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
tensorflow/datasets
2e496976d7d45550508395fb2f35cf958c8a3414
tensorflow_datasets/core/utils/py_utils.py
python
get_class_url
(cls)
return constants.SRC_BASE_URL + module_path + '.py'
Returns URL of given class or object.
Returns URL of given class or object.
[ "Returns", "URL", "of", "given", "class", "or", "object", "." ]
def get_class_url(cls): """Returns URL of given class or object.""" cls_path = get_class_path(cls, use_tfds_prefix=False) module_path, unused_class_name = cls_path.rsplit('.', 1) module_path = module_path.replace('.', '/') return constants.SRC_BASE_URL + module_path + '.py'
[ "def", "get_class_url", "(", "cls", ")", ":", "cls_path", "=", "get_class_path", "(", "cls", ",", "use_tfds_prefix", "=", "False", ")", "module_path", ",", "unused_class_name", "=", "cls_path", ".", "rsplit", "(", "'.'", ",", "1", ")", "module_path", "=", ...
https://github.com/tensorflow/datasets/blob/2e496976d7d45550508395fb2f35cf958c8a3414/tensorflow_datasets/core/utils/py_utils.py#L429-L434
emesene/emesene
4548a4098310e21b16437bb36223a7f632a4f7bc
emesene/e3/xmpp/SleekXMPP/sleekxmpp/plugins/xep_0060/stanza/pubsub_errors.py
python
PubsubErrorCondition.set_condition
(self, value)
return self
Set the tag name of the condition element. Arguments: value -- The tag name of the condition element.
Set the tag name of the condition element.
[ "Set", "the", "tag", "name", "of", "the", "condition", "element", "." ]
def set_condition(self, value): """ Set the tag name of the condition element. Arguments: value -- The tag name of the condition element. """ if value in self.conditions: del self['condition'] cond = ET.Element("{%s}%s" % (self.condition_ns, va...
[ "def", "set_condition", "(", "self", ",", "value", ")", ":", "if", "value", "in", "self", ".", "conditions", ":", "del", "self", "[", "'condition'", "]", "cond", "=", "ET", ".", "Element", "(", "\"{%s}%s\"", "%", "(", "self", ".", "condition_ns", ",", ...
https://github.com/emesene/emesene/blob/4548a4098310e21b16437bb36223a7f632a4f7bc/emesene/e3/xmpp/SleekXMPP/sleekxmpp/plugins/xep_0060/stanza/pubsub_errors.py#L43-L54
securesystemslab/zippy
ff0e84ac99442c2c55fe1d285332cfd4e185e089
zippy/benchmarks/src/benchmarks/sympy/sympy/solvers/ode.py
python
checkodesol
(ode, sol, func=None, order='auto', solve_for_func=True)
r""" Substitutes ``sol`` into ``ode`` and checks that the result is ``0``. This only works when ``func`` is one function, like `f(x)`. ``sol`` can be a single solution or a list of solutions. Each solution may be an :py:class:`~sympy.core.relational.Equality` that the solution satisfies, e.g. ``E...
r""" Substitutes ``sol`` into ``ode`` and checks that the result is ``0``.
[ "r", "Substitutes", "sol", "into", "ode", "and", "checks", "that", "the", "result", "is", "0", "." ]
def checkodesol(ode, sol, func=None, order='auto', solve_for_func=True): r""" Substitutes ``sol`` into ``ode`` and checks that the result is ``0``. This only works when ``func`` is one function, like `f(x)`. ``sol`` can be a single solution or a list of solutions. Each solution may be an :py:clas...
[ "def", "checkodesol", "(", "ode", ",", "sol", ",", "func", "=", "None", ",", "order", "=", "'auto'", ",", "solve_for_func", "=", "True", ")", ":", "if", "not", "isinstance", "(", "ode", ",", "Equality", ")", ":", "ode", "=", "Eq", "(", "ode", ",", ...
https://github.com/securesystemslab/zippy/blob/ff0e84ac99442c2c55fe1d285332cfd4e185e089/zippy/benchmarks/src/benchmarks/sympy/sympy/solvers/ode.py#L1683-L1899
apache/libcloud
90971e17bfd7b6bb97b2489986472c531cc8e140
libcloud/compute/drivers/abiquo.py
python
AbiquoNodeDriver.ex_list_groups
(self, location=None)
return groups
List all groups. :param location: filter the groups by location (optional) :type location: a :class:`NodeLocation` instance. :return: the list of :class:`NodeGroup`
List all groups.
[ "List", "all", "groups", "." ]
def ex_list_groups(self, location=None): """ List all groups. :param location: filter the groups by location (optional) :type location: a :class:`NodeLocation` instance. :return: the list of :class:`NodeGroup` """ groups = [] for vdc in self._ge...
[ "def", "ex_list_groups", "(", "self", ",", "location", "=", "None", ")", ":", "groups", "=", "[", "]", "for", "vdc", "in", "self", ".", "_get_locations", "(", "location", ")", ":", "link_vdc", "=", "self", ".", "connection", ".", "cache", "[", "\"locat...
https://github.com/apache/libcloud/blob/90971e17bfd7b6bb97b2489986472c531cc8e140/libcloud/compute/drivers/abiquo.py#L383-L412
jython/jython3
def4f8ec47cb7a9c799ea4c745f12badf92c5769
lib-python/3.5.1/stat.py
python
S_ISREG
(mode)
return S_IFMT(mode) == S_IFREG
Return True if mode is from a regular file.
Return True if mode is from a regular file.
[ "Return", "True", "if", "mode", "is", "from", "a", "regular", "file", "." ]
def S_ISREG(mode): """Return True if mode is from a regular file.""" return S_IFMT(mode) == S_IFREG
[ "def", "S_ISREG", "(", "mode", ")", ":", "return", "S_IFMT", "(", "mode", ")", "==", "S_IFREG" ]
https://github.com/jython/jython3/blob/def4f8ec47cb7a9c799ea4c745f12badf92c5769/lib-python/3.5.1/stat.py#L58-L60
Tautulli/Tautulli
2410eb33805aaac4bd1c5dad0f71e4f15afaf742
lib/infi/systray/traybar.py
python
SysTrayIcon._create_menu
(self, menu, menu_options)
[]
def _create_menu(self, menu, menu_options): for option_text, option_icon, option_action, option_state, option_id in menu_options[::-1]: if option_icon: option_icon = self._prep_menu_icon(option_icon) mi_fstate = 0 mi_ftype = 0 if option_state == ...
[ "def", "_create_menu", "(", "self", ",", "menu", ",", "menu_options", ")", ":", "for", "option_text", ",", "option_icon", ",", "option_action", ",", "option_state", ",", "option_id", "in", "menu_options", "[", ":", ":", "-", "1", "]", ":", "if", "option_ic...
https://github.com/Tautulli/Tautulli/blob/2410eb33805aaac4bd1c5dad0f71e4f15afaf742/lib/infi/systray/traybar.py#L250-L280
cgarrard/osgeopy-code
bc85f4ec7a630b53502ee491e400057b67cdab22
ospybook/ospybook/vectorplotter.py
python
VectorPlotter._plot_geom
(self, geom, symbol='', **kwargs)
Plot a geometry.
Plot a geometry.
[ "Plot", "a", "geometry", "." ]
def _plot_geom(self, geom, symbol='', **kwargs): """Plot a geometry.""" geom_name = geom.GetGeometryName() if geom_name == 'POINT': symbol = symbol or self._point_symbol() return self._plot_point(self._get_point_coords(geom), symbol, **kwargs) elif geom_name == 'M...
[ "def", "_plot_geom", "(", "self", ",", "geom", ",", "symbol", "=", "''", ",", "*", "*", "kwargs", ")", ":", "geom_name", "=", "geom", ".", "GetGeometryName", "(", ")", "if", "geom_name", "==", "'POINT'", ":", "symbol", "=", "symbol", "or", "self", "....
https://github.com/cgarrard/osgeopy-code/blob/bc85f4ec7a630b53502ee491e400057b67cdab22/ospybook/ospybook/vectorplotter.py#L86-L109
CellProfiler/CellProfiler
a90e17e4d258c6f3900238be0f828e0b4bd1b293
cellprofiler/gui/pipelinelistview.py
python
PipelineListView.reset_debug_module
(self)
return None
Set the pipeline slider to the first module to be debugged Skip the input modules. If there are no other modules, return None, otherwise return the first module
Set the pipeline slider to the first module to be debugged
[ "Set", "the", "pipeline", "slider", "to", "the", "first", "module", "to", "be", "debugged" ]
def reset_debug_module(self): """Set the pipeline slider to the first module to be debugged Skip the input modules. If there are no other modules, return None, otherwise return the first module """ self.list_ctrl.last_running_item = 0 for module in self.__pipeline.module...
[ "def", "reset_debug_module", "(", "self", ")", ":", "self", ".", "list_ctrl", ".", "last_running_item", "=", "0", "for", "module", "in", "self", ".", "__pipeline", ".", "modules", "(", ")", ":", "if", "not", "module", ".", "is_input_module", "(", ")", ":...
https://github.com/CellProfiler/CellProfiler/blob/a90e17e4d258c6f3900238be0f828e0b4bd1b293/cellprofiler/gui/pipelinelistview.py#L393-L404
jython/frozen-mirror
b8d7aa4cee50c0c0fe2f4b235dd62922dd0f3f99
lib-python/2.7/encodings/quopri_codec.py
python
quopri_encode
(input, errors='strict')
return (output, len(input))
Encode the input, returning a tuple (output object, length consumed). errors defines the error handling to apply. It defaults to 'strict' handling which is the only currently supported error handling for this codec.
Encode the input, returning a tuple (output object, length consumed).
[ "Encode", "the", "input", "returning", "a", "tuple", "(", "output", "object", "length", "consumed", ")", "." ]
def quopri_encode(input, errors='strict'): """Encode the input, returning a tuple (output object, length consumed). errors defines the error handling to apply. It defaults to 'strict' handling which is the only currently supported error handling for this codec. """ assert errors == 'strict' ...
[ "def", "quopri_encode", "(", "input", ",", "errors", "=", "'strict'", ")", ":", "assert", "errors", "==", "'strict'", "# using str() because of cStringIO's Unicode undesired Unicode behavior.", "f", "=", "StringIO", "(", "str", "(", "input", ")", ")", "g", "=", "S...
https://github.com/jython/frozen-mirror/blob/b8d7aa4cee50c0c0fe2f4b235dd62922dd0f3f99/lib-python/2.7/encodings/quopri_codec.py#L12-L26
iTechArt/convtools-ita
25c1057e20581d957bec1339758325dc98fec43e
src/convtools/base.py
python
This._gen_code_and_update_ctx
(self, code_input, ctx)
return code_input
[]
def _gen_code_and_update_ctx(self, code_input, ctx): return code_input
[ "def", "_gen_code_and_update_ctx", "(", "self", ",", "code_input", ",", "ctx", ")", ":", "return", "code_input" ]
https://github.com/iTechArt/convtools-ita/blob/25c1057e20581d957bec1339758325dc98fec43e/src/convtools/base.py#L927-L928
yuxiaokui/Intranet-Penetration
f57678a204840c83cbf3308e3470ae56c5ff514b
proxy/XX-Net/code/default/python27/1.0/lib/noarch/pycparser/c_parser.py
python
CParser.p_jump_statement_1
(self, p)
jump_statement : GOTO ID SEMI
jump_statement : GOTO ID SEMI
[ "jump_statement", ":", "GOTO", "ID", "SEMI" ]
def p_jump_statement_1(self, p): """ jump_statement : GOTO ID SEMI """ p[0] = c_ast.Goto(p[2], self._coord(p.lineno(1)))
[ "def", "p_jump_statement_1", "(", "self", ",", "p", ")", ":", "p", "[", "0", "]", "=", "c_ast", ".", "Goto", "(", "p", "[", "2", "]", ",", "self", ".", "_coord", "(", "p", ".", "lineno", "(", "1", ")", ")", ")" ]
https://github.com/yuxiaokui/Intranet-Penetration/blob/f57678a204840c83cbf3308e3470ae56c5ff514b/proxy/XX-Net/code/default/python27/1.0/lib/noarch/pycparser/c_parser.py#L1327-L1329
WooYun/TangScan
f4fd60228ec09ad10bd3dd3ef3b67e58bcdd4aa5
tangscan/thirdparty/requests/packages/urllib3/packages/ordered_dict.py
python
OrderedDict.viewitems
(self)
return ItemsView(self)
od.viewitems() -> a set-like object providing a view on od's items
od.viewitems() -> a set-like object providing a view on od's items
[ "od", ".", "viewitems", "()", "-", ">", "a", "set", "-", "like", "object", "providing", "a", "view", "on", "od", "s", "items" ]
def viewitems(self): "od.viewitems() -> a set-like object providing a view on od's items" return ItemsView(self)
[ "def", "viewitems", "(", "self", ")", ":", "return", "ItemsView", "(", "self", ")" ]
https://github.com/WooYun/TangScan/blob/f4fd60228ec09ad10bd3dd3ef3b67e58bcdd4aa5/tangscan/thirdparty/requests/packages/urllib3/packages/ordered_dict.py#L257-L259
horazont/aioxmpp
c701e6399c90a6bb9bec0349018a03bd7b644cde
aioxmpp/stringprep.py
python
nodeprep
(string, allow_unassigned=False)
return "".join(chars)
Process the given `string` using the Nodeprep (`RFC 6122`_) profile. In the error cases defined in `RFC 3454`_ (stringprep), a :class:`ValueError` is raised.
Process the given `string` using the Nodeprep (`RFC 6122`_) profile. In the error cases defined in `RFC 3454`_ (stringprep), a :class:`ValueError` is raised.
[ "Process", "the", "given", "string", "using", "the", "Nodeprep", "(", "RFC", "6122", "_", ")", "profile", ".", "In", "the", "error", "cases", "defined", "in", "RFC", "3454", "_", "(", "stringprep", ")", "a", ":", "class", ":", "ValueError", "is", "rais...
def nodeprep(string, allow_unassigned=False): """ Process the given `string` using the Nodeprep (`RFC 6122`_) profile. In the error cases defined in `RFC 3454`_ (stringprep), a :class:`ValueError` is raised. """ chars = list(string) _nodeprep_do_mapping(chars) do_normalization(chars) ...
[ "def", "nodeprep", "(", "string", ",", "allow_unassigned", "=", "False", ")", ":", "chars", "=", "list", "(", "string", ")", "_nodeprep_do_mapping", "(", "chars", ")", "do_normalization", "(", "chars", ")", "check_prohibited_output", "(", "chars", ",", "(", ...
https://github.com/horazont/aioxmpp/blob/c701e6399c90a6bb9bec0349018a03bd7b644cde/aioxmpp/stringprep.py#L149-L185
lyft/confidant
8a9152fc97919ba5b9f3461a9ab1019d701584bd
confidant/services/keymanager.py
python
create_datakey
(encryption_context)
return cryptolib.create_datakey( encryption_context, settings.KMS_MASTER_KEY, client=at_rest_kms_client )
Create a datakey from KMS.
Create a datakey from KMS.
[ "Create", "a", "datakey", "from", "KMS", "." ]
def create_datakey(encryption_context): ''' Create a datakey from KMS. ''' at_rest_kms_client = _get_at_rest_kms_client() # Disabled encryption is dangerous, so we don't use falsiness here. if settings.USE_ENCRYPTION is False: logger.warning( 'Creating a mock datakey in keyma...
[ "def", "create_datakey", "(", "encryption_context", ")", ":", "at_rest_kms_client", "=", "_get_at_rest_kms_client", "(", ")", "# Disabled encryption is dangerous, so we don't use falsiness here.", "if", "settings", ".", "USE_ENCRYPTION", "is", "False", ":", "logger", ".", "...
https://github.com/lyft/confidant/blob/8a9152fc97919ba5b9f3461a9ab1019d701584bd/confidant/services/keymanager.py#L49-L68
JiYou/openstack
8607dd488bde0905044b303eb6e52bdea6806923
packages/source/cinder/cinder/volume/drivers/san/hp/hp_3par_iscsi.py
python
HP3PARISCSIDriver.create_cloned_volume
(self, volume, src_vref)
return {'provider_location': "%s:%s" % (self.configuration.iscsi_ip_address, self.configuration.iscsi_port), 'metadata': new_vol}
Clone an existing volume.
Clone an existing volume.
[ "Clone", "an", "existing", "volume", "." ]
def create_cloned_volume(self, volume, src_vref): """ Clone an existing volume. """ new_vol = self.common.create_cloned_volume(volume, src_vref, self.client) return {'provider_location': "%s:%s" % (self.configuration.iscsi_ip_add...
[ "def", "create_cloned_volume", "(", "self", ",", "volume", ",", "src_vref", ")", ":", "new_vol", "=", "self", ".", "common", ".", "create_cloned_volume", "(", "volume", ",", "src_vref", ",", "self", ".", "client", ")", "return", "{", "'provider_location'", "...
https://github.com/JiYou/openstack/blob/8607dd488bde0905044b303eb6e52bdea6806923/packages/source/cinder/cinder/volume/drivers/san/hp/hp_3par_iscsi.py#L131-L138
Pymol-Scripts/Pymol-script-repo
bcd7bb7812dc6db1595953dfa4471fa15fb68c77
modules/ADT/MolKit/pdb2pqr/src/pdb.py
python
CISPEP.__init__
(self, line)
Initialize by parsing line COLUMNS TYPE FIELD DEFINITION ----------------------------------------------------------- 8-10 int serNum Record serial number. 12-14 string pep1 Residue name. 16 string chainID1 Chain identifier. ...
Initialize by parsing line
[ "Initialize", "by", "parsing", "line" ]
def __init__(self, line): """ Initialize by parsing line COLUMNS TYPE FIELD DEFINITION ----------------------------------------------------------- 8-10 int serNum Record serial number. 12-14 string pep1 Residue name. ...
[ "def", "__init__", "(", "self", ",", "line", ")", ":", "record", "=", "string", ".", "strip", "(", "line", "[", "0", ":", "6", "]", ")", "if", "record", "==", "\"CISPEP\"", ":", "self", ".", "serNum", "=", "int", "(", "string", ".", "strip", "(",...
https://github.com/Pymol-Scripts/Pymol-script-repo/blob/bcd7bb7812dc6db1595953dfa4471fa15fb68c77/modules/ADT/MolKit/pdb2pqr/src/pdb.py#L1192-L1223
clips/pattern
d25511f9ca7ed9356b801d8663b8b5168464e68f
pattern/db/__init__.py
python
DatasheetColumn.__init__
(self, datasheet, j)
A dynamic column in a Datasheet. If the actual column is deleted with Datasheet.columns.remove() or Datasheet.columms.pop(), the DatasheetColumn object will be orphaned (i.e., it is no longer part of the table).
A dynamic column in a Datasheet. If the actual column is deleted with Datasheet.columns.remove() or Datasheet.columms.pop(), the DatasheetColumn object will be orphaned (i.e., it is no longer part of the table).
[ "A", "dynamic", "column", "in", "a", "Datasheet", ".", "If", "the", "actual", "column", "is", "deleted", "with", "Datasheet", ".", "columns", ".", "remove", "()", "or", "Datasheet", ".", "columms", ".", "pop", "()", "the", "DatasheetColumn", "object", "wil...
def __init__(self, datasheet, j): """ A dynamic column in a Datasheet. If the actual column is deleted with Datasheet.columns.remove() or Datasheet.columms.pop(), the DatasheetColumn object will be orphaned (i.e., it is no longer part of the table). """ self._datasheet = ...
[ "def", "__init__", "(", "self", ",", "datasheet", ",", "j", ")", ":", "self", ".", "_datasheet", "=", "datasheet", "self", ".", "_j", "=", "j" ]
https://github.com/clips/pattern/blob/d25511f9ca7ed9356b801d8663b8b5168464e68f/pattern/db/__init__.py#L2548-L2554
Arelle/Arelle
20f3d8a8afd41668e1520799acd333349ce0ba17
arelle/ModelInstanceObject.py
python
NewFactItemOptions.startDateDate
(self)
return XmlUtil.datetimeValue(self.startDate)
(datetime) -- date-typed date value of startDate (which is persisted in str form)
(datetime) -- date-typed date value of startDate (which is persisted in str form)
[ "(", "datetime", ")", "--", "date", "-", "typed", "date", "value", "of", "startDate", "(", "which", "is", "persisted", "in", "str", "form", ")" ]
def startDateDate(self): """(datetime) -- date-typed date value of startDate (which is persisted in str form)""" return XmlUtil.datetimeValue(self.startDate)
[ "def", "startDateDate", "(", "self", ")", ":", "return", "XmlUtil", ".", "datetimeValue", "(", "self", ".", "startDate", ")" ]
https://github.com/Arelle/Arelle/blob/20f3d8a8afd41668e1520799acd333349ce0ba17/arelle/ModelInstanceObject.py#L114-L116
sethmlarson/virtualbox-python
984a6e2cb0e8996f4df40f4444c1528849f1c70d
virtualbox/library.py
python
ISystemProperties.supported_pointing_hid_types
(self)
return [PointingHIDType(a) for a in ret]
Get PointingHIDType value for 'supportedPointingHIDTypes' Returns an array of officially supported values for enum :py:class:`PointingHIDType` , in the sense of what is e.g. worth offering in the VirtualBox GUI.
Get PointingHIDType value for 'supportedPointingHIDTypes' Returns an array of officially supported values for enum :py:class:`PointingHIDType` , in the sense of what is e.g. worth offering in the VirtualBox GUI.
[ "Get", "PointingHIDType", "value", "for", "supportedPointingHIDTypes", "Returns", "an", "array", "of", "officially", "supported", "values", "for", "enum", ":", "py", ":", "class", ":", "PointingHIDType", "in", "the", "sense", "of", "what", "is", "e", ".", "g",...
def supported_pointing_hid_types(self): """Get PointingHIDType value for 'supportedPointingHIDTypes' Returns an array of officially supported values for enum :py:class:`PointingHIDType` , in the sense of what is e.g. worth offering in the VirtualBox GUI. """ ret = self._get_attr(...
[ "def", "supported_pointing_hid_types", "(", "self", ")", ":", "ret", "=", "self", ".", "_get_attr", "(", "\"supportedPointingHIDTypes\"", ")", "return", "[", "PointingHIDType", "(", "a", ")", "for", "a", "in", "ret", "]" ]
https://github.com/sethmlarson/virtualbox-python/blob/984a6e2cb0e8996f4df40f4444c1528849f1c70d/virtualbox/library.py#L20670-L20676
securesystemslab/zippy
ff0e84ac99442c2c55fe1d285332cfd4e185e089
zippy/lib-python/3/mailbox.py
python
_ProxyFile.readlines
(self, sizehint=None)
return result
Read multiple lines.
Read multiple lines.
[ "Read", "multiple", "lines", "." ]
def readlines(self, sizehint=None): """Read multiple lines.""" result = [] for line in self: result.append(line) if sizehint is not None: sizehint -= len(line) if sizehint <= 0: break return result
[ "def", "readlines", "(", "self", ",", "sizehint", "=", "None", ")", ":", "result", "=", "[", "]", "for", "line", "in", "self", ":", "result", ".", "append", "(", "line", ")", "if", "sizehint", "is", "not", "None", ":", "sizehint", "-=", "len", "(",...
https://github.com/securesystemslab/zippy/blob/ff0e84ac99442c2c55fe1d285332cfd4e185e089/zippy/lib-python/3/mailbox.py#L1892-L1901
amymcgovern/pyparrot
bf4775ec1199b282e4edde1e4a8e018dcc8725e0
pyparrot/networking/wifiConnection.py
python
WifiConnection._create_udp_connection
(self)
Create the UDP connection
Create the UDP connection
[ "Create", "the", "UDP", "connection" ]
def _create_udp_connection(self): """ Create the UDP connection """ self.udp_send_sock = socket.socket(family=socket.AF_INET, type=socket.SOCK_DGRAM) #self.udp_send_sock.connect((self.drone_ip, self.udp_send_port)) self.udp_receive_sock = socket.socket(family=socket.AF_I...
[ "def", "_create_udp_connection", "(", "self", ")", ":", "self", ".", "udp_send_sock", "=", "socket", ".", "socket", "(", "family", "=", "socket", ".", "AF_INET", ",", "type", "=", "socket", ".", "SOCK_DGRAM", ")", "#self.udp_send_sock.connect((self.drone_ip, self....
https://github.com/amymcgovern/pyparrot/blob/bf4775ec1199b282e4edde1e4a8e018dcc8725e0/pyparrot/networking/wifiConnection.py#L378-L397
Nuitka/Nuitka
39262276993757fa4e299f497654065600453fc9
nuitka/build/inline_copy/tqdm/tqdm/std.py
python
trange
(*args, **kwargs)
return tqdm(_range(*args), **kwargs)
A shortcut for tqdm(xrange(*args), **kwargs). On Python3+ range is used instead of xrange.
A shortcut for tqdm(xrange(*args), **kwargs). On Python3+ range is used instead of xrange.
[ "A", "shortcut", "for", "tqdm", "(", "xrange", "(", "*", "args", ")", "**", "kwargs", ")", ".", "On", "Python3", "+", "range", "is", "used", "instead", "of", "xrange", "." ]
def trange(*args, **kwargs): """ A shortcut for tqdm(xrange(*args), **kwargs). On Python3+ range is used instead of xrange. """ return tqdm(_range(*args), **kwargs)
[ "def", "trange", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "return", "tqdm", "(", "_range", "(", "*", "args", ")", ",", "*", "*", "kwargs", ")" ]
https://github.com/Nuitka/Nuitka/blob/39262276993757fa4e299f497654065600453fc9/nuitka/build/inline_copy/tqdm/tqdm/std.py#L1519-L1524
Grokzen/redis-py-cluster
f0627c91ce23e8784dbc996078428c9bdbacb20b
rediscluster/client.py
python
RedisCluster.cluster_save_config
(self)
return self.execute_command('CLUSTER SAVECONFIG')
Forces the node to save cluster state on disk Sends to all nodes in the cluster
Forces the node to save cluster state on disk
[ "Forces", "the", "node", "to", "save", "cluster", "state", "on", "disk" ]
def cluster_save_config(self): """ Forces the node to save cluster state on disk Sends to all nodes in the cluster """ return self.execute_command('CLUSTER SAVECONFIG')
[ "def", "cluster_save_config", "(", "self", ")", ":", "return", "self", ".", "execute_command", "(", "'CLUSTER SAVECONFIG'", ")" ]
https://github.com/Grokzen/redis-py-cluster/blob/f0627c91ce23e8784dbc996078428c9bdbacb20b/rediscluster/client.py#L894-L900
CedricGuillemet/Imogen
ee417b42747ed5b46cb11b02ef0c3630000085b3
bin/Lib/lib2to3/fixer_util.py
python
String
(string, prefix=None)
return Leaf(token.STRING, string, prefix=prefix)
A string leaf
A string leaf
[ "A", "string", "leaf" ]
def String(string, prefix=None): """A string leaf""" return Leaf(token.STRING, string, prefix=prefix)
[ "def", "String", "(", "string", ",", "prefix", "=", "None", ")", ":", "return", "Leaf", "(", "token", ".", "STRING", ",", "string", ",", "prefix", "=", "prefix", ")" ]
https://github.com/CedricGuillemet/Imogen/blob/ee417b42747ed5b46cb11b02ef0c3630000085b3/bin/Lib/lib2to3/fixer_util.py#L83-L85
jundongl/scikit-feature
48cffad4e88ff4b9d2f1c7baffb314d1b3303792
skfeature/function/statistical_based/low_variance.py
python
low_variance_feature_selection
(X, threshold)
return sel.fit_transform(X)
This function implements the low_variance feature selection (existing method in scikit-learn) Input ----- X: {numpy array}, shape (n_samples, n_features) input data p:{float} parameter used to calculate the threshold(threshold = p*(1-p)) Output ------ X_new: {numpy array}, ...
This function implements the low_variance feature selection (existing method in scikit-learn)
[ "This", "function", "implements", "the", "low_variance", "feature", "selection", "(", "existing", "method", "in", "scikit", "-", "learn", ")" ]
def low_variance_feature_selection(X, threshold): """ This function implements the low_variance feature selection (existing method in scikit-learn) Input ----- X: {numpy array}, shape (n_samples, n_features) input data p:{float} parameter used to calculate the threshold(threshol...
[ "def", "low_variance_feature_selection", "(", "X", ",", "threshold", ")", ":", "sel", "=", "VarianceThreshold", "(", "threshold", ")", "return", "sel", ".", "fit_transform", "(", "X", ")" ]
https://github.com/jundongl/scikit-feature/blob/48cffad4e88ff4b9d2f1c7baffb314d1b3303792/skfeature/function/statistical_based/low_variance.py#L4-L21
man-group/PythonTrainingExercises
00a2435649fcf53fdafede2d10b40f08463728fe
Beginners/ListsTuples/solutions.py
python
select_first_item
()
return x[0]
Return first item.
Return first item.
[ "Return", "first", "item", "." ]
def select_first_item(): """Return first item.""" x = ['A', 'B', 'C'] return x[0]
[ "def", "select_first_item", "(", ")", ":", "x", "=", "[", "'A'", ",", "'B'", ",", "'C'", "]", "return", "x", "[", "0", "]" ]
https://github.com/man-group/PythonTrainingExercises/blob/00a2435649fcf53fdafede2d10b40f08463728fe/Beginners/ListsTuples/solutions.py#L115-L118
Blosc/bloscpack
5efdadf5b6f61e995df1817943afb9629ce28c89
bloscpack/numpy_io.py
python
unpack_ndarray_from_file
(filename)
return unpack_ndarray(source)
Deserialize a Numpy array from a file. Parameters ---------- filename : str the file to decompress from Returns ------- ndarray : ndarray the Numpy array Raises ------ NotANumpyArray if the source doesn't seem to contain a Numpy array
Deserialize a Numpy array from a file.
[ "Deserialize", "a", "Numpy", "array", "from", "a", "file", "." ]
def unpack_ndarray_from_file(filename): """ Deserialize a Numpy array from a file. Parameters ---------- filename : str the file to decompress from Returns ------- ndarray : ndarray the Numpy array Raises ------ NotANumpyArray if the source doesn't seem...
[ "def", "unpack_ndarray_from_file", "(", "filename", ")", ":", "source", "=", "CompressedFPSource", "(", "open", "(", "filename", ",", "'rb'", ")", ")", "return", "unpack_ndarray", "(", "source", ")" ]
https://github.com/Blosc/bloscpack/blob/5efdadf5b6f61e995df1817943afb9629ce28c89/bloscpack/numpy_io.py#L310-L329
wistbean/learn_python3_spider
73c873f4845f4385f097e5057407d03dd37a117b
stackoverflow/venv/lib/python3.6/site-packages/pip-19.0.3-py3.6.egg/pip/_vendor/pyparsing.py
python
ParseResults.getName
(self)
r""" Returns the results name for this token expression. Useful when several different expressions might match at a particular location. Example:: integer = Word(nums) ssn_expr = Regex(r"\d\d\d-\d\d-\d\d\d\d") house_number_expr = Suppress('#') + Word(nums, a...
r""" Returns the results name for this token expression. Useful when several different expressions might match at a particular location.
[ "r", "Returns", "the", "results", "name", "for", "this", "token", "expression", ".", "Useful", "when", "several", "different", "expressions", "might", "match", "at", "a", "particular", "location", "." ]
def getName(self): r""" Returns the results name for this token expression. Useful when several different expressions might match at a particular location. Example:: integer = Word(nums) ssn_expr = Regex(r"\d\d\d-\d\d-\d\d\d\d") house_number_expr = S...
[ "def", "getName", "(", "self", ")", ":", "if", "self", ".", "__name", ":", "return", "self", ".", "__name", "elif", "self", ".", "__parent", ":", "par", "=", "self", ".", "__parent", "(", ")", "if", "par", ":", "return", "par", ".", "__lookup", "("...
https://github.com/wistbean/learn_python3_spider/blob/73c873f4845f4385f097e5057407d03dd37a117b/stackoverflow/venv/lib/python3.6/site-packages/pip-19.0.3-py3.6.egg/pip/_vendor/pyparsing.py#L954-L992
openai/spinningup
038665d62d569055401d91856abb287263096178
spinup/utils/run_utils.py
python
valid_str
(v)
return str_v
Convert a value or values to a string which could go in a filepath. Partly based on `this gist`_. .. _`this gist`: https://gist.github.com/seanh/93666
Convert a value or values to a string which could go in a filepath.
[ "Convert", "a", "value", "or", "values", "to", "a", "string", "which", "could", "go", "in", "a", "filepath", "." ]
def valid_str(v): """ Convert a value or values to a string which could go in a filepath. Partly based on `this gist`_. .. _`this gist`: https://gist.github.com/seanh/93666 """ if hasattr(v, '__name__'): return valid_str(v.__name__) if isinstance(v, tuple) or isinstance(v, list)...
[ "def", "valid_str", "(", "v", ")", ":", "if", "hasattr", "(", "v", ",", "'__name__'", ")", ":", "return", "valid_str", "(", "v", ".", "__name__", ")", "if", "isinstance", "(", "v", ",", "tuple", ")", "or", "isinstance", "(", "v", ",", "list", ")", ...
https://github.com/openai/spinningup/blob/038665d62d569055401d91856abb287263096178/spinup/utils/run_utils.py#L217-L237
IronLanguages/main
a949455434b1fda8c783289e897e78a9a0caabb5
External.LCA_RESTRICTED/Languages/CPython/27/Lib/tempfile.py
python
mkstemp
(suffix="", prefix=template, dir=None, text=False)
return _mkstemp_inner(dir, prefix, suffix, flags)
User-callable function to create and return a unique temporary file. The return value is a pair (fd, name) where fd is the file descriptor returned by os.open, and name is the filename. If 'suffix' is specified, the file name will end with that suffix, otherwise there will be no suffix. If 'prefi...
User-callable function to create and return a unique temporary file. The return value is a pair (fd, name) where fd is the file descriptor returned by os.open, and name is the filename.
[ "User", "-", "callable", "function", "to", "create", "and", "return", "a", "unique", "temporary", "file", ".", "The", "return", "value", "is", "a", "pair", "(", "fd", "name", ")", "where", "fd", "is", "the", "file", "descriptor", "returned", "by", "os", ...
def mkstemp(suffix="", prefix=template, dir=None, text=False): """User-callable function to create and return a unique temporary file. The return value is a pair (fd, name) where fd is the file descriptor returned by os.open, and name is the filename. If 'suffix' is specified, the file name will end w...
[ "def", "mkstemp", "(", "suffix", "=", "\"\"", ",", "prefix", "=", "template", ",", "dir", "=", "None", ",", "text", "=", "False", ")", ":", "if", "dir", "is", "None", ":", "dir", "=", "gettempdir", "(", ")", "if", "text", ":", "flags", "=", "_tex...
https://github.com/IronLanguages/main/blob/a949455434b1fda8c783289e897e78a9a0caabb5/External.LCA_RESTRICTED/Languages/CPython/27/Lib/tempfile.py#L259-L293
treeio/treeio
bae3115f4015aad2cbc5ab45572232ceec990495
treeio/infrastructure/forms.py
python
ItemForm.__init__
(self, user, item_type, *args, **kwargs)
Populates form with fields from given AssetType
Populates form with fields from given AssetType
[ "Populates", "form", "with", "fields", "from", "given", "AssetType" ]
def __init__(self, user, item_type, *args, **kwargs): "Populates form with fields from given AssetType" self.item_type = item_type if 'instance' in kwargs: self.instance = kwargs['instance'] values = self.instance.itemvalue_set.all() del kwargs['instance'] ...
[ "def", "__init__", "(", "self", ",", "user", ",", "item_type", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "self", ".", "item_type", "=", "item_type", "if", "'instance'", "in", "kwargs", ":", "self", ".", "instance", "=", "kwargs", "[", "'in...
https://github.com/treeio/treeio/blob/bae3115f4015aad2cbc5ab45572232ceec990495/treeio/infrastructure/forms.py#L127-L229
lightaime/deep_gcns_torch
7885181484978fbf3839bf0e929fb1c2484d0a7d
examples/sem_seg_sparse/config.py
python
OptInit._configure_logger
(self)
Configure logger on given level. Logging will occur on standard output and in a log file saved in model_dir.
Configure logger on given level. Logging will occur on standard output and in a log file saved in model_dir.
[ "Configure", "logger", "on", "given", "level", ".", "Logging", "will", "occur", "on", "standard", "output", "and", "in", "a", "log", "file", "saved", "in", "model_dir", "." ]
def _configure_logger(self): """ Configure logger on given level. Logging will occur on standard output and in a log file saved in model_dir. """ self.args.loglevel = "info" numeric_level = getattr(logging, self.args.loglevel.upper(), None) if not isinstance(numer...
[ "def", "_configure_logger", "(", "self", ")", ":", "self", ".", "args", ".", "loglevel", "=", "\"info\"", "numeric_level", "=", "getattr", "(", "logging", ",", "self", ".", "args", ".", "loglevel", ".", "upper", "(", ")", ",", "None", ")", "if", "not",...
https://github.com/lightaime/deep_gcns_torch/blob/7885181484978fbf3839bf0e929fb1c2484d0a7d/examples/sem_seg_sparse/config.py#L124-L149
shiweibsw/Translation-Tools
2fbbf902364e557fa7017f9a74a8797b7440c077
venv/Lib/site-packages/pip-9.0.3-py3.6.egg/pip/_vendor/distro.py
python
LinuxDistribution._get_distro_release_info
(self)
Get the information items from the specified distro release file. Returns: A dictionary containing all information items.
Get the information items from the specified distro release file.
[ "Get", "the", "information", "items", "from", "the", "specified", "distro", "release", "file", "." ]
def _get_distro_release_info(self): """ Get the information items from the specified distro release file. Returns: A dictionary containing all information items. """ if self.distro_release_file: # If it was specified, we use it and parse what we can, even...
[ "def", "_get_distro_release_info", "(", "self", ")", ":", "if", "self", ".", "distro_release_file", ":", "# If it was specified, we use it and parse what we can, even if", "# its file name or content does not match the expected pattern.", "distro_info", "=", "self", ".", "_parse_di...
https://github.com/shiweibsw/Translation-Tools/blob/2fbbf902364e557fa7017f9a74a8797b7440c077/venv/Lib/site-packages/pip-9.0.3-py3.6.egg/pip/_vendor/distro.py#L962-L1001
selfteaching/selfteaching-python-camp
9982ee964b984595e7d664b07c389cddaf158f1e
exercises/1901100298/d09/mymodule/stats_word.py
python
stats_text
(text,count)
return stats_text_en(text,count) + stats_text_cn(text,count)
合并 英文词频 和 中文词频 的结果
合并 英文词频 和 中文词频 的结果
[ "合并", "英文词频", "和", "中文词频", "的结果" ]
def stats_text(text,count): ''' 合并 英文词频 和 中文词频 的结果 ''' if not isinstance(text,str): raise ValueError('参数必须是 str 类型,输入类型%s'% type(text)) return stats_text_en(text,count) + stats_text_cn(text,count)
[ "def", "stats_text", "(", "text", ",", "count", ")", ":", "if", "not", "isinstance", "(", "text", ",", "str", ")", ":", "raise", "ValueError", "(", "'参数必须是 str 类型,输入类型%s'% type(text))", "", "", "", "", "", "", "return", "stats_text_en", "(", "text", ",",...
https://github.com/selfteaching/selfteaching-python-camp/blob/9982ee964b984595e7d664b07c389cddaf158f1e/exercises/1901100298/d09/mymodule/stats_word.py#L27-L33
markstory/lint-review
b0a5f34ab3808a4752c8e6eac278557530717057
lintreview/config.py
python
get_lintrc_defaults
(config)
Load the default lintrc, if it exists
Load the default lintrc, if it exists
[ "Load", "the", "default", "lintrc", "if", "it", "exists" ]
def get_lintrc_defaults(config): """ Load the default lintrc, if it exists """ if config.get('LINTRC_DEFAULTS'): with open(config.get('LINTRC_DEFAULTS')) as f: return f.read()
[ "def", "get_lintrc_defaults", "(", "config", ")", ":", "if", "config", ".", "get", "(", "'LINTRC_DEFAULTS'", ")", ":", "with", "open", "(", "config", ".", "get", "(", "'LINTRC_DEFAULTS'", ")", ")", "as", "f", ":", "return", "f", ".", "read", "(", ")" ]
https://github.com/markstory/lint-review/blob/b0a5f34ab3808a4752c8e6eac278557530717057/lintreview/config.py#L36-L42
angr/angr
4b04d56ace135018083d36d9083805be8146688b
angr/misc/hookset.py
python
HookSet.remove_hooks
(target, **hooks)
Remove the given hooks from the given target. :param target: The object from which to remove hooks. If all hooks are removed from a given method, the HookedMethod object will be removed and replaced with the original function. :param hooks: Any keywords will be interpreted as...
Remove the given hooks from the given target.
[ "Remove", "the", "given", "hooks", "from", "the", "given", "target", "." ]
def remove_hooks(target, **hooks): """ Remove the given hooks from the given target. :param target: The object from which to remove hooks. If all hooks are removed from a given method, the HookedMethod object will be removed and replaced with the original function. ...
[ "def", "remove_hooks", "(", "target", ",", "*", "*", "hooks", ")", ":", "for", "name", ",", "hook", "in", "hooks", ".", "items", "(", ")", ":", "hooked", "=", "getattr", "(", "target", ",", "name", ")", "if", "hook", "in", "hooked", ".", "pending",...
https://github.com/angr/angr/blob/4b04d56ace135018083d36d9083805be8146688b/angr/misc/hookset.py#L29-L46
urwid/urwid
e2423b5069f51d318ea1ac0f355a0efe5448f7eb
urwid/widget.py
python
Edit.get_cursor_coords
(self, size)
return self.position_coords(maxcol,self.edit_pos)
Return the (*x*, *y*) coordinates of cursor within widget. >>> Edit("? ","yes").get_cursor_coords((10,)) (5, 0)
Return the (*x*, *y*) coordinates of cursor within widget.
[ "Return", "the", "(", "*", "x", "*", "*", "y", "*", ")", "coordinates", "of", "cursor", "within", "widget", "." ]
def get_cursor_coords(self, size): """ Return the (*x*, *y*) coordinates of cursor within widget. >>> Edit("? ","yes").get_cursor_coords((10,)) (5, 0) """ (maxcol,) = size self._shift_view_to_cursor = True return self.position_coords(maxcol,self.edit_pos...
[ "def", "get_cursor_coords", "(", "self", ",", "size", ")", ":", "(", "maxcol", ",", ")", "=", "size", "self", ".", "_shift_view_to_cursor", "=", "True", "return", "self", ".", "position_coords", "(", "maxcol", ",", "self", ".", "edit_pos", ")" ]
https://github.com/urwid/urwid/blob/e2423b5069f51d318ea1ac0f355a0efe5448f7eb/urwid/widget.py#L1661-L1671
schodet/nxt-python
b434303f098d13677bceb664810f03e8c5057c82
nxt/sensor/digital.py
python
BaseDigitalSensor._i2c_query
(self, address, format)
return data
Reads an i2c value from given address, and returns a value unpacked according to the given format. Format is the same as in the struct module. See http://docs.python.org/library/struct.html#format-strings
Reads an i2c value from given address, and returns a value unpacked according to the given format. Format is the same as in the struct module. See http://docs.python.org/library/struct.html#format-strings
[ "Reads", "an", "i2c", "value", "from", "given", "address", "and", "returns", "a", "value", "unpacked", "according", "to", "the", "given", "format", ".", "Format", "is", "the", "same", "as", "in", "the", "struct", "module", ".", "See", "http", ":", "//", ...
def _i2c_query(self, address, format): """Reads an i2c value from given address, and returns a value unpacked according to the given format. Format is the same as in the struct module. See http://docs.python.org/library/struct.html#format-strings """ size = struct.calcsize(format...
[ "def", "_i2c_query", "(", "self", ",", "address", ",", "format", ")", ":", "size", "=", "struct", ".", "calcsize", "(", "format", ")", "msg", "=", "bytes", "(", "(", "self", ".", "I2C_DEV", ",", "address", ")", ")", "now", "=", "time", ".", "time",...
https://github.com/schodet/nxt-python/blob/b434303f098d13677bceb664810f03e8c5057c82/nxt/sensor/digital.py#L116-L137
pascalw/Airplayer
cb6f6a393710a31f934e3c09de4f689158d23b50
airplayer/lib/jsonrpclib/history.py
python
History.request
(self)
[]
def request(self): if len(self.requests) == 0: return None else: return self.requests[-1]
[ "def", "request", "(", "self", ")", ":", "if", "len", "(", "self", ".", "requests", ")", "==", "0", ":", "return", "None", "else", ":", "return", "self", ".", "requests", "[", "-", "1", "]" ]
https://github.com/pascalw/Airplayer/blob/cb6f6a393710a31f934e3c09de4f689158d23b50/airplayer/lib/jsonrpclib/history.py#L25-L29
zjhthu/OANet
51d71ff3f57161e912ec72420cd91cf7db64ab74
core/transformations.py
python
affine_matrix_from_points
(v0, v1, shear=True, scale=True, usesvd=True)
return M
Return affine transform matrix to register two point sets. v0 and v1 are shape (ndims, \*) arrays of at least ndims non-homogeneous coordinates, where ndims is the dimensionality of the coordinate space. If shear is False, a similarity transformation matrix is returned. If also scale is False, a rigid...
Return affine transform matrix to register two point sets.
[ "Return", "affine", "transform", "matrix", "to", "register", "two", "point", "sets", "." ]
def affine_matrix_from_points(v0, v1, shear=True, scale=True, usesvd=True): """Return affine transform matrix to register two point sets. v0 and v1 are shape (ndims, \*) arrays of at least ndims non-homogeneous coordinates, where ndims is the dimensionality of the coordinate space. If shear is False, ...
[ "def", "affine_matrix_from_points", "(", "v0", ",", "v1", ",", "shear", "=", "True", ",", "scale", "=", "True", ",", "usesvd", "=", "True", ")", ":", "v0", "=", "numpy", ".", "array", "(", "v0", ",", "dtype", "=", "numpy", ".", "float64", ",", "cop...
https://github.com/zjhthu/OANet/blob/51d71ff3f57161e912ec72420cd91cf7db64ab74/core/transformations.py#L889-L995
tao12345666333/tornado-zh
e9e8519beb147d9e1290f6a4fa7d61123d1ecb1c
tornado/web.py
python
StaticFileHandler.get_cache_time
(self, path, modified, mime_type)
return self.CACHE_MAX_AGE if "v" in self.request.arguments else 0
复写来自定义缓存控制行为. 返回一个正的秒数作为结果可缓存的时间的量或者返回0标记资源 可以被缓存一个未指定的时间段(受浏览器自身的影响). 默认情况下带有 ``v`` 请求参数的资源返回的缓存过期时间是10年.
复写来自定义缓存控制行为.
[ "复写来自定义缓存控制行为", "." ]
def get_cache_time(self, path, modified, mime_type): """复写来自定义缓存控制行为. 返回一个正的秒数作为结果可缓存的时间的量或者返回0标记资源 可以被缓存一个未指定的时间段(受浏览器自身的影响). 默认情况下带有 ``v`` 请求参数的资源返回的缓存过期时间是10年. """ return self.CACHE_MAX_AGE if "v" in self.request.arguments else 0
[ "def", "get_cache_time", "(", "self", ",", "path", ",", "modified", ",", "mime_type", ")", ":", "return", "self", ".", "CACHE_MAX_AGE", "if", "\"v\"", "in", "self", ".", "request", ".", "arguments", "else", "0" ]
https://github.com/tao12345666333/tornado-zh/blob/e9e8519beb147d9e1290f6a4fa7d61123d1ecb1c/tornado/web.py#L2488-L2496
vmware-archive/vsphere-storage-for-docker
96d2ce72457047af4ef05cb0a8794cf623803865
esx_service/vsan_policy.py
python
make_policies_dir
(datastore_path)
return policies_dir
Create the policies dir if it doesn't exist and return the path. This function assumes that datastore_path is a VSAN datastore, although it won't fail if it isn't.
Create the policies dir if it doesn't exist and return the path. This function assumes that datastore_path is a VSAN datastore, although it won't fail if it isn't.
[ "Create", "the", "policies", "dir", "if", "it", "doesn", "t", "exist", "and", "return", "the", "path", ".", "This", "function", "assumes", "that", "datastore_path", "is", "a", "VSAN", "datastore", "although", "it", "won", "t", "fail", "if", "it", "isn", ...
def make_policies_dir(datastore_path): """ Create the policies dir if it doesn't exist and return the path. This function assumes that datastore_path is a VSAN datastore, although it won't fail if it isn't. """ policies_dir = os.path.join(datastore_path, 'policies') try: os.mkdir(pol...
[ "def", "make_policies_dir", "(", "datastore_path", ")", ":", "policies_dir", "=", "os", ".", "path", ".", "join", "(", "datastore_path", ",", "'policies'", ")", "try", ":", "os", ".", "mkdir", "(", "policies_dir", ")", "except", "OSError", ":", "pass", "re...
https://github.com/vmware-archive/vsphere-storage-for-docker/blob/96d2ce72457047af4ef05cb0a8794cf623803865/esx_service/vsan_policy.py#L162-L173
tracim/tracim
a0e9746fde5a4c45b4e0f0bfa2caf9522b8c4e21
backend/tracim_backend/models/setup_models.py
python
init_models
(configurator: Configurator, app_config: "CFG")
Initialize the model for a Pyramid app.
Initialize the model for a Pyramid app.
[ "Initialize", "the", "model", "for", "a", "Pyramid", "app", "." ]
def init_models(configurator: Configurator, app_config: "CFG") -> None: """ Initialize the model for a Pyramid app. """ settings = configurator.get_settings() settings["tm.manager_hook"] = "pyramid_tm.explicit_manager" # use pyramid_tm to hook the transaction lifecycle to the request config...
[ "def", "init_models", "(", "configurator", ":", "Configurator", ",", "app_config", ":", "\"CFG\"", ")", "->", "None", ":", "settings", "=", "configurator", ".", "get_settings", "(", ")", "settings", "[", "\"tm.manager_hook\"", "]", "=", "\"pyramid_tm.explicit_mana...
https://github.com/tracim/tracim/blob/a0e9746fde5a4c45b4e0f0bfa2caf9522b8c4e21/backend/tracim_backend/models/setup_models.py#L115-L137
django/django
0a17666045de6739ae1c2ac695041823d5f827f7
django/template/defaultfilters.py
python
timeuntil_filter
(value, arg=None)
Format a date as the time until that date (i.e. "4 days, 6 hours").
Format a date as the time until that date (i.e. "4 days, 6 hours").
[ "Format", "a", "date", "as", "the", "time", "until", "that", "date", "(", "i", ".", "e", ".", "4", "days", "6", "hours", ")", "." ]
def timeuntil_filter(value, arg=None): """Format a date as the time until that date (i.e. "4 days, 6 hours").""" if not value: return '' try: return timeuntil(value, arg) except (ValueError, TypeError): return ''
[ "def", "timeuntil_filter", "(", "value", ",", "arg", "=", "None", ")", ":", "if", "not", "value", ":", "return", "''", "try", ":", "return", "timeuntil", "(", "value", ",", "arg", ")", "except", "(", "ValueError", ",", "TypeError", ")", ":", "return", ...
https://github.com/django/django/blob/0a17666045de6739ae1c2ac695041823d5f827f7/django/template/defaultfilters.py#L783-L790
hatRiot/zarp
2e772350a01c2aeed3f4da9685cd0cc5d6b3ecad
src/lib/libmproxy/flow.py
python
Request._get_state
(self)
return dict( client_conn = self.client_conn._get_state() if self.client_conn else None, httpversion = self.httpversion, host = self.host, port = self.port, scheme = self.scheme, method = self.method, path = self.path, header...
[]
def _get_state(self): return dict( client_conn = self.client_conn._get_state() if self.client_conn else None, httpversion = self.httpversion, host = self.host, port = self.port, scheme = self.scheme, method = self.method, path =...
[ "def", "_get_state", "(", "self", ")", ":", "return", "dict", "(", "client_conn", "=", "self", ".", "client_conn", ".", "_get_state", "(", ")", "if", "self", ".", "client_conn", "else", "None", ",", "httpversion", "=", "self", ".", "httpversion", ",", "h...
https://github.com/hatRiot/zarp/blob/2e772350a01c2aeed3f4da9685cd0cc5d6b3ecad/src/lib/libmproxy/flow.py#L377-L392
dreamworksanimation/usdmanager
dfd0825300c45d3bba25a585bfd0785d5bc50cb0
usdmanager/__init__.py
python
UsdMngrWindow.viewSource
(self, checked=False)
For debugging, view the source HTML of the text browser widget. :Parameters: checked : `bool` Just for signal
For debugging, view the source HTML of the text browser widget. :Parameters: checked : `bool` Just for signal
[ "For", "debugging", "view", "the", "source", "HTML", "of", "the", "text", "browser", "widget", ".", ":", "Parameters", ":", "checked", ":", "bool", "Just", "for", "signal" ]
def viewSource(self, checked=False): """ For debugging, view the source HTML of the text browser widget. :Parameters: checked : `bool` Just for signal """ html = self.currTab.textBrowser.toHtml() tab = self.newTab() tab.textBrowser.set...
[ "def", "viewSource", "(", "self", ",", "checked", "=", "False", ")", ":", "html", "=", "self", ".", "currTab", ".", "textBrowser", ".", "toHtml", "(", ")", "tab", "=", "self", ".", "newTab", "(", ")", "tab", ".", "textBrowser", ".", "setPlainText", "...
https://github.com/dreamworksanimation/usdmanager/blob/dfd0825300c45d3bba25a585bfd0785d5bc50cb0/usdmanager/__init__.py#L3470-L3479
opsmop/opsmop
376ca587f8c5f9ca8ed1829909d075c339066034
opsmop/callbacks/callbacks.py
python
Callbacks.on_terminate_with_host_list
(self, host_list)
[]
def on_terminate_with_host_list(self, host_list): self._run_callbacks('on_terminate_with_host_list', host_list)
[ "def", "on_terminate_with_host_list", "(", "self", ",", "host_list", ")", ":", "self", ".", "_run_callbacks", "(", "'on_terminate_with_host_list'", ",", "host_list", ")" ]
https://github.com/opsmop/opsmop/blob/376ca587f8c5f9ca8ed1829909d075c339066034/opsmop/callbacks/callbacks.py#L105-L106
zhl2008/awd-platform
0416b31abea29743387b10b3914581fbe8e7da5e
web_flaskbb/lib/python2.7/site-packages/mako/runtime.py
python
Context._pop_buffer
(self)
return self._buffer_stack.pop()
pop the most recent capturing buffer from this Context.
pop the most recent capturing buffer from this Context.
[ "pop", "the", "most", "recent", "capturing", "buffer", "from", "this", "Context", "." ]
def _pop_buffer(self): """pop the most recent capturing buffer from this Context.""" return self._buffer_stack.pop()
[ "def", "_pop_buffer", "(", "self", ")", ":", "return", "self", ".", "_buffer_stack", ".", "pop", "(", ")" ]
https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_flaskbb/lib/python2.7/site-packages/mako/runtime.py#L125-L128
galaxyproject/galaxy
4c03520f05062e0f4a1b3655dc0b7452fda69943
lib/galaxy/model/tool_shed_install/__init__.py
python
ToolShedRepository.tuples_of_repository_dependencies_needed_for_compiling_td
(self)
return rd_tups_of_repositories_needed_for_compiling_td
Return tuples defining this repository's repository dependencies that are necessary only for compiling this repository's tool dependencies.
Return tuples defining this repository's repository dependencies that are necessary only for compiling this repository's tool dependencies.
[ "Return", "tuples", "defining", "this", "repository", "s", "repository", "dependencies", "that", "are", "necessary", "only", "for", "compiling", "this", "repository", "s", "tool", "dependencies", "." ]
def tuples_of_repository_dependencies_needed_for_compiling_td(self): """ Return tuples defining this repository's repository dependencies that are necessary only for compiling this repository's tool dependencies. """ rd_tups_of_repositories_needed_for_compiling_td = [] re...
[ "def", "tuples_of_repository_dependencies_needed_for_compiling_td", "(", "self", ")", ":", "rd_tups_of_repositories_needed_for_compiling_td", "=", "[", "]", "repository_dependencies", "=", "self", ".", "metadata_", ".", "get", "(", "'repository_dependencies'", ",", "{", "}"...
https://github.com/galaxyproject/galaxy/blob/4c03520f05062e0f4a1b3655dc0b7452fda69943/lib/galaxy/model/tool_shed_install/__init__.py#L501-L514
huawei-noah/Pretrained-Language-Model
d4694a134bdfacbaef8ff1d99735106bd3b3372b
NEZHA-Gen-TensorFlow/poetry.py
python
PoetryBertModel.get_embedding_output
(self)
return self.embedding_output
Gets output of the embedding lookup (i.e., input to the transformer). Returns: float Tensor of shape [batch_size, seq_length, hidden_size] corresponding to the output of the embedding layer, after summing the word embeddings with the positional embeddings and the token type embeddings, then...
Gets output of the embedding lookup (i.e., input to the transformer).
[ "Gets", "output", "of", "the", "embedding", "lookup", "(", "i", ".", "e", ".", "input", "to", "the", "transformer", ")", "." ]
def get_embedding_output(self): """Gets output of the embedding lookup (i.e., input to the transformer). Returns: float Tensor of shape [batch_size, seq_length, hidden_size] corresponding to the output of the embedding layer, after summing the word embeddings with the positional embeddings an...
[ "def", "get_embedding_output", "(", "self", ")", ":", "return", "self", ".", "embedding_output" ]
https://github.com/huawei-noah/Pretrained-Language-Model/blob/d4694a134bdfacbaef8ff1d99735106bd3b3372b/NEZHA-Gen-TensorFlow/poetry.py#L380-L389
holzschu/Carnets
44effb10ddfc6aa5c8b0687582a724ba82c6b547
Library/lib/python3.7/site-packages/astropy-4.0-py3.7-macosx-10.9-x86_64.egg/astropy/utils/console.py
python
color_print
(*args, end='\n', **kwargs)
Prints colors and styles to the terminal uses ANSI escape sequences. :: color_print('This is the color ', 'default', 'GREEN', 'green') Parameters ---------- positional args : str The positional arguments come in pairs (*msg*, *color*), where *msg* is the string to display a...
Prints colors and styles to the terminal uses ANSI escape sequences.
[ "Prints", "colors", "and", "styles", "to", "the", "terminal", "uses", "ANSI", "escape", "sequences", "." ]
def color_print(*args, end='\n', **kwargs): """ Prints colors and styles to the terminal uses ANSI escape sequences. :: color_print('This is the color ', 'default', 'GREEN', 'green') Parameters ---------- positional args : str The positional arguments come in pairs (*msg*, ...
[ "def", "color_print", "(", "*", "args", ",", "end", "=", "'\\n'", ",", "*", "*", "kwargs", ")", ":", "file", "=", "kwargs", ".", "get", "(", "'file'", ",", "_get_stdout", "(", ")", ")", "write", "=", "file", ".", "write", "if", "isatty", "(", "fi...
https://github.com/holzschu/Carnets/blob/44effb10ddfc6aa5c8b0687582a724ba82c6b547/Library/lib/python3.7/site-packages/astropy-4.0-py3.7-macosx-10.9-x86_64.egg/astropy/utils/console.py#L330-L386
awesto/django-shop
13d9a77aff7eede74a5f363c1d540e005d88dbcd
shop/models/order.py
python
BaseOrder.save
(self, with_notification=False, **kwargs)
:param with_notification: If ``True``, all notifications for the state of this Order object are executed.
:param with_notification: If ``True``, all notifications for the state of this Order object are executed.
[ ":", "param", "with_notification", ":", "If", "True", "all", "notifications", "for", "the", "state", "of", "this", "Order", "object", "are", "executed", "." ]
def save(self, with_notification=False, **kwargs): """ :param with_notification: If ``True``, all notifications for the state of this Order object are executed. """ from shop.transition import transition_change_notification auto_transition = self._auto_transitions.get(se...
[ "def", "save", "(", "self", ",", "with_notification", "=", "False", ",", "*", "*", "kwargs", ")", ":", "from", "shop", ".", "transition", "import", "transition_change_notification", "auto_transition", "=", "self", ".", "_auto_transitions", ".", "get", "(", "se...
https://github.com/awesto/django-shop/blob/13d9a77aff7eede74a5f363c1d540e005d88dbcd/shop/models/order.py#L324-L340
DataDog/integrations-core
934674b29d94b70ccc008f76ea172d0cdae05e1e
tokumx/datadog_checks/tokumx/vendor/pymongo/read_preferences.py
python
_ServerMode.min_wire_version
(self)
return 0 if self.__max_staleness == -1 else 5
The wire protocol version the server must support. Some read preferences impose version requirements on all servers (e.g. maxStalenessSeconds requires MongoDB 3.4 / maxWireVersion 5). All servers' maxWireVersion must be at least this read preference's `min_wire_version`, or the driver ...
The wire protocol version the server must support.
[ "The", "wire", "protocol", "version", "the", "server", "must", "support", "." ]
def min_wire_version(self): """The wire protocol version the server must support. Some read preferences impose version requirements on all servers (e.g. maxStalenessSeconds requires MongoDB 3.4 / maxWireVersion 5). All servers' maxWireVersion must be at least this read preference's ...
[ "def", "min_wire_version", "(", "self", ")", ":", "return", "0", "if", "self", ".", "__max_staleness", "==", "-", "1", "else", "5" ]
https://github.com/DataDog/integrations-core/blob/934674b29d94b70ccc008f76ea172d0cdae05e1e/tokumx/datadog_checks/tokumx/vendor/pymongo/read_preferences.py#L150-L160
bookwyrm-social/bookwyrm
0c2537e27a2cdbc0136880dfbbf170d5fec72986
bookwyrm/models/import_job.py
python
ImportItem.date_added
(self)
return None
when the book was added to this dataset
when the book was added to this dataset
[ "when", "the", "book", "was", "added", "to", "this", "dataset" ]
def date_added(self): """when the book was added to this dataset""" if self.normalized_data.get("date_added"): return timezone.make_aware( dateutil.parser.parse(self.normalized_data.get("date_added")) ) return None
[ "def", "date_added", "(", "self", ")", ":", "if", "self", ".", "normalized_data", ".", "get", "(", "\"date_added\"", ")", ":", "return", "timezone", ".", "make_aware", "(", "dateutil", ".", "parser", ".", "parse", "(", "self", ".", "normalized_data", ".", ...
https://github.com/bookwyrm-social/bookwyrm/blob/0c2537e27a2cdbc0136880dfbbf170d5fec72986/bookwyrm/models/import_job.py#L175-L181
pm4py/pm4py-core
7807b09a088b02199cd0149d724d0e28793971bf
pm4py/simulation/tree_generator/variants/ptandloggenerator.py
python
apply
(parameters=None)
return GeneratedTree(parameters).generate()
Generate a process tree using the PTAndLogGenerator approach (see the paper PTandLogGenerator: A Generator for Artificial Event Data) Parameters -------------- parameters Parameters of the algorithm, according to the paper: - Parameters.MODE: most frequent number of visible activities ...
Generate a process tree using the PTAndLogGenerator approach (see the paper PTandLogGenerator: A Generator for Artificial Event Data)
[ "Generate", "a", "process", "tree", "using", "the", "PTAndLogGenerator", "approach", "(", "see", "the", "paper", "PTandLogGenerator", ":", "A", "Generator", "for", "Artificial", "Event", "Data", ")" ]
def apply(parameters=None): """ Generate a process tree using the PTAndLogGenerator approach (see the paper PTandLogGenerator: A Generator for Artificial Event Data) Parameters -------------- parameters Parameters of the algorithm, according to the paper: - Parameters.MODE: most...
[ "def", "apply", "(", "parameters", "=", "None", ")", ":", "if", "parameters", "is", "None", ":", "parameters", "=", "{", "}", "if", "not", "\"mode\"", "in", "parameters", ":", "parameters", "[", "\"mode\"", "]", "=", "20", "if", "not", "\"min\"", "in",...
https://github.com/pm4py/pm4py-core/blob/7807b09a088b02199cd0149d724d0e28793971bf/pm4py/simulation/tree_generator/variants/ptandloggenerator.py#L70-L131
skylander86/lambda-text-extractor
6da52d077a2fc571e38bfe29c33ae68f6443cd5a
lib-linux_x64/pyparsing.py
python
nestedExpr
(opener="(", closer=")", content=None, ignoreExpr=quotedString.copy())
return ret
Helper method for defining nested lists enclosed in opening and closing delimiters ("(" and ")" are the default). Parameters: - opener - opening character for a nested list (default=C{"("}); can also be a pyparsing expression - closer - closing character for a nested list (default=C{")"}); can also b...
Helper method for defining nested lists enclosed in opening and closing delimiters ("(" and ")" are the default).
[ "Helper", "method", "for", "defining", "nested", "lists", "enclosed", "in", "opening", "and", "closing", "delimiters", "(", "(", "and", ")", "are", "the", "default", ")", "." ]
def nestedExpr(opener="(", closer=")", content=None, ignoreExpr=quotedString.copy()): """ Helper method for defining nested lists enclosed in opening and closing delimiters ("(" and ")" are the default). Parameters: - opener - opening character for a nested list (default=C{"("}); can also be a pyp...
[ "def", "nestedExpr", "(", "opener", "=", "\"(\"", ",", "closer", "=", "\")\"", ",", "content", "=", "None", ",", "ignoreExpr", "=", "quotedString", ".", "copy", "(", ")", ")", ":", "if", "opener", "==", "closer", ":", "raise", "ValueError", "(", "\"ope...
https://github.com/skylander86/lambda-text-extractor/blob/6da52d077a2fc571e38bfe29c33ae68f6443cd5a/lib-linux_x64/pyparsing.py#L5135-L5223
caiiiac/Machine-Learning-with-Python
1a26c4467da41ca4ebc3d5bd789ea942ef79422f
MachineLearning/venv/lib/python3.5/site-packages/pandas/core/dtypes/common.py
python
is_datetimelike_v_object
(a, b)
return ((is_datetimelike(a) and is_object_dtype(b)) or (is_datetimelike(b) and is_object_dtype(a)))
Check if we are comparing a datetime-like object to an object instance. Parameters ---------- a : array-like, scalar The first object to check. b : array-like, scalar The second object to check. Returns ------- boolean : Whether we return a comparing a datetime-like ...
Check if we are comparing a datetime-like object to an object instance.
[ "Check", "if", "we", "are", "comparing", "a", "datetime", "-", "like", "object", "to", "an", "object", "instance", "." ]
def is_datetimelike_v_object(a, b): """ Check if we are comparing a datetime-like object to an object instance. Parameters ---------- a : array-like, scalar The first object to check. b : array-like, scalar The second object to check. Returns ------- boolean : Wheth...
[ "def", "is_datetimelike_v_object", "(", "a", ",", "b", ")", ":", "if", "not", "hasattr", "(", "a", ",", "'dtype'", ")", ":", "a", "=", "np", ".", "asarray", "(", "a", ")", "if", "not", "hasattr", "(", "b", ",", "'dtype'", ")", ":", "b", "=", "n...
https://github.com/caiiiac/Machine-Learning-with-Python/blob/1a26c4467da41ca4ebc3d5bd789ea942ef79422f/MachineLearning/venv/lib/python3.5/site-packages/pandas/core/dtypes/common.py#L1278-L1328
grow/grow
97fc21730b6a674d5d33948d94968e79447ce433
grow/documents/document.py
python
Document.locale_paths
(self)
return Document._locale_paths(self.pod_path)
[]
def locale_paths(self): return Document._locale_paths(self.pod_path)
[ "def", "locale_paths", "(", "self", ")", ":", "return", "Document", ".", "_locale_paths", "(", "self", ".", "pod_path", ")" ]
https://github.com/grow/grow/blob/97fc21730b6a674d5d33948d94968e79447ce433/grow/documents/document.py#L317-L318
kirthevasank/nasbot
3c745dc986be30e3721087c8fa768099032a0802
nn/neural_network.py
python
NeuralNetwork._check_if_valid_network
(self)
return True
Returns true if the network is a valid network.
Returns true if the network is a valid network.
[ "Returns", "true", "if", "the", "network", "is", "a", "valid", "network", "." ]
def _check_if_valid_network(self): """ Returns true if the network is a valid network. """ # Check if the lenghts of the labels and node masss are the same assert len(self.layer_labels) == len(self.num_units_in_each_layer) # If there are no processing layers, there need not be more than 3 layers (ip, op...
[ "def", "_check_if_valid_network", "(", "self", ")", ":", "# Check if the lenghts of the labels and node masss are the same", "assert", "len", "(", "self", ".", "layer_labels", ")", "==", "len", "(", "self", ".", "num_units_in_each_layer", ")", "# If there are no processing ...
https://github.com/kirthevasank/nasbot/blob/3c745dc986be30e3721087c8fa768099032a0802/nn/neural_network.py#L213-L240
nodesign/weio
1d67d705a5c36a2e825ad13feab910b0aca9a2e8
things/output/motor/servomotor.py
python
Servo.write
(self, data)
Move servo to n degrees. Every 20ms variate signal from 5% - 10% with PWM
Move servo to n degrees. Every 20ms variate signal from 5% - 10% with PWM
[ "Move", "servo", "to", "n", "degrees", ".", "Every", "20ms", "variate", "signal", "from", "5%", "-", "10%", "with", "PWM" ]
def write(self, data): """Move servo to n degrees. Every 20ms variate signal from 5% - 10% with PWM""" # Make proportion calculation here, map angle to percrents if (data>self.maxangle): data = self.maxangle print "Warning, max allowed angle is ", self.maxangle , " value...
[ "def", "write", "(", "self", ",", "data", ")", ":", "# Make proportion calculation here, map angle to percrents", "if", "(", "data", ">", "self", ".", "maxangle", ")", ":", "data", "=", "self", ".", "maxangle", "print", "\"Warning, max allowed angle is \"", ",", "...
https://github.com/nodesign/weio/blob/1d67d705a5c36a2e825ad13feab910b0aca9a2e8/things/output/motor/servomotor.py#L87-L102
home-assistant/core
265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1
homeassistant/components/ihc/light.py
python
IhcLight.supported_features
(self)
return 0
Flag supported features.
Flag supported features.
[ "Flag", "supported", "features", "." ]
def supported_features(self): """Flag supported features.""" if self._dimmable: return SUPPORT_BRIGHTNESS return 0
[ "def", "supported_features", "(", "self", ")", ":", "if", "self", ".", "_dimmable", ":", "return", "SUPPORT_BRIGHTNESS", "return", "0" ]
https://github.com/home-assistant/core/blob/265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1/homeassistant/components/ihc/light.py#L86-L90
frappe/erpnext
9d36e30ef7043b391b5ed2523b8288bf46c45d18
erpnext/erpnext_integrations/doctype/amazon_mws_settings/amazon_mws_api.py
python
Products.get_matching_product_for_id
(self, marketplaceid, type, id)
return self.make_request(data)
Returns a list of products and their attributes, based on a list of product identifier values (asin, sellersku, upc, ean, isbn and JAN) Added in Fourth Release, API version 2011-10-01
Returns a list of products and their attributes, based on a list of product identifier values (asin, sellersku, upc, ean, isbn and JAN) Added in Fourth Release, API version 2011-10-01
[ "Returns", "a", "list", "of", "products", "and", "their", "attributes", "based", "on", "a", "list", "of", "product", "identifier", "values", "(", "asin", "sellersku", "upc", "ean", "isbn", "and", "JAN", ")", "Added", "in", "Fourth", "Release", "API", "vers...
def get_matching_product_for_id(self, marketplaceid, type, id): """ Returns a list of products and their attributes, based on a list of product identifier values (asin, sellersku, upc, ean, isbn and JAN) Added in Fourth Release, API version 2011-10-01 """ data = dict(Action='GetMatchingProductForId', M...
[ "def", "get_matching_product_for_id", "(", "self", ",", "marketplaceid", ",", "type", ",", "id", ")", ":", "data", "=", "dict", "(", "Action", "=", "'GetMatchingProductForId'", ",", "MarketplaceId", "=", "marketplaceid", ",", "IdType", "=", "type", ")", "data"...
https://github.com/frappe/erpnext/blob/9d36e30ef7043b391b5ed2523b8288bf46c45d18/erpnext/erpnext_integrations/doctype/amazon_mws_settings/amazon_mws_api.py#L467-L476
BillBillBillBill/Tickeys-linux
2df31b8665004c58a5d4ab05277f245267d96364
tickeys/kivy/config.py
python
ConfigParser.update_config
(self, filename, overwrite=False)
Upgrade the configuration based on a new default config file. Overwrite any existing values if overwrite is True.
Upgrade the configuration based on a new default config file. Overwrite any existing values if overwrite is True.
[ "Upgrade", "the", "configuration", "based", "on", "a", "new", "default", "config", "file", ".", "Overwrite", "any", "existing", "values", "if", "overwrite", "is", "True", "." ]
def update_config(self, filename, overwrite=False): '''Upgrade the configuration based on a new default config file. Overwrite any existing values if overwrite is True. ''' pcp = PythonConfigParser() pcp.read(filename) confset = self.setall if overwrite else self.setde...
[ "def", "update_config", "(", "self", ",", "filename", ",", "overwrite", "=", "False", ")", ":", "pcp", "=", "PythonConfigParser", "(", ")", "pcp", ".", "read", "(", "filename", ")", "confset", "=", "self", ".", "setall", "if", "overwrite", "else", "self"...
https://github.com/BillBillBillBill/Tickeys-linux/blob/2df31b8665004c58a5d4ab05277f245267d96364/tickeys/kivy/config.py#L471-L480
aleju/imgaug
0101108d4fed06bc5056c4a03e2bcb0216dac326
imgaug/augmentables/lines.py
python
LineString.compute_neighbour_distances
(self)
return np.sqrt( np.sum( (self.coords[:-1, :] - self.coords[1:, :]) ** 2, axis=1 ) )
Compute the euclidean distance between each two consecutive points. Returns ------- ndarray ``(N-1,)`` ``float32`` array of euclidean distances between point pairs. Same order as in `coords`.
Compute the euclidean distance between each two consecutive points.
[ "Compute", "the", "euclidean", "distance", "between", "each", "two", "consecutive", "points", "." ]
def compute_neighbour_distances(self): """Compute the euclidean distance between each two consecutive points. Returns ------- ndarray ``(N-1,)`` ``float32`` array of euclidean distances between point pairs. Same order as in `coords`. """ if len(s...
[ "def", "compute_neighbour_distances", "(", "self", ")", ":", "if", "len", "(", "self", ".", "coords", ")", "<=", "1", ":", "return", "np", ".", "zeros", "(", "(", "0", ",", ")", ",", "dtype", "=", "np", ".", "float32", ")", "return", "np", ".", "...
https://github.com/aleju/imgaug/blob/0101108d4fed06bc5056c4a03e2bcb0216dac326/imgaug/augmentables/lines.py#L204-L221
miyakogi/pyppeteer
f5313d0e7f973c57ed31fa443cea1834e223a96c
pyppeteer/coverage.py
python
Coverage.startJSCoverage
(self, options: Dict = None, **kwargs: Any )
Start JS coverage measurement. Available options are: * ``resetOnNavigation`` (bool): Whether to reset coverage on every navigation. Defaults to ``True``. * ``reportAnonymousScript`` (bool): Whether anonymous script generated by the page should be reported. Defaults to ``Fa...
Start JS coverage measurement.
[ "Start", "JS", "coverage", "measurement", "." ]
async def startJSCoverage(self, options: Dict = None, **kwargs: Any ) -> None: """Start JS coverage measurement. Available options are: * ``resetOnNavigation`` (bool): Whether to reset coverage on every navigation. Defaults to ``True``. * ``repor...
[ "async", "def", "startJSCoverage", "(", "self", ",", "options", ":", "Dict", "=", "None", ",", "*", "*", "kwargs", ":", "Any", ")", "->", "None", ":", "options", "=", "merge_dict", "(", "options", ",", "kwargs", ")", "await", "self", ".", "_jsCoverage"...
https://github.com/miyakogi/pyppeteer/blob/f5313d0e7f973c57ed31fa443cea1834e223a96c/pyppeteer/coverage.py#L53-L72
WikidPad/WikidPad
558109638807bc76b4672922686e416ab2d5f79c
WikidPad/lib/pwiki/DocPages.py
python
AbstractWikiPage.extractTodoNodesFromPageAst
(pageAst)
return pageAst.iterDeepByName("todoEntry")
Return an iterator of todo nodes in pageAst.
Return an iterator of todo nodes in pageAst.
[ "Return", "an", "iterator", "of", "todo", "nodes", "in", "pageAst", "." ]
def extractTodoNodesFromPageAst(pageAst): """ Return an iterator of todo nodes in pageAst. """ return pageAst.iterDeepByName("todoEntry")
[ "def", "extractTodoNodesFromPageAst", "(", "pageAst", ")", ":", "return", "pageAst", ".", "iterDeepByName", "(", "\"todoEntry\"", ")" ]
https://github.com/WikidPad/WikidPad/blob/558109638807bc76b4672922686e416ab2d5f79c/WikidPad/lib/pwiki/DocPages.py#L849-L853
zhl2008/awd-platform
0416b31abea29743387b10b3914581fbe8e7da5e
web_flaskbb/flaskbb/utils/populate.py
python
create_default_groups
()
return result
This will create the 5 default groups.
This will create the 5 default groups.
[ "This", "will", "create", "the", "5", "default", "groups", "." ]
def create_default_groups(): """This will create the 5 default groups.""" from flaskbb.fixtures.groups import fixture result = [] for key, value in fixture.items(): group = Group(name=key) for k, v in value.items(): setattr(group, k, v) group.save() result.a...
[ "def", "create_default_groups", "(", ")", ":", "from", "flaskbb", ".", "fixtures", ".", "groups", "import", "fixture", "result", "=", "[", "]", "for", "key", ",", "value", "in", "fixture", ".", "items", "(", ")", ":", "group", "=", "Group", "(", "name"...
https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_flaskbb/flaskbb/utils/populate.py#L164-L176
wucng/TensorExpand
4ea58f64f5c5082b278229b799c9f679536510b7
TensorExpand/Object detection/Mask RCNN/CharlesShang_FastMaskRCNN/libs/boxes/gprof2dot.py
python
CallgrindParser.get_callee
(self)
return self.make_function(module, filename, function)
[]
def get_callee(self): module = self.positions.get('cob', '') filename = self.positions.get('cfi', '') function = self.positions.get('cfn', '') return self.make_function(module, filename, function)
[ "def", "get_callee", "(", "self", ")", ":", "module", "=", "self", ".", "positions", ".", "get", "(", "'cob'", ",", "''", ")", "filename", "=", "self", ".", "positions", ".", "get", "(", "'cfi'", ",", "''", ")", "function", "=", "self", ".", "posit...
https://github.com/wucng/TensorExpand/blob/4ea58f64f5c5082b278229b799c9f679536510b7/TensorExpand/Object detection/Mask RCNN/CharlesShang_FastMaskRCNN/libs/boxes/gprof2dot.py#L1905-L1909
friends-of-freeswitch/switchio
dee6e9addcf881b2b411ec1dbb397b0acfbb78cf
switchio/connection.py
python
Connection.connect
( self, host=None, port=None, password=None, loop=None, block=True, timeout=0.5 # seems to be the optimal wait value )
Connect the underlying protocol. If ``block`` is set to false returns a coroutine.
Connect the underlying protocol.
[ "Connect", "the", "underlying", "protocol", "." ]
def connect( self, host=None, port=None, password=None, loop=None, block=True, timeout=0.5 # seems to be the optimal wait value ): """Connect the underlying protocol. If ``block`` is set to false returns a coroutine. """ host = host or self.host ...
[ "def", "connect", "(", "self", ",", "host", "=", "None", ",", "port", "=", "None", ",", "password", "=", "None", ",", "loop", "=", "None", ",", "block", "=", "True", ",", "timeout", "=", "0.5", "# seems to be the optimal wait value", ")", ":", "host", ...
https://github.com/friends-of-freeswitch/switchio/blob/dee6e9addcf881b2b411ec1dbb397b0acfbb78cf/switchio/connection.py#L151-L195
LagoLunatic/wwrando
33164143eb9f51c3015be3e31402a79dfcebacfd
randomizer.py
python
Randomizer.get_log_header
(self)
return header
[]
def get_log_header(self): header = "" header += "Wind Waker Randomizer Version %s\n" % VERSION if self.permalink: header += "Permalink: %s\n" % self.permalink if self.seed_hash: header += "Seed Hash: %s\n" % self.seed_hash header += "Seed: %s\n" % self.seed heade...
[ "def", "get_log_header", "(", "self", ")", ":", "header", "=", "\"\"", "header", "+=", "\"Wind Waker Randomizer Version %s\\n\"", "%", "VERSION", "if", "self", ".", "permalink", ":", "header", "+=", "\"Permalink: %s\\n\"", "%", "self", ".", "permalink", "if", "s...
https://github.com/LagoLunatic/wwrando/blob/33164143eb9f51c3015be3e31402a79dfcebacfd/randomizer.py#L930-L970
Yuliang-Liu/Box_Discretization_Network
5b3a30c97429ef8e5c5e1c4e2476c7d9abdc03e6
maskrcnn_benchmark/structures/keypoint.py
python
Keypoints.to
(self, *args, **kwargs)
return keypoints
[]
def to(self, *args, **kwargs): keypoints = type(self)(self.keypoints.to(*args, **kwargs), self.size, self.mode) for k, v in self.extra_fields.items(): if hasattr(v, "to"): v = v.to(*args, **kwargs) keypoints.add_field(k, v) return keypoints
[ "def", "to", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "keypoints", "=", "type", "(", "self", ")", "(", "self", ".", "keypoints", ".", "to", "(", "*", "args", ",", "*", "*", "kwargs", ")", ",", "self", ".", "size", ","...
https://github.com/Yuliang-Liu/Box_Discretization_Network/blob/5b3a30c97429ef8e5c5e1c4e2476c7d9abdc03e6/maskrcnn_benchmark/structures/keypoint.py#L61-L67
NervanaSystems/neon
8c3fb8a93b4a89303467b25817c60536542d08bd
examples/faster-rcnn/ingest_kitti.py
python
create_manifest
(manifest_path, index_list, annot_dir, image_dir, root_dir)
[]
def create_manifest(manifest_path, index_list, annot_dir, image_dir, root_dir): records = [('@FILE', 'FILE')] for tag in index_list: image = os.path.join(image_dir, tag + '.png') annot = os.path.join(annot_dir, tag + '.json') assert os.path.exists(image), 'Path {} not found'.format(ima...
[ "def", "create_manifest", "(", "manifest_path", ",", "index_list", ",", "annot_dir", ",", "image_dir", ",", "root_dir", ")", ":", "records", "=", "[", "(", "'@FILE'", ",", "'FILE'", ")", "]", "for", "tag", "in", "index_list", ":", "image", "=", "os", "."...
https://github.com/NervanaSystems/neon/blob/8c3fb8a93b4a89303467b25817c60536542d08bd/examples/faster-rcnn/ingest_kitti.py#L200-L214
IronLanguages/main
a949455434b1fda8c783289e897e78a9a0caabb5
External.LCA_RESTRICTED/Languages/IronPython/repackage/pip/pip/_vendor/distlib/locators.py
python
DependencyFinder.remove_distribution
(self, dist)
Remove a distribution from the finder. This will update internal information about who provides what. :param dist: The distribution to remove.
Remove a distribution from the finder. This will update internal information about who provides what. :param dist: The distribution to remove.
[ "Remove", "a", "distribution", "from", "the", "finder", ".", "This", "will", "update", "internal", "information", "about", "who", "provides", "what", ".", ":", "param", "dist", ":", "The", "distribution", "to", "remove", "." ]
def remove_distribution(self, dist): """ Remove a distribution from the finder. This will update internal information about who provides what. :param dist: The distribution to remove. """ logger.debug('removing distribution %s', dist) name = dist.key del s...
[ "def", "remove_distribution", "(", "self", ",", "dist", ")", ":", "logger", ".", "debug", "(", "'removing distribution %s'", ",", "dist", ")", "name", "=", "dist", ".", "key", "del", "self", ".", "dists_by_name", "[", "name", "]", "del", "self", ".", "di...
https://github.com/IronLanguages/main/blob/a949455434b1fda8c783289e897e78a9a0caabb5/External.LCA_RESTRICTED/Languages/IronPython/repackage/pip/pip/_vendor/distlib/locators.py#L1058-L1074
beetbox/beets
2fea53c34dd505ba391cb345424e0613901c8025
beetsplug/replaygain.py
python
ReplayGainPlugin.open_pool
(self, threads)
Open a `ThreadPool` instance in `self.pool`
Open a `ThreadPool` instance in `self.pool`
[ "Open", "a", "ThreadPool", "instance", "in", "self", ".", "pool" ]
def open_pool(self, threads): """Open a `ThreadPool` instance in `self.pool` """ if not self._has_pool() and self.backend_instance.do_parallel: self.pool = ThreadPool(threads) self.exc_queue = queue.Queue() signal.signal(signal.SIGINT, self._interrupt) ...
[ "def", "open_pool", "(", "self", ",", "threads", ")", ":", "if", "not", "self", ".", "_has_pool", "(", ")", "and", "self", ".", "backend_instance", ".", "do_parallel", ":", "self", ".", "pool", "=", "ThreadPool", "(", "threads", ")", "self", ".", "exc_...
https://github.com/beetbox/beets/blob/2fea53c34dd505ba391cb345424e0613901c8025/beetsplug/replaygain.py#L1226-L1239
hakril/PythonForWindows
61e027a678d5b87aa64fcf8a37a6661a86236589
windows/debug/debugger.py
python
Debugger._handle_rip
(self, debug_event)
Handle RIP_EVENT
Handle RIP_EVENT
[ "Handle", "RIP_EVENT" ]
def _handle_rip(self, debug_event): """Handle RIP_EVENT""" self._update_debugger_state(debug_event) rip_info = debug_event.u.RipInfo with self.DisabledMemoryBreakpoint(): return self.on_rip(rip_info)
[ "def", "_handle_rip", "(", "self", ",", "debug_event", ")", ":", "self", ".", "_update_debugger_state", "(", "debug_event", ")", "rip_info", "=", "debug_event", ".", "u", ".", "RipInfo", "with", "self", ".", "DisabledMemoryBreakpoint", "(", ")", ":", "return",...
https://github.com/hakril/PythonForWindows/blob/61e027a678d5b87aa64fcf8a37a6661a86236589/windows/debug/debugger.py#L883-L888
bayespy/bayespy
0e6e6130c888a4295cc9421d61d4ad27b2960ebb
bayespy/plot.py
python
_hinton_figure
(x, rows=None, cols=None, fig=None, square=True)
Plot the Hinton diagram of a Gaussian node
Plot the Hinton diagram of a Gaussian node
[ "Plot", "the", "Hinton", "diagram", "of", "a", "Gaussian", "node" ]
def _hinton_figure(x, rows=None, cols=None, fig=None, square=True): """ Plot the Hinton diagram of a Gaussian node """ scale = 0 std = 0 if fig is None: fig = plt.gcf() # Get mean and second moment shape = np.shape(x) size = np.ndim(x) if rows is None: rows = ...
[ "def", "_hinton_figure", "(", "x", ",", "rows", "=", "None", ",", "cols", "=", "None", ",", "fig", "=", "None", ",", "square", "=", "True", ")", ":", "scale", "=", "0", "std", "=", "0", "if", "fig", "is", "None", ":", "fig", "=", "plt", ".", ...
https://github.com/bayespy/bayespy/blob/0e6e6130c888a4295cc9421d61d4ad27b2960ebb/bayespy/plot.py#L688-L756
JimmXinu/FanFicFare
bc149a2deb2636320fe50a3e374af6eef8f61889
included_dependencies/soupsieve/css_match.py
python
FakeParent.__init__
(self, element)
Initialize.
Initialize.
[ "Initialize", "." ]
def __init__(self, element): """Initialize.""" self.contents = [element]
[ "def", "__init__", "(", "self", ",", "element", ")", ":", "self", ".", "contents", "=", "[", "element", "]" ]
https://github.com/JimmXinu/FanFicFare/blob/bc149a2deb2636320fe50a3e374af6eef8f61889/included_dependencies/soupsieve/css_match.py#L65-L68
plaid/plaid-python
8c60fca608e426f3ff30da8857775946d29e122c
plaid/model/personal_finance_category.py
python
PersonalFinanceCategory.__init__
(self, primary, detailed, *args, **kwargs)
PersonalFinanceCategory - a model defined in OpenAPI Args: primary (str): A high level category that communicates the broad category of the transaction. detailed (str): Provides additional granularity to the primary categorization. Keyword Args: _check_type (bool): ...
PersonalFinanceCategory - a model defined in OpenAPI
[ "PersonalFinanceCategory", "-", "a", "model", "defined", "in", "OpenAPI" ]
def __init__(self, primary, detailed, *args, **kwargs): # noqa: E501 """PersonalFinanceCategory - a model defined in OpenAPI Args: primary (str): A high level category that communicates the broad category of the transaction. detailed (str): Provides additional granularity to th...
[ "def", "__init__", "(", "self", ",", "primary", ",", "detailed", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "# noqa: E501", "_check_type", "=", "kwargs", ".", "pop", "(", "'_check_type'", ",", "True", ")", "_spec_property_naming", "=", "kwargs", ...
https://github.com/plaid/plaid-python/blob/8c60fca608e426f3ff30da8857775946d29e122c/plaid/model/personal_finance_category.py#L105-L177
doyensec/inql
8ee5f2d5d967fcf8f64676d355359d299c47037b
inql/generators/tsv.py
python
extract_returns_types
(val, returns)
return returns
Recursive method that extract all the returns types available in the present queries :param val: the IIR sub value, already recursively rebuilt :param returns: the support set containing the return value, it should be empty on the first iteration
Recursive method that extract all the returns types available in the present queries
[ "Recursive", "method", "that", "extract", "all", "the", "returns", "types", "available", "in", "the", "present", "queries" ]
def extract_returns_types(val, returns): """ Recursive method that extract all the returns types available in the present queries :param val: the IIR sub value, already recursively rebuilt :param returns: the support set containing the return value, it should be empty on the first iteration """ ...
[ "def", "extract_returns_types", "(", "val", ",", "returns", ")", ":", "if", "type", "(", "val", ")", "is", "not", "dict", ":", "returns", ".", "add", "(", "val", ")", "return", "returns", "for", "k", ",", "v", "in", "val", ".", "items", "(", ")", ...
https://github.com/doyensec/inql/blob/8ee5f2d5d967fcf8f64676d355359d299c47037b/inql/generators/tsv.py#L66-L88
hyperledger/aries-cloudagent-python
2f36776e99f6053ae92eed8123b5b1b2e891c02a
aries_cloudagent/messaging/models/base_record.py
python
BaseRecord.clear_cached_key
(cls, session: ProfileSession, cache_key: str)
Shortcut method to clear a cached key value, if any. Args: session: The profile session to use cache_key: The unique cache identifier
Shortcut method to clear a cached key value, if any.
[ "Shortcut", "method", "to", "clear", "a", "cached", "key", "value", "if", "any", "." ]
async def clear_cached_key(cls, session: ProfileSession, cache_key: str): """ Shortcut method to clear a cached key value, if any. Args: session: The profile session to use cache_key: The unique cache identifier """ if not cache_key: return ...
[ "async", "def", "clear_cached_key", "(", "cls", ",", "session", ":", "ProfileSession", ",", "cache_key", ":", "str", ")", ":", "if", "not", "cache_key", ":", "return", "cache", "=", "session", ".", "inject_or", "(", "BaseCache", ")", "if", "cache", ":", ...
https://github.com/hyperledger/aries-cloudagent-python/blob/2f36776e99f6053ae92eed8123b5b1b2e891c02a/aries_cloudagent/messaging/models/base_record.py#L204-L217
hypatia-software-org/hypatia-engine
7f712491b818f0f03b285b265dd1127388bcb30d
hypatia/game.py
python
Scene.from_tmx_resource
(cls, tmx_name)
return Scene(tilemap=tmx.tilemap, player_start_position=tmx.player_start_position, human_player=human_player, npcs=tmx.npcs)
Create a scene from a Tiled editor TMX file in the scenes resource directory. Returns: Scene: A scene created using all compatible data from designated TMX file.
Create a scene from a Tiled editor TMX file in the scenes resource directory.
[ "Create", "a", "scene", "from", "a", "Tiled", "editor", "TMX", "file", "in", "the", "scenes", "resource", "directory", "." ]
def from_tmx_resource(cls, tmx_name): """Create a scene from a Tiled editor TMX file in the scenes resource directory. Returns: Scene: A scene created using all compatible data from designated TMX file. """ file_path = os.path.join('resources', 'sce...
[ "def", "from_tmx_resource", "(", "cls", ",", "tmx_name", ")", ":", "file_path", "=", "os", ".", "path", ".", "join", "(", "'resources'", ",", "'scenes'", ",", "tmx_name", "+", "'.tmx'", ")", "tmx", "=", "TMX", "(", "file_path", ")", "human_player", "=", ...
https://github.com/hypatia-software-org/hypatia-engine/blob/7f712491b818f0f03b285b265dd1127388bcb30d/hypatia/game.py#L293-L310
ztosec/hunter
4ee5cca8dc5fc5d7e631e935517bd0f493c30a37
HunterAdminApi/api/hunter_admin_web_api.py
python
list_vulnerability_count
()
获取所有用户所有扫描的记录的漏洞数量集合,按照type和level分类 :return:
获取所有用户所有扫描的记录的漏洞数量集合,按照type和level分类 :return:
[ "获取所有用户所有扫描的记录的漏洞数量集合,按照type和level分类", ":", "return", ":" ]
def list_vulnerability_count(): """ 获取所有用户所有扫描的记录的漏洞数量集合,按照type和level分类 :return: """ try: vlun_nums = VulnerabilityService.get_vulnerability_count() return jsonify(status=200, message="查询成功", data=vlun_nums) except Exception as e: return jsonify(status=200, message="查询成功...
[ "def", "list_vulnerability_count", "(", ")", ":", "try", ":", "vlun_nums", "=", "VulnerabilityService", ".", "get_vulnerability_count", "(", ")", "return", "jsonify", "(", "status", "=", "200", ",", "message", "=", "\"查询成功\", data=v", "l", "n_nu", "m", "s)", "...
https://github.com/ztosec/hunter/blob/4ee5cca8dc5fc5d7e631e935517bd0f493c30a37/HunterAdminApi/api/hunter_admin_web_api.py#L509-L518
pyparallel/pyparallel
11e8c6072d48c8f13641925d17b147bf36ee0ba3
Lib/pydoc.py
python
HTMLDoc.docother
(self, object, name=None, mod=None, *ignored)
return lhs + self.repr(object)
Produce HTML documentation for a data object.
Produce HTML documentation for a data object.
[ "Produce", "HTML", "documentation", "for", "a", "data", "object", "." ]
def docother(self, object, name=None, mod=None, *ignored): """Produce HTML documentation for a data object.""" lhs = name and '<strong>%s</strong> = ' % name or '' return lhs + self.repr(object)
[ "def", "docother", "(", "self", ",", "object", ",", "name", "=", "None", ",", "mod", "=", "None", ",", "*", "ignored", ")", ":", "lhs", "=", "name", "and", "'<strong>%s</strong> = '", "%", "name", "or", "''", "return", "lhs", "+", "self", ".", "repr"...
https://github.com/pyparallel/pyparallel/blob/11e8c6072d48c8f13641925d17b147bf36ee0ba3/Lib/pydoc.py#L963-L966
macadmins/installapplications
2063c4a2bbec1df62e25e1e4a5820ffe3b5c4e46
payload/Library/installapplications/gurl.py
python
Gurl.connection_didReceiveData_
(self, _connection, data)
NSURLConnectionDataDelegate method Sent as a connection loads data incrementally
NSURLConnectionDataDelegate method Sent as a connection loads data incrementally
[ "NSURLConnectionDataDelegate", "method", "Sent", "as", "a", "connection", "loads", "data", "incrementally" ]
def connection_didReceiveData_(self, _connection, data): '''NSURLConnectionDataDelegate method Sent as a connection loads data incrementally''' self.handleReceivedData_(data)
[ "def", "connection_didReceiveData_", "(", "self", ",", "_connection", ",", "data", ")", ":", "self", ".", "handleReceivedData_", "(", "data", ")" ]
https://github.com/macadmins/installapplications/blob/2063c4a2bbec1df62e25e1e4a5820ffe3b5c4e46/payload/Library/installapplications/gurl.py#L696-L699
makerbot/ReplicatorG
d6f2b07785a5a5f1e172fb87cb4303b17c575d5d
skein_engines/skeinforge-50/fabmetheus_utilities/gcodec.py
python
DistanceFeedRate.parseSplitLine
(self, firstWord, splitLine)
Parse gcode split line and store the parameters.
Parse gcode split line and store the parameters.
[ "Parse", "gcode", "split", "line", "and", "store", "the", "parameters", "." ]
def parseSplitLine(self, firstWord, splitLine): 'Parse gcode split line and store the parameters.' if firstWord == '(<decimalPlacesCarried>': self.decimalPlacesCarried = int(splitLine[1])
[ "def", "parseSplitLine", "(", "self", ",", "firstWord", ",", "splitLine", ")", ":", "if", "firstWord", "==", "'(<decimalPlacesCarried>'", ":", "self", ".", "decimalPlacesCarried", "=", "int", "(", "splitLine", "[", "1", "]", ")" ]
https://github.com/makerbot/ReplicatorG/blob/d6f2b07785a5a5f1e172fb87cb4303b17c575d5d/skein_engines/skeinforge-50/fabmetheus_utilities/gcodec.py#L439-L442
freelawproject/courtlistener
ab3ae7bb6e5e836b286749113e7dbb403d470912
cl/custom_filters/templatetags/text_filters.py
python
v_wrapper
(text, autoescape=None)
return mark_safe( re.sub(r" v\. ", '<span class="alt"> v. </span>', esc(text)) )
Wraps every v. in a string with a class of alt
Wraps every v. in a string with a class of alt
[ "Wraps", "every", "v", ".", "in", "a", "string", "with", "a", "class", "of", "alt" ]
def v_wrapper(text, autoescape=None): """Wraps every v. in a string with a class of alt""" if autoescape: esc = conditional_escape else: esc = lambda x: x return mark_safe( re.sub(r" v\. ", '<span class="alt"> v. </span>', esc(text)) )
[ "def", "v_wrapper", "(", "text", ",", "autoescape", "=", "None", ")", ":", "if", "autoescape", ":", "esc", "=", "conditional_escape", "else", ":", "esc", "=", "lambda", "x", ":", "x", "return", "mark_safe", "(", "re", ".", "sub", "(", "r\" v\\. \"", ",...
https://github.com/freelawproject/courtlistener/blob/ab3ae7bb6e5e836b286749113e7dbb403d470912/cl/custom_filters/templatetags/text_filters.py#L73-L81
sqall01/alertR
e1d1a83e54f876cc4cd7bd87387e05cb75d4dc13
sensorClientTemplate/lib/client/serverCommunication.py
python
ServerCommunication.handle_requests
(self)
Handles received requests by server in a loop. Returns if an error is encountered. :return:
Handles received requests by server in a loop. Returns if an error is encountered.
[ "Handles", "received", "requests", "by", "server", "in", "a", "loop", ".", "Returns", "if", "an", "error", "is", "encountered", "." ]
def handle_requests(self): """ Handles received requests by server in a loop. Returns if an error is encountered. :return: """ # Handle commands in an infinity loop. while True: if not self.has_channel: return # Exit if we are r...
[ "def", "handle_requests", "(", "self", ")", ":", "# Handle commands in an infinity loop.", "while", "True", ":", "if", "not", "self", ".", "has_channel", ":", "return", "# Exit if we are requested to.", "if", "self", ".", "_exit_flag", ":", "if", "self", ".", "has...
https://github.com/sqall01/alertR/blob/e1d1a83e54f876cc4cd7bd87387e05cb75d4dc13/sensorClientTemplate/lib/client/serverCommunication.py#L655-L737
lixinsu/RCZoo
37fcb7962fbd4c751c561d4a0c84173881ea8339
reader/rnet/model.py
python
DocReader.load
(filename, new_args=None, normalize=True)
return DocReader(args, word_dict, char_dict, feature_dict, state_dict, normalize)
[]
def load(filename, new_args=None, normalize=True): logger.info('Loading model %s' % filename) saved_params = torch.load( filename, map_location=lambda storage, loc: storage ) word_dict = saved_params['word_dict'] char_dict = saved_params['char_dict'] feature_d...
[ "def", "load", "(", "filename", ",", "new_args", "=", "None", ",", "normalize", "=", "True", ")", ":", "logger", ".", "info", "(", "'Loading model %s'", "%", "filename", ")", "saved_params", "=", "torch", ".", "load", "(", "filename", ",", "map_location", ...
https://github.com/lixinsu/RCZoo/blob/37fcb7962fbd4c751c561d4a0c84173881ea8339/reader/rnet/model.py#L446-L458
roamanalytics/mittens
6052410979b3700be852d892922ca5a74d8f48d1
mittens/mittens_base.py
python
log_of_array_ignoring_zeros
(M)
return log_M
Returns an array containing the logs of the nonzero elements of M. Zeros are left alone since log(0) isn't defined. Parameters ---------- M : array-like Returns ------- array-like Shape matches `M`
Returns an array containing the logs of the nonzero elements of M. Zeros are left alone since log(0) isn't defined.
[ "Returns", "an", "array", "containing", "the", "logs", "of", "the", "nonzero", "elements", "of", "M", ".", "Zeros", "are", "left", "alone", "since", "log", "(", "0", ")", "isn", "t", "defined", "." ]
def log_of_array_ignoring_zeros(M): """Returns an array containing the logs of the nonzero elements of M. Zeros are left alone since log(0) isn't defined. Parameters ---------- M : array-like Returns ------- array-like Shape matches `M` """ log_M = M.copy() mas...
[ "def", "log_of_array_ignoring_zeros", "(", "M", ")", ":", "log_M", "=", "M", ".", "copy", "(", ")", "mask", "=", "log_M", ">", "0", "log_M", "[", "mask", "]", "=", "np", ".", "log", "(", "log_M", "[", "mask", "]", ")", "return", "log_M" ]
https://github.com/roamanalytics/mittens/blob/6052410979b3700be852d892922ca5a74d8f48d1/mittens/mittens_base.py#L243-L261
jaychsu/algorithm
87dac5456b74a515dd97507ac68e9b8588066a04
leetcode/384_shuffle_an_array.py
python
Solution.shuffle
(self)
return a
Returns a random shuffling of the array. :rtype: List[int]
Returns a random shuffling of the array. :rtype: List[int]
[ "Returns", "a", "random", "shuffling", "of", "the", "array", ".", ":", "rtype", ":", "List", "[", "int", "]" ]
def shuffle(self): """ Returns a random shuffling of the array. :rtype: List[int] """ a = self.nums n = len(a) for i in range(n): _i = randrange(i, n) a[i], a[_i] = a[_i], a[i] return a
[ "def", "shuffle", "(", "self", ")", ":", "a", "=", "self", ".", "nums", "n", "=", "len", "(", "a", ")", "for", "i", "in", "range", "(", "n", ")", ":", "_i", "=", "randrange", "(", "i", ",", "n", ")", "a", "[", "i", "]", ",", "a", "[", "...
https://github.com/jaychsu/algorithm/blob/87dac5456b74a515dd97507ac68e9b8588066a04/leetcode/384_shuffle_an_array.py#L20-L32
Blizzard/heroprotocol
3d36eaf44fc4c8ff3331c2ae2f1dc08a94535f1c
heroprotocol/versions/protocol85894.py
python
decode_replay_header
(contents)
return decoder.instance(replay_header_typeid)
Decodes and return the replay header from the contents byte string.
Decodes and return the replay header from the contents byte string.
[ "Decodes", "and", "return", "the", "replay", "header", "from", "the", "contents", "byte", "string", "." ]
def decode_replay_header(contents): """Decodes and return the replay header from the contents byte string.""" decoder = VersionedDecoder(contents, typeinfos) return decoder.instance(replay_header_typeid)
[ "def", "decode_replay_header", "(", "contents", ")", ":", "decoder", "=", "VersionedDecoder", "(", "contents", ",", "typeinfos", ")", "return", "decoder", ".", "instance", "(", "replay_header_typeid", ")" ]
https://github.com/Blizzard/heroprotocol/blob/3d36eaf44fc4c8ff3331c2ae2f1dc08a94535f1c/heroprotocol/versions/protocol85894.py#L435-L438
wxWidgets/Phoenix
b2199e299a6ca6d866aa6f3d0888499136ead9d6
wx/lib/agw/cubecolourdialog.py
python
Colour.ToHSV
(self)
Converts a RGB triplet into a HSV triplet.
Converts a RGB triplet into a HSV triplet.
[ "Converts", "a", "RGB", "triplet", "into", "a", "HSV", "triplet", "." ]
def ToHSV(self): """ Converts a RGB triplet into a HSV triplet. """ minVal = float(min(self.r, min(self.g, self.b))) maxVal = float(max(self.r, max(self.g, self.b))) delta = maxVal - minVal self.v = int(maxVal) if abs(delta) < 1e-6: self.h = self.s = 0 ...
[ "def", "ToHSV", "(", "self", ")", ":", "minVal", "=", "float", "(", "min", "(", "self", ".", "r", ",", "min", "(", "self", ".", "g", ",", "self", ".", "b", ")", ")", ")", "maxVal", "=", "float", "(", "max", "(", "self", ".", "r", ",", "max"...
https://github.com/wxWidgets/Phoenix/blob/b2199e299a6ca6d866aa6f3d0888499136ead9d6/wx/lib/agw/cubecolourdialog.py#L1552-L1591
openstack/keystone
771c943ad2116193e7bb118c74993c829d93bd71
keystone/federation/utils.py
python
DirectMaps.__str__
(self)
return '%s' % self._matches
return the direct map array as a string.
return the direct map array as a string.
[ "return", "the", "direct", "map", "array", "as", "a", "string", "." ]
def __str__(self): """return the direct map array as a string.""" return '%s' % self._matches
[ "def", "__str__", "(", "self", ")", ":", "return", "'%s'", "%", "self", ".", "_matches" ]
https://github.com/openstack/keystone/blob/771c943ad2116193e7bb118c74993c829d93bd71/keystone/federation/utils.py#L253-L255
wistbean/learn_python3_spider
73c873f4845f4385f097e5057407d03dd37a117b
stackoverflow/venv/lib/python3.6/site-packages/twisted/python/_inotify.py
python
init
()
return fd
Create an inotify instance and return the associated file descriptor.
Create an inotify instance and return the associated file descriptor.
[ "Create", "an", "inotify", "instance", "and", "return", "the", "associated", "file", "descriptor", "." ]
def init(): """ Create an inotify instance and return the associated file descriptor. """ fd = libc.inotify_init() if fd < 0: raise INotifyError("INotify initialization error.") return fd
[ "def", "init", "(", ")", ":", "fd", "=", "libc", ".", "inotify_init", "(", ")", "if", "fd", "<", "0", ":", "raise", "INotifyError", "(", "\"INotify initialization error.\"", ")", "return", "fd" ]
https://github.com/wistbean/learn_python3_spider/blob/73c873f4845f4385f097e5057407d03dd37a117b/stackoverflow/venv/lib/python3.6/site-packages/twisted/python/_inotify.py#L24-L31
fluentpython/example-code
d5133ad6e4a48eac0980d2418ed39d7ff693edbe
attic/concurrency/wikipedia/orig/sync_py3.py
python
fetch_image
(iso_date, img_url)
return len(img)
Fetch and save image data for date and url
Fetch and save image data for date and url
[ "Fetch", "and", "save", "image", "data", "for", "date", "and", "url" ]
def fetch_image(iso_date, img_url): """Fetch and save image data for date and url""" if verbose: print('\t' + img_url) with contextlib.closing(urllib.request.urlopen(img_url)) as fp: img = fp.read() img_filename = iso_date + '__' + img_url.split('/')[-1] if verbose: print('\t...
[ "def", "fetch_image", "(", "iso_date", ",", "img_url", ")", ":", "if", "verbose", ":", "print", "(", "'\\t'", "+", "img_url", ")", "with", "contextlib", ".", "closing", "(", "urllib", ".", "request", ".", "urlopen", "(", "img_url", ")", ")", "as", "fp"...
https://github.com/fluentpython/example-code/blob/d5133ad6e4a48eac0980d2418ed39d7ff693edbe/attic/concurrency/wikipedia/orig/sync_py3.py#L70-L82
neuropsychology/NeuroKit
d01111b9b82364d28da01c002e6cbfc45d9493d9
neurokit2/eog/eog_clean.py
python
_eog_clean_mne
(eog_signal, sampling_rate=1000)
return clean
EOG cleaning implemented by default in MNE. https://github.com/mne-tools/mne-python/blob/master/mne/preprocessing/eog.py
EOG cleaning implemented by default in MNE.
[ "EOG", "cleaning", "implemented", "by", "default", "in", "MNE", "." ]
def _eog_clean_mne(eog_signal, sampling_rate=1000): """EOG cleaning implemented by default in MNE. https://github.com/mne-tools/mne-python/blob/master/mne/preprocessing/eog.py """ # Make sure MNE is installed try: import mne except ImportError: raise ImportError( "N...
[ "def", "_eog_clean_mne", "(", "eog_signal", ",", "sampling_rate", "=", "1000", ")", ":", "# Make sure MNE is installed", "try", ":", "import", "mne", "except", "ImportError", ":", "raise", "ImportError", "(", "\"NeuroKit error: signal_filter(): the 'mne' module is required ...
https://github.com/neuropsychology/NeuroKit/blob/d01111b9b82364d28da01c002e6cbfc45d9493d9/neurokit2/eog/eog_clean.py#L165-L195
pytube/pytube
56ccab4f9cbfa989c418e93a42ef00b424fc05f4
pytube/innertube.py
python
InnerTube.config
(self)
Make a request to the config endpoint. TODO: Figure out how we can use this
Make a request to the config endpoint.
[ "Make", "a", "request", "to", "the", "config", "endpoint", "." ]
def config(self): """Make a request to the config endpoint. TODO: Figure out how we can use this """ # endpoint = f'{self.base_url}/config' # noqa:E800 ...
[ "def", "config", "(", "self", ")", ":", "# endpoint = f'{self.base_url}/config' # noqa:E800", "..." ]
https://github.com/pytube/pytube/blob/56ccab4f9cbfa989c418e93a42ef00b424fc05f4/pytube/innertube.py#L259-L265
openedx/edx-platform
68dd185a0ab45862a2a61e0f803d7e03d2be71b5
pavelib/utils/envs.py
python
Env.get_django_settings
(cls, django_settings, system, settings=None, print_setting_args=None)
Interrogate Django environment for specific settings values :param django_settings: list of django settings values to get :param system: the django app to use when asking for the setting (lms | cms) :param settings: the settings file to use when asking for the value :param print_setting_...
Interrogate Django environment for specific settings values :param django_settings: list of django settings values to get :param system: the django app to use when asking for the setting (lms | cms) :param settings: the settings file to use when asking for the value :param print_setting_...
[ "Interrogate", "Django", "environment", "for", "specific", "settings", "values", ":", "param", "django_settings", ":", "list", "of", "django", "settings", "values", "to", "get", ":", "param", "system", ":", "the", "django", "app", "to", "use", "when", "asking"...
def get_django_settings(cls, django_settings, system, settings=None, print_setting_args=None): """ Interrogate Django environment for specific settings values :param django_settings: list of django settings values to get :param system: the django app to use when asking for the setting (l...
[ "def", "get_django_settings", "(", "cls", ",", "django_settings", ",", "system", ",", "settings", "=", "None", ",", "print_setting_args", "=", "None", ")", ":", "if", "not", "settings", ":", "settings", "=", "os", ".", "environ", ".", "get", "(", "\"EDX_PL...
https://github.com/openedx/edx-platform/blob/68dd185a0ab45862a2a61e0f803d7e03d2be71b5/pavelib/utils/envs.py#L241-L277
justdark/dml
4a547a26a171262a869b18e56e8e2abdd4c8c8ed
build/lib/dml/SVM/svm.py
python
SVMC.randJ
(self,i)
return j[0]
[]
def randJ(self,i): j=rd.sample(range(self.M),1) while j==i: j=rd.sample(range(self.M),1) return j[0]
[ "def", "randJ", "(", "self", ",", "i", ")", ":", "j", "=", "rd", ".", "sample", "(", "range", "(", "self", ".", "M", ")", ",", "1", ")", "while", "j", "==", "i", ":", "j", "=", "rd", ".", "sample", "(", "range", "(", "self", ".", "M", ")"...
https://github.com/justdark/dml/blob/4a547a26a171262a869b18e56e8e2abdd4c8c8ed/build/lib/dml/SVM/svm.py#L42-L46
smart-mobile-software/gitstack
d9fee8f414f202143eb6e620529e8e5539a2af56
python/Lib/site-packages/django/contrib/gis/geos/geometry.py
python
GEOSGeometry.wkb
(self)
return wkb_w().write(self)
Returns the WKB (Well-Known Binary) representation of this Geometry as a Python buffer. SRID and Z values are not included, use the `ewkb` property instead.
Returns the WKB (Well-Known Binary) representation of this Geometry as a Python buffer. SRID and Z values are not included, use the `ewkb` property instead.
[ "Returns", "the", "WKB", "(", "Well", "-", "Known", "Binary", ")", "representation", "of", "this", "Geometry", "as", "a", "Python", "buffer", ".", "SRID", "and", "Z", "values", "are", "not", "included", "use", "the", "ewkb", "property", "instead", "." ]
def wkb(self): """ Returns the WKB (Well-Known Binary) representation of this Geometry as a Python buffer. SRID and Z values are not included, use the `ewkb` property instead. """ return wkb_w().write(self)
[ "def", "wkb", "(", "self", ")", ":", "return", "wkb_w", "(", ")", ".", "write", "(", "self", ")" ]
https://github.com/smart-mobile-software/gitstack/blob/d9fee8f414f202143eb6e620529e8e5539a2af56/python/Lib/site-packages/django/contrib/gis/geos/geometry.py#L423-L429