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 |
|---|---|---|---|---|---|---|
148 | arpeggio | ParsingExpression |
An abstract class for all parsing expressions.
Represents the node of the Parser Model.
Attributes:
elements: A list (or other python object) used as a staging structure
for python based grammar definition. Used in _from_python for
building nodes list of child parser expres... | class ParsingExpression(object):
"""
An abstract class for all parsing expressions.
Represents the node of the Parser Model.
Attributes:
elements: A list (or other python object) used as a staging structure
for python based grammar definition. Used in _from_python for
bu... | (*elements, **kwargs) | [
0.020538894459605217,
-0.0159036573022604,
0.004320560488849878,
0.02167772501707077,
0.008351418189704418,
0.029449738562107086,
-0.01190776377916336,
-0.029609574005007744,
0.020698729902505875,
-0.05965869501233101,
0.015494078397750854,
-0.010024698451161385,
0.018271224573254585,
0.02... |
152 | arpeggio | RegExMatch |
This Match class will perform input matching based on Regular Expressions.
Args:
to_match (regex string): A regular expression string to match.
It will be used to create regular expression using re.compile.
ignore_case(bool): If case insensitive match is needed.
Default... | class RegExMatch(Match):
'''
This Match class will perform input matching based on Regular Expressions.
Args:
to_match (regex string): A regular expression string to match.
It will be used to create regular expression using re.compile.
ignore_case(bool): If case insensitive matc... | (to_match, rule_name='', root=False, ignore_case=None, multiline=None, str_repr=None, re_flags=re.MULTILINE, **kwargs) | [
0.03260823339223862,
-0.05201656371355057,
0.03340992331504822,
0.011848216876387596,
-0.031154006719589233,
-0.07453843206167221,
0.022130344063043594,
-0.01393633708357811,
-0.011121103540062904,
-0.04124037176370621,
-0.007019439246505499,
0.07159268856048584,
0.006702492479234934,
0.01... |
153 | arpeggio | __init__ | null | def __init__(self, to_match, rule_name='', root=False, ignore_case=None,
multiline=None, str_repr=None, re_flags=re.MULTILINE,
**kwargs):
super(RegExMatch, self).__init__(rule_name, root, **kwargs)
self.to_match_regex = to_match
self.ignore_case = ignore_case
self.multiline = m... | (self, to_match, rule_name='', root=False, ignore_case=None, multiline=None, str_repr=None, re_flags=re.MULTILINE, **kwargs) | [
0.023164985701441765,
-0.02805675007402897,
0.06462091952562332,
0.011555907316505909,
-0.0677403062582016,
-0.0589493066072464,
0.06508173793554306,
-0.006407148204743862,
-0.02383849024772644,
-0.005379168316721916,
-0.002731678308919072,
0.06320301443338394,
-0.0021224231459200382,
0.02... |
157 | arpeggio | _parse | null | def _parse(self, parser):
c_pos = parser.position
m = self.regex.match(parser.input, c_pos)
if m:
matched = m.group()
if parser.debug:
parser.dprint(
"++ Match '%s' at %d => '%s'" %
(matched, c_pos, parser.context(len(matched))))
parser.pos... | (self, parser) | [
-0.01064167357981205,
-0.01333370991051197,
0.006562967784702778,
0.03055190108716488,
-0.010948818176984787,
-0.008658780716359615,
0.06475340574979782,
0.03385822847485542,
-0.026811959221959114,
-0.006784292869269848,
0.026071196421980858,
0.0461440309882164,
0.018085423856973648,
0.014... |
159 | arpeggio | compile | null | def compile(self):
flags = self.explicit_flags
if self.multiline is True:
flags |= re.DOTALL
if self.multiline is False and flags & re.DOTALL:
flags -= re.DOTALL
if self.ignore_case is True:
flags |= re.IGNORECASE
if self.ignore_case is False and flags & re.IGNORECASE:
... | (self) | [
0.009636810049414635,
-0.030676886439323425,
0.05274885520339012,
0.005775964353233576,
-0.0553373247385025,
-0.07800394296646118,
0.05831056833267212,
-0.019833289086818695,
-0.02170468494296074,
-0.03833736479282379,
-0.016396569088101387,
0.07422617077827454,
-0.013755627907812595,
0.01... |
161 | arpeggio | Repetition |
Base class for all repetition-like parser expressions (?,*,+)
Args:
eolterm(bool): Flag that indicates that end of line should
terminate repetition match.
| class Repetition(ParsingExpression):
"""
Base class for all repetition-like parser expressions (?,*,+)
Args:
eolterm(bool): Flag that indicates that end of line should
terminate repetition match.
"""
def __init__(self, *elements, **kwargs):
super(Repetition, self).__init_... | (*elements, **kwargs) | [
-0.02474520355463028,
-0.03164084255695343,
-0.008804408833384514,
0.0023107274901121855,
-0.023936986923217773,
-0.0024547448847442865,
-0.004286130890250206,
-0.036524537950754166,
0.004292579367756844,
-0.00585527578368783,
0.061390116810798645,
0.018898526206612587,
0.029714880511164665,... |
165 | arpeggio | SemanticAction |
Semantic actions are executed during semantic analysis. They are in charge
of producing Abstract Semantic Graph (ASG) out of the parse tree.
Every non-terminal and terminal can have semantic action defined which will
be triggered during semantic analysis.
Semantic action triggering is separated in ... | class SemanticAction(object):
"""
Semantic actions are executed during semantic analysis. They are in charge
of producing Abstract Semantic Graph (ASG) out of the parse tree.
Every non-terminal and terminal can have semantic action defined which will
be triggered during semantic analysis.
Semant... | () | [
0.018012182787060738,
-0.010212223045527935,
0.011873586103320122,
-0.014267075806856155,
0.030111039057374,
-0.00869634561240673,
0.0029637033585458994,
0.025793371722102165,
0.04873332753777504,
-0.061986688524484634,
0.03187565132975578,
0.025023700669407845,
-0.003125615883618593,
-0.0... |
166 | arpeggio | first_pass |
Called in the first pass of tree walk.
This is the default implementation used if no semantic action is
defined.
| def first_pass(self, parser, node, nodes):
"""
Called in the first pass of tree walk.
This is the default implementation used if no semantic action is
defined.
"""
if isinstance(node, Terminal):
# Default for Terminal is to convert to string unless suppress flag
# is set in which... | (self, parser, node, nodes) | [
-0.007651212625205517,
0.018789522349834442,
0.06295324862003326,
-0.021683072671294212,
0.01516331173479557,
-0.004970969632267952,
0.04555485397577286,
0.03639194741845131,
0.09392906725406647,
-0.04700163006782532,
0.04329195246100426,
0.016443151980638504,
-0.011193955317139626,
-0.017... |
167 | arpeggio | SemanticActionBodyWithBraces | null | class SemanticActionBodyWithBraces(SemanticAction):
def first_pass(self, parser, node, children):
return children[1:-1]
| () | [
-0.004547335673123598,
-0.001474604825489223,
0.015976889058947563,
-0.06985407322645187,
-0.033073123544454575,
-0.04085606336593628,
0.004560453351587057,
0.04435401409864426,
0.04648776352405548,
-0.04946102201938629,
0.05292399227619171,
0.017620926722884178,
-0.011928011663258076,
0.0... |
168 | arpeggio | first_pass | null | def first_pass(self, parser, node, children):
return children[1:-1]
| (self, parser, node, children) | [
-0.030603032559156418,
0.029131732881069183,
0.012376226484775543,
-0.029737563803792,
-0.01933460868895054,
0.02399083971977234,
0.07609216123819351,
0.055770911276340485,
0.09845591336488724,
-0.0346534363925457,
0.0429273322224617,
0.026292990893125534,
0.004933181218802929,
0.015448646... |
169 | arpeggio | SemanticActionResults |
Used in visitor methods call to supply results of semantic analysis
of children parse tree nodes.
Enables dot access by the name of the rule similar to NonTerminal
tree navigation.
Enables index access as well as iteration.
| class SemanticActionResults(list):
"""
Used in visitor methods call to supply results of semantic analysis
of children parse tree nodes.
Enables dot access by the name of the rule similar to NonTerminal
tree navigation.
Enables index access as well as iteration.
"""
def __init__(self):
... | () | [
0.004846133757382631,
-0.0046102795749902725,
-0.008428446017205715,
-0.04161711782217026,
0.028177887201309204,
0.042079925537109375,
-0.02782187983393669,
-0.04752682149410248,
0.057316988706588745,
0.0043833255767822266,
0.03908947482705116,
0.016785690560936928,
0.041830722242593765,
-... |
170 | arpeggio | __getattr__ | null | def __getattr__(self, attr_name):
if attr_name == 'results':
raise AttributeError
return self.results.get(attr_name, [])
| (self, attr_name) | [
0.07413720339536667,
-0.004590591881424189,
0.0007710088393650949,
-0.02314208447933197,
0.014390732161700726,
-0.00487428018823266,
0.018878163769841194,
-0.05856013670563698,
0.09091778844594955,
0.046628035604953766,
0.012800358235836029,
0.04566521570086479,
0.0522674135863781,
-0.0055... |
171 | arpeggio | __init__ | null | def __init__(self):
self.results = {}
| (self) | [
0.0193779394030571,
0.0018895156681537628,
-0.0733165368437767,
-0.011245531029999256,
-0.0005582186859101057,
0.008398772217333317,
-0.06858858466148376,
0.006838048808276653,
0.05690188705921173,
0.011004139669239521,
-0.004251410253345966,
0.03908883407711983,
-0.006821400951594114,
0.0... |
172 | arpeggio | append_result | null | def append_result(self, name, result):
if name:
if name not in self.results:
self.results[name] = []
self.results[name].append(result)
self.append(result)
| (self, name, result) | [
0.004368105437606573,
0.01452649012207985,
-0.08106391131877899,
0.005989214405417442,
0.02324577048420906,
0.03226980194449425,
-0.06548772007226944,
-0.03765374794602394,
0.04845549538731575,
0.010285364463925362,
0.04395194351673126,
-0.011639815755188465,
0.023127255961298943,
-0.00902... |
173 | arpeggio | SemanticActionSingleChild | null | class SemanticActionSingleChild(SemanticAction):
def first_pass(self, parser, node, children):
return children[0]
| () | [
-0.01855526491999626,
0.006345097906887531,
0.015107791870832443,
-0.022988978773355484,
0.005607600323855877,
-0.005188666749745607,
0.06214180961251259,
0.06109447777271271,
0.0651092603802681,
-0.02309371344745159,
0.03260699659585953,
0.032240428030490875,
0.01581474207341671,
0.013868... |
174 | arpeggio | first_pass | null | def first_pass(self, parser, node, children):
return children[0]
| (self, parser, node, children) | [
-0.01746417209506035,
0.01926424540579319,
0.020250825211405754,
-0.017645910382270813,
-0.0034054270945489407,
0.02528756856918335,
0.09671932458877563,
0.053448330610990524,
0.07747238129377365,
-0.0236778873950243,
0.04005163162946701,
0.04122859984636307,
0.0060968827456235886,
0.02253... |
175 | arpeggio | SemanticActionToString | null | class SemanticActionToString(SemanticAction):
def first_pass(self, parser, node, children):
return text(node)
| () | [
-0.03208654001355171,
-0.025936903432011604,
0.06105590984225273,
-0.0587519146502018,
0.033577363938093185,
-0.028223959729075432,
0.02054961770772934,
0.01297692209482193,
0.09514150768518448,
-0.07155942916870117,
0.03327242285013199,
0.011545395478606224,
0.004942581057548523,
0.034831... |
176 | arpeggio | first_pass | null | def first_pass(self, parser, node, children):
return text(node)
| (self, parser, node, children) | [
-0.025012187659740448,
-0.020874204114079475,
0.0787389725446701,
-0.011877858079969883,
0.009230888448655605,
0.014759369194507599,
0.048382584005594254,
0.050560470670461655,
0.10567775368690491,
-0.04295462369918823,
0.0541791133582592,
0.031127024441957474,
0.0181769747287035,
0.027156... |
177 | arpeggio | SemanticError |
Error raised during the phase of semantic analysis used to indicate
semantic error.
| class SemanticError(ArpeggioError):
"""
Error raised during the phase of semantic analysis used to indicate
semantic error.
"""
| (message) | [
-0.009480379521846771,
0.01545178797096014,
0.012962968088686466,
0.05301273614168167,
0.016392789781093597,
-0.0468214675784111,
-0.05072619020938873,
-0.013912765309214592,
0.0174129419028759,
-0.03524801880121231,
0.048580352216959,
0.010694009251892567,
0.03602192550897598,
0.005988996... |
180 | arpeggio | Sequence |
Will match sequence of parser expressions in exact order they are defined.
| class Sequence(ParsingExpression):
"""
Will match sequence of parser expressions in exact order they are defined.
"""
def __init__(self, *elements, **kwargs):
super(Sequence, self).__init__(*elements, **kwargs)
self.ws = kwargs.pop('ws', None)
self.skipws = kwargs.pop('skipws', ... | (*elements, **kwargs) | [
-0.012679667212069035,
0.005904137156903744,
-0.04975835978984833,
-0.02269180305302143,
-0.022016027942299843,
0.0445299968123436,
0.008504980243742466,
-0.013328767381608486,
0.026942070573568344,
-0.04445886239409447,
0.025021448731422424,
0.034375593066215515,
0.02062891237437725,
0.02... |
183 | arpeggio | _parse | null | def _parse(self, parser):
results = []
c_pos = parser.position
if self.ws is not None:
old_ws = parser.ws
parser.ws = self.ws
if self.skipws is not None:
old_skipws = parser.skipws
parser.skipws = self.skipws
# Prefetching
append = results.append
try:
... | (self, parser) | [
-0.04856213554739952,
0.020573753863573074,
-0.10035441070795059,
-0.0016770088113844395,
-0.026042960584163666,
0.08023947477340698,
0.04632306471467018,
0.04162468761205673,
0.026795433834195137,
0.009126047603785992,
0.0429094024002552,
-0.022831177338957787,
-0.01927068829536438,
0.002... |
185 | arpeggio | StrMatch |
This Match class will perform input matching by a string comparison.
Args:
to_match (str): A string to match.
ignore_case(bool): If case insensitive match is needed.
Default is None to support propagation from global parser setting.
| class StrMatch(Match):
"""
This Match class will perform input matching by a string comparison.
Args:
to_match (str): A string to match.
ignore_case(bool): If case insensitive match is needed.
Default is None to support propagation from global parser setting.
"""
def __i... | (to_match, rule_name='', root=False, ignore_case=None, **kwargs) | [
0.05834216997027397,
-0.030442597344517708,
0.018685709685087204,
0.0030405742581933737,
-0.03479154035449028,
-0.05034453794360161,
0.03698443993926048,
-0.005532923620194197,
-0.0072190603241324425,
-0.06704005599021912,
-0.016115043312311172,
0.04831748828291893,
0.01062358170747757,
-0... |
188 | arpeggio | __init__ | null | def __init__(self, to_match, rule_name='', root=False, ignore_case=None,
**kwargs):
super(StrMatch, self).__init__(rule_name, root, **kwargs)
self.to_match = to_match
self.ignore_case = ignore_case
| (self, to_match, rule_name='', root=False, ignore_case=None, **kwargs) | [
0.002911913674324751,
-0.007016710937023163,
0.06479061394929886,
-0.0202619768679142,
-0.06816476583480835,
-0.046215713024139404,
0.0687100887298584,
0.015865350142121315,
0.011434639804065228,
-0.044920582324266434,
-0.007076355163007975,
0.07320896536111832,
-0.013914133422076702,
0.01... |
195 | arpeggio | SyntaxPredicate |
Base class for all syntax predicates (and, not, empty).
Predicates are parser expressions that will do the match but will not
consume any input.
| class SyntaxPredicate(ParsingExpression):
"""
Base class for all syntax predicates (and, not, empty).
Predicates are parser expressions that will do the match but will not
consume any input.
"""
| (*elements, **kwargs) | [
-0.004523209761828184,
-0.03766334801912308,
0.06278369575738907,
-0.04804138466715813,
-0.01658080704510212,
0.009235423989593983,
-0.03570457920432091,
0.0026546474546194077,
0.02658083848655224,
-0.05378023535013199,
0.04893485829234123,
0.038763005286455154,
0.03486265242099762,
0.0298... |
199 | arpeggio | Terminal |
Leaf node of the Parse Tree. Represents matched string.
Attributes:
rule (ParsingExpression): The rule that created this terminal.
position (int): A position in the input stream where match occurred.
value (str): Matched string at the given position or missing token
name in... | class Terminal(ParseTreeNode):
"""
Leaf node of the Parse Tree. Represents matched string.
Attributes:
rule (ParsingExpression): The rule that created this terminal.
position (int): A position in the input stream where match occurred.
value (str): Matched string at the given positio... | (rule, position, value, error=False, suppress=False, extra_info=None) | [
0.025167301297187805,
0.022566797211766243,
0.016030628234148026,
-0.005728964693844318,
0.030926808714866638,
-0.014695470221340656,
0.003106643445789814,
-0.013325406238436699,
0.018674766644835472,
-0.06611216068267822,
0.03167729079723358,
0.04541284218430519,
0.003518971847370267,
0.0... |
200 | arpeggio | __eq__ | null | def __eq__(self, other):
return text(self) == text(other)
| (self, other) | [
0.0481281653046608,
-0.04601962864398956,
0.04889794811606407,
0.028415029868483543,
-0.02948603220283985,
-0.08320348709821701,
-0.025519976392388344,
0.04354293644428253,
0.09545307606458664,
-0.0168264489620924,
0.006212649866938591,
-0.041166648268699646,
0.049199167639017105,
0.049466... |
201 | arpeggio | __init__ | null | def __init__(self, rule, position, value, error=False, suppress=False,
extra_info=None):
super(Terminal, self).__init__(rule, position, error)
self.value = value
self.suppress = suppress
self.extra_info = extra_info
| (self, rule, position, value, error=False, suppress=False, extra_info=None) | [
0.0022190529853105545,
0.05169827491044998,
0.05045778304338455,
-0.05300581827759743,
0.023703424260020256,
0.008675050921738148,
-0.02863185852766037,
-0.01286589726805687,
-0.0017161513678729534,
-0.03225275129079819,
0.043216001242399216,
0.05049131065607071,
0.030509358271956444,
0.01... |
202 | arpeggio | __repr__ | null | def __repr__(self):
return self.desc
| (self) | [
0.035443007946014404,
-0.022341635078191757,
0.05550757795572281,
-0.012127845548093319,
0.05910468101501465,
-0.05705862492322922,
0.03006385639309883,
-0.022473638877272606,
0.07880624383687973,
-0.04085516184568405,
-0.05461655557155609,
0.02225913293659687,
-0.014404909685254097,
0.030... |
203 | arpeggio | __str__ | null | def __str__(self):
return self.value
| (self) | [
0.03980254381895065,
-0.03149392455816269,
0.046896062791347504,
-0.012577866204082966,
0.03664986416697502,
-0.030360933393239975,
0.000023604023226653226,
-0.042528294026851654,
0.09497438371181488,
-0.08676429092884064,
-0.041575923562049866,
0.0020248147193342447,
-0.014269145205616951,
... |
205 | arpeggio | flat_str | null | def flat_str(self):
return self.value
| (self) | [
0.018527867272496223,
-0.0210823193192482,
0.07870301604270935,
-0.006010239478200674,
0.030410923063755035,
-0.04963398724794388,
0.016434185206890106,
-0.028939686715602875,
0.10431221127510071,
-0.07540486007928848,
-0.005630305036902428,
0.01267525926232338,
-0.004765348043292761,
0.02... |
206 | arpeggio | tree_str | null | def tree_str(self, indent=0):
return '{}: {}'.format(super(Terminal, self).tree_str(indent),
self.value)
| (self, indent=0) | [
0.02474522404372692,
-0.008494063280522823,
0.07923861593008041,
-0.008477218449115753,
0.04645835608243942,
-0.03675566986203194,
-0.014368738047778606,
-0.045211829245090485,
0.03854123130440712,
-0.034144703298807144,
0.03353828564286232,
-0.020971955731511116,
0.012709510512650013,
0.0... |
208 | arpeggio | UnorderedGroup |
Will try to match all of the parsing expression in any order.
| class UnorderedGroup(Repetition):
"""
Will try to match all of the parsing expression in any order.
"""
def _parse(self, parser):
results = []
c_pos = parser.position
if self.eolterm:
# Remember current eolterm and set eolterm of
# this repetition
... | (*elements, **kwargs) | [
-0.008557300083339214,
0.005725118797272444,
-0.030658595263957977,
0.05051190406084061,
-0.030004296451807022,
-0.031836334615945816,
0.02260136604309082,
-0.04393152520060539,
0.021330157294869423,
-0.04329591989517212,
0.04695999622344971,
0.02082541212439537,
0.022320952266454697,
-0.0... |
211 | arpeggio | _parse | null | def _parse(self, parser):
results = []
c_pos = parser.position
if self.eolterm:
# Remember current eolterm and set eolterm of
# this repetition
old_eolterm = parser.eolterm
parser.eolterm = self.eolterm
# Prefetching
append = results.append
nodes_to_try = list(sel... | (self, parser) | [
-0.008670291863381863,
-0.004527541343122721,
-0.03076329454779625,
0.04985292628407478,
-0.04533538222312927,
0.011893541552126408,
0.05269138514995575,
-0.004887345712631941,
0.01652102917432785,
-0.02734515070915222,
0.07120133191347122,
0.009989575482904911,
0.00202515022829175,
-0.032... |
213 | arpeggio | ZeroOrMore |
ZeroOrMore will try to match parser expression specified zero or more
times. It will never fail.
| class ZeroOrMore(Repetition):
"""
ZeroOrMore will try to match parser expression specified zero or more
times. It will never fail.
"""
def _parse(self, parser):
results = []
if self.eolterm:
# Remember current eolterm and set eolterm of
# this repetition
... | (*elements, **kwargs) | [
-0.0035891614388674498,
-0.023847537115216255,
0.009437422268092632,
0.013483305461704731,
-0.007860062643885612,
0.018857020884752274,
0.021387925371527672,
-0.03413156419992447,
0.022902904078364372,
-0.02586156688630581,
0.05143796280026436,
0.058745503425598145,
0.04241938516497612,
0.... |
216 | arpeggio | _parse | null | def _parse(self, parser):
results = []
if self.eolterm:
# Remember current eolterm and set eolterm of
# this repetition
old_eolterm = parser.eolterm
parser.eolterm = self.eolterm
# Prefetching
append = results.append
p = self.nodes[0].parse
sep = self.sep.parse if... | (self, parser) | [
-0.03172166272997856,
0.016982972621917725,
-0.08335895091295242,
0.013720279559493065,
-0.01686038449406624,
0.056427597999572754,
0.046545226126909256,
0.008491486310958862,
0.025950660929083824,
0.0036917454563081264,
0.05714425817131996,
-0.017247004434466362,
-0.015955129638314247,
0.... |
220 | arpeggio | flatten | Flattening of python iterables. | def flatten(_iterable):
'''Flattening of python iterables.'''
result = []
for e in _iterable:
if hasattr(e, "__iter__") and not type(e) in [text, NonTerminal]:
result.extend(flatten(e))
else:
result.append(e)
return result
| (_iterable) | [
-0.03698191046714783,
-0.031393226236104965,
0.021647527813911438,
-0.047814298421144485,
-0.010401162318885326,
-0.020888570696115494,
0.00730927474796772,
-0.01456680241972208,
0.11563746631145477,
0.024096889421343803,
0.014411561191082,
-0.033187124878168106,
-0.013428366743028164,
0.0... |
221 | arpeggio.utils | isstr | null | def isstr(s):
return isinstance(s, str)
| (s) | [
-0.012532542459666729,
-0.015480851754546165,
0.01728902943432331,
-0.007749333046376705,
-0.0066181086003780365,
0.009245756082236767,
0.06324168294668198,
0.012879925779998302,
0.01311151497066021,
-0.010546218603849411,
0.016941646113991737,
0.04571215808391571,
-0.01385972648859024,
-0... |
227 | arpeggio | visit_parse_tree |
Applies visitor to parse_tree and runs the second pass
afterwards.
Args:
parse_tree(ParseTreeNode):
visitor(PTNodeVisitor):
| def visit_parse_tree(parse_tree, visitor):
"""
Applies visitor to parse_tree and runs the second pass
afterwards.
Args:
parse_tree(ParseTreeNode):
visitor(PTNodeVisitor):
"""
if not parse_tree:
raise Exception(
"Parse tree is empty. You did call parse(), didn... | (parse_tree, visitor) | [
-0.0014849185245111585,
0.026890110224485397,
-0.02730884589254856,
0.029220465570688248,
-0.040671974420547485,
-0.0037526905070990324,
0.03877856209874153,
0.00027607535594142973,
0.02441410720348358,
-0.01844257302582264,
0.030094347894191742,
-0.0063993725925683975,
-0.006249174010008573... |
228 | datetime | datetime | datetime(year, month, day[, hour[, minute[, second[, microsecond[,tzinfo]]]]])
The year, month and day arguments are required. tzinfo may be None, or an
instance of a tzinfo subclass. The remaining arguments may be ints.
| class datetime(date):
"""datetime(year, month, day[, hour[, minute[, second[, microsecond[,tzinfo]]]]])
The year, month and day arguments are required. tzinfo may be None, or an
instance of a tzinfo subclass. The remaining arguments may be ints.
"""
__slots__ = date.__slots__ + time.__slots__
... | null | [
0.04133034124970436,
-0.01591603271663189,
-0.006983684375882149,
0.08676804602146149,
-0.02071184478700161,
-0.09839002043008804,
-0.06081698089838028,
0.038249820470809937,
-0.01810973696410656,
-0.036802906543016434,
-0.019101573154330254,
0.06338408589363098,
0.007888004183769226,
0.04... |
229 | maya.core | MayaDT | The Maya Datetime object. | class MayaDT(object):
"""The Maya Datetime object."""
__EPOCH_START = (1970, 1, 1)
def __init__(self, epoch):
super(MayaDT, self).__init__()
self._epoch = epoch
def __repr__(self):
return '<MayaDT epoch={}>'.format(self._epoch)
def __str__(self):
return self.rfc282... | (epoch) | [
0.048563990741968155,
0.04486890509724617,
-0.0034819082356989384,
0.053192999213933945,
0.013166282325983047,
-0.08291611075401306,
-0.0725211426615715,
0.05485782027244568,
-0.027692843228578568,
-0.00549694849178195,
-0.026088932529091835,
0.0447876937687397,
0.052462104707956314,
0.099... |
230 | maya.core | wrapper | null | def validate_arguments_type_of_function(param_type=None):
"""
Decorator to validate the <type> of arguments in
the calling function are of the `param_type` class.
if `param_type` is None, uses `param_type` as the class where it is used.
Note: Use this decorator on the functions of the class.
"... | (self, *args, **kwargs) | [
0.015431900508701801,
0.0371602438390255,
0.04190131276845932,
0.00745359854772687,
0.02707844227552414,
0.031707074493169785,
-0.04291323944926262,
-0.006446355488151312,
-0.037328895181417465,
0.022431068122386932,
-0.022393589839339256,
-0.013323717750608921,
0.038678135722875595,
-0.01... |
231 | maya.core | __add__ | null | def __add__(self, duration):
return self.add(
seconds=_seconds_or_timedelta(duration).total_seconds()
)
| (self, duration) | [
-0.050116829574108124,
-0.010206472128629684,
-0.0034671486355364323,
0.0628325343132019,
0.041877053678035736,
-0.010350583121180534,
-0.03546833619475365,
0.03516316041350365,
-0.04567480832338333,
0.002379955956712365,
-0.010613374412059784,
-0.008739927783608437,
0.0689699798822403,
0.... |
232 | maya.core | wrapper | null | def validate_class_type_arguments(operator):
"""
Decorator to validate all the arguments to function
are of the type of calling class for passed operator
"""
def inner(function):
def wrapper(self, *args, **kwargs):
for arg in args + tuple(kwargs.values()):
if no... | (self, *args, **kwargs) | [
0.0011660296004265547,
-0.017812490463256836,
0.03160939738154411,
-0.009221628308296204,
0.009212744422256947,
0.01401012297719717,
-0.03592703491449356,
-0.021019626408815384,
0.007964537478983402,
0.0022987439297139645,
0.029335083439946175,
-0.02176588587462902,
0.027771493420004845,
-... |
233 | maya.core | __format__ | Return's the datetime's format | def __format__(self, *args, **kwargs):
"""Return's the datetime's format"""
return format(self.datetime(), *args, **kwargs)
| (self, *args, **kwargs) | [
-0.005745571106672287,
-0.041127972304821014,
0.05553629249334335,
0.03852365165948868,
-0.04640425741672516,
-0.0547245554625988,
-0.018771402537822723,
0.01319071464240551,
0.05945968255400658,
-0.0424470454454422,
-0.005073351785540581,
-0.022982284426689148,
0.016133258119225502,
-0.02... |
236 | maya.core | __hash__ | null | def __hash__(self):
return hash(int(self.epoch))
| (self) | [
0.02314126119017601,
0.01277913711965084,
-0.03374018892645836,
0.09119322896003723,
-0.007308196742087603,
-0.03912947326898575,
-0.06467141211032867,
0.05206375569105148,
-0.004286930896341801,
0.014346929267048836,
-0.01788262650370598,
-0.005438277963548899,
0.04458408057689667,
0.0463... |
237 | maya.core | __init__ | null | def __init__(self, epoch):
super(MayaDT, self).__init__()
self._epoch = epoch
| (self, epoch) | [
0.00829822476953268,
0.06401366740465164,
-0.00823892094194889,
0.037852443754673004,
-0.03680192679166794,
-0.0037149274721741676,
-0.0390046201646328,
0.10295051336288452,
-0.005540621466934681,
0.04005513712763786,
-0.0044731623493134975,
0.054287925362586975,
0.02202693559229374,
0.064... |
241 | maya.core | __radd__ | null | def __radd__(self, duration):
return self + duration
| (self, duration) | [
-0.039895713329315186,
-0.007099873386323452,
0.00475404504686594,
0.07506649941205978,
0.025837382301688194,
-0.027401268482208252,
-0.05224042758345604,
0.02538818120956421,
-0.031543899327516556,
-0.0161878764629364,
-0.013900279067456722,
-0.007212173659354448,
0.0888419970870018,
0.08... |
242 | maya.core | __repr__ | null | def __repr__(self):
return '<MayaDT epoch={}>'.format(self._epoch)
| (self) | [
0.028074705973267555,
0.0508594736456871,
0.030598662793636322,
0.03979555144906044,
0.020623844116926193,
-0.04975308105349541,
-0.03455747291445732,
0.06175052374601364,
0.028627902269363403,
0.010951555334031582,
-0.03158404305577278,
0.013821261003613472,
0.01671689748764038,
0.0717772... |
243 | maya.core | __str__ | null | def __str__(self):
return self.rfc2822()
| (self) | [
-0.02829945832490921,
0.010082942433655262,
0.04967529699206352,
0.0024556166026741266,
-0.0025018302258104086,
-0.0904776081442833,
0.016989758238196373,
-0.01786361262202263,
0.10882855951786041,
-0.05464955046772957,
-0.015309267677366734,
-0.027022287249565125,
-0.008898196741938591,
0... |
244 | maya.core | __sub__ | null | def __sub__(self, duration_or_date):
if isinstance(duration_or_date, MayaDT):
return self.subtract_date(dt=duration_or_date)
else:
return self.subtract(
seconds=_seconds_or_timedelta(duration_or_date).total_seconds()
)
| (self, duration_or_date) | [
0.02468193881213665,
0.013495160266757011,
0.015057758428156376,
0.0490797683596611,
-0.030115516856312752,
-0.07301592081785202,
-0.006765337195247412,
0.02960056997835636,
0.027611808851361275,
-0.003919811453670263,
-0.019266117364168167,
0.010316695086658001,
0.040982671082019806,
0.00... |
245 | maya.core | add | Returns a new MayaDT object with the given offsets. | def add(self, **kwargs):
"""Returns a new MayaDT object with the given offsets."""
return self.from_datetime(
pendulum.instance(self.datetime()).add(**kwargs)
)
| (self, **kwargs) | [
0.010607101954519749,
-0.001212362665683031,
0.0005271956906653941,
0.00011968333274126053,
-0.03247246891260147,
-0.012157898396253586,
-0.06816648691892624,
0.04362792149186134,
-0.06124359369277954,
0.051578961312770844,
-0.020443091168999672,
0.00797246303409338,
0.039343953132629395,
... |
246 | maya.core | datetime | Returns a timezone-aware datetime...
Defaulting to UTC (as it should).
Keyword Arguments:
to_timezone {str} -- timezone to convert to (default: None/UTC)
naive {bool} -- if True,
the tzinfo is simply dropped (default: False)
| def datetime(self, to_timezone=None, naive=False):
"""Returns a timezone-aware datetime...
Defaulting to UTC (as it should).
Keyword Arguments:
to_timezone {str} -- timezone to convert to (default: None/UTC)
naive {bool} -- if True,
the tzinfo is simply dropped (defau... | (self, to_timezone=None, naive=False) | [
-0.0027613306883722544,
-0.025652462616562843,
0.026796672493219376,
0.042335789650678635,
-0.033071376383304596,
-0.05857619643211365,
-0.031890254467725754,
0.050123803317546844,
0.01536379475146532,
-0.027165772393345833,
-0.04672808200120926,
0.02124171517789364,
-0.008341663517057896,
... |
247 | maya.core | from_rfc2822 | Returns MayaDT instance from rfc2822 string. | @staticmethod
def from_rfc2822(rfc2822_string):
"""Returns MayaDT instance from rfc2822 string."""
return parse(rfc2822_string)
| (rfc2822_string) | [
0.021384328603744507,
0.058768194168806076,
0.013074890710413456,
-0.04239017143845558,
-0.03356461971998215,
-0.058596156537532806,
-0.008524484932422638,
0.059387531131505966,
0.028093811124563217,
0.010158846154808998,
0.010778183117508888,
0.04328477010130882,
-0.012954464182257652,
0.... |
248 | maya.core | from_rfc3339 | Returns MayaDT instance from rfc3339 string. | @staticmethod
def from_rfc3339(rfc3339_string):
"""Returns MayaDT instance from rfc3339 string."""
return parse(rfc3339_string)
| (rfc3339_string) | [
0.005875683855265379,
0.06214817240834236,
0.021750107407569885,
0.005301698576658964,
-0.051527250558137894,
-0.05538303032517433,
-0.017981959506869316,
0.06470701098442078,
0.006107907276600599,
0.00272752670571208,
-0.011199289932847023,
0.028743091970682144,
-0.020838741213083267,
0.0... |
249 | maya.core | iso8601 | Returns an ISO 8601 representation of the MayaDT. | def iso8601(self):
"""Returns an ISO 8601 representation of the MayaDT."""
# Get a timezone-naive datetime.
dt = self.datetime(naive=True)
return '{}Z'.format(dt.isoformat())
| (self) | [
0.01852298341691494,
0.04965663328766823,
0.0537918359041214,
0.01344795897603035,
0.009013720788061619,
-0.07149461656808853,
-0.0729299783706665,
0.03227851912379265,
0.03960910812020302,
-0.025870660319924355,
-0.005566293373703957,
-0.007685158401727676,
-0.022709451615810394,
0.018369... |
250 | maya.core | local_datetime | Returns a local timezone-aware datetime object
It's the same as:
mayaDt.datetime(to_timezone=mayaDt.local_timezone)
| def local_datetime(self):
"""Returns a local timezone-aware datetime object
It's the same as:
mayaDt.datetime(to_timezone=mayaDt.local_timezone)
"""
return self.datetime(to_timezone=self.local_timezone, naive=False)
| (self) | [
0.026827655732631683,
0.03199091553688049,
0.052519749850034714,
0.058268532156944275,
-0.0013373906258493662,
-0.07161138951778412,
-0.038999464362859726,
0.0683111622929573,
0.0020548796746879816,
-0.01706891879439354,
-0.034741103649139404,
-0.020794982090592384,
0.0007624013815075159,
... |
251 | maya.core | rfc2822 | Returns an RFC 2822 representation of the MayaDT. | def rfc2822(self):
"""Returns an RFC 2822 representation of the MayaDT."""
return email.utils.formatdate(self.epoch, usegmt=True)
| (self) | [
-0.0037582064978778362,
0.0881647914648056,
0.03150727599859238,
0.05266265571117401,
-0.009839510545134544,
-0.07288011163473129,
-0.035484764724969864,
0.042762354016304016,
0.04394344240427017,
-0.029440371319651604,
-0.014329384081065655,
-0.02838086523115635,
-0.007490359712392092,
0.... |
252 | maya.core | rfc3339 | Returns an RFC 3339 representation of the MayaDT. | def rfc3339(self):
"""Returns an RFC 3339 representation of the MayaDT."""
return self.datetime().strftime("%Y-%m-%dT%H:%M:%S.%f")[:-5] + "Z"
| (self) | [
-0.029394682496786118,
0.051816754043102264,
0.016192736104130745,
0.06756706535816193,
-0.014290310442447662,
-0.05946184694766998,
-0.047038570046424866,
0.03967662528157234,
0.030403409153223038,
-0.03456220030784607,
-0.01454691682010889,
-0.029023045673966408,
-0.03537626191973686,
0.... |
253 | maya.core | slang_date | "Returns human slang representation of date.
Keyword Arguments:
locale -- locale to translate to, e.g. 'fr' for french.
(default: 'en' - English)
| def slang_date(self, locale="en"):
""""Returns human slang representation of date.
Keyword Arguments:
locale -- locale to translate to, e.g. 'fr' for french.
(default: 'en' - English)
"""
dt = pendulum.instance(self.datetime())
try:
return _translate(dt, locale)
... | (self, locale='en') | [
-0.02125192992389202,
-0.03408503904938698,
-0.005257105454802513,
0.050997182726860046,
0.005052222404628992,
-0.03974725678563118,
0.005187259055674076,
-0.02303999662399292,
-0.0059555694460868835,
-0.051518701016902924,
-0.015440709888935089,
-0.03252048045396805,
0.008260500617325306,
... |
254 | maya.core | slang_time | "Returns human slang representation of time.
Keyword Arguments:
locale -- locale to translate to, e.g. 'fr' for french.
(default: 'en' - English)
| def slang_time(self, locale="en"):
""""Returns human slang representation of time.
Keyword Arguments:
locale -- locale to translate to, e.g. 'fr' for french.
(default: 'en' - English)
"""
dt = self.datetime()
return pendulum.instance(dt).diff_for_humans(locale=locale)
| (self, locale='en') | [
0.022804783657193184,
-0.03258831799030304,
0.012862883508205414,
0.0553579106926918,
0.01912716031074524,
-0.06658434122800827,
-0.0018707049312070012,
0.011261622421443462,
-0.02192497067153454,
-0.015080016106367111,
-0.008551794104278088,
-0.04891766980290413,
0.013901064172387123,
0.0... |
255 | maya.core | snap |
Returns a new MayaDT object modified by the given instruction.
Powered by snaptime. See https://github.com/zartstrom/snaptime
for a complete documentation about the snaptime instructions.
| def snap(self, instruction):
"""
Returns a new MayaDT object modified by the given instruction.
Powered by snaptime. See https://github.com/zartstrom/snaptime
for a complete documentation about the snaptime instructions.
"""
return self.from_datetime(snaptime.snap(self.datetime(), instruction))... | (self, instruction) | [
0.04627827927470207,
0.05344527214765549,
0.04774580895900726,
-0.006356437690556049,
-0.020067572593688965,
-0.0725572481751442,
-0.02663731388747692,
0.04986177757382393,
-0.02479437366127968,
0.0002611632226034999,
-0.04590286687016487,
0.02337804064154625,
0.019572708755731583,
0.04576... |
256 | maya.core | subtract | Returns a new MayaDT object with the given offsets. | def subtract(self, **kwargs):
"""Returns a new MayaDT object with the given offsets."""
return self.from_datetime(
pendulum.instance(self.datetime()).subtract(**kwargs)
)
| (self, **kwargs) | [
0.05640476197004318,
-0.029534777626395226,
0.00993318296968937,
-0.028475692495703697,
-0.08452173322439194,
-0.05046022683382034,
-0.03638465702533722,
0.04987943917512894,
-0.029910581186413765,
0.04837622120976448,
-0.04608723521232605,
0.000918157456908375,
0.01930265873670578,
0.0325... |
257 | maya.core | subtract_date | Returns a timedelta object with the duration between the dates | def subtract_date(self, **kwargs):
"""Returns a timedelta object with the duration between the dates"""
return timedelta(seconds=self.epoch - kwargs['dt'].epoch)
| (self, **kwargs) | [
-0.009718661196529865,
-0.0043862201273441315,
0.026193518191576004,
0.044003695249557495,
-0.02762611396610737,
-0.030597424134612083,
-0.017146937549114227,
0.05139659717679024,
0.02292153798043728,
0.024548685178160667,
-0.017783647403120995,
-0.009382620453834534,
0.033604107797145844,
... |
258 | maya.core | MayaInterval |
A MayaInterval represents a range between two datetimes,
inclusive of the start and exclusive of the end.
| class MayaInterval(object):
"""
A MayaInterval represents a range between two datetimes,
inclusive of the start and exclusive of the end.
"""
def __init__(self, start=None, end=None, duration=None):
try:
# Ensure that proper arguments were passed.
assert any(
... | (start=None, end=None, duration=None) | [
0.05053777992725372,
-0.004491694271564484,
-0.016534211114048958,
0.015191178768873215,
-0.0060983579605817795,
-0.027477430179715157,
-0.048747070133686066,
0.018712906166911125,
-0.10139390826225281,
-0.006998686585575342,
-0.03078029304742813,
0.05881483480334282,
0.05662618950009346,
... |
261 | maya.core | __contains__ | null | def __contains__(self, maya_dt):
if isinstance(maya_dt, MayaDT):
return self.contains_dt(maya_dt)
return self.contains(maya_dt)
| (self, maya_dt) | [
0.06829972565174103,
0.019995758309960365,
0.013668769039213657,
0.04055627062916756,
-0.020472267642617226,
-0.026596300303936005,
0.003922380972653627,
0.041121020913124084,
-0.015733644366264343,
-0.008413925766944885,
-0.03047897294163704,
-0.006512299180030823,
0.04362710937857628,
-0... |
262 | maya.compat | __eq__ | null | def comparable(klass):
"""
Class decorator that ensures support for the special C{__cmp__} method.
On Python 2 this does nothing.
On Python 3, C{__eq__}, C{__lt__}, etc. methods are added to the class,
relying on C{__cmp__} to implement their comparisons.
"""
# On Python 2, __cmp__ will just... | (self, other) | [
0.0313650481402874,
-0.010359338484704494,
-0.04091547057032585,
0.004120685625821352,
0.0010883393697440624,
-0.03350476175546646,
-0.01747431606054306,
0.007101930677890778,
-0.0431421622633934,
-0.019657518714666367,
0.010237566195428371,
-0.01000271923840046,
0.0691666305065155,
-0.010... |
265 | maya.core | __hash__ | null | def __hash__(self):
return hash((self.start, self.end))
| (self) | [
0.025377366691827774,
-0.013452467508614063,
0.0020223872270435095,
0.041983526200056076,
-0.04572853446006775,
-0.03718728572130203,
-0.04418453946709633,
0.0070506371557712555,
-0.023734817281365395,
-0.03738439083099365,
-0.013280000537633896,
-0.02724987082183361,
0.04001246765255928,
... |
266 | maya.core | __init__ | null | def __init__(self, start=None, end=None, duration=None):
try:
# Ensure that proper arguments were passed.
assert any(
(
(start and end),
(start and duration is not None),
(end and duration is not None),
)
)
asser... | (self, start=None, end=None, duration=None) | [
0.0018146679503843188,
0.020988287404179573,
0.018549444153904915,
-0.018059896305203438,
-0.044789254665374756,
0.005834530107676983,
-0.030316416174173355,
0.022305618971586227,
-0.10317905992269516,
-0.021201908588409424,
0.005830079782754183,
0.09043299406766891,
0.016742564737796783,
... |
267 | maya.core | __iter__ | null | def __iter__(self):
yield self.start
yield self.end
| (self) | [
0.039549410343170166,
-0.02153431810438633,
-0.05902246758341789,
0.017395038157701492,
-0.051916979253292084,
0.0042649684473872185,
-0.030952440574765205,
0.02850574068725109,
0.04112468287348747,
0.005731313023716211,
0.015124297700822353,
-0.01378364022821188,
0.045951053500175476,
0.0... |
272 | maya.core | __repr__ | null | def __repr__(self):
return '<MayaInterval start={0!r} end={1!r}>'.format(
self.start, self.end
)
| (self) | [
0.05000898987054825,
0.006798574235290289,
0.08426497876644135,
0.006212929263710976,
0.0067221857607364655,
-0.032677292823791504,
-0.026192760095000267,
-0.013019991107285023,
-0.03649671748280525,
-0.011543147265911102,
-0.021422723308205605,
0.013690512627363205,
0.016355620697140694,
... |
275 | maya.core | contains_dt | null | def contains_dt(self, dt):
return self.start <= dt < self.end
| (self, dt) | [
0.05054248124361038,
0.006266410928219557,
-0.026847481727600098,
0.025014245882630348,
-0.013577938079833984,
0.009585938416421413,
0.020216992124915123,
0.05157046392560005,
-0.04135917127132416,
-0.03858361765742302,
-0.0030025660526007414,
-0.021313507109880447,
0.06483144313097,
-0.02... |
276 | maya.core | flatten | null | @staticmethod
def flatten(interval_list):
return functools.reduce(
lambda reduced,
maya_interval: (
(
reduced[:-1] + maya_interval.combine(reduced[-1])
) if reduced else [
maya_interval
]
),
sorted(interval_list),
... | (interval_list) | [
-0.007504305336624384,
0.00028299581026658416,
0.006385433953255415,
-0.0002487139718141407,
-0.01128486730158329,
-0.009414253756403923,
-0.016013847663998604,
-0.09216703474521637,
-0.018006836995482445,
0.03393327072262764,
-0.016765588894486427,
0.012709680013358593,
0.026048725470900536... |
278 | maya.core | intersects | null | def intersects(self, maya_interval):
return self & maya_interval is not None
| (self, maya_interval) | [
0.056087493896484375,
0.004352640826255083,
-0.008781718090176582,
0.07521363347768784,
-0.034821126610040665,
0.0065183453261852264,
-0.0186845064163208,
0.0004275673418305814,
-0.09763504564762115,
0.0048070140182971954,
-0.021453211084008217,
-0.008977056480944157,
0.05095774680376053,
... |
280 | maya.core | iso8601 | Returns an ISO 8601 representation of the MayaInterval. | def iso8601(self):
"""Returns an ISO 8601 representation of the MayaInterval."""
return '{0}/{1}'.format(self.start.iso8601(), self.end.iso8601())
| (self) | [
0.028776664286851883,
0.007870969362556934,
0.07018698751926422,
0.039271291345357895,
-0.017964527010917664,
-0.03546113893389702,
-0.05765359476208687,
0.004031573887914419,
-0.021824810653924942,
-0.012032055296003819,
0.0009076263522729278,
-0.0198528915643692,
0.00005346274338080548,
... |
281 | maya.core | quantize | Returns a quanitzed interval. | def quantize(self, duration, snap_out=False, timezone='UTC'):
"""Returns a quanitzed interval."""
# Convert seconds to timedelta, if appropriate.
duration = _seconds_or_timedelta(duration)
timezone = pytz.timezone(timezone)
if duration <= timedelta(seconds=0):
raise ValueError('cannot quanti... | (self, duration, snap_out=False, timezone='UTC') | [
0.0169711634516716,
-0.0382443405687809,
0.01367358397692442,
-0.04195885732769966,
0.021927008405327797,
-0.008206045255064964,
-0.024845555424690247,
0.010091730393469334,
-0.0880870670080185,
0.004730794578790665,
-0.024580232799053192,
0.07353223115205765,
0.000225050316657871,
0.03623... |
282 | maya.core | split | null | def split(self, duration, include_remainder=True):
# Convert seconds to timedelta, if appropriate.
duration = _seconds_or_timedelta(duration)
if duration <= timedelta(seconds=0):
raise ValueError('cannot call split with a non-positive timedelta')
start = self.start
while start < self.end:
... | (self, duration, include_remainder=True) | [
0.039342001080513,
0.002008122391998768,
-0.05490587279200554,
-0.04488368332386017,
-0.02761014550924301,
0.037278611212968826,
-0.014532173052430153,
0.04504089429974556,
-0.11154106259346008,
0.0402066633105278,
-0.01920919492840767,
0.03639429807662964,
0.06948716938495636,
0.022402537... |
284 | maya.compat | cmp |
Compare two objects.
Returns a negative number if C{a < b}, zero if they are equal, and a
positive number if C{a > b}.
| def cmp(a, b):
"""
Compare two objects.
Returns a negative number if C{a < b}, zero if they are equal, and a
positive number if C{a > b}.
"""
if a < b:
return -1
elif a == b:
return 0
else:
return 1
| (a, b) | [
-0.018133124336600304,
0.017979836091399193,
-0.04061242938041687,
-0.003243854735046625,
-0.01453535445034504,
-0.03161349520087242,
-0.006762727163732052,
0.040720634162425995,
0.007136931177228689,
-0.09233376383781433,
-0.009368631057441235,
-0.020053740590810776,
0.05756433308124542,
... |
285 | maya.compat | comparable |
Class decorator that ensures support for the special C{__cmp__} method.
On Python 2 this does nothing.
On Python 3, C{__eq__}, C{__lt__}, etc. methods are added to the class,
relying on C{__cmp__} to implement their comparisons.
| def comparable(klass):
"""
Class decorator that ensures support for the special C{__cmp__} method.
On Python 2 this does nothing.
On Python 3, C{__eq__}, C{__lt__}, etc. methods are added to the class,
relying on C{__cmp__} to implement their comparisons.
"""
# On Python 2, __cmp__ will just... | (klass) | [
0.03139924630522728,
-0.010306954383850098,
-0.04091469570994377,
0.004085815977305174,
0.001092124031856656,
-0.033486731350421906,
-0.01743919402360916,
0.0070844003930687904,
-0.043176136910915375,
-0.01967454142868519,
0.010228673927485943,
-0.00998513400554657,
0.06916531920433044,
-0... |
290 | maya.core | end_of_day_midnight | null | def end_of_day_midnight(dt):
if dt.time() == time.min:
return dt
else:
return (
dt.replace(hour=0, minute=0, second=0, microsecond=0) +
timedelta(days=1)
)
| (dt) | [
0.05893242731690407,
0.015159872360527515,
0.07402440160512924,
0.012065823189914227,
-0.018195725977420807,
-0.057690925896167755,
0.010222972370684147,
0.09326764941215515,
-0.07088185846805573,
0.020950302481651306,
-0.019621510058641434,
0.008991171605885029,
0.003186191897839308,
0.01... |
292 | tzlocal.unix | get_localzone | Get the computers configured local timezone, if any. | def get_localzone() -> zoneinfo.ZoneInfo:
"""Get the computers configured local timezone, if any."""
global _cache_tz
if _cache_tz is None:
_cache_tz = _get_localzone()
return _cache_tz
| () -> zoneinfo.ZoneInfo | [
0.04614594951272011,
-0.02169222943484783,
0.024889744818210602,
0.051523588597774506,
0.0037584423553198576,
-0.03826117143034935,
-0.013798365369439125,
0.02310931123793125,
-0.002922728192061186,
-0.01922142319381237,
-0.038188498467206955,
-0.029613345861434937,
-0.07710370421409607,
-... |
294 | maya.core | intervals |
Yields MayaDT objects between the start and end MayaDTs given,
at a given interval (seconds or timedelta).
| def intervals(start, end, interval):
"""
Yields MayaDT objects between the start and end MayaDTs given,
at a given interval (seconds or timedelta).
"""
interval = _seconds_or_timedelta(interval)
current_timestamp = start
while current_timestamp.epoch < end.epoch:
yield current_timest... | (start, end, interval) | [
0.03321032598614693,
-0.0029028700664639473,
-0.0458485446870327,
-0.06854879856109619,
-0.03429307043552399,
0.031138181686401367,
-0.05171028897166252,
0.011760823428630829,
-0.0722077265381813,
0.022569581866264343,
-0.027889953926205635,
0.015027719549834728,
0.02361498773097992,
0.046... |
295 | maya.core | now | Returns a MayaDT instance for this exact moment. | def now():
"""Returns a MayaDT instance for this exact moment."""
epoch = time.time()
return MayaDT(epoch=epoch)
| () | [
0.06424393504858017,
0.008720307610929012,
0.0234276931732893,
0.007136769127100706,
0.021813783794641495,
-0.03831729292869568,
-0.03824787586927414,
0.07836996763944626,
-0.016642337664961815,
0.04237809404730797,
-0.04716775566339493,
0.013371138833463192,
-0.03224344551563263,
0.066465... |
296 | maya.core | parse | "Returns a MayaDT instance for the machine-produced moment specified.
Powered by pendulum.
Accepts most known formats. Useful for working with data.
Keyword Arguments:
string -- string to be parsed
timezone -- timezone referenced from (default: 'UTC')
day_first -- if true, the firs... | def parse(string, timezone='UTC', day_first=False, year_first=True, strict=False):
""""Returns a MayaDT instance for the machine-produced moment specified.
Powered by pendulum.
Accepts most known formats. Useful for working with data.
Keyword Arguments:
string -- string to be parsed
ti... | (string, timezone='UTC', day_first=False, year_first=True, strict=False) | [
0.036204878240823746,
0.10024304687976837,
0.012908452190458775,
-0.019407687708735466,
-0.0027882796712219715,
-0.046628858894109726,
-0.029327571392059326,
0.06733279675245285,
0.000017563883375260048,
-0.001529165543615818,
-0.051201727241277695,
0.09152939170598984,
-0.06293995678424835,... |
300 | dateutil.relativedelta | relativedelta |
The relativedelta type is designed to be applied to an existing datetime and
can replace specific components of that datetime, or represents an interval
of time.
It is based on the specification of the excellent work done by M.-A. Lemburg
in his
`mx.DateTime <https://www.egenix.com/products/py... | class relativedelta(object):
"""
The relativedelta type is designed to be applied to an existing datetime and
can replace specific components of that datetime, or represents an interval
of time.
It is based on the specification of the excellent work done by M.-A. Lemburg
in his
`mx.DateTime... | (dt1=None, dt2=None, years=0, months=0, days=0, leapdays=0, weeks=0, hours=0, minutes=0, seconds=0, microseconds=0, year=None, month=None, day=None, weekday=None, yearday=None, nlyearday=None, hour=None, minute=None, second=None, microsecond=None) | [
0.02392561361193657,
-0.009827390313148499,
-0.01545102708041668,
0.03910831734538078,
-0.0053832633420825005,
-0.057645078748464584,
-0.06135690212249756,
0.040047451853752136,
-0.023210082203149796,
-0.0206274576485157,
0.022762874141335487,
0.031997714191675186,
0.0782613530755043,
0.03... |
301 | dateutil.relativedelta | __abs__ | null | def __abs__(self):
return self.__class__(years=abs(self.years),
months=abs(self.months),
days=abs(self.days),
hours=abs(self.hours),
minutes=abs(self.minutes),
seconds=abs(self.seconds),... | (self) | [
0.043557241559028625,
0.0012656825128942728,
0.01719551905989647,
0.00281114736571908,
-0.016200736165046692,
-0.06430555135011673,
-0.033662714064121246,
-0.013207508251070976,
-0.0494193509221077,
0.032028429210186005,
-0.023750420659780502,
0.04735873267054558,
0.037695132195949554,
0.0... |
302 | dateutil.relativedelta | __add__ | null | def __add__(self, other):
if isinstance(other, relativedelta):
return self.__class__(years=other.years + self.years,
months=other.months + self.months,
days=other.days + self.days,
hours=other.hours + self.hours,
... | (self, other) | [
-0.022778073325753212,
-0.03673882782459259,
-0.000985387829132378,
0.05626289173960686,
-0.0542055182158947,
-0.06550008058547974,
-0.061343345791101456,
0.03917408734560013,
-0.026200033724308014,
-0.014852983877062798,
0.04950294643640518,
-0.0007426491938531399,
0.0573965460062027,
0.0... |
303 | dateutil.relativedelta | __bool__ | null | def __bool__(self):
return not (not self.years and
not self.months and
not self.days and
not self.hours and
not self.minutes and
not self.seconds and
not self.microseconds and
not self.leapdays and
... | (self) | [
0.04517044872045517,
0.019796697422862053,
0.015493870712816715,
0.014219642616808414,
-0.03778362274169922,
-0.04025821015238762,
-0.039076317101716995,
-0.01988903246819973,
-0.011809690855443478,
-0.02308383584022522,
-0.006874366197735071,
0.026444843038916588,
0.0685497596859932,
-0.0... |
304 | dateutil.relativedelta | __div__ | null | def __div__(self, other):
try:
reciprocal = 1 / float(other)
except TypeError:
return NotImplemented
return self.__mul__(reciprocal)
| (self, other) | [
-0.009485213086009026,
-0.05324849858880043,
0.030874453485012054,
0.07747121155261993,
-0.020836368203163147,
-0.035072825849056244,
-0.004060154780745506,
-0.06143791601061821,
-0.01201633084565401,
0.05656573176383972,
0.04968938231468201,
-0.0261923186480999,
0.05387048050761223,
0.043... |
305 | dateutil.relativedelta | __eq__ | null | def __eq__(self, other):
if not isinstance(other, relativedelta):
return NotImplemented
if self.weekday or other.weekday:
if not self.weekday or not other.weekday:
return False
if self.weekday.weekday != other.weekday.weekday:
return False
n1, n2 = self.we... | (self, other) | [
0.03448737412691116,
-0.0016428170492872596,
-0.03644838184118271,
0.04204857349395752,
-0.04061552882194519,
-0.06588238477706909,
-0.05106167867779732,
0.05064684897661209,
0.016762861981987953,
-0.002995725255459547,
0.03058421052992344,
-0.05087311938405037,
0.09850303083658218,
0.0464... |
306 | dateutil.relativedelta | __hash__ | null | def __hash__(self):
return hash((
self.weekday,
self.years,
self.months,
self.days,
self.hours,
self.minutes,
self.seconds,
self.microseconds,
self.leapdays,
self.year,
self.month,
self.day,
self.hour,
se... | (self) | [
0.05162043496966362,
0.00599227799102664,
0.004676582291722298,
0.006348340772092342,
-0.0019768003839999437,
-0.08066127449274063,
-0.055823713541030884,
-0.01969635672867298,
-0.02568863518536091,
0.01567545160651207,
-0.01630941778421402,
-0.019227396696805954,
0.04512446001172066,
0.02... |
307 | dateutil.relativedelta | __init__ | null | def __init__(self, dt1=None, dt2=None,
years=0, months=0, days=0, leapdays=0, weeks=0,
hours=0, minutes=0, seconds=0, microseconds=0,
year=None, month=None, day=None, weekday=None,
yearday=None, nlyearday=None,
hour=None, minute=None, second=None, microse... | (self, dt1=None, dt2=None, years=0, months=0, days=0, leapdays=0, weeks=0, hours=0, minutes=0, seconds=0, microseconds=0, year=None, month=None, day=None, weekday=None, yearday=None, nlyearday=None, hour=None, minute=None, second=None, microsecond=None) | [
0.015196015127003193,
0.011692642234265804,
-0.012842013500630856,
0.031696122139692307,
-0.02058921940624714,
-0.06361328065395355,
-0.06100509315729141,
0.0541972778737545,
-0.05348997190594673,
-0.010173041373491287,
0.014566071331501007,
0.0460190586745739,
0.04769890755414963,
0.04467... |
308 | dateutil.relativedelta | __mul__ | null | def __mul__(self, other):
try:
f = float(other)
except TypeError:
return NotImplemented
return self.__class__(years=int(self.years * f),
months=int(self.months * f),
days=int(self.days * f),
hours=int(self.hours * f),... | (self, other) | [
0.03135571628808975,
-0.014459464699029922,
0.015104496851563454,
0.06432401388883591,
-0.0626755952835083,
-0.0729602724313736,
-0.04070867970585823,
-0.021931083872914314,
-0.0746086835861206,
0.06511238217353821,
0.023310735821723938,
-0.008058419451117516,
0.055006884038448334,
0.08643... |
309 | dateutil.relativedelta | __ne__ | null | def __ne__(self, other):
return not self.__eq__(other)
| (self, other) | [
0.00605026027187705,
0.01285517681390047,
0.02975253388285637,
0.03969317674636841,
-0.10762957483530045,
-0.07765151560306549,
-0.0734184980392456,
0.0242704339325428,
0.035182587802410126,
0.003627987578511238,
-0.010478443466126919,
-0.038964543491601944,
0.03636227920651436,
0.02187635... |
310 | dateutil.relativedelta | __neg__ | null | def __neg__(self):
return self.__class__(years=-self.years,
months=-self.months,
days=-self.days,
hours=-self.hours,
minutes=-self.minutes,
seconds=-self.seconds,
mic... | (self) | [
0.021358827129006386,
-0.007342096418142319,
0.04696112871170044,
-0.007739922497421503,
-0.07256343215703964,
-0.07496806979179382,
-0.05955010652542114,
0.0005713221034966409,
-0.0012509411899372935,
-0.002985903760418296,
-0.03734258562326431,
0.021305782720446587,
0.022844042629003525,
... |
312 | dateutil.relativedelta | __radd__ | null | def __radd__(self, other):
return self.__add__(other)
| (self, other) | [
-0.07649122923612595,
-0.03704380989074707,
0.04110873118042946,
0.0998203456401825,
-0.038669779896736145,
-0.05998411029577255,
-0.05157148838043213,
0.00279021542519331,
0.046941012144088745,
-0.02476067654788494,
-0.002483137184754014,
-0.03179476037621498,
0.04496157169342041,
0.06935... |
313 | dateutil.relativedelta | __repr__ | null | def __repr__(self):
l = []
for attr in ["years", "months", "days", "leapdays",
"hours", "minutes", "seconds", "microseconds"]:
value = getattr(self, attr)
if value:
l.append("{attr}={value:+g}".format(attr=attr, value=value))
for attr in ["year", "month", "day", ... | (self) | [
0.046718530356884,
-0.01391047053039074,
0.0823013111948967,
-0.02042783424258232,
0.030586441978812218,
-0.05453567951917648,
-0.004540030844509602,
-0.06858442723751068,
0.0476403646171093,
0.008121354505419731,
-0.027581263333559036,
0.013219094835221767,
0.020022228360176086,
0.0452435... |
315 | dateutil.relativedelta | __rsub__ | null | def __rsub__(self, other):
return self.__neg__().__radd__(other)
| (self, other) | [
-0.021384766325354576,
-0.028729375451803207,
0.03815780207514763,
0.07310447841882706,
-0.057697877287864685,
-0.08205465227365494,
-0.013570445589721203,
0.01503936666995287,
0.05165138468146324,
-0.04365772008895874,
-0.004624541383236647,
-0.001121974317356944,
0.04263288900256157,
0.0... |
316 | dateutil.relativedelta | __sub__ | null | def __sub__(self, other):
if not isinstance(other, relativedelta):
return NotImplemented # In case the other object defines __rsub__
return self.__class__(years=self.years - other.years,
months=self.months - other.months,
days=self.days - other.days,
... | (self, other) | [
-0.00924614630639553,
-0.041417062282562256,
-0.022339683026075363,
0.034183260053396225,
-0.058615073561668396,
-0.06435956060886383,
-0.017623526975512505,
0.04655873402953148,
-0.002018993254750967,
-0.02046031318604946,
0.02657712996006012,
-0.01934332773089409,
0.04372195154428482,
0.... |
318 | dateutil.relativedelta | _fix | null | def _fix(self):
if abs(self.microseconds) > 999999:
s = _sign(self.microseconds)
div, mod = divmod(self.microseconds * s, 1000000)
self.microseconds = mod * s
self.seconds += div * s
if abs(self.seconds) > 59:
s = _sign(self.seconds)
div, mod = divmod(self.seconds... | (self) | [
0.02113785408437252,
0.0618697889149189,
-0.0008133274386636913,
0.08415557444095612,
-0.03520996496081352,
-0.05628844350576401,
-0.05470508337020874,
0.06820322573184967,
-0.02305767871439457,
-0.02187015861272812,
-0.021078478544950485,
-0.001961881760507822,
0.03329014033079147,
-0.014... |
319 | dateutil.relativedelta | _set_months | null | def _set_months(self, months):
self.months = months
if abs(self.months) > 11:
s = _sign(self.months)
div, mod = divmod(self.months * s, 12)
self.months = mod * s
self.years = div * s
else:
self.years = 0
| (self, months) | [
0.009295777417719364,
0.09003812819719315,
-0.017329514026641846,
-0.00009867050539469346,
-0.03989555314183235,
0.013420955277979374,
-0.008424592204391956,
0.02358320727944374,
-0.03616594150662422,
0.03360418975353241,
-0.008278610184788704,
-0.00966308731585741,
0.07523269206285477,
0.... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.