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
tendenci/tendenci
0f2c348cc0e7d41bc56f50b00ce05544b083bf1d
tendenci/apps/locations/importer/utils.py
python
is_import_valid
(file_path)
Returns a 2-tuple containing a booelean and list of errors The import file must be of type .csv and and include a location name column.
Returns a 2-tuple containing a booelean and list of errors
[ "Returns", "a", "2", "-", "tuple", "containing", "a", "booelean", "and", "list", "of", "errors" ]
def is_import_valid(file_path): """ Returns a 2-tuple containing a booelean and list of errors The import file must be of type .csv and and include a location name column. """ errs = [] ext = os.path.splitext(file_path)[1] if ext != '.csv': errs.append("Please make sure you'r...
[ "def", "is_import_valid", "(", "file_path", ")", ":", "errs", "=", "[", "]", "ext", "=", "os", ".", "path", ".", "splitext", "(", "file_path", ")", "[", "1", "]", "if", "ext", "!=", "'.csv'", ":", "errs", ".", "append", "(", "\"Please make sure you're ...
https://github.com/tendenci/tendenci/blob/0f2c348cc0e7d41bc56f50b00ce05544b083bf1d/tendenci/apps/locations/importer/utils.py#L9-L42
IJDykeman/wangTiles
7c1ee2095ebdf7f72bce07d94c6484915d5cae8b
experimental_code/tiles_3d/venv_mac/lib/python2.7/site-packages/setuptools/config.py
python
ConfigHandler._parse_dict
(cls, value)
return result
Represents value as a dict. :param value: :rtype: dict
Represents value as a dict.
[ "Represents", "value", "as", "a", "dict", "." ]
def _parse_dict(cls, value): """Represents value as a dict. :param value: :rtype: dict """ separator = '=' result = {} for line in cls._parse_list(value): key, sep, val = line.partition(separator) if sep != separator: raise...
[ "def", "_parse_dict", "(", "cls", ",", "value", ")", ":", "separator", "=", "'='", "result", "=", "{", "}", "for", "line", "in", "cls", ".", "_parse_list", "(", "value", ")", ":", "key", ",", "sep", ",", "val", "=", "line", ".", "partition", "(", ...
https://github.com/IJDykeman/wangTiles/blob/7c1ee2095ebdf7f72bce07d94c6484915d5cae8b/experimental_code/tiles_3d/venv_mac/lib/python2.7/site-packages/setuptools/config.py#L212-L227
justinmeister/The-Stolen-Crown-RPG
91a9949cc8ed9a2054c3b1ab8efe46678be0fcf4
data/states/credits.py
python
Credits.startup
(self, current_time, game_data)
Initialize data at scene start.
Initialize data at scene start.
[ "Initialize", "data", "at", "scene", "start", "." ]
def startup(self, current_time, game_data): """ Initialize data at scene start. """ self.game_data = game_data self.music = setup.MUSIC['overworld'] self.volume = 0.4 self.current_time = current_time self.background = pg.Surface(setup.SCREEN_RECT.size) ...
[ "def", "startup", "(", "self", ",", "current_time", ",", "game_data", ")", ":", "self", ".", "game_data", "=", "game_data", "self", ".", "music", "=", "setup", ".", "MUSIC", "[", "'overworld'", "]", "self", ".", "volume", "=", "0.4", "self", ".", "curr...
https://github.com/justinmeister/The-Stolen-Crown-RPG/blob/91a9949cc8ed9a2054c3b1ab8efe46678be0fcf4/data/states/credits.py#L142-L152
GiulioRossetti/cdlib
b2c6311b99725bb2b029556f531d244a2af14a2a
cdlib/algorithms/internal/DCS.py
python
Leader_Identification.__inclusion
(c1, c2)
return len(intersection) / float(smaller_set)
:param c1: node neighbors :param c2: node neighbors
:param c1: node neighbors :param c2: node neighbors
[ ":", "param", "c1", ":", "node", "neighbors", ":", "param", "c2", ":", "node", "neighbors" ]
def __inclusion(c1, c2): """ :param c1: node neighbors :param c2: node neighbors """ intersection = set(c2) & set(c1) smaller_set = min(len(c1), len(c2)) return len(intersection) / float(smaller_set)
[ "def", "__inclusion", "(", "c1", ",", "c2", ")", ":", "intersection", "=", "set", "(", "c2", ")", "&", "set", "(", "c1", ")", "smaller_set", "=", "min", "(", "len", "(", "c1", ")", ",", "len", "(", "c2", ")", ")", "return", "len", "(", "interse...
https://github.com/GiulioRossetti/cdlib/blob/b2c6311b99725bb2b029556f531d244a2af14a2a/cdlib/algorithms/internal/DCS.py#L11-L19
rlpy/rlpy
af25d2011fff1d61cb7c5cc8992549808f0c6103
rlpy/Domains/PacmanPackage/util.py
python
Counter.__mul__
(self, y)
return sum
Multiplying two counters gives the dot product of their vectors where each unique label is a vector element. >>> a = Counter() >>> b = Counter() >>> a['first'] = -2 >>> a['second'] = 4 >>> b['first'] = 3 >>> b['second'] = 5 >>> a['third'] = 1.5 >>...
Multiplying two counters gives the dot product of their vectors where each unique label is a vector element.
[ "Multiplying", "two", "counters", "gives", "the", "dot", "product", "of", "their", "vectors", "where", "each", "unique", "label", "is", "a", "vector", "element", "." ]
def __mul__(self, y): """ Multiplying two counters gives the dot product of their vectors where each unique label is a vector element. >>> a = Counter() >>> b = Counter() >>> a['first'] = -2 >>> a['second'] = 4 >>> b['first'] = 3 >>> b['second'] =...
[ "def", "__mul__", "(", "self", ",", "y", ")", ":", "sum", "=", "0", "x", "=", "self", "if", "len", "(", "x", ")", ">", "len", "(", "y", ")", ":", "x", ",", "y", "=", "y", ",", "x", "for", "key", "in", "x", ":", "if", "key", "not", "in",...
https://github.com/rlpy/rlpy/blob/af25d2011fff1d61cb7c5cc8992549808f0c6103/rlpy/Domains/PacmanPackage/util.py#L362-L386
runfalk/spans
db18d6d6a77c35f513095f47ea6929f609da3dff
spans/types.py
python
Range.upper
(self)
return None
Returns the upper boundary or None if it is unbounded. >>> intrange(1, 5).upper 5 >>> intrange(1).upper This is the same as the ``upper(self)`` in PostgreSQL.
Returns the upper boundary or None if it is unbounded.
[ "Returns", "the", "upper", "boundary", "or", "None", "if", "it", "is", "unbounded", "." ]
def upper(self): """ Returns the upper boundary or None if it is unbounded. >>> intrange(1, 5).upper 5 >>> intrange(1).upper This is the same as the ``upper(self)`` in PostgreSQL. """ if self: return None if self.upper_inf else s...
[ "def", "upper", "(", "self", ")", ":", "if", "self", ":", "return", "None", "if", "self", ".", "upper_inf", "else", "self", ".", "_range", ".", "upper", "return", "None" ]
https://github.com/runfalk/spans/blob/db18d6d6a77c35f513095f47ea6929f609da3dff/spans/types.py#L280-L293
scikit-image/scikit-image
ed642e2bc822f362504d24379dee94978d6fa9de
skimage/feature/corner.py
python
hessian_matrix_det
(image, sigma=1, approximate=True)
Compute the approximate Hessian Determinant over an image. The 2D approximate method uses box filters over integral images to compute the approximate Hessian Determinant. Parameters ---------- image : ndarray The image over which to compute the Hessian Determinant. sigma : float, optio...
Compute the approximate Hessian Determinant over an image.
[ "Compute", "the", "approximate", "Hessian", "Determinant", "over", "an", "image", "." ]
def hessian_matrix_det(image, sigma=1, approximate=True): """Compute the approximate Hessian Determinant over an image. The 2D approximate method uses box filters over integral images to compute the approximate Hessian Determinant. Parameters ---------- image : ndarray The image over w...
[ "def", "hessian_matrix_det", "(", "image", ",", "sigma", "=", "1", ",", "approximate", "=", "True", ")", ":", "image", "=", "img_as_float", "(", "image", ")", "float_dtype", "=", "_supported_float_type", "(", "image", ".", "dtype", ")", "image", "=", "imag...
https://github.com/scikit-image/scikit-image/blob/ed642e2bc822f362504d24379dee94978d6fa9de/skimage/feature/corner.py#L201-L245
beeware/ouroboros
a29123c6fab6a807caffbb7587cf548e0c370296
ouroboros/email/quoprimime.py
python
_unquote_match
(match)
return unquote(s)
Turn a match in the form =AB to the ASCII character with value 0xab
Turn a match in the form =AB to the ASCII character with value 0xab
[ "Turn", "a", "match", "in", "the", "form", "=", "AB", "to", "the", "ASCII", "character", "with", "value", "0xab" ]
def _unquote_match(match): """Turn a match in the form =AB to the ASCII character with value 0xab""" s = match.group(0) return unquote(s)
[ "def", "_unquote_match", "(", "match", ")", ":", "s", "=", "match", ".", "group", "(", "0", ")", "return", "unquote", "(", "s", ")" ]
https://github.com/beeware/ouroboros/blob/a29123c6fab6a807caffbb7587cf548e0c370296/ouroboros/email/quoprimime.py#L284-L287
sametmax/Django--an-app-at-a-time
99eddf12ead76e6dfbeb09ce0bae61e282e22f8a
ignore_this_directory/django/contrib/admin/options.py
python
ModelAdmin.get_model_perms
(self, request)
return { 'add': self.has_add_permission(request), 'change': self.has_change_permission(request), 'delete': self.has_delete_permission(request), 'view': self.has_view_permission(request), }
Return a dict of all perms for this model. This dict has the keys ``add``, ``change``, ``delete``, and ``view`` mapping to the True/False for each of those actions.
Return a dict of all perms for this model. This dict has the keys ``add``, ``change``, ``delete``, and ``view`` mapping to the True/False for each of those actions.
[ "Return", "a", "dict", "of", "all", "perms", "for", "this", "model", ".", "This", "dict", "has", "the", "keys", "add", "change", "delete", "and", "view", "mapping", "to", "the", "True", "/", "False", "for", "each", "of", "those", "actions", "." ]
def get_model_perms(self, request): """ Return a dict of all perms for this model. This dict has the keys ``add``, ``change``, ``delete``, and ``view`` mapping to the True/False for each of those actions. """ return { 'add': self.has_add_permission(request), ...
[ "def", "get_model_perms", "(", "self", ",", "request", ")", ":", "return", "{", "'add'", ":", "self", ".", "has_add_permission", "(", "request", ")", ",", "'change'", ":", "self", ".", "has_change_permission", "(", "request", ")", ",", "'delete'", ":", "se...
https://github.com/sametmax/Django--an-app-at-a-time/blob/99eddf12ead76e6dfbeb09ce0bae61e282e22f8a/ignore_this_directory/django/contrib/admin/options.py#L645-L656
aliyun/aliyun-oss-python-sdk
5f2afa0928a58c7c1cc6317ac147f3637481f6fd
oss2/crypto_bucket.py
python
CryptoBucket.__init__
(self, auth, endpoint, bucket_name, crypto_provider, is_cname=False, session=None, connect_timeout=None, app_name='', enable_crc=True, )
[]
def __init__(self, auth, endpoint, bucket_name, crypto_provider, is_cname=False, session=None, connect_timeout=None, app_name='', enable_crc=True, ): if not isinstance(crypto_provider, BaseCryptoProvider): ...
[ "def", "__init__", "(", "self", ",", "auth", ",", "endpoint", ",", "bucket_name", ",", "crypto_provider", ",", "is_cname", "=", "False", ",", "session", "=", "None", ",", "connect_timeout", "=", "None", ",", "app_name", "=", "''", ",", "enable_crc", "=", ...
https://github.com/aliyun/aliyun-oss-python-sdk/blob/5f2afa0928a58c7c1cc6317ac147f3637481f6fd/oss2/crypto_bucket.py#L50-L72
enthought/traitsui
b7c38c7a47bf6ae7971f9ddab70c8a358647dd25
traitsui/message.py
python
error
(message="", title="Message", buttons=["OK", "Cancel"], parent=None)
return ui.result
Displays a message to the user as a modal window with the specified title and buttons. If *buttons* is not specified, **OK** and **Cancel** buttons are used, which is appropriate for confirmations, where the user must decide whether to proceed. Be sure to word the message so that it is clear that click...
Displays a message to the user as a modal window with the specified title and buttons.
[ "Displays", "a", "message", "to", "the", "user", "as", "a", "modal", "window", "with", "the", "specified", "title", "and", "buttons", "." ]
def error(message="", title="Message", buttons=["OK", "Cancel"], parent=None): """Displays a message to the user as a modal window with the specified title and buttons. If *buttons* is not specified, **OK** and **Cancel** buttons are used, which is appropriate for confirmations, where the user must dec...
[ "def", "error", "(", "message", "=", "\"\"", ",", "title", "=", "\"Message\"", ",", "buttons", "=", "[", "\"OK\"", ",", "\"Cancel\"", "]", ",", "parent", "=", "None", ")", ":", "msg", "=", "Message", "(", "message", "=", "message", ")", "ui", "=", ...
https://github.com/enthought/traitsui/blob/b7c38c7a47bf6ae7971f9ddab70c8a358647dd25/traitsui/message.py#L62-L78
RJT1990/pyflux
297f2afc2095acd97c12e827dd500e8ea5da0c0f
pyflux/families/skewt.py
python
Skewt.neg_loglikelihood
(y, mean, scale, shape, skewness)
return -np.sum(Skewt.logpdf_internal(x=y, df=shape, loc=mean, gamma=skewness, scale=scale))
Negative loglikelihood function Parameters ---------- y : np.ndarray univariate time series mean : np.ndarray array of location parameters for the Skew t distribution scale : float scale parameter for the Skew t distribution shape :...
Negative loglikelihood function
[ "Negative", "loglikelihood", "function" ]
def neg_loglikelihood(y, mean, scale, shape, skewness): """ Negative loglikelihood function Parameters ---------- y : np.ndarray univariate time series mean : np.ndarray array of location parameters for the Skew t distribution scale : float ...
[ "def", "neg_loglikelihood", "(", "y", ",", "mean", ",", "scale", ",", "shape", ",", "skewness", ")", ":", "m1", "=", "(", "np", ".", "sqrt", "(", "shape", ")", "*", "sp", ".", "gamma", "(", "(", "shape", "-", "1.0", ")", "/", "2.0", ")", ")", ...
https://github.com/RJT1990/pyflux/blob/297f2afc2095acd97c12e827dd500e8ea5da0c0f/pyflux/families/skewt.py#L311-L337
bikalims/bika.lims
35e4bbdb5a3912cae0b5eb13e51097c8b0486349
bika/lims/jsonapi/api.py
python
get_workflow_info
(brain_or_object, endpoint=None)
return {"workflow_info": out}
Generate workflow information of the assigned workflows :param brain_or_object: A single catalog brain or content object :type brain_or_object: ATContentType/DexterityContentType/CatalogBrain :param endpoint: The named URL endpoint for the root of the items :type endpoint: str/unicode :returns: Wor...
Generate workflow information of the assigned workflows
[ "Generate", "workflow", "information", "of", "the", "assigned", "workflows" ]
def get_workflow_info(brain_or_object, endpoint=None): """Generate workflow information of the assigned workflows :param brain_or_object: A single catalog brain or content object :type brain_or_object: ATContentType/DexterityContentType/CatalogBrain :param endpoint: The named URL endpoint for the root ...
[ "def", "get_workflow_info", "(", "brain_or_object", ",", "endpoint", "=", "None", ")", ":", "# ensure we have a full content object", "obj", "=", "get_object", "(", "brain_or_object", ")", "# get the portal workflow tool", "wf_tool", "=", "get_tool", "(", "\"portal_workfl...
https://github.com/bikalims/bika.lims/blob/35e4bbdb5a3912cae0b5eb13e51097c8b0486349/bika/lims/jsonapi/api.py#L405-L478
Blizzard/heroprotocol
3d36eaf44fc4c8ff3331c2ae2f1dc08a94535f1c
heroprotocol/versions/protocol73493.py
python
decode_replay_message_events
(contents)
Decodes and yields each message event from the contents byte string.
Decodes and yields each message event from the contents byte string.
[ "Decodes", "and", "yields", "each", "message", "event", "from", "the", "contents", "byte", "string", "." ]
def decode_replay_message_events(contents): """Decodes and yields each message event from the contents byte string.""" decoder = BitPackedDecoder(contents, typeinfos) for event in _decode_event_stream(decoder, message_eventid_typeid, ...
[ "def", "decode_replay_message_events", "(", "contents", ")", ":", "decoder", "=", "BitPackedDecoder", "(", "contents", ",", "typeinfos", ")", "for", "event", "in", "_decode_event_stream", "(", "decoder", ",", "message_eventid_typeid", ",", "message_event_types", ",", ...
https://github.com/Blizzard/heroprotocol/blob/3d36eaf44fc4c8ff3331c2ae2f1dc08a94535f1c/heroprotocol/versions/protocol73493.py#L414-L421
home-assistant/supervisor
69c2517d5211b483fdfe968b0a2b36b672ee7ab2
supervisor/services/modules/mqtt.py
python
MQTTService.del_service_data
(self, addon: Addon)
Remove the data from service object.
Remove the data from service object.
[ "Remove", "the", "data", "from", "service", "object", "." ]
def del_service_data(self, addon: Addon) -> None: """Remove the data from service object.""" if not self.enabled: raise ServicesError( "Can't remove nonexistent service data", _LOGGER.warning ) self._data.clear() self.save()
[ "def", "del_service_data", "(", "self", ",", "addon", ":", "Addon", ")", "->", "None", ":", "if", "not", "self", ".", "enabled", ":", "raise", "ServicesError", "(", "\"Can't remove nonexistent service data\"", ",", "_LOGGER", ".", "warning", ")", "self", ".", ...
https://github.com/home-assistant/supervisor/blob/69c2517d5211b483fdfe968b0a2b36b672ee7ab2/supervisor/services/modules/mqtt.py#L82-L90
Chaffelson/nipyapi
d3b186fd701ce308c2812746d98af9120955e810
nipyapi/nifi/models/funnel_entity.py
python
FunnelEntity.__repr__
(self)
return self.to_str()
For `print` and `pprint`
For `print` and `pprint`
[ "For", "print", "and", "pprint" ]
def __repr__(self): """ For `print` and `pprint` """ return self.to_str()
[ "def", "__repr__", "(", "self", ")", ":", "return", "self", ".", "to_str", "(", ")" ]
https://github.com/Chaffelson/nipyapi/blob/d3b186fd701ce308c2812746d98af9120955e810/nipyapi/nifi/models/funnel_entity.py#L300-L304
facebookresearch/ParlAI
e4d59c30eef44f1f67105961b82a83fd28d7d78b
parlai/agents/rag/dpr.py
python
BertTokenizerDictionaryAgent.add_special_tokens
(self)
return True
Whether to add special tokens when tokenizing.
Whether to add special tokens when tokenizing.
[ "Whether", "to", "add", "special", "tokens", "when", "tokenizing", "." ]
def add_special_tokens(self) -> bool: """ Whether to add special tokens when tokenizing. """ return True
[ "def", "add_special_tokens", "(", "self", ")", "->", "bool", ":", "return", "True" ]
https://github.com/facebookresearch/ParlAI/blob/e4d59c30eef44f1f67105961b82a83fd28d7d78b/parlai/agents/rag/dpr.py#L270-L274
sahana/eden
1696fa50e90ce967df69f66b571af45356cc18da
modules/s3cfg.py
python
S3Config.get_project_outcomes
(self)
return self.project.get("outcomes", False)
Use Outcomes in Projects
Use Outcomes in Projects
[ "Use", "Outcomes", "in", "Projects" ]
def get_project_outcomes(self): """ Use Outcomes in Projects """ return self.project.get("outcomes", False)
[ "def", "get_project_outcomes", "(", "self", ")", ":", "return", "self", ".", "project", ".", "get", "(", "\"outcomes\"", ",", "False", ")" ]
https://github.com/sahana/eden/blob/1696fa50e90ce967df69f66b571af45356cc18da/modules/s3cfg.py#L6000-L6004
dmlc/dgl
8d14a739bc9e446d6c92ef83eafe5782398118de
python/dgl/heterograph.py
python
DGLHeteroGraph.get_ntype_id_from_dst
(self, ntype)
return ntid
Internal function to return the ID of the given DST node type. ntype can also be None. If so, there should be only one node type in the DST category. Callable even when the self graph is not uni-bipartite. Parameters ---------- ntype : str Node type Returns...
Internal function to return the ID of the given DST node type.
[ "Internal", "function", "to", "return", "the", "ID", "of", "the", "given", "DST", "node", "type", "." ]
def get_ntype_id_from_dst(self, ntype): """Internal function to return the ID of the given DST node type. ntype can also be None. If so, there should be only one node type in the DST category. Callable even when the self graph is not uni-bipartite. Parameters ---------- ...
[ "def", "get_ntype_id_from_dst", "(", "self", ",", "ntype", ")", ":", "if", "ntype", "is", "None", ":", "if", "len", "(", "self", ".", "_dsttypes_invmap", ")", "!=", "1", ":", "raise", "DGLError", "(", "'DST node type name must be specified if there are more than o...
https://github.com/dmlc/dgl/blob/8d14a739bc9e446d6c92ef83eafe5782398118de/python/dgl/heterograph.py#L1216-L1239
JimmXinu/FanFicFare
bc149a2deb2636320fe50a3e374af6eef8f61889
included_dependencies/chardet/big5prober.py
python
Big5Prober.charset_name
(self)
return "Big5"
[]
def charset_name(self): return "Big5"
[ "def", "charset_name", "(", "self", ")", ":", "return", "\"Big5\"" ]
https://github.com/JimmXinu/FanFicFare/blob/bc149a2deb2636320fe50a3e374af6eef8f61889/included_dependencies/chardet/big5prober.py#L42-L43
ctxis/canape
5f0e03424577296bcc60c2008a60a98ec5307e4b
CANAPE.Scripting/Lib/mailbox.py
python
_ProxyFile.seek
(self, offset, whence=0)
Change position.
Change position.
[ "Change", "position", "." ]
def seek(self, offset, whence=0): """Change position.""" if whence == 1: self._file.seek(self._pos) self._file.seek(offset, whence) self._pos = self._file.tell()
[ "def", "seek", "(", "self", ",", "offset", ",", "whence", "=", "0", ")", ":", "if", "whence", "==", "1", ":", "self", ".", "_file", ".", "seek", "(", "self", ".", "_pos", ")", "self", ".", "_file", ".", "seek", "(", "offset", ",", "whence", ")"...
https://github.com/ctxis/canape/blob/5f0e03424577296bcc60c2008a60a98ec5307e4b/CANAPE.Scripting/Lib/mailbox.py#L1848-L1853
ktbyers/netmiko
4c3732346eea1a4a608abd9e09d65eeb2f577810
netmiko/scp_handler.py
python
BaseFileTransfer.close_scp_chan
(self)
Close the SCP connection to the remote network device.
Close the SCP connection to the remote network device.
[ "Close", "the", "SCP", "connection", "to", "the", "remote", "network", "device", "." ]
def close_scp_chan(self) -> None: """Close the SCP connection to the remote network device.""" self.scp_conn.close() del self.scp_conn
[ "def", "close_scp_chan", "(", "self", ")", "->", "None", ":", "self", ".", "scp_conn", ".", "close", "(", ")", "del", "self", ".", "scp_conn" ]
https://github.com/ktbyers/netmiko/blob/4c3732346eea1a4a608abd9e09d65eeb2f577810/netmiko/scp_handler.py#L141-L144
IronLanguages/ironpython3
7a7bb2a872eeab0d1009fc8a6e24dca43f65b693
Src/StdLib/Lib/xmlrpc/client.py
python
ServerProxy.__repr__
(self)
return ( "<ServerProxy for %s%s>" % (self.__host, self.__handler) )
[]
def __repr__(self): return ( "<ServerProxy for %s%s>" % (self.__host, self.__handler) )
[ "def", "__repr__", "(", "self", ")", ":", "return", "(", "\"<ServerProxy for %s%s>\"", "%", "(", "self", ".", "__host", ",", "self", ".", "__handler", ")", ")" ]
https://github.com/IronLanguages/ironpython3/blob/7a7bb2a872eeab0d1009fc8a6e24dca43f65b693/Src/StdLib/Lib/xmlrpc/client.py#L1453-L1457
oilshell/oil
94388e7d44a9ad879b12615f6203b38596b5a2d3
osh/builtin_misc.py
python
Pushd.__init__
(self, mem, dir_stack, errfmt)
[]
def __init__(self, mem, dir_stack, errfmt): # type: (Mem, DirStack, ErrorFormatter) -> None self.mem = mem self.dir_stack = dir_stack self.errfmt = errfmt
[ "def", "__init__", "(", "self", ",", "mem", ",", "dir_stack", ",", "errfmt", ")", ":", "# type: (Mem, DirStack, ErrorFormatter) -> None", "self", ".", "mem", "=", "mem", "self", ".", "dir_stack", "=", "dir_stack", "self", ".", "errfmt", "=", "errfmt" ]
https://github.com/oilshell/oil/blob/94388e7d44a9ad879b12615f6203b38596b5a2d3/osh/builtin_misc.py#L631-L635
google/pytype
fa43edc95dd42ade6e3147d6580d63e778c9d506
pytype/pyi/classdef.py
python
get_metaclass
(keywords: List[ast3.keyword], bases: List[pytd_node.Node])
return None
Scan keywords for a metaclass.
Scan keywords for a metaclass.
[ "Scan", "keywords", "for", "a", "metaclass", "." ]
def get_metaclass(keywords: List[ast3.keyword], bases: List[pytd_node.Node]): """Scan keywords for a metaclass.""" for k in keywords: keyword, value = k.arg, k.value if keyword not in ("metaclass", "total"): raise ParseError(f"Unexpected classdef kwarg {keyword!r}") elif keyword == "total" and no...
[ "def", "get_metaclass", "(", "keywords", ":", "List", "[", "ast3", ".", "keyword", "]", ",", "bases", ":", "List", "[", "pytd_node", ".", "Node", "]", ")", ":", "for", "k", "in", "keywords", ":", "keyword", ",", "value", "=", "k", ".", "arg", ",", ...
https://github.com/google/pytype/blob/fa43edc95dd42ade6e3147d6580d63e778c9d506/pytype/pyi/classdef.py#L54-L69
pculture/miro
d8e4594441939514dd2ac29812bf37087bb3aea5
tv/lib/api.py
python
StorageManager.set_value
(self, key, value)
Set a value using the simple API set_value() stores a value that you can later retrieve with get_value() :param key: key to set (unicode or an ASCII bytestring) :param value: value to set
Set a value using the simple API
[ "Set", "a", "value", "using", "the", "simple", "API" ]
def set_value(self, key, value): """Set a value using the simple API set_value() stores a value that you can later retrieve with get_value() :param key: key to set (unicode or an ASCII bytestring) :param value: value to set """ self._ensure_simple_api_table() ...
[ "def", "set_value", "(", "self", ",", "key", ",", "value", ")", ":", "self", ".", "_ensure_simple_api_table", "(", ")", "self", ".", "_cursor", ".", "execute", "(", "\"INSERT OR REPLACE INTO simple_data \"", "\"(key, value) VALUES (?, ?)\"", ",", "(", "key", ",", ...
https://github.com/pculture/miro/blob/d8e4594441939514dd2ac29812bf37087bb3aea5/tv/lib/api.py#L232-L245
PythonCharmers/python-future
80523f383fbba1c6de0551e19d0277e73e69573c
src/libpasteurize/fixes/fix_kwargs.py
python
needs_fixing
(raw_params, kwargs_default=_kwargs_default_name)
u""" Returns string with the name of the kwargs dict if the params after the first star need fixing Otherwise returns empty string
u""" Returns string with the name of the kwargs dict if the params after the first star need fixing Otherwise returns empty string
[ "u", "Returns", "string", "with", "the", "name", "of", "the", "kwargs", "dict", "if", "the", "params", "after", "the", "first", "star", "need", "fixing", "Otherwise", "returns", "empty", "string" ]
def needs_fixing(raw_params, kwargs_default=_kwargs_default_name): u""" Returns string with the name of the kwargs dict if the params after the first star need fixing Otherwise returns empty string """ found_kwargs = False needs_fix = False for t in raw_params[2:]: if t.type == toke...
[ "def", "needs_fixing", "(", "raw_params", ",", "kwargs_default", "=", "_kwargs_default_name", ")", ":", "found_kwargs", "=", "False", "needs_fix", "=", "False", "for", "t", "in", "raw_params", "[", "2", ":", "]", ":", "if", "t", ".", "type", "==", "token",...
https://github.com/PythonCharmers/python-future/blob/80523f383fbba1c6de0551e19d0277e73e69573c/src/libpasteurize/fixes/fix_kwargs.py#L65-L88
python/mypy
17850b3bd77ae9efb5d21f656c4e4e05ac48d894
mypy/nodes.py
python
is_final_node
(node: Optional[SymbolNode])
return isinstance(node, (Var, FuncDef, OverloadedFuncDef, Decorator)) and node.is_final
Check whether `node` corresponds to a final attribute.
Check whether `node` corresponds to a final attribute.
[ "Check", "whether", "node", "corresponds", "to", "a", "final", "attribute", "." ]
def is_final_node(node: Optional[SymbolNode]) -> bool: """Check whether `node` corresponds to a final attribute.""" return isinstance(node, (Var, FuncDef, OverloadedFuncDef, Decorator)) and node.is_final
[ "def", "is_final_node", "(", "node", ":", "Optional", "[", "SymbolNode", "]", ")", "->", "bool", ":", "return", "isinstance", "(", "node", ",", "(", "Var", ",", "FuncDef", ",", "OverloadedFuncDef", ",", "Decorator", ")", ")", "and", "node", ".", "is_fina...
https://github.com/python/mypy/blob/17850b3bd77ae9efb5d21f656c4e4e05ac48d894/mypy/nodes.py#L3428-L3430
becauseofAI/lffd-pytorch
f7da857f7ea939665b81d7bfedb98d02f4147723
ChasingTrainFramework_GeneralOneClassDetection/image_augmentation/augmentor.py
python
Augmentor.grayscale
(image)
return result
convert BGR image to grayscale image :param image: input image with BGR channels :return:
convert BGR image to grayscale image :param image: input image with BGR channels :return:
[ "convert", "BGR", "image", "to", "grayscale", "image", ":", "param", "image", ":", "input", "image", "with", "BGR", "channels", ":", "return", ":" ]
def grayscale(image): """ convert BGR image to grayscale image :param image: input image with BGR channels :return: """ if image.ndim != 3: return None if image.dtype != numpy.uint8: print('Input image is not uint8!') return Non...
[ "def", "grayscale", "(", "image", ")", ":", "if", "image", ".", "ndim", "!=", "3", ":", "return", "None", "if", "image", ".", "dtype", "!=", "numpy", ".", "uint8", ":", "print", "(", "'Input image is not uint8!'", ")", "return", "None", "result", "=", ...
https://github.com/becauseofAI/lffd-pytorch/blob/f7da857f7ea939665b81d7bfedb98d02f4147723/ChasingTrainFramework_GeneralOneClassDetection/image_augmentation/augmentor.py#L37-L50
lovelylain/pyctp
fd304de4b50c4ddc31a4190b1caaeb5dec66bc5d
stock/ctp/ApiStruct.py
python
QryBrokerTradingParams.__init__
(self, BrokerID='', InvestorID='')
[]
def __init__(self, BrokerID='', InvestorID=''): self.BrokerID = '' #经纪公司代码, char[11] self.InvestorID = ''
[ "def", "__init__", "(", "self", ",", "BrokerID", "=", "''", ",", "InvestorID", "=", "''", ")", ":", "self", ".", "BrokerID", "=", "''", "#经纪公司代码, char[11]", "self", ".", "InvestorID", "=", "''" ]
https://github.com/lovelylain/pyctp/blob/fd304de4b50c4ddc31a4190b1caaeb5dec66bc5d/stock/ctp/ApiStruct.py#L3348-L3350
MozillaSecurity/grizzly
1c41478e32f323189a2c322ec041c3e0902a158a
sapphire/core.py
python
Sapphire.clear_backlog
(self)
Remove all pending connections from backlog. This should only be called when there isn't anything actively trying to connect. Args: None Returns: None
Remove all pending connections from backlog. This should only be called when there isn't anything actively trying to connect.
[ "Remove", "all", "pending", "connections", "from", "backlog", ".", "This", "should", "only", "be", "called", "when", "there", "isn", "t", "anything", "actively", "trying", "to", "connect", "." ]
def clear_backlog(self): """Remove all pending connections from backlog. This should only be called when there isn't anything actively trying to connect. Args: None Returns: None """ LOG.debug("clearing socket backlog") self._socket.setti...
[ "def", "clear_backlog", "(", "self", ")", ":", "LOG", ".", "debug", "(", "\"clearing socket backlog\"", ")", "self", ".", "_socket", ".", "settimeout", "(", "0", ")", "deadline", "=", "time", "(", ")", "+", "10", "while", "True", ":", "try", ":", "self...
https://github.com/MozillaSecurity/grizzly/blob/1c41478e32f323189a2c322ec041c3e0902a158a/sapphire/core.py#L81-L105
python-telegram-bot/python-telegram-bot
ade1529986f5b6d394a65372d6a27045a70725b2
telegram/chat.py
python
Chat.unpin_message
( self, timeout: ODVInput[float] = DEFAULT_NONE, api_kwargs: JSONDict = None, message_id: int = None, )
return self.bot.unpin_chat_message( chat_id=self.id, timeout=timeout, api_kwargs=api_kwargs, message_id=message_id, )
Shortcut for:: bot.unpin_chat_message(chat_id=update.effective_chat.id, *args, **kwargs) For the documentation of the arguments, please see :meth:`telegram.Bot.unpin_chat_message`. Returns: :obj:`...
Shortcut for::
[ "Shortcut", "for", "::" ]
def unpin_message( self, timeout: ODVInput[float] = DEFAULT_NONE, api_kwargs: JSONDict = None, message_id: int = None, ) -> bool: """Shortcut for:: bot.unpin_chat_message(chat_id=update.effective_chat.id, *args, ...
[ "def", "unpin_message", "(", "self", ",", "timeout", ":", "ODVInput", "[", "float", "]", "=", "DEFAULT_NONE", ",", "api_kwargs", ":", "JSONDict", "=", "None", ",", "message_id", ":", "int", "=", "None", ",", ")", "->", "bool", ":", "return", "self", "....
https://github.com/python-telegram-bot/python-telegram-bot/blob/ade1529986f5b6d394a65372d6a27045a70725b2/telegram/chat.py#L733-L757
carltongibson/django-filter
3635b2b67c110627e74404603330583df0000a44
django_filters/rest_framework/backends.py
python
DjangoFilterBackend.get_filterset_class
(self, view, queryset=None)
return None
Return the `FilterSet` class used to filter the queryset.
Return the `FilterSet` class used to filter the queryset.
[ "Return", "the", "FilterSet", "class", "used", "to", "filter", "the", "queryset", "." ]
def get_filterset_class(self, view, queryset=None): """ Return the `FilterSet` class used to filter the queryset. """ filterset_class = getattr(view, 'filterset_class', None) filterset_fields = getattr(view, 'filterset_fields', None) # TODO: remove assertion in 2.1 ...
[ "def", "get_filterset_class", "(", "self", ",", "view", ",", "queryset", "=", "None", ")", ":", "filterset_class", "=", "getattr", "(", "view", ",", "'filterset_class'", ",", "None", ")", "filterset_fields", "=", "getattr", "(", "view", ",", "'filterset_fields...
https://github.com/carltongibson/django-filter/blob/3635b2b67c110627e74404603330583df0000a44/django_filters/rest_framework/backends.py#L38-L80
Yelp/paasta
6c08c04a577359509575c794b973ea84d72accf9
paasta_tools/utils.py
python
configure_log
()
We will log to the yocalhost binded scribe.
We will log to the yocalhost binded scribe.
[ "We", "will", "log", "to", "the", "yocalhost", "binded", "scribe", "." ]
def configure_log() -> None: """We will log to the yocalhost binded scribe.""" log_writer_config = load_system_paasta_config().get_log_writer() global _log_writer LogWriterClass = get_log_writer_class(log_writer_config["driver"]) _log_writer = LogWriterClass(**log_writer_config.get("options", {}))
[ "def", "configure_log", "(", ")", "->", "None", ":", "log_writer_config", "=", "load_system_paasta_config", "(", ")", ".", "get_log_writer", "(", ")", "global", "_log_writer", "LogWriterClass", "=", "get_log_writer_class", "(", "log_writer_config", "[", "\"driver\"", ...
https://github.com/Yelp/paasta/blob/6c08c04a577359509575c794b973ea84d72accf9/paasta_tools/utils.py#L1361-L1366
rucio/rucio
6d0d358e04f5431f0b9a98ae40f31af0ddff4833
lib/rucio/core/permission/generic.py
python
perm_set_local_account_limit
(issuer, kwargs)
return False
Checks if an account can set an account limit. :param account: Account identifier which issues the command. :param kwargs: List of arguments for the action. :returns: True if account is allowed, otherwise False
Checks if an account can set an account limit.
[ "Checks", "if", "an", "account", "can", "set", "an", "account", "limit", "." ]
def perm_set_local_account_limit(issuer, kwargs): """ Checks if an account can set an account limit. :param account: Account identifier which issues the command. :param kwargs: List of arguments for the action. :returns: True if account is allowed, otherwise False """ if _is_root(issuer) or...
[ "def", "perm_set_local_account_limit", "(", "issuer", ",", "kwargs", ")", ":", "if", "_is_root", "(", "issuer", ")", "or", "has_account_attribute", "(", "account", "=", "issuer", ",", "key", "=", "'admin'", ")", ":", "return", "True", "# Check if user is a count...
https://github.com/rucio/rucio/blob/6d0d358e04f5431f0b9a98ae40f31af0ddff4833/lib/rucio/core/permission/generic.py#L769-L786
IJDykeman/wangTiles
7c1ee2095ebdf7f72bce07d94c6484915d5cae8b
experimental_code/venv/lib/python2.7/site-packages/setuptools/command/egg_info.py
python
manifest_maker.write_manifest
(self)
Write the file list in 'self.filelist' to the manifest file named by 'self.manifest'.
Write the file list in 'self.filelist' to the manifest file named by 'self.manifest'.
[ "Write", "the", "file", "list", "in", "self", ".", "filelist", "to", "the", "manifest", "file", "named", "by", "self", ".", "manifest", "." ]
def write_manifest(self): """ Write the file list in 'self.filelist' to the manifest file named by 'self.manifest'. """ self.filelist._repair() # Now _repairs should encodability, but not unicode files = [self._manifest_normalize(f) for f in self.filelist.files] ...
[ "def", "write_manifest", "(", "self", ")", ":", "self", ".", "filelist", ".", "_repair", "(", ")", "# Now _repairs should encodability, but not unicode", "files", "=", "[", "self", ".", "_manifest_normalize", "(", "f", ")", "for", "f", "in", "self", ".", "file...
https://github.com/IJDykeman/wangTiles/blob/7c1ee2095ebdf7f72bce07d94c6484915d5cae8b/experimental_code/venv/lib/python2.7/site-packages/setuptools/command/egg_info.py#L302-L312
scrtlabs/catalyst
2e8029780f2381da7a0729f7b52505e5db5f535b
catalyst/assets/assets.py
python
AssetFinder.lifetimes
(self, dates, include_start_date)
return pd.DataFrame(mask, index=dates, columns=lifetimes.sid)
Compute a DataFrame representing asset lifetimes for the specified date range. Parameters ---------- dates : pd.DatetimeIndex The dates for which to compute lifetimes. include_start_date : bool Whether or not to count the asset as alive on its start_date....
Compute a DataFrame representing asset lifetimes for the specified date range.
[ "Compute", "a", "DataFrame", "representing", "asset", "lifetimes", "for", "the", "specified", "date", "range", "." ]
def lifetimes(self, dates, include_start_date): """ Compute a DataFrame representing asset lifetimes for the specified date range. Parameters ---------- dates : pd.DatetimeIndex The dates for which to compute lifetimes. include_start_date : bool ...
[ "def", "lifetimes", "(", "self", ",", "dates", ",", "include_start_date", ")", ":", "# This is a less than ideal place to do this, because if someone adds", "# assets to the finder after we've touched lifetimes we won't have", "# those new assets available. Mutability is not my favorite", ...
https://github.com/scrtlabs/catalyst/blob/2e8029780f2381da7a0729f7b52505e5db5f535b/catalyst/assets/assets.py#L1291-L1338
LexPredict/lexpredict-contraxsuite
1d5a2540d31f8f3f1adc442cfa13a7c007319899
sdk/python/sdk/openapi_client/model/project_stats.py
python
ProjectStats.__init__
(self, project_id, name, type_title, documents_total, clauses_total, avg_ocr_grade, document_status_not_started, document_status_not_started_pcnt, document_status_in_review, document_status_in_review_pcnt, document_status_awaiting_qa, document_status_awaiting_qa_pcnt, document_status_completed, document_status_complete...
ProjectStats - a model defined in OpenAPI Args: project_id (int): name (str): type_title (str): documents_total (int): clauses_total (int): avg_ocr_grade (int, none_type): document_status_not_started (int): document...
ProjectStats - a model defined in OpenAPI
[ "ProjectStats", "-", "a", "model", "defined", "in", "OpenAPI" ]
def __init__(self, project_id, name, type_title, documents_total, clauses_total, avg_ocr_grade, document_status_not_started, document_status_not_started_pcnt, document_status_in_review, document_status_in_review_pcnt, document_status_awaiting_qa, document_status_awaiting_qa_pcnt, document_status_completed, document_sta...
[ "def", "__init__", "(", "self", ",", "project_id", ",", "name", ",", "type_title", ",", "documents_total", ",", "clauses_total", ",", "avg_ocr_grade", ",", "document_status_not_started", ",", "document_status_not_started_pcnt", ",", "document_status_in_review", ",", "do...
https://github.com/LexPredict/lexpredict-contraxsuite/blob/1d5a2540d31f8f3f1adc442cfa13a7c007319899/sdk/python/sdk/openapi_client/model/project_stats.py#L272-L387
yuzhoujr/leetcode
6a2ad1fc11225db18f68bfadd21a7419d2cb52a4
tree/YeSheng/101.Symmetric_Tree.py
python
symmetric
(node1, node2)
[]
def symmetric(node1, node2): # Using try catch follows python EAFP coding style try: return node1.val == node2.val and symmetric(node1.left, node2.right) and symmetric( node1.right, node2.left) except: return node1 is node2
[ "def", "symmetric", "(", "node1", ",", "node2", ")", ":", "# Using try catch follows python EAFP coding style", "try", ":", "return", "node1", ".", "val", "==", "node2", ".", "val", "and", "symmetric", "(", "node1", ".", "left", ",", "node2", ".", "right", "...
https://github.com/yuzhoujr/leetcode/blob/6a2ad1fc11225db18f68bfadd21a7419d2cb52a4/tree/YeSheng/101.Symmetric_Tree.py#L13-L19
buckyroberts/Vataxia
6ae68e8602df3e0544a5ca62ffa847a8a1a83a90
v1/accounts/serializers/accept_invitation.py
python
AcceptInvitationSerializer.validate_password
(password)
return password
Validate password
Validate password
[ "Validate", "password" ]
def validate_password(password): """ Validate password """ validate_password(password) return password
[ "def", "validate_password", "(", "password", ")", ":", "validate_password", "(", "password", ")", "return", "password" ]
https://github.com/buckyroberts/Vataxia/blob/6ae68e8602df3e0544a5ca62ffa847a8a1a83a90/v1/accounts/serializers/accept_invitation.py#L54-L60
numba/numba
bf480b9e0da858a65508c2b17759a72ee6a44c51
numba/cuda/cudadrv/nvvm.py
python
add_ir_version
(mod)
Add NVVM IR version to module
Add NVVM IR version to module
[ "Add", "NVVM", "IR", "version", "to", "module" ]
def add_ir_version(mod): """Add NVVM IR version to module""" i32 = ir.IntType(32) if NVVM().is_nvvm70: # NVVM IR 1.6, DWARF 3.0 ir_versions = [i32(1), i32(6), i32(3), i32(0)] else: # NVVM IR 1.1, DWARF 2.0 ir_versions = [i32(1), i32(2), i32(2), i32(0)] md_ver = mod.a...
[ "def", "add_ir_version", "(", "mod", ")", ":", "i32", "=", "ir", ".", "IntType", "(", "32", ")", "if", "NVVM", "(", ")", ".", "is_nvvm70", ":", "# NVVM IR 1.6, DWARF 3.0", "ir_versions", "=", "[", "i32", "(", "1", ")", ",", "i32", "(", "6", ")", ",...
https://github.com/numba/numba/blob/bf480b9e0da858a65508c2b17759a72ee6a44c51/numba/cuda/cudadrv/nvvm.py#L912-L923
fonttools/fonttools
892322aaff6a89bea5927379ec06bc0da3dfb7df
Lib/fontTools/ufoLib/validators.py
python
fontInfoOpenTypeOS2WeightClassValidator
(value)
return True
Version 2+.
Version 2+.
[ "Version", "2", "+", "." ]
def fontInfoOpenTypeOS2WeightClassValidator(value): """ Version 2+. """ if not isinstance(value, int): return False if value < 0: return False return True
[ "def", "fontInfoOpenTypeOS2WeightClassValidator", "(", "value", ")", ":", "if", "not", "isinstance", "(", "value", ",", "int", ")", ":", "return", "False", "if", "value", "<", "0", ":", "return", "False", "return", "True" ]
https://github.com/fonttools/fonttools/blob/892322aaff6a89bea5927379ec06bc0da3dfb7df/Lib/fontTools/ufoLib/validators.py#L206-L214
KalleHallden/AutoTimer
2d954216700c4930baa154e28dbddc34609af7ce
env/lib/python2.7/site-packages/pip/_internal/models/link.py
python
Link.is_wheel
(self)
return self.ext == WHEEL_EXTENSION
[]
def is_wheel(self): # type: () -> bool return self.ext == WHEEL_EXTENSION
[ "def", "is_wheel", "(", "self", ")", ":", "# type: () -> bool", "return", "self", ".", "ext", "==", "WHEEL_EXTENSION" ]
https://github.com/KalleHallden/AutoTimer/blob/2d954216700c4930baa154e28dbddc34609af7ce/env/lib/python2.7/site-packages/pip/_internal/models/link.py#L175-L177
bruderstein/PythonScript
df9f7071ddf3a079e3a301b9b53a6dc78cf1208f
PythonLib/full/asyncio/events.py
python
set_event_loop
(loop)
Equivalent to calling get_event_loop_policy().set_event_loop(loop).
Equivalent to calling get_event_loop_policy().set_event_loop(loop).
[ "Equivalent", "to", "calling", "get_event_loop_policy", "()", ".", "set_event_loop", "(", "loop", ")", "." ]
def set_event_loop(loop): """Equivalent to calling get_event_loop_policy().set_event_loop(loop).""" get_event_loop_policy().set_event_loop(loop)
[ "def", "set_event_loop", "(", "loop", ")", ":", "get_event_loop_policy", "(", ")", ".", "set_event_loop", "(", "loop", ")" ]
https://github.com/bruderstein/PythonScript/blob/df9f7071ddf3a079e3a301b9b53a6dc78cf1208f/PythonLib/full/asyncio/events.py#L775-L777
pwnieexpress/pwn_plug_sources
1a23324f5dc2c3de20f9c810269b6a29b2758cad
src/plecost/plecost-0.2.2-9-beta.py
python
CVE.CVE_list
(self, key_word)
Create a object file. Content: CVE entries [Id,Description]. Search by keyword in wordpress.
Create a object file. Content: CVE entries [Id,Description]. Search by keyword in wordpress.
[ "Create", "a", "object", "file", ".", "Content", ":", "CVE", "entries", "[", "Id", "Description", "]", ".", "Search", "by", "keyword", "in", "wordpress", "." ]
def CVE_list(self, key_word): ''' Create a object file. Content: CVE entries [Id,Description]. Search by keyword in wordpress. ''' try: cve_file = file(CVE_file,"w") except IOError: print "No such file or directory" try: cve = urllib2.urlopen("http://cve.mitre.org/cgi-bin/cvekey...
[ "def", "CVE_list", "(", "self", ",", "key_word", ")", ":", "try", ":", "cve_file", "=", "file", "(", "CVE_file", ",", "\"w\"", ")", "except", "IOError", ":", "print", "\"No such file or directory\"", "try", ":", "cve", "=", "urllib2", ".", "urlopen", "(", ...
https://github.com/pwnieexpress/pwn_plug_sources/blob/1a23324f5dc2c3de20f9c810269b6a29b2758cad/src/plecost/plecost-0.2.2-9-beta.py#L128-L157
pvlib/pvlib-python
1ab0eb20f9cd9fb9f7a0ddf35f81283f2648e34a
pvlib/irradiance.py
python
_dirint_bins
(times, kt_prime, zenith, w, delta_kt_prime)
return kt_prime_bin, zenith_bin, w_bin, delta_kt_prime_bin
Determine the bins for the DIRINT coefficients. Parameters ---------- times : pd.DatetimeIndex kt_prime : Zenith-independent clearness index zenith : Solar zenith angle w : precipitable water estimated from surface dew-point temperature delta_kt_prime : stability index Returns ----...
Determine the bins for the DIRINT coefficients.
[ "Determine", "the", "bins", "for", "the", "DIRINT", "coefficients", "." ]
def _dirint_bins(times, kt_prime, zenith, w, delta_kt_prime): """ Determine the bins for the DIRINT coefficients. Parameters ---------- times : pd.DatetimeIndex kt_prime : Zenith-independent clearness index zenith : Solar zenith angle w : precipitable water estimated from surface dew-po...
[ "def", "_dirint_bins", "(", "times", ",", "kt_prime", ",", "zenith", ",", "w", ",", "delta_kt_prime", ")", ":", "# @wholmgren: the following bin assignments use MATLAB's 1-indexing.", "# Later, we'll subtract 1 to conform to Python's 0-indexing.", "# Create kt_prime bins", "kt_prim...
https://github.com/pvlib/pvlib-python/blob/1ab0eb20f9cd9fb9f7a0ddf35f81283f2648e34a/pvlib/irradiance.py#L1656-L1712
DataDog/integrations-core
934674b29d94b70ccc008f76ea172d0cdae05e1e
eks_fargate/datadog_checks/eks_fargate/config_models/defaults.py
python
instance_service
(field, value)
return get_default_field_value(field, value)
[]
def instance_service(field, value): return get_default_field_value(field, value)
[ "def", "instance_service", "(", "field", ",", "value", ")", ":", "return", "get_default_field_value", "(", "field", ",", "value", ")" ]
https://github.com/DataDog/integrations-core/blob/934674b29d94b70ccc008f76ea172d0cdae05e1e/eks_fargate/datadog_checks/eks_fargate/config_models/defaults.py#L133-L134
google/apis-client-generator
f09f0ba855c3845d315b811c6234fd3996f33172
ez_setup.py
python
_validate_md5
(egg_name, data)
return data
[]
def _validate_md5(egg_name, data): if egg_name in md5_data: digest = md5(data).hexdigest() if digest != md5_data[egg_name]: print >>sys.stderr, ( "md5 validation of %s failed! (Possible download problem?)" % egg_name ) sys.exit(2) ...
[ "def", "_validate_md5", "(", "egg_name", ",", "data", ")", ":", "if", "egg_name", "in", "md5_data", ":", "digest", "=", "md5", "(", "data", ")", ".", "hexdigest", "(", ")", "if", "digest", "!=", "md5_data", "[", "egg_name", "]", ":", "print", ">>", "...
https://github.com/google/apis-client-generator/blob/f09f0ba855c3845d315b811c6234fd3996f33172/ez_setup.py#L42-L51
OpenZWave/python-openzwave
8be4c070294348f3fc268bc1d7ad2c535f352f5a
pyozw_pkgconfig.py
python
_split_version_specifier
(spec)
return m.group(2), m.group(1)
Splits version specifiers in the form ">= 0.1.2" into ('0.1.2', '>=')
Splits version specifiers in the form ">= 0.1.2" into ('0.1.2', '>=')
[ "Splits", "version", "specifiers", "in", "the", "form", ">", "=", "0", ".", "1", ".", "2", "into", "(", "0", ".", "1", ".", "2", ">", "=", ")" ]
def _split_version_specifier(spec): """Splits version specifiers in the form ">= 0.1.2" into ('0.1.2', '>=')""" m = re.search(r'([<>=]?=?)?\s*((\d*\.)*\d*)', spec) return m.group(2), m.group(1)
[ "def", "_split_version_specifier", "(", "spec", ")", ":", "m", "=", "re", ".", "search", "(", "r'([<>=]?=?)?\\s*((\\d*\\.)*\\d*)'", ",", "spec", ")", "return", "m", ".", "group", "(", "2", ")", ",", "m", ".", "group", "(", "1", ")" ]
https://github.com/OpenZWave/python-openzwave/blob/8be4c070294348f3fc268bc1d7ad2c535f352f5a/pyozw_pkgconfig.py#L49-L52
aboSamoor/polyglot
9b93b2ecbb9ba1f638c56b92665336e93230646a
polyglot/text.py
python
Text.to_json
(self, *args, **kwargs)
return json.dumps(self.serialized, *args, **kwargs)
Return a json representation (str) of this blob. Takes the same arguments as json.dumps. .. versionadded:: 0.5.1
Return a json representation (str) of this blob. Takes the same arguments as json.dumps. .. versionadded:: 0.5.1
[ "Return", "a", "json", "representation", "(", "str", ")", "of", "this", "blob", ".", "Takes", "the", "same", "arguments", "as", "json", ".", "dumps", ".", "..", "versionadded", "::", "0", ".", "5", ".", "1" ]
def to_json(self, *args, **kwargs): '''Return a json representation (str) of this blob. Takes the same arguments as json.dumps. .. versionadded:: 0.5.1 ''' try: import ujson as json except ImportError: import json return json.dumps(self.serialized, *args, **kwargs)
[ "def", "to_json", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "try", ":", "import", "ujson", "as", "json", "except", "ImportError", ":", "import", "json", "return", "json", ".", "dumps", "(", "self", ".", "serialized", ",", "*",...
https://github.com/aboSamoor/polyglot/blob/9b93b2ecbb9ba1f638c56b92665336e93230646a/polyglot/text.py#L529-L538
owid/covid-19-data
936aeae6cfbdc0163939ed7bd8ecdbb2582c0a92
scripts/src/cowidev/vax/batch/israel.py
python
Israel.export
(self)
[]
def export(self): destination = paths.out_vax(self.location) self.read().pipe(self.pipeline).to_csv(destination, index=False) # Export age data df_age = self.read_age().pipe(self.pipeline_age) df_age.to_csv(paths.out_vax(self.location, age=True), index=False) export_metad...
[ "def", "export", "(", "self", ")", ":", "destination", "=", "paths", ".", "out_vax", "(", "self", ".", "location", ")", "self", ".", "read", "(", ")", ".", "pipe", "(", "self", ".", "pipeline", ")", ".", "to_csv", "(", "destination", ",", "index", ...
https://github.com/owid/covid-19-data/blob/936aeae6cfbdc0163939ed7bd8ecdbb2582c0a92/scripts/src/cowidev/vax/batch/israel.py#L158-L168
smart-mobile-software/gitstack
d9fee8f414f202143eb6e620529e8e5539a2af56
python/Lib/site-packages/django/core/cache/backends/base.py
python
get_key_func
(key_func)
return default_key_func
Function to decide which key function to use. Defaults to ``default_key_func``.
Function to decide which key function to use.
[ "Function", "to", "decide", "which", "key", "function", "to", "use", "." ]
def get_key_func(key_func): """ Function to decide which key function to use. Defaults to ``default_key_func``. """ if key_func is not None: if callable(key_func): return key_func else: key_func_module_path, key_func_name = key_func.rsplit('.', 1) ...
[ "def", "get_key_func", "(", "key_func", ")", ":", "if", "key_func", "is", "not", "None", ":", "if", "callable", "(", "key_func", ")", ":", "return", "key_func", "else", ":", "key_func_module_path", ",", "key_func_name", "=", "key_func", ".", "rsplit", "(", ...
https://github.com/smart-mobile-software/gitstack/blob/d9fee8f414f202143eb6e620529e8e5539a2af56/python/Lib/site-packages/django/core/cache/backends/base.py#L28-L41
googleads/google-ads-python
2a1d6062221f6aad1992a6bcca0e7e4a93d2db86
google/ads/googleads/v9/services/services/account_budget_proposal_service/client.py
python
AccountBudgetProposalServiceClient.common_organization_path
(organization: str,)
return "organizations/{organization}".format(organization=organization,)
Return a fully-qualified organization string.
Return a fully-qualified organization string.
[ "Return", "a", "fully", "-", "qualified", "organization", "string", "." ]
def common_organization_path(organization: str,) -> str: """Return a fully-qualified organization string.""" return "organizations/{organization}".format(organization=organization,)
[ "def", "common_organization_path", "(", "organization", ":", "str", ",", ")", "->", "str", ":", "return", "\"organizations/{organization}\"", ".", "format", "(", "organization", "=", "organization", ",", ")" ]
https://github.com/googleads/google-ads-python/blob/2a1d6062221f6aad1992a6bcca0e7e4a93d2db86/google/ads/googleads/v9/services/services/account_budget_proposal_service/client.py#L270-L272
kovidgoyal/calibre
2b41671370f2a9eb1109b9ae901ccf915f1bd0c8
src/calibre/utils/smtplib.py
python
SMTP.send
(self, str)
Send `str' to the server.
Send `str' to the server.
[ "Send", "str", "to", "the", "server", "." ]
def send(self, str): """Send `str' to the server.""" if self.debuglevel > 0: raw = repr(str) self.debug('send:', raw) if hasattr(self, 'sock') and self.sock: try: self.sock.sendall(str) except OSError: self.close() ...
[ "def", "send", "(", "self", ",", "str", ")", ":", "if", "self", ".", "debuglevel", ">", "0", ":", "raw", "=", "repr", "(", "str", ")", "self", ".", "debug", "(", "'send:'", ",", "raw", ")", "if", "hasattr", "(", "self", ",", "'sock'", ")", "and...
https://github.com/kovidgoyal/calibre/blob/2b41671370f2a9eb1109b9ae901ccf915f1bd0c8/src/calibre/utils/smtplib.py#L344-L356
wradlib/wradlib
25f9768ddfd69b5c339d8b22d20e45e591eaeb8d
wradlib/io/iris.py
python
IrisRawFile.get_moment
(self, sweep_number, moment)
Load a single moment of a given sweep. Parameters ---------- sweep_number : int Sweep Number. moment : str Data Type to retrieve.
Load a single moment of a given sweep.
[ "Load", "a", "single", "moment", "of", "a", "given", "sweep", "." ]
def get_moment(self, sweep_number, moment): """Load a single moment of a given sweep. Parameters ---------- sweep_number : int Sweep Number. moment : str Data Type to retrieve. """ sweep = self.data[sweep_number] # create new swe...
[ "def", "get_moment", "(", "self", ",", "sweep_number", ",", "moment", ")", ":", "sweep", "=", "self", ".", "data", "[", "sweep_number", "]", "# create new sweep_data OrderedDict", "if", "not", "sweep", ".", "get", "(", "\"sweep_data\"", ",", "False", ")", ":...
https://github.com/wradlib/wradlib/blob/25f9768ddfd69b5c339d8b22d20e45e591eaeb8d/wradlib/io/iris.py#L3463-L3574
timkpaine/pyEX
254acd2b0cf7cb7183100106f4ecc11d1860c46a
pyEX/stocks/keyStats.py
python
keyStats
(symbol, stat="", token="", version="stable", filter="", format="json")
return _get( "stock/{}/stats".format(_quoteSymbols(symbol)), token=token, version=version, filter=filter, format=format, )
Key Stats about company https://iexcloud.io/docs/api/#key-stats 8am, 9am ET Args: symbol (str): Ticker to request stat (Optiona[str]): specific stat to request, in: companyName marketcap week5...
Key Stats about company
[ "Key", "Stats", "about", "company" ]
def keyStats(symbol, stat="", token="", version="stable", filter="", format="json"): """Key Stats about company https://iexcloud.io/docs/api/#key-stats 8am, 9am ET Args: symbol (str): Ticker to request stat (Optiona[str]): specific stat to request, in: ...
[ "def", "keyStats", "(", "symbol", ",", "stat", "=", "\"\"", ",", "token", "=", "\"\"", ",", "version", "=", "\"stable\"", ",", "filter", "=", "\"\"", ",", "format", "=", "\"json\"", ")", ":", "_raiseIfNotStr", "(", "symbol", ")", "if", "stat", ":", "...
https://github.com/timkpaine/pyEX/blob/254acd2b0cf7cb7183100106f4ecc11d1860c46a/pyEX/stocks/keyStats.py#L27-L91
lisa-lab/pylearn2
af81e5c362f0df4df85c3e54e23b2adeec026055
pylearn2/scripts/tutorials/jobman_demo/utils.py
python
log_uniform
(low, high)
return rval
Generates a number that's uniformly distributed in the log-space between `low` and `high` Parameters ---------- low : float Lower bound of the randomly generated number high : float Upper bound of the randomly generated number Returns ------- rval : float Random...
Generates a number that's uniformly distributed in the log-space between `low` and `high`
[ "Generates", "a", "number", "that", "s", "uniformly", "distributed", "in", "the", "log", "-", "space", "between", "low", "and", "high" ]
def log_uniform(low, high): """ Generates a number that's uniformly distributed in the log-space between `low` and `high` Parameters ---------- low : float Lower bound of the randomly generated number high : float Upper bound of the randomly generated number Returns ...
[ "def", "log_uniform", "(", "low", ",", "high", ")", ":", "log_low", "=", "numpy", ".", "log", "(", "low", ")", "log_high", "=", "numpy", ".", "log", "(", "high", ")", "log_rval", "=", "numpy", ".", "random", ".", "uniform", "(", "log_low", ",", "lo...
https://github.com/lisa-lab/pylearn2/blob/af81e5c362f0df4df85c3e54e23b2adeec026055/pylearn2/scripts/tutorials/jobman_demo/utils.py#L8-L32
leancloud/satori
701caccbd4fe45765001ca60435c0cb499477c03
satori-rules/plugin/libs/requests/packages/chardet/jpcntx.py
python
SJISContextAnalysis.get_order
(self, aBuf)
return -1, charLen
[]
def get_order(self, aBuf): if not aBuf: return -1, 1 # find out current char's byte length first_char = wrap_ord(aBuf[0]) if ((0x81 <= first_char <= 0x9F) or (0xE0 <= first_char <= 0xFC)): charLen = 2 if (first_char == 0x87) or (0xFA <= first_char <= 0...
[ "def", "get_order", "(", "self", ",", "aBuf", ")", ":", "if", "not", "aBuf", ":", "return", "-", "1", ",", "1", "# find out current char's byte length", "first_char", "=", "wrap_ord", "(", "aBuf", "[", "0", "]", ")", "if", "(", "(", "0x81", "<=", "firs...
https://github.com/leancloud/satori/blob/701caccbd4fe45765001ca60435c0cb499477c03/satori-rules/plugin/libs/requests/packages/chardet/jpcntx.py#L186-L204
intrig-unicamp/mininet-wifi
3c8a8f63bd4aa043aa9c1ad16f304dec2916f5ba
mn_wifi/sumo/traci/_vehicle.py
python
VehicleDomain.addSubscriptionFilterUpstreamDistance
(self, dist)
addSubscriptionFilterUpstreamDist(float) -> None Sets the upstream distance along the network for vehicles to be returned by the last modified vehicle context subscription (call it just after subscribing).
addSubscriptionFilterUpstreamDist(float) -> None Sets the upstream distance along the network for vehicles to be returned by the last modified vehicle context subscription (call it just after subscribing).
[ "addSubscriptionFilterUpstreamDist", "(", "float", ")", "-", ">", "None", "Sets", "the", "upstream", "distance", "along", "the", "network", "for", "vehicles", "to", "be", "returned", "by", "the", "last", "modified", "vehicle", "context", "subscription", "(", "ca...
def addSubscriptionFilterUpstreamDistance(self, dist): """addSubscriptionFilterUpstreamDist(float) -> None Sets the upstream distance along the network for vehicles to be returned by the last modified vehicle context subscription (call it just after subscribing). """ self._connec...
[ "def", "addSubscriptionFilterUpstreamDistance", "(", "self", ",", "dist", ")", ":", "self", ".", "_connection", ".", "_addSubscriptionFilter", "(", "tc", ".", "FILTER_TYPE_UPSTREAM_DIST", ",", "dist", ")" ]
https://github.com/intrig-unicamp/mininet-wifi/blob/3c8a8f63bd4aa043aa9c1ad16f304dec2916f5ba/mn_wifi/sumo/traci/_vehicle.py#L1481-L1486
munki/munki
4b778f0e5a73ed3df9eb62d93c5227efb29eebe3
code/client/munkilib/adobeutils/adobeinfo.py
python
getAdobeCatalogInfo
(mountpoint, pkgname="")
return None
Used by makepkginfo to build pkginfo data for Adobe installers/updaters
Used by makepkginfo to build pkginfo data for Adobe installers/updaters
[ "Used", "by", "makepkginfo", "to", "build", "pkginfo", "data", "for", "Adobe", "installers", "/", "updaters" ]
def getAdobeCatalogInfo(mountpoint, pkgname=""): '''Used by makepkginfo to build pkginfo data for Adobe installers/updaters''' # look for AdobeDeploymentManager (AAMEE installer) deploymentmanager = find_adobe_deployment_manager(mountpoint) if deploymentmanager: dirpath = os.path.dirname(de...
[ "def", "getAdobeCatalogInfo", "(", "mountpoint", ",", "pkgname", "=", "\"\"", ")", ":", "# look for AdobeDeploymentManager (AAMEE installer)", "deploymentmanager", "=", "find_adobe_deployment_manager", "(", "mountpoint", ")", "if", "deploymentmanager", ":", "dirpath", "=", ...
https://github.com/munki/munki/blob/4b778f0e5a73ed3df9eb62d93c5227efb29eebe3/code/client/munkilib/adobeutils/adobeinfo.py#L485-L783
tosher/Mediawiker
81bf97cace59bedcb1668e7830b85c36e014428e
lib/Crypto.lin.x64/Crypto/PublicKey/RSA.py
python
construct
(rsa_components, consistency_check=True)
return key
r"""Construct an RSA key from a tuple of valid RSA components. The modulus **n** must be the product of two primes. The public exponent **e** must be odd and larger than 1. In case of a private key, the following equations must apply: .. math:: \begin{align} p*q &= n \\ e*d &...
r"""Construct an RSA key from a tuple of valid RSA components.
[ "r", "Construct", "an", "RSA", "key", "from", "a", "tuple", "of", "valid", "RSA", "components", "." ]
def construct(rsa_components, consistency_check=True): r"""Construct an RSA key from a tuple of valid RSA components. The modulus **n** must be the product of two primes. The public exponent **e** must be odd and larger than 1. In case of a private key, the following equations must apply: .. math...
[ "def", "construct", "(", "rsa_components", ",", "consistency_check", "=", "True", ")", ":", "class", "InputComps", "(", "object", ")", ":", "pass", "input_comps", "=", "InputComps", "(", ")", "for", "(", "comp", ",", "value", ")", "in", "zip", "(", "(", ...
https://github.com/tosher/Mediawiker/blob/81bf97cace59bedcb1668e7830b85c36e014428e/lib/Crypto.lin.x64/Crypto/PublicKey/RSA.py#L471-L611
replit-archive/empythoned
977ec10ced29a3541a4973dc2b59910805695752
cpython/Lib/decimal.py
python
Decimal.is_snan
(self)
return self._exp == 'N'
Return True if self is a signaling NaN; otherwise return False.
Return True if self is a signaling NaN; otherwise return False.
[ "Return", "True", "if", "self", "is", "a", "signaling", "NaN", ";", "otherwise", "return", "False", "." ]
def is_snan(self): """Return True if self is a signaling NaN; otherwise return False.""" return self._exp == 'N'
[ "def", "is_snan", "(", "self", ")", ":", "return", "self", ".", "_exp", "==", "'N'" ]
https://github.com/replit-archive/empythoned/blob/977ec10ced29a3541a4973dc2b59910805695752/cpython/Lib/decimal.py#L3019-L3021
home-assistant/core
265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1
homeassistant/components/zha/core/helpers.py
python
LogMixin.info
(self, msg, *args)
return self.log(logging.INFO, msg, *args)
Info level log.
Info level log.
[ "Info", "level", "log", "." ]
def info(self, msg, *args): """Info level log.""" return self.log(logging.INFO, msg, *args)
[ "def", "info", "(", "self", ",", "msg", ",", "*", "args", ")", ":", "return", "self", ".", "log", "(", "logging", ".", "INFO", ",", "msg", ",", "*", "args", ")" ]
https://github.com/home-assistant/core/blob/265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1/homeassistant/components/zha/core/helpers.py#L216-L218
SteveDoyle2/pyNastran
eda651ac2d4883d95a34951f8a002ff94f642a1a
pyNastran/dev/bdf_vectorized2/cards/elements/solids.py
python
CPENTA15v.add_card
(self, card, comment='')
Adds a CPENTA15 card from ``BDF.add_card(...)`` Parameters ---------- card : BDFCard() a BDFCard object comment : str; default='' a comment for the card
Adds a CPENTA15 card from ``BDF.add_card(...)``
[ "Adds", "a", "CPENTA15", "card", "from", "BDF", ".", "add_card", "(", "...", ")" ]
def add_card(self, card, comment=''): """ Adds a CPENTA15 card from ``BDF.add_card(...)`` Parameters ---------- card : BDFCard() a BDFCard object comment : str; default='' a comment for the card """ eid = integer(card, 1, 'eid') ...
[ "def", "add_card", "(", "self", ",", "card", ",", "comment", "=", "''", ")", ":", "eid", "=", "integer", "(", "card", ",", "1", ",", "'eid'", ")", "pid", "=", "integer", "(", "card", ",", "2", ",", "'pid'", ")", "nids", "=", "[", "integer", "("...
https://github.com/SteveDoyle2/pyNastran/blob/eda651ac2d4883d95a34951f8a002ff94f642a1a/pyNastran/dev/bdf_vectorized2/cards/elements/solids.py#L386-L417
mlflow/mlflow
364aca7daf0fcee3ec407ae0b1b16d9cb3085081
mlflow/store/tracking/rest_store.py
python
RestStore.log_metric
(self, run_id, metric)
Log a metric for the specified run :param run_id: String id for the run :param metric: Metric instance to log
Log a metric for the specified run
[ "Log", "a", "metric", "for", "the", "specified", "run" ]
def log_metric(self, run_id, metric): """ Log a metric for the specified run :param run_id: String id for the run :param metric: Metric instance to log """ req_body = message_to_json( LogMetric( run_uuid=run_id, run_id=run_id, ...
[ "def", "log_metric", "(", "self", ",", "run_id", ",", "metric", ")", ":", "req_body", "=", "message_to_json", "(", "LogMetric", "(", "run_uuid", "=", "run_id", ",", "run_id", "=", "run_id", ",", "key", "=", "metric", ".", "key", ",", "value", "=", "met...
https://github.com/mlflow/mlflow/blob/364aca7daf0fcee3ec407ae0b1b16d9cb3085081/mlflow/store/tracking/rest_store.py#L174-L191
jayleicn/scipy-lecture-notes-zh-CN
cc87204fcc4bd2f4702f7c29c83cb8ed5c94b7d6
packages/3d_plotting/examples/mlab_interactive_dialog.py
python
Visualization.__init__
(self)
[]
def __init__(self): HasTraits.__init__(self) x, y, z = curve(self.n_turns) self.plot = self.scene.mlab.plot3d(x, y, z)
[ "def", "__init__", "(", "self", ")", ":", "HasTraits", ".", "__init__", "(", "self", ")", "x", ",", "y", ",", "z", "=", "curve", "(", "self", ".", "n_turns", ")", "self", ".", "plot", "=", "self", ".", "scene", ".", "mlab", ".", "plot3d", "(", ...
https://github.com/jayleicn/scipy-lecture-notes-zh-CN/blob/cc87204fcc4bd2f4702f7c29c83cb8ed5c94b7d6/packages/3d_plotting/examples/mlab_interactive_dialog.py#L27-L30
CSAILVision/gandissect
f55fc5683bebe2bd6c598d703efa6f4e6fb488bf
netdissect/progress.py
python
print_progress
(*args)
When within a progress loop, post_progress(k=str) will display the given k=str status on the right-hand-side of the progress status bar. If not within a visible progress bar, does nothing.
When within a progress loop, post_progress(k=str) will display the given k=str status on the right-hand-side of the progress status bar. If not within a visible progress bar, does nothing.
[ "When", "within", "a", "progress", "loop", "post_progress", "(", "k", "=", "str", ")", "will", "display", "the", "given", "k", "=", "str", "status", "on", "the", "right", "-", "hand", "-", "side", "of", "the", "progress", "status", "bar", ".", "If", ...
def print_progress(*args): ''' When within a progress loop, post_progress(k=str) will display the given k=str status on the right-hand-side of the progress status bar. If not within a visible progress bar, does nothing. ''' if default_verbosity: printfn = print if tqdm is None else tqdm...
[ "def", "print_progress", "(", "*", "args", ")", ":", "if", "default_verbosity", ":", "printfn", "=", "print", "if", "tqdm", "is", "None", "else", "tqdm", ".", "write", "printfn", "(", "' '", ".", "join", "(", "str", "(", "s", ")", "for", "s", "in", ...
https://github.com/CSAILVision/gandissect/blob/f55fc5683bebe2bd6c598d703efa6f4e6fb488bf/netdissect/progress.py#L69-L77
home-assistant/core
265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1
homeassistant/components/blink/alarm_control_panel.py
python
BlinkSyncModule.__init__
(self, data, name, sync)
Initialize the alarm control panel.
Initialize the alarm control panel.
[ "Initialize", "the", "alarm", "control", "panel", "." ]
def __init__(self, data, name, sync): """Initialize the alarm control panel.""" self.data = data self.sync = sync self._name = name self._attr_unique_id = sync.serial self._attr_name = f"{DOMAIN} {name}" self._attr_device_info = DeviceInfo( identifiers...
[ "def", "__init__", "(", "self", ",", "data", ",", "name", ",", "sync", ")", ":", "self", ".", "data", "=", "data", "self", ".", "sync", "=", "sync", "self", ".", "_name", "=", "name", "self", ".", "_attr_unique_id", "=", "sync", ".", "serial", "sel...
https://github.com/home-assistant/core/blob/265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1/homeassistant/components/blink/alarm_control_panel.py#L41-L50
egtwobits/mesh_mesh_align_plus
c6b39f4e163ed897de177c08d2c5f4ac205f9fa9
mesh_mesh_align_plus/utils/geom.py
python
MAPLUS_OT_GrabAndSetItemKindBase.execute
(self, context)
return {'FINISHED'}
[]
def execute(self, context): addon_data = bpy.context.scene.maplus_data prims = addon_data.prim_list if self.target == "SLOT1": active_item = addon_data.internal_storage_slot_1 elif self.target == "SLOT2": active_item = addon_data.internal_storage_slot_2 e...
[ "def", "execute", "(", "self", ",", "context", ")", ":", "addon_data", "=", "bpy", ".", "context", ".", "scene", ".", "maplus_data", "prims", "=", "addon_data", ".", "prim_list", "if", "self", ".", "target", "==", "\"SLOT1\"", ":", "active_item", "=", "a...
https://github.com/egtwobits/mesh_mesh_align_plus/blob/c6b39f4e163ed897de177c08d2c5f4ac205f9fa9/mesh_mesh_align_plus/utils/geom.py#L395-L436
saltstack/salt
fae5bc757ad0f1716483ce7ae180b451545c2058
salt/states/boto_vpc.py
python
accept_vpc_peering_connection
( name=None, conn_id=None, conn_name=None, region=None, key=None, keyid=None, profile=None, )
return ret
Accept a VPC pending requested peering connection between two VPCs. name Name of this state conn_id The connection ID to accept. Exclusive with conn_name. String type. conn_name The name of the VPC peering connection to accept. Exclusive with conn_id. String type. region ...
Accept a VPC pending requested peering connection between two VPCs.
[ "Accept", "a", "VPC", "pending", "requested", "peering", "connection", "between", "two", "VPCs", "." ]
def accept_vpc_peering_connection( name=None, conn_id=None, conn_name=None, region=None, key=None, keyid=None, profile=None, ): """ Accept a VPC pending requested peering connection between two VPCs. name Name of this state conn_id The connection ID to accep...
[ "def", "accept_vpc_peering_connection", "(", "name", "=", "None", ",", "conn_id", "=", "None", ",", "conn_name", "=", "None", ",", "region", "=", "None", ",", "key", "=", "None", ",", "keyid", "=", "None", ",", "profile", "=", "None", ",", ")", ":", ...
https://github.com/saltstack/salt/blob/fae5bc757ad0f1716483ce7ae180b451545c2058/salt/states/boto_vpc.py#L1754-L1850
inasafe/inasafe
355eb2ce63f516b9c26af0c86a24f99e53f63f87
safe/report/report_metadata.py
python
ReportComponentsMetadata.key
(self)
return self._key
Unique key as ID for the component in the report. :rtype: str
Unique key as ID for the component in the report.
[ "Unique", "key", "as", "ID", "for", "the", "component", "in", "the", "report", "." ]
def key(self): """Unique key as ID for the component in the report. :rtype: str """ return self._key
[ "def", "key", "(", "self", ")", ":", "return", "self", ".", "_key" ]
https://github.com/inasafe/inasafe/blob/355eb2ce63f516b9c26af0c86a24f99e53f63f87/safe/report/report_metadata.py#L91-L96
spesmilo/electrum
bdbd59300fbd35b01605e66145458e5f396108e8
electrum/plugins/trustedcoin/trustedcoin.py
python
TrustedCoinPlugin.restore_choice
(self, wizard: BaseWizard, seed, passphrase)
[]
def restore_choice(self, wizard: BaseWizard, seed, passphrase): wizard.set_icon('trustedcoin-wizard.png') wizard.reset_stack() title = _('Restore 2FA wallet') msg = ' '.join([ 'You are going to restore a wallet protected with two-factor authentication.', 'Do you w...
[ "def", "restore_choice", "(", "self", ",", "wizard", ":", "BaseWizard", ",", "seed", ",", "passphrase", ")", ":", "wizard", ".", "set_icon", "(", "'trustedcoin-wizard.png'", ")", "wizard", ".", "reset_stack", "(", ")", "title", "=", "_", "(", "'Restore 2FA w...
https://github.com/spesmilo/electrum/blob/bdbd59300fbd35b01605e66145458e5f396108e8/electrum/plugins/trustedcoin/trustedcoin.py#L630-L641
nucleic/enaml
65c2a2a2d765e88f2e1103046680571894bb41ed
enaml/qt/q_pixmap_transition.py
python
QWipeTransition.updatePixmap
(self, rect)
Update the pixmap for the current transition. This method paints the current rect from the ending pixmap into the proper rect of the output pixmap.
Update the pixmap for the current transition.
[ "Update", "the", "pixmap", "for", "the", "current", "transition", "." ]
def updatePixmap(self, rect): """ Update the pixmap for the current transition. This method paints the current rect from the ending pixmap into the proper rect of the output pixmap. """ painter = QPainter(self.outPixmap()) painter.drawPixmap(rect, self.endPixmap(), rect...
[ "def", "updatePixmap", "(", "self", ",", "rect", ")", ":", "painter", "=", "QPainter", "(", "self", ".", "outPixmap", "(", ")", ")", "painter", ".", "drawPixmap", "(", "rect", ",", "self", ".", "endPixmap", "(", ")", ",", "rect", ")" ]
https://github.com/nucleic/enaml/blob/65c2a2a2d765e88f2e1103046680571894bb41ed/enaml/qt/q_pixmap_transition.py#L321-L329
biolab/orange2
db40a9449cb45b507d63dcd5739b223f9cffb8e6
Orange/OrangeCanvas/application/canvasmain.py
python
CanvasMainWindow.closeEvent
(self, event)
Close the main window.
Close the main window.
[ "Close", "the", "main", "window", "." ]
def closeEvent(self, event): """Close the main window. """ document = self.current_document() if document.isModifiedStrict(): if self.ask_save_changes() == QDialog.Rejected: # Reject the event event.ignore() return old_...
[ "def", "closeEvent", "(", "self", ",", "event", ")", ":", "document", "=", "self", ".", "current_document", "(", ")", "if", "document", ".", "isModifiedStrict", "(", ")", ":", "if", "self", ".", "ask_save_changes", "(", ")", "==", "QDialog", ".", "Reject...
https://github.com/biolab/orange2/blob/db40a9449cb45b507d63dcd5739b223f9cffb8e6/Orange/OrangeCanvas/application/canvasmain.py#L1690-L1735
genicam/harvesters
8e1116628ca7b0cf81c782250bc201ca87fb9083
src/harvesters/core.py
python
Module.node_map
(self)
return self._node_map
The GenICam feature node map that belongs to the owner object. :getter: Returns itself. :type: genicam.genapi.NodeMap
The GenICam feature node map that belongs to the owner object.
[ "The", "GenICam", "feature", "node", "map", "that", "belongs", "to", "the", "owner", "object", "." ]
def node_map(self): """ The GenICam feature node map that belongs to the owner object. :getter: Returns itself. :type: genicam.genapi.NodeMap """ return self._node_map
[ "def", "node_map", "(", "self", ")", ":", "return", "self", ".", "_node_map" ]
https://github.com/genicam/harvesters/blob/8e1116628ca7b0cf81c782250bc201ca87fb9083/src/harvesters/core.py#L134-L141
JoinMarket-Org/joinmarket-clientserver
8b3d21f226185e31aa10e8e16cdfc719cea4a98e
jmclient/jmclient/blockchaininterface.py
python
RegtestBitcoinCoreMixin.grab_coins
(self, receiving_addr, amt=50)
return txid
NOTE! amt is passed in Coins, not Satoshis! Special method for regtest only: take coins from bitcoind's own wallet and put them in the receiving addr. Return the txid.
NOTE! amt is passed in Coins, not Satoshis! Special method for regtest only: take coins from bitcoind's own wallet and put them in the receiving addr. Return the txid.
[ "NOTE!", "amt", "is", "passed", "in", "Coins", "not", "Satoshis!", "Special", "method", "for", "regtest", "only", ":", "take", "coins", "from", "bitcoind", "s", "own", "wallet", "and", "put", "them", "in", "the", "receiving", "addr", ".", "Return", "the", ...
def grab_coins(self, receiving_addr, amt=50): """ NOTE! amt is passed in Coins, not Satoshis! Special method for regtest only: take coins from bitcoind's own wallet and put them in the receiving addr. Return the txid. """ if amt > 500: raise Ex...
[ "def", "grab_coins", "(", "self", ",", "receiving_addr", ",", "amt", "=", "50", ")", ":", "if", "amt", ">", "500", ":", "raise", "Exception", "(", "\"too greedy\"", ")", "\"\"\"\n if amt > self.current_balance:\n #mine enough to get to the reqd amt\n ...
https://github.com/JoinMarket-Org/joinmarket-clientserver/blob/8b3d21f226185e31aa10e8e16cdfc719cea4a98e/jmclient/jmclient/blockchaininterface.py#L584-L608
heronsystems/adeptRL
d8554d134c1dfee6659baafd886684351c1dd982
adept/container/init.py
python
Init.from_resume
(mode, args)
return args, log_id_path, initial_step_count
:param mode: Script name :param args: Dict[str, Any], static args :return: args, log_id, initial_step_count
:param mode: Script name :param args: Dict[str, Any], static args :return: args, log_id, initial_step_count
[ ":", "param", "mode", ":", "Script", "name", ":", "param", "args", ":", "Dict", "[", "str", "Any", "]", "static", "args", ":", "return", ":", "args", "log_id", "initial_step_count" ]
def from_resume(mode, args): """ :param mode: Script name :param args: Dict[str, Any], static args :return: args, log_id, initial_step_count """ resume = args.resume log_dir_helper = LogDirHelper(args.resume) with open(log_dir_helper.args_file_path(), "r")...
[ "def", "from_resume", "(", "mode", ",", "args", ")", ":", "resume", "=", "args", ".", "resume", "log_dir_helper", "=", "LogDirHelper", "(", "args", ".", "resume", ")", "with", "open", "(", "log_dir_helper", ".", "args_file_path", "(", ")", ",", "\"r\"", ...
https://github.com/heronsystems/adeptRL/blob/d8554d134c1dfee6659baafd886684351c1dd982/adept/container/init.py#L56-L85
leancloud/satori
701caccbd4fe45765001ca60435c0cb499477c03
satori-rules/plugin/libs/gevent/_ssl3.py
python
SSLSocket.__init__
(self, sock=None, keyfile=None, certfile=None, server_side=False, cert_reqs=CERT_NONE, ssl_version=PROTOCOL_SSLv23, ca_certs=None, do_handshake_on_connect=True, family=AF_INET, type=SOCK_STREAM, proto=0, fileno=None, suppress_ragged_eo...
[]
def __init__(self, sock=None, keyfile=None, certfile=None, server_side=False, cert_reqs=CERT_NONE, ssl_version=PROTOCOL_SSLv23, ca_certs=None, do_handshake_on_connect=True, family=AF_INET, type=SOCK_STREAM, proto=0, fileno=None, suppre...
[ "def", "__init__", "(", "self", ",", "sock", "=", "None", ",", "keyfile", "=", "None", ",", "certfile", "=", "None", ",", "server_side", "=", "False", ",", "cert_reqs", "=", "CERT_NONE", ",", "ssl_version", "=", "PROTOCOL_SSLv23", ",", "ca_certs", "=", "...
https://github.com/leancloud/satori/blob/701caccbd4fe45765001ca60435c0cb499477c03/satori-rules/plugin/libs/gevent/_ssl3.py#L106-L195
lovelylain/pyctp
fd304de4b50c4ddc31a4190b1caaeb5dec66bc5d
stock2/ctp/__init__.py
python
TraderApi.OnFrontConnected
(self)
当客户端与交易后台建立起通信连接时(还未登录前),该方法被调用。
当客户端与交易后台建立起通信连接时(还未登录前),该方法被调用。
[ "当客户端与交易后台建立起通信连接时(还未登录前),该方法被调用。" ]
def OnFrontConnected(self): """当客户端与交易后台建立起通信连接时(还未登录前),该方法被调用。"""
[ "def", "OnFrontConnected", "(", "self", ")", ":" ]
https://github.com/lovelylain/pyctp/blob/fd304de4b50c4ddc31a4190b1caaeb5dec66bc5d/stock2/ctp/__init__.py#L241-L242
sahana/eden
1696fa50e90ce967df69f66b571af45356cc18da
controllers/event.py
python
person
()
return s3_rest_controller("pr", "person")
Person controller for AddPersonWidget
Person controller for AddPersonWidget
[ "Person", "controller", "for", "AddPersonWidget" ]
def person(): """ Person controller for AddPersonWidget """ def prep(r): if r.representation != "s3json": # Do not serve other representations here return False else: current.xml.show_ids = True return True s3.prep = prep return s3_rest_contr...
[ "def", "person", "(", ")", ":", "def", "prep", "(", "r", ")", ":", "if", "r", ".", "representation", "!=", "\"s3json\"", ":", "# Do not serve other representations here", "return", "False", "else", ":", "current", ".", "xml", ".", "show_ids", "=", "True", ...
https://github.com/sahana/eden/blob/1696fa50e90ce967df69f66b571af45356cc18da/controllers/event.py#L438-L450
UlionTse/translators
af661ebb7b797e0e9493f1a1c8d30a1ea2edef90
translators/apis.py
python
Sogou.sogou_api
(self, query_text:str, from_language:str='auto', to_language:str='en', **kwargs)
return data if is_detail_result else data['data']['translate']['dit']
https://fanyi.sogou.com :param query_text: str, must. :param from_language: str, default 'auto'. :param to_language: str, default 'en'. :param **kwargs: :param if_ignore_limit_of_length: boolean, default False. :param is_detail_result: boolean, default Fal...
https://fanyi.sogou.com :param query_text: str, must. :param from_language: str, default 'auto'. :param to_language: str, default 'en'. :param **kwargs: :param if_ignore_limit_of_length: boolean, default False. :param is_detail_result: boolean, default Fal...
[ "https", ":", "//", "fanyi", ".", "sogou", ".", "com", ":", "param", "query_text", ":", "str", "must", ".", ":", "param", "from_language", ":", "str", "default", "auto", ".", ":", "param", "to_language", ":", "str", "default", "en", ".", ":", "param", ...
def sogou_api(self, query_text:str, from_language:str='auto', to_language:str='en', **kwargs) -> Union[str,dict]: """ https://fanyi.sogou.com :param query_text: str, must. :param from_language: str, default 'auto'. :param to_language: str, default 'en'. :param **kwargs: ...
[ "def", "sogou_api", "(", "self", ",", "query_text", ":", "str", ",", "from_language", ":", "str", "=", "'auto'", ",", "to_language", ":", "str", "=", "'en'", ",", "*", "*", "kwargs", ")", "->", "Union", "[", "str", ",", "dict", "]", ":", "is_detail_r...
https://github.com/UlionTse/translators/blob/af661ebb7b797e0e9493f1a1c8d30a1ea2edef90/translators/apis.py#L935-L970
psychopy/psychopy
01b674094f38d0e0bd51c45a6f66f671d7041696
psychopy/experiment/components/variable/__init__.py
python
VariableComponent.writeFrameCode
(self, buff)
Write the code that will be called at the start of the frame.
Write the code that will be called at the start of the frame.
[ "Write", "the", "code", "that", "will", "be", "called", "at", "the", "start", "of", "the", "frame", "." ]
def writeFrameCode(self, buff): """Write the code that will be called at the start of the frame.""" if not self.params['startFrameValue'] == '': basestring = (str, bytes) # Create dict for hold start and end types and converting them from types to variables timeTypeDi...
[ "def", "writeFrameCode", "(", "self", ",", "buff", ")", ":", "if", "not", "self", ".", "params", "[", "'startFrameValue'", "]", "==", "''", ":", "basestring", "=", "(", "str", ",", "bytes", ")", "# Create dict for hold start and end types and converting them from ...
https://github.com/psychopy/psychopy/blob/01b674094f38d0e0bd51c45a6f66f671d7041696/psychopy/experiment/components/variable/__init__.py#L122-L173
UniversalDependencies/tools
74faa47086440d03e06aa26bc7a8247878737c18
validate.py
python
build_egraph
(sentence)
return egraph
Takes the list of non-comment lines (line = list of columns) describing a sentence. Returns a dictionary with items providing easier access to the enhanced graph structure. In case of fatal problems returns None but does not report the error (presumably it has already been reported). However, once the g...
Takes the list of non-comment lines (line = list of columns) describing a sentence. Returns a dictionary with items providing easier access to the enhanced graph structure. In case of fatal problems returns None but does not report the error (presumably it has already been reported). However, once the g...
[ "Takes", "the", "list", "of", "non", "-", "comment", "lines", "(", "line", "=", "list", "of", "columns", ")", "describing", "a", "sentence", ".", "Returns", "a", "dictionary", "with", "items", "providing", "easier", "access", "to", "the", "enhanced", "grap...
def build_egraph(sentence): """ Takes the list of non-comment lines (line = list of columns) describing a sentence. Returns a dictionary with items providing easier access to the enhanced graph structure. In case of fatal problems returns None but does not report the error (presumably it has already...
[ "def", "build_egraph", "(", "sentence", ")", ":", "global", "sentence_line", "# the line of the first token/word of the current tree (skipping comments!)", "global", "line_of_first_enhanced_graph", "global", "line_of_first_tree_without_enhanced_graph", "node_line", "=", "sentence_line"...
https://github.com/UniversalDependencies/tools/blob/74faa47086440d03e06aa26bc7a8247878737c18/validate.py#L1149-L1245
c0fec0de/anytree
d63289b65644c6e8c9c1d83d339c2c235d9ecc31
anytree/search.py
python
CountError.__init__
(self, msg, result)
Error raised on `mincount` or `maxcount` mismatch.
Error raised on `mincount` or `maxcount` mismatch.
[ "Error", "raised", "on", "mincount", "or", "maxcount", "mismatch", "." ]
def __init__(self, msg, result): """Error raised on `mincount` or `maxcount` mismatch.""" if result: msg += " " + repr(result) super(CountError, self).__init__(msg)
[ "def", "__init__", "(", "self", ",", "msg", ",", "result", ")", ":", "if", "result", ":", "msg", "+=", "\" \"", "+", "repr", "(", "result", ")", "super", "(", "CountError", ",", "self", ")", ".", "__init__", "(", "msg", ")" ]
https://github.com/c0fec0de/anytree/blob/d63289b65644c6e8c9c1d83d339c2c235d9ecc31/anytree/search.py#L238-L242
rowanz/neural-motifs
d05a251b705cedaa51599bf2906cfa4653b7a761
lib/evaluation/sg_eval_all_rel_cates.py
python
_triplet
(predicates, relations, classes, boxes, predicate_scores=None, class_scores=None)
return triplets, triplet_boxes, triplet_scores
format predictions into triplets :param predicates: A 1d numpy array of num_boxes*(num_boxes-1) predicates, corresponding to each pair of possibilities :param relations: A (num_boxes*(num_boxes-1), 2) array, where each row represents the boxes in that relation :p...
format predictions into triplets :param predicates: A 1d numpy array of num_boxes*(num_boxes-1) predicates, corresponding to each pair of possibilities :param relations: A (num_boxes*(num_boxes-1), 2) array, where each row represents the boxes in that relation :p...
[ "format", "predictions", "into", "triplets", ":", "param", "predicates", ":", "A", "1d", "numpy", "array", "of", "num_boxes", "*", "(", "num_boxes", "-", "1", ")", "predicates", "corresponding", "to", "each", "pair", "of", "possibilities", ":", "param", "rel...
def _triplet(predicates, relations, classes, boxes, predicate_scores=None, class_scores=None): """ format predictions into triplets :param predicates: A 1d numpy array of num_boxes*(num_boxes-1) predicates, corresponding to each pair of possibilities :param relations:...
[ "def", "_triplet", "(", "predicates", ",", "relations", ",", "classes", ",", "boxes", ",", "predicate_scores", "=", "None", ",", "class_scores", "=", "None", ")", ":", "assert", "(", "predicates", ".", "shape", "[", "0", "]", "==", "relations", ".", "sha...
https://github.com/rowanz/neural-motifs/blob/d05a251b705cedaa51599bf2906cfa4653b7a761/lib/evaluation/sg_eval_all_rel_cates.py#L277-L307
mpdavis/python-jose
cfbb868efffe05352546f064a47e6d90a53bbae0
jose/jwe.py
python
_get_key_wrap_cek
(enc, key)
return cek_bytes, wrapped_cek
_get_rsa_key_wrap_cek Get the content encryption key for RSA key wrap Args: enc (str): Encryption algorithm key (Key): Key provided to encryption method Returns: (Key, bytes): Tuple of (cek Key object and wrapped cek)
_get_rsa_key_wrap_cek Get the content encryption key for RSA key wrap
[ "_get_rsa_key_wrap_cek", "Get", "the", "content", "encryption", "key", "for", "RSA", "key", "wrap" ]
def _get_key_wrap_cek(enc, key): """_get_rsa_key_wrap_cek Get the content encryption key for RSA key wrap Args: enc (str): Encryption algorithm key (Key): Key provided to encryption method Returns: (Key, bytes): Tuple of (cek Key object and wrapped cek) """ cek_bytes = ...
[ "def", "_get_key_wrap_cek", "(", "enc", ",", "key", ")", ":", "cek_bytes", "=", "_get_random_cek_bytes_for_enc", "(", "enc", ")", "wrapped_cek", "=", "key", ".", "wrap_key", "(", "cek_bytes", ")", "return", "cek_bytes", ",", "wrapped_cek" ]
https://github.com/mpdavis/python-jose/blob/cfbb868efffe05352546f064a47e6d90a53bbae0/jose/jwe.py#L515-L528
biocore/scikit-bio
ecdfc7941d8c21eb2559ff1ab313d6e9348781da
skbio/alignment/_tabular_msa.py
python
TabularMSA.gap_frequencies
(self, axis='sequence', relative=False)
return gap_freqs
Compute frequency of gap characters across an axis. Parameters ---------- axis : {'sequence', 'position'}, optional Axis to compute gap character frequencies across. If 'sequence' or 0, frequencies are computed for each position in the MSA. If 'position' or 1...
Compute frequency of gap characters across an axis.
[ "Compute", "frequency", "of", "gap", "characters", "across", "an", "axis", "." ]
def gap_frequencies(self, axis='sequence', relative=False): """Compute frequency of gap characters across an axis. Parameters ---------- axis : {'sequence', 'position'}, optional Axis to compute gap character frequencies across. If 'sequence' or 0, frequencies ar...
[ "def", "gap_frequencies", "(", "self", ",", "axis", "=", "'sequence'", ",", "relative", "=", "False", ")", ":", "if", "self", ".", "_is_sequence_axis", "(", "axis", ")", ":", "seq_iterator", "=", "self", ".", "iter_positions", "(", "ignore_metadata", "=", ...
https://github.com/biocore/scikit-bio/blob/ecdfc7941d8c21eb2559ff1ab313d6e9348781da/skbio/alignment/_tabular_msa.py#L1574-L1655
linxid/Machine_Learning_Study_Path
558e82d13237114bbb8152483977806fc0c222af
Machine Learning In Action/Chapter5-LogisticRegression/venv/Lib/site-packages/pip/_vendor/distlib/version.py
python
is_semver
(s)
return _SEMVER_RE.match(s)
[]
def is_semver(s): return _SEMVER_RE.match(s)
[ "def", "is_semver", "(", "s", ")", ":", "return", "_SEMVER_RE", ".", "match", "(", "s", ")" ]
https://github.com/linxid/Machine_Learning_Study_Path/blob/558e82d13237114bbb8152483977806fc0c222af/Machine Learning In Action/Chapter5-LogisticRegression/venv/Lib/site-packages/pip/_vendor/distlib/version.py#L655-L656
openhatch/oh-mainline
ce29352a034e1223141dcc2f317030bbc3359a51
vendor/packages/twill/twill/other_packages/_mechanize_dist/_opener.py
python
OpenerDirector.retrieve
(self, fullurl, filename=None, reporthook=None, data=None)
return result
Returns (filename, headers). For remote objects, the default filename will refer to a temporary file. Temporary files are removed when the OpenerDirector.close() method is called. For file: URLs, at present the returned filename is None. This may change in future. If...
Returns (filename, headers).
[ "Returns", "(", "filename", "headers", ")", "." ]
def retrieve(self, fullurl, filename=None, reporthook=None, data=None): """Returns (filename, headers). For remote objects, the default filename will refer to a temporary file. Temporary files are removed when the OpenerDirector.close() method is called. For file: URLs, at pre...
[ "def", "retrieve", "(", "self", ",", "fullurl", ",", "filename", "=", "None", ",", "reporthook", "=", "None", ",", "data", "=", "None", ")", ":", "req", "=", "self", ".", "_request", "(", "fullurl", ",", "data", ",", "False", ")", "scheme", "=", "r...
https://github.com/openhatch/oh-mainline/blob/ce29352a034e1223141dcc2f317030bbc3359a51/vendor/packages/twill/twill/other_packages/_mechanize_dist/_opener.py#L218-L283
LexPredict/lexpredict-contraxsuite
1d5a2540d31f8f3f1adc442cfa13a7c007319899
sdk/python/sdk/openapi_client/model/task_log_response_records.py
python
TaskLogResponseRecords.__init__
(self, timestamp, *args, **kwargs)
TaskLogResponseRecords - a model defined in OpenAPI Args: timestamp (datetime): Keyword Args: _check_type (bool): if True, values for parameters in openapi_types will be type checked and a TypeError will be raised ...
TaskLogResponseRecords - a model defined in OpenAPI
[ "TaskLogResponseRecords", "-", "a", "model", "defined", "in", "OpenAPI" ]
def __init__(self, timestamp, *args, **kwargs): # noqa: E501 """TaskLogResponseRecords - a model defined in OpenAPI Args: timestamp (datetime): Keyword Args: _check_type (bool): if True, values for parameters in openapi_types will be typ...
[ "def", "__init__", "(", "self", ",", "timestamp", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "# noqa: E501", "_check_type", "=", "kwargs", ".", "pop", "(", "'_check_type'", ",", "True", ")", "_spec_property_naming", "=", "kwargs", ".", "pop", "...
https://github.com/LexPredict/lexpredict-contraxsuite/blob/1d5a2540d31f8f3f1adc442cfa13a7c007319899/sdk/python/sdk/openapi_client/model/task_log_response_records.py#L200-L277
ajinabraham/OWASP-Xenotix-XSS-Exploit-Framework
cb692f527e4e819b6c228187c5702d990a180043
external/Scripting Engine/Xenotix Python Scripting Engine/bin/x86/Debug/Lib/profile.py
python
runctx
(statement, globals, locals, filename=None, sort=-1)
Run statement under profiler, supplying your own globals and locals, optionally saving results in filename. statement and filename have the same semantics as profile.run
Run statement under profiler, supplying your own globals and locals, optionally saving results in filename.
[ "Run", "statement", "under", "profiler", "supplying", "your", "own", "globals", "and", "locals", "optionally", "saving", "results", "in", "filename", "." ]
def runctx(statement, globals, locals, filename=None, sort=-1): """Run statement under profiler, supplying your own globals and locals, optionally saving results in filename. statement and filename have the same semantics as profile.run """ prof = Profile() try: prof = prof.runctx(state...
[ "def", "runctx", "(", "statement", ",", "globals", ",", "locals", ",", "filename", "=", "None", ",", "sort", "=", "-", "1", ")", ":", "prof", "=", "Profile", "(", ")", "try", ":", "prof", "=", "prof", ".", "runctx", "(", "statement", ",", "globals"...
https://github.com/ajinabraham/OWASP-Xenotix-XSS-Exploit-Framework/blob/cb692f527e4e819b6c228187c5702d990a180043/external/Scripting Engine/Xenotix Python Scripting Engine/bin/x86/Debug/Lib/profile.py#L78-L93
misterch0c/shadowbroker
e3a069bea47a2c1009697941ac214adc6f90aa8d
windows/Resources/Python/Core/Lib/pydoc.py
python
safeimport
(path, forceload=0, cache={})
return module
Import a module; handle errors; return None if the module isn't found. If the module *is* found but an exception occurs, it's wrapped in an ErrorDuringImport exception and reraised. Unlike __import__, if a package path is specified, the module at the end of the path is returned, not the package at...
Import a module; handle errors; return None if the module isn't found. If the module *is* found but an exception occurs, it's wrapped in an ErrorDuringImport exception and reraised. Unlike __import__, if a package path is specified, the module at the end of the path is returned, not the package at...
[ "Import", "a", "module", ";", "handle", "errors", ";", "return", "None", "if", "the", "module", "isn", "t", "found", ".", "If", "the", "module", "*", "is", "*", "found", "but", "an", "exception", "occurs", "it", "s", "wrapped", "in", "an", "ErrorDuring...
def safeimport(path, forceload=0, cache={}): """Import a module; handle errors; return None if the module isn't found. If the module *is* found but an exception occurs, it's wrapped in an ErrorDuringImport exception and reraised. Unlike __import__, if a package path is specified, the module at the...
[ "def", "safeimport", "(", "path", ",", "forceload", "=", "0", ",", "cache", "=", "{", "}", ")", ":", "try", ":", "if", "forceload", "and", "path", "in", "sys", ".", "modules", ":", "if", "path", "not", "in", "sys", ".", "builtin_module_names", ":", ...
https://github.com/misterch0c/shadowbroker/blob/e3a069bea47a2c1009697941ac214adc6f90aa8d/windows/Resources/Python/Core/Lib/pydoc.py#L298-L332
NVIDIA/DeepLearningExamples
589604d49e016cd9ef4525f7abcc9c7b826cfc5e
PyTorch/SpeechRecognition/Jasper/common/dali/data_loader.py
python
DaliDataLoader.__len__
(self)
return int(math.ceil(self._shard_size() / self.batch_size))
Number of batches handled by each GPU.
Number of batches handled by each GPU.
[ "Number", "of", "batches", "handled", "by", "each", "GPU", "." ]
def __len__(self): """ Number of batches handled by each GPU. """ if self.drop_last: assert self._shard_size() % self.batch_size == 0, f'{self._shard_size()} {self.batch_size}' return int(math.ceil(self._shard_size() / self.batch_size))
[ "def", "__len__", "(", "self", ")", ":", "if", "self", ".", "drop_last", ":", "assert", "self", ".", "_shard_size", "(", ")", "%", "self", ".", "batch_size", "==", "0", ",", "f'{self._shard_size()} {self.batch_size}'", "return", "int", "(", "math", ".", "c...
https://github.com/NVIDIA/DeepLearningExamples/blob/589604d49e016cd9ef4525f7abcc9c7b826cfc5e/PyTorch/SpeechRecognition/Jasper/common/dali/data_loader.py#L145-L152
knitmesh/servos-framework
45fdc04580890c3aac039c023f104ce8dc00af08
servos/manage.py
python
daemonize
()
do the UNIX double-fork magic, see Stevens' "Advanced Programming in the UNIX Environment" for details (ISBN 0201563177) http://www.erlenstar.demon.co.uk/unix/faq_2.html#SEC16
do the UNIX double-fork magic, see Stevens' "Advanced Programming in the UNIX Environment" for details (ISBN 0201563177) http://www.erlenstar.demon.co.uk/unix/faq_2.html#SEC16
[ "do", "the", "UNIX", "double", "-", "fork", "magic", "see", "Stevens", "Advanced", "Programming", "in", "the", "UNIX", "Environment", "for", "details", "(", "ISBN", "0201563177", ")", "http", ":", "//", "www", ".", "erlenstar", ".", "demon", ".", "co", "...
def daemonize(): """ do the UNIX double-fork magic, see Stevens' "Advanced Programming in the UNIX Environment" for details (ISBN 0201563177) http://www.erlenstar.demon.co.uk/unix/faq_2.html#SEC16 """ try: pid = os.fork() if pid > 0: # exit first parent sy...
[ "def", "daemonize", "(", ")", ":", "try", ":", "pid", "=", "os", ".", "fork", "(", ")", "if", "pid", ">", "0", ":", "# exit first parent", "sys", ".", "exit", "(", "0", ")", "except", "OSError", ",", "e", ":", "sys", ".", "stderr", ".", "write", ...
https://github.com/knitmesh/servos-framework/blob/45fdc04580890c3aac039c023f104ce8dc00af08/servos/manage.py#L353-L388
tryton/tryton
e6e1ac2fbe7170a423bb3fb4412414ee7d44f96c
tryton/common/domain_parser.py
python
format_value
(field, value, target=None, context=None)
return quote(converts.get(field['type'], lambda: value if value is not None else '')())
Format value for field
Format value for field
[ "Format", "value", "for", "field" ]
def format_value(field, value, target=None, context=None): "Format value for field" if context is None: context = {} def format_boolean(): if value is False: return _("False") elif value: return _("True") else: return '' def format_in...
[ "def", "format_value", "(", "field", ",", "value", ",", "target", "=", "None", ",", "context", "=", "None", ")", ":", "if", "context", "is", "None", ":", "context", "=", "{", "}", "def", "format_boolean", "(", ")", ":", "if", "value", "is", "False", ...
https://github.com/tryton/tryton/blob/e6e1ac2fbe7170a423bb3fb4412414ee7d44f96c/tryton/common/domain_parser.py#L307-L411
krintoxi/NoobSec-Toolkit
38738541cbc03cedb9a3b3ed13b629f781ad64f6
NoobSecToolkit - MAC OSX/tools/inject/thirdparty/bottle/bottle.py
python
BaseRequest.__repr__
(self)
return '<%s: %s %s>' % (self.__class__.__name__, self.method, self.url)
[]
def __repr__(self): return '<%s: %s %s>' % (self.__class__.__name__, self.method, self.url)
[ "def", "__repr__", "(", "self", ")", ":", "return", "'<%s: %s %s>'", "%", "(", "self", ".", "__class__", ".", "__name__", ",", "self", ".", "method", ",", "self", ".", "url", ")" ]
https://github.com/krintoxi/NoobSec-Toolkit/blob/38738541cbc03cedb9a3b3ed13b629f781ad64f6/NoobSecToolkit - MAC OSX/tools/inject/thirdparty/bottle/bottle.py#L1232-L1233
bgreenlee/sublime-github
d89cac5c30584e163babcf2db3b8a084b3ed7b86
lib/requests/models.py
python
PreparedRequest.prepare_hooks
(self, hooks)
Prepares the given hooks.
Prepares the given hooks.
[ "Prepares", "the", "given", "hooks", "." ]
def prepare_hooks(self, hooks): """Prepares the given hooks.""" for event in hooks: self.register_hook(event, hooks[event])
[ "def", "prepare_hooks", "(", "self", ",", "hooks", ")", ":", "for", "event", "in", "hooks", ":", "self", ".", "register_hook", "(", "event", ",", "hooks", "[", "event", "]", ")" ]
https://github.com/bgreenlee/sublime-github/blob/d89cac5c30584e163babcf2db3b8a084b3ed7b86/lib/requests/models.py#L452-L455
hugapi/hug
8b5ac00632543addfdcecc326d0475a685a0cba7
examples/redirects.py
python
internal_redirection_automatic
(number_1: int, number_2: int)
return sum_two_numbers
This will redirect internally to the sum_two_numbers handler passing along all passed in parameters. This kind of redirect happens internally within hug, fully transparent to clients.
This will redirect internally to the sum_two_numbers handler passing along all passed in parameters.
[ "This", "will", "redirect", "internally", "to", "the", "sum_two_numbers", "handler", "passing", "along", "all", "passed", "in", "parameters", "." ]
def internal_redirection_automatic(number_1: int, number_2: int): """This will redirect internally to the sum_two_numbers handler passing along all passed in parameters. This kind of redirect happens internally within hug, fully transparent to clients. """ print("Internal Redirection Automati...
[ "def", "internal_redirection_automatic", "(", "number_1", ":", "int", ",", "number_2", ":", "int", ")", ":", "print", "(", "\"Internal Redirection Automatic {}, {}\"", ".", "format", "(", "number_1", ",", "number_2", ")", ")", "return", "sum_two_numbers" ]
https://github.com/hugapi/hug/blob/8b5ac00632543addfdcecc326d0475a685a0cba7/examples/redirects.py#L12-L19
psychopy/psychopy
01b674094f38d0e0bd51c45a6f66f671d7041696
psychopy/sound/microphone.py
python
RecordingBuffer.spaceRemaining
(self)
return self._spaceRemaining
The space remaining in the recording buffer (`int`). Indicates the number of samples that the buffer can still add before overflowing.
The space remaining in the recording buffer (`int`). Indicates the number of samples that the buffer can still add before overflowing.
[ "The", "space", "remaining", "in", "the", "recording", "buffer", "(", "int", ")", ".", "Indicates", "the", "number", "of", "samples", "that", "the", "buffer", "can", "still", "add", "before", "overflowing", "." ]
def spaceRemaining(self): """The space remaining in the recording buffer (`int`). Indicates the number of samples that the buffer can still add before overflowing. """ return self._spaceRemaining
[ "def", "spaceRemaining", "(", "self", ")", ":", "return", "self", ".", "_spaceRemaining" ]
https://github.com/psychopy/psychopy/blob/01b674094f38d0e0bd51c45a6f66f671d7041696/psychopy/sound/microphone.py#L124-L128
replit-archive/empythoned
977ec10ced29a3541a4973dc2b59910805695752
cpython/Lib/cgi.py
python
print_form
(form)
Dump the contents of a form as HTML.
Dump the contents of a form as HTML.
[ "Dump", "the", "contents", "of", "a", "form", "as", "HTML", "." ]
def print_form(form): """Dump the contents of a form as HTML.""" keys = form.keys() keys.sort() print print "<H3>Form Contents:</H3>" if not keys: print "<P>No form fields." print "<DL>" for key in keys: print "<DT>" + escape(key) + ":", value = form[key] ...
[ "def", "print_form", "(", "form", ")", ":", "keys", "=", "form", ".", "keys", "(", ")", "keys", ".", "sort", "(", ")", "print", "print", "\"<H3>Form Contents:</H3>\"", "if", "not", "keys", ":", "print", "\"<P>No form fields.\"", "print", "\"<DL>\"", "for", ...
https://github.com/replit-archive/empythoned/blob/977ec10ced29a3541a4973dc2b59910805695752/cpython/Lib/cgi.py#L948-L963