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
securesystemslab/zippy
ff0e84ac99442c2c55fe1d285332cfd4e185e089
zippy/benchmarks/src/benchmarks/sympy/sympy/functions/elementary/complexes.py
python
sign._eval_is_zero
(self)
return self.args[0].is_zero
[]
def _eval_is_zero(self): return self.args[0].is_zero
[ "def", "_eval_is_zero", "(", "self", ")", ":", "return", "self", ".", "args", "[", "0", "]", ".", "is_zero" ]
https://github.com/securesystemslab/zippy/blob/ff0e84ac99442c2c55fe1d285332cfd4e185e089/zippy/benchmarks/src/benchmarks/sympy/sympy/functions/elementary/complexes.py#L296-L297
SteveDoyle2/pyNastran
eda651ac2d4883d95a34951f8a002ff94f642a1a
pyNastran/op2/tables/geom/dynamics.py
python
DYNAMICS._read_tload1_nx_24
(self, card_obj, data: bytes, n: int)
return n, dloads
Record – TLOAD1(7107,71,138) Word Name Type Description 1 SID I Load set identification number 2 DAREA I DAREA Bulk Data entry identification number 3 DELAYI I DELAY Bulk Data entry identification number 4 TYPE I Nature of the dynamic excitation 5 TID I Ide...
Record – TLOAD1(7107,71,138)
[ "Record", "–", "TLOAD1", "(", "7107", "71", "138", ")" ]
def _read_tload1_nx_24(self, card_obj, data: bytes, n: int) -> Tuple[int, List[TLOAD1]]: """ Record – TLOAD1(7107,71,138) Word Name Type Description 1 SID I Load set identification number 2 DAREA I DAREA Bulk Data entry identification number 3 DELAYI I DELAY Bulk ...
[ "def", "_read_tload1_nx_24", "(", "self", ",", "card_obj", ",", "data", ":", "bytes", ",", "n", ":", "int", ")", "->", "Tuple", "[", "int", ",", "List", "[", "TLOAD1", "]", "]", ":", "op2", "=", "self", ".", "op2", "ntotal", "=", "24", "*", "self...
https://github.com/SteveDoyle2/pyNastran/blob/eda651ac2d4883d95a34951f8a002ff94f642a1a/pyNastran/op2/tables/geom/dynamics.py#L2067-L2102
jhpyle/docassemble
b90c84e57af59aa88b3404d44d0b125c70f832cc
docassemble_base/docassemble/base/mako/codegen.py
python
_GenerateRenderMethod.write_def_decl
(self, node, identifiers)
write a locally-available callable referencing a top-level def
write a locally-available callable referencing a top-level def
[ "write", "a", "locally", "-", "available", "callable", "referencing", "a", "top", "-", "level", "def" ]
def write_def_decl(self, node, identifiers): """write a locally-available callable referencing a top-level def""" funcname = node.funcname namedecls = node.get_argument_expressions() nameargs = node.get_argument_expressions(as_call=True) if not self.in_def and ( ...
[ "def", "write_def_decl", "(", "self", ",", "node", ",", "identifiers", ")", ":", "funcname", "=", "node", ".", "funcname", "namedecls", "=", "node", ".", "get_argument_expressions", "(", ")", "nameargs", "=", "node", ".", "get_argument_expressions", "(", "as_c...
https://github.com/jhpyle/docassemble/blob/b90c84e57af59aa88b3404d44d0b125c70f832cc/docassemble_base/docassemble/base/mako/codegen.py#L584-L599
usnistgov/fipy
6809b180b41a11de988a48655575df7e142c93b9
fipy/matrices/trilinosMatrix.py
python
_TrilinosMatrix._getDistributedMatrix
(self)
Returns an equivalent Trilinos matrix, but redistributed evenly over all processors.
Returns an equivalent Trilinos matrix, but redistributed evenly over all processors.
[ "Returns", "an", "equivalent", "Trilinos", "matrix", "but", "redistributed", "evenly", "over", "all", "processors", "." ]
def _getDistributedMatrix(self): """ Returns an equivalent Trilinos matrix, but redistributed evenly over all processors. """ if self.comm.NumProc() == 1: return self.matrix # No redistribution necessary in serial mode else: ## self._mat...
[ "def", "_getDistributedMatrix", "(", "self", ")", ":", "if", "self", ".", "comm", ".", "NumProc", "(", ")", "==", "1", ":", "return", "self", ".", "matrix", "# No redistribution necessary in serial mode", "else", ":", "## self._matrix.GlobalAssemble()", "...
https://github.com/usnistgov/fipy/blob/6809b180b41a11de988a48655575df7e142c93b9/fipy/matrices/trilinosMatrix.py#L506-L527
marinho/geraldo
868ebdce67176d9b6205cddc92476f642c783fff
site/newsite/django_1_0/django/forms/formsets.py
python
BaseFormSet.add_fields
(self, form, index)
A hook for adding extra fields on to each form instance.
A hook for adding extra fields on to each form instance.
[ "A", "hook", "for", "adding", "extra", "fields", "on", "to", "each", "form", "instance", "." ]
def add_fields(self, form, index): """A hook for adding extra fields on to each form instance.""" if self.can_order: # Only pre-fill the ordering field for initial forms. if index < self._initial_form_count: form.fields[ORDERING_FIELD_NAME] = IntegerField(label='O...
[ "def", "add_fields", "(", "self", ",", "form", ",", "index", ")", ":", "if", "self", ".", "can_order", ":", "# Only pre-fill the ordering field for initial forms.", "if", "index", "<", "self", ".", "_initial_form_count", ":", "form", ".", "fields", "[", "ORDERIN...
https://github.com/marinho/geraldo/blob/868ebdce67176d9b6205cddc92476f642c783fff/site/newsite/django_1_0/django/forms/formsets.py#L236-L245
DLR-RM/stable-baselines3
e9a8979022d7005560d43b7a9c1dc1ba85f7989a
stable_baselines3/common/vec_env/subproc_vec_env.py
python
SubprocVecEnv.set_attr
(self, attr_name: str, value: Any, indices: VecEnvIndices = None)
Set attribute inside vectorized environments (see base class).
Set attribute inside vectorized environments (see base class).
[ "Set", "attribute", "inside", "vectorized", "environments", "(", "see", "base", "class", ")", "." ]
def set_attr(self, attr_name: str, value: Any, indices: VecEnvIndices = None) -> None: """Set attribute inside vectorized environments (see base class).""" target_remotes = self._get_target_remotes(indices) for remote in target_remotes: remote.send(("set_attr", (attr_name, value))) ...
[ "def", "set_attr", "(", "self", ",", "attr_name", ":", "str", ",", "value", ":", "Any", ",", "indices", ":", "VecEnvIndices", "=", "None", ")", "->", "None", ":", "target_remotes", "=", "self", ".", "_get_target_remotes", "(", "indices", ")", "for", "rem...
https://github.com/DLR-RM/stable-baselines3/blob/e9a8979022d7005560d43b7a9c1dc1ba85f7989a/stable_baselines3/common/vec_env/subproc_vec_env.py#L163-L169
hudora/pyShipping
089c502db5d79182dbd69f0b95c475e0eddda355
pyshipping/shipment.py
python
AbstractLieferung.export_karton_gewichte
(self)
return ret
Returns the weights of the estimated number of packages which will be shipped in gramms.
Returns the weights of the estimated number of packages which will be shipped in gramms.
[ "Returns", "the", "weights", "of", "the", "estimated", "number", "of", "packages", "which", "will", "be", "shipped", "in", "gramms", "." ]
def export_karton_gewichte(self): """Returns the weights of the estimated number of packages which will be shipped in gramms.""" ret = [] for box in self.itemlist: ret.extend(box.export_karton_gewichte) return ret
[ "def", "export_karton_gewichte", "(", "self", ")", ":", "ret", "=", "[", "]", "for", "box", "in", "self", ".", "itemlist", ":", "ret", ".", "extend", "(", "box", ".", "export_karton_gewichte", ")", "return", "ret" ]
https://github.com/hudora/pyShipping/blob/089c502db5d79182dbd69f0b95c475e0eddda355/pyshipping/shipment.py#L193-L198
entropy1337/infernal-twin
10995cd03312e39a48ade0f114ebb0ae3a711bb8
Modules/build/reportlab/src/reportlab/pdfgen/textobject.py
python
_PDFColorSetter.setStrokeColor
(self, aColor, alpha=None)
Takes a color object, allowing colors to be referred to by name
Takes a color object, allowing colors to be referred to by name
[ "Takes", "a", "color", "object", "allowing", "colors", "to", "be", "referred", "to", "by", "name" ]
def setStrokeColor(self, aColor, alpha=None): """Takes a color object, allowing colors to be referred to by name""" if self._enforceColorSpace: aColor = self._enforceColorSpace(aColor) if isinstance(aColor, CMYKColor): d = aColor.density c,m,y,k = (d*aColor.cy...
[ "def", "setStrokeColor", "(", "self", ",", "aColor", ",", "alpha", "=", "None", ")", ":", "if", "self", ".", "_enforceColorSpace", ":", "aColor", "=", "self", ".", "_enforceColorSpace", "(", "aColor", ")", "if", "isinstance", "(", "aColor", ",", "CMYKColor...
https://github.com/entropy1337/infernal-twin/blob/10995cd03312e39a48ade0f114ebb0ae3a711bb8/Modules/build/reportlab/src/reportlab/pdfgen/textobject.py#L101-L135
HymanLiuTS/flaskTs
286648286976e85d9b9a5873632331efcafe0b21
flasky/lib/python2.7/site-packages/sqlalchemy/orm/events.py
python
MapperEvents.before_delete
(self, mapper, connection, target)
Receive an object instance before a DELETE statement is emitted corresponding to that instance. This event is used to emit additional SQL statements on the given connection as well as to perform application specific bookkeeping related to a deletion event. The event is often ca...
Receive an object instance before a DELETE statement is emitted corresponding to that instance.
[ "Receive", "an", "object", "instance", "before", "a", "DELETE", "statement", "is", "emitted", "corresponding", "to", "that", "instance", "." ]
def before_delete(self, mapper, connection, target): """Receive an object instance before a DELETE statement is emitted corresponding to that instance. This event is used to emit additional SQL statements on the given connection as well as to perform application specific bookkee...
[ "def", "before_delete", "(", "self", ",", "mapper", ",", "connection", ",", "target", ")", ":" ]
https://github.com/HymanLiuTS/flaskTs/blob/286648286976e85d9b9a5873632331efcafe0b21/flasky/lib/python2.7/site-packages/sqlalchemy/orm/events.py#L1033-L1071
neulab/compare-mt
df40d8db4a4f19e755dab0c888b984899f1cd32b
compare_mt/compare_ll_main.py
python
print_word_likelihood_report
(ref, lls, bucket_type='freq', bucket_cutoffs=None, freq_count_file=None, freq_corpus_file=None, label_corpus=None, label_set=None, case_insensitive=False)
Print a report comparing the word log likelihood. Args: ref: the ref of words over which the likelihoods are computed lls: likelihoods corresponding to each word in ref from the systems bucket_type: A string specifying the way to bucket words together to calculate average likelihood bucket_cutoffs: The bound...
Print a report comparing the word log likelihood.
[ "Print", "a", "report", "comparing", "the", "word", "log", "likelihood", "." ]
def print_word_likelihood_report(ref, lls, bucket_type='freq', bucket_cutoffs=None, freq_count_file=None, freq_corpus_file=None, label_corpus=None, label_set=None, case_insensitive=False): """ Print a report comparing the word log likelih...
[ "def", "print_word_likelihood_report", "(", "ref", ",", "lls", ",", "bucket_type", "=", "'freq'", ",", "bucket_cutoffs", "=", "None", ",", "freq_count_file", "=", "None", ",", "freq_corpus_file", "=", "None", ",", "label_corpus", "=", "None", ",", "label_set", ...
https://github.com/neulab/compare-mt/blob/df40d8db4a4f19e755dab0c888b984899f1cd32b/compare_mt/compare_ll_main.py#L10-L51
buke/GreenOdoo
3d8c55d426fb41fdb3f2f5a1533cfe05983ba1df
runtime/python/lib/python2.7/decimal.py
python
Context.remainder_near
(self, a, b)
return a.remainder_near(b, context=self)
Returns to be "a - b * n", where n is the integer nearest the exact value of "x / b" (if two integers are equally near then the even one is chosen). If the result is equal to 0 then its sign will be the sign of a. This operation will fail under the same conditions as integer division ...
Returns to be "a - b * n", where n is the integer nearest the exact value of "x / b" (if two integers are equally near then the even one is chosen). If the result is equal to 0 then its sign will be the sign of a.
[ "Returns", "to", "be", "a", "-", "b", "*", "n", "where", "n", "is", "the", "integer", "nearest", "the", "exact", "value", "of", "x", "/", "b", "(", "if", "two", "integers", "are", "equally", "near", "then", "the", "even", "one", "is", "chosen", ")"...
def remainder_near(self, a, b): """Returns to be "a - b * n", where n is the integer nearest the exact value of "x / b" (if two integers are equally near then the even one is chosen). If the result is equal to 0 then its sign will be the sign of a. This operation will fail unde...
[ "def", "remainder_near", "(", "self", ",", "a", ",", "b", ")", ":", "a", "=", "_convert_other", "(", "a", ",", "raiseit", "=", "True", ")", "return", "a", ".", "remainder_near", "(", "b", ",", "context", "=", "self", ")" ]
https://github.com/buke/GreenOdoo/blob/3d8c55d426fb41fdb3f2f5a1533cfe05983ba1df/runtime/python/lib/python2.7/decimal.py#L5149-L5181
aceisace/Inkycal
552744bc5d80769c1015d48fd8b13201683ee679
inkycal/display/drivers/epdconfig.py
python
JetsonNano.module_init
(self)
return 0
[]
def module_init(self): self.GPIO.setmode(self.GPIO.BCM) self.GPIO.setwarnings(False) self.GPIO.setup(self.RST_PIN, self.GPIO.OUT) self.GPIO.setup(self.DC_PIN, self.GPIO.OUT) self.GPIO.setup(self.CS_PIN, self.GPIO.OUT) self.GPIO.setup(self.BUSY_PIN, self.GPIO.IN) s...
[ "def", "module_init", "(", "self", ")", ":", "self", ".", "GPIO", ".", "setmode", "(", "self", ".", "GPIO", ".", "BCM", ")", "self", ".", "GPIO", ".", "setwarnings", "(", "False", ")", "self", ".", "GPIO", ".", "setup", "(", "self", ".", "RST_PIN",...
https://github.com/aceisace/Inkycal/blob/552744bc5d80769c1015d48fd8b13201683ee679/inkycal/display/drivers/epdconfig.py#L126-L134
kubernetes-client/python
47b9da9de2d02b2b7a34fbe05afb44afd130d73a
kubernetes/client/models/v1_replica_set.py
python
V1ReplicaSet.status
(self, status)
Sets the status of this V1ReplicaSet. :param status: The status of this V1ReplicaSet. # noqa: E501 :type: V1ReplicaSetStatus
Sets the status of this V1ReplicaSet.
[ "Sets", "the", "status", "of", "this", "V1ReplicaSet", "." ]
def status(self, status): """Sets the status of this V1ReplicaSet. :param status: The status of this V1ReplicaSet. # noqa: E501 :type: V1ReplicaSetStatus """ self._status = status
[ "def", "status", "(", "self", ",", "status", ")", ":", "self", ".", "_status", "=", "status" ]
https://github.com/kubernetes-client/python/blob/47b9da9de2d02b2b7a34fbe05afb44afd130d73a/kubernetes/client/models/v1_replica_set.py#L174-L182
oracle/graalpython
577e02da9755d916056184ec441c26e00b70145c
graalpython/lib-python/3/lib2to3/patcomp.py
python
PatternCompiler.get_int
(self, node)
return int(node.value)
[]
def get_int(self, node): assert node.type == token.NUMBER return int(node.value)
[ "def", "get_int", "(", "self", ",", "node", ")", ":", "assert", "node", ".", "type", "==", "token", ".", "NUMBER", "return", "int", "(", "node", ".", "value", ")" ]
https://github.com/oracle/graalpython/blob/577e02da9755d916056184ec441c26e00b70145c/graalpython/lib-python/3/lib2to3/patcomp.py#L173-L175
tornadoweb/tornado
208672f3bf6cbb7e37f54c356e02a71ca29f1e02
tornado/ioloop.py
python
IOLoop.instance
()
return IOLoop.current()
Deprecated alias for `IOLoop.current()`. .. versionchanged:: 5.0 Previously, this method returned a global singleton `IOLoop`, in contrast with the per-thread `IOLoop` returned by `current()`. In nearly all cases the two were the same (when they differed, it was gen...
Deprecated alias for `IOLoop.current()`.
[ "Deprecated", "alias", "for", "IOLoop", ".", "current", "()", "." ]
def instance() -> "IOLoop": """Deprecated alias for `IOLoop.current()`. .. versionchanged:: 5.0 Previously, this method returned a global singleton `IOLoop`, in contrast with the per-thread `IOLoop` returned by `current()`. In nearly all cases the two were the same ...
[ "def", "instance", "(", ")", "->", "\"IOLoop\"", ":", "return", "IOLoop", ".", "current", "(", ")" ]
https://github.com/tornadoweb/tornado/blob/208672f3bf6cbb7e37f54c356e02a71ca29f1e02/tornado/ioloop.py#L181-L200
atlassian-api/atlassian-python-api
6d8545a790c3aae10b75bdc225fb5c3a0aee44db
atlassian/service_desk.py
python
ServiceDesk.get_service_desk_by_id
(self, service_desk_id)
return self.get( "rest/servicedeskapi/servicedesk/{}".format(service_desk_id), headers=self.experimental_headers, )
Returns the service desk for a given service desk ID :param service_desk_id: str :return: Service Desk
Returns the service desk for a given service desk ID
[ "Returns", "the", "service", "desk", "for", "a", "given", "service", "desk", "ID" ]
def get_service_desk_by_id(self, service_desk_id): """ Returns the service desk for a given service desk ID :param service_desk_id: str :return: Service Desk """ return self.get( "rest/servicedeskapi/servicedesk/{}".format(service_desk_id), heade...
[ "def", "get_service_desk_by_id", "(", "self", ",", "service_desk_id", ")", ":", "return", "self", ".", "get", "(", "\"rest/servicedeskapi/servicedesk/{}\"", ".", "format", "(", "service_desk_id", ")", ",", "headers", "=", "self", ".", "experimental_headers", ",", ...
https://github.com/atlassian-api/atlassian-python-api/blob/6d8545a790c3aae10b75bdc225fb5c3a0aee44db/atlassian/service_desk.py#L33-L44
shiyanlou/louplus-python
4c61697259e286e3d9116c3299f170d019ba3767
taobei/challenge-05/tbweb/handlers/order.py
python
create
()
return render_template('order/create.html', form=form, cart_products=cart_products)
创建订单
创建订单
[ "创建订单" ]
def create(): """创建订单 """ form = OrderForm() resp = TbUser(current_app).get_json('/addresses', params={ 'user_id': current_user.get_id(), }) addresses = resp['data']['addresses'] form.address_id.choices = [(str(v['id']), v['address']) for v in addresses] for addresse in address...
[ "def", "create", "(", ")", ":", "form", "=", "OrderForm", "(", ")", "resp", "=", "TbUser", "(", "current_app", ")", ".", "get_json", "(", "'/addresses'", ",", "params", "=", "{", "'user_id'", ":", "current_user", ".", "get_id", "(", ")", ",", "}", ")...
https://github.com/shiyanlou/louplus-python/blob/4c61697259e286e3d9116c3299f170d019ba3767/taobei/challenge-05/tbweb/handlers/order.py#L72-L147
angr/angr
4b04d56ace135018083d36d9083805be8146688b
angr/analyses/identifier/functions/recv_until.py
python
receive_until.args
(self)
return [a[order] for order in self.arg_order]
[]
def args(self): a = self.base_args() return [a[order] for order in self.arg_order]
[ "def", "args", "(", "self", ")", ":", "a", "=", "self", ".", "base_args", "(", ")", "return", "[", "a", "[", "order", "]", "for", "order", "in", "self", ".", "arg_order", "]" ]
https://github.com/angr/angr/blob/4b04d56ace135018083d36d9083805be8146688b/angr/analyses/identifier/functions/recv_until.py#L182-L184
miyosuda/unreal
31d4886149412fa248f6efa490ab65bd2f425cde
environment/lab_environment.py
python
LabEnvironment.process
(self, action)
return state, reward, terminal, pixel_change
[]
def process(self, action): real_action = LabEnvironment.ACTION_LIST[action] self.conn.send([COMMAND_ACTION, real_action]) obs, reward, terminal = self.conn.recv() if not terminal: state = self._preprocess_frame(obs) else: state = self.last_state pixel_change = self._calc_pixel...
[ "def", "process", "(", "self", ",", "action", ")", ":", "real_action", "=", "LabEnvironment", ".", "ACTION_LIST", "[", "action", "]", "self", ".", "conn", ".", "send", "(", "[", "COMMAND_ACTION", ",", "real_action", "]", ")", "obs", ",", "reward", ",", ...
https://github.com/miyosuda/unreal/blob/31d4886149412fa248f6efa490ab65bd2f425cde/environment/lab_environment.py#L104-L119
mtivadar/qiew
87a3b96b43f1745a6b3f1fcfebce5164d2a40a14
plugins/unpack/basic.py
python
basic.proceed
(self)
[]
def proceed(self): if self.viewMode.selector.getCurrentSelection(): u, v = self.viewMode.selector.getCurrentSelection() # prepare values vrom text boxes op = str(self.ui.op.currentText()) key = str(self.ui.key.text()) if key: ...
[ "def", "proceed", "(", "self", ")", ":", "if", "self", ".", "viewMode", ".", "selector", ".", "getCurrentSelection", "(", ")", ":", "u", ",", "v", "=", "self", ".", "viewMode", ".", "selector", ".", "getCurrentSelection", "(", ")", "# prepare values vrom t...
https://github.com/mtivadar/qiew/blob/87a3b96b43f1745a6b3f1fcfebce5164d2a40a14/plugins/unpack/basic.py#L64-L140
haiwen/seahub
e92fcd44e3e46260597d8faa9347cb8222b8b10d
seahub/utils/htmldiff.py
python
_format_range_context
(start, stop)
return '{},{}'.format(beginning, beginning + length - 1)
Convert range to the "ed" format
Convert range to the "ed" format
[ "Convert", "range", "to", "the", "ed", "format" ]
def _format_range_context(start, stop): 'Convert range to the "ed" format' # Per the diff spec at http://www.unix.org/single_unix_specification/ beginning = start + 1 # lines start numbering with one length = stop - start if not length: beginning -= 1 # empty ranges begin at line ...
[ "def", "_format_range_context", "(", "start", ",", "stop", ")", ":", "# Per the diff spec at http://www.unix.org/single_unix_specification/", "beginning", "=", "start", "+", "1", "# lines start numbering with one", "length", "=", "stop", "-", "start", "if", "not", "length...
https://github.com/haiwen/seahub/blob/e92fcd44e3e46260597d8faa9347cb8222b8b10d/seahub/utils/htmldiff.py#L1224-L1233
microsoft/azure-devops-python-api
451cade4c475482792cbe9e522c1fee32393139e
azure-devops/azure/devops/v6_0/work_item_tracking/work_item_tracking_client.py
python
WorkItemTrackingClient.get_work_item_icon_xaml
(self, icon, color=None, v=None, **kwargs)
return self._client.stream_download(response, callback=callback)
GetWorkItemIconXaml. [Preview API] Get a work item icon given the friendly name and icon color. :param str icon: The name of the icon :param str color: The 6-digit hex color for the icon :param int v: The version of the icon (used only for cache invalidation) :rtype: object
GetWorkItemIconXaml. [Preview API] Get a work item icon given the friendly name and icon color. :param str icon: The name of the icon :param str color: The 6-digit hex color for the icon :param int v: The version of the icon (used only for cache invalidation) :rtype: object
[ "GetWorkItemIconXaml", ".", "[", "Preview", "API", "]", "Get", "a", "work", "item", "icon", "given", "the", "friendly", "name", "and", "icon", "color", ".", ":", "param", "str", "icon", ":", "The", "name", "of", "the", "icon", ":", "param", "str", "col...
def get_work_item_icon_xaml(self, icon, color=None, v=None, **kwargs): """GetWorkItemIconXaml. [Preview API] Get a work item icon given the friendly name and icon color. :param str icon: The name of the icon :param str color: The 6-digit hex color for the icon :param int v: The v...
[ "def", "get_work_item_icon_xaml", "(", "self", ",", "icon", ",", "color", "=", "None", ",", "v", "=", "None", ",", "*", "*", "kwargs", ")", ":", "route_values", "=", "{", "}", "if", "icon", "is", "not", "None", ":", "route_values", "[", "'icon'", "]"...
https://github.com/microsoft/azure-devops-python-api/blob/451cade4c475482792cbe9e522c1fee32393139e/azure-devops/azure/devops/v6_0/work_item_tracking/work_item_tracking_client.py#L1499-L1525
ibis-project/ibis
e1ef8b6870ac53de9d1fe5c52851fa41872109c4
ibis/expr/api.py
python
_integer_to_interval
(arg, unit='s')
return op.to_expr()
Convert integer interval with the same inner type Parameters ---------- unit : {'Y', 'M', 'W', 'D', 'h', 'm', s', 'ms', 'us', 'ns'} Returns ------- interval : interval value expression
Convert integer interval with the same inner type
[ "Convert", "integer", "interval", "with", "the", "same", "inner", "type" ]
def _integer_to_interval(arg, unit='s'): """ Convert integer interval with the same inner type Parameters ---------- unit : {'Y', 'M', 'W', 'D', 'h', 'm', s', 'ms', 'us', 'ns'} Returns ------- interval : interval value expression """ op = ops.IntervalFromInteger(arg, unit) ...
[ "def", "_integer_to_interval", "(", "arg", ",", "unit", "=", "'s'", ")", ":", "op", "=", "ops", ".", "IntervalFromInteger", "(", "arg", ",", "unit", ")", "return", "op", ".", "to_expr", "(", ")" ]
https://github.com/ibis-project/ibis/blob/e1ef8b6870ac53de9d1fe5c52851fa41872109c4/ibis/expr/api.py#L1396-L1409
soeaver/Pytorch_Mask_RCNN
aaee46490340cec83c2fbd72471c4020786c5266
tasks/merge_task.py
python
build_rpn_targets
(image_shape, anchors, gt_class_ids, gt_boxes, config)
return rpn_match, rpn_bbox
Given the anchors and GT boxes, compute overlaps and identify positive anchors and deltas to refine them to match their corresponding GT boxes. anchors: [num_anchors, (y1, x1, y2, x2)] gt_class_ids: [num_gt_boxes] Integer class IDs. gt_boxes: [num_gt_boxes, (y1, x1, y2, x2)] Returns: rpn_match...
Given the anchors and GT boxes, compute overlaps and identify positive anchors and deltas to refine them to match their corresponding GT boxes.
[ "Given", "the", "anchors", "and", "GT", "boxes", "compute", "overlaps", "and", "identify", "positive", "anchors", "and", "deltas", "to", "refine", "them", "to", "match", "their", "corresponding", "GT", "boxes", "." ]
def build_rpn_targets(image_shape, anchors, gt_class_ids, gt_boxes, config): """Given the anchors and GT boxes, compute overlaps and identify positive anchors and deltas to refine them to match their corresponding GT boxes. anchors: [num_anchors, (y1, x1, y2, x2)] gt_class_ids: [num_gt_boxes] Integer c...
[ "def", "build_rpn_targets", "(", "image_shape", ",", "anchors", ",", "gt_class_ids", ",", "gt_boxes", ",", "config", ")", ":", "# RPN Match: 1 = positive anchor, -1 = negative anchor, 0 = neutral", "rpn_match", "=", "np", ".", "zeros", "(", "[", "anchors", ".", "shape...
https://github.com/soeaver/Pytorch_Mask_RCNN/blob/aaee46490340cec83c2fbd72471c4020786c5266/tasks/merge_task.py#L9-L117
opteroncx/MoePhoto
00d7c4f9df861a7882f6b35828c5461672238542
python/models.py
python
pixel_unshuffle
(scale)
return f
Pixel unshuffle. Args: x (Tensor): Input feature with shape (b, c, hh, hw). scale (int): Downsample ratio. Returns: Tensor: the pixel unshuffled feature.
Pixel unshuffle. Args: x (Tensor): Input feature with shape (b, c, hh, hw). scale (int): Downsample ratio. Returns: Tensor: the pixel unshuffled feature.
[ "Pixel", "unshuffle", ".", "Args", ":", "x", "(", "Tensor", ")", ":", "Input", "feature", "with", "shape", "(", "b", "c", "hh", "hw", ")", ".", "scale", "(", "int", ")", ":", "Downsample", "ratio", ".", "Returns", ":", "Tensor", ":", "the", "pixel"...
def pixel_unshuffle(scale): """ Pixel unshuffle. Args: x (Tensor): Input feature with shape (b, c, hh, hw). scale (int): Downsample ratio. Returns: Tensor: the pixel unshuffled feature. """ if scale == 1: return lambda x: x def f(x): b, c, hh, hw = x.size() out_channel = c * (s...
[ "def", "pixel_unshuffle", "(", "scale", ")", ":", "if", "scale", "==", "1", ":", "return", "lambda", "x", ":", "x", "def", "f", "(", "x", ")", ":", "b", ",", "c", ",", "hh", ",", "hw", "=", "x", ".", "size", "(", ")", "out_channel", "=", "c",...
https://github.com/opteroncx/MoePhoto/blob/00d7c4f9df861a7882f6b35828c5461672238542/python/models.py#L414-L432
Chaffelson/nipyapi
d3b186fd701ce308c2812746d98af9120955e810
nipyapi/nifi/models/bucket.py
python
Bucket.allow_bundle_redeploy
(self)
return self._allow_bundle_redeploy
Gets the allow_bundle_redeploy of this Bucket. Indicates if this bucket allows the same version of an extension bundle to be redeployed and thus overwrite the existing artifact. By default this is false. :return: The allow_bundle_redeploy of this Bucket. :rtype: bool
Gets the allow_bundle_redeploy of this Bucket. Indicates if this bucket allows the same version of an extension bundle to be redeployed and thus overwrite the existing artifact. By default this is false.
[ "Gets", "the", "allow_bundle_redeploy", "of", "this", "Bucket", ".", "Indicates", "if", "this", "bucket", "allows", "the", "same", "version", "of", "an", "extension", "bundle", "to", "be", "redeployed", "and", "thus", "overwrite", "the", "existing", "artifact", ...
def allow_bundle_redeploy(self): """ Gets the allow_bundle_redeploy of this Bucket. Indicates if this bucket allows the same version of an extension bundle to be redeployed and thus overwrite the existing artifact. By default this is false. :return: The allow_bundle_redeploy of this Buc...
[ "def", "allow_bundle_redeploy", "(", "self", ")", ":", "return", "self", ".", "_allow_bundle_redeploy" ]
https://github.com/Chaffelson/nipyapi/blob/d3b186fd701ce308c2812746d98af9120955e810/nipyapi/nifi/models/bucket.py#L210-L218
oilshell/oil
94388e7d44a9ad879b12615f6203b38596b5a2d3
Python-2.7.13/Lib/idlelib/StackViewer.py
python
VariablesTreeItem.keys
(self)
return self.object.keys()
[]
def keys(self): # unused, left for possible 3rd party use return self.object.keys()
[ "def", "keys", "(", "self", ")", ":", "# unused, left for possible 3rd party use", "return", "self", ".", "object", ".", "keys", "(", ")" ]
https://github.com/oilshell/oil/blob/94388e7d44a9ad879b12615f6203b38596b5a2d3/Python-2.7.13/Lib/idlelib/StackViewer.py#L123-L124
zyfra/ebonite
b01b662c43709d152940f488574d78ff25f89ecf
src/ebonite/core/objects/core.py
python
_WithBuilder.unbind_builder
(self)
[]
def unbind_builder(self): del self.builder
[ "def", "unbind_builder", "(", "self", ")", ":", "del", "self", ".", "builder" ]
https://github.com/zyfra/ebonite/blob/b01b662c43709d152940f488574d78ff25f89ecf/src/ebonite/core/objects/core.py#L1511-L1512
gwastro/pycbc
1e1c85534b9dba8488ce42df693230317ca63dea
pycbc/inference/io/multinest.py
python
MultinestFile.write_resume_point
(self)
Keeps a list of the number of iterations that were in a file when a run was resumed from a checkpoint.
Keeps a list of the number of iterations that were in a file when a run was resumed from a checkpoint.
[ "Keeps", "a", "list", "of", "the", "number", "of", "iterations", "that", "were", "in", "a", "file", "when", "a", "run", "was", "resumed", "from", "a", "checkpoint", "." ]
def write_resume_point(self): """Keeps a list of the number of iterations that were in a file when a run was resumed from a checkpoint.""" try: resume_pts = self.attrs["resume_points"].tolist() except KeyError: resume_pts = [] try: niterations ...
[ "def", "write_resume_point", "(", "self", ")", ":", "try", ":", "resume_pts", "=", "self", ".", "attrs", "[", "\"resume_points\"", "]", ".", "tolist", "(", ")", "except", "KeyError", ":", "resume_pts", "=", "[", "]", "try", ":", "niterations", "=", "self...
https://github.com/gwastro/pycbc/blob/1e1c85534b9dba8488ce42df693230317ca63dea/pycbc/inference/io/multinest.py#L106-L118
twilio/twilio-python
6e1e811ea57a1edfadd5161ace87397c563f6915
twilio/rest/api/v2010/account/conference/recording.py
python
RecordingList.page
(self, date_created_before=values.unset, date_created=values.unset, date_created_after=values.unset, page_token=values.unset, page_number=values.unset, page_size=values.unset)
return RecordingPage(self._version, response, self._solution)
Retrieve a single page of RecordingInstance records from the API. Request is executed immediately :param date date_created_before: The `YYYY-MM-DD` value of the resources to read :param date date_created: The `YYYY-MM-DD` value of the resources to read :param date date_created_after: Th...
Retrieve a single page of RecordingInstance records from the API. Request is executed immediately
[ "Retrieve", "a", "single", "page", "of", "RecordingInstance", "records", "from", "the", "API", ".", "Request", "is", "executed", "immediately" ]
def page(self, date_created_before=values.unset, date_created=values.unset, date_created_after=values.unset, page_token=values.unset, page_number=values.unset, page_size=values.unset): """ Retrieve a single page of RecordingInstance records from the API. Request is exec...
[ "def", "page", "(", "self", ",", "date_created_before", "=", "values", ".", "unset", ",", "date_created", "=", "values", ".", "unset", ",", "date_created_after", "=", "values", ".", "unset", ",", "page_token", "=", "values", ".", "unset", ",", "page_number",...
https://github.com/twilio/twilio-python/blob/6e1e811ea57a1edfadd5161ace87397c563f6915/twilio/rest/api/v2010/account/conference/recording.py#L97-L125
HymanLiuTS/flaskTs
286648286976e85d9b9a5873632331efcafe0b21
flasky/lib/python2.7/site-packages/pkg_resources/_vendor/pyparsing.py
python
_xml_escape
(data)
return data
Escape &, <, >, ", ', etc. in a string of data.
Escape &, <, >, ", ', etc. in a string of data.
[ "Escape", "&", "<", ">", "etc", ".", "in", "a", "string", "of", "data", "." ]
def _xml_escape(data): """Escape &, <, >, ", ', etc. in a string of data.""" # ampersand must be replaced first from_symbols = '&><"\'' to_symbols = ('&'+s+';' for s in "amp gt lt quot apos".split()) for from_,to_ in zip(from_symbols, to_symbols): data = data.replace(from_, to_) return ...
[ "def", "_xml_escape", "(", "data", ")", ":", "# ampersand must be replaced first", "from_symbols", "=", "'&><\"\\''", "to_symbols", "=", "(", "'&'", "+", "s", "+", "';'", "for", "s", "in", "\"amp gt lt quot apos\"", ".", "split", "(", ")", ")", "for", "from_",...
https://github.com/HymanLiuTS/flaskTs/blob/286648286976e85d9b9a5873632331efcafe0b21/flasky/lib/python2.7/site-packages/pkg_resources/_vendor/pyparsing.py#L162-L170
statsmodels/statsmodels
debbe7ea6ba28fe5bdb78f09f8cac694bef98722
statsmodels/genmod/cov_struct.py
python
GlobalOddsRatio.get_eyy
(self, endog_expval, index)
return vmat
Returns a matrix V such that V[i,j] is the joint probability that endog[i] = 1 and endog[j] = 1, based on the marginal probabilities of endog and the global odds ratio `current_or`.
Returns a matrix V such that V[i,j] is the joint probability that endog[i] = 1 and endog[j] = 1, based on the marginal probabilities of endog and the global odds ratio `current_or`.
[ "Returns", "a", "matrix", "V", "such", "that", "V", "[", "i", "j", "]", "is", "the", "joint", "probability", "that", "endog", "[", "i", "]", "=", "1", "and", "endog", "[", "j", "]", "=", "1", "based", "on", "the", "marginal", "probabilities", "of",...
def get_eyy(self, endog_expval, index): """ Returns a matrix V such that V[i,j] is the joint probability that endog[i] = 1 and endog[j] = 1, based on the marginal probabilities of endog and the global odds ratio `current_or`. """ current_or = self.dep_params ibd ...
[ "def", "get_eyy", "(", "self", ",", "endog_expval", ",", "index", ")", ":", "current_or", "=", "self", ".", "dep_params", "ibd", "=", "self", ".", "ibd", "[", "index", "]", "# The between-observation joint probabilities", "if", "current_or", "==", "1.0", ":", ...
https://github.com/statsmodels/statsmodels/blob/debbe7ea6ba28fe5bdb78f09f8cac694bef98722/statsmodels/genmod/cov_struct.py#L1169-L1199
usb-tools/Facedancer
e688fe61dc34087db333432394e1f90e52ac3794
facedancer/USBProxy.py
python
USBProxyDevice._proxy_out_request
(self, req)
Proxy OUT requests, which sends a request from the victim to the target device.
Proxy OUT requests, which sends a request from the victim to the target device.
[ "Proxy", "OUT", "requests", "which", "sends", "a", "request", "from", "the", "victim", "to", "the", "target", "device", "." ]
def _proxy_out_request(self, req): """ Proxy OUT requests, which sends a request from the victim to the target device. """ data = req.data for f in self.filter_list: req, data = f.filter_control_out(req, data) # ... forward the request to the real d...
[ "def", "_proxy_out_request", "(", "self", ",", "req", ")", ":", "data", "=", "req", ".", "data", "for", "f", "in", "self", ".", "filter_list", ":", "req", ",", "data", "=", "f", ".", "filter_control_out", "(", "req", ",", "data", ")", "# ... forward th...
https://github.com/usb-tools/Facedancer/blob/e688fe61dc34087db333432394e1f90e52ac3794/facedancer/USBProxy.py#L287-L313
openstack/cinder
23494a6d6c51451688191e1847a458f1d3cdcaa5
cinder/volume/drivers/qnap.py
python
QnapAPIExecutor.get_all_iscsi_portal_setting
(self)
return res_details
Execute get_all_iscsi_portal_setting API.
Execute get_all_iscsi_portal_setting API.
[ "Execute", "get_all_iscsi_portal_setting", "API", "." ]
def get_all_iscsi_portal_setting(self): """Execute get_all_iscsi_portal_setting API.""" res_details = self._get_res_details( '/cgi-bin/disk/iscsi_portal_setting.cgi?', func='get_all', sid=self.sid) return res_details
[ "def", "get_all_iscsi_portal_setting", "(", "self", ")", ":", "res_details", "=", "self", ".", "_get_res_details", "(", "'/cgi-bin/disk/iscsi_portal_setting.cgi?'", ",", "func", "=", "'get_all'", ",", "sid", "=", "self", ".", "sid", ")", "return", "res_details" ]
https://github.com/openstack/cinder/blob/23494a6d6c51451688191e1847a458f1d3cdcaa5/cinder/volume/drivers/qnap.py#L1702-L1709
openstack/octavia
27e5b27d31c695ba72fb6750de2bdafd76e0d7d9
octavia/db/api.py
python
get_lock_session
()
Context manager for using a locking (not auto-commit) session.
Context manager for using a locking (not auto-commit) session.
[ "Context", "manager", "for", "using", "a", "locking", "(", "not", "auto", "-", "commit", ")", "session", "." ]
def get_lock_session(): """Context manager for using a locking (not auto-commit) session.""" lock_session = get_session(autocommit=False) try: yield lock_session lock_session.commit() except Exception: with excutils.save_and_reraise_exception(): lock_session.rollback(...
[ "def", "get_lock_session", "(", ")", ":", "lock_session", "=", "get_session", "(", "autocommit", "=", "False", ")", "try", ":", "yield", "lock_session", "lock_session", ".", "commit", "(", ")", "except", "Exception", ":", "with", "excutils", ".", "save_and_rer...
https://github.com/openstack/octavia/blob/27e5b27d31c695ba72fb6750de2bdafd76e0d7d9/octavia/db/api.py#L49-L57
golismero/golismero
7d605b937e241f51c1ca4f47b20f755eeefb9d76
thirdparty_libs/nltk/parse/chart.py
python
ChartParser.chart_parse
(self, tokens, trace=None)
return chart
Return the final parse ``Chart`` from which all possible parse trees can be extracted. :param tokens: The sentence to be parsed :type tokens: list(str) :rtype: Chart
Return the final parse ``Chart`` from which all possible parse trees can be extracted.
[ "Return", "the", "final", "parse", "Chart", "from", "which", "all", "possible", "parse", "trees", "can", "be", "extracted", "." ]
def chart_parse(self, tokens, trace=None): """ Return the final parse ``Chart`` from which all possible parse trees can be extracted. :param tokens: The sentence to be parsed :type tokens: list(str) :rtype: Chart """ if trace is None: trace = self._trace ...
[ "def", "chart_parse", "(", "self", ",", "tokens", ",", "trace", "=", "None", ")", ":", "if", "trace", "is", "None", ":", "trace", "=", "self", ".", "_trace", "trace_new_edges", "=", "self", ".", "_trace_new_edges", "tokens", "=", "list", "(", "tokens", ...
https://github.com/golismero/golismero/blob/7d605b937e241f51c1ca4f47b20f755eeefb9d76/thirdparty_libs/nltk/parse/chart.py#L1340-L1392
andresriancho/w3af
cd22e5252243a87aaa6d0ddea47cf58dacfe00a9
w3af/core/ui/console/io/unixctrl.py
python
_moveDelta
(delta, pos_code, neg_code)
[]
def _moveDelta(delta, pos_code, neg_code): if delta != 0: code = delta > 0 and pos_code or neg_code sys.stdout.write(code % abs(delta))
[ "def", "_moveDelta", "(", "delta", ",", "pos_code", ",", "neg_code", ")", ":", "if", "delta", "!=", "0", ":", "code", "=", "delta", ">", "0", "and", "pos_code", "or", "neg_code", "sys", ".", "stdout", ".", "write", "(", "code", "%", "abs", "(", "de...
https://github.com/andresriancho/w3af/blob/cd22e5252243a87aaa6d0ddea47cf58dacfe00a9/w3af/core/ui/console/io/unixctrl.py#L98-L101
enthought/chaco
0907d1dedd07a499202efbaf2fe2a4e51b4c8e5f
chaco/tools/cursor_tool.py
python
CursorTool1D.draw
(self, gc, view_bounds=None)
Draws this tool on a graphics context. Overrides LineInspector, BaseTool.
Draws this tool on a graphics context.
[ "Draws", "this", "tool", "on", "a", "graphics", "context", "." ]
def draw(self, gc, view_bounds=None): """Draws this tool on a graphics context. Overrides LineInspector, BaseTool. """ # We draw at different points depending on whether or not we are # interactive. If both listener and interactive are true, then the # selection metadat...
[ "def", "draw", "(", "self", ",", "gc", ",", "view_bounds", "=", "None", ")", ":", "# We draw at different points depending on whether or not we are", "# interactive. If both listener and interactive are true, then the", "# selection metadata on the plot component takes precendence.", ...
https://github.com/enthought/chaco/blob/0907d1dedd07a499202efbaf2fe2a4e51b4c8e5f/chaco/tools/cursor_tool.py#L191-L218
deluge-torrent/deluge
2316088f5c0dd6cb044d9d4832fa7d56dcc79cdc
deluge/ui/gtk3/pluginmanager.py
python
PluginManager.register_hook
(self, hook, function)
Register a hook function with the plugin manager
Register a hook function with the plugin manager
[ "Register", "a", "hook", "function", "with", "the", "plugin", "manager" ]
def register_hook(self, hook, function): """Register a hook function with the plugin manager""" try: self.hooks[hook].append(function) except KeyError: log.warning('Plugin attempting to register invalid hook.')
[ "def", "register_hook", "(", "self", ",", "hook", ",", "function", ")", ":", "try", ":", "self", ".", "hooks", "[", "hook", "]", ".", "append", "(", "function", ")", "except", "KeyError", ":", "log", ".", "warning", "(", "'Plugin attempting to register inv...
https://github.com/deluge-torrent/deluge/blob/2316088f5c0dd6cb044d9d4832fa7d56dcc79cdc/deluge/ui/gtk3/pluginmanager.py#L36-L41
shiweibsw/Translation-Tools
2fbbf902364e557fa7017f9a74a8797b7440c077
venv/Lib/site-packages/pip-9.0.3-py3.6.egg/pip/_vendor/distlib/manifest.py
python
Manifest._glob_to_re
(self, pattern)
return pattern_re
Translate a shell-like glob pattern to a regular expression. Return a string containing the regex. Differs from 'fnmatch.translate()' in that '*' does not match "special characters" (which are platform-specific).
Translate a shell-like glob pattern to a regular expression.
[ "Translate", "a", "shell", "-", "like", "glob", "pattern", "to", "a", "regular", "expression", "." ]
def _glob_to_re(self, pattern): """Translate a shell-like glob pattern to a regular expression. Return a string containing the regex. Differs from 'fnmatch.translate()' in that '*' does not match "special characters" (which are platform-specific). """ pattern_re = fnmat...
[ "def", "_glob_to_re", "(", "self", ",", "pattern", ")", ":", "pattern_re", "=", "fnmatch", ".", "translate", "(", "pattern", ")", "# '?' and '*' in the glob pattern become '.' and '.*' in the RE, which", "# IMHO is wrong -- '?' and '*' aren't supposed to match slash in Unix,", "#...
https://github.com/shiweibsw/Translation-Tools/blob/2fbbf902364e557fa7017f9a74a8797b7440c077/venv/Lib/site-packages/pip-9.0.3-py3.6.egg/pip/_vendor/distlib/manifest.py#L372-L393
learningequality/kolibri
d056dbc477aaf651ab843caa141a6a1e0a491046
kolibri/core/auth/sync_operations.py
python
KolibriVersionedSyncOperation.downgrade
(self, context)
Called when we're producing data for a version older than `self.version` :type context: morango.sync.context.LocalSessionContext
Called when we're producing data for a version older than `self.version`
[ "Called", "when", "we", "re", "producing", "data", "for", "a", "version", "older", "than", "self", ".", "version" ]
def downgrade(self, context): """ Called when we're producing data for a version older than `self.version` :type context: morango.sync.context.LocalSessionContext """ pass
[ "def", "downgrade", "(", "self", ",", "context", ")", ":", "pass" ]
https://github.com/learningequality/kolibri/blob/d056dbc477aaf651ab843caa141a6a1e0a491046/kolibri/core/auth/sync_operations.py#L191-L197
ronf/asyncssh
ee1714c598d8c2ea6f5484e465443f38b68714aa
asyncssh/process.py
python
SSHProcess.connection_lost
(self, exc: Optional[Exception])
Handle a close of the SSH channel
Handle a close of the SSH channel
[ "Handle", "a", "close", "of", "the", "SSH", "channel" ]
def connection_lost(self, exc: Optional[Exception]) -> None: """Handle a close of the SSH channel""" super().connection_lost(exc) # type: ignore for reader in list(self._readers.values()): reader.close() for writer in list(self._writers.values()): writer.close(...
[ "def", "connection_lost", "(", "self", ",", "exc", ":", "Optional", "[", "Exception", "]", ")", "->", "None", ":", "super", "(", ")", ".", "connection_lost", "(", "exc", ")", "# type: ignore", "for", "reader", "in", "list", "(", "self", ".", "_readers", ...
https://github.com/ronf/asyncssh/blob/ee1714c598d8c2ea6f5484e465443f38b68714aa/asyncssh/process.py#L890-L902
saltstack/salt
fae5bc757ad0f1716483ce7ae180b451545c2058
salt/modules/cassandra_cql.py
python
_load_properties
(property_name, config_option, set_default=False, default=None)
return property_name
Load properties for the cassandra module from config or pillar. :param property_name: The property to load. :type property_name: str or list of str :param config_option: The name of the config option. :type config_option: str :param set_default: Should a default be set if not found in config. ...
Load properties for the cassandra module from config or pillar.
[ "Load", "properties", "for", "the", "cassandra", "module", "from", "config", "or", "pillar", "." ]
def _load_properties(property_name, config_option, set_default=False, default=None): """ Load properties for the cassandra module from config or pillar. :param property_name: The property to load. :type property_name: str or list of str :param config_option: The name of the config option. :typ...
[ "def", "_load_properties", "(", "property_name", ",", "config_option", ",", "set_default", "=", "False", ",", "default", "=", "None", ")", ":", "if", "not", "property_name", ":", "log", ".", "debug", "(", "\"No property specified in function, trying to load from salt ...
https://github.com/saltstack/salt/blob/fae5bc757ad0f1716483ce7ae180b451545c2058/salt/modules/cassandra_cql.py#L131-L171
buke/GreenOdoo
3d8c55d426fb41fdb3f2f5a1533cfe05983ba1df
source/openerp/addons/base/ir/ir_attachment.py
python
ir_attachment.check
(self, cr, uid, ids, mode, context=None, values=None)
Restricts the access to an ir.attachment, according to referred model In the 'document' module, it is overriden to relax this hard rule, since more complex ones apply there.
Restricts the access to an ir.attachment, according to referred model In the 'document' module, it is overriden to relax this hard rule, since more complex ones apply there.
[ "Restricts", "the", "access", "to", "an", "ir", ".", "attachment", "according", "to", "referred", "model", "In", "the", "document", "module", "it", "is", "overriden", "to", "relax", "this", "hard", "rule", "since", "more", "complex", "ones", "apply", "there"...
def check(self, cr, uid, ids, mode, context=None, values=None): """Restricts the access to an ir.attachment, according to referred model In the 'document' module, it is overriden to relax this hard rule, since more complex ones apply there. """ res_ids = {} require_employ...
[ "def", "check", "(", "self", ",", "cr", ",", "uid", ",", "ids", ",", "mode", ",", "context", "=", "None", ",", "values", "=", "None", ")", ":", "res_ids", "=", "{", "}", "require_employee", "=", "False", "if", "ids", ":", "if", "isinstance", "(", ...
https://github.com/buke/GreenOdoo/blob/3d8c55d426fb41fdb3f2f5a1533cfe05983ba1df/source/openerp/addons/base/ir/ir_attachment.py#L225-L260
tensorflow/tensorboard
61d11d99ef034c30ba20b6a7840c8eededb9031c
tensorboard/encode_png_benchmark.py
python
main
(unused_argv)
[]
def main(unused_argv): logging.set_verbosity(logging.INFO) np.random.seed(0) thread_counts = [1, 2, 4, 6, 8, 10, 12, 14, 16, 32] logger.info("Warming up...") warmup_image = _image_of_size(256) for thread_count in thread_counts: bench(warmup_image, thread_count) logger.info("Runnin...
[ "def", "main", "(", "unused_argv", ")", ":", "logging", ".", "set_verbosity", "(", "logging", ".", "INFO", ")", "np", ".", "random", ".", "seed", "(", "0", ")", "thread_counts", "=", "[", "1", ",", "2", ",", "4", ",", "6", ",", "8", ",", "10", ...
https://github.com/tensorflow/tensorboard/blob/61d11d99ef034c30ba20b6a7840c8eededb9031c/tensorboard/encode_png_benchmark.py#L112-L145
zykls/whynot
86fd2349a83cd43c614b55f5bf2dfc9ece143081
whynot/framework.py
python
ParameterCollection.default
(self)
return {name: p.default for name, p in self.params.items()}
Return the default parameter setting for each parameter.
Return the default parameter setting for each parameter.
[ "Return", "the", "default", "parameter", "setting", "for", "each", "parameter", "." ]
def default(self): """Return the default parameter setting for each parameter.""" return {name: p.default for name, p in self.params.items()}
[ "def", "default", "(", "self", ")", ":", "return", "{", "name", ":", "p", ".", "default", "for", "name", ",", "p", "in", "self", ".", "params", ".", "items", "(", ")", "}" ]
https://github.com/zykls/whynot/blob/86fd2349a83cd43c614b55f5bf2dfc9ece143081/whynot/framework.py#L222-L224
homebysix/recipe-robot
fc51b3134b6db7cd86641785d75a0b994ae88154
scripts/recipe_robot_lib/recipe_generator.py
python
required_repo_reminder
(repo_name, repo_url, facts)
Print a reminder if a required repo is not already added. Args: repo_name (str): Name of repo to issue reminder to add. repo_url (str): URL to the repo, to use with `autopkg repo-add`. facts (RoboDict): A continually-updated dictionary containing all the information we know so f...
Print a reminder if a required repo is not already added.
[ "Print", "a", "reminder", "if", "a", "required", "repo", "is", "not", "already", "added", "." ]
def required_repo_reminder(repo_name, repo_url, facts): """Print a reminder if a required repo is not already added. Args: repo_name (str): Name of repo to issue reminder to add. repo_url (str): URL to the repo, to use with `autopkg repo-add`. facts (RoboDict): A continually-updated dic...
[ "def", "required_repo_reminder", "(", "repo_name", ",", "repo_url", ",", "facts", ")", ":", "cmd", "=", "\"/usr/local/bin/autopkg repo-list\"", "exitcode", ",", "out", ",", "err", "=", "get_exitcode_stdout_stderr", "(", "cmd", ")", "if", "not", "any", "(", "(", ...
https://github.com/homebysix/recipe-robot/blob/fc51b3134b6db7cd86641785d75a0b994ae88154/scripts/recipe_robot_lib/recipe_generator.py#L164-L184
roclark/sportsipy
c19f545d3376d62ded6304b137dc69238ac620a9
sportsipy/mlb/teams.py
python
Team.single_run_record
(self)
return self._single_run_record
Returns a ``string`` of the team's record when only one run is scored. Record is in the format 'W-L'.
Returns a ``string`` of the team's record when only one run is scored. Record is in the format 'W-L'.
[ "Returns", "a", "string", "of", "the", "team", "s", "record", "when", "only", "one", "run", "is", "scored", ".", "Record", "is", "in", "the", "format", "W", "-", "L", "." ]
def single_run_record(self): """ Returns a ``string`` of the team's record when only one run is scored. Record is in the format 'W-L'. """ return self._single_run_record
[ "def", "single_run_record", "(", "self", ")", ":", "return", "self", ".", "_single_run_record" ]
https://github.com/roclark/sportsipy/blob/c19f545d3376d62ded6304b137dc69238ac620a9/sportsipy/mlb/teams.py#L620-L625
home-assistant/core
265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1
homeassistant/components/intesishome/climate.py
python
IntesisAC.async_added_to_hass
(self)
Subscribe to event updates.
Subscribe to event updates.
[ "Subscribe", "to", "event", "updates", "." ]
async def async_added_to_hass(self): """Subscribe to event updates.""" _LOGGER.debug("Added climate device with state: %s", repr(self._ih_device)) await self._controller.add_update_callback(self.async_update_callback) try: await self._controller.connect() except IHCon...
[ "async", "def", "async_added_to_hass", "(", "self", ")", ":", "_LOGGER", ".", "debug", "(", "\"Added climate device with state: %s\"", ",", "repr", "(", "self", ".", "_ih_device", ")", ")", "await", "self", ".", "_controller", ".", "add_update_callback", "(", "s...
https://github.com/home-assistant/core/blob/265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1/homeassistant/components/intesishome/climate.py#L211-L219
stanfordnlp/stanza
e44d1c88340e33bf9813e6f5a6bd24387eefc4b2
stanza/models/constituency/base_model.py
python
BaseModel.push_constituents
(self, constituent_stacks, constituents)
Add a multiple constituents to multiple constituent_stacks Useful to factor this out in case batching will help
Add a multiple constituents to multiple constituent_stacks
[ "Add", "a", "multiple", "constituents", "to", "multiple", "constituent_stacks" ]
def push_constituents(self, constituent_stacks, constituents): """ Add a multiple constituents to multiple constituent_stacks Useful to factor this out in case batching will help """
[ "def", "push_constituents", "(", "self", ",", "constituent_stacks", ",", "constituents", ")", ":" ]
https://github.com/stanfordnlp/stanza/blob/e44d1c88340e33bf9813e6f5a6bd24387eefc4b2/stanza/models/constituency/base_model.py#L84-L89
francisck/DanderSpritz_docs
86bb7caca5a957147f120b18bb5c31f299914904
Python/Core/Lib/lib-tk/Tkinter.py
python
Canvas.icursor
(self, *args)
Set cursor at position POS in the item identified by TAGORID. In ARGS TAGORID must be first.
Set cursor at position POS in the item identified by TAGORID. In ARGS TAGORID must be first.
[ "Set", "cursor", "at", "position", "POS", "in", "the", "item", "identified", "by", "TAGORID", ".", "In", "ARGS", "TAGORID", "must", "be", "first", "." ]
def icursor(self, *args): """Set cursor at position POS in the item identified by TAGORID. In ARGS TAGORID must be first.""" self.tk.call((self._w, 'icursor') + args)
[ "def", "icursor", "(", "self", ",", "*", "args", ")", ":", "self", ".", "tk", ".", "call", "(", "(", "self", ".", "_w", ",", "'icursor'", ")", "+", "args", ")" ]
https://github.com/francisck/DanderSpritz_docs/blob/86bb7caca5a957147f120b18bb5c31f299914904/Python/Core/Lib/lib-tk/Tkinter.py#L2513-L2516
agile-geoscience/bruges
64f162dbf8b94ff265108f6eb85e0d4e28ecb2cb
bruges/rockphysics/rpm.py
python
hertzmindlin
(K0, G0, phi, phic=0.4, Cn=8.6, P=10, f=1)
return K_HM, G_HM
Hertz-Mindlin model written by Alessandro Amato del Monte (2015) from Mavko et al., Rock Physics Handbook, p.246 INPUT K0, G0: mineral bulk & shear modulus in GPa phi: porosity phic: critical porosity (default 0.4) Cn: coordination nnumber (default 8.6) P: confining pressure in MPa (defa...
Hertz-Mindlin model written by Alessandro Amato del Monte (2015) from Mavko et al., Rock Physics Handbook, p.246 INPUT K0, G0: mineral bulk & shear modulus in GPa phi: porosity phic: critical porosity (default 0.4) Cn: coordination nnumber (default 8.6) P: confining pressure in MPa (defa...
[ "Hertz", "-", "Mindlin", "model", "written", "by", "Alessandro", "Amato", "del", "Monte", "(", "2015", ")", "from", "Mavko", "et", "al", ".", "Rock", "Physics", "Handbook", "p", ".", "246", "INPUT", "K0", "G0", ":", "mineral", "bulk", "&", "shear", "mo...
def hertzmindlin(K0, G0, phi, phic=0.4, Cn=8.6, P=10, f=1): ''' Hertz-Mindlin model written by Alessandro Amato del Monte (2015) from Mavko et al., Rock Physics Handbook, p.246 INPUT K0, G0: mineral bulk & shear modulus in GPa phi: porosity phic: critical porosity (default 0.4) Cn: c...
[ "def", "hertzmindlin", "(", "K0", ",", "G0", ",", "phi", ",", "phic", "=", "0.4", ",", "Cn", "=", "8.6", ",", "P", "=", "10", ",", "f", "=", "1", ")", ":", "P", "/=", "1e3", "# converts pressure in same units as solid moduli (GPa)", "PR0", "=", "(", ...
https://github.com/agile-geoscience/bruges/blob/64f162dbf8b94ff265108f6eb85e0d4e28ecb2cb/bruges/rockphysics/rpm.py#L28-L48
networkx/networkx
1620568e36702b1cfeaf1c0277b167b6cb93e48d
networkx/readwrite/json_graph/adjacency.py
python
adjacency_data
(G, attrs=_attrs)
return data
Returns data in adjacency format that is suitable for JSON serialization and use in Javascript documents. Parameters ---------- G : NetworkX graph attrs : dict A dictionary that contains two keys 'id' and 'key'. The corresponding values provide the attribute names for storing Netwo...
Returns data in adjacency format that is suitable for JSON serialization and use in Javascript documents.
[ "Returns", "data", "in", "adjacency", "format", "that", "is", "suitable", "for", "JSON", "serialization", "and", "use", "in", "Javascript", "documents", "." ]
def adjacency_data(G, attrs=_attrs): """Returns data in adjacency format that is suitable for JSON serialization and use in Javascript documents. Parameters ---------- G : NetworkX graph attrs : dict A dictionary that contains two keys 'id' and 'key'. The corresponding values p...
[ "def", "adjacency_data", "(", "G", ",", "attrs", "=", "_attrs", ")", ":", "multigraph", "=", "G", ".", "is_multigraph", "(", ")", "id_", "=", "attrs", "[", "\"id\"", "]", "# Allow 'key' to be omitted from attrs if the graph is not a multigraph.", "key", "=", "None...
https://github.com/networkx/networkx/blob/1620568e36702b1cfeaf1c0277b167b6cb93e48d/networkx/readwrite/json_graph/adjacency.py#L9-L82
openstack/tacker
a60993fc3b2d4fc0e93ab13a874fe3c314fe48de
tacker/vnfm/infra_drivers/openstack/openstack.py
python
OpenStack.heal_vnf_wait
(self, context, vnf_instance, vim_connection_info, heal_vnf_request)
return stack
Check vnf is healed successfully
Check vnf is healed successfully
[ "Check", "vnf", "is", "healed", "successfully" ]
def heal_vnf_wait(self, context, vnf_instance, vim_connection_info, heal_vnf_request): """Check vnf is healed successfully""" access_info = vim_connection_info.access_info region_name = access_info.get('region') inst_vnf_info = vnf_instance.instantiated_vnf_info ...
[ "def", "heal_vnf_wait", "(", "self", ",", "context", ",", "vnf_instance", ",", "vim_connection_info", ",", "heal_vnf_request", ")", ":", "access_info", "=", "vim_connection_info", ".", "access_info", "region_name", "=", "access_info", ".", "get", "(", "'region'", ...
https://github.com/openstack/tacker/blob/a60993fc3b2d4fc0e93ab13a874fe3c314fe48de/tacker/vnfm/infra_drivers/openstack/openstack.py#L1472-L1483
oracle/graalpython
577e02da9755d916056184ec441c26e00b70145c
graalpython/lib-python/3/wave.py
python
Wave_write.setcomptype
(self, comptype, compname)
[]
def setcomptype(self, comptype, compname): if self._datawritten: raise Error('cannot change parameters after starting to write') if comptype not in ('NONE',): raise Error('unsupported compression type') self._comptype = comptype self._compname = compname
[ "def", "setcomptype", "(", "self", ",", "comptype", ",", "compname", ")", ":", "if", "self", ".", "_datawritten", ":", "raise", "Error", "(", "'cannot change parameters after starting to write'", ")", "if", "comptype", "not", "in", "(", "'NONE'", ",", ")", ":"...
https://github.com/oracle/graalpython/blob/577e02da9755d916056184ec441c26e00b70145c/graalpython/lib-python/3/wave.py#L382-L388
soravux/scoop
3c0357c32cec3169a19c822a3857c968a48775c5
bench/evosn/futures_evosn.py
python
mutAddWire
(individual, dimension)
[]
def mutAddWire(individual, dimension): index = random.randint(0, len(individual)) individual.insert(index, genWire(dimension))
[ "def", "mutAddWire", "(", "individual", ",", "dimension", ")", ":", "index", "=", "random", ".", "randint", "(", "0", ",", "len", "(", "individual", ")", ")", "individual", ".", "insert", "(", "index", ",", "genWire", "(", "dimension", ")", ")" ]
https://github.com/soravux/scoop/blob/3c0357c32cec3169a19c822a3857c968a48775c5/bench/evosn/futures_evosn.py#L60-L62
P1sec/pycrate
d12bbccf1df8c9c7891a26967a9d2635610ec5b8
pycrate_core/elt.py
python
Array.pop
(self)
Pop the last value of the array wrapped within the its template Args: None Returns: elt (Element) : last element of the instance
Pop the last value of the array wrapped within the its template Args: None Returns: elt (Element) : last element of the instance
[ "Pop", "the", "last", "value", "of", "the", "array", "wrapped", "within", "the", "its", "template", "Args", ":", "None", "Returns", ":", "elt", "(", "Element", ")", ":", "last", "element", "of", "the", "instance" ]
def pop(self): """Pop the last value of the array wrapped within the its template Args: None Returns: elt (Element) : last element of the instance """ if self._SAFE_STAT and self._num is not None and len(self._val) == self._num: ...
[ "def", "pop", "(", "self", ")", ":", "if", "self", ".", "_SAFE_STAT", "and", "self", ".", "_num", "is", "not", "None", "and", "len", "(", "self", ".", "_val", ")", "==", "self", ".", "_num", ":", "raise", "(", "EltErr", "(", "'{0} [pop] val length {1...
https://github.com/P1sec/pycrate/blob/d12bbccf1df8c9c7891a26967a9d2635610ec5b8/pycrate_core/elt.py#L2957-L2976
wwqgtxx/wwqLyParse
33136508e52821babd9294fdecffbdf02d73a6fc
wwqLyParse/lib/python-3.7.2-embed-amd64/pyquery/pyquery.py
python
PyQuery.is_
(self, selector)
return bool(self._filter_only(selector, self))
Returns True if selector matches at least one current element, else False: >>> d = PyQuery('<p class="hello"><span>Hi</span></p><p>Bye</p>') >>> d('p').eq(0).is_('.hello') True >>> d('p').eq(0).is_('span') False >>> d('p').eq(1).is_('.he...
Returns True if selector matches at least one current element, else False:
[ "Returns", "True", "if", "selector", "matches", "at", "least", "one", "current", "element", "else", "False", ":" ]
def is_(self, selector): """Returns True if selector matches at least one current element, else False: >>> d = PyQuery('<p class="hello"><span>Hi</span></p><p>Bye</p>') >>> d('p').eq(0).is_('.hello') True >>> d('p').eq(0).is_('span') False ...
[ "def", "is_", "(", "self", ",", "selector", ")", ":", "return", "bool", "(", "self", ".", "_filter_only", "(", "selector", ",", "self", ")", ")" ]
https://github.com/wwqgtxx/wwqLyParse/blob/33136508e52821babd9294fdecffbdf02d73a6fc/wwqLyParse/lib/python-3.7.2-embed-amd64/pyquery/pyquery.py#L648-L664
openhatch/oh-mainline
ce29352a034e1223141dcc2f317030bbc3359a51
vendor/packages/Django/django/db/models/loading.py
python
AppCache.register_models
(self, app_label, *models)
Register a set of models as belonging to an app.
Register a set of models as belonging to an app.
[ "Register", "a", "set", "of", "models", "as", "belonging", "to", "an", "app", "." ]
def register_models(self, app_label, *models): """ Register a set of models as belonging to an app. """ for model in models: # Store as 'name: model' pair in a dictionary # in the app_models dictionary model_name = model._meta.object_name.lower() ...
[ "def", "register_models", "(", "self", ",", "app_label", ",", "*", "models", ")", ":", "for", "model", "in", "models", ":", "# Store as 'name: model' pair in a dictionary", "# in the app_models dictionary", "model_name", "=", "model", ".", "_meta", ".", "object_name",...
https://github.com/openhatch/oh-mainline/blob/ce29352a034e1223141dcc2f317030bbc3359a51/vendor/packages/Django/django/db/models/loading.py#L235-L256
benknight/hue-alfred-workflow
4447ba61116caf4a448b50c4bfb866565d66d81e
logic/packages/png/png.py
python
Reader.palette
(self, alpha='natural')
return plte
Returns a palette that is a sequence of 3-tuples or 4-tuples, synthesizing it from the ``PLTE`` and ``tRNS`` chunks. These chunks should have already been processed (for example, by calling the :meth:`preamble` method). All the tuples are the same size: 3-tuples if there is no ``tRNS``...
Returns a palette that is a sequence of 3-tuples or 4-tuples, synthesizing it from the ``PLTE`` and ``tRNS`` chunks. These chunks should have already been processed (for example, by calling the :meth:`preamble` method). All the tuples are the same size: 3-tuples if there is no ``tRNS``...
[ "Returns", "a", "palette", "that", "is", "a", "sequence", "of", "3", "-", "tuples", "or", "4", "-", "tuples", "synthesizing", "it", "from", "the", "PLTE", "and", "tRNS", "chunks", ".", "These", "chunks", "should", "have", "already", "been", "processed", ...
def palette(self, alpha='natural'): """Returns a palette that is a sequence of 3-tuples or 4-tuples, synthesizing it from the ``PLTE`` and ``tRNS`` chunks. These chunks should have already been processed (for example, by calling the :meth:`preamble` method). All the tuples are the ...
[ "def", "palette", "(", "self", ",", "alpha", "=", "'natural'", ")", ":", "if", "not", "self", ".", "plte", ":", "raise", "FormatError", "(", "\"Required PLTE chunk is missing in colour type 3 image.\"", ")", "plte", "=", "group", "(", "array", "(", "'B'", ",",...
https://github.com/benknight/hue-alfred-workflow/blob/4447ba61116caf4a448b50c4bfb866565d66d81e/logic/packages/png/png.py#L1958-L1979
raiden-network/raiden
76c68b426a6f81f173b9a2c09bd88a610502c38b
raiden/api/python.py
python
RaidenAPI.set_total_channel_withdraw
( self, registry_address: TokenNetworkRegistryAddress, token_address: TokenAddress, partner_address: Address, total_withdraw: WithdrawAmount, retry_timeout: NetworkTimeout = DEFAULT_RETRY_TIMEOUT, )
Set the `total_withdraw` in the channel with the peer at `partner_address` and the given `token_address`. Raises: InvalidBinaryAddress: If either token_address or partner_address is not 20 bytes long. RaidenUnrecoverableError: May happen for multiple reasons: ...
Set the `total_withdraw` in the channel with the peer at `partner_address` and the given `token_address`.
[ "Set", "the", "total_withdraw", "in", "the", "channel", "with", "the", "peer", "at", "partner_address", "and", "the", "given", "token_address", "." ]
def set_total_channel_withdraw( self, registry_address: TokenNetworkRegistryAddress, token_address: TokenAddress, partner_address: Address, total_withdraw: WithdrawAmount, retry_timeout: NetworkTimeout = DEFAULT_RETRY_TIMEOUT, ) -> None: """Set the `total_with...
[ "def", "set_total_channel_withdraw", "(", "self", ",", "registry_address", ":", "TokenNetworkRegistryAddress", ",", "token_address", ":", "TokenAddress", ",", "partner_address", ":", "Address", ",", "total_withdraw", ":", "WithdrawAmount", ",", "retry_timeout", ":", "Ne...
https://github.com/raiden-network/raiden/blob/76c68b426a6f81f173b9a2c09bd88a610502c38b/raiden/api/python.py#L537-L613
NTMC-Community/MatchZoo
8a487ee5a574356fc91e4f48e219253dc11bcff2
matchzoo/engine/base_task.py
python
BaseTask.loss
(self)
return self._loss
:return: Loss used in the task.
:return: Loss used in the task.
[ ":", "return", ":", "Loss", "used", "in", "the", "task", "." ]
def loss(self): """:return: Loss used in the task.""" return self._loss
[ "def", "loss", "(", "self", ")", ":", "return", "self", ".", "_loss" ]
https://github.com/NTMC-Community/MatchZoo/blob/8a487ee5a574356fc91e4f48e219253dc11bcff2/matchzoo/engine/base_task.py#L44-L46
9miao/Firefly
fd2795b8c26de6ab63bbec23d11f18c3dfb39a50
firefly/utils/services.py
python
Service.unMapTarget
(self, target)
Remove a target from the service.
Remove a target from the service.
[ "Remove", "a", "target", "from", "the", "service", "." ]
def unMapTarget(self, target): """Remove a target from the service.""" self._lock.acquire() try: key = target.__name__ if key in self._targets: del self._targets[key] finally: self._lock.release()
[ "def", "unMapTarget", "(", "self", ",", "target", ")", ":", "self", ".", "_lock", ".", "acquire", "(", ")", "try", ":", "key", "=", "target", ".", "__name__", "if", "key", "in", "self", ".", "_targets", ":", "del", "self", ".", "_targets", "[", "ke...
https://github.com/9miao/Firefly/blob/fd2795b8c26de6ab63bbec23d11f18c3dfb39a50/firefly/utils/services.py#L50-L58
LinkedInAttic/indextank-service
880c6295ce8e7a3a55bf9b3777cc35c7680e0d7e
api/thrift/server/TNonblockingServer.py
python
locked
(func)
return nested
Decorator which locks self.lock.
Decorator which locks self.lock.
[ "Decorator", "which", "locks", "self", ".", "lock", "." ]
def locked(func): "Decorator which locks self.lock." def nested(self, *args, **kwargs): self.lock.acquire() try: return func(self, *args, **kwargs) finally: self.lock.release() return nested
[ "def", "locked", "(", "func", ")", ":", "def", "nested", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "self", ".", "lock", ".", "acquire", "(", ")", "try", ":", "return", "func", "(", "self", ",", "*", "args", ",", "*", "...
https://github.com/LinkedInAttic/indextank-service/blob/880c6295ce8e7a3a55bf9b3777cc35c7680e0d7e/api/thrift/server/TNonblockingServer.py#L63-L71
replit-archive/empythoned
977ec10ced29a3541a4973dc2b59910805695752
cpython/Lib/wsgiref/util.py
python
is_hop_by_hop
(header_name)
return _hoppish(header_name.lower())
Return true if 'header_name' is an HTTP/1.1 "Hop-by-Hop" header
Return true if 'header_name' is an HTTP/1.1 "Hop-by-Hop" header
[ "Return", "true", "if", "header_name", "is", "an", "HTTP", "/", "1", ".", "1", "Hop", "-", "by", "-", "Hop", "header" ]
def is_hop_by_hop(header_name): """Return true if 'header_name' is an HTTP/1.1 "Hop-by-Hop" header""" return _hoppish(header_name.lower())
[ "def", "is_hop_by_hop", "(", "header_name", ")", ":", "return", "_hoppish", "(", "header_name", ".", "lower", "(", ")", ")" ]
https://github.com/replit-archive/empythoned/blob/977ec10ced29a3541a4973dc2b59910805695752/cpython/Lib/wsgiref/util.py#L163-L165
osroom/osroom
fcb9b7c5e5cfd8e919f8d87521800e70b09b5b44
apps/modules/permission/process/url_permission.py
python
get_urls
()
return data
获取web url :return:
获取web url :return:
[ "获取web", "url", ":", "return", ":" ]
def get_urls(): """ 获取web url :return: """ data = {} ctype = request.argget.all("type") keyword = request.argget.all("keyword") pre = str_to_num(request.argget.all("pre", 10)) page = str_to_num(request.argget.all("page", 1)) q = {} if ctype: q["type"] = ctype if k...
[ "def", "get_urls", "(", ")", ":", "data", "=", "{", "}", "ctype", "=", "request", ".", "argget", ".", "all", "(", "\"type\"", ")", "keyword", "=", "request", ".", "argget", ".", "all", "(", "\"keyword\"", ")", "pre", "=", "str_to_num", "(", "request"...
https://github.com/osroom/osroom/blob/fcb9b7c5e5cfd8e919f8d87521800e70b09b5b44/apps/modules/permission/process/url_permission.py#L43-L88
ctxis/canape
5f0e03424577296bcc60c2008a60a98ec5307e4b
CANAPE.Scripting/Lib/distutils/ccompiler.py
python
CCompiler.library_option
(self, lib)
Return the compiler option to add 'dir' to the list of libraries linked into the shared library or executable.
Return the compiler option to add 'dir' to the list of libraries linked into the shared library or executable.
[ "Return", "the", "compiler", "option", "to", "add", "dir", "to", "the", "list", "of", "libraries", "linked", "into", "the", "shared", "library", "or", "executable", "." ]
def library_option(self, lib): """Return the compiler option to add 'dir' to the list of libraries linked into the shared library or executable. """ raise NotImplementedError
[ "def", "library_option", "(", "self", ",", "lib", ")", ":", "raise", "NotImplementedError" ]
https://github.com/ctxis/canape/blob/5f0e03424577296bcc60c2008a60a98ec5307e4b/CANAPE.Scripting/Lib/distutils/ccompiler.py#L770-L774
Kaggle/kaggle-api
49057db362903d158b1e71a43d888b981dd27159
kaggle/models/file.py
python
File.to_dict
(self)
return result
Returns the model properties as a dict
Returns the model properties as a dict
[ "Returns", "the", "model", "properties", "as", "a", "dict" ]
def to_dict(self): """Returns the model properties as a dict""" result = {} for attr, _ in six.iteritems(self.swagger_types): value = getattr(self, attr) if isinstance(value, list): result[attr] = list(map( lambda x: x.to_dict() if has...
[ "def", "to_dict", "(", "self", ")", ":", "result", "=", "{", "}", "for", "attr", ",", "_", "in", "six", ".", "iteritems", "(", "self", ".", "swagger_types", ")", ":", "value", "=", "getattr", "(", "self", ",", "attr", ")", "if", "isinstance", "(", ...
https://github.com/Kaggle/kaggle-api/blob/49057db362903d158b1e71a43d888b981dd27159/kaggle/models/file.py#L395-L417
google-research/language
61fa7260ac7d690d11ef72ca863e45a37c0bdc80
language/conpono/binary_order/run_binary_coherence.py
python
model_fn_builder
(bert_config, init_checkpoint, learning_rate, num_train_steps, num_warmup_steps, use_tpu, use_one_hot_embeddings)
return model_fn
Returns `model_fn` closure for TPUEstimator.
Returns `model_fn` closure for TPUEstimator.
[ "Returns", "model_fn", "closure", "for", "TPUEstimator", "." ]
def model_fn_builder(bert_config, init_checkpoint, learning_rate, num_train_steps, num_warmup_steps, use_tpu, use_one_hot_embeddings): """Returns `model_fn` closure for TPUEstimator.""" def model_fn(features, labels, mode, params): # pylint: disable=unused-argument ""...
[ "def", "model_fn_builder", "(", "bert_config", ",", "init_checkpoint", ",", "learning_rate", ",", "num_train_steps", ",", "num_warmup_steps", ",", "use_tpu", ",", "use_one_hot_embeddings", ")", ":", "def", "model_fn", "(", "features", ",", "labels", ",", "mode", "...
https://github.com/google-research/language/blob/61fa7260ac7d690d11ef72ca863e45a37c0bdc80/language/conpono/binary_order/run_binary_coherence.py#L238-L330
ARISE-Initiative/robosuite
a5dfaf03cd769170881a1931d8f19c8eb72f531a
robosuite/environments/manipulation/two_arm_env.py
python
TwoArmEnv._eef1_xquat
(self)
return mat2quat(self._eef1_xmat)
End Effector 1 orientation as a (x,y,z,w) quaternion Note that this draws the orientation from the "ee" site, NOT the gripper site, since the gripper orientations are inconsistent! Returns: np.array: (x,y,z,w) quaternion for EEF1
End Effector 1 orientation as a (x,y,z,w) quaternion Note that this draws the orientation from the "ee" site, NOT the gripper site, since the gripper orientations are inconsistent!
[ "End", "Effector", "1", "orientation", "as", "a", "(", "x", "y", "z", "w", ")", "quaternion", "Note", "that", "this", "draws", "the", "orientation", "from", "the", "ee", "site", "NOT", "the", "gripper", "site", "since", "the", "gripper", "orientations", ...
def _eef1_xquat(self): """ End Effector 1 orientation as a (x,y,z,w) quaternion Note that this draws the orientation from the "ee" site, NOT the gripper site, since the gripper orientations are inconsistent! Returns: np.array: (x,y,z,w) quaternion for EEF1 ""...
[ "def", "_eef1_xquat", "(", "self", ")", ":", "return", "mat2quat", "(", "self", ".", "_eef1_xmat", ")" ]
https://github.com/ARISE-Initiative/robosuite/blob/a5dfaf03cd769170881a1931d8f19c8eb72f531a/robosuite/environments/manipulation/two_arm_env.py#L125-L134
jupyter/jupyter_client
263173095ceab87a572937f21f843886ffe356f1
jupyter_client/client.py
python
KernelClient._async_recv_reply
( self, msg_id: str, timeout: t.Optional[float] = None, channel: str = "shell" )
Receive and return the reply for a given request
Receive and return the reply for a given request
[ "Receive", "and", "return", "the", "reply", "for", "a", "given", "request" ]
async def _async_recv_reply( self, msg_id: str, timeout: t.Optional[float] = None, channel: str = "shell" ) -> t.Dict[str, t.Any]: """Receive and return the reply for a given request""" if timeout is not None: deadline = time.monotonic() + timeout while True: ...
[ "async", "def", "_async_recv_reply", "(", "self", ",", "msg_id", ":", "str", ",", "timeout", ":", "t", ".", "Optional", "[", "float", "]", "=", "None", ",", "channel", ":", "str", "=", "\"shell\"", ")", "->", "t", ".", "Dict", "[", "str", ",", "t",...
https://github.com/jupyter/jupyter_client/blob/263173095ceab87a572937f21f843886ffe356f1/jupyter_client/client.py#L193-L212
stoq/stoq
c26991644d1affcf96bc2e0a0434796cabdf8448
stoq/lib/gui/dialogs/transferorderdialog.py
python
TransferOrderDetailsDialog.add_tab
(self, slave, name)
Add a new tab on the notebook :param slave: the slave we are attaching to the new tab :param name: the name of the tab
Add a new tab on the notebook
[ "Add", "a", "new", "tab", "on", "the", "notebook" ]
def add_tab(self, slave, name): """Add a new tab on the notebook :param slave: the slave we are attaching to the new tab :param name: the name of the tab """ event_box = Gtk.EventBox() self.details_notebook.insert_page(event_box, Gtk.Label(label=name), -1) self.a...
[ "def", "add_tab", "(", "self", ",", "slave", ",", "name", ")", ":", "event_box", "=", "Gtk", ".", "EventBox", "(", ")", "self", ".", "details_notebook", ".", "insert_page", "(", "event_box", ",", "Gtk", ".", "Label", "(", "label", "=", "name", ")", "...
https://github.com/stoq/stoq/blob/c26991644d1affcf96bc2e0a0434796cabdf8448/stoq/lib/gui/dialogs/transferorderdialog.py#L77-L86
pandas-dev/pandas
5ba7d714014ae8feaccc0dd4a98890828cf2832d
pandas/core/generic.py
python
NDFrame._validate_dtype
(cls, dtype)
return dtype
validate the passed dtype
validate the passed dtype
[ "validate", "the", "passed", "dtype" ]
def _validate_dtype(cls, dtype) -> DtypeObj | None: """validate the passed dtype""" if dtype is not None: dtype = pandas_dtype(dtype) # a compound dtype if dtype.kind == "V": raise NotImplementedError( "compound dtypes are not impl...
[ "def", "_validate_dtype", "(", "cls", ",", "dtype", ")", "->", "DtypeObj", "|", "None", ":", "if", "dtype", "is", "not", "None", ":", "dtype", "=", "pandas_dtype", "(", "dtype", ")", "# a compound dtype", "if", "dtype", ".", "kind", "==", "\"V\"", ":", ...
https://github.com/pandas-dev/pandas/blob/5ba7d714014ae8feaccc0dd4a98890828cf2832d/pandas/core/generic.py#L443-L455
pyparallel/pyparallel
11e8c6072d48c8f13641925d17b147bf36ee0ba3
Lib/site-packages/jinja2-2.8-py3.3.egg/jinja2/utils.py
python
consume
(iterable)
Consumes an iterable without doing anything with it.
Consumes an iterable without doing anything with it.
[ "Consumes", "an", "iterable", "without", "doing", "anything", "with", "it", "." ]
def consume(iterable): """Consumes an iterable without doing anything with it.""" for event in iterable: pass
[ "def", "consume", "(", "iterable", ")", ":", "for", "event", "in", "iterable", ":", "pass" ]
https://github.com/pyparallel/pyparallel/blob/11e8c6072d48c8f13641925d17b147bf36ee0ba3/Lib/site-packages/jinja2-2.8-py3.3.egg/jinja2/utils.py#L102-L105
rdiff-backup/rdiff-backup
321e0cd6e5e47d4c158a0172e47ab38240a8b653
src/rdiff_backup/restore.py
python
MirrorStruct.set_mirror_select
(cls, target_rp, select_opts, *filelists)
Initialize the mirror selection object
Initialize the mirror selection object
[ "Initialize", "the", "mirror", "selection", "object" ]
def set_mirror_select(cls, target_rp, select_opts, *filelists): """Initialize the mirror selection object""" if not select_opts: return # nothing to do... cls._select = selection.Select(target_rp) cls._select.parse_selection_args(select_opts, filelists)
[ "def", "set_mirror_select", "(", "cls", ",", "target_rp", ",", "select_opts", ",", "*", "filelists", ")", ":", "if", "not", "select_opts", ":", "return", "# nothing to do...", "cls", ".", "_select", "=", "selection", ".", "Select", "(", "target_rp", ")", "cl...
https://github.com/rdiff-backup/rdiff-backup/blob/321e0cd6e5e47d4c158a0172e47ab38240a8b653/src/rdiff_backup/restore.py#L130-L135
JaniceWuo/MovieRecommend
4c86db64ca45598917d304f535413df3bc9fea65
movierecommend/venv1/Lib/site-packages/pip-9.0.1-py3.6.egg/pip/_vendor/pyparsing.py
python
Optional.__init__
( self, expr, default=_optionalNotMatched )
[]
def __init__( self, expr, default=_optionalNotMatched ): super(Optional,self).__init__( expr, savelist=False ) self.saveAsList = self.expr.saveAsList self.defaultValue = default self.mayReturnEmpty = True
[ "def", "__init__", "(", "self", ",", "expr", ",", "default", "=", "_optionalNotMatched", ")", ":", "super", "(", "Optional", ",", "self", ")", ".", "__init__", "(", "expr", ",", "savelist", "=", "False", ")", "self", ".", "saveAsList", "=", "self", "."...
https://github.com/JaniceWuo/MovieRecommend/blob/4c86db64ca45598917d304f535413df3bc9fea65/movierecommend/venv1/Lib/site-packages/pip-9.0.1-py3.6.egg/pip/_vendor/pyparsing.py#L3956-L3960
sametmax/Django--an-app-at-a-time
99eddf12ead76e6dfbeb09ce0bae61e282e22f8a
ignore_this_directory/django/contrib/auth/base_user.py
python
AbstractBaseUser.has_usable_password
(self)
return is_password_usable(self.password)
Return False if set_unusable_password() has been called for this user.
Return False if set_unusable_password() has been called for this user.
[ "Return", "False", "if", "set_unusable_password", "()", "has", "been", "called", "for", "this", "user", "." ]
def has_usable_password(self): """ Return False if set_unusable_password() has been called for this user. """ return is_password_usable(self.password)
[ "def", "has_usable_password", "(", "self", ")", ":", "return", "is_password_usable", "(", "self", ".", "password", ")" ]
https://github.com/sametmax/Django--an-app-at-a-time/blob/99eddf12ead76e6dfbeb09ce0bae61e282e22f8a/ignore_this_directory/django/contrib/auth/base_user.py#L117-L121
orbingol/NURBS-Python
8ae8b127eb0b130a25a6c81e98e90f319733bca0
geomdl/operations.py
python
flip
(surf, **kwargs)
return geom
Flips the control points grid of the input surface(s). Keyword Arguments: * ``inplace``: if False, operation applied to a copy of the object. *Default: False* :param surf: input surface(s) :type surf: abstract.Surface, multi.SurfaceContainer :return: flipped surface(s)
Flips the control points grid of the input surface(s).
[ "Flips", "the", "control", "points", "grid", "of", "the", "input", "surface", "(", "s", ")", "." ]
def flip(surf, **kwargs): """ Flips the control points grid of the input surface(s). Keyword Arguments: * ``inplace``: if False, operation applied to a copy of the object. *Default: False* :param surf: input surface(s) :type surf: abstract.Surface, multi.SurfaceContainer :return: flipped s...
[ "def", "flip", "(", "surf", ",", "*", "*", "kwargs", ")", ":", "if", "surf", ".", "pdimension", "!=", "2", ":", "raise", "GeomdlException", "(", "\"Can only flip surfaces\"", ")", "# Keyword arguments", "inplace", "=", "kwargs", ".", "get", "(", "'inplace'",...
https://github.com/orbingol/NURBS-Python/blob/8ae8b127eb0b130a25a6c81e98e90f319733bca0/geomdl/operations.py#L1653-L1685
taigaio/taiga-ncurses
65312098f2d167762e0dbd1c16019754ab64d068
taiga_ncurses/controllers/issues.py
python
ProjectIssuesSubController.handle_create_issue_request
(self)
[]
def handle_create_issue_request(self): data = self.view.get_issue_form_data() if not data.get("subject", None): self.view.notifier.error_msg("Subject is required") else: us_post_f = self.executor.create_issue(data) us_post_f.add_done_callback(self.handle_crea...
[ "def", "handle_create_issue_request", "(", "self", ")", ":", "data", "=", "self", ".", "view", ".", "get_issue_form_data", "(", ")", "if", "not", "data", ".", "get", "(", "\"subject\"", ",", "None", ")", ":", "self", ".", "view", ".", "notifier", ".", ...
https://github.com/taigaio/taiga-ncurses/blob/65312098f2d167762e0dbd1c16019754ab64d068/taiga_ncurses/controllers/issues.py#L154-L161
inguma/bokken
6109dd0025093a11631cb88cf48cb5c5ed5e617d
lib/web/template.py
python
test
()
r"""Doctest for testing template module. Define a utility function to run template test. >>> class TestResult: ... def __init__(self, t): self.t = t ... def __getattr__(self, name): return getattr(self.t, name) ... def __repr__(self): return repr(unicode(self)) ...
r"""Doctest for testing template module.
[ "r", "Doctest", "for", "testing", "template", "module", "." ]
def test(): r"""Doctest for testing template module. Define a utility function to run template test. >>> class TestResult: ... def __init__(self, t): self.t = t ... def __getattr__(self, name): return getattr(self.t, name) ... def __repr__(self): return repr(uni...
[ "def", "test", "(", ")", ":", "pass" ]
https://github.com/inguma/bokken/blob/6109dd0025093a11631cb88cf48cb5c5ed5e617d/lib/web/template.py#L1301-L1504
GoogleCloudPlatform/cloudml-samples
efddc4a9898127e55edc0946557aca4bfaf59705
tensorflow/standard/mnist/deprecated/trainer/distribution_utils.py
python
get_distribution_strategy
(num_gpus, all_reduce_alg=None)
Return a DistributionStrategy for running the model. Args: num_gpus: Number of GPUs to run this model. all_reduce_alg: Specify which algorithm to use when performing all-reduce. See tf.contrib.distribute.AllReduceCrossDeviceOps for available algorithms. If None, DistributionStrategy will choose b...
Return a DistributionStrategy for running the model.
[ "Return", "a", "DistributionStrategy", "for", "running", "the", "model", "." ]
def get_distribution_strategy(num_gpus, all_reduce_alg=None): """Return a DistributionStrategy for running the model. Args: num_gpus: Number of GPUs to run this model. all_reduce_alg: Specify which algorithm to use when performing all-reduce. See tf.contrib.distribute.AllReduceCrossDeviceOps for avai...
[ "def", "get_distribution_strategy", "(", "num_gpus", ",", "all_reduce_alg", "=", "None", ")", ":", "if", "num_gpus", "==", "0", ":", "return", "tf", ".", "contrib", ".", "distribute", ".", "OneDeviceStrategy", "(", "\"device:CPU:0\"", ")", "elif", "num_gpus", ...
https://github.com/GoogleCloudPlatform/cloudml-samples/blob/efddc4a9898127e55edc0946557aca4bfaf59705/tensorflow/standard/mnist/deprecated/trainer/distribution_utils.py#L24-L48
home-assistant/core
265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1
homeassistant/components/synology_dsm/__init__.py
python
async_setup_entry
(hass: HomeAssistant, entry: ConfigEntry)
return True
Set up Synology DSM sensors.
Set up Synology DSM sensors.
[ "Set", "up", "Synology", "DSM", "sensors", "." ]
async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool: """Set up Synology DSM sensors.""" # Migrate device indentifiers dev_reg = await get_dev_reg(hass) devices: list[DeviceEntry] = device_registry.async_entries_for_config_entry( dev_reg, entry.entry_id ) for dev...
[ "async", "def", "async_setup_entry", "(", "hass", ":", "HomeAssistant", ",", "entry", ":", "ConfigEntry", ")", "->", "bool", ":", "# Migrate device indentifiers", "dev_reg", "=", "await", "get_dev_reg", "(", "hass", ")", "devices", ":", "list", "[", "DeviceEntry...
https://github.com/home-assistant/core/blob/265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1/homeassistant/components/synology_dsm/__init__.py#L87-L232
sametmax/Django--an-app-at-a-time
99eddf12ead76e6dfbeb09ce0bae61e282e22f8a
ignore_this_directory/django/db/backends/oracle/schema.py
python
DatabaseSchemaEditor._alter_field_type_workaround
(self, model, old_field, new_field)
Oracle refuses to change from some type to other type. What we need to do instead is: - Add a nullable version of the desired field with a temporary name. If the new column is an auto field, then the temporary column can't be nullable. - Update the table to transfer values fr...
Oracle refuses to change from some type to other type. What we need to do instead is: - Add a nullable version of the desired field with a temporary name. If the new column is an auto field, then the temporary column can't be nullable. - Update the table to transfer values fr...
[ "Oracle", "refuses", "to", "change", "from", "some", "type", "to", "other", "type", ".", "What", "we", "need", "to", "do", "instead", "is", ":", "-", "Add", "a", "nullable", "version", "of", "the", "desired", "field", "with", "a", "temporary", "name", ...
def _alter_field_type_workaround(self, model, old_field, new_field): """ Oracle refuses to change from some type to other type. What we need to do instead is: - Add a nullable version of the desired field with a temporary name. If the new column is an auto field, then the tempo...
[ "def", "_alter_field_type_workaround", "(", "self", ",", "model", ",", "old_field", ",", "new_field", ")", ":", "# Make a new field that's like the new one but with a temporary", "# column name.", "new_temp_field", "=", "copy", ".", "deepcopy", "(", "new_field", ")", "new...
https://github.com/sametmax/Django--an-app-at-a-time/blob/99eddf12ead76e6dfbeb09ce0bae61e282e22f8a/ignore_this_directory/django/db/backends/oracle/schema.py#L78-L122
biolab/orange3
41685e1c7b1d1babe680113685a2d44bcc9fec0b
Orange/widgets/visualize/owscatterplotgraph.py
python
OWScatterPlotBase.get_colors
(self)
Prepare data for colors of the points in the plot The method is called by `update_colors`. It gets the colors and the indices of the data subset from the widget (`get_color_data`, `get_subset_mask`), and constructs lists of pens and brushes for each data point. The method uses ...
Prepare data for colors of the points in the plot
[ "Prepare", "data", "for", "colors", "of", "the", "points", "in", "the", "plot" ]
def get_colors(self): """ Prepare data for colors of the points in the plot The method is called by `update_colors`. It gets the colors and the indices of the data subset from the widget (`get_color_data`, `get_subset_mask`), and constructs lists of pens and brushes for ...
[ "def", "get_colors", "(", "self", ")", ":", "c_data", "=", "self", ".", "master", ".", "get_color_data", "(", ")", "c_data", "=", "self", ".", "_filter_visible", "(", "c_data", ")", "subset", "=", "self", ".", "master", ".", "get_subset_mask", "(", ")", ...
https://github.com/biolab/orange3/blob/41685e1c7b1d1babe680113685a2d44bcc9fec0b/Orange/widgets/visualize/owscatterplotgraph.py#L991-L1023
ganeti/ganeti
d340a9ddd12f501bef57da421b5f9b969a4ba905
lib/cmdlib/common.py
python
_FilterVmNodes
(lu, node_uuids)
return [uuid for uuid in node_uuids if uuid not in vm_nodes]
Filters out non-vm_capable nodes from a list. @type lu: L{LogicalUnit} @param lu: the logical unit for which we check @type node_uuids: list @param node_uuids: the list of nodes on which we should check @rtype: list @return: the list of vm-capable nodes
Filters out non-vm_capable nodes from a list.
[ "Filters", "out", "non", "-", "vm_capable", "nodes", "from", "a", "list", "." ]
def _FilterVmNodes(lu, node_uuids): """Filters out non-vm_capable nodes from a list. @type lu: L{LogicalUnit} @param lu: the logical unit for which we check @type node_uuids: list @param node_uuids: the list of nodes on which we should check @rtype: list @return: the list of vm-capable nodes """ vm_...
[ "def", "_FilterVmNodes", "(", "lu", ",", "node_uuids", ")", ":", "vm_nodes", "=", "frozenset", "(", "lu", ".", "cfg", ".", "GetNonVmCapableNodeList", "(", ")", ")", "return", "[", "uuid", "for", "uuid", "in", "node_uuids", "if", "uuid", "not", "in", "vm_...
https://github.com/ganeti/ganeti/blob/d340a9ddd12f501bef57da421b5f9b969a4ba905/lib/cmdlib/common.py#L876-L888
ym2011/POC-EXP
206b22d3a6b2a172359678df33bbc5b2ad04b6c3
K8/Web-Exp/sqlmap/thirdparty/bottle/bottle.py
python
Route.get_config
(self, key, default=None)
return default
Lookup a config field and return its value, first checking the route.config, then route.app.config.
Lookup a config field and return its value, first checking the route.config, then route.app.config.
[ "Lookup", "a", "config", "field", "and", "return", "its", "value", "first", "checking", "the", "route", ".", "config", "then", "route", ".", "app", ".", "config", "." ]
def get_config(self, key, default=None): """ Lookup a config field and return its value, first checking the route.config, then route.app.config.""" for conf in (self.config, self.app.config): if key in conf: return conf[key] return default
[ "def", "get_config", "(", "self", ",", "key", ",", "default", "=", "None", ")", ":", "for", "conf", "in", "(", "self", ".", "config", ",", "self", ".", "app", ".", "config", ")", ":", "if", "key", "in", "conf", ":", "return", "conf", "[", "key", ...
https://github.com/ym2011/POC-EXP/blob/206b22d3a6b2a172359678df33bbc5b2ad04b6c3/K8/Web-Exp/sqlmap/thirdparty/bottle/bottle.py#L624-L629
PyFilesystem/pyfilesystem2
a6ea045e766c76bae2e2fde19294c8275773ffde
fs/path.py
python
normpath
(path)
return prefix + "/".join(components)
Normalize a path. This function simplifies a path by collapsing back-references and removing duplicated separators. Arguments: path (str): Path to normalize. Returns: str: A valid FS path. Example: >>> normpath("/foo//bar/frob/../baz") '/foo/bar/baz' >>> n...
Normalize a path.
[ "Normalize", "a", "path", "." ]
def normpath(path): # type: (Text) -> Text """Normalize a path. This function simplifies a path by collapsing back-references and removing duplicated separators. Arguments: path (str): Path to normalize. Returns: str: A valid FS path. Example: >>> normpath("/foo//...
[ "def", "normpath", "(", "path", ")", ":", "# type: (Text) -> Text", "# noqa: E501", "if", "path", "in", "\"/\"", ":", "return", "path", "# An early out if there is no need to normalize this path", "if", "not", "_requires_normalization", "(", "path", ")", ":", "return", ...
https://github.com/PyFilesystem/pyfilesystem2/blob/a6ea045e766c76bae2e2fde19294c8275773ffde/fs/path.py#L50-L91
ym2011/POC-EXP
206b22d3a6b2a172359678df33bbc5b2ad04b6c3
K8/Web-Exp/sqlmap/thirdparty/bottle/bottle.py
python
BaseRequest.content_type
(self)
return self.environ.get('CONTENT_TYPE', '').lower()
The Content-Type header as a lowercase-string (default: empty).
The Content-Type header as a lowercase-string (default: empty).
[ "The", "Content", "-", "Type", "header", "as", "a", "lowercase", "-", "string", "(", "default", ":", "empty", ")", "." ]
def content_type(self): """ The Content-Type header as a lowercase-string (default: empty). """ return self.environ.get('CONTENT_TYPE', '').lower()
[ "def", "content_type", "(", "self", ")", ":", "return", "self", ".", "environ", ".", "get", "(", "'CONTENT_TYPE'", ",", "''", ")", ".", "lower", "(", ")" ]
https://github.com/ym2011/POC-EXP/blob/206b22d3a6b2a172359678df33bbc5b2ad04b6c3/K8/Web-Exp/sqlmap/thirdparty/bottle/bottle.py#L1412-L1414
benknight/hue-alfred-workflow
4447ba61116caf4a448b50c4bfb866565d66d81e
logic/packages/workflow/workflow.py
python
Workflow.open_terminal
(self)
Open a Terminal window at workflow's :attr:`workflowdir`.
Open a Terminal window at workflow's :attr:`workflowdir`.
[ "Open", "a", "Terminal", "window", "at", "workflow", "s", ":", "attr", ":", "workflowdir", "." ]
def open_terminal(self): """Open a Terminal window at workflow's :attr:`workflowdir`.""" subprocess.call(['open', '-a', 'Terminal', self.workflowdir])
[ "def", "open_terminal", "(", "self", ")", ":", "subprocess", ".", "call", "(", "[", "'open'", ",", "'-a'", ",", "'Terminal'", ",", "self", ".", "workflowdir", "]", ")" ]
https://github.com/benknight/hue-alfred-workflow/blob/4447ba61116caf4a448b50c4bfb866565d66d81e/logic/packages/workflow/workflow.py#L2656-L2658
avocado-framework/avocado
1f9b3192e8ba47d029c33fe21266bd113d17811f
avocado/core/dispatcher.py
python
VarianterDispatcher.__setstate__
(self, state)
Very fragile pickle which works when all Varianter plugins are available on both machines. TODO: Replace this with per-plugin-refresh-mechanism
Very fragile pickle which works when all Varianter plugins are available on both machines.
[ "Very", "fragile", "pickle", "which", "works", "when", "all", "Varianter", "plugins", "are", "available", "on", "both", "machines", "." ]
def __setstate__(self, state): """ Very fragile pickle which works when all Varianter plugins are available on both machines. TODO: Replace this with per-plugin-refresh-mechanism """ self.__init__() self.extensions = state.get("extensions")
[ "def", "__setstate__", "(", "self", ",", "state", ")", ":", "self", ".", "__init__", "(", ")", "self", ".", "extensions", "=", "state", ".", "get", "(", "\"extensions\"", ")" ]
https://github.com/avocado-framework/avocado/blob/1f9b3192e8ba47d029c33fe21266bd113d17811f/avocado/core/dispatcher.py#L93-L101
ipython/ipyparallel
d35d4fb9501da5b3280b11e83ed633a95f17be1d
docs/source/examples/rmt/rmtkernel.py
python
GOE
(N)
return m / 2
Creates an NxN element of the Gaussian Orthogonal Ensemble
Creates an NxN element of the Gaussian Orthogonal Ensemble
[ "Creates", "an", "NxN", "element", "of", "the", "Gaussian", "Orthogonal", "Ensemble" ]
def GOE(N): """Creates an NxN element of the Gaussian Orthogonal Ensemble""" m = ra.standard_normal((N, N)) m += m.T return m / 2
[ "def", "GOE", "(", "N", ")", ":", "m", "=", "ra", ".", "standard_normal", "(", "(", "N", ",", "N", ")", ")", "m", "+=", "m", ".", "T", "return", "m", "/", "2" ]
https://github.com/ipython/ipyparallel/blob/d35d4fb9501da5b3280b11e83ed633a95f17be1d/docs/source/examples/rmt/rmtkernel.py#L10-L14
google-research/meta-dataset
c67dd2bb66fb2a4ce7e4e9906878e13d9b851eb5
meta_dataset/dataset_conversion/dataset_to_records.py
python
ImageNetConverter._create_data_spec
(self, train_split_only=False)
Initializes the HierarchicalDatasetSpecification instance for ImageNet. See HierarchicalDatasetSpecification for details. Args: train_split_only: bool, if True the entire dataset is assigned to the training split.
Initializes the HierarchicalDatasetSpecification instance for ImageNet.
[ "Initializes", "the", "HierarchicalDatasetSpecification", "instance", "for", "ImageNet", "." ]
def _create_data_spec(self, train_split_only=False): """Initializes the HierarchicalDatasetSpecification instance for ImageNet. See HierarchicalDatasetSpecification for details. Args: train_split_only: bool, if True the entire dataset is assigned to the training split. """ # Load list...
[ "def", "_create_data_spec", "(", "self", ",", "train_split_only", "=", "False", ")", ":", "# Load lists of image names that are duplicates with images in other", "# datasets. They will be skipped from ImageNet.", "self", ".", "files_to_skip", "=", "set", "(", ")", "for", "oth...
https://github.com/google-research/meta-dataset/blob/c67dd2bb66fb2a4ce7e4e9906878e13d9b851eb5/meta_dataset/dataset_conversion/dataset_to_records.py#L1501-L1548
bytefish/facerec
4071e1e79a50dbf1d1f2e061d24448576e5ac37d
py/apps/videofacerec/simple_videofacerec.py
python
App.__init__
(self, model, camera_id, cascade_filename)
[]
def __init__(self, model, camera_id, cascade_filename): self.model = model self.detector = CascadedDetector(cascade_fn=cascade_filename, minNeighbors=5, scaleFactor=1.1) self.cam = create_capture(camera_id)
[ "def", "__init__", "(", "self", ",", "model", ",", "camera_id", ",", "cascade_filename", ")", ":", "self", ".", "model", "=", "model", "self", ".", "detector", "=", "CascadedDetector", "(", "cascade_fn", "=", "cascade_filename", ",", "minNeighbors", "=", "5"...
https://github.com/bytefish/facerec/blob/4071e1e79a50dbf1d1f2e061d24448576e5ac37d/py/apps/videofacerec/simple_videofacerec.py#L104-L107
quic/aimet
dae9bae9a77ca719aa7553fefde4768270fc3518
TrainingExtensions/torch/src/python/aimet_torch/meta/old_connectedgraph.py
python
ConnectedGraph.num_operations
(self)
return len(self._ops)
Total number of operations: named and anonymous modules, and functions
Total number of operations: named and anonymous modules, and functions
[ "Total", "number", "of", "operations", ":", "named", "and", "anonymous", "modules", "and", "functions" ]
def num_operations(self): """Total number of operations: named and anonymous modules, and functions""" return len(self._ops)
[ "def", "num_operations", "(", "self", ")", ":", "return", "len", "(", "self", ".", "_ops", ")" ]
https://github.com/quic/aimet/blob/dae9bae9a77ca719aa7553fefde4768270fc3518/TrainingExtensions/torch/src/python/aimet_torch/meta/old_connectedgraph.py#L180-L182
team-ocean/veros
f62d6a2fe459a807fa6f3799c8aaa0a5fb70560f
veros/core/diffusion.py
python
biharmonic_diffusion
(state, tr, diffusivity)
return dtr, flux_east, flux_north
Biharmonic mixing of tracer tr
Biharmonic mixing of tracer tr
[ "Biharmonic", "mixing", "of", "tracer", "tr" ]
def biharmonic_diffusion(state, tr, diffusivity): """ Biharmonic mixing of tracer tr """ vs = state.variables settings = state.settings del2 = allocate(state.dimensions, ("xt", "yt", "zt")) dtr = allocate(state.dimensions, ("xt", "yt", "zt")) flux_east = allocate(state.dimensions, ("xt...
[ "def", "biharmonic_diffusion", "(", "state", ",", "tr", ",", "diffusivity", ")", ":", "vs", "=", "state", ".", "variables", "settings", "=", "state", ".", "settings", "del2", "=", "allocate", "(", "state", ".", "dimensions", ",", "(", "\"xt\"", ",", "\"y...
https://github.com/team-ocean/veros/blob/f62d6a2fe459a807fa6f3799c8aaa0a5fb70560f/veros/core/diffusion.py#L163-L239
AppScale/gts
46f909cf5dc5ba81faf9d81dc9af598dcf8a82a9
AppServer/lib/django-1.3/django/db/models/base.py
python
Model.__reduce__
(self)
return (model_unpickle, (model, defers, factory), data)
Provide pickling support. Normally, this just dispatches to Python's standard handling. However, for models with deferred field loading, we need to do things manually, as they're dynamically created classes and only module-level classes can be pickled by the default path.
Provide pickling support. Normally, this just dispatches to Python's standard handling. However, for models with deferred field loading, we need to do things manually, as they're dynamically created classes and only module-level classes can be pickled by the default path.
[ "Provide", "pickling", "support", ".", "Normally", "this", "just", "dispatches", "to", "Python", "s", "standard", "handling", ".", "However", "for", "models", "with", "deferred", "field", "loading", "we", "need", "to", "do", "things", "manually", "as", "they",...
def __reduce__(self): """ Provide pickling support. Normally, this just dispatches to Python's standard handling. However, for models with deferred field loading, we need to do things manually, as they're dynamically created classes and only module-level classes can be pickled by...
[ "def", "__reduce__", "(", "self", ")", ":", "data", "=", "self", ".", "__dict__", "model", "=", "self", ".", "__class__", "# The obvious thing to do here is to invoke super().__reduce__()", "# for the non-deferred case. Don't do that.", "# On Python 2.4, there is something weird ...
https://github.com/AppScale/gts/blob/46f909cf5dc5ba81faf9d81dc9af598dcf8a82a9/AppServer/lib/django-1.3/django/db/models/base.py#L389-L420
rowliny/DiffHelper
ab3a96f58f9579d0023aed9ebd785f4edf26f8af
Tool/SitePackages/nltk/parse/recursivedescent.py
python
SteppingRecursiveDescentParser.initialize
(self, tokens)
Start parsing a given text. This sets the parser's tree to the start symbol, its frontier to the root node, and its remaining text to ``token['SUBTOKENS']``.
Start parsing a given text. This sets the parser's tree to the start symbol, its frontier to the root node, and its remaining text to ``token['SUBTOKENS']``.
[ "Start", "parsing", "a", "given", "text", ".", "This", "sets", "the", "parser", "s", "tree", "to", "the", "start", "symbol", "its", "frontier", "to", "the", "root", "node", "and", "its", "remaining", "text", "to", "token", "[", "SUBTOKENS", "]", "." ]
def initialize(self, tokens): """ Start parsing a given text. This sets the parser's tree to the start symbol, its frontier to the root node, and its remaining text to ``token['SUBTOKENS']``. """ self._rtext = tokens start = self._grammar.start().symbol() ...
[ "def", "initialize", "(", "self", ",", "tokens", ")", ":", "self", ".", "_rtext", "=", "tokens", "start", "=", "self", ".", "_grammar", ".", "start", "(", ")", ".", "symbol", "(", ")", "self", ".", "_tree", "=", "Tree", "(", "start", ",", "[", "]...
https://github.com/rowliny/DiffHelper/blob/ab3a96f58f9579d0023aed9ebd785f4edf26f8af/Tool/SitePackages/nltk/parse/recursivedescent.py#L395-L411
pyca/cryptography
cb63359d3fc874b565a19ff0026af52b52d87ee3
src/cryptography/hazmat/primitives/serialization/ssh.py
python
_FragList.put_mpint
(self, val: int)
Big-endian bigint prefixed with u32 length
Big-endian bigint prefixed with u32 length
[ "Big", "-", "endian", "bigint", "prefixed", "with", "u32", "length" ]
def put_mpint(self, val: int) -> None: """Big-endian bigint prefixed with u32 length""" self.put_sshstr(_to_mpint(val))
[ "def", "put_mpint", "(", "self", ",", "val", ":", "int", ")", "->", "None", ":", "self", ".", "put_sshstr", "(", "_to_mpint", "(", "val", ")", ")" ]
https://github.com/pyca/cryptography/blob/cb63359d3fc874b565a19ff0026af52b52d87ee3/src/cryptography/hazmat/primitives/serialization/ssh.py#L198-L200
natural/java2python
b8037561c542522ae620e0a071ecc7e668461587
java2python/compiler/template.py
python
Method.iterParams
(self)
return chain(*(h(self) for h in self.configHandlers('Param')))
Yields the parameters of this method template.
Yields the parameters of this method template.
[ "Yields", "the", "parameters", "of", "this", "method", "template", "." ]
def iterParams(self): """ Yields the parameters of this method template. """ return chain(*(h(self) for h in self.configHandlers('Param')))
[ "def", "iterParams", "(", "self", ")", ":", "return", "chain", "(", "*", "(", "h", "(", "self", ")", "for", "h", "in", "self", ".", "configHandlers", "(", "'Param'", ")", ")", ")" ]
https://github.com/natural/java2python/blob/b8037561c542522ae620e0a071ecc7e668461587/java2python/compiler/template.py#L474-L476
duo-labs/isthislegit
5d51fd2e0fe070cacd1ee169ca8a371a72e005ef
dashboard/lib/flanker/mime/message/part.py
python
_CounterIO.tell
(self)
return self.length
[]
def tell(self): return self.length
[ "def", "tell", "(", "self", ")", ":", "return", "self", ".", "length" ]
https://github.com/duo-labs/isthislegit/blob/5d51fd2e0fe070cacd1ee169ca8a371a72e005ef/dashboard/lib/flanker/mime/message/part.py#L697-L698