nwo stringlengths 5 106 | sha stringlengths 40 40 | path stringlengths 4 174 | language stringclasses 1
value | identifier stringlengths 1 140 | parameters stringlengths 0 87.7k | argument_list stringclasses 1
value | return_statement stringlengths 0 426k | docstring stringlengths 0 64.3k | docstring_summary stringlengths 0 26.3k | docstring_tokens list | function stringlengths 18 4.83M | function_tokens list | url stringlengths 83 304 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Abjad/abjad | d0646dfbe83db3dc5ab268f76a0950712b87b7fd | abjad/pitch/segments.py | python | IntervalClassSegment.from_selection | (class_, selection, item_class=None) | return class_(items=intervals, item_class=item_class) | Initializes interval-class segment from component selection.
.. container:: example
>>> staff_1 = abjad.Staff("c'4 <d' fs' a'>4 b2")
>>> staff_2 = abjad.Staff("c4. r8 g2")
>>> selection = abjad.select((staff_1, staff_2))
>>> abjad.IntervalClassSegment.from_sele... | Initializes interval-class segment from component selection. | [
"Initializes",
"interval",
"-",
"class",
"segment",
"from",
"component",
"selection",
"."
] | def from_selection(class_, selection, item_class=None):
"""
Initializes interval-class segment from component selection.
.. container:: example
>>> staff_1 = abjad.Staff("c'4 <d' fs' a'>4 b2")
>>> staff_2 = abjad.Staff("c4. r8 g2")
>>> selection = abjad.sel... | [
"def",
"from_selection",
"(",
"class_",
",",
"selection",
",",
"item_class",
"=",
"None",
")",
":",
"pitch_segment",
"=",
"PitchSegment",
".",
"from_selection",
"(",
"selection",
")",
"pitches",
"=",
"[",
"_",
"for",
"_",
"in",
"pitch_segment",
"]",
"interva... | https://github.com/Abjad/abjad/blob/d0646dfbe83db3dc5ab268f76a0950712b87b7fd/abjad/pitch/segments.py#L213-L230 | |
rembo10/headphones | b3199605be1ebc83a7a8feab6b1e99b64014187c | lib/yaml/__init__.py | python | YAMLObjectMetaclass.__init__ | (cls, name, bases, kwds) | [] | def __init__(cls, name, bases, kwds):
super(YAMLObjectMetaclass, cls).__init__(name, bases, kwds)
if 'yaml_tag' in kwds and kwds['yaml_tag'] is not None:
cls.yaml_loader.add_constructor(cls.yaml_tag, cls.from_yaml)
cls.yaml_dumper.add_representer(cls, cls.to_yaml) | [
"def",
"__init__",
"(",
"cls",
",",
"name",
",",
"bases",
",",
"kwds",
")",
":",
"super",
"(",
"YAMLObjectMetaclass",
",",
"cls",
")",
".",
"__init__",
"(",
"name",
",",
"bases",
",",
"kwds",
")",
"if",
"'yaml_tag'",
"in",
"kwds",
"and",
"kwds",
"[",... | https://github.com/rembo10/headphones/blob/b3199605be1ebc83a7a8feab6b1e99b64014187c/lib/yaml/__init__.py#L280-L284 | ||||
fbchat-dev/fbchat | 916a14062d31f3624dfe8dd4ab672648a3e508c0 | fbchat/_listen.py | python | get_cookie_header | (session: requests.Session, url: str) | return requests.cookies.get_cookie_header(
session.cookies, requests.Request("GET", url),
) | Extract a cookie header from a requests session. | Extract a cookie header from a requests session. | [
"Extract",
"a",
"cookie",
"header",
"from",
"a",
"requests",
"session",
"."
] | def get_cookie_header(session: requests.Session, url: str) -> str:
"""Extract a cookie header from a requests session."""
# The cookies are extracted this way to make sure they're escaped correctly
return requests.cookies.get_cookie_header(
session.cookies, requests.Request("GET", url),
) | [
"def",
"get_cookie_header",
"(",
"session",
":",
"requests",
".",
"Session",
",",
"url",
":",
"str",
")",
"->",
"str",
":",
"# The cookies are extracted this way to make sure they're escaped correctly",
"return",
"requests",
".",
"cookies",
".",
"get_cookie_header",
"("... | https://github.com/fbchat-dev/fbchat/blob/916a14062d31f3624dfe8dd4ab672648a3e508c0/fbchat/_listen.py#L51-L56 | |
entropy1337/infernal-twin | 10995cd03312e39a48ade0f114ebb0ae3a711bb8 | Modules/build/reportlab/src/reportlab/graphics/shapes.py | python | _repr | (self,I=None) | return a repr style string with named fixed args first, then keywords | return a repr style string with named fixed args first, then keywords | [
"return",
"a",
"repr",
"style",
"string",
"with",
"named",
"fixed",
"args",
"first",
"then",
"keywords"
] | def _repr(self,I=None):
'''return a repr style string with named fixed args first, then keywords'''
if isinstance(self,float):
return fp_str(self)
elif isSeq(self):
s = ''
for v in self:
s = s + '%s,' % _repr(v,I)
if isinstance(self,list):
return '[%s]... | [
"def",
"_repr",
"(",
"self",
",",
"I",
"=",
"None",
")",
":",
"if",
"isinstance",
"(",
"self",
",",
"float",
")",
":",
"return",
"fp_str",
"(",
"self",
")",
"elif",
"isSeq",
"(",
"self",
")",
":",
"s",
"=",
"''",
"for",
"v",
"in",
"self",
":",
... | https://github.com/entropy1337/infernal-twin/blob/10995cd03312e39a48ade0f114ebb0ae3a711bb8/Modules/build/reportlab/src/reportlab/graphics/shapes.py#L567-L597 | ||
mlcommons/training | 4a4d5a0b7efe99c680306b1940749211d4238a84 | image_classification/tensorflow2/common.py | python | get_num_train_iterations | (flags_obj) | return steps_per_epoch, train_epochs | Returns the number of training steps, train and test epochs. | Returns the number of training steps, train and test epochs. | [
"Returns",
"the",
"number",
"of",
"training",
"steps",
"train",
"and",
"test",
"epochs",
"."
] | def get_num_train_iterations(flags_obj):
"""Returns the number of training steps, train and test epochs."""
if flags_obj.drop_train_remainder:
steps_per_epoch = (
imagenet_preprocessing.NUM_IMAGES['train'] // flags_obj.batch_size)
else:
steps_per_epoch = (
math.ceil(1.0 * imagenet_preproce... | [
"def",
"get_num_train_iterations",
"(",
"flags_obj",
")",
":",
"if",
"flags_obj",
".",
"drop_train_remainder",
":",
"steps_per_epoch",
"=",
"(",
"imagenet_preprocessing",
".",
"NUM_IMAGES",
"[",
"'train'",
"]",
"//",
"flags_obj",
".",
"batch_size",
")",
"else",
":... | https://github.com/mlcommons/training/blob/4a4d5a0b7efe99c680306b1940749211d4238a84/image_classification/tensorflow2/common.py#L635-L657 | |
evennia/evennia | fa79110ba6b219932f22297838e8ac72ebc0be0e | evennia/locks/lockhandler.py | python | LockHandler.clear | (self) | Remove all locks in the handler. | Remove all locks in the handler. | [
"Remove",
"all",
"locks",
"in",
"the",
"handler",
"."
] | def clear(self):
"""
Remove all locks in the handler.
"""
self.locks = {}
self.lock_storage = ""
self._save_locks() | [
"def",
"clear",
"(",
"self",
")",
":",
"self",
".",
"locks",
"=",
"{",
"}",
"self",
".",
"lock_storage",
"=",
"\"\"",
"self",
".",
"_save_locks",
"(",
")"
] | https://github.com/evennia/evennia/blob/fa79110ba6b219932f22297838e8ac72ebc0be0e/evennia/locks/lockhandler.py#L464-L471 | ||
zhl2008/awd-platform | 0416b31abea29743387b10b3914581fbe8e7da5e | web_flaskbb/lib/python2.7/site-packages/werkzeug/debug/__init__.py | python | DebuggedApplication._get_pin | (self) | return self._pin | [] | def _get_pin(self):
if not hasattr(self, '_pin'):
self._pin, self._pin_cookie = get_pin_and_cookie_name(self.app)
return self._pin | [
"def",
"_get_pin",
"(",
"self",
")",
":",
"if",
"not",
"hasattr",
"(",
"self",
",",
"'_pin'",
")",
":",
"self",
".",
"_pin",
",",
"self",
".",
"_pin_cookie",
"=",
"get_pin_and_cookie_name",
"(",
"self",
".",
"app",
")",
"return",
"self",
".",
"_pin"
] | https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_flaskbb/lib/python2.7/site-packages/werkzeug/debug/__init__.py#L266-L269 | |||
oilshell/oil | 94388e7d44a9ad879b12615f6203b38596b5a2d3 | Python-2.7.13/Lib/lib-tk/Tix.py | python | ScrolledWindow.__init__ | (self, master, cnf={}, **kw) | [] | def __init__(self, master, cnf={}, **kw):
TixWidget.__init__(self, master, 'tixScrolledWindow', ['options'], cnf, kw)
self.subwidget_list['window'] = _dummyFrame(self, 'window')
self.subwidget_list['vsb'] = _dummyScrollbar(self, 'vsb')
self.subwidget_list['hsb'] = _dummyScrollbar(self, '... | [
"def",
"__init__",
"(",
"self",
",",
"master",
",",
"cnf",
"=",
"{",
"}",
",",
"*",
"*",
"kw",
")",
":",
"TixWidget",
".",
"__init__",
"(",
"self",
",",
"master",
",",
"'tixScrolledWindow'",
",",
"[",
"'options'",
"]",
",",
"cnf",
",",
"kw",
")",
... | https://github.com/oilshell/oil/blob/94388e7d44a9ad879b12615f6203b38596b5a2d3/Python-2.7.13/Lib/lib-tk/Tix.py#L1350-L1354 | ||||
twilio/twilio-python | 6e1e811ea57a1edfadd5161ace87397c563f6915 | twilio/rest/api/v2010/account/new_key.py | python | NewKeyPage.__init__ | (self, version, response, solution) | Initialize the NewKeyPage
:param Version version: Version that contains the resource
:param Response response: Response from the API
:param account_sid: A 34 character string that uniquely identifies this resource.
:returns: twilio.rest.api.v2010.account.new_key.NewKeyPage
:rty... | Initialize the NewKeyPage | [
"Initialize",
"the",
"NewKeyPage"
] | def __init__(self, version, response, solution):
"""
Initialize the NewKeyPage
:param Version version: Version that contains the resource
:param Response response: Response from the API
:param account_sid: A 34 character string that uniquely identifies this resource.
:r... | [
"def",
"__init__",
"(",
"self",
",",
"version",
",",
"response",
",",
"solution",
")",
":",
"super",
"(",
"NewKeyPage",
",",
"self",
")",
".",
"__init__",
"(",
"version",
",",
"response",
")",
"# Path Solution",
"self",
".",
"_solution",
"=",
"solution"
] | https://github.com/twilio/twilio-python/blob/6e1e811ea57a1edfadd5161ace87397c563f6915/twilio/rest/api/v2010/account/new_key.py#L61-L75 | ||
CalebBell/thermo | 572a47d1b03d49fe609b8d5f826fa6a7cde00828 | thermo/eos.py | python | PRTranslatedPPJP.__init__ | (self, Tc, Pc, omega, c=0.0, T=None, P=None, V=None) | [] | def __init__(self, Tc, Pc, omega, c=0.0, T=None, P=None, V=None):
self.Tc = Tc
self.Pc = Pc
self.omega = omega
self.T = T
self.P = P
self.V = V
Pc_inv = 1.0/Pc
self.a = self.c1*R2*Tc*Tc*Pc_inv
self.c = c
# 0.3919 + 1.4996*omega - 0.2721*om... | [
"def",
"__init__",
"(",
"self",
",",
"Tc",
",",
"Pc",
",",
"omega",
",",
"c",
"=",
"0.0",
",",
"T",
"=",
"None",
",",
"P",
"=",
"None",
",",
"V",
"=",
"None",
")",
":",
"self",
".",
"Tc",
"=",
"Tc",
"self",
".",
"Pc",
"=",
"Pc",
"self",
"... | https://github.com/CalebBell/thermo/blob/572a47d1b03d49fe609b8d5f826fa6a7cde00828/thermo/eos.py#L8217-L8236 | ||||
learningequality/ka-lite | 571918ea668013dcf022286ea85eff1c5333fb8b | kalite/packages/bundled/django/contrib/localflavor/cl/forms.py | python | CLRutField._algorithm | (self, rut) | return '0123456789K0'[11 - suma % 11] | Takes RUT in pure canonical form, calculates the verifier digit. | Takes RUT in pure canonical form, calculates the verifier digit. | [
"Takes",
"RUT",
"in",
"pure",
"canonical",
"form",
"calculates",
"the",
"verifier",
"digit",
"."
] | def _algorithm(self, rut):
"""
Takes RUT in pure canonical form, calculates the verifier digit.
"""
suma = 0
multi = 2
for r in rut[::-1]:
suma += int(r) * multi
multi += 1
if multi == 8:
multi = 2
return '0123... | [
"def",
"_algorithm",
"(",
"self",
",",
"rut",
")",
":",
"suma",
"=",
"0",
"multi",
"=",
"2",
"for",
"r",
"in",
"rut",
"[",
":",
":",
"-",
"1",
"]",
":",
"suma",
"+=",
"int",
"(",
"r",
")",
"*",
"multi",
"multi",
"+=",
"1",
"if",
"multi",
"=... | https://github.com/learningequality/ka-lite/blob/571918ea668013dcf022286ea85eff1c5333fb8b/kalite/packages/bundled/django/contrib/localflavor/cl/forms.py#L60-L71 | |
omz/PythonistaAppTemplate | f560f93f8876d82a21d108977f90583df08d55af | PythonistaAppTemplate/PythonistaKit.framework/pylib_ext/sympy/strategies/rl.py | python | glom | (key, count, combine) | return conglomerate | Create a rule to conglomerate identical args
>>> from sympy.strategies import glom
>>> from sympy import Add
>>> from sympy.abc import x
>>> key = lambda x: x.as_coeff_Mul()[1]
>>> count = lambda x: x.as_coeff_Mul()[0]
>>> combine = lambda cnt, arg: cnt * arg
>>> rl = glom(key, count... | Create a rule to conglomerate identical args | [
"Create",
"a",
"rule",
"to",
"conglomerate",
"identical",
"args"
] | def glom(key, count, combine):
""" Create a rule to conglomerate identical args
>>> from sympy.strategies import glom
>>> from sympy import Add
>>> from sympy.abc import x
>>> key = lambda x: x.as_coeff_Mul()[1]
>>> count = lambda x: x.as_coeff_Mul()[0]
>>> combine = lambda cnt, arg:... | [
"def",
"glom",
"(",
"key",
",",
"count",
",",
"combine",
")",
":",
"def",
"conglomerate",
"(",
"expr",
")",
":",
"\"\"\" Conglomerate together identical args x + x -> 2x \"\"\"",
"groups",
"=",
"sift",
"(",
"expr",
".",
"args",
",",
"key",
")",
"counts",
"=",
... | https://github.com/omz/PythonistaAppTemplate/blob/f560f93f8876d82a21d108977f90583df08d55af/PythonistaAppTemplate/PythonistaKit.framework/pylib_ext/sympy/strategies/rl.py#L42-L75 | |
EricssonResearch/calvin-base | bc4645c2061c30ca305a660e48dc86e3317f5b6f | calvin/runtime/south/async/__init__.py | python | get_framework | () | return _FW_PATH | Get the framework used on the runtime | Get the framework used on the runtime | [
"Get",
"the",
"framework",
"used",
"on",
"the",
"runtime"
] | def get_framework():
"""
Get the framework used on the runtime
"""
return _FW_PATH | [
"def",
"get_framework",
"(",
")",
":",
"return",
"_FW_PATH"
] | https://github.com/EricssonResearch/calvin-base/blob/bc4645c2061c30ca305a660e48dc86e3317f5b6f/calvin/runtime/south/async/__init__.py#L52-L56 | |
robinjia/adversarial-squad | 9cd77aa3b15b71c84052cb875dc8bb6590ae4e9a | src/py/eval_squad.py | python | normalize_answer | (s) | return white_space_fix(remove_articles(remove_punc(lower(s)))) | Lower text and remove punctuation, articles and extra whitespace. | Lower text and remove punctuation, articles and extra whitespace. | [
"Lower",
"text",
"and",
"remove",
"punctuation",
"articles",
"and",
"extra",
"whitespace",
"."
] | def normalize_answer(s):
"""Lower text and remove punctuation, articles and extra whitespace."""
def remove_articles(text):
return re.sub(r'\b(a|an|the)\b', ' ', text)
def white_space_fix(text):
return ' '.join(text.split())
def remove_punc(text):
exclude = set(string.punctuati... | [
"def",
"normalize_answer",
"(",
"s",
")",
":",
"def",
"remove_articles",
"(",
"text",
")",
":",
"return",
"re",
".",
"sub",
"(",
"r'\\b(a|an|the)\\b'",
",",
"' '",
",",
"text",
")",
"def",
"white_space_fix",
"(",
"text",
")",
":",
"return",
"' '",
".",
... | https://github.com/robinjia/adversarial-squad/blob/9cd77aa3b15b71c84052cb875dc8bb6590ae4e9a/src/py/eval_squad.py#L13-L28 | |
tao12345666333/tornado-zh | e9e8519beb147d9e1290f6a4fa7d61123d1ecb1c | tornado/gen.py | python | WaitIterator.next | (self) | return self._running_future | Returns a `.Future` that will yield the next available result.
Note that this `.Future` will not be the same object as any of
the inputs. | Returns a `.Future` that will yield the next available result. | [
"Returns",
"a",
".",
"Future",
"that",
"will",
"yield",
"the",
"next",
"available",
"result",
"."
] | def next(self):
"""Returns a `.Future` that will yield the next available result.
Note that this `.Future` will not be the same object as any of
the inputs.
"""
self._running_future = TracebackFuture()
if self._finished:
self._return_result(self._finished.po... | [
"def",
"next",
"(",
"self",
")",
":",
"self",
".",
"_running_future",
"=",
"TracebackFuture",
"(",
")",
"if",
"self",
".",
"_finished",
":",
"self",
".",
"_return_result",
"(",
"self",
".",
"_finished",
".",
"popleft",
"(",
")",
")",
"return",
"self",
... | https://github.com/tao12345666333/tornado-zh/blob/e9e8519beb147d9e1290f6a4fa7d61123d1ecb1c/tornado/gen.py#L419-L430 | |
CvvT/dumpDex | 92ab3b7e996194a06bf1dd5538a4954e8a5ee9c1 | python/idaapi.py | python | Appcall__.byref | (val) | return PyIdc_cvt_refclass__(val) | Method to create references to immutable objects
Currently we support references to int/strings
Objects need not be passed by reference (this will be done automatically) | Method to create references to immutable objects
Currently we support references to int/strings
Objects need not be passed by reference (this will be done automatically) | [
"Method",
"to",
"create",
"references",
"to",
"immutable",
"objects",
"Currently",
"we",
"support",
"references",
"to",
"int",
"/",
"strings",
"Objects",
"need",
"not",
"be",
"passed",
"by",
"reference",
"(",
"this",
"will",
"be",
"done",
"automatically",
")"
... | def byref(val):
"""
Method to create references to immutable objects
Currently we support references to int/strings
Objects need not be passed by reference (this will be done automatically)
"""
return PyIdc_cvt_refclass__(val) | [
"def",
"byref",
"(",
"val",
")",
":",
"return",
"PyIdc_cvt_refclass__",
"(",
"val",
")"
] | https://github.com/CvvT/dumpDex/blob/92ab3b7e996194a06bf1dd5538a4954e8a5ee9c1/python/idaapi.py#L3950-L3956 | |
sahana/eden | 1696fa50e90ce967df69f66b571af45356cc18da | modules/templates/historic/CRMT/menus.py | python | S3MainMenu.menu_modules | (cls) | return [
# In title_area
#MM("Sahana"),
MM("Find", link=False)(
MM("People", c="pr", f="person", m="summary", always_display=True),
MM("Organizations", c="org", f="organisation", m="summary"),
MM("Activities", c="project", f="activity",... | Custom Modules Menu | Custom Modules Menu | [
"Custom",
"Modules",
"Menu"
] | def menu_modules(cls):
""" Custom Modules Menu """
return [
# In title_area
#MM("Sahana"),
MM("Find", link=False)(
MM("People", c="pr", f="person", m="summary", always_display=True),
MM("Organizations", c="org", f="organisation", m="su... | [
"def",
"menu_modules",
"(",
"cls",
")",
":",
"return",
"[",
"# In title_area",
"#MM(\"Sahana\"),",
"MM",
"(",
"\"Find\"",
",",
"link",
"=",
"False",
")",
"(",
"MM",
"(",
"\"People\"",
",",
"c",
"=",
"\"pr\"",
",",
"f",
"=",
"\"person\"",
",",
"m",
"=",... | https://github.com/sahana/eden/blob/1696fa50e90ce967df69f66b571af45356cc18da/modules/templates/historic/CRMT/menus.py#L46-L88 | |
plotly/plotly.py | cfad7862594b35965c0e000813bd7805e8494a5b | packages/python/plotly/plotly/graph_objs/splom/_hoverlabel.py | python | Hoverlabel.bordercolor | (self) | return self["bordercolor"] | Sets the border color of the hover labels for this trace.
The 'bordercolor' property is a color and may be specified as:
- A hex string (e.g. '#ff0000')
- An rgb/rgba string (e.g. 'rgb(255,0,0)')
- An hsl/hsla string (e.g. 'hsl(0,100%,50%)')
- An hsv/hsva string (e.g... | Sets the border color of the hover labels for this trace.
The 'bordercolor' property is a color and may be specified as:
- A hex string (e.g. '#ff0000')
- An rgb/rgba string (e.g. 'rgb(255,0,0)')
- An hsl/hsla string (e.g. 'hsl(0,100%,50%)')
- An hsv/hsva string (e.g... | [
"Sets",
"the",
"border",
"color",
"of",
"the",
"hover",
"labels",
"for",
"this",
"trace",
".",
"The",
"bordercolor",
"property",
"is",
"a",
"color",
"and",
"may",
"be",
"specified",
"as",
":",
"-",
"A",
"hex",
"string",
"(",
"e",
".",
"g",
".",
"#ff0... | def bordercolor(self):
"""
Sets the border color of the hover labels for this trace.
The 'bordercolor' property is a color and may be specified as:
- A hex string (e.g. '#ff0000')
- An rgb/rgba string (e.g. 'rgb(255,0,0)')
- An hsl/hsla string (e.g. 'hsl(0,100%... | [
"def",
"bordercolor",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"bordercolor\"",
"]"
] | https://github.com/plotly/plotly.py/blob/cfad7862594b35965c0e000813bd7805e8494a5b/packages/python/plotly/plotly/graph_objs/splom/_hoverlabel.py#L150-L201 | |
gem/oq-engine | 1bdb88f3914e390abcbd285600bfd39477aae47c | openquake/hazardlib/calc/disagg.py | python | assert_same_shape | (arrays) | Raises an AssertionError if the shapes are not consistent | Raises an AssertionError if the shapes are not consistent | [
"Raises",
"an",
"AssertionError",
"if",
"the",
"shapes",
"are",
"not",
"consistent"
] | def assert_same_shape(arrays):
"""
Raises an AssertionError if the shapes are not consistent
"""
shape = arrays[0].shape
for arr in arrays[1:]:
assert arr.shape == shape, (arr.shape, shape) | [
"def",
"assert_same_shape",
"(",
"arrays",
")",
":",
"shape",
"=",
"arrays",
"[",
"0",
"]",
".",
"shape",
"for",
"arr",
"in",
"arrays",
"[",
"1",
":",
"]",
":",
"assert",
"arr",
".",
"shape",
"==",
"shape",
",",
"(",
"arr",
".",
"shape",
",",
"sh... | https://github.com/gem/oq-engine/blob/1bdb88f3914e390abcbd285600bfd39477aae47c/openquake/hazardlib/calc/disagg.py#L45-L51 | ||
sagemath/sage | f9b2db94f675ff16963ccdefba4f1a3393b3fe0d | src/sage_setup/autogen/interpreters/specs/cc.py | python | CCInterpreter.__init__ | (self) | r"""
Initialize a CCInterpreter.
EXAMPLES::
sage: from sage_setup.autogen.interpreters import *
sage: interp = CCInterpreter()
sage: interp.name
'cc'
sage: interp.mc_py_constants
{MC:py_constants}
sage: interp.chunks
... | r"""
Initialize a CCInterpreter. | [
"r",
"Initialize",
"a",
"CCInterpreter",
"."
] | def __init__(self):
r"""
Initialize a CCInterpreter.
EXAMPLES::
sage: from sage_setup.autogen.interpreters import *
sage: interp = CCInterpreter()
sage: interp.name
'cc'
sage: interp.mc_py_constants
{MC:py_constants}
... | [
"def",
"__init__",
"(",
"self",
")",
":",
"mc_retval",
"=",
"MemoryChunkCCRetval",
"(",
"'retval'",
",",
"ty_mpc",
")",
"super",
"(",
"CCInterpreter",
",",
"self",
")",
".",
"__init__",
"(",
"ty_mpc",
",",
"mc_retval",
"=",
"mc_retval",
")",
"self",
".",
... | https://github.com/sagemath/sage/blob/f9b2db94f675ff16963ccdefba4f1a3393b3fe0d/src/sage_setup/autogen/interpreters/specs/cc.py#L107-L240 | ||
AndrewAnnex/SpiceyPy | 9f8b626338f119bacd39ef2ba94a6f71bd6341c0 | src/spiceypy/spiceypy.py | python | unorm | (v1: ndarray) | return stypes.c_vector_to_python(vout), vmag.value | Normalize a double precision 3-vector and return its magnitude.
https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/unorm_c.html
:param v1: Vector to be normalized.
:return: Unit vector of v1, Magnitude of v1. | Normalize a double precision 3-vector and return its magnitude. | [
"Normalize",
"a",
"double",
"precision",
"3",
"-",
"vector",
"and",
"return",
"its",
"magnitude",
"."
] | def unorm(v1: ndarray) -> Tuple[ndarray, float]:
"""
Normalize a double precision 3-vector and return its magnitude.
https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/unorm_c.html
:param v1: Vector to be normalized.
:return: Unit vector of v1, Magnitude of v1.
"""
v1 = stypes.to_dou... | [
"def",
"unorm",
"(",
"v1",
":",
"ndarray",
")",
"->",
"Tuple",
"[",
"ndarray",
",",
"float",
"]",
":",
"v1",
"=",
"stypes",
".",
"to_double_vector",
"(",
"v1",
")",
"vout",
"=",
"stypes",
".",
"empty_double_vector",
"(",
"3",
")",
"vmag",
"=",
"ctype... | https://github.com/AndrewAnnex/SpiceyPy/blob/9f8b626338f119bacd39ef2ba94a6f71bd6341c0/src/spiceypy/spiceypy.py#L14556-L14569 | |
libtcod/python-tcod | e12c4172baa9efdfd74aff6ee9bab8454a835248 | tcod/console.py | python | Console.default_bg | (self) | return color.r, color.g, color.b | Tuple[int, int, int]: The default background color. | Tuple[int, int, int]: The default background color. | [
"Tuple",
"[",
"int",
"int",
"int",
"]",
":",
"The",
"default",
"background",
"color",
"."
] | def default_bg(self) -> Tuple[int, int, int]:
"""Tuple[int, int, int]: The default background color."""
color = self._console_data.back
return color.r, color.g, color.b | [
"def",
"default_bg",
"(",
"self",
")",
"->",
"Tuple",
"[",
"int",
",",
"int",
",",
"int",
"]",
":",
"color",
"=",
"self",
".",
"_console_data",
".",
"back",
"return",
"color",
".",
"r",
",",
"color",
".",
"g",
",",
"color",
".",
"b"
] | https://github.com/libtcod/python-tcod/blob/e12c4172baa9efdfd74aff6ee9bab8454a835248/tcod/console.py#L345-L348 | |
eventlet/eventlet | 955be1c7227a6df0daa537ebb8aed0cfa174d2e5 | eventlet/greenio/base.py | python | socket_accept | (descriptor) | Attempts to accept() on the descriptor, returns a client,address tuple
if it succeeds; returns None if it needs to trampoline, and raises
any exceptions. | Attempts to accept() on the descriptor, returns a client,address tuple
if it succeeds; returns None if it needs to trampoline, and raises
any exceptions. | [
"Attempts",
"to",
"accept",
"()",
"on",
"the",
"descriptor",
"returns",
"a",
"client",
"address",
"tuple",
"if",
"it",
"succeeds",
";",
"returns",
"None",
"if",
"it",
"needs",
"to",
"trampoline",
"and",
"raises",
"any",
"exceptions",
"."
] | def socket_accept(descriptor):
"""
Attempts to accept() on the descriptor, returns a client,address tuple
if it succeeds; returns None if it needs to trampoline, and raises
any exceptions.
"""
try:
return descriptor.accept()
except socket.error as e:
if get_errno(e) == errno.... | [
"def",
"socket_accept",
"(",
"descriptor",
")",
":",
"try",
":",
"return",
"descriptor",
".",
"accept",
"(",
")",
"except",
"socket",
".",
"error",
"as",
"e",
":",
"if",
"get_errno",
"(",
"e",
")",
"==",
"errno",
".",
"EWOULDBLOCK",
":",
"return",
"Non... | https://github.com/eventlet/eventlet/blob/955be1c7227a6df0daa537ebb8aed0cfa174d2e5/eventlet/greenio/base.py#L57-L68 | ||
llSourcell/AI_Artist | 3038c06c2e389b9c919c881c9a169efe2fd7810e | lib/python2.7/site-packages/pip/_vendor/distlib/_backport/tarfile.py | python | ExFileObject.seekable | (self) | return self.fileobj.seekable() | [] | def seekable(self):
return self.fileobj.seekable() | [
"def",
"seekable",
"(",
"self",
")",
":",
"return",
"self",
".",
"fileobj",
".",
"seekable",
"(",
")"
] | https://github.com/llSourcell/AI_Artist/blob/3038c06c2e389b9c919c881c9a169efe2fd7810e/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/tarfile.py#L807-L808 | |||
edisonlz/fastor | 342078a18363ac41d3c6b1ab29dbdd44fdb0b7b3 | base/site-packages/django/db/backends/__init__.py | python | BaseDatabaseIntrospection.get_indexes | (self, cursor, table_name) | Returns a dictionary of indexed fieldname -> infodict for the given
table, where each infodict is in the format:
{'primary_key': boolean representing whether it's the primary key,
'unique': boolean representing whether it's a unique index}
Only single-column indexes are introsp... | Returns a dictionary of indexed fieldname -> infodict for the given
table, where each infodict is in the format:
{'primary_key': boolean representing whether it's the primary key,
'unique': boolean representing whether it's a unique index} | [
"Returns",
"a",
"dictionary",
"of",
"indexed",
"fieldname",
"-",
">",
"infodict",
"for",
"the",
"given",
"table",
"where",
"each",
"infodict",
"is",
"in",
"the",
"format",
":",
"{",
"primary_key",
":",
"boolean",
"representing",
"whether",
"it",
"s",
"the",
... | def get_indexes(self, cursor, table_name):
"""
Returns a dictionary of indexed fieldname -> infodict for the given
table, where each infodict is in the format:
{'primary_key': boolean representing whether it's the primary key,
'unique': boolean representing whether it's ... | [
"def",
"get_indexes",
"(",
"self",
",",
"cursor",
",",
"table_name",
")",
":",
"raise",
"NotImplementedError"
] | https://github.com/edisonlz/fastor/blob/342078a18363ac41d3c6b1ab29dbdd44fdb0b7b3/base/site-packages/django/db/backends/__init__.py#L1344-L1353 | ||
openshift/openshift-tools | 1188778e728a6e4781acf728123e5b356380fe6f | openshift/installer/vendored/openshift-ansible-3.10.0-0.29.0/roles/lib_openshift/library/oc_adm_csr.py | python | OpenShiftCLIConfig.config_options | (self) | return self._options | return config options | return config options | [
"return",
"config",
"options"
] | def config_options(self):
''' return config options '''
return self._options | [
"def",
"config_options",
"(",
"self",
")",
":",
"return",
"self",
".",
"_options"
] | https://github.com/openshift/openshift-tools/blob/1188778e728a6e4781acf728123e5b356380fe6f/openshift/installer/vendored/openshift-ansible-3.10.0-0.29.0/roles/lib_openshift/library/oc_adm_csr.py#L1439-L1441 | |
dipu-bd/lightnovel-crawler | eca7a71f217ce7a6b0a54d2e2afb349571871880 | sources/en/w/wnmtl.py | python | WNMTLCrawler.download_chapter_body | (self, chapter) | return '\n'.join(['<p>' + x + '</p>' for x in contents]) | Download body of a single chapter and return as clean html format. | Download body of a single chapter and return as clean html format. | [
"Download",
"body",
"of",
"a",
"single",
"chapter",
"and",
"return",
"as",
"clean",
"html",
"format",
"."
] | def download_chapter_body(self, chapter):
'''Download body of a single chapter and return as clean html format.'''
data = self.get_json(chapter['url'])
contents = data['data']['content'].split('\n')
return '\n'.join(['<p>' + x + '</p>' for x in contents]) | [
"def",
"download_chapter_body",
"(",
"self",
",",
"chapter",
")",
":",
"data",
"=",
"self",
".",
"get_json",
"(",
"chapter",
"[",
"'url'",
"]",
")",
"contents",
"=",
"data",
"[",
"'data'",
"]",
"[",
"'content'",
"]",
".",
"split",
"(",
"'\\n'",
")",
... | https://github.com/dipu-bd/lightnovel-crawler/blob/eca7a71f217ce7a6b0a54d2e2afb349571871880/sources/en/w/wnmtl.py#L88-L92 | |
rpmuller/pyquante2 | 6e34cb4480ae7dbd8c5e44d221d8b27584890c83 | pyquante2/utils.py | python | cholorth | (S) | return np.linalg.inv(np.linalg.cholesky(S)).T | Cholesky orthogonalization | Cholesky orthogonalization | [
"Cholesky",
"orthogonalization"
] | def cholorth(S):
"Cholesky orthogonalization"
return np.linalg.inv(np.linalg.cholesky(S)).T | [
"def",
"cholorth",
"(",
"S",
")",
":",
"return",
"np",
".",
"linalg",
".",
"inv",
"(",
"np",
".",
"linalg",
".",
"cholesky",
"(",
"S",
")",
")",
".",
"T"
] | https://github.com/rpmuller/pyquante2/blob/6e34cb4480ae7dbd8c5e44d221d8b27584890c83/pyquante2/utils.py#L163-L165 | |
Toblerity/rtree | eb04ef8933418ab108a45b6576abea95d6cbcbdb | rtree/index.py | python | CustomStorage.destroy | (self, returnError) | Must be overridden. No return value. | Must be overridden. No return value. | [
"Must",
"be",
"overridden",
".",
"No",
"return",
"value",
"."
] | def destroy(self, returnError):
"""Must be overridden. No return value."""
returnError.contents.value = self.IllegalStateError
raise NotImplementedError("You must override this method.") | [
"def",
"destroy",
"(",
"self",
",",
"returnError",
")",
":",
"returnError",
".",
"contents",
".",
"value",
"=",
"self",
".",
"IllegalStateError",
"raise",
"NotImplementedError",
"(",
"\"You must override this method.\"",
")"
] | https://github.com/Toblerity/rtree/blob/eb04ef8933418ab108a45b6576abea95d6cbcbdb/rtree/index.py#L1771-L1774 | ||
mortcanty/CRCPython | 35d0e9f96befd38d4a78671c868128440c74b0e6 | src/build/lib/auxil/png.py | python | Test.testPAMin | (self) | Test that the command line tool can read PAM file. | Test that the command line tool can read PAM file. | [
"Test",
"that",
"the",
"command",
"line",
"tool",
"can",
"read",
"PAM",
"file",
"."
] | def testPAMin(self):
"""Test that the command line tool can read PAM file."""
def do():
return _main(['testPAMin'])
s = StringIO()
s.write('P7\nWIDTH 3\nHEIGHT 1\nDEPTH 4\nMAXVAL 255\n'
'TUPLTYPE RGB_ALPHA\nENDHDR\n')
# The pixels in flat row flat pixe... | [
"def",
"testPAMin",
"(",
"self",
")",
":",
"def",
"do",
"(",
")",
":",
"return",
"_main",
"(",
"[",
"'testPAMin'",
"]",
")",
"s",
"=",
"StringIO",
"(",
")",
"s",
".",
"write",
"(",
"'P7\\nWIDTH 3\\nHEIGHT 1\\nDEPTH 4\\nMAXVAL 255\\n'",
"'TUPLTYPE RGB_ALPHA\\nE... | https://github.com/mortcanty/CRCPython/blob/35d0e9f96befd38d4a78671c868128440c74b0e6/src/build/lib/auxil/png.py#L2254-L2272 | ||
JaniceWuo/MovieRecommend | 4c86db64ca45598917d304f535413df3bc9fea65 | movierecommend/venv1/Lib/site-packages/django/core/cache/backends/filebased.py | python | FileBasedCache._delete | (self, fname) | [] | def _delete(self, fname):
if not fname.startswith(self._dir) or not os.path.exists(fname):
return
try:
os.remove(fname)
except OSError as e:
# ENOENT can happen if the cache file is removed (by another
# process) after the os.path.exists check.
... | [
"def",
"_delete",
"(",
"self",
",",
"fname",
")",
":",
"if",
"not",
"fname",
".",
"startswith",
"(",
"self",
".",
"_dir",
")",
"or",
"not",
"os",
".",
"path",
".",
"exists",
"(",
"fname",
")",
":",
"return",
"try",
":",
"os",
".",
"remove",
"(",
... | https://github.com/JaniceWuo/MovieRecommend/blob/4c86db64ca45598917d304f535413df3bc9fea65/movierecommend/venv1/Lib/site-packages/django/core/cache/backends/filebased.py#L67-L76 | ||||
NifTK/NiftyNet | 935bf4334cd00fa9f9d50f6a95ddcbfdde4031e0 | niftynet/evaluation/region_properties.py | python | RegionProperties.compactness | (self) | return np.power(Sn, 1.5) / Vn, np.power(Snb, 1.5) / Vnb, \
np.power(Sv, 1.5) / Vv, np.power(Svb, 1.5) / Vvb | Calculates the compactness S^1.5/V in terms of probabilistic count,
binarised count, probabilistic volume, binarised volume
:return: | Calculates the compactness S^1.5/V in terms of probabilistic count,
binarised count, probabilistic volume, binarised volume | [
"Calculates",
"the",
"compactness",
"S^1",
".",
"5",
"/",
"V",
"in",
"terms",
"of",
"probabilistic",
"count",
"binarised",
"count",
"probabilistic",
"volume",
"binarised",
"volume"
] | def compactness(self):
"""
Calculates the compactness S^1.5/V in terms of probabilistic count,
binarised count, probabilistic volume, binarised volume
:return:
"""
Sn, Snb, Sv, Svb = self.surface()
Vn, Vnb, Vv, Vvb = self.volume()
return np.power(Sn, 1.5)... | [
"def",
"compactness",
"(",
"self",
")",
":",
"Sn",
",",
"Snb",
",",
"Sv",
",",
"Svb",
"=",
"self",
".",
"surface",
"(",
")",
"Vn",
",",
"Vnb",
",",
"Vv",
",",
"Vvb",
"=",
"self",
".",
"volume",
"(",
")",
"return",
"np",
".",
"power",
"(",
"Sn... | https://github.com/NifTK/NiftyNet/blob/935bf4334cd00fa9f9d50f6a95ddcbfdde4031e0/niftynet/evaluation/region_properties.py#L614-L624 | |
oilshell/oil | 94388e7d44a9ad879b12615f6203b38596b5a2d3 | Python-2.7.13/Lib/urlparse.py | python | urldefrag | (url) | Removes any existing fragment from URL.
Returns a tuple of the defragmented URL and the fragment. If
the URL contained no fragments, the second element is the
empty string. | Removes any existing fragment from URL. | [
"Removes",
"any",
"existing",
"fragment",
"from",
"URL",
"."
] | def urldefrag(url):
"""Removes any existing fragment from URL.
Returns a tuple of the defragmented URL and the fragment. If
the URL contained no fragments, the second element is the
empty string.
"""
if '#' in url:
s, n, p, a, q, frag = urlparse(url)
defrag = urlunparse((s, n, ... | [
"def",
"urldefrag",
"(",
"url",
")",
":",
"if",
"'#'",
"in",
"url",
":",
"s",
",",
"n",
",",
"p",
",",
"a",
",",
"q",
",",
"frag",
"=",
"urlparse",
"(",
"url",
")",
"defrag",
"=",
"urlunparse",
"(",
"(",
"s",
",",
"n",
",",
"p",
",",
"a",
... | https://github.com/oilshell/oil/blob/94388e7d44a9ad879b12615f6203b38596b5a2d3/Python-2.7.13/Lib/urlparse.py#L303-L315 | ||
entropy1337/infernal-twin | 10995cd03312e39a48ade0f114ebb0ae3a711bb8 | Modules/build/pip/pip/_vendor/requests/models.py | python | RequestEncodingMixin.path_url | (self) | return ''.join(url) | Build the path URL to use. | Build the path URL to use. | [
"Build",
"the",
"path",
"URL",
"to",
"use",
"."
] | def path_url(self):
"""Build the path URL to use."""
url = []
p = urlsplit(self.url)
path = p.path
if not path:
path = '/'
url.append(path)
query = p.query
if query:
url.append('?')
url.append(query)
return... | [
"def",
"path_url",
"(",
"self",
")",
":",
"url",
"=",
"[",
"]",
"p",
"=",
"urlsplit",
"(",
"self",
".",
"url",
")",
"path",
"=",
"p",
".",
"path",
"if",
"not",
"path",
":",
"path",
"=",
"'/'",
"url",
".",
"append",
"(",
"path",
")",
"query",
... | https://github.com/entropy1337/infernal-twin/blob/10995cd03312e39a48ade0f114ebb0ae3a711bb8/Modules/build/pip/pip/_vendor/requests/models.py#L54-L72 | |
mattupstate/flask-security | 674b18103fa8734aca71bbd084ea01e3709817ef | flask_security/core.py | python | UserMixin.is_active | (self) | return self.active | Returns `True` if the user is active. | Returns `True` if the user is active. | [
"Returns",
"True",
"if",
"the",
"user",
"is",
"active",
"."
] | def is_active(self):
"""Returns `True` if the user is active."""
return self.active | [
"def",
"is_active",
"(",
"self",
")",
":",
"return",
"self",
".",
"active"
] | https://github.com/mattupstate/flask-security/blob/674b18103fa8734aca71bbd084ea01e3709817ef/flask_security/core.py#L390-L392 | |
Tesorio/django-anon | 5288d84001e2cbe4027c3c0f00173e6fe49da959 | anon/compat.py | python | bulk_update | (objects, fields, manager, **bulk_update_kwargs) | Updates the list of objects using django queryset's
inbuilt ``.bulk_update()`` method if present, else
django_bulk_update's ``bulk_update()`` will be used
:param objects: list of objects that needs to be bulk updated
:type objects: list[object]
:param manager: instance of django model manager
:... | Updates the list of objects using django queryset's
inbuilt ``.bulk_update()`` method if present, else
django_bulk_update's ``bulk_update()`` will be used | [
"Updates",
"the",
"list",
"of",
"objects",
"using",
"django",
"queryset",
"s",
"inbuilt",
".",
"bulk_update",
"()",
"method",
"if",
"present",
"else",
"django_bulk_update",
"s",
"bulk_update",
"()",
"will",
"be",
"used"
] | def bulk_update(objects, fields, manager, **bulk_update_kwargs):
"""Updates the list of objects using django queryset's
inbuilt ``.bulk_update()`` method if present, else
django_bulk_update's ``bulk_update()`` will be used
:param objects: list of objects that needs to be bulk updated
:type objects:... | [
"def",
"bulk_update",
"(",
"objects",
",",
"fields",
",",
"manager",
",",
"*",
"*",
"bulk_update_kwargs",
")",
":",
"try",
":",
"manager",
".",
"bulk_update",
"(",
"objects",
",",
"fields",
",",
"*",
"*",
"bulk_update_kwargs",
")",
"except",
"AttributeError"... | https://github.com/Tesorio/django-anon/blob/5288d84001e2cbe4027c3c0f00173e6fe49da959/anon/compat.py#L5-L21 | ||
StanfordVL/taskonomy | 9f814867b5fe4165860862211e8e99b0f200144d | code/lib/optimizers/train_steps.py | python | get_default_train_step_kwargs | ( global_step, max_steps, log_every_n_steps=1, trace_every_n_steps=None ) | Sets some default arguments for any train_step_fn | Sets some default arguments for any train_step_fn | [
"Sets",
"some",
"default",
"arguments",
"for",
"any",
"train_step_fn"
] | def get_default_train_step_kwargs( global_step, max_steps, log_every_n_steps=1, trace_every_n_steps=None ):
''' Sets some default arguments for any train_step_fn '''
with tf.name_scope('train_step'):
train_step_kwargs = { 'max_steps': max_steps }
if max_steps:
should_stop_op = tf.gr... | [
"def",
"get_default_train_step_kwargs",
"(",
"global_step",
",",
"max_steps",
",",
"log_every_n_steps",
"=",
"1",
",",
"trace_every_n_steps",
"=",
"None",
")",
":",
"with",
"tf",
".",
"name_scope",
"(",
"'train_step'",
")",
":",
"train_step_kwargs",
"=",
"{",
"'... | https://github.com/StanfordVL/taskonomy/blob/9f814867b5fe4165860862211e8e99b0f200144d/code/lib/optimizers/train_steps.py#L109-L128 | ||
titusjan/argos | 5a9c31a8a9a2ca825bbf821aa1e685740e3682d7 | argos/inspector/pgplugins/old_imageplot2d.py | python | PgImagePlot2dCti._closeResources | (self) | Disconnects signals.
Is called by self.finalize when the cti is deleted. | Disconnects signals.
Is called by self.finalize when the cti is deleted. | [
"Disconnects",
"signals",
".",
"Is",
"called",
"by",
"self",
".",
"finalize",
"when",
"the",
"cti",
"is",
"deleted",
"."
] | def _closeResources(self):
""" Disconnects signals.
Is called by self.finalize when the cti is deleted.
"""
verCrossViewBox = self.pgImagePlot2d.verCrossPlotItem.getViewBox()
verCrossViewBox.sigRangeChangedManually.disconnect(self.yAxisRangeCti.setAutoRangeOff)
horCro... | [
"def",
"_closeResources",
"(",
"self",
")",
":",
"verCrossViewBox",
"=",
"self",
".",
"pgImagePlot2d",
".",
"verCrossPlotItem",
".",
"getViewBox",
"(",
")",
"verCrossViewBox",
".",
"sigRangeChangedManually",
".",
"disconnect",
"(",
"self",
".",
"yAxisRangeCti",
".... | https://github.com/titusjan/argos/blob/5a9c31a8a9a2ca825bbf821aa1e685740e3682d7/argos/inspector/pgplugins/old_imageplot2d.py#L227-L238 | ||
1040003585/WebScrapingWithPython | a770fa5b03894076c8c9539b1ffff34424ffc016 | portia_examle/lib/python2.7/site-packages/setuptools/dist.py | python | check_requirements | (dist, attr, value) | Verify that install_requires is a valid requirements list | Verify that install_requires is a valid requirements list | [
"Verify",
"that",
"install_requires",
"is",
"a",
"valid",
"requirements",
"list"
] | def check_requirements(dist, attr, value):
"""Verify that install_requires is a valid requirements list"""
try:
list(pkg_resources.parse_requirements(value))
except (TypeError, ValueError) as error:
tmpl = (
"{attr!r} must be a string or list of strings "
"containing ... | [
"def",
"check_requirements",
"(",
"dist",
",",
"attr",
",",
"value",
")",
":",
"try",
":",
"list",
"(",
"pkg_resources",
".",
"parse_requirements",
"(",
"value",
")",
")",
"except",
"(",
"TypeError",
",",
"ValueError",
")",
"as",
"error",
":",
"tmpl",
"=... | https://github.com/1040003585/WebScrapingWithPython/blob/a770fa5b03894076c8c9539b1ffff34424ffc016/portia_examle/lib/python2.7/site-packages/setuptools/dist.py#L148-L157 | ||
tf-encrypted/tf-encrypted | 8b7cfb32c426e9a6f56769a1b47626bd1be03a66 | tf_encrypted/protocol/pond/pond.py | python | Pond.add | (self, x, y) | return self.dispatch("add", x, y) | add(x, y) -> PondTensor
Adds two tensors `x` and `y`.
:param PondTensor x: The first operand.
:param PondTensor y: The second operand. | add(x, y) -> PondTensor | [
"add",
"(",
"x",
"y",
")",
"-",
">",
"PondTensor"
] | def add(self, x, y):
"""
add(x, y) -> PondTensor
Adds two tensors `x` and `y`.
:param PondTensor x: The first operand.
:param PondTensor y: The second operand.
"""
x, y = self.lift(x, y)
return self.dispatch("add", x, y) | [
"def",
"add",
"(",
"self",
",",
"x",
",",
"y",
")",
":",
"x",
",",
"y",
"=",
"self",
".",
"lift",
"(",
"x",
",",
"y",
")",
"return",
"self",
".",
"dispatch",
"(",
"\"add\"",
",",
"x",
",",
"y",
")"
] | https://github.com/tf-encrypted/tf-encrypted/blob/8b7cfb32c426e9a6f56769a1b47626bd1be03a66/tf_encrypted/protocol/pond/pond.py#L862-L872 | |
holzschu/Carnets | 44effb10ddfc6aa5c8b0687582a724ba82c6b547 | Library/lib/python3.7/site-packages/bokeh-1.4.0-py3.7.egg/bokeh/client/session.py | python | push_session | (document, session_id=None, url='default', io_loop=None) | return session | Create a session by pushing the given document to the server,
overwriting any existing server-side document.
``session.document`` in the returned session will be your supplied
document. While the connection to the server is open, changes made on the
server side will be applied to this document, and cha... | Create a session by pushing the given document to the server,
overwriting any existing server-side document. | [
"Create",
"a",
"session",
"by",
"pushing",
"the",
"given",
"document",
"to",
"the",
"server",
"overwriting",
"any",
"existing",
"server",
"-",
"side",
"document",
"."
] | def push_session(document, session_id=None, url='default', io_loop=None):
''' Create a session by pushing the given document to the server,
overwriting any existing server-side document.
``session.document`` in the returned session will be your supplied
document. While the connection to the server is o... | [
"def",
"push_session",
"(",
"document",
",",
"session_id",
"=",
"None",
",",
"url",
"=",
"'default'",
",",
"io_loop",
"=",
"None",
")",
":",
"coords",
"=",
"_SessionCoordinates",
"(",
"session_id",
"=",
"session_id",
",",
"url",
"=",
"url",
")",
"session",... | https://github.com/holzschu/Carnets/blob/44effb10ddfc6aa5c8b0687582a724ba82c6b547/Library/lib/python3.7/site-packages/bokeh-1.4.0-py3.7.egg/bokeh/client/session.py#L127-L169 | |
linxid/Machine_Learning_Study_Path | 558e82d13237114bbb8152483977806fc0c222af | Machine Learning In Action/Chapter4-NaiveBayes/venv/Lib/site-packages/pkg_resources/_vendor/packaging/specifiers.py | python | LegacySpecifier._compare_less_than_equal | (self, prospective, spec) | return prospective <= self._coerce_version(spec) | [] | def _compare_less_than_equal(self, prospective, spec):
return prospective <= self._coerce_version(spec) | [
"def",
"_compare_less_than_equal",
"(",
"self",
",",
"prospective",
",",
"spec",
")",
":",
"return",
"prospective",
"<=",
"self",
".",
"_coerce_version",
"(",
"spec",
")"
] | https://github.com/linxid/Machine_Learning_Study_Path/blob/558e82d13237114bbb8152483977806fc0c222af/Machine Learning In Action/Chapter4-NaiveBayes/venv/Lib/site-packages/pkg_resources/_vendor/packaging/specifiers.py#L253-L254 | |||
ducksboard/libsaas | 615981a3336f65be9d51ae95a48aed9ad3bd1c3c | libsaas/services/trello/notifications.py | python | Notification.card | (self) | return Card(self) | Returns a single card | Returns a single card | [
"Returns",
"a",
"single",
"card"
] | def card(self):
"""
Returns a single card
"""
return Card(self) | [
"def",
"card",
"(",
"self",
")",
":",
"return",
"Card",
"(",
"self",
")"
] | https://github.com/ducksboard/libsaas/blob/615981a3336f65be9d51ae95a48aed9ad3bd1c3c/libsaas/services/trello/notifications.py#L59-L63 | |
oddt/oddt | 8cf555820d97a692ade81c101ebe10e28bcb3722 | oddt/fingerprints.py | python | similarity_SPLIF | (reference, query, rmsd_cutoff=1.) | Calculates similarity between structural interaction fingerprints,
based on doi:http://pubs.acs.org/doi/abs/10.1021/ci500319f.
Parameters
----------
reference, query: numpy.array
SPLIFs, which are compared in order to determine similarity.
rmsd_cutoff : int (default = 1)
Specific tr... | Calculates similarity between structural interaction fingerprints,
based on doi:http://pubs.acs.org/doi/abs/10.1021/ci500319f. | [
"Calculates",
"similarity",
"between",
"structural",
"interaction",
"fingerprints",
"based",
"on",
"doi",
":",
"http",
":",
"//",
"pubs",
".",
"acs",
".",
"org",
"/",
"doi",
"/",
"abs",
"/",
"10",
".",
"1021",
"/",
"ci500319f",
"."
] | def similarity_SPLIF(reference, query, rmsd_cutoff=1.):
"""Calculates similarity between structural interaction fingerprints,
based on doi:http://pubs.acs.org/doi/abs/10.1021/ci500319f.
Parameters
----------
reference, query: numpy.array
SPLIFs, which are compared in order to determine simi... | [
"def",
"similarity_SPLIF",
"(",
"reference",
",",
"query",
",",
"rmsd_cutoff",
"=",
"1.",
")",
":",
"# intersection of reference and query hashed atoms",
"index",
"=",
"np",
".",
"intersect1d",
"(",
"reference",
"[",
"'hash'",
"]",
",",
"query",
"[",
"'hash'",
"... | https://github.com/oddt/oddt/blob/8cf555820d97a692ade81c101ebe10e28bcb3722/oddt/fingerprints.py#L702-L766 | ||
zachwill/flask-engine | 7c8ad4bfe36382a8c9286d873ec7b785715832a4 | libs/flask/helpers.py | python | safe_join | (directory, filename) | return os.path.join(directory, filename) | Safely join `directory` and `filename`.
Example usage::
@app.route('/wiki/<path:filename>')
def wiki_page(filename):
filename = safe_join(app.config['WIKI_FOLDER'], filename)
with open(filename, 'rb') as fd:
content = fd.read() # Read and process the file co... | Safely join `directory` and `filename`. | [
"Safely",
"join",
"directory",
"and",
"filename",
"."
] | def safe_join(directory, filename):
"""Safely join `directory` and `filename`.
Example usage::
@app.route('/wiki/<path:filename>')
def wiki_page(filename):
filename = safe_join(app.config['WIKI_FOLDER'], filename)
with open(filename, 'rb') as fd:
content... | [
"def",
"safe_join",
"(",
"directory",
",",
"filename",
")",
":",
"filename",
"=",
"posixpath",
".",
"normpath",
"(",
"filename",
")",
"for",
"sep",
"in",
"_os_alt_seps",
":",
"if",
"sep",
"in",
"filename",
":",
"raise",
"NotFound",
"(",
")",
"if",
"os",
... | https://github.com/zachwill/flask-engine/blob/7c8ad4bfe36382a8c9286d873ec7b785715832a4/libs/flask/helpers.py#L607-L629 | |
a1600012888/YOPO-You-Only-Propagate-Once | b8ae668be829a0ca50647ae21676a932a9634365 | experiments/CIFAR10-TRADES/pre-res18.TRADES-YOPO-2-5/network.py | python | PreActResNet.forward | (self, x) | return x | [] | def forward(self, x):
x = self.layer_one(x)
self.layer_one_out = x
self.layer_one_out.requires_grad_()
self.layer_one_out.retain_grad()
x = self.layer_one_out
for layer in self.other_layers:
x = layer(x)
return x | [
"def",
"forward",
"(",
"self",
",",
"x",
")",
":",
"x",
"=",
"self",
".",
"layer_one",
"(",
"x",
")",
"self",
".",
"layer_one_out",
"=",
"x",
"self",
".",
"layer_one_out",
".",
"requires_grad_",
"(",
")",
"self",
".",
"layer_one_out",
".",
"retain_grad... | https://github.com/a1600012888/YOPO-You-Only-Propagate-Once/blob/b8ae668be829a0ca50647ae21676a932a9634365/experiments/CIFAR10-TRADES/pre-res18.TRADES-YOPO-2-5/network.py#L68-L79 | |||
deepmind/dm_control | 806a10e896e7c887635328bfa8352604ad0fedae | dm_control/utils/io.py | python | GetResourceFilename | (name, mode='rb') | return name | [] | def GetResourceFilename(name, mode='rb'):
del mode # Unused.
return name | [
"def",
"GetResourceFilename",
"(",
"name",
",",
"mode",
"=",
"'rb'",
")",
":",
"del",
"mode",
"# Unused.",
"return",
"name"
] | https://github.com/deepmind/dm_control/blob/806a10e896e7c887635328bfa8352604ad0fedae/dm_control/utils/io.py#L26-L28 | |||
coin-or/rbfopt | 3ba5320a23f04ac3729eff7b55527f2f1e6f9fdd | src/rbfopt/examples/rbfopt_black_box_example.py | python | RbfoptBlackBox.get_var_type | (self) | return self.var_type | Return the type of each variable.
Returns
-------
1D numpy.ndarray[char]
An array of length equal to dimension, specifying the type
of each variable. Possible types are 'R' for real
(continuous) variables, 'I' for integer (discrete)
variab... | Return the type of each variable.
Returns
-------
1D numpy.ndarray[char]
An array of length equal to dimension, specifying the type
of each variable. Possible types are 'R' for real
(continuous) variables, 'I' for integer (discrete)
variab... | [
"Return",
"the",
"type",
"of",
"each",
"variable",
".",
"Returns",
"-------",
"1D",
"numpy",
".",
"ndarray",
"[",
"char",
"]",
"An",
"array",
"of",
"length",
"equal",
"to",
"dimension",
"specifying",
"the",
"type",
"of",
"each",
"variable",
".",
"Possible"... | def get_var_type(self):
"""Return the type of each variable.
Returns
-------
1D numpy.ndarray[char]
An array of length equal to dimension, specifying the type
of each variable. Possible types are 'R' for real
(continuous) variables, 'I' for in... | [
"def",
"get_var_type",
"(",
"self",
")",
":",
"return",
"self",
".",
"var_type"
] | https://github.com/coin-or/rbfopt/blob/3ba5320a23f04ac3729eff7b55527f2f1e6f9fdd/src/rbfopt/examples/rbfopt_black_box_example.py#L123-L140 | |
SanPen/GridCal | d3f4566d2d72c11c7e910c9d162538ef0e60df31 | src/GridCal/Gui/GridEditorWidget/transformer2w_graphics.py | python | TransformerGraphicItem.__init__ | (self, fromPort: TerminalItem, toPort: TerminalItem, diagramScene, width=5,
branch: Transformer2W = None) | :param fromPort:
:param toPort:
:param diagramScene:
:param width:
:param branch: | [] | def __init__(self, fromPort: TerminalItem, toPort: TerminalItem, diagramScene, width=5,
branch: Transformer2W = None):
"""
:param fromPort:
:param toPort:
:param diagramScene:
:param width:
:param branch:
"""
QGraphicsLineItem.__init__(se... | [
"def",
"__init__",
"(",
"self",
",",
"fromPort",
":",
"TerminalItem",
",",
"toPort",
":",
"TerminalItem",
",",
"diagramScene",
",",
"width",
"=",
"5",
",",
"branch",
":",
"Transformer2W",
"=",
"None",
")",
":",
"QGraphicsLineItem",
".",
"__init__",
"(",
"s... | https://github.com/SanPen/GridCal/blob/d3f4566d2d72c11c7e910c9d162538ef0e60df31/src/GridCal/Gui/GridEditorWidget/transformer2w_graphics.py#L299-L353 | |||
nosmokingbandit/watcher | dadacd21a5790ee609058a98a17fcc8954d24439 | lib/sqlalchemy/sql/sqltypes.py | python | TIMESTAMP.__init__ | (self, timezone=False) | Construct a new :class:`.TIMESTAMP`.
:param timezone: boolean. Indicates that the TIMESTAMP type should
enable timezone support, if available on the target database.
On a per-dialect basis is similar to "TIMESTAMP WITH TIMEZONE".
If the target database does not support timezones, th... | Construct a new :class:`.TIMESTAMP`. | [
"Construct",
"a",
"new",
":",
"class",
":",
".",
"TIMESTAMP",
"."
] | def __init__(self, timezone=False):
"""Construct a new :class:`.TIMESTAMP`.
:param timezone: boolean. Indicates that the TIMESTAMP type should
enable timezone support, if available on the target database.
On a per-dialect basis is similar to "TIMESTAMP WITH TIMEZONE".
If the... | [
"def",
"__init__",
"(",
"self",
",",
"timezone",
"=",
"False",
")",
":",
"super",
"(",
"TIMESTAMP",
",",
"self",
")",
".",
"__init__",
"(",
"timezone",
"=",
"timezone",
")"
] | https://github.com/nosmokingbandit/watcher/blob/dadacd21a5790ee609058a98a17fcc8954d24439/lib/sqlalchemy/sql/sqltypes.py#L2257-L2268 | ||
home-assistant/core | 265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1 | homeassistant/components/xiaomi_miio/switch.py | python | XiaomiGenericCoordinatedSwitch.async_set_child_lock_off | (self) | return await self._try_command(
"Turning the child lock of the miio device off failed.",
self._device.set_child_lock,
False,
) | Turn the child lock off. | Turn the child lock off. | [
"Turn",
"the",
"child",
"lock",
"off",
"."
] | async def async_set_child_lock_off(self) -> bool:
"""Turn the child lock off."""
return await self._try_command(
"Turning the child lock of the miio device off failed.",
self._device.set_child_lock,
False,
) | [
"async",
"def",
"async_set_child_lock_off",
"(",
"self",
")",
"->",
"bool",
":",
"return",
"await",
"self",
".",
"_try_command",
"(",
"\"Turning the child lock of the miio device off failed.\"",
",",
"self",
".",
"_device",
".",
"set_child_lock",
",",
"False",
",",
... | https://github.com/home-assistant/core/blob/265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1/homeassistant/components/xiaomi_miio/switch.py#L522-L528 | |
PlasmaPy/PlasmaPy | 78d63e341216475ce3318e1409296480407c9019 | plasmapy/particles/particle_collections.py | python | ParticleList._get_particle_attribute | (self, attr, unit=None, default=None) | return values | Get the values of a particular attribute from all of the particles.
If a ``unit`` is provided, then this function will return a
`~astropy.units.Quantity` array with that unit. | Get the values of a particular attribute from all of the particles. | [
"Get",
"the",
"values",
"of",
"a",
"particular",
"attribute",
"from",
"all",
"of",
"the",
"particles",
"."
] | def _get_particle_attribute(self, attr, unit=None, default=None):
"""
Get the values of a particular attribute from all of the particles.
If a ``unit`` is provided, then this function will return a
`~astropy.units.Quantity` array with that unit.
"""
values = [getattr(par... | [
"def",
"_get_particle_attribute",
"(",
"self",
",",
"attr",
",",
"unit",
"=",
"None",
",",
"default",
"=",
"None",
")",
":",
"values",
"=",
"[",
"getattr",
"(",
"particle",
",",
"attr",
",",
"default",
")",
"for",
"particle",
"in",
"self",
".",
"data",... | https://github.com/PlasmaPy/PlasmaPy/blob/78d63e341216475ce3318e1409296480407c9019/plasmapy/particles/particle_collections.py#L188-L198 | |
biolab/orange2 | db40a9449cb45b507d63dcd5739b223f9cffb8e6 | Orange/utils/addons.py | python | open_archive | (path, mode="r") | return archive | Return an open archive file object (zipfile.ZipFile or tarfile.TarFile). | Return an open archive file object (zipfile.ZipFile or tarfile.TarFile). | [
"Return",
"an",
"open",
"archive",
"file",
"object",
"(",
"zipfile",
".",
"ZipFile",
"or",
"tarfile",
".",
"TarFile",
")",
"."
] | def open_archive(path, mode="r"):
"""
Return an open archive file object (zipfile.ZipFile or tarfile.TarFile).
"""
_, ext = os.path.splitext(path)
if ext == ".zip":
# TODO: should it also open .egg, ...
archive = zipfile.ZipFile(path, mode)
elif ext in (".tar", ".gz", ".bz2", ".... | [
"def",
"open_archive",
"(",
"path",
",",
"mode",
"=",
"\"r\"",
")",
":",
"_",
",",
"ext",
"=",
"os",
".",
"path",
".",
"splitext",
"(",
"path",
")",
"if",
"ext",
"==",
"\".zip\"",
":",
"# TODO: should it also open .egg, ...",
"archive",
"=",
"zipfile",
"... | https://github.com/biolab/orange2/blob/db40a9449cb45b507d63dcd5739b223f9cffb8e6/Orange/utils/addons.py#L231-L243 | |
golismero/golismero | 7d605b937e241f51c1ca4f47b20f755eeefb9d76 | tools/sqlmap/thirdparty/odict/odict.py | python | Values.__setitem__ | (self, index, value) | Set the value at position i to value.
You can only do slice assignment to values if you supply a sequence of
equal length to the slice you are replacing. | Set the value at position i to value. | [
"Set",
"the",
"value",
"at",
"position",
"i",
"to",
"value",
"."
] | def __setitem__(self, index, value):
"""
Set the value at position i to value.
You can only do slice assignment to values if you supply a sequence of
equal length to the slice you are replacing.
"""
if isinstance(index, types.SliceType):
keys = self._main._se... | [
"def",
"__setitem__",
"(",
"self",
",",
"index",
",",
"value",
")",
":",
"if",
"isinstance",
"(",
"index",
",",
"types",
".",
"SliceType",
")",
":",
"keys",
"=",
"self",
".",
"_main",
".",
"_sequence",
"[",
"index",
"]",
"if",
"len",
"(",
"keys",
"... | https://github.com/golismero/golismero/blob/7d605b937e241f51c1ca4f47b20f755eeefb9d76/tools/sqlmap/thirdparty/odict/odict.py#L1101-L1120 | ||
yuxiaokui/Intranet-Penetration | f57678a204840c83cbf3308e3470ae56c5ff514b | proxy/XX-Net/code/default/gae_proxy/server/lib/google/appengine/api/taskqueue/taskqueue.py | python | Queue.add_async | (self, task, transactional=False, rpc=None) | return self.__AddTasks(tasks,
transactional,
fill_function,
multiple,
rpc) | Asynchronously adds a Task or list of Tasks into this Queue.
This function is identical to add() except that it returns an asynchronous
object. You can call get_result() on the return value to block on the call.
Args:
task: A Task instance or a list of Task instances that will be added to
th... | Asynchronously adds a Task or list of Tasks into this Queue. | [
"Asynchronously",
"adds",
"a",
"Task",
"or",
"list",
"of",
"Tasks",
"into",
"this",
"Queue",
"."
] | def add_async(self, task, transactional=False, rpc=None):
"""Asynchronously adds a Task or list of Tasks into this Queue.
This function is identical to add() except that it returns an asynchronous
object. You can call get_result() on the return value to block on the call.
Args:
task: A Task inst... | [
"def",
"add_async",
"(",
"self",
",",
"task",
",",
"transactional",
"=",
"False",
",",
"rpc",
"=",
"None",
")",
":",
"try",
":",
"tasks",
"=",
"list",
"(",
"iter",
"(",
"task",
")",
")",
"except",
"TypeError",
":",
"tasks",
"=",
"[",
"task",
"]",
... | https://github.com/yuxiaokui/Intranet-Penetration/blob/f57678a204840c83cbf3308e3470ae56c5ff514b/proxy/XX-Net/code/default/gae_proxy/server/lib/google/appengine/api/taskqueue/taskqueue.py#L1811-L1880 | |
zvtvz/zvt | 054bf8a3e7a049df7087c324fa87e8effbaf5bdc | src/zvt/samples/stock_traders.py | python | MyBullTrader.init_selectors | (
self, entity_ids, entity_schema, exchanges, codes, start_timestamp, end_timestamp, adjust_type=None
) | [] | def init_selectors(
self, entity_ids, entity_schema, exchanges, codes, start_timestamp, end_timestamp, adjust_type=None
):
myselector = TargetSelector(
entity_ids=entity_ids,
entity_schema=entity_schema,
exchanges=exchanges,
codes=codes,
st... | [
"def",
"init_selectors",
"(",
"self",
",",
"entity_ids",
",",
"entity_schema",
",",
"exchanges",
",",
"codes",
",",
"start_timestamp",
",",
"end_timestamp",
",",
"adjust_type",
"=",
"None",
")",
":",
"myselector",
"=",
"TargetSelector",
"(",
"entity_ids",
"=",
... | https://github.com/zvtvz/zvt/blob/054bf8a3e7a049df7087c324fa87e8effbaf5bdc/src/zvt/samples/stock_traders.py#L41-L66 | ||||
makerbot/ReplicatorG | d6f2b07785a5a5f1e172fb87cb4303b17c575d5d | skein_engines/skeinforge-35/fabmetheus_utilities/euclidean.py | python | getIncrementFromRank | ( rank ) | return float( powerOfTen * moduloMultipliers[ rankModulo ] ) | Get the increment from the rank which is 0 at 1 and increases by three every power of ten. | Get the increment from the rank which is 0 at 1 and increases by three every power of ten. | [
"Get",
"the",
"increment",
"from",
"the",
"rank",
"which",
"is",
"0",
"at",
"1",
"and",
"increases",
"by",
"three",
"every",
"power",
"of",
"ten",
"."
] | def getIncrementFromRank( rank ):
'Get the increment from the rank which is 0 at 1 and increases by three every power of ten.'
rankZone = int( math.floor( rank / 3 ) )
rankModulo = rank % 3
powerOfTen = pow( 10, rankZone )
moduloMultipliers = ( 1, 2, 5 )
return float( powerOfTen * moduloMultipliers[ rankModulo ] ... | [
"def",
"getIncrementFromRank",
"(",
"rank",
")",
":",
"rankZone",
"=",
"int",
"(",
"math",
".",
"floor",
"(",
"rank",
"/",
"3",
")",
")",
"rankModulo",
"=",
"rank",
"%",
"3",
"powerOfTen",
"=",
"pow",
"(",
"10",
",",
"rankZone",
")",
"moduloMultipliers... | https://github.com/makerbot/ReplicatorG/blob/d6f2b07785a5a5f1e172fb87cb4303b17c575d5d/skein_engines/skeinforge-35/fabmetheus_utilities/euclidean.py#L901-L907 | |
openshift/openshift-tools | 1188778e728a6e4781acf728123e5b356380fe6f | ansible/roles/lib_git/library/git_commit.py | python | GitCommit.__init__ | (self,
msg,
path,
commit_files,
author=None) | Constructor for GitCommit | Constructor for GitCommit | [
"Constructor",
"for",
"GitCommit"
] | def __init__(self,
msg,
path,
commit_files,
author=None):
''' Constructor for GitCommit '''
super(GitCommit, self).__init__(path, author=author)
self.path = path
self.msg = msg
self.commit_files = commit_files
... | [
"def",
"__init__",
"(",
"self",
",",
"msg",
",",
"path",
",",
"commit_files",
",",
"author",
"=",
"None",
")",
":",
"super",
"(",
"GitCommit",
",",
"self",
")",
".",
"__init__",
"(",
"path",
",",
"author",
"=",
"author",
")",
"self",
".",
"path",
"... | https://github.com/openshift/openshift-tools/blob/1188778e728a6e4781acf728123e5b356380fe6f/ansible/roles/lib_git/library/git_commit.py#L381-L397 | ||
fossasia/open-event-legacy | 82b585d276efb894a48919bec4f3bff49077e2e8 | app/helpers/deployment/kubernetes.py | python | KubernetesApi.get | (self, endpoint, headers=None, params=None, return_json=True) | Make a GET request
:param return_json:
:param params:
:param headers:
:param endpoint:
:return: | Make a GET request
:param return_json:
:param params:
:param headers:
:param endpoint:
:return: | [
"Make",
"a",
"GET",
"request",
":",
"param",
"return_json",
":",
":",
"param",
"params",
":",
":",
"param",
"headers",
":",
":",
"param",
"endpoint",
":",
":",
"return",
":"
] | def get(self, endpoint, headers=None, params=None, return_json=True):
"""
Make a GET request
:param return_json:
:param params:
:param headers:
:param endpoint:
:return:
"""
if not headers:
headers = self.headers
response = requ... | [
"def",
"get",
"(",
"self",
",",
"endpoint",
",",
"headers",
"=",
"None",
",",
"params",
"=",
"None",
",",
"return_json",
"=",
"True",
")",
":",
"if",
"not",
"headers",
":",
"headers",
"=",
"self",
".",
"headers",
"response",
"=",
"requests",
".",
"ge... | https://github.com/fossasia/open-event-legacy/blob/82b585d276efb894a48919bec4f3bff49077e2e8/app/helpers/deployment/kubernetes.py#L18-L33 | ||
rootpy/rootpy | 3926935e1f2100d8ba68070c2ab44055d4800f73 | rootpy/extern/pyparsing.py | python | ParserElement.validate | ( self, validateTrace=[] ) | Check defined expressions for valid structure, check for infinite recursive definitions. | Check defined expressions for valid structure, check for infinite recursive definitions. | [
"Check",
"defined",
"expressions",
"for",
"valid",
"structure",
"check",
"for",
"infinite",
"recursive",
"definitions",
"."
] | def validate( self, validateTrace=[] ):
"""Check defined expressions for valid structure, check for infinite recursive definitions."""
self.checkRecursion( [] ) | [
"def",
"validate",
"(",
"self",
",",
"validateTrace",
"=",
"[",
"]",
")",
":",
"self",
".",
"checkRecursion",
"(",
"[",
"]",
")"
] | https://github.com/rootpy/rootpy/blob/3926935e1f2100d8ba68070c2ab44055d4800f73/rootpy/extern/pyparsing.py#L1489-L1491 | ||
django-extensions/django-extensions | f67ff680cd6d7264cdce05309b537ac2e1ee4a70 | django_extensions/db/fields/__init__.py | python | AutoSlugField._slug_strip | (self, value) | return re.sub(r'^%s+|%s+$' % (re_sep, re_sep), '', value) | Clean up a slug by removing slug separator characters that occur at
the beginning or end of a slug.
If an alternate separator is used, it will also replace any instances
of the default '-' separator with the new separator. | Clean up a slug by removing slug separator characters that occur at
the beginning or end of a slug. | [
"Clean",
"up",
"a",
"slug",
"by",
"removing",
"slug",
"separator",
"characters",
"that",
"occur",
"at",
"the",
"beginning",
"or",
"end",
"of",
"a",
"slug",
"."
] | def _slug_strip(self, value):
"""
Clean up a slug by removing slug separator characters that occur at
the beginning or end of a slug.
If an alternate separator is used, it will also replace any instances
of the default '-' separator with the new separator.
"""
re... | [
"def",
"_slug_strip",
"(",
"self",
",",
"value",
")",
":",
"re_sep",
"=",
"'(?:-|%s)'",
"%",
"re",
".",
"escape",
"(",
"self",
".",
"separator",
")",
"value",
"=",
"re",
".",
"sub",
"(",
"'%s+'",
"%",
"re_sep",
",",
"self",
".",
"separator",
",",
"... | https://github.com/django-extensions/django-extensions/blob/f67ff680cd6d7264cdce05309b537ac2e1ee4a70/django_extensions/db/fields/__init__.py#L177-L187 | |
getsentry/sentry | 83b1f25aac3e08075e0e2495bc29efaf35aca18a | src/sentry/integrations/slack/endpoints/base.py | python | SlackDMEndpoint.post_dispatcher | (self, request: SlackDMRequest) | return self.respond(SlackHelpMessageBuilder(unknown_command).build()) | All Slack commands are handled by this endpoint. This block just
validates the request and dispatches it to the right handler. | All Slack commands are handled by this endpoint. This block just
validates the request and dispatches it to the right handler. | [
"All",
"Slack",
"commands",
"are",
"handled",
"by",
"this",
"endpoint",
".",
"This",
"block",
"just",
"validates",
"the",
"request",
"and",
"dispatches",
"it",
"to",
"the",
"right",
"handler",
"."
] | def post_dispatcher(self, request: SlackDMRequest) -> Response:
"""
All Slack commands are handled by this endpoint. This block just
validates the request and dispatches it to the right handler.
"""
command, args = request.get_command_and_args()
if command in ["help", ""... | [
"def",
"post_dispatcher",
"(",
"self",
",",
"request",
":",
"SlackDMRequest",
")",
"->",
"Response",
":",
"command",
",",
"args",
"=",
"request",
".",
"get_command_and_args",
"(",
")",
"if",
"command",
"in",
"[",
"\"help\"",
",",
"\"\"",
"]",
":",
"return"... | https://github.com/getsentry/sentry/blob/83b1f25aac3e08075e0e2495bc29efaf35aca18a/src/sentry/integrations/slack/endpoints/base.py#L24-L51 | |
robotlearn/pyrobolearn | 9cd7c060723fda7d2779fa255ac998c2c82b8436 | pyrobolearn/utils/transformation.py | python | get_symbolic_matrix_from_quaternion | (q, convention='xyzw') | return get_matrix_from_quaternion(q, convention=convention) | Get symbolic rotation matrix from the given quaternion.
Args:
q (np.array[sympy.Symbol[4]], np.array[float[4]]): (symbolic) quaternion.
convention (str): convention to be adopted when representing the quaternion. You can choose between 'xyzw' or
'wxyz'.
Returns:
np.array[sy... | Get symbolic rotation matrix from the given quaternion. | [
"Get",
"symbolic",
"rotation",
"matrix",
"from",
"the",
"given",
"quaternion",
"."
] | def get_symbolic_matrix_from_quaternion(q, convention='xyzw'):
"""
Get symbolic rotation matrix from the given quaternion.
Args:
q (np.array[sympy.Symbol[4]], np.array[float[4]]): (symbolic) quaternion.
convention (str): convention to be adopted when representing the quaternion. You can cho... | [
"def",
"get_symbolic_matrix_from_quaternion",
"(",
"q",
",",
"convention",
"=",
"'xyzw'",
")",
":",
"return",
"get_matrix_from_quaternion",
"(",
"q",
",",
"convention",
"=",
"convention",
")"
] | https://github.com/robotlearn/pyrobolearn/blob/9cd7c060723fda7d2779fa255ac998c2c82b8436/pyrobolearn/utils/transformation.py#L520-L532 | |
googleapis/python-bigquery-sqlalchemy | a491136d94cf76128ad06635df2c0dcb2c558a40 | samples/snippets/noxfile.py | python | _determine_local_import_names | (start_dir: str) | return [
basename
for basename, extension in file_ext_pairs
if extension == ".py"
or os.path.isdir(os.path.join(start_dir, basename))
and basename not in ("__pycache__")
] | Determines all import names that should be considered "local".
This is used when running the linter to insure that import order is
properly checked. | Determines all import names that should be considered "local". | [
"Determines",
"all",
"import",
"names",
"that",
"should",
"be",
"considered",
"local",
"."
] | def _determine_local_import_names(start_dir: str) -> List[str]:
"""Determines all import names that should be considered "local".
This is used when running the linter to insure that import order is
properly checked.
"""
file_ext_pairs = [os.path.splitext(path) for path in os.listdir(start_dir)]
... | [
"def",
"_determine_local_import_names",
"(",
"start_dir",
":",
"str",
")",
"->",
"List",
"[",
"str",
"]",
":",
"file_ext_pairs",
"=",
"[",
"os",
".",
"path",
".",
"splitext",
"(",
"path",
")",
"for",
"path",
"in",
"os",
".",
"listdir",
"(",
"start_dir",
... | https://github.com/googleapis/python-bigquery-sqlalchemy/blob/a491136d94cf76128ad06635df2c0dcb2c558a40/samples/snippets/noxfile.py#L111-L124 | |
akfamily/akshare | 590e50eece9ec067da3538c7059fd660b71f1339 | akshare/futures/futures_daily_bar.py | python | get_futures_index | (df: pd.DataFrame) | return pd.concat(index_dfs, axis=1).T | 指数日交易数据, 指数合成
:param df: 爬到的原始合约日线行情
:type df: pandas.DataFrame
:return: 持仓量加权指数日线行情
:rtype: pandas.DataFrame | 指数日交易数据, 指数合成
:param df: 爬到的原始合约日线行情
:type df: pandas.DataFrame
:return: 持仓量加权指数日线行情
:rtype: pandas.DataFrame | [
"指数日交易数据",
"指数合成",
":",
"param",
"df",
":",
"爬到的原始合约日线行情",
":",
"type",
"df",
":",
"pandas",
".",
"DataFrame",
":",
"return",
":",
"持仓量加权指数日线行情",
":",
"rtype",
":",
"pandas",
".",
"DataFrame"
] | def get_futures_index(df: pd.DataFrame) -> pd.DataFrame:
"""
指数日交易数据, 指数合成
:param df: 爬到的原始合约日线行情
:type df: pandas.DataFrame
:return: 持仓量加权指数日线行情
:rtype: pandas.DataFrame
"""
index_dfs = []
for var in set(df["variety"]):
df_cut = df[df["variety"] == var]
df_cut = df_c... | [
"def",
"get_futures_index",
"(",
"df",
":",
"pd",
".",
"DataFrame",
")",
"->",
"pd",
".",
"DataFrame",
":",
"index_dfs",
"=",
"[",
"]",
"for",
"var",
"in",
"set",
"(",
"df",
"[",
"\"variety\"",
"]",
")",
":",
"df_cut",
"=",
"df",
"[",
"df",
"[",
... | https://github.com/akfamily/akshare/blob/590e50eece9ec067da3538c7059fd660b71f1339/akshare/futures/futures_daily_bar.py#L566-L600 | |
dsmrreader/dsmr-reader | c037848e0f96028fb500415b9289df40f81bc14f | dsmr_backend/management/commands/dsmr_superuser.py | python | Command.handle | (self, **options) | WARNING: Only safe for command line execution. Do NOT use for web requests! | WARNING: Only safe for command line execution. Do NOT use for web requests! | [
"WARNING",
":",
"Only",
"safe",
"for",
"command",
"line",
"execution",
".",
"Do",
"NOT",
"use",
"for",
"web",
"requests!"
] | def handle(self, **options):
""" WARNING: Only safe for command line execution. Do NOT use for web requests! """
username = config(
'DSMR_USER', # @deprecated v4.5, removed v5.0
default=config('DSMRREADER_ADMIN_USER', default=None)
)
password = config(
... | [
"def",
"handle",
"(",
"self",
",",
"*",
"*",
"options",
")",
":",
"username",
"=",
"config",
"(",
"'DSMR_USER'",
",",
"# @deprecated v4.5, removed v5.0",
"default",
"=",
"config",
"(",
"'DSMRREADER_ADMIN_USER'",
",",
"default",
"=",
"None",
")",
")",
"password... | https://github.com/dsmrreader/dsmr-reader/blob/c037848e0f96028fb500415b9289df40f81bc14f/dsmr_backend/management/commands/dsmr_superuser.py#L9-L47 | ||
etetoolkit/ete | 2b207357dc2a40ccad7bfd8f54964472c72e4726 | ete3/phyloxml/_phyloxml.py | python | Clade.set_name | (self, name) | [] | def set_name(self, name): self.name = name | [
"def",
"set_name",
"(",
"self",
",",
"name",
")",
":",
"self",
".",
"name",
"=",
"name"
] | https://github.com/etetoolkit/ete/blob/2b207357dc2a40ccad7bfd8f54964472c72e4726/ete3/phyloxml/_phyloxml.py#L847-L847 | ||||
chapmanb/bcbb | dbfb52711f0bfcc1d26c5a5b53c9ff4f50dc0027 | nextgen/scripts/bcbio_nextgen_install.py | python | install_bcbio_nextgen | (requirements, datadir, tooldir, use_sudo) | Install a virtualenv containing bcbio_nextgen depdencies. | Install a virtualenv containing bcbio_nextgen depdencies. | [
"Install",
"a",
"virtualenv",
"containing",
"bcbio_nextgen",
"depdencies",
"."
] | def install_bcbio_nextgen(requirements, datadir, tooldir, use_sudo):
"""Install a virtualenv containing bcbio_nextgen depdencies.
"""
virtualenv_dir = os.path.join(datadir, "bcbio-nextgen-virtualenv")
if not os.path.exists(virtualenv_dir):
subprocess.check_call(["virtualenv", "--no-site-packages... | [
"def",
"install_bcbio_nextgen",
"(",
"requirements",
",",
"datadir",
",",
"tooldir",
",",
"use_sudo",
")",
":",
"virtualenv_dir",
"=",
"os",
".",
"path",
".",
"join",
"(",
"datadir",
",",
"\"bcbio-nextgen-virtualenv\"",
")",
"if",
"not",
"os",
".",
"path",
"... | https://github.com/chapmanb/bcbb/blob/dbfb52711f0bfcc1d26c5a5b53c9ff4f50dc0027/nextgen/scripts/bcbio_nextgen_install.py#L51-L66 | ||
Source-Python-Dev-Team/Source.Python | d0ffd8ccbd1e9923c9bc44936f20613c1c76b7fb | addons/source-python/packages/site-packages/sqlalchemy/sql/visitors.py | python | ReplacingCloningVisitor.traverse | (self, obj) | return replacement_traverse(obj, self.__traverse_options__, replace) | traverse and visit the given expression structure. | traverse and visit the given expression structure. | [
"traverse",
"and",
"visit",
"the",
"given",
"expression",
"structure",
"."
] | def traverse(self, obj):
"""traverse and visit the given expression structure."""
def replace(elem):
for v in self._visitor_iterator:
e = v.replace(elem)
if e is not None:
return e
return replacement_traverse(obj, self.__traverse_o... | [
"def",
"traverse",
"(",
"self",
",",
"obj",
")",
":",
"def",
"replace",
"(",
"elem",
")",
":",
"for",
"v",
"in",
"self",
".",
"_visitor_iterator",
":",
"e",
"=",
"v",
".",
"replace",
"(",
"elem",
")",
"if",
"e",
"is",
"not",
"None",
":",
"return"... | https://github.com/Source-Python-Dev-Team/Source.Python/blob/d0ffd8ccbd1e9923c9bc44936f20613c1c76b7fb/addons/source-python/packages/site-packages/sqlalchemy/sql/visitors.py#L199-L207 | |
brosner/everyblock_code | 25397148223dad81e7fbb9c7cf2f169162df4681 | ebgeo/ebgeo/utils/feature_reducer.py | python | Reducer.__init__ | (self, key_fields) | ``key_fields`` is a sequence consisting either or both of strings,
which are names of the source datasource's fields, or 2-tuples,
which consist of a field name for the destination datasource and a
callable which takes a feature and a layer and returns the value
of the field. | ``key_fields`` is a sequence consisting either or both of strings,
which are names of the source datasource's fields, or 2-tuples,
which consist of a field name for the destination datasource and a
callable which takes a feature and a layer and returns the value
of the field. | [
"key_fields",
"is",
"a",
"sequence",
"consisting",
"either",
"or",
"both",
"of",
"strings",
"which",
"are",
"names",
"of",
"the",
"source",
"datasource",
"s",
"fields",
"or",
"2",
"-",
"tuples",
"which",
"consist",
"of",
"a",
"field",
"name",
"for",
"the",... | def __init__(self, key_fields):
"""
``key_fields`` is a sequence consisting either or both of strings,
which are names of the source datasource's fields, or 2-tuples,
which consist of a field name for the destination datasource and a
callable which takes a feature and a layer and... | [
"def",
"__init__",
"(",
"self",
",",
"key_fields",
")",
":",
"self",
".",
"key_fields",
"=",
"key_fields",
"# Create a list of destination field names; order is imporant",
"# and the list comes in handy for creating the destinations'",
"# fields.",
"self",
".",
"key_fieldnames",
... | https://github.com/brosner/everyblock_code/blob/25397148223dad81e7fbb9c7cf2f169162df4681/ebgeo/ebgeo/utils/feature_reducer.py#L12-L28 | ||
inkandswitch/livebook | 93c8d467734787366ad084fc3566bf5cbe249c51 | public/pypyjs/modules/numpy/polynomial/legendre.py | python | legpow | (c, pow, maxpower=16) | Raise a Legendre series to a power.
Returns the Legendre series `c` raised to the power `pow`. The
arguement `c` is a sequence of coefficients ordered from low to high.
i.e., [1,2,3] is the series ``P_0 + 2*P_1 + 3*P_2.``
Parameters
----------
c : array_like
1-D array of Legendre seri... | Raise a Legendre series to a power. | [
"Raise",
"a",
"Legendre",
"series",
"to",
"a",
"power",
"."
] | def legpow(c, pow, maxpower=16):
"""Raise a Legendre series to a power.
Returns the Legendre series `c` raised to the power `pow`. The
arguement `c` is a sequence of coefficients ordered from low to high.
i.e., [1,2,3] is the series ``P_0 + 2*P_1 + 3*P_2.``
Parameters
----------
c : array... | [
"def",
"legpow",
"(",
"c",
",",
"pow",
",",
"maxpower",
"=",
"16",
")",
":",
"# c is a trimmed copy",
"[",
"c",
"]",
"=",
"pu",
".",
"as_series",
"(",
"[",
"c",
"]",
")",
"power",
"=",
"int",
"(",
"pow",
")",
"if",
"power",
"!=",
"pow",
"or",
"... | https://github.com/inkandswitch/livebook/blob/93c8d467734787366ad084fc3566bf5cbe249c51/public/pypyjs/modules/numpy/polynomial/legendre.py#L617-L665 | ||
meraki/dashboard-api-python | aef5e6fe5d23a40d435d5c64ff30580a28af07f1 | meraki/aio/api/sm.py | python | AsyncSm.createNetworkSmTargetGroup | (self, networkId: str, **kwargs) | return self._session.post(metadata, resource, payload) | **Add a target group**
https://developer.cisco.com/meraki/api-v1/#!create-network-sm-target-group
- networkId (string): (required)
- name (string): The name of this target group
- scope (string): The scope and tag options of the target group. Comma separated values beginning with one of... | **Add a target group**
https://developer.cisco.com/meraki/api-v1/#!create-network-sm-target-group | [
"**",
"Add",
"a",
"target",
"group",
"**",
"https",
":",
"//",
"developer",
".",
"cisco",
".",
"com",
"/",
"meraki",
"/",
"api",
"-",
"v1",
"/",
"#!create",
"-",
"network",
"-",
"sm",
"-",
"target",
"-",
"group"
] | def createNetworkSmTargetGroup(self, networkId: str, **kwargs):
"""
**Add a target group**
https://developer.cisco.com/meraki/api-v1/#!create-network-sm-target-group
- networkId (string): (required)
- name (string): The name of this target group
- scope (string): The sco... | [
"def",
"createNetworkSmTargetGroup",
"(",
"self",
",",
"networkId",
":",
"str",
",",
"*",
"*",
"kwargs",
")",
":",
"kwargs",
".",
"update",
"(",
"locals",
"(",
")",
")",
"metadata",
"=",
"{",
"'tags'",
":",
"[",
"'sm'",
",",
"'configure'",
",",
"'targe... | https://github.com/meraki/dashboard-api-python/blob/aef5e6fe5d23a40d435d5c64ff30580a28af07f1/meraki/aio/api/sm.py#L610-L631 | |
ajinabraham/OWASP-Xenotix-XSS-Exploit-Framework | cb692f527e4e819b6c228187c5702d990a180043 | external/Scripting Engine/Xenotix Python Scripting Engine/bin/x86/Debug/Lib/pipes.py | python | Template.prepend | (self, cmd, kind) | t.prepend(cmd, kind) adds a new step at the front. | t.prepend(cmd, kind) adds a new step at the front. | [
"t",
".",
"prepend",
"(",
"cmd",
"kind",
")",
"adds",
"a",
"new",
"step",
"at",
"the",
"front",
"."
] | def prepend(self, cmd, kind):
"""t.prepend(cmd, kind) adds a new step at the front."""
if type(cmd) is not type(''):
raise TypeError, \
'Template.prepend: cmd must be a string'
if kind not in stepkinds:
raise ValueError, \
'Template.pre... | [
"def",
"prepend",
"(",
"self",
",",
"cmd",
",",
"kind",
")",
":",
"if",
"type",
"(",
"cmd",
")",
"is",
"not",
"type",
"(",
"''",
")",
":",
"raise",
"TypeError",
",",
"'Template.prepend: cmd must be a string'",
"if",
"kind",
"not",
"in",
"stepkinds",
":",... | https://github.com/ajinabraham/OWASP-Xenotix-XSS-Exploit-Framework/blob/cb692f527e4e819b6c228187c5702d990a180043/external/Scripting Engine/Xenotix Python Scripting Engine/bin/x86/Debug/Lib/pipes.py#L132-L152 | ||
rytilahti/python-miio | b6e53dd16fac77915426e7592e2528b78ef65190 | miio/integrations/vacuum/roborock/vacuum.py | python | RoborockVacuum.stop | (self) | return self.send("app_stop") | Stop cleaning.
Note, prefer 'pause' instead of this for wider support. Some newer vacuum models
do not support this command. | Stop cleaning. | [
"Stop",
"cleaning",
"."
] | def stop(self):
"""Stop cleaning.
Note, prefer 'pause' instead of this for wider support. Some newer vacuum models
do not support this command.
"""
return self.send("app_stop") | [
"def",
"stop",
"(",
"self",
")",
":",
"return",
"self",
".",
"send",
"(",
"\"app_stop\"",
")"
] | https://github.com/rytilahti/python-miio/blob/b6e53dd16fac77915426e7592e2528b78ef65190/miio/integrations/vacuum/roborock/vacuum.py#L190-L196 | |
qmlcode/qml | 8bb833cdbbe69405384d6796920c5418dc53b6ba | qml/arad.py | python | get_local_symmetric_kernels_arad | (X1, sigmas,
width=0.2, cut_distance=5.0, r_width=1.0, c_width=0.5) | return fget_local_symmetric_kernels_arad(X1, Z1_arad, N1, sigmas,
nm1, nsigmas, width, cut_distance, r_width, c_width) | Calculates the Gaussian kernel matrix K for atomic ARAD
descriptors for a list of different sigmas. Each kernel element
is the sum of all kernel elements between pairs of atoms in two molecules.
K is calculated using an OpenMP parallel Fortran routine.
:param X1: ARAD descriptors for m... | Calculates the Gaussian kernel matrix K for atomic ARAD
descriptors for a list of different sigmas. Each kernel element
is the sum of all kernel elements between pairs of atoms in two molecules. | [
"Calculates",
"the",
"Gaussian",
"kernel",
"matrix",
"K",
"for",
"atomic",
"ARAD",
"descriptors",
"for",
"a",
"list",
"of",
"different",
"sigmas",
".",
"Each",
"kernel",
"element",
"is",
"the",
"sum",
"of",
"all",
"kernel",
"elements",
"between",
"pairs",
"o... | def get_local_symmetric_kernels_arad(X1, sigmas,
width=0.2, cut_distance=5.0, r_width=1.0, c_width=0.5):
""" Calculates the Gaussian kernel matrix K for atomic ARAD
descriptors for a list of different sigmas. Each kernel element
is the sum of all kernel elements between pairs of atoms in two mo... | [
"def",
"get_local_symmetric_kernels_arad",
"(",
"X1",
",",
"sigmas",
",",
"width",
"=",
"0.2",
",",
"cut_distance",
"=",
"5.0",
",",
"r_width",
"=",
"1.0",
",",
"c_width",
"=",
"0.5",
")",
":",
"nm1",
"=",
"X1",
".",
"shape",
"[",
"0",
"]",
"amax",
"... | https://github.com/qmlcode/qml/blob/8bb833cdbbe69405384d6796920c5418dc53b6ba/qml/arad.py#L264-L294 | |
auDeep/auDeep | 07df37b4fde5b10cd96a0c94d8804a1612c10d6f | audeep/backend/data/data_set.py | python | _Instance.__str__ | (self) | return self._data[dict(instance=self._instance)].__str__() | Returns a string representation of this instance.
Returns
-------
str
A string representation of this instance | Returns a string representation of this instance.
Returns
-------
str
A string representation of this instance | [
"Returns",
"a",
"string",
"representation",
"of",
"this",
"instance",
".",
"Returns",
"-------",
"str",
"A",
"string",
"representation",
"of",
"this",
"instance"
] | def __str__(self) -> str:
"""
Returns a string representation of this instance.
Returns
-------
str
A string representation of this instance
"""
return self._data[dict(instance=self._instance)].__str__() | [
"def",
"__str__",
"(",
"self",
")",
"->",
"str",
":",
"return",
"self",
".",
"_data",
"[",
"dict",
"(",
"instance",
"=",
"self",
".",
"_instance",
")",
"]",
".",
"__str__",
"(",
")"
] | https://github.com/auDeep/auDeep/blob/07df37b4fde5b10cd96a0c94d8804a1612c10d6f/audeep/backend/data/data_set.py#L483-L492 | |
marshmallow-code/django-rest-marshmallow | 117f89bd5f06de6049dd51d4705d0ccafcc351d7 | rest_marshmallow/__init__.py | python | Schema.data | (self) | return self._serializer_data | [] | def data(self):
# We're overriding the default implementation here, because the
# '_data' property clashes with marshmallow's implementation.
if hasattr(self, 'initial_data') and not hasattr(self, '_validated_data'):
msg = (
'When a serializer is passed a `data` keywo... | [
"def",
"data",
"(",
"self",
")",
":",
"# We're overriding the default implementation here, because the",
"# '_data' property clashes with marshmallow's implementation.",
"if",
"hasattr",
"(",
"self",
",",
"'initial_data'",
")",
"and",
"not",
"hasattr",
"(",
"self",
",",
"'_... | https://github.com/marshmallow-code/django-rest-marshmallow/blob/117f89bd5f06de6049dd51d4705d0ccafcc351d7/rest_marshmallow/__init__.py#L58-L78 | |||
AppScale/gts | 46f909cf5dc5ba81faf9d81dc9af598dcf8a82a9 | AppServer/google/appengine/api/prospective_search/prospective_search_stub.py | python | ProspectiveSearchStub._WalkQueryTree | (self, query_node, doc, query_field=None, level=0) | return False | Recursive match of doc from query tree at the given node. | Recursive match of doc from query tree at the given node. | [
"Recursive",
"match",
"of",
"doc",
"from",
"query",
"tree",
"at",
"the",
"given",
"node",
"."
] | def _WalkQueryTree(self, query_node, doc, query_field=None, level=0):
"""Recursive match of doc from query tree at the given node."""
query_type = query_node.getType()
query_text = query_node.getText()
self._Debug('_WalkQueryTree: query type: %r, field: %r, text: %r'
% (query_type, quer... | [
"def",
"_WalkQueryTree",
"(",
"self",
",",
"query_node",
",",
"doc",
",",
"query_field",
"=",
"None",
",",
"level",
"=",
"0",
")",
":",
"query_type",
"=",
"query_node",
".",
"getType",
"(",
")",
"query_text",
"=",
"query_node",
".",
"getText",
"(",
")",
... | https://github.com/AppScale/gts/blob/46f909cf5dc5ba81faf9d81dc9af598dcf8a82a9/AppServer/google/appengine/api/prospective_search/prospective_search_stub.py#L295-L363 | |
kanzure/nanoengineer | 874e4c9f8a9190f093625b267f9767e19f82e6c4 | cad/src/dna/commands/DnaSegment/DnaSegment_PropertyManager.py | python | DnaSegment_PropertyManager.close | (self) | Close this property manager.
Also sets the name of the self.command's structure to the one
displayed in the line edit field.
@see self.show()
@see: DnaSegment_EditCommand.setStructureName | Close this property manager.
Also sets the name of the self.command's structure to the one
displayed in the line edit field. | [
"Close",
"this",
"property",
"manager",
".",
"Also",
"sets",
"the",
"name",
"of",
"the",
"self",
".",
"command",
"s",
"structure",
"to",
"the",
"one",
"displayed",
"in",
"the",
"line",
"edit",
"field",
"."
] | def close(self):
"""
Close this property manager.
Also sets the name of the self.command's structure to the one
displayed in the line edit field.
@see self.show()
@see: DnaSegment_EditCommand.setStructureName
"""
if self.command is not None:
na... | [
"def",
"close",
"(",
"self",
")",
":",
"if",
"self",
".",
"command",
"is",
"not",
"None",
":",
"name",
"=",
"str",
"(",
"self",
".",
"nameLineEdit",
".",
"text",
"(",
")",
")",
"self",
".",
"command",
".",
"setStructureName",
"(",
"name",
")",
"_su... | https://github.com/kanzure/nanoengineer/blob/874e4c9f8a9190f093625b267f9767e19f82e6c4/cad/src/dna/commands/DnaSegment/DnaSegment_PropertyManager.py#L182-L193 | ||
IJDykeman/wangTiles | 7c1ee2095ebdf7f72bce07d94c6484915d5cae8b | experimental_code/tiles_3d/venv_mac_py3/lib/python2.7/site-packages/pkg_resources/_vendor/pyparsing.py | python | ParserElement.searchString | ( self, instring, maxMatches=_MAX_INT ) | Another extension to C{L{scanString}}, simplifying the access to the tokens found
to match the given parse expression. May be called with optional
C{maxMatches} argument, to clip searching after 'n' matches are found.
Example::
# a capitalized word starts with an uppercase ... | Another extension to C{L{scanString}}, simplifying the access to the tokens found
to match the given parse expression. May be called with optional
C{maxMatches} argument, to clip searching after 'n' matches are found.
Example::
# a capitalized word starts with an uppercase ... | [
"Another",
"extension",
"to",
"C",
"{",
"L",
"{",
"scanString",
"}}",
"simplifying",
"the",
"access",
"to",
"the",
"tokens",
"found",
"to",
"match",
"the",
"given",
"parse",
"expression",
".",
"May",
"be",
"called",
"with",
"optional",
"C",
"{",
"maxMatche... | def searchString( self, instring, maxMatches=_MAX_INT ):
"""
Another extension to C{L{scanString}}, simplifying the access to the tokens found
to match the given parse expression. May be called with optional
C{maxMatches} argument, to clip searching after 'n' matches are found.
... | [
"def",
"searchString",
"(",
"self",
",",
"instring",
",",
"maxMatches",
"=",
"_MAX_INT",
")",
":",
"try",
":",
"return",
"ParseResults",
"(",
"[",
"t",
"for",
"t",
",",
"s",
",",
"e",
"in",
"self",
".",
"scanString",
"(",
"instring",
",",
"maxMatches",... | https://github.com/IJDykeman/wangTiles/blob/7c1ee2095ebdf7f72bce07d94c6484915d5cae8b/experimental_code/tiles_3d/venv_mac_py3/lib/python2.7/site-packages/pkg_resources/_vendor/pyparsing.py#L1772-L1797 | ||
AppScale/gts | 46f909cf5dc5ba81faf9d81dc9af598dcf8a82a9 | AppDB/appscale/datastore/scripts/datastore.py | python | MainHandler.set_default_headers | (self) | Instructs clients to close the connection after each response. | Instructs clients to close the connection after each response. | [
"Instructs",
"clients",
"to",
"close",
"the",
"connection",
"after",
"each",
"response",
"."
] | def set_default_headers(self):
""" Instructs clients to close the connection after each response. """
self.set_header('Connection', 'close') | [
"def",
"set_default_headers",
"(",
"self",
")",
":",
"self",
".",
"set_header",
"(",
"'Connection'",
",",
"'close'",
")"
] | https://github.com/AppScale/gts/blob/46f909cf5dc5ba81faf9d81dc9af598dcf8a82a9/AppDB/appscale/datastore/scripts/datastore.py#L150-L152 | ||
tensorflow/lattice | 784eca50cbdfedf39f183cc7d298c9fe376b69c0 | tensorflow_lattice/python/pwl_calibration_sonnet_module.py | python | PWLCalibration.__init__ | (self,
input_keypoints,
units=1,
output_min=None,
output_max=None,
clamp_min=False,
clamp_max=False,
monotonicity="none",
convexity="none",
is_cyclic=False,
kernel_init="... | Initializes an instance of `PWLCalibration`.
Args:
input_keypoints: Ordered list of keypoints of piecewise linear function.
Can be anything accepted by tf.convert_to_tensor().
units: Output dimension of the layer. See class comments for details.
output_min: Minimum output of calibrator.
... | Initializes an instance of `PWLCalibration`. | [
"Initializes",
"an",
"instance",
"of",
"PWLCalibration",
"."
] | def __init__(self,
input_keypoints,
units=1,
output_min=None,
output_max=None,
clamp_min=False,
clamp_max=False,
monotonicity="none",
convexity="none",
is_cyclic=False,
k... | [
"def",
"__init__",
"(",
"self",
",",
"input_keypoints",
",",
"units",
"=",
"1",
",",
"output_min",
"=",
"None",
",",
"output_max",
"=",
"None",
",",
"clamp_min",
"=",
"False",
",",
"clamp_max",
"=",
"False",
",",
"monotonicity",
"=",
"\"none\"",
",",
"co... | https://github.com/tensorflow/lattice/blob/784eca50cbdfedf39f183cc7d298c9fe376b69c0/tensorflow_lattice/python/pwl_calibration_sonnet_module.py#L88-L214 | ||
googlearchive/simian | fb9c43946ff7ba29be417068d6447cfc0adfe9ef | src/simian/mac/models/settings.py | python | Settings.SetItem | (cls, name, value) | Set an item into settings.
If the item belongs in a serialized container it will be serialized
before storage.
Args:
name: str, like 'ca_public_cert_pem'
value: str, value | Set an item into settings. | [
"Set",
"an",
"item",
"into",
"settings",
"."
] | def SetItem(cls, name, value):
"""Set an item into settings.
If the item belongs in a serialized container it will be serialized
before storage.
Args:
name: str, like 'ca_public_cert_pem'
value: str, value
"""
if Settings.GetType(name) in ['pem', 'string', 'random_str']:
retu... | [
"def",
"SetItem",
"(",
"cls",
",",
"name",
",",
"value",
")",
":",
"if",
"Settings",
".",
"GetType",
"(",
"name",
")",
"in",
"[",
"'pem'",
",",
"'string'",
",",
"'random_str'",
"]",
":",
"return",
"super",
"(",
"Settings",
",",
"cls",
")",
".",
"Se... | https://github.com/googlearchive/simian/blob/fb9c43946ff7ba29be417068d6447cfc0adfe9ef/src/simian/mac/models/settings.py#L301-L314 | ||
wistbean/fxxkpython | 88e16d79d8dd37236ba6ecd0d0ff11d63143968c | vip/qyxuan/projects/Snake/venv/lib/python3.6/site-packages/pip-19.0.3-py3.6.egg/pip/_vendor/distlib/util.py | python | FileOperator.newer | (self, source, target) | return os.stat(source).st_mtime > os.stat(target).st_mtime | Tell if the target is newer than the source.
Returns true if 'source' exists and is more recently modified than
'target', or if 'source' exists and 'target' doesn't.
Returns false if both exist and 'target' is the same age or younger
than 'source'. Raise PackagingFileError if 'source' ... | Tell if the target is newer than the source. | [
"Tell",
"if",
"the",
"target",
"is",
"newer",
"than",
"the",
"source",
"."
] | def newer(self, source, target):
"""Tell if the target is newer than the source.
Returns true if 'source' exists and is more recently modified than
'target', or if 'source' exists and 'target' doesn't.
Returns false if both exist and 'target' is the same age or younger
than 'so... | [
"def",
"newer",
"(",
"self",
",",
"source",
",",
"target",
")",
":",
"if",
"not",
"os",
".",
"path",
".",
"exists",
"(",
"source",
")",
":",
"raise",
"DistlibException",
"(",
"\"file '%r' does not exist\"",
"%",
"os",
".",
"path",
".",
"abspath",
"(",
... | https://github.com/wistbean/fxxkpython/blob/88e16d79d8dd37236ba6ecd0d0ff11d63143968c/vip/qyxuan/projects/Snake/venv/lib/python3.6/site-packages/pip-19.0.3-py3.6.egg/pip/_vendor/distlib/util.py#L493-L511 | |
openstack/python-novaclient | 63d368168c87bc0b9a9b7928b42553c609e46089 | novaclient/utils.py | python | flatten_dict | (data) | return dict(_flatten(data)) | Return a new dict whose sub-dicts have been merged into the
original. Each of the parents keys are prepended to the child's
to prevent collisions. Any string elements will be JSON parsed
before flattening.
>>> flatten_dict({'service': {'host':'cloud9@compute-068', 'id': 143}})
{'service_host': co... | Return a new dict whose sub-dicts have been merged into the
original. Each of the parents keys are prepended to the child's
to prevent collisions. Any string elements will be JSON parsed
before flattening. | [
"Return",
"a",
"new",
"dict",
"whose",
"sub",
"-",
"dicts",
"have",
"been",
"merged",
"into",
"the",
"original",
".",
"Each",
"of",
"the",
"parents",
"keys",
"are",
"prepended",
"to",
"the",
"child",
"s",
"to",
"prevent",
"collisions",
".",
"Any",
"strin... | def flatten_dict(data):
"""Return a new dict whose sub-dicts have been merged into the
original. Each of the parents keys are prepended to the child's
to prevent collisions. Any string elements will be JSON parsed
before flattening.
>>> flatten_dict({'service': {'host':'cloud9@compute-068', 'id':... | [
"def",
"flatten_dict",
"(",
"data",
")",
":",
"data",
"=",
"data",
".",
"copy",
"(",
")",
"# Try and decode any nested JSON structures.",
"for",
"key",
",",
"value",
"in",
"data",
".",
"items",
"(",
")",
":",
"if",
"isinstance",
"(",
"value",
",",
"str",
... | https://github.com/openstack/python-novaclient/blob/63d368168c87bc0b9a9b7928b42553c609e46089/novaclient/utils.py#L184-L203 | |
TencentCloud/tencentcloud-sdk-python | 3677fd1cdc8c5fd626ce001c13fd3b59d1f279d2 | tencentcloud/wss/v20180426/models.py | python | DeleteCertResponse.__init__ | (self) | r"""
:param RequestId: 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
:type RequestId: str | r"""
:param RequestId: 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
:type RequestId: str | [
"r",
":",
"param",
"RequestId",
":",
"唯一请求",
"ID,每次请求都会返回。定位问题时需要提供该次请求的",
"RequestId。",
":",
"type",
"RequestId",
":",
"str"
] | def __init__(self):
r"""
:param RequestId: 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
:type RequestId: str
"""
self.RequestId = None | [
"def",
"__init__",
"(",
"self",
")",
":",
"self",
".",
"RequestId",
"=",
"None"
] | https://github.com/TencentCloud/tencentcloud-sdk-python/blob/3677fd1cdc8c5fd626ce001c13fd3b59d1f279d2/tencentcloud/wss/v20180426/models.py#L54-L59 | ||
m-labs/artiq | eaa1505c947c7987cdbd31c24056823c740e84e0 | artiq/coredevice/ad9910.py | python | AD9910.measure_io_update_alignment | (self, delay_start: TInt64,
delay_stop: TInt64) | return ftw & 1 | Use the digital ramp generator to locate the alignment between
IO_UPDATE and SYNC_CLK.
The ramp generator is set up to a linear frequency ramp
(dFTW/t_SYNC_CLK=1) and started at a coarse RTIO time stamp plus
`delay_start` and stopped at a coarse RTIO time stamp plus
`delay_stop`... | Use the digital ramp generator to locate the alignment between
IO_UPDATE and SYNC_CLK. | [
"Use",
"the",
"digital",
"ramp",
"generator",
"to",
"locate",
"the",
"alignment",
"between",
"IO_UPDATE",
"and",
"SYNC_CLK",
"."
] | def measure_io_update_alignment(self, delay_start: TInt64,
delay_stop: TInt64) -> TInt32:
"""Use the digital ramp generator to locate the alignment between
IO_UPDATE and SYNC_CLK.
The ramp generator is set up to a linear frequency ramp
(dFTW/t_SYNC_CL... | [
"def",
"measure_io_update_alignment",
"(",
"self",
",",
"delay_start",
":",
"TInt64",
",",
"delay_stop",
":",
"TInt64",
")",
"->",
"TInt32",
":",
"# set up DRG",
"self",
".",
"set_cfr1",
"(",
"drg_load_lrr",
"=",
"1",
",",
"drg_autoclear",
"=",
"1",
")",
"# ... | https://github.com/m-labs/artiq/blob/eaa1505c947c7987cdbd31c24056823c740e84e0/artiq/coredevice/ad9910.py#L1032-L1072 | |
BotBotMe/botbot-web | 0ada6213b5f1d8bb0f71eb79aaf37704f4903564 | botbot/apps/plugins/runner.py | python | PluginRunner.check_for_plugin_route_matches | (self, line, router) | Checks the active plugins' routes and calls functions on matches | Checks the active plugins' routes and calls functions on matches | [
"Checks",
"the",
"active",
"plugins",
"routes",
"and",
"calls",
"functions",
"on",
"matches"
] | def check_for_plugin_route_matches(self, line, router):
"""Checks the active plugins' routes and calls functions on matches"""
# get the active routes for this channel
active_slugs = line._active_plugin_slugs.intersection(router.viewkeys())
for plugin_slug in active_slugs:
fo... | [
"def",
"check_for_plugin_route_matches",
"(",
"self",
",",
"line",
",",
"router",
")",
":",
"# get the active routes for this channel",
"active_slugs",
"=",
"line",
".",
"_active_plugin_slugs",
".",
"intersection",
"(",
"router",
".",
"viewkeys",
"(",
")",
")",
"for... | https://github.com/BotBotMe/botbot-web/blob/0ada6213b5f1d8bb0f71eb79aaf37704f4903564/botbot/apps/plugins/runner.py#L263-L288 | ||
readbeyond/aeneas | 4d200a050690903b30b3d885b44714fecb23f18a | aeneas/adjustboundaryalgorithm.py | python | AdjustBoundaryAlgorithm._process_zero_length | (self, nozero, allow_arbitrary_shift) | If ``nozero`` is ``True``, modify the sync map fragment list
so that no fragment will have zero length. | If ``nozero`` is ``True``, modify the sync map fragment list
so that no fragment will have zero length. | [
"If",
"nozero",
"is",
"True",
"modify",
"the",
"sync",
"map",
"fragment",
"list",
"so",
"that",
"no",
"fragment",
"will",
"have",
"zero",
"length",
"."
] | def _process_zero_length(self, nozero, allow_arbitrary_shift):
"""
If ``nozero`` is ``True``, modify the sync map fragment list
so that no fragment will have zero length.
"""
self.log(u"Called _process_zero_length")
if not nozero:
self.log(u"Processing zero le... | [
"def",
"_process_zero_length",
"(",
"self",
",",
"nozero",
",",
"allow_arbitrary_shift",
")",
":",
"self",
".",
"log",
"(",
"u\"Called _process_zero_length\"",
")",
"if",
"not",
"nozero",
":",
"self",
".",
"log",
"(",
"u\"Processing zero length intervals not requested... | https://github.com/readbeyond/aeneas/blob/4d200a050690903b30b3d885b44714fecb23f18a/aeneas/adjustboundaryalgorithm.py#L407-L435 | ||
gem/oq-engine | 1bdb88f3914e390abcbd285600bfd39477aae47c | openquake/hazardlib/gsim/yenier_atkinson_2015.py | python | _get_f_z | (C, imt, rrup, m) | return np.log(z) + (C['b3'] + C['b4']*m)*np.log(ratio_b) | Implements eq. 7 and eq. 8 at page 1991 | Implements eq. 7 and eq. 8 at page 1991 | [
"Implements",
"eq",
".",
"7",
"and",
"eq",
".",
"8",
"at",
"page",
"1991"
] | def _get_f_z(C, imt, rrup, m):
"""
Implements eq. 7 and eq. 8 at page 1991
"""
# Pseudo depth - see eq. 6 at page 1991
pseudo_depth = 10**(-0.405+0.235*m)
# Effective distance - see eq. 5 at page 1991
reff = (rrup**2+pseudo_depth**2)**0.5
# The transition_distance is 50 km as defined jus... | [
"def",
"_get_f_z",
"(",
"C",
",",
"imt",
",",
"rrup",
",",
"m",
")",
":",
"# Pseudo depth - see eq. 6 at page 1991",
"pseudo_depth",
"=",
"10",
"**",
"(",
"-",
"0.405",
"+",
"0.235",
"*",
"m",
")",
"# Effective distance - see eq. 5 at page 1991",
"reff",
"=",
... | https://github.com/gem/oq-engine/blob/1bdb88f3914e390abcbd285600bfd39477aae47c/openquake/hazardlib/gsim/yenier_atkinson_2015.py#L155-L175 | |
zhl2008/awd-platform | 0416b31abea29743387b10b3914581fbe8e7da5e | web_flaskbb/Python-2.7.9/Lib/pickle.py | python | Unpickler.load_long | (self) | [] | def load_long(self):
self.append(long(self.readline()[:-1], 0)) | [
"def",
"load_long",
"(",
"self",
")",
":",
"self",
".",
"append",
"(",
"long",
"(",
"self",
".",
"readline",
"(",
")",
"[",
":",
"-",
"1",
"]",
",",
"0",
")",
")"
] | https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_flaskbb/Python-2.7.9/Lib/pickle.py#L937-L938 | ||||
mit-han-lab/lite-transformer | 1df8001c779deb85819fc30d70349cc334c408ba | fairseq/trainer.py | python | Trainer.dummy_train_step | (self, dummy_batch) | Dummy training step for warming caching allocator. | Dummy training step for warming caching allocator. | [
"Dummy",
"training",
"step",
"for",
"warming",
"caching",
"allocator",
"."
] | def dummy_train_step(self, dummy_batch):
"""Dummy training step for warming caching allocator."""
self.train_step(dummy_batch, dummy_batch=True)
self.zero_grad() | [
"def",
"dummy_train_step",
"(",
"self",
",",
"dummy_batch",
")",
":",
"self",
".",
"train_step",
"(",
"dummy_batch",
",",
"dummy_batch",
"=",
"True",
")",
"self",
".",
"zero_grad",
"(",
")"
] | https://github.com/mit-han-lab/lite-transformer/blob/1df8001c779deb85819fc30d70349cc334c408ba/fairseq/trainer.py#L527-L530 | ||
quantumlib/Cirq | 89f88b01d69222d3f1ec14d649b7b3a85ed9211f | cirq-google/cirq_google/api/v1/params.py | python | _to_zip_product | (sweep: cirq.Sweep) | return sweep | Converts sweep to a product of zips of single sweeps, if possible. | Converts sweep to a product of zips of single sweeps, if possible. | [
"Converts",
"sweep",
"to",
"a",
"product",
"of",
"zips",
"of",
"single",
"sweeps",
"if",
"possible",
"."
] | def _to_zip_product(sweep: cirq.Sweep) -> cirq.Product:
"""Converts sweep to a product of zips of single sweeps, if possible."""
if not isinstance(sweep, cirq.Product):
sweep = cirq.Product(sweep)
if not all(isinstance(f, cirq.Zip) for f in sweep.factors):
factors = [f if isinstance(f, cirq.... | [
"def",
"_to_zip_product",
"(",
"sweep",
":",
"cirq",
".",
"Sweep",
")",
"->",
"cirq",
".",
"Product",
":",
"if",
"not",
"isinstance",
"(",
"sweep",
",",
"cirq",
".",
"Product",
")",
":",
"sweep",
"=",
"cirq",
".",
"Product",
"(",
"sweep",
")",
"if",
... | https://github.com/quantumlib/Cirq/blob/89f88b01d69222d3f1ec14d649b7b3a85ed9211f/cirq-google/cirq_google/api/v1/params.py#L33-L44 | |
Yelp/bravado-core | 382db874b7b838dcfd169b0ce490d6a447ad6ff2 | bravado_core/validate.py | python | validate_object | (
swagger_spec, # type: Spec
object_spec, # type: JSONDict
value, # type: typing.Any
) | :type swagger_spec: :class:`bravado_core.spec.Spec`
:param object_spec: spec for an 'object' type in dict form
:type value: dict | :type swagger_spec: :class:`bravado_core.spec.Spec`
:param object_spec: spec for an 'object' type in dict form
:type value: dict | [
":",
"type",
"swagger_spec",
":",
":",
"class",
":",
"bravado_core",
".",
"spec",
".",
"Spec",
":",
"param",
"object_spec",
":",
"spec",
"for",
"an",
"object",
"type",
"in",
"dict",
"form",
":",
"type",
"value",
":",
"dict"
] | def validate_object(
swagger_spec, # type: Spec
object_spec, # type: JSONDict
value, # type: typing.Any
):
# type: (...) -> None
"""
:type swagger_spec: :class:`bravado_core.spec.Spec`
:param object_spec: spec for an 'object' type in dict form
:type value: dict
"""
get_validat... | [
"def",
"validate_object",
"(",
"swagger_spec",
",",
"# type: Spec",
"object_spec",
",",
"# type: JSONDict",
"value",
",",
"# type: typing.Any",
")",
":",
"# type: (...) -> None",
"get_validator_type",
"(",
"swagger_spec",
"=",
"swagger_spec",
")",
"(",
"object_spec",
",... | https://github.com/Yelp/bravado-core/blob/382db874b7b838dcfd169b0ce490d6a447ad6ff2/bravado_core/validate.py#L124-L139 | ||
linxid/Machine_Learning_Study_Path | 558e82d13237114bbb8152483977806fc0c222af | Machine Learning In Action/Chapter4-NaiveBayes/venv/Lib/site-packages/setuptools/glibc.py | python | glibc_version_string | () | return version_str | Returns glibc version string, or None if not using glibc. | Returns glibc version string, or None if not using glibc. | [
"Returns",
"glibc",
"version",
"string",
"or",
"None",
"if",
"not",
"using",
"glibc",
"."
] | def glibc_version_string():
"Returns glibc version string, or None if not using glibc."
# ctypes.CDLL(None) internally calls dlopen(NULL), and as the dlopen
# manpage says, "If filename is NULL, then the returned handle is for the
# main program". This way we can let the linker do the work to figure ou... | [
"def",
"glibc_version_string",
"(",
")",
":",
"# ctypes.CDLL(None) internally calls dlopen(NULL), and as the dlopen",
"# manpage says, \"If filename is NULL, then the returned handle is for the",
"# main program\". This way we can let the linker do the work to figure out",
"# which libc our process ... | https://github.com/linxid/Machine_Learning_Study_Path/blob/558e82d13237114bbb8152483977806fc0c222af/Machine Learning In Action/Chapter4-NaiveBayes/venv/Lib/site-packages/setuptools/glibc.py#L10-L32 | |
psd-tools/psd-tools | 00241f3aed2ca52a8012e198a0f390ff7d8edca9 | src/psd_tools/api/layers.py | python | Layer.clip_layers | (self) | return self._clip_layers | Clip layers associated with this layer.
To compose clipping layers::
from psd_tools import compose
clip_mask = compose(layer.clip_layers)
:return: list of layers | Clip layers associated with this layer. | [
"Clip",
"layers",
"associated",
"with",
"this",
"layer",
"."
] | def clip_layers(self):
"""
Clip layers associated with this layer.
To compose clipping layers::
from psd_tools import compose
clip_mask = compose(layer.clip_layers)
:return: list of layers
"""
return self._clip_layers | [
"def",
"clip_layers",
"(",
"self",
")",
":",
"return",
"self",
".",
"_clip_layers"
] | https://github.com/psd-tools/psd-tools/blob/00241f3aed2ca52a8012e198a0f390ff7d8edca9/src/psd_tools/api/layers.py#L429-L440 | |
openstack/cinder | 23494a6d6c51451688191e1847a458f1d3cdcaa5 | cinder/volume/drivers/hitachi/hbsd_rest.py | python | HBSDREST.has_snap_pair | (self, pvol, svol) | return (result[0]['primaryOrSecondary'] == "S-VOL" and
int(result[0]['pvolLdevId']) == pvol) | Check if the volume have the pair of the snapshot. | Check if the volume have the pair of the snapshot. | [
"Check",
"if",
"the",
"volume",
"have",
"the",
"pair",
"of",
"the",
"snapshot",
"."
] | def has_snap_pair(self, pvol, svol):
"""Check if the volume have the pair of the snapshot."""
ldev_info = self.get_ldev_info(['status', 'attributes'], svol)
if (ldev_info['status'] != NORMAL_STS or
PAIR_ATTR not in ldev_info['attributes']):
return False
params... | [
"def",
"has_snap_pair",
"(",
"self",
",",
"pvol",
",",
"svol",
")",
":",
"ldev_info",
"=",
"self",
".",
"get_ldev_info",
"(",
"[",
"'status'",
",",
"'attributes'",
"]",
",",
"svol",
")",
"if",
"(",
"ldev_info",
"[",
"'status'",
"]",
"!=",
"NORMAL_STS",
... | https://github.com/openstack/cinder/blob/23494a6d6c51451688191e1847a458f1d3cdcaa5/cinder/volume/drivers/hitachi/hbsd_rest.py#L785-L796 | |
HypothesisWorks/hypothesis | d1bfc4acc86899caa7a40f892322e1a69fbf36f4 | hypothesis-python/src/hypothesis/strategies/_internal/regex.py | python | CharactersBuilder.add_char | (self, char) | Add given char to the whitelist. | Add given char to the whitelist. | [
"Add",
"given",
"char",
"to",
"the",
"whitelist",
"."
] | def add_char(self, char):
"""Add given char to the whitelist."""
c = self.code_to_char(char)
self._whitelist_chars.add(c)
if (
self._ignorecase
and re.match(re.escape(c), c.swapcase(), flags=re.IGNORECASE) is not None
):
# Note that it is possi... | [
"def",
"add_char",
"(",
"self",
",",
"char",
")",
":",
"c",
"=",
"self",
".",
"code_to_char",
"(",
"char",
")",
"self",
".",
"_whitelist_chars",
".",
"add",
"(",
"c",
")",
"if",
"(",
"self",
".",
"_ignorecase",
"and",
"re",
".",
"match",
"(",
"re",... | https://github.com/HypothesisWorks/hypothesis/blob/d1bfc4acc86899caa7a40f892322e1a69fbf36f4/hypothesis-python/src/hypothesis/strategies/_internal/regex.py#L161-L170 | ||
deepgully/me | f7ad65edc2fe435310c6676bc2e322cfe5d4c8f0 | libs/sqlalchemy/dialects/mysql/oursql.py | python | MySQLDialect_oursql.do_execute | (self, cursor, statement, parameters, context=None) | Provide an implementation of *cursor.execute(statement, parameters)*. | Provide an implementation of *cursor.execute(statement, parameters)*. | [
"Provide",
"an",
"implementation",
"of",
"*",
"cursor",
".",
"execute",
"(",
"statement",
"parameters",
")",
"*",
"."
] | def do_execute(self, cursor, statement, parameters, context=None):
"""Provide an implementation of *cursor.execute(statement, parameters)*."""
if context and context.plain_query:
cursor.execute(statement, plain_query=True)
else:
cursor.execute(statement, parameters) | [
"def",
"do_execute",
"(",
"self",
",",
"cursor",
",",
"statement",
",",
"parameters",
",",
"context",
"=",
"None",
")",
":",
"if",
"context",
"and",
"context",
".",
"plain_query",
":",
"cursor",
".",
"execute",
"(",
"statement",
",",
"plain_query",
"=",
... | https://github.com/deepgully/me/blob/f7ad65edc2fe435310c6676bc2e322cfe5d4c8f0/libs/sqlalchemy/dialects/mysql/oursql.py#L81-L87 | ||
pyproj4/pyproj | 24eade78c52f8bf6717e56fb7c878f7da9892368 | pyproj/crs/crs.py | python | CRS.target_crs | (self) | return (
None
if self._crs.target_crs is None
else self.__class__(self._crs.target_crs)
) | .. versionadded:: 2.2.0
Returns
-------
CRS:
The hub CRS of a BoundCRS or the target CRS of a CoordinateOperation. | .. versionadded:: 2.2.0 | [
"..",
"versionadded",
"::",
"2",
".",
"2",
".",
"0"
] | def target_crs(self) -> Optional["CRS"]:
"""
.. versionadded:: 2.2.0
Returns
-------
CRS:
The hub CRS of a BoundCRS or the target CRS of a CoordinateOperation.
"""
return (
None
if self._crs.target_crs is None
else... | [
"def",
"target_crs",
"(",
"self",
")",
"->",
"Optional",
"[",
"\"CRS\"",
"]",
":",
"return",
"(",
"None",
"if",
"self",
".",
"_crs",
".",
"target_crs",
"is",
"None",
"else",
"self",
".",
"__class__",
"(",
"self",
".",
"_crs",
".",
"target_crs",
")",
... | https://github.com/pyproj4/pyproj/blob/24eade78c52f8bf6717e56fb7c878f7da9892368/pyproj/crs/crs.py#L998-L1012 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.