nwo
stringlengths
5
106
sha
stringlengths
40
40
path
stringlengths
4
174
language
stringclasses
1 value
identifier
stringlengths
1
140
parameters
stringlengths
0
87.7k
argument_list
stringclasses
1 value
return_statement
stringlengths
0
426k
docstring
stringlengths
0
64.3k
docstring_summary
stringlengths
0
26.3k
docstring_tokens
list
function
stringlengths
18
4.83M
function_tokens
list
url
stringlengths
83
304
openstack/mistral
b2d6de569c7bba96cd3179189ffbcee6b7a28c1f
mistral/engine/tasks.py
python
Task.defer
(self)
Defers task. This method puts task to a waiting state.
Defers task.
[ "Defers", "task", "." ]
def defer(self): """Defers task. This method puts task to a waiting state. """ # NOTE(rakhmerov): using named locks may cause problems under load # with MySQL that raises a lot of deadlocks in case of high # parallelism so it makes sense to do a fast check if the object...
[ "def", "defer", "(", "self", ")", ":", "# NOTE(rakhmerov): using named locks may cause problems under load", "# with MySQL that raises a lot of deadlocks in case of high", "# parallelism so it makes sense to do a fast check if the object", "# already exists in DB outside of the lock.", "if", "...
https://github.com/openstack/mistral/blob/b2d6de569c7bba96cd3179189ffbcee6b7a28c1f/mistral/engine/tasks.py#L247-L286
googleads/google-ads-python
2a1d6062221f6aad1992a6bcca0e7e4a93d2db86
google/ads/googleads/v9/services/services/keyword_plan_idea_service/client.py
python
KeywordPlanIdeaServiceClient.parse_common_folder_path
(path: str)
return m.groupdict() if m else {}
Parse a folder path into its component segments.
Parse a folder path into its component segments.
[ "Parse", "a", "folder", "path", "into", "its", "component", "segments", "." ]
def parse_common_folder_path(path: str) -> Dict[str, str]: """Parse a folder path into its component segments.""" m = re.match(r"^folders/(?P<folder>.+?)$", path) return m.groupdict() if m else {}
[ "def", "parse_common_folder_path", "(", "path", ":", "str", ")", "->", "Dict", "[", "str", ",", "str", "]", ":", "m", "=", "re", ".", "match", "(", "r\"^folders/(?P<folder>.+?)$\"", ",", "path", ")", "return", "m", ".", "groupdict", "(", ")", "if", "m"...
https://github.com/googleads/google-ads-python/blob/2a1d6062221f6aad1992a6bcca0e7e4a93d2db86/google/ads/googleads/v9/services/services/keyword_plan_idea_service/client.py#L198-L201
espnet/espnet
ea411f3f627b8f101c211e107d0ff7053344ac80
espnet/nets/pytorch_backend/transducer/error_calculator.py
python
ErrorCalculator.__init__
( self, decoder: Union[RNNDecoder, CustomDecoder], joint_network: JointNetwork, token_list: List[int], sym_space: str, sym_blank: str, report_cer: bool = False, report_wer: bool = False, )
Construct an ErrorCalculator object for Transducer model.
Construct an ErrorCalculator object for Transducer model.
[ "Construct", "an", "ErrorCalculator", "object", "for", "Transducer", "model", "." ]
def __init__( self, decoder: Union[RNNDecoder, CustomDecoder], joint_network: JointNetwork, token_list: List[int], sym_space: str, sym_blank: str, report_cer: bool = False, report_wer: bool = False, ): """Construct an ErrorCalculator object for...
[ "def", "__init__", "(", "self", ",", "decoder", ":", "Union", "[", "RNNDecoder", ",", "CustomDecoder", "]", ",", "joint_network", ":", "JointNetwork", ",", "token_list", ":", "List", "[", "int", "]", ",", "sym_space", ":", "str", ",", "sym_blank", ":", "...
https://github.com/espnet/espnet/blob/ea411f3f627b8f101c211e107d0ff7053344ac80/espnet/nets/pytorch_backend/transducer/error_calculator.py#L29-L56
securesystemslab/zippy
ff0e84ac99442c2c55fe1d285332cfd4e185e089
zippy/benchmarks/src/benchmarks/sympy/sympy/simplify/hyperexpand.py
python
Hyper_Function.build_invariants
(self)
return (self.gamma, tr(abuckets), tr(bbuckets))
Compute the invariant vector. The invariant vector is: (gamma, ((s1, n1), ..., (sk, nk)), ((t1, m1), ..., (tr, mr))) where gamma is the number of integer a < 0, s1 < ... < sk nl is the number of parameters a_i congruent to sl mod 1 t1 < ... < tr ...
Compute the invariant vector.
[ "Compute", "the", "invariant", "vector", "." ]
def build_invariants(self): """ Compute the invariant vector. The invariant vector is: (gamma, ((s1, n1), ..., (sk, nk)), ((t1, m1), ..., (tr, mr))) where gamma is the number of integer a < 0, s1 < ... < sk nl is the number of parameters a_i congr...
[ "def", "build_invariants", "(", "self", ")", ":", "abuckets", ",", "bbuckets", "=", "sift", "(", "self", ".", "ap", ",", "_mod1", ")", ",", "sift", "(", "self", ".", "bq", ",", "_mod1", ")", "def", "tr", "(", "bucket", ")", ":", "bucket", "=", "l...
https://github.com/securesystemslab/zippy/blob/ff0e84ac99442c2c55fe1d285332cfd4e185e089/zippy/benchmarks/src/benchmarks/sympy/sympy/simplify/hyperexpand.py#L511-L549
PyMVPA/PyMVPA
76c476b3de8264b0bb849bf226da5674d659564e
mvpa2/featsel/helpers.py
python
NBackHistoryStopCrit.__init__
(self, bestdetector=BestDetector(), steps=10)
Initialize with number of steps Parameters ---------- bestdetector : BestDetector used to determine where the best error is located. steps : int How many steps to check after optimal value.
Initialize with number of steps
[ "Initialize", "with", "number", "of", "steps" ]
def __init__(self, bestdetector=BestDetector(), steps=10): """Initialize with number of steps Parameters ---------- bestdetector : BestDetector used to determine where the best error is located. steps : int How many steps to check after optimal value. ...
[ "def", "__init__", "(", "self", ",", "bestdetector", "=", "BestDetector", "(", ")", ",", "steps", "=", "10", ")", ":", "StoppingCriterion", ".", "__init__", "(", "self", ")", "if", "steps", "<", "0", ":", "raise", "ValueError", ",", "\"Number of steps (got...
https://github.com/PyMVPA/PyMVPA/blob/76c476b3de8264b0bb849bf226da5674d659564e/mvpa2/featsel/helpers.py#L201-L216
etetoolkit/ete
2b207357dc2a40ccad7bfd8f54964472c72e4726
ete3/phyloxml/_phyloxml.py
python
BranchColor.build
(self, node)
[]
def build(self, node): self.buildAttributes(node, node.attrib, []) for child in node: nodeName_ = Tag_pattern_.match(child.tag).groups()[-1] self.buildChildren(child, node, nodeName_)
[ "def", "build", "(", "self", ",", "node", ")", ":", "self", ".", "buildAttributes", "(", "node", ",", "node", ".", "attrib", ",", "[", "]", ")", "for", "child", "in", "node", ":", "nodeName_", "=", "Tag_pattern_", ".", "match", "(", "child", ".", "...
https://github.com/etetoolkit/ete/blob/2b207357dc2a40ccad7bfd8f54964472c72e4726/ete3/phyloxml/_phyloxml.py#L3683-L3687
WikidPad/WikidPad
558109638807bc76b4672922686e416ab2d5f79c
WikidPad/lib/whoosh/lang/wordnet.py
python
Thesaurus.from_storage
(cls, storage, indexname="THES")
return thes
Creates a Thesaurus object from the given storage object, which should contain an index created by Thesaurus.to_storage(). >>> from whoosh.filedb.filestore import FileStorage >>> fs = FileStorage("index") >>> t = Thesaurus.from_storage(fs) >>> t.synonyms("hail") ['acclai...
Creates a Thesaurus object from the given storage object, which should contain an index created by Thesaurus.to_storage().
[ "Creates", "a", "Thesaurus", "object", "from", "the", "given", "storage", "object", "which", "should", "contain", "an", "index", "created", "by", "Thesaurus", ".", "to_storage", "()", "." ]
def from_storage(cls, storage, indexname="THES"): """Creates a Thesaurus object from the given storage object, which should contain an index created by Thesaurus.to_storage(). >>> from whoosh.filedb.filestore import FileStorage >>> fs = FileStorage("index") >>> t = Thesaurus.fro...
[ "def", "from_storage", "(", "cls", ",", "storage", ",", "indexname", "=", "\"THES\"", ")", ":", "thes", "=", "cls", "(", ")", "index", "=", "storage", ".", "open_index", "(", "indexname", "=", "indexname", ")", "thes", ".", "searcher", "=", "index", "....
https://github.com/WikidPad/WikidPad/blob/558109638807bc76b4672922686e416ab2d5f79c/WikidPad/lib/whoosh/lang/wordnet.py#L191-L210
Azure/azure-linux-extensions
a42ef718c746abab2b3c6a21da87b29e76364558
Common/libpsutil/py2.7-glibc-2.12+/psutil/__init__.py
python
Process.as_dict
(self, attrs=None, ad_value=None)
return retdict
Utility method returning process information as a hashable dictionary. If 'attrs' is specified it must be a list of strings reflecting available Process class' attribute names (e.g. ['cpu_times', 'name']) else all public (read only) attributes are assumed. 'ad_value' is...
Utility method returning process information as a hashable dictionary.
[ "Utility", "method", "returning", "process", "information", "as", "a", "hashable", "dictionary", "." ]
def as_dict(self, attrs=None, ad_value=None): """Utility method returning process information as a hashable dictionary. If 'attrs' is specified it must be a list of strings reflecting available Process class' attribute names (e.g. ['cpu_times', 'name']) else all public (read ...
[ "def", "as_dict", "(", "self", ",", "attrs", "=", "None", ",", "ad_value", "=", "None", ")", ":", "excluded_names", "=", "set", "(", "[", "'send_signal'", ",", "'suspend'", ",", "'resume'", ",", "'terminate'", ",", "'kill'", ",", "'wait'", ",", "'is_runn...
https://github.com/Azure/azure-linux-extensions/blob/a42ef718c746abab2b3c6a21da87b29e76364558/Common/libpsutil/py2.7-glibc-2.12+/psutil/__init__.py#L388-L442
inkandswitch/livebook
93c8d467734787366ad084fc3566bf5cbe249c51
public/pypyjs/modules/difflib.py
python
Differ._fancy_replace
(self, a, alo, ahi, b, blo, bhi)
r""" When replacing one block of lines with another, search the blocks for *similar* lines; the best-matching pair (if any) is used as a synch point, and intraline difference marking is done on the similar pair. Lots of work, but often worth it. Example: >>> d = Differ(...
r""" When replacing one block of lines with another, search the blocks for *similar* lines; the best-matching pair (if any) is used as a synch point, and intraline difference marking is done on the similar pair. Lots of work, but often worth it.
[ "r", "When", "replacing", "one", "block", "of", "lines", "with", "another", "search", "the", "blocks", "for", "*", "similar", "*", "lines", ";", "the", "best", "-", "matching", "pair", "(", "if", "any", ")", "is", "used", "as", "a", "synch", "point", ...
def _fancy_replace(self, a, alo, ahi, b, blo, bhi): r""" When replacing one block of lines with another, search the blocks for *similar* lines; the best-matching pair (if any) is used as a synch point, and intraline difference marking is done on the similar pair. Lots of work, bu...
[ "def", "_fancy_replace", "(", "self", ",", "a", ",", "alo", ",", "ahi", ",", "b", ",", "blo", ",", "bhi", ")", ":", "# don't synch up unless the lines have a similarity score of at", "# least cutoff; best_ratio tracks the best score seen so far", "best_ratio", ",", "cutof...
https://github.com/inkandswitch/livebook/blob/93c8d467734787366ad084fc3566bf5cbe249c51/public/pypyjs/modules/difflib.py#L943-L1039
cylc/cylc-flow
5ec221143476c7c616c156b74158edfbcd83794a
cylc/flow/network/graphql.py
python
null_stripper
(exe_result)
return exe_result
Strip nulls in accordance with type of execution result.
Strip nulls in accordance with type of execution result.
[ "Strip", "nulls", "in", "accordance", "with", "type", "of", "execution", "result", "." ]
def null_stripper(exe_result): """Strip nulls in accordance with type of execution result.""" if isinstance(exe_result, Observable): return exe_result.map(attr_strip_null) if not exe_result.errors: return attr_strip_null(exe_result) return exe_result
[ "def", "null_stripper", "(", "exe_result", ")", ":", "if", "isinstance", "(", "exe_result", ",", "Observable", ")", ":", "return", "exe_result", ".", "map", "(", "attr_strip_null", ")", "if", "not", "exe_result", ".", "errors", ":", "return", "attr_strip_null"...
https://github.com/cylc/cylc-flow/blob/5ec221143476c7c616c156b74158edfbcd83794a/cylc/flow/network/graphql.py#L134-L140
qiueer/zabbix
31983dedbd59d917ecd71bb6f36b35302673a783
Tomcat/tomcat.py
python
main
()
[]
def main(): try: usage = "usage: %prog [options]\nGet Tomcat Stat" parser = OptionParser(usage) parser.add_option("-l", "--list", action="store_true", dest="is_list", default=False, help="if list all port") par...
[ "def", "main", "(", ")", ":", "try", ":", "usage", "=", "\"usage: %prog [options]\\nGet Tomcat Stat\"", "parser", "=", "OptionParser", "(", "usage", ")", "parser", ".", "add_option", "(", "\"-l\"", ",", "\"--list\"", ",", "action", "=", "\"store_true\"", ",", ...
https://github.com/qiueer/zabbix/blob/31983dedbd59d917ecd71bb6f36b35302673a783/Tomcat/tomcat.py#L403-L465
sqall01/alertR
e1d1a83e54f876cc4cd7bd87387e05cb75d4dc13
alertClientRaspberryPi/lib/alert/gpio.py
python
RaspberryPiGPIOAlert.set_state
(self, new_state: int)
Sets the state the Alert is currently in. :param new_state: 0 (normal) or 1 (triggered)
Sets the state the Alert is currently in.
[ "Sets", "the", "state", "the", "Alert", "is", "currently", "in", "." ]
def set_state(self, new_state: int): """ Sets the state the Alert is currently in. :param new_state: 0 (normal) or 1 (triggered) """ with self.state_lock: if new_state == 1 and self.state == 0: self.state = 1 GPIO.output(self.gpio_pin,...
[ "def", "set_state", "(", "self", ",", "new_state", ":", "int", ")", ":", "with", "self", ".", "state_lock", ":", "if", "new_state", "==", "1", "and", "self", ".", "state", "==", "0", ":", "self", ".", "state", "=", "1", "GPIO", ".", "output", "(", ...
https://github.com/sqall01/alertR/blob/e1d1a83e54f876cc4cd7bd87387e05cb75d4dc13/alertClientRaspberryPi/lib/alert/gpio.py#L64-L76
Chaffelson/nipyapi
d3b186fd701ce308c2812746d98af9120955e810
nipyapi/nifi/models/versioned_label.py
python
VersionedLabel.component_type
(self, component_type)
Sets the component_type of this VersionedLabel. :param component_type: The component_type of this VersionedLabel. :type: str
Sets the component_type of this VersionedLabel.
[ "Sets", "the", "component_type", "of", "this", "VersionedLabel", "." ]
def component_type(self, component_type): """ Sets the component_type of this VersionedLabel. :param component_type: The component_type of this VersionedLabel. :type: str """ allowed_values = ["CONNECTION", "PROCESSOR", "PROCESS_GROUP", "REMOTE_PROCESS_GROUP", "INPUT_POR...
[ "def", "component_type", "(", "self", ",", "component_type", ")", ":", "allowed_values", "=", "[", "\"CONNECTION\"", ",", "\"PROCESSOR\"", ",", "\"PROCESS_GROUP\"", ",", "\"REMOTE_PROCESS_GROUP\"", ",", "\"INPUT_PORT\"", ",", "\"OUTPUT_PORT\"", ",", "\"REMOTE_INPUT_PORT...
https://github.com/Chaffelson/nipyapi/blob/d3b186fd701ce308c2812746d98af9120955e810/nipyapi/nifi/models/versioned_label.py#L291-L305
smacke/ffsubsync
9ae15d825b24b3445112683bbb7b2e4a9d3ecb8f
ffsubsync/_version.py
python
plus_or_dot
(pieces)
return "+"
Return a + if we don't already have one, else return a .
Return a + if we don't already have one, else return a .
[ "Return", "a", "+", "if", "we", "don", "t", "already", "have", "one", "else", "return", "a", "." ]
def plus_or_dot(pieces): """Return a + if we don't already have one, else return a .""" if "+" in pieces.get("closest-tag", ""): return "." return "+"
[ "def", "plus_or_dot", "(", "pieces", ")", ":", "if", "\"+\"", "in", "pieces", ".", "get", "(", "\"closest-tag\"", ",", "\"\"", ")", ":", "return", "\".\"", "return", "\"+\"" ]
https://github.com/smacke/ffsubsync/blob/9ae15d825b24b3445112683bbb7b2e4a9d3ecb8f/ffsubsync/_version.py#L308-L312
ucfopen/canvasapi
3f1a71e23c86a49dbaa6e84f6c0e81c297b86e36
canvasapi/course.py
python
Course.get_multiple_submissions
(self, **kwargs)
return PaginatedList( cls, self._requester, "GET", "courses/{}/students/submissions".format(self.id), {"course_id": self.id}, _kwargs=combine_kwargs(**kwargs), )
List submissions for multiple assignments. Get all existing submissions for a given set of students and assignments. :calls: `GET /api/v1/courses/:course_id/students/submissions \ <https://canvas.instructure.com/doc/api/submissions.html#method.submissions_api.for_students>`_ :rtype: :c...
List submissions for multiple assignments. Get all existing submissions for a given set of students and assignments.
[ "List", "submissions", "for", "multiple", "assignments", ".", "Get", "all", "existing", "submissions", "for", "a", "given", "set", "of", "students", "and", "assignments", "." ]
def get_multiple_submissions(self, **kwargs): """ List submissions for multiple assignments. Get all existing submissions for a given set of students and assignments. :calls: `GET /api/v1/courses/:course_id/students/submissions \ <https://canvas.instructure.com/doc/api/submissio...
[ "def", "get_multiple_submissions", "(", "self", ",", "*", "*", "kwargs", ")", ":", "is_grouped", "=", "kwargs", ".", "get", "(", "\"grouped\"", ",", "False", ")", "if", "normalize_bool", "(", "is_grouped", ",", "\"grouped\"", ")", ":", "cls", "=", "Grouped...
https://github.com/ucfopen/canvasapi/blob/3f1a71e23c86a49dbaa6e84f6c0e81c297b86e36/canvasapi/course.py#L1665-L1691
hak5/nano-tetra-modules
aa43cb5e2338b8dbd12a75314104a34ba608263b
PortalAuth/includes/scripts/libs/requests/adapters.py
python
HTTPAdapter.cert_verify
(self, conn, url, verify, cert)
Verify a SSL certificate. This method should not be called from user code, and is only exposed for use when subclassing the :class:`HTTPAdapter <requests.adapters.HTTPAdapter>`. :param conn: The urllib3 connection object associated with the cert. :param url: The requested URL. :...
Verify a SSL certificate. This method should not be called from user code, and is only exposed for use when subclassing the :class:`HTTPAdapter <requests.adapters.HTTPAdapter>`.
[ "Verify", "a", "SSL", "certificate", ".", "This", "method", "should", "not", "be", "called", "from", "user", "code", "and", "is", "only", "exposed", "for", "use", "when", "subclassing", "the", ":", "class", ":", "HTTPAdapter", "<requests", ".", "adapters", ...
def cert_verify(self, conn, url, verify, cert): """Verify a SSL certificate. This method should not be called from user code, and is only exposed for use when subclassing the :class:`HTTPAdapter <requests.adapters.HTTPAdapter>`. :param conn: The urllib3 connection object associated with...
[ "def", "cert_verify", "(", "self", ",", "conn", ",", "url", ",", "verify", ",", "cert", ")", ":", "if", "url", ".", "lower", "(", ")", ".", "startswith", "(", "'https'", ")", "and", "verify", ":", "cert_loc", "=", "None", "# Allow self-specified cert loc...
https://github.com/hak5/nano-tetra-modules/blob/aa43cb5e2338b8dbd12a75314104a34ba608263b/PortalAuth/includes/scripts/libs/requests/adapters.py#L159-L194
jgagneastro/coffeegrindsize
22661ebd21831dba4cf32bfc6ba59fe3d49f879c
App/dist/coffeegrindsize.app/Contents/Resources/lib/python3.7/matplotlib/backends/backend_wx.py
python
FigureManagerWx.resize
(self, width, height)
Set the canvas size in pixels
Set the canvas size in pixels
[ "Set", "the", "canvas", "size", "in", "pixels" ]
def resize(self, width, height): 'Set the canvas size in pixels' self.canvas.SetInitialSize(wx.Size(width, height)) self.window.GetSizer().Fit(self.window)
[ "def", "resize", "(", "self", ",", "width", ",", "height", ")", ":", "self", ".", "canvas", ".", "SetInitialSize", "(", "wx", ".", "Size", "(", "width", ",", "height", ")", ")", "self", ".", "window", ".", "GetSizer", "(", ")", ".", "Fit", "(", "...
https://github.com/jgagneastro/coffeegrindsize/blob/22661ebd21831dba4cf32bfc6ba59fe3d49f879c/App/dist/coffeegrindsize.app/Contents/Resources/lib/python3.7/matplotlib/backends/backend_wx.py#L1298-L1301
inspurer/WorkAttendanceSystem
1221e2d67bdf5bb15fe99517cc3ded58ccb066df
V2.0/venv/Lib/site-packages/pip-9.0.1-py3.5.egg/pip/_vendor/cachecontrol/controller.py
python
CacheController.cache_response
(self, request, response, body=None)
Algorithm for caching requests. This assumes a requests Response object.
Algorithm for caching requests.
[ "Algorithm", "for", "caching", "requests", "." ]
def cache_response(self, request, response, body=None): """ Algorithm for caching requests. This assumes a requests Response object. """ # From httplib2: Don't cache 206's since we aren't going to # handle byte range requests cacheable_status_codes...
[ "def", "cache_response", "(", "self", ",", "request", ",", "response", ",", "body", "=", "None", ")", ":", "# From httplib2: Don't cache 206's since we aren't going to", "# handle byte range requests", "cacheable_status_codes", "=", "[", "200", ",", "203", ...
https://github.com/inspurer/WorkAttendanceSystem/blob/1221e2d67bdf5bb15fe99517cc3ded58ccb066df/V2.0/venv/Lib/site-packages/pip-9.0.1-py3.5.egg/pip/_vendor/cachecontrol/controller.py#L223-L308
kubernetes-client/python
47b9da9de2d02b2b7a34fbe05afb44afd130d73a
kubernetes/client/models/v1_pod_security_context.py
python
V1PodSecurityContext.seccomp_profile
(self, seccomp_profile)
Sets the seccomp_profile of this V1PodSecurityContext. :param seccomp_profile: The seccomp_profile of this V1PodSecurityContext. # noqa: E501 :type: V1SeccompProfile
Sets the seccomp_profile of this V1PodSecurityContext.
[ "Sets", "the", "seccomp_profile", "of", "this", "V1PodSecurityContext", "." ]
def seccomp_profile(self, seccomp_profile): """Sets the seccomp_profile of this V1PodSecurityContext. :param seccomp_profile: The seccomp_profile of this V1PodSecurityContext. # noqa: E501 :type: V1SeccompProfile """ self._seccomp_profile = seccomp_profile
[ "def", "seccomp_profile", "(", "self", ",", "seccomp_profile", ")", ":", "self", ".", "_seccomp_profile", "=", "seccomp_profile" ]
https://github.com/kubernetes-client/python/blob/47b9da9de2d02b2b7a34fbe05afb44afd130d73a/kubernetes/client/models/v1_pod_security_context.py#L247-L255
HaoZhang95/Python24
b897224b8a0e6a5734f408df8c24846a98c553bf
00Python/venv/Lib/site-packages/pip-10.0.1-py3.7.egg/pip/_vendor/html5lib/serializer.py
python
HTMLSerializer.__init__
(self, **kwargs)
Initialize HTMLSerializer :arg inject_meta_charset: Whether or not to inject the meta charset. Defaults to ``True``. :arg quote_attr_values: Whether to quote attribute values that don't require quoting per legacy browser behavior (``"legacy"``), when required by th...
Initialize HTMLSerializer
[ "Initialize", "HTMLSerializer" ]
def __init__(self, **kwargs): """Initialize HTMLSerializer :arg inject_meta_charset: Whether or not to inject the meta charset. Defaults to ``True``. :arg quote_attr_values: Whether to quote attribute values that don't require quoting per legacy browser behavior (``"le...
[ "def", "__init__", "(", "self", ",", "*", "*", "kwargs", ")", ":", "unexpected_args", "=", "frozenset", "(", "kwargs", ")", "-", "frozenset", "(", "self", ".", "options", ")", "if", "len", "(", "unexpected_args", ")", ">", "0", ":", "raise", "TypeError...
https://github.com/HaoZhang95/Python24/blob/b897224b8a0e6a5734f408df8c24846a98c553bf/00Python/venv/Lib/site-packages/pip-10.0.1-py3.7.egg/pip/_vendor/html5lib/serializer.py#L135-L222
JoinMarket-Org/joinmarket-clientserver
8b3d21f226185e31aa10e8e16cdfc719cea4a98e
jmclient/jmclient/wallet_utils.py
python
WalletViewEntry.get_balance
(self, include_unconf=True)
return self.unconfirmed_amount/1e8
Overwrites base class since no children
Overwrites base class since no children
[ "Overwrites", "base", "class", "since", "no", "children" ]
def get_balance(self, include_unconf=True): """Overwrites base class since no children """ if not include_unconf: raise NotImplementedError("Separate conf/unconf balances not impl.") return self.unconfirmed_amount/1e8
[ "def", "get_balance", "(", "self", ",", "include_unconf", "=", "True", ")", ":", "if", "not", "include_unconf", ":", "raise", "NotImplementedError", "(", "\"Separate conf/unconf balances not impl.\"", ")", "return", "self", ".", "unconfirmed_amount", "/", "1e8" ]
https://github.com/JoinMarket-Org/joinmarket-clientserver/blob/8b3d21f226185e31aa10e8e16cdfc719cea4a98e/jmclient/jmclient/wallet_utils.py#L169-L174
rizar/attention-lvcsr
1ae52cafdd8419874846f9544a299eef9c758f3b
libs/Theano/theano/tensor/opt.py
python
Canonizer.simplify_factors
(self, num, denum)
return num, denum
For any Variable r which is both in num and denum, removes it from both lists. Modifies the lists inplace. Returns the modified lists. For example: | [x], [x] -> [], [] | [x, y], [x] -> [y], [] | [a, b], [c, d] -> [a, b], [c, d]
For any Variable r which is both in num and denum, removes it from both lists. Modifies the lists inplace. Returns the modified lists. For example:
[ "For", "any", "Variable", "r", "which", "is", "both", "in", "num", "and", "denum", "removes", "it", "from", "both", "lists", ".", "Modifies", "the", "lists", "inplace", ".", "Returns", "the", "modified", "lists", ".", "For", "example", ":" ]
def simplify_factors(self, num, denum): """ For any Variable r which is both in num and denum, removes it from both lists. Modifies the lists inplace. Returns the modified lists. For example: | [x], [x] -> [], [] | [x, y], [x] -> [y], [] | [a, b], [c, d] -> [a, b...
[ "def", "simplify_factors", "(", "self", ",", "num", ",", "denum", ")", ":", "for", "v", "in", "list", "(", "num", ")", ":", "if", "v", "in", "denum", ":", "num", ".", "remove", "(", "v", ")", "denum", ".", "remove", "(", "v", ")", "return", "nu...
https://github.com/rizar/attention-lvcsr/blob/1ae52cafdd8419874846f9544a299eef9c758f3b/libs/Theano/theano/tensor/opt.py#L4344-L4359
openshift/openshift-tools
1188778e728a6e4781acf728123e5b356380fe6f
ansible/roles/lib_oa_openshift/library/oc_adm_csr.py
python
OCcsr.csrs
(self)
return self._csrs
property for managing csrs
property for managing csrs
[ "property", "for", "managing", "csrs" ]
def csrs(self): '''property for managing csrs''' # any processing needed?? self._csrs = self._get(resource=self.kind)['results'][0]['items'] return self._csrs
[ "def", "csrs", "(", "self", ")", ":", "# any processing needed??", "self", ".", "_csrs", "=", "self", ".", "_get", "(", "resource", "=", "self", ".", "kind", ")", "[", "'results'", "]", "[", "0", "]", "[", "'items'", "]", "return", "self", ".", "_csr...
https://github.com/openshift/openshift-tools/blob/1188778e728a6e4781acf728123e5b356380fe6f/ansible/roles/lib_oa_openshift/library/oc_adm_csr.py#L1494-L1498
MultiChain/multichain-explorer
9e850fa79d0759b7348647ccf73a31d387c945a5
Mce/util.py
python
possible_address
(string)
return ADDRESS_RE.match(string)
[]
def possible_address(string): return ADDRESS_RE.match(string)
[ "def", "possible_address", "(", "string", ")", ":", "return", "ADDRESS_RE", ".", "match", "(", "string", ")" ]
https://github.com/MultiChain/multichain-explorer/blob/9e850fa79d0759b7348647ccf73a31d387c945a5/Mce/util.py#L141-L142
edisonlz/fastor
342078a18363ac41d3c6b1ab29dbdd44fdb0b7b3
base/site-packages/tencentcloud/ms/v20180408/models.py
python
DescribeShieldResultRequest.__init__
(self)
:param ItemId: 任务唯一标识 :type ItemId: str
:param ItemId: 任务唯一标识 :type ItemId: str
[ ":", "param", "ItemId", ":", "任务唯一标识", ":", "type", "ItemId", ":", "str" ]
def __init__(self): """ :param ItemId: 任务唯一标识 :type ItemId: str """ self.ItemId = None
[ "def", "__init__", "(", "self", ")", ":", "self", ".", "ItemId", "=", "None" ]
https://github.com/edisonlz/fastor/blob/342078a18363ac41d3c6b1ab29dbdd44fdb0b7b3/base/site-packages/tencentcloud/ms/v20180408/models.py#L701-L706
USArmyResearchLab/Dshell
a8705f689f645501e7d35e70e20ef6b032ce8393
dshell/dshellgeoip.py
python
DshellGeoIP.geoip_location_lookup
(self, ip)
Looks up the IP and returns a tuple containing country code, latitude, and longitude.
Looks up the IP and returns a tuple containing country code, latitude, and longitude.
[ "Looks", "up", "the", "IP", "and", "returns", "a", "tuple", "containing", "country", "code", "latitude", "and", "longitude", "." ]
def geoip_location_lookup(self, ip): """ Looks up the IP and returns a tuple containing country code, latitude, and longitude. """ try: return self.geo_loc_cache[ip] except KeyError: try: location = self.geoccdb.city(ip) ...
[ "def", "geoip_location_lookup", "(", "self", ",", "ip", ")", ":", "try", ":", "return", "self", ".", "geo_loc_cache", "[", "ip", "]", "except", "KeyError", ":", "try", ":", "location", "=", "self", ".", "geoccdb", ".", "city", "(", "ip", ")", "# Get co...
https://github.com/USArmyResearchLab/Dshell/blob/a8705f689f645501e7d35e70e20ef6b032ce8393/dshell/dshellgeoip.py#L70-L116
javayhu/Gank-Alfred-Workflow
aca39bd0c7bc0c494eee204e10bca61dab760ab7
source/bs4/builder/_html5lib.py
python
AttrList.__setitem__
(self, name, value)
set attr
set attr
[ "set", "attr" ]
def __setitem__(self, name, value): "set attr", name, value self.element[name] = value
[ "def", "__setitem__", "(", "self", ",", "name", ",", "value", ")", ":", ",", "name", ",", "value", "self", ".", "element", "[", "name", "]", "=", "value" ]
https://github.com/javayhu/Gank-Alfred-Workflow/blob/aca39bd0c7bc0c494eee204e10bca61dab760ab7/source/bs4/builder/_html5lib.py#L103-L105
deepgully/me
f7ad65edc2fe435310c6676bc2e322cfe5d4c8f0
libs/sqlalchemy/pool.py
python
manage
(module, **params)
Return a proxy for a DB-API module that automatically pools connections. Given a DB-API 2.0 module and pool management parameters, returns a proxy for the module that will automatically pool connections, creating new connection pools for each distinct set of connection arguments sent to the decorat...
Return a proxy for a DB-API module that automatically pools connections.
[ "Return", "a", "proxy", "for", "a", "DB", "-", "API", "module", "that", "automatically", "pools", "connections", "." ]
def manage(module, **params): """Return a proxy for a DB-API module that automatically pools connections. Given a DB-API 2.0 module and pool management parameters, returns a proxy for the module that will automatically pool connections, creating new connection pools for each distinct set of connect...
[ "def", "manage", "(", "module", ",", "*", "*", "params", ")", ":", "try", ":", "return", "proxies", "[", "module", "]", "except", "KeyError", ":", "return", "proxies", ".", "setdefault", "(", "module", ",", "_DBProxy", "(", "module", ",", "*", "*", "...
https://github.com/deepgully/me/blob/f7ad65edc2fe435310c6676bc2e322cfe5d4c8f0/libs/sqlalchemy/pool.py#L32-L52
philip-huang/PIXOR
2f64e84f72d915f8b5b80d4615bc9a0c881b5dab
scripts/helpers.py
python
cluster_point_cloud
(pts, eps=0.3, min_samples=30)
return n_clusters, labels
[]
def cluster_point_cloud(pts, eps=0.3, min_samples=30): db = DBSCAN(eps=0.3, min_samples=10, algorithm='ball_tree', n_jobs=2).fit(pts) labels = db.labels_ n_clusters = len(set(labels)) - (1 if -1 in labels else 0) unique_labels = set(labels) return n_clusters, labels
[ "def", "cluster_point_cloud", "(", "pts", ",", "eps", "=", "0.3", ",", "min_samples", "=", "30", ")", ":", "db", "=", "DBSCAN", "(", "eps", "=", "0.3", ",", "min_samples", "=", "10", ",", "algorithm", "=", "'ball_tree'", ",", "n_jobs", "=", "2", ")",...
https://github.com/philip-huang/PIXOR/blob/2f64e84f72d915f8b5b80d4615bc9a0c881b5dab/scripts/helpers.py#L9-L14
Chaffelson/nipyapi
d3b186fd701ce308c2812746d98af9120955e810
nipyapi/registry/models/access_policy.py
python
AccessPolicy.resource
(self)
return self._resource
Gets the resource of this AccessPolicy. The resource for this access policy. :return: The resource of this AccessPolicy. :rtype: str
Gets the resource of this AccessPolicy. The resource for this access policy.
[ "Gets", "the", "resource", "of", "this", "AccessPolicy", ".", "The", "resource", "for", "this", "access", "policy", "." ]
def resource(self): """ Gets the resource of this AccessPolicy. The resource for this access policy. :return: The resource of this AccessPolicy. :rtype: str """ return self._resource
[ "def", "resource", "(", "self", ")", ":", "return", "self", ".", "_resource" ]
https://github.com/Chaffelson/nipyapi/blob/d3b186fd701ce308c2812746d98af9120955e810/nipyapi/registry/models/access_policy.py#L103-L111
django/django
0a17666045de6739ae1c2ac695041823d5f827f7
django/db/models/sql/query.py
python
Query.add_distinct_fields
(self, *field_names)
Add and resolve the given fields to the query's "distinct on" clause.
Add and resolve the given fields to the query's "distinct on" clause.
[ "Add", "and", "resolve", "the", "given", "fields", "to", "the", "query", "s", "distinct", "on", "clause", "." ]
def add_distinct_fields(self, *field_names): """ Add and resolve the given fields to the query's "distinct on" clause. """ self.distinct_fields = field_names self.distinct = True
[ "def", "add_distinct_fields", "(", "self", ",", "*", "field_names", ")", ":", "self", ".", "distinct_fields", "=", "field_names", "self", ".", "distinct", "=", "True" ]
https://github.com/django/django/blob/0a17666045de6739ae1c2ac695041823d5f827f7/django/db/models/sql/query.py#L1911-L1916
TarrySingh/Artificial-Intelligence-Deep-Learning-Machine-Learning-Tutorials
5bb97d7e3ffd913abddb4cfa7d78a1b4c868890e
tensorflow_dl_models/research/slim/preprocessing/vgg_preprocessing.py
python
_random_crop
(image_list, crop_height, crop_width)
return [_crop(image, offset_height, offset_width, crop_height, crop_width) for image in image_list]
Crops the given list of images. The function applies the same crop to each image in the list. This can be effectively applied when there are multiple image inputs of the same dimension such as: image, depths, normals = _random_crop([image, depths, normals], 120, 150) Args: image_list: a list of image...
Crops the given list of images.
[ "Crops", "the", "given", "list", "of", "images", "." ]
def _random_crop(image_list, crop_height, crop_width): """Crops the given list of images. The function applies the same crop to each image in the list. This can be effectively applied when there are multiple image inputs of the same dimension such as: image, depths, normals = _random_crop([image, depths, ...
[ "def", "_random_crop", "(", "image_list", ",", "crop_height", ",", "crop_width", ")", ":", "if", "not", "image_list", ":", "raise", "ValueError", "(", "'Empty image_list.'", ")", "# Compute the rank assertions.", "rank_assertions", "=", "[", "]", "for", "i", "in",...
https://github.com/TarrySingh/Artificial-Intelligence-Deep-Learning-Machine-Learning-Tutorials/blob/5bb97d7e3ffd913abddb4cfa7d78a1b4c868890e/tensorflow_dl_models/research/slim/preprocessing/vgg_preprocessing.py#L90-L170
zhl2008/awd-platform
0416b31abea29743387b10b3914581fbe8e7da5e
web_flaskbb/lib/python2.7/site-packages/kombu/transport/redis.py
python
MultiChannelPoller.add
(self, channel)
[]
def add(self, channel): self._channels.add(channel)
[ "def", "add", "(", "self", ",", "channel", ")", ":", "self", ".", "_channels", ".", "add", "(", "channel", ")" ]
https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_flaskbb/lib/python2.7/site-packages/kombu/transport/redis.py#L263-L264
dhondta/python-sploitkit
501ee5c034189d39e2ed76e9ccf6a538ab638409
sploitkit/core/console.py
python
Console._close
(self)
Gracefully close the console.
Gracefully close the console.
[ "Gracefully", "close", "the", "console", "." ]
def _close(self): """ Gracefully close the console. """ self.logger.debug("Exiting {}[{}]".format(self.__class__.__name__, id(self))) if hasattr(self, "close") and isfunction(self.close): self.close() # cleanup references for this console self.detach() # impor...
[ "def", "_close", "(", "self", ")", ":", "self", ".", "logger", ".", "debug", "(", "\"Exiting {}[{}]\"", ".", "format", "(", "self", ".", "__class__", ".", "__name__", ",", "id", "(", "self", ")", ")", ")", "if", "hasattr", "(", "self", ",", "\"close\...
https://github.com/dhondta/python-sploitkit/blob/501ee5c034189d39e2ed76e9ccf6a538ab638409/sploitkit/core/console.py#L186-L211
dbt-labs/dbt-core
e943b9fc842535e958ef4fd0b8703adc91556bc6
core/dbt/parser/hooks.py
python
HookParser.parse_file
(self, block: FileBlock)
[]
def parse_file(self, block: FileBlock) -> None: for hook_type in RunHookType: for hook in HookSearcher(self.project, block.file, hook_type): self.parse_node(hook)
[ "def", "parse_file", "(", "self", ",", "block", ":", "FileBlock", ")", "->", "None", ":", "for", "hook_type", "in", "RunHookType", ":", "for", "hook", "in", "HookSearcher", "(", "self", ".", "project", ",", "block", ".", "file", ",", "hook_type", ")", ...
https://github.com/dbt-labs/dbt-core/blob/e943b9fc842535e958ef4fd0b8703adc91556bc6/core/dbt/parser/hooks.py#L114-L117
exodrifter/unity-python
bef6e4e9ddfbbf1eaf7acbbb973e9aa3dd64a20d
Lib/decimal.py
python
Decimal.copy_negate
(self)
Returns a copy with the sign inverted.
Returns a copy with the sign inverted.
[ "Returns", "a", "copy", "with", "the", "sign", "inverted", "." ]
def copy_negate(self): """Returns a copy with the sign inverted.""" if self._sign: return _dec_from_triple(0, self._int, self._exp, self._is_special) else: return _dec_from_triple(1, self._int, self._exp, self._is_special)
[ "def", "copy_negate", "(", "self", ")", ":", "if", "self", ".", "_sign", ":", "return", "_dec_from_triple", "(", "0", ",", "self", ".", "_int", ",", "self", ".", "_exp", ",", "self", ".", "_is_special", ")", "else", ":", "return", "_dec_from_triple", "...
https://github.com/exodrifter/unity-python/blob/bef6e4e9ddfbbf1eaf7acbbb973e9aa3dd64a20d/Lib/decimal.py#L2923-L2928
HymanLiuTS/flaskTs
286648286976e85d9b9a5873632331efcafe0b21
flasky/lib/python2.7/site-packages/pip/_vendor/pkg_resources/__init__.py
python
ResourceManager.extraction_error
(self)
Give an error message for problems extracting file(s)
Give an error message for problems extracting file(s)
[ "Give", "an", "error", "message", "for", "problems", "extracting", "file", "(", "s", ")" ]
def extraction_error(self): """Give an error message for problems extracting file(s)""" old_exc = sys.exc_info()[1] cache_path = self.extraction_path or get_default_cache() tmpl = textwrap.dedent(""" Can't extract file(s) to egg cache The following error occurr...
[ "def", "extraction_error", "(", "self", ")", ":", "old_exc", "=", "sys", ".", "exc_info", "(", ")", "[", "1", "]", "cache_path", "=", "self", ".", "extraction_path", "or", "get_default_cache", "(", ")", "tmpl", "=", "textwrap", ".", "dedent", "(", "\"\"\...
https://github.com/HymanLiuTS/flaskTs/blob/286648286976e85d9b9a5873632331efcafe0b21/flasky/lib/python2.7/site-packages/pip/_vendor/pkg_resources/__init__.py#L1224-L1250
cloudera/hue
23f02102d4547c17c32bd5ea0eb24e9eadd657a4
desktop/core/ext-py/oauth2client-4.1.3/oauth2client/client.py
python
OAuth2Credentials._refresh
(self, http)
Refreshes the access_token. This method first checks by reading the Storage object if available. If a refresh is still needed, it holds the Storage lock until the refresh is completed. Args: http: an object to be used to make HTTP requests. Raises: Http...
Refreshes the access_token.
[ "Refreshes", "the", "access_token", "." ]
def _refresh(self, http): """Refreshes the access_token. This method first checks by reading the Storage object if available. If a refresh is still needed, it holds the Storage lock until the refresh is completed. Args: http: an object to be used to make HTTP reques...
[ "def", "_refresh", "(", "self", ",", "http", ")", ":", "if", "not", "self", ".", "store", ":", "self", ".", "_do_refresh_request", "(", "http", ")", "else", ":", "self", ".", "store", ".", "acquire_lock", "(", ")", "try", ":", "new_cred", "=", "self"...
https://github.com/cloudera/hue/blob/23f02102d4547c17c32bd5ea0eb24e9eadd657a4/desktop/core/ext-py/oauth2client-4.1.3/oauth2client/client.py#L735-L763
zhl2008/awd-platform
0416b31abea29743387b10b3914581fbe8e7da5e
web_flaskbb/Python-2.7.9/Mac/Tools/fixapplepython23.py
python
fix
(makefile, do_apply)
Fix the Makefile, if required.
Fix the Makefile, if required.
[ "Fix", "the", "Makefile", "if", "required", "." ]
def fix(makefile, do_apply): """Fix the Makefile, if required.""" fixed = False lines = open(makefile).readlines() for old, new in CHANGES: i = findline(lines, new) if i >= 0: # Already fixed continue i = findline(lines, old) if i < 0: ...
[ "def", "fix", "(", "makefile", ",", "do_apply", ")", ":", "fixed", "=", "False", "lines", "=", "open", "(", "makefile", ")", ".", "readlines", "(", ")", "for", "old", ",", "new", "in", "CHANGES", ":", "i", "=", "findline", "(", "lines", ",", "new",...
https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_flaskbb/Python-2.7.9/Mac/Tools/fixapplepython23.py#L48-L77
mesalock-linux/mesapy
ed546d59a21b36feb93e2309d5c6b75aa0ad95c9
rpython/jit/backend/x86/callbuilder.py
python
CallBuilderX86.save_stack_position
(self)
Load the current 'esp' value into a callee-saved register. Further calls just return the same register, by assuming it is indeed saved.
Load the current 'esp' value into a callee-saved register. Further calls just return the same register, by assuming it is indeed saved.
[ "Load", "the", "current", "esp", "value", "into", "a", "callee", "-", "saved", "register", ".", "Further", "calls", "just", "return", "the", "same", "register", "by", "assuming", "it", "is", "indeed", "saved", "." ]
def save_stack_position(self): """Load the current 'esp' value into a callee-saved register. Further calls just return the same register, by assuming it is indeed saved.""" assert IS_X86_32 assert stdcall_or_cdecl and self.is_call_release_gil if self.saved_stack_position_...
[ "def", "save_stack_position", "(", "self", ")", ":", "assert", "IS_X86_32", "assert", "stdcall_or_cdecl", "and", "self", ".", "is_call_release_gil", "if", "self", ".", "saved_stack_position_reg", "is", "None", ":", "# pick a register saved across calls", "self", ".", ...
https://github.com/mesalock-linux/mesapy/blob/ed546d59a21b36feb93e2309d5c6b75aa0ad95c9/rpython/jit/backend/x86/callbuilder.py#L191-L200
ramusus/kinopoiskpy
e49b41eff7ae4252987636ec14c060109a50fad6
kinopoisk/person/__init__.py
python
Person.set_defaults
(self)
[]
def set_defaults(self): self.name = '' self.name_en = '' self.information = '' self.year_birth = None self.career = {} self.photos = []
[ "def", "set_defaults", "(", "self", ")", ":", "self", ".", "name", "=", "''", "self", ".", "name_en", "=", "''", "self", ".", "information", "=", "''", "self", ".", "year_birth", "=", "None", "self", ".", "career", "=", "{", "}", "self", ".", "phot...
https://github.com/ramusus/kinopoiskpy/blob/e49b41eff7ae4252987636ec14c060109a50fad6/kinopoisk/person/__init__.py#L10-L18
magenta/magenta
be6558f1a06984faff6d6949234f5fe9ad0ffdb5
magenta/models/melody_rnn/melody_rnn_model.py
python
MelodyRnnModel.melody_log_likelihood
(self, melody)
return self._evaluate_log_likelihood([melody_copy])[0]
Evaluate the log likelihood of a melody under the model. Args: melody: The Melody object for which to evaluate the log likelihood. Returns: The log likelihood of `melody` under this model.
Evaluate the log likelihood of a melody under the model.
[ "Evaluate", "the", "log", "likelihood", "of", "a", "melody", "under", "the", "model", "." ]
def melody_log_likelihood(self, melody): """Evaluate the log likelihood of a melody under the model. Args: melody: The Melody object for which to evaluate the log likelihood. Returns: The log likelihood of `melody` under this model. """ melody_copy = copy.deepcopy(melody) melody_c...
[ "def", "melody_log_likelihood", "(", "self", ",", "melody", ")", ":", "melody_copy", "=", "copy", ".", "deepcopy", "(", "melody", ")", "melody_copy", ".", "squash", "(", "self", ".", "_config", ".", "min_note", ",", "self", ".", "_config", ".", "max_note",...
https://github.com/magenta/magenta/blob/be6558f1a06984faff6d6949234f5fe9ad0ffdb5/magenta/models/melody_rnn/melody_rnn_model.py#L67-L83
dimagi/commcare-hq
d67ff1d3b4c51fa050c19e60c3253a79d3452a39
corehq/apps/es/management/commands/restore_es_snapshot.py
python
Command.get_indices
(indices)
[]
def get_indices(indices): if indices: return ','.join(indices) else: return '_all'
[ "def", "get_indices", "(", "indices", ")", ":", "if", "indices", ":", "return", "','", ".", "join", "(", "indices", ")", "else", ":", "return", "'_all'" ]
https://github.com/dimagi/commcare-hq/blob/d67ff1d3b4c51fa050c19e60c3253a79d3452a39/corehq/apps/es/management/commands/restore_es_snapshot.py#L62-L66
ctxis/CAPE
dae9fa6a254ecdbabeb7eb0d2389fa63722c1e82
lib/cuckoo/common/office/vba2graph.py
python
design_graph_dot
(DG)
return DG
Select the design of regular graph nodes (colors and content) Args: DG (networkx.DiGraph): Generated directed graph Returns: networkx.DiGraph: Directed Graph with node design and content
Select the design of regular graph nodes (colors and content) Args: DG (networkx.DiGraph): Generated directed graph Returns: networkx.DiGraph: Directed Graph with node design and content
[ "Select", "the", "design", "of", "regular", "graph", "nodes", "(", "colors", "and", "content", ")", "Args", ":", "DG", "(", "networkx", ".", "DiGraph", ")", ":", "Generated", "directed", "graph", "Returns", ":", "networkx", ".", "DiGraph", ":", "Directed",...
def design_graph_dot(DG): """Select the design of regular graph nodes (colors and content) Args: DG (networkx.DiGraph): Generated directed graph Returns: networkx.DiGraph: Directed Graph with node design and content """ # locate malicious keywords for key in DG: ...
[ "def", "design_graph_dot", "(", "DG", ")", ":", "# locate malicious keywords", "for", "key", "in", "DG", ":", "if", "\"color\"", "not", "in", "DG", ".", "node", "[", "key", "]", ":", "DG", ".", "node", "[", "key", "]", "[", "\"color\"", "]", "=", "co...
https://github.com/ctxis/CAPE/blob/dae9fa6a254ecdbabeb7eb0d2389fa63722c1e82/lib/cuckoo/common/office/vba2graph.py#L799-L842
tslearn-team/tslearn
6c93071b385a89112b82799ae5870daeca1ab88b
tslearn/utils/cast.py
python
from_sktime_dataset
(X)
return tslearn_arr
Transform a sktime-compatible dataset into a tslearn dataset. Parameters ---------- X: pandas data-frame sktime-formatted dataset (cf. `link <https://alan-turing-institute.github.io/sktime/examples/loading_data.html>`_) Returns ------- array, shape=(n_ts, sz, d) tslearn...
Transform a sktime-compatible dataset into a tslearn dataset.
[ "Transform", "a", "sktime", "-", "compatible", "dataset", "into", "a", "tslearn", "dataset", "." ]
def from_sktime_dataset(X): """Transform a sktime-compatible dataset into a tslearn dataset. Parameters ---------- X: pandas data-frame sktime-formatted dataset (cf. `link <https://alan-turing-institute.github.io/sktime/examples/loading_data.html>`_) Returns ------- array, ...
[ "def", "from_sktime_dataset", "(", "X", ")", ":", "# noqa: E501", "try", ":", "import", "pandas", "as", "pd", "except", "ImportError", ":", "raise", "ImportError", "(", "\"Conversion from/to sktime cannot be performed \"", "\"if pandas is not installed.\"", ")", "if", "...
https://github.com/tslearn-team/tslearn/blob/6c93071b385a89112b82799ae5870daeca1ab88b/tslearn/utils/cast.py#L321-L393
stopstalk/stopstalk-deployment
10c3ab44c4ece33ae515f6888c15033db2004bb1
aws_lambda/spoj_aws_lambda_function/lambda_code/pip/_vendor/pkg_resources/__init__.py
python
ResourceManager._warn_unsafe_extraction_path
(path)
If the default extraction path is overridden and set to an insecure location, such as /tmp, it opens up an opportunity for an attacker to replace an extracted file with an unauthorized payload. Warn the user if a known insecure location is used. See Distribute #375 for more details.
If the default extraction path is overridden and set to an insecure location, such as /tmp, it opens up an opportunity for an attacker to replace an extracted file with an unauthorized payload. Warn the user if a known insecure location is used.
[ "If", "the", "default", "extraction", "path", "is", "overridden", "and", "set", "to", "an", "insecure", "location", "such", "as", "/", "tmp", "it", "opens", "up", "an", "opportunity", "for", "an", "attacker", "to", "replace", "an", "extracted", "file", "wi...
def _warn_unsafe_extraction_path(path): """ If the default extraction path is overridden and set to an insecure location, such as /tmp, it opens up an opportunity for an attacker to replace an extracted file with an unauthorized payload. Warn the user if a known insecure location...
[ "def", "_warn_unsafe_extraction_path", "(", "path", ")", ":", "if", "os", ".", "name", "==", "'nt'", "and", "not", "path", ".", "startswith", "(", "os", ".", "environ", "[", "'windir'", "]", ")", ":", "# On Windows, permissions are generally restrictive by default...
https://github.com/stopstalk/stopstalk-deployment/blob/10c3ab44c4ece33ae515f6888c15033db2004bb1/aws_lambda/spoj_aws_lambda_function/lambda_code/pip/_vendor/pkg_resources/__init__.py#L1208-L1231
ai4ce/DeepMapping
b6f96ca0aa9a0e459835fcc589bcf7fccd32ceb7
models/deepmapping.py
python
get_M_net_inputs_labels
(occupied_points, unoccupited_points)
return inputs, gt
get global coord (occupied and unoccupied) and corresponding labels
get global coord (occupied and unoccupied) and corresponding labels
[ "get", "global", "coord", "(", "occupied", "and", "unoccupied", ")", "and", "corresponding", "labels" ]
def get_M_net_inputs_labels(occupied_points, unoccupited_points): """ get global coord (occupied and unoccupied) and corresponding labels """ n_pos = occupied_points.shape[1] inputs = torch.cat((occupied_points, unoccupited_points), 1) bs, N, _ = inputs.shape gt = torch.zeros([bs, N, 1], de...
[ "def", "get_M_net_inputs_labels", "(", "occupied_points", ",", "unoccupited_points", ")", ":", "n_pos", "=", "occupied_points", ".", "shape", "[", "1", "]", "inputs", "=", "torch", ".", "cat", "(", "(", "occupied_points", ",", "unoccupited_points", ")", ",", "...
https://github.com/ai4ce/DeepMapping/blob/b6f96ca0aa9a0e459835fcc589bcf7fccd32ceb7/models/deepmapping.py#L8-L19
PytLab/gaft
0fb7547752d443a3722916db02cf0a2cfb03026d
gaft/engine.py
python
GAEngine.analysis_register
(self, analysis_cls)
A decorator for analysis regsiter. :param analysis_cls: The analysis to be registered :type analysis_cls: :obj:`gaft.plugin_interfaces.OnTheFlyAnalysis`
A decorator for analysis regsiter.
[ "A", "decorator", "for", "analysis", "regsiter", "." ]
def analysis_register(self, analysis_cls): ''' A decorator for analysis regsiter. :param analysis_cls: The analysis to be registered :type analysis_cls: :obj:`gaft.plugin_interfaces.OnTheFlyAnalysis` ''' if not issubclass(analysis_cls, OnTheFlyAnalysis): raise TypeEr...
[ "def", "analysis_register", "(", "self", ",", "analysis_cls", ")", ":", "if", "not", "issubclass", "(", "analysis_cls", ",", "OnTheFlyAnalysis", ")", ":", "raise", "TypeError", "(", "'analysis class must be subclass of OnTheFlyAnalysis'", ")", "# Add analysis instance to ...
https://github.com/PytLab/gaft/blob/0fb7547752d443a3722916db02cf0a2cfb03026d/gaft/engine.py#L280-L291
tjweir/liftbook
e977a7face13ade1a4558e1909a6951d2f8928dd
elyxer.py
python
BibTag.error
(self)
return self.constant('')
To use when parsing resulted in an error.
To use when parsing resulted in an error.
[ "To", "use", "when", "parsing", "resulted", "in", "an", "error", "." ]
def error(self): "To use when parsing resulted in an error." return self.constant('')
[ "def", "error", "(", "self", ")", ":", "return", "self", ".", "constant", "(", "''", ")" ]
https://github.com/tjweir/liftbook/blob/e977a7face13ade1a4558e1909a6951d2f8928dd/elyxer.py#L7568-L7570
zopefoundation/Zope
ea04dd670d1a48d4d5c879d3db38fc2e9b4330bb
src/Products/Five/browser/metaconfigure.py
python
page
(_context, name, permission, for_=Interface, layer=IDefaultBrowserLayer, template=None, class_=None, allowed_interface=None, allowed_attributes=None, attribute='__call__', menu=None, title=None)
[]
def page(_context, name, permission, for_=Interface, layer=IDefaultBrowserLayer, template=None, class_=None, allowed_interface=None, allowed_attributes=None, attribute='__call__', menu=None, title=None): name = str(name) # De-unicode _handle_menu(_context, menu, title, [for_], name, ...
[ "def", "page", "(", "_context", ",", "name", ",", "permission", ",", "for_", "=", "Interface", ",", "layer", "=", "IDefaultBrowserLayer", ",", "template", "=", "None", ",", "class_", "=", "None", ",", "allowed_interface", "=", "None", ",", "allowed_attribute...
https://github.com/zopefoundation/Zope/blob/ea04dd670d1a48d4d5c879d3db38fc2e9b4330bb/src/Products/Five/browser/metaconfigure.py#L93-L177
edisonlz/fastor
342078a18363ac41d3c6b1ab29dbdd44fdb0b7b3
base/site-packages/django_extensions/db/fields/encrypted.py
python
EncryptedTextField.south_field_triple
(self)
return (field_class, args, kwargs)
Returns a suitable description of this field for South.
Returns a suitable description of this field for South.
[ "Returns", "a", "suitable", "description", "of", "this", "field", "for", "South", "." ]
def south_field_triple(self): "Returns a suitable description of this field for South." # We'll just introspect the _actual_ field. from south.modelsinspector import introspector field_class = "django.db.models.fields.TextField" args, kwargs = introspector(self) # That's ...
[ "def", "south_field_triple", "(", "self", ")", ":", "# We'll just introspect the _actual_ field.", "from", "south", ".", "modelsinspector", "import", "introspector", "field_class", "=", "\"django.db.models.fields.TextField\"", "args", ",", "kwargs", "=", "introspector", "("...
https://github.com/edisonlz/fastor/blob/342078a18363ac41d3c6b1ab29dbdd44fdb0b7b3/base/site-packages/django_extensions/db/fields/encrypted.py#L120-L127
krintoxi/NoobSec-Toolkit
38738541cbc03cedb9a3b3ed13b629f781ad64f6
NoobSecToolkit - MAC OSX/tools/sqli/plugins/generic/fingerprint.py
python
Fingerprint.userChooseDbmsOs
(self)
[]
def userChooseDbmsOs(self): warnMsg = "for some reason sqlmap was unable to fingerprint " warnMsg += "the back-end DBMS operating system" logger.warn(warnMsg) msg = "do you want to provide the OS? [(W)indows/(l)inux]" while True: os = readInput(msg, default="W") ...
[ "def", "userChooseDbmsOs", "(", "self", ")", ":", "warnMsg", "=", "\"for some reason sqlmap was unable to fingerprint \"", "warnMsg", "+=", "\"the back-end DBMS operating system\"", "logger", ".", "warn", "(", "warnMsg", ")", "msg", "=", "\"do you want to provide the OS? [(W)...
https://github.com/krintoxi/NoobSec-Toolkit/blob/38738541cbc03cedb9a3b3ed13b629f781ad64f6/NoobSecToolkit - MAC OSX/tools/sqli/plugins/generic/fingerprint.py#L40-L58
lebedov/scikit-cuda
5d3c74f926fe7ce67ecfc85e9623aab7bc0b344f
skcuda/cublas.py
python
cublasDscal
(handle, n, alpha, x, incx)
[]
def cublasDscal(handle, n, alpha, x, incx): status = _libcublas.cublasDscal_v2(handle, n, ctypes.byref(ctypes.c_double(alpha)), int(x), incx) cublasCheckStatus(status)
[ "def", "cublasDscal", "(", "handle", ",", "n", ",", "alpha", ",", "x", ",", "incx", ")", ":", "status", "=", "_libcublas", ".", "cublasDscal_v2", "(", "handle", ",", "n", ",", "ctypes", ".", "byref", "(", "ctypes", ".", "c_double", "(", "alpha", ")",...
https://github.com/lebedov/scikit-cuda/blob/5d3c74f926fe7ce67ecfc85e9623aab7bc0b344f/skcuda/cublas.py#L1976-L1980
MarioVilas/winappdbg
975a088ac54253d0bdef39fe831e82f24b4c11f6
winappdbg/window.py
python
Window.set_process
(self, process = None)
Manually set the parent process. Use with care! @type process: L{Process} @param process: (Optional) Process object. Use C{None} to autodetect.
Manually set the parent process. Use with care!
[ "Manually", "set", "the", "parent", "process", ".", "Use", "with", "care!" ]
def set_process(self, process = None): """ Manually set the parent process. Use with care! @type process: L{Process} @param process: (Optional) Process object. Use C{None} to autodetect. """ if process is None: self.__process = None else: ...
[ "def", "set_process", "(", "self", ",", "process", "=", "None", ")", ":", "if", "process", "is", "None", ":", "self", ".", "__process", "=", "None", "else", ":", "self", ".", "__load_Process_class", "(", ")", "if", "not", "isinstance", "(", "process", ...
https://github.com/MarioVilas/winappdbg/blob/975a088ac54253d0bdef39fe831e82f24b4c11f6/winappdbg/window.py#L208-L224
Gandi/gandi.cli
5de0605126247e986f8288b467a52710a78e1794
gandi/cli/modules/network.py
python
Vlan.list
(cls, datacenter=None)
return cls.call('hosting.vlan.list', options)
List virtual machine vlan (in the future it should also handle PaaS vlan).
List virtual machine vlan
[ "List", "virtual", "machine", "vlan" ]
def list(cls, datacenter=None): """List virtual machine vlan (in the future it should also handle PaaS vlan).""" options = {} if datacenter: datacenter_id = int(Datacenter.usable_id(datacenter)) options['datacenter_id'] = datacenter_id return cls.call('h...
[ "def", "list", "(", "cls", ",", "datacenter", "=", "None", ")", ":", "options", "=", "{", "}", "if", "datacenter", ":", "datacenter_id", "=", "int", "(", "Datacenter", ".", "usable_id", "(", "datacenter", ")", ")", "options", "[", "'datacenter_id'", "]",...
https://github.com/Gandi/gandi.cli/blob/5de0605126247e986f8288b467a52710a78e1794/gandi/cli/modules/network.py#L168-L177
cloudera/hue
23f02102d4547c17c32bd5ea0eb24e9eadd657a4
desktop/core/ext-py/docutils-0.14/docutils/writers/latex2e/__init__.py
python
Table.get_multicolumn_width
(self, start, len_)
Return sum of columnwidths for multicell.
Return sum of columnwidths for multicell.
[ "Return", "sum", "of", "columnwidths", "for", "multicell", "." ]
def get_multicolumn_width(self, start, len_): """Return sum of columnwidths for multicell.""" try: mc_width = sum([width for width in ([self._col_width[start + co] for co in range (len_)])]) return 'p{%.2f\\DU...
[ "def", "get_multicolumn_width", "(", "self", ",", "start", ",", "len_", ")", ":", "try", ":", "mc_width", "=", "sum", "(", "[", "width", "for", "width", "in", "(", "[", "self", ".", "_col_width", "[", "start", "+", "co", "]", "for", "co", "in", "ra...
https://github.com/cloudera/hue/blob/23f02102d4547c17c32bd5ea0eb24e9eadd657a4/desktop/core/ext-py/docutils-0.14/docutils/writers/latex2e/__init__.py#L1035-L1043
sagemath/sage
f9b2db94f675ff16963ccdefba4f1a3393b3fe0d
src/sage/rings/polynomial/toy_buchberger.py
python
select
(P)
return min(P, key=lambda fi_fj: LCM(LM(fi_fj[0]), LM(fi_fj[1])).total_degree())
Select a polynomial using the normal selection strategy. INPUT: - ``P`` -- a list of critical pairs OUTPUT: an element of P EXAMPLES:: sage: from sage.rings.polynomial.toy_buchberger import select sage: R.<x,y,z> = PolynomialRing(QQ, order='lex') sage: ps = [x^3 - z -1, z^3 ...
Select a polynomial using the normal selection strategy.
[ "Select", "a", "polynomial", "using", "the", "normal", "selection", "strategy", "." ]
def select(P): """ Select a polynomial using the normal selection strategy. INPUT: - ``P`` -- a list of critical pairs OUTPUT: an element of P EXAMPLES:: sage: from sage.rings.polynomial.toy_buchberger import select sage: R.<x,y,z> = PolynomialRing(QQ, order='lex') s...
[ "def", "select", "(", "P", ")", ":", "return", "min", "(", "P", ",", "key", "=", "lambda", "fi_fj", ":", "LCM", "(", "LM", "(", "fi_fj", "[", "0", "]", ")", ",", "LM", "(", "fi_fj", "[", "1", "]", ")", ")", ".", "total_degree", "(", ")", ")...
https://github.com/sagemath/sage/blob/f9b2db94f675ff16963ccdefba4f1a3393b3fe0d/src/sage/rings/polynomial/toy_buchberger.py#L371-L391
olivierkes/manuskript
2b992e70c617325013e347b470246af66f6d2690
manuskript/mainWindow.py
python
MainWindow.documentsDuplicate
(self)
Duplicate selected item(s).
Duplicate selected item(s).
[ "Duplicate", "selected", "item", "(", "s", ")", "." ]
def documentsDuplicate(self): "Duplicate selected item(s)." if self._lastFocus: self._lastFocus.duplicate()
[ "def", "documentsDuplicate", "(", "self", ")", ":", "if", "self", ".", "_lastFocus", ":", "self", ".", "_lastFocus", ".", "duplicate", "(", ")" ]
https://github.com/olivierkes/manuskript/blob/2b992e70c617325013e347b470246af66f6d2690/manuskript/mainWindow.py#L528-L530
google/coursebuilder-core
08f809db3226d9269e30d5edd0edd33bd22041f4
coursebuilder/modules/admin/admin.py
python
BaseAdminHandler._make_routes_dom
(self, parent_element, routes, caption)
Renders routes as DOM.
Renders routes as DOM.
[ "Renders", "routes", "as", "DOM", "." ]
def _make_routes_dom(self, parent_element, routes, caption): """Renders routes as DOM.""" if routes: # sort routes all_routes = [] for route in routes: if route: all_routes.append(str(route)) # render as DOM ...
[ "def", "_make_routes_dom", "(", "self", ",", "parent_element", ",", "routes", ",", "caption", ")", ":", "if", "routes", ":", "# sort routes", "all_routes", "=", "[", "]", "for", "route", "in", "routes", ":", "if", "route", ":", "all_routes", ".", "append",...
https://github.com/google/coursebuilder-core/blob/08f809db3226d9269e30d5edd0edd33bd22041f4/coursebuilder/modules/admin/admin.py#L486-L504
openedx/edx-platform
68dd185a0ab45862a2a61e0f803d7e03d2be71b5
lms/djangoapps/instructor_task/tasks_helper/grades.py
python
GradeReportBase._compile
(self, context, batched_rows)
return success_rows, error_rows
Compiles and returns the complete list of (success_rows, error_rows) for the given batched_rows and context.
Compiles and returns the complete list of (success_rows, error_rows) for the given batched_rows and context.
[ "Compiles", "and", "returns", "the", "complete", "list", "of", "(", "success_rows", "error_rows", ")", "for", "the", "given", "batched_rows", "and", "context", "." ]
def _compile(self, context, batched_rows): """ Compiles and returns the complete list of (success_rows, error_rows) for the given batched_rows and context. """ # partition and chain successes and errors success_rows, error_rows = zip(*batched_rows) success_rows = ...
[ "def", "_compile", "(", "self", ",", "context", ",", "batched_rows", ")", ":", "# partition and chain successes and errors", "success_rows", ",", "error_rows", "=", "zip", "(", "*", "batched_rows", ")", "success_rows", "=", "list", "(", "chain", "(", "*", "succe...
https://github.com/openedx/edx-platform/blob/68dd185a0ab45862a2a61e0f803d7e03d2be71b5/lms/djangoapps/instructor_task/tasks_helper/grades.py#L165-L180
general03/flask-autoindex
424246242c9f40aeb9ac2c8c63f4d2234024256e
.eggs/Werkzeug-1.0.1-py3.7.egg/werkzeug/debug/__init__.py
python
get_pin_and_cookie_name
(app)
return rv, cookie_name
Given an application object this returns a semi-stable 9 digit pin code and a random key. The hope is that this is stable between restarts to not make debugging particularly frustrating. If the pin was forcefully disabled this returns `None`. Second item in the resulting tuple is the cookie name for ...
Given an application object this returns a semi-stable 9 digit pin code and a random key. The hope is that this is stable between restarts to not make debugging particularly frustrating. If the pin was forcefully disabled this returns `None`.
[ "Given", "an", "application", "object", "this", "returns", "a", "semi", "-", "stable", "9", "digit", "pin", "code", "and", "a", "random", "key", ".", "The", "hope", "is", "that", "this", "is", "stable", "between", "restarts", "to", "not", "make", "debugg...
def get_pin_and_cookie_name(app): """Given an application object this returns a semi-stable 9 digit pin code and a random key. The hope is that this is stable between restarts to not make debugging particularly frustrating. If the pin was forcefully disabled this returns `None`. Second item in th...
[ "def", "get_pin_and_cookie_name", "(", "app", ")", ":", "pin", "=", "os", ".", "environ", ".", "get", "(", "\"WERKZEUG_DEBUG_PIN\"", ")", "rv", "=", "None", "num", "=", "None", "# Pin was explicitly disabled", "if", "pin", "==", "\"off\"", ":", "return", "No...
https://github.com/general03/flask-autoindex/blob/424246242c9f40aeb9ac2c8c63f4d2234024256e/.eggs/Werkzeug-1.0.1-py3.7.egg/werkzeug/debug/__init__.py#L137-L217
alexeygrigorev/outbrain-click-prediction-kaggle
f4eefc31fe283323f394a0cc0273b6e1d8c14de0
ml_metrics_auc.py
python
tied_rank
(x)
return r
Computes the tied rank of elements in x. This function computes the tied rank of elements in x. Parameters ---------- x : list of numbers, numpy array Returns ------- score : list of numbers The tied rank f each element in x
Computes the tied rank of elements in x. This function computes the tied rank of elements in x. Parameters ---------- x : list of numbers, numpy array Returns ------- score : list of numbers The tied rank f each element in x
[ "Computes", "the", "tied", "rank", "of", "elements", "in", "x", ".", "This", "function", "computes", "the", "tied", "rank", "of", "elements", "in", "x", ".", "Parameters", "----------", "x", ":", "list", "of", "numbers", "numpy", "array", "Returns", "-----...
def tied_rank(x): """ Computes the tied rank of elements in x. This function computes the tied rank of elements in x. Parameters ---------- x : list of numbers, numpy array Returns ------- score : list of numbers The tied rank f each element in x """ sorted_x = so...
[ "def", "tied_rank", "(", "x", ")", ":", "sorted_x", "=", "sorted", "(", "zip", "(", "x", ",", "range", "(", "len", "(", "x", ")", ")", ")", ")", "r", "=", "[", "0", "for", "k", "in", "x", "]", "cur_val", "=", "sorted_x", "[", "0", "]", "[",...
https://github.com/alexeygrigorev/outbrain-click-prediction-kaggle/blob/f4eefc31fe283323f394a0cc0273b6e1d8c14de0/ml_metrics_auc.py#L4-L29
lk-geimfari/mimesis
36653b49f28719c0a2aa20fef6c6df3911811b32
mimesis/providers/person.py
python
Person.weight
(self, minimum: int = 38, maximum: int = 90)
return self.random.randint(minimum, maximum)
Generate a random weight in Kg. :param minimum: min value :param maximum: max value :return: Weight. :Example: 48.
Generate a random weight in Kg.
[ "Generate", "a", "random", "weight", "in", "Kg", "." ]
def weight(self, minimum: int = 38, maximum: int = 90) -> int: """Generate a random weight in Kg. :param minimum: min value :param maximum: max value :return: Weight. :Example: 48. """ return self.random.randint(minimum, maximum)
[ "def", "weight", "(", "self", ",", "minimum", ":", "int", "=", "38", ",", "maximum", ":", "int", "=", "90", ")", "->", "int", ":", "return", "self", ".", "random", ".", "randint", "(", "minimum", ",", "maximum", ")" ]
https://github.com/lk-geimfari/mimesis/blob/36653b49f28719c0a2aa20fef6c6df3911811b32/mimesis/providers/person.py#L335-L345
PokemonGoF/PokemonGo-Bot-Desktop
4bfa94f0183406c6a86f93645eff7abd3ad4ced8
build/pywin/Lib/pprint.py
python
isrecursive
(object)
return _safe_repr(object, {}, None, 0)[2]
Determine if object requires a recursive representation.
Determine if object requires a recursive representation.
[ "Determine", "if", "object", "requires", "a", "recursive", "representation", "." ]
def isrecursive(object): """Determine if object requires a recursive representation.""" return _safe_repr(object, {}, None, 0)[2]
[ "def", "isrecursive", "(", "object", ")", ":", "return", "_safe_repr", "(", "object", ",", "{", "}", ",", "None", ",", "0", ")", "[", "2", "]" ]
https://github.com/PokemonGoF/PokemonGo-Bot-Desktop/blob/4bfa94f0183406c6a86f93645eff7abd3ad4ced8/build/pywin/Lib/pprint.py#L73-L75
selfteaching/selfteaching-python-camp
9982ee964b984595e7d664b07c389cddaf158f1e
exercises/1901100146/d08/mymodule/stats_word.py
python
stats_text
(text)
return stats_text_en(text) + stats_text_cn(text)
合并 英文单词 和中文字频 的结果
合并 英文单词 和中文字频 的结果
[ "合并", "英文单词", "和中文字频", "的结果" ]
def stats_text(text): ''' 合并 英文单词 和中文字频 的结果 ''' if not isinstance(text,str): raise ValueError('参数必须是 str 类型,输入类型 %s' % type(text)) return stats_text_en(text) + stats_text_cn(text)
[ "def", "stats_text", "(", "text", ")", ":", "if", "not", "isinstance", "(", "text", ",", "str", ")", ":", "raise", "ValueError", "(", "'参数必须是 str 类型,输入类型 %s' % type(text))", "", "", "", "", "", "", "return", "stats_text_en", "(", "text", ")", "+", "stats...
https://github.com/selfteaching/selfteaching-python-camp/blob/9982ee964b984595e7d664b07c389cddaf158f1e/exercises/1901100146/d08/mymodule/stats_word.py#L39-L45
pypa/pipenv
b21baade71a86ab3ee1429f71fbc14d4f95fb75d
pipenv/vendor/requests/cookies.py
python
RequestsCookieJar.iterkeys
(self)
Dict-like iterkeys() that returns an iterator of names of cookies from the jar. .. seealso:: itervalues() and iteritems().
Dict-like iterkeys() that returns an iterator of names of cookies from the jar.
[ "Dict", "-", "like", "iterkeys", "()", "that", "returns", "an", "iterator", "of", "names", "of", "cookies", "from", "the", "jar", "." ]
def iterkeys(self): """Dict-like iterkeys() that returns an iterator of names of cookies from the jar. .. seealso:: itervalues() and iteritems(). """ for cookie in iter(self): yield cookie.name
[ "def", "iterkeys", "(", "self", ")", ":", "for", "cookie", "in", "iter", "(", "self", ")", ":", "yield", "cookie", ".", "name" ]
https://github.com/pypa/pipenv/blob/b21baade71a86ab3ee1429f71fbc14d4f95fb75d/pipenv/vendor/requests/cookies.py#L218-L225
scoder/acora
873abb1b78109a2fc57dbe867c78aed8bf7bd153
acora/_acora.py
python
_make_printable
(s)
return b.decode('ascii')
[]
def _make_printable(s): if isinstance(s, bytes): s = s.decode('latin1') b = s.encode('unicode_escape') b = b.replace(b'\\', b'\\\\') return b.decode('ascii')
[ "def", "_make_printable", "(", "s", ")", ":", "if", "isinstance", "(", "s", ",", "bytes", ")", ":", "s", "=", "s", ".", "decode", "(", "'latin1'", ")", "b", "=", "s", ".", "encode", "(", "'unicode_escape'", ")", "b", "=", "b", ".", "replace", "("...
https://github.com/scoder/acora/blob/873abb1b78109a2fc57dbe867c78aed8bf7bd153/acora/_acora.py#L263-L268
deepfakes/faceswap
09c7d8aca3c608d1afad941ea78e9fd9b64d9219
tools/manual/frameviewer/control.py
python
BackgroundImage._current_view_mode
(self)
return retval
str: `frame` if global zoom mode variable is set to ``False`` other wise `face`.
str: `frame` if global zoom mode variable is set to ``False`` other wise `face`.
[ "str", ":", "frame", "if", "global", "zoom", "mode", "variable", "is", "set", "to", "False", "other", "wise", "face", "." ]
def _current_view_mode(self): """ str: `frame` if global zoom mode variable is set to ``False`` other wise `face`. """ retval = "face" if self._globals.is_zoomed else "frame" logger.trace(retval) return retval
[ "def", "_current_view_mode", "(", "self", ")", ":", "retval", "=", "\"face\"", "if", "self", ".", "_globals", ".", "is_zoomed", "else", "\"frame\"", "logger", ".", "trace", "(", "retval", ")", "return", "retval" ]
https://github.com/deepfakes/faceswap/blob/09c7d8aca3c608d1afad941ea78e9fd9b64d9219/tools/manual/frameviewer/control.py#L177-L181
CGATOxford/cgat
326aad4694bdfae8ddc194171bb5d73911243947
CGAT/SetTools.py
python
getAllCombinations
(*sets)
return F(*sets)
generate all combination of elements from a collection of sets. This method is derived from a python recipe by Zoran Isailovski: http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/410685 >>> getAllCombinations(set((1,2)), set((2,3)), set((3,4))) [(1, 2, 3), (1, 2, 4), (1, 3, 3), (1, 3, 4), (2, 2,...
generate all combination of elements from a collection of sets.
[ "generate", "all", "combination", "of", "elements", "from", "a", "collection", "of", "sets", "." ]
def getAllCombinations(*sets): """generate all combination of elements from a collection of sets. This method is derived from a python recipe by Zoran Isailovski: http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/410685 >>> getAllCombinations(set((1,2)), set((2,3)), set((3,4))) [(1, 2, 3), (...
[ "def", "getAllCombinations", "(", "*", "sets", ")", ":", "if", "not", "sets", ":", "return", "[", "]", "F", "=", "_makeListComprehensionFunction", "(", "'F'", ",", "len", "(", "sets", ")", ")", "return", "F", "(", "*", "sets", ")" ]
https://github.com/CGATOxford/cgat/blob/326aad4694bdfae8ddc194171bb5d73911243947/CGAT/SetTools.py#L113-L125
leancloud/satori
701caccbd4fe45765001ca60435c0cb499477c03
satori-rules/plugin/libs/bson/timestamp.py
python
Timestamp.__ge__
(self, other)
return NotImplemented
[]
def __ge__(self, other): if isinstance(other, Timestamp): return (self.time, self.inc) >= (other.time, other.inc) return NotImplemented
[ "def", "__ge__", "(", "self", ",", "other", ")", ":", "if", "isinstance", "(", "other", ",", "Timestamp", ")", ":", "return", "(", "self", ".", "time", ",", "self", ".", "inc", ")", ">=", "(", "other", ".", "time", ",", "other", ".", "inc", ")", ...
https://github.com/leancloud/satori/blob/701caccbd4fe45765001ca60435c0cb499477c03/satori-rules/plugin/libs/bson/timestamp.py#L106-L109
khamidou/kite
c049faf8522c8346c22c70f2a35a35db6b4a155d
src/back/kite/bottle.py
python
BaseRequest.forms
(self)
return forms
Form values parsed from an `url-encoded` or `multipart/form-data` encoded POST or PUT request body. The result is returned as a :class:`FormsDict`. All keys and values are strings. File uploads are stored separately in :attr:`files`.
Form values parsed from an `url-encoded` or `multipart/form-data` encoded POST or PUT request body. The result is returned as a :class:`FormsDict`. All keys and values are strings. File uploads are stored separately in :attr:`files`.
[ "Form", "values", "parsed", "from", "an", "url", "-", "encoded", "or", "multipart", "/", "form", "-", "data", "encoded", "POST", "or", "PUT", "request", "body", ".", "The", "result", "is", "returned", "as", "a", ":", "class", ":", "FormsDict", ".", "Al...
def forms(self): """ Form values parsed from an `url-encoded` or `multipart/form-data` encoded POST or PUT request body. The result is returned as a :class:`FormsDict`. All keys and values are strings. File uploads are stored separately in :attr:`files`. """ forms = F...
[ "def", "forms", "(", "self", ")", ":", "forms", "=", "FormsDict", "(", ")", "for", "name", ",", "item", "in", "self", ".", "POST", ".", "allitems", "(", ")", ":", "if", "not", "isinstance", "(", "item", ",", "FileUpload", ")", ":", "forms", "[", ...
https://github.com/khamidou/kite/blob/c049faf8522c8346c22c70f2a35a35db6b4a155d/src/back/kite/bottle.py#L1077-L1086
ufal/neuralmonkey
8b1465270f6bb28d5417a85cec492f7179036ede
neuralmonkey/trainers/objective.py
python
CostObjective.__init__
(self, decoder: GenericModelPart, weight: ObjectiveWeight = None)
Construct a new instance of the `CostObjective` class. Arguments: decoder: A `GenericModelPart` instance that has a `cost` attribute. weight: The weight of the objective. Raises: `TypeError` when the decoder argument does not have the `cost` attribute.
Construct a new instance of the `CostObjective` class.
[ "Construct", "a", "new", "instance", "of", "the", "CostObjective", "class", "." ]
def __init__(self, decoder: GenericModelPart, weight: ObjectiveWeight = None) -> None: """Construct a new instance of the `CostObjective` class. Arguments: decoder: A `GenericModelPart` instance that has a `cost` attribute. weight: The weight of the objective. ...
[ "def", "__init__", "(", "self", ",", "decoder", ":", "GenericModelPart", ",", "weight", ":", "ObjectiveWeight", "=", "None", ")", "->", "None", ":", "check_argument_types", "(", ")", "if", "\"cost\"", "not", "in", "dir", "(", "decoder", ")", ":", "raise", ...
https://github.com/ufal/neuralmonkey/blob/8b1465270f6bb28d5417a85cec492f7179036ede/neuralmonkey/trainers/objective.py#L69-L88
magenta/magenta
be6558f1a06984faff6d6949234f5fe9ad0ffdb5
magenta/models/coconet/lib_mask.py
python
BernoulliMaskoutMethod.__call__
(self, pianoroll_shape, separate_instruments=True, blankout_ratio=0.5, **unused_kwargs)
return mask
Sample a mask. Args: pianoroll_shape: shape of pianoroll (time, pitch, instrument) separate_instruments: whether instruments are separated blankout_ratio: bernoulli inclusion probability Returns: A mask of shape `shape`. Raises: ValueError: if shape is not three dimensional.
Sample a mask.
[ "Sample", "a", "mask", "." ]
def __call__(self, pianoroll_shape, separate_instruments=True, blankout_ratio=0.5, **unused_kwargs): """Sample a mask. Args: pianoroll_shape: shape of pianoroll (time, pitch, instrument) separate_instruments: whether instruments are separa...
[ "def", "__call__", "(", "self", ",", "pianoroll_shape", ",", "separate_instruments", "=", "True", ",", "blankout_ratio", "=", "0.5", ",", "*", "*", "unused_kwargs", ")", ":", "if", "len", "(", "pianoroll_shape", ")", "!=", "3", ":", "raise", "ValueError", ...
https://github.com/magenta/magenta/blob/be6558f1a06984faff6d6949234f5fe9ad0ffdb5/magenta/models/coconet/lib_mask.py#L69-L98
usb-tools/ViewSB
0318dc7b3d7da290a841b1681e62a0654c8c82e6
viewsb/packet.py
python
ViewSBPacket._include_details_in_debug
()
Returns true iff the given packet's details should be included in its debug output.
Returns true iff the given packet's details should be included in its debug output.
[ "Returns", "true", "iff", "the", "given", "packet", "s", "details", "should", "be", "included", "in", "its", "debug", "output", "." ]
def _include_details_in_debug(): """ Returns true iff the given packet's details should be included in its debug output. """
[ "def", "_include_details_in_debug", "(", ")", ":" ]
https://github.com/usb-tools/ViewSB/blob/0318dc7b3d7da290a841b1681e62a0654c8c82e6/viewsb/packet.py#L282-L283
CvvT/dumpDex
92ab3b7e996194a06bf1dd5538a4954e8a5ee9c1
python/idaapi.py
python
set_lzero
(*args)
return _idaapi.set_lzero(*args)
set_lzero(ea, n) -> bool
set_lzero(ea, n) -> bool
[ "set_lzero", "(", "ea", "n", ")", "-", ">", "bool" ]
def set_lzero(*args): """ set_lzero(ea, n) -> bool """ return _idaapi.set_lzero(*args)
[ "def", "set_lzero", "(", "*", "args", ")", ":", "return", "_idaapi", ".", "set_lzero", "(", "*", "args", ")" ]
https://github.com/CvvT/dumpDex/blob/92ab3b7e996194a06bf1dd5538a4954e8a5ee9c1/python/idaapi.py#L22082-L22086
dgilland/sqlservice
369dfa5d1f95aae7129ff793006d70ce666d0dbc
src/sqlservice/client.py
python
SQLClient.no_autoflush
(self)
return self.session.no_autoflush
Proxy property to :meth:`session.no_autoflush`.
Proxy property to :meth:`session.no_autoflush`.
[ "Proxy", "property", "to", ":", "meth", ":", "session", ".", "no_autoflush", "." ]
def no_autoflush(self): """Proxy property to :meth:`session.no_autoflush`.""" return self.session.no_autoflush
[ "def", "no_autoflush", "(", "self", ")", ":", "return", "self", ".", "session", ".", "no_autoflush" ]
https://github.com/dgilland/sqlservice/blob/369dfa5d1f95aae7129ff793006d70ce666d0dbc/src/sqlservice/client.py#L480-L482
HaoZhang95/Python24
b897224b8a0e6a5734f408df8c24846a98c553bf
00Python/venv/Lib/site-packages/pip-10.0.1-py3.7.egg/pip/_internal/configuration.py
python
Configuration.load
(self)
Loads configuration from configuration files and environment
Loads configuration from configuration files and environment
[ "Loads", "configuration", "from", "configuration", "files", "and", "environment" ]
def load(self): # type: () -> None """Loads configuration from configuration files and environment """ self._load_config_files() if not self.isolated: self._load_environment_vars()
[ "def", "load", "(", "self", ")", ":", "# type: () -> None", "self", ".", "_load_config_files", "(", ")", "if", "not", "self", ".", "isolated", ":", "self", ".", "_load_environment_vars", "(", ")" ]
https://github.com/HaoZhang95/Python24/blob/b897224b8a0e6a5734f408df8c24846a98c553bf/00Python/venv/Lib/site-packages/pip-10.0.1-py3.7.egg/pip/_internal/configuration.py#L108-L114
luispedro/mahotas
08cc4aa0cbd5dbd4c37580d52b822810c03b2c69
mahotas/bbox.py
python
bbox
(img, border=None, as_slice=False)
return r
min1,max1,min2,max2 = bbox(img, border={0}, as_slice={False}) Calculate the bounding box of image img. Parameters ---------- img : ndarray Any integer image type Returns ------- min1,max1,min2,max2 : int,int,int,int These are such that ``img[min1:max1, min2:max2]`` contain...
min1,max1,min2,max2 = bbox(img, border={0}, as_slice={False})
[ "min1", "max1", "min2", "max2", "=", "bbox", "(", "img", "border", "=", "{", "0", "}", "as_slice", "=", "{", "False", "}", ")" ]
def bbox(img, border=None, as_slice=False): """ min1,max1,min2,max2 = bbox(img, border={0}, as_slice={False}) Calculate the bounding box of image img. Parameters ---------- img : ndarray Any integer image type Returns ------- min1,max1,min2,max2 : int,int,int,int T...
[ "def", "bbox", "(", "img", ",", "border", "=", "None", ",", "as_slice", "=", "False", ")", ":", "if", "not", "img", ".", "shape", ":", "return", "np", ".", "array", "(", "[", "]", ",", "dtype", "=", "np", ".", "intp", ")", "r", "=", "_bbox", ...
https://github.com/luispedro/mahotas/blob/08cc4aa0cbd5dbd4c37580d52b822810c03b2c69/mahotas/bbox.py#L11-L41
Hironsan/anago
0ffb4004427c0991b6d023bfa62b37795f608a3d
anago/models.py
python
ELModel.__init__
(self, num_labels, word_vocab_size, char_vocab_size=None, word_embedding_dim=100, char_embedding_dim=25, word_lstm_size=100, char_lstm_size=25, fc_dim=100, dropout=0.5...
Build a Bi-LSTM CRF model. Args: word_vocab_size (int): word vocabulary size. char_vocab_size (int): character vocabulary size. num_labels (int): number of entity labels. word_embedding_dim (int): word embedding dimensions. char_embedding_dim (int): c...
Build a Bi-LSTM CRF model.
[ "Build", "a", "Bi", "-", "LSTM", "CRF", "model", "." ]
def __init__(self, num_labels, word_vocab_size, char_vocab_size=None, word_embedding_dim=100, char_embedding_dim=25, word_lstm_size=100, char_lstm_size=25, fc_dim=100, ...
[ "def", "__init__", "(", "self", ",", "num_labels", ",", "word_vocab_size", ",", "char_vocab_size", "=", "None", ",", "word_embedding_dim", "=", "100", ",", "char_embedding_dim", "=", "25", ",", "word_lstm_size", "=", "100", ",", "char_lstm_size", "=", "25", ",...
https://github.com/Hironsan/anago/blob/0ffb4004427c0991b6d023bfa62b37795f608a3d/anago/models.py#L130-L164
sagemath/sage
f9b2db94f675ff16963ccdefba4f1a3393b3fe0d
src/sage/symbolic/expression_conversions.py
python
FakeExpression.__repr__
(self)
return "FakeExpression(%r, %r)"%(self._operands, self._operator)
EXAMPLES:: sage: from sage.symbolic.expression_conversions import FakeExpression sage: import operator; x,y = var('x,y') sage: FakeExpression([x, y], operator.truediv) FakeExpression([x, y], <built-in function truediv>)
EXAMPLES::
[ "EXAMPLES", "::" ]
def __repr__(self): """ EXAMPLES:: sage: from sage.symbolic.expression_conversions import FakeExpression sage: import operator; x,y = var('x,y') sage: FakeExpression([x, y], operator.truediv) FakeExpression([x, y], <built-in function truediv>) """...
[ "def", "__repr__", "(", "self", ")", ":", "return", "\"FakeExpression(%r, %r)\"", "%", "(", "self", ".", "_operands", ",", "self", ".", "_operator", ")" ]
https://github.com/sagemath/sage/blob/f9b2db94f675ff16963ccdefba4f1a3393b3fe0d/src/sage/symbolic/expression_conversions.py#L53-L62
holzschu/Carnets
44effb10ddfc6aa5c8b0687582a724ba82c6b547
Library/lib/python3.7/site-packages/sympy/combinatorics/perm_groups.py
python
PermutationGroup.order
(self)
return m
Return the order of the group: the number of permutations that can be generated from elements of the group. The number of permutations comprising the group is given by ``len(group)``; the length of each permutation in the group is given by ``group.size``. Examples =====...
Return the order of the group: the number of permutations that can be generated from elements of the group.
[ "Return", "the", "order", "of", "the", "group", ":", "the", "number", "of", "permutations", "that", "can", "be", "generated", "from", "elements", "of", "the", "group", "." ]
def order(self): """Return the order of the group: the number of permutations that can be generated from elements of the group. The number of permutations comprising the group is given by ``len(group)``; the length of each permutation in the group is given by ``group.size``. ...
[ "def", "order", "(", "self", ")", ":", "if", "self", ".", "_order", "is", "not", "None", ":", "return", "self", ".", "_order", "if", "self", ".", "_is_sym", ":", "n", "=", "self", ".", "_degree", "self", ".", "_order", "=", "factorial", "(", "n", ...
https://github.com/holzschu/Carnets/blob/44effb10ddfc6aa5c8b0687582a724ba82c6b547/Library/lib/python3.7/site-packages/sympy/combinatorics/perm_groups.py#L2803-L2856
wuub/SublimeREPL
d17e8649c0d0008a364158d671ac0c7d33d0c896
sublimerepl.py
python
ReplKillCommand.is_enabled
(self)
return self.is_visible()
[]
def is_enabled(self): return self.is_visible()
[ "def", "is_enabled", "(", "self", ")", ":", "return", "self", ".", "is_visible", "(", ")" ]
https://github.com/wuub/SublimeREPL/blob/d17e8649c0d0008a364158d671ac0c7d33d0c896/sublimerepl.py#L735-L736
google/grr
8ad8a4d2c5a93c92729206b7771af19d92d4f915
grr/server/grr_response_server/gui/api_labels_restricted_call_router.py
python
ApiLabelsRestrictedCallRouter.DeletePendingUserNotification
(self, args, context=None)
return self.delegate.DeletePendingUserNotification(args, context=context)
[]
def DeletePendingUserNotification(self, args, context=None): # Everybody can delete their own pending notifications. return self.delegate.DeletePendingUserNotification(args, context=context)
[ "def", "DeletePendingUserNotification", "(", "self", ",", "args", ",", "context", "=", "None", ")", ":", "# Everybody can delete their own pending notifications.", "return", "self", ".", "delegate", ".", "DeletePendingUserNotification", "(", "args", ",", "context", "=",...
https://github.com/google/grr/blob/8ad8a4d2c5a93c92729206b7771af19d92d4f915/grr/server/grr_response_server/gui/api_labels_restricted_call_router.py#L283-L286
hyperledger/aries-cloudagent-python
2f36776e99f6053ae92eed8123b5b1b2e891c02a
aries_cloudagent/protocols/coordinate_mediation/v1_0/manager.py
python
MediationManager.store_update_results
( self, connection_id: str, results: Sequence[KeylistUpdated] )
Store results of keylist update from keylist update response message. Args: connection_id (str): connection ID of mediator sending results results (Sequence[KeylistUpdated]): keylist update results session: An active profile session
Store results of keylist update from keylist update response message.
[ "Store", "results", "of", "keylist", "update", "from", "keylist", "update", "response", "message", "." ]
async def store_update_results( self, connection_id: str, results: Sequence[KeylistUpdated] ): """Store results of keylist update from keylist update response message. Args: connection_id (str): connection ID of mediator sending results results (Sequence[KeylistUpdat...
[ "async", "def", "store_update_results", "(", "self", ",", "connection_id", ":", "str", ",", "results", ":", "Sequence", "[", "KeylistUpdated", "]", ")", ":", "session", "=", "await", "self", ".", "_profile", ".", "session", "(", ")", "to_save", ":", "Seque...
https://github.com/hyperledger/aries-cloudagent-python/blob/2f36776e99f6053ae92eed8123b5b1b2e891c02a/aries_cloudagent/protocols/coordinate_mediation/v1_0/manager.py#L524-L591
goace/personal-file-sharing-center
4a5b903b003f2db1306e77c5e51b6660fc5dbc6a
web/webapi.py
python
_status_code
(status, data=None, classname=None, docstring=None)
return type(classname, (HTTPError, object), { '__doc__': docstring, '__init__': __init__ })
[]
def _status_code(status, data=None, classname=None, docstring=None): if data is None: data = status.split(" ", 1)[1] classname = status.split(" ", 1)[1].replace(' ', '') # 304 Not Modified -> NotModified docstring = docstring or '`%s` status' % status def __init__(self, data=data, headers={...
[ "def", "_status_code", "(", "status", ",", "data", "=", "None", ",", "classname", "=", "None", ",", "docstring", "=", "None", ")", ":", "if", "data", "is", "None", ":", "data", "=", "status", ".", "split", "(", "\" \"", ",", "1", ")", "[", "1", "...
https://github.com/goace/personal-file-sharing-center/blob/4a5b903b003f2db1306e77c5e51b6660fc5dbc6a/web/webapi.py#L50-L63
chribsen/simple-machine-learning-examples
dc94e52a4cebdc8bb959ff88b81ff8cfeca25022
venv/lib/python2.7/site-packages/tpot/operators/classifiers/random_forest.py
python
TPOTRandomForestClassifier.preprocess_args
(self)
return { 'n_estimators': 500 }
Preprocess the arguments in case they need to be limited to a certain value range
Preprocess the arguments in case they need to be limited to a certain value range
[ "Preprocess", "the", "arguments", "in", "case", "they", "need", "to", "be", "limited", "to", "a", "certain", "value", "range" ]
def preprocess_args(self): """Preprocess the arguments in case they need to be limited to a certain value range""" return { 'n_estimators': 500 }
[ "def", "preprocess_args", "(", "self", ")", ":", "return", "{", "'n_estimators'", ":", "500", "}" ]
https://github.com/chribsen/simple-machine-learning-examples/blob/dc94e52a4cebdc8bb959ff88b81ff8cfeca25022/venv/lib/python2.7/site-packages/tpot/operators/classifiers/random_forest.py#L41-L45
statsmodels/statsmodels
debbe7ea6ba28fe5bdb78f09f8cac694bef98722
statsmodels/tsa/regime_switching/markov_switching.py
python
MarkovSwitching.fit
(self, start_params=None, transformed=True, cov_type='approx', cov_kwds=None, method='bfgs', maxiter=100, full_output=1, disp=0, callback=None, return_params=False, em_iter=5, search_reps=0, search_iter=5, search_scale=1., **kwargs)
return result
Fits the model by maximum likelihood via Hamilton filter. Parameters ---------- start_params : array_like, optional Initial guess of the solution for the loglikelihood maximization. If None, the default is given by Model.start_params. transformed : bool, optional...
Fits the model by maximum likelihood via Hamilton filter.
[ "Fits", "the", "model", "by", "maximum", "likelihood", "via", "Hamilton", "filter", "." ]
def fit(self, start_params=None, transformed=True, cov_type='approx', cov_kwds=None, method='bfgs', maxiter=100, full_output=1, disp=0, callback=None, return_params=False, em_iter=5, search_reps=0, search_iter=5, search_scale=1., **kwargs): """ Fits the model by maxim...
[ "def", "fit", "(", "self", ",", "start_params", "=", "None", ",", "transformed", "=", "True", ",", "cov_type", "=", "'approx'", ",", "cov_kwds", "=", "None", ",", "method", "=", "'bfgs'", ",", "maxiter", "=", "100", ",", "full_output", "=", "1", ",", ...
https://github.com/statsmodels/statsmodels/blob/debbe7ea6ba28fe5bdb78f09f8cac694bef98722/statsmodels/tsa/regime_switching/markov_switching.py#L1025-L1142
khamidou/kite
c049faf8522c8346c22c70f2a35a35db6b4a155d
src/back/kite/bottle.py
python
ConfigDict.load_config
(self, filename)
return self
Load values from an *.ini style config file. If the config file contains sections, their names are used as namespaces for the values within. The two special sections ``DEFAULT`` and ``bottle`` refer to the root namespace (no prefix).
Load values from an *.ini style config file.
[ "Load", "values", "from", "an", "*", ".", "ini", "style", "config", "file", "." ]
def load_config(self, filename): ''' Load values from an *.ini style config file. If the config file contains sections, their names are used as namespaces for the values within. The two special sections ``DEFAULT`` and ``bottle`` refer to the root namespace (no prefix). ...
[ "def", "load_config", "(", "self", ",", "filename", ")", ":", "conf", "=", "ConfigParser", "(", ")", "conf", ".", "read", "(", "filename", ")", "for", "section", "in", "conf", ".", "sections", "(", ")", ":", "for", "key", ",", "value", "in", "conf", ...
https://github.com/khamidou/kite/blob/c049faf8522c8346c22c70f2a35a35db6b4a155d/src/back/kite/bottle.py#L1995-L2009
python/cpython
e13cdca0f5224ec4e23bdd04bb3120506964bc8b
Lib/lib2to3/pgen2/driver.py
python
load_grammar
(gt="Grammar.txt", gp=None, save=True, force=False, logger=None)
return g
Load the grammar (maybe from a pickle).
Load the grammar (maybe from a pickle).
[ "Load", "the", "grammar", "(", "maybe", "from", "a", "pickle", ")", "." ]
def load_grammar(gt="Grammar.txt", gp=None, save=True, force=False, logger=None): """Load the grammar (maybe from a pickle).""" if logger is None: logger = logging.getLogger() gp = _generate_pickle_name(gt) if gp is None else gp if force or not _newer(gp, gt): logger.inf...
[ "def", "load_grammar", "(", "gt", "=", "\"Grammar.txt\"", ",", "gp", "=", "None", ",", "save", "=", "True", ",", "force", "=", "False", ",", "logger", "=", "None", ")", ":", "if", "logger", "is", "None", ":", "logger", "=", "logging", ".", "getLogger...
https://github.com/python/cpython/blob/e13cdca0f5224ec4e23bdd04bb3120506964bc8b/Lib/lib2to3/pgen2/driver.py#L113-L131
ales-tsurko/cells
4cf7e395cd433762bea70cdc863a346f3a6fe1d0
packaging/macos/python/lib/python3.7/site-packages/pip/_vendor/distlib/_backport/tarfile.py
python
_Stream.read
(self, size=None)
return buf
Return the next size number of bytes from the stream. If size is not defined, return all bytes of the stream up to EOF.
Return the next size number of bytes from the stream. If size is not defined, return all bytes of the stream up to EOF.
[ "Return", "the", "next", "size", "number", "of", "bytes", "from", "the", "stream", ".", "If", "size", "is", "not", "defined", "return", "all", "bytes", "of", "the", "stream", "up", "to", "EOF", "." ]
def read(self, size=None): """Return the next size number of bytes from the stream. If size is not defined, return all bytes of the stream up to EOF. """ if size is None: t = [] while True: buf = self._read(self.bufsize) ...
[ "def", "read", "(", "self", ",", "size", "=", "None", ")", ":", "if", "size", "is", "None", ":", "t", "=", "[", "]", "while", "True", ":", "buf", "=", "self", ".", "_read", "(", "self", ".", "bufsize", ")", "if", "not", "buf", ":", "break", "...
https://github.com/ales-tsurko/cells/blob/4cf7e395cd433762bea70cdc863a346f3a6fe1d0/packaging/macos/python/lib/python3.7/site-packages/pip/_vendor/distlib/_backport/tarfile.py#L565-L581
huawei-noah/vega
d9f13deede7f2b584e4b1d32ffdb833856129989
vega/algorithms/nas/dag_block_nas/block_nas.py
python
ProgressiveMutation.sample_sub_blocks
(self, blocks)
return do_block_fusion(sub_blocks)
Chose one sub block.
Chose one sub block.
[ "Chose", "one", "sub", "block", "." ]
def sample_sub_blocks(self, blocks): """Chose one sub block.""" s_idx = self.sample_sub_blocks_idx(len(blocks)) sub_blocks = [block for idx, block in enumerate(blocks) if s_idx[0] < idx < s_idx[1]] return do_block_fusion(sub_blocks)
[ "def", "sample_sub_blocks", "(", "self", ",", "blocks", ")", ":", "s_idx", "=", "self", ".", "sample_sub_blocks_idx", "(", "len", "(", "blocks", ")", ")", "sub_blocks", "=", "[", "block", "for", "idx", ",", "block", "in", "enumerate", "(", "blocks", ")",...
https://github.com/huawei-noah/vega/blob/d9f13deede7f2b584e4b1d32ffdb833856129989/vega/algorithms/nas/dag_block_nas/block_nas.py#L172-L176
shiyanlou/louplus-python
4c61697259e286e3d9116c3299f170d019ba3767
Python 实战大项目 seiya/seiya/seiya/web/app.py
python
job_hot_tags
()
return render_template('job/hot-tags.html', rows=job.hot_tags())
热门职位标签页面
热门职位标签页面
[ "热门职位标签页面" ]
def job_hot_tags(): """热门职位标签页面 """ return render_template('job/hot-tags.html', rows=job.hot_tags())
[ "def", "job_hot_tags", "(", ")", ":", "return", "render_template", "(", "'job/hot-tags.html'", ",", "rows", "=", "job", ".", "hot_tags", "(", ")", ")" ]
https://github.com/shiyanlou/louplus-python/blob/4c61697259e286e3d9116c3299f170d019ba3767/Python 实战大项目 seiya/seiya/seiya/web/app.py#L74-L78
tp4a/teleport
1fafd34f1f775d2cf80ea4af6e44468d8e0b24ad
server/www/packages/packages-windows/x86/asn1crypto/ocsp.py
python
OCSPResponse.extended_revoke_value
(self)
return self._extended_revoke_value
This extension is used to signal that the responder will return a "revoked" status for non-issued certificates. :return: None or a Null object (if present)
This extension is used to signal that the responder will return a "revoked" status for non-issued certificates.
[ "This", "extension", "is", "used", "to", "signal", "that", "the", "responder", "will", "return", "a", "revoked", "status", "for", "non", "-", "issued", "certificates", "." ]
def extended_revoke_value(self): """ This extension is used to signal that the responder will return a "revoked" status for non-issued certificates. :return: None or a Null object (if present) """ if self._processed_extensions is False: self._set...
[ "def", "extended_revoke_value", "(", "self", ")", ":", "if", "self", ".", "_processed_extensions", "is", "False", ":", "self", ".", "_set_extensions", "(", ")", "return", "self", ".", "_extended_revoke_value" ]
https://github.com/tp4a/teleport/blob/1fafd34f1f775d2cf80ea4af6e44468d8e0b24ad/server/www/packages/packages-windows/x86/asn1crypto/ocsp.py#L670-L681
ioflo/ioflo
177ac656d7c4ff801aebb0d8b401db365a5248ce
ioflo/aio/tcp/clienting.py
python
ClientTls.wrap
(self)
Wrap socket .cs in ssl context
Wrap socket .cs in ssl context
[ "Wrap", "socket", ".", "cs", "in", "ssl", "context" ]
def wrap(self): """ Wrap socket .cs in ssl context """ self.cs = self.context.wrap_socket(self.cs, server_side=False, do_handshake_on_connect=False, server_hos...
[ "def", "wrap", "(", "self", ")", ":", "self", ".", "cs", "=", "self", ".", "context", ".", "wrap_socket", "(", "self", ".", "cs", ",", "server_side", "=", "False", ",", "do_handshake_on_connect", "=", "False", ",", "server_hostname", "=", "self", ".", ...
https://github.com/ioflo/ioflo/blob/177ac656d7c4ff801aebb0d8b401db365a5248ce/ioflo/aio/tcp/clienting.py#L586-L593
pjlantz/droidbox
519ddd198ccef2e0d27e12929f25702f6a385d94
external/droidbox.py
python
hexToStr
(hexStr)
return ''.join( bytes )
Convert a string hex byte values into a byte string
Convert a string hex byte values into a byte string
[ "Convert", "a", "string", "hex", "byte", "values", "into", "a", "byte", "string" ]
def hexToStr(hexStr): """ Convert a string hex byte values into a byte string """ bytes = [] hexStr = ''.join(hexStr.split(" ")) for i in range(0, len(hexStr), 2): bytes.append(chr(int(hexStr[i:i+2], 16))) return ''.join( bytes )
[ "def", "hexToStr", "(", "hexStr", ")", ":", "bytes", "=", "[", "]", "hexStr", "=", "''", ".", "join", "(", "hexStr", ".", "split", "(", "\" \"", ")", ")", "for", "i", "in", "range", "(", "0", ",", "len", "(", "hexStr", ")", ",", "2", ")", ":"...
https://github.com/pjlantz/droidbox/blob/519ddd198ccef2e0d27e12929f25702f6a385d94/external/droidbox.py#L165-L174
IronLanguages/main
a949455434b1fda8c783289e897e78a9a0caabb5
External.LCA_RESTRICTED/Languages/IronPython/27/Lib/site-packages/win32com/decimal_23.py
python
Decimal._isinteger
(self)
return rest == (0,)*len(rest)
Returns whether self is an integer
Returns whether self is an integer
[ "Returns", "whether", "self", "is", "an", "integer" ]
def _isinteger(self): """Returns whether self is an integer""" if self._exp >= 0: return True rest = self._int[self._exp:] return rest == (0,)*len(rest)
[ "def", "_isinteger", "(", "self", ")", ":", "if", "self", ".", "_exp", ">=", "0", ":", "return", "True", "rest", "=", "self", ".", "_int", "[", "self", ".", "_exp", ":", "]", "return", "rest", "==", "(", "0", ",", ")", "*", "len", "(", "rest", ...
https://github.com/IronLanguages/main/blob/a949455434b1fda8c783289e897e78a9a0caabb5/External.LCA_RESTRICTED/Languages/IronPython/27/Lib/site-packages/win32com/decimal_23.py#L2095-L2100
metabrainz/picard
535bf8c7d9363ffc7abb3f69418ec11823c38118
picard/cluster.py
python
UnclusteredFiles.remove_file
(self, file, new_album=True)
[]
def remove_file(self, file, new_album=True): super().remove_file(file, new_album=new_album) self.tagger.window.enable_cluster(self.get_num_files() > 0)
[ "def", "remove_file", "(", "self", ",", "file", ",", "new_album", "=", "True", ")", ":", "super", "(", ")", ".", "remove_file", "(", "file", ",", "new_album", "=", "new_album", ")", "self", ".", "tagger", ".", "window", ".", "enable_cluster", "(", "sel...
https://github.com/metabrainz/picard/blob/535bf8c7d9363ffc7abb3f69418ec11823c38118/picard/cluster.py#L335-L337
krintoxi/NoobSec-Toolkit
38738541cbc03cedb9a3b3ed13b629f781ad64f6
NoobSecToolkit - MAC OSX/tools/inject/plugins/dbms/firebird/connector.py
python
Connector.fetchall
(self)
[]
def fetchall(self): try: return self.cursor.fetchall() except kinterbasdb.OperationalError, msg: logger.log(logging.WARN if conf.dbmsHandler else logging.DEBUG, "(remote) %s" % msg[1]) return None
[ "def", "fetchall", "(", "self", ")", ":", "try", ":", "return", "self", ".", "cursor", ".", "fetchall", "(", ")", "except", "kinterbasdb", ".", "OperationalError", ",", "msg", ":", "logger", ".", "log", "(", "logging", ".", "WARN", "if", "conf", ".", ...
https://github.com/krintoxi/NoobSec-Toolkit/blob/38738541cbc03cedb9a3b3ed13b629f781ad64f6/NoobSecToolkit - MAC OSX/tools/inject/plugins/dbms/firebird/connector.py#L50-L55
zhl2008/awd-platform
0416b31abea29743387b10b3914581fbe8e7da5e
web_flaskbb/lib/python2.7/site-packages/redis/client.py
python
StrictRedis.brpoplpush
(self, src, dst, timeout=0)
return self.execute_command('BRPOPLPUSH', src, dst, timeout)
Pop a value off the tail of ``src``, push it on the head of ``dst`` and then return it. This command blocks until a value is in ``src`` or until ``timeout`` seconds elapse, whichever is first. A ``timeout`` value of 0 blocks forever.
Pop a value off the tail of ``src``, push it on the head of ``dst`` and then return it.
[ "Pop", "a", "value", "off", "the", "tail", "of", "src", "push", "it", "on", "the", "head", "of", "dst", "and", "then", "return", "it", "." ]
def brpoplpush(self, src, dst, timeout=0): """ Pop a value off the tail of ``src``, push it on the head of ``dst`` and then return it. This command blocks until a value is in ``src`` or until ``timeout`` seconds elapse, whichever is first. A ``timeout`` value of 0 blocks ...
[ "def", "brpoplpush", "(", "self", ",", "src", ",", "dst", ",", "timeout", "=", "0", ")", ":", "if", "timeout", "is", "None", ":", "timeout", "=", "0", "return", "self", ".", "execute_command", "(", "'BRPOPLPUSH'", ",", "src", ",", "dst", ",", "timeou...
https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_flaskbb/lib/python2.7/site-packages/redis/client.py#L1291-L1302
frescobaldi/frescobaldi
301cc977fc4ba7caa3df9e4bf905212ad5d06912
frescobaldi_app/fonts/preview.py
python
get_persistent_cache_dir
()
return pref or os.path.join( tempfile.gettempdir(), appinfo.name + '-music-font-samples' )
Determine location for "persistent" caching of music fonts, either from the Preference (persistent) or the default temporary directory, which will be purged upon computer shutdown.
Determine location for "persistent" caching of music fonts, either from the Preference (persistent) or the default temporary directory, which will be purged upon computer shutdown.
[ "Determine", "location", "for", "persistent", "caching", "of", "music", "fonts", "either", "from", "the", "Preference", "(", "persistent", ")", "or", "the", "default", "temporary", "directory", "which", "will", "be", "purged", "upon", "computer", "shutdown", "."...
def get_persistent_cache_dir(): """ Determine location for "persistent" caching of music fonts, either from the Preference (persistent) or the default temporary directory, which will be purged upon computer shutdown. """ pref = QSettings().value('music-fonts/font-cache', '', str) return pref...
[ "def", "get_persistent_cache_dir", "(", ")", ":", "pref", "=", "QSettings", "(", ")", ".", "value", "(", "'music-fonts/font-cache'", ",", "''", ",", "str", ")", "return", "pref", "or", "os", ".", "path", ".", "join", "(", "tempfile", ".", "gettempdir", "...
https://github.com/frescobaldi/frescobaldi/blob/301cc977fc4ba7caa3df9e4bf905212ad5d06912/frescobaldi_app/fonts/preview.py#L50-L60