nwo stringlengths 5 106 | sha stringlengths 40 40 | path stringlengths 4 174 | language stringclasses 1
value | identifier stringlengths 1 140 | parameters stringlengths 0 87.7k | argument_list stringclasses 1
value | return_statement stringlengths 0 426k | docstring stringlengths 0 64.3k | docstring_summary stringlengths 0 26.3k | docstring_tokens list | function stringlengths 18 4.83M | function_tokens list | url stringlengths 83 304 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
openstack/neutron | fb229fb527ac8b95526412f7762d90826ac41428 | neutron/api/rpc/agentnotifiers/utils.py | python | retry | (func, max_attempts) | return _call_with_retry(max_attempts)(func) | Adds the retry logic to original function and returns a partial.
The returned partial can be called with the same arguments as the original
function. | Adds the retry logic to original function and returns a partial. | [
"Adds",
"the",
"retry",
"logic",
"to",
"original",
"function",
"and",
"returns",
"a",
"partial",
"."
] | def retry(func, max_attempts):
"""Adds the retry logic to original function and returns a partial.
The returned partial can be called with the same arguments as the original
function.
"""
return _call_with_retry(max_attempts)(func) | [
"def",
"retry",
"(",
"func",
",",
"max_attempts",
")",
":",
"return",
"_call_with_retry",
"(",
"max_attempts",
")",
"(",
"func",
")"
] | https://github.com/openstack/neutron/blob/fb229fb527ac8b95526412f7762d90826ac41428/neutron/api/rpc/agentnotifiers/utils.py#L54-L60 | |
kbandla/ImmunityDebugger | 2abc03fb15c8f3ed0914e1175c4d8933977c73e3 | 1.74/PyCommands/mike.py | python | packet_analyzer.extended_packet_sniff | (self, regs) | This is for the WSA* family of socket functions where we have to
do more pointer manipulation and there's a bit more work involved
in getting the packets. | This is for the WSA* family of socket functions where we have to
do more pointer manipulation and there's a bit more work involved
in getting the packets. | [
"This",
"is",
"for",
"the",
"WSA",
"*",
"family",
"of",
"socket",
"functions",
"where",
"we",
"have",
"to",
"do",
"more",
"pointer",
"manipulation",
"and",
"there",
"s",
"a",
"bit",
"more",
"work",
"involved",
"in",
"getting",
"the",
"packets",
"."
] | def extended_packet_sniff(self, regs):
'''
This is for the WSA* family of socket functions where we have to
do more pointer manipulation and there's a bit more work involved
in getting the packets.
'''
(payload_ptr, recv_ptr, type, function_name) = self.imm.getKnowledge... | [
"def",
"extended_packet_sniff",
"(",
"self",
",",
"regs",
")",
":",
"(",
"payload_ptr",
",",
"recv_ptr",
",",
"type",
",",
"function_name",
")",
"=",
"self",
".",
"imm",
".",
"getKnowledge",
"(",
"\"%08x\"",
"%",
"regs",
"[",
"'EIP'",
"]",
")",
"# This i... | https://github.com/kbandla/ImmunityDebugger/blob/2abc03fb15c8f3ed0914e1175c4d8933977c73e3/1.74/PyCommands/mike.py#L499-L556 | ||
log2timeline/dfvfs | 4ca7bf06b15cdc000297a7122a065f0ca71de544 | dfvfs/file_io/tsk_partition_file_io.py | python | TSKPartitionFile._Open | (self, mode='rb') | Opens the file-like object defined by path specification.
Args:
mode (Optional[str]): file access mode.
Raises:
AccessError: if the access to open the file was denied.
IOError: if the file-like object could not be opened.
OSError: if the file-like object could not be opened.
Path... | Opens the file-like object defined by path specification. | [
"Opens",
"the",
"file",
"-",
"like",
"object",
"defined",
"by",
"path",
"specification",
"."
] | def _Open(self, mode='rb'):
"""Opens the file-like object defined by path specification.
Args:
mode (Optional[str]): file access mode.
Raises:
AccessError: if the access to open the file was denied.
IOError: if the file-like object could not be opened.
OSError: if the file-like obj... | [
"def",
"_Open",
"(",
"self",
",",
"mode",
"=",
"'rb'",
")",
":",
"if",
"not",
"self",
".",
"_path_spec",
".",
"HasParent",
"(",
")",
":",
"raise",
"errors",
".",
"PathSpecError",
"(",
"'Unsupported path specification without parent.'",
")",
"self",
".",
"_fi... | https://github.com/log2timeline/dfvfs/blob/4ca7bf06b15cdc000297a7122a065f0ca71de544/dfvfs/file_io/tsk_partition_file_io.py#L27-L68 | ||
gentoo/portage | e5be73709b1a42b40380fd336f9381452b01a723 | lib/portage/util/_dyn_libs/LinkageMapELF.py | python | LinkageMapELF.listBrokenBinaries | (self, debug=False) | return rValue | Find binaries and their needed sonames, which have no providers.
@param debug: Boolean to enable debug output
@type debug: Boolean
@rtype: dict (example: {'/usr/bin/foo': set(['libbar.so'])})
@return: The return value is an object -> set-of-sonames mapping, where
object ... | Find binaries and their needed sonames, which have no providers. | [
"Find",
"binaries",
"and",
"their",
"needed",
"sonames",
"which",
"have",
"no",
"providers",
"."
] | def listBrokenBinaries(self, debug=False):
"""
Find binaries and their needed sonames, which have no providers.
@param debug: Boolean to enable debug output
@type debug: Boolean
@rtype: dict (example: {'/usr/bin/foo': set(['libbar.so'])})
@return: The return value is an ... | [
"def",
"listBrokenBinaries",
"(",
"self",
",",
"debug",
"=",
"False",
")",
":",
"os",
"=",
"_os_merge",
"class",
"_LibraryCache",
":",
"\"\"\"\n Caches properties associated with paths.\n\n The purpose of this class is to prevent multiple instances of\n ... | https://github.com/gentoo/portage/blob/e5be73709b1a42b40380fd336f9381452b01a723/lib/portage/util/_dyn_libs/LinkageMapELF.py#L505-L677 | |
SickChill/SickChill | 01020f3636d01535f60b83464d8127ea0efabfc7 | sickchill/oldbeard/scene_exceptions.py | python | get_scene_exception_by_name_multiple | (show_name) | return [(None, None)] | Given a show name, return the indexerid of the exception, None if no exception
is present. | Given a show name, return the indexerid of the exception, None if no exception
is present. | [
"Given",
"a",
"show",
"name",
"return",
"the",
"indexerid",
"of",
"the",
"exception",
"None",
"if",
"no",
"exception",
"is",
"present",
"."
] | def get_scene_exception_by_name_multiple(show_name):
"""
Given a show name, return the indexerid of the exception, None if no exception
is present.
"""
# try the obvious case first
cache_db_con = db.DBConnection("cache.db")
exception_result = cache_db_con.select("SELECT indexer_id, season F... | [
"def",
"get_scene_exception_by_name_multiple",
"(",
"show_name",
")",
":",
"# try the obvious case first",
"cache_db_con",
"=",
"db",
".",
"DBConnection",
"(",
"\"cache.db\"",
")",
"exception_result",
"=",
"cache_db_con",
".",
"select",
"(",
"\"SELECT indexer_id, season FRO... | https://github.com/SickChill/SickChill/blob/01020f3636d01535f60b83464d8127ea0efabfc7/sickchill/oldbeard/scene_exceptions.py#L141-L170 | |
midgetspy/Sick-Beard | 171a607e41b7347a74cc815f6ecce7968d9acccf | lib/pythontwitter/__init__.py | python | List.GetUri | (self) | return self._uri | Get the uri of this list.
Returns:
The uri of this list | Get the uri of this list. | [
"Get",
"the",
"uri",
"of",
"this",
"list",
"."
] | def GetUri(self):
'''Get the uri of this list.
Returns:
The uri of this list
'''
return self._uri | [
"def",
"GetUri",
"(",
"self",
")",
":",
"return",
"self",
".",
"_uri"
] | https://github.com/midgetspy/Sick-Beard/blob/171a607e41b7347a74cc815f6ecce7968d9acccf/lib/pythontwitter/__init__.py#L1672-L1678 | |
WerWolv/EdiZon_CheatsConfigsAndScripts | d16d36c7509c01dca770f402babd83ff2e9ae6e7 | Scripts/lib/python3.5/_pyio.py | python | BufferedIOBase.readinto | (self, b) | return self._readinto(b, read1=False) | Read bytes into a pre-allocated bytes-like object b.
Like read(), this may issue multiple reads to the underlying raw
stream, unless the latter is 'interactive'.
Returns an int representing the number of bytes read (0 for EOF).
Raises BlockingIOError if the underlying raw stream has n... | Read bytes into a pre-allocated bytes-like object b. | [
"Read",
"bytes",
"into",
"a",
"pre",
"-",
"allocated",
"bytes",
"-",
"like",
"object",
"b",
"."
] | def readinto(self, b):
"""Read bytes into a pre-allocated bytes-like object b.
Like read(), this may issue multiple reads to the underlying raw
stream, unless the latter is 'interactive'.
Returns an int representing the number of bytes read (0 for EOF).
Raises BlockingIOError ... | [
"def",
"readinto",
"(",
"self",
",",
"b",
")",
":",
"return",
"self",
".",
"_readinto",
"(",
"b",
",",
"read1",
"=",
"False",
")"
] | https://github.com/WerWolv/EdiZon_CheatsConfigsAndScripts/blob/d16d36c7509c01dca770f402babd83ff2e9ae6e7/Scripts/lib/python3.5/_pyio.py#L663-L675 | |
spack/spack | 675210bd8bd1c5d32ad1cc83d898fb43b569ed74 | lib/spack/spack/environment/environment.py | python | _equiv_list | (first, second) | return all(yaml_equivalent(f, s) for f, s in zip(first, second)) | Returns whether two spack yaml lists are equivalent, including overrides | Returns whether two spack yaml lists are equivalent, including overrides | [
"Returns",
"whether",
"two",
"spack",
"yaml",
"lists",
"are",
"equivalent",
"including",
"overrides"
] | def _equiv_list(first, second):
"""Returns whether two spack yaml lists are equivalent, including overrides
"""
if len(first) != len(second):
return False
return all(yaml_equivalent(f, s) for f, s in zip(first, second)) | [
"def",
"_equiv_list",
"(",
"first",
",",
"second",
")",
":",
"if",
"len",
"(",
"first",
")",
"!=",
"len",
"(",
"second",
")",
":",
"return",
"False",
"return",
"all",
"(",
"yaml_equivalent",
"(",
"f",
",",
"s",
")",
"for",
"f",
",",
"s",
"in",
"z... | https://github.com/spack/spack/blob/675210bd8bd1c5d32ad1cc83d898fb43b569ed74/lib/spack/spack/environment/environment.py#L1971-L1976 | |
openshift/openshift-tools | 1188778e728a6e4781acf728123e5b356380fe6f | openshift/installer/vendored/openshift-ansible-3.10.0-0.29.0/roles/lib_vendored_deps/library/oc_route.py | python | Yedit.get_entry | (data, key, sep='.') | return data | Get an item from a dictionary with key notation a.b.c
d = {'a': {'b': 'c'}}}
key = a.b
return c | Get an item from a dictionary with key notation a.b.c
d = {'a': {'b': 'c'}}}
key = a.b
return c | [
"Get",
"an",
"item",
"from",
"a",
"dictionary",
"with",
"key",
"notation",
"a",
".",
"b",
".",
"c",
"d",
"=",
"{",
"a",
":",
"{",
"b",
":",
"c",
"}}}",
"key",
"=",
"a",
".",
"b",
"return",
"c"
] | def get_entry(data, key, sep='.'):
''' Get an item from a dictionary with key notation a.b.c
d = {'a': {'b': 'c'}}}
key = a.b
return c
'''
if key == '':
pass
elif (not (key and Yedit.valid_key(key, sep)) and
isinstance(data, (... | [
"def",
"get_entry",
"(",
"data",
",",
"key",
",",
"sep",
"=",
"'.'",
")",
":",
"if",
"key",
"==",
"''",
":",
"pass",
"elif",
"(",
"not",
"(",
"key",
"and",
"Yedit",
".",
"valid_key",
"(",
"key",
",",
"sep",
")",
")",
"and",
"isinstance",
"(",
"... | https://github.com/openshift/openshift-tools/blob/1188778e728a6e4781acf728123e5b356380fe6f/openshift/installer/vendored/openshift-ansible-3.10.0-0.29.0/roles/lib_vendored_deps/library/oc_route.py#L374-L396 | |
yktoo/indicator-sound-switcher | c802d964e1c7b063ece973197cb92f7a76c34c1b | lib/indicator_sound_switcher/indicator.py | python | SoundSwitcherIndicator.on_refresh | (self, *args) | Signal handler: Refresh item clicked. | Signal handler: Refresh item clicked. | [
"Signal",
"handler",
":",
"Refresh",
"item",
"clicked",
"."
] | def on_refresh(self, *args):
"""Signal handler: Refresh item clicked."""
logging.debug('.on_refresh()')
self.keyboard_manager.bind_keys(self.config)
self.menu_setup()
self.update_all_pa_items() | [
"def",
"on_refresh",
"(",
"self",
",",
"*",
"args",
")",
":",
"logging",
".",
"debug",
"(",
"'.on_refresh()'",
")",
"self",
".",
"keyboard_manager",
".",
"bind_keys",
"(",
"self",
".",
"config",
")",
"self",
".",
"menu_setup",
"(",
")",
"self",
".",
"u... | https://github.com/yktoo/indicator-sound-switcher/blob/c802d964e1c7b063ece973197cb92f7a76c34c1b/lib/indicator_sound_switcher/indicator.py#L214-L219 | ||
pybrain/pybrain | dcdf32ba1805490cefbc0bdeb227260d304fdb42 | pybrain/structure/modules/kohonen.py | python | KohonenMap._backwardImplementation | (self, outerr, inerr, outbuf, inbuf) | trains the kohonen map in unsupervised manner, moving the
closest neuron and its neighbours closer to the input pattern. | trains the kohonen map in unsupervised manner, moving the
closest neuron and its neighbours closer to the input pattern. | [
"trains",
"the",
"kohonen",
"map",
"in",
"unsupervised",
"manner",
"moving",
"the",
"closest",
"neuron",
"and",
"its",
"neighbours",
"closer",
"to",
"the",
"input",
"pattern",
"."
] | def _backwardImplementation(self, outerr, inerr, outbuf, inbuf):
""" trains the kohonen map in unsupervised manner, moving the
closest neuron and its neighbours closer to the input pattern. """
# calculate neighbourhood and limit to edge of matrix
n = floor(self.neighbours)
... | [
"def",
"_backwardImplementation",
"(",
"self",
",",
"outerr",
",",
"inerr",
",",
"outbuf",
",",
"inbuf",
")",
":",
"# calculate neighbourhood and limit to edge of matrix",
"n",
"=",
"floor",
"(",
"self",
".",
"neighbours",
")",
"self",
".",
"neighbours",
"*=",
"... | https://github.com/pybrain/pybrain/blob/dcdf32ba1805490cefbc0bdeb227260d304fdb42/pybrain/structure/modules/kohonen.py#L56-L76 | ||
oauthlib/oauthlib | 553850bc85dfd408be0dae9884b4a0aefda8e579 | oauthlib/oauth1/rfc5849/request_validator.py | python | RequestValidator.validate_requested_realms | (self, client_key, realms, request) | Validates that the client may request access to the realm.
:param client_key: The client/consumer key.
:param realms: The list of realms that client is requesting access to.
:param request: OAuthlib request.
:type request: oauthlib.common.Request
:returns: True or False
... | Validates that the client may request access to the realm. | [
"Validates",
"that",
"the",
"client",
"may",
"request",
"access",
"to",
"the",
"realm",
"."
] | def validate_requested_realms(self, client_key, realms, request):
"""Validates that the client may request access to the realm.
:param client_key: The client/consumer key.
:param realms: The list of realms that client is requesting access to.
:param request: OAuthlib request.
:t... | [
"def",
"validate_requested_realms",
"(",
"self",
",",
"client_key",
",",
"realms",
",",
"request",
")",
":",
"raise",
"self",
".",
"_subclass_must_implement",
"(",
"\"validate_requested_realms\"",
")"
] | https://github.com/oauthlib/oauthlib/blob/553850bc85dfd408be0dae9884b4a0aefda8e579/oauthlib/oauth1/rfc5849/request_validator.py#L656-L673 | ||
ctxis/canape | 5f0e03424577296bcc60c2008a60a98ec5307e4b | CANAPE.Scripting/Lib/calendar.py | python | TextCalendar.formatweekday | (self, day, width) | return names[day][:width].center(width) | Returns a formatted week day name. | Returns a formatted week day name. | [
"Returns",
"a",
"formatted",
"week",
"day",
"name",
"."
] | def formatweekday(self, day, width):
"""
Returns a formatted week day name.
"""
if width >= 9:
names = day_name
else:
names = day_abbr
return names[day][:width].center(width) | [
"def",
"formatweekday",
"(",
"self",
",",
"day",
",",
"width",
")",
":",
"if",
"width",
">=",
"9",
":",
"names",
"=",
"day_name",
"else",
":",
"names",
"=",
"day_abbr",
"return",
"names",
"[",
"day",
"]",
"[",
":",
"width",
"]",
".",
"center",
"(",... | https://github.com/ctxis/canape/blob/5f0e03424577296bcc60c2008a60a98ec5307e4b/CANAPE.Scripting/Lib/calendar.py#L283-L291 | |
asciidisco/plugin.video.netflix | ceb2638a9676f5839250dadfd079b9e4e4bdd759 | resources/lib/KodiHelper.py | python | KodiHelper.build_user_sub_listing | (self, video_list_ids, type, action, build_url,
widget_display=False) | return True | Builds the video lists screen for user subfolders
(genres & recommendations)
Parameters
----------
video_list_ids : :obj:`dict` of :obj:`str`
List of video lists
type : :obj:`str`
List type (genre or recommendation)
action : :obj:`str`
... | Builds the video lists screen for user subfolders
(genres & recommendations) | [
"Builds",
"the",
"video",
"lists",
"screen",
"for",
"user",
"subfolders",
"(",
"genres",
"&",
"recommendations",
")"
] | def build_user_sub_listing(self, video_list_ids, type, action, build_url,
widget_display=False):
"""
Builds the video lists screen for user subfolders
(genres & recommendations)
Parameters
----------
video_list_ids : :obj:`dict` of :obj:`st... | [
"def",
"build_user_sub_listing",
"(",
"self",
",",
"video_list_ids",
",",
"type",
",",
"action",
",",
"build_url",
",",
"widget_display",
"=",
"False",
")",
":",
"for",
"video_list_id",
"in",
"video_list_ids",
":",
"li",
"=",
"xbmcgui",
".",
"ListItem",
"(",
... | https://github.com/asciidisco/plugin.video.netflix/blob/ceb2638a9676f5839250dadfd079b9e4e4bdd759/resources/lib/KodiHelper.py#L733-L781 | |
MDudek-ICS/TRISIS-TRITON-HATMAN | 15a00af7fd1040f0430729d024427601f84886a1 | decompiled_code/library/inspect.py | python | cleandoc | (doc) | return | Clean up indentation from docstrings.
Any whitespace that can be uniformly removed from the second line
onwards is removed. | Clean up indentation from docstrings.
Any whitespace that can be uniformly removed from the second line
onwards is removed. | [
"Clean",
"up",
"indentation",
"from",
"docstrings",
".",
"Any",
"whitespace",
"that",
"can",
"be",
"uniformly",
"removed",
"from",
"the",
"second",
"line",
"onwards",
"is",
"removed",
"."
] | def cleandoc(doc):
"""Clean up indentation from docstrings.
Any whitespace that can be uniformly removed from the second line
onwards is removed."""
try:
lines = string.split(string.expandtabs(doc), '\n')
except UnicodeError:
return
margin = sys.maxint
for line in lines... | [
"def",
"cleandoc",
"(",
"doc",
")",
":",
"try",
":",
"lines",
"=",
"string",
".",
"split",
"(",
"string",
".",
"expandtabs",
"(",
"doc",
")",
",",
"'\\n'",
")",
"except",
"UnicodeError",
":",
"return",
"margin",
"=",
"sys",
".",
"maxint",
"for",
"lin... | https://github.com/MDudek-ICS/TRISIS-TRITON-HATMAN/blob/15a00af7fd1040f0430729d024427601f84886a1/decompiled_code/library/inspect.py#L368-L398 | |
python/cpython | e13cdca0f5224ec4e23bdd04bb3120506964bc8b | Lib/logging/__init__.py | python | Handler.format | (self, record) | return fmt.format(record) | Format the specified record.
If a formatter is set, use it. Otherwise, use the default formatter
for the module. | Format the specified record. | [
"Format",
"the",
"specified",
"record",
"."
] | def format(self, record):
"""
Format the specified record.
If a formatter is set, use it. Otherwise, use the default formatter
for the module.
"""
if self.formatter:
fmt = self.formatter
else:
fmt = _defaultFormatter
return fmt.for... | [
"def",
"format",
"(",
"self",
",",
"record",
")",
":",
"if",
"self",
".",
"formatter",
":",
"fmt",
"=",
"self",
".",
"formatter",
"else",
":",
"fmt",
"=",
"_defaultFormatter",
"return",
"fmt",
".",
"format",
"(",
"record",
")"
] | https://github.com/python/cpython/blob/e13cdca0f5224ec4e23bdd04bb3120506964bc8b/Lib/logging/__init__.py#L936-L947 | |
mozillazg/pypy | 2ff5cd960c075c991389f842c6d59e71cf0cb7d0 | lib-python/2.7/lib-tk/Tkinter.py | python | PhotoImage.copy | (self) | return destImage | Return a new PhotoImage with the same image as this widget. | Return a new PhotoImage with the same image as this widget. | [
"Return",
"a",
"new",
"PhotoImage",
"with",
"the",
"same",
"image",
"as",
"this",
"widget",
"."
] | def copy(self):
"""Return a new PhotoImage with the same image as this widget."""
destImage = PhotoImage(master=self.tk)
self.tk.call(destImage, 'copy', self.name)
return destImage | [
"def",
"copy",
"(",
"self",
")",
":",
"destImage",
"=",
"PhotoImage",
"(",
"master",
"=",
"self",
".",
"tk",
")",
"self",
".",
"tk",
".",
"call",
"(",
"destImage",
",",
"'copy'",
",",
"self",
".",
"name",
")",
"return",
"destImage"
] | https://github.com/mozillazg/pypy/blob/2ff5cd960c075c991389f842c6d59e71cf0cb7d0/lib-python/2.7/lib-tk/Tkinter.py#L3388-L3392 | |
graalvm/mx | 29c0debab406352df3af246be2f8973be5db69ae | mx_benchmark.py | python | Vm.name | (self) | Returns the unique name of the Java VM (e.g. server, client, or jvmci). | Returns the unique name of the Java VM (e.g. server, client, or jvmci). | [
"Returns",
"the",
"unique",
"name",
"of",
"the",
"Java",
"VM",
"(",
"e",
".",
"g",
".",
"server",
"client",
"or",
"jvmci",
")",
"."
] | def name(self):
"""Returns the unique name of the Java VM (e.g. server, client, or jvmci)."""
raise NotImplementedError() | [
"def",
"name",
"(",
"self",
")",
":",
"raise",
"NotImplementedError",
"(",
")"
] | https://github.com/graalvm/mx/blob/29c0debab406352df3af246be2f8973be5db69ae/mx_benchmark.py#L1525-L1527 | ||
ucfopen/canvasapi | 3f1a71e23c86a49dbaa6e84f6c0e81c297b86e36 | canvasapi/user.py | python | User.get_migration_systems | (self, **kwargs) | return PaginatedList(
Migrator,
self._requester,
"GET",
"users/{}/content_migrations/migrators".format(self.id),
_kwargs=combine_kwargs(**kwargs),
) | Return a list of migration systems.
:calls: `GET /api/v1/users/:user_id/content_migrations/migrators \
<https://canvas.instructure.com/doc/api/content_migrations.html#method.content_migrations.available_migrators>`_
:rtype: :class:`canvasapi.paginated_list.PaginatedList` of
:class:... | Return a list of migration systems. | [
"Return",
"a",
"list",
"of",
"migration",
"systems",
"."
] | def get_migration_systems(self, **kwargs):
"""
Return a list of migration systems.
:calls: `GET /api/v1/users/:user_id/content_migrations/migrators \
<https://canvas.instructure.com/doc/api/content_migrations.html#method.content_migrations.available_migrators>`_
:rtype: :class:... | [
"def",
"get_migration_systems",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"from",
"canvasapi",
".",
"content_migration",
"import",
"Migrator",
"return",
"PaginatedList",
"(",
"Migrator",
",",
"self",
".",
"_requester",
",",
"\"GET\"",
",",
"\"users/{}/cont... | https://github.com/ucfopen/canvasapi/blob/3f1a71e23c86a49dbaa6e84f6c0e81c297b86e36/canvasapi/user.py#L655-L673 | |
kennethreitz-archive/requests3 | 69eb662703b40db58fdc6c095d0fe130c56649bb | requests3/http_utils.py | python | is_valid_cidr | (string_network: str) | return True | Very simple check of the cidr format in no_proxy variable.
:rtype: bool | Very simple check of the cidr format in no_proxy variable. | [
"Very",
"simple",
"check",
"of",
"the",
"cidr",
"format",
"in",
"no_proxy",
"variable",
"."
] | def is_valid_cidr(string_network: str) -> bool:
"""
Very simple check of the cidr format in no_proxy variable.
:rtype: bool
"""
if string_network.count("/") == 1:
try:
mask = int(string_network.split("/")[1])
except ValueError:
return False
if mask <... | [
"def",
"is_valid_cidr",
"(",
"string_network",
":",
"str",
")",
"->",
"bool",
":",
"if",
"string_network",
".",
"count",
"(",
"\"/\"",
")",
"==",
"1",
":",
"try",
":",
"mask",
"=",
"int",
"(",
"string_network",
".",
"split",
"(",
"\"/\"",
")",
"[",
"... | https://github.com/kennethreitz-archive/requests3/blob/69eb662703b40db58fdc6c095d0fe130c56649bb/requests3/http_utils.py#L597-L620 | |
alibaba/iOSSecAudit | f94ed3254263f3382f374e3f05afae8a1fe79f20 | lib/iosCertTrustManager.py | python | Encoder._emit_length_short | (self, length) | Emit the short length form (< 128 octets). | Emit the short length form (< 128 octets). | [
"Emit",
"the",
"short",
"length",
"form",
"(",
"<",
"128",
"octets",
")",
"."
] | def _emit_length_short(self, length):
"""Emit the short length form (< 128 octets)."""
assert length < 128
self._emit(chr(length)) | [
"def",
"_emit_length_short",
"(",
"self",
",",
"length",
")",
":",
"assert",
"length",
"<",
"128",
"self",
".",
"_emit",
"(",
"chr",
"(",
"length",
")",
")"
] | https://github.com/alibaba/iOSSecAudit/blob/f94ed3254263f3382f374e3f05afae8a1fe79f20/lib/iosCertTrustManager.py#L168-L171 | ||
holzschu/Carnets | 44effb10ddfc6aa5c8b0687582a724ba82c6b547 | Library/lib/python3.7/site-packages/sympy/geometry/line.py | python | LinearEntity.intersection | (self, other) | return other.intersection(self) | The intersection with another geometrical entity.
Parameters
==========
o : Point or LinearEntity
Returns
=======
intersection : list of geometrical entities
See Also
========
sympy.geometry.point.Point
Examples
========
... | The intersection with another geometrical entity. | [
"The",
"intersection",
"with",
"another",
"geometrical",
"entity",
"."
] | def intersection(self, other):
"""The intersection with another geometrical entity.
Parameters
==========
o : Point or LinearEntity
Returns
=======
intersection : list of geometrical entities
See Also
========
sympy.geometry.point.Poi... | [
"def",
"intersection",
"(",
"self",
",",
"other",
")",
":",
"def",
"intersect_parallel_rays",
"(",
"ray1",
",",
"ray2",
")",
":",
"if",
"ray1",
".",
"direction",
".",
"dot",
"(",
"ray2",
".",
"direction",
")",
">",
"0",
":",
"# rays point in the same direc... | https://github.com/holzschu/Carnets/blob/44effb10ddfc6aa5c8b0687582a724ba82c6b547/Library/lib/python3.7/site-packages/sympy/geometry/line.py#L390-L545 | |
Rapptz/RoboDanny | 1fb95d76d1b7685e2e2ff950e11cddfc96efbfec | cogs/mod.py | python | Mod.embeds | (self, ctx, search=100) | Removes messages that have embeds in them. | Removes messages that have embeds in them. | [
"Removes",
"messages",
"that",
"have",
"embeds",
"in",
"them",
"."
] | async def embeds(self, ctx, search=100):
"""Removes messages that have embeds in them."""
await self.do_removal(ctx, search, lambda e: len(e.embeds)) | [
"async",
"def",
"embeds",
"(",
"self",
",",
"ctx",
",",
"search",
"=",
"100",
")",
":",
"await",
"self",
".",
"do_removal",
"(",
"ctx",
",",
"search",
",",
"lambda",
"e",
":",
"len",
"(",
"e",
".",
"embeds",
")",
")"
] | https://github.com/Rapptz/RoboDanny/blob/1fb95d76d1b7685e2e2ff950e11cddfc96efbfec/cogs/mod.py#L1237-L1239 | ||
pypa/pipenv | b21baade71a86ab3ee1429f71fbc14d4f95fb75d | pipenv/patched/notpip/_vendor/requests/utils.py | python | get_environ_proxies | (url, no_proxy=None) | Return a dict of environment proxies.
:rtype: dict | Return a dict of environment proxies. | [
"Return",
"a",
"dict",
"of",
"environment",
"proxies",
"."
] | def get_environ_proxies(url, no_proxy=None):
"""
Return a dict of environment proxies.
:rtype: dict
"""
if should_bypass_proxies(url, no_proxy=no_proxy):
return {}
else:
return getproxies() | [
"def",
"get_environ_proxies",
"(",
"url",
",",
"no_proxy",
"=",
"None",
")",
":",
"if",
"should_bypass_proxies",
"(",
"url",
",",
"no_proxy",
"=",
"no_proxy",
")",
":",
"return",
"{",
"}",
"else",
":",
"return",
"getproxies",
"(",
")"
] | https://github.com/pypa/pipenv/blob/b21baade71a86ab3ee1429f71fbc14d4f95fb75d/pipenv/patched/notpip/_vendor/requests/utils.py#L791-L800 | ||
caiiiac/Machine-Learning-with-Python | 1a26c4467da41ca4ebc3d5bd789ea942ef79422f | MachineLearning/venv/lib/python3.5/site-packages/pandas/core/groupby.py | python | GroupBy.expanding | (self, *args, **kwargs) | return ExpandingGroupby(self, *args, **kwargs) | Return an expanding grouper, providing expanding
functionaility per group | Return an expanding grouper, providing expanding
functionaility per group | [
"Return",
"an",
"expanding",
"grouper",
"providing",
"expanding",
"functionaility",
"per",
"group"
] | def expanding(self, *args, **kwargs):
"""
Return an expanding grouper, providing expanding
functionaility per group
"""
from pandas.core.window import ExpandingGroupby
return ExpandingGroupby(self, *args, **kwargs) | [
"def",
"expanding",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"from",
"pandas",
".",
"core",
".",
"window",
"import",
"ExpandingGroupby",
"return",
"ExpandingGroupby",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
... | https://github.com/caiiiac/Machine-Learning-with-Python/blob/1a26c4467da41ca4ebc3d5bd789ea942ef79422f/MachineLearning/venv/lib/python3.5/site-packages/pandas/core/groupby.py#L1247-L1254 | |
rembo10/headphones | b3199605be1ebc83a7a8feab6b1e99b64014187c | lib/argparse.py | python | HelpFormatter._fill_text | (self, text, width, indent) | return _textwrap.fill(text, width, initial_indent=indent,
subsequent_indent=indent) | [] | def _fill_text(self, text, width, indent):
text = self._whitespace_matcher.sub(' ', text).strip()
return _textwrap.fill(text, width, initial_indent=indent,
subsequent_indent=indent) | [
"def",
"_fill_text",
"(",
"self",
",",
"text",
",",
"width",
",",
"indent",
")",
":",
"text",
"=",
"self",
".",
"_whitespace_matcher",
".",
"sub",
"(",
"' '",
",",
"text",
")",
".",
"strip",
"(",
")",
"return",
"_textwrap",
".",
"fill",
"(",
"text",
... | https://github.com/rembo10/headphones/blob/b3199605be1ebc83a7a8feab6b1e99b64014187c/lib/argparse.py#L621-L624 | |||
gkrizek/bash-lambda-layer | 703b0ade8174022d44779d823172ab7ac33a5505 | bin/docutils/parsers/rst/states.py | python | Body.anonymous | (self, match, context, next_state) | return [], next_state, [] | Anonymous hyperlink targets. | Anonymous hyperlink targets. | [
"Anonymous",
"hyperlink",
"targets",
"."
] | def anonymous(self, match, context, next_state):
"""Anonymous hyperlink targets."""
nodelist, blank_finish = self.anonymous_target(match)
self.parent += nodelist
self.explicit_list(blank_finish)
return [], next_state, [] | [
"def",
"anonymous",
"(",
"self",
",",
"match",
",",
"context",
",",
"next_state",
")",
":",
"nodelist",
",",
"blank_finish",
"=",
"self",
".",
"anonymous_target",
"(",
"match",
")",
"self",
".",
"parent",
"+=",
"nodelist",
"self",
".",
"explicit_list",
"("... | https://github.com/gkrizek/bash-lambda-layer/blob/703b0ade8174022d44779d823172ab7ac33a5505/bin/docutils/parsers/rst/states.py#L2363-L2368 | |
robinhood/faust | 01b4c0ad8390221db71751d80001b0fd879291e2 | faust/agents/actor.py | python | Actor.on_isolated_partition_assigned | (self, tp: TP) | Call when an isolated partition is being assigned. | Call when an isolated partition is being assigned. | [
"Call",
"when",
"an",
"isolated",
"partition",
"is",
"being",
"assigned",
"."
] | async def on_isolated_partition_assigned(self, tp: TP) -> None:
"""Call when an isolated partition is being assigned."""
self.log.dev('Actor was assigned to %r', tp) | [
"async",
"def",
"on_isolated_partition_assigned",
"(",
"self",
",",
"tp",
":",
"TP",
")",
"->",
"None",
":",
"self",
".",
"log",
".",
"dev",
"(",
"'Actor was assigned to %r'",
",",
"tp",
")"
] | https://github.com/robinhood/faust/blob/01b4c0ad8390221db71751d80001b0fd879291e2/faust/agents/actor.py#L56-L58 | ||
mitshel/sopds | 30a401de34f15468fcb366b70e7c0b5a8b6ee8e8 | opds_catalog/zipf.py | python | _ZipDecrypter._GenerateCRCTable | () | return table | Generate a CRC-32 table.
ZIP encryption uses the CRC32 one-byte primitive for scrambling some
internal keys. We noticed that a direct implementation is faster than
relying on binascii.crc32(). | Generate a CRC-32 table. | [
"Generate",
"a",
"CRC",
"-",
"32",
"table",
"."
] | def _GenerateCRCTable():
"""Generate a CRC-32 table.
ZIP encryption uses the CRC32 one-byte primitive for scrambling some
internal keys. We noticed that a direct implementation is faster than
relying on binascii.crc32().
"""
poly = 0xedb88320
table = [0] * 256
... | [
"def",
"_GenerateCRCTable",
"(",
")",
":",
"poly",
"=",
"0xedb88320",
"table",
"=",
"[",
"0",
"]",
"*",
"256",
"for",
"i",
"in",
"range",
"(",
"256",
")",
":",
"crc",
"=",
"i",
"for",
"j",
"in",
"range",
"(",
"8",
")",
":",
"if",
"crc",
"&",
... | https://github.com/mitshel/sopds/blob/30a401de34f15468fcb366b70e7c0b5a8b6ee8e8/opds_catalog/zipf.py#L461-L478 | |
bhoov/exbert | d27b6236aa51b185f7d3fed904f25cabe3baeb1a | server/spacyface/spacyface/utils/f.py | python | pick | (keys:Union[List, Set], obj:Dict) | return {k: obj[k] for k in keys} | Return a NEW object containing `keys` from the original `obj` | Return a NEW object containing `keys` from the original `obj` | [
"Return",
"a",
"NEW",
"object",
"containing",
"keys",
"from",
"the",
"original",
"obj"
] | def pick(keys:Union[List, Set], obj:Dict) -> Dict:
""" Return a NEW object containing `keys` from the original `obj` """
return {k: obj[k] for k in keys} | [
"def",
"pick",
"(",
"keys",
":",
"Union",
"[",
"List",
",",
"Set",
"]",
",",
"obj",
":",
"Dict",
")",
"->",
"Dict",
":",
"return",
"{",
"k",
":",
"obj",
"[",
"k",
"]",
"for",
"k",
"in",
"keys",
"}"
] | https://github.com/bhoov/exbert/blob/d27b6236aa51b185f7d3fed904f25cabe3baeb1a/server/spacyface/spacyface/utils/f.py#L62-L64 | |
CATIA-Systems/FMPy | fde192346c36eb69dbaca60a96e80cdc8ef37b89 | fmpy/cross_check/__init__.py | python | validate_signal | (t, y, t_ref, y_ref, t_start, t_stop, num=1000, dx=21, dy=0.1) | return t_band, y_min, y_max, i_out | Validate a signal y(t) against a reference signal y_ref(t_ref) by creating a band
around y_ref and finding the values in y outside the band
Parameters:
t time of the signal
y values of the signal
t_ref time of the reference signal
y_ref values of the referen... | Validate a signal y(t) against a reference signal y_ref(t_ref) by creating a band
around y_ref and finding the values in y outside the band | [
"Validate",
"a",
"signal",
"y",
"(",
"t",
")",
"against",
"a",
"reference",
"signal",
"y_ref",
"(",
"t_ref",
")",
"by",
"creating",
"a",
"band",
"around",
"y_ref",
"and",
"finding",
"the",
"values",
"in",
"y",
"outside",
"the",
"band"
] | def validate_signal(t, y, t_ref, y_ref, t_start, t_stop, num=1000, dx=21, dy=0.1):
""" Validate a signal y(t) against a reference signal y_ref(t_ref) by creating a band
around y_ref and finding the values in y outside the band
Parameters:
t time of the signal
y values of the ... | [
"def",
"validate_signal",
"(",
"t",
",",
"y",
",",
"t_ref",
",",
"y_ref",
",",
"t_start",
",",
"t_stop",
",",
"num",
"=",
"1000",
",",
"dx",
"=",
"21",
",",
"dy",
"=",
"0.1",
")",
":",
"import",
"numpy",
"as",
"np",
"from",
"scipy",
".",
"ndimage... | https://github.com/CATIA-Systems/FMPy/blob/fde192346c36eb69dbaca60a96e80cdc8ef37b89/fmpy/cross_check/__init__.py#L87-L144 | |
EventGhost/EventGhost | 177be516849e74970d2e13cda82244be09f277ce | plugins/System/__init__.py | python | MuteOn.Configure | (self, deviceId=0) | if eg.WindowsVersion >= 'Vista':
deviceCtrl.SetValue(0)
deviceCtrl.Enable(False) | if eg.WindowsVersion >= 'Vista':
deviceCtrl.SetValue(0)
deviceCtrl.Enable(False) | [
"if",
"eg",
".",
"WindowsVersion",
">",
"=",
"Vista",
":",
"deviceCtrl",
".",
"SetValue",
"(",
"0",
")",
"deviceCtrl",
".",
"Enable",
"(",
"False",
")"
] | def Configure(self, deviceId=0):
deviceId = SoundMixer.GetDeviceId(deviceId)
panel = eg.ConfigPanel()
deviceCtrl = panel.Choice(
deviceId + 1, choices=SoundMixer.GetMixerDevices(True)
)
"""if eg.WindowsVersion >= 'Vista':
deviceCtrl.SetValue(0)
... | [
"def",
"Configure",
"(",
"self",
",",
"deviceId",
"=",
"0",
")",
":",
"deviceId",
"=",
"SoundMixer",
".",
"GetDeviceId",
"(",
"deviceId",
")",
"panel",
"=",
"eg",
".",
"ConfigPanel",
"(",
")",
"deviceCtrl",
"=",
"panel",
".",
"Choice",
"(",
"deviceId",
... | https://github.com/EventGhost/EventGhost/blob/177be516849e74970d2e13cda82244be09f277ce/plugins/System/__init__.py#L1974-L1986 | ||
edfungus/Crouton | ada98b3930192938a48909072b45cb84b945f875 | clients/python_clients/cf_demo_client/cf_env/lib/python2.7/site-packages/jinja2/debug.py | python | ProcessedTraceback.standard_exc_info | (self) | return self.exc_type, self.exc_value, tb | Standard python exc_info for re-raising | Standard python exc_info for re-raising | [
"Standard",
"python",
"exc_info",
"for",
"re",
"-",
"raising"
] | def standard_exc_info(self):
"""Standard python exc_info for re-raising"""
tb = self.frames[0]
# the frame will be an actual traceback (or transparent proxy) if
# we are on pypy or a python implementation with support for tproxy
if type(tb) is not TracebackType:
tb = ... | [
"def",
"standard_exc_info",
"(",
"self",
")",
":",
"tb",
"=",
"self",
".",
"frames",
"[",
"0",
"]",
"# the frame will be an actual traceback (or transparent proxy) if",
"# we are on pypy or a python implementation with support for tproxy",
"if",
"type",
"(",
"tb",
")",
"is"... | https://github.com/edfungus/Crouton/blob/ada98b3930192938a48909072b45cb84b945f875/clients/python_clients/cf_demo_client/cf_env/lib/python2.7/site-packages/jinja2/debug.py#L122-L129 | |
rossant/ipymd | d87c9ebc59d67fe78b0139ee00e0e5307682e303 | ipymd/utils/utils.py | python | _flatten_links | (cells) | return [_flatten_links_cell(cell) for cell in cells] | Replace hypertext links by simple URL text. | Replace hypertext links by simple URL text. | [
"Replace",
"hypertext",
"links",
"by",
"simple",
"URL",
"text",
"."
] | def _flatten_links(cells):
"""Replace hypertext links by simple URL text."""
return [_flatten_links_cell(cell) for cell in cells] | [
"def",
"_flatten_links",
"(",
"cells",
")",
":",
"return",
"[",
"_flatten_links_cell",
"(",
"cell",
")",
"for",
"cell",
"in",
"cells",
"]"
] | https://github.com/rossant/ipymd/blob/d87c9ebc59d67fe78b0139ee00e0e5307682e303/ipymd/utils/utils.py#L86-L88 | |
UCL-INGI/INGInious | 60f10cb4c375ce207471043e76bd813220b95399 | inginious/frontend/pages/tasks.py | python | TaskPageStaticDownload.GET | (self, courseid, taskid, path) | GET request | GET request | [
"GET",
"request"
] | def GET(self, courseid, taskid, path): # pylint: disable=arguments-differ
""" GET request """
try:
course = self.course_factory.get_course(courseid)
if not self.user_manager.course_is_open_to_user(course):
return handle_course_unavailable(self.app.get_homepath(),... | [
"def",
"GET",
"(",
"self",
",",
"courseid",
",",
"taskid",
",",
"path",
")",
":",
"# pylint: disable=arguments-differ",
"try",
":",
"course",
"=",
"self",
".",
"course_factory",
".",
"get_course",
"(",
"courseid",
")",
"if",
"not",
"self",
".",
"user_manager... | https://github.com/UCL-INGI/INGInious/blob/60f10cb4c375ce207471043e76bd813220b95399/inginious/frontend/pages/tasks.py#L398-L427 | ||
jamesoff/simplemonitor | 3b324d7bb28058e924b823aeddfaf361f943e78e | simplemonitor/Monitors/monitor.py | python | Monitor.reset_dependencies | (self) | Reset the monitor's dependency list back to default. | Reset the monitor's dependency list back to default. | [
"Reset",
"the",
"monitor",
"s",
"dependency",
"list",
"back",
"to",
"default",
"."
] | def reset_dependencies(self) -> None:
"""Reset the monitor's dependency list back to default."""
self._deps = copy.copy(self._dependencies) | [
"def",
"reset_dependencies",
"(",
"self",
")",
"->",
"None",
":",
"self",
".",
"_deps",
"=",
"copy",
".",
"copy",
"(",
"self",
".",
"_dependencies",
")"
] | https://github.com/jamesoff/simplemonitor/blob/3b324d7bb28058e924b823aeddfaf361f943e78e/simplemonitor/Monitors/monitor.py#L191-L193 | ||
Tautulli/Tautulli | 2410eb33805aaac4bd1c5dad0f71e4f15afaf742 | lib/mako/pyparser.py | python | ParseFunc.__init__ | (self, listener, **exception_kwargs) | [] | def __init__(self, listener, **exception_kwargs):
self.listener = listener
self.exception_kwargs = exception_kwargs | [
"def",
"__init__",
"(",
"self",
",",
"listener",
",",
"*",
"*",
"exception_kwargs",
")",
":",
"self",
".",
"listener",
"=",
"listener",
"self",
".",
"exception_kwargs",
"=",
"exception_kwargs"
] | https://github.com/Tautulli/Tautulli/blob/2410eb33805aaac4bd1c5dad0f71e4f15afaf742/lib/mako/pyparser.py#L207-L209 | ||||
openmc-dev/openmc | 0cf7d9283786677e324bfbdd0984a54d1c86dacc | openmc/deplete/abc.py | python | FissionYieldHelper.generate_tallies | (materials, mat_indexes) | Construct tallies necessary for computing fission yields
Called during the operator set up phase prior to depleting.
Not necessary for subclasses to implement
Parameters
----------
materials : iterable of C-API materials
Materials to be used in :class:`openmc.lib.Ma... | Construct tallies necessary for computing fission yields | [
"Construct",
"tallies",
"necessary",
"for",
"computing",
"fission",
"yields"
] | def generate_tallies(materials, mat_indexes):
"""Construct tallies necessary for computing fission yields
Called during the operator set up phase prior to depleting.
Not necessary for subclasses to implement
Parameters
----------
materials : iterable of C-API materials
... | [
"def",
"generate_tallies",
"(",
"materials",
",",
"mat_indexes",
")",
":"
] | https://github.com/openmc-dev/openmc/blob/0cf7d9283786677e324bfbdd0984a54d1c86dacc/openmc/deplete/abc.py#L450-L466 | ||
LexPredict/lexpredict-contraxsuite | 1d5a2540d31f8f3f1adc442cfa13a7c007319899 | sdk/python/sdk/openapi_client/model/inline_response4041.py | python | InlineResponse4041._from_openapi_data | (cls, details, *args, **kwargs) | return self | InlineResponse4041 - a model defined in OpenAPI
Args:
details (str):
Keyword Args:
_check_type (bool): if True, values for parameters in openapi_types
will be type checked and a TypeError will be
raised if the wron... | InlineResponse4041 - a model defined in OpenAPI | [
"InlineResponse4041",
"-",
"a",
"model",
"defined",
"in",
"OpenAPI"
] | def _from_openapi_data(cls, details, *args, **kwargs): # noqa: E501
"""InlineResponse4041 - a model defined in OpenAPI
Args:
details (str):
Keyword Args:
_check_type (bool): if True, values for parameters in openapi_types
will be type ch... | [
"def",
"_from_openapi_data",
"(",
"cls",
",",
"details",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"# noqa: E501",
"_check_type",
"=",
"kwargs",
".",
"pop",
"(",
"'_check_type'",
",",
"True",
")",
"_spec_property_naming",
"=",
"kwargs",
".",
"po... | https://github.com/LexPredict/lexpredict-contraxsuite/blob/1d5a2540d31f8f3f1adc442cfa13a7c007319899/sdk/python/sdk/openapi_client/model/inline_response4041.py#L103-L176 | |
robcarver17/pysystemtrade | b0385705b7135c52d39cb6d2400feece881bcca9 | sysproduction/update_multiple_adjusted_prices.py | python | get_dict_of_new_prices_and_contractid | (
instrument_code: str, contract_date_dict: setOfNamedContracts, data: dataBlob
) | return new_prices_dict | :param instrument_code: str
:param contract_list: dict of 'yyyymmdd' str, keynames 'CARRY, PRICE, FORWARD'
:param data:
:return: dict of futures contract prices for each contract, plus contract id column | [] | def get_dict_of_new_prices_and_contractid(
instrument_code: str, contract_date_dict: setOfNamedContracts, data: dataBlob
) -> dictFuturesNamedContractFinalPricesWithContractID:
"""
:param instrument_code: str
:param contract_list: dict of 'yyyymmdd' str, keynames 'CARRY, PRICE, FORWARD'
:param data... | [
"def",
"get_dict_of_new_prices_and_contractid",
"(",
"instrument_code",
":",
"str",
",",
"contract_date_dict",
":",
"setOfNamedContracts",
",",
"data",
":",
"dataBlob",
")",
"->",
"dictFuturesNamedContractFinalPricesWithContractID",
":",
"diag_prices",
"=",
"diagPrices",
"(... | https://github.com/robcarver17/pysystemtrade/blob/b0385705b7135c52d39cb6d2400feece881bcca9/sysproduction/update_multiple_adjusted_prices.py#L171-L200 | ||
arthurdejong/python-stdnum | 02dec52602ae0709b940b781fc1fcebfde7340b7 | stdnum/issn.py | python | is_valid | (number) | Check if the number provided is a valid ISSN. | Check if the number provided is a valid ISSN. | [
"Check",
"if",
"the",
"number",
"provided",
"is",
"a",
"valid",
"ISSN",
"."
] | def is_valid(number):
"""Check if the number provided is a valid ISSN."""
try:
return bool(validate(number))
except ValidationError:
return False | [
"def",
"is_valid",
"(",
"number",
")",
":",
"try",
":",
"return",
"bool",
"(",
"validate",
"(",
"number",
")",
")",
"except",
"ValidationError",
":",
"return",
"False"
] | https://github.com/arthurdejong/python-stdnum/blob/02dec52602ae0709b940b781fc1fcebfde7340b7/stdnum/issn.py#L84-L89 | ||
OpenMDAO/OpenMDAO-Framework | f2e37b7de3edeaaeb2d251b375917adec059db9b | openmdao.util/src/openmdao/util/stream.py | python | Stream.write_float | (self, value, fmt='%.16g', sep='', full_record=False) | Writes a float.
value: float
Value to be written.
fmt: string
Format to use when writing as text.
sep: string
Appended to stream after writing `value`.
full_record: bool
If True, then write surrounding recordmarks.
Only mean... | Writes a float. | [
"Writes",
"a",
"float",
"."
] | def write_float(self, value, fmt='%.16g', sep='', full_record=False):
"""
Writes a float.
value: float
Value to be written.
fmt: string
Format to use when writing as text.
sep: string
Appended to stream after writing `value`.
full_r... | [
"def",
"write_float",
"(",
"self",
",",
"value",
",",
"fmt",
"=",
"'%.16g'",
",",
"sep",
"=",
"''",
",",
"full_record",
"=",
"False",
")",
":",
"if",
"self",
".",
"binary",
":",
"if",
"full_record",
"and",
"self",
".",
"unformatted",
":",
"self",
"."... | https://github.com/OpenMDAO/OpenMDAO-Framework/blob/f2e37b7de3edeaaeb2d251b375917adec059db9b/openmdao.util/src/openmdao/util/stream.py#L329-L361 | ||
autotest/autotest | 4614ae5f550cc888267b9a419e4b90deb54f8fae | client/shared/data_dir.py | python | get_test_providers_dir | () | return TEST_PROVIDERS_DIR | Return the base test providers dir (at the moment, test-providers.d). | Return the base test providers dir (at the moment, test-providers.d). | [
"Return",
"the",
"base",
"test",
"providers",
"dir",
"(",
"at",
"the",
"moment",
"test",
"-",
"providers",
".",
"d",
")",
"."
] | def get_test_providers_dir():
"""
Return the base test providers dir (at the moment, test-providers.d).
"""
if not os.path.isdir(TEST_PROVIDERS_DOWNLOAD_DIR):
os.makedirs(TEST_PROVIDERS_DOWNLOAD_DIR)
return TEST_PROVIDERS_DIR | [
"def",
"get_test_providers_dir",
"(",
")",
":",
"if",
"not",
"os",
".",
"path",
".",
"isdir",
"(",
"TEST_PROVIDERS_DOWNLOAD_DIR",
")",
":",
"os",
".",
"makedirs",
"(",
"TEST_PROVIDERS_DOWNLOAD_DIR",
")",
"return",
"TEST_PROVIDERS_DIR"
] | https://github.com/autotest/autotest/blob/4614ae5f550cc888267b9a419e4b90deb54f8fae/client/shared/data_dir.py#L211-L217 | |
sunpy/sunpy | 528579df0a4c938c133bd08971ba75c131b189a7 | sunpy/map/sources/sdo.py | python | HMISynopticMap.is_datasource_for | (cls, data, header, **kwargs) | return (str(header.get('TELESCOP', '')).endswith('HMI') and
str(header.get('CONTENT', '')) ==
'Carrington Synoptic Chart Of Br Field') | Determines if header corresponds to an HMI synoptic map. | Determines if header corresponds to an HMI synoptic map. | [
"Determines",
"if",
"header",
"corresponds",
"to",
"an",
"HMI",
"synoptic",
"map",
"."
] | def is_datasource_for(cls, data, header, **kwargs):
"""
Determines if header corresponds to an HMI synoptic map.
"""
return (str(header.get('TELESCOP', '')).endswith('HMI') and
str(header.get('CONTENT', '')) ==
'Carrington Synoptic Chart Of Br Field') | [
"def",
"is_datasource_for",
"(",
"cls",
",",
"data",
",",
"header",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"(",
"str",
"(",
"header",
".",
"get",
"(",
"'TELESCOP'",
",",
"''",
")",
")",
".",
"endswith",
"(",
"'HMI'",
")",
"and",
"str",
"(",
... | https://github.com/sunpy/sunpy/blob/528579df0a4c938c133bd08971ba75c131b189a7/sunpy/map/sources/sdo.py#L203-L209 | |
SickChill/SickChill | 01020f3636d01535f60b83464d8127ea0efabfc7 | sickchill/oldbeard/helpers.py | python | indentXML | (elem, level=0) | Does our pretty printing, makes Matt very happy | Does our pretty printing, makes Matt very happy | [
"Does",
"our",
"pretty",
"printing",
"makes",
"Matt",
"very",
"happy"
] | def indentXML(elem, level=0):
"""
Does our pretty printing, makes Matt very happy
"""
i = "\n" + level * " "
if elem:
if not elem.text or not elem.text.strip():
elem.text = i + " "
if not elem.tail or not elem.tail.strip():
elem.tail = i
for elem in ... | [
"def",
"indentXML",
"(",
"elem",
",",
"level",
"=",
"0",
")",
":",
"i",
"=",
"\"\\n\"",
"+",
"level",
"*",
"\" \"",
"if",
"elem",
":",
"if",
"not",
"elem",
".",
"text",
"or",
"not",
"elem",
".",
"text",
".",
"strip",
"(",
")",
":",
"elem",
"."... | https://github.com/SickChill/SickChill/blob/01020f3636d01535f60b83464d8127ea0efabfc7/sickchill/oldbeard/helpers.py#L97-L113 | ||
Chia-Network/chia-blockchain | 34d44c1324ae634a0896f7b02eaa2802af9526cd | chia/util/file_keyring.py | python | FileKeyring.set_password | (self, service: str, user: str, passphrase: str) | Store the passphrase to the keyring data using the name specified by the
'user' parameter. Will force a write to keyring.yaml on success. | Store the passphrase to the keyring data using the name specified by the
'user' parameter. Will force a write to keyring.yaml on success. | [
"Store",
"the",
"passphrase",
"to",
"the",
"keyring",
"data",
"using",
"the",
"name",
"specified",
"by",
"the",
"user",
"parameter",
".",
"Will",
"force",
"a",
"write",
"to",
"keyring",
".",
"yaml",
"on",
"success",
"."
] | def set_password(self, service: str, user: str, passphrase: str):
"""
Store the passphrase to the keyring data using the name specified by the
'user' parameter. Will force a write to keyring.yaml on success.
"""
with acquire_writer_lock(lock_path=self.keyring_lock_path):
... | [
"def",
"set_password",
"(",
"self",
",",
"service",
":",
"str",
",",
"user",
":",
"str",
",",
"passphrase",
":",
"str",
")",
":",
"with",
"acquire_writer_lock",
"(",
"lock_path",
"=",
"self",
".",
"keyring_lock_path",
")",
":",
"self",
".",
"_inner_set_pas... | https://github.com/Chia-Network/chia-blockchain/blob/34d44c1324ae634a0896f7b02eaa2802af9526cd/chia/util/file_keyring.py#L258-L264 | ||
home-assistant/supervisor | 69c2517d5211b483fdfe968b0a2b36b672ee7ab2 | supervisor/resolution/evaluate.py | python | ResolutionEvaluation.evaluate_system | (self) | Evaluate the system. | Evaluate the system. | [
"Evaluate",
"the",
"system",
"."
] | async def evaluate_system(self) -> None:
"""Evaluate the system."""
_LOGGER.info("Starting system evaluation with state %s", self.sys_core.state)
for evaluation in self.all_evaluations:
try:
await evaluation()
except Exception as err: # pylint: disable=b... | [
"async",
"def",
"evaluate_system",
"(",
"self",
")",
"->",
"None",
":",
"_LOGGER",
".",
"info",
"(",
"\"Starting system evaluation with state %s\"",
",",
"self",
".",
"sys_core",
".",
"state",
")",
"for",
"evaluation",
"in",
"self",
".",
"all_evaluations",
":",
... | https://github.com/home-assistant/supervisor/blob/69c2517d5211b483fdfe968b0a2b36b672ee7ab2/supervisor/resolution/evaluate.py#L51-L67 | ||
declare-lab/conv-emotion | 0c9dcb9cc5234a7ca8cf6af81aabe28ef3814d0e | emotion-cause-extraction/RoBERTa Baseline/simpletransformers/conv_ai/conv_ai_model.py | python | ConvAIModel.build_input_from_segments | (self, persona, history, reply, tokenizer, lm_labels=False, with_eos=True) | return instance | Build a sequence of input from 3 segments: persona, history and last reply. | Build a sequence of input from 3 segments: persona, history and last reply. | [
"Build",
"a",
"sequence",
"of",
"input",
"from",
"3",
"segments",
":",
"persona",
"history",
"and",
"last",
"reply",
"."
] | def build_input_from_segments(self, persona, history, reply, tokenizer, lm_labels=False, with_eos=True):
""" Build a sequence of input from 3 segments: persona, history and last reply. """
bos, eos, speaker1, speaker2 = tokenizer.convert_tokens_to_ids(SPECIAL_TOKENS[:-1])
sequence = [[bos] + lis... | [
"def",
"build_input_from_segments",
"(",
"self",
",",
"persona",
",",
"history",
",",
"reply",
",",
"tokenizer",
",",
"lm_labels",
"=",
"False",
",",
"with_eos",
"=",
"True",
")",
":",
"bos",
",",
"eos",
",",
"speaker1",
",",
"speaker2",
"=",
"tokenizer",
... | https://github.com/declare-lab/conv-emotion/blob/0c9dcb9cc5234a7ca8cf6af81aabe28ef3814d0e/emotion-cause-extraction/RoBERTa Baseline/simpletransformers/conv_ai/conv_ai_model.py#L944-L958 | |
plotly/plotly.py | cfad7862594b35965c0e000813bd7805e8494a5b | packages/python/plotly/plotly/graph_objs/densitymapbox/_colorbar.py | python | ColorBar.tickformatstopdefaults | (self) | return self["tickformatstopdefaults"] | When used in a template (as layout.template.data.densitymapbox.
colorbar.tickformatstopdefaults), sets the default property
values to use for elements of
densitymapbox.colorbar.tickformatstops
The 'tickformatstopdefaults' property is an instance of Tickformatstop
that may be... | When used in a template (as layout.template.data.densitymapbox.
colorbar.tickformatstopdefaults), sets the default property
values to use for elements of
densitymapbox.colorbar.tickformatstops
The 'tickformatstopdefaults' property is an instance of Tickformatstop
that may be... | [
"When",
"used",
"in",
"a",
"template",
"(",
"as",
"layout",
".",
"template",
".",
"data",
".",
"densitymapbox",
".",
"colorbar",
".",
"tickformatstopdefaults",
")",
"sets",
"the",
"default",
"property",
"values",
"to",
"use",
"for",
"elements",
"of",
"densit... | def tickformatstopdefaults(self):
"""
When used in a template (as layout.template.data.densitymapbox.
colorbar.tickformatstopdefaults), sets the default property
values to use for elements of
densitymapbox.colorbar.tickformatstops
The 'tickformatstopdefaults' propert... | [
"def",
"tickformatstopdefaults",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"tickformatstopdefaults\"",
"]"
] | https://github.com/plotly/plotly.py/blob/cfad7862594b35965c0e000813bd7805e8494a5b/packages/python/plotly/plotly/graph_objs/densitymapbox/_colorbar.py#L851-L870 | |
meejah/txtorcon | 7da6ad6f91c395951be1b4e7e1011baa2f7a689f | txtorcon/circuit.py | python | Circuit.when_built | (self) | return self._when_built.when_fired() | Returns a Deferred that is callback()'d (with this Circuit
instance) when this circuit hits BUILT.
If it's already BUILT when this is called, you get an
already-successful Deferred; otherwise, the state must change
to BUILT.
If the circuit will never hit BUILT (e.g. it is aband... | Returns a Deferred that is callback()'d (with this Circuit
instance) when this circuit hits BUILT. | [
"Returns",
"a",
"Deferred",
"that",
"is",
"callback",
"()",
"d",
"(",
"with",
"this",
"Circuit",
"instance",
")",
"when",
"this",
"circuit",
"hits",
"BUILT",
"."
] | def when_built(self):
"""
Returns a Deferred that is callback()'d (with this Circuit
instance) when this circuit hits BUILT.
If it's already BUILT when this is called, you get an
already-successful Deferred; otherwise, the state must change
to BUILT.
If the circ... | [
"def",
"when_built",
"(",
"self",
")",
":",
"# XXX note to self: we never do an errback; fix this behavior",
"if",
"self",
".",
"state",
"==",
"'BUILT'",
":",
"return",
"defer",
".",
"succeed",
"(",
"self",
")",
"return",
"self",
".",
"_when_built",
".",
"when_fir... | https://github.com/meejah/txtorcon/blob/7da6ad6f91c395951be1b4e7e1011baa2f7a689f/txtorcon/circuit.py#L241-L256 | |
home-assistant/core | 265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1 | homeassistant/components/bbox/device_tracker.py | python | BboxDeviceScanner.scan_devices | (self) | return [device.mac for device in self.last_results] | Scan for new devices and return a list with found device IDs. | Scan for new devices and return a list with found device IDs. | [
"Scan",
"for",
"new",
"devices",
"and",
"return",
"a",
"list",
"with",
"found",
"device",
"IDs",
"."
] | def scan_devices(self):
"""Scan for new devices and return a list with found device IDs."""
self._update_info()
return [device.mac for device in self.last_results] | [
"def",
"scan_devices",
"(",
"self",
")",
":",
"self",
".",
"_update_info",
"(",
")",
"return",
"[",
"device",
".",
"mac",
"for",
"device",
"in",
"self",
".",
"last_results",
"]"
] | https://github.com/home-assistant/core/blob/265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1/homeassistant/components/bbox/device_tracker.py#L58-L62 | |
ioflo/ioflo | 177ac656d7c4ff801aebb0d8b401db365a5248ce | ioflo/aid/odicting.py | python | odict.__delitem__ | (self, key) | del x[y] | del x[y] | [
"del",
"x",
"[",
"y",
"]"
] | def __delitem__(self, key):
""" del x[y] """
dict.__delitem__(self, key)
self._keys.remove(key) | [
"def",
"__delitem__",
"(",
"self",
",",
"key",
")",
":",
"dict",
".",
"__delitem__",
"(",
"self",
",",
"key",
")",
"self",
".",
"_keys",
".",
"remove",
"(",
"key",
")"
] | https://github.com/ioflo/ioflo/blob/177ac656d7c4ff801aebb0d8b401db365a5248ce/ioflo/aid/odicting.py#L80-L83 | ||
TencentCloud/tencentcloud-sdk-python | 3677fd1cdc8c5fd626ce001c13fd3b59d1f279d2 | tencentcloud/tdmq/v20200217/tdmq_client.py | python | TdmqClient.DeleteRocketMQGroup | (self, request) | 删除RocketMQ消费组
:param request: Request instance for DeleteRocketMQGroup.
:type request: :class:`tencentcloud.tdmq.v20200217.models.DeleteRocketMQGroupRequest`
:rtype: :class:`tencentcloud.tdmq.v20200217.models.DeleteRocketMQGroupResponse` | 删除RocketMQ消费组 | [
"删除RocketMQ消费组"
] | def DeleteRocketMQGroup(self, request):
"""删除RocketMQ消费组
:param request: Request instance for DeleteRocketMQGroup.
:type request: :class:`tencentcloud.tdmq.v20200217.models.DeleteRocketMQGroupRequest`
:rtype: :class:`tencentcloud.tdmq.v20200217.models.DeleteRocketMQGroupResponse`
... | [
"def",
"DeleteRocketMQGroup",
"(",
"self",
",",
"request",
")",
":",
"try",
":",
"params",
"=",
"request",
".",
"_serialize",
"(",
")",
"body",
"=",
"self",
".",
"call",
"(",
"\"DeleteRocketMQGroup\"",
",",
"params",
")",
"response",
"=",
"json",
".",
"l... | https://github.com/TencentCloud/tencentcloud-sdk-python/blob/3677fd1cdc8c5fd626ce001c13fd3b59d1f279d2/tencentcloud/tdmq/v20200217/tdmq_client.py#L953-L978 | ||
jgagneastro/coffeegrindsize | 22661ebd21831dba4cf32bfc6ba59fe3d49f879c | App/venv/lib/python3.7/site-packages/pip/_vendor/requests/models.py | python | Response.json | (self, **kwargs) | return complexjson.loads(self.text, **kwargs) | r"""Returns the json-encoded content of a response, if any.
:param \*\*kwargs: Optional arguments that ``json.loads`` takes.
:raises ValueError: If the response body does not contain valid json. | r"""Returns the json-encoded content of a response, if any. | [
"r",
"Returns",
"the",
"json",
"-",
"encoded",
"content",
"of",
"a",
"response",
"if",
"any",
"."
] | def json(self, **kwargs):
r"""Returns the json-encoded content of a response, if any.
:param \*\*kwargs: Optional arguments that ``json.loads`` takes.
:raises ValueError: If the response body does not contain valid json.
"""
if not self.encoding and self.content and len(self.co... | [
"def",
"json",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"not",
"self",
".",
"encoding",
"and",
"self",
".",
"content",
"and",
"len",
"(",
"self",
".",
"content",
")",
">",
"3",
":",
"# No encoding set. JSON RFC 4627 section 3 states we should ex... | https://github.com/jgagneastro/coffeegrindsize/blob/22661ebd21831dba4cf32bfc6ba59fe3d49f879c/App/venv/lib/python3.7/site-packages/pip/_vendor/requests/models.py#L873-L897 | |
GoSecure/pyrdp | abd8b8762b6d7fd0e49d4a927b529f892b412743 | pyrdp/parser/rdp/orders/primary.py | python | FastGlyph.__str__ | (self) | return f'<FastGlyph Cache={self.cacheId}:{self.cacheIndex} New={self.glyph != None}>' | [] | def __str__(self):
return f'<FastGlyph Cache={self.cacheId}:{self.cacheIndex} New={self.glyph != None}>' | [
"def",
"__str__",
"(",
"self",
")",
":",
"return",
"f'<FastGlyph Cache={self.cacheId}:{self.cacheIndex} New={self.glyph != None}>'"
] | https://github.com/GoSecure/pyrdp/blob/abd8b8762b6d7fd0e49d4a927b529f892b412743/pyrdp/parser/rdp/orders/primary.py#L1081-L1082 | |||
kevoreilly/CAPEv2 | 6cf79c33264624b3604d4cd432cde2a6b4536de6 | lib/cuckoo/common/abstracts.py | python | Signature.check_argument_call | (self, call, pattern, name=None, api=None, category=None, regex=False, all=False, ignorecase=False) | return False | Checks for a specific argument of an invoked API.
@param call: API call information.
@param pattern: string or expression to check for.
@param name: optional filter for the argument name.
@param api: optional filter for the API function name.
@param category: optional filter for ... | Checks for a specific argument of an invoked API. | [
"Checks",
"for",
"a",
"specific",
"argument",
"of",
"an",
"invoked",
"API",
"."
] | def check_argument_call(self, call, pattern, name=None, api=None, category=None, regex=False, all=False, ignorecase=False):
"""Checks for a specific argument of an invoked API.
@param call: API call information.
@param pattern: string or expression to check for.
@param name: optional fil... | [
"def",
"check_argument_call",
"(",
"self",
",",
"call",
",",
"pattern",
",",
"name",
"=",
"None",
",",
"api",
"=",
"None",
",",
"category",
"=",
"None",
",",
"regex",
"=",
"False",
",",
"all",
"=",
"False",
",",
"ignorecase",
"=",
"False",
")",
":",
... | https://github.com/kevoreilly/CAPEv2/blob/6cf79c33264624b3604d4cd432cde2a6b4536de6/lib/cuckoo/common/abstracts.py#L1201-L1248 | |
saltstack/salt | fae5bc757ad0f1716483ce7ae180b451545c2058 | salt/ext/tornado/http1connection.py | python | HTTP1Connection.finish | (self) | Implements `.HTTPConnection.finish`. | Implements `.HTTPConnection.finish`. | [
"Implements",
".",
"HTTPConnection",
".",
"finish",
"."
] | def finish(self):
"""Implements `.HTTPConnection.finish`."""
if (self._expected_content_remaining is not None and
self._expected_content_remaining != 0 and
not self.stream.closed()):
self.stream.close()
raise httputil.HTTPOutputError(
... | [
"def",
"finish",
"(",
"self",
")",
":",
"if",
"(",
"self",
".",
"_expected_content_remaining",
"is",
"not",
"None",
"and",
"self",
".",
"_expected_content_remaining",
"!=",
"0",
"and",
"not",
"self",
".",
"stream",
".",
"closed",
"(",
")",
")",
":",
"sel... | https://github.com/saltstack/salt/blob/fae5bc757ad0f1716483ce7ae180b451545c2058/salt/ext/tornado/http1connection.py#L442-L469 | ||
Source-Python-Dev-Team/Source.Python | d0ffd8ccbd1e9923c9bc44936f20613c1c76b7fb | addons/source-python/Python3/pickletools.py | python | read_floatnl | (f) | return float(s) | r"""
>>> import io
>>> read_floatnl(io.BytesIO(b"-1.25\n6"))
-1.25 | r"""
>>> import io
>>> read_floatnl(io.BytesIO(b"-1.25\n6"))
-1.25 | [
"r",
">>>",
"import",
"io",
">>>",
"read_floatnl",
"(",
"io",
".",
"BytesIO",
"(",
"b",
"-",
"1",
".",
"25",
"\\",
"n6",
"))",
"-",
"1",
".",
"25"
] | def read_floatnl(f):
r"""
>>> import io
>>> read_floatnl(io.BytesIO(b"-1.25\n6"))
-1.25
"""
s = read_stringnl(f, decode=False, stripquotes=False)
return float(s) | [
"def",
"read_floatnl",
"(",
"f",
")",
":",
"s",
"=",
"read_stringnl",
"(",
"f",
",",
"decode",
"=",
"False",
",",
"stripquotes",
"=",
"False",
")",
"return",
"float",
"(",
"s",
")"
] | https://github.com/Source-Python-Dev-Team/Source.Python/blob/d0ffd8ccbd1e9923c9bc44936f20613c1c76b7fb/addons/source-python/Python3/pickletools.py#L807-L814 | |
huggingface/transformers | 623b4f7c63f60cce917677ee704d6c93ee960b4b | src/transformers/models/tapas/tokenization_tapas.py | python | TapasTokenizer._get_table_values | (self, table, num_columns, num_rows, num_tokens) | Iterates over partial table and returns token, column and row indexes. | Iterates over partial table and returns token, column and row indexes. | [
"Iterates",
"over",
"partial",
"table",
"and",
"returns",
"token",
"column",
"and",
"row",
"indexes",
"."
] | def _get_table_values(self, table, num_columns, num_rows, num_tokens) -> Generator[TableValue, None, None]:
"""Iterates over partial table and returns token, column and row indexes."""
for tc in table.selected_tokens:
# First row is header row.
if tc.row_index >= num_rows + 1:
... | [
"def",
"_get_table_values",
"(",
"self",
",",
"table",
",",
"num_columns",
",",
"num_rows",
",",
"num_tokens",
")",
"->",
"Generator",
"[",
"TableValue",
",",
"None",
",",
"None",
"]",
":",
"for",
"tc",
"in",
"table",
".",
"selected_tokens",
":",
"# First ... | https://github.com/huggingface/transformers/blob/623b4f7c63f60cce917677ee704d6c93ee960b4b/src/transformers/models/tapas/tokenization_tapas.py#L1378-L1395 | ||
splunk/splunk-ansible | dea9c71ffb58db113a6841e508595b89a7c57151 | inventory/environ.py | python | parseUrl | (url, vars_scope) | return "{}://{}:{}".format(scheme, hostname, port) | Parses role URL to handle non-default schemes, ports, etc. | Parses role URL to handle non-default schemes, ports, etc. | [
"Parses",
"role",
"URL",
"to",
"handle",
"non",
"-",
"default",
"schemes",
"ports",
"etc",
"."
] | def parseUrl(url, vars_scope):
"""
Parses role URL to handle non-default schemes, ports, etc.
"""
if not url:
return ""
scheme = vars_scope.get("cert_prefix", "https")
port = vars_scope["splunk"].get("svc_port", 8089)
parsed = urlparse(url)
# If netloc exists, we should consider... | [
"def",
"parseUrl",
"(",
"url",
",",
"vars_scope",
")",
":",
"if",
"not",
"url",
":",
"return",
"\"\"",
"scheme",
"=",
"vars_scope",
".",
"get",
"(",
"\"cert_prefix\"",
",",
"\"https\"",
")",
"port",
"=",
"vars_scope",
"[",
"\"splunk\"",
"]",
".",
"get",
... | https://github.com/splunk/splunk-ansible/blob/dea9c71ffb58db113a6841e508595b89a7c57151/inventory/environ.py#L619-L644 | |
johnzero7/XNALaraMesh | 8d01dadec08ccda9558c3faf292fc214dfcd8102 | import_obj.py | python | create_nurbs | (context_nurbs, vert_loc, new_objects) | Add nurbs object to blender, only support one type at the moment | Add nurbs object to blender, only support one type at the moment | [
"Add",
"nurbs",
"object",
"to",
"blender",
"only",
"support",
"one",
"type",
"at",
"the",
"moment"
] | def create_nurbs(context_nurbs, vert_loc, new_objects):
"""
Add nurbs object to blender, only support one type at the moment
"""
deg = context_nurbs.get(b'deg', (3,))
curv_range = context_nurbs.get(b'curv_range')
curv_idx = context_nurbs.get(b'curv_idx', [])
parm_u = context_nurbs.get(b'parm... | [
"def",
"create_nurbs",
"(",
"context_nurbs",
",",
"vert_loc",
",",
"new_objects",
")",
":",
"deg",
"=",
"context_nurbs",
".",
"get",
"(",
"b'deg'",
",",
"(",
"3",
",",
")",
")",
"curv_range",
"=",
"context_nurbs",
".",
"get",
"(",
"b'curv_range'",
")",
"... | https://github.com/johnzero7/XNALaraMesh/blob/8d01dadec08ccda9558c3faf292fc214dfcd8102/import_obj.py#L956-L1026 | ||
pwnieexpress/pwn_plug_sources | 1a23324f5dc2c3de20f9c810269b6a29b2758cad | src/fimap/xgoogle/BeautifulSoup.py | python | PageElement.previousGenerator | (self) | [] | def previousGenerator(self):
i = self
while i:
i = i.previous
yield i | [
"def",
"previousGenerator",
"(",
"self",
")",
":",
"i",
"=",
"self",
"while",
"i",
":",
"i",
"=",
"i",
".",
"previous",
"yield",
"i"
] | https://github.com/pwnieexpress/pwn_plug_sources/blob/1a23324f5dc2c3de20f9c810269b6a29b2758cad/src/fimap/xgoogle/BeautifulSoup.py#L351-L355 | ||||
minio/minio-py | b3ba3bf99fe6b9ff2b28855550d6ab5345c134e3 | minio/xml.py | python | findtext | (element, name, strict=False) | return element.text or "" | Namespace aware ElementTree.Element.findtext() with strict flag
raises ValueError if element name not exist. | Namespace aware ElementTree.Element.findtext() with strict flag
raises ValueError if element name not exist. | [
"Namespace",
"aware",
"ElementTree",
".",
"Element",
".",
"findtext",
"()",
"with",
"strict",
"flag",
"raises",
"ValueError",
"if",
"element",
"name",
"not",
"exist",
"."
] | def findtext(element, name, strict=False):
"""
Namespace aware ElementTree.Element.findtext() with strict flag
raises ValueError if element name not exist.
"""
element = find(element, name)
if element is None:
if strict:
raise ValueError(f"XML element <{name}> not found")
... | [
"def",
"findtext",
"(",
"element",
",",
"name",
",",
"strict",
"=",
"False",
")",
":",
"element",
"=",
"find",
"(",
"element",
",",
"name",
")",
"if",
"element",
"is",
"None",
":",
"if",
"strict",
":",
"raise",
"ValueError",
"(",
"f\"XML element <{name}>... | https://github.com/minio/minio-py/blob/b3ba3bf99fe6b9ff2b28855550d6ab5345c134e3/minio/xml.py#L70-L80 | |
csababarta/ntdsxtract | 7fa1c8c28cbbf97a42bef40f20009dba85e4c25f | framework/addrspace.py | python | HiveFileAddressSpace.is_valid_address | (self, vaddr) | return self.base.is_valid_address(paddr) | [] | def is_valid_address(self, vaddr):
paddr = self.vtop(vaddr)
if not paddr: return False
return self.base.is_valid_address(paddr) | [
"def",
"is_valid_address",
"(",
"self",
",",
"vaddr",
")",
":",
"paddr",
"=",
"self",
".",
"vtop",
"(",
"vaddr",
")",
"if",
"not",
"paddr",
":",
"return",
"False",
"return",
"self",
".",
"base",
".",
"is_valid_address",
"(",
"paddr",
")"
] | https://github.com/csababarta/ntdsxtract/blob/7fa1c8c28cbbf97a42bef40f20009dba85e4c25f/framework/addrspace.py#L138-L141 | |||
securesystemslab/zippy | ff0e84ac99442c2c55fe1d285332cfd4e185e089 | zippy/benchmarks/src/benchmarks/sympy/sympy/combinatorics/permutations.py | python | Permutation.transpositions | (self) | return res | Return the permutation decomposed into a list of transpositions.
It is always possible to express a permutation as the product of
transpositions, see [1]
Examples
========
>>> from sympy.combinatorics.permutations import Permutation
>>> p = Permutation([[1, 2, 3], [0, ... | Return the permutation decomposed into a list of transpositions. | [
"Return",
"the",
"permutation",
"decomposed",
"into",
"a",
"list",
"of",
"transpositions",
"."
] | def transpositions(self):
"""
Return the permutation decomposed into a list of transpositions.
It is always possible to express a permutation as the product of
transpositions, see [1]
Examples
========
>>> from sympy.combinatorics.permutations import Permutatio... | [
"def",
"transpositions",
"(",
"self",
")",
":",
"a",
"=",
"self",
".",
"cyclic_form",
"res",
"=",
"[",
"]",
"for",
"x",
"in",
"a",
":",
"nx",
"=",
"len",
"(",
"x",
")",
"if",
"nx",
"==",
"2",
":",
"res",
".",
"append",
"(",
"tuple",
"(",
"x",... | https://github.com/securesystemslab/zippy/blob/ff0e84ac99442c2c55fe1d285332cfd4e185e089/zippy/benchmarks/src/benchmarks/sympy/sympy/combinatorics/permutations.py#L1392-L1428 | |
cisco/mindmeld | 809c36112e9ea8019fe29d54d136ca14eb4fd8db | mindmeld/models/helpers.py | python | ingest_dynamic_gazetteer | (resource, dynamic_resource=None, text_preparation_pipeline=None) | return workspace_resource | Ingests dynamic gazetteers from the app and adds them to the resource
Args:
resource (dict): The original resource
dynamic_resource (dict, optional): The dynamic resource that needs to be ingested
text_preparation_pipeline (TextPreparationPipeline): For text tokenization and normalization
... | Ingests dynamic gazetteers from the app and adds them to the resource | [
"Ingests",
"dynamic",
"gazetteers",
"from",
"the",
"app",
"and",
"adds",
"them",
"to",
"the",
"resource"
] | def ingest_dynamic_gazetteer(resource, dynamic_resource=None, text_preparation_pipeline=None):
"""Ingests dynamic gazetteers from the app and adds them to the resource
Args:
resource (dict): The original resource
dynamic_resource (dict, optional): The dynamic resource that needs to be ingested
... | [
"def",
"ingest_dynamic_gazetteer",
"(",
"resource",
",",
"dynamic_resource",
"=",
"None",
",",
"text_preparation_pipeline",
"=",
"None",
")",
":",
"if",
"not",
"dynamic_resource",
"or",
"GAZETTEER_RSC",
"not",
"in",
"dynamic_resource",
":",
"return",
"resource",
"te... | https://github.com/cisco/mindmeld/blob/809c36112e9ea8019fe29d54d136ca14eb4fd8db/mindmeld/models/helpers.py#L483-L503 | |
AnalogJ/lexicon | c7bedfed6ed34c96950954933b07ca3ce081d0e5 | lexicon/providers/zonomi.py | python | provider_parser | (subparser) | Configure provider parser for Zonomi | Configure provider parser for Zonomi | [
"Configure",
"provider",
"parser",
"for",
"Zonomi"
] | def provider_parser(subparser):
"""Configure provider parser for Zonomi"""
subparser.add_argument("--auth-token", help="specify token for authentication")
subparser.add_argument(
"--auth-entrypoint",
help="use Zonomi or Rimuhosting API",
choices=["zonomi", "rimuhosting"],
) | [
"def",
"provider_parser",
"(",
"subparser",
")",
":",
"subparser",
".",
"add_argument",
"(",
"\"--auth-token\"",
",",
"help",
"=",
"\"specify token for authentication\"",
")",
"subparser",
".",
"add_argument",
"(",
"\"--auth-entrypoint\"",
",",
"help",
"=",
"\"use Zon... | https://github.com/AnalogJ/lexicon/blob/c7bedfed6ed34c96950954933b07ca3ce081d0e5/lexicon/providers/zonomi.py#L38-L45 | ||
AndroBugs/AndroBugs_Framework | 7fd3a2cb1cf65a9af10b7ed2129701d4451493fe | tools/modified/androguard/core/bytecodes/dvm.py | python | Instruction31c.get_string | (self) | return get_kind(self.cm, self.get_kind(), self.BBBBBBBB) | Return the string associated to the 'kind' argument
:rtype: string | Return the string associated to the 'kind' argument | [
"Return",
"the",
"string",
"associated",
"to",
"the",
"kind",
"argument"
] | def get_string(self):
"""
Return the string associated to the 'kind' argument
:rtype: string
"""
return get_kind(self.cm, self.get_kind(), self.BBBBBBBB) | [
"def",
"get_string",
"(",
"self",
")",
":",
"return",
"get_kind",
"(",
"self",
".",
"cm",
",",
"self",
".",
"get_kind",
"(",
")",
",",
"self",
".",
"BBBBBBBB",
")"
] | https://github.com/AndroBugs/AndroBugs_Framework/blob/7fd3a2cb1cf65a9af10b7ed2129701d4451493fe/tools/modified/androguard/core/bytecodes/dvm.py#L4726-L4732 | |
blampe/IbPy | cba912d2ecc669b0bf2980357ea7942e49c0825e | ib/ext/ScannerSubscription.py | python | ScannerSubscription.couponRateBelow_0 | (self, r) | generated source for method couponRateBelow_0 | generated source for method couponRateBelow_0 | [
"generated",
"source",
"for",
"method",
"couponRateBelow_0"
] | def couponRateBelow_0(self, r):
""" generated source for method couponRateBelow_0 """
self.m_couponRateBelow = r | [
"def",
"couponRateBelow_0",
"(",
"self",
",",
"r",
")",
":",
"self",
".",
"m_couponRateBelow",
"=",
"r"
] | https://github.com/blampe/IbPy/blob/cba912d2ecc669b0bf2980357ea7942e49c0825e/ib/ext/ScannerSubscription.py#L230-L232 | ||
ukBaz/python-bluezero | e6b4e96342de6c66571a6660d711c018f8c6b470 | bluezero/microbit.py | python | Microbit.accelerometer | (self) | return tools.bytes_to_xyz(accel_bytes) | Read the values of the accelerometer on the microbit
:return: return a list in the order of x, y & z | Read the values of the accelerometer on the microbit | [
"Read",
"the",
"values",
"of",
"the",
"accelerometer",
"on",
"the",
"microbit"
] | def accelerometer(self):
"""
Read the values of the accelerometer on the microbit
:return: return a list in the order of x, y & z
"""
# [16, 0, 64, 0, 32, 252]
# x=0.16, y=0.024, z=-0.992
accel_bytes = self._accel_data.value
return tools.bytes_to_xyz(acc... | [
"def",
"accelerometer",
"(",
"self",
")",
":",
"# [16, 0, 64, 0, 32, 252]",
"# x=0.16, y=0.024, z=-0.992",
"accel_bytes",
"=",
"self",
".",
"_accel_data",
".",
"value",
"return",
"tools",
".",
"bytes_to_xyz",
"(",
"accel_bytes",
")"
] | https://github.com/ukBaz/python-bluezero/blob/e6b4e96342de6c66571a6660d711c018f8c6b470/bluezero/microbit.py#L382-L392 | |
lad1337/XDM | 0c1b7009fe00f06f102a6f67c793478f515e7efe | site-packages/babel/plural.py | python | _unary_compiler | (tmpl) | return lambda self, x: tmpl % self.compile(x) | Compiler factory for the `_Compiler`. | Compiler factory for the `_Compiler`. | [
"Compiler",
"factory",
"for",
"the",
"_Compiler",
"."
] | def _unary_compiler(tmpl):
"""Compiler factory for the `_Compiler`."""
return lambda self, x: tmpl % self.compile(x) | [
"def",
"_unary_compiler",
"(",
"tmpl",
")",
":",
"return",
"lambda",
"self",
",",
"x",
":",
"tmpl",
"%",
"self",
".",
"compile",
"(",
"x",
")"
] | https://github.com/lad1337/XDM/blob/0c1b7009fe00f06f102a6f67c793478f515e7efe/site-packages/babel/plural.py#L389-L391 | |
Fallen-Breath/MCDReforged | fdb1d2520b35f916123f265dbd94603981bb2b0c | mcdreforged/command/builder/nodes/arguments.py | python | TextNode.at_min_length | (self, min_length) | return self | [] | def at_min_length(self, min_length) -> 'TextNode':
self.__min_length = min_length
return self | [
"def",
"at_min_length",
"(",
"self",
",",
"min_length",
")",
"->",
"'TextNode'",
":",
"self",
".",
"__min_length",
"=",
"min_length",
"return",
"self"
] | https://github.com/Fallen-Breath/MCDReforged/blob/fdb1d2520b35f916123f265dbd94603981bb2b0c/mcdreforged/command/builder/nodes/arguments.py#L89-L91 | |||
HenriWahl/Nagstamon | 16549c6860b51a93141d84881c6ad28c35d8581e | Nagstamon/Servers/Thruk.py | python | ThrukServer.open_monitor | (self, host, service='') | open monitor from tablewidget context menu | open monitor from tablewidget context menu | [
"open",
"monitor",
"from",
"tablewidget",
"context",
"menu"
] | def open_monitor(self, host, service=''):
'''
open monitor from tablewidget context menu
'''
# only type is important so do not care of service '' in case of host monitor
if service == '':
url = self.monitor_cgi_url + '/extinfo.cgi?type=1&' + urllib.parse.urlencod... | [
"def",
"open_monitor",
"(",
"self",
",",
"host",
",",
"service",
"=",
"''",
")",
":",
"# only type is important so do not care of service '' in case of host monitor",
"if",
"service",
"==",
"''",
":",
"url",
"=",
"self",
".",
"monitor_cgi_url",
"+",
"'/extinfo.cgi?typ... | https://github.com/HenriWahl/Nagstamon/blob/16549c6860b51a93141d84881c6ad28c35d8581e/Nagstamon/Servers/Thruk.py#L139-L152 | ||
andresriancho/w3af | cd22e5252243a87aaa6d0ddea47cf58dacfe00a9 | w3af/core/controllers/core_helpers/status.py | python | CoreStatus.get_grep_output_speed | (self) | return 0 if gc is None else gc.in_queue.get_output_rpm() | [] | def get_grep_output_speed(self):
gc = self._w3af_core.strategy.get_grep_consumer()
return 0 if gc is None else gc.in_queue.get_output_rpm() | [
"def",
"get_grep_output_speed",
"(",
"self",
")",
":",
"gc",
"=",
"self",
".",
"_w3af_core",
".",
"strategy",
".",
"get_grep_consumer",
"(",
")",
"return",
"0",
"if",
"gc",
"is",
"None",
"else",
"gc",
".",
"in_queue",
".",
"get_output_rpm",
"(",
")"
] | https://github.com/andresriancho/w3af/blob/cd22e5252243a87aaa6d0ddea47cf58dacfe00a9/w3af/core/controllers/core_helpers/status.py#L289-L291 | |||
uclatommy/tweetfeels | 6ad8ebf64cef73c0b932614b7780e6c67902333f | tweetfeels/tweetlistener.py | python | TweetListener.reconnect_wait | (self, pattern) | Calculates an appropriate waiting time prior to attempting reconnect.
:param pattern: The type of reconnect waiting pattern dependent on type
of error or disconnect. | Calculates an appropriate waiting time prior to attempting reconnect. | [
"Calculates",
"an",
"appropriate",
"waiting",
"time",
"prior",
"to",
"attempting",
"reconnect",
"."
] | def reconnect_wait(self, pattern):
"""
Calculates an appropriate waiting time prior to attempting reconnect.
:param pattern: The type of reconnect waiting pattern dependent on type
of error or disconnect.
"""
if pattern == 'linear':
time.sleep... | [
"def",
"reconnect_wait",
"(",
"self",
",",
"pattern",
")",
":",
"if",
"pattern",
"==",
"'linear'",
":",
"time",
".",
"sleep",
"(",
"self",
".",
"_waited",
")",
"self",
".",
"_waited",
"+=",
"1",
"elif",
"pattern",
"==",
"'exponential'",
":",
"time",
".... | https://github.com/uclatommy/tweetfeels/blob/6ad8ebf64cef73c0b932614b7780e6c67902333f/tweetfeels/tweetlistener.py#L129-L141 | ||
numenta/numenta-apps | 02903b0062c89c2c259b533eea2df6e8bb44eaf3 | nta.utils/nta/utils/amqp/synchronous_amqp_client.py | python | SynchronousAmqpClient._makeConsumerMessage | (cls, haighaMessage, ackImpl, nackImpl) | return amqp_messages.ConsumerMessage(
body=cls._decodeMessageBody(haighaMessage.body),
properties=cls._makeBasicProperties(haighaMessage.properties),
methodInfo=methodInfo,
ackImpl=ackImpl,
nackImpl=nackImpl) | Make ConsumerMessage from haigha message received via Basic.Deliver
:param haigha.message.Message haighaMessage: haigha message received via
Basic.Deliver
:param ackImpl: callable for acking the message that has the following
signature: ackImpl(deliveryTag, multiple=False); or None
:param nackI... | Make ConsumerMessage from haigha message received via Basic.Deliver | [
"Make",
"ConsumerMessage",
"from",
"haigha",
"message",
"received",
"via",
"Basic",
".",
"Deliver"
] | def _makeConsumerMessage(cls, haighaMessage, ackImpl, nackImpl):
"""Make ConsumerMessage from haigha message received via Basic.Deliver
:param haigha.message.Message haighaMessage: haigha message received via
Basic.Deliver
:param ackImpl: callable for acking the message that has the following
s... | [
"def",
"_makeConsumerMessage",
"(",
"cls",
",",
"haighaMessage",
",",
"ackImpl",
",",
"nackImpl",
")",
":",
"info",
"=",
"haighaMessage",
".",
"delivery_info",
"methodInfo",
"=",
"amqp_messages",
".",
"MessageDeliveryInfo",
"(",
"consumerTag",
"=",
"info",
"[",
... | https://github.com/numenta/numenta-apps/blob/02903b0062c89c2c259b533eea2df6e8bb44eaf3/nta.utils/nta/utils/amqp/synchronous_amqp_client.py#L1006-L1033 | |
securesystemslab/zippy | ff0e84ac99442c2c55fe1d285332cfd4e185e089 | zippy/benchmarks/src/benchmarks/python-chess-0.1.0/chess/__init__.py | python | Bitboard.piece_at | (self, square) | Gets the piece at the given square. | Gets the piece at the given square. | [
"Gets",
"the",
"piece",
"at",
"the",
"given",
"square",
"."
] | def piece_at(self, square):
"""Gets the piece at the given square."""
mask = BB_SQUARES[square]
color = int(bool(self.occupied_co[BLACK] & mask))
if mask & self.pawns:
return Piece(PAWN, color)
elif mask & self.knights:
return Piece(KNIGHT, color)
... | [
"def",
"piece_at",
"(",
"self",
",",
"square",
")",
":",
"mask",
"=",
"BB_SQUARES",
"[",
"square",
"]",
"color",
"=",
"int",
"(",
"bool",
"(",
"self",
".",
"occupied_co",
"[",
"BLACK",
"]",
"&",
"mask",
")",
")",
"if",
"mask",
"&",
"self",
".",
"... | https://github.com/securesystemslab/zippy/blob/ff0e84ac99442c2c55fe1d285332cfd4e185e089/zippy/benchmarks/src/benchmarks/python-chess-0.1.0/chess/__init__.py#L941-L957 | ||
holzschu/Carnets | 44effb10ddfc6aa5c8b0687582a724ba82c6b547 | Library/lib/python3.7/site-packages/ipython_genutils/path.py | python | filefind | (filename, path_dirs=None) | Find a file by looking through a sequence of paths.
This iterates through a sequence of paths looking for a file and returns
the full, absolute path of the first occurence of the file. If no set of
path dirs is given, the filename is tested as is, after running through
:func:`expandvars` and :func:`ex... | Find a file by looking through a sequence of paths. | [
"Find",
"a",
"file",
"by",
"looking",
"through",
"a",
"sequence",
"of",
"paths",
"."
] | def filefind(filename, path_dirs=None):
"""Find a file by looking through a sequence of paths.
This iterates through a sequence of paths looking for a file and returns
the full, absolute path of the first occurence of the file. If no set of
path dirs is given, the filename is tested as is, after runni... | [
"def",
"filefind",
"(",
"filename",
",",
"path_dirs",
"=",
"None",
")",
":",
"# If paths are quoted, abspath gets confused, strip them...",
"filename",
"=",
"filename",
".",
"strip",
"(",
"'\"'",
")",
".",
"strip",
"(",
"\"'\"",
")",
"# If the input is an absolute pat... | https://github.com/holzschu/Carnets/blob/44effb10ddfc6aa5c8b0687582a724ba82c6b547/Library/lib/python3.7/site-packages/ipython_genutils/path.py#L21-L72 | ||
paulwinex/pw_MultiScriptEditor | e447e99f87cb07e238baf693b7e124e50efdbc51 | multi_script_editor/managers/nuke/main.py | python | value | (knob, default) | return '' | value(knob, default) -> string.
The value function returns the current value of a knob. The knob argument is a string referring to a knob and default is an optional default value to be returned in case of an error. Unlike knob(), this will evaluate animation at the current frame, and expand brackets and dollar signs i... | value(knob, default) -> string. | [
"value",
"(",
"knob",
"default",
")",
"-",
">",
"string",
"."
] | def value(knob, default):
"""value(knob, default) -> string.
The value function returns the current value of a knob. The knob argument is a string referring to a knob and default is an optional default value to be returned in case of an error. Unlike knob(), this will evaluate animation at the current frame, and e... | [
"def",
"value",
"(",
"knob",
",",
"default",
")",
":",
"return",
"''"
] | https://github.com/paulwinex/pw_MultiScriptEditor/blob/e447e99f87cb07e238baf693b7e124e50efdbc51/multi_script_editor/managers/nuke/main.py#L6319-L6323 | |
Map-A-Droid/MAD | 81375b5c9ccc5ca3161eb487aa81469d40ded221 | mapadroid/worker/WorkerBase.py | python | WorkerBase._wait_pogo_start_delay | (self) | [] | def _wait_pogo_start_delay(self):
delay_count: int = 0
pogo_start_delay: int = self.get_devicesettings_value("post_pogo_start_delay", 60)
self.logger.info('Waiting for pogo start: {} seconds', pogo_start_delay)
while delay_count <= pogo_start_delay:
if not self._mapping_mana... | [
"def",
"_wait_pogo_start_delay",
"(",
"self",
")",
":",
"delay_count",
":",
"int",
"=",
"0",
"pogo_start_delay",
":",
"int",
"=",
"self",
".",
"get_devicesettings_value",
"(",
"\"post_pogo_start_delay\"",
",",
"60",
")",
"self",
".",
"logger",
".",
"info",
"("... | https://github.com/Map-A-Droid/MAD/blob/81375b5c9ccc5ca3161eb487aa81469d40ded221/mapadroid/worker/WorkerBase.py#L955-L966 | ||||
rowliny/DiffHelper | ab3a96f58f9579d0023aed9ebd785f4edf26f8af | Tool/SitePackages/pycodestyle.py | python | Checker.check_logical | (self) | Build a line from tokens and run all logical checks on it. | Build a line from tokens and run all logical checks on it. | [
"Build",
"a",
"line",
"from",
"tokens",
"and",
"run",
"all",
"logical",
"checks",
"on",
"it",
"."
] | def check_logical(self):
"""Build a line from tokens and run all logical checks on it."""
self.report.increment_logical_line()
mapping = self.build_tokens_line()
if not mapping:
return
mapping_offsets = [offset for offset, _ in mapping]
(start_row, start_col)... | [
"def",
"check_logical",
"(",
"self",
")",
":",
"self",
".",
"report",
".",
"increment_logical_line",
"(",
")",
"mapping",
"=",
"self",
".",
"build_tokens_line",
"(",
")",
"if",
"not",
"mapping",
":",
"return",
"mapping_offsets",
"=",
"[",
"offset",
"for",
... | https://github.com/rowliny/DiffHelper/blob/ab3a96f58f9579d0023aed9ebd785f4edf26f8af/Tool/SitePackages/pycodestyle.py#L2085-L2118 | ||
Jenyay/outwiker | 50530cf7b3f71480bb075b2829bc0669773b835b | plugins/htmlheads/htmlheads/controller.py | python | Controller.destroy | (self) | Вызывается при отключении плагина | Вызывается при отключении плагина | [
"Вызывается",
"при",
"отключении",
"плагина"
] | def destroy(self):
"""
Вызывается при отключении плагина
"""
self._application.onWikiParserPrepare -= self.__onWikiParserPrepare
self._destroy_guicontroller() | [
"def",
"destroy",
"(",
"self",
")",
":",
"self",
".",
"_application",
".",
"onWikiParserPrepare",
"-=",
"self",
".",
"__onWikiParserPrepare",
"self",
".",
"_destroy_guicontroller",
"(",
")"
] | https://github.com/Jenyay/outwiker/blob/50530cf7b3f71480bb075b2829bc0669773b835b/plugins/htmlheads/htmlheads/controller.py#L79-L84 | ||
F8LEFT/DecLLVM | d38e45e3d0dd35634adae1d0cf7f96f3bd96e74c | python/idaapi.py | python | argloc_t._set_biggest | (self, *args) | return _idaapi.argloc_t__set_biggest(self, *args) | _set_biggest(self, ct, data) | _set_biggest(self, ct, data) | [
"_set_biggest",
"(",
"self",
"ct",
"data",
")"
] | def _set_biggest(self, *args):
"""
_set_biggest(self, ct, data)
"""
return _idaapi.argloc_t__set_biggest(self, *args) | [
"def",
"_set_biggest",
"(",
"self",
",",
"*",
"args",
")",
":",
"return",
"_idaapi",
".",
"argloc_t__set_biggest",
"(",
"self",
",",
"*",
"args",
")"
] | https://github.com/F8LEFT/DecLLVM/blob/d38e45e3d0dd35634adae1d0cf7f96f3bd96e74c/python/idaapi.py#L29086-L29090 | |
taowen/es-monitor | c4deceb4964857f495d13bfaf2d92f36734c9e1c | es_sql/sqlparse/sql_select.py | python | get_indices | (index_pattern, from_datetime=None, to_datetime=None) | [] | def get_indices(index_pattern, from_datetime=None, to_datetime=None):
if from_datetime:
prefix, delimiter, datetime_pattern = index_pattern.partition('%')
if not delimiter:
raise Exception('missing datetime pattern in %s' % index_pattern)
datetime_pattern = '%' + datetime_pattern... | [
"def",
"get_indices",
"(",
"index_pattern",
",",
"from_datetime",
"=",
"None",
",",
"to_datetime",
"=",
"None",
")",
":",
"if",
"from_datetime",
":",
"prefix",
",",
"delimiter",
",",
"datetime_pattern",
"=",
"index_pattern",
".",
"partition",
"(",
"'%'",
")",
... | https://github.com/taowen/es-monitor/blob/c4deceb4964857f495d13bfaf2d92f36734c9e1c/es_sql/sqlparse/sql_select.py#L289-L319 | ||||
sunnyxiaohu/R-C3D.pytorch | e8731af7b95f1dc934f6604f9c09e3c4ead74db5 | lib/tf_model_zoo/inceptionresnetv2/pytorch_load.py | python | inceptionresnetv2 | (pretrained=True) | return model | r"""InceptionResnetV2 model architecture from the
`"InceptionV4, Inception-ResNet..." <https://arxiv.org/abs/1602.07261>`_ paper.
Args:
pretrained ('string'): If True, returns a model pre-trained on ImageNet | r"""InceptionResnetV2 model architecture from the
`"InceptionV4, Inception-ResNet..." <https://arxiv.org/abs/1602.07261>`_ paper. | [
"r",
"InceptionResnetV2",
"model",
"architecture",
"from",
"the",
"InceptionV4",
"Inception",
"-",
"ResNet",
"...",
"<https",
":",
"//",
"arxiv",
".",
"org",
"/",
"abs",
"/",
"1602",
".",
"07261",
">",
"_",
"paper",
"."
] | def inceptionresnetv2(pretrained=True):
r"""InceptionResnetV2 model architecture from the
`"InceptionV4, Inception-ResNet..." <https://arxiv.org/abs/1602.07261>`_ paper.
Args:
pretrained ('string'): If True, returns a model pre-trained on ImageNet
"""
model = InceptionResnetV2()
if pret... | [
"def",
"inceptionresnetv2",
"(",
"pretrained",
"=",
"True",
")",
":",
"model",
"=",
"InceptionResnetV2",
"(",
")",
"if",
"pretrained",
":",
"model",
".",
"load_state_dict",
"(",
"model_zoo",
".",
"load_url",
"(",
"model_urls",
"[",
"'imagenet'",
"]",
")",
")... | https://github.com/sunnyxiaohu/R-C3D.pytorch/blob/e8731af7b95f1dc934f6604f9c09e3c4ead74db5/lib/tf_model_zoo/inceptionresnetv2/pytorch_load.py#L285-L295 | |
google-research/language | 61fa7260ac7d690d11ef72ca863e45a37c0bdc80 | language/xsp/model/common_layers.py | python | ff_layer | (x, hidden_size, output_size, nonlinearity=tf.nn.relu) | return x | Single hidden-layer feed-forward network.
Args:
x: <float>[batch_size, length, input_size]
hidden_size: Integer number of dimensions for hidden layer.
output_size: Integer number of dimensions for output.
nonlinearity: Function to use for non-linearity.
Returns:
<float>[batch_size, length, out... | Single hidden-layer feed-forward network. | [
"Single",
"hidden",
"-",
"layer",
"feed",
"-",
"forward",
"network",
"."
] | def ff_layer(x, hidden_size, output_size, nonlinearity=tf.nn.relu):
"""Single hidden-layer feed-forward network.
Args:
x: <float>[batch_size, length, input_size]
hidden_size: Integer number of dimensions for hidden layer.
output_size: Integer number of dimensions for output.
nonlinearity: Function ... | [
"def",
"ff_layer",
"(",
"x",
",",
"hidden_size",
",",
"output_size",
",",
"nonlinearity",
"=",
"tf",
".",
"nn",
".",
"relu",
")",
":",
"x",
"=",
"linear_transform",
"(",
"x",
",",
"hidden_size",
",",
"\"ffn_1\"",
",",
"bias",
"=",
"True",
")",
"x",
"... | https://github.com/google-research/language/blob/61fa7260ac7d690d11ef72ca863e45a37c0bdc80/language/xsp/model/common_layers.py#L384-L399 | |
mgear-dev/mgear | 06ddc26c5adb5eab07ca470c7fafa77404c8a1de | scripts/mgear/maya/shifter/component/eye_01/__init__.py | python | Component.addOperators | (self) | Create operators and set the relations for the component rig
Apply operators, constraints, expressions to the hierarchy.
In order to keep the code clean and easier to debug,
we shouldn't create any new object in this method. | Create operators and set the relations for the component rig | [
"Create",
"operators",
"and",
"set",
"the",
"relations",
"for",
"the",
"component",
"rig"
] | def addOperators(self):
"""Create operators and set the relations for the component rig
Apply operators, constraints, expressions to the hierarchy.
In order to keep the code clean and easier to debug,
we shouldn't create any new object in this method.
"""
upvDir = self... | [
"def",
"addOperators",
"(",
"self",
")",
":",
"upvDir",
"=",
"self",
".",
"settings",
"[",
"\"upVectorDirection\"",
"]",
"if",
"upvDir",
"==",
"0",
":",
"upvVec",
"=",
"[",
"1",
",",
"0",
",",
"0",
"]",
"elif",
"upvDir",
"==",
"1",
":",
"upvVec",
"... | https://github.com/mgear-dev/mgear/blob/06ddc26c5adb5eab07ca470c7fafa77404c8a1de/scripts/mgear/maya/shifter/component/eye_01/__init__.py#L90-L113 | ||
linkedin/python-avro-json-serializer | 445f5150e8f85ea5f9a063406686116a98ae802e | avro_json_serializer/__init__.py | python | AvroJsonBase._process_array | (self, schema, datum) | return list(map(process, datum)) | Array is (de)serialized into array.
Every element is processed recursively according to `items` schema.
:param schema: Avro schema of `datum`
:param datum: Data to serialize
:return: serialized array (list) | Array is (de)serialized into array.
Every element is processed recursively according to `items` schema.
:param schema: Avro schema of `datum`
:param datum: Data to serialize
:return: serialized array (list) | [
"Array",
"is",
"(",
"de",
")",
"serialized",
"into",
"array",
".",
"Every",
"element",
"is",
"processed",
"recursively",
"according",
"to",
"items",
"schema",
".",
":",
"param",
"schema",
":",
"Avro",
"schema",
"of",
"datum",
":",
"param",
"datum",
":",
... | def _process_array(self, schema, datum):
"""
Array is (de)serialized into array.
Every element is processed recursively according to `items` schema.
:param schema: Avro schema of `datum`
:param datum: Data to serialize
:return: serialized array (list)
"""
... | [
"def",
"_process_array",
"(",
"self",
",",
"schema",
",",
"datum",
")",
":",
"if",
"datum",
"is",
"None",
":",
"raise",
"AvroTypeException",
"(",
"schema",
",",
"datum",
")",
"process",
"=",
"functools",
".",
"partial",
"(",
"self",
".",
"_process_data",
... | https://github.com/linkedin/python-avro-json-serializer/blob/445f5150e8f85ea5f9a063406686116a98ae802e/avro_json_serializer/__init__.py#L87-L98 | |
gwpy/gwpy | 82becd78d166a32985cb657a54d0d39f6a207739 | gwpy/spectrogram/spectrogram.py | python | Spectrogram.from_spectra | (cls, *spectra, **kwargs) | return Spectrogram(data, **kwargs) | Build a new `Spectrogram` from a list of spectra.
Parameters
----------
*spectra
any number of `~gwpy.frequencyseries.FrequencySeries` series
dt : `float`, `~astropy.units.Quantity`, optional
stride between given spectra
Returns
-------
S... | Build a new `Spectrogram` from a list of spectra. | [
"Build",
"a",
"new",
"Spectrogram",
"from",
"a",
"list",
"of",
"spectra",
"."
] | def from_spectra(cls, *spectra, **kwargs):
"""Build a new `Spectrogram` from a list of spectra.
Parameters
----------
*spectra
any number of `~gwpy.frequencyseries.FrequencySeries` series
dt : `float`, `~astropy.units.Quantity`, optional
stride between gi... | [
"def",
"from_spectra",
"(",
"cls",
",",
"*",
"spectra",
",",
"*",
"*",
"kwargs",
")",
":",
"data",
"=",
"numpy",
".",
"vstack",
"(",
"[",
"s",
".",
"value",
"for",
"s",
"in",
"spectra",
"]",
")",
"spec1",
"=",
"list",
"(",
"spectra",
")",
"[",
... | https://github.com/gwpy/gwpy/blob/82becd78d166a32985cb657a54d0d39f6a207739/gwpy/spectrogram/spectrogram.py#L357-L397 | |
IBM/lale | b4d6829c143a4735b06083a0e6c70d2cca244162 | lale/type_checking.py | python | _get_args_schema | (fun) | return result | [] | def _get_args_schema(fun):
sig = inspect.signature(fun)
result = {"type": "object", "properties": {}}
required = []
additional_properties = False
for name, param in sig.parameters.items():
ignored_kinds = [
inspect.Parameter.VAR_POSITIONAL,
inspect.Parameter.VAR_KEYWO... | [
"def",
"_get_args_schema",
"(",
"fun",
")",
":",
"sig",
"=",
"inspect",
".",
"signature",
"(",
"fun",
")",
"result",
"=",
"{",
"\"type\"",
":",
"\"object\"",
",",
"\"properties\"",
":",
"{",
"}",
"}",
"required",
"=",
"[",
"]",
"additional_properties",
"... | https://github.com/IBM/lale/blob/b4d6829c143a4735b06083a0e6c70d2cca244162/lale/type_checking.py#L375-L399 | |||
twilio/twilio-python | 6e1e811ea57a1edfadd5161ace87397c563f6915 | twilio/rest/taskrouter/v1/workspace/task_channel.py | python | TaskChannelContext.update | (self, friendly_name=values.unset,
channel_optimized_routing=values.unset) | return TaskChannelInstance(
self._version,
payload,
workspace_sid=self._solution['workspace_sid'],
sid=self._solution['sid'],
) | Update the TaskChannelInstance
:param unicode friendly_name: A string to describe the Task Channel resource
:param bool channel_optimized_routing: Whether the TaskChannel should prioritize Workers that have been idle
:returns: The updated TaskChannelInstance
:rtype: twilio.rest.taskrou... | Update the TaskChannelInstance | [
"Update",
"the",
"TaskChannelInstance"
] | def update(self, friendly_name=values.unset,
channel_optimized_routing=values.unset):
"""
Update the TaskChannelInstance
:param unicode friendly_name: A string to describe the Task Channel resource
:param bool channel_optimized_routing: Whether the TaskChannel should prio... | [
"def",
"update",
"(",
"self",
",",
"friendly_name",
"=",
"values",
".",
"unset",
",",
"channel_optimized_routing",
"=",
"values",
".",
"unset",
")",
":",
"data",
"=",
"values",
".",
"of",
"(",
"{",
"'FriendlyName'",
":",
"friendly_name",
",",
"'ChannelOptimi... | https://github.com/twilio/twilio-python/blob/6e1e811ea57a1edfadd5161ace87397c563f6915/twilio/rest/taskrouter/v1/workspace/task_channel.py#L240-L263 | |
makerbot/ReplicatorG | d6f2b07785a5a5f1e172fb87cb4303b17c575d5d | skein_engines/skeinforge-47/fabmetheus_utilities/geometry/creation/lineation.py | python | getInradius | (defaultInradius, elementNode) | return getComplexByMultiplierPrefix(elementNode, 2.0, 'size', defaultInradius) | Get inradius. | Get inradius. | [
"Get",
"inradius",
"."
] | def getInradius(defaultInradius, elementNode):
'Get inradius.'
defaultInradius = getComplexByPrefixes(elementNode, ['demisize', 'inradius'], defaultInradius)
return getComplexByMultiplierPrefix(elementNode, 2.0, 'size', defaultInradius) | [
"def",
"getInradius",
"(",
"defaultInradius",
",",
"elementNode",
")",
":",
"defaultInradius",
"=",
"getComplexByPrefixes",
"(",
"elementNode",
",",
"[",
"'demisize'",
",",
"'inradius'",
"]",
",",
"defaultInradius",
")",
"return",
"getComplexByMultiplierPrefix",
"(",
... | https://github.com/makerbot/ReplicatorG/blob/d6f2b07785a5a5f1e172fb87cb4303b17c575d5d/skein_engines/skeinforge-47/fabmetheus_utilities/geometry/creation/lineation.py#L143-L146 | |
cool-RR/python_toolbox | cb9ef64b48f1d03275484d707dc5079b6701ad0c | python_toolbox/temp_file_tools.py | python | create_temp_folder | (*, prefix=tempfile.template, suffix='',
parent_folder=None, chmod=None) | Context manager that creates a temporary folder and deletes it after usage.
After the suite finishes, the temporary folder and all its files and
subfolders will be deleted.
Example:
with create_temp_folder() as temp_folder:
# We have a temporary folder!
assert temp_folder... | Context manager that creates a temporary folder and deletes it after usage. | [
"Context",
"manager",
"that",
"creates",
"a",
"temporary",
"folder",
"and",
"deletes",
"it",
"after",
"usage",
"."
] | def create_temp_folder(*, prefix=tempfile.template, suffix='',
parent_folder=None, chmod=None):
'''
Context manager that creates a temporary folder and deletes it after usage.
After the suite finishes, the temporary folder and all its files and
subfolders will be deleted.
Ex... | [
"def",
"create_temp_folder",
"(",
"*",
",",
"prefix",
"=",
"tempfile",
".",
"template",
",",
"suffix",
"=",
"''",
",",
"parent_folder",
"=",
"None",
",",
"chmod",
"=",
"None",
")",
":",
"temp_folder",
"=",
"pathlib",
".",
"Path",
"(",
"tempfile",
".",
... | https://github.com/cool-RR/python_toolbox/blob/cb9ef64b48f1d03275484d707dc5079b6701ad0c/python_toolbox/temp_file_tools.py#L16-L53 | ||
MITRECND/WhoDat | 9c2a3265c6437f2f82f23abc1deaaaa86b947d38 | pydat/backend/pydat/core/query_parser.py | python | PyDatParser.p_daterange_range | (self, t) | daterange : WORD COLON DATE COLON DATE | daterange : WORD COLON DATE COLON DATE | [
"daterange",
":",
"WORD",
"COLON",
"DATE",
"COLON",
"DATE"
] | def p_daterange_range(self, t):
'daterange : WORD COLON DATE COLON DATE'
try:
start = datetime.datetime.strptime(t[3], '%Y-%m-%d')
end = (datetime.datetime.strptime(t[5], '%Y-%m-%d') +
datetime.timedelta(1, 0))
except Exception:
raise Value... | [
"def",
"p_daterange_range",
"(",
"self",
",",
"t",
")",
":",
"try",
":",
"start",
"=",
"datetime",
".",
"datetime",
".",
"strptime",
"(",
"t",
"[",
"3",
"]",
",",
"'%Y-%m-%d'",
")",
"end",
"=",
"(",
"datetime",
".",
"datetime",
".",
"strptime",
"(",
... | https://github.com/MITRECND/WhoDat/blob/9c2a3265c6437f2f82f23abc1deaaaa86b947d38/pydat/backend/pydat/core/query_parser.py#L605-L618 | ||
PaddlePaddle/PaddleX | 2bab73f81ab54e328204e7871e6ae4a82e719f5d | static/paddlex/cv/models/ppyolo.py | python | PPYOLO.evaluate | (self,
eval_dataset,
batch_size=1,
epoch_id=None,
metric=None,
return_details=False) | return evaluate_metrics | 评估。
Args:
eval_dataset (paddlex.datasets): 验证数据读取器。
batch_size (int): 验证数据批大小。默认为1。
epoch_id (int): 当前评估模型所在的训练轮数。
metric (bool): 训练过程中评估的方式,取值范围为['COCO', 'VOC']。默认为None,
根据用户传入的Dataset自动选择,如为VOCDetection,则metric为'VOC';
如为COCODetec... | 评估。 | [
"评估。"
] | def evaluate(self,
eval_dataset,
batch_size=1,
epoch_id=None,
metric=None,
return_details=False):
"""评估。
Args:
eval_dataset (paddlex.datasets): 验证数据读取器。
batch_size (int): 验证数据批大小。默认为1。
... | [
"def",
"evaluate",
"(",
"self",
",",
"eval_dataset",
",",
"batch_size",
"=",
"1",
",",
"epoch_id",
"=",
"None",
",",
"metric",
"=",
"None",
",",
"return_details",
"=",
"False",
")",
":",
"input_channel",
"=",
"getattr",
"(",
"self",
",",
"'input_channel'",... | https://github.com/PaddlePaddle/PaddleX/blob/2bab73f81ab54e328204e7871e6ae4a82e719f5d/static/paddlex/cv/models/ppyolo.py#L368-L456 | |
zhl2008/awd-platform | 0416b31abea29743387b10b3914581fbe8e7da5e | web_hxb2/lib/python3.5/site-packages/wagtail/wagtailsearch/backends/elasticsearch.py | python | ElasticsearchSearchBackend.add | (self, obj) | [] | def add(self, obj):
self.get_index_for_model(type(obj)).add_item(obj) | [
"def",
"add",
"(",
"self",
",",
"obj",
")",
":",
"self",
".",
"get_index_for_model",
"(",
"type",
"(",
"obj",
")",
")",
".",
"add_item",
"(",
"obj",
")"
] | https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_hxb2/lib/python3.5/site-packages/wagtail/wagtailsearch/backends/elasticsearch.py#L805-L806 | ||||
securesystemslab/zippy | ff0e84ac99442c2c55fe1d285332cfd4e185e089 | zippy/benchmarks/src/benchmarks/sympy/sympy/combinatorics/partitions.py | python | IntegerPartition.as_dict | (self) | return self._dict | Return the partition as a dictionary whose keys are the
partition integers and the values are the multiplicity of that
integer.
Examples
========
>>> from sympy.combinatorics.partitions import IntegerPartition
>>> IntegerPartition([1]*3 + [2] + [3]*4).as_dict()
... | Return the partition as a dictionary whose keys are the
partition integers and the values are the multiplicity of that
integer. | [
"Return",
"the",
"partition",
"as",
"a",
"dictionary",
"whose",
"keys",
"are",
"the",
"partition",
"integers",
"and",
"the",
"values",
"are",
"the",
"multiplicity",
"of",
"that",
"integer",
"."
] | def as_dict(self):
"""Return the partition as a dictionary whose keys are the
partition integers and the values are the multiplicity of that
integer.
Examples
========
>>> from sympy.combinatorics.partitions import IntegerPartition
>>> IntegerPartition([1]*3 + [... | [
"def",
"as_dict",
"(",
"self",
")",
":",
"if",
"self",
".",
"_dict",
"is",
"None",
":",
"groups",
"=",
"group",
"(",
"self",
".",
"partition",
",",
"multiple",
"=",
"False",
")",
"self",
".",
"_keys",
"=",
"[",
"g",
"[",
"0",
"]",
"for",
"g",
"... | https://github.com/securesystemslab/zippy/blob/ff0e84ac99442c2c55fe1d285332cfd4e185e089/zippy/benchmarks/src/benchmarks/sympy/sympy/combinatorics/partitions.py#L443-L459 | |
fukuball/fuku-ml | 0da15ad7af76adf344b5a6b3f3dbabbbab3446b0 | FukuML/KernelLogisticRegression.py | python | KernelLogisticRegression.__init__ | (self) | init | init | [
"init"
] | def __init__(self):
"""init"""
self.status = 'empty'
self.train_X = []
self.train_Y = []
self.W = []
self.data_num = 0
self.data_demension = 0
self.test_X = []
self.test_Y = []
self.feature_transform_mode = ''
self.feature_transfo... | [
"def",
"__init__",
"(",
"self",
")",
":",
"self",
".",
"status",
"=",
"'empty'",
"self",
".",
"train_X",
"=",
"[",
"]",
"self",
".",
"train_Y",
"=",
"[",
"]",
"self",
".",
"W",
"=",
"[",
"]",
"self",
".",
"data_num",
"=",
"0",
"self",
".",
"dat... | https://github.com/fukuball/fuku-ml/blob/0da15ad7af76adf344b5a6b3f3dbabbbab3446b0/FukuML/KernelLogisticRegression.py#L13-L37 | ||
1012598167/flask_mongodb_game | 60c7e0351586656ec38f851592886338e50b4110 | python_flask/venv/Lib/site-packages/gridfs/__init__.py | python | GridFS.get | (self, file_id, session=None) | return gout | Get a file from GridFS by ``"_id"``.
Returns an instance of :class:`~gridfs.grid_file.GridOut`,
which provides a file-like interface for reading.
:Parameters:
- `file_id`: ``"_id"`` of the file to get
- `session` (optional): a
:class:`~pymongo.client_session.Cli... | Get a file from GridFS by ``"_id"``. | [
"Get",
"a",
"file",
"from",
"GridFS",
"by",
"_id",
"."
] | def get(self, file_id, session=None):
"""Get a file from GridFS by ``"_id"``.
Returns an instance of :class:`~gridfs.grid_file.GridOut`,
which provides a file-like interface for reading.
:Parameters:
- `file_id`: ``"_id"`` of the file to get
- `session` (optional): ... | [
"def",
"get",
"(",
"self",
",",
"file_id",
",",
"session",
"=",
"None",
")",
":",
"gout",
"=",
"GridOut",
"(",
"self",
".",
"__collection",
",",
"file_id",
",",
"session",
"=",
"session",
")",
"# Raise NoFile now, instead of on first attribute access.",
"gout",
... | https://github.com/1012598167/flask_mongodb_game/blob/60c7e0351586656ec38f851592886338e50b4110/python_flask/venv/Lib/site-packages/gridfs/__init__.py#L136-L154 | |
ProjectQ-Framework/ProjectQ | 0d32c1610ba4e9aefd7f19eb52dadb4fbe5f9005 | projectq/backends/_sim/_pysim.py | python | Simulator.set_wavefunction | (self, wavefunction, ordering) | Set wavefunction and qubit ordering.
Args:
wavefunction (list[complex]): Array of complex amplitudes describing the wavefunction (must be normalized).
ordering (list): List of ids describing the new ordering of qubits (i.e., the ordering of the provided
wavefunction). | Set wavefunction and qubit ordering. | [
"Set",
"wavefunction",
"and",
"qubit",
"ordering",
"."
] | def set_wavefunction(self, wavefunction, ordering):
"""
Set wavefunction and qubit ordering.
Args:
wavefunction (list[complex]): Array of complex amplitudes describing the wavefunction (must be normalized).
ordering (list): List of ids describing the new ordering of qubi... | [
"def",
"set_wavefunction",
"(",
"self",
",",
"wavefunction",
",",
"ordering",
")",
":",
"# wavefunction contains 2^n values for n qubits",
"if",
"len",
"(",
"wavefunction",
")",
"!=",
"(",
"1",
"<<",
"len",
"(",
"ordering",
")",
")",
":",
"# pragma: no cover",
"... | https://github.com/ProjectQ-Framework/ProjectQ/blob/0d32c1610ba4e9aefd7f19eb52dadb4fbe5f9005/projectq/backends/_sim/_pysim.py#L436-L457 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.