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
securesystemslab/zippy
ff0e84ac99442c2c55fe1d285332cfd4e185e089
zippy/lib-python/3/site.py
python
_Helper.__call__
(self, *args, **kwds)
return pydoc.help(*args, **kwds)
[]
def __call__(self, *args, **kwds): import pydoc return pydoc.help(*args, **kwds)
[ "def", "__call__", "(", "self", ",", "*", "args", ",", "*", "*", "kwds", ")", ":", "import", "pydoc", "return", "pydoc", ".", "help", "(", "*", "args", ",", "*", "*", "kwds", ")" ]
https://github.com/securesystemslab/zippy/blob/ff0e84ac99442c2c55fe1d285332cfd4e185e089/zippy/lib-python/3/site.py#L455-L457
WerWolv/EdiZon_CheatsConfigsAndScripts
d16d36c7509c01dca770f402babd83ff2e9ae6e7
Scripts/lib/python3.5/pydoc.py
python
cram
(text, maxlen)
return text
Omit part of a string if needed to make it fit in a maximum length.
Omit part of a string if needed to make it fit in a maximum length.
[ "Omit", "part", "of", "a", "string", "if", "needed", "to", "make", "it", "fit", "in", "a", "maximum", "length", "." ]
def cram(text, maxlen): """Omit part of a string if needed to make it fit in a maximum length.""" if len(text) > maxlen: pre = max(0, (maxlen-3)//2) post = max(0, maxlen-3-pre) return text[:pre] + '...' + text[len(text)-post:] return text
[ "def", "cram", "(", "text", ",", "maxlen", ")", ":", "if", "len", "(", "text", ")", ">", "maxlen", ":", "pre", "=", "max", "(", "0", ",", "(", "maxlen", "-", "3", ")", "//", "2", ")", "post", "=", "max", "(", "0", ",", "maxlen", "-", "3", ...
https://github.com/WerWolv/EdiZon_CheatsConfigsAndScripts/blob/d16d36c7509c01dca770f402babd83ff2e9ae6e7/Scripts/lib/python3.5/pydoc.py#L123-L129
ajinabraham/OWASP-Xenotix-XSS-Exploit-Framework
cb692f527e4e819b6c228187c5702d990a180043
bin/x86/Debug/scripting_engine/Lib/pydoc.py
python
HTMLDoc.docdata
(self, object, name=None, mod=None, cl=None)
return self._docdescriptor(name, object, mod)
Produce html documentation for a data descriptor.
Produce html documentation for a data descriptor.
[ "Produce", "html", "documentation", "for", "a", "data", "descriptor", "." ]
def docdata(self, object, name=None, mod=None, cl=None): """Produce html documentation for a data descriptor.""" return self._docdescriptor(name, object, mod)
[ "def", "docdata", "(", "self", ",", "object", ",", "name", "=", "None", ",", "mod", "=", "None", ",", "cl", "=", "None", ")", ":", "return", "self", ".", "_docdescriptor", "(", "name", ",", "object", ",", "mod", ")" ]
https://github.com/ajinabraham/OWASP-Xenotix-XSS-Exploit-Framework/blob/cb692f527e4e819b6c228187c5702d990a180043/bin/x86/Debug/scripting_engine/Lib/pydoc.py#L927-L929
tomplus/kubernetes_asyncio
f028cc793e3a2c519be6a52a49fb77ff0b014c9b
kubernetes_asyncio/client/api/custom_objects_api.py
python
CustomObjectsApi.patch_namespaced_custom_object_status
(self, group, version, namespace, plural, name, body, **kwargs)
return self.patch_namespaced_custom_object_status_with_http_info(group, version, namespace, plural, name, body, **kwargs)
patch_namespaced_custom_object_status # noqa: E501 partially update status of the specified namespace scoped custom object # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.patch_name...
patch_namespaced_custom_object_status # noqa: E501
[ "patch_namespaced_custom_object_status", "#", "noqa", ":", "E501" ]
def patch_namespaced_custom_object_status(self, group, version, namespace, plural, name, body, **kwargs): # noqa: E501 """patch_namespaced_custom_object_status # noqa: E501 partially update status of the specified namespace scoped custom object # noqa: E501 This method makes a synchronous HT...
[ "def", "patch_namespaced_custom_object_status", "(", "self", ",", "group", ",", "version", ",", "namespace", ",", "plural", ",", "name", ",", "body", ",", "*", "*", "kwargs", ")", ":", "# noqa: E501", "kwargs", "[", "'_return_http_data_only'", "]", "=", "True"...
https://github.com/tomplus/kubernetes_asyncio/blob/f028cc793e3a2c519be6a52a49fb77ff0b014c9b/kubernetes_asyncio/client/api/custom_objects_api.py#L3143-L3174
linxid/Machine_Learning_Study_Path
558e82d13237114bbb8152483977806fc0c222af
Machine Learning In Action/Chapter5-LogisticRegression/venv/Lib/codecs.py
python
StreamWriter.seek
(self, offset, whence=0)
[]
def seek(self, offset, whence=0): self.stream.seek(offset, whence) if whence == 0 and offset == 0: self.reset()
[ "def", "seek", "(", "self", ",", "offset", ",", "whence", "=", "0", ")", ":", "self", ".", "stream", ".", "seek", "(", "offset", ",", "whence", ")", "if", "whence", "==", "0", "and", "offset", "==", "0", ":", "self", ".", "reset", "(", ")" ]
https://github.com/linxid/Machine_Learning_Study_Path/blob/558e82d13237114bbb8152483977806fc0c222af/Machine Learning In Action/Chapter5-LogisticRegression/venv/Lib/codecs.py#L398-L401
BoyuanJiang/matching-networks-pytorch
3f7bc55ce531143004cc4bc6138a3485d4886794
matching_networks.py
python
BidirectionalLSTM.__init__
(self, layer_size, batch_size, vector_dim,use_cuda)
Initial a muti-layer Bidirectional LSTM :param layer_size: a list of each layer'size :param batch_size: :param vector_dim:
Initial a muti-layer Bidirectional LSTM :param layer_size: a list of each layer'size :param batch_size: :param vector_dim:
[ "Initial", "a", "muti", "-", "layer", "Bidirectional", "LSTM", ":", "param", "layer_size", ":", "a", "list", "of", "each", "layer", "size", ":", "param", "batch_size", ":", ":", "param", "vector_dim", ":" ]
def __init__(self, layer_size, batch_size, vector_dim,use_cuda): super(BidirectionalLSTM, self).__init__() """ Initial a muti-layer Bidirectional LSTM :param layer_size: a list of each layer'size :param batch_size: :param vector_dim: """ self.batch_size ...
[ "def", "__init__", "(", "self", ",", "layer_size", ",", "batch_size", ",", "vector_dim", ",", "use_cuda", ")", ":", "super", "(", "BidirectionalLSTM", ",", "self", ")", ".", "__init__", "(", ")", "self", ".", "batch_size", "=", "batch_size", "self", ".", ...
https://github.com/BoyuanJiang/matching-networks-pytorch/blob/3f7bc55ce531143004cc4bc6138a3485d4886794/matching_networks.py#L108-L123
demisto/content
5c664a65b992ac8ca90ac3f11b1b2cdf11ee9b07
Packs/Axonius/Integrations/Axonius/Axonius.py
python
parse_asset
(asset: dict)
return { parse_key(key=k): parse_kv(key=k, value=v) for k, v in asset.items() if k not in SKIPS }
Initiate field format correction on assets.
Initiate field format correction on assets.
[ "Initiate", "field", "format", "correction", "on", "assets", "." ]
def parse_asset(asset: dict) -> dict: """Initiate field format correction on assets.""" return { parse_key(key=k): parse_kv(key=k, value=v) for k, v in asset.items() if k not in SKIPS }
[ "def", "parse_asset", "(", "asset", ":", "dict", ")", "->", "dict", ":", "return", "{", "parse_key", "(", "key", "=", "k", ")", ":", "parse_kv", "(", "key", "=", "k", ",", "value", "=", "v", ")", "for", "k", ",", "v", "in", "asset", ".", "items...
https://github.com/demisto/content/blob/5c664a65b992ac8ca90ac3f11b1b2cdf11ee9b07/Packs/Axonius/Integrations/Axonius/Axonius.py#L81-L87
1012598167/flask_mongodb_game
60c7e0351586656ec38f851592886338e50b4110
python_flask/venv/Lib/site-packages/pip-19.0.3-py3.6.egg/pip/_vendor/urllib3/util/ssl_.py
python
_const_compare_digest_backport
(a, b)
return result == 0
Compare two digests of equal length in constant time. The digests must be of type str/bytes. Returns True if the digests match, and False otherwise.
Compare two digests of equal length in constant time.
[ "Compare", "two", "digests", "of", "equal", "length", "in", "constant", "time", "." ]
def _const_compare_digest_backport(a, b): """ Compare two digests of equal length in constant time. The digests must be of type str/bytes. Returns True if the digests match, and False otherwise. """ result = abs(len(a) - len(b)) for l, r in zip(bytearray(a), bytearray(b)): result |=...
[ "def", "_const_compare_digest_backport", "(", "a", ",", "b", ")", ":", "result", "=", "abs", "(", "len", "(", "a", ")", "-", "len", "(", "b", ")", ")", "for", "l", ",", "r", "in", "zip", "(", "bytearray", "(", "a", ")", ",", "bytearray", "(", "...
https://github.com/1012598167/flask_mongodb_game/blob/60c7e0351586656ec38f851592886338e50b4110/python_flask/venv/Lib/site-packages/pip-19.0.3-py3.6.egg/pip/_vendor/urllib3/util/ssl_.py#L27-L37
aws-samples/aws-kube-codesuite
ab4e5ce45416b83bffb947ab8d234df5437f4fca
src/kubernetes/client/models/v1alpha1_admission_hook_client_config.py
python
V1alpha1AdmissionHookClientConfig.__init__
(self, ca_bundle=None, service=None)
V1alpha1AdmissionHookClientConfig - a model defined in Swagger :param dict swaggerTypes: The key is attribute name and the value is attribute type. :param dict attributeMap: The key is attribute name and the value is json key in defini...
V1alpha1AdmissionHookClientConfig - a model defined in Swagger
[ "V1alpha1AdmissionHookClientConfig", "-", "a", "model", "defined", "in", "Swagger" ]
def __init__(self, ca_bundle=None, service=None): """ V1alpha1AdmissionHookClientConfig - a model defined in Swagger :param dict swaggerTypes: The key is attribute name and the value is attribute type. :param dict attributeMap: The key is attribute name...
[ "def", "__init__", "(", "self", ",", "ca_bundle", "=", "None", ",", "service", "=", "None", ")", ":", "self", ".", "swagger_types", "=", "{", "'ca_bundle'", ":", "'str'", ",", "'service'", ":", "'V1alpha1ServiceReference'", "}", "self", ".", "attribute_map",...
https://github.com/aws-samples/aws-kube-codesuite/blob/ab4e5ce45416b83bffb947ab8d234df5437f4fca/src/kubernetes/client/models/v1alpha1_admission_hook_client_config.py#L24-L44
dimagi/commcare-hq
d67ff1d3b4c51fa050c19e60c3253a79d3452a39
corehq/apps/userreports/pillow.py
python
get_kafka_ucr_registry_pillow
( pillow_id='kafka-ucr-registry', num_processes=1, process_num=0, dedicated_migration_process=False, processor_chunk_size=DEFAULT_PROCESSOR_CHUNK_SIZE, ucr_configs=None, **kwargs)
return ConfigurableReportKafkaPillow( processor=ucr_processor, pillow_name=pillow_id, topics=CASE_TOPICS, num_processes=num_processes, process_num=process_num, is_dedicated_migration_process=dedicated_migration_process and (process_num == 0), processor_chunk_size=...
UCR pillow that reads from all 'case' Kafka topics and writes data into the UCR database tables Only UCRs backed by Data Registries are processed in this pillow. Processors: - :py:class:`corehq.apps.userreports.pillow.ConfigurableReportPillowProcessor`
UCR pillow that reads from all 'case' Kafka topics and writes data into the UCR database tables
[ "UCR", "pillow", "that", "reads", "from", "all", "case", "Kafka", "topics", "and", "writes", "data", "into", "the", "UCR", "database", "tables" ]
def get_kafka_ucr_registry_pillow( pillow_id='kafka-ucr-registry', num_processes=1, process_num=0, dedicated_migration_process=False, processor_chunk_size=DEFAULT_PROCESSOR_CHUNK_SIZE, ucr_configs=None, **kwargs): """UCR pillow that reads from all 'case' Kafka topics and writes data into the UCR databas...
[ "def", "get_kafka_ucr_registry_pillow", "(", "pillow_id", "=", "'kafka-ucr-registry'", ",", "num_processes", "=", "1", ",", "process_num", "=", "0", ",", "dedicated_migration_process", "=", "False", ",", "processor_chunk_size", "=", "DEFAULT_PROCESSOR_CHUNK_SIZE", ",", ...
https://github.com/dimagi/commcare-hq/blob/d67ff1d3b4c51fa050c19e60c3253a79d3452a39/corehq/apps/userreports/pillow.py#L746-L770
gem/oq-engine
1bdb88f3914e390abcbd285600bfd39477aae47c
openquake/hazardlib/gsim/atkinson_boore_2003.py
python
_compute_site_class_dummy_variables_2008
(kind, vs30)
return Sbc, Sc, Sd, Se
Extend :meth:`AtkinsonBoore2003SInter._compute_site_class_dummy_variables` and includes dummy variable for B/C site conditions (vs30 > 760.)
Extend :meth:`AtkinsonBoore2003SInter._compute_site_class_dummy_variables` and includes dummy variable for B/C site conditions (vs30 > 760.)
[ "Extend", ":", "meth", ":", "AtkinsonBoore2003SInter", ".", "_compute_site_class_dummy_variables", "and", "includes", "dummy", "variable", "for", "B", "/", "C", "site", "conditions", "(", "vs30", ">", "760", ".", ")" ]
def _compute_site_class_dummy_variables_2008(kind, vs30): """ Extend :meth:`AtkinsonBoore2003SInter._compute_site_class_dummy_variables` and includes dummy variable for B/C site conditions (vs30 > 760.) """ Sbc = np.zeros_like(vs30) Sc = np.zeros_like(vs30) Sd = np.zeros_like(vs30) S...
[ "def", "_compute_site_class_dummy_variables_2008", "(", "kind", ",", "vs30", ")", ":", "Sbc", "=", "np", ".", "zeros_like", "(", "vs30", ")", "Sc", "=", "np", ".", "zeros_like", "(", "vs30", ")", "Sd", "=", "np", ".", "zeros_like", "(", "vs30", ")", "S...
https://github.com/gem/oq-engine/blob/1bdb88f3914e390abcbd285600bfd39477aae47c/openquake/hazardlib/gsim/atkinson_boore_2003.py#L86-L102
mcneel/rhinoscriptsyntax
c49bd0bf24c2513bdcb84d1bf307144489600fd9
Scripts/rhinoscript/surface.py
python
AddLoftSrf
(object_ids, start=None, end=None, loft_type=0, simplify_method=0, value=0, closed=False)
return idlist
Adds a surface created by lofting curves to the document. - no curve sorting performed. pass in curves in the order you want them sorted - directions of open curves not adjusted. Use CurveDirectionsMatch and ReverseCurve to adjust the directions of open curves - seams of closed curves are not adjusted...
Adds a surface created by lofting curves to the document. - no curve sorting performed. pass in curves in the order you want them sorted - directions of open curves not adjusted. Use CurveDirectionsMatch and ReverseCurve to adjust the directions of open curves - seams of closed curves are not adjusted...
[ "Adds", "a", "surface", "created", "by", "lofting", "curves", "to", "the", "document", ".", "-", "no", "curve", "sorting", "performed", ".", "pass", "in", "curves", "in", "the", "order", "you", "want", "them", "sorted", "-", "directions", "of", "open", "...
def AddLoftSrf(object_ids, start=None, end=None, loft_type=0, simplify_method=0, value=0, closed=False): """Adds a surface created by lofting curves to the document. - no curve sorting performed. pass in curves in the order you want them sorted - directions of open curves not adjusted. Use CurveDirectionsMa...
[ "def", "AddLoftSrf", "(", "object_ids", ",", "start", "=", "None", ",", "end", "=", "None", ",", "loft_type", "=", "0", ",", "simplify_method", "=", "0", ",", "value", "=", "0", ",", "closed", "=", "False", ")", ":", "if", "loft_type", "<", "0", "o...
https://github.com/mcneel/rhinoscriptsyntax/blob/c49bd0bf24c2513bdcb84d1bf307144489600fd9/Scripts/rhinoscript/surface.py#L439-L521
keras-team/keras
5caa668b6a415675064a730f5eb46ecc08e40f65
keras/engine/functional.py
python
ModuleWrapper.__init__
(self, module, method_name=None, **kwargs)
Initializes the wrapper Layer for this module. Args: module: The `tf.Module` instance to be wrapped. method_name: (Optional) str. The name of the method to use as the forward pass of the module. If not set, defaults to '__call__' if defined, or 'call'. **kwargs: Additional keywrod...
Initializes the wrapper Layer for this module.
[ "Initializes", "the", "wrapper", "Layer", "for", "this", "module", "." ]
def __init__(self, module, method_name=None, **kwargs): """Initializes the wrapper Layer for this module. Args: module: The `tf.Module` instance to be wrapped. method_name: (Optional) str. The name of the method to use as the forward pass of the module. If not set, defaults to '__call__' if...
[ "def", "__init__", "(", "self", ",", "module", ",", "method_name", "=", "None", ",", "*", "*", "kwargs", ")", ":", "super", "(", "ModuleWrapper", ",", "self", ")", ".", "__init__", "(", "*", "*", "kwargs", ")", "if", "method_name", "is", "None", ":",...
https://github.com/keras-team/keras/blob/5caa668b6a415675064a730f5eb46ecc08e40f65/keras/engine/functional.py#L1461-L1493
boston-dynamics/spot-sdk
5ffa12e6943a47323c7279d86e30346868755f52
python/bosdyn-client/src/bosdyn/client/math_helpers.py
python
SE3Velocity.angular
(self)
return geometry_pb2.Vec3(x=self.angular_velocity_x, y=self.angular_velocity_y, z=self.angular_velocity_z)
Property to allow attribute access of the protobuf message field 'angular' similar to the geometry_pb2.SE3Velocity for the math_helper.SE3Velocity.
Property to allow attribute access of the protobuf message field 'angular' similar to the geometry_pb2.SE3Velocity for the math_helper.SE3Velocity.
[ "Property", "to", "allow", "attribute", "access", "of", "the", "protobuf", "message", "field", "angular", "similar", "to", "the", "geometry_pb2", ".", "SE3Velocity", "for", "the", "math_helper", ".", "SE3Velocity", "." ]
def angular(self): """Property to allow attribute access of the protobuf message field 'angular' similar to the geometry_pb2.SE3Velocity for the math_helper.SE3Velocity.""" return geometry_pb2.Vec3(x=self.angular_velocity_x, y=self.angular_velocity_y, z=self.a...
[ "def", "angular", "(", "self", ")", ":", "return", "geometry_pb2", ".", "Vec3", "(", "x", "=", "self", ".", "angular_velocity_x", ",", "y", "=", "self", ".", "angular_velocity_y", ",", "z", "=", "self", ".", "angular_velocity_z", ")" ]
https://github.com/boston-dynamics/spot-sdk/blob/5ffa12e6943a47323c7279d86e30346868755f52/python/bosdyn-client/src/bosdyn/client/math_helpers.py#L285-L289
reviewboard/reviewboard
7395902e4c181bcd1d633f61105012ffb1d18e1b
reviewboard/reviews/models/review_request_draft.py
python
ReviewRequestDraft.create
(review_request, changedesc=None)
return draft
Create a draft based on a review request. This will copy over all the details of the review request that we care about. If a draft already exists for the review request, the draft will be returned. Args: review_request (reviewboard.reviews.models.review_request. ...
Create a draft based on a review request.
[ "Create", "a", "draft", "based", "on", "a", "review", "request", "." ]
def create(review_request, changedesc=None): """Create a draft based on a review request. This will copy over all the details of the review request that we care about. If a draft already exists for the review request, the draft will be returned. Args: review_request...
[ "def", "create", "(", "review_request", ",", "changedesc", "=", "None", ")", ":", "draft", ",", "draft_is_new", "=", "ReviewRequestDraft", ".", "objects", ".", "get_or_create", "(", "review_request", "=", "review_request", ",", "defaults", "=", "{", "'changedesc...
https://github.com/reviewboard/reviewboard/blob/7395902e4c181bcd1d633f61105012ffb1d18e1b/reviewboard/reviews/models/review_request_draft.py#L139-L241
hydroshare/hydroshare
7ba563b55412f283047fb3ef6da367d41dec58c6
hs_access_control/models/user.py
python
UserAccess.can_undo_share_community_with_user
(self, this_community, this_user)
return self.__get_community_undo_users(this_community).filter(id=this_user.id).exists()
Check that a user share can be undone :param this_user: shared user to check. :param this_community: with user to check. :returns: Boolean "undo_share" differs from "unshare" in that no special privilege is required to "undo" a share; all that is required is that one granted th...
Check that a user share can be undone
[ "Check", "that", "a", "user", "share", "can", "be", "undone" ]
def can_undo_share_community_with_user(self, this_community, this_user): """ Check that a user share can be undone :param this_user: shared user to check. :param this_community: with user to check. :returns: Boolean "undo_share" differs from "unshare" in that no special...
[ "def", "can_undo_share_community_with_user", "(", "self", ",", "this_community", ",", "this_user", ")", ":", "if", "__debug__", ":", "assert", "isinstance", "(", "this_user", ",", "User", ")", "assert", "isinstance", "(", "this_community", ",", "Community", ")", ...
https://github.com/hydroshare/hydroshare/blob/7ba563b55412f283047fb3ef6da367d41dec58c6/hs_access_control/models/user.py#L3254-L3286
zhl2008/awd-platform
0416b31abea29743387b10b3914581fbe8e7da5e
web_flaskbb/lib/python2.7/site-packages/pkg_resources/__init__.py
python
Distribution.__eq__
(self, other)
return self.hashcmp == other.hashcmp
[]
def __eq__(self, other): if not isinstance(other, self.__class__): # It's not a Distribution, so they are not equal return False return self.hashcmp == other.hashcmp
[ "def", "__eq__", "(", "self", ",", "other", ")", ":", "if", "not", "isinstance", "(", "other", ",", "self", ".", "__class__", ")", ":", "# It's not a Distribution, so they are not equal", "return", "False", "return", "self", ".", "hashcmp", "==", "other", ".",...
https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_flaskbb/lib/python2.7/site-packages/pkg_resources/__init__.py#L2502-L2506
openhatch/oh-mainline
ce29352a034e1223141dcc2f317030bbc3359a51
vendor/packages/twisted/twisted/python/runtime.py
python
Platform.getType
(self)
return self.type
Return 'posix', 'win32' or 'java
Return 'posix', 'win32' or 'java
[ "Return", "posix", "win32", "or", "java" ]
def getType(self): """Return 'posix', 'win32' or 'java'""" return self.type
[ "def", "getType", "(", "self", ")", ":", "return", "self", ".", "type" ]
https://github.com/openhatch/oh-mainline/blob/ce29352a034e1223141dcc2f317030bbc3359a51/vendor/packages/twisted/twisted/python/runtime.py#L48-L50
DLR-RM/BlenderProc
e04e03f34b66702bbca45d1ac701599b6d764609
blenderproc/python/utility/SetupUtility.py
python
SetupUtility.setup
(user_required_packages: Optional[List[str]] = None, blender_path: Optional[str] = None, major_version: Optional[str] = None, reinstall_packages: bool = False, debug_args: Optional[List[str]] = None)
return sys.argv
Sets up the python environment. - Makes sure all required pip packages are installed - Prepares the given sys.argv :param user_required_packages: A list of python packages that are additionally necessary to execute the python script. :param blender_path: The path to the blender install...
Sets up the python environment.
[ "Sets", "up", "the", "python", "environment", "." ]
def setup(user_required_packages: Optional[List[str]] = None, blender_path: Optional[str] = None, major_version: Optional[str] = None, reinstall_packages: bool = False, debug_args: Optional[List[str]] = None): """ Sets up the python environment. - Makes sure all required pip packages are installed ...
[ "def", "setup", "(", "user_required_packages", ":", "Optional", "[", "List", "[", "str", "]", "]", "=", "None", ",", "blender_path", ":", "Optional", "[", "str", "]", "=", "None", ",", "major_version", ":", "Optional", "[", "str", "]", "=", "None", ","...
https://github.com/DLR-RM/BlenderProc/blob/e04e03f34b66702bbca45d1ac701599b6d764609/blenderproc/python/utility/SetupUtility.py#L24-L56
mozilla/zamboni
14b1a44658e47b9f048962fa52dbf00a3beaaf30
lib/utils.py
python
update_csp
()
After settings, including DEBUG has loaded, see if we need to update CSP.
After settings, including DEBUG has loaded, see if we need to update CSP.
[ "After", "settings", "including", "DEBUG", "has", "loaded", "see", "if", "we", "need", "to", "update", "CSP", "." ]
def update_csp(): """ After settings, including DEBUG has loaded, see if we need to update CSP. """ # This list will expand as we implement more CSP enforcement for key in ('CSP_SCRIPT_SRC',): values = getattr(settings, key) new = set() for value in values: # If w...
[ "def", "update_csp", "(", ")", ":", "# This list will expand as we implement more CSP enforcement", "for", "key", "in", "(", "'CSP_SCRIPT_SRC'", ",", ")", ":", "values", "=", "getattr", "(", "settings", ",", "key", ")", "new", "=", "set", "(", ")", "for", "val...
https://github.com/mozilla/zamboni/blob/14b1a44658e47b9f048962fa52dbf00a3beaaf30/lib/utils.py#L82-L106
stared/livelossplot
0afb02397af89739c2cd1c36dfc974554ee32215
livelossplot/inputs/poutyne.py
python
PlotLossesCallback.__init__
(self, **kwargs)
Args: **kwargs: keyword arguments that will be passed to PlotLosses constructor
Args: **kwargs: keyword arguments that will be passed to PlotLosses constructor
[ "Args", ":", "**", "kwargs", ":", "keyword", "arguments", "that", "will", "be", "passed", "to", "PlotLosses", "constructor" ]
def __init__(self, **kwargs): """ Args: **kwargs: keyword arguments that will be passed to PlotLosses constructor """ super(PlotLossesCallback, self).__init__() self.liveplot = PlotLosses(**kwargs) self.metrics = None
[ "def", "__init__", "(", "self", ",", "*", "*", "kwargs", ")", ":", "super", "(", "PlotLossesCallback", ",", "self", ")", ".", "__init__", "(", ")", "self", ".", "liveplot", "=", "PlotLosses", "(", "*", "*", "kwargs", ")", "self", ".", "metrics", "=",...
https://github.com/stared/livelossplot/blob/0afb02397af89739c2cd1c36dfc974554ee32215/livelossplot/inputs/poutyne.py#L9-L16
pyca/pyopenssl
fb26edde0aa27670c7bb24c0daeb05516e83d7b0
src/OpenSSL/crypto.py
python
_new_mem_buf
(buffer=None)
return bio
Allocate a new OpenSSL memory BIO. Arrange for the garbage collector to clean it up automatically. :param buffer: None or some bytes to use to put into the BIO so that they can be read out.
Allocate a new OpenSSL memory BIO.
[ "Allocate", "a", "new", "OpenSSL", "memory", "BIO", "." ]
def _new_mem_buf(buffer=None): """ Allocate a new OpenSSL memory BIO. Arrange for the garbage collector to clean it up automatically. :param buffer: None or some bytes to use to put into the BIO so that they can be read out. """ if buffer is None: bio = _lib.BIO_new(_lib.BIO_s_...
[ "def", "_new_mem_buf", "(", "buffer", "=", "None", ")", ":", "if", "buffer", "is", "None", ":", "bio", "=", "_lib", ".", "BIO_new", "(", "_lib", ".", "BIO_s_mem", "(", ")", ")", "free", "=", "_lib", ".", "BIO_free", "else", ":", "data", "=", "_ffi"...
https://github.com/pyca/pyopenssl/blob/fb26edde0aa27670c7bb24c0daeb05516e83d7b0/src/OpenSSL/crypto.py#L105-L128
jgagneastro/coffeegrindsize
22661ebd21831dba4cf32bfc6ba59fe3d49f879c
App/dist/coffeegrindsize.app/Contents/Resources/lib/python3.7/matplotlib/cbook/__init__.py
python
_reshape_2D
(X, name)
Use Fortran ordering to convert ndarrays and lists of iterables to lists of 1D arrays. Lists of iterables are converted by applying `np.asarray` to each of their elements. 1D ndarrays are returned in a singleton list containing them. 2D ndarrays are converted to the list of their *columns*. *name...
Use Fortran ordering to convert ndarrays and lists of iterables to lists of 1D arrays.
[ "Use", "Fortran", "ordering", "to", "convert", "ndarrays", "and", "lists", "of", "iterables", "to", "lists", "of", "1D", "arrays", "." ]
def _reshape_2D(X, name): """ Use Fortran ordering to convert ndarrays and lists of iterables to lists of 1D arrays. Lists of iterables are converted by applying `np.asarray` to each of their elements. 1D ndarrays are returned in a singleton list containing them. 2D ndarrays are converted to t...
[ "def", "_reshape_2D", "(", "X", ",", "name", ")", ":", "# Iterate over columns for ndarrays, over rows otherwise.", "X", "=", "np", ".", "atleast_1d", "(", "X", ".", "T", "if", "isinstance", "(", "X", ",", "np", ".", "ndarray", ")", "else", "np", ".", "asa...
https://github.com/jgagneastro/coffeegrindsize/blob/22661ebd21831dba4cf32bfc6ba59fe3d49f879c/App/dist/coffeegrindsize.app/Contents/Resources/lib/python3.7/matplotlib/cbook/__init__.py#L1383-L1403
titusjan/argos
5a9c31a8a9a2ca825bbf821aa1e685740e3682d7
argos/repo/iconfactory.py
python
RtiIconFactory.loadIcon
(self, fileName, color=None)
return self._icons[key]
Reads SVG from a file name and creates an QIcon from it. Optionally replaces the color. Caches the created icons. :param fileName: absolute path to an icon file. If False/empty/None, None returned, which yields no icon. :param color: '#RRGGBB' string (e.g. '#FF0000'...
Reads SVG from a file name and creates an QIcon from it.
[ "Reads", "SVG", "from", "a", "file", "name", "and", "creates", "an", "QIcon", "from", "it", "." ]
def loadIcon(self, fileName, color=None): """ Reads SVG from a file name and creates an QIcon from it. Optionally replaces the color. Caches the created icons. :param fileName: absolute path to an icon file. If False/empty/None, None returned, which yields no icon. ...
[ "def", "loadIcon", "(", "self", ",", "fileName", ",", "color", "=", "None", ")", ":", "if", "not", "fileName", ":", "return", "None", "key", "=", "(", "fileName", ",", "color", ")", "if", "key", "not", "in", "self", ".", "_icons", ":", "try", ":", ...
https://github.com/titusjan/argos/blob/5a9c31a8a9a2ca825bbf821aa1e685740e3682d7/argos/repo/iconfactory.py#L153-L182
sahana/eden
1696fa50e90ce967df69f66b571af45356cc18da
modules/templates/historic/RLP/helpers.py
python
get_cms_intro
(module, resource, name, cmsxml=False)
return XML(row.body) if cmsxml else row.body
Get intro from CMS @param module: the module prefix @param resource: the resource name @param name: the post name @param cmsxml: whether to XML-escape the contents or not @returns: the post contents, or None if not available
Get intro from CMS
[ "Get", "intro", "from", "CMS" ]
def get_cms_intro(module, resource, name, cmsxml=False): """ Get intro from CMS @param module: the module prefix @param resource: the resource name @param name: the post name @param cmsxml: whether to XML-escape the contents or not @returns: the post contents, or No...
[ "def", "get_cms_intro", "(", "module", ",", "resource", ",", "name", ",", "cmsxml", "=", "False", ")", ":", "# Get intro text from CMS", "db", "=", "current", ".", "db", "s3db", "=", "current", ".", "s3db", "ctable", "=", "s3db", ".", "cms_post", "ltable",...
https://github.com/sahana/eden/blob/1696fa50e90ce967df69f66b571af45356cc18da/modules/templates/historic/RLP/helpers.py#L226-L259
apeterswu/RL4NMT
3c66a2d8142abc5ce73db63e05d3cc9bf4663b65
tensor2tensor/models/transformer_moe.py
python
transformer_moe_12k
()
return hparams
Hyper parameters specifics for long sequence generation.
Hyper parameters specifics for long sequence generation.
[ "Hyper", "parameters", "specifics", "for", "long", "sequence", "generation", "." ]
def transformer_moe_12k(): """Hyper parameters specifics for long sequence generation.""" hparams = transformer_moe_8k() hparams.batch_size = 12000 # At 12k, the softmax become the memory bottleneck hparams.factored_logit = True return hparams
[ "def", "transformer_moe_12k", "(", ")", ":", "hparams", "=", "transformer_moe_8k", "(", ")", "hparams", ".", "batch_size", "=", "12000", "# At 12k, the softmax become the memory bottleneck", "hparams", ".", "factored_logit", "=", "True", "return", "hparams" ]
https://github.com/apeterswu/RL4NMT/blob/3c66a2d8142abc5ce73db63e05d3cc9bf4663b65/tensor2tensor/models/transformer_moe.py#L302-L308
webpy/webpy.github.com
c6ccc32b6581edcc1b3e5991ad8cc30df14b5632
static/web-0.134.py
python
transact
()
Start a transaction.
Start a transaction.
[ "Start", "a", "transaction", "." ]
def transact(): """Start a transaction.""" # commit everything up to now, so we don't rollback it later ctx.db.commit() ctx.db_transaction = True
[ "def", "transact", "(", ")", ":", "# commit everything up to now, so we don't rollback it later", "ctx", ".", "db", ".", "commit", "(", ")", "ctx", ".", "db_transaction", "=", "True" ]
https://github.com/webpy/webpy.github.com/blob/c6ccc32b6581edcc1b3e5991ad8cc30df14b5632/static/web-0.134.py#L513-L517
mcfletch/pyopengl
02d11dad9ff18e50db10e975c4756e17bf198464
OpenGL/wrapper.py
python
Wrapper.cArgIndex
( self, argName )
Return the C-argument index for the given argument name
Return the C-argument index for the given argument name
[ "Return", "the", "C", "-", "argument", "index", "for", "the", "given", "argument", "name" ]
def cArgIndex( self, argName ): """Return the C-argument index for the given argument name""" argNames = self.wrappedOperation.argNames try: return asList( argNames ).index( argName ) except (ValueError,IndexError): raise KeyError( """No argument %r in argument li...
[ "def", "cArgIndex", "(", "self", ",", "argName", ")", ":", "argNames", "=", "self", ".", "wrappedOperation", ".", "argNames", "try", ":", "return", "asList", "(", "argNames", ")", ".", "index", "(", "argName", ")", "except", "(", "ValueError", ",", "Inde...
https://github.com/mcfletch/pyopengl/blob/02d11dad9ff18e50db10e975c4756e17bf198464/OpenGL/wrapper.py#L117-L125
yianjiajia/django_web_ansible
1103343082a65abf9d37310f5048514d74930753
devops/pagination/paginator.py
python
InfinitePage.has_next
(self)
return True
Checks for one more item than last on this page.
Checks for one more item than last on this page.
[ "Checks", "for", "one", "more", "item", "than", "last", "on", "this", "page", "." ]
def has_next(self): """ Checks for one more item than last on this page. """ try: next_item = self.paginator.object_list[ self.number * self.paginator.per_page] except IndexError: return False return True
[ "def", "has_next", "(", "self", ")", ":", "try", ":", "next_item", "=", "self", ".", "paginator", ".", "object_list", "[", "self", ".", "number", "*", "self", ".", "paginator", ".", "per_page", "]", "except", "IndexError", ":", "return", "False", "return...
https://github.com/yianjiajia/django_web_ansible/blob/1103343082a65abf9d37310f5048514d74930753/devops/pagination/paginator.py#L79-L88
nlloyd/SubliminalCollaborator
5c619e17ddbe8acb9eea8996ec038169ddcd50a1
libs/twisted/words/protocols/jabber/sasl.py
python
SASLInitiatingInitializer.onFailure
(self, failure)
Clean up observers, parse the failure and errback the deferred. @param failure: the failure protocol element. Holds details on the error condition. @type failure: L{domish.Element}
Clean up observers, parse the failure and errback the deferred.
[ "Clean", "up", "observers", "parse", "the", "failure", "and", "errback", "the", "deferred", "." ]
def onFailure(self, failure): """ Clean up observers, parse the failure and errback the deferred. @param failure: the failure protocol element. Holds details on the error condition. @type failure: L{domish.Element} """ self.xmlstream.removeObserv...
[ "def", "onFailure", "(", "self", ",", "failure", ")", ":", "self", ".", "xmlstream", ".", "removeObserver", "(", "'/challenge'", ",", "self", ".", "onChallenge", ")", "self", ".", "xmlstream", ".", "removeObserver", "(", "'/success'", ",", "self", ".", "on...
https://github.com/nlloyd/SubliminalCollaborator/blob/5c619e17ddbe8acb9eea8996ec038169ddcd50a1/libs/twisted/words/protocols/jabber/sasl.py#L228-L243
mdiazcl/fuzzbunch-debian
2b76c2249ade83a389ae3badb12a1bd09901fd2c
windows/Resources/Python/Core/Lib/_pyio.py
python
BufferedReader.peek
(self, n=0)
Returns buffered bytes without advancing the position. The argument indicates a desired minimal number of bytes; we do at most one raw read to satisfy it. We never return more than self.buffer_size.
Returns buffered bytes without advancing the position. The argument indicates a desired minimal number of bytes; we do at most one raw read to satisfy it. We never return more than self.buffer_size.
[ "Returns", "buffered", "bytes", "without", "advancing", "the", "position", ".", "The", "argument", "indicates", "a", "desired", "minimal", "number", "of", "bytes", ";", "we", "do", "at", "most", "one", "raw", "read", "to", "satisfy", "it", ".", "We", "neve...
def peek(self, n=0): """Returns buffered bytes without advancing the position. The argument indicates a desired minimal number of bytes; we do at most one raw read to satisfy it. We never return more than self.buffer_size. """ with self._read_lock: r...
[ "def", "peek", "(", "self", ",", "n", "=", "0", ")", ":", "with", "self", ".", "_read_lock", ":", "return", "self", ".", "_peek_unlocked", "(", "n", ")" ]
https://github.com/mdiazcl/fuzzbunch-debian/blob/2b76c2249ade83a389ae3badb12a1bd09901fd2c/windows/Resources/Python/Core/Lib/_pyio.py#L898-L906
secureworks/flowsynth
de58ed4ad137bfc55c59857934f76f481edf1978
src/flowsynth.py
python
output_handler
()
decide what to do about output
decide what to do about output
[ "decide", "what", "to", "do", "about", "output" ]
def output_handler(): """ decide what to do about output """ global ARGS global COMPILER_OUTPUT global COMPILER_TIMELINE global COMPILER_INSTRUCTIONS global START_TIME global END_TIME global RUNTIME if (ARGS.output_format == "hex"): hex_output() else: pcap_output...
[ "def", "output_handler", "(", ")", ":", "global", "ARGS", "global", "COMPILER_OUTPUT", "global", "COMPILER_TIMELINE", "global", "COMPILER_INSTRUCTIONS", "global", "START_TIME", "global", "END_TIME", "global", "RUNTIME", "if", "(", "ARGS", ".", "output_format", "==", ...
https://github.com/secureworks/flowsynth/blob/de58ed4ad137bfc55c59857934f76f481edf1978/src/flowsynth.py#L879-L896
ganeti/ganeti
d340a9ddd12f501bef57da421b5f9b969a4ba905
lib/config/__init__.py
python
ConfigWriter.GetNodeGroupInfoByName
(self, nodegroup_name)
return None
Get the L{objects.NodeGroup} object for a named node group. @param nodegroup_name: name of the node group to get information for @type nodegroup_name: string @return: the corresponding L{objects.NodeGroup} instance or None if no information is available
Get the L{objects.NodeGroup} object for a named node group.
[ "Get", "the", "L", "{", "objects", ".", "NodeGroup", "}", "object", "for", "a", "named", "node", "group", "." ]
def GetNodeGroupInfoByName(self, nodegroup_name): """Get the L{objects.NodeGroup} object for a named node group. @param nodegroup_name: name of the node group to get information for @type nodegroup_name: string @return: the corresponding L{objects.NodeGroup} instance or None if no information...
[ "def", "GetNodeGroupInfoByName", "(", "self", ",", "nodegroup_name", ")", ":", "for", "nodegroup", "in", "self", ".", "_UnlockedGetAllNodeGroupsInfo", "(", ")", ".", "values", "(", ")", ":", "if", "nodegroup", ".", "name", "==", "nodegroup_name", ":", "return"...
https://github.com/ganeti/ganeti/blob/d340a9ddd12f501bef57da421b5f9b969a4ba905/lib/config/__init__.py#L2304-L2316
plotly/plotly.py
cfad7862594b35965c0e000813bd7805e8494a5b
packages/python/plotly/plotly/graph_objs/_scatterpolargl.py
python
Scatterpolargl.marker
(self)
return self["marker"]
The 'marker' property is an instance of Marker that may be specified as: - An instance of :class:`plotly.graph_objs.scatterpolargl.Marker` - A dict of string/value properties that will be passed to the Marker constructor Supported dict properties: ...
The 'marker' property is an instance of Marker that may be specified as: - An instance of :class:`plotly.graph_objs.scatterpolargl.Marker` - A dict of string/value properties that will be passed to the Marker constructor Supported dict properties: ...
[ "The", "marker", "property", "is", "an", "instance", "of", "Marker", "that", "may", "be", "specified", "as", ":", "-", "An", "instance", "of", ":", "class", ":", "plotly", ".", "graph_objs", ".", "scatterpolargl", ".", "Marker", "-", "A", "dict", "of", ...
def marker(self): """ The 'marker' property is an instance of Marker that may be specified as: - An instance of :class:`plotly.graph_objs.scatterpolargl.Marker` - A dict of string/value properties that will be passed to the Marker constructor Supp...
[ "def", "marker", "(", "self", ")", ":", "return", "self", "[", "\"marker\"", "]" ]
https://github.com/plotly/plotly.py/blob/cfad7862594b35965c0e000813bd7805e8494a5b/packages/python/plotly/plotly/graph_objs/_scatterpolargl.py#L644-L783
jkwill87/mnamer
c8bbc63a8847e9b15b0f512f7ae01de0b98cf739
mnamer/providers.py
python
Provider.__init__
(self, api_key: str = None, cache: bool = True)
Initializes the provider.
Initializes the provider.
[ "Initializes", "the", "provider", "." ]
def __init__(self, api_key: str = None, cache: bool = True): """Initializes the provider.""" if api_key: self.api_key = api_key if cache: self.cache = cache
[ "def", "__init__", "(", "self", ",", "api_key", ":", "str", "=", "None", ",", "cache", ":", "bool", "=", "True", ")", ":", "if", "api_key", ":", "self", ".", "api_key", "=", "api_key", "if", "cache", ":", "self", ".", "cache", "=", "cache" ]
https://github.com/jkwill87/mnamer/blob/c8bbc63a8847e9b15b0f512f7ae01de0b98cf739/mnamer/providers.py#L25-L30
yzhao062/pyod
13b0cd5f50d5ea5c5321da88c46232ae6f24dff7
pyod/models/abod.py
python
ABOD._fit_default
(self)
return self
Default ABOD method. Use all training points with high complexity O(n^3). For internal use only.
Default ABOD method. Use all training points with high complexity O(n^3). For internal use only.
[ "Default", "ABOD", "method", ".", "Use", "all", "training", "points", "with", "high", "complexity", "O", "(", "n^3", ")", ".", "For", "internal", "use", "only", "." ]
def _fit_default(self): """Default ABOD method. Use all training points with high complexity O(n^3). For internal use only. """ for i in range(self.n_train_): curr_pt = self.X_train_[i, :] # get the index pairs of the neighbors, remove itself from index ...
[ "def", "_fit_default", "(", "self", ")", ":", "for", "i", "in", "range", "(", "self", ".", "n_train_", ")", ":", "curr_pt", "=", "self", ".", "X_train_", "[", "i", ",", ":", "]", "# get the index pairs of the neighbors, remove itself from index", "X_ind", "=",...
https://github.com/yzhao062/pyod/blob/13b0cd5f50d5ea5c5321da88c46232ae6f24dff7/pyod/models/abod.py#L182-L196
daoluan/decode-Django
d46a858b45b56de48b0355f50dd9e45402d04cfd
Django-1.5.1/django/contrib/auth/forms.py
python
AuthenticationForm.__init__
(self, request=None, *args, **kwargs)
If request is passed in, the form will validate that cookies are enabled. Note that the request (a HttpRequest object) must have set a cookie with the key TEST_COOKIE_NAME and value TEST_COOKIE_VALUE before running this validation.
If request is passed in, the form will validate that cookies are enabled. Note that the request (a HttpRequest object) must have set a cookie with the key TEST_COOKIE_NAME and value TEST_COOKIE_VALUE before running this validation.
[ "If", "request", "is", "passed", "in", "the", "form", "will", "validate", "that", "cookies", "are", "enabled", ".", "Note", "that", "the", "request", "(", "a", "HttpRequest", "object", ")", "must", "have", "set", "a", "cookie", "with", "the", "key", "TES...
def __init__(self, request=None, *args, **kwargs): """ If request is passed in, the form will validate that cookies are enabled. Note that the request (a HttpRequest object) must have set a cookie with the key TEST_COOKIE_NAME and value TEST_COOKIE_VALUE before running this valid...
[ "def", "__init__", "(", "self", ",", "request", "=", "None", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "self", ".", "request", "=", "request", "self", ".", "user_cache", "=", "None", "super", "(", "AuthenticationForm", ",", "self", ")", "....
https://github.com/daoluan/decode-Django/blob/d46a858b45b56de48b0355f50dd9e45402d04cfd/Django-1.5.1/django/contrib/auth/forms.py#L158-L173
huawei-noah/vega
d9f13deede7f2b584e4b1d32ffdb833856129989
vega/core/search_space/forbidden.py
python
ForbiddenAndConjunction.__new__
(cls, forbidden_list)
return object.__new__(cls)
Build new class.
Build new class.
[ "Build", "new", "class", "." ]
def __new__(cls, forbidden_list): """Build new class.""" if not isinstance(forbidden_list, list): raise ValueError('Invalid forbidden_list type {}, should be List type.'.format(type(forbidden_list))) for forbidden in forbidden_list: if not isinstance(forbidden, ForbiddenE...
[ "def", "__new__", "(", "cls", ",", "forbidden_list", ")", ":", "if", "not", "isinstance", "(", "forbidden_list", ",", "list", ")", ":", "raise", "ValueError", "(", "'Invalid forbidden_list type {}, should be List type.'", ".", "format", "(", "type", "(", "forbidde...
https://github.com/huawei-noah/vega/blob/d9f13deede7f2b584e4b1d32ffdb833856129989/vega/core/search_space/forbidden.py#L52-L61
algorhythms/HackerRankAlgorithms
439bf2e31fd395d19d40f79e969153e50e5358b5
Knapsack.py
python
Solution.solve
(self, cipher)
return f[n][k]
repeatable knapsack, dp f[i][c] represents the max possible value at the index i given the capacity c normally: f[i][c] = max{f[i-1][c], f[i-1][c-w_i]+v_i} since repeatable: f[i][c] = max{f[i-1][c], f[i-1][c-w_i]+v_i, f[i][c-w_i]+v_i} since f[i][c] represent the max poss...
repeatable knapsack, dp
[ "repeatable", "knapsack", "dp" ]
def solve(self, cipher): """ repeatable knapsack, dp f[i][c] represents the max possible value at the index i given the capacity c normally: f[i][c] = max{f[i-1][c], f[i-1][c-w_i]+v_i} since repeatable: f[i][c] = max{f[i-1][c], f[i-1][c-w_i]+v_i, f[i][c-w_i]+v_i}...
[ "def", "solve", "(", "self", ",", "cipher", ")", ":", "n", ",", "k", ",", "A", "=", "cipher", "f", "=", "[", "[", "0", "for", "_", "in", "xrange", "(", "k", "+", "1", ")", "]", "for", "_", "in", "xrange", "(", "n", "+", "1", ")", "]", "...
https://github.com/algorhythms/HackerRankAlgorithms/blob/439bf2e31fd395d19d40f79e969153e50e5358b5/Knapsack.py#L23-L45
pwnieexpress/pwn_plug_sources
1a23324f5dc2c3de20f9c810269b6a29b2758cad
src/set/src/core/digitalsig/disitool.py
python
DeleteDigitalSignature
(SignedFile, UnsignedFile=None)
return new_file_data
Deletes the digital signature from file SignedFile When UnsignedFile is not None, writes the modified file to UnsignedFile Returns the modified file as a PE file
Deletes the digital signature from file SignedFile When UnsignedFile is not None, writes the modified file to UnsignedFile Returns the modified file as a PE file
[ "Deletes", "the", "digital", "signature", "from", "file", "SignedFile", "When", "UnsignedFile", "is", "not", "None", "writes", "the", "modified", "file", "to", "UnsignedFile", "Returns", "the", "modified", "file", "as", "a", "PE", "file" ]
def DeleteDigitalSignature(SignedFile, UnsignedFile=None): """Deletes the digital signature from file SignedFile When UnsignedFile is not None, writes the modified file to UnsignedFile Returns the modified file as a PE file """ pe = pefile.PE(SignedFile) address = pe.OPTIONAL_HEADER.DATA...
[ "def", "DeleteDigitalSignature", "(", "SignedFile", ",", "UnsignedFile", "=", "None", ")", ":", "pe", "=", "pefile", ".", "PE", "(", "SignedFile", ")", "address", "=", "pe", ".", "OPTIONAL_HEADER", ".", "DATA_DIRECTORY", "[", "pefile", ".", "DIRECTORY_ENTRY", ...
https://github.com/pwnieexpress/pwn_plug_sources/blob/1a23324f5dc2c3de20f9c810269b6a29b2758cad/src/set/src/core/digitalsig/disitool.py#L49-L70
aimagelab/meshed-memory-transformer
e0fe3fae68091970407e82e5b907cbc423f25df2
evaluation/bleu/bleu_scorer.py
python
BleuScorer.score_ratio_str
(self, option=None)
return "%.4f (%.2f)" % self.score_ratio(option)
[]
def score_ratio_str(self, option=None): return "%.4f (%.2f)" % self.score_ratio(option)
[ "def", "score_ratio_str", "(", "self", ",", "option", "=", "None", ")", ":", "return", "\"%.4f (%.2f)\"", "%", "self", ".", "score_ratio", "(", "option", ")" ]
https://github.com/aimagelab/meshed-memory-transformer/blob/e0fe3fae68091970407e82e5b907cbc423f25df2/evaluation/bleu/bleu_scorer.py#L139-L140
ltworf/typedload
a115d7ca1c354a03b392607b60de84ce91d5e106
typedload/typechecks.py
python
is_any
(type_: Type[Any])
return type_ == Any
Check if it is a typing.Any
Check if it is a typing.Any
[ "Check", "if", "it", "is", "a", "typing", ".", "Any" ]
def is_any(type_: Type[Any]) -> bool: ''' Check if it is a typing.Any ''' return type_ == Any
[ "def", "is_any", "(", "type_", ":", "Type", "[", "Any", "]", ")", "->", "bool", ":", "return", "type_", "==", "Any" ]
https://github.com/ltworf/typedload/blob/a115d7ca1c354a03b392607b60de84ce91d5e106/typedload/typechecks.py#L240-L244
p2pool/p2pool
53c438bbada06b9d4a9a465bc13f7694a7a322b7
wstools/logging.py
python
sendUDP
(url, outputStr)
[]
def sendUDP(url, outputStr): from socket import socket, AF_INET, SOCK_DGRAM idx1 = url.find('://') + 3; idx2 = url.find('/', idx1) if idx2 < idx1: idx2 = len(url) netloc = url[idx1:idx2] host,port = (netloc.split(':')+[80])[0:2] socket(AF_INET, SOCK_DGRAM).sendto( outputStr, (host,int(port)), )
[ "def", "sendUDP", "(", "url", ",", "outputStr", ")", ":", "from", "socket", "import", "socket", ",", "AF_INET", ",", "SOCK_DGRAM", "idx1", "=", "url", ".", "find", "(", "'://'", ")", "+", "3", "idx2", "=", "url", ".", "find", "(", "'/'", ",", "idx1...
https://github.com/p2pool/p2pool/blob/53c438bbada06b9d4a9a465bc13f7694a7a322b7/wstools/logging.py#L212-L218
google-research/torchsde
53038a3efcd77f6c9f3cfd0310700a59be5d5d2d
torchsde/_core/adjoint_sde.py
python
AdjointSDE.get_state
(self, t, y_aug, v=None, extra_states=False)
return y, adj_y, extra_states, requires_grad
Unpacks y_aug, whilst enforcing the necessary checks so that we can calculate derivatives wrt state.
Unpacks y_aug, whilst enforcing the necessary checks so that we can calculate derivatives wrt state.
[ "Unpacks", "y_aug", "whilst", "enforcing", "the", "necessary", "checks", "so", "that", "we", "can", "calculate", "derivatives", "wrt", "state", "." ]
def get_state(self, t, y_aug, v=None, extra_states=False): """Unpacks y_aug, whilst enforcing the necessary checks so that we can calculate derivatives wrt state.""" # These leaf checks are very important. # get_state is used where we want to compute: # ``` # with torch.enable_g...
[ "def", "get_state", "(", "self", ",", "t", ",", "y_aug", ",", "v", "=", "None", ",", "extra_states", "=", "False", ")", ":", "# These leaf checks are very important.", "# get_state is used where we want to compute:", "# ```", "# with torch.enable_grad():", "# s = some...
https://github.com/google-research/torchsde/blob/53038a3efcd77f6c9f3cfd0310700a59be5d5d2d/torchsde/_core/adjoint_sde.py#L74-L109
tensorflow/lattice
784eca50cbdfedf39f183cc7d298c9fe376b69c0
tensorflow_lattice/python/cdf_layer.py
python
CDF.call
(self, inputs)
return result
Standard Keras call() method.
Standard Keras call() method.
[ "Standard", "Keras", "call", "()", "method", "." ]
def call(self, inputs): """Standard Keras call() method.""" input_dim = int(inputs.shape[-1]) # We add new axes to enable broadcasting. x = inputs[..., tf.newaxis, tf.newaxis] # Shape: (batch, input_dim, 1, 1) # --> (batch, input_dim, num_keypoints, units / factor) # --> (batch, input...
[ "def", "call", "(", "self", ",", "inputs", ")", ":", "input_dim", "=", "int", "(", "inputs", ".", "shape", "[", "-", "1", "]", ")", "# We add new axes to enable broadcasting.", "x", "=", "inputs", "[", "...", ",", "tf", ".", "newaxis", ",", "tf", ".", ...
https://github.com/tensorflow/lattice/blob/784eca50cbdfedf39f183cc7d298c9fe376b69c0/tensorflow_lattice/python/cdf_layer.py#L197-L236
zhl2008/awd-platform
0416b31abea29743387b10b3914581fbe8e7da5e
web_flaskbb/lib/python2.7/site-packages/dateutil/tz/tz.py
python
_ttinfo.__eq__
(self, other)
return (self.offset == other.offset and self.delta == other.delta and self.isdst == other.isdst and self.abbr == other.abbr and self.isstd == other.isstd and self.isgmt == other.isgmt and self.dstoffset == other.dstoffset)
[]
def __eq__(self, other): if not isinstance(other, _ttinfo): return NotImplemented return (self.offset == other.offset and self.delta == other.delta and self.isdst == other.isdst and self.abbr == other.abbr and self.isstd == oth...
[ "def", "__eq__", "(", "self", ",", "other", ")", ":", "if", "not", "isinstance", "(", "other", ",", "_ttinfo", ")", ":", "return", "NotImplemented", "return", "(", "self", ".", "offset", "==", "other", ".", "offset", "and", "self", ".", "delta", "==", ...
https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_flaskbb/lib/python2.7/site-packages/dateutil/tz/tz.py#L332-L342
holzschu/Carnets
44effb10ddfc6aa5c8b0687582a724ba82c6b547
Library/lib/python3.7/site-packages/docutils/utils/smartquotes.py
python
educateDashes
(text)
return text
Parameter: String (unicode or bytes). Returns: The `text`, with each instance of "--" translated to an em-dash character.
Parameter: String (unicode or bytes). Returns: The `text`, with each instance of "--" translated to an em-dash character.
[ "Parameter", ":", "String", "(", "unicode", "or", "bytes", ")", ".", "Returns", ":", "The", "text", "with", "each", "instance", "of", "--", "translated", "to", "an", "em", "-", "dash", "character", "." ]
def educateDashes(text): """ Parameter: String (unicode or bytes). Returns: The `text`, with each instance of "--" translated to an em-dash character. """ text = re.sub(r"""---""", smartchars.endash, text) # en (yes, backwards) text = re.sub(r"""--""", smartchars.emdash, te...
[ "def", "educateDashes", "(", "text", ")", ":", "text", "=", "re", ".", "sub", "(", "r\"\"\"---\"\"\"", ",", "smartchars", ".", "endash", ",", "text", ")", "# en (yes, backwards)", "text", "=", "re", ".", "sub", "(", "r\"\"\"--\"\"\"", ",", "smartchars", "...
https://github.com/holzschu/Carnets/blob/44effb10ddfc6aa5c8b0687582a724ba82c6b547/Library/lib/python3.7/site-packages/docutils/utils/smartquotes.py#L767-L776
reviewboard/reviewboard
7395902e4c181bcd1d633f61105012ffb1d18e1b
reviewboard/webapi/resources/hosting_service_account.py
python
HostingServiceAccountResource.create
(self, request, username, service_id, password=None, hosting_url=None, local_site_name=None, *args, **kwargs)
return 201, { self.item_result_key: account, }
Creates a hosting service account. The ``service_id`` is a registered HostingService ID. This must be known beforehand, and can be looked up in the Review Board administration UI.
Creates a hosting service account.
[ "Creates", "a", "hosting", "service", "account", "." ]
def create(self, request, username, service_id, password=None, hosting_url=None, local_site_name=None, *args, **kwargs): """Creates a hosting service account. The ``service_id`` is a registered HostingService ID. This must be known beforehand, and can be looked up in the Review B...
[ "def", "create", "(", "self", ",", "request", ",", "username", ",", "service_id", ",", "password", "=", "None", ",", "hosting_url", "=", "None", ",", "local_site_name", "=", "None", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "local_site", "="...
https://github.com/reviewboard/reviewboard/blob/7395902e4c181bcd1d633f61105012ffb1d18e1b/reviewboard/webapi/resources/hosting_service_account.py#L166-L216
ajinabraham/OWASP-Xenotix-XSS-Exploit-Framework
cb692f527e4e819b6c228187c5702d990a180043
bin/x86/Debug/scripting_engine/Lib/warnings.py
python
catch_warnings.__init__
(self, record=False, module=None)
Specify whether to record warnings and if an alternative module should be used other than sys.modules['warnings']. For compatibility with Python 3.0, please consider all arguments to be keyword-only.
Specify whether to record warnings and if an alternative module should be used other than sys.modules['warnings'].
[ "Specify", "whether", "to", "record", "warnings", "and", "if", "an", "alternative", "module", "should", "be", "used", "other", "than", "sys", ".", "modules", "[", "warnings", "]", "." ]
def __init__(self, record=False, module=None): """Specify whether to record warnings and if an alternative module should be used other than sys.modules['warnings']. For compatibility with Python 3.0, please consider all arguments to be keyword-only. """ self._record = r...
[ "def", "__init__", "(", "self", ",", "record", "=", "False", ",", "module", "=", "None", ")", ":", "self", ".", "_record", "=", "record", "self", ".", "_module", "=", "sys", ".", "modules", "[", "'warnings'", "]", "if", "module", "is", "None", "else"...
https://github.com/ajinabraham/OWASP-Xenotix-XSS-Exploit-Framework/blob/cb692f527e4e819b6c228187c5702d990a180043/bin/x86/Debug/scripting_engine/Lib/warnings.py#L318-L328
omergertel/pyformance
b71056eaf9af6cafd3e3c4a416412ae425bdc82e
pyformance/reporters/syslog_reporter.py
python
SysLogReporter.__init__
( self, registry=None, reporting_interval=5, tag="pyformance", clock=None, address=DEFAULT_SYSLOG_ADDRESS, socktype=DEFAULT_SYSLOG_SOCKTYPE, facility=DEFAULT_SYSLOG_FACILITY, )
[]
def __init__( self, registry=None, reporting_interval=5, tag="pyformance", clock=None, address=DEFAULT_SYSLOG_ADDRESS, socktype=DEFAULT_SYSLOG_SOCKTYPE, facility=DEFAULT_SYSLOG_FACILITY, ): super(SysLogReporter, self).__init__(registry, reporti...
[ "def", "__init__", "(", "self", ",", "registry", "=", "None", ",", "reporting_interval", "=", "5", ",", "tag", "=", "\"pyformance\"", ",", "clock", "=", "None", ",", "address", "=", "DEFAULT_SYSLOG_ADDRESS", ",", "socktype", "=", "DEFAULT_SYSLOG_SOCKTYPE", ","...
https://github.com/omergertel/pyformance/blob/b71056eaf9af6cafd3e3c4a416412ae425bdc82e/pyformance/reporters/syslog_reporter.py#L22-L49
oracle/oci-python-sdk
3c1604e4e212008fb6718e2f68cdb5ef71fd5793
src/oci/service_catalog/service_catalog_client.py
python
ServiceCatalogClient.get_private_application
(self, private_application_id, **kwargs)
Gets the details of the specified private application. :param str private_application_id: (required) The unique identifier for the private application. :param str opc_request_id: (optional) Unique Oracle-assigned identifier for the request. If you need to contact Oracle about ...
Gets the details of the specified private application.
[ "Gets", "the", "details", "of", "the", "specified", "private", "application", "." ]
def get_private_application(self, private_application_id, **kwargs): """ Gets the details of the specified private application. :param str private_application_id: (required) The unique identifier for the private application. :param str opc_request_id: (optional) ...
[ "def", "get_private_application", "(", "self", ",", "private_application_id", ",", "*", "*", "kwargs", ")", ":", "resource_path", "=", "\"/privateApplications/{privateApplicationId}\"", "method", "=", "\"GET\"", "# Don't accept unknown kwargs", "expected_kwargs", "=", "[", ...
https://github.com/oracle/oci-python-sdk/blob/3c1604e4e212008fb6718e2f68cdb5ef71fd5793/src/oci/service_catalog/service_catalog_client.py#L863-L941
alteryx/featuretools
d59e11082962f163540fd6e185901f65c506326a
featuretools/utils/koalas_utils.py
python
replace_categorical_columns
(pdf)
return new_df
[]
def replace_categorical_columns(pdf): new_df = pd.DataFrame() for c in pdf.columns: col = pdf[c] if col.dtype.name == 'category': new_df[c] = col.astype('string') else: new_df[c] = pdf[c] return new_df
[ "def", "replace_categorical_columns", "(", "pdf", ")", ":", "new_df", "=", "pd", ".", "DataFrame", "(", ")", "for", "c", "in", "pdf", ".", "columns", ":", "col", "=", "pdf", "[", "c", "]", "if", "col", ".", "dtype", ".", "name", "==", "'category'", ...
https://github.com/alteryx/featuretools/blob/d59e11082962f163540fd6e185901f65c506326a/featuretools/utils/koalas_utils.py#L25-L33
okpy/ok
50a00190f05363d096478dd8e53aa1a36dd40c4a
server/models.py
python
Version.save
(self)
[]
def save(self): cache.delete_memoized(Version.get_current_versions, self.name) cache.delete_memoized(Version.get_current_versions, None) db.session.add(self) db.session.commit()
[ "def", "save", "(", "self", ")", ":", "cache", ".", "delete_memoized", "(", "Version", ".", "get_current_versions", ",", "self", ".", "name", ")", "cache", ".", "delete_memoized", "(", "Version", ".", "get_current_versions", ",", "None", ")", "db", ".", "s...
https://github.com/okpy/ok/blob/50a00190f05363d096478dd8e53aa1a36dd40c4a/server/models.py#L1392-L1396
japerk/nltk-trainer
1d48784a6e7558641ed40875d426fe376d41e11c
nltk_trainer/featx/phonetics.py
python
caverphone
(term)
return caverphoneCode
returns the language key using the caverphone algorithm 2.0
returns the language key using the caverphone algorithm 2.0
[ "returns", "the", "language", "key", "using", "the", "caverphone", "algorithm", "2", ".", "0" ]
def caverphone (term): "returns the language key using the caverphone algorithm 2.0" # Developed at the University of Otago, New Zealand. # Project: Caversham Project (http://caversham.otago.ac.nz) # Developer: David Hood, University of Otago, New Zealand # Contact: caversham@otago.ac.nz # Project Technical Pape...
[ "def", "caverphone", "(", "term", ")", ":", "# Developed at the University of Otago, New Zealand.", "# Project: Caversham Project (http://caversham.otago.ac.nz)", "# Developer: David Hood, University of Otago, New Zealand", "# Contact: caversham@otago.ac.nz", "# Project Technical Paper: http://c...
https://github.com/japerk/nltk-trainer/blob/1d48784a6e7558641ed40875d426fe376d41e11c/nltk_trainer/featx/phonetics.py#L441-L597
materialsproject/fireworks
83a907c19baf2a5c9fdcf63996f9797c3c85b785
fireworks/core/launchpad.py
python
LazyFirework.__init__
(self, fw_id, fw_coll, launch_coll, fallback_fs)
Args: fw_id (int): firework id fw_coll (pymongo.collection): fireworks collection launch_coll (pymongo.collection): launches collection
Args: fw_id (int): firework id fw_coll (pymongo.collection): fireworks collection launch_coll (pymongo.collection): launches collection
[ "Args", ":", "fw_id", "(", "int", ")", ":", "firework", "id", "fw_coll", "(", "pymongo", ".", "collection", ")", ":", "fireworks", "collection", "launch_coll", "(", "pymongo", ".", "collection", ")", ":", "launches", "collection" ]
def __init__(self, fw_id, fw_coll, launch_coll, fallback_fs): """ Args: fw_id (int): firework id fw_coll (pymongo.collection): fireworks collection launch_coll (pymongo.collection): launches collection """ # This is the only attribute known w/o a DB qu...
[ "def", "__init__", "(", "self", ",", "fw_id", ",", "fw_coll", ",", "launch_coll", ",", "fallback_fs", ")", ":", "# This is the only attribute known w/o a DB query", "self", ".", "fw_id", "=", "fw_id", "self", ".", "_fwc", ",", "self", ".", "_lc", ",", "self", ...
https://github.com/materialsproject/fireworks/blob/83a907c19baf2a5c9fdcf63996f9797c3c85b785/fireworks/core/launchpad.py#L2044-L2055
open-mmlab/mmclassification
5232965b17b6c050f9b328b3740c631ed4034624
mmcls/core/evaluation/eval_metrics.py
python
f1_score
(pred, target, average_mode='macro', thrs=0.)
return f1_scores
Calculate F1 score according to the prediction and target. Args: pred (torch.Tensor | np.array): The model prediction with shape (N, C). target (torch.Tensor | np.array): The target of each prediction with shape (N, 1) or (N,). average_mode (str): The type of averaging performed...
Calculate F1 score according to the prediction and target.
[ "Calculate", "F1", "score", "according", "to", "the", "prediction", "and", "target", "." ]
def f1_score(pred, target, average_mode='macro', thrs=0.): """Calculate F1 score according to the prediction and target. Args: pred (torch.Tensor | np.array): The model prediction with shape (N, C). target (torch.Tensor | np.array): The target of each prediction with shape (N, 1) or...
[ "def", "f1_score", "(", "pred", ",", "target", ",", "average_mode", "=", "'macro'", ",", "thrs", "=", "0.", ")", ":", "_", ",", "_", ",", "f1_scores", "=", "precision_recall_f1", "(", "pred", ",", "target", ",", "average_mode", ",", "thrs", ")", "retur...
https://github.com/open-mmlab/mmclassification/blob/5232965b17b6c050f9b328b3740c631ed4034624/mmcls/core/evaluation/eval_metrics.py#L198-L225
openedx/edx-platform
68dd185a0ab45862a2a61e0f803d7e03d2be71b5
openedx/features/enterprise_support/signals.py
python
handle_enterprise_learner_passing_grade
(sender, user, course_id, **kwargs)
Listen for a learner passing a course, transmit data to relevant integrated channel
Listen for a learner passing a course, transmit data to relevant integrated channel
[ "Listen", "for", "a", "learner", "passing", "a", "course", "transmit", "data", "to", "relevant", "integrated", "channel" ]
def handle_enterprise_learner_passing_grade(sender, user, course_id, **kwargs): # pylint: disable=unused-argument """ Listen for a learner passing a course, transmit data to relevant integrated channel """ if is_enterprise_learner(user): kwargs = { 'username': str(user.username), ...
[ "def", "handle_enterprise_learner_passing_grade", "(", "sender", ",", "user", ",", "course_id", ",", "*", "*", "kwargs", ")", ":", "# pylint: disable=unused-argument", "if", "is_enterprise_learner", "(", "user", ")", ":", "kwargs", "=", "{", "'username'", ":", "st...
https://github.com/openedx/edx-platform/blob/68dd185a0ab45862a2a61e0f803d7e03d2be71b5/openedx/features/enterprise_support/signals.py#L60-L70
huggingface/transformers
623b4f7c63f60cce917677ee704d6c93ee960b4b
examples/research_projects/quantization-qdqbert/quant_trainer.py
python
finish_calibration
(model, args)
Disable calibration and load amax for all "*_input_quantizer modules in model.
Disable calibration and load amax for all "*_input_quantizer modules in model.
[ "Disable", "calibration", "and", "load", "amax", "for", "all", "*", "_input_quantizer", "modules", "in", "model", "." ]
def finish_calibration(model, args): """Disable calibration and load amax for all "*_input_quantizer modules in model.""" logger.info("Loading calibrated amax") for name, module in model.named_modules(): if name.endswith("_quantizer"): if module._calibrator is not None: ...
[ "def", "finish_calibration", "(", "model", ",", "args", ")", ":", "logger", ".", "info", "(", "\"Loading calibrated amax\"", ")", "for", "name", ",", "module", "in", "model", ".", "named_modules", "(", ")", ":", "if", "name", ".", "endswith", "(", "\"_quan...
https://github.com/huggingface/transformers/blob/623b4f7c63f60cce917677ee704d6c93ee960b4b/examples/research_projects/quantization-qdqbert/quant_trainer.py#L128-L144
linxid/Machine_Learning_Study_Path
558e82d13237114bbb8152483977806fc0c222af
Machine Learning In Action/Chapter4-NaiveBayes/venv/Lib/site-packages/pip/_vendor/cachecontrol/caches/file_cache.py
python
FileCache.delete
(self, key)
[]
def delete(self, key): name = self._fn(key) if not self.forever: os.remove(name)
[ "def", "delete", "(", "self", ",", "key", ")", ":", "name", "=", "self", ".", "_fn", "(", "key", ")", "if", "not", "self", ".", "forever", ":", "os", ".", "remove", "(", "name", ")" ]
https://github.com/linxid/Machine_Learning_Study_Path/blob/558e82d13237114bbb8152483977806fc0c222af/Machine Learning In Action/Chapter4-NaiveBayes/venv/Lib/site-packages/pip/_vendor/cachecontrol/caches/file_cache.py#L104-L107
mathics/Mathics
318e06dea8f1c70758a50cb2f95c9900150e3a68
mathics/core/util.py
python
subsets_2
(items, min, max, without_duplicates=True)
max may only be 1 or None (= infinity). Respects include property of items
max may only be 1 or None (= infinity). Respects include property of items
[ "max", "may", "only", "be", "1", "or", "None", "(", "=", "infinity", ")", ".", "Respects", "include", "property", "of", "items" ]
def subsets_2(items, min, max, without_duplicates=True): """max may only be 1 or None (= infinity). Respects include property of items """ if min <= max == 1: for index in range(len(items)): if items[index].include: yield [items[index]], ([], items[:index] + items[in...
[ "def", "subsets_2", "(", "items", ",", "min", ",", "max", ",", "without_duplicates", "=", "True", ")", ":", "if", "min", "<=", "max", "==", "1", ":", "for", "index", "in", "range", "(", "len", "(", "items", ")", ")", ":", "if", "items", "[", "ind...
https://github.com/mathics/Mathics/blob/318e06dea8f1c70758a50cb2f95c9900150e3a68/mathics/core/util.py#L125-L169
mars-project/mars
6afd7ed86db77f29cc9470485698ef192ecc6d33
mars/dataframe/indexing/at.py
python
at
(a)
return DataFrameAt(a)
Access a single value for a row/column label pair. Similar to ``loc``, in that both provide label-based lookups. Use ``at`` if you only need to get or set a single value in a DataFrame or Series. Raises ------ KeyError If 'label' does not exist in DataFrame. See Also -------- ...
Access a single value for a row/column label pair.
[ "Access", "a", "single", "value", "for", "a", "row", "/", "column", "label", "pair", "." ]
def at(a): """ Access a single value for a row/column label pair. Similar to ``loc``, in that both provide label-based lookups. Use ``at`` if you only need to get or set a single value in a DataFrame or Series. Raises ------ KeyError If 'label' does not exist in DataFrame. ...
[ "def", "at", "(", "a", ")", ":", "return", "DataFrameAt", "(", "a", ")" ]
https://github.com/mars-project/mars/blob/6afd7ed86db77f29cc9470485698ef192ecc6d33/mars/dataframe/indexing/at.py#L36-L83
w-digital-scanner/w9scan
aa725571897f095635c4b7660db5ce90c655946c
w9scan.py
python
modulePath
()
return getUnicode(os.path.dirname(os.path.realpath(_)), encoding=sys.getfilesystemencoding())
This will get us the program's directory, even if we are frozen using py2exe
This will get us the program's directory, even if we are frozen using py2exe
[ "This", "will", "get", "us", "the", "program", "s", "directory", "even", "if", "we", "are", "frozen", "using", "py2exe" ]
def modulePath(): """ This will get us the program's directory, even if we are frozen using py2exe """ try: _ = sys.executable if weAreFrozen() else __file__ except NameError: _ = inspect.getsourcefile(modulePath) return getUnicode(os.path.dirname(os.path.realpath(_)), enco...
[ "def", "modulePath", "(", ")", ":", "try", ":", "_", "=", "sys", ".", "executable", "if", "weAreFrozen", "(", ")", "else", "__file__", "except", "NameError", ":", "_", "=", "inspect", ".", "getsourcefile", "(", "modulePath", ")", "return", "getUnicode", ...
https://github.com/w-digital-scanner/w9scan/blob/aa725571897f095635c4b7660db5ce90c655946c/w9scan.py#L33-L44
home-assistant/core
265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1
homeassistant/components/smappee/switch.py
python
SmappeeActuator.turn_on
(self, **kwargs)
Turn on Comport Plug.
Turn on Comport Plug.
[ "Turn", "on", "Comport", "Plug", "." ]
def turn_on(self, **kwargs): """Turn on Comport Plug.""" if self._actuator_type in ("SWITCH", "COMFORT_PLUG"): self._service_location.set_actuator_state(self._actuator_id, state="ON_ON") elif self._actuator_type == "INFINITY_OUTPUT_MODULE": self._service_location.set_actu...
[ "def", "turn_on", "(", "self", ",", "*", "*", "kwargs", ")", ":", "if", "self", ".", "_actuator_type", "in", "(", "\"SWITCH\"", ",", "\"COMFORT_PLUG\"", ")", ":", "self", ".", "_service_location", ".", "set_actuator_state", "(", "self", ".", "_actuator_id", ...
https://github.com/home-assistant/core/blob/265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1/homeassistant/components/smappee/switch.py#L111-L118
py2neo-org/py2neo
2e46bbf4d622f53282e796ffc521fc4bc6d0b60d
py2neo/ogm/__init__.py
python
RelatedObjects.add
(self, obj, properties=None, **kwproperties)
return 1
Add or update a related object. This method returns the number of new related objects that were added: 0 if an existing object was updated, or 1 if a new object was added. :param obj: :py:class:`.Model` to relate. :param properties: Dictionary of propert...
Add or update a related object.
[ "Add", "or", "update", "a", "related", "object", "." ]
def add(self, obj, properties=None, **kwproperties): """ Add or update a related object. This method returns the number of new related objects that were added: 0 if an existing object was updated, or 1 if a new object was added. :param obj: :py:class:`.Model` to rel...
[ "def", "add", "(", "self", ",", "obj", ",", "properties", "=", "None", ",", "*", "*", "kwproperties", ")", ":", "if", "not", "isinstance", "(", "obj", ",", "Model", ")", ":", "raise", "TypeError", "(", "\"Related objects must be Model instances\"", ")", "r...
https://github.com/py2neo-org/py2neo/blob/2e46bbf4d622f53282e796ffc521fc4bc6d0b60d/py2neo/ogm/__init__.py#L251-L277
TensorMSA/tensormsa
c36b565159cd934533636429add3c7d7263d622b
cluster/preprocess/pre_node_feed_img2cnn.py
python
PreNodeFeedImg2Cnn.run
(self, conf_data)
override init class
override init class
[ "override", "init", "class" ]
def run(self, conf_data): """ override init class """ super(PreNodeFeedImg2Cnn, self).run(conf_data) self._init_node_parm(conf_data['node_id'])
[ "def", "run", "(", "self", ",", "conf_data", ")", ":", "super", "(", "PreNodeFeedImg2Cnn", ",", "self", ")", ".", "run", "(", "conf_data", ")", "self", ".", "_init_node_parm", "(", "conf_data", "[", "'node_id'", "]", ")" ]
https://github.com/TensorMSA/tensormsa/blob/c36b565159cd934533636429add3c7d7263d622b/cluster/preprocess/pre_node_feed_img2cnn.py#L9-L14
aws-cloudformation/cfn-lint
16df5d0ca0d8ebcf9330ebea701e83d883b47217
src/cfnlint/rules/resources/events/RuleTargetsLimit.py
python
RuleTargetsLimit.match_resource_properties
(self, properties, _, path, cfn)
return matches
Check CloudFormation Properties
Check CloudFormation Properties
[ "Check", "CloudFormation", "Properties" ]
def match_resource_properties(self, properties, _, path, cfn): """Check CloudFormation Properties""" matches = [] matches.extend( cfn.check_value( obj=properties, key='Targets', path=path[:], check_value=self.check_value )) ...
[ "def", "match_resource_properties", "(", "self", ",", "properties", ",", "_", ",", "path", ",", "cfn", ")", ":", "matches", "=", "[", "]", "matches", ".", "extend", "(", "cfn", ".", "check_value", "(", "obj", "=", "properties", ",", "key", "=", "'Targe...
https://github.com/aws-cloudformation/cfn-lint/blob/16df5d0ca0d8ebcf9330ebea701e83d883b47217/src/cfnlint/rules/resources/events/RuleTargetsLimit.py#L45-L60
stanfordmlgroup/nlc
af40dc1451cd9fe9d58e947ca6093d0530794fad
nlc_data.py
python
maybe_download
(directory, filename, url)
return filepath
Download filename from url unless it's already in directory.
Download filename from url unless it's already in directory.
[ "Download", "filename", "from", "url", "unless", "it", "s", "already", "in", "directory", "." ]
def maybe_download(directory, filename, url): """Download filename from url unless it's already in directory.""" if not os.path.exists(directory): print("Creating directory %s" % directory) os.mkdir(directory) filepath = os.path.join(directory, filename) if not os.path.exists(filepath): print("Downl...
[ "def", "maybe_download", "(", "directory", ",", "filename", ",", "url", ")", ":", "if", "not", "os", ".", "path", ".", "exists", "(", "directory", ")", ":", "print", "(", "\"Creating directory %s\"", "%", "directory", ")", "os", ".", "mkdir", "(", "direc...
https://github.com/stanfordmlgroup/nlc/blob/af40dc1451cd9fe9d58e947ca6093d0530794fad/nlc_data.py#L51-L62
chaoss/grimoirelab-perceval
ba19bfd5e40bffdd422ca8e68526326b47f97491
perceval/backends/core/pagure.py
python
PagureClient.__get_url_namespace_repository
(self)
return urijoin(self.base_url, self.namespace, self.repository)
Build URL for a repository within a namespace
Build URL for a repository within a namespace
[ "Build", "URL", "for", "a", "repository", "within", "a", "namespace" ]
def __get_url_namespace_repository(self): """Build URL for a repository within a namespace""" return urijoin(self.base_url, self.namespace, self.repository)
[ "def", "__get_url_namespace_repository", "(", "self", ")", ":", "return", "urijoin", "(", "self", ".", "base_url", ",", "self", ".", "namespace", ",", "self", ".", "repository", ")" ]
https://github.com/chaoss/grimoirelab-perceval/blob/ba19bfd5e40bffdd422ca8e68526326b47f97491/perceval/backends/core/pagure.py#L380-L383
wbond/asn1crypto
9ae350f212532dfee7f185f6b3eda24753249cf3
asn1crypto/core.py
python
AbstractString._copy
(self, other, copy_func)
Copies the contents of another AbstractString object to itself :param object: Another instance of the same class :param copy_func: An reference of copy.copy() or copy.deepcopy() to use when copying lists, dicts and objects
Copies the contents of another AbstractString object to itself
[ "Copies", "the", "contents", "of", "another", "AbstractString", "object", "to", "itself" ]
def _copy(self, other, copy_func): """ Copies the contents of another AbstractString object to itself :param object: Another instance of the same class :param copy_func: An reference of copy.copy() or copy.deepcopy() to use when copying lists, dicts ...
[ "def", "_copy", "(", "self", ",", "other", ",", "copy_func", ")", ":", "super", "(", "AbstractString", ",", "self", ")", ".", "_copy", "(", "other", ",", "copy_func", ")", "self", ".", "_unicode", "=", "other", ".", "_unicode" ]
https://github.com/wbond/asn1crypto/blob/9ae350f212532dfee7f185f6b3eda24753249cf3/asn1crypto/core.py#L1817-L1830
lovelylain/pyctp
fd304de4b50c4ddc31a4190b1caaeb5dec66bc5d
stock/ctp/ApiStruct.py
python
MarketDataAveragePrice.__init__
(self, AveragePrice=0.0)
[]
def __init__(self, AveragePrice=0.0): self.AveragePrice = 'Price'
[ "def", "__init__", "(", "self", ",", "AveragePrice", "=", "0.0", ")", ":", "self", ".", "AveragePrice", "=", "'Price'" ]
https://github.com/lovelylain/pyctp/blob/fd304de4b50c4ddc31a4190b1caaeb5dec66bc5d/stock/ctp/ApiStruct.py#L3152-L3153
DataDog/integrations-core
934674b29d94b70ccc008f76ea172d0cdae05e1e
airflow/datadog_checks/airflow/config_models/defaults.py
python
instance_tls_ignore_warning
(field, value)
return False
[]
def instance_tls_ignore_warning(field, value): return False
[ "def", "instance_tls_ignore_warning", "(", "field", ",", "value", ")", ":", "return", "False" ]
https://github.com/DataDog/integrations-core/blob/934674b29d94b70ccc008f76ea172d0cdae05e1e/airflow/datadog_checks/airflow/config_models/defaults.py#L157-L158
googleworkspace/hangouts-chat-samples
cacaba5094864150f23d4fab1fb0c7e418ad2c80
python/card-bot/main.py
python
respond_to_interactive_card_click
(action_name, custom_params)
return { 'actionResponse': { 'type': action_response }, 'cards': [ { 'header': { 'title': BOT_HEADER, 'subtitle': 'Interactive card clicked', 'imageUrl': 'https://goo.gl/5obRKj', ...
Creates a response for when the user clicks on an interactive card. See the guide for creating interactive cards https://developers.google.com/hangouts/chat/how-tos/cards-onclick Args: action_name: the name of the custom action defined in the original bot response custom_params: the parame...
Creates a response for when the user clicks on an interactive card.
[ "Creates", "a", "response", "for", "when", "the", "user", "clicks", "on", "an", "interactive", "card", "." ]
def respond_to_interactive_card_click(action_name, custom_params): """Creates a response for when the user clicks on an interactive card. See the guide for creating interactive cards https://developers.google.com/hangouts/chat/how-tos/cards-onclick Args: action_name: the name of the custom act...
[ "def", "respond_to_interactive_card_click", "(", "action_name", ",", "custom_params", ")", ":", "message", "=", "'You clicked {}'", ".", "format", "(", "'a text button'", "if", "action_name", "==", "INTERACTIVE_TEXT_BUTTON_ACTION", "else", "'an image button'", ")", "origi...
https://github.com/googleworkspace/hangouts-chat-samples/blob/cacaba5094864150f23d4fab1fb0c7e418ad2c80/python/card-bot/main.py#L220-L279
ChineseGLUE/ChineseGLUE
1591b85cf5427c2ff60f718d359ecb71d2b44879
baselines/models_pytorch/classifier_pytorch/transformers/tokenization_bert.py
python
_is_whitespace
(char)
return False
Checks whether `chars` is a whitespace character.
Checks whether `chars` is a whitespace character.
[ "Checks", "whether", "chars", "is", "a", "whitespace", "character", "." ]
def _is_whitespace(char): """Checks whether `chars` is a whitespace character.""" # \t, \n, and \r are technically contorl characters but we treat them # as whitespace since they are generally considered as such. if char == " " or char == "\t" or char == "\n" or char == "\r": return True cat...
[ "def", "_is_whitespace", "(", "char", ")", ":", "# \\t, \\n, and \\r are technically contorl characters but we treat them", "# as whitespace since they are generally considered as such.", "if", "char", "==", "\" \"", "or", "char", "==", "\"\\t\"", "or", "char", "==", "\"\\n\"",...
https://github.com/ChineseGLUE/ChineseGLUE/blob/1591b85cf5427c2ff60f718d359ecb71d2b44879/baselines/models_pytorch/classifier_pytorch/transformers/tokenization_bert.py#L465-L474
mchristopher/PokemonGo-DesktopMap
ec37575f2776ee7d64456e2a1f6b6b78830b4fe0
app/pywin/Lib/mimetypes.py
python
MimeTypes.guess_all_extensions
(self, type, strict=True)
return extensions
Guess the extensions for a file based on its MIME type. Return value is a list of strings giving the possible filename extensions, including the leading dot ('.'). The extension is not guaranteed to have been associated with any particular data stream, but would be mapped to the MIME t...
Guess the extensions for a file based on its MIME type.
[ "Guess", "the", "extensions", "for", "a", "file", "based", "on", "its", "MIME", "type", "." ]
def guess_all_extensions(self, type, strict=True): """Guess the extensions for a file based on its MIME type. Return value is a list of strings giving the possible filename extensions, including the leading dot ('.'). The extension is not guaranteed to have been associated with any par...
[ "def", "guess_all_extensions", "(", "self", ",", "type", ",", "strict", "=", "True", ")", ":", "type", "=", "type", ".", "lower", "(", ")", "extensions", "=", "self", ".", "types_map_inv", "[", "True", "]", ".", "get", "(", "type", ",", "[", "]", "...
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/ec37575f2776ee7d64456e2a1f6b6b78830b4fe0/app/pywin/Lib/mimetypes.py#L157-L174
pyexcel-webwares/Flask-Excel
cae311b069998f5c238c0c0467348bb95e4745d4
setup.py
python
read_files
(*files)
return text
Read files into setup
Read files into setup
[ "Read", "files", "into", "setup" ]
def read_files(*files): """Read files into setup""" text = "" for single_file in files: content = read(single_file) text = text + content + "\n" return text
[ "def", "read_files", "(", "*", "files", ")", ":", "text", "=", "\"\"", "for", "single_file", "in", "files", ":", "content", "=", "read", "(", "single_file", ")", "text", "=", "text", "+", "content", "+", "\"\\n\"", "return", "text" ]
https://github.com/pyexcel-webwares/Flask-Excel/blob/cae311b069998f5c238c0c0467348bb95e4745d4/setup.py#L162-L168
IndicoDataSolutions/finetune
83ba222eed331df64b2fa7157bb64f0a2eef4a2c
finetune/util/group_metrics.py
python
attach_entities
(groups, entities)
return groups
Attaches a documents entities to the documents groups :param groups: A list of groups :param entities: A list of entities :return: A copy of the groups param with an additional "entities" key added to each group containing all entities that appear within the group
Attaches a documents entities to the documents groups
[ "Attaches", "a", "documents", "entities", "to", "the", "documents", "groups" ]
def attach_entities(groups, entities): """ Attaches a documents entities to the documents groups :param groups: A list of groups :param entities: A list of entities :return: A copy of the groups param with an additional "entities" key added to each group containing all entities that appear with...
[ "def", "attach_entities", "(", "groups", ",", "entities", ")", ":", "# Copy so we don't modify input", "groups", "=", "deepcopy", "(", "groups", ")", "for", "group", "in", "groups", ":", "group", "[", "\"entities\"", "]", "=", "[", "]", "for", "entity", "in"...
https://github.com/IndicoDataSolutions/finetune/blob/83ba222eed331df64b2fa7157bb64f0a2eef4a2c/finetune/util/group_metrics.py#L470-L486
mateuszmalinowski/visual_turing_test-tutorial
69aace8075f110a3b58175c8cc5055e46fdf7028
kraino/utils/model_visualization.py
python
model_picture
(model, to_file='local/model.png')
[]
def model_picture(model, to_file='local/model.png'): graph = pydot.Dot(graph_type='digraph') if isinstance(model,Sequential): previous_node = None written_nodes = [] n = 1 for node in model.get_config()['layers']: # append number in case layers have same name to diff...
[ "def", "model_picture", "(", "model", ",", "to_file", "=", "'local/model.png'", ")", ":", "graph", "=", "pydot", ".", "Dot", "(", "graph_type", "=", "'digraph'", ")", "if", "isinstance", "(", "model", ",", "Sequential", ")", ":", "previous_node", "=", "Non...
https://github.com/mateuszmalinowski/visual_turing_test-tutorial/blob/69aace8075f110a3b58175c8cc5055e46fdf7028/kraino/utils/model_visualization.py#L13-L48
openhatch/oh-mainline
ce29352a034e1223141dcc2f317030bbc3359a51
vendor/packages/twisted/twisted/cred/credentials.py
python
DigestedCredentials.checkHash
(self, digestHash)
return expected == response
Verify that the credentials represented by this object agree with the credentials represented by the I{H(A1)} given in C{digestHash}. @param digestHash: A precomputed H(A1) value based on the username, realm, and password associate with this credentials object.
Verify that the credentials represented by this object agree with the credentials represented by the I{H(A1)} given in C{digestHash}.
[ "Verify", "that", "the", "credentials", "represented", "by", "this", "object", "agree", "with", "the", "credentials", "represented", "by", "the", "I", "{", "H", "(", "A1", ")", "}", "given", "in", "C", "{", "digestHash", "}", "." ]
def checkHash(self, digestHash): """ Verify that the credentials represented by this object agree with the credentials represented by the I{H(A1)} given in C{digestHash}. @param digestHash: A precomputed H(A1) value based on the username, realm, and password associate with t...
[ "def", "checkHash", "(", "self", ",", "digestHash", ")", ":", "response", "=", "self", ".", "fields", ".", "get", "(", "'response'", ")", "uri", "=", "self", ".", "fields", ".", "get", "(", "'uri'", ")", "nonce", "=", "self", ".", "fields", ".", "g...
https://github.com/openhatch/oh-mainline/blob/ce29352a034e1223141dcc2f317030bbc3359a51/vendor/packages/twisted/twisted/cred/credentials.py#L147-L168
microsoft/azure-devops-python-api
451cade4c475482792cbe9e522c1fee32393139e
azure-devops/azure/devops/v5_1/service_hooks/service_hooks_client.py
python
ServiceHooksClient.list_consumer_actions
(self, consumer_id, publisher_id=None)
return self._deserialize('[ConsumerAction]', self._unwrap_collection(response))
ListConsumerActions. Get a list of consumer actions for a specific consumer. :param str consumer_id: ID for a consumer. :param str publisher_id: :rtype: [ConsumerAction]
ListConsumerActions. Get a list of consumer actions for a specific consumer. :param str consumer_id: ID for a consumer. :param str publisher_id: :rtype: [ConsumerAction]
[ "ListConsumerActions", ".", "Get", "a", "list", "of", "consumer", "actions", "for", "a", "specific", "consumer", ".", ":", "param", "str", "consumer_id", ":", "ID", "for", "a", "consumer", ".", ":", "param", "str", "publisher_id", ":", ":", "rtype", ":", ...
def list_consumer_actions(self, consumer_id, publisher_id=None): """ListConsumerActions. Get a list of consumer actions for a specific consumer. :param str consumer_id: ID for a consumer. :param str publisher_id: :rtype: [ConsumerAction] """ route_values = {} ...
[ "def", "list_consumer_actions", "(", "self", ",", "consumer_id", ",", "publisher_id", "=", "None", ")", ":", "route_values", "=", "{", "}", "if", "consumer_id", "is", "not", "None", ":", "route_values", "[", "'consumerId'", "]", "=", "self", ".", "_serialize...
https://github.com/microsoft/azure-devops-python-api/blob/451cade4c475482792cbe9e522c1fee32393139e/azure-devops/azure/devops/v5_1/service_hooks/service_hooks_client.py#L51-L69
nosmokingbandit/Watcher3
0217e75158b563bdefc8e01c3be7620008cf3977
lib/sqlalchemy/sql/elements.py
python
UnaryExpression._create_asc
(cls, column)
return UnaryExpression( _literal_as_label_reference(column), modifier=operators.asc_op, wraps_column_expression=False)
Produce an ascending ``ORDER BY`` clause element. e.g.:: from sqlalchemy import asc stmt = select([users_table]).order_by(asc(users_table.c.name)) will produce SQL as:: SELECT id, name FROM user ORDER BY name ASC The :func:`.asc` function is a standalone ...
Produce an ascending ``ORDER BY`` clause element.
[ "Produce", "an", "ascending", "ORDER", "BY", "clause", "element", "." ]
def _create_asc(cls, column): """Produce an ascending ``ORDER BY`` clause element. e.g.:: from sqlalchemy import asc stmt = select([users_table]).order_by(asc(users_table.c.name)) will produce SQL as:: SELECT id, name FROM user ORDER BY name ASC T...
[ "def", "_create_asc", "(", "cls", ",", "column", ")", ":", "return", "UnaryExpression", "(", "_literal_as_label_reference", "(", "column", ")", ",", "modifier", "=", "operators", ".", "asc_op", ",", "wraps_column_expression", "=", "False", ")" ]
https://github.com/nosmokingbandit/Watcher3/blob/0217e75158b563bdefc8e01c3be7620008cf3977/lib/sqlalchemy/sql/elements.py#L2673-L2709
dimagi/commcare-hq
d67ff1d3b4c51fa050c19e60c3253a79d3452a39
corehq/apps/reports/standard/cases/basic.py
python
CaseListMixin.shared_pagination_GET_params
(self)
return shared_params
[]
def shared_pagination_GET_params(self): shared_params = super(CaseListMixin, self).shared_pagination_GET_params shared_params.append(dict( name=SelectOpenCloseFilter.slug, value=self.request.GET.get(SelectOpenCloseFilter.slug, '') )) return shared_params
[ "def", "shared_pagination_GET_params", "(", "self", ")", ":", "shared_params", "=", "super", "(", "CaseListMixin", ",", "self", ")", ".", "shared_pagination_GET_params", "shared_params", ".", "append", "(", "dict", "(", "name", "=", "SelectOpenCloseFilter", ".", "...
https://github.com/dimagi/commcare-hq/blob/d67ff1d3b4c51fa050c19e60c3253a79d3452a39/corehq/apps/reports/standard/cases/basic.py#L133-L139
kanzure/nanoengineer
874e4c9f8a9190f093625b267f9767e19f82e6c4
cad/src/model/part.py
python
Part.ensure_toplevel_group
(self)
return
Make sure this Part's toplevel node is a Group (of a kind which does not mind having arbitrary new members added to it), by Grouping it if not. @note: most operations which create new nodes and want to add them needn't call this directly, since they can call self.addnode or ...
Make sure this Part's toplevel node is a Group (of a kind which does not mind having arbitrary new members added to it), by Grouping it if not.
[ "Make", "sure", "this", "Part", "s", "toplevel", "node", "is", "a", "Group", "(", "of", "a", "kind", "which", "does", "not", "mind", "having", "arbitrary", "new", "members", "added", "to", "it", ")", "by", "Grouping", "it", "if", "not", "." ]
def ensure_toplevel_group(self): #bruce 080318 revised so unopenables like DnaStrand don't count """ Make sure this Part's toplevel node is a Group (of a kind which does not mind having arbitrary new members added to it), by Grouping it if not. @note: most operations which crea...
[ "def", "ensure_toplevel_group", "(", "self", ")", ":", "#bruce 080318 revised so unopenables like DnaStrand don't count", "topnode", "=", "self", ".", "topnode", "assert", "topnode", "is", "not", "None", "if", "not", "topnode", ".", "is_group", "(", ")", "or", "not"...
https://github.com/kanzure/nanoengineer/blob/874e4c9f8a9190f093625b267f9767e19f82e6c4/cad/src/model/part.py#L942-L960
edisonlz/fastor
342078a18363ac41d3c6b1ab29dbdd44fdb0b7b3
base/site-packages/tencentcloud/cvm/v20170312/models.py
python
RenewInstancesResponse.__init__
(self)
:param RequestId: 唯一请求ID,每次请求都会返回。定位问题时需要提供该次请求的RequestId。 :type RequestId: str
:param RequestId: 唯一请求ID,每次请求都会返回。定位问题时需要提供该次请求的RequestId。 :type RequestId: str
[ ":", "param", "RequestId", ":", "唯一请求ID,每次请求都会返回。定位问题时需要提供该次请求的RequestId。", ":", "type", "RequestId", ":", "str" ]
def __init__(self): """ :param RequestId: 唯一请求ID,每次请求都会返回。定位问题时需要提供该次请求的RequestId。 :type RequestId: str """ self.RequestId = None
[ "def", "__init__", "(", "self", ")", ":", "self", ".", "RequestId", "=", "None" ]
https://github.com/edisonlz/fastor/blob/342078a18363ac41d3c6b1ab29dbdd44fdb0b7b3/base/site-packages/tencentcloud/cvm/v20170312/models.py#L3355-L3360
jazzband/django-analytical
8d449868da5b824c4028a5f34e9222bbbb4a0090
analytical/templatetags/olark.py
python
olark
(parser, token)
return OlarkNode()
Olark set-up template tag. Renders Javascript code to set-up Olark chat. You must supply your site ID in the ``OLARK_SITE_ID`` setting.
Olark set-up template tag.
[ "Olark", "set", "-", "up", "template", "tag", "." ]
def olark(parser, token): """ Olark set-up template tag. Renders Javascript code to set-up Olark chat. You must supply your site ID in the ``OLARK_SITE_ID`` setting. """ bits = token.split_contents() if len(bits) > 1: raise TemplateSyntaxError("'%s' takes no arguments" % bits[0]) ...
[ "def", "olark", "(", "parser", ",", "token", ")", ":", "bits", "=", "token", ".", "split_contents", "(", ")", "if", "len", "(", "bits", ")", ">", "1", ":", "raise", "TemplateSyntaxError", "(", "\"'%s' takes no arguments\"", "%", "bits", "[", "0", "]", ...
https://github.com/jazzband/django-analytical/blob/8d449868da5b824c4028a5f34e9222bbbb4a0090/analytical/templatetags/olark.py#L43-L53
cogitas3d/OrtogOnBlender
881e93f5beb2263e44c270974dd0e81deca44762
DesenhaObjetos.py
python
CriaBezierUnido.execute
(self, context)
return {'FINISHED'}
[]
def execute(self, context): CriaBezierUnidoDef(self, context) return {'FINISHED'}
[ "def", "execute", "(", "self", ",", "context", ")", ":", "CriaBezierUnidoDef", "(", "self", ",", "context", ")", "return", "{", "'FINISHED'", "}" ]
https://github.com/cogitas3d/OrtogOnBlender/blob/881e93f5beb2263e44c270974dd0e81deca44762/DesenhaObjetos.py#L1018-L1022
chiphuyen/stanford-tensorflow-tutorials
51e53daaa2a32cfe7a1966f060b28dbbd081791c
examples/word2vec_utils.py
python
most_common_words
(visual_fld, num_visualize)
create a list of num_visualize most frequent words to visualize on TensorBoard. saved to visualization/vocab_[num_visualize].tsv
create a list of num_visualize most frequent words to visualize on TensorBoard. saved to visualization/vocab_[num_visualize].tsv
[ "create", "a", "list", "of", "num_visualize", "most", "frequent", "words", "to", "visualize", "on", "TensorBoard", ".", "saved", "to", "visualization", "/", "vocab_", "[", "num_visualize", "]", ".", "tsv" ]
def most_common_words(visual_fld, num_visualize): """ create a list of num_visualize most frequent words to visualize on TensorBoard. saved to visualization/vocab_[num_visualize].tsv """ words = open(os.path.join(visual_fld, 'vocab.tsv'), 'r').readlines()[:num_visualize] words = [word for word in wo...
[ "def", "most_common_words", "(", "visual_fld", ",", "num_visualize", ")", ":", "words", "=", "open", "(", "os", ".", "path", ".", "join", "(", "visual_fld", ",", "'vocab.tsv'", ")", ",", "'r'", ")", ".", "readlines", "(", ")", "[", ":", "num_visualize", ...
https://github.com/chiphuyen/stanford-tensorflow-tutorials/blob/51e53daaa2a32cfe7a1966f060b28dbbd081791c/examples/word2vec_utils.py#L58-L67
readbeyond/aeneas
4d200a050690903b30b3d885b44714fecb23f18a
aeneas/globalfunctions.py
python
safe_str
(string)
return string
Safely return the given Unicode string from a ``__str__`` function: as a byte string in Python 2, or as a Unicode string in Python 3. :param string string: the string to return :rtype: bytes or string
Safely return the given Unicode string from a ``__str__`` function: as a byte string in Python 2, or as a Unicode string in Python 3.
[ "Safely", "return", "the", "given", "Unicode", "string", "from", "a", "__str__", "function", ":", "as", "a", "byte", "string", "in", "Python", "2", "or", "as", "a", "Unicode", "string", "in", "Python", "3", "." ]
def safe_str(string): """ Safely return the given Unicode string from a ``__str__`` function: as a byte string in Python 2, or as a Unicode string in Python 3. :param string string: the string to return :rtype: bytes or string """ if string is None: return None if PY2: ...
[ "def", "safe_str", "(", "string", ")", ":", "if", "string", "is", "None", ":", "return", "None", "if", "PY2", ":", "return", "string", ".", "encode", "(", "\"utf-8\"", ")", "return", "string" ]
https://github.com/readbeyond/aeneas/blob/4d200a050690903b30b3d885b44714fecb23f18a/aeneas/globalfunctions.py#L1176-L1189
tdeboissiere/DeepLearningImplementations
5c4094880fc6992cca2d6e336463b2525026f6e2
DenseNet/densenet.py
python
denseblock_altern
(x, concat_axis, nb_layers, nb_filter, growth_rate, dropout_rate=None, weight_decay=1E-4)
return x, nb_filter
Build a denseblock where the output of each conv_factory is fed to subsequent ones. (Alternative of a above) :param x: keras model :param concat_axis: int -- index of contatenate axis :param nb_layers: int -- the number of layers of conv_ factory to append to the model. :pa...
Build a denseblock where the output of each conv_factory is fed to subsequent ones. (Alternative of a above)
[ "Build", "a", "denseblock", "where", "the", "output", "of", "each", "conv_factory", "is", "fed", "to", "subsequent", "ones", ".", "(", "Alternative", "of", "a", "above", ")" ]
def denseblock_altern(x, concat_axis, nb_layers, nb_filter, growth_rate, dropout_rate=None, weight_decay=1E-4): """Build a denseblock where the output of each conv_factory is fed to subsequent ones. (Alternative of a above) :param x: keras model :param concat_axis: int -- index...
[ "def", "denseblock_altern", "(", "x", ",", "concat_axis", ",", "nb_layers", ",", "nb_filter", ",", "growth_rate", ",", "dropout_rate", "=", "None", ",", "weight_decay", "=", "1E-4", ")", ":", "for", "i", "in", "range", "(", "nb_layers", ")", ":", "merge_te...
https://github.com/tdeboissiere/DeepLearningImplementations/blob/5c4094880fc6992cca2d6e336463b2525026f6e2/DenseNet/densenet.py#L102-L128
awslabs/aws-ec2rescue-linux
8ecf40e7ea0d2563dac057235803fca2221029d2
ec2rlcore/programversion.py
python
ProgramVersion.__lt__
(self, other)
Implementation enables the rich comparison operator '<'. Python 2.5+ will infer the other operators, le, gt, and ge.
Implementation enables the rich comparison operator '<'. Python 2.5+ will infer the other operators, le, gt, and ge.
[ "Implementation", "enables", "the", "rich", "comparison", "operator", "<", ".", "Python", "2", ".", "5", "+", "will", "infer", "the", "other", "operators", "le", "gt", "and", "ge", "." ]
def __lt__(self, other): """ Implementation enables the rich comparison operator '<'. Python 2.5+ will infer the other operators, le, gt, and ge. """ if isinstance(other, self.__class__): return int(other.major) > int(self.major) \ or (int(other.maj...
[ "def", "__lt__", "(", "self", ",", "other", ")", ":", "if", "isinstance", "(", "other", ",", "self", ".", "__class__", ")", ":", "return", "int", "(", "other", ".", "major", ")", ">", "int", "(", "self", ".", "major", ")", "or", "(", "int", "(", ...
https://github.com/awslabs/aws-ec2rescue-linux/blob/8ecf40e7ea0d2563dac057235803fca2221029d2/ec2rlcore/programversion.py#L123-L144
apple/ccs-calendarserver
13c706b985fb728b9aab42dc0fef85aae21921c3
twistedcaldav/directory/augment.py
python
AugmentXMLDB._parseXML
(self)
return results
Parse self.xmlFiles into AugmentRecords. If none of the xmlFiles exist, create a default record.
Parse self.xmlFiles into AugmentRecords.
[ "Parse", "self", ".", "xmlFiles", "into", "AugmentRecords", "." ]
def _parseXML(self): """ Parse self.xmlFiles into AugmentRecords. If none of the xmlFiles exist, create a default record. """ results = {} # If all augments files are missing, return a default record for xmlFile in self.xmlFiles: if os.path.exists(x...
[ "def", "_parseXML", "(", "self", ")", ":", "results", "=", "{", "}", "# If all augments files are missing, return a default record", "for", "xmlFile", "in", "self", ".", "xmlFiles", ":", "if", "os", ".", "path", ".", "exists", "(", "xmlFile", ")", ":", "break"...
https://github.com/apple/ccs-calendarserver/blob/13c706b985fb728b9aab42dc0fef85aae21921c3/twistedcaldav/directory/augment.py#L498-L531
johntruckenbrodt/pyroSAR
efac51134ba42d20120b259f968afe5a4ddcc46a
pyroSAR/gamma/parser_demo.py
python
DELFT_vec2
(SLC_par, DELFT_dir, nstate='-', interval='-', ODR='-', logpath=None, outdir=None, shellscript=None)
| Extract and interpolate DELFT ERS-1, ERS-2, and ENVISAT state vectors | Copyright 2012, Gamma Remote Sensing, v2.6 clw 24-Oct-2012 Parameters ---------- SLC_par: (input) ISP image parameter file DELFT_dir: directory containing Delft orbit arclist and ODR files for ERS-1, ERS-2 or ...
| Extract and interpolate DELFT ERS-1, ERS-2, and ENVISAT state vectors | Copyright 2012, Gamma Remote Sensing, v2.6 clw 24-Oct-2012
[ "|", "Extract", "and", "interpolate", "DELFT", "ERS", "-", "1", "ERS", "-", "2", "and", "ENVISAT", "state", "vectors", "|", "Copyright", "2012", "Gamma", "Remote", "Sensing", "v2", ".", "6", "clw", "24", "-", "Oct", "-", "2012" ]
def DELFT_vec2(SLC_par, DELFT_dir, nstate='-', interval='-', ODR='-', logpath=None, outdir=None, shellscript=None): """ | Extract and interpolate DELFT ERS-1, ERS-2, and ENVISAT state vectors | Copyright 2012, Gamma Remote Sensing, v2.6 clw 24-Oct-2012 Parameters ---------- SLC_par: (in...
[ "def", "DELFT_vec2", "(", "SLC_par", ",", "DELFT_dir", ",", "nstate", "=", "'-'", ",", "interval", "=", "'-'", ",", "ODR", "=", "'-'", ",", "logpath", "=", "None", ",", "outdir", "=", "None", ",", "shellscript", "=", "None", ")", ":", "process", "(",...
https://github.com/johntruckenbrodt/pyroSAR/blob/efac51134ba42d20120b259f968afe5a4ddcc46a/pyroSAR/gamma/parser_demo.py#L820-L847
programa-stic/barf-project
9547ef843b8eb021c2c32c140e36173c0b4eafa3
barf/analysis/gadgets/classifier.py
python
GadgetClassifier._classify_jump
(self, regs_init, regs_fini, mem_fini, written_regs, read_regs)
return matches
Classify jump gadgets.
Classify jump gadgets.
[ "Classify", "jump", "gadgets", "." ]
def _classify_jump(self, regs_init, regs_fini, mem_fini, written_regs, read_regs): """Classify jump gadgets. """ # TODO: Implement. matches = [] return matches
[ "def", "_classify_jump", "(", "self", ",", "regs_init", ",", "regs_fini", ",", "mem_fini", ",", "written_regs", ",", "read_regs", ")", ":", "# TODO: Implement.", "matches", "=", "[", "]", "return", "matches" ]
https://github.com/programa-stic/barf-project/blob/9547ef843b8eb021c2c32c140e36173c0b4eafa3/barf/analysis/gadgets/classifier.py#L148-L155
openshift/openshift-tools
1188778e728a6e4781acf728123e5b356380fe6f
openshift/installer/vendored/openshift-ansible-3.10.0-0.29.0/roles/lib_openshift/src/lib/base.py
python
Utils.cleanup
(files)
Clean up on exit
Clean up on exit
[ "Clean", "up", "on", "exit" ]
def cleanup(files): '''Clean up on exit ''' for sfile in files: if os.path.exists(sfile): if os.path.isdir(sfile): shutil.rmtree(sfile) elif os.path.isfile(sfile): os.remove(sfile)
[ "def", "cleanup", "(", "files", ")", ":", "for", "sfile", "in", "files", ":", "if", "os", ".", "path", ".", "exists", "(", "sfile", ")", ":", "if", "os", ".", "path", ".", "isdir", "(", "sfile", ")", ":", "shutil", ".", "rmtree", "(", "sfile", ...
https://github.com/openshift/openshift-tools/blob/1188778e728a6e4781acf728123e5b356380fe6f/openshift/installer/vendored/openshift-ansible-3.10.0-0.29.0/roles/lib_openshift/src/lib/base.py#L392-L399
ducksboard/libsaas
615981a3336f65be9d51ae95a48aed9ad3bd1c3c
libsaas/services/github/repocommits.py
python
RepoCommitsComment.get
(self, format=None)
return http.Request('GET', self.get_url(), params), parsers.parse_json
Fetch the comment. :var format: Which format should be requested, either `raw`, `text`, `html` or `full`. For details on formats, see http://developer.github.com/v3/mime/#comment-body-properties.
Fetch the comment.
[ "Fetch", "the", "comment", "." ]
def get(self, format=None): """ Fetch the comment. :var format: Which format should be requested, either `raw`, `text`, `html` or `full`. For details on formats, see http://developer.github.com/v3/mime/#comment-body-properties. """ params = base.get_param...
[ "def", "get", "(", "self", ",", "format", "=", "None", ")", ":", "params", "=", "base", ".", "get_params", "(", "(", "'format'", ",", ")", ",", "locals", "(", ")", ")", "return", "http", ".", "Request", "(", "'GET'", ",", "self", ".", "get_url", ...
https://github.com/ducksboard/libsaas/blob/615981a3336f65be9d51ae95a48aed9ad3bd1c3c/libsaas/services/github/repocommits.py#L18-L28
xtiankisutsa/MARA_Framework
ac4ac88bfd38f33ae8780a606ed09ab97177c562
tools/qark/qark/lib/bs4/element.py
python
Tag.select
(self, selector, _candidate_generator=None)
return current_context
Perform a CSS selection operation on the current element.
Perform a CSS selection operation on the current element.
[ "Perform", "a", "CSS", "selection", "operation", "on", "the", "current", "element", "." ]
def select(self, selector, _candidate_generator=None): """Perform a CSS selection operation on the current element.""" tokens = selector.split() current_context = [self] if tokens[-1] in self._selector_combinators: raise ValueError( 'Final combinator "%s" is ...
[ "def", "select", "(", "self", ",", "selector", ",", "_candidate_generator", "=", "None", ")", ":", "tokens", "=", "selector", ".", "split", "(", ")", "current_context", "=", "[", "self", "]", "if", "tokens", "[", "-", "1", "]", "in", "self", ".", "_s...
https://github.com/xtiankisutsa/MARA_Framework/blob/ac4ac88bfd38f33ae8780a606ed09ab97177c562/tools/qark/qark/lib/bs4/element.py#L1204-L1399
CouchPotato/CouchPotatoServer
7260c12f72447ddb6f062367c6dfbda03ecd4e9c
libs/pytwitter/__init__.py
python
User.GetVerified
(self)
return self._verified
Get the setting of verified for this user. Returns: True/False if user is a verified account
Get the setting of verified for this user.
[ "Get", "the", "setting", "of", "verified", "for", "this", "user", "." ]
def GetVerified(self): '''Get the setting of verified for this user. Returns: True/False if user is a verified account ''' return self._verified
[ "def", "GetVerified", "(", "self", ")", ":", "return", "self", ".", "_verified" ]
https://github.com/CouchPotato/CouchPotatoServer/blob/7260c12f72447ddb6f062367c6dfbda03ecd4e9c/libs/pytwitter/__init__.py#L1245-L1251
zhl2008/awd-platform
0416b31abea29743387b10b3914581fbe8e7da5e
web_flaskbb/Python-2.7.9/Lib/SimpleXMLRPCServer.py
python
SimpleXMLRPCRequestHandler.do_POST
(self)
Handles the HTTP POST request. Attempts to interpret all HTTP POST requests as XML-RPC calls, which are forwarded to the server's _dispatch method for handling.
Handles the HTTP POST request.
[ "Handles", "the", "HTTP", "POST", "request", "." ]
def do_POST(self): """Handles the HTTP POST request. Attempts to interpret all HTTP POST requests as XML-RPC calls, which are forwarded to the server's _dispatch method for handling. """ # Check that the path is legal if not self.is_rpc_path_valid(): self.re...
[ "def", "do_POST", "(", "self", ")", ":", "# Check that the path is legal", "if", "not", "self", ".", "is_rpc_path_valid", "(", ")", ":", "self", ".", "report_404", "(", ")", "return", "try", ":", "# Get arguments by reading body of request.", "# We read this in chunks...
https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_flaskbb/Python-2.7.9/Lib/SimpleXMLRPCServer.py#L467-L535
GNS3/gns3-gui
da8adbaa18ab60e053af2a619efd468f4c8950f3
gns3/nodes_view.py
python
NodesView.mouseMoveEvent
(self, event)
Handles all mouse move events. This is the starting point to drag & drop a template on the scene. :param: QMouseEvent instance
Handles all mouse move events. This is the starting point to drag & drop a template on the scene.
[ "Handles", "all", "mouse", "move", "events", ".", "This", "is", "the", "starting", "point", "to", "drag", "&", "drop", "a", "template", "on", "the", "scene", "." ]
def mouseMoveEvent(self, event): """ Handles all mouse move events. This is the starting point to drag & drop a template on the scene. :param: QMouseEvent instance """ # Check that an item has been selected and left button clicked if self.currentItem() is not No...
[ "def", "mouseMoveEvent", "(", "self", ",", "event", ")", ":", "# Check that an item has been selected and left button clicked", "if", "self", ".", "currentItem", "(", ")", "is", "not", "None", "and", "event", ".", "buttons", "(", ")", "==", "QtCore", ".", "Qt", ...
https://github.com/GNS3/gns3-gui/blob/da8adbaa18ab60e053af2a619efd468f4c8950f3/gns3/nodes_view.py#L170-L193
Qirky/FoxDot
76318f9630bede48ff3994146ed644affa27bfa4
FoxDot/lib/OSC.py
python
OSCStreamingServer.stop
(self)
Stop the server thread and close the socket.
Stop the server thread and close the socket.
[ "Stop", "the", "server", "thread", "and", "close", "the", "socket", "." ]
def stop(self): """ Stop the server thread and close the socket. """ self.running = False self._server_thread.join() self.server_close()
[ "def", "stop", "(", "self", ")", ":", "self", ".", "running", "=", "False", "self", ".", "_server_thread", ".", "join", "(", ")", "self", ".", "server_close", "(", ")" ]
https://github.com/Qirky/FoxDot/blob/76318f9630bede48ff3994146ed644affa27bfa4/FoxDot/lib/OSC.py#L2650-L2654
plotly/plotly.py
cfad7862594b35965c0e000813bd7805e8494a5b
packages/python/plotly/plotly/graph_objs/_box.py
python
Box.notchwidth
(self)
return self["notchwidth"]
Sets the width of the notches relative to the box' width. For example, with 0, the notches are as wide as the box(es). The 'notchwidth' property is a number and may be specified as: - An int or float in the interval [0, 0.5] Returns ------- int|float
Sets the width of the notches relative to the box' width. For example, with 0, the notches are as wide as the box(es). The 'notchwidth' property is a number and may be specified as: - An int or float in the interval [0, 0.5]
[ "Sets", "the", "width", "of", "the", "notches", "relative", "to", "the", "box", "width", ".", "For", "example", "with", "0", "the", "notches", "are", "as", "wide", "as", "the", "box", "(", "es", ")", ".", "The", "notchwidth", "property", "is", "a", "...
def notchwidth(self): """ Sets the width of the notches relative to the box' width. For example, with 0, the notches are as wide as the box(es). The 'notchwidth' property is a number and may be specified as: - An int or float in the interval [0, 0.5] Returns ...
[ "def", "notchwidth", "(", "self", ")", ":", "return", "self", "[", "\"notchwidth\"", "]" ]
https://github.com/plotly/plotly.py/blob/cfad7862594b35965c0e000813bd7805e8494a5b/packages/python/plotly/plotly/graph_objs/_box.py#L1050-L1062