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
spl0k/supysonic
62bad3b9878a1d22cf040f25dab0fa28a252ba38
supysonic/api/albums_songs.py
python
album_list_id3
()
return request.formatter( "albumList2", { "album": [ f.as_subsonic_album(request.user) for f in query.limit(size, offset) ] }, )
[]
def album_list_id3(): ltype = request.values["type"] size, offset = map(request.values.get, ("size", "offset")) size = int(size) if size else 10 offset = int(offset) if offset else 0 query = Album.select() if ltype == "random": return request.formatter( "albumList2", ...
[ "def", "album_list_id3", "(", ")", ":", "ltype", "=", "request", ".", "values", "[", "\"type\"", "]", "size", ",", "offset", "=", "map", "(", "request", ".", "values", ".", "get", ",", "(", "\"size\"", ",", "\"offset\"", ")", ")", "size", "=", "int",...
https://github.com/spl0k/supysonic/blob/62bad3b9878a1d22cf040f25dab0fa28a252ba38/supysonic/api/albums_songs.py#L135-L187
oracle/graalpython
577e02da9755d916056184ec441c26e00b70145c
graalpython/lib-python/3/ctypes/macholib/dyld.py
python
dyld_image_suffix_search
(iterator, env=None)
return _inject()
For a potential path iterator, add DYLD_IMAGE_SUFFIX semantics
For a potential path iterator, add DYLD_IMAGE_SUFFIX semantics
[ "For", "a", "potential", "path", "iterator", "add", "DYLD_IMAGE_SUFFIX", "semantics" ]
def dyld_image_suffix_search(iterator, env=None): """For a potential path iterator, add DYLD_IMAGE_SUFFIX semantics""" suffix = dyld_image_suffix(env) if suffix is None: return iterator def _inject(iterator=iterator, suffix=suffix): for path in iterator: if path.endswith('.dy...
[ "def", "dyld_image_suffix_search", "(", "iterator", ",", "env", "=", "None", ")", ":", "suffix", "=", "dyld_image_suffix", "(", "env", ")", "if", "suffix", "is", "None", ":", "return", "iterator", "def", "_inject", "(", "iterator", "=", "iterator", ",", "s...
https://github.com/oracle/graalpython/blob/577e02da9755d916056184ec441c26e00b70145c/graalpython/lib-python/3/ctypes/macholib/dyld.py#L56-L68
microsoft/MMdnn
19562a381c27545984a216eda7591430e274e518
mmdnn/conversion/coreml/coreml_emitter.py
python
CoreMLEmitter.emit_Flatten
(self, IR_node)
Convert a flatten layer from keras to coreml.
Convert a flatten layer from keras to coreml.
[ "Convert", "a", "flatten", "layer", "from", "keras", "to", "coreml", "." ]
def emit_Flatten(self, IR_node): """ Convert a flatten layer from keras to coreml. """ # Get input and output names input_name = self.IR_graph.get_node(IR_node.in_edges[0]).real_name output_name = IR_node.out_edges[0] """ # blob_order == 0 if the input bl...
[ "def", "emit_Flatten", "(", "self", ",", "IR_node", ")", ":", "# Get input and output names", "input_name", "=", "self", ".", "IR_graph", ".", "get_node", "(", "IR_node", ".", "in_edges", "[", "0", "]", ")", ".", "real_name", "output_name", "=", "IR_node", "...
https://github.com/microsoft/MMdnn/blob/19562a381c27545984a216eda7591430e274e518/mmdnn/conversion/coreml/coreml_emitter.py#L610-L630
theotherp/nzbhydra
4b03d7f769384b97dfc60dade4806c0fc987514e
libs/requests/packages/urllib3/packages/six.py
python
_SixMetaPathImporter.is_package
(self, fullname)
return hasattr(self.__get_module(fullname), "__path__")
Return true, if the named module is a package. We need this method to get correct spec objects with Python 3.4 (see PEP451)
Return true, if the named module is a package.
[ "Return", "true", "if", "the", "named", "module", "is", "a", "package", "." ]
def is_package(self, fullname): """ Return true, if the named module is a package. We need this method to get correct spec objects with Python 3.4 (see PEP451) """ return hasattr(self.__get_module(fullname), "__path__")
[ "def", "is_package", "(", "self", ",", "fullname", ")", ":", "return", "hasattr", "(", "self", ".", "__get_module", "(", "fullname", ")", ",", "\"__path__\"", ")" ]
https://github.com/theotherp/nzbhydra/blob/4b03d7f769384b97dfc60dade4806c0fc987514e/libs/requests/packages/urllib3/packages/six.py#L209-L216
topydo/topydo
57d7577c987515d4b49d5500f666da29080ca3c2
topydo/lib/ChangeSet.py
python
ChangeSet.save
(self, p_todolist)
Saves a tuple with archive, todolist and command with its arguments into the backup file with unix timestamp as the key. Tuple is then indexed in backup file with combination of hash calculated from p_todolist and unix timestamp. Backup file is closed afterwards.
Saves a tuple with archive, todolist and command with its arguments into the backup file with unix timestamp as the key. Tuple is then indexed in backup file with combination of hash calculated from p_todolist and unix timestamp. Backup file is closed afterwards.
[ "Saves", "a", "tuple", "with", "archive", "todolist", "and", "command", "with", "its", "arguments", "into", "the", "backup", "file", "with", "unix", "timestamp", "as", "the", "key", ".", "Tuple", "is", "then", "indexed", "in", "backup", "file", "with", "co...
def save(self, p_todolist): """ Saves a tuple with archive, todolist and command with its arguments into the backup file with unix timestamp as the key. Tuple is then indexed in backup file with combination of hash calculated from p_todolist and unix timestamp. Backup file is clo...
[ "def", "save", "(", "self", ",", "p_todolist", ")", ":", "self", ".", "_trim", "(", ")", "current_hash", "=", "hash_todolist", "(", "p_todolist", ")", "list_todo", "=", "(", "self", ".", "todolist", ".", "print_todos", "(", ")", "+", "'\\n'", ")", ".",...
https://github.com/topydo/topydo/blob/57d7577c987515d4b49d5500f666da29080ca3c2/topydo/lib/ChangeSet.py#L96-L119
mozilla/mozillians
bd5da47fef01e4e09d3bb8cb0799735bdfbeb3f9
mozillians/common/authbackend.py
python
MozilliansAuthBackend.check_authentication_method
(self, user)
return user
Check which Identity is used to login. This method, depending on the current status of the IdpProfile of a user, enforces MFA logins and creates the IdpProfiles. Returns the object (user) it was passed unchanged.
Check which Identity is used to login.
[ "Check", "which", "Identity", "is", "used", "to", "login", "." ]
def check_authentication_method(self, user): """Check which Identity is used to login. This method, depending on the current status of the IdpProfile of a user, enforces MFA logins and creates the IdpProfiles. Returns the object (user) it was passed unchanged. """ if not...
[ "def", "check_authentication_method", "(", "self", ",", "user", ")", ":", "if", "not", "user", ":", "return", "None", "profile", "=", "user", ".", "userprofile", "# Ensure compatibility with OIDC conformant mode", "auth0_user_id", "=", "self", ".", "claims", ".", ...
https://github.com/mozilla/mozillians/blob/bd5da47fef01e4e09d3bb8cb0799735bdfbeb3f9/mozillians/common/authbackend.py#L139-L188
microsoft/DeepSpeed
3a4cb042433a2e8351887922f8362d3752c52a42
deepspeed/profiling/flops_profiler/profiler.py
python
get_model_profile
( model, input_res, input_constructor=None, print_profile=True, detailed=True, module_depth=-1, top_modules=1, warm_up=1, as_string=True, output_file=None, ignore_modules=None, )
return flops, macs, params
Returns the total floating-point operations, MACs, and parameters of a model. Example: .. code-block:: python model = torchvision.models.alexnet() batch_size = 256 flops, macs, params = get_model_profile(model=model, input_res= (batch_size, 3, 224, 224))) Args: model ([to...
Returns the total floating-point operations, MACs, and parameters of a model.
[ "Returns", "the", "total", "floating", "-", "point", "operations", "MACs", "and", "parameters", "of", "a", "model", "." ]
def get_model_profile( model, input_res, input_constructor=None, print_profile=True, detailed=True, module_depth=-1, top_modules=1, warm_up=1, as_string=True, output_file=None, ignore_modules=None, ): """Returns the total floating-point operations, MACs, and parameters of...
[ "def", "get_model_profile", "(", "model", ",", "input_res", ",", "input_constructor", "=", "None", ",", "print_profile", "=", "True", ",", "detailed", "=", "True", ",", "module_depth", "=", "-", "1", ",", "top_modules", "=", "1", ",", "warm_up", "=", "1", ...
https://github.com/microsoft/DeepSpeed/blob/3a4cb042433a2e8351887922f8362d3752c52a42/deepspeed/profiling/flops_profiler/profiler.py#L1126-L1217
dswah/pyGAM
b57b4cf8783a90976031e1857e748ca3e6ec650b
pygam/penalties.py
python
concave
(n, coef)
return convexity_(n, coef, convex=False)
Builds a penalty matrix for P-Splines with continuous features. Penalizes violation of a concave feature function. Parameters ---------- n : int number of splines coef : array-like coefficients of the feature function Returns ------- penalty matrix : sparse csc matrix o...
Builds a penalty matrix for P-Splines with continuous features. Penalizes violation of a concave feature function.
[ "Builds", "a", "penalty", "matrix", "for", "P", "-", "Splines", "with", "continuous", "features", ".", "Penalizes", "violation", "of", "a", "concave", "feature", "function", "." ]
def concave(n, coef): """ Builds a penalty matrix for P-Splines with continuous features. Penalizes violation of a concave feature function. Parameters ---------- n : int number of splines coef : array-like coefficients of the feature function Returns ------- pe...
[ "def", "concave", "(", "n", ",", "coef", ")", ":", "return", "convexity_", "(", "n", ",", "coef", ",", "convex", "=", "False", ")" ]
https://github.com/dswah/pyGAM/blob/b57b4cf8783a90976031e1857e748ca3e6ec650b/pygam/penalties.py#L196-L212
SeldonIO/alibi
ce961caf995d22648a8338857822c90428af4765
alibi/explainers/anchor_tabular.py
python
TabularSampler.build_lookups
(self, X: np.ndarray)
return [self.cat_lookup, self.ord_lookup, self.enc2feat_idx]
An encoding of the feature IDs is created by assigning each bin of a discretized numerical variable and each categorical variable a unique index. For a dataset containg, e.g., a numerical variable with 5 bins and 3 categorical variables, indices 0 - 4 represent bins of the numerical variable whereas ind...
An encoding of the feature IDs is created by assigning each bin of a discretized numerical variable and each categorical variable a unique index. For a dataset containg, e.g., a numerical variable with 5 bins and 3 categorical variables, indices 0 - 4 represent bins of the numerical variable whereas ind...
[ "An", "encoding", "of", "the", "feature", "IDs", "is", "created", "by", "assigning", "each", "bin", "of", "a", "discretized", "numerical", "variable", "and", "each", "categorical", "variable", "a", "unique", "index", ".", "For", "a", "dataset", "containg", "...
def build_lookups(self, X: np.ndarray) -> List[Dict]: """ An encoding of the feature IDs is created by assigning each bin of a discretized numerical variable and each categorical variable a unique index. For a dataset containg, e.g., a numerical variable with 5 bins and 3 categorical var...
[ "def", "build_lookups", "(", "self", ",", "X", ":", "np", ".", "ndarray", ")", "->", "List", "[", "Dict", "]", ":", "X", "=", "self", ".", "disc", ".", "discretize", "(", "X", ".", "reshape", "(", "1", ",", "-", "1", ")", ")", "[", "0", "]", ...
https://github.com/SeldonIO/alibi/blob/ce961caf995d22648a8338857822c90428af4765/alibi/explainers/anchor_tabular.py#L494-L568
rdiff-backup/rdiff-backup
321e0cd6e5e47d4c158a0172e47ab38240a8b653
src/rdiff_backup/rpath.py
python
RPath.get_parent_rp
(self)
Return new RPath of directory self is in
Return new RPath of directory self is in
[ "Return", "new", "RPath", "of", "directory", "self", "is", "in" ]
def get_parent_rp(self): """Return new RPath of directory self is in""" if self.index: return self.__class__(self.conn, self.base, self.index[:-1]) dirname = self.dirsplit()[0] if dirname: return self.__class__(self.conn, dirname) else: return ...
[ "def", "get_parent_rp", "(", "self", ")", ":", "if", "self", ".", "index", ":", "return", "self", ".", "__class__", "(", "self", ".", "conn", ",", "self", ".", "base", ",", "self", ".", "index", "[", ":", "-", "1", "]", ")", "dirname", "=", "self...
https://github.com/rdiff-backup/rdiff-backup/blob/321e0cd6e5e47d4c158a0172e47ab38240a8b653/src/rdiff_backup/rpath.py#L967-L975
microsoft/unilm
65f15af2a307ebb64cfb25adf54375b002e6fe8d
xtune/src/transformers/tokenization_albert.py
python
AlbertTokenizer._convert_id_to_token
(self, index)
return self.sp_model.IdToPiece(index)
Converts an index (integer) in a token (str) using the vocab.
Converts an index (integer) in a token (str) using the vocab.
[ "Converts", "an", "index", "(", "integer", ")", "in", "a", "token", "(", "str", ")", "using", "the", "vocab", "." ]
def _convert_id_to_token(self, index): """Converts an index (integer) in a token (str) using the vocab.""" return self.sp_model.IdToPiece(index)
[ "def", "_convert_id_to_token", "(", "self", ",", "index", ")", ":", "return", "self", ".", "sp_model", ".", "IdToPiece", "(", "index", ")" ]
https://github.com/microsoft/unilm/blob/65f15af2a307ebb64cfb25adf54375b002e6fe8d/xtune/src/transformers/tokenization_albert.py#L230-L232
conda/conda
09cb6bdde68e551852c3844fd2b59c8ba4cafce2
conda/common/pkg_formats/python.py
python
PythonDistribution._parse_entries_file_data
(data)
return entries_data
https://setuptools.readthedocs.io/en/latest/formats.html#entry-points-txt-entry-point-plugin-metadata
https://setuptools.readthedocs.io/en/latest/formats.html#entry-points-txt-entry-point-plugin-metadata
[ "https", ":", "//", "setuptools", ".", "readthedocs", ".", "io", "/", "en", "/", "latest", "/", "formats", ".", "html#entry", "-", "points", "-", "txt", "-", "entry", "-", "point", "-", "plugin", "-", "metadata" ]
def _parse_entries_file_data(data): """ https://setuptools.readthedocs.io/en/latest/formats.html#entry-points-txt-entry-point-plugin-metadata """ # FIXME: Use pkg_resources which provides API for this? entries_data = odict() config = ConfigParser() config.optionxf...
[ "def", "_parse_entries_file_data", "(", "data", ")", ":", "# FIXME: Use pkg_resources which provides API for this?", "entries_data", "=", "odict", "(", ")", "config", "=", "ConfigParser", "(", ")", "config", ".", "optionxform", "=", "lambda", "x", ":", "x", "# Avoid...
https://github.com/conda/conda/blob/09cb6bdde68e551852c3844fd2b59c8ba4cafce2/conda/common/pkg_formats/python.py#L175-L191
Nicotine-Plus/nicotine-plus
6583532193e132206bb2096c77c6ad1ce96c21fa
pynicotine/shares.py
python
Scanner.get_file_info
(self, name, pathname, tinytag, file_stat=None)
return [name, size, bitrate_info, duration_info]
Get file metadata
Get file metadata
[ "Get", "file", "metadata" ]
def get_file_info(self, name, pathname, tinytag, file_stat=None): """ Get file metadata """ size = 0 audio = None bitrate_info = None duration_info = None if file_stat is None: file_stat = os.stat(pathname) size = file_stat.st_size """ We s...
[ "def", "get_file_info", "(", "self", ",", "name", ",", "pathname", ",", "tinytag", ",", "file_stat", "=", "None", ")", ":", "size", "=", "0", "audio", "=", "None", "bitrate_info", "=", "None", "duration_info", "=", "None", "if", "file_stat", "is", "None"...
https://github.com/Nicotine-Plus/nicotine-plus/blob/6583532193e132206bb2096c77c6ad1ce96c21fa/pynicotine/shares.py#L359-L396
zhl2008/awd-platform
0416b31abea29743387b10b3914581fbe8e7da5e
web_flaskbb/Python-2.7.9/Lib/lib-tk/Tkinter.py
python
Misc.winfo_pointerxy
(self)
return self._getints( self.tk.call('winfo', 'pointerxy', self._w))
Return a tuple of x and y coordinates of the pointer on the root window.
Return a tuple of x and y coordinates of the pointer on the root window.
[ "Return", "a", "tuple", "of", "x", "and", "y", "coordinates", "of", "the", "pointer", "on", "the", "root", "window", "." ]
def winfo_pointerxy(self): """Return a tuple of x and y coordinates of the pointer on the root window.""" return self._getints( self.tk.call('winfo', 'pointerxy', self._w))
[ "def", "winfo_pointerxy", "(", "self", ")", ":", "return", "self", ".", "_getints", "(", "self", ".", "tk", ".", "call", "(", "'winfo'", ",", "'pointerxy'", ",", "self", ".", "_w", ")", ")" ]
https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_flaskbb/Python-2.7.9/Lib/lib-tk/Tkinter.py#L870-L873
cpnota/autonomous-learning-library
aaa5403ead52f1175b460fc3984864355c575061
all/core/state.py
python
State.update
(self, key, value)
return self.__class__(x, device=self.device)
Adds a key/value pair to the state, or updates an existing key/value pair. Note that this is NOT an in-place operation, but returns a new State or StateArray. Args: key (string): The name of the state component to update. value (any): The value of the new state component. ...
Adds a key/value pair to the state, or updates an existing key/value pair. Note that this is NOT an in-place operation, but returns a new State or StateArray.
[ "Adds", "a", "key", "/", "value", "pair", "to", "the", "state", "or", "updates", "an", "existing", "key", "/", "value", "pair", ".", "Note", "that", "this", "is", "NOT", "an", "in", "-", "place", "operation", "but", "returns", "a", "new", "State", "o...
def update(self, key, value): """ Adds a key/value pair to the state, or updates an existing key/value pair. Note that this is NOT an in-place operation, but returns a new State or StateArray. Args: key (string): The name of the state component to update. value (...
[ "def", "update", "(", "self", ",", "key", ",", "value", ")", ":", "x", "=", "{", "}", "for", "k", "in", "self", ".", "keys", "(", ")", ":", "if", "not", "k", "==", "key", ":", "x", "[", "k", "]", "=", "super", "(", ")", ".", "__getitem__", ...
https://github.com/cpnota/autonomous-learning-library/blob/aaa5403ead52f1175b460fc3984864355c575061/all/core/state.py#L141-L158
buke/GreenOdoo
3d8c55d426fb41fdb3f2f5a1533cfe05983ba1df
runtime/python/lib/python2.7/hotshot/__init__.py
python
Profile.close
(self)
Close the logfile and terminate the profiler.
Close the logfile and terminate the profiler.
[ "Close", "the", "logfile", "and", "terminate", "the", "profiler", "." ]
def close(self): """Close the logfile and terminate the profiler.""" self._prof.close()
[ "def", "close", "(", "self", ")", ":", "self", ".", "_prof", ".", "close", "(", ")" ]
https://github.com/buke/GreenOdoo/blob/3d8c55d426fb41fdb3f2f5a1533cfe05983ba1df/runtime/python/lib/python2.7/hotshot/__init__.py#L26-L28
wandb/client
3963364d8112b7dedb928fa423b6878ea1b467d9
wandb/sdk/integration_utils/data_logging.py
python
_infer_single_example_keyed_processor
( example: Union[Sequence, Any], class_labels_table: Optional["wandb.Table"] = None, possible_base_example: Optional[Union[Sequence, Any]] = None, )
return processors
Infers a processor from a single example. Infers a processor from a single example with optional class_labels_table and base_example. Base example is useful for cases such as segmentation masks
Infers a processor from a single example.
[ "Infers", "a", "processor", "from", "a", "single", "example", "." ]
def _infer_single_example_keyed_processor( example: Union[Sequence, Any], class_labels_table: Optional["wandb.Table"] = None, possible_base_example: Optional[Union[Sequence, Any]] = None, ) -> Dict[str, Callable]: """Infers a processor from a single example. Infers a processor from a single example...
[ "def", "_infer_single_example_keyed_processor", "(", "example", ":", "Union", "[", "Sequence", ",", "Any", "]", ",", "class_labels_table", ":", "Optional", "[", "\"wandb.Table\"", "]", "=", "None", ",", "possible_base_example", ":", "Optional", "[", "Union", "[", ...
https://github.com/wandb/client/blob/3963364d8112b7dedb928fa423b6878ea1b467d9/wandb/sdk/integration_utils/data_logging.py#L247-L342
krintoxi/NoobSec-Toolkit
38738541cbc03cedb9a3b3ed13b629f781ad64f6
NoobSecToolkit - MAC OSX/tools/inject/thirdparty/keepalive/keepalive.py
python
HTTPResponse.readlines
(self, sizehint = 0)
return list
[]
def readlines(self, sizehint = 0): total = 0 list = [] while 1: line = self.readline() if not line: break list.append(line) total += len(line) if sizehint and total >= sizehint: break return list
[ "def", "readlines", "(", "self", ",", "sizehint", "=", "0", ")", ":", "total", "=", "0", "list", "=", "[", "]", "while", "1", ":", "line", "=", "self", ".", "readline", "(", ")", "if", "not", "line", ":", "break", "list", ".", "append", "(", "l...
https://github.com/krintoxi/NoobSec-Toolkit/blob/38738541cbc03cedb9a3b3ed13b629f781ad64f6/NoobSecToolkit - MAC OSX/tools/inject/thirdparty/keepalive/keepalive.py#L289-L299
mcahny/vps
138503edbc9e70de744dc0c9fa4b71c799a94d5d
mmdet/core/evaluation/class_names.py
python
imagenet_vid_classes
()
return [ 'airplane', 'antelope', 'bear', 'bicycle', 'bird', 'bus', 'car', 'cattle', 'dog', 'domestic_cat', 'elephant', 'fox', 'giant_panda', 'hamster', 'horse', 'lion', 'lizard', 'monkey', 'motorcycle', 'rabbit', 'red_panda', 'sheep', 'snake', 'squirrel', 'tiger', 'train', 'turtle', ...
[]
def imagenet_vid_classes(): return [ 'airplane', 'antelope', 'bear', 'bicycle', 'bird', 'bus', 'car', 'cattle', 'dog', 'domestic_cat', 'elephant', 'fox', 'giant_panda', 'hamster', 'horse', 'lion', 'lizard', 'monkey', 'motorcycle', 'rabbit', 'red_panda', 'sheep', 'snake', 'squirrel', ...
[ "def", "imagenet_vid_classes", "(", ")", ":", "return", "[", "'airplane'", ",", "'antelope'", ",", "'bear'", ",", "'bicycle'", ",", "'bird'", ",", "'bus'", ",", "'car'", ",", "'cattle'", ",", "'dog'", ",", "'domestic_cat'", ",", "'elephant'", ",", "'fox'", ...
https://github.com/mcahny/vps/blob/138503edbc9e70de744dc0c9fa4b71c799a94d5d/mmdet/core/evaluation/class_names.py#L57-L64
OpenMDAO/OpenMDAO
f47eb5485a0bb5ea5d2ae5bd6da4b94dc6b296bd
openmdao/core/indepvarcomp.py
python
_AutoIndepVarComp.__init__
(self, name=None, val=1.0, **kwargs)
Initialize all attributes. Parameters ---------- name : str or None name of the variable. If None, variables should be defined external to this class by calling add_output. val : float or ndarray value of the variable if a single variable is being def...
Initialize all attributes.
[ "Initialize", "all", "attributes", "." ]
def __init__(self, name=None, val=1.0, **kwargs): """ Initialize all attributes. Parameters ---------- name : str or None name of the variable. If None, variables should be defined external to this class by calling add_output. val : float or ndarr...
[ "def", "__init__", "(", "self", ",", "name", "=", "None", ",", "val", "=", "1.0", ",", "*", "*", "kwargs", ")", ":", "super", "(", ")", ".", "__init__", "(", "name", ",", "val", ",", "*", "*", "kwargs", ")", "self", ".", "_remotes", "=", "set",...
https://github.com/OpenMDAO/OpenMDAO/blob/f47eb5485a0bb5ea5d2ae5bd6da4b94dc6b296bd/openmdao/core/indepvarcomp.py#L257-L272
ctxis/CAPE
dae9fa6a254ecdbabeb7eb0d2389fa63722c1e82
lib/cuckoo/common/utils.py
python
is_sane_filename
(s)
return True
Test if a filename is sane.
Test if a filename is sane.
[ "Test", "if", "a", "filename", "is", "sane", "." ]
def is_sane_filename(s): """ Test if a filename is sane.""" for c in s: if c not in FILENAME_CHARACTERS: return False return True
[ "def", "is_sane_filename", "(", "s", ")", ":", "for", "c", "in", "s", ":", "if", "c", "not", "in", "FILENAME_CHARACTERS", ":", "return", "False", "return", "True" ]
https://github.com/ctxis/CAPE/blob/dae9fa6a254ecdbabeb7eb0d2389fa63722c1e82/lib/cuckoo/common/utils.py#L168-L173
enthought/traitsui
b7c38c7a47bf6ae7971f9ddab70c8a358647dd25
traitsui/qt4/table_editor.py
python
TableEditor._on_context_insert
(self)
Handle 'insert item' being selected from the header context menu.
Handle 'insert item' being selected from the header context menu.
[ "Handle", "insert", "item", "being", "selected", "from", "the", "header", "context", "menu", "." ]
def _on_context_insert(self): """Handle 'insert item' being selected from the header context menu.""" self.model.insertRow(self.header_row)
[ "def", "_on_context_insert", "(", "self", ")", ":", "self", ".", "model", ".", "insertRow", "(", "self", ".", "header_row", ")" ]
https://github.com/enthought/traitsui/blob/b7c38c7a47bf6ae7971f9ddab70c8a358647dd25/traitsui/qt4/table_editor.py#L805-L808
pilotmoon/PopClip-Extensions
29fc472befc09ee350092ac70283bd9fdb456cb6
source/Trello/requests/packages/urllib3/request.py
python
RequestMethods.request
(self, method, url, fields=None, headers=None, **urlopen_kw)
Make a request using :meth:`urlopen` with the appropriate encoding of ``fields`` based on the ``method`` used. This is a convenience method that requires the least amount of manual effort. It can be used in most situations, while still having the option to drop down to more specific met...
Make a request using :meth:`urlopen` with the appropriate encoding of ``fields`` based on the ``method`` used.
[ "Make", "a", "request", "using", ":", "meth", ":", "urlopen", "with", "the", "appropriate", "encoding", "of", "fields", "based", "on", "the", "method", "used", "." ]
def request(self, method, url, fields=None, headers=None, **urlopen_kw): """ Make a request using :meth:`urlopen` with the appropriate encoding of ``fields`` based on the ``method`` used. This is a convenience method that requires the least amount of manual effort. It can be use...
[ "def", "request", "(", "self", ",", "method", ",", "url", ",", "fields", "=", "None", ",", "headers", "=", "None", ",", "*", "*", "urlopen_kw", ")", ":", "method", "=", "method", ".", "upper", "(", ")", "if", "method", "in", "self", ".", "_encode_u...
https://github.com/pilotmoon/PopClip-Extensions/blob/29fc472befc09ee350092ac70283bd9fdb456cb6/source/Trello/requests/packages/urllib3/request.py#L52-L72
cdhigh/KindleEar
7c4ecf9625239f12a829210d1760b863ef5a23aa
lib/web/utils.py
python
rstrips
(text, remove)
return _strips('r', text, remove)
removes the string `remove` from the right of `text` >>> rstrips("foobar", "bar") 'foo'
removes the string `remove` from the right of `text`
[ "removes", "the", "string", "remove", "from", "the", "right", "of", "text" ]
def rstrips(text, remove): """ removes the string `remove` from the right of `text` >>> rstrips("foobar", "bar") 'foo' """ return _strips('r', text, remove)
[ "def", "rstrips", "(", "text", ",", "remove", ")", ":", "return", "_strips", "(", "'r'", ",", "text", ",", "remove", ")" ]
https://github.com/cdhigh/KindleEar/blob/7c4ecf9625239f12a829210d1760b863ef5a23aa/lib/web/utils.py#L297-L305
JaniceWuo/MovieRecommend
4c86db64ca45598917d304f535413df3bc9fea65
movierecommend/venv1/Lib/site-packages/django/core/cache/backends/base.py
python
BaseCache.validate_key
(self, key)
Warn about keys that would not be portable to the memcached backend. This encourages (but does not force) writing backend-portable cache code.
Warn about keys that would not be portable to the memcached backend. This encourages (but does not force) writing backend-portable cache code.
[ "Warn", "about", "keys", "that", "would", "not", "be", "portable", "to", "the", "memcached", "backend", ".", "This", "encourages", "(", "but", "does", "not", "force", ")", "writing", "backend", "-", "portable", "cache", "code", "." ]
def validate_key(self, key): """ Warn about keys that would not be portable to the memcached backend. This encourages (but does not force) writing backend-portable cache code. """ if len(key) > MEMCACHE_MAX_KEY_LENGTH: warnings.warn( 'Cache key...
[ "def", "validate_key", "(", "self", ",", "key", ")", ":", "if", "len", "(", "key", ")", ">", "MEMCACHE_MAX_KEY_LENGTH", ":", "warnings", ".", "warn", "(", "'Cache key will cause errors if used with memcached: %r '", "'(longer than %s)'", "%", "(", "key", ",", "MEM...
https://github.com/JaniceWuo/MovieRecommend/blob/4c86db64ca45598917d304f535413df3bc9fea65/movierecommend/venv1/Lib/site-packages/django/core/cache/backends/base.py#L230-L247
numba/numba
bf480b9e0da858a65508c2b17759a72ee6a44c51
numba/cuda/simulator/cudadrv/devices.py
python
FakeDeviceList.__str__
(self)
return ', '.join([str(d) for d in self.lst])
[]
def __str__(self): return ', '.join([str(d) for d in self.lst])
[ "def", "__str__", "(", "self", ")", ":", "return", "', '", ".", "join", "(", "[", "str", "(", "d", ")", "for", "d", "in", "self", ".", "lst", "]", ")" ]
https://github.com/numba/numba/blob/bf480b9e0da858a65508c2b17759a72ee6a44c51/numba/cuda/simulator/cudadrv/devices.py#L80-L81
erevus-cn/pocscan
5fef32b1abe22a9f666ad3aacfd1f99d784cb72d
pocscan/plugins/tangscan/tangscan/thirdparty/requests/adapters.py
python
HTTPAdapter.build_response
(self, req, resp)
return response
Builds a :class:`Response <requests.Response>` object from a urllib3 response. This should not be called from user code, and is only exposed for use when subclassing the :class:`HTTPAdapter <requests.adapters.HTTPAdapter>` :param req: The :class:`PreparedRequest <PreparedRequest>` used ...
Builds a :class:`Response <requests.Response>` object from a urllib3 response. This should not be called from user code, and is only exposed for use when subclassing the :class:`HTTPAdapter <requests.adapters.HTTPAdapter>`
[ "Builds", "a", ":", "class", ":", "Response", "<requests", ".", "Response", ">", "object", "from", "a", "urllib3", "response", ".", "This", "should", "not", "be", "called", "from", "user", "code", "and", "is", "only", "exposed", "for", "use", "when", "su...
def build_response(self, req, resp): """Builds a :class:`Response <requests.Response>` object from a urllib3 response. This should not be called from user code, and is only exposed for use when subclassing the :class:`HTTPAdapter <requests.adapters.HTTPAdapter>` :param req: The ...
[ "def", "build_response", "(", "self", ",", "req", ",", "resp", ")", ":", "response", "=", "Response", "(", ")", "# Fallback to None if there's no status_code, for whatever reason.", "response", ".", "status_code", "=", "getattr", "(", "resp", ",", "'status'", ",", ...
https://github.com/erevus-cn/pocscan/blob/5fef32b1abe22a9f666ad3aacfd1f99d784cb72d/pocscan/plugins/tangscan/tangscan/thirdparty/requests/adapters.py#L188-L222
holoviz/datashader
25578abde75c7fa28c6633b33cb8d8a1e433da67
datashader/glyphs/area.py
python
AreaToLineAxis0Multi.compute_x_bounds
(self, df)
return self.maybe_expand_bounds((min(mins), max(maxes)))
[]
def compute_x_bounds(self, df): bounds_list = [self._compute_bounds(df[x]) for x in self.x] mins, maxes = zip(*bounds_list) return self.maybe_expand_bounds((min(mins), max(maxes)))
[ "def", "compute_x_bounds", "(", "self", ",", "df", ")", ":", "bounds_list", "=", "[", "self", ".", "_compute_bounds", "(", "df", "[", "x", "]", ")", "for", "x", "in", "self", ".", "x", "]", "mins", ",", "maxes", "=", "zip", "(", "*", "bounds_list",...
https://github.com/holoviz/datashader/blob/25578abde75c7fa28c6633b33cb8d8a1e433da67/datashader/glyphs/area.py#L333-L337
Jackiexiao/MTTS
bb44483a4bceeebd541ee6cdb2732ebfe85f3b04
src/txt2pinyin.py
python
_pre_pinyin_setting
()
fix pinyin error
fix pinyin error
[ "fix", "pinyin", "error" ]
def _pre_pinyin_setting(): ''' fix pinyin error''' load_phrases_dict({'嗯':[['ēn']]})
[ "def", "_pre_pinyin_setting", "(", ")", ":", "load_phrases_dict", "(", "{", "'嗯':[", "[", "'", "ē", "n']]}", ")", "", "", "" ]
https://github.com/Jackiexiao/MTTS/blob/bb44483a4bceeebd541ee6cdb2732ebfe85f3b04/src/txt2pinyin.py#L48-L50
home-assistant/core
265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1
homeassistant/components/adguard/sensor.py
python
AdGuardHomePercentageBlockedSensor.__init__
(self, adguard: AdGuardHome, entry: ConfigEntry)
Initialize AdGuard Home sensor.
Initialize AdGuard Home sensor.
[ "Initialize", "AdGuard", "Home", "sensor", "." ]
def __init__(self, adguard: AdGuardHome, entry: ConfigEntry) -> None: """Initialize AdGuard Home sensor.""" super().__init__( adguard, entry, "AdGuard DNS Queries Blocked Ratio", "mdi:magnify-close", "blocked_percentage", PERCENTAGE...
[ "def", "__init__", "(", "self", ",", "adguard", ":", "AdGuardHome", ",", "entry", ":", "ConfigEntry", ")", "->", "None", ":", "super", "(", ")", ".", "__init__", "(", "adguard", ",", "entry", ",", "\"AdGuard DNS Queries Blocked Ratio\"", ",", "\"mdi:magnify-cl...
https://github.com/home-assistant/core/blob/265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1/homeassistant/components/adguard/sensor.py#L137-L146
inducer/pycuda
9f3b898ec0846e2a4dff5077d4403ea03b1fccf9
aksetup_helper.py
python
Option.__init__
(self, name, default=None, help=None)
[]
def __init__(self, name, default=None, help=None): self.name = name self.default = default self.help = help
[ "def", "__init__", "(", "self", ",", "name", ",", "default", "=", "None", ",", "help", "=", "None", ")", ":", "self", ".", "name", "=", "name", "self", ".", "default", "=", "default", "self", ".", "help", "=", "help" ]
https://github.com/inducer/pycuda/blob/9f3b898ec0846e2a4dff5077d4403ea03b1fccf9/aksetup_helper.py#L424-L427
luispedro/BuildingMachineLearningSystemsWithPython
52891e6bac00213bf94ab1a3b1f2d8d5ed04a774
ch08/all_correlations.py
python
all_correlations_book_version
(bait, target)
return np.array( [np.corrcoef(bait, c)[0, 1] for c in target])
corrs = all_correlations(bait, target) corrs[i] is the correlation between bait and target[i]
corrs = all_correlations(bait, target)
[ "corrs", "=", "all_correlations", "(", "bait", "target", ")" ]
def all_correlations_book_version(bait, target): ''' corrs = all_correlations(bait, target) corrs[i] is the correlation between bait and target[i] ''' return np.array( [np.corrcoef(bait, c)[0, 1] for c in target])
[ "def", "all_correlations_book_version", "(", "bait", ",", "target", ")", ":", "return", "np", ".", "array", "(", "[", "np", ".", "corrcoef", "(", "bait", ",", "c", ")", "[", "0", ",", "1", "]", "for", "c", "in", "target", "]", ")" ]
https://github.com/luispedro/BuildingMachineLearningSystemsWithPython/blob/52891e6bac00213bf94ab1a3b1f2d8d5ed04a774/ch08/all_correlations.py#L18-L26
kubernetes-client/python
47b9da9de2d02b2b7a34fbe05afb44afd130d73a
kubernetes/client/models/v1_attached_volume.py
python
V1AttachedVolume.to_dict
(self)
return result
Returns the model properties as a dict
Returns the model properties as a dict
[ "Returns", "the", "model", "properties", "as", "a", "dict" ]
def to_dict(self): """Returns the model properties as a dict""" result = {} for attr, _ in six.iteritems(self.openapi_types): value = getattr(self, attr) if isinstance(value, list): result[attr] = list(map( lambda x: x.to_dict() if has...
[ "def", "to_dict", "(", "self", ")", ":", "result", "=", "{", "}", "for", "attr", ",", "_", "in", "six", ".", "iteritems", "(", "self", ".", "openapi_types", ")", ":", "value", "=", "getattr", "(", "self", ",", "attr", ")", "if", "isinstance", "(", ...
https://github.com/kubernetes-client/python/blob/47b9da9de2d02b2b7a34fbe05afb44afd130d73a/kubernetes/client/models/v1_attached_volume.py#L108-L130
demisto/content
5c664a65b992ac8ca90ac3f11b1b2cdf11ee9b07
Packs/FlashpointFeed/Integrations/FlashpointFeed/FlashpointFeed.py
python
Client.http_request
(self, url_suffix, method="GET", params=None)
return resp
Get http response based on url and given parameters. :param method: Specify http methods :param url_suffix: url encoded url suffix :param params: None :return: http response on json
Get http response based on url and given parameters.
[ "Get", "http", "response", "based", "on", "url", "and", "given", "parameters", "." ]
def http_request(self, url_suffix, method="GET", params=None) -> Any: """ Get http response based on url and given parameters. :param method: Specify http methods :param url_suffix: url encoded url suffix :param params: None :return: http response on json """ ...
[ "def", "http_request", "(", "self", ",", "url_suffix", ",", "method", "=", "\"GET\"", ",", "params", "=", "None", ")", "->", "Any", ":", "resp", "=", "self", ".", "_http_request", "(", "method", "=", "method", ",", "url_suffix", "=", "url_suffix", ",", ...
https://github.com/demisto/content/blob/5c664a65b992ac8ca90ac3f11b1b2cdf11ee9b07/Packs/FlashpointFeed/Integrations/FlashpointFeed/FlashpointFeed.py#L63-L82
BlueBrain/BluePyOpt
6d4185479bc6dddb3daad84fa27e0b8457d69652
examples/thalamocortical-cell/CellEvalSetup/protocols.py
python
StepProtocolCustom.run
(self, cell_model, param_values, sim=None, isolate=None)
return responses
Run protocol
Run protocol
[ "Run", "protocol" ]
def run(self, cell_model, param_values, sim=None, isolate=None): """Run protocol""" responses = {} responses.update(super(StepProtocolCustom, self).run( cell_model, param_values, sim=sim, isolate=isolate)) for mechanism in cell_...
[ "def", "run", "(", "self", ",", "cell_model", ",", "param_values", ",", "sim", "=", "None", ",", "isolate", "=", "None", ")", ":", "responses", "=", "{", "}", "responses", ".", "update", "(", "super", "(", "StepProtocolCustom", ",", "self", ")", ".", ...
https://github.com/BlueBrain/BluePyOpt/blob/6d4185479bc6dddb3daad84fa27e0b8457d69652/examples/thalamocortical-cell/CellEvalSetup/protocols.py#L64-L80
florath/rmtoo
6ffe08703451358dca24b232ee4380b1da23bcad
rmtoo/lib/Output.py
python
Output.__init__
(self, config)
Creates the output module handler.
Creates the output module handler.
[ "Creates", "the", "output", "module", "handler", "." ]
def __init__(self, config): '''Creates the output module handler.''' tracer.debug("Called.") self.__config = config self.__cmad_file = None self.__plugin_manager = extension.ExtensionManager( namespace='rmtoo.output.plugin', invoke_on_load=False)
[ "def", "__init__", "(", "self", ",", "config", ")", ":", "tracer", ".", "debug", "(", "\"Called.\"", ")", "self", ".", "__config", "=", "config", "self", ".", "__cmad_file", "=", "None", "self", ".", "__plugin_manager", "=", "extension", ".", "ExtensionMan...
https://github.com/florath/rmtoo/blob/6ffe08703451358dca24b232ee4380b1da23bcad/rmtoo/lib/Output.py#L24-L31
blackye/webdirdig
11eb3df84d228127dde1dd4afcb922f5075903a2
thirdparty_libs/requests/packages/urllib3/request.py
python
RequestMethods.request_encode_url
(self, method, url, fields=None, **urlopen_kw)
return self.urlopen(method, url, **urlopen_kw)
Make a request using :meth:`urlopen` with the ``fields`` encoded in the url. This is useful for request methods like GET, HEAD, DELETE, etc.
Make a request using :meth:`urlopen` with the ``fields`` encoded in the url. This is useful for request methods like GET, HEAD, DELETE, etc.
[ "Make", "a", "request", "using", ":", "meth", ":", "urlopen", "with", "the", "fields", "encoded", "in", "the", "url", ".", "This", "is", "useful", "for", "request", "methods", "like", "GET", "HEAD", "DELETE", "etc", "." ]
def request_encode_url(self, method, url, fields=None, **urlopen_kw): """ Make a request using :meth:`urlopen` with the ``fields`` encoded in the url. This is useful for request methods like GET, HEAD, DELETE, etc. """ if fields: url += '?' + urlencode(fields) ...
[ "def", "request_encode_url", "(", "self", ",", "method", ",", "url", ",", "fields", "=", "None", ",", "*", "*", "urlopen_kw", ")", ":", "if", "fields", ":", "url", "+=", "'?'", "+", "urlencode", "(", "fields", ")", "return", "self", ".", "urlopen", "...
https://github.com/blackye/webdirdig/blob/11eb3df84d228127dde1dd4afcb922f5075903a2/thirdparty_libs/requests/packages/urllib3/request.py#L81-L88
ClusterLabs/pcs
1f225199e02c8d20456bb386f4c913c3ff21ac78
pcs/lib/corosync/qdevice_net.py
python
client_import_certificate_and_key
(runner, pk12_certificate)
import qdevice client certificate to the local node certificate storage
import qdevice client certificate to the local node certificate storage
[ "import", "qdevice", "client", "certificate", "to", "the", "local", "node", "certificate", "storage" ]
def client_import_certificate_and_key(runner, pk12_certificate): """ import qdevice client certificate to the local node certificate storage """ if not client_initialized(): raise LibraryError( ReportItem.error(reports.messages.QdeviceNotInitialized(__model)) ) # save the...
[ "def", "client_import_certificate_and_key", "(", "runner", ",", "pk12_certificate", ")", ":", "if", "not", "client_initialized", "(", ")", ":", "raise", "LibraryError", "(", "ReportItem", ".", "error", "(", "reports", ".", "messages", ".", "QdeviceNotInitialized", ...
https://github.com/ClusterLabs/pcs/blob/1f225199e02c8d20456bb386f4c913c3ff21ac78/pcs/lib/corosync/qdevice_net.py#L384-L408
joelgrus/data-science-from-scratch
d5d0f117f41b3ccab3b07f1ee1fa21cfcf69afa1
first-edition/code/working_with_data.py
python
scatter
()
[]
def scatter(): plt.scatter(xs, ys1, marker='.', color='black', label='ys1') plt.scatter(xs, ys2, marker='.', color='gray', label='ys2') plt.xlabel('xs') plt.ylabel('ys') plt.legend(loc=9) plt.show()
[ "def", "scatter", "(", ")", ":", "plt", ".", "scatter", "(", "xs", ",", "ys1", ",", "marker", "=", "'.'", ",", "color", "=", "'black'", ",", "label", "=", "'ys1'", ")", "plt", ".", "scatter", "(", "xs", ",", "ys2", ",", "marker", "=", "'.'", ",...
https://github.com/joelgrus/data-science-from-scratch/blob/d5d0f117f41b3ccab3b07f1ee1fa21cfcf69afa1/first-edition/code/working_with_data.py#L47-L53
oilshell/oil
94388e7d44a9ad879b12615f6203b38596b5a2d3
Python-2.7.13/Tools/pybench/CommandLine.py
python
Application.check_files
(self,filelist)
return None
Apply some user defined checks on the files given in filelist. This may modify filelist in place. A typical application is checking that at least n files are given. If this method returns anything other than None, the process is terminated with the return value as exit ...
Apply some user defined checks on the files given in filelist.
[ "Apply", "some", "user", "defined", "checks", "on", "the", "files", "given", "in", "filelist", "." ]
def check_files(self,filelist): """ Apply some user defined checks on the files given in filelist. This may modify filelist in place. A typical application is checking that at least n files are given. If this method returns anything other than None, the process...
[ "def", "check_files", "(", "self", ",", "filelist", ")", ":", "return", "None" ]
https://github.com/oilshell/oil/blob/94388e7d44a9ad879b12615f6203b38596b5a2d3/Python-2.7.13/Tools/pybench/CommandLine.py#L478-L489
OSInside/kiwi
9618cf33f510ddf302ad1d4e0df35f75b00eb152
kiwi/bootloader/config/base.py
python
BootLoaderConfigBase.get_boot_theme
(self)
return theme
Bootloader Theme name :return: theme name :rtype: str
Bootloader Theme name
[ "Bootloader", "Theme", "name" ]
def get_boot_theme(self): """ Bootloader Theme name :return: theme name :rtype: str """ theme = None for preferences in self.xml_state.get_preferences_sections(): section_content = preferences.get_bootloader_theme() if section_content: ...
[ "def", "get_boot_theme", "(", "self", ")", ":", "theme", "=", "None", "for", "preferences", "in", "self", ".", "xml_state", ".", "get_preferences_sections", "(", ")", ":", "section_content", "=", "preferences", ".", "get_bootloader_theme", "(", ")", "if", "sec...
https://github.com/OSInside/kiwi/blob/9618cf33f510ddf302ad1d4e0df35f75b00eb152/kiwi/bootloader/config/base.py#L208-L221
openshift/openshift-tools
1188778e728a6e4781acf728123e5b356380fe6f
openshift/installer/vendored/openshift-ansible-3.9.40/roles/lib_vendored_deps/library/oc_label.py
python
Utils.cleanup
(files)
Clean up on exit
Clean up on exit
[ "Clean", "up", "on", "exit" ]
def cleanup(files): '''Clean up on exit ''' for sfile in files: if os.path.exists(sfile): if os.path.isdir(sfile): shutil.rmtree(sfile) elif os.path.isfile(sfile): os.remove(sfile)
[ "def", "cleanup", "(", "files", ")", ":", "for", "sfile", "in", "files", ":", "if", "os", ".", "path", ".", "exists", "(", "sfile", ")", ":", "if", "os", ".", "path", ".", "isdir", "(", "sfile", ")", ":", "shutil", ".", "rmtree", "(", "sfile", ...
https://github.com/openshift/openshift-tools/blob/1188778e728a6e4781acf728123e5b356380fe6f/openshift/installer/vendored/openshift-ansible-3.9.40/roles/lib_vendored_deps/library/oc_label.py#L1243-L1250
internetarchive/brozzler
427908e8210fcbaab22ce8254bd8f8efb72d33c0
brozzler/frontier.py
python
RethinkDbFrontier.site_pages
(self, site_id, brozzled=None)
Args: site_id (str or int): brozzled (bool): if true, results include only pages that have been brozzled at least once; if false, only pages that have not been brozzled; and if None (the default), all pages Returns: iterator of brozzler.Page
Args: site_id (str or int): brozzled (bool): if true, results include only pages that have been brozzled at least once; if false, only pages that have not been brozzled; and if None (the default), all pages Returns: iterator of brozzler.Page
[ "Args", ":", "site_id", "(", "str", "or", "int", ")", ":", "brozzled", "(", "bool", ")", ":", "if", "true", "results", "include", "only", "pages", "that", "have", "been", "brozzled", "at", "least", "once", ";", "if", "false", "only", "pages", "that", ...
def site_pages(self, site_id, brozzled=None): ''' Args: site_id (str or int): brozzled (bool): if true, results include only pages that have been brozzled at least once; if false, only pages that have not been brozzled; and if None (the default), a...
[ "def", "site_pages", "(", "self", ",", "site_id", ",", "brozzled", "=", "None", ")", ":", "query", "=", "self", ".", "rr", ".", "table", "(", "\"pages\"", ")", ".", "between", "(", "[", "site_id", ",", "1", "if", "brozzled", "is", "True", "else", "...
https://github.com/internetarchive/brozzler/blob/427908e8210fcbaab22ce8254bd8f8efb72d33c0/brozzler/frontier.py#L450-L470
mozilla/kitsune
7c7cf9baed57aa776547aea744243ccad6ca91fb
kitsune/search/base.py
python
SumoDocument.migrate_reads
(cls)
Point the read alias at the same index as the write alias.
Point the read alias at the same index as the write alias.
[ "Point", "the", "read", "alias", "at", "the", "same", "index", "as", "the", "write", "alias", "." ]
def migrate_reads(cls): """Point the read alias at the same index as the write alias.""" cls._update_alias(cls.Index.read_alias, cls.alias_points_at(cls.Index.write_alias))
[ "def", "migrate_reads", "(", "cls", ")", ":", "cls", ".", "_update_alias", "(", "cls", ".", "Index", ".", "read_alias", ",", "cls", ".", "alias_points_at", "(", "cls", ".", "Index", ".", "write_alias", ")", ")" ]
https://github.com/mozilla/kitsune/blob/7c7cf9baed57aa776547aea744243ccad6ca91fb/kitsune/search/base.py#L85-L87
rwth-i6/returnn
f2d718a197a280b0d5f0fd91a7fcb8658560dddb
returnn/tf/layers/basic.py
python
VariableLayer.get_out_data_from_opts
(cls, name, network, shape, dtype="float32", add_batch_axis=False, add_time_axis=False, **kwargs)
return Data( name="%s_output" % name, dim_tags=dim_tags, dtype=dtype, batch=network.get_global_batch_info() if add_batch_axis else None)
:param str name: :param returnn.tf.network.TFNetwork network: :param tuple[int|Dim]|list[int|Dim] shape: :param str dtype: :param bool add_batch_axis: :param bool add_time_axis: :rtype: Data
:param str name: :param returnn.tf.network.TFNetwork network: :param tuple[int|Dim]|list[int|Dim] shape: :param str dtype: :param bool add_batch_axis: :param bool add_time_axis: :rtype: Data
[ ":", "param", "str", "name", ":", ":", "param", "returnn", ".", "tf", ".", "network", ".", "TFNetwork", "network", ":", ":", "param", "tuple", "[", "int|Dim", "]", "|list", "[", "int|Dim", "]", "shape", ":", ":", "param", "str", "dtype", ":", ":", ...
def get_out_data_from_opts(cls, name, network, shape, dtype="float32", add_batch_axis=False, add_time_axis=False, **kwargs): """ :param str name: :param returnn.tf.network.TFNetwork network: :param tuple[int|Dim]|list[int|Dim] shape: :param str dtype: :param bool add...
[ "def", "get_out_data_from_opts", "(", "cls", ",", "name", ",", "network", ",", "shape", ",", "dtype", "=", "\"float32\"", ",", "add_batch_axis", "=", "False", ",", "add_time_axis", "=", "False", ",", "*", "*", "kwargs", ")", ":", "assert", "isinstance", "(...
https://github.com/rwth-i6/returnn/blob/f2d718a197a280b0d5f0fd91a7fcb8658560dddb/returnn/tf/layers/basic.py#L8077-L8111
leo-editor/leo-editor
383d6776d135ef17d73d935a2f0ecb3ac0e99494
leo/commands/editCommands.py
python
EditCommandsClass.tabify
(self, event)
Convert 4 spaces to tabs in the selected text.
Convert 4 spaces to tabs in the selected text.
[ "Convert", "4", "spaces", "to", "tabs", "in", "the", "selected", "text", "." ]
def tabify(self, event): """Convert 4 spaces to tabs in the selected text.""" self.tabifyHelper(event, which='tabify')
[ "def", "tabify", "(", "self", ",", "event", ")", ":", "self", ".", "tabifyHelper", "(", "event", ",", "which", "=", "'tabify'", ")" ]
https://github.com/leo-editor/leo-editor/blob/383d6776d135ef17d73d935a2f0ecb3ac0e99494/leo/commands/editCommands.py#L445-L447
gkrizek/bash-lambda-layer
703b0ade8174022d44779d823172ab7ac33a5505
bin/awscli/customizations/s3/utils.py
python
PrintTask.__new__
(cls, message, error=False, total_parts=None, warning=None)
return super(PrintTask, cls).__new__(cls, message, error, total_parts, warning)
:param message: An arbitrary string associated with the entry. This can be used to communicate the result of the task. :param error: Boolean indicating a failure. :param total_parts: The total number of parts for multipart transfers. :param warning: Boolean indicating a warning
:param message: An arbitrary string associated with the entry. This can be used to communicate the result of the task. :param error: Boolean indicating a failure. :param total_parts: The total number of parts for multipart transfers. :param warning: Boolean indicating a warning
[ ":", "param", "message", ":", "An", "arbitrary", "string", "associated", "with", "the", "entry", ".", "This", "can", "be", "used", "to", "communicate", "the", "result", "of", "the", "task", ".", ":", "param", "error", ":", "Boolean", "indicating", "a", "...
def __new__(cls, message, error=False, total_parts=None, warning=None): """ :param message: An arbitrary string associated with the entry. This can be used to communicate the result of the task. :param error: Boolean indicating a failure. :param total_parts: The total numbe...
[ "def", "__new__", "(", "cls", ",", "message", ",", "error", "=", "False", ",", "total_parts", "=", "None", ",", "warning", "=", "None", ")", ":", "return", "super", "(", "PrintTask", ",", "cls", ")", ".", "__new__", "(", "cls", ",", "message", ",", ...
https://github.com/gkrizek/bash-lambda-layer/blob/703b0ade8174022d44779d823172ab7ac33a5505/bin/awscli/customizations/s3/utils.py#L381-L390
spyder-ide/spyder
55da47c032dfcf519600f67f8b30eab467f965e7
spyder/widgets/simplecodeeditor.py
python
SimpleCodeEditor.set_scrollpastend_enabled
(self, state)
Set scroll past end state. Parameters ---------- state: bool Scroll past end state.
Set scroll past end state.
[ "Set", "scroll", "past", "end", "state", "." ]
def set_scrollpastend_enabled(self, state): """ Set scroll past end state. Parameters ---------- state: bool Scroll past end state. """ self._scrollpastend_enabled = state self.setCenterOnScroll(state) self.setDocument(self.document())
[ "def", "set_scrollpastend_enabled", "(", "self", ",", "state", ")", ":", "self", ".", "_scrollpastend_enabled", "=", "state", "self", ".", "setCenterOnScroll", "(", "state", ")", "self", ".", "setDocument", "(", "self", ".", "document", "(", ")", ")" ]
https://github.com/spyder-ide/spyder/blob/55da47c032dfcf519600f67f8b30eab467f965e7/spyder/widgets/simplecodeeditor.py#L285-L296
viewfinderco/viewfinder
453845b5d64ab5b3b826c08b02546d1ca0a07c14
marketing/tornado/iostream.py
python
BaseIOStream.read_until
(self, delimiter, callback)
Run ``callback`` when we read the given delimiter. The callback will get the data read (including the delimiter) as an argument.
Run ``callback`` when we read the given delimiter.
[ "Run", "callback", "when", "we", "read", "the", "given", "delimiter", "." ]
def read_until(self, delimiter, callback): """Run ``callback`` when we read the given delimiter. The callback will get the data read (including the delimiter) as an argument. """ self._set_read_callback(callback) self._read_delimiter = delimiter self._try_inline_...
[ "def", "read_until", "(", "self", ",", "delimiter", ",", "callback", ")", ":", "self", ".", "_set_read_callback", "(", "callback", ")", "self", ".", "_read_delimiter", "=", "delimiter", "self", ".", "_try_inline_read", "(", ")" ]
https://github.com/viewfinderco/viewfinder/blob/453845b5d64ab5b3b826c08b02546d1ca0a07c14/marketing/tornado/iostream.py#L154-L162
defunkt/pystache
17a5dfdcd56eb76af731d141de395a7632a905b8
pystache/parsed.py
python
ParsedTemplate.add
(self, node)
Arguments: node: a unicode string or node object instance. See the class docstring for information.
Arguments:
[ "Arguments", ":" ]
def add(self, node): """ Arguments: node: a unicode string or node object instance. See the class docstring for information. """ self._parse_tree.append(node)
[ "def", "add", "(", "self", ",", "node", ")", ":", "self", ".", "_parse_tree", ".", "append", "(", "node", ")" ]
https://github.com/defunkt/pystache/blob/17a5dfdcd56eb76af731d141de395a7632a905b8/pystache/parsed.py#L27-L35
tmr232/Sark
bf961ec840530e16eac7a9027d2115276ee52387
sark/code/instruction.py
python
Instruction.regs
(self)
return regs
Names of all registers used by the instruction.
Names of all registers used by the instruction.
[ "Names", "of", "all", "registers", "used", "by", "the", "instruction", "." ]
def regs(self): """Names of all registers used by the instruction.""" regs = set() for operand in self.operands: if not operand.type.has_reg: continue regs.update(operand.regs) return regs
[ "def", "regs", "(", "self", ")", ":", "regs", "=", "set", "(", ")", "for", "operand", "in", "self", ".", "operands", ":", "if", "not", "operand", ".", "type", ".", "has_reg", ":", "continue", "regs", ".", "update", "(", "operand", ".", "regs", ")",...
https://github.com/tmr232/Sark/blob/bf961ec840530e16eac7a9027d2115276ee52387/sark/code/instruction.py#L400-L407
jieter/django-tables2
ce392ee2ee341d7180345a6113919cf9a3925f16
django_tables2/data.py
python
TableData.ordering
(self)
return None
[]
def ordering(self): return None
[ "def", "ordering", "(", "self", ")", ":", "return", "None" ]
https://github.com/jieter/django-tables2/blob/ce392ee2ee341d7180345a6113919cf9a3925f16/django_tables2/data.py#L44-L45
ifwe/digsby
f5fe00244744aa131e07f09348d10563f3d8fa99
digsby/src/jabber/filetransfer/s5b_proxy_sender.py
python
S5B_proxyConnect.handle_connect
(self)
start the generator
start the generator
[ "start", "the", "generator" ]
def handle_connect(self): """start the generator""" log.info('connect to %s', self.addr) self.proc( self.s5b_ok() )
[ "def", "handle_connect", "(", "self", ")", ":", "log", ".", "info", "(", "'connect to %s'", ",", "self", ".", "addr", ")", "self", ".", "proc", "(", "self", ".", "s5b_ok", "(", ")", ")" ]
https://github.com/ifwe/digsby/blob/f5fe00244744aa131e07f09348d10563f3d8fa99/digsby/src/jabber/filetransfer/s5b_proxy_sender.py#L31-L34
reviewboard/reviewboard
7395902e4c181bcd1d633f61105012ffb1d18e1b
reviewboard/webapi/resources/draft_diffcommit.py
python
DraftDiffCommitResource.has_access_permissions
(self, request, commit, *args, **kwargs)
return draft.is_accessible_by(request.user)
Return whether or not the user has access permissions to the commit. A user has access permissions for a commit if they have permission to access the review request draft. Args: request (django.http.HttpRequest): The HTTP request from the client. commit...
Return whether or not the user has access permissions to the commit.
[ "Return", "whether", "or", "not", "the", "user", "has", "access", "permissions", "to", "the", "commit", "." ]
def has_access_permissions(self, request, commit, *args, **kwargs): """Return whether or not the user has access permissions to the commit. A user has access permissions for a commit if they have permission to access the review request draft. Args: request (django.http.Http...
[ "def", "has_access_permissions", "(", "self", ",", "request", ",", "commit", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "draft", "=", "resources", ".", "review_request_draft", ".", "get_object", "(", "request", ",", "*", "args", ",", "*", "*", ...
https://github.com/reviewboard/reviewboard/blob/7395902e4c181bcd1d633f61105012ffb1d18e1b/reviewboard/webapi/resources/draft_diffcommit.py#L73-L98
uqfoundation/multiprocess
028cc73f02655e6451d92e5147d19d8c10aebe50
py3.1/multiprocess/managers.py
python
BaseManager._create
(self, typeid, *args, **kwds)
return Token(typeid, self._address, id), exposed
Create a new shared object; return the token and exposed tuple
Create a new shared object; return the token and exposed tuple
[ "Create", "a", "new", "shared", "object", ";", "return", "the", "token", "and", "exposed", "tuple" ]
def _create(self, typeid, *args, **kwds): ''' Create a new shared object; return the token and exposed tuple ''' assert self._state.value == State.STARTED, 'server not yet started' conn = self._Client(self._address, authkey=self._authkey) try: id, exposed = di...
[ "def", "_create", "(", "self", ",", "typeid", ",", "*", "args", ",", "*", "*", "kwds", ")", ":", "assert", "self", ".", "_state", ".", "value", "==", "State", ".", "STARTED", ",", "'server not yet started'", "conn", "=", "self", ".", "_Client", "(", ...
https://github.com/uqfoundation/multiprocess/blob/028cc73f02655e6451d92e5147d19d8c10aebe50/py3.1/multiprocess/managers.py#L562-L572
ajinabraham/OWASP-Xenotix-XSS-Exploit-Framework
cb692f527e4e819b6c228187c5702d990a180043
external/Scripting Engine/Xenotix Python Scripting Engine/Lib/cmd.py
python
Cmd.cmdloop
(self, intro=None)
Repeatedly issue a prompt, accept input, parse an initial prefix off the received input, and dispatch to action methods, passing them the remainder of the line as argument.
Repeatedly issue a prompt, accept input, parse an initial prefix off the received input, and dispatch to action methods, passing them the remainder of the line as argument.
[ "Repeatedly", "issue", "a", "prompt", "accept", "input", "parse", "an", "initial", "prefix", "off", "the", "received", "input", "and", "dispatch", "to", "action", "methods", "passing", "them", "the", "remainder", "of", "the", "line", "as", "argument", "." ]
def cmdloop(self, intro=None): """Repeatedly issue a prompt, accept input, parse an initial prefix off the received input, and dispatch to action methods, passing them the remainder of the line as argument. """ self.preloop() if self.use_rawinput and self.completekey: ...
[ "def", "cmdloop", "(", "self", ",", "intro", "=", "None", ")", ":", "self", ".", "preloop", "(", ")", "if", "self", ".", "use_rawinput", "and", "self", ".", "completekey", ":", "try", ":", "import", "readline", "self", ".", "old_completer", "=", "readl...
https://github.com/ajinabraham/OWASP-Xenotix-XSS-Exploit-Framework/blob/cb692f527e4e819b6c228187c5702d990a180043/external/Scripting Engine/Xenotix Python Scripting Engine/Lib/cmd.py#L102-L151
PyTorchLightning/pytorch-lightning
5914fb748fb53d826ab337fc2484feab9883a104
pytorch_lightning/trainer/callback_hook.py
python
TrainerCallbackHookMixin.on_load_checkpoint
(self, checkpoint: Dict[str, Any])
r""" .. deprecated:: v1.6 `TrainerCallbackHookMixin.on_load_checkpoint` was deprecated in v1.6 and will be removed in v1.8. Called when loading a model checkpoint.
r""" .. deprecated:: v1.6 `TrainerCallbackHookMixin.on_load_checkpoint` was deprecated in v1.6 and will be removed in v1.8.
[ "r", "..", "deprecated", "::", "v1", ".", "6", "TrainerCallbackHookMixin", ".", "on_load_checkpoint", "was", "deprecated", "in", "v1", ".", "6", "and", "will", "be", "removed", "in", "v1", ".", "8", "." ]
def on_load_checkpoint(self, checkpoint: Dict[str, Any]) -> None: r""" .. deprecated:: v1.6 `TrainerCallbackHookMixin.on_load_checkpoint` was deprecated in v1.6 and will be removed in v1.8. Called when loading a model checkpoint. """ # Todo: the `callback_states` are...
[ "def", "on_load_checkpoint", "(", "self", ",", "checkpoint", ":", "Dict", "[", "str", ",", "Any", "]", ")", "->", "None", ":", "# Todo: the `callback_states` are dropped with TPUSpawn as they", "# can't be saved using `xm.save`", "# https://github.com/pytorch/xla/issues/2773", ...
https://github.com/PyTorchLightning/pytorch-lightning/blob/5914fb748fb53d826ab337fc2484feab9883a104/pytorch_lightning/trainer/callback_hook.py#L605-L637
Nordeus/pushkin
39f7057d3eb82c811c5c6b795d8bc7df9352a217
pushkin/request/requests.py
python
EventRequestBatch.filter_messages
(self, messages)
return messages
Filters out messages that shouldn't be send according to cooldown
Filters out messages that shouldn't be send according to cooldown
[ "Filters", "out", "messages", "that", "shouldn", "t", "be", "send", "according", "to", "cooldown" ]
def filter_messages(self, messages): """Filters out messages that shouldn't be send according to cooldown""" if len(messages) > 0: pairs = {(message['login_id'], message['message_id']) for message in messages} pairs_to_send = database.get_and_update_messages_to_send(pairs) ...
[ "def", "filter_messages", "(", "self", ",", "messages", ")", ":", "if", "len", "(", "messages", ")", ">", "0", ":", "pairs", "=", "{", "(", "message", "[", "'login_id'", "]", ",", "message", "[", "'message_id'", "]", ")", "for", "message", "in", "mes...
https://github.com/Nordeus/pushkin/blob/39f7057d3eb82c811c5c6b795d8bc7df9352a217/pushkin/request/requests.py#L107-L119
aws-samples/aws-kube-codesuite
ab4e5ce45416b83bffb947ab8d234df5437f4fca
src/kubernetes/client/models/apps_v1beta1_deployment_status.py
python
AppsV1beta1DeploymentStatus.collision_count
(self, collision_count)
Sets the collision_count of this AppsV1beta1DeploymentStatus. Count of hash collisions for the Deployment. The Deployment controller uses this field as a collision avoidance mechanism when it needs to create the name for the newest ReplicaSet. :param collision_count: The collision_count of this AppsV1b...
Sets the collision_count of this AppsV1beta1DeploymentStatus. Count of hash collisions for the Deployment. The Deployment controller uses this field as a collision avoidance mechanism when it needs to create the name for the newest ReplicaSet.
[ "Sets", "the", "collision_count", "of", "this", "AppsV1beta1DeploymentStatus", ".", "Count", "of", "hash", "collisions", "for", "the", "Deployment", ".", "The", "Deployment", "controller", "uses", "this", "field", "as", "a", "collision", "avoidance", "mechanism", ...
def collision_count(self, collision_count): """ Sets the collision_count of this AppsV1beta1DeploymentStatus. Count of hash collisions for the Deployment. The Deployment controller uses this field as a collision avoidance mechanism when it needs to create the name for the newest ReplicaSet. ...
[ "def", "collision_count", "(", "self", ",", "collision_count", ")", ":", "self", ".", "_collision_count", "=", "collision_count" ]
https://github.com/aws-samples/aws-kube-codesuite/blob/ab4e5ce45416b83bffb947ab8d234df5437f4fca/src/kubernetes/client/models/apps_v1beta1_deployment_status.py#L99-L108
kubeflow/pipelines
bea751c9259ff0ae85290f873170aae89284ba8e
components/aws/emr/common/_utils.py
python
submit_pyspark_job
(client, jobflow_id, job_name, py_file, extra_args)
return submit_spark_job(client, jobflow_id, job_name, py_file, '', extra_args)
Submits single spark job to a running cluster
Submits single spark job to a running cluster
[ "Submits", "single", "spark", "job", "to", "a", "running", "cluster" ]
def submit_pyspark_job(client, jobflow_id, job_name, py_file, extra_args): """Submits single spark job to a running cluster""" return submit_spark_job(client, jobflow_id, job_name, py_file, '', extra_args)
[ "def", "submit_pyspark_job", "(", "client", ",", "jobflow_id", ",", "job_name", ",", "py_file", ",", "extra_args", ")", ":", "return", "submit_spark_job", "(", "client", ",", "jobflow_id", ",", "job_name", ",", "py_file", ",", "''", ",", "extra_args", ")" ]
https://github.com/kubeflow/pipelines/blob/bea751c9259ff0ae85290f873170aae89284ba8e/components/aws/emr/common/_utils.py#L150-L152
WerWolv/EdiZon_CheatsConfigsAndScripts
d16d36c7509c01dca770f402babd83ff2e9ae6e7
Scripts/lib/python3.5/codecs.py
python
StreamReader.seek
(self, offset, whence=0)
Set the input stream's current position. Resets the codec buffers used for keeping state.
Set the input stream's current position.
[ "Set", "the", "input", "stream", "s", "current", "position", "." ]
def seek(self, offset, whence=0): """ Set the input stream's current position. Resets the codec buffers used for keeping state. """ self.stream.seek(offset, whence) self.reset()
[ "def", "seek", "(", "self", ",", "offset", ",", "whence", "=", "0", ")", ":", "self", ".", "stream", ".", "seek", "(", "offset", ",", "whence", ")", "self", ".", "reset", "(", ")" ]
https://github.com/WerWolv/EdiZon_CheatsConfigsAndScripts/blob/d16d36c7509c01dca770f402babd83ff2e9ae6e7/Scripts/lib/python3.5/codecs.py#L631-L637
googleads/google-ads-python
2a1d6062221f6aad1992a6bcca0e7e4a93d2db86
google/ads/googleads/v9/services/services/conversion_upload_service/client.py
python
ConversionUploadServiceClient.transport
(self)
return self._transport
Return the transport used by the client instance. Returns: ConversionUploadServiceTransport: The transport used by the client instance.
Return the transport used by the client instance.
[ "Return", "the", "transport", "used", "by", "the", "client", "instance", "." ]
def transport(self) -> ConversionUploadServiceTransport: """Return the transport used by the client instance. Returns: ConversionUploadServiceTransport: The transport used by the client instance. """ return self._transport
[ "def", "transport", "(", "self", ")", "->", "ConversionUploadServiceTransport", ":", "return", "self", ".", "_transport" ]
https://github.com/googleads/google-ads-python/blob/2a1d6062221f6aad1992a6bcca0e7e4a93d2db86/google/ads/googleads/v9/services/services/conversion_upload_service/client.py#L158-L164
osmr/imgclsmob
f2993d3ce73a2f7ddba05da3891defb08547d504
gluon/gluoncv2/models/pyramidnet_cifar.py
python
pyramidnet110_a84_svhn
(classes=10, **kwargs)
return get_pyramidnet_cifar( classes=classes, blocks=110, alpha=84, bottleneck=False, model_name="pyramidnet110_a84_svhn", **kwargs)
PyramidNet-110 (a=84) model for SVHN from 'Deep Pyramidal Residual Networks,' https://arxiv.org/abs/1610.02915. Parameters: ---------- classes : int, default 10 Number of classification classes. pretrained : bool, default False Whether to load the pretrained weights for model. ctx :...
PyramidNet-110 (a=84) model for SVHN from 'Deep Pyramidal Residual Networks,' https://arxiv.org/abs/1610.02915.
[ "PyramidNet", "-", "110", "(", "a", "=", "84", ")", "model", "for", "SVHN", "from", "Deep", "Pyramidal", "Residual", "Networks", "https", ":", "//", "arxiv", ".", "org", "/", "abs", "/", "1610", ".", "02915", "." ]
def pyramidnet110_a84_svhn(classes=10, **kwargs): """ PyramidNet-110 (a=84) model for SVHN from 'Deep Pyramidal Residual Networks,' https://arxiv.org/abs/1610.02915. Parameters: ---------- classes : int, default 10 Number of classification classes. pretrained : bool, default False ...
[ "def", "pyramidnet110_a84_svhn", "(", "classes", "=", "10", ",", "*", "*", "kwargs", ")", ":", "return", "get_pyramidnet_cifar", "(", "classes", "=", "classes", ",", "blocks", "=", "110", ",", "alpha", "=", "84", ",", "bottleneck", "=", "False", ",", "mo...
https://github.com/osmr/imgclsmob/blob/f2993d3ce73a2f7ddba05da3891defb08547d504/gluon/gluoncv2/models/pyramidnet_cifar.py#L289-L310
cloudera/hue
23f02102d4547c17c32bd5ea0eb24e9eadd657a4
desktop/core/ext-py/protobuf-3.13.0/google/protobuf/descriptor.py
python
MakeDescriptor
(desc_proto, package='', build_file_if_cpp=True, syntax=None)
return Descriptor(desc_proto.name, desc_name, None, None, fields, list(nested_types.values()), list(enum_types.values()), [], options=_OptionsOrNone(desc_proto), create_key=_internal_create_key)
Make a protobuf Descriptor given a DescriptorProto protobuf. Handles nested descriptors. Note that this is limited to the scope of defining a message inside of another message. Composite fields can currently only be resolved if the message is defined in the same scope as the field. Args: desc_proto: The d...
Make a protobuf Descriptor given a DescriptorProto protobuf.
[ "Make", "a", "protobuf", "Descriptor", "given", "a", "DescriptorProto", "protobuf", "." ]
def MakeDescriptor(desc_proto, package='', build_file_if_cpp=True, syntax=None): """Make a protobuf Descriptor given a DescriptorProto protobuf. Handles nested descriptors. Note that this is limited to the scope of defining a message inside of another message. Composite fields can currently on...
[ "def", "MakeDescriptor", "(", "desc_proto", ",", "package", "=", "''", ",", "build_file_if_cpp", "=", "True", ",", "syntax", "=", "None", ")", ":", "if", "api_implementation", ".", "Type", "(", ")", "==", "'cpp'", "and", "build_file_if_cpp", ":", "# The C++ ...
https://github.com/cloudera/hue/blob/23f02102d4547c17c32bd5ea0eb24e9eadd657a4/desktop/core/ext-py/protobuf-3.13.0/google/protobuf/descriptor.py#L1037-L1141
TencentCloud/tencentcloud-sdk-python
3677fd1cdc8c5fd626ce001c13fd3b59d1f279d2
tencentcloud/iotcloud/v20180614/iotcloud_client.py
python
IotcloudClient.DescribeTasks
(self, request)
本接口(DescribeTasks)用于查询已创建的任务列表,任务保留一个月 :param request: Request instance for DescribeTasks. :type request: :class:`tencentcloud.iotcloud.v20180614.models.DescribeTasksRequest` :rtype: :class:`tencentcloud.iotcloud.v20180614.models.DescribeTasksResponse`
本接口(DescribeTasks)用于查询已创建的任务列表,任务保留一个月
[ "本接口(DescribeTasks)用于查询已创建的任务列表,任务保留一个月" ]
def DescribeTasks(self, request): """本接口(DescribeTasks)用于查询已创建的任务列表,任务保留一个月 :param request: Request instance for DescribeTasks. :type request: :class:`tencentcloud.iotcloud.v20180614.models.DescribeTasksRequest` :rtype: :class:`tencentcloud.iotcloud.v20180614.models.DescribeTasksRespons...
[ "def", "DescribeTasks", "(", "self", ",", "request", ")", ":", "try", ":", "params", "=", "request", ".", "_serialize", "(", ")", "body", "=", "self", ".", "call", "(", "\"DescribeTasks\"", ",", "params", ")", "response", "=", "json", ".", "loads", "("...
https://github.com/TencentCloud/tencentcloud-sdk-python/blob/3677fd1cdc8c5fd626ce001c13fd3b59d1f279d2/tencentcloud/iotcloud/v20180614/iotcloud_client.py#L1177-L1202
VainF/DeepLabV3Plus-Pytorch
e0ee4769d676e093d56b2ddad963300c4b61c0b1
utils/ext_transforms.py
python
ExtCenterCrop.__repr__
(self)
return self.__class__.__name__ + '(size={0})'.format(self.size)
[]
def __repr__(self): return self.__class__.__name__ + '(size={0})'.format(self.size)
[ "def", "__repr__", "(", "self", ")", ":", "return", "self", ".", "__class__", ".", "__name__", "+", "'(size={0})'", ".", "format", "(", "self", ".", "size", ")" ]
https://github.com/VainF/DeepLabV3Plus-Pytorch/blob/e0ee4769d676e093d56b2ddad963300c4b61c0b1/utils/ext_transforms.py#L92-L93
deepchem/deepchem
054eb4b2b082e3df8e1a8e77f36a52137ae6e375
deepchem/data/datasets.py
python
ImageDataset.w
(self)
return self._w
Get the weight vector for this dataset as a single numpy array.
Get the weight vector for this dataset as a single numpy array.
[ "Get", "the", "weight", "vector", "for", "this", "dataset", "as", "a", "single", "numpy", "array", "." ]
def w(self) -> np.ndarray: """Get the weight vector for this dataset as a single numpy array.""" return self._w
[ "def", "w", "(", "self", ")", "->", "np", ".", "ndarray", ":", "return", "self", ".", "_w" ]
https://github.com/deepchem/deepchem/blob/054eb4b2b082e3df8e1a8e77f36a52137ae6e375/deepchem/data/datasets.py#L2722-L2724
ParallelSSH/parallel-ssh
9c9b67825019b221927343a18a3c00001ae92aa2
pssh/_version.py
python
register_vcs_handler
(vcs, method)
return decorate
Decorator to mark a method as the handler for a particular VCS.
Decorator to mark a method as the handler for a particular VCS.
[ "Decorator", "to", "mark", "a", "method", "as", "the", "handler", "for", "a", "particular", "VCS", "." ]
def register_vcs_handler(vcs, method): # decorator """Decorator to mark a method as the handler for a particular VCS.""" def decorate(f): """Store f in HANDLERS[vcs][method].""" if vcs not in HANDLERS: HANDLERS[vcs] = {} HANDLERS[vcs][method] = f return f return ...
[ "def", "register_vcs_handler", "(", "vcs", ",", "method", ")", ":", "# decorator", "def", "decorate", "(", "f", ")", ":", "\"\"\"Store f in HANDLERS[vcs][method].\"\"\"", "if", "vcs", "not", "in", "HANDLERS", ":", "HANDLERS", "[", "vcs", "]", "=", "{", "}", ...
https://github.com/ParallelSSH/parallel-ssh/blob/9c9b67825019b221927343a18a3c00001ae92aa2/pssh/_version.py#L59-L67
karmab/kcli
fff2a2632841f54d9346b437821585df0ec659d7
kvirt/cli.py
python
create_bucket
(args)
Create bucket
Create bucket
[ "Create", "bucket" ]
def create_bucket(args): """Create bucket""" buckets = args.buckets public = args.public config = Kconfig(client=args.client, debug=args.debug, region=args.region, zone=args.zone, namespace=args.namespace) k = config.k for bucket in buckets: pprint("Creating bucket %s..." % bucket) ...
[ "def", "create_bucket", "(", "args", ")", ":", "buckets", "=", "args", ".", "buckets", "public", "=", "args", ".", "public", "config", "=", "Kconfig", "(", "client", "=", "args", ".", "client", ",", "debug", "=", "args", ".", "debug", ",", "region", ...
https://github.com/karmab/kcli/blob/fff2a2632841f54d9346b437821585df0ec659d7/kvirt/cli.py#L2929-L2937
wrobstory/vincent
c5a06e50179015fbb788a7a42e4570ff4467a9e9
vincent/visualization.py
python
Visualization.legends
(value)
list or KeyedList of ``Legends`` : Legend definitions Legends visualize scales, and take one or more scales as their input. They can be customized via a LegendProperty object.
list or KeyedList of ``Legends`` : Legend definitions
[ "list", "or", "KeyedList", "of", "Legends", ":", "Legend", "definitions" ]
def legends(value): """list or KeyedList of ``Legends`` : Legend definitions Legends visualize scales, and take one or more scales as their input. They can be customized via a LegendProperty object. """ for i, entry in enumerate(value): _assert_is_type('legends[{0}]'...
[ "def", "legends", "(", "value", ")", ":", "for", "i", ",", "entry", "in", "enumerate", "(", "value", ")", ":", "_assert_is_type", "(", "'legends[{0}]'", ".", "format", "(", "i", ")", ",", "entry", ",", "Legend", ")" ]
https://github.com/wrobstory/vincent/blob/c5a06e50179015fbb788a7a42e4570ff4467a9e9/vincent/visualization.py#L164-L171
hyde/hyde
7f415402cc3e007a746eb2b5bc102281fdb415bd
hyde/ext/plugins/sphinx.py
python
SphinxPlugin._sanity_check
(self)
Check the current site for sanity. This method checks that the site is propertly set up for building things with sphinx, e.g. it has a config file, a master document, the hyde sphinx extension is enabled, and so-on.
Check the current site for sanity.
[ "Check", "the", "current", "site", "for", "sanity", "." ]
def _sanity_check(self): """Check the current site for sanity. This method checks that the site is propertly set up for building things with sphinx, e.g. it has a config file, a master document, the hyde sphinx extension is enabled, and so-on. """ # Check that the sphin...
[ "def", "_sanity_check", "(", "self", ")", ":", "# Check that the sphinx config file actually exists.", "try", ":", "sphinx_config", "=", "self", ".", "sphinx_config", "except", "EnvironmentError", ":", "logger", ".", "error", "(", "\"Could not read the sphinx config file.\...
https://github.com/hyde/hyde/blob/7f415402cc3e007a746eb2b5bc102281fdb415bd/hyde/ext/plugins/sphinx.py#L189-L243
DeepX-inc/machina
f93bb6f5aca1feccd71fc509bd6370d2015e2d85
machina/samplers/distributed_epi_sampler.py
python
DistributedEpiSampler.wait_trigger_completion
(self, trigger)
Set trigger to 1, then wait until it become 0
Set trigger to 1, then wait until it become 0
[ "Set", "trigger", "to", "1", "then", "wait", "until", "it", "become", "0" ]
def wait_trigger_completion(self, trigger): """Set trigger to 1, then wait until it become 0 """ self.set_trigger(trigger) self.wait_trigger_processed(trigger)
[ "def", "wait_trigger_completion", "(", "self", ",", "trigger", ")", ":", "self", ".", "set_trigger", "(", "trigger", ")", "self", ".", "wait_trigger_processed", "(", "trigger", ")" ]
https://github.com/DeepX-inc/machina/blob/f93bb6f5aca1feccd71fc509bd6370d2015e2d85/machina/samplers/distributed_epi_sampler.py#L119-L123
holzschu/Carnets
44effb10ddfc6aa5c8b0687582a724ba82c6b547
Library/lib/python3.7/site-packages/notebook/notebookapp.py
python
NotebookApp.notebook_info
(self, kernel_count=True)
return info
Return the current working directory and the server url information
Return the current working directory and the server url information
[ "Return", "the", "current", "working", "directory", "and", "the", "server", "url", "information" ]
def notebook_info(self, kernel_count=True): "Return the current working directory and the server url information" info = self.contents_manager.info_string() + "\n" if kernel_count: n_kernels = len(self.kernel_manager.list_kernel_ids()) kernel_msg = trans.ngettext("%d acti...
[ "def", "notebook_info", "(", "self", ",", "kernel_count", "=", "True", ")", ":", "info", "=", "self", ".", "contents_manager", ".", "info_string", "(", ")", "+", "\"\\n\"", "if", "kernel_count", ":", "n_kernels", "=", "len", "(", "self", ".", "kernel_manag...
https://github.com/holzschu/Carnets/blob/44effb10ddfc6aa5c8b0687582a724ba82c6b547/Library/lib/python3.7/site-packages/notebook/notebookapp.py#L1648-L1658
WikidPad/WikidPad
558109638807bc76b4672922686e416ab2d5f79c
WikidPad/lib/whoosh/searching.py
python
ResultsPage.is_last_page
(self)
return self.pagecount == 0 or self.pagenum == self.pagecount
Returns True if this object represents the last page of results.
Returns True if this object represents the last page of results.
[ "Returns", "True", "if", "this", "object", "represents", "the", "last", "page", "of", "results", "." ]
def is_last_page(self): """Returns True if this object represents the last page of results. """ return self.pagecount == 0 or self.pagenum == self.pagecount
[ "def", "is_last_page", "(", "self", ")", ":", "return", "self", ".", "pagecount", "==", "0", "or", "self", ".", "pagenum", "==", "self", ".", "pagecount" ]
https://github.com/WikidPad/WikidPad/blob/558109638807bc76b4672922686e416ab2d5f79c/WikidPad/lib/whoosh/searching.py#L1645-L1649
natashamjaques/neural_chat
ddb977bb4602a67c460d02231e7bbf7b2cb49a97
ParlAI/parlai/mturk/core/dev/agents.py
python
MTurkAgent.clear_messages
(self)
Clears the message history for this agent
Clears the message history for this agent
[ "Clears", "the", "message", "history", "for", "this", "agent" ]
def clear_messages(self): """Clears the message history for this agent""" self.state.clear_messages()
[ "def", "clear_messages", "(", "self", ")", ":", "self", ".", "state", ".", "clear_messages", "(", ")" ]
https://github.com/natashamjaques/neural_chat/blob/ddb977bb4602a67c460d02231e7bbf7b2cb49a97/ParlAI/parlai/mturk/core/dev/agents.py#L254-L256
quantumlib/Cirq
89f88b01d69222d3f1ec14d649b7b3a85ed9211f
cirq-core/cirq/optimizers/merge_interactions_to_sqrt_iswap.py
python
MergeInteractionsToSqrtIswap._two_qubit_matrix_to_operations
( self, q0: 'cirq.Qid', q1: 'cirq.Qid', mat: np.ndarray, )
return two_qubit_to_sqrt_iswap.two_qubit_matrix_to_sqrt_iswap_operations( q0, q1, mat, required_sqrt_iswap_count=self.required_sqrt_iswap_count, use_sqrt_iswap_inv=self.use_sqrt_iswap_inv, atol=self.tolerance, check_preconditions=False,...
Decomposes the merged two-qubit gate unitary into the minimum number of SQRT_ISWAP gates. Args: q0: The first qubit being operated on. q1: The other qubit being operated on. mat: Defines the operation to apply to the pair of qubits. Returns: A li...
Decomposes the merged two-qubit gate unitary into the minimum number of SQRT_ISWAP gates.
[ "Decomposes", "the", "merged", "two", "-", "qubit", "gate", "unitary", "into", "the", "minimum", "number", "of", "SQRT_ISWAP", "gates", "." ]
def _two_qubit_matrix_to_operations( self, q0: 'cirq.Qid', q1: 'cirq.Qid', mat: np.ndarray, ) -> Sequence['cirq.Operation']: """Decomposes the merged two-qubit gate unitary into the minimum number of SQRT_ISWAP gates. Args: q0: The first qubit bei...
[ "def", "_two_qubit_matrix_to_operations", "(", "self", ",", "q0", ":", "'cirq.Qid'", ",", "q1", ":", "'cirq.Qid'", ",", "mat", ":", "np", ".", "ndarray", ",", ")", "->", "Sequence", "[", "'cirq.Operation'", "]", ":", "return", "two_qubit_to_sqrt_iswap", ".", ...
https://github.com/quantumlib/Cirq/blob/89f88b01d69222d3f1ec14d649b7b3a85ed9211f/cirq-core/cirq/optimizers/merge_interactions_to_sqrt_iswap.py#L84-L109
facebookarchive/augmented-traffic-control
575720854de4f609b6209028857ec8d81efcf654
atc/atcd/atcd/access_manager.py
python
AccessManager.get_devices_controlled_by
(self, ip)
return [ _remote_control_instance(key, val) for (key, val) in self._control_allowed.items() if is_valid(key, val) ]
Implementation for atcd.getDevicesControlledBy
Implementation for atcd.getDevicesControlledBy
[ "Implementation", "for", "atcd", ".", "getDevicesControlledBy" ]
def get_devices_controlled_by(self, ip): ''' Implementation for atcd.getDevicesControlledBy ''' now = time.time() def is_valid(key, val): return key[0] == ip and val > now return [ _remote_control_instance(key, val) for (key, val) in ...
[ "def", "get_devices_controlled_by", "(", "self", ",", "ip", ")", ":", "now", "=", "time", ".", "time", "(", ")", "def", "is_valid", "(", "key", ",", "val", ")", ":", "return", "key", "[", "0", "]", "==", "ip", "and", "val", ">", "now", "return", ...
https://github.com/facebookarchive/augmented-traffic-control/blob/575720854de4f609b6209028857ec8d81efcf654/atc/atcd/atcd/access_manager.py#L141-L154
scipy/scipy
e0a749f01e79046642ccfdc419edbf9e7ca141ad
scipy/stats/_morestats.py
python
boxcox_llf
(lmb, data)
return (lmb - 1) * np.sum(logdata, axis=0) - N/2 * np.log(variance)
r"""The boxcox log-likelihood function. Parameters ---------- lmb : scalar Parameter for Box-Cox transformation. See `boxcox` for details. data : array_like Data to calculate Box-Cox log-likelihood for. If `data` is multi-dimensional, the log-likelihood is calculated along the...
r"""The boxcox log-likelihood function.
[ "r", "The", "boxcox", "log", "-", "likelihood", "function", "." ]
def boxcox_llf(lmb, data): r"""The boxcox log-likelihood function. Parameters ---------- lmb : scalar Parameter for Box-Cox transformation. See `boxcox` for details. data : array_like Data to calculate Box-Cox log-likelihood for. If `data` is multi-dimensional, the log-lik...
[ "def", "boxcox_llf", "(", "lmb", ",", "data", ")", ":", "data", "=", "np", ".", "asarray", "(", "data", ")", "N", "=", "data", ".", "shape", "[", "0", "]", "if", "N", "==", "0", ":", "return", "np", ".", "nan", "logdata", "=", "np", ".", "log...
https://github.com/scipy/scipy/blob/e0a749f01e79046642ccfdc419edbf9e7ca141ad/scipy/stats/_morestats.py#L820-L915
wxWidgets/Phoenix
b2199e299a6ca6d866aa6f3d0888499136ead9d6
wx/lib/pydocview.py
python
DocTabbedChildFrame.Destroy
(self)
Removes the current notebook page.
Removes the current notebook page.
[ "Removes", "the", "current", "notebook", "page", "." ]
def Destroy(self): """ Removes the current notebook page. """ wx.GetApp().GetTopWindow().RemoveNotebookPage(self)
[ "def", "Destroy", "(", "self", ")", ":", "wx", ".", "GetApp", "(", ")", ".", "GetTopWindow", "(", ")", ".", "RemoveNotebookPage", "(", "self", ")" ]
https://github.com/wxWidgets/Phoenix/blob/b2199e299a6ca6d866aa6f3d0888499136ead9d6/wx/lib/pydocview.py#L630-L634
openhatch/oh-mainline
ce29352a034e1223141dcc2f317030bbc3359a51
vendor/packages/twisted/twisted/internet/pollreactor.py
python
install
()
Install the poll() reactor.
Install the poll() reactor.
[ "Install", "the", "poll", "()", "reactor", "." ]
def install(): """Install the poll() reactor.""" p = PollReactor() from twisted.internet.main import installReactor installReactor(p)
[ "def", "install", "(", ")", ":", "p", "=", "PollReactor", "(", ")", "from", "twisted", ".", "internet", ".", "main", "import", "installReactor", "installReactor", "(", "p", ")" ]
https://github.com/openhatch/oh-mainline/blob/ce29352a034e1223141dcc2f317030bbc3359a51/vendor/packages/twisted/twisted/internet/pollreactor.py#L205-L209
arizvisa/ida-minsc
8627a60f047b5e55d3efeecde332039cd1a16eea
base/database.py
python
imports.fullname
(cls)
return cls.fullname(ui.current.address())
Return the full name of the import at the current address.
Return the full name of the import at the current address.
[ "Return", "the", "full", "name", "of", "the", "import", "at", "the", "current", "address", "." ]
def fullname(cls): '''Return the full name of the import at the current address.''' return cls.fullname(ui.current.address())
[ "def", "fullname", "(", "cls", ")", ":", "return", "cls", ".", "fullname", "(", "ui", ".", "current", ".", "address", "(", ")", ")" ]
https://github.com/arizvisa/ida-minsc/blob/8627a60f047b5e55d3efeecde332039cd1a16eea/base/database.py#L2189-L2191
speedinghzl/pytorch-segmentation-toolbox
3f8f602a086f60d93993acd2c409ea50803236d4
libs/dense.py
python
DenseModule.out_channels
(self)
return self.in_channels + self.growth * self.layers
[]
def out_channels(self): return self.in_channels + self.growth * self.layers
[ "def", "out_channels", "(", "self", ")", ":", "return", "self", ".", "in_channels", "+", "self", ".", "growth", "*", "self", ".", "layers" ]
https://github.com/speedinghzl/pytorch-segmentation-toolbox/blob/3f8f602a086f60d93993acd2c409ea50803236d4/libs/dense.py#L31-L32
DataDog/integrations-core
934674b29d94b70ccc008f76ea172d0cdae05e1e
tokumx/datadog_checks/tokumx/vendor/pymongo/monitoring.py
python
CommandSucceededEvent.duration_micros
(self)
return self.__duration_micros
The duration of this operation in microseconds.
The duration of this operation in microseconds.
[ "The", "duration", "of", "this", "operation", "in", "microseconds", "." ]
def duration_micros(self): """The duration of this operation in microseconds.""" return self.__duration_micros
[ "def", "duration_micros", "(", "self", ")", ":", "return", "self", ".", "__duration_micros" ]
https://github.com/DataDog/integrations-core/blob/934674b29d94b70ccc008f76ea172d0cdae05e1e/tokumx/datadog_checks/tokumx/vendor/pymongo/monitoring.py#L426-L428
holzschu/Carnets
44effb10ddfc6aa5c8b0687582a724ba82c6b547
Library/lib/python3.7/site-packages/sympy/stats/frv.py
python
FiniteDensity.__call__
(self, item)
Make instance of a class callable. If item belongs to current instance of a class, return it. Otherwise, return 0.
Make instance of a class callable.
[ "Make", "instance", "of", "a", "class", "callable", "." ]
def __call__(self, item): """ Make instance of a class callable. If item belongs to current instance of a class, return it. Otherwise, return 0. """ item = sympify(item) if item in self: return self[item] else: return 0
[ "def", "__call__", "(", "self", ",", "item", ")", ":", "item", "=", "sympify", "(", "item", ")", "if", "item", "in", "self", ":", "return", "self", "[", "item", "]", "else", ":", "return", "0" ]
https://github.com/holzschu/Carnets/blob/44effb10ddfc6aa5c8b0687582a724ba82c6b547/Library/lib/python3.7/site-packages/sympy/stats/frv.py#L31-L43
pycontribs/pyrax
a0c022981f76a4cba96a22ecc19bb52843ac4fbe
pyrax/cloudloadbalancers.py
python
CloudLoadBalancer.get_error_page
(self)
return self.manager.get_error_page(self)
Returns the current error page for the load balancer. Load balancers all have a default error page that is shown to an end user who is attempting to access a load balancer node that is offline/unavailable.
Returns the current error page for the load balancer.
[ "Returns", "the", "current", "error", "page", "for", "the", "load", "balancer", "." ]
def get_error_page(self): """ Returns the current error page for the load balancer. Load balancers all have a default error page that is shown to an end user who is attempting to access a load balancer node that is offline/unavailable. """ return self.manager.get...
[ "def", "get_error_page", "(", "self", ")", ":", "return", "self", ".", "manager", ".", "get_error_page", "(", "self", ")" ]
https://github.com/pycontribs/pyrax/blob/a0c022981f76a4cba96a22ecc19bb52843ac4fbe/pyrax/cloudloadbalancers.py#L349-L357
clinton-hall/nzbToMedia
27669389216902d1085660167e7bda0bd8527ecf
libs/common/guessit/rules/properties/language.py
python
to_rebulk_match
(language_match)
return start, end, { 'name': name, 'value': language_match.lang }
Convert language match to rebulk Match: start, end, dict
Convert language match to rebulk Match: start, end, dict
[ "Convert", "language", "match", "to", "rebulk", "Match", ":", "start", "end", "dict" ]
def to_rebulk_match(language_match): """ Convert language match to rebulk Match: start, end, dict """ word = language_match.word start = word.start end = word.end name = language_match.property_name if language_match.lang == UNDETERMINED: return start, end, { 'name': ...
[ "def", "to_rebulk_match", "(", "language_match", ")", ":", "word", "=", "language_match", ".", "word", "start", "=", "word", ".", "start", "end", "=", "word", ".", "end", "name", "=", "language_match", ".", "property_name", "if", "language_match", ".", "lang...
https://github.com/clinton-hall/nzbToMedia/blob/27669389216902d1085660167e7bda0bd8527ecf/libs/common/guessit/rules/properties/language.py#L169-L188
learningequality/ka-lite
571918ea668013dcf022286ea85eff1c5333fb8b
kalite/packages/bundled/django/contrib/auth/hashers.py
python
get_hasher
(algorithm='default')
Returns an instance of a loaded password hasher. If algorithm is 'default', the default hasher will be returned. This function will also lazy import hashers specified in your settings file if needed.
Returns an instance of a loaded password hasher.
[ "Returns", "an", "instance", "of", "a", "loaded", "password", "hasher", "." ]
def get_hasher(algorithm='default'): """ Returns an instance of a loaded password hasher. If algorithm is 'default', the default hasher will be returned. This function will also lazy import hashers specified in your settings file if needed. """ if hasattr(algorithm, 'algorithm'): re...
[ "def", "get_hasher", "(", "algorithm", "=", "'default'", ")", ":", "if", "hasattr", "(", "algorithm", ",", "'algorithm'", ")", ":", "return", "algorithm", "elif", "algorithm", "==", "'default'", ":", "if", "PREFERRED_HASHER", "is", "None", ":", "load_hashers",...
https://github.com/learningequality/ka-lite/blob/571918ea668013dcf022286ea85eff1c5333fb8b/kalite/packages/bundled/django/contrib/auth/hashers.py#L102-L124
PokemonGoF/PokemonGo-Bot-Desktop
4bfa94f0183406c6a86f93645eff7abd3ad4ced8
build/pywin/Lib/logging/__init__.py
python
Handler.__init__
(self, level=NOTSET)
Initializes the instance - basically setting the formatter to None and the filter list to empty.
Initializes the instance - basically setting the formatter to None and the filter list to empty.
[ "Initializes", "the", "instance", "-", "basically", "setting", "the", "formatter", "to", "None", "and", "the", "filter", "list", "to", "empty", "." ]
def __init__(self, level=NOTSET): """ Initializes the instance - basically setting the formatter to None and the filter list to empty. """ Filterer.__init__(self) self._name = None self.level = _checkLevel(level) self.formatter = None # Add the han...
[ "def", "__init__", "(", "self", ",", "level", "=", "NOTSET", ")", ":", "Filterer", ".", "__init__", "(", "self", ")", "self", ".", "_name", "=", "None", "self", ".", "level", "=", "_checkLevel", "(", "level", ")", "self", ".", "formatter", "=", "None...
https://github.com/PokemonGoF/PokemonGo-Bot-Desktop/blob/4bfa94f0183406c6a86f93645eff7abd3ad4ced8/build/pywin/Lib/logging/__init__.py#L665-L676
rhinstaller/anaconda
63edc8680f1b05cbfe11bef28703acba808c5174
pyanaconda/modules/storage/partitioning/blivet/blivet_handler.py
python
BlivetRequestHandler.handle
(self)
Handle a message.
Handle a message.
[ "Handle", "a", "message", "." ]
def handle(self): """Handle a message.""" msg = self._recv_msg() unpickled_msg = pickle.loads(msg) if unpickled_msg[0] == "call": self._call_utils_method(unpickled_msg) elif unpickled_msg[0] == "param": self._get_param(unpickled_msg) elif unpickle...
[ "def", "handle", "(", "self", ")", ":", "msg", "=", "self", ".", "_recv_msg", "(", ")", "unpickled_msg", "=", "pickle", ".", "loads", "(", "msg", ")", "if", "unpickled_msg", "[", "0", "]", "==", "\"call\"", ":", "self", ".", "_call_utils_method", "(", ...
https://github.com/rhinstaller/anaconda/blob/63edc8680f1b05cbfe11bef28703acba808c5174/pyanaconda/modules/storage/partitioning/blivet/blivet_handler.py#L55-L69
sahana/eden
1696fa50e90ce967df69f66b571af45356cc18da
models/tasks.py
python
gis_download_kml
(record_id, filename, session_id_name, session_id, user_id=None)
return result
Download a KML file - will normally be done Asynchronously if there is a worker alive @param record_id: id of the record in db.gis_layer_kml @param filename: name to save the file as @param session_id_name: name of the session @param session_id: id of the session @pa...
Download a KML file - will normally be done Asynchronously if there is a worker alive
[ "Download", "a", "KML", "file", "-", "will", "normally", "be", "done", "Asynchronously", "if", "there", "is", "a", "worker", "alive" ]
def gis_download_kml(record_id, filename, session_id_name, session_id, user_id=None): """ Download a KML file - will normally be done Asynchronously if there is a worker alive @param record_id: id of the record in db.gis_layer_kml @param filename: name to sa...
[ "def", "gis_download_kml", "(", "record_id", ",", "filename", ",", "session_id_name", ",", "session_id", ",", "user_id", "=", "None", ")", ":", "if", "user_id", ":", "# Authenticate", "auth", ".", "s3_impersonate", "(", "user_id", ")", "# Run the Task & return the...
https://github.com/sahana/eden/blob/1696fa50e90ce967df69f66b571af45356cc18da/models/tasks.py#L95-L113
Jenyay/outwiker
50530cf7b3f71480bb075b2829bc0669773b835b
src/outwiker/core/system.py
python
getPluginsDirList
(configDirName=DEFAULT_CONFIG_DIR, configFileName=DEFAULT_CONFIG_NAME)
return getSpecialDirList(PLUGINS_FOLDER_NAME, configDirName, configFileName)
Возвращает список директорий, откуда должны грузиться плагины
Возвращает список директорий, откуда должны грузиться плагины
[ "Возвращает", "список", "директорий", "откуда", "должны", "грузиться", "плагины" ]
def getPluginsDirList(configDirName=DEFAULT_CONFIG_DIR, configFileName=DEFAULT_CONFIG_NAME): """ Возвращает список директорий, откуда должны грузиться плагины """ return getSpecialDirList(PLUGINS_FOLDER_NAME, configDirName, ...
[ "def", "getPluginsDirList", "(", "configDirName", "=", "DEFAULT_CONFIG_DIR", ",", "configFileName", "=", "DEFAULT_CONFIG_NAME", ")", ":", "return", "getSpecialDirList", "(", "PLUGINS_FOLDER_NAME", ",", "configDirName", ",", "configFileName", ")" ]
https://github.com/Jenyay/outwiker/blob/50530cf7b3f71480bb075b2829bc0669773b835b/src/outwiker/core/system.py#L288-L295
securesystemslab/zippy
ff0e84ac99442c2c55fe1d285332cfd4e185e089
zippy/benchmarks/src/benchmarks/sympy/sympy/printing/latex.py
python
LatexPrinter._print_ImageSet
(self, s)
return r"\left\{%s\; |\; %s \in %s\right\}" % ( self._print(s.lamda.expr), ', '.join([self._print(var) for var in s.lamda.variables]), self._print(s.base_set))
[]
def _print_ImageSet(self, s): return r"\left\{%s\; |\; %s \in %s\right\}" % ( self._print(s.lamda.expr), ', '.join([self._print(var) for var in s.lamda.variables]), self._print(s.base_set))
[ "def", "_print_ImageSet", "(", "self", ",", "s", ")", ":", "return", "r\"\\left\\{%s\\; |\\; %s \\in %s\\right\\}\"", "%", "(", "self", ".", "_print", "(", "s", ".", "lamda", ".", "expr", ")", ",", "', '", ".", "join", "(", "[", "self", ".", "_print", "(...
https://github.com/securesystemslab/zippy/blob/ff0e84ac99442c2c55fe1d285332cfd4e185e089/zippy/benchmarks/src/benchmarks/sympy/sympy/printing/latex.py#L1461-L1465
accelero-cloud/appkernel
1be8707f535e9f8ad78ef944f2631b15ce03e8f3
appkernel/reflection.py
python
is_dictionary
(obj)
return type(obj) is dict
Helper method for testing if the object is a dictionary. >>> is_dictionary({'key':'value'}) True
Helper method for testing if the object is a dictionary. >>> is_dictionary({'key':'value'}) True
[ "Helper", "method", "for", "testing", "if", "the", "object", "is", "a", "dictionary", ".", ">>>", "is_dictionary", "(", "{", "key", ":", "value", "}", ")", "True" ]
def is_dictionary(obj): """Helper method for testing if the object is a dictionary. >>> is_dictionary({'key':'value'}) True """ return type(obj) is dict
[ "def", "is_dictionary", "(", "obj", ")", ":", "return", "type", "(", "obj", ")", "is", "dict" ]
https://github.com/accelero-cloud/appkernel/blob/1be8707f535e9f8ad78ef944f2631b15ce03e8f3/appkernel/reflection.py#L95-L100
tomplus/kubernetes_asyncio
f028cc793e3a2c519be6a52a49fb77ff0b014c9b
kubernetes_asyncio/client/models/v1_node_selector_term.py
python
V1NodeSelectorTerm.match_fields
(self, match_fields)
Sets the match_fields of this V1NodeSelectorTerm. A list of node selector requirements by node's fields. # noqa: E501 :param match_fields: The match_fields of this V1NodeSelectorTerm. # noqa: E501 :type: list[V1NodeSelectorRequirement]
Sets the match_fields of this V1NodeSelectorTerm.
[ "Sets", "the", "match_fields", "of", "this", "V1NodeSelectorTerm", "." ]
def match_fields(self, match_fields): """Sets the match_fields of this V1NodeSelectorTerm. A list of node selector requirements by node's fields. # noqa: E501 :param match_fields: The match_fields of this V1NodeSelectorTerm. # noqa: E501 :type: list[V1NodeSelectorRequirement] ...
[ "def", "match_fields", "(", "self", ",", "match_fields", ")", ":", "self", ".", "_match_fields", "=", "match_fields" ]
https://github.com/tomplus/kubernetes_asyncio/blob/f028cc793e3a2c519be6a52a49fb77ff0b014c9b/kubernetes_asyncio/client/models/v1_node_selector_term.py#L95-L104
nortikin/sverchok
7b460f01317c15f2681bfa3e337c5e7346f3711b
utils/decorators.py
python
deprecated
(argument)
This is a decorator which can be used to mark functions as deprecated. It will result in a warning being emitted when the function is used.
This is a decorator which can be used to mark functions as deprecated. It will result in a warning being emitted when the function is used.
[ "This", "is", "a", "decorator", "which", "can", "be", "used", "to", "mark", "functions", "as", "deprecated", ".", "It", "will", "result", "in", "a", "warning", "being", "emitted", "when", "the", "function", "is", "used", "." ]
def deprecated(argument): """ This is a decorator which can be used to mark functions as deprecated. It will result in a warning being emitted when the function is used. """ def format_message(object, reason): if inspect.isclass(object): if reason is None: fm...
[ "def", "deprecated", "(", "argument", ")", ":", "def", "format_message", "(", "object", ",", "reason", ")", ":", "if", "inspect", ".", "isclass", "(", "object", ")", ":", "if", "reason", "is", "None", ":", "fmt", "=", "\"Call to deprecated class {name}.\"", ...
https://github.com/nortikin/sverchok/blob/7b460f01317c15f2681bfa3e337c5e7346f3711b/utils/decorators.py#L26-L100
aquario-crypto/Book_on_Python_Algorithms_and_Data_Structure
234b4b1fc84faf4a06843c1fba1d05ccc18f80e6
book/ebook_src/real_interview_problems/other_resources/Project-Euler/012-highly_divisible_trian_num.py
python
find_trian
(l)
return sum(range(1, l+1))
find the lth trian number
find the lth trian number
[ "find", "the", "lth", "trian", "number" ]
def find_trian(l): ''' find the lth trian number''' return sum(range(1, l+1))
[ "def", "find_trian", "(", "l", ")", ":", "return", "sum", "(", "range", "(", "1", ",", "l", "+", "1", ")", ")" ]
https://github.com/aquario-crypto/Book_on_Python_Algorithms_and_Data_Structure/blob/234b4b1fc84faf4a06843c1fba1d05ccc18f80e6/book/ebook_src/real_interview_problems/other_resources/Project-Euler/012-highly_divisible_trian_num.py#L18-L20
LxMLS/lxmls-toolkit
d95c623dd13e31135f4887c3788959eb9ad3d269
lxmls/deep_learning/pytorch_models/rnn.py
python
PolicyRNN.baseline
(self, R)
return cast_float(b, grad=False)
compute baseline as E(R| w_1:t-1, a_1:t-a) = < h_t, w > :return: <h_t,w>
compute baseline as E(R| w_1:t-1, a_1:t-a) = < h_t, w > :return: <h_t,w>
[ "compute", "baseline", "as", "E", "(", "R|", "w_1", ":", "t", "-", "1", "a_1", ":", "t", "-", "a", ")", "=", "<", "h_t", "w", ">", ":", "return", ":", "<h_t", "w", ">" ]
def baseline(self, R): """ compute baseline as E(R| w_1:t-1, a_1:t-a) = < h_t, w > :return: <h_t,w> """ # estimate baseline weights with all batch samples using OLS H = self.h.data H = H.detach().numpy() w = np.dot(np.linalg.pinv(H), R.data.detach().numpy(...
[ "def", "baseline", "(", "self", ",", "R", ")", ":", "# estimate baseline weights with all batch samples using OLS", "H", "=", "self", ".", "h", ".", "data", "H", "=", "H", ".", "detach", "(", ")", ".", "numpy", "(", ")", "w", "=", "np", ".", "dot", "("...
https://github.com/LxMLS/lxmls-toolkit/blob/d95c623dd13e31135f4887c3788959eb9ad3d269/lxmls/deep_learning/pytorch_models/rnn.py#L496-L506
facebookresearch/mmf
fb6fe390287e1da12c3bd28d4ab43c5f7dcdfc9f
mmf/common/registry.py
python
Registry.get_pool_class
(cls, name)
return cls.mapping["pool_name_mapping"].get(name, None)
[]
def get_pool_class(cls, name): return cls.mapping["pool_name_mapping"].get(name, None)
[ "def", "get_pool_class", "(", "cls", ",", "name", ")", ":", "return", "cls", ".", "mapping", "[", "\"pool_name_mapping\"", "]", ".", "get", "(", "name", ",", "None", ")" ]
https://github.com/facebookresearch/mmf/blob/fb6fe390287e1da12c3bd28d4ab43c5f7dcdfc9f/mmf/common/registry.py#L542-L543
pantsbuild/pants
2e126e78ffc40cb108408316b90e8beebee1df9e
src/python/pants/util/ordered_set.py
python
OrderedSet.update
(self, iterable: Iterable[T])
Update the set with the given iterable sequence.
Update the set with the given iterable sequence.
[ "Update", "the", "set", "with", "the", "given", "iterable", "sequence", "." ]
def update(self, iterable: Iterable[T]) -> None: """Update the set with the given iterable sequence.""" for item in iterable: self.add(item)
[ "def", "update", "(", "self", ",", "iterable", ":", "Iterable", "[", "T", "]", ")", "->", "None", ":", "for", "item", "in", "iterable", ":", "self", ".", "add", "(", "item", ")" ]
https://github.com/pantsbuild/pants/blob/2e126e78ffc40cb108408316b90e8beebee1df9e/src/python/pants/util/ordered_set.py#L158-L161
awslabs/sockeye
ec2d13f7beb42d8c4f389dba0172250dc9154d5a
sockeye/model.py
python
SockeyeModel.load_parameters
(self, filename: str, ctx: Union[mx.Context, List[mx.Context]] = None, allow_missing: bool = False, ignore_extra: bool = False, cast_dtype: bool = False, dtype_source: str = 'c...
Load parameters from file previously saved by `save_parameters`. Parameters ---------- filename : str Path to parameter file. ctx : Context or list of Context, default cpu() Context(s) to initialize loaded parameters on. allow_missing : bool, default Fals...
Load parameters from file previously saved by `save_parameters`.
[ "Load", "parameters", "from", "file", "previously", "saved", "by", "save_parameters", "." ]
def load_parameters(self, filename: str, ctx: Union[mx.Context, List[mx.Context]] = None, allow_missing: bool = False, ignore_extra: bool = False, cast_dtype: bool = False, dty...
[ "def", "load_parameters", "(", "self", ",", "filename", ":", "str", ",", "ctx", ":", "Union", "[", "mx", ".", "Context", ",", "List", "[", "mx", ".", "Context", "]", "]", "=", "None", ",", "allow_missing", ":", "bool", "=", "False", ",", "ignore_extr...
https://github.com/awslabs/sockeye/blob/ec2d13f7beb42d8c4f389dba0172250dc9154d5a/sockeye/model.py#L336-L373