nwo stringlengths 5 58 | sha stringlengths 40 40 | path stringlengths 5 172 | language stringclasses 1
value | identifier stringlengths 1 100 | parameters stringlengths 2 3.5k | argument_list stringclasses 1
value | return_statement stringlengths 0 21.5k | docstring stringlengths 2 17k | docstring_summary stringlengths 0 6.58k | docstring_tokens list | function stringlengths 35 55.6k | function_tokens list | url stringlengths 89 269 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
redapple0204/my-boring-python | 1ab378e9d4f39ad920ff542ef3b2db68f0575a98 | pythonenv3.8/lib/python3.8/site-packages/pip/_vendor/ipaddress.py | python | _BaseNetwork.num_addresses | (self) | return int(self.broadcast_address) - int(self.network_address) + 1 | Number of hosts in the current subnet. | Number of hosts in the current subnet. | [
"Number",
"of",
"hosts",
"in",
"the",
"current",
"subnet",
"."
] | def num_addresses(self):
"""Number of hosts in the current subnet."""
return int(self.broadcast_address) - int(self.network_address) + 1 | [
"def",
"num_addresses",
"(",
"self",
")",
":",
"return",
"int",
"(",
"self",
".",
"broadcast_address",
")",
"-",
"int",
"(",
"self",
".",
"network_address",
")",
"+",
"1"
] | https://github.com/redapple0204/my-boring-python/blob/1ab378e9d4f39ad920ff542ef3b2db68f0575a98/pythonenv3.8/lib/python3.8/site-packages/pip/_vendor/ipaddress.py#L847-L849 | |
facebookarchive/nuclide | 2a2a0a642d136768b7d2a6d35a652dc5fb77d70a | modules/atom-ide-debugger-python/VendorLib/vs-py-debugger/pythonFiles/experimental/ptvsd/ptvsd/_vendored/pydevd/pydevd_attach_to_process/winappdbg/thread.py | python | Thread.get_stack_trace_with_labels | (self, depth = 16, bMakePretty = True) | return trace | Tries to get a stack trace for the current function.
Only works for functions with standard prologue and epilogue.
@type depth: int
@param depth: Maximum depth of stack trace.
@type bMakePretty: bool
@param bMakePretty:
C{True} for user readable labels,
... | Tries to get a stack trace for the current function.
Only works for functions with standard prologue and epilogue. | [
"Tries",
"to",
"get",
"a",
"stack",
"trace",
"for",
"the",
"current",
"function",
".",
"Only",
"works",
"for",
"functions",
"with",
"standard",
"prologue",
"and",
"epilogue",
"."
] | def get_stack_trace_with_labels(self, depth = 16, bMakePretty = True):
"""
Tries to get a stack trace for the current function.
Only works for functions with standard prologue and epilogue.
@type depth: int
@param depth: Maximum depth of stack trace.
@type bMakePretty... | [
"def",
"get_stack_trace_with_labels",
"(",
"self",
",",
"depth",
"=",
"16",
",",
"bMakePretty",
"=",
"True",
")",
":",
"try",
":",
"trace",
"=",
"self",
".",
"__get_stack_trace",
"(",
"depth",
",",
"True",
",",
"bMakePretty",
")",
"except",
"Exception",
":... | https://github.com/facebookarchive/nuclide/blob/2a2a0a642d136768b7d2a6d35a652dc5fb77d70a/modules/atom-ide-debugger-python/VendorLib/vs-py-debugger/pythonFiles/experimental/ptvsd/ptvsd/_vendored/pydevd/pydevd_attach_to_process/winappdbg/thread.py#L1258-L1286 | |
Opentrons/opentrons | 466e0567065d8773a81c25cd1b5c7998e00adf2c | api/src/opentrons/hardware_control/api.py | python | API.resume | (self, pause_type: PauseType) | Resume motion after a call to :py:meth:`pause`. | Resume motion after a call to :py:meth:`pause`. | [
"Resume",
"motion",
"after",
"a",
"call",
"to",
":",
"py",
":",
"meth",
":",
"pause",
"."
] | def resume(self, pause_type: PauseType):
"""
Resume motion after a call to :py:meth:`pause`.
"""
self._pause_manager.resume(pause_type)
if self._pause_manager.should_pause:
return
# Resume must be called immediately to awaken thread running hardware
... | [
"def",
"resume",
"(",
"self",
",",
"pause_type",
":",
"PauseType",
")",
":",
"self",
".",
"_pause_manager",
".",
"resume",
"(",
"pause_type",
")",
"if",
"self",
".",
"_pause_manager",
".",
"should_pause",
":",
"return",
"# Resume must be called immediately to awak... | https://github.com/Opentrons/opentrons/blob/466e0567065d8773a81c25cd1b5c7998e00adf2c/api/src/opentrons/hardware_control/api.py#L639-L657 | ||
webrtc/apprtc | db975e22ea07a0c11a4179d4beb2feb31cf344f4 | src/third_party/oauth2client/client.py | python | OAuth2WebServerFlow.step2_exchange | (self, code, http=None) | Exhanges a code for OAuth2Credentials.
Args:
code: string or dict, either the code as a string, or a dictionary
of the query parameters to the redirect_uri, which contains
the code.
http: httplib2.Http, optional http instance to use to do the fetch
Returns:
An OAuth2Credentia... | Exhanges a code for OAuth2Credentials. | [
"Exhanges",
"a",
"code",
"for",
"OAuth2Credentials",
"."
] | def step2_exchange(self, code, http=None):
"""Exhanges a code for OAuth2Credentials.
Args:
code: string or dict, either the code as a string, or a dictionary
of the query parameters to the redirect_uri, which contains
the code.
http: httplib2.Http, optional http instance to use to d... | [
"def",
"step2_exchange",
"(",
"self",
",",
"code",
",",
"http",
"=",
"None",
")",
":",
"if",
"not",
"(",
"isinstance",
"(",
"code",
",",
"str",
")",
"or",
"isinstance",
"(",
"code",
",",
"unicode",
")",
")",
":",
"if",
"'code'",
"not",
"in",
"code"... | https://github.com/webrtc/apprtc/blob/db975e22ea07a0c11a4179d4beb2feb31cf344f4/src/third_party/oauth2client/client.py#L1237-L1310 | ||
axa-group/Parsr | 3a2193b15c56a8fbcafe5efbddd83adbb0f8fd9d | clients/python-client/parsr_client/parsr_client.py | python | ParsrClient.set_server | (self, server: str) | Setter for the Parsr server's address | Setter for the Parsr server's address | [
"Setter",
"for",
"the",
"Parsr",
"server",
"s",
"address"
] | def set_server(self, server: str):
"""Setter for the Parsr server's address
"""
self.server = server | [
"def",
"set_server",
"(",
"self",
",",
"server",
":",
"str",
")",
":",
"self",
".",
"server",
"=",
"server"
] | https://github.com/axa-group/Parsr/blob/3a2193b15c56a8fbcafe5efbddd83adbb0f8fd9d/clients/python-client/parsr_client/parsr_client.py#L58-L61 | ||
prometheus-ar/vot.ar | 72d8fa1ea08fe417b64340b98dff68df8364afdf | msa/core/armve/protocol.py | python | Printer.do_print | (self) | Envia el comando CMD_PRINTER_PRINT al ARM. | Envia el comando CMD_PRINTER_PRINT al ARM. | [
"Envia",
"el",
"comando",
"CMD_PRINTER_PRINT",
"al",
"ARM",
"."
] | def do_print(self):
"""Envia el comando CMD_PRINTER_PRINT al ARM."""
self._send_command(CMD_PRINTER_PRINT) | [
"def",
"do_print",
"(",
"self",
")",
":",
"self",
".",
"_send_command",
"(",
"CMD_PRINTER_PRINT",
")"
] | https://github.com/prometheus-ar/vot.ar/blob/72d8fa1ea08fe417b64340b98dff68df8364afdf/msa/core/armve/protocol.py#L1458-L1460 | ||
sagemath/cloud | 054854b87817edfa95e9044c793059bddc361e67 | sage_salvus.py | python | exercise | (code) | r"""
Use the %exercise cell decorator to create interactive exercise
sets. Put %exercise at the top of the cell, then write Sage code
in the cell that defines the following (all are optional):
- a ``question`` variable, as an HTML string with math in dollar
signs
- an ``answer`` variable, w... | r"""
Use the %exercise cell decorator to create interactive exercise
sets. Put %exercise at the top of the cell, then write Sage code
in the cell that defines the following (all are optional): | [
"r",
"Use",
"the",
"%exercise",
"cell",
"decorator",
"to",
"create",
"interactive",
"exercise",
"sets",
".",
"Put",
"%exercise",
"at",
"the",
"top",
"of",
"the",
"cell",
"then",
"write",
"Sage",
"code",
"in",
"the",
"cell",
"that",
"defines",
"the",
"follo... | def exercise(code):
r"""
Use the %exercise cell decorator to create interactive exercise
sets. Put %exercise at the top of the cell, then write Sage code
in the cell that defines the following (all are optional):
- a ``question`` variable, as an HTML string with math in dollar
signs
- a... | [
"def",
"exercise",
"(",
"code",
")",
":",
"f",
"=",
"closure",
"(",
"code",
")",
"def",
"g",
"(",
")",
":",
"x",
"=",
"f",
"(",
")",
"return",
"x",
".",
"get",
"(",
"'title'",
",",
"''",
")",
",",
"x",
".",
"get",
"(",
"'question'",
",",
"'... | https://github.com/sagemath/cloud/blob/054854b87817edfa95e9044c793059bddc361e67/sage_salvus.py#L2498-L2617 | ||
kemayo/maphilight | e00d927f648c00b634470bc6c4750378b4953cc0 | tools/parse_path.py | python | Sequence | (token) | return OneOrMore(token + maybeComma) | A sequence of the token | A sequence of the token | [
"A",
"sequence",
"of",
"the",
"token"
] | def Sequence(token):
""" A sequence of the token"""
return OneOrMore(token + maybeComma) | [
"def",
"Sequence",
"(",
"token",
")",
":",
"return",
"OneOrMore",
"(",
"token",
"+",
"maybeComma",
")"
] | https://github.com/kemayo/maphilight/blob/e00d927f648c00b634470bc6c4750378b4953cc0/tools/parse_path.py#L25-L27 | |
openwisp/openwisp-controller | 0bfda7a28c86092f165b177c551c07babcb40630 | openwisp_controller/subnet_division/rule_types/base.py | python | BaseSubnetDivisionRuleType.should_create_subnets_ips | (cls, instance, **kwargs) | return a boolean value whether subnets and IPs should
be provisioned for "instance" object | return a boolean value whether subnets and IPs should
be provisioned for "instance" object | [
"return",
"a",
"boolean",
"value",
"whether",
"subnets",
"and",
"IPs",
"should",
"be",
"provisioned",
"for",
"instance",
"object"
] | def should_create_subnets_ips(cls, instance, **kwargs):
"""
return a boolean value whether subnets and IPs should
be provisioned for "instance" object
"""
raise NotImplementedError() | [
"def",
"should_create_subnets_ips",
"(",
"cls",
",",
"instance",
",",
"*",
"*",
"kwargs",
")",
":",
"raise",
"NotImplementedError",
"(",
")"
] | https://github.com/openwisp/openwisp-controller/blob/0bfda7a28c86092f165b177c551c07babcb40630/openwisp_controller/subnet_division/rule_types/base.py#L99-L104 | ||
sbrshk/whatever | f7ba72effd6f836ca701ed889c747db804d5ea8f | node_modules/node-gyp/gyp/pylib/gyp/generator/android.py | python | AndroidMkWriter.ComputeAndroidModule | (self, spec) | return ''.join([prefix, middle, suffix]) | Return the Android module name used for a gyp spec.
We use the complete qualified target name to avoid collisions between
duplicate targets in different directories. We also add a suffix to
distinguish gyp-generated module names. | Return the Android module name used for a gyp spec. | [
"Return",
"the",
"Android",
"module",
"name",
"used",
"for",
"a",
"gyp",
"spec",
"."
] | def ComputeAndroidModule(self, spec):
"""Return the Android module name used for a gyp spec.
We use the complete qualified target name to avoid collisions between
duplicate targets in different directories. We also add a suffix to
distinguish gyp-generated module names.
"""
if int(spec.get('an... | [
"def",
"ComputeAndroidModule",
"(",
"self",
",",
"spec",
")",
":",
"if",
"int",
"(",
"spec",
".",
"get",
"(",
"'android_unmangled_name'",
",",
"0",
")",
")",
":",
"assert",
"self",
".",
"type",
"!=",
"'shared_library'",
"or",
"self",
".",
"target",
".",
... | https://github.com/sbrshk/whatever/blob/f7ba72effd6f836ca701ed889c747db804d5ea8f/node_modules/node-gyp/gyp/pylib/gyp/generator/android.py#L585-L614 | |
Nexedi/erp5 | 44df1959c0e21576cf5e9803d602d95efb4b695b | bt5/erp5_big_file/DocumentTemplateItem/portal_components/document.erp5.BigFile.py | python | BigFile._appendData | (self, data_chunk, content_type=None) | append data chunk to the end of the file
NOTE if content_type is specified, it will change content_type for the
whole file. | append data chunk to the end of the file | [
"append",
"data",
"chunk",
"to",
"the",
"end",
"of",
"the",
"file"
] | def _appendData(self, data_chunk, content_type=None):
"""append data chunk to the end of the file
NOTE if content_type is specified, it will change content_type for the
whole file.
"""
data, size = self._read_data(data_chunk, data=self._baseGetData())
content_type=self._get_content_t... | [
"def",
"_appendData",
"(",
"self",
",",
"data_chunk",
",",
"content_type",
"=",
"None",
")",
":",
"data",
",",
"size",
"=",
"self",
".",
"_read_data",
"(",
"data_chunk",
",",
"data",
"=",
"self",
".",
"_baseGetData",
"(",
")",
")",
"content_type",
"=",
... | https://github.com/Nexedi/erp5/blob/44df1959c0e21576cf5e9803d602d95efb4b695b/bt5/erp5_big_file/DocumentTemplateItem/portal_components/document.erp5.BigFile.py#L398-L407 | ||
GoogleCloudPlatform/PerfKitExplorer | 9efa61015d50c25f6d753f0212ad3bf16876d496 | server/perfkit/explorer/samples_mart/explorer_method.py | python | ExplorerQueryBase.__init__ | (self, data_client=None, dataset_name=None) | Create credentials and storage service.
If a data_client is not provided, a credential_file will be used to get
a data connection.
Args:
data_client: A class that provides data connectivity. Typically a
BigQueryClient instance or specialization.
dataset_name: The name of the BigQuer... | Create credentials and storage service. | [
"Create",
"credentials",
"and",
"storage",
"service",
"."
] | def __init__(self, data_client=None, dataset_name=None):
"""Create credentials and storage service.
If a data_client is not provided, a credential_file will be used to get
a data connection.
Args:
data_client: A class that provides data connectivity. Typically a
BigQueryClient instanc... | [
"def",
"__init__",
"(",
"self",
",",
"data_client",
"=",
"None",
",",
"dataset_name",
"=",
"None",
")",
":",
"self",
".",
"_data_client",
"=",
"data_client",
"self",
".",
"dataset_name",
"=",
"dataset_name",
"or",
"big_query_client",
".",
"DATASET_ID",
"self",... | https://github.com/GoogleCloudPlatform/PerfKitExplorer/blob/9efa61015d50c25f6d753f0212ad3bf16876d496/server/perfkit/explorer/samples_mart/explorer_method.py#L49-L63 | ||
replit-archive/jsrepl | 36d79b6288ca5d26208e8bade2a168c6ebcb2376 | extern/python/closured/lib/python2.7/difflib.py | python | unified_diff | (a, b, fromfile='', tofile='', fromfiledate='',
tofiledate='', n=3, lineterm='\n') | r"""
Compare two sequences of lines; generate the delta as a unified diff.
Unified diffs are a compact way of showing line changes and a few
lines of context. The number of context lines is set by 'n' which
defaults to three.
By default, the diff control lines (those with ---, +++, or @@) are
... | r"""
Compare two sequences of lines; generate the delta as a unified diff. | [
"r",
"Compare",
"two",
"sequences",
"of",
"lines",
";",
"generate",
"the",
"delta",
"as",
"a",
"unified",
"diff",
"."
] | def unified_diff(a, b, fromfile='', tofile='', fromfiledate='',
tofiledate='', n=3, lineterm='\n'):
r"""
Compare two sequences of lines; generate the delta as a unified diff.
Unified diffs are a compact way of showing line changes and a few
lines of context. The number of context line... | [
"def",
"unified_diff",
"(",
"a",
",",
"b",
",",
"fromfile",
"=",
"''",
",",
"tofile",
"=",
"''",
",",
"fromfiledate",
"=",
"''",
",",
"tofiledate",
"=",
"''",
",",
"n",
"=",
"3",
",",
"lineterm",
"=",
"'\\n'",
")",
":",
"started",
"=",
"False",
"... | https://github.com/replit-archive/jsrepl/blob/36d79b6288ca5d26208e8bade2a168c6ebcb2376/extern/python/closured/lib/python2.7/difflib.py#L1158-L1223 | ||
oldj/SwitchHosts | d0eb2321fe36780ec32c914cbc69a818fc1918d3 | alfred/workflow/web.py | python | request | (method, url, params=None, data=None, headers=None, cookies=None,
files=None, auth=None, timeout=60, allow_redirects=False,
stream=False) | return Response(req, stream) | Initiate an HTTP(S) request. Returns :class:`Response` object.
:param method: 'GET' or 'POST'
:type method: unicode
:param url: URL to open
:type url: unicode
:param params: mapping of URL parameters
:type params: dict
:param data: mapping of form data ``{'field_name': 'value'}`` or
... | Initiate an HTTP(S) request. Returns :class:`Response` object. | [
"Initiate",
"an",
"HTTP",
"(",
"S",
")",
"request",
".",
"Returns",
":",
"class",
":",
"Response",
"object",
"."
] | def request(method, url, params=None, data=None, headers=None, cookies=None,
files=None, auth=None, timeout=60, allow_redirects=False,
stream=False):
"""Initiate an HTTP(S) request. Returns :class:`Response` object.
:param method: 'GET' or 'POST'
:type method: unicode
:param url... | [
"def",
"request",
"(",
"method",
",",
"url",
",",
"params",
"=",
"None",
",",
"data",
"=",
"None",
",",
"headers",
"=",
"None",
",",
"cookies",
"=",
"None",
",",
"files",
"=",
"None",
",",
"auth",
"=",
"None",
",",
"timeout",
"=",
"60",
",",
"all... | https://github.com/oldj/SwitchHosts/blob/d0eb2321fe36780ec32c914cbc69a818fc1918d3/alfred/workflow/web.py#L482-L591 | |
redapple0204/my-boring-python | 1ab378e9d4f39ad920ff542ef3b2db68f0575a98 | pythonenv3.8/lib/python3.8/site-packages/pip/_internal/utils/temp_dir.py | python | TempDirectory.create | (self) | Create a temporary directory and store its path in self.path | Create a temporary directory and store its path in self.path | [
"Create",
"a",
"temporary",
"directory",
"and",
"store",
"its",
"path",
"in",
"self",
".",
"path"
] | def create(self):
"""Create a temporary directory and store its path in self.path
"""
if self.path is not None:
logger.debug(
"Skipped creation of temporary directory: {}".format(self.path)
)
return
# We realpath here because some syste... | [
"def",
"create",
"(",
"self",
")",
":",
"if",
"self",
".",
"path",
"is",
"not",
"None",
":",
"logger",
".",
"debug",
"(",
"\"Skipped creation of temporary directory: {}\"",
".",
"format",
"(",
"self",
".",
"path",
")",
")",
"return",
"# We realpath here becaus... | https://github.com/redapple0204/my-boring-python/blob/1ab378e9d4f39ad920ff542ef3b2db68f0575a98/pythonenv3.8/lib/python3.8/site-packages/pip/_internal/utils/temp_dir.py#L62-L77 | ||
mdipierro/web2py-appliances | f97658293d51519e5f06e1ed503ee85f8154fcf3 | FacebookConnectExample/modules/plugin_fbconnect/facebook.py | python | PhotosProxy.upload | (self, image, aid=None, caption=None, size=(604, 1024)) | return self._client._parse_response(response, 'facebook.photos.upload') | Facebook API call. See http://developers.facebook.com/documentation.php?v=1.0&method=photos.upload
size -- an optional size (width, height) to resize the image to before uploading. Resizes by default
to Facebook's maximum display width of 604. | Facebook API call. See http://developers.facebook.com/documentation.php?v=1.0&method=photos.upload | [
"Facebook",
"API",
"call",
".",
"See",
"http",
":",
"//",
"developers",
".",
"facebook",
".",
"com",
"/",
"documentation",
".",
"php?v",
"=",
"1",
".",
"0&method",
"=",
"photos",
".",
"upload"
] | def upload(self, image, aid=None, caption=None, size=(604, 1024)):
"""Facebook API call. See http://developers.facebook.com/documentation.php?v=1.0&method=photos.upload
size -- an optional size (width, height) to resize the image to before uploading. Resizes by default
to Facebook's max... | [
"def",
"upload",
"(",
"self",
",",
"image",
",",
"aid",
"=",
"None",
",",
"caption",
"=",
"None",
",",
"size",
"=",
"(",
"604",
",",
"1024",
")",
")",
":",
"args",
"=",
"{",
"}",
"if",
"aid",
"is",
"not",
"None",
":",
"args",
"[",
"'aid'",
"]... | https://github.com/mdipierro/web2py-appliances/blob/f97658293d51519e5f06e1ed503ee85f8154fcf3/FacebookConnectExample/modules/plugin_fbconnect/facebook.py#L471-L520 | |
aosabook/500lines | fba689d101eb5600f5c8f4d7fd79912498e950e2 | contingent/code/contingent/graphlib.py | python | Graph.immediate_consequences_of | (self, task) | return self.sorted(self._consequences_of[task]) | Return the tasks that use `task` as an input. | Return the tasks that use `task` as an input. | [
"Return",
"the",
"tasks",
"that",
"use",
"task",
"as",
"an",
"input",
"."
] | def immediate_consequences_of(self, task):
"""Return the tasks that use `task` as an input."""
return self.sorted(self._consequences_of[task]) | [
"def",
"immediate_consequences_of",
"(",
"self",
",",
"task",
")",
":",
"return",
"self",
".",
"sorted",
"(",
"self",
".",
"_consequences_of",
"[",
"task",
"]",
")"
] | https://github.com/aosabook/500lines/blob/fba689d101eb5600f5c8f4d7fd79912498e950e2/contingent/code/contingent/graphlib.py#L70-L72 | |
SteeltoeOSS/Samples | a27be0f2fd2af0e263f32aceb131df21fb54c82b | steps/browser_steps.py | python | step_impl | (context, data, url) | :type context: behave.runner.Context
:type data: str
:type url: str | :type context: behave.runner.Context
:type data: str
:type url: str | [
":",
"type",
"context",
":",
"behave",
".",
"runner",
".",
"Context",
":",
"type",
"data",
":",
"str",
":",
"type",
"url",
":",
"str"
] | def step_impl(context, data, url):
"""
:type context: behave.runner.Context
:type data: str
:type url: str
"""
url = dns.resolve_url(context, url)
fields = data.split('=')
assert len(fields) == 2, 'Invalid data format: {}'.format(data)
payload = {fields[0]: fields[1]}
context.log... | [
"def",
"step_impl",
"(",
"context",
",",
"data",
",",
"url",
")",
":",
"url",
"=",
"dns",
".",
"resolve_url",
"(",
"context",
",",
"url",
")",
"fields",
"=",
"data",
".",
"split",
"(",
"'='",
")",
"assert",
"len",
"(",
"fields",
")",
"==",
"2",
"... | https://github.com/SteeltoeOSS/Samples/blob/a27be0f2fd2af0e263f32aceb131df21fb54c82b/steps/browser_steps.py#L34-L47 | ||
replit-archive/jsrepl | 36d79b6288ca5d26208e8bade2a168c6ebcb2376 | extern/python/closured/lib/python2.7/xml/dom/expatbuilder.py | python | Namespaces.install | (self, parser) | Insert the namespace-handlers onto the parser. | Insert the namespace-handlers onto the parser. | [
"Insert",
"the",
"namespace",
"-",
"handlers",
"onto",
"the",
"parser",
"."
] | def install(self, parser):
"""Insert the namespace-handlers onto the parser."""
ExpatBuilder.install(self, parser)
if self._options.namespace_declarations:
parser.StartNamespaceDeclHandler = (
self.start_namespace_decl_handler) | [
"def",
"install",
"(",
"self",
",",
"parser",
")",
":",
"ExpatBuilder",
".",
"install",
"(",
"self",
",",
"parser",
")",
"if",
"self",
".",
"_options",
".",
"namespace_declarations",
":",
"parser",
".",
"StartNamespaceDeclHandler",
"=",
"(",
"self",
".",
"... | https://github.com/replit-archive/jsrepl/blob/36d79b6288ca5d26208e8bade2a168c6ebcb2376/extern/python/closured/lib/python2.7/xml/dom/expatbuilder.py#L732-L737 | ||
opencoweb/coweb | 7b3a87ee9eda735a859447d404ee16edde1c5671 | servers/python/coweb/service/manager/object.py | python | ObjectServiceManager.get_manager_id | (self) | return 'object' | Manager id is object matching wrapper module name. | Manager id is object matching wrapper module name. | [
"Manager",
"id",
"is",
"object",
"matching",
"wrapper",
"module",
"name",
"."
] | def get_manager_id(self):
'''Manager id is object matching wrapper module name.'''
return 'object' | [
"def",
"get_manager_id",
"(",
"self",
")",
":",
"return",
"'object'"
] | https://github.com/opencoweb/coweb/blob/7b3a87ee9eda735a859447d404ee16edde1c5671/servers/python/coweb/service/manager/object.py#L10-L12 | |
ctripcorp/tars | d7954fccaf1a17901f22d844d84c5663a3d79c11 | tars/api/views/deployment.py | python | DeploymentViewSet.reset | (self, request, pk=None, format=None) | return self.retrieve(request) | temp for develop | temp for develop | [
"temp",
"for",
"develop"
] | def reset(self, request, pk=None, format=None):
"""
temp for develop
"""
deployment = self.get_object()
deployment.reset()
return self.retrieve(request) | [
"def",
"reset",
"(",
"self",
",",
"request",
",",
"pk",
"=",
"None",
",",
"format",
"=",
"None",
")",
":",
"deployment",
"=",
"self",
".",
"get_object",
"(",
")",
"deployment",
".",
"reset",
"(",
")",
"return",
"self",
".",
"retrieve",
"(",
"request"... | https://github.com/ctripcorp/tars/blob/d7954fccaf1a17901f22d844d84c5663a3d79c11/tars/api/views/deployment.py#L363-L369 | |
xtk/X | 04c1aa856664a8517d23aefd94c470d47130aead | lib/pypng-0.0.9/code/png.py | python | Reader.validate_signature | (self) | If signature (header) has not been read then read and
validate it; otherwise do nothing. | If signature (header) has not been read then read and
validate it; otherwise do nothing. | [
"If",
"signature",
"(",
"header",
")",
"has",
"not",
"been",
"read",
"then",
"read",
"and",
"validate",
"it",
";",
"otherwise",
"do",
"nothing",
"."
] | def validate_signature(self):
"""If signature (header) has not been read then read and
validate it; otherwise do nothing.
"""
if self.signature:
return
self.signature = self.file.read(8)
if self.signature != _signature:
raise FormatError("PNG file... | [
"def",
"validate_signature",
"(",
"self",
")",
":",
"if",
"self",
".",
"signature",
":",
"return",
"self",
".",
"signature",
"=",
"self",
".",
"file",
".",
"read",
"(",
"8",
")",
"if",
"self",
".",
"signature",
"!=",
"_signature",
":",
"raise",
"Format... | https://github.com/xtk/X/blob/04c1aa856664a8517d23aefd94c470d47130aead/lib/pypng-0.0.9/code/png.py#L1428-L1437 | ||
mceSystems/node-jsc | 90634f3064fab8e89a85b3942f0cc5054acc86fa | deps/v8/gypfiles/vs_toolchain.py | python | Update | (force=False) | return 0 | Requests an update of the toolchain to the specific hashes we have at
this revision. The update outputs a .json of the various configuration
information required to pass to gyp which we use in |GetToolchainDir()|. | Requests an update of the toolchain to the specific hashes we have at
this revision. The update outputs a .json of the various configuration
information required to pass to gyp which we use in |GetToolchainDir()|. | [
"Requests",
"an",
"update",
"of",
"the",
"toolchain",
"to",
"the",
"specific",
"hashes",
"we",
"have",
"at",
"this",
"revision",
".",
"The",
"update",
"outputs",
"a",
".",
"json",
"of",
"the",
"various",
"configuration",
"information",
"required",
"to",
"pas... | def Update(force=False):
"""Requests an update of the toolchain to the specific hashes we have at
this revision. The update outputs a .json of the various configuration
information required to pass to gyp which we use in |GetToolchainDir()|.
"""
if force != False and force != '--force':
print >>sys.stderr... | [
"def",
"Update",
"(",
"force",
"=",
"False",
")",
":",
"if",
"force",
"!=",
"False",
"and",
"force",
"!=",
"'--force'",
":",
"print",
">>",
"sys",
".",
"stderr",
",",
"'Unknown parameter \"%s\"'",
"%",
"force",
"return",
"1",
"if",
"force",
"==",
"'--for... | https://github.com/mceSystems/node-jsc/blob/90634f3064fab8e89a85b3942f0cc5054acc86fa/deps/v8/gypfiles/vs_toolchain.py#L294-L325 | |
nodejs/http2 | 734ad72e3939e62bcff0f686b8ec426b8aaa22e3 | deps/npm/node_modules/node-gyp/gyp/pylib/gyp/ordered_dict.py | python | OrderedDict.values | (self) | return [self[key] for key in self] | od.values() -> list of values in od | od.values() -> list of values in od | [
"od",
".",
"values",
"()",
"-",
">",
"list",
"of",
"values",
"in",
"od"
] | def values(self):
'od.values() -> list of values in od'
return [self[key] for key in self] | [
"def",
"values",
"(",
"self",
")",
":",
"return",
"[",
"self",
"[",
"key",
"]",
"for",
"key",
"in",
"self",
"]"
] | https://github.com/nodejs/http2/blob/734ad72e3939e62bcff0f686b8ec426b8aaa22e3/deps/npm/node_modules/node-gyp/gyp/pylib/gyp/ordered_dict.py#L147-L149 | |
agoravoting/agora-ciudadana | a7701035ea77d7a91baa9b5c2d0c05d91d1b4262 | agora_site/agora_core/resources/agora.py | python | AgoraResource.join_action | (self, request, agora, **kwargs) | return self.create_response(request, dict(status="success")) | Action that an user can execute to join an agora if it has permissions | Action that an user can execute to join an agora if it has permissions | [
"Action",
"that",
"an",
"user",
"can",
"execute",
"to",
"join",
"an",
"agora",
"if",
"it",
"has",
"permissions"
] | def join_action(self, request, agora, **kwargs):
'''
Action that an user can execute to join an agora if it has permissions
'''
request.user.get_profile().add_to_agora(agora_id=agora.id, request=request)
return self.create_response(request, dict(status="success")) | [
"def",
"join_action",
"(",
"self",
",",
"request",
",",
"agora",
",",
"*",
"*",
"kwargs",
")",
":",
"request",
".",
"user",
".",
"get_profile",
"(",
")",
".",
"add_to_agora",
"(",
"agora_id",
"=",
"agora",
".",
"id",
",",
"request",
"=",
"request",
"... | https://github.com/agoravoting/agora-ciudadana/blob/a7701035ea77d7a91baa9b5c2d0c05d91d1b4262/agora_site/agora_core/resources/agora.py#L622-L628 | |
odoo/odoo | 8de8c196a137f4ebbf67d7c7c83fee36f873f5c8 | odoo/tools/translate.py | python | trans_load_data | (cr, fileobj, fileformat, lang,
verbose=True, create_empty_translation=False, overwrite=False) | Populates the ir_translation table.
:param fileobj: buffer open to a translation file
:param fileformat: format of the `fielobj` file, one of 'po' or 'csv'
:param lang: language code of the translations contained in `fileobj`
language must be present and activated in the database
:para... | Populates the ir_translation table. | [
"Populates",
"the",
"ir_translation",
"table",
"."
] | def trans_load_data(cr, fileobj, fileformat, lang,
verbose=True, create_empty_translation=False, overwrite=False):
"""Populates the ir_translation table.
:param fileobj: buffer open to a translation file
:param fileformat: format of the `fielobj` file, one of 'po' or 'csv'
:param la... | [
"def",
"trans_load_data",
"(",
"cr",
",",
"fileobj",
",",
"fileformat",
",",
"lang",
",",
"verbose",
"=",
"True",
",",
"create_empty_translation",
"=",
"False",
",",
"overwrite",
"=",
"False",
")",
":",
"if",
"verbose",
":",
"_logger",
".",
"info",
"(",
... | https://github.com/odoo/odoo/blob/8de8c196a137f4ebbf67d7c7c83fee36f873f5c8/odoo/tools/translate.py#L1169-L1230 | ||
nodejs/node-chakracore | 770c8dcd1bc3e0fce2d4497b4eec3fe49d829d43 | deps/chakrashim/third_party/jinja2/jinja2/utils.py | python | LRUCache.__setitem__ | (self, key, value) | Sets the value for an item. Moves the item up so that it
has the highest priority then. | Sets the value for an item. Moves the item up so that it
has the highest priority then. | [
"Sets",
"the",
"value",
"for",
"an",
"item",
".",
"Moves",
"the",
"item",
"up",
"so",
"that",
"it",
"has",
"the",
"highest",
"priority",
"then",
"."
] | def __setitem__(self, key, value):
"""Sets the value for an item. Moves the item up so that it
has the highest priority then.
"""
self._wlock.acquire()
try:
if key in self._mapping:
self._remove(key)
elif len(self._mapping) == self.capacity... | [
"def",
"__setitem__",
"(",
"self",
",",
"key",
",",
"value",
")",
":",
"self",
".",
"_wlock",
".",
"acquire",
"(",
")",
"try",
":",
"if",
"key",
"in",
"self",
".",
"_mapping",
":",
"self",
".",
"_remove",
"(",
"key",
")",
"elif",
"len",
"(",
"sel... | https://github.com/nodejs/node-chakracore/blob/770c8dcd1bc3e0fce2d4497b4eec3fe49d829d43/deps/chakrashim/third_party/jinja2/jinja2/utils.py#L413-L426 | ||
mozilla/spidernode | aafa9e5273f954f272bb4382fc007af14674b4c2 | deps/npm/node_modules/node-gyp/gyp/pylib/gyp/generator/android.py | python | AndroidMkWriter.ComputeOutput | (self, spec) | return os.path.join(path, self.ComputeOutputBasename(spec)) | Return the 'output' (full output path) of a gyp spec.
E.g., the loadable module 'foobar' in directory 'baz' will produce
'$(obj)/baz/libfoobar.so' | Return the 'output' (full output path) of a gyp spec. | [
"Return",
"the",
"output",
"(",
"full",
"output",
"path",
")",
"of",
"a",
"gyp",
"spec",
"."
] | def ComputeOutput(self, spec):
"""Return the 'output' (full output path) of a gyp spec.
E.g., the loadable module 'foobar' in directory 'baz' will produce
'$(obj)/baz/libfoobar.so'
"""
if self.type == 'executable':
# We install host executables into shared_intermediate_dir so they can be
... | [
"def",
"ComputeOutput",
"(",
"self",
",",
"spec",
")",
":",
"if",
"self",
".",
"type",
"==",
"'executable'",
":",
"# We install host executables into shared_intermediate_dir so they can be",
"# run by gyp rules that refer to PRODUCT_DIR.",
"path",
"=",
"'$(gyp_shared_intermedia... | https://github.com/mozilla/spidernode/blob/aafa9e5273f954f272bb4382fc007af14674b4c2/deps/npm/node_modules/node-gyp/gyp/pylib/gyp/generator/android.py#L662-L688 | |
jxcore/jxcore | b05f1f2d2c9d62c813c7d84f3013dbbf30b6e410 | deps/npm/node_modules/node-gyp/gyp/pylib/gyp/msvs_emulation.py | python | MsvsSettings.GetLdflags | (self, config, gyp_to_build_path, expand_special,
manifest_base_name, output_name, is_executable, build_dir) | return ldflags, intermediate_manifest, manifest_files | Returns the flags that need to be added to link commands, and the
manifest files. | Returns the flags that need to be added to link commands, and the
manifest files. | [
"Returns",
"the",
"flags",
"that",
"need",
"to",
"be",
"added",
"to",
"link",
"commands",
"and",
"the",
"manifest",
"files",
"."
] | def GetLdflags(self, config, gyp_to_build_path, expand_special,
manifest_base_name, output_name, is_executable, build_dir):
"""Returns the flags that need to be added to link commands, and the
manifest files."""
config = self._TargetConfig(config)
ldflags = []
ld = self._GetWrapper(... | [
"def",
"GetLdflags",
"(",
"self",
",",
"config",
",",
"gyp_to_build_path",
",",
"expand_special",
",",
"manifest_base_name",
",",
"output_name",
",",
"is_executable",
",",
"build_dir",
")",
":",
"config",
"=",
"self",
".",
"_TargetConfig",
"(",
"config",
")",
... | https://github.com/jxcore/jxcore/blob/b05f1f2d2c9d62c813c7d84f3013dbbf30b6e410/deps/npm/node_modules/node-gyp/gyp/pylib/gyp/msvs_emulation.py#L555-L647 | |
atom-community/ide-python | c046f9c2421713b34baa22648235541c5bb284fe | dist/debugger/VendorLib/vs-py-debugger/pythonFiles/experimental/ptvsd/ptvsd/_vendored/pydevd/_pydev_imps/_pydev_SocketServer.py | python | TCPServer.fileno | (self) | return self.socket.fileno() | Return socket file number.
Interface required by select(). | Return socket file number. | [
"Return",
"socket",
"file",
"number",
"."
] | def fileno(self):
"""Return socket file number.
Interface required by select().
"""
return self.socket.fileno() | [
"def",
"fileno",
"(",
"self",
")",
":",
"return",
"self",
".",
"socket",
".",
"fileno",
"(",
")"
] | https://github.com/atom-community/ide-python/blob/c046f9c2421713b34baa22648235541c5bb284fe/dist/debugger/VendorLib/vs-py-debugger/pythonFiles/experimental/ptvsd/ptvsd/_vendored/pydevd/_pydev_imps/_pydev_SocketServer.py#L438-L444 | |
datahuborg/datahub | f066b472c2b66cc3b868bbe433aed2d4557aea32 | src/examples/python/gen_py/datahub/DataHub.py | python | Iface.create_repo | (self, con, repo_name) | Parameters:
- con
- repo_name | Parameters:
- con
- repo_name | [
"Parameters",
":",
"-",
"con",
"-",
"repo_name"
] | def create_repo(self, con, repo_name):
"""
Parameters:
- con
- repo_name
"""
pass | [
"def",
"create_repo",
"(",
"self",
",",
"con",
",",
"repo_name",
")",
":",
"pass"
] | https://github.com/datahuborg/datahub/blob/f066b472c2b66cc3b868bbe433aed2d4557aea32/src/examples/python/gen_py/datahub/DataHub.py#L31-L37 | ||
replit-archive/jsrepl | 36d79b6288ca5d26208e8bade2a168c6ebcb2376 | extern/python/unclosured/lib/python2.7/urllib.py | python | ftperrors | () | return _ftperrors | Return the set of errors raised by the FTP class. | Return the set of errors raised by the FTP class. | [
"Return",
"the",
"set",
"of",
"errors",
"raised",
"by",
"the",
"FTP",
"class",
"."
] | def ftperrors():
"""Return the set of errors raised by the FTP class."""
global _ftperrors
if _ftperrors is None:
import ftplib
_ftperrors = ftplib.all_errors
return _ftperrors | [
"def",
"ftperrors",
"(",
")",
":",
"global",
"_ftperrors",
"if",
"_ftperrors",
"is",
"None",
":",
"import",
"ftplib",
"_ftperrors",
"=",
"ftplib",
".",
"all_errors",
"return",
"_ftperrors"
] | https://github.com/replit-archive/jsrepl/blob/36d79b6288ca5d26208e8bade2a168c6ebcb2376/extern/python/unclosured/lib/python2.7/urllib.py#L824-L830 | |
ayojs/ayo | 45a1c8cf6384f5bcc81d834343c3ed9d78b97df3 | deps/npm/node_modules/node-gyp/gyp/pylib/gyp/MSVSSettings.py | python | _Type.ValidateMSVS | (self, value) | Verifies that the value is legal for MSVS.
Args:
value: the value to check for this type.
Raises:
ValueError if value is not valid for MSVS. | Verifies that the value is legal for MSVS. | [
"Verifies",
"that",
"the",
"value",
"is",
"legal",
"for",
"MSVS",
"."
] | def ValidateMSVS(self, value):
"""Verifies that the value is legal for MSVS.
Args:
value: the value to check for this type.
Raises:
ValueError if value is not valid for MSVS.
""" | [
"def",
"ValidateMSVS",
"(",
"self",
",",
"value",
")",
":"
] | https://github.com/ayojs/ayo/blob/45a1c8cf6384f5bcc81d834343c3ed9d78b97df3/deps/npm/node_modules/node-gyp/gyp/pylib/gyp/MSVSSettings.py#L70-L78 | ||
xtk/X | 04c1aa856664a8517d23aefd94c470d47130aead | lib/selenium/selenium/webdriver/common/alert.py | python | Alert.accept | (self) | Accepts the alert available | Accepts the alert available | [
"Accepts",
"the",
"alert",
"available"
] | def accept(self):
""" Accepts the alert available """
self.driver.execute(Command.ACCEPT_ALERT) | [
"def",
"accept",
"(",
"self",
")",
":",
"self",
".",
"driver",
".",
"execute",
"(",
"Command",
".",
"ACCEPT_ALERT",
")"
] | https://github.com/xtk/X/blob/04c1aa856664a8517d23aefd94c470d47130aead/lib/selenium/selenium/webdriver/common/alert.py#L33-L35 | ||
CaliOpen/Caliopen | 5361ebc5d4d2c525a87f737468b8a8e2aefbe3e8 | src/backend/components/py.pi/caliopen_pi/qualifiers/base.py | python | BaseQualifier.get_participant | (self, message, participant) | return p, c | Try to find a related contact and return a Participant instance. | Try to find a related contact and return a Participant instance. | [
"Try",
"to",
"find",
"a",
"related",
"contact",
"and",
"return",
"a",
"Participant",
"instance",
"."
] | def get_participant(self, message, participant):
"""Try to find a related contact and return a Participant instance."""
p = Participant()
p.address = participant.address.lower()
p.type = participant.type
p.label = participant.label
p.protocol = message.message_protocol
... | [
"def",
"get_participant",
"(",
"self",
",",
"message",
",",
"participant",
")",
":",
"p",
"=",
"Participant",
"(",
")",
"p",
".",
"address",
"=",
"participant",
".",
"address",
".",
"lower",
"(",
")",
"p",
".",
"type",
"=",
"participant",
".",
"type",
... | https://github.com/CaliOpen/Caliopen/blob/5361ebc5d4d2c525a87f737468b8a8e2aefbe3e8/src/backend/components/py.pi/caliopen_pi/qualifiers/base.py#L59-L78 | |
nodejs/node | ac3c33c1646bf46104c15ae035982c06364da9b8 | tools/gyp/pylib/gyp/generator/ninja.py | python | Target.PreCompileInput | (self) | return self.actions_stamp or self.precompile_stamp | Return the path, if any, that should be used as a dependency of
any dependent compile step. | Return the path, if any, that should be used as a dependency of
any dependent compile step. | [
"Return",
"the",
"path",
"if",
"any",
"that",
"should",
"be",
"used",
"as",
"a",
"dependency",
"of",
"any",
"dependent",
"compile",
"step",
"."
] | def PreCompileInput(self):
"""Return the path, if any, that should be used as a dependency of
any dependent compile step."""
return self.actions_stamp or self.precompile_stamp | [
"def",
"PreCompileInput",
"(",
"self",
")",
":",
"return",
"self",
".",
"actions_stamp",
"or",
"self",
".",
"precompile_stamp"
] | https://github.com/nodejs/node/blob/ac3c33c1646bf46104c15ae035982c06364da9b8/tools/gyp/pylib/gyp/generator/ninja.py#L177-L180 | |
UWFlow/rmc | 00bcc1450ffbec3a6c8d956a2a5d1bb3a04bfcb9 | server/view_helpers.py | python | redirect_to_profile | (user) | Returns a flask.redirect() to a given user's profile.
Basically redirect the request to the /profile endpoint with their ObjectId
Args:
user: The user's profile to redirects to. Should NOT be None. | Returns a flask.redirect() to a given user's profile. | [
"Returns",
"a",
"flask",
".",
"redirect",
"()",
"to",
"a",
"given",
"user",
"s",
"profile",
"."
] | def redirect_to_profile(user):
"""
Returns a flask.redirect() to a given user's profile.
Basically redirect the request to the /profile endpoint with their ObjectId
Args:
user: The user's profile to redirects to. Should NOT be None.
"""
if user is None:
# This should only happe... | [
"def",
"redirect_to_profile",
"(",
"user",
")",
":",
"if",
"user",
"is",
"None",
":",
"# This should only happen during development time...",
"logging",
".",
"error",
"(",
"'redirect_to_profile(user) called with user=None'",
")",
"return",
"flask",
".",
"redirect",
"(",
... | https://github.com/UWFlow/rmc/blob/00bcc1450ffbec3a6c8d956a2a5d1bb3a04bfcb9/server/view_helpers.py#L134-L152 | ||
jxcore/jxcore | b05f1f2d2c9d62c813c7d84f3013dbbf30b6e410 | deps/npm/node_modules/node-gyp/gyp/pylib/gyp/generator/ninja.py | python | Target.PreActionInput | (self, flavor) | return self.FinalOutput() or self.preaction_stamp | Return the path, if any, that should be used as a dependency of
any dependent action step. | Return the path, if any, that should be used as a dependency of
any dependent action step. | [
"Return",
"the",
"path",
"if",
"any",
"that",
"should",
"be",
"used",
"as",
"a",
"dependency",
"of",
"any",
"dependent",
"action",
"step",
"."
] | def PreActionInput(self, flavor):
"""Return the path, if any, that should be used as a dependency of
any dependent action step."""
if self.UsesToc(flavor):
return self.FinalOutput() + '.TOC'
return self.FinalOutput() or self.preaction_stamp | [
"def",
"PreActionInput",
"(",
"self",
",",
"flavor",
")",
":",
"if",
"self",
".",
"UsesToc",
"(",
"flavor",
")",
":",
"return",
"self",
".",
"FinalOutput",
"(",
")",
"+",
"'.TOC'",
"return",
"self",
".",
"FinalOutput",
"(",
")",
"or",
"self",
".",
"p... | https://github.com/jxcore/jxcore/blob/b05f1f2d2c9d62c813c7d84f3013dbbf30b6e410/deps/npm/node_modules/node-gyp/gyp/pylib/gyp/generator/ninja.py#L163-L168 | |
Southpaw-TACTIC/TACTIC | ba9b87aef0ee3b3ea51446f25b285ebbca06f62c | src/pyasm/prod/service/base_xmlrpc.py | python | BaseXMLRPC.create_set | (self, ticket, project_code, set_name, cat_name, selected) | return [xml, asset_code] | an xml to create a new set node | an xml to create a new set node | [
"an",
"xml",
"to",
"create",
"a",
"new",
"set",
"node"
] | def create_set(self, ticket, project_code, set_name, cat_name, selected):
'''an xml to create a new set node'''
xml = ''
asset_code = ''
try:
self.init(ticket)
Project.set_project(project_code)
cmd = MayaSetCreateCmd()
cmd.set_set_name(set_... | [
"def",
"create_set",
"(",
"self",
",",
"ticket",
",",
"project_code",
",",
"set_name",
",",
"cat_name",
",",
"selected",
")",
":",
"xml",
"=",
"''",
"asset_code",
"=",
"''",
"try",
":",
"self",
".",
"init",
"(",
"ticket",
")",
"Project",
".",
"set_proj... | https://github.com/Southpaw-TACTIC/TACTIC/blob/ba9b87aef0ee3b3ea51446f25b285ebbca06f62c/src/pyasm/prod/service/base_xmlrpc.py#L232-L258 | |
jeeliz/jeelizFaceFilter | be3ffa5a76c930a98b2b7895c1dfa1faa4a1fa82 | libs/three/blenderExporter/io_three/exporter/api/object.py | python | _valid_node | (obj, valid_types, options) | return True | :param obj:
:param valid_types:
:param options: | [] | def _valid_node(obj, valid_types, options):
"""
:param obj:
:param valid_types:
:param options:
"""
if obj.type not in valid_types:
return False
# skip objects that are not on visible layers
visible_layers = _visible_scene_layers()
if not _on_visible_layer(obj, visible_lay... | [
"def",
"_valid_node",
"(",
"obj",
",",
"valid_types",
",",
"options",
")",
":",
"if",
"obj",
".",
"type",
"not",
"in",
"valid_types",
":",
"return",
"False",
"# skip objects that are not on visible layers",
"visible_layers",
"=",
"_visible_scene_layers",
"(",
")",
... | https://github.com/jeeliz/jeelizFaceFilter/blob/be3ffa5a76c930a98b2b7895c1dfa1faa4a1fa82/libs/three/blenderExporter/io_three/exporter/api/object.py#L700-L738 | ||
atom-community/ide-python | c046f9c2421713b34baa22648235541c5bb284fe | dist/debugger/VendorLib/vs-py-debugger/pythonFiles/experimental/ptvsd/ptvsd/_vendored/pydevd/third_party/pep8/lib2to3/lib2to3/main.py | python | main | (fixer_pkg, args=None) | return int(bool(rt.errors)) | Main program.
Args:
fixer_pkg: the name of a package where the fixers are located.
args: optional; a list of command line arguments. If omitted,
sys.argv[1:] is used.
Returns a suggested exit status (0, 1, 2). | Main program. | [
"Main",
"program",
"."
] | def main(fixer_pkg, args=None):
"""Main program.
Args:
fixer_pkg: the name of a package where the fixers are located.
args: optional; a list of command line arguments. If omitted,
sys.argv[1:] is used.
Returns a suggested exit status (0, 1, 2).
"""
# Set up option par... | [
"def",
"main",
"(",
"fixer_pkg",
",",
"args",
"=",
"None",
")",
":",
"# Set up option parser",
"parser",
"=",
"optparse",
".",
"OptionParser",
"(",
"usage",
"=",
"\"2to3 [options] file|dir ...\"",
")",
"parser",
".",
"add_option",
"(",
"\"-d\"",
",",
"\"--doctes... | https://github.com/atom-community/ide-python/blob/c046f9c2421713b34baa22648235541c5bb284fe/dist/debugger/VendorLib/vs-py-debugger/pythonFiles/experimental/ptvsd/ptvsd/_vendored/pydevd/third_party/pep8/lib2to3/lib2to3/main.py#L134-L269 | |
NVIDIA-AI-IOT/deepstream_360_d_smart_parking_application | b9b1f9e9aa84e379c573063fc5622ef50d38898d | tracker/code/mctrack/mctracker.py | python | MulticamTracker.select_rep_member_from_list | (self, json_list) | return retval | This method selects one representative dict from the list
of vehicle detections (in json_list)
Returns:
[dict] -- A representative day2 schema dictionary of
selected representative vehicle detection | This method selects one representative dict from the list
of vehicle detections (in json_list) | [
"This",
"method",
"selects",
"one",
"representative",
"dict",
"from",
"the",
"list",
"of",
"vehicle",
"detections",
"(",
"in",
"json_list",
")"
] | def select_rep_member_from_list(self, json_list):
"""
This method selects one representative dict from the list
of vehicle detections (in json_list)
Returns:
[dict] -- A representative day2 schema dictionary of
selected representative vehicle detection
""... | [
"def",
"select_rep_member_from_list",
"(",
"self",
",",
"json_list",
")",
":",
"retval",
"=",
"None",
"if",
"json_list",
":",
"retval",
"=",
"json_list",
"[",
"0",
"]",
"pref",
"=",
"100",
"min_obj_id",
"=",
"None",
"for",
"ele",
"in",
"json_list",
":",
... | https://github.com/NVIDIA-AI-IOT/deepstream_360_d_smart_parking_application/blob/b9b1f9e9aa84e379c573063fc5622ef50d38898d/tracker/code/mctrack/mctracker.py#L554-L582 | |
agoravoting/agora-ciudadana | a7701035ea77d7a91baa9b5c2d0c05d91d1b4262 | agora_site/misc/utils.py | python | rest | (path, query={}, data={}, headers={}, method="GET", request=None) | return (res.status_code, res._container) | Converts a RPC-like call to something like a HttpRequest, passes it
to the right view function (via django's url resolver) and returns
the result.
Args:
path: a uri-like string representing an API endpoint. e.g. /resource/27.
/api/v2/ is automatically prepended to the path.
qu... | Converts a RPC-like call to something like a HttpRequest, passes it
to the right view function (via django's url resolver) and returns
the result. | [
"Converts",
"a",
"RPC",
"-",
"like",
"call",
"to",
"something",
"like",
"a",
"HttpRequest",
"passes",
"it",
"to",
"the",
"right",
"view",
"function",
"(",
"via",
"django",
"s",
"url",
"resolver",
")",
"and",
"returns",
"the",
"result",
"."
] | def rest(path, query={}, data={}, headers={}, method="GET", request=None):
"""
Converts a RPC-like call to something like a HttpRequest, passes it
to the right view function (via django's url resolver) and returns
the result.
Args:
path: a uri-like string representing an API endpoint. e.g. ... | [
"def",
"rest",
"(",
"path",
",",
"query",
"=",
"{",
"}",
",",
"data",
"=",
"{",
"}",
",",
"headers",
"=",
"{",
"}",
",",
"method",
"=",
"\"GET\"",
",",
"request",
"=",
"None",
")",
":",
"#adjust for lack of trailing slash, just in case",
"if",
"path",
... | https://github.com/agoravoting/agora-ciudadana/blob/a7701035ea77d7a91baa9b5c2d0c05d91d1b4262/agora_site/misc/utils.py#L375-L415 | |
CaliOpen/Caliopen | 5361ebc5d4d2c525a87f737468b8a8e2aefbe3e8 | src/backend/tools/py.CLI/caliopen_cli/commands/setup_storage.py | python | setup_storage | (settings=None) | Create cassandra models. | Create cassandra models. | [
"Create",
"cassandra",
"models",
"."
] | def setup_storage(settings=None):
"""Create cassandra models."""
from caliopen_storage.core import core_registry
# Make discovery happen
from caliopen_main.user.core import User
from caliopen_main.user.core import (UserIdentity,
IdentityLookup,
... | [
"def",
"setup_storage",
"(",
"settings",
"=",
"None",
")",
":",
"from",
"caliopen_storage",
".",
"core",
"import",
"core_registry",
"# Make discovery happen",
"from",
"caliopen_main",
".",
"user",
".",
"core",
"import",
"User",
"from",
"caliopen_main",
".",
"user"... | https://github.com/CaliOpen/Caliopen/blob/5361ebc5d4d2c525a87f737468b8a8e2aefbe3e8/src/backend/tools/py.CLI/caliopen_cli/commands/setup_storage.py#L9-L35 | ||
nodejs/quic | 5baab3f3a05548d3b51bea98868412b08766e34d | deps/npm/node_modules/node-gyp/gyp/pylib/gyp/msvs_emulation.py | python | MsvsSettings.AdjustMidlIncludeDirs | (self, midl_include_dirs, config) | return [self.ConvertVSMacros(p, config=config) for p in includes] | Updates midl_include_dirs to expand VS specific paths, and adds the
system include dirs used for platform SDK and similar. | Updates midl_include_dirs to expand VS specific paths, and adds the
system include dirs used for platform SDK and similar. | [
"Updates",
"midl_include_dirs",
"to",
"expand",
"VS",
"specific",
"paths",
"and",
"adds",
"the",
"system",
"include",
"dirs",
"used",
"for",
"platform",
"SDK",
"and",
"similar",
"."
] | def AdjustMidlIncludeDirs(self, midl_include_dirs, config):
"""Updates midl_include_dirs to expand VS specific paths, and adds the
system include dirs used for platform SDK and similar."""
config = self._TargetConfig(config)
includes = midl_include_dirs + self.msvs_system_include_dirs[config]
includ... | [
"def",
"AdjustMidlIncludeDirs",
"(",
"self",
",",
"midl_include_dirs",
",",
"config",
")",
":",
"config",
"=",
"self",
".",
"_TargetConfig",
"(",
"config",
")",
"includes",
"=",
"midl_include_dirs",
"+",
"self",
".",
"msvs_system_include_dirs",
"[",
"config",
"]... | https://github.com/nodejs/quic/blob/5baab3f3a05548d3b51bea98868412b08766e34d/deps/npm/node_modules/node-gyp/gyp/pylib/gyp/msvs_emulation.py#L349-L356 | |
replit-archive/jsrepl | 36d79b6288ca5d26208e8bade2a168c6ebcb2376 | extern/python/reloop-closured/lib/python2.7/smtplib.py | python | SMTP.starttls | (self, keyfile=None, certfile=None) | return (resp, reply) | Puts the connection to the SMTP server into TLS mode.
If there has been no previous EHLO or HELO command this session, this
method tries ESMTP EHLO first.
If the server supports TLS, this will encrypt the rest of the SMTP
session. If you provide the keyfile and certfile parameters,
... | Puts the connection to the SMTP server into TLS mode. | [
"Puts",
"the",
"connection",
"to",
"the",
"SMTP",
"server",
"into",
"TLS",
"mode",
"."
] | def starttls(self, keyfile=None, certfile=None):
"""Puts the connection to the SMTP server into TLS mode.
If there has been no previous EHLO or HELO command this session, this
method tries ESMTP EHLO first.
If the server supports TLS, this will encrypt the rest of the SMTP
sess... | [
"def",
"starttls",
"(",
"self",
",",
"keyfile",
"=",
"None",
",",
"certfile",
"=",
"None",
")",
":",
"self",
".",
"ehlo_or_helo_if_needed",
"(",
")",
"if",
"not",
"self",
".",
"has_extn",
"(",
"\"starttls\"",
")",
":",
"raise",
"SMTPException",
"(",
"\"S... | https://github.com/replit-archive/jsrepl/blob/36d79b6288ca5d26208e8bade2a168c6ebcb2376/extern/python/reloop-closured/lib/python2.7/smtplib.py#L607-L641 | |
replit-archive/jsrepl | 36d79b6288ca5d26208e8bade2a168c6ebcb2376 | extern/python/closured/lib/python2.7/collections.py | python | Counter.__missing__ | (self, key) | return 0 | The count of elements not in the Counter is zero. | The count of elements not in the Counter is zero. | [
"The",
"count",
"of",
"elements",
"not",
"in",
"the",
"Counter",
"is",
"zero",
"."
] | def __missing__(self, key):
'The count of elements not in the Counter is zero.'
# Needed so that self[missing_item] does not raise KeyError
return 0 | [
"def",
"__missing__",
"(",
"self",
",",
"key",
")",
":",
"# Needed so that self[missing_item] does not raise KeyError",
"return",
"0"
] | https://github.com/replit-archive/jsrepl/blob/36d79b6288ca5d26208e8bade2a168c6ebcb2376/extern/python/closured/lib/python2.7/collections.py#L420-L423 | |
nkrode/RedisLive | e1d7763baee558ce4681b7764025d38df5ee5798 | src/dataprovider/redisprovider.py | python | RedisStatsProvider.save_info_command | (self, server, timestamp, info) | Save Redis info command dump
Args:
server (str): id of server
timestamp (datetime): Timestamp.
info (dict): The result of a Redis INFO command. | Save Redis info command dump | [
"Save",
"Redis",
"info",
"command",
"dump"
] | def save_info_command(self, server, timestamp, info):
"""Save Redis info command dump
Args:
server (str): id of server
timestamp (datetime): Timestamp.
info (dict): The result of a Redis INFO command.
"""
self.conn.set(server + ":Info", json.dumps(inf... | [
"def",
"save_info_command",
"(",
"self",
",",
"server",
",",
"timestamp",
",",
"info",
")",
":",
"self",
".",
"conn",
".",
"set",
"(",
"server",
"+",
"\":Info\"",
",",
"json",
".",
"dumps",
"(",
"info",
")",
")"
] | https://github.com/nkrode/RedisLive/blob/e1d7763baee558ce4681b7764025d38df5ee5798/src/dataprovider/redisprovider.py#L32-L40 | ||
replit-archive/jsrepl | 36d79b6288ca5d26208e8bade2a168c6ebcb2376 | extern/python/reloop-closured/lib/python2.7/random.py | python | WichmannHill.seed | (self, a=None) | Initialize internal state from hashable object.
None or no argument seeds from current time or from an operating
system specific randomness source if available.
If a is not None or an int or long, hash(a) is used instead.
If a is an int or long, a is used directly. Distinct values be... | Initialize internal state from hashable object. | [
"Initialize",
"internal",
"state",
"from",
"hashable",
"object",
"."
] | def seed(self, a=None):
"""Initialize internal state from hashable object.
None or no argument seeds from current time or from an operating
system specific randomness source if available.
If a is not None or an int or long, hash(a) is used instead.
If a is an int or long, a is... | [
"def",
"seed",
"(",
"self",
",",
"a",
"=",
"None",
")",
":",
"if",
"a",
"is",
"None",
":",
"try",
":",
"a",
"=",
"long",
"(",
"_hexlify",
"(",
"_urandom",
"(",
"16",
")",
")",
",",
"16",
")",
"except",
"NotImplementedError",
":",
"import",
"time"... | https://github.com/replit-archive/jsrepl/blob/36d79b6288ca5d26208e8bade2a168c6ebcb2376/extern/python/reloop-closured/lib/python2.7/random.py#L657-L686 | ||
atom-community/ide-python | c046f9c2421713b34baa22648235541c5bb284fe | dist/debugger/VendorLib/vs-py-debugger/pythonFiles/experimental/ptvsd/ptvsd/_vendored/pydevd/pydevd_attach_to_process/winappdbg/win32/user32.py | python | Point._as_parameter_ | (self) | return POINT(self.x, self.y) | Compatibility with ctypes.
Allows passing transparently a Point object to an API call. | Compatibility with ctypes.
Allows passing transparently a Point object to an API call. | [
"Compatibility",
"with",
"ctypes",
".",
"Allows",
"passing",
"transparently",
"a",
"Point",
"object",
"to",
"an",
"API",
"call",
"."
] | def _as_parameter_(self):
"""
Compatibility with ctypes.
Allows passing transparently a Point object to an API call.
"""
return POINT(self.x, self.y) | [
"def",
"_as_parameter_",
"(",
"self",
")",
":",
"return",
"POINT",
"(",
"self",
".",
"x",
",",
"self",
".",
"y",
")"
] | https://github.com/atom-community/ide-python/blob/c046f9c2421713b34baa22648235541c5bb284fe/dist/debugger/VendorLib/vs-py-debugger/pythonFiles/experimental/ptvsd/ptvsd/_vendored/pydevd/pydevd_attach_to_process/winappdbg/win32/user32.py#L438-L443 | |
TeamvisionCorp/TeamVision | aa2a57469e430ff50cce21174d8f280efa0a83a7 | distribute/0.0.4/build_shell/teamvision/teamvision/issue/views/dashboard_view.py | python | index | (request,env_id) | return page_worker.get_dashboard_index(request,"all") | index page | index page | [
"index",
"page"
] | def index(request,env_id):
''' index page'''
page_worker=ENVDashBoardPageWorker(request)
return page_worker.get_dashboard_index(request,"all") | [
"def",
"index",
"(",
"request",
",",
"env_id",
")",
":",
"page_worker",
"=",
"ENVDashBoardPageWorker",
"(",
"request",
")",
"return",
"page_worker",
".",
"get_dashboard_index",
"(",
"request",
",",
"\"all\"",
")"
] | https://github.com/TeamvisionCorp/TeamVision/blob/aa2a57469e430ff50cce21174d8f280efa0a83a7/distribute/0.0.4/build_shell/teamvision/teamvision/issue/views/dashboard_view.py#L18-L21 | |
aaPanel/aaPanel | d2a66661dbd66948cce5a074214257550aec91ee | class/pyotp/totp.py | python | TOTP.__init__ | (self, *args, **kwargs) | :param interval: the time interval in seconds
for OTP. This defaults to 30.
:type interval: int | :param interval: the time interval in seconds
for OTP. This defaults to 30.
:type interval: int | [
":",
"param",
"interval",
":",
"the",
"time",
"interval",
"in",
"seconds",
"for",
"OTP",
".",
"This",
"defaults",
"to",
"30",
".",
":",
"type",
"interval",
":",
"int"
] | def __init__(self, *args, **kwargs):
"""
:param interval: the time interval in seconds
for OTP. This defaults to 30.
:type interval: int
"""
self.interval = kwargs.pop('interval', 30)
super(TOTP, self).__init__(*args, **kwargs) | [
"def",
"__init__",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"self",
".",
"interval",
"=",
"kwargs",
".",
"pop",
"(",
"'interval'",
",",
"30",
")",
"super",
"(",
"TOTP",
",",
"self",
")",
".",
"__init__",
"(",
"*",
"args",... | https://github.com/aaPanel/aaPanel/blob/d2a66661dbd66948cce5a074214257550aec91ee/class/pyotp/totp.py#L14-L21 | ||
Nexedi/erp5 | 44df1959c0e21576cf5e9803d602d95efb4b695b | product/Zelenium/zuite.py | python | Zuite._getZipFile | ( self, include_selenium=True ) | return stream.getvalue() | Generate a zip file containing both tests and scaffolding. | Generate a zip file containing both tests and scaffolding. | [
"Generate",
"a",
"zip",
"file",
"containing",
"both",
"tests",
"and",
"scaffolding",
"."
] | def _getZipFile( self, include_selenium=True ):
""" Generate a zip file containing both tests and scaffolding.
"""
stream = StringIO.StringIO()
archive = zipfile.ZipFile( stream, 'w' )
def convertToBytes(body):
if isinstance(body, types.UnicodeType):
... | [
"def",
"_getZipFile",
"(",
"self",
",",
"include_selenium",
"=",
"True",
")",
":",
"stream",
"=",
"StringIO",
".",
"StringIO",
"(",
")",
"archive",
"=",
"zipfile",
".",
"ZipFile",
"(",
"stream",
",",
"'w'",
")",
"def",
"convertToBytes",
"(",
"body",
")",... | https://github.com/Nexedi/erp5/blob/44df1959c0e21576cf5e9803d602d95efb4b695b/product/Zelenium/zuite.py#L497-L566 | |
carlosperate/ardublockly | 04fa48273b5651386d0ef1ce6dd446795ffc2594 | ardublocklyserver/local-packages/serial/threaded/__init__.py | python | LineReader.handle_line | (self, line) | Process one line - to be overridden by subclassing | Process one line - to be overridden by subclassing | [
"Process",
"one",
"line",
"-",
"to",
"be",
"overridden",
"by",
"subclassing"
] | def handle_line(self, line):
"""Process one line - to be overridden by subclassing"""
raise NotImplementedError('please implement functionality in handle_line') | [
"def",
"handle_line",
"(",
"self",
",",
"line",
")",
":",
"raise",
"NotImplementedError",
"(",
"'please implement functionality in handle_line'",
")"
] | https://github.com/carlosperate/ardublockly/blob/04fa48273b5651386d0ef1ce6dd446795ffc2594/ardublocklyserver/local-packages/serial/threaded/__init__.py#L134-L136 | ||
aws-samples/aws-lex-web-ui | 370f11286062957faf51448cb3bd93c5776be8e0 | templates/custom-resources/lex-manager.py | python | get_parsed_args | () | return args | Parse arguments passed when running as a shell script | Parse arguments passed when running as a shell script | [
"Parse",
"arguments",
"passed",
"when",
"running",
"as",
"a",
"shell",
"script"
] | def get_parsed_args():
""" Parse arguments passed when running as a shell script
"""
parser = argparse.ArgumentParser(
description='Lex bot manager. Import, export or delete a Lex bot.'
' Used to import/export/delete Lex bots and associated resources'
' (i.e. intents, slot ty... | [
"def",
"get_parsed_args",
"(",
")",
":",
"parser",
"=",
"argparse",
".",
"ArgumentParser",
"(",
"description",
"=",
"'Lex bot manager. Import, export or delete a Lex bot.'",
"' Used to import/export/delete Lex bots and associated resources'",
"' (i.e. intents, slot types).'",
")",
... | https://github.com/aws-samples/aws-lex-web-ui/blob/370f11286062957faf51448cb3bd93c5776be8e0/templates/custom-resources/lex-manager.py#L105-L142 | |
replit-archive/jsrepl | 36d79b6288ca5d26208e8bade2a168c6ebcb2376 | extern/python/unclosured/lib/python2.7/ftplib.py | python | FTP.size | (self, filename) | Retrieve the size of a file. | Retrieve the size of a file. | [
"Retrieve",
"the",
"size",
"of",
"a",
"file",
"."
] | def size(self, filename):
'''Retrieve the size of a file.'''
# The SIZE command is defined in RFC-3659
resp = self.sendcmd('SIZE ' + filename)
if resp[:3] == '213':
s = resp[3:].strip()
try:
return int(s)
except (OverflowError, ValueErr... | [
"def",
"size",
"(",
"self",
",",
"filename",
")",
":",
"# The SIZE command is defined in RFC-3659",
"resp",
"=",
"self",
".",
"sendcmd",
"(",
"'SIZE '",
"+",
"filename",
")",
"if",
"resp",
"[",
":",
"3",
"]",
"==",
"'213'",
":",
"s",
"=",
"resp",
"[",
... | https://github.com/replit-archive/jsrepl/blob/36d79b6288ca5d26208e8bade2a168c6ebcb2376/extern/python/unclosured/lib/python2.7/ftplib.py#L545-L554 | ||
mozilla/spidernode | aafa9e5273f954f272bb4382fc007af14674b4c2 | deps/npm/node_modules/node-gyp/gyp/pylib/gyp/generator/msvs.py | python | _ValidateSourcesForMSVSProject | (spec, version) | Makes sure if duplicate basenames are not specified in the source list.
Arguments:
spec: The target dictionary containing the properties of the target.
version: The VisualStudioVersion object. | Makes sure if duplicate basenames are not specified in the source list. | [
"Makes",
"sure",
"if",
"duplicate",
"basenames",
"are",
"not",
"specified",
"in",
"the",
"source",
"list",
"."
] | def _ValidateSourcesForMSVSProject(spec, version):
"""Makes sure if duplicate basenames are not specified in the source list.
Arguments:
spec: The target dictionary containing the properties of the target.
version: The VisualStudioVersion object.
"""
# This validation should not be applied to MSVC2010 ... | [
"def",
"_ValidateSourcesForMSVSProject",
"(",
"spec",
",",
"version",
")",
":",
"# This validation should not be applied to MSVC2010 and later.",
"assert",
"not",
"version",
".",
"UsesVcxproj",
"(",
")",
"# TODO: Check if MSVC allows this for loadable_module targets.",
"if",
"spe... | https://github.com/mozilla/spidernode/blob/aafa9e5273f954f272bb4382fc007af14674b4c2/deps/npm/node_modules/node-gyp/gyp/pylib/gyp/generator/msvs.py#L947-L979 | ||
atom-community/ide-python | c046f9c2421713b34baa22648235541c5bb284fe | dist/debugger/VendorLib/vs-py-debugger/pythonFiles/PythonTools/visualstudio_py_repl.py | python | ReplBackend.run_command | (self, command) | runs the specified command which is a string containing code | runs the specified command which is a string containing code | [
"runs",
"the",
"specified",
"command",
"which",
"is",
"a",
"string",
"containing",
"code"
] | def run_command(self, command):
"""runs the specified command which is a string containing code"""
raise NotImplementedError | [
"def",
"run_command",
"(",
"self",
",",
"command",
")",
":",
"raise",
"NotImplementedError"
] | https://github.com/atom-community/ide-python/blob/c046f9c2421713b34baa22648235541c5bb284fe/dist/debugger/VendorLib/vs-py-debugger/pythonFiles/PythonTools/visualstudio_py_repl.py#L469-L471 | ||
depjs/dep | cb8def92812d80b1fd8e5ffbbc1ae129a207fff6 | node_modules/node-gyp/gyp/pylib/gyp/generator/ninja.py | python | NinjaWriter.GypPathToNinja | (self, path, env=None) | return os.path.normpath(os.path.join(self.build_to_base, path)) | Translate a gyp path to a ninja path, optionally expanding environment
variable references in |path| with |env|.
See the above discourse on path conversions. | Translate a gyp path to a ninja path, optionally expanding environment
variable references in |path| with |env|. | [
"Translate",
"a",
"gyp",
"path",
"to",
"a",
"ninja",
"path",
"optionally",
"expanding",
"environment",
"variable",
"references",
"in",
"|path|",
"with",
"|env|",
"."
] | def GypPathToNinja(self, path, env=None):
"""Translate a gyp path to a ninja path, optionally expanding environment
variable references in |path| with |env|.
See the above discourse on path conversions."""
if env:
if self.flavor == "mac":
path = gyp.xcode_emulation.E... | [
"def",
"GypPathToNinja",
"(",
"self",
",",
"path",
",",
"env",
"=",
"None",
")",
":",
"if",
"env",
":",
"if",
"self",
".",
"flavor",
"==",
"\"mac\"",
":",
"path",
"=",
"gyp",
".",
"xcode_emulation",
".",
"ExpandEnvVars",
"(",
"path",
",",
"env",
")",... | https://github.com/depjs/dep/blob/cb8def92812d80b1fd8e5ffbbc1ae129a207fff6/node_modules/node-gyp/gyp/pylib/gyp/generator/ninja.py#L304-L322 | |
ipython-contrib/jupyter_contrib_nbextensions | a186b18efaa1f55fba64f08cd9d8bf85cba56d25 | src/jupyter_contrib_nbextensions/application.py | python | BaseContribNbextensionsApp._log_datefmt_default | (self) | return "%H:%M:%S" | Exclude date from timestamp. | Exclude date from timestamp. | [
"Exclude",
"date",
"from",
"timestamp",
"."
] | def _log_datefmt_default(self):
"""Exclude date from timestamp."""
return "%H:%M:%S" | [
"def",
"_log_datefmt_default",
"(",
"self",
")",
":",
"return",
"\"%H:%M:%S\""
] | https://github.com/ipython-contrib/jupyter_contrib_nbextensions/blob/a186b18efaa1f55fba64f08cd9d8bf85cba56d25/src/jupyter_contrib_nbextensions/application.py#L28-L30 | |
ivendrov/order-embedding | 2057e6056a887ea00d304fc43a8a7e4810f4d669 | utils.py | python | ortho_weight | (ndim) | return u.astype('float32') | Orthogonal weight init, for recurrent layers | Orthogonal weight init, for recurrent layers | [
"Orthogonal",
"weight",
"init",
"for",
"recurrent",
"layers"
] | def ortho_weight(ndim):
"""
Orthogonal weight init, for recurrent layers
"""
W = numpy.random.randn(ndim, ndim)
u, s, v = numpy.linalg.svd(W)
return u.astype('float32') | [
"def",
"ortho_weight",
"(",
"ndim",
")",
":",
"W",
"=",
"numpy",
".",
"random",
".",
"randn",
"(",
"ndim",
",",
"ndim",
")",
"u",
",",
"s",
",",
"v",
"=",
"numpy",
".",
"linalg",
".",
"svd",
"(",
"W",
")",
"return",
"u",
".",
"astype",
"(",
"... | https://github.com/ivendrov/order-embedding/blob/2057e6056a887ea00d304fc43a8a7e4810f4d669/utils.py#L61-L67 | |
wtx358/wtxlog | 5e0dd09309ff98b26009a9eac48b01afd344cd99 | wtxlog/main/views.py | python | upload | () | return json.dumps(result) | 文件上传函数 | 文件上传函数 | [
"文件上传函数"
] | def upload():
''' 文件上传函数 '''
result = {"err": "", "msg": {"url": "", "localfile": ""}}
fname = ''
fext = ''
data = None
if request.method == 'POST' and 'filedata' in request.files:
# 传统上传模式,IE浏览器使用这种模式
fileobj = request.files['filedata']
result["msg"]["localfile"] = fil... | [
"def",
"upload",
"(",
")",
":",
"result",
"=",
"{",
"\"err\"",
":",
"\"\"",
",",
"\"msg\"",
":",
"{",
"\"url\"",
":",
"\"\"",
",",
"\"localfile\"",
":",
"\"\"",
"}",
"}",
"fname",
"=",
"''",
"fext",
"=",
"''",
"data",
"=",
"None",
"if",
"request",
... | https://github.com/wtx358/wtxlog/blob/5e0dd09309ff98b26009a9eac48b01afd344cd99/wtxlog/main/views.py#L311-L348 | |
liftoff/GateOne | 6ae1d01f7fe21e2703bdf982df7353e7bb81a500 | termio/termio.py | python | MultiplexPOSIXIOLoop._write | (self, chars) | Writes *chars* to `self.fd` (pretty straightforward). If IOError or
OSError exceptions are encountered, will run `terminate`. All other
exceptions are logged but no action will be taken. | Writes *chars* to `self.fd` (pretty straightforward). If IOError or
OSError exceptions are encountered, will run `terminate`. All other
exceptions are logged but no action will be taken. | [
"Writes",
"*",
"chars",
"*",
"to",
"self",
".",
"fd",
"(",
"pretty",
"straightforward",
")",
".",
"If",
"IOError",
"or",
"OSError",
"exceptions",
"are",
"encountered",
"will",
"run",
"terminate",
".",
"All",
"other",
"exceptions",
"are",
"logged",
"but",
"... | def _write(self, chars):
"""
Writes *chars* to `self.fd` (pretty straightforward). If IOError or
OSError exceptions are encountered, will run `terminate`. All other
exceptions are logged but no action will be taken.
"""
#logging.debug("MultiplexPOSIXIOLoop._write(%s)" %... | [
"def",
"_write",
"(",
"self",
",",
"chars",
")",
":",
"#logging.debug(\"MultiplexPOSIXIOLoop._write(%s)\" % repr(chars))",
"try",
":",
"with",
"io",
".",
"open",
"(",
"self",
".",
"fd",
",",
"'wt'",
",",
"encoding",
"=",
"'UTF-8'",
",",
"closefd",
"=",
"False"... | https://github.com/liftoff/GateOne/blob/6ae1d01f7fe21e2703bdf982df7353e7bb81a500/termio/termio.py#L1750-L1778 | ||
replit-archive/jsrepl | 36d79b6288ca5d26208e8bade2a168c6ebcb2376 | extern/python/unclosured/lib/python2.7/mailbox.py | python | Babyl.__setitem__ | (self, key, message) | Replace the keyed message; raise KeyError if it doesn't exist. | Replace the keyed message; raise KeyError if it doesn't exist. | [
"Replace",
"the",
"keyed",
"message",
";",
"raise",
"KeyError",
"if",
"it",
"doesn",
"t",
"exist",
"."
] | def __setitem__(self, key, message):
"""Replace the keyed message; raise KeyError if it doesn't exist."""
_singlefileMailbox.__setitem__(self, key, message)
if isinstance(message, BabylMessage):
self._labels[key] = message.get_labels() | [
"def",
"__setitem__",
"(",
"self",
",",
"key",
",",
"message",
")",
":",
"_singlefileMailbox",
".",
"__setitem__",
"(",
"self",
",",
"key",
",",
"message",
")",
"if",
"isinstance",
"(",
"message",
",",
"BabylMessage",
")",
":",
"self",
".",
"_labels",
"[... | https://github.com/replit-archive/jsrepl/blob/36d79b6288ca5d26208e8bade2a168c6ebcb2376/extern/python/unclosured/lib/python2.7/mailbox.py#L1192-L1196 | ||
liftoff/GateOne | 6ae1d01f7fe21e2703bdf982df7353e7bb81a500 | termio/termio.py | python | MultiplexPOSIXIOLoop._read | (self, bytes=-1) | return result | Reads at most *bytes* from the incoming stream, writes the result to
the terminal emulator using `term_write`, and returns what was read.
If *bytes* is -1 (default) it will read `self.fd` until there's no more
output.
Returns the result of all that reading.
.. note:: Non-blocki... | Reads at most *bytes* from the incoming stream, writes the result to
the terminal emulator using `term_write`, and returns what was read.
If *bytes* is -1 (default) it will read `self.fd` until there's no more
output. | [
"Reads",
"at",
"most",
"*",
"bytes",
"*",
"from",
"the",
"incoming",
"stream",
"writes",
"the",
"result",
"to",
"the",
"terminal",
"emulator",
"using",
"term_write",
"and",
"returns",
"what",
"was",
"read",
".",
"If",
"*",
"bytes",
"*",
"is",
"-",
"1",
... | def _read(self, bytes=-1):
"""
Reads at most *bytes* from the incoming stream, writes the result to
the terminal emulator using `term_write`, and returns what was read.
If *bytes* is -1 (default) it will read `self.fd` until there's no more
output.
Returns the result of ... | [
"def",
"_read",
"(",
"self",
",",
"bytes",
"=",
"-",
"1",
")",
":",
"# Commented out because it can be really noisy. Uncomment only if you",
"# *really* need to debug this method.",
"#logging.debug(\"MultiplexPOSIXIOLoop._read()\")",
"result",
"=",
"b\"\"",
"def",
"restore_captu... | https://github.com/liftoff/GateOne/blob/6ae1d01f7fe21e2703bdf982df7353e7bb81a500/termio/termio.py#L1583-L1675 | |
romanvm/django-tinymce4-lite | eef7af8ff6e9de844e14e89b084b86c4b2ba8eba | tinymce/views.py | python | spell_check | (request) | return JsonResponse(output, status=status) | Implements the TinyMCE 4 spellchecker protocol
:param request: Django http request with JSON-RPC payload from TinyMCE 4
containing a language code and a text to check for errors.
:type request: django.http.request.HttpRequest
:return: Django http response containing JSON-RPC payload
with sp... | Implements the TinyMCE 4 spellchecker protocol | [
"Implements",
"the",
"TinyMCE",
"4",
"spellchecker",
"protocol"
] | def spell_check(request):
"""
Implements the TinyMCE 4 spellchecker protocol
:param request: Django http request with JSON-RPC payload from TinyMCE 4
containing a language code and a text to check for errors.
:type request: django.http.request.HttpRequest
:return: Django http response conta... | [
"def",
"spell_check",
"(",
"request",
")",
":",
"data",
"=",
"json",
".",
"loads",
"(",
"request",
".",
"body",
".",
"decode",
"(",
"'utf-8'",
")",
")",
"output",
"=",
"{",
"'id'",
":",
"data",
"[",
"'id'",
"]",
"}",
"error",
"=",
"None",
"status",... | https://github.com/romanvm/django-tinymce4-lite/blob/eef7af8ff6e9de844e14e89b084b86c4b2ba8eba/tinymce/views.py#L25-L59 | |
KevinFasusi/supplychainpy | 5bffccf9383045eace82ee1d21ca49e1ecdd7d22 | supplychainpy/bot/_controller.py | python | revenue_controller | (uri: str, direction: str = None, sku_id: str = None) | return tuple(result) | Retrieves SKUs which generate revenue.
Args:
uri (str): Database connection string.
direction (str): Indication of sort direction.
sku_id (str): SKU unique id.
Returns:
tuple: Result. | Retrieves SKUs which generate revenue. | [
"Retrieves",
"SKUs",
"which",
"generate",
"revenue",
"."
] | def revenue_controller(uri: str, direction: str = None, sku_id: str = None) -> tuple:
""" Retrieves SKUs which generate revenue.
Args:
uri (str): Database connection string.
direction (str): Indication of sort direction.
sku_id (str): SKU unique id.
Returns:
... | [
"def",
"revenue_controller",
"(",
"uri",
":",
"str",
",",
"direction",
":",
"str",
"=",
"None",
",",
"sku_id",
":",
"str",
"=",
"None",
")",
"->",
"tuple",
":",
"meta",
"=",
"MetaData",
"(",
")",
"connection",
"=",
"engine",
"(",
"uri",
")",
"invento... | https://github.com/KevinFasusi/supplychainpy/blob/5bffccf9383045eace82ee1d21ca49e1ecdd7d22/supplychainpy/bot/_controller.py#L157-L195 | |
fusionbox/django-widgy | e524e1c5bf14b056a4baf01298e39c0873d6130f | widgy/models/base.py | python | Content.valid_parent_of | (self, cls, obj=None) | return self.accepting_children | Given a content class, can it be _added_ as our child?
Note: this does not apply to _existing_ children (adoption) | Given a content class, can it be _added_ as our child?
Note: this does not apply to _existing_ children (adoption) | [
"Given",
"a",
"content",
"class",
"can",
"it",
"be",
"_added_",
"as",
"our",
"child?",
"Note",
":",
"this",
"does",
"not",
"apply",
"to",
"_existing_",
"children",
"(",
"adoption",
")"
] | def valid_parent_of(self, cls, obj=None):
"""
Given a content class, can it be _added_ as our child?
Note: this does not apply to _existing_ children (adoption)
"""
return self.accepting_children | [
"def",
"valid_parent_of",
"(",
"self",
",",
"cls",
",",
"obj",
"=",
"None",
")",
":",
"return",
"self",
".",
"accepting_children"
] | https://github.com/fusionbox/django-widgy/blob/e524e1c5bf14b056a4baf01298e39c0873d6130f/widgy/models/base.py#L587-L592 | |
nodejs/node | ac3c33c1646bf46104c15ae035982c06364da9b8 | tools/inspector_protocol/jinja2/idtracking.py | python | FrameSymbolVisitor.visit_Name | (self, node, store_as_param=False, **kwargs) | All assignments to names go through this function. | All assignments to names go through this function. | [
"All",
"assignments",
"to",
"names",
"go",
"through",
"this",
"function",
"."
] | def visit_Name(self, node, store_as_param=False, **kwargs):
"""All assignments to names go through this function."""
if store_as_param or node.ctx == 'param':
self.symbols.declare_parameter(node.name)
elif node.ctx == 'store':
self.symbols.store(node.name)
elif no... | [
"def",
"visit_Name",
"(",
"self",
",",
"node",
",",
"store_as_param",
"=",
"False",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"store_as_param",
"or",
"node",
".",
"ctx",
"==",
"'param'",
":",
"self",
".",
"symbols",
".",
"declare_parameter",
"(",
"node",
... | https://github.com/nodejs/node/blob/ac3c33c1646bf46104c15ae035982c06364da9b8/tools/inspector_protocol/jinja2/idtracking.py#L209-L216 | ||
microsoft/pai | b3c196f3355a265322c3804cabfcea82cbffa2db | src/job-exporter/src/collector.py | python | ContainerCollector.infer_service_name | (cls, container_name) | return None | try to infer service name from container_name, if it's container not belongs
to pai service, will return None | try to infer service name from container_name, if it's container not belongs
to pai service, will return None | [
"try",
"to",
"infer",
"service",
"name",
"from",
"container_name",
"if",
"it",
"s",
"container",
"not",
"belongs",
"to",
"pai",
"service",
"will",
"return",
"None"
] | def infer_service_name(cls, container_name):
""" try to infer service name from container_name, if it's container not belongs
to pai service, will return None """
if container_name.startswith("k8s_POD_"):
# this is empty container created by k8s for pod
return None
... | [
"def",
"infer_service_name",
"(",
"cls",
",",
"container_name",
")",
":",
"if",
"container_name",
".",
"startswith",
"(",
"\"k8s_POD_\"",
")",
":",
"# this is empty container created by k8s for pod",
"return",
"None",
"# TODO speed this up, since this is O(n^2)",
"for",
"se... | https://github.com/microsoft/pai/blob/b3c196f3355a265322c3804cabfcea82cbffa2db/src/job-exporter/src/collector.py#L649-L661 | |
xl7dev/BurpSuite | d1d4bd4981a87f2f4c0c9744ad7c476336c813da | Extender/Sqlmap/lib/core/common.py | python | paramToDict | (place, parameters=None) | return testableParameters | Split the parameters into names and values, check if these parameters
are within the testable parameters and return in a dictionary. | Split the parameters into names and values, check if these parameters
are within the testable parameters and return in a dictionary. | [
"Split",
"the",
"parameters",
"into",
"names",
"and",
"values",
"check",
"if",
"these",
"parameters",
"are",
"within",
"the",
"testable",
"parameters",
"and",
"return",
"in",
"a",
"dictionary",
"."
] | def paramToDict(place, parameters=None):
"""
Split the parameters into names and values, check if these parameters
are within the testable parameters and return in a dictionary.
"""
testableParameters = OrderedDict()
if place in conf.parameters and not parameters:
parameters = conf.par... | [
"def",
"paramToDict",
"(",
"place",
",",
"parameters",
"=",
"None",
")",
":",
"testableParameters",
"=",
"OrderedDict",
"(",
")",
"if",
"place",
"in",
"conf",
".",
"parameters",
"and",
"not",
"parameters",
":",
"parameters",
"=",
"conf",
".",
"parameters",
... | https://github.com/xl7dev/BurpSuite/blob/d1d4bd4981a87f2f4c0c9744ad7c476336c813da/Extender/Sqlmap/lib/core/common.py#L537-L632 | |
nodejs/node-chakracore | 770c8dcd1bc3e0fce2d4497b4eec3fe49d829d43 | deps/npm/node_modules/node-gyp/gyp/pylib/gyp/msvs_emulation.py | python | MsvsSettings.AdjustIncludeDirs | (self, include_dirs, config) | return [self.ConvertVSMacros(p, config=config) for p in includes] | Updates include_dirs to expand VS specific paths, and adds the system
include dirs used for platform SDK and similar. | Updates include_dirs to expand VS specific paths, and adds the system
include dirs used for platform SDK and similar. | [
"Updates",
"include_dirs",
"to",
"expand",
"VS",
"specific",
"paths",
"and",
"adds",
"the",
"system",
"include",
"dirs",
"used",
"for",
"platform",
"SDK",
"and",
"similar",
"."
] | def AdjustIncludeDirs(self, include_dirs, config):
"""Updates include_dirs to expand VS specific paths, and adds the system
include dirs used for platform SDK and similar."""
config = self._TargetConfig(config)
includes = include_dirs + self.msvs_system_include_dirs[config]
includes.extend(self._Set... | [
"def",
"AdjustIncludeDirs",
"(",
"self",
",",
"include_dirs",
",",
"config",
")",
":",
"config",
"=",
"self",
".",
"_TargetConfig",
"(",
"config",
")",
"includes",
"=",
"include_dirs",
"+",
"self",
".",
"msvs_system_include_dirs",
"[",
"config",
"]",
"includes... | https://github.com/nodejs/node-chakracore/blob/770c8dcd1bc3e0fce2d4497b4eec3fe49d829d43/deps/npm/node_modules/node-gyp/gyp/pylib/gyp/msvs_emulation.py#L332-L339 | |
Opentrons/opentrons | 466e0567065d8773a81c25cd1b5c7998e00adf2c | api/src/opentrons/hardware_control/pipette.py | python | Pipette.working_volume | (self, tip_volume: float) | The working volume is the current tip max volume | The working volume is the current tip max volume | [
"The",
"working",
"volume",
"is",
"the",
"current",
"tip",
"max",
"volume"
] | def working_volume(self, tip_volume: float):
"""The working volume is the current tip max volume"""
self._working_volume = min(self.config.max_volume, tip_volume) | [
"def",
"working_volume",
"(",
"self",
",",
"tip_volume",
":",
"float",
")",
":",
"self",
".",
"_working_volume",
"=",
"min",
"(",
"self",
".",
"config",
".",
"max_volume",
",",
"tip_volume",
")"
] | https://github.com/Opentrons/opentrons/blob/466e0567065d8773a81c25cd1b5c7998e00adf2c/api/src/opentrons/hardware_control/pipette.py#L238-L240 | ||
phith0n/Minos | 1c98fb367121df1e8b8e7a20ea7de391df583e8f | extends/torndsession/session.py | python | SessionManager.expires | (self) | return self._expires | The session object lifetime on server.
this property could not be used to cookie expires setting. | The session object lifetime on server.
this property could not be used to cookie expires setting. | [
"The",
"session",
"object",
"lifetime",
"on",
"server",
".",
"this",
"property",
"could",
"not",
"be",
"used",
"to",
"cookie",
"expires",
"setting",
"."
] | def expires(self):
"""
The session object lifetime on server.
this property could not be used to cookie expires setting.
"""
if not hasattr(self, '_expires'):
self.__init_session_object()
return self._expires | [
"def",
"expires",
"(",
"self",
")",
":",
"if",
"not",
"hasattr",
"(",
"self",
",",
"'_expires'",
")",
":",
"self",
".",
"__init_session_object",
"(",
")",
"return",
"self",
".",
"_expires"
] | https://github.com/phith0n/Minos/blob/1c98fb367121df1e8b8e7a20ea7de391df583e8f/extends/torndsession/session.py#L213-L220 | |
patrickfuller/jgraph | 7297450f26ae8cba21914668a5aaa755de8aa14d | python/notebook.py | python | draw | (data, size=(600, 400), node_size=2.0, edge_size=0.25,
default_node_color=0x5bc0de, default_edge_color=0xaaaaaa, z=100,
shader='basic', optimize=True, directed=True, display_html=True,
show_save=False) | Draws an interactive 3D visualization of the inputted graph.
Args:
data: Either an adjacency list of tuples (ie. [(1,2),...]) or object
size: (Optional) Dimensions of visualization, in pixels
node_size: (Optional) Defaults to 2.0
edge_size: (Optional) Defaults to 0.25
defaul... | Draws an interactive 3D visualization of the inputted graph. | [
"Draws",
"an",
"interactive",
"3D",
"visualization",
"of",
"the",
"inputted",
"graph",
"."
] | def draw(data, size=(600, 400), node_size=2.0, edge_size=0.25,
default_node_color=0x5bc0de, default_edge_color=0xaaaaaa, z=100,
shader='basic', optimize=True, directed=True, display_html=True,
show_save=False):
"""Draws an interactive 3D visualization of the inputted graph.
Args:
... | [
"def",
"draw",
"(",
"data",
",",
"size",
"=",
"(",
"600",
",",
"400",
")",
",",
"node_size",
"=",
"2.0",
",",
"edge_size",
"=",
"0.25",
",",
"default_node_color",
"=",
"0x5bc0de",
",",
"default_edge_color",
"=",
"0xaaaaaa",
",",
"z",
"=",
"100",
",",
... | https://github.com/patrickfuller/jgraph/blob/7297450f26ae8cba21914668a5aaa755de8aa14d/python/notebook.py#L29-L133 | ||
Nexedi/erp5 | 44df1959c0e21576cf5e9803d602d95efb4b695b | product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Base_validateRelation.py | python | checkSameKeys | (a , b) | return same | Checks if the two lists contain
the same values | Checks if the two lists contain
the same values | [
"Checks",
"if",
"the",
"two",
"lists",
"contain",
"the",
"same",
"values"
] | def checkSameKeys(a , b):
"""
Checks if the two lists contain
the same values
"""
same = 1
for ka in a:
if not ka in b:
same = 0
for kb in b:
if not kb in a:
same = 0
return same | [
"def",
"checkSameKeys",
"(",
"a",
",",
"b",
")",
":",
"same",
"=",
"1",
"for",
"ka",
"in",
"a",
":",
"if",
"not",
"ka",
"in",
"b",
":",
"same",
"=",
"0",
"for",
"kb",
"in",
"b",
":",
"if",
"not",
"kb",
"in",
"a",
":",
"same",
"=",
"0",
"r... | https://github.com/Nexedi/erp5/blob/44df1959c0e21576cf5e9803d602d95efb4b695b/product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Base_validateRelation.py#L25-L37 | |
replit-archive/jsrepl | 36d79b6288ca5d26208e8bade2a168c6ebcb2376 | extern/python/reloop-closured/lib/python2.7/compiler/visitor.py | python | ASTVisitor.preorder | (self, tree, visitor, *args) | Do preorder walk of tree using visitor | Do preorder walk of tree using visitor | [
"Do",
"preorder",
"walk",
"of",
"tree",
"using",
"visitor"
] | def preorder(self, tree, visitor, *args):
"""Do preorder walk of tree using visitor"""
self.visitor = visitor
visitor.visit = self.dispatch
self.dispatch(tree, *args) | [
"def",
"preorder",
"(",
"self",
",",
"tree",
",",
"visitor",
",",
"*",
"args",
")",
":",
"self",
".",
"visitor",
"=",
"visitor",
"visitor",
".",
"visit",
"=",
"self",
".",
"dispatch",
"self",
".",
"dispatch",
"(",
"tree",
",",
"*",
"args",
")"
] | https://github.com/replit-archive/jsrepl/blob/36d79b6288ca5d26208e8bade2a168c6ebcb2376/extern/python/reloop-closured/lib/python2.7/compiler/visitor.py#L59-L63 | ||
enkimute/ganja.js | db26a33e34190f1578881a34f4e5bd467907ba87 | codegen/python/mink.py | python | MINK.Involute | (a) | return MINK.fromarray(res) | MINK.Involute
Main involution | MINK.Involute
Main involution | [
"MINK",
".",
"Involute",
"Main",
"involution"
] | def Involute(a):
"""MINK.Involute
Main involution
"""
res = a.mvec.copy()
res[0]=a[0]
res[1]=-a[1]
res[2]=-a[2]
res[3]=a[3]
return MINK.fromarray(res) | [
"def",
"Involute",
"(",
"a",
")",
":",
"res",
"=",
"a",
".",
"mvec",
".",
"copy",
"(",
")",
"res",
"[",
"0",
"]",
"=",
"a",
"[",
"0",
"]",
"res",
"[",
"1",
"]",
"=",
"-",
"a",
"[",
"1",
"]",
"res",
"[",
"2",
"]",
"=",
"-",
"a",
"[",
... | https://github.com/enkimute/ganja.js/blob/db26a33e34190f1578881a34f4e5bd467907ba87/codegen/python/mink.py#L95-L105 | |
nodejs/node-convergence-archive | e11fe0c2777561827cdb7207d46b0917ef3c42a7 | deps/npm/node_modules/node-gyp/gyp/pylib/gyp/ordered_dict.py | python | OrderedDict.setdefault | (self, key, default=None) | return default | od.setdefault(k[,d]) -> od.get(k,d), also set od[k]=d if k not in od | od.setdefault(k[,d]) -> od.get(k,d), also set od[k]=d if k not in od | [
"od",
".",
"setdefault",
"(",
"k",
"[",
"d",
"]",
")",
"-",
">",
"od",
".",
"get",
"(",
"k",
"d",
")",
"also",
"set",
"od",
"[",
"k",
"]",
"=",
"d",
"if",
"k",
"not",
"in",
"od"
] | def setdefault(self, key, default=None):
'od.setdefault(k[,d]) -> od.get(k,d), also set od[k]=d if k not in od'
if key in self:
return self[key]
self[key] = default
return default | [
"def",
"setdefault",
"(",
"self",
",",
"key",
",",
"default",
"=",
"None",
")",
":",
"if",
"key",
"in",
"self",
":",
"return",
"self",
"[",
"key",
"]",
"self",
"[",
"key",
"]",
"=",
"default",
"return",
"default"
] | https://github.com/nodejs/node-convergence-archive/blob/e11fe0c2777561827cdb7207d46b0917ef3c42a7/deps/npm/node_modules/node-gyp/gyp/pylib/gyp/ordered_dict.py#L219-L224 | |
facebookarchive/nuclide | 2a2a0a642d136768b7d2a6d35a652dc5fb77d70a | modules/atom-ide-debugger-python/VendorLib/vs-py-debugger/pythonFiles/experimental/ptvsd/ptvsd/_vendored/pydevd/third_party/pep8/lib2to3/lib2to3/fixer_util.py | python | find_root | (node) | return node | Find the top level namespace. | Find the top level namespace. | [
"Find",
"the",
"top",
"level",
"namespace",
"."
] | def find_root(node):
"""Find the top level namespace."""
# Scamper up to the top level namespace
while node.type != syms.file_input:
node = node.parent
if not node:
raise ValueError("root found before file_input node was found.")
return node | [
"def",
"find_root",
"(",
"node",
")",
":",
"# Scamper up to the top level namespace",
"while",
"node",
".",
"type",
"!=",
"syms",
".",
"file_input",
":",
"node",
"=",
"node",
".",
"parent",
"if",
"not",
"node",
":",
"raise",
"ValueError",
"(",
"\"root found be... | https://github.com/facebookarchive/nuclide/blob/2a2a0a642d136768b7d2a6d35a652dc5fb77d70a/modules/atom-ide-debugger-python/VendorLib/vs-py-debugger/pythonFiles/experimental/ptvsd/ptvsd/_vendored/pydevd/third_party/pep8/lib2to3/lib2to3/fixer_util.py#L273-L280 | |
opentraveldata/geobases | e9ef3708155cb320684aa710a11d5a228a7d80c0 | GeoBaseMain.py | python | scan_coords | (u_input, geob, verbose) | This function tries to interpret the main
argument as either coordinates (lat, lng) or
a key like ORY. | This function tries to interpret the main
argument as either coordinates (lat, lng) or
a key like ORY. | [
"This",
"function",
"tries",
"to",
"interpret",
"the",
"main",
"argument",
"as",
"either",
"coordinates",
"(",
"lat",
"lng",
")",
"or",
"a",
"key",
"like",
"ORY",
"."
] | def scan_coords(u_input, geob, verbose):
"""
This function tries to interpret the main
argument as either coordinates (lat, lng) or
a key like ORY.
"""
# First we try input a direct key
if u_input in geob:
coords = geob.getLocation(u_input)
if coords is None:
err... | [
"def",
"scan_coords",
"(",
"u_input",
",",
"geob",
",",
"verbose",
")",
":",
"# First we try input a direct key",
"if",
"u_input",
"in",
"geob",
":",
"coords",
"=",
"geob",
".",
"getLocation",
"(",
"u_input",
")",
"if",
"coords",
"is",
"None",
":",
"error",
... | https://github.com/opentraveldata/geobases/blob/e9ef3708155cb320684aa710a11d5a228a7d80c0/GeoBaseMain.py#L583-L626 | ||
harvard-lil/perma | c54ff21b3eee931f5094a7654fdddc9ad90fc29c | perma_web/fabfile/dev.py | python | read_playback_tests | (*filepaths) | Aggregate files from the test_playbacks() task and report count for each type of error. | Aggregate files from the test_playbacks() task and report count for each type of error. | [
"Aggregate",
"files",
"from",
"the",
"test_playbacks",
"()",
"task",
"and",
"report",
"count",
"for",
"each",
"type",
"of",
"error",
"."
] | def read_playback_tests(*filepaths):
"""
Aggregate files from the test_playbacks() task and report count for each type of error.
"""
from collections import defaultdict
errs = defaultdict(list)
prefixes = [
"'ascii' codec can't encode character",
"No Captures found for:",
... | [
"def",
"read_playback_tests",
"(",
"*",
"filepaths",
")",
":",
"from",
"collections",
"import",
"defaultdict",
"errs",
"=",
"defaultdict",
"(",
"list",
")",
"prefixes",
"=",
"[",
"\"'ascii' codec can't encode character\"",
",",
"\"No Captures found for:\"",
",",
"\"'a... | https://github.com/harvard-lil/perma/blob/c54ff21b3eee931f5094a7654fdddc9ad90fc29c/perma_web/fabfile/dev.py#L469-L501 | ||
Southpaw-TACTIC/TACTIC | ba9b87aef0ee3b3ea51446f25b285ebbca06f62c | src/tactic/ui/cgapp/checkin_wdg.py | python | AssetCheckinWdg.get_checkin | (self) | return widget | the button which initiates the checkin | the button which initiates the checkin | [
"the",
"button",
"which",
"initiates",
"the",
"checkin"
] | def get_checkin(self):
'''the button which initiates the checkin'''
# create the button with the javascript function
widget = Widget()
#button = TextBtnWdg(label=self.PUBLISH_BUTTON, size='large', width='100', side_padding='20', vert_offset='-5')
button = ActionButtonWdg(title=se... | [
"def",
"get_checkin",
"(",
"self",
")",
":",
"# create the button with the javascript function",
"widget",
"=",
"Widget",
"(",
")",
"#button = TextBtnWdg(label=self.PUBLISH_BUTTON, size='large', width='100', side_padding='20', vert_offset='-5')",
"button",
"=",
"ActionButtonWdg",
"("... | https://github.com/Southpaw-TACTIC/TACTIC/blob/ba9b87aef0ee3b3ea51446f25b285ebbca06f62c/src/tactic/ui/cgapp/checkin_wdg.py#L909-L935 | |
korolr/dotfiles | 8e46933503ecb8d8651739ffeb1d2d4f0f5c6524 | .config/sublime-text-3/Backup/20170602095117/mdpopups/st3/mdpopups/__init__.py | python | scope2style | (view, scope, selected=False, explicit_background=False) | return style | Convert the scope to a style. | Convert the scope to a style. | [
"Convert",
"the",
"scope",
"to",
"a",
"style",
"."
] | def scope2style(view, scope, selected=False, explicit_background=False):
"""Convert the scope to a style."""
style = {
'color': None,
'background': None,
'style': ''
}
obj = _get_scheme(view)[0]
style_obj = obj.guess_style(scope, selected, explicit_background)
style['col... | [
"def",
"scope2style",
"(",
"view",
",",
"scope",
",",
"selected",
"=",
"False",
",",
"explicit_background",
"=",
"False",
")",
":",
"style",
"=",
"{",
"'color'",
":",
"None",
",",
"'background'",
":",
"None",
",",
"'style'",
":",
"''",
"}",
"obj",
"=",... | https://github.com/korolr/dotfiles/blob/8e46933503ecb8d8651739ffeb1d2d4f0f5c6524/.config/sublime-text-3/Backup/20170602095117/mdpopups/st3/mdpopups/__init__.py#L493-L506 | |
atom-community/ide-python | c046f9c2421713b34baa22648235541c5bb284fe | dist/debugger/VendorLib/vs-py-debugger/pythonFiles/experimental/ptvsd/ptvsd/_vendored/pydevd/third_party/pep8/lib2to3/lib2to3/pytree.py | python | LeafPattern.__init__ | (self, type=None, content=None, name=None) | Initializer. Takes optional type, content, and name.
The type, if given must be a token type (< 256). If not given,
this matches any *leaf* node; the content may still be required.
The content, if given, must be a string.
If a name is given, the matching node is stored in the result... | Initializer. Takes optional type, content, and name. | [
"Initializer",
".",
"Takes",
"optional",
"type",
"content",
"and",
"name",
"."
] | def __init__(self, type=None, content=None, name=None):
"""
Initializer. Takes optional type, content, and name.
The type, if given must be a token type (< 256). If not given,
this matches any *leaf* node; the content may still be required.
The content, if given, must be a st... | [
"def",
"__init__",
"(",
"self",
",",
"type",
"=",
"None",
",",
"content",
"=",
"None",
",",
"name",
"=",
"None",
")",
":",
"if",
"type",
"is",
"not",
"None",
":",
"assert",
"0",
"<=",
"type",
"<",
"256",
",",
"type",
"if",
"content",
"is",
"not",... | https://github.com/atom-community/ide-python/blob/c046f9c2421713b34baa22648235541c5bb284fe/dist/debugger/VendorLib/vs-py-debugger/pythonFiles/experimental/ptvsd/ptvsd/_vendored/pydevd/third_party/pep8/lib2to3/lib2to3/pytree.py#L536-L554 | ||
nodejs/node-chakracore | 770c8dcd1bc3e0fce2d4497b4eec3fe49d829d43 | deps/npm/node_modules/node-gyp/gyp/pylib/gyp/ordered_dict.py | python | OrderedDict.viewvalues | (self) | return ValuesView(self) | od.viewvalues() -> an object providing a view on od's values | od.viewvalues() -> an object providing a view on od's values | [
"od",
".",
"viewvalues",
"()",
"-",
">",
"an",
"object",
"providing",
"a",
"view",
"on",
"od",
"s",
"values"
] | def viewvalues(self):
"od.viewvalues() -> an object providing a view on od's values"
return ValuesView(self) | [
"def",
"viewvalues",
"(",
"self",
")",
":",
"return",
"ValuesView",
"(",
"self",
")"
] | https://github.com/nodejs/node-chakracore/blob/770c8dcd1bc3e0fce2d4497b4eec3fe49d829d43/deps/npm/node_modules/node-gyp/gyp/pylib/gyp/ordered_dict.py#L282-L284 | |
xl7dev/BurpSuite | d1d4bd4981a87f2f4c0c9744ad7c476336c813da | Extender/PT-Manager/XlsxWriter-0.7.3/xlsxwriter/chartsheet.py | python | Chartsheet.protect | (self, password='', options=None) | Set the password and protection options of the worksheet.
Args:
password: An optional password string.
options: A dictionary of worksheet objects to protect.
Returns:
Nothing. | Set the password and protection options of the worksheet. | [
"Set",
"the",
"password",
"and",
"protection",
"options",
"of",
"the",
"worksheet",
"."
] | def protect(self, password='', options=None):
"""
Set the password and protection options of the worksheet.
Args:
password: An optional password string.
options: A dictionary of worksheet objects to protect.
Returns:
Nothing.
"""
# ... | [
"def",
"protect",
"(",
"self",
",",
"password",
"=",
"''",
",",
"options",
"=",
"None",
")",
":",
"# Overridden from parent worksheet class.",
"if",
"self",
".",
"chart",
":",
"self",
".",
"chart",
".",
"protection",
"=",
"True",
"else",
":",
"self",
".",
... | https://github.com/xl7dev/BurpSuite/blob/d1d4bd4981a87f2f4c0c9744ad7c476336c813da/Extender/PT-Manager/XlsxWriter-0.7.3/xlsxwriter/chartsheet.py#L55-L83 | ||
defunctzombie/libuv.js | 04a76a470dfdcad14ea8f19b6f215f205a9214f8 | tools/gyp/pylib/gyp/generator/msvs.py | python | _GenerateMSBuildRulePropsFile | (props_path, msbuild_rules) | Generate the .props file. | Generate the .props file. | [
"Generate",
"the",
".",
"props",
"file",
"."
] | def _GenerateMSBuildRulePropsFile(props_path, msbuild_rules):
"""Generate the .props file."""
content = ['Project',
{'xmlns': 'http://schemas.microsoft.com/developer/msbuild/2003'}]
for rule in msbuild_rules:
content.extend([
['PropertyGroup',
{'Condition': "'$(%s)' == '' and '$(... | [
"def",
"_GenerateMSBuildRulePropsFile",
"(",
"props_path",
",",
"msbuild_rules",
")",
":",
"content",
"=",
"[",
"'Project'",
",",
"{",
"'xmlns'",
":",
"'http://schemas.microsoft.com/developer/msbuild/2003'",
"}",
"]",
"for",
"rule",
"in",
"msbuild_rules",
":",
"conten... | https://github.com/defunctzombie/libuv.js/blob/04a76a470dfdcad14ea8f19b6f215f205a9214f8/tools/gyp/pylib/gyp/generator/msvs.py#L2115-L2144 | ||
googlearchive/ChromeWebLab | 60f964b3f283c15704b7a04b7bb50cb15791e2e4 | Sketchbots/sw/labqueue/lask/core/model.py | python | LabDataContainer.__get_new | (cls, *args, **kwargs) | return LabDataContainer(
random_block=random.random(),
**kwargs
) | This is a convenience method for constructing a new LabDataContainer which
has a random block assigned. | This is a convenience method for constructing a new LabDataContainer which
has a random block assigned. | [
"This",
"is",
"a",
"convenience",
"method",
"for",
"constructing",
"a",
"new",
"LabDataContainer",
"which",
"has",
"a",
"random",
"block",
"assigned",
"."
] | def __get_new(cls, *args, **kwargs):
"""This is a convenience method for constructing a new LabDataContainer which
has a random block assigned.
"""
# all new objects use the latest version of the model
kwargs['model_version_used'] = LabDataContainer.LATEST_MODEL_VERSION
... | [
"def",
"__get_new",
"(",
"cls",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"# all new objects use the latest version of the model",
"kwargs",
"[",
"'model_version_used'",
"]",
"=",
"LabDataContainer",
".",
"LATEST_MODEL_VERSION",
"if",
"'random_block'",
"in"... | https://github.com/googlearchive/ChromeWebLab/blob/60f964b3f283c15704b7a04b7bb50cb15791e2e4/Sketchbots/sw/labqueue/lask/core/model.py#L2478-L2490 | |
jxcore/jxcore | b05f1f2d2c9d62c813c7d84f3013dbbf30b6e410 | tools/gyp/pylib/gyp/generator/msvs.py | python | _GetMSVSConfigurationType | (spec, build_file) | return config_type | Returns the configuration type for this project.
It's a number defined by Microsoft. May raise an exception.
Args:
spec: The target dictionary containing the properties of the target.
build_file: The path of the gyp file.
Returns:
An integer, the configuration type. | Returns the configuration type for this project. | [
"Returns",
"the",
"configuration",
"type",
"for",
"this",
"project",
"."
] | def _GetMSVSConfigurationType(spec, build_file):
"""Returns the configuration type for this project.
It's a number defined by Microsoft. May raise an exception.
Args:
spec: The target dictionary containing the properties of the target.
build_file: The path of the gyp file.
Returns:
An integ... | [
"def",
"_GetMSVSConfigurationType",
"(",
"spec",
",",
"build_file",
")",
":",
"try",
":",
"config_type",
"=",
"{",
"'executable'",
":",
"'1'",
",",
"# .exe",
"'shared_library'",
":",
"'2'",
",",
"# .dll",
"'loadable_module'",
":",
"'2'",
",",
"# .dll",
"'stati... | https://github.com/jxcore/jxcore/blob/b05f1f2d2c9d62c813c7d84f3013dbbf30b6e410/tools/gyp/pylib/gyp/generator/msvs.py#L1058-L1085 | |
pinterest/pinball | c54a206cf6e3dbadb056c189f741d75828c02f98 | pinball/persistence/store.py | python | Store.initialize | (self) | return | Initialize the token store. | Initialize the token store. | [
"Initialize",
"the",
"token",
"store",
"."
] | def initialize(self):
"""Initialize the token store."""
return | [
"def",
"initialize",
"(",
"self",
")",
":",
"return"
] | https://github.com/pinterest/pinball/blob/c54a206cf6e3dbadb056c189f741d75828c02f98/pinball/persistence/store.py#L66-L68 | |
Southpaw-TACTIC/TACTIC | ba9b87aef0ee3b3ea51446f25b285ebbca06f62c | src/pyasm/web/html_wdg.py | python | HtmlElement.set_attribute | (self, name, value) | Set an attribute of the html element | Set an attribute of the html element | [
"Set",
"an",
"attribute",
"of",
"the",
"html",
"element"
] | def set_attribute(self, name, value):
'''Set an attribute of the html element'''
self.set_attr(name, value) | [
"def",
"set_attribute",
"(",
"self",
",",
"name",
",",
"value",
")",
":",
"self",
".",
"set_attr",
"(",
"name",
",",
"value",
")"
] | https://github.com/Southpaw-TACTIC/TACTIC/blob/ba9b87aef0ee3b3ea51446f25b285ebbca06f62c/src/pyasm/web/html_wdg.py#L207-L209 | ||
ayojs/ayo | 45a1c8cf6384f5bcc81d834343c3ed9d78b97df3 | tools/gyp/pylib/gyp/generator/msvs.py | python | _GetMSBuildPropertyGroup | (spec, label, properties) | return [group] | Returns a PropertyGroup definition for the specified properties.
Arguments:
spec: The target project dict.
label: An optional label for the PropertyGroup.
properties: The dictionary to be converted. The key is the name of the
property. The value is itself a dictionary; its key is the value and
... | Returns a PropertyGroup definition for the specified properties. | [
"Returns",
"a",
"PropertyGroup",
"definition",
"for",
"the",
"specified",
"properties",
"."
] | def _GetMSBuildPropertyGroup(spec, label, properties):
"""Returns a PropertyGroup definition for the specified properties.
Arguments:
spec: The target project dict.
label: An optional label for the PropertyGroup.
properties: The dictionary to be converted. The key is the name of the
property. ... | [
"def",
"_GetMSBuildPropertyGroup",
"(",
"spec",
",",
"label",
",",
"properties",
")",
":",
"group",
"=",
"[",
"'PropertyGroup'",
"]",
"if",
"label",
":",
"group",
".",
"append",
"(",
"{",
"'Label'",
":",
"label",
"}",
")",
"num_configurations",
"=",
"len",... | https://github.com/ayojs/ayo/blob/45a1c8cf6384f5bcc81d834343c3ed9d78b97df3/tools/gyp/pylib/gyp/generator/msvs.py#L2985-L3032 | |
nodejs/quic | 5baab3f3a05548d3b51bea98868412b08766e34d | tools/inspector_protocol/jinja2/environment.py | python | Template.from_module_dict | (cls, environment, module_dict, globals) | return cls._from_namespace(environment, module_dict, globals) | Creates a template object from a module. This is used by the
module loader to create a template object.
.. versionadded:: 2.4 | Creates a template object from a module. This is used by the
module loader to create a template object. | [
"Creates",
"a",
"template",
"object",
"from",
"a",
"module",
".",
"This",
"is",
"used",
"by",
"the",
"module",
"loader",
"to",
"create",
"a",
"template",
"object",
"."
] | def from_module_dict(cls, environment, module_dict, globals):
"""Creates a template object from a module. This is used by the
module loader to create a template object.
.. versionadded:: 2.4
"""
return cls._from_namespace(environment, module_dict, globals) | [
"def",
"from_module_dict",
"(",
"cls",
",",
"environment",
",",
"module_dict",
",",
"globals",
")",
":",
"return",
"cls",
".",
"_from_namespace",
"(",
"environment",
",",
"module_dict",
",",
"globals",
")"
] | https://github.com/nodejs/quic/blob/5baab3f3a05548d3b51bea98868412b08766e34d/tools/inspector_protocol/jinja2/environment.py#L962-L968 | |
xtk/X | 04c1aa856664a8517d23aefd94c470d47130aead | lib/selenium/selenium/webdriver/support/select.py | python | Select.deselect_all | (self) | Clear all selected entries. This is only valid when the SELECT supports multiple selections.
throws NotImplementedError If the SELECT does not support multiple selections | Clear all selected entries. This is only valid when the SELECT supports multiple selections.
throws NotImplementedError If the SELECT does not support multiple selections | [
"Clear",
"all",
"selected",
"entries",
".",
"This",
"is",
"only",
"valid",
"when",
"the",
"SELECT",
"supports",
"multiple",
"selections",
".",
"throws",
"NotImplementedError",
"If",
"the",
"SELECT",
"does",
"not",
"support",
"multiple",
"selections"
] | def deselect_all(self):
"""Clear all selected entries. This is only valid when the SELECT supports multiple selections.
throws NotImplementedError If the SELECT does not support multiple selections
"""
if not self.is_multiple:
raise NotImplementedError("You may only desele... | [
"def",
"deselect_all",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"is_multiple",
":",
"raise",
"NotImplementedError",
"(",
"\"You may only deselect all options of a multi-select\"",
")",
"for",
"opt",
"in",
"self",
".",
"options",
":",
"self",
".",
"_unsetSe... | https://github.com/xtk/X/blob/04c1aa856664a8517d23aefd94c470d47130aead/lib/selenium/selenium/webdriver/support/select.py#L138-L145 | ||
ayojs/ayo | 45a1c8cf6384f5bcc81d834343c3ed9d78b97df3 | tools/gyp/pylib/gyp/MSVSProject.py | python | Writer.__init__ | (self, project_path, version, name, guid=None, platforms=None) | Initializes the project.
Args:
project_path: Path to the project file.
version: Format version to emit.
name: Name of the project.
guid: GUID to use for project, if not None.
platforms: Array of string, the supported platforms. If null, ['Win32'] | Initializes the project. | [
"Initializes",
"the",
"project",
"."
] | def __init__(self, project_path, version, name, guid=None, platforms=None):
"""Initializes the project.
Args:
project_path: Path to the project file.
version: Format version to emit.
name: Name of the project.
guid: GUID to use for project, if not None.
platforms: Array of string,... | [
"def",
"__init__",
"(",
"self",
",",
"project_path",
",",
"version",
",",
"name",
",",
"guid",
"=",
"None",
",",
"platforms",
"=",
"None",
")",
":",
"self",
".",
"project_path",
"=",
"project_path",
"self",
".",
"version",
"=",
"version",
"self",
".",
... | https://github.com/ayojs/ayo/blob/45a1c8cf6384f5bcc81d834343c3ed9d78b97df3/tools/gyp/pylib/gyp/MSVSProject.py#L54-L82 | ||
jeff1evesque/machine-learning | 4c54e36f8ebf6a0b481c8aca71a6b3b4010dd4ff | brain/session/base.py | python | Base.validate_premodel_settings | (self) | This method validates the provided settings (not the dataset), that
describe the session. | [] | def validate_premodel_settings(self):
'''
This method validates the provided settings (not the dataset), that
describe the session.
'''
settings = self.premodel_data['properties']
error = Validator().validate_settings(
self.premodel_data['properties'],
... | [
"def",
"validate_premodel_settings",
"(",
"self",
")",
":",
"settings",
"=",
"self",
".",
"premodel_data",
"[",
"'properties'",
"]",
"error",
"=",
"Validator",
"(",
")",
".",
"validate_settings",
"(",
"self",
".",
"premodel_data",
"[",
"'properties'",
"]",
","... | https://github.com/jeff1evesque/machine-learning/blob/4c54e36f8ebf6a0b481c8aca71a6b3b4010dd4ff/brain/session/base.py#L58-L110 | |||
Southpaw-TACTIC/TACTIC | ba9b87aef0ee3b3ea51446f25b285ebbca06f62c | 3rd_party/python2/site-packages/cherrypy/process/plugins.py | python | Monitor.graceful | (self) | Stop the callback's background task thread and restart it. | Stop the callback's background task thread and restart it. | [
"Stop",
"the",
"callback",
"s",
"background",
"task",
"thread",
"and",
"restart",
"it",
"."
] | def graceful(self):
"""Stop the callback's background task thread and restart it."""
self.stop()
self.start() | [
"def",
"graceful",
"(",
"self",
")",
":",
"self",
".",
"stop",
"(",
")",
"self",
".",
"start",
"(",
")"
] | https://github.com/Southpaw-TACTIC/TACTIC/blob/ba9b87aef0ee3b3ea51446f25b285ebbca06f62c/3rd_party/python2/site-packages/cherrypy/process/plugins.py#L578-L581 | ||
sherpa-ai/sherpa | ff6466e99717983f9f394ba72b63f17343e32bdc | sherpa/core.py | python | _Runner.update_results | (self) | Get rows from database and check if anything new needs to be added to
the results-table. | Get rows from database and check if anything new needs to be added to
the results-table. | [
"Get",
"rows",
"from",
"database",
"and",
"check",
"if",
"anything",
"new",
"needs",
"to",
"be",
"added",
"to",
"the",
"results",
"-",
"table",
"."
] | def update_results(self):
"""
Get rows from database and check if anything new needs to be added to
the results-table.
"""
results = self.database.get_new_results()
if results != [] and self._all_trials == {}:
logger.warning(results)
raise ValueErr... | [
"def",
"update_results",
"(",
"self",
")",
":",
"results",
"=",
"self",
".",
"database",
".",
"get_new_results",
"(",
")",
"if",
"results",
"!=",
"[",
"]",
"and",
"self",
".",
"_all_trials",
"==",
"{",
"}",
":",
"logger",
".",
"warning",
"(",
"results"... | https://github.com/sherpa-ai/sherpa/blob/ff6466e99717983f9f394ba72b63f17343e32bdc/sherpa/core.py#L454-L491 | ||
tuan3w/visual_search | 62665d4ac58669bad8e7f5ffed18d2914ffa8b01 | visual_search/lib/datasets/coco.py | python | coco._load_image_set_index | (self) | return image_ids | Load image ids. | Load image ids. | [
"Load",
"image",
"ids",
"."
] | def _load_image_set_index(self):
"""
Load image ids.
"""
image_ids = self._COCO.getImgIds()
return image_ids | [
"def",
"_load_image_set_index",
"(",
"self",
")",
":",
"image_ids",
"=",
"self",
".",
"_COCO",
".",
"getImgIds",
"(",
")",
"return",
"image_ids"
] | https://github.com/tuan3w/visual_search/blob/62665d4ac58669bad8e7f5ffed18d2914ffa8b01/visual_search/lib/datasets/coco.py#L92-L97 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.