Add third-party vobject stubs (#5733)

This commit is contained in:
Sebastian Rittau
2021-07-09 03:26:24 +02:00
committed by GitHub
parent 788b20e326
commit a7446632f7
12 changed files with 604 additions and 0 deletions

View File

@@ -46,6 +46,7 @@
"stubs/redis",
"stubs/requests",
"stubs/simplejson",
"stubs/vobject",
"stubs/waitress",
"stubs/Werkzeug"
],

View File

@@ -0,0 +1,5 @@
# implementation has *args and **kwds arguments that can't be used
vobject.base.VBase.__init__
# only available on Windows
vobject.win32tz

View File

@@ -0,0 +1 @@
version = "0.9"

View File

@@ -0,0 +1,4 @@
from .base import Component
def iCalendar() -> Component: ...
def vCard() -> Component: ...

View File

@@ -0,0 +1,151 @@
from _typeshed import SupportsWrite
from collections.abc import Iterable
from typing import Any, TypeVar, overload
from typing_extensions import Literal
DEBUG: bool
CR: str
LF: str
CRLF: str
SPACE: str
TAB: str
SPACEORTAB: str
_V = TypeVar("_V", bound=VBase)
_W = TypeVar("_W", bound=SupportsWrite[bytes])
class VBase:
group: Any | None
behavior: Any | None
parentBehavior: Any | None
isNative: bool
def __init__(self, group: Any | None = ...) -> None: ...
def copy(self, copyit: VBase) -> None: ...
def validate(self, *args, **kwds) -> bool: ...
def getChildren(self) -> list[Any]: ...
def clearBehavior(self, cascade: bool = ...) -> None: ...
def autoBehavior(self, cascade: bool = ...) -> None: ...
def setBehavior(self, behavior, cascade: bool = ...) -> None: ...
def transformToNative(self): ...
def transformFromNative(self): ...
def transformChildrenToNative(self) -> None: ...
def transformChildrenFromNative(self, clearBehavior: bool = ...) -> None: ...
@overload
def serialize(self, buf: None = ..., lineLength: int = ..., validate: bool = ..., behavior: Any | None = ...) -> str: ...
@overload
def serialize(self, buf: _W, lineLength: int = ..., validate: bool = ..., behavior: Any | None = ...) -> _W: ...
def toVName(name, stripNum: int = ..., upper: bool = ...): ...
class ContentLine(VBase):
name: Any
encoded: Any
params: Any
singletonparams: Any
isNative: Any
lineNumber: Any
value: Any
def __init__(
self,
name,
params,
value,
group: Any | None = ...,
encoded: bool = ...,
isNative: bool = ...,
lineNumber: Any | None = ...,
*args,
**kwds,
) -> None: ...
@classmethod
def duplicate(cls, copyit): ...
def copy(self, copyit) -> None: ...
def __eq__(self, other): ...
def __getattr__(self, name): ...
def __setattr__(self, name, value) -> None: ...
def __delattr__(self, name) -> None: ...
def valueRepr(self): ...
def __unicode__(self): ...
def prettyPrint(self, level: int = ..., tabwidth: int = ...) -> None: ...
class Component(VBase):
contents: dict[str, list[VBase]]
name: Any
useBegin: bool
def __init__(self, name: Any | None = ..., *args, **kwds) -> None: ...
@classmethod
def duplicate(cls, copyit): ...
def copy(self, copyit) -> None: ...
def setProfile(self, name) -> None: ...
def __getattr__(self, name): ...
normal_attributes: Any
def __setattr__(self, name, value) -> None: ...
def __delattr__(self, name) -> None: ...
def getChildValue(self, childName, default: Any | None = ..., childNumber: int = ...): ...
@overload
def add(self, objOrName: _V, group: str | None = ...) -> _V: ...
@overload
def add(self, objOrName: Literal["vevent"], group: str | None = ...) -> Component: ...
@overload
def add(
self, objOrName: Literal["uid", "summary", "description", "dtstart", "dtend"], group: str | None = ...
) -> ContentLine: ...
@overload
def add(self, objOrName: str, group: str | None = ...) -> Any: ... # returns VBase sub-class
def remove(self, obj) -> None: ...
def getChildren(self) -> list[Any]: ...
def components(self) -> Iterable[Component]: ...
def lines(self): ...
def sortChildKeys(self): ...
def getSortedChildren(self): ...
def setBehaviorFromVersionLine(self, versionLine) -> None: ...
def transformChildrenToNative(self) -> None: ...
def transformChildrenFromNative(self, clearBehavior: bool = ...) -> None: ...
def prettyPrint(self, level: int = ..., tabwidth: int = ...) -> None: ...
class VObjectError(Exception):
msg: Any
lineNumber: Any
def __init__(self, msg, lineNumber: Any | None = ...) -> None: ...
class ParseError(VObjectError): ...
class ValidateError(VObjectError): ...
class NativeError(VObjectError): ...
patterns: Any
param_values_re: Any
params_re: Any
line_re: Any
begin_re: Any
def parseParams(string): ...
def parseLine(line, lineNumber: Any | None = ...): ...
wrap_re: Any
logical_lines_re: Any
testLines: str
def getLogicalLines(fp, allowQP: bool = ...) -> None: ...
def textLineToContentLine(text, n: Any | None = ...): ...
def dquoteEscape(param): ...
def foldOneLine(outbuf, input, lineLength: int = ...) -> None: ...
def defaultSerialize(obj, buf, lineLength): ...
class Stack:
stack: Any
def __init__(self) -> None: ...
def __len__(self): ...
def top(self): ...
def topName(self): ...
def modifyTop(self, item) -> None: ...
def push(self, obj) -> None: ...
def pop(self): ...
def readComponents(
streamOrString, validate: bool = ..., transform: bool = ..., ignoreUnreadable: bool = ..., allowQP: bool = ...
) -> None: ...
def readOne(stream, validate: bool = ..., transform: bool = ..., ignoreUnreadable: bool = ..., allowQP: bool = ...): ...
def registerBehavior(behavior, name: Any | None = ..., default: bool = ..., id: Any | None = ...) -> None: ...
def getBehavior(name, id: Any | None = ...): ...
def newFromBehavior(name, id: Any | None = ...): ...
def backslashEscape(s): ...

View File

@@ -0,0 +1,33 @@
from typing import Any
class Behavior:
name: str
description: str
versionString: str
knownChildren: Any
quotedPrintable: bool
defaultBehavior: Any
hasNative: bool
isComponent: bool
allowGroup: bool
forceUTC: bool
sortFirst: Any
def __init__(self) -> None: ...
@classmethod
def validate(cls, obj, raiseException: bool = ..., complainUnrecognized: bool = ...): ...
@classmethod
def lineValidate(cls, line, raiseException, complainUnrecognized): ...
@classmethod
def decode(cls, line) -> None: ...
@classmethod
def encode(cls, line) -> None: ...
@classmethod
def transformToNative(cls, obj): ...
@classmethod
def transformFromNative(cls, obj) -> None: ...
@classmethod
def generateImplicitParameters(cls, obj) -> None: ...
@classmethod
def serialize(cls, obj, buf, lineLength, validate: bool = ...): ...
@classmethod
def valueRepr(cls, line): ...

View File

@@ -0,0 +1,6 @@
def change_tz(cal, new_timezone, default, utc_only: bool = ..., utc_tz=...) -> None: ...
def main() -> None: ...
version: str
def get_options(): ...

View File

@@ -0,0 +1,8 @@
from typing import Any
from .icalendar import VCalendar2_0
class HCalendar(VCalendar2_0):
name: str
@classmethod
def serialize(cls, obj, buf: Any | None = ..., lineLength: Any | None = ..., validate: bool = ...): ...

View File

@@ -0,0 +1,236 @@
from datetime import timedelta
from typing import Any, Tuple
from .base import Component
from .behavior import Behavior
DATENAMES: Tuple[str, ...]
RULENAMES: Tuple[str, ...]
DATESANDRULES: Tuple[str, ...]
PRODID: str
WEEKDAYS: Tuple[str, ...]
FREQUENCIES: Tuple[str, ...]
zeroDelta: timedelta
twoHours: timedelta
def toUnicode(s: str | bytes) -> str: ...
def registerTzid(tzid, tzinfo) -> None: ...
def getTzid(tzid, smart: bool = ...): ...
utc: Any # dateutil.tz.tz.tzutc
class TimezoneComponent(Component):
isNative: bool
behavior: Any
tzinfo: Any
name: str
useBegin: bool
def __init__(self, tzinfo: Any | None = ..., *args, **kwds) -> None: ...
@classmethod
def registerTzinfo(cls, tzinfo): ...
def gettzinfo(self): ...
tzid: Any
daylight: Any
standard: Any
def settzinfo(self, tzinfo, start: int = ..., end: int = ...): ...
normal_attributes: Any
@staticmethod
def pickTzid(tzinfo, allowUTC: bool = ...): ...
def prettyPrint(self, level, tabwidth) -> None: ... # type: ignore
class RecurringComponent(Component):
isNative: bool
def __init__(self, *args, **kwds) -> None: ...
def getrruleset(self, addRDate: bool = ...): ...
def setrruleset(self, rruleset): ...
rruleset: Any
def __setattr__(self, name, value) -> None: ...
class TextBehavior(Behavior):
base64string: str
@classmethod
def decode(cls, line) -> None: ...
@classmethod
def encode(cls, line) -> None: ...
class VCalendarComponentBehavior(Behavior):
defaultBehavior: Any
isComponent: bool
class RecurringBehavior(VCalendarComponentBehavior):
hasNative: bool
@staticmethod
def transformToNative(obj): ...
@staticmethod
def transformFromNative(obj): ...
@staticmethod
def generateImplicitParameters(obj) -> None: ...
class DateTimeBehavior(Behavior):
hasNative: bool
@staticmethod
def transformToNative(obj): ...
@classmethod
def transformFromNative(cls, obj): ...
class UTCDateTimeBehavior(DateTimeBehavior):
forceUTC: bool
class DateOrDateTimeBehavior(Behavior):
hasNative: bool
@staticmethod
def transformToNative(obj): ...
@staticmethod
def transformFromNative(obj): ...
class MultiDateBehavior(Behavior):
hasNative: bool
@staticmethod
def transformToNative(obj): ...
@staticmethod
def transformFromNative(obj): ...
class MultiTextBehavior(Behavior):
listSeparator: str
@classmethod
def decode(cls, line) -> None: ...
@classmethod
def encode(cls, line) -> None: ...
class SemicolonMultiTextBehavior(MultiTextBehavior):
listSeparator: str
class VCalendar2_0(VCalendarComponentBehavior):
name: str
description: str
versionString: str
sortFirst: Any
knownChildren: Any
@classmethod
def generateImplicitParameters(cls, obj) -> None: ...
@classmethod
def serialize(cls, obj, buf, lineLength, validate: bool = ...): ...
class VTimezone(VCalendarComponentBehavior):
name: str
hasNative: bool
description: str
sortFirst: Any
knownChildren: Any
@classmethod
def validate(cls, obj, raiseException, *args): ...
@staticmethod
def transformToNative(obj): ...
@staticmethod
def transformFromNative(obj): ...
class TZID(Behavior): ...
class DaylightOrStandard(VCalendarComponentBehavior):
hasNative: bool
knownChildren: Any
class VEvent(RecurringBehavior):
name: str
sortFirst: Any
description: str
knownChildren: Any
@classmethod
def validate(cls, obj, raiseException, *args): ...
class VTodo(RecurringBehavior):
name: str
description: str
knownChildren: Any
@classmethod
def validate(cls, obj, raiseException, *args): ...
class VJournal(RecurringBehavior):
name: str
knownChildren: Any
class VFreeBusy(VCalendarComponentBehavior):
name: str
description: str
sortFirst: Any
knownChildren: Any
class VAlarm(VCalendarComponentBehavior):
name: str
description: str
knownChildren: Any
@staticmethod
def generateImplicitParameters(obj) -> None: ...
@classmethod
def validate(cls, obj, raiseException, *args): ...
class VAvailability(VCalendarComponentBehavior):
name: str
description: str
sortFirst: Any
knownChildren: Any
@classmethod
def validate(cls, obj, raiseException, *args): ...
class Available(RecurringBehavior):
name: str
sortFirst: Any
description: str
knownChildren: Any
@classmethod
def validate(cls, obj, raiseException, *args): ...
class Duration(Behavior):
name: str
hasNative: bool
@staticmethod
def transformToNative(obj): ...
@staticmethod
def transformFromNative(obj): ...
class Trigger(Behavior):
name: str
description: str
hasNative: bool
forceUTC: bool
@staticmethod
def transformToNative(obj): ...
@staticmethod
def transformFromNative(obj): ...
class PeriodBehavior(Behavior):
hasNative: bool
@staticmethod
def transformToNative(obj): ...
@classmethod
def transformFromNative(cls, obj): ...
class FreeBusy(PeriodBehavior):
name: str
forceUTC: bool
class RRule(Behavior): ...
utcDateTimeList: Any
dateTimeOrDateList: Any
textList: Any
def numToDigits(num, places): ...
def timedeltaToString(delta): ...
def timeToString(dateOrDateTime): ...
def dateToString(date): ...
def dateTimeToString(dateTime, convertToUTC: bool = ...): ...
def deltaToOffset(delta): ...
def periodToString(period, convertToUTC: bool = ...): ...
def isDuration(s): ...
def stringToDate(s): ...
def stringToDateTime(s, tzinfo: Any | None = ...): ...
escapableCharList: str
def stringToTextValues(s, listSeparator: str = ..., charList: Any | None = ..., strict: bool = ...): ...
def stringToDurations(s, strict: bool = ...): ...
def parseDtstart(contentline, allowSignatureMismatch: bool = ...): ...
def stringToPeriod(s, tzinfo: Any | None = ...): ...
def getTransition(transitionTo, year, tzinfo): ...
def tzinfo_eq(tzinfo1, tzinfo2, startYear: int = ..., endYear: int = ...): ...

View File

@@ -0,0 +1,10 @@
def getSortKey(component): ...
def sortByUID(components): ...
def deleteExtraneous(component, ignore_dtstamp: bool = ...) -> None: ...
def diff(left, right): ...
def prettyDiff(leftObj, rightObj) -> None: ...
def main() -> None: ...
version: str
def getOptions(): ...

View File

@@ -0,0 +1,110 @@
from typing import Any
from .behavior import Behavior
class Name:
family: Any
given: Any
additional: Any
prefix: Any
suffix: Any
def __init__(
self, family: str = ..., given: str = ..., additional: str = ..., prefix: str = ..., suffix: str = ...
) -> None: ...
@staticmethod
def toString(val): ...
def __eq__(self, other): ...
class Address:
box: Any
extended: Any
street: Any
city: Any
region: Any
code: Any
country: Any
def __init__(
self,
street: str = ...,
city: str = ...,
region: str = ...,
code: str = ...,
country: str = ...,
box: str = ...,
extended: str = ...,
) -> None: ...
@staticmethod
def toString(val, join_char: str = ...): ...
lines: Any
one_line: Any
def __eq__(self, other): ...
class VCardTextBehavior(Behavior):
allowGroup: bool
base64string: str
@classmethod
def decode(cls, line) -> None: ...
@classmethod
def encode(cls, line) -> None: ...
class VCardBehavior(Behavior):
allowGroup: bool
defaultBehavior: Any
class VCard3_0(VCardBehavior):
name: str
description: str
versionString: str
isComponent: bool
sortFirst: Any
knownChildren: Any
@classmethod
def generateImplicitParameters(cls, obj) -> None: ...
class FN(VCardTextBehavior):
name: str
description: str
class Label(VCardTextBehavior):
name: str
description: str
wacky_apple_photo_serialize: bool
REALLY_LARGE: float
class Photo(VCardTextBehavior):
name: str
description: str
@classmethod
def valueRepr(cls, line): ...
@classmethod
def serialize(cls, obj, buf, lineLength, validate) -> None: ... # type: ignore
def toListOrString(string): ...
def splitFields(string): ...
def toList(stringOrList): ...
def serializeFields(obj, order: Any | None = ...): ...
NAME_ORDER: Any
ADDRESS_ORDER: Any
class NameBehavior(VCardBehavior):
hasNative: bool
@staticmethod
def transformToNative(obj): ...
@staticmethod
def transformFromNative(obj): ...
class AddressBehavior(VCardBehavior):
hasNative: bool
@staticmethod
def transformToNative(obj): ...
@staticmethod
def transformFromNative(obj): ...
class OrgBehavior(VCardBehavior):
hasNative: bool
@staticmethod
def transformToNative(obj): ...
@staticmethod
def transformFromNative(obj): ...

View File

@@ -0,0 +1,39 @@
import datetime
from typing import Any
handle: Any
tzparent: Any
parentsize: Any
localkey: Any
WEEKS: Any
def list_timezones(): ...
class win32tz(datetime.tzinfo):
data: Any
def __init__(self, name) -> None: ...
def utcoffset(self, dt): ...
def dst(self, dt): ...
def tzname(self, dt): ...
def pickNthWeekday(year, month, dayofweek, hour, minute, whichweek): ...
class win32tz_data:
display: Any
dstname: Any
stdname: Any
stdoffset: Any
dstoffset: Any
stdmonth: Any
stddayofweek: Any
stdweeknumber: Any
stdhour: Any
stdminute: Any
dstmonth: Any
dstdayofweek: Any
dstweeknumber: Any
dsthour: Any
dstminute: Any
def __init__(self, path) -> None: ...
def valuesToDict(key): ...