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
locuslab/deq
1fb7059d6d89bb26d16da80ab9489dcc73fc5472
MDEQ-Vision/lib/datasets/cityscapes.py
python
Cityscapes.__init__
(self, root, list_path, num_samples=None, num_classes=19, multi_scale=True, flip=True, ignore_label=-1, base_size=2048, crop_size=(512, 1024), ...
[]
def __init__(self, root, list_path, num_samples=None, num_classes=19, multi_scale=True, flip=True, ignore_label=-1, base_size=2048, crop_size=(512, 1024), ...
[ "def", "__init__", "(", "self", ",", "root", ",", "list_path", ",", "num_samples", "=", "None", ",", "num_classes", "=", "19", ",", "multi_scale", "=", "True", ",", "flip", "=", "True", ",", "ignore_label", "=", "-", "1", ",", "base_size", "=", "2048",...
https://github.com/locuslab/deq/blob/1fb7059d6d89bb26d16da80ab9489dcc73fc5472/MDEQ-Vision/lib/datasets/cityscapes.py#L19-L68
marcomusy/vedo
246bb78a406c4f97fe6f7d2a4d460909c830de87
vedo/ugrid.py
python
UGrid.alpha
(self, opacity=None)
return self
Set/get mesh's transparency. Same as `mesh.opacity()`.
Set/get mesh's transparency. Same as `mesh.opacity()`.
[ "Set", "/", "get", "mesh", "s", "transparency", ".", "Same", "as", "mesh", ".", "opacity", "()", "." ]
def alpha(self, opacity=None): """Set/get mesh's transparency. Same as `mesh.opacity()`.""" if opacity is None: return self.property.GetOpacity() self.property.SetOpacity(opacity) bfp = self.GetBackfaceProperty() if bfp: if opacity < 1: se...
[ "def", "alpha", "(", "self", ",", "opacity", "=", "None", ")", ":", "if", "opacity", "is", "None", ":", "return", "self", ".", "property", ".", "GetOpacity", "(", ")", "self", ".", "property", ".", "SetOpacity", "(", "opacity", ")", "bfp", "=", "self...
https://github.com/marcomusy/vedo/blob/246bb78a406c4f97fe6f7d2a4d460909c830de87/vedo/ugrid.py#L181-L194
tp4a/teleport
1fafd34f1f775d2cf80ea4af6e44468d8e0b24ad
server/www/packages/packages-windows/x86/PIL/JpegImagePlugin.py
python
_save
(im, fp, filename)
[]
def _save(im, fp, filename): try: rawmode = RAWMODE[im.mode] except KeyError: raise OSError("cannot write mode %s as JPEG" % im.mode) info = im.encoderinfo dpi = [round(x) for x in info.get("dpi", (0, 0))] quality = info.get("quality", -1) subsampling = info.get("subsampling"...
[ "def", "_save", "(", "im", ",", "fp", ",", "filename", ")", ":", "try", ":", "rawmode", "=", "RAWMODE", "[", "im", ".", "mode", "]", "except", "KeyError", ":", "raise", "OSError", "(", "\"cannot write mode %s as JPEG\"", "%", "im", ".", "mode", ")", "i...
https://github.com/tp4a/teleport/blob/1fafd34f1f775d2cf80ea4af6e44468d8e0b24ad/server/www/packages/packages-windows/x86/PIL/JpegImagePlugin.py#L609-L763
mesalock-linux/mesapy
ed546d59a21b36feb93e2309d5c6b75aa0ad95c9
rpython/rtyper/callparse.py
python
getsig
(rtyper, graph)
return (graph.signature, graph.defaults, getrinputs(rtyper, graph), getrresult(rtyper, graph))
Return the complete 'signature' of the graph.
Return the complete 'signature' of the graph.
[ "Return", "the", "complete", "signature", "of", "the", "graph", "." ]
def getsig(rtyper, graph): """Return the complete 'signature' of the graph.""" return (graph.signature, graph.defaults, getrinputs(rtyper, graph), getrresult(rtyper, graph))
[ "def", "getsig", "(", "rtyper", ",", "graph", ")", ":", "return", "(", "graph", ".", "signature", ",", "graph", ".", "defaults", ",", "getrinputs", "(", "rtyper", ",", "graph", ")", ",", "getrresult", "(", "rtyper", ",", "graph", ")", ")" ]
https://github.com/mesalock-linux/mesapy/blob/ed546d59a21b36feb93e2309d5c6b75aa0ad95c9/rpython/rtyper/callparse.py#L27-L32
home-assistant/core
265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1
homeassistant/config_entries.py
python
ConfigFlow.async_step_usb
( self, discovery_info: UsbServiceInfo )
return await self.async_step_discovery(dataclasses.asdict(discovery_info))
Handle a flow initialized by USB discovery.
Handle a flow initialized by USB discovery.
[ "Handle", "a", "flow", "initialized", "by", "USB", "discovery", "." ]
async def async_step_usb( self, discovery_info: UsbServiceInfo ) -> data_entry_flow.FlowResult: """Handle a flow initialized by USB discovery.""" return await self.async_step_discovery(dataclasses.asdict(discovery_info))
[ "async", "def", "async_step_usb", "(", "self", ",", "discovery_info", ":", "UsbServiceInfo", ")", "->", "data_entry_flow", ".", "FlowResult", ":", "return", "await", "self", ".", "async_step_discovery", "(", "dataclasses", ".", "asdict", "(", "discovery_info", ")"...
https://github.com/home-assistant/core/blob/265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1/homeassistant/config_entries.py#L1431-L1435
holzschu/Carnets
44effb10ddfc6aa5c8b0687582a724ba82c6b547
Library/lib/python3.7/site-packages/notebook/notebookapp.py
python
random_ports
(port, n)
Generate a list of n random ports near the given port. The first 5 ports will be sequential, and the remaining n-5 will be randomly selected in the range [port-2*n, port+2*n].
Generate a list of n random ports near the given port.
[ "Generate", "a", "list", "of", "n", "random", "ports", "near", "the", "given", "port", "." ]
def random_ports(port, n): """Generate a list of n random ports near the given port. The first 5 ports will be sequential, and the remaining n-5 will be randomly selected in the range [port-2*n, port+2*n]. """ for i in range(min(5, n)): yield port + i for i in range(n-5): yield ...
[ "def", "random_ports", "(", "port", ",", "n", ")", ":", "for", "i", "in", "range", "(", "min", "(", "5", ",", "n", ")", ")", ":", "yield", "port", "+", "i", "for", "i", "in", "range", "(", "n", "-", "5", ")", ":", "yield", "max", "(", "1", ...
https://github.com/holzschu/Carnets/blob/44effb10ddfc6aa5c8b0687582a724ba82c6b547/Library/lib/python3.7/site-packages/notebook/notebookapp.py#L129-L138
easyw/RF-tools-KiCAD
e42ea8e44d009e6ba6bd8cbf22a3f0a4df1aa5d8
via_fence_generator/viafence_action.py
python
ViaFenceAction.checkTracks
(self)
return removed
[]
def checkTracks(self): ##Check vias collisions with all tracks if not(hasattr(pcbnew,'DRAWSEGMENT')) and temporary_fix: self.clearance = 0 #TBF else: self.clearance = self.boardObj.GetDesignSettings().GetDefault().GetClearance() #lboard = self.boardObj.ComputeBounding...
[ "def", "checkTracks", "(", "self", ")", ":", "##Check vias collisions with all tracks", "if", "not", "(", "hasattr", "(", "pcbnew", ",", "'DRAWSEGMENT'", ")", ")", "and", "temporary_fix", ":", "self", ".", "clearance", "=", "0", "#TBF", "else", ":", "self", ...
https://github.com/easyw/RF-tools-KiCAD/blob/e42ea8e44d009e6ba6bd8cbf22a3f0a4df1aa5d8/via_fence_generator/viafence_action.py#L194-L280
msracver/Deformable-ConvNets
6aeda878a95bcb55eadffbe125804e730574de8d
fpn/core/DataParallelExecutorGroup.py
python
DataParallelExecutorGroup.bind_exec
(self, data_shapes, label_shapes, shared_group=None, reshape=False)
Bind executors on their respective devices. Parameters ---------- data_shapes : list label_shapes : list shared_group : DataParallelExecutorGroup reshape : bool
Bind executors on their respective devices.
[ "Bind", "executors", "on", "their", "respective", "devices", "." ]
def bind_exec(self, data_shapes, label_shapes, shared_group=None, reshape=False): """Bind executors on their respective devices. Parameters ---------- data_shapes : list label_shapes : list shared_group : DataParallelExecutorGroup reshape : bool """ ...
[ "def", "bind_exec", "(", "self", ",", "data_shapes", ",", "label_shapes", ",", "shared_group", "=", "None", ",", "reshape", "=", "False", ")", ":", "assert", "reshape", "or", "not", "self", ".", "execs", "for", "i", "in", "range", "(", "len", "(", "sel...
https://github.com/msracver/Deformable-ConvNets/blob/6aeda878a95bcb55eadffbe125804e730574de8d/fpn/core/DataParallelExecutorGroup.py#L253-L281
m-labs/artiq
eaa1505c947c7987cdbd31c24056823c740e84e0
artiq/gui/ticker.py
python
Ticker.__init__
(self, min_ticks=3, precision=3, steps=(5, 2, 1, .5))
min_ticks: minimum number of ticks to generate The maximum number of ticks is max(consecutive ratios in steps)*min_ticks thus 5/2*min_ticks for default steps. precision: maximum number of significant digits in labels Also extract common offset and magnitude from t...
min_ticks: minimum number of ticks to generate The maximum number of ticks is max(consecutive ratios in steps)*min_ticks thus 5/2*min_ticks for default steps. precision: maximum number of significant digits in labels Also extract common offset and magnitude from t...
[ "min_ticks", ":", "minimum", "number", "of", "ticks", "to", "generate", "The", "maximum", "number", "of", "ticks", "is", "max", "(", "consecutive", "ratios", "in", "steps", ")", "*", "min_ticks", "thus", "5", "/", "2", "*", "min_ticks", "for", "default", ...
def __init__(self, min_ticks=3, precision=3, steps=(5, 2, 1, .5)): """ min_ticks: minimum number of ticks to generate The maximum number of ticks is max(consecutive ratios in steps)*min_ticks thus 5/2*min_ticks for default steps. precision: maximum number of s...
[ "def", "__init__", "(", "self", ",", "min_ticks", "=", "3", ",", "precision", "=", "3", ",", "steps", "=", "(", "5", ",", "2", ",", "1", ",", ".5", ")", ")", ":", "self", ".", "min_ticks", "=", "min_ticks", "self", ".", "precision", "=", "precisi...
https://github.com/m-labs/artiq/blob/eaa1505c947c7987cdbd31c24056823c740e84e0/artiq/gui/ticker.py#L10-L26
scotch/engineauth
e6e8f76edb3974c631f843e4e482723fddd1a36c
lib/oauth2client/appengine.py
python
AppAssertionCredentials.__init__
(self, scope, audience='https://accounts.google.com/o/oauth2/token', assertion_type='http://oauth.net/grant_type/jwt/1.0/bearer', token_uri='https://accounts.google.com/o/oauth2/token', **kwargs)
Constructor for AppAssertionCredentials Args: scope: string, scope of the credentials being requested. audience: string, The audience, or verifier of the assertion. For convenience defaults to Google's audience. assertion_type: string, Type name that will identify the format of the ...
Constructor for AppAssertionCredentials
[ "Constructor", "for", "AppAssertionCredentials" ]
def __init__(self, scope, audience='https://accounts.google.com/o/oauth2/token', assertion_type='http://oauth.net/grant_type/jwt/1.0/bearer', token_uri='https://accounts.google.com/o/oauth2/token', **kwargs): """Constructor for AppAssertionCredentials Args: scope: string, scope of the c...
[ "def", "__init__", "(", "self", ",", "scope", ",", "audience", "=", "'https://accounts.google.com/o/oauth2/token'", ",", "assertion_type", "=", "'http://oauth.net/grant_type/jwt/1.0/bearer'", ",", "token_uri", "=", "'https://accounts.google.com/o/oauth2/token'", ",", "*", "*"...
https://github.com/scotch/engineauth/blob/e6e8f76edb3974c631f843e4e482723fddd1a36c/lib/oauth2client/appengine.py#L73-L96
spack/spack
675210bd8bd1c5d32ad1cc83d898fb43b569ed74
var/spack/repos/builtin/packages/gtkplus/package.py
python
Gtkplus.check
(self)
All build time checks open windows in the X server, don't do that
All build time checks open windows in the X server, don't do that
[ "All", "build", "time", "checks", "open", "windows", "in", "the", "X", "server", "don", "t", "do", "that" ]
def check(self): """All build time checks open windows in the X server, don't do that""" pass
[ "def", "check", "(", "self", ")", ":", "pass" ]
https://github.com/spack/spack/blob/675210bd8bd1c5d32ad1cc83d898fb43b569ed74/var/spack/repos/builtin/packages/gtkplus/package.py#L127-L129
statsmodels/statsmodels
debbe7ea6ba28fe5bdb78f09f8cac694bef98722
statsmodels/sandbox/regression/gmm.py
python
IVGMM.predict
(self, params, exog=None)
return np.dot(exog, params)
Get prediction at params
Get prediction at params
[ "Get", "prediction", "at", "params" ]
def predict(self, params, exog=None): """Get prediction at params""" if exog is None: exog = self.exog return np.dot(exog, params)
[ "def", "predict", "(", "self", ",", "params", ",", "exog", "=", "None", ")", ":", "if", "exog", "is", "None", ":", "exog", "=", "self", ".", "exog", "return", "np", ".", "dot", "(", "exog", ",", "params", ")" ]
https://github.com/statsmodels/statsmodels/blob/debbe7ea6ba28fe5bdb78f09f8cac694bef98722/statsmodels/sandbox/regression/gmm.py#L1385-L1390
IntelAI/models
1d7a53ccfad3e6f0e7378c9e3c8840895d63df8c
models/language_translation/tensorflow/transformer_mlperf/inference/bfloat16/transformer/model/embedding_layer.py
python
EmbeddingSharedWeights.call
(self, x)
Get token embeddings of x. Args: x: An int64 tensor with shape [batch_size, length] Returns: embeddings: float32 tensor with shape [batch_size, length, embedding_size] padding: float32 tensor with shape [batch_size, length] indicating the locations of the padding tokens in x.
Get token embeddings of x.
[ "Get", "token", "embeddings", "of", "x", "." ]
def call(self, x): """Get token embeddings of x. Args: x: An int64 tensor with shape [batch_size, length] Returns: embeddings: float32 tensor with shape [batch_size, length, embedding_size] padding: float32 tensor with shape [batch_size, length] indicating the locations of the pad...
[ "def", "call", "(", "self", ",", "x", ")", ":", "with", "tf", ".", "compat", ".", "v1", ".", "name_scope", "(", "\"embedding\"", ")", ":", "embeddings", "=", "tf", ".", "gather", "(", "self", ".", "shared_weights", ",", "x", ")", "# Scale embedding by ...
https://github.com/IntelAI/models/blob/1d7a53ccfad3e6f0e7378c9e3c8840895d63df8c/models/language_translation/tensorflow/transformer_mlperf/inference/bfloat16/transformer/model/embedding_layer.py#L53-L78
googleapis/google-auth-library-python
87cd2455aca96ac3fbc4a8b2f8e4c0bba568a70b
google/auth/crypt/_cryptography_rsa.py
python
RSAVerifier.from_string
(cls, public_key)
return cls(pubkey)
Construct an Verifier instance from a public key or public certificate string. Args: public_key (Union[str, bytes]): The public key in PEM format or the x509 public key certificate. Returns: Verifier: The constructed verifier. Raises: ...
Construct an Verifier instance from a public key or public certificate string.
[ "Construct", "an", "Verifier", "instance", "from", "a", "public", "key", "or", "public", "certificate", "string", "." ]
def from_string(cls, public_key): """Construct an Verifier instance from a public key or public certificate string. Args: public_key (Union[str, bytes]): The public key in PEM format or the x509 public key certificate. Returns: Verifier: The cons...
[ "def", "from_string", "(", "cls", ",", "public_key", ")", ":", "public_key_data", "=", "_helpers", ".", "to_bytes", "(", "public_key", ")", "if", "_CERTIFICATE_MARKER", "in", "public_key_data", ":", "cert", "=", "cryptography", ".", "x509", ".", "load_pem_x509_c...
https://github.com/googleapis/google-auth-library-python/blob/87cd2455aca96ac3fbc4a8b2f8e4c0bba568a70b/google/auth/crypt/_cryptography_rsa.py#L60-L85
spacetx/starfish
0e879d995d5c49b6f5a842e201e3be04c91afc7e
starfish/core/image/Filter/call_bases.py
python
CallBases._vector_norm
(self, x: xr.DataArray, dim: Axes, ord=None)
return result
Calculates the vector norm across a given dimension of an xarray. Parameters ---------- x : xarray.DataArray xarray to calcuate the norm. dim : Axes The dimension of the xarray to perform the norm across ord : Optional[str] Order of the norm t...
Calculates the vector norm across a given dimension of an xarray.
[ "Calculates", "the", "vector", "norm", "across", "a", "given", "dimension", "of", "an", "xarray", "." ]
def _vector_norm(self, x: xr.DataArray, dim: Axes, ord=None): """ Calculates the vector norm across a given dimension of an xarray. Parameters ---------- x : xarray.DataArray xarray to calcuate the norm. dim : Axes The dimension of the xarray to p...
[ "def", "_vector_norm", "(", "self", ",", "x", ":", "xr", ".", "DataArray", ",", "dim", ":", "Axes", ",", "ord", "=", "None", ")", ":", "result", "=", "xr", ".", "apply_ufunc", "(", "np", ".", "linalg", ".", "norm", ",", "x", ",", "input_core_dims",...
https://github.com/spacetx/starfish/blob/0e879d995d5c49b6f5a842e201e3be04c91afc7e/starfish/core/image/Filter/call_bases.py#L40-L67
BNMetrics/logme
b491d199a8ec8f604bbe8afb736ced349575e55e
logme/cli/_cli.py
python
add_options
(options: list=None)
return add_options_wrapper
*decorator* Combining _command_options as one single decorator, - options can be passed to specify which option to use - if option is not specified, it will combine all the option
*decorator*
[ "*", "decorator", "*" ]
def add_options(options: list=None): """ *decorator* Combining _command_options as one single decorator, - options can be passed to specify which option to use - if option is not specified, it will combine all the option """ def add_options_wrapper(command_func): if not options:...
[ "def", "add_options", "(", "options", ":", "list", "=", "None", ")", ":", "def", "add_options_wrapper", "(", "command_func", ")", ":", "if", "not", "options", ":", "for", "option", "in", "_command_options", ".", "values", "(", ")", ":", "command_func", "="...
https://github.com/BNMetrics/logme/blob/b491d199a8ec8f604bbe8afb736ced349575e55e/logme/cli/_cli.py#L30-L52
ustayready/CredKing
68b612e4cdf01d2b65b14ab2869bb8a5531056ee
plugins/gmail/bs4/diagnose.py
python
rword
(length=5)
return s
Generate a random word-like string.
Generate a random word-like string.
[ "Generate", "a", "random", "word", "-", "like", "string", "." ]
def rword(length=5): "Generate a random word-like string." s = '' for i in range(length): if i % 2 == 0: t = _consonants else: t = _vowels s += random.choice(t) return s
[ "def", "rword", "(", "length", "=", "5", ")", ":", "s", "=", "''", "for", "i", "in", "range", "(", "length", ")", ":", "if", "i", "%", "2", "==", "0", ":", "t", "=", "_consonants", "else", ":", "t", "=", "_vowels", "s", "+=", "random", ".", ...
https://github.com/ustayready/CredKing/blob/68b612e4cdf01d2b65b14ab2869bb8a5531056ee/plugins/gmail/bs4/diagnose.py#L139-L148
rail-berkeley/softlearning
13cf187cc93d90f7c217ea2845067491c3c65464
scripts/sync_gs.py
python
sync_gs
(args)
Sync files from google cloud storage bucket to local machine. TODO(hartikainen): Refactor this to use project config instead of environment variables (e.g. `SAC_GS_BUCKET`).
Sync files from google cloud storage bucket to local machine.
[ "Sync", "files", "from", "google", "cloud", "storage", "bucket", "to", "local", "machine", "." ]
def sync_gs(args): """Sync files from google cloud storage bucket to local machine. TODO(hartikainen): Refactor this to use project config instead of environment variables (e.g. `SAC_GS_BUCKET`). """ if 'SAC_GS_BUCKET' not in os.environ: raise ValueError( "'SAC_GS_BUCKET' en...
[ "def", "sync_gs", "(", "args", ")", ":", "if", "'SAC_GS_BUCKET'", "not", "in", "os", ".", "environ", ":", "raise", "ValueError", "(", "\"'SAC_GS_BUCKET' environment variable needs to be set.\"", ")", "bucket", "=", "os", ".", "environ", "[", "'SAC_GS_BUCKET'", "]"...
https://github.com/rail-berkeley/softlearning/blob/13cf187cc93d90f7c217ea2845067491c3c65464/scripts/sync_gs.py#L23-L60
IronLanguages/ironpython3
7a7bb2a872eeab0d1009fc8a6e24dca43f65b693
Src/StdLib/Lib/email/contentmanager.py
python
ContentManager.add_set_handler
(self, typekey, handler)
[]
def add_set_handler(self, typekey, handler): self.set_handlers[typekey] = handler
[ "def", "add_set_handler", "(", "self", ",", "typekey", ",", "handler", ")", ":", "self", ".", "set_handlers", "[", "typekey", "]", "=", "handler" ]
https://github.com/IronLanguages/ironpython3/blob/7a7bb2a872eeab0d1009fc8a6e24dca43f65b693/Src/StdLib/Lib/email/contentmanager.py#L27-L28
Azure/azure-linux-extensions
a42ef718c746abab2b3c6a21da87b29e76364558
OSPatching/azure/servicemanagement/servicebusmanagementservice.py
python
ServiceBusManagementService.get_regions
(self)
return _convert_response_to_feeds( response, _ServiceBusManagementXmlSerializer.xml_to_region)
Get list of available service bus regions.
Get list of available service bus regions.
[ "Get", "list", "of", "available", "service", "bus", "regions", "." ]
def get_regions(self): ''' Get list of available service bus regions. ''' response = self._perform_get( self._get_path('services/serviceBus/Regions/', None), None) return _convert_response_to_feeds( response, _ServiceBusManagementX...
[ "def", "get_regions", "(", "self", ")", ":", "response", "=", "self", ".", "_perform_get", "(", "self", ".", "_get_path", "(", "'services/serviceBus/Regions/'", ",", "None", ")", ",", "None", ")", "return", "_convert_response_to_feeds", "(", "response", ",", "...
https://github.com/Azure/azure-linux-extensions/blob/a42ef718c746abab2b3c6a21da87b29e76364558/OSPatching/azure/servicemanagement/servicebusmanagementservice.py#L41-L51
bendmorris/static-python
2e0f8c4d7ed5b359dc7d8a75b6fb37e6b6c5c473
Lib/decimal.py
python
_sqrt_nearest
(n, a)
return a
Closest integer to the square root of the positive integer n. a is an initial approximation to the square root. Any positive integer will do for a, but the closer a is to the square root of n the faster convergence will be.
Closest integer to the square root of the positive integer n. a is an initial approximation to the square root. Any positive integer will do for a, but the closer a is to the square root of n the faster convergence will be.
[ "Closest", "integer", "to", "the", "square", "root", "of", "the", "positive", "integer", "n", ".", "a", "is", "an", "initial", "approximation", "to", "the", "square", "root", ".", "Any", "positive", "integer", "will", "do", "for", "a", "but", "the", "clo...
def _sqrt_nearest(n, a): """Closest integer to the square root of the positive integer n. a is an initial approximation to the square root. Any positive integer will do for a, but the closer a is to the square root of n the faster convergence will be. """ if n <= 0 or a <= 0: raise Va...
[ "def", "_sqrt_nearest", "(", "n", ",", "a", ")", ":", "if", "n", "<=", "0", "or", "a", "<=", "0", ":", "raise", "ValueError", "(", "\"Both arguments to _sqrt_nearest should be positive.\"", ")", "b", "=", "0", "while", "a", "!=", "b", ":", "b", ",", "a...
https://github.com/bendmorris/static-python/blob/2e0f8c4d7ed5b359dc7d8a75b6fb37e6b6c5c473/Lib/decimal.py#L5673-L5686
python-cmd2/cmd2
c1f6114d52161a3b8a32d3cee1c495d79052e1fb
examples/help_categories.py
python
HelpCategories.do_sessions
(self, _)
Sessions command
Sessions command
[ "Sessions", "command" ]
def do_sessions(self, _): """Sessions command""" self.poutput('Sessions')
[ "def", "do_sessions", "(", "self", ",", "_", ")", ":", "self", ".", "poutput", "(", "'Sessions'", ")" ]
https://github.com/python-cmd2/cmd2/blob/c1f6114d52161a3b8a32d3cee1c495d79052e1fb/examples/help_categories.py#L70-L72
wummel/linkchecker
c2ce810c3fb00b895a841a7be6b2e78c64e7b042
linkcheck/director/aggregator.py
python
Aggregate.wait_for_host
(self, host)
Throttle requests to one host.
Throttle requests to one host.
[ "Throttle", "requests", "to", "one", "host", "." ]
def wait_for_host(self, host): """Throttle requests to one host.""" t = time.time() if host in self.times: due_time = self.times[host] if due_time > t: wait = due_time - t time.sleep(wait) t = time.time() wait_time =...
[ "def", "wait_for_host", "(", "self", ",", "host", ")", ":", "t", "=", "time", ".", "time", "(", ")", "if", "host", "in", "self", ".", "times", ":", "due_time", "=", "self", ".", "times", "[", "host", "]", "if", "due_time", ">", "t", ":", "wait", ...
https://github.com/wummel/linkchecker/blob/c2ce810c3fb00b895a841a7be6b2e78c64e7b042/linkcheck/director/aggregator.py#L134-L144
LinOTP/LinOTP
bb3940bbaccea99550e6c063ff824f258dd6d6d7
linotp/lib/policy/filter.py
python
AttributeCompare._user_domain_compare
(self)
return self._userinfo_direct()
define the user lookup, which is here user or use@domain :return: the user info as dict
define the user lookup, which is here user or use@domain
[ "define", "the", "user", "lookup", "which", "is", "here", "user", "or", "use@domain" ]
def _user_domain_compare(self): """ define the user lookup, which is here user or use@domain :return: the user info as dict """ udc = UserDomainCompare() compare_result = udc.compare(self.userObj, self.user_spec) if not compare_result: return False ...
[ "def", "_user_domain_compare", "(", "self", ")", ":", "udc", "=", "UserDomainCompare", "(", ")", "compare_result", "=", "udc", ".", "compare", "(", "self", ".", "userObj", ",", "self", ".", "user_spec", ")", "if", "not", "compare_result", ":", "return", "F...
https://github.com/LinOTP/LinOTP/blob/bb3940bbaccea99550e6c063ff824f258dd6d6d7/linotp/lib/policy/filter.py#L309-L321
kanzure/nanoengineer
874e4c9f8a9190f093625b267f9767e19f82e6c4
cad/src/operations/ops_files.py
python
fileSlotsMixin.fileExportAmdl
(self)
return self.fileExport(format)
Slot method for 'File > Export > Animation Master Model...' @return: The name of the file saved, or None if the user cancelled. @rtype: string @note: There are more popular .mdl file formats that we may need to support in the future. This option was needed by John ...
Slot method for 'File > Export > Animation Master Model...'
[ "Slot", "method", "for", "File", ">", "Export", ">", "Animation", "Master", "Model", "..." ]
def fileExportAmdl(self): """ Slot method for 'File > Export > Animation Master Model...' @return: The name of the file saved, or None if the user cancelled. @rtype: string @note: There are more popular .mdl file formats that we may need to support in the future...
[ "def", "fileExportAmdl", "(", "self", ")", ":", "format", "=", "\"Animation Master Model (*.mdl)\"", "return", "self", ".", "fileExport", "(", "format", ")" ]
https://github.com/kanzure/nanoengineer/blob/874e4c9f8a9190f093625b267f9767e19f82e6c4/cad/src/operations/ops_files.py#L1327-L1339
OpenEndedGroup/Field
4f7c8edfb01bb0ccc927b78d3c500f018a4ae37c
Contents/lib/python/imaplib.py
python
IMAP4.delete
(self, mailbox)
return self._simple_command('DELETE', mailbox)
Delete old mailbox. (typ, [data]) = <instance>.delete(mailbox)
Delete old mailbox.
[ "Delete", "old", "mailbox", "." ]
def delete(self, mailbox): """Delete old mailbox. (typ, [data]) = <instance>.delete(mailbox) """ return self._simple_command('DELETE', mailbox)
[ "def", "delete", "(", "self", ",", "mailbox", ")", ":", "return", "self", ".", "_simple_command", "(", "'DELETE'", ",", "mailbox", ")" ]
https://github.com/OpenEndedGroup/Field/blob/4f7c8edfb01bb0ccc927b78d3c500f018a4ae37c/Contents/lib/python/imaplib.py#L398-L403
PaddlePaddle/PaddleX
2bab73f81ab54e328204e7871e6ae4a82e719f5d
paddlex/paddleseg/models/backbones/hrnet.py
python
HRNet.forward
(self, x)
return [x]
[]
def forward(self, x): conv1 = self.conv_layer1_1(x) conv2 = self.conv_layer1_2(conv1) la1 = self.la1(conv2) tr1 = self.tr1([la1]) st2 = self.st2(tr1) tr2 = self.tr2(st2) st3 = self.st3(tr2) tr3 = self.tr3(st3) st4 = self.st4(tr3) size ...
[ "def", "forward", "(", "self", ",", "x", ")", ":", "conv1", "=", "self", ".", "conv_layer1_1", "(", "x", ")", "conv2", "=", "self", ".", "conv_layer1_2", "(", "conv1", ")", "la1", "=", "self", ".", "la1", "(", "conv2", ")", "tr1", "=", "self", "....
https://github.com/PaddlePaddle/PaddleX/blob/2bab73f81ab54e328204e7871e6ae4a82e719f5d/paddlex/paddleseg/models/backbones/hrnet.py#L157-L181
jgagneastro/coffeegrindsize
22661ebd21831dba4cf32bfc6ba59fe3d49f879c
App/dist/coffeegrindsize.app/Contents/Resources/lib/python3.7/numpy/core/getlimits.py
python
_discovered_machar
(ftype)
return MachAr(lambda v: array([v], ftype), lambda v:_fr0(v.astype(params['itype']))[0], lambda v:array(_fr0(v)[0], ftype), lambda v: params['fmt'] % array(_fr0(v)[0], ftype), params['title'])
Create MachAr instance with found information on float types
Create MachAr instance with found information on float types
[ "Create", "MachAr", "instance", "with", "found", "information", "on", "float", "types" ]
def _discovered_machar(ftype): """ Create MachAr instance with found information on float types """ params = _MACHAR_PARAMS[ftype] return MachAr(lambda v: array([v], ftype), lambda v:_fr0(v.astype(params['itype']))[0], lambda v:array(_fr0(v)[0], ftype), ...
[ "def", "_discovered_machar", "(", "ftype", ")", ":", "params", "=", "_MACHAR_PARAMS", "[", "ftype", "]", "return", "MachAr", "(", "lambda", "v", ":", "array", "(", "[", "v", "]", ",", "ftype", ")", ",", "lambda", "v", ":", "_fr0", "(", "v", ".", "a...
https://github.com/jgagneastro/coffeegrindsize/blob/22661ebd21831dba4cf32bfc6ba59fe3d49f879c/App/dist/coffeegrindsize.app/Contents/Resources/lib/python3.7/numpy/core/getlimits.py#L282-L290
apple/ccs-calendarserver
13c706b985fb728b9aab42dc0fef85aae21921c3
txdav/common/datastore/sql_sharing.py
python
SharingMixIn._bindForResourceIDAndHomeID
(cls)
return cls._bindFor((bind.RESOURCE_ID == Parameter("resourceID")) .And(bind.HOME_RESOURCE_ID == Parameter("homeID")))
DAL query that looks up home bind rows by home child resource ID and home resource ID.
DAL query that looks up home bind rows by home child resource ID and home resource ID.
[ "DAL", "query", "that", "looks", "up", "home", "bind", "rows", "by", "home", "child", "resource", "ID", "and", "home", "resource", "ID", "." ]
def _bindForResourceIDAndHomeID(cls): """ DAL query that looks up home bind rows by home child resource ID and home resource ID. """ bind = cls._bindSchema return cls._bindFor((bind.RESOURCE_ID == Parameter("resourceID")) .And(bind.HOME_RESOURC...
[ "def", "_bindForResourceIDAndHomeID", "(", "cls", ")", ":", "bind", "=", "cls", ".", "_bindSchema", "return", "cls", ".", "_bindFor", "(", "(", "bind", ".", "RESOURCE_ID", "==", "Parameter", "(", "\"resourceID\"", ")", ")", ".", "And", "(", "bind", ".", ...
https://github.com/apple/ccs-calendarserver/blob/13c706b985fb728b9aab42dc0fef85aae21921c3/txdav/common/datastore/sql_sharing.py#L360-L367
XX-net/XX-Net
a9898cfcf0084195fb7e69b6bc834e59aecdf14f
python3.8.2/Lib/telnetlib.py
python
Telnet.mt_interact
(self)
Multithreaded version of interact().
Multithreaded version of interact().
[ "Multithreaded", "version", "of", "interact", "()", "." ]
def mt_interact(self): """Multithreaded version of interact().""" import _thread _thread.start_new_thread(self.listener, ()) while 1: line = sys.stdin.readline() if not line: break self.write(line.encode('ascii'))
[ "def", "mt_interact", "(", "self", ")", ":", "import", "_thread", "_thread", ".", "start_new_thread", "(", "self", ".", "listener", ",", "(", ")", ")", "while", "1", ":", "line", "=", "sys", ".", "stdin", ".", "readline", "(", ")", "if", "not", "line...
https://github.com/XX-net/XX-Net/blob/a9898cfcf0084195fb7e69b6bc834e59aecdf14f/python3.8.2/Lib/telnetlib.py#L563-L571
tensorflow/models
6b8bb0cbeb3e10415c7a87448f08adc3c484c1d3
official/projects/edgetpu/vision/modeling/mobilenet_edgetpu_v2_model_blocks.py
python
mobilenet_edgetpu_v2_base
( width_coefficient: float = 1.0, depth_coefficient: float = 1.0, stem_base_filters: int = 64, stem_kernel_size: int = 5, top_base_filters: int = 1280, group_base_size: int = 64, dropout_rate: float = 0.2, drop_connect_rate: float = 0.1, filter_size_overrides: Optional[Dict[int, int]...
return config
Creates MobilenetEdgeTPUV2 ModelConfig based on tuning parameters.
Creates MobilenetEdgeTPUV2 ModelConfig based on tuning parameters.
[ "Creates", "MobilenetEdgeTPUV2", "ModelConfig", "based", "on", "tuning", "parameters", "." ]
def mobilenet_edgetpu_v2_base( width_coefficient: float = 1.0, depth_coefficient: float = 1.0, stem_base_filters: int = 64, stem_kernel_size: int = 5, top_base_filters: int = 1280, group_base_size: int = 64, dropout_rate: float = 0.2, drop_connect_rate: float = 0.1, filter_size_overr...
[ "def", "mobilenet_edgetpu_v2_base", "(", "width_coefficient", ":", "float", "=", "1.0", ",", "depth_coefficient", ":", "float", "=", "1.0", ",", "stem_base_filters", ":", "int", "=", "64", ",", "stem_kernel_size", ":", "int", "=", "5", ",", "top_base_filters", ...
https://github.com/tensorflow/models/blob/6b8bb0cbeb3e10415c7a87448f08adc3c484c1d3/official/projects/edgetpu/vision/modeling/mobilenet_edgetpu_v2_model_blocks.py#L271-L333
alltheplaces/alltheplaces
bd858bd39ec93408029b013f41a8ea1da5b95727
locations/spiders/hilton.py
python
HiltonSpider.parse_grand_vacation_hotel
(self, response)
Parse Grand Vacation hotel resort page
Parse Grand Vacation hotel resort page
[ "Parse", "Grand", "Vacation", "hotel", "resort", "page" ]
def parse_grand_vacation_hotel(self, response): """Parse Grand Vacation hotel resort page""" properties = response.meta["properties"] lat, lon = response.xpath('//script/text()').re_first(r'.*google.maps.LatLng\(\s*(.*)\s+\);').split(',') properties.update({ "name": response....
[ "def", "parse_grand_vacation_hotel", "(", "self", ",", "response", ")", ":", "properties", "=", "response", ".", "meta", "[", "\"properties\"", "]", "lat", ",", "lon", "=", "response", ".", "xpath", "(", "'//script/text()'", ")", ".", "re_first", "(", "r'.*g...
https://github.com/alltheplaces/alltheplaces/blob/bd858bd39ec93408029b013f41a8ea1da5b95727/locations/spiders/hilton.py#L128-L139
nooperpudd/chinastock
bad839f1177bba21cacbf448ef20391702dbcf01
baseinfo.py
python
stock_base_code
()
根据同花顺股票列表数据,得到股票信息 code: 600383 name :金地集团 market: sh,sz sh:上证股票 sz:深证股票
根据同花顺股票列表数据,得到股票信息 code: 600383 name :金地集团 market: sh,sz sh:上证股票 sz:深证股票
[ "根据同花顺股票列表数据,得到股票信息", "code", ":", "600383", "name", ":", "金地集团", "market:", "sh", "sz", "sh", ":", "上证股票", "sz", ":", "深证股票" ]
def stock_base_code(): """ 根据同花顺股票列表数据,得到股票信息 code: 600383 name :金地集团 market: sh,sz sh:上证股票 sz:深证股票 """ file = os.path.dirname(__file__) + '/code.txt' regex = re.compile('(\d{6})') f = open(file, 'r') lines = f.readlines() for line in lines: line = line.strip(...
[ "def", "stock_base_code", "(", ")", ":", "file", "=", "os", ".", "path", ".", "dirname", "(", "__file__", ")", "+", "'/code.txt'", "regex", "=", "re", ".", "compile", "(", "'(\\d{6})'", ")", "f", "=", "open", "(", "file", ",", "'r'", ")", "lines", ...
https://github.com/nooperpudd/chinastock/blob/bad839f1177bba21cacbf448ef20391702dbcf01/baseinfo.py#L25-L46
TesterlifeRaymond/doraemon
d5cb6e34bd5f2aa97273ce0c0c9303e32beaa333
venv/lib/python3.6/site-packages/pip/_vendor/distlib/version.py
python
Matcher.match
(self, version)
return True
Check if the provided version matches the constraints. :param version: The version to match against this instance. :type version: String or :class:`Version` instance.
Check if the provided version matches the constraints.
[ "Check", "if", "the", "provided", "version", "matches", "the", "constraints", "." ]
def match(self, version): """ Check if the provided version matches the constraints. :param version: The version to match against this instance. :type version: String or :class:`Version` instance. """ if isinstance(version, string_types): version = self.versi...
[ "def", "match", "(", "self", ",", "version", ")", ":", "if", "isinstance", "(", "version", ",", "string_types", ")", ":", "version", "=", "self", ".", "version_class", "(", "version", ")", "for", "operator", ",", "constraint", ",", "prefix", "in", "self"...
https://github.com/TesterlifeRaymond/doraemon/blob/d5cb6e34bd5f2aa97273ce0c0c9303e32beaa333/venv/lib/python3.6/site-packages/pip/_vendor/distlib/version.py#L135-L154
leo-editor/leo-editor
383d6776d135ef17d73d935a2f0ecb3ac0e99494
leo/external/make_stub_files.py
python
Pattern.__repr__
(self)
return '%s: %s' % (self.find_s, self.repl_s)
Pattern.__repr__
Pattern.__repr__
[ "Pattern", ".", "__repr__" ]
def __repr__(self): '''Pattern.__repr__''' return '%s: %s' % (self.find_s, self.repl_s)
[ "def", "__repr__", "(", "self", ")", ":", "return", "'%s: %s'", "%", "(", "self", ".", "find_s", ",", "self", ".", "repl_s", ")" ]
https://github.com/leo-editor/leo-editor/blob/383d6776d135ef17d73d935a2f0ecb3ac0e99494/leo/external/make_stub_files.py#L1197-L1199
securesystemslab/zippy
ff0e84ac99442c2c55fe1d285332cfd4e185e089
zippy/benchmarks/src/benchmarks/sympy/examples/beginner/limits_examples.py
python
main
()
[]
def main(): x = Symbol("x") a = Symbol("a") h = Symbol("h") show( limit(sqrt(x**2 - 5*x + 6) - x, x, oo), -Rational(5)/2 ) show( limit(x*(sqrt(x**2 + 1) - x), x, oo), Rational(1)/2 ) show( limit(x - sqrt3(x**3 - 1), x, oo), Rational(0) ) show( limit(log(1 + exp(x))/x, x, -oo), Rational(0...
[ "def", "main", "(", ")", ":", "x", "=", "Symbol", "(", "\"x\"", ")", "a", "=", "Symbol", "(", "\"a\"", ")", "h", "=", "Symbol", "(", "\"h\"", ")", "show", "(", "limit", "(", "sqrt", "(", "x", "**", "2", "-", "5", "*", "x", "+", "6", ")", ...
https://github.com/securesystemslab/zippy/blob/ff0e84ac99442c2c55fe1d285332cfd4e185e089/zippy/benchmarks/src/benchmarks/sympy/examples/beginner/limits_examples.py#L19-L38
aplanas/kmanga
61162f09e8c61fa22831aea101b2899a28bf01fc
kmanga/scrapyctl/mobictl.py
python
MobiCtl.create_mobi
(self)
return mobi_info
Create the MOBI file and return a list of files and names.
Create the MOBI file and return a list of files and names.
[ "Create", "the", "MOBI", "file", "and", "return", "a", "list", "of", "files", "and", "names", "." ]
def create_mobi(self): """Create the MOBI file and return a list of files and names.""" cache = MobiCache(settings.MOBI_STORE) if self.issue.url not in cache: mobi_and_containers = self._create_mobi() # XXX TODO - We are not storing stats in the cache anymore (is ...
[ "def", "create_mobi", "(", "self", ")", ":", "cache", "=", "MobiCache", "(", "settings", ".", "MOBI_STORE", ")", "if", "self", ".", "issue", ".", "url", "not", "in", "cache", ":", "mobi_and_containers", "=", "self", ".", "_create_mobi", "(", ")", "# XXX ...
https://github.com/aplanas/kmanga/blob/61162f09e8c61fa22831aea101b2899a28bf01fc/kmanga/scrapyctl/mobictl.py#L143-L158
omaha-consulting/omaha-server
1aa507b51e3656b490f72a3c9d60ee9d085e389e
omaha_server/omaha_server/s3utils.py
python
BaseS3Storage.url
(self, name)
return url
[]
def url(self, name): url = super(BaseS3Storage, self).url(name) if not self.querystring_auth: f = furl(url) if 'x-amz-security-token' in f.args: del f.args['x-amz-security-token'] url = f.url return url
[ "def", "url", "(", "self", ",", "name", ")", ":", "url", "=", "super", "(", "BaseS3Storage", ",", "self", ")", ".", "url", "(", "name", ")", "if", "not", "self", ".", "querystring_auth", ":", "f", "=", "furl", "(", "url", ")", "if", "'x-amz-securit...
https://github.com/omaha-consulting/omaha-server/blob/1aa507b51e3656b490f72a3c9d60ee9d085e389e/omaha_server/omaha_server/s3utils.py#L9-L16
liuyubobobo/Play-with-Linear-Algebra
e86175adb908b03756618fbeeeadb448a3551321
13-Eigenvalues-and-Eigenvectors/09-Implement-Our-Own-Diagonalization/playLA/Vector.py
python
Vector.__mul__
(self, k)
return Vector([k * e for e in self])
返回数量乘法的结果向量:self * k
返回数量乘法的结果向量:self * k
[ "返回数量乘法的结果向量:self", "*", "k" ]
def __mul__(self, k): """返回数量乘法的结果向量:self * k""" return Vector([k * e for e in self])
[ "def", "__mul__", "(", "self", ",", "k", ")", ":", "return", "Vector", "(", "[", "k", "*", "e", "for", "e", "in", "self", "]", ")" ]
https://github.com/liuyubobobo/Play-with-Linear-Algebra/blob/e86175adb908b03756618fbeeeadb448a3551321/13-Eigenvalues-and-Eigenvectors/09-Implement-Our-Own-Diagonalization/playLA/Vector.py#L50-L52
baidu/information-extraction
d0a536d8dc55761e50d38e7434dc19f3a8477e9b
bin/so_labeling/spo_data_reader.py
python
DataReader._get_token_idx
(self, sentence_term_list, sentence)
return token_idx_list
Get the start offset of every token
Get the start offset of every token
[ "Get", "the", "start", "offset", "of", "every", "token" ]
def _get_token_idx(self, sentence_term_list, sentence): """Get the start offset of every token""" token_idx_list = [] start_idx = 0 for sent_term in sentence_term_list: if start_idx >= len(sentence): break token_idx_list.append(start_idx) ...
[ "def", "_get_token_idx", "(", "self", ",", "sentence_term_list", ",", "sentence", ")", ":", "token_idx_list", "=", "[", "]", "start_idx", "=", "0", "for", "sent_term", "in", "sentence_term_list", ":", "if", "start_idx", ">=", "len", "(", "sentence", ")", ":"...
https://github.com/baidu/information-extraction/blob/d0a536d8dc55761e50d38e7434dc19f3a8477e9b/bin/so_labeling/spo_data_reader.py#L107-L116
PINTO0309/PINTO_model_zoo
2924acda7a7d541d8712efd7cc4fd1c61ef5bddd
077_ESRGAN/demo/demo_ESRGAN_onnx.py
python
draw_debug
(image, elapsed_time, hr_image)
return image, concat_image, debug_image, hr_image
[]
def draw_debug(image, elapsed_time, hr_image): hr_width, hr_height = hr_image.shape[1], hr_image.shape[0] # Up-conversion using OpenCV Resize for comparison debug_image = copy.deepcopy(image) debug_image = cv.resize( debug_image, dsize=(hr_width, hr_height), interpolation=cv.INT...
[ "def", "draw_debug", "(", "image", ",", "elapsed_time", ",", "hr_image", ")", ":", "hr_width", ",", "hr_height", "=", "hr_image", ".", "shape", "[", "1", "]", ",", "hr_image", ".", "shape", "[", "0", "]", "# Up-conversion using OpenCV Resize for comparison", "...
https://github.com/PINTO0309/PINTO_model_zoo/blob/2924acda7a7d541d8712efd7cc4fd1c61ef5bddd/077_ESRGAN/demo/demo_ESRGAN_onnx.py#L96-L119
dimagi/commcare-hq
d67ff1d3b4c51fa050c19e60c3253a79d3452a39
corehq/apps/domain/views/fixtures.py
python
LocationFixtureConfigView.page_context
(self)
return {'form': form}
[]
def page_context(self): location_settings = LocationFixtureConfiguration.for_domain(self.domain) form = LocationFixtureForm(instance=location_settings) return {'form': form}
[ "def", "page_context", "(", "self", ")", ":", "location_settings", "=", "LocationFixtureConfiguration", ".", "for_domain", "(", "self", ".", "domain", ")", "form", "=", "LocationFixtureForm", "(", "instance", "=", "location_settings", ")", "return", "{", "'form'",...
https://github.com/dimagi/commcare-hq/blob/d67ff1d3b4c51fa050c19e60c3253a79d3452a39/corehq/apps/domain/views/fixtures.py#L33-L36
Tencent/QT4A
cc99ce12bd10f864c95b7bf0675fd1b757bce4bb
qt4a/androiddriver/devicedriver.py
python
DeviceDriver._content_provider_patch_func
(self, func)
return wrap_func
解决4.0以下版本手机中访问ContentProvider的限制
解决4.0以下版本手机中访问ContentProvider的限制
[ "解决4", ".", "0以下版本手机中访问ContentProvider的限制" ]
def _content_provider_patch_func(self, func): """解决4.0以下版本手机中访问ContentProvider的限制 """ def wrap_func(*args, **kwargs): if self.adb.get_sdk_version() >= 16: return func(*args, **kwargs) else: result = func(*args, **kwargs) if...
[ "def", "_content_provider_patch_func", "(", "self", ",", "func", ")", ":", "def", "wrap_func", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "if", "self", ".", "adb", ".", "get_sdk_version", "(", ")", ">=", "16", ":", "return", "func", "(", "*...
https://github.com/Tencent/QT4A/blob/cc99ce12bd10f864c95b7bf0675fd1b757bce4bb/qt4a/androiddriver/devicedriver.py#L1042-L1064
Jenyay/outwiker
50530cf7b3f71480bb075b2829bc0669773b835b
plugins/webpage/webpage/libs/email/message.py
python
Message.get_boundary
(self, failobj=None)
return utils.collapse_rfc2231_value(boundary).rstrip()
Return the boundary associated with the payload if present. The boundary is extracted from the Content-Type header's `boundary' parameter, and it is unquoted.
Return the boundary associated with the payload if present.
[ "Return", "the", "boundary", "associated", "with", "the", "payload", "if", "present", "." ]
def get_boundary(self, failobj=None): """Return the boundary associated with the payload if present. The boundary is extracted from the Content-Type header's `boundary' parameter, and it is unquoted. """ missing = object() boundary = self.get_param('boundary', missing) ...
[ "def", "get_boundary", "(", "self", ",", "failobj", "=", "None", ")", ":", "missing", "=", "object", "(", ")", "boundary", "=", "self", ".", "get_param", "(", "'boundary'", ",", "missing", ")", "if", "boundary", "is", "missing", ":", "return", "failobj",...
https://github.com/Jenyay/outwiker/blob/50530cf7b3f71480bb075b2829bc0669773b835b/plugins/webpage/webpage/libs/email/message.py#L822-L833
mypaint/mypaint
90b36dbc7b8bd2f323383f7edf608a5e0a3a1a33
lib/layer/tree.py
python
RootLayerStack.path_above
(self, path, insert=False)
return None
Return the path for the layer stacked above a given path :param path: a layer path :type path: list or tuple :param insert: get an insertion path :type insert: bool :return: the layer above `path` in walk order :rtype: tuple Normally this is used for locating th...
Return the path for the layer stacked above a given path
[ "Return", "the", "path", "for", "the", "layer", "stacked", "above", "a", "given", "path" ]
def path_above(self, path, insert=False): """Return the path for the layer stacked above a given path :param path: a layer path :type path: list or tuple :param insert: get an insertion path :type insert: bool :return: the layer above `path` in walk order :rtype:...
[ "def", "path_above", "(", "self", ",", "path", ",", "insert", "=", "False", ")", ":", "path", "=", "tuple", "(", "path", ")", "if", "len", "(", "path", ")", "==", "0", ":", "raise", "ValueError", "(", "\"Path identifies the root stack\"", ")", "if", "i...
https://github.com/mypaint/mypaint/blob/90b36dbc7b8bd2f323383f7edf608a5e0a3a1a33/lib/layer/tree.py#L1180-L1252
elastic/elasticsearch-py
6ef1adfa3c840a84afda7369cd8e43ae7dc45cdb
elasticsearch/_async/client/ingest.py
python
IngestClient.geo_ip_stats
( self, *, error_trace: Optional[bool] = None, filter_path: Optional[Union[List[str], str]] = None, human: Optional[bool] = None, pretty: Optional[bool] = None, )
return await self._perform_request("GET", __target, headers=__headers)
Returns statistical information about geoip databases `<https://www.elastic.co/guide/en/elasticsearch/reference/master/geoip-stats-api.html>`_
Returns statistical information about geoip databases
[ "Returns", "statistical", "information", "about", "geoip", "databases" ]
async def geo_ip_stats( self, *, error_trace: Optional[bool] = None, filter_path: Optional[Union[List[str], str]] = None, human: Optional[bool] = None, pretty: Optional[bool] = None, ) -> ObjectApiResponse[Any]: """ Returns statistical information abou...
[ "async", "def", "geo_ip_stats", "(", "self", ",", "*", ",", "error_trace", ":", "Optional", "[", "bool", "]", "=", "None", ",", "filter_path", ":", "Optional", "[", "Union", "[", "List", "[", "str", "]", ",", "str", "]", "]", "=", "None", ",", "hum...
https://github.com/elastic/elasticsearch-py/blob/6ef1adfa3c840a84afda7369cd8e43ae7dc45cdb/elasticsearch/_async/client/ingest.py#L72-L100
ronf/asyncssh
ee1714c598d8c2ea6f5484e465443f38b68714aa
asyncssh/sk_ecdsa.py
python
_SKECDSAKey.make_public
(cls, key_params: object)
return cls(curve_id, public_value, application)
Construct a U2F ECDSA public key
Construct a U2F ECDSA public key
[ "Construct", "a", "U2F", "ECDSA", "public", "key" ]
def make_public(cls, key_params: object) -> SSHKey: """Construct a U2F ECDSA public key""" curve_id, public_value, application = cast(_PublicKeyArgs, key_params) return cls(curve_id, public_value, application)
[ "def", "make_public", "(", "cls", ",", "key_params", ":", "object", ")", "->", "SSHKey", ":", "curve_id", ",", "public_value", ",", "application", "=", "cast", "(", "_PublicKeyArgs", ",", "key_params", ")", "return", "cls", "(", "curve_id", ",", "public_valu...
https://github.com/ronf/asyncssh/blob/ee1714c598d8c2ea6f5484e465443f38b68714aa/asyncssh/sk_ecdsa.py#L107-L112
michaelhelmick/django-balancer
b5253a4b2975f2a91c9291c6b38be4a4ebca9c50
balancer/mixins.py
python
MasterSlaveMixin.allow_syncdb
(self, db, model)
return db == self.master
Only allow syncdb on the master
Only allow syncdb on the master
[ "Only", "allow", "syncdb", "on", "the", "master" ]
def allow_syncdb(self, db, model): """Only allow syncdb on the master""" return db == self.master
[ "def", "allow_syncdb", "(", "self", ",", "db", ",", "model", ")", ":", "return", "db", "==", "self", ".", "master" ]
https://github.com/michaelhelmick/django-balancer/blob/b5253a4b2975f2a91c9291c6b38be4a4ebca9c50/balancer/mixins.py#L28-L30
PMEAL/OpenPNM
c9514b858d1361b2090b2f9579280cbcd476c9b0
openpnm/models/geometry/pore_size/_funcs.py
python
largest_sphere
(target, fixed_diameter='pore.fixed_diameter', iters=5)
return D[network.pores(target.name)]
r""" Finds the maximum diameter pore that can be placed in each location without overlapping any neighbors. Parameters ---------- %(models.target.parameters)s fixed_diameter : string Name of the dictionary key on ``target`` where the array containing pore diameter values is stor...
r""" Finds the maximum diameter pore that can be placed in each location without overlapping any neighbors.
[ "r", "Finds", "the", "maximum", "diameter", "pore", "that", "can", "be", "placed", "in", "each", "location", "without", "overlapping", "any", "neighbors", "." ]
def largest_sphere(target, fixed_diameter='pore.fixed_diameter', iters=5): r""" Finds the maximum diameter pore that can be placed in each location without overlapping any neighbors. Parameters ---------- %(models.target.parameters)s fixed_diameter : string Name of the dictionary ke...
[ "def", "largest_sphere", "(", "target", ",", "fixed_diameter", "=", "'pore.fixed_diameter'", ",", "iters", "=", "5", ")", ":", "network", "=", "target", ".", "project", ".", "network", "P12", "=", "network", "[", "'throat.conns'", "]", "C1", "=", "network", ...
https://github.com/PMEAL/OpenPNM/blob/c9514b858d1361b2090b2f9579280cbcd476c9b0/openpnm/models/geometry/pore_size/_funcs.py#L60-L128
PyMVPA/PyMVPA
76c476b3de8264b0bb849bf226da5674d659564e
mvpa2/generators/splitters.py
python
Splitter.generate
(self, ds)
Yield dataset splits. Parameters ---------- ds: Dataset Input dataset Returns ------- generator The generator yields every possible split according to the splitter configuration. All generated dataset have a boolean 'lastsplit' at...
Yield dataset splits.
[ "Yield", "dataset", "splits", "." ]
def generate(self, ds): """Yield dataset splits. Parameters ---------- ds: Dataset Input dataset Returns ------- generator The generator yields every possible split according to the splitter configuration. All generated dataset have...
[ "def", "generate", "(", "self", ",", "ds", ")", ":", "# localbinding", "noslicing", "=", "self", ".", "__noslicing", "count", "=", "self", ".", "__count", "splattr", "=", "self", ".", "get_space", "(", ")", "ignore", "=", "self", ".", "__splitattr_ignore",...
https://github.com/PyMVPA/PyMVPA/blob/76c476b3de8264b0bb849bf226da5674d659564e/mvpa2/generators/splitters.py#L74-L167
strohne/Facepager
c69b7728f692cafd9207e0fb20706aa9563175ac
src/apimodules.py
python
ApiTab.idtostr
(self, val)
return str(val).encode("utf-8")
Return the Node-ID as a string
Return the Node-ID as a string
[ "Return", "the", "Node", "-", "ID", "as", "a", "string" ]
def idtostr(self, val): """ Return the Node-ID as a string """ return str(val).encode("utf-8")
[ "def", "idtostr", "(", "self", ",", "val", ")", ":", "return", "str", "(", "val", ")", ".", "encode", "(", "\"utf-8\"", ")" ]
https://github.com/strohne/Facepager/blob/c69b7728f692cafd9207e0fb20706aa9563175ac/src/apimodules.py#L118-L122
FederatedAI/FATE
32540492623568ecd1afcb367360133616e02fa3
python/federatedml/secureprotol/hash/hash_factory.py
python
compute_sha256
(value)
return hashlib.sha256(bytes(value, encoding='utf-8')).hexdigest()
[]
def compute_sha256(value): return hashlib.sha256(bytes(value, encoding='utf-8')).hexdigest()
[ "def", "compute_sha256", "(", "value", ")", ":", "return", "hashlib", ".", "sha256", "(", "bytes", "(", "value", ",", "encoding", "=", "'utf-8'", ")", ")", ".", "hexdigest", "(", ")" ]
https://github.com/FederatedAI/FATE/blob/32540492623568ecd1afcb367360133616e02fa3/python/federatedml/secureprotol/hash/hash_factory.py#L19-L20
tomplus/kubernetes_asyncio
f028cc793e3a2c519be6a52a49fb77ff0b014c9b
kubernetes_asyncio/client/models/v1_vsphere_virtual_disk_volume_source.py
python
V1VsphereVirtualDiskVolumeSource.__repr__
(self)
return self.to_str()
For `print` and `pprint`
For `print` and `pprint`
[ "For", "print", "and", "pprint" ]
def __repr__(self): """For `print` and `pprint`""" return self.to_str()
[ "def", "__repr__", "(", "self", ")", ":", "return", "self", ".", "to_str", "(", ")" ]
https://github.com/tomplus/kubernetes_asyncio/blob/f028cc793e3a2c519be6a52a49fb77ff0b014c9b/kubernetes_asyncio/client/models/v1_vsphere_virtual_disk_volume_source.py#L191-L193
globaleaks/GlobaLeaks
4624ca937728adb8e21c4733a8aecec6a41cb3db
backend/globaleaks/handlers/admin/node.py
python
NodeInstance.get
(self)
Get the node infos.
Get the node infos.
[ "Get", "the", "node", "infos", "." ]
def get(self): """ Get the node infos. """ config = yield self.determine_allow_config_filter() serialized_node = yield tw(db_admin_serialize_node, self.request.tid, self.request.language, ...
[ "def", "get", "(", "self", ")", ":", "config", "=", "yield", "self", ".", "determine_allow_config_filter", "(", ")", "serialized_node", "=", "yield", "tw", "(", "db_admin_serialize_node", ",", "self", ".", "request", ".", "tid", ",", "self", ".", "request", ...
https://github.com/globaleaks/GlobaLeaks/blob/4624ca937728adb8e21c4733a8aecec6a41cb3db/backend/globaleaks/handlers/admin/node.py#L172-L181
azavea/raster-vision
fc181a6f31f085affa1ee12f0204bdbc5a6bf85a
rastervision_pytorch_learner/rastervision/pytorch_learner/utils/utils.py
python
validate_albumentation_transform
(tf: dict)
return tf
Validate a serialized albumentation transform.
Validate a serialized albumentation transform.
[ "Validate", "a", "serialized", "albumentation", "transform", "." ]
def validate_albumentation_transform(tf: dict): """ Validate a serialized albumentation transform. """ if tf is not None: try: A.from_dict(tf) except Exception: raise ConfigError('The given serialization is invalid. Use ' 'A.to_dict(transform...
[ "def", "validate_albumentation_transform", "(", "tf", ":", "dict", ")", ":", "if", "tf", "is", "not", "None", ":", "try", ":", "A", ".", "from_dict", "(", "tf", ")", "except", "Exception", ":", "raise", "ConfigError", "(", "'The given serialization is invalid....
https://github.com/azavea/raster-vision/blob/fc181a6f31f085affa1ee12f0204bdbc5a6bf85a/rastervision_pytorch_learner/rastervision/pytorch_learner/utils/utils.py#L74-L82
nlloyd/SubliminalCollaborator
5c619e17ddbe8acb9eea8996ec038169ddcd50a1
libs/twisted/conch/client/options.py
python
ConchOptions.opt_macs
(self, macs)
Specify MAC algorithms
Specify MAC algorithms
[ "Specify", "MAC", "algorithms" ]
def opt_macs(self, macs): "Specify MAC algorithms" macs = macs.split(',') for mac in macs: if not SSHCiphers.macMap.has_key(mac): sys.exit("Unknown mac type '%s'" % mac) self['macs'] = macs
[ "def", "opt_macs", "(", "self", ",", "macs", ")", ":", "macs", "=", "macs", ".", "split", "(", "','", ")", "for", "mac", "in", "macs", ":", "if", "not", "SSHCiphers", ".", "macMap", ".", "has_key", "(", "mac", ")", ":", "sys", ".", "exit", "(", ...
https://github.com/nlloyd/SubliminalCollaborator/blob/5c619e17ddbe8acb9eea8996ec038169ddcd50a1/libs/twisted/conch/client/options.py#L73-L79
astropy/photutils
3caa48e4e4d139976ed7457dc41583fb2c56ba20
photutils/isophote/isophote.py
python
Isophote.pa
(self)
return self.sample.geometry.pa
The position angle (radians) of the ellipse.
The position angle (radians) of the ellipse.
[ "The", "position", "angle", "(", "radians", ")", "of", "the", "ellipse", "." ]
def pa(self): """The position angle (radians) of the ellipse.""" return self.sample.geometry.pa
[ "def", "pa", "(", "self", ")", ":", "return", "self", ".", "sample", ".", "geometry", ".", "pa" ]
https://github.com/astropy/photutils/blob/3caa48e4e4d139976ed7457dc41583fb2c56ba20/photutils/isophote/isophote.py#L163-L165
caiiiac/Machine-Learning-with-Python
1a26c4467da41ca4ebc3d5bd789ea942ef79422f
MachineLearning/venv/lib/python3.5/site-packages/pandas/io/pytables.py
python
Table.data_orientation
(self)
return tuple(itertools.chain([int(a[0]) for a in self.non_index_axes], [int(a.axis) for a in self.index_axes]))
return a tuple of my permutated axes, non_indexable at the front
return a tuple of my permutated axes, non_indexable at the front
[ "return", "a", "tuple", "of", "my", "permutated", "axes", "non_indexable", "at", "the", "front" ]
def data_orientation(self): """return a tuple of my permutated axes, non_indexable at the front""" return tuple(itertools.chain([int(a[0]) for a in self.non_index_axes], [int(a.axis) for a in self.index_axes]))
[ "def", "data_orientation", "(", "self", ")", ":", "return", "tuple", "(", "itertools", ".", "chain", "(", "[", "int", "(", "a", "[", "0", "]", ")", "for", "a", "in", "self", ".", "non_index_axes", "]", ",", "[", "int", "(", "a", ".", "axis", ")",...
https://github.com/caiiiac/Machine-Learning-with-Python/blob/1a26c4467da41ca4ebc3d5bd789ea942ef79422f/MachineLearning/venv/lib/python3.5/site-packages/pandas/io/pytables.py#L3073-L3076
andresriancho/w3af
cd22e5252243a87aaa6d0ddea47cf58dacfe00a9
w3af/plugins/attack/db/sqlmap/thirdparty/bottle/bottle.py
python
Bottle.__exit__
(self, exc_type, exc_value, traceback)
[]
def __exit__(self, exc_type, exc_value, traceback): default_app.pop()
[ "def", "__exit__", "(", "self", ",", "exc_type", ",", "exc_value", ",", "traceback", ")", ":", "default_app", ".", "pop", "(", ")" ]
https://github.com/andresriancho/w3af/blob/cd22e5252243a87aaa6d0ddea47cf58dacfe00a9/w3af/plugins/attack/db/sqlmap/thirdparty/bottle/bottle.py#L1070-L1071
mail-in-a-box/mailinabox
520caf65571c0cdbac88e7fb56c04bacfb112778
management/utils.py
python
write_settings
(config, env)
[]
def write_settings(config, env): import rtyaml fn = os.path.join(env['STORAGE_ROOT'], 'settings.yaml') with open(fn, "w") as f: f.write(rtyaml.dump(config))
[ "def", "write_settings", "(", "config", ",", "env", ")", ":", "import", "rtyaml", "fn", "=", "os", ".", "path", ".", "join", "(", "env", "[", "'STORAGE_ROOT'", "]", ",", "'settings.yaml'", ")", "with", "open", "(", "fn", ",", "\"w\"", ")", "as", "f",...
https://github.com/mail-in-a-box/mailinabox/blob/520caf65571c0cdbac88e7fb56c04bacfb112778/management/utils.py#L27-L31
bleachbit/bleachbit
88fc4452936d02b56a76f07ce2142306bb47262b
bleachbit/markovify/text.py
python
Text.make_sentence_with_start
(self, beginning, strict=True, **kwargs)
return None
Tries making a sentence that begins with `beginning` string, which should be a string of one to `self.state` words known to exist in the corpus. If strict == True, then markovify will draw its initial inspiration only from sentences that start with the specified word/phrase. ...
Tries making a sentence that begins with `beginning` string, which should be a string of one to `self.state` words known to exist in the corpus. If strict == True, then markovify will draw its initial inspiration only from sentences that start with the specified word/phrase.
[ "Tries", "making", "a", "sentence", "that", "begins", "with", "beginning", "string", "which", "should", "be", "a", "string", "of", "one", "to", "self", ".", "state", "words", "known", "to", "exist", "in", "the", "corpus", ".", "If", "strict", "==", "True...
def make_sentence_with_start(self, beginning, strict=True, **kwargs): """ Tries making a sentence that begins with `beginning` string, which should be a string of one to `self.state` words known to exist in the corpus. If strict == True, then markovify will draw its init...
[ "def", "make_sentence_with_start", "(", "self", ",", "beginning", ",", "strict", "=", "True", ",", "*", "*", "kwargs", ")", ":", "split", "=", "tuple", "(", "self", ".", "word_split", "(", "beginning", ")", ")", "word_count", "=", "len", "(", "split", ...
https://github.com/bleachbit/bleachbit/blob/88fc4452936d02b56a76f07ce2142306bb47262b/bleachbit/markovify/text.py#L186-L225
robhagemans/pcbasic
c3a043b46af66623a801e18a38175be077251ada
pcbasic/basic/base/codestream.py
python
StreamWrapper.__init__
(self, stream)
Set up codec.
Set up codec.
[ "Set", "up", "codec", "." ]
def __init__(self, stream): """Set up codec.""" self._stream = stream
[ "def", "__init__", "(", "self", ",", "stream", ")", ":", "self", ".", "_stream", "=", "stream" ]
https://github.com/robhagemans/pcbasic/blob/c3a043b46af66623a801e18a38175be077251ada/pcbasic/basic/base/codestream.py#L20-L22
cortex-lab/phy
9a330b9437a3d0b40a37a201d147224e6e7fb462
phy/gui/widgets.py
python
HTMLBuilder.set_body_src
(self, filename)
Set the path to an HTML file containing the body of the widget.
Set the path to an HTML file containing the body of the widget.
[ "Set", "the", "path", "to", "an", "HTML", "file", "containing", "the", "body", "of", "the", "widget", "." ]
def set_body_src(self, filename): """Set the path to an HTML file containing the body of the widget.""" path = _static_abs_path(filename) self.set_body(read_text(path))
[ "def", "set_body_src", "(", "self", ",", "filename", ")", ":", "path", "=", "_static_abs_path", "(", "filename", ")", "self", ".", "set_body", "(", "read_text", "(", "path", ")", ")" ]
https://github.com/cortex-lab/phy/blob/9a330b9437a3d0b40a37a201d147224e6e7fb462/phy/gui/widgets.py#L231-L234
pwnieexpress/pwn_plug_sources
1a23324f5dc2c3de20f9c810269b6a29b2758cad
src/goodfet/GoodFETCC.py
python
GoodFETCC.flash
(self,file)
Flash an intel hex file to code memory.
Flash an intel hex file to code memory.
[ "Flash", "an", "intel", "hex", "file", "to", "code", "memory", "." ]
def flash(self,file): """Flash an intel hex file to code memory.""" print "Flashing %s" % file; h = IntelHex(file); page = 0x0000; pagelen = self.CCpagesize(); #Varies by chip. #print "page=%04x, pagelen=%04x" % (page,pagelen); bcount = ...
[ "def", "flash", "(", "self", ",", "file", ")", ":", "print", "\"Flashing %s\"", "%", "file", "h", "=", "IntelHex", "(", "file", ")", "page", "=", "0x0000", "pagelen", "=", "self", ".", "CCpagesize", "(", ")", "#Varies by chip.", "#print \"page=%04x, pagelen=...
https://github.com/pwnieexpress/pwn_plug_sources/blob/1a23324f5dc2c3de20f9c810269b6a29b2758cad/src/goodfet/GoodFETCC.py#L350-L381
dragonfly/dragonfly
a579b5eadf452e23b07d4caf27b402703b0012b7
examples/detailed_use_cases/obj_3d_mf.py
python
cost
(z)
return 0.1 + 0.9 * normalised_z
Cost function.
Cost function.
[ "Cost", "function", "." ]
def cost(z): """ Cost function. """ normalised_z = (z[0] - 60.0)/ 120.0 return 0.1 + 0.9 * normalised_z
[ "def", "cost", "(", "z", ")", ":", "normalised_z", "=", "(", "z", "[", "0", "]", "-", "60.0", ")", "/", "120.0", "return", "0.1", "+", "0.9", "*", "normalised_z" ]
https://github.com/dragonfly/dragonfly/blob/a579b5eadf452e23b07d4caf27b402703b0012b7/examples/detailed_use_cases/obj_3d_mf.py#L20-L23
shiweibsw/Translation-Tools
2fbbf902364e557fa7017f9a74a8797b7440c077
venv/Lib/site-packages/pip-9.0.3-py3.6.egg/pip/_vendor/colorama/winterm.py
python
WinTerm.fore
(self, fore=None, light=False, on_stderr=False)
[]
def fore(self, fore=None, light=False, on_stderr=False): if fore is None: fore = self._default_fore self._fore = fore # Emulate LIGHT_EX with BRIGHT Style if light: self._light |= WinStyle.BRIGHT else: self._light &= ~WinStyle.BRIGHT se...
[ "def", "fore", "(", "self", ",", "fore", "=", "None", ",", "light", "=", "False", ",", "on_stderr", "=", "False", ")", ":", "if", "fore", "is", "None", ":", "fore", "=", "self", ".", "_default_fore", "self", ".", "_fore", "=", "fore", "# Emulate LIGH...
https://github.com/shiweibsw/Translation-Tools/blob/2fbbf902364e557fa7017f9a74a8797b7440c077/venv/Lib/site-packages/pip-9.0.3-py3.6.egg/pip/_vendor/colorama/winterm.py#L48-L57
getsentry/rb
6f96a68dca2d77e9ac1d8bdd7a21e2575af65a20
rb/clients.py
python
RoutingClient.get_fanout_client
(self, hosts, max_concurrency=64, auto_batch=None)
return FanoutClient( hosts, connection_pool=self.connection_pool, max_concurrency=max_concurrency, auto_batch=auto_batch, )
Returns a thread unsafe fanout client. Returns an instance of :class:`FanoutClient`.
Returns a thread unsafe fanout client.
[ "Returns", "a", "thread", "unsafe", "fanout", "client", "." ]
def get_fanout_client(self, hosts, max_concurrency=64, auto_batch=None): """Returns a thread unsafe fanout client. Returns an instance of :class:`FanoutClient`. """ if auto_batch is None: auto_batch = self.auto_batch return FanoutClient( hosts, ...
[ "def", "get_fanout_client", "(", "self", ",", "hosts", ",", "max_concurrency", "=", "64", ",", "auto_batch", "=", "None", ")", ":", "if", "auto_batch", "is", "None", ":", "auto_batch", "=", "self", ".", "auto_batch", "return", "FanoutClient", "(", "hosts", ...
https://github.com/getsentry/rb/blob/6f96a68dca2d77e9ac1d8bdd7a21e2575af65a20/rb/clients.py#L548-L560
Azure/azure-linux-extensions
a42ef718c746abab2b3c6a21da87b29e76364558
Diagnostic/Utils/lad_logging_config.py
python
LadLoggingConfig.get_fluentd_syslog_src_config
(self)
return '' if self._syslog_disabled else fluentd_syslog_src_config
Get Fluentd's syslog source config that should be used for this LAD's syslog configs. :rtype: str :return: Fluentd config string that should be overwritten to /etc/opt/microsoft/omsagent/LAD/conf/omsagent.d/syslog.conf (after replacing '%SYSLOG_PORT%' with the assigned/...
Get Fluentd's syslog source config that should be used for this LAD's syslog configs. :rtype: str :return: Fluentd config string that should be overwritten to /etc/opt/microsoft/omsagent/LAD/conf/omsagent.d/syslog.conf (after replacing '%SYSLOG_PORT%' with the assigned/...
[ "Get", "Fluentd", "s", "syslog", "source", "config", "that", "should", "be", "used", "for", "this", "LAD", "s", "syslog", "configs", ".", ":", "rtype", ":", "str", ":", "return", ":", "Fluentd", "config", "string", "that", "should", "be", "overwritten", ...
def get_fluentd_syslog_src_config(self): """ Get Fluentd's syslog source config that should be used for this LAD's syslog configs. :rtype: str :return: Fluentd config string that should be overwritten to /etc/opt/microsoft/omsagent/LAD/conf/omsagent.d/syslog.conf ...
[ "def", "get_fluentd_syslog_src_config", "(", "self", ")", ":", "fluentd_syslog_src_config", "=", "\"\"\"\n<source>\n type syslog\n port %SYSLOG_PORT%\n bind 127.0.0.1\n protocol_type udp\n include_source_host true\n tag mdsd.syslog\n</source>\n\n# Generate fields expected for existing mdsd sys...
https://github.com/Azure/azure-linux-extensions/blob/a42ef718c746abab2b3c6a21da87b29e76364558/Diagnostic/Utils/lad_logging_config.py#L408-L444
coto/gae-boilerplate
470f2b61fcb0238c1ad02cc1f97e6017acbe9628
bp_includes/external/babel/messages/catalog.py
python
Catalog.check
(self)
Run various validation checks on the translations in the catalog. For every message which fails validation, this method yield a ``(message, errors)`` tuple, where ``message`` is the `Message` object and ``errors`` is a sequence of `TranslationError` objects. :rtype: ``iterator``
Run various validation checks on the translations in the catalog.
[ "Run", "various", "validation", "checks", "on", "the", "translations", "in", "the", "catalog", "." ]
def check(self): """Run various validation checks on the translations in the catalog. For every message which fails validation, this method yield a ``(message, errors)`` tuple, where ``message`` is the `Message` object and ``errors`` is a sequence of `TranslationError` objects. ...
[ "def", "check", "(", "self", ")", ":", "for", "message", "in", "self", ".", "_messages", ".", "values", "(", ")", ":", "errors", "=", "message", ".", "check", "(", "catalog", "=", "self", ")", "if", "errors", ":", "yield", "message", ",", "errors" ]
https://github.com/coto/gae-boilerplate/blob/470f2b61fcb0238c1ad02cc1f97e6017acbe9628/bp_includes/external/babel/messages/catalog.py#L632-L644
zhl2008/awd-platform
0416b31abea29743387b10b3914581fbe8e7da5e
web_flaskbb/lib/python2.7/site-packages/sqlalchemy/dialects/mssql/base.py
python
MSSQLCompiler.visit_rollback_to_savepoint
(self, savepoint_stmt)
return ("ROLLBACK TRANSACTION %s" % self.preparer.format_savepoint(savepoint_stmt))
[]
def visit_rollback_to_savepoint(self, savepoint_stmt): return ("ROLLBACK TRANSACTION %s" % self.preparer.format_savepoint(savepoint_stmt))
[ "def", "visit_rollback_to_savepoint", "(", "self", ",", "savepoint_stmt", ")", ":", "return", "(", "\"ROLLBACK TRANSACTION %s\"", "%", "self", ".", "preparer", ".", "format_savepoint", "(", "savepoint_stmt", ")", ")" ]
https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_flaskbb/lib/python2.7/site-packages/sqlalchemy/dialects/mssql/base.py#L1431-L1433
openedx/edx-platform
68dd185a0ab45862a2a61e0f803d7e03d2be71b5
common/lib/xmodule/xmodule/modulestore/split_mongo/split.py
python
SplitMongoModuleStore.create_course
( # lint-amnesty, pylint: disable=arguments-differ self, org, course, run, user_id, master_branch=None, fields=None, versions_dict=None, search_targets=None, root_category='course', root_block_id=None, **kwargs )
return self._create_courselike( locator, user_id, master_branch, fields, versions_dict, search_targets, root_category, root_block_id, **kwargs )
Create a new entry in the active courses index which points to an existing or new structure. Returns the course root of the resulting entry (the location has the course id) Arguments: org (str): the organization that owns the course course (str): the course number of the course...
Create a new entry in the active courses index which points to an existing or new structure. Returns the course root of the resulting entry (the location has the course id)
[ "Create", "a", "new", "entry", "in", "the", "active", "courses", "index", "which", "points", "to", "an", "existing", "or", "new", "structure", ".", "Returns", "the", "course", "root", "of", "the", "resulting", "entry", "(", "the", "location", "has", "the",...
def create_course( # lint-amnesty, pylint: disable=arguments-differ self, org, course, run, user_id, master_branch=None, fields=None, versions_dict=None, search_targets=None, root_category='course', root_block_id=None, **kwargs ): """ Create a new entry in the active courses...
[ "def", "create_course", "(", "# lint-amnesty, pylint: disable=arguments-differ", "self", ",", "org", ",", "course", ",", "run", ",", "user_id", ",", "master_branch", "=", "None", ",", "fields", "=", "None", ",", "versions_dict", "=", "None", ",", "search_targets",...
https://github.com/openedx/edx-platform/blob/68dd185a0ab45862a2a61e0f803d7e03d2be71b5/common/lib/xmodule/xmodule/modulestore/split_mongo/split.py#L1772-L1826
spesmilo/electrum
bdbd59300fbd35b01605e66145458e5f396108e8
electrum/wallet.py
python
Abstract_Wallet.get_key_for_outgoing_invoice
(cls, invoice: Invoice)
return key
Return the key to use for this invoice in self.invoices.
Return the key to use for this invoice in self.invoices.
[ "Return", "the", "key", "to", "use", "for", "this", "invoice", "in", "self", ".", "invoices", "." ]
def get_key_for_outgoing_invoice(cls, invoice: Invoice) -> str: """Return the key to use for this invoice in self.invoices.""" if invoice.is_lightning(): assert isinstance(invoice, LNInvoice) key = invoice.rhash else: assert isinstance(invoice, OnchainInvoice)...
[ "def", "get_key_for_outgoing_invoice", "(", "cls", ",", "invoice", ":", "Invoice", ")", "->", "str", ":", "if", "invoice", ".", "is_lightning", "(", ")", ":", "assert", "isinstance", "(", "invoice", ",", "LNInvoice", ")", "key", "=", "invoice", ".", "rhash...
https://github.com/spesmilo/electrum/blob/bdbd59300fbd35b01605e66145458e5f396108e8/electrum/wallet.py#L2301-L2309
007gzs/dingtalk-sdk
7979da2e259fdbc571728cae2425a04dbc65850a
dingtalk/client/api/taobao.py
python
TbDianZiMianDan.taobao_wlb_waybill_i_querydetail
( self, waybill_detail_query_request )
return self._top_request( "taobao.wlb.waybill.i.querydetail", { "waybill_detail_query_request": waybill_detail_query_request } )
查面单号状态v1.0 查看面单号的当前状态,如签收、发货、失效等。 文档地址:https://open-doc.dingtalk.com/docs/api.htm?apiId=23873 :param waybill_detail_query_request: 面单查询请求
查面单号状态v1.0 查看面单号的当前状态,如签收、发货、失效等。 文档地址:https://open-doc.dingtalk.com/docs/api.htm?apiId=23873
[ "查面单号状态v1", ".", "0", "查看面单号的当前状态,如签收、发货、失效等。", "文档地址:https", ":", "//", "open", "-", "doc", ".", "dingtalk", ".", "com", "/", "docs", "/", "api", ".", "htm?apiId", "=", "23873" ]
def taobao_wlb_waybill_i_querydetail( self, waybill_detail_query_request ): """ 查面单号状态v1.0 查看面单号的当前状态,如签收、发货、失效等。 文档地址:https://open-doc.dingtalk.com/docs/api.htm?apiId=23873 :param waybill_detail_query_request: 面单查询请求 """ return self._...
[ "def", "taobao_wlb_waybill_i_querydetail", "(", "self", ",", "waybill_detail_query_request", ")", ":", "return", "self", ".", "_top_request", "(", "\"taobao.wlb.waybill.i.querydetail\"", ",", "{", "\"waybill_detail_query_request\"", ":", "waybill_detail_query_request", "}", "...
https://github.com/007gzs/dingtalk-sdk/blob/7979da2e259fdbc571728cae2425a04dbc65850a/dingtalk/client/api/taobao.py#L46348-L46364
sagemath/sage
f9b2db94f675ff16963ccdefba4f1a3393b3fe0d
src/sage/graphs/bipartite_graph.py
python
BipartiteGraph.add_vertices
(self, vertices, left=False, right=False)
Add vertices to the bipartite graph from an iterable container of vertices. Vertices that already exist in the graph will not be added again. INPUT: - ``vertices`` -- sequence of vertices to add. - ``left`` -- (default: ``False``); either ``True`` or sequence of same ...
Add vertices to the bipartite graph from an iterable container of vertices.
[ "Add", "vertices", "to", "the", "bipartite", "graph", "from", "an", "iterable", "container", "of", "vertices", "." ]
def add_vertices(self, vertices, left=False, right=False): """ Add vertices to the bipartite graph from an iterable container of vertices. Vertices that already exist in the graph will not be added again. INPUT: - ``vertices`` -- sequence of vertices to add. -...
[ "def", "add_vertices", "(", "self", ",", "vertices", ",", "left", "=", "False", ",", "right", "=", "False", ")", ":", "# sanity check on partition specifiers", "if", "left", "and", "right", ":", "# also triggered if both lists are specified", "raise", "RuntimeError", ...
https://github.com/sagemath/sage/blob/f9b2db94f675ff16963ccdefba4f1a3393b3fe0d/src/sage/graphs/bipartite_graph.py#L583-L673
JimmXinu/FanFicFare
bc149a2deb2636320fe50a3e374af6eef8f61889
included_dependencies/bs4/element.py
python
HTMLAwareEntitySubstitution.substitute_xml
(cls, ns)
return cls._substitute_if_appropriate( ns, EntitySubstitution.substitute_xml)
[]
def substitute_xml(cls, ns): return cls._substitute_if_appropriate( ns, EntitySubstitution.substitute_xml)
[ "def", "substitute_xml", "(", "cls", ",", "ns", ")", ":", "return", "cls", ".", "_substitute_if_appropriate", "(", "ns", ",", "EntitySubstitution", ".", "substitute_xml", ")" ]
https://github.com/JimmXinu/FanFicFare/blob/bc149a2deb2636320fe50a3e374af6eef8f61889/included_dependencies/bs4/element.py#L135-L137
jeffzh3ng/fuxi
fadb1136b8896fe2a0f7783627bda867d5e6fd98
fuxi/common/thirdparty/theHarvester/discovery/duckduckgosearch.py
python
SearchDuckDuckGo.crawl
(self, text)
Function parses json and returns URLs. :param text: formatted json :return: set of URLs
Function parses json and returns URLs. :param text: formatted json :return: set of URLs
[ "Function", "parses", "json", "and", "returns", "URLs", ".", ":", "param", "text", ":", "formatted", "json", ":", "return", ":", "set", "of", "URLs" ]
async def crawl(self, text): """ Function parses json and returns URLs. :param text: formatted json :return: set of URLs """ urls = set() try: load = json.loads(text) for keys in load.keys(): # Iterate through keys of dict. ...
[ "async", "def", "crawl", "(", "self", ",", "text", ")", ":", "urls", "=", "set", "(", ")", "try", ":", "load", "=", "json", ".", "loads", "(", "text", ")", "for", "keys", "in", "load", ".", "keys", "(", ")", ":", "# Iterate through keys of dict.", ...
https://github.com/jeffzh3ng/fuxi/blob/fadb1136b8896fe2a0f7783627bda867d5e6fd98/fuxi/common/thirdparty/theHarvester/discovery/duckduckgosearch.py#L33-L73
blankwall/MacHeap
cb8f0ab8f9531186856e2d241e30de5285c29569
lib/ptypes/pbinary.py
python
_struct_generic.alias
(self, alias, target)
Add an alias from /alias/ to the field /target/
Add an alias from /alias/ to the field /target/
[ "Add", "an", "alias", "from", "/", "alias", "/", "to", "the", "field", "/", "target", "/" ]
def alias(self, alias, target): """Add an alias from /alias/ to the field /target/""" res = self.__getindex__(target) self.__fastindex[alias.lower()] = res
[ "def", "alias", "(", "self", ",", "alias", ",", "target", ")", ":", "res", "=", "self", ".", "__getindex__", "(", "target", ")", "self", ".", "__fastindex", "[", "alias", ".", "lower", "(", ")", "]", "=", "res" ]
https://github.com/blankwall/MacHeap/blob/cb8f0ab8f9531186856e2d241e30de5285c29569/lib/ptypes/pbinary.py#L555-L558
roclark/sportsipy
c19f545d3376d62ded6304b137dc69238ac620a9
sportsipy/nfl/roster.py
python
Player.yards_recovered_from_fumble
(self)
return self._yards_recovered_from_fumble
Returns an ``int`` of the number of yards the player gained after recovering a fumble.
Returns an ``int`` of the number of yards the player gained after recovering a fumble.
[ "Returns", "an", "int", "of", "the", "number", "of", "yards", "the", "player", "gained", "after", "recovering", "a", "fumble", "." ]
def yards_recovered_from_fumble(self): """ Returns an ``int`` of the number of yards the player gained after recovering a fumble. """ return self._yards_recovered_from_fumble
[ "def", "yards_recovered_from_fumble", "(", "self", ")", ":", "return", "self", ".", "_yards_recovered_from_fumble" ]
https://github.com/roclark/sportsipy/blob/c19f545d3376d62ded6304b137dc69238ac620a9/sportsipy/nfl/roster.py#L1642-L1647
projecthamster/hamster
19d160090de30e756bdc3122ff935bdaa86e2843
src/hamster/lib/datetime.py
python
hday.end
(self)
return datetime.from_day_time(self + timedelta(days=1), self.start_time())
Day end.
Day end.
[ "Day", "end", "." ]
def end(self) -> datetime: """Day end.""" return datetime.from_day_time(self + timedelta(days=1), self.start_time())
[ "def", "end", "(", "self", ")", "->", "datetime", ":", "return", "datetime", ".", "from_day_time", "(", "self", "+", "timedelta", "(", "days", "=", "1", ")", ",", "self", ".", "start_time", "(", ")", ")" ]
https://github.com/projecthamster/hamster/blob/19d160090de30e756bdc3122ff935bdaa86e2843/src/hamster/lib/datetime.py#L106-L108
researchmm/tasn
5dba8ccc096cedc63913730eeea14a9647911129
tasn-pytorch/mymodel/tasn.py
python
resnet18
(pretrained=False, progress=True, **kwargs)
return _resnet('resnet18', BasicBlock, [2, 2, 2, 2], True, pretrained, progress, **kwargs)
r"""ResNet-18 model from `"Deep Residual Learning for Image Recognition" <https://arxiv.org/pdf/1512.03385.pdf>`_ Args: pretrained (bool): If True, returns a model pre-trained on ImageNet progress (bool): If True, displays a progress bar of the download to stderr
r"""ResNet-18 model from `"Deep Residual Learning for Image Recognition" <https://arxiv.org/pdf/1512.03385.pdf>`_
[ "r", "ResNet", "-", "18", "model", "from", "Deep", "Residual", "Learning", "for", "Image", "Recognition", "<https", ":", "//", "arxiv", ".", "org", "/", "pdf", "/", "1512", ".", "03385", ".", "pdf", ">", "_" ]
def resnet18(pretrained=False, progress=True, **kwargs): r"""ResNet-18 model from `"Deep Residual Learning for Image Recognition" <https://arxiv.org/pdf/1512.03385.pdf>`_ Args: pretrained (bool): If True, returns a model pre-trained on ImageNet progress (bool): If True, displays a progress ...
[ "def", "resnet18", "(", "pretrained", "=", "False", ",", "progress", "=", "True", ",", "*", "*", "kwargs", ")", ":", "return", "_resnet", "(", "'resnet18'", ",", "BasicBlock", ",", "[", "2", ",", "2", ",", "2", ",", "2", "]", ",", "True", ",", "p...
https://github.com/researchmm/tasn/blob/5dba8ccc096cedc63913730eeea14a9647911129/tasn-pytorch/mymodel/tasn.py#L390-L399
awslabs/gluon-ts
066ec3b7f47aa4ee4c061a28f35db7edbad05a98
src/gluonts/mx/trainer/model_iteration_averaging.py
python
IterationAveragingStrategy.load_cached_model
(self, model: nn.HybridBlock)
r""" Parameters ---------- model The model that the cached model is loaded to.
r""" Parameters ---------- model The model that the cached model is loaded to.
[ "r", "Parameters", "----------", "model", "The", "model", "that", "the", "cached", "model", "is", "loaded", "to", "." ]
def load_cached_model(self, model: nn.HybridBlock): r""" Parameters ---------- model The model that the cached model is loaded to. """ if self.cached_model is not None: # load the cached model for name, param_cached in self.cached_model...
[ "def", "load_cached_model", "(", "self", ",", "model", ":", "nn", ".", "HybridBlock", ")", ":", "if", "self", ".", "cached_model", "is", "not", "None", ":", "# load the cached model", "for", "name", ",", "param_cached", "in", "self", ".", "cached_model", "."...
https://github.com/awslabs/gluon-ts/blob/066ec3b7f47aa4ee4c061a28f35db7edbad05a98/src/gluonts/mx/trainer/model_iteration_averaging.py#L144-L154
spesmilo/electrum
bdbd59300fbd35b01605e66145458e5f396108e8
electrum/plugins/ledger/ledger.py
python
Ledger_Client.supports_multi_output
(self)
return self.multiOutputSupported
[]
def supports_multi_output(self): return self.multiOutputSupported
[ "def", "supports_multi_output", "(", "self", ")", ":", "return", "self", ".", "multiOutputSupported" ]
https://github.com/spesmilo/electrum/blob/bdbd59300fbd35b01605e66145458e5f396108e8/electrum/plugins/ledger/ledger.py#L166-L167
ajinabraham/OWASP-Xenotix-XSS-Exploit-Framework
cb692f527e4e819b6c228187c5702d990a180043
external/Scripting Engine/Xenotix Python Scripting Engine/Lib/lib2to3/pytree.py
python
Node.insert_child
(self, i, child)
Equivalent to 'node.children.insert(i, child)'. This method also sets the child's parent attribute appropriately.
Equivalent to 'node.children.insert(i, child)'. This method also sets the child's parent attribute appropriately.
[ "Equivalent", "to", "node", ".", "children", ".", "insert", "(", "i", "child", ")", ".", "This", "method", "also", "sets", "the", "child", "s", "parent", "attribute", "appropriately", "." ]
def insert_child(self, i, child): """ Equivalent to 'node.children.insert(i, child)'. This method also sets the child's parent attribute appropriately. """ child.parent = self self.children.insert(i, child) self.changed()
[ "def", "insert_child", "(", "self", ",", "i", ",", "child", ")", ":", "child", ".", "parent", "=", "self", "self", ".", "children", ".", "insert", "(", "i", ",", "child", ")", "self", ".", "changed", "(", ")" ]
https://github.com/ajinabraham/OWASP-Xenotix-XSS-Exploit-Framework/blob/cb692f527e4e819b6c228187c5702d990a180043/external/Scripting Engine/Xenotix Python Scripting Engine/Lib/lib2to3/pytree.py#L332-L339
tensorflow/ranking
94cccec8b4e71d2cc4489c61e2623522738c2924
tensorflow_ranking/python/keras/network.py
python
RankingNetwork.example_feature_columns
(self)
return self._example_feature_columns
[]
def example_feature_columns(self): return self._example_feature_columns
[ "def", "example_feature_columns", "(", "self", ")", ":", "return", "self", ".", "_example_feature_columns" ]
https://github.com/tensorflow/ranking/blob/94cccec8b4e71d2cc4489c61e2623522738c2924/tensorflow_ranking/python/keras/network.py#L129-L130
zestedesavoir/zds-site
2ba922223c859984a413cc6c108a8aa4023b113e
zds/utils/misc.py
python
compute_hash
(filenames)
return md5_hash.hexdigest()
returns a md5 hexdigest of group of files to check if they have change
returns a md5 hexdigest of group of files to check if they have change
[ "returns", "a", "md5", "hexdigest", "of", "group", "of", "files", "to", "check", "if", "they", "have", "change" ]
def compute_hash(filenames): """returns a md5 hexdigest of group of files to check if they have change""" md5_hash = hashlib.md5() for filename in filenames: if filename: file_handle = open(filename, "rb") must_continue = True while must_continue: ...
[ "def", "compute_hash", "(", "filenames", ")", ":", "md5_hash", "=", "hashlib", ".", "md5", "(", ")", "for", "filename", "in", "filenames", ":", "if", "filename", ":", "file_handle", "=", "open", "(", "filename", ",", "\"rb\"", ")", "must_continue", "=", ...
https://github.com/zestedesavoir/zds-site/blob/2ba922223c859984a413cc6c108a8aa4023b113e/zds/utils/misc.py#L11-L24
conan-io/conan
28ec09f6cbf1d7e27ec27393fd7bbc74891e74a8
conan/tools/files/symlinks/symlinks.py
python
absolute_to_relative_symlinks
(conanfile, base_folder)
Convert the symlinks with absolute paths to relative if they are pointing to a file or directory inside the 'base_folder'. Any absolute symlink pointing outside the 'base_folder' will be ignored
Convert the symlinks with absolute paths to relative if they are pointing to a file or directory inside the 'base_folder'. Any absolute symlink pointing outside the 'base_folder' will be ignored
[ "Convert", "the", "symlinks", "with", "absolute", "paths", "to", "relative", "if", "they", "are", "pointing", "to", "a", "file", "or", "directory", "inside", "the", "base_folder", ".", "Any", "absolute", "symlink", "pointing", "outside", "the", "base_folder", ...
def absolute_to_relative_symlinks(conanfile, base_folder): """Convert the symlinks with absolute paths to relative if they are pointing to a file or directory inside the 'base_folder'. Any absolute symlink pointing outside the 'base_folder' will be ignored""" for fullpath in get_symlinks(base_folder): ...
[ "def", "absolute_to_relative_symlinks", "(", "conanfile", ",", "base_folder", ")", ":", "for", "fullpath", "in", "get_symlinks", "(", "base_folder", ")", ":", "link_target", "=", "os", ".", "readlink", "(", "fullpath", ")", "if", "not", "os", ".", "path", "....
https://github.com/conan-io/conan/blob/28ec09f6cbf1d7e27ec27393fd7bbc74891e74a8/conan/tools/files/symlinks/symlinks.py#L19-L31
biolab/orange3
41685e1c7b1d1babe680113685a2d44bcc9fec0b
Orange/widgets/visualize/owvenndiagram.py
python
OWVennDiagram.expand_table
(self, table, atrs, metas, cv)
return (*exp, ids)
[]
def expand_table(self, table, atrs, metas, cv): exp = [] n = 1 if isinstance(table, RowInstance) else len(table) if isinstance(table, RowInstance): ids = table.id.reshape(-1, 1) atr_vals = self.row_vals else: ids = table.ids.reshape(-1, 1) ...
[ "def", "expand_table", "(", "self", ",", "table", ",", "atrs", ",", "metas", ",", "cv", ")", ":", "exp", "=", "[", "]", "n", "=", "1", "if", "isinstance", "(", "table", ",", "RowInstance", ")", "else", "len", "(", "table", ")", "if", "isinstance", ...
https://github.com/biolab/orange3/blob/41685e1c7b1d1babe680113685a2d44bcc9fec0b/Orange/widgets/visualize/owvenndiagram.py#L664-L682
mesalock-linux/mesapy
ed546d59a21b36feb93e2309d5c6b75aa0ad95c9
pypy/module/cpyext/pyerrors.py
python
PyErr_SetObject
(space, w_type, w_value)
This function is similar to PyErr_SetString() but lets you specify an arbitrary Python object for the "value" of the exception.
This function is similar to PyErr_SetString() but lets you specify an arbitrary Python object for the "value" of the exception.
[ "This", "function", "is", "similar", "to", "PyErr_SetString", "()", "but", "lets", "you", "specify", "an", "arbitrary", "Python", "object", "for", "the", "value", "of", "the", "exception", "." ]
def PyErr_SetObject(space, w_type, w_value): """This function is similar to PyErr_SetString() but lets you specify an arbitrary Python object for the "value" of the exception.""" state = space.fromcache(State) state.set_exception(OperationError(w_type, w_value))
[ "def", "PyErr_SetObject", "(", "space", ",", "w_type", ",", "w_value", ")", ":", "state", "=", "space", ".", "fromcache", "(", "State", ")", "state", ".", "set_exception", "(", "OperationError", "(", "w_type", ",", "w_value", ")", ")" ]
https://github.com/mesalock-linux/mesapy/blob/ed546d59a21b36feb93e2309d5c6b75aa0ad95c9/pypy/module/cpyext/pyerrors.py#L15-L19
git-cola/git-cola
b48b8028e0c3baf47faf7b074b9773737358163d
cola/widgets/branch.py
python
GitHelper.rename
(self, branch, new_branch)
return self.git.branch(branch, new_branch, m=True)
[]
def rename(self, branch, new_branch): return self.git.branch(branch, new_branch, m=True)
[ "def", "rename", "(", "self", ",", "branch", ",", "new_branch", ")", ":", "return", "self", ".", "git", ".", "branch", "(", "branch", ",", "new_branch", ",", "m", "=", "True", ")" ]
https://github.com/git-cola/git-cola/blob/b48b8028e0c3baf47faf7b074b9773737358163d/cola/widgets/branch.py#L690-L691
menpo/menpofit
5f2f45bab26df206d43292fd32d19cd8f62f0443
menpofit/atm/fitter.py
python
LucasKanadeATMFitter.atm
(self)
return self._model
r""" The trained ATM model. :type: :map:`ATM` or `subclass`
r""" The trained ATM model.
[ "r", "The", "trained", "ATM", "model", "." ]
def atm(self): r""" The trained ATM model. :type: :map:`ATM` or `subclass` """ return self._model
[ "def", "atm", "(", "self", ")", ":", "return", "self", ".", "_model" ]
https://github.com/menpo/menpofit/blob/5f2f45bab26df206d43292fd32d19cd8f62f0443/menpofit/atm/fitter.py#L61-L67
zhl2008/awd-platform
0416b31abea29743387b10b3914581fbe8e7da5e
web_hxb2/lib/python3.5/site-packages/wagtail/wagtailimages/image_operations.py
python
FormatOperation.run
(self, willow, image, env)
[]
def run(self, willow, image, env): env['output-format'] = self.format
[ "def", "run", "(", "self", ",", "willow", ",", "image", ",", "env", ")", ":", "env", "[", "'output-format'", "]", "=", "self", ".", "format" ]
https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_hxb2/lib/python3.5/site-packages/wagtail/wagtailimages/image_operations.py#L239-L240
istresearch/scrapy-cluster
01861c2dca1563aab740417d315cc4ebf9b73f72
redis-monitor/plugins/stats_monitor.py
python
StatsMonitor._get_plugin_stats
(self, name)
return the_dict
Used for getting stats for Plugin based stuff, like Kafka Monitor and Redis Monitor @param name: the main class stats name @return: A formatted dict of stats
Used for getting stats for Plugin based stuff, like Kafka Monitor and Redis Monitor
[ "Used", "for", "getting", "stats", "for", "Plugin", "based", "stuff", "like", "Kafka", "Monitor", "and", "Redis", "Monitor" ]
def _get_plugin_stats(self, name): ''' Used for getting stats for Plugin based stuff, like Kafka Monitor and Redis Monitor @param name: the main class stats name @return: A formatted dict of stats ''' the_dict = {} keys = self.redis_conn.keys('stats:{n}:...
[ "def", "_get_plugin_stats", "(", "self", ",", "name", ")", ":", "the_dict", "=", "{", "}", "keys", "=", "self", ".", "redis_conn", ".", "keys", "(", "'stats:{n}:*'", ".", "format", "(", "n", "=", "name", ")", ")", "for", "key", "in", "keys", ":", "...
https://github.com/istresearch/scrapy-cluster/blob/01861c2dca1563aab740417d315cc4ebf9b73f72/redis-monitor/plugins/stats_monitor.py#L109-L146
nosmokingbandit/watcher
dadacd21a5790ee609058a98a17fcc8954d24439
lib/hachoir_parser/misc/torrent.py
python
Integer.createValue
(self)
return int(self["value"].value)
Read integer value (may raise ValueError)
Read integer value (may raise ValueError)
[ "Read", "integer", "value", "(", "may", "raise", "ValueError", ")" ]
def createValue(self): """Read integer value (may raise ValueError)""" return int(self["value"].value)
[ "def", "createValue", "(", "self", ")", ":", "return", "int", "(", "self", "[", "\"value\"", "]", ".", "value", ")" ]
https://github.com/nosmokingbandit/watcher/blob/dadacd21a5790ee609058a98a17fcc8954d24439/lib/hachoir_parser/misc/torrent.py#L38-L40
danielyule/hearthbreaker
884c70333e61991af9a8426f16a6a80bc3cfbb07
hearthbreaker/game_objects.py
python
Character.attack
(self)
Causes this :class:`Character` to attack. The Character will assemble a list of possible targets and then ask the agent associated with this Character to select which target from the list it would like to attack. This method will not succeed if the Character can't attack, either because it is ...
Causes this :class:`Character` to attack.
[ "Causes", "this", ":", "class", ":", "Character", "to", "attack", "." ]
def attack(self): """ Causes this :class:`Character` to attack. The Character will assemble a list of possible targets and then ask the agent associated with this Character to select which target from the list it would like to attack. This method will not succeed if the Charact...
[ "def", "attack", "(", "self", ")", ":", "if", "not", "self", ".", "can_attack", "(", ")", ":", "raise", "GameException", "(", "\"That minion cannot attack\"", ")", "found_taunt", "=", "False", "targets", "=", "[", "]", "for", "enemy", "in", "self", ".", ...
https://github.com/danielyule/hearthbreaker/blob/884c70333e61991af9a8426f16a6a80bc3cfbb07/hearthbreaker/game_objects.py#L417-L465
Zulko/easyAI
a5cbd0b600ebbeadc3730df9e7a211d7643cff8b
easyAI/AI/TranspositionTable.py
python
TranspositionTable.__init__
(self, own_dict=None)
[]
def __init__(self, own_dict=None): self.d = own_dict if own_dict is not None else dict()
[ "def", "__init__", "(", "self", ",", "own_dict", "=", "None", ")", ":", "self", ".", "d", "=", "own_dict", "if", "own_dict", "is", "not", "None", "else", "dict", "(", ")" ]
https://github.com/Zulko/easyAI/blob/a5cbd0b600ebbeadc3730df9e7a211d7643cff8b/easyAI/AI/TranspositionTable.py#L53-L54
ofnote/tsalib
e6c2ab5d1f8453866eb201264652c89d2a570f1e
tsalib/ts.py
python
update_dim_vars_len
(name2len)
name2len: dictionary with dim var name and new length pairs e.g., {'t': 50, 'c': 256}
name2len: dictionary with dim var name and new length pairs e.g., {'t': 50, 'c': 256}
[ "name2len", ":", "dictionary", "with", "dim", "var", "name", "and", "new", "length", "pairs", "e", ".", "g", ".", "{", "t", ":", "50", "c", ":", "256", "}" ]
def update_dim_vars_len (name2len): ''' name2len: dictionary with dim var name and new length pairs e.g., {'t': 50, 'c': 256} ''' for name, dimlen in name2len.items(): d = DimVar.lookup(name) d.update_len(dimlen)
[ "def", "update_dim_vars_len", "(", "name2len", ")", ":", "for", "name", ",", "dimlen", "in", "name2len", ".", "items", "(", ")", ":", "d", "=", "DimVar", ".", "lookup", "(", "name", ")", "d", ".", "update_len", "(", "dimlen", ")" ]
https://github.com/ofnote/tsalib/blob/e6c2ab5d1f8453866eb201264652c89d2a570f1e/tsalib/ts.py#L264-L271
Azure/azure-linux-extensions
a42ef718c746abab2b3c6a21da87b29e76364558
Common/libpsutil/py2.6-glibc-2.12-pre/psutil/_pswindows.py
python
cpu_count_logical
()
return cext.cpu_count_logical()
Return the number of logical CPUs in the system.
Return the number of logical CPUs in the system.
[ "Return", "the", "number", "of", "logical", "CPUs", "in", "the", "system", "." ]
def cpu_count_logical(): """Return the number of logical CPUs in the system.""" return cext.cpu_count_logical()
[ "def", "cpu_count_logical", "(", ")", ":", "return", "cext", ".", "cpu_count_logical", "(", ")" ]
https://github.com/Azure/azure-linux-extensions/blob/a42ef718c746abab2b3c6a21da87b29e76364558/Common/libpsutil/py2.6-glibc-2.12-pre/psutil/_pswindows.py#L146-L148
lisa-lab/pylearn2
af81e5c362f0df4df85c3e54e23b2adeec026055
pylearn2/datasets/new_norb.py
python
get_instance_value
(label)
return _check_range_and_return('instance', label, -1, 9, -1)
Returns the instance value corresponding to a lighting label int. The value is the int itself. This just sanity-checks the label for range errors. Parameters ---------- label: int Instance label.
Returns the instance value corresponding to a lighting label int.
[ "Returns", "the", "instance", "value", "corresponding", "to", "a", "lighting", "label", "int", "." ]
def get_instance_value(label): """ Returns the instance value corresponding to a lighting label int. The value is the int itself. This just sanity-checks the label for range errors. Parameters ---------- label: int Instance label. """ return _check_range_and_return('instance'...
[ "def", "get_instance_value", "(", "label", ")", ":", "return", "_check_range_and_return", "(", "'instance'", ",", "label", ",", "-", "1", ",", "9", ",", "-", "1", ")" ]
https://github.com/lisa-lab/pylearn2/blob/af81e5c362f0df4df85c3e54e23b2adeec026055/pylearn2/datasets/new_norb.py#L815-L827
sagemath/sage
f9b2db94f675ff16963ccdefba4f1a3393b3fe0d
src/sage/combinat/species/sum_species.py
python
SumSpecies.left_summand
(self)
return self._F
Returns the left summand of this species. EXAMPLES:: sage: P = species.PermutationSpecies() sage: F = P + P*P sage: F.left_summand() Permutation species
Returns the left summand of this species.
[ "Returns", "the", "left", "summand", "of", "this", "species", "." ]
def left_summand(self): """ Returns the left summand of this species. EXAMPLES:: sage: P = species.PermutationSpecies() sage: F = P + P*P sage: F.left_summand() Permutation species """ return self._F
[ "def", "left_summand", "(", "self", ")", ":", "return", "self", ".", "_F" ]
https://github.com/sagemath/sage/blob/f9b2db94f675ff16963ccdefba4f1a3393b3fe0d/src/sage/combinat/species/sum_species.py#L64-L75
Esri/ArcREST
ab240fde2b0200f61d4a5f6df033516e53f2f416
src/arcrest/ags/_gpobjects.py
python
GPString.asDictionary
(self)
return { "dataType" : self._dataType, "value" : self._value, "paramName" : self._paramName }
returns object as dictionary
returns object as dictionary
[ "returns", "object", "as", "dictionary" ]
def asDictionary(self): """returns object as dictionary""" return { "dataType" : self._dataType, "value" : self._value, "paramName" : self._paramName }
[ "def", "asDictionary", "(", "self", ")", ":", "return", "{", "\"dataType\"", ":", "self", ".", "_dataType", ",", "\"value\"", ":", "self", ".", "_value", ",", "\"paramName\"", ":", "self", ".", "_paramName", "}" ]
https://github.com/Esri/ArcREST/blob/ab240fde2b0200f61d4a5f6df033516e53f2f416/src/arcrest/ags/_gpobjects.py#L587-L593