Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add some initial support for typechecking. #286

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ pb_fetch:

pb_compile:
for filepath in ./protobufs/*.proto; do \
protoc3 --python_out ./steam/protobufs/ --proto_path=./protobufs "$$filepath"; \
protoc --plugin mypy_protobuf --python_out ./steam/protobufs/ --mypy_out steam/protobufs/ --proto_path=./protobufs "$$filepath"; \
done;
sed -i '/^import sys/! s/^import /import steam.protobufs./' steam/protobufs/*_pb2.py

Expand Down
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,4 @@ mock==1.3.0
PyYAML==5.1
vcrpy==2.0.1
cachetools>=3.0.0
mypy-protobuf>=1.23
Empty file added steam/enums/py.typed
Empty file.
194 changes: 194 additions & 0 deletions steam/protobufs/content_manifest_pb2.pyi
Original file line number Diff line number Diff line change
@@ -0,0 +1,194 @@
# @generated by generate_proto_mypy_stubs.py. Do not edit!
import sys
from google.protobuf.descriptor import (
Descriptor as google___protobuf___descriptor___Descriptor,
EnumDescriptor as google___protobuf___descriptor___EnumDescriptor,
FileDescriptor as google___protobuf___descriptor___FileDescriptor,
)

from google.protobuf.internal.containers import (
RepeatedCompositeFieldContainer as google___protobuf___internal___containers___RepeatedCompositeFieldContainer,
)

from google.protobuf.internal.enum_type_wrapper import (
_EnumTypeWrapper as google___protobuf___internal___enum_type_wrapper____EnumTypeWrapper,
)

from google.protobuf.message import (
Message as google___protobuf___message___Message,
)

from typing import (
Iterable as typing___Iterable,
NewType as typing___NewType,
Optional as typing___Optional,
Text as typing___Text,
cast as typing___cast,
)

from typing_extensions import (
Literal as typing_extensions___Literal,
)


builtin___bool = bool
builtin___bytes = bytes
builtin___float = float
builtin___int = int


DESCRIPTOR: google___protobuf___descriptor___FileDescriptor = ...

EContentDeltaChunkDataLocationValue = typing___NewType('EContentDeltaChunkDataLocationValue', builtin___int)
type___EContentDeltaChunkDataLocationValue = EContentDeltaChunkDataLocationValue
EContentDeltaChunkDataLocation: _EContentDeltaChunkDataLocation
class _EContentDeltaChunkDataLocation(google___protobuf___internal___enum_type_wrapper____EnumTypeWrapper[EContentDeltaChunkDataLocationValue]):
DESCRIPTOR: google___protobuf___descriptor___EnumDescriptor = ...
k_EContentDeltaChunkDataLocationInProtobuf = typing___cast(EContentDeltaChunkDataLocationValue, 0)
k_EContentDeltaChunkDataLocationAfterProtobuf = typing___cast(EContentDeltaChunkDataLocationValue, 1)
k_EContentDeltaChunkDataLocationInProtobuf = typing___cast(EContentDeltaChunkDataLocationValue, 0)
k_EContentDeltaChunkDataLocationAfterProtobuf = typing___cast(EContentDeltaChunkDataLocationValue, 1)
type___EContentDeltaChunkDataLocation = EContentDeltaChunkDataLocation

class ContentManifestPayload(google___protobuf___message___Message):
DESCRIPTOR: google___protobuf___descriptor___Descriptor = ...
class FileMapping(google___protobuf___message___Message):
DESCRIPTOR: google___protobuf___descriptor___Descriptor = ...
class ChunkData(google___protobuf___message___Message):
DESCRIPTOR: google___protobuf___descriptor___Descriptor = ...
sha: builtin___bytes = ...
crc: builtin___int = ...
offset: builtin___int = ...
cb_original: builtin___int = ...
cb_compressed: builtin___int = ...

def __init__(self,
*,
sha : typing___Optional[builtin___bytes] = None,
crc : typing___Optional[builtin___int] = None,
offset : typing___Optional[builtin___int] = None,
cb_original : typing___Optional[builtin___int] = None,
cb_compressed : typing___Optional[builtin___int] = None,
) -> None: ...
def HasField(self, field_name: typing_extensions___Literal[u"cb_compressed",b"cb_compressed",u"cb_original",b"cb_original",u"crc",b"crc",u"offset",b"offset",u"sha",b"sha"]) -> builtin___bool: ...
def ClearField(self, field_name: typing_extensions___Literal[u"cb_compressed",b"cb_compressed",u"cb_original",b"cb_original",u"crc",b"crc",u"offset",b"offset",u"sha",b"sha"]) -> None: ...
type___ChunkData = ChunkData

filename: typing___Text = ...
size: builtin___int = ...
flags: builtin___int = ...
sha_filename: builtin___bytes = ...
sha_content: builtin___bytes = ...
linktarget: typing___Text = ...

@property
def chunks(self) -> google___protobuf___internal___containers___RepeatedCompositeFieldContainer[type___ContentManifestPayload.FileMapping.ChunkData]: ...

def __init__(self,
*,
filename : typing___Optional[typing___Text] = None,
size : typing___Optional[builtin___int] = None,
flags : typing___Optional[builtin___int] = None,
sha_filename : typing___Optional[builtin___bytes] = None,
sha_content : typing___Optional[builtin___bytes] = None,
chunks : typing___Optional[typing___Iterable[type___ContentManifestPayload.FileMapping.ChunkData]] = None,
linktarget : typing___Optional[typing___Text] = None,
) -> None: ...
def HasField(self, field_name: typing_extensions___Literal[u"filename",b"filename",u"flags",b"flags",u"linktarget",b"linktarget",u"sha_content",b"sha_content",u"sha_filename",b"sha_filename",u"size",b"size"]) -> builtin___bool: ...
def ClearField(self, field_name: typing_extensions___Literal[u"chunks",b"chunks",u"filename",b"filename",u"flags",b"flags",u"linktarget",b"linktarget",u"sha_content",b"sha_content",u"sha_filename",b"sha_filename",u"size",b"size"]) -> None: ...
type___FileMapping = FileMapping


@property
def mappings(self) -> google___protobuf___internal___containers___RepeatedCompositeFieldContainer[type___ContentManifestPayload.FileMapping]: ...

def __init__(self,
*,
mappings : typing___Optional[typing___Iterable[type___ContentManifestPayload.FileMapping]] = None,
) -> None: ...
def ClearField(self, field_name: typing_extensions___Literal[u"mappings",b"mappings"]) -> None: ...
type___ContentManifestPayload = ContentManifestPayload

class ContentManifestMetadata(google___protobuf___message___Message):
DESCRIPTOR: google___protobuf___descriptor___Descriptor = ...
depot_id: builtin___int = ...
gid_manifest: builtin___int = ...
creation_time: builtin___int = ...
filenames_encrypted: builtin___bool = ...
cb_disk_original: builtin___int = ...
cb_disk_compressed: builtin___int = ...
unique_chunks: builtin___int = ...
crc_encrypted: builtin___int = ...
crc_clear: builtin___int = ...

def __init__(self,
*,
depot_id : typing___Optional[builtin___int] = None,
gid_manifest : typing___Optional[builtin___int] = None,
creation_time : typing___Optional[builtin___int] = None,
filenames_encrypted : typing___Optional[builtin___bool] = None,
cb_disk_original : typing___Optional[builtin___int] = None,
cb_disk_compressed : typing___Optional[builtin___int] = None,
unique_chunks : typing___Optional[builtin___int] = None,
crc_encrypted : typing___Optional[builtin___int] = None,
crc_clear : typing___Optional[builtin___int] = None,
) -> None: ...
def HasField(self, field_name: typing_extensions___Literal[u"cb_disk_compressed",b"cb_disk_compressed",u"cb_disk_original",b"cb_disk_original",u"crc_clear",b"crc_clear",u"crc_encrypted",b"crc_encrypted",u"creation_time",b"creation_time",u"depot_id",b"depot_id",u"filenames_encrypted",b"filenames_encrypted",u"gid_manifest",b"gid_manifest",u"unique_chunks",b"unique_chunks"]) -> builtin___bool: ...
def ClearField(self, field_name: typing_extensions___Literal[u"cb_disk_compressed",b"cb_disk_compressed",u"cb_disk_original",b"cb_disk_original",u"crc_clear",b"crc_clear",u"crc_encrypted",b"crc_encrypted",u"creation_time",b"creation_time",u"depot_id",b"depot_id",u"filenames_encrypted",b"filenames_encrypted",u"gid_manifest",b"gid_manifest",u"unique_chunks",b"unique_chunks"]) -> None: ...
type___ContentManifestMetadata = ContentManifestMetadata

class ContentManifestSignature(google___protobuf___message___Message):
DESCRIPTOR: google___protobuf___descriptor___Descriptor = ...
signature: builtin___bytes = ...

def __init__(self,
*,
signature : typing___Optional[builtin___bytes] = None,
) -> None: ...
def HasField(self, field_name: typing_extensions___Literal[u"signature",b"signature"]) -> builtin___bool: ...
def ClearField(self, field_name: typing_extensions___Literal[u"signature",b"signature"]) -> None: ...
type___ContentManifestSignature = ContentManifestSignature

class ContentDeltaChunks(google___protobuf___message___Message):
DESCRIPTOR: google___protobuf___descriptor___Descriptor = ...
class DeltaChunk(google___protobuf___message___Message):
DESCRIPTOR: google___protobuf___descriptor___Descriptor = ...
sha_source: builtin___bytes = ...
sha_target: builtin___bytes = ...
size_original: builtin___int = ...
patch_method: builtin___int = ...
chunk: builtin___bytes = ...
size_delta: builtin___int = ...

def __init__(self,
*,
sha_source : typing___Optional[builtin___bytes] = None,
sha_target : typing___Optional[builtin___bytes] = None,
size_original : typing___Optional[builtin___int] = None,
patch_method : typing___Optional[builtin___int] = None,
chunk : typing___Optional[builtin___bytes] = None,
size_delta : typing___Optional[builtin___int] = None,
) -> None: ...
def HasField(self, field_name: typing_extensions___Literal[u"chunk",b"chunk",u"patch_method",b"patch_method",u"sha_source",b"sha_source",u"sha_target",b"sha_target",u"size_delta",b"size_delta",u"size_original",b"size_original"]) -> builtin___bool: ...
def ClearField(self, field_name: typing_extensions___Literal[u"chunk",b"chunk",u"patch_method",b"patch_method",u"sha_source",b"sha_source",u"sha_target",b"sha_target",u"size_delta",b"size_delta",u"size_original",b"size_original"]) -> None: ...
type___DeltaChunk = DeltaChunk

depot_id: builtin___int = ...
manifest_id_source: builtin___int = ...
manifest_id_target: builtin___int = ...
chunk_data_location: type___EContentDeltaChunkDataLocationValue = ...

@property
def deltaChunks(self) -> google___protobuf___internal___containers___RepeatedCompositeFieldContainer[type___ContentDeltaChunks.DeltaChunk]: ...

def __init__(self,
*,
depot_id : typing___Optional[builtin___int] = None,
manifest_id_source : typing___Optional[builtin___int] = None,
manifest_id_target : typing___Optional[builtin___int] = None,
deltaChunks : typing___Optional[typing___Iterable[type___ContentDeltaChunks.DeltaChunk]] = None,
chunk_data_location : typing___Optional[type___EContentDeltaChunkDataLocationValue] = None,
) -> None: ...
def HasField(self, field_name: typing_extensions___Literal[u"chunk_data_location",b"chunk_data_location",u"depot_id",b"depot_id",u"manifest_id_source",b"manifest_id_source",u"manifest_id_target",b"manifest_id_target"]) -> builtin___bool: ...
def ClearField(self, field_name: typing_extensions___Literal[u"chunk_data_location",b"chunk_data_location",u"deltaChunks",b"deltaChunks",u"depot_id",b"depot_id",u"manifest_id_source",b"manifest_id_source",u"manifest_id_target",b"manifest_id_target"]) -> None: ...
type___ContentDeltaChunks = ContentDeltaChunks
47 changes: 47 additions & 0 deletions steam/protobufs/encrypted_app_ticket_pb2.pyi
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# @generated by generate_proto_mypy_stubs.py. Do not edit!
import sys
from google.protobuf.descriptor import (
Descriptor as google___protobuf___descriptor___Descriptor,
FileDescriptor as google___protobuf___descriptor___FileDescriptor,
)

from google.protobuf.message import (
Message as google___protobuf___message___Message,
)

from typing import (
Optional as typing___Optional,
)

from typing_extensions import (
Literal as typing_extensions___Literal,
)


builtin___bool = bool
builtin___bytes = bytes
builtin___float = float
builtin___int = int


DESCRIPTOR: google___protobuf___descriptor___FileDescriptor = ...

class EncryptedAppTicket(google___protobuf___message___Message):
DESCRIPTOR: google___protobuf___descriptor___Descriptor = ...
ticket_version_no: builtin___int = ...
crc_encryptedticket: builtin___int = ...
cb_encrypteduserdata: builtin___int = ...
cb_encrypted_appownershipticket: builtin___int = ...
encrypted_ticket: builtin___bytes = ...

def __init__(self,
*,
ticket_version_no : typing___Optional[builtin___int] = None,
crc_encryptedticket : typing___Optional[builtin___int] = None,
cb_encrypteduserdata : typing___Optional[builtin___int] = None,
cb_encrypted_appownershipticket : typing___Optional[builtin___int] = None,
encrypted_ticket : typing___Optional[builtin___bytes] = None,
) -> None: ...
def HasField(self, field_name: typing_extensions___Literal[u"cb_encrypted_appownershipticket",b"cb_encrypted_appownershipticket",u"cb_encrypteduserdata",b"cb_encrypteduserdata",u"crc_encryptedticket",b"crc_encryptedticket",u"encrypted_ticket",b"encrypted_ticket",u"ticket_version_no",b"ticket_version_no"]) -> builtin___bool: ...
def ClearField(self, field_name: typing_extensions___Literal[u"cb_encrypted_appownershipticket",b"cb_encrypted_appownershipticket",u"cb_encrypteduserdata",b"cb_encrypteduserdata",u"crc_encryptedticket",b"crc_encryptedticket",u"encrypted_ticket",b"encrypted_ticket",u"ticket_version_no",b"ticket_version_no"]) -> None: ...
type___EncryptedAppTicket = EncryptedAppTicket
82 changes: 82 additions & 0 deletions steam/protobufs/gc_pb2.pyi
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
# @generated by generate_proto_mypy_stubs.py. Do not edit!
import sys
from google.protobuf.descriptor import (
Descriptor as google___protobuf___descriptor___Descriptor,
EnumDescriptor as google___protobuf___descriptor___EnumDescriptor,
FileDescriptor as google___protobuf___descriptor___FileDescriptor,
)

from google.protobuf.internal.enum_type_wrapper import (
_EnumTypeWrapper as google___protobuf___internal___enum_type_wrapper____EnumTypeWrapper,
)

from google.protobuf.message import (
Message as google___protobuf___message___Message,
)

from typing import (
NewType as typing___NewType,
Optional as typing___Optional,
Text as typing___Text,
cast as typing___cast,
)

from typing_extensions import (
Literal as typing_extensions___Literal,
)


builtin___bool = bool
builtin___bytes = bytes
builtin___float = float
builtin___int = int


DESCRIPTOR: google___protobuf___descriptor___FileDescriptor = ...

GCProtoBufMsgSrcValue = typing___NewType('GCProtoBufMsgSrcValue', builtin___int)
type___GCProtoBufMsgSrcValue = GCProtoBufMsgSrcValue
GCProtoBufMsgSrc: _GCProtoBufMsgSrc
class _GCProtoBufMsgSrc(google___protobuf___internal___enum_type_wrapper____EnumTypeWrapper[GCProtoBufMsgSrcValue]):
DESCRIPTOR: google___protobuf___descriptor___EnumDescriptor = ...
GCProtoBufMsgSrc_Unspecified = typing___cast(GCProtoBufMsgSrcValue, 0)
GCProtoBufMsgSrc_FromSystem = typing___cast(GCProtoBufMsgSrcValue, 1)
GCProtoBufMsgSrc_FromSteamID = typing___cast(GCProtoBufMsgSrcValue, 2)
GCProtoBufMsgSrc_FromGC = typing___cast(GCProtoBufMsgSrcValue, 3)
GCProtoBufMsgSrc_ReplySystem = typing___cast(GCProtoBufMsgSrcValue, 4)
GCProtoBufMsgSrc_Unspecified = typing___cast(GCProtoBufMsgSrcValue, 0)
GCProtoBufMsgSrc_FromSystem = typing___cast(GCProtoBufMsgSrcValue, 1)
GCProtoBufMsgSrc_FromSteamID = typing___cast(GCProtoBufMsgSrcValue, 2)
GCProtoBufMsgSrc_FromGC = typing___cast(GCProtoBufMsgSrcValue, 3)
GCProtoBufMsgSrc_ReplySystem = typing___cast(GCProtoBufMsgSrcValue, 4)
type___GCProtoBufMsgSrc = GCProtoBufMsgSrc

class CMsgProtoBufHeader(google___protobuf___message___Message):
DESCRIPTOR: google___protobuf___descriptor___Descriptor = ...
client_steam_id: builtin___int = ...
client_session_id: builtin___int = ...
source_app_id: builtin___int = ...
job_id_source: builtin___int = ...
job_id_target: builtin___int = ...
target_job_name: typing___Text = ...
eresult: builtin___int = ...
error_message: typing___Text = ...
gc_msg_src: type___GCProtoBufMsgSrcValue = ...
gc_dir_index_source: builtin___int = ...

def __init__(self,
*,
client_steam_id : typing___Optional[builtin___int] = None,
client_session_id : typing___Optional[builtin___int] = None,
source_app_id : typing___Optional[builtin___int] = None,
job_id_source : typing___Optional[builtin___int] = None,
job_id_target : typing___Optional[builtin___int] = None,
target_job_name : typing___Optional[typing___Text] = None,
eresult : typing___Optional[builtin___int] = None,
error_message : typing___Optional[typing___Text] = None,
gc_msg_src : typing___Optional[type___GCProtoBufMsgSrcValue] = None,
gc_dir_index_source : typing___Optional[builtin___int] = None,
) -> None: ...
def HasField(self, field_name: typing_extensions___Literal[u"client_session_id",b"client_session_id",u"client_steam_id",b"client_steam_id",u"eresult",b"eresult",u"error_message",b"error_message",u"gc_dir_index_source",b"gc_dir_index_source",u"gc_msg_src",b"gc_msg_src",u"job_id_source",b"job_id_source",u"job_id_target",b"job_id_target",u"source_app_id",b"source_app_id",u"target_job_name",b"target_job_name"]) -> builtin___bool: ...
def ClearField(self, field_name: typing_extensions___Literal[u"client_session_id",b"client_session_id",u"client_steam_id",b"client_steam_id",u"eresult",b"eresult",u"error_message",b"error_message",u"gc_dir_index_source",b"gc_dir_index_source",u"gc_msg_src",b"gc_msg_src",u"job_id_source",b"job_id_source",u"job_id_target",b"job_id_target",u"source_app_id",b"source_app_id",u"target_job_name",b"target_job_name"]) -> None: ...
type___CMsgProtoBufHeader = CMsgProtoBufHeader
Empty file added steam/protobufs/py.typed
Empty file.
Loading