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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
wtforms/wtforms | efe4e90acdb4a6b5d9b64a25756a33b41719319b | src/wtforms/form.py | python | BaseForm.__delitem__ | (self, name) | Remove a field from this form. | Remove a field from this form. | [
"Remove",
"a",
"field",
"from",
"this",
"form",
"."
] | def __delitem__(self, name):
"""Remove a field from this form."""
del self._fields[name] | [
"def",
"__delitem__",
"(",
"self",
",",
"name",
")",
":",
"del",
"self",
".",
"_fields",
"[",
"name",
"]"
] | https://github.com/wtforms/wtforms/blob/efe4e90acdb4a6b5d9b64a25756a33b41719319b/src/wtforms/form.py#L69-L71 | ||
ctxis/canape | 5f0e03424577296bcc60c2008a60a98ec5307e4b | CANAPE.Scripting/Lib/decimal.py | python | Context.remainder_near | (self, a, b) | return a.remainder_near(b, context=self) | Returns to be "a - b * n", where n is the integer nearest the exact
value of "x / b" (if two integers are equally near then the even one
is chosen). If the result is equal to 0 then its sign will be the
sign of a.
This operation will fail under the same conditions as integer division
... | Returns to be "a - b * n", where n is the integer nearest the exact
value of "x / b" (if two integers are equally near then the even one
is chosen). If the result is equal to 0 then its sign will be the
sign of a. | [
"Returns",
"to",
"be",
"a",
"-",
"b",
"*",
"n",
"where",
"n",
"is",
"the",
"integer",
"nearest",
"the",
"exact",
"value",
"of",
"x",
"/",
"b",
"(",
"if",
"two",
"integers",
"are",
"equally",
"near",
"then",
"the",
"even",
"one",
"is",
"chosen",
")"... | def remainder_near(self, a, b):
"""Returns to be "a - b * n", where n is the integer nearest the exact
value of "x / b" (if two integers are equally near then the even one
is chosen). If the result is equal to 0 then its sign will be the
sign of a.
This operation will fail unde... | [
"def",
"remainder_near",
"(",
"self",
",",
"a",
",",
"b",
")",
":",
"a",
"=",
"_convert_other",
"(",
"a",
",",
"raiseit",
"=",
"True",
")",
"return",
"a",
".",
"remainder_near",
"(",
"b",
",",
"context",
"=",
"self",
")"
] | https://github.com/ctxis/canape/blob/5f0e03424577296bcc60c2008a60a98ec5307e4b/CANAPE.Scripting/Lib/decimal.py#L5127-L5159 | |
sublimelsp/LSP | 19a01aa045de04bcc805e56043923656548050e0 | plugin/session_view.py | python | SessionView._register_auto_complete_triggers | (self, registration_id: str, trigger_chars: List[str]) | Register trigger characters from a dynamic server registration. | Register trigger characters from a dynamic server registration. | [
"Register",
"trigger",
"characters",
"from",
"a",
"dynamic",
"server",
"registration",
"."
] | def _register_auto_complete_triggers(self, registration_id: str, trigger_chars: List[str]) -> None:
"""Register trigger characters from a dynamic server registration."""
self._apply_auto_complete_triggers(self.view.settings(), trigger_chars, registration_id) | [
"def",
"_register_auto_complete_triggers",
"(",
"self",
",",
"registration_id",
":",
"str",
",",
"trigger_chars",
":",
"List",
"[",
"str",
"]",
")",
"->",
"None",
":",
"self",
".",
"_apply_auto_complete_triggers",
"(",
"self",
".",
"view",
".",
"settings",
"("... | https://github.com/sublimelsp/LSP/blob/19a01aa045de04bcc805e56043923656548050e0/plugin/session_view.py#L140-L142 | ||
lepture/authlib | 2284f751a47474da7d127303e0d8f34d9046c310 | authlib/oauth2/rfc6749/grants/authorization_code.py | python | AuthorizationCodeGrant.save_authorization_code | (self, code, request) | Save authorization_code for later use. Developers MUST implement
it in subclass. Here is an example::
def save_authorization_code(self, code, request):
client = request.client
item = AuthorizationCode(
code=code,
client_id=clie... | Save authorization_code for later use. Developers MUST implement
it in subclass. Here is an example:: | [
"Save",
"authorization_code",
"for",
"later",
"use",
".",
"Developers",
"MUST",
"implement",
"it",
"in",
"subclass",
".",
"Here",
"is",
"an",
"example",
"::"
] | def save_authorization_code(self, code, request):
"""Save authorization_code for later use. Developers MUST implement
it in subclass. Here is an example::
def save_authorization_code(self, code, request):
client = request.client
item = AuthorizationCode(
... | [
"def",
"save_authorization_code",
"(",
"self",
",",
"code",
",",
"request",
")",
":",
"raise",
"NotImplementedError",
"(",
")"
] | https://github.com/lepture/authlib/blob/2284f751a47474da7d127303e0d8f34d9046c310/authlib/oauth2/rfc6749/grants/authorization_code.py#L295-L310 | ||
python/cpython | e13cdca0f5224ec4e23bdd04bb3120506964bc8b | Lib/urllib/request.py | python | Request.get_method | (self) | return getattr(self, 'method', default_method) | Return a string indicating the HTTP request method. | Return a string indicating the HTTP request method. | [
"Return",
"a",
"string",
"indicating",
"the",
"HTTP",
"request",
"method",
"."
] | def get_method(self):
"""Return a string indicating the HTTP request method."""
default_method = "POST" if self.data is not None else "GET"
return getattr(self, 'method', default_method) | [
"def",
"get_method",
"(",
"self",
")",
":",
"default_method",
"=",
"\"POST\"",
"if",
"self",
".",
"data",
"is",
"not",
"None",
"else",
"\"GET\"",
"return",
"getattr",
"(",
"self",
",",
"'method'",
",",
"default_method",
")"
] | https://github.com/python/cpython/blob/e13cdca0f5224ec4e23bdd04bb3120506964bc8b/Lib/urllib/request.py#L382-L385 | |
getting-things-gnome/gtg | 4b02c43744b32a00facb98174f04ec5953bd055d | GTG/core/datastore.py | python | TaskSource.__init__ | (self, requester, backend, datastore) | Instantiates a TaskSource object.
@param requester: a Requester
@param backend: the backend being wrapped
@param datastore: a Datastore | Instantiates a TaskSource object. | [
"Instantiates",
"a",
"TaskSource",
"object",
"."
] | def __init__(self, requester, backend, datastore):
"""
Instantiates a TaskSource object.
@param requester: a Requester
@param backend: the backend being wrapped
@param datastore: a Datastore
"""
self.backend = backend
self.req = requester
self.ba... | [
"def",
"__init__",
"(",
"self",
",",
"requester",
",",
"backend",
",",
"datastore",
")",
":",
"self",
".",
"backend",
"=",
"backend",
"self",
".",
"req",
"=",
"requester",
"self",
".",
"backend",
".",
"register_datastore",
"(",
"datastore",
")",
"self",
... | https://github.com/getting-things-gnome/gtg/blob/4b02c43744b32a00facb98174f04ec5953bd055d/GTG/core/datastore.py#L666-L689 | ||
twisted/twisted | dee676b040dd38b847ea6fb112a712cb5e119490 | src/twisted/trial/_dist/workerreporter.py | python | WorkerReporter._getFrames | (self, failure) | return frames | Extract frames from a C{Failure} instance. | Extract frames from a C{Failure} instance. | [
"Extract",
"frames",
"from",
"a",
"C",
"{",
"Failure",
"}",
"instance",
"."
] | def _getFrames(self, failure):
"""
Extract frames from a C{Failure} instance.
"""
frames = []
for frame in failure.frames:
frames.extend([frame[0], frame[1], str(frame[2])])
return frames | [
"def",
"_getFrames",
"(",
"self",
",",
"failure",
")",
":",
"frames",
"=",
"[",
"]",
"for",
"frame",
"in",
"failure",
".",
"frames",
":",
"frames",
".",
"extend",
"(",
"[",
"frame",
"[",
"0",
"]",
",",
"frame",
"[",
"1",
"]",
",",
"str",
"(",
"... | https://github.com/twisted/twisted/blob/dee676b040dd38b847ea6fb112a712cb5e119490/src/twisted/trial/_dist/workerreporter.py#L46-L53 | |
elastic/elasticsearch-py | 6ef1adfa3c840a84afda7369cd8e43ae7dc45cdb | elasticsearch/_sync/client/transform.py | python | TransformClient.get_transform | (
self,
*,
transform_id: Optional[Any] = None,
allow_no_match: Optional[bool] = None,
error_trace: Optional[bool] = None,
exclude_generated: Optional[bool] = None,
filter_path: Optional[Union[List[str], str]] = None,
from_: Optional[int] = None,
hu... | return self._perform_request("GET", __target, headers=__headers) | Retrieves configuration information for transforms.
`<https://www.elastic.co/guide/en/elasticsearch/reference/current/get-transform.html>`_
:param transform_id: Identifier for the transform. It can be a transform identifier
or a wildcard expression. You can get information for all transfor... | Retrieves configuration information for transforms. | [
"Retrieves",
"configuration",
"information",
"for",
"transforms",
"."
] | def get_transform(
self,
*,
transform_id: Optional[Any] = None,
allow_no_match: Optional[bool] = None,
error_trace: Optional[bool] = None,
exclude_generated: Optional[bool] = None,
filter_path: Optional[Union[List[str], str]] = None,
from_: Optional[int] =... | [
"def",
"get_transform",
"(",
"self",
",",
"*",
",",
"transform_id",
":",
"Optional",
"[",
"Any",
"]",
"=",
"None",
",",
"allow_no_match",
":",
"Optional",
"[",
"bool",
"]",
"=",
"None",
",",
"error_trace",
":",
"Optional",
"[",
"bool",
"]",
"=",
"None"... | https://github.com/elastic/elasticsearch-py/blob/6ef1adfa3c840a84afda7369cd8e43ae7dc45cdb/elasticsearch/_sync/client/transform.py#L77-L135 | |
SickChill/SickChill | 01020f3636d01535f60b83464d8127ea0efabfc7 | sickchill/views/api/webapi.py | python | CMDShowGetQuality.run | (self) | return _responds(RESULT_SUCCESS, {"initial": any_qualities, "archive": best_qualities}) | Get the quality setting of a show | Get the quality setting of a show | [
"Get",
"the",
"quality",
"setting",
"of",
"a",
"show"
] | def run(self):
"""Get the quality setting of a show"""
show_obj = Show.find(settings.showList, int(self.indexerid))
if not show_obj:
return _responds(RESULT_FAILURE, msg="Show not found")
any_qualities, best_qualities = _map_quality(show_obj.quality)
return _respond... | [
"def",
"run",
"(",
"self",
")",
":",
"show_obj",
"=",
"Show",
".",
"find",
"(",
"settings",
".",
"showList",
",",
"int",
"(",
"self",
".",
"indexerid",
")",
")",
"if",
"not",
"show_obj",
":",
"return",
"_responds",
"(",
"RESULT_FAILURE",
",",
"msg",
... | https://github.com/SickChill/SickChill/blob/01020f3636d01535f60b83464d8127ea0efabfc7/sickchill/views/api/webapi.py#L2317-L2325 | |
pwnieexpress/pwn_plug_sources | 1a23324f5dc2c3de20f9c810269b6a29b2758cad | src/goodfet/GoodFETNRF.py | python | GoodFETNRF.RF_setfreq | (self,frequency) | Set the frequency in Hz. | Set the frequency in Hz. | [
"Set",
"the",
"frequency",
"in",
"Hz",
"."
] | def RF_setfreq(self,frequency):
"""Set the frequency in Hz."""
#On the NRF24L01+, register 0x05 is the offset in
#MHz above 2400.
chan=frequency/1000000-2400;
self.poke(0x05,chan); | [
"def",
"RF_setfreq",
"(",
"self",
",",
"frequency",
")",
":",
"#On the NRF24L01+, register 0x05 is the offset in",
"#MHz above 2400.",
"chan",
"=",
"frequency",
"/",
"1000000",
"-",
"2400",
"self",
".",
"poke",
"(",
"0x05",
",",
"chan",
")"
] | https://github.com/pwnieexpress/pwn_plug_sources/blob/1a23324f5dc2c3de20f9c810269b6a29b2758cad/src/goodfet/GoodFETNRF.py#L95-L102 | ||
AppScale/gts | 46f909cf5dc5ba81faf9d81dc9af598dcf8a82a9 | AppServer/lib/cherrypy/cherrypy/lib/caching.py | python | Cache.clear | (self) | Reset the cache to its initial, empty state. | Reset the cache to its initial, empty state. | [
"Reset",
"the",
"cache",
"to",
"its",
"initial",
"empty",
"state",
"."
] | def clear(self):
"""Reset the cache to its initial, empty state."""
raise NotImplemented | [
"def",
"clear",
"(",
"self",
")",
":",
"raise",
"NotImplemented"
] | https://github.com/AppScale/gts/blob/46f909cf5dc5ba81faf9d81dc9af598dcf8a82a9/AppServer/lib/cherrypy/cherrypy/lib/caching.py#L60-L62 | ||
NYUCCL/psiTurk | bad1e5c70ab2a0b7f04a1a86f166ed2f998b607d | psiturk/amt_services_wrapper.py | python | MTurkServicesWrapper._try_fetch_local_assignment | (self, try_this, with_psiturk_status=None) | Can accept either an assignment_id or the return of a mturk boto grab... | Can accept either an assignment_id or the return of a mturk boto grab... | [
"Can",
"accept",
"either",
"an",
"assignment_id",
"or",
"the",
"return",
"of",
"a",
"mturk",
"boto",
"grab",
"..."
] | def _try_fetch_local_assignment(self, try_this, with_psiturk_status=None):
"""
Can accept either an assignment_id or the return of a mturk boto grab...
"""
query = Participant.query.order_by(Participant.beginhit.desc())
if with_psiturk_status:
query = query.filter(Pa... | [
"def",
"_try_fetch_local_assignment",
"(",
"self",
",",
"try_this",
",",
"with_psiturk_status",
"=",
"None",
")",
":",
"query",
"=",
"Participant",
".",
"query",
".",
"order_by",
"(",
"Participant",
".",
"beginhit",
".",
"desc",
"(",
")",
")",
"if",
"with_ps... | https://github.com/NYUCCL/psiTurk/blob/bad1e5c70ab2a0b7f04a1a86f166ed2f998b607d/psiturk/amt_services_wrapper.py#L274-L299 | ||
wgrathwohl/JEM | 3d01161547109b464eee87304f07b2dac8519d03 | train_wrn_ebm.py | python | init_random | (args, bs) | return t.FloatTensor(bs, n_ch, im_sz, im_sz).uniform_(-1, 1) | [] | def init_random(args, bs):
return t.FloatTensor(bs, n_ch, im_sz, im_sz).uniform_(-1, 1) | [
"def",
"init_random",
"(",
"args",
",",
"bs",
")",
":",
"return",
"t",
".",
"FloatTensor",
"(",
"bs",
",",
"n_ch",
",",
"im_sz",
",",
"im_sz",
")",
".",
"uniform_",
"(",
"-",
"1",
",",
"1",
")"
] | https://github.com/wgrathwohl/JEM/blob/3d01161547109b464eee87304f07b2dac8519d03/train_wrn_ebm.py#L106-L107 | |||
gammapy/gammapy | 735b25cd5bbed35e2004d633621896dcd5295e8b | gammapy/estimators/points/core.py | python | FluxPoints.read | (
cls, filename, sed_type=None, format="gadf-sed", reference_model=None, **kwargs
) | return cls.from_table(
table=table,
sed_type=sed_type,
reference_model=reference_model,
format=format,
) | Read flux points.
Parameters
----------
filename : str
Filename
sed_type : {"dnde", "flux", "eflux", "e2dnde", "likelihood"}
Sed type
format : {"gadf-sed", "lightcurve"}
Format string.
reference_model : `SpectralModel`
Refe... | Read flux points. | [
"Read",
"flux",
"points",
"."
] | def read(
cls, filename, sed_type=None, format="gadf-sed", reference_model=None, **kwargs
):
"""Read flux points.
Parameters
----------
filename : str
Filename
sed_type : {"dnde", "flux", "eflux", "e2dnde", "likelihood"}
Sed type
forma... | [
"def",
"read",
"(",
"cls",
",",
"filename",
",",
"sed_type",
"=",
"None",
",",
"format",
"=",
"\"gadf-sed\"",
",",
"reference_model",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"filename",
"=",
"make_path",
"(",
"filename",
")",
"try",
":",
"table... | https://github.com/gammapy/gammapy/blob/735b25cd5bbed35e2004d633621896dcd5295e8b/gammapy/estimators/points/core.py#L108-L144 | |
audreyfeldroy/complexity | 710dc771b11c65fb65820cfb2a519dd749c65419 | complexity/utils.py | python | make_sure_path_exists | (path) | return True | Ensures that a directory exists.
:param path: A directory path. | Ensures that a directory exists. | [
"Ensures",
"that",
"a",
"directory",
"exists",
"."
] | def make_sure_path_exists(path):
"""
Ensures that a directory exists.
:param path: A directory path.
"""
try:
os.makedirs(path)
except OSError as exception:
if exception.errno != errno.EEXIST:
return False
return True | [
"def",
"make_sure_path_exists",
"(",
"path",
")",
":",
"try",
":",
"os",
".",
"makedirs",
"(",
"path",
")",
"except",
"OSError",
"as",
"exception",
":",
"if",
"exception",
".",
"errno",
"!=",
"errno",
".",
"EEXIST",
":",
"return",
"False",
"return",
"Tru... | https://github.com/audreyfeldroy/complexity/blob/710dc771b11c65fb65820cfb2a519dd749c65419/complexity/utils.py#L23-L34 | |
jython/jython3 | def4f8ec47cb7a9c799ea4c745f12badf92c5769 | lib-python/3.5.1/_pydecimal.py | python | Decimal.is_canonical | (self) | return True | Return True if self is canonical; otherwise return False.
Currently, the encoding of a Decimal instance is always
canonical, so this method returns True for any Decimal. | Return True if self is canonical; otherwise return False. | [
"Return",
"True",
"if",
"self",
"is",
"canonical",
";",
"otherwise",
"return",
"False",
"."
] | def is_canonical(self):
"""Return True if self is canonical; otherwise return False.
Currently, the encoding of a Decimal instance is always
canonical, so this method returns True for any Decimal.
"""
return True | [
"def",
"is_canonical",
"(",
"self",
")",
":",
"return",
"True"
] | https://github.com/jython/jython3/blob/def4f8ec47cb7a9c799ea4c745f12badf92c5769/lib-python/3.5.1/_pydecimal.py#L3099-L3105 | |
CalebBell/thermo | 572a47d1b03d49fe609b8d5f826fa6a7cde00828 | thermo/eos_mix.py | python | IGMIX.d3delta_dninjnks | (self) | return self._zeros3d() | r'''Helper method for calculating the third partial mole number
derivatives of `delta`. Note this is independent of the phase.
.. math::
\left(\frac{\partial^3 \delta}{\partial n_i \partial n_j \partial n_k }
\right)_{T, P,
n_{m \ne i,j,k}} = 0
Returns
... | r'''Helper method for calculating the third partial mole number
derivatives of `delta`. Note this is independent of the phase. | [
"r",
"Helper",
"method",
"for",
"calculating",
"the",
"third",
"partial",
"mole",
"number",
"derivatives",
"of",
"delta",
".",
"Note",
"this",
"is",
"independent",
"of",
"the",
"phase",
"."
] | def d3delta_dninjnks(self):
r'''Helper method for calculating the third partial mole number
derivatives of `delta`. Note this is independent of the phase.
.. math::
\left(\frac{\partial^3 \delta}{\partial n_i \partial n_j \partial n_k }
\right)_{T, P,
n_{m \n... | [
"def",
"d3delta_dninjnks",
"(",
"self",
")",
":",
"return",
"self",
".",
"_zeros3d",
"(",
")"
] | https://github.com/CalebBell/thermo/blob/572a47d1b03d49fe609b8d5f826fa6a7cde00828/thermo/eos_mix.py#L6304-L6319 | |
twilio/twilio-python | 6e1e811ea57a1edfadd5161ace87397c563f6915 | twilio/rest/messaging/v1/usecase.py | python | UsecaseInstance.usecases | (self) | return self._properties['usecases'] | :returns: Human readable Messaging Service Use Case details
:rtype: list[dict] | :returns: Human readable Messaging Service Use Case details
:rtype: list[dict] | [
":",
"returns",
":",
"Human",
"readable",
"Messaging",
"Service",
"Use",
"Case",
"details",
":",
"rtype",
":",
"list",
"[",
"dict",
"]"
] | def usecases(self):
"""
:returns: Human readable Messaging Service Use Case details
:rtype: list[dict]
"""
return self._properties['usecases'] | [
"def",
"usecases",
"(",
"self",
")",
":",
"return",
"self",
".",
"_properties",
"[",
"'usecases'",
"]"
] | https://github.com/twilio/twilio-python/blob/6e1e811ea57a1edfadd5161ace87397c563f6915/twilio/rest/messaging/v1/usecase.py#L116-L121 | |
jkehler/awslambda-psycopg2 | c7b1b2f6382bbe5893d95c4e7f4b5ffdf05ab3b4 | psycopg2-3.8/extras.py | python | register_composite | (name, conn_or_curs, globally=False, factory=None) | return caster | Register a typecaster to convert a composite type into a tuple.
:param name: the name of a PostgreSQL composite type, e.g. created using
the |CREATE TYPE|_ command
:param conn_or_curs: a connection or cursor used to find the type oid and
components; the typecaster is registered in a scope limit... | Register a typecaster to convert a composite type into a tuple. | [
"Register",
"a",
"typecaster",
"to",
"convert",
"a",
"composite",
"type",
"into",
"a",
"tuple",
"."
] | def register_composite(name, conn_or_curs, globally=False, factory=None):
"""Register a typecaster to convert a composite type into a tuple.
:param name: the name of a PostgreSQL composite type, e.g. created using
the |CREATE TYPE|_ command
:param conn_or_curs: a connection or cursor used to find t... | [
"def",
"register_composite",
"(",
"name",
",",
"conn_or_curs",
",",
"globally",
"=",
"False",
",",
"factory",
"=",
"None",
")",
":",
"if",
"factory",
"is",
"None",
":",
"factory",
"=",
"CompositeCaster",
"caster",
"=",
"factory",
".",
"_from_db",
"(",
"nam... | https://github.com/jkehler/awslambda-psycopg2/blob/c7b1b2f6382bbe5893d95c4e7f4b5ffdf05ab3b4/psycopg2-3.8/extras.py#L1137-L1162 | |
mattupstate/flask-security | 674b18103fa8734aca71bbd084ea01e3709817ef | flask_security/datastore.py | python | UserDatastore.find_role | (self, *args, **kwargs) | Returns a role matching the provided name. | Returns a role matching the provided name. | [
"Returns",
"a",
"role",
"matching",
"the",
"provided",
"name",
"."
] | def find_role(self, *args, **kwargs):
"""Returns a role matching the provided name."""
raise NotImplementedError | [
"def",
"find_role",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"raise",
"NotImplementedError"
] | https://github.com/mattupstate/flask-security/blob/674b18103fa8734aca71bbd084ea01e3709817ef/flask_security/datastore.py#L144-L146 | ||
rembo10/headphones | b3199605be1ebc83a7a8feab6b1e99b64014187c | lib/yaml/scanner.py | python | Scanner.scan_to_next_token | (self) | [] | def scan_to_next_token(self):
# We ignore spaces, line breaks and comments.
# If we find a line break in the block context, we set the flag
# `allow_simple_key` on.
# The byte order mark is stripped if it's the first character in the
# stream. We do not yet support BOM inside the... | [
"def",
"scan_to_next_token",
"(",
"self",
")",
":",
"# We ignore spaces, line breaks and comments.",
"# If we find a line break in the block context, we set the flag",
"# `allow_simple_key` on.",
"# The byte order mark is stripped if it's the first character in the",
"# stream. We do not yet sup... | https://github.com/rembo10/headphones/blob/b3199605be1ebc83a7a8feab6b1e99b64014187c/lib/yaml/scanner.py#L753-L786 | ||||
PyMVPA/PyMVPA | 76c476b3de8264b0bb849bf226da5674d659564e | mvpa2/measures/winner.py | python | feature_loser_measure | () | return WinnerMeasure('features', partial(np.argmin, axis=1), 'lta_') | takes loser over features | takes loser over features | [
"takes",
"loser",
"over",
"features"
] | def feature_loser_measure():
'''takes loser over features'''
return WinnerMeasure('features', partial(np.argmin, axis=1), 'lta_') | [
"def",
"feature_loser_measure",
"(",
")",
":",
"return",
"WinnerMeasure",
"(",
"'features'",
",",
"partial",
"(",
"np",
".",
"argmin",
",",
"axis",
"=",
"1",
")",
",",
"'lta_'",
")"
] | https://github.com/PyMVPA/PyMVPA/blob/76c476b3de8264b0bb849bf226da5674d659564e/mvpa2/measures/winner.py#L135-L137 | |
Antergos/Cnchi | 13ac2209da9432d453e0097cf48a107640b563a9 | src/pacman/pac.py | python | Pac.initialize_alpm | (self) | Set alpm setup | Set alpm setup | [
"Set",
"alpm",
"setup"
] | def initialize_alpm(self):
""" Set alpm setup """
if self.config is not None:
root_dir = self.config.options["RootDir"]
db_path = self.config.options["DBPath"]
else:
root_dir = _DEFAULT_ROOT_DIR
db_path = _DEFAULT_DB_PATH
self.handle = pya... | [
"def",
"initialize_alpm",
"(",
"self",
")",
":",
"if",
"self",
".",
"config",
"is",
"not",
"None",
":",
"root_dir",
"=",
"self",
".",
"config",
".",
"options",
"[",
"\"RootDir\"",
"]",
"db_path",
"=",
"self",
".",
"config",
".",
"options",
"[",
"\"DBPa... | https://github.com/Antergos/Cnchi/blob/13ac2209da9432d453e0097cf48a107640b563a9/src/pacman/pac.py#L122-L156 | ||
saltstack/salt | fae5bc757ad0f1716483ce7ae180b451545c2058 | salt/modules/junos.py | python | install_config | (path=None, **kwargs) | Installs the given configuration file into the candidate configuration.
Commits the changes if the commit checks or throws an error.
path (required)
Path where the configuration/template file is present. If the file has
a ``.conf`` extension, the content is treated as text format. If the
... | Installs the given configuration file into the candidate configuration.
Commits the changes if the commit checks or throws an error. | [
"Installs",
"the",
"given",
"configuration",
"file",
"into",
"the",
"candidate",
"configuration",
".",
"Commits",
"the",
"changes",
"if",
"the",
"commit",
"checks",
"or",
"throws",
"an",
"error",
"."
] | def install_config(path=None, **kwargs):
"""
Installs the given configuration file into the candidate configuration.
Commits the changes if the commit checks or throws an error.
path (required)
Path where the configuration/template file is present. If the file has
a ``.conf`` extension,... | [
"def",
"install_config",
"(",
"path",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"conn",
"=",
"__proxy__",
"[",
"\"junos.conn\"",
"]",
"(",
")",
"ret",
"=",
"{",
"}",
"ret",
"[",
"\"out\"",
"]",
"=",
"True",
"if",
"path",
"is",
"None",
":",
... | https://github.com/saltstack/salt/blob/fae5bc757ad0f1716483ce7ae180b451545c2058/salt/modules/junos.py#L995-L1273 | ||
google/apis-client-generator | f09f0ba855c3845d315b811c6234fd3996f33172 | src/googleapis/codegen/php_generator.py | python | PHPApi.ToClassName | (self, s, unused_element, element_type=None) | return utilities.CamelCase(s) | Convert a discovery name to a suitable PHP class name.
Overrides the default.
Args:
s: (string) The wire format name of a class.
unused_element: (object) The object we need a class name for.
element_type: (string) The kind of object we need a class name for.
Returns:
A name suitabl... | Convert a discovery name to a suitable PHP class name. | [
"Convert",
"a",
"discovery",
"name",
"to",
"a",
"suitable",
"PHP",
"class",
"name",
"."
] | def ToClassName(self, s, unused_element, element_type=None):
"""Convert a discovery name to a suitable PHP class name.
Overrides the default.
Args:
s: (string) The wire format name of a class.
unused_element: (object) The object we need a class name for.
element_type: (string) The kind o... | [
"def",
"ToClassName",
"(",
"self",
",",
"s",
",",
"unused_element",
",",
"element_type",
"=",
"None",
")",
":",
"if",
"s",
".",
"lower",
"(",
")",
"in",
"PhpLanguageModel",
".",
"RESERVED_CLASS_NAMES",
":",
"# Prepend the service name.",
"return",
"utilities",
... | https://github.com/google/apis-client-generator/blob/f09f0ba855c3845d315b811c6234fd3996f33172/src/googleapis/codegen/php_generator.py#L296-L311 | |
google-research/motion_imitation | d0e7b963c5a301984352d25a3ee0820266fa4218 | mpc_controller/foot_stepper.py | python | FootStepper.swing_foot | (self) | [] | def swing_foot(self):
self.move_swing_foot = True | [
"def",
"swing_foot",
"(",
"self",
")",
":",
"self",
".",
"move_swing_foot",
"=",
"True"
] | https://github.com/google-research/motion_imitation/blob/d0e7b963c5a301984352d25a3ee0820266fa4218/mpc_controller/foot_stepper.py#L78-L79 | ||||
bruderstein/PythonScript | df9f7071ddf3a079e3a301b9b53a6dc78cf1208f | PythonLib/full/xml/dom/minidom.py | python | Element.setAttribute | (self, attname, value) | [] | def setAttribute(self, attname, value):
attr = self.getAttributeNode(attname)
if attr is None:
attr = Attr(attname)
attr.value = value # also sets nodeValue
attr.ownerDocument = self.ownerDocument
self.setAttributeNode(attr)
elif value != attr.valu... | [
"def",
"setAttribute",
"(",
"self",
",",
"attname",
",",
"value",
")",
":",
"attr",
"=",
"self",
".",
"getAttributeNode",
"(",
"attname",
")",
"if",
"attr",
"is",
"None",
":",
"attr",
"=",
"Attr",
"(",
"attname",
")",
"attr",
".",
"value",
"=",
"valu... | https://github.com/bruderstein/PythonScript/blob/df9f7071ddf3a079e3a301b9b53a6dc78cf1208f/PythonLib/full/xml/dom/minidom.py#L745-L755 | ||||
lfz/Guided-Denoise | 8881ab768d16eaf87342da4ff7dc8271e183e205 | Attackset/Iter2_v3_resv2_inresv2_random/nets/alexnet.py | python | alexnet_v2 | (inputs,
num_classes=1000,
is_training=True,
dropout_keep_prob=0.5,
spatial_squeeze=True,
scope='alexnet_v2') | AlexNet version 2.
Described in: http://arxiv.org/pdf/1404.5997v2.pdf
Parameters from:
github.com/akrizhevsky/cuda-convnet2/blob/master/layers/
layers-imagenet-1gpu.cfg
Note: All the fully_connected layers have been transformed to conv2d layers.
To use in classification mode, resize input to 224x224... | AlexNet version 2. | [
"AlexNet",
"version",
"2",
"."
] | def alexnet_v2(inputs,
num_classes=1000,
is_training=True,
dropout_keep_prob=0.5,
spatial_squeeze=True,
scope='alexnet_v2'):
"""AlexNet version 2.
Described in: http://arxiv.org/pdf/1404.5997v2.pdf
Parameters from:
github.com/akrizhevsk... | [
"def",
"alexnet_v2",
"(",
"inputs",
",",
"num_classes",
"=",
"1000",
",",
"is_training",
"=",
"True",
",",
"dropout_keep_prob",
"=",
"0.5",
",",
"spatial_squeeze",
"=",
"True",
",",
"scope",
"=",
"'alexnet_v2'",
")",
":",
"with",
"tf",
".",
"variable_scope",... | https://github.com/lfz/Guided-Denoise/blob/8881ab768d16eaf87342da4ff7dc8271e183e205/Attackset/Iter2_v3_resv2_inresv2_random/nets/alexnet.py#L55-L124 | ||
sahana/eden | 1696fa50e90ce967df69f66b571af45356cc18da | modules/templates/IFRC/menus.py | python | S3MainMenu.menu_modules | (cls) | return [
homepage("gis")(
),
homepage("hrm", "org", name=T("Staff"),
#vars={"group": "staff"}, check=hrm)(
vars={"group": "staff"})(
MM("Staff", c="hrm", f="staff", m="summary"),
MM("Teams", c="hrm", f="group")... | Custom Modules Menu | Custom Modules Menu | [
"Custom",
"Modules",
"Menu"
] | def menu_modules(cls):
""" Custom Modules Menu """
system_roles = current.session.s3.system_roles
ADMIN = system_roles.ADMIN
T = current.T
auth = current.auth
has_role = auth.s3_has_role
s3db = current.s3db
if not has_role(ADMIN):
if auth.s3... | [
"def",
"menu_modules",
"(",
"cls",
")",
":",
"system_roles",
"=",
"current",
".",
"session",
".",
"s3",
".",
"system_roles",
"ADMIN",
"=",
"system_roles",
".",
"ADMIN",
"T",
"=",
"current",
".",
"T",
"auth",
"=",
"current",
".",
"auth",
"has_role",
"=",
... | https://github.com/sahana/eden/blob/1696fa50e90ce967df69f66b571af45356cc18da/modules/templates/IFRC/menus.py#L43-L206 | |
frescobaldi/frescobaldi | 301cc977fc4ba7caa3df9e4bf905212ad5d06912 | frescobaldi_app/actioncollectionmanager.py | python | ActionCollectionManager.action | (self, collection_name, action_name) | Returns the named action from the named collection. | Returns the named action from the named collection. | [
"Returns",
"the",
"named",
"action",
"from",
"the",
"named",
"collection",
"."
] | def action(self, collection_name, action_name):
"""Returns the named action from the named collection."""
collection = self._actioncollections.get(collection_name)
if collection:
if isinstance(collection, actioncollection.ShortcutCollection):
return collection.realAct... | [
"def",
"action",
"(",
"self",
",",
"collection_name",
",",
"action_name",
")",
":",
"collection",
"=",
"self",
".",
"_actioncollections",
".",
"get",
"(",
"collection_name",
")",
"if",
"collection",
":",
"if",
"isinstance",
"(",
"collection",
",",
"actioncolle... | https://github.com/frescobaldi/frescobaldi/blob/301cc977fc4ba7caa3df9e4bf905212ad5d06912/frescobaldi_app/actioncollectionmanager.py#L75-L81 | ||
archlinux/archweb | 19e5da892ef2af7bf045576f8114c256589e16c4 | todolists/utils.py | python | attach_staging | (packages, list_id) | return annotated | Look for any staging version of the packages provided and attach them
to the 'staging' attribute on each package if found. | Look for any staging version of the packages provided and attach them
to the 'staging' attribute on each package if found. | [
"Look",
"for",
"any",
"staging",
"version",
"of",
"the",
"packages",
"provided",
"and",
"attach",
"them",
"to",
"the",
"staging",
"attribute",
"on",
"each",
"package",
"if",
"found",
"."
] | def attach_staging(packages, list_id):
'''Look for any staging version of the packages provided and attach them
to the 'staging' attribute on each package if found.'''
pkgnames = TodolistPackage.objects.filter(
todolist_id=list_id).values('pkgname')
staging_pkgs = Package.objects.normal().filter... | [
"def",
"attach_staging",
"(",
"packages",
",",
"list_id",
")",
":",
"pkgnames",
"=",
"TodolistPackage",
".",
"objects",
".",
"filter",
"(",
"todolist_id",
"=",
"list_id",
")",
".",
"values",
"(",
"'pkgname'",
")",
"staging_pkgs",
"=",
"Package",
".",
"object... | https://github.com/archlinux/archweb/blob/19e5da892ef2af7bf045576f8114c256589e16c4/todolists/utils.py#L41-L56 | |
openedx/edx-platform | 68dd185a0ab45862a2a61e0f803d7e03d2be71b5 | lms/djangoapps/instructor/views/instructor_dashboard.py | python | is_ecommerce_course | (course_key) | return sku_count > 0 | Checks if the given course is an e-commerce course or not, by checking its SKU value from
CourseMode records for the course | Checks if the given course is an e-commerce course or not, by checking its SKU value from
CourseMode records for the course | [
"Checks",
"if",
"the",
"given",
"course",
"is",
"an",
"e",
"-",
"commerce",
"course",
"or",
"not",
"by",
"checking",
"its",
"SKU",
"value",
"from",
"CourseMode",
"records",
"for",
"the",
"course"
] | def is_ecommerce_course(course_key):
"""
Checks if the given course is an e-commerce course or not, by checking its SKU value from
CourseMode records for the course
"""
sku_count = len([mode.sku for mode in CourseMode.modes_for_course(course_key) if mode.sku])
return sku_count > 0 | [
"def",
"is_ecommerce_course",
"(",
"course_key",
")",
":",
"sku_count",
"=",
"len",
"(",
"[",
"mode",
".",
"sku",
"for",
"mode",
"in",
"CourseMode",
".",
"modes_for_course",
"(",
"course_key",
")",
"if",
"mode",
".",
"sku",
"]",
")",
"return",
"sku_count",... | https://github.com/openedx/edx-platform/blob/68dd185a0ab45862a2a61e0f803d7e03d2be71b5/lms/djangoapps/instructor/views/instructor_dashboard.py#L775-L781 | |
googleads/googleads-python-lib | b3b42a6deedbe6eaa1c9b30183a9eae3f9e9a7ee | examples/adwords/v201809/advanced_operations/add_ad_customizer.py | python | CreateCustomizerFeed | (client, feed_name) | Creates a new AdCustomizerFeed.
Args:
client: an AdWordsClient instance.
feed_name: the name for the new AdCustomizerFeed.
Returns:
The new AdCustomizerFeed. | Creates a new AdCustomizerFeed. | [
"Creates",
"a",
"new",
"AdCustomizerFeed",
"."
] | def CreateCustomizerFeed(client, feed_name):
"""Creates a new AdCustomizerFeed.
Args:
client: an AdWordsClient instance.
feed_name: the name for the new AdCustomizerFeed.
Returns:
The new AdCustomizerFeed.
"""
# Get the AdCustomizerFeedService
ad_customizer_feed_service = client.GetService('Ad... | [
"def",
"CreateCustomizerFeed",
"(",
"client",
",",
"feed_name",
")",
":",
"# Get the AdCustomizerFeedService",
"ad_customizer_feed_service",
"=",
"client",
".",
"GetService",
"(",
"'AdCustomizerFeedService'",
",",
"'v201809'",
")",
"customizer_feed",
"=",
"{",
"'feedName'... | https://github.com/googleads/googleads-python-lib/blob/b3b42a6deedbe6eaa1c9b30183a9eae3f9e9a7ee/examples/adwords/v201809/advanced_operations/add_ad_customizer.py#L82-L125 | ||
zhl2008/awd-platform | 0416b31abea29743387b10b3914581fbe8e7da5e | web_hxb2/lib/python3.5/site-packages/pkg_resources/_vendor/packaging/version.py | python | LegacyVersion.local | (self) | return None | [] | def local(self):
return None | [
"def",
"local",
"(",
"self",
")",
":",
"return",
"None"
] | https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_hxb2/lib/python3.5/site-packages/pkg_resources/_vendor/packaging/version.py#L93-L94 | |||
ulfalizer/Kconfiglib | 061e71f7d78cb057762d88de088055361863deff | kconfiglib.py | python | Kconfig.unset_values | (self) | Removes any user values from all symbols, as if Kconfig.load_config()
or Symbol.set_value() had never been called. | Removes any user values from all symbols, as if Kconfig.load_config()
or Symbol.set_value() had never been called. | [
"Removes",
"any",
"user",
"values",
"from",
"all",
"symbols",
"as",
"if",
"Kconfig",
".",
"load_config",
"()",
"or",
"Symbol",
".",
"set_value",
"()",
"had",
"never",
"been",
"called",
"."
] | def unset_values(self):
"""
Removes any user values from all symbols, as if Kconfig.load_config()
or Symbol.set_value() had never been called.
"""
self._warn_assign_no_prompt = False
try:
# set_value() already rejects undefined symbols, and they don't
... | [
"def",
"unset_values",
"(",
"self",
")",
":",
"self",
".",
"_warn_assign_no_prompt",
"=",
"False",
"try",
":",
"# set_value() already rejects undefined symbols, and they don't",
"# need to be invalidated (because their value never changes), so we",
"# can just iterate over defined symb... | https://github.com/ulfalizer/Kconfiglib/blob/061e71f7d78cb057762d88de088055361863deff/kconfiglib.py#L1990-L2006 | ||
ucfopen/canvasapi | 3f1a71e23c86a49dbaa6e84f6c0e81c297b86e36 | canvasapi/user.py | python | User.get_content_export | (self, content_export, **kwargs) | return ContentExport(self._requester, response.json()) | Return information about a single content export.
:calls: `GET /api/v1/users/:user_id/content_exports/:id\
<https://canvas.instructure.com/doc/api/content_exports.html#method.content_exports_api.show>`_
:param content_export: The object or ID of the content export to show.
:type conten... | Return information about a single content export. | [
"Return",
"information",
"about",
"a",
"single",
"content",
"export",
"."
] | def get_content_export(self, content_export, **kwargs):
"""
Return information about a single content export.
:calls: `GET /api/v1/users/:user_id/content_exports/:id\
<https://canvas.instructure.com/doc/api/content_exports.html#method.content_exports_api.show>`_
:param content_... | [
"def",
"get_content_export",
"(",
"self",
",",
"content_export",
",",
"*",
"*",
"kwargs",
")",
":",
"from",
"canvasapi",
".",
"content_export",
"import",
"ContentExport",
"export_id",
"=",
"obj_or_id",
"(",
"content_export",
",",
"\"content_export\"",
",",
"(",
... | https://github.com/ucfopen/canvasapi/blob/3f1a71e23c86a49dbaa6e84f6c0e81c297b86e36/canvasapi/user.py#L339-L361 | |
twilio/twilio-python | 6e1e811ea57a1edfadd5161ace87397c563f6915 | twilio/rest/api/v2010/account/usage/record/this_month.py | python | ThisMonthInstance.price | (self) | return self._properties['price'] | :returns: The total price of the usage
:rtype: unicode | :returns: The total price of the usage
:rtype: unicode | [
":",
"returns",
":",
"The",
"total",
"price",
"of",
"the",
"usage",
":",
"rtype",
":",
"unicode"
] | def price(self):
"""
:returns: The total price of the usage
:rtype: unicode
"""
return self._properties['price'] | [
"def",
"price",
"(",
"self",
")",
":",
"return",
"self",
".",
"_properties",
"[",
"'price'",
"]"
] | https://github.com/twilio/twilio-python/blob/6e1e811ea57a1edfadd5161ace87397c563f6915/twilio/rest/api/v2010/account/usage/record/this_month.py#L541-L546 | |
Cog-Creators/Red-DiscordBot | b05933274a11fb097873ab0d1b246d37b06aa306 | redbot/cogs/downloader/repo_manager.py | python | RepoManager.delete_repo | (self, name: str) | Delete a repository and its folders.
Parameters
----------
name : str
The name of the repository to delete.
Raises
------
.MissingGitRepo
If the repo does not exist. | Delete a repository and its folders. | [
"Delete",
"a",
"repository",
"and",
"its",
"folders",
"."
] | async def delete_repo(self, name: str) -> None:
"""Delete a repository and its folders.
Parameters
----------
name : str
The name of the repository to delete.
Raises
------
.MissingGitRepo
If the repo does not exist.
"""
... | [
"async",
"def",
"delete_repo",
"(",
"self",
",",
"name",
":",
"str",
")",
"->",
"None",
":",
"repo",
"=",
"self",
".",
"get_repo",
"(",
"name",
")",
"if",
"repo",
"is",
"None",
":",
"raise",
"errors",
".",
"MissingGitRepo",
"(",
"f\"There is no repo with... | https://github.com/Cog-Creators/Red-DiscordBot/blob/b05933274a11fb097873ab0d1b246d37b06aa306/redbot/cogs/downloader/repo_manager.py#L1118-L1142 | ||
serge-sans-paille/pythran | f9f73aa5a965adc4ebcb91a439784dbe9ef911fa | pythran/types/type_dependencies.py | python | TypeDependencies.visit_Assign | (self, node) | In case of assignment assign value depend on r-value type dependencies.
It is valid for subscript, `a[i] = foo()` means `a` type depend on
`foo` return type. | In case of assignment assign value depend on r-value type dependencies. | [
"In",
"case",
"of",
"assignment",
"assign",
"value",
"depend",
"on",
"r",
"-",
"value",
"type",
"dependencies",
"."
] | def visit_Assign(self, node):
"""
In case of assignment assign value depend on r-value type dependencies.
It is valid for subscript, `a[i] = foo()` means `a` type depend on
`foo` return type.
"""
value_deps = self.visit(node.value)
for target in node.targets:
... | [
"def",
"visit_Assign",
"(",
"self",
",",
"node",
")",
":",
"value_deps",
"=",
"self",
".",
"visit",
"(",
"node",
".",
"value",
")",
"for",
"target",
"in",
"node",
".",
"targets",
":",
"name",
"=",
"get_variable",
"(",
"target",
")",
"if",
"isinstance",... | https://github.com/serge-sans-paille/pythran/blob/f9f73aa5a965adc4ebcb91a439784dbe9ef911fa/pythran/types/type_dependencies.py#L330-L341 | ||
aws-samples/aws-kube-codesuite | ab4e5ce45416b83bffb947ab8d234df5437f4fca | src/ipaddress.py | python | _count_righthand_zero_bits | (number, bits) | return min(bits, _compat_bit_length(~number & (number - 1))) | Count the number of zero bits on the right hand side.
Args:
number: an integer.
bits: maximum number of bits to count.
Returns:
The number of zero bits on the right hand side of the number. | Count the number of zero bits on the right hand side. | [
"Count",
"the",
"number",
"of",
"zero",
"bits",
"on",
"the",
"right",
"hand",
"side",
"."
] | def _count_righthand_zero_bits(number, bits):
"""Count the number of zero bits on the right hand side.
Args:
number: an integer.
bits: maximum number of bits to count.
Returns:
The number of zero bits on the right hand side of the number.
"""
if number == 0:
return... | [
"def",
"_count_righthand_zero_bits",
"(",
"number",
",",
"bits",
")",
":",
"if",
"number",
"==",
"0",
":",
"return",
"bits",
"return",
"min",
"(",
"bits",
",",
"_compat_bit_length",
"(",
"~",
"number",
"&",
"(",
"number",
"-",
"1",
")",
")",
")"
] | https://github.com/aws-samples/aws-kube-codesuite/blob/ab4e5ce45416b83bffb947ab8d234df5437f4fca/src/ipaddress.py#L306-L319 | |
Tautulli/Tautulli | 2410eb33805aaac4bd1c5dad0f71e4f15afaf742 | lib/apscheduler/jobstores/base.py | python | BaseJobStore.lookup_job | (self, job_id) | Returns a specific job, or ``None`` if it isn't found..
The job store is responsible for setting the ``scheduler`` and ``jobstore`` attributes of
the returned job to point to the scheduler and itself, respectively.
:param str|unicode job_id: identifier of the job
:rtype: Job | Returns a specific job, or ``None`` if it isn't found.. | [
"Returns",
"a",
"specific",
"job",
"or",
"None",
"if",
"it",
"isn",
"t",
"found",
".."
] | def lookup_job(self, job_id):
"""
Returns a specific job, or ``None`` if it isn't found..
The job store is responsible for setting the ``scheduler`` and ``jobstore`` attributes of
the returned job to point to the scheduler and itself, respectively.
:param str|unicode job_id: id... | [
"def",
"lookup_job",
"(",
"self",
",",
"job_id",
")",
":"
] | https://github.com/Tautulli/Tautulli/blob/2410eb33805aaac4bd1c5dad0f71e4f15afaf742/lib/apscheduler/jobstores/base.py#L68-L77 | ||
kubernetes-client/python | 47b9da9de2d02b2b7a34fbe05afb44afd130d73a | kubernetes/client/api/core_v1_api.py | python | CoreV1Api.create_namespaced_event | (self, namespace, body, **kwargs) | return self.create_namespaced_event_with_http_info(namespace, body, **kwargs) | create_namespaced_event # noqa: E501
create an Event # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.create_namespaced_event(namespace, body, async_req=True)
>>> result = th... | create_namespaced_event # noqa: E501 | [
"create_namespaced_event",
"#",
"noqa",
":",
"E501"
] | def create_namespaced_event(self, namespace, body, **kwargs): # noqa: E501
"""create_namespaced_event # noqa: E501
create an Event # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread... | [
"def",
"create_namespaced_event",
"(",
"self",
",",
"namespace",
",",
"body",
",",
"*",
"*",
"kwargs",
")",
":",
"# noqa: E501",
"kwargs",
"[",
"'_return_http_data_only'",
"]",
"=",
"True",
"return",
"self",
".",
"create_namespaced_event_with_http_info",
"(",
"nam... | https://github.com/kubernetes-client/python/blob/47b9da9de2d02b2b7a34fbe05afb44afd130d73a/kubernetes/client/api/core_v1_api.py#L6879-L6906 | |
google/youtube-8m | e6f6bf682d20bb21904ea9c081c15e070809d914 | readers.py | python | YT8MAggregatedFeatureReader.__init__ | ( # pylint: disable=dangerous-default-value
self,
num_classes=3862,
feature_sizes=[1024, 128],
feature_names=["mean_rgb", "mean_audio"]) | Construct a YT8MAggregatedFeatureReader.
Args:
num_classes: a positive integer for the number of classes.
feature_sizes: positive integer(s) for the feature dimensions as a list.
feature_names: the feature name(s) in the tensorflow record as a list. | Construct a YT8MAggregatedFeatureReader. | [
"Construct",
"a",
"YT8MAggregatedFeatureReader",
"."
] | def __init__( # pylint: disable=dangerous-default-value
self,
num_classes=3862,
feature_sizes=[1024, 128],
feature_names=["mean_rgb", "mean_audio"]):
"""Construct a YT8MAggregatedFeatureReader.
Args:
num_classes: a positive integer for the number of classes.
feature_sizes: ... | [
"def",
"__init__",
"(",
"# pylint: disable=dangerous-default-value",
"self",
",",
"num_classes",
"=",
"3862",
",",
"feature_sizes",
"=",
"[",
"1024",
",",
"128",
"]",
",",
"feature_names",
"=",
"[",
"\"mean_rgb\"",
",",
"\"mean_audio\"",
"]",
")",
":",
"assert",... | https://github.com/google/youtube-8m/blob/e6f6bf682d20bb21904ea9c081c15e070809d914/readers.py#L74-L93 | ||
CGCookie/retopoflow | 3d8b3a47d1d661f99ab0aeb21d31370bf15de35e | addon_common/common/maths.py | python | Size2D.get_width_midmaxmin | (self) | return self._min_width | [] | def get_width_midmaxmin(self):
if self._width is not None: return self._width
if self._max_width is not None: return self._max_width
return self._min_width | [
"def",
"get_width_midmaxmin",
"(",
"self",
")",
":",
"if",
"self",
".",
"_width",
"is",
"not",
"None",
":",
"return",
"self",
".",
"_width",
"if",
"self",
".",
"_max_width",
"is",
"not",
"None",
":",
"return",
"self",
".",
"_max_width",
"return",
"self",... | https://github.com/CGCookie/retopoflow/blob/3d8b3a47d1d661f99ab0aeb21d31370bf15de35e/addon_common/common/maths.py#L1349-L1352 | |||
megvii-model/CrowdDetection | 446f8e688fde679e04c35bd1aa1d4d491646f2eb | model/emd_refine/inference.py | python | inference | (args) | [] | def inference(args):
@jit.trace(symbolic=False)
def val_func():
pred_boxes = net(net.inputs)
return pred_boxes
# model path
model_file = args.resume_weights
assert os.path.exists(model_file)
# load model
net = network.Network()
net.eval()
check_point = mge.load(model_... | [
"def",
"inference",
"(",
"args",
")",
":",
"@",
"jit",
".",
"trace",
"(",
"symbolic",
"=",
"False",
")",
"def",
"val_func",
"(",
")",
":",
"pred_boxes",
"=",
"net",
"(",
"net",
".",
"inputs",
")",
"return",
"pred_boxes",
"# model path",
"model_file",
"... | https://github.com/megvii-model/CrowdDetection/blob/446f8e688fde679e04c35bd1aa1d4d491646f2eb/model/emd_refine/inference.py#L19-L65 | ||||
holzschu/Carnets | 44effb10ddfc6aa5c8b0687582a724ba82c6b547 | Library/lib/python3.7/site-packages/matplotlib-3.0.3-py3.7-macosx-10.9-x86_64.egg/matplotlib/axes/_base.py | python | _AxesBase.set_prop_cycle | (self, *args, **kwargs) | Set the property cycle of the Axes.
The property cycle controls the style properties such as color,
marker and linestyle of future plot commands. The style properties
of data already added to the Axes are not modified.
Call signatures::
set_prop_cycle(cycler)
set_p... | Set the property cycle of the Axes. | [
"Set",
"the",
"property",
"cycle",
"of",
"the",
"Axes",
"."
] | def set_prop_cycle(self, *args, **kwargs):
"""
Set the property cycle of the Axes.
The property cycle controls the style properties such as color,
marker and linestyle of future plot commands. The style properties
of data already added to the Axes are not modified.
Call... | [
"def",
"set_prop_cycle",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"args",
"and",
"kwargs",
":",
"raise",
"TypeError",
"(",
"\"Cannot supply both positional and keyword \"",
"\"arguments to this method.\"",
")",
"# Can't do `args == (None... | https://github.com/holzschu/Carnets/blob/44effb10ddfc6aa5c8b0687582a724ba82c6b547/Library/lib/python3.7/site-packages/matplotlib-3.0.3-py3.7-macosx-10.9-x86_64.egg/matplotlib/axes/_base.py#L1150-L1222 | ||
evennia/evennia | fa79110ba6b219932f22297838e8ac72ebc0be0e | evennia/web/utils/general_context.py | python | set_webclient_settings | () | As with set_game_name_and_slogan above, this sets global variables pertaining
to webclient settings.
Notes:
Used for unit testing. | As with set_game_name_and_slogan above, this sets global variables pertaining
to webclient settings. | [
"As",
"with",
"set_game_name_and_slogan",
"above",
"this",
"sets",
"global",
"variables",
"pertaining",
"to",
"webclient",
"settings",
"."
] | def set_webclient_settings():
"""
As with set_game_name_and_slogan above, this sets global variables pertaining
to webclient settings.
Notes:
Used for unit testing.
"""
global WEBCLIENT_ENABLED, WEBSOCKET_CLIENT_ENABLED, WEBSOCKET_PORT, WEBSOCKET_URL
WEBCLIENT_ENABLED = settings.WEB... | [
"def",
"set_webclient_settings",
"(",
")",
":",
"global",
"WEBCLIENT_ENABLED",
",",
"WEBSOCKET_CLIENT_ENABLED",
",",
"WEBSOCKET_PORT",
",",
"WEBSOCKET_URL",
"WEBCLIENT_ENABLED",
"=",
"settings",
".",
"WEBCLIENT_ENABLED",
"WEBSOCKET_CLIENT_ENABLED",
"=",
"settings",
".",
"... | https://github.com/evennia/evennia/blob/fa79110ba6b219932f22297838e8ac72ebc0be0e/evennia/web/utils/general_context.py#L46-L64 | ||
misterch0c/shadowbroker | e3a069bea47a2c1009697941ac214adc6f90aa8d | windows/Resources/Python/Core/Lib/compiler/syntax.py | python | SyntaxErrorChecker.__init__ | (self, multi=None) | Create new visitor object.
If optional argument multi is not None, then print messages
for each error rather than raising a SyntaxError for the
first. | Create new visitor object.
If optional argument multi is not None, then print messages
for each error rather than raising a SyntaxError for the
first. | [
"Create",
"new",
"visitor",
"object",
".",
"If",
"optional",
"argument",
"multi",
"is",
"not",
"None",
"then",
"print",
"messages",
"for",
"each",
"error",
"rather",
"than",
"raising",
"a",
"SyntaxError",
"for",
"the",
"first",
"."
] | def __init__(self, multi=None):
"""Create new visitor object.
If optional argument multi is not None, then print messages
for each error rather than raising a SyntaxError for the
first.
"""
self.multi = multi
self.errors = 0 | [
"def",
"__init__",
"(",
"self",
",",
"multi",
"=",
"None",
")",
":",
"self",
".",
"multi",
"=",
"multi",
"self",
".",
"errors",
"=",
"0"
] | https://github.com/misterch0c/shadowbroker/blob/e3a069bea47a2c1009697941ac214adc6f90aa8d/windows/Resources/Python/Core/Lib/compiler/syntax.py#L27-L35 | ||
WikidPad/WikidPad | 558109638807bc76b4672922686e416ab2d5f79c | WikidPad/lib/whoosh/reading.py | python | IndexReader.storage | (self) | return None | Returns the :class:`whoosh.filedb.filestore.Storage` object used by
this reader to read its files. If the reader is not atomic,
(``reader.is_atomic() == True``), returns None. | Returns the :class:`whoosh.filedb.filestore.Storage` object used by
this reader to read its files. If the reader is not atomic,
(``reader.is_atomic() == True``), returns None. | [
"Returns",
"the",
":",
"class",
":",
"whoosh",
".",
"filedb",
".",
"filestore",
".",
"Storage",
"object",
"used",
"by",
"this",
"reader",
"to",
"read",
"its",
"files",
".",
"If",
"the",
"reader",
"is",
"not",
"atomic",
"(",
"reader",
".",
"is_atomic",
... | def storage(self):
"""Returns the :class:`whoosh.filedb.filestore.Storage` object used by
this reader to read its files. If the reader is not atomic,
(``reader.is_atomic() == True``), returns None.
"""
return None | [
"def",
"storage",
"(",
"self",
")",
":",
"return",
"None"
] | https://github.com/WikidPad/WikidPad/blob/558109638807bc76b4672922686e416ab2d5f79c/WikidPad/lib/whoosh/reading.py#L177-L183 | |
jgagneastro/coffeegrindsize | 22661ebd21831dba4cf32bfc6ba59fe3d49f879c | App/dist/coffeegrindsize.app/Contents/Resources/lib/python3.7/pandas/io/sql.py | python | to_sql | (frame, name, con, schema=None, if_exists='fail', index=True,
index_label=None, chunksize=None, dtype=None, method=None) | Write records stored in a DataFrame to a SQL database.
Parameters
----------
frame : DataFrame, Series
name : string
Name of SQL table.
con : SQLAlchemy connectable(engine/connection) or database string URI
or sqlite3 DBAPI2 connection
Using SQLAlchemy makes it possible to u... | Write records stored in a DataFrame to a SQL database. | [
"Write",
"records",
"stored",
"in",
"a",
"DataFrame",
"to",
"a",
"SQL",
"database",
"."
] | def to_sql(frame, name, con, schema=None, if_exists='fail', index=True,
index_label=None, chunksize=None, dtype=None, method=None):
"""
Write records stored in a DataFrame to a SQL database.
Parameters
----------
frame : DataFrame, Series
name : string
Name of SQL table.
... | [
"def",
"to_sql",
"(",
"frame",
",",
"name",
",",
"con",
",",
"schema",
"=",
"None",
",",
"if_exists",
"=",
"'fail'",
",",
"index",
"=",
"True",
",",
"index_label",
"=",
"None",
",",
"chunksize",
"=",
"None",
",",
"dtype",
"=",
"None",
",",
"method",
... | https://github.com/jgagneastro/coffeegrindsize/blob/22661ebd21831dba4cf32bfc6ba59fe3d49f879c/App/dist/coffeegrindsize.app/Contents/Resources/lib/python3.7/pandas/io/sql.py#L400-L460 | ||
daoluan/decode-Django | d46a858b45b56de48b0355f50dd9e45402d04cfd | Django-1.5.1/django/utils/timezone.py | python | get_current_timezone | () | return getattr(_active, "value", get_default_timezone()) | Returns the currently active time zone as a tzinfo instance. | Returns the currently active time zone as a tzinfo instance. | [
"Returns",
"the",
"currently",
"active",
"time",
"zone",
"as",
"a",
"tzinfo",
"instance",
"."
] | def get_current_timezone():
"""
Returns the currently active time zone as a tzinfo instance.
"""
return getattr(_active, "value", get_default_timezone()) | [
"def",
"get_current_timezone",
"(",
")",
":",
"return",
"getattr",
"(",
"_active",
",",
"\"value\"",
",",
"get_default_timezone",
"(",
")",
")"
] | https://github.com/daoluan/decode-Django/blob/d46a858b45b56de48b0355f50dd9e45402d04cfd/Django-1.5.1/django/utils/timezone.py#L127-L131 | |
andyzsf/TuShare | 92787ad0cd492614bdb6389b71a19c80d1c8c9ae | tushare/datayes/macro.py | python | Macro.GermanyDataFinance | (self, indicID='', indicName='', beginDate='', endDate='', field='') | return _ret_data(code, result) | 包含德国财政收支数据,具体指标可参见API文档;历史数据从2004年开始,按月更新。 | 包含德国财政收支数据,具体指标可参见API文档;历史数据从2004年开始,按月更新。 | [
"包含德国财政收支数据,具体指标可参见API文档;历史数据从2004年开始,按月更新。"
] | def GermanyDataFinance(self, indicID='', indicName='', beginDate='', endDate='', field=''):
"""
包含德国财政收支数据,具体指标可参见API文档;历史数据从2004年开始,按月更新。
"""
code, result = self.client.getData(vs.GERMANYDATAFINANCE%(indicID, indicName, beginDate, endDate, field))
return _ret_data(code, resu... | [
"def",
"GermanyDataFinance",
"(",
"self",
",",
"indicID",
"=",
"''",
",",
"indicName",
"=",
"''",
",",
"beginDate",
"=",
"''",
",",
"endDate",
"=",
"''",
",",
"field",
"=",
"''",
")",
":",
"code",
",",
"result",
"=",
"self",
".",
"client",
".",
"ge... | https://github.com/andyzsf/TuShare/blob/92787ad0cd492614bdb6389b71a19c80d1c8c9ae/tushare/datayes/macro.py#L1403-L1408 | |
clinton-hall/nzbToMedia | 27669389216902d1085660167e7bda0bd8527ecf | libs/common/setuptools/command/easy_install.py | python | easy_install.check_pth_processing | (self) | return False | Empirically verify whether .pth files are supported in inst. dir | Empirically verify whether .pth files are supported in inst. dir | [
"Empirically",
"verify",
"whether",
".",
"pth",
"files",
"are",
"supported",
"in",
"inst",
".",
"dir"
] | def check_pth_processing(self):
"""Empirically verify whether .pth files are supported in inst. dir"""
instdir = self.install_dir
log.info("Checking .pth file support in %s", instdir)
pth_file = self.pseudo_tempname() + ".pth"
ok_file = pth_file + '.ok'
ok_exists = os.pat... | [
"def",
"check_pth_processing",
"(",
"self",
")",
":",
"instdir",
"=",
"self",
".",
"install_dir",
"log",
".",
"info",
"(",
"\"Checking .pth file support in %s\"",
",",
"instdir",
")",
"pth_file",
"=",
"self",
".",
"pseudo_tempname",
"(",
")",
"+",
"\".pth\"",
... | https://github.com/clinton-hall/nzbToMedia/blob/27669389216902d1085660167e7bda0bd8527ecf/libs/common/setuptools/command/easy_install.py#L537-L594 | |
NoGameNoLife00/mybolg | afe17ea5bfe405e33766e5682c43a4262232ee12 | libs/wtforms/fields/core.py | python | Field.post_validate | (self, form, validation_stopped) | Override if you need to run any field-level validation tasks after
normal validation. This shouldn't be needed in most cases.
:param form: The form the field belongs to.
:param validation_stopped:
`True` if any validator raised StopValidation. | Override if you need to run any field-level validation tasks after
normal validation. This shouldn't be needed in most cases. | [
"Override",
"if",
"you",
"need",
"to",
"run",
"any",
"field",
"-",
"level",
"validation",
"tasks",
"after",
"normal",
"validation",
".",
"This",
"shouldn",
"t",
"be",
"needed",
"in",
"most",
"cases",
"."
] | def post_validate(self, form, validation_stopped):
"""
Override if you need to run any field-level validation tasks after
normal validation. This shouldn't be needed in most cases.
:param form: The form the field belongs to.
:param validation_stopped:
`True` if any v... | [
"def",
"post_validate",
"(",
"self",
",",
"form",
",",
"validation_stopped",
")",
":",
"pass"
] | https://github.com/NoGameNoLife00/mybolg/blob/afe17ea5bfe405e33766e5682c43a4262232ee12/libs/wtforms/fields/core.py#L239-L248 | ||
rdiff-backup/rdiff-backup | 321e0cd6e5e47d4c158a0172e47ab38240a8b653 | src/rdiff_backup/SetConnections.py | python | _init_connection_routing | (conn, conn_number, remote_cmd) | Called by _init_connection, establish routing, conn dict | Called by _init_connection, establish routing, conn dict | [
"Called",
"by",
"_init_connection",
"establish",
"routing",
"conn",
"dict"
] | def _init_connection_routing(conn, conn_number, remote_cmd):
"""Called by _init_connection, establish routing, conn dict"""
Globals.connection_dict[conn_number] = conn
conn.SetConnections.init_connection_remote(conn_number)
for other_remote_conn in Globals.connections[1:]:
conn.SetConnections.a... | [
"def",
"_init_connection_routing",
"(",
"conn",
",",
"conn_number",
",",
"remote_cmd",
")",
":",
"Globals",
".",
"connection_dict",
"[",
"conn_number",
"]",
"=",
"conn",
"conn",
".",
"SetConnections",
".",
"init_connection_remote",
"(",
"conn_number",
")",
"for",
... | https://github.com/rdiff-backup/rdiff-backup/blob/321e0cd6e5e47d4c158a0172e47ab38240a8b653/src/rdiff_backup/SetConnections.py#L444-L454 | ||
softlayer/softlayer-python | cdef7d63c66413197a9a97b0414de9f95887a82a | SoftLayer/CLI/loadbal/layer7_policy_list.py | python | policies | (env, protocol_id) | List policies of the front-end protocol (listener). | List policies of the front-end protocol (listener). | [
"List",
"policies",
"of",
"the",
"front",
"-",
"end",
"protocol",
"(",
"listener",
")",
"."
] | def policies(env, protocol_id):
"""List policies of the front-end protocol (listener)."""
mgr = SoftLayer.LoadBalancerManager(env.client)
if protocol_id:
l7policies = mgr.get_l7policies(protocol_id)
table = generate_l7policies_table(l7policies, protocol_id)
else:
l7policies = mg... | [
"def",
"policies",
"(",
"env",
",",
"protocol_id",
")",
":",
"mgr",
"=",
"SoftLayer",
".",
"LoadBalancerManager",
"(",
"env",
".",
"client",
")",
"if",
"protocol_id",
":",
"l7policies",
"=",
"mgr",
".",
"get_l7policies",
"(",
"protocol_id",
")",
"table",
"... | https://github.com/softlayer/softlayer-python/blob/cdef7d63c66413197a9a97b0414de9f95887a82a/SoftLayer/CLI/loadbal/layer7_policy_list.py#L15-L25 | ||
pymeasure/pymeasure | b4d888e9ead85ef7f7af0031f2dbb44c9ce1825e | pymeasure/adapters/vxi11.py | python | VXI11Adapter.read | (self) | return self.connection.read() | Wrapper function for the read command using the
vx11 interface.
:return string containing a response from the device. | Wrapper function for the read command using the
vx11 interface. | [
"Wrapper",
"function",
"for",
"the",
"read",
"command",
"using",
"the",
"vx11",
"interface",
"."
] | def read(self):
""" Wrapper function for the read command using the
vx11 interface.
:return string containing a response from the device.
"""
return self.connection.read() | [
"def",
"read",
"(",
"self",
")",
":",
"return",
"self",
".",
"connection",
".",
"read",
"(",
")"
] | https://github.com/pymeasure/pymeasure/blob/b4d888e9ead85ef7f7af0031f2dbb44c9ce1825e/pymeasure/adapters/vxi11.py#L68-L74 | |
postlund/pyatv | 4ed1f5539f37d86d80272663d1f2ea34a6c41ec4 | pyatv/conf.py | python | AppleTV.deep_sleep | (self) | return self._deep_sleep | If device is in deep sleep. | If device is in deep sleep. | [
"If",
"device",
"is",
"in",
"deep",
"sleep",
"."
] | def deep_sleep(self) -> bool:
"""If device is in deep sleep."""
return self._deep_sleep | [
"def",
"deep_sleep",
"(",
"self",
")",
"->",
"bool",
":",
"return",
"self",
".",
"_deep_sleep"
] | https://github.com/postlund/pyatv/blob/4ed1f5539f37d86d80272663d1f2ea34a6c41ec4/pyatv/conf.py#L51-L53 | |
yuantiku/fairseq-gec | 10aafebc482706346f768e4f18a9813153cb1ecc | fairseq/tasks/fairseq_task.py | python | FairseqTask.setup_task | (cls, args, **kwargs) | return cls(args) | Setup the task (e.g., load dictionaries).
Args:
args (argparse.Namespace): parsed command-line arguments | Setup the task (e.g., load dictionaries). | [
"Setup",
"the",
"task",
"(",
"e",
".",
"g",
".",
"load",
"dictionaries",
")",
"."
] | def setup_task(cls, args, **kwargs):
"""Setup the task (e.g., load dictionaries).
Args:
args (argparse.Namespace): parsed command-line arguments
"""
return cls(args) | [
"def",
"setup_task",
"(",
"cls",
",",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"cls",
"(",
"args",
")"
] | https://github.com/yuantiku/fairseq-gec/blob/10aafebc482706346f768e4f18a9813153cb1ecc/fairseq/tasks/fairseq_task.py#L59-L65 | |
ceph/ceph-ansible | 583e60af84180f0414d67ee52c3ec7cd64ddb4dd | library/radosgw_zone.py | python | get_zonegroup | (module, container_image=None) | return cmd | Get existing zonegroup | Get existing zonegroup | [
"Get",
"existing",
"zonegroup"
] | def get_zonegroup(module, container_image=None):
'''
Get existing zonegroup
'''
cluster = module.params.get('cluster')
realm = module.params.get('realm')
zonegroup = module.params.get('zonegroup')
cmd = pre_generate_radosgw_cmd(container_image=container_image)
args = [
'--clus... | [
"def",
"get_zonegroup",
"(",
"module",
",",
"container_image",
"=",
"None",
")",
":",
"cluster",
"=",
"module",
".",
"params",
".",
"get",
"(",
"'cluster'",
")",
"realm",
"=",
"module",
".",
"params",
".",
"get",
"(",
"'realm'",
")",
"zonegroup",
"=",
... | https://github.com/ceph/ceph-ansible/blob/583e60af84180f0414d67ee52c3ec7cd64ddb4dd/library/radosgw_zone.py#L310-L333 | |
google/pytype | fa43edc95dd42ade6e3147d6580d63e778c9d506 | pytype/metrics.py | python | get_cpu_clock | () | return time.process_time() | Returns CPU clock to keep compatibility with various Python versions. | Returns CPU clock to keep compatibility with various Python versions. | [
"Returns",
"CPU",
"clock",
"to",
"keep",
"compatibility",
"with",
"various",
"Python",
"versions",
"."
] | def get_cpu_clock():
"""Returns CPU clock to keep compatibility with various Python versions."""
return time.process_time() | [
"def",
"get_cpu_clock",
"(",
")",
":",
"return",
"time",
".",
"process_time",
"(",
")"
] | https://github.com/google/pytype/blob/fa43edc95dd42ade6e3147d6580d63e778c9d506/pytype/metrics.py#L89-L91 | |
tanghaibao/goatools | 647e9dd833695f688cd16c2f9ea18f1692e5c6bc | goatools/gosubdag/plot/go_edge.py | python | GoEdge.__init__ | (self, gosubdag, optobj) | [] | def __init__(self, gosubdag, optobj):
self.gosubdag = gosubdag # GoSubDag
self.kws = optobj.get_kws() | [
"def",
"__init__",
"(",
"self",
",",
"gosubdag",
",",
"optobj",
")",
":",
"self",
".",
"gosubdag",
"=",
"gosubdag",
"# GoSubDag",
"self",
".",
"kws",
"=",
"optobj",
".",
"get_kws",
"(",
")"
] | https://github.com/tanghaibao/goatools/blob/647e9dd833695f688cd16c2f9ea18f1692e5c6bc/goatools/gosubdag/plot/go_edge.py#L47-L49 | ||||
Tautulli/Tautulli | 2410eb33805aaac4bd1c5dad0f71e4f15afaf742 | lib/cherrypy/lib/sessions.py | python | Session.__init__ | (self, id=None, **kwargs) | [] | def __init__(self, id=None, **kwargs):
self.id_observers = []
self._data = {}
for k, v in kwargs.items():
setattr(self, k, v)
self.originalid = id
self.missing = False
if id is None:
if self.debug:
cherrypy.log('No id given; makin... | [
"def",
"__init__",
"(",
"self",
",",
"id",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"self",
".",
"id_observers",
"=",
"[",
"]",
"self",
".",
"_data",
"=",
"{",
"}",
"for",
"k",
",",
"v",
"in",
"kwargs",
".",
"items",
"(",
")",
":",
"se... | https://github.com/Tautulli/Tautulli/blob/2410eb33805aaac4bd1c5dad0f71e4f15afaf742/lib/cherrypy/lib/sessions.py#L177-L203 | ||||
accel-brain/accel-brain-code | 86f489dc9be001a3bae6d053f48d6b57c0bedb95 | Generative-Adversarial-Networks/pygan/controllablemodel/_mxnet/gancontroller/cluster_gan_controller.py | python | ClusterGANController.train_clusterer | (self) | return total_g_loss, total_posterior | Train clusterer.
Returns:
Tuple data.
- generative loss.
- discriminative posterior. | Train clusterer.
Returns:
Tuple data.
- generative loss.
- discriminative posterior. | [
"Train",
"clusterer",
".",
"Returns",
":",
"Tuple",
"data",
".",
"-",
"generative",
"loss",
".",
"-",
"discriminative",
"posterior",
"."
] | def train_clusterer(self):
'''
Train clusterer.
Returns:
Tuple data.
- generative loss.
- discriminative posterior.
'''
total_g_loss = 0.0
total_posterior = 0.0
for g in range(self.g_step):
with autograd.rec... | [
"def",
"train_clusterer",
"(",
"self",
")",
":",
"total_g_loss",
"=",
"0.0",
"total_posterior",
"=",
"0.0",
"for",
"g",
"in",
"range",
"(",
"self",
".",
"g_step",
")",
":",
"with",
"autograd",
".",
"record",
"(",
")",
":",
"with",
"autograd",
".",
"pre... | https://github.com/accel-brain/accel-brain-code/blob/86f489dc9be001a3bae6d053f48d6b57c0bedb95/Generative-Adversarial-Networks/pygan/controllablemodel/_mxnet/gancontroller/cluster_gan_controller.py#L367-L422 | |
PyHDI/veriloggen | 2382d200deabf59cfcfd741f5eba371010aaf2bb | veriloggen/types/fixed.py | python | _FixedGreaterEq.__init__ | (self, left, right) | [] | def __init__(self, left, right):
left, right = self.init(left, right)
vtypes.GreaterEq.__init__(self, left, right) | [
"def",
"__init__",
"(",
"self",
",",
"left",
",",
"right",
")",
":",
"left",
",",
"right",
"=",
"self",
".",
"init",
"(",
"left",
",",
"right",
")",
"vtypes",
".",
"GreaterEq",
".",
"__init__",
"(",
"self",
",",
"left",
",",
"right",
")"
] | https://github.com/PyHDI/veriloggen/blob/2382d200deabf59cfcfd741f5eba371010aaf2bb/veriloggen/types/fixed.py#L615-L617 | ||||
securesystemslab/zippy | ff0e84ac99442c2c55fe1d285332cfd4e185e089 | zippy/benchmarks/src/benchmarks/sympy/sympy/matrices/expressions/matexpr.py | python | MatrixExpr.__rmul__ | (self, other) | return MatMul(other, self).doit() | [] | def __rmul__(self, other):
return MatMul(other, self).doit() | [
"def",
"__rmul__",
"(",
"self",
",",
"other",
")",
":",
"return",
"MatMul",
"(",
"other",
",",
"self",
")",
".",
"doit",
"(",
")"
] | https://github.com/securesystemslab/zippy/blob/ff0e84ac99442c2c55fe1d285332cfd4e185e089/zippy/benchmarks/src/benchmarks/sympy/sympy/matrices/expressions/matexpr.py#L104-L105 | |||
vyos/vyos-1x | 6e8a8934a7d4e1b21d7c828e372303683b499b56 | python/vyos/configdict.py | python | node_changed | (conf, path, key_mangling=None) | return list(keys) | Check if a leaf node was altered. If it has been altered - values has been
changed, or it was added/removed, we will return the old value. If nothing
has been changed, None is returned | Check if a leaf node was altered. If it has been altered - values has been
changed, or it was added/removed, we will return the old value. If nothing
has been changed, None is returned | [
"Check",
"if",
"a",
"leaf",
"node",
"was",
"altered",
".",
"If",
"it",
"has",
"been",
"altered",
"-",
"values",
"has",
"been",
"changed",
"or",
"it",
"was",
"added",
"/",
"removed",
"we",
"will",
"return",
"the",
"old",
"value",
".",
"If",
"nothing",
... | def node_changed(conf, path, key_mangling=None):
"""
Check if a leaf node was altered. If it has been altered - values has been
changed, or it was added/removed, we will return the old value. If nothing
has been changed, None is returned
"""
from vyos.configdiff import get_config_diff, Diff
... | [
"def",
"node_changed",
"(",
"conf",
",",
"path",
",",
"key_mangling",
"=",
"None",
")",
":",
"from",
"vyos",
".",
"configdiff",
"import",
"get_config_diff",
",",
"Diff",
"D",
"=",
"get_config_diff",
"(",
"conf",
",",
"key_mangling",
")",
"D",
".",
"set_lev... | https://github.com/vyos/vyos-1x/blob/6e8a8934a7d4e1b21d7c828e372303683b499b56/python/vyos/configdict.py#L133-L144 | |
ipfs-shipyard/py-ipfs-http-client | f04ff601556f8429837eb7d4851fe02913f72f63 | ipfshttpclient/client/base.py | python | ResponseBase.__iter__ | (self) | return iter(self._raw) | [] | def __iter__(self) -> ty.Iterator[str]:
return iter(self._raw) | [
"def",
"__iter__",
"(",
"self",
")",
"->",
"ty",
".",
"Iterator",
"[",
"str",
"]",
":",
"return",
"iter",
"(",
"self",
".",
"_raw",
")"
] | https://github.com/ipfs-shipyard/py-ipfs-http-client/blob/f04ff601556f8429837eb7d4851fe02913f72f63/ipfshttpclient/client/base.py#L96-L97 | |||
samoturk/mol2vec | 850d944d5f48a58e26ed0264332b5741f72555aa | mol2vec/features.py | python | generate_corpus | (in_file, out_file, r, sentence_type='alt', n_jobs=1) | Generates corpus file from sdf
Parameters
----------
in_file : str
Input sdf
out_file : str
Outfile name prefix, suffix is either _r0, _r1, etc. or _alt_r1 (max radius in alt sentence)
r : int
Radius of morgan fingerprint
sentence_type : str
Options: 'all'... | Generates corpus file from sdf
Parameters
----------
in_file : str
Input sdf
out_file : str
Outfile name prefix, suffix is either _r0, _r1, etc. or _alt_r1 (max radius in alt sentence)
r : int
Radius of morgan fingerprint
sentence_type : str
Options: 'all'... | [
"Generates",
"corpus",
"file",
"from",
"sdf",
"Parameters",
"----------",
"in_file",
":",
"str",
"Input",
"sdf",
"out_file",
":",
"str",
"Outfile",
"name",
"prefix",
"suffix",
"is",
"either",
"_r0",
"_r1",
"etc",
".",
"or",
"_alt_r1",
"(",
"max",
"radius",
... | def generate_corpus(in_file, out_file, r, sentence_type='alt', n_jobs=1):
"""Generates corpus file from sdf
Parameters
----------
in_file : str
Input sdf
out_file : str
Outfile name prefix, suffix is either _r0, _r1, etc. or _alt_r1 (max radius in alt sentence)
r : int
... | [
"def",
"generate_corpus",
"(",
"in_file",
",",
"out_file",
",",
"r",
",",
"sentence_type",
"=",
"'alt'",
",",
"n_jobs",
"=",
"1",
")",
":",
"# File type detection",
"in_split",
"=",
"in_file",
".",
"split",
"(",
"'.'",
")",
"if",
"in_split",
"[",
"-",
"1... | https://github.com/samoturk/mol2vec/blob/850d944d5f48a58e26ed0264332b5741f72555aa/mol2vec/features.py#L189-L277 | ||
chainer/chainercv | 7159616642e0be7c5b3ef380b848e16b7e99355b | chainercv/links/model/senet/se_resnet.py | python | SEResNet.__init__ | (self, n_layer,
n_class=None,
pretrained_model=None,
mean=None, initialW=None, fc_kwargs={}) | [] | def __init__(self, n_layer,
n_class=None,
pretrained_model=None,
mean=None, initialW=None, fc_kwargs={}):
blocks = self._blocks[n_layer]
param, path = utils.prepare_pretrained_model(
{'n_class': n_class, 'mean': mean},
pretraine... | [
"def",
"__init__",
"(",
"self",
",",
"n_layer",
",",
"n_class",
"=",
"None",
",",
"pretrained_model",
"=",
"None",
",",
"mean",
"=",
"None",
",",
"initialW",
"=",
"None",
",",
"fc_kwargs",
"=",
"{",
"}",
")",
":",
"blocks",
"=",
"self",
".",
"_blocks... | https://github.com/chainer/chainercv/blob/7159616642e0be7c5b3ef380b848e16b7e99355b/chainercv/links/model/senet/se_resnet.py#L104-L142 | ||||
gcovr/gcovr | 09e89b5287fa5a11408a208cb34aea0efd19d4f5 | noxfile.py | python | upload_wheel | (session: nox.Session) | Upload the wheel. | Upload the wheel. | [
"Upload",
"the",
"wheel",
"."
] | def upload_wheel(session: nox.Session) -> None:
"""Upload the wheel."""
session.install("twine")
session.run("twine", "upload", "dist/*", external=True) | [
"def",
"upload_wheel",
"(",
"session",
":",
"nox",
".",
"Session",
")",
"->",
"None",
":",
"session",
".",
"install",
"(",
"\"twine\"",
")",
"session",
".",
"run",
"(",
"\"twine\"",
",",
"\"upload\"",
",",
"\"dist/*\"",
",",
"external",
"=",
"True",
")"
... | https://github.com/gcovr/gcovr/blob/09e89b5287fa5a11408a208cb34aea0efd19d4f5/noxfile.py#L183-L186 | ||
chribsen/simple-machine-learning-examples | dc94e52a4cebdc8bb959ff88b81ff8cfeca25022 | venv/lib/python2.7/site-packages/setuptools/command/egg_info.py | python | FileList._repair | (self) | Replace self.files with only safe paths
Because some owners of FileList manipulate the underlying
``files`` attribute directly, this method must be called to
repair those paths. | Replace self.files with only safe paths | [
"Replace",
"self",
".",
"files",
"with",
"only",
"safe",
"paths"
] | def _repair(self):
"""
Replace self.files with only safe paths
Because some owners of FileList manipulate the underlying
``files`` attribute directly, this method must be called to
repair those paths.
"""
self.files = list(filter(self._safe_path, self.files)) | [
"def",
"_repair",
"(",
"self",
")",
":",
"self",
".",
"files",
"=",
"list",
"(",
"filter",
"(",
"self",
".",
"_safe_path",
",",
"self",
".",
"files",
")",
")"
] | https://github.com/chribsen/simple-machine-learning-examples/blob/dc94e52a4cebdc8bb959ff88b81ff8cfeca25022/venv/lib/python2.7/site-packages/setuptools/command/egg_info.py#L483-L491 | ||
ilastik/ilastik | 6acd2c554bc517e9c8ddad3623a7aaa2e6970c28 | lazyflow/request/request.py | python | Request.reset_thread_pool | (cls, num_workers=min(multiprocessing.cpu_count(), 8)) | Change the number of threads allocated to the request system.
:param num_workers: How many threads to create in the threadpool.
Note: Beyond a certain point, we don't benefit from extra
workers, even on machines with many CPUs.
... | Change the number of threads allocated to the request system. | [
"Change",
"the",
"number",
"of",
"threads",
"allocated",
"to",
"the",
"request",
"system",
"."
] | def reset_thread_pool(cls, num_workers=min(multiprocessing.cpu_count(), 8)):
"""
Change the number of threads allocated to the request system.
:param num_workers: How many threads to create in the threadpool.
Note: Beyond a certain point, we don't benefit from extra
... | [
"def",
"reset_thread_pool",
"(",
"cls",
",",
"num_workers",
"=",
"min",
"(",
"multiprocessing",
".",
"cpu_count",
"(",
")",
",",
"8",
")",
")",
":",
"with",
"cls",
".",
"class_lock",
":",
"active_count",
"=",
"0",
"if",
"cls",
".",
"global_thread_pool",
... | https://github.com/ilastik/ilastik/blob/6acd2c554bc517e9c8ddad3623a7aaa2e6970c28/lazyflow/request/request.py#L121-L145 | ||
magenta/magenta | be6558f1a06984faff6d6949234f5fe9ad0ffdb5 | magenta/models/image_stylization/image_utils.py | python | load_np_image_uint8 | (image_file) | Loads an image as a numpy array.
Args:
image_file: str. Image file.
Returns:
A 3-D numpy array of shape [image_size, image_size, 3] and dtype uint8,
with values in [0, 255]. | Loads an image as a numpy array. | [
"Loads",
"an",
"image",
"as",
"a",
"numpy",
"array",
"."
] | def load_np_image_uint8(image_file):
"""Loads an image as a numpy array.
Args:
image_file: str. Image file.
Returns:
A 3-D numpy array of shape [image_size, image_size, 3] and dtype uint8,
with values in [0, 255].
"""
with tempfile.NamedTemporaryFile() as f:
f.write(tf.gfile.GFile(image_file... | [
"def",
"load_np_image_uint8",
"(",
"image_file",
")",
":",
"with",
"tempfile",
".",
"NamedTemporaryFile",
"(",
")",
"as",
"f",
":",
"f",
".",
"write",
"(",
"tf",
".",
"gfile",
".",
"GFile",
"(",
"image_file",
",",
"'rb'",
")",
".",
"read",
"(",
")",
... | https://github.com/magenta/magenta/blob/be6558f1a06984faff6d6949234f5fe9ad0ffdb5/magenta/models/image_stylization/image_utils.py#L385-L402 | ||
IronLanguages/main | a949455434b1fda8c783289e897e78a9a0caabb5 | External.LCA_RESTRICTED/Languages/IronPython/27/Lib/xmlrpclib.py | python | ServerProxy.__call__ | (self, attr) | A workaround to get special attributes on the ServerProxy
without interfering with the magic __getattr__ | A workaround to get special attributes on the ServerProxy
without interfering with the magic __getattr__ | [
"A",
"workaround",
"to",
"get",
"special",
"attributes",
"on",
"the",
"ServerProxy",
"without",
"interfering",
"with",
"the",
"magic",
"__getattr__"
] | def __call__(self, attr):
"""A workaround to get special attributes on the ServerProxy
without interfering with the magic __getattr__
"""
if attr == "close":
return self.__close
elif attr == "transport":
return self.__transport
raise AttributeEr... | [
"def",
"__call__",
"(",
"self",
",",
"attr",
")",
":",
"if",
"attr",
"==",
"\"close\"",
":",
"return",
"self",
".",
"__close",
"elif",
"attr",
"==",
"\"transport\"",
":",
"return",
"self",
".",
"__transport",
"raise",
"AttributeError",
"(",
"\"Attribute %r n... | https://github.com/IronLanguages/main/blob/a949455434b1fda8c783289e897e78a9a0caabb5/External.LCA_RESTRICTED/Languages/IronPython/27/Lib/xmlrpclib.py#L1625-L1633 | ||
whoosh-community/whoosh | 5421f1ab3bb802114105b3181b7ce4f44ad7d0bb | src/whoosh/searching.py | python | Results.__iter__ | (self) | Yields a :class:`Hit` object for each result in ranked order. | Yields a :class:`Hit` object for each result in ranked order. | [
"Yields",
"a",
":",
"class",
":",
"Hit",
"object",
"for",
"each",
"result",
"in",
"ranked",
"order",
"."
] | def __iter__(self):
"""Yields a :class:`Hit` object for each result in ranked order.
"""
for i in xrange(len(self.top_n)):
yield Hit(self, self.top_n[i][1], i, self.top_n[i][0]) | [
"def",
"__iter__",
"(",
"self",
")",
":",
"for",
"i",
"in",
"xrange",
"(",
"len",
"(",
"self",
".",
"top_n",
")",
")",
":",
"yield",
"Hit",
"(",
"self",
",",
"self",
".",
"top_n",
"[",
"i",
"]",
"[",
"1",
"]",
",",
"i",
",",
"self",
".",
"t... | https://github.com/whoosh-community/whoosh/blob/5421f1ab3bb802114105b3181b7ce4f44ad7d0bb/src/whoosh/searching.py#L1000-L1005 | ||
kanzure/nanoengineer | 874e4c9f8a9190f093625b267f9767e19f82e6c4 | cad/src/cnt/commands/EditNanotube/EditNanotube_GraphicsMode.py | python | EditNanotube_GraphicsMode.leftUp | (self, event) | return | Method called during Left up event. | Method called during Left up event. | [
"Method",
"called",
"during",
"Left",
"up",
"event",
"."
] | def leftUp(self, event):
"""
Method called during Left up event.
"""
_superclass.leftUp(self, event)
self.update_selobj(event)
self.update_cursor()
self.o.gl_update()
#Reset the flag that decides whether to draw the handles. This flag is
#set duri... | [
"def",
"leftUp",
"(",
"self",
",",
"event",
")",
":",
"_superclass",
".",
"leftUp",
"(",
"self",
",",
"event",
")",
"self",
".",
"update_selobj",
"(",
"event",
")",
"self",
".",
"update_cursor",
"(",
")",
"self",
".",
"o",
".",
"gl_update",
"(",
")",... | https://github.com/kanzure/nanoengineer/blob/874e4c9f8a9190f093625b267f9767e19f82e6c4/cad/src/cnt/commands/EditNanotube/EditNanotube_GraphicsMode.py#L272-L289 | |
junsukchoe/ADL | dab2e78163bd96970ec9ae41de62835332dbf4fe | tensorpack/train/base.py | python | Trainer.main_loop | (self, steps_per_epoch, starting_epoch, max_epoch) | Run the main training loop.
Args:
steps_per_epoch, starting_epoch, max_epoch (int): | Run the main training loop. | [
"Run",
"the",
"main",
"training",
"loop",
"."
] | def main_loop(self, steps_per_epoch, starting_epoch, max_epoch):
"""
Run the main training loop.
Args:
steps_per_epoch, starting_epoch, max_epoch (int):
"""
with self.sess.as_default():
self.loop.config(steps_per_epoch, starting_epoch, max_epoch)
... | [
"def",
"main_loop",
"(",
"self",
",",
"steps_per_epoch",
",",
"starting_epoch",
",",
"max_epoch",
")",
":",
"with",
"self",
".",
"sess",
".",
"as_default",
"(",
")",
":",
"self",
".",
"loop",
".",
"config",
"(",
"steps_per_epoch",
",",
"starting_epoch",
",... | https://github.com/junsukchoe/ADL/blob/dab2e78163bd96970ec9ae41de62835332dbf4fe/tensorpack/train/base.py#L256-L295 | ||
wakatime/komodo-wakatime | 8923c04ded9fa64d7374fadd8cde3a6fadfe053d | components/wakatime/packages/pygments/modeline.py | python | get_filetype_from_buffer | (buf, max_lines=5) | return None | Scan the buffer for modelines and return filetype if one is found. | Scan the buffer for modelines and return filetype if one is found. | [
"Scan",
"the",
"buffer",
"for",
"modelines",
"and",
"return",
"filetype",
"if",
"one",
"is",
"found",
"."
] | def get_filetype_from_buffer(buf, max_lines=5):
"""
Scan the buffer for modelines and return filetype if one is found.
"""
lines = buf.splitlines()
for l in lines[-1:-max_lines-1:-1]:
ret = get_filetype_from_line(l)
if ret:
return ret
for i in range(max_lines, -1, -1)... | [
"def",
"get_filetype_from_buffer",
"(",
"buf",
",",
"max_lines",
"=",
"5",
")",
":",
"lines",
"=",
"buf",
".",
"splitlines",
"(",
")",
"for",
"l",
"in",
"lines",
"[",
"-",
"1",
":",
"-",
"max_lines",
"-",
"1",
":",
"-",
"1",
"]",
":",
"ret",
"=",... | https://github.com/wakatime/komodo-wakatime/blob/8923c04ded9fa64d7374fadd8cde3a6fadfe053d/components/wakatime/packages/pygments/modeline.py#L29-L44 | |
eblot/pyftdi | 72797e5ae0945d6f771f13102d7fccac255d83d7 | pyftdi/misc.py | python | EasyDict.mirror | (self) | return EasyDict({v: k for k, v in self.items()}) | Instanciate a mirror EasyDict. | Instanciate a mirror EasyDict. | [
"Instanciate",
"a",
"mirror",
"EasyDict",
"."
] | def mirror(self) -> 'EasyDict':
"""Instanciate a mirror EasyDict."""
return EasyDict({v: k for k, v in self.items()}) | [
"def",
"mirror",
"(",
"self",
")",
"->",
"'EasyDict'",
":",
"return",
"EasyDict",
"(",
"{",
"v",
":",
"k",
"for",
"k",
",",
"v",
"in",
"self",
".",
"items",
"(",
")",
"}",
")"
] | https://github.com/eblot/pyftdi/blob/72797e5ae0945d6f771f13102d7fccac255d83d7/pyftdi/misc.py#L343-L345 | |
dimagi/commcare-hq | d67ff1d3b4c51fa050c19e60c3253a79d3452a39 | corehq/apps/case_search/models.py | python | _flatten_multi_value_dict_values | (value) | return {k: _flatten_singleton_list(v) for k, v in value.items()} | [] | def _flatten_multi_value_dict_values(value):
return {k: _flatten_singleton_list(v) for k, v in value.items()} | [
"def",
"_flatten_multi_value_dict_values",
"(",
"value",
")",
":",
"return",
"{",
"k",
":",
"_flatten_singleton_list",
"(",
"v",
")",
"for",
"k",
",",
"v",
"in",
"value",
".",
"items",
"(",
")",
"}"
] | https://github.com/dimagi/commcare-hq/blob/d67ff1d3b4c51fa050c19e60c3253a79d3452a39/corehq/apps/case_search/models.py#L40-L41 | |||
openassistant/oa-core | 5e8151edff872d7810ad4580add4fb8d9fdc1081 | oa/modules/mind/__init__.py | python | set_mind | (name, history=True) | return oa.legacy.mind | Activate new mind. | Activate new mind. | [
"Activate",
"new",
"mind",
"."
] | def set_mind(name, history=True):
""" Activate new mind. """
_logger.info('Opening Mind: {}'.format(name))
if history:
_history.append(name)
oa.legacy.mind = oa.legacy.minds[name]
return oa.legacy.mind | [
"def",
"set_mind",
"(",
"name",
",",
"history",
"=",
"True",
")",
":",
"_logger",
".",
"info",
"(",
"'Opening Mind: {}'",
".",
"format",
"(",
"name",
")",
")",
"if",
"history",
":",
"_history",
".",
"append",
"(",
"name",
")",
"oa",
".",
"legacy",
".... | https://github.com/openassistant/oa-core/blob/5e8151edff872d7810ad4580add4fb8d9fdc1081/oa/modules/mind/__init__.py#L41-L48 | |
biolab/orange2 | db40a9449cb45b507d63dcd5739b223f9cffb8e6 | Orange/OrangeCanvas/registry/description.py | python | CategoryDescription.from_package | (cls, package) | return CategoryDescription(
name=name,
qualified_name=qualified_name,
description=description,
long_description=long_description,
help=help,
author=author,
author_email=author_email,
maintainer=maintainer,
mainta... | Get the CategoryDescription from a package.
Parameters
----------
package : `module` or `str`
A package containing the category. | Get the CategoryDescription from a package. | [
"Get",
"the",
"CategoryDescription",
"from",
"a",
"package",
"."
] | def from_package(cls, package):
"""
Get the CategoryDescription from a package.
Parameters
----------
package : `module` or `str`
A package containing the category.
"""
if isinstance(package, basestring):
package = __import__(package, fro... | [
"def",
"from_package",
"(",
"cls",
",",
"package",
")",
":",
"if",
"isinstance",
"(",
"package",
",",
"basestring",
")",
":",
"package",
"=",
"__import__",
"(",
"package",
",",
"fromlist",
"=",
"[",
"\"\"",
"]",
")",
"package_name",
"=",
"package",
".",
... | https://github.com/biolab/orange2/blob/db40a9449cb45b507d63dcd5739b223f9cffb8e6/Orange/OrangeCanvas/registry/description.py#L522-L573 | |
criteo/biggraphite | 1f647ada6b3f2b2f3fb4e59d326f73a2c891fc30 | tools/elasticsearch/import-metrics.py | python | create_metric | (es, row, labels=None) | Create a metric. | Create a metric. | [
"Create",
"a",
"metric",
"."
] | def create_metric(es, row, labels=None):
"""Create a metric."""
metric, config, created_on, uid, read_on, updated_on = row
print(metric, labels)
if labels:
# Make sure there are no collisions for labelled metrics
doc_id = chr((ord(uid[0]) + 1) % 254) + uid[1:]
else:
doc_id =... | [
"def",
"create_metric",
"(",
"es",
",",
"row",
",",
"labels",
"=",
"None",
")",
":",
"metric",
",",
"config",
",",
"created_on",
",",
"uid",
",",
"read_on",
",",
"updated_on",
"=",
"row",
"print",
"(",
"metric",
",",
"labels",
")",
"if",
"labels",
":... | https://github.com/criteo/biggraphite/blob/1f647ada6b3f2b2f3fb4e59d326f73a2c891fc30/tools/elasticsearch/import-metrics.py#L114-L131 | ||
tp4a/teleport | 1fafd34f1f775d2cf80ea4af6e44468d8e0b24ad | server/www/packages/packages-darwin/x64/cryptography/hazmat/backends/openssl/decode_asn1.py | python | _decode_general_name | (backend, gn) | [] | def _decode_general_name(backend, gn):
if gn.type == backend._lib.GEN_DNS:
# Convert to bytes and then decode to utf8. We don't use
# asn1_string_to_utf8 here because it doesn't properly convert
# utf8 from ia5strings.
data = _asn1_string_to_bytes(backend, gn.d.dNSName).decode("utf8"... | [
"def",
"_decode_general_name",
"(",
"backend",
",",
"gn",
")",
":",
"if",
"gn",
".",
"type",
"==",
"backend",
".",
"_lib",
".",
"GEN_DNS",
":",
"# Convert to bytes and then decode to utf8. We don't use",
"# asn1_string_to_utf8 here because it doesn't properly convert",
"# u... | https://github.com/tp4a/teleport/blob/1fafd34f1f775d2cf80ea4af6e44468d8e0b24ad/server/www/packages/packages-darwin/x64/cryptography/hazmat/backends/openssl/decode_asn1.py#L89-L164 | ||||
cogitas3d/OrtogOnBlender | 881e93f5beb2263e44c270974dd0e81deca44762 | DinamicaMole.py | python | GeraNarizDinamicaMole | () | [] | def GeraNarizDinamicaMole():
foundTrichion = 'Trichion' in bpy.data.objects
foundRadix = 'Radix' in bpy.data.objects
foundTipofNose = 'Tip of Nose' in bpy.data.objects
foundAlarGrooveright = 'Alar Groove right' in bpy.data.objects
foundAlarGrooveleft = 'Alar Groove left' in bpy.data.objects
fou... | [
"def",
"GeraNarizDinamicaMole",
"(",
")",
":",
"foundTrichion",
"=",
"'Trichion'",
"in",
"bpy",
".",
"data",
".",
"objects",
"foundRadix",
"=",
"'Radix'",
"in",
"bpy",
".",
"data",
".",
"objects",
"foundTipofNose",
"=",
"'Tip of Nose'",
"in",
"bpy",
".",
"da... | https://github.com/cogitas3d/OrtogOnBlender/blob/881e93f5beb2263e44c270974dd0e81deca44762/DinamicaMole.py#L283-L555 | ||||
CalebBell/thermo | 572a47d1b03d49fe609b8d5f826fa6a7cde00828 | thermo/chemical.py | python | Chemical.Van_der_Waals_area | (self) | return None | r'''Unnormalized Van der Waals area, in units of [m^2/mol].
Examples
--------
>>> Chemical('hexane').Van_der_Waals_area
964000.0 | r'''Unnormalized Van der Waals area, in units of [m^2/mol]. | [
"r",
"Unnormalized",
"Van",
"der",
"Waals",
"area",
"in",
"units",
"of",
"[",
"m^2",
"/",
"mol",
"]",
"."
] | def Van_der_Waals_area(self):
r'''Unnormalized Van der Waals area, in units of [m^2/mol].
Examples
--------
>>> Chemical('hexane').Van_der_Waals_area
964000.0
'''
if self.UNIFAC_Q:
return Van_der_Waals_area(self.UNIFAC_Q)
return None | [
"def",
"Van_der_Waals_area",
"(",
"self",
")",
":",
"if",
"self",
".",
"UNIFAC_Q",
":",
"return",
"Van_der_Waals_area",
"(",
"self",
".",
"UNIFAC_Q",
")",
"return",
"None"
] | https://github.com/CalebBell/thermo/blob/572a47d1b03d49fe609b8d5f826fa6a7cde00828/thermo/chemical.py#L1821-L1831 | |
sympy/sympy | d822fcba181155b85ff2b29fe525adbafb22b448 | sympy/logic/utilities/dimacs.py | python | load | (s) | return And(*clauses) | Loads a boolean expression from a string.
Examples
========
>>> from sympy.logic.utilities.dimacs import load
>>> load('1')
cnf_1
>>> load('1 2')
cnf_1 | cnf_2
>>> load('1 \\n 2')
cnf_1 & cnf_2
>>> load('1 2 \\n 3')
cnf_3 & (cnf_1 | cnf_2) | Loads a boolean expression from a string. | [
"Loads",
"a",
"boolean",
"expression",
"from",
"a",
"string",
"."
] | def load(s):
"""Loads a boolean expression from a string.
Examples
========
>>> from sympy.logic.utilities.dimacs import load
>>> load('1')
cnf_1
>>> load('1 2')
cnf_1 | cnf_2
>>> load('1 \\n 2')
cnf_1 & cnf_2
>>> load('1 2 \\n 3')
cnf_3 & (cnf_1 | cnf_2)
"""
cl... | [
"def",
"load",
"(",
"s",
")",
":",
"clauses",
"=",
"[",
"]",
"lines",
"=",
"s",
".",
"split",
"(",
"'\\n'",
")",
"pComment",
"=",
"re",
".",
"compile",
"(",
"r'c.*'",
")",
"pStats",
"=",
"re",
".",
"compile",
"(",
"r'p\\s*cnf\\s*(\\d*)\\s*(\\d*)'",
"... | https://github.com/sympy/sympy/blob/d822fcba181155b85ff2b29fe525adbafb22b448/sympy/logic/utilities/dimacs.py#L12-L62 | |
Kolifanes/plugin.video.youtube | 834998dfb52a9be71a5de8efe9808ec713bc2e04 | resources/lib/kodion/impl/abstract_logger.py | python | AbstractLogger.log | (self, text, log_level=constants.log.NOTICE) | Needs to be implemented by a mock for testing or the real deal.
Logging.
:param text:
:param log_level:
:return: | Needs to be implemented by a mock for testing or the real deal.
Logging.
:param text:
:param log_level:
:return: | [
"Needs",
"to",
"be",
"implemented",
"by",
"a",
"mock",
"for",
"testing",
"or",
"the",
"real",
"deal",
".",
"Logging",
".",
":",
"param",
"text",
":",
":",
"param",
"log_level",
":",
":",
"return",
":"
] | def log(self, text, log_level=constants.log.NOTICE):
"""
Needs to be implemented by a mock for testing or the real deal.
Logging.
:param text:
:param log_level:
:return:
"""
raise NotImplementedError() | [
"def",
"log",
"(",
"self",
",",
"text",
",",
"log_level",
"=",
"constants",
".",
"log",
".",
"NOTICE",
")",
":",
"raise",
"NotImplementedError",
"(",
")"
] | https://github.com/Kolifanes/plugin.video.youtube/blob/834998dfb52a9be71a5de8efe9808ec713bc2e04/resources/lib/kodion/impl/abstract_logger.py#L10-L18 | ||
ulif/diceware | 5d909b5e2f8efdd8dfe53a4f68c50f7710961dc0 | diceware/config.py | python | get_configparser | (path_list=None) | return found, parser | Parse `path_list` for config values.
If no list is given we use `valid_locations()`.
Return a list of paths read and a config parser instance. | Parse `path_list` for config values. | [
"Parse",
"path_list",
"for",
"config",
"values",
"."
] | def get_configparser(path_list=None):
"""Parse `path_list` for config values.
If no list is given we use `valid_locations()`.
Return a list of paths read and a config parser instance.
"""
if path_list is None:
path_list = valid_locations()
parser = SafeParser()
found = parser.read(... | [
"def",
"get_configparser",
"(",
"path_list",
"=",
"None",
")",
":",
"if",
"path_list",
"is",
"None",
":",
"path_list",
"=",
"valid_locations",
"(",
")",
"parser",
"=",
"SafeParser",
"(",
")",
"found",
"=",
"parser",
".",
"read",
"(",
"path_list",
")",
"r... | https://github.com/ulif/diceware/blob/5d909b5e2f8efdd8dfe53a4f68c50f7710961dc0/diceware/config.py#L56-L67 | |
inducer/loopy | 55143b21711a534c07bbb14aaa63ff3879a93433 | loopy/kernel/function_interface.py | python | InKernelCallable.get_used_hw_axes | (self, callables_table) | Returns a tuple ``group_axes_used, local_axes_used``, where
``(group|local)_axes_used`` are :class:`frozenset` of hardware axes
indices used by the callable. | Returns a tuple ``group_axes_used, local_axes_used``, where
``(group|local)_axes_used`` are :class:`frozenset` of hardware axes
indices used by the callable. | [
"Returns",
"a",
"tuple",
"group_axes_used",
"local_axes_used",
"where",
"(",
"group|local",
")",
"_axes_used",
"are",
":",
"class",
":",
"frozenset",
"of",
"hardware",
"axes",
"indices",
"used",
"by",
"the",
"callable",
"."
] | def get_used_hw_axes(self, callables_table):
"""
Returns a tuple ``group_axes_used, local_axes_used``, where
``(group|local)_axes_used`` are :class:`frozenset` of hardware axes
indices used by the callable.
"""
raise NotImplementedError | [
"def",
"get_used_hw_axes",
"(",
"self",
",",
"callables_table",
")",
":",
"raise",
"NotImplementedError"
] | https://github.com/inducer/loopy/blob/55143b21711a534c07bbb14aaa63ff3879a93433/loopy/kernel/function_interface.py#L423-L429 | ||
mozilla/dxr | ef09324a32930e2769e6ff63eaa8de76fcf79ee3 | dxr/plugins/rust/__init__.py | python | TreeToIndex.fixup_sub_mods_impl | (self, table_name, table_ref_name) | NOTE table_name and table_ref_name should not come from user input, otherwise
there is potential for SQL injection attacks. | NOTE table_name and table_ref_name should not come from user input, otherwise
there is potential for SQL injection attacks. | [
"NOTE",
"table_name",
"and",
"table_ref_name",
"should",
"not",
"come",
"from",
"user",
"input",
"otherwise",
"there",
"is",
"potential",
"for",
"SQL",
"injection",
"attacks",
"."
] | def fixup_sub_mods_impl(self, table_name, table_ref_name):
""" NOTE table_name and table_ref_name should not come from user input, otherwise
there is potential for SQL injection attacks. """
# First create refids for module refs whose qualnames match the qualname of
# the module (i.e... | [
"def",
"fixup_sub_mods_impl",
"(",
"self",
",",
"table_name",
",",
"table_ref_name",
")",
":",
"# First create refids for module refs whose qualnames match the qualname of",
"# the module (i.e., no aliases).",
"table_refs",
"=",
"getattr",
"(",
"self",
".",
"data",
",",
"tabl... | https://github.com/mozilla/dxr/blob/ef09324a32930e2769e6ff63eaa8de76fcf79ee3/dxr/plugins/rust/__init__.py#L489-L535 | ||
krintoxi/NoobSec-Toolkit | 38738541cbc03cedb9a3b3ed13b629f781ad64f6 | NoobSecToolkit - MAC OSX/tools/sqli/thirdparty/bottle/bottle.py | python | BaseRequest.content_type | (self) | return self.environ.get('CONTENT_TYPE', '').lower() | The Content-Type header as a lowercase-string (default: empty). | The Content-Type header as a lowercase-string (default: empty). | [
"The",
"Content",
"-",
"Type",
"header",
"as",
"a",
"lowercase",
"-",
"string",
"(",
"default",
":",
"empty",
")",
"."
] | def content_type(self):
''' The Content-Type header as a lowercase-string (default: empty). '''
return self.environ.get('CONTENT_TYPE', '').lower() | [
"def",
"content_type",
"(",
"self",
")",
":",
"return",
"self",
".",
"environ",
".",
"get",
"(",
"'CONTENT_TYPE'",
",",
"''",
")",
".",
"lower",
"(",
")"
] | https://github.com/krintoxi/NoobSec-Toolkit/blob/38738541cbc03cedb9a3b3ed13b629f781ad64f6/NoobSecToolkit - MAC OSX/tools/sqli/thirdparty/bottle/bottle.py#L1154-L1156 | |
home-assistant/core | 265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1 | homeassistant/helpers/event.py | python | _TrackStateChangeFiltered.async_update_listeners | (self, new_track_states: TrackStates) | Update the listeners based on the new TrackStates. | Update the listeners based on the new TrackStates. | [
"Update",
"the",
"listeners",
"based",
"on",
"the",
"new",
"TrackStates",
"."
] | def async_update_listeners(self, new_track_states: TrackStates) -> None:
"""Update the listeners based on the new TrackStates."""
last_track_states = self._last_track_states
self._last_track_states = new_track_states
had_all_listener = last_track_states.all_states
if new_track_... | [
"def",
"async_update_listeners",
"(",
"self",
",",
"new_track_states",
":",
"TrackStates",
")",
"->",
"None",
":",
"last_track_states",
"=",
"self",
".",
"_last_track_states",
"self",
".",
"_last_track_states",
"=",
"new_track_states",
"had_all_listener",
"=",
"last_t... | https://github.com/home-assistant/core/blob/265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1/homeassistant/helpers/event.py#L572-L605 | ||
aws/aws-sam-cli | 2aa7bf01b2e0b0864ef63b1898a8b30577443acc | samcli/lib/warnings/sam_cli_warning.py | python | CodeDeployConditionWarning.check | (self, template_dict) | return (False, "") | Checking if template dictionary have Function with Condition and DeploymentPreferences which
will trigger this warning. | Checking if template dictionary have Function with Condition and DeploymentPreferences which
will trigger this warning. | [
"Checking",
"if",
"template",
"dictionary",
"have",
"Function",
"with",
"Condition",
"and",
"DeploymentPreferences",
"which",
"will",
"trigger",
"this",
"warning",
"."
] | def check(self, template_dict):
"""
Checking if template dictionary have Function with Condition and DeploymentPreferences which
will trigger this warning.
"""
functions = [
resource
for (_, resource) in template_dict.get("Resources", {}).items()
... | [
"def",
"check",
"(",
"self",
",",
"template_dict",
")",
":",
"functions",
"=",
"[",
"resource",
"for",
"(",
"_",
",",
"resource",
")",
"in",
"template_dict",
".",
"get",
"(",
"\"Resources\"",
",",
"{",
"}",
")",
".",
"items",
"(",
")",
"if",
"resourc... | https://github.com/aws/aws-sam-cli/blob/2aa7bf01b2e0b0864ef63b1898a8b30577443acc/samcli/lib/warnings/sam_cli_warning.py#L104-L117 | |
omz/PythonistaAppTemplate | f560f93f8876d82a21d108977f90583df08d55af | PythonistaAppTemplate/PythonistaKit.framework/pylib_ext/numpy/oldnumeric/ma.py | python | sort | (x, axis = -1, fill_value=None) | return masked_values(s, fill_value, copy=0) | If x does not have a mask, return a masked array formed from the
result of numeric.sort(x, axis).
Otherwise, fill x with fill_value. Sort it.
Set a mask where the result is equal to fill_value.
Note that this may have unintended consequences if the data contains the
fill value at a no... | If x does not have a mask, return a masked array formed from the
result of numeric.sort(x, axis).
Otherwise, fill x with fill_value. Sort it.
Set a mask where the result is equal to fill_value.
Note that this may have unintended consequences if the data contains the
fill value at a no... | [
"If",
"x",
"does",
"not",
"have",
"a",
"mask",
"return",
"a",
"masked",
"array",
"formed",
"from",
"the",
"result",
"of",
"numeric",
".",
"sort",
"(",
"x",
"axis",
")",
".",
"Otherwise",
"fill",
"x",
"with",
"fill_value",
".",
"Sort",
"it",
".",
"Set... | def sort (x, axis = -1, fill_value=None):
"""If x does not have a mask, return a masked array formed from the
result of numeric.sort(x, axis).
Otherwise, fill x with fill_value. Sort it.
Set a mask where the result is equal to fill_value.
Note that this may have unintended consequences i... | [
"def",
"sort",
"(",
"x",
",",
"axis",
"=",
"-",
"1",
",",
"fill_value",
"=",
"None",
")",
":",
"if",
"fill_value",
"is",
"None",
":",
"fill_value",
"=",
"default_fill_value",
"(",
"x",
")",
"d",
"=",
"filled",
"(",
"x",
",",
"fill_value",
")",
"s",... | https://github.com/omz/PythonistaAppTemplate/blob/f560f93f8876d82a21d108977f90583df08d55af/PythonistaAppTemplate/PythonistaKit.framework/pylib_ext/numpy/oldnumeric/ma.py#L2075-L2092 | |
SanPen/GridCal | d3f4566d2d72c11c7e910c9d162538ef0e60df31 | src/GridCal/Gui/Main/GridCalMain.py | python | MainGUI.get_selected_buses | (self) | return lst | Get the selected buses
:return: | Get the selected buses
:return: | [
"Get",
"the",
"selected",
"buses",
":",
"return",
":"
] | def get_selected_buses(self) -> List[Tuple[int, Bus]]:
"""
Get the selected buses
:return:
"""
lst: List[Tuple[int, Bus]] = list()
for k, bus in enumerate(self.circuit.buses):
if bus.graphic_obj is not None:
if bus.graphic_obj.isSelected():
... | [
"def",
"get_selected_buses",
"(",
"self",
")",
"->",
"List",
"[",
"Tuple",
"[",
"int",
",",
"Bus",
"]",
"]",
":",
"lst",
":",
"List",
"[",
"Tuple",
"[",
"int",
",",
"Bus",
"]",
"]",
"=",
"list",
"(",
")",
"for",
"k",
",",
"bus",
"in",
"enumerat... | https://github.com/SanPen/GridCal/blob/d3f4566d2d72c11c7e910c9d162538ef0e60df31/src/GridCal/Gui/Main/GridCalMain.py#L6192-L6202 | |
CouchPotato/CouchPotatoServer | 7260c12f72447ddb6f062367c6dfbda03ecd4e9c | libs/apscheduler/scheduler.py | python | Scheduler.start | (self) | Starts the scheduler in a new thread.
In threaded mode (the default), this method will return immediately
after starting the scheduler thread.
In standalone mode, this method will block until there are no more
scheduled jobs. | Starts the scheduler in a new thread. | [
"Starts",
"the",
"scheduler",
"in",
"a",
"new",
"thread",
"."
] | def start(self):
"""
Starts the scheduler in a new thread.
In threaded mode (the default), this method will return immediately
after starting the scheduler thread.
In standalone mode, this method will block until there are no more
scheduled jobs.
"""
if ... | [
"def",
"start",
"(",
"self",
")",
":",
"if",
"self",
".",
"running",
":",
"raise",
"SchedulerAlreadyRunningError",
"# Create a RAMJobStore as the default if there is no default job store",
"if",
"not",
"'default'",
"in",
"self",
".",
"_jobstores",
":",
"self",
".",
"a... | https://github.com/CouchPotato/CouchPotatoServer/blob/7260c12f72447ddb6f062367c6dfbda03ecd4e9c/libs/apscheduler/scheduler.py#L86-L114 | ||
twilio/twilio-python | 6e1e811ea57a1edfadd5161ace87397c563f6915 | twilio/rest/ip_messaging/v2/service/__init__.py | python | ServiceInstance.bindings | (self) | return self._proxy.bindings | Access the bindings
:returns: twilio.rest.ip_messaging.v2.service.binding.BindingList
:rtype: twilio.rest.ip_messaging.v2.service.binding.BindingList | Access the bindings | [
"Access",
"the",
"bindings"
] | def bindings(self):
"""
Access the bindings
:returns: twilio.rest.ip_messaging.v2.service.binding.BindingList
:rtype: twilio.rest.ip_messaging.v2.service.binding.BindingList
"""
return self._proxy.bindings | [
"def",
"bindings",
"(",
"self",
")",
":",
"return",
"self",
".",
"_proxy",
".",
"bindings"
] | https://github.com/twilio/twilio-python/blob/6e1e811ea57a1edfadd5161ace87397c563f6915/twilio/rest/ip_messaging/v2/service/__init__.py#L796-L803 | |
zhl2008/awd-platform | 0416b31abea29743387b10b3914581fbe8e7da5e | web_hxb2/lib/python3.5/site-packages/wagtail_bak/contrib/wagtailapi/serializers.py | python | PageSerializer.build_relational_field | (self, field_name, relation_info) | return super(PageSerializer, self).build_relational_field(field_name, relation_info) | [] | def build_relational_field(self, field_name, relation_info):
# Find all relation fields that point to child class and make them use
# the ChildRelationField class.
if relation_info.to_many:
model = getattr(self.Meta, 'model')
child_relations = {
child_rela... | [
"def",
"build_relational_field",
"(",
"self",
",",
"field_name",
",",
"relation_info",
")",
":",
"# Find all relation fields that point to child class and make them use",
"# the ChildRelationField class.",
"if",
"relation_info",
".",
"to_many",
":",
"model",
"=",
"getattr",
"... | https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_hxb2/lib/python3.5/site-packages/wagtail_bak/contrib/wagtailapi/serializers.py#L258-L271 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.