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
oracle/oci-python-sdk
3c1604e4e212008fb6718e2f68cdb5ef71fd5793
src/oci/vulnerability_scanning/vulnerability_scanning_client.py
python
VulnerabilityScanningClient.list_host_vulnerabilities
(self, compartment_id, **kwargs)
Retrieves a list of HostVulnerabilitySummary objects in a compartment. You can filter and sort the vulnerabilities by problem severity and time. A host vulnerability describes a security issue that was detected in scans of one or more compute instances. :param str compartment_id: (required) The ID...
Retrieves a list of HostVulnerabilitySummary objects in a compartment. You can filter and sort the vulnerabilities by problem severity and time. A host vulnerability describes a security issue that was detected in scans of one or more compute instances.
[ "Retrieves", "a", "list", "of", "HostVulnerabilitySummary", "objects", "in", "a", "compartment", ".", "You", "can", "filter", "and", "sort", "the", "vulnerabilities", "by", "problem", "severity", "and", "time", ".", "A", "host", "vulnerability", "describes", "a"...
def list_host_vulnerabilities(self, compartment_id, **kwargs): """ Retrieves a list of HostVulnerabilitySummary objects in a compartment. You can filter and sort the vulnerabilities by problem severity and time. A host vulnerability describes a security issue that was detected in scans of one or more co...
[ "def", "list_host_vulnerabilities", "(", "self", ",", "compartment_id", ",", "*", "*", "kwargs", ")", ":", "resource_path", "=", "\"/hostVulnerabilities\"", "method", "=", "\"GET\"", "# Don't accept unknown kwargs", "expected_kwargs", "=", "[", "\"retry_strategy\"", ","...
https://github.com/oracle/oci-python-sdk/blob/3c1604e4e212008fb6718e2f68cdb5ef71fd5793/src/oci/vulnerability_scanning/vulnerability_scanning_client.py#L4391-L4539
karanchahal/distiller
a17ec06cbeafcdd2aea19d7c7663033c951392f5
models/vision/mnasnet.py
python
MNASNet._initialize_weights
(self)
[]
def _initialize_weights(self): for m in self.modules(): if isinstance(m, nn.Conv2d): nn.init.kaiming_normal_(m.weight, mode="fan_out", nonlinearity="relu") if m.bias is not None: nn.init.zeros_(m.bias) ...
[ "def", "_initialize_weights", "(", "self", ")", ":", "for", "m", "in", "self", ".", "modules", "(", ")", ":", "if", "isinstance", "(", "m", ",", "nn", ".", "Conv2d", ")", ":", "nn", ".", "init", ".", "kaiming_normal_", "(", "m", ".", "weight", ",",...
https://github.com/karanchahal/distiller/blob/a17ec06cbeafcdd2aea19d7c7663033c951392f5/models/vision/mnasnet.py#L140-L153
rogerbinns/apsw
00a7eb5138f2f00976f0c76cb51906afecbe298f
tools/example2rst.py
python
rstout
(filename)
return op
[]
def rstout(filename): op = [] op.extend(""" .. Automatically generated by example2rst.py. Edit that file not this one! Example ======= This code demonstrates usage of the APSW api. It gives you a good overview of all the things that can be done. Also included is output so you can see what gets printed w...
[ "def", "rstout", "(", "filename", ")", ":", "op", "=", "[", "]", "op", ".", "extend", "(", "\"\"\"\n.. Automatically generated by example2rst.py. Edit that file\n not this one!\n\nExample\n=======\n\nThis code demonstrates usage of the APSW api. It gives you a good\noverview of all t...
https://github.com/rogerbinns/apsw/blob/00a7eb5138f2f00976f0c76cb51906afecbe298f/tools/example2rst.py#L50-L124
sqlalchemy/sqlalchemy
eb716884a4abcabae84a6aaba105568e925b7d27
lib/sqlalchemy/dialects/mysql/base.py
python
MySQLTypeCompiler._extend_string
(self, type_, defaults, spec)
return " ".join( [c for c in (spec, charset, collation) if c is not None] )
Extend a string-type declaration with standard SQL CHARACTER SET / COLLATE annotations and MySQL specific extensions.
Extend a string-type declaration with standard SQL CHARACTER SET / COLLATE annotations and MySQL specific extensions.
[ "Extend", "a", "string", "-", "type", "declaration", "with", "standard", "SQL", "CHARACTER", "SET", "/", "COLLATE", "annotations", "and", "MySQL", "specific", "extensions", "." ]
def _extend_string(self, type_, defaults, spec): """Extend a string-type declaration with standard SQL CHARACTER SET / COLLATE annotations and MySQL specific extensions. """ def attr(name): return getattr(type_, name, defaults.get(name)) if attr("charset"): ...
[ "def", "_extend_string", "(", "self", ",", "type_", ",", "defaults", ",", "spec", ")", ":", "def", "attr", "(", "name", ")", ":", "return", "getattr", "(", "type_", ",", "name", ",", "defaults", ".", "get", "(", "name", ")", ")", "if", "attr", "(",...
https://github.com/sqlalchemy/sqlalchemy/blob/eb716884a4abcabae84a6aaba105568e925b7d27/lib/sqlalchemy/dialects/mysql/base.py#L1998-L2030
micropython/micropython-lib
cdd260f0792d04a1ded99171b4c7a2582b7856b4
python-stdlib/base64/base64.py
python
b64encode
(s, altchars=None)
return encoded
Encode a byte string using Base64. s is the byte string to encode. Optional altchars must be a byte string of length 2 which specifies an alternative alphabet for the '+' and '/' characters. This allows an application to e.g. generate url or filesystem safe Base64 strings. The encoded byte strin...
Encode a byte string using Base64.
[ "Encode", "a", "byte", "string", "using", "Base64", "." ]
def b64encode(s, altchars=None): """Encode a byte string using Base64. s is the byte string to encode. Optional altchars must be a byte string of length 2 which specifies an alternative alphabet for the '+' and '/' characters. This allows an application to e.g. generate url or filesystem safe Bas...
[ "def", "b64encode", "(", "s", ",", "altchars", "=", "None", ")", ":", "if", "not", "isinstance", "(", "s", ",", "bytes_types", ")", ":", "raise", "TypeError", "(", "\"expected bytes, not %s\"", "%", "s", ".", "__class__", ".", "__name__", ")", "# Strip off...
https://github.com/micropython/micropython-lib/blob/cdd260f0792d04a1ded99171b4c7a2582b7856b4/python-stdlib/base64/base64.py#L58-L77
allenai/allennlp
a3d71254fcc0f3615910e9c3d48874515edf53e0
allennlp/data/fields/tensor_field.py
python
TensorField.as_tensor
(self, padding_lengths: Dict[str, int])
return torch.nn.functional.pad(tensor, pad, value=self.padding_value)
[]
def as_tensor(self, padding_lengths: Dict[str, int]) -> torch.Tensor: tensor = self.tensor while len(tensor.size()) < len(padding_lengths): tensor = tensor.unsqueeze(-1) pad = [ padding for i, dimension_size in reversed(list(enumerate(tensor.size()))) ...
[ "def", "as_tensor", "(", "self", ",", "padding_lengths", ":", "Dict", "[", "str", ",", "int", "]", ")", "->", "torch", ".", "Tensor", ":", "tensor", "=", "self", ".", "tensor", "while", "len", "(", "tensor", ".", "size", "(", ")", ")", "<", "len", ...
https://github.com/allenai/allennlp/blob/a3d71254fcc0f3615910e9c3d48874515edf53e0/allennlp/data/fields/tensor_field.py#L42-L51
WenlongZhang0517/RankSRGAN
b313c24a25c9844d1d0c7ea8fd1e35da00ad8975
codes/data/util.py
python
_get_paths_from_lmdb
(dataroot)
return paths, sizes
get image path list from lmdb meta info
get image path list from lmdb meta info
[ "get", "image", "path", "list", "from", "lmdb", "meta", "info" ]
def _get_paths_from_lmdb(dataroot): """get image path list from lmdb meta info""" meta_info = pickle.load(open(os.path.join(dataroot, 'meta_info.pkl'), 'rb')) paths = meta_info['keys'] sizes = meta_info['resolution'] if len(sizes) == 1: sizes = sizes * len(paths) return paths, sizes
[ "def", "_get_paths_from_lmdb", "(", "dataroot", ")", ":", "meta_info", "=", "pickle", ".", "load", "(", "open", "(", "os", ".", "path", ".", "join", "(", "dataroot", ",", "'meta_info.pkl'", ")", ",", "'rb'", ")", ")", "paths", "=", "meta_info", "[", "'...
https://github.com/WenlongZhang0517/RankSRGAN/blob/b313c24a25c9844d1d0c7ea8fd1e35da00ad8975/codes/data/util.py#L35-L42
espeed/bulbs
628e5b14f0249f9ca4fa1ceea6f2af2dca45f75a
bulbs/model.py
python
Relationship.get_index_name
(cls, config)
return cls.get_label(config)
Returns the index name. :param config: Config object. :type config: bulbs.config.Config :rtype: str
Returns the index name.
[ "Returns", "the", "index", "name", "." ]
def get_index_name(cls, config): """ Returns the index name. :param config: Config object. :type config: bulbs.config.Config :rtype: str """ return cls.get_label(config)
[ "def", "get_index_name", "(", "cls", ",", "config", ")", ":", "return", "cls", ".", "get_label", "(", "config", ")" ]
https://github.com/espeed/bulbs/blob/628e5b14f0249f9ca4fa1ceea6f2af2dca45f75a/bulbs/model.py#L704-L714
mchristopher/PokemonGo-DesktopMap
ec37575f2776ee7d64456e2a1f6b6b78830b4fe0
app/pylibs/win32/gevent/hub.py
python
Hub.join
(self, timeout=None)
return False
Wait for the event loop to finish. Exits only when there are no more spawned greenlets, started servers, active timeouts or watchers. If *timeout* is provided, wait no longer for the specified number of seconds. Returns True if exited because the loop finished execution. Returns False ...
Wait for the event loop to finish. Exits only when there are no more spawned greenlets, started servers, active timeouts or watchers.
[ "Wait", "for", "the", "event", "loop", "to", "finish", ".", "Exits", "only", "when", "there", "are", "no", "more", "spawned", "greenlets", "started", "servers", "active", "timeouts", "or", "watchers", "." ]
def join(self, timeout=None): """Wait for the event loop to finish. Exits only when there are no more spawned greenlets, started servers, active timeouts or watchers. If *timeout* is provided, wait no longer for the specified number of seconds. Returns True if exited because the loop f...
[ "def", "join", "(", "self", ",", "timeout", "=", "None", ")", ":", "assert", "getcurrent", "(", ")", "is", "self", ".", "parent", ",", "\"only possible from the MAIN greenlet\"", "if", "self", ".", "dead", ":", "return", "True", "waiter", "=", "Waiter", "(...
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/ec37575f2776ee7d64456e2a1f6b6b78830b4fe0/app/pylibs/win32/gevent/hub.py#L676-L703
NVlabs/condensa
ff2fd0f9d997ce36b574f4c9bed2bb7cffba835d
condensa/dtypes.py
python
DType.name
(self)
return _DTYPE_TO_STRING[self._dtype]
[]
def name(self): return _DTYPE_TO_STRING[self._dtype]
[ "def", "name", "(", "self", ")", ":", "return", "_DTYPE_TO_STRING", "[", "self", ".", "_dtype", "]" ]
https://github.com/NVlabs/condensa/blob/ff2fd0f9d997ce36b574f4c9bed2bb7cffba835d/condensa/dtypes.py#L25-L26
microsoft/azure-devops-python-api
451cade4c475482792cbe9e522c1fee32393139e
azure-devops/azure/devops/v5_1/git/git_client_base.py
python
GitClientBase.get_blobs_zip
(self, blob_ids, repository_id, project=None, filename=None, **kwargs)
return self._client.stream_download(response, callback=callback)
GetBlobsZip. Gets one or more blobs in a zip file download. :param [str] blob_ids: Blob IDs (SHA1 hashes) to be returned in the zip file. :param str repository_id: The name or ID of the repository. :param str project: Project ID or project name :param str filename: :rtype...
GetBlobsZip. Gets one or more blobs in a zip file download. :param [str] blob_ids: Blob IDs (SHA1 hashes) to be returned in the zip file. :param str repository_id: The name or ID of the repository. :param str project: Project ID or project name :param str filename: :rtype...
[ "GetBlobsZip", ".", "Gets", "one", "or", "more", "blobs", "in", "a", "zip", "file", "download", ".", ":", "param", "[", "str", "]", "blob_ids", ":", "Blob", "IDs", "(", "SHA1", "hashes", ")", "to", "be", "returned", "in", "the", "zip", "file", ".", ...
def get_blobs_zip(self, blob_ids, repository_id, project=None, filename=None, **kwargs): """GetBlobsZip. Gets one or more blobs in a zip file download. :param [str] blob_ids: Blob IDs (SHA1 hashes) to be returned in the zip file. :param str repository_id: The name or ID of the repository...
[ "def", "get_blobs_zip", "(", "self", ",", "blob_ids", ",", "repository_id", ",", "project", "=", "None", ",", "filename", "=", "None", ",", "*", "*", "kwargs", ")", ":", "route_values", "=", "{", "}", "if", "project", "is", "not", "None", ":", "route_v...
https://github.com/microsoft/azure-devops-python-api/blob/451cade4c475482792cbe9e522c1fee32393139e/azure-devops/azure/devops/v5_1/git/git_client_base.py#L139-L168
selfteaching/selfteaching-python-camp
9982ee964b984595e7d664b07c389cddaf158f1e
19100205/Ceasar1978/pip-19.0.3/src/pip/_vendor/webencodings/__init__.py
python
_get_encoding
(encoding_or_label)
return encoding
Accept either an encoding object or label. :param encoding: An :class:`Encoding` object or a label string. :returns: An :class:`Encoding` object. :raises: :exc:`~exceptions.LookupError` for an unknown label.
Accept either an encoding object or label.
[ "Accept", "either", "an", "encoding", "object", "or", "label", "." ]
def _get_encoding(encoding_or_label): """ Accept either an encoding object or label. :param encoding: An :class:`Encoding` object or a label string. :returns: An :class:`Encoding` object. :raises: :exc:`~exceptions.LookupError` for an unknown label. """ if hasattr(encoding_or_label, 'codec...
[ "def", "_get_encoding", "(", "encoding_or_label", ")", ":", "if", "hasattr", "(", "encoding_or_label", ",", "'codec_info'", ")", ":", "return", "encoding_or_label", "encoding", "=", "lookup", "(", "encoding_or_label", ")", "if", "encoding", "is", "None", ":", "r...
https://github.com/selfteaching/selfteaching-python-camp/blob/9982ee964b984595e7d664b07c389cddaf158f1e/19100205/Ceasar1978/pip-19.0.3/src/pip/_vendor/webencodings/__init__.py#L91-L106
pandas-dev/pandas
5ba7d714014ae8feaccc0dd4a98890828cf2832d
pandas/core/frame.py
python
DataFrame.corrwith
(self, other, axis: Axis = 0, drop=False, method="pearson")
return correl
Compute pairwise correlation. Pairwise correlation is computed between rows or columns of DataFrame with rows or columns of Series or DataFrame. DataFrames are first aligned along both axes before computing the correlations. Parameters ---------- other : DataFra...
Compute pairwise correlation.
[ "Compute", "pairwise", "correlation", "." ]
def corrwith(self, other, axis: Axis = 0, drop=False, method="pearson") -> Series: """ Compute pairwise correlation. Pairwise correlation is computed between rows or columns of DataFrame with rows or columns of Series or DataFrame. DataFrames are first aligned along both axes be...
[ "def", "corrwith", "(", "self", ",", "other", ",", "axis", ":", "Axis", "=", "0", ",", "drop", "=", "False", ",", "method", "=", "\"pearson\"", ")", "->", "Series", ":", "axis", "=", "self", ".", "_get_axis_number", "(", "axis", ")", "this", "=", "...
https://github.com/pandas-dev/pandas/blob/5ba7d714014ae8feaccc0dd4a98890828cf2832d/pandas/core/frame.py#L9670-L9761
yumaojun03/blog-python-app
92ecad4c693090d67351d022e47b2d5be901d25d
www/transwarp/web.py
python
_RedirectError.__init__
(self, code, location)
Init an HttpError with response code.
Init an HttpError with response code.
[ "Init", "an", "HttpError", "with", "response", "code", "." ]
def __init__(self, code, location): """ Init an HttpError with response code. """ super(_RedirectError, self).__init__(code) self.location = location
[ "def", "__init__", "(", "self", ",", "code", ",", "location", ")", ":", "super", "(", "_RedirectError", ",", "self", ")", ".", "__init__", "(", "code", ")", "self", ".", "location", "=", "location" ]
https://github.com/yumaojun03/blog-python-app/blob/92ecad4c693090d67351d022e47b2d5be901d25d/www/transwarp/web.py#L296-L301
CLUEbenchmark/CLUE
5bd39732734afecb490cf18a5212e692dbf2c007
baselines/models_pytorch/classifier_pytorch/convert_albert_original_tf_checkpoint_to_pytorch.py
python
convert_tf_checkpoint_to_pytorch
(tf_checkpoint_path, bert_config_file, pytorch_dump_path)
[]
def convert_tf_checkpoint_to_pytorch(tf_checkpoint_path, bert_config_file, pytorch_dump_path): # Initialise PyTorch model config = BertConfig.from_json_file(bert_config_file) print("Building PyTorch model from configuration: {}".format(str(config))) model = AlbertForPreTraining(config) # Load weigh...
[ "def", "convert_tf_checkpoint_to_pytorch", "(", "tf_checkpoint_path", ",", "bert_config_file", ",", "pytorch_dump_path", ")", ":", "# Initialise PyTorch model", "config", "=", "BertConfig", ".", "from_json_file", "(", "bert_config_file", ")", "print", "(", "\"Building PyTor...
https://github.com/CLUEbenchmark/CLUE/blob/5bd39732734afecb490cf18a5212e692dbf2c007/baselines/models_pytorch/classifier_pytorch/convert_albert_original_tf_checkpoint_to_pytorch.py#L15-L26
plotly/plotly.py
cfad7862594b35965c0e000813bd7805e8494a5b
packages/python/plotly/plotly/graph_objs/scatter3d/_error_x.py
python
ErrorX.color
(self)
return self["color"]
Sets the stoke color of the error bars. The 'color' property is a color and may be specified as: - A hex string (e.g. '#ff0000') - An rgb/rgba string (e.g. 'rgb(255,0,0)') - An hsl/hsla string (e.g. 'hsl(0,100%,50%)') - An hsv/hsva string (e.g. 'hsv(0,100%,100%)') ...
Sets the stoke color of the error bars. The 'color' property is a color and may be specified as: - A hex string (e.g. '#ff0000') - An rgb/rgba string (e.g. 'rgb(255,0,0)') - An hsl/hsla string (e.g. 'hsl(0,100%,50%)') - An hsv/hsva string (e.g. 'hsv(0,100%,100%)') ...
[ "Sets", "the", "stoke", "color", "of", "the", "error", "bars", ".", "The", "color", "property", "is", "a", "color", "and", "may", "be", "specified", "as", ":", "-", "A", "hex", "string", "(", "e", ".", "g", ".", "#ff0000", ")", "-", "An", "rgb", ...
def color(self): """ Sets the stoke color of the error bars. The 'color' property is a color and may be specified as: - A hex string (e.g. '#ff0000') - An rgb/rgba string (e.g. 'rgb(255,0,0)') - An hsl/hsla string (e.g. 'hsl(0,100%,50%)') - An hsv/hsv...
[ "def", "color", "(", "self", ")", ":", "return", "self", "[", "\"color\"", "]" ]
https://github.com/plotly/plotly.py/blob/cfad7862594b35965c0e000813bd7805e8494a5b/packages/python/plotly/plotly/graph_objs/scatter3d/_error_x.py#L116-L166
pypa/pipenv
b21baade71a86ab3ee1429f71fbc14d4f95fb75d
pipenv/patched/notpip/_vendor/idna/uts46data.py
python
_seg_72
()
return [ (0x1F109, '3', '8,'), (0x1F10A, '3', '9,'), (0x1F10B, 'V'), (0x1F110, '3', '(a)'), (0x1F111, '3', '(b)'), (0x1F112, '3', '(c)'), (0x1F113, '3', '(d)'), (0x1F114, '3', '(e)'), (0x1F115, '3', '(f)'), (0x1F116, '3', '(g)'), (0x1F117, '3', '(h)'), (0x1F118, '3', '(i)...
[]
def _seg_72(): # type: () -> List[Union[Tuple[int, str], Tuple[int, str, str]]] return [ (0x1F109, '3', '8,'), (0x1F10A, '3', '9,'), (0x1F10B, 'V'), (0x1F110, '3', '(a)'), (0x1F111, '3', '(b)'), (0x1F112, '3', '(c)'), (0x1F113, '3', '(d)'), (0x1F114, '3', '(e)'), (0x1F115, '3...
[ "def", "_seg_72", "(", ")", ":", "# type: () -> List[Union[Tuple[int, str], Tuple[int, str, str]]]", "return", "[", "(", "0x1F109", ",", "'3'", ",", "'8,'", ")", ",", "(", "0x1F10A", ",", "'3'", ",", "'9,'", ")", ",", "(", "0x1F10B", ",", "'V'", ")", ",", ...
https://github.com/pypa/pipenv/blob/b21baade71a86ab3ee1429f71fbc14d4f95fb75d/pipenv/patched/notpip/_vendor/idna/uts46data.py#L7569-L7672
siznax/wptools
788cdc2078696dacb14652d5f2ad098a585e4763
wptools/site.py
python
WPToolsSite._set_siteinfo
(self)
capture API sitematrix data in data attribute
capture API sitematrix data in data attribute
[ "capture", "API", "sitematrix", "data", "in", "data", "attribute" ]
def _set_siteinfo(self): """ capture API sitematrix data in data attribute """ data = self._load_response('siteinfo').get('query') mostviewed = data.get('mostviewed') self.data['mostviewed'] = [] for item in mostviewed[1:]: if item['ns'] == 0: ...
[ "def", "_set_siteinfo", "(", "self", ")", ":", "data", "=", "self", ".", "_load_response", "(", "'siteinfo'", ")", ".", "get", "(", "'query'", ")", "mostviewed", "=", "data", ".", "get", "(", "'mostviewed'", ")", "self", ".", "data", "[", "'mostviewed'",...
https://github.com/siznax/wptools/blob/788cdc2078696dacb14652d5f2ad098a585e4763/wptools/site.py#L61-L96
kovidgoyal/calibre
2b41671370f2a9eb1109b9ae901ccf915f1bd0c8
src/calibre/library/schema_upgrades.py
python
SchemaUpgrade.upgrade_version_6
(self)
Show authors in order
Show authors in order
[ "Show", "authors", "in", "order" ]
def upgrade_version_6(self): 'Show authors in order' self.conn.executescript(''' BEGIN TRANSACTION; DROP VIEW meta; CREATE VIEW meta AS SELECT id, title, (SELECT sortconcat(bal.id, name) FROM books_authors_link AS bal JOIN authors ON(author = authors.id) WH...
[ "def", "upgrade_version_6", "(", "self", ")", ":", "self", ".", "conn", ".", "executescript", "(", "'''\n BEGIN TRANSACTION;\n DROP VIEW meta;\n CREATE VIEW meta AS\n SELECT id, title,\n (SELECT sortconcat(bal.id, name) FROM books_authors_link AS bal...
https://github.com/kovidgoyal/calibre/blob/2b41671370f2a9eb1109b9ae901ccf915f1bd0c8/src/calibre/library/schema_upgrades.py#L165-L191
mothran/bunny
cbdb98a0ff36b488bbc2659a46365509f0a1045b
libbunny/bunny.py
python
Bunny.__init__
(self)
Setup and build the bunny model and starts the read_packet_thread()
Setup and build the bunny model and starts the read_packet_thread()
[ "Setup", "and", "build", "the", "bunny", "model", "and", "starts", "the", "read_packet_thread", "()" ]
def __init__(self): """ Setup and build the bunny model and starts the read_packet_thread() """ self.inandout = SendRec() self.cryptor = AEScrypt() self.model = TrafficModel() # each item should be an full bunny message that can be passed to the .decrypt() method # TODO: put a upper bound of...
[ "def", "__init__", "(", "self", ")", ":", "self", ".", "inandout", "=", "SendRec", "(", ")", "self", ".", "cryptor", "=", "AEScrypt", "(", ")", "self", ".", "model", "=", "TrafficModel", "(", ")", "# each item should be an full bunny message that can be passed t...
https://github.com/mothran/bunny/blob/cbdb98a0ff36b488bbc2659a46365509f0a1045b/libbunny/bunny.py#L44-L77
osmr/imgclsmob
f2993d3ce73a2f7ddba05da3891defb08547d504
chainer_/chainercv2/models/nasnet.py
python
nasnet_4a1056
(**kwargs)
return get_nasnet( repeat=4, penultimate_filters=1056, init_block_channels=32, final_pool_size=7, extra_padding=True, skip_reduction_layer_input=False, in_size=(224, 224), model_name="nasnet_4a1056", **kwargs)
NASNet-A 4@1056 (NASNet-A-Mobile) model from 'Learning Transferable Architectures for Scalable Image Recognition,' https://arxiv.org/abs/1707.07012. Parameters: ---------- pretrained : bool, default False Whether to load the pretrained weights for model. root : str, default '~/.chainer/mode...
NASNet-A 4@1056 (NASNet-A-Mobile) model from 'Learning Transferable Architectures for Scalable Image Recognition,' https://arxiv.org/abs/1707.07012.
[ "NASNet", "-", "A", "4@1056", "(", "NASNet", "-", "A", "-", "Mobile", ")", "model", "from", "Learning", "Transferable", "Architectures", "for", "Scalable", "Image", "Recognition", "https", ":", "//", "arxiv", ".", "org", "/", "abs", "/", "1707", ".", "07...
def nasnet_4a1056(**kwargs): """ NASNet-A 4@1056 (NASNet-A-Mobile) model from 'Learning Transferable Architectures for Scalable Image Recognition,' https://arxiv.org/abs/1707.07012. Parameters: ---------- pretrained : bool, default False Whether to load the pretrained weights for model....
[ "def", "nasnet_4a1056", "(", "*", "*", "kwargs", ")", ":", "return", "get_nasnet", "(", "repeat", "=", "4", ",", "penultimate_filters", "=", "1056", ",", "init_block_channels", "=", "32", ",", "final_pool_size", "=", "7", ",", "extra_padding", "=", "True", ...
https://github.com/osmr/imgclsmob/blob/f2993d3ce73a2f7ddba05da3891defb08547d504/chainer_/chainercv2/models/nasnet.py#L1259-L1280
dulwich/dulwich
1f66817d712e3563ce1ff53b1218491a2eae39da
dulwich/config.py
python
ConfigDict.__init__
(self, values=None, encoding=None)
Create a new ConfigDict.
Create a new ConfigDict.
[ "Create", "a", "new", "ConfigDict", "." ]
def __init__(self, values=None, encoding=None): """Create a new ConfigDict.""" if encoding is None: encoding = sys.getdefaultencoding() self.encoding = encoding self._values = CaseInsensitiveDict.make(values)
[ "def", "__init__", "(", "self", ",", "values", "=", "None", ",", "encoding", "=", "None", ")", ":", "if", "encoding", "is", "None", ":", "encoding", "=", "sys", ".", "getdefaultencoding", "(", ")", "self", ".", "encoding", "=", "encoding", "self", ".",...
https://github.com/dulwich/dulwich/blob/1f66817d712e3563ce1ff53b1218491a2eae39da/dulwich/config.py#L195-L200
oanda/v20-python
f28192f4a31bce038cf6dfa302f5878bec192fe5
src/v20/transaction.py
python
CreateTransaction.__init__
(self, **kwargs)
Create a new CreateTransaction instance
Create a new CreateTransaction instance
[ "Create", "a", "new", "CreateTransaction", "instance" ]
def __init__(self, **kwargs): """ Create a new CreateTransaction instance """ super(CreateTransaction, self).__init__() # # The Transaction's Identifier. # self.id = kwargs.get("id") # # The date/time when the Transaction was created. ...
[ "def", "__init__", "(", "self", ",", "*", "*", "kwargs", ")", ":", "super", "(", "CreateTransaction", ",", "self", ")", ".", "__init__", "(", ")", "#", "# The Transaction's Identifier.", "#", "self", ".", "id", "=", "kwargs", ".", "get", "(", "\"id\"", ...
https://github.com/oanda/v20-python/blob/f28192f4a31bce038cf6dfa302f5878bec192fe5/src/v20/transaction.py#L174-L240
IronLanguages/main
a949455434b1fda8c783289e897e78a9a0caabb5
External.LCA_RESTRICTED/Languages/CPython/27/Lib/imaplib.py
python
IMAP4.logout
(self)
return typ, dat
Shutdown connection to server. (typ, [data]) = <instance>.logout() Returns server 'BYE' response.
Shutdown connection to server.
[ "Shutdown", "connection", "to", "server", "." ]
def logout(self): """Shutdown connection to server. (typ, [data]) = <instance>.logout() Returns server 'BYE' response. """ self.state = 'LOGOUT' try: typ, dat = self._simple_command('LOGOUT') except: typ, dat = 'NO', ['%s: %s' % sys.exc_info()[:2]] self....
[ "def", "logout", "(", "self", ")", ":", "self", ".", "state", "=", "'LOGOUT'", "try", ":", "typ", ",", "dat", "=", "self", ".", "_simple_command", "(", "'LOGOUT'", ")", "except", ":", "typ", ",", "dat", "=", "'NO'", ",", "[", "'%s: %s'", "%", "sys"...
https://github.com/IronLanguages/main/blob/a949455434b1fda8c783289e897e78a9a0caabb5/External.LCA_RESTRICTED/Languages/CPython/27/Lib/imaplib.py#L527-L540
timonwong/OmniMarkupPreviewer
21921ac7a99d2b5924a2219b33679a5b53621392
OmniMarkupLib/Renderers/libs/python2/genshi/filters/transform.py
python
SubstituteTransformation.__call__
(self, stream)
Apply the transform filter to the marked stream. :param stream: The marked event stream to filter
Apply the transform filter to the marked stream.
[ "Apply", "the", "transform", "filter", "to", "the", "marked", "stream", "." ]
def __call__(self, stream): """Apply the transform filter to the marked stream. :param stream: The marked event stream to filter """ for mark, (kind, data, pos) in stream: if mark is not None and kind is TEXT: new_data = self.pattern.sub(self.replace, data, s...
[ "def", "__call__", "(", "self", ",", "stream", ")", ":", "for", "mark", ",", "(", "kind", ",", "data", ",", "pos", ")", "in", "stream", ":", "if", "mark", "is", "not", "None", "and", "kind", "is", "TEXT", ":", "new_data", "=", "self", ".", "patte...
https://github.com/timonwong/OmniMarkupPreviewer/blob/21921ac7a99d2b5924a2219b33679a5b53621392/OmniMarkupLib/Renderers/libs/python2/genshi/filters/transform.py#L1000-L1012
PyCQA/astroid
a815443f62faae05249621a396dcf0afd884a619
astroid/nodes/as_string.py
python
AsStringVisitor.visit_pass
(self, node)
return "pass"
return an astroid.Pass node as string
return an astroid.Pass node as string
[ "return", "an", "astroid", ".", "Pass", "node", "as", "string" ]
def visit_pass(self, node): """return an astroid.Pass node as string""" return "pass"
[ "def", "visit_pass", "(", "self", ",", "node", ")", ":", "return", "\"pass\"" ]
https://github.com/PyCQA/astroid/blob/a815443f62faae05249621a396dcf0afd884a619/astroid/nodes/as_string.py#L436-L438
urwid/urwid
e2423b5069f51d318ea1ac0f355a0efe5448f7eb
urwid/container.py
python
Pile.mouse_event
(self, size, event, button, col, row, focus)
return w.mouse_event(tsize, event, button, col, row-wrow, focus)
Pass the event to the contained widget. May change focus on button 1 press.
Pass the event to the contained widget. May change focus on button 1 press.
[ "Pass", "the", "event", "to", "the", "contained", "widget", ".", "May", "change", "focus", "on", "button", "1", "press", "." ]
def mouse_event(self, size, event, button, col, row, focus): """ Pass the event to the contained widget. May change focus on button 1 press. """ wrow = 0 item_rows = self.get_item_rows(size, focus) for i, (r, w) in enumerate(zip(item_rows, (w for (...
[ "def", "mouse_event", "(", "self", ",", "size", ",", "event", ",", "button", ",", "col", ",", "row", ",", "focus", ")", ":", "wrow", "=", "0", "item_rows", "=", "self", ".", "get_item_rows", "(", "size", ",", "focus", ")", "for", "i", ",", "(", "...
https://github.com/urwid/urwid/blob/e2423b5069f51d318ea1ac0f355a0efe5448f7eb/urwid/container.py#L1701-L1726
selfteaching/selfteaching-python-camp
9982ee964b984595e7d664b07c389cddaf158f1e
19100205/Ceasar1978/pip-19.0.3/src/pip/_internal/req/req_uninstall.py
python
UninstallPathSet._allowed_to_proceed
(self, verbose)
return ask('Proceed (y/n)? ', ('y', 'n')) == 'y'
Display which files would be deleted and prompt for confirmation
Display which files would be deleted and prompt for confirmation
[ "Display", "which", "files", "would", "be", "deleted", "and", "prompt", "for", "confirmation" ]
def _allowed_to_proceed(self, verbose): """Display which files would be deleted and prompt for confirmation """ def _display(msg, paths): if not paths: return logger.info(msg) with indent_log(): for path in sorted(compact(path...
[ "def", "_allowed_to_proceed", "(", "self", ",", "verbose", ")", ":", "def", "_display", "(", "msg", ",", "paths", ")", ":", "if", "not", "paths", ":", "return", "logger", ".", "info", "(", "msg", ")", "with", "indent_log", "(", ")", ":", "for", "path...
https://github.com/selfteaching/selfteaching-python-camp/blob/9982ee964b984595e7d664b07c389cddaf158f1e/19100205/Ceasar1978/pip-19.0.3/src/pip/_internal/req/req_uninstall.py#L368-L395
holzschu/Carnets
44effb10ddfc6aa5c8b0687582a724ba82c6b547
Library/lib/python3.7/site-packages/networkx/linalg/attrmatrix.py
python
_node_value
(G, node_attr)
return value
Returns a function that returns a value from G.nodes[u]. We return a function expecting a node as its sole argument. Then, in the simplest scenario, the returned function will return G.nodes[u][node_attr]. However, we also handle the case when `node_attr` is None or when it is a function itself. P...
Returns a function that returns a value from G.nodes[u].
[ "Returns", "a", "function", "that", "returns", "a", "value", "from", "G", ".", "nodes", "[", "u", "]", "." ]
def _node_value(G, node_attr): """Returns a function that returns a value from G.nodes[u]. We return a function expecting a node as its sole argument. Then, in the simplest scenario, the returned function will return G.nodes[u][node_attr]. However, we also handle the case when `node_attr` is None or wh...
[ "def", "_node_value", "(", "G", ",", "node_attr", ")", ":", "if", "node_attr", "is", "None", ":", "def", "value", "(", "u", ")", ":", "return", "u", "elif", "not", "hasattr", "(", "node_attr", ",", "'__call__'", ")", ":", "# assume it is a key for the node...
https://github.com/holzschu/Carnets/blob/44effb10ddfc6aa5c8b0687582a724ba82c6b547/Library/lib/python3.7/site-packages/networkx/linalg/attrmatrix.py#L10-L47
PaddlePaddle/PARL
5fb7a5d2b5d0f0dac57fdf4acb9e79485c7efa96
parl/utils/replay_memory.py
python
ReplayMemory.load_from_d4rl
(self, dataset)
load data from d4rl dataset(https://github.com/rail-berkeley/d4rl#using-d4rl) to replay memory. Args: dataset(dict): dataset that contains: observations (np.float32): shape of (batch_size, obs_dim), next_observations (np.int32): shape of (batc...
load data from d4rl dataset(https://github.com/rail-berkeley/d4rl#using-d4rl) to replay memory.
[ "load", "data", "from", "d4rl", "dataset", "(", "https", ":", "//", "github", ".", "com", "/", "rail", "-", "berkeley", "/", "d4rl#using", "-", "d4rl", ")", "to", "replay", "memory", "." ]
def load_from_d4rl(self, dataset): """ load data from d4rl dataset(https://github.com/rail-berkeley/d4rl#using-d4rl) to replay memory. Args: dataset(dict): dataset that contains: observations (np.float32): shape of (batch_size, obs_dim), ...
[ "def", "load_from_d4rl", "(", "self", ",", "dataset", ")", ":", "logger", ".", "info", "(", "\"Dataset Info: \"", ")", "for", "key", "in", "dataset", ":", "logger", ".", "info", "(", "'key: {},\\tshape: {},\\tdtype: {}'", ".", "format", "(", "key", ",", "dat...
https://github.com/PaddlePaddle/PARL/blob/5fb7a5d2b5d0f0dac57fdf4acb9e79485c7efa96/parl/utils/replay_memory.py#L149-L199
demisto/content
5c664a65b992ac8ca90ac3f11b1b2cdf11ee9b07
Packs/OpsGenie/Integrations/OpsGenieV3/OpsGenieV3.py
python
fetch_incidents_command
(client: Client, params: Dict[str, Any], last_run: Optional[Dict] = None)
return incidents + alerts, {ALERT_TYPE: {'lastRun': last_run_alerts, 'next_page': next_page_alerts}, INCIDENT_TYPE: {'lastRun': last_run_incidents, 'next_page': next_page_incidents} ...
Uses to fetch incidents into Demisto Documentation: https://github.com/demisto/content/tree/master/docs/fetching_incidents Args: client: Client object with request last_run: Last fetch object occurs params: demisto params Returns: incidents, new last_run
Uses to fetch incidents into Demisto Documentation: https://github.com/demisto/content/tree/master/docs/fetching_incidents
[ "Uses", "to", "fetch", "incidents", "into", "Demisto", "Documentation", ":", "https", ":", "//", "github", ".", "com", "/", "demisto", "/", "content", "/", "tree", "/", "master", "/", "docs", "/", "fetching_incidents" ]
def fetch_incidents_command(client: Client, params: Dict[str, Any], last_run: Optional[Dict] = None) -> Tuple[List[Dict[str, Any]], Dict]: """Uses to fetch incidents into Demisto Documentation: https://github.com/demisto/content/tree/master/docs/fetching_i...
[ "def", "fetch_incidents_command", "(", "client", ":", "Client", ",", "params", ":", "Dict", "[", "str", ",", "Any", "]", ",", "last_run", ":", "Optional", "[", "Dict", "]", "=", "None", ")", "->", "Tuple", "[", "List", "[", "Dict", "[", "str", ",", ...
https://github.com/demisto/content/blob/5c664a65b992ac8ca90ac3f11b1b2cdf11ee9b07/Packs/OpsGenie/Integrations/OpsGenieV3/OpsGenieV3.py#L967-L1023
uwdata/termite-data-server
1085571407c627bdbbd21c352e793fed65d09599
web2py/gluon/contrib/gateways/fcgi.py
python
Server.__init__
(self, handler=None, maxwrite=8192, bindAddress=None, umask=None, multiplexed=False)
handler, if present, must reference a function or method that takes one argument: a Request object. If handler is not specified at creation time, Server *must* be subclassed. (The handler method below is abstract.) maxwrite is the maximum number of bytes (per Record) to write to...
handler, if present, must reference a function or method that takes one argument: a Request object. If handler is not specified at creation time, Server *must* be subclassed. (The handler method below is abstract.)
[ "handler", "if", "present", "must", "reference", "a", "function", "or", "method", "that", "takes", "one", "argument", ":", "a", "Request", "object", ".", "If", "handler", "is", "not", "specified", "at", "creation", "time", "Server", "*", "must", "*", "be",...
def __init__(self, handler=None, maxwrite=8192, bindAddress=None, umask=None, multiplexed=False): """ handler, if present, must reference a function or method that takes one argument: a Request object. If handler is not specified at creation time, Server *must* be subcla...
[ "def", "__init__", "(", "self", ",", "handler", "=", "None", ",", "maxwrite", "=", "8192", ",", "bindAddress", "=", "None", ",", "umask", "=", "None", ",", "multiplexed", "=", "False", ")", ":", "if", "handler", "is", "not", "None", ":", "self", ".",...
https://github.com/uwdata/termite-data-server/blob/1085571407c627bdbbd21c352e793fed65d09599/web2py/gluon/contrib/gateways/fcgi.py#L924-L983
odlgroup/odl
0b088df8dc4621c68b9414c3deff9127f4c4f11d
odl/contrib/torch/operator.py
python
copy_if_zero_strides
(arr)
return arr.copy() if 0 in arr.strides else arr
Workaround for NumPy issue #9165 with 0 in arr.strides.
Workaround for NumPy issue #9165 with 0 in arr.strides.
[ "Workaround", "for", "NumPy", "issue", "#9165", "with", "0", "in", "arr", ".", "strides", "." ]
def copy_if_zero_strides(arr): """Workaround for NumPy issue #9165 with 0 in arr.strides.""" assert isinstance(arr, np.ndarray) return arr.copy() if 0 in arr.strides else arr
[ "def", "copy_if_zero_strides", "(", "arr", ")", ":", "assert", "isinstance", "(", "arr", ",", "np", ".", "ndarray", ")", "return", "arr", ".", "copy", "(", ")", "if", "0", "in", "arr", ".", "strides", "else", "arr" ]
https://github.com/odlgroup/odl/blob/0b088df8dc4621c68b9414c3deff9127f4c4f11d/odl/contrib/torch/operator.py#L513-L516
limodou/ulipad
4c7d590234f39cac80bb1d36dca095b646e287fb
packages/docutils/nodes.py
python
Node.deepcopy
(self)
Return a deep copy of self (also copying children).
Return a deep copy of self (also copying children).
[ "Return", "a", "deep", "copy", "of", "self", "(", "also", "copying", "children", ")", "." ]
def deepcopy(self): """Return a deep copy of self (also copying children).""" raise NotImplementedError
[ "def", "deepcopy", "(", "self", ")", ":", "raise", "NotImplementedError" ]
https://github.com/limodou/ulipad/blob/4c7d590234f39cac80bb1d36dca095b646e287fb/packages/docutils/nodes.py#L87-L89
django/django
0a17666045de6739ae1c2ac695041823d5f827f7
django/core/management/color.py
python
no_style
()
return make_style('nocolor')
Return a Style object with no color scheme.
Return a Style object with no color scheme.
[ "Return", "a", "Style", "object", "with", "no", "color", "scheme", "." ]
def no_style(): """ Return a Style object with no color scheme. """ return make_style('nocolor')
[ "def", "no_style", "(", ")", ":", "return", "make_style", "(", "'nocolor'", ")" ]
https://github.com/django/django/blob/0a17666045de6739ae1c2ac695041823d5f827f7/django/core/management/color.py#L94-L98
triaquae/triaquae
bbabf736b3ba56a0c6498e7f04e16c13b8b8f2b9
TriAquae/models/django/db/backends/sqlite3/base.py
python
parse_datetime_with_timezone_support
(value)
return dt
[]
def parse_datetime_with_timezone_support(value): dt = parse_datetime(value) # Confirm that dt is naive before overwriting its tzinfo. if dt is not None and settings.USE_TZ and timezone.is_naive(dt): dt = dt.replace(tzinfo=timezone.utc) return dt
[ "def", "parse_datetime_with_timezone_support", "(", "value", ")", ":", "dt", "=", "parse_datetime", "(", "value", ")", "# Confirm that dt is naive before overwriting its tzinfo.", "if", "dt", "is", "not", "None", "and", "settings", ".", "USE_TZ", "and", "timezone", "....
https://github.com/triaquae/triaquae/blob/bbabf736b3ba56a0c6498e7f04e16c13b8b8f2b9/TriAquae/models/django/db/backends/sqlite3/base.py#L40-L45
chapmanb/bcbb
dbfb52711f0bfcc1d26c5a5b53c9ff4f50dc0027
gff/BCBio/GFF/GFFParser.py
python
parse
(gff_files, base_dict=None, limit_info=None, target_lines=None)
High level interface to parse GFF files into SeqRecords and SeqFeatures.
High level interface to parse GFF files into SeqRecords and SeqFeatures.
[ "High", "level", "interface", "to", "parse", "GFF", "files", "into", "SeqRecords", "and", "SeqFeatures", "." ]
def parse(gff_files, base_dict=None, limit_info=None, target_lines=None): """High level interface to parse GFF files into SeqRecords and SeqFeatures. """ parser = GFFParser() for rec in parser.parse_in_parts(gff_files, base_dict, limit_info, target_lines): yield rec
[ "def", "parse", "(", "gff_files", ",", "base_dict", "=", "None", ",", "limit_info", "=", "None", ",", "target_lines", "=", "None", ")", ":", "parser", "=", "GFFParser", "(", ")", "for", "rec", "in", "parser", ".", "parse_in_parts", "(", "gff_files", ",",...
https://github.com/chapmanb/bcbb/blob/dbfb52711f0bfcc1d26c5a5b53c9ff4f50dc0027/gff/BCBio/GFF/GFFParser.py#L776-L782
wistbean/learn_python3_spider
73c873f4845f4385f097e5057407d03dd37a117b
stackoverflow/venv/lib/python3.6/site-packages/pip-19.0.3-py3.6.egg/pip/_vendor/pkg_resources/__init__.py
python
Distribution.insert_on
(self, path, loc=None, replace=False)
return
Ensure self.location is on path If replace=False (default): - If location is already in path anywhere, do nothing. - Else: - If it's an egg and its parent directory is on path, insert just ahead of the parent. - Else: add to the end of path. ...
Ensure self.location is on path
[ "Ensure", "self", ".", "location", "is", "on", "path" ]
def insert_on(self, path, loc=None, replace=False): """Ensure self.location is on path If replace=False (default): - If location is already in path anywhere, do nothing. - Else: - If it's an egg and its parent directory is on path, insert just ahead...
[ "def", "insert_on", "(", "self", ",", "path", ",", "loc", "=", "None", ",", "replace", "=", "False", ")", ":", "loc", "=", "loc", "or", "self", ".", "location", "if", "not", "loc", ":", "return", "nloc", "=", "_normalize_cached", "(", "loc", ")", "...
https://github.com/wistbean/learn_python3_spider/blob/73c873f4845f4385f097e5057407d03dd37a117b/stackoverflow/venv/lib/python3.6/site-packages/pip-19.0.3-py3.6.egg/pip/_vendor/pkg_resources/__init__.py#L2746-L2812
vyos/vyos-1x
6e8a8934a7d4e1b21d7c828e372303683b499b56
python/vyos/ifconfig/section.py
python
Section._sort_interfaces
(cls, generator)
return l
return a list of the sorted interface by number, vlan, qinq
return a list of the sorted interface by number, vlan, qinq
[ "return", "a", "list", "of", "the", "sorted", "interface", "by", "number", "vlan", "qinq" ]
def _sort_interfaces(cls, generator): """ return a list of the sorted interface by number, vlan, qinq """ def key(ifname): value = 0 parts = re.split(r'([^0-9]+)([0-9]+)[.]?([0-9]+)?[.]?([0-9]+)?', ifname) length = len(parts) name = parts[1...
[ "def", "_sort_interfaces", "(", "cls", ",", "generator", ")", ":", "def", "key", "(", "ifname", ")", ":", "value", "=", "0", "parts", "=", "re", ".", "split", "(", "r'([^0-9]+)([0-9]+)[.]?([0-9]+)?[.]?([0-9]+)?'", ",", "ifname", ")", "length", "=", "len", ...
https://github.com/vyos/vyos-1x/blob/6e8a8934a7d4e1b21d7c828e372303683b499b56/python/vyos/ifconfig/section.py#L109-L135
buke/GreenOdoo
3d8c55d426fb41fdb3f2f5a1533cfe05983ba1df
runtime/python/lib/python2.7/collections.py
python
OrderedDict.iteritems
(self)
od.iteritems -> an iterator over the (key, value) pairs in od
od.iteritems -> an iterator over the (key, value) pairs in od
[ "od", ".", "iteritems", "-", ">", "an", "iterator", "over", "the", "(", "key", "value", ")", "pairs", "in", "od" ]
def iteritems(self): 'od.iteritems -> an iterator over the (key, value) pairs in od' for k in self: yield (k, self[k])
[ "def", "iteritems", "(", "self", ")", ":", "for", "k", "in", "self", ":", "yield", "(", "k", ",", "self", "[", "k", "]", ")" ]
https://github.com/buke/GreenOdoo/blob/3d8c55d426fb41fdb3f2f5a1533cfe05983ba1df/runtime/python/lib/python2.7/collections.py#L121-L124
theislab/scvelo
1805ab4a72d3f34496f0ef246500a159f619d3a2
docs/source/conf.py
python
modurl
(qualname)
return f"{github_url}/{path}{fragment}"
Get the full GitHub URL for some object’s qualname.
Get the full GitHub URL for some object’s qualname.
[ "Get", "the", "full", "GitHub", "URL", "for", "some", "object’s", "qualname", "." ]
def modurl(qualname): """Get the full GitHub URL for some object’s qualname.""" obj, module = get_obj_module(qualname) github_url = github_url_scvelo try: path = PurePosixPath(Path(module.__file__).resolve().relative_to(project_dir)) except ValueError: # trying to document something ...
[ "def", "modurl", "(", "qualname", ")", ":", "obj", ",", "module", "=", "get_obj_module", "(", "qualname", ")", "github_url", "=", "github_url_scvelo", "try", ":", "path", "=", "PurePosixPath", "(", "Path", "(", "module", ".", "__file__", ")", ".", "resolve...
https://github.com/theislab/scvelo/blob/1805ab4a72d3f34496f0ef246500a159f619d3a2/docs/source/conf.py#L250-L268
omz/PythonistaAppTemplate
f560f93f8876d82a21d108977f90583df08d55af
PythonistaAppTemplate/PythonistaKit.framework/pylib/mimify.py
python
mime_decode
(line)
return newline + line[pos:]
Decode a single line of quoted-printable text to 8bit.
Decode a single line of quoted-printable text to 8bit.
[ "Decode", "a", "single", "line", "of", "quoted", "-", "printable", "text", "to", "8bit", "." ]
def mime_decode(line): """Decode a single line of quoted-printable text to 8bit.""" newline = '' pos = 0 while 1: res = mime_code.search(line, pos) if res is None: break newline = newline + line[pos:res.start(0)] + \ chr(int(res.group(1), 16)) ...
[ "def", "mime_decode", "(", "line", ")", ":", "newline", "=", "''", "pos", "=", "0", "while", "1", ":", "res", "=", "mime_code", ".", "search", "(", "line", ",", "pos", ")", "if", "res", "is", "None", ":", "break", "newline", "=", "newline", "+", ...
https://github.com/omz/PythonistaAppTemplate/blob/f560f93f8876d82a21d108977f90583df08d55af/PythonistaAppTemplate/PythonistaKit.framework/pylib/mimify.py#L93-L104
maas/maas
db2f89970c640758a51247c59bf1ec6f60cf4ab5
src/maasserver/api/nodes.py
python
NodeHandler.delete
(self, request, system_id)
return rc.DELETED
@description-title Delete a node @description Deletes a node with a given system_id. @param (string) "{system_id}" [required=true] A node's system_id. @success (http-status-code) "204" 204 @error (http-status-code) "404" 404 @error (content) "not-found" The requested node is n...
@description-title Delete a node @description Deletes a node with a given system_id.
[ "@description", "-", "title", "Delete", "a", "node", "@description", "Deletes", "a", "node", "with", "a", "given", "system_id", "." ]
def delete(self, request, system_id): """@description-title Delete a node @description Deletes a node with a given system_id. @param (string) "{system_id}" [required=true] A node's system_id. @success (http-status-code) "204" 204 @error (http-status-code) "404" 404 @er...
[ "def", "delete", "(", "self", ",", "request", ",", "system_id", ")", ":", "node", "=", "self", ".", "model", ".", "objects", ".", "get_node_or_404", "(", "system_id", "=", "system_id", ",", "user", "=", "request", ".", "user", ",", "perm", "=", "NodePe...
https://github.com/maas/maas/blob/db2f89970c640758a51247c59bf1ec6f60cf4ab5/src/maasserver/api/nodes.py#L519-L540
fluentpython/example-code-2e
80f7f84274a47579e59c29a4657691525152c9d5
12-seq-hacking/vector_v2.py
python
Vector.__init__
(self, components)
[]
def __init__(self, components): self._components = array(self.typecode, components)
[ "def", "__init__", "(", "self", ",", "components", ")", ":", "self", ".", "_components", "=", "array", "(", "self", ".", "typecode", ",", "components", ")" ]
https://github.com/fluentpython/example-code-2e/blob/80f7f84274a47579e59c29a4657691525152c9d5/12-seq-hacking/vector_v2.py#L121-L122
paulwinex/pw_MultiScriptEditor
e447e99f87cb07e238baf693b7e124e50efdbc51
multi_script_editor/managers/nuke/main.py
python
ofxPluginPath
()
return ['',]
nuke.ofxPluginPath() -> String list List of all the directories Nuke searched for OFX plugins in. @return: String list
nuke.ofxPluginPath() -> String list
[ "nuke", ".", "ofxPluginPath", "()", "-", ">", "String", "list" ]
def ofxPluginPath(): """nuke.ofxPluginPath() -> String list List of all the directories Nuke searched for OFX plugins in. @return: String list""" return ['',]
[ "def", "ofxPluginPath", "(", ")", ":", "return", "[", "''", ",", "]" ]
https://github.com/paulwinex/pw_MultiScriptEditor/blob/e447e99f87cb07e238baf693b7e124e50efdbc51/multi_script_editor/managers/nuke/main.py#L5671-L5677
salesforce/glad
cc3217437128578a1942582670104bc214506a5e
dataset.py
python
Ontology.from_dict
(cls, d)
return cls(**d)
[]
def from_dict(cls, d): return cls(**d)
[ "def", "from_dict", "(", "cls", ",", "d", ")", ":", "return", "cls", "(", "*", "*", "d", ")" ]
https://github.com/salesforce/glad/blob/cc3217437128578a1942582670104bc214506a5e/dataset.py#L197-L198
baidu/DuReader
43577e29435f5abcb7b02ce6a0019b3f42b1221d
DuReader-2.0/tensorflow/rc_model.py
python
RCModel._compute_loss
(self)
The loss function
The loss function
[ "The", "loss", "function" ]
def _compute_loss(self): """ The loss function """ def sparse_nll_loss(probs, labels, epsilon=1e-9, scope=None): """ negative log likelyhood loss """ with tf.name_scope(scope, "log_loss"): labels = tf.one_hot(labels, tf.sha...
[ "def", "_compute_loss", "(", "self", ")", ":", "def", "sparse_nll_loss", "(", "probs", ",", "labels", ",", "epsilon", "=", "1e-9", ",", "scope", "=", "None", ")", ":", "\"\"\"\n negative log likelyhood loss\n \"\"\"", "with", "tf", ".", "name...
https://github.com/baidu/DuReader/blob/43577e29435f5abcb7b02ce6a0019b3f42b1221d/DuReader-2.0/tensorflow/rc_model.py#L179-L200
apple/ccs-calendarserver
13c706b985fb728b9aab42dc0fef85aae21921c3
twistedcaldav/directory/calendaruserproxyloader.py
python
XMLCalendarUserProxyLoader._parseMembers
(self, node, addto)
[]
def _parseMembers(self, node, addto): for child in node: if child.tag == ELEMENT_MEMBER: addto.add(child.text)
[ "def", "_parseMembers", "(", "self", ",", "node", ",", "addto", ")", ":", "for", "child", "in", "node", ":", "if", "child", ".", "tag", "==", "ELEMENT_MEMBER", ":", "addto", ".", "add", "(", "child", ".", "text", ")" ]
https://github.com/apple/ccs-calendarserver/blob/13c706b985fb728b9aab42dc0fef85aae21921c3/twistedcaldav/directory/calendaruserproxyloader.py#L109-L112
pyparallel/pyparallel
11e8c6072d48c8f13641925d17b147bf36ee0ba3
Lib/collections/abc.py
python
Mapping.keys
(self)
return KeysView(self)
D.keys() -> a set-like object providing a view on D's keys
D.keys() -> a set-like object providing a view on D's keys
[ "D", ".", "keys", "()", "-", ">", "a", "set", "-", "like", "object", "providing", "a", "view", "on", "D", "s", "keys" ]
def keys(self): "D.keys() -> a set-like object providing a view on D's keys" return KeysView(self)
[ "def", "keys", "(", "self", ")", ":", "return", "KeysView", "(", "self", ")" ]
https://github.com/pyparallel/pyparallel/blob/11e8c6072d48c8f13641925d17b147bf36ee0ba3/Lib/collections/abc.py#L412-L414
dreamworksanimation/usdmanager
dfd0825300c45d3bba25a585bfd0785d5bc50cb0
usdmanager/__init__.py
python
UsdMngrWindow.customTabWidgetContextMenu
(self, pos)
Slot for the right-click context menu for the tab widget. :Parameters: pos : `QtCore.QPoint` Position of the right-click
Slot for the right-click context menu for the tab widget. :Parameters: pos : `QtCore.QPoint` Position of the right-click
[ "Slot", "for", "the", "right", "-", "click", "context", "menu", "for", "the", "tab", "widget", ".", ":", "Parameters", ":", "pos", ":", "QtCore", ".", "QPoint", "Position", "of", "the", "right", "-", "click" ]
def customTabWidgetContextMenu(self, pos): """ Slot for the right-click context menu for the tab widget. :Parameters: pos : `QtCore.QPoint` Position of the right-click """ menu = QtWidgets.QMenu(self) menu.addAction(self.actionNewTab) ...
[ "def", "customTabWidgetContextMenu", "(", "self", ",", "pos", ")", ":", "menu", "=", "QtWidgets", ".", "QMenu", "(", "self", ")", "menu", ".", "addAction", "(", "self", ".", "actionNewTab", ")", "menu", ".", "addSeparator", "(", ")", "menu", ".", "addAct...
https://github.com/dreamworksanimation/usdmanager/blob/dfd0825300c45d3bba25a585bfd0785d5bc50cb0/usdmanager/__init__.py#L652-L694
nipy/nibabel
4703f4d8e32be4cec30e829c2d93ebe54759bb62
nibabel/casting.py
python
longdouble_precision_improved
()
return not longdouble_lte_float64() and _LD_LTE_FLOAT64
True if longdouble precision increased since initial import This can happen on Windows compiled with MSVC. It may be because libraries compiled with mingw (longdouble is Intel80) get linked to numpy compiled with MSVC (longdouble is Float64)
True if longdouble precision increased since initial import
[ "True", "if", "longdouble", "precision", "increased", "since", "initial", "import" ]
def longdouble_precision_improved(): """ True if longdouble precision increased since initial import This can happen on Windows compiled with MSVC. It may be because libraries compiled with mingw (longdouble is Intel80) get linked to numpy compiled with MSVC (longdouble is Float64) """ return ...
[ "def", "longdouble_precision_improved", "(", ")", ":", "return", "not", "longdouble_lte_float64", "(", ")", "and", "_LD_LTE_FLOAT64" ]
https://github.com/nipy/nibabel/blob/4703f4d8e32be4cec30e829c2d93ebe54759bb62/nibabel/casting.py#L681-L688
lovelylain/pyctp
fd304de4b50c4ddc31a4190b1caaeb5dec66bc5d
option/ctp/ApiStruct.py
python
ReqFutureSignOut.__init__
(self, TradeCode='', BankID='', BankBranchID='', BrokerID='', BrokerBranchID='', TradeDate='', TradeTime='', BankSerial='', TradingDay='', PlateSerial=0, LastFragment=LF_Yes, SessionID=0, InstallID=0, UserID='', Digest='', CurrencyID='', DeviceID='', BrokerIDByBank='', OperNo='', RequestID=0, TID=0)
[]
def __init__(self, TradeCode='', BankID='', BankBranchID='', BrokerID='', BrokerBranchID='', TradeDate='', TradeTime='', BankSerial='', TradingDay='', PlateSerial=0, LastFragment=LF_Yes, SessionID=0, InstallID=0, UserID='', Digest='', CurrencyID='', DeviceID='', BrokerIDByBank='', OperNo='', RequestID=0, TID=0): ...
[ "def", "__init__", "(", "self", ",", "TradeCode", "=", "''", ",", "BankID", "=", "''", ",", "BankBranchID", "=", "''", ",", "BrokerID", "=", "''", ",", "BrokerBranchID", "=", "''", ",", "TradeDate", "=", "''", ",", "TradeTime", "=", "''", ",", "BankS...
https://github.com/lovelylain/pyctp/blob/fd304de4b50c4ddc31a4190b1caaeb5dec66bc5d/option/ctp/ApiStruct.py#L5866-L5887
plotly/plotly.py
cfad7862594b35965c0e000813bd7805e8494a5b
packages/python/plotly/plotly/graph_objs/indicator/gauge/_axis.py
python
Axis.dtick
(self)
return self["dtick"]
Sets the step in-between ticks on this axis. Use with `tick0`. Must be a positive number, or special strings available to "log" and "date" axes. If the axis `type` is "log", then ticks are set every 10^(n*dtick) where n is the tick number. For example, to set a tick mark at 1, 10, 100, 1...
Sets the step in-between ticks on this axis. Use with `tick0`. Must be a positive number, or special strings available to "log" and "date" axes. If the axis `type` is "log", then ticks are set every 10^(n*dtick) where n is the tick number. For example, to set a tick mark at 1, 10, 100, 1...
[ "Sets", "the", "step", "in", "-", "between", "ticks", "on", "this", "axis", ".", "Use", "with", "tick0", ".", "Must", "be", "a", "positive", "number", "or", "special", "strings", "available", "to", "log", "and", "date", "axes", ".", "If", "the", "axis"...
def dtick(self): """ Sets the step in-between ticks on this axis. Use with `tick0`. Must be a positive number, or special strings available to "log" and "date" axes. If the axis `type` is "log", then ticks are set every 10^(n*dtick) where n is the tick number. For example...
[ "def", "dtick", "(", "self", ")", ":", "return", "self", "[", "\"dtick\"", "]" ]
https://github.com/plotly/plotly.py/blob/cfad7862594b35965c0e000813bd7805e8494a5b/packages/python/plotly/plotly/graph_objs/indicator/gauge/_axis.py#L45-L74
golismero/golismero
7d605b937e241f51c1ca4f47b20f755eeefb9d76
golismero/api/net/web_utils.py
python
data_from_http_response
(response)
return data
Extracts data from an HTTP response. :param response: HTTP response. :type response: HTTP_Response :returns: Extracted data, or None if no data was found. :rtype: Data | None
Extracts data from an HTTP response.
[ "Extracts", "data", "from", "an", "HTTP", "response", "." ]
def data_from_http_response(response): """ Extracts data from an HTTP response. :param response: HTTP response. :type response: HTTP_Response :returns: Extracted data, or None if no data was found. :rtype: Data | None """ # If we have no data, return None. if not response.data: ...
[ "def", "data_from_http_response", "(", "response", ")", ":", "# If we have no data, return None.", "if", "not", "response", ".", "data", ":", "return", "None", "# Get the MIME content type.", "content_type", "=", "response", ".", "content_type", "# Strip the content type mo...
https://github.com/golismero/golismero/blob/7d605b937e241f51c1ca4f47b20f755eeefb9d76/golismero/api/net/web_utils.py#L116-L176
tomplus/kubernetes_asyncio
f028cc793e3a2c519be6a52a49fb77ff0b014c9b
kubernetes_asyncio/client/models/v1alpha1_priority_class_list.py
python
V1alpha1PriorityClassList.to_dict
(self)
return result
Returns the model properties as a dict
Returns the model properties as a dict
[ "Returns", "the", "model", "properties", "as", "a", "dict" ]
def to_dict(self): """Returns the model properties as a dict""" result = {} for attr, _ in six.iteritems(self.openapi_types): value = getattr(self, attr) if isinstance(value, list): result[attr] = list(map( lambda x: x.to_dict() if has...
[ "def", "to_dict", "(", "self", ")", ":", "result", "=", "{", "}", "for", "attr", ",", "_", "in", "six", ".", "iteritems", "(", "self", ".", "openapi_types", ")", ":", "value", "=", "getattr", "(", "self", ",", "attr", ")", "if", "isinstance", "(", ...
https://github.com/tomplus/kubernetes_asyncio/blob/f028cc793e3a2c519be6a52a49fb77ff0b014c9b/kubernetes_asyncio/client/models/v1alpha1_priority_class_list.py#L161-L183
danielplohmann/apiscout
8622b54302cb2712fe35ce971e77d1f3d5849a2a
apiscout/db_builder/pefile.py
python
PE.parse_resources_directory
(self, rva, size=0, base_rva = None, level = 0, dirs=None)
return resource_directory_data
Parse the resources directory. Given the RVA of the resources directory, it will process all its entries. The root will have the corresponding member of its structure, IMAGE_RESOURCE_DIRECTORY plus 'entries', a list of all the entries in the directory. Those entries wi...
Parse the resources directory.
[ "Parse", "the", "resources", "directory", "." ]
def parse_resources_directory(self, rva, size=0, base_rva = None, level = 0, dirs=None): """Parse the resources directory. Given the RVA of the resources directory, it will process all its entries. The root will have the corresponding member of its structure, IMAGE_RESOURCE_DIR...
[ "def", "parse_resources_directory", "(", "self", ",", "rva", ",", "size", "=", "0", ",", "base_rva", "=", "None", ",", "level", "=", "0", ",", "dirs", "=", "None", ")", ":", "# OC Patch:", "if", "dirs", "is", "None", ":", "dirs", "=", "[", "rva", "...
https://github.com/danielplohmann/apiscout/blob/8622b54302cb2712fe35ce971e77d1f3d5849a2a/apiscout/db_builder/pefile.py#L3247-L3502
ghostop14/sparrow-wifi
4b8289773ea4304872062f65a6ffc9352612b08e
sparrowhackrf.py
python
HackrfSweepThread.__init__
(self, parentHackrf)
[]
def __init__(self, parentHackrf): super().__init__() self.parentHackrf= parentHackrf self.minFreq = 2400 self.maxFreq = 5900 self.binWidth = 250000 # 250 KHz width self.gain = 40 # mirror qspectrumanalyzer # In python3 / is a floating point opera...
[ "def", "__init__", "(", "self", ",", "parentHackrf", ")", ":", "super", "(", ")", ".", "__init__", "(", ")", "self", ".", "parentHackrf", "=", "parentHackrf", "self", ".", "minFreq", "=", "2400", "self", ".", "maxFreq", "=", "5900", "self", ".", "binWi...
https://github.com/ghostop14/sparrow-wifi/blob/4b8289773ea4304872062f65a6ffc9352612b08e/sparrowhackrf.py#L35-L46
openshift/openshift-tools
1188778e728a6e4781acf728123e5b356380fe6f
openshift/installer/vendored/openshift-ansible-3.11.28-1/roles/lib_vendored_deps/library/oc_configmap.py
python
Utils.cleanup
(files)
Clean up on exit
Clean up on exit
[ "Clean", "up", "on", "exit" ]
def cleanup(files): '''Clean up on exit ''' for sfile in files: if os.path.exists(sfile): if os.path.isdir(sfile): shutil.rmtree(sfile) elif os.path.isfile(sfile): os.remove(sfile)
[ "def", "cleanup", "(", "files", ")", ":", "for", "sfile", "in", "files", ":", "if", "os", ".", "path", ".", "exists", "(", "sfile", ")", ":", "if", "os", ".", "path", ".", "isdir", "(", "sfile", ")", ":", "shutil", ".", "rmtree", "(", "sfile", ...
https://github.com/openshift/openshift-tools/blob/1188778e728a6e4781acf728123e5b356380fe6f/openshift/installer/vendored/openshift-ansible-3.11.28-1/roles/lib_vendored_deps/library/oc_configmap.py#L1225-L1232
tanghaibao/goatools
647e9dd833695f688cd16c2f9ea18f1692e5c6bc
versioneer.py
python
get_config_from_root
(root)
return cfg
Read the project setup.cfg file to determine Versioneer config.
Read the project setup.cfg file to determine Versioneer config.
[ "Read", "the", "project", "setup", ".", "cfg", "file", "to", "determine", "Versioneer", "config", "." ]
def get_config_from_root(root): """Read the project setup.cfg file to determine Versioneer config.""" # This might raise EnvironmentError (if setup.cfg is missing), or # configparser.NoSectionError (if it lacks a [versioneer] section), or # configparser.NoOptionError (if it lacks "VCS="). See the docstr...
[ "def", "get_config_from_root", "(", "root", ")", ":", "# This might raise EnvironmentError (if setup.cfg is missing), or", "# configparser.NoSectionError (if it lacks a [versioneer] section), or", "# configparser.NoOptionError (if it lacks \"VCS=\"). See the docstring at", "# the top of versioneer...
https://github.com/tanghaibao/goatools/blob/647e9dd833695f688cd16c2f9ea18f1692e5c6bc/versioneer.py#L335-L361
shchur/gnn-benchmark
1e72912a0810cdf27ae54fd589a3b43358a2b161
gnnbench/models/graphsage.py
python
GraphSAGE._preprocess_features
(self, features)
return to_sparse_tensor(features)
[]
def _preprocess_features(self, features): if self.normalize_features: features = row_normalize(features) return to_sparse_tensor(features)
[ "def", "_preprocess_features", "(", "self", ",", "features", ")", ":", "if", "self", ".", "normalize_features", ":", "features", "=", "row_normalize", "(", "features", ")", "return", "to_sparse_tensor", "(", "features", ")" ]
https://github.com/shchur/gnn-benchmark/blob/1e72912a0810cdf27ae54fd589a3b43358a2b161/gnnbench/models/graphsage.py#L215-L218
angr/angr
4b04d56ace135018083d36d9083805be8146688b
angr/angrdb/serializers/comments.py
python
CommentsSerializer.dump
(session, db_kb, comments)
:param session: :param DbKnowledgeBase db_kb: :param Comments comments: :return: None
[]
def dump(session, db_kb, comments): """ :param session: :param DbKnowledgeBase db_kb: :param Comments comments: :return: None """ for addr, comment in comments.items(): db_comment = session.query(DbComment).filter_by( ...
[ "def", "dump", "(", "session", ",", "db_kb", ",", "comments", ")", ":", "for", "addr", ",", "comment", "in", "comments", ".", "items", "(", ")", ":", "db_comment", "=", "session", ".", "query", "(", "DbComment", ")", ".", "filter_by", "(", "kb", "=",...
https://github.com/angr/angr/blob/4b04d56ace135018083d36d9083805be8146688b/angr/angrdb/serializers/comments.py#L13-L38
talkpython/data-driven-web-apps-with-flask
60852486d56af680b36e2c0addef8648b21fd07b
app/ch13-validation/final/alembic/env.py
python
run_migrations_online
()
Run migrations in 'online' mode. In this scenario we need to create an Engine and associate a connection with the context.
Run migrations in 'online' mode.
[ "Run", "migrations", "in", "online", "mode", "." ]
def run_migrations_online(): """Run migrations in 'online' mode. In this scenario we need to create an Engine and associate a connection with the context. """ connectable = engine_from_config( config.get_section(config.config_ini_section), prefix="sqlalchemy.", poolclass=po...
[ "def", "run_migrations_online", "(", ")", ":", "connectable", "=", "engine_from_config", "(", "config", ".", "get_section", "(", "config", ".", "config_ini_section", ")", ",", "prefix", "=", "\"sqlalchemy.\"", ",", "poolclass", "=", "pool", ".", "NullPool", ",",...
https://github.com/talkpython/data-driven-web-apps-with-flask/blob/60852486d56af680b36e2c0addef8648b21fd07b/app/ch13-validation/final/alembic/env.py#L61-L80
buke/GreenOdoo
3d8c55d426fb41fdb3f2f5a1533cfe05983ba1df
runtime/python/lib/python2.7/site-packages/passlib-1.6.2-py2.7.egg/passlib/utils/handlers.py
python
_bitsize
(count, chars)
helper for bitsize() methods
helper for bitsize() methods
[ "helper", "for", "bitsize", "()", "methods" ]
def _bitsize(count, chars): """helper for bitsize() methods""" if chars and count: import math return int(count * math.log(len(chars), 2)) else: return 0
[ "def", "_bitsize", "(", "count", ",", "chars", ")", ":", "if", "chars", "and", "count", ":", "import", "math", "return", "int", "(", "count", "*", "math", ".", "log", "(", "len", "(", "chars", ")", ",", "2", ")", ")", "else", ":", "return", "0" ]
https://github.com/buke/GreenOdoo/blob/3d8c55d426fb41fdb3f2f5a1533cfe05983ba1df/runtime/python/lib/python2.7/site-packages/passlib-1.6.2-py2.7.egg/passlib/utils/handlers.py#L76-L82
holzschu/Carnets
44effb10ddfc6aa5c8b0687582a724ba82c6b547
Library/lib/python3.7/site-packages/astropy-4.0-py3.7-macosx-10.9-x86_64.egg/astropy/modeling/core.py
python
make_subtree_dict
(tree, nodepath, tdict, leaflist)
Traverse a tree noting each node by a key that indicates all the left/right choices necessary to reach that node. Each key will reference a tuple that contains: - reference to the compound model for that node. - left most index contained within that subtree (relative to all indices for the whole...
Traverse a tree noting each node by a key that indicates all the left/right choices necessary to reach that node. Each key will reference a tuple that contains:
[ "Traverse", "a", "tree", "noting", "each", "node", "by", "a", "key", "that", "indicates", "all", "the", "left", "/", "right", "choices", "necessary", "to", "reach", "that", "node", ".", "Each", "key", "will", "reference", "a", "tuple", "that", "contains", ...
def make_subtree_dict(tree, nodepath, tdict, leaflist): ''' Traverse a tree noting each node by a key that indicates all the left/right choices necessary to reach that node. Each key will reference a tuple that contains: - reference to the compound model for that node. - left most index contain...
[ "def", "make_subtree_dict", "(", "tree", ",", "nodepath", ",", "tdict", ",", "leaflist", ")", ":", "# if this is a leaf, just append it to the leaflist", "if", "not", "hasattr", "(", "tree", ",", "'isleaf'", ")", ":", "leaflist", ".", "append", "(", "tree", ")",...
https://github.com/holzschu/Carnets/blob/44effb10ddfc6aa5c8b0687582a724ba82c6b547/Library/lib/python3.7/site-packages/astropy-4.0-py3.7-macosx-10.9-x86_64.egg/astropy/modeling/core.py#L3489-L3508
Melissa-AI/Melissa-Core
ea08ae5e3088360d3bddc40db72160697522b8f7
melissa/utilities/snowboydetect.py
python
SnowboyDetect.Reset
(self)
return _snowboydetect.SnowboyDetect_Reset(self)
[]
def Reset(self): return _snowboydetect.SnowboyDetect_Reset(self)
[ "def", "Reset", "(", "self", ")", ":", "return", "_snowboydetect", ".", "SnowboyDetect_Reset", "(", "self", ")" ]
https://github.com/Melissa-AI/Melissa-Core/blob/ea08ae5e3088360d3bddc40db72160697522b8f7/melissa/utilities/snowboydetect.py#L107-L108
PaddlePaddle/PaddleX
2bab73f81ab54e328204e7871e6ae4a82e719f5d
paddlex/paddleseg/utils/download.py
python
_uncompress_file_zip
(filepath, extrapath)
[]
def _uncompress_file_zip(filepath, extrapath): files = zipfile.ZipFile(filepath, 'r') filelist = files.namelist() rootpath = filelist[0] total_num = len(filelist) for index, file in enumerate(filelist): files.extract(file, extrapath) yield total_num, index, rootpath files.close()...
[ "def", "_uncompress_file_zip", "(", "filepath", ",", "extrapath", ")", ":", "files", "=", "zipfile", ".", "ZipFile", "(", "filepath", ",", "'r'", ")", "filelist", "=", "files", ".", "namelist", "(", ")", "rootpath", "=", "filelist", "[", "0", "]", "total...
https://github.com/PaddlePaddle/PaddleX/blob/2bab73f81ab54e328204e7871e6ae4a82e719f5d/paddlex/paddleseg/utils/download.py#L67-L76
ryanmcgrath/twython
0c405604285364457f3c309969f11ba68163bd05
twython/endpoints.py
python
EndpointsMixin.get_contributees
(self, **params)
return self.get('users/contributees', params=params)
Returns a collection of users that the specified user can "contribute" to. Docs: https://dev.twitter.com/docs/api/1.1/get/users/contributees
Returns a collection of users that the specified user can "contribute" to.
[ "Returns", "a", "collection", "of", "users", "that", "the", "specified", "user", "can", "contribute", "to", "." ]
def get_contributees(self, **params): """Returns a collection of users that the specified user can "contribute" to. Docs: https://dev.twitter.com/docs/api/1.1/get/users/contributees """ return self.get('users/contributees', params=params)
[ "def", "get_contributees", "(", "self", ",", "*", "*", "params", ")", ":", "return", "self", ".", "get", "(", "'users/contributees'", ",", "params", "=", "params", ")" ]
https://github.com/ryanmcgrath/twython/blob/0c405604285364457f3c309969f11ba68163bd05/twython/endpoints.py#L640-L646
algorhythms/LeetCode
3fb14aeea62a960442e47dfde9f964c7ffce32be
128 Longest Consecutive Sequence.py
python
Solution.longestConsecutive_TLE
(self, num)
return max_length
O(n) within in one scan algorithm: array, inverted index O(kn), k is the length of consecutive sequence TLE due to excessive lookup :param num: a list of integer :return: an integer
O(n) within in one scan algorithm: array, inverted index O(kn), k is the length of consecutive sequence
[ "O", "(", "n", ")", "within", "in", "one", "scan", "algorithm", ":", "array", "inverted", "index", "O", "(", "kn", ")", "k", "is", "the", "length", "of", "consecutive", "sequence" ]
def longestConsecutive_TLE(self, num): """ O(n) within in one scan algorithm: array, inverted index O(kn), k is the length of consecutive sequence TLE due to excessive lookup :param num: a list of integer :return: an integer """ length = len(num)...
[ "def", "longestConsecutive_TLE", "(", "self", ",", "num", ")", ":", "length", "=", "len", "(", "num", ")", "inverted_table", "=", "dict", "(", "zip", "(", "num", ",", "range", "(", "length", ")", ")", ")", "max_length", "=", "-", "1", "<<", "31", "...
https://github.com/algorhythms/LeetCode/blob/3fb14aeea62a960442e47dfde9f964c7ffce32be/128 Longest Consecutive Sequence.py#L12-L43
sagemath/sage
f9b2db94f675ff16963ccdefba4f1a3393b3fe0d
src/sage/algebras/lie_algebras/structure_coefficients.py
python
LieAlgebraWithStructureCoefficients.__init__
(self, R, s_coeff, names, index_set, category=None, prefix=None, bracket=None, latex_bracket=None, string_quotes=None, **kwds)
Initialize ``self``. EXAMPLES:: sage: L = LieAlgebra(QQ, 'x,y', {('x','y'): {'x':1}}) sage: TestSuite(L).run()
Initialize ``self``.
[ "Initialize", "self", "." ]
def __init__(self, R, s_coeff, names, index_set, category=None, prefix=None, bracket=None, latex_bracket=None, string_quotes=None, **kwds): """ Initialize ``self``. EXAMPLES:: sage: L = LieAlgebra(QQ, 'x,y', {('x','y'): {'x':1}}) sage: TestSuite(L).run(...
[ "def", "__init__", "(", "self", ",", "R", ",", "s_coeff", ",", "names", ",", "index_set", ",", "category", "=", "None", ",", "prefix", "=", "None", ",", "bracket", "=", "None", ",", "latex_bracket", "=", "None", ",", "string_quotes", "=", "None", ",", ...
https://github.com/sagemath/sage/blob/f9b2db94f675ff16963ccdefba4f1a3393b3fe0d/src/sage/algebras/lie_algebras/structure_coefficients.py#L191-L237
IJDykeman/wangTiles
7c1ee2095ebdf7f72bce07d94c6484915d5cae8b
experimental_code/tiles_3d/venv_mac_py3/lib/python2.7/site-packages/pip/_internal/utils/ui.py
python
InterruptibleMixin.__init__
(self, *args, **kwargs)
Save the original SIGINT handler for later.
Save the original SIGINT handler for later.
[ "Save", "the", "original", "SIGINT", "handler", "for", "later", "." ]
def __init__(self, *args, **kwargs): """ Save the original SIGINT handler for later. """ super(InterruptibleMixin, self).__init__(*args, **kwargs) self.original_handler = signal(SIGINT, self.handle_sigint) # If signal() returns None, the previous handler was not install...
[ "def", "__init__", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "super", "(", "InterruptibleMixin", ",", "self", ")", ".", "__init__", "(", "*", "args", ",", "*", "*", "kwargs", ")", "self", ".", "original_handler", "=", "signal"...
https://github.com/IJDykeman/wangTiles/blob/7c1ee2095ebdf7f72bce07d94c6484915d5cae8b/experimental_code/tiles_3d/venv_mac_py3/lib/python2.7/site-packages/pip/_internal/utils/ui.py#L84-L98
fritzy/SleekXMPP
cc1d470397de768ffcc41d2ed5ac3118d19f09f5
sleekxmpp/plugins/xep_0009/remote.py
python
RemoteSession.__init__
(self, client, session_close_callback)
Initializes a new RPC session. Arguments: client -- The SleekXMPP client associated with this session. session_close_callback -- A callback called when the session is closed.
Initializes a new RPC session.
[ "Initializes", "a", "new", "RPC", "session", "." ]
def __init__(self, client, session_close_callback): ''' Initializes a new RPC session. Arguments: client -- The SleekXMPP client associated with this session. session_close_callback -- A callback called when the session is closed. ''' self...
[ "def", "__init__", "(", "self", ",", "client", ",", "session_close_callback", ")", ":", "self", ".", "_client", "=", "client", "self", ".", "_session_close_callback", "=", "session_close_callback", "self", ".", "_event", "=", "threading", ".", "Event", "(", ")...
https://github.com/fritzy/SleekXMPP/blob/cc1d470397de768ffcc41d2ed5ac3118d19f09f5/sleekxmpp/plugins/xep_0009/remote.py#L470-L485
kokjo/universalrop
6b675445b9a6a5d58af03efc796ce597c49d60bd
unirop.py
python
RealGadget.analyse
(self)
[]
def analyse(self): ip = self.arch.instruction_pointer sp = self.arch.stack_pointer emu = Emulator(self.arch) emu.map_code(self.address, self.code) stack = get_random_page(self.arch) stack_data = randoms(self.arch.page_size) emu.setup_stack( stac...
[ "def", "analyse", "(", "self", ")", ":", "ip", "=", "self", ".", "arch", ".", "instruction_pointer", "sp", "=", "self", ".", "arch", ".", "stack_pointer", "emu", "=", "Emulator", "(", "self", ".", "arch", ")", "emu", ".", "map_code", "(", "self", "."...
https://github.com/kokjo/universalrop/blob/6b675445b9a6a5d58af03efc796ce597c49d60bd/unirop.py#L141-L181
AppScale/gts
46f909cf5dc5ba81faf9d81dc9af598dcf8a82a9
AppServer/google/appengine/datastore/datastore_v4_pb.py
python
_DatastoreV4Service_ClientBaseStub.BeginTransaction
(self, request, rpc=None, callback=None, response=None)
return self._MakeCall(rpc, self._full_name_BeginTransaction, 'BeginTransaction', request, response, callback, self._protorpc_BeginTransaction)
Make a BeginTransaction RPC call. Args: request: a BeginTransactionRequest instance. rpc: Optional RPC instance to use for the call. callback: Optional final callback. Will be called as callback(rpc, result) when the rpc completes. If None, the call is synchronous. respo...
Make a BeginTransaction RPC call.
[ "Make", "a", "BeginTransaction", "RPC", "call", "." ]
def BeginTransaction(self, request, rpc=None, callback=None, response=None): """Make a BeginTransaction RPC call. Args: request: a BeginTransactionRequest instance. rpc: Optional RPC instance to use for the call. callback: Optional final callback. Will be called as callback(rpc, res...
[ "def", "BeginTransaction", "(", "self", ",", "request", ",", "rpc", "=", "None", ",", "callback", "=", "None", ",", "response", "=", "None", ")", ":", "if", "response", "is", "None", ":", "response", "=", "BeginTransactionResponse", "return", "self", ".", ...
https://github.com/AppScale/gts/blob/46f909cf5dc5ba81faf9d81dc9af598dcf8a82a9/AppServer/google/appengine/datastore/datastore_v4_pb.py#L6325-L6348
jupyter/nbconvert
b645841af220922f67684acd03e0a8f39e613648
nbconvert/filters/strings.py
python
text_base64
(text)
return base64.b64encode(text.encode()).decode()
Encode base64 text
Encode base64 text
[ "Encode", "base64", "text" ]
def text_base64(text): """ Encode base64 text """ return base64.b64encode(text.encode()).decode()
[ "def", "text_base64", "(", "text", ")", ":", "return", "base64", ".", "b64encode", "(", "text", ".", "encode", "(", ")", ")", ".", "decode", "(", ")" ]
https://github.com/jupyter/nbconvert/blob/b645841af220922f67684acd03e0a8f39e613648/nbconvert/filters/strings.py#L255-L259
holzschu/Carnets
44effb10ddfc6aa5c8b0687582a724ba82c6b547
Library/lib/python3.7/site-packages/prompt_toolkit/layout/containers.py
python
WindowRenderInfo.cursor_position
(self)
Return the cursor position coordinates, relative to the left/top corner of the rendered screen.
Return the cursor position coordinates, relative to the left/top corner of the rendered screen.
[ "Return", "the", "cursor", "position", "coordinates", "relative", "to", "the", "left", "/", "top", "corner", "of", "the", "rendered", "screen", "." ]
def cursor_position(self): """ Return the cursor position coordinates, relative to the left/top corner of the rendered screen. """ cpos = self.ui_content.cursor_position try: y, x = self._rowcol_to_yx[cpos.y, cpos.x] except KeyError: # For ...
[ "def", "cursor_position", "(", "self", ")", ":", "cpos", "=", "self", ".", "ui_content", ".", "cursor_position", "try", ":", "y", ",", "x", "=", "self", ".", "_rowcol_to_yx", "[", "cpos", ".", "y", ",", "cpos", ".", "x", "]", "except", "KeyError", ":...
https://github.com/holzschu/Carnets/blob/44effb10ddfc6aa5c8b0687582a724ba82c6b547/Library/lib/python3.7/site-packages/prompt_toolkit/layout/containers.py#L955-L968
PaddlePaddle/PaddleSpeech
26524031d242876b7fdb71582b0b3a7ea45c7d9d
paddlespeech/t2s/frontend/zh_normalization/chronology.py
python
_time_num2str
(num_string: str)
return result
A special case for verbalizing number in time.
A special case for verbalizing number in time.
[ "A", "special", "case", "for", "verbalizing", "number", "in", "time", "." ]
def _time_num2str(num_string: str) -> str: """A special case for verbalizing number in time.""" result = num2str(num_string.lstrip('0')) if num_string.startswith('0'): result = DIGITS['0'] + result return result
[ "def", "_time_num2str", "(", "num_string", ":", "str", ")", "->", "str", ":", "result", "=", "num2str", "(", "num_string", ".", "lstrip", "(", "'0'", ")", ")", "if", "num_string", ".", "startswith", "(", "'0'", ")", ":", "result", "=", "DIGITS", "[", ...
https://github.com/PaddlePaddle/PaddleSpeech/blob/26524031d242876b7fdb71582b0b3a7ea45c7d9d/paddlespeech/t2s/frontend/zh_normalization/chronology.py#L22-L27
Cog-Creators/Red-DiscordBot
b05933274a11fb097873ab0d1b246d37b06aa306
redbot/core/config.py
python
Config._all_from_scope
(self, scope: str)
return ret
Get a dict of all values from a particular scope of data. :code:`scope` must be one of the constants attributed to this class, i.e. :code:`GUILD`, :code:`MEMBER` et cetera. IDs as keys in the returned dict are casted to `int` for convenience. Default values are also mixed into the dat...
Get a dict of all values from a particular scope of data.
[ "Get", "a", "dict", "of", "all", "values", "from", "a", "particular", "scope", "of", "data", "." ]
async def _all_from_scope(self, scope: str) -> Dict[int, Dict[Any, Any]]: """Get a dict of all values from a particular scope of data. :code:`scope` must be one of the constants attributed to this class, i.e. :code:`GUILD`, :code:`MEMBER` et cetera. IDs as keys in the returned dict are...
[ "async", "def", "_all_from_scope", "(", "self", ",", "scope", ":", "str", ")", "->", "Dict", "[", "int", ",", "Dict", "[", "Any", ",", "Any", "]", "]", ":", "group", "=", "self", ".", "_get_base_group", "(", "scope", ")", "ret", "=", "{", "}", "d...
https://github.com/Cog-Creators/Red-DiscordBot/blob/b05933274a11fb097873ab0d1b246d37b06aa306/redbot/core/config.py#L1133-L1158
giswqs/whitebox-python
b4df0bbb10a1dee3bd0f6b3482511f7c829b38fe
whitebox/whitebox_tools.py
python
WhiteboxTools.ln
(self, i, output, callback=None)
return self.run_tool('ln', args, callback)
Returns the natural logarithm of values in a raster. Keyword arguments: i -- Input raster file. output -- Output raster file. callback -- Custom function for handling tool text outputs.
Returns the natural logarithm of values in a raster.
[ "Returns", "the", "natural", "logarithm", "of", "values", "in", "a", "raster", "." ]
def ln(self, i, output, callback=None): """Returns the natural logarithm of values in a raster. Keyword arguments: i -- Input raster file. output -- Output raster file. callback -- Custom function for handling tool text outputs. """ args = [] args.appe...
[ "def", "ln", "(", "self", ",", "i", ",", "output", ",", "callback", "=", "None", ")", ":", "args", "=", "[", "]", "args", ".", "append", "(", "\"--input='{}'\"", ".", "format", "(", "i", ")", ")", "args", ".", "append", "(", "\"--output='{}'\"", "....
https://github.com/giswqs/whitebox-python/blob/b4df0bbb10a1dee3bd0f6b3482511f7c829b38fe/whitebox/whitebox_tools.py#L8121-L8133
ApostropheEditor/Apostrophe
cc30858c15f3408296d73202497d3cdef5a46064
apostrophe/inline_preview.py
python
InlinePreview.get_view_for_lexikon
(self, match)
return None
[]
def get_view_for_lexikon(self, match): term = match.group("text") lexikon_dict = get_dictionary(term) if lexikon_dict: grid = Gtk.Grid.new() grid.get_style_context().add_class("lexikon") grid.set_row_spacing(2) grid.set_column_spacing(4) ...
[ "def", "get_view_for_lexikon", "(", "self", ",", "match", ")", ":", "term", "=", "match", ".", "group", "(", "\"text\"", ")", "lexikon_dict", "=", "get_dictionary", "(", "term", ")", "if", "lexikon_dict", ":", "grid", "=", "Gtk", ".", "Grid", ".", "new",...
https://github.com/ApostropheEditor/Apostrophe/blob/cc30858c15f3408296d73202497d3cdef5a46064/apostrophe/inline_preview.py#L247-L297
postgres/pgadmin4
374c5e952fa594d749fadf1f88076c1cba8c5f64
web/pgadmin/browser/server_groups/servers/databases/schemas/functions/__init__.py
python
FunctionView.sql
(self, gid, sid, did, scid, fnid=None, **kwargs)
return ajax_response(response=sql)
Returns the SQL for the Function object. Args: gid: Server Group Id sid: Server Id did: Database Id scid: Schema Id fnid: Function Id json_resp:
Returns the SQL for the Function object.
[ "Returns", "the", "SQL", "for", "the", "Function", "object", "." ]
def sql(self, gid, sid, did, scid, fnid=None, **kwargs): """ Returns the SQL for the Function object. Args: gid: Server Group Id sid: Server Id did: Database Id scid: Schema Id fnid: Function Id json_resp: """ ...
[ "def", "sql", "(", "self", ",", "gid", ",", "sid", ",", "did", ",", "scid", ",", "fnid", "=", "None", ",", "*", "*", "kwargs", ")", ":", "json_resp", "=", "kwargs", ".", "get", "(", "'json_resp'", ",", "True", ")", "target_schema", "=", "kwargs", ...
https://github.com/postgres/pgadmin4/blob/374c5e952fa594d749fadf1f88076c1cba8c5f64/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/__init__.py#L1143-L1239
openhatch/oh-mainline
ce29352a034e1223141dcc2f317030bbc3359a51
vendor/packages/django-tastypie/tastypie/utils/formatting.py
python
format_time
(t)
return dateformat.format(dt, 'H:i:s O')
RFC 2822 time formatter
RFC 2822 time formatter
[ "RFC", "2822", "time", "formatter" ]
def format_time(t): """ RFC 2822 time formatter """ # again, workaround dateformat input requirement dt = aware_datetime(2000, 1, 1, t.hour, t.minute, t.second) return dateformat.format(dt, 'H:i:s O')
[ "def", "format_time", "(", "t", ")", ":", "# again, workaround dateformat input requirement", "dt", "=", "aware_datetime", "(", "2000", ",", "1", ",", "1", ",", "t", ".", "hour", ",", "t", ".", "minute", ",", "t", ".", "second", ")", "return", "dateformat"...
https://github.com/openhatch/oh-mainline/blob/ce29352a034e1223141dcc2f317030bbc3359a51/vendor/packages/django-tastypie/tastypie/utils/formatting.py#L31-L37
huggingface/transformers
623b4f7c63f60cce917677ee704d6c93ee960b4b
src/transformers/utils/dummy_pt_objects.py
python
UniSpeechSatForSequenceClassification.from_pretrained
(cls, *args, **kwargs)
[]
def from_pretrained(cls, *args, **kwargs): requires_backends(cls, ["torch"])
[ "def", "from_pretrained", "(", "cls", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "requires_backends", "(", "cls", ",", "[", "\"torch\"", "]", ")" ]
https://github.com/huggingface/transformers/blob/623b4f7c63f60cce917677ee704d6c93ee960b4b/src/transformers/utils/dummy_pt_objects.py#L4955-L4956
spyder-ide/spyder
55da47c032dfcf519600f67f8b30eab467f965e7
external-deps/qdarkstyle/qdarkstyle/utils/scss.py
python
_create_scss_variables
(variables_scss_filepath, palette, header=HEADER_SCSS)
Create a scss variables file.
Create a scss variables file.
[ "Create", "a", "scss", "variables", "file", "." ]
def _create_scss_variables(variables_scss_filepath, palette, header=HEADER_SCSS): """Create a scss variables file.""" scss = _dict_to_scss(palette.to_dict()) data = header.format(qtsass.__version__) + scss + '\n' with open(variables_scss_filepath, 'w') as f: f.write(d...
[ "def", "_create_scss_variables", "(", "variables_scss_filepath", ",", "palette", ",", "header", "=", "HEADER_SCSS", ")", ":", "scss", "=", "_dict_to_scss", "(", "palette", ".", "to_dict", "(", ")", ")", "data", "=", "header", ".", "format", "(", "qtsass", "....
https://github.com/spyder-ide/spyder/blob/55da47c032dfcf519600f67f8b30eab467f965e7/external-deps/qdarkstyle/qdarkstyle/utils/scss.py#L81-L88
llSourcell/AI_Artist
3038c06c2e389b9c919c881c9a169efe2fd7810e
lib/python2.7/site-packages/setuptools/command/build_py.py
python
build_py.build_package_data
(self)
Copy data files into build directory
Copy data files into build directory
[ "Copy", "data", "files", "into", "build", "directory" ]
def build_package_data(self): """Copy data files into build directory""" for package, src_dir, build_dir, filenames in self.data_files: for filename in filenames: target = os.path.join(build_dir, filename) self.mkpath(os.path.dirname(target)) s...
[ "def", "build_package_data", "(", "self", ")", ":", "for", "package", ",", "src_dir", ",", "build_dir", ",", "filenames", "in", "self", ".", "data_files", ":", "for", "filename", "in", "filenames", ":", "target", "=", "os", ".", "path", ".", "join", "(",...
https://github.com/llSourcell/AI_Artist/blob/3038c06c2e389b9c919c881c9a169efe2fd7810e/lib/python2.7/site-packages/setuptools/command/build_py.py#L111-L122
openshift/openshift-tools
1188778e728a6e4781acf728123e5b356380fe6f
openshift/installer/vendored/openshift-ansible-3.9.40/roles/openshift_health_checker/openshift_checks/logging/fluentd.py
python
Fluentd.get_nodes_by_name
(self)
return { node['metadata']['name']: node for node in nodes['items'] }
Retrieve all the node definitions. Returns: dict(name: node)
Retrieve all the node definitions. Returns: dict(name: node)
[ "Retrieve", "all", "the", "node", "definitions", ".", "Returns", ":", "dict", "(", "name", ":", "node", ")" ]
def get_nodes_by_name(self): """Retrieve all the node definitions. Returns: dict(name: node)""" nodes_json = self.exec_oc("get nodes -o json", []) try: nodes = json.loads(nodes_json) except ValueError: # no valid json - should not happen raise OpenShiftCheckExcep...
[ "def", "get_nodes_by_name", "(", "self", ")", ":", "nodes_json", "=", "self", ".", "exec_oc", "(", "\"get nodes -o json\"", ",", "[", "]", ")", "try", ":", "nodes", "=", "json", ".", "loads", "(", "nodes_json", ")", "except", "ValueError", ":", "# no valid...
https://github.com/openshift/openshift-tools/blob/1188778e728a6e4781acf728123e5b356380fe6f/openshift/installer/vendored/openshift-ansible-3.9.40/roles/openshift_health_checker/openshift_checks/logging/fluentd.py#L50-L69
playframework/play1
0ecac3bc2421ae2dbec27a368bf671eda1c9cba5
python/Lib/site-packages/win32/lib/regutil.py
python
RegisterHelpFile
(helpFile, helpPath, helpDesc = None, bCheckFile = 1)
Register a help file in the registry. Note that this used to support writing to the Windows Help key, however this is no longer done, as it seems to be incompatible. helpFile -- the base name of the help file. helpPath -- the path to the help file helpDesc -- A descriptio...
Register a help file in the registry. Note that this used to support writing to the Windows Help key, however this is no longer done, as it seems to be incompatible.
[ "Register", "a", "help", "file", "in", "the", "registry", ".", "Note", "that", "this", "used", "to", "support", "writing", "to", "the", "Windows", "Help", "key", "however", "this", "is", "no", "longer", "done", "as", "it", "seems", "to", "be", "incompati...
def RegisterHelpFile(helpFile, helpPath, helpDesc = None, bCheckFile = 1): """Register a help file in the registry. Note that this used to support writing to the Windows Help key, however this is no longer done, as it seems to be incompatible. helpFile -- the base name of the help file. ...
[ "def", "RegisterHelpFile", "(", "helpFile", ",", "helpPath", ",", "helpDesc", "=", "None", ",", "bCheckFile", "=", "1", ")", ":", "if", "helpDesc", "is", "None", ":", "helpDesc", "=", "helpFile", "fullHelpFile", "=", "os", ".", "path", ".", "join", "(", ...
https://github.com/playframework/play1/blob/0ecac3bc2421ae2dbec27a368bf671eda1c9cba5/python/Lib/site-packages/win32/lib/regutil.py#L171-L190
ajinabraham/OWASP-Xenotix-XSS-Exploit-Framework
cb692f527e4e819b6c228187c5702d990a180043
external/Scripting Engine/Xenotix Python Scripting Engine/Lib/numbers.py
python
Integral.__ror__
(self, other)
other | self
other | self
[ "other", "|", "self" ]
def __ror__(self, other): """other | self""" raise NotImplementedError
[ "def", "__ror__", "(", "self", ",", "other", ")", ":", "raise", "NotImplementedError" ]
https://github.com/ajinabraham/OWASP-Xenotix-XSS-Exploit-Framework/blob/cb692f527e4e819b6c228187c5702d990a180043/external/Scripting Engine/Xenotix Python Scripting Engine/Lib/numbers.py#L366-L368
xiaobai1217/MBMD
246f3434bccb9c8357e0f698995b659578bf1afb
lib/slim/datasets/flowers.py
python
get_split
(split_name, dataset_dir, file_pattern=None, reader=None)
return slim.dataset.Dataset( data_sources=file_pattern, reader=reader, decoder=decoder, num_samples=SPLITS_TO_SIZES[split_name], items_to_descriptions=_ITEMS_TO_DESCRIPTIONS, num_classes=_NUM_CLASSES, labels_to_names=labels_to_names)
Gets a dataset tuple with instructions for reading flowers. Args: split_name: A train/validation split name. dataset_dir: The base directory of the dataset sources. file_pattern: The file pattern to use when matching the dataset sources. It is assumed that the pattern contains a '%s' string so that...
Gets a dataset tuple with instructions for reading flowers.
[ "Gets", "a", "dataset", "tuple", "with", "instructions", "for", "reading", "flowers", "." ]
def get_split(split_name, dataset_dir, file_pattern=None, reader=None): """Gets a dataset tuple with instructions for reading flowers. Args: split_name: A train/validation split name. dataset_dir: The base directory of the dataset sources. file_pattern: The file pattern to use when matching the dataset...
[ "def", "get_split", "(", "split_name", ",", "dataset_dir", ",", "file_pattern", "=", "None", ",", "reader", "=", "None", ")", ":", "if", "split_name", "not", "in", "SPLITS_TO_SIZES", ":", "raise", "ValueError", "(", "'split name %s was not recognized.'", "%", "s...
https://github.com/xiaobai1217/MBMD/blob/246f3434bccb9c8357e0f698995b659578bf1afb/lib/slim/datasets/flowers.py#L44-L98
domlysz/BlenderGIS
0c00bc361d05599467174b8721d4cfeb4c3db608
operators/view3d_mapviewer.py
python
BaseMap.place
(self)
Set map as background image
Set map as background image
[ "Set", "map", "as", "background", "image" ]
def place(self): '''Set map as background image''' #Get or load bpy image try: self.img = [img for img in bpy.data.images if img.filepath == self.imgPath and len(img.packed_files) == 0][0] except IndexError: self.img = bpy.data.images.load(self.imgPath) #Get or load background image empties = [obj f...
[ "def", "place", "(", "self", ")", ":", "#Get or load bpy image", "try", ":", "self", ".", "img", "=", "[", "img", "for", "img", "in", "bpy", ".", "data", ".", "images", "if", "img", ".", "filepath", "==", "self", ".", "imgPath", "and", "len", "(", ...
https://github.com/domlysz/BlenderGIS/blob/0c00bc361d05599467174b8721d4cfeb4c3db608/operators/view3d_mapviewer.py#L216-L283
Miserlou/Zappa
5a11c17f5ecf0568bdb73b4baf6fb08ff0184f39
zappa/utilities.py
python
is_valid_bucket_name
(name)
return True
Checks if an S3 bucket name is valid according to https://docs.aws.amazon.com/AmazonS3/latest/dev/BucketRestrictions.html#bucketnamingrules
Checks if an S3 bucket name is valid according to https://docs.aws.amazon.com/AmazonS3/latest/dev/BucketRestrictions.html#bucketnamingrules
[ "Checks", "if", "an", "S3", "bucket", "name", "is", "valid", "according", "to", "https", ":", "//", "docs", ".", "aws", ".", "amazon", ".", "com", "/", "AmazonS3", "/", "latest", "/", "dev", "/", "BucketRestrictions", ".", "html#bucketnamingrules" ]
def is_valid_bucket_name(name): """ Checks if an S3 bucket name is valid according to https://docs.aws.amazon.com/AmazonS3/latest/dev/BucketRestrictions.html#bucketnamingrules """ # Bucket names must be at least 3 and no more than 63 characters long. if (len(name) < 3 or len(name) > 63): ret...
[ "def", "is_valid_bucket_name", "(", "name", ")", ":", "# Bucket names must be at least 3 and no more than 63 characters long.", "if", "(", "len", "(", "name", ")", "<", "3", "or", "len", "(", "name", ")", ">", "63", ")", ":", "return", "False", "# Bucket names mus...
https://github.com/Miserlou/Zappa/blob/5a11c17f5ecf0568bdb73b4baf6fb08ff0184f39/zappa/utilities.py#L534-L567
UFAL-DSG/tgen
3c43c0e29faa7ea3857a6e490d9c28a8daafc7d0
tgen/candgen.py
python
RandomCandidateGenerator.can_generate_greedy
(self, tree, da)
return True
Check if the candidate generator can generate a given tree greedily, always pursuing the first viable path. This is for debugging purposes only. Uses `get_all_successors` and always goes on with the first one that increases coverage of the current tree.
Check if the candidate generator can generate a given tree greedily, always pursuing the first viable path.
[ "Check", "if", "the", "candidate", "generator", "can", "generate", "a", "given", "tree", "greedily", "always", "pursuing", "the", "first", "viable", "path", "." ]
def can_generate_greedy(self, tree, da): """Check if the candidate generator can generate a given tree greedily, always pursuing the first viable path. This is for debugging purposes only. Uses `get_all_successors` and always goes on with the first one that increases coverage of...
[ "def", "can_generate_greedy", "(", "self", ",", "tree", ",", "da", ")", ":", "self", ".", "init_run", "(", "da", ")", "cur_subtree", "=", "TreeData", "(", ")", "found", "=", "True", "while", "found", "and", "cur_subtree", "!=", "tree", ":", "found", "=...
https://github.com/UFAL-DSG/tgen/blob/3c43c0e29faa7ea3857a6e490d9c28a8daafc7d0/tgen/candgen.py#L484-L512
iagcl/watchmen
d329b357e6fde3ad91e972988b160a33c12afc2a
verification_rules/check_cloudtrail/check_cloudtrail.py
python
lambda_handler
(event, context)
Entrypoint for lambda function. Args: event: lambda event context: lambda context
Entrypoint for lambda function.
[ "Entrypoint", "for", "lambda", "function", "." ]
def lambda_handler(event, context): """Entrypoint for lambda function. Args: event: lambda event context: lambda context """ citizen_exec_role_arn = event["citizen_exec_role_arn"] event = event["config_event"] logger.log_event(event, context, None, None) invoking_event = j...
[ "def", "lambda_handler", "(", "event", ",", "context", ")", ":", "citizen_exec_role_arn", "=", "event", "[", "\"citizen_exec_role_arn\"", "]", "event", "=", "event", "[", "\"config_event\"", "]", "logger", ".", "log_event", "(", "event", ",", "context", ",", "...
https://github.com/iagcl/watchmen/blob/d329b357e6fde3ad91e972988b160a33c12afc2a/verification_rules/check_cloudtrail/check_cloudtrail.py#L47-L85
bigboNed3/bert_serving
44d33920da6888cf91cb72e6c7b27c7b0c7d8815
run_classifier.py
python
create_model
(bert_config, is_training, input_ids, input_mask, segment_ids, labels, num_labels, use_one_hot_embeddings)
Creates a classification model.
Creates a classification model.
[ "Creates", "a", "classification", "model", "." ]
def create_model(bert_config, is_training, input_ids, input_mask, segment_ids, labels, num_labels, use_one_hot_embeddings): """Creates a classification model.""" model = modeling.BertModel( config=bert_config, is_training=is_training, input_ids=input_ids, input_m...
[ "def", "create_model", "(", "bert_config", ",", "is_training", ",", "input_ids", ",", "input_mask", ",", "segment_ids", ",", "labels", ",", "num_labels", ",", "use_one_hot_embeddings", ")", ":", "model", "=", "modeling", ".", "BertModel", "(", "config", "=", "...
https://github.com/bigboNed3/bert_serving/blob/44d33920da6888cf91cb72e6c7b27c7b0c7d8815/run_classifier.py#L582-L624
zhl2008/awd-platform
0416b31abea29743387b10b3914581fbe8e7da5e
web_flaskbb/lib/python2.7/site-packages/whoosh/analysis/filters.py
python
Filter.__ne__
(self, other)
return not self == other
[]
def __ne__(self, other): return not self == other
[ "def", "__ne__", "(", "self", ",", "other", ")", ":", "return", "not", "self", "==", "other" ]
https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_flaskbb/lib/python2.7/site-packages/whoosh/analysis/filters.py#L77-L78
twilio/twilio-python
6e1e811ea57a1edfadd5161ace87397c563f6915
twilio/rest/verify/__init__.py
python
Verify.v2
(self)
return self._v2
:returns: Version v2 of verify :rtype: twilio.rest.verify.v2.V2
:returns: Version v2 of verify :rtype: twilio.rest.verify.v2.V2
[ ":", "returns", ":", "Version", "v2", "of", "verify", ":", "rtype", ":", "twilio", ".", "rest", ".", "verify", ".", "v2", ".", "V2" ]
def v2(self): """ :returns: Version v2 of verify :rtype: twilio.rest.verify.v2.V2 """ if self._v2 is None: self._v2 = V2(self) return self._v2
[ "def", "v2", "(", "self", ")", ":", "if", "self", ".", "_v2", "is", "None", ":", "self", ".", "_v2", "=", "V2", "(", "self", ")", "return", "self", ".", "_v2" ]
https://github.com/twilio/twilio-python/blob/6e1e811ea57a1edfadd5161ace87397c563f6915/twilio/rest/verify/__init__.py#L30-L37
boto/boto
b2a6f08122b2f1b89888d2848e730893595cd001
boto/opsworks/layer1.py
python
OpsWorksConnection.create_layer
(self, stack_id, type, name, shortname, attributes=None, custom_instance_profile_arn=None, custom_security_group_ids=None, packages=None, volume_configurations=None, enable_auto_healing=None, auto_assign_elastic_ips=None, ...
return self.make_request(action='CreateLayer', body=json.dumps(params))
Creates a layer. For more information, see `How to Create a Layer`_. You should use **CreateLayer** for noncustom layer types such as PHP App Server only if the stack does not have an existing layer of that type. A stack can have at most one instance of each noncustom layer; if...
Creates a layer. For more information, see `How to Create a Layer`_.
[ "Creates", "a", "layer", ".", "For", "more", "information", "see", "How", "to", "Create", "a", "Layer", "_", "." ]
def create_layer(self, stack_id, type, name, shortname, attributes=None, custom_instance_profile_arn=None, custom_security_group_ids=None, packages=None, volume_configurations=None, enable_auto_healing=None, auto_assign_elastic_ips=None...
[ "def", "create_layer", "(", "self", ",", "stack_id", ",", "type", ",", "name", ",", "shortname", ",", "attributes", "=", "None", ",", "custom_instance_profile_arn", "=", "None", ",", "custom_security_group_ids", "=", "None", ",", "packages", "=", "None", ",", ...
https://github.com/boto/boto/blob/b2a6f08122b2f1b89888d2848e730893595cd001/boto/opsworks/layer1.py#L757-L897
AppScale/gts
46f909cf5dc5ba81faf9d81dc9af598dcf8a82a9
AppServer/lib/django-1.2/django/core/urlresolvers.py
python
get_urlconf
(default=None)
return default
Returns the root URLconf to use for the current thread if it has been changed from the default one.
Returns the root URLconf to use for the current thread if it has been changed from the default one.
[ "Returns", "the", "root", "URLconf", "to", "use", "for", "the", "current", "thread", "if", "it", "has", "been", "changed", "from", "the", "default", "one", "." ]
def get_urlconf(default=None): """ Returns the root URLconf to use for the current thread if it has been changed from the default one. """ thread = currentThread() if thread in _urlconfs: return _urlconfs[thread] return default
[ "def", "get_urlconf", "(", "default", "=", "None", ")", ":", "thread", "=", "currentThread", "(", ")", "if", "thread", "in", "_urlconfs", ":", "return", "_urlconfs", "[", "thread", "]", "return", "default" ]
https://github.com/AppScale/gts/blob/46f909cf5dc5ba81faf9d81dc9af598dcf8a82a9/AppServer/lib/django-1.2/django/core/urlresolvers.py#L388-L396
nucleic/enaml
65c2a2a2d765e88f2e1103046680571894bb41ed
enaml/core/code_tracing.py
python
CodeTracer.return_value
(self, value)
Called before the RETURN_VALUE opcode is executed. Parameters ---------- value : object The value that will be returned from the code object.
Called before the RETURN_VALUE opcode is executed.
[ "Called", "before", "the", "RETURN_VALUE", "opcode", "is", "executed", "." ]
def return_value(self, value): """ Called before the RETURN_VALUE opcode is executed. Parameters ---------- value : object The value that will be returned from the code object. """ pass
[ "def", "return_value", "(", "self", ",", "value", ")", ":", "pass" ]
https://github.com/nucleic/enaml/blob/65c2a2a2d765e88f2e1103046680571894bb41ed/enaml/core/code_tracing.py#L107-L116
jaywink/socialhome
c3178b044936a5c57a502ab6ed2b4f43c8e076ca
socialhome/content/management/commands/create_dummy_content.py
python
Command.handle
(self, *args, **options)
Create dummy content.
Create dummy content.
[ "Create", "dummy", "content", "." ]
def handle(self, *args, **options): """Create dummy content.""" for i in range(options["amount"]): content = PublicContentFactory() print("Created content: %s" % content) user_email = options["user_email"] if user_email is not None: user = User.objec...
[ "def", "handle", "(", "self", ",", "*", "args", ",", "*", "*", "options", ")", ":", "for", "i", "in", "range", "(", "options", "[", "\"amount\"", "]", ")", ":", "content", "=", "PublicContentFactory", "(", ")", "print", "(", "\"Created content: %s\"", ...
https://github.com/jaywink/socialhome/blob/c3178b044936a5c57a502ab6ed2b4f43c8e076ca/socialhome/content/management/commands/create_dummy_content.py#L17-L41
AppScale/gts
46f909cf5dc5ba81faf9d81dc9af598dcf8a82a9
AppServer/lib/django-1.5/django/contrib/gis/db/backends/postgis/operations.py
python
PostGISOperations.postgis_version_tuple
(self)
return (version, major, minor1, minor2)
Returns the PostGIS version as a tuple (version string, major, minor, subminor).
Returns the PostGIS version as a tuple (version string, major, minor, subminor).
[ "Returns", "the", "PostGIS", "version", "as", "a", "tuple", "(", "version", "string", "major", "minor", "subminor", ")", "." ]
def postgis_version_tuple(self): """ Returns the PostGIS version as a tuple (version string, major, minor, subminor). """ # Getting the PostGIS version version = self.postgis_lib_version() m = self.version_regex.match(version) if m: major = in...
[ "def", "postgis_version_tuple", "(", "self", ")", ":", "# Getting the PostGIS version", "version", "=", "self", ".", "postgis_lib_version", "(", ")", "m", "=", "self", ".", "version_regex", ".", "match", "(", "version", ")", "if", "m", ":", "major", "=", "in...
https://github.com/AppScale/gts/blob/46f909cf5dc5ba81faf9d81dc9af598dcf8a82a9/AppServer/lib/django-1.5/django/contrib/gis/db/backends/postgis/operations.py#L438-L454