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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
home-assistant-libs/pytradfri | ef2614b0ccdf628abc3b9559dc00b95ec6e4bd72 | pytradfri/group.py | python | Group.remove_member | (self, memberid) | return self._gateway.remove_group_member(
{ATTR_GROUP_ID: self.id, ATTR_ID: [memberid]}
) | Remove a member from this group. | Remove a member from this group. | [
"Remove",
"a",
"member",
"from",
"this",
"group",
"."
] | def remove_member(self, memberid):
"""Remove a member from this group."""
return self._gateway.remove_group_member(
{ATTR_GROUP_ID: self.id, ATTR_ID: [memberid]}
) | [
"def",
"remove_member",
"(",
"self",
",",
"memberid",
")",
":",
"return",
"self",
".",
"_gateway",
".",
"remove_group_member",
"(",
"{",
"ATTR_GROUP_ID",
":",
"self",
".",
"id",
",",
"ATTR_ID",
":",
"[",
"memberid",
"]",
"}",
")"
] | https://github.com/home-assistant-libs/pytradfri/blob/ef2614b0ccdf628abc3b9559dc00b95ec6e4bd72/pytradfri/group.py#L83-L87 | |
openstack/swift | b8d7c3dcb817504dcc0959ba52cc4ed2cf66c100 | swift/proxy/controllers/obj.py | python | ObjectControllerRouter.register | (cls, policy_type) | return register_wrapper | Decorator for Storage Policy implementations to register
their ObjectController implementations.
This also fills in a policy_type attribute on the class. | Decorator for Storage Policy implementations to register
their ObjectController implementations. | [
"Decorator",
"for",
"Storage",
"Policy",
"implementations",
"to",
"register",
"their",
"ObjectController",
"implementations",
"."
] | def register(cls, policy_type):
"""
Decorator for Storage Policy implementations to register
their ObjectController implementations.
This also fills in a policy_type attribute on the class.
"""
def register_wrapper(controller_cls):
if policy_type in cls.polic... | [
"def",
"register",
"(",
"cls",
",",
"policy_type",
")",
":",
"def",
"register_wrapper",
"(",
"controller_cls",
")",
":",
"if",
"policy_type",
"in",
"cls",
".",
"policy_type_to_controller_map",
":",
"raise",
"PolicyError",
"(",
"'%r is already registered for the policy... | https://github.com/openstack/swift/blob/b8d7c3dcb817504dcc0959ba52cc4ed2cf66c100/swift/proxy/controllers/obj.py#L136-L152 | |
weewx/weewx | cb594fce224560bd8696050fc5c7843c7839320e | bin/weecfg/database.py | python | CalcMissing._progress | (message, overprint=True) | Utility function to show our progress. | Utility function to show our progress. | [
"Utility",
"function",
"to",
"show",
"our",
"progress",
"."
] | def _progress(message, overprint=True):
"""Utility function to show our progress."""
if overprint:
print(message + "\r", end='')
else:
print(message)
sys.stdout.flush() | [
"def",
"_progress",
"(",
"message",
",",
"overprint",
"=",
"True",
")",
":",
"if",
"overprint",
":",
"print",
"(",
"message",
"+",
"\"\\r\"",
",",
"end",
"=",
"''",
")",
"else",
":",
"print",
"(",
"message",
")",
"sys",
".",
"stdout",
".",
"flush",
... | https://github.com/weewx/weewx/blob/cb594fce224560bd8696050fc5c7843c7839320e/bin/weecfg/database.py#L576-L583 | ||
msracver/Deformable-ConvNets | 6aeda878a95bcb55eadffbe125804e730574de8d | lib/rpn/rpn.py | python | assign_anchor | (feat_shape, gt_boxes, im_info, cfg, feat_stride=16,
scales=(8, 16, 32), ratios=(0.5, 1, 2), allowed_border=0) | return label | assign ground truth boxes to anchor positions
:param feat_shape: infer output shape
:param gt_boxes: assign ground truth
:param im_info: filter out anchors overlapped with edges
:param feat_stride: anchor position step
:param scales: used to generate anchors, affects num_anchors (per location)
:... | assign ground truth boxes to anchor positions
:param feat_shape: infer output shape
:param gt_boxes: assign ground truth
:param im_info: filter out anchors overlapped with edges
:param feat_stride: anchor position step
:param scales: used to generate anchors, affects num_anchors (per location)
:... | [
"assign",
"ground",
"truth",
"boxes",
"to",
"anchor",
"positions",
":",
"param",
"feat_shape",
":",
"infer",
"output",
"shape",
":",
"param",
"gt_boxes",
":",
"assign",
"ground",
"truth",
":",
"param",
"im_info",
":",
"filter",
"out",
"anchors",
"overlapped",
... | def assign_anchor(feat_shape, gt_boxes, im_info, cfg, feat_stride=16,
scales=(8, 16, 32), ratios=(0.5, 1, 2), allowed_border=0):
"""
assign ground truth boxes to anchor positions
:param feat_shape: infer output shape
:param gt_boxes: assign ground truth
:param im_info: filter out a... | [
"def",
"assign_anchor",
"(",
"feat_shape",
",",
"gt_boxes",
",",
"im_info",
",",
"cfg",
",",
"feat_stride",
"=",
"16",
",",
"scales",
"=",
"(",
"8",
",",
"16",
",",
"32",
")",
",",
"ratios",
"=",
"(",
"0.5",
",",
"1",
",",
"2",
")",
",",
"allowed... | https://github.com/msracver/Deformable-ConvNets/blob/6aeda878a95bcb55eadffbe125804e730574de8d/lib/rpn/rpn.py#L78-L241 | |
SanPen/GridCal | d3f4566d2d72c11c7e910c9d162538ef0e60df31 | src/GridCal/Engine/Devices/upfc.py | python | UPFC.plot_profiles | (self, time_series=None, my_index=0, show_fig=True) | Plot the time series results of this object
:param time_series: TimeSeries Instance
:param my_index: index of this object in the simulation
:param show_fig: Show the figure? | Plot the time series results of this object
:param time_series: TimeSeries Instance
:param my_index: index of this object in the simulation
:param show_fig: Show the figure? | [
"Plot",
"the",
"time",
"series",
"results",
"of",
"this",
"object",
":",
"param",
"time_series",
":",
"TimeSeries",
"Instance",
":",
"param",
"my_index",
":",
"index",
"of",
"this",
"object",
"in",
"the",
"simulation",
":",
"param",
"show_fig",
":",
"Show",
... | def plot_profiles(self, time_series=None, my_index=0, show_fig=True):
"""
Plot the time series results of this object
:param time_series: TimeSeries Instance
:param my_index: index of this object in the simulation
:param show_fig: Show the figure?
"""
if time_ser... | [
"def",
"plot_profiles",
"(",
"self",
",",
"time_series",
"=",
"None",
",",
"my_index",
"=",
"0",
",",
"show_fig",
"=",
"True",
")",
":",
"if",
"time_series",
"is",
"not",
"None",
":",
"fig",
"=",
"plt",
".",
"figure",
"(",
"figsize",
"=",
"(",
"12",
... | https://github.com/SanPen/GridCal/blob/d3f4566d2d72c11c7e910c9d162538ef0e60df31/src/GridCal/Engine/Devices/upfc.py#L235-L269 | ||
pyqt/examples | 843bb982917cecb2350b5f6d7f42c9b7fb142ec1 | src/pyqt-official/ipc/sharedmemory/sharedmemory.py | python | Dialog.loadFromMemory | (self) | This slot function is called in the second Dialog process, when the
user presses the "Load Image from Shared Memory" button. First, it
attaches the process to the shared memory segment created by the first
Dialog process. Then it locks the segment for exclusive access, copies
the image... | This slot function is called in the second Dialog process, when the
user presses the "Load Image from Shared Memory" button. First, it
attaches the process to the shared memory segment created by the first
Dialog process. Then it locks the segment for exclusive access, copies
the image... | [
"This",
"slot",
"function",
"is",
"called",
"in",
"the",
"second",
"Dialog",
"process",
"when",
"the",
"user",
"presses",
"the",
"Load",
"Image",
"from",
"Shared",
"Memory",
"button",
".",
"First",
"it",
"attaches",
"the",
"process",
"to",
"the",
"shared",
... | def loadFromMemory(self):
""" This slot function is called in the second Dialog process, when the
user presses the "Load Image from Shared Memory" button. First, it
attaches the process to the shared memory segment created by the first
Dialog process. Then it locks the segment for excl... | [
"def",
"loadFromMemory",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"sharedMemory",
".",
"attach",
"(",
")",
":",
"self",
".",
"ui",
".",
"label",
".",
"setText",
"(",
"\"Unable to attach to shared memory segment.\\nLoad an \"",
"\"image first.\"",
")",
"r... | https://github.com/pyqt/examples/blob/843bb982917cecb2350b5f6d7f42c9b7fb142ec1/src/pyqt-official/ipc/sharedmemory/sharedmemory.py#L135-L162 | ||
IJDykeman/wangTiles | 7c1ee2095ebdf7f72bce07d94c6484915d5cae8b | experimental_code/tiles_3d/venv_mac/lib/python2.7/site-packages/pip/_vendor/distlib/wheel.py | python | Wheel.build | (self, paths, tags=None, wheel_version=None) | return pathname | Build a wheel from files in specified paths, and use any specified tags
when determining the name of the wheel. | Build a wheel from files in specified paths, and use any specified tags
when determining the name of the wheel. | [
"Build",
"a",
"wheel",
"from",
"files",
"in",
"specified",
"paths",
"and",
"use",
"any",
"specified",
"tags",
"when",
"determining",
"the",
"name",
"of",
"the",
"wheel",
"."
] | def build(self, paths, tags=None, wheel_version=None):
"""
Build a wheel from files in specified paths, and use any specified tags
when determining the name of the wheel.
"""
if tags is None:
tags = {}
libkey = list(filter(lambda o: o in paths, ('purelib', 'p... | [
"def",
"build",
"(",
"self",
",",
"paths",
",",
"tags",
"=",
"None",
",",
"wheel_version",
"=",
"None",
")",
":",
"if",
"tags",
"is",
"None",
":",
"tags",
"=",
"{",
"}",
"libkey",
"=",
"list",
"(",
"filter",
"(",
"lambda",
"o",
":",
"o",
"in",
... | https://github.com/IJDykeman/wangTiles/blob/7c1ee2095ebdf7f72bce07d94c6484915d5cae8b/experimental_code/tiles_3d/venv_mac/lib/python2.7/site-packages/pip/_vendor/distlib/wheel.py#L326-L428 | |
ifwe/digsby | f5fe00244744aa131e07f09348d10563f3d8fa99 | digsby/lib/pyxmpp/jabber/dataforms.py | python | Form.__init__ | (self, xmlnode_or_type = "form", title = None, instructions = None,
fields = None, reported_fields = None, items = None, strict=True) | Initialize a `Form` object.
:Parameters:
- `xmlnode_or_type`: XML element to parse or a form title.
- `title`: form title.
- `instructions`: instructions for the form.
- `fields`: form fields.
- `reported_fields`: fields reported in multi-item data.
... | Initialize a `Form` object. | [
"Initialize",
"a",
"Form",
"object",
"."
] | def __init__(self, xmlnode_or_type = "form", title = None, instructions = None,
fields = None, reported_fields = None, items = None, strict=True):
"""Initialize a `Form` object.
:Parameters:
- `xmlnode_or_type`: XML element to parse or a form title.
- `title`: form t... | [
"def",
"__init__",
"(",
"self",
",",
"xmlnode_or_type",
"=",
"\"form\"",
",",
"title",
"=",
"None",
",",
"instructions",
"=",
"None",
",",
"fields",
"=",
"None",
",",
"reported_fields",
"=",
"None",
",",
"items",
"=",
"None",
",",
"strict",
"=",
"True",
... | https://github.com/ifwe/digsby/blob/f5fe00244744aa131e07f09348d10563f3d8fa99/digsby/lib/pyxmpp/jabber/dataforms.py#L490-L528 | ||
stevearc/dql | 9666cfba19773c20c7b4be29adc7d6179cf00d44 | dql/cli.py | python | DQLClient.completedefault | (self, text, line, *_) | Autocomplete table names in queries | Autocomplete table names in queries | [
"Autocomplete",
"table",
"names",
"in",
"queries"
] | def completedefault(self, text, line, *_):
"""Autocomplete table names in queries"""
tokens = line.split()
try:
before = tokens[-2]
complete = before.lower() in ("from", "update", "table", "into")
if tokens[0].lower() == "dump":
complete = True... | [
"def",
"completedefault",
"(",
"self",
",",
"text",
",",
"line",
",",
"*",
"_",
")",
":",
"tokens",
"=",
"line",
".",
"split",
"(",
")",
"try",
":",
"before",
"=",
"tokens",
"[",
"-",
"2",
"]",
"complete",
"=",
"before",
".",
"lower",
"(",
")",
... | https://github.com/stevearc/dql/blob/9666cfba19773c20c7b4be29adc7d6179cf00d44/dql/cli.py#L704-L719 | ||
moloch--/RootTheBox | 097272332b9f9b7e2df31ca0823ed10c7b66ac81 | handlers/BaseHandlers.py | python | BaseHandler.head | (self, *args, **kwargs) | Ignore it | Ignore it | [
"Ignore",
"it"
] | def head(self, *args, **kwargs):
""" Ignore it """
logging.warning("%s attempted to use HEAD method" % self.request.remote_ip) | [
"def",
"head",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"logging",
".",
"warning",
"(",
"\"%s attempted to use HEAD method\"",
"%",
"self",
".",
"request",
".",
"remote_ip",
")"
] | https://github.com/moloch--/RootTheBox/blob/097272332b9f9b7e2df31ca0823ed10c7b66ac81/handlers/BaseHandlers.py#L228-L230 | ||
openshift/openshift-tools | 1188778e728a6e4781acf728123e5b356380fe6f | openshift/installer/vendored/openshift-ansible-3.9.14-1/roles/lib_utils/filter_plugins/oo_filters.py | python | lib_utils_oo_dict_to_list_of_dict | (data, key_title='key', value_title='value') | return rval | Take a dict and arrange them as a list of dicts
Input data:
{'region': 'infra', 'test_k': 'test_v'}
Return data:
[{'key': 'region', 'value': 'infra'}, {'key': 'test_k', 'value': 'test_v'}]
Written for use of the oc_label module | Take a dict and arrange them as a list of dicts | [
"Take",
"a",
"dict",
"and",
"arrange",
"them",
"as",
"a",
"list",
"of",
"dicts"
] | def lib_utils_oo_dict_to_list_of_dict(data, key_title='key', value_title='value'):
"""Take a dict and arrange them as a list of dicts
Input data:
{'region': 'infra', 'test_k': 'test_v'}
Return data:
[{'key': 'region', 'value': 'infra'}, {'key': 'test_k', 'value': 'test_v'}]
Wri... | [
"def",
"lib_utils_oo_dict_to_list_of_dict",
"(",
"data",
",",
"key_title",
"=",
"'key'",
",",
"value_title",
"=",
"'value'",
")",
":",
"if",
"not",
"isinstance",
"(",
"data",
",",
"dict",
")",
":",
"# pylint: disable=line-too-long",
"raise",
"errors",
".",
"Ansi... | https://github.com/openshift/openshift-tools/blob/1188778e728a6e4781acf728123e5b356380fe6f/openshift/installer/vendored/openshift-ansible-3.9.14-1/roles/lib_utils/filter_plugins/oo_filters.py#L193-L212 | |
freqtrade/freqtrade-strategies | 484569e9c9b662c37563f5490162a0692675162d | user_data/strategies/Strategy002.py | python | Strategy002.populate_sell_trend | (self, dataframe: DataFrame, metadata: dict) | return dataframe | Based on TA indicators, populates the sell signal for the given dataframe
:param dataframe: DataFrame
:return: DataFrame with buy column | Based on TA indicators, populates the sell signal for the given dataframe
:param dataframe: DataFrame
:return: DataFrame with buy column | [
"Based",
"on",
"TA",
"indicators",
"populates",
"the",
"sell",
"signal",
"for",
"the",
"given",
"dataframe",
":",
"param",
"dataframe",
":",
"DataFrame",
":",
"return",
":",
"DataFrame",
"with",
"buy",
"column"
] | def populate_sell_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
"""
Based on TA indicators, populates the sell signal for the given dataframe
:param dataframe: DataFrame
:return: DataFrame with buy column
"""
dataframe.loc[
(
... | [
"def",
"populate_sell_trend",
"(",
"self",
",",
"dataframe",
":",
"DataFrame",
",",
"metadata",
":",
"dict",
")",
"->",
"DataFrame",
":",
"dataframe",
".",
"loc",
"[",
"(",
"(",
"dataframe",
"[",
"'sar'",
"]",
">",
"dataframe",
"[",
"'close'",
"]",
")",
... | https://github.com/freqtrade/freqtrade-strategies/blob/484569e9c9b662c37563f5490162a0692675162d/user_data/strategies/Strategy002.py#L123-L135 | |
yuanwenq/dailyfresh | d834f01a8ec15f880302009e8ffb1eaf0b99177b | apps/order/views.py | python | CheckPayView.post | (self, request) | 查询支付结果 | 查询支付结果 | [
"查询支付结果"
] | def post(self, request):
"""查询支付结果"""
# 用户是否登录
user = request.user
if not user.is_authenticated():
return JsonResponse({'res': 0, 'errmsg': '用户未邓丽'})
# 接收参数
order_id = request.POST.get('order_id')
# 校验参数
if not order_id:
return Js... | [
"def",
"post",
"(",
"self",
",",
"request",
")",
":",
"# 用户是否登录",
"user",
"=",
"request",
".",
"user",
"if",
"not",
"user",
".",
"is_authenticated",
"(",
")",
":",
"return",
"JsonResponse",
"(",
"{",
"'res'",
":",
"0",
",",
"'errmsg'",
":",
"'用户未邓丽'})"... | https://github.com/yuanwenq/dailyfresh/blob/d834f01a8ec15f880302009e8ffb1eaf0b99177b/apps/order/views.py#L389-L475 | ||
stanford-mast/nn_dataflow | 198a5274b9529125c6aa2b8b72b365d60cf83778 | nn_dataflow/tools/nn_dataflow_search.py | python | argparser | () | return ap | Argument parser. | Argument parser. | [
"Argument",
"parser",
"."
] | def argparser():
''' Argument parser. '''
ap = argparse.ArgumentParser()
ap.add_argument('net',
help='network name, should be a .py file under "nns". '
'Choices: {}.'.format(', '.join(all_networks())))
ap.add_argument('--batch', type=int, required=True,
... | [
"def",
"argparser",
"(",
")",
":",
"ap",
"=",
"argparse",
".",
"ArgumentParser",
"(",
")",
"ap",
".",
"add_argument",
"(",
"'net'",
",",
"help",
"=",
"'network name, should be a .py file under \"nns\". '",
"'Choices: {}.'",
".",
"format",
"(",
"', '",
".",
"join... | https://github.com/stanford-mast/nn_dataflow/blob/198a5274b9529125c6aa2b8b72b365d60cf83778/nn_dataflow/tools/nn_dataflow_search.py#L210-L316 | |
mu-editor/mu | 5a5d7723405db588f67718a63a0ec0ecabebae33 | mu/modes/pyboard.py | python | PyboardMode.workspace_dir | (self) | Return the default location on the filesystem for opening and closing
files. | Return the default location on the filesystem for opening and closing
files. | [
"Return",
"the",
"default",
"location",
"on",
"the",
"filesystem",
"for",
"opening",
"and",
"closing",
"files",
"."
] | def workspace_dir(self):
"""
Return the default location on the filesystem for opening and closing
files.
"""
device_dir = None
# Attempts to find the path on the filesystem that represents the
# plugged in Pyboard board.
if os.name == "posix":
... | [
"def",
"workspace_dir",
"(",
"self",
")",
":",
"device_dir",
"=",
"None",
"# Attempts to find the path on the filesystem that represents the",
"# plugged in Pyboard board.",
"if",
"os",
".",
"name",
"==",
"\"posix\"",
":",
"# We're on Linux or OSX",
"for",
"mount_command",
... | https://github.com/mu-editor/mu/blob/5a5d7723405db588f67718a63a0ec0ecabebae33/mu/modes/pyboard.py#L104-L188 | ||
gkrizek/bash-lambda-layer | 703b0ade8174022d44779d823172ab7ac33a5505 | bin/docutils/nodes.py | python | NodeVisitor.dispatch_visit | (self, node) | return method(node) | Call self."``visit_`` + node class name" with `node` as
parameter. If the ``visit_...`` method does not exist, call
self.unknown_visit. | Call self."``visit_`` + node class name" with `node` as
parameter. If the ``visit_...`` method does not exist, call
self.unknown_visit. | [
"Call",
"self",
".",
"visit_",
"+",
"node",
"class",
"name",
"with",
"node",
"as",
"parameter",
".",
"If",
"the",
"visit_",
"...",
"method",
"does",
"not",
"exist",
"call",
"self",
".",
"unknown_visit",
"."
] | def dispatch_visit(self, node):
"""
Call self."``visit_`` + node class name" with `node` as
parameter. If the ``visit_...`` method does not exist, call
self.unknown_visit.
"""
node_name = node.__class__.__name__
method = getattr(self, 'visit_' + node_name, self.u... | [
"def",
"dispatch_visit",
"(",
"self",
",",
"node",
")",
":",
"node_name",
"=",
"node",
".",
"__class__",
".",
"__name__",
"method",
"=",
"getattr",
"(",
"self",
",",
"'visit_'",
"+",
"node_name",
",",
"self",
".",
"unknown_visit",
")",
"self",
".",
"docu... | https://github.com/gkrizek/bash-lambda-layer/blob/703b0ade8174022d44779d823172ab7ac33a5505/bin/docutils/nodes.py#L1871-L1882 | |
openshift/openshift-tools | 1188778e728a6e4781acf728123e5b356380fe6f | openshift/installer/vendored/openshift-ansible-3.11.28-1/roles/lib_vendored_deps/library/oc_serviceaccount_secret.py | python | Yedit.update | (self, path, value, index=None, curr_value=None) | return (False, self.yaml_dict) | put path, value into a dict | put path, value into a dict | [
"put",
"path",
"value",
"into",
"a",
"dict"
] | def update(self, path, value, index=None, curr_value=None):
''' put path, value into a dict '''
try:
entry = Yedit.get_entry(self.yaml_dict, path, self.separator)
except KeyError:
entry = None
if isinstance(entry, dict):
# AUDIT:maybe-no-member makes ... | [
"def",
"update",
"(",
"self",
",",
"path",
",",
"value",
",",
"index",
"=",
"None",
",",
"curr_value",
"=",
"None",
")",
":",
"try",
":",
"entry",
"=",
"Yedit",
".",
"get_entry",
"(",
"self",
".",
"yaml_dict",
",",
"path",
",",
"self",
".",
"separa... | https://github.com/openshift/openshift-tools/blob/1188778e728a6e4781acf728123e5b356380fe6f/openshift/installer/vendored/openshift-ansible-3.11.28-1/roles/lib_vendored_deps/library/oc_serviceaccount_secret.py#L541-L586 | |
appinho/SARosPerceptionKitti | 148683b23bef294762ced937e4386501e56c8d64 | pre_processing/kitti2bag.py | python | inv | (transform) | return transform_inv | Invert rigid body transformation matrix | Invert rigid body transformation matrix | [
"Invert",
"rigid",
"body",
"transformation",
"matrix"
] | def inv(transform):
"Invert rigid body transformation matrix"
R = transform[0:3, 0:3]
t = transform[0:3, 3]
t_inv = -1 * R.T.dot(t)
transform_inv = np.eye(4)
transform_inv[0:3, 0:3] = R.T
transform_inv[0:3, 3] = t_inv
return transform_inv | [
"def",
"inv",
"(",
"transform",
")",
":",
"R",
"=",
"transform",
"[",
"0",
":",
"3",
",",
"0",
":",
"3",
"]",
"t",
"=",
"transform",
"[",
"0",
":",
"3",
",",
"3",
"]",
"t_inv",
"=",
"-",
"1",
"*",
"R",
".",
"T",
".",
"dot",
"(",
"t",
")... | https://github.com/appinho/SARosPerceptionKitti/blob/148683b23bef294762ced937e4386501e56c8d64/pre_processing/kitti2bag.py#L211-L219 | |
ocelma/python-recsys | 6c6343c6f57271e745773ab6aefea0a5d29f0620 | recsys/datamodel/data.py | python | Data.get | (self) | return self._data | :returns: a list of tuples | :returns: a list of tuples | [
":",
"returns",
":",
"a",
"list",
"of",
"tuples"
] | def get(self):
"""
:returns: a list of tuples
"""
return self._data | [
"def",
"get",
"(",
"self",
")",
":",
"return",
"self",
".",
"_data"
] | https://github.com/ocelma/python-recsys/blob/6c6343c6f57271e745773ab6aefea0a5d29f0620/recsys/datamodel/data.py#L50-L54 | |
TencentCloud/tencentcloud-sdk-python | 3677fd1cdc8c5fd626ce001c13fd3b59d1f279d2 | tencentcloud/cpdp/v20190820/cpdp_client.py | python | CpdpClient.CheckAcct | (self, request) | 商户绑定提现银行卡的验证接口
:param request: Request instance for CheckAcct.
:type request: :class:`tencentcloud.cpdp.v20190820.models.CheckAcctRequest`
:rtype: :class:`tencentcloud.cpdp.v20190820.models.CheckAcctResponse` | 商户绑定提现银行卡的验证接口 | [
"商户绑定提现银行卡的验证接口"
] | def CheckAcct(self, request):
"""商户绑定提现银行卡的验证接口
:param request: Request instance for CheckAcct.
:type request: :class:`tencentcloud.cpdp.v20190820.models.CheckAcctRequest`
:rtype: :class:`tencentcloud.cpdp.v20190820.models.CheckAcctResponse`
"""
try:
params ... | [
"def",
"CheckAcct",
"(",
"self",
",",
"request",
")",
":",
"try",
":",
"params",
"=",
"request",
".",
"_serialize",
"(",
")",
"body",
"=",
"self",
".",
"call",
"(",
"\"CheckAcct\"",
",",
"params",
")",
"response",
"=",
"json",
".",
"loads",
"(",
"bod... | https://github.com/TencentCloud/tencentcloud-sdk-python/blob/3677fd1cdc8c5fd626ce001c13fd3b59d1f279d2/tencentcloud/cpdp/v20190820/cpdp_client.py#L428-L453 | ||
openshift/openshift-tools | 1188778e728a6e4781acf728123e5b356380fe6f | openshift/installer/vendored/openshift-ansible-3.9.14-1/roles/lib_vendored_deps/library/oc_pvc.py | python | Utils.get_resource_file | (sfile, sfile_type='yaml') | return contents | return the service file | return the service file | [
"return",
"the",
"service",
"file"
] | def get_resource_file(sfile, sfile_type='yaml'):
''' return the service file '''
contents = None
with open(sfile) as sfd:
contents = sfd.read()
if sfile_type == 'yaml':
# AUDIT:no-member makes sense here due to ruamel.YAML/PyYAML usage
# pylint: disab... | [
"def",
"get_resource_file",
"(",
"sfile",
",",
"sfile_type",
"=",
"'yaml'",
")",
":",
"contents",
"=",
"None",
"with",
"open",
"(",
"sfile",
")",
"as",
"sfd",
":",
"contents",
"=",
"sfd",
".",
"read",
"(",
")",
"if",
"sfile_type",
"==",
"'yaml'",
":",
... | https://github.com/openshift/openshift-tools/blob/1188778e728a6e4781acf728123e5b356380fe6f/openshift/installer/vendored/openshift-ansible-3.9.14-1/roles/lib_vendored_deps/library/oc_pvc.py#L1270-L1286 | |
reviewboard/reviewboard | 7395902e4c181bcd1d633f61105012ffb1d18e1b | reviewboard/admin/context_processors.py | python | read_only | (request) | return {
'is_read_only': is_site_read_only_for(request.user),
'read_only_message': siteconfig.get('read_only_message', ''),
} | Return a dictionary with the read-only state.
Args:
request (django.http.HttpRequest):
The current HTTP request.
Returns:
dict:
State to add to the context. | Return a dictionary with the read-only state. | [
"Return",
"a",
"dictionary",
"with",
"the",
"read",
"-",
"only",
"state",
"."
] | def read_only(request):
"""Return a dictionary with the read-only state.
Args:
request (django.http.HttpRequest):
The current HTTP request.
Returns:
dict:
State to add to the context.
"""
siteconfig = SiteConfiguration.objects.get_current()
return {
... | [
"def",
"read_only",
"(",
"request",
")",
":",
"siteconfig",
"=",
"SiteConfiguration",
".",
"objects",
".",
"get_current",
"(",
")",
"return",
"{",
"'is_read_only'",
":",
"is_site_read_only_for",
"(",
"request",
".",
"user",
")",
",",
"'read_only_message'",
":",
... | https://github.com/reviewboard/reviewboard/blob/7395902e4c181bcd1d633f61105012ffb1d18e1b/reviewboard/admin/context_processors.py#L11-L27 | |
happinesslz/TANet | 2d4b2ab99b8e57c03671b0f1531eab7dca8f3c1f | second.pytorch_with_TANet/second/script.py | python | eval_multi_threshold | () | [] | def eval_multi_threshold():
config_path = "./configs/car.fhd.config"
ckpt_name = "/path/to/your/model_ckpt" # don't forget to change this.
assert "/path/to/your" not in ckpt_name
config = pipeline_pb2.TrainEvalPipelineConfig()
with open(config_path, "r") as f:
proto_str = f.read()
te... | [
"def",
"eval_multi_threshold",
"(",
")",
":",
"config_path",
"=",
"\"./configs/car.fhd.config\"",
"ckpt_name",
"=",
"\"/path/to/your/model_ckpt\"",
"# don't forget to change this.",
"assert",
"\"/path/to/your\"",
"not",
"in",
"ckpt_name",
"config",
"=",
"pipeline_pb2",
".",
... | https://github.com/happinesslz/TANet/blob/2d4b2ab99b8e57c03671b0f1531eab7dca8f3c1f/second.pytorch_with_TANet/second/script.py#L24-L43 | ||||
nvaccess/nvda | 20d5a25dced4da34338197f0ef6546270ebca5d0 | source/NVDAObjects/__init__.py | python | NVDAObject._get_role | (self) | return controlTypes.Role.UNKNOWN | The role or type of control this object represents (example: button, list, dialog). | The role or type of control this object represents (example: button, list, dialog). | [
"The",
"role",
"or",
"type",
"of",
"control",
"this",
"object",
"represents",
"(",
"example",
":",
"button",
"list",
"dialog",
")",
"."
] | def _get_role(self) -> controlTypes.Role:
"""The role or type of control this object represents (example: button, list, dialog).
"""
return controlTypes.Role.UNKNOWN | [
"def",
"_get_role",
"(",
"self",
")",
"->",
"controlTypes",
".",
"Role",
":",
"return",
"controlTypes",
".",
"Role",
".",
"UNKNOWN"
] | https://github.com/nvaccess/nvda/blob/20d5a25dced4da34338197f0ef6546270ebca5d0/source/NVDAObjects/__init__.py#L434-L437 | |
DIYer22/boxx | d271bc375a33e01e616a0f74ce028e6d77d1820e | boxx/tool/toolStructObj.py | python | _SliceToInt.__getitem__ | (self, index) | return int(round(index)) | [] | def __getitem__(self, index):
def f(t):
if isinstance(t, tuple):
return tuple(f(i) for i in t)
else:
if isinstance(t, slice):
return self.__intSlice(t)
if isinstance(t, float):
return int(round(t))
... | [
"def",
"__getitem__",
"(",
"self",
",",
"index",
")",
":",
"def",
"f",
"(",
"t",
")",
":",
"if",
"isinstance",
"(",
"t",
",",
"tuple",
")",
":",
"return",
"tuple",
"(",
"f",
"(",
"i",
")",
"for",
"i",
"in",
"t",
")",
"else",
":",
"if",
"isins... | https://github.com/DIYer22/boxx/blob/d271bc375a33e01e616a0f74ce028e6d77d1820e/boxx/tool/toolStructObj.py#L43-L55 | |||
wistbean/learn_python3_spider | 73c873f4845f4385f097e5057407d03dd37a117b | stackoverflow/venv/lib/python3.6/site-packages/twisted/persisted/dirdbm.py | python | DirDBM.__delitem__ | (self, k) | C{del dirdbm[foo]}
Delete a file in this directory.
@type k: bytes
@param k: key to delete
@raise KeyError: Raised when there is no such key | C{del dirdbm[foo]}
Delete a file in this directory. | [
"C",
"{",
"del",
"dirdbm",
"[",
"foo",
"]",
"}",
"Delete",
"a",
"file",
"in",
"this",
"directory",
"."
] | def __delitem__(self, k):
"""
C{del dirdbm[foo]}
Delete a file in this directory.
@type k: bytes
@param k: key to delete
@raise KeyError: Raised when there is no such key
"""
if not type(k) == bytes:
raise TypeError("DirDBM key must be bytes"... | [
"def",
"__delitem__",
"(",
"self",
",",
"k",
")",
":",
"if",
"not",
"type",
"(",
"k",
")",
"==",
"bytes",
":",
"raise",
"TypeError",
"(",
"\"DirDBM key must be bytes\"",
")",
"k",
"=",
"self",
".",
"_encode",
"(",
"k",
")",
"try",
":",
"self",
".",
... | https://github.com/wistbean/learn_python3_spider/blob/73c873f4845f4385f097e5057407d03dd37a117b/stackoverflow/venv/lib/python3.6/site-packages/twisted/persisted/dirdbm.py#L177-L193 | ||
jgagneastro/coffeegrindsize | 22661ebd21831dba4cf32bfc6ba59fe3d49f879c | App/dist/coffeegrindsize.app/Contents/Resources/lib/python3.7/matplotlib/patches.py | python | FancyArrowPatch.get_mutation_scale | (self) | return self._mutation_scale | Return the mutation scale.
Returns
-------
scale : scalar | Return the mutation scale. | [
"Return",
"the",
"mutation",
"scale",
"."
] | def get_mutation_scale(self):
"""
Return the mutation scale.
Returns
-------
scale : scalar
"""
return self._mutation_scale | [
"def",
"get_mutation_scale",
"(",
"self",
")",
":",
"return",
"self",
".",
"_mutation_scale"
] | https://github.com/jgagneastro/coffeegrindsize/blob/22661ebd21831dba4cf32bfc6ba59fe3d49f879c/App/dist/coffeegrindsize.app/Contents/Resources/lib/python3.7/matplotlib/patches.py#L4195-L4203 | |
ctxis/canape | 5f0e03424577296bcc60c2008a60a98ec5307e4b | CANAPE.Scripting/Lib/ssl.py | python | SSLSocket.do_handshake | (self) | Perform a TLS/SSL handshake. | Perform a TLS/SSL handshake. | [
"Perform",
"a",
"TLS",
"/",
"SSL",
"handshake",
"."
] | def do_handshake(self):
"""Perform a TLS/SSL handshake."""
self._sslobj.do_handshake() | [
"def",
"do_handshake",
"(",
"self",
")",
":",
"self",
".",
"_sslobj",
".",
"do_handshake",
"(",
")"
] | https://github.com/ctxis/canape/blob/5f0e03424577296bcc60c2008a60a98ec5307e4b/CANAPE.Scripting/Lib/ssl.py#L292-L296 | ||
NoGameNoLife00/mybolg | afe17ea5bfe405e33766e5682c43a4262232ee12 | libs/sqlalchemy/connectors/zxJDBC.py | python | ZxJDBCConnector._driver_kwargs | (self) | return {} | Return kw arg dict to be sent to connect(). | Return kw arg dict to be sent to connect(). | [
"Return",
"kw",
"arg",
"dict",
"to",
"be",
"sent",
"to",
"connect",
"()",
"."
] | def _driver_kwargs(self):
"""Return kw arg dict to be sent to connect()."""
return {} | [
"def",
"_driver_kwargs",
"(",
"self",
")",
":",
"return",
"{",
"}"
] | https://github.com/NoGameNoLife00/mybolg/blob/afe17ea5bfe405e33766e5682c43a4262232ee12/libs/sqlalchemy/connectors/zxJDBC.py#L31-L33 | |
tendenci/tendenci | 0f2c348cc0e7d41bc56f50b00ce05544b083bf1d | tendenci/libs/model_report/report.py | python | ReportAdmin._get_grouper_text | (self, groupby_field, value) | return value | [] | def _get_grouper_text(self, groupby_field, value):
try:
model_field = [mfield for mfield, field in self.model_fields if field == groupby_field][0]
except:
model_field = None
value = self.get_grouper_text(value, groupby_field, model_field)
if value is None or str(v... | [
"def",
"_get_grouper_text",
"(",
"self",
",",
"groupby_field",
",",
"value",
")",
":",
"try",
":",
"model_field",
"=",
"[",
"mfield",
"for",
"mfield",
",",
"field",
"in",
"self",
".",
"model_fields",
"if",
"field",
"==",
"groupby_field",
"]",
"[",
"0",
"... | https://github.com/tendenci/tendenci/blob/0f2c348cc0e7d41bc56f50b00ce05544b083bf1d/tendenci/libs/model_report/report.py#L378-L389 | |||
EricZgw/PyramidBox | 03f67d8422f2f03e5ee580e2f92d4040c24bbdb4 | nets/np_methods.py | python | bboxes_nms_fast | (classes, scores, bboxes, nms_threshold=0.45) | return classes[keep], scores[keep], bboxes[keep] | Apply non-maximum selection to bounding boxes. | Apply non-maximum selection to bounding boxes. | [
"Apply",
"non",
"-",
"maximum",
"selection",
"to",
"bounding",
"boxes",
"."
] | def bboxes_nms_fast(classes, scores, bboxes, nms_threshold=0.45):
"""Apply non-maximum selection to bounding boxes.
"""
y1 = bboxes[:, 0]
x1 = bboxes[:, 1]
y2 = bboxes[:, 2]
x2 = bboxes[:, 3]
areas = (x2 - x1 ) * (y2 - y1 )
order = scores.argsort()[::-1]
keep = []
... | [
"def",
"bboxes_nms_fast",
"(",
"classes",
",",
"scores",
",",
"bboxes",
",",
"nms_threshold",
"=",
"0.45",
")",
":",
"y1",
"=",
"bboxes",
"[",
":",
",",
"0",
"]",
"x1",
"=",
"bboxes",
"[",
":",
",",
"1",
"]",
"y2",
"=",
"bboxes",
"[",
":",
",",
... | https://github.com/EricZgw/PyramidBox/blob/03f67d8422f2f03e5ee580e2f92d4040c24bbdb4/nets/np_methods.py#L235-L263 | |
jgagneastro/coffeegrindsize | 22661ebd21831dba4cf32bfc6ba59fe3d49f879c | App/dist/coffeegrindsize.app/Contents/Resources/lib/python3.7/pandas/io/pytables.py | python | IndexCol.is_indexed | (self) | return whether I am an indexed column | return whether I am an indexed column | [
"return",
"whether",
"I",
"am",
"an",
"indexed",
"column"
] | def is_indexed(self):
""" return whether I am an indexed column """
try:
return getattr(self.table.cols, self.cname).is_indexed
except AttributeError:
False | [
"def",
"is_indexed",
"(",
"self",
")",
":",
"try",
":",
"return",
"getattr",
"(",
"self",
".",
"table",
".",
"cols",
",",
"self",
".",
"cname",
")",
".",
"is_indexed",
"except",
"AttributeError",
":",
"False"
] | https://github.com/jgagneastro/coffeegrindsize/blob/22661ebd21831dba4cf32bfc6ba59fe3d49f879c/App/dist/coffeegrindsize.app/Contents/Resources/lib/python3.7/pandas/io/pytables.py#L1612-L1617 | ||
cltk/cltk | 1a8c2f5ef72389e2579dfce1fa5af8e59ebc9ec1 | src/cltk/phonology/non/utils.py | python | Vowel.match | (self, abstract_vowel) | [] | def match(self, abstract_vowel):
if isinstance(abstract_vowel, AbstractVowel):
res = True
if abstract_vowel.height is not None:
res = res and abstract_vowel.height == self.height
if abstract_vowel.backness is not None:
res = res and abstract_vo... | [
"def",
"match",
"(",
"self",
",",
"abstract_vowel",
")",
":",
"if",
"isinstance",
"(",
"abstract_vowel",
",",
"AbstractVowel",
")",
":",
"res",
"=",
"True",
"if",
"abstract_vowel",
".",
"height",
"is",
"not",
"None",
":",
"res",
"=",
"res",
"and",
"abstr... | https://github.com/cltk/cltk/blob/1a8c2f5ef72389e2579dfce1fa5af8e59ebc9ec1/src/cltk/phonology/non/utils.py#L254-L269 | ||||
eliben/pykaleidoscope | 977d234e7bffb01e3dc91f6dd862bb03ada1063b | chapter7and8.py | python | TestParser._flatten | (self, ast) | Test helper - flattens the AST into a sexpr-like nested list. | Test helper - flattens the AST into a sexpr-like nested list. | [
"Test",
"helper",
"-",
"flattens",
"the",
"AST",
"into",
"a",
"sexpr",
"-",
"like",
"nested",
"list",
"."
] | def _flatten(self, ast):
"""Test helper - flattens the AST into a sexpr-like nested list."""
if isinstance(ast, NumberExprAST):
return ['Number', ast.val]
elif isinstance(ast, VariableExprAST):
return ['Variable', ast.name]
elif isinstance(ast, UnaryExprAST):
... | [
"def",
"_flatten",
"(",
"self",
",",
"ast",
")",
":",
"if",
"isinstance",
"(",
"ast",
",",
"NumberExprAST",
")",
":",
"return",
"[",
"'Number'",
",",
"ast",
".",
"val",
"]",
"elif",
"isinstance",
"(",
"ast",
",",
"VariableExprAST",
")",
":",
"return",
... | https://github.com/eliben/pykaleidoscope/blob/977d234e7bffb01e3dc91f6dd862bb03ada1063b/chapter7and8.py#L988-L1011 | ||
scikit-learn/scikit-learn | 1d1aadd0711b87d2a11c80aad15df6f8cf156712 | sklearn/linear_model/_least_angle.py | python | lars_path | (
X,
y,
Xy=None,
*,
Gram=None,
max_iter=500,
alpha_min=0,
method="lar",
copy_X=True,
eps=np.finfo(float).eps,
copy_Gram=True,
verbose=0,
return_path=True,
return_n_iter=False,
positive=False,
) | return _lars_path_solver(
X=X,
y=y,
Xy=Xy,
Gram=Gram,
n_samples=None,
max_iter=max_iter,
alpha_min=alpha_min,
method=method,
copy_X=copy_X,
eps=eps,
copy_Gram=copy_Gram,
verbose=verbose,
return_path=return_path,
... | Compute Least Angle Regression or Lasso path using LARS algorithm [1]
The optimization objective for the case method='lasso' is::
(1 / (2 * n_samples)) * ||y - Xw||^2_2 + alpha * ||w||_1
in the case of method='lars', the objective function is only known in
the form of an implicit equation (see discus... | Compute Least Angle Regression or Lasso path using LARS algorithm [1] | [
"Compute",
"Least",
"Angle",
"Regression",
"or",
"Lasso",
"path",
"using",
"LARS",
"algorithm",
"[",
"1",
"]"
] | def lars_path(
X,
y,
Xy=None,
*,
Gram=None,
max_iter=500,
alpha_min=0,
method="lar",
copy_X=True,
eps=np.finfo(float).eps,
copy_Gram=True,
verbose=0,
return_path=True,
return_n_iter=False,
positive=False,
):
"""Compute Least Angle Regression or Lasso path ... | [
"def",
"lars_path",
"(",
"X",
",",
"y",
",",
"Xy",
"=",
"None",
",",
"*",
",",
"Gram",
"=",
"None",
",",
"max_iter",
"=",
"500",
",",
"alpha_min",
"=",
"0",
",",
"method",
"=",
"\"lar\"",
",",
"copy_X",
"=",
"True",
",",
"eps",
"=",
"np",
".",
... | https://github.com/scikit-learn/scikit-learn/blob/1d1aadd0711b87d2a11c80aad15df6f8cf156712/sklearn/linear_model/_least_angle.py#L35-L188 | |
Tinkoff/Nginx-builder | 1c8bbd1e51bf6e856b3756f59aa911a3687b3138 | src/builder.py | python | repair_keys | (block) | return repaired_keys_dict | Преобразованиие формата названий параметров
:param block:
:return repaired_keys_dict: | Преобразованиие формата названий параметров
:param block:
:return repaired_keys_dict: | [
"Преобразованиие",
"формата",
"названий",
"параметров",
":",
"param",
"block",
":",
":",
"return",
"repaired_keys_dict",
":"
] | def repair_keys(block):
"""
Преобразованиие формата названий параметров
:param block:
:return repaired_keys_dict:
"""
repaired_keys_dict = OrderedDict()
for block_part in block:
repaired_keys = OrderedDict()
for key in block_part:
z = ''.join(x for x in key.title(... | [
"def",
"repair_keys",
"(",
"block",
")",
":",
"repaired_keys_dict",
"=",
"OrderedDict",
"(",
")",
"for",
"block_part",
"in",
"block",
":",
"repaired_keys",
"=",
"OrderedDict",
"(",
")",
"for",
"key",
"in",
"block_part",
":",
"z",
"=",
"''",
".",
"join",
... | https://github.com/Tinkoff/Nginx-builder/blob/1c8bbd1e51bf6e856b3756f59aa911a3687b3138/src/builder.py#L233-L248 | |
oilshell/oil | 94388e7d44a9ad879b12615f6203b38596b5a2d3 | Python-2.7.13/Lib/lib-tk/Tix.py | python | HList.item_cget | (self, entry, col, opt) | return self.tk.call(self._w, 'item', 'cget', entry, col, opt) | [] | def item_cget(self, entry, col, opt):
return self.tk.call(self._w, 'item', 'cget', entry, col, opt) | [
"def",
"item_cget",
"(",
"self",
",",
"entry",
",",
"col",
",",
"opt",
")",
":",
"return",
"self",
".",
"tk",
".",
"call",
"(",
"self",
".",
"_w",
",",
"'item'",
",",
"'cget'",
",",
"entry",
",",
"col",
",",
"opt",
")"
] | https://github.com/oilshell/oil/blob/94388e7d44a9ad879b12615f6203b38596b5a2d3/Python-2.7.13/Lib/lib-tk/Tix.py#L1008-L1009 | |||
gothinkster/flask-realworld-example-app | 4b95fb2227dfeb5dd1a45d89b2bf48630b93fd28 | conduit/extensions.py | python | CRUDMixin.delete | (self, commit=True) | return commit and db.session.commit() | Remove the record from the database. | Remove the record from the database. | [
"Remove",
"the",
"record",
"from",
"the",
"database",
"."
] | def delete(self, commit=True):
"""Remove the record from the database."""
db.session.delete(self)
return commit and db.session.commit() | [
"def",
"delete",
"(",
"self",
",",
"commit",
"=",
"True",
")",
":",
"db",
".",
"session",
".",
"delete",
"(",
"self",
")",
"return",
"commit",
"and",
"db",
".",
"session",
".",
"commit",
"(",
")"
] | https://github.com/gothinkster/flask-realworld-example-app/blob/4b95fb2227dfeb5dd1a45d89b2bf48630b93fd28/conduit/extensions.py#L34-L37 | |
cbfinn/gps | 82fa6cc930c4392d55d2525f6b792089f1d2ccfe | python/gps/gui/image_visualizer.py | python | ImageVisualizer.draw | (self) | [] | def draw(self):
self._ax_image.draw_artist(self._ax_image.patch)
self._ax_image.draw_artist(self._plot)
self._ax_image.draw_artist(self._overlay_plot_initial)
self._ax_image.draw_artist(self._overlay_plot_target)
self._fig.canvas.update()
self._fig.canvas.flush_events() | [
"def",
"draw",
"(",
"self",
")",
":",
"self",
".",
"_ax_image",
".",
"draw_artist",
"(",
"self",
".",
"_ax_image",
".",
"patch",
")",
"self",
".",
"_ax_image",
".",
"draw_artist",
"(",
"self",
".",
"_plot",
")",
"self",
".",
"_ax_image",
".",
"draw_art... | https://github.com/cbfinn/gps/blob/82fa6cc930c4392d55d2525f6b792089f1d2ccfe/python/gps/gui/image_visualizer.py#L153-L159 | ||||
yougov/mongo-connector | 557cafd4b54c848cd54ef28a258391a154650cb4 | mongo_connector/connector.py | python | Connector.oplog_thread_join | (self) | Stops all the OplogThreads | Stops all the OplogThreads | [
"Stops",
"all",
"the",
"OplogThreads"
] | def oplog_thread_join(self):
"""Stops all the OplogThreads
"""
LOG.info("MongoConnector: Stopping all OplogThreads")
for thread in self.shard_set.values():
thread.join() | [
"def",
"oplog_thread_join",
"(",
"self",
")",
":",
"LOG",
".",
"info",
"(",
"\"MongoConnector: Stopping all OplogThreads\"",
")",
"for",
"thread",
"in",
"self",
".",
"shard_set",
".",
"values",
"(",
")",
":",
"thread",
".",
"join",
"(",
")"
] | https://github.com/yougov/mongo-connector/blob/557cafd4b54c848cd54ef28a258391a154650cb4/mongo_connector/connector.py#L475-L480 | ||
univ-of-utah-marriott-library-apple/firmware_password_manager | 198694a650acd3fa61b85d25dd61e83782bb25d5 | firmware_password_manager.py | python | FWPM_Object.secure_delete | (self) | return | attempts to securely delete the keyfile with medium overwrite and zeroing settings | attempts to securely delete the keyfile with medium overwrite and zeroing settings | [
"attempts",
"to",
"securely",
"delete",
"the",
"keyfile",
"with",
"medium",
"overwrite",
"and",
"zeroing",
"settings"
] | def secure_delete(self):
"""
attempts to securely delete the keyfile with medium overwrite and zeroing settings
"""
if self.logger:
self.logger.info("%s: activated" % inspect.stack()[0][3])
if self.logger:
self.logger.info("Deleting keyfile")
use... | [
"def",
"secure_delete",
"(",
"self",
")",
":",
"if",
"self",
".",
"logger",
":",
"self",
".",
"logger",
".",
"info",
"(",
"\"%s: activated\"",
"%",
"inspect",
".",
"stack",
"(",
")",
"[",
"0",
"]",
"[",
"3",
"]",
")",
"if",
"self",
".",
"logger",
... | https://github.com/univ-of-utah-marriott-library-apple/firmware_password_manager/blob/198694a650acd3fa61b85d25dd61e83782bb25d5/firmware_password_manager.py#L316-L358 | |
kubernetes-client/python | 47b9da9de2d02b2b7a34fbe05afb44afd130d73a | kubernetes/client/configuration.py | python | Configuration.logger_format | (self) | return self.__logger_format | The logger format.
The logger_formatter will be updated when sets logger_format.
:param value: The format string.
:type: str | The logger format. | [
"The",
"logger",
"format",
"."
] | def logger_format(self):
"""The logger format.
The logger_formatter will be updated when sets logger_format.
:param value: The format string.
:type: str
"""
return self.__logger_format | [
"def",
"logger_format",
"(",
"self",
")",
":",
"return",
"self",
".",
"__logger_format"
] | https://github.com/kubernetes-client/python/blob/47b9da9de2d02b2b7a34fbe05afb44afd130d73a/kubernetes/client/configuration.py#L276-L284 | |
thinkle/gourmet | 8af29c8ded24528030e5ae2ea3461f61c1e5a575 | gourmet/plugins/nutritional_information/nutritionDisplay.py | python | NutritionModel.connect_treeview_signals | (self,tv) | [] | def connect_treeview_signals (self,tv):
tv.connect('row-expanded',self.row_expanded_cb) | [
"def",
"connect_treeview_signals",
"(",
"self",
",",
"tv",
")",
":",
"tv",
".",
"connect",
"(",
"'row-expanded'",
",",
"self",
".",
"row_expanded_cb",
")"
] | https://github.com/thinkle/gourmet/blob/8af29c8ded24528030e5ae2ea3461f61c1e5a575/gourmet/plugins/nutritional_information/nutritionDisplay.py#L15-L16 | ||||
oracle/oci-python-sdk | 3c1604e4e212008fb6718e2f68cdb5ef71fd5793 | src/oci/opsi/operations_insights_client.py | python | OperationsInsightsClient.summarize_exadata_insight_resource_utilization_insight | (self, compartment_id, resource_type, resource_metric, **kwargs) | Gets current utilization, projected utilization and days to reach projectedUtilization for an exadata system over specified time period. Valid values for ResourceType DATABASE are CPU,MEMORY,IO and STORAGE. Valid values for ResourceType HOST are CPU and MEMORY. Valid values for ResourceType STORAGE_SERVER are STORAGE, ... | Gets current utilization, projected utilization and days to reach projectedUtilization for an exadata system over specified time period. Valid values for ResourceType DATABASE are CPU,MEMORY,IO and STORAGE. Valid values for ResourceType HOST are CPU and MEMORY. Valid values for ResourceType STORAGE_SERVER are STORAGE, ... | [
"Gets",
"current",
"utilization",
"projected",
"utilization",
"and",
"days",
"to",
"reach",
"projectedUtilization",
"for",
"an",
"exadata",
"system",
"over",
"specified",
"time",
"period",
".",
"Valid",
"values",
"for",
"ResourceType",
"DATABASE",
"are",
"CPU",
"M... | def summarize_exadata_insight_resource_utilization_insight(self, compartment_id, resource_type, resource_metric, **kwargs):
"""
Gets current utilization, projected utilization and days to reach projectedUtilization for an exadata system over specified time period. Valid values for ResourceType DATABASE ... | [
"def",
"summarize_exadata_insight_resource_utilization_insight",
"(",
"self",
",",
"compartment_id",
",",
"resource_type",
",",
"resource_metric",
",",
"*",
"*",
"kwargs",
")",
":",
"resource_path",
"=",
"\"/exadataInsights/resourceUtilizationInsight\"",
"method",
"=",
"\"G... | https://github.com/oracle/oci-python-sdk/blob/3c1604e4e212008fb6718e2f68cdb5ef71fd5793/src/oci/opsi/operations_insights_client.py#L10537-L10733 | ||
jython/frozen-mirror | b8d7aa4cee50c0c0fe2f4b235dd62922dd0f3f99 | lib-python/2.7/decimal.py | python | Context.logical_or | (self, a, b) | return a.logical_or(b, context=self) | Applies the logical operation 'or' between each operand's digits.
The operands must be both logical numbers.
>>> ExtendedContext.logical_or(Decimal('0'), Decimal('0'))
Decimal('0')
>>> ExtendedContext.logical_or(Decimal('0'), Decimal('1'))
Decimal('1')
>>> ExtendedConte... | Applies the logical operation 'or' between each operand's digits. | [
"Applies",
"the",
"logical",
"operation",
"or",
"between",
"each",
"operand",
"s",
"digits",
"."
] | def logical_or(self, a, b):
"""Applies the logical operation 'or' between each operand's digits.
The operands must be both logical numbers.
>>> ExtendedContext.logical_or(Decimal('0'), Decimal('0'))
Decimal('0')
>>> ExtendedContext.logical_or(Decimal('0'), Decimal('1'))
... | [
"def",
"logical_or",
"(",
"self",
",",
"a",
",",
"b",
")",
":",
"a",
"=",
"_convert_other",
"(",
"a",
",",
"raiseit",
"=",
"True",
")",
"return",
"a",
".",
"logical_or",
"(",
"b",
",",
"context",
"=",
"self",
")"
] | https://github.com/jython/frozen-mirror/blob/b8d7aa4cee50c0c0fe2f4b235dd62922dd0f3f99/lib-python/2.7/decimal.py#L4608-L4633 | |
LxMLS/lxmls-toolkit | d95c623dd13e31135f4887c3788959eb9ad3d269 | lxmls/deep_learning/numpy_models/mlp.py | python | NumpyMLP.cross_entropy_loss | (self, input, output) | return -log_probability[range(num_examples), output].mean() | Cross entropy loss | Cross entropy loss | [
"Cross",
"entropy",
"loss"
] | def cross_entropy_loss(self, input, output):
"""Cross entropy loss"""
num_examples = input.shape[0]
log_probability, _ = self.log_forward(input)
return -log_probability[range(num_examples), output].mean() | [
"def",
"cross_entropy_loss",
"(",
"self",
",",
"input",
",",
"output",
")",
":",
"num_examples",
"=",
"input",
".",
"shape",
"[",
"0",
"]",
"log_probability",
",",
"_",
"=",
"self",
".",
"log_forward",
"(",
"input",
")",
"return",
"-",
"log_probability",
... | https://github.com/LxMLS/lxmls-toolkit/blob/d95c623dd13e31135f4887c3788959eb9ad3d269/lxmls/deep_learning/numpy_models/mlp.py#L75-L79 | |
compas-dev/compas | 0b33f8786481f710115fb1ae5fe79abc2a9a5175 | src/compas/geometry/intersections/intersections.py | python | intersection_polyline_plane | (polyline, plane, expected_number_of_intersections=None, tol=1e-6) | return intersections | Calculate the intersection point of a plane with a polyline. Reduce expected_number_of_intersections to speed up.
Parameters
----------
polyline : sequence[point] or :class:`compas.geometry.Polyline`
Polyline to test intersection.
plane : [point, vector] or :class:`compas.geometry.Plane`
... | Calculate the intersection point of a plane with a polyline. Reduce expected_number_of_intersections to speed up. | [
"Calculate",
"the",
"intersection",
"point",
"of",
"a",
"plane",
"with",
"a",
"polyline",
".",
"Reduce",
"expected_number_of_intersections",
"to",
"speed",
"up",
"."
] | def intersection_polyline_plane(polyline, plane, expected_number_of_intersections=None, tol=1e-6):
"""Calculate the intersection point of a plane with a polyline. Reduce expected_number_of_intersections to speed up.
Parameters
----------
polyline : sequence[point] or :class:`compas.geometry.Polyline`
... | [
"def",
"intersection_polyline_plane",
"(",
"polyline",
",",
"plane",
",",
"expected_number_of_intersections",
"=",
"None",
",",
"tol",
"=",
"1e-6",
")",
":",
"if",
"not",
"expected_number_of_intersections",
":",
"expected_number_of_intersections",
"=",
"len",
"(",
"po... | https://github.com/compas-dev/compas/blob/0b33f8786481f710115fb1ae5fe79abc2a9a5175/src/compas/geometry/intersections/intersections.py#L311-L341 | |
cisco/mindmeld | 809c36112e9ea8019fe29d54d136ca14eb4fd8db | mindmeld/text_preparation/spacy_model_factory.py | python | SpacyModelFactory.validate_spacy_language | (language) | Check if the language is valid.
Args:
language (str, optional): Language as specified using a 639-1/2 code. | Check if the language is valid. | [
"Check",
"if",
"the",
"language",
"is",
"valid",
"."
] | def validate_spacy_language(language):
"""Check if the language is valid.
Args:
language (str, optional): Language as specified using a 639-1/2 code.
"""
if language not in SPACY_SUPPORTED_LANGUAGES:
raise ValueError("Spacy does not currently support: {!r}.".form... | [
"def",
"validate_spacy_language",
"(",
"language",
")",
":",
"if",
"language",
"not",
"in",
"SPACY_SUPPORTED_LANGUAGES",
":",
"raise",
"ValueError",
"(",
"\"Spacy does not currently support: {!r}.\"",
".",
"format",
"(",
"language",
")",
")"
] | https://github.com/cisco/mindmeld/blob/809c36112e9ea8019fe29d54d136ca14eb4fd8db/mindmeld/text_preparation/spacy_model_factory.py#L51-L58 | ||
flosell/trailscraper | 2509b8da81b49edf375a44fbc22a58fd9e2ea928 | trailscraper/iam.py | python | BaseElement.json_repr | (self) | JSON representation of the class | JSON representation of the class | [
"JSON",
"representation",
"of",
"the",
"class"
] | def json_repr(self):
"""JSON representation of the class"""
raise NotImplementedError | [
"def",
"json_repr",
"(",
"self",
")",
":",
"raise",
"NotImplementedError"
] | https://github.com/flosell/trailscraper/blob/2509b8da81b49edf375a44fbc22a58fd9e2ea928/trailscraper/iam.py#L18-L20 | ||
saltstack/salt | fae5bc757ad0f1716483ce7ae180b451545c2058 | salt/utils/vault.py | python | write_cache | (connection) | Write the vault token to cache | Write the vault token to cache | [
"Write",
"the",
"vault",
"token",
"to",
"cache"
] | def write_cache(connection):
"""
Write the vault token to cache
"""
# If uses is 1 and unlimited_use_token is not true, then this is a single use token and should not be cached
# In that case, we still want to cache the vault metadata lookup information for paths, so continue on
if (
con... | [
"def",
"write_cache",
"(",
"connection",
")",
":",
"# If uses is 1 and unlimited_use_token is not true, then this is a single use token and should not be cached",
"# In that case, we still want to cache the vault metadata lookup information for paths, so continue on",
"if",
"(",
"connection",
... | https://github.com/saltstack/salt/blob/fae5bc757ad0f1716483ce7ae180b451545c2058/salt/utils/vault.py#L204-L246 | ||
Source-Python-Dev-Team/Source.Python | d0ffd8ccbd1e9923c9bc44936f20613c1c76b7fb | addons/source-python/Python3/collections/__init__.py | python | Counter.elements | (self) | return _chain.from_iterable(_starmap(_repeat, self.items())) | Iterator over elements repeating each as many times as its count.
>>> c = Counter('ABCABC')
>>> sorted(c.elements())
['A', 'A', 'B', 'B', 'C', 'C']
# Knuth's example for prime factors of 1836: 2**2 * 3**3 * 17**1
>>> prime_factors = Counter({2: 2, 3: 3, 17: 1})
>>> pro... | Iterator over elements repeating each as many times as its count. | [
"Iterator",
"over",
"elements",
"repeating",
"each",
"as",
"many",
"times",
"as",
"its",
"count",
"."
] | def elements(self):
'''Iterator over elements repeating each as many times as its count.
>>> c = Counter('ABCABC')
>>> sorted(c.elements())
['A', 'A', 'B', 'B', 'C', 'C']
# Knuth's example for prime factors of 1836: 2**2 * 3**3 * 17**1
>>> prime_factors = Counter({2: 2... | [
"def",
"elements",
"(",
"self",
")",
":",
"# Emulate Bag.do from Smalltalk and Multiset.begin from C++.",
"return",
"_chain",
".",
"from_iterable",
"(",
"_starmap",
"(",
"_repeat",
",",
"self",
".",
"items",
"(",
")",
")",
")"
] | https://github.com/Source-Python-Dev-Team/Source.Python/blob/d0ffd8ccbd1e9923c9bc44936f20613c1c76b7fb/addons/source-python/Python3/collections/__init__.py#L557-L577 | |
Cue/ocstyle | aec49228f7a4aee9d20f9de51ae50bb969075aee | src/ocstyle/rules.py | python | keyword | (_) | return None | Matches keywords. | Matches keywords. | [
"Matches",
"keywords",
"."
] | def keyword(_):
"""Matches keywords."""
return None | [
"def",
"keyword",
"(",
"_",
")",
":",
"return",
"None"
] | https://github.com/Cue/ocstyle/blob/aec49228f7a4aee9d20f9de51ae50bb969075aee/src/ocstyle/rules.py#L522-L524 | |
google-research/language | 61fa7260ac7d690d11ef72ca863e45a37c0bdc80 | language/compir/dataset_parsers/scan_parser.py | python | ScanParser._get_atom_map | (self) | return atom_map | Gets (utterance, program) pairs, used for adding brackets to programs. | Gets (utterance, program) pairs, used for adding brackets to programs. | [
"Gets",
"(",
"utterance",
"program",
")",
"pairs",
"used",
"for",
"adding",
"brackets",
"to",
"programs",
"."
] | def _get_atom_map(self):
"""Gets (utterance, program) pairs, used for adding brackets to programs."""
atoms = [
("turn left", "I_TURN_LEFT"),
("turn right", "I_TURN_RIGHT"),
("walk left", "I_TURN_LEFT I_WALK"),
("run left", "I_TURN_LEFT I_RUN"),
("look left", "I_TURN_LEFT... | [
"def",
"_get_atom_map",
"(",
"self",
")",
":",
"atoms",
"=",
"[",
"(",
"\"turn left\"",
",",
"\"I_TURN_LEFT\"",
")",
",",
"(",
"\"turn right\"",
",",
"\"I_TURN_RIGHT\"",
")",
",",
"(",
"\"walk left\"",
",",
"\"I_TURN_LEFT I_WALK\"",
")",
",",
"(",
"\"run left\... | https://github.com/google-research/language/blob/61fa7260ac7d690d11ef72ca863e45a37c0bdc80/language/compir/dataset_parsers/scan_parser.py#L109-L176 | |
guildai/guildai | 1665985a3d4d788efc1a3180ca51cc417f71ca78 | guild/op_util.py | python | _default_run_label | (flag_vals) | return " ".join(
flag_util.flag_assigns(non_null, truncate_floats=True, shorten_paths=True)
) | Returns a default run label for a map of flag values.
The default label is a string containing flag assign as NAME=VALUE. | Returns a default run label for a map of flag values. | [
"Returns",
"a",
"default",
"run",
"label",
"for",
"a",
"map",
"of",
"flag",
"values",
"."
] | def _default_run_label(flag_vals):
"""Returns a default run label for a map of flag values.
The default label is a string containing flag assign as NAME=VALUE.
"""
non_null = {name: val for name, val in flag_vals.items() if val is not None}
return " ".join(
flag_util.flag_assigns(non_null, ... | [
"def",
"_default_run_label",
"(",
"flag_vals",
")",
":",
"non_null",
"=",
"{",
"name",
":",
"val",
"for",
"name",
",",
"val",
"in",
"flag_vals",
".",
"items",
"(",
")",
"if",
"val",
"is",
"not",
"None",
"}",
"return",
"\" \"",
".",
"join",
"(",
"flag... | https://github.com/guildai/guildai/blob/1665985a3d4d788efc1a3180ca51cc417f71ca78/guild/op_util.py#L692-L700 | |
alicevision/meshroom | 92004286fd0bc8ab36bd3575b4c0166090e665e1 | meshroom/ui/reconstruction.py | python | ViewpointWrapper.pose | (self) | return QMatrix4x4(
self._R[0], -self._R[1], -self._R[2], self._T[0],
self._R[3], -self._R[4], -self._R[5], self._T[1],
self._R[6], -self._R[7], -self._R[8], self._T[2],
0, 0, 0, 1
) | Get the camera pose of 'viewpoint' as a 4x4 matrix. | Get the camera pose of 'viewpoint' as a 4x4 matrix. | [
"Get",
"the",
"camera",
"pose",
"of",
"viewpoint",
"as",
"a",
"4x4",
"matrix",
"."
] | def pose(self):
""" Get the camera pose of 'viewpoint' as a 4x4 matrix. """
if self._R is None or self._T is None:
return None
# convert transform matrix for Qt
return QMatrix4x4(
self._R[0], -self._R[1], -self._R[2], self._T[0],
self._R[3], -self._R[... | [
"def",
"pose",
"(",
"self",
")",
":",
"if",
"self",
".",
"_R",
"is",
"None",
"or",
"self",
".",
"_T",
"is",
"None",
":",
"return",
"None",
"# convert transform matrix for Qt",
"return",
"QMatrix4x4",
"(",
"self",
".",
"_R",
"[",
"0",
"]",
",",
"-",
"... | https://github.com/alicevision/meshroom/blob/92004286fd0bc8ab36bd3575b4c0166090e665e1/meshroom/ui/reconstruction.py#L318-L329 | |
PyTorchLightning/pytorch-lightning | 5914fb748fb53d826ab337fc2484feab9883a104 | pytorch_lightning/utilities/memory.py | python | get_memory_profile | (mode: str) | return memory_map | r"""
.. deprecated:: v1.5
This function was deprecated in v1.5 in favor of
`pytorch_lightning.accelerators.gpu._get_nvidia_gpu_stats` and will be removed in v1.7.
Get a profile of the current memory usage.
Args:
mode: There are two modes:
- 'all' means return memory fo... | r"""
.. deprecated:: v1.5
This function was deprecated in v1.5 in favor of
`pytorch_lightning.accelerators.gpu._get_nvidia_gpu_stats` and will be removed in v1.7. | [
"r",
"..",
"deprecated",
"::",
"v1",
".",
"5",
"This",
"function",
"was",
"deprecated",
"in",
"v1",
".",
"5",
"in",
"favor",
"of",
"pytorch_lightning",
".",
"accelerators",
".",
"gpu",
".",
"_get_nvidia_gpu_stats",
"and",
"will",
"be",
"removed",
"in",
"v1... | def get_memory_profile(mode: str) -> Dict[str, float]:
r"""
.. deprecated:: v1.5
This function was deprecated in v1.5 in favor of
`pytorch_lightning.accelerators.gpu._get_nvidia_gpu_stats` and will be removed in v1.7.
Get a profile of the current memory usage.
Args:
mode: There... | [
"def",
"get_memory_profile",
"(",
"mode",
":",
"str",
")",
"->",
"Dict",
"[",
"str",
",",
"float",
"]",
":",
"memory_map",
"=",
"get_gpu_memory_map",
"(",
")",
"if",
"mode",
"==",
"\"min_max\"",
":",
"min_index",
",",
"min_memory",
"=",
"min",
"(",
"memo... | https://github.com/PyTorchLightning/pytorch-lightning/blob/5914fb748fb53d826ab337fc2484feab9883a104/pytorch_lightning/utilities/memory.py#L111-L141 | |
RTIInternational/gobbli | d9ec8132f74ce49dc4bead2fad25b661bcef6e76 | gobbli/io.py | python | validate_X | (X: List[str]) | Confirm a given array matches the expected type for input.
Args:
X: Something that should be valid model input. | Confirm a given array matches the expected type for input. | [
"Confirm",
"a",
"given",
"array",
"matches",
"the",
"expected",
"type",
"for",
"input",
"."
] | def validate_X(X: List[str]):
"""
Confirm a given array matches the expected type for input.
Args:
X: Something that should be valid model input.
"""
_check_string_list(X) | [
"def",
"validate_X",
"(",
"X",
":",
"List",
"[",
"str",
"]",
")",
":",
"_check_string_list",
"(",
"X",
")"
] | https://github.com/RTIInternational/gobbli/blob/d9ec8132f74ce49dc4bead2fad25b661bcef6e76/gobbli/io.py#L55-L62 | ||
vilemduha/blendercam | 3bd98ace230464d68d9ff86eae595481ec98ffc0 | scripts/addons/cam/nc/nc.py | python | Creator.set_plane | (self, plane) | Set plane | Set plane | [
"Set",
"plane"
] | def set_plane(self, plane):
"""Set plane"""
pass | [
"def",
"set_plane",
"(",
"self",
",",
"plane",
")",
":",
"pass"
] | https://github.com/vilemduha/blendercam/blob/3bd98ace230464d68d9ff86eae595481ec98ffc0/scripts/addons/cam/nc/nc.py#L112-L114 | ||
pyproj4/pyproj | 24eade78c52f8bf6717e56fb7c878f7da9892368 | pyproj/crs/coordinate_operation.py | python | MercatorAConversion.__new__ | (
cls,
latitude_natural_origin: float = 0.0,
longitude_natural_origin: float = 0.0,
false_easting: float = 0.0,
false_northing: float = 0.0,
scale_factor_natural_origin: float = 1.0,
) | return cls.from_json_dict(merc_json) | Parameters
----------
longitude_natural_origin: float, default=0.0
Latitude of natural origin (lat_0).
longitude_natural_origin: float, default=0.0
Longitude of natural origin (lon_0).
false_easting: float, default=0.0
False easting (x_0).
fals... | Parameters
----------
longitude_natural_origin: float, default=0.0
Latitude of natural origin (lat_0).
longitude_natural_origin: float, default=0.0
Longitude of natural origin (lon_0).
false_easting: float, default=0.0
False easting (x_0).
fals... | [
"Parameters",
"----------",
"longitude_natural_origin",
":",
"float",
"default",
"=",
"0",
".",
"0",
"Latitude",
"of",
"natural",
"origin",
"(",
"lat_0",
")",
".",
"longitude_natural_origin",
":",
"float",
"default",
"=",
"0",
".",
"0",
"Longitude",
"of",
"nat... | def __new__(
cls,
latitude_natural_origin: float = 0.0,
longitude_natural_origin: float = 0.0,
false_easting: float = 0.0,
false_northing: float = 0.0,
scale_factor_natural_origin: float = 1.0,
):
"""
Parameters
----------
longitude_nat... | [
"def",
"__new__",
"(",
"cls",
",",
"latitude_natural_origin",
":",
"float",
"=",
"0.0",
",",
"longitude_natural_origin",
":",
"float",
"=",
"0.0",
",",
"false_easting",
":",
"float",
"=",
"0.0",
",",
"false_northing",
":",
"float",
"=",
"0.0",
",",
"scale_fa... | https://github.com/pyproj4/pyproj/blob/24eade78c52f8bf6717e56fb7c878f7da9892368/pyproj/crs/coordinate_operation.py#L679-L743 | |
PacificBiosciences/FALCON | ab80e88e1278879f28fe83b9fa0382249213444e | falcon_kit/run_support.py | python | update_job_sections | (config) | More for backwards compatibility with stuff from 'General' section. | More for backwards compatibility with stuff from 'General' section. | [
"More",
"for",
"backwards",
"compatibility",
"with",
"stuff",
"from",
"General",
"section",
"."
] | def update_job_sections(config):
"""More for backwards compatibility with stuff from 'General' section.
"""
update_job_defaults_section(config)
General = config['General']
# Update a few where the names change and the section is non-default.
def update_step_job_opts(name):
if General.ge... | [
"def",
"update_job_sections",
"(",
"config",
")",
":",
"update_job_defaults_section",
"(",
"config",
")",
"General",
"=",
"config",
"[",
"'General'",
"]",
"# Update a few where the names change and the section is non-default.",
"def",
"update_step_job_opts",
"(",
"name",
")... | https://github.com/PacificBiosciences/FALCON/blob/ab80e88e1278879f28fe83b9fa0382249213444e/falcon_kit/run_support.py#L256-L276 | ||
omz/PythonistaAppTemplate | f560f93f8876d82a21d108977f90583df08d55af | PythonistaAppTemplate/PythonistaKit.framework/pylib/httplib.py | python | HTTPConnection._send_output | (self, message_body=None) | Send the currently buffered request and clear the buffer.
Appends an extra \\r\\n to the buffer.
A message_body may be specified, to be appended to the request. | Send the currently buffered request and clear the buffer. | [
"Send",
"the",
"currently",
"buffered",
"request",
"and",
"clear",
"the",
"buffer",
"."
] | def _send_output(self, message_body=None):
"""Send the currently buffered request and clear the buffer.
Appends an extra \\r\\n to the buffer.
A message_body may be specified, to be appended to the request.
"""
self._buffer.extend(("", ""))
msg = "\r\n".join(self._buffer... | [
"def",
"_send_output",
"(",
"self",
",",
"message_body",
"=",
"None",
")",
":",
"self",
".",
"_buffer",
".",
"extend",
"(",
"(",
"\"\"",
",",
"\"\"",
")",
")",
"msg",
"=",
"\"\\r\\n\"",
".",
"join",
"(",
"self",
".",
"_buffer",
")",
"del",
"self",
... | https://github.com/omz/PythonistaAppTemplate/blob/f560f93f8876d82a21d108977f90583df08d55af/PythonistaAppTemplate/PythonistaKit.framework/pylib/httplib.py#L814-L833 | ||
IlyaGusev/rupo | 83a5fac0dddd480a401181e5465f0e3c94ad2dcc | rupo/stress/word.py | python | Stress.__str__ | (self) | return str(self.position) + "\t" + str(self.type) | [] | def __str__(self):
return str(self.position) + "\t" + str(self.type) | [
"def",
"__str__",
"(",
"self",
")",
":",
"return",
"str",
"(",
"self",
".",
"position",
")",
"+",
"\"\\t\"",
"+",
"str",
"(",
"self",
".",
"type",
")"
] | https://github.com/IlyaGusev/rupo/blob/83a5fac0dddd480a401181e5465f0e3c94ad2dcc/rupo/stress/word.py#L30-L31 | |||
khanhnamle1994/natural-language-processing | 01d450d5ac002b0156ef4cf93a07cb508c1bcdc5 | assignment1/.env/lib/python2.7/site-packages/pkg_resources/_vendor/packaging/version.py | python | _parse_local_version | (local) | Takes a string like abc.1.twelve and turns it into ("abc", 1, "twelve"). | Takes a string like abc.1.twelve and turns it into ("abc", 1, "twelve"). | [
"Takes",
"a",
"string",
"like",
"abc",
".",
"1",
".",
"twelve",
"and",
"turns",
"it",
"into",
"(",
"abc",
"1",
"twelve",
")",
"."
] | def _parse_local_version(local):
"""
Takes a string like abc.1.twelve and turns it into ("abc", 1, "twelve").
"""
if local is not None:
return tuple(
part.lower() if not part.isdigit() else int(part)
for part in _local_version_seperators.split(local)
) | [
"def",
"_parse_local_version",
"(",
"local",
")",
":",
"if",
"local",
"is",
"not",
"None",
":",
"return",
"tuple",
"(",
"part",
".",
"lower",
"(",
")",
"if",
"not",
"part",
".",
"isdigit",
"(",
")",
"else",
"int",
"(",
"part",
")",
"for",
"part",
"... | https://github.com/khanhnamle1994/natural-language-processing/blob/01d450d5ac002b0156ef4cf93a07cb508c1bcdc5/assignment1/.env/lib/python2.7/site-packages/pkg_resources/_vendor/packaging/version.py#L332-L340 | ||
angr/angr | 4b04d56ace135018083d36d9083805be8146688b | angr/procedures/linux_kernel/fstat64.py | python | fstat64._store_amd64 | (self, stat_buf, stat) | [] | def _store_amd64(self, stat_buf, stat):
store = lambda offset, val: self.state.memory.store(stat_buf + offset, val, endness='Iend_LE')
store(0x00, stat.st_dev)
store(0x08, stat.st_ino)
store(0x10, stat.st_mode)
store(0x18, stat.st_nlink)
store(0x1c, stat.st_uid)
... | [
"def",
"_store_amd64",
"(",
"self",
",",
"stat_buf",
",",
"stat",
")",
":",
"store",
"=",
"lambda",
"offset",
",",
"val",
":",
"self",
".",
"state",
".",
"memory",
".",
"store",
"(",
"stat_buf",
"+",
"offset",
",",
"val",
",",
"endness",
"=",
"'Iend_... | https://github.com/angr/angr/blob/4b04d56ace135018083d36d9083805be8146688b/angr/procedures/linux_kernel/fstat64.py#L67-L89 | ||||
cournape/Bento | 37de23d784407a7c98a4a15770ffc570d5f32d70 | bento/parser/lexer.py | python | t_insidemstringnotcontinued_WS | (t) | return t | [] | def t_insidemstringnotcontinued_WS(t):
return t | [
"def",
"t_insidemstringnotcontinued_WS",
"(",
"t",
")",
":",
"return",
"t"
] | https://github.com/cournape/Bento/blob/37de23d784407a7c98a4a15770ffc570d5f32d70/bento/parser/lexer.py#L326-L327 | |||
NTMC-Community/MatchZoo-py | 0e5c04e1e948aa9277abd5c85ff99d9950d8527f | matchzoo/tasks/ranking.py | python | Ranking.list_available_metrics | (cls) | return ['map'] | :return: a list of available metrics. | :return: a list of available metrics. | [
":",
"return",
":",
"a",
"list",
"of",
"available",
"metrics",
"."
] | def list_available_metrics(cls) -> list:
""":return: a list of available metrics."""
return ['map'] | [
"def",
"list_available_metrics",
"(",
"cls",
")",
"->",
"list",
":",
"return",
"[",
"'map'",
"]"
] | https://github.com/NTMC-Community/MatchZoo-py/blob/0e5c04e1e948aa9277abd5c85ff99d9950d8527f/matchzoo/tasks/ranking.py#L29-L31 | |
yt-project/yt | dc7b24f9b266703db4c843e329c6c8644d47b824 | yt/frontends/enzo_e/data_structures.py | python | EnzoEHierarchy._setup_derived_fields | (self) | [] | def _setup_derived_fields(self):
super()._setup_derived_fields()
for fname, field in self.ds.field_info.items():
if not field.particle_type:
continue
if isinstance(fname, tuple):
continue
if field._function is NullFunc:
... | [
"def",
"_setup_derived_fields",
"(",
"self",
")",
":",
"super",
"(",
")",
".",
"_setup_derived_fields",
"(",
")",
"for",
"fname",
",",
"field",
"in",
"self",
".",
"ds",
".",
"field_info",
".",
"items",
"(",
")",
":",
"if",
"not",
"field",
".",
"particl... | https://github.com/yt-project/yt/blob/dc7b24f9b266703db4c843e329c6c8644d47b824/yt/frontends/enzo_e/data_structures.py#L255-L263 | ||||
pypa/pipenv | b21baade71a86ab3ee1429f71fbc14d4f95fb75d | pipenv/patched/notpip/_internal/operations/install/wheel.py | python | install_wheel | (
name, # type: str
wheel_path, # type: str
scheme, # type: Scheme
req_description, # type: str
pycompile=True, # type: bool
warn_script_location=True, # type: bool
direct_url=None, # type: Optional[DirectUrl]
requested=False, # type: bool
) | [] | def install_wheel(
name, # type: str
wheel_path, # type: str
scheme, # type: Scheme
req_description, # type: str
pycompile=True, # type: bool
warn_script_location=True, # type: bool
direct_url=None, # type: Optional[DirectUrl]
requested=False, # type: bool
):
# type: (...) ->... | [
"def",
"install_wheel",
"(",
"name",
",",
"# type: str",
"wheel_path",
",",
"# type: str",
"scheme",
",",
"# type: Scheme",
"req_description",
",",
"# type: str",
"pycompile",
"=",
"True",
",",
"# type: bool",
"warn_script_location",
"=",
"True",
",",
"# type: bool",
... | https://github.com/pypa/pipenv/blob/b21baade71a86ab3ee1429f71fbc14d4f95fb75d/pipenv/patched/notpip/_internal/operations/install/wheel.py#L781-L803 | ||||
polakowo/vectorbt | 6638735c131655760474d72b9f045d1dbdbd8fe9 | vectorbt/utils/checks.py | python | is_index | (arg: tp.Any) | return isinstance(arg, pd.Index) | Check whether the argument is `pd.Index`. | Check whether the argument is `pd.Index`. | [
"Check",
"whether",
"the",
"argument",
"is",
"pd",
".",
"Index",
"."
] | def is_index(arg: tp.Any) -> bool:
"""Check whether the argument is `pd.Index`."""
return isinstance(arg, pd.Index) | [
"def",
"is_index",
"(",
"arg",
":",
"tp",
".",
"Any",
")",
"->",
"bool",
":",
"return",
"isinstance",
"(",
"arg",
",",
"pd",
".",
"Index",
")"
] | https://github.com/polakowo/vectorbt/blob/6638735c131655760474d72b9f045d1dbdbd8fe9/vectorbt/utils/checks.py#L32-L34 | |
vispy/vispy | 26256fdc2574259dd227022fbce0767cae4e244b | vispy/visuals/graphs/layouts/networkx_layout.py | python | NetworkxCoordinates.__call__ | (self, adjacency_mat, directed=False) | Parameters
----------
adjacency_mat : sparse adjacency matrix.
directed : bool, default False
Returns
---------
(node_vertices, line_vertices, arrow_vertices) : tuple
Yields the node and line vertices in a tuple. This layout only yields a
single time, and... | Parameters
----------
adjacency_mat : sparse adjacency matrix.
directed : bool, default False | [
"Parameters",
"----------",
"adjacency_mat",
":",
"sparse",
"adjacency",
"matrix",
".",
"directed",
":",
"bool",
"default",
"False"
] | def __call__(self, adjacency_mat, directed=False):
"""
Parameters
----------
adjacency_mat : sparse adjacency matrix.
directed : bool, default False
Returns
---------
(node_vertices, line_vertices, arrow_vertices) : tuple
Yields the node and line ... | [
"def",
"__call__",
"(",
"self",
",",
"adjacency_mat",
",",
"directed",
"=",
"False",
")",
":",
"if",
"issparse",
"(",
"adjacency_mat",
")",
":",
"adjacency_mat",
"=",
"adjacency_mat",
".",
"tocoo",
"(",
")",
"line_vertices",
",",
"arrows",
"=",
"_straight_li... | https://github.com/vispy/vispy/blob/26256fdc2574259dd227022fbce0767cae4e244b/vispy/visuals/graphs/layouts/networkx_layout.py#L64-L82 | ||
kuri65536/python-for-android | 26402a08fc46b09ef94e8d7a6bbc3a54ff9d0891 | python3-alpha/python-libs/bs4/element.py | python | PageElement.find_next_sibling | (self, name=None, attrs={}, text=None, **kwargs) | return self._find_one(self.find_next_siblings, name, attrs, text,
**kwargs) | Returns the closest sibling to this Tag that matches the
given criteria and appears after this Tag in the document. | Returns the closest sibling to this Tag that matches the
given criteria and appears after this Tag in the document. | [
"Returns",
"the",
"closest",
"sibling",
"to",
"this",
"Tag",
"that",
"matches",
"the",
"given",
"criteria",
"and",
"appears",
"after",
"this",
"Tag",
"in",
"the",
"document",
"."
] | def find_next_sibling(self, name=None, attrs={}, text=None, **kwargs):
"""Returns the closest sibling to this Tag that matches the
given criteria and appears after this Tag in the document."""
return self._find_one(self.find_next_siblings, name, attrs, text,
**kwargs... | [
"def",
"find_next_sibling",
"(",
"self",
",",
"name",
"=",
"None",
",",
"attrs",
"=",
"{",
"}",
",",
"text",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"self",
".",
"_find_one",
"(",
"self",
".",
"find_next_siblings",
",",
"name",
",",... | https://github.com/kuri65536/python-for-android/blob/26402a08fc46b09ef94e8d7a6bbc3a54ff9d0891/python3-alpha/python-libs/bs4/element.py#L258-L262 | |
magmax/python-inquirer | ef7487247b46f33032f54a1547c9b8d9b8287c2b | noxfile.py | python | activate_virtualenv_in_precommit_hooks | (session: Session) | Activate virtualenv in hooks installed by pre-commit.
This function patches git hooks installed by pre-commit to activate the
session's virtual environment. This allows pre-commit to locate hooks in
that environment when invoked from git.
Args:
session: The Session object. | Activate virtualenv in hooks installed by pre-commit. | [
"Activate",
"virtualenv",
"in",
"hooks",
"installed",
"by",
"pre",
"-",
"commit",
"."
] | def activate_virtualenv_in_precommit_hooks(session: Session) -> None:
"""Activate virtualenv in hooks installed by pre-commit.
This function patches git hooks installed by pre-commit to activate the
session's virtual environment. This allows pre-commit to locate hooks in
that environment when invoked f... | [
"def",
"activate_virtualenv_in_precommit_hooks",
"(",
"session",
":",
"Session",
")",
"->",
"None",
":",
"assert",
"session",
".",
"bin",
"is",
"not",
"None",
"# noqa: S101",
"# Only patch hooks containing a reference to this session's bindir. Support",
"# quoting rules for Pyt... | https://github.com/magmax/python-inquirer/blob/ef7487247b46f33032f54a1547c9b8d9b8287c2b/noxfile.py#L35-L97 | ||
tsenghungchen/SA-tensorflow | 6aad7dbf609e64dd652e9204518eddc6674168a4 | pycocoevalcap/bleu/bleu_scorer.py | python | BleuScorer.score_ratio | (self, option=None) | return (self.fscore(option=option), self.ratio(option=option)) | return (bleu, len_ratio) pair | return (bleu, len_ratio) pair | [
"return",
"(",
"bleu",
"len_ratio",
")",
"pair"
] | def score_ratio(self, option=None):
'''return (bleu, len_ratio) pair'''
return (self.fscore(option=option), self.ratio(option=option)) | [
"def",
"score_ratio",
"(",
"self",
",",
"option",
"=",
"None",
")",
":",
"return",
"(",
"self",
".",
"fscore",
"(",
"option",
"=",
"option",
")",
",",
"self",
".",
"ratio",
"(",
"option",
"=",
"option",
")",
")"
] | https://github.com/tsenghungchen/SA-tensorflow/blob/6aad7dbf609e64dd652e9204518eddc6674168a4/pycocoevalcap/bleu/bleu_scorer.py#L126-L128 | |
IdentityPython/pysaml2 | 6badb32d212257bd83ffcc816f9b625f68281b47 | src/saml2/ws/wspol.py | python | operator_content_type__from_string | (xml_string) | return saml2.create_class_from_xml_string(OperatorContentType_, xml_string) | [] | def operator_content_type__from_string(xml_string):
return saml2.create_class_from_xml_string(OperatorContentType_, xml_string) | [
"def",
"operator_content_type__from_string",
"(",
"xml_string",
")",
":",
"return",
"saml2",
".",
"create_class_from_xml_string",
"(",
"OperatorContentType_",
",",
"xml_string",
")"
] | https://github.com/IdentityPython/pysaml2/blob/6badb32d212257bd83ffcc816f9b625f68281b47/src/saml2/ws/wspol.py#L134-L135 | |||
bendichter/brokenaxes | 191a534e64054f0e155cd7398832e44c681ed539 | brokenaxes.py | python | BrokenAxes.set_title | (self, *args, **kwargs) | return self.big_ax.set_title(*args, **kwargs) | [] | def set_title(self, *args, **kwargs):
return self.big_ax.set_title(*args, **kwargs) | [
"def",
"set_title",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"self",
".",
"big_ax",
".",
"set_title",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/bendichter/brokenaxes/blob/191a534e64054f0e155cd7398832e44c681ed539/brokenaxes.py#L329-L330 | |||
MaurizioFD/RecSys2019_DeepLearning_Evaluation | 0fb6b7f5c396f8525316ed66cf9c9fdb03a5fa9b | CNN_on_embeddings/IJCAI/CFM_our_interface/Dataset_wrapper.py | python | dict_to_sparse_matrix | (d:dict, shape:tuple) | return sparse_matrix | Convert a dictionary to a sparse matrix | Convert a dictionary to a sparse matrix | [
"Convert",
"a",
"dictionary",
"to",
"a",
"sparse",
"matrix"
] | def dict_to_sparse_matrix(d:dict, shape:tuple):
""" Convert a dictionary to a sparse matrix """
tot_items = 0
row_ind = []
col_ind = []
for k, v in d.items():
c = len(v)
row_ind.extend([k] * c)
col_ind.extend(v)
tot_items += c
data = np.ones(tot_items)
sparse... | [
"def",
"dict_to_sparse_matrix",
"(",
"d",
":",
"dict",
",",
"shape",
":",
"tuple",
")",
":",
"tot_items",
"=",
"0",
"row_ind",
"=",
"[",
"]",
"col_ind",
"=",
"[",
"]",
"for",
"k",
",",
"v",
"in",
"d",
".",
"items",
"(",
")",
":",
"c",
"=",
"len... | https://github.com/MaurizioFD/RecSys2019_DeepLearning_Evaluation/blob/0fb6b7f5c396f8525316ed66cf9c9fdb03a5fa9b/CNN_on_embeddings/IJCAI/CFM_our_interface/Dataset_wrapper.py#L14-L30 | |
chapmanb/bcbb | dbfb52711f0bfcc1d26c5a5b53c9ff4f50dc0027 | nextgen/bcbio/broad/metrics.py | python | RNASeqPicardMetrics.report | (self, align_bam, ref_file, gtf_file, is_paired=False,
rrna_file="null") | return summary_info, graphs | Produce report metrics for a RNASeq experiment using Picard
with a sorted aligned BAM file. | Produce report metrics for a RNASeq experiment using Picard
with a sorted aligned BAM file. | [
"Produce",
"report",
"metrics",
"for",
"a",
"RNASeq",
"experiment",
"using",
"Picard",
"with",
"a",
"sorted",
"aligned",
"BAM",
"file",
"."
] | def report(self, align_bam, ref_file, gtf_file, is_paired=False,
rrna_file="null"):
"""Produce report metrics for a RNASeq experiment using Picard
with a sorted aligned BAM file.
"""
# collect duplication metrics
dup_bam, dup_metrics = self._get_current_dup_metri... | [
"def",
"report",
"(",
"self",
",",
"align_bam",
",",
"ref_file",
",",
"gtf_file",
",",
"is_paired",
"=",
"False",
",",
"rrna_file",
"=",
"\"null\"",
")",
":",
"# collect duplication metrics",
"dup_bam",
",",
"dup_metrics",
"=",
"self",
".",
"_get_current_dup_met... | https://github.com/chapmanb/bcbb/blob/dbfb52711f0bfcc1d26c5a5b53c9ff4f50dc0027/nextgen/bcbio/broad/metrics.py#L442-L467 | |
microsoft/unilm | 65f15af2a307ebb64cfb25adf54375b002e6fe8d | infoxlm/fairseq/fairseq/models/fairseq_model.py | python | BaseFairseqModel.upgrade_state_dict_named | (self, state_dict, name) | Upgrade old state dicts to work with newer code.
Args:
state_dict (dict): state dictionary to upgrade, in place
name (str): the state dict key corresponding to the current module | Upgrade old state dicts to work with newer code. | [
"Upgrade",
"old",
"state",
"dicts",
"to",
"work",
"with",
"newer",
"code",
"."
] | def upgrade_state_dict_named(self, state_dict, name):
"""Upgrade old state dicts to work with newer code.
Args:
state_dict (dict): state dictionary to upgrade, in place
name (str): the state dict key corresponding to the current module
"""
assert state_dict is no... | [
"def",
"upgrade_state_dict_named",
"(",
"self",
",",
"state_dict",
",",
"name",
")",
":",
"assert",
"state_dict",
"is",
"not",
"None",
"def",
"do_upgrade",
"(",
"m",
",",
"prefix",
")",
":",
"if",
"len",
"(",
"prefix",
")",
">",
"0",
":",
"prefix",
"+=... | https://github.com/microsoft/unilm/blob/65f15af2a307ebb64cfb25adf54375b002e6fe8d/infoxlm/fairseq/fairseq/models/fairseq_model.py#L77-L98 | ||
openshift/openshift-tools | 1188778e728a6e4781acf728123e5b356380fe6f | ansible/roles/lib_oa_openshift/library/oc_adm_router.py | python | Router.__init__ | (self,
router_config,
verbose=False) | Constructor for OpenshiftOC
a router consists of 3 or more parts
- dc/router
- svc/router
- sa/router
- secret/router-certs
- clusterrolebinding/router-router-role | Constructor for OpenshiftOC | [
"Constructor",
"for",
"OpenshiftOC"
] | def __init__(self,
router_config,
verbose=False):
''' Constructor for OpenshiftOC
a router consists of 3 or more parts
- dc/router
- svc/router
- sa/router
- secret/router-certs
- clusterrolebinding/router-route... | [
"def",
"__init__",
"(",
"self",
",",
"router_config",
",",
"verbose",
"=",
"False",
")",
":",
"super",
"(",
"Router",
",",
"self",
")",
".",
"__init__",
"(",
"router_config",
".",
"namespace",
",",
"router_config",
".",
"kubeconfig",
",",
"verbose",
")",
... | https://github.com/openshift/openshift-tools/blob/1188778e728a6e4781acf728123e5b356380fe6f/ansible/roles/lib_oa_openshift/library/oc_adm_router.py#L2693-L2720 | ||
blurstudio/cross3d | 277968d1227de740fc87ef61005c75034420eadf | cross3d/abstract/abstractcontainer.py | python | AbstractContainer.deselect | (self) | return self.setSelected(False) | Deselects the objects on this object group from the scene
:return: bool | Deselects the objects on this object group from the scene
:return: bool | [
"Deselects",
"the",
"objects",
"on",
"this",
"object",
"group",
"from",
"the",
"scene",
":",
"return",
":",
"bool"
] | def deselect(self):
"""Deselects the objects on this object group from the scene
:return: bool
"""
return self.setSelected(False) | [
"def",
"deselect",
"(",
"self",
")",
":",
"return",
"self",
".",
"setSelected",
"(",
"False",
")"
] | https://github.com/blurstudio/cross3d/blob/277968d1227de740fc87ef61005c75034420eadf/cross3d/abstract/abstractcontainer.py#L249-L255 | |
InsaneLife/dssm | 1d32e137654e03994f7ba6cfde52e1d47601027c | model/bert/tokenization.py | python | whitespace_tokenize | (text) | return tokens | Runs basic whitespace cleaning and splitting on a peice of text. | Runs basic whitespace cleaning and splitting on a peice of text. | [
"Runs",
"basic",
"whitespace",
"cleaning",
"and",
"splitting",
"on",
"a",
"peice",
"of",
"text",
"."
] | def whitespace_tokenize(text):
"""Runs basic whitespace cleaning and splitting on a peice of text."""
text = text.strip()
if not text:
return []
tokens = text.split()
return tokens | [
"def",
"whitespace_tokenize",
"(",
"text",
")",
":",
"text",
"=",
"text",
".",
"strip",
"(",
")",
"if",
"not",
"text",
":",
"return",
"[",
"]",
"tokens",
"=",
"text",
".",
"split",
"(",
")",
"return",
"tokens"
] | https://github.com/InsaneLife/dssm/blob/1d32e137654e03994f7ba6cfde52e1d47601027c/model/bert/tokenization.py#L96-L102 | |
krintoxi/NoobSec-Toolkit | 38738541cbc03cedb9a3b3ed13b629f781ad64f6 | NoobSecToolkit /tools/inject/thirdparty/bottle/bottle.py | python | BaseRequest.json | (self) | return None | If the ``Content-Type`` header is ``application/json``, this
property holds the parsed content of the request body. Only requests
smaller than :attr:`MEMFILE_MAX` are processed to avoid memory
exhaustion. | If the ``Content-Type`` header is ``application/json``, this
property holds the parsed content of the request body. Only requests
smaller than :attr:`MEMFILE_MAX` are processed to avoid memory
exhaustion. | [
"If",
"the",
"Content",
"-",
"Type",
"header",
"is",
"application",
"/",
"json",
"this",
"property",
"holds",
"the",
"parsed",
"content",
"of",
"the",
"request",
"body",
".",
"Only",
"requests",
"smaller",
"than",
":",
"attr",
":",
"MEMFILE_MAX",
"are",
"p... | def json(self):
''' If the ``Content-Type`` header is ``application/json``, this
property holds the parsed content of the request body. Only requests
smaller than :attr:`MEMFILE_MAX` are processed to avoid memory
exhaustion. '''
if 'application/json' in self.environ.g... | [
"def",
"json",
"(",
"self",
")",
":",
"if",
"'application/json'",
"in",
"self",
".",
"environ",
".",
"get",
"(",
"'CONTENT_TYPE'",
",",
"''",
")",
"and",
"0",
"<",
"self",
".",
"content_length",
"<",
"self",
".",
"MEMFILE_MAX",
":",
"return",
"json_loads... | https://github.com/krintoxi/NoobSec-Toolkit/blob/38738541cbc03cedb9a3b3ed13b629f781ad64f6/NoobSecToolkit /tools/inject/thirdparty/bottle/bottle.py#L1017-L1025 | |
misterch0c/shadowbroker | e3a069bea47a2c1009697941ac214adc6f90aa8d | windows/Resources/Python/Core/Lib/pipes.py | python | Template.clone | (self) | return t | t.clone() returns a new pipeline template with identical
initial state as the current one. | t.clone() returns a new pipeline template with identical
initial state as the current one. | [
"t",
".",
"clone",
"()",
"returns",
"a",
"new",
"pipeline",
"template",
"with",
"identical",
"initial",
"state",
"as",
"the",
"current",
"one",
"."
] | def clone(self):
"""t.clone() returns a new pipeline template with identical
initial state as the current one."""
t = Template()
t.steps = self.steps[:]
t.debugging = self.debugging
return t | [
"def",
"clone",
"(",
"self",
")",
":",
"t",
"=",
"Template",
"(",
")",
"t",
".",
"steps",
"=",
"self",
".",
"steps",
"[",
":",
"]",
"t",
".",
"debugging",
"=",
"self",
".",
"debugging",
"return",
"t"
] | https://github.com/misterch0c/shadowbroker/blob/e3a069bea47a2c1009697941ac214adc6f90aa8d/windows/Resources/Python/Core/Lib/pipes.py#L97-L103 | |
beeware/ouroboros | a29123c6fab6a807caffbb7587cf548e0c370296 | ouroboros/mailcap.py | python | parsefield | (line, i, n) | return line[start:i].strip(), i | Separate one key-value pair in a mailcap entry. | Separate one key-value pair in a mailcap entry. | [
"Separate",
"one",
"key",
"-",
"value",
"pair",
"in",
"a",
"mailcap",
"entry",
"."
] | def parsefield(line, i, n):
"""Separate one key-value pair in a mailcap entry."""
start = i
while i < n:
c = line[i]
if c == ';':
break
elif c == '\\':
i = i+2
else:
i = i+1
return line[start:i].strip(), i | [
"def",
"parsefield",
"(",
"line",
",",
"i",
",",
"n",
")",
":",
"start",
"=",
"i",
"while",
"i",
"<",
"n",
":",
"c",
"=",
"line",
"[",
"i",
"]",
"if",
"c",
"==",
"';'",
":",
"break",
"elif",
"c",
"==",
"'\\\\'",
":",
"i",
"=",
"i",
"+",
"... | https://github.com/beeware/ouroboros/blob/a29123c6fab6a807caffbb7587cf548e0c370296/ouroboros/mailcap.py#L122-L133 | |
erikdubois/Aureola | 005fb14b3cab0ba1929ebf9ac3ac68d2c6e1c0ef | shailen mc/dropbox.py | python | relpath | (path, start=curdir) | return join(*rel_list) | Return a relative version of a path | Return a relative version of a path | [
"Return",
"a",
"relative",
"version",
"of",
"a",
"path"
] | def relpath(path, start=curdir):
"""Return a relative version of a path"""
if not path:
raise ValueError("no path specified")
if type(start) is unicode:
start_list = unicode_abspath(start).split(sep)
else:
start_list = abspath(start).split(sep)
if type(path) is unicode:
... | [
"def",
"relpath",
"(",
"path",
",",
"start",
"=",
"curdir",
")",
":",
"if",
"not",
"path",
":",
"raise",
"ValueError",
"(",
"\"no path specified\"",
")",
"if",
"type",
"(",
"start",
")",
"is",
"unicode",
":",
"start_list",
"=",
"unicode_abspath",
"(",
"s... | https://github.com/erikdubois/Aureola/blob/005fb14b3cab0ba1929ebf9ac3ac68d2c6e1c0ef/shailen mc/dropbox.py#L97-L119 | |
asciidoc-py/asciidoc-py | b40326325e5985c8b60366237eabe850b32d2176 | asciidoc/a2x.py | python | A2X.xsl_stylesheet | (self, file_name=None) | return self.asciidoc_conf_file(os.path.join('docbook-xsl', file_name)) | Return full path name of file in asciidoc docbook-xsl configuration
directory.
If an XSL file was specified with the --xsl-file option then it is
returned. | Return full path name of file in asciidoc docbook-xsl configuration
directory.
If an XSL file was specified with the --xsl-file option then it is
returned. | [
"Return",
"full",
"path",
"name",
"of",
"file",
"in",
"asciidoc",
"docbook",
"-",
"xsl",
"configuration",
"directory",
".",
"If",
"an",
"XSL",
"file",
"was",
"specified",
"with",
"the",
"--",
"xsl",
"-",
"file",
"option",
"then",
"it",
"is",
"returned",
... | def xsl_stylesheet(self, file_name=None):
'''
Return full path name of file in asciidoc docbook-xsl configuration
directory.
If an XSL file was specified with the --xsl-file option then it is
returned.
'''
if self.xsl_file is not None:
return self.xsl_... | [
"def",
"xsl_stylesheet",
"(",
"self",
",",
"file_name",
"=",
"None",
")",
":",
"if",
"self",
".",
"xsl_file",
"is",
"not",
"None",
":",
"return",
"self",
".",
"xsl_file",
"if",
"not",
"file_name",
":",
"file_name",
"=",
"self",
".",
"format",
"+",
"'.x... | https://github.com/asciidoc-py/asciidoc-py/blob/b40326325e5985c8b60366237eabe850b32d2176/asciidoc/a2x.py#L589-L600 | |
fossasia/pslab-python | bb53a334b729d0956ed9f4ce6899903f3e4868ef | pslab/bus/uart.py | python | UART.write_byte | (self, data: int) | Write a single byte to the UART bus.
Parameters
----------
data : int
Byte value to write to the UART bus. | Write a single byte to the UART bus. | [
"Write",
"a",
"single",
"byte",
"to",
"the",
"UART",
"bus",
"."
] | def write_byte(self, data: int):
"""Write a single byte to the UART bus.
Parameters
----------
data : int
Byte value to write to the UART bus.
"""
self._write_byte(data) | [
"def",
"write_byte",
"(",
"self",
",",
"data",
":",
"int",
")",
":",
"self",
".",
"_write_byte",
"(",
"data",
")"
] | https://github.com/fossasia/pslab-python/blob/bb53a334b729d0956ed9f4ce6899903f3e4868ef/pslab/bus/uart.py#L252-L260 | ||
biolab/orange3 | 41685e1c7b1d1babe680113685a2d44bcc9fec0b | Orange/widgets/unsupervised/owcorrespondence.py | python | ScatterPlotItem.paint | (self, painter, option, widget=None) | [] | def paint(self, painter, option, widget=None):
painter.setRenderHint(QPainter.SmoothPixmapTransform, True)
painter.setRenderHint(QPainter.Antialiasing, True)
super().paint(painter, option, widget) | [
"def",
"paint",
"(",
"self",
",",
"painter",
",",
"option",
",",
"widget",
"=",
"None",
")",
":",
"painter",
".",
"setRenderHint",
"(",
"QPainter",
".",
"SmoothPixmapTransform",
",",
"True",
")",
"painter",
".",
"setRenderHint",
"(",
"QPainter",
".",
"Anti... | https://github.com/biolab/orange3/blob/41685e1c7b1d1babe680113685a2d44bcc9fec0b/Orange/widgets/unsupervised/owcorrespondence.py#L26-L29 | ||||
HSLCY/ABSA-BERT-pair | 7d238eb8c772946b9e572373c144b11151e4187f | evaluation.py | python | get_y_pred | (task_name, pred_data_dir) | return pred, score | Read file to obtain y_pred and scores. | Read file to obtain y_pred and scores. | [
"Read",
"file",
"to",
"obtain",
"y_pred",
"and",
"scores",
"."
] | def get_y_pred(task_name, pred_data_dir):
"""
Read file to obtain y_pred and scores.
"""
pred=[]
score=[]
if task_name in ["sentihood_NLI_M", "sentihood_QA_M"]:
with open(pred_data_dir, "r", encoding="utf-8") as f:
s=f.readline().strip().split()
while s:
... | [
"def",
"get_y_pred",
"(",
"task_name",
",",
"pred_data_dir",
")",
":",
"pred",
"=",
"[",
"]",
"score",
"=",
"[",
"]",
"if",
"task_name",
"in",
"[",
"\"sentihood_NLI_M\"",
",",
"\"sentihood_QA_M\"",
"]",
":",
"with",
"open",
"(",
"pred_data_dir",
",",
"\"r\... | https://github.com/HSLCY/ABSA-BERT-pair/blob/7d238eb8c772946b9e572373c144b11151e4187f/evaluation.py#L54-L182 | |
wistbean/fxxkpython | 88e16d79d8dd37236ba6ecd0d0ff11d63143968c | vip/qyxuan/projects/Snake/venv/lib/python3.6/site-packages/pip-19.0.3-py3.6.egg/pip/_vendor/requests/cookies.py | python | RequestsCookieJar._find_no_duplicates | (self, name, domain=None, path=None) | Both ``__get_item__`` and ``get`` call this function: it's never
used elsewhere in Requests.
:param name: a string containing name of cookie
:param domain: (optional) string containing domain of cookie
:param path: (optional) string containing path of cookie
:raises KeyError: if... | Both ``__get_item__`` and ``get`` call this function: it's never
used elsewhere in Requests. | [
"Both",
"__get_item__",
"and",
"get",
"call",
"this",
"function",
":",
"it",
"s",
"never",
"used",
"elsewhere",
"in",
"Requests",
"."
] | def _find_no_duplicates(self, name, domain=None, path=None):
"""Both ``__get_item__`` and ``get`` call this function: it's never
used elsewhere in Requests.
:param name: a string containing name of cookie
:param domain: (optional) string containing domain of cookie
:param path: ... | [
"def",
"_find_no_duplicates",
"(",
"self",
",",
"name",
",",
"domain",
"=",
"None",
",",
"path",
"=",
"None",
")",
":",
"toReturn",
"=",
"None",
"for",
"cookie",
"in",
"iter",
"(",
"self",
")",
":",
"if",
"cookie",
".",
"name",
"==",
"name",
":",
"... | https://github.com/wistbean/fxxkpython/blob/88e16d79d8dd37236ba6ecd0d0ff11d63143968c/vip/qyxuan/projects/Snake/venv/lib/python3.6/site-packages/pip-19.0.3-py3.6.egg/pip/_vendor/requests/cookies.py#L376-L399 | ||
zopefoundation/Zope | ea04dd670d1a48d4d5c879d3db38fc2e9b4330bb | src/OFS/PropertySheets.py | python | View.tpURL | (self) | return self.getId() | [] | def tpURL(self):
return self.getId() | [
"def",
"tpURL",
"(",
"self",
")",
":",
"return",
"self",
".",
"getId",
"(",
")"
] | https://github.com/zopefoundation/Zope/blob/ea04dd670d1a48d4d5c879d3db38fc2e9b4330bb/src/OFS/PropertySheets.py#L58-L59 | |||
CouchPotato/CouchPotatoV1 | 135b3331d1b88ef645e29b76f2d4cc4a732c9232 | library/sqlalchemy/orm/session.py | python | Session.object_session | (cls, instance) | return object_session(instance) | Return the ``Session`` to which an object belongs. | Return the ``Session`` to which an object belongs. | [
"Return",
"the",
"Session",
"to",
"which",
"an",
"object",
"belongs",
"."
] | def object_session(cls, instance):
"""Return the ``Session`` to which an object belongs."""
return object_session(instance) | [
"def",
"object_session",
"(",
"cls",
",",
"instance",
")",
":",
"return",
"object_session",
"(",
"instance",
")"
] | https://github.com/CouchPotato/CouchPotatoV1/blob/135b3331d1b88ef645e29b76f2d4cc4a732c9232/library/sqlalchemy/orm/session.py#L1261-L1264 | |
facebookresearch/pytorch3d | fddd6a700fa9685c1ce2d4b266c111d7db424ecc | pytorch3d/structures/meshes.py | python | Meshes.faces_list | (self) | return self._faces_list | Get the list representation of the faces.
Returns:
list of tensors of faces of shape (F_n, 3). | Get the list representation of the faces. | [
"Get",
"the",
"list",
"representation",
"of",
"the",
"faces",
"."
] | def faces_list(self):
"""
Get the list representation of the faces.
Returns:
list of tensors of faces of shape (F_n, 3).
"""
if self._faces_list is None:
assert (
self._faces_padded is not None
), "faces_padded is required to c... | [
"def",
"faces_list",
"(",
"self",
")",
":",
"if",
"self",
".",
"_faces_list",
"is",
"None",
":",
"assert",
"(",
"self",
".",
"_faces_padded",
"is",
"not",
"None",
")",
",",
"\"faces_padded is required to compute faces_list.\"",
"self",
".",
"_faces_list",
"=",
... | https://github.com/facebookresearch/pytorch3d/blob/fddd6a700fa9685c1ce2d4b266c111d7db424ecc/pytorch3d/structures/meshes.py#L538-L552 | |
tortoise/tortoise-orm | 5bf910a3dcd1e729106b7f0dee16aae362d35f46 | tortoise/queryset.py | python | QuerySet.select_related | (self, *fields: str) | return queryset | Return a new QuerySet instance that will select related objects.
If fields are specified, they must be ForeignKey fields and only those
related objects are included in the selection. | Return a new QuerySet instance that will select related objects. | [
"Return",
"a",
"new",
"QuerySet",
"instance",
"that",
"will",
"select",
"related",
"objects",
"."
] | def select_related(self, *fields: str) -> "QuerySet[MODEL]":
"""
Return a new QuerySet instance that will select related objects.
If fields are specified, they must be ForeignKey fields and only those
related objects are included in the selection.
"""
queryset = self._c... | [
"def",
"select_related",
"(",
"self",
",",
"*",
"fields",
":",
"str",
")",
"->",
"\"QuerySet[MODEL]\"",
":",
"queryset",
"=",
"self",
".",
"_clone",
"(",
")",
"for",
"field",
"in",
"fields",
":",
"queryset",
".",
"_select_related",
".",
"add",
"(",
"fiel... | https://github.com/tortoise/tortoise-orm/blob/5bf910a3dcd1e729106b7f0dee16aae362d35f46/tortoise/queryset.py#L800-L811 | |
apple/ccs-calendarserver | 13c706b985fb728b9aab42dc0fef85aae21921c3 | contrib/performance/benchmarks/unbounded_recurrence_autoaccept.py | python | measure | (host, port, dtrace, attendeeCount, samples) | return _measure(
calendar, organizerSequence, events,
host, port, dtrace, samples) | [] | def measure(host, port, dtrace, attendeeCount, samples):
calendar = "unbounded-recurrence-autoaccept"
organizerSequence = 1
# An infinite stream of recurring VEVENTS to PUT to the server.
events = ((i, makeEvent(i, organizerSequence, attendeeCount)) for i in count(2))
return _measure(
cale... | [
"def",
"measure",
"(",
"host",
",",
"port",
",",
"dtrace",
",",
"attendeeCount",
",",
"samples",
")",
":",
"calendar",
"=",
"\"unbounded-recurrence-autoaccept\"",
"organizerSequence",
"=",
"1",
"# An infinite stream of recurring VEVENTS to PUT to the server.",
"events",
"... | https://github.com/apple/ccs-calendarserver/blob/13c706b985fb728b9aab42dc0fef85aae21921c3/contrib/performance/benchmarks/unbounded_recurrence_autoaccept.py#L45-L54 | |||
nilearn/nilearn | 9edba4471747efacf21260bf470a346307f52706 | nilearn/plotting/img_plotting.py | python | _MNI152Template.__str__ | (self) | return "<MNI152Template>" | [] | def __str__(self):
return "<MNI152Template>" | [
"def",
"__str__",
"(",
"self",
")",
":",
"return",
"\"<MNI152Template>\""
] | https://github.com/nilearn/nilearn/blob/9edba4471747efacf21260bf470a346307f52706/nilearn/plotting/img_plotting.py#L384-L385 | |||
pypa/pipenv | b21baade71a86ab3ee1429f71fbc14d4f95fb75d | pipenv/vendor/pythonfinder/_vendor/pep514tools/_registry.py | python | get_value_from_tuple | (value, vtype) | return None | [] | def get_value_from_tuple(value, vtype):
if vtype == winreg.REG_SZ:
if '\0' in value:
return value[:value.index('\0')]
return value
return None | [
"def",
"get_value_from_tuple",
"(",
"value",
",",
"vtype",
")",
":",
"if",
"vtype",
"==",
"winreg",
".",
"REG_SZ",
":",
"if",
"'\\0'",
"in",
"value",
":",
"return",
"value",
"[",
":",
"value",
".",
"index",
"(",
"'\\0'",
")",
"]",
"return",
"value",
... | https://github.com/pypa/pipenv/blob/b21baade71a86ab3ee1429f71fbc14d4f95fb75d/pipenv/vendor/pythonfinder/_vendor/pep514tools/_registry.py#L27-L32 | |||
karmab/kcli | fff2a2632841f54d9346b437821585df0ec659d7 | kvirt/providers/sampleprovider.py | python | Kbase.delete | (self, name, snapshots=False) | return {'result': 'success'} | :param name:
:param snapshots:
:return: | [] | def delete(self, name, snapshots=False):
"""
:param name:
:param snapshots:
:return:
"""
print("not implemented")
return {'result': 'success'} | [
"def",
"delete",
"(",
"self",
",",
"name",
",",
"snapshots",
"=",
"False",
")",
":",
"print",
"(",
"\"not implemented\"",
")",
"return",
"{",
"'result'",
":",
"'success'",
"}"
] | https://github.com/karmab/kcli/blob/fff2a2632841f54d9346b437821585df0ec659d7/kvirt/providers/sampleprovider.py#L262-L270 | ||
mrJean1/PyGeodesy | 7da5ca71aa3edb7bc49e219e0b8190686e1a7965 | pygeodesy/lcc.py | python | Conic.__init__ | (self, latlon0, par1, par2=None, E0=0, N0=0,
k0=1, opt3=0, name=NN, auth=NN) | New Lambert conformal conic projection.
@arg latlon0: Origin with (ellipsoidal) datum (C{LatLon}).
@arg par1: First standard parallel (C{degrees90}).
@kwarg par2: Optional, second standard parallel (C{degrees90}).
@kwarg E0: Optional, false easting (C{meter}).
@kw... | New Lambert conformal conic projection. | [
"New",
"Lambert",
"conformal",
"conic",
"projection",
"."
] | def __init__(self, latlon0, par1, par2=None, E0=0, N0=0,
k0=1, opt3=0, name=NN, auth=NN):
'''New Lambert conformal conic projection.
@arg latlon0: Origin with (ellipsoidal) datum (C{LatLon}).
@arg par1: First standard parallel (C{degrees90}).
@kwarg par2:... | [
"def",
"__init__",
"(",
"self",
",",
"latlon0",
",",
"par1",
",",
"par2",
"=",
"None",
",",
"E0",
"=",
"0",
",",
"N0",
"=",
"0",
",",
"k0",
"=",
"1",
",",
"opt3",
"=",
"0",
",",
"name",
"=",
"NN",
",",
"auth",
"=",
"NN",
")",
":",
"if",
"... | https://github.com/mrJean1/PyGeodesy/blob/7da5ca71aa3edb7bc49e219e0b8190686e1a7965/pygeodesy/lcc.py#L82-L131 | ||
bruderstein/PythonScript | df9f7071ddf3a079e3a301b9b53a6dc78cf1208f | PythonLib/full/asynchat.py | python | async_chat._collect_incoming_data | (self, data) | [] | def _collect_incoming_data(self, data):
self.incoming.append(data) | [
"def",
"_collect_incoming_data",
"(",
"self",
",",
"data",
")",
":",
"self",
".",
"incoming",
".",
"append",
"(",
"data",
")"
] | https://github.com/bruderstein/PythonScript/blob/df9f7071ddf3a079e3a301b9b53a6dc78cf1208f/PythonLib/full/asynchat.py#L92-L93 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.