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
OctoPrint/OctoPrint
4b12b0e6f06c3abfb31b1840a0605e2de8e911d2
src/octoprint/vendor/flask_principal.py
python
Permission.issubset
(self, other)
return ( self.needs.issubset(other.needs) and self.excludes.issubset(other.excludes) )
Whether this permission needs are a subset of another :param other: The other permission
Whether this permission needs are a subset of another
[ "Whether", "this", "permission", "needs", "are", "a", "subset", "of", "another" ]
def issubset(self, other): """Whether this permission needs are a subset of another :param other: The other permission """ return ( self.needs.issubset(other.needs) and self.excludes.issubset(other.excludes) )
[ "def", "issubset", "(", "self", ",", "other", ")", ":", "return", "(", "self", ".", "needs", ".", "issubset", "(", "other", ".", "needs", ")", "and", "self", ".", "excludes", ".", "issubset", "(", "other", ".", "excludes", ")", ")" ]
https://github.com/OctoPrint/OctoPrint/blob/4b12b0e6f06c3abfb31b1840a0605e2de8e911d2/src/octoprint/vendor/flask_principal.py#L318-L326
realpython/book2-exercises
cde325eac8e6d8cff2316601c2e5b36bb46af7d0
web2py/venv/lib/python2.7/site-packages/pip/index.py
python
PackageFinder._link_package_versions
(self, link, search)
return InstallationCandidate(search.supplied, version, link)
Return an InstallationCandidate or None
Return an InstallationCandidate or None
[ "Return", "an", "InstallationCandidate", "or", "None" ]
def _link_package_versions(self, link, search): """Return an InstallationCandidate or None""" version = None if link.egg_fragment: egg_info = link.egg_fragment ext = link.ext else: egg_info, ext = link.splitext() if not ext: ...
[ "def", "_link_package_versions", "(", "self", ",", "link", ",", "search", ")", ":", "version", "=", "None", "if", "link", ".", "egg_fragment", ":", "egg_info", "=", "link", ".", "egg_fragment", "ext", "=", "link", ".", "ext", "else", ":", "egg_info", ","...
https://github.com/realpython/book2-exercises/blob/cde325eac8e6d8cff2316601c2e5b36bb46af7d0/web2py/venv/lib/python2.7/site-packages/pip/index.py#L605-L680
Ha0Tang/SelectionGAN
80aa7ad9f79f643c28633c40c621f208f3fb0121
person_transfer/models/PATN.py
python
TransferModel.save
(self, label)
[]
def save(self, label): self.save_network(self.netG1, 'netG1', label, self.gpu_ids) self.save_network(self.netG2, 'netG2', label, self.gpu_ids) if self.opt.with_D_PB: self.save_network(self.netD_PB, 'netD_PB', label, self.gpu_ids) if self.opt.with_D_PP: self.sav...
[ "def", "save", "(", "self", ",", "label", ")", ":", "self", ".", "save_network", "(", "self", ".", "netG1", ",", "'netG1'", ",", "label", ",", "self", ".", "gpu_ids", ")", "self", ".", "save_network", "(", "self", ".", "netG2", ",", "'netG2'", ",", ...
https://github.com/Ha0Tang/SelectionGAN/blob/80aa7ad9f79f643c28633c40c621f208f3fb0121/person_transfer/models/PATN.py#L311-L317
robhagemans/pcbasic
c3a043b46af66623a801e18a38175be077251ada
pcbasic/basic/devices/disk.py
python
dos_to_native_name
(native_path, dosname, isdir)
return None
Find a matching native file name for a given normalised DOS name.
Find a matching native file name for a given normalised DOS name.
[ "Find", "a", "matching", "native", "file", "name", "for", "a", "given", "normalised", "DOS", "name", "." ]
def dos_to_native_name(native_path, dosname, isdir): """Find a matching native file name for a given normalised DOS name.""" try: uni_name = dosname.decode('ascii') except UnicodeDecodeError: # non-ascii characters are not allowable for DOS filenames, no match return None # check...
[ "def", "dos_to_native_name", "(", "native_path", ",", "dosname", ",", "isdir", ")", ":", "try", ":", "uni_name", "=", "dosname", ".", "decode", "(", "'ascii'", ")", "except", "UnicodeDecodeError", ":", "# non-ascii characters are not allowable for DOS filenames, no matc...
https://github.com/robhagemans/pcbasic/blob/c3a043b46af66623a801e18a38175be077251ada/pcbasic/basic/devices/disk.py#L179-L206
PaddlePaddle/PaddleSpeech
26524031d242876b7fdb71582b0b3a7ea45c7d9d
paddlespeech/s2t/training/updaters/standard_updater.py
python
StandardUpdater.state_dict
(self)
return state_dict
State dict of a Updater, model, optimizers/schedulers and updater state are included.
State dict of a Updater, model, optimizers/schedulers and updater state are included.
[ "State", "dict", "of", "a", "Updater", "model", "optimizers", "/", "schedulers", "and", "updater", "state", "are", "included", "." ]
def state_dict(self): """State dict of a Updater, model, optimizers/schedulers and updater state are included.""" state_dict = super().state_dict() for name, model in self.models.items(): state_dict[f"{name}_params"] = model.state_dict() for name, optim in self.optim...
[ "def", "state_dict", "(", "self", ")", ":", "state_dict", "=", "super", "(", ")", ".", "state_dict", "(", ")", "for", "name", ",", "model", "in", "self", ".", "models", ".", "items", "(", ")", ":", "state_dict", "[", "f\"{name}_params\"", "]", "=", "...
https://github.com/PaddlePaddle/PaddleSpeech/blob/26524031d242876b7fdb71582b0b3a7ea45c7d9d/paddlespeech/s2t/training/updaters/standard_updater.py#L179-L187
stratosphereips/Manati
20e55d49edf00f8503807c62397d02a0dad9ddff
manati/api_manager/models.py
python
ExternalModuleManager.find_by_event
(self, event_name)
return etss
[]
def find_by_event(self, event_name): ets= ExternalModule.objects.filter(run_in_events__contains=event_name)\ .exclude(status=ExternalModule.MODULES_STATUS.removed).distinct() etss = [] for et in ets: run_in_events = json.loads(et.run_in_events) if event_name i...
[ "def", "find_by_event", "(", "self", ",", "event_name", ")", ":", "ets", "=", "ExternalModule", ".", "objects", ".", "filter", "(", "run_in_events__contains", "=", "event_name", ")", ".", "exclude", "(", "status", "=", "ExternalModule", ".", "MODULES_STATUS", ...
https://github.com/stratosphereips/Manati/blob/20e55d49edf00f8503807c62397d02a0dad9ddff/manati/api_manager/models.py#L54-L62
sdaps/sdaps
51d1072185223f5e48512661e2c1e8399d63e876
sdaps/gui/buddies.py
python
centered_circle
(cr, x, y, radius)
[]
def centered_circle(cr, x, y, radius): inner_ellipse(cr, x - radius, y - radius, 2*radius, 2*radius)
[ "def", "centered_circle", "(", "cr", ",", "x", ",", "y", ",", "radius", ")", ":", "inner_ellipse", "(", "cr", ",", "x", "-", "radius", ",", "y", "-", "radius", ",", "2", "*", "radius", ",", "2", "*", "radius", ")" ]
https://github.com/sdaps/sdaps/blob/51d1072185223f5e48512661e2c1e8399d63e876/sdaps/gui/buddies.py#L70-L71
KalleHallden/AutoTimer
2d954216700c4930baa154e28dbddc34609af7ce
env/lib/python2.7/site-packages/pip/_vendor/ipaddress.py
python
_IPAddressBase._prefix_from_prefix_string
(cls, prefixlen_str)
return prefixlen
Return prefix length from a numeric string Args: prefixlen_str: The string to be converted Returns: An integer, the prefix length. Raises: NetmaskValueError: If the input is not a valid netmask
Return prefix length from a numeric string
[ "Return", "prefix", "length", "from", "a", "numeric", "string" ]
def _prefix_from_prefix_string(cls, prefixlen_str): """Return prefix length from a numeric string Args: prefixlen_str: The string to be converted Returns: An integer, the prefix length. Raises: NetmaskValueError: If the input is not a valid netmask ...
[ "def", "_prefix_from_prefix_string", "(", "cls", ",", "prefixlen_str", ")", ":", "# int allows a leading +/- as well as surrounding whitespace,", "# so we ensure that isn't the case", "if", "not", "_BaseV4", ".", "_DECIMAL_DIGITS", ".", "issuperset", "(", "prefixlen_str", ")", ...
https://github.com/KalleHallden/AutoTimer/blob/2d954216700c4930baa154e28dbddc34609af7ce/env/lib/python2.7/site-packages/pip/_vendor/ipaddress.py#L600-L622
apache/tvm
6eb4ed813ebcdcd9558f0906a1870db8302ff1e0
python/tvm/autotvm/graph_tuner/base_graph_tuner.py
python
BaseGraphTuner.get_optimal_records
(self)
return ret
Convert optimal record dictionary to a list of records with ascending order of node index in graph. Returns ------- sch_list : list of tuple List of records with ascending order of node index in graph.
Convert optimal record dictionary to a list of records with ascending order of node index in graph.
[ "Convert", "optimal", "record", "dictionary", "to", "a", "list", "of", "records", "with", "ascending", "order", "of", "node", "index", "in", "graph", "." ]
def get_optimal_records(self): """Convert optimal record dictionary to a list of records with ascending order of node index in graph. Returns ------- sch_list : list of tuple List of records with ascending order of node index in graph. """ ordered_ind...
[ "def", "get_optimal_records", "(", "self", ")", ":", "ordered_index_list", "=", "sorted", "(", "self", ".", "_optimal_record_dict", ".", "keys", "(", ")", ")", "ret", "=", "[", "]", "for", "index", "in", "ordered_index_list", ":", "node_entry", "=", "self", ...
https://github.com/apache/tvm/blob/6eb4ed813ebcdcd9558f0906a1870db8302ff1e0/python/tvm/autotvm/graph_tuner/base_graph_tuner.py#L556-L572
ilastik/ilastik
6acd2c554bc517e9c8ddad3623a7aaa2e6970c28
lazyflow/request/request.py
python
RequestPool.__len__
(self)
Returns the number of requests that we haven't discarded yet and therefore haven't completely finished. This len will decrease until the RequestPool has completed or failed.
Returns the number of requests that we haven't discarded yet and therefore haven't completely finished.
[ "Returns", "the", "number", "of", "requests", "that", "we", "haven", "t", "discarded", "yet", "and", "therefore", "haven", "t", "completely", "finished", "." ]
def __len__(self): """ Returns the number of requests that we haven't discarded yet and therefore haven't completely finished. This len will decrease until the RequestPool has completed or failed. """ with self._set_lock: return len(self._unsubmitted_requests...
[ "def", "__len__", "(", "self", ")", ":", "with", "self", ".", "_set_lock", ":", "return", "len", "(", "self", ".", "_unsubmitted_requests", ")", "+", "len", "(", "self", ".", "_active_requests", ")", "+", "len", "(", "self", ".", "_finishing_requests", "...
https://github.com/ilastik/ilastik/blob/6acd2c554bc517e9c8ddad3623a7aaa2e6970c28/lazyflow/request/request.py#L1286-L1294
SAP-archive/PyHDB
667ed1f069ca9282deb792a6dde987c1ab488362
pyhdb/protocol/parts.py
python
Parameters.pack_lob_data
(remaining_size, payload, row_header_start_pos, row_lobs)
return unwritten_lobs
After parameter row has been written, append the lobs and update the corresponding lob headers with lob position and lob size: :param payload: payload object (io.BytesIO instance) :param row_header_start_pos: absolute position of start position of row within payload :param row_lobs: list...
After parameter row has been written, append the lobs and update the corresponding lob headers with lob position and lob size: :param payload: payload object (io.BytesIO instance) :param row_header_start_pos: absolute position of start position of row within payload :param row_lobs: list...
[ "After", "parameter", "row", "has", "been", "written", "append", "the", "lobs", "and", "update", "the", "corresponding", "lob", "headers", "with", "lob", "position", "and", "lob", "size", ":", ":", "param", "payload", ":", "payload", "object", "(", "io", "...
def pack_lob_data(remaining_size, payload, row_header_start_pos, row_lobs): """ After parameter row has been written, append the lobs and update the corresponding lob headers with lob position and lob size: :param payload: payload object (io.BytesIO instance) :param row_header_st...
[ "def", "pack_lob_data", "(", "remaining_size", ",", "payload", ",", "row_header_start_pos", ",", "row_lobs", ")", ":", "unwritten_lobs", "=", "collections", ".", "deque", "(", ")", "for", "lob_buffer", "in", "row_lobs", ":", "# Calculate relative position of lob withi...
https://github.com/SAP-archive/PyHDB/blob/667ed1f069ca9282deb792a6dde987c1ab488362/pyhdb/protocol/parts.py#L545-L573
ni/nidaqmx-python
62fc6b48cbbb330fe1bcc9aedadc86610a1269b6
nidaqmx/_task_modules/triggering/start_trigger.py
python
StartTrigger.anlg_edge_lvl
(self)
[]
def anlg_edge_lvl(self): cfunc = lib_importer.windll.DAQmxResetAnlgEdgeStartTrigLvl if cfunc.argtypes is None: with cfunc.arglock: if cfunc.argtypes is None: cfunc.argtypes = [ lib_importer.task_handle] error_code = cfunc( ...
[ "def", "anlg_edge_lvl", "(", "self", ")", ":", "cfunc", "=", "lib_importer", ".", "windll", ".", "DAQmxResetAnlgEdgeStartTrigLvl", "if", "cfunc", ".", "argtypes", "is", "None", ":", "with", "cfunc", ".", "arglock", ":", "if", "cfunc", ".", "argtypes", "is", ...
https://github.com/ni/nidaqmx-python/blob/62fc6b48cbbb330fe1bcc9aedadc86610a1269b6/nidaqmx/_task_modules/triggering/start_trigger.py#L434-L444
bnpy/bnpy
d5b311e8f58ccd98477f4a0c8a4d4982e3fca424
bnpy/allocmodel/topics/HDPTopicModel.py
python
HDPTopicModel.update_global_params_VB
(self, SS, rho=None, mergeCompA=None, mergeCompB=None, sortorder=None, **kwargs)
Update global parameters.
Update global parameters.
[ "Update", "global", "parameters", "." ]
def update_global_params_VB(self, SS, rho=None, mergeCompA=None, mergeCompB=None, sortorder=None, **kwargs): ''' Update global parameters. ''' if mergeCompA is None: # Standard case: ...
[ "def", "update_global_params_VB", "(", "self", ",", "SS", ",", "rho", "=", "None", ",", "mergeCompA", "=", "None", ",", "mergeCompB", "=", "None", ",", "sortorder", "=", "None", ",", "*", "*", "kwargs", ")", ":", "if", "mergeCompA", "is", "None", ":", ...
https://github.com/bnpy/bnpy/blob/d5b311e8f58ccd98477f4a0c8a4d4982e3fca424/bnpy/allocmodel/topics/HDPTopicModel.py#L431-L455
hypothesis/h
25ef1b8d94889df86ace5a084f1aa0effd9f4e25
h/services/group.py
python
GroupService.groupids_created_by
(self, user)
return [ g.pubid for g in self.session.query(Group.pubid).filter_by(creator=user) ]
Return a list of pubids which the user created. If the passed-in user is ``None``, this returns an empty list. :type user: `h.models.user.User` or None
Return a list of pubids which the user created.
[ "Return", "a", "list", "of", "pubids", "which", "the", "user", "created", "." ]
def groupids_created_by(self, user): """ Return a list of pubids which the user created. If the passed-in user is ``None``, this returns an empty list. :type user: `h.models.user.User` or None """ if user is None: return [] return [ g.pu...
[ "def", "groupids_created_by", "(", "self", ",", "user", ")", ":", "if", "user", "is", "None", ":", "return", "[", "]", "return", "[", "g", ".", "pubid", "for", "g", "in", "self", ".", "session", ".", "query", "(", "Group", ".", "pubid", ")", ".", ...
https://github.com/hypothesis/h/blob/25ef1b8d94889df86ace5a084f1aa0effd9f4e25/h/services/group.py#L107-L120
falconry/falcon
ee97769eab6a951864876202474133446aa50297
falcon/asgi/app.py
python
App._handle_exception
(self, req, resp, ex, params, ws=None)
return False
Handle an exception raised from mw or a responder. Args: ex: Exception to handle req: Current request object to pass to the handler registered for the given exception type resp: Current response object to pass to the handler registered for the...
Handle an exception raised from mw or a responder.
[ "Handle", "an", "exception", "raised", "from", "mw", "or", "a", "responder", "." ]
async def _handle_exception(self, req, resp, ex, params, ws=None): """Handle an exception raised from mw or a responder. Args: ex: Exception to handle req: Current request object to pass to the handler registered for the given exception type resp: Cur...
[ "async", "def", "_handle_exception", "(", "self", ",", "req", ",", "resp", ",", "ex", ",", "params", ",", "ws", "=", "None", ")", ":", "err_handler", "=", "self", ".", "_find_error_handler", "(", "ex", ")", "if", "resp", ":", "# NOTE(caselit): Reset body, ...
https://github.com/falconry/falcon/blob/ee97769eab6a951864876202474133446aa50297/falcon/asgi/app.py#L1061-L1108
privacyidea/privacyidea
9490c12ddbf77a34ac935b082d09eb583dfafa2c
privacyidea/models.py
python
PeriodicTaskLastRun.__init__
(self, periodictask_id, node, timestamp)
:param periodictask_id: ID of the periodic task we are referring to :param node: Node name as unicode :param timestamp: Time of the last run as a datetime. A timezone must not be set! We require the time to be given in UTC.
:param periodictask_id: ID of the periodic task we are referring to :param node: Node name as unicode :param timestamp: Time of the last run as a datetime. A timezone must not be set! We require the time to be given in UTC.
[ ":", "param", "periodictask_id", ":", "ID", "of", "the", "periodic", "task", "we", "are", "referring", "to", ":", "param", "node", ":", "Node", "name", "as", "unicode", ":", "param", "timestamp", ":", "Time", "of", "the", "last", "run", "as", "a", "dat...
def __init__(self, periodictask_id, node, timestamp): """ :param periodictask_id: ID of the periodic task we are referring to :param node: Node name as unicode :param timestamp: Time of the last run as a datetime. A timezone must not be set! We require the time ...
[ "def", "__init__", "(", "self", ",", "periodictask_id", ",", "node", ",", "timestamp", ")", ":", "self", ".", "periodictask_id", "=", "periodictask_id", "self", ".", "node", "=", "node", "self", ".", "timestamp", "=", "timestamp", "self", ".", "save", "(",...
https://github.com/privacyidea/privacyidea/blob/9490c12ddbf77a34ac935b082d09eb583dfafa2c/privacyidea/models.py#L2994-L3004
nltk/nltk_contrib
c9da2c29777ca9df650740145f1f4a375ccac961
nltk_contrib/mit/six863/semantics/logic.py
python
Parser.next
(self)
Parse the next complete expression from the stream and return it.
Parse the next complete expression from the stream and return it.
[ "Parse", "the", "next", "complete", "expression", "from", "the", "stream", "and", "return", "it", "." ]
def next(self): """Parse the next complete expression from the stream and return it.""" tok = self.token() if tok in [Parser.LAMBDA, Parser.SOME, Parser.ALL]: # Expression is a lambda expression: \x.M # or a some expression: some x.M if tok == Parser....
[ "def", "next", "(", "self", ")", ":", "tok", "=", "self", ".", "token", "(", ")", "if", "tok", "in", "[", "Parser", ".", "LAMBDA", ",", "Parser", ".", "SOME", ",", "Parser", ".", "ALL", "]", ":", "# Expression is a lambda expression: \\x.M", "# or a some...
https://github.com/nltk/nltk_contrib/blob/c9da2c29777ca9df650740145f1f4a375ccac961/nltk_contrib/mit/six863/semantics/logic.py#L657-L724
mcneel/rhinoscriptsyntax
c49bd0bf24c2513bdcb84d1bf307144489600fd9
Scripts/rhinoscript/surface.py
python
AddSrfPt
(points)
return rc
Creates a new surface from either 3 or 4 corner points. Parameters: points ([point, point, point, point]): list of either 3 or 4 corner points Returns: guid: The identifier of the new object if successful. None: if not successful, or on error. Example: import rhinoscriptsyntax as rs ...
Creates a new surface from either 3 or 4 corner points. Parameters: points ([point, point, point, point]): list of either 3 or 4 corner points Returns: guid: The identifier of the new object if successful. None: if not successful, or on error. Example: import rhinoscriptsyntax as rs ...
[ "Creates", "a", "new", "surface", "from", "either", "3", "or", "4", "corner", "points", ".", "Parameters", ":", "points", "(", "[", "point", "point", "point", "point", "]", ")", ":", "list", "of", "either", "3", "or", "4", "corner", "points", "Returns"...
def AddSrfPt(points): """Creates a new surface from either 3 or 4 corner points. Parameters: points ([point, point, point, point]): list of either 3 or 4 corner points Returns: guid: The identifier of the new object if successful. None: if not successful, or on error. Example: im...
[ "def", "AddSrfPt", "(", "points", ")", ":", "points", "=", "rhutil", ".", "coerce3dpointlist", "(", "points", ",", "True", ")", "surface", "=", "None", "if", "len", "(", "points", ")", "==", "3", ":", "surface", "=", "Rhino", ".", "Geometry", ".", "N...
https://github.com/mcneel/rhinoscriptsyntax/blob/c49bd0bf24c2513bdcb84d1bf307144489600fd9/Scripts/rhinoscript/surface.py#L648-L674
aewallin/openvoronoi
c4366904dc7ac40c189e95ebb014db7e4b137b86
python_examples/ttt/ttt_0_single_glyph.py
python
center
(segs, exts, tscale)
return out
translate segments so they are centered around (0,0)
translate segments so they are centered around (0,0)
[ "translate", "segments", "so", "they", "are", "centered", "around", "(", "0", "0", ")" ]
def center(segs, exts, tscale): """ translate segments so they are centered around (0,0) """ minx = tscale * exts.minx maxx = tscale * exts.maxx miny = tscale * exts.miny maxy = tscale * exts.maxy meanx = minx + 0.5 * (maxx - minx) meany = miny + 0.5 * (maxy - miny) out = translate(s...
[ "def", "center", "(", "segs", ",", "exts", ",", "tscale", ")", ":", "minx", "=", "tscale", "*", "exts", ".", "minx", "maxx", "=", "tscale", "*", "exts", ".", "maxx", "miny", "=", "tscale", "*", "exts", ".", "miny", "maxy", "=", "tscale", "*", "ex...
https://github.com/aewallin/openvoronoi/blob/c4366904dc7ac40c189e95ebb014db7e4b137b86/python_examples/ttt/ttt_0_single_glyph.py#L78-L88
yuxiaokui/Intranet-Penetration
f57678a204840c83cbf3308e3470ae56c5ff514b
proxy/XX-Net/code/default/python27/1.0/lib/runpy.py
python
_run_module_as_main
(mod_name, alter_argv=True)
return _run_code(code, main_globals, None, "__main__", fname, loader, pkg_name)
Runs the designated module in the __main__ namespace Note that the executed module will have full access to the __main__ namespace. If this is not desirable, the run_module() function should be used to run the module code in a fresh namespace. At the very least, these variables in __main__...
Runs the designated module in the __main__ namespace
[ "Runs", "the", "designated", "module", "in", "the", "__main__", "namespace" ]
def _run_module_as_main(mod_name, alter_argv=True): """Runs the designated module in the __main__ namespace Note that the executed module will have full access to the __main__ namespace. If this is not desirable, the run_module() function should be used to run the module code in a fresh namesp...
[ "def", "_run_module_as_main", "(", "mod_name", ",", "alter_argv", "=", "True", ")", ":", "try", ":", "if", "alter_argv", "or", "mod_name", "!=", "\"__main__\"", ":", "# i.e. -m switch", "mod_name", ",", "loader", ",", "code", ",", "fname", "=", "_get_module_de...
https://github.com/yuxiaokui/Intranet-Penetration/blob/f57678a204840c83cbf3308e3470ae56c5ff514b/proxy/XX-Net/code/default/python27/1.0/lib/runpy.py#L136-L162
ray-project/ray
703c1610348615dcb8c2d141a0c46675084660f5
rllib/policy/policy_template.py
python
build_policy_class
( name: str, framework: str, *, loss_fn: Optional[Callable[[ Policy, ModelV2, Type[TorchDistributionWrapper], SampleBatch ], Union[TensorType, List[TensorType]]]], get_default_config: Optional[Callable[[], TrainerConfigDict]] = None, stats_fn: Optional...
return policy_cls
Helper function for creating a new Policy class at runtime. Supports frameworks JAX and PyTorch. Args: name (str): name of the policy (e.g., "PPOTorchPolicy") framework (str): Either "jax" or "torch". loss_fn (Optional[Callable[[Policy, ModelV2, Type[TorchDistributionWrappe...
Helper function for creating a new Policy class at runtime.
[ "Helper", "function", "for", "creating", "a", "new", "Policy", "class", "at", "runtime", "." ]
def build_policy_class( name: str, framework: str, *, loss_fn: Optional[Callable[[ Policy, ModelV2, Type[TorchDistributionWrapper], SampleBatch ], Union[TensorType, List[TensorType]]]], get_default_config: Optional[Callable[[], TrainerConfigDict]] = None, ...
[ "def", "build_policy_class", "(", "name", ":", "str", ",", "framework", ":", "str", ",", "*", ",", "loss_fn", ":", "Optional", "[", "Callable", "[", "[", "Policy", ",", "ModelV2", ",", "Type", "[", "TorchDistributionWrapper", "]", ",", "SampleBatch", "]", ...
https://github.com/ray-project/ray/blob/703c1610348615dcb8c2d141a0c46675084660f5/rllib/policy/policy_template.py#L30-L406
TencentCloud/tencentcloud-sdk-python
3677fd1cdc8c5fd626ce001c13fd3b59d1f279d2
tencentcloud/cdn/v20180606/cdn_client.py
python
CdnClient.DescribeTopData
(self, request)
DescribeTopData 通过入参 Metric 和 Filter 组合不同,可以查询以下排序数据: + 依据总流量、总请求数对访问 IP 排序,从大至小返回 TOP 100 IP + 依据总流量、总请求数对访问 Refer 排序,从大至小返回 TOP 100 Refer + 依据总流量、总请求数对访问 设备 排序,从大至小返回 设备类型 + 依据总流量、总请求数对访问 操作系统 排序,从大至小返回 操作系统 + 依据总流量、总请求数对访问 浏览器 排序,从大至小返回 浏览器 注意: + 仅支持 90 天内数据查...
DescribeTopData 通过入参 Metric 和 Filter 组合不同,可以查询以下排序数据:
[ "DescribeTopData", "通过入参", "Metric", "和", "Filter", "组合不同,可以查询以下排序数据:" ]
def DescribeTopData(self, request): """DescribeTopData 通过入参 Metric 和 Filter 组合不同,可以查询以下排序数据: + 依据总流量、总请求数对访问 IP 排序,从大至小返回 TOP 100 IP + 依据总流量、总请求数对访问 Refer 排序,从大至小返回 TOP 100 Refer + 依据总流量、总请求数对访问 设备 排序,从大至小返回 设备类型 + 依据总流量、总请求数对访问 操作系统 排序,从大至小返回 操作系统 + 依据总流量、总请求数对访问 浏览器 排序...
[ "def", "DescribeTopData", "(", "self", ",", "request", ")", ":", "try", ":", "params", "=", "request", ".", "_serialize", "(", ")", "body", "=", "self", ".", "call", "(", "\"DescribeTopData\"", ",", "params", ")", "response", "=", "json", ".", "loads", ...
https://github.com/TencentCloud/tencentcloud-sdk-python/blob/3677fd1cdc8c5fd626ce001c13fd3b59d1f279d2/tencentcloud/cdn/v20180606/cdn_client.py#L1177-L1212
wxWidgets/Phoenix
b2199e299a6ca6d866aa6f3d0888499136ead9d6
wx/lib/ogl/basic.py
python
ShapeEvtHandler.OnDrawBranches
(self, dc, erase = False)
The draw branches handler.
The draw branches handler.
[ "The", "draw", "branches", "handler", "." ]
def OnDrawBranches(self, dc, erase = False): """The draw branches handler.""" if self._previousHandler: self._previousHandler.OnDrawBranches(dc, erase = erase)
[ "def", "OnDrawBranches", "(", "self", ",", "dc", ",", "erase", "=", "False", ")", ":", "if", "self", ".", "_previousHandler", ":", "self", ".", "_previousHandler", ".", "OnDrawBranches", "(", "dc", ",", "erase", "=", "erase", ")" ]
https://github.com/wxWidgets/Phoenix/blob/b2199e299a6ca6d866aa6f3d0888499136ead9d6/wx/lib/ogl/basic.py#L171-L174
google/turbinia
4559d4af9267762a8995cfc415099a80a22ee4d3
turbinia/workers/analysis/jupyter.py
python
JupyterAnalysisTask.run
(self, evidence, result)
return result
Run the Jupyter worker. Args: evidence (Evidence object): The evidence to process result (TurbiniaTaskResult): The object to place task results into. Returns: TurbiniaTaskResult object.
Run the Jupyter worker.
[ "Run", "the", "Jupyter", "worker", "." ]
def run(self, evidence, result): """Run the Jupyter worker. Args: evidence (Evidence object): The evidence to process result (TurbiniaTaskResult): The object to place task results into. Returns: TurbiniaTaskResult object. """ # Where to store the resulting output file. ...
[ "def", "run", "(", "self", ",", "evidence", ",", "result", ")", ":", "# Where to store the resulting output file.", "output_file_name", "=", "'jupyter_analysis.txt'", "output_file_path", "=", "os", ".", "path", ".", "join", "(", "self", ".", "output_dir", ",", "ou...
https://github.com/google/turbinia/blob/4559d4af9267762a8995cfc415099a80a22ee4d3/turbinia/workers/analysis/jupyter.py#L35-L72
hakril/PythonForWindows
61e027a678d5b87aa64fcf8a37a6661a86236589
windows/rpc/ndr.py
python
NdrConformantArray.unpack_conformant
(cls, stream, size)
return res
[]
def unpack_conformant(cls, stream, size): res = [cls.MEMBER_TYPE.unpack(stream) for i in range(size)] stream.align(4) return res
[ "def", "unpack_conformant", "(", "cls", ",", "stream", ",", "size", ")", ":", "res", "=", "[", "cls", ".", "MEMBER_TYPE", ".", "unpack", "(", "stream", ")", "for", "i", "in", "range", "(", "size", ")", "]", "stream", ".", "align", "(", "4", ")", ...
https://github.com/hakril/PythonForWindows/blob/61e027a678d5b87aa64fcf8a37a6661a86236589/windows/rpc/ndr.py#L451-L454
sahana/eden
1696fa50e90ce967df69f66b571af45356cc18da
controllers/xforms.py
python
uses_requirement
(requirement, field)
return False
Check if a given database field uses the specified requirement (IS_IN_SET, IS_INT_IN_RANGE, etc) @todo: deprecate
Check if a given database field uses the specified requirement (IS_IN_SET, IS_INT_IN_RANGE, etc)
[ "Check", "if", "a", "given", "database", "field", "uses", "the", "specified", "requirement", "(", "IS_IN_SET", "IS_INT_IN_RANGE", "etc", ")" ]
def uses_requirement(requirement, field): """ Check if a given database field uses the specified requirement (IS_IN_SET, IS_INT_IN_RANGE, etc) @todo: deprecate """ if hasattr(field.requires, "other") or requirement in str(field.requires): if hasattr(field.requires, "other")...
[ "def", "uses_requirement", "(", "requirement", ",", "field", ")", ":", "if", "hasattr", "(", "field", ".", "requires", ",", "\"other\"", ")", "or", "requirement", "in", "str", "(", "field", ".", "requires", ")", ":", "if", "hasattr", "(", "field", ".", ...
https://github.com/sahana/eden/blob/1696fa50e90ce967df69f66b571af45356cc18da/controllers/xforms.py#L122-L136
autorope/donkeycar
a3df79a3573127dff31fc9b2953588056875b214
donkeycar/utils.py
python
map_range
(x, X_min, X_max, Y_min, Y_max)
return int(y)
Linear mapping between two ranges of values
Linear mapping between two ranges of values
[ "Linear", "mapping", "between", "two", "ranges", "of", "values" ]
def map_range(x, X_min, X_max, Y_min, Y_max): ''' Linear mapping between two ranges of values ''' X_range = X_max - X_min Y_range = Y_max - Y_min XY_ratio = X_range/Y_range y = ((x-X_min) / XY_ratio + Y_min) // 1 return int(y)
[ "def", "map_range", "(", "x", ",", "X_min", ",", "X_max", ",", "Y_min", ",", "Y_max", ")", ":", "X_range", "=", "X_max", "-", "X_min", "Y_range", "=", "Y_max", "-", "Y_min", "XY_ratio", "=", "X_range", "/", "Y_range", "y", "=", "(", "(", "x", "-", ...
https://github.com/autorope/donkeycar/blob/a3df79a3573127dff31fc9b2953588056875b214/donkeycar/utils.py#L284-L294
securesystemslab/zippy
ff0e84ac99442c2c55fe1d285332cfd4e185e089
zippy/lib-python/3/tkinter/__init__.py
python
Wm.wm_withdraw
(self)
return self.tk.call('wm', 'withdraw', self._w)
Withdraw this widget from the screen such that it is unmapped and forgotten by the window manager. Re-draw it with wm_deiconify.
Withdraw this widget from the screen such that it is unmapped and forgotten by the window manager. Re-draw it with wm_deiconify.
[ "Withdraw", "this", "widget", "from", "the", "screen", "such", "that", "it", "is", "unmapped", "and", "forgotten", "by", "the", "window", "manager", ".", "Re", "-", "draw", "it", "with", "wm_deiconify", "." ]
def wm_withdraw(self): """Withdraw this widget from the screen such that it is unmapped and forgotten by the window manager. Re-draw it with wm_deiconify.""" return self.tk.call('wm', 'withdraw', self._w)
[ "def", "wm_withdraw", "(", "self", ")", ":", "return", "self", ".", "tk", ".", "call", "(", "'wm'", ",", "'withdraw'", ",", "self", ".", "_w", ")" ]
https://github.com/securesystemslab/zippy/blob/ff0e84ac99442c2c55fe1d285332cfd4e185e089/zippy/lib-python/3/tkinter/__init__.py#L1643-L1646
Azure/azure-linux-extensions
a42ef718c746abab2b3c6a21da87b29e76364558
Common/libpsutil/py2.7-glibc-2.12+/psutil/__init__.py
python
test
()
List info of all currently running processes emulating ps aux output.
List info of all currently running processes emulating ps aux output.
[ "List", "info", "of", "all", "currently", "running", "processes", "emulating", "ps", "aux", "output", "." ]
def test(): """List info of all currently running processes emulating ps aux output. """ import datetime today_day = datetime.date.today() templ = "%-10s %5s %4s %4s %7s %7s %-13s %5s %7s %s" attrs = ['pid', 'cpu_percent', 'memory_percent', 'name', 'cpu_times', 'create_time', ...
[ "def", "test", "(", ")", ":", "import", "datetime", "today_day", "=", "datetime", ".", "date", ".", "today", "(", ")", "templ", "=", "\"%-10s %5s %4s %4s %7s %7s %-13s %5s %7s %s\"", "attrs", "=", "[", "'pid'", ",", "'cpu_percent'", ",", "'memory_percent'", ","...
https://github.com/Azure/azure-linux-extensions/blob/a42ef718c746abab2b3c6a21da87b29e76364558/Common/libpsutil/py2.7-glibc-2.12+/psutil/__init__.py#L1909-L1970
sk1712/gcn_metric_learning
50abd52bcd29d2d1ccfc27cbffe71b91c0629c7e
lib/models_siamese.py
python
base_model._bias_variable
(self, shape, regularization=True)
return var
[]
def _bias_variable(self, shape, regularization=True): # initial = tf.constant_initializer(0.1) initial = tf.constant_initializer(0.0) var = tf.get_variable('bias', shape, tf.float32, initializer=initial) if regularization: self.regularizers.append(tf.nn.l2_loss(var)) ...
[ "def", "_bias_variable", "(", "self", ",", "shape", ",", "regularization", "=", "True", ")", ":", "# initial = tf.constant_initializer(0.1)", "initial", "=", "tf", ".", "constant_initializer", "(", "0.0", ")", "var", "=", "tf", ".", "get_variable", "(", "'bias'"...
https://github.com/sk1712/gcn_metric_learning/blob/50abd52bcd29d2d1ccfc27cbffe71b91c0629c7e/lib/models_siamese.py#L312-L320
securesystemslab/zippy
ff0e84ac99442c2c55fe1d285332cfd4e185e089
zippy/lib-python/3/plat-sunos5/STROPTS.py
python
RW_LOCK_HELD
(x)
return (rw_lock_held((x)))
[]
def RW_LOCK_HELD(x): return (rw_lock_held((x)))
[ "def", "RW_LOCK_HELD", "(", "x", ")", ":", "return", "(", "rw_lock_held", "(", "(", "x", ")", ")", ")" ]
https://github.com/securesystemslab/zippy/blob/ff0e84ac99442c2c55fe1d285332cfd4e185e089/zippy/lib-python/3/plat-sunos5/STROPTS.py#L337-L337
bpython/bpython
189da3ecbaa30212b8ba73aeb321b6a6a324348b
bpython/repl.py
python
Interpreter.showtraceback
(self)
This needs to override the default traceback thing so it can put it into a pretty colour and maybe other stuff, I don't know
This needs to override the default traceback thing so it can put it into a pretty colour and maybe other stuff, I don't know
[ "This", "needs", "to", "override", "the", "default", "traceback", "thing", "so", "it", "can", "put", "it", "into", "a", "pretty", "colour", "and", "maybe", "other", "stuff", "I", "don", "t", "know" ]
def showtraceback(self): """This needs to override the default traceback thing so it can put it into a pretty colour and maybe other stuff, I don't know""" try: t, v, tb = sys.exc_info() sys.last_type = t sys.last_value = v sys.last_traceba...
[ "def", "showtraceback", "(", "self", ")", ":", "try", ":", "t", ",", "v", ",", "tb", "=", "sys", ".", "exc_info", "(", ")", "sys", ".", "last_type", "=", "t", "sys", ".", "last_value", "=", "v", "sys", ".", "last_traceback", "=", "tb", "tblist", ...
https://github.com/bpython/bpython/blob/189da3ecbaa30212b8ba73aeb321b6a6a324348b/bpython/repl.py#L186-L211
projecthamster/hamster
19d160090de30e756bdc3122ff935bdaa86e2843
waflib/Runner.py
python
Parallel.skip
(self, tsk)
Mark a task as skipped/up-to-date
Mark a task as skipped/up-to-date
[ "Mark", "a", "task", "as", "skipped", "/", "up", "-", "to", "-", "date" ]
def skip(self, tsk): """ Mark a task as skipped/up-to-date """ tsk.hasrun = Task.SKIPPED self.mark_finished(tsk)
[ "def", "skip", "(", "self", ",", "tsk", ")", ":", "tsk", ".", "hasrun", "=", "Task", ".", "SKIPPED", "self", ".", "mark_finished", "(", "tsk", ")" ]
https://github.com/projecthamster/hamster/blob/19d160090de30e756bdc3122ff935bdaa86e2843/waflib/Runner.py#L405-L410
mrahtz/learning-from-human-preferences
3fca07c4c3fd20bec307f4405684461437d9e215
a2c/common/schedules.py
python
ConstantSchedule.value
(self, t)
return self._v
See Schedule.value
See Schedule.value
[ "See", "Schedule", ".", "value" ]
def value(self, t): """See Schedule.value""" return self._v
[ "def", "value", "(", "self", ",", "t", ")", ":", "return", "self", ".", "_v" ]
https://github.com/mrahtz/learning-from-human-preferences/blob/3fca07c4c3fd20bec307f4405684461437d9e215/a2c/common/schedules.py#L29-L31
zhl2008/awd-platform
0416b31abea29743387b10b3914581fbe8e7da5e
web_flaskbb/lib/python2.7/site-packages/whoosh/automata/fsa.py
python
FSA.get_labels
(self, src)
return iter(self.transitions.get(src, []))
[]
def get_labels(self, src): return iter(self.transitions.get(src, []))
[ "def", "get_labels", "(", "self", ",", "src", ")", ":", "return", "iter", "(", "self", ".", "transitions", ".", "get", "(", "src", ",", "[", "]", ")", ")" ]
https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_flaskbb/lib/python2.7/site-packages/whoosh/automata/fsa.py#L66-L67
holzschu/Carnets
44effb10ddfc6aa5c8b0687582a724ba82c6b547
Library/lib/python3.7/site-packages/matplotlib-3.0.3-py3.7-macosx-10.9-x86_64.egg/matplotlib/afm.py
python
AFM.get_vertical_stem_width
(self)
return self._header.get(b'StdVW', None)
Return the standard vertical stem width as float, or *None* if not specified in AFM file.
Return the standard vertical stem width as float, or *None* if not specified in AFM file.
[ "Return", "the", "standard", "vertical", "stem", "width", "as", "float", "or", "*", "None", "*", "if", "not", "specified", "in", "AFM", "file", "." ]
def get_vertical_stem_width(self): """ Return the standard vertical stem width as float, or *None* if not specified in AFM file. """ return self._header.get(b'StdVW', None)
[ "def", "get_vertical_stem_width", "(", "self", ")", ":", "return", "self", ".", "_header", ".", "get", "(", "b'StdVW'", ",", "None", ")" ]
https://github.com/holzschu/Carnets/blob/44effb10ddfc6aa5c8b0687582a724ba82c6b547/Library/lib/python3.7/site-packages/matplotlib-3.0.3-py3.7-macosx-10.9-x86_64.egg/matplotlib/afm.py#L557-L562
MillionIntegrals/vel
f3ce7da64362ad207f40f2c0d58d9300a25df3e8
vel/rl/env_roller/transition_replay_env_roller.py
python
TransitionReplayEnvRoller.rollout
(self, batch_info: BatchInfo, model: RlModel, number_of_steps: int)
return Trajectories( num_steps=accumulated_tensors['observations'].size(0), num_envs=accumulated_tensors['observations'].size(1), environment_information=episode_information, transition_tensors=accumulated_tensors, rollout_tensors={} ).to_transitions()
Calculate env rollout
Calculate env rollout
[ "Calculate", "env", "rollout" ]
def rollout(self, batch_info: BatchInfo, model: RlModel, number_of_steps: int) -> Rollout: """ Calculate env rollout """ assert not model.is_recurrent, "Replay env roller does not support recurrent models" accumulator = TensorAccumulator() episode_information = [] # List of dictionarie...
[ "def", "rollout", "(", "self", ",", "batch_info", ":", "BatchInfo", ",", "model", ":", "RlModel", ",", "number_of_steps", ":", "int", ")", "->", "Rollout", ":", "assert", "not", "model", ".", "is_recurrent", ",", "\"Replay env roller does not support recurrent mod...
https://github.com/MillionIntegrals/vel/blob/f3ce7da64362ad207f40f2c0d58d9300a25df3e8/vel/rl/env_roller/transition_replay_env_roller.py#L55-L124
pretix/pretix
96f694cf61345f54132cd26cdeb07d5d11b34232
src/pretix/base/shredder.py
python
BaseDataShredder.require_download_confirmation
(self)
return self.tax_relevant
Indicates whether the data of this shredder needs to be downloaded, before it is actually shredded. By default this value is equal to the tax relevant flag.
Indicates whether the data of this shredder needs to be downloaded, before it is actually shredded. By default this value is equal to the tax relevant flag.
[ "Indicates", "whether", "the", "data", "of", "this", "shredder", "needs", "to", "be", "downloaded", "before", "it", "is", "actually", "shredded", ".", "By", "default", "this", "value", "is", "equal", "to", "the", "tax", "relevant", "flag", "." ]
def require_download_confirmation(self): """ Indicates whether the data of this shredder needs to be downloaded, before it is actually shredded. By default this value is equal to the tax relevant flag. """ return self.tax_relevant
[ "def", "require_download_confirmation", "(", "self", ")", ":", "return", "self", ".", "tax_relevant" ]
https://github.com/pretix/pretix/blob/96f694cf61345f54132cd26cdeb07d5d11b34232/src/pretix/base/shredder.py#L121-L126
dimagi/commcare-hq
d67ff1d3b4c51fa050c19e60c3253a79d3452a39
corehq/util/models.py
python
ForeignValue.__set_name__
(self, owner, name)
[]
def __set_name__(self, owner, name): other_names = getattr(owner, "_ForeignValue_names", []) owner._ForeignValue_names = other_names + [name]
[ "def", "__set_name__", "(", "self", ",", "owner", ",", "name", ")", ":", "other_names", "=", "getattr", "(", "owner", ",", "\"_ForeignValue_names\"", ",", "[", "]", ")", "owner", ".", "_ForeignValue_names", "=", "other_names", "+", "[", "name", "]" ]
https://github.com/dimagi/commcare-hq/blob/d67ff1d3b4c51fa050c19e60c3253a79d3452a39/corehq/util/models.py#L286-L288
ternaus/kaggle_dstl_submission
7de6ebad72d0fa3b0756ce67f9d7b5ea3e60b33a
src/visualize.py
python
plot_polygons
(fig, ax, polygonsList)
return legend_patches
Plot descrates.PolygonPatch from list of polygons objs for each CLASS
Plot descrates.PolygonPatch from list of polygons objs for each CLASS
[ "Plot", "descrates", ".", "PolygonPatch", "from", "list", "of", "polygons", "objs", "for", "each", "CLASS" ]
def plot_polygons(fig, ax, polygonsList): ''' Plot descrates.PolygonPatch from list of polygons objs for each CLASS ''' legend_patches = [] for cType in polygonsList: print('{} : {} \tcount = {}'.format(cType, CLASSES[cType], len(polygonsList[cType]))) legend_patches.append(Patch(col...
[ "def", "plot_polygons", "(", "fig", ",", "ax", ",", "polygonsList", ")", ":", "legend_patches", "=", "[", "]", "for", "cType", "in", "polygonsList", ":", "print", "(", "'{} : {} \\tcount = {}'", ".", "format", "(", "cType", ",", "CLASSES", "[", "cType", "]...
https://github.com/ternaus/kaggle_dstl_submission/blob/7de6ebad72d0fa3b0756ce67f9d7b5ea3e60b33a/src/visualize.py#L171-L192
home-assistant/core
265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1
homeassistant/components/litterrobot/switch.py
python
LitterRobotPanelLockoutSwitch.icon
(self)
return "mdi:lock" if self.is_on else "mdi:lock-open"
Return the icon.
Return the icon.
[ "Return", "the", "icon", "." ]
def icon(self) -> str: """Return the icon.""" return "mdi:lock" if self.is_on else "mdi:lock-open"
[ "def", "icon", "(", "self", ")", "->", "str", ":", "return", "\"mdi:lock\"", "if", "self", ".", "is_on", "else", "\"mdi:lock-open\"" ]
https://github.com/home-assistant/core/blob/265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1/homeassistant/components/litterrobot/switch.py#L51-L53
Thriftpy/thriftpy2
8755065bdd3a51b55cbab488fe628027f2c060db
thriftpy2/parser/parser.py
python
p_const
(p)
const : CONST field_type IDENTIFIER '=' const_value | CONST field_type IDENTIFIER '=' const_value sep
const : CONST field_type IDENTIFIER '=' const_value | CONST field_type IDENTIFIER '=' const_value sep
[ "const", ":", "CONST", "field_type", "IDENTIFIER", "=", "const_value", "|", "CONST", "field_type", "IDENTIFIER", "=", "const_value", "sep" ]
def p_const(p): '''const : CONST field_type IDENTIFIER '=' const_value | CONST field_type IDENTIFIER '=' const_value sep''' try: val = _cast(p[2], p.lineno(3))(p[5]) except AssertionError: raise ThriftParserError('Type error for constant %s at line %d' % ...
[ "def", "p_const", "(", "p", ")", ":", "try", ":", "val", "=", "_cast", "(", "p", "[", "2", "]", ",", "p", ".", "lineno", "(", "3", ")", ")", "(", "p", "[", "5", "]", ")", "except", "AssertionError", ":", "raise", "ThriftParserError", "(", "'Typ...
https://github.com/Thriftpy/thriftpy2/blob/8755065bdd3a51b55cbab488fe628027f2c060db/thriftpy2/parser/parser.py#L106-L116
david-abel/simple_rl
d8fe6007efb4840377f085a4e35ba89aaa2cdf6d
simple_rl/abstraction/state_abs/indicator_funcs.py
python
_q_eps_approx_indicator
(state_x, state_y, vi, actions, epsilon=0.0)
return True
Args: state_x (State) state_y (State) vi (ValueIteration) actions (list) Returns: (bool): true iff: max |Q(state_x,a) - Q(state_y, a)| <= epsilon
Args: state_x (State) state_y (State) vi (ValueIteration) actions (list)
[ "Args", ":", "state_x", "(", "State", ")", "state_y", "(", "State", ")", "vi", "(", "ValueIteration", ")", "actions", "(", "list", ")" ]
def _q_eps_approx_indicator(state_x, state_y, vi, actions, epsilon=0.0): ''' Args: state_x (State) state_y (State) vi (ValueIteration) actions (list) Returns: (bool): true iff: max |Q(state_x,a) - Q(state_y, a)| <= epsilon ''' for a in actions: ...
[ "def", "_q_eps_approx_indicator", "(", "state_x", ",", "state_y", ",", "vi", ",", "actions", ",", "epsilon", "=", "0.0", ")", ":", "for", "a", "in", "actions", ":", "q_x", "=", "vi", ".", "get_q_value", "(", "state_x", ",", "a", ")", "q_y", "=", "vi"...
https://github.com/david-abel/simple_rl/blob/d8fe6007efb4840377f085a4e35ba89aaa2cdf6d/simple_rl/abstraction/state_abs/indicator_funcs.py#L47-L66
securesystemslab/zippy
ff0e84ac99442c2c55fe1d285332cfd4e185e089
zippy/benchmarks/src/benchmarks/whoosh/src/whoosh/fields.py
python
NUMERIC.__setstate__
(self, d)
[]
def __setstate__(self, d): self.__dict__.update(d) self._struct = struct.Struct(">" + self.sortable_typecode) if "min_value" not in d: d["min_value"], d["max_value"] = self._min_max()
[ "def", "__setstate__", "(", "self", ",", "d", ")", ":", "self", ".", "__dict__", ".", "update", "(", "d", ")", "self", ".", "_struct", "=", "struct", ".", "Struct", "(", "\">\"", "+", "self", ".", "sortable_typecode", ")", "if", "\"min_value\"", "not",...
https://github.com/securesystemslab/zippy/blob/ff0e84ac99442c2c55fe1d285332cfd4e185e089/zippy/benchmarks/src/benchmarks/whoosh/src/whoosh/fields.py#L516-L520
bnpy/bnpy
d5b311e8f58ccd98477f4a0c8a4d4982e3fca424
bnpy/learnalg/zzzdeprecated/ParallelMOVBAlg.py
python
ParallelMOVBAlg.memoizedSummaryStep
(self, hmodel, SS, SSchunk, batchID)
return SS
Execute summary step on current batch and update aggregated SS. Returns -------- SS : updated aggregate suff stats
Execute summary step on current batch and update aggregated SS.
[ "Execute", "summary", "step", "on", "current", "batch", "and", "update", "aggregated", "SS", "." ]
def memoizedSummaryStep(self, hmodel, SS, SSchunk, batchID): ''' Execute summary step on current batch and update aggregated SS. Returns -------- SS : updated aggregate suff stats ''' if batchID in self.SSmemory: oldSSchunk = self.load_batch_suff_stat_from_me...
[ "def", "memoizedSummaryStep", "(", "self", ",", "hmodel", ",", "SS", ",", "SSchunk", ",", "batchID", ")", ":", "if", "batchID", "in", "self", ".", "SSmemory", ":", "oldSSchunk", "=", "self", ".", "load_batch_suff_stat_from_memory", "(", "batchID", ")", "asse...
https://github.com/bnpy/bnpy/blob/d5b311e8f58ccd98477f4a0c8a4d4982e3fca424/bnpy/learnalg/zzzdeprecated/ParallelMOVBAlg.py#L160-L184
dragonfly/dragonfly
a579b5eadf452e23b07d4caf27b402703b0012b7
dragonfly/nn/nn_domains.py
python
neural_nets_are_equal
(net1, net2)
return is_true
Returns true if both net1 and net2 are equal.
Returns true if both net1 and net2 are equal.
[ "Returns", "true", "if", "both", "net1", "and", "net2", "are", "equal", "." ]
def neural_nets_are_equal(net1, net2): """ Returns true if both net1 and net2 are equal. """ is_true = True for key in net1.__dict__.keys(): val1 = net1.__dict__[key] val2 = net2.__dict__[key] is_true = True if isinstance(val1, dict): for val_key in val1.keys(): is_true = is_true a...
[ "def", "neural_nets_are_equal", "(", "net1", ",", "net2", ")", ":", "is_true", "=", "True", "for", "key", "in", "net1", ".", "__dict__", ".", "keys", "(", ")", ":", "val1", "=", "net1", ".", "__dict__", "[", "key", "]", "val2", "=", "net2", ".", "_...
https://github.com/dragonfly/dragonfly/blob/a579b5eadf452e23b07d4caf27b402703b0012b7/dragonfly/nn/nn_domains.py#L172-L189
mcahny/vps
138503edbc9e70de744dc0c9fa4b71c799a94d5d
mmdet/models/flow_modules/flow_modules.py
python
conv
(in_planes, out_planes, kernel_size=3, stride=1, dilation=1)
return nn.Sequential( nn.Conv2d(in_planes, out_planes, kernel_size=kernel_size, stride=stride, dilation=dilation, padding=((kernel_size - 1) * dilation) // 2, bias=True), nn.LeakyReLU(0.1, inplace=True))
[]
def conv(in_planes, out_planes, kernel_size=3, stride=1, dilation=1): return nn.Sequential( nn.Conv2d(in_planes, out_planes, kernel_size=kernel_size, stride=stride, dilation=dilation, padding=((kernel_size - 1) * dilation) // 2, bias=True), ...
[ "def", "conv", "(", "in_planes", ",", "out_planes", ",", "kernel_size", "=", "3", ",", "stride", "=", "1", ",", "dilation", "=", "1", ")", ":", "return", "nn", ".", "Sequential", "(", "nn", ".", "Conv2d", "(", "in_planes", ",", "out_planes", ",", "ke...
https://github.com/mcahny/vps/blob/138503edbc9e70de744dc0c9fa4b71c799a94d5d/mmdet/models/flow_modules/flow_modules.py#L29-L34
Bitmessage/PyBitmessage
97612b049e0453867d6d90aa628f8e7b007b4d85
src/bitmessageqt/foldertree.py
python
AddressBookCompleter.pathFromIndex
(self, index)
return part1 + autoString + part2
Perform autocompletion (reimplemented QCompleter method)
Perform autocompletion (reimplemented QCompleter method)
[ "Perform", "autocompletion", "(", "reimplemented", "QCompleter", "method", ")" ]
def pathFromIndex(self, index): """Perform autocompletion (reimplemented QCompleter method)""" autoString = unicode( index.data(QtCore.Qt.EditRole).toString().toUtf8(), 'utf-8') text = unicode(self.widget().text().toUtf8(), 'utf-8') # If cursor position was saved, restore it...
[ "def", "pathFromIndex", "(", "self", ",", "index", ")", ":", "autoString", "=", "unicode", "(", "index", ".", "data", "(", "QtCore", ".", "Qt", ".", "EditRole", ")", ".", "toString", "(", ")", ".", "toUtf8", "(", ")", ",", "'utf-8'", ")", "text", "...
https://github.com/Bitmessage/PyBitmessage/blob/97612b049e0453867d6d90aa628f8e7b007b4d85/src/bitmessageqt/foldertree.py#L590-L627
jacoxu/encoder_decoder
6829c3bc42105aedfd1b8a81c81be19df4326c0a
keras/backend/theano_backend.py
python
batch_flatten
(x)
return x
Turn a n-D tensor into a 2D tensor where the first dimension is conserved.
Turn a n-D tensor into a 2D tensor where the first dimension is conserved.
[ "Turn", "a", "n", "-", "D", "tensor", "into", "a", "2D", "tensor", "where", "the", "first", "dimension", "is", "conserved", "." ]
def batch_flatten(x): '''Turn a n-D tensor into a 2D tensor where the first dimension is conserved. ''' x = T.reshape(x, (x.shape[0], T.prod(x.shape) // x.shape[0])) return x
[ "def", "batch_flatten", "(", "x", ")", ":", "x", "=", "T", ".", "reshape", "(", "x", ",", "(", "x", ".", "shape", "[", "0", "]", ",", "T", ".", "prod", "(", "x", ".", "shape", ")", "//", "x", ".", "shape", "[", "0", "]", ")", ")", "return...
https://github.com/jacoxu/encoder_decoder/blob/6829c3bc42105aedfd1b8a81c81be19df4326c0a/keras/backend/theano_backend.py#L310-L315
openstack/sahara
c4f4d29847d5bcca83d49ef7e9a3378458462a79
sahara/api/middleware/version_discovery.py
python
VersionResponseMiddlewareV1._get_versions
(self, req)
return version_response
Populate the version response with APIv1 stuff.
Populate the version response with APIv1 stuff.
[ "Populate", "the", "version", "response", "with", "APIv1", "stuff", "." ]
def _get_versions(self, req): """Populate the version response with APIv1 stuff.""" version_response = { "versions": [ {"id": "v1.0", "status": "SUPPORTED", "links": self._get_links("1.0", req) }, {"id": "v1.1...
[ "def", "_get_versions", "(", "self", ",", "req", ")", ":", "version_response", "=", "{", "\"versions\"", ":", "[", "{", "\"id\"", ":", "\"v1.0\"", ",", "\"status\"", ":", "\"SUPPORTED\"", ",", "\"links\"", ":", "self", ".", "_get_links", "(", "\"1.0\"", ",...
https://github.com/openstack/sahara/blob/c4f4d29847d5bcca83d49ef7e9a3378458462a79/sahara/api/middleware/version_discovery.py#L40-L54
securesystemslab/zippy
ff0e84ac99442c2c55fe1d285332cfd4e185e089
zippy/lib-python/3/xml/dom/pulldom.py
python
DOMEventStream.__next__
(self)
[]
def __next__(self): rc = self.getEvent() if rc: return rc raise StopIteration
[ "def", "__next__", "(", "self", ")", ":", "rc", "=", "self", ".", "getEvent", "(", ")", "if", "rc", ":", "return", "rc", "raise", "StopIteration" ]
https://github.com/securesystemslab/zippy/blob/ff0e84ac99442c2c55fe1d285332cfd4e185e089/zippy/lib-python/3/xml/dom/pulldom.py#L226-L230
cms-dev/cms
0401c5336b34b1731736045da4877fef11889274
cms/db/fsobject.py
python
FSObject.delete
(self)
Delete this file.
Delete this file.
[ "Delete", "this", "file", "." ]
def delete(self): """Delete this file. """ LargeObject.unlink(self.loid) self.sa_session.delete(self)
[ "def", "delete", "(", "self", ")", ":", "LargeObject", ".", "unlink", "(", "self", ".", "loid", ")", "self", ".", "sa_session", ".", "delete", "(", "self", ")" ]
https://github.com/cms-dev/cms/blob/0401c5336b34b1731736045da4877fef11889274/cms/db/fsobject.py#L394-L399
triaquae/triaquae
bbabf736b3ba56a0c6498e7f04e16c13b8b8f2b9
TriAquae/models/Centos_6.4/paramiko/sftp_file.py
python
SFTPFile._prefetch_thread
(self, chunks)
[]
def _prefetch_thread(self, chunks): # do these read requests in a temporary thread because there may be # a lot of them, so it may block. for offset, length in chunks: self.sftp._async_request(self, CMD_READ, self.handle, long(offset), int(length))
[ "def", "_prefetch_thread", "(", "self", ",", "chunks", ")", ":", "# do these read requests in a temporary thread because there may be", "# a lot of them, so it may block.", "for", "offset", ",", "length", "in", "chunks", ":", "self", ".", "sftp", ".", "_async_request", "(...
https://github.com/triaquae/triaquae/blob/bbabf736b3ba56a0c6498e7f04e16c13b8b8f2b9/TriAquae/models/Centos_6.4/paramiko/sftp_file.py#L456-L460
JosephLai241/URS
9f8cf3a3adb9aa5079dfc7bfd7832b53358ee40f
urs/praw_scrapers/static_scrapers/Redditor.py
python
GetInteractions.get
(limit, reddit, redditor)
return skeleton
Get Redditor information and interactions. Calls previously defined private methods: GetInteractions._make_json_skeleton() GetInteractions._get_user_info() GetInteractions._get_user_interactions() Parameters ---------- limit: str String ...
Get Redditor information and interactions.
[ "Get", "Redditor", "information", "and", "interactions", "." ]
def get(limit, reddit, redditor): """ Get Redditor information and interactions. Calls previously defined private methods: GetInteractions._make_json_skeleton() GetInteractions._get_user_info() GetInteractions._get_user_interactions() Parameters ...
[ "def", "get", "(", "limit", ",", "reddit", ",", "redditor", ")", ":", "redditor", ",", "skeleton", "=", "GetInteractions", ".", "_make_json_skeleton", "(", "limit", ",", "reddit", ",", "redditor", ")", "GetInteractions", ".", "_get_user_info", "(", "redditor",...
https://github.com/JosephLai241/URS/blob/9f8cf3a3adb9aa5079dfc7bfd7832b53358ee40f/urs/praw_scrapers/static_scrapers/Redditor.py#L485-L512
ganeti/ganeti
d340a9ddd12f501bef57da421b5f9b969a4ba905
lib/server/noded.py
python
NodeRequestHandler.perspective_bdev_sizes
(params)
return backend.GetBlockDevSizes(devices)
Query the list of block devices
Query the list of block devices
[ "Query", "the", "list", "of", "block", "devices" ]
def perspective_bdev_sizes(params): """Query the list of block devices """ devices = params[0] return backend.GetBlockDevSizes(devices)
[ "def", "perspective_bdev_sizes", "(", "params", ")", ":", "devices", "=", "params", "[", "0", "]", "return", "backend", ".", "GetBlockDevSizes", "(", "devices", ")" ]
https://github.com/ganeti/ganeti/blob/d340a9ddd12f501bef57da421b5f9b969a4ba905/lib/server/noded.py#L544-L549
madengr/ham2mon
db9834ce923c1919602bf33cb47720daba9bc6ea
apps/ham2mon.py
python
main
(screen)
Start scanner with GUI interface Initialize and set up screen Create windows Create scanner object Executes scan cycles Update windows Process keyboard strokes
Start scanner with GUI interface
[ "Start", "scanner", "with", "GUI", "interface" ]
def main(screen): """Start scanner with GUI interface Initialize and set up screen Create windows Create scanner object Executes scan cycles Update windows Process keyboard strokes """ # pylint: disable=too-many-statements # pylint: disable-msg=R0914 # Use the curses.wrappe...
[ "def", "main", "(", "screen", ")", ":", "# pylint: disable=too-many-statements", "# pylint: disable-msg=R0914", "# Use the curses.wrapper() to crash cleanly", "# Note the screen object is passed from the wrapper()", "# http://stackoverflow.com/questions/9854511/python-curses-dilemma", "# The i...
https://github.com/madengr/ham2mon/blob/db9834ce923c1919602bf33cb47720daba9bc6ea/apps/ham2mon.py#L15-L137
SteveDoyle2/pyNastran
eda651ac2d4883d95a34951f8a002ff94f642a1a
pyNastran/bdf/cards/optimization.py
python
DVPREL2._verify
(self, xref)
Verifies all methods for this object work Parameters ---------- xref : bool has this model been cross referenced
Verifies all methods for this object work
[ "Verifies", "all", "methods", "for", "this", "object", "work" ]
def _verify(self, xref): """ Verifies all methods for this object work Parameters ---------- xref : bool has this model been cross referenced """ pass
[ "def", "_verify", "(", "self", ",", "xref", ")", ":", "pass" ]
https://github.com/SteveDoyle2/pyNastran/blob/eda651ac2d4883d95a34951f8a002ff94f642a1a/pyNastran/bdf/cards/optimization.py#L5233-L5243
google/pyringe
76dff5d1ac29cd5e7bf32677654a83291a15ad8a
pyringe/payload/libpython.py
python
PyCodeObjectPtr.addr2line
(self, addrq)
return lineno
Get the line number for a given bytecode offset Analogous to PyCode_Addr2Line; translated from pseudocode in Objects/lnotab_notes.txt
Get the line number for a given bytecode offset
[ "Get", "the", "line", "number", "for", "a", "given", "bytecode", "offset" ]
def addr2line(self, addrq): ''' Get the line number for a given bytecode offset Analogous to PyCode_Addr2Line; translated from pseudocode in Objects/lnotab_notes.txt ''' co_lnotab = self.pyop_field('co_lnotab').proxyval(set()) # Initialize lineno to co_firstline...
[ "def", "addr2line", "(", "self", ",", "addrq", ")", ":", "co_lnotab", "=", "self", ".", "pyop_field", "(", "'co_lnotab'", ")", ".", "proxyval", "(", "set", "(", ")", ")", "# Initialize lineno to co_firstlineno as per PyCode_Addr2Line", "# not 0, as lnotab_notes.txt ha...
https://github.com/google/pyringe/blob/76dff5d1ac29cd5e7bf32677654a83291a15ad8a/pyringe/payload/libpython.py#L592-L611
pyparallel/pyparallel
11e8c6072d48c8f13641925d17b147bf36ee0ba3
Lib/site-packages/pip-7.1.2-py3.3.egg/pip/_vendor/requests/packages/urllib3/packages/ordered_dict.py
python
OrderedDict.__init__
(self, *args, **kwds)
Initialize an ordered dictionary. Signature is the same as for regular dictionaries, but keyword arguments are not recommended because their insertion order is arbitrary.
Initialize an ordered dictionary. Signature is the same as for regular dictionaries, but keyword arguments are not recommended because their insertion order is arbitrary.
[ "Initialize", "an", "ordered", "dictionary", ".", "Signature", "is", "the", "same", "as", "for", "regular", "dictionaries", "but", "keyword", "arguments", "are", "not", "recommended", "because", "their", "insertion", "order", "is", "arbitrary", "." ]
def __init__(self, *args, **kwds): '''Initialize an ordered dictionary. Signature is the same as for regular dictionaries, but keyword arguments are not recommended because their insertion order is arbitrary. ''' if len(args) > 1: raise TypeError('expected at most 1...
[ "def", "__init__", "(", "self", ",", "*", "args", ",", "*", "*", "kwds", ")", ":", "if", "len", "(", "args", ")", ">", "1", ":", "raise", "TypeError", "(", "'expected at most 1 arguments, got %d'", "%", "len", "(", "args", ")", ")", "try", ":", "self...
https://github.com/pyparallel/pyparallel/blob/11e8c6072d48c8f13641925d17b147bf36ee0ba3/Lib/site-packages/pip-7.1.2-py3.3.egg/pip/_vendor/requests/packages/urllib3/packages/ordered_dict.py#L28-L42
TencentCloud/tencentcloud-sdk-python
3677fd1cdc8c5fd626ce001c13fd3b59d1f279d2
tencentcloud/ecm/v20190719/models.py
python
DescribePeakNetworkOverviewResponse.__init__
(self)
r""" :param PeakNetworkRegionSet: 网络峰值数组。 注意:此字段可能返回 null,表示取不到有效值。 :type PeakNetworkRegionSet: list of PeakNetworkRegionInfo :param RequestId: 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 :type RequestId: str
r""" :param PeakNetworkRegionSet: 网络峰值数组。 注意:此字段可能返回 null,表示取不到有效值。 :type PeakNetworkRegionSet: list of PeakNetworkRegionInfo :param RequestId: 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 :type RequestId: str
[ "r", ":", "param", "PeakNetworkRegionSet", ":", "网络峰值数组。", "注意:此字段可能返回", "null,表示取不到有效值。", ":", "type", "PeakNetworkRegionSet", ":", "list", "of", "PeakNetworkRegionInfo", ":", "param", "RequestId", ":", "唯一请求", "ID,每次请求都会返回。定位问题时需要提供该次请求的", "RequestId。", ":", "type", ...
def __init__(self): r""" :param PeakNetworkRegionSet: 网络峰值数组。 注意:此字段可能返回 null,表示取不到有效值。 :type PeakNetworkRegionSet: list of PeakNetworkRegionInfo :param RequestId: 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 :type RequestId: str """ self.PeakNetworkRegionSet = None...
[ "def", "__init__", "(", "self", ")", ":", "self", ".", "PeakNetworkRegionSet", "=", "None", "self", ".", "RequestId", "=", "None" ]
https://github.com/TencentCloud/tencentcloud-sdk-python/blob/3677fd1cdc8c5fd626ce001c13fd3b59d1f279d2/tencentcloud/ecm/v20190719/models.py#L4257-L4266
TengXiaoDai/DistributedCrawling
f5c2439e6ce68dd9b49bde084d76473ff9ed4963
Lib/linecache.py
python
clearcache
()
Clear the cache entirely.
Clear the cache entirely.
[ "Clear", "the", "cache", "entirely", "." ]
def clearcache(): """Clear the cache entirely.""" global cache cache = {}
[ "def", "clearcache", "(", ")", ":", "global", "cache", "cache", "=", "{", "}" ]
https://github.com/TengXiaoDai/DistributedCrawling/blob/f5c2439e6ce68dd9b49bde084d76473ff9ed4963/Lib/linecache.py#L30-L34
TengXiaoDai/DistributedCrawling
f5c2439e6ce68dd9b49bde084d76473ff9ed4963
Lib/site-packages/pip/_vendor/pkg_resources/__init__.py
python
EntryPoint.parse
(cls, src, dist=None)
return cls(res['name'], res['module'], attrs, extras, dist)
Parse a single entry point from string `src` Entry point syntax follows the form:: name = some.module:some.attr [extra1, extra2] The entry name and module name are required, but the ``:attrs`` and ``[extras]`` parts are optional
Parse a single entry point from string `src`
[ "Parse", "a", "single", "entry", "point", "from", "string", "src" ]
def parse(cls, src, dist=None): """Parse a single entry point from string `src` Entry point syntax follows the form:: name = some.module:some.attr [extra1, extra2] The entry name and module name are required, but the ``:attrs`` and ``[extras]`` parts are optional "...
[ "def", "parse", "(", "cls", ",", "src", ",", "dist", "=", "None", ")", ":", "m", "=", "cls", ".", "pattern", ".", "match", "(", "src", ")", "if", "not", "m", ":", "msg", "=", "\"EntryPoint must be in 'name=module:attrs [extras]' format\"", "raise", "ValueE...
https://github.com/TengXiaoDai/DistributedCrawling/blob/f5c2439e6ce68dd9b49bde084d76473ff9ed4963/Lib/site-packages/pip/_vendor/pkg_resources/__init__.py#L2321-L2338
TencentCloud/tencentcloud-sdk-python
3677fd1cdc8c5fd626ce001c13fd3b59d1f279d2
tencentcloud/emr/v20190103/models.py
python
InquiryPriceScaleOutInstanceRequest.__init__
(self)
r""" :param TimeUnit: 扩容的时间单位。取值范围: <li>s:表示秒。PayMode取值为0时,TimeUnit只能取值为s。</li> <li>m:表示月份。PayMode取值为1时,TimeUnit只能取值为m。</li> :type TimeUnit: str :param TimeSpan: 扩容的时长。结合TimeUnit一起使用。 <li>TimeUnit为s时,该参数只能填写3600,表示按量计费实例。</li> <li>TimeUnit为m时,该参数填写的数字表示包年包月实例的购买时长,如1表示购买一个月</li> :type Ti...
r""" :param TimeUnit: 扩容的时间单位。取值范围: <li>s:表示秒。PayMode取值为0时,TimeUnit只能取值为s。</li> <li>m:表示月份。PayMode取值为1时,TimeUnit只能取值为m。</li> :type TimeUnit: str :param TimeSpan: 扩容的时长。结合TimeUnit一起使用。 <li>TimeUnit为s时,该参数只能填写3600,表示按量计费实例。</li> <li>TimeUnit为m时,该参数填写的数字表示包年包月实例的购买时长,如1表示购买一个月</li> :type Ti...
[ "r", ":", "param", "TimeUnit", ":", "扩容的时间单位。取值范围:", "<li", ">", "s:表示秒。PayMode取值为0时,TimeUnit只能取值为s。<", "/", "li", ">", "<li", ">", "m:表示月份。PayMode取值为1时,TimeUnit只能取值为m。<", "/", "li", ">", ":", "type", "TimeUnit", ":", "str", ":", "param", "TimeSpan", ":", "扩容的时长...
def __init__(self): r""" :param TimeUnit: 扩容的时间单位。取值范围: <li>s:表示秒。PayMode取值为0时,TimeUnit只能取值为s。</li> <li>m:表示月份。PayMode取值为1时,TimeUnit只能取值为m。</li> :type TimeUnit: str :param TimeSpan: 扩容的时长。结合TimeUnit一起使用。 <li>TimeUnit为s时,该参数只能填写3600,表示按量计费实例。</li> <li>TimeUnit为m时,该参数填写的数字表示包年包月实例的购买时长,如1表...
[ "def", "__init__", "(", "self", ")", ":", "self", ".", "TimeUnit", "=", "None", "self", ".", "TimeSpan", "=", "None", "self", ".", "ZoneId", "=", "None", "self", ".", "PayMode", "=", "None", "self", ".", "InstanceId", "=", "None", "self", ".", "CoreC...
https://github.com/TencentCloud/tencentcloud-sdk-python/blob/3677fd1cdc8c5fd626ce001c13fd3b59d1f279d2/tencentcloud/emr/v20190103/models.py#L1780-L1819
nanoporetech/medaka
2b83074fe3b6a6ec971614bfc6804f543fe1e5f0
medaka/medaka.py
python
medaka_parser
()
return parser
Create the medaka command-line interface.
Create the medaka command-line interface.
[ "Create", "the", "medaka", "command", "-", "line", "interface", "." ]
def medaka_parser(): """Create the medaka command-line interface.""" from medaka import __version__ parser = argparse.ArgumentParser('medaka', formatter_class=argparse.ArgumentDefaultsHelpFormatter) subparsers = parser.add_subparsers(title='subcommands', description='valid commands', help='addit...
[ "def", "medaka_parser", "(", ")", ":", "from", "medaka", "import", "__version__", "parser", "=", "argparse", ".", "ArgumentParser", "(", "'medaka'", ",", "formatter_class", "=", "argparse", ".", "ArgumentDefaultsHelpFormatter", ")", "subparsers", "=", "parser", "....
https://github.com/nanoporetech/medaka/blob/2b83074fe3b6a6ec971614bfc6804f543fe1e5f0/medaka/medaka.py#L341-L678
DataDog/integrations-core
934674b29d94b70ccc008f76ea172d0cdae05e1e
ibm_mq/datadog_checks/ibm_mq/config_models/__init__.py
python
ConfigMixin.config
(self)
return self._config_model_instance
[]
def config(self) -> InstanceConfig: return self._config_model_instance
[ "def", "config", "(", "self", ")", "->", "InstanceConfig", ":", "return", "self", ".", "_config_model_instance" ]
https://github.com/DataDog/integrations-core/blob/934674b29d94b70ccc008f76ea172d0cdae05e1e/ibm_mq/datadog_checks/ibm_mq/config_models/__init__.py#L19-L20
bobbui/json-logging-python
efbe367527203a88e0fec9f81ccb2f1e9252b1bf
json_logging/framework/sanic/__init__.py
python
SanicRequestInfoExtractor.support_global_request_object
()
return False
[]
def support_global_request_object(): return False
[ "def", "support_global_request_object", "(", ")", ":", "return", "False" ]
https://github.com/bobbui/json-logging-python/blob/efbe367527203a88e0fec9f81ccb2f1e9252b1bf/json_logging/framework/sanic/__init__.py#L88-L89
cobbler/cobbler
eed8cdca3e970c8aa1d199e80b8c8f19b3f940cc
cobbler/remote.py
python
CobblerXMLRPCInterface.get_items
(self, what: str)
return self.xmlrpc_hacks(items)
Individual list elements are the same for get_item. :param what: is the name of a Cobbler object type, as described for get_item. :return: This returns a list of dicts.
Individual list elements are the same for get_item.
[ "Individual", "list", "elements", "are", "the", "same", "for", "get_item", "." ]
def get_items(self, what: str): """ Individual list elements are the same for get_item. :param what: is the name of a Cobbler object type, as described for get_item. :return: This returns a list of dicts. """ items = [x.to_dict() for x in self.api.get_items(what)] ...
[ "def", "get_items", "(", "self", ",", "what", ":", "str", ")", ":", "items", "=", "[", "x", ".", "to_dict", "(", ")", "for", "x", "in", "self", ".", "api", ".", "get_items", "(", "what", ")", "]", "return", "self", ".", "xmlrpc_hacks", "(", "item...
https://github.com/cobbler/cobbler/blob/eed8cdca3e970c8aa1d199e80b8c8f19b3f940cc/cobbler/remote.py#L835-L843
vivisect/vivisect
37b0b655d8dedfcf322e86b0f144b096e48d547e
envi/__init__.py
python
Opcode.getTargets
(self, emu=None)
return remote_branches
Determines the targets of call/branch instructions. Fall throughs are not considered as targets. Deref branches are resolved. Returns ((bva, bflags),...) addr can be None in cases where the branch target cannot be computed. (for example, if BR_DEREF flag is set and cannot read the mem...
Determines the targets of call/branch instructions. Fall throughs are not considered as targets. Deref branches are resolved.
[ "Determines", "the", "targets", "of", "call", "/", "branch", "instructions", ".", "Fall", "throughs", "are", "not", "considered", "as", "targets", ".", "Deref", "branches", "are", "resolved", "." ]
def getTargets(self, emu=None): """ Determines the targets of call/branch instructions. Fall throughs are not considered as targets. Deref branches are resolved. Returns ((bva, bflags),...) addr can be None in cases where the branch target cannot be computed. (for exam...
[ "def", "getTargets", "(", "self", ",", "emu", "=", "None", ")", ":", "remote_branches", "=", "[", "]", "for", "bva", ",", "bflags", "in", "self", ".", "getBranches", "(", "emu", "=", "emu", ")", ":", "if", "bflags", "&", "BR_FALL", ":", "continue", ...
https://github.com/vivisect/vivisect/blob/37b0b655d8dedfcf322e86b0f144b096e48d547e/envi/__init__.py#L433-L458
python-diamond/Diamond
7000e16cfdf4508ed9291fc4b3800592557b2431
src/diamond/handler/hostedgraphite.py
python
HostedGraphiteHandler.flush
(self)
[]
def flush(self): self.graphite.flush()
[ "def", "flush", "(", "self", ")", ":", "self", ".", "graphite", ".", "flush", "(", ")" ]
https://github.com/python-diamond/Diamond/blob/7000e16cfdf4508ed9291fc4b3800592557b2431/src/diamond/handler/hostedgraphite.py#L91-L92
CellProfiler/CellProfiler
a90e17e4d258c6f3900238be0f828e0b4bd1b293
cellprofiler/modules/measurecolocalization.py
python
MeasureColocalization.get_image_pairs
(self)
Yield all permutations of pairs of images to correlate Yields the pairs of images in a canonical order.
Yield all permutations of pairs of images to correlate
[ "Yield", "all", "permutations", "of", "pairs", "of", "images", "to", "correlate" ]
def get_image_pairs(self): """Yield all permutations of pairs of images to correlate Yields the pairs of images in a canonical order. """ for i in range(len(self.images_list.value) - 1): for j in range(i + 1, len(self.images_list.value)): yield ( ...
[ "def", "get_image_pairs", "(", "self", ")", ":", "for", "i", "in", "range", "(", "len", "(", "self", ".", "images_list", ".", "value", ")", "-", "1", ")", ":", "for", "j", "in", "range", "(", "i", "+", "1", ",", "len", "(", "self", ".", "images...
https://github.com/CellProfiler/CellProfiler/blob/a90e17e4d258c6f3900238be0f828e0b4bd1b293/cellprofiler/modules/measurecolocalization.py#L323-L333
tensorwerk/hangar-py
a6deb22854a6c9e9709011b91c1c0eeda7f47bb0
src/hangar/backends/numpy_10.py
python
NUMPY_10_FileHandles.read_data
(self, hashVal: NUMPY_10_DataHashSpec)
return out
Read data from disk written in the numpy_00 fmtBackend Parameters ---------- hashVal : NUMPY_10_DataHashSpec record specification stored in the db Returns ------- np.ndarray tensor data stored at the provided hashVal specification. Raise...
Read data from disk written in the numpy_00 fmtBackend
[ "Read", "data", "from", "disk", "written", "in", "the", "numpy_00", "fmtBackend" ]
def read_data(self, hashVal: NUMPY_10_DataHashSpec) -> np.ndarray: """Read data from disk written in the numpy_00 fmtBackend Parameters ---------- hashVal : NUMPY_10_DataHashSpec record specification stored in the db Returns ------- np.ndarray ...
[ "def", "read_data", "(", "self", ",", "hashVal", ":", "NUMPY_10_DataHashSpec", ")", "->", "np", ".", "ndarray", ":", "srcSlc", "=", "(", "hashVal", ".", "collection_idx", ",", "*", "[", "slice", "(", "0", ",", "x", ")", "for", "x", "in", "hashVal", "...
https://github.com/tensorwerk/hangar-py/blob/a6deb22854a6c9e9709011b91c1c0eeda7f47bb0/src/hangar/backends/numpy_10.py#L336-L392
sethmlarson/virtualbox-python
984a6e2cb0e8996f4df40f4444c1528849f1c70d
virtualbox/library.py
python
IGuestScreenInfo.primary
(self)
return ret
Get bool value for 'primary
Get bool value for 'primary
[ "Get", "bool", "value", "for", "primary" ]
def primary(self): """Get bool value for 'primary'""" ret = self._get_attr("primary") return ret
[ "def", "primary", "(", "self", ")", ":", "ret", "=", "self", ".", "_get_attr", "(", "\"primary\"", ")", "return", "ret" ]
https://github.com/sethmlarson/virtualbox-python/blob/984a6e2cb0e8996f4df40f4444c1528849f1c70d/virtualbox/library.py#L28596-L28599
metabrainz/picard
535bf8c7d9363ffc7abb3f69418ec11823c38118
picard/tagger.py
python
main
(localedir=None, autoupdate=True)
[]
def main(localedir=None, autoupdate=True): # Some libs (ie. Phonon) require those to be set QtWidgets.QApplication.setApplicationName(PICARD_APP_NAME) QtWidgets.QApplication.setOrganizationName(PICARD_ORG_NAME) QtWidgets.QApplication.setDesktopFileName(PICARD_DESKTOP_NAME) # Allow High DPI Support ...
[ "def", "main", "(", "localedir", "=", "None", ",", "autoupdate", "=", "True", ")", ":", "# Some libs (ie. Phonon) require those to be set", "QtWidgets", ".", "QApplication", ".", "setApplicationName", "(", "PICARD_APP_NAME", ")", "QtWidgets", ".", "QApplication", ".",...
https://github.com/metabrainz/picard/blob/535bf8c7d9363ffc7abb3f69418ec11823c38118/picard/tagger.py#L1040-L1087
mrDoctorWho/vk4xmpp
e8f25a16832adb6b93fe8b50afdc9547e429389b
gateway.py
python
VK.getGroupData
(self, gid, fields=None)
Gets group data (only name so far) Args: gid: the group id fields: a list of advanced fields to receive Returns: The group information
Gets group data (only name so far) Args: gid: the group id fields: a list of advanced fields to receive Returns: The group information
[ "Gets", "group", "data", "(", "only", "name", "so", "far", ")", "Args", ":", "gid", ":", "the", "group", "id", "fields", ":", "a", "list", "of", "advanced", "fields", "to", "receive", "Returns", ":", "The", "group", "information" ]
def getGroupData(self, gid, fields=None): """ Gets group data (only name so far) Args: gid: the group id fields: a list of advanced fields to receive Returns: The group information """ fields = fields or ["name"] data = self.method("groups.getById", {"group_id": abs(gid), "fields": str.join(",", ...
[ "def", "getGroupData", "(", "self", ",", "gid", ",", "fields", "=", "None", ")", ":", "fields", "=", "fields", "or", "[", "\"name\"", "]", "data", "=", "self", ".", "method", "(", "\"groups.getById\"", ",", "{", "\"group_id\"", ":", "abs", "(", "gid", ...
https://github.com/mrDoctorWho/vk4xmpp/blob/e8f25a16832adb6b93fe8b50afdc9547e429389b/gateway.py#L581-L595
bitprophet/ssh
e8bdad4c82a50158a749233dca58c29e47c60b76
ssh/channel.py
python
Channel.get_name
(self)
return self._name
Get the name of this channel that was previously set by L{set_name}. @return: the name of this channel. @rtype: str
Get the name of this channel that was previously set by L{set_name}.
[ "Get", "the", "name", "of", "this", "channel", "that", "was", "previously", "set", "by", "L", "{", "set_name", "}", "." ]
def get_name(self): """ Get the name of this channel that was previously set by L{set_name}. @return: the name of this channel. @rtype: str """ return self._name
[ "def", "get_name", "(", "self", ")", ":", "return", "self", ".", "_name" ]
https://github.com/bitprophet/ssh/blob/e8bdad4c82a50158a749233dca58c29e47c60b76/ssh/channel.py#L429-L436
IntelPython/sdc
1ebf55c00ef38dfbd401a70b3945e352a5a38b87
sdc/extensions/indexes/int64_index_ext.py
python
pd_int64_index_contains_overload
(self, val)
return pd_int64_index_contains_impl
[]
def pd_int64_index_contains_overload(self, val): if not isinstance(self, Int64IndexType): return None _func_name = 'Operator contains().' ty_checker = TypeChecker(_func_name) if not (isinstance(val, types.Integer)): ty_checker.raise_exc(val, 'integer scalar', 'val') def pd_int64_i...
[ "def", "pd_int64_index_contains_overload", "(", "self", ",", "val", ")", ":", "if", "not", "isinstance", "(", "self", ",", "Int64IndexType", ")", ":", "return", "None", "_func_name", "=", "'Operator contains().'", "ty_checker", "=", "TypeChecker", "(", "_func_name...
https://github.com/IntelPython/sdc/blob/1ebf55c00ef38dfbd401a70b3945e352a5a38b87/sdc/extensions/indexes/int64_index_ext.py#L253-L272
andresriancho/w3af
cd22e5252243a87aaa6d0ddea47cf58dacfe00a9
w3af/core/ui/gui/tools/encdec.py
python
utf8_barebyte_encoding
(t)
return t.encode("utf8")
UTF-8 Bare byte Encoding, just a normal UTF-8 encoding. >>> utf8_barebyte_encoding("A") 'A' >>> utf8_barebyte_encoding("Año") 'A\\xc3\\xb1o'
UTF-8 Bare byte Encoding, just a normal UTF-8 encoding.
[ "UTF", "-", "8", "Bare", "byte", "Encoding", "just", "a", "normal", "UTF", "-", "8", "encoding", "." ]
def utf8_barebyte_encoding(t): """UTF-8 Bare byte Encoding, just a normal UTF-8 encoding. >>> utf8_barebyte_encoding("A") 'A' >>> utf8_barebyte_encoding("Año") 'A\\xc3\\xb1o' """ return t.encode("utf8")
[ "def", "utf8_barebyte_encoding", "(", "t", ")", ":", "return", "t", ".", "encode", "(", "\"utf8\"", ")" ]
https://github.com/andresriancho/w3af/blob/cd22e5252243a87aaa6d0ddea47cf58dacfe00a9/w3af/core/ui/gui/tools/encdec.py#L488-L496
AppScale/gts
46f909cf5dc5ba81faf9d81dc9af598dcf8a82a9
AppServer/lib/django-1.5/django/views/generic/edit.py
python
ModelFormMixin.get_form_kwargs
(self)
return kwargs
Returns the keyword arguments for instantiating the form.
Returns the keyword arguments for instantiating the form.
[ "Returns", "the", "keyword", "arguments", "for", "instantiating", "the", "form", "." ]
def get_form_kwargs(self): """ Returns the keyword arguments for instantiating the form. """ kwargs = super(ModelFormMixin, self).get_form_kwargs() kwargs.update({'instance': self.object}) return kwargs
[ "def", "get_form_kwargs", "(", "self", ")", ":", "kwargs", "=", "super", "(", "ModelFormMixin", ",", "self", ")", ".", "get_form_kwargs", "(", ")", "kwargs", ".", "update", "(", "{", "'instance'", ":", "self", ".", "object", "}", ")", "return", "kwargs" ...
https://github.com/AppScale/gts/blob/46f909cf5dc5ba81faf9d81dc9af598dcf8a82a9/AppServer/lib/django-1.5/django/views/generic/edit.py#L100-L106
sagemath/sage
f9b2db94f675ff16963ccdefba4f1a3393b3fe0d
src/sage/combinat/ncsf_qsym/combinatorics.py
python
coeff_lp
(J,I)
return prod(K[-1] for K in J.refinement_splitting(I))
r""" Returns the coefficient `lp_{J,I}` as defined in [NCSF]_. INPUT: - ``J`` -- a composition - ``I`` -- a composition refining ``J`` OUTPUT: - integer EXAMPLES:: sage: from sage.combinat.ncsf_qsym.combinatorics import coeff_lp sage: coeff_lp(Composition([1,1,1]), Comp...
r""" Returns the coefficient `lp_{J,I}` as defined in [NCSF]_.
[ "r", "Returns", "the", "coefficient", "lp_", "{", "J", "I", "}", "as", "defined", "in", "[", "NCSF", "]", "_", "." ]
def coeff_lp(J,I): r""" Returns the coefficient `lp_{J,I}` as defined in [NCSF]_. INPUT: - ``J`` -- a composition - ``I`` -- a composition refining ``J`` OUTPUT: - integer EXAMPLES:: sage: from sage.combinat.ncsf_qsym.combinatorics import coeff_lp sage: coeff_lp(Com...
[ "def", "coeff_lp", "(", "J", ",", "I", ")", ":", "return", "prod", "(", "K", "[", "-", "1", "]", "for", "K", "in", "J", ".", "refinement_splitting", "(", "I", ")", ")" ]
https://github.com/sagemath/sage/blob/f9b2db94f675ff16963ccdefba4f1a3393b3fe0d/src/sage/combinat/ncsf_qsym/combinatorics.py#L55-L76
AstroPrint/AstroBox
e7e3b8a7d33ea85fcb6b2696869c0d719ceb8b75
src/octoprint/util/__init__.py
python
silentRemove
(file)
Silently removes a file. Does not raise an error if the file doesn't exist. @param file the path of the file to be removed
Silently removes a file. Does not raise an error if the file doesn't exist.
[ "Silently", "removes", "a", "file", ".", "Does", "not", "raise", "an", "error", "if", "the", "file", "doesn", "t", "exist", "." ]
def silentRemove(file): """ Silently removes a file. Does not raise an error if the file doesn't exist. @param file the path of the file to be removed """ try: os.remove(file) except OSError: pass
[ "def", "silentRemove", "(", "file", ")", ":", "try", ":", "os", ".", "remove", "(", "file", ")", "except", "OSError", ":", "pass" ]
https://github.com/AstroPrint/AstroBox/blob/e7e3b8a7d33ea85fcb6b2696869c0d719ceb8b75/src/octoprint/util/__init__.py#L186-L196
usnistgov/fipy
6809b180b41a11de988a48655575df7e142c93b9
versioneer.py
python
render_pep440_pre
(pieces)
return rendered
TAG[.post.devDISTANCE] -- No -dirty. Exceptions: 1: no tags. 0.post.devDISTANCE
TAG[.post.devDISTANCE] -- No -dirty.
[ "TAG", "[", ".", "post", ".", "devDISTANCE", "]", "--", "No", "-", "dirty", "." ]
def render_pep440_pre(pieces): """TAG[.post.devDISTANCE] -- No -dirty. Exceptions: 1: no tags. 0.post.devDISTANCE """ if pieces["closest-tag"]: rendered = pieces["closest-tag"] if pieces["distance"]: rendered += ".post.dev%d" % pieces["distance"] else: # exce...
[ "def", "render_pep440_pre", "(", "pieces", ")", ":", "if", "pieces", "[", "\"closest-tag\"", "]", ":", "rendered", "=", "pieces", "[", "\"closest-tag\"", "]", "if", "pieces", "[", "\"distance\"", "]", ":", "rendered", "+=", "\".post.dev%d\"", "%", "pieces", ...
https://github.com/usnistgov/fipy/blob/6809b180b41a11de988a48655575df7e142c93b9/versioneer.py#L1261-L1274
donnemartin/gitsome
d7c57abc7cb66e9c910a844f15d4536866da3310
xonsh/ptk2/shell.py
python
PromptToolkit2Shell.continuation_tokens
(self, width, line_number, is_soft_wrap=False)
return PygmentsTokens(toks)
Displays dots in multiline prompt
Displays dots in multiline prompt
[ "Displays", "dots", "in", "multiline", "prompt" ]
def continuation_tokens(self, width, line_number, is_soft_wrap=False): """Displays dots in multiline prompt""" if is_soft_wrap: return "" width = width - 1 dots = builtins.__xonsh__.env.get("MULTILINE_PROMPT") dots = dots() if callable(dots) else dots if dots ...
[ "def", "continuation_tokens", "(", "self", ",", "width", ",", "line_number", ",", "is_soft_wrap", "=", "False", ")", ":", "if", "is_soft_wrap", ":", "return", "\"\"", "width", "=", "width", "-", "1", "dots", "=", "builtins", ".", "__xonsh__", ".", "env", ...
https://github.com/donnemartin/gitsome/blob/d7c57abc7cb66e9c910a844f15d4536866da3310/xonsh/ptk2/shell.py#L244-L273
gammapy/gammapy
735b25cd5bbed35e2004d633621896dcd5295e8b
gammapy/modeling/models/temporal.py
python
LightCurveTemplateTemporalModel.read
(cls, path)
return cls(Table.read(filename), filename=filename)
Read lightcurve model table from FITS file. TODO: This doesn't read the XML part of the model yet.
Read lightcurve model table from FITS file.
[ "Read", "lightcurve", "model", "table", "from", "FITS", "file", "." ]
def read(cls, path): """Read lightcurve model table from FITS file. TODO: This doesn't read the XML part of the model yet. """ filename = str(make_path(path)) return cls(Table.read(filename), filename=filename)
[ "def", "read", "(", "cls", ",", "path", ")", ":", "filename", "=", "str", "(", "make_path", "(", "path", ")", ")", "return", "cls", "(", "Table", ".", "read", "(", "filename", ")", ",", "filename", "=", "filename", ")" ]
https://github.com/gammapy/gammapy/blob/735b25cd5bbed35e2004d633621896dcd5295e8b/gammapy/modeling/models/temporal.py#L408-L414
BillBillBillBill/Tickeys-linux
2df31b8665004c58a5d4ab05277f245267d96364
tickeys/kivy_32/kivy/storage/__init__.py
python
AbstractStore.async_clear
(self, callback)
Asynchronous version of :meth:`clear`.
Asynchronous version of :meth:`clear`.
[ "Asynchronous", "version", "of", ":", "meth", ":", "clear", "." ]
def async_clear(self, callback): '''Asynchronous version of :meth:`clear`. ''' self._schedule(self.store_clear_async, callback=callback)
[ "def", "async_clear", "(", "self", ",", "callback", ")", ":", "self", ".", "_schedule", "(", "self", ".", "store_clear_async", ",", "callback", "=", "callback", ")" ]
https://github.com/BillBillBillBill/Tickeys-linux/blob/2df31b8665004c58a5d4ab05277f245267d96364/tickeys/kivy_32/kivy/storage/__init__.py#L281-L284
GoogleCloudPlatform/PerfKitBenchmarker
6e3412d7d5e414b8ca30ed5eaf970cef1d919a67
perfkitbenchmarker/linux_benchmarks/speccpu2006_benchmark.py
python
Prepare
(benchmark_spec)
Installs SPEC CPU2006 on the target vm. Args: benchmark_spec: The benchmark specification. Contains all data that is required to run the benchmark.
Installs SPEC CPU2006 on the target vm.
[ "Installs", "SPEC", "CPU2006", "on", "the", "target", "vm", "." ]
def Prepare(benchmark_spec): """Installs SPEC CPU2006 on the target vm. Args: benchmark_spec: The benchmark specification. Contains all data that is required to run the benchmark. """ vm = benchmark_spec.vms[0] vm.Install('speccpu2006') # Set attribute outside of the install function, so benchm...
[ "def", "Prepare", "(", "benchmark_spec", ")", ":", "vm", "=", "benchmark_spec", ".", "vms", "[", "0", "]", "vm", ".", "Install", "(", "'speccpu2006'", ")", "# Set attribute outside of the install function, so benchmark will work", "# even with --install_packages=False.", ...
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/6e3412d7d5e414b8ca30ed5eaf970cef1d919a67/perfkitbenchmarker/linux_benchmarks/speccpu2006_benchmark.py#L66-L78
jbjorne/TEES
caf19a4a1352ac59f5dc13a8684cc42ce4342d9d
Utils/ElementTreeUtils.py
python
setDefaultElement
(parent, name)
return element
[]
def setDefaultElement(parent, name): element = parent.find(name) if element == None: element = ElementTree.Element(name) parent.append(element) return element
[ "def", "setDefaultElement", "(", "parent", ",", "name", ")", ":", "element", "=", "parent", ".", "find", "(", "name", ")", "if", "element", "==", "None", ":", "element", "=", "ElementTree", ".", "Element", "(", "name", ")", "parent", ".", "append", "("...
https://github.com/jbjorne/TEES/blob/caf19a4a1352ac59f5dc13a8684cc42ce4342d9d/Utils/ElementTreeUtils.py#L360-L365
edfungus/Crouton
ada98b3930192938a48909072b45cb84b945f875
clients/esp8266_clients/venv/lib/python2.7/site-packages/pip/_vendor/requests/packages/urllib3/packages/ordered_dict.py
python
OrderedDict.popitem
(self, last=True)
return key, value
od.popitem() -> (k, v), return and remove a (key, value) pair. Pairs are returned in LIFO order if last is true or FIFO order if false.
od.popitem() -> (k, v), return and remove a (key, value) pair. Pairs are returned in LIFO order if last is true or FIFO order if false.
[ "od", ".", "popitem", "()", "-", ">", "(", "k", "v", ")", "return", "and", "remove", "a", "(", "key", "value", ")", "pair", ".", "Pairs", "are", "returned", "in", "LIFO", "order", "if", "last", "is", "true", "or", "FIFO", "order", "if", "false", ...
def popitem(self, last=True): '''od.popitem() -> (k, v), return and remove a (key, value) pair. Pairs are returned in LIFO order if last is true or FIFO order if false. ''' if not self: raise KeyError('dictionary is empty') root = self.__root if last: ...
[ "def", "popitem", "(", "self", ",", "last", "=", "True", ")", ":", "if", "not", "self", ":", "raise", "KeyError", "(", "'dictionary is empty'", ")", "root", "=", "self", ".", "__root", "if", "last", ":", "link", "=", "root", "[", "0", "]", "link_prev...
https://github.com/edfungus/Crouton/blob/ada98b3930192938a48909072b45cb84b945f875/clients/esp8266_clients/venv/lib/python2.7/site-packages/pip/_vendor/requests/packages/urllib3/packages/ordered_dict.py#L91-L112
sagemath/sage
f9b2db94f675ff16963ccdefba4f1a3393b3fe0d
src/sage/graphs/generators/classical_geometries.py
python
SymplecticDualPolarGraph
(m, q)
return G
r""" Return the Symplectic Dual Polar Graph `DSp(m,q)`. For more information on Symplectic Dual Polar graphs, see [BCN1989]_ and Sect. 2.3.1 of [Coh1981]_. INPUT: - ``m,q`` -- integers; `q` must be a prime power, and `m` must be even EXAMPLES:: sage: G = graphs.SymplecticDualPolarGr...
r""" Return the Symplectic Dual Polar Graph `DSp(m,q)`.
[ "r", "Return", "the", "Symplectic", "Dual", "Polar", "Graph", "DSp", "(", "m", "q", ")", "." ]
def SymplecticDualPolarGraph(m, q): r""" Return the Symplectic Dual Polar Graph `DSp(m,q)`. For more information on Symplectic Dual Polar graphs, see [BCN1989]_ and Sect. 2.3.1 of [Coh1981]_. INPUT: - ``m,q`` -- integers; `q` must be a prime power, and `m` must be even EXAMPLES:: ...
[ "def", "SymplecticDualPolarGraph", "(", "m", ",", "q", ")", ":", "from", "sage", ".", "libs", ".", "gap", ".", "libgap", "import", "libgap", "G", "=", "_polar_graph", "(", "m", ",", "q", ",", "libgap", ".", "SymplecticGroup", "(", "m", ",", "q", ")",...
https://github.com/sagemath/sage/blob/f9b2db94f675ff16963ccdefba4f1a3393b3fe0d/src/sage/graphs/generators/classical_geometries.py#L773-L810
Vector35/binaryninja-api
d9661f34eec6855d495a10eaafc2a8e2679756a7
python/flowgraph.py
python
FlowGraphLayoutRequest.graph
(self)
return CoreFlowGraph(core.BNGetGraphForFlowGraphLayoutRequest(self.handle))
Flow graph that is being processed (read-only)
Flow graph that is being processed (read-only)
[ "Flow", "graph", "that", "is", "being", "processed", "(", "read", "-", "only", ")" ]
def graph(self): """Flow graph that is being processed (read-only)""" return CoreFlowGraph(core.BNGetGraphForFlowGraphLayoutRequest(self.handle))
[ "def", "graph", "(", "self", ")", ":", "return", "CoreFlowGraph", "(", "core", ".", "BNGetGraphForFlowGraphLayoutRequest", "(", "self", ".", "handle", ")", ")" ]
https://github.com/Vector35/binaryninja-api/blob/d9661f34eec6855d495a10eaafc2a8e2679756a7/python/flowgraph.py#L363-L365
sagemath/sage
f9b2db94f675ff16963ccdefba4f1a3393b3fe0d
src/sage/functions/exp_integral.py
python
Function_cos_integral._evalf_
(self, z, parent=None, algorithm=None)
return mpmath_utils_call(mpmath.ci, z, parent=parent)
EXAMPLES:: sage: N(cos_integral(1e23)) < 1e-20 True sage: N(cos_integral(10^-10), digits=30) -22.4486352650389239795759024568 sage: cos_integral(ComplexField(100)(I)) 0.83786694098020824089467857943 + 1.5707963267948966192313216916*I
EXAMPLES::
[ "EXAMPLES", "::" ]
def _evalf_(self, z, parent=None, algorithm=None): """ EXAMPLES:: sage: N(cos_integral(1e23)) < 1e-20 True sage: N(cos_integral(10^-10), digits=30) -22.4486352650389239795759024568 sage: cos_integral(ComplexField(100)(I)) 0.8378669...
[ "def", "_evalf_", "(", "self", ",", "z", ",", "parent", "=", "None", ",", "algorithm", "=", "None", ")", ":", "import", "mpmath", "return", "mpmath_utils_call", "(", "mpmath", ".", "ci", ",", "z", ",", "parent", "=", "parent", ")" ]
https://github.com/sagemath/sage/blob/f9b2db94f675ff16963ccdefba4f1a3393b3fe0d/src/sage/functions/exp_integral.py#L997-L1010
weewx/weewx
cb594fce224560bd8696050fc5c7843c7839320e
bin/weewx/restx.py
python
StdRESTful.shutDown_thread
(q, t)
Function to shut down a thread.
Function to shut down a thread.
[ "Function", "to", "shut", "down", "a", "thread", "." ]
def shutDown_thread(q, t): """Function to shut down a thread.""" if q and t.is_alive(): # Put a None in the queue to signal the thread to shutdown q.put(None) # Wait up to 20 seconds for the thread to exit: t.join(20.0) if t.is_alive(): ...
[ "def", "shutDown_thread", "(", "q", ",", "t", ")", ":", "if", "q", "and", "t", ".", "is_alive", "(", ")", ":", "# Put a None in the queue to signal the thread to shutdown", "q", ".", "put", "(", "None", ")", "# Wait up to 20 seconds for the thread to exit:", "t", ...
https://github.com/weewx/weewx/blob/cb594fce224560bd8696050fc5c7843c7839320e/bin/weewx/restx.py#L149-L159
Esri/ArcREST
ab240fde2b0200f61d4a5f6df033516e53f2f416
src/arcrest/manageorg/_content.py
python
Group.id
(self)
return self._groupId
gets the group id
gets the group id
[ "gets", "the", "group", "id" ]
def id(self): """gets the group id""" return self._groupId
[ "def", "id", "(", "self", ")", ":", "return", "self", ".", "_groupId" ]
https://github.com/Esri/ArcREST/blob/ab240fde2b0200f61d4a5f6df033516e53f2f416/src/arcrest/manageorg/_content.py#L3108-L3110
HymanLiuTS/flaskTs
286648286976e85d9b9a5873632331efcafe0b21
flasky/lib/python2.7/site-packages/wheel/bdist_wheel.py
python
bdist_wheel.add_requirements
(self, metadata_path)
Add additional requirements from setup.cfg to file metadata_path
Add additional requirements from setup.cfg to file metadata_path
[ "Add", "additional", "requirements", "from", "setup", ".", "cfg", "to", "file", "metadata_path" ]
def add_requirements(self, metadata_path): """Add additional requirements from setup.cfg to file metadata_path""" additional = list(self.setupcfg_requirements()) if not additional: return pkg_info = read_pkg_info(metadata_path) if 'Provides-Extra' in pkg_info or 'Requires-Dist' i...
[ "def", "add_requirements", "(", "self", ",", "metadata_path", ")", ":", "additional", "=", "list", "(", "self", ".", "setupcfg_requirements", "(", ")", ")", "if", "not", "additional", ":", "return", "pkg_info", "=", "read_pkg_info", "(", "metadata_path", ")", ...
https://github.com/HymanLiuTS/flaskTs/blob/286648286976e85d9b9a5873632331efcafe0b21/flasky/lib/python2.7/site-packages/wheel/bdist_wheel.py#L347-L358
hirofumi0810/tensorflow_end2end_speech_recognition
65b9728089d5e92b25b92384a67419d970399a64
models/encoders/core/rnn_util.py
python
sequence_length
(inputs, time_major=True, dtype=tf.int32)
return seq_len
Inspect the length of the sequence of input data. Args: inputs: A tensor of size `[B, T, input_size]` time_major (bool, optional): set True if inputs is time-major dtype (optional): default is tf.int32 Returns: seq_len: A tensor of size `[B,]`
Inspect the length of the sequence of input data. Args: inputs: A tensor of size `[B, T, input_size]` time_major (bool, optional): set True if inputs is time-major dtype (optional): default is tf.int32 Returns: seq_len: A tensor of size `[B,]`
[ "Inspect", "the", "length", "of", "the", "sequence", "of", "input", "data", ".", "Args", ":", "inputs", ":", "A", "tensor", "of", "size", "[", "B", "T", "input_size", "]", "time_major", "(", "bool", "optional", ")", ":", "set", "True", "if", "inputs", ...
def sequence_length(inputs, time_major=True, dtype=tf.int32): """Inspect the length of the sequence of input data. Args: inputs: A tensor of size `[B, T, input_size]` time_major (bool, optional): set True if inputs is time-major dtype (optional): default is tf.int32 Returns: ...
[ "def", "sequence_length", "(", "inputs", ",", "time_major", "=", "True", ",", "dtype", "=", "tf", ".", "int32", ")", ":", "time_axis", "=", "0", "if", "time_major", "else", "1", "with", "tf", ".", "variable_scope", "(", "\"seq_len\"", ")", ":", "used", ...
https://github.com/hirofumi0810/tensorflow_end2end_speech_recognition/blob/65b9728089d5e92b25b92384a67419d970399a64/models/encoders/core/rnn_util.py#L13-L27
dimagi/commcare-hq
d67ff1d3b4c51fa050c19e60c3253a79d3452a39
corehq/apps/app_manager/suite_xml/features/mobile_ucr.py
python
_get_select_details
(config)
return models.Detail(custom_xml=Detail( id=_get_select_detail_id(config), title=Text( locale=Locale(id=id_strings.report_menu()), ), fields=[ Field( header=Header( text=Text( locale=Locale(id=id_strings.r...
[]
def _get_select_details(config): return models.Detail(custom_xml=Detail( id=_get_select_detail_id(config), title=Text( locale=Locale(id=id_strings.report_menu()), ), fields=[ Field( header=Header( text=Text( ...
[ "def", "_get_select_details", "(", "config", ")", ":", "return", "models", ".", "Detail", "(", "custom_xml", "=", "Detail", "(", "id", "=", "_get_select_detail_id", "(", "config", ")", ",", "title", "=", "Text", "(", "locale", "=", "Locale", "(", "id", "...
https://github.com/dimagi/commcare-hq/blob/d67ff1d3b4c51fa050c19e60c3253a79d3452a39/corehq/apps/app_manager/suite_xml/features/mobile_ucr.py#L160-L180
sunpy/sunpy
528579df0a4c938c133bd08971ba75c131b189a7
sunpy/net/scraper.py
python
Scraper._URL_followsPattern
(self, url)
return False
Check whether the url provided follows the pattern.
Check whether the url provided follows the pattern.
[ "Check", "whether", "the", "url", "provided", "follows", "the", "pattern", "." ]
def _URL_followsPattern(self, url): """ Check whether the url provided follows the pattern. """ pattern = self.pattern for k, v in TIME_CONVERSIONS.items(): pattern = pattern.replace(k, v) matches = re.match(pattern, url) if matches: return...
[ "def", "_URL_followsPattern", "(", "self", ",", "url", ")", ":", "pattern", "=", "self", ".", "pattern", "for", "k", ",", "v", "in", "TIME_CONVERSIONS", ".", "items", "(", ")", ":", "pattern", "=", "pattern", ".", "replace", "(", "k", ",", "v", ")", ...
https://github.com/sunpy/sunpy/blob/528579df0a4c938c133bd08971ba75c131b189a7/sunpy/net/scraper.py#L169-L179
autotest/autotest
4614ae5f550cc888267b9a419e4b90deb54f8fae
client/shared/utils.py
python
get_children_pids
(ppid)
return (system_output("ps -L --ppid=%d -o lwp" % ppid).split('\n')[1:])
Get all PIDs of children/threads of parent ppid param ppid: parent PID return: list of PIDs of all children/threads of ppid
Get all PIDs of children/threads of parent ppid param ppid: parent PID return: list of PIDs of all children/threads of ppid
[ "Get", "all", "PIDs", "of", "children", "/", "threads", "of", "parent", "ppid", "param", "ppid", ":", "parent", "PID", "return", ":", "list", "of", "PIDs", "of", "all", "children", "/", "threads", "of", "ppid" ]
def get_children_pids(ppid): """ Get all PIDs of children/threads of parent ppid param ppid: parent PID return: list of PIDs of all children/threads of ppid """ return (system_output("ps -L --ppid=%d -o lwp" % ppid).split('\n')[1:])
[ "def", "get_children_pids", "(", "ppid", ")", ":", "return", "(", "system_output", "(", "\"ps -L --ppid=%d -o lwp\"", "%", "ppid", ")", ".", "split", "(", "'\\n'", ")", "[", "1", ":", "]", ")" ]
https://github.com/autotest/autotest/blob/4614ae5f550cc888267b9a419e4b90deb54f8fae/client/shared/utils.py#L1144-L1150
NVIDIA/DeepLearningExamples
589604d49e016cd9ef4525f7abcc9c7b826cfc5e
PyTorch/LanguageModeling/BART/bart/modeling/modeling_bart.py
python
BartEncoder.forward
( self, input_ids=None, attention_mask=None, head_mask=None, inputs_embeds=None, output_attentions=None, output_hidden_states=None, return_dict=None, )
return BaseModelOutput( last_hidden_state=hidden_states, hidden_states=encoder_states, attentions=all_attentions )
r""" Args: input_ids (:obj:`torch.LongTensor` of shape :obj:`(batch_size, sequence_length)`): Indices of input sequence tokens in the vocabulary. Padding will be ignored by default should you provide it. Indices can be obtained using :class:`~transform...
r""" Args: input_ids (:obj:`torch.LongTensor` of shape :obj:`(batch_size, sequence_length)`): Indices of input sequence tokens in the vocabulary. Padding will be ignored by default should you provide it. Indices can be obtained using :class:`~transform...
[ "r", "Args", ":", "input_ids", "(", ":", "obj", ":", "torch", ".", "LongTensor", "of", "shape", ":", "obj", ":", "(", "batch_size", "sequence_length", ")", ")", ":", "Indices", "of", "input", "sequence", "tokens", "in", "the", "vocabulary", ".", "Padding...
def forward( self, input_ids=None, attention_mask=None, head_mask=None, inputs_embeds=None, output_attentions=None, output_hidden_states=None, return_dict=None, ): r""" Args: input_ids (:obj:`torch.LongTensor` of shape :obj:...
[ "def", "forward", "(", "self", ",", "input_ids", "=", "None", ",", "attention_mask", "=", "None", ",", "head_mask", "=", "None", ",", "inputs_embeds", "=", "None", ",", "output_attentions", "=", "None", ",", "output_hidden_states", "=", "None", ",", "return_...
https://github.com/NVIDIA/DeepLearningExamples/blob/589604d49e016cd9ef4525f7abcc9c7b826cfc5e/PyTorch/LanguageModeling/BART/bart/modeling/modeling_bart.py#L669-L797
msprev/panzer
9a45452c3d6bb7890e96f67f3ef93e0e03057e47
panzer/document.py
python
Document.jsonfilter
(self)
pipe through external command listed in filters
pipe through external command listed in filters
[ "pipe", "through", "external", "command", "listed", "in", "filters" ]
def jsonfilter(self): """ pipe through external command listed in filters """ to_run = [entry for entry in self.runlist if entry['kind'] == 'filter'] if not to_run: return info.log('INFO', 'panzer', info.pretty_title('filter')) # Run commands f...
[ "def", "jsonfilter", "(", "self", ")", ":", "to_run", "=", "[", "entry", "for", "entry", "in", "self", ".", "runlist", "if", "entry", "[", "'kind'", "]", "==", "'filter'", "]", "if", "not", "to_run", ":", "return", "info", ".", "log", "(", "'INFO'", ...
https://github.com/msprev/panzer/blob/9a45452c3d6bb7890e96f67f3ef93e0e03057e47/panzer/document.py#L476-L537
postlund/pyatv
4ed1f5539f37d86d80272663d1f2ea34a6c41ec4
pyatv/interface.py
python
BaseConfig.properties
(self)
return self._properties
Return Zeroconf properties.
Return Zeroconf properties.
[ "Return", "Zeroconf", "properties", "." ]
def properties(self) -> Mapping[str, Mapping[str, str]]: """Return Zeroconf properties.""" return self._properties
[ "def", "properties", "(", "self", ")", "->", "Mapping", "[", "str", ",", "Mapping", "[", "str", ",", "str", "]", "]", ":", "return", "self", ".", "_properties" ]
https://github.com/postlund/pyatv/blob/4ed1f5539f37d86d80272663d1f2ea34a6c41ec4/pyatv/interface.py#L1079-L1081