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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
dmontagu/fastapi-utils | af95ff4a8195caaa9edaa3dbd5b6eeb09691d9c7 | fastapi_utils/cbv.py | python | cbv | (router: APIRouter) | return decorator | This function returns a decorator that converts the decorated into a class-based view for the provided router.
Any methods of the decorated class that are decorated as endpoints using the router provided to this function
will become endpoints in the router. The first positional argument to the methods (typical... | This function returns a decorator that converts the decorated into a class-based view for the provided router. | [
"This",
"function",
"returns",
"a",
"decorator",
"that",
"converts",
"the",
"decorated",
"into",
"a",
"class",
"-",
"based",
"view",
"for",
"the",
"provided",
"router",
"."
] | def cbv(router: APIRouter) -> Callable[[Type[T]], Type[T]]:
"""
This function returns a decorator that converts the decorated into a class-based view for the provided router.
Any methods of the decorated class that are decorated as endpoints using the router provided to this function
will become endpoi... | [
"def",
"cbv",
"(",
"router",
":",
"APIRouter",
")",
"->",
"Callable",
"[",
"[",
"Type",
"[",
"T",
"]",
"]",
",",
"Type",
"[",
"T",
"]",
"]",
":",
"def",
"decorator",
"(",
"cls",
":",
"Type",
"[",
"T",
"]",
")",
"->",
"Type",
"[",
"T",
"]",
... | https://github.com/dmontagu/fastapi-utils/blob/af95ff4a8195caaa9edaa3dbd5b6eeb09691d9c7/fastapi_utils/cbv.py#L13-L28 | |
wanggrun/Adaptively-Connected-Neural-Networks | e27066ef52301bdafa5932f43af8feeb23647edb | tensorpack-installed/build/lib/tensorpack/utils/concurrency.py | python | OrderedResultGatherProc.__init__ | (self, data_queue, nr_producer, start=0) | Args:
data_queue(multiprocessing.Queue): a queue which contains datapoints.
nr_producer(int): number of producer processes. This process will
terminate after receiving this many of :class:`DIE` sentinel.
start(int): the rank of the first object | Args:
data_queue(multiprocessing.Queue): a queue which contains datapoints.
nr_producer(int): number of producer processes. This process will
terminate after receiving this many of :class:`DIE` sentinel.
start(int): the rank of the first object | [
"Args",
":",
"data_queue",
"(",
"multiprocessing",
".",
"Queue",
")",
":",
"a",
"queue",
"which",
"contains",
"datapoints",
".",
"nr_producer",
"(",
"int",
")",
":",
"number",
"of",
"producer",
"processes",
".",
"This",
"process",
"will",
"terminate",
"after... | def __init__(self, data_queue, nr_producer, start=0):
"""
Args:
data_queue(multiprocessing.Queue): a queue which contains datapoints.
nr_producer(int): number of producer processes. This process will
terminate after receiving this many of :class:`DIE` sentinel.
... | [
"def",
"__init__",
"(",
"self",
",",
"data_queue",
",",
"nr_producer",
",",
"start",
"=",
"0",
")",
":",
"super",
"(",
"OrderedResultGatherProc",
",",
"self",
")",
".",
"__init__",
"(",
")",
"self",
".",
"data_queue",
"=",
"data_queue",
"self",
".",
"ord... | https://github.com/wanggrun/Adaptively-Connected-Neural-Networks/blob/e27066ef52301bdafa5932f43af8feeb23647edb/tensorpack-installed/build/lib/tensorpack/utils/concurrency.py#L293-L305 | ||
psychopy/psychopy | 01b674094f38d0e0bd51c45a6f66f671d7041696 | psychopy/demos/coder/iohub/wintab/_wintabgraphics.py | python | PenTracesStim.end | (self) | Stop using the current_pentrace ShapeStim. Next time a pen
sample position is added to the PenTracesStim instance, a new
ShapeStim will created and added to the pentracestim list.
:return: None | Stop using the current_pentrace ShapeStim. Next time a pen
sample position is added to the PenTracesStim instance, a new
ShapeStim will created and added to the pentracestim list. | [
"Stop",
"using",
"the",
"current_pentrace",
"ShapeStim",
".",
"Next",
"time",
"a",
"pen",
"sample",
"position",
"is",
"added",
"to",
"the",
"PenTracesStim",
"instance",
"a",
"new",
"ShapeStim",
"will",
"created",
"and",
"added",
"to",
"the",
"pentracestim",
"l... | def end(self):
"""Stop using the current_pentrace ShapeStim. Next time a pen
sample position is added to the PenTracesStim instance, a new
ShapeStim will created and added to the pentracestim list.
:return: None
"""
self.current_pentrace = None
self.current_point... | [
"def",
"end",
"(",
"self",
")",
":",
"self",
".",
"current_pentrace",
"=",
"None",
"self",
".",
"current_points",
"=",
"[",
"]",
"self",
".",
"last_pos",
"=",
"[",
"0",
",",
"0",
"]"
] | https://github.com/psychopy/psychopy/blob/01b674094f38d0e0bd51c45a6f66f671d7041696/psychopy/demos/coder/iohub/wintab/_wintabgraphics.py#L247-L256 | ||
omz/PythonistaAppTemplate | f560f93f8876d82a21d108977f90583df08d55af | PythonistaAppTemplate/PythonistaKit.framework/pylib/difflib.py | python | ndiff | (a, b, linejunk=None, charjunk=IS_CHARACTER_JUNK) | return Differ(linejunk, charjunk).compare(a, b) | r"""
Compare `a` and `b` (lists of strings); return a `Differ`-style delta.
Optional keyword parameters `linejunk` and `charjunk` are for filter
functions (or None):
- linejunk: A function that should accept a single string argument, and
return true iff the string is junk. The default is None, ... | r"""
Compare `a` and `b` (lists of strings); return a `Differ`-style delta. | [
"r",
"Compare",
"a",
"and",
"b",
"(",
"lists",
"of",
"strings",
")",
";",
"return",
"a",
"Differ",
"-",
"style",
"delta",
"."
] | def ndiff(a, b, linejunk=None, charjunk=IS_CHARACTER_JUNK):
r"""
Compare `a` and `b` (lists of strings); return a `Differ`-style delta.
Optional keyword parameters `linejunk` and `charjunk` are for filter
functions (or None):
- linejunk: A function that should accept a single string argument, and
... | [
"def",
"ndiff",
"(",
"a",
",",
"b",
",",
"linejunk",
"=",
"None",
",",
"charjunk",
"=",
"IS_CHARACTER_JUNK",
")",
":",
"return",
"Differ",
"(",
"linejunk",
",",
"charjunk",
")",
".",
"compare",
"(",
"a",
",",
"b",
")"
] | https://github.com/omz/PythonistaAppTemplate/blob/f560f93f8876d82a21d108977f90583df08d55af/PythonistaAppTemplate/PythonistaKit.framework/pylib/difflib.py#L1315-L1349 | |
dmbee/seglearn | 746d6c4eb89a338e6366c5be59fb25d1af63477f | seglearn/preprocessing.py | python | TargetRunLengthEncoder._transform | (self, X, y) | return Xt, yt | Transforms single series | Transforms single series | [
"Transforms",
"single",
"series"
] | def _transform(self, X, y):
"""
Transforms single series
"""
z, p, y_rle = self._rle(y)
p = np.append(p, len(y))
big_enough = p[1:] - p[:-1] >= self.min_length
Xt = []
for i in range(len(y_rle)):
if big_enough[i]:
Xt.append(X[p... | [
"def",
"_transform",
"(",
"self",
",",
"X",
",",
"y",
")",
":",
"z",
",",
"p",
",",
"y_rle",
"=",
"self",
".",
"_rle",
"(",
"y",
")",
"p",
"=",
"np",
".",
"append",
"(",
"p",
",",
"len",
"(",
"y",
")",
")",
"big_enough",
"=",
"p",
"[",
"1... | https://github.com/dmbee/seglearn/blob/746d6c4eb89a338e6366c5be59fb25d1af63477f/seglearn/preprocessing.py#L143-L157 | |
googleapis/oauth2client | 50d20532a748f18e53f7d24ccbe6647132c979a9 | oauth2client/_pure_python_crypt.py | python | _bit_list_to_bytes | (bit_list) | return bytes(byte_vals) | Converts an iterable of 1's and 0's to bytes.
Combines the list 8 at a time, treating each group of 8 bits
as a single byte. | Converts an iterable of 1's and 0's to bytes. | [
"Converts",
"an",
"iterable",
"of",
"1",
"s",
"and",
"0",
"s",
"to",
"bytes",
"."
] | def _bit_list_to_bytes(bit_list):
"""Converts an iterable of 1's and 0's to bytes.
Combines the list 8 at a time, treating each group of 8 bits
as a single byte.
"""
num_bits = len(bit_list)
byte_vals = bytearray()
for start in six.moves.xrange(0, num_bits, 8):
curr_bits = bit_list[... | [
"def",
"_bit_list_to_bytes",
"(",
"bit_list",
")",
":",
"num_bits",
"=",
"len",
"(",
"bit_list",
")",
"byte_vals",
"=",
"bytearray",
"(",
")",
"for",
"start",
"in",
"six",
".",
"moves",
".",
"xrange",
"(",
"0",
",",
"num_bits",
",",
"8",
")",
":",
"c... | https://github.com/googleapis/oauth2client/blob/50d20532a748f18e53f7d24ccbe6647132c979a9/oauth2client/_pure_python_crypt.py#L49-L62 | |
scikit-learn/scikit-learn | 1d1aadd0711b87d2a11c80aad15df6f8cf156712 | sklearn/cluster/_mean_shift.py | python | MeanShift.predict | (self, X) | Predict the closest cluster each sample in X belongs to.
Parameters
----------
X : array-like of shape (n_samples, n_features)
New data to predict.
Returns
-------
labels : ndarray of shape (n_samples,)
Index of the cluster each sample belongs to... | Predict the closest cluster each sample in X belongs to. | [
"Predict",
"the",
"closest",
"cluster",
"each",
"sample",
"in",
"X",
"belongs",
"to",
"."
] | def predict(self, X):
"""Predict the closest cluster each sample in X belongs to.
Parameters
----------
X : array-like of shape (n_samples, n_features)
New data to predict.
Returns
-------
labels : ndarray of shape (n_samples,)
Index of t... | [
"def",
"predict",
"(",
"self",
",",
"X",
")",
":",
"check_is_fitted",
"(",
"self",
")",
"X",
"=",
"self",
".",
"_validate_data",
"(",
"X",
",",
"reset",
"=",
"False",
")",
"with",
"config_context",
"(",
"assume_finite",
"=",
"True",
")",
":",
"return",... | https://github.com/scikit-learn/scikit-learn/blob/1d1aadd0711b87d2a11c80aad15df6f8cf156712/sklearn/cluster/_mean_shift.py#L498-L514 | ||
Huangying-Zhan/DF-VO | 6a2ec43fc6209d9058ae1709d779c5ada68a31f3 | libs/datasets/tum.py | python | TUM.get_gt_poses | (self) | return gt_poses | Get ground-truth poses
Returns:
gt_poses (dict): each pose is a [4x4] array | Get ground-truth poses
Returns:
gt_poses (dict): each pose is a [4x4] array | [
"Get",
"ground",
"-",
"truth",
"poses",
"Returns",
":",
"gt_poses",
"(",
"dict",
")",
":",
"each",
"pose",
"is",
"a",
"[",
"4x4",
"]",
"array"
] | def get_gt_poses(self):
"""Get ground-truth poses
Returns:
gt_poses (dict): each pose is a [4x4] array
"""
annotations = os.path.join(
self.cfg.directory.gt_pose_dir,
self.cfg.seq,
'g... | [
"def",
"get_gt_poses",
"(",
"self",
")",
":",
"annotations",
"=",
"os",
".",
"path",
".",
"join",
"(",
"self",
".",
"cfg",
".",
"directory",
".",
"gt_pose_dir",
",",
"self",
".",
"cfg",
".",
"seq",
",",
"'groundtruth.txt'",
")",
"gt_poses",
"=",
"load_... | https://github.com/Huangying-Zhan/DF-VO/blob/6a2ec43fc6209d9058ae1709d779c5ada68a31f3/libs/datasets/tum.py#L164-L176 | |
ankitsejwal/Lyndor | d645ca0606ff3b2a518c7b58c688d11f7a60783d | run.py | python | schedule_download | (url) | Look for the scheduled time in settings.json | Look for the scheduled time in settings.json | [
"Look",
"for",
"the",
"scheduled",
"time",
"in",
"settings",
".",
"json"
] | def schedule_download(url):
''' Look for the scheduled time in settings.json '''
if not read.aria2_installed:
tip = '☝🏻 Tip: Install aria2c for faster downloads, read README.md to learn more.'
message.carriage_return_animate(tip)
if read.download_time == '':
# If download time... | [
"def",
"schedule_download",
"(",
"url",
")",
":",
"if",
"not",
"read",
".",
"aria2_installed",
":",
"tip",
"=",
"'☝🏻 Tip: Install aria2c for faster downloads, read README.md to learn more.'",
"message",
".",
"carriage_return_animate",
"(",
"tip",
")",
"if",
"read",
".... | https://github.com/ankitsejwal/Lyndor/blob/d645ca0606ff3b2a518c7b58c688d11f7a60783d/run.py#L47-L69 | ||
fluentpython/notebooks | 0f6e1e8d1686743dacd9281df7c5b5921812010a | 07-closure-deco/strategy_best4.py | python | Order.due | (self) | return self.total() - discount | [] | def due(self):
if self.promotion is None:
discount = 0
else:
discount = self.promotion(self)
return self.total() - discount | [
"def",
"due",
"(",
"self",
")",
":",
"if",
"self",
".",
"promotion",
"is",
"None",
":",
"discount",
"=",
"0",
"else",
":",
"discount",
"=",
"self",
".",
"promotion",
"(",
"self",
")",
"return",
"self",
".",
"total",
"(",
")",
"-",
"discount"
] | https://github.com/fluentpython/notebooks/blob/0f6e1e8d1686743dacd9281df7c5b5921812010a/07-closure-deco/strategy_best4.py#L67-L72 | |||
oilshell/oil | 94388e7d44a9ad879b12615f6203b38596b5a2d3 | Python-2.7.13/Lib/lib-tk/Tix.py | python | DirTree.chdir | (self, dir) | [] | def chdir(self, dir):
self.tk.call(self._w, 'chdir', dir) | [
"def",
"chdir",
"(",
"self",
",",
"dir",
")",
":",
"self",
".",
"tk",
".",
"call",
"(",
"self",
".",
"_w",
",",
"'chdir'",
",",
"dir",
")"
] | https://github.com/oilshell/oil/blob/94388e7d44a9ad879b12615f6203b38596b5a2d3/Python-2.7.13/Lib/lib-tk/Tix.py#L686-L687 | ||||
gaasedelen/lighthouse | 7245a2d2c4e84351cd259ed81dafa4263167909a | plugins/lighthouse/ui/coverage_overview.py | python | CoverageOverview.terminate | (self) | The CoverageOverview is being hidden / deleted. | The CoverageOverview is being hidden / deleted. | [
"The",
"CoverageOverview",
"is",
"being",
"hidden",
"/",
"deleted",
"."
] | def terminate(self):
"""
The CoverageOverview is being hidden / deleted.
"""
self._combobox = None
self._shell = None
self._table_view = None
self._table_controller = None
self._table_model = None
self.widget = None | [
"def",
"terminate",
"(",
"self",
")",
":",
"self",
".",
"_combobox",
"=",
"None",
"self",
".",
"_shell",
"=",
"None",
"self",
".",
"_table_view",
"=",
"None",
"self",
".",
"_table_controller",
"=",
"None",
"self",
".",
"_table_model",
"=",
"None",
"self"... | https://github.com/gaasedelen/lighthouse/blob/7245a2d2c4e84351cd259ed81dafa4263167909a/plugins/lighthouse/ui/coverage_overview.py#L63-L72 | ||
avocado-framework/avocado | 1f9b3192e8ba47d029c33fe21266bd113d17811f | setup.py | python | Develop.handle_uninstall | (self) | When uninstalling, we remove the plugins before Avocado. | When uninstalling, we remove the plugins before Avocado. | [
"When",
"uninstalling",
"we",
"remove",
"the",
"plugins",
"before",
"Avocado",
"."
] | def handle_uninstall(self):
"""When uninstalling, we remove the plugins before Avocado."""
self._walk_develop_plugins()
super().run() | [
"def",
"handle_uninstall",
"(",
"self",
")",
":",
"self",
".",
"_walk_develop_plugins",
"(",
")",
"super",
"(",
")",
".",
"run",
"(",
")"
] | https://github.com/avocado-framework/avocado/blob/1f9b3192e8ba47d029c33fe21266bd113d17811f/setup.py#L136-L139 | ||
ros/ros | 93d8da32091b8b43702eab5d3202f4511dfeb7dc | tools/rosunit/src/rosunit/pyunit.py | python | unitrun | (package, test_name, test, sysargs=None, coverage_packages=None) | Wrapper routine from running python unitttests with
JUnit-compatible XML output. This is meant for unittests that do
not not need a running ROS graph (i.e. offline tests only).
This enables JUnit-compatible test reporting so that
test results can be reported to higher-level tools.
WARNING: unitru... | Wrapper routine from running python unitttests with
JUnit-compatible XML output. This is meant for unittests that do
not not need a running ROS graph (i.e. offline tests only). | [
"Wrapper",
"routine",
"from",
"running",
"python",
"unitttests",
"with",
"JUnit",
"-",
"compatible",
"XML",
"output",
".",
"This",
"is",
"meant",
"for",
"unittests",
"that",
"do",
"not",
"not",
"need",
"a",
"running",
"ROS",
"graph",
"(",
"i",
".",
"e",
... | def unitrun(package, test_name, test, sysargs=None, coverage_packages=None):
"""
Wrapper routine from running python unitttests with
JUnit-compatible XML output. This is meant for unittests that do
not not need a running ROS graph (i.e. offline tests only).
This enables JUnit-compatible test repor... | [
"def",
"unitrun",
"(",
"package",
",",
"test_name",
",",
"test",
",",
"sysargs",
"=",
"None",
",",
"coverage_packages",
"=",
"None",
")",
":",
"if",
"sysargs",
"is",
"None",
":",
"# lazy-init sys args",
"import",
"sys",
"sysargs",
"=",
"sys",
".",
"argv",
... | https://github.com/ros/ros/blob/93d8da32091b8b43702eab5d3202f4511dfeb7dc/tools/rosunit/src/rosunit/pyunit.py#L48-L112 | ||
django-nonrel/django-nonrel | 4fbfe7344481a5eab8698f79207f09124310131b | django/contrib/messages/storage/cookie.py | python | CookieStorage._get | (self, *args, **kwargs) | return messages, all_retrieved | Retrieves a list of messages from the messages cookie. If the
not_finished sentinel value is found at the end of the message list,
remove it and return a result indicating that not all messages were
retrieved by this storage. | Retrieves a list of messages from the messages cookie. If the
not_finished sentinel value is found at the end of the message list,
remove it and return a result indicating that not all messages were
retrieved by this storage. | [
"Retrieves",
"a",
"list",
"of",
"messages",
"from",
"the",
"messages",
"cookie",
".",
"If",
"the",
"not_finished",
"sentinel",
"value",
"is",
"found",
"at",
"the",
"end",
"of",
"the",
"message",
"list",
"remove",
"it",
"and",
"return",
"a",
"result",
"indi... | def _get(self, *args, **kwargs):
"""
Retrieves a list of messages from the messages cookie. If the
not_finished sentinel value is found at the end of the message list,
remove it and return a result indicating that not all messages were
retrieved by this storage.
"""
... | [
"def",
"_get",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"data",
"=",
"self",
".",
"request",
".",
"COOKIES",
".",
"get",
"(",
"self",
".",
"cookie_name",
")",
"messages",
"=",
"self",
".",
"_decode",
"(",
"data",
")",
"al... | https://github.com/django-nonrel/django-nonrel/blob/4fbfe7344481a5eab8698f79207f09124310131b/django/contrib/messages/storage/cookie.py#L54-L67 | |
nephila/djangocms-installer | 5f825c02b1c324a2c9c3d0662913a3a2fdf798dd | djangocms_installer/utils.py | python | less_than_version | (value) | return ".".join(map(str, items)) | Converts the current version to the next one for inserting into requirements
in the ' < version' format | Converts the current version to the next one for inserting into requirements
in the ' < version' format | [
"Converts",
"the",
"current",
"version",
"to",
"the",
"next",
"one",
"for",
"inserting",
"into",
"requirements",
"in",
"the",
"<",
"version",
"format"
] | def less_than_version(value):
"""
Converts the current version to the next one for inserting into requirements
in the ' < version' format
"""
items = list(map(int, str(value).split(".")))
if len(items) == 1:
items.append(0)
items[1] += 1
return ".".join(map(str, items)) | [
"def",
"less_than_version",
"(",
"value",
")",
":",
"items",
"=",
"list",
"(",
"map",
"(",
"int",
",",
"str",
"(",
"value",
")",
".",
"split",
"(",
"\".\"",
")",
")",
")",
"if",
"len",
"(",
"items",
")",
"==",
"1",
":",
"items",
".",
"append",
... | https://github.com/nephila/djangocms-installer/blob/5f825c02b1c324a2c9c3d0662913a3a2fdf798dd/djangocms_installer/utils.py#L93-L102 | |
IronLanguages/main | a949455434b1fda8c783289e897e78a9a0caabb5 | External.LCA_RESTRICTED/Languages/IronPython/27/Lib/decimal.py | python | Decimal.log10 | (self, context=None) | return ans | Returns the base 10 logarithm of self. | Returns the base 10 logarithm of self. | [
"Returns",
"the",
"base",
"10",
"logarithm",
"of",
"self",
"."
] | def log10(self, context=None):
"""Returns the base 10 logarithm of self."""
if context is None:
context = getcontext()
# log10(NaN) = NaN
ans = self._check_nans(context=context)
if ans:
return ans
# log10(0.0) == -Infinity
if not self:
... | [
"def",
"log10",
"(",
"self",
",",
"context",
"=",
"None",
")",
":",
"if",
"context",
"is",
"None",
":",
"context",
"=",
"getcontext",
"(",
")",
"# log10(NaN) = NaN",
"ans",
"=",
"self",
".",
"_check_nans",
"(",
"context",
"=",
"context",
")",
"if",
"an... | https://github.com/IronLanguages/main/blob/a949455434b1fda8c783289e897e78a9a0caabb5/External.LCA_RESTRICTED/Languages/IronPython/27/Lib/decimal.py#L3173-L3222 | |
PySimpleGUI/PySimpleGUI | 6c0d1fb54f493d45e90180b322fbbe70f7a5af3c | UserCreatedPrograms/Klondike_Solitaire.py | python | get_card | (x, y, down=True) | return id_to_card(ids[down-2]) | [] | def get_card(x, y, down=True):
# get card by position (x,y), button down for 1st one, button up for 2nd one
ids = draw.get_figures_at_location((x,y))
if down+len(ids)<2: return None
return id_to_card(ids[down-2]) | [
"def",
"get_card",
"(",
"x",
",",
"y",
",",
"down",
"=",
"True",
")",
":",
"# get card by position (x,y), button down for 1st one, button up for 2nd one",
"ids",
"=",
"draw",
".",
"get_figures_at_location",
"(",
"(",
"x",
",",
"y",
")",
")",
"if",
"down",
"+",
... | https://github.com/PySimpleGUI/PySimpleGUI/blob/6c0d1fb54f493d45e90180b322fbbe70f7a5af3c/UserCreatedPrograms/Klondike_Solitaire.py#L458-L462 | |||
nodejs/node-gyp | a2f298870692022302fa27a1d42363c4a72df407 | gyp/pylib/gyp/xcode_emulation.py | python | XcodeArchsDefault._VariableMapping | (self, sdkroot) | Returns the dictionary of variable mapping depending on the SDKROOT. | Returns the dictionary of variable mapping depending on the SDKROOT. | [
"Returns",
"the",
"dictionary",
"of",
"variable",
"mapping",
"depending",
"on",
"the",
"SDKROOT",
"."
] | def _VariableMapping(self, sdkroot):
"""Returns the dictionary of variable mapping depending on the SDKROOT."""
sdkroot = sdkroot.lower()
if "iphoneos" in sdkroot:
return self._archs["ios"]
elif "iphonesimulator" in sdkroot:
return self._archs["iossim"]
el... | [
"def",
"_VariableMapping",
"(",
"self",
",",
"sdkroot",
")",
":",
"sdkroot",
"=",
"sdkroot",
".",
"lower",
"(",
")",
"if",
"\"iphoneos\"",
"in",
"sdkroot",
":",
"return",
"self",
".",
"_archs",
"[",
"\"ios\"",
"]",
"elif",
"\"iphonesimulator\"",
"in",
"sdk... | https://github.com/nodejs/node-gyp/blob/a2f298870692022302fa27a1d42363c4a72df407/gyp/pylib/gyp/xcode_emulation.py#L54-L62 | ||
open-mmlab/mmediting | 6a08a728c63e76f0427eeebcd2db236839bbd11d | mmedit/datasets/pipelines/random_down_sampling.py | python | resize_fn | (img, size, interpolation='bicubic', backend='pillow') | Resize the given image to a given size.
Args:
img (ndarray | torch.Tensor): The input image.
size (int | tuple[int]): Target size w or (w, h).
interpolation (str): Interpolation method, accepted values are
"nearest", "bilinear", "bicubic", "area", "lanczos" for 'cv2'
... | Resize the given image to a given size. | [
"Resize",
"the",
"given",
"image",
"to",
"a",
"given",
"size",
"."
] | def resize_fn(img, size, interpolation='bicubic', backend='pillow'):
"""Resize the given image to a given size.
Args:
img (ndarray | torch.Tensor): The input image.
size (int | tuple[int]): Target size w or (w, h).
interpolation (str): Interpolation method, accepted values are
... | [
"def",
"resize_fn",
"(",
"img",
",",
"size",
",",
"interpolation",
"=",
"'bicubic'",
",",
"backend",
"=",
"'pillow'",
")",
":",
"if",
"isinstance",
"(",
"size",
",",
"int",
")",
":",
"size",
"=",
"(",
"size",
",",
"size",
")",
"if",
"isinstance",
"("... | https://github.com/open-mmlab/mmediting/blob/6a08a728c63e76f0427eeebcd2db236839bbd11d/mmedit/datasets/pipelines/random_down_sampling.py#L94-L125 | ||
AppScale/gts | 46f909cf5dc5ba81faf9d81dc9af598dcf8a82a9 | AppServer/lib/django-1.5/django/contrib/syndication/views.py | python | Feed.item_extra_kwargs | (self, item) | return {} | Returns an extra keyword arguments dictionary that is used with
the `add_item` call of the feed generator. | Returns an extra keyword arguments dictionary that is used with
the `add_item` call of the feed generator. | [
"Returns",
"an",
"extra",
"keyword",
"arguments",
"dictionary",
"that",
"is",
"used",
"with",
"the",
"add_item",
"call",
"of",
"the",
"feed",
"generator",
"."
] | def item_extra_kwargs(self, item):
"""
Returns an extra keyword arguments dictionary that is used with
the `add_item` call of the feed generator.
"""
return {} | [
"def",
"item_extra_kwargs",
"(",
"self",
",",
"item",
")",
":",
"return",
"{",
"}"
] | https://github.com/AppScale/gts/blob/46f909cf5dc5ba81faf9d81dc9af598dcf8a82a9/AppServer/lib/django-1.5/django/contrib/syndication/views.py#L93-L98 | |
buke/GreenOdoo | 3d8c55d426fb41fdb3f2f5a1533cfe05983ba1df | runtime/python/lib/python2.7/site-packages/gdata/docs/service.py | python | DocumentQuery.__init__ | (self, feed='/feeds/documents', visibility='private',
projection='full', text_query=None, params=None,
categories=None) | Constructor for Document List Query
Args:
feed: string (optional) The path for the feed. (e.g. '/feeds/documents')
visibility: string (optional) The visibility chosen for the current feed.
projection: string (optional) The projection chosen for the current feed.
text_query: string (optional... | Constructor for Document List Query | [
"Constructor",
"for",
"Document",
"List",
"Query"
] | def __init__(self, feed='/feeds/documents', visibility='private',
projection='full', text_query=None, params=None,
categories=None):
"""Constructor for Document List Query
Args:
feed: string (optional) The path for the feed. (e.g. '/feeds/documents')
visibility: string (optional) The vi... | [
"def",
"__init__",
"(",
"self",
",",
"feed",
"=",
"'/feeds/documents'",
",",
"visibility",
"=",
"'private'",
",",
"projection",
"=",
"'full'",
",",
"text_query",
"=",
"None",
",",
"params",
"=",
"None",
",",
"categories",
"=",
"None",
")",
":",
"self",
"... | https://github.com/buke/GreenOdoo/blob/3d8c55d426fb41fdb3f2f5a1533cfe05983ba1df/runtime/python/lib/python2.7/site-packages/gdata/docs/service.py#L519-L543 | ||
LumaPictures/pymel | fa88a3f4fa18e09bb8aa9bdf4dab53d984bada72 | pymel/core/datatypes.py | python | EulerRotation.__imul__ | (self, other) | u.__imul__(v) <==> u *= v
Valid for EulerRotation * Matrix multiplication, in place transformation of u by Matrix v
or EulerRotation by scalar multiplication only | u.__imul__(v) <==> u *= v
Valid for EulerRotation * Matrix multiplication, in place transformation of u by Matrix v
or EulerRotation by scalar multiplication only | [
"u",
".",
"__imul__",
"(",
"v",
")",
"<",
"==",
">",
"u",
"*",
"=",
"v",
"Valid",
"for",
"EulerRotation",
"*",
"Matrix",
"multiplication",
"in",
"place",
"transformation",
"of",
"u",
"by",
"Matrix",
"v",
"or",
"EulerRotation",
"by",
"scalar",
"multiplica... | def __imul__(self, other):
""" u.__imul__(v) <==> u *= v
Valid for EulerRotation * Matrix multiplication, in place transformation of u by Matrix v
or EulerRotation by scalar multiplication only """
try:
return self.__class__(self.__mul__(other))
except:
... | [
"def",
"__imul__",
"(",
"self",
",",
"other",
")",
":",
"try",
":",
"return",
"self",
".",
"__class__",
"(",
"self",
".",
"__mul__",
"(",
"other",
")",
")",
"except",
":",
"return",
"NotImplemented"
] | https://github.com/LumaPictures/pymel/blob/fa88a3f4fa18e09bb8aa9bdf4dab53d984bada72/pymel/core/datatypes.py#L3084-L3091 | ||
mementum/backtrader | e2674b1690f6366e08646d8cfd44af7bb71b3970 | backtrader/plot/multicursor.py | python | Widget.set_active | (self, active) | Set whether the widget is active. | Set whether the widget is active. | [
"Set",
"whether",
"the",
"widget",
"is",
"active",
"."
] | def set_active(self, active):
"""Set whether the widget is active.
"""
self._active = active | [
"def",
"set_active",
"(",
"self",
",",
"active",
")",
":",
"self",
".",
"_active",
"=",
"active"
] | https://github.com/mementum/backtrader/blob/e2674b1690f6366e08646d8cfd44af7bb71b3970/backtrader/plot/multicursor.py#L73-L76 | ||
sagemath/sage | f9b2db94f675ff16963ccdefba4f1a3393b3fe0d | src/sage/interfaces/qepcad.py | python | QepcadCell.signs | (self) | return self._signs | r"""
Return the sign vector of a QEPCAD cell.
This is a list of lists.
The outer list contains one element for each level of the cell;
the inner list contains one element for each projection factor at
that level. These elements are either -1, 0, or 1.
EXAMPLES::
... | r"""
Return the sign vector of a QEPCAD cell. | [
"r",
"Return",
"the",
"sign",
"vector",
"of",
"a",
"QEPCAD",
"cell",
"."
] | def signs(self):
r"""
Return the sign vector of a QEPCAD cell.
This is a list of lists.
The outer list contains one element for each level of the cell;
the inner list contains one element for each projection factor at
that level. These elements are either -1, 0, or 1.
... | [
"def",
"signs",
"(",
"self",
")",
":",
"return",
"self",
".",
"_signs"
] | https://github.com/sagemath/sage/blob/f9b2db94f675ff16963ccdefba4f1a3393b3fe0d/src/sage/interfaces/qepcad.py#L2616-L2639 | |
rwl/PYPOWER | f5be0406aa54dcebded075de075454f99e2a46e6 | pypower/runpf.py | python | runpf | (casedata=None, ppopt=None, fname='', solvedcase='') | return results, success | Runs a power flow.
Runs a power flow [full AC Newton's method by default] and optionally
returns the solved values in the data matrices, a flag which is C{True} if
the algorithm was successful in finding a solution, and the elapsed
time in seconds. All input arguments are optional. If C{casename} is
... | Runs a power flow. | [
"Runs",
"a",
"power",
"flow",
"."
] | def runpf(casedata=None, ppopt=None, fname='', solvedcase=''):
"""Runs a power flow.
Runs a power flow [full AC Newton's method by default] and optionally
returns the solved values in the data matrices, a flag which is C{True} if
the algorithm was successful in finding a solution, and the elapsed
t... | [
"def",
"runpf",
"(",
"casedata",
"=",
"None",
",",
"ppopt",
"=",
"None",
",",
"fname",
"=",
"''",
",",
"solvedcase",
"=",
"''",
")",
":",
"## default arguments",
"if",
"casedata",
"is",
"None",
":",
"casedata",
"=",
"join",
"(",
"dirname",
"(",
"__file... | https://github.com/rwl/PYPOWER/blob/f5be0406aa54dcebded075de075454f99e2a46e6/pypower/runpf.py#L40-L322 | |
misterch0c/shadowbroker | e3a069bea47a2c1009697941ac214adc6f90aa8d | windows/Resources/Python/Core/Lib/mailbox.py | python | Maildir.remove | (self, key) | Remove the keyed message; raise KeyError if it doesn't exist. | Remove the keyed message; raise KeyError if it doesn't exist. | [
"Remove",
"the",
"keyed",
"message",
";",
"raise",
"KeyError",
"if",
"it",
"doesn",
"t",
"exist",
"."
] | def remove(self, key):
"""Remove the keyed message; raise KeyError if it doesn't exist."""
os.remove(os.path.join(self._path, self._lookup(key))) | [
"def",
"remove",
"(",
"self",
",",
"key",
")",
":",
"os",
".",
"remove",
"(",
"os",
".",
"path",
".",
"join",
"(",
"self",
".",
"_path",
",",
"self",
".",
"_lookup",
"(",
"key",
")",
")",
")"
] | https://github.com/misterch0c/shadowbroker/blob/e3a069bea47a2c1009697941ac214adc6f90aa8d/windows/Resources/Python/Core/Lib/mailbox.py#L292-L294 | ||
hzlzh/AlfredWorkflow.com | 7055f14f6922c80ea5943839eb0caff11ae57255 | Sources/Workflows/Rotten-Tomatoes/PyAl/Request/requests/packages/urllib3/packages/ordered_dict.py | python | OrderedDict.__iter__ | (self) | od.__iter__() <==> iter(od) | od.__iter__() <==> iter(od) | [
"od",
".",
"__iter__",
"()",
"<",
"==",
">",
"iter",
"(",
"od",
")"
] | def __iter__(self):
'od.__iter__() <==> iter(od)'
root = self.__root
curr = root[1]
while curr is not root:
yield curr[2]
curr = curr[1] | [
"def",
"__iter__",
"(",
"self",
")",
":",
"root",
"=",
"self",
".",
"__root",
"curr",
"=",
"root",
"[",
"1",
"]",
"while",
"curr",
"is",
"not",
"root",
":",
"yield",
"curr",
"[",
"2",
"]",
"curr",
"=",
"curr",
"[",
"1",
"]"
] | https://github.com/hzlzh/AlfredWorkflow.com/blob/7055f14f6922c80ea5943839eb0caff11ae57255/Sources/Workflows/Rotten-Tomatoes/PyAl/Request/requests/packages/urllib3/packages/ordered_dict.py#L64-L70 | ||
SafeBreach-Labs/SirepRAT | b8ef60ba40e3581ffc28441a16509ad8ffe5963d | models/commands/SirepCommand.py | python | SirepCommand.__repr__ | (self) | return pformat(self.__dict__) | Returns the instance's representation | Returns the instance's representation | [
"Returns",
"the",
"instance",
"s",
"representation"
] | def __repr__(self):
"""Returns the instance's representation"""
return pformat(self.__dict__) | [
"def",
"__repr__",
"(",
"self",
")",
":",
"return",
"pformat",
"(",
"self",
".",
"__dict__",
")"
] | https://github.com/SafeBreach-Labs/SirepRAT/blob/b8ef60ba40e3581ffc28441a16509ad8ffe5963d/models/commands/SirepCommand.py#L74-L76 | |
mcfletch/pyopengl | 02d11dad9ff18e50db10e975c4756e17bf198464 | OpenGL/GL/ARB/instanced_arrays.py | python | glInitInstancedArraysARB | () | return extensions.hasGLExtension( _EXTENSION_NAME ) | Return boolean indicating whether this extension is available | Return boolean indicating whether this extension is available | [
"Return",
"boolean",
"indicating",
"whether",
"this",
"extension",
"is",
"available"
] | def glInitInstancedArraysARB():
'''Return boolean indicating whether this extension is available'''
from OpenGL import extensions
return extensions.hasGLExtension( _EXTENSION_NAME ) | [
"def",
"glInitInstancedArraysARB",
"(",
")",
":",
"from",
"OpenGL",
"import",
"extensions",
"return",
"extensions",
".",
"hasGLExtension",
"(",
"_EXTENSION_NAME",
")"
] | https://github.com/mcfletch/pyopengl/blob/02d11dad9ff18e50db10e975c4756e17bf198464/OpenGL/GL/ARB/instanced_arrays.py#L46-L49 | |
mozilla/kitsune | 7c7cf9baed57aa776547aea744243ccad6ca91fb | kitsune/forums/models.py | python | Thread.last_page | (self) | return self.replies // forums.POSTS_PER_PAGE + 1 | Returns the page number for the last post. | Returns the page number for the last post. | [
"Returns",
"the",
"page",
"number",
"for",
"the",
"last",
"post",
"."
] | def last_page(self):
"""Returns the page number for the last post."""
return self.replies // forums.POSTS_PER_PAGE + 1 | [
"def",
"last_page",
"(",
"self",
")",
":",
"return",
"self",
".",
"replies",
"//",
"forums",
".",
"POSTS_PER_PAGE",
"+",
"1"
] | https://github.com/mozilla/kitsune/blob/7c7cf9baed57aa776547aea744243ccad6ca91fb/kitsune/forums/models.py#L131-L133 | |
secdev/scapy | 65089071da1acf54622df0b4fa7fc7673d47d3cd | scapy/utils.py | python | RawPcapNgReader._read_block_pkt | (self, block, size) | return (block[20:20 + caplen][:size],
RawPcapNgReader.PacketMetadata(linktype=self.interfaces[intid][0], # noqa: E501
tsresol=self.interfaces[intid][2], # noqa: E501
tshigh=tshigh,
... | (Obsolete) Packet Block | (Obsolete) Packet Block | [
"(",
"Obsolete",
")",
"Packet",
"Block"
] | def _read_block_pkt(self, block, size):
# type: (bytes, int) -> Tuple[bytes, RawPcapNgReader.PacketMetadata]
"""(Obsolete) Packet Block"""
try:
intid, drops, tshigh, tslow, caplen, wirelen = struct.unpack(
self.endian + "HH4I",
block[:20],
... | [
"def",
"_read_block_pkt",
"(",
"self",
",",
"block",
",",
"size",
")",
":",
"# type: (bytes, int) -> Tuple[bytes, RawPcapNgReader.PacketMetadata]",
"try",
":",
"intid",
",",
"drops",
",",
"tshigh",
",",
"tslow",
",",
"caplen",
",",
"wirelen",
"=",
"struct",
".",
... | https://github.com/secdev/scapy/blob/65089071da1acf54622df0b4fa7fc7673d47d3cd/scapy/utils.py#L1591-L1609 | |
oracle/oci-python-sdk | 3c1604e4e212008fb6718e2f68cdb5ef71fd5793 | src/oci/mysql/mysqlaas_client.py | python | MysqlaasClient.delete_configuration | (self, configuration_id, **kwargs) | Deletes a Configuration.
The Configuration must not be in use by any DB Systems.
:param str configuration_id: (required)
The OCID of the Configuration.
:param str if_match: (optional)
For optimistic concurrency control. In the PUT or DELETE call for a
resou... | Deletes a Configuration.
The Configuration must not be in use by any DB Systems. | [
"Deletes",
"a",
"Configuration",
".",
"The",
"Configuration",
"must",
"not",
"be",
"in",
"use",
"by",
"any",
"DB",
"Systems",
"."
] | def delete_configuration(self, configuration_id, **kwargs):
"""
Deletes a Configuration.
The Configuration must not be in use by any DB Systems.
:param str configuration_id: (required)
The OCID of the Configuration.
:param str if_match: (optional)
For o... | [
"def",
"delete_configuration",
"(",
"self",
",",
"configuration_id",
",",
"*",
"*",
"kwargs",
")",
":",
"resource_path",
"=",
"\"/configurations/{configurationId}\"",
"method",
"=",
"\"DELETE\"",
"# Don't accept unknown kwargs",
"expected_kwargs",
"=",
"[",
"\"retry_strat... | https://github.com/oracle/oci-python-sdk/blob/3c1604e4e212008fb6718e2f68cdb5ef71fd5793/src/oci/mysql/mysqlaas_client.py#L183-L270 | ||
kbandla/ImmunityDebugger | 2abc03fb15c8f3ed0914e1175c4d8933977c73e3 | 1.84/Libs/immlib.py | python | Debugger.isVmWare | (self) | return debugger.check_vmware() | Check if debugger is running under a vmware machine
@rtype: DWORD
@return: 1 if vmware machine exists | Check if debugger is running under a vmware machine | [
"Check",
"if",
"debugger",
"is",
"running",
"under",
"a",
"vmware",
"machine"
] | def isVmWare(self):
"""
Check if debugger is running under a vmware machine
@rtype: DWORD
@return: 1 if vmware machine exists
"""
return debugger.check_vmware() | [
"def",
"isVmWare",
"(",
"self",
")",
":",
"return",
"debugger",
".",
"check_vmware",
"(",
")"
] | https://github.com/kbandla/ImmunityDebugger/blob/2abc03fb15c8f3ed0914e1175c4d8933977c73e3/1.84/Libs/immlib.py#L1855-L1862 | |
openstack/barbican | a9d2b133c8dc3307974f119f9a2b23a4ba82e8ce | barbican/plugin/interface/certificate_manager.py | python | CertificateStatusNotSupported.__init__ | (self, status) | [] | def __init__(self, status):
super(CertificateStatusNotSupported, self).__init__(
u._("Certificate status of {status} not "
"supported").format(status=status)
)
self.status = status | [
"def",
"__init__",
"(",
"self",
",",
"status",
")",
":",
"super",
"(",
"CertificateStatusNotSupported",
",",
"self",
")",
".",
"__init__",
"(",
"u",
".",
"_",
"(",
"\"Certificate status of {status} not \"",
"\"supported\"",
")",
".",
"format",
"(",
"status",
"... | https://github.com/openstack/barbican/blob/a9d2b133c8dc3307974f119f9a2b23a4ba82e8ce/barbican/plugin/interface/certificate_manager.py#L159-L164 | ||||
Blizzard/heroprotocol | 3d36eaf44fc4c8ff3331c2ae2f1dc08a94535f1c | heroprotocol/versions/protocol76893.py | python | decode_replay_initdata | (contents) | return decoder.instance(replay_initdata_typeid) | Decodes and return the replay init data from the contents byte string. | Decodes and return the replay init data from the contents byte string. | [
"Decodes",
"and",
"return",
"the",
"replay",
"init",
"data",
"from",
"the",
"contents",
"byte",
"string",
"."
] | def decode_replay_initdata(contents):
"""Decodes and return the replay init data from the contents byte string."""
decoder = BitPackedDecoder(contents, typeinfos)
return decoder.instance(replay_initdata_typeid) | [
"def",
"decode_replay_initdata",
"(",
"contents",
")",
":",
"decoder",
"=",
"BitPackedDecoder",
"(",
"contents",
",",
"typeinfos",
")",
"return",
"decoder",
".",
"instance",
"(",
"replay_initdata_typeid",
")"
] | https://github.com/Blizzard/heroprotocol/blob/3d36eaf44fc4c8ff3331c2ae2f1dc08a94535f1c/heroprotocol/versions/protocol76893.py#L446-L449 | |
colour-science/colour | 38782ac059e8ddd91939f3432bf06811c16667f0 | colour/models/rgb/prismatic.py | python | Prismatic_to_RGB | (Lrgb) | return from_range_1(RGB) | Converts from *Prismatic* :math:`L\\rho\\gamma\\beta` colourspace array to
*RGB* colourspace.
Parameters
----------
Lrgb : array_like
*Prismatic* :math:`L\\rho\\gamma\\beta` colourspace array.
Returns
-------
ndarray
*RGB* colourspace array.
Notes
-----
+-----... | Converts from *Prismatic* :math:`L\\rho\\gamma\\beta` colourspace array to
*RGB* colourspace. | [
"Converts",
"from",
"*",
"Prismatic",
"*",
":",
"math",
":",
"L",
"\\\\",
"rho",
"\\\\",
"gamma",
"\\\\",
"beta",
"colourspace",
"array",
"to",
"*",
"RGB",
"*",
"colourspace",
"."
] | def Prismatic_to_RGB(Lrgb):
"""
Converts from *Prismatic* :math:`L\\rho\\gamma\\beta` colourspace array to
*RGB* colourspace.
Parameters
----------
Lrgb : array_like
*Prismatic* :math:`L\\rho\\gamma\\beta` colourspace array.
Returns
-------
ndarray
*RGB* colourspace... | [
"def",
"Prismatic_to_RGB",
"(",
"Lrgb",
")",
":",
"Lrgb",
"=",
"to_domain_1",
"(",
"Lrgb",
")",
"rgb",
"=",
"Lrgb",
"[",
"...",
",",
"1",
":",
"]",
"m",
"=",
"np",
".",
"max",
"(",
"rgb",
",",
"axis",
"=",
"-",
"1",
")",
"[",
"...",
",",
"np"... | https://github.com/colour-science/colour/blob/38782ac059e8ddd91939f3432bf06811c16667f0/colour/models/rgb/prismatic.py#L96-L146 | |
gramps-project/gramps | 04d4651a43eb210192f40a9f8c2bad8ee8fa3753 | gramps/gen/utils/place.py | python | __convert_structure_to_float | (sign, degs, mins=0, secs=0.0) | return -v if sign == "-" else v | helper function which converts a structure to a nice
representation | helper function which converts a structure to a nice
representation | [
"helper",
"function",
"which",
"converts",
"a",
"structure",
"to",
"a",
"nice",
"representation"
] | def __convert_structure_to_float(sign, degs, mins=0, secs=0.0):
"""helper function which converts a structure to a nice
representation
"""
v = float(degs)
if mins is not None:
v += float(mins) / 60.
if secs is not None:
v += secs / 3600.
return -v if sign == "-" else v | [
"def",
"__convert_structure_to_float",
"(",
"sign",
",",
"degs",
",",
"mins",
"=",
"0",
",",
"secs",
"=",
"0.0",
")",
":",
"v",
"=",
"float",
"(",
"degs",
")",
"if",
"mins",
"is",
"not",
"None",
":",
"v",
"+=",
"float",
"(",
"mins",
")",
"/",
"60... | https://github.com/gramps-project/gramps/blob/04d4651a43eb210192f40a9f8c2bad8ee8fa3753/gramps/gen/utils/place.py#L82-L91 | |
edisonlz/fastor | 342078a18363ac41d3c6b1ab29dbdd44fdb0b7b3 | base/site-packages/redis/client.py | python | Redis.lindex | (self, name, index) | return self.execute_command('LINDEX', name, index) | Return the item from list ``name`` at position ``index``
Negative indexes are supported and will return an item at the
end of the list | Return the item from list ``name`` at position ``index`` | [
"Return",
"the",
"item",
"from",
"list",
"name",
"at",
"position",
"index"
] | def lindex(self, name, index):
"""
Return the item from list ``name`` at position ``index``
Negative indexes are supported and will return an item at the
end of the list
"""
return self.execute_command('LINDEX', name, index) | [
"def",
"lindex",
"(",
"self",
",",
"name",
",",
"index",
")",
":",
"return",
"self",
".",
"execute_command",
"(",
"'LINDEX'",
",",
"name",
",",
"index",
")"
] | https://github.com/edisonlz/fastor/blob/342078a18363ac41d3c6b1ab29dbdd44fdb0b7b3/base/site-packages/redis/client.py#L568-L575 | |
Chaffelson/nipyapi | d3b186fd701ce308c2812746d98af9120955e810 | nipyapi/nifi/models/controller_service_referencing_component_entity.py | python | ControllerServiceReferencingComponentEntity.permissions | (self) | return self._permissions | Gets the permissions of this ControllerServiceReferencingComponentEntity.
The permissions for this component.
:return: The permissions of this ControllerServiceReferencingComponentEntity.
:rtype: PermissionsDTO | Gets the permissions of this ControllerServiceReferencingComponentEntity.
The permissions for this component. | [
"Gets",
"the",
"permissions",
"of",
"this",
"ControllerServiceReferencingComponentEntity",
".",
"The",
"permissions",
"for",
"this",
"component",
"."
] | def permissions(self):
"""
Gets the permissions of this ControllerServiceReferencingComponentEntity.
The permissions for this component.
:return: The permissions of this ControllerServiceReferencingComponentEntity.
:rtype: PermissionsDTO
"""
return self._permissi... | [
"def",
"permissions",
"(",
"self",
")",
":",
"return",
"self",
".",
"_permissions"
] | https://github.com/Chaffelson/nipyapi/blob/d3b186fd701ce308c2812746d98af9120955e810/nipyapi/nifi/models/controller_service_referencing_component_entity.py#L184-L192 | |
dbt-labs/dbt-core | e943b9fc842535e958ef4fd0b8703adc91556bc6 | core/dbt/task/list.py | python | ListTask.selection_arg | (self) | [] | def selection_arg(self):
# for backwards compatibility, list accepts both --models and --select,
# with slightly different behavior: --models implies --resource-type model
if self.args.models:
return self.args.models
else:
return self.args.select | [
"def",
"selection_arg",
"(",
"self",
")",
":",
"# for backwards compatibility, list accepts both --models and --select,",
"# with slightly different behavior: --models implies --resource-type model",
"if",
"self",
".",
"args",
".",
"models",
":",
"return",
"self",
".",
"args",
... | https://github.com/dbt-labs/dbt-core/blob/e943b9fc842535e958ef4fd0b8703adc91556bc6/core/dbt/task/list.py#L183-L189 | ||||
robotlearn/pyrobolearn | 9cd7c060723fda7d2779fa255ac998c2c82b8436 | pyrobolearn/utils/parsers/robots/data_structures.py | python | Visual.__init__ | (self, name=None, dtype=None, size=None, color=None, filename=None, position=None, orientation=None,
material_name=None, texture=None, diffuse=None, specular=None, emissive=None) | Initialize the visual shape of a body.
Args:
name (str): name of the visual shape.
dtype (str): primitive shape type.
size (list[float[:3]], str): size/dimension of the shape.
color (list[float], str): RGB(A) ambient color.
filename (str): path to the... | Initialize the visual shape of a body. | [
"Initialize",
"the",
"visual",
"shape",
"of",
"a",
"body",
"."
] | def __init__(self, name=None, dtype=None, size=None, color=None, filename=None, position=None, orientation=None,
material_name=None, texture=None, diffuse=None, specular=None, emissive=None):
"""
Initialize the visual shape of a body.
Args:
name (str): name of the v... | [
"def",
"__init__",
"(",
"self",
",",
"name",
"=",
"None",
",",
"dtype",
"=",
"None",
",",
"size",
"=",
"None",
",",
"color",
"=",
"None",
",",
"filename",
"=",
"None",
",",
"position",
"=",
"None",
",",
"orientation",
"=",
"None",
",",
"material_name... | https://github.com/robotlearn/pyrobolearn/blob/9cd7c060723fda7d2779fa255ac998c2c82b8436/pyrobolearn/utils/parsers/robots/data_structures.py#L2467-L2493 | ||
linxid/Machine_Learning_Study_Path | 558e82d13237114bbb8152483977806fc0c222af | Machine Learning In Action/Chapter5-LogisticRegression/venv/Lib/site-packages/pkg_resources/_vendor/pyparsing.py | python | ParseExpression.append | ( self, other ) | return self | [] | def append( self, other ):
self.exprs.append( other )
self.strRepr = None
return self | [
"def",
"append",
"(",
"self",
",",
"other",
")",
":",
"self",
".",
"exprs",
".",
"append",
"(",
"other",
")",
"self",
".",
"strRepr",
"=",
"None",
"return",
"self"
] | https://github.com/linxid/Machine_Learning_Study_Path/blob/558e82d13237114bbb8152483977806fc0c222af/Machine Learning In Action/Chapter5-LogisticRegression/venv/Lib/site-packages/pkg_resources/_vendor/pyparsing.py#L3242-L3245 | |||
jupyter/enterprise_gateway | 1a529b13f3d9ab94411e4751d4bd35bafd6bbc2e | enterprise_gateway/services/processproxies/container.py | python | ContainerProcessProxy.get_initial_states | (self) | Return list of states indicating container is starting (includes running). | Return list of states indicating container is starting (includes running). | [
"Return",
"list",
"of",
"states",
"indicating",
"container",
"is",
"starting",
"(",
"includes",
"running",
")",
"."
] | def get_initial_states(self):
"""Return list of states indicating container is starting (includes running)."""
raise NotImplementedError | [
"def",
"get_initial_states",
"(",
"self",
")",
":",
"raise",
"NotImplementedError"
] | https://github.com/jupyter/enterprise_gateway/blob/1a529b13f3d9ab94411e4751d4bd35bafd6bbc2e/enterprise_gateway/services/processproxies/container.py#L200-L202 | ||
kanzure/nanoengineer | 874e4c9f8a9190f093625b267f9767e19f82e6c4 | cad/src/model/chunk.py | python | Chunk._recompute_externs | (self) | return externs | Recompute self.externs, the list of external bonds of self. | Recompute self.externs, the list of external bonds of self. | [
"Recompute",
"self",
".",
"externs",
"the",
"list",
"of",
"external",
"bonds",
"of",
"self",
"."
] | def _recompute_externs(self):
"""
Recompute self.externs, the list of external bonds of self.
"""
externs = []
for atom in self.atoms.itervalues():
for bond in atom.bonds:
if bond.atom1.molecule is not self or \
bond.atom2.molecule i... | [
"def",
"_recompute_externs",
"(",
"self",
")",
":",
"externs",
"=",
"[",
"]",
"for",
"atom",
"in",
"self",
".",
"atoms",
".",
"itervalues",
"(",
")",
":",
"for",
"bond",
"in",
"atom",
".",
"bonds",
":",
"if",
"bond",
".",
"atom1",
".",
"molecule",
... | https://github.com/kanzure/nanoengineer/blob/874e4c9f8a9190f093625b267f9767e19f82e6c4/cad/src/model/chunk.py#L1646-L1656 | |
ajinabraham/OWASP-Xenotix-XSS-Exploit-Framework | cb692f527e4e819b6c228187c5702d990a180043 | external/Scripting Engine/Xenotix Python Scripting Engine/packages/IronPython.StdLib.2.7.4/content/Lib/urllib.py | python | splituser | (host) | return None, host | splituser('user[:passwd]@host[:port]') --> 'user[:passwd]', 'host[:port]'. | splituser('user[:passwd] | [
"splituser",
"(",
"user",
"[",
":",
"passwd",
"]"
] | def splituser(host):
"""splituser('user[:passwd]@host[:port]') --> 'user[:passwd]', 'host[:port]'."""
global _userprog
if _userprog is None:
import re
_userprog = re.compile('^(.*)@(.*)$')
match = _userprog.match(host)
if match: return match.group(1, 2)
return None, host | [
"def",
"splituser",
"(",
"host",
")",
":",
"global",
"_userprog",
"if",
"_userprog",
"is",
"None",
":",
"import",
"re",
"_userprog",
"=",
"re",
".",
"compile",
"(",
"'^(.*)@(.*)$'",
")",
"match",
"=",
"_userprog",
".",
"match",
"(",
"host",
")",
"if",
... | https://github.com/ajinabraham/OWASP-Xenotix-XSS-Exploit-Framework/blob/cb692f527e4e819b6c228187c5702d990a180043/external/Scripting Engine/Xenotix Python Scripting Engine/packages/IronPython.StdLib.2.7.4/content/Lib/urllib.py#L1076-L1085 | |
mortcanty/CRCPython | 35d0e9f96befd38d4a78671c868128440c74b0e6 | src/build/lib/auxil/png.py | python | Reader.__init__ | (self, _guess=None, **kw) | Create a PNG decoder object.
The constructor expects exactly one keyword argument. If you
supply a positional argument instead, it will guess the input
type. You can choose among the following keyword arguments:
filename
Name of input file (a PNG file).
file
... | Create a PNG decoder object. | [
"Create",
"a",
"PNG",
"decoder",
"object",
"."
] | def __init__(self, _guess=None, **kw):
"""
Create a PNG decoder object.
The constructor expects exactly one keyword argument. If you
supply a positional argument instead, it will guess the input
type. You can choose among the following keyword arguments:
filename
... | [
"def",
"__init__",
"(",
"self",
",",
"_guess",
"=",
"None",
",",
"*",
"*",
"kw",
")",
":",
"if",
"(",
"(",
"_guess",
"is",
"not",
"None",
"and",
"len",
"(",
"kw",
")",
"!=",
"0",
")",
"or",
"(",
"_guess",
"is",
"None",
"and",
"len",
"(",
"kw"... | https://github.com/mortcanty/CRCPython/blob/35d0e9f96befd38d4a78671c868128440c74b0e6/src/build/lib/auxil/png.py#L1078-L1122 | ||
pgmpy/pgmpy | 24279929a28082ea994c52f3d165ca63fc56b02b | pgmpy/sampling/NUTS.py | python | NoUTurnSampler.generate_sample | (self, initial_pos, num_samples, stepsize=None) | Returns a generator type object whose each iteration yields a sample
Parameters
----------
initial_pos: A 1d array like object
Vector representing values of parameter position, the starting
state in markov chain.
num_samples: int
Number of samples to... | Returns a generator type object whose each iteration yields a sample | [
"Returns",
"a",
"generator",
"type",
"object",
"whose",
"each",
"iteration",
"yields",
"a",
"sample"
] | def generate_sample(self, initial_pos, num_samples, stepsize=None):
"""
Returns a generator type object whose each iteration yields a sample
Parameters
----------
initial_pos: A 1d array like object
Vector representing values of parameter position, the starting
... | [
"def",
"generate_sample",
"(",
"self",
",",
"initial_pos",
",",
"num_samples",
",",
"stepsize",
"=",
"None",
")",
":",
"initial_pos",
"=",
"_check_1d_array_object",
"(",
"initial_pos",
",",
"\"initial_pos\"",
")",
"_check_length_equal",
"(",
"initial_pos",
",",
"s... | https://github.com/pgmpy/pgmpy/blob/24279929a28082ea994c52f3d165ca63fc56b02b/pgmpy/sampling/NUTS.py#L360-L418 | ||
LGE-ARC-AdvancedAI/auptimizer | 50f6e3b4e0cb9146ca90fd74b9b24ca97ae22617 | src/aup/compression/torch/compressor.py | python | Compressor._wrap_modules | (self, layer, config) | This method is implemented in the subclasses, i.e., `Pruner` and `Quantizer`
Parameters
----------
layer : LayerInfo
the layer to instrument the compression operation
config : dict
the configuration for compressing this layer | This method is implemented in the subclasses, i.e., `Pruner` and `Quantizer` | [
"This",
"method",
"is",
"implemented",
"in",
"the",
"subclasses",
"i",
".",
"e",
".",
"Pruner",
"and",
"Quantizer"
] | def _wrap_modules(self, layer, config):
"""
This method is implemented in the subclasses, i.e., `Pruner` and `Quantizer`
Parameters
----------
layer : LayerInfo
the layer to instrument the compression operation
config : dict
the configuration for ... | [
"def",
"_wrap_modules",
"(",
"self",
",",
"layer",
",",
"config",
")",
":",
"raise",
"NotImplementedError",
"(",
")"
] | https://github.com/LGE-ARC-AdvancedAI/auptimizer/blob/50f6e3b4e0cb9146ca90fd74b9b24ca97ae22617/src/aup/compression/torch/compressor.py#L226-L237 | ||
ansible-collections/community.general | 3faffe8f47968a2400ba3c896c8901c03001a194 | plugins/modules/clc_server_snapshot.py | python | main | () | Main function
:return: None | Main function
:return: None | [
"Main",
"function",
":",
"return",
":",
"None"
] | def main():
"""
Main function
:return: None
"""
module = AnsibleModule(
argument_spec=ClcSnapshot.define_argument_spec(),
supports_check_mode=True
)
clc_snapshot = ClcSnapshot(module)
clc_snapshot.process_request() | [
"def",
"main",
"(",
")",
":",
"module",
"=",
"AnsibleModule",
"(",
"argument_spec",
"=",
"ClcSnapshot",
".",
"define_argument_spec",
"(",
")",
",",
"supports_check_mode",
"=",
"True",
")",
"clc_snapshot",
"=",
"ClcSnapshot",
"(",
"module",
")",
"clc_snapshot",
... | https://github.com/ansible-collections/community.general/blob/3faffe8f47968a2400ba3c896c8901c03001a194/plugins/modules/clc_server_snapshot.py#L397-L407 | ||
mverleg/array_storage_benchmark | b5b7572f7c1fc0a386d36468ebc9424fece63906 | methods.py | python | sync | (fh) | This makes sure data is written to disk, so that buffering doesn't influence the timings. | This makes sure data is written to disk, so that buffering doesn't influence the timings. | [
"This",
"makes",
"sure",
"data",
"is",
"written",
"to",
"disk",
"so",
"that",
"buffering",
"doesn",
"t",
"influence",
"the",
"timings",
"."
] | def sync(fh):
"""
This makes sure data is written to disk, so that buffering doesn't influence the timings.
"""
fh.flush()
fsync(fh.fileno()) | [
"def",
"sync",
"(",
"fh",
")",
":",
"fh",
".",
"flush",
"(",
")",
"fsync",
"(",
"fh",
".",
"fileno",
"(",
")",
")"
] | https://github.com/mverleg/array_storage_benchmark/blob/b5b7572f7c1fc0a386d36468ebc9424fece63906/methods.py#L20-L25 | ||
josw123/dart-fss | 816d0fc6002aefb61912d5871af0438a6e1e7c99 | dart_fss/api/issue/bnk_mngt_pcsp.py | python | bnk_mngt_pcsp | (
corp_code: str,
bgn_de: str,
end_de: str,
api_key: str = None
) | return api_request(
api_key=api_key,
path=path,
corp_code=corp_code,
bgn_de=bgn_de,
end_de=end_de,
) | 주요사항보고서(채권은행 등의 관리절차 중단) 내에 주요 정보를 제공합니다.
Parameters
----------
corp_code: str
공시대상회사의 고유번호(8자리)※ 개발가이드 > 공시정보 > 고유번호 참고
bgn_de: str
검색시작 접수일자(YYYYMMDD) ※ 2015년 이후 부터 정보제공
end_de: str
검색종료 접수일자(YYYYMMDD) ※ 2015년 이후 부터 정보제공
api_key: str, optional
DART_API_KEY, 만약 ... | 주요사항보고서(채권은행 등의 관리절차 중단) 내에 주요 정보를 제공합니다. | [
"주요사항보고서",
"(",
"채권은행",
"등의",
"관리절차",
"중단",
")",
"내에",
"주요",
"정보를",
"제공합니다",
"."
] | def bnk_mngt_pcsp(
corp_code: str,
bgn_de: str,
end_de: str,
api_key: str = None
) -> Dict:
""" 주요사항보고서(채권은행 등의 관리절차 중단) 내에 주요 정보를 제공합니다.
Parameters
----------
corp_code: str
공시대상회사의 고유번호(8자리)※ 개발가이드 > 공시정보 > 고유번호 참고
bgn_de: str
검색시작 접수일자(YYYYMMDD) ※ 2015년 이후 부터 정보제공... | [
"def",
"bnk_mngt_pcsp",
"(",
"corp_code",
":",
"str",
",",
"bgn_de",
":",
"str",
",",
"end_de",
":",
"str",
",",
"api_key",
":",
"str",
"=",
"None",
")",
"->",
"Dict",
":",
"path",
"=",
"'/api/bnkMngtPcsp.json'",
"return",
"api_request",
"(",
"api_key",
... | https://github.com/josw123/dart-fss/blob/816d0fc6002aefb61912d5871af0438a6e1e7c99/dart_fss/api/issue/bnk_mngt_pcsp.py#L6-L38 | |
reiinakano/xcessiv | a48dff7d370c84eb5c243bde87164c1f5fd096d5 | xcessiv/functions.py | python | get_sample_dataset | (dataset_properties) | return X, y, splits | Returns sample dataset
Args:
dataset_properties (dict): Dictionary corresponding to the properties of the dataset
used to verify the estimator and metric generators.
Returns:
X (array-like): Features array
y (array-like): Labels array
splits (iterator): This is an... | Returns sample dataset | [
"Returns",
"sample",
"dataset"
] | def get_sample_dataset(dataset_properties):
"""Returns sample dataset
Args:
dataset_properties (dict): Dictionary corresponding to the properties of the dataset
used to verify the estimator and metric generators.
Returns:
X (array-like): Features array
y (array-like): ... | [
"def",
"get_sample_dataset",
"(",
"dataset_properties",
")",
":",
"kwargs",
"=",
"dataset_properties",
".",
"copy",
"(",
")",
"data_type",
"=",
"kwargs",
".",
"pop",
"(",
"'type'",
")",
"if",
"data_type",
"==",
"'multiclass'",
":",
"try",
":",
"X",
",",
"y... | https://github.com/reiinakano/xcessiv/blob/a48dff7d370c84eb5c243bde87164c1f5fd096d5/xcessiv/functions.py#L161-L201 | |
python/cpython | e13cdca0f5224ec4e23bdd04bb3120506964bc8b | Lib/email/message.py | python | Message.get_param | (self, param, failobj=None, header='content-type',
unquote=True) | return failobj | Return the parameter value if found in the Content-Type header.
Optional failobj is the object to return if there is no Content-Type
header, or the Content-Type header has no such parameter. Optional
header is the header to search instead of Content-Type.
Parameter keys are always com... | Return the parameter value if found in the Content-Type header. | [
"Return",
"the",
"parameter",
"value",
"if",
"found",
"in",
"the",
"Content",
"-",
"Type",
"header",
"."
] | def get_param(self, param, failobj=None, header='content-type',
unquote=True):
"""Return the parameter value if found in the Content-Type header.
Optional failobj is the object to return if there is no Content-Type
header, or the Content-Type header has no such parameter. Opt... | [
"def",
"get_param",
"(",
"self",
",",
"param",
",",
"failobj",
"=",
"None",
",",
"header",
"=",
"'content-type'",
",",
"unquote",
"=",
"True",
")",
":",
"if",
"header",
"not",
"in",
"self",
":",
"return",
"failobj",
"for",
"k",
",",
"v",
"in",
"self"... | https://github.com/python/cpython/blob/e13cdca0f5224ec4e23bdd04bb3120506964bc8b/Lib/email/message.py#L667-L699 | |
ubbn/wxPython | 65f9398ca50960d12b8b074bfadb778403897ed8 | Chapter-09/validator1.py | python | NotEmptyValidator.Clone | (self) | return NotEmptyValidator() | Note that every validator must implement the Clone() method. | Note that every validator must implement the Clone() method. | [
"Note",
"that",
"every",
"validator",
"must",
"implement",
"the",
"Clone",
"()",
"method",
"."
] | def Clone(self):
"""
Note that every validator must implement the Clone() method.
"""
return NotEmptyValidator() | [
"def",
"Clone",
"(",
"self",
")",
":",
"return",
"NotEmptyValidator",
"(",
")"
] | https://github.com/ubbn/wxPython/blob/65f9398ca50960d12b8b074bfadb778403897ed8/Chapter-09/validator1.py#L13-L17 | |
home-assistant/core | 265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1 | homeassistant/components/nanoleaf/light.py | python | NanoleafLight.async_added_to_hass | (self) | Handle entity being added to Home Assistant. | Handle entity being added to Home Assistant. | [
"Handle",
"entity",
"being",
"added",
"to",
"Home",
"Assistant",
"."
] | async def async_added_to_hass(self) -> None:
"""Handle entity being added to Home Assistant."""
await super().async_added_to_hass()
self.async_on_remove(
async_dispatcher_connect(
self.hass,
f"{DOMAIN}_update_light_{self._nanoleaf.serial_no}",
... | [
"async",
"def",
"async_added_to_hass",
"(",
"self",
")",
"->",
"None",
":",
"await",
"super",
"(",
")",
".",
"async_added_to_hass",
"(",
")",
"self",
".",
"async_on_remove",
"(",
"async_dispatcher_connect",
"(",
"self",
".",
"hass",
",",
"f\"{DOMAIN}_update_ligh... | https://github.com/home-assistant/core/blob/265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1/homeassistant/components/nanoleaf/light.py#L211-L220 | ||
DataDog/integrations-core | 934674b29d94b70ccc008f76ea172d0cdae05e1e | openstack_controller/datadog_checks/openstack_controller/openstack_controller.py | python | OpenStackControllerCheck.get_flavors_detail | (self, query_params) | return self._api.get_flavors_detail(query_params) | [] | def get_flavors_detail(self, query_params):
return self._api.get_flavors_detail(query_params) | [
"def",
"get_flavors_detail",
"(",
"self",
",",
"query_params",
")",
":",
"return",
"self",
".",
"_api",
".",
"get_flavors_detail",
"(",
"query_params",
")"
] | https://github.com/DataDog/integrations-core/blob/934674b29d94b70ccc008f76ea172d0cdae05e1e/openstack_controller/datadog_checks/openstack_controller/openstack_controller.py#L818-L819 | |||
google/trax | d6cae2067dedd0490b78d831033607357e975015 | trax/tf_numpy/numpy_impl/math_ops.py | python | arccosh | (x) | return _scalar(tf.math.acosh, x, True) | [] | def arccosh(x):
return _scalar(tf.math.acosh, x, True) | [
"def",
"arccosh",
"(",
"x",
")",
":",
"return",
"_scalar",
"(",
"tf",
".",
"math",
".",
"acosh",
",",
"x",
",",
"True",
")"
] | https://github.com/google/trax/blob/d6cae2067dedd0490b78d831033607357e975015/trax/tf_numpy/numpy_impl/math_ops.py#L582-L583 | |||
airbnb/knowledge-repo | 72f3bbb86a1c2a4a8bea0bcad5305b41c662b3d9 | knowledge_repo/app/routes/health.py | python | ping | () | return "OK" | Return OK when a request to the ping view is received. | Return OK when a request to the ping view is received. | [
"Return",
"OK",
"when",
"a",
"request",
"to",
"the",
"ping",
"view",
"is",
"received",
"."
] | def ping():
"""Return OK when a request to the ping view is received."""
return "OK" | [
"def",
"ping",
"(",
")",
":",
"return",
"\"OK\""
] | https://github.com/airbnb/knowledge-repo/blob/72f3bbb86a1c2a4a8bea0bcad5305b41c662b3d9/knowledge_repo/app/routes/health.py#L21-L23 | |
dmlc/gluon-cv | 709bc139919c02f7454cb411311048be188cde64 | gluoncv/utils/viz/bbox.py | python | plot_bbox | (img, bboxes, scores=None, labels=None, thresh=0.5,
class_names=None, colors=None, ax=None,
reverse_rgb=False, absolute_coordinates=True,
linewidth=3.5, fontsize=12) | return ax | Visualize bounding boxes.
Parameters
----------
img : numpy.ndarray or mxnet.nd.NDArray
Image with shape `H, W, 3`.
bboxes : numpy.ndarray or mxnet.nd.NDArray
Bounding boxes with shape `N, 4`. Where `N` is the number of boxes.
scores : numpy.ndarray or mxnet.nd.NDArray, optional
... | Visualize bounding boxes. | [
"Visualize",
"bounding",
"boxes",
"."
] | def plot_bbox(img, bboxes, scores=None, labels=None, thresh=0.5,
class_names=None, colors=None, ax=None,
reverse_rgb=False, absolute_coordinates=True,
linewidth=3.5, fontsize=12):
"""Visualize bounding boxes.
Parameters
----------
img : numpy.ndarray or mxnet.n... | [
"def",
"plot_bbox",
"(",
"img",
",",
"bboxes",
",",
"scores",
"=",
"None",
",",
"labels",
"=",
"None",
",",
"thresh",
"=",
"0.5",
",",
"class_names",
"=",
"None",
",",
"colors",
"=",
"None",
",",
"ax",
"=",
"None",
",",
"reverse_rgb",
"=",
"False",
... | https://github.com/dmlc/gluon-cv/blob/709bc139919c02f7454cb411311048be188cde64/gluoncv/utils/viz/bbox.py#L11-L112 | |
karanchahal/distiller | a17ec06cbeafcdd2aea19d7c7663033c951392f5 | models/vision/mobilenet.py | python | ConvBNReLU.__init__ | (self, in_planes, out_planes, kernel_size=3, stride=1, groups=1) | [] | def __init__(self, in_planes, out_planes, kernel_size=3, stride=1, groups=1):
padding = (kernel_size - 1) // 2
super(ConvBNReLU, self).__init__(
nn.Conv2d(in_planes, out_planes, kernel_size, stride, padding, groups=groups, bias=False),
nn.BatchNorm2d(out_planes),
nn.R... | [
"def",
"__init__",
"(",
"self",
",",
"in_planes",
",",
"out_planes",
",",
"kernel_size",
"=",
"3",
",",
"stride",
"=",
"1",
",",
"groups",
"=",
"1",
")",
":",
"padding",
"=",
"(",
"kernel_size",
"-",
"1",
")",
"//",
"2",
"super",
"(",
"ConvBNReLU",
... | https://github.com/karanchahal/distiller/blob/a17ec06cbeafcdd2aea19d7c7663033c951392f5/models/vision/mobilenet.py#L34-L40 | ||||
Nordeus/pushkin | 39f7057d3eb82c811c5c6b795d8bc7df9352a217 | pushkin/database/database.py | python | upsert_device | (login_id, platform_id, device_token, application_version, unregistered_ts=None) | return device | Add or update a device entity. Returns new or updated device with relation to login preloaded. | Add or update a device entity. Returns new or updated device with relation to login preloaded. | [
"Add",
"or",
"update",
"a",
"device",
"entity",
".",
"Returns",
"new",
"or",
"updated",
"device",
"with",
"relation",
"to",
"login",
"preloaded",
"."
] | def upsert_device(login_id, platform_id, device_token, application_version, unregistered_ts=None):
'''
Add or update a device entity. Returns new or updated device with relation to login preloaded.
'''
with session_scope() as session:
login = session.query(model.Login).filter(model.Login.id == l... | [
"def",
"upsert_device",
"(",
"login_id",
",",
"platform_id",
",",
"device_token",
",",
"application_version",
",",
"unregistered_ts",
"=",
"None",
")",
":",
"with",
"session_scope",
"(",
")",
"as",
"session",
":",
"login",
"=",
"session",
".",
"query",
"(",
... | https://github.com/Nordeus/pushkin/blob/39f7057d3eb82c811c5c6b795d8bc7df9352a217/pushkin/database/database.py#L250-L271 | |
tarbell-project/tarbell | 818b3d3623dcda5a08a5bf45550219719b0f0365 | tarbell/cli.py | python | tarbell_list | (command, args) | List tarbell projects. | List tarbell projects. | [
"List",
"tarbell",
"projects",
"."
] | def tarbell_list(command, args):
"""
List tarbell projects.
"""
with ensure_settings(command, args) as settings:
projects_path = settings.config.get("projects_path")
if not projects_path:
show_error("{0} does not exist".format(projects_path))
sys.exit()
p... | [
"def",
"tarbell_list",
"(",
"command",
",",
"args",
")",
":",
"with",
"ensure_settings",
"(",
"command",
",",
"args",
")",
"as",
"settings",
":",
"projects_path",
"=",
"settings",
".",
"config",
".",
"get",
"(",
"\"projects_path\"",
")",
"if",
"not",
"proj... | https://github.com/tarbell-project/tarbell/blob/818b3d3623dcda5a08a5bf45550219719b0f0365/tarbell/cli.py#L275-L320 | ||
beancount/beancount | cb3526a1af95b3b5be70347470c381b5a86055fe | beancount/core/account.py | python | AccountTransformer.parse | (self, transformed_name: str) | return (transformed_name
if self.rsep is None
else transformed_name.replace(self.rsep, sep)) | Convert the transform account name to an account name. | Convert the transform account name to an account name. | [
"Convert",
"the",
"transform",
"account",
"name",
"to",
"an",
"account",
"name",
"."
] | def parse(self, transformed_name: str) -> Account:
"Convert the transform account name to an account name."
return (transformed_name
if self.rsep is None
else transformed_name.replace(self.rsep, sep)) | [
"def",
"parse",
"(",
"self",
",",
"transformed_name",
":",
"str",
")",
"->",
"Account",
":",
"return",
"(",
"transformed_name",
"if",
"self",
".",
"rsep",
"is",
"None",
"else",
"transformed_name",
".",
"replace",
"(",
"self",
".",
"rsep",
",",
"sep",
")"... | https://github.com/beancount/beancount/blob/cb3526a1af95b3b5be70347470c381b5a86055fe/beancount/core/account.py#L228-L232 | |
saltstack/salt | fae5bc757ad0f1716483ce7ae180b451545c2058 | salt/modules/consul.py | python | get | (consul_url=None, key=None, token=None, recurse=False, decode=False, raw=False) | return ret | Get key from Consul
:param consul_url: The Consul server URL.
:param key: The key to use as the starting point for the list.
:param recurse: Return values recursively beginning at the value of key.
:param decode: By default values are stored as Base64 encoded values,
decode will retu... | Get key from Consul | [
"Get",
"key",
"from",
"Consul"
] | def get(consul_url=None, key=None, token=None, recurse=False, decode=False, raw=False):
"""
Get key from Consul
:param consul_url: The Consul server URL.
:param key: The key to use as the starting point for the list.
:param recurse: Return values recursively beginning at the value of key.
:para... | [
"def",
"get",
"(",
"consul_url",
"=",
"None",
",",
"key",
"=",
"None",
",",
"token",
"=",
"None",
",",
"recurse",
"=",
"False",
",",
"decode",
"=",
"False",
",",
"raw",
"=",
"False",
")",
":",
"ret",
"=",
"{",
"}",
"if",
"not",
"consul_url",
":",... | https://github.com/saltstack/salt/blob/fae5bc757ad0f1716483ce7ae180b451545c2058/salt/modules/consul.py#L156-L216 | |
openedx/edx-platform | 68dd185a0ab45862a2a61e0f803d7e03d2be71b5 | common/djangoapps/student/models.py | python | LoginFailures.clear_lockout_counter | (cls, user) | Removes the lockout counters (normally called after a successful login) | Removes the lockout counters (normally called after a successful login) | [
"Removes",
"the",
"lockout",
"counters",
"(",
"normally",
"called",
"after",
"a",
"successful",
"login",
")"
] | def clear_lockout_counter(cls, user):
"""
Removes the lockout counters (normally called after a successful login)
"""
try:
entry = cls._get_record_for_user(user)
entry.delete()
except ObjectDoesNotExist:
return | [
"def",
"clear_lockout_counter",
"(",
"cls",
",",
"user",
")",
":",
"try",
":",
"entry",
"=",
"cls",
".",
"_get_record_for_user",
"(",
"user",
")",
"entry",
".",
"delete",
"(",
")",
"except",
"ObjectDoesNotExist",
":",
"return"
] | https://github.com/openedx/edx-platform/blob/68dd185a0ab45862a2a61e0f803d7e03d2be71b5/common/djangoapps/student/models.py#L1077-L1085 | ||
gbrindisi/xsssniper | 02b59afd15efead30bdf4829b6c1356abb8731cd | core/packages/clint/packages/colorama/winterm.py | python | WinTerm.fore | (self, fore=None, on_stderr=False) | [] | def fore(self, fore=None, on_stderr=False):
if fore is None:
fore = self._default_fore
self._fore = fore
self.set_console(on_stderr=on_stderr) | [
"def",
"fore",
"(",
"self",
",",
"fore",
"=",
"None",
",",
"on_stderr",
"=",
"False",
")",
":",
"if",
"fore",
"is",
"None",
":",
"fore",
"=",
"self",
".",
"_default_fore",
"self",
".",
"_fore",
"=",
"fore",
"self",
".",
"set_console",
"(",
"on_stderr... | https://github.com/gbrindisi/xsssniper/blob/02b59afd15efead30bdf4829b6c1356abb8731cd/core/packages/clint/packages/colorama/winterm.py#L43-L47 | ||||
rhinstaller/anaconda | 63edc8680f1b05cbfe11bef28703acba808c5174 | pyanaconda/ui/tui/spokes/__init__.py | python | NormalTUISpoke._get_help | (self) | return get_help_path_for_screen(self.get_screen_id()) | Get the help path for this screen. | Get the help path for this screen. | [
"Get",
"the",
"help",
"path",
"for",
"this",
"screen",
"."
] | def _get_help(self):
"""Get the help path for this screen."""
return get_help_path_for_screen(self.get_screen_id()) | [
"def",
"_get_help",
"(",
"self",
")",
":",
"return",
"get_help_path_for_screen",
"(",
"self",
".",
"get_screen_id",
"(",
")",
")"
] | https://github.com/rhinstaller/anaconda/blob/63edc8680f1b05cbfe11bef28703acba808c5174/pyanaconda/ui/tui/spokes/__init__.py#L98-L100 | |
google-research/lottery-ticket-hypothesis | 1f17279d282e729ee29e80a2f750cfbffc4b8500 | foundations/paths.py | python | final | (parent_directory) | return os.path.join(parent_directory, 'final') | The path where the weights at the end of training are stored. | The path where the weights at the end of training are stored. | [
"The",
"path",
"where",
"the",
"weights",
"at",
"the",
"end",
"of",
"training",
"are",
"stored",
"."
] | def final(parent_directory):
"""The path where the weights at the end of training are stored."""
return os.path.join(parent_directory, 'final') | [
"def",
"final",
"(",
"parent_directory",
")",
":",
"return",
"os",
".",
"path",
".",
"join",
"(",
"parent_directory",
",",
"'final'",
")"
] | https://github.com/google-research/lottery-ticket-hypothesis/blob/1f17279d282e729ee29e80a2f750cfbffc4b8500/foundations/paths.py#L29-L31 | |
pymedusa/Medusa | 1405fbb6eb8ef4d20fcca24c32ddca52b11f0f38 | ext/boto/ec2/cloudwatch/__init__.py | python | CloudWatchConnection.put_metric_alarm | (self, alarm) | return self.get_status('PutMetricAlarm', params) | Creates or updates an alarm and associates it with the specified Amazon
CloudWatch metric. Optionally, this operation can associate one or more
Amazon Simple Notification Service resources with the alarm.
When this operation creates an alarm, the alarm state is immediately
set to INSUFF... | Creates or updates an alarm and associates it with the specified Amazon
CloudWatch metric. Optionally, this operation can associate one or more
Amazon Simple Notification Service resources with the alarm. | [
"Creates",
"or",
"updates",
"an",
"alarm",
"and",
"associates",
"it",
"with",
"the",
"specified",
"Amazon",
"CloudWatch",
"metric",
".",
"Optionally",
"this",
"operation",
"can",
"associate",
"one",
"or",
"more",
"Amazon",
"Simple",
"Notification",
"Service",
"r... | def put_metric_alarm(self, alarm):
"""
Creates or updates an alarm and associates it with the specified Amazon
CloudWatch metric. Optionally, this operation can associate one or more
Amazon Simple Notification Service resources with the alarm.
When this operation creates an alar... | [
"def",
"put_metric_alarm",
"(",
"self",
",",
"alarm",
")",
":",
"params",
"=",
"{",
"'AlarmName'",
":",
"alarm",
".",
"name",
",",
"'MetricName'",
":",
"alarm",
".",
"metric",
",",
"'Namespace'",
":",
"alarm",
".",
"namespace",
",",
"'Statistic'",
":",
"... | https://github.com/pymedusa/Medusa/blob/1405fbb6eb8ef4d20fcca24c32ddca52b11f0f38/ext/boto/ec2/cloudwatch/__init__.py#L484-L528 | |
pyscf/pyscf | 0adfb464333f5ceee07b664f291d4084801bae64 | pyscf/tools/fcidump.py | python | scf_from_fcidump | (mf, filename, molpro_orbsym=MOLPRO_ORBSYM) | return to_scf(filename, molpro_orbsym, mf) | Update the SCF object with the quantities defined in FCIDUMP file | Update the SCF object with the quantities defined in FCIDUMP file | [
"Update",
"the",
"SCF",
"object",
"with",
"the",
"quantities",
"defined",
"in",
"FCIDUMP",
"file"
] | def scf_from_fcidump(mf, filename, molpro_orbsym=MOLPRO_ORBSYM):
'''Update the SCF object with the quantities defined in FCIDUMP file'''
return to_scf(filename, molpro_orbsym, mf) | [
"def",
"scf_from_fcidump",
"(",
"mf",
",",
"filename",
",",
"molpro_orbsym",
"=",
"MOLPRO_ORBSYM",
")",
":",
"return",
"to_scf",
"(",
"filename",
",",
"molpro_orbsym",
",",
"mf",
")"
] | https://github.com/pyscf/pyscf/blob/0adfb464333f5ceee07b664f291d4084801bae64/pyscf/tools/fcidump.py#L346-L348 | |
edisonlz/fastor | 342078a18363ac41d3c6b1ab29dbdd44fdb0b7b3 | base/site-packages/redis_model/models/dattributes.py | python | find_include | (ref_klass,pks,kwargs) | search the related object from current object
param;
ref_klass:related classs
pks:primary key
**kwargs:
order_by_score: True or False
include_select_related_model:True or False
include:True or False
select_related:True or False | search the related object from current object
param;
ref_klass:related classs
pks:primary key
**kwargs:
order_by_score: True or False
include_select_related_model:True or False
include:True or False
select_related:True or False | [
"search",
"the",
"related",
"object",
"from",
"current",
"object",
"param",
";",
"ref_klass",
":",
"related",
"classs",
"pks",
":",
"primary",
"key",
"**",
"kwargs",
":",
"order_by_score",
":",
"True",
"or",
"False",
"include_select_related_model",
":",
"True",
... | def find_include(ref_klass,pks,kwargs):
"""
search the related object from current object
param;
ref_klass:related classs
pks:primary key
**kwargs:
order_by_score: True or False
include_select_related_model:True or False
include:True or False
... | [
"def",
"find_include",
"(",
"ref_klass",
",",
"pks",
",",
"kwargs",
")",
":",
"if",
"not",
"pks",
":",
"return",
"[",
"]",
"order_by_score",
"=",
"kwargs",
".",
"get",
"(",
"\"order_by_score\"",
",",
"False",
")",
"include_select_related_model",
"=",
"kwargs... | https://github.com/edisonlz/fastor/blob/342078a18363ac41d3c6b1ab29dbdd44fdb0b7b3/base/site-packages/redis_model/models/dattributes.py#L85-L159 | ||
jython/frozen-mirror | b8d7aa4cee50c0c0fe2f4b235dd62922dd0f3f99 | lib-python/2.7/xml/sax/__init__.py | python | make_parser | (parser_list = []) | Creates and returns a SAX parser.
Creates the first parser it is able to instantiate of the ones
given in the list created by doing parser_list +
default_parser_list. The lists must contain the names of Python
modules containing both a SAX parser and a create_parser function. | Creates and returns a SAX parser. | [
"Creates",
"and",
"returns",
"a",
"SAX",
"parser",
"."
] | def make_parser(parser_list = []):
"""Creates and returns a SAX parser.
Creates the first parser it is able to instantiate of the ones
given in the list created by doing parser_list +
default_parser_list. The lists must contain the names of Python
modules containing both a SAX parser and a create_... | [
"def",
"make_parser",
"(",
"parser_list",
"=",
"[",
"]",
")",
":",
"for",
"parser_name",
"in",
"parser_list",
"+",
"default_parser_list",
":",
"try",
":",
"return",
"_create_parser",
"(",
"parser_name",
")",
"except",
"ImportError",
",",
"e",
":",
"import",
... | https://github.com/jython/frozen-mirror/blob/b8d7aa4cee50c0c0fe2f4b235dd62922dd0f3f99/lib-python/2.7/xml/sax/__init__.py#L71-L93 | ||
carla-simulator/scenario_runner | f4d00d88eda4212a1e119515c96281a4be5c234e | srunner/scenarios/master_scenario.py | python | MasterScenario.__del__ | (self) | Remove all actors upon deletion | Remove all actors upon deletion | [
"Remove",
"all",
"actors",
"upon",
"deletion"
] | def __del__(self):
"""
Remove all actors upon deletion
"""
self.remove_all_actors() | [
"def",
"__del__",
"(",
"self",
")",
":",
"self",
".",
"remove_all_actors",
"(",
")"
] | https://github.com/carla-simulator/scenario_runner/blob/f4d00d88eda4212a1e119515c96281a4be5c234e/srunner/scenarios/master_scenario.py#L110-L114 | ||
CountryTk/Hydra | 7109c0bbdd12200bff12a43ac92f8a2bb6eeee35 | Hydra/widgets/Content.py | python | Content.initialize | (self, justOpened=False) | After content is loaded into the file, this function will handle jump to definition when opening a file | After content is loaded into the file, this function will handle jump to definition when opening a file | [
"After",
"content",
"is",
"loaded",
"into",
"the",
"file",
"this",
"function",
"will",
"handle",
"jump",
"to",
"definition",
"when",
"opening",
"a",
"file"
] | def initialize(self, justOpened=False):
"""
After content is loaded into the file, this function will handle jump to definition when opening a file
"""
QTest.qWait(5) # Without this, it won't work
if self.searchCommand:
self.searchFor(self.searchCommand) | [
"def",
"initialize",
"(",
"self",
",",
"justOpened",
"=",
"False",
")",
":",
"QTest",
".",
"qWait",
"(",
"5",
")",
"# Without this, it won't work",
"if",
"self",
".",
"searchCommand",
":",
"self",
".",
"searchFor",
"(",
"self",
".",
"searchCommand",
")"
] | https://github.com/CountryTk/Hydra/blob/7109c0bbdd12200bff12a43ac92f8a2bb6eeee35/Hydra/widgets/Content.py#L199-L207 | ||
statsmodels/statsmodels | debbe7ea6ba28fe5bdb78f09f8cac694bef98722 | statsmodels/base/model.py | python | Model._get_init_kwds | (self) | return kwds | return dictionary with extra keys used in model.__init__ | return dictionary with extra keys used in model.__init__ | [
"return",
"dictionary",
"with",
"extra",
"keys",
"used",
"in",
"model",
".",
"__init__"
] | def _get_init_kwds(self):
"""return dictionary with extra keys used in model.__init__
"""
kwds = dict(((key, getattr(self, key, None))
for key in self._init_keys))
return kwds | [
"def",
"_get_init_kwds",
"(",
"self",
")",
":",
"kwds",
"=",
"dict",
"(",
"(",
"(",
"key",
",",
"getattr",
"(",
"self",
",",
"key",
",",
"None",
")",
")",
"for",
"key",
"in",
"self",
".",
"_init_keys",
")",
")",
"return",
"kwds"
] | https://github.com/statsmodels/statsmodels/blob/debbe7ea6ba28fe5bdb78f09f8cac694bef98722/statsmodels/base/model.py#L108-L114 | |
natashamjaques/neural_chat | ddb977bb4602a67c460d02231e7bbf7b2cb49a97 | ParlAI/projects/memnn_feedback/agent/memnn_feedback.py | python | MemnnFeedbackAgent.batchify | (self, obs) | return xs, ys, cands, valid_inds, feedback_cands | Returns:
xs = [memories, queries, memory_lengths, query_lengths]
ys = [labels, label_lengths] (if available, else None)
cands = list of candidates for each example in batch
valid_inds = list of indices for examples with valid observations | Returns:
xs = [memories, queries, memory_lengths, query_lengths]
ys = [labels, label_lengths] (if available, else None)
cands = list of candidates for each example in batch
valid_inds = list of indices for examples with valid observations | [
"Returns",
":",
"xs",
"=",
"[",
"memories",
"queries",
"memory_lengths",
"query_lengths",
"]",
"ys",
"=",
"[",
"labels",
"label_lengths",
"]",
"(",
"if",
"available",
"else",
"None",
")",
"cands",
"=",
"list",
"of",
"candidates",
"for",
"each",
"example",
... | def batchify(self, obs):
"""Returns:
xs = [memories, queries, memory_lengths, query_lengths]
ys = [labels, label_lengths] (if available, else None)
cands = list of candidates for each example in batch
valid_inds = list of indices for examples with valid observatio... | [
"def",
"batchify",
"(",
"self",
",",
"obs",
")",
":",
"exs",
"=",
"[",
"ex",
"for",
"ex",
"in",
"obs",
"if",
"'text'",
"in",
"ex",
"]",
"valid_inds",
"=",
"[",
"i",
"for",
"i",
",",
"ex",
"in",
"enumerate",
"(",
"obs",
")",
"if",
"'text'",
"in"... | https://github.com/natashamjaques/neural_chat/blob/ddb977bb4602a67c460d02231e7bbf7b2cb49a97/ParlAI/projects/memnn_feedback/agent/memnn_feedback.py#L488-L571 | |
keikoproj/minion-manager | c4e89a5c4614f86f0e58acb919bb99cd9122c897 | cloud_provider/base.py | python | MinionManagerBase.run | (self) | return | Main method for the minion-manager functionality. | Main method for the minion-manager functionality. | [
"Main",
"method",
"for",
"the",
"minion",
"-",
"manager",
"functionality",
"."
] | def run(self):
"""Main method for the minion-manager functionality."""
return | [
"def",
"run",
"(",
"self",
")",
":",
"return"
] | https://github.com/keikoproj/minion-manager/blob/c4e89a5c4614f86f0e58acb919bb99cd9122c897/cloud_provider/base.py#L20-L22 | |
django-nonrel/django-nonrel | 4fbfe7344481a5eab8698f79207f09124310131b | django/contrib/gis/gdal/srs.py | python | SpatialReference.__getitem__ | (self, target) | Returns the value of the given string attribute node, None if the node
doesn't exist. Can also take a tuple as a parameter, (target, child),
where child is the index of the attribute in the WKT. For example:
>>> wkt = 'GEOGCS["WGS 84", DATUM["WGS_1984, ... AUTHORITY["EPSG","4326"]]')
... | Returns the value of the given string attribute node, None if the node
doesn't exist. Can also take a tuple as a parameter, (target, child),
where child is the index of the attribute in the WKT. For example: | [
"Returns",
"the",
"value",
"of",
"the",
"given",
"string",
"attribute",
"node",
"None",
"if",
"the",
"node",
"doesn",
"t",
"exist",
".",
"Can",
"also",
"take",
"a",
"tuple",
"as",
"a",
"parameter",
"(",
"target",
"child",
")",
"where",
"child",
"is",
"... | def __getitem__(self, target):
"""
Returns the value of the given string attribute node, None if the node
doesn't exist. Can also take a tuple as a parameter, (target, child),
where child is the index of the attribute in the WKT. For example:
>>> wkt = 'GEOGCS["WGS 84", DATU... | [
"def",
"__getitem__",
"(",
"self",
",",
"target",
")",
":",
"if",
"isinstance",
"(",
"target",
",",
"tuple",
")",
":",
"return",
"self",
".",
"attr_value",
"(",
"*",
"target",
")",
"else",
":",
"return",
"self",
".",
"attr_value",
"(",
"target",
")"
] | https://github.com/django-nonrel/django-nonrel/blob/4fbfe7344481a5eab8698f79207f09124310131b/django/contrib/gis/gdal/srs.py#L99-L125 | ||
CLUEbenchmark/CLUE | 5bd39732734afecb490cf18a5212e692dbf2c007 | baselines/models/ernie/run_pretraining.py | python | _decode_record | (record, name_to_features) | return example | Decodes a record to a TensorFlow example. | Decodes a record to a TensorFlow example. | [
"Decodes",
"a",
"record",
"to",
"a",
"TensorFlow",
"example",
"."
] | def _decode_record(record, name_to_features):
"""Decodes a record to a TensorFlow example."""
example = tf.parse_single_example(record, name_to_features)
# tf.Example only supports tf.int64, but the TPU only supports tf.int32.
# So cast all int64 to int32.
for name in list(example.keys()):
t = example[na... | [
"def",
"_decode_record",
"(",
"record",
",",
"name_to_features",
")",
":",
"example",
"=",
"tf",
".",
"parse_single_example",
"(",
"record",
",",
"name_to_features",
")",
"# tf.Example only supports tf.int64, but the TPU only supports tf.int32.",
"# So cast all int64 to int32."... | https://github.com/CLUEbenchmark/CLUE/blob/5bd39732734afecb490cf18a5212e692dbf2c007/baselines/models/ernie/run_pretraining.py#L391-L403 | |
praw-dev/praw | d1280b132f509ad115f3941fb55f13f979068377 | praw/util/token_manager.py | python | SQLiteTokenManager.register | (self, refresh_token) | return cursor.rowcount == 1 | Register the initial refresh token in the database.
:returns: ``True`` if ``refresh_token`` is saved to the database, otherwise,
``False`` if there is already a ``refresh_token`` for the associated
``key``. | Register the initial refresh token in the database. | [
"Register",
"the",
"initial",
"refresh",
"token",
"in",
"the",
"database",
"."
] | def register(self, refresh_token):
"""Register the initial refresh token in the database.
:returns: ``True`` if ``refresh_token`` is saved to the database, otherwise,
``False`` if there is already a ``refresh_token`` for the associated
``key``.
"""
cursor = self... | [
"def",
"register",
"(",
"self",
",",
"refresh_token",
")",
":",
"cursor",
"=",
"self",
".",
"_connection",
".",
"execute",
"(",
"\"INSERT OR IGNORE INTO tokens VALUES (?, ?, datetime('now'))\"",
",",
"(",
"self",
".",
"key",
",",
"refresh_token",
")",
",",
")",
... | https://github.com/praw-dev/praw/blob/d1280b132f509ad115f3941fb55f13f979068377/praw/util/token_manager.py#L178-L191 | |
wxWidgets/Phoenix | b2199e299a6ca6d866aa6f3d0888499136ead9d6 | wx/lib/agw/aui/auibook.py | python | AuiNotebook.GetSelection | (self) | return self._curpage | Returns the index of the currently active page, or -1 if none was selected. | Returns the index of the currently active page, or -1 if none was selected. | [
"Returns",
"the",
"index",
"of",
"the",
"currently",
"active",
"page",
"or",
"-",
"1",
"if",
"none",
"was",
"selected",
"."
] | def GetSelection(self):
""" Returns the index of the currently active page, or -1 if none was selected. """
return self._curpage | [
"def",
"GetSelection",
"(",
"self",
")",
":",
"return",
"self",
".",
"_curpage"
] | https://github.com/wxWidgets/Phoenix/blob/b2199e299a6ca6d866aa6f3d0888499136ead9d6/wx/lib/agw/aui/auibook.py#L4288-L4291 | |
triaquae/triaquae | bbabf736b3ba56a0c6498e7f04e16c13b8b8f2b9 | TriAquae/models/Centos_5.9/ecdsa/keys.py | python | SigningKey.sign_number | (self, number, entropy=None, k=None) | return sig.r, sig.s | [] | def sign_number(self, number, entropy=None, k=None):
# returns a pair of numbers
order = self.privkey.order
# privkey.sign() may raise RuntimeError in the amazingly unlikely
# (2**-192) event that r=0 or s=0, because that would leak the key.
# We could re-try with a different 'k'... | [
"def",
"sign_number",
"(",
"self",
",",
"number",
",",
"entropy",
"=",
"None",
",",
"k",
"=",
"None",
")",
":",
"# returns a pair of numbers",
"order",
"=",
"self",
".",
"privkey",
".",
"order",
"# privkey.sign() may raise RuntimeError in the amazingly unlikely",
"#... | https://github.com/triaquae/triaquae/blob/bbabf736b3ba56a0c6498e7f04e16c13b8b8f2b9/TriAquae/models/Centos_5.9/ecdsa/keys.py#L263-L280 | |||
bgreenlee/sublime-github | d89cac5c30584e163babcf2db3b8a084b3ed7b86 | lib/requests/sessions.py | python | merge_setting | (request_setting, session_setting, dict_class=OrderedDict) | return merged_setting | Determines appropriate setting for a given request, taking into account the
explicit setting on that request, and the setting in the session. If a
setting is a dictionary, they will be merged together using `dict_class` | Determines appropriate setting for a given request, taking into account the
explicit setting on that request, and the setting in the session. If a
setting is a dictionary, they will be merged together using `dict_class` | [
"Determines",
"appropriate",
"setting",
"for",
"a",
"given",
"request",
"taking",
"into",
"account",
"the",
"explicit",
"setting",
"on",
"that",
"request",
"and",
"the",
"setting",
"in",
"the",
"session",
".",
"If",
"a",
"setting",
"is",
"a",
"dictionary",
"... | def merge_setting(request_setting, session_setting, dict_class=OrderedDict):
"""
Determines appropriate setting for a given request, taking into account the
explicit setting on that request, and the setting in the session. If a
setting is a dictionary, they will be merged together using `dict_class`
... | [
"def",
"merge_setting",
"(",
"request_setting",
",",
"session_setting",
",",
"dict_class",
"=",
"OrderedDict",
")",
":",
"if",
"session_setting",
"is",
"None",
":",
"return",
"request_setting",
"if",
"request_setting",
"is",
"None",
":",
"return",
"session_setting",... | https://github.com/bgreenlee/sublime-github/blob/d89cac5c30584e163babcf2db3b8a084b3ed7b86/lib/requests/sessions.py#L37-L65 | |
kevinzakka/hypersearch | 8fddfd3a23d3f6b8401924af49bfaacebd20a409 | hyperband.py | python | Hyperband._parse_params | (self, params) | Split the user-defined params dictionary
into its different components. | Split the user-defined params dictionary
into its different components. | [
"Split",
"the",
"user",
"-",
"defined",
"params",
"dictionary",
"into",
"its",
"different",
"components",
"."
] | def _parse_params(self, params):
"""
Split the user-defined params dictionary
into its different components.
"""
self.size_params = {}
self.net_params = {}
self.optim_params = {}
self.reg_params = {}
size_filter = ["hidden"]
net_filter = [... | [
"def",
"_parse_params",
"(",
"self",
",",
"params",
")",
":",
"self",
".",
"size_params",
"=",
"{",
"}",
"self",
".",
"net_params",
"=",
"{",
"}",
"self",
".",
"optim_params",
"=",
"{",
"}",
"self",
".",
"reg_params",
"=",
"{",
"}",
"size_filter",
"=... | https://github.com/kevinzakka/hypersearch/blob/8fddfd3a23d3f6b8401924af49bfaacebd20a409/hyperband.py#L86-L111 | ||
golismero/golismero | 7d605b937e241f51c1ca4f47b20f755eeefb9d76 | thirdparty_libs/geopy/geocoders/openmapquest.py | python | OpenMapQuest.parse_json | (self, page, exactly_one=True) | Parse display name, latitude, and longitude from an JSON response. | Parse display name, latitude, and longitude from an JSON response. | [
"Parse",
"display",
"name",
"latitude",
"and",
"longitude",
"from",
"an",
"JSON",
"response",
"."
] | def parse_json(self, page, exactly_one=True):
"""Parse display name, latitude, and longitude from an JSON response."""
if not isinstance(page, basestring):
page = decode_page(page)
resources = json.loads(page)
if exactly_one and len(resources) != 1:
from ... | [
"def",
"parse_json",
"(",
"self",
",",
"page",
",",
"exactly_one",
"=",
"True",
")",
":",
"if",
"not",
"isinstance",
"(",
"page",
",",
"basestring",
")",
":",
"page",
"=",
"decode_page",
"(",
"page",
")",
"resources",
"=",
"json",
".",
"loads",
"(",
... | https://github.com/golismero/golismero/blob/7d605b937e241f51c1ca4f47b20f755eeefb9d76/thirdparty_libs/geopy/geocoders/openmapquest.py#L43-L69 | ||
WeblateOrg/weblate | 8126f3dda9d24f2846b755955132a8b8410866c8 | weblate/utils/validators.py | python | validate_bitmap | (value) | Validate bitmap, based on django.forms.fields.ImageField. | Validate bitmap, based on django.forms.fields.ImageField. | [
"Validate",
"bitmap",
"based",
"on",
"django",
".",
"forms",
".",
"fields",
".",
"ImageField",
"."
] | def validate_bitmap(value):
"""Validate bitmap, based on django.forms.fields.ImageField."""
if value is None:
return
# Ensure we have image object and content type
# Pretty much copy from django.forms.fields.ImageField:
# We need to get a file object for Pillow. We might have a path or we
... | [
"def",
"validate_bitmap",
"(",
"value",
")",
":",
"if",
"value",
"is",
"None",
":",
"return",
"# Ensure we have image object and content type",
"# Pretty much copy from django.forms.fields.ImageField:",
"# We need to get a file object for Pillow. We might have a path or we",
"# might h... | https://github.com/WeblateOrg/weblate/blob/8126f3dda9d24f2846b755955132a8b8410866c8/weblate/utils/validators.py#L88-L135 | ||
missionpinball/mpf | 8e6b74cff4ba06d2fec9445742559c1068b88582 | mpf/platforms/smartmatrix.py | python | SmartMatrixDevice.stop | (self) | Stop platform. | Stop platform. | [
"Stop",
"platform",
"."
] | def stop(self):
"""Stop platform.""" | [
"def",
"stop",
"(",
"self",
")",
":"
] | https://github.com/missionpinball/mpf/blob/8e6b74cff4ba06d2fec9445742559c1068b88582/mpf/platforms/smartmatrix.py#L127-L128 | ||
pgmpy/pgmpy | 24279929a28082ea994c52f3d165ca63fc56b02b | pgmpy/base/DAG.py | python | DAG._get_ancestors_of | (self, nodes) | return ancestors_list | Returns a dictionary of all ancestors of all the observed nodes including the
node itself.
Parameters
----------
nodes: string, list-type
name of all the observed nodes
Examples
--------
>>> from pgmpy.base import DAG
>>> model = DAG([('D', '... | Returns a dictionary of all ancestors of all the observed nodes including the
node itself. | [
"Returns",
"a",
"dictionary",
"of",
"all",
"ancestors",
"of",
"all",
"the",
"observed",
"nodes",
"including",
"the",
"node",
"itself",
"."
] | def _get_ancestors_of(self, nodes):
"""
Returns a dictionary of all ancestors of all the observed nodes including the
node itself.
Parameters
----------
nodes: string, list-type
name of all the observed nodes
Examples
--------
>>> fro... | [
"def",
"_get_ancestors_of",
"(",
"self",
",",
"nodes",
")",
":",
"if",
"not",
"isinstance",
"(",
"nodes",
",",
"(",
"list",
",",
"tuple",
")",
")",
":",
"nodes",
"=",
"[",
"nodes",
"]",
"for",
"node",
"in",
"nodes",
":",
"if",
"node",
"not",
"in",
... | https://github.com/pgmpy/pgmpy/blob/24279929a28082ea994c52f3d165ca63fc56b02b/pgmpy/base/DAG.py#L756-L790 | |
GNOME/gnome-music | b7b55c8519f9cc613ca60c01a5ab8cef6b58c92e | gnomemusic/player.py | python | PlayerPlaylist._on_repeat_mode_changed | (self, klass, param) | [] | def _on_repeat_mode_changed(self, klass, param):
# FIXME: This shuffle is too simple.
def _shuffle_sort(song_a, song_b):
return randint(-1, 1)
if self.props.repeat_mode == RepeatMode.SHUFFLE:
self._model.set_sort_func(
utils.wrap_list_store_sort_func(_shu... | [
"def",
"_on_repeat_mode_changed",
"(",
"self",
",",
"klass",
",",
"param",
")",
":",
"# FIXME: This shuffle is too simple.",
"def",
"_shuffle_sort",
"(",
"song_a",
",",
"song_b",
")",
":",
"return",
"randint",
"(",
"-",
"1",
",",
"1",
")",
"if",
"self",
".",... | https://github.com/GNOME/gnome-music/blob/b7b55c8519f9cc613ca60c01a5ab8cef6b58c92e/gnomemusic/player.py#L279-L288 | ||||
nathanlopez/Stitch | 8e22e91c94237959c02d521aab58dc7e3d994cea | Application/stitch_winshell.py | python | st_winshell.do_EOF | (self, line) | return self.stlib.EOF() | [] | def do_EOF(self, line): return self.stlib.EOF() | [
"def",
"do_EOF",
"(",
"self",
",",
"line",
")",
":",
"return",
"self",
".",
"stlib",
".",
"EOF",
"(",
")"
] | https://github.com/nathanlopez/Stitch/blob/8e22e91c94237959c02d521aab58dc7e3d994cea/Application/stitch_winshell.py#L147-L147 | |||
dipu-bd/lightnovel-crawler | eca7a71f217ce7a6b0a54d2e2afb349571871880 | sources/en/n/noveltrench.py | python | NovelTrenchCrawler.download_chapter_body | (self, chapter) | return str(contents) | Download body of a single chapter and return as clean html format. | Download body of a single chapter and return as clean html format. | [
"Download",
"body",
"of",
"a",
"single",
"chapter",
"and",
"return",
"as",
"clean",
"html",
"format",
"."
] | def download_chapter_body(self, chapter):
'''Download body of a single chapter and return as clean html format.'''
logger.info('Downloading %s', chapter['url'])
soup = self.get_soup(chapter['url'])
contents = soup.select_one('div.text-left')
for bad in contents.select('h3, .code... | [
"def",
"download_chapter_body",
"(",
"self",
",",
"chapter",
")",
":",
"logger",
".",
"info",
"(",
"'Downloading %s'",
",",
"chapter",
"[",
"'url'",
"]",
")",
"soup",
"=",
"self",
".",
"get_soup",
"(",
"chapter",
"[",
"'url'",
"]",
")",
"contents",
"=",
... | https://github.com/dipu-bd/lightnovel-crawler/blob/eca7a71f217ce7a6b0a54d2e2afb349571871880/sources/en/n/noveltrench.py#L78-L87 | |
tensorflow/agents | 1407001d242f7f77fb9407f9b1ac78bcd8f73a09 | tf_agents/policies/gaussian_policy.py | python | GaussianPolicy.__init__ | (self,
wrapped_policy: tf_policy.TFPolicy,
scale: types.Float = 1.,
clip: bool = True,
name: Optional[Text] = None) | Builds an GaussianPolicy wrapping wrapped_policy.
Args:
wrapped_policy: A policy to wrap and add OU noise to.
scale: Stddev of the Gaussian distribution from which noise is drawn.
clip: Whether to clip actions to spec. Default True.
name: The name of this policy. | Builds an GaussianPolicy wrapping wrapped_policy. | [
"Builds",
"an",
"GaussianPolicy",
"wrapping",
"wrapped_policy",
"."
] | def __init__(self,
wrapped_policy: tf_policy.TFPolicy,
scale: types.Float = 1.,
clip: bool = True,
name: Optional[Text] = None):
"""Builds an GaussianPolicy wrapping wrapped_policy.
Args:
wrapped_policy: A policy to wrap and add OU noise to.
... | [
"def",
"__init__",
"(",
"self",
",",
"wrapped_policy",
":",
"tf_policy",
".",
"TFPolicy",
",",
"scale",
":",
"types",
".",
"Float",
"=",
"1.",
",",
"clip",
":",
"bool",
"=",
"True",
",",
"name",
":",
"Optional",
"[",
"Text",
"]",
"=",
"None",
")",
... | https://github.com/tensorflow/agents/blob/1407001d242f7f77fb9407f9b1ac78bcd8f73a09/tf_agents/policies/gaussian_policy.py#L38-L74 | ||
facebookresearch/pyrobot | 27ffd64bbb7ce3ff6ec4b2122d84b438d5641d0f | robots/LoCoBot/locobot_calibration/scripts/solve_for_calibration_params.py | python | get_correspondence | (arm_pose_ids, pts) | return mask, pts_full | Use the arm_pose_ids to determine which corners actually corresspond to
one another. Returns an expanded matrix, and a mask that determines which
points should be used for computing the loss. | Use the arm_pose_ids to determine which corners actually corresspond to
one another. Returns an expanded matrix, and a mask that determines which
points should be used for computing the loss. | [
"Use",
"the",
"arm_pose_ids",
"to",
"determine",
"which",
"corners",
"actually",
"corresspond",
"to",
"one",
"another",
".",
"Returns",
"an",
"expanded",
"matrix",
"and",
"a",
"mask",
"that",
"determines",
"which",
"points",
"should",
"be",
"used",
"for",
"com... | def get_correspondence(arm_pose_ids, pts):
"""Use the arm_pose_ids to determine which corners actually corresspond to
one another. Returns an expanded matrix, and a mask that determines which
points should be used for computing the loss."""
u_pts, ids = np.unique(arm_pose_ids, return_inverse=True)
n... | [
"def",
"get_correspondence",
"(",
"arm_pose_ids",
",",
"pts",
")",
":",
"u_pts",
",",
"ids",
"=",
"np",
".",
"unique",
"(",
"arm_pose_ids",
",",
"return_inverse",
"=",
"True",
")",
"n_pts",
"=",
"u_pts",
".",
"size",
"*",
"4",
"mask",
"=",
"np",
".",
... | https://github.com/facebookresearch/pyrobot/blob/27ffd64bbb7ce3ff6ec4b2122d84b438d5641d0f/robots/LoCoBot/locobot_calibration/scripts/solve_for_calibration_params.py#L699-L711 | |
kennethreitz-archive/requests3 | 69eb662703b40db58fdc6c095d0fe130c56649bb | requests3/core/_http/_backends/twisted_backend.py | python | TwistedSocket.__init__ | (self, protocol) | [] | def __init__(self, protocol):
self._protocol = protocol | [
"def",
"__init__",
"(",
"self",
",",
"protocol",
")",
":",
"self",
".",
"_protocol",
"=",
"protocol"
] | https://github.com/kennethreitz-archive/requests3/blob/69eb662703b40db58fdc6c095d0fe130c56649bb/requests3/core/_http/_backends/twisted_backend.py#L169-L170 | ||||
home-assistant-libs/pytradfri | ef2614b0ccdf628abc3b9559dc00b95ec6e4bd72 | pytradfri/smart_task.py | python | StartActionItem.dimmer | (self) | return self.raw.get(ATTR_LIGHT_DIMMER) | Return dimmer level. | Return dimmer level. | [
"Return",
"dimmer",
"level",
"."
] | def dimmer(self):
"""Return dimmer level."""
return self.raw.get(ATTR_LIGHT_DIMMER) | [
"def",
"dimmer",
"(",
"self",
")",
":",
"return",
"self",
".",
"raw",
".",
"get",
"(",
"ATTR_LIGHT_DIMMER",
")"
] | https://github.com/home-assistant-libs/pytradfri/blob/ef2614b0ccdf628abc3b9559dc00b95ec6e4bd72/pytradfri/smart_task.py#L259-L261 | |
IntelAI/models | 1d7a53ccfad3e6f0e7378c9e3c8840895d63df8c | models/language_translation/tensorflow/transformer_mlperf/training/bfloat16/transformer/data_download.py | python | find_file | (path, filename, max_depth=5) | return None | Returns full filepath if the file is in path or a subdirectory. | Returns full filepath if the file is in path or a subdirectory. | [
"Returns",
"full",
"filepath",
"if",
"the",
"file",
"is",
"in",
"path",
"or",
"a",
"subdirectory",
"."
] | def find_file(path, filename, max_depth=5):
"""Returns full filepath if the file is in path or a subdirectory."""
for root, dirs, files in os.walk(path):
if filename in files:
return os.path.join(root, filename)
# Don't search past max_depth
depth = root[len(path) + 1:].count(os.sep)
if depth... | [
"def",
"find_file",
"(",
"path",
",",
"filename",
",",
"max_depth",
"=",
"5",
")",
":",
"for",
"root",
",",
"dirs",
",",
"files",
"in",
"os",
".",
"walk",
"(",
"path",
")",
":",
"if",
"filename",
"in",
"files",
":",
"return",
"os",
".",
"path",
"... | https://github.com/IntelAI/models/blob/1d7a53ccfad3e6f0e7378c9e3c8840895d63df8c/models/language_translation/tensorflow/transformer_mlperf/training/bfloat16/transformer/data_download.py#L86-L96 | |
angr/angr | 4b04d56ace135018083d36d9083805be8146688b | angr/state_plugins/unicorn_engine.py | python | Unicorn._concretize | (self, d) | return cd | [] | def _concretize(self, d):
cd = self.state.solver.eval_to_ast(d, 1)[0]
if hash(d) not in self._concretized_asts:
constraint = (d == cd).annotate(AggressiveConcretizationAnnotation(self.state.regs.ip))
self.state.add_constraints(constraint)
self._concretized_asts.add(ha... | [
"def",
"_concretize",
"(",
"self",
",",
"d",
")",
":",
"cd",
"=",
"self",
".",
"state",
".",
"solver",
".",
"eval_to_ast",
"(",
"d",
",",
"1",
")",
"[",
"0",
"]",
"if",
"hash",
"(",
"d",
")",
"not",
"in",
"self",
".",
"_concretized_asts",
":",
... | https://github.com/angr/angr/blob/4b04d56ace135018083d36d9083805be8146688b/angr/state_plugins/unicorn_engine.py#L780-L786 | |||
YaoZeyuan/ZhihuHelp_archived | a0e4a7acd4512452022ce088fff2adc6f8d30195 | src/lib/requests/packages/chardet/chardistribution.py | python | CharDistributionAnalysis.feed | (self, aBuf, aCharLen) | feed a character with known length | feed a character with known length | [
"feed",
"a",
"character",
"with",
"known",
"length"
] | def feed(self, aBuf, aCharLen):
"""feed a character with known length"""
if aCharLen == 2:
# we only care about 2-bytes character in our distribution analysis
order = self.get_order(aBuf)
else:
order = -1
if order >= 0:
self._mTotalChars +=... | [
"def",
"feed",
"(",
"self",
",",
"aBuf",
",",
"aCharLen",
")",
":",
"if",
"aCharLen",
"==",
"2",
":",
"# we only care about 2-bytes character in our distribution analysis",
"order",
"=",
"self",
".",
"get_order",
"(",
"aBuf",
")",
"else",
":",
"order",
"=",
"-... | https://github.com/YaoZeyuan/ZhihuHelp_archived/blob/a0e4a7acd4512452022ce088fff2adc6f8d30195/src/lib/requests/packages/chardet/chardistribution.py#L68-L80 | ||
pympler/pympler | 8019a883eec547d91ecda6ba12669d4f4504c625 | pympler/util/bottle.py | python | BaseRequest.script_name | (self) | return '/' + script_name + '/' if script_name else '/' | The initial portion of the URL's `path` that was removed by a higher
level (server or routing middleware) before the application was
called. This script path is returned with leading and tailing
slashes. | The initial portion of the URL's `path` that was removed by a higher
level (server or routing middleware) before the application was
called. This script path is returned with leading and tailing
slashes. | [
"The",
"initial",
"portion",
"of",
"the",
"URL",
"s",
"path",
"that",
"was",
"removed",
"by",
"a",
"higher",
"level",
"(",
"server",
"or",
"routing",
"middleware",
")",
"before",
"the",
"application",
"was",
"called",
".",
"This",
"script",
"path",
"is",
... | def script_name(self):
''' The initial portion of the URL's `path` that was removed by a higher
level (server or routing middleware) before the application was
called. This script path is returned with leading and tailing
slashes. '''
script_name = self.environ.get('S... | [
"def",
"script_name",
"(",
"self",
")",
":",
"script_name",
"=",
"self",
".",
"environ",
".",
"get",
"(",
"'SCRIPT_NAME'",
",",
"''",
")",
".",
"strip",
"(",
"'/'",
")",
"return",
"'/'",
"+",
"script_name",
"+",
"'/'",
"if",
"script_name",
"else",
"'/'... | https://github.com/pympler/pympler/blob/8019a883eec547d91ecda6ba12669d4f4504c625/pympler/util/bottle.py#L1287-L1293 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.