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
graphcore/examples
46d2b7687b829778369fc6328170a7b14761e5c6
applications/tensorflow/detection/yolov3/core/utils.py
python
postprocess_boxes
(pred_bbox, org_img_shape, input_size, score_threshold)
return np.concatenate([coors, scores[:, np.newaxis], classes[:, np.newaxis]], axis=-1)
Turn predicted boxes to image relative coordinate and remove invalid parts Args: pred_bbox: tensor of predicted boxes org_image_shape: original image shape (h,w) input_size: network input size, one integer, network input is a square image score_threshold: box score threshold, boxes b...
Turn predicted boxes to image relative coordinate and remove invalid parts Args: pred_bbox: tensor of predicted boxes org_image_shape: original image shape (h,w) input_size: network input size, one integer, network input is a square image score_threshold: box score threshold, boxes b...
[ "Turn", "predicted", "boxes", "to", "image", "relative", "coordinate", "and", "remove", "invalid", "parts", "Args", ":", "pred_bbox", ":", "tensor", "of", "predicted", "boxes", "org_image_shape", ":", "original", "image", "shape", "(", "h", "w", ")", "input_si...
def postprocess_boxes(pred_bbox, org_img_shape, input_size, score_threshold): """Turn predicted boxes to image relative coordinate and remove invalid parts Args: pred_bbox: tensor of predicted boxes org_image_shape: original image shape (h,w) input_size: network input size, one integer, ...
[ "def", "postprocess_boxes", "(", "pred_bbox", ",", "org_img_shape", ",", "input_size", ",", "score_threshold", ")", ":", "valid_scale", "=", "[", "0", ",", "np", ".", "inf", "]", "pred_bbox", "=", "np", ".", "array", "(", "pred_bbox", ")", "pred_xywh", "="...
https://github.com/graphcore/examples/blob/46d2b7687b829778369fc6328170a7b14761e5c6/applications/tensorflow/detection/yolov3/core/utils.py#L164-L213
XX-net/XX-Net
a9898cfcf0084195fb7e69b6bc834e59aecdf14f
code/default/lib/noarch/hyper/packages/rfc3986/uri.py
python
URIReference.scheme_is_valid
(self, require=False)
return self._is_valid(self.scheme, SCHEME_MATCHER, require)
Determines if the scheme component is valid. :param str require: Set to ``True`` to require the presence of this component. :returns: ``True`` if the scheme is valid. ``False`` otherwise. :rtype: bool
Determines if the scheme component is valid.
[ "Determines", "if", "the", "scheme", "component", "is", "valid", "." ]
def scheme_is_valid(self, require=False): """Determines if the scheme component is valid. :param str require: Set to ``True`` to require the presence of this component. :returns: ``True`` if the scheme is valid. ``False`` otherwise. :rtype: bool """ return se...
[ "def", "scheme_is_valid", "(", "self", ",", "require", "=", "False", ")", ":", "return", "self", ".", "_is_valid", "(", "self", ".", "scheme", ",", "SCHEME_MATCHER", ",", "require", ")" ]
https://github.com/XX-net/XX-Net/blob/a9898cfcf0084195fb7e69b6bc834e59aecdf14f/code/default/lib/noarch/hyper/packages/rfc3986/uri.py#L212-L220
nadineproject/nadine
c41c8ef7ffe18f1853029c97eecc329039b4af6c
doors/core.py
python
TestDoorController.test_connection
(self)
return True
[]
def test_connection(self): return True
[ "def", "test_connection", "(", "self", ")", ":", "return", "True" ]
https://github.com/nadineproject/nadine/blob/c41c8ef7ffe18f1853029c97eecc329039b4af6c/doors/core.py#L331-L332
21dotco/two1-python
4e833300fd5a58363e3104ed4c097631e5d296d3
two1/bitcoin/coinbase.py
python
CoinbaseTransactionBuilder.build
(self, enonce1, enonce2, bitshare=True)
return tx_type(Transaction.DEFAULT_TRANSACTION_VERSION, [cb_input], self.outputs, self.lock_time)
Builds a coinbase txn and returns it. If bitshare == True, padding is added to the coinbase input script to align the length of the txn without the last output & locktime to a 512-bit boundary. Args: enonce1 (bytes): byte stream to place in the coinbase input scr...
Builds a coinbase txn and returns it. If bitshare == True, padding is added to the coinbase input script to align the length of the txn without the last output & locktime to a 512-bit boundary.
[ "Builds", "a", "coinbase", "txn", "and", "returns", "it", ".", "If", "bitshare", "==", "True", "padding", "is", "added", "to", "the", "coinbase", "input", "script", "to", "align", "the", "length", "of", "the", "txn", "without", "the", "last", "output", "...
def build(self, enonce1, enonce2, bitshare=True): """ Builds a coinbase txn and returns it. If bitshare == True, padding is added to the coinbase input script to align the length of the txn without the last output & locktime to a 512-bit boundary. Args: e...
[ "def", "build", "(", "self", ",", "enonce1", ",", "enonce2", ",", "bitshare", "=", "True", ")", ":", "if", "len", "(", "enonce1", ")", "!=", "self", ".", "enonce1_len", ":", "raise", "ValueError", "(", "\"len(enonce1) does not match enonce1_len\"", ")", "if"...
https://github.com/21dotco/two1-python/blob/4e833300fd5a58363e3104ed4c097631e5d296d3/two1/bitcoin/coinbase.py#L151-L178
open-cogsci/OpenSesame
c4a3641b097a80a76937edbd8c365f036bcc9705
opensesame_extensions/help/help.py
python
help.populate_help_menu
(self)
desc: Is collected when the sitemap is done loading, and populates the menu.
desc: Is collected when the sitemap is done loading, and populates the menu.
[ "desc", ":", "Is", "collected", "when", "the", "sitemap", "is", "done", "loading", "and", "populates", "the", "menu", "." ]
def populate_help_menu(self): """ desc: Is collected when the sitemap is done loading, and populates the menu. """ if self._get_sitemap_thread.sitemap is None: return try: _dict = safe_yaml_load(self._get_sitemap_thread.sitemap) except yaml.scanner.ScannerError: # If the sitemap was loaded ...
[ "def", "populate_help_menu", "(", "self", ")", ":", "if", "self", ".", "_get_sitemap_thread", ".", "sitemap", "is", "None", ":", "return", "try", ":", "_dict", "=", "safe_yaml_load", "(", "self", ".", "_get_sitemap_thread", ".", "sitemap", ")", "except", "ya...
https://github.com/open-cogsci/OpenSesame/blob/c4a3641b097a80a76937edbd8c365f036bcc9705/opensesame_extensions/help/help.py#L139-L172
adonno/Home-AssistantConfig
8038c0143c6a990e409951202bb1bda149fcbaf7
custom_components/hacs/hacsbase/__init__.py
python
Hacs.register_repository
(self, full_name, category, check=True)
Register a repository.
Register a repository.
[ "Register", "a", "repository", "." ]
async def register_repository(self, full_name, category, check=True): """Register a repository.""" from ..repositories.repository import RERPOSITORY_CLASSES if full_name in self.common.skip: self.logger.debug(f"Skipping {full_name}") return if category not in RE...
[ "async", "def", "register_repository", "(", "self", ",", "full_name", ",", "category", ",", "check", "=", "True", ")", ":", "from", ".", ".", "repositories", ".", "repository", "import", "RERPOSITORY_CLASSES", "if", "full_name", "in", "self", ".", "common", ...
https://github.com/adonno/Home-AssistantConfig/blob/8038c0143c6a990e409951202bb1bda149fcbaf7/custom_components/hacs/hacsbase/__init__.py#L116-L147
PhoenixDL/rising
6de193375dcaac35605163c35cec259c9a2116d1
rising/utils/affine.py
python
matrix_to_homogeneous
(batch: torch.Tensor)
return torch.cat([batch, missing], dim=-2)
Transforms a given transformation matrix to a homogeneous transformation matrix. Args: batch: the batch of matrices to convert [N, dim, dim] Returns: torch.Tensor: the converted batch of matrices
Transforms a given transformation matrix to a homogeneous transformation matrix.
[ "Transforms", "a", "given", "transformation", "matrix", "to", "a", "homogeneous", "transformation", "matrix", "." ]
def matrix_to_homogeneous(batch: torch.Tensor) -> torch.Tensor: """ Transforms a given transformation matrix to a homogeneous transformation matrix. Args: batch: the batch of matrices to convert [N, dim, dim] Returns: torch.Tensor: the converted batch of matrices """ if ba...
[ "def", "matrix_to_homogeneous", "(", "batch", ":", "torch", ".", "Tensor", ")", "->", "torch", ".", "Tensor", ":", "if", "batch", ".", "size", "(", "-", "1", ")", "==", "batch", ".", "size", "(", "-", "2", ")", ":", "missing", "=", "batch", ".", ...
https://github.com/PhoenixDL/rising/blob/6de193375dcaac35605163c35cec259c9a2116d1/rising/utils/affine.py#L23-L45
gramps-project/gramps
04d4651a43eb210192f40a9f8c2bad8ee8fa3753
gramps/plugins/db/dbapi/dbapi.py
python
DBAPI._txn_commit
(self)
Lowlevel interface to the backend transaction. Executes a db END;
Lowlevel interface to the backend transaction. Executes a db END;
[ "Lowlevel", "interface", "to", "the", "backend", "transaction", ".", "Executes", "a", "db", "END", ";" ]
def _txn_commit(self): """ Lowlevel interface to the backend transaction. Executes a db END; """ if self.transaction == None: _LOG.debug(" DBAPI %s transaction commit", hex(id(self))) self.dbapi.commit()
[ "def", "_txn_commit", "(", "self", ")", ":", "if", "self", ".", "transaction", "==", "None", ":", "_LOG", ".", "debug", "(", "\" DBAPI %s transaction commit\"", ",", "hex", "(", "id", "(", "self", ")", ")", ")", "self", ".", "dbapi", ".", "commit", ...
https://github.com/gramps-project/gramps/blob/04d4651a43eb210192f40a9f8c2bad8ee8fa3753/gramps/plugins/db/dbapi/dbapi.py#L211-L218
sagemath/sage
f9b2db94f675ff16963ccdefba4f1a3393b3fe0d
src/sage/geometry/hyperplane_arrangement/hyperplane.py
python
Hyperplane.dimension
(self)
return self.linear_part().dimension()
r""" The dimension of the hyperplane. OUTPUT: An integer. EXAMPLES:: sage: H.<x,y,z> = HyperplaneArrangements(QQ) sage: h = x + y + z - 1 sage: h.dimension() 2
r""" The dimension of the hyperplane.
[ "r", "The", "dimension", "of", "the", "hyperplane", "." ]
def dimension(self): r""" The dimension of the hyperplane. OUTPUT: An integer. EXAMPLES:: sage: H.<x,y,z> = HyperplaneArrangements(QQ) sage: h = x + y + z - 1 sage: h.dimension() 2 """ return self.linear_part().d...
[ "def", "dimension", "(", "self", ")", ":", "return", "self", ".", "linear_part", "(", ")", ".", "dimension", "(", ")" ]
https://github.com/sagemath/sage/blob/f9b2db94f675ff16963ccdefba4f1a3393b3fe0d/src/sage/geometry/hyperplane_arrangement/hyperplane.py#L422-L437
edfungus/Crouton
ada98b3930192938a48909072b45cb84b945f875
clients/esp8266_clients/venv/lib/python2.7/site-packages/setuptools/dist.py
python
Distribution.handle_display_options
(self, option_order)
If there were any non-global "display-only" options (--help-commands or the metadata display options) on the command line, display the requested info and return true; else return false.
If there were any non-global "display-only" options (--help-commands or the metadata display options) on the command line, display the requested info and return true; else return false.
[ "If", "there", "were", "any", "non", "-", "global", "display", "-", "only", "options", "(", "--", "help", "-", "commands", "or", "the", "metadata", "display", "options", ")", "on", "the", "command", "line", "display", "the", "requested", "info", "and", "...
def handle_display_options(self, option_order): """If there were any non-global "display-only" options (--help-commands or the metadata display options) on the command line, display the requested info and return true; else return false. """ import sys if PY2 or s...
[ "def", "handle_display_options", "(", "self", ",", "option_order", ")", ":", "import", "sys", "if", "PY2", "or", "self", ".", "help_commands", ":", "return", "_Distribution", ".", "handle_display_options", "(", "self", ",", "option_order", ")", "# Stdout may be St...
https://github.com/edfungus/Crouton/blob/ada98b3930192938a48909072b45cb84b945f875/clients/esp8266_clients/venv/lib/python2.7/site-packages/setuptools/dist.py#L670-L703
apache/libcloud
90971e17bfd7b6bb97b2489986472c531cc8e140
libcloud/compute/drivers/kamatera.py
python
KamateraNodeDriver.ex_get_node
( self, id=None, name=None, state=NodeState.UNKNOWN, public_ips=None, private_ips=None, size=None, image=None, created_at=None, location=None, dailybackup=None, managed=None, billingcycle=None, generated_pass...
return Node( id=id, name=name, state=state, public_ips=public_ips, private_ips=private_ips, driver=self, size=size, image=image, created_at=created_at, extra=extra, )
Get a Kamatera node object. :param id: Node ID (optional) :type id: ``str`` :param name: Node name (optional) :type name: ``str`` :param state: Node state (optional) :type state: :class:`libcloud.compute.types.NodeState` :param public_ips: Node p...
Get a Kamatera node object.
[ "Get", "a", "Kamatera", "node", "object", "." ]
def ex_get_node( self, id=None, name=None, state=NodeState.UNKNOWN, public_ips=None, private_ips=None, size=None, image=None, created_at=None, location=None, dailybackup=None, managed=None, billingcycle=None, ...
[ "def", "ex_get_node", "(", "self", ",", "id", "=", "None", ",", "name", "=", "None", ",", "state", "=", "NodeState", ".", "UNKNOWN", ",", "public_ips", "=", "None", ",", "private_ips", "=", "None", ",", "size", "=", "None", ",", "image", "=", "None",...
https://github.com/apache/libcloud/blob/90971e17bfd7b6bb97b2489986472c531cc8e140/libcloud/compute/drivers/kamatera.py#L576-L671
voxelmorph/voxelmorph
92641b4808aefd3762bb2680d2b2aa8a491298ac
voxelmorph/py/utils.py
python
vol_to_sdt
(X_label, sdt=True, sdt_vol_resize=1)
return X_dt
Computes the signed distance transform from a volume.
Computes the signed distance transform from a volume.
[ "Computes", "the", "signed", "distance", "transform", "from", "a", "volume", "." ]
def vol_to_sdt(X_label, sdt=True, sdt_vol_resize=1): """ Computes the signed distance transform from a volume. """ X_dt = signed_dist_trf(X_label) if not (sdt_vol_resize == 1): if not isinstance(sdt_vol_resize, (list, tuple)): sdt_vol_resize = [sdt_vol_resize] * X_dt.ndim ...
[ "def", "vol_to_sdt", "(", "X_label", ",", "sdt", "=", "True", ",", "sdt_vol_resize", "=", "1", ")", ":", "X_dt", "=", "signed_dist_trf", "(", "X_label", ")", "if", "not", "(", "sdt_vol_resize", "==", "1", ")", ":", "if", "not", "isinstance", "(", "sdt_...
https://github.com/voxelmorph/voxelmorph/blob/92641b4808aefd3762bb2680d2b2aa8a491298ac/voxelmorph/py/utils.py#L385-L401
SanPen/GridCal
d3f4566d2d72c11c7e910c9d162538ef0e60df31
src/GridCal/Gui/GridEditorWidget/transformer2w_graphics.py
python
TransformerGraphicItem.setEndPos
(self, endpos)
Set the starting position @param endpos: @return:
Set the starting position
[ "Set", "the", "starting", "position" ]
def setEndPos(self, endpos): """ Set the starting position @param endpos: @return: """ self.pos2 = endpos self.redraw()
[ "def", "setEndPos", "(", "self", ",", "endpos", ")", ":", "self", ".", "pos2", "=", "endpos", "self", ".", "redraw", "(", ")" ]
https://github.com/SanPen/GridCal/blob/d3f4566d2d72c11c7e910c9d162538ef0e60df31/src/GridCal/Gui/GridEditorWidget/transformer2w_graphics.py#L701-L708
JulianEberius/SublimePythonIDE
d70e40abc0c9f347af3204c7b910e0d6bfd6e459
server/lib/python2/rope/contrib/generate.py
python
create_generate
(kind, project, resource, offset)
return generate(project, resource, offset)
A factory for creating `Generate` objects `kind` can be 'variable', 'function', 'class', 'module' or 'package'.
A factory for creating `Generate` objects
[ "A", "factory", "for", "creating", "Generate", "objects" ]
def create_generate(kind, project, resource, offset): """A factory for creating `Generate` objects `kind` can be 'variable', 'function', 'class', 'module' or 'package'. """ generate = eval('Generate' + kind.title()) return generate(project, resource, offset)
[ "def", "create_generate", "(", "kind", ",", "project", ",", "resource", ",", "offset", ")", ":", "generate", "=", "eval", "(", "'Generate'", "+", "kind", ".", "title", "(", ")", ")", "return", "generate", "(", "project", ",", "resource", ",", "offset", ...
https://github.com/JulianEberius/SublimePythonIDE/blob/d70e40abc0c9f347af3204c7b910e0d6bfd6e459/server/lib/python2/rope/contrib/generate.py#L6-L14
mesonbuild/meson
a22d0f9a0a787df70ce79b05d0c45de90a970048
mesonbuild/build.py
python
Executable.get_import_filename
(self)
return self.import_filename
The name of the import library that will be outputted by the compiler Returns None if there is no import library required for this platform
The name of the import library that will be outputted by the compiler
[ "The", "name", "of", "the", "import", "library", "that", "will", "be", "outputted", "by", "the", "compiler" ]
def get_import_filename(self) -> T.Optional[str]: """ The name of the import library that will be outputted by the compiler Returns None if there is no import library required for this platform """ return self.import_filename
[ "def", "get_import_filename", "(", "self", ")", "->", "T", ".", "Optional", "[", "str", "]", ":", "return", "self", ".", "import_filename" ]
https://github.com/mesonbuild/meson/blob/a22d0f9a0a787df70ce79b05d0c45de90a970048/mesonbuild/build.py#L1854-L1860
grow/grow
97fc21730b6a674d5d33948d94968e79447ce433
grow/documents/document_fields.py
python
DocumentFields.__getitem__
(self, key)
return self._data[key]
[]
def __getitem__(self, key): return self._data[key]
[ "def", "__getitem__", "(", "self", ",", "key", ")", ":", "return", "self", ".", "_data", "[", "key", "]" ]
https://github.com/grow/grow/blob/97fc21730b6a674d5d33948d94968e79447ce433/grow/documents/document_fields.py#L15-L16
googleads/google-ads-python
2a1d6062221f6aad1992a6bcca0e7e4a93d2db86
google/ads/googleads/v9/services/services/topic_constant_service/client.py
python
TopicConstantServiceClient.topic_constant_path
(topic_id: str,)
return "topicConstants/{topic_id}".format(topic_id=topic_id,)
Return a fully-qualified topic_constant string.
Return a fully-qualified topic_constant string.
[ "Return", "a", "fully", "-", "qualified", "topic_constant", "string", "." ]
def topic_constant_path(topic_id: str,) -> str: """Return a fully-qualified topic_constant string.""" return "topicConstants/{topic_id}".format(topic_id=topic_id,)
[ "def", "topic_constant_path", "(", "topic_id", ":", "str", ",", ")", "->", "str", ":", "return", "\"topicConstants/{topic_id}\"", ".", "format", "(", "topic_id", "=", "topic_id", ",", ")" ]
https://github.com/googleads/google-ads-python/blob/2a1d6062221f6aad1992a6bcca0e7e4a93d2db86/google/ads/googleads/v9/services/services/topic_constant_service/client.py#L175-L177
frenetic-lang/pyretic
30462692f3e9675158862755955b44f3a37ea21c
pyretic/core/netkat.py
python
netkat_backend.generate_classifier
(cls, pol, switch_cnt, multistage, print_json=False, return_json=False, server_port=NETKAT_PORT)
Generate JSON or classifier output from compiling an input policy.
Generate JSON or classifier output from compiling an input policy.
[ "Generate", "JSON", "or", "classifier", "output", "from", "compiling", "an", "input", "policy", "." ]
def generate_classifier(cls, pol, switch_cnt, multistage, print_json=False, return_json=False, server_port=NETKAT_PORT): """ Generate JSON or classifier output from compiling an input policy. """ def use_explicit_switches(pol): """ Ensure every switch in the netwo...
[ "def", "generate_classifier", "(", "cls", ",", "pol", ",", "switch_cnt", ",", "multistage", ",", "print_json", "=", "False", ",", "return_json", "=", "False", ",", "server_port", "=", "NETKAT_PORT", ")", ":", "def", "use_explicit_switches", "(", "pol", ")", ...
https://github.com/frenetic-lang/pyretic/blob/30462692f3e9675158862755955b44f3a37ea21c/pyretic/core/netkat.py#L70-L163
Raytone-D/puppet
6212d4306d520c60f5f168aec3b79ee56071ee6b
puppet/util.py
python
go_to_top
(h_root: int, timeout: float = 1.0, interval: float = 0.01)
窗口置顶
窗口置顶
[ "窗口置顶" ]
def go_to_top(h_root: int, timeout: float = 1.0, interval: float = 0.01): """窗口置顶""" keyboard.send('alt') # ! enables calls to SwitchToThisWindow if user32.SwitchToThisWindow(h_root, True) != 0: stop = int(timeout/interval) for _ in range(stop): if user32.GetForegroundWindow() ...
[ "def", "go_to_top", "(", "h_root", ":", "int", ",", "timeout", ":", "float", "=", "1.0", ",", "interval", ":", "float", "=", "0.01", ")", ":", "keyboard", ".", "send", "(", "'alt'", ")", "# ! enables calls to SwitchToThisWindow", "if", "user32", ".", "Swit...
https://github.com/Raytone-D/puppet/blob/6212d4306d520c60f5f168aec3b79ee56071ee6b/puppet/util.py#L250-L259
mysql/mysql-connector-python
c5460bcbb0dff8e4e48bf4af7a971c89bf486d85
lib/mysqlx/statement.py
python
Statement.exec_counter
(self)
return self._exec_counter
int: The number of times this statement was executed.
int: The number of times this statement was executed.
[ "int", ":", "The", "number", "of", "times", "this", "statement", "was", "executed", "." ]
def exec_counter(self): """int: The number of times this statement was executed.""" return self._exec_counter
[ "def", "exec_counter", "(", "self", ")", ":", "return", "self", ".", "_exec_counter" ]
https://github.com/mysql/mysql-connector-python/blob/c5460bcbb0dff8e4e48bf4af7a971c89bf486d85/lib/mysqlx/statement.py#L167-L169
boto/boto
b2a6f08122b2f1b89888d2848e730893595cd001
boto/sts/__init__.py
python
regions
()
return get_regions('sts', connection_cls=STSConnection)
Get all available regions for the STS service. :rtype: list :return: A list of :class:`boto.regioninfo.RegionInfo` instances
Get all available regions for the STS service.
[ "Get", "all", "available", "regions", "for", "the", "STS", "service", "." ]
def regions(): """ Get all available regions for the STS service. :rtype: list :return: A list of :class:`boto.regioninfo.RegionInfo` instances """ return get_regions('sts', connection_cls=STSConnection)
[ "def", "regions", "(", ")", ":", "return", "get_regions", "(", "'sts'", ",", "connection_cls", "=", "STSConnection", ")" ]
https://github.com/boto/boto/blob/b2a6f08122b2f1b89888d2848e730893595cd001/boto/sts/__init__.py#L28-L35
heynemann/pyvows
5b0e2a202603c1fc00d1fa0c6134c92c15b7e2b7
pyvows/reporting/coverage.py
python
VowsCoverageReporter.format_class_coverage
(self, cover_character, klass, space1, progress, coverage, space2, lines, cover_threshold)
return ' {0} {klass}{space1}\t{progress}{coverage}{space2} {lines}'.format( # TODO: # * remove manual spacing, use .format() alignment cover_character, klass=klass, space1=space1, progress=dim('•' * progress), coverage=coverage, ...
Accepts coverage data for a class and returns a formatted string (intended for humans).
Accepts coverage data for a class and returns a formatted string (intended for humans).
[ "Accepts", "coverage", "data", "for", "a", "class", "and", "returns", "a", "formatted", "string", "(", "intended", "for", "humans", ")", "." ]
def format_class_coverage(self, cover_character, klass, space1, progress, coverage, space2, lines, cover_threshold): '''Accepts coverage data for a class and returns a formatted string (intended for humans). ''' # FIXME: # Doesn't this *actually* print coverage for a modu...
[ "def", "format_class_coverage", "(", "self", ",", "cover_character", ",", "klass", ",", "space1", ",", "progress", ",", "coverage", ",", "space2", ",", "lines", ",", "cover_threshold", ")", ":", "# FIXME:", "# Doesn't this *actually* print coverage for a module,...
https://github.com/heynemann/pyvows/blob/5b0e2a202603c1fc00d1fa0c6134c92c15b7e2b7/pyvows/reporting/coverage.py#L134-L168
frappe/frappe
b64cab6867dfd860f10ccaf41a4ec04bc890b583
frappe/client.py
python
insert_many
(docs=None)
return out
Insert multiple documents :param docs: JSON or list of dict objects to be inserted in one request
Insert multiple documents
[ "Insert", "multiple", "documents" ]
def insert_many(docs=None): '''Insert multiple documents :param docs: JSON or list of dict objects to be inserted in one request''' if isinstance(docs, str): docs = json.loads(docs) out = [] if len(docs) > 200: frappe.throw(_('Only 200 inserts allowed in one request')) for doc in docs: if doc.get("paren...
[ "def", "insert_many", "(", "docs", "=", "None", ")", ":", "if", "isinstance", "(", "docs", ",", "str", ")", ":", "docs", "=", "json", ".", "loads", "(", "docs", ")", "out", "=", "[", "]", "if", "len", "(", "docs", ")", ">", "200", ":", "frappe"...
https://github.com/frappe/frappe/blob/b64cab6867dfd860f10ccaf41a4ec04bc890b583/frappe/client.py#L177-L200
PaddlePaddle/PGL
e48545f2814523c777b8a9a9188bf5a7f00d6e52
apps/Graph4KG/dataset/trigraph.py
python
TriGraph.ents
(self)
return np.arange(0, self._num_ents)
All entity ids from 0 to :code:`num_ents - 1` (np.ndarray).
All entity ids from 0 to :code:`num_ents - 1` (np.ndarray).
[ "All", "entity", "ids", "from", "0", "to", ":", "code", ":", "num_ents", "-", "1", "(", "np", ".", "ndarray", ")", "." ]
def ents(self): """All entity ids from 0 to :code:`num_ents - 1` (np.ndarray). """ return np.arange(0, self._num_ents)
[ "def", "ents", "(", "self", ")", ":", "return", "np", ".", "arange", "(", "0", ",", "self", ".", "_num_ents", ")" ]
https://github.com/PaddlePaddle/PGL/blob/e48545f2814523c777b8a9a9188bf5a7f00d6e52/apps/Graph4KG/dataset/trigraph.py#L320-L323
uqfoundation/mystic
154e6302d1f2f94e8f13e88ecc5f24241cc28ac7
mystic/math/discrete.py
python
product_measure.flatten
(self)
return params
convert a product measure to a single list of parameters Args: None Returns: a list of parameters Notes: Given ``product_measure.pts = (M, N, ...)``, then the returned list is ``params = [wx1, ..., wxM, x1, ..., xM, wy1, ..., wyN, y1, ..., yN, ...]``. Thus, *params* will have ``M`` weights and ``...
convert a product measure to a single list of parameters
[ "convert", "a", "product", "measure", "to", "a", "single", "list", "of", "parameters" ]
def flatten(self): """convert a product measure to a single list of parameters Args: None Returns: a list of parameters Notes: Given ``product_measure.pts = (M, N, ...)``, then the returned list is ``params = [wx1, ..., wxM, x1, ..., xM, wy1, ..., wyN, y1, ..., yN, ...]``. Thus, *params* will...
[ "def", "flatten", "(", "self", ")", ":", "params", "=", "flatten", "(", "self", ")", "return", "params" ]
https://github.com/uqfoundation/mystic/blob/154e6302d1f2f94e8f13e88ecc5f24241cc28ac7/mystic/math/discrete.py#L944-L961
DSE-MSU/DeepRobust
2bcde200a5969dae32cddece66206a52c87c43e8
deeprobust/graph/utils.py
python
tensor2onehot
(labels)
return onehot_mx.to(labels.device)
Convert label tensor to label onehot tensor. Parameters ---------- labels : torch.LongTensor node labels Returns ------- torch.LongTensor onehot labels tensor
Convert label tensor to label onehot tensor.
[ "Convert", "label", "tensor", "to", "label", "onehot", "tensor", "." ]
def tensor2onehot(labels): """Convert label tensor to label onehot tensor. Parameters ---------- labels : torch.LongTensor node labels Returns ------- torch.LongTensor onehot labels tensor """ eye = torch.eye(labels.max() + 1) onehot_mx = eye[labels] retur...
[ "def", "tensor2onehot", "(", "labels", ")", ":", "eye", "=", "torch", ".", "eye", "(", "labels", ".", "max", "(", ")", "+", "1", ")", "onehot_mx", "=", "eye", "[", "labels", "]", "return", "onehot_mx", ".", "to", "(", "labels", ".", "device", ")" ]
https://github.com/DSE-MSU/DeepRobust/blob/2bcde200a5969dae32cddece66206a52c87c43e8/deeprobust/graph/utils.py#L26-L43
Dozed12/df-style-worldgen
937455d54f4b02df9c4b10ae6418f4c932fd97bf
libtcodpy.py
python
console_put_char
(con, x, y, c, flag=BKGND_DEFAULT)
[]
def console_put_char(con, x, y, c, flag=BKGND_DEFAULT): if type(c) == str or type(c) == bytes: _lib.TCOD_console_put_char(con, x, y, ord(c), flag) else: _lib.TCOD_console_put_char(con, x, y, c, flag)
[ "def", "console_put_char", "(", "con", ",", "x", ",", "y", ",", "c", ",", "flag", "=", "BKGND_DEFAULT", ")", ":", "if", "type", "(", "c", ")", "==", "str", "or", "type", "(", "c", ")", "==", "bytes", ":", "_lib", ".", "TCOD_console_put_char", "(", ...
https://github.com/Dozed12/df-style-worldgen/blob/937455d54f4b02df9c4b10ae6418f4c932fd97bf/libtcodpy.py#L763-L767
sethmlarson/virtualbox-python
984a6e2cb0e8996f4df40f4444c1528849f1c70d
virtualbox/library.py
python
ISystemProperties.max_guest_vram
(self)
return ret
Get int value for 'maxGuestVRAM' Maximum guest video memory in Megabytes.
Get int value for 'maxGuestVRAM' Maximum guest video memory in Megabytes.
[ "Get", "int", "value", "for", "maxGuestVRAM", "Maximum", "guest", "video", "memory", "in", "Megabytes", "." ]
def max_guest_vram(self): """Get int value for 'maxGuestVRAM' Maximum guest video memory in Megabytes. """ ret = self._get_attr("maxGuestVRAM") return ret
[ "def", "max_guest_vram", "(", "self", ")", ":", "ret", "=", "self", ".", "_get_attr", "(", "\"maxGuestVRAM\"", ")", "return", "ret" ]
https://github.com/sethmlarson/virtualbox-python/blob/984a6e2cb0e8996f4df40f4444c1528849f1c70d/virtualbox/library.py#L20137-L20142
akamai-threat-research/mqtt-pwn
40368e531660339fca1562a6c609c35f7ae4f989
mqtt_pwn/connection/brute_forcer.py
python
ConnectionResult.set_return_code
(self, return_code)
Sets the return code field
Sets the return code field
[ "Sets", "the", "return", "code", "field" ]
def set_return_code(self, return_code): """Sets the return code field""" self._return_code = return_code
[ "def", "set_return_code", "(", "self", ",", "return_code", ")", ":", "self", ".", "_return_code", "=", "return_code" ]
https://github.com/akamai-threat-research/mqtt-pwn/blob/40368e531660339fca1562a6c609c35f7ae4f989/mqtt_pwn/connection/brute_forcer.py#L17-L19
hatRiot/zarp
2e772350a01c2aeed3f4da9685cd0cc5d6b3ecad
src/lib/scapy/layers/sctp.py
python
_SCTPChunkGuessPayload.default_payload_class
(self,p)
[]
def default_payload_class(self,p): if len(p) < 4: return conf.padding_layer else: t = ord(p[0]) return globals().get(sctpchunktypescls.get(t, "Raw"), conf.raw_layer)
[ "def", "default_payload_class", "(", "self", ",", "p", ")", ":", "if", "len", "(", "p", ")", "<", "4", ":", "return", "conf", ".", "padding_layer", "else", ":", "t", "=", "ord", "(", "p", "[", "0", "]", ")", "return", "globals", "(", ")", ".", ...
https://github.com/hatRiot/zarp/blob/2e772350a01c2aeed3f4da9685cd0cc5d6b3ecad/src/lib/scapy/layers/sctp.py#L179-L184
LinkedInAttic/naarad
261e2c0760fd6a6b0ee59064180bd8e3674311fe
src/naarad/metrics/metric.py
python
Metric.calc_key_stats
(self, metric_store)
Calculate stats such as percentile and mean :param dict metric_store: The metric store used to store all the parsed log data :return: None
Calculate stats such as percentile and mean
[ "Calculate", "stats", "such", "as", "percentile", "and", "mean" ]
def calc_key_stats(self, metric_store): """ Calculate stats such as percentile and mean :param dict metric_store: The metric store used to store all the parsed log data :return: None """ stats_to_calculate = ['mean', 'std', 'min', 'max'] # TODO: get input from user percentiles_to_calculate...
[ "def", "calc_key_stats", "(", "self", ",", "metric_store", ")", ":", "stats_to_calculate", "=", "[", "'mean'", ",", "'std'", ",", "'min'", ",", "'max'", "]", "# TODO: get input from user", "percentiles_to_calculate", "=", "range", "(", "0", ",", "100", ",", "1...
https://github.com/LinkedInAttic/naarad/blob/261e2c0760fd6a6b0ee59064180bd8e3674311fe/src/naarad/metrics/metric.py#L322-L343
enthought/mayavi
2103a273568b8f0bd62328801aafbd6252543ae8
mayavi/sources/array_source.py
python
ArraySource.remove_attribute
(self, name, category='point')
Remove an attribute by its name and optional category (point and cell). Returns the removed array.
Remove an attribute by its name and optional category (point and cell). Returns the removed array.
[ "Remove", "an", "attribute", "by", "its", "name", "and", "optional", "category", "(", "point", "and", "cell", ")", ".", "Returns", "the", "removed", "array", "." ]
def remove_attribute(self, name, category='point'): """Remove an attribute by its name and optional category (point and cell). Returns the removed array. """ data = getattr(self.image_data, '%s_data' % category) data.remove_array(name)
[ "def", "remove_attribute", "(", "self", ",", "name", ",", "category", "=", "'point'", ")", ":", "data", "=", "getattr", "(", "self", ".", "image_data", ",", "'%s_data'", "%", "category", ")", "data", ".", "remove_array", "(", "name", ")" ]
https://github.com/enthought/mayavi/blob/2103a273568b8f0bd62328801aafbd6252543ae8/mayavi/sources/array_source.py#L215-L220
home-assistant/core
265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1
homeassistant/components/alexa/capabilities.py
python
AlexaPowerController.properties_proactively_reported
(self)
return True
Return True if properties asynchronously reported.
Return True if properties asynchronously reported.
[ "Return", "True", "if", "properties", "asynchronously", "reported", "." ]
def properties_proactively_reported(self): """Return True if properties asynchronously reported.""" return True
[ "def", "properties_proactively_reported", "(", "self", ")", ":", "return", "True" ]
https://github.com/home-assistant/core/blob/265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1/homeassistant/components/alexa/capabilities.py#L380-L382
GoogleCloudPlatform/professional-services
0c707aa97437f3d154035ef8548109b7882f71da
examples/vertex_pipeline/components/component_base/src/preprocess.py
python
executor_main
()
Main executor.
Main executor.
[ "Main", "executor", "." ]
def executor_main(): """Main executor.""" parser = argparse.ArgumentParser() parser.add_argument('--executor_input', type=str) parser.add_argument('--function_to_execute', type=str) args, _ = parser.parse_known_args() executor_input = json.loads(args.executor_input) function_to_execute = globals()[args....
[ "def", "executor_main", "(", ")", ":", "parser", "=", "argparse", ".", "ArgumentParser", "(", ")", "parser", ".", "add_argument", "(", "'--executor_input'", ",", "type", "=", "str", ")", "parser", ".", "add_argument", "(", "'--function_to_execute'", ",", "type...
https://github.com/GoogleCloudPlatform/professional-services/blob/0c707aa97437f3d154035ef8548109b7882f71da/examples/vertex_pipeline/components/component_base/src/preprocess.py#L95-L108
kuri65536/python-for-android
26402a08fc46b09ef94e8d7a6bbc3a54ff9d0891
python-modules/twisted/twisted/internet/selectreactor.py
python
SelectReactor.addReader
(self, reader)
Add a FileDescriptor for notification of data available to read.
Add a FileDescriptor for notification of data available to read.
[ "Add", "a", "FileDescriptor", "for", "notification", "of", "data", "available", "to", "read", "." ]
def addReader(self, reader): """ Add a FileDescriptor for notification of data available to read. """ self._reads[reader] = 1
[ "def", "addReader", "(", "self", ",", "reader", ")", ":", "self", ".", "_reads", "[", "reader", "]", "=", "1" ]
https://github.com/kuri65536/python-for-android/blob/26402a08fc46b09ef94e8d7a6bbc3a54ff9d0891/python-modules/twisted/twisted/internet/selectreactor.py#L158-L162
fuzzbunch/fuzzbunch
4b60a6c7cf9f84cf389d3fcdb9281de84ffb5802
fuzzbunch/plugin.py
python
Plugin.execute
(self, session, mode)
Execute the plugin
Execute the plugin
[ "Execute", "the", "plugin" ]
def execute(self, session, mode): """Execute the plugin""" pass
[ "def", "execute", "(", "self", ",", "session", ",", "mode", ")", ":", "pass" ]
https://github.com/fuzzbunch/fuzzbunch/blob/4b60a6c7cf9f84cf389d3fcdb9281de84ffb5802/fuzzbunch/plugin.py#L308-L310
SebKuzminsky/pycam
55e3129f518e470040e79bb00515b4bfcf36c172
pycam/Plugins/ParallelProcessing.py
python
ParallelProcessing.setup
(self)
return True
[]
def setup(self): if self.gui and self._gtk: box = self.gui.get_object("MultiprocessingFrame") box.unparent() self.core.register_ui("preferences", "Parallel processing", box, 60) # "process pool" window self.process_pool_window = self.gui.get_object("Pr...
[ "def", "setup", "(", "self", ")", ":", "if", "self", ".", "gui", "and", "self", ".", "_gtk", ":", "box", "=", "self", ".", "gui", ".", "get_object", "(", "\"MultiprocessingFrame\"", ")", "box", ".", "unparent", "(", ")", "self", ".", "core", ".", "...
https://github.com/SebKuzminsky/pycam/blob/55e3129f518e470040e79bb00515b4bfcf36c172/pycam/Plugins/ParallelProcessing.py#L35-L92
pyg-team/pytorch_geometric
b920e9a3a64e22c8356be55301c88444ff051cae
benchmark/citation/gat.py
python
Net.forward
(self, data)
return F.log_softmax(x, dim=1)
[]
def forward(self, data): x, edge_index = data.x, data.edge_index x = F.dropout(x, p=args.dropout, training=self.training) x = F.elu(self.conv1(x, edge_index)) x = F.dropout(x, p=args.dropout, training=self.training) x = self.conv2(x, edge_index) return F.log_softmax(x, di...
[ "def", "forward", "(", "self", ",", "data", ")", ":", "x", ",", "edge_index", "=", "data", ".", "x", ",", "data", ".", "edge_index", "x", "=", "F", ".", "dropout", "(", "x", ",", "p", "=", "args", ".", "dropout", ",", "training", "=", "self", "...
https://github.com/pyg-team/pytorch_geometric/blob/b920e9a3a64e22c8356be55301c88444ff051cae/benchmark/citation/gat.py#L37-L43
tjweir/liftbook
e977a7face13ade1a4558e1909a6951d2f8928dd
elyxer.py
python
FormulaFactory.clearany
(self, pos)
return None
Cleary any ignored type.
Cleary any ignored type.
[ "Cleary", "any", "ignored", "type", "." ]
def clearany(self, pos): "Cleary any ignored type." for type in self.ignoredtypes: if self.instance(type).detect(pos): return self.parsetype(type, pos) return None
[ "def", "clearany", "(", "self", ",", "pos", ")", ":", "for", "type", "in", "self", ".", "ignoredtypes", ":", "if", "self", ".", "instance", "(", "type", ")", ".", "detect", "(", "pos", ")", ":", "return", "self", ".", "parsetype", "(", "type", ",",...
https://github.com/tjweir/liftbook/blob/e977a7face13ade1a4558e1909a6951d2f8928dd/elyxer.py#L4389-L4394
Source-Python-Dev-Team/Source.Python
d0ffd8ccbd1e9923c9bc44936f20613c1c76b7fb
addons/source-python/Python3/configparser.py
python
RawConfigParser._unify_values
(self, section, vars)
return _ChainMap(vardict, sectiondict, self._defaults)
Create a sequence of lookups with 'vars' taking priority over the 'section' which takes priority over the DEFAULTSECT.
Create a sequence of lookups with 'vars' taking priority over the 'section' which takes priority over the DEFAULTSECT.
[ "Create", "a", "sequence", "of", "lookups", "with", "vars", "taking", "priority", "over", "the", "section", "which", "takes", "priority", "over", "the", "DEFAULTSECT", "." ]
def _unify_values(self, section, vars): """Create a sequence of lookups with 'vars' taking priority over the 'section' which takes priority over the DEFAULTSECT. """ sectiondict = {} try: sectiondict = self._sections[section] except KeyError: if s...
[ "def", "_unify_values", "(", "self", ",", "section", ",", "vars", ")", ":", "sectiondict", "=", "{", "}", "try", ":", "sectiondict", "=", "self", ".", "_sections", "[", "section", "]", "except", "KeyError", ":", "if", "section", "!=", "self", ".", "def...
https://github.com/Source-Python-Dev-Team/Source.Python/blob/d0ffd8ccbd1e9923c9bc44936f20613c1c76b7fb/addons/source-python/Python3/configparser.py#L1131-L1149
openstack/tempest
fe0ac89a5a1c43fa908a76759cd99eea3b1f9853
tempest/lib/common/rest_client.py
python
RestClient.put
(self, url, body, headers=None, extra_headers=False, chunked=False)
return self.request('PUT', url, extra_headers, headers, body, chunked)
Send a HTTP PUT request using keystone service catalog and auth :param str url: the relative url to send the put request to :param dict body: the request body :param dict headers: The headers to use for the request :param bool extra_headers: Boolean value than indicates if the headers ...
Send a HTTP PUT request using keystone service catalog and auth
[ "Send", "a", "HTTP", "PUT", "request", "using", "keystone", "service", "catalog", "and", "auth" ]
def put(self, url, body, headers=None, extra_headers=False, chunked=False): """Send a HTTP PUT request using keystone service catalog and auth :param str url: the relative url to send the put request to :param dict body: the request body :param dict headers: The headers to use for the r...
[ "def", "put", "(", "self", ",", "url", ",", "body", ",", "headers", "=", "None", ",", "extra_headers", "=", "False", ",", "chunked", "=", "False", ")", ":", "return", "self", ".", "request", "(", "'PUT'", ",", "url", ",", "extra_headers", ",", "heade...
https://github.com/openstack/tempest/blob/fe0ac89a5a1c43fa908a76759cd99eea3b1f9853/tempest/lib/common/rest_client.py#L348-L363
InvestmentSystems/static-frame
0b19d6969bf6c17fb0599871aca79eb3b52cf2ed
static_frame/core/bus.py
python
Bus.to_series
(self)
return Series(self.values, index=self._index, own_index=True, name=self._name, )
Return a :obj:`Series` with the :obj:`Frame` contained in this :obj:`Bus`. If the :obj:`Bus` is associated with a :obj:`Store`, all :obj:`Frame` will be loaded into memory and the returned :obj:`Bus` will no longer be associated with the :obj:`Store`.
Return a :obj:`Series` with the :obj:`Frame` contained in this :obj:`Bus`. If the :obj:`Bus` is associated with a :obj:`Store`, all :obj:`Frame` will be loaded into memory and the returned :obj:`Bus` will no longer be associated with the :obj:`Store`.
[ "Return", "a", ":", "obj", ":", "Series", "with", "the", ":", "obj", ":", "Frame", "contained", "in", "this", ":", "obj", ":", "Bus", ".", "If", "the", ":", "obj", ":", "Bus", "is", "associated", "with", "a", ":", "obj", ":", "Store", "all", ":",...
def to_series(self) -> Series: '''Return a :obj:`Series` with the :obj:`Frame` contained in this :obj:`Bus`. If the :obj:`Bus` is associated with a :obj:`Store`, all :obj:`Frame` will be loaded into memory and the returned :obj:`Bus` will no longer be associated with the :obj:`Store`. ''' # valu...
[ "def", "to_series", "(", "self", ")", "->", "Series", ":", "# values returns an immutable array and will fully realize from Store", "return", "Series", "(", "self", ".", "values", ",", "index", "=", "self", ".", "_index", ",", "own_index", "=", "True", ",", "name"...
https://github.com/InvestmentSystems/static-frame/blob/0b19d6969bf6c17fb0599871aca79eb3b52cf2ed/static_frame/core/bus.py#L1323-L1331
pret/pokemon-reverse-engineering-tools
5e0715f2579adcfeb683448c9a7826cfd3afa57d
pokemontools/map_editor.py
python
MapRenderer.__init__
(self, config=config, **kwargs)
[]
def __init__(self, config=config, **kwargs): self.config = config self.__dict__.update(kwargs) self.map = Map(**kwargs)
[ "def", "__init__", "(", "self", ",", "config", "=", "config", ",", "*", "*", "kwargs", ")", ":", "self", ".", "config", "=", "config", "self", ".", "__dict__", ".", "update", "(", "kwargs", ")", "self", ".", "map", "=", "Map", "(", "*", "*", "kwa...
https://github.com/pret/pokemon-reverse-engineering-tools/blob/5e0715f2579adcfeb683448c9a7826cfd3afa57d/pokemontools/map_editor.py#L398-L401
rucio/rucio
6d0d358e04f5431f0b9a98ae40f31af0ddff4833
lib/rucio/db/sqla/migrate_repo/versions/2af3291ec4c_added_replicas_history_table.py
python
upgrade
()
Upgrade the database to this revision
Upgrade the database to this revision
[ "Upgrade", "the", "database", "to", "this", "revision" ]
def upgrade(): ''' Upgrade the database to this revision ''' if context.get_context().dialect.name in ['oracle', 'mysql', 'postgresql']: create_table('replicas_history', sa.Column('rse_id', GUID()), sa.Column('scope', sa.String(25)), ...
[ "def", "upgrade", "(", ")", ":", "if", "context", ".", "get_context", "(", ")", ".", "dialect", ".", "name", "in", "[", "'oracle'", ",", "'mysql'", ",", "'postgresql'", "]", ":", "create_table", "(", "'replicas_history'", ",", "sa", ".", "Column", "(", ...
https://github.com/rucio/rucio/blob/6d0d358e04f5431f0b9a98ae40f31af0ddff4833/lib/rucio/db/sqla/migrate_repo/versions/2af3291ec4c_added_replicas_history_table.py#L35-L49
LGE-ARC-AdvancedAI/auptimizer
50f6e3b4e0cb9146ca90fd74b9b24ca97ae22617
src/aup/Proposer/hyperopt/mongoexp.py
python
MongoJobs.set_attachment
(self, doc, blob, name, collection=None)
Attach potentially large data string `blob` to `doc` by name `name` blob must be a string doc must have been saved in some collection (must have an _id), but not necessarily the jobs collection. name must be a string Returns None
Attach potentially large data string `blob` to `doc` by name `name`
[ "Attach", "potentially", "large", "data", "string", "blob", "to", "doc", "by", "name", "name" ]
def set_attachment(self, doc, blob, name, collection=None): """Attach potentially large data string `blob` to `doc` by name `name` blob must be a string doc must have been saved in some collection (must have an _id), but not necessarily the jobs collection. name must be a stri...
[ "def", "set_attachment", "(", "self", ",", "doc", ",", "blob", ",", "name", ",", "collection", "=", "None", ")", ":", "# If there is already a file with the given name for this doc, then we will delete it", "# after writing the new file", "attachments", "=", "doc", ".", "...
https://github.com/LGE-ARC-AdvancedAI/auptimizer/blob/50f6e3b4e0cb9146ca90fd74b9b24ca97ae22617/src/aup/Proposer/hyperopt/mongoexp.py#L570-L611
exercism/python
f79d44ef6c9cf68d8c76cb94017a590f04391635
exercises/practice/run-length-encoding/.meta/example.py
python
encode
(string)
return ''.join(single_helper(key, group) for key, group in groupby(string))
[]
def encode(string): def single_helper(key, group): size = len(list(group)) return key if size == 1 else str(size) + key return ''.join(single_helper(key, group) for key, group in groupby(string))
[ "def", "encode", "(", "string", ")", ":", "def", "single_helper", "(", "key", ",", "group", ")", ":", "size", "=", "len", "(", "list", "(", "group", ")", ")", "return", "key", "if", "size", "==", "1", "else", "str", "(", "size", ")", "+", "key", ...
https://github.com/exercism/python/blob/f79d44ef6c9cf68d8c76cb94017a590f04391635/exercises/practice/run-length-encoding/.meta/example.py#L9-L13
replit-archive/empythoned
977ec10ced29a3541a4973dc2b59910805695752
cpython/Lib/plat-mac/lib-scriptpackages/StdSuites/AppleScript_Suite.py
python
AppleScript_Suite_Events.ends_with
(self, _object, _attributes={}, **_arguments)
ends with: Ends with Required argument: an AE object reference Keyword argument _attributes: AppleEvent attribute dictionary Returns: anything
ends with: Ends with Required argument: an AE object reference Keyword argument _attributes: AppleEvent attribute dictionary Returns: anything
[ "ends", "with", ":", "Ends", "with", "Required", "argument", ":", "an", "AE", "object", "reference", "Keyword", "argument", "_attributes", ":", "AppleEvent", "attribute", "dictionary", "Returns", ":", "anything" ]
def ends_with(self, _object, _attributes={}, **_arguments): """ends with: Ends with Required argument: an AE object reference Keyword argument _attributes: AppleEvent attribute dictionary Returns: anything """ _code = 'ascr' _subcode = 'ends' if _argument...
[ "def", "ends_with", "(", "self", ",", "_object", ",", "_attributes", "=", "{", "}", ",", "*", "*", "_arguments", ")", ":", "_code", "=", "'ascr'", "_subcode", "=", "'ends'", "if", "_arguments", ":", "raise", "TypeError", ",", "'No optional args expected'", ...
https://github.com/replit-archive/empythoned/blob/977ec10ced29a3541a4973dc2b59910805695752/cpython/Lib/plat-mac/lib-scriptpackages/StdSuites/AppleScript_Suite.py#L385-L404
danecjensen/subscribely
4d6ac60358b5fe26f0c01be68f1ba063df3b1ea0
src/flask/app.py
python
Flask.try_trigger_before_first_request_functions
(self)
Called before each request and will ensure that it triggers the :attr:`before_first_request_funcs` and only exactly once per application instance (which means process usually). :internal:
Called before each request and will ensure that it triggers the :attr:`before_first_request_funcs` and only exactly once per application instance (which means process usually).
[ "Called", "before", "each", "request", "and", "will", "ensure", "that", "it", "triggers", "the", ":", "attr", ":", "before_first_request_funcs", "and", "only", "exactly", "once", "per", "application", "instance", "(", "which", "means", "process", "usually", ")",...
def try_trigger_before_first_request_functions(self): """Called before each request and will ensure that it triggers the :attr:`before_first_request_funcs` and only exactly once per application instance (which means process usually). :internal: """ if self._got_first_req...
[ "def", "try_trigger_before_first_request_functions", "(", "self", ")", ":", "if", "self", ".", "_got_first_request", ":", "return", "with", "self", ".", "_before_request_lock", ":", "if", "self", ".", "_got_first_request", ":", "return", "self", ".", "_got_first_req...
https://github.com/danecjensen/subscribely/blob/4d6ac60358b5fe26f0c01be68f1ba063df3b1ea0/src/flask/app.py#L1270-L1284
cooelf/SemBERT
f849452f864b5dd47f94e2911cffc15e9f6a5a2a
run_classifier.py
python
QnliProcessor.get_train_examples
(self, data_dir)
return self._create_examples( self._read_tsv(os.path.join(data_dir, "train.tsv_tag")), "train")
See base class.
See base class.
[ "See", "base", "class", "." ]
def get_train_examples(self, data_dir): """See base class.""" return self._create_examples( self._read_tsv(os.path.join(data_dir, "train.tsv_tag")), "train")
[ "def", "get_train_examples", "(", "self", ",", "data_dir", ")", ":", "return", "self", ".", "_create_examples", "(", "self", ".", "_read_tsv", "(", "os", ".", "path", ".", "join", "(", "data_dir", ",", "\"train.tsv_tag\"", ")", ")", ",", "\"train\"", ")" ]
https://github.com/cooelf/SemBERT/blob/f849452f864b5dd47f94e2911cffc15e9f6a5a2a/run_classifier.py#L321-L324
Cadene/tensorflow-model-zoo.torch
990b10ffc22d4c8eacb2a502f20415b4f70c74c2
models/research/cognitive_mapping_and_planning/tfcode/tf_utils.py
python
add_value_to_summary
(metric_summary, tag, val, log=True, tag_str=None)
Adds a scalar summary to the summary object. Optionally also logs to logging.
Adds a scalar summary to the summary object. Optionally also logs to logging.
[ "Adds", "a", "scalar", "summary", "to", "the", "summary", "object", ".", "Optionally", "also", "logs", "to", "logging", "." ]
def add_value_to_summary(metric_summary, tag, val, log=True, tag_str=None): """Adds a scalar summary to the summary object. Optionally also logs to logging.""" new_value = metric_summary.value.add(); new_value.tag = tag new_value.simple_value = val if log: if tag_str is None: tag_str = tag + '%f' ...
[ "def", "add_value_to_summary", "(", "metric_summary", ",", "tag", ",", "val", ",", "log", "=", "True", ",", "tag_str", "=", "None", ")", ":", "new_value", "=", "metric_summary", ".", "value", ".", "add", "(", ")", "new_value", ".", "tag", "=", "tag", "...
https://github.com/Cadene/tensorflow-model-zoo.torch/blob/990b10ffc22d4c8eacb2a502f20415b4f70c74c2/models/research/cognitive_mapping_and_planning/tfcode/tf_utils.py#L688-L697
pypa/flit
a4524758604107bde8c77b5816612edb76a604aa
flit_core/flit_core/vendor/tomli/_re.py
python
match_to_datetime
(match: "re.Match")
return datetime(year, month, day, hour, minute, sec, micros, tzinfo=tz)
Convert a `RE_DATETIME` match to `datetime.datetime` or `datetime.date`. Raises ValueError if the match does not correspond to a valid date or datetime.
Convert a `RE_DATETIME` match to `datetime.datetime` or `datetime.date`.
[ "Convert", "a", "RE_DATETIME", "match", "to", "datetime", ".", "datetime", "or", "datetime", ".", "date", "." ]
def match_to_datetime(match: "re.Match") -> Union[datetime, date]: """Convert a `RE_DATETIME` match to `datetime.datetime` or `datetime.date`. Raises ValueError if the match does not correspond to a valid date or datetime. """ ( year_str, month_str, day_str, hour_str...
[ "def", "match_to_datetime", "(", "match", ":", "\"re.Match\"", ")", "->", "Union", "[", "datetime", ",", "date", "]", ":", "(", "year_str", ",", "month_str", ",", "day_str", ",", "hour_str", ",", "minute_str", ",", "sec_str", ",", "micros_str", ",", "zulu_...
https://github.com/pypa/flit/blob/a4524758604107bde8c77b5816612edb76a604aa/flit_core/flit_core/vendor/tomli/_re.py#L46-L78
fake-name/ChromeController
6c70d855e33e06463516b263bf9e6f34c48e29e8
ChromeController/Generator/Generated.py
python
ChromeRemoteDebugInterface.Database_disable
(self)
return subdom_funcs
Function path: Database.disable Domain: Database Method name: disable No return value. Description: Disables database tracking, prevents database events from being sent to the client.
Function path: Database.disable Domain: Database Method name: disable No return value. Description: Disables database tracking, prevents database events from being sent to the client.
[ "Function", "path", ":", "Database", ".", "disable", "Domain", ":", "Database", "Method", "name", ":", "disable", "No", "return", "value", ".", "Description", ":", "Disables", "database", "tracking", "prevents", "database", "events", "from", "being", "sent", "...
def Database_disable(self): """ Function path: Database.disable Domain: Database Method name: disable No return value. Description: Disables database tracking, prevents database events from being sent to the client. """ subdom_funcs = self.synchronous_command('Database.disable') return subdo...
[ "def", "Database_disable", "(", "self", ")", ":", "subdom_funcs", "=", "self", ".", "synchronous_command", "(", "'Database.disable'", ")", "return", "subdom_funcs" ]
https://github.com/fake-name/ChromeController/blob/6c70d855e33e06463516b263bf9e6f34c48e29e8/ChromeController/Generator/Generated.py#L3333-L3344
aliyun/aliyun-odps-python-sdk
20b391c8d6eb1a689eedf950c2fc702be5f057c9
odps/lib/six.py
python
_SixMetaPathImporter.get_code
(self, fullname)
return None
Return None Required, if is_package is implemented
Return None
[ "Return", "None" ]
def get_code(self, fullname): """Return None Required, if is_package is implemented""" self.__get_module(fullname) # eventually raises ImportError return None
[ "def", "get_code", "(", "self", ",", "fullname", ")", ":", "self", ".", "__get_module", "(", "fullname", ")", "# eventually raises ImportError", "return", "None" ]
https://github.com/aliyun/aliyun-odps-python-sdk/blob/20b391c8d6eb1a689eedf950c2fc702be5f057c9/odps/lib/six.py#L233-L238
alshedivat/keras-gp
742019c428948673920284215058a0c284491b80
kgp/backend/gpml.py
python
GPML.get_dlik_dx
(self, which_set, verbose=0)
return dlik_dx
Get derivative of the log marginal likelihood w.r.t. the kernel.
Get derivative of the log marginal likelihood w.r.t. the kernel.
[ "Get", "derivative", "of", "the", "log", "marginal", "likelihood", "w", ".", "r", ".", "t", ".", "the", "kernel", "." ]
def get_dlik_dx(self, which_set, verbose=0): """Get derivative of the log marginal likelihood w.r.t. the kernel. """ assert which_set in {'tr', 'tst', 'val', 'tmp'} X_name, y_name = 'X_' + which_set, 'y_' + which_set self.config.update({'X': X_name, 'y': y_name}) self.eng...
[ "def", "get_dlik_dx", "(", "self", ",", "which_set", ",", "verbose", "=", "0", ")", ":", "assert", "which_set", "in", "{", "'tr'", ",", "'tst'", ",", "'val'", ",", "'tmp'", "}", "X_name", ",", "y_name", "=", "'X_'", "+", "which_set", ",", "'y_'", "+"...
https://github.com/alshedivat/keras-gp/blob/742019c428948673920284215058a0c284491b80/kgp/backend/gpml.py#L207-L215
openelections/openelections-core
3c516d8c4cf1166b1868b738a248d48f3378c525
openelex/us/wa/transform/__init__.py
python
CreateResultsTransform._parse_winner
(self, raw_result)
Converts raw winner value into boolean
Converts raw winner value into boolean
[ "Converts", "raw", "winner", "value", "into", "boolean" ]
def _parse_winner(self, raw_result): """ Converts raw winner value into boolean """ if raw_result.winner == 'Y': # Winner in post-2002 contest return True elif raw_result.winner == 1: # Winner in 2002 contest return True els...
[ "def", "_parse_winner", "(", "self", ",", "raw_result", ")", ":", "if", "raw_result", ".", "winner", "==", "'Y'", ":", "# Winner in post-2002 contest", "return", "True", "elif", "raw_result", ".", "winner", "==", "1", ":", "# Winner in 2002 contest", "return", "...
https://github.com/openelections/openelections-core/blob/3c516d8c4cf1166b1868b738a248d48f3378c525/openelex/us/wa/transform/__init__.py#L491-L502
williballenthin/INDXParse
454d70645b2d01f75ac4346bc2410fbe047d090c
INDXParse.py
python
NTATTR_STANDARD_INDEX_HEADER.deleted_entries
(self)
A generator that yields INDX entries found in the slack space associated with this header.
A generator that yields INDX entries found in the slack space associated with this header.
[ "A", "generator", "that", "yields", "INDX", "entries", "found", "in", "the", "slack", "space", "associated", "with", "this", "header", "." ]
def deleted_entries(self): """ A generator that yields INDX entries found in the slack space associated with this header. """ off = self.offset() + self.entry_size() # NTATTR_STANDARD_INDEX_ENTRY is at least 0x52 bytes # long, so don't overrun # but if we...
[ "def", "deleted_entries", "(", "self", ")", ":", "off", "=", "self", ".", "offset", "(", ")", "+", "self", ".", "entry_size", "(", ")", "# NTATTR_STANDARD_INDEX_ENTRY is at least 0x52 bytes", "# long, so don't overrun", "# but if we do, then we're done", "try", ":", "...
https://github.com/williballenthin/INDXParse/blob/454d70645b2d01f75ac4346bc2410fbe047d090c/INDXParse.py#L403-L431
bowenbaker/metaqnn
a25847f635e9545455f83405453e740646038f7a
libs/input_modules/get_datasets.py
python
get_mnist
(save_dir=None, root_path=None)
return Xtr, Ytr, Xte, Yte
If root_path is None, we download the data set from internet. Either save path or root path must not be None and not both. Returns Xtr, Ytr, Xte, Yte as numpy arrays
If root_path is None, we download the data set from internet.
[ "If", "root_path", "is", "None", "we", "download", "the", "data", "set", "from", "internet", "." ]
def get_mnist(save_dir=None, root_path=None): ''' If root_path is None, we download the data set from internet. Either save path or root path must not be None and not both. Returns Xtr, Ytr, Xte, Yte as numpy arrays ''' assert((save_dir is not None and root_path is None) or (save_dir is N...
[ "def", "get_mnist", "(", "save_dir", "=", "None", ",", "root_path", "=", "None", ")", ":", "assert", "(", "(", "save_dir", "is", "not", "None", "and", "root_path", "is", "None", ")", "or", "(", "save_dir", "is", "None", "and", "root_path", "is", "not",...
https://github.com/bowenbaker/metaqnn/blob/a25847f635e9545455f83405453e740646038f7a/libs/input_modules/get_datasets.py#L345-L379
cisco-sas/kitty
cb0760989dcdfe079e43ac574d872d0b18953a32
kitty/model/low_level/aliases.py
python
BitMaskNotSet
(field, comp_value)
return Compare(field, '&=0', comp_value)
Condition applies if the given bitmask is equal to 0 in the value of the field :rtype: :class:`~kitty.model.low_level.condition.Compare`
Condition applies if the given bitmask is equal to 0 in the value of the field
[ "Condition", "applies", "if", "the", "given", "bitmask", "is", "equal", "to", "0", "in", "the", "value", "of", "the", "field" ]
def BitMaskNotSet(field, comp_value): ''' Condition applies if the given bitmask is equal to 0 in the value of the field :rtype: :class:`~kitty.model.low_level.condition.Compare` ''' return Compare(field, '&=0', comp_value)
[ "def", "BitMaskNotSet", "(", "field", ",", "comp_value", ")", ":", "return", "Compare", "(", "field", ",", "'&=0'", ",", "comp_value", ")" ]
https://github.com/cisco-sas/kitty/blob/cb0760989dcdfe079e43ac574d872d0b18953a32/kitty/model/low_level/aliases.py#L327-L333
ambakick/Person-Detection-and-Tracking
f925394ac29b5cf321f1ce89a71b193381519a0b
utils/np_box_mask_list_ops.py
python
iou
(box_mask_list1, box_mask_list2)
return np_mask_ops.iou(box_mask_list1.get_masks(), box_mask_list2.get_masks())
Computes pairwise intersection-over-union between box and mask collections. Args: box_mask_list1: BoxMaskList holding N boxes and masks box_mask_list2: BoxMaskList holding M boxes and masks Returns: a numpy array with shape [N, M] representing pairwise iou scores.
Computes pairwise intersection-over-union between box and mask collections.
[ "Computes", "pairwise", "intersection", "-", "over", "-", "union", "between", "box", "and", "mask", "collections", "." ]
def iou(box_mask_list1, box_mask_list2): """Computes pairwise intersection-over-union between box and mask collections. Args: box_mask_list1: BoxMaskList holding N boxes and masks box_mask_list2: BoxMaskList holding M boxes and masks Returns: a numpy array with shape [N, M] representing pairwise iou...
[ "def", "iou", "(", "box_mask_list1", ",", "box_mask_list2", ")", ":", "return", "np_mask_ops", ".", "iou", "(", "box_mask_list1", ".", "get_masks", "(", ")", ",", "box_mask_list2", ".", "get_masks", "(", ")", ")" ]
https://github.com/ambakick/Person-Detection-and-Tracking/blob/f925394ac29b5cf321f1ce89a71b193381519a0b/utils/np_box_mask_list_ops.py#L79-L90
horazont/aioxmpp
c701e6399c90a6bb9bec0349018a03bd7b644cde
aioxmpp/security_layer.py
python
make
( password_provider, *, pin_store=None, pin_type=PinType.PUBLIC_KEY, post_handshake_deferred_failure=None, anonymous=False, ssl_context_factory=default_ssl_context, no_verify=False)
return SecurityLayer( ssl_context_factory, certificate_verifier_factory, True, tuple(sasl_providers), )
Construct a :class:`SecurityLayer`. Depending on the arguments passed, different features are enabled or disabled. .. warning:: When using any argument except `password_provider`, be sure to read its documentation below the following overview **carefully**. Many arguments can be used t...
Construct a :class:`SecurityLayer`. Depending on the arguments passed, different features are enabled or disabled.
[ "Construct", "a", ":", "class", ":", "SecurityLayer", ".", "Depending", "on", "the", "arguments", "passed", "different", "features", "are", "enabled", "or", "disabled", "." ]
def make( password_provider, *, pin_store=None, pin_type=PinType.PUBLIC_KEY, post_handshake_deferred_failure=None, anonymous=False, ssl_context_factory=default_ssl_context, no_verify=False): """ Construct a :class:`SecurityLayer`. Depending on the ...
[ "def", "make", "(", "password_provider", ",", "*", ",", "pin_store", "=", "None", ",", "pin_type", "=", "PinType", ".", "PUBLIC_KEY", ",", "post_handshake_deferred_failure", "=", "None", ",", "anonymous", "=", "False", ",", "ssl_context_factory", "=", "default_s...
https://github.com/horazont/aioxmpp/blob/c701e6399c90a6bb9bec0349018a03bd7b644cde/aioxmpp/security_layer.py#L1292-L1497
MozillaSecurity/grizzly
1c41478e32f323189a2c322ec041c3e0902a158a
grizzly/replay/crash.py
python
modify_args
(args, crash, bucket)
return args
Arguments: args (argparse.Namespace): Result from `ReplayArgs.parse_args`. Returns: args (argparse.Namespace): Modified arguments.
[]
def modify_args(args, crash, bucket): """ Arguments: args (argparse.Namespace): Result from `ReplayArgs.parse_args`. Returns: args (argparse.Namespace): Modified arguments. """ args.original_crash_id = args.input args.input = str(crash.testcase_path()) if args.tool is Non...
[ "def", "modify_args", "(", "args", ",", "crash", ",", "bucket", ")", ":", "args", ".", "original_crash_id", "=", "args", ".", "input", "args", ".", "input", "=", "str", "(", "crash", ".", "testcase_path", "(", ")", ")", "if", "args", ".", "tool", "is...
https://github.com/MozillaSecurity/grizzly/blob/1c41478e32f323189a2c322ec041c3e0902a158a/grizzly/replay/crash.py#L32-L53
mandarjoshi90/coref
bd04f2e19b9dcc0b8bba848a335e4af3be50741c
bert/modeling.py
python
reshape_to_matrix
(input_tensor)
return output_tensor
Reshapes a >= rank 2 tensor to a rank 2 tensor (i.e., a matrix).
Reshapes a >= rank 2 tensor to a rank 2 tensor (i.e., a matrix).
[ "Reshapes", "a", ">", "=", "rank", "2", "tensor", "to", "a", "rank", "2", "tensor", "(", "i", ".", "e", ".", "a", "matrix", ")", "." ]
def reshape_to_matrix(input_tensor): """Reshapes a >= rank 2 tensor to a rank 2 tensor (i.e., a matrix).""" ndims = input_tensor.shape.ndims if ndims < 2: raise ValueError("Input tensor must have at least rank 2. Shape = %s" % (input_tensor.shape)) if ndims == 2: return input_tensor...
[ "def", "reshape_to_matrix", "(", "input_tensor", ")", ":", "ndims", "=", "input_tensor", ".", "shape", ".", "ndims", "if", "ndims", "<", "2", ":", "raise", "ValueError", "(", "\"Input tensor must have at least rank 2. Shape = %s\"", "%", "(", "input_tensor", ".", ...
https://github.com/mandarjoshi90/coref/blob/bd04f2e19b9dcc0b8bba848a335e4af3be50741c/bert/modeling.py#L937-L948
replit-archive/empythoned
977ec10ced29a3541a4973dc2b59910805695752
dist/lib/python2.7/imaplib.py
python
Time2Internaldate
(date_time)
return '"' + dt + " %+03d%02d" % divmod(zone//60, 60) + '"'
Convert date_time to IMAP4 INTERNALDATE representation. Return string in form: '"DD-Mmm-YYYY HH:MM:SS +HHMM"'. The date_time argument can be a number (int or float) representing seconds since epoch (as returned by time.time()), a 9-tuple representing local time (as returned by time.localtime()), or a ...
Convert date_time to IMAP4 INTERNALDATE representation.
[ "Convert", "date_time", "to", "IMAP4", "INTERNALDATE", "representation", "." ]
def Time2Internaldate(date_time): """Convert date_time to IMAP4 INTERNALDATE representation. Return string in form: '"DD-Mmm-YYYY HH:MM:SS +HHMM"'. The date_time argument can be a number (int or float) representing seconds since epoch (as returned by time.time()), a 9-tuple representing local tim...
[ "def", "Time2Internaldate", "(", "date_time", ")", ":", "if", "isinstance", "(", "date_time", ",", "(", "int", ",", "float", ")", ")", ":", "tt", "=", "time", ".", "localtime", "(", "date_time", ")", "elif", "isinstance", "(", "date_time", ",", "(", "t...
https://github.com/replit-archive/empythoned/blob/977ec10ced29a3541a4973dc2b59910805695752/dist/lib/python2.7/imaplib.py#L1382-L1410
tdamdouni/Pythonista
3e082d53b6b9b501a3c8cf3251a8ad4c8be9c2ad
stash/autopep8.py
python
standard_deviation
(numbers)
return (sum((n - mean) ** 2 for n in numbers) / len(numbers)) ** .5
Return standard devation.
Return standard devation.
[ "Return", "standard", "devation", "." ]
def standard_deviation(numbers): """Return standard devation.""" numbers = list(numbers) if not numbers: return 0 mean = sum(numbers) / len(numbers) return (sum((n - mean) ** 2 for n in numbers) / len(numbers)) ** .5
[ "def", "standard_deviation", "(", "numbers", ")", ":", "numbers", "=", "list", "(", "numbers", ")", "if", "not", "numbers", ":", "return", "0", "mean", "=", "sum", "(", "numbers", ")", "/", "len", "(", "numbers", ")", "return", "(", "sum", "(", "(", ...
https://github.com/tdamdouni/Pythonista/blob/3e082d53b6b9b501a3c8cf3251a8ad4c8be9c2ad/stash/autopep8.py#L3445-L3452
google/grr
8ad8a4d2c5a93c92729206b7771af19d92d4f915
grr/server/grr_response_server/gui/api_call_router_with_approval_checks.py
python
ApiCallRouterWithApprovalChecks.GetFleetspeakPendingMessageCount
( self, args: api_client.ApiGetFleetspeakPendingMessageCountArgs, context: Optional[api_call_context.ApiCallContext] = None )
return self.delegate.GetFleetspeakPendingMessageCount(args, context=context)
[]
def GetFleetspeakPendingMessageCount( self, args: api_client.ApiGetFleetspeakPendingMessageCountArgs, context: Optional[api_call_context.ApiCallContext] = None ) -> api_client.ApiGetFleetspeakPendingMessageCountHandler: self.access_checker.CheckClientAccess(context, args.client_id) return se...
[ "def", "GetFleetspeakPendingMessageCount", "(", "self", ",", "args", ":", "api_client", ".", "ApiGetFleetspeakPendingMessageCountArgs", ",", "context", ":", "Optional", "[", "api_call_context", ".", "ApiCallContext", "]", "=", "None", ")", "->", "api_client", ".", "...
https://github.com/google/grr/blob/8ad8a4d2c5a93c92729206b7771af19d92d4f915/grr/server/grr_response_server/gui/api_call_router_with_approval_checks.py#L253-L259
awslabs/deeplearning-benchmark
3e9a906422b402869537f91056ae771b66487a8e
word_language_model/lstm_bucketing.py
python
tokenize_text
(fname, vocab=None, invalid_label=-1, start_label=0)
return sentences, vocab
[]
def tokenize_text(fname, vocab=None, invalid_label=-1, start_label=0): try: assert os.path.exists(fname) except AssertionError: subprocess.call(['{}/get_ptb_data.sh'.format(os.path.dirname(__file__))]) assert os.path.exists(fname) lines = open(fname).readlines() lines = [filter(N...
[ "def", "tokenize_text", "(", "fname", ",", "vocab", "=", "None", ",", "invalid_label", "=", "-", "1", ",", "start_label", "=", "0", ")", ":", "try", ":", "assert", "os", ".", "path", ".", "exists", "(", "fname", ")", "except", "AssertionError", ":", ...
https://github.com/awslabs/deeplearning-benchmark/blob/3e9a906422b402869537f91056ae771b66487a8e/word_language_model/lstm_bucketing.py#L51-L61
scipy/scipy
e0a749f01e79046642ccfdc419edbf9e7ca141ad
scipy/_lib/_uarray/_backend.py
python
generate_multimethod
( argument_extractor: ArgumentExtractorType, argument_replacer: ArgumentReplacerType, domain: str, default: typing.Optional[typing.Callable] = None, )
return functools.update_wrapper(ua_func, argument_extractor)
Generates a multimethod. Parameters ---------- argument_extractor : ArgumentExtractorType A callable which extracts the dispatchable arguments. Extracted arguments should be marked by the :obj:`Dispatchable` class. It has the same signature as the desired multimethod. argument_r...
Generates a multimethod.
[ "Generates", "a", "multimethod", "." ]
def generate_multimethod( argument_extractor: ArgumentExtractorType, argument_replacer: ArgumentReplacerType, domain: str, default: typing.Optional[typing.Callable] = None, ): """ Generates a multimethod. Parameters ---------- argument_extractor : ArgumentExtractorType A cal...
[ "def", "generate_multimethod", "(", "argument_extractor", ":", "ArgumentExtractorType", ",", "argument_replacer", ":", "ArgumentReplacerType", ",", "domain", ":", "str", ",", "default", ":", "typing", ".", "Optional", "[", "typing", ".", "Callable", "]", "=", "Non...
https://github.com/scipy/scipy/blob/e0a749f01e79046642ccfdc419edbf9e7ca141ad/scipy/_lib/_uarray/_backend.py#L169-L241
akfamily/akshare
590e50eece9ec067da3538c7059fd660b71f1339
akshare/futures/cons.py
python
get_json_path
(name, module_file)
return module_json_path
获取 JSON 配置文件的路径(从模块所在目录查找) :param name: 文件名 :param module_file: filename :return: str json_file_path
获取 JSON 配置文件的路径(从模块所在目录查找) :param name: 文件名 :param module_file: filename :return: str json_file_path
[ "获取", "JSON", "配置文件的路径", "(", "从模块所在目录查找", ")", ":", "param", "name", ":", "文件名", ":", "param", "module_file", ":", "filename", ":", "return", ":", "str", "json_file_path" ]
def get_json_path(name, module_file): """ 获取 JSON 配置文件的路径(从模块所在目录查找) :param name: 文件名 :param module_file: filename :return: str json_file_path """ module_folder = os.path.abspath(os.path.dirname(os.path.dirname(module_file))) module_json_path = os.path.join(module_folder, "file_fold", na...
[ "def", "get_json_path", "(", "name", ",", "module_file", ")", ":", "module_folder", "=", "os", ".", "path", ".", "abspath", "(", "os", ".", "path", ".", "dirname", "(", "os", ".", "path", ".", "dirname", "(", "module_file", ")", ")", ")", "module_json_...
https://github.com/akfamily/akshare/blob/590e50eece9ec067da3538c7059fd660b71f1339/akshare/futures/cons.py#L436-L445
YichenGong/Densely-Interactive-Inference-Network
cb2c23bc1aca7cafb523104b0db07df2332a877a
python/my/tensorflow/rnn_cell.py
python
TreeRNNCell.__call__
(self, inputs, state, scope=None)
:param inputs: [N*B, I + B] :param state: [N*B, d] :param scope: :return: [N*B, d]
:param inputs: [N*B, I + B] :param state: [N*B, d] :param scope: :return: [N*B, d]
[ ":", "param", "inputs", ":", "[", "N", "*", "B", "I", "+", "B", "]", ":", "param", "state", ":", "[", "N", "*", "B", "d", "]", ":", "param", "scope", ":", ":", "return", ":", "[", "N", "*", "B", "d", "]" ]
def __call__(self, inputs, state, scope=None): """ :param inputs: [N*B, I + B] :param state: [N*B, d] :param scope: :return: [N*B, d] """ with tf.variable_scope(scope or self.__class__.__name__): d = self.state_size x = tf.slice(inputs, [0,...
[ "def", "__call__", "(", "self", ",", "inputs", ",", "state", ",", "scope", "=", "None", ")", ":", "with", "tf", ".", "variable_scope", "(", "scope", "or", "self", ".", "__class__", ".", "__name__", ")", ":", "d", "=", "self", ".", "state_size", "x", ...
https://github.com/YichenGong/Densely-Interactive-Inference-Network/blob/cb2c23bc1aca7cafb523104b0db07df2332a877a/python/my/tensorflow/rnn_cell.py#L34-L51
numenta/nupic
b9ebedaf54f49a33de22d8d44dff7c765cdb5548
external/linux32/lib/python2.6/site-packages/matplotlib/axes.py
python
Axes.__pick
(self, x, y, trans=None, among=None)
return ds[0][1]
Return the artist under point that is closest to the *x*, *y*. If *trans* is *None*, *x*, and *y* are in window coords, (0,0 = lower left). Otherwise, *trans* is a :class:`~matplotlib.transforms.Transform` that specifies the coordinate system of *x*, *y*. The selection of artis...
Return the artist under point that is closest to the *x*, *y*. If *trans* is *None*, *x*, and *y* are in window coords, (0,0 = lower left). Otherwise, *trans* is a :class:`~matplotlib.transforms.Transform` that specifies the coordinate system of *x*, *y*.
[ "Return", "the", "artist", "under", "point", "that", "is", "closest", "to", "the", "*", "x", "*", "*", "y", "*", ".", "If", "*", "trans", "*", "is", "*", "None", "*", "*", "x", "*", "and", "*", "y", "*", "are", "in", "window", "coords", "(", ...
def __pick(self, x, y, trans=None, among=None): """ Return the artist under point that is closest to the *x*, *y*. If *trans* is *None*, *x*, and *y* are in window coords, (0,0 = lower left). Otherwise, *trans* is a :class:`~matplotlib.transforms.Transform` that specifies the ...
[ "def", "__pick", "(", "self", ",", "x", ",", "y", ",", "trans", "=", "None", ",", "among", "=", "None", ")", ":", "# MGDTODO: Needs updating", "if", "trans", "is", "not", "None", ":", "xywin", "=", "trans", ".", "transform_point", "(", "(", "x", ",",...
https://github.com/numenta/nupic/blob/b9ebedaf54f49a33de22d8d44dff7c765cdb5548/external/linux32/lib/python2.6/site-packages/matplotlib/axes.py#L2487-L2552
deluge-torrent/deluge
2316088f5c0dd6cb044d9d4832fa7d56dcc79cdc
deluge/maketorrent.py
python
TorrentMetadata.set_pad_files
(self, pad)
Enable padding files for the torrent. Args: private (bool): True adds padding files to align files on piece boundaries.
Enable padding files for the torrent.
[ "Enable", "padding", "files", "for", "the", "torrent", "." ]
def set_pad_files(self, pad): """Enable padding files for the torrent. Args: private (bool): True adds padding files to align files on piece boundaries. """ self.__pad_files = pad
[ "def", "set_pad_files", "(", "self", ",", "pad", ")", ":", "self", ".", "__pad_files", "=", "pad" ]
https://github.com/deluge-torrent/deluge/blob/2316088f5c0dd6cb044d9d4832fa7d56dcc79cdc/deluge/maketorrent.py#L361-L368
shunyaoshih/TPA-LSTM
598cfc90f778856084f0ca80b463894e7ea26481
lib/data_generator.py
python
DataGenerator._float_list_feature
(self, value)
return tf.train.Feature(float_list=tf.train.FloatList(value=value))
[]
def _float_list_feature(self, value): return tf.train.Feature(float_list=tf.train.FloatList(value=value))
[ "def", "_float_list_feature", "(", "self", ",", "value", ")", ":", "return", "tf", ".", "train", ".", "Feature", "(", "float_list", "=", "tf", ".", "train", ".", "FloatList", "(", "value", "=", "value", ")", ")" ]
https://github.com/shunyaoshih/TPA-LSTM/blob/598cfc90f778856084f0ca80b463894e7ea26481/lib/data_generator.py#L89-L90
IntelPython/sdc
1ebf55c00ef38dfbd401a70b3945e352a5a38b87
sdc/utilities/utils.py
python
gen_getitem
(out_var, in_var, ind, calltypes, nodes)
[]
def gen_getitem(out_var, in_var, ind, calltypes, nodes): loc = out_var.loc getitem = ir.Expr.static_getitem(in_var, ind, None, loc) calltypes[getitem] = None nodes.append(ir.Assign(getitem, out_var, loc))
[ "def", "gen_getitem", "(", "out_var", ",", "in_var", ",", "ind", ",", "calltypes", ",", "nodes", ")", ":", "loc", "=", "out_var", ".", "loc", "getitem", "=", "ir", ".", "Expr", ".", "static_getitem", "(", "in_var", ",", "ind", ",", "None", ",", "loc"...
https://github.com/IntelPython/sdc/blob/1ebf55c00ef38dfbd401a70b3945e352a5a38b87/sdc/utilities/utils.py#L525-L529
dowjones/hammer
674028a067cad91ce1a84577d30afe7b895f2a6a
hammer/reporting-remediation/reporting/create_s3bucket_acl_issue_tickets.py
python
CreateS3BucketsTickets.create_tickets_s3buckets
(self)
Class method to create jira tickets
Class method to create jira tickets
[ "Class", "method", "to", "create", "jira", "tickets" ]
def create_tickets_s3buckets(self): """ Class method to create jira tickets """ table_name = self.config.s3acl.ddb_table_name main_account = Account(region=self.config.aws.region) ddb_table = main_account.resource("dynamodb").Table(table_name) jira = JiraReporting(self.config) ...
[ "def", "create_tickets_s3buckets", "(", "self", ")", ":", "table_name", "=", "self", ".", "config", ".", "s3acl", ".", "ddb_table_name", "main_account", "=", "Account", "(", "region", "=", "self", ".", "config", ".", "aws", ".", "region", ")", "ddb_table", ...
https://github.com/dowjones/hammer/blob/674028a067cad91ce1a84577d30afe7b895f2a6a/hammer/reporting-remediation/reporting/create_s3bucket_acl_issue_tickets.py#L30-L167
mdiazcl/fuzzbunch-debian
2b76c2249ade83a389ae3badb12a1bd09901fd2c
windows/Resources/Python/Core/Lib/email/feedparser.py
python
FeedParser.__init__
(self, _factory=message.Message)
return
_factory is called with no arguments to create a new message obj
_factory is called with no arguments to create a new message obj
[ "_factory", "is", "called", "with", "no", "arguments", "to", "create", "a", "new", "message", "obj" ]
def __init__(self, _factory=message.Message): """_factory is called with no arguments to create a new message obj""" self._factory = _factory self._input = BufferedSubFile() self._msgstack = [] self._parse = self._parsegen().next self._cur = None self._last = None...
[ "def", "__init__", "(", "self", ",", "_factory", "=", "message", ".", "Message", ")", ":", "self", ".", "_factory", "=", "_factory", "self", ".", "_input", "=", "BufferedSubFile", "(", ")", "self", ".", "_msgstack", "=", "[", "]", "self", ".", "_parse"...
https://github.com/mdiazcl/fuzzbunch-debian/blob/2b76c2249ade83a389ae3badb12a1bd09901fd2c/windows/Resources/Python/Core/Lib/email/feedparser.py#L110-L119
suavecode/SUAVE
4f83c467c5662b6cc611ce2ab6c0bdd25fd5c0a5
trunk/SUAVE/Plots/Performance/Mission_Plots.py
python
plot_battery_pack_conditions
(results, line_color = 'bo-', line_color2 = 'rs--', save_figure = False, save_filename = "Battery_Pack_Conditions", file_type = ".png")
return
This plots the battery pack conditions of the network Assumptions: None Source: None Inputs: results.segments.conditions.propulsion battery_power_draw battery_energy battery_voltage_under_load battery_voltage_open_circuit current ...
This plots the battery pack conditions of the network
[ "This", "plots", "the", "battery", "pack", "conditions", "of", "the", "network" ]
def plot_battery_pack_conditions(results, line_color = 'bo-', line_color2 = 'rs--', save_figure = False, save_filename = "Battery_Pack_Conditions", file_type = ".png"): """This plots the battery pack conditions of the network Assumptions: None Source: None Inputs: results.segments.conditi...
[ "def", "plot_battery_pack_conditions", "(", "results", ",", "line_color", "=", "'bo-'", ",", "line_color2", "=", "'rs--'", ",", "save_figure", "=", "False", ",", "save_filename", "=", "\"Battery_Pack_Conditions\"", ",", "file_type", "=", "\".png\"", ")", ":", "axi...
https://github.com/suavecode/SUAVE/blob/4f83c467c5662b6cc611ce2ab6c0bdd25fd5c0a5/trunk/SUAVE/Plots/Performance/Mission_Plots.py#L383-L485
zhl2008/awd-platform
0416b31abea29743387b10b3914581fbe8e7da5e
web_flaskbb/lib/python2.7/site-packages/jinja2/environment.py
python
TemplateExpression.__init__
(self, template, undefined_to_none)
[]
def __init__(self, template, undefined_to_none): self._template = template self._undefined_to_none = undefined_to_none
[ "def", "__init__", "(", "self", ",", "template", ",", "undefined_to_none", ")", ":", "self", ".", "_template", "=", "template", "self", ".", "_undefined_to_none", "=", "undefined_to_none" ]
https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_flaskbb/lib/python2.7/site-packages/jinja2/environment.py#L1177-L1179
tobegit3hub/deep_image_model
8a53edecd9e00678b278bb10f6fb4bdb1e4ee25e
java_predict_client/src/main/proto/tensorflow/python/ops/rnn.py
python
_reverse_seq
(input_seq, lengths)
return results
Reverse a list of Tensors up to specified lengths. Args: input_seq: Sequence of seq_len tensors of dimension (batch_size, n_features) or nested tuples of tensors. lengths: A `Tensor` of dimension batch_size, containing lengths for each sequence in the batch. If "None" is speci...
Reverse a list of Tensors up to specified lengths.
[ "Reverse", "a", "list", "of", "Tensors", "up", "to", "specified", "lengths", "." ]
def _reverse_seq(input_seq, lengths): """Reverse a list of Tensors up to specified lengths. Args: input_seq: Sequence of seq_len tensors of dimension (batch_size, n_features) or nested tuples of tensors. lengths: A `Tensor` of dimension batch_size, containing lengths for each ...
[ "def", "_reverse_seq", "(", "input_seq", ",", "lengths", ")", ":", "if", "lengths", "is", "None", ":", "return", "list", "(", "reversed", "(", "input_seq", ")", ")", "flat_input_seq", "=", "tuple", "(", "nest", ".", "flatten", "(", "input_", ")", "for", ...
https://github.com/tobegit3hub/deep_image_model/blob/8a53edecd9e00678b278bb10f6fb4bdb1e4ee25e/java_predict_client/src/main/proto/tensorflow/python/ops/rnn.py#L435-L478
IronLanguages/ironpython3
7a7bb2a872eeab0d1009fc8a6e24dca43f65b693
Src/StdLib/Lib/encodings/charmap.py
python
StreamWriter.__init__
(self,stream,errors='strict',mapping=None)
[]
def __init__(self,stream,errors='strict',mapping=None): codecs.StreamWriter.__init__(self,stream,errors) self.mapping = mapping
[ "def", "__init__", "(", "self", ",", "stream", ",", "errors", "=", "'strict'", ",", "mapping", "=", "None", ")", ":", "codecs", ".", "StreamWriter", ".", "__init__", "(", "self", ",", "stream", ",", "errors", ")", "self", ".", "mapping", "=", "mapping"...
https://github.com/IronLanguages/ironpython3/blob/7a7bb2a872eeab0d1009fc8a6e24dca43f65b693/Src/StdLib/Lib/encodings/charmap.py#L42-L44
GMvandeVen/continual-learning
a02db26d3b10754abdc4a549bdcde6af488c94e0
callbacks.py
python
_sample_cb
(log, config, visdom=None, test_datasets=None, sample_size=64, iters_per_task=None)
return sample_cb if (visdom is not None) else None
Initiates function for evaluating samples of generative model. [test_datasets] None or <list> of <Datasets> (if provided, also reconstructions are shown)
Initiates function for evaluating samples of generative model.
[ "Initiates", "function", "for", "evaluating", "samples", "of", "generative", "model", "." ]
def _sample_cb(log, config, visdom=None, test_datasets=None, sample_size=64, iters_per_task=None): '''Initiates function for evaluating samples of generative model. [test_datasets] None or <list> of <Datasets> (if provided, also reconstructions are shown)''' def sample_cb(generator, batch, task=1): ...
[ "def", "_sample_cb", "(", "log", ",", "config", ",", "visdom", "=", "None", ",", "test_datasets", "=", "None", ",", "sample_size", "=", "64", ",", "iters_per_task", "=", "None", ")", ":", "def", "sample_cb", "(", "generator", ",", "batch", ",", "task", ...
https://github.com/GMvandeVen/continual-learning/blob/a02db26d3b10754abdc4a549bdcde6af488c94e0/callbacks.py#L9-L32
sagemath/sage
f9b2db94f675ff16963ccdefba4f1a3393b3fe0d
src/sage/combinat/root_system/type_relabel.py
python
CartanType.ascii_art
(self, label=lambda i: i, node=None)
return self._type.ascii_art(lambda i: label(self._relabelling[i]), node)
Return an ascii art representation of this Cartan type. EXAMPLES:: sage: print(CartanType(["G", 2]).relabel({1:2,2:1}).ascii_art()) 3 O=<=O 2 1 sage: print(CartanType(["B", 3, 1]).relabel([1,3,2,0]).ascii_art()) O 1 ...
Return an ascii art representation of this Cartan type.
[ "Return", "an", "ascii", "art", "representation", "of", "this", "Cartan", "type", "." ]
def ascii_art(self, label=lambda i: i, node=None): """ Return an ascii art representation of this Cartan type. EXAMPLES:: sage: print(CartanType(["G", 2]).relabel({1:2,2:1}).ascii_art()) 3 O=<=O 2 1 sage: print(CartanType(["B", 3,...
[ "def", "ascii_art", "(", "self", ",", "label", "=", "lambda", "i", ":", "i", ",", "node", "=", "None", ")", ":", "if", "node", "is", "None", ":", "node", "=", "self", ".", "_ascii_art_node", "return", "self", ".", "_type", ".", "ascii_art", "(", "l...
https://github.com/sagemath/sage/blob/f9b2db94f675ff16963ccdefba4f1a3393b3fe0d/src/sage/combinat/root_system/type_relabel.py#L289-L311
hyperledger/aries-cloudagent-python
2f36776e99f6053ae92eed8123b5b1b2e891c02a
aries_cloudagent/utils/classloader.py
python
ClassLoader.load_subclass_of
(cls, base_class: Type, mod_path: str, package: str = None)
return imported_class
Resolve an implementation of a base path within a module. Args: base_class: the base class being implemented mod_path: the absolute module path package: the parent package to search for the module Returns: The resolved class Raises: ...
Resolve an implementation of a base path within a module.
[ "Resolve", "an", "implementation", "of", "a", "base", "path", "within", "a", "module", "." ]
def load_subclass_of(cls, base_class: Type, mod_path: str, package: str = None): """ Resolve an implementation of a base path within a module. Args: base_class: the base class being implemented mod_path: the absolute module path package: the parent package to...
[ "def", "load_subclass_of", "(", "cls", ",", "base_class", ":", "Type", ",", "mod_path", ":", "str", ",", "package", ":", "str", "=", "None", ")", ":", "mod", "=", "cls", ".", "load_module", "(", "mod_path", ",", "package", ")", "if", "not", "mod", ":...
https://github.com/hyperledger/aries-cloudagent-python/blob/2f36776e99f6053ae92eed8123b5b1b2e891c02a/aries_cloudagent/utils/classloader.py#L123-L156
zhl2008/awd-platform
0416b31abea29743387b10b3914581fbe8e7da5e
web_flaskbb/lib/python2.7/site-packages/dateutil/tz/win.py
python
tzwin.__repr__
(self)
return "tzwin(%s)" % repr(self._name)
[]
def __repr__(self): return "tzwin(%s)" % repr(self._name)
[ "def", "__repr__", "(", "self", ")", ":", "return", "\"tzwin(%s)\"", "%", "repr", "(", "self", ".", "_name", ")" ]
https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_flaskbb/lib/python2.7/site-packages/dateutil/tz/win.py#L229-L230
andabi/music-source-separation
ba9aa531ccca08437f1efe5dec1871faebf5c840
mir_eval/hierarchy.py
python
_hierarchy_bounds
(intervals_hier)
return min(boundaries), max(boundaries)
Compute the covered time range of a hierarchical segmentation. Parameters ---------- intervals_hier : list of ndarray A hierarchical segmentation, encoded as a list of arrays of segment intervals. Returns ------- t_min : float t_max : float The minimum and maximum t...
Compute the covered time range of a hierarchical segmentation.
[ "Compute", "the", "covered", "time", "range", "of", "a", "hierarchical", "segmentation", "." ]
def _hierarchy_bounds(intervals_hier): '''Compute the covered time range of a hierarchical segmentation. Parameters ---------- intervals_hier : list of ndarray A hierarchical segmentation, encoded as a list of arrays of segment intervals. Returns ------- t_min : float t...
[ "def", "_hierarchy_bounds", "(", "intervals_hier", ")", ":", "boundaries", "=", "list", "(", "itertools", ".", "chain", "(", "*", "list", "(", "itertools", ".", "chain", "(", "*", "intervals_hier", ")", ")", ")", ")", "return", "min", "(", "boundaries", ...
https://github.com/andabi/music-source-separation/blob/ba9aa531ccca08437f1efe5dec1871faebf5c840/mir_eval/hierarchy.py#L81-L98
PySimpleGUI/PySimpleGUI
6c0d1fb54f493d45e90180b322fbbe70f7a5af3c
PySimpleGUIQt/PySimpleGUIQt.py
python
Output.write
(self, m)
MUST be called write. Don't mess with. It's called by Python itself because of reroute :param m: :return:
MUST be called write. Don't mess with. It's called by Python itself because of reroute :param m: :return:
[ "MUST", "be", "called", "write", ".", "Don", "t", "mess", "with", ".", "It", "s", "called", "by", "Python", "itself", "because", "of", "reroute", ":", "param", "m", ":", ":", "return", ":" ]
def write(self, m): """ MUST be called write. Don't mess with. It's called by Python itself because of reroute :param m: :return: """ self.QT_TextBrowser.moveCursor(QtGui.QTextCursor.End) self.QT_TextBrowser.insertPlainText( str(m))
[ "def", "write", "(", "self", ",", "m", ")", ":", "self", ".", "QT_TextBrowser", ".", "moveCursor", "(", "QtGui", ".", "QTextCursor", ".", "End", ")", "self", ".", "QT_TextBrowser", ".", "insertPlainText", "(", "str", "(", "m", ")", ")" ]
https://github.com/PySimpleGUI/PySimpleGUI/blob/6c0d1fb54f493d45e90180b322fbbe70f7a5af3c/PySimpleGUIQt/PySimpleGUIQt.py#L1694-L1701
linxid/Machine_Learning_Study_Path
558e82d13237114bbb8152483977806fc0c222af
Machine Learning In Action/Chapter5-LogisticRegression/venv/Lib/_dummy_thread.py
python
LockType.__init__
(self)
[]
def __init__(self): self.locked_status = False
[ "def", "__init__", "(", "self", ")", ":", "self", ".", "locked_status", "=", "False" ]
https://github.com/linxid/Machine_Learning_Study_Path/blob/558e82d13237114bbb8152483977806fc0c222af/Machine Learning In Action/Chapter5-LogisticRegression/venv/Lib/_dummy_thread.py#L99-L100
IronLanguages/main
a949455434b1fda8c783289e897e78a9a0caabb5
External.LCA_RESTRICTED/Languages/IronPython/repackage/pip/pip/_vendor/requests/utils.py
python
default_user_agent
(name="python-requests")
return '%s/%s' % (name, __version__)
Return a string representing the default user agent.
Return a string representing the default user agent.
[ "Return", "a", "string", "representing", "the", "default", "user", "agent", "." ]
def default_user_agent(name="python-requests"): """Return a string representing the default user agent.""" return '%s/%s' % (name, __version__)
[ "def", "default_user_agent", "(", "name", "=", "\"python-requests\"", ")", ":", "return", "'%s/%s'", "%", "(", "name", ",", "__version__", ")" ]
https://github.com/IronLanguages/main/blob/a949455434b1fda8c783289e897e78a9a0caabb5/External.LCA_RESTRICTED/Languages/IronPython/repackage/pip/pip/_vendor/requests/utils.py#L580-L582
enthought/comtypes
8f3abc93c213fccdf9cae54aa88bfc1dfc17b8e9
comtypes/client/dynamic.py
python
_Dispatch.QueryInterface
(self, *args)
return self._comobj.QueryInterface(*args)
QueryInterface is forwarded to the real com object.
QueryInterface is forwarded to the real com object.
[ "QueryInterface", "is", "forwarded", "to", "the", "real", "com", "object", "." ]
def QueryInterface(self, *args): "QueryInterface is forwarded to the real com object." return self._comobj.QueryInterface(*args)
[ "def", "QueryInterface", "(", "self", ",", "*", "args", ")", ":", "return", "self", ".", "_comobj", ".", "QueryInterface", "(", "*", "args", ")" ]
https://github.com/enthought/comtypes/blob/8f3abc93c213fccdf9cae54aa88bfc1dfc17b8e9/comtypes/client/dynamic.py#L85-L87
home-assistant/core
265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1
homeassistant/components/panasonic_viera/media_player.py
python
PanasonicVieraTVEntity.device_class
(self)
return MediaPlayerDeviceClass.TV
Return the device class of the device.
Return the device class of the device.
[ "Return", "the", "device", "class", "of", "the", "device", "." ]
def device_class(self): """Return the device class of the device.""" return MediaPlayerDeviceClass.TV
[ "def", "device_class", "(", "self", ")", ":", "return", "MediaPlayerDeviceClass", ".", "TV" ]
https://github.com/home-assistant/core/blob/265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1/homeassistant/components/panasonic_viera/media_player.py#L106-L108
tebelorg/RPA-Python
9e8b2b417777a0780a0d19c9f880a9bb8ac2e976
tagui.py
python
_tagui_output
()
return tagui_output_text
function to wait for tagui output file to read and delete it
function to wait for tagui output file to read and delete it
[ "function", "to", "wait", "for", "tagui", "output", "file", "to", "read", "and", "delete", "it" ]
def _tagui_output(): """function to wait for tagui output file to read and delete it""" global _tagui_delay, _tagui_init_directory # to handle user changing current directory after init() is called init_directory_output_file = os.path.join(_tagui_init_directory, 'rpa_python.txt') # sleep to not sp...
[ "def", "_tagui_output", "(", ")", ":", "global", "_tagui_delay", ",", "_tagui_init_directory", "# to handle user changing current directory after init() is called", "init_directory_output_file", "=", "os", ".", "path", ".", "join", "(", "_tagui_init_directory", ",", "'rpa_pyt...
https://github.com/tebelorg/RPA-Python/blob/9e8b2b417777a0780a0d19c9f880a9bb8ac2e976/tagui.py#L134-L158
upyun/python-sdk
dabff535df78d5beba4c989a6b8a046977079cdc
examples/upload.py
python
rest_upload
()
rest文件上传
rest文件上传
[ "rest文件上传" ]
def rest_upload(): """ rest文件上传 """ with open(local_file, "rb") as f: # headers 可选,见rest上传参数 headers = None up.put(remote_file, f, headers=headers)
[ "def", "rest_upload", "(", ")", ":", "with", "open", "(", "local_file", ",", "\"rb\"", ")", "as", "f", ":", "# headers 可选,见rest上传参数", "headers", "=", "None", "up", ".", "put", "(", "remote_file", ",", "f", ",", "headers", "=", "headers", ")" ]
https://github.com/upyun/python-sdk/blob/dabff535df78d5beba4c989a6b8a046977079cdc/examples/upload.py#L19-L26
evennia/evennia
fa79110ba6b219932f22297838e8ac72ebc0be0e
evennia/comms/comms.py
python
DefaultChannel.at_channel_creation
(self)
Called once, when the channel is first created.
Called once, when the channel is first created.
[ "Called", "once", "when", "the", "channel", "is", "first", "created", "." ]
def at_channel_creation(self): """ Called once, when the channel is first created. """ pass
[ "def", "at_channel_creation", "(", "self", ")", ":", "pass" ]
https://github.com/evennia/evennia/blob/fa79110ba6b219932f22297838e8ac72ebc0be0e/evennia/comms/comms.py#L67-L72
edisonlz/fastor
342078a18363ac41d3c6b1ab29dbdd44fdb0b7b3
base/site-packages/debug_toolbar/views.py
python
sql_profile
(request)
Returns the output of running the SQL and getting the profiling statistics. Expected GET variables: sql: urlencoded sql with positional arguments params: JSON encoded parameter values duration: time for SQL to execute passed in from toolbar just for redisplay hash: the hash of (secr...
Returns the output of running the SQL and getting the profiling statistics.
[ "Returns", "the", "output", "of", "running", "the", "SQL", "and", "getting", "the", "profiling", "statistics", "." ]
def sql_profile(request): """ Returns the output of running the SQL and getting the profiling statistics. Expected GET variables: sql: urlencoded sql with positional arguments params: JSON encoded parameter values duration: time for SQL to execute passed in from toolbar just for red...
[ "def", "sql_profile", "(", "request", ")", ":", "from", "debug_toolbar", ".", "panels", ".", "sql", "import", "reformat_sql", "sql", "=", "request", ".", "GET", ".", "get", "(", "'sql'", ",", "''", ")", "params", "=", "request", ".", "GET", ".", "get",...
https://github.com/edisonlz/fastor/blob/342078a18363ac41d3c6b1ab29dbdd44fdb0b7b3/base/site-packages/debug_toolbar/views.py#L115-L158
mrlesmithjr/Ansible
d44f0dc0d942bdf3bf7334b307e6048f0ee16e36
roles/ansible-vsphere-management/scripts/pdns/lib/python2.7/site-packages/pip/download.py
python
get_file_content
(url, comes_from=None, session=None)
return url, content
Gets the content of a file; it may be a filename, file: URL, or http: URL. Returns (location, content). Content is unicode.
Gets the content of a file; it may be a filename, file: URL, or http: URL. Returns (location, content). Content is unicode.
[ "Gets", "the", "content", "of", "a", "file", ";", "it", "may", "be", "a", "filename", "file", ":", "URL", "or", "http", ":", "URL", ".", "Returns", "(", "location", "content", ")", ".", "Content", "is", "unicode", "." ]
def get_file_content(url, comes_from=None, session=None): """Gets the content of a file; it may be a filename, file: URL, or http: URL. Returns (location, content). Content is unicode.""" if session is None: raise TypeError( "get_file_content() missing 1 required keyword argument: 'ses...
[ "def", "get_file_content", "(", "url", ",", "comes_from", "=", "None", ",", "session", "=", "None", ")", ":", "if", "session", "is", "None", ":", "raise", "TypeError", "(", "\"get_file_content() missing 1 required keyword argument: 'session'\"", ")", "match", "=", ...
https://github.com/mrlesmithjr/Ansible/blob/d44f0dc0d942bdf3bf7334b307e6048f0ee16e36/roles/ansible-vsphere-management/scripts/pdns/lib/python2.7/site-packages/pip/download.py#L389-L427
cgat-developers/ruffus
fc8fa8dcf7b5f4b877e5bb712146e87abd26d046
ruffus/task.py
python
Pipeline.set_tail_tasks
(self, tail_tasks)
Specifies tasks at the tail of the pipeline, i.e. with only descendants/dependants
Specifies tasks at the tail of the pipeline, i.e. with only descendants/dependants
[ "Specifies", "tasks", "at", "the", "tail", "of", "the", "pipeline", "i", ".", "e", ".", "with", "only", "descendants", "/", "dependants" ]
def set_tail_tasks(self, tail_tasks): """ Specifies tasks at the tail of the pipeline, i.e. with only descendants/dependants """ self.tail_tasks = tail_tasks
[ "def", "set_tail_tasks", "(", "self", ",", "tail_tasks", ")", ":", "self", ".", "tail_tasks", "=", "tail_tasks" ]
https://github.com/cgat-developers/ruffus/blob/fc8fa8dcf7b5f4b877e5bb712146e87abd26d046/ruffus/task.py#L992-L997
fabtools/fabtools
5fdc7174c3fae5e93a16d677d0466f41dc2be175
fabtools/python.py
python
is_installed
(package, python_cmd='python', pip_cmd='pip')
return (package.lower() in packages)
Check if a Python package is installed (using pip). Package names are case insensitive. Example:: from fabtools.python import virtualenv import fabtools with virtualenv('/path/to/venv'): fabtools.python.install('Flask') assert fabtools.python.is_installed('fla...
Check if a Python package is installed (using pip).
[ "Check", "if", "a", "Python", "package", "is", "installed", "(", "using", "pip", ")", "." ]
def is_installed(package, python_cmd='python', pip_cmd='pip'): """ Check if a Python package is installed (using pip). Package names are case insensitive. Example:: from fabtools.python import virtualenv import fabtools with virtualenv('/path/to/venv'): fabtools.p...
[ "def", "is_installed", "(", "package", ",", "python_cmd", "=", "'python'", ",", "pip_cmd", "=", "'pip'", ")", ":", "with", "settings", "(", "hide", "(", "'running'", ",", "'stdout'", ",", "'stderr'", ",", "'warnings'", ")", ",", "warn_only", "=", "True", ...
https://github.com/fabtools/fabtools/blob/5fdc7174c3fae5e93a16d677d0466f41dc2be175/fabtools/python.py#L89-L110
awslabs/aws-data-wrangler
548f5197bacd91bd50ebc66a0173eff9c56f69b1
awswrangler/_config.py
python
_Config.concurrent_partitioning
(self)
return cast(bool, self["concurrent_partitioning"])
Property concurrent_partitioning.
Property concurrent_partitioning.
[ "Property", "concurrent_partitioning", "." ]
def concurrent_partitioning(self) -> bool: """Property concurrent_partitioning.""" return cast(bool, self["concurrent_partitioning"])
[ "def", "concurrent_partitioning", "(", "self", ")", "->", "bool", ":", "return", "cast", "(", "bool", ",", "self", "[", "\"concurrent_partitioning\"", "]", ")" ]
https://github.com/awslabs/aws-data-wrangler/blob/548f5197bacd91bd50ebc66a0173eff9c56f69b1/awswrangler/_config.py#L198-L200
andresriancho/w3af
cd22e5252243a87aaa6d0ddea47cf58dacfe00a9
w3af/plugins/attack/db/sqlmap/lib/core/option.py
python
_adjustLoggingFormatter
()
Solves problem of line deletition caused by overlapping logging messages and retrieved data info in inference mode
Solves problem of line deletition caused by overlapping logging messages and retrieved data info in inference mode
[ "Solves", "problem", "of", "line", "deletition", "caused", "by", "overlapping", "logging", "messages", "and", "retrieved", "data", "info", "in", "inference", "mode" ]
def _adjustLoggingFormatter(): """ Solves problem of line deletition caused by overlapping logging messages and retrieved data info in inference mode """ if hasattr(FORMATTER, '_format'): return def format(record): message = FORMATTER._format(record) message = boldifyMe...
[ "def", "_adjustLoggingFormatter", "(", ")", ":", "if", "hasattr", "(", "FORMATTER", ",", "'_format'", ")", ":", "return", "def", "format", "(", "record", ")", ":", "message", "=", "FORMATTER", ".", "_format", "(", "record", ")", "message", "=", "boldifyMes...
https://github.com/andresriancho/w3af/blob/cd22e5252243a87aaa6d0ddea47cf58dacfe00a9/w3af/plugins/attack/db/sqlmap/lib/core/option.py#L455-L473
llSourcell/AI_Artist
3038c06c2e389b9c919c881c9a169efe2fd7810e
lib/python2.7/site-packages/pip/_vendor/pkg_resources/__init__.py
python
_SetuptoolsVersionMixin.__getitem__
(self, key)
return tuple(self)[key]
[]
def __getitem__(self, key): return tuple(self)[key]
[ "def", "__getitem__", "(", "self", ",", "key", ")", ":", "return", "tuple", "(", "self", ")", "[", "key", "]" ]
https://github.com/llSourcell/AI_Artist/blob/3038c06c2e389b9c919c881c9a169efe2fd7810e/lib/python2.7/site-packages/pip/_vendor/pkg_resources/__init__.py#L136-L137
tensorflow/tensor2tensor
2a33b152d7835af66a6d20afe7961751047e28dd
tensor2tensor/utils/metrics.py
python
padded_sequence_accuracy
(predictions, labels, weights_fn=common_layers.weights_nonzero)
Percentage of times that predictions matches labels everywhere (non-0).
Percentage of times that predictions matches labels everywhere (non-0).
[ "Percentage", "of", "times", "that", "predictions", "matches", "labels", "everywhere", "(", "non", "-", "0", ")", "." ]
def padded_sequence_accuracy(predictions, labels, weights_fn=common_layers.weights_nonzero): """Percentage of times that predictions matches labels everywhere (non-0).""" # If the last dimension is 1 then we're using L1/L2 loss. if common_layers.shape_list...
[ "def", "padded_sequence_accuracy", "(", "predictions", ",", "labels", ",", "weights_fn", "=", "common_layers", ".", "weights_nonzero", ")", ":", "# If the last dimension is 1 then we're using L1/L2 loss.", "if", "common_layers", ".", "shape_list", "(", "predictions", ")", ...
https://github.com/tensorflow/tensor2tensor/blob/2a33b152d7835af66a6d20afe7961751047e28dd/tensor2tensor/utils/metrics.py#L212-L245