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
arsaboo/homeassistant-config
53c998986fbe84d793a0b174757154ab30e676e4
custom_components/futures_cnn/sensor.py
python
CNNFuturesData.__init__
(self, resource)
Initialize the data object.
Initialize the data object.
[ "Initialize", "the", "data", "object", "." ]
def __init__(self, resource): """Initialize the data object.""" self._resource = resource self.data = None self.available = True
[ "def", "__init__", "(", "self", ",", "resource", ")", ":", "self", ".", "_resource", "=", "resource", "self", ".", "data", "=", "None", "self", ".", "available", "=", "True" ]
https://github.com/arsaboo/homeassistant-config/blob/53c998986fbe84d793a0b174757154ab30e676e4/custom_components/futures_cnn/sensor.py#L183-L187
IJDykeman/wangTiles
7c1ee2095ebdf7f72bce07d94c6484915d5cae8b
experimental_code/tiles_3d/venv_mac/lib/python2.7/site-packages/setuptools/command/sdist.py
python
sdist.make_distribution
(self)
Workaround for #516
Workaround for #516
[ "Workaround", "for", "#516" ]
def make_distribution(self): """ Workaround for #516 """ with self._remove_os_link(): orig.sdist.make_distribution(self)
[ "def", "make_distribution", "(", "self", ")", ":", "with", "self", ".", "_remove_os_link", "(", ")", ":", "orig", ".", "sdist", ".", "make_distribution", "(", "self", ")" ]
https://github.com/IJDykeman/wangTiles/blob/7c1ee2095ebdf7f72bce07d94c6484915d5cae8b/experimental_code/tiles_3d/venv_mac/lib/python2.7/site-packages/setuptools/command/sdist.py#L73-L78
oddt/oddt
8cf555820d97a692ade81c101ebe10e28bcb3722
oddt/scoring/functions/RFScore.py
python
rfscore.__init__
(self, protein=None, n_jobs=-1, version=1, spr=0, **kwargs)
Scoring function implementing RF-Score variants. It predicts the binding affinity (pKi/d) of ligand in a complex utilizng simple descriptors (close contacts of atoms <12A) with sophisticated machine-learning model (random forest). The third variand supplements those contacts with Vina p...
Scoring function implementing RF-Score variants. It predicts the binding affinity (pKi/d) of ligand in a complex utilizng simple descriptors (close contacts of atoms <12A) with sophisticated machine-learning model (random forest). The third variand supplements those contacts with Vina p...
[ "Scoring", "function", "implementing", "RF", "-", "Score", "variants", ".", "It", "predicts", "the", "binding", "affinity", "(", "pKi", "/", "d", ")", "of", "ligand", "in", "a", "complex", "utilizng", "simple", "descriptors", "(", "close", "contacts", "of", ...
def __init__(self, protein=None, n_jobs=-1, version=1, spr=0, **kwargs): """Scoring function implementing RF-Score variants. It predicts the binding affinity (pKi/d) of ligand in a complex utilizng simple descriptors (close contacts of atoms <12A) with sophisticated machine-learning mod...
[ "def", "__init__", "(", "self", ",", "protein", "=", "None", ",", "n_jobs", "=", "-", "1", ",", "version", "=", "1", ",", "spr", "=", "0", ",", "*", "*", "kwargs", ")", ":", "self", ".", "protein", "=", "protein", "self", ".", "n_jobs", "=", "n...
https://github.com/oddt/oddt/blob/8cf555820d97a692ade81c101ebe10e28bcb3722/oddt/scoring/functions/RFScore.py#L34-L123
sagemath/sage
f9b2db94f675ff16963ccdefba4f1a3393b3fe0d
src/sage/schemes/toric/library.py
python
ToricVarietyFactory.Cube_deformation
(self,k, names=None, base_ring=QQ)
return ToricVariety(fan, coordinate_names=names)
r""" Construct, for each `k\in\ZZ_{\geq 0}`, a toric variety with `\ZZ_k`-torsion in the Chow group. The fans of this sequence of toric varieties all equal the face fan of a unit cube topologically, but the ``(1,1,1)``-vertex is moved to ``(1,1,2k+1)``. This example was ...
r""" Construct, for each `k\in\ZZ_{\geq 0}`, a toric variety with `\ZZ_k`-torsion in the Chow group.
[ "r", "Construct", "for", "each", "k", "\\", "in", "\\", "ZZ_", "{", "\\", "geq", "0", "}", "a", "toric", "variety", "with", "\\", "ZZ_k", "-", "torsion", "in", "the", "Chow", "group", "." ]
def Cube_deformation(self,k, names=None, base_ring=QQ): r""" Construct, for each `k\in\ZZ_{\geq 0}`, a toric variety with `\ZZ_k`-torsion in the Chow group. The fans of this sequence of toric varieties all equal the face fan of a unit cube topologically, but the ``(1,1,1...
[ "def", "Cube_deformation", "(", "self", ",", "k", ",", "names", "=", "None", ",", "base_ring", "=", "QQ", ")", ":", "# We are going to eventually switch off consistency checks, so we need", "# to be sure that the input is acceptable.", "try", ":", "k", "=", "ZZ", "(", ...
https://github.com/sagemath/sage/blob/f9b2db94f675ff16963ccdefba4f1a3393b3fe0d/src/sage/schemes/toric/library.py#L985-L1046
SanPen/GridCal
d3f4566d2d72c11c7e910c9d162538ef0e60df31
src/GridCal/Engine/Simulations/PowerFlow/derivatives.py
python
derivatives_Beq_csc_fast
(nb, nl, iBeqx, F, T, V, ma, k2)
return dSbus_dBeqx, dSf_dBeqx, dSt_dBeqx
Compute the derivatives of: - dSbus_dBeqz, dSf_dBeqz, dSt_dBeqz -> iBeqx=iBeqz - dSbus_dBeqv, dSf_dBeqv, dSt_dBeqv -> iBeqx=iBeqv :param nb: Number of buses :param nl: Number of branches :param iBeqx: array of indices {iBeqz, iBeqv} :param F: Array of branch "from" bus indices :param T: Arr...
Compute the derivatives of: - dSbus_dBeqz, dSf_dBeqz, dSt_dBeqz -> iBeqx=iBeqz - dSbus_dBeqv, dSf_dBeqv, dSt_dBeqv -> iBeqx=iBeqv
[ "Compute", "the", "derivatives", "of", ":", "-", "dSbus_dBeqz", "dSf_dBeqz", "dSt_dBeqz", "-", ">", "iBeqx", "=", "iBeqz", "-", "dSbus_dBeqv", "dSf_dBeqv", "dSt_dBeqv", "-", ">", "iBeqx", "=", "iBeqv" ]
def derivatives_Beq_csc_fast(nb, nl, iBeqx, F, T, V, ma, k2): """ Compute the derivatives of: - dSbus_dBeqz, dSf_dBeqz, dSt_dBeqz -> iBeqx=iBeqz - dSbus_dBeqv, dSf_dBeqv, dSt_dBeqv -> iBeqx=iBeqv :param nb: Number of buses :param nl: Number of branches :param iBeqx: array of indices {iBeqz,...
[ "def", "derivatives_Beq_csc_fast", "(", "nb", ",", "nl", ",", "iBeqx", ",", "F", ",", "T", ",", "V", ",", "ma", ",", "k2", ")", ":", "ndev", "=", "len", "(", "iBeqx", ")", "dSbus_dBeq_data", ",", "dSbus_dBeq_indices", ",", "dSbus_dBeq_indptr", ",", "dS...
https://github.com/SanPen/GridCal/blob/d3f4566d2d72c11c7e910c9d162538ef0e60df31/src/GridCal/Engine/Simulations/PowerFlow/derivatives.py#L831-L860
misterch0c/shadowbroker
e3a069bea47a2c1009697941ac214adc6f90aa8d
windows/Resources/Python/Core/Lib/lib-tk/Tkinter.py
python
Menu.activate
(self, index)
Activate entry at INDEX.
Activate entry at INDEX.
[ "Activate", "entry", "at", "INDEX", "." ]
def activate(self, index): """Activate entry at INDEX.""" self.tk.call(self._w, 'activate', index)
[ "def", "activate", "(", "self", ",", "index", ")", ":", "self", ".", "tk", ".", "call", "(", "self", ".", "_w", ",", "'activate'", ",", "index", ")" ]
https://github.com/misterch0c/shadowbroker/blob/e3a069bea47a2c1009697941ac214adc6f90aa8d/windows/Resources/Python/Core/Lib/lib-tk/Tkinter.py#L2936-L2938
deepfakes/faceswap
09c7d8aca3c608d1afad941ea78e9fd9b64d9219
lib/gui/wrapper.py
python
FaceswapControl.terminate
(self)
Terminate the running process in a LongRunningTask so we can still output to console
Terminate the running process in a LongRunningTask so we can still output to console
[ "Terminate", "the", "running", "process", "in", "a", "LongRunningTask", "so", "we", "can", "still", "output", "to", "console" ]
def terminate(self): """ Terminate the running process in a LongRunningTask so we can still output to console """ if self.thread is None: logger.debug("Terminating wrapper in LongRunningTask") self.thread = LongRunningTask(target=self.terminate_in_thread, ...
[ "def", "terminate", "(", "self", ")", ":", "if", "self", ".", "thread", "is", "None", ":", "logger", ".", "debug", "(", "\"Terminating wrapper in LongRunningTask\"", ")", "self", ".", "thread", "=", "LongRunningTask", "(", "target", "=", "self", ".", "termin...
https://github.com/deepfakes/faceswap/blob/09c7d8aca3c608d1afad941ea78e9fd9b64d9219/lib/gui/wrapper.py#L370-L387
EricZgw/PyramidBox
03f67d8422f2f03e5ee580e2f92d4040c24bbdb4
preprocessing/tf_image.py
python
fix_image_flip_shape
(image, result)
return result
Set the shape to 3 dimensional if we don't know anything else. Args: image: original image size result: flipped or transformed image Returns: An image whose shape is at least None,None,None.
Set the shape to 3 dimensional if we don't know anything else. Args: image: original image size result: flipped or transformed image Returns: An image whose shape is at least None,None,None.
[ "Set", "the", "shape", "to", "3", "dimensional", "if", "we", "don", "t", "know", "anything", "else", ".", "Args", ":", "image", ":", "original", "image", "size", "result", ":", "flipped", "or", "transformed", "image", "Returns", ":", "An", "image", "whos...
def fix_image_flip_shape(image, result): """Set the shape to 3 dimensional if we don't know anything else. Args: image: original image size result: flipped or transformed image Returns: An image whose shape is at least None,None,None. """ image_shape = image.get_shape() if imag...
[ "def", "fix_image_flip_shape", "(", "image", ",", "result", ")", ":", "image_shape", "=", "image", ".", "get_shape", "(", ")", "if", "image_shape", "==", "tensor_shape", ".", "unknown_shape", "(", ")", ":", "result", ".", "set_shape", "(", "[", "None", ","...
https://github.com/EricZgw/PyramidBox/blob/03f67d8422f2f03e5ee580e2f92d4040c24bbdb4/preprocessing/tf_image.py#L119-L132
SublimeHaskell/SublimeHaskell
733c7c4fa6eaf34a6544b888345f23ab4f461fcb
internals/backend.py
python
HaskellBackend.is_available
(**_kwargs)
return False
Test if the backend is available. For most backends, this verifies that an executable exists and possibly that the version is supported (see the `hsdev` version of this method.) Return True if the backend is available. The base class returns False.
Test if the backend is available. For most backends, this verifies that an executable exists and possibly that the version is supported (see the `hsdev` version of this method.)
[ "Test", "if", "the", "backend", "is", "available", ".", "For", "most", "backends", "this", "verifies", "that", "an", "executable", "exists", "and", "possibly", "that", "the", "version", "is", "supported", "(", "see", "the", "hsdev", "version", "of", "this", ...
def is_available(**_kwargs): '''Test if the backend is available. For most backends, this verifies that an executable exists and possibly that the version is supported (see the `hsdev` version of this method.) Return True if the backend is available. The base class returns False. ''' ...
[ "def", "is_available", "(", "*", "*", "_kwargs", ")", ":", "return", "False" ]
https://github.com/SublimeHaskell/SublimeHaskell/blob/733c7c4fa6eaf34a6544b888345f23ab4f461fcb/internals/backend.py#L29-L35
windelbouwman/ppci
915c069e0667042c085ec42c78e9e3c9a5295324
ppci/api.py
python
c3c
( sources, includes, march, opt_level=0, reporter=None, debug=False, outstream=None, )
return ir_to_object( [ir_module], march, debug=debug, reporter=reporter, opt=opt_cg, outstream=outstream, )
Compile a set of sources into binary format for the given target. Args: sources: a collection of sources that will be compiled. includes: a collection of sources that will be used for type and function information. march: the architecture for which to compile. reporter: ...
Compile a set of sources into binary format for the given target.
[ "Compile", "a", "set", "of", "sources", "into", "binary", "format", "for", "the", "given", "target", "." ]
def c3c( sources, includes, march, opt_level=0, reporter=None, debug=False, outstream=None, ): """Compile a set of sources into binary format for the given target. Args: sources: a collection of sources that will be compiled. includes: a collection of sources that wi...
[ "def", "c3c", "(", "sources", ",", "includes", ",", "march", ",", "opt_level", "=", "0", ",", "reporter", "=", "None", ",", "debug", "=", "False", ",", "outstream", "=", "None", ",", ")", ":", "reporter", "=", "get_reporter", "(", "reporter", ")", "m...
https://github.com/windelbouwman/ppci/blob/915c069e0667042c085ec42c78e9e3c9a5295324/ppci/api.py#L395-L440
textX/textX
452b684d434c557a63ff7ae2b014770c29669e4c
textx/lang.py
python
python_type
(textx_type_name)
return { 'ID': text, 'BOOL': bool, 'INT': int, 'FLOAT': float, 'STRICTFLOAT': float, 'STRING': text, 'NUMBER': float, 'BASETYPE': text, }.get(textx_type_name, textx_type_name)
Return Python type from the name of base textx type.
Return Python type from the name of base textx type.
[ "Return", "Python", "type", "from", "the", "name", "of", "base", "textx", "type", "." ]
def python_type(textx_type_name): """Return Python type from the name of base textx type.""" return { 'ID': text, 'BOOL': bool, 'INT': int, 'FLOAT': float, 'STRICTFLOAT': float, 'STRING': text, 'NUMBER': float, 'BASETYPE': text, }.get(textx_typ...
[ "def", "python_type", "(", "textx_type_name", ")", ":", "return", "{", "'ID'", ":", "text", ",", "'BOOL'", ":", "bool", ",", "'INT'", ":", "int", ",", "'FLOAT'", ":", "float", ",", "'STRICTFLOAT'", ":", "float", ",", "'STRING'", ":", "text", ",", "'NUM...
https://github.com/textX/textX/blob/452b684d434c557a63ff7ae2b014770c29669e4c/textx/lang.py#L136-L147
Erotemic/ubelt
221d5f6262d5c8e78638e1a38e3adcc9cc9a15e9
ubelt/util_hash.py
python
HashableExtensions.lookup
(self, data)
return hash_func
Returns an appropriate function to hash ``data`` if one has been registered. Raises: TypeError : if data has no registered hash methods Example: >>> import ubelt as ub >>> import pytest >>> if not ub.modname_to_modpath('numpy'): ... ...
Returns an appropriate function to hash ``data`` if one has been registered.
[ "Returns", "an", "appropriate", "function", "to", "hash", "data", "if", "one", "has", "been", "registered", "." ]
def lookup(self, data): """ Returns an appropriate function to hash ``data`` if one has been registered. Raises: TypeError : if data has no registered hash methods Example: >>> import ubelt as ub >>> import pytest >>> if not ub.mo...
[ "def", "lookup", "(", "self", ",", "data", ")", ":", "# Evaluate the lazy queue if anything is in it", "if", "self", ".", "_lazy_queue", ":", "for", "func", "in", "self", ".", "_lazy_queue", ":", "func", "(", ")", "self", ".", "_lazy_queue", "=", "[", "]", ...
https://github.com/Erotemic/ubelt/blob/221d5f6262d5c8e78638e1a38e3adcc9cc9a15e9/ubelt/util_hash.py#L480-L545
getnikola/nikola
2da876e9322e42a93f8295f950e336465c6a4ee5
nikola/plugins/command/serve.py
python
CommandServe.shutdown
(self, signum=None, _frame=None)
Shut down the server that is running detached.
Shut down the server that is running detached.
[ "Shut", "down", "the", "server", "that", "is", "running", "detached", "." ]
def shutdown(self, signum=None, _frame=None): """Shut down the server that is running detached.""" if self.dns_sd: self.dns_sd.Reset() if os.path.exists(self.serve_pidfile): os.remove(self.serve_pidfile) if not self.detached: self.logger.info("Server i...
[ "def", "shutdown", "(", "self", ",", "signum", "=", "None", ",", "_frame", "=", "None", ")", ":", "if", "self", ".", "dns_sd", ":", "self", ".", "dns_sd", ".", "Reset", "(", ")", "if", "os", ".", "path", ".", "exists", "(", "self", ".", "serve_pi...
https://github.com/getnikola/nikola/blob/2da876e9322e42a93f8295f950e336465c6a4ee5/nikola/plugins/command/serve.py#L100-L109
prkumar/uplink
3472806f68a60a93f7cb555d36365551a5411cc5
uplink/clients/io/interfaces.py
python
RequestExecution.state
(self)
The current state of the request.
The current state of the request.
[ "The", "current", "state", "of", "the", "request", "." ]
def state(self): """The current state of the request.""" raise NotImplementedError
[ "def", "state", "(", "self", ")", ":", "raise", "NotImplementedError" ]
https://github.com/prkumar/uplink/blob/3472806f68a60a93f7cb555d36365551a5411cc5/uplink/clients/io/interfaces.py#L86-L88
missionpinball/mpf
8e6b74cff4ba06d2fec9445742559c1068b88582
mpf/core/utility_functions.py
python
Util.pwm32_to_int
(source_int: int)
Convert a PWM32 value to int.
Convert a PWM32 value to int.
[ "Convert", "a", "PWM32", "value", "to", "int", "." ]
def pwm32_to_int(source_int: int) -> int: """Convert a PWM32 value to int.""" # generated by the int_to_pwm.py script in the mpf/tools folder lookup_table = { 0: 0, # 00000000000000000000000000000000 1: 2, # 00000000000000000000000000000010 2: 131074, # 00...
[ "def", "pwm32_to_int", "(", "source_int", ":", "int", ")", "->", "int", ":", "# generated by the int_to_pwm.py script in the mpf/tools folder", "lookup_table", "=", "{", "0", ":", "0", ",", "# 00000000000000000000000000000000", "1", ":", "2", ",", "# 0000000000000000000...
https://github.com/missionpinball/mpf/blob/8e6b74cff4ba06d2fec9445742559c1068b88582/mpf/core/utility_functions.py#L423-L467
wxWidgets/Phoenix
b2199e299a6ca6d866aa6f3d0888499136ead9d6
wx/lib/agw/aui/tabart.py
python
AuiSimpleTabArt.DrawTab
(self, dc, wnd, page, in_rect, close_button_state, paint_control=False)
return out_tab_rect, out_button_rect, x_extent
Draws a single tab. :param `dc`: a :class:`wx.DC` device context; :param `wnd`: a :class:`wx.Window` instance object; :param `page`: the tab control page associated with the tab; :param wx.Rect `in_rect`: rectangle the tab should be confined to; :param integer `close_button_stat...
Draws a single tab.
[ "Draws", "a", "single", "tab", "." ]
def DrawTab(self, dc, wnd, page, in_rect, close_button_state, paint_control=False): """ Draws a single tab. :param `dc`: a :class:`wx.DC` device context; :param `wnd`: a :class:`wx.Window` instance object; :param `page`: the tab control page associated with the tab; :par...
[ "def", "DrawTab", "(", "self", ",", "dc", ",", "wnd", ",", "page", ",", "in_rect", ",", "close_button_state", ",", "paint_control", "=", "False", ")", ":", "# if the caption is empty, measure some temporary text", "caption", "=", "page", ".", "caption", "if", "c...
https://github.com/wxWidgets/Phoenix/blob/b2199e299a6ca6d866aa6f3d0888499136ead9d6/wx/lib/agw/aui/tabart.py#L1151-L1326
zhl2008/awd-platform
0416b31abea29743387b10b3914581fbe8e7da5e
web_flaskbb/Python-2.7.9/Lib/plat-mac/ic.py
python
IC.settypecreator
(self, file)
[]
def settypecreator(self, file): file = Carbon.File.pathname(file) record = self.mapfile(os.path.split(file)[1]) MacOS.SetCreatorAndType(file, record[2], record[1]) macostools.touched(fss)
[ "def", "settypecreator", "(", "self", ",", "file", ")", ":", "file", "=", "Carbon", ".", "File", ".", "pathname", "(", "file", ")", "record", "=", "self", ".", "mapfile", "(", "os", ".", "path", ".", "split", "(", "file", ")", "[", "1", "]", ")",...
https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_flaskbb/Python-2.7.9/Lib/plat-mac/ic.py#L226-L230
saltstack/salt
fae5bc757ad0f1716483ce7ae180b451545c2058
salt/modules/zabbix.py
python
usergroup_list
(**connection_args)
Retrieve all enabled user groups. .. versionadded:: 2016.3.0 :param _connection_user: Optional - zabbix user (can also be set in opts or pillar, see module's docstring) :param _connection_password: Optional - zabbix password (can also be set in opts or pillar, see module's docstring) :param _connectio...
Retrieve all enabled user groups.
[ "Retrieve", "all", "enabled", "user", "groups", "." ]
def usergroup_list(**connection_args): """ Retrieve all enabled user groups. .. versionadded:: 2016.3.0 :param _connection_user: Optional - zabbix user (can also be set in opts or pillar, see module's docstring) :param _connection_password: Optional - zabbix password (can also be set in opts or pi...
[ "def", "usergroup_list", "(", "*", "*", "connection_args", ")", ":", "conn_args", "=", "_login", "(", "*", "*", "connection_args", ")", "ret", "=", "False", "try", ":", "if", "conn_args", ":", "method", "=", "\"usergroup.get\"", "params", "=", "{", "\"outp...
https://github.com/saltstack/salt/blob/fae5bc757ad0f1716483ce7ae180b451545c2058/salt/modules/zabbix.py#L1110-L1141
truenas/middleware
b11ec47d6340324f5a32287ffb4012e5d709b934
src/middlewared/middlewared/plugins/smb_/groupmap.py
python
SMBService.validate_groupmap_hwm
(self, low_range)
return must_reload
Middleware forces allocation of GIDs for Users, Groups, and Administrators to be deterministic with the default idmap backend. Bump up the idmap_tdb high-water mark to avoid conflicts with these and remove any mappings that conflict. Winbindd will regenerate the removed ones as-needed.
Middleware forces allocation of GIDs for Users, Groups, and Administrators to be deterministic with the default idmap backend. Bump up the idmap_tdb high-water mark to avoid conflicts with these and remove any mappings that conflict. Winbindd will regenerate the removed ones as-needed.
[ "Middleware", "forces", "allocation", "of", "GIDs", "for", "Users", "Groups", "and", "Administrators", "to", "be", "deterministic", "with", "the", "default", "idmap", "backend", ".", "Bump", "up", "the", "idmap_tdb", "high", "-", "water", "mark", "to", "avoid"...
def validate_groupmap_hwm(self, low_range): """ Middleware forces allocation of GIDs for Users, Groups, and Administrators to be deterministic with the default idmap backend. Bump up the idmap_tdb high-water mark to avoid conflicts with these and remove any mappings that conflict...
[ "def", "validate_groupmap_hwm", "(", "self", ",", "low_range", ")", ":", "must_reload", "=", "False", "try", ":", "tdb_handle", "=", "tdb", ".", "open", "(", "f\"{SMBPath.STATEDIR.platform()}/winbindd_idmap.tdb\"", ")", "except", "FileNotFoundError", ":", "return", ...
https://github.com/truenas/middleware/blob/b11ec47d6340324f5a32287ffb4012e5d709b934/src/middlewared/middlewared/plugins/smb_/groupmap.py#L182-L224
securityclippy/elasticintel
aa08d3e9f5ab1c000128e95161139ce97ff0e334
whois_lambda/requests/packages/urllib3/fields.py
python
RequestField.from_tuples
(cls, fieldname, value)
return request_param
A :class:`~urllib3.fields.RequestField` factory from old-style tuple parameters. Supports constructing :class:`~urllib3.fields.RequestField` from parameter of key/value strings AND key/filetuple. A filetuple is a (filename, data, MIME type) tuple where the MIME type is optional. For exa...
A :class:`~urllib3.fields.RequestField` factory from old-style tuple parameters.
[ "A", ":", "class", ":", "~urllib3", ".", "fields", ".", "RequestField", "factory", "from", "old", "-", "style", "tuple", "parameters", "." ]
def from_tuples(cls, fieldname, value): """ A :class:`~urllib3.fields.RequestField` factory from old-style tuple parameters. Supports constructing :class:`~urllib3.fields.RequestField` from parameter of key/value strings AND key/filetuple. A filetuple is a (filename, data, MIME ...
[ "def", "from_tuples", "(", "cls", ",", "fieldname", ",", "value", ")", ":", "if", "isinstance", "(", "value", ",", "tuple", ")", ":", "if", "len", "(", "value", ")", "==", "3", ":", "filename", ",", "data", ",", "content_type", "=", "value", "else", ...
https://github.com/securityclippy/elasticintel/blob/aa08d3e9f5ab1c000128e95161139ce97ff0e334/whois_lambda/requests/packages/urllib3/fields.py#L72-L103
dropbox/dropbox-sdk-python
015437429be224732990041164a21a0501235db1
dropbox/team_log.py
python
EventDetails.get_shared_folder_decline_invitation_details
(self)
return self._value
Only call this if :meth:`is_shared_folder_decline_invitation_details` is true. :rtype: SharedFolderDeclineInvitationDetails
Only call this if :meth:`is_shared_folder_decline_invitation_details` is true.
[ "Only", "call", "this", "if", ":", "meth", ":", "is_shared_folder_decline_invitation_details", "is", "true", "." ]
def get_shared_folder_decline_invitation_details(self): """ Only call this if :meth:`is_shared_folder_decline_invitation_details` is true. :rtype: SharedFolderDeclineInvitationDetails """ if not self.is_shared_folder_decline_invitation_details(): raise AttributeError...
[ "def", "get_shared_folder_decline_invitation_details", "(", "self", ")", ":", "if", "not", "self", ".", "is_shared_folder_decline_invitation_details", "(", ")", ":", "raise", "AttributeError", "(", "\"tag 'shared_folder_decline_invitation_details' not set\"", ")", "return", "...
https://github.com/dropbox/dropbox-sdk-python/blob/015437429be224732990041164a21a0501235db1/dropbox/team_log.py#L20019-L20027
openedx/edx-platform
68dd185a0ab45862a2a61e0f803d7e03d2be71b5
cms/djangoapps/contentstore/courseware_index.py
python
indexing_is_enabled
()
return settings.FEATURES.get('ENABLE_COURSEWARE_INDEX', False)
Checks to see if the indexing feature is enabled
Checks to see if the indexing feature is enabled
[ "Checks", "to", "see", "if", "the", "indexing", "feature", "is", "enabled" ]
def indexing_is_enabled(): """ Checks to see if the indexing feature is enabled """ return settings.FEATURES.get('ENABLE_COURSEWARE_INDEX', False)
[ "def", "indexing_is_enabled", "(", ")", ":", "return", "settings", ".", "FEATURES", ".", "get", "(", "'ENABLE_COURSEWARE_INDEX'", ",", "False", ")" ]
https://github.com/openedx/edx-platform/blob/68dd185a0ab45862a2a61e0f803d7e03d2be71b5/cms/djangoapps/contentstore/courseware_index.py#L48-L52
veusz/veusz
5a1e2af5f24df0eb2a2842be51f2997c4999c7fb
veusz/dataimport/defn_nd.py
python
ImportFileND
( comm, filename, dataset, shape=None, transpose=False, mode='text', csvdelimiter=',', csvtextdelimiter='"', csvlocale='en_US', prefix="", suffix="", encoding='utf_8', linked=False)
return op.outnames
Import n-dimensional data from a file. filename is the name of the file to read dataset is the dataset to read if shape is set, the dataset is reshaped to these dimensions after loading if transpose=True, then rows and columns, etc, are swapped mode is either 'text' or 'csv' csvdelimiter is th...
Import n-dimensional data from a file. filename is the name of the file to read dataset is the dataset to read
[ "Import", "n", "-", "dimensional", "data", "from", "a", "file", ".", "filename", "is", "the", "name", "of", "the", "file", "to", "read", "dataset", "is", "the", "dataset", "to", "read" ]
def ImportFileND( comm, filename, dataset, shape=None, transpose=False, mode='text', csvdelimiter=',', csvtextdelimiter='"', csvlocale='en_US', prefix="", suffix="", encoding='utf_8', linked=False): """Import n-dimensional data from a file. filename is th...
[ "def", "ImportFileND", "(", "comm", ",", "filename", ",", "dataset", ",", "shape", "=", "None", ",", "transpose", "=", "False", ",", "mode", "=", "'text'", ",", "csvdelimiter", "=", "','", ",", "csvtextdelimiter", "=", "'\"'", ",", "csvlocale", "=", "'en...
https://github.com/veusz/veusz/blob/5a1e2af5f24df0eb2a2842be51f2997c4999c7fb/veusz/dataimport/defn_nd.py#L97-L145
JaniceWuo/MovieRecommend
4c86db64ca45598917d304f535413df3bc9fea65
movierecommend/venv1/Lib/site-packages/pip-9.0.1-py3.6.egg/pip/exceptions.py
python
HashError.__str__
(self)
return '%s\n%s' % (self.head, self.body())
[]
def __str__(self): return '%s\n%s' % (self.head, self.body())
[ "def", "__str__", "(", "self", ")", ":", "return", "'%s\\n%s'", "%", "(", "self", ".", "head", ",", "self", ".", "body", "(", ")", ")" ]
https://github.com/JaniceWuo/MovieRecommend/blob/4c86db64ca45598917d304f535413df3bc9fea65/movierecommend/venv1/Lib/site-packages/pip-9.0.1-py3.6.egg/pip/exceptions.py#L110-L111
JaniceWuo/MovieRecommend
4c86db64ca45598917d304f535413df3bc9fea65
movierecommend/venv1/Lib/site-packages/django/contrib/messages/storage/cookie.py
python
MessageEncoder.default
(self, obj)
return super(MessageEncoder, self).default(obj)
[]
def default(self, obj): if isinstance(obj, Message): # Using 0/1 here instead of False/True to produce more compact json is_safedata = 1 if isinstance(obj.message, SafeData) else 0 message = [self.message_key, is_safedata, obj.level, obj.message] if obj.extra_tags...
[ "def", "default", "(", "self", ",", "obj", ")", ":", "if", "isinstance", "(", "obj", ",", "Message", ")", ":", "# Using 0/1 here instead of False/True to produce more compact json", "is_safedata", "=", "1", "if", "isinstance", "(", "obj", ".", "message", ",", "S...
https://github.com/JaniceWuo/MovieRecommend/blob/4c86db64ca45598917d304f535413df3bc9fea65/movierecommend/venv1/Lib/site-packages/django/contrib/messages/storage/cookie.py#L17-L25
zhl2008/awd-platform
0416b31abea29743387b10b3914581fbe8e7da5e
web_flaskbb/lib/python2.7/site-packages/sqlalchemy/sql/elements.py
python
FunctionFilter.type
(self)
return self.func.type
[]
def type(self): return self.func.type
[ "def", "type", "(", "self", ")", ":", "return", "self", ".", "func", ".", "type" ]
https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_flaskbb/lib/python2.7/site-packages/sqlalchemy/sql/elements.py#L3484-L3485
aws-samples/aws-kube-codesuite
ab4e5ce45416b83bffb947ab8d234df5437f4fca
src/kubernetes/client/models/v1_config_map_volume_source.py
python
V1ConfigMapVolumeSource.default_mode
(self, default_mode)
Sets the default_mode of this V1ConfigMapVolumeSource. Optional: mode bits to use on created files by default. Must be a value between 0 and 0777. Defaults to 0644. Directories within the path are not affected by this setting. This might be in conflict with other options that affect the file mode, like fsGroup,...
Sets the default_mode of this V1ConfigMapVolumeSource. Optional: mode bits to use on created files by default. Must be a value between 0 and 0777. Defaults to 0644. Directories within the path are not affected by this setting. This might be in conflict with other options that affect the file mode, like fsGroup,...
[ "Sets", "the", "default_mode", "of", "this", "V1ConfigMapVolumeSource", ".", "Optional", ":", "mode", "bits", "to", "use", "on", "created", "files", "by", "default", ".", "Must", "be", "a", "value", "between", "0", "and", "0777", ".", "Defaults", "to", "06...
def default_mode(self, default_mode): """ Sets the default_mode of this V1ConfigMapVolumeSource. Optional: mode bits to use on created files by default. Must be a value between 0 and 0777. Defaults to 0644. Directories within the path are not affected by this setting. This might be in conflict w...
[ "def", "default_mode", "(", "self", ",", "default_mode", ")", ":", "self", ".", "_default_mode", "=", "default_mode" ]
https://github.com/aws-samples/aws-kube-codesuite/blob/ab4e5ce45416b83bffb947ab8d234df5437f4fca/src/kubernetes/client/models/v1_config_map_volume_source.py#L64-L73
freqtrade/freqtrade
13651fd3be8d5ce8dcd7c94b920bda4e00b75aca
freqtrade/strategy/hyper.py
python
HyperStrategyMixin.detect_all_parameters
(cls)
return params
Detect all parameters and return them as a list
Detect all parameters and return them as a list
[ "Detect", "all", "parameters", "and", "return", "them", "as", "a", "list" ]
def detect_all_parameters(cls) -> Dict: """ Detect all parameters and return them as a list""" params: Dict = { 'buy': list(cls.detect_parameters('buy')), 'sell': list(cls.detect_parameters('sell')), 'protection': list(cls.detect_parameters('protection')), } ...
[ "def", "detect_all_parameters", "(", "cls", ")", "->", "Dict", ":", "params", ":", "Dict", "=", "{", "'buy'", ":", "list", "(", "cls", ".", "detect_parameters", "(", "'buy'", ")", ")", ",", "'sell'", ":", "list", "(", "cls", ".", "detect_parameters", "...
https://github.com/freqtrade/freqtrade/blob/13651fd3be8d5ce8dcd7c94b920bda4e00b75aca/freqtrade/strategy/hyper.py#L346-L357
geopython/pycsw
43a5c92fa819a3a3fdc8a8e3ef075d784dff73fc
pycsw/core/util.py
python
wktenvelope2bbox
(envelope)
return bbox
returns bbox string of WKT ENVELOPE definition
returns bbox string of WKT ENVELOPE definition
[ "returns", "bbox", "string", "of", "WKT", "ENVELOPE", "definition" ]
def wktenvelope2bbox(envelope): """returns bbox string of WKT ENVELOPE definition""" tmparr = [x.strip() for x in envelope.split('(')[1].split(')')[0].split(',')] bbox = '%s,%s,%s,%s' % (tmparr[0], tmparr[3], tmparr[1], tmparr[2]) return bbox
[ "def", "wktenvelope2bbox", "(", "envelope", ")", ":", "tmparr", "=", "[", "x", ".", "strip", "(", ")", "for", "x", "in", "envelope", ".", "split", "(", "'('", ")", "[", "1", "]", ".", "split", "(", "')'", ")", "[", "0", "]", ".", "split", "(", ...
https://github.com/geopython/pycsw/blob/43a5c92fa819a3a3fdc8a8e3ef075d784dff73fc/pycsw/core/util.py#L169-L174
MongoEngine/django-mongoengine
e8a75e8e5860545ecfbadaf1b1285495022bd7cb
django_mongoengine/views/embedded.py
python
EmbeddedFormMixin.get_form
(self, form_class=None)
return form_class(self.object, **self.get_form_kwargs())
Returns an instance of the form to be used in this view.
Returns an instance of the form to be used in this view.
[ "Returns", "an", "instance", "of", "the", "form", "to", "be", "used", "in", "this", "view", "." ]
def get_form(self, form_class=None): """ Returns an instance of the form to be used in this view. """ if form_class is None: form_class = self.get_form_class() return form_class(self.object, **self.get_form_kwargs())
[ "def", "get_form", "(", "self", ",", "form_class", "=", "None", ")", ":", "if", "form_class", "is", "None", ":", "form_class", "=", "self", ".", "get_form_class", "(", ")", "return", "form_class", "(", "self", ".", "object", ",", "*", "*", "self", ".",...
https://github.com/MongoEngine/django-mongoengine/blob/e8a75e8e5860545ecfbadaf1b1285495022bd7cb/django_mongoengine/views/embedded.py#L24-L30
segmentio/analytics-python
40b2bad5c2539d310dc06cf19d20b372b0b1b3eb
analytics/consumer.py
python
Consumer.run
(self)
Runs the consumer.
Runs the consumer.
[ "Runs", "the", "consumer", "." ]
def run(self): """Runs the consumer.""" self.log.debug('consumer is running...') while self.running: self.upload() self.log.debug('consumer exited.')
[ "def", "run", "(", "self", ")", ":", "self", ".", "log", ".", "debug", "(", "'consumer is running...'", ")", "while", "self", ".", "running", ":", "self", ".", "upload", "(", ")", "self", ".", "log", ".", "debug", "(", "'consumer exited.'", ")" ]
https://github.com/segmentio/analytics-python/blob/40b2bad5c2539d310dc06cf19d20b372b0b1b3eb/analytics/consumer.py#L49-L55
iotaledger/iota.py
f596c1ac0d9bcbceda1cf6109cd921943a6599b3
iota/types.py
python
TryteString.decode
(self, errors: str = 'strict', strip_padding: bool = True)
return bytes_.decode('utf-8', errors)
Decodes the TryteString into a higher-level abstraction (usually Unicode characters). :param str errors: How to handle trytes that can't be converted, or bytes that can't be decoded using UTF-8: 'strict' raise an exception (recommended). ...
Decodes the TryteString into a higher-level abstraction (usually Unicode characters).
[ "Decodes", "the", "TryteString", "into", "a", "higher", "-", "level", "abstraction", "(", "usually", "Unicode", "characters", ")", "." ]
def decode(self, errors: str = 'strict', strip_padding: bool = True) -> str: """ Decodes the TryteString into a higher-level abstraction (usually Unicode characters). :param str errors: How to handle trytes that can't be converted, or bytes that can't ...
[ "def", "decode", "(", "self", ",", "errors", ":", "str", "=", "'strict'", ",", "strip_padding", ":", "bool", "=", "True", ")", "->", "str", ":", "trytes", "=", "self", ".", "_trytes", "if", "strip_padding", "and", "(", "trytes", "[", "-", "1", "]", ...
https://github.com/iotaledger/iota.py/blob/f596c1ac0d9bcbceda1cf6109cd921943a6599b3/iota/types.py#L617-L666
zhl2008/awd-platform
0416b31abea29743387b10b3914581fbe8e7da5e
web_flaskbb/Python-2.7.9/Demo/pdist/client.py
python
Client._flush
(self)
[]
def _flush(self): self._wf.flush()
[ "def", "_flush", "(", "self", ")", ":", "self", ".", "_wf", ".", "flush", "(", ")" ]
https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_flaskbb/Python-2.7.9/Demo/pdist/client.py#L125-L126
504ensicsLabs/DAMM
60e7ec7dacd6087cd6320b3615becca9b4cf9b24
volatility/obj.py
python
Object
(theType, offset, vm, name = None, **kwargs)
A function which instantiates the object named in theType (as a string) from the type in profile passing optional args of kwargs.
A function which instantiates the object named in theType (as a string) from the type in profile passing optional args of kwargs.
[ "A", "function", "which", "instantiates", "the", "object", "named", "in", "theType", "(", "as", "a", "string", ")", "from", "the", "type", "in", "profile", "passing", "optional", "args", "of", "kwargs", "." ]
def Object(theType, offset, vm, name = None, **kwargs): """ A function which instantiates the object named in theType (as a string) from the type in profile passing optional args of kwargs. """ name = name or theType offset = int(offset) try: if vm.profile.has_type(theType): ...
[ "def", "Object", "(", "theType", ",", "offset", ",", "vm", ",", "name", "=", "None", ",", "*", "*", "kwargs", ")", ":", "name", "=", "name", "or", "theType", "offset", "=", "int", "(", "offset", ")", "try", ":", "if", "vm", ".", "profile", ".", ...
https://github.com/504ensicsLabs/DAMM/blob/60e7ec7dacd6087cd6320b3615becca9b4cf9b24/volatility/obj.py#L164-L183
macanv/BERT-BiLSTM-CRF-NER
ccf3f093f0ac803e435cb8e8598fdddc2ba1105d
bert_base/train/models.py
python
DataProcessor.get_labels
(self)
Gets the list of labels for this data set.
Gets the list of labels for this data set.
[ "Gets", "the", "list", "of", "labels", "for", "this", "data", "set", "." ]
def get_labels(self): """Gets the list of labels for this data set.""" raise NotImplementedError()
[ "def", "get_labels", "(", "self", ")", ":", "raise", "NotImplementedError", "(", ")" ]
https://github.com/macanv/BERT-BiLSTM-CRF-NER/blob/ccf3f093f0ac803e435cb8e8598fdddc2ba1105d/bert_base/train/models.py#L60-L62
scipy/scipy
e0a749f01e79046642ccfdc419edbf9e7ca141ad
scipy/signal/_signaltools.py
python
_numeric_arrays
(arrays, kinds='buifc')
return True
See if a list of arrays are all numeric. Parameters ---------- arrays : array or list of arrays arrays to check if numeric. kinds : string-like The dtypes of the arrays to be checked. If the dtype.kind of the ndarrays are not in this string the function returns False and ...
See if a list of arrays are all numeric.
[ "See", "if", "a", "list", "of", "arrays", "are", "all", "numeric", "." ]
def _numeric_arrays(arrays, kinds='buifc'): """ See if a list of arrays are all numeric. Parameters ---------- arrays : array or list of arrays arrays to check if numeric. kinds : string-like The dtypes of the arrays to be checked. If the dtype.kind of the ndarrays are n...
[ "def", "_numeric_arrays", "(", "arrays", ",", "kinds", "=", "'buifc'", ")", ":", "if", "type", "(", "arrays", ")", "==", "np", ".", "ndarray", ":", "return", "arrays", ".", "dtype", ".", "kind", "in", "kinds", "for", "array_", "in", "arrays", ":", "i...
https://github.com/scipy/scipy/blob/e0a749f01e79046642ccfdc419edbf9e7ca141ad/scipy/signal/_signaltools.py#L990-L1008
securesystemslab/zippy
ff0e84ac99442c2c55fe1d285332cfd4e185e089
zippy/benchmarks/src/benchmarks/sympy/sympy/polys/polytools.py
python
cancel
(f, *gens, **args)
Cancel common factors in a rational function ``f``. Examples ======== >>> from sympy import cancel, sqrt, Symbol >>> from sympy.abc import x >>> A = Symbol('A', commutative=False) >>> cancel((2*x**2 - 2)/(x**2 - 2*x + 1)) (2*x + 2)/(x - 1) >>> cancel((sqrt(3) + sqrt(15)*A)/(sqrt(2) + ...
Cancel common factors in a rational function ``f``.
[ "Cancel", "common", "factors", "in", "a", "rational", "function", "f", "." ]
def cancel(f, *gens, **args): """ Cancel common factors in a rational function ``f``. Examples ======== >>> from sympy import cancel, sqrt, Symbol >>> from sympy.abc import x >>> A = Symbol('A', commutative=False) >>> cancel((2*x**2 - 2)/(x**2 - 2*x + 1)) (2*x + 2)/(x - 1) >>>...
[ "def", "cancel", "(", "f", ",", "*", "gens", ",", "*", "*", "args", ")", ":", "from", "sympy", ".", "core", ".", "exprtools", "import", "factor_terms", "options", ".", "allowed_flags", "(", "args", ",", "[", "'polys'", "]", ")", "f", "=", "sympify", ...
https://github.com/securesystemslab/zippy/blob/ff0e84ac99442c2c55fe1d285332cfd4e185e089/zippy/benchmarks/src/benchmarks/sympy/sympy/polys/polytools.py#L6196-L6269
sagemath/sage
f9b2db94f675ff16963ccdefba4f1a3393b3fe0d
src/sage/modules/tensor_operations.py
python
TensorOperation.preimage
(self)
return self._index_map.keys()
A choice of pre-image multi-indices. OUTPUT: A list of multi-indices (tuples of integers) whose image is the entire image under the :meth:`index_map`. EXAMPLES:: sage: from sage.modules.tensor_operations import \ ....: VectorCollection, TensorOperation ...
A choice of pre-image multi-indices.
[ "A", "choice", "of", "pre", "-", "image", "multi", "-", "indices", "." ]
def preimage(self): """ A choice of pre-image multi-indices. OUTPUT: A list of multi-indices (tuples of integers) whose image is the entire image under the :meth:`index_map`. EXAMPLES:: sage: from sage.modules.tensor_operations import \ ....: ...
[ "def", "preimage", "(", "self", ")", ":", "return", "self", ".", "_index_map", ".", "keys", "(", ")" ]
https://github.com/sagemath/sage/blob/f9b2db94f675ff16963ccdefba4f1a3393b3fe0d/src/sage/modules/tensor_operations.py#L543-L563
compas-dev/compas
0b33f8786481f710115fb1ae5fe79abc2a9a5175
src/compas/datastructures/halfedge/halfedge.py
python
HalfEdge.face_attribute
(self, key, name, value=None)
Get or set an attribute of a face. Parameters ---------- key : int The face identifier. name : str The name of the attribute. value : obj, optional The value of the attribute. Returns ------- object or None ...
Get or set an attribute of a face.
[ "Get", "or", "set", "an", "attribute", "of", "a", "face", "." ]
def face_attribute(self, key, name, value=None): """Get or set an attribute of a face. Parameters ---------- key : int The face identifier. name : str The name of the attribute. value : obj, optional The value of the attribute. ...
[ "def", "face_attribute", "(", "self", ",", "key", ",", "name", ",", "value", "=", "None", ")", ":", "if", "key", "not", "in", "self", ".", "face", ":", "raise", "KeyError", "(", "key", ")", "if", "value", "is", "not", "None", ":", "if", "key", "n...
https://github.com/compas-dev/compas/blob/0b33f8786481f710115fb1ae5fe79abc2a9a5175/src/compas/datastructures/halfedge/halfedge.py#L1123-L1155
wistbean/learn_python3_spider
73c873f4845f4385f097e5057407d03dd37a117b
stackoverflow/venv/lib/python3.6/site-packages/pip-19.0.3-py3.6.egg/pip/_vendor/cachecontrol/caches/file_cache.py
python
url_to_file_path
(url, filecache)
return filecache._fn(key)
Return the file cache path based on the URL. This does not ensure the file exists!
Return the file cache path based on the URL.
[ "Return", "the", "file", "cache", "path", "based", "on", "the", "URL", "." ]
def url_to_file_path(url, filecache): """Return the file cache path based on the URL. This does not ensure the file exists! """ key = CacheController.cache_url(url) return filecache._fn(key)
[ "def", "url_to_file_path", "(", "url", ",", "filecache", ")", ":", "key", "=", "CacheController", ".", "cache_url", "(", "url", ")", "return", "filecache", ".", "_fn", "(", "key", ")" ]
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/cachecontrol/caches/file_cache.py#L140-L146
stopstalk/stopstalk-deployment
10c3ab44c4ece33ae515f6888c15033db2004bb1
aws_lambda/spoj_aws_lambda_function/lambda_code/requests/packages/urllib3/packages/ordered_dict.py
python
OrderedDict.items
(self)
return [(key, self[key]) for key in self]
od.items() -> list of (key, value) pairs in od
od.items() -> list of (key, value) pairs in od
[ "od", ".", "items", "()", "-", ">", "list", "of", "(", "key", "value", ")", "pairs", "in", "od" ]
def items(self): 'od.items() -> list of (key, value) pairs in od' return [(key, self[key]) for key in self]
[ "def", "items", "(", "self", ")", ":", "return", "[", "(", "key", ",", "self", "[", "key", "]", ")", "for", "key", "in", "self", "]" ]
https://github.com/stopstalk/stopstalk-deployment/blob/10c3ab44c4ece33ae515f6888c15033db2004bb1/aws_lambda/spoj_aws_lambda_function/lambda_code/requests/packages/urllib3/packages/ordered_dict.py#L124-L126
kupferlauncher/kupfer
1c1e9bcbce05a82f503f68f8b3955c20b02639b3
kupfer/plugin/screen.py
python
get_username
()
return info[0]
Return username for current user
Return username for current user
[ "Return", "username", "for", "current", "user" ]
def get_username(): """Return username for current user""" import pwd info = pwd.getpwuid(os.geteuid()) return info[0]
[ "def", "get_username", "(", ")", ":", "import", "pwd", "info", "=", "pwd", ".", "getpwuid", "(", "os", ".", "geteuid", "(", ")", ")", "return", "info", "[", "0", "]" ]
https://github.com/kupferlauncher/kupfer/blob/1c1e9bcbce05a82f503f68f8b3955c20b02639b3/kupfer/plugin/screen.py#L31-L35
Tivix/django-common
407d208121011a8425139e541629554114d96c18
django_common/email_backends.py
python
TestEmailBackend._send
(self, email_message)
return True
A helper method that does the actual sending.
A helper method that does the actual sending.
[ "A", "helper", "method", "that", "does", "the", "actual", "sending", "." ]
def _send(self, email_message): """A helper method that does the actual sending.""" if not email_message.recipients(): return False from_email = email_message.from_email if hasattr(message, 'sanitize_address'): from_email = message.sanitize_address(email_message.f...
[ "def", "_send", "(", "self", ",", "email_message", ")", ":", "if", "not", "email_message", ".", "recipients", "(", ")", ":", "return", "False", "from_email", "=", "email_message", ".", "from_email", "if", "hasattr", "(", "message", ",", "'sanitize_address'", ...
https://github.com/Tivix/django-common/blob/407d208121011a8425139e541629554114d96c18/django_common/email_backends.py#L24-L50
compas-dev/compas
0b33f8786481f710115fb1ae5fe79abc2a9a5175
src/compas/robots/model/robot.py
python
RobotModel._rebuild_tree
(self)
Store tree structure from link and joint lists.
Store tree structure from link and joint lists.
[ "Store", "tree", "structure", "from", "link", "and", "joint", "lists", "." ]
def _rebuild_tree(self): """Store tree structure from link and joint lists.""" self._adjacency = dict() self._links = dict() self._joints = dict() for link in self.links: link.joints = self.find_children_joints(link) link.parent_joint = self.find_parent_j...
[ "def", "_rebuild_tree", "(", "self", ")", ":", "self", ".", "_adjacency", "=", "dict", "(", ")", "self", ".", "_links", "=", "dict", "(", ")", "self", ".", "_joints", "=", "dict", "(", ")", "for", "link", "in", "self", ".", "links", ":", "link", ...
https://github.com/compas-dev/compas/blob/0b33f8786481f710115fb1ae5fe79abc2a9a5175/src/compas/robots/model/robot.py#L123-L144
GNS3/gns3-gui
da8adbaa18ab60e053af2a619efd468f4c8950f3
gns3/graphics_view.py
python
GraphicsView.consoleToNode
(self, node, aux=False)
return True
Start a console application to connect to a node. :param node: Node instance :param aux: auxiliary console mode :returns: False if the console application could not be started
Start a console application to connect to a node.
[ "Start", "a", "console", "application", "to", "connect", "to", "a", "node", "." ]
def consoleToNode(self, node, aux=False): """ Start a console application to connect to a node. :param node: Node instance :param aux: auxiliary console mode :returns: False if the console application could not be started """ if not hasattr(node, "console") or ...
[ "def", "consoleToNode", "(", "self", ",", "node", ",", "aux", "=", "False", ")", ":", "if", "not", "hasattr", "(", "node", ",", "\"console\"", ")", "or", "not", "node", ".", "initialized", "(", ")", "or", "node", ".", "status", "(", ")", "!=", "Nod...
https://github.com/GNS3/gns3-gui/blob/da8adbaa18ab60e053af2a619efd468f4c8950f3/gns3/graphics_view.py#L1077-L1104
aiven/pghoard
1de0d2e33bf087b7ce3b6af556bbf941acfac3a4
pghoard/rohmu/dates.py
python
now
()
return datetime.datetime.now(datetime.timezone.utc)
[]
def now(): return datetime.datetime.now(datetime.timezone.utc)
[ "def", "now", "(", ")", ":", "return", "datetime", ".", "datetime", ".", "now", "(", "datetime", ".", "timezone", ".", "utc", ")" ]
https://github.com/aiven/pghoard/blob/1de0d2e33bf087b7ce3b6af556bbf941acfac3a4/pghoard/rohmu/dates.py#L44-L45
zhl2008/awd-platform
0416b31abea29743387b10b3914581fbe8e7da5e
web_hxb2/lib/python3.5/site-packages/pip/_vendor/colorama/ansi.py
python
clear_screen
(mode=2)
return CSI + str(mode) + 'J'
[]
def clear_screen(mode=2): return CSI + str(mode) + 'J'
[ "def", "clear_screen", "(", "mode", "=", "2", ")", ":", "return", "CSI", "+", "str", "(", "mode", ")", "+", "'J'" ]
https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_hxb2/lib/python3.5/site-packages/pip/_vendor/colorama/ansi.py#L18-L19
materialsproject/pymatgen
8128f3062a334a2edd240e4062b5b9bdd1ae6f58
pymatgen/io/abinit/inputs.py
python
BasicAbinitInput.__init__
( self, structure, pseudos, pseudo_dir=None, comment=None, abi_args=None, abi_kwargs=None, )
Args: structure: Parameters defining the crystalline structure. Accepts |Structure| object file with structure (CIF, netcdf file, ...) or dictionary with ABINIT geo variables. pseudos: Pseudopotentials to be used for the calculation. Accepts: string or list of strings ...
Args: structure: Parameters defining the crystalline structure. Accepts |Structure| object file with structure (CIF, netcdf file, ...) or dictionary with ABINIT geo variables. pseudos: Pseudopotentials to be used for the calculation. Accepts: string or list of strings ...
[ "Args", ":", "structure", ":", "Parameters", "defining", "the", "crystalline", "structure", ".", "Accepts", "|Structure|", "object", "file", "with", "structure", "(", "CIF", "netcdf", "file", "...", ")", "or", "dictionary", "with", "ABINIT", "geo", "variables", ...
def __init__( self, structure, pseudos, pseudo_dir=None, comment=None, abi_args=None, abi_kwargs=None, ): """ Args: structure: Parameters defining the crystalline structure. Accepts |Structure| object file with structure...
[ "def", "__init__", "(", "self", ",", "structure", ",", "pseudos", ",", "pseudo_dir", "=", "None", ",", "comment", "=", "None", ",", "abi_args", "=", "None", ",", "abi_kwargs", "=", "None", ",", ")", ":", "# Internal dict with variables. we use an ordered dict so...
https://github.com/materialsproject/pymatgen/blob/8128f3062a334a2edd240e4062b5b9bdd1ae6f58/pymatgen/io/abinit/inputs.py#L720-L770
open-mmlab/mmclassification
5232965b17b6c050f9b328b3740c631ed4034624
mmcls/models/backbones/res2net.py
python
Bottle2neck.__init__
(self, in_channels, out_channels, scales=4, base_width=26, base_channels=64, stage_type='normal', **kwargs)
Bottle2neck block for Res2Net.
Bottle2neck block for Res2Net.
[ "Bottle2neck", "block", "for", "Res2Net", "." ]
def __init__(self, in_channels, out_channels, scales=4, base_width=26, base_channels=64, stage_type='normal', **kwargs): """Bottle2neck block for Res2Net.""" super(Bottle2neck, self).__...
[ "def", "__init__", "(", "self", ",", "in_channels", ",", "out_channels", ",", "scales", "=", "4", ",", "base_width", "=", "26", ",", "base_channels", "=", "64", ",", "stage_type", "=", "'normal'", ",", "*", "*", "kwargs", ")", ":", "super", "(", "Bottl...
https://github.com/open-mmlab/mmclassification/blob/5232965b17b6c050f9b328b3740c631ed4034624/mmcls/models/backbones/res2net.py#L18-L79
Infinidat/infi.clickhouse_orm
232a8d29ad237c833d3c851e1d61989ff55d7bd8
src/infi/clickhouse_orm/query.py
python
Q.is_empty
(self)
return not bool(self._conds or self._children)
Checks if there are any conditions in Q object Returns: Boolean
Checks if there are any conditions in Q object Returns: Boolean
[ "Checks", "if", "there", "are", "any", "conditions", "in", "Q", "object", "Returns", ":", "Boolean" ]
def is_empty(self): """ Checks if there are any conditions in Q object Returns: Boolean """ return not bool(self._conds or self._children)
[ "def", "is_empty", "(", "self", ")", ":", "return", "not", "bool", "(", "self", ".", "_conds", "or", "self", ".", "_children", ")" ]
https://github.com/Infinidat/infi.clickhouse_orm/blob/232a8d29ad237c833d3c851e1d61989ff55d7bd8/src/infi/clickhouse_orm/query.py#L203-L208
sagemath/sage
f9b2db94f675ff16963ccdefba4f1a3393b3fe0d
src/sage/combinat/cluster_algebra_quiver/quiver.py
python
ClusterQuiver.reorient
(self, data)
Reorient ``self`` with respect to the given total order, or with respect to an iterator of edges in ``self`` to be reverted. .. WARNING:: This operation might change the mutation type of ``self``. INPUT: - ``data`` -- an iterator defining a total order on ...
Reorient ``self`` with respect to the given total order, or with respect to an iterator of edges in ``self`` to be reverted.
[ "Reorient", "self", "with", "respect", "to", "the", "given", "total", "order", "or", "with", "respect", "to", "an", "iterator", "of", "edges", "in", "self", "to", "be", "reverted", "." ]
def reorient(self, data): """ Reorient ``self`` with respect to the given total order, or with respect to an iterator of edges in ``self`` to be reverted. .. WARNING:: This operation might change the mutation type of ``self``. INPUT: - ``data`` -- ...
[ "def", "reorient", "(", "self", ",", "data", ")", ":", "if", "not", "data", ":", "raise", "ValueError", "(", "'empty input'", ")", "first", "=", "data", "[", "0", "]", "if", "set", "(", "data", ")", "==", "set", "(", "range", "(", "self", ".", "_...
https://github.com/sagemath/sage/blob/f9b2db94f675ff16963ccdefba4f1a3393b3fe0d/src/sage/combinat/cluster_algebra_quiver/quiver.py#L1531-L1602
rytilahti/python-miio
b6e53dd16fac77915426e7592e2528b78ef65190
miio/integrations/vacuum/roborock/vacuum.py
python
RoborockVacuum.consumable_reset
(self, consumable: Consumable)
return self.send("reset_consumable", [consumable.value])
Reset consumable information.
Reset consumable information.
[ "Reset", "consumable", "information", "." ]
def consumable_reset(self, consumable: Consumable): """Reset consumable information.""" return self.send("reset_consumable", [consumable.value])
[ "def", "consumable_reset", "(", "self", ",", "consumable", ":", "Consumable", ")", ":", "return", "self", ".", "send", "(", "\"reset_consumable\"", ",", "[", "consumable", ".", "value", "]", ")" ]
https://github.com/rytilahti/python-miio/blob/b6e53dd16fac77915426e7592e2528b78ef65190/miio/integrations/vacuum/roborock/vacuum.py#L389-L391
ohmyadd/wetland
76d296ec66dc438606e2455a848619d446f4a4b7
paramiko/message.py
python
Message.get_so_far
(self)
return self.packet.read(position)
Returns the `str` bytes of this message that have been parsed and returned. The string passed into a message's constructor can be regenerated by concatenating ``get_so_far`` and `get_remainder`.
Returns the `str` bytes of this message that have been parsed and returned. The string passed into a message's constructor can be regenerated by concatenating ``get_so_far`` and `get_remainder`.
[ "Returns", "the", "str", "bytes", "of", "this", "message", "that", "have", "been", "parsed", "and", "returned", ".", "The", "string", "passed", "into", "a", "message", "s", "constructor", "can", "be", "regenerated", "by", "concatenating", "get_so_far", "and", ...
def get_so_far(self): """ Returns the `str` bytes of this message that have been parsed and returned. The string passed into a message's constructor can be regenerated by concatenating ``get_so_far`` and `get_remainder`. """ position = self.packet.tell() self.rewi...
[ "def", "get_so_far", "(", "self", ")", ":", "position", "=", "self", ".", "packet", ".", "tell", "(", ")", "self", ".", "rewind", "(", ")", "return", "self", ".", "packet", ".", "read", "(", "position", ")" ]
https://github.com/ohmyadd/wetland/blob/76d296ec66dc438606e2455a848619d446f4a4b7/paramiko/message.py#L91-L99
hiroharu-kato/neural_renderer
85aa98d418bb18877baec4e987e5743c21ab5e99
neural_renderer/renderer.py
python
Renderer.render_depth
(self, vertices, faces)
return images
[]
def render_depth(self, vertices, faces): # fill back if self.fill_back: faces = cf.concat((faces, faces[:, :, ::-1]), axis=1).data # viewpoint transformation if self.camera_mode == 'look_at': vertices = neural_renderer.look_at(vertices, self.eye) elif sel...
[ "def", "render_depth", "(", "self", ",", "vertices", ",", "faces", ")", ":", "# fill back", "if", "self", ".", "fill_back", ":", "faces", "=", "cf", ".", "concat", "(", "(", "faces", ",", "faces", "[", ":", ",", ":", ",", ":", ":", "-", "1", "]",...
https://github.com/hiroharu-kato/neural_renderer/blob/85aa98d418bb18877baec4e987e5743c21ab5e99/neural_renderer/renderer.py#L55-L73
zhl2008/awd-platform
0416b31abea29743387b10b3914581fbe8e7da5e
web_hxb2/lib/python3.5/site-packages/treebeard/templatetags/admin_tree_list.py
python
_line
(context, node, request)
return output + format_html( '<a href="{}/" {}>{}</a>', mark_safe(node.pk), mark_safe(raw_id_fields), mark_safe(str(node)))
[]
def _line(context, node, request): if TO_FIELD_VAR in request.GET and request.GET[TO_FIELD_VAR] == 'id': raw_id_fields = format_html(""" onclick="opener.dismissRelatedLookupPopup(window, '{}'); return false;" """, mark_safe(node.pk)) else: raw_id_fields = '' output = '' i...
[ "def", "_line", "(", "context", ",", "node", ",", "request", ")", ":", "if", "TO_FIELD_VAR", "in", "request", ".", "GET", "and", "request", ".", "GET", "[", "TO_FIELD_VAR", "]", "==", "'id'", ":", "raw_id_fields", "=", "format_html", "(", "\"\"\"\n ...
https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_hxb2/lib/python3.5/site-packages/treebeard/templatetags/admin_tree_list.py#L15-L27
biopython/biopython
2dd97e71762af7b046d7f7f8a4f1e38db6b06c86
Bio/HMM/Trainer.py
python
AbstractTrainer.log_likelihood
(self, probabilities)
return total_likelihood
Calculate the log likelihood of the training seqs. Arguments: - probabilities -- A list of the probabilities of each training sequence under the current parameters, calculated using the forward algorithm.
Calculate the log likelihood of the training seqs.
[ "Calculate", "the", "log", "likelihood", "of", "the", "training", "seqs", "." ]
def log_likelihood(self, probabilities): """Calculate the log likelihood of the training seqs. Arguments: - probabilities -- A list of the probabilities of each training sequence under the current parameters, calculated using the forward algorithm. """ to...
[ "def", "log_likelihood", "(", "self", ",", "probabilities", ")", ":", "total_likelihood", "=", "0", "for", "probability", "in", "probabilities", ":", "total_likelihood", "+=", "math", ".", "log", "(", "probability", ")", "return", "total_likelihood" ]
https://github.com/biopython/biopython/blob/2dd97e71762af7b046d7f7f8a4f1e38db6b06c86/Bio/HMM/Trainer.py#L56-L69
bikalims/bika.lims
35e4bbdb5a3912cae0b5eb13e51097c8b0486349
bika/lims/browser/worksheet/views/referencesamples.py
python
ReferenceSamplesView.__call__
(self)
return super(ReferenceSamplesView, self).contents_table()
[]
def __call__(self): self.service_uids = self.request.get('service_uids', '').split(",") self.control_type = self.request.get('control_type', '') if not self.control_type: return t(_("No control type specified")) return super(ReferenceSamplesView, self).contents_table()
[ "def", "__call__", "(", "self", ")", ":", "self", ".", "service_uids", "=", "self", ".", "request", ".", "get", "(", "'service_uids'", ",", "''", ")", ".", "split", "(", "\",\"", ")", "self", ".", "control_type", "=", "self", ".", "request", ".", "ge...
https://github.com/bikalims/bika.lims/blob/35e4bbdb5a3912cae0b5eb13e51097c8b0486349/bika/lims/browser/worksheet/views/referencesamples.py#L54-L59
rwth-i6/returnn
f2d718a197a280b0d5f0fd91a7fcb8658560dddb
returnn/config.py
python
Config.is_true
(self, key, default=False)
return self.bool(key, default=default)
:param str key: :param bool default: :return: bool(value) if it is set or default :rtype: bool
:param str key: :param bool default: :return: bool(value) if it is set or default :rtype: bool
[ ":", "param", "str", "key", ":", ":", "param", "bool", "default", ":", ":", "return", ":", "bool", "(", "value", ")", "if", "it", "is", "set", "or", "default", ":", "rtype", ":", "bool" ]
def is_true(self, key, default=False): """ :param str key: :param bool default: :return: bool(value) if it is set or default :rtype: bool """ if self.is_typed(key): return bool(self.typed_dict[key]) return self.bool(key, default=default)
[ "def", "is_true", "(", "self", ",", "key", ",", "default", "=", "False", ")", ":", "if", "self", ".", "is_typed", "(", "key", ")", ":", "return", "bool", "(", "self", ".", "typed_dict", "[", "key", "]", ")", "return", "self", ".", "bool", "(", "k...
https://github.com/rwth-i6/returnn/blob/f2d718a197a280b0d5f0fd91a7fcb8658560dddb/returnn/config.py#L231-L240
pyparallel/pyparallel
11e8c6072d48c8f13641925d17b147bf36ee0ba3
Lib/decimal.py
python
Decimal.next_toward
(self, other, context=None)
return ans
Returns the number closest to self, in the direction towards other. The result is the closest representable number to self (excluding self) that is in the direction towards other, unless both have the same value. If the two operands are numerically equal, then the result is a copy of s...
Returns the number closest to self, in the direction towards other.
[ "Returns", "the", "number", "closest", "to", "self", "in", "the", "direction", "towards", "other", "." ]
def next_toward(self, other, context=None): """Returns the number closest to self, in the direction towards other. The result is the closest representable number to self (excluding self) that is in the direction towards other, unless both have the same value. If the two operands are ...
[ "def", "next_toward", "(", "self", ",", "other", ",", "context", "=", "None", ")", ":", "other", "=", "_convert_other", "(", "other", ",", "raiseit", "=", "True", ")", "if", "context", "is", "None", ":", "context", "=", "getcontext", "(", ")", "ans", ...
https://github.com/pyparallel/pyparallel/blob/11e8c6072d48c8f13641925d17b147bf36ee0ba3/Lib/decimal.py#L3547-L3591
openstack/zaqar
1726ac41b5369cc30e99fd652f29f5300b95d958
zaqar/storage/utils.py
python
load_storage_impl
(uri, control_mode=False, default_store=None)
Loads a storage driver implementation and returns it. :param uri: The connection uri to parse and load a driver for. :param control_mode: (Default False). Determines which driver type to load; if False, the data driver is loaded. If True, the control driver is loaded. :param default_store: ...
Loads a storage driver implementation and returns it.
[ "Loads", "a", "storage", "driver", "implementation", "and", "returns", "it", "." ]
def load_storage_impl(uri, control_mode=False, default_store=None): """Loads a storage driver implementation and returns it. :param uri: The connection uri to parse and load a driver for. :param control_mode: (Default False). Determines which driver type to load; if False, the data driver is ...
[ "def", "load_storage_impl", "(", "uri", ",", "control_mode", "=", "False", ",", "default_store", "=", "None", ")", ":", "mode", "=", "'control'", "if", "control_mode", "else", "'data'", "driver_type", "=", "'zaqar.{0}.storage'", ".", "format", "(", "mode", ")"...
https://github.com/openstack/zaqar/blob/1726ac41b5369cc30e99fd652f29f5300b95d958/zaqar/storage/utils.py#L76-L99
microsoft/ProphetNet
32f806bf16598c59990fc932da3dbb3746716f7c
ProphetNet_En/cnndm/eval/bs_pyrouge.py
python
Rouge155.__set_rouge_dir
(self, home_dir=None)
Verfify presence of ROUGE-1.5.5.pl and data folder, and set those paths.
Verfify presence of ROUGE-1.5.5.pl and data folder, and set those paths.
[ "Verfify", "presence", "of", "ROUGE", "-", "1", ".", "5", ".", "5", ".", "pl", "and", "data", "folder", "and", "set", "those", "paths", "." ]
def __set_rouge_dir(self, home_dir=None): """ Verfify presence of ROUGE-1.5.5.pl and data folder, and set those paths. """ if not home_dir: self._home_dir = self.__get_rouge_home_dir_from_settings() else: self._home_dir = home_dir self...
[ "def", "__set_rouge_dir", "(", "self", ",", "home_dir", "=", "None", ")", ":", "if", "not", "home_dir", ":", "self", ".", "_home_dir", "=", "self", ".", "__get_rouge_home_dir_from_settings", "(", ")", "else", ":", "self", ".", "_home_dir", "=", "home_dir", ...
https://github.com/microsoft/ProphetNet/blob/32f806bf16598c59990fc932da3dbb3746716f7c/ProphetNet_En/cnndm/eval/bs_pyrouge.py#L432-L449
scrapinghub/splash
802d8391984bae049ef95a3fe1a74feaee95a233
splash/lua.py
python
parse_error_message
(error_text)
return { 'source': m.group(1), 'line_number': int(m.group(2)), 'error': m.group(3) }
r""" Split Lua error message into 'source', 'line_number' and 'error'. If error message can't be parsed, an empty dict is returned. This function is not reliable because error text is ambiguous. Parse runtime error messages:: >>> info = parse_error_message('[string "function main(splash)\r......
r""" Split Lua error message into 'source', 'line_number' and 'error'. If error message can't be parsed, an empty dict is returned.
[ "r", "Split", "Lua", "error", "message", "into", "source", "line_number", "and", "error", ".", "If", "error", "message", "can", "t", "be", "parsed", "an", "empty", "dict", "is", "returned", "." ]
def parse_error_message(error_text): r""" Split Lua error message into 'source', 'line_number' and 'error'. If error message can't be parsed, an empty dict is returned. This function is not reliable because error text is ambiguous. Parse runtime error messages:: >>> info = parse_error_mes...
[ "def", "parse_error_message", "(", "error_text", ")", ":", "error_text", "=", "to_unicode", "(", "error_text", ")", "m", "=", "_LUA_ERROR_RE", ".", "match", "(", "error_text", ")", "if", "not", "m", ":", "m", "=", "_SYNTAX_ERROR_RE", ".", "match", "(", "er...
https://github.com/scrapinghub/splash/blob/802d8391984bae049ef95a3fe1a74feaee95a233/splash/lua.py#L272-L313
Eniac-Xie/faster-rcnn-resnet
aba743e8404b47fc9bcccba4920846d1068c7e3c
lib/rpn/generate_anchors.py
python
generate_anchors
(base_size=16, ratios=[0.5, 1, 2], scales=2**np.arange(3, 6))
return anchors
Generate anchor (reference) windows by enumerating aspect ratios X scales wrt a reference (0, 0, 15, 15) window.
Generate anchor (reference) windows by enumerating aspect ratios X scales wrt a reference (0, 0, 15, 15) window.
[ "Generate", "anchor", "(", "reference", ")", "windows", "by", "enumerating", "aspect", "ratios", "X", "scales", "wrt", "a", "reference", "(", "0", "0", "15", "15", ")", "window", "." ]
def generate_anchors(base_size=16, ratios=[0.5, 1, 2], scales=2**np.arange(3, 6)): """ Generate anchor (reference) windows by enumerating aspect ratios X scales wrt a reference (0, 0, 15, 15) window. """ base_anchor = np.array([1, 1, base_size, base_size]) - 1 ratio_anchors...
[ "def", "generate_anchors", "(", "base_size", "=", "16", ",", "ratios", "=", "[", "0.5", ",", "1", ",", "2", "]", ",", "scales", "=", "2", "**", "np", ".", "arange", "(", "3", ",", "6", ")", ")", ":", "base_anchor", "=", "np", ".", "array", "(",...
https://github.com/Eniac-Xie/faster-rcnn-resnet/blob/aba743e8404b47fc9bcccba4920846d1068c7e3c/lib/rpn/generate_anchors.py#L37-L48
ihaveamac/ninfs
dee583ba3205c4e050e0b193a85a4177eb334159
ninfs/mount/romfs.py
python
RomFSMount.__del__
(self, *args)
[]
def __del__(self, *args): try: self.reader.close() except AttributeError: pass
[ "def", "__del__", "(", "self", ",", "*", "args", ")", ":", "try", ":", "self", ".", "reader", ".", "close", "(", ")", "except", "AttributeError", ":", "pass" ]
https://github.com/ihaveamac/ninfs/blob/dee583ba3205c4e050e0b193a85a4177eb334159/ninfs/mount/romfs.py#L33-L37
privacyidea/privacyidea
9490c12ddbf77a34ac935b082d09eb583dfafa2c
privacyidea/lib/auditmodules/containeraudit.py
python
Audit.add_policy
(self, policyname)
Call the add_policy method for all writeable modules
Call the add_policy method for all writeable modules
[ "Call", "the", "add_policy", "method", "for", "all", "writeable", "modules" ]
def add_policy(self, policyname): """ Call the add_policy method for all writeable modules """ for module in self.write_modules: module.add_policy(policyname)
[ "def", "add_policy", "(", "self", ",", "policyname", ")", ":", "for", "module", "in", "self", ".", "write_modules", ":", "module", ".", "add_policy", "(", "policyname", ")" ]
https://github.com/privacyidea/privacyidea/blob/9490c12ddbf77a34ac935b082d09eb583dfafa2c/privacyidea/lib/auditmodules/containeraudit.py#L79-L84
PyCQA/flake8
bff62cdf860a70d05ce84e2b5ee494e7f3fd31af
src/flake8/processor.py
python
FileProcessor.build_logical_line_tokens
(self)
return comments, logical, mapping
Build the mapping, comments, and logical line lists.
Build the mapping, comments, and logical line lists.
[ "Build", "the", "mapping", "comments", "and", "logical", "line", "lists", "." ]
def build_logical_line_tokens(self) -> _Logical: """Build the mapping, comments, and logical line lists.""" logical = [] comments = [] mapping: _LogicalMapping = [] length = 0 previous_row = previous_column = None for token_type, text, start, end, line in self.tok...
[ "def", "build_logical_line_tokens", "(", "self", ")", "->", "_Logical", ":", "logical", "=", "[", "]", "comments", "=", "[", "]", "mapping", ":", "_LogicalMapping", "=", "[", "]", "length", "=", "0", "previous_row", "=", "previous_column", "=", "None", "fo...
https://github.com/PyCQA/flake8/blob/bff62cdf860a70d05ce84e2b5ee494e7f3fd31af/src/flake8/processor.py#L182-L215
xcmyz/FastSpeech
d8bd89790100542fda836b8f3f9342b64ad67e39
audio/stft.py
python
STFT.__init__
(self, filter_length=800, hop_length=200, win_length=800, window='hann')
[]
def __init__(self, filter_length=800, hop_length=200, win_length=800, window='hann'): super(STFT, self).__init__() self.filter_length = filter_length self.hop_length = hop_length self.win_length = win_length self.window = window self.forward_transform = N...
[ "def", "__init__", "(", "self", ",", "filter_length", "=", "800", ",", "hop_length", "=", "200", ",", "win_length", "=", "800", ",", "window", "=", "'hann'", ")", ":", "super", "(", "STFT", ",", "self", ")", ".", "__init__", "(", ")", "self", ".", ...
https://github.com/xcmyz/FastSpeech/blob/d8bd89790100542fda836b8f3f9342b64ad67e39/audio/stft.py#L20-L51
openhatch/oh-mainline
ce29352a034e1223141dcc2f317030bbc3359a51
vendor/packages/pytz/pytz/tzinfo.py
python
DstTzInfo.tzname
(self, dt, is_dst=None)
See datetime.tzinfo.tzname The is_dst parameter may be used to remove ambiguity during DST transitions. >>> from pytz import timezone >>> tz = timezone('America/St_Johns') >>> normal = datetime(2009, 9, 1) >>> tz.tzname(normal) 'NDT' >>> tz.tzname(norm...
See datetime.tzinfo.tzname
[ "See", "datetime", ".", "tzinfo", ".", "tzname" ]
def tzname(self, dt, is_dst=None): '''See datetime.tzinfo.tzname The is_dst parameter may be used to remove ambiguity during DST transitions. >>> from pytz import timezone >>> tz = timezone('America/St_Johns') >>> normal = datetime(2009, 9, 1) >>> tz.tzname(no...
[ "def", "tzname", "(", "self", ",", "dt", ",", "is_dst", "=", "None", ")", ":", "if", "dt", "is", "None", ":", "return", "self", ".", "zone", "elif", "dt", ".", "tzinfo", "is", "not", "self", ":", "dt", "=", "self", ".", "localize", "(", "dt", "...
https://github.com/openhatch/oh-mainline/blob/ce29352a034e1223141dcc2f317030bbc3359a51/vendor/packages/pytz/pytz/tzinfo.py#L449-L485
pret/pokemon-reverse-engineering-tools
5e0715f2579adcfeb683448c9a7826cfd3afa57d
pokemontools/configuration.py
python
Config.__init__
(self, **kwargs)
Store all parameters.
Store all parameters.
[ "Store", "all", "parameters", "." ]
def __init__(self, **kwargs): """ Store all parameters. """ self._config = {} for (key, value) in kwargs.items(): if key not in self.__dict__: self._config[key] = value else: raise ConfigException( "Can'...
[ "def", "__init__", "(", "self", ",", "*", "*", "kwargs", ")", ":", "self", ".", "_config", "=", "{", "}", "for", "(", "key", ",", "value", ")", "in", "kwargs", ".", "items", "(", ")", ":", "if", "key", "not", "in", "self", ".", "__dict__", ":",...
https://github.com/pret/pokemon-reverse-engineering-tools/blob/5e0715f2579adcfeb683448c9a7826cfd3afa57d/pokemontools/configuration.py#L19-L43
tomplus/kubernetes_asyncio
f028cc793e3a2c519be6a52a49fb77ff0b014c9b
kubernetes_asyncio/client/models/v2beta1_resource_metric_status.py
python
V2beta1ResourceMetricStatus.to_str
(self)
return pprint.pformat(self.to_dict())
Returns the string representation of the model
Returns the string representation of the model
[ "Returns", "the", "string", "representation", "of", "the", "model" ]
def to_str(self): """Returns the string representation of the model""" return pprint.pformat(self.to_dict())
[ "def", "to_str", "(", "self", ")", ":", "return", "pprint", ".", "pformat", "(", "self", ".", "to_dict", "(", ")", ")" ]
https://github.com/tomplus/kubernetes_asyncio/blob/f028cc793e3a2c519be6a52a49fb77ff0b014c9b/kubernetes_asyncio/client/models/v2beta1_resource_metric_status.py#L160-L162
omz/PythonistaAppTemplate
f560f93f8876d82a21d108977f90583df08d55af
PythonistaAppTemplate/PythonistaKit.framework/pylib_ext/mpmath/calculus/extrapolation.py
python
sumem
(ctx, f, interval, tol=None, reject=10, integral=None, adiffs=None, bdiffs=None, verbose=False, error=False, _fast_abort=False)
r""" Uses the Euler-Maclaurin formula to compute an approximation accurate to within ``tol`` (which defaults to the present epsilon) of the sum .. math :: S = \sum_{k=a}^b f(k) where `(a,b)` are given by ``interval`` and `a` or `b` may be infinite. The approximation is .. math :: ...
r""" Uses the Euler-Maclaurin formula to compute an approximation accurate to within ``tol`` (which defaults to the present epsilon) of the sum
[ "r", "Uses", "the", "Euler", "-", "Maclaurin", "formula", "to", "compute", "an", "approximation", "accurate", "to", "within", "tol", "(", "which", "defaults", "to", "the", "present", "epsilon", ")", "of", "the", "sum" ]
def sumem(ctx, f, interval, tol=None, reject=10, integral=None, adiffs=None, bdiffs=None, verbose=False, error=False, _fast_abort=False): r""" Uses the Euler-Maclaurin formula to compute an approximation accurate to within ``tol`` (which defaults to the present epsilon) of the sum .. math :: ...
[ "def", "sumem", "(", "ctx", ",", "f", ",", "interval", ",", "tol", "=", "None", ",", "reject", "=", "10", ",", "integral", "=", "None", ",", "adiffs", "=", "None", ",", "bdiffs", "=", "None", ",", "verbose", "=", "False", ",", "error", "=", "Fals...
https://github.com/omz/PythonistaAppTemplate/blob/f560f93f8876d82a21d108977f90583df08d55af/PythonistaAppTemplate/PythonistaKit.framework/pylib_ext/mpmath/calculus/extrapolation.py#L967-L1086
lmjohns3/theanets
79db9f878ef2071f2f576a1cf5d43a752a55894a
theanets/losses.py
python
Loss.__call__
(self, outputs)
Construct the computation graph for this loss function. Parameters ---------- outputs : dict of Theano expressions A dictionary mapping network output names to Theano expressions representing the outputs of a computation graph. Returns ------- lo...
Construct the computation graph for this loss function.
[ "Construct", "the", "computation", "graph", "for", "this", "loss", "function", "." ]
def __call__(self, outputs): '''Construct the computation graph for this loss function. Parameters ---------- outputs : dict of Theano expressions A dictionary mapping network output names to Theano expressions representing the outputs of a computation graph. ...
[ "def", "__call__", "(", "self", ",", "outputs", ")", ":", "raise", "NotImplementedError" ]
https://github.com/lmjohns3/theanets/blob/79db9f878ef2071f2f576a1cf5d43a752a55894a/theanets/losses.py#L66-L80
caiiiac/Machine-Learning-with-Python
1a26c4467da41ca4ebc3d5bd789ea942ef79422f
MachineLearning/venv/lib/python3.5/site-packages/pip/vcs/__init__.py
python
VersionControl.controls_location
(cls, location)
return os.path.exists(path)
Check if a location is controlled by the vcs. It is meant to be overridden to implement smarter detection mechanisms for specific vcs.
Check if a location is controlled by the vcs. It is meant to be overridden to implement smarter detection mechanisms for specific vcs.
[ "Check", "if", "a", "location", "is", "controlled", "by", "the", "vcs", ".", "It", "is", "meant", "to", "be", "overridden", "to", "implement", "smarter", "detection", "mechanisms", "for", "specific", "vcs", "." ]
def controls_location(cls, location): """ Check if a location is controlled by the vcs. It is meant to be overridden to implement smarter detection mechanisms for specific vcs. """ logger.debug('Checking in %s for %s (%s)...', location, cls.dirname, c...
[ "def", "controls_location", "(", "cls", ",", "location", ")", ":", "logger", ".", "debug", "(", "'Checking in %s for %s (%s)...'", ",", "location", ",", "cls", ".", "dirname", ",", "cls", ".", "name", ")", "path", "=", "os", ".", "path", ".", "join", "("...
https://github.com/caiiiac/Machine-Learning-with-Python/blob/1a26c4467da41ca4ebc3d5bd789ea942ef79422f/MachineLearning/venv/lib/python3.5/site-packages/pip/vcs/__init__.py#L335-L344
jython/frozen-mirror
b8d7aa4cee50c0c0fe2f4b235dd62922dd0f3f99
lib-python/2.7/idlelib/TreeWidget.py
python
TreeItem.IsEditable
(self)
Return whether the item's text may be edited.
Return whether the item's text may be edited.
[ "Return", "whether", "the", "item", "s", "text", "may", "be", "edited", "." ]
def IsEditable(self): """Return whether the item's text may be edited."""
[ "def", "IsEditable", "(", "self", ")", ":" ]
https://github.com/jython/frozen-mirror/blob/b8d7aa4cee50c0c0fe2f4b235dd62922dd0f3f99/lib-python/2.7/idlelib/TreeWidget.py#L343-L344
dropbox/dropbox-sdk-python
015437429be224732990041164a21a0501235db1
dropbox/team_log.py
python
EventType.is_governance_policy_add_folder_failed
(self)
return self._tag == 'governance_policy_add_folder_failed'
Check if the union tag is ``governance_policy_add_folder_failed``. :rtype: bool
Check if the union tag is ``governance_policy_add_folder_failed``.
[ "Check", "if", "the", "union", "tag", "is", "governance_policy_add_folder_failed", "." ]
def is_governance_policy_add_folder_failed(self): """ Check if the union tag is ``governance_policy_add_folder_failed``. :rtype: bool """ return self._tag == 'governance_policy_add_folder_failed'
[ "def", "is_governance_policy_add_folder_failed", "(", "self", ")", ":", "return", "self", ".", "_tag", "==", "'governance_policy_add_folder_failed'" ]
https://github.com/dropbox/dropbox-sdk-python/blob/015437429be224732990041164a21a0501235db1/dropbox/team_log.py#L28553-L28559
tdryer/hangups
f0b37be1d46e71b30337227d7c46192cc726dcb4
hangups/conversation_event.py
python
ChatMessageEvent.attachments
(self)
return attachments
List of attachments in the message (:class:`list`).
List of attachments in the message (:class:`list`).
[ "List", "of", "attachments", "in", "the", "message", "(", ":", "class", ":", "list", ")", "." ]
def attachments(self): """List of attachments in the message (:class:`list`).""" raw_attachments = self._event.chat_message.message_content.attachment if raw_attachments is None: raw_attachments = [] attachments = [] for attachment in raw_attachments: for ...
[ "def", "attachments", "(", "self", ")", ":", "raw_attachments", "=", "self", ".", "_event", ".", "chat_message", ".", "message_content", ".", "attachment", "if", "raw_attachments", "is", "None", ":", "raw_attachments", "=", "[", "]", "attachments", "=", "[", ...
https://github.com/tdryer/hangups/blob/f0b37be1d46e71b30337227d7c46192cc726dcb4/hangups/conversation_event.py#L174-L196
kubernetes-client/python
47b9da9de2d02b2b7a34fbe05afb44afd130d73a
kubernetes/client/models/v1beta1_pod_security_policy_spec.py
python
V1beta1PodSecurityPolicySpec.se_linux
(self)
return self._se_linux
Gets the se_linux of this V1beta1PodSecurityPolicySpec. # noqa: E501 :return: The se_linux of this V1beta1PodSecurityPolicySpec. # noqa: E501 :rtype: V1beta1SELinuxStrategyOptions
Gets the se_linux of this V1beta1PodSecurityPolicySpec. # noqa: E501
[ "Gets", "the", "se_linux", "of", "this", "V1beta1PodSecurityPolicySpec", ".", "#", "noqa", ":", "E501" ]
def se_linux(self): """Gets the se_linux of this V1beta1PodSecurityPolicySpec. # noqa: E501 :return: The se_linux of this V1beta1PodSecurityPolicySpec. # noqa: E501 :rtype: V1beta1SELinuxStrategyOptions """ return self._se_linux
[ "def", "se_linux", "(", "self", ")", ":", "return", "self", ".", "_se_linux" ]
https://github.com/kubernetes-client/python/blob/47b9da9de2d02b2b7a34fbe05afb44afd130d73a/kubernetes/client/models/v1beta1_pod_security_policy_spec.py#L646-L653
jgagneastro/coffeegrindsize
22661ebd21831dba4cf32bfc6ba59fe3d49f879c
App/dist/coffeegrindsize.app/Contents/Resources/lib/python3.7/scipy/signal/ltisys.py
python
lti.impulse
(self, X0=None, T=None, N=None)
return impulse(self, X0=X0, T=T, N=N)
Return the impulse response of a continuous-time system. See `impulse` for details.
Return the impulse response of a continuous-time system. See `impulse` for details.
[ "Return", "the", "impulse", "response", "of", "a", "continuous", "-", "time", "system", ".", "See", "impulse", "for", "details", "." ]
def impulse(self, X0=None, T=None, N=None): """ Return the impulse response of a continuous-time system. See `impulse` for details. """ return impulse(self, X0=X0, T=T, N=N)
[ "def", "impulse", "(", "self", ",", "X0", "=", "None", ",", "T", "=", "None", ",", "N", "=", "None", ")", ":", "return", "impulse", "(", "self", ",", "X0", "=", "X0", ",", "T", "=", "T", ",", "N", "=", "N", ")" ]
https://github.com/jgagneastro/coffeegrindsize/blob/22661ebd21831dba4cf32bfc6ba59fe3d49f879c/App/dist/coffeegrindsize.app/Contents/Resources/lib/python3.7/scipy/signal/ltisys.py#L231-L236
elastic/elasticsearch-py
6ef1adfa3c840a84afda7369cd8e43ae7dc45cdb
elasticsearch/_async/client/rollup.py
python
RollupClient.stop_job
( self, *, id: Any, error_trace: Optional[bool] = None, filter_path: Optional[Union[List[str], str]] = None, human: Optional[bool] = None, pretty: Optional[bool] = None, timeout: Optional[Any] = None, wait_for_completion: Optional[bool] = None, ...
return await self._perform_request("POST", __target, headers=__headers)
Stops an existing, started rollup job. `<https://www.elastic.co/guide/en/elasticsearch/reference/master/rollup-stop-job.html>`_ :param id: The ID of the job to stop :param timeout: Block for (at maximum) the specified duration while waiting for the job to stop. Defaults to 30s. ...
Stops an existing, started rollup job.
[ "Stops", "an", "existing", "started", "rollup", "job", "." ]
async def stop_job( self, *, id: Any, error_trace: Optional[bool] = None, filter_path: Optional[Union[List[str], str]] = None, human: Optional[bool] = None, pretty: Optional[bool] = None, timeout: Optional[Any] = None, wait_for_completion: Optional...
[ "async", "def", "stop_job", "(", "self", ",", "*", ",", "id", ":", "Any", ",", "error_trace", ":", "Optional", "[", "bool", "]", "=", "None", ",", "filter_path", ":", "Optional", "[", "Union", "[", "List", "[", "str", "]", ",", "str", "]", "]", "...
https://github.com/elastic/elasticsearch-py/blob/6ef1adfa3c840a84afda7369cd8e43ae7dc45cdb/elasticsearch/_async/client/rollup.py#L440-L483
JaniceWuo/MovieRecommend
4c86db64ca45598917d304f535413df3bc9fea65
movierecommend/venv1/Lib/site-packages/pip-9.0.1-py3.6.egg/pip/_vendor/colorama/ansitowin32.py
python
AnsiToWin32.convert_ansi
(self, paramstring, command)
[]
def convert_ansi(self, paramstring, command): if self.convert: params = self.extract_params(command, paramstring) self.call_win32(command, params)
[ "def", "convert_ansi", "(", "self", ",", "paramstring", ",", "command", ")", ":", "if", "self", ".", "convert", ":", "params", "=", "self", ".", "extract_params", "(", "command", ",", "paramstring", ")", "self", ".", "call_win32", "(", "command", ",", "p...
https://github.com/JaniceWuo/MovieRecommend/blob/4c86db64ca45598917d304f535413df3bc9fea65/movierecommend/venv1/Lib/site-packages/pip-9.0.1-py3.6.egg/pip/_vendor/colorama/ansitowin32.py#L178-L181
youyuge34/PI-REC
9f8f1adff169fda301f3134ac730991484a6b128
tool_draw.py
python
model_process
(color_domain, edge)
return result
Key function to reconstruct image from edge and color domain. :param color_domain: channel=3 :param edge: channel=1 :return: reconstruction
Key function to reconstruct image from edge and color domain. :param color_domain: channel=3 :param edge: channel=1 :return: reconstruction
[ "Key", "function", "to", "reconstruct", "image", "from", "edge", "and", "color", "domain", ".", ":", "param", "color_domain", ":", "channel", "=", "3", ":", "param", "edge", ":", "channel", "=", "1", ":", "return", ":", "reconstruction" ]
def model_process(color_domain, edge): """ Key function to reconstruct image from edge and color domain. :param color_domain: channel=3 :param edge: channel=1 :return: reconstruction """ # print(color_domain.shape, edge.shape) size_origin = color_domain.shape[:2] img = cv.cvtColor(co...
[ "def", "model_process", "(", "color_domain", ",", "edge", ")", ":", "# print(color_domain.shape, edge.shape)", "size_origin", "=", "color_domain", ".", "shape", "[", ":", "2", "]", "img", "=", "cv", ".", "cvtColor", "(", "color_domain", ",", "cv", ".", "COLOR_...
https://github.com/youyuge34/PI-REC/blob/9f8f1adff169fda301f3134ac730991484a6b128/tool_draw.py#L215-L228
turicas/rows
27871dbfef3be445169eafe2c66f0333d3090579
rows/fields.py
python
make_header
(field_names, permit_not=False)
return result
Return unique and slugged field names.
Return unique and slugged field names.
[ "Return", "unique", "and", "slugged", "field", "names", "." ]
def make_header(field_names, permit_not=False): """Return unique and slugged field names.""" slug_chars = SLUG_CHARS if not permit_not else SLUG_CHARS + "^" header = [slug(field_name, permitted_chars=slug_chars) for field_name in field_names] result = [] for index, field_name in enumerate(header): ...
[ "def", "make_header", "(", "field_names", ",", "permit_not", "=", "False", ")", ":", "slug_chars", "=", "SLUG_CHARS", "if", "not", "permit_not", "else", "SLUG_CHARS", "+", "\"^\"", "header", "=", "[", "slug", "(", "field_name", ",", "permitted_chars", "=", "...
https://github.com/turicas/rows/blob/27871dbfef3be445169eafe2c66f0333d3090579/rows/fields.py#L583-L599
heynemann/pyccuracy
0bbe3bcff4d13a6501bf77d5af9457f6a1491ab6
pyccuracy/airspeed.py
python
StopDirective.evaluate
(self, stream, namespace, loader)
[]
def evaluate(self, stream, namespace, loader): if hasattr(stream, 'stop'): stream.stop = True
[ "def", "evaluate", "(", "self", ",", "stream", ",", "namespace", ",", "loader", ")", ":", "if", "hasattr", "(", "stream", ",", "'stop'", ")", ":", "stream", ".", "stop", "=", "True" ]
https://github.com/heynemann/pyccuracy/blob/0bbe3bcff4d13a6501bf77d5af9457f6a1491ab6/pyccuracy/airspeed.py#L869-L871
seantis/suitable
047d8634c74498850911e2b14425fee6713adcca
suitable/module_runner.py
python
ModuleRunner.__init__
(self, module_name)
Runs any ansible module given the module's name and access to the api instance (done through the hookup method).
Runs any ansible module given the module's name and access to the api instance (done through the hookup method).
[ "Runs", "any", "ansible", "module", "given", "the", "module", "s", "name", "and", "access", "to", "the", "api", "instance", "(", "done", "through", "the", "hookup", "method", ")", "." ]
def __init__(self, module_name): """ Runs any ansible module given the module's name and access to the api instance (done through the hookup method). """ self.module_name = module_name self.api = None self.module_args = None
[ "def", "__init__", "(", "self", ",", "module_name", ")", ":", "self", ".", "module_name", "=", "module_name", "self", ".", "api", "=", "None", "self", ".", "module_args", "=", "None" ]
https://github.com/seantis/suitable/blob/047d8634c74498850911e2b14425fee6713adcca/suitable/module_runner.py#L96-L103
huawei-noah/Pretrained-Language-Model
d4694a134bdfacbaef8ff1d99735106bd3b3372b
DynaBERT/transformers/tokenization_bert.py
python
BasicTokenizer._tokenize_chinese_chars
(self, text)
return "".join(output)
Adds whitespace around any CJK character.
Adds whitespace around any CJK character.
[ "Adds", "whitespace", "around", "any", "CJK", "character", "." ]
def _tokenize_chinese_chars(self, text): """Adds whitespace around any CJK character.""" output = [] for char in text: cp = ord(char) if self._is_chinese_char(cp): output.append(" ") output.append(char) output.append(" ") ...
[ "def", "_tokenize_chinese_chars", "(", "self", ",", "text", ")", ":", "output", "=", "[", "]", "for", "char", "in", "text", ":", "cp", "=", "ord", "(", "char", ")", "if", "self", ".", "_is_chinese_char", "(", "cp", ")", ":", "output", ".", "append", ...
https://github.com/huawei-noah/Pretrained-Language-Model/blob/d4694a134bdfacbaef8ff1d99735106bd3b3372b/DynaBERT/transformers/tokenization_bert.py#L356-L367
JiYou/openstack
8607dd488bde0905044b303eb6e52bdea6806923
packages/source/quantum/quantum/plugins/plumgrid/plumgrid_nos_plugin/plumgrid_plugin.py
python
QuantumPluginPLUMgridV2.create_port
(self, context, port)
return super(QuantumPluginPLUMgridV2, self).create_port(context, port)
Create port core Quantum API
Create port core Quantum API
[ "Create", "port", "core", "Quantum", "API" ]
def create_port(self, context, port): """ Create port core Quantum API """ LOG.debug(_("QuantumPluginPLUMgrid Status: create_port() called")) # Port operations on PLUMgrid NOS is an automatic operation from the # VIF driver operations in Nova. It requires admin_state_up ...
[ "def", "create_port", "(", "self", ",", "context", ",", "port", ")", ":", "LOG", ".", "debug", "(", "_", "(", "\"QuantumPluginPLUMgrid Status: create_port() called\"", ")", ")", "# Port operations on PLUMgrid NOS is an automatic operation from the", "# VIF driver operations i...
https://github.com/JiYou/openstack/blob/8607dd488bde0905044b303eb6e52bdea6806923/packages/source/quantum/quantum/plugins/plumgrid/plumgrid_nos_plugin/plumgrid_plugin.py#L186-L198
zhl2008/awd-platform
0416b31abea29743387b10b3914581fbe8e7da5e
web_flaskbb/Python-2.7.9/Lib/BaseHTTPServer.py
python
BaseHTTPRequestHandler.end_headers
(self)
Send the blank line ending the MIME headers.
Send the blank line ending the MIME headers.
[ "Send", "the", "blank", "line", "ending", "the", "MIME", "headers", "." ]
def end_headers(self): """Send the blank line ending the MIME headers.""" if self.request_version != 'HTTP/0.9': self.wfile.write("\r\n")
[ "def", "end_headers", "(", "self", ")", ":", "if", "self", ".", "request_version", "!=", "'HTTP/0.9'", ":", "self", ".", "wfile", ".", "write", "(", "\"\\r\\n\"", ")" ]
https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_flaskbb/Python-2.7.9/Lib/BaseHTTPServer.py#L409-L412
theotherp/nzbhydra
4b03d7f769384b97dfc60dade4806c0fc987514e
libs/decimal.py
python
Context.logical_xor
(self, a, b)
return a.logical_xor(b, context=self)
Applies the logical operation 'xor' between each operand's digits. The operands must be both logical numbers. >>> ExtendedContext.logical_xor(Decimal('0'), Decimal('0')) Decimal('0') >>> ExtendedContext.logical_xor(Decimal('0'), Decimal('1')) Decimal('1') >>> ExtendedCo...
Applies the logical operation 'xor' between each operand's digits.
[ "Applies", "the", "logical", "operation", "xor", "between", "each", "operand", "s", "digits", "." ]
def logical_xor(self, a, b): """Applies the logical operation 'xor' between each operand's digits. The operands must be both logical numbers. >>> ExtendedContext.logical_xor(Decimal('0'), Decimal('0')) Decimal('0') >>> ExtendedContext.logical_xor(Decimal('0'), Decimal('1')) ...
[ "def", "logical_xor", "(", "self", ",", "a", ",", "b", ")", ":", "a", "=", "_convert_other", "(", "a", ",", "raiseit", "=", "True", ")", "return", "a", ".", "logical_xor", "(", "b", ",", "context", "=", "self", ")" ]
https://github.com/theotherp/nzbhydra/blob/4b03d7f769384b97dfc60dade4806c0fc987514e/libs/decimal.py#L4636-L4661
leoshine/Spherical_Regression
d19bc2f6f52982d4d58f5ddabe4231381d7facd7
S3.3D_Rotation/trainval_workdir.py
python
adjust_learning_rate
(optimizer, epoch)
return lr
Sets the learning rate to the initial LR decayed by 10 every _N_ epochs
Sets the learning rate to the initial LR decayed by 10 every _N_ epochs
[ "Sets", "the", "learning", "rate", "to", "the", "initial", "LR", "decayed", "by", "10", "every", "_N_", "epochs" ]
def adjust_learning_rate(optimizer, epoch): """Sets the learning rate to the initial LR decayed by 10 every _N_ epochs""" _N_ = int((40000*batch_size)/29786./2 /10)*10 # '2' mean at most decay 2 times. lr = opt.base_lr * (0.1 ** (epoch // _N_)) # 300)) for param_group in optimizer.param_groups: ...
[ "def", "adjust_learning_rate", "(", "optimizer", ",", "epoch", ")", ":", "_N_", "=", "int", "(", "(", "40000", "*", "batch_size", ")", "/", "29786.", "/", "2", "/", "10", ")", "*", "10", "# '2' mean at most decay 2 times.", "lr", "=", "opt", ".", "base_l...
https://github.com/leoshine/Spherical_Regression/blob/d19bc2f6f52982d4d58f5ddabe4231381d7facd7/S3.3D_Rotation/trainval_workdir.py#L256-L262
ajinabraham/OWASP-Xenotix-XSS-Exploit-Framework
cb692f527e4e819b6c228187c5702d990a180043
external/Scripting Engine/Xenotix Python Scripting Engine/packages/IronPython.StdLib.2.7.4/content/Lib/uuid.py
python
_ifconfig_getnode
()
return None
Get the hardware address on Unix by running ifconfig.
Get the hardware address on Unix by running ifconfig.
[ "Get", "the", "hardware", "address", "on", "Unix", "by", "running", "ifconfig", "." ]
def _ifconfig_getnode(): """Get the hardware address on Unix by running ifconfig.""" # This works on Linux ('' or '-a'), Tru64 ('-av'), but not all Unixes. for args in ('', '-a', '-av'): mac = _find_mac('ifconfig', args, ['hwaddr', 'ether'], lambda i: i+1) if mac: return mac ...
[ "def", "_ifconfig_getnode", "(", ")", ":", "# This works on Linux ('' or '-a'), Tru64 ('-av'), but not all Unixes.", "for", "args", "in", "(", "''", ",", "'-a'", ",", "'-av'", ")", ":", "mac", "=", "_find_mac", "(", "'ifconfig'", ",", "args", ",", "[", "'hwaddr'",...
https://github.com/ajinabraham/OWASP-Xenotix-XSS-Exploit-Framework/blob/cb692f527e4e819b6c228187c5702d990a180043/external/Scripting Engine/Xenotix Python Scripting Engine/packages/IronPython.StdLib.2.7.4/content/Lib/uuid.py#L316-L338
WZMIAOMIAO/deep-learning-for-image-processing
a4502c284958d4bf78fb77b089a90e7688ddc196
pytorch_object_detection/ssd/my_dataset.py
python
VOCDataSet.coco_index
(self, idx)
return target
该方法是专门为pycocotools统计标签信息准备,不对图像和标签作任何处理 由于不用去读取图片,可大幅缩减统计时间 Args: idx: 输入需要获取图像的索引
该方法是专门为pycocotools统计标签信息准备,不对图像和标签作任何处理 由于不用去读取图片,可大幅缩减统计时间
[ "该方法是专门为pycocotools统计标签信息准备,不对图像和标签作任何处理", "由于不用去读取图片,可大幅缩减统计时间" ]
def coco_index(self, idx): """ 该方法是专门为pycocotools统计标签信息准备,不对图像和标签作任何处理 由于不用去读取图片,可大幅缩减统计时间 Args: idx: 输入需要获取图像的索引 """ # read xml xml_path = self.xml_list[idx] with open(xml_path) as fid: xml_str = fid.read() xml = etree.fro...
[ "def", "coco_index", "(", "self", ",", "idx", ")", ":", "# read xml", "xml_path", "=", "self", ".", "xml_list", "[", "idx", "]", "with", "open", "(", "xml_path", ")", "as", "fid", ":", "xml_str", "=", "fid", ".", "read", "(", ")", "xml", "=", "etre...
https://github.com/WZMIAOMIAO/deep-learning-for-image-processing/blob/a4502c284958d4bf78fb77b089a90e7688ddc196/pytorch_object_detection/ssd/my_dataset.py#L130-L180
AppScale/gts
46f909cf5dc5ba81faf9d81dc9af598dcf8a82a9
AppServer/lib/django-1.5/django/core/files/storage.py
python
Storage.get_valid_name
(self, name)
return get_valid_filename(name)
Returns a filename, based on the provided filename, that's suitable for use in the target storage system.
Returns a filename, based on the provided filename, that's suitable for use in the target storage system.
[ "Returns", "a", "filename", "based", "on", "the", "provided", "filename", "that", "s", "suitable", "for", "use", "in", "the", "target", "storage", "system", "." ]
def get_valid_name(self, name): """ Returns a filename, based on the provided filename, that's suitable for use in the target storage system. """ return get_valid_filename(name)
[ "def", "get_valid_name", "(", "self", ",", "name", ")", ":", "return", "get_valid_filename", "(", "name", ")" ]
https://github.com/AppScale/gts/blob/46f909cf5dc5ba81faf9d81dc9af598dcf8a82a9/AppServer/lib/django-1.5/django/core/files/storage.py#L55-L60
dpp/simply_lift
cf49f7dcce81c7f1557314dd0f0bb08aaedc73da
elyxer.py
python
Float.embed
(self)
return tagged
Embed the whole contents in a div.
Embed the whole contents in a div.
[ "Embed", "the", "whole", "contents", "in", "a", "div", "." ]
def embed(self): "Embed the whole contents in a div." embeddedtag = self.getembeddedtag() tagged = TaggedText().complete(self.contents, embeddedtag, True) self.contents = [tagged] return tagged
[ "def", "embed", "(", "self", ")", ":", "embeddedtag", "=", "self", ".", "getembeddedtag", "(", ")", "tagged", "=", "TaggedText", "(", ")", ".", "complete", "(", "self", ".", "contents", ",", "embeddedtag", ",", "True", ")", "self", ".", "contents", "="...
https://github.com/dpp/simply_lift/blob/cf49f7dcce81c7f1557314dd0f0bb08aaedc73da/elyxer.py#L6726-L6731
pwnieexpress/pwn_plug_sources
1a23324f5dc2c3de20f9c810269b6a29b2758cad
src/metagoofil/hachoir_core/tools.py
python
paddingSize
(value, align)
Compute size of a padding field. >>> paddingSize(31, 4) 1 >>> paddingSize(32, 4) 0 >>> paddingSize(33, 4) 3 Note: (value + paddingSize(value, align)) == alignValue(value, align)
Compute size of a padding field.
[ "Compute", "size", "of", "a", "padding", "field", "." ]
def paddingSize(value, align): """ Compute size of a padding field. >>> paddingSize(31, 4) 1 >>> paddingSize(32, 4) 0 >>> paddingSize(33, 4) 3 Note: (value + paddingSize(value, align)) == alignValue(value, align) """ if value % align != 0: return align - (value % al...
[ "def", "paddingSize", "(", "value", ",", "align", ")", ":", "if", "value", "%", "align", "!=", "0", ":", "return", "align", "-", "(", "value", "%", "align", ")", "else", ":", "return", "0" ]
https://github.com/pwnieexpress/pwn_plug_sources/blob/1a23324f5dc2c3de20f9c810269b6a29b2758cad/src/metagoofil/hachoir_core/tools.py#L42-L58
Yelp/mrjob
091572e87bc24cc64be40278dd0f5c3617c98d4b
mrjob/cloud.py
python
HadoopInTheCloudJobRunner._cp_to_local_cmd
(self)
return 'hadoop fs -copyToLocal'
Command to copy files from the cloud to the local directory (usually via Hadoop). Redefine this as needed; for example, on EMR, we sometimes have to use ``aws s3 cp`` because ``hadoop`` isn't installed at bootstrap time.
Command to copy files from the cloud to the local directory (usually via Hadoop). Redefine this as needed; for example, on EMR, we sometimes have to use ``aws s3 cp`` because ``hadoop`` isn't installed at bootstrap time.
[ "Command", "to", "copy", "files", "from", "the", "cloud", "to", "the", "local", "directory", "(", "usually", "via", "Hadoop", ")", ".", "Redefine", "this", "as", "needed", ";", "for", "example", "on", "EMR", "we", "sometimes", "have", "to", "use", "aws",...
def _cp_to_local_cmd(self): """Command to copy files from the cloud to the local directory (usually via Hadoop). Redefine this as needed; for example, on EMR, we sometimes have to use ``aws s3 cp`` because ``hadoop`` isn't installed at bootstrap time.""" return 'hadoop fs -copyTo...
[ "def", "_cp_to_local_cmd", "(", "self", ")", ":", "return", "'hadoop fs -copyToLocal'" ]
https://github.com/Yelp/mrjob/blob/091572e87bc24cc64be40278dd0f5c3617c98d4b/mrjob/cloud.py#L196-L201
pm4py/pm4py-core
7807b09a088b02199cd0149d724d0e28793971bf
pm4py/objects/petri_net/utils/petri_utils.py
python
decorate_transitions_prepostset
(net)
Decorate transitions with sub and addition markings Parameters ------------- net Petri net
Decorate transitions with sub and addition markings
[ "Decorate", "transitions", "with", "sub", "and", "addition", "markings" ]
def decorate_transitions_prepostset(net): """ Decorate transitions with sub and addition markings Parameters ------------- net Petri net """ from pm4py.objects.petri_net.obj import Marking for trans in net.transitions: sub_marking = Marking() add_marking = Markin...
[ "def", "decorate_transitions_prepostset", "(", "net", ")", ":", "from", "pm4py", ".", "objects", ".", "petri_net", ".", "obj", "import", "Marking", "for", "trans", "in", "net", ".", "transitions", ":", "sub_marking", "=", "Marking", "(", ")", "add_marking", ...
https://github.com/pm4py/pm4py-core/blob/7807b09a088b02199cd0149d724d0e28793971bf/pm4py/objects/petri_net/utils/petri_utils.py#L395-L418
nginxinc/nginx-amplify-agent
81c4002c156809039933234abeb292edee3ac492
amplify/agent/objects/nginx/object.py
python
NginxObject.get_alive_plus_status_urls
(self)
return external_status_url, internal_status_url
Tries to get alive plus urls There are two types of plus status urls: internal and external - internal are for the agent and usually they have the localhost ip in address - external are for the browsers and usually they have a normal server name Returns a tuple of str or Nones - (extern...
Tries to get alive plus urls There are two types of plus status urls: internal and external - internal are for the agent and usually they have the localhost ip in address - external are for the browsers and usually they have a normal server name
[ "Tries", "to", "get", "alive", "plus", "urls", "There", "are", "two", "types", "of", "plus", "status", "urls", ":", "internal", "and", "external", "-", "internal", "are", "for", "the", "agent", "and", "usually", "they", "have", "the", "localhost", "ip", ...
def get_alive_plus_status_urls(self): """ Tries to get alive plus urls There are two types of plus status urls: internal and external - internal are for the agent and usually they have the localhost ip in address - external are for the browsers and usually they have a normal serv...
[ "def", "get_alive_plus_status_urls", "(", "self", ")", ":", "internal_urls", "=", "self", ".", "config", ".", "plus_status_internal_urls", "external_urls", "=", "self", ".", "config", ".", "plus_status_external_urls", "if", "'plus_status'", "in", "context", ".", "ap...
https://github.com/nginxinc/nginx-amplify-agent/blob/81c4002c156809039933234abeb292edee3ac492/amplify/agent/objects/nginx/object.py#L147-L185
ayeowch/bitnodes
5fa4ac3fe8e748d450228ec1fea01b8e61978e5c
ping.py
python
set_reachable
(nodes)
return REDIS_CONN.scard('reachable')
Adds reachable nodes that are not already in the open set into the reachable set in Redis. New workers can be spawned separately to establish and maintain connection with these nodes.
Adds reachable nodes that are not already in the open set into the reachable set in Redis. New workers can be spawned separately to establish and maintain connection with these nodes.
[ "Adds", "reachable", "nodes", "that", "are", "not", "already", "in", "the", "open", "set", "into", "the", "reachable", "set", "in", "Redis", ".", "New", "workers", "can", "be", "spawned", "separately", "to", "establish", "and", "maintain", "connection", "wit...
def set_reachable(nodes): """ Adds reachable nodes that are not already in the open set into the reachable set in Redis. New workers can be spawned separately to establish and maintain connection with these nodes. """ for node in nodes: address = node[0] port = node[1] se...
[ "def", "set_reachable", "(", "nodes", ")", ":", "for", "node", "in", "nodes", ":", "address", "=", "node", "[", "0", "]", "port", "=", "node", "[", "1", "]", "services", "=", "node", "[", "2", "]", "height", "=", "node", "[", "3", "]", "if", "n...
https://github.com/ayeowch/bitnodes/blob/5fa4ac3fe8e748d450228ec1fea01b8e61978e5c/ping.py#L276-L289
plivo/plivoframework
29fc41fb3c887d5d9022a941e87bbeb2269112ff
src/plivo/rest/freeswitch/api.py
python
PlivoRestApi.play
(self)
return self.send_response(Success=result, Message=msg)
Play something to a Call or bridged leg or both legs. Allow playing a sound to a Call via the REST API. To play sound, make an HTTP POST request to the resource URI. POST Parameters ---------------- Required Parameters - You must POST the following parameters: CallUUID...
Play something to a Call or bridged leg or both legs. Allow playing a sound to a Call via the REST API. To play sound, make an HTTP POST request to the resource URI.
[ "Play", "something", "to", "a", "Call", "or", "bridged", "leg", "or", "both", "legs", ".", "Allow", "playing", "a", "sound", "to", "a", "Call", "via", "the", "REST", "API", ".", "To", "play", "sound", "make", "an", "HTTP", "POST", "request", "to", "t...
def play(self): """Play something to a Call or bridged leg or both legs. Allow playing a sound to a Call via the REST API. To play sound, make an HTTP POST request to the resource URI. POST Parameters ---------------- Required Parameters - You must POST the following pa...
[ "def", "play", "(", "self", ")", ":", "self", ".", "_rest_inbound_socket", ".", "log", ".", "debug", "(", "\"RESTAPI Play with %s\"", "%", "str", "(", "request", ".", "form", ".", "items", "(", ")", ")", ")", "msg", "=", "\"\"", "result", "=", "False",...
https://github.com/plivo/plivoframework/blob/29fc41fb3c887d5d9022a941e87bbeb2269112ff/src/plivo/rest/freeswitch/api.py#L1775-L1858
IronLanguages/ironpython3
7a7bb2a872eeab0d1009fc8a6e24dca43f65b693
Src/StdLib/Lib/asyncio/tasks.py
python
Task.get_stack
(self, *, limit=None)
return frames
Return the list of stack frames for this task's coroutine. If the coroutine is not done, this returns the stack where it is suspended. If the coroutine has completed successfully or was cancelled, this returns an empty list. If the coroutine was terminated by an exception, this return...
Return the list of stack frames for this task's coroutine.
[ "Return", "the", "list", "of", "stack", "frames", "for", "this", "task", "s", "coroutine", "." ]
def get_stack(self, *, limit=None): """Return the list of stack frames for this task's coroutine. If the coroutine is not done, this returns the stack where it is suspended. If the coroutine has completed successfully or was cancelled, this returns an empty list. If the coroutine was ...
[ "def", "get_stack", "(", "self", ",", "*", ",", "limit", "=", "None", ")", ":", "frames", "=", "[", "]", "try", ":", "# 'async def' coroutines", "f", "=", "self", ".", "_coro", ".", "cr_frame", "except", "AttributeError", ":", "f", "=", "self", ".", ...
https://github.com/IronLanguages/ironpython3/blob/7a7bb2a872eeab0d1009fc8a6e24dca43f65b693/Src/StdLib/Lib/asyncio/tasks.py#L110-L155