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
yihui-he/KL-Loss
66c0ed9e886a2218f4cf88c0efd4f40199bff54a
detectron/roi_data/retinanet.py
python
add_retinanet_blobs
(blobs, im_scales, roidb, image_width, image_height)
return True
Add RetinaNet blobs.
Add RetinaNet blobs.
[ "Add", "RetinaNet", "blobs", "." ]
def add_retinanet_blobs(blobs, im_scales, roidb, image_width, image_height): """Add RetinaNet blobs.""" # RetinaNet is applied to many feature levels, as in the FPN paper k_max, k_min = cfg.FPN.RPN_MAX_LEVEL, cfg.FPN.RPN_MIN_LEVEL scales_per_octave = cfg.RETINANET.SCALES_PER_OCTAVE num_aspect_ratios...
[ "def", "add_retinanet_blobs", "(", "blobs", ",", "im_scales", ",", "roidb", ",", "image_width", ",", "image_height", ")", ":", "# RetinaNet is applied to many feature levels, as in the FPN paper", "k_max", ",", "k_min", "=", "cfg", ".", "FPN", ".", "RPN_MAX_LEVEL", ",...
https://github.com/yihui-he/KL-Loss/blob/66c0ed9e886a2218f4cf88c0efd4f40199bff54a/detectron/roi_data/retinanet.py#L78-L179
HeinleinSupport/check_mk_extensions
aa7d7389b812ed00f91dad61d66fb676284897d8
msexch_database_size/lib/check_mk/base/cee/plugins/bakery/msexch_database_size.py
python
get_msexch_database_size_files
(conf: Dict[str, Any])
[]
def get_msexch_database_size_files(conf: Dict[str, Any]) -> FileGenerator: yield Plugin(base_os=OS.WINDOWS, source=Path("msexch_database_size.ps1"))
[ "def", "get_msexch_database_size_files", "(", "conf", ":", "Dict", "[", "str", ",", "Any", "]", ")", "->", "FileGenerator", ":", "yield", "Plugin", "(", "base_os", "=", "OS", ".", "WINDOWS", ",", "source", "=", "Path", "(", "\"msexch_database_size.ps1\"", ")...
https://github.com/HeinleinSupport/check_mk_extensions/blob/aa7d7389b812ed00f91dad61d66fb676284897d8/msexch_database_size/lib/check_mk/base/cee/plugins/bakery/msexch_database_size.py#L23-L25
mcfletch/pyopengl
02d11dad9ff18e50db10e975c4756e17bf198464
OpenGL/GL/EXT/paletted_texture.py
python
glInitPalettedTextureEXT
()
return extensions.hasGLExtension( _EXTENSION_NAME )
Return boolean indicating whether this extension is available
Return boolean indicating whether this extension is available
[ "Return", "boolean", "indicating", "whether", "this", "extension", "is", "available" ]
def glInitPalettedTextureEXT(): '''Return boolean indicating whether this extension is available''' from OpenGL import extensions return extensions.hasGLExtension( _EXTENSION_NAME )
[ "def", "glInitPalettedTextureEXT", "(", ")", ":", "from", "OpenGL", "import", "extensions", "return", "extensions", ".", "hasGLExtension", "(", "_EXTENSION_NAME", ")" ]
https://github.com/mcfletch/pyopengl/blob/02d11dad9ff18e50db10e975c4756e17bf198464/OpenGL/GL/EXT/paletted_texture.py#L58-L61
openedx/edx-platform
68dd185a0ab45862a2a61e0f803d7e03d2be71b5
openedx/core/djangoapps/xblock/utils.py
python
get_xblock_id_for_anonymous_user
(user)
Get a unique string that identifies the current anonymous (not logged in) user. (This is different than the "anonymous user ID", which is an anonymized identifier for a logged in user.) Note that this ID is a string, not an int. It is guaranteed to be in a unique namespace that won't collide with "norm...
Get a unique string that identifies the current anonymous (not logged in) user. (This is different than the "anonymous user ID", which is an anonymized identifier for a logged in user.)
[ "Get", "a", "unique", "string", "that", "identifies", "the", "current", "anonymous", "(", "not", "logged", "in", ")", "user", ".", "(", "This", "is", "different", "than", "the", "anonymous", "user", "ID", "which", "is", "an", "anonymized", "identifier", "f...
def get_xblock_id_for_anonymous_user(user): """ Get a unique string that identifies the current anonymous (not logged in) user. (This is different than the "anonymous user ID", which is an anonymized identifier for a logged in user.) Note that this ID is a string, not an int. It is guaranteed to be...
[ "def", "get_xblock_id_for_anonymous_user", "(", "user", ")", ":", "if", "not", "user", "or", "not", "user", ".", "is_anonymous", ":", "raise", "TypeError", "(", "\"get_xblock_id_for_anonymous_user() is only for anonymous (not logged in) users.\"", ")", "if", "hasattr", "(...
https://github.com/openedx/edx-platform/blob/68dd185a0ab45862a2a61e0f803d7e03d2be71b5/openedx/core/djangoapps/xblock/utils.py#L143-L169
securesystemslab/zippy
ff0e84ac99442c2c55fe1d285332cfd4e185e089
zippy/lib-python/3/idlelib/Debugger.py
python
NamespaceViewer.__init__
(self, master, title, dict=None)
[]
def __init__(self, master, title, dict=None): width = 0 height = 40 if dict: height = 20*len(dict) # XXX 20 == observed height of Entry widget self.master = master self.title = title import reprlib self.repr = reprlib.Repr() self.repr.maxstring...
[ "def", "__init__", "(", "self", ",", "master", ",", "title", ",", "dict", "=", "None", ")", ":", "width", "=", "0", "height", "=", "40", "if", "dict", ":", "height", "=", "20", "*", "len", "(", "dict", ")", "# XXX 20 == observed height of Entry widget", ...
https://github.com/securesystemslab/zippy/blob/ff0e84ac99442c2c55fe1d285332cfd4e185e089/zippy/lib-python/3/idlelib/Debugger.py#L408-L433
atomistic-machine-learning/schnetpack
dacf6076d43509dfd8b6694a846ac8453ae39b5e
src/schnetpack/md/simulation_hooks/barostats.py
python
NHCBarostatIsotropic._update_box_velocities
(self, time_step)
Update the velocities of the additional degree of freedom associated with the simulation cells. Args: time_step (float): Current timestep considering YS and multi-timestep integration.
Update the velocities of the additional degree of freedom associated with the simulation cells.
[ "Update", "the", "velocities", "of", "the", "additional", "degree", "of", "freedom", "associated", "with", "the", "simulation", "cells", "." ]
def _update_box_velocities(self, time_step): """ Update the velocities of the additional degree of freedom associated with the simulation cells. Args: time_step (float): Current timestep considering YS and multi-timestep integration. """ b_factor = torch.exp(-0.125 *...
[ "def", "_update_box_velocities", "(", "self", ",", "time_step", ")", ":", "b_factor", "=", "torch", ".", "exp", "(", "-", "0.125", "*", "time_step", "*", "self", ".", "t_velocities_cell", "[", "...", ",", "0", "]", ")", "self", ".", "b_velocities_cell", ...
https://github.com/atomistic-machine-learning/schnetpack/blob/dacf6076d43509dfd8b6694a846ac8453ae39b5e/src/schnetpack/md/simulation_hooks/barostats.py#L525-L536
ahmetcemturan/SFACT
7576e29ba72b33e5058049b77b7b558875542747
skeinforge_application/skeinforge_plugins/craft_plugins/oozebane.py
python
OozebaneSkein.getActiveFeedRateRatio
(self)
return 1.0
Get the feed rate of the first active move over the operating feed rate.
Get the feed rate of the first active move over the operating feed rate.
[ "Get", "the", "feed", "rate", "of", "the", "first", "active", "move", "over", "the", "operating", "feed", "rate", "." ]
def getActiveFeedRateRatio(self): "Get the feed rate of the first active move over the operating feed rate." isSearchExtruderActive = self.isExtruderActive for afterIndex in xrange(self.lineIndex, len(self.lines)): line = self.lines[ afterIndex ] splitLine = gcodec.getSplitLineBeforeBracketSemicolon(line) ...
[ "def", "getActiveFeedRateRatio", "(", "self", ")", ":", "isSearchExtruderActive", "=", "self", ".", "isExtruderActive", "for", "afterIndex", "in", "xrange", "(", "self", ".", "lineIndex", ",", "len", "(", "self", ".", "lines", ")", ")", ":", "line", "=", "...
https://github.com/ahmetcemturan/SFACT/blob/7576e29ba72b33e5058049b77b7b558875542747/skeinforge_application/skeinforge_plugins/craft_plugins/oozebane.py#L176-L189
sametmax/Django--an-app-at-a-time
99eddf12ead76e6dfbeb09ce0bae61e282e22f8a
ignore_this_directory/django/views/generic/dates.py
python
BaseDateListView.get_date_list
(self, queryset, date_type=None, ordering='ASC')
return date_list
Get a date list by calling `queryset.dates/datetimes()`, checking along the way for empty lists that aren't allowed.
Get a date list by calling `queryset.dates/datetimes()`, checking along the way for empty lists that aren't allowed.
[ "Get", "a", "date", "list", "by", "calling", "queryset", ".", "dates", "/", "datetimes", "()", "checking", "along", "the", "way", "for", "empty", "lists", "that", "aren", "t", "allowed", "." ]
def get_date_list(self, queryset, date_type=None, ordering='ASC'): """ Get a date list by calling `queryset.dates/datetimes()`, checking along the way for empty lists that aren't allowed. """ date_field = self.get_date_field() allow_empty = self.get_allow_empty() ...
[ "def", "get_date_list", "(", "self", ",", "queryset", ",", "date_type", "=", "None", ",", "ordering", "=", "'ASC'", ")", ":", "date_field", "=", "self", ".", "get_date_field", "(", ")", "allow_empty", "=", "self", ".", "get_allow_empty", "(", ")", "if", ...
https://github.com/sametmax/Django--an-app-at-a-time/blob/99eddf12ead76e6dfbeb09ce0bae61e282e22f8a/ignore_this_directory/django/views/generic/dates.py#L351-L372
VirtueSecurity/aws-extender
d123b7e1a845847709ba3a481f11996bddc68a1c
BappModules/docutils/parsers/rst/directives/__init__.py
python
single_char_or_whitespace_or_unicode
(argument)
return char
As with `single_char_or_unicode`, but "tab" and "space" are also supported. (Directive option conversion function.)
As with `single_char_or_unicode`, but "tab" and "space" are also supported. (Directive option conversion function.)
[ "As", "with", "single_char_or_unicode", "but", "tab", "and", "space", "are", "also", "supported", ".", "(", "Directive", "option", "conversion", "function", ".", ")" ]
def single_char_or_whitespace_or_unicode(argument): """ As with `single_char_or_unicode`, but "tab" and "space" are also supported. (Directive option conversion function.) """ if argument == 'tab': char = '\t' elif argument == 'space': char = ' ' else: char = single_c...
[ "def", "single_char_or_whitespace_or_unicode", "(", "argument", ")", ":", "if", "argument", "==", "'tab'", ":", "char", "=", "'\\t'", "elif", "argument", "==", "'space'", ":", "char", "=", "' '", "else", ":", "char", "=", "single_char_or_unicode", "(", "argume...
https://github.com/VirtueSecurity/aws-extender/blob/d123b7e1a845847709ba3a481f11996bddc68a1c/BappModules/docutils/parsers/rst/directives/__init__.py#L328-L339
mlcommons/inference
078e21f2bc0a37c7fd0e435d64f5a49760dca823
vision/medical_imaging/3d-unet-kits19/preprocess.py
python
Preprocessor.preprocess_dataset
(self)
Performs preprocess of all the cases collected and then prints summary stats of them
Performs preprocess of all the cases collected and then prints summary stats of them
[ "Performs", "preprocess", "of", "all", "the", "cases", "collected", "and", "then", "prints", "summary", "stats", "of", "them" ]
def preprocess_dataset(self): """ Performs preprocess of all the cases collected and then prints summary stats of them """ for case in self.collect_cases(): self.preprocess_case(case) self.print_stats()
[ "def", "preprocess_dataset", "(", "self", ")", ":", "for", "case", "in", "self", ".", "collect_cases", "(", ")", ":", "self", ".", "preprocess_case", "(", "case", ")", "self", ".", "print_stats", "(", ")" ]
https://github.com/mlcommons/inference/blob/078e21f2bc0a37c7fd0e435d64f5a49760dca823/vision/medical_imaging/3d-unet-kits19/preprocess.py#L259-L265
saltstack/salt
fae5bc757ad0f1716483ce7ae180b451545c2058
salt/utils/win_chcp.py
python
chcp
(page_id, raise_error=False)
Gets or sets the codepage of the shell. Args: page_id (str, int): A number representing the codepage. raise_error (bool): ``True`` will raise an error if the codepage fails to change. ``False`` will suppress the error Returns: int: A number represe...
Gets or sets the codepage of the shell.
[ "Gets", "or", "sets", "the", "codepage", "of", "the", "shell", "." ]
def chcp(page_id, raise_error=False): """ Gets or sets the codepage of the shell. Args: page_id (str, int): A number representing the codepage. raise_error (bool): ``True`` will raise an error if the codepage fails to change. ``False`` will suppress the...
[ "def", "chcp", "(", "page_id", ",", "raise_error", "=", "False", ")", ":", "if", "not", "isinstance", "(", "page_id", ",", "int", ")", ":", "try", ":", "page_id", "=", "int", "(", "page_id", ")", "except", "ValueError", ":", "error", "=", "\"The `page_...
https://github.com/saltstack/salt/blob/fae5bc757ad0f1716483ce7ae180b451545c2058/salt/utils/win_chcp.py#L33-L78
dimagi/commcare-hq
d67ff1d3b4c51fa050c19e60c3253a79d3452a39
corehq/apps/app_manager/views/releases.py
python
short_odk_url
(request, domain, app_id, with_media=False)
return HttpResponse(short_url)
[]
def short_odk_url(request, domain, app_id, with_media=False): build_profile_id = request.GET.get('profile') short_url = get_app(domain, app_id).get_short_odk_url(with_media=with_media, build_profile_id=build_profile_id) return HttpResponse(short_url)
[ "def", "short_odk_url", "(", "request", ",", "domain", ",", "app_id", ",", "with_media", "=", "False", ")", ":", "build_profile_id", "=", "request", ".", "GET", ".", "get", "(", "'profile'", ")", "short_url", "=", "get_app", "(", "domain", ",", "app_id", ...
https://github.com/dimagi/commcare-hq/blob/d67ff1d3b4c51fa050c19e60c3253a79d3452a39/corehq/apps/app_manager/views/releases.py#L459-L462
lovelylain/pyctp
fd304de4b50c4ddc31a4190b1caaeb5dec66bc5d
example/ctp/lts/ApiStruct.py
python
QrySuperUserFunction.__init__
(self, UserID='')
[]
def __init__(self, UserID=''): self.UserID = ''
[ "def", "__init__", "(", "self", ",", "UserID", "=", "''", ")", ":", "self", ".", "UserID", "=", "''" ]
https://github.com/lovelylain/pyctp/blob/fd304de4b50c4ddc31a4190b1caaeb5dec66bc5d/example/ctp/lts/ApiStruct.py#L1233-L1234
david8862/keras-YOLOv3-model-set
e9f0f94109430973525219e66eeafe8a2f51363d
yolo3/models/yolo3_mobilenet.py
python
yolo3lite_spp_mobilenet_body
(inputs, num_anchors, num_classes, alpha=1.0)
return Model(inputs = inputs, outputs=[y1,y2,y3])
Create YOLO_v3 Lite SPP MobileNet model CNN body in keras.
Create YOLO_v3 Lite SPP MobileNet model CNN body in keras.
[ "Create", "YOLO_v3", "Lite", "SPP", "MobileNet", "model", "CNN", "body", "in", "keras", "." ]
def yolo3lite_spp_mobilenet_body(inputs, num_anchors, num_classes, alpha=1.0): '''Create YOLO_v3 Lite SPP MobileNet model CNN body in keras.''' mobilenet = MobileNet(input_tensor=inputs, weights='imagenet', include_top=False, alpha=alpha) print('backbone layers number: {}'.format(len(mobilenet.layers))) ...
[ "def", "yolo3lite_spp_mobilenet_body", "(", "inputs", ",", "num_anchors", ",", "num_classes", ",", "alpha", "=", "1.0", ")", ":", "mobilenet", "=", "MobileNet", "(", "input_tensor", "=", "inputs", ",", "weights", "=", "'imagenet'", ",", "include_top", "=", "Fa...
https://github.com/david8862/keras-YOLOv3-model-set/blob/e9f0f94109430973525219e66eeafe8a2f51363d/yolo3/models/yolo3_mobilenet.py#L66-L89
holzschu/Carnets
44effb10ddfc6aa5c8b0687582a724ba82c6b547
Library/lib/python3.7/site-packages/IPython/utils/version.py
python
check_version
(v, check)
check version string v >= check If dev/prerelease tags result in TypeError for string-number comparison, it is assumed that the dependency is satisfied. Users on dev branches are responsible for keeping their own packages up to date.
check version string v >= check
[ "check", "version", "string", "v", ">", "=", "check" ]
def check_version(v, check): """check version string v >= check If dev/prerelease tags result in TypeError for string-number comparison, it is assumed that the dependency is satisfied. Users on dev branches are responsible for keeping their own packages up to date. """ try: return Loose...
[ "def", "check_version", "(", "v", ",", "check", ")", ":", "try", ":", "return", "LooseVersion", "(", "v", ")", ">=", "LooseVersion", "(", "check", ")", "except", "TypeError", ":", "return", "True" ]
https://github.com/holzschu/Carnets/blob/44effb10ddfc6aa5c8b0687582a724ba82c6b547/Library/lib/python3.7/site-packages/IPython/utils/version.py#L25-L35
oracle/graalpython
577e02da9755d916056184ec441c26e00b70145c
graalpython/lib-python/3/_pydecimal.py
python
Decimal.is_qnan
(self)
return self._exp == 'n'
Return True if self is a quiet NaN; otherwise return False.
Return True if self is a quiet NaN; otherwise return False.
[ "Return", "True", "if", "self", "is", "a", "quiet", "NaN", ";", "otherwise", "return", "False", "." ]
def is_qnan(self): """Return True if self is a quiet NaN; otherwise return False.""" return self._exp == 'n'
[ "def", "is_qnan", "(", "self", ")", ":", "return", "self", ".", "_exp", "==", "'n'" ]
https://github.com/oracle/graalpython/blob/577e02da9755d916056184ec441c26e00b70145c/graalpython/lib-python/3/_pydecimal.py#L3143-L3145
edisonlz/fastor
342078a18363ac41d3c6b1ab29dbdd44fdb0b7b3
base/site-packages/tornado/httpserver.py
python
HTTPConnection.write
(self, chunk, callback=None)
Writes a chunk of output to the stream.
Writes a chunk of output to the stream.
[ "Writes", "a", "chunk", "of", "output", "to", "the", "stream", "." ]
def write(self, chunk, callback=None): """Writes a chunk of output to the stream.""" assert self._request, "Request closed" if not self.stream.closed(): self._write_callback = stack_context.wrap(callback) self.stream.write(chunk, self._on_write_complete)
[ "def", "write", "(", "self", ",", "chunk", ",", "callback", "=", "None", ")", ":", "assert", "self", ".", "_request", ",", "\"Request closed\"", "if", "not", "self", ".", "stream", ".", "closed", "(", ")", ":", "self", ".", "_write_callback", "=", "sta...
https://github.com/edisonlz/fastor/blob/342078a18363ac41d3c6b1ab29dbdd44fdb0b7b3/base/site-packages/tornado/httpserver.py#L181-L186
pventuzelo/octopus
e8b8c5a9d5f6d9c63605afe9ef1528ab481ec983
octopus/engine/ssa.py
python
SSAEngine.emulate_one_instruction
(self, instr, state, depth)
TODO
TODO
[ "TODO" ]
def emulate_one_instruction(self, instr, state, depth): """ TODO """ raise NotImplementedError
[ "def", "emulate_one_instruction", "(", "self", ",", "instr", ",", "state", ",", "depth", ")", ":", "raise", "NotImplementedError" ]
https://github.com/pventuzelo/octopus/blob/e8b8c5a9d5f6d9c63605afe9ef1528ab481ec983/octopus/engine/ssa.py#L16-L18
DataDog/datadog-serverless-functions
2b28937da7cb8e2fdfa007db45e9fb0c7bd472e9
aws/logs_monitoring/enhanced_lambda_metrics.py
python
LambdaTagsCache.get
(self, resource_arn)
return function_tags
Get the tags for the Lambda function from the cache Will refetch the tags if they are out of date, or a lambda arn is encountered which isn't in the tag list Note: the ARNs in the cache have been lowercased, so resource_arn must be lowercased Args: resource_arn (str): the ...
Get the tags for the Lambda function from the cache
[ "Get", "the", "tags", "for", "the", "Lambda", "function", "from", "the", "cache" ]
def get(self, resource_arn): """Get the tags for the Lambda function from the cache Will refetch the tags if they are out of date, or a lambda arn is encountered which isn't in the tag list Note: the ARNs in the cache have been lowercased, so resource_arn must be lowercased Ar...
[ "def", "get", "(", "self", ",", "resource_arn", ")", ":", "if", "self", ".", "_is_expired", "(", ")", ":", "send_forwarder_internal_metrics", "(", "\"local_cache_expired\"", ")", "logger", ".", "debug", "(", "\"Local cache expired, fetching cache from S3\"", ")", "s...
https://github.com/DataDog/datadog-serverless-functions/blob/2b28937da7cb8e2fdfa007db45e9fb0c7bd472e9/aws/logs_monitoring/enhanced_lambda_metrics.py#L167-L187
zhl2008/awd-platform
0416b31abea29743387b10b3914581fbe8e7da5e
web_flaskbb/lib/python2.7/site-packages/setuptools/_vendor/six.py
python
_SixMetaPathImporter.is_package
(self, fullname)
return hasattr(self.__get_module(fullname), "__path__")
Return true, if the named module is a package. We need this method to get correct spec objects with Python 3.4 (see PEP451)
Return true, if the named module is a package.
[ "Return", "true", "if", "the", "named", "module", "is", "a", "package", "." ]
def is_package(self, fullname): """ Return true, if the named module is a package. We need this method to get correct spec objects with Python 3.4 (see PEP451) """ return hasattr(self.__get_module(fullname), "__path__")
[ "def", "is_package", "(", "self", ",", "fullname", ")", ":", "return", "hasattr", "(", "self", ".", "__get_module", "(", "fullname", ")", ",", "\"__path__\"", ")" ]
https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_flaskbb/lib/python2.7/site-packages/setuptools/_vendor/six.py#L209-L216
tensorflow/models
6b8bb0cbeb3e10415c7a87448f08adc3c484c1d3
research/object_detection/utils/vrd_evaluation.py
python
VRDDetectionEvaluator.add_single_detected_image_info
(self, image_id, detections_dict)
Adds detections for a single image to be used for evaluation. Args: image_id: A unique string/integer identifier for the image. detections_dict: A dictionary containing - standard_fields.DetectionResultFields.detection_boxes: A numpy array of structures with shape [N, 1], representing...
Adds detections for a single image to be used for evaluation.
[ "Adds", "detections", "for", "a", "single", "image", "to", "be", "used", "for", "evaluation", "." ]
def add_single_detected_image_info(self, image_id, detections_dict): """Adds detections for a single image to be used for evaluation. Args: image_id: A unique string/integer identifier for the image. detections_dict: A dictionary containing - standard_fields.DetectionResultFields.detection_...
[ "def", "add_single_detected_image_info", "(", "self", ",", "image_id", ",", "detections_dict", ")", ":", "if", "image_id", "not", "in", "self", ".", "_image_ids", ":", "logging", ".", "warning", "(", "'No groundtruth for the image with id %s.'", ",", "image_id", ")"...
https://github.com/tensorflow/models/blob/6b8bb0cbeb3e10415c7a87448f08adc3c484c1d3/research/object_detection/utils/vrd_evaluation.py#L169-L218
Kozea/WeasyPrint
6cce2978165134e37683cb5b3d156cac6a11a7f9
weasyprint/svg/bounding_box.py
python
bounding_box_circle
(svg, node, font_size)
return cx - r, cy - r, 2 * r, 2 * r
Bounding box for circle node.
Bounding box for circle node.
[ "Bounding", "box", "for", "circle", "node", "." ]
def bounding_box_circle(svg, node, font_size): """Bounding box for circle node.""" cx, cy = svg.point(node.get('cx'), node.get('cy'), font_size) r = svg.length(node.get('r'), font_size) return cx - r, cy - r, 2 * r, 2 * r
[ "def", "bounding_box_circle", "(", "svg", ",", "node", ",", "font_size", ")", ":", "cx", ",", "cy", "=", "svg", ".", "point", "(", "node", ".", "get", "(", "'cx'", ")", ",", "node", ".", "get", "(", "'cy'", ")", ",", "font_size", ")", "r", "=", ...
https://github.com/Kozea/WeasyPrint/blob/6cce2978165134e37683cb5b3d156cac6a11a7f9/weasyprint/svg/bounding_box.py#L40-L44
sergiocorreia/panflute
b9546cf7b88fdc9f00117fca395c4d3590f45769
examples/pandocfilters/gabc.py
python
png
(contents, latex_command)
return src
Creates a png if needed.
Creates a png if needed.
[ "Creates", "a", "png", "if", "needed", "." ]
def png(contents, latex_command): """Creates a png if needed.""" outfile = sha(contents + latex_command) src = os.path.join(IMAGEDIR, outfile + '.png') if not os.path.isfile(src): try: os.mkdir(IMAGEDIR) stderr.write('Created directory ' + IMAGEDIR + '\n') except ...
[ "def", "png", "(", "contents", ",", "latex_command", ")", ":", "outfile", "=", "sha", "(", "contents", "+", "latex_command", ")", "src", "=", "os", ".", "path", ".", "join", "(", "IMAGEDIR", ",", "outfile", "+", "'.png'", ")", "if", "not", "os", ".",...
https://github.com/sergiocorreia/panflute/blob/b9546cf7b88fdc9f00117fca395c4d3590f45769/examples/pandocfilters/gabc.py#L105-L117
CedricGuillemet/Imogen
ee417b42747ed5b46cb11b02ef0c3630000085b3
bin/Lib/codecs.py
python
iterdecode
(iterator, encoding, errors='strict', **kwargs)
Decoding iterator. Decodes the input strings from the iterator using an IncrementalDecoder. errors and kwargs are passed through to the IncrementalDecoder constructor.
Decoding iterator.
[ "Decoding", "iterator", "." ]
def iterdecode(iterator, encoding, errors='strict', **kwargs): """ Decoding iterator. Decodes the input strings from the iterator using an IncrementalDecoder. errors and kwargs are passed through to the IncrementalDecoder constructor. """ decoder = getincrementaldecoder(encoding)(errors, *...
[ "def", "iterdecode", "(", "iterator", ",", "encoding", ",", "errors", "=", "'strict'", ",", "*", "*", "kwargs", ")", ":", "decoder", "=", "getincrementaldecoder", "(", "encoding", ")", "(", "errors", ",", "*", "*", "kwargs", ")", "for", "input", "in", ...
https://github.com/CedricGuillemet/Imogen/blob/ee417b42747ed5b46cb11b02ef0c3630000085b3/bin/Lib/codecs.py#L1031-L1047
OpenCobolIDE/OpenCobolIDE
c78d0d335378e5fe0a5e74f53c19b68b55e85388
open_cobol_ide/extlibs/pyqode/core/managers/file.py
python
FileManager._get_text
(self, encoding)
return text.encode(encoding)
[]
def _get_text(self, encoding): lines = self.editor.toPlainText().splitlines() if self.clean_trailing_whitespaces: lines = [l.rstrip() for l in lines] # remove emtpy ending lines try: last_line = lines[-1] except IndexError: pass # empty file ...
[ "def", "_get_text", "(", "self", ",", "encoding", ")", ":", "lines", "=", "self", ".", "editor", ".", "toPlainText", "(", ")", ".", "splitlines", "(", ")", "if", "self", ".", "clean_trailing_whitespaces", ":", "lines", "=", "[", "l", ".", "rstrip", "("...
https://github.com/OpenCobolIDE/OpenCobolIDE/blob/c78d0d335378e5fe0a5e74f53c19b68b55e85388/open_cobol_ide/extlibs/pyqode/core/managers/file.py#L323-L340
Miserlou/Zappa
5a11c17f5ecf0568bdb73b4baf6fb08ff0184f39
zappa/cli.py
python
ZappaCLI.schedule
(self)
Given a a list of functions and a schedule to execute them, setup up regular execution.
Given a a list of functions and a schedule to execute them, setup up regular execution.
[ "Given", "a", "a", "list", "of", "functions", "and", "a", "schedule", "to", "execute", "them", "setup", "up", "regular", "execution", "." ]
def schedule(self): """ Given a a list of functions and a schedule to execute them, setup up regular execution. """ events = self.stage_config.get('events', []) if events: if not isinstance(events, list): # pragma: no cover print("Events must...
[ "def", "schedule", "(", "self", ")", ":", "events", "=", "self", ".", "stage_config", ".", "get", "(", "'events'", ",", "[", "]", ")", "if", "events", ":", "if", "not", "isinstance", "(", "events", ",", "list", ")", ":", "# pragma: no cover", "print", ...
https://github.com/Miserlou/Zappa/blob/5a11c17f5ecf0568bdb73b4baf6fb08ff0184f39/zappa/cli.py#L1162-L1232
espressif/esptool
41ceca0a72266960252717b3181389902fd89d55
esptool.py
python
ESP8266ROMFirmwareImage.save
(self, basename)
Save a set of V1 images for flashing. Parameter is a base filename.
Save a set of V1 images for flashing. Parameter is a base filename.
[ "Save", "a", "set", "of", "V1", "images", "for", "flashing", ".", "Parameter", "is", "a", "base", "filename", "." ]
def save(self, basename): """ Save a set of V1 images for flashing. Parameter is a base filename. """ # IROM data goes in its own plain binary file irom_segment = self.get_irom_segment() if irom_segment is not None: with open("%s0x%05x.bin" % (basename, irom_segment.addr - ES...
[ "def", "save", "(", "self", ",", "basename", ")", ":", "# IROM data goes in its own plain binary file", "irom_segment", "=", "self", ".", "get_irom_segment", "(", ")", "if", "irom_segment", "is", "not", "None", ":", "with", "open", "(", "\"%s0x%05x.bin\"", "%", ...
https://github.com/espressif/esptool/blob/41ceca0a72266960252717b3181389902fd89d55/esptool.py#L2841-L2856
biopython/biopython
2dd97e71762af7b046d7f7f8a4f1e38db6b06c86
Bio/Blast/Record.py
python
PSIBlast.__init__
(self)
Initialize the class.
Initialize the class.
[ "Initialize", "the", "class", "." ]
def __init__(self): """Initialize the class.""" Header.__init__(self) DatabaseReport.__init__(self) Parameters.__init__(self) self.rounds = [] self.converged = 0
[ "def", "__init__", "(", "self", ")", ":", "Header", ".", "__init__", "(", "self", ")", "DatabaseReport", ".", "__init__", "(", "self", ")", "Parameters", ".", "__init__", "(", "self", ")", "self", ".", "rounds", "=", "[", "]", "self", ".", "converged",...
https://github.com/biopython/biopython/blob/2dd97e71762af7b046d7f7f8a4f1e38db6b06c86/Bio/Blast/Record.py#L454-L460
aliyun/aliyun-openapi-python-sdk
bda53176cc9cf07605b1cf769f0df444cca626a0
aliyun-python-sdk-core/aliyunsdkcore/vendored/requests/packages/urllib3/fields.py
python
RequestField.make_multipart
(self, content_disposition=None, content_type=None, content_location=None)
Makes this request field into a multipart request field. This method overrides "Content-Disposition", "Content-Type" and "Content-Location" headers to the request parameter. :param content_type: The 'Content-Type' of the request body. :param content_location: Th...
Makes this request field into a multipart request field.
[ "Makes", "this", "request", "field", "into", "a", "multipart", "request", "field", "." ]
def make_multipart(self, content_disposition=None, content_type=None, content_location=None): """ Makes this request field into a multipart request field. This method overrides "Content-Disposition", "Content-Type" and "Content-Location" headers to the request par...
[ "def", "make_multipart", "(", "self", ",", "content_disposition", "=", "None", ",", "content_type", "=", "None", ",", "content_location", "=", "None", ")", ":", "self", ".", "headers", "[", "'Content-Disposition'", "]", "=", "content_disposition", "or", "'form-d...
https://github.com/aliyun/aliyun-openapi-python-sdk/blob/bda53176cc9cf07605b1cf769f0df444cca626a0/aliyun-python-sdk-core/aliyunsdkcore/vendored/requests/packages/urllib3/fields.py#L157-L178
ales-tsurko/cells
4cf7e395cd433762bea70cdc863a346f3a6fe1d0
packaging/macos/python/lib/python3.7/idlelib/pyparse.py
python
Parser.is_block_opener
(self)
return self.lastch == ':'
Return True if the last interesting statement opens a block.
Return True if the last interesting statement opens a block.
[ "Return", "True", "if", "the", "last", "interesting", "statement", "opens", "a", "block", "." ]
def is_block_opener(self): "Return True if the last interesting statement opens a block." self._study2() return self.lastch == ':'
[ "def", "is_block_opener", "(", "self", ")", ":", "self", ".", "_study2", "(", ")", "return", "self", ".", "lastch", "==", "':'" ]
https://github.com/ales-tsurko/cells/blob/4cf7e395cd433762bea70cdc863a346f3a6fe1d0/packaging/macos/python/lib/python3.7/idlelib/pyparse.py#L577-L580
Tencent/bk-bcs-saas
2b437bf2f5fd5ce2078f7787c3a12df609f7679d
bcs-app/backend/packages/blue_krill/data_types/enum.py
python
FeatureFlag.__new__
(cls, value)
return cls._missing_(value)
Cast a string into a predefined feature flag.
Cast a string into a predefined feature flag.
[ "Cast", "a", "string", "into", "a", "predefined", "feature", "flag", "." ]
def __new__(cls, value): """Cast a string into a predefined feature flag.""" for field in cls._get_feature_fields_().values(): if field.name == value: return value return cls._missing_(value)
[ "def", "__new__", "(", "cls", ",", "value", ")", ":", "for", "field", "in", "cls", ".", "_get_feature_fields_", "(", ")", ".", "values", "(", ")", ":", "if", "field", ".", "name", "==", "value", ":", "return", "value", "return", "cls", ".", "_missing...
https://github.com/Tencent/bk-bcs-saas/blob/2b437bf2f5fd5ce2078f7787c3a12df609f7679d/bcs-app/backend/packages/blue_krill/data_types/enum.py#L90-L95
Phype/telnet-iot-honeypot
f1d4b75245d72990d339668f37a1670fc85c0c9b
backend/webcontroller.py
python
WebController.get_asn
(self, asn)
[]
def get_asn(self, asn): asn_obj = self.session.query(ASN).filter(ASN.asn == asn).first() if asn_obj: return asn_obj.json(depth=1) else: return None
[ "def", "get_asn", "(", "self", ",", "asn", ")", ":", "asn_obj", "=", "self", ".", "session", ".", "query", "(", "ASN", ")", ".", "filter", "(", "ASN", ".", "asn", "==", "asn", ")", ".", "first", "(", ")", "if", "asn_obj", ":", "return", "asn_obj"...
https://github.com/Phype/telnet-iot-honeypot/blob/f1d4b75245d72990d339668f37a1670fc85c0c9b/backend/webcontroller.py#L240-L246
ClusterHQ/flocker
eaa586248986d7cd681c99c948546c2b507e44de
admin/packaging.py
python
BuildOptions.__init__
(self, distributions)
:param distributions: An iterable of the names of distributions which are acceptable as values for the ``--distribution`` parameter.
:param distributions: An iterable of the names of distributions which are acceptable as values for the ``--distribution`` parameter.
[ ":", "param", "distributions", ":", "An", "iterable", "of", "the", "names", "of", "distributions", "which", "are", "acceptable", "as", "values", "for", "the", "--", "distribution", "parameter", "." ]
def __init__(self, distributions): """ :param distributions: An iterable of the names of distributions which are acceptable as values for the ``--distribution`` parameter. """ usage.Options.__init__(self) self.docs["distribution"] = self.docs["distribution"].format( ...
[ "def", "__init__", "(", "self", ",", "distributions", ")", ":", "usage", ".", "Options", ".", "__init__", "(", "self", ")", "self", ".", "docs", "[", "\"distribution\"", "]", "=", "self", ".", "docs", "[", "\"distribution\"", "]", ".", "format", "(", "...
https://github.com/ClusterHQ/flocker/blob/eaa586248986d7cd681c99c948546c2b507e44de/admin/packaging.py#L1328-L1336
tweecode/twine
45e6350a2b813ec4282440b78f901cf377ead1a9
passagewidget.py
python
PassageWidget.getConnectedWidgets
(self, displayArrows, imageArrows)
return ret
Returns a list of titles of all widgets that will have lines drawn to them.
Returns a list of titles of all widgets that will have lines drawn to them.
[ "Returns", "a", "list", "of", "titles", "of", "all", "widgets", "that", "will", "have", "lines", "drawn", "to", "them", "." ]
def getConnectedWidgets(self, displayArrows, imageArrows): """ Returns a list of titles of all widgets that will have lines drawn to them. """ ret = [] for link in self.linksAndDisplays(): if link in self.passage.links or displayArrows: widget = self....
[ "def", "getConnectedWidgets", "(", "self", ",", "displayArrows", ",", "imageArrows", ")", ":", "ret", "=", "[", "]", "for", "link", "in", "self", ".", "linksAndDisplays", "(", ")", ":", "if", "link", "in", "self", ".", "passage", ".", "links", "or", "d...
https://github.com/tweecode/twine/blob/45e6350a2b813ec4282440b78f901cf377ead1a9/passagewidget.py#L339-L363
IronLanguages/ironpython2
51fdedeeda15727717fb8268a805f71b06c0b9f1
Src/StdLib/Lib/site-packages/win32/lib/win32timezone.py
python
TimeZoneInfo.local
(class_)
return class_(info, fix_standard_time)
Returns the local time zone as defined by the operating system in the registry. >>> localTZ = TimeZoneInfo.local() >>> now_local = datetime.datetime.now(localTZ) >>> now_UTC = datetime.datetime.utcnow() >>> (now_UTC - now_local) < datetime.timedelta(seconds = 5) Traceback (most recent call last): ... ...
Returns the local time zone as defined by the operating system in the registry. >>> localTZ = TimeZoneInfo.local() >>> now_local = datetime.datetime.now(localTZ) >>> now_UTC = datetime.datetime.utcnow() >>> (now_UTC - now_local) < datetime.timedelta(seconds = 5) Traceback (most recent call last): ... ...
[ "Returns", "the", "local", "time", "zone", "as", "defined", "by", "the", "operating", "system", "in", "the", "registry", ".", ">>>", "localTZ", "=", "TimeZoneInfo", ".", "local", "()", ">>>", "now_local", "=", "datetime", ".", "datetime", ".", "now", "(", ...
def local(class_): """Returns the local time zone as defined by the operating system in the registry. >>> localTZ = TimeZoneInfo.local() >>> now_local = datetime.datetime.now(localTZ) >>> now_UTC = datetime.datetime.utcnow() >>> (now_UTC - now_local) < datetime.timedelta(seconds = 5) Traceback (most recen...
[ "def", "local", "(", "class_", ")", ":", "code", ",", "info", "=", "TimeZoneDefinition", ".", "current", "(", ")", "# code is 0 if daylight savings is disabled or not defined", "# code is 1 or 2 if daylight savings is enabled, 2 if currently active", "fix_standard_time", "=", ...
https://github.com/IronLanguages/ironpython2/blob/51fdedeeda15727717fb8268a805f71b06c0b9f1/Src/StdLib/Lib/site-packages/win32/lib/win32timezone.py#L519-L543
intel/virtual-storage-manager
00706ab9701acbd0d5e04b19cc80c6b66a2973b8
source/python-vsmclient/vsmclient/v1/shell.py
python
do_server_remove
(cs, args)
Removes a server.
Removes a server.
[ "Removes", "a", "server", "." ]
def do_server_remove(cs, args): """Removes a server.""" if not args.id: raise exceptions.CommandError("you need to specify Server ID") remove_storage = True remove_monitor = True cluster_id = 1 servers = [] for id in args.id: servers.append({ 'id': id, ...
[ "def", "do_server_remove", "(", "cs", ",", "args", ")", ":", "if", "not", "args", ".", "id", ":", "raise", "exceptions", ".", "CommandError", "(", "\"you need to specify Server ID\"", ")", "remove_storage", "=", "True", "remove_monitor", "=", "True", "cluster_id...
https://github.com/intel/virtual-storage-manager/blob/00706ab9701acbd0d5e04b19cc80c6b66a2973b8/source/python-vsmclient/vsmclient/v1/shell.py#L886-L905
capitalone/giraffez
e5e69cb8728f51fc3b3b45f0c140b39bd6d6f752
giraffez/secret.py
python
Secret.set
(self, key, value)
Set a decrypted value by key in a giraffez configuration file. :param str key: The key used to lookup the encrypted value :param value: Value to set at the given key, can be any value that is YAML serializeable.
Set a decrypted value by key in a giraffez configuration file.
[ "Set", "a", "decrypted", "value", "by", "key", "in", "a", "giraffez", "configuration", "file", "." ]
def set(self, key, value): """ Set a decrypted value by key in a giraffez configuration file. :param str key: The key used to lookup the encrypted value :param value: Value to set at the given key, can be any value that is YAML serializeable. """ if not key.s...
[ "def", "set", "(", "self", ",", "key", ",", "value", ")", ":", "if", "not", "key", ".", "startswith", "(", "\"secure.\"", ")", ":", "key", "=", "\"secure.{0}\"", ".", "format", "(", "key", ")", "self", ".", "config", ".", "set_value", "(", "key", "...
https://github.com/capitalone/giraffez/blob/e5e69cb8728f51fc3b3b45f0c140b39bd6d6f752/giraffez/secret.py#L53-L64
nianticlabs/footprints
dd660dc5922d05cc9e795953791848df5f4e8801
footprints/preprocessing/ground_truth_generation/data_loader.py
python
MatterportLoader.load_scan_data
(self)
load depths, poses, footprints for all frames in a scan
load depths, poses, footprints for all frames in a scan
[ "load", "depths", "poses", "footprints", "for", "all", "frames", "in", "a", "scan" ]
def load_scan_data(self): """ load depths, poses, footprints for all frames in a scan""" ground_segs = [] depths = [] poses = [] intrinsics = [] inv_intrinsics = [] files = sorted(os.listdir(os.path.join(self.training_data_path, 'ground_seg', ...
[ "def", "load_scan_data", "(", "self", ")", ":", "ground_segs", "=", "[", "]", "depths", "=", "[", "]", "poses", "=", "[", "]", "intrinsics", "=", "[", "]", "inv_intrinsics", "=", "[", "]", "files", "=", "sorted", "(", "os", ".", "listdir", "(", "os...
https://github.com/nianticlabs/footprints/blob/dd660dc5922d05cc9e795953791848df5f4e8801/footprints/preprocessing/ground_truth_generation/data_loader.py#L248-L289
selinon/selinon
3613153566d454022a138639f0375c63f490c4cb
selinon/config.py
python
Config._should_config
(node_name, dst_node_name, configuration)
return False
Syntax sugar for configuration entries that accept lists/booleans. :param node_name: node name :param dst_node_name: destination node to which configuration should be propagated :param configuration: configuration that should be checked :return: true if node_name satisfies configuration
Syntax sugar for configuration entries that accept lists/booleans.
[ "Syntax", "sugar", "for", "configuration", "entries", "that", "accept", "lists", "/", "booleans", "." ]
def _should_config(node_name, dst_node_name, configuration): """Syntax sugar for configuration entries that accept lists/booleans. :param node_name: node name :param dst_node_name: destination node to which configuration should be propagated :param configuration: configuration that shou...
[ "def", "_should_config", "(", "node_name", ",", "dst_node_name", ",", "configuration", ")", ":", "if", "configuration", "[", "node_name", "]", "is", "True", ":", "return", "True", "if", "isinstance", "(", "configuration", "[", "node_name", "]", ",", "list", ...
https://github.com/selinon/selinon/blob/3613153566d454022a138639f0375c63f490c4cb/selinon/config.py#L232-L246
holzschu/Carnets
44effb10ddfc6aa5c8b0687582a724ba82c6b547
Library/lib/python3.7/site-packages/matplotlib-3.0.3-py3.7-macosx-10.9-x86_64.egg/matplotlib/type1font.py
python
Type1Font._read
(self, file)
return data
Read the font from a file, decoding into usable parts.
Read the font from a file, decoding into usable parts.
[ "Read", "the", "font", "from", "a", "file", "decoding", "into", "usable", "parts", "." ]
def _read(self, file): """ Read the font from a file, decoding into usable parts. """ rawdata = file.read() if not rawdata.startswith(b'\x80'): return rawdata data = b'' while rawdata: if not rawdata.startswith(b'\x80'): ra...
[ "def", "_read", "(", "self", ",", "file", ")", ":", "rawdata", "=", "file", ".", "read", "(", ")", "if", "not", "rawdata", ".", "startswith", "(", "b'\\x80'", ")", ":", "return", "rawdata", "data", "=", "b''", "while", "rawdata", ":", "if", "not", ...
https://github.com/holzschu/Carnets/blob/44effb10ddfc6aa5c8b0687582a724ba82c6b547/Library/lib/python3.7/site-packages/matplotlib-3.0.3-py3.7-macosx-10.9-x86_64.egg/matplotlib/type1font.py#L69-L98
googleads/google-ads-python
2a1d6062221f6aad1992a6bcca0e7e4a93d2db86
google/ads/googleads/v8/services/services/bidding_seasonality_adjustment_service/client.py
python
BiddingSeasonalityAdjustmentServiceClientMeta.get_transport_class
( cls, label: str = None, )
return next(iter(cls._transport_registry.values()))
Return an appropriate transport class. Args: label: The name of the desired transport. If none is provided, then the first transport in the registry is used. Returns: The transport class to use.
Return an appropriate transport class.
[ "Return", "an", "appropriate", "transport", "class", "." ]
def get_transport_class( cls, label: str = None, ) -> Type[BiddingSeasonalityAdjustmentServiceTransport]: """Return an appropriate transport class. Args: label: The name of the desired transport. If none is provided, then the first transport in the registry is us...
[ "def", "get_transport_class", "(", "cls", ",", "label", ":", "str", "=", "None", ",", ")", "->", "Type", "[", "BiddingSeasonalityAdjustmentServiceTransport", "]", ":", "# If a specific transport is requested, return that one.", "if", "label", ":", "return", "cls", "."...
https://github.com/googleads/google-ads-python/blob/2a1d6062221f6aad1992a6bcca0e7e4a93d2db86/google/ads/googleads/v8/services/services/bidding_seasonality_adjustment_service/client.py#L61-L79
Calysto/calysto_scheme
15bf81987870bcae1264e5a0a06feb9a8ee12b8b
calysto_scheme/scheme.py
python
b_proc_129_d
()
[]
def b_proc_129_d(): if (False if ((not(length_one_q(args_reg))) is False) else True): GLOBALS['msg_reg'] = "incorrect number of arguments to vector->list" GLOBALS['pc'] = runtime_error else: if (False if ((not(vector_q((args_reg).car))) is False) else True): GLOBALS['msg_reg'...
[ "def", "b_proc_129_d", "(", ")", ":", "if", "(", "False", "if", "(", "(", "not", "(", "length_one_q", "(", "args_reg", ")", ")", ")", "is", "False", ")", "else", "True", ")", ":", "GLOBALS", "[", "'msg_reg'", "]", "=", "\"incorrect number of arguments to...
https://github.com/Calysto/calysto_scheme/blob/15bf81987870bcae1264e5a0a06feb9a8ee12b8b/calysto_scheme/scheme.py#L4995-L5007
zhl2008/awd-platform
0416b31abea29743387b10b3914581fbe8e7da5e
web_flaskbb/lib/python2.7/site-packages/amqp/serialization.py
python
_read_item
(buf, offset=0, unpack_from=unpack_from, ftype_t=ftype_t)
return val, offset
[]
def _read_item(buf, offset=0, unpack_from=unpack_from, ftype_t=ftype_t): ftype = ftype_t(buf[offset]) if ftype_t else buf[offset] offset += 1 # 'S': long string if ftype == 'S': slen, = unpack_from('>I', buf, offset) offset += 4 val = pstr_t(buf[offset:offset + slen]) of...
[ "def", "_read_item", "(", "buf", ",", "offset", "=", "0", ",", "unpack_from", "=", "unpack_from", ",", "ftype_t", "=", "ftype_t", ")", ":", "ftype", "=", "ftype_t", "(", "buf", "[", "offset", "]", ")", "if", "ftype_t", "else", "buf", "[", "offset", "...
https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_flaskbb/lib/python2.7/site-packages/amqp/serialization.py#L51-L152
sentinel-hub/eo-learn
cf964eaf173668d6a374675dbd7c1d244264c11d
core/eolearn/core/utilities.py
python
FeatureParser._get_features
(self, eopatch=None)
A generator of parsed features. :param eopatch: A given EOPatch :type eopatch: EOPatch or None :return: One by one feature :rtype: tuple(FeatureType, str) or tuple(FeatureType, str, str)
A generator of parsed features.
[ "A", "generator", "of", "parsed", "features", "." ]
def _get_features(self, eopatch=None): """A generator of parsed features. :param eopatch: A given EOPatch :type eopatch: EOPatch or None :return: One by one feature :rtype: tuple(FeatureType, str) or tuple(FeatureType, str, str) """ for feature_type, feature_dict...
[ "def", "_get_features", "(", "self", ",", "eopatch", "=", "None", ")", ":", "for", "feature_type", ",", "feature_dict", "in", "self", ".", "feature_collection", ".", "items", "(", ")", ":", "if", "feature_type", "is", "None", "and", "self", ".", "default_f...
https://github.com/sentinel-hub/eo-learn/blob/cf964eaf173668d6a374675dbd7c1d244264c11d/core/eolearn/core/utilities.py#L309-L344
ansible/ansible-modules-core
00911a75ad6635834b6d28eef41f197b2f73c381
utilities/logic/wait_for.py
python
_create_connection
(host, port, connect_timeout)
return connect_socket
Connect to a 2-tuple (host, port) and return the socket object. Args: 2-tuple (host, port) and connection timeout Returns: Socket object
Connect to a 2-tuple (host, port) and return the socket object.
[ "Connect", "to", "a", "2", "-", "tuple", "(", "host", "port", ")", "and", "return", "the", "socket", "object", "." ]
def _create_connection(host, port, connect_timeout): """ Connect to a 2-tuple (host, port) and return the socket object. Args: 2-tuple (host, port) and connection timeout Returns: Socket object """ if sys.version_info < (2, 6): (family, _) = (_convert_host_to_ip(host...
[ "def", "_create_connection", "(", "host", ",", "port", ",", "connect_timeout", ")", ":", "if", "sys", ".", "version_info", "<", "(", "2", ",", "6", ")", ":", "(", "family", ",", "_", ")", "=", "(", "_convert_host_to_ip", "(", "host", ")", ")", "[", ...
https://github.com/ansible/ansible-modules-core/blob/00911a75ad6635834b6d28eef41f197b2f73c381/utilities/logic/wait_for.py#L366-L383
smicallef/spiderfoot
fd4bf9394c9ab3ecc90adc3115c56349fb23165b
sfcli.py
python
SpiderFootCli.completedefault
(self, text, line, begidx, endidx)
return []
[]
def completedefault(self, text, line, begidx, endidx): return []
[ "def", "completedefault", "(", "self", ",", "text", ",", "line", ",", "begidx", ",", "endidx", ")", ":", "return", "[", "]" ]
https://github.com/smicallef/spiderfoot/blob/fd4bf9394c9ab3ecc90adc3115c56349fb23165b/sfcli.py#L406-L407
OpenEndedGroup/Field
4f7c8edfb01bb0ccc927b78d3c500f018a4ae37c
Contents/lib/python/dbexts.py
python
dbexts.typeinfo
(self, sqltype=None)
display the types available for the database
display the types available for the database
[ "display", "the", "types", "available", "for", "the", "database" ]
def typeinfo(self, sqltype=None): """ display the types available for the database """ cur = self.begin() cur.gettypeinfo(sqltype) self.commit(cur) self.display()
[ "def", "typeinfo", "(", "self", ",", "sqltype", "=", "None", ")", ":", "cur", "=", "self", ".", "begin", "(", ")", "cur", ".", "gettypeinfo", "(", "sqltype", ")", "self", ".", "commit", "(", "cur", ")", "self", ".", "display", "(", ")" ]
https://github.com/OpenEndedGroup/Field/blob/4f7c8edfb01bb0ccc927b78d3c500f018a4ae37c/Contents/lib/python/dbexts.py#L412-L417
kvazis/homeassistant
aca227a780f806d861342e3611025a52a3bb4366
custom_components/hacs/helpers/functions/information.py
python
get_info_md_content
(repository)
return ""
Get the content of info.md
Get the content of info.md
[ "Get", "the", "content", "of", "info", ".", "md" ]
async def get_info_md_content(repository): """Get the content of info.md""" filename = info_file(repository) if not filename: return "" try: info = await repository.repository_object.get_contents(filename, repository.ref) if info is None: return "" info = info...
[ "async", "def", "get_info_md_content", "(", "repository", ")", ":", "filename", "=", "info_file", "(", "repository", ")", "if", "not", "filename", ":", "return", "\"\"", "try", ":", "info", "=", "await", "repository", ".", "repository_object", ".", "get_conten...
https://github.com/kvazis/homeassistant/blob/aca227a780f806d861342e3611025a52a3bb4366/custom_components/hacs/helpers/functions/information.py#L27-L45
nneonneo/eqgrp-free-file
49e457d7ac870d5e00f5a247b94476cd5643f3ba
Firewall/EXPLOITS/EXBA/scapy/packet.py
python
Packet.psdump
(self, filename=None, **kargs)
psdump(filename=None, layer_shift=0, rebuild=1) Creates an EPS file describing a packet. If filename is not provided a temporary file is created and gs is called.
psdump(filename=None, layer_shift=0, rebuild=1) Creates an EPS file describing a packet. If filename is not provided a temporary file is created and gs is called.
[ "psdump", "(", "filename", "=", "None", "layer_shift", "=", "0", "rebuild", "=", "1", ")", "Creates", "an", "EPS", "file", "describing", "a", "packet", ".", "If", "filename", "is", "not", "provided", "a", "temporary", "file", "is", "created", "and", "gs"...
def psdump(self, filename=None, **kargs): """psdump(filename=None, layer_shift=0, rebuild=1) Creates an EPS file describing a packet. If filename is not provided a temporary file is created and gs is called.""" canvas = self.canvas_dump(**kargs) if filename is None: fname = get_temp_...
[ "def", "psdump", "(", "self", ",", "filename", "=", "None", ",", "*", "*", "kargs", ")", ":", "canvas", "=", "self", ".", "canvas_dump", "(", "*", "*", "kargs", ")", "if", "filename", "is", "None", ":", "fname", "=", "get_temp_file", "(", "autoext", ...
https://github.com/nneonneo/eqgrp-free-file/blob/49e457d7ac870d5e00f5a247b94476cd5643f3ba/Firewall/EXPLOITS/EXBA/scapy/packet.py#L350-L359
NUAA-AL/ALiPy
bc69062c7129d597a9e54b9eb409c6fcb1f36a3c
alipy/index/index_collections.py
python
IndexCollection.index
(self)
return copy.deepcopy(self._innercontainer)
Get the index of data.
Get the index of data.
[ "Get", "the", "index", "of", "data", "." ]
def index(self): """ Get the index of data. """ return copy.deepcopy(self._innercontainer)
[ "def", "index", "(", "self", ")", ":", "return", "copy", ".", "deepcopy", "(", "self", ".", "_innercontainer", ")" ]
https://github.com/NUAA-AL/ALiPy/blob/bc69062c7129d597a9e54b9eb409c6fcb1f36a3c/alipy/index/index_collections.py#L91-L95
fossasia/x-mario-center
fe67afe28d995dcf4e2498e305825a4859566172
build/lib.linux-i686-2.7/softwarecenter/utils.py
python
pnormaldist
(qn)
Inverse normal distribution, based on the Ruby statistics2.pnormaldist
Inverse normal distribution, based on the Ruby statistics2.pnormaldist
[ "Inverse", "normal", "distribution", "based", "on", "the", "Ruby", "statistics2", ".", "pnormaldist" ]
def pnormaldist(qn): """ Inverse normal distribution, based on the Ruby statistics2.pnormaldist """ b = [1.570796288, 0.03706987906, -0.8364353589e-3, -0.2250947176e-3, 0.6841218299e-5, 0.5824238515e-5, -0.104527497e-5, 0.8360937017e-7, -0.3231081277e-8, 0.3657763036e-10, 0.69...
[ "def", "pnormaldist", "(", "qn", ")", ":", "b", "=", "[", "1.570796288", ",", "0.03706987906", ",", "-", "0.8364353589e-3", ",", "-", "0.2250947176e-3", ",", "0.6841218299e-5", ",", "0.5824238515e-5", ",", "-", "0.104527497e-5", ",", "0.8360937017e-7", ",", "-...
https://github.com/fossasia/x-mario-center/blob/fe67afe28d995dcf4e2498e305825a4859566172/build/lib.linux-i686-2.7/softwarecenter/utils.py#L560-L585
numba/numba
bf480b9e0da858a65508c2b17759a72ee6a44c51
numba/core/types/abstract.py
python
_autoincr
()
return n
[]
def _autoincr(): n = next(_typecodes) # 4 billion types should be enough, right? assert n < 2 ** 32, "Limited to 4 billion types" return n
[ "def", "_autoincr", "(", ")", ":", "n", "=", "next", "(", "_typecodes", ")", "# 4 billion types should be enough, right?", "assert", "n", "<", "2", "**", "32", ",", "\"Limited to 4 billion types\"", "return", "n" ]
https://github.com/numba/numba/blob/bf480b9e0da858a65508c2b17759a72ee6a44c51/numba/core/types/abstract.py#L19-L23
python/cpython
e13cdca0f5224ec4e23bdd04bb3120506964bc8b
Lib/tkinter/__init__.py
python
Misc.winfo_server
(self)
return self.tk.call('winfo', 'server', self._w)
Return information of the X-Server of the screen of this widget in the form "XmajorRminor vendor vendorVersion".
Return information of the X-Server of the screen of this widget in the form "XmajorRminor vendor vendorVersion".
[ "Return", "information", "of", "the", "X", "-", "Server", "of", "the", "screen", "of", "this", "widget", "in", "the", "form", "XmajorRminor", "vendor", "vendorVersion", "." ]
def winfo_server(self): """Return information of the X-Server of the screen of this widget in the form "XmajorRminor vendor vendorVersion".""" return self.tk.call('winfo', 'server', self._w)
[ "def", "winfo_server", "(", "self", ")", ":", "return", "self", ".", "tk", ".", "call", "(", "'winfo'", ",", "'server'", ",", "self", ".", "_w", ")" ]
https://github.com/python/cpython/blob/e13cdca0f5224ec4e23bdd04bb3120506964bc8b/Lib/tkinter/__init__.py#L1253-L1256
robotframework/RIDE
6e8a50774ff33dead3a2757a11b0b4418ab205c0
src/robotide/editor/contentassist.py
python
ContentAssistTextEditor.__init__
(self, parent, suggestion_source, pos, size=wx.DefaultSize)
self.SetBackgroundColour(Colour(200, 222, 40)) self.SetOwnBackgroundColour(Colour(200, 222, 40)) self.SetForegroundColour(Colour(7, 0, 70)) self.SetOwnForegroundColour(Colour(7, 0, 70))
self.SetBackgroundColour(Colour(200, 222, 40)) self.SetOwnBackgroundColour(Colour(200, 222, 40)) self.SetForegroundColour(Colour(7, 0, 70)) self.SetOwnForegroundColour(Colour(7, 0, 70))
[ "self", ".", "SetBackgroundColour", "(", "Colour", "(", "200", "222", "40", "))", "self", ".", "SetOwnBackgroundColour", "(", "Colour", "(", "200", "222", "40", "))", "self", ".", "SetForegroundColour", "(", "Colour", "(", "7", "0", "70", "))", "self", "...
def __init__(self, parent, suggestion_source, pos, size=wx.DefaultSize): wx.TextCtrl.__init__(self, parent, -1, "", pos, size=size, style=wx.WANTS_CHARS|wx.BORDER_NONE|wx.WS_EX_TRANSIENT|wx.TE_PROCESS_ENTER|wx.TE_NOHIDESEL) _ContentAssistTextCtrlBase.__init__(self, suggestion_source) self.SetBac...
[ "def", "__init__", "(", "self", ",", "parent", ",", "suggestion_source", ",", "pos", ",", "size", "=", "wx", ".", "DefaultSize", ")", ":", "wx", ".", "TextCtrl", ".", "__init__", "(", "self", ",", "parent", ",", "-", "1", ",", "\"\"", ",", "pos", "...
https://github.com/robotframework/RIDE/blob/6e8a50774ff33dead3a2757a11b0b4418ab205c0/src/robotide/editor/contentassist.py#L228-L240
bruderstein/PythonScript
df9f7071ddf3a079e3a301b9b53a6dc78cf1208f
PythonLib/full/email/_header_value_parser.py
python
TokenList.fold
(self, *, policy)
return _refold_parse_tree(self, policy=policy)
[]
def fold(self, *, policy): return _refold_parse_tree(self, policy=policy)
[ "def", "fold", "(", "self", ",", "*", ",", "policy", ")", ":", "return", "_refold_parse_tree", "(", "self", ",", "policy", "=", "policy", ")" ]
https://github.com/bruderstein/PythonScript/blob/df9f7071ddf3a079e3a301b9b53a6dc78cf1208f/PythonLib/full/email/_header_value_parser.py#L155-L156
huuuuusy/Mask-RCNN-Shiny
b59944ae08fda8dfc19d27a22acd59f94d8beb4f
mrcnn/visualize.py
python
display_instances
(image, boxes, masks, class_ids, class_names, scores=None, title="", figsize=(16, 16), ax=None, show_mask=True, show_bbox=True, colors=None, captions=None)
boxes: [num_instance, (y1, x1, y2, x2, class_id)] in image coordinates. masks: [height, width, num_instances] class_ids: [num_instances] class_names: list of class names of the dataset scores: (optional) confidence scores for each box title: (optional) Figure title show_mask, show_bbox: To show ...
boxes: [num_instance, (y1, x1, y2, x2, class_id)] in image coordinates. masks: [height, width, num_instances] class_ids: [num_instances] class_names: list of class names of the dataset scores: (optional) confidence scores for each box title: (optional) Figure title show_mask, show_bbox: To show ...
[ "boxes", ":", "[", "num_instance", "(", "y1", "x1", "y2", "x2", "class_id", ")", "]", "in", "image", "coordinates", ".", "masks", ":", "[", "height", "width", "num_instances", "]", "class_ids", ":", "[", "num_instances", "]", "class_names", ":", "list", ...
def display_instances(image, boxes, masks, class_ids, class_names, scores=None, title="", figsize=(16, 16), ax=None, show_mask=True, show_bbox=True, colors=None, captions=None): """ boxes: [num_instance, (y1, x1, y2, x2, cla...
[ "def", "display_instances", "(", "image", ",", "boxes", ",", "masks", ",", "class_ids", ",", "class_names", ",", "scores", "=", "None", ",", "title", "=", "\"\"", ",", "figsize", "=", "(", "16", ",", "16", ")", ",", "ax", "=", "None", ",", "show_mask...
https://github.com/huuuuusy/Mask-RCNN-Shiny/blob/b59944ae08fda8dfc19d27a22acd59f94d8beb4f/mrcnn/visualize.py#L84-L169
securesystemslab/zippy
ff0e84ac99442c2c55fe1d285332cfd4e185e089
zippy/benchmarks/src/benchmarks/sympy/sympy/core/function.py
python
FunctionClass.__repr__
(cls)
return cls.__name__
[]
def __repr__(cls): return cls.__name__
[ "def", "__repr__", "(", "cls", ")", ":", "return", "cls", ".", "__name__" ]
https://github.com/securesystemslab/zippy/blob/ff0e84ac99442c2c55fe1d285332cfd4e185e089/zippy/benchmarks/src/benchmarks/sympy/sympy/core/function.py#L170-L171
pyparallel/pyparallel
11e8c6072d48c8f13641925d17b147bf36ee0ba3
Lib/site-packages/Cython-0.23.4-py3.3-win-amd64.egg/Cython/Compiler/Optimize.py
python
EarlyReplaceBuiltinCalls._handle_simple_function_all
(self, node, pos_args)
return self._transform_any_all(node, pos_args, False)
Transform _result = all(x for L in LL for x in L) into for L in LL: for x in L: if not x: _result = False break else: continue break else: _result = True
Transform
[ "Transform" ]
def _handle_simple_function_all(self, node, pos_args): """Transform _result = all(x for L in LL for x in L) into for L in LL: for x in L: if not x: _result = False break else: continue ...
[ "def", "_handle_simple_function_all", "(", "self", ",", "node", ",", "pos_args", ")", ":", "return", "self", ".", "_transform_any_all", "(", "node", ",", "pos_args", ",", "False", ")" ]
https://github.com/pyparallel/pyparallel/blob/11e8c6072d48c8f13641925d17b147bf36ee0ba3/Lib/site-packages/Cython-0.23.4-py3.3-win-amd64.egg/Cython/Compiler/Optimize.py#L1503-L1521
catalyst-cooperative/pudl
40d176313e60dfa9d2481f63842ed23f08f1ad5f
src/pudl/analysis/state_demand.py
python
melt_ferc714_hourly_demand_matrix
( df: pd.DataFrame, tz: pd.DataFrame )
return df
Melt FERC 714 hourly demand matrix to long format. Args: df: FERC 714 hourly demand matrix, as described in :func:`load_ferc714_hourly_demand_matrix`. tz: FERC 714 respondent time zones, as described in :func:`load_ferc714_hourly_demand_matrix`. Returns: Long-format...
Melt FERC 714 hourly demand matrix to long format.
[ "Melt", "FERC", "714", "hourly", "demand", "matrix", "to", "long", "format", "." ]
def melt_ferc714_hourly_demand_matrix( df: pd.DataFrame, tz: pd.DataFrame ) -> pd.DataFrame: """ Melt FERC 714 hourly demand matrix to long format. Args: df: FERC 714 hourly demand matrix, as described in :func:`load_ferc714_hourly_demand_matrix`. tz: FERC 714 respondent time ...
[ "def", "melt_ferc714_hourly_demand_matrix", "(", "df", ":", "pd", ".", "DataFrame", ",", "tz", ":", "pd", ".", "DataFrame", ")", "->", "pd", ".", "DataFrame", ":", "# Melt demand matrix to long format", "df", "=", "df", ".", "melt", "(", "value_name", "=", "...
https://github.com/catalyst-cooperative/pudl/blob/40d176313e60dfa9d2481f63842ed23f08f1ad5f/src/pudl/analysis/state_demand.py#L464-L488
zhl2008/awd-platform
0416b31abea29743387b10b3914581fbe8e7da5e
web_flaskbb/Python-2.7.9/Doc/tools/rstlint.py
python
checker
(*suffixes, **kwds)
return deco
Decorator to register a function as a checker.
Decorator to register a function as a checker.
[ "Decorator", "to", "register", "a", "function", "as", "a", "checker", "." ]
def checker(*suffixes, **kwds): """Decorator to register a function as a checker.""" def deco(func): for suffix in suffixes: checkers.setdefault(suffix, []).append(func) for prop in checker_props: setattr(func, prop, kwds.get(prop, checker_props[prop])) return fun...
[ "def", "checker", "(", "*", "suffixes", ",", "*", "*", "kwds", ")", ":", "def", "deco", "(", "func", ")", ":", "for", "suffix", "in", "suffixes", ":", "checkers", ".", "setdefault", "(", "suffix", ",", "[", "]", ")", ".", "append", "(", "func", "...
https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_flaskbb/Python-2.7.9/Doc/tools/rstlint.py#L54-L62
TencentCloud/tencentcloud-sdk-python
3677fd1cdc8c5fd626ce001c13fd3b59d1f279d2
tencentcloud/vpc/v20170312/models.py
python
ModifyPrivateIpAddressesAttributeResponse.__init__
(self)
r""" :param RequestId: 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 :type RequestId: str
r""" :param RequestId: 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 :type RequestId: str
[ "r", ":", "param", "RequestId", ":", "唯一请求", "ID,每次请求都会返回。定位问题时需要提供该次请求的", "RequestId。", ":", "type", "RequestId", ":", "str" ]
def __init__(self): r""" :param RequestId: 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 :type RequestId: str """ self.RequestId = None
[ "def", "__init__", "(", "self", ")", ":", "self", ".", "RequestId", "=", "None" ]
https://github.com/TencentCloud/tencentcloud-sdk-python/blob/3677fd1cdc8c5fd626ce001c13fd3b59d1f279d2/tencentcloud/vpc/v20170312/models.py#L15311-L15316
MaybeShewill-CV/attentive-gan-derainnet
4ec79993cf3d757741c9c88c1036d87bd46e982d
attentive_gan_model/cnn_basenet.py
python
CNNBaseModel.dropout
(inputdata, keep_prob, noise_shape=None, name=None)
return tf.nn.dropout(inputdata, keep_prob=keep_prob, noise_shape=noise_shape, name=name)
:param name: :param inputdata: :param keep_prob: :param noise_shape: :return:
[]
def dropout(inputdata, keep_prob, noise_shape=None, name=None): """ :param name: :param inputdata: :param keep_prob: :param noise_shape: :return: """ return tf.nn.dropout(inputdata, keep_prob=keep_prob, noise_shape=noise_shape, name=name)
[ "def", "dropout", "(", "inputdata", ",", "keep_prob", ",", "noise_shape", "=", "None", ",", "name", "=", "None", ")", ":", "return", "tf", ".", "nn", ".", "dropout", "(", "inputdata", ",", "keep_prob", "=", "keep_prob", ",", "noise_shape", "=", "noise_sh...
https://github.com/MaybeShewill-CV/attentive-gan-derainnet/blob/4ec79993cf3d757741c9c88c1036d87bd46e982d/attentive_gan_model/cnn_basenet.py#L264-L273
mrlesmithjr/Ansible
d44f0dc0d942bdf3bf7334b307e6048f0ee16e36
roles/ansible-nginx-load-balancer/library/openssl_csr.py
python
CertificateSigningRequest.dump
(self)
return result
Serialize the object into a dictionary.
Serialize the object into a dictionary.
[ "Serialize", "the", "object", "into", "a", "dictionary", "." ]
def dump(self): '''Serialize the object into a dictionary.''' result = { 'csr': self.path, 'subject': self.subject, 'subjectAltName': self.subjectAltName, 'changed': self.changed } return result
[ "def", "dump", "(", "self", ")", ":", "result", "=", "{", "'csr'", ":", "self", ".", "path", ",", "'subject'", ":", "self", ".", "subject", ",", "'subjectAltName'", ":", "self", ".", "subjectAltName", ",", "'changed'", ":", "self", ".", "changed", "}",...
https://github.com/mrlesmithjr/Ansible/blob/d44f0dc0d942bdf3bf7334b307e6048f0ee16e36/roles/ansible-nginx-load-balancer/library/openssl_csr.py#L251-L261
twilio/twilio-python
6e1e811ea57a1edfadd5161ace87397c563f6915
twilio/rest/studio/v2/flow/execution/__init__.py
python
ExecutionContext.__repr__
(self)
return '<Twilio.Studio.V2.ExecutionContext {}>'.format(context)
Provide a friendly representation :returns: Machine friendly representation :rtype: str
Provide a friendly representation
[ "Provide", "a", "friendly", "representation" ]
def __repr__(self): """ Provide a friendly representation :returns: Machine friendly representation :rtype: str """ context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) return '<Twilio.Studio.V2.ExecutionContext {}>'.format(context)
[ "def", "__repr__", "(", "self", ")", ":", "context", "=", "' '", ".", "join", "(", "'{}={}'", ".", "format", "(", "k", ",", "v", ")", "for", "k", ",", "v", "in", "self", ".", "_solution", ".", "items", "(", ")", ")", "return", "'<Twilio.Studio.V2.E...
https://github.com/twilio/twilio-python/blob/6e1e811ea57a1edfadd5161ace87397c563f6915/twilio/rest/studio/v2/flow/execution/__init__.py#L327-L335
rucio/rucio
6d0d358e04f5431f0b9a98ae40f31af0ddff4833
lib/rucio/rse/protocols/storm.py
python
Default.delete
(self, pfn)
Deletes a file from the connected RSE. :param pfn Physical file name :raises ServiceUnavailable, SourceNotFound
Deletes a file from the connected RSE.
[ "Deletes", "a", "file", "from", "the", "connected", "RSE", "." ]
def delete(self, pfn): """ Deletes a file from the connected RSE. :param pfn Physical file name :raises ServiceUnavailable, SourceNotFound """ raise NotImplementedError
[ "def", "delete", "(", "self", ",", "pfn", ")", ":", "raise", "NotImplementedError" ]
https://github.com/rucio/rucio/blob/6d0d358e04f5431f0b9a98ae40f31af0ddff4833/lib/rucio/rse/protocols/storm.py#L198-L205
holoviz/panel
5e25cb09447d8edf0b316f130ee1318a2aeb880f
panel/io/state.py
python
_state.log
(self, msg, level='info')
Logs user messages to the Panel logger. Arguments --------- msg: str Log message level: int or str Log level as a string, i.e. 'debug', 'info', 'warning' or 'error'.
Logs user messages to the Panel logger.
[ "Logs", "user", "messages", "to", "the", "Panel", "logger", "." ]
def log(self, msg, level='info'): """ Logs user messages to the Panel logger. Arguments --------- msg: str Log message level: int or str Log level as a string, i.e. 'debug', 'info', 'warning' or 'error'. """ args = () if self.c...
[ "def", "log", "(", "self", ",", "msg", ",", "level", "=", "'info'", ")", ":", "args", "=", "(", ")", "if", "self", ".", "curdoc", ":", "args", "=", "(", "id", "(", "self", ".", "curdoc", ")", ",", ")", "msg", "=", "LOG_USER_MSG", ".", "format",...
https://github.com/holoviz/panel/blob/5e25cb09447d8edf0b316f130ee1318a2aeb880f/panel/io/state.py#L328-L343
veusz/veusz
5a1e2af5f24df0eb2a2842be51f2997c4999c7fb
veusz/widgets/polygon.py
python
Polygon.addSettings
(klass, s)
Construct list of settings.
Construct list of settings.
[ "Construct", "list", "of", "settings", "." ]
def addSettings(klass, s): """Construct list of settings.""" plotters.FreePlotter.addSettings(s) s.add( setting.Line( 'Line', descr=_('Line around polygon'), usertext=_('Line')), pixmap='settings_plotline' ) s.add( setting.BrushExtended( ...
[ "def", "addSettings", "(", "klass", ",", "s", ")", ":", "plotters", ".", "FreePlotter", ".", "addSettings", "(", "s", ")", "s", ".", "add", "(", "setting", ".", "Line", "(", "'Line'", ",", "descr", "=", "_", "(", "'Line around polygon'", ")", ",", "u...
https://github.com/veusz/veusz/blob/5a1e2af5f24df0eb2a2842be51f2997c4999c7fb/veusz/widgets/polygon.py#L43-L56
astanway/crucible
c79a3c25f10465387af69d758973825fe3f244f5
src/crucible.py
python
Crucible.run
(self)
Called when the process intializes.
Called when the process intializes.
[ "Called", "when", "the", "process", "intializes", "." ]
def run(self): """ Called when the process intializes. """ __data__ = abspath(join(dirname( __file__ ), '..', 'data')) files = [ f for f in listdir(__data__) if isfile(join(__data__,f)) ] # Spawn processes pids = [] for index, ts_name...
[ "def", "run", "(", "self", ")", ":", "__data__", "=", "abspath", "(", "join", "(", "dirname", "(", "__file__", ")", ",", "'..'", ",", "'data'", ")", ")", "files", "=", "[", "f", "for", "f", "in", "listdir", "(", "__data__", ")", "if", "isfile", "...
https://github.com/astanway/crucible/blob/c79a3c25f10465387af69d758973825fe3f244f5/src/crucible.py#L17-L40
misterch0c/shadowbroker
e3a069bea47a2c1009697941ac214adc6f90aa8d
windows/Resources/Python/Core/Lib/lib-tk/Tkinter.py
python
Spinbox.__init__
(self, master=None, cnf={}, **kw)
Construct a spinbox widget with the parent MASTER. STANDARD OPTIONS activebackground, background, borderwidth, cursor, exportselection, font, foreground, highlightbackground, highlightcolor, highlightthickness, insertbackground, inser...
Construct a spinbox widget with the parent MASTER. STANDARD OPTIONS activebackground, background, borderwidth, cursor, exportselection, font, foreground, highlightbackground, highlightcolor, highlightthickness, insertbackground, inser...
[ "Construct", "a", "spinbox", "widget", "with", "the", "parent", "MASTER", ".", "STANDARD", "OPTIONS", "activebackground", "background", "borderwidth", "cursor", "exportselection", "font", "foreground", "highlightbackground", "highlightcolor", "highlightthickness", "insertba...
def __init__(self, master=None, cnf={}, **kw): """Construct a spinbox widget with the parent MASTER. STANDARD OPTIONS activebackground, background, borderwidth, cursor, exportselection, font, foreground, highlightbackground, highlightcolor, ...
[ "def", "__init__", "(", "self", ",", "master", "=", "None", ",", "cnf", "=", "{", "}", ",", "*", "*", "kw", ")", ":", "Widget", ".", "__init__", "(", "self", ",", "master", ",", "'spinbox'", ",", "cnf", ",", "kw", ")" ]
https://github.com/misterch0c/shadowbroker/blob/e3a069bea47a2c1009697941ac214adc6f90aa8d/windows/Resources/Python/Core/Lib/lib-tk/Tkinter.py#L3761-L3788
qutip/qutip
52d01da181a21b810c3407812c670f35fdc647e8
qutip/bloch.py
python
Bloch.render
(self)
Render the Bloch sphere and its data sets in on given figure and axes.
Render the Bloch sphere and its data sets in on given figure and axes.
[ "Render", "the", "Bloch", "sphere", "and", "its", "data", "sets", "in", "on", "given", "figure", "and", "axes", "." ]
def render(self): """ Render the Bloch sphere and its data sets in on given figure and axes. """ if not self._ext_fig and not self._is_inline_backend(): # If no external figure was supplied, we check to see if the # figure we created in a previous call to .render(...
[ "def", "render", "(", "self", ")", ":", "if", "not", "self", ".", "_ext_fig", "and", "not", "self", ".", "_is_inline_backend", "(", ")", ":", "# If no external figure was supplied, we check to see if the", "# figure we created in a previous call to .render() has been", "# c...
https://github.com/qutip/qutip/blob/52d01da181a21b810c3407812c670f35fdc647e8/qutip/bloch.py#L414-L472
sphinx-doc/sphinx
e79681c76843c1339863b365747079b2d662d0c1
sphinx/util/docutils.py
python
is_directive_registered
(name: str)
return name in directives._directives
Check the *name* directive is already registered.
Check the *name* directive is already registered.
[ "Check", "the", "*", "name", "*", "directive", "is", "already", "registered", "." ]
def is_directive_registered(name: str) -> bool: """Check the *name* directive is already registered.""" return name in directives._directives
[ "def", "is_directive_registered", "(", "name", ":", "str", ")", "->", "bool", ":", "return", "name", "in", "directives", ".", "_directives" ]
https://github.com/sphinx-doc/sphinx/blob/e79681c76843c1339863b365747079b2d662d0c1/sphinx/util/docutils.py#L65-L67
AppScale/gts
46f909cf5dc5ba81faf9d81dc9af598dcf8a82a9
AppServer/lib/django-1.5/django/contrib/auth/handlers/modwsgi.py
python
check_password
(environ, username, password)
Authenticates against Django's auth database mod_wsgi docs specify None, True, False as return value depending on whether the user exists and authenticates.
Authenticates against Django's auth database
[ "Authenticates", "against", "Django", "s", "auth", "database" ]
def check_password(environ, username, password): """ Authenticates against Django's auth database mod_wsgi docs specify None, True, False as return value depending on whether the user exists and authenticates. """ UserModel = auth.get_user_model() # db connection state is managed similarly...
[ "def", "check_password", "(", "environ", ",", "username", ",", "password", ")", ":", "UserModel", "=", "auth", ".", "get_user_model", "(", ")", "# db connection state is managed similarly to the wsgi handler", "# as mod_wsgi may call these functions outside of a request/response ...
https://github.com/AppScale/gts/blob/46f909cf5dc5ba81faf9d81dc9af598dcf8a82a9/AppServer/lib/django-1.5/django/contrib/auth/handlers/modwsgi.py#L6-L28
kubernetes-client/python
47b9da9de2d02b2b7a34fbe05afb44afd130d73a
kubernetes/client/models/v1_csi_driver_spec.py
python
V1CSIDriverSpec.__ne__
(self, other)
return self.to_dict() != other.to_dict()
Returns true if both objects are not equal
Returns true if both objects are not equal
[ "Returns", "true", "if", "both", "objects", "are", "not", "equal" ]
def __ne__(self, other): """Returns true if both objects are not equal""" if not isinstance(other, V1CSIDriverSpec): return True return self.to_dict() != other.to_dict()
[ "def", "__ne__", "(", "self", ",", "other", ")", ":", "if", "not", "isinstance", "(", "other", ",", "V1CSIDriverSpec", ")", ":", "return", "True", "return", "self", ".", "to_dict", "(", ")", "!=", "other", ".", "to_dict", "(", ")" ]
https://github.com/kubernetes-client/python/blob/47b9da9de2d02b2b7a34fbe05afb44afd130d73a/kubernetes/client/models/v1_csi_driver_spec.py#L285-L290
smart-mobile-software/gitstack
d9fee8f414f202143eb6e620529e8e5539a2af56
python/Lib/lib-tk/Tkinter.py
python
PanedWindow.panes
(self)
return self.tk.call(self._w, 'panes')
Returns an ordered list of the child panes.
Returns an ordered list of the child panes.
[ "Returns", "an", "ordered", "list", "of", "the", "child", "panes", "." ]
def panes(self): """Returns an ordered list of the child panes.""" return self.tk.call(self._w, 'panes')
[ "def", "panes", "(", "self", ")", ":", "return", "self", ".", "tk", ".", "call", "(", "self", ".", "_w", ",", "'panes'", ")" ]
https://github.com/smart-mobile-software/gitstack/blob/d9fee8f414f202143eb6e620529e8e5539a2af56/python/Lib/lib-tk/Tkinter.py#L3679-L3681
phonopy/phonopy
816586d0ba8177482ecf40e52f20cbdee2260d51
phonopy/structure/tetrahedron_method.py
python
TetrahedronMethod._n_4
(self)
return 1.0
n4. omega4 < omega
n4.
[ "n4", "." ]
def _n_4(self): """n4. omega4 < omega """ return 1.0
[ "def", "_n_4", "(", "self", ")", ":", "return", "1.0" ]
https://github.com/phonopy/phonopy/blob/816586d0ba8177482ecf40e52f20cbdee2260d51/phonopy/structure/tetrahedron_method.py#L461-L467
eth-brownie/brownie
754bda9f0a294b2beb86453d5eca4ff769a877c8
brownie/network/contract.py
python
ContractContainer.get_verification_info
(self)
Return a dict with flattened source code for this contract and further information needed for verification
Return a dict with flattened source code for this contract and further information needed for verification
[ "Return", "a", "dict", "with", "flattened", "source", "code", "for", "this", "contract", "and", "further", "information", "needed", "for", "verification" ]
def get_verification_info(self) -> Dict: """ Return a dict with flattened source code for this contract and further information needed for verification """ language = self._build["language"] if language == "Vyper": raise TypeError( "Etherscan d...
[ "def", "get_verification_info", "(", "self", ")", "->", "Dict", ":", "language", "=", "self", ".", "_build", "[", "\"language\"", "]", "if", "language", "==", "\"Vyper\"", ":", "raise", "TypeError", "(", "\"Etherscan does not support API verification of source code \"...
https://github.com/eth-brownie/brownie/blob/754bda9f0a294b2beb86453d5eca4ff769a877c8/brownie/network/contract.py#L261-L309
tomplus/kubernetes_asyncio
f028cc793e3a2c519be6a52a49fb77ff0b014c9b
kubernetes_asyncio/client/models/v1_pod_security_context.py
python
V1PodSecurityContext.windows_options
(self)
return self._windows_options
Gets the windows_options of this V1PodSecurityContext. # noqa: E501 :return: The windows_options of this V1PodSecurityContext. # noqa: E501 :rtype: V1WindowsSecurityContextOptions
Gets the windows_options of this V1PodSecurityContext. # noqa: E501
[ "Gets", "the", "windows_options", "of", "this", "V1PodSecurityContext", ".", "#", "noqa", ":", "E501" ]
def windows_options(self): """Gets the windows_options of this V1PodSecurityContext. # noqa: E501 :return: The windows_options of this V1PodSecurityContext. # noqa: E501 :rtype: V1WindowsSecurityContextOptions """ return self._windows_options
[ "def", "windows_options", "(", "self", ")", ":", "return", "self", ".", "_windows_options" ]
https://github.com/tomplus/kubernetes_asyncio/blob/f028cc793e3a2c519be6a52a49fb77ff0b014c9b/kubernetes_asyncio/client/models/v1_pod_security_context.py#L304-L311
OpenEndedGroup/Field
4f7c8edfb01bb0ccc927b78d3c500f018a4ae37c
Contents/lib/python/poplib.py
python
POP3.list
(self, which=None)
return self._longcmd('LIST')
Request listing, return result. Result without a message number argument is in form ['response', ['mesg_num octets', ...], octets]. Result when a message number argument is given is a single response: the "scan listing" for that message.
Request listing, return result.
[ "Request", "listing", "return", "result", "." ]
def list(self, which=None): """Request listing, return result. Result without a message number argument is in form ['response', ['mesg_num octets', ...], octets]. Result when a message number argument is given is a single response: the "scan listing" for that message. "...
[ "def", "list", "(", "self", ",", "which", "=", "None", ")", ":", "if", "which", "is", "not", "None", ":", "return", "self", ".", "_shortcmd", "(", "'LIST %s'", "%", "which", ")", "return", "self", ".", "_longcmd", "(", "'LIST'", ")" ]
https://github.com/OpenEndedGroup/Field/blob/4f7c8edfb01bb0ccc927b78d3c500f018a4ae37c/Contents/lib/python/poplib.py#L218-L229
adobe/antialiased-cnns
b27a34a26f3ab039113d44d83c54d0428598ac9c
antialiased_cnns/alexnet.py
python
alexnet
(pretrained=False, filter_size=4, _force_nonfinetuned=False, **kwargs)
return model
AlexNet model architecture from the `"One weird trick..." <https://arxiv.org/abs/1404.5997>`_ paper. Args: pretrained (bool): If True, returns a model pre-trained on ImageNet filter_size (int): [4] Antialiasing filter size
AlexNet model architecture from the `"One weird trick..." <https://arxiv.org/abs/1404.5997>`_ paper.
[ "AlexNet", "model", "architecture", "from", "the", "One", "weird", "trick", "...", "<https", ":", "//", "arxiv", ".", "org", "/", "abs", "/", "1404", ".", "5997", ">", "_", "paper", "." ]
def alexnet(pretrained=False, filter_size=4, _force_nonfinetuned=False, **kwargs): """AlexNet model architecture from the `"One weird trick..." <https://arxiv.org/abs/1404.5997>`_ paper. Args: pretrained (bool): If True, returns a model pre-trained on ImageNet filter_size (int): [4] Antiali...
[ "def", "alexnet", "(", "pretrained", "=", "False", ",", "filter_size", "=", "4", ",", "_force_nonfinetuned", "=", "False", ",", "*", "*", "kwargs", ")", ":", "model", "=", "AlexNet", "(", "filter_size", "=", "filter_size", ",", "*", "*", "kwargs", ")", ...
https://github.com/adobe/antialiased-cnns/blob/b27a34a26f3ab039113d44d83c54d0428598ac9c/antialiased_cnns/alexnet.py#L110-L124
JaniceWuo/MovieRecommend
4c86db64ca45598917d304f535413df3bc9fea65
movierecommend/venv1/Lib/site-packages/pytz/__init__.py
python
_FixedOffset.localize
(self, dt, is_dst=False)
return dt.replace(tzinfo=self)
Convert naive time to local time
Convert naive time to local time
[ "Convert", "naive", "time", "to", "local", "time" ]
def localize(self, dt, is_dst=False): '''Convert naive time to local time''' if dt.tzinfo is not None: raise ValueError('Not naive datetime (tzinfo is already set)') return dt.replace(tzinfo=self)
[ "def", "localize", "(", "self", ",", "dt", ",", "is_dst", "=", "False", ")", ":", "if", "dt", ".", "tzinfo", "is", "not", "None", ":", "raise", "ValueError", "(", "'Not naive datetime (tzinfo is already set)'", ")", "return", "dt", ".", "replace", "(", "tz...
https://github.com/JaniceWuo/MovieRecommend/blob/4c86db64ca45598917d304f535413df3bc9fea65/movierecommend/venv1/Lib/site-packages/pytz/__init__.py#L395-L399
haiwen/seahub
e92fcd44e3e46260597d8faa9347cb8222b8b10d
seahub/base/models.py
python
UserStarredFilesManager.add_starred_item
(self, email, repo_id, path, is_dir, org_id=-1)
return starred_item
[]
def add_starred_item(self, email, repo_id, path, is_dir, org_id=-1): starred_item = UserStarredFiles.objects.create(email=email, repo_id=repo_id, path=path, is_dir=is_dir, org_id=org_id) return starred_item
[ "def", "add_starred_item", "(", "self", ",", "email", ",", "repo_id", ",", "path", ",", "is_dir", ",", "org_id", "=", "-", "1", ")", ":", "starred_item", "=", "UserStarredFiles", ".", "objects", ".", "create", "(", "email", "=", "email", ",", "repo_id", ...
https://github.com/haiwen/seahub/blob/e92fcd44e3e46260597d8faa9347cb8222b8b10d/seahub/base/models.py#L147-L152
feisuzhu/thbattle
ac0dee1b2d86de7664289cf432b157ef25427ba1
src/pyglet/image/__init__.py
python
create
(width, height, pattern=None)
return pattern.create_image(width, height)
Create an image optionally filled with the given pattern. :note: You can make no assumptions about the return type; usually it will be ImageData or CompressedImageData, but patterns are free to return any subclass of AbstractImage. :Parameters: `width` : int Width of image ...
Create an image optionally filled with the given pattern.
[ "Create", "an", "image", "optionally", "filled", "with", "the", "given", "pattern", "." ]
def create(width, height, pattern=None): '''Create an image optionally filled with the given pattern. :note: You can make no assumptions about the return type; usually it will be ImageData or CompressedImageData, but patterns are free to return any subclass of AbstractImage. :Parameters: ...
[ "def", "create", "(", "width", ",", "height", ",", "pattern", "=", "None", ")", ":", "if", "not", "pattern", ":", "pattern", "=", "SolidColorImagePattern", "(", ")", "return", "pattern", ".", "create_image", "(", "width", ",", "height", ")" ]
https://github.com/feisuzhu/thbattle/blob/ac0dee1b2d86de7664289cf432b157ef25427ba1/src/pyglet/image/__init__.py#L208-L228
itsjohncs/superzippy
b62c3ef5d7e065b85e0024a9acf77b5d067650f9
superzippy/bootstrapper/zipsite.py
python
split_zip_path
(path)
return None, path
Takes a path that includes at most a single zip file as a directory and splits the path between what's outside of the zip file and what's inside. :param path: The path. :returns: ``(first_path, second_part)`` >>> zipsite.split_zip_path("/tmp/testing/stuff.zip/hi/bar") ('/tmp/testing/stuff.zip', 'h...
Takes a path that includes at most a single zip file as a directory and splits the path between what's outside of the zip file and what's inside.
[ "Takes", "a", "path", "that", "includes", "at", "most", "a", "single", "zip", "file", "as", "a", "directory", "and", "splits", "the", "path", "between", "what", "s", "outside", "of", "the", "zip", "file", "and", "what", "s", "inside", "." ]
def split_zip_path(path): """ Takes a path that includes at most a single zip file as a directory and splits the path between what's outside of the zip file and what's inside. :param path: The path. :returns: ``(first_path, second_part)`` >>> zipsite.split_zip_path("/tmp/testing/stuff.zip/hi/b...
[ "def", "split_zip_path", "(", "path", ")", ":", "drive", ",", "path", "=", "os", ".", "path", ".", "splitdrive", "(", "path", ")", "path_parts", "=", "get_path_parts", "(", "path", ")", "for", "i", "in", "range", "(", "len", "(", "path_parts", ")", "...
https://github.com/itsjohncs/superzippy/blob/b62c3ef5d7e065b85e0024a9acf77b5d067650f9/superzippy/bootstrapper/zipsite.py#L76-L107
brendano/tweetmotif
1b0b1e3a941745cd5a26eba01f554688b7c4b27e
everything_else/djfrontend/django-1.0.2/contrib/gis/sitemaps/views.py
python
kml
(request, label, model, field_name=None, compress=False)
return render('gis/kml/placemarks.kml', {'places' : placemarks})
This view generates KML for the given app label, model, and field name. The model's default manager must be GeoManager, and the field name must be that of a geographic field.
This view generates KML for the given app label, model, and field name.
[ "This", "view", "generates", "KML", "for", "the", "given", "app", "label", "model", "and", "field", "name", "." ]
def kml(request, label, model, field_name=None, compress=False): """ This view generates KML for the given app label, model, and field name. The model's default manager must be GeoManager, and the field name must be that of a geographic field. """ placemarks = [] klass = get_model(label, mo...
[ "def", "kml", "(", "request", ",", "label", ",", "model", ",", "field_name", "=", "None", ",", "compress", "=", "False", ")", ":", "placemarks", "=", "[", "]", "klass", "=", "get_model", "(", "label", ",", "model", ")", "if", "not", "klass", ":", "...
https://github.com/brendano/tweetmotif/blob/1b0b1e3a941745cd5a26eba01f554688b7c4b27e/everything_else/djfrontend/django-1.0.2/contrib/gis/sitemaps/views.py#L62-L102
apple/ccs-calendarserver
13c706b985fb728b9aab42dc0fef85aae21921c3
calendarserver/tools/dashboard.py
python
JobsWindow.updateRowCount
(self)
[]
def updateRowCount(self): self.rowCount = defaultIfNone(self.readItem("jobcount"), 0)
[ "def", "updateRowCount", "(", "self", ")", ":", "self", ".", "rowCount", "=", "defaultIfNone", "(", "self", ".", "readItem", "(", "\"jobcount\"", ")", ",", "0", ")" ]
https://github.com/apple/ccs-calendarserver/blob/13c706b985fb728b9aab42dc0fef85aae21921c3/calendarserver/tools/dashboard.py#L1019-L1020
pixelogik/NearPy
1b534b864d320d875508e95cd2b76b6d8c07a90b
nearpy/storage/storage_redis.py
python
RedisStorage.clean_all_buckets
(self)
Removes all buckets from all hashes and their content.
Removes all buckets from all hashes and their content.
[ "Removes", "all", "buckets", "from", "all", "hashes", "and", "their", "content", "." ]
def clean_all_buckets(self): """ Removes all buckets from all hashes and their content. """ bucket_keys = self.redis_object.keys(pattern='nearpy_*') if len(bucket_keys) > 0: self.redis_object.delete(*bucket_keys)
[ "def", "clean_all_buckets", "(", "self", ")", ":", "bucket_keys", "=", "self", ".", "redis_object", ".", "keys", "(", "pattern", "=", "'nearpy_*'", ")", "if", "len", "(", "bucket_keys", ")", ">", "0", ":", "self", ".", "redis_object", ".", "delete", "(",...
https://github.com/pixelogik/NearPy/blob/1b534b864d320d875508e95cd2b76b6d8c07a90b/nearpy/storage/storage_redis.py#L191-L197
edgewall/trac
beb3e4eaf1e0a456d801a50a8614ecab06de29fc
trac/ticket/query.py
python
Query.get_sql
(self, req=None, cached_ids=None, authname=None)
return "".join(sql), args
Return a (sql, params) tuple for the query.
Return a (sql, params) tuple for the query.
[ "Return", "a", "(", "sql", "params", ")", "tuple", "for", "the", "query", "." ]
def get_sql(self, req=None, cached_ids=None, authname=None): """Return a (sql, params) tuple for the query. """ if req is not None: authname = req.authname self.get_columns() # Build the list of actual columns to query cols = [] def add_cols(*args): ...
[ "def", "get_sql", "(", "self", ",", "req", "=", "None", ",", "cached_ids", "=", "None", ",", "authname", "=", "None", ")", ":", "if", "req", "is", "not", "None", ":", "authname", "=", "req", ".", "authname", "self", ".", "get_columns", "(", ")", "#...
https://github.com/edgewall/trac/blob/beb3e4eaf1e0a456d801a50a8614ecab06de29fc/trac/ticket/query.py#L401-L694
dimagi/commcare-hq
d67ff1d3b4c51fa050c19e60c3253a79d3452a39
corehq/motech/dhis2/models.py
python
get_date_params
(slug, date_span)
return { slug: "{}+to+{}".format(startdate, enddate), slug + '-start': startdate, slug + '-end': enddate, }
Mimics date filter request parameters
Mimics date filter request parameters
[ "Mimics", "date", "filter", "request", "parameters" ]
def get_date_params(slug, date_span): """ Mimics date filter request parameters """ startdate = date_span.startdate.strftime('%Y-%m-%d') enddate = date_span.enddate.strftime('%Y-%m-%d') return { slug: "{}+to+{}".format(startdate, enddate), slug + '-start': startdate, slug...
[ "def", "get_date_params", "(", "slug", ",", "date_span", ")", ":", "startdate", "=", "date_span", ".", "startdate", ".", "strftime", "(", "'%Y-%m-%d'", ")", "enddate", "=", "date_span", ".", "enddate", ".", "strftime", "(", "'%Y-%m-%d'", ")", "return", "{", ...
https://github.com/dimagi/commcare-hq/blob/d67ff1d3b4c51fa050c19e60c3253a79d3452a39/corehq/motech/dhis2/models.py#L493-L503
khanhnamle1994/natural-language-processing
01d450d5ac002b0156ef4cf93a07cb508c1bcdc5
assignment1/.env/lib/python2.7/site-packages/scipy/optimize/_trustregion.py
python
BaseQuadraticSubproblem.get_boundaries_intersections
(self, z, d, trust_radius)
return ta, tb
Solve the scalar quadratic equation ||z + t d|| == trust_radius. This is like a line-sphere intersection. Return the two values of t, sorted from low to high.
Solve the scalar quadratic equation ||z + t d|| == trust_radius. This is like a line-sphere intersection. Return the two values of t, sorted from low to high.
[ "Solve", "the", "scalar", "quadratic", "equation", "||z", "+", "t", "d||", "==", "trust_radius", ".", "This", "is", "like", "a", "line", "-", "sphere", "intersection", ".", "Return", "the", "two", "values", "of", "t", "sorted", "from", "low", "to", "high...
def get_boundaries_intersections(self, z, d, trust_radius): """ Solve the scalar quadratic equation ||z + t d|| == trust_radius. This is like a line-sphere intersection. Return the two values of t, sorted from low to high. """ a = np.dot(d, d) b = 2 * np.dot(z, d)...
[ "def", "get_boundaries_intersections", "(", "self", ",", "z", ",", "d", ",", "trust_radius", ")", ":", "a", "=", "np", ".", "dot", "(", "d", ",", "d", ")", "b", "=", "2", "*", "np", ".", "dot", "(", "z", ",", "d", ")", "c", "=", "np", ".", ...
https://github.com/khanhnamle1994/natural-language-processing/blob/01d450d5ac002b0156ef4cf93a07cb508c1bcdc5/assignment1/.env/lib/python2.7/site-packages/scipy/optimize/_trustregion.py#L74-L86
AstarLight/Satellite-Segmentation
28626b6f2351ea8e50da32807d1fa29784eb0e1d
deprecated/unet.py
python
load_img
(path, grayscale=False)
return img
[]
def load_img(path, grayscale=False): if grayscale: img = cv2.imread(path,cv2.IMREAD_GRAYSCALE) else: img = cv2.imread(path) img = np.array(img,dtype="float") / 255.0 return img
[ "def", "load_img", "(", "path", ",", "grayscale", "=", "False", ")", ":", "if", "grayscale", ":", "img", "=", "cv2", ".", "imread", "(", "path", ",", "cv2", ".", "IMREAD_GRAYSCALE", ")", "else", ":", "img", "=", "cv2", ".", "imread", "(", "path", "...
https://github.com/AstarLight/Satellite-Segmentation/blob/28626b6f2351ea8e50da32807d1fa29784eb0e1d/deprecated/unet.py#L33-L39
SeldomQA/poium
b95b6d49f31084d9a213de2d51e35803733ca136
poium/wda/__init__.py
python
Page.native_resolution
(self)
return multiple * w, multiple * h
获取屏幕原始分辨率
获取屏幕原始分辨率
[ "获取屏幕原始分辨率" ]
def native_resolution(self): """ 获取屏幕原始分辨率 """ multiple = self.driver.scale w, h = self.driver.window_size() return multiple * w, multiple * h
[ "def", "native_resolution", "(", "self", ")", ":", "multiple", "=", "self", ".", "driver", ".", "scale", "w", ",", "h", "=", "self", ".", "driver", ".", "window_size", "(", ")", "return", "multiple", "*", "w", ",", "multiple", "*", "h" ]
https://github.com/SeldomQA/poium/blob/b95b6d49f31084d9a213de2d51e35803733ca136/poium/wda/__init__.py#L27-L33
enthought/traitsui
b7c38c7a47bf6ae7971f9ddab70c8a358647dd25
traitsui/qt4/tabular_editor.py
python
TabularEditor._on_click
(self, index)
Handle a cell being clicked.
Handle a cell being clicked.
[ "Handle", "a", "cell", "being", "clicked", "." ]
def _on_click(self, index): """Handle a cell being clicked.""" self._mouse_click(index, "clicked")
[ "def", "_on_click", "(", "self", ",", "index", ")", ":", "self", ".", "_mouse_click", "(", "index", ",", "\"clicked\"", ")" ]
https://github.com/enthought/traitsui/blob/b7c38c7a47bf6ae7971f9ddab70c8a358647dd25/traitsui/qt4/tabular_editor.py#L531-L533
openshift/openshift-tools
1188778e728a6e4781acf728123e5b356380fe6f
ansible/roles/lib_zabbix/library/zbx_action.py
python
get_host_id_by_name
(zapi, host_name)
return content['result'][0]['hostid']
Get host id by name
Get host id by name
[ "Get", "host", "id", "by", "name" ]
def get_host_id_by_name(zapi, host_name): '''Get host id by name''' content = zapi.get_content('host', 'get', {'filter': {'name': host_name}}) return content['result'][0]['hostid']
[ "def", "get_host_id_by_name", "(", "zapi", ",", "host_name", ")", ":", "content", "=", "zapi", ".", "get_content", "(", "'host'", ",", "'get'", ",", "{", "'filter'", ":", "{", "'name'", ":", "host_name", "}", "}", ")", "return", "content", "[", "'result'...
https://github.com/openshift/openshift-tools/blob/1188778e728a6e4781acf728123e5b356380fe6f/ansible/roles/lib_zabbix/library/zbx_action.py#L298-L304
safe-graph/DGFraud
4d017a5ae9c44287215f52470e1aef5ee99a5d9d
algorithms/GraphConsis/utils.py
python
load_mat_full
(prefix='./example_data/', file_name = 'YelpChi.mat', relations=['net_rur'], train_size=0.8)
return adj_mat, features, truelabels, train_idx, test_idx
[]
def load_mat_full(prefix='./example_data/', file_name = 'YelpChi.mat', relations=['net_rur'], train_size=0.8): data = sio.loadmat(prefix + file_name) truelabels, features = data['label'], data['features'].astype(float) truelabels = truelabels.tolist()[0] features = features.todense() N = features.sh...
[ "def", "load_mat_full", "(", "prefix", "=", "'./example_data/'", ",", "file_name", "=", "'YelpChi.mat'", ",", "relations", "=", "[", "'net_rur'", "]", ",", "train_size", "=", "0.8", ")", ":", "data", "=", "sio", ".", "loadmat", "(", "prefix", "+", "file_na...
https://github.com/safe-graph/DGFraud/blob/4d017a5ae9c44287215f52470e1aef5ee99a5d9d/algorithms/GraphConsis/utils.py#L21-L34
kuri65536/python-for-android
26402a08fc46b09ef94e8d7a6bbc3a54ff9d0891
python-modules/twisted/twisted/protocols/sip.py
python
parseAddress
(address, host=None, port=None, clean=0)
return name, url, params
Return (name, uri, params) for From/To/Contact header. @param clean: remove unnecessary info, usually for From and To headers.
Return (name, uri, params) for From/To/Contact header.
[ "Return", "(", "name", "uri", "params", ")", "for", "From", "/", "To", "/", "Contact", "header", "." ]
def parseAddress(address, host=None, port=None, clean=0): """Return (name, uri, params) for From/To/Contact header. @param clean: remove unnecessary info, usually for From and To headers. """ address = address.strip() # simple 'sip:foo' case if address.startswith("sip:"): return "", par...
[ "def", "parseAddress", "(", "address", ",", "host", "=", "None", ",", "port", "=", "None", ",", "clean", "=", "0", ")", ":", "address", "=", "address", ".", "strip", "(", ")", "# simple 'sip:foo' case", "if", "address", ".", "startswith", "(", "\"sip:\""...
https://github.com/kuri65536/python-for-android/blob/26402a08fc46b09ef94e8d7a6bbc3a54ff9d0891/python-modules/twisted/twisted/protocols/sip.py#L490-L521
ajinabraham/OWASP-Xenotix-XSS-Exploit-Framework
cb692f527e4e819b6c228187c5702d990a180043
external/Scripting Engine/Xenotix Python Scripting Engine/bin/x86/Debug/Lib/numbers.py
python
Complex.imag
(self)
Retrieve the imaginary component of this number. This should subclass Real.
Retrieve the imaginary component of this number.
[ "Retrieve", "the", "imaginary", "component", "of", "this", "number", "." ]
def imag(self): """Retrieve the imaginary component of this number. This should subclass Real. """ raise NotImplementedError
[ "def", "imag", "(", "self", ")", ":", "raise", "NotImplementedError" ]
https://github.com/ajinabraham/OWASP-Xenotix-XSS-Exploit-Framework/blob/cb692f527e4e819b6c228187c5702d990a180043/external/Scripting Engine/Xenotix Python Scripting Engine/bin/x86/Debug/Lib/numbers.py#L65-L70
bruderstein/PythonScript
df9f7071ddf3a079e3a301b9b53a6dc78cf1208f
PythonLib/full/xml/sax/xmlreader.py
python
InputSource.getEncoding
(self)
return self.__encoding
Get the character encoding of this InputSource.
Get the character encoding of this InputSource.
[ "Get", "the", "character", "encoding", "of", "this", "InputSource", "." ]
def getEncoding(self): "Get the character encoding of this InputSource." return self.__encoding
[ "def", "getEncoding", "(", "self", ")", ":", "return", "self", ".", "__encoding" ]
https://github.com/bruderstein/PythonScript/blob/df9f7071ddf3a079e3a301b9b53a6dc78cf1208f/PythonLib/full/xml/sax/xmlreader.py#L238-L240
securesystemslab/zippy
ff0e84ac99442c2c55fe1d285332cfd4e185e089
zippy/benchmarks/src/benchmarks/sympy/sympy/polys/agca/ideals.py
python
Ideal.reduce_element
(self, x)
return x
Reduce the element ``x`` of our ring modulo the ideal ``self``. Here "reduce" has no specific meaning: it could return a unique normal form, simplify the expression a bit, or just do nothing.
Reduce the element ``x`` of our ring modulo the ideal ``self``.
[ "Reduce", "the", "element", "x", "of", "our", "ring", "modulo", "the", "ideal", "self", "." ]
def reduce_element(self, x): """ Reduce the element ``x`` of our ring modulo the ideal ``self``. Here "reduce" has no specific meaning: it could return a unique normal form, simplify the expression a bit, or just do nothing. """ return x
[ "def", "reduce_element", "(", "self", ",", "x", ")", ":", "return", "x" ]
https://github.com/securesystemslab/zippy/blob/ff0e84ac99442c2c55fe1d285332cfd4e185e089/zippy/benchmarks/src/benchmarks/sympy/sympy/polys/agca/ideals.py#L217-L224
PrefectHQ/prefect
67bdc94e2211726d99561f6f52614bec8970e981
src/prefect/utilities/graphql.py
python
multiline_indent
(string: str, spaces: int)
return string.replace("\n", "\n" + " " * spaces)
Utility to indent all but the first line in a string to the specified level
Utility to indent all but the first line in a string to the specified level
[ "Utility", "to", "indent", "all", "but", "the", "first", "line", "in", "a", "string", "to", "the", "specified", "level" ]
def multiline_indent(string: str, spaces: int) -> str: """ Utility to indent all but the first line in a string to the specified level """ return string.replace("\n", "\n" + " " * spaces)
[ "def", "multiline_indent", "(", "string", ":", "str", ",", "spaces", ":", "int", ")", "->", "str", ":", "return", "string", ".", "replace", "(", "\"\\n\"", ",", "\"\\n\"", "+", "\" \"", "*", "spaces", ")" ]
https://github.com/PrefectHQ/prefect/blob/67bdc94e2211726d99561f6f52614bec8970e981/src/prefect/utilities/graphql.py#L24-L28
Chaffelson/nipyapi
d3b186fd701ce308c2812746d98af9120955e810
nipyapi/nifi/models/documented_type_dto.py
python
DocumentedTypeDTO.usage_restriction
(self, usage_restriction)
Sets the usage_restriction of this DocumentedTypeDTO. The optional description of why the usage of this component is restricted. :param usage_restriction: The usage_restriction of this DocumentedTypeDTO. :type: str
Sets the usage_restriction of this DocumentedTypeDTO. The optional description of why the usage of this component is restricted.
[ "Sets", "the", "usage_restriction", "of", "this", "DocumentedTypeDTO", ".", "The", "optional", "description", "of", "why", "the", "usage", "of", "this", "component", "is", "restricted", "." ]
def usage_restriction(self, usage_restriction): """ Sets the usage_restriction of this DocumentedTypeDTO. The optional description of why the usage of this component is restricted. :param usage_restriction: The usage_restriction of this DocumentedTypeDTO. :type: str """ ...
[ "def", "usage_restriction", "(", "self", ",", "usage_restriction", ")", ":", "self", ".", "_usage_restriction", "=", "usage_restriction" ]
https://github.com/Chaffelson/nipyapi/blob/d3b186fd701ce308c2812746d98af9120955e810/nipyapi/nifi/models/documented_type_dto.py#L218-L227