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
openshift/openshift-tools
1188778e728a6e4781acf728123e5b356380fe6f
openshift/installer/vendored/openshift-ansible-3.9.40/roles/lib_openshift/library/oc_clusterrole.py
python
OpenShiftCLI._replace_content
(self, resource, rname, content, edits=None, force=False, sep='.')
return {'returncode': 0, 'updated': False}
replace the current object with the content
replace the current object with the content
[ "replace", "the", "current", "object", "with", "the", "content" ]
def _replace_content(self, resource, rname, content, edits=None, force=False, sep='.'): ''' replace the current object with the content ''' res = self._get(resource, rname) if not res['results']: return res fname = Utils.create_tmpfile(rname + '-') yed = Yedit(fname...
[ "def", "_replace_content", "(", "self", ",", "resource", ",", "rname", ",", "content", ",", "edits", "=", "None", ",", "force", "=", "False", ",", "sep", "=", "'.'", ")", ":", "res", "=", "self", ".", "_get", "(", "resource", ",", "rname", ")", "if...
https://github.com/openshift/openshift-tools/blob/1188778e728a6e4781acf728123e5b356380fe6f/openshift/installer/vendored/openshift-ansible-3.9.40/roles/lib_openshift/library/oc_clusterrole.py#L880-L911
zhl2008/awd-platform
0416b31abea29743387b10b3914581fbe8e7da5e
web_hxb2/lib/python3.5/site-packages/bs4/builder/_lxml.py
python
LXMLTreeBuilderForXML.data
(self, content)
[]
def data(self, content): self.soup.handle_data(content)
[ "def", "data", "(", "self", ",", "content", ")", ":", "self", ".", "soup", ".", "handle_data", "(", "content", ")" ]
https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_hxb2/lib/python3.5/site-packages/bs4/builder/_lxml.py#L215-L216
igraph/python-igraph
e9f83e8af08f24ea025596e745917197d8b44d94
src/igraph/utils.py
python
multidict.__delitem__
(self, key)
Removes all the items associated to the given `key`.
Removes all the items associated to the given `key`.
[ "Removes", "all", "the", "items", "associated", "to", "the", "given", "key", "." ]
def __delitem__(self, key): """Removes all the items associated to the given `key`.""" del self._dict[key]
[ "def", "__delitem__", "(", "self", ",", "key", ")", ":", "del", "self", ".", "_dict", "[", "key", "]" ]
https://github.com/igraph/python-igraph/blob/e9f83e8af08f24ea025596e745917197d8b44d94/src/igraph/utils.py#L261-L263
quantumlib/OpenFermion
6187085f2a7707012b68370b625acaeed547e62b
src/openfermion/ops/representations/diagonal_coulomb_hamiltonian.py
python
DiagonalCoulombHamiltonian.__truediv__
(self, dividend)
return quotient
[]
def __truediv__(self, dividend): quotient = copy.deepcopy(self) quotient /= dividend return quotient
[ "def", "__truediv__", "(", "self", ",", "dividend", ")", ":", "quotient", "=", "copy", ".", "deepcopy", "(", "self", ")", "quotient", "/=", "dividend", "return", "quotient" ]
https://github.com/quantumlib/OpenFermion/blob/6187085f2a7707012b68370b625acaeed547e62b/src/openfermion/ops/representations/diagonal_coulomb_hamiltonian.py#L79-L82
kalliope-project/kalliope
7b2bb4671c8fbfa0ea9f768c84994fe75da974eb
kalliope/core/Models/Brain.py
python
Brain.__eq__
(self, other)
return self.__dict__ == other.__dict__
This is used to compare 2 objects :param other: :return:
This is used to compare 2 objects :param other: :return:
[ "This", "is", "used", "to", "compare", "2", "objects", ":", "param", "other", ":", ":", "return", ":" ]
def __eq__(self, other): """ This is used to compare 2 objects :param other: :return: """ return self.__dict__ == other.__dict__
[ "def", "__eq__", "(", "self", ",", "other", ")", ":", "return", "self", ".", "__dict__", "==", "other", ".", "__dict__" ]
https://github.com/kalliope-project/kalliope/blob/7b2bb4671c8fbfa0ea9f768c84994fe75da974eb/kalliope/core/Models/Brain.py#L62-L68
matrix-org/synapse
8e57584a5859a9002759963eb546d523d2498a01
synapse/python_dependencies.py
python
_check_requirement
(dependency_string)
Parses a dependency string, and checks if the specified requirement is installed Raises: VersionConflict if the requirement is installed, but with the the wrong version DistributionNotFound if nothing is found to provide the requirement
Parses a dependency string, and checks if the specified requirement is installed
[ "Parses", "a", "dependency", "string", "and", "checks", "if", "the", "specified", "requirement", "is", "installed" ]
def _check_requirement(dependency_string): """Parses a dependency string, and checks if the specified requirement is installed Raises: VersionConflict if the requirement is installed, but with the the wrong version DistributionNotFound if nothing is found to provide the requirement """ ...
[ "def", "_check_requirement", "(", "dependency_string", ")", ":", "req", "=", "Requirement", ".", "parse", "(", "dependency_string", ")", "# first check if the markers specify that this requirement needs installing", "if", "req", ".", "marker", "is", "not", "None", "and", ...
https://github.com/matrix-org/synapse/blob/8e57584a5859a9002759963eb546d523d2498a01/synapse/python_dependencies.py#L225-L239
wistbean/learn_python3_spider
73c873f4845f4385f097e5057407d03dd37a117b
stackoverflow/venv/lib/python3.6/site-packages/hyperlink/_url.py
python
_encode_schemeless_path_part
(text, maximal=True)
return u''.join([_SCHEMELESS_PATH_PART_QUOTE_MAP[t] if t in _SCHEMELESS_PATH_DELIMS else t for t in text])
Percent-encode the first segment of a URL path for a URL without a scheme specified.
Percent-encode the first segment of a URL path for a URL without a scheme specified.
[ "Percent", "-", "encode", "the", "first", "segment", "of", "a", "URL", "path", "for", "a", "URL", "without", "a", "scheme", "specified", "." ]
def _encode_schemeless_path_part(text, maximal=True): """Percent-encode the first segment of a URL path for a URL without a scheme specified. """ if maximal: bytestr = normalize('NFC', text).encode('utf8') return u''.join([_SCHEMELESS_PATH_PART_QUOTE_MAP[b] for b in bytestr]) return ...
[ "def", "_encode_schemeless_path_part", "(", "text", ",", "maximal", "=", "True", ")", ":", "if", "maximal", ":", "bytestr", "=", "normalize", "(", "'NFC'", ",", "text", ")", ".", "encode", "(", "'utf8'", ")", "return", "u''", ".", "join", "(", "[", "_S...
https://github.com/wistbean/learn_python3_spider/blob/73c873f4845f4385f097e5057407d03dd37a117b/stackoverflow/venv/lib/python3.6/site-packages/hyperlink/_url.py#L245-L253
lenskit/lkpy
cfe84226f8be7778fb343f0c96c4f4ef4acc5932
lenskit/math/solve.py
python
dposv
(A, b, lower=False)
Interface to the BLAS dposv function. A Numba-accessible verison without error checking is exposed as :py:func:`_dposv`.
Interface to the BLAS dposv function. A Numba-accessible verison without error checking is exposed as :py:func:`_dposv`.
[ "Interface", "to", "the", "BLAS", "dposv", "function", ".", "A", "Numba", "-", "accessible", "verison", "without", "error", "checking", "is", "exposed", "as", ":", "py", ":", "func", ":", "_dposv", "." ]
def dposv(A, b, lower=False): """ Interface to the BLAS dposv function. A Numba-accessible verison without error checking is exposed as :py:func:`_dposv`. """ info = _dposv(A, b, lower) if info < 0: raise ValueError('invalid args to dposv, code ' + str(info)) elif info > 0: ...
[ "def", "dposv", "(", "A", ",", "b", ",", "lower", "=", "False", ")", ":", "info", "=", "_dposv", "(", "A", ",", "b", ",", "lower", ")", "if", "info", "<", "0", ":", "raise", "ValueError", "(", "'invalid args to dposv, code '", "+", "str", "(", "inf...
https://github.com/lenskit/lkpy/blob/cfe84226f8be7778fb343f0c96c4f4ef4acc5932/lenskit/math/solve.py#L60-L69
SCSSoftware/BlenderTools
96f323d3bdf2d8cb8ed7f882dcdf036277a802dd
addon/io_scs_tools/utils/object.py
python
get_children
(obj, children=[], reset=True)
return children
Takes an object and returns all its children objects in a list. (Recursive)
Takes an object and returns all its children objects in a list. (Recursive)
[ "Takes", "an", "object", "and", "returns", "all", "its", "children", "objects", "in", "a", "list", ".", "(", "Recursive", ")" ]
def get_children(obj, children=[], reset=True): """Takes an object and returns all its children objects in a list. (Recursive)""" if reset: children = [] for child in obj.children: # filter out multilevel scs roots isnt_root = not (child.scs_props.empty_object_type == "SCS Root" and ...
[ "def", "get_children", "(", "obj", ",", "children", "=", "[", "]", ",", "reset", "=", "True", ")", ":", "if", "reset", ":", "children", "=", "[", "]", "for", "child", "in", "obj", ".", "children", ":", "# filter out multilevel scs roots", "isnt_root", "=...
https://github.com/SCSSoftware/BlenderTools/blob/96f323d3bdf2d8cb8ed7f882dcdf036277a802dd/addon/io_scs_tools/utils/object.py#L140-L152
pycrypto/pycrypto
7acba5f3a6ff10f1424c309d0d34d2b713233019
lib/Crypto/IO/_PBES.py
python
PBES2.encrypt
(data, passphrase, protection, prot_params=None, randfunc=None)
return encrypted_private_key_info.encode()
Encrypt a piece of data using a passphrase and *PBES2*. :Parameters: data : byte string The piece of data to encrypt. passphrase : byte string The passphrase to use for encrypting the data. protection : string The identifier of the encryption al...
Encrypt a piece of data using a passphrase and *PBES2*.
[ "Encrypt", "a", "piece", "of", "data", "using", "a", "passphrase", "and", "*", "PBES2", "*", "." ]
def encrypt(data, passphrase, protection, prot_params=None, randfunc=None): """Encrypt a piece of data using a passphrase and *PBES2*. :Parameters: data : byte string The piece of data to encrypt. passphrase : byte string The passphrase to use for encrypting ...
[ "def", "encrypt", "(", "data", ",", "passphrase", ",", "protection", ",", "prot_params", "=", "None", ",", "randfunc", "=", "None", ")", ":", "if", "prot_params", "is", "None", ":", "prot_params", "=", "{", "}", "if", "randfunc", "is", "None", ":", "ra...
https://github.com/pycrypto/pycrypto/blob/7acba5f3a6ff10f1424c309d0d34d2b713233019/lib/Crypto/IO/_PBES.py#L155-L255
glinscott/fishtest
8d2b823a63fbe7be169a2177a130018c389d7aea
worker/packages/requests/utils.py
python
iter_slices
(string, slice_length)
Iterate over slices of a string.
Iterate over slices of a string.
[ "Iterate", "over", "slices", "of", "a", "string", "." ]
def iter_slices(string, slice_length): """Iterate over slices of a string.""" pos = 0 if slice_length is None or slice_length <= 0: slice_length = len(string) while pos < len(string): yield string[pos:pos + slice_length] pos += slice_length
[ "def", "iter_slices", "(", "string", ",", "slice_length", ")", ":", "pos", "=", "0", "if", "slice_length", "is", "None", "or", "slice_length", "<=", "0", ":", "slice_length", "=", "len", "(", "string", ")", "while", "pos", "<", "len", "(", "string", ")...
https://github.com/glinscott/fishtest/blob/8d2b823a63fbe7be169a2177a130018c389d7aea/worker/packages/requests/utils.py#L529-L536
aws/sagemaker-python-sdk
9d259b316f7f43838c16f35c10e98a110b56735b
src/sagemaker/utils.py
python
base_from_name
(name)
return m.group(1) if m else name
Extract the base name of the resource name (for use with future resource name generation). This function looks for timestamps that match the ones produced by :func:`~sagemaker.utils.name_from_base`. Args: name (str): The resource name. Returns: str: The base name, as extracted from th...
Extract the base name of the resource name (for use with future resource name generation).
[ "Extract", "the", "base", "name", "of", "the", "resource", "name", "(", "for", "use", "with", "future", "resource", "name", "generation", ")", "." ]
def base_from_name(name): """Extract the base name of the resource name (for use with future resource name generation). This function looks for timestamps that match the ones produced by :func:`~sagemaker.utils.name_from_base`. Args: name (str): The resource name. Returns: str: Th...
[ "def", "base_from_name", "(", "name", ")", ":", "m", "=", "re", ".", "match", "(", "r\"^(.+)-(\\d{4}-\\d{2}-\\d{2}-\\d{2}-\\d{2}-\\d{2}-\\d{3}|\\d{6}-\\d{4})\"", ",", "name", ")", "return", "m", ".", "group", "(", "1", ")", "if", "m", "else", "name" ]
https://github.com/aws/sagemaker-python-sdk/blob/9d259b316f7f43838c16f35c10e98a110b56735b/src/sagemaker/utils.py#L103-L116
dask/dask-jobqueue
4980e746e9be15e5fe6736b6c496b8faea737fd7
versioneer.py
python
do_vcs_install
(manifest_in, versionfile_source, ipy)
Git-specific installation logic for Versioneer. For Git, this means creating/changing .gitattributes to mark _version.py for export-subst keyword substitution.
Git-specific installation logic for Versioneer.
[ "Git", "-", "specific", "installation", "logic", "for", "Versioneer", "." ]
def do_vcs_install(manifest_in, versionfile_source, ipy): """Git-specific installation logic for Versioneer. For Git, this means creating/changing .gitattributes to mark _version.py for export-subst keyword substitution. """ GITS = ["git"] if sys.platform == "win32": GITS = ["git.cmd", ...
[ "def", "do_vcs_install", "(", "manifest_in", ",", "versionfile_source", ",", "ipy", ")", ":", "GITS", "=", "[", "\"git\"", "]", "if", "sys", ".", "platform", "==", "\"win32\"", ":", "GITS", "=", "[", "\"git.cmd\"", ",", "\"git.exe\"", "]", "files", "=", ...
https://github.com/dask/dask-jobqueue/blob/4980e746e9be15e5fe6736b6c496b8faea737fd7/versioneer.py#L1122-L1157
mynlp/ccg2lambda
442a9ec9be7393d92c77a03856aa4a9c71c20078
scripts/nltk2graph.py
python
get_scoped_nodes
(graph, head_node=None, quant_active=None, quant_scope=None)
return quant_scope
Returns a dictionary where: keys are tuples (scope_node_id, expression) and values are lists of tuples (node ID, node_type)s within the scope and with the same expression. node_type is one of {'leaf', 'internal'}.
Returns a dictionary where: keys are tuples (scope_node_id, expression) and values are lists of tuples (node ID, node_type)s within the scope and with the same expression. node_type is one of {'leaf', 'internal'}.
[ "Returns", "a", "dictionary", "where", ":", "keys", "are", "tuples", "(", "scope_node_id", "expression", ")", "and", "values", "are", "lists", "of", "tuples", "(", "node", "ID", "node_type", ")", "s", "within", "the", "scope", "and", "with", "the", "same",...
def get_scoped_nodes(graph, head_node=None, quant_active=None, quant_scope=None): """ Returns a dictionary where: keys are tuples (scope_node_id, expression) and values are lists of tuples (node ID, node_type)s within the scope and with the same expression. node_type is one of {'leaf', 'internal...
[ "def", "get_scoped_nodes", "(", "graph", ",", "head_node", "=", "None", ",", "quant_active", "=", "None", ",", "quant_scope", "=", "None", ")", ":", "if", "quant_scope", "is", "None", ":", "quant_scope", "=", "{", "}", "label", "=", "get_label", "(", "gr...
https://github.com/mynlp/ccg2lambda/blob/442a9ec9be7393d92c77a03856aa4a9c71c20078/scripts/nltk2graph.py#L263-L289
dswah/pyGAM
b57b4cf8783a90976031e1857e748ca3e6ec650b
pygam/core.py
python
Core.__repr__
(self)
return nice_repr(name, self.get_params(), line_width=self._line_width, line_offset=self._line_offset, decimals=4, args=None)
__repr__ method
__repr__ method
[ "__repr__", "method" ]
def __repr__(self): """__repr__ method""" name = self.__class__.__name__ return nice_repr(name, self.get_params(), line_width=self._line_width, line_offset=self._line_offset, decimals=4, args=None)
[ "def", "__repr__", "(", "self", ")", ":", "name", "=", "self", ".", "__class__", ".", "__name__", "return", "nice_repr", "(", "name", ",", "self", ".", "get_params", "(", ")", ",", "line_width", "=", "self", ".", "_line_width", ",", "line_offset", "=", ...
https://github.com/dswah/pyGAM/blob/b57b4cf8783a90976031e1857e748ca3e6ec650b/pygam/core.py#L124-L130
CouchPotato/CouchPotatoV1
135b3331d1b88ef645e29b76f2d4cc4a732c9232
cherrypy/_cptools.py
python
Tool._setup
(self)
Hook this tool into cherrypy.request. The standard CherryPy request object will automatically call this method when the tool is "turned on" in config.
Hook this tool into cherrypy.request. The standard CherryPy request object will automatically call this method when the tool is "turned on" in config.
[ "Hook", "this", "tool", "into", "cherrypy", ".", "request", ".", "The", "standard", "CherryPy", "request", "object", "will", "automatically", "call", "this", "method", "when", "the", "tool", "is", "turned", "on", "in", "config", "." ]
def _setup(self): """Hook this tool into cherrypy.request. The standard CherryPy request object will automatically call this method when the tool is "turned on" in config. """ conf = self._merged_args() p = conf.pop("priority", None) if p is None: ...
[ "def", "_setup", "(", "self", ")", ":", "conf", "=", "self", ".", "_merged_args", "(", ")", "p", "=", "conf", ".", "pop", "(", "\"priority\"", ",", "None", ")", "if", "p", "is", "None", ":", "p", "=", "getattr", "(", "self", ".", "callable", ",",...
https://github.com/CouchPotato/CouchPotatoV1/blob/135b3331d1b88ef645e29b76f2d4cc4a732c9232/cherrypy/_cptools.py#L130-L141
oracle/oci-python-sdk
3c1604e4e212008fb6718e2f68cdb5ef71fd5793
src/oci/core/virtual_network_client.py
python
VirtualNetworkClient.get_all_drg_attachments
(self, drg_id, **kwargs)
Returns a complete list of DRG attachments that belong to a particular DRG. :param str drg_id: (required) The `OCID`__ of the DRG. __ https://docs.cloud.oracle.com/Content/General/Concepts/identifiers.htm :param str opc_request_id: (optional) Unique identifier for...
Returns a complete list of DRG attachments that belong to a particular DRG.
[ "Returns", "a", "complete", "list", "of", "DRG", "attachments", "that", "belong", "to", "a", "particular", "DRG", "." ]
def get_all_drg_attachments(self, drg_id, **kwargs): """ Returns a complete list of DRG attachments that belong to a particular DRG. :param str drg_id: (required) The `OCID`__ of the DRG. __ https://docs.cloud.oracle.com/Content/General/Concepts/identifiers.htm ...
[ "def", "get_all_drg_attachments", "(", "self", ",", "drg_id", ",", "*", "*", "kwargs", ")", ":", "resource_path", "=", "\"/drgs/{drgId}/actions/getAllDrgAttachments\"", "method", "=", "\"POST\"", "# Don't accept unknown kwargs", "expected_kwargs", "=", "[", "\"retry_strat...
https://github.com/oracle/oci-python-sdk/blob/3c1604e4e212008fb6718e2f68cdb5ef71fd5793/src/oci/core/virtual_network_client.py#L7881-L8006
tp4a/teleport
1fafd34f1f775d2cf80ea4af6e44468d8e0b24ad
server/www/packages/packages-darwin/x64/pymysql/protocol.py
python
MysqlPacket.is_resultset_packet
(self)
return 1 <= field_count <= 250
[]
def is_resultset_packet(self): field_count = ord(self._data[0:1]) return 1 <= field_count <= 250
[ "def", "is_resultset_packet", "(", "self", ")", ":", "field_count", "=", "ord", "(", "self", ".", "_data", "[", "0", ":", "1", "]", ")", "return", "1", "<=", "field_count", "<=", "250" ]
https://github.com/tp4a/teleport/blob/1fafd34f1f775d2cf80ea4af6e44468d8e0b24ad/server/www/packages/packages-darwin/x64/pymysql/protocol.py#L204-L206
home-assistant/core
265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1
homeassistant/components/prosegur/alarm_control_panel.py
python
async_setup_entry
( hass: HomeAssistant, entry: ConfigEntry, async_add_entities: AddEntitiesCallback )
Set up the Prosegur alarm control panel platform.
Set up the Prosegur alarm control panel platform.
[ "Set", "up", "the", "Prosegur", "alarm", "control", "panel", "platform", "." ]
async def async_setup_entry( hass: HomeAssistant, entry: ConfigEntry, async_add_entities: AddEntitiesCallback ) -> None: """Set up the Prosegur alarm control panel platform.""" async_add_entities( [ProsegurAlarm(entry.data["contract"], hass.data[DOMAIN][entry.entry_id])], update_before_add=T...
[ "async", "def", "async_setup_entry", "(", "hass", ":", "HomeAssistant", ",", "entry", ":", "ConfigEntry", ",", "async_add_entities", ":", "AddEntitiesCallback", ")", "->", "None", ":", "async_add_entities", "(", "[", "ProsegurAlarm", "(", "entry", ".", "data", "...
https://github.com/home-assistant/core/blob/265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1/homeassistant/components/prosegur/alarm_control_panel.py#L33-L40
AndroidHooker/hooker
1f73d741195f6d57c12e0d36bfd8a0a22f573e6c
hooker_xp/hooker_xp/analysis/Analysis.py
python
Analysis._generateIdXp
(self, apkFiles)
return Analysis.generateIdXp(apkFiles)
Generates and returns the identifier of the experiment based on the provided list of apk following schema: md5("".join(sorted(apkFileNames))+currentDate)
Generates and returns the identifier of the experiment based on the provided list of apk following schema: md5("".join(sorted(apkFileNames))+currentDate)
[ "Generates", "and", "returns", "the", "identifier", "of", "the", "experiment", "based", "on", "the", "provided", "list", "of", "apk", "following", "schema", ":", "md5", "(", ".", "join", "(", "sorted", "(", "apkFileNames", "))", "+", "currentDate", ")" ]
def _generateIdXp(self, apkFiles): """Generates and returns the identifier of the experiment based on the provided list of apk following schema: md5("".join(sorted(apkFileNames))+currentDate) """ return Analysis.generateIdXp(apkFiles)
[ "def", "_generateIdXp", "(", "self", ",", "apkFiles", ")", ":", "return", "Analysis", ".", "generateIdXp", "(", "apkFiles", ")" ]
https://github.com/AndroidHooker/hooker/blob/1f73d741195f6d57c12e0d36bfd8a0a22f573e6c/hooker_xp/hooker_xp/analysis/Analysis.py#L88-L93
evilhero/mylar
dbee01d7e48e8c717afa01b2de1946c5d0b956cb
lib/cherrypy/__init__.py
python
_HandleSignalsPlugin.subscribe
(self)
Add the handlers based on the platform
Add the handlers based on the platform
[ "Add", "the", "handlers", "based", "on", "the", "platform" ]
def subscribe(self): """Add the handlers based on the platform""" if hasattr(self.bus, "signal_handler"): self.bus.signal_handler.subscribe() if hasattr(self.bus, "console_control_handler"): self.bus.console_control_handler.subscribe()
[ "def", "subscribe", "(", "self", ")", ":", "if", "hasattr", "(", "self", ".", "bus", ",", "\"signal_handler\"", ")", ":", "self", ".", "bus", ".", "signal_handler", ".", "subscribe", "(", ")", "if", "hasattr", "(", "self", ".", "bus", ",", "\"console_c...
https://github.com/evilhero/mylar/blob/dbee01d7e48e8c717afa01b2de1946c5d0b956cb/lib/cherrypy/__init__.py#L136-L141
liuyubobobo/Play-with-Linear-Algebra
e86175adb908b03756618fbeeeadb448a3551321
07-Elemental-Matrices-and-The-Properties-of-Inversion/02-Implement-Inverse-of-Matrix/playLA/Matrix.py
python
Matrix.shape
(self)
return len(self._values), len(self._values[0])
返回矩阵的形状: (行数, 列数)
返回矩阵的形状: (行数, 列数)
[ "返回矩阵的形状", ":", "(", "行数,", "列数", ")" ]
def shape(self): """返回矩阵的形状: (行数, 列数)""" return len(self._values), len(self._values[0])
[ "def", "shape", "(", "self", ")", ":", "return", "len", "(", "self", ".", "_values", ")", ",", "len", "(", "self", ".", "_values", "[", "0", "]", ")" ]
https://github.com/liuyubobobo/Play-with-Linear-Algebra/blob/e86175adb908b03756618fbeeeadb448a3551321/07-Elemental-Matrices-and-The-Properties-of-Inversion/02-Implement-Inverse-of-Matrix/playLA/Matrix.py#L105-L107
mesalock-linux/mesapy
ed546d59a21b36feb93e2309d5c6b75aa0ad95c9
rpython/rlib/rbigint.py
python
digits_from_nonneg_long
(l)
UNSAFE
UNSAFE
[ "UNSAFE" ]
def digits_from_nonneg_long(l): """UNSAFE""" digits = [] while True: digits.append(_store_digit(_mask_digit(l & MASK))) l = l >> SHIFT if not l: return digits[:]
[ "def", "digits_from_nonneg_long", "(", "l", ")", ":", "digits", "=", "[", "]", "while", "True", ":", "digits", ".", "append", "(", "_store_digit", "(", "_mask_digit", "(", "l", "&", "MASK", ")", ")", ")", "l", "=", "l", ">>", "SHIFT", "if", "not", ...
https://github.com/mesalock-linux/mesapy/blob/ed546d59a21b36feb93e2309d5c6b75aa0ad95c9/rpython/rlib/rbigint.py#L1327-L1334
naftaliharris/tauthon
5587ceec329b75f7caf6d65a036db61ac1bae214
Lib/plat-mac/findertools.py
python
putaway
(object)
puth the object away, whereever it came from.
puth the object away, whereever it came from.
[ "puth", "the", "object", "away", "whereever", "it", "came", "from", "." ]
def putaway(object): """puth the object away, whereever it came from.""" finder = _getfinder() args = {} attrs = {} args['----'] = aetypes.ObjectSpecifier(want=aetypes.Type('cdis'), form="name", seld=object, fr=None) _reply, args, attrs = talker.send("fndr", "ptwy", args, attrs) if 'errn' in...
[ "def", "putaway", "(", "object", ")", ":", "finder", "=", "_getfinder", "(", ")", "args", "=", "{", "}", "attrs", "=", "{", "}", "args", "[", "'----'", "]", "=", "aetypes", ".", "ObjectSpecifier", "(", "want", "=", "aetypes", ".", "Type", "(", "'cd...
https://github.com/naftaliharris/tauthon/blob/5587ceec329b75f7caf6d65a036db61ac1bae214/Lib/plat-mac/findertools.py#L606-L616
OpnTec/open-event-server
a48f7e4c6002db6fb4dc06bac6508536a0dc585e
app/api/discount_codes.py
python
DiscountCodeList.query
(self, view_kwargs)
return query_
query method for Discount Code List :param view_kwargs: :return:
query method for Discount Code List :param view_kwargs: :return:
[ "query", "method", "for", "Discount", "Code", "List", ":", "param", "view_kwargs", ":", ":", "return", ":" ]
def query(self, view_kwargs): """ query method for Discount Code List :param view_kwargs: :return: """ query_ = self.session.query(DiscountCode) if view_kwargs.get('user_id'): user = safe_query(self, User, 'id', view_kwargs['user_id'], 'user_id') ...
[ "def", "query", "(", "self", ",", "view_kwargs", ")", ":", "query_", "=", "self", ".", "session", ".", "query", "(", "DiscountCode", ")", "if", "view_kwargs", ".", "get", "(", "'user_id'", ")", ":", "user", "=", "safe_query", "(", "self", ",", "User", ...
https://github.com/OpnTec/open-event-server/blob/a48f7e4c6002db6fb4dc06bac6508536a0dc585e/app/api/discount_codes.py#L74-L93
landlab/landlab
a5dd80b8ebfd03d1ba87ef6c4368c409485f222c
landlab/components/priority_flood_flow_router/priority_flood_flow_router.py
python
PriorityFloodFlowRouter._test_water_inputs
(self, grid, runoff_rate)
Test inputs for runoff_rate and water__unit_flux_in.
Test inputs for runoff_rate and water__unit_flux_in.
[ "Test", "inputs", "for", "runoff_rate", "and", "water__unit_flux_in", "." ]
def _test_water_inputs(self, grid, runoff_rate): """Test inputs for runoff_rate and water__unit_flux_in.""" if "water__unit_flux_in" not in grid.at_node: if runoff_rate is None: # assume that if runoff rate is not supplied, that the value # should be set to on...
[ "def", "_test_water_inputs", "(", "self", ",", "grid", ",", "runoff_rate", ")", ":", "if", "\"water__unit_flux_in\"", "not", "in", "grid", ".", "at_node", ":", "if", "runoff_rate", "is", "None", ":", "# assume that if runoff rate is not supplied, that the value", "# s...
https://github.com/landlab/landlab/blob/a5dd80b8ebfd03d1ba87ef6c4368c409485f222c/landlab/components/priority_flood_flow_router/priority_flood_flow_router.py#L526-L545
zhl2008/awd-platform
0416b31abea29743387b10b3914581fbe8e7da5e
web_flaskbb/Python-2.7.9/Mac/Modules/snd/sndsupport.py
python
SndObjectDefinition.outputInitStructMembers
(self)
[]
def outputInitStructMembers(self): ObjectDefinition.outputInitStructMembers(self) Output("it->ob_callback = NULL;") Output("it->ob_A5 = SetCurrentA5();");
[ "def", "outputInitStructMembers", "(", "self", ")", ":", "ObjectDefinition", ".", "outputInitStructMembers", "(", "self", ")", "Output", "(", "\"it->ob_callback = NULL;\"", ")", "Output", "(", "\"it->ob_A5 = SetCurrentA5();\"", ")" ]
https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_flaskbb/Python-2.7.9/Mac/Modules/snd/sndsupport.py#L192-L195
numba/llvmlite
aeddf447d4befc336b26bde8c46042553a13cf75
llvmlite/ir/builder.py
python
IRBuilder.fma
(self, a, b, c)
Perform the fused multiply-add operation.
Perform the fused multiply-add operation.
[ "Perform", "the", "fused", "multiply", "-", "add", "operation", "." ]
def fma(self, a, b, c): """ Perform the fused multiply-add operation. """
[ "def", "fma", "(", "self", ",", "a", ",", "b", ",", "c", ")", ":" ]
https://github.com/numba/llvmlite/blob/aeddf447d4befc336b26bde8c46042553a13cf75/llvmlite/ir/builder.py#L1082-L1085
shuup/shuup
25f78cfe370109b9885b903e503faac295c7b7f2
shuup/front/providers/form_fields.py
python
FormFieldProvider.get_fields
(self, **kwargs)
return []
Get a list of field definitions :return: list of `FormFieldDefinition`s :rtype: list[shuup.front.providers.form_fields.FormFieldDefinition]
Get a list of field definitions
[ "Get", "a", "list", "of", "field", "definitions" ]
def get_fields(self, **kwargs): """ Get a list of field definitions :return: list of `FormFieldDefinition`s :rtype: list[shuup.front.providers.form_fields.FormFieldDefinition] """ return []
[ "def", "get_fields", "(", "self", ",", "*", "*", "kwargs", ")", ":", "return", "[", "]" ]
https://github.com/shuup/shuup/blob/25f78cfe370109b9885b903e503faac295c7b7f2/shuup/front/providers/form_fields.py#L36-L43
OpenCobolIDE/OpenCobolIDE
c78d0d335378e5fe0a5e74f53c19b68b55e85388
open_cobol_ide/extlibs/pyqode/core/modes/matcher.py
python
SymbolMatcherMode.symbol_pos
(self, cursor, character_type=OPEN, symbol_type=PAREN)
return retval
Find the corresponding symbol position (line, column) of the specified symbol. If symbol type is PAREN and character_type is OPEN, the function will look for '('. :param cursor: QTextCursor :param character_type: character type to look for (open or close char) :param symbol_type...
Find the corresponding symbol position (line, column) of the specified symbol. If symbol type is PAREN and character_type is OPEN, the function will look for '('.
[ "Find", "the", "corresponding", "symbol", "position", "(", "line", "column", ")", "of", "the", "specified", "symbol", ".", "If", "symbol", "type", "is", "PAREN", "and", "character_type", "is", "OPEN", "the", "function", "will", "look", "for", "(", "." ]
def symbol_pos(self, cursor, character_type=OPEN, symbol_type=PAREN): """ Find the corresponding symbol position (line, column) of the specified symbol. If symbol type is PAREN and character_type is OPEN, the function will look for '('. :param cursor: QTextCursor :param ...
[ "def", "symbol_pos", "(", "self", ",", "cursor", ",", "character_type", "=", "OPEN", ",", "symbol_type", "=", "PAREN", ")", ":", "retval", "=", "None", ",", "None", "original_cursor", "=", "self", ".", "editor", ".", "textCursor", "(", ")", "self", ".", ...
https://github.com/OpenCobolIDE/OpenCobolIDE/blob/c78d0d335378e5fe0a5e74f53c19b68b55e85388/open_cobol_ide/extlibs/pyqode/core/modes/matcher.py#L127-L149
nodesign/weio
1d67d705a5c36a2e825ad13feab910b0aca9a2e8
openWrt/files/usr/lib/python2.7/site-packages/tornado/iostream.py
python
SSLIOStream._handle_connect
(self)
[]
def _handle_connect(self): # When the connection is complete, wrap the socket for SSL # traffic. Note that we do this by overriding _handle_connect # instead of by passing a callback to super().connect because # user callbacks are enqueued asynchronously on the IOLoop, # but sin...
[ "def", "_handle_connect", "(", "self", ")", ":", "# When the connection is complete, wrap the socket for SSL", "# traffic. Note that we do this by overriding _handle_connect", "# instead of by passing a callback to super().connect because", "# user callbacks are enqueued asynchronously on the IOL...
https://github.com/nodesign/weio/blob/1d67d705a5c36a2e825ad13feab910b0aca9a2e8/openWrt/files/usr/lib/python2.7/site-packages/tornado/iostream.py#L832-L842
fossasia/open-event-server
5ce3b88c0bcf8685944e634701203944b2cf17dd
app/api/speakers.py
python
SpeakerList.query
(self, view_kwargs)
return query_
query method for speakers list class :param view_kwargs: :return:
query method for speakers list class :param view_kwargs: :return:
[ "query", "method", "for", "speakers", "list", "class", ":", "param", "view_kwargs", ":", ":", "return", ":" ]
def query(self, view_kwargs): """ query method for speakers list class :param view_kwargs: :return: """ query_ = self.session.query(Speaker) query_ = event_query(query_, view_kwargs) if view_kwargs.get('user_id'): user = safe_query_kwargs(User...
[ "def", "query", "(", "self", ",", "view_kwargs", ")", ":", "query_", "=", "self", ".", "session", ".", "query", "(", "Speaker", ")", "query_", "=", "event_query", "(", "query_", ",", "view_kwargs", ")", "if", "view_kwargs", ".", "get", "(", "'user_id'", ...
https://github.com/fossasia/open-event-server/blob/5ce3b88c0bcf8685944e634701203944b2cf17dd/app/api/speakers.py#L133-L158
oracle/graalpython
577e02da9755d916056184ec441c26e00b70145c
graalpython/lib-python/3/encodings/mac_greek.py
python
Codec.encode
(self,input,errors='strict')
return codecs.charmap_encode(input,errors,encoding_table)
[]
def encode(self,input,errors='strict'): return codecs.charmap_encode(input,errors,encoding_table)
[ "def", "encode", "(", "self", ",", "input", ",", "errors", "=", "'strict'", ")", ":", "return", "codecs", ".", "charmap_encode", "(", "input", ",", "errors", ",", "encoding_table", ")" ]
https://github.com/oracle/graalpython/blob/577e02da9755d916056184ec441c26e00b70145c/graalpython/lib-python/3/encodings/mac_greek.py#L11-L12
novoid/Memacs
cc5b89a1da011a1ef08550e4da06c01881995b77
memacs/lib/orgwriter.py
python
OrgOutputWriter.write
(self, output)
Write "<output>"
Write "<output>"
[ "Write", "<output", ">" ]
def write(self, output): """ Write "<output>" """ if self.__handler: self.__handler.write(str(output)) else: if self.__test: self.__test_data += output else: # don't remove the comma(otherwise there will be a \n)...
[ "def", "write", "(", "self", ",", "output", ")", ":", "if", "self", ".", "__handler", ":", "self", ".", "__handler", ".", "write", "(", "str", "(", "output", ")", ")", "else", ":", "if", "self", ".", "__test", ":", "self", ".", "__test_data", "+=",...
https://github.com/novoid/Memacs/blob/cc5b89a1da011a1ef08550e4da06c01881995b77/memacs/lib/orgwriter.py#L74-L85
wy1iu/SphereNet
110ce2a57b64129285947e63854b9e3ffcb94a9b
sphere_resnet/cifar10plus_input.py
python
read_cifar10
(filename_queue)
return result
Reads and parses examples from CIFAR10 data files. Recommendation: if you want N-way read parallelism, call this function N times. This will give you N independent Readers reading different files & positions within those files, which will give better mixing of examples. Args: filename_queue: A queue of...
Reads and parses examples from CIFAR10 data files.
[ "Reads", "and", "parses", "examples", "from", "CIFAR10", "data", "files", "." ]
def read_cifar10(filename_queue): """Reads and parses examples from CIFAR10 data files. Recommendation: if you want N-way read parallelism, call this function N times. This will give you N independent Readers reading different files & positions within those files, which will give better mixing of examples. ...
[ "def", "read_cifar10", "(", "filename_queue", ")", ":", "class", "CIFAR10Record", "(", "object", ")", ":", "pass", "result", "=", "CIFAR10Record", "(", ")", "# Dimensions of the images in the CIFAR-10 dataset.", "# See http://www.cs.toronto.edu/~kriz/cifar.html for a descriptio...
https://github.com/wy1iu/SphereNet/blob/110ce2a57b64129285947e63854b9e3ffcb94a9b/sphere_resnet/cifar10plus_input.py#L38-L98
mlflow/mlflow
364aca7daf0fcee3ec407ae0b1b16d9cb3085081
mlflow/entities/run_info.py
python
RunInfo.run_id
(self)
return self._run_id
String containing run id.
String containing run id.
[ "String", "containing", "run", "id", "." ]
def run_id(self): """String containing run id.""" return self._run_id
[ "def", "run_id", "(", "self", ")", ":", "return", "self", ".", "_run_id" ]
https://github.com/mlflow/mlflow/blob/364aca7daf0fcee3ec407ae0b1b16d9cb3085081/mlflow/entities/run_info.py#L101-L103
uqfoundation/multiprocess
028cc73f02655e6451d92e5147d19d8c10aebe50
pypy3.6/multiprocess/spawn.py
python
is_forking
(argv)
Return whether commandline indicates we are forking
Return whether commandline indicates we are forking
[ "Return", "whether", "commandline", "indicates", "we", "are", "forking" ]
def is_forking(argv): ''' Return whether commandline indicates we are forking ''' if len(argv) >= 2 and argv[1] == '--multiprocessing-fork': return True else: return False
[ "def", "is_forking", "(", "argv", ")", ":", "if", "len", "(", "argv", ")", ">=", "2", "and", "argv", "[", "1", "]", "==", "'--multiprocessing-fork'", ":", "return", "True", "else", ":", "return", "False" ]
https://github.com/uqfoundation/multiprocess/blob/028cc73f02655e6451d92e5147d19d8c10aebe50/pypy3.6/multiprocess/spawn.py#L52-L59
fossasia/AYABInterface
e2065eed8daf17b2936f6ca5e488c9bfb850914e
AYABInterface/actions.py
python
Action.__repr__
(self)
return self.__class__.__name__ + repr(self._arguments)
Return this object as string. :rtype: str
Return this object as string.
[ "Return", "this", "object", "as", "string", "." ]
def __repr__(self): """Return this object as string. :rtype: str """ return self.__class__.__name__ + repr(self._arguments)
[ "def", "__repr__", "(", "self", ")", ":", "return", "self", ".", "__class__", ".", "__name__", "+", "repr", "(", "self", ".", "_arguments", ")" ]
https://github.com/fossasia/AYABInterface/blob/e2065eed8daf17b2936f6ca5e488c9bfb850914e/AYABInterface/actions.py#L72-L77
anfederico/Gemini
54fbf71ce42799bab116d9047ca3cb89ceff8272
gemini/helpers/timeframe_resampler.py
python
resample
(data, period='D')
return data
Return resampled dataframe Allowed periods: * T - minute (15T - 15 minutes), * H - hour, * D - day, * W - week, * M - month :param data: :param period: :return:
Return resampled dataframe
[ "Return", "resampled", "dataframe" ]
def resample(data, period='D'): """ Return resampled dataframe Allowed periods: * T - minute (15T - 15 minutes), * H - hour, * D - day, * W - week, * M - month :param data: :param period: :return: """ if period[-1:] not in ['T', 'H', 'D', 'W', 'M']: logger....
[ "def", "resample", "(", "data", ",", "period", "=", "'D'", ")", ":", "if", "period", "[", "-", "1", ":", "]", "not", "in", "[", "'T'", ",", "'H'", ",", "'D'", ",", "'W'", ",", "'M'", "]", ":", "logger", ".", "warning", "(", "'Unknown period for r...
https://github.com/anfederico/Gemini/blob/54fbf71ce42799bab116d9047ca3cb89ceff8272/gemini/helpers/timeframe_resampler.py#L6-L32
LexPredict/lexpredict-contraxsuite
1d5a2540d31f8f3f1adc442cfa13a7c007319899
sdk/python/sdk/openapi_client/model/project_list_status_data.py
python
ProjectListStatusData.__init__
(self, name, order, *args, **kwargs)
ProjectListStatusData - a model defined in OpenAPI Args: name (str): order (int): Keyword Args: _check_type (bool): if True, values for parameters in openapi_types will be type checked and a TypeError will be ...
ProjectListStatusData - a model defined in OpenAPI
[ "ProjectListStatusData", "-", "a", "model", "defined", "in", "OpenAPI" ]
def __init__(self, name, order, *args, **kwargs): # noqa: E501 """ProjectListStatusData - a model defined in OpenAPI Args: name (str): order (int): Keyword Args: _check_type (bool): if True, values for parameters in openapi_types ...
[ "def", "__init__", "(", "self", ",", "name", ",", "order", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "# noqa: E501", "_check_type", "=", "kwargs", ".", "pop", "(", "'_check_type'", ",", "True", ")", "_spec_property_naming", "=", "kwargs", ".",...
https://github.com/LexPredict/lexpredict-contraxsuite/blob/1d5a2540d31f8f3f1adc442cfa13a7c007319899/sdk/python/sdk/openapi_client/model/project_list_status_data.py#L215-L294
cloudera/hue
23f02102d4547c17c32bd5ea0eb24e9eadd657a4
desktop/core/ext-py/kazoo-2.8.0/kazoo/interfaces.py
python
IHandler.spawn
(self, func, *args, **kwargs)
Spawn a function to run asynchronously :param args: args to call the function with. :param kwargs: keyword args to call the function with. This method should return immediately and execute the function with the provided args and kwargs in an asynchronous manner.
Spawn a function to run asynchronously
[ "Spawn", "a", "function", "to", "run", "asynchronously" ]
def spawn(self, func, *args, **kwargs): """Spawn a function to run asynchronously :param args: args to call the function with. :param kwargs: keyword args to call the function with. This method should return immediately and execute the function with the provided args and kwargs...
[ "def", "spawn", "(", "self", ",", "func", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":" ]
https://github.com/cloudera/hue/blob/23f02102d4547c17c32bd5ea0eb24e9eadd657a4/desktop/core/ext-py/kazoo-2.8.0/kazoo/interfaces.py#L83-L92
plotly/plotly.py
cfad7862594b35965c0e000813bd7805e8494a5b
packages/python/plotly/plotly/graph_objs/table/_header.py
python
Header.prefixsrc
(self)
return self["prefixsrc"]
Sets the source reference on Chart Studio Cloud for `prefix`. The 'prefixsrc' property must be specified as a string or as a plotly.grid_objs.Column object Returns ------- str
Sets the source reference on Chart Studio Cloud for `prefix`. The 'prefixsrc' property must be specified as a string or as a plotly.grid_objs.Column object
[ "Sets", "the", "source", "reference", "on", "Chart", "Studio", "Cloud", "for", "prefix", ".", "The", "prefixsrc", "property", "must", "be", "specified", "as", "a", "string", "or", "as", "a", "plotly", ".", "grid_objs", ".", "Column", "object" ]
def prefixsrc(self): """ Sets the source reference on Chart Studio Cloud for `prefix`. The 'prefixsrc' property must be specified as a string or as a plotly.grid_objs.Column object Returns ------- str """ return self["prefixsrc"]
[ "def", "prefixsrc", "(", "self", ")", ":", "return", "self", "[", "\"prefixsrc\"", "]" ]
https://github.com/plotly/plotly.py/blob/cfad7862594b35965c0e000813bd7805e8494a5b/packages/python/plotly/plotly/graph_objs/table/_header.py#L280-L291
openhatch/oh-mainline
ce29352a034e1223141dcc2f317030bbc3359a51
vendor/packages/gdata/src/gdata/gauth.py
python
generate_request_for_access_token
( request_token, auth_server_url=ACCESS_TOKEN_URL)
return request_token.modify_request(http_request)
Creates a request to ask the OAuth server for an access token. Requires a request token which the user has authorized. See the documentation on OAuth with Google Data for more details: http://code.google.com/apis/accounts/docs/OAuth.html#AccessToken Args: request_token: An OAuthHmacToken or OAuthRsaToken ...
Creates a request to ask the OAuth server for an access token.
[ "Creates", "a", "request", "to", "ask", "the", "OAuth", "server", "for", "an", "access", "token", "." ]
def generate_request_for_access_token( request_token, auth_server_url=ACCESS_TOKEN_URL): """Creates a request to ask the OAuth server for an access token. Requires a request token which the user has authorized. See the documentation on OAuth with Google Data for more details: http://code.google.com/apis/ac...
[ "def", "generate_request_for_access_token", "(", "request_token", ",", "auth_server_url", "=", "ACCESS_TOKEN_URL", ")", ":", "http_request", "=", "atom", ".", "http_core", ".", "HttpRequest", "(", "auth_server_url", ",", "'POST'", ")", "http_request", ".", "headers", ...
https://github.com/openhatch/oh-mainline/blob/ce29352a034e1223141dcc2f317030bbc3359a51/vendor/packages/gdata/src/gdata/gauth.py#L768-L789
QCoDeS/Qcodes
3cda2cef44812e2aa4672781f2423bf5f816f9f9
qcodes/instrument_drivers/tektronix/AWG70002A.py
python
AWG70002A.__init__
(self, name: str, address: str, timeout: float=10, **kwargs: Any)
Args: name: The name used internally by QCoDeS in the DataSet address: The VISA resource name of the instrument timeout: The VISA timeout time (in seconds).
Args: name: The name used internally by QCoDeS in the DataSet address: The VISA resource name of the instrument timeout: The VISA timeout time (in seconds).
[ "Args", ":", "name", ":", "The", "name", "used", "internally", "by", "QCoDeS", "in", "the", "DataSet", "address", ":", "The", "VISA", "resource", "name", "of", "the", "instrument", "timeout", ":", "The", "VISA", "timeout", "time", "(", "in", "seconds", "...
def __init__(self, name: str, address: str, timeout: float=10, **kwargs: Any) -> None: """ Args: name: The name used internally by QCoDeS in the DataSet address: The VISA resource name of the instrument timeout: The VISA timeout time (in seconds). ...
[ "def", "__init__", "(", "self", ",", "name", ":", "str", ",", "address", ":", "str", ",", "timeout", ":", "float", "=", "10", ",", "*", "*", "kwargs", ":", "Any", ")", "->", "None", ":", "super", "(", ")", ".", "__init__", "(", "name", ",", "ad...
https://github.com/QCoDeS/Qcodes/blob/3cda2cef44812e2aa4672781f2423bf5f816f9f9/qcodes/instrument_drivers/tektronix/AWG70002A.py#L13-L23
QQuick/Transcrypt
68b4b71d4ff3e4d58281b24e9e2dcc9fc766e822
transcrypt/modules/logging/__init__.py
python
Logger.addHandler
(self, hdlr)
Add the specified handler to this logger.
Add the specified handler to this logger.
[ "Add", "the", "specified", "handler", "to", "this", "logger", "." ]
def addHandler(self, hdlr): """ Add the specified handler to this logger. """ _acquireLock() try: if not (hdlr in self.handlers): self.handlers.append(hdlr) finally: _releaseLock()
[ "def", "addHandler", "(", "self", ",", "hdlr", ")", ":", "_acquireLock", "(", ")", "try", ":", "if", "not", "(", "hdlr", "in", "self", ".", "handlers", ")", ":", "self", ".", "handlers", ".", "append", "(", "hdlr", ")", "finally", ":", "_releaseLock"...
https://github.com/QQuick/Transcrypt/blob/68b4b71d4ff3e4d58281b24e9e2dcc9fc766e822/transcrypt/modules/logging/__init__.py#L1510-L1519
biolab/orange3
41685e1c7b1d1babe680113685a2d44bcc9fec0b
Orange/widgets/data/owimpute.py
python
Task.__init__
(self, futures, watcher)
[]
def __init__(self, futures, watcher): self.futures = futures self.watcher = watcher
[ "def", "__init__", "(", "self", ",", "futures", ",", "watcher", ")", ":", "self", ".", "futures", "=", "futures", "self", ".", "watcher", "=", "watcher" ]
https://github.com/biolab/orange3/blob/41685e1c7b1d1babe680113685a2d44bcc9fec0b/Orange/widgets/data/owimpute.py#L86-L88
pavlov99/json-rpc
00b24a9e811d9ca89ec3b1570195c881687bbef4
jsonrpc/jsonrpc2.py
python
JSONRPC20BatchResponse.json
(self)
return json.dumps(self.data)
[]
def json(self): return json.dumps(self.data)
[ "def", "json", "(", "self", ")", ":", "return", "json", ".", "dumps", "(", "self", ".", "data", ")" ]
https://github.com/pavlov99/json-rpc/blob/00b24a9e811d9ca89ec3b1570195c881687bbef4/jsonrpc/jsonrpc2.py#L263-L264
cobbler/cobbler
eed8cdca3e970c8aa1d199e80b8c8f19b3f940cc
cobbler/services.py
python
CobblerSvc.settings
(self)
return Settings().from_dict(self.remote.get_settings())
Get the application configuration. :return: Settings object.
Get the application configuration.
[ "Get", "the", "application", "configuration", "." ]
def settings(self) -> Settings: """ Get the application configuration. :return: Settings object. """ self.__xmlrpc_setup() return Settings().from_dict(self.remote.get_settings())
[ "def", "settings", "(", "self", ")", "->", "Settings", ":", "self", ".", "__xmlrpc_setup", "(", ")", "return", "Settings", "(", ")", ".", "from_dict", "(", "self", ".", "remote", ".", "get_settings", "(", ")", ")" ]
https://github.com/cobbler/cobbler/blob/eed8cdca3e970c8aa1d199e80b8c8f19b3f940cc/cobbler/services.py#L60-L67
accurics/terrascan
9f75f7506d9d796e427c15ff789bb48e27165dd5
docs/policies/document_policies.py
python
dir_size
(dir)
[]
def dir_size(dir): for policy_type in os.listdir(dir): with open(f"docs/policies/{policy_type}.md", "w") as f: f.write(f"\n") for resource_type in os.listdir(os.path.join(dir,policy_type)): f.write(f"### {resource_type}\n") f.write("| Category | Resour...
[ "def", "dir_size", "(", "dir", ")", ":", "for", "policy_type", "in", "os", ".", "listdir", "(", "dir", ")", ":", "with", "open", "(", "f\"docs/policies/{policy_type}.md\"", ",", "\"w\"", ")", "as", "f", ":", "f", ".", "write", "(", "f\"\\n\"", ")", "fo...
https://github.com/accurics/terrascan/blob/9f75f7506d9d796e427c15ff789bb48e27165dd5/docs/policies/document_policies.py#L4-L23
truenas/middleware
b11ec47d6340324f5a32287ffb4012e5d709b934
src/freenas/usr/local/share/python-gdb/libpython.py
python
PyFrameObjectPtr.iter_locals
(self)
Yield a sequence of (name,value) pairs of PyObjectPtr instances, for the local variables of this frame
Yield a sequence of (name,value) pairs of PyObjectPtr instances, for the local variables of this frame
[ "Yield", "a", "sequence", "of", "(", "name", "value", ")", "pairs", "of", "PyObjectPtr", "instances", "for", "the", "local", "variables", "of", "this", "frame" ]
def iter_locals(self): ''' Yield a sequence of (name,value) pairs of PyObjectPtr instances, for the local variables of this frame ''' if self.is_optimized_out(): return f_localsplus = self.field('f_localsplus') for i in safe_range(self.co_nlocals): ...
[ "def", "iter_locals", "(", "self", ")", ":", "if", "self", ".", "is_optimized_out", "(", ")", ":", "return", "f_localsplus", "=", "self", ".", "field", "(", "'f_localsplus'", ")", "for", "i", "in", "safe_range", "(", "self", ".", "co_nlocals", ")", ":", ...
https://github.com/truenas/middleware/blob/b11ec47d6340324f5a32287ffb4012e5d709b934/src/freenas/usr/local/share/python-gdb/libpython.py#L855-L868
oracle/graalpython
577e02da9755d916056184ec441c26e00b70145c
graalpython/lib-python/3/encodings/utf_32.py
python
StreamReader.reset
(self)
[]
def reset(self): codecs.StreamReader.reset(self) try: del self.decode except AttributeError: pass
[ "def", "reset", "(", "self", ")", ":", "codecs", ".", "StreamReader", ".", "reset", "(", "self", ")", "try", ":", "del", "self", ".", "decode", "except", "AttributeError", ":", "pass" ]
https://github.com/oracle/graalpython/blob/577e02da9755d916056184ec441c26e00b70145c/graalpython/lib-python/3/encodings/utf_32.py#L121-L126
deluge-torrent/deluge
2316088f5c0dd6cb044d9d4832fa7d56dcc79cdc
deluge/plugins/Blocklist/deluge_blocklist/core.py
python
Core.on_download_complete
(self, blocklist)
return threads.deferToThread(self.update_info, blocklist)
Runs any download clean up functions. Args: blocklist (str): Path of blocklist. Returns: Deferred: a Deferred which fires when clean up is done.
Runs any download clean up functions.
[ "Runs", "any", "download", "clean", "up", "functions", "." ]
def on_download_complete(self, blocklist): """Runs any download clean up functions. Args: blocklist (str): Path of blocklist. Returns: Deferred: a Deferred which fires when clean up is done. """ log.debug('Blocklist download complete: %s', blocklist) ...
[ "def", "on_download_complete", "(", "self", ",", "blocklist", ")", ":", "log", ".", "debug", "(", "'Blocklist download complete: %s'", ",", "blocklist", ")", "self", ".", "is_downloading", "=", "False", "return", "threads", ".", "deferToThread", "(", "self", "."...
https://github.com/deluge-torrent/deluge/blob/2316088f5c0dd6cb044d9d4832fa7d56dcc79cdc/deluge/plugins/Blocklist/deluge_blocklist/core.py#L336-L348
osmr/imgclsmob
f2993d3ce73a2f7ddba05da3891defb08547d504
pytorch/pytorchcv/models/ibnresnet.py
python
ibn_resnet152
(**kwargs)
return get_ibnresnet(blocks=152, model_name="ibn_resnet152", **kwargs)
IBN-ResNet-152 model from 'Two at Once: Enhancing Learning and Generalization Capacities via IBN-Net,' https://arxiv.org/abs/1807.09441. Parameters: ---------- pretrained : bool, default False Whether to load the pretrained weights for model. root : str, default '~/.torch/models' Lo...
IBN-ResNet-152 model from 'Two at Once: Enhancing Learning and Generalization Capacities via IBN-Net,' https://arxiv.org/abs/1807.09441.
[ "IBN", "-", "ResNet", "-", "152", "model", "from", "Two", "at", "Once", ":", "Enhancing", "Learning", "and", "Generalization", "Capacities", "via", "IBN", "-", "Net", "https", ":", "//", "arxiv", ".", "org", "/", "abs", "/", "1807", ".", "09441", "." ]
def ibn_resnet152(**kwargs): """ IBN-ResNet-152 model from 'Two at Once: Enhancing Learning and Generalization Capacities via IBN-Net,' https://arxiv.org/abs/1807.09441. Parameters: ---------- pretrained : bool, default False Whether to load the pretrained weights for model. root : ...
[ "def", "ibn_resnet152", "(", "*", "*", "kwargs", ")", ":", "return", "get_ibnresnet", "(", "blocks", "=", "152", ",", "model_name", "=", "\"ibn_resnet152\"", ",", "*", "*", "kwargs", ")" ]
https://github.com/osmr/imgclsmob/blob/f2993d3ce73a2f7ddba05da3891defb08547d504/pytorch/pytorchcv/models/ibnresnet.py#L364-L376
wzzheng/HDML
fa03ef0eb0be2256df7aab928bcc596c41d44fb3
main_npair.py
python
main
(_)
[]
def main(_): if not FLAGS.LossType == 'NpairLoss': print("LossType n-pair-loss is required") return 0 # placeholders x_raw = tf.placeholder(tf.float32, shape=[None, FLAGS.default_image_size, FLAGS.default_image_size, 3]) label_raw = tf.placeholder(tf.int32, shape=[None, 1]) with tf....
[ "def", "main", "(", "_", ")", ":", "if", "not", "FLAGS", ".", "LossType", "==", "'NpairLoss'", ":", "print", "(", "\"LossType n-pair-loss is required\"", ")", "return", "0", "# placeholders", "x_raw", "=", "tf", ".", "placeholder", "(", "tf", ".", "float32",...
https://github.com/wzzheng/HDML/blob/fa03ef0eb0be2256df7aab928bcc596c41d44fb3/main_npair.py#L24-L249
Cadene/tensorflow-model-zoo.torch
990b10ffc22d4c8eacb2a502f20415b4f70c74c2
models/samples/core/get_started/custom_estimator.py
python
eval_input_fn
(features, labels=None, batch_size=None)
return dataset.make_one_shot_iterator().get_next()
An input function for evaluation or prediction
An input function for evaluation or prediction
[ "An", "input", "function", "for", "evaluation", "or", "prediction" ]
def eval_input_fn(features, labels=None, batch_size=None): """An input function for evaluation or prediction""" if labels is None: # No labels, use only features. inputs = features else: inputs = (features, labels) # Convert the inputs to a Dataset. dataset = tf.data.Dataset...
[ "def", "eval_input_fn", "(", "features", ",", "labels", "=", "None", ",", "batch_size", "=", "None", ")", ":", "if", "labels", "is", "None", ":", "# No labels, use only features.", "inputs", "=", "features", "else", ":", "inputs", "=", "(", "features", ",", ...
https://github.com/Cadene/tensorflow-model-zoo.torch/blob/990b10ffc22d4c8eacb2a502f20415b4f70c74c2/models/samples/core/get_started/custom_estimator.py#L62-L78
hardbyte/python-can
e7a2b040ee1f0cdd7fd77fbfef0454353166b333
can/interfaces/kvaser/structures.py
python
BusStatistics.std_data
(self)
return self.m_stdData
Number of received standard (11-bit identifiers) data frames.
Number of received standard (11-bit identifiers) data frames.
[ "Number", "of", "received", "standard", "(", "11", "-", "bit", "identifiers", ")", "data", "frames", "." ]
def std_data(self): """Number of received standard (11-bit identifiers) data frames.""" return self.m_stdData
[ "def", "std_data", "(", "self", ")", ":", "return", "self", ".", "m_stdData" ]
https://github.com/hardbyte/python-can/blob/e7a2b040ee1f0cdd7fd77fbfef0454353166b333/can/interfaces/kvaser/structures.py#L42-L44
makehumancommunity/makehuman
8006cf2cc851624619485658bb933a4244bbfd7c
makehuman/lib/getpath.py
python
getRelativePath
(path, relativeTo = [getDataPath(), getSysDataPath()], strict=False)
return formatPath(rpath)
Return a relative file path, relative to one of the specified search paths. First valid path is returned, so order in which search paths are given matters.
Return a relative file path, relative to one of the specified search paths. First valid path is returned, so order in which search paths are given matters.
[ "Return", "a", "relative", "file", "path", "relative", "to", "one", "of", "the", "specified", "search", "paths", ".", "First", "valid", "path", "is", "returned", "so", "order", "in", "which", "search", "paths", "are", "given", "matters", "." ]
def getRelativePath(path, relativeTo = [getDataPath(), getSysDataPath()], strict=False): """ Return a relative file path, relative to one of the specified search paths. First valid path is returned, so order in which search paths are given matters. """ if not isinstance(relativeTo, list): re...
[ "def", "getRelativePath", "(", "path", ",", "relativeTo", "=", "[", "getDataPath", "(", ")", ",", "getSysDataPath", "(", ")", "]", ",", "strict", "=", "False", ")", ":", "if", "not", "isinstance", "(", "relativeTo", ",", "list", ")", ":", "relativeTo", ...
https://github.com/makehumancommunity/makehuman/blob/8006cf2cc851624619485658bb933a4244bbfd7c/makehuman/lib/getpath.py#L263-L284
BerkeleyAutomation/gqcnn
499a609fe9dfb074bdfb6c4e6e33667ea50f4c21
gqcnn/grasping/grasp_quality_function.py
python
NoMagicQualityFunction.grasps_to_tensors
(self, grasps, state)
return image_tensor, pose_tensor
Converts a list of grasps to an image and pose tensor for fast grasp quality evaluation. Attributes ---------- grasps : :obj:`list` of :obj:`object` List of image grasps to convert. state : :obj:`RgbdImageState` RGB-D image to plan grasps on. Ret...
Converts a list of grasps to an image and pose tensor for fast grasp quality evaluation.
[ "Converts", "a", "list", "of", "grasps", "to", "an", "image", "and", "pose", "tensor", "for", "fast", "grasp", "quality", "evaluation", "." ]
def grasps_to_tensors(self, grasps, state): """Converts a list of grasps to an image and pose tensor for fast grasp quality evaluation. Attributes ---------- grasps : :obj:`list` of :obj:`object` List of image grasps to convert. state : :obj:`RgbdImageState` ...
[ "def", "grasps_to_tensors", "(", "self", ",", "grasps", ",", "state", ")", ":", "# Parse params.", "gqcnn_im_height", "=", "self", ".", "_im_height", "gqcnn_im_width", "=", "self", ".", "_im_width", "gqcnn_num_channels", "=", "self", ".", "_num_channels", "gqcnn_p...
https://github.com/BerkeleyAutomation/gqcnn/blob/499a609fe9dfb074bdfb6c4e6e33667ea50f4c21/gqcnn/grasping/grasp_quality_function.py#L1114-L1179
ray-project/ray
703c1610348615dcb8c2d141a0c46675084660f5
python/ray/serve/router.py
python
ReplicaSet._try_assign_replica
(self, query: Query)
return None
Try to assign query to a replica, return the object ref if succeeded or return None if it can't assign this query to any replicas.
Try to assign query to a replica, return the object ref if succeeded or return None if it can't assign this query to any replicas.
[ "Try", "to", "assign", "query", "to", "a", "replica", "return", "the", "object", "ref", "if", "succeeded", "or", "return", "None", "if", "it", "can", "t", "assign", "this", "query", "to", "any", "replicas", "." ]
def _try_assign_replica(self, query: Query) -> Optional[ray.ObjectRef]: """Try to assign query to a replica, return the object ref if succeeded or return None if it can't assign this query to any replicas. """ for _ in range(len(self.in_flight_queries.keys())): replica = next...
[ "def", "_try_assign_replica", "(", "self", ",", "query", ":", "Query", ")", "->", "Optional", "[", "ray", ".", "ObjectRef", "]", ":", "for", "_", "in", "range", "(", "len", "(", "self", ".", "in_flight_queries", ".", "keys", "(", ")", ")", ")", ":", ...
https://github.com/ray-project/ray/blob/703c1610348615dcb8c2d141a0c46675084660f5/python/ray/serve/router.py#L106-L124
deepmind/bsuite
f305972cf05042f6ce23d638477ea9b33918ba17
bsuite/experiments/deep_sea/analysis.py
python
_make_baseline
(plt_df: pd.DataFrame, sweep_vars: Optional[Sequence[str]] = None)
Generate baseline 2^N data for each combination of sweep_vars.
Generate baseline 2^N data for each combination of sweep_vars.
[ "Generate", "baseline", "2^N", "data", "for", "each", "combination", "of", "sweep_vars", "." ]
def _make_baseline(plt_df: pd.DataFrame, sweep_vars: Optional[Sequence[str]] = None) -> pd.DataFrame: """Generate baseline 2^N data for each combination of sweep_vars.""" x = np.arange(5, 20) baseline = pd.DataFrame(dict(size=x, episode=2**x)) if sweep_vars: params = plt_df.groupby(sweep_...
[ "def", "_make_baseline", "(", "plt_df", ":", "pd", ".", "DataFrame", ",", "sweep_vars", ":", "Optional", "[", "Sequence", "[", "str", "]", "]", "=", "None", ")", "->", "pd", ".", "DataFrame", ":", "x", "=", "np", ".", "arange", "(", "5", ",", "20",...
https://github.com/deepmind/bsuite/blob/f305972cf05042f6ce23d638477ea9b33918ba17/bsuite/experiments/deep_sea/analysis.py#L95-L110
mypaint/mypaint
90b36dbc7b8bd2f323383f7edf608a5e0a3a1a33
gui/document.py
python
Document._layer_picking_iter
(self)
Enumerates leaf layers in picking order, with paths
Enumerates leaf layers in picking order, with paths
[ "Enumerates", "leaf", "layers", "in", "picking", "order", "with", "paths" ]
def _layer_picking_iter(self): """Enumerates leaf layers in picking order, with paths""" layer_stack = self.model.layer_stack parents = set() for path, layer in layer_stack.walk(): if path in parents: continue parent_path = path[:-1] pa...
[ "def", "_layer_picking_iter", "(", "self", ")", ":", "layer_stack", "=", "self", ".", "model", ".", "layer_stack", "parents", "=", "set", "(", ")", "for", "path", ",", "layer", "in", "layer_stack", ".", "walk", "(", ")", ":", "if", "path", "in", "paren...
https://github.com/mypaint/mypaint/blob/90b36dbc7b8bd2f323383f7edf608a5e0a3a1a33/gui/document.py#L1138-L1147
andresriancho/w3af
cd22e5252243a87aaa6d0ddea47cf58dacfe00a9
w3af/core/controllers/payload_transfer/base_payload_transfer.py
python
BasePayloadTransfer.can_transfer
(self)
This method is used to test if the transfer method works as expected. Usually the implementation of this should transfer 10 bytes and check if they arrived as expected to the other end.
This method is used to test if the transfer method works as expected. Usually the implementation of this should transfer 10 bytes and check if they arrived as expected to the other end.
[ "This", "method", "is", "used", "to", "test", "if", "the", "transfer", "method", "works", "as", "expected", ".", "Usually", "the", "implementation", "of", "this", "should", "transfer", "10", "bytes", "and", "check", "if", "they", "arrived", "as", "expected",...
def can_transfer(self): """ This method is used to test if the transfer method works as expected. Usually the implementation of this should transfer 10 bytes and check if they arrived as expected to the other end. """ raise NotImplementedError()
[ "def", "can_transfer", "(", "self", ")", ":", "raise", "NotImplementedError", "(", ")" ]
https://github.com/andresriancho/w3af/blob/cd22e5252243a87aaa6d0ddea47cf58dacfe00a9/w3af/core/controllers/payload_transfer/base_payload_transfer.py#L34-L40
tensorflow/ranking
94cccec8b4e71d2cc4489c61e2623522738c2924
tensorflow_ranking/research/dasalc.py
python
main
(_)
[]
def main(_): tf.compat.v1.logging.set_verbosity(tf.compat.v1.logging.INFO) train_and_eval()
[ "def", "main", "(", "_", ")", ":", "tf", ".", "compat", ".", "v1", ".", "logging", ".", "set_verbosity", "(", "tf", ".", "compat", ".", "v1", ".", "logging", ".", "INFO", ")", "train_and_eval", "(", ")" ]
https://github.com/tensorflow/ranking/blob/94cccec8b4e71d2cc4489c61e2623522738c2924/tensorflow_ranking/research/dasalc.py#L314-L316
pantsbuild/pex
473c6ac732ed4bc338b4b20a9ec930d1d722c9b4
pex/vendor/_vendored/pip/pip/_vendor/requests/models.py
python
PreparedRequest.prepare_url
(self, url, params)
Prepares the given HTTP URL.
Prepares the given HTTP URL.
[ "Prepares", "the", "given", "HTTP", "URL", "." ]
def prepare_url(self, url, params): """Prepares the given HTTP URL.""" #: Accept objects that have string representations. #: We're unable to blindly call unicode/str functions #: as this will include the bytestring indicator (b'') #: on python 3.x. #: https://github.com/...
[ "def", "prepare_url", "(", "self", ",", "url", ",", "params", ")", ":", "#: Accept objects that have string representations.", "#: We're unable to blindly call unicode/str functions", "#: as this will include the bytestring indicator (b'')", "#: on python 3.x.", "#: https://github.com/ps...
https://github.com/pantsbuild/pex/blob/473c6ac732ed4bc338b4b20a9ec930d1d722c9b4/pex/vendor/_vendored/pip/pip/_vendor/requests/models.py#L358-L442
wrye-bash/wrye-bash
d495c47cfdb44475befa523438a40c4419cb386f
Mopy/bash/bosh/bain.py
python
InstallersData._skips_in_data_dir
(sDirs)
Skip some top level directories based on global settings - EVEN on a fullRefresh.
Skip some top level directories based on global settings - EVEN on a fullRefresh.
[ "Skip", "some", "top", "level", "directories", "based", "on", "global", "settings", "-", "EVEN", "on", "a", "fullRefresh", "." ]
def _skips_in_data_dir(sDirs): """Skip some top level directories based on global settings - EVEN on a fullRefresh.""" setSkipOBSE = not bass.settings[u'bash.installers.allowOBSEPlugins'] setSkipDocs = bass.settings[u'bash.installers.skipDocs'] setSkipImages = bass.settings[u'bas...
[ "def", "_skips_in_data_dir", "(", "sDirs", ")", ":", "setSkipOBSE", "=", "not", "bass", ".", "settings", "[", "u'bash.installers.allowOBSEPlugins'", "]", "setSkipDocs", "=", "bass", ".", "settings", "[", "u'bash.installers.skipDocs'", "]", "setSkipImages", "=", "bas...
https://github.com/wrye-bash/wrye-bash/blob/d495c47cfdb44475befa523438a40c4419cb386f/Mopy/bash/bosh/bain.py#L2154-L2184
haiwen/seahub
e92fcd44e3e46260597d8faa9347cb8222b8b10d
seahub/work_weixin/management/commands/fix_work_weixin_departments_sync.py
python
Command.log_debug
(self, msg)
[]
def log_debug(self, msg): logger.debug(msg) self.println(msg)
[ "def", "log_debug", "(", "self", ",", "msg", ")", ":", "logger", ".", "debug", "(", "msg", ")", "self", ".", "println", "(", "msg", ")" ]
https://github.com/haiwen/seahub/blob/e92fcd44e3e46260597d8faa9347cb8222b8b10d/seahub/work_weixin/management/commands/fix_work_weixin_departments_sync.py#L32-L34
Jenyay/outwiker
50530cf7b3f71480bb075b2829bc0669773b835b
src/outwiker/core/sortfunctions.py
python
sortOrderFunction
(page1, page2)
return 0
Функция для сортировки страниц с учетом order
Функция для сортировки страниц с учетом order
[ "Функция", "для", "сортировки", "страниц", "с", "учетом", "order" ]
def sortOrderFunction(page1, page2): """ Функция для сортировки страниц с учетом order """ orderpage1 = page1.params.orderOption.value orderpage2 = page2.params.orderOption.value # Если еще не установили порядок страницы (значение по умолчанию: -1) if orderpage1 == -1 or orderpage2 == -1: ...
[ "def", "sortOrderFunction", "(", "page1", ",", "page2", ")", ":", "orderpage1", "=", "page1", ".", "params", ".", "orderOption", ".", "value", "orderpage2", "=", "page2", ".", "params", ".", "orderOption", ".", "value", "# Если еще не установили порядок страницы (...
https://github.com/Jenyay/outwiker/blob/50530cf7b3f71480bb075b2829bc0669773b835b/src/outwiker/core/sortfunctions.py#L7-L22
OUCMachineLearning/OUCML
5b54337d7c0316084cb1a74befda2bba96137d4a
One_Day_One_GAN/day6/srgan_pytorch/models.py
python
DenseResidualBlock.forward
(self, x)
return out.mul(self.res_scale) + x
[]
def forward(self, x): inputs = x for block in self.blocks: out = block(inputs) inputs = torch.cat([inputs, out], 1) return out.mul(self.res_scale) + x
[ "def", "forward", "(", "self", ",", "x", ")", ":", "inputs", "=", "x", "for", "block", "in", "self", ".", "blocks", ":", "out", "=", "block", "(", "inputs", ")", "inputs", "=", "torch", ".", "cat", "(", "[", "inputs", ",", "out", "]", ",", "1",...
https://github.com/OUCMachineLearning/OUCML/blob/5b54337d7c0316084cb1a74befda2bba96137d4a/One_Day_One_GAN/day6/srgan_pytorch/models.py#L41-L46
brython-dev/brython
9cba5fb7f43a9b52fff13e89b403e02a1dfaa5f3
www/src/Lib/site.py
python
addusersitepackages
(known_paths)
return known_paths
Add a per user site-package to sys.path Each user has its own python directory with site-packages in the home directory.
Add a per user site-package to sys.path
[ "Add", "a", "per", "user", "site", "-", "package", "to", "sys", ".", "path" ]
def addusersitepackages(known_paths): """Add a per user site-package to sys.path Each user has its own python directory with site-packages in the home directory. """ # get the per user site-package path # this call will also make sure USER_BASE and USER_SITE are set _trace("Processing user ...
[ "def", "addusersitepackages", "(", "known_paths", ")", ":", "# get the per user site-package path", "# this call will also make sure USER_BASE and USER_SITE are set", "_trace", "(", "\"Processing user site-packages\"", ")", "user_site", "=", "getusersitepackages", "(", ")", "if", ...
https://github.com/brython-dev/brython/blob/9cba5fb7f43a9b52fff13e89b403e02a1dfaa5f3/www/src/Lib/site.py#L331-L344
wummel/linkchecker
c2ce810c3fb00b895a841a7be6b2e78c64e7b042
linkcheck/configuration/__init__.py
python
get_plugin_folders
()
return folders
Get linkchecker plugin folders. Default is ~/.linkchecker/plugins/.
Get linkchecker plugin folders. Default is ~/.linkchecker/plugins/.
[ "Get", "linkchecker", "plugin", "folders", ".", "Default", "is", "~", "/", ".", "linkchecker", "/", "plugins", "/", "." ]
def get_plugin_folders(): """Get linkchecker plugin folders. Default is ~/.linkchecker/plugins/.""" folders = [] defaultfolder = normpath("~/.linkchecker/plugins") if not os.path.exists(defaultfolder) and not Portable: try: make_userdir(defaultfolder) except Exception as errm...
[ "def", "get_plugin_folders", "(", ")", ":", "folders", "=", "[", "]", "defaultfolder", "=", "normpath", "(", "\"~/.linkchecker/plugins\"", ")", "if", "not", "os", ".", "path", ".", "exists", "(", "defaultfolder", ")", "and", "not", "Portable", ":", "try", ...
https://github.com/wummel/linkchecker/blob/c2ce810c3fb00b895a841a7be6b2e78c64e7b042/linkcheck/configuration/__init__.py#L366-L379
kpreid/shinysdr
25022d36903ff67e036e82a22b6555a12a4d8e8a
shinysdr/plugins/ghpsdr.py
python
DspserverService.announce
(self, open_client)
interface used by shinysdr.main
interface used by shinysdr.main
[ "interface", "used", "by", "shinysdr", ".", "main" ]
def announce(self, open_client): """interface used by shinysdr.main""" # TODO: pass message back instead, this is all sorts of wrong Logger().info('GHPSDR-compatible server at port %s' % self.__port_obj.getHost().port)
[ "def", "announce", "(", "self", ",", "open_client", ")", ":", "# TODO: pass message back instead, this is all sorts of wrong", "Logger", "(", ")", ".", "info", "(", "'GHPSDR-compatible server at port %s'", "%", "self", ".", "__port_obj", ".", "getHost", "(", ")", ".",...
https://github.com/kpreid/shinysdr/blob/25022d36903ff67e036e82a22b6555a12a4d8e8a/shinysdr/plugins/ghpsdr.py#L191-L194
rowanz/grover
f59a206a8722357c351eae9e937b9f7a53bfda61
lm/dataloader.py
python
input_fn_builder
(input_files, seq_length, is_training, num_cpu_threads=4, evaluate_for_fixed_number_of_steps=True)
return input_fn
Creates an `input_fn` closure to be passed to TPUEstimator.
Creates an `input_fn` closure to be passed to TPUEstimator.
[ "Creates", "an", "input_fn", "closure", "to", "be", "passed", "to", "TPUEstimator", "." ]
def input_fn_builder(input_files, seq_length, is_training, num_cpu_threads=4, evaluate_for_fixed_number_of_steps=True): """Creates an `input_fn` closure to be passed to TPUEstimator.""" def input_fn(params): """The actu...
[ "def", "input_fn_builder", "(", "input_files", ",", "seq_length", ",", "is_training", ",", "num_cpu_threads", "=", "4", ",", "evaluate_for_fixed_number_of_steps", "=", "True", ")", ":", "def", "input_fn", "(", "params", ")", ":", "\"\"\"The actual input function.\"\"\...
https://github.com/rowanz/grover/blob/f59a206a8722357c351eae9e937b9f7a53bfda61/lm/dataloader.py#L34-L85
missionpinball/mpf
8e6b74cff4ba06d2fec9445742559c1068b88582
mpf/platforms/visual_pinball_engine/visual_pinball_engine.py
python
VisualPinballEngineDmd.__init__
(self, name, platform, color_mapping, width, height)
Initialise virtual DMD.
Initialise virtual DMD.
[ "Initialise", "virtual", "DMD", "." ]
def __init__(self, name, platform, color_mapping, width, height) -> None: """Initialise virtual DMD.""" self.data = None # type: Optional[bytes] self.brightness = 1.0 # type: Optional[float] self.name = name self.platform = platform self.width = width sel...
[ "def", "__init__", "(", "self", ",", "name", ",", "platform", ",", "color_mapping", ",", "width", ",", "height", ")", "->", "None", ":", "self", ".", "data", "=", "None", "# type: Optional[bytes]", "self", ".", "brightness", "=", "1.0", "# type: Optional[flo...
https://github.com/missionpinball/mpf/blob/8e6b74cff4ba06d2fec9445742559c1068b88582/mpf/platforms/visual_pinball_engine/visual_pinball_engine.py#L141-L149
googleads/google-ads-python
2a1d6062221f6aad1992a6bcca0e7e4a93d2db86
google/ads/googleads/v7/services/services/campaign_criterion_simulation_service/transports/grpc.py
python
CampaignCriterionSimulationServiceGrpcTransport.get_campaign_criterion_simulation
( self, )
return self._stubs["get_campaign_criterion_simulation"]
r"""Return a callable for the get campaign criterion simulation method over gRPC. Returns the requested campaign criterion simulation in full detail. List of thrown errors: `AuthenticationError <>`__ `AuthorizationError <>`__ `HeaderError <>`__ `Intern...
r"""Return a callable for the get campaign criterion simulation method over gRPC.
[ "r", "Return", "a", "callable", "for", "the", "get", "campaign", "criterion", "simulation", "method", "over", "gRPC", "." ]
def get_campaign_criterion_simulation( self, ) -> Callable[ [ campaign_criterion_simulation_service.GetCampaignCriterionSimulationRequest ], campaign_criterion_simulation.CampaignCriterionSimulation, ]: r"""Return a callable for the get campaign criter...
[ "def", "get_campaign_criterion_simulation", "(", "self", ",", ")", "->", "Callable", "[", "[", "campaign_criterion_simulation_service", ".", "GetCampaignCriterionSimulationRequest", "]", ",", "campaign_criterion_simulation", ".", "CampaignCriterionSimulation", ",", "]", ":", ...
https://github.com/googleads/google-ads-python/blob/2a1d6062221f6aad1992a6bcca0e7e4a93d2db86/google/ads/googleads/v7/services/services/campaign_criterion_simulation_service/transports/grpc.py#L222-L260
mdiazcl/fuzzbunch-debian
2b76c2249ade83a389ae3badb12a1bd09901fd2c
windows/Resources/Python/Core/Lib/lib-tk/Tkinter.py
python
Checkbutton.select
(self)
Put the button in on-state.
Put the button in on-state.
[ "Put", "the", "button", "in", "on", "-", "state", "." ]
def select(self): """Put the button in on-state.""" self.tk.call(self._w, 'select')
[ "def", "select", "(", "self", ")", ":", "self", ".", "tk", ".", "call", "(", "self", ".", "_w", ",", "'select'", ")" ]
https://github.com/mdiazcl/fuzzbunch-debian/blob/2b76c2249ade83a389ae3badb12a1bd09901fd2c/windows/Resources/Python/Core/Lib/lib-tk/Tkinter.py#L2634-L2636
python/cpython
e13cdca0f5224ec4e23bdd04bb3120506964bc8b
Lib/idlelib/pyshell.py
python
fix_x11_paste
(root)
Make paste replace selection on x11. See issue #5124.
Make paste replace selection on x11. See issue #5124.
[ "Make", "paste", "replace", "selection", "on", "x11", ".", "See", "issue", "#5124", "." ]
def fix_x11_paste(root): "Make paste replace selection on x11. See issue #5124." if root._windowingsystem == 'x11': for cls in 'Text', 'Entry', 'Spinbox': root.bind_class( cls, '<<Paste>>', 'catch {%W delete sel.first sel.last}\n' + ...
[ "def", "fix_x11_paste", "(", "root", ")", ":", "if", "root", ".", "_windowingsystem", "==", "'x11'", ":", "for", "cls", "in", "'Text'", ",", "'Entry'", ",", "'Spinbox'", ":", "root", ".", "bind_class", "(", "cls", ",", "'<<Paste>>'", ",", "'catch {%W delet...
https://github.com/python/cpython/blob/e13cdca0f5224ec4e23bdd04bb3120506964bc8b/Lib/idlelib/pyshell.py#L1463-L1471
evennia/evennia
fa79110ba6b219932f22297838e8ac72ebc0be0e
evennia/typeclasses/models.py
python
TypedObject.__db_set
(self, value)
Stop accidentally replacing the db object
Stop accidentally replacing the db object
[ "Stop", "accidentally", "replacing", "the", "db", "object" ]
def __db_set(self, value): """Stop accidentally replacing the db object""" string = "Cannot assign directly to db object! " string += "Use db.attr=value instead." raise Exception(string)
[ "def", "__db_set", "(", "self", ",", "value", ")", ":", "string", "=", "\"Cannot assign directly to db object! \"", "string", "+=", "\"Use db.attr=value instead.\"", "raise", "Exception", "(", "string", ")" ]
https://github.com/evennia/evennia/blob/fa79110ba6b219932f22297838e8ac72ebc0be0e/evennia/typeclasses/models.py#L752-L756
JBakamovic/cxxd
142c19649b036bd6f6bdcd4684de735ea11a6c94
service.py
python
Service.__unknown_action
(self, payload)
return self.started_up
[]
def __unknown_action(self, payload): logging.error("Unknown action triggered! Valid actions are: {0}".format(self.action)) return self.started_up
[ "def", "__unknown_action", "(", "self", ",", "payload", ")", ":", "logging", ".", "error", "(", "\"Unknown action triggered! Valid actions are: {0}\"", ".", "format", "(", "self", ".", "action", ")", ")", "return", "self", ".", "started_up" ]
https://github.com/JBakamovic/cxxd/blob/142c19649b036bd6f6bdcd4684de735ea11a6c94/service.py#L48-L50
IJDykeman/wangTiles
7c1ee2095ebdf7f72bce07d94c6484915d5cae8b
experimental_code/tiles_3d/venv_mac_py3/lib/python2.7/site-packages/pip/_vendor/pyparsing.py
python
removeQuotes
(s,l,t)
return t[0][1:-1]
Helper parse action for removing quotation marks from parsed quoted strings. Example:: # by default, quotation marks are included in parsed results quotedString.parseString("'Now is the Winter of our Discontent'") # -> ["'Now is the Winter of our Discontent'"] # use removeQuotes to strip q...
Helper parse action for removing quotation marks from parsed quoted strings.
[ "Helper", "parse", "action", "for", "removing", "quotation", "marks", "from", "parsed", "quoted", "strings", "." ]
def removeQuotes(s,l,t): """ Helper parse action for removing quotation marks from parsed quoted strings. Example:: # by default, quotation marks are included in parsed results quotedString.parseString("'Now is the Winter of our Discontent'") # -> ["'Now is the Winter of our Discontent'"] ...
[ "def", "removeQuotes", "(", "s", ",", "l", ",", "t", ")", ":", "return", "t", "[", "0", "]", "[", "1", ":", "-", "1", "]" ]
https://github.com/IJDykeman/wangTiles/blob/7c1ee2095ebdf7f72bce07d94c6484915d5cae8b/experimental_code/tiles_3d/venv_mac_py3/lib/python2.7/site-packages/pip/_vendor/pyparsing.py#L4789-L4801
cloudera/hue
23f02102d4547c17c32bd5ea0eb24e9eadd657a4
desktop/core/ext-py/boto-2.46.1/boto/opsworks/layer1.py
python
OpsWorksConnection.describe_my_user_profile
(self)
return self.make_request(action='DescribeMyUserProfile', body=json.dumps(params))
Describes a user's SSH information. **Required Permissions**: To use this action, an IAM user must have self-management enabled or an attached policy that explicitly grants permissions. For more information on user permissions, see `Managing User Permissions`_.
Describes a user's SSH information.
[ "Describes", "a", "user", "s", "SSH", "information", "." ]
def describe_my_user_profile(self): """ Describes a user's SSH information. **Required Permissions**: To use this action, an IAM user must have self-management enabled or an attached policy that explicitly grants permissions. For more information on user permissions, see...
[ "def", "describe_my_user_profile", "(", "self", ")", ":", "params", "=", "{", "}", "return", "self", ".", "make_request", "(", "action", "=", "'DescribeMyUserProfile'", ",", "body", "=", "json", ".", "dumps", "(", "params", ")", ")" ]
https://github.com/cloudera/hue/blob/23f02102d4547c17c32bd5ea0eb24e9eadd657a4/desktop/core/ext-py/boto-2.46.1/boto/opsworks/layer1.py#L1639-L1652
dimagi/commcare-hq
d67ff1d3b4c51fa050c19e60c3253a79d3452a39
corehq/messaging/scheduling/forms.py
python
validate_date
(value)
return value.date()
[]
def validate_date(value): error = ValidationError(_("Please enter a valid date in the format YYYY-MM-DD")) if not isinstance(value, (str, str)) or not re.match(r'^\d\d\d\d-\d\d-\d\d$', value): raise error try: value = parser.parse(value) except ValueError: raise error retu...
[ "def", "validate_date", "(", "value", ")", ":", "error", "=", "ValidationError", "(", "_", "(", "\"Please enter a valid date in the format YYYY-MM-DD\"", ")", ")", "if", "not", "isinstance", "(", "value", ",", "(", "str", ",", "str", ")", ")", "or", "not", "...
https://github.com/dimagi/commcare-hq/blob/d67ff1d3b4c51fa050c19e60c3253a79d3452a39/corehq/messaging/scheduling/forms.py#L84-L95
apache/libcloud
90971e17bfd7b6bb97b2489986472c531cc8e140
libcloud/common/openstack_identity.py
python
OpenStackIdentity_3_0_Connection.create_user
( self, email, password, name, description=None, domain_id=None, default_project_id=None, enabled=True, )
return user
Create a new user account. :param email: User's mail address. :type email: ``str`` :param password: User's password. :type password: ``str`` :param name: User's name. :type name: ``str`` :param description: Optional description. :type description: ``st...
Create a new user account.
[ "Create", "a", "new", "user", "account", "." ]
def create_user( self, email, password, name, description=None, domain_id=None, default_project_id=None, enabled=True, ): """ Create a new user account. :param email: User's mail address. :type email: ``str`` :...
[ "def", "create_user", "(", "self", ",", "email", ",", "password", ",", "name", ",", "description", "=", "None", ",", "domain_id", "=", "None", ",", "default_project_id", "=", "None", ",", "enabled", "=", "True", ",", ")", ":", "data", "=", "{", "\"emai...
https://github.com/apache/libcloud/blob/90971e17bfd7b6bb97b2489986472c531cc8e140/libcloud/common/openstack_identity.py#L1447-L1499
omz/PythonistaAppTemplate
f560f93f8876d82a21d108977f90583df08d55af
PythonistaAppTemplate/PythonistaKit.framework/pylib_ext/matplotlib/axis.py
python
Axis.get_minorticklines
(self)
return cbook.silent_list('Line2D ticklines', lines)
Return the minor tick lines as a list of Line2D instances
Return the minor tick lines as a list of Line2D instances
[ "Return", "the", "minor", "tick", "lines", "as", "a", "list", "of", "Line2D", "instances" ]
def get_minorticklines(self): 'Return the minor tick lines as a list of Line2D instances' lines = [] ticks = self.get_minor_ticks() for tick in ticks: lines.append(tick.tick1line) lines.append(tick.tick2line) return cbook.silent_list('Line2D ticklines', li...
[ "def", "get_minorticklines", "(", "self", ")", ":", "lines", "=", "[", "]", "ticks", "=", "self", ".", "get_minor_ticks", "(", ")", "for", "tick", "in", "ticks", ":", "lines", ".", "append", "(", "tick", ".", "tick1line", ")", "lines", ".", "append", ...
https://github.com/omz/PythonistaAppTemplate/blob/f560f93f8876d82a21d108977f90583df08d55af/PythonistaAppTemplate/PythonistaKit.framework/pylib_ext/matplotlib/axis.py#L1173-L1180
angr/claripy
4c961b4dc664706be8142fe4868f27655bc8da77
claripy/vsa/strided_interval.py
python
StridedInterval._get_msb
(v, bits)
return 1
Get the MSB (most significant bit). :param v: The integer :param bits: Bits of the integer :return: the MSB
Get the MSB (most significant bit).
[ "Get", "the", "MSB", "(", "most", "significant", "bit", ")", "." ]
def _get_msb(v, bits): """ Get the MSB (most significant bit). :param v: The integer :param bits: Bits of the integer :return: the MSB """ if StridedInterval._is_msb_zero(v, bits): return 0 return 1
[ "def", "_get_msb", "(", "v", ",", "bits", ")", ":", "if", "StridedInterval", ".", "_is_msb_zero", "(", "v", ",", "bits", ")", ":", "return", "0", "return", "1" ]
https://github.com/angr/claripy/blob/4c961b4dc664706be8142fe4868f27655bc8da77/claripy/vsa/strided_interval.py#L1529-L1539
mmatl/pyrender
4a289a6205c5baa623cd0e7da1be3d898bcbc4da
pyrender/utils.py
python
format_color_vector
(value, length)
return value.squeeze().astype(np.float32)
Format a color vector.
Format a color vector.
[ "Format", "a", "color", "vector", "." ]
def format_color_vector(value, length): """Format a color vector. """ if isinstance(value, int): value = value / 255.0 if isinstance(value, float): value = np.repeat(value, length) if isinstance(value, list) or isinstance(value, tuple): value = np.array(value) if isinstan...
[ "def", "format_color_vector", "(", "value", ",", "length", ")", ":", "if", "isinstance", "(", "value", ",", "int", ")", ":", "value", "=", "value", "/", "255.0", "if", "isinstance", "(", "value", ",", "float", ")", ":", "value", "=", "np", ".", "repe...
https://github.com/mmatl/pyrender/blob/4a289a6205c5baa623cd0e7da1be3d898bcbc4da/pyrender/utils.py#L5-L27
securesystemslab/zippy
ff0e84ac99442c2c55fe1d285332cfd4e185e089
zippy/benchmarks/src/benchmarks/sympy/sympy/matrices/matrices.py
python
MatrixBase.QRsolve
(self, b)
return self._new([row._mat for row in reversed(x)])
Solve the linear system 'Ax = b'. 'self' is the matrix 'A', the method argument is the vector 'b'. The method returns the solution vector 'x'. If 'b' is a matrix, the system is solved for each column of 'b' and the return value is a matrix of the same shape as 'b'. This metho...
Solve the linear system 'Ax = b'.
[ "Solve", "the", "linear", "system", "Ax", "=", "b", "." ]
def QRsolve(self, b): """Solve the linear system 'Ax = b'. 'self' is the matrix 'A', the method argument is the vector 'b'. The method returns the solution vector 'x'. If 'b' is a matrix, the system is solved for each column of 'b' and the return value is a matrix of the same ...
[ "def", "QRsolve", "(", "self", ",", "b", ")", ":", "Q", ",", "R", "=", "self", ".", "as_mutable", "(", ")", ".", "QRdecomposition", "(", ")", "y", "=", "Q", ".", "T", "*", "b", "# back substitution to solve R*x = y:", "# We build up the result \"backwards\" ...
https://github.com/securesystemslab/zippy/blob/ff0e84ac99442c2c55fe1d285332cfd4e185e089/zippy/benchmarks/src/benchmarks/sympy/sympy/matrices/matrices.py#L1598-L1640
moinwiki/moin
568f223231aadecbd3b21a701ec02271f8d8021d
src/moin/datastructures/backends/__init__.py
python
BaseDictsBackend.__contains__
(self, dict_name)
Check if a dict called <dict_name> is available in this backend.
Check if a dict called <dict_name> is available in this backend.
[ "Check", "if", "a", "dict", "called", "<dict_name", ">", "is", "available", "in", "this", "backend", "." ]
def __contains__(self, dict_name): """ Check if a dict called <dict_name> is available in this backend. """ raise NotImplementedError()
[ "def", "__contains__", "(", "self", ",", "dict_name", ")", ":", "raise", "NotImplementedError", "(", ")" ]
https://github.com/moinwiki/moin/blob/568f223231aadecbd3b21a701ec02271f8d8021d/src/moin/datastructures/backends/__init__.py#L289-L293
errbotio/errbot
66e1de8e1d7daa62be7f9ed1b2ac8832f09fa25d
errbot/botplugin.py
python
BotPlugin.callback_message
(self, message: Message)
Triggered on every message not coming from the bot itself. Override this method to get notified on *ANY* message. :param message: representing the message that was received.
Triggered on every message not coming from the bot itself.
[ "Triggered", "on", "every", "message", "not", "coming", "from", "the", "bot", "itself", "." ]
def callback_message(self, message: Message) -> None: """ Triggered on every message not coming from the bot itself. Override this method to get notified on *ANY* message. :param message: representing the message that was received. """ pass
[ "def", "callback_message", "(", "self", ",", "message", ":", "Message", ")", "->", "None", ":", "pass" ]
https://github.com/errbotio/errbot/blob/66e1de8e1d7daa62be7f9ed1b2ac8832f09fa25d/errbot/botplugin.py#L473-L482
iotaledger/iota.py
f596c1ac0d9bcbceda1cf6109cd921943a6599b3
iota/api_async.py
python
AsyncStrictIota.were_addresses_spent_from
( self, addresses: Iterable[Address] )
return await core.WereAddressesSpentFromCommand(self.adapter)( addresses=addresses, )
Check if a list of addresses was ever spent from, in the current epoch, or in previous epochs. If an address has a pending transaction, it's also considered 'spent'. :param Iterable[Address] addresses: List of addresses to check. :return: ``dict`` with the foll...
Check if a list of addresses was ever spent from, in the current epoch, or in previous epochs.
[ "Check", "if", "a", "list", "of", "addresses", "was", "ever", "spent", "from", "in", "the", "current", "epoch", "or", "in", "previous", "epochs", "." ]
async def were_addresses_spent_from( self, addresses: Iterable[Address] ) -> dict: """ Check if a list of addresses was ever spent from, in the current epoch, or in previous epochs. If an address has a pending transaction, it's also considered 'spent'. ...
[ "async", "def", "were_addresses_spent_from", "(", "self", ",", "addresses", ":", "Iterable", "[", "Address", "]", ")", "->", "dict", ":", "return", "await", "core", ".", "WereAddressesSpentFromCommand", "(", "self", ".", "adapter", ")", "(", "addresses", "=", ...
https://github.com/iotaledger/iota.py/blob/f596c1ac0d9bcbceda1cf6109cd921943a6599b3/iota/api_async.py#L672-L703
edfungus/Crouton
ada98b3930192938a48909072b45cb84b945f875
clients/esp8266_clients/venv/lib/python2.7/site-packages/pip/_vendor/distlib/manifest.py
python
Manifest._parse_directive
(self, directive)
return action, patterns, thedir, dir_pattern
Validate a directive. :param directive: The directive to validate. :return: A tuple of action, patterns, thedir, dir_patterns
Validate a directive. :param directive: The directive to validate. :return: A tuple of action, patterns, thedir, dir_patterns
[ "Validate", "a", "directive", ".", ":", "param", "directive", ":", "The", "directive", "to", "validate", ".", ":", "return", ":", "A", "tuple", "of", "action", "patterns", "thedir", "dir_patterns" ]
def _parse_directive(self, directive): """ Validate a directive. :param directive: The directive to validate. :return: A tuple of action, patterns, thedir, dir_patterns """ words = directive.split() if len(words) == 1 and words[0] not in ('include', 'exclude', ...
[ "def", "_parse_directive", "(", "self", ",", "directive", ")", ":", "words", "=", "directive", ".", "split", "(", ")", "if", "len", "(", "words", ")", "==", "1", "and", "words", "[", "0", "]", "not", "in", "(", "'include'", ",", "'exclude'", ",", "...
https://github.com/edfungus/Crouton/blob/ada98b3930192938a48909072b45cb84b945f875/clients/esp8266_clients/venv/lib/python2.7/site-packages/pip/_vendor/distlib/manifest.py#L202-L247
tpircher/pycrc
240d4509e8592c7ee60aaed8a068351cf71c25fc
pycrc/codegen.py
python
File._c_file
(self)
return out
Add C file content.
Add C file content.
[ "Add", "C", "file", "content", "." ]
def _c_file(self): """ Add C file content. """ out = [ CodeGen(self.opt, '', _includes(self.opt)), '#include "{header_filename}" /* include the header file generated with pycrc */'.format(**self.sym), '#include <stdlib.h>', ...
[ "def", "_c_file", "(", "self", ")", ":", "out", "=", "[", "CodeGen", "(", "self", ".", "opt", ",", "''", ",", "_includes", "(", "self", ".", "opt", ")", ")", ",", "'#include \"{header_filename}\" /* include the header file generated with pycrc */'", ".", "fo...
https://github.com/tpircher/pycrc/blob/240d4509e8592c7ee60aaed8a068351cf71c25fc/pycrc/codegen.py#L395-L427
determined-ai/determined
f637264493acc14f12e66550cb51c520b5d27f6c
model_hub/model_hub/huggingface/_trial.py
python
build_using_auto
( config_kwargs: Union[Dict, attrdict.AttrDict], tokenizer_kwargs: Union[Dict, attrdict.AttrDict], model_mode: str, model_kwargs: Union[Dict, attrdict.AttrDict], use_pretrained_weights: bool = True, )
return config, tokenizer, model
Build the config, tokenizer, and model using tranformer's Auto classes. Args: config_kwargs: arguments for transformers configuration classes tokenizer_kwargs: arguments for transformers tokenizer classes model_mode: one of (pretraining, causal-lm, masked-lm, seq2seq-lm, sequence-classi...
Build the config, tokenizer, and model using tranformer's Auto classes.
[ "Build", "the", "config", "tokenizer", "and", "model", "using", "tranformer", "s", "Auto", "classes", "." ]
def build_using_auto( config_kwargs: Union[Dict, attrdict.AttrDict], tokenizer_kwargs: Union[Dict, attrdict.AttrDict], model_mode: str, model_kwargs: Union[Dict, attrdict.AttrDict], use_pretrained_weights: bool = True, ) -> Tuple[ transformers.PretrainedConfig, # This is how it's named in trans...
[ "def", "build_using_auto", "(", "config_kwargs", ":", "Union", "[", "Dict", ",", "attrdict", ".", "AttrDict", "]", ",", "tokenizer_kwargs", ":", "Union", "[", "Dict", ",", "attrdict", ".", "AttrDict", "]", ",", "model_mode", ":", "str", ",", "model_kwargs", ...
https://github.com/determined-ai/determined/blob/f637264493acc14f12e66550cb51c520b5d27f6c/model_hub/model_hub/huggingface/_trial.py#L29-L64
OpenIDC/pyoidc
bd510e49ebd6d8816e3ee94e62a3e86e907a0f8d
src/oic/oic/message.py
python
RegistrationResponse.verify
(self, **kwargs)
return True
Verify that the response is valid. Implementations MUST either return both a Client Configuration Endpoint and a Registration Access Token or neither of them. :param kwargs: :return: True if the message is OK otherwise False
Verify that the response is valid.
[ "Verify", "that", "the", "response", "is", "valid", "." ]
def verify(self, **kwargs): """ Verify that the response is valid. Implementations MUST either return both a Client Configuration Endpoint and a Registration Access Token or neither of them. :param kwargs: :return: True if the message is OK otherwise False """ ...
[ "def", "verify", "(", "self", ",", "*", "*", "kwargs", ")", ":", "super", "(", "RegistrationResponse", ",", "self", ")", ".", "verify", "(", "*", "*", "kwargs", ")", "has_reg_uri", "=", "\"registration_client_uri\"", "in", "self", "has_reg_at", "=", "\"reg...
https://github.com/OpenIDC/pyoidc/blob/bd510e49ebd6d8816e3ee94e62a3e86e907a0f8d/src/oic/oic/message.py#L671-L693
Chaffelson/nipyapi
d3b186fd701ce308c2812746d98af9120955e810
nipyapi/nifi/models/process_group_entity.py
python
ProcessGroupEntity.up_to_date_count
(self)
return self._up_to_date_count
Gets the up_to_date_count of this ProcessGroupEntity. The number of up to date versioned process groups in the process group. :return: The up_to_date_count of this ProcessGroupEntity. :rtype: int
Gets the up_to_date_count of this ProcessGroupEntity. The number of up to date versioned process groups in the process group.
[ "Gets", "the", "up_to_date_count", "of", "this", "ProcessGroupEntity", ".", "The", "number", "of", "up", "to", "date", "versioned", "process", "groups", "in", "the", "process", "group", "." ]
def up_to_date_count(self): """ Gets the up_to_date_count of this ProcessGroupEntity. The number of up to date versioned process groups in the process group. :return: The up_to_date_count of this ProcessGroupEntity. :rtype: int """ return self._up_to_date_count
[ "def", "up_to_date_count", "(", "self", ")", ":", "return", "self", ".", "_up_to_date_count" ]
https://github.com/Chaffelson/nipyapi/blob/d3b186fd701ce308c2812746d98af9120955e810/nipyapi/nifi/models/process_group_entity.py#L587-L595
robinhood/thorn
486a53ebcf6373ff306a8d17dc016d78e880fcd6
setup.py
python
strip_comments
(l)
return l.split('#', 1)[0].strip()
[]
def strip_comments(l): return l.split('#', 1)[0].strip()
[ "def", "strip_comments", "(", "l", ")", ":", "return", "l", ".", "split", "(", "'#'", ",", "1", ")", "[", "0", "]", ".", "strip", "(", ")" ]
https://github.com/robinhood/thorn/blob/486a53ebcf6373ff306a8d17dc016d78e880fcd6/setup.py#L73-L74
bokeh/bokeh
a00e59da76beb7b9f83613533cfd3aced1df5f06
bokeh/util/serialization.py
python
transform_array_to_list
(array: npt.NDArray[Any])
return array.tolist()
Transforms a NumPy array into a list of values Args: array (np.nadarray) : the NumPy array series to transform Returns: list or dict
Transforms a NumPy array into a list of values
[ "Transforms", "a", "NumPy", "array", "into", "a", "list", "of", "values" ]
def transform_array_to_list(array: npt.NDArray[Any]) -> Sequence[Any]: ''' Transforms a NumPy array into a list of values Args: array (np.nadarray) : the NumPy array series to transform Returns: list or dict ''' pd = import_optional('pandas') if (array.dtype.kind in ('u', 'i'...
[ "def", "transform_array_to_list", "(", "array", ":", "npt", ".", "NDArray", "[", "Any", "]", ")", "->", "Sequence", "[", "Any", "]", ":", "pd", "=", "import_optional", "(", "'pandas'", ")", "if", "(", "array", ".", "dtype", ".", "kind", "in", "(", "'...
https://github.com/bokeh/bokeh/blob/a00e59da76beb7b9f83613533cfd3aced1df5f06/bokeh/util/serialization.py#L386-L408
ThomasTJdev/WMD
32e249a1170a4ca52e7196d6f7fd9392ae1d124f
core/modules.py
python
loadModuleName
(call)
Get module name.
Get module name.
[ "Get", "module", "name", "." ]
def loadModuleName(call): """Get module name.""" root = loadXML() for child in root.findall('module'): if call == (child.find('call').text): return child.get('name')
[ "def", "loadModuleName", "(", "call", ")", ":", "root", "=", "loadXML", "(", ")", "for", "child", "in", "root", ".", "findall", "(", "'module'", ")", ":", "if", "call", "==", "(", "child", ".", "find", "(", "'call'", ")", ".", "text", ")", ":", "...
https://github.com/ThomasTJdev/WMD/blob/32e249a1170a4ca52e7196d6f7fd9392ae1d124f/core/modules.py#L224-L229
biopython/biopython
2dd97e71762af7b046d7f7f8a4f1e38db6b06c86
Bio/SeqUtils/MeltingTemp.py
python
_check
(seq, method)
return seq
Return a sequence which fulfills the requirements of the given method (PRIVATE). All Tm methods in this package require the sequence in uppercase format. Most methods make use of the length of the sequence (directly or indirectly), which can only be expressed as len(seq) if the sequence does not contai...
Return a sequence which fulfills the requirements of the given method (PRIVATE).
[ "Return", "a", "sequence", "which", "fulfills", "the", "requirements", "of", "the", "given", "method", "(", "PRIVATE", ")", "." ]
def _check(seq, method): """Return a sequence which fulfills the requirements of the given method (PRIVATE). All Tm methods in this package require the sequence in uppercase format. Most methods make use of the length of the sequence (directly or indirectly), which can only be expressed as len(seq) if ...
[ "def", "_check", "(", "seq", ",", "method", ")", ":", "seq", "=", "\"\"", ".", "join", "(", "seq", ".", "split", "(", ")", ")", ".", "upper", "(", ")", "seq", "=", "str", "(", "Seq", ".", "Seq", "(", "seq", ")", ".", "back_transcribe", "(", "...
https://github.com/biopython/biopython/blob/2dd97e71762af7b046d7f7f8a4f1e38db6b06c86/Bio/SeqUtils/MeltingTemp.py#L439-L484
saleor/saleor
2221bdf61b037c660ffc2d1efa484d8efe8172f5
saleor/checkout/utils.py
python
_get_shipping_voucher_discount_for_checkout
( manager: PluginsManager, voucher: Voucher, checkout_info: "CheckoutInfo", lines: Iterable["CheckoutLineInfo"], address: Optional["Address"], discounts: Optional[Iterable[DiscountInfo]] = None, )
return voucher.get_discount_amount_for(shipping_price, checkout_info.channel)
Calculate discount value for a voucher of shipping type.
Calculate discount value for a voucher of shipping type.
[ "Calculate", "discount", "value", "for", "a", "voucher", "of", "shipping", "type", "." ]
def _get_shipping_voucher_discount_for_checkout( manager: PluginsManager, voucher: Voucher, checkout_info: "CheckoutInfo", lines: Iterable["CheckoutLineInfo"], address: Optional["Address"], discounts: Optional[Iterable[DiscountInfo]] = None, ): """Calculate discount value for a voucher of sh...
[ "def", "_get_shipping_voucher_discount_for_checkout", "(", "manager", ":", "PluginsManager", ",", "voucher", ":", "Voucher", ",", "checkout_info", ":", "\"CheckoutInfo\"", ",", "lines", ":", "Iterable", "[", "\"CheckoutLineInfo\"", "]", ",", "address", ":", "Optional"...
https://github.com/saleor/saleor/blob/2221bdf61b037c660ffc2d1efa484d8efe8172f5/saleor/checkout/utils.py#L278-L308
google/grr
8ad8a4d2c5a93c92729206b7771af19d92d4f915
grr/server/grr_response_server/databases/mysql_flows.py
python
MySQLDBFlowMixin._WriteFlowResultsOrErrors
(self, table_name, results, cursor=None)
Writes flow results/errors for a given flow.
Writes flow results/errors for a given flow.
[ "Writes", "flow", "results", "/", "errors", "for", "a", "given", "flow", "." ]
def _WriteFlowResultsOrErrors(self, table_name, results, cursor=None): """Writes flow results/errors for a given flow.""" query = (f"INSERT INTO {table_name} " "(client_id, flow_id, hunt_id, timestamp, payload, type, tag) " "VALUES ") templates = [] args = [] for r in res...
[ "def", "_WriteFlowResultsOrErrors", "(", "self", ",", "table_name", ",", "results", ",", "cursor", "=", "None", ")", ":", "query", "=", "(", "f\"INSERT INTO {table_name} \"", "\"(client_id, flow_id, hunt_id, timestamp, payload, type, tag) \"", "\"VALUES \"", ")", "templates...
https://github.com/google/grr/blob/8ad8a4d2c5a93c92729206b7771af19d92d4f915/grr/server/grr_response_server/databases/mysql_flows.py#L1360-L1389