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
jtriley/StarCluster
bc7c950e73f193eac9aab986b6764939cfdad978
starcluster/cluster.py
python
Cluster.add_node
(self, alias=None, no_create=False, image_id=None, instance_type=None, zone=None, placement_group=None, spot_bid=None)
return self.add_nodes(1, aliases=aliases, image_id=image_id, instance_type=instance_type, zone=zone, placement_group=placement_group, spot_bid=spot_bid, no_create=no_create)
Add a single node to this cluster
Add a single node to this cluster
[ "Add", "a", "single", "node", "to", "this", "cluster" ]
def add_node(self, alias=None, no_create=False, image_id=None, instance_type=None, zone=None, placement_group=None, spot_bid=None): """ Add a single node to this cluster """ aliases = [alias] if alias else None return self.add_nodes(1, aliases=al...
[ "def", "add_node", "(", "self", ",", "alias", "=", "None", ",", "no_create", "=", "False", ",", "image_id", "=", "None", ",", "instance_type", "=", "None", ",", "zone", "=", "None", ",", "placement_group", "=", "None", ",", "spot_bid", "=", "None", ")"...
https://github.com/jtriley/StarCluster/blob/bc7c950e73f193eac9aab986b6764939cfdad978/starcluster/cluster.py#L986-L996
fonttools/fonttools
892322aaff6a89bea5927379ec06bc0da3dfb7df
Lib/fontTools/varLib/varStore.py
python
VarStore_optimize
(self)
return varidx_map
Optimize storage. Returns mapping from old VarIdxes to new ones.
Optimize storage. Returns mapping from old VarIdxes to new ones.
[ "Optimize", "storage", ".", "Returns", "mapping", "from", "old", "VarIdxes", "to", "new", "ones", "." ]
def VarStore_optimize(self): """Optimize storage. Returns mapping from old VarIdxes to new ones.""" # TODO # Check that no two VarRegions are the same; if they are, fold them. n = len(self.VarRegionList.Region) # Number of columns zeroes = [0] * n front_mapping = {} # Map from old VarIdxes to full row tuples ...
[ "def", "VarStore_optimize", "(", "self", ")", ":", "# TODO", "# Check that no two VarRegions are the same; if they are, fold them.", "n", "=", "len", "(", "self", ".", "VarRegionList", ".", "Region", ")", "# Number of columns", "zeroes", "=", "[", "0", "]", "*", "n"...
https://github.com/fonttools/fonttools/blob/892322aaff6a89bea5927379ec06bc0da3dfb7df/Lib/fontTools/varLib/varStore.py#L434-L554
realpython/book2-exercises
cde325eac8e6d8cff2316601c2e5b36bb46af7d0
web2py/venv/lib/python2.7/site-packages/setuptools/dist.py
python
Feature.validate
(self, dist)
Verify that feature makes sense in context of distribution This method is called by the distribution just before it parses its command line. It checks to ensure that the 'remove' attribute, if any, contains only valid package/module names that are present in the base distribution when ...
Verify that feature makes sense in context of distribution
[ "Verify", "that", "feature", "makes", "sense", "in", "context", "of", "distribution" ]
def validate(self, dist): """Verify that feature makes sense in context of distribution This method is called by the distribution just before it parses its command line. It checks to ensure that the 'remove' attribute, if any, contains only valid package/module names that are present i...
[ "def", "validate", "(", "self", ",", "dist", ")", ":", "for", "item", "in", "self", ".", "remove", ":", "if", "not", "dist", ".", "has_contents_for", "(", "item", ")", ":", "raise", "DistutilsSetupError", "(", "\"%s wants to be able to remove %s, but the distrib...
https://github.com/realpython/book2-exercises/blob/cde325eac8e6d8cff2316601c2e5b36bb46af7d0/web2py/venv/lib/python2.7/site-packages/setuptools/dist.py#L897-L914
home-assistant/core
265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1
homeassistant/components/hikvision/binary_sensor.py
python
HikvisionData.__init__
(self, hass, url, port, name, username, password)
Initialize the data object.
Initialize the data object.
[ "Initialize", "the", "data", "object", "." ]
def __init__(self, hass, url, port, name, username, password): """Initialize the data object.""" self._url = url self._port = port self._name = name self._username = username self._password = password # Establish camera self.camdata = HikCamera(self._url,...
[ "def", "__init__", "(", "self", ",", "hass", ",", "url", ",", "port", ",", "name", ",", "username", ",", "password", ")", ":", "self", ".", "_url", "=", "url", "self", ".", "_port", "=", "port", "self", ".", "_name", "=", "name", "self", ".", "_u...
https://github.com/home-assistant/core/blob/265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1/homeassistant/components/hikvision/binary_sensor.py#L149-L164
coala/coala
37af7fd5de3ed148b8096cfc80e4717fb840bf2c
coalib/core/Bear.py
python
Bear.__json__
(cls)
return data
Override JSON export of ``Bear`` class.
Override JSON export of ``Bear`` class.
[ "Override", "JSON", "export", "of", "Bear", "class", "." ]
def __json__(cls): """ Override JSON export of ``Bear`` class. """ # Those members get duplicated if they aren't excluded because they # exist also as fields. excluded_members = {'can_detect', 'maintainers', 'maintainers_emails'} # json cannot serialize propertie...
[ "def", "__json__", "(", "cls", ")", ":", "# Those members get duplicated if they aren't excluded because they", "# exist also as fields.", "excluded_members", "=", "{", "'can_detect'", ",", "'maintainers'", ",", "'maintainers_emails'", "}", "# json cannot serialize properties, so d...
https://github.com/coala/coala/blob/37af7fd5de3ed148b8096cfc80e4717fb840bf2c/coalib/core/Bear.py#L278-L302
sagemath/sage
f9b2db94f675ff16963ccdefba4f1a3393b3fe0d
src/sage/schemes/toric/variety.py
python
is_ToricVariety
(x)
return isinstance(x, ToricVariety_field)
r""" Check if ``x`` is a toric variety. INPUT: - ``x`` -- anything. OUTPUT: - ``True`` if ``x`` is a :class:`toric variety <ToricVariety_field>` and ``False`` otherwise. .. NOTE:: While projective spaces are toric varieties mathematically, they are not toric varieties...
r""" Check if ``x`` is a toric variety.
[ "r", "Check", "if", "x", "is", "a", "toric", "variety", "." ]
def is_ToricVariety(x): r""" Check if ``x`` is a toric variety. INPUT: - ``x`` -- anything. OUTPUT: - ``True`` if ``x`` is a :class:`toric variety <ToricVariety_field>` and ``False`` otherwise. .. NOTE:: While projective spaces are toric varieties mathematically, they are...
[ "def", "is_ToricVariety", "(", "x", ")", ":", "return", "isinstance", "(", "x", ",", "ToricVariety_field", ")" ]
https://github.com/sagemath/sage/blob/f9b2db94f675ff16963ccdefba4f1a3393b3fe0d/src/sage/schemes/toric/variety.py#L343-L376
bendmorris/static-python
2e0f8c4d7ed5b359dc7d8a75b6fb37e6b6c5c473
Lib/tkinter/__init__.py
python
Text.scan_dragto
(self, x, y)
Adjust the view of the text to 10 times the difference between X and Y and the coordinates given in scan_mark.
Adjust the view of the text to 10 times the difference between X and Y and the coordinates given in scan_mark.
[ "Adjust", "the", "view", "of", "the", "text", "to", "10", "times", "the", "difference", "between", "X", "and", "Y", "and", "the", "coordinates", "given", "in", "scan_mark", "." ]
def scan_dragto(self, x, y): """Adjust the view of the text to 10 times the difference between X and Y and the coordinates given in scan_mark.""" self.tk.call(self._w, 'scan', 'dragto', x, y)
[ "def", "scan_dragto", "(", "self", ",", "x", ",", "y", ")", ":", "self", ".", "tk", ".", "call", "(", "self", ".", "_w", ",", "'scan'", ",", "'dragto'", ",", "x", ",", "y", ")" ]
https://github.com/bendmorris/static-python/blob/2e0f8c4d7ed5b359dc7d8a75b6fb37e6b6c5c473/Lib/tkinter/__init__.py#L3134-L3138
joaoventura/pylibui
2e74db787bfea533f3ae465670963daedcaec344
pylibui/libui/separator.py
python
uiNewHorizontalSeparator
()
return clibui.uiNewHorizontalSeparator()
Returns a horizontal separator. :return: uiHorizontalSeparator
Returns a horizontal separator.
[ "Returns", "a", "horizontal", "separator", "." ]
def uiNewHorizontalSeparator(): """ Returns a horizontal separator. :return: uiHorizontalSeparator """ # Set return type clibui.uiNewHorizontalSeparator.restype = ctypes.POINTER(uiSeparator) return clibui.uiNewHorizontalSeparator()
[ "def", "uiNewHorizontalSeparator", "(", ")", ":", "# Set return type", "clibui", ".", "uiNewHorizontalSeparator", ".", "restype", "=", "ctypes", ".", "POINTER", "(", "uiSeparator", ")", "return", "clibui", ".", "uiNewHorizontalSeparator", "(", ")" ]
https://github.com/joaoventura/pylibui/blob/2e74db787bfea533f3ae465670963daedcaec344/pylibui/libui/separator.py#L28-L38
openedx/edx-platform
68dd185a0ab45862a2a61e0f803d7e03d2be71b5
openedx/core/djangoapps/content_libraries/api.py
python
set_library_block_olx
(usage_key, new_olx_str)
Replace the OLX source of the given XBlock. This is only meant for use by developers or API client applications, as very little validation is done and this can easily result in a broken XBlock that won't load.
Replace the OLX source of the given XBlock. This is only meant for use by developers or API client applications, as very little validation is done and this can easily result in a broken XBlock that won't load.
[ "Replace", "the", "OLX", "source", "of", "the", "given", "XBlock", ".", "This", "is", "only", "meant", "for", "use", "by", "developers", "or", "API", "client", "applications", "as", "very", "little", "validation", "is", "done", "and", "this", "can", "easil...
def set_library_block_olx(usage_key, new_olx_str): """ Replace the OLX source of the given XBlock. This is only meant for use by developers or API client applications, as very little validation is done and this can easily result in a broken XBlock that won't load. """ # because this old pyli...
[ "def", "set_library_block_olx", "(", "usage_key", ",", "new_olx_str", ")", ":", "# because this old pylint can't understand attr.ib() objects, pylint: disable=no-member", "assert", "isinstance", "(", "usage_key", ",", "LibraryUsageLocatorV2", ")", "# Make sure the block exists:", "...
https://github.com/openedx/edx-platform/blob/68dd185a0ab45862a2a61e0f803d7e03d2be71b5/openedx/core/djangoapps/content_libraries/api.py#L732-L753
Yuliang-Liu/Box_Discretization_Network
5b3a30c97429ef8e5c5e1c4e2476c7d9abdc03e6
setup.py
python
get_extensions
()
return ext_modules
[]
def get_extensions(): this_dir = os.path.dirname(os.path.abspath(__file__)) extensions_dir = os.path.join(this_dir, "maskrcnn_benchmark", "csrc") main_file = glob.glob(os.path.join(extensions_dir, "*.cpp")) source_cpu = glob.glob(os.path.join(extensions_dir, "cpu", "*.cpp")) source_cuda = glob.glob...
[ "def", "get_extensions", "(", ")", ":", "this_dir", "=", "os", ".", "path", ".", "dirname", "(", "os", ".", "path", ".", "abspath", "(", "__file__", ")", ")", "extensions_dir", "=", "os", ".", "path", ".", "join", "(", "this_dir", ",", "\"maskrcnn_benc...
https://github.com/Yuliang-Liu/Box_Discretization_Network/blob/5b3a30c97429ef8e5c5e1c4e2476c7d9abdc03e6/setup.py#L17-L56
conansherry/detectron2
72c935d9aad8935406b1038af408aa06077d950a
detectron2/evaluation/coco_evaluation.py
python
COCOEvaluator._derive_coco_results
(self, coco_eval, iou_type, class_names=None)
return results
Derive the desired score numbers from summarized COCOeval. Args: coco_eval (None or COCOEval): None represents no predictions from model. iou_type (str): class_names (None or list[str]): if provided, will use it to predict per-category AP. Returns: ...
Derive the desired score numbers from summarized COCOeval.
[ "Derive", "the", "desired", "score", "numbers", "from", "summarized", "COCOeval", "." ]
def _derive_coco_results(self, coco_eval, iou_type, class_names=None): """ Derive the desired score numbers from summarized COCOeval. Args: coco_eval (None or COCOEval): None represents no predictions from model. iou_type (str): class_names (None or list[str]...
[ "def", "_derive_coco_results", "(", "self", ",", "coco_eval", ",", "iou_type", ",", "class_names", "=", "None", ")", ":", "metrics", "=", "{", "\"bbox\"", ":", "[", "\"AP\"", ",", "\"AP50\"", ",", "\"AP75\"", ",", "\"APs\"", ",", "\"APm\"", ",", "\"APl\"",...
https://github.com/conansherry/detectron2/blob/72c935d9aad8935406b1038af408aa06077d950a/detectron2/evaluation/coco_evaluation.py#L216-L277
daoluan/decode-Django
d46a858b45b56de48b0355f50dd9e45402d04cfd
Django-1.5.1/django/contrib/formtools/wizard/views.py
python
WizardView.process_step_files
(self, form)
return self.get_form_step_files(form)
This method is used to postprocess the form files. By default, it returns the raw `form.files` dictionary.
This method is used to postprocess the form files. By default, it returns the raw `form.files` dictionary.
[ "This", "method", "is", "used", "to", "postprocess", "the", "form", "files", ".", "By", "default", "it", "returns", "the", "raw", "form", ".", "files", "dictionary", "." ]
def process_step_files(self, form): """ This method is used to postprocess the form files. By default, it returns the raw `form.files` dictionary. """ return self.get_form_step_files(form)
[ "def", "process_step_files", "(", "self", ",", "form", ")", ":", "return", "self", ".", "get_form_step_files", "(", "form", ")" ]
https://github.com/daoluan/decode-Django/blob/d46a858b45b56de48b0355f50dd9e45402d04cfd/Django-1.5.1/django/contrib/formtools/wizard/views.py#L408-L413
saltstack/salt
fae5bc757ad0f1716483ce7ae180b451545c2058
salt/modules/zfs.py
python
rollback
(name, **kwargs)
return __utils__["zfs.parse_command_result"](res, "rolledback")
Roll back the given dataset to a previous snapshot. name : string name of snapshot recursive : boolean destroy any snapshots and bookmarks more recent than the one specified. recursive_all : boolean destroy any more recent snapshots and bookmarks, as well as any clon...
Roll back the given dataset to a previous snapshot.
[ "Roll", "back", "the", "given", "dataset", "to", "a", "previous", "snapshot", "." ]
def rollback(name, **kwargs): """ Roll back the given dataset to a previous snapshot. name : string name of snapshot recursive : boolean destroy any snapshots and bookmarks more recent than the one specified. recursive_all : boolean destroy any more recent snapshots ...
[ "def", "rollback", "(", "name", ",", "*", "*", "kwargs", ")", ":", "## Configure command", "# NOTE: initialize the defaults", "flags", "=", "[", "]", "# NOTE: set extra config from kwargs", "if", "kwargs", ".", "get", "(", "\"recursive_all\"", ",", "False", ")", "...
https://github.com/saltstack/salt/blob/fae5bc757ad0f1716483ce7ae180b451545c2058/salt/modules/zfs.py#L631-L694
olist/correios
5494d7457665fa9a8dffbffa976cdbd2885c54e4
correios/xml_utils.py
python
add_text_argument
(f)
return wrapper
[]
def add_text_argument(f): @wraps(f) def wrapper(*args, **kwargs): text = kwargs.pop("text", None) cdata = kwargs.pop("cdata", None) element = f(*args, **kwargs) if cdata: element.text = etree.CDATA(cdata) elif text: element.text = text else...
[ "def", "add_text_argument", "(", "f", ")", ":", "@", "wraps", "(", "f", ")", "def", "wrapper", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "text", "=", "kwargs", ".", "pop", "(", "\"text\"", ",", "None", ")", "cdata", "=", "kwargs", ".",...
https://github.com/olist/correios/blob/5494d7457665fa9a8dffbffa976cdbd2885c54e4/correios/xml_utils.py#L20-L34
tendenci/tendenci
0f2c348cc0e7d41bc56f50b00ce05544b083bf1d
tendenci/libs/model_report/utils.py
python
model_lookup_label
(report, field)
return "[%s] %s" % (report.model._meta.verbose_name.title(), field.verbose_name.title())
[]
def model_lookup_label(report, field): return "[%s] %s" % (report.model._meta.verbose_name.title(), field.verbose_name.title())
[ "def", "model_lookup_label", "(", "report", ",", "field", ")", ":", "return", "\"[%s] %s\"", "%", "(", "report", ".", "model", ".", "_meta", ".", "verbose_name", ".", "title", "(", ")", ",", "field", ".", "verbose_name", ".", "title", "(", ")", ")" ]
https://github.com/tendenci/tendenci/blob/0f2c348cc0e7d41bc56f50b00ce05544b083bf1d/tendenci/libs/model_report/utils.py#L28-L29
Pyomo/pyomo
dbd4faee151084f343b893cc2b0c04cf2b76fd92
pyomo/core/expr/logical_expr.py
python
BooleanExpressionBase.nargs
(self)
Returns the number of child nodes.
Returns the number of child nodes.
[ "Returns", "the", "number", "of", "child", "nodes", "." ]
def nargs(self): """ Returns the number of child nodes. """ raise NotImplementedError( "Derived expression (%s) failed to " "implement nargs()" % (str(self.__class__), ))
[ "def", "nargs", "(", "self", ")", ":", "raise", "NotImplementedError", "(", "\"Derived expression (%s) failed to \"", "\"implement nargs()\"", "%", "(", "str", "(", "self", ".", "__class__", ")", ",", ")", ")" ]
https://github.com/Pyomo/pyomo/blob/dbd4faee151084f343b893cc2b0c04cf2b76fd92/pyomo/core/expr/logical_expr.py#L451-L457
weechat/scripts
99ec0e7eceefabb9efb0f11ec26d45d6e8e84335
python/vdm.py
python
vdm_buffer_set_title
()
Set buffer title, using key used by user.
Set buffer title, using key used by user.
[ "Set", "buffer", "title", "using", "key", "used", "by", "user", "." ]
def vdm_buffer_set_title(): """ Set buffer title, using key used by user. """ global vdm_buffer, vdm_key lang = weechat.config_get_plugin("lang") weechat.buffer_set(vdm_buffer, "title", SCRIPT_NAME + " " + SCRIPT_VERSION + " [" + lang + "] | " + "Keys: las...
[ "def", "vdm_buffer_set_title", "(", ")", ":", "global", "vdm_buffer", ",", "vdm_key", "lang", "=", "weechat", ".", "config_get_plugin", "(", "\"lang\"", ")", "weechat", ".", "buffer_set", "(", "vdm_buffer", ",", "\"title\"", ",", "SCRIPT_NAME", "+", "\" \"", "...
https://github.com/weechat/scripts/blob/99ec0e7eceefabb9efb0f11ec26d45d6e8e84335/python/vdm.py#L134-L142
boto/boto
b2a6f08122b2f1b89888d2848e730893595cd001
boto/storage_uri.py
python
BucketStorageUri.__init__
(self, scheme, bucket_name=None, object_name=None, debug=0, connection_args=None, suppress_consec_slashes=True, version_id=None, generation=None, is_latest=False)
Instantiate a BucketStorageUri from scheme,bucket,object tuple. @type scheme: string @param scheme: URI scheme naming the storage provider (gs, s3, etc.) @type bucket_name: string @param bucket_name: bucket name @type object_name: string @param object_name: object name, ...
Instantiate a BucketStorageUri from scheme,bucket,object tuple.
[ "Instantiate", "a", "BucketStorageUri", "from", "scheme", "bucket", "object", "tuple", "." ]
def __init__(self, scheme, bucket_name=None, object_name=None, debug=0, connection_args=None, suppress_consec_slashes=True, version_id=None, generation=None, is_latest=False): """Instantiate a BucketStorageUri from scheme,bucket,object tuple. @type scheme: string ...
[ "def", "__init__", "(", "self", ",", "scheme", ",", "bucket_name", "=", "None", ",", "object_name", "=", "None", ",", "debug", "=", "0", ",", "connection_args", "=", "None", ",", "suppress_consec_slashes", "=", "True", ",", "version_id", "=", "None", ",", ...
https://github.com/boto/boto/blob/b2a6f08122b2f1b89888d2848e730893595cd001/boto/storage_uri.py#L252-L299
mautrix/telegram
9f48eca5a6654bc38012cb761ecaaaf416aabdd0
mautrix_telegram/puppet.py
python
Puppet.try_update_info
(self, source: au.AbstractUser, info: User)
[]
async def try_update_info(self, source: au.AbstractUser, info: User) -> None: try: await self.update_info(source, info) except Exception: source.log.exception(f"Failed to update info of {self.tgid}")
[ "async", "def", "try_update_info", "(", "self", ",", "source", ":", "au", ".", "AbstractUser", ",", "info", ":", "User", ")", "->", "None", ":", "try", ":", "await", "self", ".", "update_info", "(", "source", ",", "info", ")", "except", "Exception", ":...
https://github.com/mautrix/telegram/blob/9f48eca5a6654bc38012cb761ecaaaf416aabdd0/mautrix_telegram/puppet.py#L217-L221
anki/cozmo-python-sdk
dd29edef18748fcd816550469195323842a7872e
src/cozmo/usbmux/usbmux.py
python
USBMux.connect
(self)
Opens a connection to the USBMux daemon on the local machine. :func:`connect_to_usbmux` provides a convenient wrapper to this method.
Opens a connection to the USBMux daemon on the local machine.
[ "Opens", "a", "connection", "to", "the", "USBMux", "daemon", "on", "the", "local", "machine", "." ]
async def connect(self): '''Opens a connection to the USBMux daemon on the local machine. :func:`connect_to_usbmux` provides a convenient wrapper to this method. ''' self._waiter = asyncio.Future(loop=self.loop) await self._connect_transport(lambda: self) await self._wai...
[ "async", "def", "connect", "(", "self", ")", ":", "self", ".", "_waiter", "=", "asyncio", ".", "Future", "(", "loop", "=", "self", ".", "loop", ")", "await", "self", ".", "_connect_transport", "(", "lambda", ":", "self", ")", "await", "self", ".", "_...
https://github.com/anki/cozmo-python-sdk/blob/dd29edef18748fcd816550469195323842a7872e/src/cozmo/usbmux/usbmux.py#L196-L203
tensorflow/models
6b8bb0cbeb3e10415c7a87448f08adc3c484c1d3
official/legacy/image_classification/resnet/imagenet_preprocessing.py
python
_resize_image
(image, height, width)
return tf.compat.v1.image.resize( image, [height, width], method=tf.image.ResizeMethod.BILINEAR, align_corners=False)
Simple wrapper around tf.resize_images. This is primarily to make sure we use the same `ResizeMethod` and other details each time. Args: image: A 3-D image `Tensor`. height: The target height for the resized image. width: The target width for the resized image. Returns: resized_image: A 3-D t...
Simple wrapper around tf.resize_images.
[ "Simple", "wrapper", "around", "tf", ".", "resize_images", "." ]
def _resize_image(image, height, width): """Simple wrapper around tf.resize_images. This is primarily to make sure we use the same `ResizeMethod` and other details each time. Args: image: A 3-D image `Tensor`. height: The target height for the resized image. width: The target width for the resized...
[ "def", "_resize_image", "(", "image", ",", "height", ",", "width", ")", ":", "return", "tf", ".", "compat", ".", "v1", ".", "image", ".", "resize", "(", "image", ",", "[", "height", ",", "width", "]", ",", "method", "=", "tf", ".", "image", ".", ...
https://github.com/tensorflow/models/blob/6b8bb0cbeb3e10415c7a87448f08adc3c484c1d3/official/legacy/image_classification/resnet/imagenet_preprocessing.py#L515-L533
django-cumulus/django-cumulus
64feb07b857af28f226be4899e875c29405e261d
cumulus/context_processors.py
python
static_cdn_url
(request)
return { "STATIC_URL": cdn_url + static_url, "STATIC_SSL_URL": ssl_url + static_url, "LOCAL_STATIC_URL": static_url, }
A context processor that exposes the full static CDN URL as static URL in templates.
A context processor that exposes the full static CDN URL as static URL in templates.
[ "A", "context", "processor", "that", "exposes", "the", "full", "static", "CDN", "URL", "as", "static", "URL", "in", "templates", "." ]
def static_cdn_url(request): """ A context processor that exposes the full static CDN URL as static URL in templates. """ cdn_url, ssl_url = _get_container_urls(CumulusStaticStorage()) static_url = settings.STATIC_URL return { "STATIC_URL": cdn_url + static_url, "STATIC_SSL_...
[ "def", "static_cdn_url", "(", "request", ")", ":", "cdn_url", ",", "ssl_url", "=", "_get_container_urls", "(", "CumulusStaticStorage", "(", ")", ")", "static_url", "=", "settings", ".", "STATIC_URL", "return", "{", "\"STATIC_URL\"", ":", "cdn_url", "+", "static_...
https://github.com/django-cumulus/django-cumulus/blob/64feb07b857af28f226be4899e875c29405e261d/cumulus/context_processors.py#L32-L44
IronLanguages/ironpython3
7a7bb2a872eeab0d1009fc8a6e24dca43f65b693
Src/StdLib/Lib/encodings/uu_codec.py
python
uu_decode
(input, errors='strict')
return (outfile.getvalue(), len(input))
[]
def uu_decode(input, errors='strict'): assert errors == 'strict' infile = BytesIO(input) outfile = BytesIO() readline = infile.readline write = outfile.write # Find start of encoded data while 1: s = readline() if not s: raise ValueError('Missing "begin" line in ...
[ "def", "uu_decode", "(", "input", ",", "errors", "=", "'strict'", ")", ":", "assert", "errors", "==", "'strict'", "infile", "=", "BytesIO", "(", "input", ")", "outfile", "=", "BytesIO", "(", ")", "readline", "=", "infile", ".", "readline", "write", "=", ...
https://github.com/IronLanguages/ironpython3/blob/7a7bb2a872eeab0d1009fc8a6e24dca43f65b693/Src/StdLib/Lib/encodings/uu_codec.py#L33-L64
IJDykeman/wangTiles
7c1ee2095ebdf7f72bce07d94c6484915d5cae8b
experimental_code/tiles_3d/venv_mac_py3/lib/python2.7/site-packages/setuptools/depends.py
python
_update_globals
()
Patch the globals to remove the objects not available on some platforms. XXX it'd be better to test assertions about bytecode instead.
Patch the globals to remove the objects not available on some platforms.
[ "Patch", "the", "globals", "to", "remove", "the", "objects", "not", "available", "on", "some", "platforms", "." ]
def _update_globals(): """ Patch the globals to remove the objects not available on some platforms. XXX it'd be better to test assertions about bytecode instead. """ if not sys.platform.startswith('java') and sys.platform != 'cli': return incompatible = 'extract_constant', 'get_module_...
[ "def", "_update_globals", "(", ")", ":", "if", "not", "sys", ".", "platform", ".", "startswith", "(", "'java'", ")", "and", "sys", ".", "platform", "!=", "'cli'", ":", "return", "incompatible", "=", "'extract_constant'", ",", "'get_module_constant'", "for", ...
https://github.com/IJDykeman/wangTiles/blob/7c1ee2095ebdf7f72bce07d94c6484915d5cae8b/experimental_code/tiles_3d/venv_mac_py3/lib/python2.7/site-packages/setuptools/depends.py#L171-L183
chdsbd/kodiak
4c705cea8edaa2792f2a59700a2f7c3d75b6e918
bot/kodiak/dependencies.py
python
compare_match_type
(a: MatchType | None, b: MatchType | None)
return match_rank[a] > match_rank[b]
[]
def compare_match_type(a: MatchType | None, b: MatchType | None) -> bool: return match_rank[a] > match_rank[b]
[ "def", "compare_match_type", "(", "a", ":", "MatchType", "|", "None", ",", "b", ":", "MatchType", "|", "None", ")", "->", "bool", ":", "return", "match_rank", "[", "a", "]", ">", "match_rank", "[", "b", "]" ]
https://github.com/chdsbd/kodiak/blob/4c705cea8edaa2792f2a59700a2f7c3d75b6e918/bot/kodiak/dependencies.py#L99-L100
osmr/imgclsmob
f2993d3ce73a2f7ddba05da3891defb08547d504
gluon/model_stats.py
python
measure_model
(model, in_shapes, ctx=mx.cpu())
return num_flops, num_macs, num_params1
Calculate model statistics. Parameters: ---------- model : HybridBlock Tested model. in_shapes : list of tuple of ints Shapes of the input tensors. ctx : Context, default CPU The context in which to load the pretrained weights.
Calculate model statistics.
[ "Calculate", "model", "statistics", "." ]
def measure_model(model, in_shapes, ctx=mx.cpu()): """ Calculate model statistics. Parameters: ---------- model : HybridBlock Tested model. in_shapes : list of tuple of ints Shapes of the input tensors. ctx : Context, default CPU T...
[ "def", "measure_model", "(", "model", ",", "in_shapes", ",", "ctx", "=", "mx", ".", "cpu", "(", ")", ")", ":", "global", "num_flops", "global", "num_macs", "global", "num_params", "global", "names", "num_flops", "=", "0", "num_macs", "=", "0", "num_params"...
https://github.com/osmr/imgclsmob/blob/f2993d3ce73a2f7ddba05da3891defb08547d504/gluon/model_stats.py#L69-L303
cloudera/hue
23f02102d4547c17c32bd5ea0eb24e9eadd657a4
desktop/core/ext-py/Django-1.11.29/django/contrib/admin/options.py
python
BaseModelAdmin.get_queryset
(self, request)
return qs
Returns a QuerySet of all model instances that can be edited by the admin site. This is used by changelist_view.
Returns a QuerySet of all model instances that can be edited by the admin site. This is used by changelist_view.
[ "Returns", "a", "QuerySet", "of", "all", "model", "instances", "that", "can", "be", "edited", "by", "the", "admin", "site", ".", "This", "is", "used", "by", "changelist_view", "." ]
def get_queryset(self, request): """ Returns a QuerySet of all model instances that can be edited by the admin site. This is used by changelist_view. """ qs = self.model._default_manager.get_queryset() # TODO: this should be handled by some parameter to the ChangeList. ...
[ "def", "get_queryset", "(", "self", ",", "request", ")", ":", "qs", "=", "self", ".", "model", ".", "_default_manager", ".", "get_queryset", "(", ")", "# TODO: this should be handled by some parameter to the ChangeList.", "ordering", "=", "self", ".", "get_ordering", ...
https://github.com/cloudera/hue/blob/23f02102d4547c17c32bd5ea0eb24e9eadd657a4/desktop/core/ext-py/Django-1.11.29/django/contrib/admin/options.py#L325-L335
awslabs/aws-lambda-powertools-python
0c6ac0fe183476140ee1df55fe9fa1cc20925577
aws_lambda_powertools/utilities/data_classes/cognito_user_pool_event.py
python
PreSignUpTriggerEventResponse.auto_confirm_user
(self, value: bool)
Set to true to auto-confirm the user, or false otherwise.
Set to true to auto-confirm the user, or false otherwise.
[ "Set", "to", "true", "to", "auto", "-", "confirm", "the", "user", "or", "false", "otherwise", "." ]
def auto_confirm_user(self, value: bool): """Set to true to auto-confirm the user, or false otherwise.""" self["response"]["autoConfirmUser"] = value
[ "def", "auto_confirm_user", "(", "self", ",", "value", ":", "bool", ")", ":", "self", "[", "\"response\"", "]", "[", "\"autoConfirmUser\"", "]", "=", "value" ]
https://github.com/awslabs/aws-lambda-powertools-python/blob/0c6ac0fe183476140ee1df55fe9fa1cc20925577/aws_lambda_powertools/utilities/data_classes/cognito_user_pool_event.py#L81-L83
zhl2008/awd-platform
0416b31abea29743387b10b3914581fbe8e7da5e
web_hxb2/lib/python3.5/site-packages/wagtail_bak/contrib/postgres_search/backend.py
python
PostgresSearchRebuilder.start
(self)
return self.index
[]
def start(self): self.index.delete_stale_entries() return self.index
[ "def", "start", "(", "self", ")", ":", "self", ".", "index", ".", "delete_stale_entries", "(", ")", "return", "self", ".", "index" ]
https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_hxb2/lib/python3.5/site-packages/wagtail_bak/contrib/postgres_search/backend.py#L305-L307
flaskbb/flaskbb
de13a37fcb713b9c627632210ab9a7bb980d591f
flaskbb/user/models.py
python
User.ban
(self)
return False
Bans the user. Returns True upon success.
Bans the user. Returns True upon success.
[ "Bans", "the", "user", ".", "Returns", "True", "upon", "success", "." ]
def ban(self): """Bans the user. Returns True upon success.""" if not self.get_permissions()['banned']: banned_group = Group.query.filter( Group.banned == True ).first() self.primary_group = banned_group self.save() self.invali...
[ "def", "ban", "(", "self", ")", ":", "if", "not", "self", ".", "get_permissions", "(", ")", "[", "'banned'", "]", ":", "banned_group", "=", "Group", ".", "query", ".", "filter", "(", "Group", ".", "banned", "==", "True", ")", ".", "first", "(", ")"...
https://github.com/flaskbb/flaskbb/blob/de13a37fcb713b9c627632210ab9a7bb980d591f/flaskbb/user/models.py#L409-L420
HoloClean/holoclean
d4f5929a8e4d92d4f41eb058c04c96cdcb0af767
dataset/dbengine.py
python
_execute_query
(args, conn_args)
return res
[]
def _execute_query(args, conn_args): query_id = args[0] query = args[1] logging.debug("Starting to execute query %s with id %s", query, query_id) tic = time.clock() con = psycopg2.connect(conn_args) cur = con.cursor() cur.execute(query) res = cur.fetchall() con.close() toc = time...
[ "def", "_execute_query", "(", "args", ",", "conn_args", ")", ":", "query_id", "=", "args", "[", "0", "]", "query", "=", "args", "[", "1", "]", "logging", ".", "debug", "(", "\"Starting to execute query %s with id %s\"", ",", "query", ",", "query_id", ")", ...
https://github.com/HoloClean/holoclean/blob/d4f5929a8e4d92d4f41eb058c04c96cdcb0af767/dataset/dbengine.py#L112-L124
dcramer/django-sphinx
0071d1cae5390d0ec8c669786ca3c7275abb6410
djangosphinx/apis/api278/__init__.py
python
SphinxClient._GetResponse
(self, sock, client_ver)
return response
INTERNAL METHOD, DO NOT CALL. Gets and checks response packet from searchd server.
INTERNAL METHOD, DO NOT CALL. Gets and checks response packet from searchd server.
[ "INTERNAL", "METHOD", "DO", "NOT", "CALL", ".", "Gets", "and", "checks", "response", "packet", "from", "searchd", "server", "." ]
def _GetResponse (self, sock, client_ver): """ INTERNAL METHOD, DO NOT CALL. Gets and checks response packet from searchd server. """ (status, ver, length) = unpack('>2HL', sock.recv(8)) response = '' left = length while left>0: chunk = sock.recv(left) if chunk: response += chunk left -= len...
[ "def", "_GetResponse", "(", "self", ",", "sock", ",", "client_ver", ")", ":", "(", "status", ",", "ver", ",", "length", ")", "=", "unpack", "(", "'>2HL'", ",", "sock", ".", "recv", "(", "8", ")", ")", "response", "=", "''", "left", "=", "length", ...
https://github.com/dcramer/django-sphinx/blob/0071d1cae5390d0ec8c669786ca3c7275abb6410/djangosphinx/apis/api278/__init__.py#L216-L267
django-wiki/django-wiki
9b05df98b7f1ca24683ff181abe5147c3a2fed86
src/wiki/core/plugins/registry.py
python
get_sidebar
()
return _sidebar
Returns plugin classes that should connect to the sidebar
Returns plugin classes that should connect to the sidebar
[ "Returns", "plugin", "classes", "that", "should", "connect", "to", "the", "sidebar" ]
def get_sidebar(): """Returns plugin classes that should connect to the sidebar""" return _sidebar
[ "def", "get_sidebar", "(", ")", ":", "return", "_sidebar" ]
https://github.com/django-wiki/django-wiki/blob/9b05df98b7f1ca24683ff181abe5147c3a2fed86/src/wiki/core/plugins/registry.py#L59-L61
pandas-dev/pandas
5ba7d714014ae8feaccc0dd4a98890828cf2832d
pandas/io/formats/css.py
python
CSSResolver.parse
(self, declarations_str: str)
Generates (prop, value) pairs from declarations. In a future version may generate parsed tokens from tinycss/tinycss2 Parameters ---------- declarations_str : str
Generates (prop, value) pairs from declarations.
[ "Generates", "(", "prop", "value", ")", "pairs", "from", "declarations", "." ]
def parse(self, declarations_str: str): """ Generates (prop, value) pairs from declarations. In a future version may generate parsed tokens from tinycss/tinycss2 Parameters ---------- declarations_str : str """ for decl in declarations_str.split(";"): ...
[ "def", "parse", "(", "self", ",", "declarations_str", ":", "str", ")", ":", "for", "decl", "in", "declarations_str", ".", "split", "(", "\";\"", ")", ":", "if", "not", "decl", ".", "strip", "(", ")", ":", "continue", "prop", ",", "sep", ",", "val", ...
https://github.com/pandas-dev/pandas/blob/5ba7d714014ae8feaccc0dd4a98890828cf2832d/pandas/io/formats/css.py#L264-L287
mchristopher/PokemonGo-DesktopMap
ec37575f2776ee7d64456e2a1f6b6b78830b4fe0
app/pywin/Lib/logging/__init__.py
python
Logger.warning
(self, msg, *args, **kwargs)
Log 'msg % args' with severity 'WARNING'. To pass exception information, use the keyword argument exc_info with a true value, e.g. logger.warning("Houston, we have a %s", "bit of a problem", exc_info=1)
Log 'msg % args' with severity 'WARNING'.
[ "Log", "msg", "%", "args", "with", "severity", "WARNING", "." ]
def warning(self, msg, *args, **kwargs): """ Log 'msg % args' with severity 'WARNING'. To pass exception information, use the keyword argument exc_info with a true value, e.g. logger.warning("Houston, we have a %s", "bit of a problem", exc_info=1) """ if self.is...
[ "def", "warning", "(", "self", ",", "msg", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "if", "self", ".", "isEnabledFor", "(", "WARNING", ")", ":", "self", ".", "_log", "(", "WARNING", ",", "msg", ",", "args", ",", "*", "*", "kwargs", ...
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/ec37575f2776ee7d64456e2a1f6b6b78830b4fe0/app/pywin/Lib/logging/__init__.py#L1169-L1179
pypa/pipenv
b21baade71a86ab3ee1429f71fbc14d4f95fb75d
pipenv/patched/notpip/_vendor/resolvelib/structs.py
python
IteratorMapping.__repr__
(self)
return "IteratorMapping({!r}, {!r}, {!r})".format( self._mapping, self._accessor, self._appends, )
[]
def __repr__(self): return "IteratorMapping({!r}, {!r}, {!r})".format( self._mapping, self._accessor, self._appends, )
[ "def", "__repr__", "(", "self", ")", ":", "return", "\"IteratorMapping({!r}, {!r}, {!r})\"", ".", "format", "(", "self", ".", "_mapping", ",", "self", ".", "_accessor", ",", "self", ".", "_appends", ",", ")" ]
https://github.com/pypa/pipenv/blob/b21baade71a86ab3ee1429f71fbc14d4f95fb75d/pipenv/patched/notpip/_vendor/resolvelib/structs.py#L78-L83
LinOTP/LinOTP
bb3940bbaccea99550e6c063ff824f258dd6d6d7
linotp/controllers/monitoring.py
python
MonitoringController.userinfo
(self)
method: monitoring/userinfo description: for each realm, display the resolvers and the number of users per resolver arguments: * realms - optional: takes a realm, only information on this realm will be displayed returns: ...
method: monitoring/userinfo
[ "method", ":", "monitoring", "/", "userinfo" ]
def userinfo(self): """ method: monitoring/userinfo description: for each realm, display the resolvers and the number of users per resolver arguments: * realms - optional: takes a realm, only information on this realm will...
[ "def", "userinfo", "(", "self", ")", ":", "result", "=", "{", "}", "try", ":", "request_realms", "=", "self", ".", "request_params", ".", "get", "(", "\"realms\"", ",", "\"\"", ")", ".", "split", "(", "\",\"", ")", "monit_handler", "=", "MonitorHandler",...
https://github.com/LinOTP/LinOTP/blob/bb3940bbaccea99550e6c063ff824f258dd6d6d7/linotp/controllers/monitoring.py#L314-L372
pymedusa/Medusa
1405fbb6eb8ef4d20fcca24c32ddca52b11f0f38
ext/boto/dynamodb2/table.py
python
Table.delete_item
(self, expected=None, conditional_operator=None, **kwargs)
return True
Deletes a single item. You can perform a conditional delete operation that deletes the item if it exists, or if it has an expected attribute value. Conditional deletes are useful for only deleting items if specific conditions are met. If those conditions are met, DynamoDB performs ...
Deletes a single item. You can perform a conditional delete operation that deletes the item if it exists, or if it has an expected attribute value.
[ "Deletes", "a", "single", "item", ".", "You", "can", "perform", "a", "conditional", "delete", "operation", "that", "deletes", "the", "item", "if", "it", "exists", "or", "if", "it", "has", "an", "expected", "attribute", "value", "." ]
def delete_item(self, expected=None, conditional_operator=None, **kwargs): """ Deletes a single item. You can perform a conditional delete operation that deletes the item if it exists, or if it has an expected attribute value. Conditional deletes are useful for only deleting ite...
[ "def", "delete_item", "(", "self", ",", "expected", "=", "None", ",", "conditional_operator", "=", "None", ",", "*", "*", "kwargs", ")", ":", "expected", "=", "self", ".", "_build_filters", "(", "expected", ",", "using", "=", "FILTER_OPERATORS", ")", "raw_...
https://github.com/pymedusa/Medusa/blob/1405fbb6eb8ef4d20fcca24c32ddca52b11f0f38/ext/boto/dynamodb2/table.py#L855-L917
FederatedAI/FATE
32540492623568ecd1afcb367360133616e02fa3
python/federatedml/util/conversion.py
python
bytes_to_bin
(bytes_arr)
return bin_compensate(res)
Convert bytes to a binary number :param bytes_arr: :return: str, whose length must be a multiple of 8
Convert bytes to a binary number :param bytes_arr: :return: str, whose length must be a multiple of 8
[ "Convert", "bytes", "to", "a", "binary", "number", ":", "param", "bytes_arr", ":", ":", "return", ":", "str", "whose", "length", "must", "be", "a", "multiple", "of", "8" ]
def bytes_to_bin(bytes_arr): """ Convert bytes to a binary number :param bytes_arr: :return: str, whose length must be a multiple of 8 """ res = bin(bytes_to_int(bytes_arr))[2:] return bin_compensate(res)
[ "def", "bytes_to_bin", "(", "bytes_arr", ")", ":", "res", "=", "bin", "(", "bytes_to_int", "(", "bytes_arr", ")", ")", "[", "2", ":", "]", "return", "bin_compensate", "(", "res", ")" ]
https://github.com/FederatedAI/FATE/blob/32540492623568ecd1afcb367360133616e02fa3/python/federatedml/util/conversion.py#L41-L48
usnistgov/fipy
6809b180b41a11de988a48655575df7e142c93b9
fipy/solvers/trilinos/linearPCGSolver.py
python
LinearPCGSolver.__init__
(self, tolerance=1e-10, iterations=1000, precon=MultilevelDDPreconditioner())
Parameters ---------- tolerance : float Required error tolerance. iterations : int Maximum number of iterative steps to perform. precon : ~fipy.solvers.trilinos.preconditioners.preconditioner.Preconditioner
Parameters ---------- tolerance : float Required error tolerance. iterations : int Maximum number of iterative steps to perform. precon : ~fipy.solvers.trilinos.preconditioners.preconditioner.Preconditioner
[ "Parameters", "----------", "tolerance", ":", "float", "Required", "error", "tolerance", ".", "iterations", ":", "int", "Maximum", "number", "of", "iterative", "steps", "to", "perform", ".", "precon", ":", "~fipy", ".", "solvers", ".", "trilinos", ".", "precon...
def __init__(self, tolerance=1e-10, iterations=1000, precon=MultilevelDDPreconditioner()): """ Parameters ---------- tolerance : float Required error tolerance. iterations : int Maximum number of iterative steps to perform. precon : ~fipy.solvers.t...
[ "def", "__init__", "(", "self", ",", "tolerance", "=", "1e-10", ",", "iterations", "=", "1000", ",", "precon", "=", "MultilevelDDPreconditioner", "(", ")", ")", ":", "TrilinosAztecOOSolver", ".", "__init__", "(", "self", ",", "tolerance", "=", "tolerance", "...
https://github.com/usnistgov/fipy/blob/6809b180b41a11de988a48655575df7e142c93b9/fipy/solvers/trilinos/linearPCGSolver.py#L21-L33
sagemath/sage
f9b2db94f675ff16963ccdefba4f1a3393b3fe0d
src/sage/libs/gap/assigned_names.py
python
list_globals
()
return tuple(sorted(gvars))
Return the GAP reserved keywords OUTPUT: Tuple of strings. EXAMPLES:: sage: from sage.libs.gap.assigned_names import GLOBALS sage: 'ZassenhausIntersection' in GLOBALS # indirect doctest True
Return the GAP reserved keywords
[ "Return", "the", "GAP", "reserved", "keywords" ]
def list_globals(): """ Return the GAP reserved keywords OUTPUT: Tuple of strings. EXAMPLES:: sage: from sage.libs.gap.assigned_names import GLOBALS sage: 'ZassenhausIntersection' in GLOBALS # indirect doctest True """ gvars = set( name.sage() for name i...
[ "def", "list_globals", "(", ")", ":", "gvars", "=", "set", "(", "name", ".", "sage", "(", ")", "for", "name", "in", "NamesGVars", "(", ")", "if", "IsBoundGlobal", "(", "name", ")", ")", "gvars", ".", "difference_update", "(", "KEYWORDS", ")", "return",...
https://github.com/sagemath/sage/blob/f9b2db94f675ff16963ccdefba4f1a3393b3fe0d/src/sage/libs/gap/assigned_names.py#L94-L113
ethereum/py-evm
026ee20f8d9b70d7c1b6a4fb9484d5489d425e54
eth/db/account.py
python
AccountDB._get_access_list
(self)
Get the list of addresses that were accessed, whether the bytecode was accessed, and which storage slots were accessed.
Get the list of addresses that were accessed, whether the bytecode was accessed, and which storage slots were accessed.
[ "Get", "the", "list", "of", "addresses", "that", "were", "accessed", "whether", "the", "bytecode", "was", "accessed", "and", "which", "storage", "slots", "were", "accessed", "." ]
def _get_access_list(self) -> Iterable[Tuple[Address, AccountQueryTracker]]: """ Get the list of addresses that were accessed, whether the bytecode was accessed, and which storage slots were accessed. """ for address in self._accessed_accounts: did_access_bytecode = a...
[ "def", "_get_access_list", "(", "self", ")", "->", "Iterable", "[", "Tuple", "[", "Address", ",", "AccountQueryTracker", "]", "]", ":", "for", "address", "in", "self", ".", "_accessed_accounts", ":", "did_access_bytecode", "=", "address", "in", "self", ".", ...
https://github.com/ethereum/py-evm/blob/026ee20f8d9b70d7c1b6a4fb9484d5489d425e54/eth/db/account.py#L513-L524
lkiesow/python-feedgen
ffe3e4d752ac76e23c879c35682c310c2b1ccb86
feedgen/entry.py
python
FeedEntry.title
(self, title=None)
return self.__atom_title
Get or set the title value of the entry. It should contain a human readable title for the entry. Title is mandatory for both ATOM and RSS and should not be blank. :param title: The new title of the entry. :returns: The entriess title.
Get or set the title value of the entry. It should contain a human readable title for the entry. Title is mandatory for both ATOM and RSS and should not be blank.
[ "Get", "or", "set", "the", "title", "value", "of", "the", "entry", ".", "It", "should", "contain", "a", "human", "readable", "title", "for", "the", "entry", ".", "Title", "is", "mandatory", "for", "both", "ATOM", "and", "RSS", "and", "should", "not", "...
def title(self, title=None): '''Get or set the title value of the entry. It should contain a human readable title for the entry. Title is mandatory for both ATOM and RSS and should not be blank. :param title: The new title of the entry. :returns: The entriess title. ''' ...
[ "def", "title", "(", "self", ",", "title", "=", "None", ")", ":", "if", "title", "is", "not", "None", ":", "self", ".", "__atom_title", "=", "title", "self", ".", "__rss_title", "=", "title", "return", "self", ".", "__atom_title" ]
https://github.com/lkiesow/python-feedgen/blob/ffe3e4d752ac76e23c879c35682c310c2b1ccb86/feedgen/entry.py#L263-L274
elcodigok/wphardening
634daf3a0b8dcc92484a7775a39abdfa9a846173
lib/checkWordpress.py
python
checkWordpress.isWordPress
(self)
:return: True if successful, False otherwise.
:return: True if successful, False otherwise.
[ ":", "return", ":", "True", "if", "successful", "False", "otherwise", "." ]
def isWordPress(self): """ :return: True if successful, False otherwise. """ value = self.existsFiles() if ((value * 100) / len(self.fileWordPress) > 60): logging.info( self.directory + " This project directory is a WordPress." ) ...
[ "def", "isWordPress", "(", "self", ")", ":", "value", "=", "self", ".", "existsFiles", "(", ")", "if", "(", "(", "value", "*", "100", ")", "/", "len", "(", "self", ".", "fileWordPress", ")", ">", "60", ")", ":", "logging", ".", "info", "(", "self...
https://github.com/elcodigok/wphardening/blob/634daf3a0b8dcc92484a7775a39abdfa9a846173/lib/checkWordpress.py#L91-L117
OpenEndedGroup/Field
4f7c8edfb01bb0ccc927b78d3c500f018a4ae37c
Contents/lib/python/smtplib.py
python
SMTP.help
(self, args='')
return self.getreply()[1]
SMTP 'help' command. Returns help text from server.
SMTP 'help' command. Returns help text from server.
[ "SMTP", "help", "command", ".", "Returns", "help", "text", "from", "server", "." ]
def help(self, args=''): """SMTP 'help' command. Returns help text from server.""" self.putcmd("help", args) return self.getreply()[1]
[ "def", "help", "(", "self", ",", "args", "=", "''", ")", ":", "self", ".", "putcmd", "(", "\"help\"", ",", "args", ")", "return", "self", ".", "getreply", "(", ")", "[", "1", "]" ]
https://github.com/OpenEndedGroup/Field/blob/4f7c8edfb01bb0ccc927b78d3c500f018a4ae37c/Contents/lib/python/smtplib.py#L445-L449
OpenXenManager/openxenmanager
1cb5c1cb13358ba584856e99a94f9669d17670ff
src/OXM/window_menuitem.py
python
oxcWindowMenuItem.on_menuitem_changepw_activate
(self, widget, data=None)
"Change Server Password" menu item is pressed
"Change Server Password" menu item is pressed
[ "Change", "Server", "Password", "menu", "item", "is", "pressed" ]
def on_menuitem_changepw_activate(self, widget, data=None): """ "Change Server Password" menu item is pressed """ self.builder.get_object("lblwrongpw").hide() self.builder.get_object("changepassword").show() self.builder.get_object("txtcurrentpw").set_text("") sel...
[ "def", "on_menuitem_changepw_activate", "(", "self", ",", "widget", ",", "data", "=", "None", ")", ":", "self", ".", "builder", ".", "get_object", "(", "\"lblwrongpw\"", ")", ".", "hide", "(", ")", "self", ".", "builder", ".", "get_object", "(", "\"changep...
https://github.com/OpenXenManager/openxenmanager/blob/1cb5c1cb13358ba584856e99a94f9669d17670ff/src/OXM/window_menuitem.py#L1115-L1126
aiidateam/aiida-core
c743a335480f8bb3a5e4ebd2463a31f9f3b9f9b2
aiida/manage/external/rmq.py
python
get_task_exchange_name
(prefix)
return f'{prefix}.{_TASK_EXCHANGE}'
Return the task exchange name for a given prefix. :returns: task exchange name
Return the task exchange name for a given prefix.
[ "Return", "the", "task", "exchange", "name", "for", "a", "given", "prefix", "." ]
def get_task_exchange_name(prefix): """Return the task exchange name for a given prefix. :returns: task exchange name """ return f'{prefix}.{_TASK_EXCHANGE}'
[ "def", "get_task_exchange_name", "(", "prefix", ")", ":", "return", "f'{prefix}.{_TASK_EXCHANGE}'" ]
https://github.com/aiidateam/aiida-core/blob/c743a335480f8bb3a5e4ebd2463a31f9f3b9f9b2/aiida/manage/external/rmq.py#L114-L119
automl/SMAC3
d4cb7ed76e0fbdd9edf6ab5360ff75de67ac2195
smac/runhistory/runhistory.py
python
RunHistory._cost
( self, config: Configuration, instance_seed_budget_keys: typing.Optional[typing.Iterable[InstSeedBudgetKey]] = None, )
return costs
Return array of all costs for the given config for further calculations. Parameters ---------- config : Configuration Configuration to calculate objective for instance_seed_budget_keys : list, optional (default=None) List of tuples of instance-seeds-budget keys. ...
Return array of all costs for the given config for further calculations.
[ "Return", "array", "of", "all", "costs", "for", "the", "given", "config", "for", "further", "calculations", "." ]
def _cost( self, config: Configuration, instance_seed_budget_keys: typing.Optional[typing.Iterable[InstSeedBudgetKey]] = None, ) -> typing.List[float]: """Return array of all costs for the given config for further calculations. Parameters ---------- config : ...
[ "def", "_cost", "(", "self", ",", "config", ":", "Configuration", ",", "instance_seed_budget_keys", ":", "typing", ".", "Optional", "[", "typing", ".", "Iterable", "[", "InstSeedBudgetKey", "]", "]", "=", "None", ",", ")", "->", "typing", ".", "List", "[",...
https://github.com/automl/SMAC3/blob/d4cb7ed76e0fbdd9edf6ab5360ff75de67ac2195/smac/runhistory/runhistory.py#L615-L647
pyansys/pymapdl
c07291fc062b359abf0e92b95a92d753a95ef3d7
ansys/mapdl/core/_commands/solution/fe_forces.py
python
FeForces.fj
(self, elem="", label="", value="", **kwargs)
return self.run(command, **kwargs)
Specify forces or moments on the components of the relative motion of a APDL Command: FJ joint element. Parameters ---------- elem Element number or ALL to specify all joint elements. label Valid labels: FX - Force in local x direct...
Specify forces or moments on the components of the relative motion of a
[ "Specify", "forces", "or", "moments", "on", "the", "components", "of", "the", "relative", "motion", "of", "a" ]
def fj(self, elem="", label="", value="", **kwargs): """Specify forces or moments on the components of the relative motion of a APDL Command: FJ joint element. Parameters ---------- elem Element number or ALL to specify all joint elements. label ...
[ "def", "fj", "(", "self", ",", "elem", "=", "\"\"", ",", "label", "=", "\"\"", ",", "value", "=", "\"\"", ",", "*", "*", "kwargs", ")", ":", "command", "=", "f\"FJ,{elem},{label},{value}\"", "return", "self", ".", "run", "(", "command", ",", "*", "*"...
https://github.com/pyansys/pymapdl/blob/c07291fc062b359abf0e92b95a92d753a95ef3d7/ansys/mapdl/core/_commands/solution/fe_forces.py#L178-L214
sightmachine/SimpleCV
6c4d61b6d1d9d856b471910107cad0838954d2b2
SimpleCV/LineScan.py
python
LineScan.ifft
(self,fft)
return retVal
**SUMMARY** Perform an inverse fast Fourier transform on the provided irrationally valued signal and return the results as a LineScan. **PARAMETERS** * *fft* - A one dimensional numpy array of irrational values upon which we will perform the IFFT. *...
**SUMMARY**
[ "**", "SUMMARY", "**" ]
def ifft(self,fft): """ **SUMMARY** Perform an inverse fast Fourier transform on the provided irrationally valued signal and return the results as a LineScan. **PARAMETERS** * *fft* - A one dimensional numpy array of irrational values upon wh...
[ "def", "ifft", "(", "self", ",", "fft", ")", ":", "signal", "=", "np", ".", "fft", ".", "ifft", "(", "fft", ")", "retVal", "=", "LineScan", "(", "signal", ".", "real", ")", "retVal", ".", "image", "=", "self", ".", "image", "retVal", ".", "pointL...
https://github.com/sightmachine/SimpleCV/blob/6c4d61b6d1d9d856b471910107cad0838954d2b2/SimpleCV/LineScan.py#L621-L654
awslabs/aws-ec2rescue-linux
8ecf40e7ea0d2563dac057235803fca2221029d2
lib/requests/_internal_utils.py
python
to_native_string
(string, encoding='ascii')
return out
Given a string object, regardless of type, returns a representation of that string in the native string type, encoding and decoding where necessary. This assumes ASCII unless told otherwise.
Given a string object, regardless of type, returns a representation of that string in the native string type, encoding and decoding where necessary. This assumes ASCII unless told otherwise.
[ "Given", "a", "string", "object", "regardless", "of", "type", "returns", "a", "representation", "of", "that", "string", "in", "the", "native", "string", "type", "encoding", "and", "decoding", "where", "necessary", ".", "This", "assumes", "ASCII", "unless", "to...
def to_native_string(string, encoding='ascii'): """Given a string object, regardless of type, returns a representation of that string in the native string type, encoding and decoding where necessary. This assumes ASCII unless told otherwise. """ if isinstance(string, builtin_str): out = stri...
[ "def", "to_native_string", "(", "string", ",", "encoding", "=", "'ascii'", ")", ":", "if", "isinstance", "(", "string", ",", "builtin_str", ")", ":", "out", "=", "string", "else", ":", "if", "is_py2", ":", "out", "=", "string", ".", "encode", "(", "enc...
https://github.com/awslabs/aws-ec2rescue-linux/blob/8ecf40e7ea0d2563dac057235803fca2221029d2/lib/requests/_internal_utils.py#L14-L27
sfepy/sfepy
02ec7bb2ab39ee1dfe1eb4cd509f0ffb7dcc8b25
sfepy/discrete/variables.py
python
Variables.check_vector_size
(self, vec, stripped=False)
Check whether the shape of the DOF vector corresponds to the total number of DOFs of the state variables. Parameters ---------- vec : array The vector of DOF values. stripped : bool If True, the size of the DOF vector should be reduced, i.e. w...
Check whether the shape of the DOF vector corresponds to the total number of DOFs of the state variables.
[ "Check", "whether", "the", "shape", "of", "the", "DOF", "vector", "corresponds", "to", "the", "total", "number", "of", "DOFs", "of", "the", "state", "variables", "." ]
def check_vector_size(self, vec, stripped=False): """ Check whether the shape of the DOF vector corresponds to the total number of DOFs of the state variables. Parameters ---------- vec : array The vector of DOF values. stripped : bool If ...
[ "def", "check_vector_size", "(", "self", ",", "vec", ",", "stripped", "=", "False", ")", ":", "if", "not", "stripped", ":", "n_dof", "=", "self", ".", "di", ".", "get_n_dof_total", "(", ")", "if", "vec", ".", "size", "!=", "n_dof", ":", "msg", "=", ...
https://github.com/sfepy/sfepy/blob/02ec7bb2ab39ee1dfe1eb4cd509f0ffb7dcc8b25/sfepy/discrete/variables.py#L615-L648
inspurer/WorkAttendanceSystem
1221e2d67bdf5bb15fe99517cc3ded58ccb066df
V2.0/venv/Lib/site-packages/pip-9.0.1-py3.5.egg/pip/_vendor/requests/sessions.py
python
Session.close
(self)
Closes all adapters and as such the session
Closes all adapters and as such the session
[ "Closes", "all", "adapters", "and", "as", "such", "the", "session" ]
def close(self): """Closes all adapters and as such the session""" for v in self.adapters.values(): v.close()
[ "def", "close", "(", "self", ")", ":", "for", "v", "in", "self", ".", "adapters", ".", "values", "(", ")", ":", "v", ".", "close", "(", ")" ]
https://github.com/inspurer/WorkAttendanceSystem/blob/1221e2d67bdf5bb15fe99517cc3ded58ccb066df/V2.0/venv/Lib/site-packages/pip-9.0.1-py3.5.egg/pip/_vendor/requests/sessions.py#L674-L677
TesterlifeRaymond/doraemon
d5cb6e34bd5f2aa97273ce0c0c9303e32beaa333
venv/lib/python3.6/site-packages/pip/_vendor/requests/utils.py
python
select_proxy
(url, proxies)
return proxy
Select a proxy for the url, if applicable. :param url: The url being for the request :param proxies: A dictionary of schemes or schemes and hosts to proxy URLs
Select a proxy for the url, if applicable.
[ "Select", "a", "proxy", "for", "the", "url", "if", "applicable", "." ]
def select_proxy(url, proxies): """Select a proxy for the url, if applicable. :param url: The url being for the request :param proxies: A dictionary of schemes or schemes and hosts to proxy URLs """ proxies = proxies or {} urlparts = urlparse(url) if urlparts.hostname is None: retur...
[ "def", "select_proxy", "(", "url", ",", "proxies", ")", ":", "proxies", "=", "proxies", "or", "{", "}", "urlparts", "=", "urlparse", "(", "url", ")", "if", "urlparts", ".", "hostname", "is", "None", ":", "return", "proxies", ".", "get", "(", "'all'", ...
https://github.com/TesterlifeRaymond/doraemon/blob/d5cb6e34bd5f2aa97273ce0c0c9303e32beaa333/venv/lib/python3.6/site-packages/pip/_vendor/requests/utils.py#L611-L634
ycszen/TorchSeg
62eeb159aee77972048d9d7688a28249d3c56735
model/bisenet/cityscapes.bisenet.X39.speed/eval.py
python
SegEvaluator.compute_metric
(self, results)
return result_line
[]
def compute_metric(self, results): hist = np.zeros((config.num_classes, config.num_classes)) correct = 0 labeled = 0 count = 0 for d in results: hist += d['hist'] correct += d['correct'] labeled += d['labeled'] count += 1 i...
[ "def", "compute_metric", "(", "self", ",", "results", ")", ":", "hist", "=", "np", ".", "zeros", "(", "(", "config", ".", "num_classes", ",", "config", ".", "num_classes", ")", ")", "correct", "=", "0", "labeled", "=", "0", "count", "=", "0", "for", ...
https://github.com/ycszen/TorchSeg/blob/62eeb159aee77972048d9d7688a28249d3c56735/model/bisenet/cityscapes.bisenet.X39.speed/eval.py#L64-L79
joschabach/micropsi2
74a2642d20da9da1d64acc5e4c11aeabee192a27
micropsi_core/nodenet/nodenet.py
python
Nodenet.get_nodespace_uids
(self)
Returns a list of the UIDs of all Nodespace objects that exist in the node net
Returns a list of the UIDs of all Nodespace objects that exist in the node net
[ "Returns", "a", "list", "of", "the", "UIDs", "of", "all", "Nodespace", "objects", "that", "exist", "in", "the", "node", "net" ]
def get_nodespace_uids(self): """ Returns a list of the UIDs of all Nodespace objects that exist in the node net """ pass
[ "def", "get_nodespace_uids", "(", "self", ")", ":", "pass" ]
https://github.com/joschabach/micropsi2/blob/74a2642d20da9da1d64acc5e4c11aeabee192a27/micropsi_core/nodenet/nodenet.py#L288-L292
collinsctk/PyQYT
7af3673955f94ff1b2df2f94220cd2dab2e252af
ExtentionPackages/scapy/layers/ipsec.py
python
CryptAlgo.new_cipher
(self, key, iv)
@param key: the secret key, a byte string @param iv: the initialization vector, a byte string @return: an initialized cipher object for this algo
[]
def new_cipher(self, key, iv): """ @param key: the secret key, a byte string @param iv: the initialization vector, a byte string @return: an initialized cipher object for this algo """ if type(key) is str: key = key.encode('ascii') if (hasatt...
[ "def", "new_cipher", "(", "self", ",", "key", ",", "iv", ")", ":", "if", "type", "(", "key", ")", "is", "str", ":", "key", "=", "key", ".", "encode", "(", "'ascii'", ")", "if", "(", "hasattr", "(", "self", ".", "cipher", ",", "'MODE_CTR'", ")", ...
https://github.com/collinsctk/PyQYT/blob/7af3673955f94ff1b2df2f94220cd2dab2e252af/ExtentionPackages/scapy/layers/ipsec.py#L235-L267
volatilityfoundation/volatility3
168b0d0b053ab97a7cb096ef2048795cc54d885f
volatility3/framework/interfaces/context.py
python
ModuleInterface.symbols
(self)
Lists the symbols contained in the symbol table for this module
Lists the symbols contained in the symbol table for this module
[ "Lists", "the", "symbols", "contained", "in", "the", "symbol", "table", "for", "this", "module" ]
def symbols(self) -> List: """Lists the symbols contained in the symbol table for this module"""
[ "def", "symbols", "(", "self", ")", "->", "List", ":" ]
https://github.com/volatilityfoundation/volatility3/blob/168b0d0b053ab97a7cb096ef2048795cc54d885f/volatility3/framework/interfaces/context.py#L280-L281
bruderstein/PythonScript
df9f7071ddf3a079e3a301b9b53a6dc78cf1208f
PythonLib/full/xml/dom/minidom.py
python
DocumentType.__init__
(self, qualifiedName)
[]
def __init__(self, qualifiedName): self.entities = ReadOnlySequentialNamedNodeMap() self.notations = ReadOnlySequentialNamedNodeMap() if qualifiedName: prefix, localname = _nssplit(qualifiedName) self.name = localname self.nodeName = self.name
[ "def", "__init__", "(", "self", ",", "qualifiedName", ")", ":", "self", ".", "entities", "=", "ReadOnlySequentialNamedNodeMap", "(", ")", "self", ".", "notations", "=", "ReadOnlySequentialNamedNodeMap", "(", ")", "if", "qualifiedName", ":", "prefix", ",", "local...
https://github.com/bruderstein/PythonScript/blob/df9f7071ddf3a079e3a301b9b53a6dc78cf1208f/PythonLib/full/xml/dom/minidom.py#L1314-L1320
fossasia/x-mario-center
fe67afe28d995dcf4e2498e305825a4859566172
softwarecenter/ui/gtk3/review_gui_helper.py
python
SubmitReviewsApp._get_send_accounts
(self, sel_index)
return the account referenced by the passed in index, or all accounts if the index of the combo points to the pseudo-sc-all string
return the account referenced by the passed in index, or all accounts if the index of the combo points to the pseudo-sc-all string
[ "return", "the", "account", "referenced", "by", "the", "passed", "in", "index", "or", "all", "accounts", "if", "the", "index", "of", "the", "combo", "points", "to", "the", "pseudo", "-", "sc", "-", "all", "string" ]
def _get_send_accounts(self, sel_index): """return the account referenced by the passed in index, or all accounts if the index of the combo points to the pseudo-sc-all string """ if self.gwibber_accounts[sel_index]["id"] == "pseudo-sc-all": return self.gwibber_a...
[ "def", "_get_send_accounts", "(", "self", ",", "sel_index", ")", ":", "if", "self", ".", "gwibber_accounts", "[", "sel_index", "]", "[", "\"id\"", "]", "==", "\"pseudo-sc-all\"", ":", "return", "self", ".", "gwibber_accounts", "else", ":", "return", "[", "se...
https://github.com/fossasia/x-mario-center/blob/fe67afe28d995dcf4e2498e305825a4859566172/softwarecenter/ui/gtk3/review_gui_helper.py#L1021-L1029
yandex/yandex-tank
b41bcc04396c4ed46fc8b28a261197320854fd33
yandextank/plugins/Autostop/criterions.py
python
TimeLimitCriterion.notify
(self, data, stat)
return (self.end_time - self.start_time) > self.time_limit
[]
def notify(self, data, stat): self.end_time = time.time() return (self.end_time - self.start_time) > self.time_limit
[ "def", "notify", "(", "self", ",", "data", ",", "stat", ")", ":", "self", ".", "end_time", "=", "time", ".", "time", "(", ")", "return", "(", "self", ".", "end_time", "-", "self", ".", "start_time", ")", ">", "self", ".", "time_limit" ]
https://github.com/yandex/yandex-tank/blob/b41bcc04396c4ed46fc8b28a261197320854fd33/yandextank/plugins/Autostop/criterions.py#L446-L448
webcompat/webcompat.com
c3504dffec29b14eaa62ef01aa1ba78f9c2b12ef
webcompat/form.py
python
build_formdata
(form_object)
return rv
Convert HTML form data to GitHub API data. Summary -> title Version -> part of body URL -> part of body Category -> labels Details -> part of body Description -> part of body Browser -> part of body, labels OS -> part of body, labels Tested Elsewhere -> body Image Upload -> part...
Convert HTML form data to GitHub API data.
[ "Convert", "HTML", "form", "data", "to", "GitHub", "API", "data", "." ]
def build_formdata(form_object): """Convert HTML form data to GitHub API data. Summary -> title Version -> part of body URL -> part of body Category -> labels Details -> part of body Description -> part of body Browser -> part of body, labels OS -> part of body, labels Tested El...
[ "def", "build_formdata", "(", "form_object", ")", ":", "# Do domain extraction for adding to the summary/title", "# form_object always returns a unicode string", "url", "=", "form_object", ".", "get", "(", "'url'", ")", "normalized_url", "=", "normalize_url", "(", "url", ")...
https://github.com/webcompat/webcompat.com/blob/c3504dffec29b14eaa62ef01aa1ba78f9c2b12ef/webcompat/form.py#L441-L535
number5/cloud-init
19948dbaf40309355e1a2dbef116efb0ce66245c
cloudinit/sources/DataSourceMAAS.py
python
get_id_from_ds_cfg
(ds_cfg)
return "v1:" + hashlib.sha256(idstr.encode("utf-8")).hexdigest()
Given a config, generate a unique identifier for this node.
Given a config, generate a unique identifier for this node.
[ "Given", "a", "config", "generate", "a", "unique", "identifier", "for", "this", "node", "." ]
def get_id_from_ds_cfg(ds_cfg): """Given a config, generate a unique identifier for this node.""" fields = ("consumer_key", "token_key", "token_secret") idstr = "\0".join([ds_cfg.get(f, "") for f in fields]) # store the encoding version as part of the hash in the event # that it ever changed we can ...
[ "def", "get_id_from_ds_cfg", "(", "ds_cfg", ")", ":", "fields", "=", "(", "\"consumer_key\"", ",", "\"token_key\"", ",", "\"token_secret\"", ")", "idstr", "=", "\"\\0\"", ".", "join", "(", "[", "ds_cfg", ".", "get", "(", "f", ",", "\"\"", ")", "for", "f"...
https://github.com/number5/cloud-init/blob/19948dbaf40309355e1a2dbef116efb0ce66245c/cloudinit/sources/DataSourceMAAS.py#L177-L183
silverapp/silver
a59dbc7216733ab49dca2fae525d229bdba04420
silver/models/plans.py
python
Plan.__str__
(self)
return "%s (%s)" % (self.name, self.provider.name)
[]
def __str__(self): return "%s (%s)" % (self.name, self.provider.name)
[ "def", "__str__", "(", "self", ")", ":", "return", "\"%s (%s)\"", "%", "(", "self", ".", "name", ",", "self", ".", "provider", ".", "name", ")" ]
https://github.com/silverapp/silver/blob/a59dbc7216733ab49dca2fae525d229bdba04420/silver/models/plans.py#L134-L135
zhl2008/awd-platform
0416b31abea29743387b10b3914581fbe8e7da5e
web_hxb2/lib/python3.5/site-packages/bs4/builder/_lxml.py
python
LXMLTreeBuilderForXML.doctype
(self, name, pubid, system)
[]
def doctype(self, name, pubid, system): self.soup.endData() doctype = Doctype.for_name_and_ids(name, pubid, system) self.soup.object_was_parsed(doctype)
[ "def", "doctype", "(", "self", ",", "name", ",", "pubid", ",", "system", ")", ":", "self", ".", "soup", ".", "endData", "(", ")", "doctype", "=", "Doctype", ".", "for_name_and_ids", "(", "name", ",", "pubid", ",", "system", ")", "self", ".", "soup", ...
https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_hxb2/lib/python3.5/site-packages/bs4/builder/_lxml.py#L218-L221
theislab/anndata
664e32b0aa6625fe593370d37174384c05abfd4e
anndata/_core/sparse_dataset.py
python
BackedSparseMatrix.copy
(self)
[]
def copy(self) -> ss.spmatrix: if isinstance(self.data, h5py.Dataset): return SparseDataset(self.data.parent).to_memory() else: return super().copy()
[ "def", "copy", "(", "self", ")", "->", "ss", ".", "spmatrix", ":", "if", "isinstance", "(", "self", ".", "data", ",", "h5py", ".", "Dataset", ")", ":", "return", "SparseDataset", "(", "self", ".", "data", ".", "parent", ")", ".", "to_memory", "(", ...
https://github.com/theislab/anndata/blob/664e32b0aa6625fe593370d37174384c05abfd4e/anndata/_core/sparse_dataset.py#L48-L52
shiyanhui/FileHeader
f347cc134021fb0b710694b71c57742476f5fd2b
FileHeader.py
python
get_author
()
return get_user_data_from_git('name', getpass.getuser())
Get author
Get author
[ "Get", "author" ]
def get_author(): '''Get author''' return get_user_data_from_git('name', getpass.getuser())
[ "def", "get_author", "(", ")", ":", "return", "get_user_data_from_git", "(", "'name'", ",", "getpass", ".", "getuser", "(", ")", ")" ]
https://github.com/shiyanhui/FileHeader/blob/f347cc134021fb0b710694b71c57742476f5fd2b/FileHeader.py#L231-L234
sightmachine/SimpleCV
6c4d61b6d1d9d856b471910107cad0838954d2b2
SimpleCV/Features/Detection.py
python
ROI.toTLAndBR
(self)
return [(self.xtl,self.ytl),(self.xtl+self.w,self.ytl+self.h)]
**SUMMARY** Get the ROI as a list of tuples of the ROI's top left corner and bottom right corner. **RETURNS** A list of the form [(x,y),(x,y)] **EXAMPLE** >>> roi = ROI(10,10,100,100,img) >>> roi.translate(30,30) >>> print roi.toTLAndBR()
**SUMMARY** Get the ROI as a list of tuples of the ROI's top left corner and bottom right corner.
[ "**", "SUMMARY", "**", "Get", "the", "ROI", "as", "a", "list", "of", "tuples", "of", "the", "ROI", "s", "top", "left", "corner", "and", "bottom", "right", "corner", "." ]
def toTLAndBR(self): """ **SUMMARY** Get the ROI as a list of tuples of the ROI's top left corner and bottom right corner. **RETURNS** A list of the form [(x,y),(x,y)] **EXAMPLE** >>> roi = ROI(10,10,100,100,img) >>> roi.translate(30,3...
[ "def", "toTLAndBR", "(", "self", ")", ":", "return", "[", "(", "self", ".", "xtl", ",", "self", ".", "ytl", ")", ",", "(", "self", ".", "xtl", "+", "self", ".", "w", ",", "self", ".", "ytl", "+", "self", ".", "h", ")", "]" ]
https://github.com/sightmachine/SimpleCV/blob/6c4d61b6d1d9d856b471910107cad0838954d2b2/SimpleCV/Features/Detection.py#L1997-L2015
holzschu/Carnets
44effb10ddfc6aa5c8b0687582a724ba82c6b547
Library/lib/python3.7/email/message.py
python
Message.add_header
(self, _name, _value, **_params)
Extended header setting. name is the header field to add. keyword arguments can be used to set additional parameters for the header field, with underscores converted to dashes. Normally the parameter will be added as key="value" unless value is None, in which case only the key will be...
Extended header setting.
[ "Extended", "header", "setting", "." ]
def add_header(self, _name, _value, **_params): """Extended header setting. name is the header field to add. keyword arguments can be used to set additional parameters for the header field, with underscores converted to dashes. Normally the parameter will be added as key="value" unles...
[ "def", "add_header", "(", "self", ",", "_name", ",", "_value", ",", "*", "*", "_params", ")", ":", "parts", "=", "[", "]", "for", "k", ",", "v", "in", "_params", ".", "items", "(", ")", ":", "if", "v", "is", "None", ":", "parts", ".", "append",...
https://github.com/holzschu/Carnets/blob/44effb10ddfc6aa5c8b0687582a724ba82c6b547/Library/lib/python3.7/email/message.py#L515-L543
biolab/orange3
41685e1c7b1d1babe680113685a2d44bcc9fec0b
Orange/widgets/unsupervised/owsom.py
python
OWSOM.restart_som_pressed
(self)
[]
def restart_som_pressed(self): if self._optimizer_thread is not None: self.stop_optimization = True self._optimizer.stop_optimization = True else: self.start_som()
[ "def", "restart_som_pressed", "(", "self", ")", ":", "if", "self", ".", "_optimizer_thread", "is", "not", "None", ":", "self", ".", "stop_optimization", "=", "True", "self", ".", "_optimizer", ".", "stop_optimization", "=", "True", "else", ":", "self", ".", ...
https://github.com/biolab/orange3/blob/41685e1c7b1d1babe680113685a2d44bcc9fec0b/Orange/widgets/unsupervised/owsom.py#L484-L489
QUVA-Lab/artemis
84d3b1daf0de363cc823d99f978e2861ed400b5b
artemis/ml/predictors/predictor_comparison.py
python
LearningCurveData.add
(self, time, scores)
:param time: Something representing the time at which the record was taken. :param scores: A list of 2-tuples of (score_name, score). It can also be a scalar score. Eg: [('training', 0.104), ('test', 0.119)] :return:
:param time: Something representing the time at which the record was taken. :param scores: A list of 2-tuples of (score_name, score). It can also be a scalar score. Eg: [('training', 0.104), ('test', 0.119)] :return:
[ ":", "param", "time", ":", "Something", "representing", "the", "time", "at", "which", "the", "record", "was", "taken", ".", ":", "param", "scores", ":", "A", "list", "of", "2", "-", "tuples", "of", "(", "score_name", "score", ")", ".", "It", "can", "...
def add(self, time, scores): """ :param time: Something representing the time at which the record was taken. :param scores: A list of 2-tuples of (score_name, score). It can also be a scalar score. Eg: [('training', 0.104), ('test', 0.119)] :return: """ if np...
[ "def", "add", "(", "self", ",", "time", ",", "scores", ")", ":", "if", "np", ".", "isscalar", "(", "scores", ")", ":", "scores", "=", "[", "(", "'Score'", ",", "scores", ")", "]", "elif", "isinstance", "(", "scores", ",", "tuple", ")", ":", "scor...
https://github.com/QUVA-Lab/artemis/blob/84d3b1daf0de363cc823d99f978e2861ed400b5b/artemis/ml/predictors/predictor_comparison.py#L256-L275
cocoakekeyu/autoproxy
c7298b1d46129e7bbb58d5a701be4e01025dde4f
autoproxy.py
python
ProxyValidate.__init__
(self, autoproxy, part)
[]
def __init__(self, autoproxy, part): super(ProxyValidate, self).__init__() self.autoproxy = autoproxy self.part = part
[ "def", "__init__", "(", "self", ",", "autoproxy", ",", "part", ")", ":", "super", "(", "ProxyValidate", ",", "self", ")", ".", "__init__", "(", ")", "self", ".", "autoproxy", "=", "autoproxy", "self", ".", "part", "=", "part" ]
https://github.com/cocoakekeyu/autoproxy/blob/c7298b1d46129e7bbb58d5a701be4e01025dde4f/autoproxy.py#L233-L236
oracle/graalpython
577e02da9755d916056184ec441c26e00b70145c
graalpython/lib-python/3/urllib/parse.py
python
urlunparse
(components)
return _coerce_result(urlunsplit((scheme, netloc, url, query, fragment)))
Put a parsed URL back together again. This may result in a slightly different, but equivalent URL, if the URL that was parsed originally had redundant delimiters, e.g. a ? with an empty query (the draft states that these are equivalent).
Put a parsed URL back together again. This may result in a slightly different, but equivalent URL, if the URL that was parsed originally had redundant delimiters, e.g. a ? with an empty query (the draft states that these are equivalent).
[ "Put", "a", "parsed", "URL", "back", "together", "again", ".", "This", "may", "result", "in", "a", "slightly", "different", "but", "equivalent", "URL", "if", "the", "URL", "that", "was", "parsed", "originally", "had", "redundant", "delimiters", "e", ".", "...
def urlunparse(components): """Put a parsed URL back together again. This may result in a slightly different, but equivalent URL, if the URL that was parsed originally had redundant delimiters, e.g. a ? with an empty query (the draft states that these are equivalent).""" scheme, netloc, url, params...
[ "def", "urlunparse", "(", "components", ")", ":", "scheme", ",", "netloc", ",", "url", ",", "params", ",", "query", ",", "fragment", ",", "_coerce_result", "=", "(", "_coerce_args", "(", "*", "components", ")", ")", "if", "params", ":", "url", "=", "\"...
https://github.com/oracle/graalpython/blob/577e02da9755d916056184ec441c26e00b70145c/graalpython/lib-python/3/urllib/parse.py#L474-L483
bhoov/exbert
d27b6236aa51b185f7d3fed904f25cabe3baeb1a
server/data_processing/convenience_corpus.py
python
files_available
(base_dir, glob_pattern="*.faiss")
return True
Determine whether the base_dir contains indexed files
Determine whether the base_dir contains indexed files
[ "Determine", "whether", "the", "base_dir", "contains", "indexed", "files" ]
def files_available(base_dir, glob_pattern="*.faiss"): """Determine whether the base_dir contains indexed files""" if not base_dir.exists() or len(list(base_dir.glob(glob_pattern))) == 0: return False return True
[ "def", "files_available", "(", "base_dir", ",", "glob_pattern", "=", "\"*.faiss\"", ")", ":", "if", "not", "base_dir", ".", "exists", "(", ")", "or", "len", "(", "list", "(", "base_dir", ".", "glob", "(", "glob_pattern", ")", ")", ")", "==", "0", ":", ...
https://github.com/bhoov/exbert/blob/d27b6236aa51b185f7d3fed904f25cabe3baeb1a/server/data_processing/convenience_corpus.py#L21-L26
khanhnamle1994/natural-language-processing
01d450d5ac002b0156ef4cf93a07cb508c1bcdc5
assignment1/.env/lib/python2.7/site-packages/scipy/misc/doccer.py
python
docformat
(docstring, docdict=None)
return docstring % indented
Fill a function docstring from variables in dictionary Adapt the indent of the inserted docs Parameters ---------- docstring : string docstring from function, possibly with dict formatting strings docdict : dict dictionary with keys that match the dict formatting strings an...
Fill a function docstring from variables in dictionary
[ "Fill", "a", "function", "docstring", "from", "variables", "in", "dictionary" ]
def docformat(docstring, docdict=None): ''' Fill a function docstring from variables in dictionary Adapt the indent of the inserted docs Parameters ---------- docstring : string docstring from function, possibly with dict formatting strings docdict : dict dictionary with keys t...
[ "def", "docformat", "(", "docstring", ",", "docdict", "=", "None", ")", ":", "if", "not", "docstring", ":", "return", "docstring", "if", "docdict", "is", "None", ":", "docdict", "=", "{", "}", "if", "not", "docdict", ":", "return", "docstring", "lines", ...
https://github.com/khanhnamle1994/natural-language-processing/blob/01d450d5ac002b0156ef4cf93a07cb508c1bcdc5/assignment1/.env/lib/python2.7/site-packages/scipy/misc/doccer.py#L12-L68
TencentCloud/tencentcloud-sdk-python
3677fd1cdc8c5fd626ce001c13fd3b59d1f279d2
tencentcloud/cpdp/v20190820/models.py
python
CreateAgentTaxPaymentInfosResponse.__init__
(self)
r""" :param AgentTaxPaymentBatch: 代理商完税证明批次信息 :type AgentTaxPaymentBatch: :class:`tencentcloud.cpdp.v20190820.models.AgentTaxPaymentBatch` :param RequestId: 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 :type RequestId: str
r""" :param AgentTaxPaymentBatch: 代理商完税证明批次信息 :type AgentTaxPaymentBatch: :class:`tencentcloud.cpdp.v20190820.models.AgentTaxPaymentBatch` :param RequestId: 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 :type RequestId: str
[ "r", ":", "param", "AgentTaxPaymentBatch", ":", "代理商完税证明批次信息", ":", "type", "AgentTaxPaymentBatch", ":", ":", "class", ":", "tencentcloud", ".", "cpdp", ".", "v20190820", ".", "models", ".", "AgentTaxPaymentBatch", ":", "param", "RequestId", ":", "唯一请求", "ID,每次请...
def __init__(self): r""" :param AgentTaxPaymentBatch: 代理商完税证明批次信息 :type AgentTaxPaymentBatch: :class:`tencentcloud.cpdp.v20190820.models.AgentTaxPaymentBatch` :param RequestId: 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 :type RequestId: str """ self.AgentTaxPaymen...
[ "def", "__init__", "(", "self", ")", ":", "self", ".", "AgentTaxPaymentBatch", "=", "None", "self", ".", "RequestId", "=", "None" ]
https://github.com/TencentCloud/tencentcloud-sdk-python/blob/3677fd1cdc8c5fd626ce001c13fd3b59d1f279d2/tencentcloud/cpdp/v20190820/models.py#L3606-L3614
IronLanguages/main
a949455434b1fda8c783289e897e78a9a0caabb5
External.LCA_RESTRICTED/Languages/IronPython/27/Doc/sphinx/pycode/pgen2/parse.py
python
Parser.setup
(self, start=None)
Prepare for parsing. This *must* be called before starting to parse. The optional argument is an alternative start symbol; it defaults to the grammar's start symbol. You can use a Parser instance to parse any number of programs; each time you call setup() the parser is reset t...
Prepare for parsing.
[ "Prepare", "for", "parsing", "." ]
def setup(self, start=None): """Prepare for parsing. This *must* be called before starting to parse. The optional argument is an alternative start symbol; it defaults to the grammar's start symbol. You can use a Parser instance to parse any number of programs; each tim...
[ "def", "setup", "(", "self", ",", "start", "=", "None", ")", ":", "if", "start", "is", "None", ":", "start", "=", "self", ".", "grammar", ".", "start", "# Each stack entry is a tuple: (dfa, state, node).", "# A node is a tuple: (type, value, context, children),", "# w...
https://github.com/IronLanguages/main/blob/a949455434b1fda8c783289e897e78a9a0caabb5/External.LCA_RESTRICTED/Languages/IronPython/27/Doc/sphinx/pycode/pgen2/parse.py#L89-L111
wistbean/fxxkpython
88e16d79d8dd37236ba6ecd0d0ff11d63143968c
vip/qyxuan/projects/Snake/venv/lib/python3.6/site-packages/pip-19.0.3-py3.6.egg/pip/_vendor/urllib3/connectionpool.py
python
HTTPSConnectionPool._prepare_conn
(self, conn)
return conn
Prepare the ``connection`` for :meth:`urllib3.util.ssl_wrap_socket` and establish the tunnel if proxy is used.
Prepare the ``connection`` for :meth:`urllib3.util.ssl_wrap_socket` and establish the tunnel if proxy is used.
[ "Prepare", "the", "connection", "for", ":", "meth", ":", "urllib3", ".", "util", ".", "ssl_wrap_socket", "and", "establish", "the", "tunnel", "if", "proxy", "is", "used", "." ]
def _prepare_conn(self, conn): """ Prepare the ``connection`` for :meth:`urllib3.util.ssl_wrap_socket` and establish the tunnel if proxy is used. """ if isinstance(conn, VerifiedHTTPSConnection): conn.set_cert(key_file=self.key_file, cert_fi...
[ "def", "_prepare_conn", "(", "self", ",", "conn", ")", ":", "if", "isinstance", "(", "conn", ",", "VerifiedHTTPSConnection", ")", ":", "conn", ".", "set_cert", "(", "key_file", "=", "self", ".", "key_file", ",", "cert_file", "=", "self", ".", "cert_file", ...
https://github.com/wistbean/fxxkpython/blob/88e16d79d8dd37236ba6ecd0d0ff11d63143968c/vip/qyxuan/projects/Snake/venv/lib/python3.6/site-packages/pip-19.0.3-py3.6.egg/pip/_vendor/urllib3/connectionpool.py#L782-L797
saltstack/salt
fae5bc757ad0f1716483ce7ae180b451545c2058
salt/modules/freebsdkmod.py
python
remove
(mod, persist=False, comment=True)
Remove the specified kernel module mod Name of module to remove persist Also remove module from /boot/loader.conf comment If persist is set don't remove line from /boot/loader.conf but only comment it CLI Example: .. code-block:: bash salt '*' kmod.remov...
Remove the specified kernel module
[ "Remove", "the", "specified", "kernel", "module" ]
def remove(mod, persist=False, comment=True): """ Remove the specified kernel module mod Name of module to remove persist Also remove module from /boot/loader.conf comment If persist is set don't remove line from /boot/loader.conf but only comment it CLI Examp...
[ "def", "remove", "(", "mod", ",", "persist", "=", "False", ",", "comment", "=", "True", ")", ":", "pre_mods", "=", "lsmod", "(", ")", "res", "=", "__salt__", "[", "\"cmd.run_all\"", "]", "(", "\"kldunload {}\"", ".", "format", "(", "mod", ")", ",", "...
https://github.com/saltstack/salt/blob/fae5bc757ad0f1716483ce7ae180b451545c2058/salt/modules/freebsdkmod.py#L236-L266
DataBiosphere/toil
2e148eee2114ece8dcc3ec8a83f36333266ece0d
contrib/admin/cleanup_aws_resources.py
python
contains_uuid_with_underscores
(string)
return bool(re.compile('[0-9a-f]{8}_[0-9a-f]{4}_[0-9a-f]{4}_[0-9a-f]{4}_[0-9a-f]{12}').findall(string))
Determines if a string contains a pattern like: '28064c76-a491-43e7-9b50-da424f920354', which toil uses in its test generated IAM role names.
Determines if a string contains a pattern like: '28064c76-a491-43e7-9b50-da424f920354', which toil uses in its test generated IAM role names.
[ "Determines", "if", "a", "string", "contains", "a", "pattern", "like", ":", "28064c76", "-", "a491", "-", "43e7", "-", "9b50", "-", "da424f920354", "which", "toil", "uses", "in", "its", "test", "generated", "IAM", "role", "names", "." ]
def contains_uuid_with_underscores(string): """ Determines if a string contains a pattern like: '28064c76-a491-43e7-9b50-da424f920354', which toil uses in its test generated IAM role names. """ return bool(re.compile('[0-9a-f]{8}_[0-9a-f]{4}_[0-9a-f]{4}_[0-9a-f]{4}_[0-9a-f]{12}').findall(string))
[ "def", "contains_uuid_with_underscores", "(", "string", ")", ":", "return", "bool", "(", "re", ".", "compile", "(", "'[0-9a-f]{8}_[0-9a-f]{4}_[0-9a-f]{4}_[0-9a-f]{4}_[0-9a-f]{12}'", ")", ".", "findall", "(", "string", ")", ")" ]
https://github.com/DataBiosphere/toil/blob/2e148eee2114ece8dcc3ec8a83f36333266ece0d/contrib/admin/cleanup_aws_resources.py#L50-L55
bungnoid/glTools
8ff0899de43784a18bd4543285655e68e28fb5e5
tools/proxyMesh.py
python
proxyParent
(proxyMesh,joint)
return proxyShapes
Parent a proxy mesh shape to a specified parent joint @param proxyMesh: Proxy mesh shape to parent to joint @type proxyMesh: str @param joint: Joint to parent mesh shape to @type joint: str
Parent a proxy mesh shape to a specified parent joint
[ "Parent", "a", "proxy", "mesh", "shape", "to", "a", "specified", "parent", "joint" ]
def proxyParent(proxyMesh,joint): ''' Parent a proxy mesh shape to a specified parent joint @param proxyMesh: Proxy mesh shape to parent to joint @type proxyMesh: str @param joint: Joint to parent mesh shape to @type joint: str ''' # Checks if not mc.objExists(proxyMesh): raise Exception('Proxy mesh "'+proxy...
[ "def", "proxyParent", "(", "proxyMesh", ",", "joint", ")", ":", "# Checks", "if", "not", "mc", ".", "objExists", "(", "proxyMesh", ")", ":", "raise", "Exception", "(", "'Proxy mesh \"'", "+", "proxyMesh", "+", "'\" does not exist!'", ")", "if", "not", "mc", ...
https://github.com/bungnoid/glTools/blob/8ff0899de43784a18bd4543285655e68e28fb5e5/tools/proxyMesh.py#L32-L68
niwinz/djorm-pgarray
2ca5142f235e9c23cfae0b46062cf89d97ed8d7c
djorm_pgarray/fields.py
python
FloatArrayField.__init__
(self, *args, **kwargs)
[]
def __init__(self, *args, **kwargs): kwargs.setdefault("dbtype", "double precision") super(FloatArrayField, self).__init__(*args, **kwargs)
[ "def", "__init__", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "kwargs", ".", "setdefault", "(", "\"dbtype\"", ",", "\"double precision\"", ")", "super", "(", "FloatArrayField", ",", "self", ")", ".", "__init__", "(", "*", "args", ...
https://github.com/niwinz/djorm-pgarray/blob/2ca5142f235e9c23cfae0b46062cf89d97ed8d7c/djorm_pgarray/fields.py#L191-L193
julesontheroad/NSC_BUILDER
e9083e83383281bdd9e167d3141163dcc56b6710
py/ztools/lib/aes128.py
python
AESCBC.encrypt
(self, data, iv=None)
return out
Encrypts some data in CBC mode.
Encrypts some data in CBC mode.
[ "Encrypts", "some", "data", "in", "CBC", "mode", "." ]
def encrypt(self, data, iv=None): '''Encrypts some data in CBC mode.''' if iv is None: iv = self.iv out = b'' while data: encb = self.aes.encrypt_block_ecb(sxor(data[:0x10], iv)) out += encb iv = encb data = data[0x10:] return out
[ "def", "encrypt", "(", "self", ",", "data", ",", "iv", "=", "None", ")", ":", "if", "iv", "is", "None", ":", "iv", "=", "self", ".", "iv", "out", "=", "b''", "while", "data", ":", "encb", "=", "self", ".", "aes", ".", "encrypt_block_ecb", "(", ...
https://github.com/julesontheroad/NSC_BUILDER/blob/e9083e83383281bdd9e167d3141163dcc56b6710/py/ztools/lib/aes128.py#L21-L31
graphcore/examples
46d2b7687b829778369fc6328170a7b14761e5c6
applications/tensorflow/contrastive_divergence_vae/models/vae/vae_base.py
python
VAE.iwae_elbo
(self, X_b, proposal_sampler=None, proposal_log_prob=None)
return iwae_elbo_loop(sample_idx),
More memory-efficient implementation of importance-weighted ELBO which accumulates IWELBO scores over latent samples (rather than storing all values and then doing log-sum-exp). :param X_b: input tensor to calculate model IWELBO for :param proposal_sampler: function, which takes input of the req...
More memory-efficient implementation of importance-weighted ELBO which accumulates IWELBO scores over latent samples (rather than storing all values and then doing log-sum-exp). :param X_b: input tensor to calculate model IWELBO for :param proposal_sampler: function, which takes input of the req...
[ "More", "memory", "-", "efficient", "implementation", "of", "importance", "-", "weighted", "ELBO", "which", "accumulates", "IWELBO", "scores", "over", "latent", "samples", "(", "rather", "than", "storing", "all", "values", "and", "then", "doing", "log", "-", "...
def iwae_elbo(self, X_b, proposal_sampler=None, proposal_log_prob=None): """ More memory-efficient implementation of importance-weighted ELBO which accumulates IWELBO scores over latent samples (rather than storing all values and then doing log-sum-exp). :param X_b: input tensor to calcu...
[ "def", "iwae_elbo", "(", "self", ",", "X_b", ",", "proposal_sampler", "=", "None", ",", "proposal_log_prob", "=", "None", ")", ":", "# Get parameters of approximate latent posterior q(Z|X)", "Z_cond_X_mu", ",", "Z_cond_X_sigma", "=", "self", ".", "encoder", "(", "tf...
https://github.com/graphcore/examples/blob/46d2b7687b829778369fc6328170a7b14761e5c6/applications/tensorflow/contrastive_divergence_vae/models/vae/vae_base.py#L151-L251
wistbean/fxxkpython
88e16d79d8dd37236ba6ecd0d0ff11d63143968c
vip/qyxuan/projects/venv/lib/python3.6/site-packages/pip-19.0.3-py3.6.egg/pip/_internal/utils/logging.py
python
setup_logging
(verbosity, no_color, user_log_file)
return level_number
Configures and sets up all of the logging Returns the requested logging level, as its integer value.
Configures and sets up all of the logging
[ "Configures", "and", "sets", "up", "all", "of", "the", "logging" ]
def setup_logging(verbosity, no_color, user_log_file): """Configures and sets up all of the logging Returns the requested logging level, as its integer value. """ # Determine the level to be logging at. if verbosity >= 1: level = "DEBUG" elif verbosity == -1: level = "WARNING" ...
[ "def", "setup_logging", "(", "verbosity", ",", "no_color", ",", "user_log_file", ")", ":", "# Determine the level to be logging at.", "if", "verbosity", ">=", "1", ":", "level", "=", "\"DEBUG\"", "elif", "verbosity", "==", "-", "1", ":", "level", "=", "\"WARNING...
https://github.com/wistbean/fxxkpython/blob/88e16d79d8dd37236ba6ecd0d0ff11d63143968c/vip/qyxuan/projects/venv/lib/python3.6/site-packages/pip-19.0.3-py3.6.egg/pip/_internal/utils/logging.py#L217-L318
liaohuqiu/btcbot-open
bb46896b5e24449bc41f65a876d8d7c886a340c1
src/btfxwss/client.py
python
BtfxWssClient.orders_update
(self)
return self.queue_processor.account['Order Update']
Return queue containing order updates associated with the user account. :return: Queue()
Return queue containing order updates associated with the user account.
[ "Return", "queue", "containing", "order", "updates", "associated", "with", "the", "user", "account", "." ]
def orders_update(self): """Return queue containing order updates associated with the user account. :return: Queue() """ return self.queue_processor.account['Order Update']
[ "def", "orders_update", "(", "self", ")", ":", "return", "self", ".", "queue_processor", ".", "account", "[", "'Order Update'", "]" ]
https://github.com/liaohuqiu/btcbot-open/blob/bb46896b5e24449bc41f65a876d8d7c886a340c1/src/btfxwss/client.py#L72-L77
keiffster/program-y
8c99b56f8c32f01a7b9887b5daae9465619d0385
src/programy/clients/render/renderer.py
python
RichMediaRenderer.handle_list
(self, client_context, lst)
return None
[]
def handle_list(self, client_context, lst): del client_context del lst return None
[ "def", "handle_list", "(", "self", ",", "client_context", ",", "lst", ")", ":", "del", "client_context", "del", "lst", "return", "None" ]
https://github.com/keiffster/program-y/blob/8c99b56f8c32f01a7b9887b5daae9465619d0385/src/programy/clients/render/renderer.py#L469-L472
ClusterHQ/flocker
eaa586248986d7cd681c99c948546c2b507e44de
flocker/restapi/_infrastructure.py
python
structured
(inputSchema, outputSchema, schema_store=None, ignore_body=False)
return deco
Decorate a Klein-style endpoint method so that the request body is automatically decoded and the response body is automatically encoded. Items in the object encoded in the request body will be passed to C{original} as keyword arguments. For example:: {"foo": "bar"} If this request body is re...
Decorate a Klein-style endpoint method so that the request body is automatically decoded and the response body is automatically encoded.
[ "Decorate", "a", "Klein", "-", "style", "endpoint", "method", "so", "that", "the", "request", "body", "is", "automatically", "decoded", "and", "the", "response", "body", "is", "automatically", "encoded", "." ]
def structured(inputSchema, outputSchema, schema_store=None, ignore_body=False): """ Decorate a Klein-style endpoint method so that the request body is automatically decoded and the response body is automatically encoded. Items in the object encoded in the request body will be passed to ...
[ "def", "structured", "(", "inputSchema", ",", "outputSchema", ",", "schema_store", "=", "None", ",", "ignore_body", "=", "False", ")", ":", "if", "schema_store", "is", "None", ":", "schema_store", "=", "{", "}", "inputValidator", "=", "getValidator", "(", "i...
https://github.com/ClusterHQ/flocker/blob/eaa586248986d7cd681c99c948546c2b507e44de/flocker/restapi/_infrastructure.py#L203-L269
FederatedAI/FATE
32540492623568ecd1afcb367360133616e02fa3
python/federatedml/callbacks/callback_list.py
python
CallbackList.init_callback_list
(self, callback_param: CallbackParam)
[]
def init_callback_list(self, callback_param: CallbackParam): LOGGER.debug(f"self_model: {self.model}") if "EarlyStopping" in callback_param.callbacks or \ "PerformanceEvaluate" in callback_param.callbacks: has_arbiter = self.model.component_properties.has_arbiter ...
[ "def", "init_callback_list", "(", "self", ",", "callback_param", ":", "CallbackParam", ")", ":", "LOGGER", ".", "debug", "(", "f\"self_model: {self.model}\"", ")", "if", "\"EarlyStopping\"", "in", "callback_param", ".", "callbacks", "or", "\"PerformanceEvaluate\"", "i...
https://github.com/FederatedAI/FATE/blob/32540492623568ecd1afcb367360133616e02fa3/python/federatedml/callbacks/callback_list.py#L29-L44
ambujraj/hacktoberfest2018
53df2cac8b3404261131a873352ec4f2ffa3544d
MAC_changer/venv/lib/python3.7/site-packages/pip-10.0.1-py3.7.egg/pip/_vendor/distlib/database.py
python
make_graph
(dists, scheme='default')
return graph
Makes a dependency graph from the given distributions. :parameter dists: a list of distributions :type dists: list of :class:`distutils2.database.InstalledDistribution` and :class:`distutils2.database.EggInfoDistribution` instances :rtype: a :class:`DependencyGraph` instance
Makes a dependency graph from the given distributions.
[ "Makes", "a", "dependency", "graph", "from", "the", "given", "distributions", "." ]
def make_graph(dists, scheme='default'): """Makes a dependency graph from the given distributions. :parameter dists: a list of distributions :type dists: list of :class:`distutils2.database.InstalledDistribution` and :class:`distutils2.database.EggInfoDistribution` instances :rtype: a ...
[ "def", "make_graph", "(", "dists", ",", "scheme", "=", "'default'", ")", ":", "scheme", "=", "get_scheme", "(", "scheme", ")", "graph", "=", "DependencyGraph", "(", ")", "provided", "=", "{", "}", "# maps names to lists of (version, dist) tuples", "# first, build ...
https://github.com/ambujraj/hacktoberfest2018/blob/53df2cac8b3404261131a873352ec4f2ffa3544d/MAC_changer/venv/lib/python3.7/site-packages/pip-10.0.1-py3.7.egg/pip/_vendor/distlib/database.py#L1222-L1273
zhl2008/awd-platform
0416b31abea29743387b10b3914581fbe8e7da5e
web_flaskbb/Python-2.7.9/Doc/includes/mp_synchronize.py
python
test_join_timeout
()
[]
def test_join_timeout(): p = multiprocessing.Process(target=join_timeout_func) p.start() print 'waiting for process to finish' while 1: p.join(timeout=1) if not p.is_alive(): break print '.', sys.stdout.flush()
[ "def", "test_join_timeout", "(", ")", ":", "p", "=", "multiprocessing", ".", "Process", "(", "target", "=", "join_timeout_func", ")", "p", ".", "start", "(", ")", "print", "'waiting for process to finish'", "while", "1", ":", "p", ".", "join", "(", "timeout"...
https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_flaskbb/Python-2.7.9/Doc/includes/mp_synchronize.py#L153-L164
apache/tvm
6eb4ed813ebcdcd9558f0906a1870db8302ff1e0
python/tvm/relay/op/op.py
python
register_infer_correct_layout
(op_name, infer_layout=None, level=10)
return tvm.ir.register_op_attr(op_name, "FInferCorrectLayout", infer_layout, level)
Register infer op layout function for an op Parameters ---------- op_name : str The name of the operator infer_layout: function (attrs: Attrs, inputs: List[Layout]) -> InferCorrectLayoutOutput The function to infer correct layout level : int The priority level
Register infer op layout function for an op
[ "Register", "infer", "op", "layout", "function", "for", "an", "op" ]
def register_infer_correct_layout(op_name, infer_layout=None, level=10): """Register infer op layout function for an op Parameters ---------- op_name : str The name of the operator infer_layout: function (attrs: Attrs, inputs: List[Layout]) -> InferCorrectLayoutOutput The function ...
[ "def", "register_infer_correct_layout", "(", "op_name", ",", "infer_layout", "=", "None", ",", "level", "=", "10", ")", ":", "return", "tvm", ".", "ir", ".", "register_op_attr", "(", "op_name", ",", "\"FInferCorrectLayout\"", ",", "infer_layout", ",", "level", ...
https://github.com/apache/tvm/blob/6eb4ed813ebcdcd9558f0906a1870db8302ff1e0/python/tvm/relay/op/op.py#L344-L358
michael-lazar/rtv
b3d5bf16a70dba685e05db35308cc8a6d2b7f7aa
rtv/packages/praw/handlers.py
python
MultiprocessHandler.request
(self, **kwargs)
return self._relay(method='request', **kwargs)
Forward the request to the server and return its HTTP response.
Forward the request to the server and return its HTTP response.
[ "Forward", "the", "request", "to", "the", "server", "and", "return", "its", "HTTP", "response", "." ]
def request(self, **kwargs): """Forward the request to the server and return its HTTP response.""" return self._relay(method='request', **kwargs)
[ "def", "request", "(", "self", ",", "*", "*", "kwargs", ")", ":", "return", "self", ".", "_relay", "(", "method", "=", "'request'", ",", "*", "*", "kwargs", ")" ]
https://github.com/michael-lazar/rtv/blob/b3d5bf16a70dba685e05db35308cc8a6d2b7f7aa/rtv/packages/praw/handlers.py#L241-L243
plotly/plotly.py
cfad7862594b35965c0e000813bd7805e8494a5b
packages/python/plotly/plotly/graph_objs/_choropleth.py
python
Choropleth.ids
(self)
return self["ids"]
Assigns id labels to each datum. These ids for object constancy of data points during animation. Should be an array of strings, not numbers or any other type. The 'ids' property is an array that may be specified as a tuple, list, numpy array, or pandas Series Returns ...
Assigns id labels to each datum. These ids for object constancy of data points during animation. Should be an array of strings, not numbers or any other type. The 'ids' property is an array that may be specified as a tuple, list, numpy array, or pandas Series
[ "Assigns", "id", "labels", "to", "each", "datum", ".", "These", "ids", "for", "object", "constancy", "of", "data", "points", "during", "animation", ".", "Should", "be", "an", "array", "of", "strings", "not", "numbers", "or", "any", "other", "type", ".", ...
def ids(self): """ Assigns id labels to each datum. These ids for object constancy of data points during animation. Should be an array of strings, not numbers or any other type. The 'ids' property is an array that may be specified as a tuple, list, numpy array, or pa...
[ "def", "ids", "(", "self", ")", ":", "return", "self", "[", "\"ids\"", "]" ]
https://github.com/plotly/plotly.py/blob/cfad7862594b35965c0e000813bd7805e8494a5b/packages/python/plotly/plotly/graph_objs/_choropleth.py#L758-L771
zhl2008/awd-platform
0416b31abea29743387b10b3914581fbe8e7da5e
web_flaskbb/Python-2.7.9/Demo/classes/Complex.py
python
Re
(obj)
return obj
[]
def Re(obj): if IsComplex(obj): return obj.re return obj
[ "def", "Re", "(", "obj", ")", ":", "if", "IsComplex", "(", "obj", ")", ":", "return", "obj", ".", "re", "return", "obj" ]
https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_flaskbb/Python-2.7.9/Demo/classes/Complex.py#L86-L89
bjmayor/hacker
e3ce2ad74839c2733b27dac6c0f495e0743e1866
venv/lib/python3.5/site-packages/pip/utils/__init__.py
python
captured_output
(stream_name)
Return a context manager used by captured_stdout/stdin/stderr that temporarily replaces the sys stream *stream_name* with a StringIO. Taken from Lib/support/__init__.py in the CPython repo.
Return a context manager used by captured_stdout/stdin/stderr that temporarily replaces the sys stream *stream_name* with a StringIO.
[ "Return", "a", "context", "manager", "used", "by", "captured_stdout", "/", "stdin", "/", "stderr", "that", "temporarily", "replaces", "the", "sys", "stream", "*", "stream_name", "*", "with", "a", "StringIO", "." ]
def captured_output(stream_name): """Return a context manager used by captured_stdout/stdin/stderr that temporarily replaces the sys stream *stream_name* with a StringIO. Taken from Lib/support/__init__.py in the CPython repo. """ orig_stdout = getattr(sys, stream_name) setattr(sys, stream_name...
[ "def", "captured_output", "(", "stream_name", ")", ":", "orig_stdout", "=", "getattr", "(", "sys", ",", "stream_name", ")", "setattr", "(", "sys", ",", "stream_name", ",", "StreamWrapper", ".", "from_stream", "(", "orig_stdout", ")", ")", "try", ":", "yield"...
https://github.com/bjmayor/hacker/blob/e3ce2ad74839c2733b27dac6c0f495e0743e1866/venv/lib/python3.5/site-packages/pip/utils/__init__.py#L784-L795
entropy1337/infernal-twin
10995cd03312e39a48ade0f114ebb0ae3a711bb8
Modules/build/pillow/build/scripts-2.7/pildriver.py
python
PILDriver.push
(self, item)
Push an argument onto the evaluation stack.
Push an argument onto the evaluation stack.
[ "Push", "an", "argument", "onto", "the", "evaluation", "stack", "." ]
def push(self, item): "Push an argument onto the evaluation stack." self.stack = [item] + self.stack
[ "def", "push", "(", "self", ",", "item", ")", ":", "self", ".", "stack", "=", "[", "item", "]", "+", "self", ".", "stack" ]
https://github.com/entropy1337/infernal-twin/blob/10995cd03312e39a48ade0f114ebb0ae3a711bb8/Modules/build/pillow/build/scripts-2.7/pildriver.py#L71-L73
pyparallel/pyparallel
11e8c6072d48c8f13641925d17b147bf36ee0ba3
Lib/site-packages/tornado-4.3b2-py3.3-win-amd64.egg/tornado/iostream.py
python
BaseIOStream._find_read_pos
(self)
return None
Attempts to find a position in the read buffer that satisfies the currently-pending read. Returns a position in the buffer if the current read can be satisfied, or None if it cannot.
Attempts to find a position in the read buffer that satisfies the currently-pending read.
[ "Attempts", "to", "find", "a", "position", "in", "the", "read", "buffer", "that", "satisfies", "the", "currently", "-", "pending", "read", "." ]
def _find_read_pos(self): """Attempts to find a position in the read buffer that satisfies the currently-pending read. Returns a position in the buffer if the current read can be satisfied, or None if it cannot. """ if (self._read_bytes is not None and (self....
[ "def", "_find_read_pos", "(", "self", ")", ":", "if", "(", "self", ".", "_read_bytes", "is", "not", "None", "and", "(", "self", ".", "_read_buffer_size", ">=", "self", ".", "_read_bytes", "or", "(", "self", ".", "_read_partial", "and", "self", ".", "_rea...
https://github.com/pyparallel/pyparallel/blob/11e8c6072d48c8f13641925d17b147bf36ee0ba3/Lib/site-packages/tornado-4.3b2-py3.3-win-amd64.egg/tornado/iostream.py#L772-L818
CouchPotato/CouchPotatoV1
135b3331d1b88ef645e29b76f2d4cc4a732c9232
library/sqlalchemy/engine/base.py
python
ExecutionContext.handle_dbapi_exception
(self, e)
Receive a DBAPI exception which occured upon execute, result fetch, etc.
Receive a DBAPI exception which occured upon execute, result fetch, etc.
[ "Receive", "a", "DBAPI", "exception", "which", "occured", "upon", "execute", "result", "fetch", "etc", "." ]
def handle_dbapi_exception(self, e): """Receive a DBAPI exception which occured upon execute, result fetch, etc.""" raise NotImplementedError()
[ "def", "handle_dbapi_exception", "(", "self", ",", "e", ")", ":", "raise", "NotImplementedError", "(", ")" ]
https://github.com/CouchPotato/CouchPotatoV1/blob/135b3331d1b88ef645e29b76f2d4cc4a732c9232/library/sqlalchemy/engine/base.py#L619-L623
Ericsson/codechecker
c4e43f62dc3acbf71d3109b337db7c97f7852f43
web/server/codechecker_server/session_manager.py
python
SessionManager.get_failure_zip_size
(self)
return limit.get('failure_zip_size')
Maximum size of the collected failed zips which can be store on the server.
Maximum size of the collected failed zips which can be store on the server.
[ "Maximum", "size", "of", "the", "collected", "failed", "zips", "which", "can", "be", "store", "on", "the", "server", "." ]
def get_failure_zip_size(self): """ Maximum size of the collected failed zips which can be store on the server. """ limit = self.__store_config.get('limit', {}) return limit.get('failure_zip_size')
[ "def", "get_failure_zip_size", "(", "self", ")", ":", "limit", "=", "self", ".", "__store_config", ".", "get", "(", "'limit'", ",", "{", "}", ")", "return", "limit", ".", "get", "(", "'failure_zip_size'", ")" ]
https://github.com/Ericsson/codechecker/blob/c4e43f62dc3acbf71d3109b337db7c97f7852f43/web/server/codechecker_server/session_manager.py#L668-L674