id
int32
0
252k
repo
stringlengths
7
55
path
stringlengths
4
127
func_name
stringlengths
1
88
original_string
stringlengths
75
19.8k
language
stringclasses
1 value
code
stringlengths
75
19.8k
code_tokens
list
docstring
stringlengths
3
17.3k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
87
242
243,300
yougov/vr.builder
vr/builder/build.py
OutputSaver.make_tarball
def make_tarball(self, app_folder, build_data): """ Following a successful build, create a tarball and build result. """ # slugignore clean_slug_dir(app_folder) # tar up the result with tarfile.open('build.tar.gz', 'w:gz') as tar: tar.add(app_folder, ...
python
def make_tarball(self, app_folder, build_data): """ Following a successful build, create a tarball and build result. """ # slugignore clean_slug_dir(app_folder) # tar up the result with tarfile.open('build.tar.gz', 'w:gz') as tar: tar.add(app_folder, ...
[ "def", "make_tarball", "(", "self", ",", "app_folder", ",", "build_data", ")", ":", "# slugignore", "clean_slug_dir", "(", "app_folder", ")", "# tar up the result", "with", "tarfile", ".", "open", "(", "'build.tar.gz'", ",", "'w:gz'", ")", "as", "tar", ":", "t...
Following a successful build, create a tarball and build result.
[ "Following", "a", "successful", "build", "create", "a", "tarball", "and", "build", "result", "." ]
666b28f997d0cff52e82eed4ace1c73fee4b2136
https://github.com/yougov/vr.builder/blob/666b28f997d0cff52e82eed4ace1c73fee4b2136/vr/builder/build.py#L63-L81
243,301
goldhand/django-nupages
nupages/middleware.py
MultiTenantMiddleware.process_request
def process_request(self, request): ''' checks if the host domain is one of the site objects and sets request.site_id ''' site_id = 0 domain = request.get_host().lower() if hasattr(settings, 'SITE_ID'): site_id = settings.SITE_ID try: ...
python
def process_request(self, request): ''' checks if the host domain is one of the site objects and sets request.site_id ''' site_id = 0 domain = request.get_host().lower() if hasattr(settings, 'SITE_ID'): site_id = settings.SITE_ID try: ...
[ "def", "process_request", "(", "self", ",", "request", ")", ":", "site_id", "=", "0", "domain", "=", "request", ".", "get_host", "(", ")", ".", "lower", "(", ")", "if", "hasattr", "(", "settings", ",", "'SITE_ID'", ")", ":", "site_id", "=", "settings",...
checks if the host domain is one of the site objects and sets request.site_id
[ "checks", "if", "the", "host", "domain", "is", "one", "of", "the", "site", "objects", "and", "sets", "request", ".", "site_id" ]
4e54fae7e057f9530c22dc30c03812fd660cb7f4
https://github.com/goldhand/django-nupages/blob/4e54fae7e057f9530c22dc30c03812fd660cb7f4/nupages/middleware.py#L9-L23
243,302
baliame/http-hmac-python
httphmac/v2.py
V2Signer.sign
def sign(self, request, authheaders, secret): """Returns the v2 signature appropriate for the request. The request is not changed by this function. Keyword arguments: request -- A request object which can be consumed by this API. authheaders -- A string-indexable object which contains t...
python
def sign(self, request, authheaders, secret): """Returns the v2 signature appropriate for the request. The request is not changed by this function. Keyword arguments: request -- A request object which can be consumed by this API. authheaders -- A string-indexable object which contains t...
[ "def", "sign", "(", "self", ",", "request", ",", "authheaders", ",", "secret", ")", ":", "if", "\"id\"", "not", "in", "authheaders", "or", "authheaders", "[", "\"id\"", "]", "==", "''", ":", "raise", "KeyError", "(", "\"id required in authorization headers.\""...
Returns the v2 signature appropriate for the request. The request is not changed by this function. Keyword arguments: request -- A request object which can be consumed by this API. authheaders -- A string-indexable object which contains the headers appropriate for this signature version. ...
[ "Returns", "the", "v2", "signature", "appropriate", "for", "the", "request", ".", "The", "request", "is", "not", "changed", "by", "this", "function", "." ]
9884c0cbfdb712f9f37080a8efbfdce82850785f
https://github.com/baliame/http-hmac-python/blob/9884c0cbfdb712f9f37080a8efbfdce82850785f/httphmac/v2.py#L78-L109
243,303
baliame/http-hmac-python
httphmac/v2.py
V2Signer.get_response_signer
def get_response_signer(self): """Returns the response signer for this version of the signature. """ if not hasattr(self, "response_signer"): self.response_signer = V2ResponseSigner(self.digest, orig=self) return self.response_signer
python
def get_response_signer(self): """Returns the response signer for this version of the signature. """ if not hasattr(self, "response_signer"): self.response_signer = V2ResponseSigner(self.digest, orig=self) return self.response_signer
[ "def", "get_response_signer", "(", "self", ")", ":", "if", "not", "hasattr", "(", "self", ",", "\"response_signer\"", ")", ":", "self", ".", "response_signer", "=", "V2ResponseSigner", "(", "self", ".", "digest", ",", "orig", "=", "self", ")", "return", "s...
Returns the response signer for this version of the signature.
[ "Returns", "the", "response", "signer", "for", "this", "version", "of", "the", "signature", "." ]
9884c0cbfdb712f9f37080a8efbfdce82850785f
https://github.com/baliame/http-hmac-python/blob/9884c0cbfdb712f9f37080a8efbfdce82850785f/httphmac/v2.py#L111-L116
243,304
baliame/http-hmac-python
httphmac/v2.py
V2Signer.check
def check(self, request, secret): """Verifies whether or not the request bears an authorization appropriate and valid for this version of the signature. This verifies every element of the signature, including the timestamp's value. Does not alter the request. Keyword arguments: ...
python
def check(self, request, secret): """Verifies whether or not the request bears an authorization appropriate and valid for this version of the signature. This verifies every element of the signature, including the timestamp's value. Does not alter the request. Keyword arguments: ...
[ "def", "check", "(", "self", ",", "request", ",", "secret", ")", ":", "if", "request", ".", "get_header", "(", "\"Authorization\"", ")", "==", "\"\"", ":", "return", "False", "ah", "=", "self", ".", "parse_auth_headers", "(", "request", ".", "get_header", ...
Verifies whether or not the request bears an authorization appropriate and valid for this version of the signature. This verifies every element of the signature, including the timestamp's value. Does not alter the request. Keyword arguments: request -- A request object which can be cons...
[ "Verifies", "whether", "or", "not", "the", "request", "bears", "an", "authorization", "appropriate", "and", "valid", "for", "this", "version", "of", "the", "signature", ".", "This", "verifies", "every", "element", "of", "the", "signature", "including", "the", ...
9884c0cbfdb712f9f37080a8efbfdce82850785f
https://github.com/baliame/http-hmac-python/blob/9884c0cbfdb712f9f37080a8efbfdce82850785f/httphmac/v2.py#L128-L163
243,305
baliame/http-hmac-python
httphmac/v2.py
V2Signer.unroll_auth_headers
def unroll_auth_headers(self, authheaders, exclude_signature=False, sep=",", quote=True): """Converts an authorization header dict-like object into a string representing the authorization. Keyword arguments: authheaders -- A string-indexable object which contains the headers appropriate for thi...
python
def unroll_auth_headers(self, authheaders, exclude_signature=False, sep=",", quote=True): """Converts an authorization header dict-like object into a string representing the authorization. Keyword arguments: authheaders -- A string-indexable object which contains the headers appropriate for thi...
[ "def", "unroll_auth_headers", "(", "self", ",", "authheaders", ",", "exclude_signature", "=", "False", ",", "sep", "=", "\",\"", ",", "quote", "=", "True", ")", ":", "res", "=", "\"\"", "ordered", "=", "collections", ".", "OrderedDict", "(", "sorted", "(",...
Converts an authorization header dict-like object into a string representing the authorization. Keyword arguments: authheaders -- A string-indexable object which contains the headers appropriate for this signature version.
[ "Converts", "an", "authorization", "header", "dict", "-", "like", "object", "into", "a", "string", "representing", "the", "authorization", "." ]
9884c0cbfdb712f9f37080a8efbfdce82850785f
https://github.com/baliame/http-hmac-python/blob/9884c0cbfdb712f9f37080a8efbfdce82850785f/httphmac/v2.py#L165-L177
243,306
baliame/http-hmac-python
httphmac/v2.py
V2Signer.sign_direct
def sign_direct(self, request, authheaders, secret): """Signs a request directly with a v2 signature. The request's Authorization header will change. This function may also add the required X-Authorization-Timestamp and X-Authorization-Content-SHA256 headers. Keyword arguments: request ...
python
def sign_direct(self, request, authheaders, secret): """Signs a request directly with a v2 signature. The request's Authorization header will change. This function may also add the required X-Authorization-Timestamp and X-Authorization-Content-SHA256 headers. Keyword arguments: request ...
[ "def", "sign_direct", "(", "self", ",", "request", ",", "authheaders", ",", "secret", ")", ":", "if", "request", ".", "get_header", "(", "'x-authorization-timestamp'", ")", "==", "''", ":", "request", ".", "with_header", "(", "\"X-Authorization-Timestamp\"", ","...
Signs a request directly with a v2 signature. The request's Authorization header will change. This function may also add the required X-Authorization-Timestamp and X-Authorization-Content-SHA256 headers. Keyword arguments: request -- A request object which can be consumed by this API. a...
[ "Signs", "a", "request", "directly", "with", "a", "v2", "signature", ".", "The", "request", "s", "Authorization", "header", "will", "change", ".", "This", "function", "may", "also", "add", "the", "required", "X", "-", "Authorization", "-", "Timestamp", "and"...
9884c0cbfdb712f9f37080a8efbfdce82850785f
https://github.com/baliame/http-hmac-python/blob/9884c0cbfdb712f9f37080a8efbfdce82850785f/httphmac/v2.py#L188-L206
243,307
baliame/http-hmac-python
httphmac/v2.py
V2ResponseSigner.check
def check(self, request, response, secret): """Checks the response for the appropriate signature. Returns True if the signature matches the expected value. Keyword arguments: request -- A request object which can be consumed by this API. response -- A requests response object or compati...
python
def check(self, request, response, secret): """Checks the response for the appropriate signature. Returns True if the signature matches the expected value. Keyword arguments: request -- A request object which can be consumed by this API. response -- A requests response object or compati...
[ "def", "check", "(", "self", ",", "request", ",", "response", ",", "secret", ")", ":", "auth", "=", "request", ".", "get_header", "(", "'Authorization'", ")", "if", "auth", "==", "''", ":", "raise", "KeyError", "(", "'Authorization header is required for the r...
Checks the response for the appropriate signature. Returns True if the signature matches the expected value. Keyword arguments: request -- A request object which can be consumed by this API. response -- A requests response object or compatible signed response object. secret -- The base6...
[ "Checks", "the", "response", "for", "the", "appropriate", "signature", ".", "Returns", "True", "if", "the", "signature", "matches", "the", "expected", "value", "." ]
9884c0cbfdb712f9f37080a8efbfdce82850785f
https://github.com/baliame/http-hmac-python/blob/9884c0cbfdb712f9f37080a8efbfdce82850785f/httphmac/v2.py#L226-L242
243,308
baliame/http-hmac-python
httphmac/v2.py
V2ResponseSigner.signable
def signable(self, request, authheaders, response_body): """Creates the signable string for a response and returns it. Keyword arguments: request -- A request object which can be consumed by this API. authheaders -- A string-indexable object which contains the headers appropriate for th...
python
def signable(self, request, authheaders, response_body): """Creates the signable string for a response and returns it. Keyword arguments: request -- A request object which can be consumed by this API. authheaders -- A string-indexable object which contains the headers appropriate for th...
[ "def", "signable", "(", "self", ",", "request", ",", "authheaders", ",", "response_body", ")", ":", "nonce", "=", "authheaders", "[", "\"nonce\"", "]", "timestamp", "=", "request", ".", "get_header", "(", "\"x-authorization-timestamp\"", ")", "try", ":", "body...
Creates the signable string for a response and returns it. Keyword arguments: request -- A request object which can be consumed by this API. authheaders -- A string-indexable object which contains the headers appropriate for this signature version. response_body -- A string or bytes-lik...
[ "Creates", "the", "signable", "string", "for", "a", "response", "and", "returns", "it", "." ]
9884c0cbfdb712f9f37080a8efbfdce82850785f
https://github.com/baliame/http-hmac-python/blob/9884c0cbfdb712f9f37080a8efbfdce82850785f/httphmac/v2.py#L244-L258
243,309
baliame/http-hmac-python
httphmac/v2.py
V2ResponseSigner.sign
def sign(self, request, authheaders, response_body, secret): """Returns the response signature for the response to the request. Keyword arguments: request -- A request object which can be consumed by this API. authheaders -- A string-indexable object which contains the headers appropria...
python
def sign(self, request, authheaders, response_body, secret): """Returns the response signature for the response to the request. Keyword arguments: request -- A request object which can be consumed by this API. authheaders -- A string-indexable object which contains the headers appropria...
[ "def", "sign", "(", "self", ",", "request", ",", "authheaders", ",", "response_body", ",", "secret", ")", ":", "if", "\"nonce\"", "not", "in", "authheaders", "or", "authheaders", "[", "\"nonce\"", "]", "==", "''", ":", "raise", "KeyError", "(", "\"nonce re...
Returns the response signature for the response to the request. Keyword arguments: request -- A request object which can be consumed by this API. authheaders -- A string-indexable object which contains the headers appropriate for this signature version. response_body -- A string or byte...
[ "Returns", "the", "response", "signature", "for", "the", "response", "to", "the", "request", "." ]
9884c0cbfdb712f9f37080a8efbfdce82850785f
https://github.com/baliame/http-hmac-python/blob/9884c0cbfdb712f9f37080a8efbfdce82850785f/httphmac/v2.py#L260-L283
243,310
basvandenbroek/gcloud_taskqueue
gcloud_taskqueue/taskqueue.py
Taskqueue.delete_task
def delete_task(self, id, client=None): """Deletes a task from the current task queue. If the task isn't found (backend 404), raises a :class:`gcloud.exceptions.NotFound`. :type id: string :param id: A task name to delete. :type client: :class:`gcloud.taskqueue.client....
python
def delete_task(self, id, client=None): """Deletes a task from the current task queue. If the task isn't found (backend 404), raises a :class:`gcloud.exceptions.NotFound`. :type id: string :param id: A task name to delete. :type client: :class:`gcloud.taskqueue.client....
[ "def", "delete_task", "(", "self", ",", "id", ",", "client", "=", "None", ")", ":", "client", "=", "self", ".", "_require_client", "(", "client", ")", "task", "=", "Task", "(", "taskqueue", "=", "self", ",", "id", "=", "id", ")", "# We intentionally pa...
Deletes a task from the current task queue. If the task isn't found (backend 404), raises a :class:`gcloud.exceptions.NotFound`. :type id: string :param id: A task name to delete. :type client: :class:`gcloud.taskqueue.client.Client` or ``NoneType`` :param client: Opti...
[ "Deletes", "a", "task", "from", "the", "current", "task", "queue", "." ]
b147b57f7c0ad9e8030ee9797d6526a448aa5007
https://github.com/basvandenbroek/gcloud_taskqueue/blob/b147b57f7c0ad9e8030ee9797d6526a448aa5007/gcloud_taskqueue/taskqueue.py#L153-L174
243,311
basvandenbroek/gcloud_taskqueue
gcloud_taskqueue/taskqueue.py
Taskqueue.get_task
def get_task(self, id, client=None): """Gets a named task from taskqueue If the task isn't found (backend 404), raises a :class:`gcloud.exceptions.NotFound`. :type id: string :param id: A task name to get :type client: :class:`gcloud.taskqueue.client.Client` or ``NoneTy...
python
def get_task(self, id, client=None): """Gets a named task from taskqueue If the task isn't found (backend 404), raises a :class:`gcloud.exceptions.NotFound`. :type id: string :param id: A task name to get :type client: :class:`gcloud.taskqueue.client.Client` or ``NoneTy...
[ "def", "get_task", "(", "self", ",", "id", ",", "client", "=", "None", ")", ":", "client", "=", "self", ".", "_require_client", "(", "client", ")", "task", "=", "Task", "(", "taskqueue", "=", "self", ",", "id", "=", "id", ")", "try", ":", "response...
Gets a named task from taskqueue If the task isn't found (backend 404), raises a :class:`gcloud.exceptions.NotFound`. :type id: string :param id: A task name to get :type client: :class:`gcloud.taskqueue.client.Client` or ``NoneType`` :param client: Optional. The client...
[ "Gets", "a", "named", "task", "from", "taskqueue" ]
b147b57f7c0ad9e8030ee9797d6526a448aa5007
https://github.com/basvandenbroek/gcloud_taskqueue/blob/b147b57f7c0ad9e8030ee9797d6526a448aa5007/gcloud_taskqueue/taskqueue.py#L176-L199
243,312
basvandenbroek/gcloud_taskqueue
gcloud_taskqueue/taskqueue.py
Taskqueue.lease
def lease(self, lease_time, num_tasks, group_by_tag=False, tag=None, client=None): """ Acquires a lease on the topmost N unowned tasks in the specified queue. :type lease_time: int :param lease_time: How long to lease this task, in seconds. :type num_tasks: int :param num_tasks...
python
def lease(self, lease_time, num_tasks, group_by_tag=False, tag=None, client=None): """ Acquires a lease on the topmost N unowned tasks in the specified queue. :type lease_time: int :param lease_time: How long to lease this task, in seconds. :type num_tasks: int :param num_tasks...
[ "def", "lease", "(", "self", ",", "lease_time", ",", "num_tasks", ",", "group_by_tag", "=", "False", ",", "tag", "=", "None", ",", "client", "=", "None", ")", ":", "client", "=", "self", ".", "_require_client", "(", "client", ")", "if", "group_by_tag", ...
Acquires a lease on the topmost N unowned tasks in the specified queue. :type lease_time: int :param lease_time: How long to lease this task, in seconds. :type num_tasks: int :param num_tasks: The number of tasks to lease. :type group_by_tag: bool :param group_by_tag: ...
[ "Acquires", "a", "lease", "on", "the", "topmost", "N", "unowned", "tasks", "in", "the", "specified", "queue", "." ]
b147b57f7c0ad9e8030ee9797d6526a448aa5007
https://github.com/basvandenbroek/gcloud_taskqueue/blob/b147b57f7c0ad9e8030ee9797d6526a448aa5007/gcloud_taskqueue/taskqueue.py#L209-L246
243,313
basvandenbroek/gcloud_taskqueue
gcloud_taskqueue/taskqueue.py
Taskqueue.update_task
def update_task(self, id, new_lease_time, client=None): """ Updates the duration of a task lease If the task isn't found (backend 404), raises a :class:`gcloud.exceptions.NotFound`. :type id: string :param id: A task name to update :type new_lease_time: int :pa...
python
def update_task(self, id, new_lease_time, client=None): """ Updates the duration of a task lease If the task isn't found (backend 404), raises a :class:`gcloud.exceptions.NotFound`. :type id: string :param id: A task name to update :type new_lease_time: int :pa...
[ "def", "update_task", "(", "self", ",", "id", ",", "new_lease_time", ",", "client", "=", "None", ")", ":", "client", "=", "self", ".", "_require_client", "(", "client", ")", "task", "=", "Task", "(", "taskqueue", "=", "self", ",", "id", "=", "id", ")...
Updates the duration of a task lease If the task isn't found (backend 404), raises a :class:`gcloud.exceptions.NotFound`. :type id: string :param id: A task name to update :type new_lease_time: int :param new_lease_time: New lease time, in seconds. :type clien...
[ "Updates", "the", "duration", "of", "a", "task", "lease" ]
b147b57f7c0ad9e8030ee9797d6526a448aa5007
https://github.com/basvandenbroek/gcloud_taskqueue/blob/b147b57f7c0ad9e8030ee9797d6526a448aa5007/gcloud_taskqueue/taskqueue.py#L248-L277
243,314
basvandenbroek/gcloud_taskqueue
gcloud_taskqueue/taskqueue.py
Taskqueue.insert_task
def insert_task(self, description, tag=None, client=None): """ Insert task in task queue. If the task isn't found (backend 404), raises a :class:`gcloud.exceptions.NotFound`. :type description: string :param description: Description of task to perform :type tag: string...
python
def insert_task(self, description, tag=None, client=None): """ Insert task in task queue. If the task isn't found (backend 404), raises a :class:`gcloud.exceptions.NotFound`. :type description: string :param description: Description of task to perform :type tag: string...
[ "def", "insert_task", "(", "self", ",", "description", ",", "tag", "=", "None", ",", "client", "=", "None", ")", ":", "client", "=", "self", ".", "_require_client", "(", "client", ")", "new_task", "=", "{", "\"queueName\"", ":", "self", ".", "full_name",...
Insert task in task queue. If the task isn't found (backend 404), raises a :class:`gcloud.exceptions.NotFound`. :type description: string :param description: Description of task to perform :type tag: string :param tag: Optional. The tag for this task, allows leasing ta...
[ "Insert", "task", "in", "task", "queue", "." ]
b147b57f7c0ad9e8030ee9797d6526a448aa5007
https://github.com/basvandenbroek/gcloud_taskqueue/blob/b147b57f7c0ad9e8030ee9797d6526a448aa5007/gcloud_taskqueue/taskqueue.py#L279-L310
243,315
pydsigner/pygu
pygu/pygw.py
Base.add_to
def add_to(self, container): ''' Add the class to @container. ''' if self.container: self.remove_from(self.container) container.add(self)
python
def add_to(self, container): ''' Add the class to @container. ''' if self.container: self.remove_from(self.container) container.add(self)
[ "def", "add_to", "(", "self", ",", "container", ")", ":", "if", "self", ".", "container", ":", "self", ".", "remove_from", "(", "self", ".", "container", ")", "container", ".", "add", "(", "self", ")" ]
Add the class to @container.
[ "Add", "the", "class", "to" ]
09fe71534900933908ab83db12f5659b7827e31c
https://github.com/pydsigner/pygu/blob/09fe71534900933908ab83db12f5659b7827e31c/pygu/pygw.py#L78-L84
243,316
pydsigner/pygu
pygu/pygw.py
Container.draw
def draw(self, surf): ''' Draw all widgets and sub-containers to @surf. ''' if self.shown: for w in self.widgets: surf.blit(w.image, self.convert_rect(w.rect)) for c in self.containers: c.draw(surf)
python
def draw(self, surf): ''' Draw all widgets and sub-containers to @surf. ''' if self.shown: for w in self.widgets: surf.blit(w.image, self.convert_rect(w.rect)) for c in self.containers: c.draw(surf)
[ "def", "draw", "(", "self", ",", "surf", ")", ":", "if", "self", ".", "shown", ":", "for", "w", "in", "self", ".", "widgets", ":", "surf", ".", "blit", "(", "w", ".", "image", ",", "self", ".", "convert_rect", "(", "w", ".", "rect", ")", ")", ...
Draw all widgets and sub-containers to @surf.
[ "Draw", "all", "widgets", "and", "sub", "-", "containers", "to" ]
09fe71534900933908ab83db12f5659b7827e31c
https://github.com/pydsigner/pygu/blob/09fe71534900933908ab83db12f5659b7827e31c/pygu/pygw.py#L153-L161
243,317
pydsigner/pygu
pygu/pygw.py
Container.kill
def kill(self): ''' Remove the class from its container, contained items and sub-widgets. Runs automatically when the class is garbage collected. ''' Base.kill(self) for c in self.containers: c.remove_internal(self) for w in self.widgets: ...
python
def kill(self): ''' Remove the class from its container, contained items and sub-widgets. Runs automatically when the class is garbage collected. ''' Base.kill(self) for c in self.containers: c.remove_internal(self) for w in self.widgets: ...
[ "def", "kill", "(", "self", ")", ":", "Base", ".", "kill", "(", "self", ")", "for", "c", "in", "self", ".", "containers", ":", "c", ".", "remove_internal", "(", "self", ")", "for", "w", "in", "self", ".", "widgets", ":", "w", ".", "remove_internal"...
Remove the class from its container, contained items and sub-widgets. Runs automatically when the class is garbage collected.
[ "Remove", "the", "class", "from", "its", "container", "contained", "items", "and", "sub", "-", "widgets", ".", "Runs", "automatically", "when", "the", "class", "is", "garbage", "collected", "." ]
09fe71534900933908ab83db12f5659b7827e31c
https://github.com/pydsigner/pygu/blob/09fe71534900933908ab83db12f5659b7827e31c/pygu/pygw.py#L163-L173
243,318
pydsigner/pygu
pygu/pygw.py
Typable.bspace
def bspace(self): ''' Remove the character before the cursor. ''' try: self.text.pop(self.cursor_loc - 1) self.cursor_loc -= 1 except IndexError: pass
python
def bspace(self): ''' Remove the character before the cursor. ''' try: self.text.pop(self.cursor_loc - 1) self.cursor_loc -= 1 except IndexError: pass
[ "def", "bspace", "(", "self", ")", ":", "try", ":", "self", ".", "text", ".", "pop", "(", "self", ".", "cursor_loc", "-", "1", ")", "self", ".", "cursor_loc", "-=", "1", "except", "IndexError", ":", "pass" ]
Remove the character before the cursor.
[ "Remove", "the", "character", "before", "the", "cursor", "." ]
09fe71534900933908ab83db12f5659b7827e31c
https://github.com/pydsigner/pygu/blob/09fe71534900933908ab83db12f5659b7827e31c/pygu/pygw.py#L446-L454
243,319
pydsigner/pygu
pygu/pygw.py
Entry.paste
def paste(self): ''' Insert text from the clipboard at the cursor. ''' try: t = pygame.scrap.get(SCRAP_TEXT) if t: self.insert(t) return True except: # pygame.scrap is experimental, allow for changes ...
python
def paste(self): ''' Insert text from the clipboard at the cursor. ''' try: t = pygame.scrap.get(SCRAP_TEXT) if t: self.insert(t) return True except: # pygame.scrap is experimental, allow for changes ...
[ "def", "paste", "(", "self", ")", ":", "try", ":", "t", "=", "pygame", ".", "scrap", ".", "get", "(", "SCRAP_TEXT", ")", "if", "t", ":", "self", ".", "insert", "(", "t", ")", "return", "True", "except", ":", "# pygame.scrap is experimental, allow for cha...
Insert text from the clipboard at the cursor.
[ "Insert", "text", "from", "the", "clipboard", "at", "the", "cursor", "." ]
09fe71534900933908ab83db12f5659b7827e31c
https://github.com/pydsigner/pygu/blob/09fe71534900933908ab83db12f5659b7827e31c/pygu/pygw.py#L568-L579
243,320
slarse/clanimtk
clanimtk/cli.py
animate_cli
def animate_cli(animation_, step, event): """Print out the animation cycle to stdout. This function is for use with synchronous functions and must be run in a thread. Args: animation_ (generator): A generator that produces strings for the animation. Should be endless. step (float): ...
python
def animate_cli(animation_, step, event): """Print out the animation cycle to stdout. This function is for use with synchronous functions and must be run in a thread. Args: animation_ (generator): A generator that produces strings for the animation. Should be endless. step (float): ...
[ "def", "animate_cli", "(", "animation_", ",", "step", ",", "event", ")", ":", "while", "True", ":", "# run at least once, important for tests!", "time", ".", "sleep", "(", "step", ")", "frame", "=", "next", "(", "animation_", ")", "sys", ".", "stdout", ".", ...
Print out the animation cycle to stdout. This function is for use with synchronous functions and must be run in a thread. Args: animation_ (generator): A generator that produces strings for the animation. Should be endless. step (float): Seconds between each animation frame.
[ "Print", "out", "the", "animation", "cycle", "to", "stdout", ".", "This", "function", "is", "for", "use", "with", "synchronous", "functions", "and", "must", "be", "run", "in", "a", "thread", "." ]
cb93d2e914c3ecc4e0007745ff4d546318cf3902
https://github.com/slarse/clanimtk/blob/cb93d2e914c3ecc4e0007745ff4d546318cf3902/clanimtk/cli.py#L24-L42
243,321
CS207-Final-Project-Group-10/cs207-FinalProject
solar_system/earth_sun.py
energy_ES
def energy_ES(q, v): """Compute the kinetic and potential energy of the earth sun system""" # Body 0 is the sun, Body 1 is the earth m0 = mass[0] m1 = mass[1] # Positions of sun and earth q0: np.ndarray = q[:, slices[0]] q1: np.ndarray = q[:, slices[1]] # Velocities of sun and earth ...
python
def energy_ES(q, v): """Compute the kinetic and potential energy of the earth sun system""" # Body 0 is the sun, Body 1 is the earth m0 = mass[0] m1 = mass[1] # Positions of sun and earth q0: np.ndarray = q[:, slices[0]] q1: np.ndarray = q[:, slices[1]] # Velocities of sun and earth ...
[ "def", "energy_ES", "(", "q", ",", "v", ")", ":", "# Body 0 is the sun, Body 1 is the earth", "m0", "=", "mass", "[", "0", "]", "m1", "=", "mass", "[", "1", "]", "# Positions of sun and earth", "q0", ":", "np", ".", "ndarray", "=", "q", "[", ":", ",", ...
Compute the kinetic and potential energy of the earth sun system
[ "Compute", "the", "kinetic", "and", "potential", "energy", "of", "the", "earth", "sun", "system" ]
842e9c2d3ca1490cef18c086dfde81856d8d3a82
https://github.com/CS207-Final-Project-Group-10/cs207-FinalProject/blob/842e9c2d3ca1490cef18c086dfde81856d8d3a82/solar_system/earth_sun.py#L174-L202
243,322
CS207-Final-Project-Group-10/cs207-FinalProject
solar_system/earth_sun.py
make_force_ES
def make_force_ES(q_vars, mass): """Fluxion with the potential energy of the earth-sun sytem""" # Build the potential energy fluxion; just one pair of bodies U = U_ij(q_vars, mass, 0, 1) # Varname arrays for both the coordinate system and U vn_q = np.array([q.var_name for q in q_vars]) vn_fl = ...
python
def make_force_ES(q_vars, mass): """Fluxion with the potential energy of the earth-sun sytem""" # Build the potential energy fluxion; just one pair of bodies U = U_ij(q_vars, mass, 0, 1) # Varname arrays for both the coordinate system and U vn_q = np.array([q.var_name for q in q_vars]) vn_fl = ...
[ "def", "make_force_ES", "(", "q_vars", ",", "mass", ")", ":", "# Build the potential energy fluxion; just one pair of bodies", "U", "=", "U_ij", "(", "q_vars", ",", "mass", ",", "0", ",", "1", ")", "# Varname arrays for both the coordinate system and U", "vn_q", "=", ...
Fluxion with the potential energy of the earth-sun sytem
[ "Fluxion", "with", "the", "potential", "energy", "of", "the", "earth", "-", "sun", "sytem" ]
842e9c2d3ca1490cef18c086dfde81856d8d3a82
https://github.com/CS207-Final-Project-Group-10/cs207-FinalProject/blob/842e9c2d3ca1490cef18c086dfde81856d8d3a82/solar_system/earth_sun.py#L215-L228
243,323
delfick/aws_syncr
aws_syncr/option_spec/aws_syncr_specs.py
valid_account_id.validate
def validate(self, meta, val): """Validate an account_id""" val = string_or_int_as_string_spec().normalise(meta, val) if not regexes['amazon_account_id'].match(val): raise BadOption("Account id must match a particular regex", got=val, should_match=regexes['amazon_account_id'].pattern...
python
def validate(self, meta, val): """Validate an account_id""" val = string_or_int_as_string_spec().normalise(meta, val) if not regexes['amazon_account_id'].match(val): raise BadOption("Account id must match a particular regex", got=val, should_match=regexes['amazon_account_id'].pattern...
[ "def", "validate", "(", "self", ",", "meta", ",", "val", ")", ":", "val", "=", "string_or_int_as_string_spec", "(", ")", ".", "normalise", "(", "meta", ",", "val", ")", "if", "not", "regexes", "[", "'amazon_account_id'", "]", ".", "match", "(", "val", ...
Validate an account_id
[ "Validate", "an", "account_id" ]
8cd214b27c1eee98dfba4632cbb8bc0ae36356bd
https://github.com/delfick/aws_syncr/blob/8cd214b27c1eee98dfba4632cbb8bc0ae36356bd/aws_syncr/option_spec/aws_syncr_specs.py#L40-L45
243,324
delfick/aws_syncr
aws_syncr/option_spec/aws_syncr_specs.py
AwsSyncrSpec.aws_syncr_spec
def aws_syncr_spec(self): """Spec for aws_syncr options""" formatted_string = formatted(string_spec(), MergedOptionStringFormatter, expected_type=string_types) return create_spec(AwsSyncr , extra = defaulted(formatted_string, "") , stage = defaulted(formatted_string, "") ...
python
def aws_syncr_spec(self): """Spec for aws_syncr options""" formatted_string = formatted(string_spec(), MergedOptionStringFormatter, expected_type=string_types) return create_spec(AwsSyncr , extra = defaulted(formatted_string, "") , stage = defaulted(formatted_string, "") ...
[ "def", "aws_syncr_spec", "(", "self", ")", ":", "formatted_string", "=", "formatted", "(", "string_spec", "(", ")", ",", "MergedOptionStringFormatter", ",", "expected_type", "=", "string_types", ")", "return", "create_spec", "(", "AwsSyncr", ",", "extra", "=", "...
Spec for aws_syncr options
[ "Spec", "for", "aws_syncr", "options" ]
8cd214b27c1eee98dfba4632cbb8bc0ae36356bd
https://github.com/delfick/aws_syncr/blob/8cd214b27c1eee98dfba4632cbb8bc0ae36356bd/aws_syncr/option_spec/aws_syncr_specs.py#L51-L63
243,325
delfick/aws_syncr
aws_syncr/option_spec/aws_syncr_specs.py
AwsSyncrSpec.accounts_spec
def accounts_spec(self): """Spec for accounts options""" formatted_account_id = formatted(valid_account_id(), MergedOptionStringFormatter, expected_type=string_types) return dictof(string_spec(), formatted_account_id)
python
def accounts_spec(self): """Spec for accounts options""" formatted_account_id = formatted(valid_account_id(), MergedOptionStringFormatter, expected_type=string_types) return dictof(string_spec(), formatted_account_id)
[ "def", "accounts_spec", "(", "self", ")", ":", "formatted_account_id", "=", "formatted", "(", "valid_account_id", "(", ")", ",", "MergedOptionStringFormatter", ",", "expected_type", "=", "string_types", ")", "return", "dictof", "(", "string_spec", "(", ")", ",", ...
Spec for accounts options
[ "Spec", "for", "accounts", "options" ]
8cd214b27c1eee98dfba4632cbb8bc0ae36356bd
https://github.com/delfick/aws_syncr/blob/8cd214b27c1eee98dfba4632cbb8bc0ae36356bd/aws_syncr/option_spec/aws_syncr_specs.py#L66-L69
243,326
sassoo/goldman
goldman/resources/s3_model.py
Resource._gen_s3_path
def _gen_s3_path(self, model, props): """ Return the part of the S3 path based on inputs The path will be passed to the s3_upload method & will ultimately be merged with the standard AWS S3 URL. An example model type of 'users' with a resource ID of 99 & an API endpoint...
python
def _gen_s3_path(self, model, props): """ Return the part of the S3 path based on inputs The path will be passed to the s3_upload method & will ultimately be merged with the standard AWS S3 URL. An example model type of 'users' with a resource ID of 99 & an API endpoint...
[ "def", "_gen_s3_path", "(", "self", ",", "model", ",", "props", ")", ":", "now", "=", "'%.5f'", "%", "time", ".", "time", "(", ")", "return", "'%s/%s/%s/%s.%s'", "%", "(", "model", ".", "rtype", ",", "model", ".", "rid_value", ",", "self", ".", "_s3_...
Return the part of the S3 path based on inputs The path will be passed to the s3_upload method & will ultimately be merged with the standard AWS S3 URL. An example model type of 'users' with a resource ID of 99 & an API endpoint ending with 'photos' will have a path gen...
[ "Return", "the", "part", "of", "the", "S3", "path", "based", "on", "inputs" ]
b72540c9ad06b5c68aadb1b4fa8cb0b716260bf2
https://github.com/sassoo/goldman/blob/b72540c9ad06b5c68aadb1b4fa8cb0b716260bf2/goldman/resources/s3_model.py#L61-L82
243,327
sassoo/goldman
goldman/resources/s3_model.py
Resource.on_post
def on_post(self, req, resp, rid): """ Deserialize the file upload & save it to S3 File uploads are associated with a model of some kind. Ensure the associating model exists first & foremost. """ signals.pre_req.send(self.model) signals.pre_req_upload.send(self....
python
def on_post(self, req, resp, rid): """ Deserialize the file upload & save it to S3 File uploads are associated with a model of some kind. Ensure the associating model exists first & foremost. """ signals.pre_req.send(self.model) signals.pre_req_upload.send(self....
[ "def", "on_post", "(", "self", ",", "req", ",", "resp", ",", "rid", ")", ":", "signals", ".", "pre_req", ".", "send", "(", "self", ".", "model", ")", "signals", ".", "pre_req_upload", ".", "send", "(", "self", ".", "model", ")", "props", "=", "req"...
Deserialize the file upload & save it to S3 File uploads are associated with a model of some kind. Ensure the associating model exists first & foremost.
[ "Deserialize", "the", "file", "upload", "&", "save", "it", "to", "S3" ]
b72540c9ad06b5c68aadb1b4fa8cb0b716260bf2
https://github.com/sassoo/goldman/blob/b72540c9ad06b5c68aadb1b4fa8cb0b716260bf2/goldman/resources/s3_model.py#L84-L118
243,328
astex/sequential
sequential/decorators.py
before
def before(f, chain=False): """Runs f before the decorated function.""" def decorator(g): @wraps(g) def h(*args, **kargs): if chain: return g(f(*args, **kargs)) else: f(*args, **kargs) return g(*args, **kargs) return...
python
def before(f, chain=False): """Runs f before the decorated function.""" def decorator(g): @wraps(g) def h(*args, **kargs): if chain: return g(f(*args, **kargs)) else: f(*args, **kargs) return g(*args, **kargs) return...
[ "def", "before", "(", "f", ",", "chain", "=", "False", ")", ":", "def", "decorator", "(", "g", ")", ":", "@", "wraps", "(", "g", ")", "def", "h", "(", "*", "args", ",", "*", "*", "kargs", ")", ":", "if", "chain", ":", "return", "g", "(", "f...
Runs f before the decorated function.
[ "Runs", "f", "before", "the", "decorated", "function", "." ]
8812d487c33a8f0f1c96336cd27ad2fa942175f6
https://github.com/astex/sequential/blob/8812d487c33a8f0f1c96336cd27ad2fa942175f6/sequential/decorators.py#L5-L16
243,329
astex/sequential
sequential/decorators.py
after
def after(f, chain=False): """Runs f with the result of the decorated function.""" def decorator(g): @wraps(g) def h(*args, **kargs): if chain: return f(g(*args, **kargs)) else: r = g(*args, **kargs) f(*args, **kargs) ...
python
def after(f, chain=False): """Runs f with the result of the decorated function.""" def decorator(g): @wraps(g) def h(*args, **kargs): if chain: return f(g(*args, **kargs)) else: r = g(*args, **kargs) f(*args, **kargs) ...
[ "def", "after", "(", "f", ",", "chain", "=", "False", ")", ":", "def", "decorator", "(", "g", ")", ":", "@", "wraps", "(", "g", ")", "def", "h", "(", "*", "args", ",", "*", "*", "kargs", ")", ":", "if", "chain", ":", "return", "f", "(", "g"...
Runs f with the result of the decorated function.
[ "Runs", "f", "with", "the", "result", "of", "the", "decorated", "function", "." ]
8812d487c33a8f0f1c96336cd27ad2fa942175f6
https://github.com/astex/sequential/blob/8812d487c33a8f0f1c96336cd27ad2fa942175f6/sequential/decorators.py#L19-L31
243,330
astex/sequential
sequential/decorators.py
during
def during(f): """Runs f during the decorated function's execution in a separate thread.""" def decorator(g): @wraps(g) def h(*args, **kargs): tf = Thread(target=f, args=args, kwargs=kargs) tf.start() r = g(*args, **kargs) tf.join() ret...
python
def during(f): """Runs f during the decorated function's execution in a separate thread.""" def decorator(g): @wraps(g) def h(*args, **kargs): tf = Thread(target=f, args=args, kwargs=kargs) tf.start() r = g(*args, **kargs) tf.join() ret...
[ "def", "during", "(", "f", ")", ":", "def", "decorator", "(", "g", ")", ":", "@", "wraps", "(", "g", ")", "def", "h", "(", "*", "args", ",", "*", "*", "kargs", ")", ":", "tf", "=", "Thread", "(", "target", "=", "f", ",", "args", "=", "args"...
Runs f during the decorated function's execution in a separate thread.
[ "Runs", "f", "during", "the", "decorated", "function", "s", "execution", "in", "a", "separate", "thread", "." ]
8812d487c33a8f0f1c96336cd27ad2fa942175f6
https://github.com/astex/sequential/blob/8812d487c33a8f0f1c96336cd27ad2fa942175f6/sequential/decorators.py#L34-L45
243,331
gsamokovarov/frames.py
frames/__init__.py
Frame.current_frame
def current_frame(raw=False): ''' Gives the current execution frame. :returns: The current execution frame that is actually executing this. ''' # `import sys` is important here, because the `sys` module is special # and we will end up with the class frame in...
python
def current_frame(raw=False): ''' Gives the current execution frame. :returns: The current execution frame that is actually executing this. ''' # `import sys` is important here, because the `sys` module is special # and we will end up with the class frame in...
[ "def", "current_frame", "(", "raw", "=", "False", ")", ":", "# `import sys` is important here, because the `sys` module is special", "# and we will end up with the class frame instead of the `current` one.", "if", "NATIVE", ":", "import", "sys", "frame", "=", "sys", ".", "_getf...
Gives the current execution frame. :returns: The current execution frame that is actually executing this.
[ "Gives", "the", "current", "execution", "frame", "." ]
ba43782d043691fb5a388a1e749e0f0edb68a3d7
https://github.com/gsamokovarov/frames.py/blob/ba43782d043691fb5a388a1e749e0f0edb68a3d7/frames/__init__.py#L47-L70
243,332
gsamokovarov/frames.py
frames/__init__.py
Frame.locate
def locate(callback, root_frame=None, include_root=False, raw=False): ''' Locates a frame by criteria. :param callback: One argument function to check the frame against. The frame we are curretly on, is given as that argument. :param root_frame: The r...
python
def locate(callback, root_frame=None, include_root=False, raw=False): ''' Locates a frame by criteria. :param callback: One argument function to check the frame against. The frame we are curretly on, is given as that argument. :param root_frame: The r...
[ "def", "locate", "(", "callback", ",", "root_frame", "=", "None", ",", "include_root", "=", "False", ",", "raw", "=", "False", ")", ":", "def", "get_from", "(", "maybe_callable", ")", ":", "if", "callable", "(", "maybe_callable", ")", ":", "return", "may...
Locates a frame by criteria. :param callback: One argument function to check the frame against. The frame we are curretly on, is given as that argument. :param root_frame: The root frame to start the search from. Can be a callback taking no arguments. ...
[ "Locates", "a", "frame", "by", "criteria", "." ]
ba43782d043691fb5a388a1e749e0f0edb68a3d7
https://github.com/gsamokovarov/frames.py/blob/ba43782d043691fb5a388a1e749e0f0edb68a3d7/frames/__init__.py#L73-L119
243,333
toastdriven/alligator
alligator/tasks.py
Task.to_call
def to_call(self, func, *args, **kwargs): """ Sets the function & its arguments to be called when the task is processed. Ex:: task.to_call(my_function, 1, 'c', another=True) :param func: The callable with business logic to execute :type func: callable ...
python
def to_call(self, func, *args, **kwargs): """ Sets the function & its arguments to be called when the task is processed. Ex:: task.to_call(my_function, 1, 'c', another=True) :param func: The callable with business logic to execute :type func: callable ...
[ "def", "to_call", "(", "self", ",", "func", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "self", ".", "func", "=", "func", "self", ".", "func_args", "=", "args", "self", ".", "func_kwargs", "=", "kwargs" ]
Sets the function & its arguments to be called when the task is processed. Ex:: task.to_call(my_function, 1, 'c', another=True) :param func: The callable with business logic to execute :type func: callable :param args: Positional arguments to pass to the callable ...
[ "Sets", "the", "function", "&", "its", "arguments", "to", "be", "called", "when", "the", "task", "is", "processed", "." ]
f18bcb35b350fc6b0886393f5246d69c892b36c7
https://github.com/toastdriven/alligator/blob/f18bcb35b350fc6b0886393f5246d69c892b36c7/alligator/tasks.py#L73-L93
243,334
toastdriven/alligator
alligator/tasks.py
Task.serialize
def serialize(self): """ Serializes the ``Task`` data for storing in the queue. All data must be JSON-serializable in order to be stored properly. :returns: A JSON strong of the task data. """ data = { 'task_id': self.task_id, 'retries': self.ret...
python
def serialize(self): """ Serializes the ``Task`` data for storing in the queue. All data must be JSON-serializable in order to be stored properly. :returns: A JSON strong of the task data. """ data = { 'task_id': self.task_id, 'retries': self.ret...
[ "def", "serialize", "(", "self", ")", ":", "data", "=", "{", "'task_id'", ":", "self", ".", "task_id", ",", "'retries'", ":", "self", ".", "retries", ",", "'async'", ":", "self", ".", "async", ",", "'module'", ":", "determine_module", "(", "self", ".",...
Serializes the ``Task`` data for storing in the queue. All data must be JSON-serializable in order to be stored properly. :returns: A JSON strong of the task data.
[ "Serializes", "the", "Task", "data", "for", "storing", "in", "the", "queue", "." ]
f18bcb35b350fc6b0886393f5246d69c892b36c7
https://github.com/toastdriven/alligator/blob/f18bcb35b350fc6b0886393f5246d69c892b36c7/alligator/tasks.py#L140-L177
243,335
toastdriven/alligator
alligator/tasks.py
Task.deserialize
def deserialize(cls, data): """ Given some data from the queue, deserializes it into a ``Task`` instance. The data must be similar in format to what comes from ``Task.serialize`` (a JSON-serialized dictionary). Required keys are ``task_id``, ``retries`` & ``async``. ...
python
def deserialize(cls, data): """ Given some data from the queue, deserializes it into a ``Task`` instance. The data must be similar in format to what comes from ``Task.serialize`` (a JSON-serialized dictionary). Required keys are ``task_id``, ``retries`` & ``async``. ...
[ "def", "deserialize", "(", "cls", ",", "data", ")", ":", "data", "=", "json", ".", "loads", "(", "data", ")", "options", "=", "data", ".", "get", "(", "'options'", ",", "{", "}", ")", "task", "=", "cls", "(", "task_id", "=", "data", "[", "'task_i...
Given some data from the queue, deserializes it into a ``Task`` instance. The data must be similar in format to what comes from ``Task.serialize`` (a JSON-serialized dictionary). Required keys are ``task_id``, ``retries`` & ``async``. :param data: A JSON-serialized string of th...
[ "Given", "some", "data", "from", "the", "queue", "deserializes", "it", "into", "a", "Task", "instance", "." ]
f18bcb35b350fc6b0886393f5246d69c892b36c7
https://github.com/toastdriven/alligator/blob/f18bcb35b350fc6b0886393f5246d69c892b36c7/alligator/tasks.py#L180-L225
243,336
toastdriven/alligator
alligator/tasks.py
Task.run
def run(self): """ Runs the task. This fires the ``on_start`` hook function first (if present), passing the task itself. Then it runs the target function supplied via ``Task.to_call`` with its arguments & stores the result. If the target function succeeded, the...
python
def run(self): """ Runs the task. This fires the ``on_start`` hook function first (if present), passing the task itself. Then it runs the target function supplied via ``Task.to_call`` with its arguments & stores the result. If the target function succeeded, the...
[ "def", "run", "(", "self", ")", ":", "if", "self", ".", "on_start", ":", "self", ".", "on_start", "(", "self", ")", "try", ":", "result", "=", "self", ".", "func", "(", "*", "self", ".", "func_args", ",", "*", "*", "self", ".", "func_kwargs", ")"...
Runs the task. This fires the ``on_start`` hook function first (if present), passing the task itself. Then it runs the target function supplied via ``Task.to_call`` with its arguments & stores the result. If the target function succeeded, the ``on_success`` hook function is ...
[ "Runs", "the", "task", "." ]
f18bcb35b350fc6b0886393f5246d69c892b36c7
https://github.com/toastdriven/alligator/blob/f18bcb35b350fc6b0886393f5246d69c892b36c7/alligator/tasks.py#L227-L264
243,337
rameshg87/pyremotevbox
pyremotevbox/ZSI/TCcompound.py
_check_typecode_list
def _check_typecode_list(ofwhat, tcname): '''Check a list of typecodes for compliance with Struct requirements.''' for o in ofwhat: if callable(o): #skip if _Mirage continue if not isinstance(o, TypeCode): raise TypeError( tcname + ' ofwhat outside the...
python
def _check_typecode_list(ofwhat, tcname): '''Check a list of typecodes for compliance with Struct requirements.''' for o in ofwhat: if callable(o): #skip if _Mirage continue if not isinstance(o, TypeCode): raise TypeError( tcname + ' ofwhat outside the...
[ "def", "_check_typecode_list", "(", "ofwhat", ",", "tcname", ")", ":", "for", "o", "in", "ofwhat", ":", "if", "callable", "(", "o", ")", ":", "#skip if _Mirage", "continue", "if", "not", "isinstance", "(", "o", ",", "TypeCode", ")", ":", "raise", "TypeEr...
Check a list of typecodes for compliance with Struct requirements.
[ "Check", "a", "list", "of", "typecodes", "for", "compliance", "with", "Struct", "requirements", "." ]
123dffff27da57c8faa3ac1dd4c68b1cf4558b1a
https://github.com/rameshg87/pyremotevbox/blob/123dffff27da57c8faa3ac1dd4c68b1cf4558b1a/pyremotevbox/ZSI/TCcompound.py#L30-L41
243,338
rameshg87/pyremotevbox
pyremotevbox/ZSI/TCcompound.py
_get_type_or_substitute
def _get_type_or_substitute(typecode, pyobj, sw, elt): '''return typecode or substitute type for wildcard or derived type. For serialization only. ''' sub = getattr(pyobj, 'typecode', typecode) if sub is typecode or sub is None: return typecode # Element WildCard if isinstance(type...
python
def _get_type_or_substitute(typecode, pyobj, sw, elt): '''return typecode or substitute type for wildcard or derived type. For serialization only. ''' sub = getattr(pyobj, 'typecode', typecode) if sub is typecode or sub is None: return typecode # Element WildCard if isinstance(type...
[ "def", "_get_type_or_substitute", "(", "typecode", ",", "pyobj", ",", "sw", ",", "elt", ")", ":", "sub", "=", "getattr", "(", "pyobj", ",", "'typecode'", ",", "typecode", ")", "if", "sub", "is", "typecode", "or", "sub", "is", "None", ":", "return", "ty...
return typecode or substitute type for wildcard or derived type. For serialization only.
[ "return", "typecode", "or", "substitute", "type", "for", "wildcard", "or", "derived", "type", ".", "For", "serialization", "only", "." ]
123dffff27da57c8faa3ac1dd4c68b1cf4558b1a
https://github.com/rameshg87/pyremotevbox/blob/123dffff27da57c8faa3ac1dd4c68b1cf4558b1a/pyremotevbox/ZSI/TCcompound.py#L44-L86
243,339
rameshg87/pyremotevbox
pyremotevbox/ZSI/TCcompound.py
ComplexType.setDerivedTypeContents
def setDerivedTypeContents(self, extensions=None, restrictions=None): """For derived types set appropriate parameter and """ if extensions: ofwhat = list(self.ofwhat) if type(extensions) in _seqtypes: ofwhat += list(extensions) else: ...
python
def setDerivedTypeContents(self, extensions=None, restrictions=None): """For derived types set appropriate parameter and """ if extensions: ofwhat = list(self.ofwhat) if type(extensions) in _seqtypes: ofwhat += list(extensions) else: ...
[ "def", "setDerivedTypeContents", "(", "self", ",", "extensions", "=", "None", ",", "restrictions", "=", "None", ")", ":", "if", "extensions", ":", "ofwhat", "=", "list", "(", "self", ".", "ofwhat", ")", "if", "type", "(", "extensions", ")", "in", "_seqty...
For derived types set appropriate parameter and
[ "For", "derived", "types", "set", "appropriate", "parameter", "and" ]
123dffff27da57c8faa3ac1dd4c68b1cf4558b1a
https://github.com/rameshg87/pyremotevbox/blob/123dffff27da57c8faa3ac1dd4c68b1cf4558b1a/pyremotevbox/ZSI/TCcompound.py#L440-L457
243,340
evfredericksen/pynacea
pynhost/pynhost/commands.py
ActionList.contains_non_repeat_actions
def contains_non_repeat_actions(self): ''' Because repeating repeat actions can get ugly real fast ''' for action in self.actions: if not isinstance(action, (int, dynamic.RepeatCommand)): return True return False
python
def contains_non_repeat_actions(self): ''' Because repeating repeat actions can get ugly real fast ''' for action in self.actions: if not isinstance(action, (int, dynamic.RepeatCommand)): return True return False
[ "def", "contains_non_repeat_actions", "(", "self", ")", ":", "for", "action", "in", "self", ".", "actions", ":", "if", "not", "isinstance", "(", "action", ",", "(", "int", ",", "dynamic", ".", "RepeatCommand", ")", ")", ":", "return", "True", "return", "...
Because repeating repeat actions can get ugly real fast
[ "Because", "repeating", "repeat", "actions", "can", "get", "ugly", "real", "fast" ]
63ee0e6695209048bf2571aa2c3770f502e29b0a
https://github.com/evfredericksen/pynacea/blob/63ee0e6695209048bf2571aa2c3770f502e29b0a/pynhost/pynhost/commands.py#L67-L74
243,341
edeposit/edeposit.amqp.ftp
src/edeposit/amqp/ftp/decoders/validator.py
_all_correct_list
def _all_correct_list(array): """ Make sure, that all items in `array` has good type and size. Args: array (list): Array of python types. Returns: True/False """ if type(array) not in _ITERABLE_TYPES: return False for item in array: if not type(item) in _IT...
python
def _all_correct_list(array): """ Make sure, that all items in `array` has good type and size. Args: array (list): Array of python types. Returns: True/False """ if type(array) not in _ITERABLE_TYPES: return False for item in array: if not type(item) in _IT...
[ "def", "_all_correct_list", "(", "array", ")", ":", "if", "type", "(", "array", ")", "not", "in", "_ITERABLE_TYPES", ":", "return", "False", "for", "item", "in", "array", ":", "if", "not", "type", "(", "item", ")", "in", "_ITERABLE_TYPES", ":", "return",...
Make sure, that all items in `array` has good type and size. Args: array (list): Array of python types. Returns: True/False
[ "Make", "sure", "that", "all", "items", "in", "array", "has", "good", "type", "and", "size", "." ]
fcdcbffb6e5d194e1bb4f85f0b8eaa9dbb08aa71
https://github.com/edeposit/edeposit.amqp.ftp/blob/fcdcbffb6e5d194e1bb4f85f0b8eaa9dbb08aa71/src/edeposit/amqp/ftp/decoders/validator.py#L220-L240
243,342
edeposit/edeposit.amqp.ftp
src/edeposit/amqp/ftp/decoders/validator.py
_convert_to_dict
def _convert_to_dict(data): """ Convert `data` to dictionary. Tries to get sense in multidimensional arrays. Args: data: List/dict/tuple of variable dimension. Returns: dict: If the data can be converted to dictionary. Raises: MetaParsingException: When the data are u...
python
def _convert_to_dict(data): """ Convert `data` to dictionary. Tries to get sense in multidimensional arrays. Args: data: List/dict/tuple of variable dimension. Returns: dict: If the data can be converted to dictionary. Raises: MetaParsingException: When the data are u...
[ "def", "_convert_to_dict", "(", "data", ")", ":", "if", "isinstance", "(", "data", ",", "dict", ")", ":", "return", "data", "if", "isinstance", "(", "data", ",", "list", ")", "or", "isinstance", "(", "data", ",", "tuple", ")", ":", "if", "_all_correct_...
Convert `data` to dictionary. Tries to get sense in multidimensional arrays. Args: data: List/dict/tuple of variable dimension. Returns: dict: If the data can be converted to dictionary. Raises: MetaParsingException: When the data are unconvertible to dict.
[ "Convert", "data", "to", "dictionary", "." ]
fcdcbffb6e5d194e1bb4f85f0b8eaa9dbb08aa71
https://github.com/edeposit/edeposit.amqp.ftp/blob/fcdcbffb6e5d194e1bb4f85f0b8eaa9dbb08aa71/src/edeposit/amqp/ftp/decoders/validator.py#L243-L270
243,343
edeposit/edeposit.amqp.ftp
src/edeposit/amqp/ftp/decoders/validator.py
check_structure
def check_structure(data): """ Check whether the structure is flat dictionary. If not, try to convert it to dictionary. Args: data: Whatever data you have (dict/tuple/list). Returns: dict: When the conversion was successful or `data` was already `good`. Raises: MetaPar...
python
def check_structure(data): """ Check whether the structure is flat dictionary. If not, try to convert it to dictionary. Args: data: Whatever data you have (dict/tuple/list). Returns: dict: When the conversion was successful or `data` was already `good`. Raises: MetaPar...
[ "def", "check_structure", "(", "data", ")", ":", "if", "not", "isinstance", "(", "data", ",", "dict", ")", ":", "try", ":", "data", "=", "_convert_to_dict", "(", "data", ")", "except", "MetaParsingException", ":", "raise", "except", ":", "raise", "MetaPars...
Check whether the structure is flat dictionary. If not, try to convert it to dictionary. Args: data: Whatever data you have (dict/tuple/list). Returns: dict: When the conversion was successful or `data` was already `good`. Raises: MetaParsingException: When the data couldn't b...
[ "Check", "whether", "the", "structure", "is", "flat", "dictionary", ".", "If", "not", "try", "to", "convert", "it", "to", "dictionary", "." ]
fcdcbffb6e5d194e1bb4f85f0b8eaa9dbb08aa71
https://github.com/edeposit/edeposit.amqp.ftp/blob/fcdcbffb6e5d194e1bb4f85f0b8eaa9dbb08aa71/src/edeposit/amqp/ftp/decoders/validator.py#L273-L312
243,344
edeposit/edeposit.amqp.ftp
src/edeposit/amqp/ftp/decoders/validator.py
Field._remove_accents
def _remove_accents(self, input_str): """ Convert unicode string to ASCII. Credit: http://stackoverflow.com/a/517974 """ nkfd_form = unicodedata.normalize('NFKD', input_str) return u"".join([c for c in nkfd_form if not unicodedata.combining(c)])
python
def _remove_accents(self, input_str): """ Convert unicode string to ASCII. Credit: http://stackoverflow.com/a/517974 """ nkfd_form = unicodedata.normalize('NFKD', input_str) return u"".join([c for c in nkfd_form if not unicodedata.combining(c)])
[ "def", "_remove_accents", "(", "self", ",", "input_str", ")", ":", "nkfd_form", "=", "unicodedata", ".", "normalize", "(", "'NFKD'", ",", "input_str", ")", "return", "u\"\"", ".", "join", "(", "[", "c", "for", "c", "in", "nkfd_form", "if", "not", "unicod...
Convert unicode string to ASCII. Credit: http://stackoverflow.com/a/517974
[ "Convert", "unicode", "string", "to", "ASCII", "." ]
fcdcbffb6e5d194e1bb4f85f0b8eaa9dbb08aa71
https://github.com/edeposit/edeposit.amqp.ftp/blob/fcdcbffb6e5d194e1bb4f85f0b8eaa9dbb08aa71/src/edeposit/amqp/ftp/decoders/validator.py#L111-L118
243,345
edeposit/edeposit.amqp.ftp
src/edeposit/amqp/ftp/decoders/validator.py
FieldParser.process
def process(self, key, val): """ Try to look for `key` in all required and optional fields. If found, set the `val`. """ for field in self.fields: if field.check(key, val): return for field in self.optional: if field.check(key, val...
python
def process(self, key, val): """ Try to look for `key` in all required and optional fields. If found, set the `val`. """ for field in self.fields: if field.check(key, val): return for field in self.optional: if field.check(key, val...
[ "def", "process", "(", "self", ",", "key", ",", "val", ")", ":", "for", "field", "in", "self", ".", "fields", ":", "if", "field", ".", "check", "(", "key", ",", "val", ")", ":", "return", "for", "field", "in", "self", ".", "optional", ":", "if", ...
Try to look for `key` in all required and optional fields. If found, set the `val`.
[ "Try", "to", "look", "for", "key", "in", "all", "required", "and", "optional", "fields", ".", "If", "found", "set", "the", "val", "." ]
fcdcbffb6e5d194e1bb4f85f0b8eaa9dbb08aa71
https://github.com/edeposit/edeposit.amqp.ftp/blob/fcdcbffb6e5d194e1bb4f85f0b8eaa9dbb08aa71/src/edeposit/amqp/ftp/decoders/validator.py#L158-L169
243,346
riccardocagnasso/useless
src/useless/common/structures.py
Structure.get_size
def get_size(cls): """ Total byte size of fields in this structure => total byte size of the structure on the file """ return sum([getattr(cls, name).length for name in cls.get_fields_names()])
python
def get_size(cls): """ Total byte size of fields in this structure => total byte size of the structure on the file """ return sum([getattr(cls, name).length for name in cls.get_fields_names()])
[ "def", "get_size", "(", "cls", ")", ":", "return", "sum", "(", "[", "getattr", "(", "cls", ",", "name", ")", ".", "length", "for", "name", "in", "cls", ".", "get_fields_names", "(", ")", "]", ")" ]
Total byte size of fields in this structure => total byte size of the structure on the file
[ "Total", "byte", "size", "of", "fields", "in", "this", "structure", "=", ">", "total", "byte", "size", "of", "the", "structure", "on", "the", "file" ]
5167aab82958f653148e3689c9a7e548d4fa2cba
https://github.com/riccardocagnasso/useless/blob/5167aab82958f653148e3689c9a7e548d4fa2cba/src/useless/common/structures.py#L79-L85
243,347
Aperture-py/aperture-lib
aperturelib/__init__.py
format_image
def format_image(path, options): '''Formats an image. Args: path (str): Path to the image file. options (dict): Options to apply to the image. Returns: (list) A list of PIL images. The list will always be of length 1 unless resolutions for resizing are provided in the optio...
python
def format_image(path, options): '''Formats an image. Args: path (str): Path to the image file. options (dict): Options to apply to the image. Returns: (list) A list of PIL images. The list will always be of length 1 unless resolutions for resizing are provided in the optio...
[ "def", "format_image", "(", "path", ",", "options", ")", ":", "image", "=", "Image", ".", "open", "(", "path", ")", "image_pipeline_results", "=", "__pipeline_image", "(", "image", ",", "options", ")", "return", "image_pipeline_results" ]
Formats an image. Args: path (str): Path to the image file. options (dict): Options to apply to the image. Returns: (list) A list of PIL images. The list will always be of length 1 unless resolutions for resizing are provided in the options.
[ "Formats", "an", "image", "." ]
5c54af216319f297ddf96181a16f088cf1ba23f3
https://github.com/Aperture-py/aperture-lib/blob/5c54af216319f297ddf96181a16f088cf1ba23f3/aperturelib/__init__.py#L26-L39
243,348
nefarioustim/parker
parker/redisset.py
get_instance
def get_instance(key, expire=None): """Return an instance of RedisSet.""" global _instances try: instance = _instances[key] except KeyError: instance = RedisSet( key, _redis, expire=expire ) _instances[key] = instance return instan...
python
def get_instance(key, expire=None): """Return an instance of RedisSet.""" global _instances try: instance = _instances[key] except KeyError: instance = RedisSet( key, _redis, expire=expire ) _instances[key] = instance return instan...
[ "def", "get_instance", "(", "key", ",", "expire", "=", "None", ")", ":", "global", "_instances", "try", ":", "instance", "=", "_instances", "[", "key", "]", "except", "KeyError", ":", "instance", "=", "RedisSet", "(", "key", ",", "_redis", ",", "expire",...
Return an instance of RedisSet.
[ "Return", "an", "instance", "of", "RedisSet", "." ]
ccc1de1ac6bfb5e0a8cfa4fdebb2f38f2ee027d6
https://github.com/nefarioustim/parker/blob/ccc1de1ac6bfb5e0a8cfa4fdebb2f38f2ee027d6/parker/redisset.py#L14-L27
243,349
nefarioustim/parker
parker/redisset.py
RedisSet.add
def add(self, value): """Add value to set.""" added = self.redis.sadd( self.key, value ) if self.redis.scard(self.key) < 2: self.redis.expire(self.key, self.expire) return added
python
def add(self, value): """Add value to set.""" added = self.redis.sadd( self.key, value ) if self.redis.scard(self.key) < 2: self.redis.expire(self.key, self.expire) return added
[ "def", "add", "(", "self", ",", "value", ")", ":", "added", "=", "self", ".", "redis", ".", "sadd", "(", "self", ".", "key", ",", "value", ")", "if", "self", ".", "redis", ".", "scard", "(", "self", ".", "key", ")", "<", "2", ":", "self", "."...
Add value to set.
[ "Add", "value", "to", "set", "." ]
ccc1de1ac6bfb5e0a8cfa4fdebb2f38f2ee027d6
https://github.com/nefarioustim/parker/blob/ccc1de1ac6bfb5e0a8cfa4fdebb2f38f2ee027d6/parker/redisset.py#L51-L61
243,350
pybel/pybel-artifactory
src/pybel_artifactory/cli.py
write
def write(name, keyword, domain, citation, author, description, species, version, contact, licenses, values, functions, output, value_prefix): """Build a namespace from items.""" write_namespace( name, keyword, domain, author, citation, values, namespace_description=description, ...
python
def write(name, keyword, domain, citation, author, description, species, version, contact, licenses, values, functions, output, value_prefix): """Build a namespace from items.""" write_namespace( name, keyword, domain, author, citation, values, namespace_description=description, ...
[ "def", "write", "(", "name", ",", "keyword", ",", "domain", ",", "citation", ",", "author", ",", "description", ",", "species", ",", "version", ",", "contact", ",", "licenses", ",", "values", ",", "functions", ",", "output", ",", "value_prefix", ")", ":"...
Build a namespace from items.
[ "Build", "a", "namespace", "from", "items", "." ]
720107780a59be2ef08885290dfa519b1da62871
https://github.com/pybel/pybel-artifactory/blob/720107780a59be2ef08885290dfa519b1da62871/src/pybel_artifactory/cli.py#L43-L56
243,351
pybel/pybel-artifactory
src/pybel_artifactory/cli.py
history
def history(namespace_module): """Hash all versions on Artifactory.""" for path in get_namespace_history(namespace_module): h = get_bel_resource_hash(path.as_posix()) click.echo('{}\t{}'.format(path, h))
python
def history(namespace_module): """Hash all versions on Artifactory.""" for path in get_namespace_history(namespace_module): h = get_bel_resource_hash(path.as_posix()) click.echo('{}\t{}'.format(path, h))
[ "def", "history", "(", "namespace_module", ")", ":", "for", "path", "in", "get_namespace_history", "(", "namespace_module", ")", ":", "h", "=", "get_bel_resource_hash", "(", "path", ".", "as_posix", "(", ")", ")", "click", ".", "echo", "(", "'{}\\t{}'", ".",...
Hash all versions on Artifactory.
[ "Hash", "all", "versions", "on", "Artifactory", "." ]
720107780a59be2ef08885290dfa519b1da62871
https://github.com/pybel/pybel-artifactory/blob/720107780a59be2ef08885290dfa519b1da62871/src/pybel_artifactory/cli.py#L79-L83
243,352
pybel/pybel-artifactory
src/pybel_artifactory/cli.py
convert_to_annotation
def convert_to_annotation(file, output): """Convert a namespace file to an annotation file.""" resource = parse_bel_resource(file) write_annotation( keyword=resource['Namespace']['Keyword'], values={k: '' for k in resource['Values']}, citation_name=resource['Citation']['NameString']...
python
def convert_to_annotation(file, output): """Convert a namespace file to an annotation file.""" resource = parse_bel_resource(file) write_annotation( keyword=resource['Namespace']['Keyword'], values={k: '' for k in resource['Values']}, citation_name=resource['Citation']['NameString']...
[ "def", "convert_to_annotation", "(", "file", ",", "output", ")", ":", "resource", "=", "parse_bel_resource", "(", "file", ")", "write_annotation", "(", "keyword", "=", "resource", "[", "'Namespace'", "]", "[", "'Keyword'", "]", ",", "values", "=", "{", "k", ...
Convert a namespace file to an annotation file.
[ "Convert", "a", "namespace", "file", "to", "an", "annotation", "file", "." ]
720107780a59be2ef08885290dfa519b1da62871
https://github.com/pybel/pybel-artifactory/blob/720107780a59be2ef08885290dfa519b1da62871/src/pybel_artifactory/cli.py#L90-L100
243,353
pybel/pybel-artifactory
src/pybel_artifactory/cli.py
history
def history(annotation_module): """Output the hashes for the annotation resources' versions.""" for path in get_annotation_history(annotation_module): h = get_bel_resource_hash(path.as_posix()) click.echo('{}\t{}'.format(path, h))
python
def history(annotation_module): """Output the hashes for the annotation resources' versions.""" for path in get_annotation_history(annotation_module): h = get_bel_resource_hash(path.as_posix()) click.echo('{}\t{}'.format(path, h))
[ "def", "history", "(", "annotation_module", ")", ":", "for", "path", "in", "get_annotation_history", "(", "annotation_module", ")", ":", "h", "=", "get_bel_resource_hash", "(", "path", ".", "as_posix", "(", ")", ")", "click", ".", "echo", "(", "'{}\\t{}'", "...
Output the hashes for the annotation resources' versions.
[ "Output", "the", "hashes", "for", "the", "annotation", "resources", "versions", "." ]
720107780a59be2ef08885290dfa519b1da62871
https://github.com/pybel/pybel-artifactory/blob/720107780a59be2ef08885290dfa519b1da62871/src/pybel_artifactory/cli.py#L110-L114
243,354
pybel/pybel-artifactory
src/pybel_artifactory/cli.py
convert_to_namespace
def convert_to_namespace(file, output, keyword): """Convert an annotation file to a namespace file.""" resource = parse_bel_resource(file) write_namespace( namespace_keyword=(keyword or resource['AnnotationDefinition']['Keyword']), namespace_name=resource['AnnotationDefinition']['Keyword'], ...
python
def convert_to_namespace(file, output, keyword): """Convert an annotation file to a namespace file.""" resource = parse_bel_resource(file) write_namespace( namespace_keyword=(keyword or resource['AnnotationDefinition']['Keyword']), namespace_name=resource['AnnotationDefinition']['Keyword'], ...
[ "def", "convert_to_namespace", "(", "file", ",", "output", ",", "keyword", ")", ":", "resource", "=", "parse_bel_resource", "(", "file", ")", "write_namespace", "(", "namespace_keyword", "=", "(", "keyword", "or", "resource", "[", "'AnnotationDefinition'", "]", ...
Convert an annotation file to a namespace file.
[ "Convert", "an", "annotation", "file", "to", "a", "namespace", "file", "." ]
720107780a59be2ef08885290dfa519b1da62871
https://github.com/pybel/pybel-artifactory/blob/720107780a59be2ef08885290dfa519b1da62871/src/pybel_artifactory/cli.py#L129-L141
243,355
nefarioustim/parker
parker/client.py
get_proxy
def get_proxy(): """Return a random proxy from proxy config.""" proxies = _config['proxies'] return proxies[ random.randint(0, len(proxies) - 1) ] if len(proxies) > 0 else None
python
def get_proxy(): """Return a random proxy from proxy config.""" proxies = _config['proxies'] return proxies[ random.randint(0, len(proxies) - 1) ] if len(proxies) > 0 else None
[ "def", "get_proxy", "(", ")", ":", "proxies", "=", "_config", "[", "'proxies'", "]", "return", "proxies", "[", "random", ".", "randint", "(", "0", ",", "len", "(", "proxies", ")", "-", "1", ")", "]", "if", "len", "(", "proxies", ")", ">", "0", "e...
Return a random proxy from proxy config.
[ "Return", "a", "random", "proxy", "from", "proxy", "config", "." ]
ccc1de1ac6bfb5e0a8cfa4fdebb2f38f2ee027d6
https://github.com/nefarioustim/parker/blob/ccc1de1ac6bfb5e0a8cfa4fdebb2f38f2ee027d6/parker/client.py#L14-L20
243,356
nefarioustim/parker
parker/client.py
get_instance
def get_instance(): """Return an instance of Client.""" global _instances user_agents = _config['user-agents'] user_agent = user_agents[ random.randint(0, len(user_agents) - 1) ] if len(user_agents) > 0 else DEFAULT_UA instance_key = user_agent try: instance = _instances[i...
python
def get_instance(): """Return an instance of Client.""" global _instances user_agents = _config['user-agents'] user_agent = user_agents[ random.randint(0, len(user_agents) - 1) ] if len(user_agents) > 0 else DEFAULT_UA instance_key = user_agent try: instance = _instances[i...
[ "def", "get_instance", "(", ")", ":", "global", "_instances", "user_agents", "=", "_config", "[", "'user-agents'", "]", "user_agent", "=", "user_agents", "[", "random", ".", "randint", "(", "0", ",", "len", "(", "user_agents", ")", "-", "1", ")", "]", "i...
Return an instance of Client.
[ "Return", "an", "instance", "of", "Client", "." ]
ccc1de1ac6bfb5e0a8cfa4fdebb2f38f2ee027d6
https://github.com/nefarioustim/parker/blob/ccc1de1ac6bfb5e0a8cfa4fdebb2f38f2ee027d6/parker/client.py#L23-L40
243,357
nefarioustim/parker
parker/client.py
Client.get
def get(self, uri, disable_proxy=False, stream=False): """Return Requests response to GET request.""" response = requests.get( uri, headers=self.headers, allow_redirects=True, cookies={}, stream=stream, proxies=self.proxy if not dis...
python
def get(self, uri, disable_proxy=False, stream=False): """Return Requests response to GET request.""" response = requests.get( uri, headers=self.headers, allow_redirects=True, cookies={}, stream=stream, proxies=self.proxy if not dis...
[ "def", "get", "(", "self", ",", "uri", ",", "disable_proxy", "=", "False", ",", "stream", "=", "False", ")", ":", "response", "=", "requests", ".", "get", "(", "uri", ",", "headers", "=", "self", ".", "headers", ",", "allow_redirects", "=", "True", "...
Return Requests response to GET request.
[ "Return", "Requests", "response", "to", "GET", "request", "." ]
ccc1de1ac6bfb5e0a8cfa4fdebb2f38f2ee027d6
https://github.com/nefarioustim/parker/blob/ccc1de1ac6bfb5e0a8cfa4fdebb2f38f2ee027d6/parker/client.py#L73-L90
243,358
nefarioustim/parker
parker/client.py
Client.get_content
def get_content(self, uri, disable_proxy=False): """Return content from URI if Response status is good.""" return self.get(uri=uri, disable_proxy=disable_proxy)
python
def get_content(self, uri, disable_proxy=False): """Return content from URI if Response status is good.""" return self.get(uri=uri, disable_proxy=disable_proxy)
[ "def", "get_content", "(", "self", ",", "uri", ",", "disable_proxy", "=", "False", ")", ":", "return", "self", ".", "get", "(", "uri", "=", "uri", ",", "disable_proxy", "=", "disable_proxy", ")" ]
Return content from URI if Response status is good.
[ "Return", "content", "from", "URI", "if", "Response", "status", "is", "good", "." ]
ccc1de1ac6bfb5e0a8cfa4fdebb2f38f2ee027d6
https://github.com/nefarioustim/parker/blob/ccc1de1ac6bfb5e0a8cfa4fdebb2f38f2ee027d6/parker/client.py#L92-L94
243,359
nefarioustim/parker
parker/client.py
Client.get_iter_content
def get_iter_content(self, uri, disable_proxy=False): """Return iterable content from URI if Response status is good.""" return self.get(uri=uri, disable_proxy=disable_proxy, stream=True)
python
def get_iter_content(self, uri, disable_proxy=False): """Return iterable content from URI if Response status is good.""" return self.get(uri=uri, disable_proxy=disable_proxy, stream=True)
[ "def", "get_iter_content", "(", "self", ",", "uri", ",", "disable_proxy", "=", "False", ")", ":", "return", "self", ".", "get", "(", "uri", "=", "uri", ",", "disable_proxy", "=", "disable_proxy", ",", "stream", "=", "True", ")" ]
Return iterable content from URI if Response status is good.
[ "Return", "iterable", "content", "from", "URI", "if", "Response", "status", "is", "good", "." ]
ccc1de1ac6bfb5e0a8cfa4fdebb2f38f2ee027d6
https://github.com/nefarioustim/parker/blob/ccc1de1ac6bfb5e0a8cfa4fdebb2f38f2ee027d6/parker/client.py#L96-L98
243,360
Akhail/Tebless
tebless/utils/__init__.py
dict_diff
def dict_diff(first, second): """ Return a dict of keys that differ with another config object. If a value is not found in one fo the configs, it will be represented by KEYNOTFOUND. @param first: Fist dictionary to diff. @param second: Second dicationary to diff. @return diff: Dict of Key =...
python
def dict_diff(first, second): """ Return a dict of keys that differ with another config object. If a value is not found in one fo the configs, it will be represented by KEYNOTFOUND. @param first: Fist dictionary to diff. @param second: Second dicationary to diff. @return diff: Dict of Key =...
[ "def", "dict_diff", "(", "first", ",", "second", ")", ":", "diff", "=", "{", "}", "# Check all keys in first dict", "for", "key", "in", "first", ":", "if", "key", "not", "in", "second", ":", "diff", "[", "key", "]", "=", "(", "first", "[", "key", "]"...
Return a dict of keys that differ with another config object. If a value is not found in one fo the configs, it will be represented by KEYNOTFOUND. @param first: Fist dictionary to diff. @param second: Second dicationary to diff. @return diff: Dict of Key => (first.val, second.val)
[ "Return", "a", "dict", "of", "keys", "that", "differ", "with", "another", "config", "object", ".", "If", "a", "value", "is", "not", "found", "in", "one", "fo", "the", "configs", "it", "will", "be", "represented", "by", "KEYNOTFOUND", "." ]
369ff76f06e7a0b6d04fabc287fa6c4095e158d4
https://github.com/Akhail/Tebless/blob/369ff76f06e7a0b6d04fabc287fa6c4095e158d4/tebless/utils/__init__.py#L13-L32
243,361
RonenNess/Fileter
fileter/iterators/concat_files.py
ConcatFiles.process_file
def process_file(self, path, dryrun): """ Concat files and return filename. """ # special case - skip output file so we won't include it in result if path == self._output_path: return None # if dryrun skip and return file if dryrun: return...
python
def process_file(self, path, dryrun): """ Concat files and return filename. """ # special case - skip output file so we won't include it in result if path == self._output_path: return None # if dryrun skip and return file if dryrun: return...
[ "def", "process_file", "(", "self", ",", "path", ",", "dryrun", ")", ":", "# special case - skip output file so we won't include it in result", "if", "path", "==", "self", ".", "_output_path", ":", "return", "None", "# if dryrun skip and return file", "if", "dryrun", ":...
Concat files and return filename.
[ "Concat", "files", "and", "return", "filename", "." ]
5372221b4049d5d46a9926573b91af17681c81f3
https://github.com/RonenNess/Fileter/blob/5372221b4049d5d46a9926573b91af17681c81f3/fileter/iterators/concat_files.py#L41-L59
243,362
maxfischer2781/chainlet
chainlet/primitives/chain.py
Chain._chain_forks
def _chain_forks(elements): """Detect whether a sequence of elements leads to a fork of streams""" # we are only interested in the result, so unwind from the end for element in reversed(elements): if element.chain_fork: return True elif element.chain_join:...
python
def _chain_forks(elements): """Detect whether a sequence of elements leads to a fork of streams""" # we are only interested in the result, so unwind from the end for element in reversed(elements): if element.chain_fork: return True elif element.chain_join:...
[ "def", "_chain_forks", "(", "elements", ")", ":", "# we are only interested in the result, so unwind from the end", "for", "element", "in", "reversed", "(", "elements", ")", ":", "if", "element", ".", "chain_fork", ":", "return", "True", "elif", "element", ".", "cha...
Detect whether a sequence of elements leads to a fork of streams
[ "Detect", "whether", "a", "sequence", "of", "elements", "leads", "to", "a", "fork", "of", "streams" ]
4e17f9992b4780bd0d9309202e2847df640bffe8
https://github.com/maxfischer2781/chainlet/blob/4e17f9992b4780bd0d9309202e2847df640bffe8/chainlet/primitives/chain.py#L66-L74
243,363
walidsa3d/videoscene
videoscene/core.py
parse
def parse(filename): """ parse a scene release string and return a dictionary of parsed values.""" screensize = re.compile('720p|1080p', re.I) source = re.compile( '\.(AHDTV|MBluRay|MDVDR|CAM|TS|TELESYNC|DVDSCR|DVD9|BDSCR|DDC|R5LINE|R5|DVDRip|HDRip|BRRip|BDRip|WEBRip|WEB-?HD|HDtv|PDTV|WEBDL|BluRay)'...
python
def parse(filename): """ parse a scene release string and return a dictionary of parsed values.""" screensize = re.compile('720p|1080p', re.I) source = re.compile( '\.(AHDTV|MBluRay|MDVDR|CAM|TS|TELESYNC|DVDSCR|DVD9|BDSCR|DDC|R5LINE|R5|DVDRip|HDRip|BRRip|BDRip|WEBRip|WEB-?HD|HDtv|PDTV|WEBDL|BluRay)'...
[ "def", "parse", "(", "filename", ")", ":", "screensize", "=", "re", ".", "compile", "(", "'720p|1080p'", ",", "re", ".", "I", ")", "source", "=", "re", ".", "compile", "(", "'\\.(AHDTV|MBluRay|MDVDR|CAM|TS|TELESYNC|DVDSCR|DVD9|BDSCR|DDC|R5LINE|R5|DVDRip|HDRip|BRRip|BD...
parse a scene release string and return a dictionary of parsed values.
[ "parse", "a", "scene", "release", "string", "and", "return", "a", "dictionary", "of", "parsed", "values", "." ]
3212f8cd7b746b78f76687a60326183bcf5f2e1b
https://github.com/walidsa3d/videoscene/blob/3212f8cd7b746b78f76687a60326183bcf5f2e1b/videoscene/core.py#L7-L57
243,364
xaptum/xtt-python
xtt/certificates.py
generate_ecdsap256_server_certificate
def generate_ecdsap256_server_certificate(server_id, server_pub_key, expiry, root_id, root_priv_key): """ Creates a new server certificate signed by the provided root. :param Identity server_id: the identity for the certificate :param ECDSAP256PublicKey server_pu...
python
def generate_ecdsap256_server_certificate(server_id, server_pub_key, expiry, root_id, root_priv_key): """ Creates a new server certificate signed by the provided root. :param Identity server_id: the identity for the certificate :param ECDSAP256PublicKey server_pu...
[ "def", "generate_ecdsap256_server_certificate", "(", "server_id", ",", "server_pub_key", ",", "expiry", ",", "root_id", ",", "root_priv_key", ")", ":", "cert", "=", "ECDSAP256ServerCertificate", "(", ")", "rc", "=", "_lib", ".", "xtt_generate_server_certificate_ecdsap25...
Creates a new server certificate signed by the provided root. :param Identity server_id: the identity for the certificate :param ECDSAP256PublicKey server_pub_key: the public key for the certificate :param CertificateExpiry expiry: the expiry date for the certificate :param CertificateRootId root_id: t...
[ "Creates", "a", "new", "server", "certificate", "signed", "by", "the", "provided", "root", "." ]
23ee469488d710d730314bec1136c4dd7ac2cd5c
https://github.com/xaptum/xtt-python/blob/23ee469488d710d730314bec1136c4dd7ac2cd5c/xtt/certificates.py#L35-L57
243,365
radjkarl/fancyTools
fancytools/math/Point3D.py
Point3D.project
def project(self, win_width, win_height, fov, viewer_distance): """ Transforms this 3D point to 2D using a perspective projection. """ factor = fov / (viewer_distance + self.z) x = self.x * factor + win_width // 2 y = -self.y * factor + win_height // 2 return Point3D(x, y, 1)
python
def project(self, win_width, win_height, fov, viewer_distance): """ Transforms this 3D point to 2D using a perspective projection. """ factor = fov / (viewer_distance + self.z) x = self.x * factor + win_width // 2 y = -self.y * factor + win_height // 2 return Point3D(x, y, 1)
[ "def", "project", "(", "self", ",", "win_width", ",", "win_height", ",", "fov", ",", "viewer_distance", ")", ":", "factor", "=", "fov", "/", "(", "viewer_distance", "+", "self", ".", "z", ")", "x", "=", "self", ".", "x", "*", "factor", "+", "win_widt...
Transforms this 3D point to 2D using a perspective projection.
[ "Transforms", "this", "3D", "point", "to", "2D", "using", "a", "perspective", "projection", "." ]
4c4d961003dc4ed6e46429a0c24f7e2bb52caa8b
https://github.com/radjkarl/fancyTools/blob/4c4d961003dc4ed6e46429a0c24f7e2bb52caa8b/fancytools/math/Point3D.py#L46-L51
243,366
lambdalisue/maidenhair
src/maidenhair/functions.py
set_default_parser
def set_default_parser(parser): """ Set defaulr parser instance Parameters ---------- parser : instance or string An instance or registered name of parser class. The specified parser instance will be used when user did not specified :attr:`parser` in :func:`maidenhair.functi...
python
def set_default_parser(parser): """ Set defaulr parser instance Parameters ---------- parser : instance or string An instance or registered name of parser class. The specified parser instance will be used when user did not specified :attr:`parser` in :func:`maidenhair.functi...
[ "def", "set_default_parser", "(", "parser", ")", ":", "if", "isinstance", "(", "parser", ",", "basestring", ")", ":", "parser", "=", "registry", ".", "find", "(", "parser", ")", "(", ")", "if", "not", "isinstance", "(", "parser", ",", "BaseParser", ")", ...
Set defaulr parser instance Parameters ---------- parser : instance or string An instance or registered name of parser class. The specified parser instance will be used when user did not specified :attr:`parser` in :func:`maidenhair.functions.load` function. See also ------...
[ "Set", "defaulr", "parser", "instance" ]
d5095c1087d1f4d71cc57410492151d2803a9f0d
https://github.com/lambdalisue/maidenhair/blob/d5095c1087d1f4d71cc57410492151d2803a9f0d/src/maidenhair/functions.py#L166-L187
243,367
lambdalisue/maidenhair
src/maidenhair/functions.py
set_default_loader
def set_default_loader(loader): """ Set defaulr loader instance Parameters ---------- loader : instance or string An instance or registered name of loader class. The specified loader instance will be used when user did not specified :attr:`loader` in :func:`maidenhair.functi...
python
def set_default_loader(loader): """ Set defaulr loader instance Parameters ---------- loader : instance or string An instance or registered name of loader class. The specified loader instance will be used when user did not specified :attr:`loader` in :func:`maidenhair.functi...
[ "def", "set_default_loader", "(", "loader", ")", ":", "if", "isinstance", "(", "loader", ",", "basestring", ")", ":", "loader", "=", "registry", ".", "find", "(", "loader", ")", "(", ")", "if", "not", "isinstance", "(", "loader", ",", "BaseLoader", ")", ...
Set defaulr loader instance Parameters ---------- loader : instance or string An instance or registered name of loader class. The specified loader instance will be used when user did not specified :attr:`loader` in :func:`maidenhair.functions.load` function. See also ------...
[ "Set", "defaulr", "loader", "instance" ]
d5095c1087d1f4d71cc57410492151d2803a9f0d
https://github.com/lambdalisue/maidenhair/blob/d5095c1087d1f4d71cc57410492151d2803a9f0d/src/maidenhair/functions.py#L208-L229
243,368
thingful/hypercat-py
hypercat/hypercat.py
loads
def loads(inputStr): """Takes a string and converts it into an internal hypercat object, with some checking""" inCat = json.loads(inputStr) assert CATALOGUE_TYPE in _values(inCat[CATALOGUE_METADATA], ISCONTENTTYPE_RELATION) # Manually copy mandatory fields, to check that they are they, and exclude other...
python
def loads(inputStr): """Takes a string and converts it into an internal hypercat object, with some checking""" inCat = json.loads(inputStr) assert CATALOGUE_TYPE in _values(inCat[CATALOGUE_METADATA], ISCONTENTTYPE_RELATION) # Manually copy mandatory fields, to check that they are they, and exclude other...
[ "def", "loads", "(", "inputStr", ")", ":", "inCat", "=", "json", ".", "loads", "(", "inputStr", ")", "assert", "CATALOGUE_TYPE", "in", "_values", "(", "inCat", "[", "CATALOGUE_METADATA", "]", ",", "ISCONTENTTYPE_RELATION", ")", "# Manually copy mandatory fields, t...
Takes a string and converts it into an internal hypercat object, with some checking
[ "Takes", "a", "string", "and", "converts", "it", "into", "an", "internal", "hypercat", "object", "with", "some", "checking" ]
db24ef66ec92d74fbea90afbeadc3a268f18f6e3
https://github.com/thingful/hypercat-py/blob/db24ef66ec92d74fbea90afbeadc3a268f18f6e3/hypercat/hypercat.py#L195-L212
243,369
thingful/hypercat-py
hypercat/hypercat.py
Base.rels
def rels(self): """Returns a LIST of all the metadata relations""" r = [] for i in self.metadata: r = r + i[REL] return []
python
def rels(self): """Returns a LIST of all the metadata relations""" r = [] for i in self.metadata: r = r + i[REL] return []
[ "def", "rels", "(", "self", ")", ":", "r", "=", "[", "]", "for", "i", "in", "self", ".", "metadata", ":", "r", "=", "r", "+", "i", "[", "REL", "]", "return", "[", "]" ]
Returns a LIST of all the metadata relations
[ "Returns", "a", "LIST", "of", "all", "the", "metadata", "relations" ]
db24ef66ec92d74fbea90afbeadc3a268f18f6e3
https://github.com/thingful/hypercat-py/blob/db24ef66ec92d74fbea90afbeadc3a268f18f6e3/hypercat/hypercat.py#L79-L84
243,370
thingful/hypercat-py
hypercat/hypercat.py
Base.prettyprint
def prettyprint(self): """Return hypercat formatted prettily""" return json.dumps(self.asJSON(), sort_keys=True, indent=4, separators=(',', ': '))
python
def prettyprint(self): """Return hypercat formatted prettily""" return json.dumps(self.asJSON(), sort_keys=True, indent=4, separators=(',', ': '))
[ "def", "prettyprint", "(", "self", ")", ":", "return", "json", ".", "dumps", "(", "self", ".", "asJSON", "(", ")", ",", "sort_keys", "=", "True", ",", "indent", "=", "4", ",", "separators", "=", "(", "','", ",", "': '", ")", ")" ]
Return hypercat formatted prettily
[ "Return", "hypercat", "formatted", "prettily" ]
db24ef66ec92d74fbea90afbeadc3a268f18f6e3
https://github.com/thingful/hypercat-py/blob/db24ef66ec92d74fbea90afbeadc3a268f18f6e3/hypercat/hypercat.py#L90-L92
243,371
SkyLothar/shcmd
shcmd/tailf.py
tailf
def tailf( filepath, lastn=0, timeout=60, stopon=None, encoding="utf8", delay=0.1 ): """provide a `tail -f` like function :param filepath: file to tail -f, absolute path or relative path :param lastn: lastn line will also be yield :param timeout: (optional) stop tail -f ...
python
def tailf( filepath, lastn=0, timeout=60, stopon=None, encoding="utf8", delay=0.1 ): """provide a `tail -f` like function :param filepath: file to tail -f, absolute path or relative path :param lastn: lastn line will also be yield :param timeout: (optional) stop tail -f ...
[ "def", "tailf", "(", "filepath", ",", "lastn", "=", "0", ",", "timeout", "=", "60", ",", "stopon", "=", "None", ",", "encoding", "=", "\"utf8\"", ",", "delay", "=", "0.1", ")", ":", "if", "not", "os", ".", "path", ".", "isfile", "(", "filepath", ...
provide a `tail -f` like function :param filepath: file to tail -f, absolute path or relative path :param lastn: lastn line will also be yield :param timeout: (optional) stop tail -f when time's up [timeout <= 10min, default = 1min] :param stopon: (optional) stops when the stopon(output) return...
[ "provide", "a", "tail", "-", "f", "like", "function" ]
d8cad6311a4da7ef09f3419c86b58e30388b7ee3
https://github.com/SkyLothar/shcmd/blob/d8cad6311a4da7ef09f3419c86b58e30388b7ee3/shcmd/tailf.py#L20-L84
243,372
padfoot27/merlin
venv/lib/python2.7/site-packages/setuptools/sandbox.py
_execfile
def _execfile(filename, globals, locals=None): """ Python 3 implementation of execfile. """ mode = 'rb' # Python 2.6 compile requires LF for newlines, so use deprecated # Universal newlines support. if sys.version_info < (2, 7): mode += 'U' with open(filename, mode) as stream: ...
python
def _execfile(filename, globals, locals=None): """ Python 3 implementation of execfile. """ mode = 'rb' # Python 2.6 compile requires LF for newlines, so use deprecated # Universal newlines support. if sys.version_info < (2, 7): mode += 'U' with open(filename, mode) as stream: ...
[ "def", "_execfile", "(", "filename", ",", "globals", ",", "locals", "=", "None", ")", ":", "mode", "=", "'rb'", "# Python 2.6 compile requires LF for newlines, so use deprecated", "# Universal newlines support.", "if", "sys", ".", "version_info", "<", "(", "2", ",", ...
Python 3 implementation of execfile.
[ "Python", "3", "implementation", "of", "execfile", "." ]
c317505c5eca0e774fcf8b8c7f08801479a5099a
https://github.com/padfoot27/merlin/blob/c317505c5eca0e774fcf8b8c7f08801479a5099a/venv/lib/python2.7/site-packages/setuptools/sandbox.py#L32-L46
243,373
maxfischer2781/chainlet
chainlet/primitives/link.py
ChainLink.send
def send(self, value=None): """Send a single value to this element for processing""" if self.chain_fork: return self._send_fork(value) return self._send_flat(value)
python
def send(self, value=None): """Send a single value to this element for processing""" if self.chain_fork: return self._send_fork(value) return self._send_flat(value)
[ "def", "send", "(", "self", ",", "value", "=", "None", ")", ":", "if", "self", ".", "chain_fork", ":", "return", "self", ".", "_send_fork", "(", "value", ")", "return", "self", ".", "_send_flat", "(", "value", ")" ]
Send a single value to this element for processing
[ "Send", "a", "single", "value", "to", "this", "element", "for", "processing" ]
4e17f9992b4780bd0d9309202e2847df640bffe8
https://github.com/maxfischer2781/chainlet/blob/4e17f9992b4780bd0d9309202e2847df640bffe8/chainlet/primitives/link.py#L184-L188
243,374
kankiri/pabiana
pabiana/utils.py
read_interfaces
def read_interfaces(path: str) -> Interfaces: """Reads an Interfaces JSON file at the given path and returns it as a dictionary.""" with open(path, encoding='utf-8') as f: return json.load(f)
python
def read_interfaces(path: str) -> Interfaces: """Reads an Interfaces JSON file at the given path and returns it as a dictionary.""" with open(path, encoding='utf-8') as f: return json.load(f)
[ "def", "read_interfaces", "(", "path", ":", "str", ")", "->", "Interfaces", ":", "with", "open", "(", "path", ",", "encoding", "=", "'utf-8'", ")", "as", "f", ":", "return", "json", ".", "load", "(", "f", ")" ]
Reads an Interfaces JSON file at the given path and returns it as a dictionary.
[ "Reads", "an", "Interfaces", "JSON", "file", "at", "the", "given", "path", "and", "returns", "it", "as", "a", "dictionary", "." ]
74acfdd81e2a1cc411c37b9ee3d6905ce4b1a39b
https://github.com/kankiri/pabiana/blob/74acfdd81e2a1cc411c37b9ee3d6905ce4b1a39b/pabiana/utils.py#L7-L10
243,375
kankiri/pabiana
pabiana/utils.py
multiple
def multiple(layer: int, limit: int) -> Set[str]: """Returns a set of strings to be used as Slots with Pabianas default Clock. Args: layer: The layer in the hierarchy this Area is placed in. Technically, the number specifies how many of the Clocks signals are relevant to the Area. Between 1 and limit. limi...
python
def multiple(layer: int, limit: int) -> Set[str]: """Returns a set of strings to be used as Slots with Pabianas default Clock. Args: layer: The layer in the hierarchy this Area is placed in. Technically, the number specifies how many of the Clocks signals are relevant to the Area. Between 1 and limit. limi...
[ "def", "multiple", "(", "layer", ":", "int", ",", "limit", ":", "int", ")", "->", "Set", "[", "str", "]", ":", "return", "{", "str", "(", "x", ")", ".", "zfill", "(", "2", ")", "for", "x", "in", "[", "2", "**", "x", "for", "x", "in", "range...
Returns a set of strings to be used as Slots with Pabianas default Clock. Args: layer: The layer in the hierarchy this Area is placed in. Technically, the number specifies how many of the Clocks signals are relevant to the Area. Between 1 and limit. limit: The number of layers of the hierarchy.
[ "Returns", "a", "set", "of", "strings", "to", "be", "used", "as", "Slots", "with", "Pabianas", "default", "Clock", "." ]
74acfdd81e2a1cc411c37b9ee3d6905ce4b1a39b
https://github.com/kankiri/pabiana/blob/74acfdd81e2a1cc411c37b9ee3d6905ce4b1a39b/pabiana/utils.py#L17-L26
243,376
delfick/aws_syncr
aws_syncr/amazon/common.py
AmazonMixin.print_change
def print_change(self, symbol, typ, changes=None, document=None, **kwargs): """Print out a change""" values = ", ".join("{0}={1}".format(key, val) for key, val in sorted(kwargs.items())) print("{0} {1}({2})".format(symbol, typ, values)) if changes: for change in changes: ...
python
def print_change(self, symbol, typ, changes=None, document=None, **kwargs): """Print out a change""" values = ", ".join("{0}={1}".format(key, val) for key, val in sorted(kwargs.items())) print("{0} {1}({2})".format(symbol, typ, values)) if changes: for change in changes: ...
[ "def", "print_change", "(", "self", ",", "symbol", ",", "typ", ",", "changes", "=", "None", ",", "document", "=", "None", ",", "*", "*", "kwargs", ")", ":", "values", "=", "\", \"", ".", "join", "(", "\"{0}={1}\"", ".", "format", "(", "key", ",", "...
Print out a change
[ "Print", "out", "a", "change" ]
8cd214b27c1eee98dfba4632cbb8bc0ae36356bd
https://github.com/delfick/aws_syncr/blob/8cd214b27c1eee98dfba4632cbb8bc0ae36356bd/aws_syncr/amazon/common.py#L48-L56
243,377
delfick/aws_syncr
aws_syncr/amazon/common.py
AmazonMixin.change
def change(self, symbol, typ, **kwargs): """Print out a change and then do the change if not doing a dry run""" self.print_change(symbol, typ, **kwargs) if not self.dry_run: try: yield except: raise else: self.am...
python
def change(self, symbol, typ, **kwargs): """Print out a change and then do the change if not doing a dry run""" self.print_change(symbol, typ, **kwargs) if not self.dry_run: try: yield except: raise else: self.am...
[ "def", "change", "(", "self", ",", "symbol", ",", "typ", ",", "*", "*", "kwargs", ")", ":", "self", ".", "print_change", "(", "symbol", ",", "typ", ",", "*", "*", "kwargs", ")", "if", "not", "self", ".", "dry_run", ":", "try", ":", "yield", "exce...
Print out a change and then do the change if not doing a dry run
[ "Print", "out", "a", "change", "and", "then", "do", "the", "change", "if", "not", "doing", "a", "dry", "run" ]
8cd214b27c1eee98dfba4632cbb8bc0ae36356bd
https://github.com/delfick/aws_syncr/blob/8cd214b27c1eee98dfba4632cbb8bc0ae36356bd/aws_syncr/amazon/common.py#L58-L67
243,378
rameshg87/pyremotevbox
pyremotevbox/ZSI/wstools/Utility.py
urlopen
def urlopen(url, timeout=20, redirects=None): """A minimal urlopen replacement hack that supports timeouts for http. Note that this supports GET only.""" scheme, host, path, params, query, frag = urlparse(url) if not scheme in ('http', 'https'): return urllib.urlopen(url) if params: path...
python
def urlopen(url, timeout=20, redirects=None): """A minimal urlopen replacement hack that supports timeouts for http. Note that this supports GET only.""" scheme, host, path, params, query, frag = urlparse(url) if not scheme in ('http', 'https'): return urllib.urlopen(url) if params: path...
[ "def", "urlopen", "(", "url", ",", "timeout", "=", "20", ",", "redirects", "=", "None", ")", ":", "scheme", ",", "host", ",", "path", ",", "params", ",", "query", ",", "frag", "=", "urlparse", "(", "url", ")", "if", "not", "scheme", "in", "(", "'...
A minimal urlopen replacement hack that supports timeouts for http. Note that this supports GET only.
[ "A", "minimal", "urlopen", "replacement", "hack", "that", "supports", "timeouts", "for", "http", ".", "Note", "that", "this", "supports", "GET", "only", "." ]
123dffff27da57c8faa3ac1dd4c68b1cf4558b1a
https://github.com/rameshg87/pyremotevbox/blob/123dffff27da57c8faa3ac1dd4c68b1cf4558b1a/pyremotevbox/ZSI/wstools/Utility.py#L147-L211
243,379
rameshg87/pyremotevbox
pyremotevbox/ZSI/wstools/Utility.py
DOM.SOAPUriToVersion
def SOAPUriToVersion(self, uri): """Return the SOAP version related to an envelope uri.""" value = self._soap_uri_mapping.get(uri) if value is not None: return value raise ValueError( 'Unsupported SOAP envelope uri: %s' % uri )
python
def SOAPUriToVersion(self, uri): """Return the SOAP version related to an envelope uri.""" value = self._soap_uri_mapping.get(uri) if value is not None: return value raise ValueError( 'Unsupported SOAP envelope uri: %s' % uri )
[ "def", "SOAPUriToVersion", "(", "self", ",", "uri", ")", ":", "value", "=", "self", ".", "_soap_uri_mapping", ".", "get", "(", "uri", ")", "if", "value", "is", "not", "None", ":", "return", "value", "raise", "ValueError", "(", "'Unsupported SOAP envelope uri...
Return the SOAP version related to an envelope uri.
[ "Return", "the", "SOAP", "version", "related", "to", "an", "envelope", "uri", "." ]
123dffff27da57c8faa3ac1dd4c68b1cf4558b1a
https://github.com/rameshg87/pyremotevbox/blob/123dffff27da57c8faa3ac1dd4c68b1cf4558b1a/pyremotevbox/ZSI/wstools/Utility.py#L242-L249
243,380
rameshg87/pyremotevbox
pyremotevbox/ZSI/wstools/Utility.py
DOM.WSDLUriToVersion
def WSDLUriToVersion(self, uri): """Return the WSDL version related to a WSDL namespace uri.""" value = self._wsdl_uri_mapping.get(uri) if value is not None: return value raise ValueError( 'Unsupported SOAP envelope uri: %s' % uri )
python
def WSDLUriToVersion(self, uri): """Return the WSDL version related to a WSDL namespace uri.""" value = self._wsdl_uri_mapping.get(uri) if value is not None: return value raise ValueError( 'Unsupported SOAP envelope uri: %s' % uri )
[ "def", "WSDLUriToVersion", "(", "self", ",", "uri", ")", ":", "value", "=", "self", ".", "_wsdl_uri_mapping", ".", "get", "(", "uri", ")", "if", "value", "is", "not", "None", ":", "return", "value", "raise", "ValueError", "(", "'Unsupported SOAP envelope uri...
Return the WSDL version related to a WSDL namespace uri.
[ "Return", "the", "WSDL", "version", "related", "to", "a", "WSDL", "namespace", "uri", "." ]
123dffff27da57c8faa3ac1dd4c68b1cf4558b1a
https://github.com/rameshg87/pyremotevbox/blob/123dffff27da57c8faa3ac1dd4c68b1cf4558b1a/pyremotevbox/ZSI/wstools/Utility.py#L350-L357
243,381
rameshg87/pyremotevbox
pyremotevbox/ZSI/wstools/Utility.py
DOM.isElement
def isElement(self, node, name, nsuri=None): """Return true if the given node is an element with the given name and optional namespace uri.""" if node.nodeType != node.ELEMENT_NODE: return 0 return node.localName == name and \ (nsuri is None or self.nsUriMat...
python
def isElement(self, node, name, nsuri=None): """Return true if the given node is an element with the given name and optional namespace uri.""" if node.nodeType != node.ELEMENT_NODE: return 0 return node.localName == name and \ (nsuri is None or self.nsUriMat...
[ "def", "isElement", "(", "self", ",", "node", ",", "name", ",", "nsuri", "=", "None", ")", ":", "if", "node", ".", "nodeType", "!=", "node", ".", "ELEMENT_NODE", ":", "return", "0", "return", "node", ".", "localName", "==", "name", "and", "(", "nsuri...
Return true if the given node is an element with the given name and optional namespace uri.
[ "Return", "true", "if", "the", "given", "node", "is", "an", "element", "with", "the", "given", "name", "and", "optional", "namespace", "uri", "." ]
123dffff27da57c8faa3ac1dd4c68b1cf4558b1a
https://github.com/rameshg87/pyremotevbox/blob/123dffff27da57c8faa3ac1dd4c68b1cf4558b1a/pyremotevbox/ZSI/wstools/Utility.py#L410-L416
243,382
rameshg87/pyremotevbox
pyremotevbox/ZSI/wstools/Utility.py
DOM.getElement
def getElement(self, node, name, nsuri=None, default=join): """Return the first child of node with a matching name and namespace uri, or the default if one is provided.""" nsmatch = self.nsUriMatch ELEMENT_NODE = node.ELEMENT_NODE for child in node.childNodes: if c...
python
def getElement(self, node, name, nsuri=None, default=join): """Return the first child of node with a matching name and namespace uri, or the default if one is provided.""" nsmatch = self.nsUriMatch ELEMENT_NODE = node.ELEMENT_NODE for child in node.childNodes: if c...
[ "def", "getElement", "(", "self", ",", "node", ",", "name", ",", "nsuri", "=", "None", ",", "default", "=", "join", ")", ":", "nsmatch", "=", "self", ".", "nsUriMatch", "ELEMENT_NODE", "=", "node", ".", "ELEMENT_NODE", "for", "child", "in", "node", "."...
Return the first child of node with a matching name and namespace uri, or the default if one is provided.
[ "Return", "the", "first", "child", "of", "node", "with", "a", "matching", "name", "and", "namespace", "uri", "or", "the", "default", "if", "one", "is", "provided", "." ]
123dffff27da57c8faa3ac1dd4c68b1cf4558b1a
https://github.com/rameshg87/pyremotevbox/blob/123dffff27da57c8faa3ac1dd4c68b1cf4558b1a/pyremotevbox/ZSI/wstools/Utility.py#L418-L431
243,383
rameshg87/pyremotevbox
pyremotevbox/ZSI/wstools/Utility.py
DOM.getElementById
def getElementById(self, node, id, default=join): """Return the first child of node matching an id reference.""" attrget = self.getAttr ELEMENT_NODE = node.ELEMENT_NODE for child in node.childNodes: if child.nodeType == ELEMENT_NODE: if attrget(child, 'id') ==...
python
def getElementById(self, node, id, default=join): """Return the first child of node matching an id reference.""" attrget = self.getAttr ELEMENT_NODE = node.ELEMENT_NODE for child in node.childNodes: if child.nodeType == ELEMENT_NODE: if attrget(child, 'id') ==...
[ "def", "getElementById", "(", "self", ",", "node", ",", "id", ",", "default", "=", "join", ")", ":", "attrget", "=", "self", ".", "getAttr", "ELEMENT_NODE", "=", "node", ".", "ELEMENT_NODE", "for", "child", "in", "node", ".", "childNodes", ":", "if", "...
Return the first child of node matching an id reference.
[ "Return", "the", "first", "child", "of", "node", "matching", "an", "id", "reference", "." ]
123dffff27da57c8faa3ac1dd4c68b1cf4558b1a
https://github.com/rameshg87/pyremotevbox/blob/123dffff27da57c8faa3ac1dd4c68b1cf4558b1a/pyremotevbox/ZSI/wstools/Utility.py#L433-L443
243,384
rameshg87/pyremotevbox
pyremotevbox/ZSI/wstools/Utility.py
DOM.getElements
def getElements(self, node, name, nsuri=None): """Return a sequence of the child elements of the given node that match the given name and optional namespace uri.""" nsmatch = self.nsUriMatch result = [] ELEMENT_NODE = node.ELEMENT_NODE for child in node.childNodes: ...
python
def getElements(self, node, name, nsuri=None): """Return a sequence of the child elements of the given node that match the given name and optional namespace uri.""" nsmatch = self.nsUriMatch result = [] ELEMENT_NODE = node.ELEMENT_NODE for child in node.childNodes: ...
[ "def", "getElements", "(", "self", ",", "node", ",", "name", ",", "nsuri", "=", "None", ")", ":", "nsmatch", "=", "self", ".", "nsUriMatch", "result", "=", "[", "]", "ELEMENT_NODE", "=", "node", ".", "ELEMENT_NODE", "for", "child", "in", "node", ".", ...
Return a sequence of the child elements of the given node that match the given name and optional namespace uri.
[ "Return", "a", "sequence", "of", "the", "child", "elements", "of", "the", "given", "node", "that", "match", "the", "given", "name", "and", "optional", "namespace", "uri", "." ]
123dffff27da57c8faa3ac1dd4c68b1cf4558b1a
https://github.com/rameshg87/pyremotevbox/blob/123dffff27da57c8faa3ac1dd4c68b1cf4558b1a/pyremotevbox/ZSI/wstools/Utility.py#L464-L475
243,385
rameshg87/pyremotevbox
pyremotevbox/ZSI/wstools/Utility.py
DOM.hasAttr
def hasAttr(self, node, name, nsuri=None): """Return true if element has attribute with the given name and optional nsuri. If nsuri is not specified, returns true if an attribute exists with the given name with any namespace.""" if nsuri is None: if node.hasAttribute(na...
python
def hasAttr(self, node, name, nsuri=None): """Return true if element has attribute with the given name and optional nsuri. If nsuri is not specified, returns true if an attribute exists with the given name with any namespace.""" if nsuri is None: if node.hasAttribute(na...
[ "def", "hasAttr", "(", "self", ",", "node", ",", "name", ",", "nsuri", "=", "None", ")", ":", "if", "nsuri", "is", "None", ":", "if", "node", ".", "hasAttribute", "(", "name", ")", ":", "return", "True", "return", "False", "return", "node", ".", "h...
Return true if element has attribute with the given name and optional nsuri. If nsuri is not specified, returns true if an attribute exists with the given name with any namespace.
[ "Return", "true", "if", "element", "has", "attribute", "with", "the", "given", "name", "and", "optional", "nsuri", ".", "If", "nsuri", "is", "not", "specified", "returns", "true", "if", "an", "attribute", "exists", "with", "the", "given", "name", "with", "...
123dffff27da57c8faa3ac1dd4c68b1cf4558b1a
https://github.com/rameshg87/pyremotevbox/blob/123dffff27da57c8faa3ac1dd4c68b1cf4558b1a/pyremotevbox/ZSI/wstools/Utility.py#L477-L485
243,386
rameshg87/pyremotevbox
pyremotevbox/ZSI/wstools/Utility.py
DOM.getAttr
def getAttr(self, node, name, nsuri=None, default=join): """Return the value of the attribute named 'name' with the optional nsuri, or the default if one is specified. If nsuri is not specified, an attribute that matches the given name will be returned regardless of namespace.""...
python
def getAttr(self, node, name, nsuri=None, default=join): """Return the value of the attribute named 'name' with the optional nsuri, or the default if one is specified. If nsuri is not specified, an attribute that matches the given name will be returned regardless of namespace.""...
[ "def", "getAttr", "(", "self", ",", "node", ",", "name", ",", "nsuri", "=", "None", ",", "default", "=", "join", ")", ":", "if", "nsuri", "is", "None", ":", "result", "=", "node", ".", "_attrs", ".", "get", "(", "name", ",", "None", ")", "if", ...
Return the value of the attribute named 'name' with the optional nsuri, or the default if one is specified. If nsuri is not specified, an attribute that matches the given name will be returned regardless of namespace.
[ "Return", "the", "value", "of", "the", "attribute", "named", "name", "with", "the", "optional", "nsuri", "or", "the", "default", "if", "one", "is", "specified", ".", "If", "nsuri", "is", "not", "specified", "an", "attribute", "that", "matches", "the", "giv...
123dffff27da57c8faa3ac1dd4c68b1cf4558b1a
https://github.com/rameshg87/pyremotevbox/blob/123dffff27da57c8faa3ac1dd4c68b1cf4558b1a/pyremotevbox/ZSI/wstools/Utility.py#L487-L505
243,387
rameshg87/pyremotevbox
pyremotevbox/ZSI/wstools/Utility.py
DOM.getAttrs
def getAttrs(self, node): """Return a Collection of all attributes """ attrs = {} for k,v in node._attrs.items(): attrs[k] = v.value return attrs
python
def getAttrs(self, node): """Return a Collection of all attributes """ attrs = {} for k,v in node._attrs.items(): attrs[k] = v.value return attrs
[ "def", "getAttrs", "(", "self", ",", "node", ")", ":", "attrs", "=", "{", "}", "for", "k", ",", "v", "in", "node", ".", "_attrs", ".", "items", "(", ")", ":", "attrs", "[", "k", "]", "=", "v", ".", "value", "return", "attrs" ]
Return a Collection of all attributes
[ "Return", "a", "Collection", "of", "all", "attributes" ]
123dffff27da57c8faa3ac1dd4c68b1cf4558b1a
https://github.com/rameshg87/pyremotevbox/blob/123dffff27da57c8faa3ac1dd4c68b1cf4558b1a/pyremotevbox/ZSI/wstools/Utility.py#L507-L513
243,388
rameshg87/pyremotevbox
pyremotevbox/ZSI/wstools/Utility.py
DOM.getElementText
def getElementText(self, node, preserve_ws=None): """Return the text value of an xml element node. Leading and trailing whitespace is stripped from the value unless the preserve_ws flag is passed with a true value.""" result = [] for child in node.childNodes: no...
python
def getElementText(self, node, preserve_ws=None): """Return the text value of an xml element node. Leading and trailing whitespace is stripped from the value unless the preserve_ws flag is passed with a true value.""" result = [] for child in node.childNodes: no...
[ "def", "getElementText", "(", "self", ",", "node", ",", "preserve_ws", "=", "None", ")", ":", "result", "=", "[", "]", "for", "child", "in", "node", ".", "childNodes", ":", "nodetype", "=", "child", ".", "nodeType", "if", "nodetype", "==", "child", "."...
Return the text value of an xml element node. Leading and trailing whitespace is stripped from the value unless the preserve_ws flag is passed with a true value.
[ "Return", "the", "text", "value", "of", "an", "xml", "element", "node", ".", "Leading", "and", "trailing", "whitespace", "is", "stripped", "from", "the", "value", "unless", "the", "preserve_ws", "flag", "is", "passed", "with", "a", "true", "value", "." ]
123dffff27da57c8faa3ac1dd4c68b1cf4558b1a
https://github.com/rameshg87/pyremotevbox/blob/123dffff27da57c8faa3ac1dd4c68b1cf4558b1a/pyremotevbox/ZSI/wstools/Utility.py#L515-L528
243,389
rameshg87/pyremotevbox
pyremotevbox/ZSI/wstools/Utility.py
DOM.findNamespaceURI
def findNamespaceURI(self, prefix, node): """Find a namespace uri given a prefix and a context node.""" attrkey = (self.NS_XMLNS, prefix) DOCUMENT_NODE = node.DOCUMENT_NODE ELEMENT_NODE = node.ELEMENT_NODE while 1: if node is None: raise DOMException('...
python
def findNamespaceURI(self, prefix, node): """Find a namespace uri given a prefix and a context node.""" attrkey = (self.NS_XMLNS, prefix) DOCUMENT_NODE = node.DOCUMENT_NODE ELEMENT_NODE = node.ELEMENT_NODE while 1: if node is None: raise DOMException('...
[ "def", "findNamespaceURI", "(", "self", ",", "prefix", ",", "node", ")", ":", "attrkey", "=", "(", "self", ".", "NS_XMLNS", ",", "prefix", ")", "DOCUMENT_NODE", "=", "node", ".", "DOCUMENT_NODE", "ELEMENT_NODE", "=", "node", ".", "ELEMENT_NODE", "while", "...
Find a namespace uri given a prefix and a context node.
[ "Find", "a", "namespace", "uri", "given", "a", "prefix", "and", "a", "context", "node", "." ]
123dffff27da57c8faa3ac1dd4c68b1cf4558b1a
https://github.com/rameshg87/pyremotevbox/blob/123dffff27da57c8faa3ac1dd4c68b1cf4558b1a/pyremotevbox/ZSI/wstools/Utility.py#L530-L548
243,390
rameshg87/pyremotevbox
pyremotevbox/ZSI/wstools/Utility.py
DOM.findTargetNS
def findTargetNS(self, node): """Return the defined target namespace uri for the given node.""" attrget = self.getAttr attrkey = (self.NS_XMLNS, 'xmlns') DOCUMENT_NODE = node.DOCUMENT_NODE ELEMENT_NODE = node.ELEMENT_NODE while 1: if node.nodeType != ELEMENT_N...
python
def findTargetNS(self, node): """Return the defined target namespace uri for the given node.""" attrget = self.getAttr attrkey = (self.NS_XMLNS, 'xmlns') DOCUMENT_NODE = node.DOCUMENT_NODE ELEMENT_NODE = node.ELEMENT_NODE while 1: if node.nodeType != ELEMENT_N...
[ "def", "findTargetNS", "(", "self", ",", "node", ")", ":", "attrget", "=", "self", ".", "getAttr", "attrkey", "=", "(", "self", ".", "NS_XMLNS", ",", "'xmlns'", ")", "DOCUMENT_NODE", "=", "node", ".", "DOCUMENT_NODE", "ELEMENT_NODE", "=", "node", ".", "E...
Return the defined target namespace uri for the given node.
[ "Return", "the", "defined", "target", "namespace", "uri", "for", "the", "given", "node", "." ]
123dffff27da57c8faa3ac1dd4c68b1cf4558b1a
https://github.com/rameshg87/pyremotevbox/blob/123dffff27da57c8faa3ac1dd4c68b1cf4558b1a/pyremotevbox/ZSI/wstools/Utility.py#L568-L583
243,391
rameshg87/pyremotevbox
pyremotevbox/ZSI/wstools/Utility.py
DOM.nsUriMatch
def nsUriMatch(self, value, wanted, strict=0, tt=type(())): """Return a true value if two namespace uri values match.""" if value == wanted or (type(wanted) is tt) and value in wanted: return 1 if not strict and value is not None: wanted = type(wanted) is tt and wanted or...
python
def nsUriMatch(self, value, wanted, strict=0, tt=type(())): """Return a true value if two namespace uri values match.""" if value == wanted or (type(wanted) is tt) and value in wanted: return 1 if not strict and value is not None: wanted = type(wanted) is tt and wanted or...
[ "def", "nsUriMatch", "(", "self", ",", "value", ",", "wanted", ",", "strict", "=", "0", ",", "tt", "=", "type", "(", "(", ")", ")", ")", ":", "if", "value", "==", "wanted", "or", "(", "type", "(", "wanted", ")", "is", "tt", ")", "and", "value",...
Return a true value if two namespace uri values match.
[ "Return", "a", "true", "value", "if", "two", "namespace", "uri", "values", "match", "." ]
123dffff27da57c8faa3ac1dd4c68b1cf4558b1a
https://github.com/rameshg87/pyremotevbox/blob/123dffff27da57c8faa3ac1dd4c68b1cf4558b1a/pyremotevbox/ZSI/wstools/Utility.py#L615-L625
243,392
rameshg87/pyremotevbox
pyremotevbox/ZSI/wstools/Utility.py
DOM.createDocument
def createDocument(self, nsuri, qname, doctype=None): """Create a new writable DOM document object.""" impl = xml.dom.minidom.getDOMImplementation() return impl.createDocument(nsuri, qname, doctype)
python
def createDocument(self, nsuri, qname, doctype=None): """Create a new writable DOM document object.""" impl = xml.dom.minidom.getDOMImplementation() return impl.createDocument(nsuri, qname, doctype)
[ "def", "createDocument", "(", "self", ",", "nsuri", ",", "qname", ",", "doctype", "=", "None", ")", ":", "impl", "=", "xml", ".", "dom", ".", "minidom", ".", "getDOMImplementation", "(", ")", "return", "impl", ".", "createDocument", "(", "nsuri", ",", ...
Create a new writable DOM document object.
[ "Create", "a", "new", "writable", "DOM", "document", "object", "." ]
123dffff27da57c8faa3ac1dd4c68b1cf4558b1a
https://github.com/rameshg87/pyremotevbox/blob/123dffff27da57c8faa3ac1dd4c68b1cf4558b1a/pyremotevbox/ZSI/wstools/Utility.py#L627-L630
243,393
rameshg87/pyremotevbox
pyremotevbox/ZSI/wstools/Utility.py
DOM.loadFromURL
def loadFromURL(self, url): """Load an xml file from a URL and return a DOM document.""" if isfile(url) is True: file = open(url, 'r') else: file = urlopen(url) try: result = self.loadDocument(file) except Exception, ex: file....
python
def loadFromURL(self, url): """Load an xml file from a URL and return a DOM document.""" if isfile(url) is True: file = open(url, 'r') else: file = urlopen(url) try: result = self.loadDocument(file) except Exception, ex: file....
[ "def", "loadFromURL", "(", "self", ",", "url", ")", ":", "if", "isfile", "(", "url", ")", "is", "True", ":", "file", "=", "open", "(", "url", ",", "'r'", ")", "else", ":", "file", "=", "urlopen", "(", "url", ")", "try", ":", "result", "=", "sel...
Load an xml file from a URL and return a DOM document.
[ "Load", "an", "xml", "file", "from", "a", "URL", "and", "return", "a", "DOM", "document", "." ]
123dffff27da57c8faa3ac1dd4c68b1cf4558b1a
https://github.com/rameshg87/pyremotevbox/blob/123dffff27da57c8faa3ac1dd4c68b1cf4558b1a/pyremotevbox/ZSI/wstools/Utility.py#L637-L651
243,394
rameshg87/pyremotevbox
pyremotevbox/ZSI/wstools/Utility.py
ElementProxy._getUniquePrefix
def _getUniquePrefix(self): '''I guess we need to resolve all potential prefixes because when the current node is attached it copies the namespaces into the parent node. ''' while 1: self._indx += 1 prefix = 'ns%d' %self._indx try: ...
python
def _getUniquePrefix(self): '''I guess we need to resolve all potential prefixes because when the current node is attached it copies the namespaces into the parent node. ''' while 1: self._indx += 1 prefix = 'ns%d' %self._indx try: ...
[ "def", "_getUniquePrefix", "(", "self", ")", ":", "while", "1", ":", "self", ".", "_indx", "+=", "1", "prefix", "=", "'ns%d'", "%", "self", ".", "_indx", "try", ":", "self", ".", "_dom", ".", "findNamespaceURI", "(", "prefix", ",", "self", ".", "_get...
I guess we need to resolve all potential prefixes because when the current node is attached it copies the namespaces into the parent node.
[ "I", "guess", "we", "need", "to", "resolve", "all", "potential", "prefixes", "because", "when", "the", "current", "node", "is", "attached", "it", "copies", "the", "namespaces", "into", "the", "parent", "node", "." ]
123dffff27da57c8faa3ac1dd4c68b1cf4558b1a
https://github.com/rameshg87/pyremotevbox/blob/123dffff27da57c8faa3ac1dd4c68b1cf4558b1a/pyremotevbox/ZSI/wstools/Utility.py#L828-L840
243,395
rameshg87/pyremotevbox
pyremotevbox/ZSI/wstools/Utility.py
ElementProxy.createDocument
def createDocument(self, namespaceURI, localName, doctype=None): '''If specified must be a SOAP envelope, else may contruct an empty document. ''' prefix = self._soap_env_prefix if namespaceURI == self.reserved_ns[prefix]: qualifiedName = '%s:%s' %(prefix,localName) ...
python
def createDocument(self, namespaceURI, localName, doctype=None): '''If specified must be a SOAP envelope, else may contruct an empty document. ''' prefix = self._soap_env_prefix if namespaceURI == self.reserved_ns[prefix]: qualifiedName = '%s:%s' %(prefix,localName) ...
[ "def", "createDocument", "(", "self", ",", "namespaceURI", ",", "localName", ",", "doctype", "=", "None", ")", ":", "prefix", "=", "self", ".", "_soap_env_prefix", "if", "namespaceURI", "==", "self", ".", "reserved_ns", "[", "prefix", "]", ":", "qualifiedNam...
If specified must be a SOAP envelope, else may contruct an empty document.
[ "If", "specified", "must", "be", "a", "SOAP", "envelope", "else", "may", "contruct", "an", "empty", "document", "." ]
123dffff27da57c8faa3ac1dd4c68b1cf4558b1a
https://github.com/rameshg87/pyremotevbox/blob/123dffff27da57c8faa3ac1dd4c68b1cf4558b1a/pyremotevbox/ZSI/wstools/Utility.py#L934-L954
243,396
callowayproject/Transmogrify
transmogrify/autodetect/__init__.py
face_and_energy_detector
def face_and_energy_detector(image_path, detect_faces=True): """ Finds faces and energy in an image """ source = Image.open(image_path) work_width = 800 if source.mode != 'RGB' or source.bits != 8: source24 = source.convert('RGB') else: source24 = source.copy() grayscale...
python
def face_and_energy_detector(image_path, detect_faces=True): """ Finds faces and energy in an image """ source = Image.open(image_path) work_width = 800 if source.mode != 'RGB' or source.bits != 8: source24 = source.convert('RGB') else: source24 = source.copy() grayscale...
[ "def", "face_and_energy_detector", "(", "image_path", ",", "detect_faces", "=", "True", ")", ":", "source", "=", "Image", ".", "open", "(", "image_path", ")", "work_width", "=", "800", "if", "source", ".", "mode", "!=", "'RGB'", "or", "source", ".", "bits"...
Finds faces and energy in an image
[ "Finds", "faces", "and", "energy", "in", "an", "image" ]
f1f891b8b923b3a1ede5eac7f60531c1c472379e
https://github.com/callowayproject/Transmogrify/blob/f1f891b8b923b3a1ede5eac7f60531c1c472379e/transmogrify/autodetect/__init__.py#L136-L164
243,397
callowayproject/Transmogrify
transmogrify/autodetect/__init__.py
get_crop_size
def get_crop_size(crop_w, crop_h, image_w, image_h): """ Determines the correct scale size for the image when img w == crop w and img h > crop h Use these dimensions when img h == crop h and img w > crop w Use these dimensions """ scale1 = float(crop_w) / float(image_w) sca...
python
def get_crop_size(crop_w, crop_h, image_w, image_h): """ Determines the correct scale size for the image when img w == crop w and img h > crop h Use these dimensions when img h == crop h and img w > crop w Use these dimensions """ scale1 = float(crop_w) / float(image_w) sca...
[ "def", "get_crop_size", "(", "crop_w", ",", "crop_h", ",", "image_w", ",", "image_h", ")", ":", "scale1", "=", "float", "(", "crop_w", ")", "/", "float", "(", "image_w", ")", "scale2", "=", "float", "(", "crop_h", ")", "/", "float", "(", "image_h", "...
Determines the correct scale size for the image when img w == crop w and img h > crop h Use these dimensions when img h == crop h and img w > crop w Use these dimensions
[ "Determines", "the", "correct", "scale", "size", "for", "the", "image" ]
f1f891b8b923b3a1ede5eac7f60531c1c472379e
https://github.com/callowayproject/Transmogrify/blob/f1f891b8b923b3a1ede5eac7f60531c1c472379e/transmogrify/autodetect/__init__.py#L167-L189
243,398
callowayproject/Transmogrify
transmogrify/autodetect/__init__.py
calc_subrange
def calc_subrange(range_max, sub_amount, weight): """ return the start and stop points that are sub_amount distance apart and contain weight, without going outside the provided range """ if weight > range_max or sub_amount > range_max: raise ValueError("sub_amount and weight must be less tha...
python
def calc_subrange(range_max, sub_amount, weight): """ return the start and stop points that are sub_amount distance apart and contain weight, without going outside the provided range """ if weight > range_max or sub_amount > range_max: raise ValueError("sub_amount and weight must be less tha...
[ "def", "calc_subrange", "(", "range_max", ",", "sub_amount", ",", "weight", ")", ":", "if", "weight", ">", "range_max", "or", "sub_amount", ">", "range_max", ":", "raise", "ValueError", "(", "\"sub_amount and weight must be less than range_max. range_max %s, sub_amount %s...
return the start and stop points that are sub_amount distance apart and contain weight, without going outside the provided range
[ "return", "the", "start", "and", "stop", "points", "that", "are", "sub_amount", "distance", "apart", "and", "contain", "weight", "without", "going", "outside", "the", "provided", "range" ]
f1f891b8b923b3a1ede5eac7f60531c1c472379e
https://github.com/callowayproject/Transmogrify/blob/f1f891b8b923b3a1ede5eac7f60531c1c472379e/transmogrify/autodetect/__init__.py#L192-L209
243,399
callowayproject/Transmogrify
transmogrify/autodetect/__init__.py
smart_crop
def smart_crop(crop_w, crop_h, image_path): """ Return the scaled image size and crop rectangle """ cropping = face_and_energy_detector(image_path) img = Image.open(image_path) w, h = img.size scaled_size = get_crop_size(crop_w, crop_h, *img.size) gravity_x = int(round(scaled_size[0] * c...
python
def smart_crop(crop_w, crop_h, image_path): """ Return the scaled image size and crop rectangle """ cropping = face_and_energy_detector(image_path) img = Image.open(image_path) w, h = img.size scaled_size = get_crop_size(crop_w, crop_h, *img.size) gravity_x = int(round(scaled_size[0] * c...
[ "def", "smart_crop", "(", "crop_w", ",", "crop_h", ",", "image_path", ")", ":", "cropping", "=", "face_and_energy_detector", "(", "image_path", ")", "img", "=", "Image", ".", "open", "(", "image_path", ")", "w", ",", "h", "=", "img", ".", "size", "scaled...
Return the scaled image size and crop rectangle
[ "Return", "the", "scaled", "image", "size", "and", "crop", "rectangle" ]
f1f891b8b923b3a1ede5eac7f60531c1c472379e
https://github.com/callowayproject/Transmogrify/blob/f1f891b8b923b3a1ede5eac7f60531c1c472379e/transmogrify/autodetect/__init__.py#L212-L229