-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Add stubs for pyasn1
#9437
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
Merged
Merged
Add stubs for pyasn1
#9437
Changes from 2 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
2cbee87
Initial stub
Avasam ade1913
Completed most Incomplete types
Avasam cac4f6b
More direct compat types
Avasam b26e252
PR comments
Avasam 609bda6
Apply fix from last round of code review that was missed
AlexWaygood 3b42d6e
Revert comparison dunder changes
Avasam 74ecb46
Merge branch 'pyasn1-stubs' of https://github.com/Avasam/typeshed int…
Avasam File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# Unintended re-exports | ||
pyasn1.compat.binary.version_info | ||
pyasn1.compat.octets.version_info | ||
pyasn1.compat.string.version_info | ||
|
||
# type_check_only | ||
pyasn1.type.base.NoValue.plug | ||
|
||
# typeshed typing differences with runtime collections.OrderedDict and builtins.dict | ||
pyasn1.codec.native.encoder.SequenceEncoder.protoDict | ||
pyasn1.codec.native.encoder.SetEncoder.protoDict | ||
|
||
# Attempted "__ne__" operation on ASN.1 schema object | ||
pyasn1.type.base | ||
pyasn1.type.univ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
version = "0.4.*" | ||
|
||
[tool.stubtest] | ||
ignore_missing_stub = false |
Empty file.
Empty file.
Empty file.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,337 @@ | ||
from _typeshed import Incomplete | ||
from abc import ABCMeta, abstractmethod | ||
from collections.abc import Callable | ||
from typing_extensions import TypeAlias | ||
|
||
from pyasn1.type import base, char, univ, useful | ||
from pyasn1.type.base import Asn1Type | ||
from pyasn1.type.tag import TagSet | ||
|
||
_Unused: TypeAlias = object | ||
|
||
class AbstractDecoder(metaclass=ABCMeta): | ||
protoComponent: Asn1Type | None | ||
@abstractmethod | ||
def valueDecoder( | ||
self, | ||
substrate, | ||
asn1Spec, | ||
tagSet: TagSet | None = ..., | ||
length: int | None = ..., | ||
state: Incomplete | None = ..., | ||
decodeFun: Callable[..., Incomplete] | None = ..., | ||
substrateFun: Callable[..., Incomplete] | None = ..., | ||
**options, | ||
) -> None: ... | ||
# Abstract, but implementation is optional | ||
def indefLenValueDecoder( | ||
self, | ||
substrate, | ||
asn1Spec, | ||
tagSet: TagSet | None = ..., | ||
length: int | None = ..., | ||
state: Incomplete | None = ..., | ||
decodeFun: Callable[..., Incomplete] | None = ..., | ||
substrateFun: Callable[..., Incomplete] | None = ..., | ||
**options, | ||
) -> None: ... | ||
|
||
class AbstractSimpleDecoder(AbstractDecoder, metaclass=ABCMeta): | ||
AlexWaygood marked this conversation as resolved.
Show resolved
Hide resolved
|
||
@staticmethod | ||
def substrateCollector(asn1Object, substrate, length): ... | ||
|
||
class ExplicitTagDecoder(AbstractSimpleDecoder): | ||
protoComponent: univ.Any | ||
def valueDecoder( | ||
self, | ||
substrate, | ||
asn1Spec, | ||
tagSet: TagSet | None = ..., | ||
length: int | None = ..., | ||
state: _Unused = ..., | ||
decodeFun: Callable[..., Incomplete] | None = ..., | ||
substrateFun: Callable[..., Incomplete] | None = ..., | ||
**options, | ||
): ... | ||
def indefLenValueDecoder( | ||
self, | ||
substrate, | ||
asn1Spec, | ||
tagSet: TagSet | None = ..., | ||
length: int | None = ..., | ||
state: _Unused = ..., | ||
decodeFun: Callable[..., Incomplete] | None = ..., | ||
substrateFun: Callable[..., Incomplete] | None = ..., | ||
**options, | ||
): ... | ||
|
||
class IntegerDecoder(AbstractSimpleDecoder): | ||
protoComponent: univ.Integer | ||
def valueDecoder( | ||
self, | ||
substrate, | ||
asn1Spec, | ||
tagSet: TagSet | None = ..., | ||
length: int | None = ..., | ||
state: _Unused = ..., | ||
decodeFun: _Unused = ..., | ||
substrateFun: _Unused = ..., | ||
**options, | ||
): ... | ||
|
||
class BooleanDecoder(IntegerDecoder): | ||
protoComponent: univ.Boolean | ||
|
||
class BitStringDecoder(AbstractSimpleDecoder): | ||
protoComponent: univ.BitString | ||
supportConstructedForm: bool | ||
def valueDecoder( | ||
self, | ||
substrate, | ||
asn1Spec, | ||
tagSet: TagSet | None = ..., | ||
length: int | None = ..., | ||
state: _Unused = ..., | ||
decodeFun: Callable[..., Incomplete] | None = ..., | ||
substrateFun: Callable[..., Incomplete] | None = ..., | ||
**options, | ||
): ... | ||
def indefLenValueDecoder( | ||
self, | ||
substrate, | ||
asn1Spec, | ||
tagSet: TagSet | None = ..., | ||
length: int | None = ..., | ||
state: _Unused = ..., | ||
decodeFun: Callable[..., Incomplete] | None = ..., | ||
substrateFun: Callable[..., Incomplete] | None = ..., | ||
**options, | ||
): ... | ||
|
||
class OctetStringDecoder(AbstractSimpleDecoder): | ||
protoComponent: univ.OctetString | ||
supportConstructedForm: bool | ||
def valueDecoder( | ||
self, | ||
substrate, | ||
asn1Spec, | ||
tagSet: TagSet | None = ..., | ||
length: int | None = ..., | ||
state: _Unused = ..., | ||
decodeFun: Callable[..., Incomplete] | None = ..., | ||
substrateFun: Callable[..., Incomplete] | None = ..., | ||
**options, | ||
): ... | ||
def indefLenValueDecoder( | ||
self, | ||
substrate, | ||
asn1Spec, | ||
tagSet: TagSet | None = ..., | ||
length: int | None = ..., | ||
state: _Unused = ..., | ||
decodeFun: Callable[..., Incomplete] | None = ..., | ||
substrateFun: Callable[..., Incomplete] | None = ..., | ||
**options, | ||
): ... | ||
|
||
class NullDecoder(AbstractSimpleDecoder): | ||
protoComponent: univ.Null | ||
def valueDecoder( | ||
self, | ||
substrate, | ||
asn1Spec, | ||
tagSet: TagSet | None = ..., | ||
length: int | None = ..., | ||
state: _Unused = ..., | ||
decodeFun: _Unused = ..., | ||
substrateFun: _Unused = ..., | ||
**options, | ||
): ... | ||
|
||
class ObjectIdentifierDecoder(AbstractSimpleDecoder): | ||
protoComponent: univ.ObjectIdentifier | ||
def valueDecoder( | ||
self, | ||
substrate, | ||
asn1Spec, | ||
tagSet: TagSet | None = ..., | ||
length: int | None = ..., | ||
state: _Unused = ..., | ||
decodeFun: _Unused = ..., | ||
substrateFun: _Unused = ..., | ||
**options, | ||
): ... | ||
|
||
class RealDecoder(AbstractSimpleDecoder): | ||
protoComponent: univ.Real | ||
def valueDecoder( | ||
self, | ||
substrate, | ||
asn1Spec, | ||
tagSet: TagSet | None = ..., | ||
length: int | None = ..., | ||
state: _Unused = ..., | ||
decodeFun: _Unused = ..., | ||
substrateFun: _Unused = ..., | ||
**options, | ||
): ... | ||
|
||
class AbstractConstructedDecoder(AbstractDecoder, metaclass=ABCMeta): | ||
protoComponent: base.ConstructedAsn1Type | None | ||
|
||
class UniversalConstructedTypeDecoder(AbstractConstructedDecoder): | ||
protoRecordComponent: univ.SequenceAndSetBase | None | ||
protoSequenceComponent: univ.SequenceOfAndSetOfBase | None | ||
def valueDecoder( | ||
self, | ||
substrate, | ||
asn1Spec, | ||
tagSet: TagSet | None = ..., | ||
length: int | None = ..., | ||
state: _Unused = ..., | ||
decodeFun: Callable[..., Incomplete] | None = ..., | ||
substrateFun: Callable[..., Incomplete] | None = ..., | ||
**options, | ||
): ... | ||
def indefLenValueDecoder( | ||
self, | ||
substrate, | ||
asn1Spec, | ||
tagSet: TagSet | None = ..., | ||
length: int | None = ..., | ||
state: _Unused = ..., | ||
decodeFun: Callable[..., Incomplete] | None = ..., | ||
substrateFun: Callable[..., Incomplete] | None = ..., | ||
**options, | ||
): ... | ||
|
||
class SequenceOrSequenceOfDecoder(UniversalConstructedTypeDecoder): | ||
protoRecordComponent: univ.Sequence | ||
protoSequenceComponent: univ.SequenceOf | ||
|
||
class SequenceDecoder(SequenceOrSequenceOfDecoder): | ||
protoComponent: univ.Sequence | ||
|
||
class SequenceOfDecoder(SequenceOrSequenceOfDecoder): | ||
protoComponent: univ.SequenceOf | ||
|
||
class SetOrSetOfDecoder(UniversalConstructedTypeDecoder): | ||
protoRecordComponent: univ.Set | ||
protoSequenceComponent: univ.SetOf | ||
|
||
class SetDecoder(SetOrSetOfDecoder): | ||
protoComponent: univ.Set | ||
|
||
class SetOfDecoder(SetOrSetOfDecoder): | ||
protoComponent: univ.SetOf | ||
|
||
class ChoiceDecoder(AbstractConstructedDecoder): | ||
protoComponent: univ.Choice | ||
def valueDecoder( | ||
self, | ||
substrate, | ||
asn1Spec, | ||
tagSet: TagSet | None = ..., | ||
length: int | None = ..., | ||
state: Incomplete | None = ..., | ||
decodeFun: Callable[..., Incomplete] | None = ..., | ||
substrateFun: Callable[..., Incomplete] | None = ..., | ||
**options, | ||
): ... | ||
def indefLenValueDecoder( | ||
self, | ||
substrate, | ||
asn1Spec, | ||
tagSet: TagSet | None = ..., | ||
length: int | None = ..., | ||
state: Incomplete | None = ..., | ||
decodeFun: Callable[..., Incomplete] | None = ..., | ||
substrateFun: Callable[..., Incomplete] | None = ..., | ||
**options, | ||
): ... | ||
|
||
class AnyDecoder(AbstractSimpleDecoder): | ||
protoComponent: univ.Any | ||
def valueDecoder( | ||
self, | ||
substrate, | ||
asn1Spec, | ||
tagSet: TagSet | None = ..., | ||
length: int | None = ..., | ||
state: _Unused = ..., | ||
decodeFun: _Unused = ..., | ||
substrateFun: Callable[..., Incomplete] | None = ..., | ||
**options, | ||
): ... | ||
def indefLenValueDecoder( | ||
self, | ||
substrate, | ||
asn1Spec, | ||
tagSet: TagSet | None = ..., | ||
length: int | None = ..., | ||
state: _Unused = ..., | ||
decodeFun: Callable[..., Incomplete] | None = ..., | ||
substrateFun: Callable[..., Incomplete] | None = ..., | ||
**options, | ||
): ... | ||
|
||
class UTF8StringDecoder(OctetStringDecoder): | ||
protoComponent: char.UTF8String | ||
|
||
class NumericStringDecoder(OctetStringDecoder): | ||
protoComponent: char.NumericString | ||
|
||
class PrintableStringDecoder(OctetStringDecoder): | ||
protoComponent: char.PrintableString | ||
|
||
class TeletexStringDecoder(OctetStringDecoder): | ||
protoComponent: char.TeletexString | ||
|
||
class VideotexStringDecoder(OctetStringDecoder): | ||
protoComponent: char.VideotexString | ||
|
||
class IA5StringDecoder(OctetStringDecoder): | ||
protoComponent: char.IA5String | ||
|
||
class GraphicStringDecoder(OctetStringDecoder): | ||
protoComponent: char.GraphicString | ||
|
||
class VisibleStringDecoder(OctetStringDecoder): | ||
protoComponent: char.VisibleString | ||
|
||
class GeneralStringDecoder(OctetStringDecoder): | ||
protoComponent: char.GeneralString | ||
|
||
class UniversalStringDecoder(OctetStringDecoder): | ||
protoComponent: char.UniversalString | ||
|
||
class BMPStringDecoder(OctetStringDecoder): | ||
protoComponent: char.BMPString | ||
|
||
class ObjectDescriptorDecoder(OctetStringDecoder): | ||
protoComponent: useful.ObjectDescriptor | ||
|
||
class GeneralizedTimeDecoder(OctetStringDecoder): | ||
protoComponent: useful.GeneralizedTime | ||
|
||
class UTCTimeDecoder(OctetStringDecoder): | ||
protoComponent: useful.UTCTime | ||
|
||
class Decoder: | ||
defaultErrorState: int | ||
defaultRawDecoder: AnyDecoder | ||
supportIndefLength: bool | ||
def __init__(self, tagMap, typeMap=...) -> None: ... | ||
def __call__( | ||
self, | ||
substrate, | ||
asn1Spec: Asn1Type | None = ..., | ||
tagSet: TagSet | None = ..., | ||
length: int | None = ..., | ||
state=..., | ||
decodeFun: _Unused = ..., | ||
substrateFun: Callable[..., Incomplete] | None = ..., | ||
**options, | ||
): ... | ||
|
||
decode: Decoder |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.