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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
pygae/clifford | 0b6cffb9a6d44ecb7a666f6b08b1788fc94a0ab6 | clifford/tools/g3c/rotor_parameterisation.py | python | interpolate_TR_rotors | (R_n_plus_1, R_n, interpolation_fraction) | return R_n_lambda | Interpolates TR type rotors
From :cite:`wareham-interpolation`. | Interpolates TR type rotors | [
"Interpolates",
"TR",
"type",
"rotors"
] | def interpolate_TR_rotors(R_n_plus_1, R_n, interpolation_fraction):
"""
Interpolates TR type rotors
From :cite:`wareham-interpolation`.
"""
if interpolation_fraction < np.finfo(float).eps:
return R_n
delta_R = R_n_plus_1 * ~R_n
delta_bivector = ga_log(delta_R)(2)
R_n_lambda = ga... | [
"def",
"interpolate_TR_rotors",
"(",
"R_n_plus_1",
",",
"R_n",
",",
"interpolation_fraction",
")",
":",
"if",
"interpolation_fraction",
"<",
"np",
".",
"finfo",
"(",
"float",
")",
".",
"eps",
":",
"return",
"R_n",
"delta_R",
"=",
"R_n_plus_1",
"*",
"~",
"R_n... | https://github.com/pygae/clifford/blob/0b6cffb9a6d44ecb7a666f6b08b1788fc94a0ab6/clifford/tools/g3c/rotor_parameterisation.py#L196-L207 | |
beeware/ouroboros | a29123c6fab6a807caffbb7587cf548e0c370296 | ouroboros/pydoc.py | python | resolve | (thing, forceload=0) | Given an object or a path to an object, get the object and its name. | Given an object or a path to an object, get the object and its name. | [
"Given",
"an",
"object",
"or",
"a",
"path",
"to",
"an",
"object",
"get",
"the",
"object",
"and",
"its",
"name",
"."
] | def resolve(thing, forceload=0):
"""Given an object or a path to an object, get the object and its name."""
if isinstance(thing, str):
object = locate(thing, forceload)
if object is None:
raise ImportError('no Python documentation found for %r' % thing)
return object, thing
... | [
"def",
"resolve",
"(",
"thing",
",",
"forceload",
"=",
"0",
")",
":",
"if",
"isinstance",
"(",
"thing",
",",
"str",
")",
":",
"object",
"=",
"locate",
"(",
"thing",
",",
"forceload",
")",
"if",
"object",
"is",
"None",
":",
"raise",
"ImportError",
"("... | https://github.com/beeware/ouroboros/blob/a29123c6fab6a807caffbb7587cf548e0c370296/ouroboros/pydoc.py#L1589-L1598 | ||
fluentpython/example-code-2e | 80f7f84274a47579e59c29a4657691525152c9d5 | 13-protocol-abc/tombola_subhook.py | python | Tombola.pick | (self) | Remove item at random, returning it.
This method should raise `LookupError` when the instance is empty. | Remove item at random, returning it. | [
"Remove",
"item",
"at",
"random",
"returning",
"it",
"."
] | def pick(self): # <3>
"""Remove item at random, returning it.
This method should raise `LookupError` when the instance is empty.
""" | [
"def",
"pick",
"(",
"self",
")",
":",
"# <3>"
] | https://github.com/fluentpython/example-code-2e/blob/80f7f84274a47579e59c29a4657691525152c9d5/13-protocol-abc/tombola_subhook.py#L36-L40 | ||
demisto/content | 5c664a65b992ac8ca90ac3f11b1b2cdf11ee9b07 | Packs/MicrosoftGraphApplications/Integrations/MicrosoftGraphApplications/MicrosoftGraphApplications.py | python | Client.delete_service_principals | (
self,
service_id: str
) | Deletes a given id from authorized apps.
Arguments:
service_id: the service to remove
Returns:
True if removed successfully
Raises:
DemistoException if no app exists or any other requests error.
Docs:
https://docs.microsoft.com/en-us/gr... | Deletes a given id from authorized apps. | [
"Deletes",
"a",
"given",
"id",
"from",
"authorized",
"apps",
"."
] | def delete_service_principals(
self,
service_id: str
):
"""Deletes a given id from authorized apps.
Arguments:
service_id: the service to remove
Returns:
True if removed successfully
Raises:
DemistoException if no app exi... | [
"def",
"delete_service_principals",
"(",
"self",
",",
"service_id",
":",
"str",
")",
":",
"self",
".",
"ms_client",
".",
"http_request",
"(",
"'DELETE'",
",",
"f'v1.0/servicePrincipals/{service_id}'",
",",
"return_empty_response",
"=",
"True",
")"
] | https://github.com/demisto/content/blob/5c664a65b992ac8ca90ac3f11b1b2cdf11ee9b07/Packs/MicrosoftGraphApplications/Integrations/MicrosoftGraphApplications/MicrosoftGraphApplications.py#L69-L89 | ||
cenkalti/kuyruk | 1052334e804c137245ddbbed31c75fa0aac46a71 | kuyruk/worker.py | python | Worker._handle_sigusr2 | (self, signum: int, frame: Any) | Drop current task. | Drop current task. | [
"Drop",
"current",
"task",
"."
] | def _handle_sigusr2(self, signum: int, frame: Any) -> None:
"""Drop current task."""
logger.warning("Catched SIGUSR2")
if self.current_task:
logger.warning("Dropping current task...")
raise Discard | [
"def",
"_handle_sigusr2",
"(",
"self",
",",
"signum",
":",
"int",
",",
"frame",
":",
"Any",
")",
"->",
"None",
":",
"logger",
".",
"warning",
"(",
"\"Catched SIGUSR2\"",
")",
"if",
"self",
".",
"current_task",
":",
"logger",
".",
"warning",
"(",
"\"Dropp... | https://github.com/cenkalti/kuyruk/blob/1052334e804c137245ddbbed31c75fa0aac46a71/kuyruk/worker.py#L405-L410 | ||
quantopian/trading_calendars | 19c4b677f13147928d34be5a3da50ba4161be45d | trading_calendars/calendar_utils.py | python | TradingCalendarDispatcher.__init__ | (self, calendars, calendar_factories, aliases) | [] | def __init__(self, calendars, calendar_factories, aliases):
self._calendars = calendars
self._calendar_factories = dict(calendar_factories)
self._aliases = dict(aliases) | [
"def",
"__init__",
"(",
"self",
",",
"calendars",
",",
"calendar_factories",
",",
"aliases",
")",
":",
"self",
".",
"_calendars",
"=",
"calendars",
"self",
".",
"_calendar_factories",
"=",
"dict",
"(",
"calendar_factories",
")",
"self",
".",
"_aliases",
"=",
... | https://github.com/quantopian/trading_calendars/blob/19c4b677f13147928d34be5a3da50ba4161be45d/trading_calendars/calendar_utils.py#L165-L168 | ||||
google/ctfscoreboard | 28a8f6c30e401e07031741d5bafea3003e2d100e | scoreboard/models.py | python | Challenge.get_joined_query | (cls) | return cls.query.options(
orm.joinedload(cls.answers).joinedload(Answer.team)) | Get a prejoined-query with answers and teams. | Get a prejoined-query with answers and teams. | [
"Get",
"a",
"prejoined",
"-",
"query",
"with",
"answers",
"and",
"teams",
"."
] | def get_joined_query(cls):
"""Get a prejoined-query with answers and teams."""
return cls.query.options(
orm.joinedload(cls.answers).joinedload(Answer.team)) | [
"def",
"get_joined_query",
"(",
"cls",
")",
":",
"return",
"cls",
".",
"query",
".",
"options",
"(",
"orm",
".",
"joinedload",
"(",
"cls",
".",
"answers",
")",
".",
"joinedload",
"(",
"Answer",
".",
"team",
")",
")"
] | https://github.com/google/ctfscoreboard/blob/28a8f6c30e401e07031741d5bafea3003e2d100e/scoreboard/models.py#L573-L576 | |
dragonfly/dragonfly | a579b5eadf452e23b07d4caf27b402703b0012b7 | dragonfly/exd/worker_manager.py | python | MultiProcessingWorkerManager._rwm_set_up | (self) | Sets things up for the child. | Sets things up for the child. | [
"Sets",
"things",
"up",
"for",
"the",
"child",
"."
] | def _rwm_set_up(self):
""" Sets things up for the child. """
# Create the result directories. """
self.result_dir_names = {wid:'%s/result_%s'%(self.tmp_dir, str(wid)) for wid in
self.worker_ids}
# Create the working directories
self.working_dir_names ... | [
"def",
"_rwm_set_up",
"(",
"self",
")",
":",
"# Create the result directories. \"\"\"",
"self",
".",
"result_dir_names",
"=",
"{",
"wid",
":",
"'%s/result_%s'",
"%",
"(",
"self",
".",
"tmp_dir",
",",
"str",
"(",
"wid",
")",
")",
"for",
"wid",
"in",
"self",
... | https://github.com/dragonfly/dragonfly/blob/a579b5eadf452e23b07d4caf27b402703b0012b7/dragonfly/exd/worker_manager.py#L227-L239 | ||
hakril/PythonForWindows | 61e027a678d5b87aa64fcf8a37a6661a86236589 | windows/com.py | python | Variant.guess_type_and_set_value | (self, value) | [] | def guess_type_and_set_value(self, value):
for t, attr, check in self.CHECK_TYPE:
try:
checkres = check(value)
except TypeError as e:
continue
if checkres:
self.vt = t
if attr is not None:
set... | [
"def",
"guess_type_and_set_value",
"(",
"self",
",",
"value",
")",
":",
"for",
"t",
",",
"attr",
",",
"check",
"in",
"self",
".",
"CHECK_TYPE",
":",
"try",
":",
"checkres",
"=",
"check",
"(",
"value",
")",
"except",
"TypeError",
"as",
"e",
":",
"contin... | https://github.com/hakril/PythonForWindows/blob/61e027a678d5b87aa64fcf8a37a6661a86236589/windows/com.py#L240-L251 | ||||
HaoZhang95/Python24 | b897224b8a0e6a5734f408df8c24846a98c553bf | 00Python/venv/Lib/site-packages/pip-10.0.1-py3.7.egg/pip/_vendor/distlib/_backport/tarfile.py | python | ExFileObject.close | (self) | Close the file object. | Close the file object. | [
"Close",
"the",
"file",
"object",
"."
] | def close(self):
"""Close the file object.
"""
self.closed = True | [
"def",
"close",
"(",
"self",
")",
":",
"self",
".",
"closed",
"=",
"True"
] | https://github.com/HaoZhang95/Python24/blob/b897224b8a0e6a5734f408df8c24846a98c553bf/00Python/venv/Lib/site-packages/pip-10.0.1-py3.7.egg/pip/_vendor/distlib/_backport/tarfile.py#L905-L908 | ||
llSourcell/AI_For_Music_Composition | 795f8879158b238e7dc78d07e4451dcf54a2126c | musegan/model.py | python | Model.save_statistics | (self, filepath=None) | Save model statistics to file. Default to save to the log directory
given as a global variable. | Save model statistics to file. Default to save to the log directory
given as a global variable. | [
"Save",
"model",
"statistics",
"to",
"file",
".",
"Default",
"to",
"save",
"to",
"the",
"log",
"directory",
"given",
"as",
"a",
"global",
"variable",
"."
] | def save_statistics(self, filepath=None):
"""Save model statistics to file. Default to save to the log directory
given as a global variable."""
if filepath is None:
filepath = os.path.join(self.config['log_dir'],
'model_statistics.txt')
wit... | [
"def",
"save_statistics",
"(",
"self",
",",
"filepath",
"=",
"None",
")",
":",
"if",
"filepath",
"is",
"None",
":",
"filepath",
"=",
"os",
".",
"path",
".",
"join",
"(",
"self",
".",
"config",
"[",
"'log_dir'",
"]",
",",
"'model_statistics.txt'",
")",
... | https://github.com/llSourcell/AI_For_Music_Composition/blob/795f8879158b238e7dc78d07e4451dcf54a2126c/musegan/model.py#L112-L119 | ||
hyperledger/aries-cloudagent-python | 2f36776e99f6053ae92eed8123b5b1b2e891c02a | aries_cloudagent/admin/server.py | python | AdminServer.liveliness_handler | (self, request: web.BaseRequest) | Request handler for liveliness check.
Args:
request: aiohttp request object
Returns:
The web response, always indicating True | Request handler for liveliness check. | [
"Request",
"handler",
"for",
"liveliness",
"check",
"."
] | async def liveliness_handler(self, request: web.BaseRequest):
"""
Request handler for liveliness check.
Args:
request: aiohttp request object
Returns:
The web response, always indicating True
"""
app_live = self.app._state["alive"]
if ap... | [
"async",
"def",
"liveliness_handler",
"(",
"self",
",",
"request",
":",
"web",
".",
"BaseRequest",
")",
":",
"app_live",
"=",
"self",
".",
"app",
".",
"_state",
"[",
"\"alive\"",
"]",
"if",
"app_live",
":",
"return",
"web",
".",
"json_response",
"(",
"{"... | https://github.com/hyperledger/aries-cloudagent-python/blob/2f36776e99f6053ae92eed8123b5b1b2e891c02a/aries_cloudagent/admin/server.py#L663-L678 | ||
NVIDIA/DeepLearningExamples | 589604d49e016cd9ef4525f7abcc9c7b826cfc5e | PyTorch/LanguageModeling/Transformer-XL/pytorch/utils/distributed.py | python | get_world_size | () | return world_size | Gets total number of distributed workers or returns one if distributed is
not initialized. | Gets total number of distributed workers or returns one if distributed is
not initialized. | [
"Gets",
"total",
"number",
"of",
"distributed",
"workers",
"or",
"returns",
"one",
"if",
"distributed",
"is",
"not",
"initialized",
"."
] | def get_world_size():
"""
Gets total number of distributed workers or returns one if distributed is
not initialized.
"""
if torch.distributed.is_available() and torch.distributed.is_initialized():
world_size = torch.distributed.get_world_size()
else:
world_size = 1
return wor... | [
"def",
"get_world_size",
"(",
")",
":",
"if",
"torch",
".",
"distributed",
".",
"is_available",
"(",
")",
"and",
"torch",
".",
"distributed",
".",
"is_initialized",
"(",
")",
":",
"world_size",
"=",
"torch",
".",
"distributed",
".",
"get_world_size",
"(",
... | https://github.com/NVIDIA/DeepLearningExamples/blob/589604d49e016cd9ef4525f7abcc9c7b826cfc5e/PyTorch/LanguageModeling/Transformer-XL/pytorch/utils/distributed.py#L57-L66 | |
thinkle/gourmet | 8af29c8ded24528030e5ae2ea3461f61c1e5a575 | gourmet/gtk_extras/treeview_extras.py | python | get_row | (mod, iter) | return row | Grab all values in iter and return as a list suitable for
feeding to 'row' argument of append/prepend/insert | Grab all values in iter and return as a list suitable for
feeding to 'row' argument of append/prepend/insert | [
"Grab",
"all",
"values",
"in",
"iter",
"and",
"return",
"as",
"a",
"list",
"suitable",
"for",
"feeding",
"to",
"row",
"argument",
"of",
"append",
"/",
"prepend",
"/",
"insert"
] | def get_row (mod, iter):
"""Grab all values in iter and return as a list suitable for
feeding to 'row' argument of append/prepend/insert"""
n = 0
flag = True
row = []
while flag:
try:
row.append(mod.get_value(iter,n))
except:
... | [
"def",
"get_row",
"(",
"mod",
",",
"iter",
")",
":",
"n",
"=",
"0",
"flag",
"=",
"True",
"row",
"=",
"[",
"]",
"while",
"flag",
":",
"try",
":",
"row",
".",
"append",
"(",
"mod",
".",
"get_value",
"(",
"iter",
",",
"n",
")",
")",
"except",
":... | https://github.com/thinkle/gourmet/blob/8af29c8ded24528030e5ae2ea3461f61c1e5a575/gourmet/gtk_extras/treeview_extras.py#L156-L168 | |
mihaip/mail-trends | 312b5be7f8f0a5933b05c75e229eda8e44c3c920 | main.py | python | GetOptsMap | () | return opts_map | [] | def GetOptsMap():
opts, args = getopt.getopt(sys.argv[1:], "", [
# Standard options
"username=", "password=", "use_ssl", "server=",
# Other params
"filter_out=", "me=",
# Development options
"record", "replay",
"max_messages=", "random_subset",
"skip_labels"])... | [
"def",
"GetOptsMap",
"(",
")",
":",
"opts",
",",
"args",
"=",
"getopt",
".",
"getopt",
"(",
"sys",
".",
"argv",
"[",
"1",
":",
"]",
",",
"\"\"",
",",
"[",
"# Standard options",
"\"username=\"",
",",
"\"password=\"",
",",
"\"use_ssl\"",
",",
"\"server=\""... | https://github.com/mihaip/mail-trends/blob/312b5be7f8f0a5933b05c75e229eda8e44c3c920/main.py#L18-L44 | |||
wistbean/learn_python3_spider | 73c873f4845f4385f097e5057407d03dd37a117b | stackoverflow/venv/lib/python3.6/site-packages/twisted/conch/insults/insults.py | python | ITerminalTransport.nextLine | () | Move the cursor to the first position on the next line, performing scrolling if necessary. | Move the cursor to the first position on the next line, performing scrolling if necessary. | [
"Move",
"the",
"cursor",
"to",
"the",
"first",
"position",
"on",
"the",
"next",
"line",
"performing",
"scrolling",
"if",
"necessary",
"."
] | def nextLine():
"""
Move the cursor to the first position on the next line, performing scrolling if necessary.
""" | [
"def",
"nextLine",
"(",
")",
":"
] | https://github.com/wistbean/learn_python3_spider/blob/73c873f4845f4385f097e5057407d03dd37a117b/stackoverflow/venv/lib/python3.6/site-packages/twisted/conch/insults/insults.py#L140-L143 | ||
nerdvegas/rez | d392c65bf63b4bca8106f938cec49144ba54e770 | src/rez/package_help.py | python | PackageHelp.open | (self, section_index=0) | Launch a help section. | Launch a help section. | [
"Launch",
"a",
"help",
"section",
"."
] | def open(self, section_index=0):
"""Launch a help section."""
uri = self._sections[section_index][1]
if len(uri.split()) == 1:
self._open_url(uri)
else:
if self._verbose:
print("running command: %s" % uri)
with Popen(uri, shell=True) a... | [
"def",
"open",
"(",
"self",
",",
"section_index",
"=",
"0",
")",
":",
"uri",
"=",
"self",
".",
"_sections",
"[",
"section_index",
"]",
"[",
"1",
"]",
"if",
"len",
"(",
"uri",
".",
"split",
"(",
")",
")",
"==",
"1",
":",
"self",
".",
"_open_url",
... | https://github.com/nerdvegas/rez/blob/d392c65bf63b4bca8106f938cec49144ba54e770/src/rez/package_help.py#L107-L117 | ||
keiffster/program-y | 8c99b56f8c32f01a7b9887b5daae9465619d0385 | src/programy/parser/template/nodes/authorise.py | python | TemplateAuthoriseNode.__init__ | (self) | [] | def __init__(self):
TemplateNode.__init__(self)
self._role = None
self._denied_srai = None | [
"def",
"__init__",
"(",
"self",
")",
":",
"TemplateNode",
".",
"__init__",
"(",
"self",
")",
"self",
".",
"_role",
"=",
"None",
"self",
".",
"_denied_srai",
"=",
"None"
] | https://github.com/keiffster/program-y/blob/8c99b56f8c32f01a7b9887b5daae9465619d0385/src/programy/parser/template/nodes/authorise.py#L24-L27 | ||||
khalim19/gimp-plugin-export-layers | b37255f2957ad322f4d332689052351cdea6e563 | export_layers/pygimplib/setting/presenters_gtk.py | python | GimpUiPatternSelectButtonPresenter._create_gui_element | (self, setting) | return gimpui.PatternSelectButton(setting.display_name, setting.value) | [] | def _create_gui_element(self, setting):
return gimpui.PatternSelectButton(setting.display_name, setting.value) | [
"def",
"_create_gui_element",
"(",
"self",
",",
"setting",
")",
":",
"return",
"gimpui",
".",
"PatternSelectButton",
"(",
"setting",
".",
"display_name",
",",
"setting",
".",
"value",
")"
] | https://github.com/khalim19/gimp-plugin-export-layers/blob/b37255f2957ad322f4d332689052351cdea6e563/export_layers/pygimplib/setting/presenters_gtk.py#L614-L615 | |||
movidius/ncappzoo | 5d06afdbfce51b0627fab05d1941a30ecffee172 | apps/driving_pi/car_pi.py | python | DriveBrickPi3.speed | (self) | return self.__speed | Get speed value of the car
:return: speed value | Get speed value of the car
:return: speed value | [
"Get",
"speed",
"value",
"of",
"the",
"car",
":",
"return",
":",
"speed",
"value"
] | def speed(self):
"""
Get speed value of the car
:return: speed value
"""
return self.__speed | [
"def",
"speed",
"(",
"self",
")",
":",
"return",
"self",
".",
"__speed"
] | https://github.com/movidius/ncappzoo/blob/5d06afdbfce51b0627fab05d1941a30ecffee172/apps/driving_pi/car_pi.py#L42-L47 | |
biolab/orange3 | 41685e1c7b1d1babe680113685a2d44bcc9fec0b | Orange/widgets/visualize/ownomogram.py | python | RulerItem.__init__ | (self, name, values, scale, name_offset, offset, labels=None) | [] | def __init__(self, name, values, scale, name_offset, offset, labels=None):
super().__init__()
# leading label
font = name.document().defaultFont()
if self.bold_label:
font.setWeight(QFont.Bold)
name.setFont(font)
name.setPos(name_offset, -10)
name.set... | [
"def",
"__init__",
"(",
"self",
",",
"name",
",",
"values",
",",
"scale",
",",
"name_offset",
",",
"offset",
",",
"labels",
"=",
"None",
")",
":",
"super",
"(",
")",
".",
"__init__",
"(",
")",
"# leading label",
"font",
"=",
"name",
".",
"document",
... | https://github.com/biolab/orange3/blob/41685e1c7b1d1babe680113685a2d44bcc9fec0b/Orange/widgets/visualize/ownomogram.py#L376-L430 | ||||
IronLanguages/ironpython3 | 7a7bb2a872eeab0d1009fc8a6e24dca43f65b693 | Src/StdLib/Lib/socketserver.py | python | TCPServer.get_request | (self) | return self.socket.accept() | Get the request and client address from the socket.
May be overridden. | Get the request and client address from the socket. | [
"Get",
"the",
"request",
"and",
"client",
"address",
"from",
"the",
"socket",
"."
] | def get_request(self):
"""Get the request and client address from the socket.
May be overridden.
"""
return self.socket.accept() | [
"def",
"get_request",
"(",
"self",
")",
":",
"return",
"self",
".",
"socket",
".",
"accept",
"(",
")"
] | https://github.com/IronLanguages/ironpython3/blob/7a7bb2a872eeab0d1009fc8a6e24dca43f65b693/Src/StdLib/Lib/socketserver.py#L471-L477 | |
zhl2008/awd-platform | 0416b31abea29743387b10b3914581fbe8e7da5e | web_hxb2/lib/python3.5/site-packages/django/http/multipartparser.py | python | ChunkIter.__iter__ | (self) | return self | [] | def __iter__(self):
return self | [
"def",
"__iter__",
"(",
"self",
")",
":",
"return",
"self"
] | https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_hxb2/lib/python3.5/site-packages/django/http/multipartparser.py#L457-L458 | |||
zhl2008/awd-platform | 0416b31abea29743387b10b3914581fbe8e7da5e | web_flaskbb/Python-2.7.9/Lib/idlelib/GrepDialog.py | python | grep | (text, io=None, flist=None) | [] | def grep(text, io=None, flist=None):
root = text._root()
engine = SearchEngine.get(root)
if not hasattr(engine, "_grepdialog"):
engine._grepdialog = GrepDialog(root, engine, flist)
dialog = engine._grepdialog
searchphrase = text.get("sel.first", "sel.last")
dialog.open(text, searchphrase... | [
"def",
"grep",
"(",
"text",
",",
"io",
"=",
"None",
",",
"flist",
"=",
"None",
")",
":",
"root",
"=",
"text",
".",
"_root",
"(",
")",
"engine",
"=",
"SearchEngine",
".",
"get",
"(",
"root",
")",
"if",
"not",
"hasattr",
"(",
"engine",
",",
"\"_gre... | https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_flaskbb/Python-2.7.9/Lib/idlelib/GrepDialog.py#L13-L20 | ||||
IdentityPython/pysaml2 | 6badb32d212257bd83ffcc816f9b625f68281b47 | src/saml2/httputil.py | python | Response._response | (self, message="", **argv) | [] | def _response(self, message="", **argv):
if self.template:
message = self.template % message
elif self.mako_lookup and self.mako_template:
argv["message"] = message
mte = self.mako_lookup.get_template(self.mako_template)
message = mte.render(**argv)
... | [
"def",
"_response",
"(",
"self",
",",
"message",
"=",
"\"\"",
",",
"*",
"*",
"argv",
")",
":",
"if",
"self",
".",
"template",
":",
"message",
"=",
"self",
".",
"template",
"%",
"message",
"elif",
"self",
".",
"mako_lookup",
"and",
"self",
".",
"mako_... | https://github.com/IdentityPython/pysaml2/blob/6badb32d212257bd83ffcc816f9b625f68281b47/src/saml2/httputil.py#L56-L69 | ||||
iduta/iresnet | babdc4f5946f64905710cd64a5bd6c164a805c9e | models/resgroupfix.py | python | conv1x1 | (in_planes, out_planes, stride=1) | return nn.Conv2d(in_planes, out_planes, kernel_size=1, stride=stride, bias=False) | 1x1 convolution | 1x1 convolution | [
"1x1",
"convolution"
] | def conv1x1(in_planes, out_planes, stride=1):
"""1x1 convolution"""
return nn.Conv2d(in_planes, out_planes, kernel_size=1, stride=stride, bias=False) | [
"def",
"conv1x1",
"(",
"in_planes",
",",
"out_planes",
",",
"stride",
"=",
"1",
")",
":",
"return",
"nn",
".",
"Conv2d",
"(",
"in_planes",
",",
"out_planes",
",",
"kernel_size",
"=",
"1",
",",
"stride",
"=",
"stride",
",",
"bias",
"=",
"False",
")"
] | https://github.com/iduta/iresnet/blob/babdc4f5946f64905710cd64a5bd6c164a805c9e/models/resgroupfix.py#L32-L34 | |
vibora-io/vibora | 4cda888f89aec6bfb2541ee53548ae1bf50fbf1b | vibora/client/response.py | python | Response.receive_headers | (self) | :return: | [] | async def receive_headers(self):
"""
:return:
"""
if self._parser_status != ResponseStatus.PENDING_HEADERS:
return
try:
self._parser.feed(await self._connection.read_until(b'\r\n\r\n'))
if self._headers.get('content-encoding') == 'gzip':
... | [
"async",
"def",
"receive_headers",
"(",
"self",
")",
":",
"if",
"self",
".",
"_parser_status",
"!=",
"ResponseStatus",
".",
"PENDING_HEADERS",
":",
"return",
"try",
":",
"self",
".",
"_parser",
".",
"feed",
"(",
"await",
"self",
".",
"_connection",
".",
"r... | https://github.com/vibora-io/vibora/blob/4cda888f89aec6bfb2541ee53548ae1bf50fbf1b/vibora/client/response.py#L139-L155 | |||
carla-simulator/scenario_runner | f4d00d88eda4212a1e119515c96281a4be5c234e | srunner/scenarios/background_activity.py | python | BackgroundBehavior.__init__ | (self, ego_actor, route, night_mode=False, debug=False, name="BackgroundBehavior") | Setup class members | Setup class members | [
"Setup",
"class",
"members"
] | def __init__(self, ego_actor, route, night_mode=False, debug=False, name="BackgroundBehavior"):
"""
Setup class members
"""
super(BackgroundBehavior, self).__init__(name)
self.debug = debug
self._map = CarlaDataProvider.get_map()
self._world = CarlaDataProvider.ge... | [
"def",
"__init__",
"(",
"self",
",",
"ego_actor",
",",
"route",
",",
"night_mode",
"=",
"False",
",",
"debug",
"=",
"False",
",",
"name",
"=",
"\"BackgroundBehavior\"",
")",
":",
"super",
"(",
"BackgroundBehavior",
",",
"self",
")",
".",
"__init__",
"(",
... | https://github.com/carla-simulator/scenario_runner/blob/f4d00d88eda4212a1e119515c96281a4be5c234e/srunner/scenarios/background_activity.py#L243-L335 | ||
analysiscenter/batchflow | 294747da0bca309785f925be891441fdd824e9fa | batchflow/models/torch/base.py | python | TorchModel.combine_configs | (self) | return config | Combine default configuration and the external one. | Combine default configuration and the external one. | [
"Combine",
"default",
"configuration",
"and",
"the",
"external",
"one",
"."
] | def combine_configs(self):
""" Combine default configuration and the external one. """
config = self.default_config() + self.external_config
return config | [
"def",
"combine_configs",
"(",
"self",
")",
":",
"config",
"=",
"self",
".",
"default_config",
"(",
")",
"+",
"self",
".",
"external_config",
"return",
"config"
] | https://github.com/analysiscenter/batchflow/blob/294747da0bca309785f925be891441fdd824e9fa/batchflow/models/torch/base.py#L501-L504 | |
plotly/plotly.py | cfad7862594b35965c0e000813bd7805e8494a5b | packages/python/plotly/plotly/graph_objs/layout/mapbox/layer/_line.py | python | Line.dashsrc | (self) | return self["dashsrc"] | Sets the source reference on Chart Studio Cloud for `dash`.
The 'dashsrc' property must be specified as a string or
as a plotly.grid_objs.Column object
Returns
-------
str | Sets the source reference on Chart Studio Cloud for `dash`.
The 'dashsrc' property must be specified as a string or
as a plotly.grid_objs.Column object | [
"Sets",
"the",
"source",
"reference",
"on",
"Chart",
"Studio",
"Cloud",
"for",
"dash",
".",
"The",
"dashsrc",
"property",
"must",
"be",
"specified",
"as",
"a",
"string",
"or",
"as",
"a",
"plotly",
".",
"grid_objs",
".",
"Column",
"object"
] | def dashsrc(self):
"""
Sets the source reference on Chart Studio Cloud for `dash`.
The 'dashsrc' property must be specified as a string or
as a plotly.grid_objs.Column object
Returns
-------
str
"""
return self["dashsrc"] | [
"def",
"dashsrc",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"dashsrc\"",
"]"
] | https://github.com/plotly/plotly.py/blob/cfad7862594b35965c0e000813bd7805e8494a5b/packages/python/plotly/plotly/graph_objs/layout/mapbox/layer/_line.py#L37-L48 | |
sergiocorreia/panflute | b9546cf7b88fdc9f00117fca395c4d3590f45769 | panflute/base.py | python | Element._set_ica | (self, identifier, classes, attributes) | [] | def _set_ica(self, identifier, classes, attributes):
self.identifier = check_type(identifier, str)
self.classes = [check_type(cl, str) for cl in classes]
self.attributes = dict(attributes) | [
"def",
"_set_ica",
"(",
"self",
",",
"identifier",
",",
"classes",
",",
"attributes",
")",
":",
"self",
".",
"identifier",
"=",
"check_type",
"(",
"identifier",
",",
"str",
")",
"self",
".",
"classes",
"=",
"[",
"check_type",
"(",
"cl",
",",
"str",
")"... | https://github.com/sergiocorreia/panflute/blob/b9546cf7b88fdc9f00117fca395c4d3590f45769/panflute/base.py#L82-L85 | ||||
lad1337/XDM | 0c1b7009fe00f06f102a6f67c793478f515e7efe | site-packages/cherrypy/lib/cptools.py | python | SessionAuth.do_check | (self) | Assert username. May raise redirect, or return True if request handled. | Assert username. May raise redirect, or return True if request handled. | [
"Assert",
"username",
".",
"May",
"raise",
"redirect",
"or",
"return",
"True",
"if",
"request",
"handled",
"."
] | def do_check(self):
"""Assert username. May raise redirect, or return True if request handled."""
sess = cherrypy.session
request = cherrypy.serving.request
response = cherrypy.serving.response
username = sess.get(self.session_key)
if not username:
se... | [
"def",
"do_check",
"(",
"self",
")",
":",
"sess",
"=",
"cherrypy",
".",
"session",
"request",
"=",
"cherrypy",
".",
"serving",
".",
"request",
"response",
"=",
"cherrypy",
".",
"serving",
".",
"response",
"username",
"=",
"sess",
".",
"get",
"(",
"self",... | https://github.com/lad1337/XDM/blob/0c1b7009fe00f06f102a6f67c793478f515e7efe/site-packages/cherrypy/lib/cptools.py#L340-L364 | ||
openshift/openshift-tools | 1188778e728a6e4781acf728123e5b356380fe6f | ansible/roles/lib_oa_openshift/library/oc_obj.py | python | OCObject.run_ansible | (params, check_mode=False) | run the oc_obj module | run the oc_obj module | [
"run",
"the",
"oc_obj",
"module"
] | def run_ansible(params, check_mode=False):
'''run the oc_obj module'''
ocobj = OCObject(params['kind'],
params['namespace'],
params['name'],
params['selector'],
kubeconfig=params['kubeconfig'],
... | [
"def",
"run_ansible",
"(",
"params",
",",
"check_mode",
"=",
"False",
")",
":",
"ocobj",
"=",
"OCObject",
"(",
"params",
"[",
"'kind'",
"]",
",",
"params",
"[",
"'namespace'",
"]",
",",
"params",
"[",
"'name'",
"]",
",",
"params",
"[",
"'selector'",
"]... | https://github.com/openshift/openshift-tools/blob/1188778e728a6e4781acf728123e5b356380fe6f/ansible/roles/lib_oa_openshift/library/oc_obj.py#L1599-L1707 | ||
magic-wormhole/magic-wormhole | e522a3992217b433ac2c36543bf85c27a7226ed9 | src/wormhole/observer.py | python | SequenceObserver.fire | (self, result) | [] | def fire(self, result):
if isinstance(result, Failure):
self._error = result
for d in self._observers:
self._eq.eventually(d.errback, self._error)
self._observers = []
else:
self._results.append(result)
if self._observers:
... | [
"def",
"fire",
"(",
"self",
",",
"result",
")",
":",
"if",
"isinstance",
"(",
"result",
",",
"Failure",
")",
":",
"self",
".",
"_error",
"=",
"result",
"for",
"d",
"in",
"self",
".",
"_observers",
":",
"self",
".",
"_eq",
".",
"eventually",
"(",
"d... | https://github.com/magic-wormhole/magic-wormhole/blob/e522a3992217b433ac2c36543bf85c27a7226ed9/src/wormhole/observer.py#L62-L72 | ||||
duckduckgo/zeroclickinfo-fathead | 477c5652f6576746618dbb8158b67f0960ae9f56 | lib/fathead/python/redirect.py | python | Entry.parse | (self, input_obj) | return self.data | Try to parse given input into a valid entry.
Args:
input_obj: TSV string or list of data.
Returns:
List of data
Raises:
Throws BadEntryException if data is invalid. | Try to parse given input into a valid entry.
Args:
input_obj: TSV string or list of data. | [
"Try",
"to",
"parse",
"given",
"input",
"into",
"a",
"valid",
"entry",
".",
"Args",
":",
"input_obj",
":",
"TSV",
"string",
"or",
"list",
"of",
"data",
"."
] | def parse(self, input_obj):
"""
Try to parse given input into a valid entry.
Args:
input_obj: TSV string or list of data.
Returns:
List of data
Raises:
Throws BadEntryException if data is invalid.
"""
if isinstance(input_obj, s... | [
"def",
"parse",
"(",
"self",
",",
"input_obj",
")",
":",
"if",
"isinstance",
"(",
"input_obj",
",",
"str",
")",
":",
"processed",
"=",
"input_obj",
".",
"split",
"(",
"'\\t'",
")",
"self",
".",
"data",
"=",
"processed",
"elif",
"isinstance",
"(",
"inpu... | https://github.com/duckduckgo/zeroclickinfo-fathead/blob/477c5652f6576746618dbb8158b67f0960ae9f56/lib/fathead/python/redirect.py#L54-L87 | |
robotlearn/pyrobolearn | 9cd7c060723fda7d2779fa255ac998c2c82b8436 | pyrobolearn/simulators/bullet.py | python | Bullet.compute_view_matrix_from_ypr | (self, target_position, distance, yaw, pitch, roll, up_axis_index=2) | return np.asarray(view).reshape(4, 4).T | Compute the view matrix from the yaw, pitch, and roll angles.
The view matrix is the 4x4 matrix that maps the world coordinates into the camera coordinates. Basically,
it applies a rotation and translation such that the world is in front of the camera. That is, instead
of turning the camera to ... | Compute the view matrix from the yaw, pitch, and roll angles. | [
"Compute",
"the",
"view",
"matrix",
"from",
"the",
"yaw",
"pitch",
"and",
"roll",
"angles",
"."
] | def compute_view_matrix_from_ypr(self, target_position, distance, yaw, pitch, roll, up_axis_index=2):
"""Compute the view matrix from the yaw, pitch, and roll angles.
The view matrix is the 4x4 matrix that maps the world coordinates into the camera coordinates. Basically,
it applies a rotation ... | [
"def",
"compute_view_matrix_from_ypr",
"(",
"self",
",",
"target_position",
",",
"distance",
",",
"yaw",
",",
"pitch",
",",
"roll",
",",
"up_axis_index",
"=",
"2",
")",
":",
"view",
"=",
"self",
".",
"sim",
".",
"computeViewMatrixFromYawPitchRoll",
"(",
"camer... | https://github.com/robotlearn/pyrobolearn/blob/9cd7c060723fda7d2779fa255ac998c2c82b8436/pyrobolearn/simulators/bullet.py#L2613-L2638 | |
lvpengyuan/masktextspotter.caffe2 | da99ef31f5ccb4de5248bb881d5b4a291910c8ae | lib/utils/segms.py | python | rle_mask_voting | (
top_masks, all_masks, all_dets, iou_thresh, binarize_thresh, method='AVG'
) | return top_segms_out | Returns new masks (in correspondence with `top_masks`) by combining
multiple overlapping masks coming from the pool of `all_masks`. Two methods
for combining masks are supported: 'AVG' uses a weighted average of
overlapping mask pixels; 'UNION' takes the union of all mask pixels. | Returns new masks (in correspondence with `top_masks`) by combining
multiple overlapping masks coming from the pool of `all_masks`. Two methods
for combining masks are supported: 'AVG' uses a weighted average of
overlapping mask pixels; 'UNION' takes the union of all mask pixels. | [
"Returns",
"new",
"masks",
"(",
"in",
"correspondence",
"with",
"top_masks",
")",
"by",
"combining",
"multiple",
"overlapping",
"masks",
"coming",
"from",
"the",
"pool",
"of",
"all_masks",
".",
"Two",
"methods",
"for",
"combining",
"masks",
"are",
"supported",
... | def rle_mask_voting(
top_masks, all_masks, all_dets, iou_thresh, binarize_thresh, method='AVG'
):
"""Returns new masks (in correspondence with `top_masks`) by combining
multiple overlapping masks coming from the pool of `all_masks`. Two methods
for combining masks are supported: 'AVG' uses a weighted av... | [
"def",
"rle_mask_voting",
"(",
"top_masks",
",",
"all_masks",
",",
"all_dets",
",",
"iou_thresh",
",",
"binarize_thresh",
",",
"method",
"=",
"'AVG'",
")",
":",
"if",
"len",
"(",
"top_masks",
")",
"==",
"0",
":",
"return",
"all_not_crowd",
"=",
"[",
"False... | https://github.com/lvpengyuan/masktextspotter.caffe2/blob/da99ef31f5ccb4de5248bb881d5b4a291910c8ae/lib/utils/segms.py#L241-L302 | |
kevoreilly/CAPEv2 | 6cf79c33264624b3604d4cd432cde2a6b4536de6 | modules/machinery/vsphere.py | python | vSphere._stop_virtual_machine | (self, vm) | Power off a virtual machine | Power off a virtual machine | [
"Power",
"off",
"a",
"virtual",
"machine"
] | def _stop_virtual_machine(self, vm):
"""Power off a virtual machine"""
log.info("Powering off virtual machine %s", vm.summary.config.name)
task = vm.PowerOffVM_Task()
try:
self._wait_task(task)
except CuckooMachineError as e:
log.error("PowerOffVM: %s", e) | [
"def",
"_stop_virtual_machine",
"(",
"self",
",",
"vm",
")",
":",
"log",
".",
"info",
"(",
"\"Powering off virtual machine %s\"",
",",
"vm",
".",
"summary",
".",
"config",
".",
"name",
")",
"task",
"=",
"vm",
".",
"PowerOffVM_Task",
"(",
")",
"try",
":",
... | https://github.com/kevoreilly/CAPEv2/blob/6cf79c33264624b3604d4cd432cde2a6b4536de6/modules/machinery/vsphere.py#L316-L323 | ||
CouchPotato/CouchPotatoV1 | 135b3331d1b88ef645e29b76f2d4cc4a732c9232 | library/httplib2/__init__.py | python | HTTPResponse__getheaders | (self) | return self.msg.items() | Return list of (header, value) tuples. | Return list of (header, value) tuples. | [
"Return",
"list",
"of",
"(",
"header",
"value",
")",
"tuples",
"."
] | def HTTPResponse__getheaders(self):
"""Return list of (header, value) tuples."""
if self.msg is None:
raise httplib.ResponseNotReady()
return self.msg.items() | [
"def",
"HTTPResponse__getheaders",
"(",
"self",
")",
":",
"if",
"self",
".",
"msg",
"is",
"None",
":",
"raise",
"httplib",
".",
"ResponseNotReady",
"(",
")",
"return",
"self",
".",
"msg",
".",
"items",
"(",
")"
] | https://github.com/CouchPotato/CouchPotatoV1/blob/135b3331d1b88ef645e29b76f2d4cc4a732c9232/library/httplib2/__init__.py#L104-L108 | |
home-assistant/core | 265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1 | homeassistant/components/gree/climate.py | python | GreeClimateEntity.async_set_temperature | (self, **kwargs) | Set new target temperature. | Set new target temperature. | [
"Set",
"new",
"target",
"temperature",
"."
] | async def async_set_temperature(self, **kwargs):
"""Set new target temperature."""
if ATTR_TEMPERATURE not in kwargs:
raise ValueError(f"Missing parameter {ATTR_TEMPERATURE}")
temperature = kwargs[ATTR_TEMPERATURE]
_LOGGER.debug(
"Setting temperature to %d for %s... | [
"async",
"def",
"async_set_temperature",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"ATTR_TEMPERATURE",
"not",
"in",
"kwargs",
":",
"raise",
"ValueError",
"(",
"f\"Missing parameter {ATTR_TEMPERATURE}\"",
")",
"temperature",
"=",
"kwargs",
"[",
"ATTR_TE... | https://github.com/home-assistant/core/blob/265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1/homeassistant/components/gree/climate.py#L177-L191 | ||
mozillazg/pypy | 2ff5cd960c075c991389f842c6d59e71cf0cb7d0 | pypy/module/operator/interp_operator.py | python | setitem | (space, w_obj, w_key, w_value) | setitem(a, b, c) -- Same as a[b] = c. | setitem(a, b, c) -- Same as a[b] = c. | [
"setitem",
"(",
"a",
"b",
"c",
")",
"--",
"Same",
"as",
"a",
"[",
"b",
"]",
"=",
"c",
"."
] | def setitem(space, w_obj, w_key, w_value):
'setitem(a, b, c) -- Same as a[b] = c.'
space.setitem(w_obj, w_key, w_value) | [
"def",
"setitem",
"(",
"space",
",",
"w_obj",
",",
"w_key",
",",
"w_value",
")",
":",
"space",
".",
"setitem",
"(",
"w_obj",
",",
"w_key",
",",
"w_value",
")"
] | https://github.com/mozillazg/pypy/blob/2ff5cd960c075c991389f842c6d59e71cf0cb7d0/pypy/module/operator/interp_operator.py#L147-L149 | ||
danielfm/pybreaker | 1dbcbda76dda1d1d3a9df25cbe1912655dbbf6cc | src/pybreaker.py | python | CircuitBreaker.call_async | (self, func, *args, **kwargs) | return wrapped() | Calls async `func` with the given `args` and `kwargs` according to the rules
implemented by the current state of this circuit breaker.
Return a closure to prevent import errors when using without tornado present | Calls async `func` with the given `args` and `kwargs` according to the rules
implemented by the current state of this circuit breaker. | [
"Calls",
"async",
"func",
"with",
"the",
"given",
"args",
"and",
"kwargs",
"according",
"to",
"the",
"rules",
"implemented",
"by",
"the",
"current",
"state",
"of",
"this",
"circuit",
"breaker",
"."
] | def call_async(self, func, *args, **kwargs):
"""
Calls async `func` with the given `args` and `kwargs` according to the rules
implemented by the current state of this circuit breaker.
Return a closure to prevent import errors when using without tornado present
"""
@gen.c... | [
"def",
"call_async",
"(",
"self",
",",
"func",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"@",
"gen",
".",
"coroutine",
"def",
"wrapped",
"(",
")",
":",
"with",
"self",
".",
"_lock",
":",
"ret",
"=",
"yield",
"self",
".",
"state",
".",
... | https://github.com/danielfm/pybreaker/blob/1dbcbda76dda1d1d3a9df25cbe1912655dbbf6cc/src/pybreaker.py#L218-L230 | |
styxit/HTPC-Manager | 490697460b4fa1797106aece27d873bc256b2ff1 | libs/cherrypy/lib/sessions.py | python | Session.save | (self) | Save session data. | Save session data. | [
"Save",
"session",
"data",
"."
] | def save(self):
"""Save session data."""
try:
# If session data has never been loaded then it's never been
# accessed: no need to save it
if self.loaded:
t = datetime.timedelta(seconds = self.timeout * 60)
expiration_time = self.now()... | [
"def",
"save",
"(",
"self",
")",
":",
"try",
":",
"# If session data has never been loaded then it's never been",
"# accessed: no need to save it",
"if",
"self",
".",
"loaded",
":",
"t",
"=",
"datetime",
".",
"timedelta",
"(",
"seconds",
"=",
"self",
".",
"timeout... | https://github.com/styxit/HTPC-Manager/blob/490697460b4fa1797106aece27d873bc256b2ff1/libs/cherrypy/lib/sessions.py#L214-L230 | ||
pyvista/pyvista | 012dbb95a9aae406c3cd4cd94fc8c477f871e426 | pyvista/utilities/errors.py | python | send_errors_to_logging | () | return obs.observe(error_output) | Send all VTK error/warning messages to Python's logging module. | Send all VTK error/warning messages to Python's logging module. | [
"Send",
"all",
"VTK",
"error",
"/",
"warning",
"messages",
"to",
"Python",
"s",
"logging",
"module",
"."
] | def send_errors_to_logging():
"""Send all VTK error/warning messages to Python's logging module."""
error_output = _vtk.vtkStringOutputWindow()
error_win = _vtk.vtkOutputWindow()
error_win.SetInstance(error_output)
obs = Observer()
return obs.observe(error_output) | [
"def",
"send_errors_to_logging",
"(",
")",
":",
"error_output",
"=",
"_vtk",
".",
"vtkStringOutputWindow",
"(",
")",
"error_win",
"=",
"_vtk",
".",
"vtkOutputWindow",
"(",
")",
"error_win",
".",
"SetInstance",
"(",
"error_output",
")",
"obs",
"=",
"Observer",
... | https://github.com/pyvista/pyvista/blob/012dbb95a9aae406c3cd4cd94fc8c477f871e426/pyvista/utilities/errors.py#L171-L177 | |
tp4a/teleport | 1fafd34f1f775d2cf80ea4af6e44468d8e0b24ad | server/www/packages/packages-darwin/x64/mako/_ast_util.py | python | SourceGenerator.__init__ | (self, indent_with) | [] | def __init__(self, indent_with):
self.result = []
self.indent_with = indent_with
self.indentation = 0
self.new_lines = 0 | [
"def",
"__init__",
"(",
"self",
",",
"indent_with",
")",
":",
"self",
".",
"result",
"=",
"[",
"]",
"self",
".",
"indent_with",
"=",
"indent_with",
"self",
".",
"indentation",
"=",
"0",
"self",
".",
"new_lines",
"=",
"0"
] | https://github.com/tp4a/teleport/blob/1fafd34f1f775d2cf80ea4af6e44468d8e0b24ad/server/www/packages/packages-darwin/x64/mako/_ast_util.py#L361-L365 | ||||
hydroshare/hydroshare | 7ba563b55412f283047fb3ef6da367d41dec58c6 | hs_modflow_modelinstance/models.py | python | MODFLOWModelInstanceMetaData.stress_period | (self) | return self._stress_period.all().first() | [] | def stress_period(self):
return self._stress_period.all().first() | [
"def",
"stress_period",
"(",
"self",
")",
":",
"return",
"self",
".",
"_stress_period",
".",
"all",
"(",
")",
".",
"first",
"(",
")"
] | https://github.com/hydroshare/hydroshare/blob/7ba563b55412f283047fb3ef6da367d41dec58c6/hs_modflow_modelinstance/models.py#L708-L709 | |||
blurstudio/cross3d | 277968d1227de740fc87ef61005c75034420eadf | cross3d/studiomax/cachelib/transformcache.py | python | toggleCaches | ( object, state ) | return False | \remarks enables/disables the caches on the inputed object based on the given state
\param object <Py3dsMax.mxs.Object>
\param state <bool>
\return <bool> success | \remarks enables/disables the caches on the inputed object based on the given state
\param object <Py3dsMax.mxs.Object>
\param state <bool>
\return <bool> success | [
"\\",
"remarks",
"enables",
"/",
"disables",
"the",
"caches",
"on",
"the",
"inputed",
"object",
"based",
"on",
"the",
"given",
"state",
"\\",
"param",
"object",
"<Py3dsMax",
".",
"mxs",
".",
"Object",
">",
"\\",
"param",
"state",
"<bool",
">",
"\\",
"ret... | def toggleCaches( object, state ):
"""
\remarks enables/disables the caches on the inputed object based on the given state
\param object <Py3dsMax.mxs.Object>
\param state <bool>
\return <bool> success
"""
is_prop = mxs.isproperty
classof = mxs.classof
if ( is_prop( object, 'controller' ) and classo... | [
"def",
"toggleCaches",
"(",
"object",
",",
"state",
")",
":",
"is_prop",
"=",
"mxs",
".",
"isproperty",
"classof",
"=",
"mxs",
".",
"classof",
"if",
"(",
"is_prop",
"(",
"object",
",",
"'controller'",
")",
"and",
"classof",
"(",
"object",
".",
"controlle... | https://github.com/blurstudio/cross3d/blob/277968d1227de740fc87ef61005c75034420eadf/cross3d/studiomax/cachelib/transformcache.py#L70-L85 | |
haiwen/seahub | e92fcd44e3e46260597d8faa9347cb8222b8b10d | seahub/api2/views.py | python | RepoHistoryLimit.put | (self, request, repo_id, format=None) | [] | def put(self, request, repo_id, format=None):
repo = seafile_api.get_repo(repo_id)
if not repo:
error_msg = 'Library %s not found.' % repo_id
return api_error(status.HTTP_404_NOT_FOUND, error_msg)
# check permission
if is_org_context(request):
repo_o... | [
"def",
"put",
"(",
"self",
",",
"request",
",",
"repo_id",
",",
"format",
"=",
"None",
")",
":",
"repo",
"=",
"seafile_api",
".",
"get_repo",
"(",
"repo_id",
")",
"if",
"not",
"repo",
":",
"error_msg",
"=",
"'Library %s not found.'",
"%",
"repo_id",
"ret... | https://github.com/haiwen/seahub/blob/e92fcd44e3e46260597d8faa9347cb8222b8b10d/seahub/api2/views.py#L1494-L1550 | ||||
securityclippy/elasticintel | aa08d3e9f5ab1c000128e95161139ce97ff0e334 | whois_lambda/dns/rdatatype.py | python | from_text | (text) | return value | Convert text into a DNS rdata type value.
@param text: the text
@type text: string
@raises dns.rdatatype.UnknownRdatatype: the type is unknown
@raises ValueError: the rdata type value is not >= 0 and <= 65535
@rtype: int | Convert text into a DNS rdata type value. | [
"Convert",
"text",
"into",
"a",
"DNS",
"rdata",
"type",
"value",
"."
] | def from_text(text):
"""Convert text into a DNS rdata type value.
@param text: the text
@type text: string
@raises dns.rdatatype.UnknownRdatatype: the type is unknown
@raises ValueError: the rdata type value is not >= 0 and <= 65535
@rtype: int"""
value = _by_text.get(text.upper())
if v... | [
"def",
"from_text",
"(",
"text",
")",
":",
"value",
"=",
"_by_text",
".",
"get",
"(",
"text",
".",
"upper",
"(",
")",
")",
"if",
"value",
"is",
"None",
":",
"match",
"=",
"_unknown_type_pattern",
".",
"match",
"(",
"text",
")",
"if",
"match",
"is",
... | https://github.com/securityclippy/elasticintel/blob/aa08d3e9f5ab1c000128e95161139ce97ff0e334/whois_lambda/dns/rdatatype.py#L202-L218 | |
isce-framework/isce2 | 0e5114a8bede3caf1d533d98e44dfe4b983e3f48 | components/isceobj/Planet/Planet.py | python | Planet.polar_axis | (self, vector) | return None | Give me a vector that is parallel to my spin axis | Give me a vector that is parallel to my spin axis | [
"Give",
"me",
"a",
"vector",
"that",
"is",
"parallel",
"to",
"my",
"spin",
"axis"
] | def polar_axis(self, vector):
"""Give me a vector that is parallel to my spin axis"""
from isceobj.Util.geo.euclid import Vector
if not isinstance(vector, Vector):
try:
vector = Vector(*vector)
except Exception:
raise ValueError(
... | [
"def",
"polar_axis",
"(",
"self",
",",
"vector",
")",
":",
"from",
"isceobj",
".",
"Util",
".",
"geo",
".",
"euclid",
"import",
"Vector",
"if",
"not",
"isinstance",
"(",
"vector",
",",
"Vector",
")",
":",
"try",
":",
"vector",
"=",
"Vector",
"(",
"*"... | https://github.com/isce-framework/isce2/blob/0e5114a8bede3caf1d533d98e44dfe4b983e3f48/components/isceobj/Planet/Planet.py#L179-L191 | |
lightforever/mlcomp | c78fdb77ec9c4ec8ff11beea50b90cab20903ad9 | mlcomp/contrib/segmentation/deeplabv3/aspp.py | python | ASPP._init_weight | (self) | [] | def _init_weight(self):
for m in self.modules():
if isinstance(m, nn.Conv2d):
# n = m.kernel_size[0] * m.kernel_size[1] * m.out_channels
# m.weight.data.normal_(0, math.sqrt(2. / n))
torch.nn.init.kaiming_normal_(m.weight)
elif isinstance(m... | [
"def",
"_init_weight",
"(",
"self",
")",
":",
"for",
"m",
"in",
"self",
".",
"modules",
"(",
")",
":",
"if",
"isinstance",
"(",
"m",
",",
"nn",
".",
"Conv2d",
")",
":",
"# n = m.kernel_size[0] * m.kernel_size[1] * m.out_channels",
"# m.weight.data.normal_(0, math.... | https://github.com/lightforever/mlcomp/blob/c78fdb77ec9c4ec8ff11beea50b90cab20903ad9/mlcomp/contrib/segmentation/deeplabv3/aspp.py#L85-L93 | ||||
chenguanyou/weixin_YiQi | ad86ed8061f4f5fa88b6600a9b0809e5bb3bfd08 | backend/Yiqi/Yiqi/partyApp/xadmin/views/list.py | python | ListAdminView.get_list_display | (self) | return list(self.base_list_display) | Return a sequence containing the fields to be displayed on the list. | Return a sequence containing the fields to be displayed on the list. | [
"Return",
"a",
"sequence",
"containing",
"the",
"fields",
"to",
"be",
"displayed",
"on",
"the",
"list",
"."
] | def get_list_display(self):
"""
Return a sequence containing the fields to be displayed on the list.
"""
self.base_list_display = (COL_LIST_VAR in self.request.GET and self.request.GET[COL_LIST_VAR] != "" and \
self.request.GET[COL_LIST_VAR].split('.')) or self.list_display
... | [
"def",
"get_list_display",
"(",
"self",
")",
":",
"self",
".",
"base_list_display",
"=",
"(",
"COL_LIST_VAR",
"in",
"self",
".",
"request",
".",
"GET",
"and",
"self",
".",
"request",
".",
"GET",
"[",
"COL_LIST_VAR",
"]",
"!=",
"\"\"",
"and",
"self",
".",... | https://github.com/chenguanyou/weixin_YiQi/blob/ad86ed8061f4f5fa88b6600a9b0809e5bb3bfd08/backend/Yiqi/Yiqi/partyApp/xadmin/views/list.py#L148-L154 | |
errbotio/errbot | 66e1de8e1d7daa62be7f9ed1b2ac8832f09fa25d | errbot/core_plugins/utils.py | python | Utils.render_test | (self, _, args) | Tests / showcases the markdown rendering on your current backend | Tests / showcases the markdown rendering on your current backend | [
"Tests",
"/",
"showcases",
"the",
"markdown",
"rendering",
"on",
"your",
"current",
"backend"
] | def render_test(self, _, args):
"""Tests / showcases the markdown rendering on your current backend"""
with open(path.join(path.dirname(path.realpath(__file__)), "test.md")) as f:
return f.read() | [
"def",
"render_test",
"(",
"self",
",",
"_",
",",
"args",
")",
":",
"with",
"open",
"(",
"path",
".",
"join",
"(",
"path",
".",
"dirname",
"(",
"path",
".",
"realpath",
"(",
"__file__",
")",
")",
",",
"\"test.md\"",
")",
")",
"as",
"f",
":",
"ret... | https://github.com/errbotio/errbot/blob/66e1de8e1d7daa62be7f9ed1b2ac8832f09fa25d/errbot/core_plugins/utils.py#L74-L77 | ||
oilshell/oil | 94388e7d44a9ad879b12615f6203b38596b5a2d3 | Python-2.7.13/Lib/idlelib/WidgetRedirector.py | python | WidgetRedirector.dispatch | (self, operation, *args) | Callback from Tcl which runs when the widget is referenced.
If an operation has been registered in self._operations, apply the
associated function to the args passed into Tcl. Otherwise, pass the
operation through to Tk via the original Tcl function.
Note that if a registered function ... | Callback from Tcl which runs when the widget is referenced. | [
"Callback",
"from",
"Tcl",
"which",
"runs",
"when",
"the",
"widget",
"is",
"referenced",
"."
] | def dispatch(self, operation, *args):
'''Callback from Tcl which runs when the widget is referenced.
If an operation has been registered in self._operations, apply the
associated function to the args passed into Tcl. Otherwise, pass the
operation through to Tk via the original Tcl funct... | [
"def",
"dispatch",
"(",
"self",
",",
"operation",
",",
"*",
"args",
")",
":",
"m",
"=",
"self",
".",
"_operations",
".",
"get",
"(",
"operation",
")",
"try",
":",
"if",
"m",
":",
"return",
"m",
"(",
"*",
"args",
")",
"else",
":",
"return",
"self"... | https://github.com/oilshell/oil/blob/94388e7d44a9ad879b12615f6203b38596b5a2d3/Python-2.7.13/Lib/idlelib/WidgetRedirector.py#L98-L117 | ||
hatRiot/zarp | 2e772350a01c2aeed3f4da9685cd0cc5d6b3ecad | src/lib/scapy/fields.py | python | IPField.any2i | (self, pkt, x) | return self.h2i(pkt,x) | [] | def any2i(self, pkt, x):
return self.h2i(pkt,x) | [
"def",
"any2i",
"(",
"self",
",",
"pkt",
",",
"x",
")",
":",
"return",
"self",
".",
"h2i",
"(",
"pkt",
",",
"x",
")"
] | https://github.com/hatRiot/zarp/blob/2e772350a01c2aeed3f4da9685cd0cc5d6b3ecad/src/lib/scapy/fields.py#L213-L214 | |||
Huangying-Zhan/DF-VO | 6a2ec43fc6209d9058ae1709d779c5ada68a31f3 | libs/deep_models/flow/deep_flow.py | python | DeepFlow.generate_images_pred_flow | (self, inputs, outputs) | return outputs | Generate the warped (reprojected) color images using optical flow for a minibatch.
Generated images are saved into the `outputs` dictionary. | Generate the warped (reprojected) color images using optical flow for a minibatch.
Generated images are saved into the `outputs` dictionary. | [
"Generate",
"the",
"warped",
"(",
"reprojected",
")",
"color",
"images",
"using",
"optical",
"flow",
"for",
"a",
"minibatch",
".",
"Generated",
"images",
"are",
"saved",
"into",
"the",
"outputs",
"dictionary",
"."
] | def generate_images_pred_flow(self, inputs, outputs):
"""Generate the warped (reprojected) color images using optical flow for a minibatch.
Generated images are saved into the `outputs` dictionary.
"""
source_scale = 0
for _, f_i in enumerate(self.frame_ids[1:]):
if f... | [
"def",
"generate_images_pred_flow",
"(",
"self",
",",
"inputs",
",",
"outputs",
")",
":",
"source_scale",
"=",
"0",
"for",
"_",
",",
"f_i",
"in",
"enumerate",
"(",
"self",
".",
"frame_ids",
"[",
"1",
":",
"]",
")",
":",
"if",
"f_i",
"!=",
"\"s\"",
":... | https://github.com/Huangying-Zhan/DF-VO/blob/6a2ec43fc6209d9058ae1709d779c5ada68a31f3/libs/deep_models/flow/deep_flow.py#L254-L282 | |
arsaboo/homeassistant-config | 53c998986fbe84d793a0b174757154ab30e676e4 | custom_components/alexa_media/sensor.py | python | AlexaMediaNotificationSensor.__init__ | (
self,
client,
n_dict,
sensor_property: Text,
account,
name="Next Notification",
icon=None,
) | Initialize the Alexa sensor device. | Initialize the Alexa sensor device. | [
"Initialize",
"the",
"Alexa",
"sensor",
"device",
"."
] | def __init__(
self,
client,
n_dict,
sensor_property: Text,
account,
name="Next Notification",
icon=None,
):
"""Initialize the Alexa sensor device."""
# Class info
self._client = client
self._n_dict = n_dict
self._sensor_... | [
"def",
"__init__",
"(",
"self",
",",
"client",
",",
"n_dict",
",",
"sensor_property",
":",
"Text",
",",
"account",
",",
"name",
"=",
"\"Next Notification\"",
",",
"icon",
"=",
"None",
",",
")",
":",
"# Class info",
"self",
".",
"_client",
"=",
"client",
... | https://github.com/arsaboo/homeassistant-config/blob/53c998986fbe84d793a0b174757154ab30e676e4/custom_components/alexa_media/sensor.py#L139-L165 | ||
mardix/assembly | 4c993d19bc9d33c1641323e03231e9ecad711b38 | assembly/_extensions.py | python | _Mailer.send | (self, to, subject=None, body=None, reply_to=None, template=None, **kwargs) | To send email
:param to: the recipients, list or string
:param subject: the subject
:param body: the body
:param reply_to: reply_to
:param template: template, will use the templates instead
:param kwargs: context args
:return: bool - True if everything is ok | To send email
:param to: the recipients, list or string
:param subject: the subject
:param body: the body
:param reply_to: reply_to
:param template: template, will use the templates instead
:param kwargs: context args
:return: bool - True if everything is ok | [
"To",
"send",
"email",
":",
"param",
"to",
":",
"the",
"recipients",
"list",
"or",
"string",
":",
"param",
"subject",
":",
"the",
"subject",
":",
"param",
"body",
":",
"the",
"body",
":",
"param",
"reply_to",
":",
"reply_to",
":",
"param",
"template",
... | def send(self, to, subject=None, body=None, reply_to=None, template=None, **kwargs):
"""
To send email
:param to: the recipients, list or string
:param subject: the subject
:param body: the body
:param reply_to: reply_to
:param template: template, will use the tem... | [
"def",
"send",
"(",
"self",
",",
"to",
",",
"subject",
"=",
"None",
",",
"body",
"=",
"None",
",",
"reply_to",
"=",
"None",
",",
"template",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"sender",
"=",
"self",
".",
"config",
".",
"get",
"(",
... | https://github.com/mardix/assembly/blob/4c993d19bc9d33c1641323e03231e9ecad711b38/assembly/_extensions.py#L181-L230 | ||
SteveDoyle2/pyNastran | eda651ac2d4883d95a34951f8a002ff94f642a1a | pyNastran/gui/gui_common.py | python | GuiCommon.__init__ | (self, **kwds) | fmt_order, html_logging, inputs, parent=None, | fmt_order, html_logging, inputs, parent=None, | [
"fmt_order",
"html_logging",
"inputs",
"parent",
"=",
"None"
] | def __init__(self, **kwds):
"""
fmt_order, html_logging, inputs, parent=None,
"""
# this will reset the background color/label color if things break
#super(QMainWindow, self).__init__(self)
if qt_version == 'pyqt5':
super(GuiCommon, self).__init__(**kwds)
... | [
"def",
"__init__",
"(",
"self",
",",
"*",
"*",
"kwds",
")",
":",
"# this will reset the background color/label color if things break",
"#super(QMainWindow, self).__init__(self)",
"if",
"qt_version",
"==",
"'pyqt5'",
":",
"super",
"(",
"GuiCommon",
",",
"self",
")",
".",... | https://github.com/SteveDoyle2/pyNastran/blob/eda651ac2d4883d95a34951f8a002ff94f642a1a/pyNastran/gui/gui_common.py#L64-L110 | ||
daiquocnguyen/Graph-Transformer | f9dc818a06ff0490f3d1bcc2e7b9ccd188950dcd | UGformerV1_TF/universal_transformer_modified.py | python | update_hparams_for_universal_transformer | (hparams) | return hparams | Adds deault hparams for all of the variants of the Universal Transformer.
Args:
hparams: default hparams (usually one of the standard hparams from
transformer model (like "transformer_base")
Returns:
hparams with default values for Universal Transformers hyper-parameters | Adds deault hparams for all of the variants of the Universal Transformer. | [
"Adds",
"deault",
"hparams",
"for",
"all",
"of",
"the",
"variants",
"of",
"the",
"Universal",
"Transformer",
"."
] | def update_hparams_for_universal_transformer(hparams):
"""Adds deault hparams for all of the variants of the Universal Transformer.
Args:
hparams: default hparams (usually one of the standard hparams from
transformer model (like "transformer_base")
Returns:
hparams with default values for Universa... | [
"def",
"update_hparams_for_universal_transformer",
"(",
"hparams",
")",
":",
"hparams",
".",
"daisy_chain_variables",
"=",
"False",
"# Breaks multi-gpu in while loops.",
"# If not None, mixes vanilla transformer with Universal Transformer.",
"# Options: None, \"before_ut\", and \"after_ut\... | https://github.com/daiquocnguyen/Graph-Transformer/blob/f9dc818a06ff0490f3d1bcc2e7b9ccd188950dcd/UGformerV1_TF/universal_transformer_modified.py#L349-L431 | |
smart-mobile-software/gitstack | d9fee8f414f202143eb6e620529e8e5539a2af56 | python/Lib/cookielib.py | python | unmatched | (match) | return match.string[:start]+match.string[end:] | Return unmatched part of re.Match object. | Return unmatched part of re.Match object. | [
"Return",
"unmatched",
"part",
"of",
"re",
".",
"Match",
"object",
"."
] | def unmatched(match):
"""Return unmatched part of re.Match object."""
start, end = match.span(0)
return match.string[:start]+match.string[end:] | [
"def",
"unmatched",
"(",
"match",
")",
":",
"start",
",",
"end",
"=",
"match",
".",
"span",
"(",
"0",
")",
"return",
"match",
".",
"string",
"[",
":",
"start",
"]",
"+",
"match",
".",
"string",
"[",
"end",
":",
"]"
] | https://github.com/smart-mobile-software/gitstack/blob/d9fee8f414f202143eb6e620529e8e5539a2af56/python/Lib/cookielib.py#L317-L320 | |
omz/PythonistaAppTemplate | f560f93f8876d82a21d108977f90583df08d55af | PythonistaAppTemplate/PythonistaKit.framework/pylib/inspect.py | python | getmembers | (object, predicate=None) | return results | Return all members of an object as (name, value) pairs sorted by name.
Optionally, only return members that satisfy a given predicate. | Return all members of an object as (name, value) pairs sorted by name.
Optionally, only return members that satisfy a given predicate. | [
"Return",
"all",
"members",
"of",
"an",
"object",
"as",
"(",
"name",
"value",
")",
"pairs",
"sorted",
"by",
"name",
".",
"Optionally",
"only",
"return",
"members",
"that",
"satisfy",
"a",
"given",
"predicate",
"."
] | def getmembers(object, predicate=None):
"""Return all members of an object as (name, value) pairs sorted by name.
Optionally, only return members that satisfy a given predicate."""
results = []
for key in dir(object):
try:
value = getattr(object, key)
except AttributeError:
... | [
"def",
"getmembers",
"(",
"object",
",",
"predicate",
"=",
"None",
")",
":",
"results",
"=",
"[",
"]",
"for",
"key",
"in",
"dir",
"(",
"object",
")",
":",
"try",
":",
"value",
"=",
"getattr",
"(",
"object",
",",
"key",
")",
"except",
"AttributeError"... | https://github.com/omz/PythonistaAppTemplate/blob/f560f93f8876d82a21d108977f90583df08d55af/PythonistaAppTemplate/PythonistaKit.framework/pylib/inspect.py#L247-L259 | |
niosus/EasyClangComplete | 3b16eb17735aaa3f56bb295fc5481b269ee9f2ef | plugin/clang/cindex33.py | python | Token.spelling | (self) | return conf.lib.clang_getTokenSpelling(self._tu, self) | The spelling of this token.
This is the textual representation of the token in source. | The spelling of this token. | [
"The",
"spelling",
"of",
"this",
"token",
"."
] | def spelling(self):
"""The spelling of this token.
This is the textual representation of the token in source.
"""
return conf.lib.clang_getTokenSpelling(self._tu, self) | [
"def",
"spelling",
"(",
"self",
")",
":",
"return",
"conf",
".",
"lib",
".",
"clang_getTokenSpelling",
"(",
"self",
".",
"_tu",
",",
"self",
")"
] | https://github.com/niosus/EasyClangComplete/blob/3b16eb17735aaa3f56bb295fc5481b269ee9f2ef/plugin/clang/cindex33.py#L2509-L2514 | |
python-attrs/cattrs | 50ba769c8349f5891b157d2bb7f06602822ac0a3 | src/cattr/converters.py | python | Converter._structure_dict | (self, obj, cl) | Convert a mapping into a potentially generic dict. | Convert a mapping into a potentially generic dict. | [
"Convert",
"a",
"mapping",
"into",
"a",
"potentially",
"generic",
"dict",
"."
] | def _structure_dict(self, obj, cl):
"""Convert a mapping into a potentially generic dict."""
if is_bare(cl) or cl.__args__ == (Any, Any):
return dict(obj)
else:
key_type, val_type = cl.__args__
if key_type is Any:
val_conv = self._structure_fun... | [
"def",
"_structure_dict",
"(",
"self",
",",
"obj",
",",
"cl",
")",
":",
"if",
"is_bare",
"(",
"cl",
")",
"or",
"cl",
".",
"__args__",
"==",
"(",
"Any",
",",
"Any",
")",
":",
"return",
"dict",
"(",
"obj",
")",
"else",
":",
"key_type",
",",
"val_ty... | https://github.com/python-attrs/cattrs/blob/50ba769c8349f5891b157d2bb7f06602822ac0a3/src/cattr/converters.py#L503-L521 | ||
cagbal/ros_people_object_detection_tensorflow | 982ffd4a54b8059638f5cd4aa167299c7fc9e61f | src/object_detection/metrics/tf_example_parser.py | python | BoundingBoxParser.__init__ | (self, xmin_field_name, ymin_field_name, xmax_field_name,
ymax_field_name) | [] | def __init__(self, xmin_field_name, ymin_field_name, xmax_field_name,
ymax_field_name):
self.field_names = [
ymin_field_name, xmin_field_name, ymax_field_name, xmax_field_name
] | [
"def",
"__init__",
"(",
"self",
",",
"xmin_field_name",
",",
"ymin_field_name",
",",
"xmax_field_name",
",",
"ymax_field_name",
")",
":",
"self",
".",
"field_names",
"=",
"[",
"ymin_field_name",
",",
"xmin_field_name",
",",
"ymax_field_name",
",",
"xmax_field_name",... | https://github.com/cagbal/ros_people_object_detection_tensorflow/blob/982ffd4a54b8059638f5cd4aa167299c7fc9e61f/src/object_detection/metrics/tf_example_parser.py#L68-L72 | ||||
Tautulli/Tautulli | 2410eb33805aaac4bd1c5dad0f71e4f15afaf742 | lib/pyparsing/core.py | python | ParserElement.__rmul__ | (self, other) | return self.__mul__(other) | [] | def __rmul__(self, other):
return self.__mul__(other) | [
"def",
"__rmul__",
"(",
"self",
",",
"other",
")",
":",
"return",
"self",
".",
"__mul__",
"(",
"other",
")"
] | https://github.com/Tautulli/Tautulli/blob/2410eb33805aaac4bd1c5dad0f71e4f15afaf742/lib/pyparsing/core.py#L1509-L1510 | |||
conda/conda-build | 2a19925f2b2ca188f80ffa625cd783e7d403793f | versioneer.py | python | versions_from_parentdir | (parentdir_prefix, root, verbose) | Try to determine the version from the parent directory name.
Source tarballs conventionally unpack into a directory that includes both
the project name and a version string. We will also support searching up
two directory levels for an appropriately named parent directory | Try to determine the version from the parent directory name. | [
"Try",
"to",
"determine",
"the",
"version",
"from",
"the",
"parent",
"directory",
"name",
"."
] | def versions_from_parentdir(parentdir_prefix, root, verbose):
"""Try to determine the version from the parent directory name.
Source tarballs conventionally unpack into a directory that includes both
the project name and a version string. We will also support searching up
two directory levels for an ap... | [
"def",
"versions_from_parentdir",
"(",
"parentdir_prefix",
",",
"root",
",",
"verbose",
")",
":",
"rootdirs",
"=",
"[",
"]",
"for",
"i",
"in",
"range",
"(",
"3",
")",
":",
"dirname",
"=",
"os",
".",
"path",
".",
"basename",
"(",
"root",
")",
"if",
"d... | https://github.com/conda/conda-build/blob/2a19925f2b2ca188f80ffa625cd783e7d403793f/versioneer.py#L1158-L1180 | ||
runawayhorse001/LearningApacheSpark | 67f3879dce17553195f094f5728b94a01badcf24 | pyspark/sql/context.py | python | SQLContext.getOrCreate | (cls, sc) | return cls._instantiatedContext | Get the existing SQLContext or create a new one with given SparkContext.
:param sc: SparkContext | Get the existing SQLContext or create a new one with given SparkContext. | [
"Get",
"the",
"existing",
"SQLContext",
"or",
"create",
"a",
"new",
"one",
"with",
"given",
"SparkContext",
"."
] | def getOrCreate(cls, sc):
"""
Get the existing SQLContext or create a new one with given SparkContext.
:param sc: SparkContext
"""
if cls._instantiatedContext is None:
jsqlContext = sc._jvm.SQLContext.getOrCreate(sc._jsc.sc())
sparkSession = SparkSession(... | [
"def",
"getOrCreate",
"(",
"cls",
",",
"sc",
")",
":",
"if",
"cls",
".",
"_instantiatedContext",
"is",
"None",
":",
"jsqlContext",
"=",
"sc",
".",
"_jvm",
".",
"SQLContext",
".",
"getOrCreate",
"(",
"sc",
".",
"_jsc",
".",
"sc",
"(",
")",
")",
"spark... | https://github.com/runawayhorse001/LearningApacheSpark/blob/67f3879dce17553195f094f5728b94a01badcf24/pyspark/sql/context.py#L103-L113 | |
onaio/onadata | 89ad16744e8f247fb748219476f6ac295869a95f | onadata/libs/utils/viewer_tools.py | python | image_urls_for_form | (xform) | return sum(
[
image_urls(s)
for s in xform.instances.filter(deleted_at__isnull=True)
], []) | Return image urls of all image attachments of the xform. | Return image urls of all image attachments of the xform. | [
"Return",
"image",
"urls",
"of",
"all",
"image",
"attachments",
"of",
"the",
"xform",
"."
] | def image_urls_for_form(xform):
"""Return image urls of all image attachments of the xform."""
return sum(
[
image_urls(s)
for s in xform.instances.filter(deleted_at__isnull=True)
], []) | [
"def",
"image_urls_for_form",
"(",
"xform",
")",
":",
"return",
"sum",
"(",
"[",
"image_urls",
"(",
"s",
")",
"for",
"s",
"in",
"xform",
".",
"instances",
".",
"filter",
"(",
"deleted_at__isnull",
"=",
"True",
")",
"]",
",",
"[",
"]",
")"
] | https://github.com/onaio/onadata/blob/89ad16744e8f247fb748219476f6ac295869a95f/onadata/libs/utils/viewer_tools.py#L30-L36 | |
stepjam/PyRep | d778d5d4ffa3be366d4e699f6e2941553fd47ecc | pyrep/robots/mobiles/nonholonomic_base.py | python | NonHolonomicBase.get_base_velocities | (self) | return [lv, av] | Gets linear and angular velocities of the mobile robot base
calculated from kinematics equations. Left joint should have index 1,
right joint should have index.
:return: A list with linear and angular velocity of the robot base. | Gets linear and angular velocities of the mobile robot base
calculated from kinematics equations. Left joint should have index 1,
right joint should have index. | [
"Gets",
"linear",
"and",
"angular",
"velocities",
"of",
"the",
"mobile",
"robot",
"base",
"calculated",
"from",
"kinematics",
"equations",
".",
"Left",
"joint",
"should",
"have",
"index",
"1",
"right",
"joint",
"should",
"have",
"index",
"."
] | def get_base_velocities(self) -> List[float]:
"""Gets linear and angular velocities of the mobile robot base
calculated from kinematics equations. Left joint should have index 1,
right joint should have index.
:return: A list with linear and angular velocity of the robot base.
"... | [
"def",
"get_base_velocities",
"(",
"self",
")",
"->",
"List",
"[",
"float",
"]",
":",
"wv",
"=",
"self",
".",
"get_joint_velocities",
"(",
")",
"lv",
"=",
"sum",
"(",
"wv",
")",
"*",
"self",
".",
"wheel_radius",
"/",
"2.0",
"v_diff",
"=",
"wv",
"[",
... | https://github.com/stepjam/PyRep/blob/d778d5d4ffa3be366d4e699f6e2941553fd47ecc/pyrep/robots/mobiles/nonholonomic_base.py#L36-L49 | |
X-Plane/XPlane2Blender | 5face69fbb828a414b167dcb063fabf5182a54bc | io_xplane2blender/xplane_types/xplane_material.py | python | XPlaneMaterial.isValid | (self, exportType:str) | return io_xplane2blender.xplane_types.xplane_material_utils.validate(self, exportType) | # Method: isValid
# Checks if material is valid based on an export type.
#
# Parameters:
# exportType <string> - one of "aircraft", "cockpit", "scenery", "instanced_scenery"
#
# Returns:
# Tuple[List[str],Liststr]] A tuple of a list of errors and a list of warni... | # Method: isValid
# Checks if material is valid based on an export type.
#
# Parameters:
# exportType <string> - one of "aircraft", "cockpit", "scenery", "instanced_scenery"
#
# Returns:
# Tuple[List[str],Liststr]] A tuple of a list of errors and a list of warni... | [
"#",
"Method",
":",
"isValid",
"#",
"Checks",
"if",
"material",
"is",
"valid",
"based",
"on",
"an",
"export",
"type",
".",
"#",
"#",
"Parameters",
":",
"#",
"exportType",
"<string",
">",
"-",
"one",
"of",
"aircraft",
"cockpit",
"scenery",
"instanced_scener... | def isValid(self, exportType:str)->Tuple[List[str],List[str]]:
'''
# Method: isValid
# Checks if material is valid based on an export type.
#
# Parameters:
# exportType <string> - one of "aircraft", "cockpit", "scenery", "instanced_scenery"
#
# Returns:
... | [
"def",
"isValid",
"(",
"self",
",",
"exportType",
":",
"str",
")",
"->",
"Tuple",
"[",
"List",
"[",
"str",
"]",
",",
"List",
"[",
"str",
"]",
"]",
":",
"return",
"io_xplane2blender",
".",
"xplane_types",
".",
"xplane_material_utils",
".",
"validate",
"("... | https://github.com/X-Plane/XPlane2Blender/blob/5face69fbb828a414b167dcb063fabf5182a54bc/io_xplane2blender/xplane_types/xplane_material.py#L242-L254 | |
IronLanguages/main | a949455434b1fda8c783289e897e78a9a0caabb5 | External.LCA_RESTRICTED/Languages/CPython/27/Lib/decimal.py | python | Context.__repr__ | (self) | return ', '.join(s) + ')' | Show the current context. | Show the current context. | [
"Show",
"the",
"current",
"context",
"."
] | def __repr__(self):
"""Show the current context."""
s = []
s.append('Context(prec=%(prec)d, rounding=%(rounding)s, '
'Emin=%(Emin)d, Emax=%(Emax)d, capitals=%(capitals)d'
% vars(self))
names = [f.__name__ for f, v in self.flags.items() if v]
s.ap... | [
"def",
"__repr__",
"(",
"self",
")",
":",
"s",
"=",
"[",
"]",
"s",
".",
"append",
"(",
"'Context(prec=%(prec)d, rounding=%(rounding)s, '",
"'Emin=%(Emin)d, Emax=%(Emax)d, capitals=%(capitals)d'",
"%",
"vars",
"(",
"self",
")",
")",
"names",
"=",
"[",
"f",
".",
"... | https://github.com/IronLanguages/main/blob/a949455434b1fda8c783289e897e78a9a0caabb5/External.LCA_RESTRICTED/Languages/CPython/27/Lib/decimal.py#L3792-L3802 | |
pyg-team/pytorch_geometric | b920e9a3a64e22c8356be55301c88444ff051cae | torch_geometric/graphgym/checkpoint.py | python | get_ckpt_dir | () | return osp.join(cfg.run_dir, 'ckpt') | [] | def get_ckpt_dir() -> str:
return osp.join(cfg.run_dir, 'ckpt') | [
"def",
"get_ckpt_dir",
"(",
")",
"->",
"str",
":",
"return",
"osp",
".",
"join",
"(",
"cfg",
".",
"run_dir",
",",
"'ckpt'",
")"
] | https://github.com/pyg-team/pytorch_geometric/blob/b920e9a3a64e22c8356be55301c88444ff051cae/torch_geometric/graphgym/checkpoint.py#L71-L72 | |||
holzschu/Carnets | 44effb10ddfc6aa5c8b0687582a724ba82c6b547 | Library/lib/python3.7/site-packages/Pillow-6.0.0-py3.7-macosx-10.9-x86_64.egg/PIL/Image.py | python | open | (fp, mode="r") | Opens and identifies the given image file.
This is a lazy operation; this function identifies the file, but
the file remains open and the actual image data is not read from
the file until you try to process the data (or call the
:py:meth:`~PIL.Image.Image.load` method). See
:py:func:`~PIL.Image.ne... | Opens and identifies the given image file. | [
"Opens",
"and",
"identifies",
"the",
"given",
"image",
"file",
"."
] | def open(fp, mode="r"):
"""
Opens and identifies the given image file.
This is a lazy operation; this function identifies the file, but
the file remains open and the actual image data is not read from
the file until you try to process the data (or call the
:py:meth:`~PIL.Image.Image.load` metho... | [
"def",
"open",
"(",
"fp",
",",
"mode",
"=",
"\"r\"",
")",
":",
"if",
"mode",
"!=",
"\"r\"",
":",
"raise",
"ValueError",
"(",
"\"bad mode %r\"",
"%",
"mode",
")",
"exclusive_fp",
"=",
"False",
"filename",
"=",
"\"\"",
"if",
"isPath",
"(",
"fp",
")",
"... | https://github.com/holzschu/Carnets/blob/44effb10ddfc6aa5c8b0687582a724ba82c6b547/Library/lib/python3.7/site-packages/Pillow-6.0.0-py3.7-macosx-10.9-x86_64.egg/PIL/Image.py#L2621-L2705 | ||
rembo10/headphones | b3199605be1ebc83a7a8feab6b1e99b64014187c | lib/cherrypy/wsgiserver/wsgiserver2.py | python | SizeCheckWrapper.next | (self) | return data | [] | def next(self):
data = self.rfile.next()
self.bytes_read += len(data)
self._check_length()
return data | [
"def",
"next",
"(",
"self",
")",
":",
"data",
"=",
"self",
".",
"rfile",
".",
"next",
"(",
")",
"self",
".",
"bytes_read",
"+=",
"len",
"(",
"data",
")",
"self",
".",
"_check_length",
"(",
")",
"return",
"data"
] | https://github.com/rembo10/headphones/blob/b3199605be1ebc83a7a8feab6b1e99b64014187c/lib/cherrypy/wsgiserver/wsgiserver2.py#L336-L340 | |||
spotify/luigi | c3b66f4a5fa7eaa52f9a72eb6704b1049035c789 | examples/top_artists.py | python | Streams.run | (self) | Generates bogus data and writes it into the :py:meth:`~.Streams.output` target. | Generates bogus data and writes it into the :py:meth:`~.Streams.output` target. | [
"Generates",
"bogus",
"data",
"and",
"writes",
"it",
"into",
"the",
":",
"py",
":",
"meth",
":",
"~",
".",
"Streams",
".",
"output",
"target",
"."
] | def run(self):
"""
Generates bogus data and writes it into the :py:meth:`~.Streams.output` target.
"""
with self.output().open('w') as output:
for _ in range(1000):
output.write('{} {} {}\n'.format(
random.randint(0, 999),
... | [
"def",
"run",
"(",
"self",
")",
":",
"with",
"self",
".",
"output",
"(",
")",
".",
"open",
"(",
"'w'",
")",
"as",
"output",
":",
"for",
"_",
"in",
"range",
"(",
"1000",
")",
":",
"output",
".",
"write",
"(",
"'{} {} {}\\n'",
".",
"format",
"(",
... | https://github.com/spotify/luigi/blob/c3b66f4a5fa7eaa52f9a72eb6704b1049035c789/examples/top_artists.py#L54-L63 | ||
nosmokingbandit/Watcher3 | 0217e75158b563bdefc8e01c3be7620008cf3977 | lib/sqlalchemy/dialects/mssql/base.py | python | MSExecutionContext.pre_exec | (self) | Activate IDENTITY_INSERT if needed. | Activate IDENTITY_INSERT if needed. | [
"Activate",
"IDENTITY_INSERT",
"if",
"needed",
"."
] | def pre_exec(self):
"""Activate IDENTITY_INSERT if needed."""
if self.isinsert:
tbl = self.compiled.statement.table
seq_column = tbl._autoincrement_column
insert_has_sequence = seq_column is not None
if insert_has_sequence:
self._enable_i... | [
"def",
"pre_exec",
"(",
"self",
")",
":",
"if",
"self",
".",
"isinsert",
":",
"tbl",
"=",
"self",
".",
"compiled",
".",
"statement",
".",
"table",
"seq_column",
"=",
"tbl",
".",
"_autoincrement_column",
"insert_has_sequence",
"=",
"seq_column",
"is",
"not",
... | https://github.com/nosmokingbandit/Watcher3/blob/0217e75158b563bdefc8e01c3be7620008cf3977/lib/sqlalchemy/dialects/mssql/base.py#L995-L1037 | ||
mkusner/grammarVAE | ffffe272a8cf1772578dfc92254c55c224cddc02 | equation_optimization/simulation1/grammar/run_bo.py | python | save_object | (obj, filename) | Function that saves an object to a file using pickle | Function that saves an object to a file using pickle | [
"Function",
"that",
"saves",
"an",
"object",
"to",
"a",
"file",
"using",
"pickle"
] | def save_object(obj, filename):
"""
Function that saves an object to a file using pickle
"""
result = pickle.dumps(obj)
with gzip.GzipFile(filename, 'wb') as dest: dest.write(result)
dest.close() | [
"def",
"save_object",
"(",
"obj",
",",
"filename",
")",
":",
"result",
"=",
"pickle",
".",
"dumps",
"(",
"obj",
")",
"with",
"gzip",
".",
"GzipFile",
"(",
"filename",
",",
"'wb'",
")",
"as",
"dest",
":",
"dest",
".",
"write",
"(",
"result",
")",
"d... | https://github.com/mkusner/grammarVAE/blob/ffffe272a8cf1772578dfc92254c55c224cddc02/equation_optimization/simulation1/grammar/run_bo.py#L58-L66 | ||
djblets/djblets | 0496e1ec49e43d43d776768c9fc5b6f8af56ec2c | djblets/db/fields/json_field.py | python | JSONField.to_python | (self, value) | return value | Return a value suitable for using in Python code.
This will return the deserialized version of the data, allowing
Python code to work with the data directly.
Args:
value (object):
The value to make usable in Python code.
Returns:
object:
... | Return a value suitable for using in Python code. | [
"Return",
"a",
"value",
"suitable",
"for",
"using",
"in",
"Python",
"code",
"."
] | def to_python(self, value):
"""Return a value suitable for using in Python code.
This will return the deserialized version of the data, allowing
Python code to work with the data directly.
Args:
value (object):
The value to make usable in Python code.
... | [
"def",
"to_python",
"(",
"self",
",",
"value",
")",
":",
"if",
"isinstance",
"(",
"value",
",",
"six",
".",
"string_types",
")",
":",
"value",
"=",
"self",
".",
"loads",
"(",
"value",
")",
"return",
"value"
] | https://github.com/djblets/djblets/blob/0496e1ec49e43d43d776768c9fc5b6f8af56ec2c/djblets/db/fields/json_field.py#L315-L332 | |
redhat-imaging/imagefactory | 176f6e045e1df049d50f33a924653128d5ab8b27 | imgfac/rest/bottle.py | python | BaseResponse.set_header | (self, name, value) | Create a new response header, replacing any previously defined
headers with the same name. | Create a new response header, replacing any previously defined
headers with the same name. | [
"Create",
"a",
"new",
"response",
"header",
"replacing",
"any",
"previously",
"defined",
"headers",
"with",
"the",
"same",
"name",
"."
] | def set_header(self, name, value):
''' Create a new response header, replacing any previously defined
headers with the same name. '''
self._headers[_hkey(name)] = [_hval(value)] | [
"def",
"set_header",
"(",
"self",
",",
"name",
",",
"value",
")",
":",
"self",
".",
"_headers",
"[",
"_hkey",
"(",
"name",
")",
"]",
"=",
"[",
"_hval",
"(",
"value",
")",
"]"
] | https://github.com/redhat-imaging/imagefactory/blob/176f6e045e1df049d50f33a924653128d5ab8b27/imgfac/rest/bottle.py#L1544-L1547 | ||
JaniceWuo/MovieRecommend | 4c86db64ca45598917d304f535413df3bc9fea65 | movierecommend/venv1/Lib/site-packages/pip-9.0.1-py3.6.egg/pip/_vendor/requests/packages/urllib3/connection.py | python | _match_hostname | (cert, asserted_hostname) | [] | def _match_hostname(cert, asserted_hostname):
try:
match_hostname(cert, asserted_hostname)
except CertificateError as e:
log.error(
'Certificate did not match expected hostname: %s. '
'Certificate: %s', asserted_hostname, cert
)
# Add cert to exception and... | [
"def",
"_match_hostname",
"(",
"cert",
",",
"asserted_hostname",
")",
":",
"try",
":",
"match_hostname",
"(",
"cert",
",",
"asserted_hostname",
")",
"except",
"CertificateError",
"as",
"e",
":",
"log",
".",
"error",
"(",
"'Certificate did not match expected hostname... | https://github.com/JaniceWuo/MovieRecommend/blob/4c86db64ca45598917d304f535413df3bc9fea65/movierecommend/venv1/Lib/site-packages/pip-9.0.1-py3.6.egg/pip/_vendor/requests/packages/urllib3/connection.py#L311-L322 | ||||
frePPLe/frepple | 57aa612030b4fcd03cb9c613f83a7dac4f0e8d6d | freppledb/common/report.py | python | GridReport._filter_in | (query, reportrow, data, database=DEFAULT_DB_ALIAS) | [] | def _filter_in(query, reportrow, data, database=DEFAULT_DB_ALIAS):
if isinstance(reportrow, GridFieldChoice):
# Comparison also with the translated choices
accepted = []
for f in smart_str(data).split(","):
t = f.strip().lower()
for c in report... | [
"def",
"_filter_in",
"(",
"query",
",",
"reportrow",
",",
"data",
",",
"database",
"=",
"DEFAULT_DB_ALIAS",
")",
":",
"if",
"isinstance",
"(",
"reportrow",
",",
"GridFieldChoice",
")",
":",
"# Comparison also with the translated choices",
"accepted",
"=",
"[",
"]"... | https://github.com/frePPLe/frepple/blob/57aa612030b4fcd03cb9c613f83a7dac4f0e8d6d/freppledb/common/report.py#L2546-L2559 | ||||
oilshell/oil | 94388e7d44a9ad879b12615f6203b38596b5a2d3 | Python-2.7.13/Lib/httplib.py | python | HTTPResponse._safe_read | (self, amt) | return ''.join(s) | Read the number of bytes requested, compensating for partial reads.
Normally, we have a blocking socket, but a read() can be interrupted
by a signal (resulting in a partial read).
Note that we cannot distinguish between EOF and an interrupt when zero
bytes have been read. IncompleteRea... | Read the number of bytes requested, compensating for partial reads. | [
"Read",
"the",
"number",
"of",
"bytes",
"requested",
"compensating",
"for",
"partial",
"reads",
"."
] | def _safe_read(self, amt):
"""Read the number of bytes requested, compensating for partial reads.
Normally, we have a blocking socket, but a read() can be interrupted
by a signal (resulting in a partial read).
Note that we cannot distinguish between EOF and an interrupt when zero
... | [
"def",
"_safe_read",
"(",
"self",
",",
"amt",
")",
":",
"# NOTE(gps): As of svn r74426 socket._fileobject.read(x) will never",
"# return less than x bytes unless EOF is encountered. It now handles",
"# signal interruptions (socket.error EINTR) internally. This code",
"# never caught that exc... | https://github.com/oilshell/oil/blob/94388e7d44a9ad879b12615f6203b38596b5a2d3/Python-2.7.13/Lib/httplib.py#L667-L693 | |
Sceptre/sceptre | b44797ae712e1e57c2421f2d93c35a4e8104c5ee | sceptre/diffing/stack_differ.py | python | repr_str | (dumper: Dumper, data: str) | return dumper.represent_str(data) | A YAML Representer that handles strings, breaking multi-line strings into something a lot
more readable in the yaml output. This is useful for representing long, multiline strings in
templates or in stack parameters.
:param dumper: The Dumper that is being used to serialize this object
:param data: The... | A YAML Representer that handles strings, breaking multi-line strings into something a lot
more readable in the yaml output. This is useful for representing long, multiline strings in
templates or in stack parameters. | [
"A",
"YAML",
"Representer",
"that",
"handles",
"strings",
"breaking",
"multi",
"-",
"line",
"strings",
"into",
"something",
"a",
"lot",
"more",
"readable",
"in",
"the",
"yaml",
"output",
".",
"This",
"is",
"useful",
"for",
"representing",
"long",
"multiline",
... | def repr_str(dumper: Dumper, data: str) -> str:
"""A YAML Representer that handles strings, breaking multi-line strings into something a lot
more readable in the yaml output. This is useful for representing long, multiline strings in
templates or in stack parameters.
:param dumper: The Dumper that is b... | [
"def",
"repr_str",
"(",
"dumper",
":",
"Dumper",
",",
"data",
":",
"str",
")",
"->",
"str",
":",
"if",
"'\\n'",
"in",
"data",
":",
"return",
"dumper",
".",
"represent_scalar",
"(",
"u'tag:yaml.org,2002:str'",
",",
"data",
",",
"style",
"=",
"'|'",
")",
... | https://github.com/Sceptre/sceptre/blob/b44797ae712e1e57c2421f2d93c35a4e8104c5ee/sceptre/diffing/stack_differ.py#L41-L52 | |
getsentry/sentry-python | f92e9707ea73765eb9fdcf6482dc46aed4221a7a | sentry_sdk/scope.py | python | Scope.fingerprint | (self, value) | When set this overrides the default fingerprint. | When set this overrides the default fingerprint. | [
"When",
"set",
"this",
"overrides",
"the",
"default",
"fingerprint",
"."
] | def fingerprint(self, value):
# type: (Optional[List[str]]) -> None
"""When set this overrides the default fingerprint."""
self._fingerprint = value | [
"def",
"fingerprint",
"(",
"self",
",",
"value",
")",
":",
"# type: (Optional[List[str]]) -> None",
"self",
".",
"_fingerprint",
"=",
"value"
] | https://github.com/getsentry/sentry-python/blob/f92e9707ea73765eb9fdcf6482dc46aed4221a7a/sentry_sdk/scope.py#L138-L141 | ||
apple/coremltools | 141a83af482fcbdd5179807c9eaff9a7999c2c49 | coremltools/models/neural_network/builder.py | python | _get_lstm_weight_fields | (lstm_wp) | return [
lstm_wp.inputGateWeightMatrix,
lstm_wp.forgetGateWeightMatrix,
lstm_wp.blockInputWeightMatrix,
lstm_wp.outputGateWeightMatrix,
lstm_wp.inputGateRecursionMatrix,
lstm_wp.forgetGateRecursionMatrix,
lstm_wp.blockInputRecursionMatrix,
lstm_wp.outputGa... | Get LSTM weight fields.
lstm_wp: _NeuralNetwork_pb2.LSTMWeightParams | Get LSTM weight fields.
lstm_wp: _NeuralNetwork_pb2.LSTMWeightParams | [
"Get",
"LSTM",
"weight",
"fields",
".",
"lstm_wp",
":",
"_NeuralNetwork_pb2",
".",
"LSTMWeightParams"
] | def _get_lstm_weight_fields(lstm_wp):
"""
Get LSTM weight fields.
lstm_wp: _NeuralNetwork_pb2.LSTMWeightParams
"""
return [
lstm_wp.inputGateWeightMatrix,
lstm_wp.forgetGateWeightMatrix,
lstm_wp.blockInputWeightMatrix,
lstm_wp.outputGateWeightMatrix,
lstm_wp.i... | [
"def",
"_get_lstm_weight_fields",
"(",
"lstm_wp",
")",
":",
"return",
"[",
"lstm_wp",
".",
"inputGateWeightMatrix",
",",
"lstm_wp",
".",
"forgetGateWeightMatrix",
",",
"lstm_wp",
".",
"blockInputWeightMatrix",
",",
"lstm_wp",
".",
"outputGateWeightMatrix",
",",
"lstm_... | https://github.com/apple/coremltools/blob/141a83af482fcbdd5179807c9eaff9a7999c2c49/coremltools/models/neural_network/builder.py#L146-L167 | |
wxWidgets/Phoenix | b2199e299a6ca6d866aa6f3d0888499136ead9d6 | wx/lib/agw/aui/aui_utilities.py | python | FindFocusDescendant | (ancestor) | return focusWin | Find a window with the focus, that is also a descendant of the given window.
This is used to determine the window to initially send commands to.
:param wx.Window `ancestor`: the window to check for ancestry. | Find a window with the focus, that is also a descendant of the given window.
This is used to determine the window to initially send commands to. | [
"Find",
"a",
"window",
"with",
"the",
"focus",
"that",
"is",
"also",
"a",
"descendant",
"of",
"the",
"given",
"window",
".",
"This",
"is",
"used",
"to",
"determine",
"the",
"window",
"to",
"initially",
"send",
"commands",
"to",
"."
] | def FindFocusDescendant(ancestor):
"""
Find a window with the focus, that is also a descendant of the given window.
This is used to determine the window to initially send commands to.
:param wx.Window `ancestor`: the window to check for ancestry.
"""
# Process events starting with the window w... | [
"def",
"FindFocusDescendant",
"(",
"ancestor",
")",
":",
"# Process events starting with the window with the focus, if any.",
"focusWin",
"=",
"wx",
".",
"Window",
".",
"FindFocus",
"(",
")",
"win",
"=",
"focusWin",
"# Check if this is a descendant of this frame.",
"# If not,... | https://github.com/wxWidgets/Phoenix/blob/b2199e299a6ca6d866aa6f3d0888499136ead9d6/wx/lib/agw/aui/aui_utilities.py#L349-L372 | |
wistbean/learn_python3_spider | 73c873f4845f4385f097e5057407d03dd37a117b | stackoverflow/venv/lib/python3.6/site-packages/pymongo/pool.py | python | Pool.__init__ | (self, address, options, handshake=True) | :Parameters:
- `address`: a (hostname, port) tuple
- `options`: a PoolOptions instance
- `handshake`: whether to call ismaster for each new SocketInfo | :Parameters:
- `address`: a (hostname, port) tuple
- `options`: a PoolOptions instance
- `handshake`: whether to call ismaster for each new SocketInfo | [
":",
"Parameters",
":",
"-",
"address",
":",
"a",
"(",
"hostname",
"port",
")",
"tuple",
"-",
"options",
":",
"a",
"PoolOptions",
"instance",
"-",
"handshake",
":",
"whether",
"to",
"call",
"ismaster",
"for",
"each",
"new",
"SocketInfo"
] | def __init__(self, address, options, handshake=True):
"""
:Parameters:
- `address`: a (hostname, port) tuple
- `options`: a PoolOptions instance
- `handshake`: whether to call ismaster for each new SocketInfo
"""
# Check a socket's health with socket_closed(... | [
"def",
"__init__",
"(",
"self",
",",
"address",
",",
"options",
",",
"handshake",
"=",
"True",
")",
":",
"# Check a socket's health with socket_closed() every once in a while.",
"# Can override for testing: 0 to always check, None to never check.",
"self",
".",
"_check_interval_s... | https://github.com/wistbean/learn_python3_spider/blob/73c873f4845f4385f097e5057407d03dd37a117b/stackoverflow/venv/lib/python3.6/site-packages/pymongo/pool.py#L946-L993 | ||
regel/loudml | 0008baef02259a8ae81dd210d3f91a51ffc9ed9f | loudml/storage.py | python | Storage.get_model_hook | (self, model_name, hook_name) | Get model hook | Get model hook | [
"Get",
"model",
"hook"
] | def get_model_hook(self, model_name, hook_name):
"""Get model hook""" | [
"def",
"get_model_hook",
"(",
"self",
",",
"model_name",
",",
"hook_name",
")",
":"
] | https://github.com/regel/loudml/blob/0008baef02259a8ae81dd210d3f91a51ffc9ed9f/loudml/storage.py#L118-L119 | ||
NeuralEnsemble/python-neo | 34d4db8fb0dc950dbbc6defd7fb75e99ea877286 | neo/rawio/baserawio.py | python | BaseRawIO.source_name | (self) | return self._source_name() | Return fancy name of file source | Return fancy name of file source | [
"Return",
"fancy",
"name",
"of",
"file",
"source"
] | def source_name(self):
"""Return fancy name of file source"""
return self._source_name() | [
"def",
"source_name",
"(",
"self",
")",
":",
"return",
"self",
".",
"_source_name",
"(",
")"
] | https://github.com/NeuralEnsemble/python-neo/blob/34d4db8fb0dc950dbbc6defd7fb75e99ea877286/neo/rawio/baserawio.py#L188-L190 | |
meduza-corp/interstellar | 40a801ccd7856491726f5a126621d9318cabe2e1 | gsutil/third_party/boto/boto/fps/connection.py | python | FPSConnection.get_recipient_verification_status | (self, action, response, **kw) | return self.get_object(action, kw, response) | Returns the recipient status. | Returns the recipient status. | [
"Returns",
"the",
"recipient",
"status",
"."
] | def get_recipient_verification_status(self, action, response, **kw):
"""
Returns the recipient status.
"""
return self.get_object(action, kw, response) | [
"def",
"get_recipient_verification_status",
"(",
"self",
",",
"action",
",",
"response",
",",
"*",
"*",
"kw",
")",
":",
"return",
"self",
".",
"get_object",
"(",
"action",
",",
"kw",
",",
"response",
")"
] | https://github.com/meduza-corp/interstellar/blob/40a801ccd7856491726f5a126621d9318cabe2e1/gsutil/third_party/boto/boto/fps/connection.py#L281-L285 | |
cloudera/hue | 23f02102d4547c17c32bd5ea0eb24e9eadd657a4 | desktop/core/ext-py/boto-2.46.1/boto/gs/key.py | python | Key.set_xml_acl | (self, acl_str, headers=None, generation=None,
if_generation=None, if_metageneration=None) | Sets this objects's ACL to an XML string.
:type acl_str: string
:param acl_str: A string containing the ACL XML.
:type headers: dict
:param headers: Additional headers to set during the request.
:type generation: int
:param generation: If specified, sets the ACL for a ... | Sets this objects's ACL to an XML string. | [
"Sets",
"this",
"objects",
"s",
"ACL",
"to",
"an",
"XML",
"string",
"."
] | def set_xml_acl(self, acl_str, headers=None, generation=None,
if_generation=None, if_metageneration=None):
"""Sets this objects's ACL to an XML string.
:type acl_str: string
:param acl_str: A string containing the ACL XML.
:type headers: dict
:param headers... | [
"def",
"set_xml_acl",
"(",
"self",
",",
"acl_str",
",",
"headers",
"=",
"None",
",",
"generation",
"=",
"None",
",",
"if_generation",
"=",
"None",
",",
"if_metageneration",
"=",
"None",
")",
":",
"if",
"self",
".",
"bucket",
"is",
"not",
"None",
":",
"... | https://github.com/cloudera/hue/blob/23f02102d4547c17c32bd5ea0eb24e9eadd657a4/desktop/core/ext-py/boto-2.46.1/boto/gs/key.py#L842-L870 | ||
Tautulli/Tautulli | 2410eb33805aaac4bd1c5dad0f71e4f15afaf742 | lib/future/backports/misc.py | python | ChainMap.popitem | (self) | Remove and return an item pair from maps[0]. Raise KeyError is maps[0] is empty. | Remove and return an item pair from maps[0]. Raise KeyError is maps[0] is empty. | [
"Remove",
"and",
"return",
"an",
"item",
"pair",
"from",
"maps",
"[",
"0",
"]",
".",
"Raise",
"KeyError",
"is",
"maps",
"[",
"0",
"]",
"is",
"empty",
"."
] | def popitem(self):
'Remove and return an item pair from maps[0]. Raise KeyError is maps[0] is empty.'
try:
return self.maps[0].popitem()
except KeyError:
raise KeyError('No keys found in the first mapping.') | [
"def",
"popitem",
"(",
"self",
")",
":",
"try",
":",
"return",
"self",
".",
"maps",
"[",
"0",
"]",
".",
"popitem",
"(",
")",
"except",
"KeyError",
":",
"raise",
"KeyError",
"(",
"'No keys found in the first mapping.'",
")"
] | https://github.com/Tautulli/Tautulli/blob/2410eb33805aaac4bd1c5dad0f71e4f15afaf742/lib/future/backports/misc.py#L826-L831 | ||
MaybeShewill-CV/lanenet-lane-detection | 94be8d9a66c7bbda5ad99b10492bc406c8aee45f | lanenet_model/lanenet_discriminative_loss.py | python | discriminative_loss_single | (
prediction,
correct_label,
feature_dim,
label_shape,
delta_v,
delta_d,
param_var,
param_dist,
param_reg) | return loss, l_var, l_dist, l_reg | discriminative loss
:param prediction: inference of network
:param correct_label: instance label
:param feature_dim: feature dimension of prediction
:param label_shape: shape of label
:param delta_v: cut off variance distance
:param delta_d: cut off cluster distance
:param param_var: weight ... | discriminative loss
:param prediction: inference of network
:param correct_label: instance label
:param feature_dim: feature dimension of prediction
:param label_shape: shape of label
:param delta_v: cut off variance distance
:param delta_d: cut off cluster distance
:param param_var: weight ... | [
"discriminative",
"loss",
":",
"param",
"prediction",
":",
"inference",
"of",
"network",
":",
"param",
"correct_label",
":",
"instance",
"label",
":",
"param",
"feature_dim",
":",
"feature",
"dimension",
"of",
"prediction",
":",
"param",
"label_shape",
":",
"sha... | def discriminative_loss_single(
prediction,
correct_label,
feature_dim,
label_shape,
delta_v,
delta_d,
param_var,
param_dist,
param_reg):
"""
discriminative loss
:param prediction: inference of network
:param correct_label: instance... | [
"def",
"discriminative_loss_single",
"(",
"prediction",
",",
"correct_label",
",",
"feature_dim",
",",
"label_shape",
",",
"delta_v",
",",
"delta_d",
",",
"param_var",
",",
"param_dist",
",",
"param_reg",
")",
":",
"correct_label",
"=",
"tf",
".",
"reshape",
"("... | https://github.com/MaybeShewill-CV/lanenet-lane-detection/blob/94be8d9a66c7bbda5ad99b10492bc406c8aee45f/lanenet_model/lanenet_discriminative_loss.py#L14-L95 | |
hgrecco/pint | befdffb9d767fb354fc756660a33268c0f8d48e1 | pint/numpy_func.py | python | convert_arg | (arg, pre_calc_units) | return arg | Convert quantities and sequences of quantities to pre_calc_units and strip units.
Helper function for convert_to_consistent_units. pre_calc_units must be given as a
pint Unit or None. | Convert quantities and sequences of quantities to pre_calc_units and strip units. | [
"Convert",
"quantities",
"and",
"sequences",
"of",
"quantities",
"to",
"pre_calc_units",
"and",
"strip",
"units",
"."
] | def convert_arg(arg, pre_calc_units):
"""Convert quantities and sequences of quantities to pre_calc_units and strip units.
Helper function for convert_to_consistent_units. pre_calc_units must be given as a
pint Unit or None.
"""
if pre_calc_units is not None:
if _is_quantity(arg):
... | [
"def",
"convert_arg",
"(",
"arg",
",",
"pre_calc_units",
")",
":",
"if",
"pre_calc_units",
"is",
"not",
"None",
":",
"if",
"_is_quantity",
"(",
"arg",
")",
":",
"return",
"arg",
".",
"m_as",
"(",
"pre_calc_units",
")",
"elif",
"_is_sequence_with_quantity_eleme... | https://github.com/hgrecco/pint/blob/befdffb9d767fb354fc756660a33268c0f8d48e1/pint/numpy_func.py#L72-L94 | |
IBM/lale | b4d6829c143a4735b06083a0e6c70d2cca244162 | lale/lib/autoai_libs/cat_encoder.py | python | _CatEncoderImpl.__init__ | (
self,
encoding,
categories,
dtype,
handle_unknown,
sklearn_version_family=None,
activate_flag=True,
encode_unknown_with="auto",
) | [] | def __init__(
self,
encoding,
categories,
dtype,
handle_unknown,
sklearn_version_family=None,
activate_flag=True,
encode_unknown_with="auto",
):
self._hyperparams = {
"encoding": encoding,
"categories": categories,
... | [
"def",
"__init__",
"(",
"self",
",",
"encoding",
",",
"categories",
",",
"dtype",
",",
"handle_unknown",
",",
"sklearn_version_family",
"=",
"None",
",",
"activate_flag",
"=",
"True",
",",
"encode_unknown_with",
"=",
"\"auto\"",
",",
")",
":",
"self",
".",
"... | https://github.com/IBM/lale/blob/b4d6829c143a4735b06083a0e6c70d2cca244162/lale/lib/autoai_libs/cat_encoder.py#L23-L44 | ||||
bendmorris/static-python | 2e0f8c4d7ed5b359dc7d8a75b6fb37e6b6c5c473 | Lib/heapq.py | python | heapreplace | (heap, item) | return returnitem | Pop and return the current smallest value, and add the new item.
This is more efficient than heappop() followed by heappush(), and can be
more appropriate when using a fixed-size heap. Note that the value
returned may be larger than item! That constrains reasonable uses of
this routine unless written... | Pop and return the current smallest value, and add the new item. | [
"Pop",
"and",
"return",
"the",
"current",
"smallest",
"value",
"and",
"add",
"the",
"new",
"item",
"."
] | def heapreplace(heap, item):
"""Pop and return the current smallest value, and add the new item.
This is more efficient than heappop() followed by heappush(), and can be
more appropriate when using a fixed-size heap. Note that the value
returned may be larger than item! That constrains reasonable use... | [
"def",
"heapreplace",
"(",
"heap",
",",
"item",
")",
":",
"returnitem",
"=",
"heap",
"[",
"0",
"]",
"# raises appropriate IndexError if heap is empty",
"heap",
"[",
"0",
"]",
"=",
"item",
"_siftup",
"(",
"heap",
",",
"0",
")",
"return",
"returnitem"
] | https://github.com/bendmorris/static-python/blob/2e0f8c4d7ed5b359dc7d8a75b6fb37e6b6c5c473/Lib/heapq.py#L148-L162 | |
spesmilo/electrum | bdbd59300fbd35b01605e66145458e5f396108e8 | electrum/plugins/cosigner_pool/qt.py | python | Listener.__init__ | (self, parent) | [] | def __init__(self, parent):
util.DaemonThread.__init__(self)
self.daemon = True
self.parent = parent
self.received = set()
self.keyhashes = [] | [
"def",
"__init__",
"(",
"self",
",",
"parent",
")",
":",
"util",
".",
"DaemonThread",
".",
"__init__",
"(",
"self",
")",
"self",
".",
"daemon",
"=",
"True",
"self",
".",
"parent",
"=",
"parent",
"self",
".",
"received",
"=",
"set",
"(",
")",
"self",
... | https://github.com/spesmilo/electrum/blob/bdbd59300fbd35b01605e66145458e5f396108e8/electrum/plugins/cosigner_pool/qt.py#L59-L64 | ||||
NVIDIA/NeMo | 5b0c0b4dec12d87d3cd960846de4105309ce938e | nemo/collections/tts/modules/melgan_modules.py | python | MelGANMultiScaleDiscriminator.reset_parameters | (self) | Reset parameters.
This initialization follows official implementation manner.
https://github.com/descriptinc/melgan-neurips/blob/master/mel2wav/modules.py | Reset parameters. | [
"Reset",
"parameters",
"."
] | def reset_parameters(self):
"""Reset parameters.
This initialization follows official implementation manner.
https://github.com/descriptinc/melgan-neurips/blob/master/mel2wav/modules.py
"""
def _reset_parameters(module):
if isinstance(module, torch.nn.Conv1d) or is... | [
"def",
"reset_parameters",
"(",
"self",
")",
":",
"def",
"_reset_parameters",
"(",
"module",
")",
":",
"if",
"isinstance",
"(",
"module",
",",
"torch",
".",
"nn",
".",
"Conv1d",
")",
"or",
"isinstance",
"(",
"module",
",",
"torch",
".",
"nn",
".",
"Con... | https://github.com/NVIDIA/NeMo/blob/5b0c0b4dec12d87d3cd960846de4105309ce938e/nemo/collections/tts/modules/melgan_modules.py#L495-L508 | ||
IronLanguages/ironpython3 | 7a7bb2a872eeab0d1009fc8a6e24dca43f65b693 | Src/StdLib/Lib/asyncio/futures.py | python | Future.result | (self) | return self._result | Return the result this future represents.
If the future has been cancelled, raises CancelledError. If the
future's result isn't yet available, raises InvalidStateError. If
the future is done and has an exception set, this exception is raised. | Return the result this future represents. | [
"Return",
"the",
"result",
"this",
"future",
"represents",
"."
] | def result(self):
"""Return the result this future represents.
If the future has been cancelled, raises CancelledError. If the
future's result isn't yet available, raises InvalidStateError. If
the future is done and has an exception set, this exception is raised.
"""
i... | [
"def",
"result",
"(",
"self",
")",
":",
"if",
"self",
".",
"_state",
"==",
"_CANCELLED",
":",
"raise",
"CancelledError",
"if",
"self",
".",
"_state",
"!=",
"_FINISHED",
":",
"raise",
"InvalidStateError",
"(",
"'Result is not ready.'",
")",
"self",
".",
"_log... | https://github.com/IronLanguages/ironpython3/blob/7a7bb2a872eeab0d1009fc8a6e24dca43f65b693/Src/StdLib/Lib/asyncio/futures.py#L258-L275 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.