index int64 0 731k | package stringlengths 2 98 ⌀ | name stringlengths 1 76 | docstring stringlengths 0 281k ⌀ | code stringlengths 4 8.19k | signature stringlengths 2 42.8k ⌀ | embed_func_code listlengths 768 768 |
|---|---|---|---|---|---|---|
722,950 | gitdb.db.ref | update_cache | null | def update_cache(self, force=False):
# re-read alternates and update databases
self._update_dbs_from_ref_file()
return super().update_cache(force)
| (self, force=False) | [
0.02810100093483925,
-0.018369728699326515,
-0.019375814124941826,
0.04298412427306175,
0.049228791147470474,
-0.024336853995919228,
-0.058144789189100266,
0.028066309168934822,
0.07028719782829285,
-0.03920263051986694,
-0.023139961063861847,
-0.01566370576620102,
-0.011899559758603573,
0... |
722,951 | gitdb.stream | Sha1Writer | Simple stream writer which produces a sha whenever you like as it degests
everything it is supposed to write | class Sha1Writer:
"""Simple stream writer which produces a sha whenever you like as it degests
everything it is supposed to write"""
__slots__ = "sha1"
def __init__(self):
self.sha1 = make_sha()
#{ Stream Interface
def write(self, data):
""":raise IOError: If not all bytes co... | () | [
-0.03148169443011284,
-0.03460985794663429,
-0.004760446958243847,
0.015313453041017056,
0.050159744918346405,
-0.017632296308875084,
-0.06485483795404434,
0.03353682532906532,
-0.025661855936050415,
-0.010966760106384754,
0.06052633374929428,
0.06187216937541962,
-0.004301225300878286,
0.... |
722,952 | gitdb.stream | __init__ | null | def __init__(self):
self.sha1 = make_sha()
| (self) | [
-0.03865617513656616,
-0.033117130398750305,
0.007066047750413418,
0.06335596740245819,
-0.015077581629157066,
-0.04260546341538429,
-0.026021797209978104,
0.05589247867465019,
0.020265206694602966,
0.0013230536133050919,
0.025235285982489586,
0.07430017739534378,
-0.009153648279607296,
0.... |
722,954 | gitdb.stream | write | :raise IOError: If not all bytes could be written
:param data: byte object
:return: length of incoming data | def write(self, data):
""":raise IOError: If not all bytes could be written
:param data: byte object
:return: length of incoming data"""
self.sha1.update(data)
return len(data)
| (self, data) | [
-0.0764865130186081,
-0.01894763670861721,
0.007755656260997057,
0.09492957592010498,
0.048091158270835876,
0.009595612995326519,
-0.0630543977022171,
0.015493912622332573,
0.010230679996311665,
-0.04603806138038635,
0.03977438062429428,
0.003732110373675823,
0.003336280584335327,
-0.00986... |
722,955 | gitdb.stream | ZippedStoreShaWriter | Remembers everything someone writes to it and generates a sha | class ZippedStoreShaWriter(Sha1Writer):
"""Remembers everything someone writes to it and generates a sha"""
__slots__ = ('buf', 'zip')
def __init__(self):
Sha1Writer.__init__(self)
self.buf = BytesIO()
self.zip = zlib.compressobj(zlib.Z_BEST_SPEED)
def __getattr__(self, attr):... | () | [
-0.020647365599870682,
-0.01388844195753336,
-0.023117991164326668,
0.06822454184293747,
0.07168342173099518,
-0.02906513772904873,
-0.08336594700813293,
0.046412453055381775,
-0.008488361723721027,
-0.011982531286776066,
0.061342086642980576,
0.05957735702395439,
-0.02331211045384407,
0.0... |
722,956 | gitdb.stream | __getattr__ | null | def __getattr__(self, attr):
return getattr(self.buf, attr)
| (self, attr) | [
0.06609181314706802,
-0.02351813018321991,
-0.028404168784618378,
0.02205231972038746,
0.013013148680329323,
-0.02065165527164936,
0.04843692481517792,
0.04830663278698921,
0.017231428995728493,
-0.013876348733901978,
0.0024084097240120173,
0.023176107555627823,
0.00253666820935905,
0.0362... |
722,957 | gitdb.stream | __init__ | null | def __init__(self):
Sha1Writer.__init__(self)
self.buf = BytesIO()
self.zip = zlib.compressobj(zlib.Z_BEST_SPEED)
| (self) | [
-0.01155622024089098,
-0.01576174981892109,
-0.004762672353535891,
0.007651727180927992,
0.019428107887506485,
-0.016965897753834724,
-0.08310414105653763,
0.08605160564184189,
-0.06484423577785492,
0.00936359353363514,
0.06811519712209702,
0.0764184221625328,
-0.048345617949962616,
0.0421... |
722,958 | gitdb.stream | close | null | def close(self):
self.buf.write(self.zip.flush())
| (self) | [
0.03818847984075546,
0.013830332085490227,
-0.03721616789698601,
0.04422353580594063,
0.03356160596013069,
-0.06269750744104385,
-0.08449075371026993,
0.0962926372885704,
0.0023008643183857203,
0.030493786558508873,
-0.0031118246261030436,
-0.09703025966882706,
-0.014534421265125275,
0.012... |
722,959 | gitdb.stream | getvalue | :return: string value from the current stream position to the end | def getvalue(self):
""":return: string value from the current stream position to the end"""
return self.buf.getvalue()
| (self) | [
0.026807060465216637,
-0.015686411410570145,
-0.06915785372257233,
0.026958134025335312,
0.05327840521931648,
0.02069699764251709,
0.014427470043301582,
0.008241870440542698,
0.07996796816587448,
-0.08352657407522202,
-0.003002575598657131,
0.004248927813023329,
-0.042233292013406754,
0.02... |
722,960 | gitdb.stream | seek | Seeking currently only supports to rewind written data
Multiple writes are not supported | def seek(self, offset, whence=getattr(os, 'SEEK_SET', 0)):
"""Seeking currently only supports to rewind written data
Multiple writes are not supported"""
if offset != 0 or whence != getattr(os, 'SEEK_SET', 0):
raise ValueError("Can only seek to position 0")
# END handle offset
self.buf.seek(... | (self, offset, whence=0) | [
0.03438928350806236,
0.0154415313154459,
-0.0489099882543087,
0.03268929570913315,
0.02307375706732273,
0.004798916168510914,
-0.024153955280780792,
0.05829532444477081,
-0.006760097108781338,
-0.020382113754749298,
0.003512859810143709,
-0.05482451990246773,
0.04345586895942688,
0.0008184... |
722,962 | gitdb.stream | write | null | def write(self, data):
alen = Sha1Writer.write(self, data)
self.buf.write(self.zip.compress(data))
return alen
| (self, data) | [
-0.03365662693977356,
-0.0038236090913414955,
0.011065192520618439,
0.01405314914882183,
0.08483314514160156,
-0.02725512906908989,
-0.07873310148715973,
0.025659188628196716,
-0.015046179294586182,
0.01393788680434227,
0.037841539829969406,
0.009894835762679577,
-0.017679482698440552,
0.0... |
722,963 | gitdb | _init_externals | Initialize external projects by putting them into the path | def _init_externals():
"""Initialize external projects by putting them into the path"""
if 'PYOXIDIZER' not in os.environ:
where = os.path.join(os.path.dirname(__file__), 'ext', 'smmap')
if os.path.exists(where):
sys.path.append(where)
import smmap
del smmap
# END handle... | () | [
0.04428120702505112,
-0.041989583522081375,
-0.003437434323132038,
0.04583245888352394,
-0.03881656751036644,
-0.008690538816154003,
-0.0038032126612961292,
0.06363660842180252,
-0.0026353662833571434,
0.03624289855360985,
0.001701089320704341,
-0.010717744007706642,
-0.003598288632929325,
... |
722,980 | pyopenstates.core | APIError |
Raised when the Open States API returns an error
| class APIError(RuntimeError):
"""
Raised when the Open States API returns an error
"""
pass
| null | [
-0.029722917824983597,
-0.07238298654556274,
-0.03682389482855797,
0.0406905822455883,
-0.001576489070430398,
-0.05521777272224426,
-0.0405098982155323,
0.0471230186522007,
0.04090740904211998,
-0.03776346519589424,
0.043111782521009445,
0.02059825323522091,
0.05897605046629906,
-0.0052624... |
722,981 | pyopenstates.core | NotFound | Raised when the API cannot find the requested object | class NotFound(APIError):
"""Raised when the API cannot find the requested object"""
pass
| null | [
-0.00601296266540885,
-0.03577904775738716,
-0.039432063698768616,
0.014808361418545246,
0.01435600221157074,
-0.034532926976680756,
0.009729989804327488,
0.019664820283651352,
0.048718228936195374,
-0.003612471977248788,
0.03987588733434677,
-0.028507161885499954,
0.06216951087117195,
-0.... |
722,984 | pyopenstates.core | get_bill |
Returns details of a specific bill Can be identified by the Open States
unique bill id (uid), or by specifying the state, session, and
legislative bill ID
Args:
uid: The Open States unique bill ID
state: The postal code of the state
session: The legislative session (see state m... | def get_bill(uid=None, state=None, session=None, bill_id=None, include=None):
"""
Returns details of a specific bill Can be identified by the Open States
unique bill id (uid), or by specifying the state, session, and
legislative bill ID
Args:
uid: The Open States unique bill ID
stat... | (uid=None, state=None, session=None, bill_id=None, include=None) | [
-0.01896457001566887,
-0.04397159442305565,
0.016989851370453835,
0.00990998838096857,
-0.03250548988580704,
-0.022877605631947517,
0.01808186247944832,
-0.023714812472462654,
-0.05951453372836113,
-0.07094423472881317,
-0.0735650584101677,
-0.004531840793788433,
-0.036218322813510895,
0.0... |
722,985 | pyopenstates.core | get_legislator |
Gets a legislator's details
Args:
leg_id: The Legislator's Open States ID
fields: An optional custom list of fields to return
Returns:
The requested :ref:`Legislator` details as a dictionary
| def get_legislator(leg_id):
"""
Gets a legislator's details
Args:
leg_id: The Legislator's Open States ID
fields: An optional custom list of fields to return
Returns:
The requested :ref:`Legislator` details as a dictionary
"""
leg_id = _fix_id_string("ocd-person/", leg_... | (leg_id) | [
0.025538261979818344,
0.035236112773418427,
0.02384861744940281,
0.044634755700826645,
0.01649162732064724,
-0.014089164324104786,
0.01904369331896305,
0.019782911986112595,
-0.016095615923404694,
-0.03678495064377785,
-0.05241415649652481,
-0.009838654659688473,
-0.04273390769958496,
0.02... |
722,986 | pyopenstates.core | get_metadata |
Returns a list of all states with data available, and basic metadata
about their status. Can also get detailed metadata for a particular
state.
Args:
state: The abbreviation of state to get detailed metadata on, or leave
as None to get high-level metadata on all states.
... | def get_metadata(state=None, include=None, fields=None):
"""
Returns a list of all states with data available, and basic metadata
about their status. Can also get detailed metadata for a particular
state.
Args:
state: The abbreviation of state to get detailed metadata on, or lea... | (state=None, include=None, fields=None) | [
-0.010542450472712517,
-0.07373402267694473,
0.009577486664056778,
-0.034341875463724136,
0.021788330748677254,
0.03511745110154152,
-0.012382193468511105,
-0.02736167050898075,
-0.00027956883423030376,
-0.01550254225730896,
-0.036506276577711105,
0.05667130649089813,
0.002383098704740405,
... |
722,987 | pyopenstates.core | get_organizations | null | def get_organizations(state):
uri = "jurisdictions"
uri += "/" + _jurisdiction_id(state)
state_response = _get(uri, params={"include": "organizations"})
return state_response["organizations"]
| (state) | [
-0.03332112357020378,
-0.05940075218677521,
-0.03275751695036888,
-0.0185136329382658,
0.009922897443175316,
0.018001263961195946,
-0.05864927917718887,
-0.09721365571022034,
0.03140827640891075,
-0.04016980156302452,
-0.0002050814073299989,
-0.021246273070573807,
-0.04901672154664993,
0.0... |
722,988 | pyopenstates.core | locate_legislators |
Returns a list of legislators for the given latitude/longitude coordinates
Args:
lat: Latitude
long: Longitude
fields: An optional custom list of fields to return
Returns:
A list of matching :ref:`Legislator` dictionaries
| def locate_legislators(lat, lng, fields=None):
"""
Returns a list of legislators for the given latitude/longitude coordinates
Args:
lat: Latitude
long: Longitude
fields: An optional custom list of fields to return
Returns:
A list of matching :ref:`Legislator` dictionari... | (lat, lng, fields=None) | [
0.04968063160777092,
0.019113389775156975,
0.017508788034319878,
0.056560032069683075,
-0.020549554377794266,
0.0342019759118557,
0.02675520069897175,
-0.02632967010140419,
-0.006985784508287907,
0.009556694887578487,
0.008674606680870056,
-0.02482258528470993,
0.0014538943069055676,
-0.00... |
722,989 | pyopenstates.core | search_bills |
Find bills matching a given set of filters
For a list of each field, example values, etc. see
https://v3.openstates.org/docs#/bills/bills_search_bills_get
| def search_bills(
jurisdiction=None,
identifier=None,
session=None,
chamber=None,
classification=None,
subject=None,
updated_since=None,
created_since=None,
action_since=None,
sponsor=None,
sponsor_classification=None,
q=None,
# control params
sort=None,
inclu... | (jurisdiction=None, identifier=None, session=None, chamber=None, classification=None, subject=None, updated_since=None, created_since=None, action_since=None, sponsor=None, sponsor_classification=None, q=None, sort=None, include=None, page=1, per_page=10, all_pages=True, state=None) | [
0.035626232624053955,
-0.028957370668649673,
-0.08943706005811691,
-0.05133432522416115,
-0.030319446697831154,
-0.019812006503343582,
-0.05628732591867447,
-0.03919947147369385,
-0.02952342852950096,
-0.04383406415581703,
-0.08306891471147537,
0.010560506954789162,
-0.01428410317748785,
0... |
722,990 | pyopenstates.core | search_districts |
Search for districts
Args:
state: The state to search in
chamber: the upper or lower legislative chamber
fields: Optionally specify a custom list of fields to return
Returns:
A list of matching :ref:`District` dictionaries
| def search_districts(state, chamber):
"""
Search for districts
Args:
state: The state to search in
chamber: the upper or lower legislative chamber
fields: Optionally specify a custom list of fields to return
Returns:
A list of matching :ref:`District` dictionaries
""... | (state, chamber) | [
-0.008359475992619991,
0.020582767203450203,
0.007482163142412901,
-0.02496478706598282,
-0.019382711499929428,
0.024692047387361526,
0.006154829170554876,
-0.040583688765764236,
0.00029887742130085826,
-0.06749401986598969,
-0.056402601301670074,
0.06294835358858109,
-0.05989367142319679,
... |
722,991 | pyopenstates.core | search_legislators |
Search for legislators.
Returns:
A list of matching :ref:`Legislator` dictionaries
| def search_legislators(
jurisdiction=None,
name=None,
id_=None,
org_classification=None,
district=None,
include=None,
):
"""
Search for legislators.
Returns:
A list of matching :ref:`Legislator` dictionaries
"""
params = _make_params(
jurisdiction=jurisdicti... | (jurisdiction=None, name=None, id_=None, org_classification=None, district=None, include=None) | [
0.0524386428296566,
0.01678568124771118,
0.008609858341515064,
0.02122347801923752,
-0.0013198239030316472,
0.028841253370046616,
-0.02170180343091488,
-0.030807703733444214,
-0.000049687165301293135,
0.034085117280483246,
-0.02097545750439167,
-0.01396887470036745,
0.008290974423289299,
-... |
722,992 | pyopenstates.core | set_api_key | Sets API key. Can also be set as OPENSTATES_API_KEY environment
variable. | def set_api_key(apikey):
"""Sets API key. Can also be set as OPENSTATES_API_KEY environment
variable."""
session.headers["X-Api-Key"] = apikey
| (apikey) | [
-0.06621534377336502,
-0.051367055624723434,
-0.04895922541618347,
0.05195077136158943,
-0.021269172430038452,
0.0084091667085886,
-0.00996878370642662,
0.05344654619693756,
-0.015687381848692894,
0.0009211776778101921,
-0.024114789441227913,
-0.08850602060556412,
0.015559693798422813,
0.0... |
722,993 | pyopenstates.core | set_user_agent | Appends a custom string to the default User-Agent string
(e.g. ``pyopenstates/__version__ user_agent``) | def set_user_agent(user_agent):
"""Appends a custom string to the default User-Agent string
(e.g. ``pyopenstates/__version__ user_agent``)"""
session.headers.update({"User-Agent": f"{DEFAULT_USER_AGENT} {user_agent}"})
| (user_agent) | [
-0.051679641008377075,
-0.012845336459577084,
-0.038815658539533615,
0.0053972783498466015,
-0.0017676319694146514,
-0.012416536919772625,
-0.015147802419960499,
0.027331296354532242,
0.0031227776780724525,
-0.022446712478995323,
0.011810624971985817,
0.004828653298318386,
-0.052574526518583... |
722,994 | pyvat.item_type | ItemType | Item type.
If no item type matches the type of item being sold, it is currently not
supported by pyvat.
| class ItemType(Enum):
"""Item type.
If no item type matches the type of item being sold, it is currently not
supported by pyvat.
"""
generic_physical_good = 1
"""Generic physical good.
"""
generic_electronic_service = 2
"""Generic electronic service.
Any electronic service th... | (value, names=None, *, module=None, qualname=None, type=None, start=1) | [
0.08424434065818787,
-0.08836662024259567,
-0.0531773678958416,
-0.05467637628316879,
0.017622731626033783,
-0.09638632088899612,
0.00006942434993106872,
-0.09391295164823532,
0.015411692671477795,
-0.0644199401140213,
-0.0005937483510933816,
0.035133037716150284,
0.011420579627156258,
-0.... |
722,995 | pyvat.party | Party | Trading party.
Represents either a consumer or business in a given country acting as a
party to a transaction.
:ivar country_code:
Party's legal or effective country of registration or residence as an
ISO 3166-1 alpha-2 country code.
:type country_code: str
:ivar is_business: Wheth... | class Party(object):
"""Trading party.
Represents either a consumer or business in a given country acting as a
party to a transaction.
:ivar country_code:
Party's legal or effective country of registration or residence as an
ISO 3166-1 alpha-2 country code.
:type country_code: str
... | (country_code, is_business) | [
0.010955693200230598,
-0.06871961057186127,
-0.048708055168390274,
0.035119738429784775,
-0.026163389906287193,
-0.10262707620859146,
-0.002947000088170171,
-0.00005954642256256193,
0.0003338840324431658,
-0.05587313324213028,
-0.005532127805054188,
-0.001467845868319273,
-0.027176633477211,... |
722,996 | pyvat.party | __init__ | Initialize a trading party.
:param country_code:
Party's legal or effective country of registration or residence as
an ISO 3166-1 alpha-2 country code.
:type country_code: str
:param is_business: Whether the part is a legal business entity.
:type is_business: boo... | def __init__(self, country_code, is_business):
"""Initialize a trading party.
:param country_code:
Party's legal or effective country of registration or residence as
an ISO 3166-1 alpha-2 country code.
:type country_code: str
:param is_business: Whether the part is a legal business entit... | (self, country_code, is_business) | [
-0.019485538825392723,
-0.04303696006536484,
-0.00042492765351198614,
-0.004605280701071024,
-0.059377193450927734,
-0.07621607929468155,
-0.009896199218928814,
0.0030661914497613907,
0.006573492661118507,
-0.04760148376226425,
0.0037182667292654514,
0.023915814235806465,
-0.0372258201241493... |
722,997 | pyvat.party | __repr__ | null | def __repr__(self):
return '<pyvat.Party: country code = %s, is business = %r>' % (
self.country_code, self.is_business,
)
| (self) | [
0.02071445807814598,
-0.07806380838155746,
0.059030838310718536,
0.007987051270902157,
-0.014668269082903862,
-0.10181925445795059,
0.020964890718460083,
-0.04210866242647171,
0.035668935626745224,
-0.0746292918920517,
-0.02164464071393013,
-0.0118598323315382,
-0.03357602655887604,
0.0140... |
722,998 | pyvat.vat_charge | VatCharge | VAT charge.
:ivar action: VAT charge action.
:type action: VatChargeAction
:ivar country_code:
Country in which the action applies as the ISO 3166-1 alpha-2 code of
the country.
:type country_code: str
:ivar rate:
VAT rate in percent. I.e. a value of 25 indicates a VAT charg... | class VatCharge(object):
"""VAT charge.
:ivar action: VAT charge action.
:type action: VatChargeAction
:ivar country_code:
Country in which the action applies as the ISO 3166-1 alpha-2 code of
the country.
:type country_code: str
:ivar rate:
VAT rate in percent. I.e. a v... | (action, country_code, rate) | [
0.06666311621665955,
-0.08895822614431381,
0.010740169323980808,
-0.0019316101679578424,
0.009851327165961266,
-0.07888469099998474,
0.023387644439935684,
-0.04421986639499664,
0.003353988053277135,
-0.02438759058713913,
-0.03662768006324768,
0.00041461913497187197,
0.019350821152329445,
0... |
722,999 | pyvat.vat_charge | __init__ | null | def __init__(self, action, country_code, rate):
self.action = action
self.country_code = country_code
self.rate = ensure_decimal(rate)
| (self, action, country_code, rate) | [
-0.003322834149003029,
-0.037219319492578506,
0.021344797685742378,
0.017170583829283714,
-0.04733753949403763,
-0.07300850003957748,
-0.014274556189775467,
-0.018931441009044647,
0.00035474105970934033,
-0.01320195384323597,
0.02270342782139778,
0.04336890950798988,
0.026439661160111427,
... |
723,000 | pyvat.vat_charge | __repr__ | null | def __repr__(self):
return '<%s.%s: action = %r, country code = %r, rate = %s>' % (
self.__class__.__module__,
self.__class__.__name__,
self.action,
self.country_code,
self.rate,
)
| (self) | [
0.0016742723528295755,
-0.06468050926923752,
0.06090594828128815,
0.001973167760297656,
0.03538188710808754,
-0.09396079927682877,
0.024039892479777336,
-0.03413591533899307,
0.04012756422162056,
-0.03906482830643654,
-0.016619041562080383,
-0.00026725942734628916,
0.010169314220547676,
0.... |
723,001 | pyvat.vat_charge | VatChargeAction | VAT charge action.
| class VatChargeAction(Enum):
"""VAT charge action.
"""
charge = 1
"""Charge VAT.
"""
reverse_charge = 2
"""No VAT charged but customer is required to account via reverse-charge.
"""
no_charge = 3
"""No VAT charged.
"""
| (value, names=None, *, module=None, qualname=None, type=None, start=1) | [
0.061360277235507965,
-0.08832509070634842,
-0.03805333003401756,
-0.054963793605566025,
0.02158334292471409,
-0.08074124157428741,
0.026792455464601517,
-0.04523501172661781,
-0.019687380641698837,
-0.05622776970267296,
-0.032193079590797424,
0.038589563220739365,
0.02022361196577549,
0.0... |
723,002 | pyvat.result | VatNumberCheckResult | Result of a VAT number validation check.
:ivar is_valid:
Boolean value indicating if the checked VAT number was deemed to be
valid. ``True`` if the VAT number is valid or ``False`` if the VAT
number is positively invalid.
:ivar log_lines:
Check log lines.
:ivar business_name... | class VatNumberCheckResult(object):
"""Result of a VAT number validation check.
:ivar is_valid:
Boolean value indicating if the checked VAT number was deemed to be
valid. ``True`` if the VAT number is valid or ``False`` if the VAT
number is positively invalid.
:ivar log_lines:
... | (is_valid=None, log_lines=None, business_name=None, business_address=None, business_country_code=None) | [
0.0655675083398819,
-0.03630342707037926,
-0.008803716860711575,
0.02739538811147213,
0.0028007703367620707,
-0.07376798242330551,
-0.04190950095653534,
-0.06542236357927322,
0.019485196098685265,
-0.049529410898685455,
-0.03320103511214256,
0.02848394773900509,
0.04938426986336708,
-0.028... |
723,003 | pyvat.result | __init__ | null | def __init__(self,
is_valid=None,
log_lines=None,
business_name=None,
business_address=None,
business_country_code=None):
self.is_valid = is_valid
self.log_lines = log_lines or []
self.business_name = business_name
self.business_address = ... | (self, is_valid=None, log_lines=None, business_name=None, business_address=None, business_country_code=None) | [
-0.008343483321368694,
0.04311412572860718,
0.001469068811275065,
-0.023854276165366173,
-0.08600771427154541,
-0.08439047634601593,
-0.032473426312208176,
0.01308493409305811,
0.000923480256460607,
-0.018671760335564613,
-0.021373284980654716,
0.043665457516908646,
-0.013884365558624268,
... |
723,004 | pyvat.registries | ViesRegistry | VIES registry.
Uses the European Commision's VIES registry for validating VAT numbers.
| class ViesRegistry(Registry):
"""VIES registry.
Uses the European Commision's VIES registry for validating VAT numbers.
"""
CHECK_VAT_SERVICE_URL = 'http://ec.europa.eu/taxation_customs/vies/' \
'services/checkVatService'
"""URL for the VAT checking service.
"""
DEFAULT_TIMEOUT = ... | () | [
0.07923135906457901,
-0.05996549874544144,
-0.006002685520797968,
-0.02382667362689972,
0.0012207335093989968,
-0.047857869416475296,
-0.0658147931098938,
-0.05534332990646362,
0.0064833094365894794,
-0.03710007295012474,
-0.014203970320522785,
0.010512369684875011,
0.06606022268533707,
-0... |
723,005 | pyvat.registries | check_vat_number | null | def check_vat_number(self, vat_number, country_code):
# Non-ISO code used for Greece.
if country_code == 'GR':
country_code = 'EL'
# Request information about the VAT number.
result = VatNumberCheckResult()
request_data = (
u'<?xml version="1.0" encoding="UTF-8"?><SOAP-ENV:Envelo... | (self, vat_number, country_code) | [
0.07529134303331375,
-0.04589186981320381,
0.02214919961988926,
-0.015506432391703129,
-0.009227173402905464,
-0.04756500944495201,
-0.05214622989296913,
-0.05226573720574379,
0.00536799430847168,
-0.03575342893600464,
-0.007011257577687502,
0.013922923244535923,
0.06222491338849068,
-0.04... |
723,006 | pyvat | check_vat_number | Check if a VAT number is valid.
If possible, the VAT number will be checked against available registries.
:param vat_number: VAT number to validate.
:param country_code:
Optional country code. Should be supplied if known, as there is no
guarantee that naively entered VAT numbers contain th... | def check_vat_number(vat_number, country_code=None):
"""Check if a VAT number is valid.
If possible, the VAT number will be checked against available registries.
:param vat_number: VAT number to validate.
:param country_code:
Optional country code. Should be supplied if known, as there is no
... | (vat_number, country_code=None) | [
0.061741676181554794,
-0.05399088189005852,
-0.023346897214651108,
0.020152058452367783,
-0.020983850583434105,
-0.021740026772022247,
-0.048924509435892105,
-0.0638967752456665,
0.038262445479631424,
-0.07263059169054031,
0.022874288260936737,
0.02381950616836548,
0.040228500962257385,
-0... |
723,008 | pyvat | decompose_vat_number | Decompose a VAT number and an optional country code.
:param vat_number: VAT number.
:param country_code:
Optional country code. Default ``None`` prompting detection from the
VAT number.
:returns:
a :class:`tuple` containing the VAT number and country code or
``(vat_number, N... | def decompose_vat_number(vat_number, country_code=None):
"""Decompose a VAT number and an optional country code.
:param vat_number: VAT number.
:param country_code:
Optional country code. Default ``None`` prompting detection from the
VAT number.
:returns:
a :class:`tuple` contai... | (vat_number, country_code=None) | [
0.049375101923942566,
-0.0014199127908796072,
-0.0018376038642600179,
-0.010223371908068657,
-0.019935576245188713,
-0.07266166806221008,
-0.018354739993810654,
-0.05804603546857834,
0.06838300079107285,
-0.05857613682746887,
0.010024584829807281,
0.009508682414889336,
-0.007932579144835472,... |
723,010 | pyvat | get_sale_vat_charge | Get the VAT charge for performing the sale of an item.
Currently only supports determination of the VAT charge for
telecommunications, broadcasting and electronic services in the EU.
:param date: Sale date.
:type date: datetime.date
:param item_type: Type of the item being sold.
:type item_typ... | def get_sale_vat_charge(date,
item_type,
buyer,
seller):
"""Get the VAT charge for performing the sale of an item.
Currently only supports determination of the VAT charge for
telecommunications, broadcasting and electronic services in ... | (date, item_type, buyer, seller) | [
0.020474199205636978,
-0.0725700706243515,
0.008773992769420147,
0.03713967651128769,
-0.004728388041257858,
-0.06915151327848434,
0.027812954038381577,
-0.0554029606282711,
-0.03331237658858299,
0.009061969816684723,
0.00725514953956008,
0.0014526555314660072,
0.025787828490138054,
0.0168... |
723,011 | pyvat | is_vat_number_format_valid | Test if the format of a VAT number is valid.
:param vat_number: VAT number to validate.
:param country_code:
Optional country code. Should be supplied if known, as there is no
guarantee that naively entered VAT numbers contain the correct alpha-2
country code prefix for EU countries jus... | def is_vat_number_format_valid(vat_number, country_code=None):
"""Test if the format of a VAT number is valid.
:param vat_number: VAT number to validate.
:param country_code:
Optional country code. Should be supplied if known, as there is no
guarantee that naively entered VAT numbers contai... | (vat_number, country_code=None) | [
0.040710967034101486,
-0.02468125708401203,
-0.013576564379036427,
0.008623459376394749,
-0.027359118685126305,
-0.027677465230226517,
-0.013791916891932487,
-0.03395077586174011,
0.030392779037356377,
-0.05535493046045303,
0.0202618520706892,
0.008923079818487167,
0.028351612389087677,
-0... |
723,023 | varint | _byte | null | def _byte(b):
return bytes((b, ))
| (b) | [
-0.04504013806581497,
-0.023162011057138443,
-0.02343960851430893,
0.0418824702501297,
-0.05503363534808159,
-0.05642161890864372,
-0.017488619312644005,
0.08876168727874756,
-0.015103019773960114,
-0.08279334753751755,
0.0776578038930893,
0.07286924868822098,
-0.007395361550152302,
0.0310... |
723,024 | varint | _read_one | Read a byte from the file (as an integer)
raises EOFError if the stream ends while reading bytes.
| def _read_one(stream):
"""Read a byte from the file (as an integer)
raises EOFError if the stream ends while reading bytes.
"""
c = stream.read(1)
if c == '':
raise EOFError("Unexpected EOF while reading bytes")
return ord(c)
| (stream) | [
-0.03067455068230629,
-0.012643727473914623,
0.014965140260756016,
0.057663194835186005,
0.007540162652730942,
0.011491880752146244,
0.03519333153963089,
0.0637945607304573,
0.041643671691417694,
-0.07265491783618927,
0.04153734818100929,
0.03845394402742386,
-0.020201610401272774,
0.01459... |
723,025 | varint | decode_bytes | Read a varint from from `buf` bytes | def decode_bytes(buf):
"""Read a varint from from `buf` bytes"""
return decode_stream(BytesIO(buf))
| (buf) | [
0.014148307032883167,
-0.011083412915468216,
-0.03100951761007309,
0.012963557615876198,
-0.020690182223916054,
0.019814498722553253,
0.03506170213222504,
0.0472525991499424,
0.005292737390846014,
-0.06140090525150299,
0.038049329072237015,
0.062362439930438995,
-0.03997240215539932,
0.008... |
723,026 | varint | decode_stream | Read a varint from `stream` | def decode_stream(stream):
"""Read a varint from `stream`"""
shift = 0
result = 0
while True:
i = _read_one(stream)
result |= (i & 0x7f) << shift
shift += 7
if not (i & 0x80):
break
return result
| (stream) | [
-0.005386396776884794,
0.043091174215078354,
0.0038759612943977118,
-0.003068001940846443,
0.02492106333374977,
0.059106726199388504,
0.009435172192752361,
0.03860251232981682,
0.016787603497505188,
-0.01572827808558941,
0.007029247935861349,
0.06147674098610878,
-0.024723561480641365,
0.0... |
723,027 | varint | encode | Pack `number` into varint bytes | def encode(number):
"""Pack `number` into varint bytes"""
buf = b''
while True:
towrite = number & 0x7f
number >>= 7
if number:
buf += _byte(towrite | 0x80)
else:
buf += _byte(towrite)
break
return buf
| (number) | [
-0.022922523319721222,
0.025205714628100395,
-0.04149610921740532,
-0.005929957143962383,
0.043525610119104385,
0.035625044256448746,
-0.07944058626890182,
-0.03165663778781891,
-0.01031966507434845,
-0.06773469597101212,
0.06925681978464127,
0.02283192053437233,
0.018736669793725014,
-0.0... |
723,029 | isort.settings | Config | null | class Config(_Config):
def __init__(
self,
settings_file: str = "",
settings_path: str = "",
config: Optional[_Config] = None,
**config_overrides: Any,
):
self._known_patterns: Optional[List[Tuple[Pattern[str], str]]] = None
self._section_comments: Optiona... | (settings_file: str = '', settings_path: str = '', config: Optional[isort.settings._Config] = None, **config_overrides: Any) | [
-0.018645230680704117,
-0.05171392858028412,
-0.038343269377946854,
-0.003200536360964179,
0.0037795808166265488,
0.008664609864354134,
-0.0185925904661417,
0.01233891025185585,
-0.051840268075466156,
-0.0674218237400055,
0.011338742449879646,
-0.02415141649544239,
-0.034700553864240646,
0... |
723,030 | isort.settings | __delattr__ | null | """isort/settings.py.
Defines how the default settings for isort should be loaded
"""
import configparser
import fnmatch
import os
import posixpath
import re
import stat
import subprocess # nosec: Needed for gitignore support.
import sys
from dataclasses import dataclass, field
from pathlib import Path
from typing im... | (self, name) | [
0.016008146107196808,
-0.026525527238845825,
-0.04345209151506424,
0.0025997189804911613,
0.04673074930906296,
-0.028243860229849815,
-0.010724766179919243,
0.016551297158002853,
-0.0742240771651268,
-0.10744517296552658,
-0.0002828397846315056,
-0.0228518508374691,
-0.04617772251367569,
0... |
723,033 | isort.settings | __init__ | null | def __init__(
self,
settings_file: str = "",
settings_path: str = "",
config: Optional[_Config] = None,
**config_overrides: Any,
):
self._known_patterns: Optional[List[Tuple[Pattern[str], str]]] = None
self._section_comments: Optional[Tuple[str, ...]] = None
self._section_comments_end: O... | (self, settings_file: str = '', settings_path: str = '', config: Optional[isort.settings._Config] = None, **config_overrides: Any) | [
-0.020147649571299553,
-0.05471521615982056,
-0.036589741706848145,
-0.00035500572994351387,
0.001778668025508523,
0.0072576007805764675,
-0.023397954180836678,
0.015330424532294273,
-0.05479991436004639,
-0.062168680131435394,
0.013869374990463257,
-0.012471850961446762,
-0.0365473926067352... |
723,034 | isort.settings | __post_init__ | null | def __post_init__(self) -> None:
py_version = self.py_version
if py_version == "auto": # pragma: no cover
if sys.version_info.major == 2 and sys.version_info.minor <= 6:
py_version = "2"
elif sys.version_info.major == 3 and (
sys.version_info.minor <= 5 or sys.version_in... | (self) -> NoneType | [
0.045019812881946564,
-0.009458433836698532,
-0.03509525582194328,
0.030336905270814896,
-0.015770530328154564,
-0.022587593644857407,
-0.03402705490589142,
0.07994027435779572,
-0.056595224887132645,
-0.03309480473399162,
0.012439684942364693,
0.03816390410065651,
-0.032628681510686874,
0... |
723,035 | isort.settings | __repr__ | null | @dataclass(frozen=True)
class _Config:
"""Defines the data schema and defaults used for isort configuration.
NOTE: known lists, such as known_standard_library, are intentionally not complete as they are
dynamically determined later on.
"""
py_version: str = "3"
force_to_top: FrozenSet[str] = f... | (self) | [
0.02886698953807354,
-0.022238563746213913,
-0.0652252808213234,
0.005741040222346783,
0.026690199971199036,
-0.04377114400267601,
-0.023238711059093475,
0.029965190216898918,
-0.0578516460955143,
-0.08793450146913528,
-0.014600186608731747,
-0.013276462443172932,
-0.025572387501597404,
0.... |
723,037 | isort.settings | _check_folder_git_ls_files | null | def _check_folder_git_ls_files(self, folder: str) -> Optional[Path]:
env = {**os.environ, "LANG": "C.UTF-8"}
try:
topfolder_result = subprocess.check_output( # nosec # skipcq: PYL-W1510
["git", "-C", folder, "rev-parse", "--show-toplevel"], encoding="utf-8", env=env
)
except sub... | (self, folder: str) -> Optional[pathlib.Path] | [
0.004623266402631998,
-0.03896249085664749,
-0.05808610841631889,
0.06215175986289978,
0.021608183160424232,
-0.00984414666891098,
0.03647792711853981,
0.04656676575541496,
0.03175348788499832,
-0.05409574881196022,
0.04046828672289848,
-0.01206519640982151,
-0.023546896874904633,
-0.07562... |
723,038 | isort.settings | _parse_known_pattern | Expand pattern if identified as a directory and return found sub packages | def _parse_known_pattern(self, pattern: str) -> List[str]:
"""Expand pattern if identified as a directory and return found sub packages"""
if pattern.endswith(os.path.sep):
patterns = [
filename
for filename in os.listdir(os.path.join(self.directory, pattern))
if os.p... | (self, pattern: str) -> List[str] | [
0.054960887879133224,
0.013139794580638409,
-0.003115262370556593,
-0.013313830830156803,
0.03468557447195053,
0.011094859801232815,
0.08694888651371002,
-0.005325532518327236,
0.012356627732515335,
-0.0047120521776378155,
0.04277829825878143,
0.03696545958518982,
-0.05054034665226936,
-0.... |
723,039 | isort.settings | is_skipped | Returns True if the file and/or folder should be skipped based on current settings. | def is_skipped(self, file_path: Path) -> bool:
"""Returns True if the file and/or folder should be skipped based on current settings."""
if self.directory and Path(self.directory) in file_path.resolve().parents:
file_name = os.path.relpath(file_path.resolve(), self.directory)
else:
file_name... | (self, file_path: pathlib.Path) -> bool | [
0.01650758646428585,
-0.01921491138637066,
-0.032852936536073685,
0.09434065222740173,
0.00917651504278183,
-0.005080037284642458,
0.04611578956246376,
-0.0016426468500867486,
-0.028087232261896133,
-0.05248358100652695,
0.06891004741191864,
0.01835303008556366,
0.004048313479870558,
-0.04... |
723,040 | isort.settings | is_supported_filetype | null | def is_supported_filetype(self, file_name: str) -> bool:
_root, ext = os.path.splitext(file_name)
ext = ext.lstrip(".")
if ext in self.supported_extensions:
return True
if ext in self.blocked_extensions:
return False
# Skip editor backup files.
if file_name.endswith("~"):
... | (self, file_name: str) -> bool | [
0.04229750111699104,
-0.07829301059246063,
0.025133835151791573,
0.02201990969479084,
0.007029504049569368,
-0.020592693239450455,
0.02368808351457119,
-0.0031996523030102253,
-0.025226512923836708,
-0.03241819888353348,
0.07069354504346848,
0.012603988870978355,
-0.022372080013155937,
-0.... |
723,041 | isort.api | ImportKey | Defines how to key an individual import, generally for deduping.
Import keys are defined from less to more specific:
from x.y import z as a
______| | | |
| | | |
PACKAGE | | |
________| | |
| | |
MODULE | |
... | class ImportKey(Enum):
"""Defines how to key an individual import, generally for deduping.
Import keys are defined from less to more specific:
from x.y import z as a
______| | | |
| | | |
PACKAGE | | |
________| | |
| | |
... | (value, names=None, *, module=None, qualname=None, type=None, start=1) | [
0.03344995155930519,
-0.05962817743420601,
-0.08013445138931274,
0.019324619323015213,
0.052174653857946396,
-0.048393357545137405,
0.03879467397928238,
-0.028777867555618286,
0.008180694654583931,
-0.041521571576595306,
-0.01787027344107628,
-0.008594274520874023,
0.03364992514252663,
0.0... |
723,045 | isort.api | check_code_string | Checks the order, format, and categorization of imports within the provided code string.
Returns `True` if everything is correct, otherwise `False`.
- **code**: The string of code with imports that need to be sorted.
- **show_diff**: If `True` the changes that need to be done will be printed to stdout, if ... | def check_code_string(
code: str,
show_diff: Union[bool, TextIO] = False,
extension: Optional[str] = None,
config: Config = DEFAULT_CONFIG,
file_path: Optional[Path] = None,
disregard_skip: bool = False,
**config_kwargs: Any,
) -> bool:
"""Checks the order, format, and categorization of ... | (code: str, show_diff: Union[bool, TextIO] = False, extension: Optional[str] = None, config: isort.settings.Config = Config(py_version='py3', force_to_top=frozenset(), skip=frozenset({'dist', '.tox', '.mypy_cache', '_build', '.git', '.direnv', '.venv', '.nox', 'buck-out', '.eggs', '__pypackages__', '.pytype', '.svn', '... | [
0.03717035427689552,
-0.018350834026932716,
0.016620304435491562,
-0.012564373202621937,
0.047373272478580475,
-0.018350834026932716,
0.01403352152556181,
0.008472389541566372,
-0.011699107475578785,
-0.07895545661449432,
0.019756890833377838,
0.01669240929186344,
-0.002431305358186364,
-0... |
723,047 | isort.api | check_stream | Checks any imports within the provided code stream, returning `False` if any unsorted or
incorrectly imports are found or `True` if no problems are identified.
- **input_stream**: The stream of code with imports that need to be sorted.
- **show_diff**: If `True` the changes that need to be done will be pri... | def check_stream(
input_stream: TextIO,
show_diff: Union[bool, TextIO] = False,
extension: Optional[str] = None,
config: Config = DEFAULT_CONFIG,
file_path: Optional[Path] = None,
disregard_skip: bool = False,
**config_kwargs: Any,
) -> bool:
"""Checks any imports within the provided cod... | (input_stream: <class 'TextIO'>, show_diff: Union[bool, TextIO] = False, extension: Optional[str] = None, config: isort.settings.Config = Config(py_version='py3', force_to_top=frozenset(), skip=frozenset({'dist', '.tox', '.mypy_cache', '_build', '.git', '.direnv', '.venv', '.nox', 'buck-out', '.eggs', '__pypackages__',... | [
0.0052775051444768906,
-0.02749212086200714,
-0.033798690885305405,
0.008718741126358509,
0.03904787451028824,
-0.010555010288953781,
-0.004061979707330465,
0.033666517585515976,
-0.012953018769621849,
-0.03294900432229042,
0.006991042289882898,
-0.026680197566747665,
-0.004500985145568848,
... |
723,048 | isort.api | sort_code_string | Sorts any imports within the provided code string, returning a new string with them sorted.
- **code**: The string of code with imports that need to be sorted.
- **extension**: The file extension that contains imports. Defaults to filename extension or py.
- **config**: The config object to use when sortin... | def sort_code_string(
code: str,
extension: Optional[str] = None,
config: Config = DEFAULT_CONFIG,
file_path: Optional[Path] = None,
disregard_skip: bool = False,
show_diff: Union[bool, TextIO] = False,
**config_kwargs: Any,
) -> str:
"""Sorts any imports within the provided code string,... | (code: str, extension: Optional[str] = None, config: isort.settings.Config = Config(py_version='py3', force_to_top=frozenset(), skip=frozenset({'dist', '.tox', '.mypy_cache', '_build', '.git', '.direnv', '.venv', '.nox', 'buck-out', '.eggs', '__pypackages__', '.pytype', '.svn', '.bzr', '.hg', '.pants.d', 'build', 'venv... | [
0.021655600517988205,
0.01910371333360672,
-0.01358348410576582,
-0.00944552756845951,
0.05032889172434807,
-0.02091130055487156,
-0.010615142993628979,
0.02096446417272091,
0.03820742666721344,
-0.08194394409656525,
0.019245484843850136,
-0.0038632741197943687,
-0.03269605711102486,
0.033... |
723,052 | isort.api | sort_file | Sorts and formats any groups of imports imports within the provided file or Path.
Returns `True` if the file has been changed, otherwise `False`.
- **filename**: The name or Path of the file to format.
- **extension**: The file extension that contains imports. Defaults to filename extension or py.
- *... | def sort_file(
filename: Union[str, Path],
extension: Optional[str] = None,
config: Config = DEFAULT_CONFIG,
file_path: Optional[Path] = None,
disregard_skip: bool = True,
ask_to_apply: bool = False,
show_diff: Union[bool, TextIO] = False,
write_to_stdout: bool = False,
output: Optio... | (filename: Union[str, pathlib.Path], extension: Optional[str] = None, config: isort.settings.Config = Config(py_version='py3', force_to_top=frozenset(), skip=frozenset({'dist', '.tox', '.mypy_cache', '_build', '.git', '.direnv', '.venv', '.nox', 'buck-out', '.eggs', '__pypackages__', '.pytype', '.svn', '.bzr', '.hg', '... | [
-0.0270120520144701,
-0.007804502733051777,
-0.02079499326646328,
0.01644611358642578,
-0.005420785862952471,
-0.016589034348726273,
-0.016211314126849174,
0.06602945923805237,
0.03785362467169762,
-0.08317997306585312,
-0.0038129258900880814,
-0.051247354596853256,
-0.0156804658472538,
0.... |
723,054 | isort.api | find_imports_in_code | Finds and returns all imports within the provided code string.
- **code**: The string of code with imports that need to be sorted.
- **config**: The config object to use when sorting imports.
- **file_path**: The disk location where the code string was pulled from.
- **unique**: If True, only the first... | def find_imports_in_code(
code: str,
config: Config = DEFAULT_CONFIG,
file_path: Optional[Path] = None,
unique: Union[bool, ImportKey] = False,
top_only: bool = False,
**config_kwargs: Any,
) -> Iterator[identify.Import]:
"""Finds and returns all imports within the provided code string.
... | (code: str, config: isort.settings.Config = Config(py_version='py3', force_to_top=frozenset(), skip=frozenset({'dist', '.tox', '.mypy_cache', '_build', '.git', '.direnv', '.venv', '.nox', 'buck-out', '.eggs', '__pypackages__', '.pytype', '.svn', '.bzr', '.hg', '.pants.d', 'build', 'venv', 'node_modules'}), extend_skip=... | [
-0.0011700793402269483,
-0.048394110053777695,
-0.007288715336471796,
-0.003947283606976271,
0.011071817949414253,
0.010535338893532753,
0.011164314113557339,
-0.03394617512822151,
0.02885887399315834,
-0.04869009926915169,
0.0017412445740774274,
0.003912597429007292,
-0.025362510234117508,
... |
723,055 | isort.api | find_imports_in_file | Finds and returns all imports within the provided source file.
- **filename**: The name or Path of the file to look for imports in.
- **extension**: The file extension that contains imports. Defaults to filename extension or py.
- **config**: The config object to use when sorting imports.
- **file_path... | def find_imports_in_file(
filename: Union[str, Path],
config: Config = DEFAULT_CONFIG,
file_path: Optional[Path] = None,
unique: Union[bool, ImportKey] = False,
top_only: bool = False,
**config_kwargs: Any,
) -> Iterator[identify.Import]:
"""Finds and returns all imports within the provided ... | (filename: Union[str, pathlib.Path], config: isort.settings.Config = Config(py_version='py3', force_to_top=frozenset(), skip=frozenset({'dist', '.tox', '.mypy_cache', '_build', '.git', '.direnv', '.venv', '.nox', 'buck-out', '.eggs', '__pypackages__', '.pytype', '.svn', '.bzr', '.hg', '.pants.d', 'build', 'venv', 'node... | [
-0.031338099390268326,
-0.062178466469049454,
-0.017545124515891075,
0.024312391877174377,
0.029366306960582733,
0.00783931091427803,
0.019516916945576668,
-0.03252500295639038,
0.05264494568109512,
-0.033807627856731415,
-0.016578372567892075,
-0.01820557937026024,
-0.030227771028876305,
... |
723,056 | isort.api | find_imports_in_paths | Finds and returns all imports within the provided source paths.
- **paths**: A collection of paths to recursively look for imports within.
- **extension**: The file extension that contains imports. Defaults to filename extension or py.
- **config**: The config object to use when sorting imports.
- **fi... | def find_imports_in_paths(
paths: Iterator[Union[str, Path]],
config: Config = DEFAULT_CONFIG,
file_path: Optional[Path] = None,
unique: Union[bool, ImportKey] = False,
top_only: bool = False,
**config_kwargs: Any,
) -> Iterator[identify.Import]:
"""Finds and returns all imports within the p... | (paths: Iterator[Union[str, pathlib.Path]], config: isort.settings.Config = Config(py_version='py3', force_to_top=frozenset(), skip=frozenset({'dist', '.tox', '.mypy_cache', '_build', '.git', '.direnv', '.venv', '.nox', 'buck-out', '.eggs', '__pypackages__', '.pytype', '.svn', '.bzr', '.hg', '.pants.d', 'build', 'venv'... | [
-0.04305588826537132,
-0.05264526233077049,
-0.01935204304754734,
0.03641265258193016,
-0.013190198689699173,
0.018475906923413277,
0.039243247359991074,
-0.010975785553455353,
0.028768112882971764,
-0.034602608531713486,
-0.013661964796483517,
-0.005213498137891293,
-0.01939055509865284,
... |
723,057 | isort.api | find_imports_in_stream | Finds and returns all imports within the provided code stream.
- **input_stream**: The stream of code with imports that need to be sorted.
- **config**: The config object to use when sorting imports.
- **file_path**: The disk location where the code string was pulled from.
- **unique**: If True, only t... | def find_imports_in_stream(
input_stream: TextIO,
config: Config = DEFAULT_CONFIG,
file_path: Optional[Path] = None,
unique: Union[bool, ImportKey] = False,
top_only: bool = False,
_seen: Optional[Set[str]] = None,
**config_kwargs: Any,
) -> Iterator[identify.Import]:
"""Finds and return... | (input_stream: <class 'TextIO'>, config: isort.settings.Config = Config(py_version='py3', force_to_top=frozenset(), skip=frozenset({'dist', '.tox', '.mypy_cache', '_build', '.git', '.direnv', '.venv', '.nox', 'buck-out', '.eggs', '__pypackages__', '.pytype', '.svn', '.bzr', '.hg', '.pants.d', 'build', 'venv', 'node_mod... | [
-0.03696225956082344,
-0.05137064680457115,
-0.030475690960884094,
0.002326450776308775,
0.007628242485225201,
-0.0001352824765490368,
0.022553876042366028,
-0.0028611733578145504,
0.042274538427591324,
-0.007246131543070078,
-0.02713920921087265,
-0.015955468639731407,
-0.038061995059251785... |
723,065 | isort.place | module | Returns the section placement for the given module name. | def module(name: str, config: Config = DEFAULT_CONFIG) -> str:
"""Returns the section placement for the given module name."""
return module_with_reason(name, config)[0]
| (name: str, config: isort.settings.Config = Config(py_version='py3', force_to_top=frozenset(), skip=frozenset({'dist', '.tox', '.mypy_cache', '_build', '.git', '.direnv', '.venv', '.nox', 'buck-out', '.eggs', '__pypackages__', '.pytype', '.svn', '.bzr', '.hg', '.pants.d', 'build', 'venv', 'node_modules'}), extend_skip=... | [
0.04930108040571213,
0.0011441498063504696,
0.014321860857307911,
-0.06351058185100555,
0.01736428402364254,
-0.005026048049330711,
-0.0008254300919361413,
0.03692395240068436,
-0.03294805809855461,
-0.059258103370666504,
-0.040657833218574524,
-0.04691554605960846,
-0.027122510597109795,
... |
723,071 | isort.api | sort_stream | Sorts any imports within the provided code stream, outputs to the provided output stream.
Returns `True` if anything is modified from the original input stream, otherwise `False`.
- **input_stream**: The stream of code with imports that need to be sorted.
- **output_stream**: The stream where sorted impor... | def sort_stream(
input_stream: TextIO,
output_stream: TextIO,
extension: Optional[str] = None,
config: Config = DEFAULT_CONFIG,
file_path: Optional[Path] = None,
disregard_skip: bool = False,
show_diff: Union[bool, TextIO] = False,
raise_on_skip: bool = True,
**config_kwargs: Any,
) ... | (input_stream: <class 'TextIO'>, output_stream: <class 'TextIO'>, extension: Optional[str] = None, config: isort.settings.Config = Config(py_version='py3', force_to_top=frozenset(), skip=frozenset({'dist', '.tox', '.mypy_cache', '_build', '.git', '.direnv', '.venv', '.nox', 'buck-out', '.eggs', '__pypackages__', '.pyty... | [
-0.009205320850014687,
-0.0033357348293066025,
-0.012437991797924042,
0.0007415536674670875,
0.008094247430562973,
0.0046881274320185184,
-0.012608926743268967,
0.07935378700494766,
0.03203511983156204,
-0.06378869712352753,
0.024252576753497124,
-0.03748491033911705,
-0.010346558876335621,
... |
723,075 | mathprimes | _is_prime |
Returns whether or not an integer is prime.
Uses the fact that all prime numbers except two and three are one more or one less than a multiple of six.
The checks whether a given list of smaller primes are factors.
If not then the number is prime.
| def _is_prime(i: int, prev: Tuple[int]) -> bool:
"""
Returns whether or not an integer is prime.
Uses the fact that all prime numbers except two and three are one more or one less than a multiple of six.
The checks whether a given list of smaller primes are factors.
If not then the number is prime.
... | (i: int, prev: Tuple[int]) -> bool | [
0.023146670311689377,
0.007079935632646084,
-0.058338671922683716,
0.04765268787741661,
-0.0464821383357048,
0.0018950628582388163,
0.04323480650782585,
0.012422927655279636,
-0.06645699590444565,
0.032586585730314255,
0.05954698100686073,
-0.0025582166854292154,
0.006900577340275049,
-0.0... |
723,076 | mathprimes | is_prime | A function that implents ``_is_prime`` from above but will auto generate primes if not given. | def is_prime(number: int, primes = None) -> bool:
"""A function that implents ``_is_prime`` from above but will auto generate primes if not given."""
if primes is None:
for i, primes in prime_gen():
if i >= number:
break
return number in primes
| (number: int, primes=None) -> bool | [
0.04924516752362251,
-0.02034691907465458,
-0.053333304822444916,
0.015246124006807804,
-0.0025761823635548353,
0.02934832125902176,
-0.001298639690503478,
0.005893105175346136,
-0.07403653115034103,
0.029292061924934387,
0.01551804132759571,
0.025278937071561813,
0.019971860572695732,
0.0... |
723,077 | mathprimes | prime_factorization |
Given any integer and an optional iterable of primes.
Returns a dictionary of the prime factors and their occurences.
| def prime_factorization(number: int, primes = None):
"""
Given any integer and an optional iterable of primes.
Returns a dictionary of the prime factors and their occurences.
"""
if number <= 1:
return None
# If primes is not given autogenerate them.
if primes is None:
for i,... | (number: int, primes=None) | [
0.01729862205684185,
-0.00565258739516139,
-0.030961407348513603,
0.041471242904663086,
-0.004035871475934982,
0.02185288444161415,
-0.006812456529587507,
-0.03813839331269264,
-0.03365040943026543,
-0.018775679171085358,
-0.004748362582176924,
0.04480409249663353,
-0.02172032743692398,
0.... |
723,078 | mathprimes | prime_gen | An infinite generator yielding a tuple of ``(prime_number, previous_prime_numbers)`` | def prime_gen() -> Generator[Tuple[int,Tuple[int]], None, None]:
"""An infinite generator yielding a tuple of ``(prime_number, previous_prime_numbers)``"""
primes = ()
i = 2
while True:
if _is_prime(i, primes):
primes += (i,)
yield i, primes
i += 1
| () -> Generator[Tuple[int, Tuple[int]], NoneType, NoneType] | [
0.007770773954689503,
-0.031510163098573685,
-0.027369463816285133,
0.009014840237796307,
-0.03817613050341606,
0.02918914332985878,
-0.0010195078793913126,
0.01862386241555214,
0.018902383744716644,
-0.0023198591079562902,
0.028762076050043106,
0.008392807096242905,
-0.007770773954689503,
... |
723,263 | exponent_server_sdk | DeviceNotRegisteredError | Raised when the push token is invalid
To handle this error, you should stop sending messages to this token.
| class DeviceNotRegisteredError(PushTicketError):
"""Raised when the push token is invalid
To handle this error, you should stop sending messages to this token.
"""
pass
| (push_response) | [
-0.012716928496956825,
-0.023513304069638252,
-0.019402962177991867,
0.04964717477560043,
-0.0020630231592804193,
-0.03645459562540054,
-0.03421096131205559,
0.002889802912250161,
0.011882295832037926,
-0.033564791083335876,
0.06382695585489273,
-0.008144398219883442,
0.0485343299806118,
-... |
723,264 | exponent_server_sdk | __init__ | null | def __init__(self, push_response):
if push_response.message:
self.message = push_response.message
else:
self.message = 'Unknown push ticket error'
super(PushTicketError, self).__init__(self.message)
self.push_response = push_response
| (self, push_response) | [
-0.030276266857981682,
-0.004212532192468643,
-0.014793873764574528,
0.03444460406899452,
-0.04075293615460396,
-0.03798024728894234,
-0.013742485083639622,
0.06981963664293289,
0.04462353512644768,
-0.01862725429236889,
0.05221585929393768,
0.033402521163225174,
0.010299885645508766,
-0.0... |
723,265 | exponent_server_sdk | InvalidCredentialsError | Raised when our push notification credentials for your standalone app
are invalid (ex: you may have revoked them).
Run expo build:ios -c to regenerate new push notification credentials for
iOS. If you revoke an APN key, all apps that rely on that key will no
longer be able to send or receive push noti... | class InvalidCredentialsError(PushTicketError):
"""Raised when our push notification credentials for your standalone app
are invalid (ex: you may have revoked them).
Run expo build:ios -c to regenerate new push notification credentials for
iOS. If you revoke an APN key, all apps that rely on that key ... | (push_response) | [
-0.05107339471578598,
-0.06535758078098297,
-0.015697723254561424,
0.054532844573259354,
0.033292561769485474,
-0.0654691755771637,
-0.0282707791775465,
0.016209200024604797,
0.028549768030643463,
-0.04422888904809952,
0.055276814848184586,
0.04400569945573807,
0.01896188221871853,
0.00769... |
723,267 | exponent_server_sdk | MessageRateExceededError | Raised when you are sending messages too frequently to a device
You should implement exponential backoff and slowly retry sending messages.
| class MessageRateExceededError(PushTicketError):
"""Raised when you are sending messages too frequently to a device
You should implement exponential backoff and slowly retry sending messages.
"""
pass
| (push_response) | [
-0.037001609802246094,
-0.05502710118889809,
-0.04142571613192558,
0.05791556462645531,
-0.021572085097432137,
-0.05272363871335983,
-0.03915882110595703,
-0.019908476620912552,
-0.0025434037670493126,
-0.04906735569238663,
0.05308926850557327,
0.005219347774982452,
0.018409399315714836,
0... |
723,269 | exponent_server_sdk | MessageTooBigError | Raised when the notification was too large.
On Android and iOS, the total payload must be at most 4096 bytes.
| class MessageTooBigError(PushTicketError):
"""Raised when the notification was too large.
On Android and iOS, the total payload must be at most 4096 bytes.
"""
pass
| (push_response) | [
-0.046211715787649155,
-0.028730075806379318,
-0.04130396246910095,
0.06068422272801399,
-0.022371485829353333,
-0.0524091012775898,
-0.035805124789476395,
0.005668995436280966,
-0.00759896170347929,
-0.07153860479593277,
0.05860648676753044,
0.03347662836313248,
0.004983880091458559,
-0.0... |
723,271 | exponent_server_sdk | PushClient | Exponent push client
See full API docs at https://docs.expo.io/versions/latest/guides/push-notifications.html#http2-api
| class PushClient(object):
"""Exponent push client
See full API docs at https://docs.expo.io/versions/latest/guides/push-notifications.html#http2-api
"""
DEFAULT_HOST = "https://exp.host"
DEFAULT_BASE_API_URL = "/--/api/v2"
DEFAULT_MAX_MESSAGE_COUNT = 100
DEFAULT_MAX_RECEIPT_COUNT = 1000
... | (host=None, api_url=None, session=None, force_fcm_v1=None, **kwargs) | [
0.010297478176653385,
-0.04389123246073723,
-0.09917408972978592,
0.004376559052616358,
0.012417701072990894,
0.005044036544859409,
-0.05193237587809563,
0.004536230117082596,
-0.00648631202057004,
-0.015234194695949554,
0.030196163803339005,
0.01448033843189478,
0.028730330988764763,
-0.0... |
723,272 | exponent_server_sdk | __init__ | Construct a new PushClient object.
Args:
host: The server protocol, hostname, and port.
api_url: The api url at the host.
session: Pass in your own requests.Session object if you prefer
to customize
force_fcm_v1: If True, send Android notification... | def __init__(self, host=None, api_url=None, session=None, force_fcm_v1=None, **kwargs):
"""Construct a new PushClient object.
Args:
host: The server protocol, hostname, and port.
api_url: The api url at the host.
session: Pass in your own requests.Session object if you prefer
... | (self, host=None, api_url=None, session=None, force_fcm_v1=None, **kwargs) | [
-0.013256859965622425,
-0.049136217683553696,
-0.052455201745033264,
-0.020352618768811226,
0.005369505379348993,
0.016022680327296257,
-0.012713233008980751,
0.03660419210791588,
-0.013199635781347752,
-0.01586054638028145,
0.017195768654346466,
0.007367571350187063,
-0.004198800306767225,
... |
723,273 | exponent_server_sdk | _check_receipts_internal |
Helper function for check_receipts_multiple
| def _check_receipts_internal(self, push_tickets):
"""
Helper function for check_receipts_multiple
"""
response = self.session.post(
self.host + self.api_url + '/push/getReceipts',
json={'ids': [push_ticket.id for push_ticket in push_tickets]},
timeout=self.timeout)
receipts =... | (self, push_tickets) | [
0.011182588525116444,
-0.01908237673342228,
-0.07906810194253922,
0.054842084646224976,
-0.07443355768918991,
-0.025647977367043495,
-0.04072779417037964,
-0.027649257332086563,
0.0734504759311676,
0.015571359544992447,
0.0035461271181702614,
-0.004349272232502699,
0.017739413306117058,
-0... |
723,274 | exponent_server_sdk | _publish_internal | Send push notifications
The server will validate any type of syntax errors and the client will
raise the proper exceptions for the user to handle.
Each notification is of the form:
{
'to': 'ExponentPushToken[xxx]',
'body': 'This text gets display in the notification... | def _publish_internal(self, push_messages):
"""Send push notifications
The server will validate any type of syntax errors and the client will
raise the proper exceptions for the user to handle.
Each notification is of the form:
{
'to': 'ExponentPushToken[xxx]',
'body': 'This text gets di... | (self, push_messages) | [
-0.016502978280186653,
-0.04134724289178848,
-0.11095109581947327,
0.037196554243564606,
-0.0058668386191129684,
-0.004235498141497374,
-0.04318312555551529,
0.02530323527753353,
-0.014178193174302578,
-0.008151712827384472,
0.02951378934085369,
0.007592966314405203,
0.04553784057497978,
-... |
723,275 | exponent_server_sdk | check_receipts | Checks the push receipts of the given push tickets | def check_receipts(self, push_tickets):
""" Checks the push receipts of the given push tickets """
# Delayed import because this file is immediately read on install, and
# the requests library may not be installed yet.
response = requests.post(
self.host + self.api_url + '/push/getReceipts',
... | (self, push_tickets) | [
0.001713440753519535,
-0.020408790558576584,
-0.08261115849018097,
0.02744990959763527,
-0.05838552117347717,
-0.0030543471220880747,
-0.04454728215932846,
-0.013777240179479122,
0.05636381357908249,
0.010997392237186432,
0.0003836996329482645,
-0.011406962759792805,
0.019119080156087875,
... |
723,276 | exponent_server_sdk | check_receipts_multiple |
Check receipts in batches of 1000 as per expo docs
| def check_receipts_multiple(self, push_tickets):
"""
Check receipts in batches of 1000 as per expo docs
"""
receipts = []
for start in itertools.count(0, self.max_receipt_count):
chunk = list(
itertools.islice(push_tickets, start,
start + self.max_rec... | (self, push_tickets) | [
0.0020690099336206913,
-0.012651326134800911,
-0.09549879282712936,
0.05394880846142769,
-0.053530871868133545,
0.01179803628474474,
-0.03792785853147507,
-0.06181997060775757,
0.05642160773277283,
-0.016795877367258072,
0.02751423977315426,
0.01191122829914093,
-0.00011604848987190053,
-0... |
723,277 | exponent_server_sdk | publish | Sends a single push notification
Args:
push_message: A single PushMessage object.
Returns:
A PushTicket object which contains the results.
| def publish(self, push_message):
"""Sends a single push notification
Args:
push_message: A single PushMessage object.
Returns:
A PushTicket object which contains the results.
"""
return self.publish_multiple([push_message])[0]
| (self, push_message) | [
-0.020122338086366653,
-0.03795604407787323,
-0.08506660908460617,
0.030931711196899414,
0.006817475892603397,
-0.024752411991357803,
-0.027199484407901764,
-0.001600940595380962,
0.03526250272989273,
0.0036926160100847483,
0.0075788856483995914,
-0.0017516820225864649,
0.006183701567351818,... |
723,278 | exponent_server_sdk | publish_multiple | Sends multiple push notifications at once
Args:
push_messages: An array of PushMessage objects.
Returns:
An array of PushTicket objects which contains the results.
| def publish_multiple(self, push_messages):
"""Sends multiple push notifications at once
Args:
push_messages: An array of PushMessage objects.
Returns:
An array of PushTicket objects which contains the results.
"""
push_tickets = []
for start in itertools.count(0, self.max_message_... | (self, push_messages) | [
-0.032319601625204086,
-0.024329081177711487,
-0.1274908185005188,
0.020020993426442146,
-0.060277488082647324,
0.019055694341659546,
-0.03560876473784447,
-0.042973630130290985,
0.010805973783135414,
0.02915557101368904,
-0.009161392226815224,
0.004826489370316267,
0.0034522805362939835,
... |
723,279 | exponent_server_sdk | validate_and_get_receipts |
Validate and get receipts for requests
| def validate_and_get_receipts(self, response):
"""
Validate and get receipts for requests
"""
# Let's validate the response format first.
try:
response_data = response.json()
except ValueError:
# The response isn't json. First, let's attempt to raise a normal
# http error... | (self, response) | [
0.001911254832521081,
0.016951201483607292,
-0.06787822395563126,
-0.005038554314523935,
-0.036123406141996384,
-0.019420001655817032,
-0.029056580737233162,
0.0007491292781196535,
0.02136567234992981,
0.017143933102488518,
0.034030891954898834,
0.026395048946142197,
0.0738987922668457,
-0... |
723,280 | exponent_server_sdk | PushMessage | An object that describes a push notification request.
You can override this class to provide your own custom validation before
sending these to the Exponent push servers. You can also override the
get_payload function itself to take advantage of any hidden or new
arguments before this library updates u... | class PushMessage(
namedtuple('PushMessage', [
'to', 'data', 'title', 'body', 'sound', 'ttl', 'expiration',
'priority', 'badge', 'category', 'display_in_foreground',
'channel_id', 'subtitle', 'mutable_content'
])):
"""An object that describes a push notification r... | (to=None, data=None, title=None, body=None, sound=None, ttl=None, expiration=None, priority=None, badge=None, category=None, display_in_foreground=None, channel_id=None, subtitle=None, mutable_content=None) | [
0.03081047162413597,
-0.020344318822026253,
-0.06671682745218277,
0.010456353425979614,
0.03508317098021507,
-0.052644357085227966,
0.0020359018817543983,
0.01968773454427719,
0.01792377606034279,
-0.04707808792591095,
0.020834308117628098,
0.012367308139801025,
0.0414334200322628,
0.00832... |
723,282 | namedtuple_PushMessage | __new__ | Create new instance of PushMessage(to, data, title, body, sound, ttl, expiration, priority, badge, category, display_in_foreground, channel_id, subtitle, mutable_content) | from builtins import function
| (_cls, to=None, data=None, title=None, body=None, sound=None, ttl=None, expiration=None, priority=None, badge=None, category=None, display_in_foreground=None, channel_id=None, subtitle=None, mutable_content=None) | [
0.009987438097596169,
-0.03448875993490219,
0.019406022503972054,
0.011531468480825424,
0.012425380758941174,
0.06140364706516266,
-0.0008573431405238807,
0.005846999119967222,
-0.012457886710762978,
-0.02476949617266655,
-0.015155876986682415,
0.03673166781663895,
0.0068709347397089005,
0... |
723,285 | collections | _replace | Return a new PushMessage object replacing specified fields with new values | def namedtuple(typename, field_names, *, rename=False, defaults=None, module=None):
"""Returns a new subclass of tuple with named fields.
>>> Point = namedtuple('Point', ['x', 'y'])
>>> Point.__doc__ # docstring for the new class
'Point(x, y)'
>>> p = Point(11, y=22) #... | (self, /, **kwds) | [
0.05422734469175339,
0.0013971473090350628,
-0.015411114320158958,
-0.035643354058265686,
-0.032841332256793976,
-0.03327399864792824,
0.002850953256711364,
0.02148902788758278,
0.020973950624465942,
-0.04615093022584915,
-0.04219513759016991,
0.057070571929216385,
0.004468296188861132,
0.... |
723,286 | exponent_server_sdk | get_payload | null | def get_payload(self):
# Sanity check for invalid push token format.
if not PushClient.is_exponent_push_token(self.to):
raise ValueError('Invalid push token')
# There is only one required field.
payload = {
'to': self.to,
}
# All of these fields are optional.
if self.data is ... | (self) | [
-0.0014762911014258862,
-0.0058564417995512486,
-0.022256428375840187,
-0.023659635335206985,
0.01139131560921669,
0.021320955827832222,
-0.003169397125020623,
-0.027167653664946556,
0.005900292191654444,
-0.021847158670425415,
0.04322658106684685,
0.009559350088238716,
-0.001299672061577439... |
723,287 | exponent_server_sdk | PushReceipt | Wrapper class for a PushReceipt response. Similar to a PushResponse
A successful single push notification:
'data': {
'id': {'status': 'ok'}
}
Errors contain 'errors'
| class PushReceipt(
namedtuple('PushReceipt', ['id', 'status', 'message', 'details'])):
"""Wrapper class for a PushReceipt response. Similar to a PushResponse
A successful single push notification:
'data': {
'id': {'status': 'ok'}
}
Errors contain 'errors'
"""
# ... | (id, status, message, details) | [
0.018073856830596924,
0.007103158626705408,
-0.05925792083144188,
-0.007041391916573048,
-0.0016047436511144042,
-0.10270359367132187,
-0.036717865616083145,
0.02387041412293911,
0.03945460170507431,
-0.03886544331908226,
0.00993967056274414,
0.0288117416203022,
0.05560894310474396,
0.0191... |
723,289 | namedtuple_PushReceipt | __new__ | Create new instance of PushReceipt(id, status, message, details) | from builtins import function
| (_cls, id, status, message, details) | [
0.009987438097596169,
-0.03448875993490219,
0.019406022503972054,
0.011531468480825424,
0.012425380758941174,
0.06140364706516266,
-0.0008573431405238807,
0.005846999119967222,
-0.012457886710762978,
-0.02476949617266655,
-0.015155876986682415,
0.03673166781663895,
0.0068709347397089005,
0... |
723,292 | collections | _replace | Return a new PushReceipt object replacing specified fields with new values | def namedtuple(typename, field_names, *, rename=False, defaults=None, module=None):
"""Returns a new subclass of tuple with named fields.
>>> Point = namedtuple('Point', ['x', 'y'])
>>> Point.__doc__ # docstring for the new class
'Point(x, y)'
>>> p = Point(11, y=22) #... | (self, /, **kwds) | [
0.054226528853178024,
0.0013675098307430744,
-0.015400581061840057,
-0.035684023052453995,
-0.03284083679318428,
-0.03329410031437874,
0.0028148554265499115,
0.021509306505322456,
0.020942730829119682,
-0.04615023732185364,
-0.04219450056552887,
0.05706971138715744,
0.004509434569627047,
0... |
723,293 | exponent_server_sdk | is_success | Returns True if this push notification successfully sent. | def is_success(self):
"""Returns True if this push notification successfully sent."""
return self.status == PushReceipt.SUCCESS_STATUS
| (self) | [
0.023290462791919708,
0.0005403563845902681,
-0.018603414297103882,
0.012296712026000023,
0.053566254675388336,
-0.052625223994255066,
-0.027326026931405067,
0.010134155862033367,
0.04965736344456673,
0.01648610085248947,
0.003818405093625188,
-0.024738198146224022,
0.056135986000299454,
-... |
723,294 | exponent_server_sdk | validate_response | Raises an exception if there was an error. Otherwise, do nothing.
Clients should handle these errors, since these require custom handling
to properly resolve.
| def validate_response(self):
"""Raises an exception if there was an error. Otherwise, do nothing.
Clients should handle these errors, since these require custom handling
to properly resolve.
"""
if self.is_success():
return
# Handle the error if we have any information
if self.detail... | (self) | [
0.021375853568315506,
0.004689504392445087,
-0.030811361968517303,
0.021093351766467094,
-0.02721419185400009,
-0.0749567374587059,
-0.03452153131365776,
0.0025377939455211163,
0.03610353171825409,
0.002204679185524583,
0.06704672425985336,
0.048891376703977585,
0.09356408566236496,
-0.025... |
723,295 | exponent_server_sdk | PushServerError | Raised when the push token server is not behaving as expected
For example, invalid push notification arguments result in a different
style of error. Instead of a "data" array containing errors per
notification, an "error" array is returned.
{"errors": [
{"code": "API_ERROR",
"message": "c... | class PushServerError(Exception):
"""Raised when the push token server is not behaving as expected
For example, invalid push notification arguments result in a different
style of error. Instead of a "data" array containing errors per
notification, an "error" array is returned.
{"errors": [
{... | (message, response, response_data=None, errors=None) | [
-0.02972760610282421,
-0.02566753886640072,
-0.02471688948571682,
0.01383393257856369,
0.00787751842290163,
-0.033728256821632385,
-0.011279061436653137,
0.03957078978419304,
0.06840716302394867,
-0.049671441316604614,
0.07331885397434235,
0.04436364769935608,
0.05359287187457085,
-0.01793... |
723,296 | exponent_server_sdk | __init__ | null | def __init__(self, message, response, response_data=None, errors=None):
self.message = message
self.response = response
self.response_data = response_data
self.errors = errors
super(PushServerError, self).__init__(self.message)
| (self, message, response, response_data=None, errors=None) | [
-0.04476040229201317,
-0.015395903028547764,
-0.02886969782412052,
-0.02198055386543274,
-0.01691836677491665,
-0.009934068657457829,
-0.019325759261846542,
0.06169779971241951,
0.05077413097023964,
-0.018183913081884384,
0.04240058362483978,
0.04049750789999962,
0.015062864869832993,
-0.0... |
723,297 | exponent_server_sdk | PushTicket | Wrapper class for a push notification response.
A successful single push notification:
{'status': 'ok'}
An invalid push token
{'status': 'error',
'message': '"adsf" is not a registered push notification recipient'}
| class PushTicket(
namedtuple('PushTicket',
['push_message', 'status', 'message', 'details', 'id'])):
"""Wrapper class for a push notification response.
A successful single push notification:
{'status': 'ok'}
An invalid push token
{'status': 'error',
'mes... | (push_message, status, message, details, id) | [
0.043587543070316315,
-0.003485018853098154,
-0.060221124440431595,
0.007645776960998774,
-0.0206785649061203,
-0.08468005061149597,
-0.027464311569929123,
0.01480010710656643,
0.005963516887277365,
-0.02806916832923889,
0.014592187479138374,
0.022417530417442322,
0.03417444974184036,
-0.0... |
723,299 | namedtuple_PushTicket | __new__ | Create new instance of PushTicket(push_message, status, message, details, id) | from builtins import function
| (_cls, push_message, status, message, details, id) | [
0.009987438097596169,
-0.03448875993490219,
0.019406022503972054,
0.011531468480825424,
0.012425380758941174,
0.06140364706516266,
-0.0008573431405238807,
0.005846999119967222,
-0.012457886710762978,
-0.02476949617266655,
-0.015155876986682415,
0.03673166781663895,
0.0068709347397089005,
0... |
723,302 | collections | _replace | Return a new PushTicket object replacing specified fields with new values | def namedtuple(typename, field_names, *, rename=False, defaults=None, module=None):
"""Returns a new subclass of tuple with named fields.
>>> Point = namedtuple('Point', ['x', 'y'])
>>> Point.__doc__ # docstring for the new class
'Point(x, y)'
>>> p = Point(11, y=22) #... | (self, /, **kwds) | [
0.05422734469175339,
0.0013971473090350628,
-0.015411114320158958,
-0.035643354058265686,
-0.032841332256793976,
-0.03327399864792824,
0.002850953256711364,
0.02148902788758278,
0.020973950624465942,
-0.04615093022584915,
-0.04219513759016991,
0.057070571929216385,
0.004468296188861132,
0.... |
723,303 | exponent_server_sdk | is_success | Returns True if this push notification successfully sent. | def is_success(self):
"""Returns True if this push notification successfully sent."""
return self.status == PushTicket.SUCCESS_STATUS
| (self) | [
0.028607897460460663,
-0.007993118837475777,
-0.030497098341584206,
0.02315620332956314,
0.032980047166347504,
-0.05293360725045204,
-0.02286832593381405,
0.021500904113054276,
0.033663757145404816,
0.020475337281823158,
0.012009918689727783,
-0.03767606243491173,
0.03911545127630234,
-0.0... |
723,304 | exponent_server_sdk | validate_response | Raises an exception if there was an error. Otherwise, do nothing.
Clients should handle these errors, since these require custom handling
to properly resolve.
| def validate_response(self):
"""Raises an exception if there was an error. Otherwise, do nothing.
Clients should handle these errors, since these require custom handling
to properly resolve.
"""
if self.is_success():
return
# Handle the error if we have any information
if self.detail... | (self) | [
0.029154015704989433,
0.0010672452626749873,
-0.03807060047984123,
0.026181820780038834,
-0.036783281713724136,
-0.06788720935583115,
-0.030573854222893715,
0.003717610379680991,
0.02707158774137497,
0.003970814868807793,
0.0715598613023758,
0.039793338626623154,
0.08594755828380585,
-0.03... |
723,305 | exponent_server_sdk | PushTicketError | Base class for all push ticket errors | class PushTicketError(Exception):
"""Base class for all push ticket errors"""
def __init__(self, push_response):
if push_response.message:
self.message = push_response.message
else:
self.message = 'Unknown push ticket error'
super(PushTicketError, self).__init__(s... | (push_response) | [
-0.030504446476697922,
-0.023132698610424995,
-0.03493901342153549,
0.04557429626584053,
-0.04307865351438522,
-0.06074013188481331,
-0.028930271044373512,
0.05129507929086685,
0.05041200667619705,
-0.032596949487924576,
0.06031779199838638,
0.02754806913435459,
0.022000061348080635,
-0.01... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.