Skip to content

Commit

Permalink
PR comments
Browse files Browse the repository at this point in the history
  • Loading branch information
Avasam committed Jan 6, 2023
1 parent cac4f6b commit b26e252
Show file tree
Hide file tree
Showing 13 changed files with 27 additions and 80 deletions.
7 changes: 4 additions & 3 deletions stubs/pyasn1/pyasn1/codec/ber/encoder.pyi
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
from abc import ABC, abstractmethod
from _typeshed import Incomplete
from abc import abstractmethod

from pyasn1.type.base import Asn1Type

class AbstractItemEncoder(ABC):
class AbstractItemEncoder:
supportIndefLenMode: bool
eooIntegerSubstrate: tuple[int, int]
eooOctetsSubstrate: bytes
def encodeTag(self, singleTag, isConstructed): ...
def encodeLength(self, length, defMode): ...
@abstractmethod
def encodeValue(self, value, asn1Spec, encodeFun, **options) -> None: ...
def encode(self, value, asn1Spec: Asn1Type | None = ..., encodeFun: object | None = ..., **options): ...
def encode(self, value, asn1Spec: Asn1Type | None = ..., encodeFun: Incomplete | None = ..., **options): ...

class EndOfOctetsEncoder(AbstractItemEncoder):
def encodeValue(self, value, asn1Spec, encodeFun, **options): ...
Expand Down
27 changes: 12 additions & 15 deletions stubs/pyasn1/pyasn1/codec/cer/encoder.pyi
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from typing import ClassVar

from pyasn1.codec.ber import encoder

class BooleanEncoder(encoder.IntegerEncoder):
Expand All @@ -6,23 +8,18 @@ class BooleanEncoder(encoder.IntegerEncoder):
class RealEncoder(encoder.RealEncoder): ...

class TimeEncoderMixIn:
Z_CHAR: int
PLUS_CHAR: int
MINUS_CHAR: int
COMMA_CHAR: int
DOT_CHAR: int
ZERO_CHAR: int
MIN_LENGTH: int
MAX_LENGTH: int
Z_CHAR: ClassVar[int]
PLUS_CHAR: ClassVar[int]
MINUS_CHAR: ClassVar[int]
COMMA_CHAR: ClassVar[int]
DOT_CHAR: ClassVar[int]
ZERO_CHAR: ClassVar[int]
MIN_LENGTH: ClassVar[int]
MAX_LENGTH: ClassVar[int]
def encodeValue(self, value, asn1Spec, encodeFun, **options): ...

class GeneralizedTimeEncoder(TimeEncoderMixIn, encoder.OctetStringEncoder):
MIN_LENGTH: int
MAX_LENGTH: int

class UTCTimeEncoder(TimeEncoderMixIn, encoder.OctetStringEncoder):
MIN_LENGTH: int
MAX_LENGTH: int
class GeneralizedTimeEncoder(TimeEncoderMixIn, encoder.OctetStringEncoder): ...
class UTCTimeEncoder(TimeEncoderMixIn, encoder.OctetStringEncoder): ...

class SetOfEncoder(encoder.SequenceOfEncoder):
def encodeValue(self, value, asn1Spec, encodeFun, **options): ...
Expand Down
3 changes: 1 addition & 2 deletions stubs/pyasn1/pyasn1/codec/native/decoder.pyi
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
from _typeshed import Incomplete
from abc import ABC
from collections.abc import Callable
from typing_extensions import TypeAlias

_Unused: TypeAlias = object

class AbstractScalarDecoder(ABC):
class AbstractScalarDecoder:
def __call__(self, pyObject, asn1Spec, decodeFun: _Unused = ..., **options): ...

class BitStringDecoder(AbstractScalarDecoder):
Expand Down
4 changes: 2 additions & 2 deletions stubs/pyasn1/pyasn1/codec/native/encoder.pyi
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from abc import ABC, abstractmethod
from abc import abstractmethod
from collections import OrderedDict

class AbstractItemEncoder(ABC):
class AbstractItemEncoder:
@abstractmethod
def encode(self, value, encodeFun, **options) -> None: ...

Expand Down
2 changes: 1 addition & 1 deletion stubs/pyasn1/pyasn1/error.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ class ValueConstraintError(PyAsn1Error): ...
class SubstrateUnderrunError(PyAsn1Error): ...

class PyAsn1UnicodeError(PyAsn1Error, UnicodeError):
def __init__(self, message, unicode_error: UnicodeError | object = ...) -> None: ...
def __init__(self, message, unicode_error: UnicodeError | None = ...) -> None: ...

class PyAsn1UnicodeDecodeError(PyAsn1UnicodeError, UnicodeDecodeError): ...
class PyAsn1UnicodeEncodeError(PyAsn1UnicodeError, UnicodeEncodeError): ...
4 changes: 0 additions & 4 deletions stubs/pyasn1/pyasn1/type/base.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,6 @@ class NoValue:
class SimpleAsn1Type(Asn1Type):
defaultValue: Incomplete | NoValue
def __init__(self, value=..., **kwargs) -> None: ...
def __eq__(self, other): ...
def __ne__(self, other): ...
def __lt__(self, other): ...
def __le__(self, other): ...
def __gt__(self, other): ...
Expand All @@ -128,8 +126,6 @@ class ConstructedAsn1Type(Asn1Type):
componentType: namedtype.NamedTypes | None
sizeSpec: constraint.ConstraintsIntersection
def __init__(self, **kwargs) -> None: ...
def __eq__(self, other): ...
def __ne__(self, other): ...
def __lt__(self, other): ...
def __le__(self, other): ...
def __gt__(self, other): ...
Expand Down
17 changes: 1 addition & 16 deletions stubs/pyasn1/pyasn1/type/char.pyi
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
from abc import ABC

from pyasn1.type import univ
from pyasn1.type.tag import TagSet

class AbstractCharacterString(univ.OctetString, ABC):
class AbstractCharacterString(univ.OctetString):
def __bytes__(self) -> bytes: ...
def prettyIn(self, value): ...
def asOctets(self, padding: bool = ...): ...
Expand All @@ -13,75 +11,62 @@ class AbstractCharacterString(univ.OctetString, ABC):
def __reversed__(self): ...

class NumericString(AbstractCharacterString):
__doc__: str
tagSet: TagSet
encoding: str
typeId: int

class PrintableString(AbstractCharacterString):
__doc__: str
tagSet: TagSet
encoding: str
typeId: int

class TeletexString(AbstractCharacterString):
__doc__: str
tagSet: TagSet
encoding: str
typeId: int

class T61String(TeletexString):
__doc__: str
typeId: int

class VideotexString(AbstractCharacterString):
__doc__: str
tagSet: TagSet
encoding: str
typeId: int

class IA5String(AbstractCharacterString):
__doc__: str
tagSet: TagSet
encoding: str
typeId: int

class GraphicString(AbstractCharacterString):
__doc__: str
tagSet: TagSet
encoding: str
typeId: int

class VisibleString(AbstractCharacterString):
__doc__: str
tagSet: TagSet
encoding: str
typeId: int

class ISO646String(VisibleString):
__doc__: str
typeId: int

class GeneralString(AbstractCharacterString):
__doc__: str
tagSet: TagSet
encoding: str
typeId: int

class UniversalString(AbstractCharacterString):
__doc__: str
tagSet: TagSet
encoding: str
typeId: int

class BMPString(AbstractCharacterString):
__doc__: str
tagSet: TagSet
encoding: str
typeId: int

class UTF8String(AbstractCharacterString):
__doc__: str
tagSet: TagSet
encoding: str
typeId: int
8 changes: 2 additions & 6 deletions stubs/pyasn1/pyasn1/type/constraint.pyi
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
from abc import ABC

class AbstractConstraint(ABC):
class AbstractConstraint:
def __init__(self, *values) -> None: ...
def __call__(self, value, idx: int | None = ...) -> None: ...
def __eq__(self, other): ...
def __ne__(self, other): ...
def __lt__(self, other): ...
def __le__(self, other): ...
def __gt__(self, other): ...
Expand All @@ -31,7 +27,7 @@ class WithComponentsConstraint(AbstractConstraint): ...
class InnerTypeConstraint(AbstractConstraint): ...
class ConstraintsExclusion(AbstractConstraint): ...

class AbstractConstraintSet(AbstractConstraint, ABC):
class AbstractConstraintSet(AbstractConstraint):
def __getitem__(self, idx): ...
def __iter__(self): ...
def __add__(self, value): ...
Expand Down
6 changes: 0 additions & 6 deletions stubs/pyasn1/pyasn1/type/namedtype.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ class NamedType:
isOptional: bool
isDefaulted: bool
def __init__(self, name, asn1Object, openType: type | None = ...) -> None: ...
def __eq__(self, other): ...
def __ne__(self, other): ...
def __lt__(self, other): ...
def __le__(self, other): ...
def __gt__(self, other): ...
Expand All @@ -21,17 +19,13 @@ class NamedType:
def getType(self): ...

class OptionalNamedType(NamedType):
__doc__: str
isOptional: bool

class DefaultedNamedType(NamedType):
__doc__: str
isDefaulted: bool

class NamedTypes:
def __init__(self, *namedTypes, **kwargs) -> None: ...
def __eq__(self, other): ...
def __ne__(self, other): ...
def __lt__(self, other): ...
def __le__(self, other): ...
def __gt__(self, other): ...
Expand Down
2 changes: 0 additions & 2 deletions stubs/pyasn1/pyasn1/type/namedval.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ from collections.abc import Generator

class NamedValues:
def __init__(self, *args, **kwargs) -> None: ...
def __eq__(self, other): ...
def __ne__(self, other): ...
def __lt__(self, other): ...
def __le__(self, other): ...
def __gt__(self, other): ...
Expand Down
4 changes: 0 additions & 4 deletions stubs/pyasn1/pyasn1/type/tag.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ tagCategoryUntagged: int

class Tag:
def __init__(self, tagClass, tagFormat, tagId) -> None: ...
def __eq__(self, other): ...
def __ne__(self, other): ...
def __lt__(self, other): ...
def __le__(self, other): ...
def __gt__(self, other): ...
Expand All @@ -33,8 +31,6 @@ class TagSet:
def __add__(self, superTag): ...
def __radd__(self, superTag): ...
def __getitem__(self, i): ...
def __eq__(self, other): ...
def __ne__(self, other): ...
def __lt__(self, other): ...
def __le__(self, other): ...
def __gt__(self, other): ...
Expand Down
20 changes: 4 additions & 16 deletions stubs/pyasn1/pyasn1/type/univ.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -54,12 +54,10 @@ class Integer(base.SimpleAsn1Type):
def __floor__(self): ...
def __ceil__(self): ...
def __trunc__(self): ...
def __lt__(self, value): ...
def __le__(self, value): ...
def __eq__(self, value): ...
def __ne__(self, value): ...
def __gt__(self, value): ...
def __ge__(self, value): ...
def __lt__(self, value) -> bool: ...
def __le__(self, value) -> bool: ...
def __gt__(self, value) -> bool: ...
def __ge__(self, value) -> bool: ...
def prettyIn(self, value): ...
def prettyOut(self, value): ...
def getNamedValues(self): ...
Expand All @@ -86,8 +84,6 @@ class BitString(base.SimpleAsn1Type):
defaultBinValue: str | base.NoValue
defaultHexValue: str | base.NoValue
def __init__(self, value=..., **kwargs) -> None: ...
def __eq__(self, other): ...
def __ne__(self, other): ...
def __lt__(self, other): ...
def __le__(self, other): ...
def __gt__(self, other): ...
Expand Down Expand Up @@ -207,8 +203,6 @@ class Real(base.SimpleAsn1Type):
def __trunc__(self): ...
def __lt__(self, value): ...
def __le__(self, value): ...
def __eq__(self, value): ...
def __ne__(self, value): ...
def __gt__(self, value): ...
def __ge__(self, value): ...
def __bool__(self) -> bool: ...
Expand Down Expand Up @@ -263,11 +257,9 @@ class SequenceOfAndSetOfBase(base.ConstructedAsn1Type):
def isInconsistent(self): ...

class SequenceOf(SequenceOfAndSetOfBase):
__doc__: str
typeId: int

class SetOf(SequenceOfAndSetOfBase):
__doc__: str
typeId: int

class SequenceAndSetBase(base.ConstructedAsn1Type):
Expand Down Expand Up @@ -316,7 +308,6 @@ class SequenceAndSetBase(base.ConstructedAsn1Type):
def getNameByPosition(self, idx): ...

class Sequence(SequenceAndSetBase):
__doc__: str
tagSet: TagSet
subtypeSpec: constraint.ConstraintsIntersection
componentType: namedtype.NamedTypes
Expand All @@ -325,7 +316,6 @@ class Sequence(SequenceAndSetBase):
def getComponentPositionNearType(self, tagSet, idx): ...

class Set(SequenceAndSetBase):
__doc__: str
tagSet: TagSet
componentType: namedtype.NamedTypes
subtypeSpec: constraint.ConstraintsIntersection
Expand All @@ -349,8 +339,6 @@ class Choice(Set):
componentType: namedtype.NamedTypes
subtypeSpec: constraint.ConstraintsIntersection
typeId: int
def __eq__(self, other): ...
def __ne__(self, other): ...
def __lt__(self, other): ...
def __le__(self, other): ...
def __gt__(self, other): ...
Expand Down
3 changes: 0 additions & 3 deletions stubs/pyasn1/pyasn1/type/useful.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ from pyasn1.type import char
from pyasn1.type.tag import TagSet

class ObjectDescriptor(char.GraphicString):
__doc__: str
tagSet: TagSet
typeId: int

Expand All @@ -21,11 +20,9 @@ class TimeMixIn:
def fromDateTime(cls, dt): ...

class GeneralizedTime(char.VisibleString, TimeMixIn):
__doc__: str
tagSet: TagSet
typeId: int

class UTCTime(char.VisibleString, TimeMixIn):
__doc__: str
tagSet: TagSet
typeId: int

0 comments on commit b26e252

Please sign in to comment.