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
Alex-Fabbri/Multi-News
f6476d1f114662eb93db32e9b704b7c4fe047217
code/OpenNMT-py-baselines/onmt/utils/report_manager.py
python
ReportMgrBase.__init__
(self, report_every, start_time=-1.)
Args: report_every(int): Report status every this many sentences start_time(float): manually set report start time. Negative values means that you will need to set it later or use `start()`
Args: report_every(int): Report status every this many sentences start_time(float): manually set report start time. Negative values means that you will need to set it later or use `start()`
[ "Args", ":", "report_every", "(", "int", ")", ":", "Report", "status", "every", "this", "many", "sentences", "start_time", "(", "float", ")", ":", "manually", "set", "report", "start", "time", ".", "Negative", "values", "means", "that", "you", "will", "nee...
def __init__(self, report_every, start_time=-1.): """ Args: report_every(int): Report status every this many sentences start_time(float): manually set report start time. Negative values means that you will need to set it later or use `start()` """ ...
[ "def", "__init__", "(", "self", ",", "report_every", ",", "start_time", "=", "-", "1.", ")", ":", "self", ".", "report_every", "=", "report_every", "self", ".", "progress_step", "=", "0", "self", ".", "start_time", "=", "start_time" ]
https://github.com/Alex-Fabbri/Multi-News/blob/f6476d1f114662eb93db32e9b704b7c4fe047217/code/OpenNMT-py-baselines/onmt/utils/report_manager.py#L33-L42
kubeflow-kale/kale
bda9d296822e56ba8fe76b0072e656005da04905
backend/kale/processors/nbprocessor.py
python
NotebookProcessor.parse_cell_metadata
(self, metadata)
return parsed_tags
Parse a notebook's cell's metadata field. The Kale UI writes specific tags inside the 'tags' field, as a list of string tags. Supported tags are defined by _TAGS_LANGUAGE. Args: metadata (dict): a dict containing a notebook's cell's metadata Returns (dict): parsed tags bas...
Parse a notebook's cell's metadata field.
[ "Parse", "a", "notebook", "s", "cell", "s", "metadata", "field", "." ]
def parse_cell_metadata(self, metadata): """Parse a notebook's cell's metadata field. The Kale UI writes specific tags inside the 'tags' field, as a list of string tags. Supported tags are defined by _TAGS_LANGUAGE. Args: metadata (dict): a dict containing a notebook's cell...
[ "def", "parse_cell_metadata", "(", "self", ",", "metadata", ")", ":", "parsed_tags", "=", "dict", "(", ")", "# `step_names` is a list because a notebook cell might be assigned to", "# more than one Pipeline step.", "parsed_tags", "[", "'step_names'", "]", "=", "list", "(", ...
https://github.com/kubeflow-kale/kale/blob/bda9d296822e56ba8fe76b0072e656005da04905/backend/kale/processors/nbprocessor.py#L342-L444
PaddlePaddle/PaddleX
2bab73f81ab54e328204e7871e6ae4a82e719f5d
static/paddlex_restful/restful/project/train/params.py
python
DetParams.set_mixup_alpha
(self, mixup_alpha)
[]
def set_mixup_alpha(self, mixup_alpha): self.mixup_alpha = mixup_alpha
[ "def", "set_mixup_alpha", "(", "self", ",", "mixup_alpha", ")", ":", "self", ".", "mixup_alpha", "=", "mixup_alpha" ]
https://github.com/PaddlePaddle/PaddleX/blob/2bab73f81ab54e328204e7871e6ae4a82e719f5d/static/paddlex_restful/restful/project/train/params.py#L228-L229
home-assistant/core
265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1
homeassistant/components/tado/sensor.py
python
async_setup_entry
( hass: HomeAssistant, entry: ConfigEntry, async_add_entities: AddEntitiesCallback )
Set up the Tado sensor platform.
Set up the Tado sensor platform.
[ "Set", "up", "the", "Tado", "sensor", "platform", "." ]
async def async_setup_entry( hass: HomeAssistant, entry: ConfigEntry, async_add_entities: AddEntitiesCallback ) -> None: """Set up the Tado sensor platform.""" tado = hass.data[DOMAIN][entry.entry_id][DATA] zones = tado.zones entities = [] # Create home sensors entities.extend([TadoHomeSen...
[ "async", "def", "async_setup_entry", "(", "hass", ":", "HomeAssistant", ",", "entry", ":", "ConfigEntry", ",", "async_add_entities", ":", "AddEntitiesCallback", ")", "->", "None", ":", "tado", "=", "hass", ".", "data", "[", "DOMAIN", "]", "[", "entry", ".", ...
https://github.com/home-assistant/core/blob/265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1/homeassistant/components/tado/sensor.py#L59-L86
catap/namebench
9913a7a1a7955a3759eb18cbe73b421441a7a00f
nb_third_party/jinja2/meta.py
python
TrackingCodeGenerator.write
(self, x)
Don't write.
Don't write.
[ "Don", "t", "write", "." ]
def write(self, x): """Don't write."""
[ "def", "write", "(", "self", ",", "x", ")", ":" ]
https://github.com/catap/namebench/blob/9913a7a1a7955a3759eb18cbe73b421441a7a00f/nb_third_party/jinja2/meta.py#L24-L25
vispy/vispy
26256fdc2574259dd227022fbce0767cae4e244b
vispy/visuals/image.py
python
ImageVisual._update_method
(self, view)
Decide which method to use for *view* and configure it accordingly.
Decide which method to use for *view* and configure it accordingly.
[ "Decide", "which", "method", "to", "use", "for", "*", "view", "*", "and", "configure", "it", "accordingly", "." ]
def _update_method(self, view): """Decide which method to use for *view* and configure it accordingly.""" method = self._method if method == 'auto': if view.transforms.get_transform().Linear: method = 'subdivide' else: method = 'impostor' ...
[ "def", "_update_method", "(", "self", ",", "view", ")", ":", "method", "=", "self", ".", "_method", "if", "method", "==", "'auto'", ":", "if", "view", ".", "transforms", ".", "get_transform", "(", ")", ".", "Linear", ":", "method", "=", "'subdivide'", ...
https://github.com/vispy/vispy/blob/26256fdc2574259dd227022fbce0767cae4e244b/vispy/visuals/image.py#L498-L521
zhl2008/awd-platform
0416b31abea29743387b10b3914581fbe8e7da5e
web_flaskbb/Python-2.7.9/Lib/distutils/cmd.py
python
install_misc.initialize_options
(self)
[]
def initialize_options (self): self.install_dir = None self.outfiles = []
[ "def", "initialize_options", "(", "self", ")", ":", "self", ".", "install_dir", "=", "None", "self", ".", "outfiles", "=", "[", "]" ]
https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_flaskbb/Python-2.7.9/Lib/distutils/cmd.py#L440-L442
wbond/packagecontrol.io
9f5eb7e3392e6bc2ad979ad32d3dd27ef9c00b20
app/lib/package_control/downloaders/cli_downloader.py
python
CliDownloader.execute
(self, args)
return output
Runs the executable and args and returns the result :param args: A list of the executable path and all arguments to be passed to it :return: The text output of the executable :raises: NonCleanExitError when the executable exits with an error
Runs the executable and args and returns the result
[ "Runs", "the", "executable", "and", "args", "and", "returns", "the", "result" ]
def execute(self, args): """ Runs the executable and args and returns the result :param args: A list of the executable path and all arguments to be passed to it :return: The text output of the executable :raises: NonCleanExitError when the e...
[ "def", "execute", "(", "self", ",", "args", ")", ":", "if", "self", ".", "settings", ".", "get", "(", "'debug'", ")", ":", "console_write", "(", "u'''\n Trying to execute command %s\n '''", ",", "create_cmd", "(", "args", ")", ")", ...
https://github.com/wbond/packagecontrol.io/blob/9f5eb7e3392e6bc2ad979ad32d3dd27ef9c00b20/app/lib/package_control/downloaders/cli_downloader.py#L54-L86
iGio90/Dwarf
bb3011cdffd209c7e3f5febe558053bf649ca69c
dwarf_debugger/ui/widgets/hex_edit.py
python
HexEditor.on_cm_paste
(self)
paste plain ascii or hex
paste plain ascii or hex
[ "paste", "plain", "ascii", "or", "hex" ]
def on_cm_paste(self): """ paste plain ascii or hex """
[ "def", "on_cm_paste", "(", "self", ")", ":" ]
https://github.com/iGio90/Dwarf/blob/bb3011cdffd209c7e3f5febe558053bf649ca69c/dwarf_debugger/ui/widgets/hex_edit.py#L1276-L1278
IronLanguages/ironpython3
7a7bb2a872eeab0d1009fc8a6e24dca43f65b693
Src/StdLib/Lib/socketserver.py
python
TCPServer.shutdown_request
(self, request)
Called to shutdown and close an individual request.
Called to shutdown and close an individual request.
[ "Called", "to", "shutdown", "and", "close", "an", "individual", "request", "." ]
def shutdown_request(self, request): """Called to shutdown and close an individual request.""" try: #explicitly shutdown. socket.close() merely releases #the socket and waits for GC to perform the actual close. request.shutdown(socket.SHUT_WR) except OSError:...
[ "def", "shutdown_request", "(", "self", ",", "request", ")", ":", "try", ":", "#explicitly shutdown. socket.close() merely releases", "#the socket and waits for GC to perform the actual close.", "request", ".", "shutdown", "(", "socket", ".", "SHUT_WR", ")", "except", "OSE...
https://github.com/IronLanguages/ironpython3/blob/7a7bb2a872eeab0d1009fc8a6e24dca43f65b693/Src/StdLib/Lib/socketserver.py#L479-L487
pwnieexpress/pwn_plug_sources
1a23324f5dc2c3de20f9c810269b6a29b2758cad
src/metagoofil/hachoir_parser/misc/lnk.py
python
NetworkVolumeTable.createFields
(self)
[]
def createFields(self): yield UInt32(self, "length", "Length of this structure") yield UInt32(self, "unknown[]") yield UInt32(self, "share_name_offset", "Offset to share name") yield UInt32(self, "unknown[]") yield UInt32(self, "unknown[]") padding = self.seekByte(self["s...
[ "def", "createFields", "(", "self", ")", ":", "yield", "UInt32", "(", "self", ",", "\"length\"", ",", "\"Length of this structure\"", ")", "yield", "UInt32", "(", "self", ",", "\"unknown[]\"", ")", "yield", "UInt32", "(", "self", ",", "\"share_name_offset\"", ...
https://github.com/pwnieexpress/pwn_plug_sources/blob/1a23324f5dc2c3de20f9c810269b6a29b2758cad/src/metagoofil/hachoir_parser/misc/lnk.py#L180-L189
sony/nnabla-examples
068be490aacf73740502a1c3b10f8b2d15a52d32
GANs/jsigan/ops.py
python
dyn_2d_up_operation
(x, lf_2d, k_sz, sf=2)
return y
Dynamic 2d upsampling
Dynamic 2d upsampling
[ "Dynamic", "2d", "upsampling" ]
def dyn_2d_up_operation(x, lf_2d, k_sz, sf=2): """ Dynamic 2d upsampling """ with nn.parameter_scope("Dynamic_2D_Upsampling"): y = [] sz = lf_2d.shape lf_2d_new = F.reshape( lf_2d, (sz[0], sz[1], sz[2], k_sz[0] * k_sz[0], sf ** 2)) lf_2d_new = F.softmax(lf_2d_...
[ "def", "dyn_2d_up_operation", "(", "x", ",", "lf_2d", ",", "k_sz", ",", "sf", "=", "2", ")", ":", "with", "nn", ".", "parameter_scope", "(", "\"Dynamic_2D_Upsampling\"", ")", ":", "y", "=", "[", "]", "sz", "=", "lf_2d", ".", "shape", "lf_2d_new", "=", ...
https://github.com/sony/nnabla-examples/blob/068be490aacf73740502a1c3b10f8b2d15a52d32/GANs/jsigan/ops.py#L111-L127
smart-mobile-software/gitstack
d9fee8f414f202143eb6e620529e8e5539a2af56
python/Lib/site-packages/django/contrib/gis/gdal/envelope.py
python
Envelope.ur
(self)
return (self.max_x, self.max_y)
Returns the upper-right coordinate.
Returns the upper-right coordinate.
[ "Returns", "the", "upper", "-", "right", "coordinate", "." ]
def ur(self): "Returns the upper-right coordinate." return (self.max_x, self.max_y)
[ "def", "ur", "(", "self", ")", ":", "return", "(", "self", ".", "max_x", ",", "self", ".", "max_y", ")" ]
https://github.com/smart-mobile-software/gitstack/blob/d9fee8f414f202143eb6e620529e8e5539a2af56/python/Lib/site-packages/django/contrib/gis/gdal/envelope.py#L154-L156
shiweibsw/Translation-Tools
2fbbf902364e557fa7017f9a74a8797b7440c077
venv/Lib/site-packages/pip-9.0.3-py3.6.egg/pip/_vendor/distlib/_backport/tarfile.py
python
TarInfo._decode_pax_field
(self, value, encoding, fallback_encoding, fallback_errors)
Decode a single field from a pax record.
Decode a single field from a pax record.
[ "Decode", "a", "single", "field", "from", "a", "pax", "record", "." ]
def _decode_pax_field(self, value, encoding, fallback_encoding, fallback_errors): """Decode a single field from a pax record. """ try: return value.decode(encoding, "strict") except UnicodeDecodeError: return value.decode(fallback_encoding, fallback_errors)
[ "def", "_decode_pax_field", "(", "self", ",", "value", ",", "encoding", ",", "fallback_encoding", ",", "fallback_errors", ")", ":", "try", ":", "return", "value", ".", "decode", "(", "encoding", ",", "\"strict\"", ")", "except", "UnicodeDecodeError", ":", "ret...
https://github.com/shiweibsw/Translation-Tools/blob/2fbbf902364e557fa7017f9a74a8797b7440c077/venv/Lib/site-packages/pip-9.0.3-py3.6.egg/pip/_vendor/distlib/_backport/tarfile.py#L1541-L1547
falseen/PySocket
79bc2587774f8266c657d69c45e512dcd0a93892
shadowsocks/socket.py
python
socksocket._write_SOCKS5_address
(self, addr, file)
return host, port
Return the host and port packed for the SOCKS5 protocol, and the resolved address as a tuple object.
Return the host and port packed for the SOCKS5 protocol, and the resolved address as a tuple object.
[ "Return", "the", "host", "and", "port", "packed", "for", "the", "SOCKS5", "protocol", "and", "the", "resolved", "address", "as", "a", "tuple", "object", "." ]
def _write_SOCKS5_address(self, addr, file): """ Return the host and port packed for the SOCKS5 protocol, and the resolved address as a tuple object. """ host, port = addr proxy_type, _, _, rdns, username, password = self.proxy family_to_byte = {socket.AF_INET: b"...
[ "def", "_write_SOCKS5_address", "(", "self", ",", "addr", ",", "file", ")", ":", "host", ",", "port", "=", "addr", "proxy_type", ",", "_", ",", "_", ",", "rdns", ",", "username", ",", "password", "=", "self", ".", "proxy", "family_to_byte", "=", "{", ...
https://github.com/falseen/PySocket/blob/79bc2587774f8266c657d69c45e512dcd0a93892/shadowsocks/socket.py#L692-L733
moraes/tipfy
20cc0dab85f5433e399ae2d948d2b32dad051d66
tipfy/config.py
python
Config.update
(self, module, values)
Updates the configuration dictionary for a module. :param module: The module to update the configuration, e.g.: `tipfy.i18n`. :param values: A dictionary of configurations for the module.
Updates the configuration dictionary for a module.
[ "Updates", "the", "configuration", "dictionary", "for", "a", "module", "." ]
def update(self, module, values): """Updates the configuration dictionary for a module. :param module: The module to update the configuration, e.g.: `tipfy.i18n`. :param values: A dictionary of configurations for the module. """ assert isinstance(values, ...
[ "def", "update", "(", "self", ",", "module", ",", "values", ")", ":", "assert", "isinstance", "(", "values", ",", "dict", ")", ",", "'Module configuration must be a dict.'", "if", "module", "not", "in", "self", ":", "module_dict", "=", "SubConfig", "(", "mod...
https://github.com/moraes/tipfy/blob/20cc0dab85f5433e399ae2d948d2b32dad051d66/tipfy/config.py#L152-L167
PyCQA/pylint
3fc855f9d0fa8e6410be5a23cf954ffd5471b4eb
pylint/checkers/format.py
python
FormatChecker._check_multi_statement_line
(self, node, line)
Check for lines containing multiple statements.
Check for lines containing multiple statements.
[ "Check", "for", "lines", "containing", "multiple", "statements", "." ]
def _check_multi_statement_line(self, node, line): """Check for lines containing multiple statements.""" # Do not warn about multiple nested context managers # in with statements. if isinstance(node, nodes.With): return # For try... except... finally..., the two nodes...
[ "def", "_check_multi_statement_line", "(", "self", ",", "node", ",", "line", ")", ":", "# Do not warn about multiple nested context managers", "# in with statements.", "if", "isinstance", "(", "node", ",", "nodes", ".", "With", ")", ":", "return", "# For try... except.....
https://github.com/PyCQA/pylint/blob/3fc855f9d0fa8e6410be5a23cf954ffd5471b4eb/pylint/checkers/format.py#L633-L669
log2timeline/dftimewolf
18b4d0760d6a6ca378ac06c2242d04a0d8caf072
dftimewolf/lib/enhancers/timesketch.py
python
TimesketchEnhancer._GenerateStoryString
( self, stories: List["ts_story.Story"], sketch_url: str)
return '\n'.join(story_strings)
Returns a string with story data. The function runs through all saved stories in a sketch and returns back a formatted string with an overview of all stored stories. Args: stories (list): a list of Story objects (timesketch_api.story.Story). sketch_url (str): the full URL to the sketch. R...
Returns a string with story data.
[ "Returns", "a", "string", "with", "story", "data", "." ]
def _GenerateStoryString( self, stories: List["ts_story.Story"], sketch_url: str) -> str: """Returns a string with story data. The function runs through all saved stories in a sketch and returns back a formatted string with an overview of all stored stories. Args: stories (list): a list of...
[ "def", "_GenerateStoryString", "(", "self", ",", "stories", ":", "List", "[", "\"ts_story.Story\"", "]", ",", "sketch_url", ":", "str", ")", "->", "str", ":", "story_strings", "=", "[", "]", "for", "story", "in", "stories", ":", "story_url", "=", "'{0:s}st...
https://github.com/log2timeline/dftimewolf/blob/18b4d0760d6a6ca378ac06c2242d04a0d8caf072/dftimewolf/lib/enhancers/timesketch.py#L197-L218
hyperledger/indy-plenum
7566f960f86d8ce74a26fa6ccbd534b942fc4223
plenum/server/propagator.py
python
Propagator.request_propagates
(self, request_list: RequestPropagates)
return i
Request PROPAGATEs for the given request keys. Since replicas can request PROPAGATEs independently of each other, check if it has been requested recently :param req_keys: :return:
Request PROPAGATEs for the given request keys. Since replicas can request PROPAGATEs independently of each other, check if it has been requested recently :param req_keys: :return:
[ "Request", "PROPAGATEs", "for", "the", "given", "request", "keys", ".", "Since", "replicas", "can", "request", "PROPAGATEs", "independently", "of", "each", "other", "check", "if", "it", "has", "been", "requested", "recently", ":", "param", "req_keys", ":", ":"...
def request_propagates(self, request_list: RequestPropagates): """ Request PROPAGATEs for the given request keys. Since replicas can request PROPAGATEs independently of each other, check if it has been requested recently :param req_keys: :return: """ req_k...
[ "def", "request_propagates", "(", "self", ",", "request_list", ":", "RequestPropagates", ")", ":", "req_keys", "=", "request_list", ".", "bad_requests", "i", "=", "0", "for", "digest", "in", "req_keys", ":", "if", "digest", "not", "in", "self", ".", "request...
https://github.com/hyperledger/indy-plenum/blob/7566f960f86d8ce74a26fa6ccbd534b942fc4223/plenum/server/propagator.py#L316-L342
spack/spack
675210bd8bd1c5d32ad1cc83d898fb43b569ed74
lib/spack/spack/schema/env.py
python
update
(data)
return False
Update the data in place to remove deprecated properties. Args: data (dict): dictionary to be updated Returns: True if data was changed, False otherwise
Update the data in place to remove deprecated properties.
[ "Update", "the", "data", "in", "place", "to", "remove", "deprecated", "properties", "." ]
def update(data): """Update the data in place to remove deprecated properties. Args: data (dict): dictionary to be updated Returns: True if data was changed, False otherwise """ if 'include' in data: msg = ("included configuration files should be updated manually" ...
[ "def", "update", "(", "data", ")", ":", "if", "'include'", "in", "data", ":", "msg", "=", "(", "\"included configuration files should be updated manually\"", "\" [files={0}]\"", ")", "warnings", ".", "warn", "(", "msg", ".", "format", "(", "', '", ".", "join", ...
https://github.com/spack/spack/blob/675210bd8bd1c5d32ad1cc83d898fb43b569ed74/lib/spack/spack/schema/env.py#L163-L179
omz/PythonistaAppTemplate
f560f93f8876d82a21d108977f90583df08d55af
PythonistaAppTemplate/PythonistaKit.framework/pylib_ext/matplotlib/cbook.py
python
align_iterators
(func, *iterables)
This generator takes a bunch of iterables that are ordered by func It sends out ordered tuples:: (func(row), [rows from all iterators matching func(row)]) It is used by :func:`matplotlib.mlab.recs_join` to join record arrays
This generator takes a bunch of iterables that are ordered by func It sends out ordered tuples::
[ "This", "generator", "takes", "a", "bunch", "of", "iterables", "that", "are", "ordered", "by", "func", "It", "sends", "out", "ordered", "tuples", "::" ]
def align_iterators(func, *iterables): """ This generator takes a bunch of iterables that are ordered by func It sends out ordered tuples:: (func(row), [rows from all iterators matching func(row)]) It is used by :func:`matplotlib.mlab.recs_join` to join record arrays """ class myiter: ...
[ "def", "align_iterators", "(", "func", ",", "*", "iterables", ")", ":", "class", "myiter", ":", "def", "__init__", "(", "self", ",", "it", ")", ":", "self", ".", "it", "=", "it", "self", ".", "key", "=", "self", ".", "value", "=", "None", "self", ...
https://github.com/omz/PythonistaAppTemplate/blob/f560f93f8876d82a21d108977f90583df08d55af/PythonistaAppTemplate/PythonistaKit.framework/pylib_ext/matplotlib/cbook.py#L1877-L1918
JiYou/openstack
8607dd488bde0905044b303eb6e52bdea6806923
packages/source/ceilometer/ceilometer/openstack/common/rpc/impl_fake.py
python
call
(conf, context, topic, msg, timeout=None)
return rv[-1]
Sends a message on a topic and wait for a response.
Sends a message on a topic and wait for a response.
[ "Sends", "a", "message", "on", "a", "topic", "and", "wait", "for", "a", "response", "." ]
def call(conf, context, topic, msg, timeout=None): """Sends a message on a topic and wait for a response.""" rv = multicall(conf, context, topic, msg, timeout) # NOTE(vish): return the last result from the multicall rv = list(rv) if not rv: return return rv[-1]
[ "def", "call", "(", "conf", ",", "context", ",", "topic", ",", "msg", ",", "timeout", "=", "None", ")", ":", "rv", "=", "multicall", "(", "conf", ",", "context", ",", "topic", ",", "msg", ",", "timeout", ")", "# NOTE(vish): return the last result from the ...
https://github.com/JiYou/openstack/blob/8607dd488bde0905044b303eb6e52bdea6806923/packages/source/ceilometer/ceilometer/openstack/common/rpc/impl_fake.py#L155-L162
openshift/openshift-tools
1188778e728a6e4781acf728123e5b356380fe6f
openshift/installer/vendored/openshift-ansible-3.10.0-0.29.0/roles/lib_openshift/library/oc_adm_policy_group.py
python
Yedit.read
(self)
return contents
read from file
read from file
[ "read", "from", "file" ]
def read(self): ''' read from file ''' # check if it exists if self.filename is None or not self.file_exists(): return None contents = None with open(self.filename) as yfd: contents = yfd.read() return contents
[ "def", "read", "(", "self", ")", ":", "# check if it exists", "if", "self", ".", "filename", "is", "None", "or", "not", "self", ".", "file_exists", "(", ")", ":", "return", "None", "contents", "=", "None", "with", "open", "(", "self", ".", "filename", ...
https://github.com/openshift/openshift-tools/blob/1188778e728a6e4781acf728123e5b356380fe6f/openshift/installer/vendored/openshift-ansible-3.10.0-0.29.0/roles/lib_openshift/library/oc_adm_policy_group.py#L381-L391
aleju/imgaug
0101108d4fed06bc5056c4a03e2bcb0216dac326
imgaug/augmenters/imgcorruptlike.py
python
Contrast.__init__
(self, severity=(1, 5), seed=None, name=None, random_state="deprecated", deterministic="deprecated")
[]
def __init__(self, severity=(1, 5), seed=None, name=None, random_state="deprecated", deterministic="deprecated"): super(Contrast, self).__init__( apply_contrast, severity, seed=seed, name=name, random_state=random_state, deterministic=determi...
[ "def", "__init__", "(", "self", ",", "severity", "=", "(", "1", ",", "5", ")", ",", "seed", "=", "None", ",", "name", "=", "None", ",", "random_state", "=", "\"deprecated\"", ",", "deterministic", "=", "\"deprecated\"", ")", ":", "super", "(", "Contras...
https://github.com/aleju/imgaug/blob/0101108d4fed06bc5056c4a03e2bcb0216dac326/imgaug/augmenters/imgcorruptlike.py#L1868-L1874
mininet/mininet
8a50d3867c49781c60b6171acc6e4b46954b4281
mininet/topo.py
python
Topo.setlinkInfo
( self, src, dst, info, key=None )
Set link metadata dict
Set link metadata dict
[ "Set", "link", "metadata", "dict" ]
def setlinkInfo( self, src, dst, info, key=None ): "Set link metadata dict" entry, key = self._linkEntry( src, dst, key ) entry[ key ] = info
[ "def", "setlinkInfo", "(", "self", ",", "src", ",", "dst", ",", "info", ",", "key", "=", "None", ")", ":", "entry", ",", "key", "=", "self", ".", "_linkEntry", "(", "src", ",", "dst", ",", "key", ")", "entry", "[", "key", "]", "=", "info" ]
https://github.com/mininet/mininet/blob/8a50d3867c49781c60b6171acc6e4b46954b4281/mininet/topo.py#L267-L270
Pylons/pyramid_cookbook
19b62fb7c36a2b8c5866df784fda0ccd04805995
docs/traversal_tutorial/zodb/tutorial/views.py
python
TutorialViews.folder
(self)
return dict(page_title=page_title)
[]
def folder(self): page_title = 'Quick Tutorial: Folder' return dict(page_title=page_title)
[ "def", "folder", "(", "self", ")", ":", "page_title", "=", "'Quick Tutorial: Folder'", "return", "dict", "(", "page_title", "=", "page_title", ")" ]
https://github.com/Pylons/pyramid_cookbook/blob/19b62fb7c36a2b8c5866df784fda0ccd04805995/docs/traversal_tutorial/zodb/tutorial/views.py#L28-L30
nsacyber/WALKOFF
52d3311abe99d64cd2a902eb998c5e398efe0e07
common/walkoff_client/walkoff_client/api_client.py
python
ApiClient.sanitize_for_serialization
(self, obj)
return {key: self.sanitize_for_serialization(val) for key, val in six.iteritems(obj_dict)}
Builds a JSON POST object. If obj is None, return None. If obj is str, int, long, float, bool, return directly. If obj is datetime.datetime, datetime.date convert to string in iso8601 format. If obj is list, sanitize each element in the list. If obj is dict, return t...
Builds a JSON POST object.
[ "Builds", "a", "JSON", "POST", "object", "." ]
def sanitize_for_serialization(self, obj): """Builds a JSON POST object. If obj is None, return None. If obj is str, int, long, float, bool, return directly. If obj is datetime.datetime, datetime.date convert to string in iso8601 format. If obj is list, sanitize each...
[ "def", "sanitize_for_serialization", "(", "self", ",", "obj", ")", ":", "if", "obj", "is", "None", ":", "return", "None", "elif", "isinstance", "(", "obj", ",", "self", ".", "PRIMITIVE_TYPES", ")", ":", "return", "obj", "elif", "isinstance", "(", "obj", ...
https://github.com/nsacyber/WALKOFF/blob/52d3311abe99d64cd2a902eb998c5e398efe0e07/common/walkoff_client/walkoff_client/api_client.py#L191-L231
HIPS/hypergrad
b10077231662b672ab5e8de05432c62ba5f063bc
experiments/Jan_25_Figure_1/4_naive_reverse/experiment.py
python
sgd3_naive
(optimizing_loss, x, v, alphas, betas, meta, fwd_callback=None, reverse_callback=None)
Same as sgd2 but simplifies things by not bothering with grads of optimizing loss (can always just pass that in as the secondary loss)
Same as sgd2 but simplifies things by not bothering with grads of optimizing loss (can always just pass that in as the secondary loss)
[ "Same", "as", "sgd2", "but", "simplifies", "things", "by", "not", "bothering", "with", "grads", "of", "optimizing", "loss", "(", "can", "always", "just", "pass", "that", "in", "as", "the", "secondary", "loss", ")" ]
def sgd3_naive(optimizing_loss, x, v, alphas, betas, meta, fwd_callback=None, reverse_callback=None): """Same as sgd2 but simplifies things by not bothering with grads of optimizing loss (can always just pass that in as the secondary loss)""" x = x.astype(np.float16) v = v.astype(np.float16) L_grad ...
[ "def", "sgd3_naive", "(", "optimizing_loss", ",", "x", ",", "v", ",", "alphas", ",", "betas", ",", "meta", ",", "fwd_callback", "=", "None", ",", "reverse_callback", "=", "None", ")", ":", "x", "=", "x", ".", "astype", "(", "np", ".", "float16", ")",...
https://github.com/HIPS/hypergrad/blob/b10077231662b672ab5e8de05432c62ba5f063bc/experiments/Jan_25_Figure_1/4_naive_reverse/experiment.py#L39-L65
shidenggui/easytrader
dbb166564c6c73da3446588a19d2692ad52716cb
easytrader/clienttrader.py
python
ClientTrader._type_keys
(self, control_id, text)
[]
def _type_keys(self, control_id, text): self._main.child_window(control_id=control_id, class_name="Edit").set_edit_text( text )
[ "def", "_type_keys", "(", "self", ",", "control_id", ",", "text", ")", ":", "self", ".", "_main", ".", "child_window", "(", "control_id", "=", "control_id", ",", "class_name", "=", "\"Edit\"", ")", ".", "set_edit_text", "(", "text", ")" ]
https://github.com/shidenggui/easytrader/blob/dbb166564c6c73da3446588a19d2692ad52716cb/easytrader/clienttrader.py#L492-L495
dimagi/commcare-hq
d67ff1d3b4c51fa050c19e60c3253a79d3452a39
corehq/apps/auditcare/middleware.py
python
AuditMiddleware.__call__
(self, request)
return response
[]
def __call__(self, request): response = None try: response = self.get_response(request) finally: self._save_audit(request, response) return response
[ "def", "__call__", "(", "self", ",", "request", ")", ":", "response", "=", "None", "try", ":", "response", "=", "self", ".", "get_response", "(", "request", ")", "finally", ":", "self", ".", "_save_audit", "(", "request", ",", "response", ")", "return", ...
https://github.com/dimagi/commcare-hq/blob/d67ff1d3b4c51fa050c19e60c3253a79d3452a39/corehq/apps/auditcare/middleware.py#L44-L50
sagemath/sage
f9b2db94f675ff16963ccdefba4f1a3393b3fe0d
src/sage/schemes/generic/algebraic_scheme.py
python
AlgebraicScheme._point
(self, *args, **kwds)
return self.__A._point(*args, **kwds)
r""" Construct a point of ``self``. For internal use only. TESTS:: sage: P2.<x,y,z> = ProjectiveSpace(2, QQ) sage: point_homset = P2._point_homset(Spec(QQ), P2) sage: P2._point(point_homset, [1,2,1]) (1 : 2 : 1)
r""" Construct a point of ``self``. For internal use only.
[ "r", "Construct", "a", "point", "of", "self", ".", "For", "internal", "use", "only", "." ]
def _point(self, *args, **kwds): r""" Construct a point of ``self``. For internal use only. TESTS:: sage: P2.<x,y,z> = ProjectiveSpace(2, QQ) sage: point_homset = P2._point_homset(Spec(QQ), P2) sage: P2._point(point_homset, [1,2,1]) (1 : 2 : 1) ...
[ "def", "_point", "(", "self", ",", "*", "args", ",", "*", "*", "kwds", ")", ":", "return", "self", ".", "__A", ".", "_point", "(", "*", "args", ",", "*", "*", "kwds", ")" ]
https://github.com/sagemath/sage/blob/f9b2db94f675ff16963ccdefba4f1a3393b3fe0d/src/sage/schemes/generic/algebraic_scheme.py#L579-L590
ailabx/ailabx
4a8c701a3604bbc34157167224588041944ac1a2
codes/qlib-main/scripts/data_collector/us_index/collector.py
python
WIKIIndex.get_changes
(self)
get companies changes Returns ------- pd.DataFrame: symbol date type SH600000 2019-11-11 add SH600000 2020-11-10 remove dtypes: symbol: str date: pd.Timestamp type...
get companies changes
[ "get", "companies", "changes" ]
def get_changes(self) -> pd.DataFrame: """get companies changes Returns ------- pd.DataFrame: symbol date type SH600000 2019-11-11 add SH600000 2020-11-10 remove dtypes: symbol: str ...
[ "def", "get_changes", "(", "self", ")", "->", "pd", ".", "DataFrame", ":", "raise", "NotImplementedError", "(", "\"rewrite get_changes\"", ")" ]
https://github.com/ailabx/ailabx/blob/4a8c701a3604bbc34157167224588041944ac1a2/codes/qlib-main/scripts/data_collector/us_index/collector.py#L58-L72
playframework/play1
0ecac3bc2421ae2dbec27a368bf671eda1c9cba5
python/Lib/nntplib.py
python
NNTP.date
(self)
return resp, date, time
Process the DATE command. Arguments: None Returns: resp: server response if successful date: Date suitable for newnews/newgroups commands etc. time: Time suitable for newnews/newgroups commands etc.
Process the DATE command. Arguments: None Returns: resp: server response if successful date: Date suitable for newnews/newgroups commands etc. time: Time suitable for newnews/newgroups commands etc.
[ "Process", "the", "DATE", "command", ".", "Arguments", ":", "None", "Returns", ":", "resp", ":", "server", "response", "if", "successful", "date", ":", "Date", "suitable", "for", "newnews", "/", "newgroups", "commands", "etc", ".", "time", ":", "Time", "su...
def date (self): """Process the DATE command. Arguments: None Returns: resp: server response if successful date: Date suitable for newnews/newgroups commands etc. time: Time suitable for newnews/newgroups commands etc.""" resp = self.shortcmd("DATE") if r...
[ "def", "date", "(", "self", ")", ":", "resp", "=", "self", ".", "shortcmd", "(", "\"DATE\"", ")", "if", "resp", "[", ":", "3", "]", "!=", "'111'", ":", "raise", "NNTPReplyError", "(", "resp", ")", "elem", "=", "resp", ".", "split", "(", ")", "if"...
https://github.com/playframework/play1/blob/0ecac3bc2421ae2dbec27a368bf671eda1c9cba5/python/Lib/nntplib.py#L537-L555
wrye-bash/wrye-bash
d495c47cfdb44475befa523438a40c4419cb386f
Mopy/bash/gui/checkables.py
python
_ACheckable.is_blocked
(self)
return bool(self._block_user_func)
Returns True if user interaction for this component is blocked.
Returns True if user interaction for this component is blocked.
[ "Returns", "True", "if", "user", "interaction", "for", "this", "component", "is", "blocked", "." ]
def is_blocked(self): """Returns True if user interaction for this component is blocked.""" return bool(self._block_user_func)
[ "def", "is_blocked", "(", "self", ")", ":", "return", "bool", "(", "self", ".", "_block_user_func", ")" ]
https://github.com/wrye-bash/wrye-bash/blob/d495c47cfdb44475befa523438a40c4419cb386f/Mopy/bash/gui/checkables.py#L77-L79
microsoft/ptvsd
99c8513921021d2cc7cd82e132b65c644c256768
src/ptvsd/_vendored/pydevd/pydevd_attach_to_process/winappdbg/debug.py
python
Debug.__enter__
(self)
return self
Compatibility with the "C{with}" Python statement.
Compatibility with the "C{with}" Python statement.
[ "Compatibility", "with", "the", "C", "{", "with", "}", "Python", "statement", "." ]
def __enter__(self): """ Compatibility with the "C{with}" Python statement. """ return self
[ "def", "__enter__", "(", "self", ")", ":", "return", "self" ]
https://github.com/microsoft/ptvsd/blob/99c8513921021d2cc7cd82e132b65c644c256768/src/ptvsd/_vendored/pydevd/pydevd_attach_to_process/winappdbg/debug.py#L173-L177
sagemath/sage
f9b2db94f675ff16963ccdefba4f1a3393b3fe0d
src/sage/tensor/modules/tensor_with_indices.py
python
TensorWithIndices.__pos__
(self)
return TensorWithIndices(+self._tensor, self._con + '_' + self._cov)
r""" Unary plus operator. OUTPUT: - an exact copy of ``self`` EXAMPLES:: sage: from sage.tensor.modules.tensor_with_indices import TensorWithIndices sage: M = FiniteRankFreeModule(QQ, 3, name='M') sage: e = M.basis('e') sage: a = M.tens...
r""" Unary plus operator.
[ "r", "Unary", "plus", "operator", "." ]
def __pos__(self): r""" Unary plus operator. OUTPUT: - an exact copy of ``self`` EXAMPLES:: sage: from sage.tensor.modules.tensor_with_indices import TensorWithIndices sage: M = FiniteRankFreeModule(QQ, 3, name='M') sage: e = M.basis('e') ...
[ "def", "__pos__", "(", "self", ")", ":", "return", "TensorWithIndices", "(", "+", "self", ".", "_tensor", ",", "self", ".", "_con", "+", "'_'", "+", "self", ".", "_cov", ")" ]
https://github.com/sagemath/sage/blob/f9b2db94f675ff16963ccdefba4f1a3393b3fe0d/src/sage/tensor/modules/tensor_with_indices.py#L1014-L1037
nvaccess/nvda
20d5a25dced4da34338197f0ef6546270ebca5d0
source/NVDAObjects/UIA/__init__.py
python
UIATextInfo._get_controlFieldNVDAObjectClass
(self)
return UIA
The NVDAObject class to be used by the _getTextWithFieldsForUIARange method when instantiating NVDAObjects in order to generate control fields for content. L{UIA} is usually what you want, but if you know the class will always mutate to a certain subclass (E.g. WordDocumentNode) then performance gains can be made by ...
The NVDAObject class to be used by the _getTextWithFieldsForUIARange method when instantiating NVDAObjects in order to generate control fields for content. L{UIA} is usually what you want, but if you know the class will always mutate to a certain subclass (E.g. WordDocumentNode) then performance gains can be made by ...
[ "The", "NVDAObject", "class", "to", "be", "used", "by", "the", "_getTextWithFieldsForUIARange", "method", "when", "instantiating", "NVDAObjects", "in", "order", "to", "generate", "control", "fields", "for", "content", ".", "L", "{", "UIA", "}", "is", "usually", ...
def _get_controlFieldNVDAObjectClass(self): """ The NVDAObject class to be used by the _getTextWithFieldsForUIARange method when instantiating NVDAObjects in order to generate control fields for content. L{UIA} is usually what you want, but if you know the class will always mutate to a certain subclass (E.g. Word...
[ "def", "_get_controlFieldNVDAObjectClass", "(", "self", ")", ":", "return", "UIA" ]
https://github.com/nvaccess/nvda/blob/20d5a25dced4da34338197f0ef6546270ebca5d0/source/NVDAObjects/UIA/__init__.py#L69-L74
openhatch/oh-mainline
ce29352a034e1223141dcc2f317030bbc3359a51
vendor/packages/celery/celery/backends/base.py
python
BaseBackend.mark_as_started
(self, task_id, **meta)
return self.store_result(task_id, meta, status=states.STARTED)
Mark a task as started
Mark a task as started
[ "Mark", "a", "task", "as", "started" ]
def mark_as_started(self, task_id, **meta): """Mark a task as started""" return self.store_result(task_id, meta, status=states.STARTED)
[ "def", "mark_as_started", "(", "self", ",", "task_id", ",", "*", "*", "meta", ")", ":", "return", "self", ".", "store_result", "(", "task_id", ",", "meta", ",", "status", "=", "states", ".", "STARTED", ")" ]
https://github.com/openhatch/oh-mainline/blob/ce29352a034e1223141dcc2f317030bbc3359a51/vendor/packages/celery/celery/backends/base.py#L82-L84
robclewley/pydstool
939e3abc9dd1f180d35152bacbde57e24c85ff26
PyDSTool/PyCont/misc.py
python
getFlowMaps
(n, pt, pttype, method='standard')
return maps, ntst
method: 'standard' is currently the only working method for calculating the flow maps.
method: 'standard' is currently the only working method for calculating the flow maps.
[ "method", ":", "standard", "is", "currently", "the", "only", "working", "method", "for", "calculating", "the", "flow", "maps", "." ]
def getFlowMaps(n, pt, pttype, method='standard'): """ method: 'standard' is currently the only working method for calculating the flow maps. """ try: flow = pt.labels[pttype]['flow'] # flow maps (matrices) except: raise RuntimeError("Malformed point -- no flow map informatio...
[ "def", "getFlowMaps", "(", "n", ",", "pt", ",", "pttype", ",", "method", "=", "'standard'", ")", ":", "try", ":", "flow", "=", "pt", ".", "labels", "[", "pttype", "]", "[", "'flow'", "]", "# flow maps (matrices)", "except", ":", "raise", "RuntimeError", ...
https://github.com/robclewley/pydstool/blob/939e3abc9dd1f180d35152bacbde57e24c85ff26/PyDSTool/PyCont/misc.py#L473-L494
deanishe/alfred-fakeum
12a7e64d9c099c0f11416ee99fae064d6360aab2
src/libs/ipaddress.py
python
_BaseNetwork.is_reserved
(self)
return (self.network_address.is_reserved and self.broadcast_address.is_reserved)
Test if the address is otherwise IETF reserved. Returns: A boolean, True if the address is within one of the reserved IPv6 Network ranges.
Test if the address is otherwise IETF reserved.
[ "Test", "if", "the", "address", "is", "otherwise", "IETF", "reserved", "." ]
def is_reserved(self): """Test if the address is otherwise IETF reserved. Returns: A boolean, True if the address is within one of the reserved IPv6 Network ranges. """ return (self.network_address.is_reserved and self.broadcast_address.is_reserv...
[ "def", "is_reserved", "(", "self", ")", ":", "return", "(", "self", ".", "network_address", ".", "is_reserved", "and", "self", ".", "broadcast_address", ".", "is_reserved", ")" ]
https://github.com/deanishe/alfred-fakeum/blob/12a7e64d9c099c0f11416ee99fae064d6360aab2/src/libs/ipaddress.py#L1122-L1131
cronyo/cronyo
cd5abab0871b68bf31b18aac934303928130a441
cronyo/vendor/yaml/parser.py
python
Parser.get_event
(self)
return value
[]
def get_event(self): # Get the next event and proceed further. if self.current_event is None: if self.state: self.current_event = self.state() value = self.current_event self.current_event = None return value
[ "def", "get_event", "(", "self", ")", ":", "# Get the next event and proceed further.", "if", "self", ".", "current_event", "is", "None", ":", "if", "self", ".", "state", ":", "self", ".", "current_event", "=", "self", ".", "state", "(", ")", "value", "=", ...
https://github.com/cronyo/cronyo/blob/cd5abab0871b68bf31b18aac934303928130a441/cronyo/vendor/yaml/parser.py#L114-L121
holzschu/Carnets
44effb10ddfc6aa5c8b0687582a724ba82c6b547
Library/lib/python3.7/importlib/_bootstrap_external.py
python
ExtensionFileLoader.get_filename
(self, fullname)
return self.path
Return the path to the source file as found by the finder.
Return the path to the source file as found by the finder.
[ "Return", "the", "path", "to", "the", "source", "file", "as", "found", "by", "the", "finder", "." ]
def get_filename(self, fullname): """Return the path to the source file as found by the finder.""" return self.path
[ "def", "get_filename", "(", "self", ",", "fullname", ")", ":", "return", "self", ".", "path" ]
https://github.com/holzschu/Carnets/blob/44effb10ddfc6aa5c8b0687582a724ba82c6b547/Library/lib/python3.7/importlib/_bootstrap_external.py#L1069-L1071
tensorpack/dataflow
4ac75d6b000c887b68bbc4ace11c57a47eff662c
dataflow/dataflow/parallel_map.py
python
MultiThreadMapData.__init__
(self, ds, num_thread=None, map_func=None, *, buffer_size=200, strict=False)
Args: ds (DataFlow): the dataflow to map num_thread (int): number of threads to use map_func (callable): datapoint -> datapoint | None. Return None to discard/skip the datapoint. buffer_size (int): number of datapoints in the buffer strict (boo...
Args: ds (DataFlow): the dataflow to map num_thread (int): number of threads to use map_func (callable): datapoint -> datapoint | None. Return None to discard/skip the datapoint. buffer_size (int): number of datapoints in the buffer strict (boo...
[ "Args", ":", "ds", "(", "DataFlow", ")", ":", "the", "dataflow", "to", "map", "num_thread", "(", "int", ")", ":", "number", "of", "threads", "to", "use", "map_func", "(", "callable", ")", ":", "datapoint", "-", ">", "datapoint", "|", "None", ".", "Re...
def __init__(self, ds, num_thread=None, map_func=None, *, buffer_size=200, strict=False): """ Args: ds (DataFlow): the dataflow to map num_thread (int): number of threads to use map_func (callable): datapoint -> datapoint | None. Return None to discard...
[ "def", "__init__", "(", "self", ",", "ds", ",", "num_thread", "=", "None", ",", "map_func", "=", "None", ",", "*", ",", "buffer_size", "=", "200", ",", "strict", "=", "False", ")", ":", "if", "strict", ":", "# In strict mode, buffer size cannot be larger tha...
https://github.com/tensorpack/dataflow/blob/4ac75d6b000c887b68bbc4ace11c57a47eff662c/dataflow/dataflow/parallel_map.py#L145-L169
guildai/guildai
1665985a3d4d788efc1a3180ca51cc417f71ca78
guild/external/setuptools/command/easy_install.py
python
WindowsScriptWriter._get_script_args
(cls, type_, name, header, script_text)
For Windows, add a .py extension
For Windows, add a .py extension
[ "For", "Windows", "add", "a", ".", "py", "extension" ]
def _get_script_args(cls, type_, name, header, script_text): "For Windows, add a .py extension" ext = dict(console='.pya', gui='.pyw')[type_] if ext not in os.environ['PATHEXT'].lower().split(';'): msg = ( "{ext} not listed in PATHEXT; scripts will not be " ...
[ "def", "_get_script_args", "(", "cls", ",", "type_", ",", "name", ",", "header", ",", "script_text", ")", ":", "ext", "=", "dict", "(", "console", "=", "'.pya'", ",", "gui", "=", "'.pyw'", ")", "[", "type_", "]", "if", "ext", "not", "in", "os", "."...
https://github.com/guildai/guildai/blob/1665985a3d4d788efc1a3180ca51cc417f71ca78/guild/external/setuptools/command/easy_install.py#L2180-L2193
realpython/book2-exercises
cde325eac8e6d8cff2316601c2e5b36bb46af7d0
web2py/scripts/extract_pgsql_models.py
python
define_field
(conn, table, field, pks)
return f
Determine field type, default value, references, etc.
Determine field type, default value, references, etc.
[ "Determine", "field", "type", "default", "value", "references", "etc", "." ]
def define_field(conn, table, field, pks): "Determine field type, default value, references, etc." f = {} ref = references(conn, table, field['column_name']) if ref: f.update(ref) elif field['column_default'] and \ field['column_default'].startswith("nextval") and \ field...
[ "def", "define_field", "(", "conn", ",", "table", ",", "field", ",", "pks", ")", ":", "f", "=", "{", "}", "ref", "=", "references", "(", "conn", ",", "table", ",", "field", "[", "'column_name'", "]", ")", "if", "ref", ":", "f", ".", "update", "("...
https://github.com/realpython/book2-exercises/blob/cde325eac8e6d8cff2316601c2e5b36bb46af7d0/web2py/scripts/extract_pgsql_models.py#L94-L157
jython/frozen-mirror
b8d7aa4cee50c0c0fe2f4b235dd62922dd0f3f99
lib-python/2.7/plat-mac/findertools.py
python
_setlabel
(object_alias, index)
return index
label: Set the label for the object.
label: Set the label for the object.
[ "label", ":", "Set", "the", "label", "for", "the", "object", "." ]
def _setlabel(object_alias, index): """label: Set the label for the object.""" finder = _getfinder() args = {} attrs = {} _code = 'core' _subcode = 'setd' aeobj_0 = aetypes.ObjectSpecifier(want=aetypes.Type('prop'), form="alis", seld=object_alias, fr=None) aeobj_1 = aetypes.O...
[ "def", "_setlabel", "(", "object_alias", ",", "index", ")", ":", "finder", "=", "_getfinder", "(", ")", "args", "=", "{", "}", "attrs", "=", "{", "}", "_code", "=", "'core'", "_subcode", "=", "'setd'", "aeobj_0", "=", "aetypes", ".", "ObjectSpecifier", ...
https://github.com/jython/frozen-mirror/blob/b8d7aa4cee50c0c0fe2f4b235dd62922dd0f3f99/lib-python/2.7/plat-mac/findertools.py#L356-L372
cheind/py-motmetrics
6597e8a4ed398b9f14880fa76de26bc43d230836
motmetrics/metrics.py
python
num_frames
(df)
return df.full.index.get_level_values(0).unique().shape[0]
Total number of frames.
Total number of frames.
[ "Total", "number", "of", "frames", "." ]
def num_frames(df): """Total number of frames.""" return df.full.index.get_level_values(0).unique().shape[0]
[ "def", "num_frames", "(", "df", ")", ":", "return", "df", ".", "full", ".", "index", ".", "get_level_values", "(", "0", ")", ".", "unique", "(", ")", ".", "shape", "[", "0", "]" ]
https://github.com/cheind/py-motmetrics/blob/6597e8a4ed398b9f14880fa76de26bc43d230836/motmetrics/metrics.py#L340-L342
plotly/plotly.py
cfad7862594b35965c0e000813bd7805e8494a5b
packages/python/plotly/plotly/graph_objs/_figure.py
python
Figure.update_smiths
( self, patch=None, selector=None, overwrite=False, row=None, col=None, **kwargs )
return self
Perform a property update operation on all smith objects that satisfy the specified selection criteria Parameters ---------- patch: dict Dictionary of property updates to be applied to all smith objects that satisfy the selection criteria. selector: dict,...
Perform a property update operation on all smith objects that satisfy the specified selection criteria
[ "Perform", "a", "property", "update", "operation", "on", "all", "smith", "objects", "that", "satisfy", "the", "specified", "selection", "criteria" ]
def update_smiths( self, patch=None, selector=None, overwrite=False, row=None, col=None, **kwargs ): """ Perform a property update operation on all smith objects that satisfy the specified selection criteria Parameters ---------- patch: dict Dicti...
[ "def", "update_smiths", "(", "self", ",", "patch", "=", "None", ",", "selector", "=", "None", ",", "overwrite", "=", "False", ",", "row", "=", "None", ",", "col", "=", "None", ",", "*", "*", "kwargs", ")", ":", "for", "obj", "in", "self", ".", "s...
https://github.com/plotly/plotly.py/blob/cfad7862594b35965c0e000813bd7805e8494a5b/packages/python/plotly/plotly/graph_objs/_figure.py#L20557-L20601
gammapy/gammapy
735b25cd5bbed35e2004d633621896dcd5295e8b
gammapy/maps/hpx/io.py
python
HpxConv.identify_hpx_format
(header)
Identify the convention used to write this file.
Identify the convention used to write this file.
[ "Identify", "the", "convention", "used", "to", "write", "this", "file", "." ]
def identify_hpx_format(header): """Identify the convention used to write this file.""" # Hopefully the file contains the HPX_CONV keyword specifying # the convention used if "HPX_CONV" in header: return header["HPX_CONV"].lower() # Try based on the EXTNAME keyword ...
[ "def", "identify_hpx_format", "(", "header", ")", ":", "# Hopefully the file contains the HPX_CONV keyword specifying", "# the convention used", "if", "\"HPX_CONV\"", "in", "header", ":", "return", "header", "[", "\"HPX_CONV\"", "]", ".", "lower", "(", ")", "# Try based o...
https://github.com/gammapy/gammapy/blob/735b25cd5bbed35e2004d633621896dcd5295e8b/gammapy/maps/hpx/io.py#L24-L61
Yelp/mrjob
091572e87bc24cc64be40278dd0f5c3617c98d4b
mrjob/runner.py
python
MRJobRunner._check_input_path
(self, path)
Raise :py:class:`IOError` if the given input does not exist or is otherwise invalid. Override this to provide custom check behavior.
Raise :py:class:`IOError` if the given input does not exist or is otherwise invalid. Override this to provide custom check behavior.
[ "Raise", ":", "py", ":", "class", ":", "IOError", "if", "the", "given", "input", "does", "not", "exist", "or", "is", "otherwise", "invalid", ".", "Override", "this", "to", "provide", "custom", "check", "behavior", "." ]
def _check_input_path(self, path): """Raise :py:class:`IOError` if the given input does not exist or is otherwise invalid. Override this to provide custom check behavior.""" if path == '-': return # STDIN always exists if not self.fs.can_handle_path(path): ...
[ "def", "_check_input_path", "(", "self", ",", "path", ")", ":", "if", "path", "==", "'-'", ":", "return", "# STDIN always exists", "if", "not", "self", ".", "fs", ".", "can_handle_path", "(", "path", ")", ":", "return", "# no way to check (e.g. non-S3 URIs on EM...
https://github.com/Yelp/mrjob/blob/091572e87bc24cc64be40278dd0f5c3617c98d4b/mrjob/runner.py#L1135-L1147
timonwong/OmniMarkupPreviewer
21921ac7a99d2b5924a2219b33679a5b53621392
OmniMarkupLib/Renderers/libs/python3/genshi/filters/i18n.py
python
Translator.extract
(self, stream, gettext_functions=GETTEXT_FUNCTIONS, search_text=True, comment_stack=None)
Extract localizable strings from the given template stream. For every string found, this function yields a ``(lineno, function, message, comments)`` tuple, where: * ``lineno`` is the number of the line on which the string was found, * ``function`` is the name of the ``g...
Extract localizable strings from the given template stream. For every string found, this function yields a ``(lineno, function, message, comments)`` tuple, where: * ``lineno`` is the number of the line on which the string was found, * ``function`` is the name of the ``g...
[ "Extract", "localizable", "strings", "from", "the", "given", "template", "stream", ".", "For", "every", "string", "found", "this", "function", "yields", "a", "(", "lineno", "function", "message", "comments", ")", "tuple", "where", ":", "*", "lineno", "is", "...
def extract(self, stream, gettext_functions=GETTEXT_FUNCTIONS, search_text=True, comment_stack=None): """Extract localizable strings from the given template stream. For every string found, this function yields a ``(lineno, function, message, comments)`` tuple, where: ...
[ "def", "extract", "(", "self", ",", "stream", ",", "gettext_functions", "=", "GETTEXT_FUNCTIONS", ",", "search_text", "=", "True", ",", "comment_stack", "=", "None", ")", ":", "if", "not", "self", ".", "extract_text", ":", "search_text", "=", "False", "if", ...
https://github.com/timonwong/OmniMarkupPreviewer/blob/21921ac7a99d2b5924a2219b33679a5b53621392/OmniMarkupLib/Renderers/libs/python3/genshi/filters/i18n.py#L767-L899
mihaip/readerisdead
0e35cf26e88f27e0a07432182757c1ce230f6936
third_party/web/template.py
python
Render._load_template
(self, name)
[]
def _load_template(self, name): kind, path = self._lookup(name) if kind == 'dir': return Render(path, cache=self._cache is not None, base=self._base, **self._keywords) elif kind == 'file': return Template(open(path).read(), filename=path, **self._keywords) ...
[ "def", "_load_template", "(", "self", ",", "name", ")", ":", "kind", ",", "path", "=", "self", ".", "_lookup", "(", "name", ")", "if", "kind", "==", "'dir'", ":", "return", "Render", "(", "path", ",", "cache", "=", "self", ".", "_cache", "is", "not...
https://github.com/mihaip/readerisdead/blob/0e35cf26e88f27e0a07432182757c1ce230f6936/third_party/web/template.py#L993-L1001
arthurdejong/python-stdnum
02dec52602ae0709b940b781fc1fcebfde7340b7
stdnum/us/tin.py
python
format
(number)
return number
Reformat the number to the standard presentation format.
Reformat the number to the standard presentation format.
[ "Reformat", "the", "number", "to", "the", "standard", "presentation", "format", "." ]
def format(number): """Reformat the number to the standard presentation format.""" for mod in _tin_modules: if mod.is_valid(number) and hasattr(mod, 'format'): return mod.format(number) return number
[ "def", "format", "(", "number", ")", ":", "for", "mod", "in", "_tin_modules", ":", "if", "mod", ".", "is_valid", "(", "number", ")", "and", "hasattr", "(", "mod", ",", "'format'", ")", ":", "return", "mod", ".", "format", "(", "number", ")", "return"...
https://github.com/arthurdejong/python-stdnum/blob/02dec52602ae0709b940b781fc1fcebfde7340b7/stdnum/us/tin.py#L93-L98
indigo-dc/udocker
87fb41cb5bcdb211d70f2b7f067c8e33d8959a1f
udocker/config.py
python
Config.getconf
(self, user_cfile="u.conf")
Return all configuration variables
Return all configuration variables
[ "Return", "all", "configuration", "variables" ]
def getconf(self, user_cfile="u.conf"): """Return all configuration variables""" self._file_override(user_cfile) # Override with variables in conf file self._env_override()
[ "def", "getconf", "(", "self", ",", "user_cfile", "=", "\"u.conf\"", ")", ":", "self", ".", "_file_override", "(", "user_cfile", ")", "# Override with variables in conf file", "self", ".", "_env_override", "(", ")" ]
https://github.com/indigo-dc/udocker/blob/87fb41cb5bcdb211d70f2b7f067c8e33d8959a1f/udocker/config.py#L263-L266
mrkipling/maraschino
c6be9286937783ae01df2d6d8cebfc8b2734a7d7
lib/sqlalchemy/orm/descriptor_props.py
python
CompositeProperty._create_descriptor
(self)
Create the Python descriptor that will serve as the access point on instances of the mapped class.
Create the Python descriptor that will serve as the access point on instances of the mapped class.
[ "Create", "the", "Python", "descriptor", "that", "will", "serve", "as", "the", "access", "point", "on", "instances", "of", "the", "mapped", "class", "." ]
def _create_descriptor(self): """Create the Python descriptor that will serve as the access point on instances of the mapped class. """ def fget(instance): dict_ = attributes.instance_dict(instance) state = attributes.instance_state(instance) if se...
[ "def", "_create_descriptor", "(", "self", ")", ":", "def", "fget", "(", "instance", ")", ":", "dict_", "=", "attributes", ".", "instance_dict", "(", "instance", ")", "state", "=", "attributes", ".", "instance_state", "(", "instance", ")", "if", "self", "."...
https://github.com/mrkipling/maraschino/blob/c6be9286937783ae01df2d6d8cebfc8b2734a7d7/lib/sqlalchemy/orm/descriptor_props.py#L99-L155
FateScript/CenterNet-better
972dbf2882375d54ec0e06ada21f39baaa997f0c
dl_lib/utils/memory.py
python
retry_if_cuda_oom
(func)
return wrapped
Makes a function retry itself after encountering pytorch's CUDA OOM error. It will first retry after calling `torch.cuda.empty_cache()`. If that still fails, it will then retry by trying to convert inputs to CPUs. In this case, it expects the function to dispatch to CPU implementation. The return va...
Makes a function retry itself after encountering pytorch's CUDA OOM error. It will first retry after calling `torch.cuda.empty_cache()`. If that still fails, it will then retry by trying to convert inputs to CPUs. In this case, it expects the function to dispatch to CPU implementation. The return va...
[ "Makes", "a", "function", "retry", "itself", "after", "encountering", "pytorch", "s", "CUDA", "OOM", "error", ".", "It", "will", "first", "retry", "after", "calling", "torch", ".", "cuda", ".", "empty_cache", "()", ".", "If", "that", "still", "fails", "it"...
def retry_if_cuda_oom(func): """ Makes a function retry itself after encountering pytorch's CUDA OOM error. It will first retry after calling `torch.cuda.empty_cache()`. If that still fails, it will then retry by trying to convert inputs to CPUs. In this case, it expects the function to dispatch...
[ "def", "retry_if_cuda_oom", "(", "func", ")", ":", "def", "maybe_to_cpu", "(", "x", ")", ":", "try", ":", "like_gpu_tensor", "=", "x", ".", "device", ".", "type", "==", "\"cuda\"", "and", "hasattr", "(", "x", ",", "\"to\"", ")", "except", "AttributeError...
https://github.com/FateScript/CenterNet-better/blob/972dbf2882375d54ec0e06ada21f39baaa997f0c/dl_lib/utils/memory.py#L27-L79
SanPen/GridCal
d3f4566d2d72c11c7e910c9d162538ef0e60df31
src/GridCal/Gui/GuiFunctions.py
python
PandasModel.headerData
(self, p_int, orientation, role)
return None
:param p_int: :param orientation: :param role: :return:
[]
def headerData(self, p_int, orientation, role): """ :param p_int: :param orientation: :param role: :return: """ if role == QtCore.Qt.DisplayRole: if orientation == QtCore.Qt.Horizontal: return self.cols_c[p_int] elif orient...
[ "def", "headerData", "(", "self", ",", "p_int", ",", "orientation", ",", "role", ")", ":", "if", "role", "==", "QtCore", ".", "Qt", ".", "DisplayRole", ":", "if", "orientation", "==", "QtCore", ".", "Qt", ".", "Horizontal", ":", "return", "self", ".", ...
https://github.com/SanPen/GridCal/blob/d3f4566d2d72c11c7e910c9d162538ef0e60df31/src/GridCal/Gui/GuiFunctions.py#L364-L383
kuri65536/python-for-android
26402a08fc46b09ef94e8d7a6bbc3a54ff9d0891
python-build/python-libs/gdata/src/gdata/service.py
python
GDataService.GenerateAuthSubURL
(self, next, scope, secure=False, session=True, domain='default')
return gdata.auth.generate_auth_sub_url(next, scope, secure=secure, session=session, request_url='%s/accounts/AuthSubRequest' % AUTH_SERVER_HOST, domain=domain)
Generate a URL at which the user will login and be redirected back. Users enter their credentials on a Google login page and a token is sent to the URL specified in next. See documentation for AuthSub login at: http://code.google.com/apis/accounts/docs/AuthSub.html Args: next: string The URL use...
Generate a URL at which the user will login and be redirected back.
[ "Generate", "a", "URL", "at", "which", "the", "user", "will", "login", "and", "be", "redirected", "back", "." ]
def GenerateAuthSubURL(self, next, scope, secure=False, session=True, domain='default'): """Generate a URL at which the user will login and be redirected back. Users enter their credentials on a Google login page and a token is sent to the URL specified in next. See documentation for AuthSub login a...
[ "def", "GenerateAuthSubURL", "(", "self", ",", "next", ",", "scope", ",", "secure", "=", "False", ",", "session", "=", "True", ",", "domain", "=", "'default'", ")", ":", "if", "not", "isinstance", "(", "scope", ",", "(", "list", ",", "tuple", ")", ")...
https://github.com/kuri65536/python-for-android/blob/26402a08fc46b09ef94e8d7a6bbc3a54ff9d0891/python-build/python-libs/gdata/src/gdata/service.py#L845-L867
openstack/cinder
23494a6d6c51451688191e1847a458f1d3cdcaa5
cinder/api/v3/views/volumes.py
python
ViewBuilder.detail
(self, request, volume)
return volume_ref
Detailed view of a single volume.
Detailed view of a single volume.
[ "Detailed", "view", "of", "a", "single", "volume", "." ]
def detail(self, request, volume): """Detailed view of a single volume.""" volume_ref = super(ViewBuilder, self).detail(request, volume) req_version = request.api_version_request # Add group_id if min version is greater than or equal to GROUP_VOLUME. if req_version.matches(mv.GR...
[ "def", "detail", "(", "self", ",", "request", ",", "volume", ")", ":", "volume_ref", "=", "super", "(", "ViewBuilder", ",", "self", ")", ".", "detail", "(", "request", ",", "volume", ")", "req_version", "=", "request", ".", "api_version_request", "# Add gr...
https://github.com/openstack/cinder/blob/23494a6d6c51451688191e1847a458f1d3cdcaa5/cinder/api/v3/views/volumes.py#L43-L83
ChineseGLUE/ChineseGLUE
1591b85cf5427c2ff60f718d359ecb71d2b44879
baselines/models/roberta/run_classifier.py
python
SentencePairClassificationProcessor.__init__
(self)
[]
def __init__(self): self.language = "zh"
[ "def", "__init__", "(", "self", ")", ":", "self", ".", "language", "=", "\"zh\"" ]
https://github.com/ChineseGLUE/ChineseGLUE/blob/1591b85cf5427c2ff60f718d359ecb71d2b44879/baselines/models/roberta/run_classifier.py#L639-L640
holzschu/Carnets
44effb10ddfc6aa5c8b0687582a724ba82c6b547
Library/lib/python3.7/idlelib/codecontext.py
python
CodeContext.__init__
(self, editwin)
Initialize settings for context block. editwin is the Editor window for the context block. self.text is the editor window text widget. self.textfont is the editor window font. self.context displays the code context text above the editor text. Initially None, it is toggled via...
Initialize settings for context block.
[ "Initialize", "settings", "for", "context", "block", "." ]
def __init__(self, editwin): """Initialize settings for context block. editwin is the Editor window for the context block. self.text is the editor window text widget. self.textfont is the editor window font. self.context displays the code context text above the editor text. ...
[ "def", "__init__", "(", "self", ",", "editwin", ")", ":", "self", ".", "editwin", "=", "editwin", "self", ".", "text", "=", "editwin", ".", "text", "self", ".", "textfont", "=", "self", ".", "text", "[", "\"font\"", "]", "self", ".", "contextcolors", ...
https://github.com/holzschu/Carnets/blob/44effb10ddfc6aa5c8b0687582a724ba82c6b547/Library/lib/python3.7/idlelib/codecontext.py#L48-L75
home-assistant/core
265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1
homeassistant/components/mailgun/__init__.py
python
async_setup
(hass: HomeAssistant, config: ConfigType)
return True
Set up the Mailgun component.
Set up the Mailgun component.
[ "Set", "up", "the", "Mailgun", "component", "." ]
async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool: """Set up the Mailgun component.""" if DOMAIN not in config: return True hass.data[DOMAIN] = config[DOMAIN] return True
[ "async", "def", "async_setup", "(", "hass", ":", "HomeAssistant", ",", "config", ":", "ConfigType", ")", "->", "bool", ":", "if", "DOMAIN", "not", "in", "config", ":", "return", "True", "hass", ".", "data", "[", "DOMAIN", "]", "=", "config", "[", "DOMA...
https://github.com/home-assistant/core/blob/265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1/homeassistant/components/mailgun/__init__.py#L41-L47
lunixbochs/ActualVim
1f555ce719e49d6584f0e35e9f0db2f216b98fa5
lib/asyncio/sslproto.py
python
_SSLPipe.feed_appdata
(self, data, offset=0)
return (ssldata, offset)
Feed plaintext data into the pipe. Return an (ssldata, offset) tuple. The ssldata element is a list of buffers containing record level data that needs to be sent to the remote SSL instance. The offset is the number of plaintext bytes that were processed, which may be less than the lengt...
Feed plaintext data into the pipe.
[ "Feed", "plaintext", "data", "into", "the", "pipe", "." ]
def feed_appdata(self, data, offset=0): """Feed plaintext data into the pipe. Return an (ssldata, offset) tuple. The ssldata element is a list of buffers containing record level data that needs to be sent to the remote SSL instance. The offset is the number of plaintext bytes that ...
[ "def", "feed_appdata", "(", "self", ",", "data", ",", "offset", "=", "0", ")", ":", "assert", "0", "<=", "offset", "<=", "len", "(", "data", ")", "if", "self", ".", "_state", "==", "_UNWRAPPED", ":", "# pass through data in unwrapped mode", "if", "offset",...
https://github.com/lunixbochs/ActualVim/blob/1f555ce719e49d6584f0e35e9f0db2f216b98fa5/lib/asyncio/sslproto.py#L243-L291
Azure/azure-devops-cli-extension
11334cd55806bef0b99c3bee5a438eed71e44037
azure-devops/azext_devops/devops_sdk/v5_0/client_factory.py
python
ClientFactoryV5_0.get_token_admin_client
(self)
return self._connection.get_client('azure.devops.v5_0.token_admin.token_admin_client.TokenAdminClient')
get_token_admin_client. Gets the 5.0 version of the TokenAdminClient :rtype: :class:`<TokenAdminClient> <azure.devops.v5_0.token_admin.token_admin_client.TokenAdminClient>`
get_token_admin_client. Gets the 5.0 version of the TokenAdminClient :rtype: :class:`<TokenAdminClient> <azure.devops.v5_0.token_admin.token_admin_client.TokenAdminClient>`
[ "get_token_admin_client", ".", "Gets", "the", "5", ".", "0", "version", "of", "the", "TokenAdminClient", ":", "rtype", ":", ":", "class", ":", "<TokenAdminClient", ">", "<azure", ".", "devops", ".", "v5_0", ".", "token_admin", ".", "token_admin_client", ".", ...
def get_token_admin_client(self): """get_token_admin_client. Gets the 5.0 version of the TokenAdminClient :rtype: :class:`<TokenAdminClient> <azure.devops.v5_0.token_admin.token_admin_client.TokenAdminClient>` """ return self._connection.get_client('azure.devops.v5_0.token_admin....
[ "def", "get_token_admin_client", "(", "self", ")", ":", "return", "self", ".", "_connection", ".", "get_client", "(", "'azure.devops.v5_0.token_admin.token_admin_client.TokenAdminClient'", ")" ]
https://github.com/Azure/azure-devops-cli-extension/blob/11334cd55806bef0b99c3bee5a438eed71e44037/azure-devops/azext_devops/devops_sdk/v5_0/client_factory.py#L319-L324
PowerScript/KatanaFramework
0f6ad90a88de865d58ec26941cb4460501e75496
lib/ftplib/ftplib.py
python
test
()
Test program. Usage: ftp [-d] [-r[file]] host [-l[dir]] [-d[dir]] [-p] [file] ... -d dir -l list -p password
Test program. Usage: ftp [-d] [-r[file]] host [-l[dir]] [-d[dir]] [-p] [file] ...
[ "Test", "program", ".", "Usage", ":", "ftp", "[", "-", "d", "]", "[", "-", "r", "[", "file", "]]", "host", "[", "-", "l", "[", "dir", "]]", "[", "-", "d", "[", "dir", "]]", "[", "-", "p", "]", "[", "file", "]", "..." ]
def test(): '''Test program. Usage: ftp [-d] [-r[file]] host [-l[dir]] [-d[dir]] [-p] [file] ... -d dir -l list -p password ''' if len(sys.argv) < 2: print test.__doc__ sys.exit(0) debugging = 0 rcfile = None while sys.argv[1] == '-d': debugging = debug...
[ "def", "test", "(", ")", ":", "if", "len", "(", "sys", ".", "argv", ")", "<", "2", ":", "print", "test", ".", "__doc__", "sys", ".", "exit", "(", "0", ")", "debugging", "=", "0", "rcfile", "=", "None", "while", "sys", ".", "argv", "[", "1", "...
https://github.com/PowerScript/KatanaFramework/blob/0f6ad90a88de865d58ec26941cb4460501e75496/lib/ftplib/ftplib.py#L1017-L1069
nosmokingbandit/watcher
dadacd21a5790ee609058a98a17fcc8954d24439
lib/sqlalchemy/orm/unitofwork.py
python
UOWTransaction.remove_state_actions
(self, state)
remove pending actions for a state from the uowtransaction.
remove pending actions for a state from the uowtransaction.
[ "remove", "pending", "actions", "for", "a", "state", "from", "the", "uowtransaction", "." ]
def remove_state_actions(self, state): """remove pending actions for a state from the uowtransaction.""" isdelete = self.states[state][0] self.states[state] = (isdelete, True)
[ "def", "remove_state_actions", "(", "self", ",", "state", ")", ":", "isdelete", "=", "self", ".", "states", "[", "state", "]", "[", "0", "]", "self", ".", "states", "[", "state", "]", "=", "(", "isdelete", ",", "True", ")" ]
https://github.com/nosmokingbandit/watcher/blob/dadacd21a5790ee609058a98a17fcc8954d24439/lib/sqlalchemy/orm/unitofwork.py#L184-L189
onelogin/python3-saml
b4199c5364d4b4c00d9930d9e4dab655ecdfaf81
src/onelogin/saml2/errors.py
python
OneLogin_Saml2_Error.__init__
(self, message, code=0, errors=None)
Initializes the Exception instance. Arguments are: * (str) message. Describes the error. * (int) code. The code error (defined in the error class).
Initializes the Exception instance.
[ "Initializes", "the", "Exception", "instance", "." ]
def __init__(self, message, code=0, errors=None): """ Initializes the Exception instance. Arguments are: * (str) message. Describes the error. * (int) code. The code error (defined in the error class). """ assert isinstance(code, int) ...
[ "def", "__init__", "(", "self", ",", "message", ",", "code", "=", "0", ",", "errors", "=", "None", ")", ":", "assert", "isinstance", "(", "code", ",", "int", ")", "if", "errors", "is", "not", "None", ":", "message", "=", "message", "%", "errors", "...
https://github.com/onelogin/python3-saml/blob/b4199c5364d4b4c00d9930d9e4dab655ecdfaf81/src/onelogin/saml2/errors.py#L42-L56
selfteaching/selfteaching-python-camp
9982ee964b984595e7d664b07c389cddaf158f1e
19100102/Jinjin1111/mymodule/stats_word.py
python
stats_text_cn
(text)
return mydict
以字典形势返回字符串中文汉字的出现频率 :param text:string :return dict:中文汉字排序结果
以字典形势返回字符串中文汉字的出现频率 :param text:string :return dict:中文汉字排序结果
[ "以字典形势返回字符串中文汉字的出现频率", ":", "param", "text", ":", "string", ":", "return", "dict", ":", "中文汉字排序结果" ]
def stats_text_cn(text): ''' 以字典形势返回字符串中文汉字的出现频率 :param text:string :return dict:中文汉字排序结果 ''' # 在这里写具体操作 mydict={} text=is_ustr(text).replace(" ","") for mylinum in text: if mylinum != "": if mylinum in mydict: mydict[mylinum]=int(mydict[mylinum])...
[ "def", "stats_text_cn", "(", "text", ")", ":", "# 在这里写具体操作", "mydict", "=", "{", "}", "text", "=", "is_ustr", "(", "text", ")", ".", "replace", "(", "\" \"", ",", "\"\"", ")", "for", "mylinum", "in", "text", ":", "if", "mylinum", "!=", "\"\"", ":", ...
https://github.com/selfteaching/selfteaching-python-camp/blob/9982ee964b984595e7d664b07c389cddaf158f1e/19100102/Jinjin1111/mymodule/stats_word.py#L77-L92
openhatch/oh-mainline
ce29352a034e1223141dcc2f317030bbc3359a51
vendor/packages/gdata/src/gdata/Crypto/PublicKey/pubkey.py
python
pubkey.blind
(self, M, B)
blind(M : string|long, B : string|long) : string|long Blind message M using blinding factor B.
blind(M : string|long, B : string|long) : string|long Blind message M using blinding factor B.
[ "blind", "(", "M", ":", "string|long", "B", ":", "string|long", ")", ":", "string|long", "Blind", "message", "M", "using", "blinding", "factor", "B", "." ]
def blind(self, M, B): """blind(M : string|long, B : string|long) : string|long Blind message M using blinding factor B. """ wasString=0 if isinstance(M, types.StringType): M=bytes_to_long(M) ; wasString=1 if isinstance(B, types.StringType): B=bytes_to_long(B)...
[ "def", "blind", "(", "self", ",", "M", ",", "B", ")", ":", "wasString", "=", "0", "if", "isinstance", "(", "M", ",", "types", ".", "StringType", ")", ":", "M", "=", "bytes_to_long", "(", "M", ")", "wasString", "=", "1", "if", "isinstance", "(", "...
https://github.com/openhatch/oh-mainline/blob/ce29352a034e1223141dcc2f317030bbc3359a51/vendor/packages/gdata/src/gdata/Crypto/PublicKey/pubkey.py#L91-L101
thiagopena/djangoSIGE
e32186b27bfd8acf21b0fa400e699cb5c73e5433
djangosige/apps/vendas/models/vendas.py
python
ItensVenda.format_quantidade
(self)
return locale.format(u'%.2f', self.quantidade, 1)
[]
def format_quantidade(self): return locale.format(u'%.2f', self.quantidade, 1)
[ "def", "format_quantidade", "(", "self", ")", ":", "return", "locale", ".", "format", "(", "u'%.2f'", ",", "self", ".", "quantidade", ",", "1", ")" ]
https://github.com/thiagopena/djangoSIGE/blob/e32186b27bfd8acf21b0fa400e699cb5c73e5433/djangosige/apps/vendas/models/vendas.py#L147-L148
venthur/python-ardrone
15adf2221e405ced25624bf0a27ee206d74a88ab
libardrone.py
python
ARDrone.commwdg
(self)
Communication watchdog signal. This needs to be send regulary to keep the communication w/ the drone alive.
Communication watchdog signal.
[ "Communication", "watchdog", "signal", "." ]
def commwdg(self): """Communication watchdog signal. This needs to be send regulary to keep the communication w/ the drone alive. """ self.at(at_comwdg)
[ "def", "commwdg", "(", "self", ")", ":", "self", ".", "at", "(", "at_comwdg", ")" ]
https://github.com/venthur/python-ardrone/blob/15adf2221e405ced25624bf0a27ee206d74a88ab/libardrone.py#L148-L154
HaoZhang95/Python24
b897224b8a0e6a5734f408df8c24846a98c553bf
00Python/venv/Lib/site-packages/pip-10.0.1-py3.7.egg/pip/_vendor/ipaddress.py
python
_IPAddressBase._prefix_from_ip_string
(cls, ip_str)
Turn a netmask/hostmask string into a prefix length Args: ip_str: The netmask/hostmask to be converted Returns: An integer, the prefix length. Raises: NetmaskValueError: If the input is not a valid netmask/hostmask
Turn a netmask/hostmask string into a prefix length
[ "Turn", "a", "netmask", "/", "hostmask", "string", "into", "a", "prefix", "length" ]
def _prefix_from_ip_string(cls, ip_str): """Turn a netmask/hostmask string into a prefix length Args: ip_str: The netmask/hostmask to be converted Returns: An integer, the prefix length. Raises: NetmaskValueError: If the input is not a valid netmask...
[ "def", "_prefix_from_ip_string", "(", "cls", ",", "ip_str", ")", ":", "# Parse the netmask/hostmask like an IP address.", "try", ":", "ip_int", "=", "cls", ".", "_ip_int_from_string", "(", "ip_str", ")", "except", "AddressValueError", ":", "cls", ".", "_report_invalid...
https://github.com/HaoZhang95/Python24/blob/b897224b8a0e6a5734f408df8c24846a98c553bf/00Python/venv/Lib/site-packages/pip-10.0.1-py3.7.egg/pip/_vendor/ipaddress.py#L625-L656
ales-tsurko/cells
4cf7e395cd433762bea70cdc863a346f3a6fe1d0
packaging/macos/python/lib/python3.7/mailbox.py
python
Mailbox.items
(self)
return list(self.iteritems())
Return a list of (key, message) tuples. Memory intensive.
Return a list of (key, message) tuples. Memory intensive.
[ "Return", "a", "list", "of", "(", "key", "message", ")", "tuples", ".", "Memory", "intensive", "." ]
def items(self): """Return a list of (key, message) tuples. Memory intensive.""" return list(self.iteritems())
[ "def", "items", "(", "self", ")", ":", "return", "list", "(", "self", ".", "iteritems", "(", ")", ")" ]
https://github.com/ales-tsurko/cells/blob/4cf7e395cd433762bea70cdc863a346f3a6fe1d0/packaging/macos/python/lib/python3.7/mailbox.py#L130-L132
amzn/xfer
dd4a6a27ca00406df83eec5916d3a76a1a798248
xfer-ml/xfer/meta_model_repurposer.py
python
MetaModelRepurposer.repurpose
(self, train_iterator: mx.io.DataIter)
Train a meta-model using features extracted from training data through the source neural network. Set self.target_model to the trained meta-model. :param train_iterator: Training data iterator to use to extract features from source_model. :type train_iterator: :class: `mxnet.io.DataIter`
Train a meta-model using features extracted from training data through the source neural network.
[ "Train", "a", "meta", "-", "model", "using", "features", "extracted", "from", "training", "data", "through", "the", "source", "neural", "network", "." ]
def repurpose(self, train_iterator: mx.io.DataIter): """ Train a meta-model using features extracted from training data through the source neural network. Set self.target_model to the trained meta-model. :param train_iterator: Training data iterator to use to extract features from sour...
[ "def", "repurpose", "(", "self", ",", "train_iterator", ":", "mx", ".", "io", ".", "DataIter", ")", ":", "# Validate if repurpose call is valid", "self", ".", "_validate_before_repurpose", "(", ")", "# For given training data, extract features from source neural network", "...
https://github.com/amzn/xfer/blob/dd4a6a27ca00406df83eec5916d3a76a1a798248/xfer-ml/xfer/meta_model_repurposer.py#L99-L121
s3rvac/weechat-notify-send
d99632574a11098c05bc2b6075e149aaea77be0d
notify_send.py
python
notify_on_all_messages_in_buffer
(buffer)
return False
Does the user want to be notified for all messages in the given buffer?
Does the user want to be notified for all messages in the given buffer?
[ "Does", "the", "user", "want", "to", "be", "notified", "for", "all", "messages", "in", "the", "given", "buffer?" ]
def notify_on_all_messages_in_buffer(buffer): """Does the user want to be notified for all messages in the given buffer? """ buffer_names = names_for_buffer(buffer) # Option notify_on_all_messages_in_buffers: for buf in buffers_to_notify_on_all_messages(): if buf in buffer_names: ...
[ "def", "notify_on_all_messages_in_buffer", "(", "buffer", ")", ":", "buffer_names", "=", "names_for_buffer", "(", "buffer", ")", "# Option notify_on_all_messages_in_buffers:", "for", "buf", "in", "buffers_to_notify_on_all_messages", "(", ")", ":", "if", "buf", "in", "bu...
https://github.com/s3rvac/weechat-notify-send/blob/d99632574a11098c05bc2b6075e149aaea77be0d/notify_send.py#L557-L573
deanishe/alfred-vpn-manager
f5d0dd1433ea69b1517d4866a12b1118097057b9
src/vpn.py
python
VPNApp.name
(self)
return self.__class__.__name__
Name of application.
Name of application.
[ "Name", "of", "application", "." ]
def name(self): """Name of application.""" return self.__class__.__name__
[ "def", "name", "(", "self", ")", ":", "return", "self", ".", "__class__", ".", "__name__" ]
https://github.com/deanishe/alfred-vpn-manager/blob/f5d0dd1433ea69b1517d4866a12b1118097057b9/src/vpn.py#L137-L139
NiklasRosenstein/myo-python
80967f206ae6f0a0eb9808319840680e6e60f1bf
myo/math.py
python
Vector.__repr__
(self)
return 'Vector({0}, {1}, {2})'.format(self.x, self.y, self.z)
[]
def __repr__(self): return 'Vector({0}, {1}, {2})'.format(self.x, self.y, self.z)
[ "def", "__repr__", "(", "self", ")", ":", "return", "'Vector({0}, {1}, {2})'", ".", "format", "(", "self", ".", "x", ",", "self", ".", "y", ",", "self", ".", "z", ")" ]
https://github.com/NiklasRosenstein/myo-python/blob/80967f206ae6f0a0eb9808319840680e6e60f1bf/myo/math.py#L75-L76
cloudera/hue
23f02102d4547c17c32bd5ea0eb24e9eadd657a4
desktop/core/ext-py/protobuf-3.13.0/google/protobuf/internal/well_known_types.py
python
Any.Pack
(self, msg, type_url_prefix='type.googleapis.com/', deterministic=None)
Packs the specified message into current Any message.
Packs the specified message into current Any message.
[ "Packs", "the", "specified", "message", "into", "current", "Any", "message", "." ]
def Pack(self, msg, type_url_prefix='type.googleapis.com/', deterministic=None): """Packs the specified message into current Any message.""" if len(type_url_prefix) < 1 or type_url_prefix[-1] != '/': self.type_url = '%s/%s' % (type_url_prefix, msg.DESCRIPTOR.full_name) else: self.type...
[ "def", "Pack", "(", "self", ",", "msg", ",", "type_url_prefix", "=", "'type.googleapis.com/'", ",", "deterministic", "=", "None", ")", ":", "if", "len", "(", "type_url_prefix", ")", "<", "1", "or", "type_url_prefix", "[", "-", "1", "]", "!=", "'/'", ":",...
https://github.com/cloudera/hue/blob/23f02102d4547c17c32bd5ea0eb24e9eadd657a4/desktop/core/ext-py/protobuf-3.13.0/google/protobuf/internal/well_known_types.py#L72-L79
psychopy/psychopy
01b674094f38d0e0bd51c45a6f66f671d7041696
psychopy/sound/audiodevice.py
python
AudioDeviceStatus.state
(self)
return self._state
State of the device (`int`). Either `1` for playback, `2` for recording or `3` for duplex (recording and playback).
State of the device (`int`). Either `1` for playback, `2` for recording or `3` for duplex (recording and playback).
[ "State", "of", "the", "device", "(", "int", ")", ".", "Either", "1", "for", "playback", "2", "for", "recording", "or", "3", "for", "duplex", "(", "recording", "and", "playback", ")", "." ]
def state(self): """State of the device (`int`). Either `1` for playback, `2` for recording or `3` for duplex (recording and playback). """ return self._state
[ "def", "state", "(", "self", ")", ":", "return", "self", ".", "_state" ]
https://github.com/psychopy/psychopy/blob/01b674094f38d0e0bd51c45a6f66f671d7041696/psychopy/sound/audiodevice.py#L606-L611
ddbourgin/numpy-ml
b0359af5285fbf9699d64fd5ec059493228af03e
numpy_ml/bandits/bandits.py
python
BernoulliBandit.hyperparameters
(self)
return { "id": "BernoulliBandit", "payoff_probs": self.payoff_probs, }
A dictionary of the bandit hyperparameters
A dictionary of the bandit hyperparameters
[ "A", "dictionary", "of", "the", "bandit", "hyperparameters" ]
def hyperparameters(self): """A dictionary of the bandit hyperparameters""" return { "id": "BernoulliBandit", "payoff_probs": self.payoff_probs, }
[ "def", "hyperparameters", "(", "self", ")", ":", "return", "{", "\"id\"", ":", "\"BernoulliBandit\"", ",", "\"payoff_probs\"", ":", "self", ".", "payoff_probs", ",", "}" ]
https://github.com/ddbourgin/numpy-ml/blob/b0359af5285fbf9699d64fd5ec059493228af03e/numpy_ml/bandits/bandits.py#L168-L173
TencentCloud/tencentcloud-sdk-python
3677fd1cdc8c5fd626ce001c13fd3b59d1f279d2
tencentcloud/iecp/v20210914/models.py
python
DescribeEdgeUnitApplicationVisualizationResponse.__init__
(self)
r""" :param BasicInfo: 基本信息 注意:此字段可能返回 null,表示取不到有效值。 :type BasicInfo: :class:`tencentcloud.iecp.v20210914.models.ApplicationBasicInfo` :param BasicConfig: 基本配置 注意:此字段可能返回 null,表示取不到有效值。 :type BasicConfig: :class:`tencentcloud.iecp.v20210914.models.ApplicationBasicConfig` :param ...
r""" :param BasicInfo: 基本信息 注意:此字段可能返回 null,表示取不到有效值。 :type BasicInfo: :class:`tencentcloud.iecp.v20210914.models.ApplicationBasicInfo` :param BasicConfig: 基本配置 注意:此字段可能返回 null,表示取不到有效值。 :type BasicConfig: :class:`tencentcloud.iecp.v20210914.models.ApplicationBasicConfig` :param ...
[ "r", ":", "param", "BasicInfo", ":", "基本信息", "注意:此字段可能返回", "null,表示取不到有效值。", ":", "type", "BasicInfo", ":", ":", "class", ":", "tencentcloud", ".", "iecp", ".", "v20210914", ".", "models", ".", "ApplicationBasicInfo", ":", "param", "BasicConfig", ":", "基本配置", ...
def __init__(self): r""" :param BasicInfo: 基本信息 注意:此字段可能返回 null,表示取不到有效值。 :type BasicInfo: :class:`tencentcloud.iecp.v20210914.models.ApplicationBasicInfo` :param BasicConfig: 基本配置 注意:此字段可能返回 null,表示取不到有效值。 :type BasicConfig: :class:`tencentcloud.iecp.v20210914.models.Application...
[ "def", "__init__", "(", "self", ")", ":", "self", ".", "BasicInfo", "=", "None", "self", ".", "BasicConfig", "=", "None", "self", ".", "Volumes", "=", "None", "self", ".", "InitContainers", "=", "None", "self", ".", "Containers", "=", "None", "self", "...
https://github.com/TencentCloud/tencentcloud-sdk-python/blob/3677fd1cdc8c5fd626ce001c13fd3b59d1f279d2/tencentcloud/iecp/v20210914/models.py#L3184-L3233
marin-m/vmlinux-to-elf
7374dc6890655312fbd2aef16660d60f3d41de43
vmlinux_to_elf/utils/elf.py
python
VariableEndiannessAndWordsizeStructure.pretty_print
(self)
[]
def pretty_print(self): pretty_print_structure(self)
[ "def", "pretty_print", "(", "self", ")", ":", "pretty_print_structure", "(", "self", ")" ]
https://github.com/marin-m/vmlinux-to-elf/blob/7374dc6890655312fbd2aef16660d60f3d41de43/vmlinux_to_elf/utils/elf.py#L123-L125
yuxiaokui/Intranet-Penetration
f57678a204840c83cbf3308e3470ae56c5ff514b
proxy/XX-Net/code/default/python27/1.0/lib/noarch/ipaddress.py
python
_IPAddressBase._prefix_from_ip_int
(cls, ip_int)
return prefixlen
Return prefix length from the bitwise netmask. Args: ip_int: An integer, the netmask in expanded bitwise format Returns: An integer, the prefix length. Raises: ValueError: If the input intermingles zeroes & ones
Return prefix length from the bitwise netmask.
[ "Return", "prefix", "length", "from", "the", "bitwise", "netmask", "." ]
def _prefix_from_ip_int(cls, ip_int): """Return prefix length from the bitwise netmask. Args: ip_int: An integer, the netmask in expanded bitwise format Returns: An integer, the prefix length. Raises: ValueError: If the input intermingles zeroes & o...
[ "def", "_prefix_from_ip_int", "(", "cls", ",", "ip_int", ")", ":", "trailing_zeroes", "=", "_count_righthand_zero_bits", "(", "ip_int", ",", "cls", ".", "_max_prefixlen", ")", "prefixlen", "=", "cls", ".", "_max_prefixlen", "-", "trailing_zeroes", "leading_ones", ...
https://github.com/yuxiaokui/Intranet-Penetration/blob/f57678a204840c83cbf3308e3470ae56c5ff514b/proxy/XX-Net/code/default/python27/1.0/lib/noarch/ipaddress.py#L569-L591
crflynn/stochastic
a563762682a784a24e8b8705995b0e4cafad469f
stochastic/processes/continuous/mixed_poisson.py
python
MixedPoissonProcess.rate_kwargs
(self)
return self._rate_kwargs
Keyword arguments for the rate function.
Keyword arguments for the rate function.
[ "Keyword", "arguments", "for", "the", "rate", "function", "." ]
def rate_kwargs(self): """Keyword arguments for the rate function.""" return self._rate_kwargs
[ "def", "rate_kwargs", "(", "self", ")", ":", "return", "self", ".", "_rate_kwargs" ]
https://github.com/crflynn/stochastic/blob/a563762682a784a24e8b8705995b0e4cafad469f/stochastic/processes/continuous/mixed_poisson.py#L64-L66
gkrizek/bash-lambda-layer
703b0ade8174022d44779d823172ab7ac33a5505
bin/s3transfer/futures.py
python
ExecutorFuture.__init__
(self, future)
A future returned from the executor Currently, it is just a wrapper around a concurrent.futures.Future. However, this can eventually grow to implement the needed functionality of concurrent.futures.Future if we move off of the library and not affect the rest of the codebase. :t...
A future returned from the executor
[ "A", "future", "returned", "from", "the", "executor" ]
def __init__(self, future): """A future returned from the executor Currently, it is just a wrapper around a concurrent.futures.Future. However, this can eventually grow to implement the needed functionality of concurrent.futures.Future if we move off of the library and not affec...
[ "def", "__init__", "(", "self", ",", "future", ")", ":", "self", ".", "_future", "=", "future" ]
https://github.com/gkrizek/bash-lambda-layer/blob/703b0ade8174022d44779d823172ab7ac33a5505/bin/s3transfer/futures.py#L478-L489
netbox-community/pynetbox
8cf11d19d358c153322e3caadcee041fb9ba653e
pynetbox/models/dcim.py
python
Racks.elevation
(self)
return RODetailEndpoint(self, "elevation", custom_return=RUs)
Represents the ``elevation`` detail endpoint. Returns a DetailEndpoint object that is the interface for viewing response from the elevation endpoint updated in Netbox version 2.8. :returns: :py:class:`.DetailEndpoint` :Examples: >>> rack = nb.dcim.racks.get(123) ...
Represents the ``elevation`` detail endpoint.
[ "Represents", "the", "elevation", "detail", "endpoint", "." ]
def elevation(self): """ Represents the ``elevation`` detail endpoint. Returns a DetailEndpoint object that is the interface for viewing response from the elevation endpoint updated in Netbox version 2.8. :returns: :py:class:`.DetailEndpoint` :Examples: >>> ra...
[ "def", "elevation", "(", "self", ")", ":", "return", "RODetailEndpoint", "(", "self", ",", "\"elevation\"", ",", "custom_return", "=", "RUs", ")" ]
https://github.com/netbox-community/pynetbox/blob/8cf11d19d358c153322e3caadcee041fb9ba653e/pynetbox/models/dcim.py#L191-L207
PaddlePaddle/PaddleX
2bab73f81ab54e328204e7871e6ae4a82e719f5d
paddlex/ppdet/engine/callbacks.py
python
WiferFaceEval.__init__
(self, model)
[]
def __init__(self, model): super(WiferFaceEval, self).__init__(model)
[ "def", "__init__", "(", "self", ",", "model", ")", ":", "super", "(", "WiferFaceEval", ",", "self", ")", ".", "__init__", "(", "model", ")" ]
https://github.com/PaddlePaddle/PaddleX/blob/2bab73f81ab54e328204e7871e6ae4a82e719f5d/paddlex/ppdet/engine/callbacks.py#L215-L216
mlcommons/ck
558a22c5970eb0d6708d0edc080e62a92566bab0
ck/repo/module/pipeline/module.py
python
init
(i)
return {'return':0}
Input: {} Output: { return - return code = 0, if successful > 0, if error (error) - error text if return > 0 }
[]
def init(i): """ Input: {} Output: { return - return code = 0, if successful > 0, if error (error) - error text if return > 0 } """ return {'return':0}
[ "def", "init", "(", "i", ")", ":", "return", "{", "'return'", ":", "0", "}" ]
https://github.com/mlcommons/ck/blob/558a22c5970eb0d6708d0edc080e62a92566bab0/ck/repo/module/pipeline/module.py#L21-L33
what-studio/profiling
824ae554b35909ecbb8aead8853429573e70aeee
profiling/tracing/__init__.py
python
TracingProfiler._profile
(self, frame, event, arg)
The callback function to register by :func:`sys.setprofile`.
The callback function to register by :func:`sys.setprofile`.
[ "The", "callback", "function", "to", "register", "by", ":", "func", ":", "sys", ".", "setprofile", "." ]
def _profile(self, frame, event, arg): """The callback function to register by :func:`sys.setprofile`.""" # c = event.startswith('c_') if event.startswith('c_'): return time1 = self.timer() frames = self.frame_stack(frame) if frames: frames.pop() ...
[ "def", "_profile", "(", "self", ",", "frame", ",", "event", ",", "arg", ")", ":", "# c = event.startswith('c_')", "if", "event", ".", "startswith", "(", "'c_'", ")", ":", "return", "time1", "=", "self", ".", "timer", "(", ")", "frames", "=", "self", "....
https://github.com/what-studio/profiling/blob/824ae554b35909ecbb8aead8853429573e70aeee/profiling/tracing/__init__.py#L80-L108
asappresearch/flambe
98f10f859fe9223fd2d1d76d430f77cdbddc0956
flambe/nn/distance/cosine.py
python
CosineDistance.__init__
(self, eps: float = 1e-8)
Initialize the CosineDistance module. Parameters ---------- eps : float, optional Used for numerical stability
Initialize the CosineDistance module.
[ "Initialize", "the", "CosineDistance", "module", "." ]
def __init__(self, eps: float = 1e-8) -> None: """Initialize the CosineDistance module. Parameters ---------- eps : float, optional Used for numerical stability """ super().__init__() self.eps = eps
[ "def", "__init__", "(", "self", ",", "eps", ":", "float", "=", "1e-8", ")", "->", "None", ":", "super", "(", ")", ".", "__init__", "(", ")", "self", ".", "eps", "=", "eps" ]
https://github.com/asappresearch/flambe/blob/98f10f859fe9223fd2d1d76d430f77cdbddc0956/flambe/nn/distance/cosine.py#L13-L23
collinsctk/PyQYT
7af3673955f94ff1b2df2f94220cd2dab2e252af
ExtentionPackages/tornado/iostream.py
python
BaseIOStream.read_until
(self, delimiter, callback=None, max_bytes=None)
return future
Asynchronously read until we have found the given delimiter. The result includes all the data read including the delimiter. If a callback is given, it will be run with the data as an argument; if not, this method returns a `.Future`. If ``max_bytes`` is not None, the connection will be...
Asynchronously read until we have found the given delimiter.
[ "Asynchronously", "read", "until", "we", "have", "found", "the", "given", "delimiter", "." ]
def read_until(self, delimiter, callback=None, max_bytes=None): """Asynchronously read until we have found the given delimiter. The result includes all the data read including the delimiter. If a callback is given, it will be run with the data as an argument; if not, this method returns...
[ "def", "read_until", "(", "self", ",", "delimiter", ",", "callback", "=", "None", ",", "max_bytes", "=", "None", ")", ":", "future", "=", "self", ".", "_set_read_callback", "(", "callback", ")", "self", ".", "_read_delimiter", "=", "delimiter", "self", "."...
https://github.com/collinsctk/PyQYT/blob/7af3673955f94ff1b2df2f94220cd2dab2e252af/ExtentionPackages/tornado/iostream.py#L263-L292
lazylibrarian/LazyLibrarian
ae3c14e9db9328ce81765e094ab2a14ed7155624
lib3/bs4/element.py
python
Tag.find
(self, name=None, attrs={}, recursive=True, text=None, **kwargs)
return r
Return only the first child of this Tag matching the given criteria.
Return only the first child of this Tag matching the given criteria.
[ "Return", "only", "the", "first", "child", "of", "this", "Tag", "matching", "the", "given", "criteria", "." ]
def find(self, name=None, attrs={}, recursive=True, text=None, **kwargs): """Return only the first child of this Tag matching the given criteria.""" r = None l = self.find_all(name, attrs, recursive, text, 1, **kwargs) if l: r = l[0] return r
[ "def", "find", "(", "self", ",", "name", "=", "None", ",", "attrs", "=", "{", "}", ",", "recursive", "=", "True", ",", "text", "=", "None", ",", "*", "*", "kwargs", ")", ":", "r", "=", "None", "l", "=", "self", ".", "find_all", "(", "name", "...
https://github.com/lazylibrarian/LazyLibrarian/blob/ae3c14e9db9328ce81765e094ab2a14ed7155624/lib3/bs4/element.py#L1273-L1281
zhl2008/awd-platform
0416b31abea29743387b10b3914581fbe8e7da5e
web_flaskbb/lib/python2.7/site-packages/whoosh/query/ranges.py
python
NumericRange.simplify
(self, ixreader)
return self._compile_query(ixreader).simplify(ixreader)
[]
def simplify(self, ixreader): return self._compile_query(ixreader).simplify(ixreader)
[ "def", "simplify", "(", "self", ",", "ixreader", ")", ":", "return", "self", ".", "_compile_query", "(", "ixreader", ")", ".", "simplify", "(", "ixreader", ")" ]
https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_flaskbb/lib/python2.7/site-packages/whoosh/query/ranges.py#L258-L259
buke/GreenOdoo
3d8c55d426fb41fdb3f2f5a1533cfe05983ba1df
runtime/python/lib/python2.7/lib2to3/pytree.py
python
Node.clone
(self)
return Node(self.type, [ch.clone() for ch in self.children], fixers_applied=self.fixers_applied)
Return a cloned (deep) copy of self.
Return a cloned (deep) copy of self.
[ "Return", "a", "cloned", "(", "deep", ")", "copy", "of", "self", "." ]
def clone(self): """Return a cloned (deep) copy of self.""" return Node(self.type, [ch.clone() for ch in self.children], fixers_applied=self.fixers_applied)
[ "def", "clone", "(", "self", ")", ":", "return", "Node", "(", "self", ".", "type", ",", "[", "ch", ".", "clone", "(", ")", "for", "ch", "in", "self", ".", "children", "]", ",", "fixers_applied", "=", "self", ".", "fixers_applied", ")" ]
https://github.com/buke/GreenOdoo/blob/3d8c55d426fb41fdb3f2f5a1533cfe05983ba1df/runtime/python/lib/python2.7/lib2to3/pytree.py#L289-L292
makehumancommunity/makehuman
8006cf2cc851624619485658bb933a4244bbfd7c
makehuman/core/mhmain.py
python
MHApplication.getLoadedPlugins
(self)
return list(self.modules.keys())
Get the names of loaded plugins.
Get the names of loaded plugins.
[ "Get", "the", "names", "of", "loaded", "plugins", "." ]
def getLoadedPlugins(self): """ Get the names of loaded plugins. """ return list(self.modules.keys())
[ "def", "getLoadedPlugins", "(", "self", ")", ":", "return", "list", "(", "self", ".", "modules", ".", "keys", "(", ")", ")" ]
https://github.com/makehumancommunity/makehuman/blob/8006cf2cc851624619485658bb933a4244bbfd7c/makehuman/core/mhmain.py#L609-L613
replit-archive/empythoned
977ec10ced29a3541a4973dc2b59910805695752
dist/lib/python2.7/telnetlib.py
python
Telnet.rawq_getchar
(self)
return c
Get next char from raw queue. Block if no data is immediately available. Raise EOFError when connection is closed.
Get next char from raw queue.
[ "Get", "next", "char", "from", "raw", "queue", "." ]
def rawq_getchar(self): """Get next char from raw queue. Block if no data is immediately available. Raise EOFError when connection is closed. """ if not self.rawq: self.fill_rawq() if self.eof: raise EOFError c = self.rawq[self.i...
[ "def", "rawq_getchar", "(", "self", ")", ":", "if", "not", "self", ".", "rawq", ":", "self", ".", "fill_rawq", "(", ")", "if", "self", ".", "eof", ":", "raise", "EOFError", "c", "=", "self", ".", "rawq", "[", "self", ".", "irawq", "]", "self", "....
https://github.com/replit-archive/empythoned/blob/977ec10ced29a3541a4973dc2b59910805695752/dist/lib/python2.7/telnetlib.py#L486-L502
junxiaosong/AlphaZero_Gomoku
a2555b26e38aaaa08270e0731c53135e6222ef46
mcts_pure.py
python
MCTS.update_with_move
(self, last_move)
Step forward in the tree, keeping everything we already know about the subtree.
Step forward in the tree, keeping everything we already know about the subtree.
[ "Step", "forward", "in", "the", "tree", "keeping", "everything", "we", "already", "know", "about", "the", "subtree", "." ]
def update_with_move(self, last_move): """Step forward in the tree, keeping everything we already know about the subtree. """ if last_move in self._root._children: self._root = self._root._children[last_move] self._root._parent = None else: sel...
[ "def", "update_with_move", "(", "self", ",", "last_move", ")", ":", "if", "last_move", "in", "self", ".", "_root", ".", "_children", ":", "self", ".", "_root", "=", "self", ".", "_root", ".", "_children", "[", "last_move", "]", "self", ".", "_root", "....
https://github.com/junxiaosong/AlphaZero_Gomoku/blob/a2555b26e38aaaa08270e0731c53135e6222ef46/mcts_pure.py#L171-L179
Tautulli/Tautulli
2410eb33805aaac4bd1c5dad0f71e4f15afaf742
plexpy/users.py
python
Users.get_recently_watched
(self, user_id=None, limit='10')
return recently_watched
[]
def get_recently_watched(self, user_id=None, limit='10'): if not session.allow_session_user(user_id): return [] monitor_db = database.MonitorDatabase() recently_watched = [] if not limit.isdigit(): limit = '10' try: if str(user_id).isdigit()...
[ "def", "get_recently_watched", "(", "self", ",", "user_id", "=", "None", ",", "limit", "=", "'10'", ")", ":", "if", "not", "session", ".", "allow_session_user", "(", "user_id", ")", ":", "return", "[", "]", "monitor_db", "=", "database", ".", "MonitorDatab...
https://github.com/Tautulli/Tautulli/blob/2410eb33805aaac4bd1c5dad0f71e4f15afaf742/plexpy/users.py#L598-L657
CamDavidsonPilon/lifelines
9be26a9a8720e8536e9828e954bb91d559a3016f
lifelines/fitters/breslow_fleming_harrington_fitter.py
python
BreslowFlemingHarringtonFitter.survival_function_at_times
(self, times, label=None)
return pd.Series(self.predict(times), index=_to_1d_array(times), name=label)
Return a Pandas series of the predicted survival value at specific times Parameters ----------- times: iterable or float label: str
Return a Pandas series of the predicted survival value at specific times
[ "Return", "a", "Pandas", "series", "of", "the", "predicted", "survival", "value", "at", "specific", "times" ]
def survival_function_at_times(self, times, label=None) -> pd.Series: """ Return a Pandas series of the predicted survival value at specific times Parameters ----------- times: iterable or float label: str """ label = coalesce(label, self._label) ...
[ "def", "survival_function_at_times", "(", "self", ",", "times", ",", "label", "=", "None", ")", "->", "pd", ".", "Series", ":", "label", "=", "coalesce", "(", "label", ",", "self", ".", "_label", ")", "return", "pd", ".", "Series", "(", "self", ".", ...
https://github.com/CamDavidsonPilon/lifelines/blob/9be26a9a8720e8536e9828e954bb91d559a3016f/lifelines/fitters/breslow_fleming_harrington_fitter.py#L88-L99
kivy/python-for-android
4ecaa5fe01aa25e3bc8cadc52ae481645754f955
ci/rebuild_updated_recipes.py
python
build
(target_python, requirements)
Builds an APK given a target Python and a set of requirements.
Builds an APK given a target Python and a set of requirements.
[ "Builds", "an", "APK", "given", "a", "target", "Python", "and", "a", "set", "of", "requirements", "." ]
def build(target_python, requirements): """ Builds an APK given a target Python and a set of requirements. """ if not requirements: return android_sdk_home = os.environ['ANDROID_SDK_HOME'] android_ndk_home = os.environ['ANDROID_NDK_HOME'] requirements.add(target_python.name) requ...
[ "def", "build", "(", "target_python", ",", "requirements", ")", ":", "if", "not", "requirements", ":", "return", "android_sdk_home", "=", "os", ".", "environ", "[", "'ANDROID_SDK_HOME'", "]", "android_ndk_home", "=", "os", ".", "environ", "[", "'ANDROID_NDK_HOME...
https://github.com/kivy/python-for-android/blob/4ecaa5fe01aa25e3bc8cadc52ae481645754f955/ci/rebuild_updated_recipes.py#L49-L66