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
SanPen/GridCal
d3f4566d2d72c11c7e910c9d162538ef0e60df31
src/GridCal/ThirdParty/pulp/pulp.py
python
permutation
(orgset, k=None)
returns an iterator that lists the permutations of orgset of length k :param orgset: the list to be iterated :param k: the cardinality of the subsets :return: an iterator of the subsets example: >>> c = permutation([1,2,3,4],2) >>> for s in c: ... print(s) (1, 2) (1, 3) ...
returns an iterator that lists the permutations of orgset of length k
[ "returns", "an", "iterator", "that", "lists", "the", "permutations", "of", "orgset", "of", "length", "k" ]
def permutation(orgset, k=None): """ returns an iterator that lists the permutations of orgset of length k :param orgset: the list to be iterated :param k: the cardinality of the subsets :return: an iterator of the subsets example: >>> c = permutation([1,2,3,4],2) >>> for s in c:...
[ "def", "permutation", "(", "orgset", ",", "k", "=", "None", ")", ":", "try", ":", "from", "itertools", "import", "permutation", "as", "_it_permutation", "return", "_it_permutation", "(", "orgset", ",", "k", ")", "except", "ImportError", ":", "return", "__per...
https://github.com/SanPen/GridCal/blob/d3f4566d2d72c11c7e910c9d162538ef0e60df31/src/GridCal/ThirdParty/pulp/pulp.py#L2207-L2239
IronLanguages/ironpython2
51fdedeeda15727717fb8268a805f71b06c0b9f1
Src/StdLib/repackage/setuptools/setuptools/_vendor/pyparsing.py
python
ParserElement.__or__
(self, other )
return MatchFirst( [ self, other ] )
Implementation of | operator - returns C{L{MatchFirst}}
Implementation of | operator - returns C{L{MatchFirst}}
[ "Implementation", "of", "|", "operator", "-", "returns", "C", "{", "L", "{", "MatchFirst", "}}" ]
def __or__(self, other ): """ Implementation of | operator - returns C{L{MatchFirst}} """ if isinstance( other, basestring ): other = ParserElement._literalStringClass( other ) if not isinstance( other, ParserElement ): warnings.warn("Cannot combine elemen...
[ "def", "__or__", "(", "self", ",", "other", ")", ":", "if", "isinstance", "(", "other", ",", "basestring", ")", ":", "other", "=", "ParserElement", ".", "_literalStringClass", "(", "other", ")", "if", "not", "isinstance", "(", "other", ",", "ParserElement"...
https://github.com/IronLanguages/ironpython2/blob/51fdedeeda15727717fb8268a805f71b06c0b9f1/Src/StdLib/repackage/setuptools/setuptools/_vendor/pyparsing.py#L1948-L1958
rigetti/grove
dc6bf6ec63e8c435fe52b1e00f707d5ce4cdb9b3
grove/utils/utility_programs.py
python
ControlledProgramBuilder.with_operation
(self, operation)
return self
Sets the operation that defines the controlled gate. :param numpy.ndarray operation: The unitary gate to be controlled, given as a numpy array. :return: self, with operation set. :rtype: ControlledProgramBuilder
Sets the operation that defines the controlled gate.
[ "Sets", "the", "operation", "that", "defines", "the", "controlled", "gate", "." ]
def with_operation(self, operation): """Sets the operation that defines the controlled gate. :param numpy.ndarray operation: The unitary gate to be controlled, given as a numpy array. :return: self, with operation set. :rtype: ControlledProgramBuilder """ self.operation ...
[ "def", "with_operation", "(", "self", ",", "operation", ")", ":", "self", ".", "operation", "=", "operation", "return", "self" ]
https://github.com/rigetti/grove/blob/dc6bf6ec63e8c435fe52b1e00f707d5ce4cdb9b3/grove/utils/utility_programs.py#L76-L84
F8LEFT/DecLLVM
d38e45e3d0dd35634adae1d0cf7f96f3bd96e74c
python/idaapi.py
python
is_type_uchar
(*args)
return _idaapi.is_type_uchar(*args)
is_type_uchar(t) -> bool
is_type_uchar(t) -> bool
[ "is_type_uchar", "(", "t", ")", "-", ">", "bool" ]
def is_type_uchar(*args): """ is_type_uchar(t) -> bool """ return _idaapi.is_type_uchar(*args)
[ "def", "is_type_uchar", "(", "*", "args", ")", ":", "return", "_idaapi", ".", "is_type_uchar", "(", "*", "args", ")" ]
https://github.com/F8LEFT/DecLLVM/blob/d38e45e3d0dd35634adae1d0cf7f96f3bd96e74c/python/idaapi.py#L28460-L28464
allenai/document-qa
2f9fa6878b60ed8a8a31bcf03f802cde292fe48b
docqa/scripts/train_bidaf.py
python
main
()
A close-as-possible impelemntation of BiDaF, its based on the `dev` tensorflow 1.1 branch of Ming's repo which, in particular, uses Adam not Adadelta. I was not able to replicate the results in paper using Adadelta, but with Adam i was able to get to 78.0 F1 on the dev set with this scripts. I believe this appr...
A close-as-possible impelemntation of BiDaF, its based on the `dev` tensorflow 1.1 branch of Ming's repo which, in particular, uses Adam not Adadelta. I was not able to replicate the results in paper using Adadelta, but with Adam i was able to get to 78.0 F1 on the dev set with this scripts. I believe this appr...
[ "A", "close", "-", "as", "-", "possible", "impelemntation", "of", "BiDaF", "its", "based", "on", "the", "dev", "tensorflow", "1", ".", "1", "branch", "of", "Ming", "s", "repo", "which", "in", "particular", "uses", "Adam", "not", "Adadelta", ".", "I", "...
def main(): """ A close-as-possible impelemntation of BiDaF, its based on the `dev` tensorflow 1.1 branch of Ming's repo which, in particular, uses Adam not Adadelta. I was not able to replicate the results in paper using Adadelta, but with Adam i was able to get to 78.0 F1 on the dev set with this scri...
[ "def", "main", "(", ")", ":", "out", "=", "get_output_name_from_cli", "(", ")", "train_params", "=", "TrainParams", "(", "SerializableOptimizer", "(", "\"Adam\"", ",", "dict", "(", "learning_rate", "=", "0.001", ")", ")", ",", "num_epochs", "=", "12", ",", ...
https://github.com/allenai/document-qa/blob/2f9fa6878b60ed8a8a31bcf03f802cde292fe48b/docqa/scripts/train_bidaf.py#L21-L81
SymbiFlow/symbiflow-arch-defs
f38793112ff78a06de9f1e3269bd22543e29729f
xc/common/libraries/parse_pdf_modules.py
python
find_pages
(pgs, start, stop)
Find all the pages between the resolved "start" and "stop" actions
Find all the pages between the resolved "start" and "stop" actions
[ "Find", "all", "the", "pages", "between", "the", "resolved", "start", "and", "stop", "actions" ]
def find_pages(pgs, start, stop): """Find all the pages between the resolved "start" and "stop" actions""" extract = False bottom = PAGE_MARGIN for pg in pgs: if pg.pageid == start[0].objid: extract = True top = start[1] - HEADER_MARGIN else: top = pg....
[ "def", "find_pages", "(", "pgs", ",", "start", ",", "stop", ")", ":", "extract", "=", "False", "bottom", "=", "PAGE_MARGIN", "for", "pg", "in", "pgs", ":", "if", "pg", ".", "pageid", "==", "start", "[", "0", "]", ".", "objid", ":", "extract", "=", ...
https://github.com/SymbiFlow/symbiflow-arch-defs/blob/f38793112ff78a06de9f1e3269bd22543e29729f/xc/common/libraries/parse_pdf_modules.py#L190-L205
onaio/onadata
89ad16744e8f247fb748219476f6ac295869a95f
onadata/apps/logger/models/xform.py
python
XFormMixin.get_unique_id_string
(self, id_string, count=0)
return id_string
[]
def get_unique_id_string(self, id_string, count=0): # used to generate a new id_string for new data_dictionary object if # id_string already existed if self._id_string_already_exists_in_account(id_string): if count != 0: if re.match(r'\w+_\d+$', id_string): ...
[ "def", "get_unique_id_string", "(", "self", ",", "id_string", ",", "count", "=", "0", ")", ":", "# used to generate a new id_string for new data_dictionary object if", "# id_string already existed", "if", "self", ".", "_id_string_already_exists_in_account", "(", "id_string", ...
https://github.com/onaio/onadata/blob/89ad16744e8f247fb748219476f6ac295869a95f/onadata/apps/logger/models/xform.py#L291-L304
vulscanteam/vulscan
787397e267c4e6469522ee0abe55b3e98f968d4a
pocsuite/lib/core/common.py
python
isListLike
(value)
return isinstance(value, (list, tuple, set))
Returns True if the given value is a list-like instance >>> isListLike([1, 2, 3]) True >>> isListLike(u'2') False
Returns True if the given value is a list-like instance
[ "Returns", "True", "if", "the", "given", "value", "is", "a", "list", "-", "like", "instance" ]
def isListLike(value): """ Returns True if the given value is a list-like instance >>> isListLike([1, 2, 3]) True >>> isListLike(u'2') False """ return isinstance(value, (list, tuple, set))
[ "def", "isListLike", "(", "value", ")", ":", "return", "isinstance", "(", "value", ",", "(", "list", ",", "tuple", ",", "set", ")", ")" ]
https://github.com/vulscanteam/vulscan/blob/787397e267c4e6469522ee0abe55b3e98f968d4a/pocsuite/lib/core/common.py#L211-L221
gevent/gevent
ae2cb5aeb2aea8987efcb90a4c50ca4e1ee12c31
src/gevent/resolver/_addresses.py
python
_ipv6_inet_aton
(text, _v4_ending=re.compile(br'(.*):(\d+\.\d+\.\d+\.\d+)$'), _colon_colon_start=re.compile(br'::.*'), _colon_colon_end=re.compile(br'.*::$'))
Convert an IPv6 address in text form to binary form. *text*, a ``text``, the IPv6 address in textual form. Returns a ``binary``.
Convert an IPv6 address in text form to binary form.
[ "Convert", "an", "IPv6", "address", "in", "text", "form", "to", "binary", "form", "." ]
def _ipv6_inet_aton(text, _v4_ending=re.compile(br'(.*):(\d+\.\d+\.\d+\.\d+)$'), _colon_colon_start=re.compile(br'::.*'), _colon_colon_end=re.compile(br'.*::$')): """ Convert an IPv6 address in text form to binary form. *text*, a ``text``, the IPv...
[ "def", "_ipv6_inet_aton", "(", "text", ",", "_v4_ending", "=", "re", ".", "compile", "(", "br'(.*):(\\d+\\.\\d+\\.\\d+\\.\\d+)$'", ")", ",", "_colon_colon_start", "=", "re", ".", "compile", "(", "br'::.*'", ")", ",", "_colon_colon_end", "=", "re", ".", "compile"...
https://github.com/gevent/gevent/blob/ae2cb5aeb2aea8987efcb90a4c50ca4e1ee12c31/src/gevent/resolver/_addresses.py#L67-L141
berkeleydeeprlcourse/homework_fall2019
e9725d8aba926e2fe1c743f881884111b44e33bb
hw3/cs285/infrastructure/dqn_utils.py
python
MemoryOptimizedReplayBuffer.can_sample
(self, batch_size)
return batch_size + 1 <= self.num_in_buffer
Returns true if `batch_size` different transitions can be sampled from the buffer.
Returns true if `batch_size` different transitions can be sampled from the buffer.
[ "Returns", "true", "if", "batch_size", "different", "transitions", "can", "be", "sampled", "from", "the", "buffer", "." ]
def can_sample(self, batch_size): """Returns true if `batch_size` different transitions can be sampled from the buffer.""" return batch_size + 1 <= self.num_in_buffer
[ "def", "can_sample", "(", "self", ",", "batch_size", ")", ":", "return", "batch_size", "+", "1", "<=", "self", ".", "num_in_buffer" ]
https://github.com/berkeleydeeprlcourse/homework_fall2019/blob/e9725d8aba926e2fe1c743f881884111b44e33bb/hw3/cs285/infrastructure/dqn_utils.py#L347-L349
dimagi/commcare-hq
d67ff1d3b4c51fa050c19e60c3253a79d3452a39
corehq/apps/api/resources/v0_3.py
python
CommCareCaseResource.obj_get_list
(self, bundle, domain, **kwargs)
return ElasticAPIQuerySet( payload=es_query, model=ESCase, es_client=self.case_es(domain) ).order_by('server_modified_on')
[]
def obj_get_list(self, bundle, domain, **kwargs): try: es_query = es_query_from_get_params(bundle.request.GET, domain, doc_type='case') except Http400 as e: raise BadRequest(str(e)) return ElasticAPIQuerySet( payload=es_query, model=ESCase, ...
[ "def", "obj_get_list", "(", "self", ",", "bundle", ",", "domain", ",", "*", "*", "kwargs", ")", ":", "try", ":", "es_query", "=", "es_query_from_get_params", "(", "bundle", ".", "request", ".", "GET", ",", "domain", ",", "doc_type", "=", "'case'", ")", ...
https://github.com/dimagi/commcare-hq/blob/d67ff1d3b4c51fa050c19e60c3253a79d3452a39/corehq/apps/api/resources/v0_3.py#L64-L74
dragonbook/V2V-PoseNet-pytorch
90045b61c45f18dc20b410e2de14bd22be55fe0e
lib/accuracy.py
python
compute_mean_err
(pred, gt)
return np.mean(err_dist, axis=0)
pred: (N, K, 3) gt: (N, K, 3) mean_err: (K,)
pred: (N, K, 3) gt: (N, K, 3)
[ "pred", ":", "(", "N", "K", "3", ")", "gt", ":", "(", "N", "K", "3", ")" ]
def compute_mean_err(pred, gt): ''' pred: (N, K, 3) gt: (N, K, 3) mean_err: (K,) ''' N, K = pred.shape[0], pred.shape[1] err_dist = np.sqrt(np.sum((pred - gt)**2, axis=2)) # (N, K) return np.mean(err_dist, axis=0)
[ "def", "compute_mean_err", "(", "pred", ",", "gt", ")", ":", "N", ",", "K", "=", "pred", ".", "shape", "[", "0", "]", ",", "pred", ".", "shape", "[", "1", "]", "err_dist", "=", "np", ".", "sqrt", "(", "np", ".", "sum", "(", "(", "pred", "-", ...
https://github.com/dragonbook/V2V-PoseNet-pytorch/blob/90045b61c45f18dc20b410e2de14bd22be55fe0e/lib/accuracy.py#L42-L51
plasticityai/magnitude
7ac0baeaf181263b661c3ae00643d21e3fd90216
pymagnitude/third_party/_pysqlite/__init__.py
python
Magnitude._db_full_result_to_vec
(self, result, put_cache=True)
Converts a full database result to a vector.
Converts a full database result to a vector.
[ "Converts", "a", "full", "database", "result", "to", "a", "vector", "." ]
def _db_full_result_to_vec(self, result, put_cache=True): """Converts a full database result to a vector.""" result_key = result[0] if self._query_is_cached(result_key): return (result_key, self.query(result_key)) else: vec = self._db_result_to_vec(result[1:]) ...
[ "def", "_db_full_result_to_vec", "(", "self", ",", "result", ",", "put_cache", "=", "True", ")", ":", "result_key", "=", "result", "[", "0", "]", "if", "self", ".", "_query_is_cached", "(", "result_key", ")", ":", "return", "(", "result_key", ",", "self", ...
https://github.com/plasticityai/magnitude/blob/7ac0baeaf181263b661c3ae00643d21e3fd90216/pymagnitude/third_party/_pysqlite/__init__.py#L718-L727
HymanLiuTS/flaskTs
286648286976e85d9b9a5873632331efcafe0b21
flasky/lib/python2.7/site-packages/selenium/webdriver/remote/remote_connection.py
python
RemoteConnection.set_timeout
(cls, timeout)
Override the default timeout :Args: - timeout - timeout value for http requests in seconds
Override the default timeout
[ "Override", "the", "default", "timeout" ]
def set_timeout(cls, timeout): """ Override the default timeout :Args: - timeout - timeout value for http requests in seconds """ cls._timeout = timeout
[ "def", "set_timeout", "(", "cls", ",", "timeout", ")", ":", "cls", ".", "_timeout", "=", "timeout" ]
https://github.com/HymanLiuTS/flaskTs/blob/286648286976e85d9b9a5873632331efcafe0b21/flasky/lib/python2.7/site-packages/selenium/webdriver/remote/remote_connection.py#L149-L156
aws-samples/aws-kube-codesuite
ab4e5ce45416b83bffb947ab8d234df5437f4fca
src/kubernetes/client/models/v1_security_context.py
python
V1SecurityContext.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 iteritems(self.swagger_types): value = getattr(self, attr) if isinstance(value, list): result[attr] = list(map( lambda x: x.to...
[ "def", "to_dict", "(", "self", ")", ":", "result", "=", "{", "}", "for", "attr", ",", "_", "in", "iteritems", "(", "self", ".", "swagger_types", ")", ":", "value", "=", "getattr", "(", "self", ",", "attr", ")", "if", "isinstance", "(", "value", ","...
https://github.com/aws-samples/aws-kube-codesuite/blob/ab4e5ce45416b83bffb947ab8d234df5437f4fca/src/kubernetes/client/models/v1_security_context.py#L196-L220
bslatkin/effectivepython
4ae6f3141291ea137eb29a245bf889dbc8091713
example_code/item_49.py
python
Point2D.__repr__
(self)
return f'Point2D({self.x}, {self.y})'
[]
def __repr__(self): return f'Point2D({self.x}, {self.y})'
[ "def", "__repr__", "(", "self", ")", ":", "return", "f'Point2D({self.x}, {self.y})'" ]
https://github.com/bslatkin/effectivepython/blob/4ae6f3141291ea137eb29a245bf889dbc8091713/example_code/item_49.py#L67-L68
newfies-dialer/newfies-dialer
8168b3dd43e9f5ce73a2645b3229def1b2815d47
newfies/appointment/utils.py
python
OccurrenceReplacer.get_additional_occurrences
(self, start, end)
return [occ for key, occ in self.lookup.items() if (occ.start < end and occ.end >= start and not occ.cancelled)]
Return persisted occurrences which are now in the period
Return persisted occurrences which are now in the period
[ "Return", "persisted", "occurrences", "which", "are", "now", "in", "the", "period" ]
def get_additional_occurrences(self, start, end): """ Return persisted occurrences which are now in the period """ return [occ for key, occ in self.lookup.items() if (occ.start < end and occ.end >= start and not occ.cancelled)]
[ "def", "get_additional_occurrences", "(", "self", ",", "start", ",", "end", ")", ":", "return", "[", "occ", "for", "key", ",", "occ", "in", "self", ".", "lookup", ".", "items", "(", ")", "if", "(", "occ", ".", "start", "<", "end", "and", "occ", "."...
https://github.com/newfies-dialer/newfies-dialer/blob/8168b3dd43e9f5ce73a2645b3229def1b2815d47/newfies/appointment/utils.py#L33-L37
samuelclay/NewsBlur
2c45209df01a1566ea105e04d499367f32ac9ad2
utils/S3.py
python
AWSAuthConnection.__init__
(self, aws_access_key_id, aws_secret_access_key, is_secure=True, server=DEFAULT_HOST, port=None, calling_format=CallingFormat.SUBDOMAIN)
[]
def __init__(self, aws_access_key_id, aws_secret_access_key, is_secure=True, server=DEFAULT_HOST, port=None, calling_format=CallingFormat.SUBDOMAIN): if not port: port = PORTS_BY_SECURITY[is_secure] self.aws_access_key_id = aws_access_key_id self.aws_secret_access_key =...
[ "def", "__init__", "(", "self", ",", "aws_access_key_id", ",", "aws_secret_access_key", ",", "is_secure", "=", "True", ",", "server", "=", "DEFAULT_HOST", ",", "port", "=", "None", ",", "calling_format", "=", "CallingFormat", ".", "SUBDOMAIN", ")", ":", "if", ...
https://github.com/samuelclay/NewsBlur/blob/2c45209df01a1566ea105e04d499367f32ac9ad2/utils/S3.py#L145-L156
oracle/oci-python-sdk
3c1604e4e212008fb6718e2f68cdb5ef71fd5793
src/oci/core/virtual_network_client.py
python
VirtualNetworkClient.create_security_list
(self, create_security_list_details, **kwargs)
Creates a new security list for the specified VCN. For more information about security lists, see `Security Lists`__. For information on the number of rules you can have in a security list, see `Service Limits`__. For the purposes of access control, you must provide the `OCID`__ of the ...
Creates a new security list for the specified VCN. For more information about security lists, see `Security Lists`__. For information on the number of rules you can have in a security list, see `Service Limits`__.
[ "Creates", "a", "new", "security", "list", "for", "the", "specified", "VCN", ".", "For", "more", "information", "about", "security", "lists", "see", "Security", "Lists", "__", ".", "For", "information", "on", "the", "number", "of", "rules", "you", "can", "...
def create_security_list(self, create_security_list_details, **kwargs): """ Creates a new security list for the specified VCN. For more information about security lists, see `Security Lists`__. For information on the number of rules you can have in a security list, see `Service L...
[ "def", "create_security_list", "(", "self", ",", "create_security_list_details", ",", "*", "*", "kwargs", ")", ":", "resource_path", "=", "\"/securityLists\"", "method", "=", "\"POST\"", "# Don't accept unknown kwargs", "expected_kwargs", "=", "[", "\"retry_strategy\"", ...
https://github.com/oracle/oci-python-sdk/blob/3c1604e4e212008fb6718e2f68cdb5ef71fd5793/src/oci/core/virtual_network_client.py#L4959-L5050
paralelo14/google_explorer
0b21b57ef6fb7b9182fb13d00508164d007b2d19
exploits/joomraa.py
python
set_media_options
(options, sess, data)
return True
Allow us to upload a .pht file
Allow us to upload a .pht file
[ "Allow", "us", "to", "upload", "a", ".", "pht", "file" ]
def set_media_options(options, sess, data): """ Allow us to upload a .pht file """ print("[+] Setting media options") newdata = { 'jform[upload_extensions]': 'bmp,csv,doc,gif,ico,jpg,jpeg,odg,odp,ods,odt,pdf,png,ppt,swf,txt,xcf,xls,BMP,CSV,DOC,GIF,ICO,JPG,JPEG,ODG,ODP,ODS,ODT,PDF,PNG,PPT,SWF,TXT,XCF,XLS', 'jfo...
[ "def", "set_media_options", "(", "options", ",", "sess", ",", "data", ")", ":", "print", "(", "\"[+] Setting media options\"", ")", "newdata", "=", "{", "'jform[upload_extensions]'", ":", "'bmp,csv,doc,gif,ico,jpg,jpeg,odg,odp,ods,odt,pdf,png,ppt,swf,txt,xcf,xls,BMP,CSV,DOC,GIF...
https://github.com/paralelo14/google_explorer/blob/0b21b57ef6fb7b9182fb13d00508164d007b2d19/exploits/joomraa.py#L75-L101
amirassov/kaggle-imaterialist
f1ae37100801203500d20119b9de7e19b0d89a1c
mmdetection/mmdet/core/post_processing/merge_augs.py
python
merge_aug_masks
(aug_masks, img_metas, rcnn_test_cfg, weights=None)
return merged_masks
Merge augmented mask prediction. Args: aug_masks (list[ndarray]): shape (n, #class, h, w) img_shapes (list[ndarray]): shape (3, ). rcnn_test_cfg (dict): rcnn test config. Returns: tuple: (bboxes, scores)
Merge augmented mask prediction.
[ "Merge", "augmented", "mask", "prediction", "." ]
def merge_aug_masks(aug_masks, img_metas, rcnn_test_cfg, weights=None): """Merge augmented mask prediction. Args: aug_masks (list[ndarray]): shape (n, #class, h, w) img_shapes (list[ndarray]): shape (3, ). rcnn_test_cfg (dict): rcnn test config. Returns: tuple: (bboxes, sco...
[ "def", "merge_aug_masks", "(", "aug_masks", ",", "img_metas", ",", "rcnn_test_cfg", ",", "weights", "=", "None", ")", ":", "recovered_masks", "=", "[", "mask", "if", "not", "img_info", "[", "0", "]", "[", "'flip'", "]", "else", "mask", "[", "...", ",", ...
https://github.com/amirassov/kaggle-imaterialist/blob/f1ae37100801203500d20119b9de7e19b0d89a1c/mmdetection/mmdet/core/post_processing/merge_augs.py#L76-L96
OpenCobolIDE/OpenCobolIDE
c78d0d335378e5fe0a5e74f53c19b68b55e85388
open_cobol_ide/controllers/cobol.py
python
CobolController._on_run_finished
(self)
[]
def _on_run_finished(self): self.enable_compile(True) self.enable_run(True)
[ "def", "_on_run_finished", "(", "self", ")", ":", "self", ".", "enable_compile", "(", "True", ")", "self", ".", "enable_run", "(", "True", ")" ]
https://github.com/OpenCobolIDE/OpenCobolIDE/blob/c78d0d335378e5fe0a5e74f53c19b68b55e85388/open_cobol_ide/controllers/cobol.py#L478-L480
openhatch/oh-mainline
ce29352a034e1223141dcc2f317030bbc3359a51
vendor/packages/gdata/src/gdata/apps/service.py
python
AppsService.GetGeneratorForAllNicknamesOfAUser
( self, user_name, num_retries=gdata.service.DEFAULT_NUM_RETRIES, delay=gdata.service.DEFAULT_DELAY, backoff=gdata.service.DEFAULT_BACKOFF)
return self.GetGeneratorFromLinkFinder( first_page, gdata.apps.NicknameFeedFromString, num_retries=num_retries, delay=delay, backoff=backoff)
Retrieve a generator for all nicknames of a particular user.
Retrieve a generator for all nicknames of a particular user.
[ "Retrieve", "a", "generator", "for", "all", "nicknames", "of", "a", "particular", "user", "." ]
def GetGeneratorForAllNicknamesOfAUser( self, user_name, num_retries=gdata.service.DEFAULT_NUM_RETRIES, delay=gdata.service.DEFAULT_DELAY, backoff=gdata.service.DEFAULT_BACKOFF): """Retrieve a generator for all nicknames of a particular user.""" uri = "%s/nickname/%s?username=%s" % (self._baseURL(), API...
[ "def", "GetGeneratorForAllNicknamesOfAUser", "(", "self", ",", "user_name", ",", "num_retries", "=", "gdata", ".", "service", ".", "DEFAULT_NUM_RETRIES", ",", "delay", "=", "gdata", ".", "service", ".", "DEFAULT_DELAY", ",", "backoff", "=", "gdata", ".", "servic...
https://github.com/openhatch/oh-mainline/blob/ce29352a034e1223141dcc2f317030bbc3359a51/vendor/packages/gdata/src/gdata/apps/service.py#L303-L315
aleju/imgaug
0101108d4fed06bc5056c4a03e2bcb0216dac326
imgaug/augmenters/geometric.py
python
_AffineSamplingResult.to_matrix
( self, idx, arr_shape, image_shape, fit_output, shift_add=(0.5, 0.5) )
return matrix, arr_shape
[]
def to_matrix( self, idx, arr_shape, image_shape, fit_output, shift_add=(0.5, 0.5) ): if 0 in image_shape: return np.eye(3, dtype=np.float32), arr_shape params = self.get_affine_parameters( idx, arr_shap...
[ "def", "to_matrix", "(", "self", ",", "idx", ",", "arr_shape", ",", "image_shape", ",", "fit_output", ",", "shift_add", "=", "(", "0.5", ",", "0.5", ")", ")", ":", "if", "0", "in", "image_shape", ":", "return", "np", ".", "eye", "(", "3", ",", "dty...
https://github.com/aleju/imgaug/blob/0101108d4fed06bc5056c4a03e2bcb0216dac326/imgaug/augmenters/geometric.py#L742-L774
lad1337/XDM
0c1b7009fe00f06f102a6f67c793478f515e7efe
site-packages/logilab/common/tree.py
python
Node.flatten
(self, _list=None)
return _list
return a list with all the nodes descendant from this node
return a list with all the nodes descendant from this node
[ "return", "a", "list", "with", "all", "the", "nodes", "descendant", "from", "this", "node" ]
def flatten(self, _list=None): """ return a list with all the nodes descendant from this node """ if _list is None: _list = [] _list.append(self) for c in self.children: c.flatten(_list) return _list
[ "def", "flatten", "(", "self", ",", "_list", "=", "None", ")", ":", "if", "_list", "is", "None", ":", "_list", "=", "[", "]", "_list", ".", "append", "(", "self", ")", "for", "c", "in", "self", ".", "children", ":", "c", ".", "flatten", "(", "_...
https://github.com/lad1337/XDM/blob/0c1b7009fe00f06f102a6f67c793478f515e7efe/site-packages/logilab/common/tree.py#L208-L217
django-oscar/django-oscar
ffcc530844d40283b6b1552778a140536b904f5f
src/oscar/templatetags/display_tags.py
python
get_parameters
(context, except_field)
return ''
Renders current get parameters except for the specified parameter
Renders current get parameters except for the specified parameter
[ "Renders", "current", "get", "parameters", "except", "for", "the", "specified", "parameter" ]
def get_parameters(context, except_field): """ Renders current get parameters except for the specified parameter """ getvars = context['request'].GET.copy() getvars.pop(except_field, None) if len(getvars.keys()) > 0: return "%s&" % getvars.urlencode() return ''
[ "def", "get_parameters", "(", "context", ",", "except_field", ")", ":", "getvars", "=", "context", "[", "'request'", "]", ".", "GET", ".", "copy", "(", ")", "getvars", ".", "pop", "(", "except_field", ",", "None", ")", "if", "len", "(", "getvars", ".",...
https://github.com/django-oscar/django-oscar/blob/ffcc530844d40283b6b1552778a140536b904f5f/src/oscar/templatetags/display_tags.py#L9-L18
ansible-collections/community.general
3faffe8f47968a2400ba3c896c8901c03001a194
plugins/modules/nagios.py
python
Nagios.disable_svc_notifications
(self, host, services=None)
This command is used to prevent notifications from being sent out for the specified service. Note that this command does not disable notifications from being sent out about the host. Syntax: DISABLE_SVC_NOTIFICATIONS;<host_name>;<service_description>
This command is used to prevent notifications from being sent out for the specified service.
[ "This", "command", "is", "used", "to", "prevent", "notifications", "from", "being", "sent", "out", "for", "the", "specified", "service", "." ]
def disable_svc_notifications(self, host, services=None): """ This command is used to prevent notifications from being sent out for the specified service. Note that this command does not disable notifications from being sent out about the host. Syntax: DISABLE_SVC_NOTIF...
[ "def", "disable_svc_notifications", "(", "self", ",", "host", ",", "services", "=", "None", ")", ":", "cmd", "=", "\"DISABLE_SVC_NOTIFICATIONS\"", "if", "services", "is", "None", ":", "services", "=", "[", "]", "for", "service", "in", "services", ":", "notif...
https://github.com/ansible-collections/community.general/blob/3faffe8f47968a2400ba3c896c8901c03001a194/plugins/modules/nagios.py#L902-L920
abarker/pdfCropMargins
d9378cd6cba55ff137d80ff2d1f098bf6938f759
src/pdfCropMargins/external_program_calls.py
python
call_external_subprocess
(command_list, stdin_filename=None, stdout_filename=None, stderr_filename=None, env=None)
Run the command and arguments in the command_list. Will search the system PATH for commands to execute, but no shell is started. Redirects any selected outputs to the given filename. Waits for command completion.
Run the command and arguments in the command_list. Will search the system PATH for commands to execute, but no shell is started. Redirects any selected outputs to the given filename. Waits for command completion.
[ "Run", "the", "command", "and", "arguments", "in", "the", "command_list", ".", "Will", "search", "the", "system", "PATH", "for", "commands", "to", "execute", "but", "no", "shell", "is", "started", ".", "Redirects", "any", "selected", "outputs", "to", "the", ...
def call_external_subprocess(command_list, stdin_filename=None, stdout_filename=None, stderr_filename=None, env=None): """Run the command and arguments in the command_list. Will search the system PATH for commands to execute, but no shell is started. Redirects any selected out...
[ "def", "call_external_subprocess", "(", "command_list", ",", "stdin_filename", "=", "None", ",", "stdout_filename", "=", "None", ",", "stderr_filename", "=", "None", ",", "env", "=", "None", ")", ":", "stdin", "=", "open", "(", "stdin_filename", ",", "\"r\"", ...
https://github.com/abarker/pdfCropMargins/blob/d9378cd6cba55ff137d80ff2d1f098bf6938f759/src/pdfCropMargins/external_program_calls.py#L322-L339
Tautulli/Tautulli
2410eb33805aaac4bd1c5dad0f71e4f15afaf742
lib/dns/update.py
python
UpdateMessage.update
(self, v)
[]
def update(self, v): self.sections[2] = v
[ "def", "update", "(", "self", ",", "v", ")", ":", "self", ".", "sections", "[", "2", "]", "=", "v" ]
https://github.com/Tautulli/Tautulli/blob/2410eb33805aaac4bd1c5dad0f71e4f15afaf742/lib/dns/update.py#L103-L104
devopshq/tfs
56644a36dd34457dec6922eb144c21db320f16e7
tfs/connection.py
python
TFSAPI.run_saved_query
(self, id)
return self._find_resource(Wiql, ids=id)
Run saved query by query id :param id: id of the query to run :return: instance of the Wiql object with query results
Run saved query by query id
[ "Run", "saved", "query", "by", "query", "id" ]
def run_saved_query(self, id): """ Run saved query by query id :param id: id of the query to run :return: instance of the Wiql object with query results """ return self._find_resource(Wiql, ids=id)
[ "def", "run_saved_query", "(", "self", ",", "id", ")", ":", "return", "self", ".", "_find_resource", "(", "Wiql", ",", "ids", "=", "id", ")" ]
https://github.com/devopshq/tfs/blob/56644a36dd34457dec6922eb144c21db320f16e7/tfs/connection.py#L237-L243
ajinabraham/OWASP-Xenotix-XSS-Exploit-Framework
cb692f527e4e819b6c228187c5702d990a180043
external/Scripting Engine/Xenotix Python Scripting Engine/Lib/csv.py
python
Sniffer._guess_quote_and_delimiter
(self, data, delimiters)
return (quotechar, doublequote, delim, skipinitialspace)
Looks for text enclosed between two identical quotes (the probable quotechar) which are preceded and followed by the same character (the probable delimiter). For example: ,'some text', The quote with the most wins, same with the delimiter. If there is no ...
Looks for text enclosed between two identical quotes (the probable quotechar) which are preceded and followed by the same character (the probable delimiter). For example: ,'some text', The quote with the most wins, same with the delimiter. If there is no ...
[ "Looks", "for", "text", "enclosed", "between", "two", "identical", "quotes", "(", "the", "probable", "quotechar", ")", "which", "are", "preceded", "and", "followed", "by", "the", "same", "character", "(", "the", "probable", "delimiter", ")", ".", "For", "exa...
def _guess_quote_and_delimiter(self, data, delimiters): """ Looks for text enclosed between two identical quotes (the probable quotechar) which are preceded and followed by the same character (the probable delimiter). For example: ,'some text', Th...
[ "def", "_guess_quote_and_delimiter", "(", "self", ",", "data", ",", "delimiters", ")", ":", "matches", "=", "[", "]", "for", "restr", "in", "(", "'(?P<delim>[^\\w\\n\"\\'])(?P<space> ?)(?P<quote>[\"\\']).*?(?P=quote)(?P=delim)'", ",", "# ,\".*?\",", "'(?:^|\\n)(?P<quote>[\"...
https://github.com/ajinabraham/OWASP-Xenotix-XSS-Exploit-Framework/blob/cb692f527e4e819b6c228187c5702d990a180043/external/Scripting Engine/Xenotix Python Scripting Engine/Lib/csv.py#L201-L274
vrenkens/nabu
39deb62d182c7036c72f0f7eeb1d5c8eb0fb20fd
nabu/neuralnetworks/decoders/max_decoder.py
python
MaxDecoder.update_evaluation_loss
(self, loss, outputs, references, reference_seq_length)
return update_loss
update the evaluation loss args: loss: the current evaluation loss outputs: the outputs of the decoder as a dictionary references: the references as a dictionary reference_seq_length: the sequence lengths of the references Returns: an op to u...
update the evaluation loss
[ "update", "the", "evaluation", "loss" ]
def update_evaluation_loss(self, loss, outputs, references, reference_seq_length): '''update the evaluation loss args: loss: the current evaluation loss outputs: the outputs of the decoder as a dictionary references: the references as a...
[ "def", "update_evaluation_loss", "(", "self", ",", "loss", ",", "outputs", ",", "references", ",", "reference_seq_length", ")", ":", "#create a valiable to hold the total number of reference targets", "num_targets", "=", "tf", ".", "get_variable", "(", "name", "=", "'nu...
https://github.com/vrenkens/nabu/blob/39deb62d182c7036c72f0f7eeb1d5c8eb0fb20fd/nabu/neuralnetworks/decoders/max_decoder.py#L75-L133
zhl2008/awd-platform
0416b31abea29743387b10b3914581fbe8e7da5e
web_flaskbb/Python-2.7.9/Lib/plat-sunos5/TYPES.py
python
INT64_C
(c)
return __CONCAT__(c,ll)
[]
def INT64_C(c): return __CONCAT__(c,ll)
[ "def", "INT64_C", "(", "c", ")", ":", "return", "__CONCAT__", "(", "c", ",", "ll", ")" ]
https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_flaskbb/Python-2.7.9/Lib/plat-sunos5/TYPES.py#L82-L82
andresriancho/w3af
cd22e5252243a87aaa6d0ddea47cf58dacfe00a9
w3af/plugins/attack/xpath.py
python
xpath._get_delimiter
(self, vuln, is_error_resp)
:return: The delimiter to be used to terminate strings, one of single quote or double quote. If an error is found, None is returned.
:return: The delimiter to be used to terminate strings, one of single quote or double quote. If an error is found, None is returned.
[ ":", "return", ":", "The", "delimiter", "to", "be", "used", "to", "terminate", "strings", "one", "of", "single", "quote", "or", "double", "quote", ".", "If", "an", "error", "is", "found", "None", "is", "returned", "." ]
def _get_delimiter(self, vuln, is_error_resp): """ :return: The delimiter to be used to terminate strings, one of single quote or double quote. If an error is found, None is returned. """ mutant = vuln.get_mutant() orig_value = mutant.get_token_original_value() t...
[ "def", "_get_delimiter", "(", "self", ",", "vuln", ",", "is_error_resp", ")", ":", "mutant", "=", "vuln", ".", "get_mutant", "(", ")", "orig_value", "=", "mutant", ".", "get_token_original_value", "(", ")", "true_sq", "=", "\"%s' and '%i'='%i\"", "%", "(", "...
https://github.com/andresriancho/w3af/blob/cd22e5252243a87aaa6d0ddea47cf58dacfe00a9/w3af/plugins/attack/xpath.py#L154-L188
oracle/graalpython
577e02da9755d916056184ec441c26e00b70145c
graalpython/lib-python/3/http/cookiejar.py
python
DefaultCookiePolicy.return_ok_expires
(self, cookie, request)
return True
[]
def return_ok_expires(self, cookie, request): if cookie.is_expired(self._now): _debug(" cookie expired") return False return True
[ "def", "return_ok_expires", "(", "self", ",", "cookie", ",", "request", ")", ":", "if", "cookie", ".", "is_expired", "(", "self", ".", "_now", ")", ":", "_debug", "(", "\" cookie expired\"", ")", "return", "False", "return", "True" ]
https://github.com/oracle/graalpython/blob/577e02da9755d916056184ec441c26e00b70145c/graalpython/lib-python/3/http/cookiejar.py#L1133-L1137
smart-mobile-software/gitstack
d9fee8f414f202143eb6e620529e8e5539a2af56
python/Lib/site-packages/django/contrib/localflavor/uy/util.py
python
get_validation_digit
(number)
return (10-sum) % 10
Calculates the validation digit for the given number.
Calculates the validation digit for the given number.
[ "Calculates", "the", "validation", "digit", "for", "the", "given", "number", "." ]
def get_validation_digit(number): """ Calculates the validation digit for the given number. """ sum = 0 dvs = [4, 3, 6, 7, 8, 9, 2] number = str(number) for i in range(0, len(number)): sum = (int(number[-1 - i]) * dvs[i] + sum) % 10 return (10-sum) % 10
[ "def", "get_validation_digit", "(", "number", ")", ":", "sum", "=", "0", "dvs", "=", "[", "4", ",", "3", ",", "6", ",", "7", ",", "8", ",", "9", ",", "2", "]", "number", "=", "str", "(", "number", ")", "for", "i", "in", "range", "(", "0", "...
https://github.com/smart-mobile-software/gitstack/blob/d9fee8f414f202143eb6e620529e8e5539a2af56/python/Lib/site-packages/django/contrib/localflavor/uy/util.py#L3-L12
metamorphose/metamorphose2
d2bdd6a86340b9668e93b35a6a568894c9909d68
src/operations/changeLength.py
python
OpPanel.on_config_load
(self)
Update GUI elements, settings after config load.
Update GUI elements, settings after config load.
[ "Update", "GUI", "elements", "settings", "after", "config", "load", "." ]
def on_config_load(self): """Update GUI elements, settings after config load.""" self.__enable_options(False)
[ "def", "on_config_load", "(", "self", ")", ":", "self", ".", "__enable_options", "(", "False", ")" ]
https://github.com/metamorphose/metamorphose2/blob/d2bdd6a86340b9668e93b35a6a568894c9909d68/src/operations/changeLength.py#L137-L139
oracle/oci-python-sdk
3c1604e4e212008fb6718e2f68cdb5ef71fd5793
examples/list_resources_in_tenancy/list_limits_per_compartments.py
python
print_header
(name, category)
[]
def print_header(name, category): options = {0: 120, 1: 100, 2: 90, 3: 85} chars = int(options[category]) print("") print('#' * chars) print("#" + name.center(chars - 2, " ") + "#") print('#' * chars)
[ "def", "print_header", "(", "name", ",", "category", ")", ":", "options", "=", "{", "0", ":", "120", ",", "1", ":", "100", ",", "2", ":", "90", ",", "3", ":", "85", "}", "chars", "=", "int", "(", "options", "[", "category", "]", ")", "print", ...
https://github.com/oracle/oci-python-sdk/blob/3c1604e4e212008fb6718e2f68cdb5ef71fd5793/examples/list_resources_in_tenancy/list_limits_per_compartments.py#L77-L83
SpriteLink/NIPAP
de09cd7c4c55521f26f00201d694ea9e388b21a9
pynipap/pynipap.py
python
Pynipap.__init__
(self, id=None)
Creates logger and XML-RPC-connection.
Creates logger and XML-RPC-connection.
[ "Creates", "logger", "and", "XML", "-", "RPC", "-", "connection", "." ]
def __init__(self, id=None): """ Creates logger and XML-RPC-connection. """ self._logger = logging.getLogger(self.__class__.__name__) self._auth_opts = AuthOptions() self.id = id
[ "def", "__init__", "(", "self", ",", "id", "=", "None", ")", ":", "self", ".", "_logger", "=", "logging", ".", "getLogger", "(", "self", ".", "__class__", ".", "__name__", ")", "self", ".", "_auth_opts", "=", "AuthOptions", "(", ")", "self", ".", "id...
https://github.com/SpriteLink/NIPAP/blob/de09cd7c4c55521f26f00201d694ea9e388b21a9/pynipap/pynipap.py#L317-L323
oracle/graalpython
577e02da9755d916056184ec441c26e00b70145c
graalpython/lib-python/3/contextlib.py
python
closing.__exit__
(self, *exc_info)
[]
def __exit__(self, *exc_info): self.thing.close()
[ "def", "__exit__", "(", "self", ",", "*", "exc_info", ")", ":", "self", ".", "thing", ".", "close", "(", ")" ]
https://github.com/oracle/graalpython/blob/577e02da9755d916056184ec441c26e00b70145c/graalpython/lib-python/3/contextlib.py#L298-L299
matrix-org/synapse
8e57584a5859a9002759963eb546d523d2498a01
synapse/storage/databases/main/media_repository.py
python
MediaRepositoryStore.mark_local_media_as_safe
(self, media_id: str, safe: bool = True)
Mark a local media as safe or unsafe from quarantining.
Mark a local media as safe or unsafe from quarantining.
[ "Mark", "a", "local", "media", "as", "safe", "or", "unsafe", "from", "quarantining", "." ]
async def mark_local_media_as_safe(self, media_id: str, safe: bool = True) -> None: """Mark a local media as safe or unsafe from quarantining.""" await self.db_pool.simple_update_one( table="local_media_repository", keyvalues={"media_id": media_id}, updatevalues={"saf...
[ "async", "def", "mark_local_media_as_safe", "(", "self", ",", "media_id", ":", "str", ",", "safe", ":", "bool", "=", "True", ")", "->", "None", ":", "await", "self", ".", "db_pool", ".", "simple_update_one", "(", "table", "=", "\"local_media_repository\"", "...
https://github.com/matrix-org/synapse/blob/8e57584a5859a9002759963eb546d523d2498a01/synapse/storage/databases/main/media_repository.py#L333-L340
ctxis/canape
5f0e03424577296bcc60c2008a60a98ec5307e4b
CANAPE.Scripting/Lib/_pyio.py
python
TextIOBase.encoding
(self)
return None
Subclasses should override.
Subclasses should override.
[ "Subclasses", "should", "override", "." ]
def encoding(self): """Subclasses should override.""" return None
[ "def", "encoding", "(", "self", ")", ":", "return", "None" ]
https://github.com/ctxis/canape/blob/5f0e03424577296bcc60c2008a60a98ec5307e4b/CANAPE.Scripting/Lib/_pyio.py#L1331-L1333
cisco/mindmeld
809c36112e9ea8019fe29d54d136ca14eb4fd8db
mindmeld/text_preparation/spacy_model_factory.py
python
SpacyModelFactory.validate_spacy_model_size
(spacy_model_size)
Check if the model size is valid. Args: spacy_model_size (str, optional): Size of the Spacy model to use. ("sm", "md", or "lg")
Check if the model size is valid.
[ "Check", "if", "the", "model", "size", "is", "valid", "." ]
def validate_spacy_model_size(spacy_model_size): """Check if the model size is valid. Args: spacy_model_size (str, optional): Size of the Spacy model to use. ("sm", "md", or "lg") """ if spacy_model_size not in SPACY_MODEL_SIZES: raise ValueError( ...
[ "def", "validate_spacy_model_size", "(", "spacy_model_size", ")", ":", "if", "spacy_model_size", "not", "in", "SPACY_MODEL_SIZES", ":", "raise", "ValueError", "(", "\"{!r} is not a valid model size. Select from: {!r}.\"", ".", "format", "(", "spacy_model_size", ",", "\" \""...
https://github.com/cisco/mindmeld/blob/809c36112e9ea8019fe29d54d136ca14eb4fd8db/mindmeld/text_preparation/spacy_model_factory.py#L61-L72
JiYou/openstack
8607dd488bde0905044b303eb6e52bdea6806923
packages/source/nova/nova/api/openstack/xmlutil.py
python
TemplateElement.get
(self, key)
return self.attrib[key]
Get an attribute. Returns a callable which performs datum selection. :param key: The name of the attribute to get.
Get an attribute.
[ "Get", "an", "attribute", "." ]
def get(self, key): """Get an attribute. Returns a callable which performs datum selection. :param key: The name of the attribute to get. """ return self.attrib[key]
[ "def", "get", "(", "self", ",", "key", ")", ":", "return", "self", ".", "attrib", "[", "key", "]" ]
https://github.com/JiYou/openstack/blob/8607dd488bde0905044b303eb6e52bdea6806923/packages/source/nova/nova/api/openstack/xmlutil.py#L275-L283
snakemake/snakemake
987282dde8a2db5174414988c134a39ae8836a61
snakemake/io.py
python
expand
(*args, **wildcards)
Expand wildcards in given filepatterns. Arguments *args -- first arg: filepatterns as list or one single filepattern, second arg (optional): a function to combine wildcard values (itertools.product per default) **wildcards -- the wildcards as keyword arguments with their values as l...
Expand wildcards in given filepatterns.
[ "Expand", "wildcards", "in", "given", "filepatterns", "." ]
def expand(*args, **wildcards): """ Expand wildcards in given filepatterns. Arguments *args -- first arg: filepatterns as list or one single filepattern, second arg (optional): a function to combine wildcard values (itertools.product per default) **wildcards -- the wildcards as keyw...
[ "def", "expand", "(", "*", "args", ",", "*", "*", "wildcards", ")", ":", "filepatterns", "=", "args", "[", "0", "]", "if", "len", "(", "args", ")", "==", "1", ":", "combinator", "=", "product", "elif", "len", "(", "args", ")", "==", "2", ":", "...
https://github.com/snakemake/snakemake/blob/987282dde8a2db5174414988c134a39ae8836a61/snakemake/io.py#L1107-L1182
errbotio/errbot
66e1de8e1d7daa62be7f9ed1b2ac8832f09fa25d
tools/plugin-gen.py
python
rate_limit
(resp)
Wait enough to be in the budget for this request. :param resp: the http response from github :return:
Wait enough to be in the budget for this request. :param resp: the http response from github :return:
[ "Wait", "enough", "to", "be", "in", "the", "budget", "for", "this", "request", ".", ":", "param", "resp", ":", "the", "http", "response", "from", "github", ":", "return", ":" ]
def rate_limit(resp): """ Wait enough to be in the budget for this request. :param resp: the http response from github :return: """ if "X-RateLimit-Remaining" not in resp.headers: log.info("No rate limit detected. Hum along...") return remain = int(resp.headers["X-RateLimit-R...
[ "def", "rate_limit", "(", "resp", ")", ":", "if", "\"X-RateLimit-Remaining\"", "not", "in", "resp", ".", "headers", ":", "log", ".", "info", "(", "\"No rate limit detected. Hum along...\"", ")", "return", "remain", "=", "int", "(", "resp", ".", "headers", "[",...
https://github.com/errbotio/errbot/blob/66e1de8e1d7daa62be7f9ed1b2ac8832f09fa25d/tools/plugin-gen.py#L105-L125
deepmind/leo
de9a0c2a77dd7a42c1986b1eef18d184a86e294a
runner.py
python
_construct_training_summaries
(metatrain_loss, metatrain_accuracy, model_grads, model_vars)
[]
def _construct_training_summaries(metatrain_loss, metatrain_accuracy, model_grads, model_vars): tf.summary.scalar("metatrain_loss", metatrain_loss) tf.summary.scalar("metatrain_valid_accuracy", metatrain_accuracy) for g, v in zip(model_grads, model_vars): histogram_name = v.n...
[ "def", "_construct_training_summaries", "(", "metatrain_loss", ",", "metatrain_accuracy", ",", "model_grads", ",", "model_vars", ")", ":", "tf", ".", "summary", ".", "scalar", "(", "\"metatrain_loss\"", ",", "metatrain_loss", ")", "tf", ".", "summary", ".", "scala...
https://github.com/deepmind/leo/blob/de9a0c2a77dd7a42c1986b1eef18d184a86e294a/runner.py#L64-L72
natashamjaques/neural_chat
ddb977bb4602a67c460d02231e7bbf7b2cb49a97
ParlAI/parlai/agents/legacy_agents/seq2seq/dict_v1.py
python
find_ngrams
(token_dict, text, n)
return saved_tokens
Break text into ngrams that appear in ``token_dict``. :param token_dict: ``dict`` to check for ngrams :param text: ``str`` to look for ngrams in :param n: ``int`` max size of ngrams
Break text into ngrams that appear in ``token_dict``.
[ "Break", "text", "into", "ngrams", "that", "appear", "in", "token_dict", "." ]
def find_ngrams(token_dict, text, n): """Break text into ngrams that appear in ``token_dict``. :param token_dict: ``dict`` to check for ngrams :param text: ``str`` to look for ngrams in :param n: ``int`` max size of ngrams """ # base case if n <= 1: return text # tokens committe...
[ "def", "find_ngrams", "(", "token_dict", ",", "text", ",", "n", ")", ":", "# base case", "if", "n", "<=", "1", ":", "return", "text", "# tokens committed to output", "saved_tokens", "=", "[", "]", "# tokens remaining to be searched in sentence", "search_tokens", "="...
https://github.com/natashamjaques/neural_chat/blob/ddb977bb4602a67c460d02231e7bbf7b2cb49a97/ParlAI/parlai/agents/legacy_agents/seq2seq/dict_v1.py#L50-L82
bendmorris/static-python
2e0f8c4d7ed5b359dc7d8a75b6fb37e6b6c5c473
Parser/asdl_c.py
python
PrototypeVisitor.get_args
(self, fields)
return args
Return list of C argument into, one for each field. Argument info is 3-tuple of a C type, variable name, and flag that is true if type can be NULL.
Return list of C argument into, one for each field.
[ "Return", "list", "of", "C", "argument", "into", "one", "for", "each", "field", "." ]
def get_args(self, fields): """Return list of C argument into, one for each field. Argument info is 3-tuple of a C type, variable name, and flag that is true if type can be NULL. """ args = [] unnamed = {} for f in fields: if f.name is None: ...
[ "def", "get_args", "(", "self", ",", "fields", ")", ":", "args", "=", "[", "]", "unnamed", "=", "{", "}", "for", "f", "in", "fields", ":", "if", "f", ".", "name", "is", "None", ":", "name", "=", "f", ".", "type", "c", "=", "unnamed", "[", "na...
https://github.com/bendmorris/static-python/blob/2e0f8c4d7ed5b359dc7d8a75b6fb37e6b6c5c473/Parser/asdl_c.py#L238-L263
nottombrown/rl-teacher
b2c2201e9d2457b13185424a19da7209364f23df
rl_teacher/teach.py
python
ComparisonRewardPredictor.__init__
(self, env, summary_writer, comparison_collector, agent_logger, label_schedule)
[]
def __init__(self, env, summary_writer, comparison_collector, agent_logger, label_schedule): self.summary_writer = summary_writer self.agent_logger = agent_logger self.comparison_collector = comparison_collector self.label_schedule = label_schedule # Set up some bookkeeping ...
[ "def", "__init__", "(", "self", ",", "env", ",", "summary_writer", ",", "comparison_collector", ",", "agent_logger", ",", "label_schedule", ")", ":", "self", ".", "summary_writer", "=", "summary_writer", "self", ".", "agent_logger", "=", "agent_logger", "self", ...
https://github.com/nottombrown/rl-teacher/blob/b2c2201e9d2457b13185424a19da7209364f23df/rl_teacher/teach.py#L42-L64
TencentCloud/tencentcloud-sdk-python
3677fd1cdc8c5fd626ce001c13fd3b59d1f279d2
tencentcloud/iotvideoindustry/v20201201/iotvideoindustry_client.py
python
IotvideoindustryClient.DescribeIPCChannels
(self, request)
获取IPC设备下属通道 请使用DescribeChannels接口 :param request: Request instance for DescribeIPCChannels. :type request: :class:`tencentcloud.iotvideoindustry.v20201201.models.DescribeIPCChannelsRequest` :rtype: :class:`tencentcloud.iotvideoindustry.v20201201.models.DescribeIPCChannelsResponse`
获取IPC设备下属通道 请使用DescribeChannels接口
[ "获取IPC设备下属通道", "请使用DescribeChannels接口" ]
def DescribeIPCChannels(self, request): """获取IPC设备下属通道 请使用DescribeChannels接口 :param request: Request instance for DescribeIPCChannels. :type request: :class:`tencentcloud.iotvideoindustry.v20201201.models.DescribeIPCChannelsRequest` :rtype: :class:`tencentcloud.iotvideoindustry....
[ "def", "DescribeIPCChannels", "(", "self", ",", "request", ")", ":", "try", ":", "params", "=", "request", ".", "_serialize", "(", ")", "body", "=", "self", ".", "call", "(", "\"DescribeIPCChannels\"", ",", "params", ")", "response", "=", "json", ".", "l...
https://github.com/TencentCloud/tencentcloud-sdk-python/blob/3677fd1cdc8c5fd626ce001c13fd3b59d1f279d2/tencentcloud/iotvideoindustry/v20201201/iotvideoindustry_client.py#L1412-L1438
toxygen-project/toxygen
0a54012cf5ee72434b923bcde7d8f1a4e575ce2f
toxygen/profile.py
python
Profile.send_friend_request
(self, tox_id, message)
Function tries to send request to contact with specified id :param tox_id: id of new contact or tox dns 4 value :param message: additional message :return: True on success else error string
Function tries to send request to contact with specified id :param tox_id: id of new contact or tox dns 4 value :param message: additional message :return: True on success else error string
[ "Function", "tries", "to", "send", "request", "to", "contact", "with", "specified", "id", ":", "param", "tox_id", ":", "id", "of", "new", "contact", "or", "tox", "dns", "4", "value", ":", "param", "message", ":", "additional", "message", ":", "return", "...
def send_friend_request(self, tox_id, message): """ Function tries to send request to contact with specified id :param tox_id: id of new contact or tox dns 4 value :param message: additional message :return: True on success else error string """ try: m...
[ "def", "send_friend_request", "(", "self", ",", "tox_id", ",", "message", ")", ":", "try", ":", "message", "=", "message", "or", "'Hello! Add me to your contact list please'", "if", "'@'", "in", "tox_id", ":", "# value like groupbot@toxme.io", "tox_id", "=", "tox_dn...
https://github.com/toxygen-project/toxygen/blob/0a54012cf5ee72434b923bcde7d8f1a4e575ce2f/toxygen/profile.py#L813-L847
makerbot/ReplicatorG
d6f2b07785a5a5f1e172fb87cb4303b17c575d5d
skein_engines/skeinforge-47/skeinforge_application/skeinforge_plugins/craft_plugins/smooth.py
python
getNewRepository
()
return SmoothRepository()
Get new repository.
Get new repository.
[ "Get", "new", "repository", "." ]
def getNewRepository(): 'Get new repository.' return SmoothRepository()
[ "def", "getNewRepository", "(", ")", ":", "return", "SmoothRepository", "(", ")" ]
https://github.com/makerbot/ReplicatorG/blob/d6f2b07785a5a5f1e172fb87cb4303b17c575d5d/skein_engines/skeinforge-47/skeinforge_application/skeinforge_plugins/craft_plugins/smooth.py#L75-L77
fastnlp/fitlog
ba9547a56f4855a2d9cf26ae709d01922befa077
fitlog/__init__.py
python
get_log_dir
(absolute=False)
return _logger.get_log_dir(absolute=absolute)
返回的是存放所有log的文件夹。例如logs/,需要调用set_log_dir()先设置log的记录文件夹 :param bool absolute: 是否返回绝对路径 :return:
返回的是存放所有log的文件夹。例如logs/,需要调用set_log_dir()先设置log的记录文件夹
[ "返回的是存放所有log的文件夹。例如logs", "/", ",需要调用set_log_dir", "()", "先设置log的记录文件夹" ]
def get_log_dir(absolute=False): """ 返回的是存放所有log的文件夹。例如logs/,需要调用set_log_dir()先设置log的记录文件夹 :param bool absolute: 是否返回绝对路径 :return: """ return _logger.get_log_dir(absolute=absolute)
[ "def", "get_log_dir", "(", "absolute", "=", "False", ")", ":", "return", "_logger", ".", "get_log_dir", "(", "absolute", "=", "absolute", ")" ]
https://github.com/fastnlp/fitlog/blob/ba9547a56f4855a2d9cf26ae709d01922befa077/fitlog/__init__.py#L50-L57
robotlearn/pyrobolearn
9cd7c060723fda7d2779fa255ac998c2c82b8436
pyrobolearn/simulators/simulator.py
python
Simulator.get_link_state
(self, body_id, link_id, compute_velocity=False, compute_forward_kinematics=False)
Get the state of the associated link. Args: body_id (int): body unique id. link_id (int): link index. compute_velocity (bool): If True, the Cartesian world velocity will be computed and returned. compute_forward_kinematics (bool): if True, the Cartesian world pos...
Get the state of the associated link.
[ "Get", "the", "state", "of", "the", "associated", "link", "." ]
def get_link_state(self, body_id, link_id, compute_velocity=False, compute_forward_kinematics=False): """ Get the state of the associated link. Args: body_id (int): body unique id. link_id (int): link index. compute_velocity (bool): If True, the Cartesian wor...
[ "def", "get_link_state", "(", "self", ",", "body_id", ",", "link_id", ",", "compute_velocity", "=", "False", ",", "compute_forward_kinematics", "=", "False", ")", ":", "pass" ]
https://github.com/robotlearn/pyrobolearn/blob/9cd7c060723fda7d2779fa255ac998c2c82b8436/pyrobolearn/simulators/simulator.py#L1408-L1431
hhstore/annotated-py-projects
4f4eca9a3913a19983cae496279a72699c083a0b
asyncio/asyncio-3.4.3/asyncio/events.py
python
set_event_loop
(loop)
Equivalent to calling get_event_loop_policy().set_event_loop(loop).
Equivalent to calling get_event_loop_policy().set_event_loop(loop).
[ "Equivalent", "to", "calling", "get_event_loop_policy", "()", ".", "set_event_loop", "(", "loop", ")", "." ]
def set_event_loop(loop): """Equivalent to calling get_event_loop_policy().set_event_loop(loop).""" get_event_loop_policy().set_event_loop(loop)
[ "def", "set_event_loop", "(", "loop", ")", ":", "get_event_loop_policy", "(", ")", ".", "set_event_loop", "(", "loop", ")" ]
https://github.com/hhstore/annotated-py-projects/blob/4f4eca9a3913a19983cae496279a72699c083a0b/asyncio/asyncio-3.4.3/asyncio/events.py#L663-L665
rlgraph/rlgraph
428fc136a9a075f29a397495b4226a491a287be2
rlgraph/components/explorations/epsilon_exploration.py
python
EpsilonExploration.__init__
(self, decay_spec=None, scope="epsilon-exploration", **kwargs)
Args: decay_spec (Optional[dict,DecayComponent]): The spec-dict for the DecayComponent to use or a DecayComponent object directly. Keyword Args: Used as decay_spec (only if `decay_spec` not given) to construct the DecayComponent.
Args: decay_spec (Optional[dict,DecayComponent]): The spec-dict for the DecayComponent to use or a DecayComponent object directly.
[ "Args", ":", "decay_spec", "(", "Optional", "[", "dict", "DecayComponent", "]", ")", ":", "The", "spec", "-", "dict", "for", "the", "DecayComponent", "to", "use", "or", "a", "DecayComponent", "object", "directly", "." ]
def __init__(self, decay_spec=None, scope="epsilon-exploration", **kwargs): """ Args: decay_spec (Optional[dict,DecayComponent]): The spec-dict for the DecayComponent to use or a DecayComponent object directly. Keyword Args: Used as decay_spec (only if `d...
[ "def", "__init__", "(", "self", ",", "decay_spec", "=", "None", ",", "scope", "=", "\"epsilon-exploration\"", ",", "*", "*", "kwargs", ")", ":", "super", "(", "EpsilonExploration", ",", "self", ")", ".", "__init__", "(", "scope", "=", "scope", ",", "*", ...
https://github.com/rlgraph/rlgraph/blob/428fc136a9a075f29a397495b4226a491a287be2/rlgraph/components/explorations/epsilon_exploration.py#L47-L66
haiwen/seafile-docker
2d2461d4c8cab3458ec9832611c419d47506c300
cluster/image/pro_seafile_7.1/scripts_7.1/setup-seafile-mysql.py
python
Utils.write_config
(cp, fn)
Return a case sensitive ConfigParser by reading the file "fn"
Return a case sensitive ConfigParser by reading the file "fn"
[ "Return", "a", "case", "sensitive", "ConfigParser", "by", "reading", "the", "file", "fn" ]
def write_config(cp, fn): '''Return a case sensitive ConfigParser by reading the file "fn"''' with open(fn, 'w') as fp: cp.write(fp)
[ "def", "write_config", "(", "cp", ",", "fn", ")", ":", "with", "open", "(", "fn", ",", "'w'", ")", "as", "fp", ":", "cp", ".", "write", "(", "fp", ")" ]
https://github.com/haiwen/seafile-docker/blob/2d2461d4c8cab3458ec9832611c419d47506c300/cluster/image/pro_seafile_7.1/scripts_7.1/setup-seafile-mysql.py#L185-L188
sagemath/sage
f9b2db94f675ff16963ccdefba4f1a3393b3fe0d
src/sage/interfaces/kenzo.py
python
KenzoSimplicialSet.join
(self, other)
return KenzoSimplicialSet(join_kenzo)
r""" Return the join of ``self`` and ``other``. INPUT: - ``other`` -- the Kenzo simplicial set with which the join is made OUTPUT: - A :class:`KenzoSimplicialSet` EXAMPLES:: sage: from sage.interfaces.kenzo import Sphere # optional - kenzo ...
r""" Return the join of ``self`` and ``other``.
[ "r", "Return", "the", "join", "of", "self", "and", "other", "." ]
def join(self, other): r""" Return the join of ``self`` and ``other``. INPUT: - ``other`` -- the Kenzo simplicial set with which the join is made OUTPUT: - A :class:`KenzoSimplicialSet` EXAMPLES:: sage: from sage.interfaces.kenzo import Sphere ...
[ "def", "join", "(", "self", ",", "other", ")", ":", "join_kenzo", "=", "__join__", "(", "self", ".", "_kenzo", ",", "other", ".", "_kenzo", ")", "return", "KenzoSimplicialSet", "(", "join_kenzo", ")" ]
https://github.com/sagemath/sage/blob/f9b2db94f675ff16963ccdefba4f1a3393b3fe0d/src/sage/interfaces/kenzo.py#L879-L903
DataDog/integrations-core
934674b29d94b70ccc008f76ea172d0cdae05e1e
pgbouncer/datadog_checks/pgbouncer/config_models/shared.py
python
SharedConfig._run_validations
(cls, v, field)
return getattr(validators, f'shared_{field.name}', identity)(v, field=field)
[]
def _run_validations(cls, v, field): if not v: return v return getattr(validators, f'shared_{field.name}', identity)(v, field=field)
[ "def", "_run_validations", "(", "cls", ",", "v", ",", "field", ")", ":", "if", "not", "v", ":", "return", "v", "return", "getattr", "(", "validators", ",", "f'shared_{field.name}'", ",", "identity", ")", "(", "v", ",", "field", "=", "field", ")" ]
https://github.com/DataDog/integrations-core/blob/934674b29d94b70ccc008f76ea172d0cdae05e1e/pgbouncer/datadog_checks/pgbouncer/config_models/shared.py#L40-L44
ewels/MultiQC
9b953261d3d684c24eef1827a5ce6718c847a5af
multiqc/modules/mirtop/mirtop.py
python
MultiqcModule.mirtop_stats_table
(self)
Take the parsed stats from the mirtop report and add them to the basic stats table at the top of the report
Take the parsed stats from the mirtop report and add them to the basic stats table at the top of the report
[ "Take", "the", "parsed", "stats", "from", "the", "mirtop", "report", "and", "add", "them", "to", "the", "basic", "stats", "table", "at", "the", "top", "of", "the", "report" ]
def mirtop_stats_table(self): """Take the parsed stats from the mirtop report and add them to the basic stats table at the top of the report""" headers = OrderedDict() headers["ref_miRNA_sum"] = { "title": "{} Ref miRNA reads".format(config.read_count_prefix), "d...
[ "def", "mirtop_stats_table", "(", "self", ")", ":", "headers", "=", "OrderedDict", "(", ")", "headers", "[", "\"ref_miRNA_sum\"", "]", "=", "{", "\"title\"", ":", "\"{} Ref miRNA reads\"", ".", "format", "(", "config", ".", "read_count_prefix", ")", ",", "\"de...
https://github.com/ewels/MultiQC/blob/9b953261d3d684c24eef1827a5ce6718c847a5af/multiqc/modules/mirtop/mirtop.py#L130-L165
saltstack/salt
fae5bc757ad0f1716483ce7ae180b451545c2058
salt/modules/mount.py
python
swaps
()
return ret
Return a dict containing information on active swap .. versionchanged:: 2016.3.2 CLI Example: .. code-block:: bash salt '*' mount.swaps
Return a dict containing information on active swap
[ "Return", "a", "dict", "containing", "information", "on", "active", "swap" ]
def swaps(): """ Return a dict containing information on active swap .. versionchanged:: 2016.3.2 CLI Example: .. code-block:: bash salt '*' mount.swaps """ ret = {} if __grains__["kernel"] == "SunOS": for line in __salt__["cmd.run_stdout"]("swap -l").splitlines(): ...
[ "def", "swaps", "(", ")", ":", "ret", "=", "{", "}", "if", "__grains__", "[", "\"kernel\"", "]", "==", "\"SunOS\"", ":", "for", "line", "in", "__salt__", "[", "\"cmd.run_stdout\"", "]", "(", "\"swap -l\"", ")", ".", "splitlines", "(", ")", ":", "if", ...
https://github.com/saltstack/salt/blob/fae5bc757ad0f1716483ce7ae180b451545c2058/salt/modules/mount.py#L1422-L1486
demisto/content
5c664a65b992ac8ca90ac3f11b1b2cdf11ee9b07
Packs/FreshDesk/Integrations/FreshDesk/FreshDesk.py
python
get_ticket_conversations_command
()
Lists all replies and notes for a specified ticket. demisto parameter: (number) ticket_id ID of the ticket for which you would like to list all of its conversations returns: Conversation Objects
Lists all replies and notes for a specified ticket.
[ "Lists", "all", "replies", "and", "notes", "for", "a", "specified", "ticket", "." ]
def get_ticket_conversations_command(): """ Lists all replies and notes for a specified ticket. demisto parameter: (number) ticket_id ID of the ticket for which you would like to list all of its conversations returns: Conversation Objects """ # Get id number of ticket as cmd ar...
[ "def", "get_ticket_conversations_command", "(", ")", ":", "# Get id number of ticket as cmd arg for which you want to see all the conversations", "ticket_id", "=", "demisto", ".", "args", "(", ")", ".", "get", "(", "'ticket_id'", ")", "# Make request and get raw response", "con...
https://github.com/demisto/content/blob/5c664a65b992ac8ca90ac3f11b1b2cdf11ee9b07/Packs/FreshDesk/Integrations/FreshDesk/FreshDesk.py#L1461-L1502
dephell/dephell
de96f01fcfd8dd620b049369a8ec30dde566c5de
dephell/cached_property.py
python
cached_property.__get__
(self, obj, cls)
return value
[]
def __get__(self, obj, cls): if obj is None: return self value = obj.__dict__[self.func.__name__] = self.func(obj) return value
[ "def", "__get__", "(", "self", ",", "obj", ",", "cls", ")", ":", "if", "obj", "is", "None", ":", "return", "self", "value", "=", "obj", ".", "__dict__", "[", "self", ".", "func", ".", "__name__", "]", "=", "self", ".", "func", "(", "obj", ")", ...
https://github.com/dephell/dephell/blob/de96f01fcfd8dd620b049369a8ec30dde566c5de/dephell/cached_property.py#L15-L19
celiao/tmdbsimple
2c046367866667102b78247db708c0ac275f805d
tmdbsimple/account.py
python
Account.favorite
(self, **kwargs)
return response
This method allows you to mark a movie or TV show as a favorite item. Args: media_type: 'movie' | 'tv' media_id: The id of the media. favorite: True (to add) | False (to remove). Returns: A dict respresentation of the JSON returned from the API.
This method allows you to mark a movie or TV show as a favorite item.
[ "This", "method", "allows", "you", "to", "mark", "a", "movie", "or", "TV", "show", "as", "a", "favorite", "item", "." ]
def favorite(self, **kwargs): """ This method allows you to mark a movie or TV show as a favorite item. Args: media_type: 'movie' | 'tv' media_id: The id of the media. favorite: True (to add) | False (to remove). Returns: A dict respresen...
[ "def", "favorite", "(", "self", ",", "*", "*", "kwargs", ")", ":", "path", "=", "self", ".", "_get_id_path", "(", "'favorite'", ")", "kwargs", ".", "update", "(", "{", "'session_id'", ":", "self", ".", "session_id", "}", ")", "payload", "=", "{", "'m...
https://github.com/celiao/tmdbsimple/blob/2c046367866667102b78247db708c0ac275f805d/tmdbsimple/account.py#L118-L141
ChineseGLUE/ChineseGLUE
1591b85cf5427c2ff60f718d359ecb71d2b44879
baselines/models_pytorch/classifier_pytorch/transformers/modeling_bert.py
python
BertSelfAttention.transpose_for_scores
(self, x)
return x.permute(0, 2, 1, 3)
[]
def transpose_for_scores(self, x): new_x_shape = x.size()[:-1] + (self.num_attention_heads, self.attention_head_size) x = x.view(*new_x_shape) return x.permute(0, 2, 1, 3)
[ "def", "transpose_for_scores", "(", "self", ",", "x", ")", ":", "new_x_shape", "=", "x", ".", "size", "(", ")", "[", ":", "-", "1", "]", "+", "(", "self", ".", "num_attention_heads", ",", "self", ".", "attention_head_size", ")", "x", "=", "x", ".", ...
https://github.com/ChineseGLUE/ChineseGLUE/blob/1591b85cf5427c2ff60f718d359ecb71d2b44879/baselines/models_pytorch/classifier_pytorch/transformers/modeling_bert.py#L196-L199
TengXiaoDai/DistributedCrawling
f5c2439e6ce68dd9b49bde084d76473ff9ed4963
Lib/site-packages/pip/_vendor/distlib/markers.py
python
Evaluator.__init__
(self, context=None)
Initialise an instance. :param context: If specified, names are looked up in this mapping.
Initialise an instance.
[ "Initialise", "an", "instance", "." ]
def __init__(self, context=None): """ Initialise an instance. :param context: If specified, names are looked up in this mapping. """ self.context = context or {} self.source = None
[ "def", "__init__", "(", "self", ",", "context", "=", "None", ")", ":", "self", ".", "context", "=", "context", "or", "{", "}", "self", ".", "source", "=", "None" ]
https://github.com/TengXiaoDai/DistributedCrawling/blob/f5c2439e6ce68dd9b49bde084d76473ff9ed4963/Lib/site-packages/pip/_vendor/distlib/markers.py#L51-L58
quantumlib/Cirq
89f88b01d69222d3f1ec14d649b7b3a85ed9211f
cirq-core/cirq/sim/simulator.py
python
SimulatesAmplitudes.compute_amplitudes_sweep_iter
( self, program: 'cirq.AbstractCircuit', bitstrings: Sequence[int], params: 'cirq.Sweepable', qubit_order: 'cirq.QubitOrderOrList' = ops.QubitOrder.DEFAULT, )
Computes the desired amplitudes. The initial state is assumed to be the all zeros state. Args: program: The circuit to simulate. bitstrings: The bitstrings whose amplitudes are desired, input as an integer array where each integer is formed from measured ...
Computes the desired amplitudes.
[ "Computes", "the", "desired", "amplitudes", "." ]
def compute_amplitudes_sweep_iter( self, program: 'cirq.AbstractCircuit', bitstrings: Sequence[int], params: 'cirq.Sweepable', qubit_order: 'cirq.QubitOrderOrList' = ops.QubitOrder.DEFAULT, ) -> Iterator[Sequence[complex]]: """Computes the desired amplitudes. ...
[ "def", "compute_amplitudes_sweep_iter", "(", "self", ",", "program", ":", "'cirq.AbstractCircuit'", ",", "bitstrings", ":", "Sequence", "[", "int", "]", ",", "params", ":", "'cirq.Sweepable'", ",", "qubit_order", ":", "'cirq.QubitOrderOrList'", "=", "ops", ".", "Q...
https://github.com/quantumlib/Cirq/blob/89f88b01d69222d3f1ec14d649b7b3a85ed9211f/cirq-core/cirq/sim/simulator.py#L210-L236
home-assistant/core
265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1
homeassistant/components/nexia/sensor.py
python
NexiaThermostatSensor.native_value
(self)
return val
Return the state of the sensor.
Return the state of the sensor.
[ "Return", "the", "state", "of", "the", "sensor", "." ]
def native_value(self): """Return the state of the sensor.""" val = getattr(self._thermostat, self._call)() if self._modifier: val = self._modifier(val) if isinstance(val, float): val = round(val, 1) return val
[ "def", "native_value", "(", "self", ")", ":", "val", "=", "getattr", "(", "self", ".", "_thermostat", ",", "self", ".", "_call", ")", "(", ")", "if", "self", ".", "_modifier", ":", "val", "=", "self", ".", "_modifier", "(", "val", ")", "if", "isins...
https://github.com/home-assistant/core/blob/265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1/homeassistant/components/nexia/sensor.py#L187-L194
microsoft/azure-devops-python-api
451cade4c475482792cbe9e522c1fee32393139e
azure-devops/azure/devops/v6_0/git/git_client_base.py
python
GitClientBase.update_pull_request_reviewers
(self, patch_votes, repository_id, pull_request_id, project=None)
UpdatePullRequestReviewers. [Preview API] Reset the votes of multiple reviewers on a pull request. NOTE: This endpoint only supports updating votes, but does not support updating required reviewers (use policy) or display names. :param [IdentityRefWithVote] patch_votes: IDs of the reviewers whose votes...
UpdatePullRequestReviewers. [Preview API] Reset the votes of multiple reviewers on a pull request. NOTE: This endpoint only supports updating votes, but does not support updating required reviewers (use policy) or display names. :param [IdentityRefWithVote] patch_votes: IDs of the reviewers whose votes...
[ "UpdatePullRequestReviewers", ".", "[", "Preview", "API", "]", "Reset", "the", "votes", "of", "multiple", "reviewers", "on", "a", "pull", "request", ".", "NOTE", ":", "This", "endpoint", "only", "supports", "updating", "votes", "but", "does", "not", "support",...
def update_pull_request_reviewers(self, patch_votes, repository_id, pull_request_id, project=None): """UpdatePullRequestReviewers. [Preview API] Reset the votes of multiple reviewers on a pull request. NOTE: This endpoint only supports updating votes, but does not support updating required reviewers (u...
[ "def", "update_pull_request_reviewers", "(", "self", ",", "patch_votes", ",", "repository_id", ",", "pull_request_id", ",", "project", "=", "None", ")", ":", "route_values", "=", "{", "}", "if", "project", "is", "not", "None", ":", "route_values", "[", "'proje...
https://github.com/microsoft/azure-devops-python-api/blob/451cade4c475482792cbe9e522c1fee32393139e/azure-devops/azure/devops/v6_0/git/git_client_base.py#L2032-L2052
zsdonghao/text-to-image
c1fbfa4349f5aa1c74c9fe17743cc0cff34f1aab
tensorlayer/iterate.py
python
ptb_iterator
(raw_data, batch_size, num_steps)
Generate a generator that iterates on a list of words, see PTB tutorial. Yields (Returns) the source contexts and the target context by the given batch_size and num_steps (sequence_length).\n see ``PTB tutorial``. e.g. x = [0, 1, 2] y = [1, 2, 3] , when batch_size = 1, num_steps = 3, raw_data = [i for...
Generate a generator that iterates on a list of words, see PTB tutorial. Yields (Returns) the source contexts and the target context by the given batch_size and num_steps (sequence_length).\n see ``PTB tutorial``.
[ "Generate", "a", "generator", "that", "iterates", "on", "a", "list", "of", "words", "see", "PTB", "tutorial", ".", "Yields", "(", "Returns", ")", "the", "source", "contexts", "and", "the", "target", "context", "by", "the", "given", "batch_size", "and", "nu...
def ptb_iterator(raw_data, batch_size, num_steps): """ Generate a generator that iterates on a list of words, see PTB tutorial. Yields (Returns) the source contexts and the target context by the given batch_size and num_steps (sequence_length).\n see ``PTB tutorial``. e.g. x = [0, 1, 2] y = [1, 2,...
[ "def", "ptb_iterator", "(", "raw_data", ",", "batch_size", ",", "num_steps", ")", ":", "raw_data", "=", "np", ".", "array", "(", "raw_data", ",", "dtype", "=", "np", ".", "int32", ")", "data_len", "=", "len", "(", "raw_data", ")", "batch_len", "=", "da...
https://github.com/zsdonghao/text-to-image/blob/c1fbfa4349f5aa1c74c9fe17743cc0cff34f1aab/tensorlayer/iterate.py#L204-L278
bokeh/bokeh
a00e59da76beb7b9f83613533cfd3aced1df5f06
bokeh/application/handlers/function.py
python
FunctionHandler.safe_to_fork
(self)
return self._safe_to_fork
Whether it is still safe for the Bokeh server to fork new workers. ``False`` if ``modify_doc`` has already been called.
Whether it is still safe for the Bokeh server to fork new workers.
[ "Whether", "it", "is", "still", "safe", "for", "the", "Bokeh", "server", "to", "fork", "new", "workers", "." ]
def safe_to_fork(self) -> bool: ''' Whether it is still safe for the Bokeh server to fork new workers. ``False`` if ``modify_doc`` has already been called. ''' return self._safe_to_fork
[ "def", "safe_to_fork", "(", "self", ")", "->", "bool", ":", "return", "self", ".", "_safe_to_fork" ]
https://github.com/bokeh/bokeh/blob/a00e59da76beb7b9f83613533cfd3aced1df5f06/bokeh/application/handlers/function.py#L125-L131
DamnWidget/anaconda
a9998fb362320f907d5ccbc6fcf5b62baca677c0
anaconda_lib/jedi/_compatibility.py
python
cast_path
(obj)
return u(obj, errors='replace')
Take a bytes or str path and cast it to unicode. Apparently it is perfectly fine to pass both byte and unicode objects into the sys.path. This probably means that byte paths are normal at other places as well. Since this just really complicates everything and Python 2.7 will be EOL soon anyway, ju...
Take a bytes or str path and cast it to unicode.
[ "Take", "a", "bytes", "or", "str", "path", "and", "cast", "it", "to", "unicode", "." ]
def cast_path(obj): """ Take a bytes or str path and cast it to unicode. Apparently it is perfectly fine to pass both byte and unicode objects into the sys.path. This probably means that byte paths are normal at other places as well. Since this just really complicates everything and Python 2.7...
[ "def", "cast_path", "(", "obj", ")", ":", "return", "u", "(", "obj", ",", "errors", "=", "'replace'", ")" ]
https://github.com/DamnWidget/anaconda/blob/a9998fb362320f907d5ccbc6fcf5b62baca677c0/anaconda_lib/jedi/_compatibility.py#L289-L300
sunpy/sunpy
528579df0a4c938c133bd08971ba75c131b189a7
sunpy/io/special/genx.py
python
read_genx
(filename)
return skeleton
solarsoft genx file reader. genx files have been used to store calibration data for multiple instruments and distributed within solarsoft. They are stored in XDR format; The External Data Representation Standard file format (XDR) is described in `RFC 1014 <https://tools.ietf.org/html/rfc1014>`__, w...
solarsoft genx file reader.
[ "solarsoft", "genx", "file", "reader", "." ]
def read_genx(filename): """ solarsoft genx file reader. genx files have been used to store calibration data for multiple instruments and distributed within solarsoft. They are stored in XDR format; The External Data Representation Standard file format (XDR) is described in `RFC 1014 <https://t...
[ "def", "read_genx", "(", "filename", ")", ":", "with", "open", "(", "filename", ",", "mode", "=", "'rb'", ")", "as", "xdrfile", ":", "xdrdata", "=", "SSWUnpacker", "(", "xdrfile", ".", "read", "(", ")", ")", "# HEADER information", "version", ",", "xdr",...
https://github.com/sunpy/sunpy/blob/528579df0a4c938c133bd08971ba75c131b189a7/sunpy/io/special/genx.py#L118-L189
volatilityfoundation/volatility
a438e768194a9e05eb4d9ee9338b881c0fa25937
volatility/plugins/addrspaces/amd64.py
python
AMD64PagedMemory.get_pdpi
(self, vaddr, pml4e)
return self.read_long_long_phys(pdpte_paddr)
This method returns the Page Directory Pointer entry for the virtual address. Bits 32:30 are used to select the appropriate 8 byte entry in the Page Directory Pointer table. "Bits 51:12 are from the PML4E" [Intel] "Bits 11:3 are bits 38:30 of the linear address" [Intel] "Bits 2:...
This method returns the Page Directory Pointer entry for the virtual address. Bits 32:30 are used to select the appropriate 8 byte entry in the Page Directory Pointer table.
[ "This", "method", "returns", "the", "Page", "Directory", "Pointer", "entry", "for", "the", "virtual", "address", ".", "Bits", "32", ":", "30", "are", "used", "to", "select", "the", "appropriate", "8", "byte", "entry", "in", "the", "Page", "Directory", "Poi...
def get_pdpi(self, vaddr, pml4e): ''' This method returns the Page Directory Pointer entry for the virtual address. Bits 32:30 are used to select the appropriate 8 byte entry in the Page Directory Pointer table. "Bits 51:12 are from the PML4E" [Intel] "Bits 11:3 are bits...
[ "def", "get_pdpi", "(", "self", ",", "vaddr", ",", "pml4e", ")", ":", "pdpte_paddr", "=", "(", "pml4e", "&", "0xffffffffff000", ")", "|", "(", "(", "vaddr", "&", "0x7FC0000000", ")", ">>", "27", ")", "return", "self", ".", "read_long_long_phys", "(", "...
https://github.com/volatilityfoundation/volatility/blob/a438e768194a9e05eb4d9ee9338b881c0fa25937/volatility/plugins/addrspaces/amd64.py#L134-L145
WoLpH/python-statsd
a757da04375c48d03d322246405b33382d37f03f
statsd/raw.py
python
Raw.send
(self, subname, value, timestamp=None)
return statsd.Client._send(self, {name: '%s|r|%s' % (value, ts)})
Send the data to statsd via self.connection :keyword subname: The subname to report the data to (appended to the client name) :type subname: str :keyword value: The raw value to send
Send the data to statsd via self.connection
[ "Send", "the", "data", "to", "statsd", "via", "self", ".", "connection" ]
def send(self, subname, value, timestamp=None): '''Send the data to statsd via self.connection :keyword subname: The subname to report the data to (appended to the client name) :type subname: str :keyword value: The raw value to send ''' if timestamp is None:...
[ "def", "send", "(", "self", ",", "subname", ",", "value", ",", "timestamp", "=", "None", ")", ":", "if", "timestamp", "is", "None", ":", "ts", "=", "int", "(", "dt", ".", "datetime", ".", "now", "(", ")", ".", "strftime", "(", "\"%s\"", ")", ")",...
https://github.com/WoLpH/python-statsd/blob/a757da04375c48d03d322246405b33382d37f03f/statsd/raw.py#L24-L38
wxWidgets/Phoenix
b2199e299a6ca6d866aa6f3d0888499136ead9d6
wx/lib/agw/ultimatelistctrl.py
python
UltimateListItemData.GetWidth
(self)
return self._rect.width
Returns the item width, in pixels.
Returns the item width, in pixels.
[ "Returns", "the", "item", "width", "in", "pixels", "." ]
def GetWidth(self): """ Returns the item width, in pixels. """ return self._rect.width
[ "def", "GetWidth", "(", "self", ")", ":", "return", "self", ".", "_rect", ".", "width" ]
https://github.com/wxWidgets/Phoenix/blob/b2199e299a6ca6d866aa6f3d0888499136ead9d6/wx/lib/agw/ultimatelistctrl.py#L3108-L3111
Lab41/ipython-spark-docker
a73dca291447f4861a97a9716593306b148d0b2a
mesos/fabfile.py
python
start_masters
()
[]
def start_masters(): run('echo manual | sudo tee /etc/init/mesos-slave.override') run('sudo stop mesos-slave; sudo restart zookeeper') run('sudo start mesos-master') run('sudo start marathon')
[ "def", "start_masters", "(", ")", ":", "run", "(", "'echo manual | sudo tee /etc/init/mesos-slave.override'", ")", "run", "(", "'sudo stop mesos-slave; sudo restart zookeeper'", ")", "run", "(", "'sudo start mesos-master'", ")", "run", "(", "'sudo start marathon'", ")" ]
https://github.com/Lab41/ipython-spark-docker/blob/a73dca291447f4861a97a9716593306b148d0b2a/mesos/fabfile.py#L73-L77
xonsh/xonsh
b76d6f994f22a4078f602f8b386f4ec280c8461f
xonsh/parsers/base.py
python
xonsh_pathsearch
(pattern, pymode=False, lineno=None, col=None)
return xonsh_call( "__xonsh__.pathsearch", args=[func, pattern, pymode, pathobj], lineno=lineno, col=col, )
Creates the AST node for calling the __xonsh__.pathsearch() function. The pymode argument indicate if it is called from subproc or python mode
Creates the AST node for calling the __xonsh__.pathsearch() function. The pymode argument indicate if it is called from subproc or python mode
[ "Creates", "the", "AST", "node", "for", "calling", "the", "__xonsh__", ".", "pathsearch", "()", "function", ".", "The", "pymode", "argument", "indicate", "if", "it", "is", "called", "from", "subproc", "or", "python", "mode" ]
def xonsh_pathsearch(pattern, pymode=False, lineno=None, col=None): """Creates the AST node for calling the __xonsh__.pathsearch() function. The pymode argument indicate if it is called from subproc or python mode""" pymode = ast.NameConstant(value=pymode, lineno=lineno, col_offset=col) searchfunc, patt...
[ "def", "xonsh_pathsearch", "(", "pattern", ",", "pymode", "=", "False", ",", "lineno", "=", "None", ",", "col", "=", "None", ")", ":", "pymode", "=", "ast", ".", "NameConstant", "(", "value", "=", "pymode", ",", "lineno", "=", "lineno", ",", "col_offse...
https://github.com/xonsh/xonsh/blob/b76d6f994f22a4078f602f8b386f4ec280c8461f/xonsh/parsers/base.py#L129-L151
marinho/geraldo
868ebdce67176d9b6205cddc92476f642c783fff
site/newsite/site-geraldo/django/__init__.py
python
get_version
()
return v
Returns the version as a human-format string.
Returns the version as a human-format string.
[ "Returns", "the", "version", "as", "a", "human", "-", "format", "string", "." ]
def get_version(): "Returns the version as a human-format string." v = '.'.join([str(i) for i in VERSION[:-1]]) if VERSION[-1]: from django.utils.version import get_svn_revision v = '%s-%s-%s' % (v, VERSION[-1], get_svn_revision()) return v
[ "def", "get_version", "(", ")", ":", "v", "=", "'.'", ".", "join", "(", "[", "str", "(", "i", ")", "for", "i", "in", "VERSION", "[", ":", "-", "1", "]", "]", ")", "if", "VERSION", "[", "-", "1", "]", ":", "from", "django", ".", "utils", "."...
https://github.com/marinho/geraldo/blob/868ebdce67176d9b6205cddc92476f642c783fff/site/newsite/site-geraldo/django/__init__.py#L3-L9
quic/aimet
dae9bae9a77ca719aa7553fefde4768270fc3518
TrainingExtensions/tensorflow/src/python/aimet_tensorflow/common/connectedgraph.py
python
ConnectedGraph.get_op_from_module_name
(self, name: str)
return self._ops.get(op_info.module_name, None)
Given the name of a tf operation, return the op in ops dict corresponding to the tf operation
Given the name of a tf operation, return the op in ops dict corresponding to the tf operation
[ "Given", "the", "name", "of", "a", "tf", "operation", "return", "the", "op", "in", "ops", "dict", "corresponding", "to", "the", "tf", "operation" ]
def get_op_from_module_name(self, name: str): """ Given the name of a tf operation, return the op in ops dict corresponding to the tf operation """ tf_op = self._graph.get_operation_by_name(name) op_info = self._module_identifier.get_op_info(tf_op) return self._ops.get(op_info.module_na...
[ "def", "get_op_from_module_name", "(", "self", ",", "name", ":", "str", ")", ":", "tf_op", "=", "self", ".", "_graph", ".", "get_operation_by_name", "(", "name", ")", "op_info", "=", "self", ".", "_module_identifier", ".", "get_op_info", "(", "tf_op", ")", ...
https://github.com/quic/aimet/blob/dae9bae9a77ca719aa7553fefde4768270fc3518/TrainingExtensions/tensorflow/src/python/aimet_tensorflow/common/connectedgraph.py#L87-L92
mathics/Mathics
318e06dea8f1c70758a50cb2f95c9900150e3a68
mathics/builtin/numbers/integer.py
python
BitLength.apply
(self, n, evaluation)
return Integer(n.bit_length())
BitLength[n_Integer]
BitLength[n_Integer]
[ "BitLength", "[", "n_Integer", "]" ]
def apply(self, n, evaluation): "BitLength[n_Integer]" n = n.get_int_value() if n < 0: n = -1 - n return Integer(n.bit_length())
[ "def", "apply", "(", "self", ",", "n", ",", "evaluation", ")", ":", "n", "=", "n", ".", "get_int_value", "(", ")", "if", "n", "<", "0", ":", "n", "=", "-", "1", "-", "n", "return", "Integer", "(", "n", ".", "bit_length", "(", ")", ")" ]
https://github.com/mathics/Mathics/blob/318e06dea8f1c70758a50cb2f95c9900150e3a68/mathics/builtin/numbers/integer.py#L193-L198
stopstalk/stopstalk-deployment
10c3ab44c4ece33ae515f6888c15033db2004bb1
aws_lambda/spoj_aws_lambda_function/lambda_code/setuptools/command/easy_install.py
python
easy_install.create_home_path
(self)
Create directories under ~.
Create directories under ~.
[ "Create", "directories", "under", "~", "." ]
def create_home_path(self): """Create directories under ~.""" if not self.user: return home = convert_path(os.path.expanduser("~")) for name, path in six.iteritems(self.config_vars): if path.startswith(home) and not os.path.isdir(path): self.debug_...
[ "def", "create_home_path", "(", "self", ")", ":", "if", "not", "self", ".", "user", ":", "return", "home", "=", "convert_path", "(", "os", ".", "path", ".", "expanduser", "(", "\"~\"", ")", ")", "for", "name", ",", "path", "in", "six", ".", "iteritem...
https://github.com/stopstalk/stopstalk-deployment/blob/10c3ab44c4ece33ae515f6888c15033db2004bb1/aws_lambda/spoj_aws_lambda_function/lambda_code/setuptools/command/easy_install.py#L1340-L1348
avrae/avrae
6ebe46a1ec3d4dfaa2f9b18fac948325f39f87de
cogs5e/models/sheet/base.py
python
Saves.update
(self, explicit_saves: dict)
Updates saves with an explicit dictionary of modifiers. All provided are assumed to have prof=1.
Updates saves with an explicit dictionary of modifiers. All provided are assumed to have prof=1.
[ "Updates", "saves", "with", "an", "explicit", "dictionary", "of", "modifiers", ".", "All", "provided", "are", "assumed", "to", "have", "prof", "=", "1", "." ]
def update(self, explicit_saves: dict): """Updates saves with an explicit dictionary of modifiers. All provided are assumed to have prof=1.""" for save, mod in explicit_saves.items(): if save not in self.saves: raise ValueError(f"{save} is not a save.") self.saves...
[ "def", "update", "(", "self", ",", "explicit_saves", ":", "dict", ")", ":", "for", "save", ",", "mod", "in", "explicit_saves", ".", "items", "(", ")", ":", "if", "save", "not", "in", "self", ".", "saves", ":", "raise", "ValueError", "(", "f\"{save} is ...
https://github.com/avrae/avrae/blob/6ebe46a1ec3d4dfaa2f9b18fac948325f39f87de/cogs5e/models/sheet/base.py#L259-L265
sagemath/sage
f9b2db94f675ff16963ccdefba4f1a3393b3fe0d
src/sage/combinat/set_partition.py
python
SetPartition.check
(self)
Check that we are a valid set partition. EXAMPLES:: sage: S = SetPartitions(4) sage: s = S([[1, 3], [2, 4]]) sage: s.check() TESTS:: sage: s = S([[1, 2, 3]], check=False) sage: s.check() Traceback (most recent call last): ...
Check that we are a valid set partition.
[ "Check", "that", "we", "are", "a", "valid", "set", "partition", "." ]
def check(self): """ Check that we are a valid set partition. EXAMPLES:: sage: S = SetPartitions(4) sage: s = S([[1, 3], [2, 4]]) sage: s.check() TESTS:: sage: s = S([[1, 2, 3]], check=False) sage: s.check() Trac...
[ "def", "check", "(", "self", ")", ":", "if", "self", "not", "in", "self", ".", "parent", "(", ")", ":", "raise", "ValueError", "(", "\"%s is not an element of %s\"", "%", "(", "self", ",", "self", ".", "parent", "(", ")", ")", ")" ]
https://github.com/sagemath/sage/blob/f9b2db94f675ff16963ccdefba4f1a3393b3fe0d/src/sage/combinat/set_partition.py#L626-L650
grayddq/PublicMonitors
814bfe9662d23b64d089ff750aa6a5b3e152d3c2
lib/nmap.py
python
PortScannerHostDict.sctp
(self, port)
return self['sctp'][port]
returns info for sctp port
returns info for sctp port
[ "returns", "info", "for", "sctp", "port" ]
def sctp(self, port): """ returns info for sctp port """ assert type(port) is int, 'Wrong type for [port], should be an int [was {0}]'.format(type(port)) return self['sctp'][port]
[ "def", "sctp", "(", "self", ",", "port", ")", ":", "assert", "type", "(", "port", ")", "is", "int", ",", "'Wrong type for [port], should be an int [was {0}]'", ".", "format", "(", "type", "(", "port", ")", ")", "return", "self", "[", "'sctp'", "]", "[", ...
https://github.com/grayddq/PublicMonitors/blob/814bfe9662d23b64d089ff750aa6a5b3e152d3c2/lib/nmap.py#L772-L778
redis/redis-py
0affa0ed3f3cbcb6dec29b34a580f769f69ae9f7
redis/commands/core.py
python
BasicKeyCommands.getrange
(self, key, start, end)
return self.execute_command("GETRANGE", key, start, end)
Returns the substring of the string value stored at ``key``, determined by the offsets ``start`` and ``end`` (both are inclusive) For more information check https://redis.io/commands/getrange
Returns the substring of the string value stored at ``key``, determined by the offsets ``start`` and ``end`` (both are inclusive)
[ "Returns", "the", "substring", "of", "the", "string", "value", "stored", "at", "key", "determined", "by", "the", "offsets", "start", "and", "end", "(", "both", "are", "inclusive", ")" ]
def getrange(self, key, start, end): """ Returns the substring of the string value stored at ``key``, determined by the offsets ``start`` and ``end`` (both are inclusive) For more information check https://redis.io/commands/getrange """ return self.execute_command("GETRA...
[ "def", "getrange", "(", "self", ",", "key", ",", "start", ",", "end", ")", ":", "return", "self", ".", "execute_command", "(", "\"GETRANGE\"", ",", "key", ",", "start", ",", "end", ")" ]
https://github.com/redis/redis-py/blob/0affa0ed3f3cbcb6dec29b34a580f769f69ae9f7/redis/commands/core.py#L1332-L1339
larryhastings/gilectomy
4315ec3f1d6d4f813cc82ce27a24e7f784dbfc1a
Lib/lib2to3/pgen2/conv.py
python
Converter.run
(self, graminit_h, graminit_c)
Load the grammar tables from the text files written by pgen.
Load the grammar tables from the text files written by pgen.
[ "Load", "the", "grammar", "tables", "from", "the", "text", "files", "written", "by", "pgen", "." ]
def run(self, graminit_h, graminit_c): """Load the grammar tables from the text files written by pgen.""" self.parse_graminit_h(graminit_h) self.parse_graminit_c(graminit_c) self.finish_off()
[ "def", "run", "(", "self", ",", "graminit_h", ",", "graminit_c", ")", ":", "self", ".", "parse_graminit_h", "(", "graminit_h", ")", "self", ".", "parse_graminit_c", "(", "graminit_c", ")", "self", ".", "finish_off", "(", ")" ]
https://github.com/larryhastings/gilectomy/blob/4315ec3f1d6d4f813cc82ce27a24e7f784dbfc1a/Lib/lib2to3/pgen2/conv.py#L47-L51
wistbean/learn_python3_spider
73c873f4845f4385f097e5057407d03dd37a117b
stackoverflow/venv/lib/python3.6/site-packages/pycparser/c_ast.py
python
Node.__repr__
(self)
return result
Generates a python representation of the current node
Generates a python representation of the current node
[ "Generates", "a", "python", "representation", "of", "the", "current", "node" ]
def __repr__(self): """ Generates a python representation of the current node """ result = self.__class__.__name__ + '(' indent = '' separator = '' for name in self.__slots__[:-2]: result += separator result += indent result +=...
[ "def", "__repr__", "(", "self", ")", ":", "result", "=", "self", ".", "__class__", ".", "__name__", "+", "'('", "indent", "=", "''", "separator", "=", "''", "for", "name", "in", "self", ".", "__slots__", "[", ":", "-", "2", "]", ":", "result", "+="...
https://github.com/wistbean/learn_python3_spider/blob/73c873f4845f4385f097e5057407d03dd37a117b/stackoverflow/venv/lib/python3.6/site-packages/pycparser/c_ast.py#L34-L51
facebookresearch/detectron2
cb92ae1763cd7d3777c243f07749574cdaec6cb8
projects/Panoptic-DeepLab/panoptic_deeplab/target_generator.py
python
PanopticDeepLabTargetGenerator.__call__
(self, panoptic, segments_info)
return dict( sem_seg=torch.as_tensor(semantic.astype("long")), center=torch.as_tensor(center.astype(np.float32)), center_points=center_pts, offset=torch.as_tensor(offset.astype(np.float32)), sem_seg_weights=torch.as_tensor(semantic_weights.astype(np.float32)),...
Generates the training target. reference: https://github.com/mcordts/cityscapesScripts/blob/master/cityscapesscripts/preparation/createPanopticImgs.py # noqa reference: https://github.com/facebookresearch/detectron2/blob/main/datasets/prepare_panoptic_fpn.py#L18 # noqa Args: panop...
Generates the training target. reference: https://github.com/mcordts/cityscapesScripts/blob/master/cityscapesscripts/preparation/createPanopticImgs.py # noqa reference: https://github.com/facebookresearch/detectron2/blob/main/datasets/prepare_panoptic_fpn.py#L18 # noqa
[ "Generates", "the", "training", "target", ".", "reference", ":", "https", ":", "//", "github", ".", "com", "/", "mcordts", "/", "cityscapesScripts", "/", "blob", "/", "master", "/", "cityscapesscripts", "/", "preparation", "/", "createPanopticImgs", ".", "py",...
def __call__(self, panoptic, segments_info): """Generates the training target. reference: https://github.com/mcordts/cityscapesScripts/blob/master/cityscapesscripts/preparation/createPanopticImgs.py # noqa reference: https://github.com/facebookresearch/detectron2/blob/main/datasets/prepare_pano...
[ "def", "__call__", "(", "self", ",", "panoptic", ",", "segments_info", ")", ":", "height", ",", "width", "=", "panoptic", ".", "shape", "[", "0", "]", ",", "panoptic", ".", "shape", "[", "1", "]", "semantic", "=", "np", ".", "zeros_like", "(", "panop...
https://github.com/facebookresearch/detectron2/blob/cb92ae1763cd7d3777c243f07749574cdaec6cb8/projects/Panoptic-DeepLab/panoptic_deeplab/target_generator.py#L52-L155
IntelAI/models
1d7a53ccfad3e6f0e7378c9e3c8840895d63df8c
models/common/tensorflow/mlperf_utils/logs/logger.py
python
BenchmarkLogger.log_metric
(self, name, value, unit=None, global_step=None, extras=None)
Log the benchmark metric information to local file. Currently the logging is done in a synchronized way. This should be updated to log asynchronously. Args: name: string, the name of the metric to log. value: number, the value of the metric. The value will not be logged if it is not a ...
Log the benchmark metric information to local file.
[ "Log", "the", "benchmark", "metric", "information", "to", "local", "file", "." ]
def log_metric(self, name, value, unit=None, global_step=None, extras=None): """Log the benchmark metric information to local file. Currently the logging is done in a synchronized way. This should be updated to log asynchronously. Args: name: string, the name of the metric to log. value: n...
[ "def", "log_metric", "(", "self", ",", "name", ",", "value", ",", "unit", "=", "None", ",", "global_step", "=", "None", ",", "extras", "=", "None", ")", ":", "if", "not", "isinstance", "(", "value", ",", "numbers", ".", "Number", ")", ":", "tf", "....
https://github.com/IntelAI/models/blob/1d7a53ccfad3e6f0e7378c9e3c8840895d63df8c/models/common/tensorflow/mlperf_utils/logs/logger.py#L66-L103
tendenci/tendenci
0f2c348cc0e7d41bc56f50b00ce05544b083bf1d
tendenci/apps/corporate_memberships/import_processor.py
python
CorpMembershipImportProcessor.process_corp_membership
(self, cmemb_data, **kwargs)
return corp_memb_display
Check if it's insert or update. If dry_run is False, do the import to the corpmembership. :param cmemb_data: a dictionary that includes the info of a corp_membership
Check if it's insert or update. If dry_run is False, do the import to the corpmembership.
[ "Check", "if", "it", "s", "insert", "or", "update", ".", "If", "dry_run", "is", "False", "do", "the", "import", "to", "the", "corpmembership", "." ]
def process_corp_membership(self, cmemb_data, **kwargs): """ Check if it's insert or update. If dry_run is False, do the import to the corpmembership. :param cmemb_data: a dictionary that includes the info of a corp_membership """ self.cmemb_data = cmemb_data ...
[ "def", "process_corp_membership", "(", "self", ",", "cmemb_data", ",", "*", "*", "kwargs", ")", ":", "self", ".", "cmemb_data", "=", "cmemb_data", "if", "'id'", "not", "in", "self", ".", "cmemb_data", ":", "if", "'id'", "in", "self", ".", "corp_membership_...
https://github.com/tendenci/tendenci/blob/0f2c348cc0e7d41bc56f50b00ce05544b083bf1d/tendenci/apps/corporate_memberships/import_processor.py#L156-L260
cloudera/impyla
0c736af4cad2bade9b8e313badc08ec50e81c948
impala/_thrift_gen/hive_metastore/ThriftHiveMetastore.py
python
Client.alter_table
(self, dbname, tbl_name, new_tbl)
Parameters: - dbname - tbl_name - new_tbl
Parameters: - dbname - tbl_name - new_tbl
[ "Parameters", ":", "-", "dbname", "-", "tbl_name", "-", "new_tbl" ]
def alter_table(self, dbname, tbl_name, new_tbl): """ Parameters: - dbname - tbl_name - new_tbl """ self.send_alter_table(dbname, tbl_name, new_tbl) self.recv_alter_table()
[ "def", "alter_table", "(", "self", ",", "dbname", ",", "tbl_name", ",", "new_tbl", ")", ":", "self", ".", "send_alter_table", "(", "dbname", ",", "tbl_name", ",", "new_tbl", ")", "self", ".", "recv_alter_table", "(", ")" ]
https://github.com/cloudera/impyla/blob/0c736af4cad2bade9b8e313badc08ec50e81c948/impala/_thrift_gen/hive_metastore/ThriftHiveMetastore.py#L2305-L2313
zhl2008/awd-platform
0416b31abea29743387b10b3914581fbe8e7da5e
web_flaskbb/Python-2.7.9/Lib/lib-tk/turtle.py
python
RawTurtle.reset
(self)
Delete the turtle's drawings and restore its default values. No argument. , Delete the turtle's drawings from the screen, re-center the turtle and set variables to the default values. Example (for a Turtle instance named turtle): >>> turtle.position() (0.00,-22.00) ...
Delete the turtle's drawings and restore its default values.
[ "Delete", "the", "turtle", "s", "drawings", "and", "restore", "its", "default", "values", "." ]
def reset(self): """Delete the turtle's drawings and restore its default values. No argument. , Delete the turtle's drawings from the screen, re-center the turtle and set variables to the default values. Example (for a Turtle instance named turtle): >>> turtle.position(...
[ "def", "reset", "(", "self", ")", ":", "TNavigator", ".", "reset", "(", "self", ")", "TPen", ".", "_reset", "(", "self", ")", "self", ".", "_clear", "(", ")", "self", ".", "_drawturtle", "(", ")", "self", ".", "_update", "(", ")" ]
https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_flaskbb/Python-2.7.9/Lib/lib-tk/turtle.py#L2463-L2486
apache/tvm
6eb4ed813ebcdcd9558f0906a1870db8302ff1e0
python/tvm/contrib/graph_executor.py
python
GraphModule.get_input_info
(self)
return shape_dict, dtype_dict
Return the 'shape' and 'dtype' dictionaries of the graph. .. note:: We can't simply get the input tensors from a TVM graph because weight tensors are treated equivalently. Therefore, to find the input tensors we look at the 'arg_nodes' in the graph (which are eit...
Return the 'shape' and 'dtype' dictionaries of the graph.
[ "Return", "the", "shape", "and", "dtype", "dictionaries", "of", "the", "graph", "." ]
def get_input_info(self): """Return the 'shape' and 'dtype' dictionaries of the graph. .. note:: We can't simply get the input tensors from a TVM graph because weight tensors are treated equivalently. Therefore, to find the input tensors we look at the 'arg_nodes' in...
[ "def", "get_input_info", "(", "self", ")", ":", "input_info", "=", "self", ".", "_get_input_info", "(", ")", "assert", "\"shape\"", "in", "input_info", "shape_dict", "=", "input_info", "[", "\"shape\"", "]", "assert", "\"dtype\"", "in", "input_info", "dtype_dict...
https://github.com/apache/tvm/blob/6eb4ed813ebcdcd9558f0906a1870db8302ff1e0/python/tvm/contrib/graph_executor.py#L262-L286
mrjoes/flask-admin
402b56ea844dc5b215f6293e7dc63f39a6723692
flask_admin/contrib/sqla/view.py
python
ModelView.__init__
(self, model, session, name=None, category=None, endpoint=None, url=None, static_folder=None, menu_class_name=None, menu_icon_type=None, menu_icon_value=None)
Constructor. :param model: Model class :param session: SQLAlchemy session :param name: View name. If not set, defaults to the model name :param category: Category name :param endpoint: ...
Constructor.
[ "Constructor", "." ]
def __init__(self, model, session, name=None, category=None, endpoint=None, url=None, static_folder=None, menu_class_name=None, menu_icon_type=None, menu_icon_value=None): """ Constructor. :param model: Model class :param ses...
[ "def", "__init__", "(", "self", ",", "model", ",", "session", ",", "name", "=", "None", ",", "category", "=", "None", ",", "endpoint", "=", "None", ",", "url", "=", "None", ",", "static_folder", "=", "None", ",", "menu_class_name", "=", "None", ",", ...
https://github.com/mrjoes/flask-admin/blob/402b56ea844dc5b215f6293e7dc63f39a6723692/flask_admin/contrib/sqla/view.py#L245-L301
F8LEFT/DecLLVM
d38e45e3d0dd35634adae1d0cf7f96f3bd96e74c
python/idaapi.py
python
AskUsingForm
(*args)
return r
Calls the AskUsingForm() @param: Compiled Arguments obtain through the Form.Compile() function @return: 1 = ok, 0 = cancel
Calls the AskUsingForm()
[ "Calls", "the", "AskUsingForm", "()" ]
def AskUsingForm(*args): """ Calls the AskUsingForm() @param: Compiled Arguments obtain through the Form.Compile() function @return: 1 = ok, 0 = cancel """ old = set_script_timeout(0) r = AskUsingForm__(*args) set_script_timeout(old) return r
[ "def", "AskUsingForm", "(", "*", "args", ")", ":", "old", "=", "set_script_timeout", "(", "0", ")", "r", "=", "AskUsingForm__", "(", "*", "args", ")", "set_script_timeout", "(", "old", ")", "return", "r" ]
https://github.com/F8LEFT/DecLLVM/blob/d38e45e3d0dd35634adae1d0cf7f96f3bd96e74c/python/idaapi.py#L45600-L45609
livid/v2ex-gae
32be3a77d535e7c9df85a333e01ab8834d0e8581
twitter/twitter.py
python
User.SetScreenName
(self, screen_name)
Set the short username of this user. Args: screen_name: the short username of this user
Set the short username of this user.
[ "Set", "the", "short", "username", "of", "this", "user", "." ]
def SetScreenName(self, screen_name): '''Set the short username of this user. Args: screen_name: the short username of this user ''' self._screen_name = screen_name
[ "def", "SetScreenName", "(", "self", ",", "screen_name", ")", ":", "self", ".", "_screen_name", "=", "screen_name" ]
https://github.com/livid/v2ex-gae/blob/32be3a77d535e7c9df85a333e01ab8834d0e8581/twitter/twitter.py#L553-L559
F8LEFT/DecLLVM
d38e45e3d0dd35634adae1d0cf7f96f3bd96e74c
python/idaapi.py
python
wait_for_next_event
(*args)
return _idaapi.wait_for_next_event(*args)
wait_for_next_event(wfne, timeout_in_secs) -> dbg_event_code_t
wait_for_next_event(wfne, timeout_in_secs) -> dbg_event_code_t
[ "wait_for_next_event", "(", "wfne", "timeout_in_secs", ")", "-", ">", "dbg_event_code_t" ]
def wait_for_next_event(*args): """ wait_for_next_event(wfne, timeout_in_secs) -> dbg_event_code_t """ return _idaapi.wait_for_next_event(*args)
[ "def", "wait_for_next_event", "(", "*", "args", ")", ":", "return", "_idaapi", ".", "wait_for_next_event", "(", "*", "args", ")" ]
https://github.com/F8LEFT/DecLLVM/blob/d38e45e3d0dd35634adae1d0cf7f96f3bd96e74c/python/idaapi.py#L24066-L24070
pwnieexpress/pwn_plug_sources
1a23324f5dc2c3de20f9c810269b6a29b2758cad
src/metagoofil/hachoir_parser/network/tcpdump.py
python
Layer.parseNext
(self, parent)
return None
[]
def parseNext(self, parent): return None
[ "def", "parseNext", "(", "self", ",", "parent", ")", ":", "return", "None" ]
https://github.com/pwnieexpress/pwn_plug_sources/blob/1a23324f5dc2c3de20f9c810269b6a29b2758cad/src/metagoofil/hachoir_parser/network/tcpdump.py#L31-L32