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 | partition stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|
CenturyLinkCloud/clc-python-sdk | src/clc/APIv1/network.py | Network.GetNetworkDetails | def GetNetworkDetails(network,alias=None,location=None):
"""Gets the details for a Network and its IP Addresses.
https://t3n.zendesk.com/entries/21726312-Get-Network-Details
:param network: network name
:param alias: short code for a particular account. If none will use account's default alias
:param locat... | python | def GetNetworkDetails(network,alias=None,location=None):
"""Gets the details for a Network and its IP Addresses.
https://t3n.zendesk.com/entries/21726312-Get-Network-Details
:param network: network name
:param alias: short code for a particular account. If none will use account's default alias
:param locat... | [
"def",
"GetNetworkDetails",
"(",
"network",
",",
"alias",
"=",
"None",
",",
"location",
"=",
"None",
")",
":",
"if",
"alias",
"is",
"None",
":",
"alias",
"=",
"clc",
".",
"v1",
".",
"Account",
".",
"GetAlias",
"(",
")",
"if",
"location",
"is",
"None"... | Gets the details for a Network and its IP Addresses.
https://t3n.zendesk.com/entries/21726312-Get-Network-Details
:param network: network name
:param alias: short code for a particular account. If none will use account's default alias
:param location: datacenter where group resides. If none will use account... | [
"Gets",
"the",
"details",
"for",
"a",
"Network",
"and",
"its",
"IP",
"Addresses",
"."
] | f4dba40c627cb08dd4b7d0d277e8d67578010b05 | https://github.com/CenturyLinkCloud/clc-python-sdk/blob/f4dba40c627cb08dd4b7d0d277e8d67578010b05/src/clc/APIv1/network.py#L30-L42 | train |
blag/django-secure-mail | secure_mail/handlers.py | get_variable_from_exception | def get_variable_from_exception(exception, variable_name):
"""
Grab the variable from closest frame in the stack
"""
for frame in reversed(trace()):
try:
# From http://stackoverflow.com/a/9059407/6461688
frame_variable = frame[0].f_locals[variable_name]
except Key... | python | def get_variable_from_exception(exception, variable_name):
"""
Grab the variable from closest frame in the stack
"""
for frame in reversed(trace()):
try:
# From http://stackoverflow.com/a/9059407/6461688
frame_variable = frame[0].f_locals[variable_name]
except Key... | [
"def",
"get_variable_from_exception",
"(",
"exception",
",",
"variable_name",
")",
":",
"for",
"frame",
"in",
"reversed",
"(",
"trace",
"(",
")",
")",
":",
"try",
":",
"# From http://stackoverflow.com/a/9059407/6461688",
"frame_variable",
"=",
"frame",
"[",
"0",
"... | Grab the variable from closest frame in the stack | [
"Grab",
"the",
"variable",
"from",
"closest",
"frame",
"in",
"the",
"stack"
] | 52987b6ce829e6de2dc8ab38ed3190bc2752b341 | https://github.com/blag/django-secure-mail/blob/52987b6ce829e6de2dc8ab38ed3190bc2752b341/secure_mail/handlers.py#L14-L27 | train |
blag/django-secure-mail | secure_mail/handlers.py | force_delete_key | def force_delete_key(address):
"""
Delete the key from the keyring and the Key and Address objects from the
database
"""
address_object = Address.objects.get(address=address)
address_object.key.delete()
address_object.delete() | python | def force_delete_key(address):
"""
Delete the key from the keyring and the Key and Address objects from the
database
"""
address_object = Address.objects.get(address=address)
address_object.key.delete()
address_object.delete() | [
"def",
"force_delete_key",
"(",
"address",
")",
":",
"address_object",
"=",
"Address",
".",
"objects",
".",
"get",
"(",
"address",
"=",
"address",
")",
"address_object",
".",
"key",
".",
"delete",
"(",
")",
"address_object",
".",
"delete",
"(",
")"
] | Delete the key from the keyring and the Key and Address objects from the
database | [
"Delete",
"the",
"key",
"from",
"the",
"keyring",
"and",
"the",
"Key",
"and",
"Address",
"objects",
"from",
"the",
"database"
] | 52987b6ce829e6de2dc8ab38ed3190bc2752b341 | https://github.com/blag/django-secure-mail/blob/52987b6ce829e6de2dc8ab38ed3190bc2752b341/secure_mail/handlers.py#L72-L79 | train |
uzumaxy/pyvalid | pyvalid/__accepts.py | Accepts.__wrap_accepted_val | def __wrap_accepted_val(self, value):
"""Wrap accepted value in the list if yet not wrapped.
"""
if isinstance(value, tuple):
value = list(value)
elif not isinstance(value, list):
value = [value]
return value | python | def __wrap_accepted_val(self, value):
"""Wrap accepted value in the list if yet not wrapped.
"""
if isinstance(value, tuple):
value = list(value)
elif not isinstance(value, list):
value = [value]
return value | [
"def",
"__wrap_accepted_val",
"(",
"self",
",",
"value",
")",
":",
"if",
"isinstance",
"(",
"value",
",",
"tuple",
")",
":",
"value",
"=",
"list",
"(",
"value",
")",
"elif",
"not",
"isinstance",
"(",
"value",
",",
"list",
")",
":",
"value",
"=",
"[",... | Wrap accepted value in the list if yet not wrapped. | [
"Wrap",
"accepted",
"value",
"in",
"the",
"list",
"if",
"yet",
"not",
"wrapped",
"."
] | 74a1a64df1cc77cac55f12f0fe0f52292c6ae479 | https://github.com/uzumaxy/pyvalid/blob/74a1a64df1cc77cac55f12f0fe0f52292c6ae479/pyvalid/__accepts.py#L44-L51 | train |
uzumaxy/pyvalid | pyvalid/__accepts.py | Accepts.__validate_args | def __validate_args(self, func_name, args, kwargs):
"""Compare value of each required argument with list of
accepted values.
Args:
func_name (str): Function name.
args (list): Collection of the position arguments.
kwargs (dict): Collection of the keyword argu... | python | def __validate_args(self, func_name, args, kwargs):
"""Compare value of each required argument with list of
accepted values.
Args:
func_name (str): Function name.
args (list): Collection of the position arguments.
kwargs (dict): Collection of the keyword argu... | [
"def",
"__validate_args",
"(",
"self",
",",
"func_name",
",",
"args",
",",
"kwargs",
")",
":",
"from",
"pyvalid",
".",
"validators",
"import",
"Validator",
"for",
"i",
",",
"(",
"arg_name",
",",
"accepted_values",
")",
"in",
"enumerate",
"(",
"self",
".",
... | Compare value of each required argument with list of
accepted values.
Args:
func_name (str): Function name.
args (list): Collection of the position arguments.
kwargs (dict): Collection of the keyword arguments.
Raises:
InvalidArgumentNumberError:... | [
"Compare",
"value",
"of",
"each",
"required",
"argument",
"with",
"list",
"of",
"accepted",
"values",
"."
] | 74a1a64df1cc77cac55f12f0fe0f52292c6ae479 | https://github.com/uzumaxy/pyvalid/blob/74a1a64df1cc77cac55f12f0fe0f52292c6ae479/pyvalid/__accepts.py#L94-L145 | train |
uzumaxy/pyvalid | pyvalid/__accepts.py | Accepts.__ordinal | def __ordinal(self, num):
"""Returns the ordinal number of a given integer, as a string.
eg. 1 -> 1st, 2 -> 2nd, 3 -> 3rd, etc.
"""
if 10 <= num % 100 < 20:
return str(num) + 'th'
else:
ord_info = {1: 'st', 2: 'nd', 3: 'rd'}.get(num % 10, 'th')
... | python | def __ordinal(self, num):
"""Returns the ordinal number of a given integer, as a string.
eg. 1 -> 1st, 2 -> 2nd, 3 -> 3rd, etc.
"""
if 10 <= num % 100 < 20:
return str(num) + 'th'
else:
ord_info = {1: 'st', 2: 'nd', 3: 'rd'}.get(num % 10, 'th')
... | [
"def",
"__ordinal",
"(",
"self",
",",
"num",
")",
":",
"if",
"10",
"<=",
"num",
"%",
"100",
"<",
"20",
":",
"return",
"str",
"(",
"num",
")",
"+",
"'th'",
"else",
":",
"ord_info",
"=",
"{",
"1",
":",
"'st'",
",",
"2",
":",
"'nd'",
",",
"3",
... | Returns the ordinal number of a given integer, as a string.
eg. 1 -> 1st, 2 -> 2nd, 3 -> 3rd, etc. | [
"Returns",
"the",
"ordinal",
"number",
"of",
"a",
"given",
"integer",
"as",
"a",
"string",
".",
"eg",
".",
"1",
"-",
">",
"1st",
"2",
"-",
">",
"2nd",
"3",
"-",
">",
"3rd",
"etc",
"."
] | 74a1a64df1cc77cac55f12f0fe0f52292c6ae479 | https://github.com/uzumaxy/pyvalid/blob/74a1a64df1cc77cac55f12f0fe0f52292c6ae479/pyvalid/__accepts.py#L147-L155 | train |
sio2project/filetracker | filetracker/client/client.py | Client.get_file | def get_file(self, name, save_to, add_to_cache=True,
force_refresh=False, _lock_exclusive=False):
"""Retrieves file identified by ``name``.
The file is saved as ``save_to``. If ``add_to_cache`` is ``True``,
the file is added to the local store. If ``force_refresh`` is
... | python | def get_file(self, name, save_to, add_to_cache=True,
force_refresh=False, _lock_exclusive=False):
"""Retrieves file identified by ``name``.
The file is saved as ``save_to``. If ``add_to_cache`` is ``True``,
the file is added to the local store. If ``force_refresh`` is
... | [
"def",
"get_file",
"(",
"self",
",",
"name",
",",
"save_to",
",",
"add_to_cache",
"=",
"True",
",",
"force_refresh",
"=",
"False",
",",
"_lock_exclusive",
"=",
"False",
")",
":",
"uname",
",",
"version",
"=",
"split_name",
"(",
"name",
")",
"lock",
"=",
... | Retrieves file identified by ``name``.
The file is saved as ``save_to``. If ``add_to_cache`` is ``True``,
the file is added to the local store. If ``force_refresh`` is
``True``, local cache is not examined if a remote store is
configured.
If a remote store is con... | [
"Retrieves",
"file",
"identified",
"by",
"name",
"."
] | 359b474850622e3d0c25ee2596d7242c02f84efb | https://github.com/sio2project/filetracker/blob/359b474850622e3d0c25ee2596d7242c02f84efb/filetracker/client/client.py#L91-L152 | train |
sio2project/filetracker | filetracker/client/client.py | Client.get_stream | def get_stream(self, name, force_refresh=False, serve_from_cache=False):
"""Retrieves file identified by ``name`` in streaming mode.
Works like :meth:`get_file`, except that returns a tuple
(file-like object, versioned name).
When both remote_store and local_store are present,... | python | def get_stream(self, name, force_refresh=False, serve_from_cache=False):
"""Retrieves file identified by ``name`` in streaming mode.
Works like :meth:`get_file`, except that returns a tuple
(file-like object, versioned name).
When both remote_store and local_store are present,... | [
"def",
"get_stream",
"(",
"self",
",",
"name",
",",
"force_refresh",
"=",
"False",
",",
"serve_from_cache",
"=",
"False",
")",
":",
"uname",
",",
"version",
"=",
"split_name",
"(",
"name",
")",
"lock",
"=",
"None",
"if",
"self",
".",
"local_store",
":",
... | Retrieves file identified by ``name`` in streaming mode.
Works like :meth:`get_file`, except that returns a tuple
(file-like object, versioned name).
When both remote_store and local_store are present, serve_from_cache
can be used to ensure that the file will be downloaded ... | [
"Retrieves",
"file",
"identified",
"by",
"name",
"in",
"streaming",
"mode",
"."
] | 359b474850622e3d0c25ee2596d7242c02f84efb | https://github.com/sio2project/filetracker/blob/359b474850622e3d0c25ee2596d7242c02f84efb/filetracker/client/client.py#L154-L199 | train |
sio2project/filetracker | filetracker/client/client.py | Client.file_version | def file_version(self, name):
"""Returns the newest available version number of the file.
If the remote store is configured, it is queried, otherwise
the local version is returned. It is assumed that the remote store
always has the newest version of the file.
If ver... | python | def file_version(self, name):
"""Returns the newest available version number of the file.
If the remote store is configured, it is queried, otherwise
the local version is returned. It is assumed that the remote store
always has the newest version of the file.
If ver... | [
"def",
"file_version",
"(",
"self",
",",
"name",
")",
":",
"if",
"self",
".",
"remote_store",
":",
"return",
"self",
".",
"remote_store",
".",
"file_version",
"(",
"name",
")",
"else",
":",
"return",
"self",
".",
"local_store",
".",
"file_version",
"(",
... | Returns the newest available version number of the file.
If the remote store is configured, it is queried, otherwise
the local version is returned. It is assumed that the remote store
always has the newest version of the file.
If version is a part of ``name``, it is ignored... | [
"Returns",
"the",
"newest",
"available",
"version",
"number",
"of",
"the",
"file",
"."
] | 359b474850622e3d0c25ee2596d7242c02f84efb | https://github.com/sio2project/filetracker/blob/359b474850622e3d0c25ee2596d7242c02f84efb/filetracker/client/client.py#L201-L214 | train |
sio2project/filetracker | filetracker/client/client.py | Client.file_size | def file_size(self, name, force_refresh=False):
"""Returns the size of the file.
For efficiency this operation does not use locking, so may return
inconsistent data. Use it for informational purposes.
"""
uname, version = split_name(name)
t = time.time()
... | python | def file_size(self, name, force_refresh=False):
"""Returns the size of the file.
For efficiency this operation does not use locking, so may return
inconsistent data. Use it for informational purposes.
"""
uname, version = split_name(name)
t = time.time()
... | [
"def",
"file_size",
"(",
"self",
",",
"name",
",",
"force_refresh",
"=",
"False",
")",
":",
"uname",
",",
"version",
"=",
"split_name",
"(",
"name",
")",
"t",
"=",
"time",
".",
"time",
"(",
")",
"logger",
".",
"debug",
"(",
"' querying size of %s'",
... | Returns the size of the file.
For efficiency this operation does not use locking, so may return
inconsistent data. Use it for informational purposes. | [
"Returns",
"the",
"size",
"of",
"the",
"file",
"."
] | 359b474850622e3d0c25ee2596d7242c02f84efb | https://github.com/sio2project/filetracker/blob/359b474850622e3d0c25ee2596d7242c02f84efb/filetracker/client/client.py#L216-L243 | train |
sio2project/filetracker | filetracker/client/client.py | Client.put_file | def put_file(self,
name,
filename,
to_local_store=True,
to_remote_store=True,
compress_hint=True):
"""Adds file ``filename`` to the filetracker under the name ``name``.
If the file already exists, a new version is c... | python | def put_file(self,
name,
filename,
to_local_store=True,
to_remote_store=True,
compress_hint=True):
"""Adds file ``filename`` to the filetracker under the name ``name``.
If the file already exists, a new version is c... | [
"def",
"put_file",
"(",
"self",
",",
"name",
",",
"filename",
",",
"to_local_store",
"=",
"True",
",",
"to_remote_store",
"=",
"True",
",",
"compress_hint",
"=",
"True",
")",
":",
"if",
"not",
"to_local_store",
"and",
"not",
"to_remote_store",
":",
"raise",
... | Adds file ``filename`` to the filetracker under the name ``name``.
If the file already exists, a new version is created. In practice
if the store does not support versioning, the file is overwritten.
The file may be added to local store only (if ``to_remote_store`` is
``Fal... | [
"Adds",
"file",
"filename",
"to",
"the",
"filetracker",
"under",
"the",
"name",
"name",
"."
] | 359b474850622e3d0c25ee2596d7242c02f84efb | https://github.com/sio2project/filetracker/blob/359b474850622e3d0c25ee2596d7242c02f84efb/filetracker/client/client.py#L245-L292 | train |
sio2project/filetracker | filetracker/client/client.py | Client.delete_file | def delete_file(self, name):
"""Deletes the file identified by ``name`` along with its metadata.
The file is removed from both the local store and the remote store.
"""
if self.local_store:
lock = self.lock_manager.lock_for(name)
lock.lock_exclusive()
... | python | def delete_file(self, name):
"""Deletes the file identified by ``name`` along with its metadata.
The file is removed from both the local store and the remote store.
"""
if self.local_store:
lock = self.lock_manager.lock_for(name)
lock.lock_exclusive()
... | [
"def",
"delete_file",
"(",
"self",
",",
"name",
")",
":",
"if",
"self",
".",
"local_store",
":",
"lock",
"=",
"self",
".",
"lock_manager",
".",
"lock_for",
"(",
"name",
")",
"lock",
".",
"lock_exclusive",
"(",
")",
"try",
":",
"self",
".",
"local_store... | Deletes the file identified by ``name`` along with its metadata.
The file is removed from both the local store and the remote store. | [
"Deletes",
"the",
"file",
"identified",
"by",
"name",
"along",
"with",
"its",
"metadata",
"."
] | 359b474850622e3d0c25ee2596d7242c02f84efb | https://github.com/sio2project/filetracker/blob/359b474850622e3d0c25ee2596d7242c02f84efb/filetracker/client/client.py#L294-L307 | train |
sio2project/filetracker | filetracker/client/client.py | Client.list_local_files | def list_local_files(self):
"""Returns list of all stored local files.
Each element of this list is of :class:`DataStore.FileInfoEntry`
type.
"""
result = []
if self.local_store:
result.extend(self.local_store.list_files())
return result | python | def list_local_files(self):
"""Returns list of all stored local files.
Each element of this list is of :class:`DataStore.FileInfoEntry`
type.
"""
result = []
if self.local_store:
result.extend(self.local_store.list_files())
return result | [
"def",
"list_local_files",
"(",
"self",
")",
":",
"result",
"=",
"[",
"]",
"if",
"self",
".",
"local_store",
":",
"result",
".",
"extend",
"(",
"self",
".",
"local_store",
".",
"list_files",
"(",
")",
")",
"return",
"result"
] | Returns list of all stored local files.
Each element of this list is of :class:`DataStore.FileInfoEntry`
type. | [
"Returns",
"list",
"of",
"all",
"stored",
"local",
"files",
"."
] | 359b474850622e3d0c25ee2596d7242c02f84efb | https://github.com/sio2project/filetracker/blob/359b474850622e3d0c25ee2596d7242c02f84efb/filetracker/client/client.py#L309-L318 | train |
humangeo/preflyt | preflyt/__init__.py | load_checkers | def load_checkers():
"""Load the checkers"""
for loader, name, _ in pkgutil.iter_modules([os.path.join(__path__[0], 'checkers')]):
loader.find_module(name).load_module(name) | python | def load_checkers():
"""Load the checkers"""
for loader, name, _ in pkgutil.iter_modules([os.path.join(__path__[0], 'checkers')]):
loader.find_module(name).load_module(name) | [
"def",
"load_checkers",
"(",
")",
":",
"for",
"loader",
",",
"name",
",",
"_",
"in",
"pkgutil",
".",
"iter_modules",
"(",
"[",
"os",
".",
"path",
".",
"join",
"(",
"__path__",
"[",
"0",
"]",
",",
"'checkers'",
")",
"]",
")",
":",
"loader",
".",
"... | Load the checkers | [
"Load",
"the",
"checkers"
] | 3174e6b8fc851ba5bd6c7fcf9becf36a6f6f6d93 | https://github.com/humangeo/preflyt/blob/3174e6b8fc851ba5bd6c7fcf9becf36a6f6f6d93/preflyt/__init__.py#L17-L20 | train |
humangeo/preflyt | preflyt/__init__.py | check | def check(operations, loud=False):
"""Check all the things
:param operations: The operations to check
:param loud: `True` if checkers should prettyprint their status to stderr. `False` otherwise.
:returns: A tuple of overall success, and a detailed execution log for all the operations
"""
if n... | python | def check(operations, loud=False):
"""Check all the things
:param operations: The operations to check
:param loud: `True` if checkers should prettyprint their status to stderr. `False` otherwise.
:returns: A tuple of overall success, and a detailed execution log for all the operations
"""
if n... | [
"def",
"check",
"(",
"operations",
",",
"loud",
"=",
"False",
")",
":",
"if",
"not",
"CHECKERS",
":",
"load_checkers",
"(",
")",
"roll_call",
"=",
"[",
"]",
"everything_ok",
"=",
"True",
"if",
"loud",
"and",
"operations",
":",
"title",
"=",
"\"Preflyt Ch... | Check all the things
:param operations: The operations to check
:param loud: `True` if checkers should prettyprint their status to stderr. `False` otherwise.
:returns: A tuple of overall success, and a detailed execution log for all the operations | [
"Check",
"all",
"the",
"things"
] | 3174e6b8fc851ba5bd6c7fcf9becf36a6f6f6d93 | https://github.com/humangeo/preflyt/blob/3174e6b8fc851ba5bd6c7fcf9becf36a6f6f6d93/preflyt/__init__.py#L22-L49 | train |
humangeo/preflyt | preflyt/__init__.py | verify | def verify(operations, loud=False):
"""Check all the things and be assertive about it
:param operations: THe operations to check
:param loud: `True` if checkers should prettyprint their status to stderr. `False` otherwise.
:returns: The detailed execution log for the operations.
"""
everything... | python | def verify(operations, loud=False):
"""Check all the things and be assertive about it
:param operations: THe operations to check
:param loud: `True` if checkers should prettyprint their status to stderr. `False` otherwise.
:returns: The detailed execution log for the operations.
"""
everything... | [
"def",
"verify",
"(",
"operations",
",",
"loud",
"=",
"False",
")",
":",
"everything_ok",
",",
"roll_call",
"=",
"check",
"(",
"operations",
",",
"loud",
"=",
"loud",
")",
"if",
"not",
"everything_ok",
":",
"raise",
"CheckFailedException",
"(",
"roll_call",
... | Check all the things and be assertive about it
:param operations: THe operations to check
:param loud: `True` if checkers should prettyprint their status to stderr. `False` otherwise.
:returns: The detailed execution log for the operations. | [
"Check",
"all",
"the",
"things",
"and",
"be",
"assertive",
"about",
"it"
] | 3174e6b8fc851ba5bd6c7fcf9becf36a6f6f6d93 | https://github.com/humangeo/preflyt/blob/3174e6b8fc851ba5bd6c7fcf9becf36a6f6f6d93/preflyt/__init__.py#L51-L62 | train |
phn/angles | angles.py | deci2sexa | def deci2sexa(deci, pre=3, trunc=False, lower=None, upper=None,
b=False, upper_trim=False):
"""Returns the sexagesimal representation of a decimal number.
Parameters
----------
deci : float
Decimal number to be converted into sexagesimal. If `lower` and
`upper` are given t... | python | def deci2sexa(deci, pre=3, trunc=False, lower=None, upper=None,
b=False, upper_trim=False):
"""Returns the sexagesimal representation of a decimal number.
Parameters
----------
deci : float
Decimal number to be converted into sexagesimal. If `lower` and
`upper` are given t... | [
"def",
"deci2sexa",
"(",
"deci",
",",
"pre",
"=",
"3",
",",
"trunc",
"=",
"False",
",",
"lower",
"=",
"None",
",",
"upper",
"=",
"None",
",",
"b",
"=",
"False",
",",
"upper_trim",
"=",
"False",
")",
":",
"if",
"lower",
"is",
"not",
"None",
"and",... | Returns the sexagesimal representation of a decimal number.
Parameters
----------
deci : float
Decimal number to be converted into sexagesimal. If `lower` and
`upper` are given then the number is normalized to the given
range before converting to sexagesimal.
pre : int
T... | [
"Returns",
"the",
"sexagesimal",
"representation",
"of",
"a",
"decimal",
"number",
"."
] | 5c30ed7c3a7412177daaed180bf3b2351b287589 | https://github.com/phn/angles/blob/5c30ed7c3a7412177daaed180bf3b2351b287589/angles.py#L269-L403 | train |
phn/angles | angles.py | sexa2deci | def sexa2deci(sign, hd, mm, ss, todeg=False):
"""Combine sexagesimal components into a decimal number.
Parameters
----------
sign : int
Sign of the number: 1 for +ve, -1 for negative.
hd : float
The hour or degree like part.
mm : float
The minute or arc-minute like part.... | python | def sexa2deci(sign, hd, mm, ss, todeg=False):
"""Combine sexagesimal components into a decimal number.
Parameters
----------
sign : int
Sign of the number: 1 for +ve, -1 for negative.
hd : float
The hour or degree like part.
mm : float
The minute or arc-minute like part.... | [
"def",
"sexa2deci",
"(",
"sign",
",",
"hd",
",",
"mm",
",",
"ss",
",",
"todeg",
"=",
"False",
")",
":",
"divisors",
"=",
"[",
"1.0",
",",
"60.0",
",",
"3600.0",
"]",
"d",
"=",
"0.0",
"# sexages[0] is sign.",
"if",
"sign",
"not",
"in",
"(",
"-",
"... | Combine sexagesimal components into a decimal number.
Parameters
----------
sign : int
Sign of the number: 1 for +ve, -1 for negative.
hd : float
The hour or degree like part.
mm : float
The minute or arc-minute like part.
ss : float
The second or arc-second like... | [
"Combine",
"sexagesimal",
"components",
"into",
"a",
"decimal",
"number",
"."
] | 5c30ed7c3a7412177daaed180bf3b2351b287589 | https://github.com/phn/angles/blob/5c30ed7c3a7412177daaed180bf3b2351b287589/angles.py#L406-L477 | train |
phn/angles | angles.py | fmt_angle | def fmt_angle(val, s1=" ", s2=" ", s3="", pre=3, trunc=False,
lower=None, upper=None, b=False, upper_trim=False):
"""Return sexagesimal string of given angle in degrees or hours.
Parameters
----------
val : float
The angle (in degrees or hours) that is to be converted into a
... | python | def fmt_angle(val, s1=" ", s2=" ", s3="", pre=3, trunc=False,
lower=None, upper=None, b=False, upper_trim=False):
"""Return sexagesimal string of given angle in degrees or hours.
Parameters
----------
val : float
The angle (in degrees or hours) that is to be converted into a
... | [
"def",
"fmt_angle",
"(",
"val",
",",
"s1",
"=",
"\" \"",
",",
"s2",
"=",
"\" \"",
",",
"s3",
"=",
"\"\"",
",",
"pre",
"=",
"3",
",",
"trunc",
"=",
"False",
",",
"lower",
"=",
"None",
",",
"upper",
"=",
"None",
",",
"b",
"=",
"False",
",",
"up... | Return sexagesimal string of given angle in degrees or hours.
Parameters
----------
val : float
The angle (in degrees or hours) that is to be converted into a
sexagesimal string.
s1 : str
Character to be used between the first and second parts of the
the sexagesimal repr... | [
"Return",
"sexagesimal",
"string",
"of",
"given",
"angle",
"in",
"degrees",
"or",
"hours",
"."
] | 5c30ed7c3a7412177daaed180bf3b2351b287589 | https://github.com/phn/angles/blob/5c30ed7c3a7412177daaed180bf3b2351b287589/angles.py#L480-L551 | train |
phn/angles | angles.py | phmsdms | def phmsdms(hmsdms):
"""Parse a string containing a sexagesimal number.
This can handle several types of delimiters and will process
reasonably valid strings. See examples.
Parameters
----------
hmsdms : str
String containing a sexagesimal number.
Returns
-------
d : dict
... | python | def phmsdms(hmsdms):
"""Parse a string containing a sexagesimal number.
This can handle several types of delimiters and will process
reasonably valid strings. See examples.
Parameters
----------
hmsdms : str
String containing a sexagesimal number.
Returns
-------
d : dict
... | [
"def",
"phmsdms",
"(",
"hmsdms",
")",
":",
"units",
"=",
"None",
"sign",
"=",
"None",
"# Floating point regex:",
"# http://www.regular-expressions.info/floatingpoint.html",
"#",
"# pattern1: find a decimal number (int or float) and any",
"# characters following it upto the next decim... | Parse a string containing a sexagesimal number.
This can handle several types of delimiters and will process
reasonably valid strings. See examples.
Parameters
----------
hmsdms : str
String containing a sexagesimal number.
Returns
-------
d : dict
parts : a 3 element... | [
"Parse",
"a",
"string",
"containing",
"a",
"sexagesimal",
"number",
"."
] | 5c30ed7c3a7412177daaed180bf3b2351b287589 | https://github.com/phn/angles/blob/5c30ed7c3a7412177daaed180bf3b2351b287589/angles.py#L554-L746 | train |
phn/angles | angles.py | pposition | def pposition(hd, details=False):
"""Parse string into angular position.
A string containing 2 or 6 numbers is parsed, and the numbers are
converted into decimal numbers. In the former case the numbers are
assumed to be floats. In the latter case, the numbers are assumed
to be sexagesimal.
Par... | python | def pposition(hd, details=False):
"""Parse string into angular position.
A string containing 2 or 6 numbers is parsed, and the numbers are
converted into decimal numbers. In the former case the numbers are
assumed to be floats. In the latter case, the numbers are assumed
to be sexagesimal.
Par... | [
"def",
"pposition",
"(",
"hd",
",",
"details",
"=",
"False",
")",
":",
"# :TODO: split two angles based on user entered separator and process each part separately.",
"# Split at any character other than a digit, \".\", \"-\", and \"+\".",
"p",
"=",
"re",
".",
"split",
"(",
"r\"[^... | Parse string into angular position.
A string containing 2 or 6 numbers is parsed, and the numbers are
converted into decimal numbers. In the former case the numbers are
assumed to be floats. In the latter case, the numbers are assumed
to be sexagesimal.
Parameters
----------
hd: str
... | [
"Parse",
"string",
"into",
"angular",
"position",
"."
] | 5c30ed7c3a7412177daaed180bf3b2351b287589 | https://github.com/phn/angles/blob/5c30ed7c3a7412177daaed180bf3b2351b287589/angles.py#L749-L845 | train |
phn/angles | angles.py | sep | def sep(a1, b1, a2, b2):
"""Angular spearation between two points on a unit sphere.
This will be an angle between [0, π] radians.
Parameters
----------
a1, b1 : float
Longitude-like and latitude-like angles defining the first
point. Both are in radians.
a2, b2 : float
... | python | def sep(a1, b1, a2, b2):
"""Angular spearation between two points on a unit sphere.
This will be an angle between [0, π] radians.
Parameters
----------
a1, b1 : float
Longitude-like and latitude-like angles defining the first
point. Both are in radians.
a2, b2 : float
... | [
"def",
"sep",
"(",
"a1",
",",
"b1",
",",
"a2",
",",
"b2",
")",
":",
"# Tolerance to decide if the calculated separation is zero.",
"tol",
"=",
"1e-15",
"v",
"=",
"CartesianVector",
".",
"from_spherical",
"(",
"1.0",
",",
"a1",
",",
"b1",
")",
"v2",
"=",
"C... | Angular spearation between two points on a unit sphere.
This will be an angle between [0, π] radians.
Parameters
----------
a1, b1 : float
Longitude-like and latitude-like angles defining the first
point. Both are in radians.
a2, b2 : float
Longitude-like and latitude-like... | [
"Angular",
"spearation",
"between",
"two",
"points",
"on",
"a",
"unit",
"sphere",
"."
] | 5c30ed7c3a7412177daaed180bf3b2351b287589 | https://github.com/phn/angles/blob/5c30ed7c3a7412177daaed180bf3b2351b287589/angles.py#L848-L908 | train |
phn/angles | angles.py | normalize_sphere | def normalize_sphere(alpha, delta):
"""Normalize angles of a point on a sphere.
Parameters
----------
alpha: float
The alpha (right ascension/longitude like) angle in degrees.
delta: float
The delta (declination/latitude like) angle in degrees.
Returns
-------
(alpha, d... | python | def normalize_sphere(alpha, delta):
"""Normalize angles of a point on a sphere.
Parameters
----------
alpha: float
The alpha (right ascension/longitude like) angle in degrees.
delta: float
The delta (declination/latitude like) angle in degrees.
Returns
-------
(alpha, d... | [
"def",
"normalize_sphere",
"(",
"alpha",
",",
"delta",
")",
":",
"v",
"=",
"CartesianVector",
".",
"from_spherical",
"(",
"r",
"=",
"1.0",
",",
"alpha",
"=",
"d2r",
"(",
"alpha",
")",
",",
"delta",
"=",
"d2r",
"(",
"delta",
")",
")",
"angles",
"=",
... | Normalize angles of a point on a sphere.
Parameters
----------
alpha: float
The alpha (right ascension/longitude like) angle in degrees.
delta: float
The delta (declination/latitude like) angle in degrees.
Returns
-------
(alpha, delta): (float, float)
Normalized al... | [
"Normalize",
"angles",
"of",
"a",
"point",
"on",
"a",
"sphere",
"."
] | 5c30ed7c3a7412177daaed180bf3b2351b287589 | https://github.com/phn/angles/blob/5c30ed7c3a7412177daaed180bf3b2351b287589/angles.py#L1969-L2003 | train |
phn/angles | angles.py | CartesianVector.from_spherical | def from_spherical(cls, r=1.0, alpha=0.0, delta=0.0):
"""Construct Cartesian vector from spherical coordinates.
alpha and delta must be in radians.
"""
x = r * math.cos(delta) * math.cos(alpha)
y = r * math.cos(delta) * math.sin(alpha)
z = r * math.sin(delta)
ret... | python | def from_spherical(cls, r=1.0, alpha=0.0, delta=0.0):
"""Construct Cartesian vector from spherical coordinates.
alpha and delta must be in radians.
"""
x = r * math.cos(delta) * math.cos(alpha)
y = r * math.cos(delta) * math.sin(alpha)
z = r * math.sin(delta)
ret... | [
"def",
"from_spherical",
"(",
"cls",
",",
"r",
"=",
"1.0",
",",
"alpha",
"=",
"0.0",
",",
"delta",
"=",
"0.0",
")",
":",
"x",
"=",
"r",
"*",
"math",
".",
"cos",
"(",
"delta",
")",
"*",
"math",
".",
"cos",
"(",
"alpha",
")",
"y",
"=",
"r",
"... | Construct Cartesian vector from spherical coordinates.
alpha and delta must be in radians. | [
"Construct",
"Cartesian",
"vector",
"from",
"spherical",
"coordinates",
"."
] | 5c30ed7c3a7412177daaed180bf3b2351b287589 | https://github.com/phn/angles/blob/5c30ed7c3a7412177daaed180bf3b2351b287589/angles.py#L1908-L1916 | train |
phn/angles | angles.py | CartesianVector.cross | def cross(self, v):
"""Cross product of two vectors.
Parameters
----------
v : CartesianVector
The vector to take cross product with.
Returns
-------
v : CartesianVector
Cross product of this vector and the given vector.
"""
... | python | def cross(self, v):
"""Cross product of two vectors.
Parameters
----------
v : CartesianVector
The vector to take cross product with.
Returns
-------
v : CartesianVector
Cross product of this vector and the given vector.
"""
... | [
"def",
"cross",
"(",
"self",
",",
"v",
")",
":",
"n",
"=",
"self",
".",
"__class__",
"(",
")",
"n",
".",
"x",
"=",
"self",
".",
"y",
"*",
"v",
".",
"z",
"-",
"self",
".",
"z",
"*",
"v",
".",
"y",
"n",
".",
"y",
"=",
"-",
"(",
"self",
... | Cross product of two vectors.
Parameters
----------
v : CartesianVector
The vector to take cross product with.
Returns
-------
v : CartesianVector
Cross product of this vector and the given vector. | [
"Cross",
"product",
"of",
"two",
"vectors",
"."
] | 5c30ed7c3a7412177daaed180bf3b2351b287589 | https://github.com/phn/angles/blob/5c30ed7c3a7412177daaed180bf3b2351b287589/angles.py#L1921-L1940 | train |
phn/angles | angles.py | CartesianVector.mod | def mod(self):
"""Modulus of vector."""
return math.sqrt(self.x ** 2 + self.y ** 2 + self.z ** 2) | python | def mod(self):
"""Modulus of vector."""
return math.sqrt(self.x ** 2 + self.y ** 2 + self.z ** 2) | [
"def",
"mod",
"(",
"self",
")",
":",
"return",
"math",
".",
"sqrt",
"(",
"self",
".",
"x",
"**",
"2",
"+",
"self",
".",
"y",
"**",
"2",
"+",
"self",
".",
"z",
"**",
"2",
")"
] | Modulus of vector. | [
"Modulus",
"of",
"vector",
"."
] | 5c30ed7c3a7412177daaed180bf3b2351b287589 | https://github.com/phn/angles/blob/5c30ed7c3a7412177daaed180bf3b2351b287589/angles.py#L1943-L1945 | train |
phn/angles | angles.py | AngularPosition.sep | def sep(self, p):
"""Angular spearation between objects in radians.
Parameters
----------
p : AngularPosition
The object to which the separation from the current object
is to be calculated.
Notes
-----
This method calls the function sep()... | python | def sep(self, p):
"""Angular spearation between objects in radians.
Parameters
----------
p : AngularPosition
The object to which the separation from the current object
is to be calculated.
Notes
-----
This method calls the function sep()... | [
"def",
"sep",
"(",
"self",
",",
"p",
")",
":",
"return",
"sep",
"(",
"self",
".",
"alpha",
".",
"r",
",",
"self",
".",
"delta",
".",
"r",
",",
"p",
".",
"alpha",
".",
"r",
",",
"p",
".",
"delta",
".",
"r",
")"
] | Angular spearation between objects in radians.
Parameters
----------
p : AngularPosition
The object to which the separation from the current object
is to be calculated.
Notes
-----
This method calls the function sep(). See its docstring for
... | [
"Angular",
"spearation",
"between",
"objects",
"in",
"radians",
"."
] | 5c30ed7c3a7412177daaed180bf3b2351b287589 | https://github.com/phn/angles/blob/5c30ed7c3a7412177daaed180bf3b2351b287589/angles.py#L2194-L2213 | train |
phn/angles | angles.py | AngularPosition.bear | def bear(self, p):
"""Find position angle between objects, in radians.
Parameters
----------
p : AngularPosition
The object to which bearing must be determined.
Notes
-----
This method calls the function bear(). See its docstring for
details.... | python | def bear(self, p):
"""Find position angle between objects, in radians.
Parameters
----------
p : AngularPosition
The object to which bearing must be determined.
Notes
-----
This method calls the function bear(). See its docstring for
details.... | [
"def",
"bear",
"(",
"self",
",",
"p",
")",
":",
"return",
"bear",
"(",
"self",
".",
"alpha",
".",
"r",
",",
"self",
".",
"delta",
".",
"r",
",",
"p",
".",
"alpha",
".",
"r",
",",
"p",
".",
"delta",
".",
"r",
")"
] | Find position angle between objects, in radians.
Parameters
----------
p : AngularPosition
The object to which bearing must be determined.
Notes
-----
This method calls the function bear(). See its docstring for
details.
See also
---... | [
"Find",
"position",
"angle",
"between",
"objects",
"in",
"radians",
"."
] | 5c30ed7c3a7412177daaed180bf3b2351b287589 | https://github.com/phn/angles/blob/5c30ed7c3a7412177daaed180bf3b2351b287589/angles.py#L2215-L2233 | train |
cltl/KafNafParserPy | KafNafParserPy/chunk_data.py | Cchunks.get_chunk | def get_chunk(self, chunk_id):
"""
Returns the chunk object for the supplied identifier
@type chunk_id: string
@param chunk_id: chunk identifier
"""
if chunk_id in self.idx:
return Cchunk(self.idx[chunk_id], self.type)
else:
return None | python | def get_chunk(self, chunk_id):
"""
Returns the chunk object for the supplied identifier
@type chunk_id: string
@param chunk_id: chunk identifier
"""
if chunk_id in self.idx:
return Cchunk(self.idx[chunk_id], self.type)
else:
return None | [
"def",
"get_chunk",
"(",
"self",
",",
"chunk_id",
")",
":",
"if",
"chunk_id",
"in",
"self",
".",
"idx",
":",
"return",
"Cchunk",
"(",
"self",
".",
"idx",
"[",
"chunk_id",
"]",
",",
"self",
".",
"type",
")",
"else",
":",
"return",
"None"
] | Returns the chunk object for the supplied identifier
@type chunk_id: string
@param chunk_id: chunk identifier | [
"Returns",
"the",
"chunk",
"object",
"for",
"the",
"supplied",
"identifier"
] | 9bc32e803c176404b255ba317479b8780ed5f569 | https://github.com/cltl/KafNafParserPy/blob/9bc32e803c176404b255ba317479b8780ed5f569/KafNafParserPy/chunk_data.py#L191-L200 | train |
cltl/KafNafParserPy | KafNafParserPy/chunk_data.py | Cchunks.add_chunk | def add_chunk(self, chunk_obj):
"""
Adds a chunk object to the layer
@type chunk_obj: L{Cchunk}
@param chunk_obj: the chunk object
"""
if chunk_obj.get_id() in self.idx:
raise ValueError("Chunk with id {} already exists!"
.format(c... | python | def add_chunk(self, chunk_obj):
"""
Adds a chunk object to the layer
@type chunk_obj: L{Cchunk}
@param chunk_obj: the chunk object
"""
if chunk_obj.get_id() in self.idx:
raise ValueError("Chunk with id {} already exists!"
.format(c... | [
"def",
"add_chunk",
"(",
"self",
",",
"chunk_obj",
")",
":",
"if",
"chunk_obj",
".",
"get_id",
"(",
")",
"in",
"self",
".",
"idx",
":",
"raise",
"ValueError",
"(",
"\"Chunk with id {} already exists!\"",
".",
"format",
"(",
"chunk_obj",
".",
"get_id",
"(",
... | Adds a chunk object to the layer
@type chunk_obj: L{Cchunk}
@param chunk_obj: the chunk object | [
"Adds",
"a",
"chunk",
"object",
"to",
"the",
"layer"
] | 9bc32e803c176404b255ba317479b8780ed5f569 | https://github.com/cltl/KafNafParserPy/blob/9bc32e803c176404b255ba317479b8780ed5f569/KafNafParserPy/chunk_data.py#L202-L212 | train |
thombashi/DataProperty | examples/py/to_column_dp_list.py | display_col_dp | def display_col_dp(dp_list, attr_name):
"""
show a value assocciated with an attribute for each
DataProperty instance in the dp_list
"""
print()
print("---------- {:s} ----------".format(attr_name))
print([getattr(dp, attr_name) for dp in dp_list]) | python | def display_col_dp(dp_list, attr_name):
"""
show a value assocciated with an attribute for each
DataProperty instance in the dp_list
"""
print()
print("---------- {:s} ----------".format(attr_name))
print([getattr(dp, attr_name) for dp in dp_list]) | [
"def",
"display_col_dp",
"(",
"dp_list",
",",
"attr_name",
")",
":",
"print",
"(",
")",
"print",
"(",
"\"---------- {:s} ----------\"",
".",
"format",
"(",
"attr_name",
")",
")",
"print",
"(",
"[",
"getattr",
"(",
"dp",
",",
"attr_name",
")",
"for",
"dp",
... | show a value assocciated with an attribute for each
DataProperty instance in the dp_list | [
"show",
"a",
"value",
"assocciated",
"with",
"an",
"attribute",
"for",
"each",
"DataProperty",
"instance",
"in",
"the",
"dp_list"
] | 1d1a4c6abee87264c2f870a932c0194895d80a18 | https://github.com/thombashi/DataProperty/blob/1d1a4c6abee87264c2f870a932c0194895d80a18/examples/py/to_column_dp_list.py#L16-L24 | train |
MacHu-GWU/macro-project | macro/bot.py | Bot.delay | def delay(self, dl=0):
"""Delay for ``dl`` seconds.
"""
if dl is None:
time.sleep(self.dl)
elif dl < 0:
sys.stderr.write(
"delay cannot less than zero, this takes no effects.\n")
else:
time.sleep(dl) | python | def delay(self, dl=0):
"""Delay for ``dl`` seconds.
"""
if dl is None:
time.sleep(self.dl)
elif dl < 0:
sys.stderr.write(
"delay cannot less than zero, this takes no effects.\n")
else:
time.sleep(dl) | [
"def",
"delay",
"(",
"self",
",",
"dl",
"=",
"0",
")",
":",
"if",
"dl",
"is",
"None",
":",
"time",
".",
"sleep",
"(",
"self",
".",
"dl",
")",
"elif",
"dl",
"<",
"0",
":",
"sys",
".",
"stderr",
".",
"write",
"(",
"\"delay cannot less than zero, this... | Delay for ``dl`` seconds. | [
"Delay",
"for",
"dl",
"seconds",
"."
] | dae909d2d28acbfa2be623aa2dffe988f3882d4d | https://github.com/MacHu-GWU/macro-project/blob/dae909d2d28acbfa2be623aa2dffe988f3882d4d/macro/bot.py#L134-L143 | train |
MacHu-GWU/macro-project | macro/bot.py | Bot.scroll_up | def scroll_up(self, n, pre_dl=None, post_dl=None):
"""Scroll up ``n`` times.
**中文文档**
鼠标滚轮向上滚动n次。
"""
self.delay(pre_dl)
self.m.scroll(vertical=n)
self.delay(post_dl) | python | def scroll_up(self, n, pre_dl=None, post_dl=None):
"""Scroll up ``n`` times.
**中文文档**
鼠标滚轮向上滚动n次。
"""
self.delay(pre_dl)
self.m.scroll(vertical=n)
self.delay(post_dl) | [
"def",
"scroll_up",
"(",
"self",
",",
"n",
",",
"pre_dl",
"=",
"None",
",",
"post_dl",
"=",
"None",
")",
":",
"self",
".",
"delay",
"(",
"pre_dl",
")",
"self",
".",
"m",
".",
"scroll",
"(",
"vertical",
"=",
"n",
")",
"self",
".",
"delay",
"(",
... | Scroll up ``n`` times.
**中文文档**
鼠标滚轮向上滚动n次。 | [
"Scroll",
"up",
"n",
"times",
"."
] | dae909d2d28acbfa2be623aa2dffe988f3882d4d | https://github.com/MacHu-GWU/macro-project/blob/dae909d2d28acbfa2be623aa2dffe988f3882d4d/macro/bot.py#L203-L212 | train |
MacHu-GWU/macro-project | macro/bot.py | Bot.scroll_right | def scroll_right(self, n, pre_dl=None, post_dl=None):
"""Scroll right ``n`` times.
**中文文档**
鼠标滚轮向右滚动n次(如果可能的话)。
"""
self.delay(pre_dl)
self.m.scroll(horizontal=n)
self.delay(post_dl) | python | def scroll_right(self, n, pre_dl=None, post_dl=None):
"""Scroll right ``n`` times.
**中文文档**
鼠标滚轮向右滚动n次(如果可能的话)。
"""
self.delay(pre_dl)
self.m.scroll(horizontal=n)
self.delay(post_dl) | [
"def",
"scroll_right",
"(",
"self",
",",
"n",
",",
"pre_dl",
"=",
"None",
",",
"post_dl",
"=",
"None",
")",
":",
"self",
".",
"delay",
"(",
"pre_dl",
")",
"self",
".",
"m",
".",
"scroll",
"(",
"horizontal",
"=",
"n",
")",
"self",
".",
"delay",
"(... | Scroll right ``n`` times.
**中文文档**
鼠标滚轮向右滚动n次(如果可能的话)。 | [
"Scroll",
"right",
"n",
"times",
"."
] | dae909d2d28acbfa2be623aa2dffe988f3882d4d | https://github.com/MacHu-GWU/macro-project/blob/dae909d2d28acbfa2be623aa2dffe988f3882d4d/macro/bot.py#L225-L234 | train |
MacHu-GWU/macro-project | macro/bot.py | Bot.tap_key | def tap_key(self, key_name, n=1, interval=0, pre_dl=None, post_dl=None):
"""Tap a key on keyboard for ``n`` times, with ``interval`` seconds of
interval. Key is declared by it's name
Example::
bot.tap_key("a")
bot.tap_key(1)
bot.tap_key("up")
bot... | python | def tap_key(self, key_name, n=1, interval=0, pre_dl=None, post_dl=None):
"""Tap a key on keyboard for ``n`` times, with ``interval`` seconds of
interval. Key is declared by it's name
Example::
bot.tap_key("a")
bot.tap_key(1)
bot.tap_key("up")
bot... | [
"def",
"tap_key",
"(",
"self",
",",
"key_name",
",",
"n",
"=",
"1",
",",
"interval",
"=",
"0",
",",
"pre_dl",
"=",
"None",
",",
"post_dl",
"=",
"None",
")",
":",
"key",
"=",
"self",
".",
"_parse_key",
"(",
"key_name",
")",
"self",
".",
"delay",
"... | Tap a key on keyboard for ``n`` times, with ``interval`` seconds of
interval. Key is declared by it's name
Example::
bot.tap_key("a")
bot.tap_key(1)
bot.tap_key("up")
bot.tap_key("space")
bot.tap_key("enter")
bot.tap_key("tab")
... | [
"Tap",
"a",
"key",
"on",
"keyboard",
"for",
"n",
"times",
"with",
"interval",
"seconds",
"of",
"interval",
".",
"Key",
"is",
"declared",
"by",
"it",
"s",
"name"
] | dae909d2d28acbfa2be623aa2dffe988f3882d4d | https://github.com/MacHu-GWU/macro-project/blob/dae909d2d28acbfa2be623aa2dffe988f3882d4d/macro/bot.py#L273-L293 | train |
MacHu-GWU/macro-project | macro/bot.py | Bot.enter | def enter(self, n=1, interval=0, pre_dl=None, post_dl=None):
"""Press enter key n times.
**中文文档**
按回车键/换行键 n 次。
"""
self.delay(pre_dl)
self.k.tap_key(self.k.enter_key, n, interval)
self.delay(post_dl) | python | def enter(self, n=1, interval=0, pre_dl=None, post_dl=None):
"""Press enter key n times.
**中文文档**
按回车键/换行键 n 次。
"""
self.delay(pre_dl)
self.k.tap_key(self.k.enter_key, n, interval)
self.delay(post_dl) | [
"def",
"enter",
"(",
"self",
",",
"n",
"=",
"1",
",",
"interval",
"=",
"0",
",",
"pre_dl",
"=",
"None",
",",
"post_dl",
"=",
"None",
")",
":",
"self",
".",
"delay",
"(",
"pre_dl",
")",
"self",
".",
"k",
".",
"tap_key",
"(",
"self",
".",
"k",
... | Press enter key n times.
**中文文档**
按回车键/换行键 n 次。 | [
"Press",
"enter",
"key",
"n",
"times",
"."
] | dae909d2d28acbfa2be623aa2dffe988f3882d4d | https://github.com/MacHu-GWU/macro-project/blob/dae909d2d28acbfa2be623aa2dffe988f3882d4d/macro/bot.py#L295-L304 | train |
MacHu-GWU/macro-project | macro/bot.py | Bot.backspace | def backspace(self, n=1, interval=0, pre_dl=None, post_dl=None):
"""Press backspace key n times.
**中文文档**
按退格键 n 次。
"""
self.delay(pre_dl)
self.k.tap_key(self.k.backspace_key, n, interval)
self.delay(post_dl) | python | def backspace(self, n=1, interval=0, pre_dl=None, post_dl=None):
"""Press backspace key n times.
**中文文档**
按退格键 n 次。
"""
self.delay(pre_dl)
self.k.tap_key(self.k.backspace_key, n, interval)
self.delay(post_dl) | [
"def",
"backspace",
"(",
"self",
",",
"n",
"=",
"1",
",",
"interval",
"=",
"0",
",",
"pre_dl",
"=",
"None",
",",
"post_dl",
"=",
"None",
")",
":",
"self",
".",
"delay",
"(",
"pre_dl",
")",
"self",
".",
"k",
".",
"tap_key",
"(",
"self",
".",
"k"... | Press backspace key n times.
**中文文档**
按退格键 n 次。 | [
"Press",
"backspace",
"key",
"n",
"times",
"."
] | dae909d2d28acbfa2be623aa2dffe988f3882d4d | https://github.com/MacHu-GWU/macro-project/blob/dae909d2d28acbfa2be623aa2dffe988f3882d4d/macro/bot.py#L306-L315 | train |
MacHu-GWU/macro-project | macro/bot.py | Bot.space | def space(self, n=1, interval=0, pre_dl=None, post_dl=None):
"""Press white space key n times.
**中文文档**
按空格键 n 次。
"""
self.delay(pre_dl)
self.k.tap_key(self.k.space_key, n)
self.delay(post_dl) | python | def space(self, n=1, interval=0, pre_dl=None, post_dl=None):
"""Press white space key n times.
**中文文档**
按空格键 n 次。
"""
self.delay(pre_dl)
self.k.tap_key(self.k.space_key, n)
self.delay(post_dl) | [
"def",
"space",
"(",
"self",
",",
"n",
"=",
"1",
",",
"interval",
"=",
"0",
",",
"pre_dl",
"=",
"None",
",",
"post_dl",
"=",
"None",
")",
":",
"self",
".",
"delay",
"(",
"pre_dl",
")",
"self",
".",
"k",
".",
"tap_key",
"(",
"self",
".",
"k",
... | Press white space key n times.
**中文文档**
按空格键 n 次。 | [
"Press",
"white",
"space",
"key",
"n",
"times",
"."
] | dae909d2d28acbfa2be623aa2dffe988f3882d4d | https://github.com/MacHu-GWU/macro-project/blob/dae909d2d28acbfa2be623aa2dffe988f3882d4d/macro/bot.py#L317-L326 | train |
MacHu-GWU/macro-project | macro/bot.py | Bot.fn | def fn(self, i, n=1, interval=0, pre_dl=None, post_dl=None):
"""Press Fn key n times.
**中文文档**
按 Fn 功能键 n 次。
"""
self.delay(pre_dl)
self.k.tap_key(self.k.function_keys[i], n, interval)
self.delay(post_dl) | python | def fn(self, i, n=1, interval=0, pre_dl=None, post_dl=None):
"""Press Fn key n times.
**中文文档**
按 Fn 功能键 n 次。
"""
self.delay(pre_dl)
self.k.tap_key(self.k.function_keys[i], n, interval)
self.delay(post_dl) | [
"def",
"fn",
"(",
"self",
",",
"i",
",",
"n",
"=",
"1",
",",
"interval",
"=",
"0",
",",
"pre_dl",
"=",
"None",
",",
"post_dl",
"=",
"None",
")",
":",
"self",
".",
"delay",
"(",
"pre_dl",
")",
"self",
".",
"k",
".",
"tap_key",
"(",
"self",
"."... | Press Fn key n times.
**中文文档**
按 Fn 功能键 n 次。 | [
"Press",
"Fn",
"key",
"n",
"times",
"."
] | dae909d2d28acbfa2be623aa2dffe988f3882d4d | https://github.com/MacHu-GWU/macro-project/blob/dae909d2d28acbfa2be623aa2dffe988f3882d4d/macro/bot.py#L328-L337 | train |
MacHu-GWU/macro-project | macro/bot.py | Bot.tab | def tab(self, n=1, interval=0, pre_dl=None, post_dl=None):
"""Tap ``tab`` key for ``n`` times, with ``interval`` seconds of interval.
**中文文档**
以 ``interval`` 中定义的频率按下某个tab键 ``n`` 次。
"""
self.delay(pre_dl)
self.k.tap_key(self.k.tab_key, n, interval)
self.delay(po... | python | def tab(self, n=1, interval=0, pre_dl=None, post_dl=None):
"""Tap ``tab`` key for ``n`` times, with ``interval`` seconds of interval.
**中文文档**
以 ``interval`` 中定义的频率按下某个tab键 ``n`` 次。
"""
self.delay(pre_dl)
self.k.tap_key(self.k.tab_key, n, interval)
self.delay(po... | [
"def",
"tab",
"(",
"self",
",",
"n",
"=",
"1",
",",
"interval",
"=",
"0",
",",
"pre_dl",
"=",
"None",
",",
"post_dl",
"=",
"None",
")",
":",
"self",
".",
"delay",
"(",
"pre_dl",
")",
"self",
".",
"k",
".",
"tap_key",
"(",
"self",
".",
"k",
".... | Tap ``tab`` key for ``n`` times, with ``interval`` seconds of interval.
**中文文档**
以 ``interval`` 中定义的频率按下某个tab键 ``n`` 次。 | [
"Tap",
"tab",
"key",
"for",
"n",
"times",
"with",
"interval",
"seconds",
"of",
"interval",
"."
] | dae909d2d28acbfa2be623aa2dffe988f3882d4d | https://github.com/MacHu-GWU/macro-project/blob/dae909d2d28acbfa2be623aa2dffe988f3882d4d/macro/bot.py#L339-L348 | train |
MacHu-GWU/macro-project | macro/bot.py | Bot.up | def up(self, n=1, interval=0, pre_dl=None, post_dl=None):
"""Press up key n times.
**中文文档**
按上方向键 n 次。
"""
self.delay(pre_dl)
self.k.tap_key(self.k.up_key, n, interval)
self.delay(post_dl) | python | def up(self, n=1, interval=0, pre_dl=None, post_dl=None):
"""Press up key n times.
**中文文档**
按上方向键 n 次。
"""
self.delay(pre_dl)
self.k.tap_key(self.k.up_key, n, interval)
self.delay(post_dl) | [
"def",
"up",
"(",
"self",
",",
"n",
"=",
"1",
",",
"interval",
"=",
"0",
",",
"pre_dl",
"=",
"None",
",",
"post_dl",
"=",
"None",
")",
":",
"self",
".",
"delay",
"(",
"pre_dl",
")",
"self",
".",
"k",
".",
"tap_key",
"(",
"self",
".",
"k",
"."... | Press up key n times.
**中文文档**
按上方向键 n 次。 | [
"Press",
"up",
"key",
"n",
"times",
"."
] | dae909d2d28acbfa2be623aa2dffe988f3882d4d | https://github.com/MacHu-GWU/macro-project/blob/dae909d2d28acbfa2be623aa2dffe988f3882d4d/macro/bot.py#L350-L359 | train |
MacHu-GWU/macro-project | macro/bot.py | Bot.down | def down(self, n=1, interval=0, pre_dl=None, post_dl=None):
"""Press down key n times.
**中文文档**
按下方向键 n 次。
"""
self.delay(pre_dl)
self.k.tap_key(self.k.down_key, n, interval)
self.delay(post_dl) | python | def down(self, n=1, interval=0, pre_dl=None, post_dl=None):
"""Press down key n times.
**中文文档**
按下方向键 n 次。
"""
self.delay(pre_dl)
self.k.tap_key(self.k.down_key, n, interval)
self.delay(post_dl) | [
"def",
"down",
"(",
"self",
",",
"n",
"=",
"1",
",",
"interval",
"=",
"0",
",",
"pre_dl",
"=",
"None",
",",
"post_dl",
"=",
"None",
")",
":",
"self",
".",
"delay",
"(",
"pre_dl",
")",
"self",
".",
"k",
".",
"tap_key",
"(",
"self",
".",
"k",
"... | Press down key n times.
**中文文档**
按下方向键 n 次。 | [
"Press",
"down",
"key",
"n",
"times",
"."
] | dae909d2d28acbfa2be623aa2dffe988f3882d4d | https://github.com/MacHu-GWU/macro-project/blob/dae909d2d28acbfa2be623aa2dffe988f3882d4d/macro/bot.py#L361-L370 | train |
MacHu-GWU/macro-project | macro/bot.py | Bot.left | def left(self, n=1, interval=0, pre_dl=None, post_dl=None):
"""Press left key n times
**中文文档**
按左方向键 n 次。
"""
self.delay(pre_dl)
self.k.tap_key(self.k.left_key, n, interval)
self.delay(post_dl) | python | def left(self, n=1, interval=0, pre_dl=None, post_dl=None):
"""Press left key n times
**中文文档**
按左方向键 n 次。
"""
self.delay(pre_dl)
self.k.tap_key(self.k.left_key, n, interval)
self.delay(post_dl) | [
"def",
"left",
"(",
"self",
",",
"n",
"=",
"1",
",",
"interval",
"=",
"0",
",",
"pre_dl",
"=",
"None",
",",
"post_dl",
"=",
"None",
")",
":",
"self",
".",
"delay",
"(",
"pre_dl",
")",
"self",
".",
"k",
".",
"tap_key",
"(",
"self",
".",
"k",
"... | Press left key n times
**中文文档**
按左方向键 n 次。 | [
"Press",
"left",
"key",
"n",
"times"
] | dae909d2d28acbfa2be623aa2dffe988f3882d4d | https://github.com/MacHu-GWU/macro-project/blob/dae909d2d28acbfa2be623aa2dffe988f3882d4d/macro/bot.py#L372-L381 | train |
MacHu-GWU/macro-project | macro/bot.py | Bot.right | def right(self, n=1, interval=0, pre_dl=None, post_dl=None):
"""Press right key n times.
**中文文档**
按右方向键 n 次。
"""
self.delay(pre_dl)
self.k.tap_key(self.k.right_key, n, interval)
self.delay(post_dl) | python | def right(self, n=1, interval=0, pre_dl=None, post_dl=None):
"""Press right key n times.
**中文文档**
按右方向键 n 次。
"""
self.delay(pre_dl)
self.k.tap_key(self.k.right_key, n, interval)
self.delay(post_dl) | [
"def",
"right",
"(",
"self",
",",
"n",
"=",
"1",
",",
"interval",
"=",
"0",
",",
"pre_dl",
"=",
"None",
",",
"post_dl",
"=",
"None",
")",
":",
"self",
".",
"delay",
"(",
"pre_dl",
")",
"self",
".",
"k",
".",
"tap_key",
"(",
"self",
".",
"k",
... | Press right key n times.
**中文文档**
按右方向键 n 次。 | [
"Press",
"right",
"key",
"n",
"times",
"."
] | dae909d2d28acbfa2be623aa2dffe988f3882d4d | https://github.com/MacHu-GWU/macro-project/blob/dae909d2d28acbfa2be623aa2dffe988f3882d4d/macro/bot.py#L383-L392 | train |
MacHu-GWU/macro-project | macro/bot.py | Bot.delete | def delete(self, n=1, interval=0, pre_dl=None, post_dl=None):
"""Pres delete key n times.
**中文文档**
按 delete 键n次。
"""
self.delay(pre_dl)
self.k.tap_key(self.k.delete_key, n, interval)
self.delay(post_dl) | python | def delete(self, n=1, interval=0, pre_dl=None, post_dl=None):
"""Pres delete key n times.
**中文文档**
按 delete 键n次。
"""
self.delay(pre_dl)
self.k.tap_key(self.k.delete_key, n, interval)
self.delay(post_dl) | [
"def",
"delete",
"(",
"self",
",",
"n",
"=",
"1",
",",
"interval",
"=",
"0",
",",
"pre_dl",
"=",
"None",
",",
"post_dl",
"=",
"None",
")",
":",
"self",
".",
"delay",
"(",
"pre_dl",
")",
"self",
".",
"k",
".",
"tap_key",
"(",
"self",
".",
"k",
... | Pres delete key n times.
**中文文档**
按 delete 键n次。 | [
"Pres",
"delete",
"key",
"n",
"times",
"."
] | dae909d2d28acbfa2be623aa2dffe988f3882d4d | https://github.com/MacHu-GWU/macro-project/blob/dae909d2d28acbfa2be623aa2dffe988f3882d4d/macro/bot.py#L394-L403 | train |
MacHu-GWU/macro-project | macro/bot.py | Bot.insert | def insert(self, n=1, interval=0, pre_dl=None, post_dl=None):
"""Pres insert key n times.
**中文文档**
按 insert 键n次。
"""
self.delay(pre_dl)
self.k.tap_key(self.k.insert_key, n, interval)
self.delay(post_dl) | python | def insert(self, n=1, interval=0, pre_dl=None, post_dl=None):
"""Pres insert key n times.
**中文文档**
按 insert 键n次。
"""
self.delay(pre_dl)
self.k.tap_key(self.k.insert_key, n, interval)
self.delay(post_dl) | [
"def",
"insert",
"(",
"self",
",",
"n",
"=",
"1",
",",
"interval",
"=",
"0",
",",
"pre_dl",
"=",
"None",
",",
"post_dl",
"=",
"None",
")",
":",
"self",
".",
"delay",
"(",
"pre_dl",
")",
"self",
".",
"k",
".",
"tap_key",
"(",
"self",
".",
"k",
... | Pres insert key n times.
**中文文档**
按 insert 键n次。 | [
"Pres",
"insert",
"key",
"n",
"times",
"."
] | dae909d2d28acbfa2be623aa2dffe988f3882d4d | https://github.com/MacHu-GWU/macro-project/blob/dae909d2d28acbfa2be623aa2dffe988f3882d4d/macro/bot.py#L405-L414 | train |
MacHu-GWU/macro-project | macro/bot.py | Bot.home | def home(self, n=1, interval=0, pre_dl=None, post_dl=None):
"""Pres home key n times.
**中文文档**
按 home 键n次。
"""
self.delay(pre_dl)
self.k.tap_key(self.k.home_key, n, interval)
self.delay(post_dl) | python | def home(self, n=1, interval=0, pre_dl=None, post_dl=None):
"""Pres home key n times.
**中文文档**
按 home 键n次。
"""
self.delay(pre_dl)
self.k.tap_key(self.k.home_key, n, interval)
self.delay(post_dl) | [
"def",
"home",
"(",
"self",
",",
"n",
"=",
"1",
",",
"interval",
"=",
"0",
",",
"pre_dl",
"=",
"None",
",",
"post_dl",
"=",
"None",
")",
":",
"self",
".",
"delay",
"(",
"pre_dl",
")",
"self",
".",
"k",
".",
"tap_key",
"(",
"self",
".",
"k",
"... | Pres home key n times.
**中文文档**
按 home 键n次。 | [
"Pres",
"home",
"key",
"n",
"times",
"."
] | dae909d2d28acbfa2be623aa2dffe988f3882d4d | https://github.com/MacHu-GWU/macro-project/blob/dae909d2d28acbfa2be623aa2dffe988f3882d4d/macro/bot.py#L416-L425 | train |
MacHu-GWU/macro-project | macro/bot.py | Bot.end | def end(self, n=1, interval=0, pre_dl=None, post_dl=None):
"""Press end key n times.
**中文文档**
按 end 键n次。
"""
self.delay(pre_dl)
self.k.tap_key(self.k.end_key, n, interval)
self.delay(post_dl) | python | def end(self, n=1, interval=0, pre_dl=None, post_dl=None):
"""Press end key n times.
**中文文档**
按 end 键n次。
"""
self.delay(pre_dl)
self.k.tap_key(self.k.end_key, n, interval)
self.delay(post_dl) | [
"def",
"end",
"(",
"self",
",",
"n",
"=",
"1",
",",
"interval",
"=",
"0",
",",
"pre_dl",
"=",
"None",
",",
"post_dl",
"=",
"None",
")",
":",
"self",
".",
"delay",
"(",
"pre_dl",
")",
"self",
".",
"k",
".",
"tap_key",
"(",
"self",
".",
"k",
".... | Press end key n times.
**中文文档**
按 end 键n次。 | [
"Press",
"end",
"key",
"n",
"times",
"."
] | dae909d2d28acbfa2be623aa2dffe988f3882d4d | https://github.com/MacHu-GWU/macro-project/blob/dae909d2d28acbfa2be623aa2dffe988f3882d4d/macro/bot.py#L427-L436 | train |
MacHu-GWU/macro-project | macro/bot.py | Bot.page_up | def page_up(self, n=1, interval=0, pre_dl=None, post_dl=None):
"""Pres page_up key n times.
**中文文档**
按 page_up 键n次。
"""
self.delay(pre_dl)
self.k.tap_key(self.k.page_up_key, n, interval)
self.delay(post_dl) | python | def page_up(self, n=1, interval=0, pre_dl=None, post_dl=None):
"""Pres page_up key n times.
**中文文档**
按 page_up 键n次。
"""
self.delay(pre_dl)
self.k.tap_key(self.k.page_up_key, n, interval)
self.delay(post_dl) | [
"def",
"page_up",
"(",
"self",
",",
"n",
"=",
"1",
",",
"interval",
"=",
"0",
",",
"pre_dl",
"=",
"None",
",",
"post_dl",
"=",
"None",
")",
":",
"self",
".",
"delay",
"(",
"pre_dl",
")",
"self",
".",
"k",
".",
"tap_key",
"(",
"self",
".",
"k",
... | Pres page_up key n times.
**中文文档**
按 page_up 键n次。 | [
"Pres",
"page_up",
"key",
"n",
"times",
"."
] | dae909d2d28acbfa2be623aa2dffe988f3882d4d | https://github.com/MacHu-GWU/macro-project/blob/dae909d2d28acbfa2be623aa2dffe988f3882d4d/macro/bot.py#L438-L447 | train |
MacHu-GWU/macro-project | macro/bot.py | Bot.page_down | def page_down(self, n=1, interval=0, pre_dl=None, post_dl=None):
"""Pres page_down key n times.
**中文文档**
按 page_down 键n次。
"""
self.delay(pre_dl)
self.k.tap_key(self.k.page_down, n, interval)
self.delay(post_dl) | python | def page_down(self, n=1, interval=0, pre_dl=None, post_dl=None):
"""Pres page_down key n times.
**中文文档**
按 page_down 键n次。
"""
self.delay(pre_dl)
self.k.tap_key(self.k.page_down, n, interval)
self.delay(post_dl) | [
"def",
"page_down",
"(",
"self",
",",
"n",
"=",
"1",
",",
"interval",
"=",
"0",
",",
"pre_dl",
"=",
"None",
",",
"post_dl",
"=",
"None",
")",
":",
"self",
".",
"delay",
"(",
"pre_dl",
")",
"self",
".",
"k",
".",
"tap_key",
"(",
"self",
".",
"k"... | Pres page_down key n times.
**中文文档**
按 page_down 键n次。 | [
"Pres",
"page_down",
"key",
"n",
"times",
"."
] | dae909d2d28acbfa2be623aa2dffe988f3882d4d | https://github.com/MacHu-GWU/macro-project/blob/dae909d2d28acbfa2be623aa2dffe988f3882d4d/macro/bot.py#L449-L458 | train |
MacHu-GWU/macro-project | macro/bot.py | Bot.press_and_tap | def press_and_tap(self, press_key, tap_key, n=1, interval=0, pre_dl=None, post_dl=None):
"""Press combination of two keys, like Ctrl + C, Alt + F4. The second
key could be tapped for multiple time.
Examples::
bot.press_and_tap("ctrl", "c")
bot.press_and_tap("shift", "1"... | python | def press_and_tap(self, press_key, tap_key, n=1, interval=0, pre_dl=None, post_dl=None):
"""Press combination of two keys, like Ctrl + C, Alt + F4. The second
key could be tapped for multiple time.
Examples::
bot.press_and_tap("ctrl", "c")
bot.press_and_tap("shift", "1"... | [
"def",
"press_and_tap",
"(",
"self",
",",
"press_key",
",",
"tap_key",
",",
"n",
"=",
"1",
",",
"interval",
"=",
"0",
",",
"pre_dl",
"=",
"None",
",",
"post_dl",
"=",
"None",
")",
":",
"press_key",
"=",
"self",
".",
"_parse_key",
"(",
"press_key",
")... | Press combination of two keys, like Ctrl + C, Alt + F4. The second
key could be tapped for multiple time.
Examples::
bot.press_and_tap("ctrl", "c")
bot.press_and_tap("shift", "1")
**中文文档**
按下两个键的组合键。 | [
"Press",
"combination",
"of",
"two",
"keys",
"like",
"Ctrl",
"+",
"C",
"Alt",
"+",
"F4",
".",
"The",
"second",
"key",
"could",
"be",
"tapped",
"for",
"multiple",
"time",
"."
] | dae909d2d28acbfa2be623aa2dffe988f3882d4d | https://github.com/MacHu-GWU/macro-project/blob/dae909d2d28acbfa2be623aa2dffe988f3882d4d/macro/bot.py#L461-L481 | train |
MacHu-GWU/macro-project | macro/bot.py | Bot.press_two_and_tap | def press_two_and_tap(self,
press_key1, press_key2, tap_key, n=1, interval=0, pre_dl=None, post_dl=None):
"""Press combination of three keys, like Ctrl + Shift + C, The tap key
could be tapped for multiple time.
Examples::
bot.press_and_tap("ctrl", "shift"... | python | def press_two_and_tap(self,
press_key1, press_key2, tap_key, n=1, interval=0, pre_dl=None, post_dl=None):
"""Press combination of three keys, like Ctrl + Shift + C, The tap key
could be tapped for multiple time.
Examples::
bot.press_and_tap("ctrl", "shift"... | [
"def",
"press_two_and_tap",
"(",
"self",
",",
"press_key1",
",",
"press_key2",
",",
"tap_key",
",",
"n",
"=",
"1",
",",
"interval",
"=",
"0",
",",
"pre_dl",
"=",
"None",
",",
"post_dl",
"=",
"None",
")",
":",
"press_key1",
"=",
"self",
".",
"_parse_key... | Press combination of three keys, like Ctrl + Shift + C, The tap key
could be tapped for multiple time.
Examples::
bot.press_and_tap("ctrl", "shift", "c")
**中文文档**
按下三个键的组合键。 | [
"Press",
"combination",
"of",
"three",
"keys",
"like",
"Ctrl",
"+",
"Shift",
"+",
"C",
"The",
"tap",
"key",
"could",
"be",
"tapped",
"for",
"multiple",
"time",
"."
] | dae909d2d28acbfa2be623aa2dffe988f3882d4d | https://github.com/MacHu-GWU/macro-project/blob/dae909d2d28acbfa2be623aa2dffe988f3882d4d/macro/bot.py#L483-L506 | train |
MacHu-GWU/macro-project | macro/bot.py | Bot.ctrl_c | def ctrl_c(self, pre_dl=None, post_dl=None):
"""Press Ctrl + C, usually for copy.
**中文文档**
按下 Ctrl + C 组合键, 通常用于复制。
"""
self.delay(pre_dl)
self.k.press_key(self.k.control_key)
self.k.tap_key("c")
self.k.release_key(self.k.control_key)
self.delay(... | python | def ctrl_c(self, pre_dl=None, post_dl=None):
"""Press Ctrl + C, usually for copy.
**中文文档**
按下 Ctrl + C 组合键, 通常用于复制。
"""
self.delay(pre_dl)
self.k.press_key(self.k.control_key)
self.k.tap_key("c")
self.k.release_key(self.k.control_key)
self.delay(... | [
"def",
"ctrl_c",
"(",
"self",
",",
"pre_dl",
"=",
"None",
",",
"post_dl",
"=",
"None",
")",
":",
"self",
".",
"delay",
"(",
"pre_dl",
")",
"self",
".",
"k",
".",
"press_key",
"(",
"self",
".",
"k",
".",
"control_key",
")",
"self",
".",
"k",
".",
... | Press Ctrl + C, usually for copy.
**中文文档**
按下 Ctrl + C 组合键, 通常用于复制。 | [
"Press",
"Ctrl",
"+",
"C",
"usually",
"for",
"copy",
"."
] | dae909d2d28acbfa2be623aa2dffe988f3882d4d | https://github.com/MacHu-GWU/macro-project/blob/dae909d2d28acbfa2be623aa2dffe988f3882d4d/macro/bot.py#L508-L519 | train |
MacHu-GWU/macro-project | macro/bot.py | Bot.ctrl_fn | def ctrl_fn(self, i, pre_dl=None, post_dl=None):
"""Press Ctrl + Fn1 ~ 12 once.
**中文文档**
按下 Ctrl + Fn1 ~ 12 组合键。
"""
self.delay(pre_dl)
self.k.press_key(self.k.control_key)
self.k.tap_key(self.k.function_keys[i])
self.k.release_key(self.k.control_key)
... | python | def ctrl_fn(self, i, pre_dl=None, post_dl=None):
"""Press Ctrl + Fn1 ~ 12 once.
**中文文档**
按下 Ctrl + Fn1 ~ 12 组合键。
"""
self.delay(pre_dl)
self.k.press_key(self.k.control_key)
self.k.tap_key(self.k.function_keys[i])
self.k.release_key(self.k.control_key)
... | [
"def",
"ctrl_fn",
"(",
"self",
",",
"i",
",",
"pre_dl",
"=",
"None",
",",
"post_dl",
"=",
"None",
")",
":",
"self",
".",
"delay",
"(",
"pre_dl",
")",
"self",
".",
"k",
".",
"press_key",
"(",
"self",
".",
"k",
".",
"control_key",
")",
"self",
".",... | Press Ctrl + Fn1 ~ 12 once.
**中文文档**
按下 Ctrl + Fn1 ~ 12 组合键。 | [
"Press",
"Ctrl",
"+",
"Fn1",
"~",
"12",
"once",
"."
] | dae909d2d28acbfa2be623aa2dffe988f3882d4d | https://github.com/MacHu-GWU/macro-project/blob/dae909d2d28acbfa2be623aa2dffe988f3882d4d/macro/bot.py#L599-L610 | train |
MacHu-GWU/macro-project | macro/bot.py | Bot.alt_fn | def alt_fn(self, i, pre_dl=None, post_dl=None):
"""Press Alt + Fn1 ~ 12 once.
**中文文档**
按下 Alt + Fn1 ~ 12 组合键。
"""
self.delay(pre_dl)
self.k.press_key(self.k.alt_key)
self.k.tap_key(self.k.function_keys[i])
self.k.release_key(self.k.alt_key)
self.... | python | def alt_fn(self, i, pre_dl=None, post_dl=None):
"""Press Alt + Fn1 ~ 12 once.
**中文文档**
按下 Alt + Fn1 ~ 12 组合键。
"""
self.delay(pre_dl)
self.k.press_key(self.k.alt_key)
self.k.tap_key(self.k.function_keys[i])
self.k.release_key(self.k.alt_key)
self.... | [
"def",
"alt_fn",
"(",
"self",
",",
"i",
",",
"pre_dl",
"=",
"None",
",",
"post_dl",
"=",
"None",
")",
":",
"self",
".",
"delay",
"(",
"pre_dl",
")",
"self",
".",
"k",
".",
"press_key",
"(",
"self",
".",
"k",
".",
"alt_key",
")",
"self",
".",
"k... | Press Alt + Fn1 ~ 12 once.
**中文文档**
按下 Alt + Fn1 ~ 12 组合键。 | [
"Press",
"Alt",
"+",
"Fn1",
"~",
"12",
"once",
"."
] | dae909d2d28acbfa2be623aa2dffe988f3882d4d | https://github.com/MacHu-GWU/macro-project/blob/dae909d2d28acbfa2be623aa2dffe988f3882d4d/macro/bot.py#L612-L623 | train |
MacHu-GWU/macro-project | macro/bot.py | Bot.shift_fn | def shift_fn(self, i, pre_dl=None, post_dl=None):
"""Press Shift + Fn1 ~ 12 once.
**中文文档**
按下 Shift + Fn1 ~ 12 组合键。
"""
self.delay(pre_dl)
self.k.press_key(self.k.shift_key)
self.k.tap_key(self.k.function_keys[i])
self.k.release_key(self.k.shift_key)
... | python | def shift_fn(self, i, pre_dl=None, post_dl=None):
"""Press Shift + Fn1 ~ 12 once.
**中文文档**
按下 Shift + Fn1 ~ 12 组合键。
"""
self.delay(pre_dl)
self.k.press_key(self.k.shift_key)
self.k.tap_key(self.k.function_keys[i])
self.k.release_key(self.k.shift_key)
... | [
"def",
"shift_fn",
"(",
"self",
",",
"i",
",",
"pre_dl",
"=",
"None",
",",
"post_dl",
"=",
"None",
")",
":",
"self",
".",
"delay",
"(",
"pre_dl",
")",
"self",
".",
"k",
".",
"press_key",
"(",
"self",
".",
"k",
".",
"shift_key",
")",
"self",
".",
... | Press Shift + Fn1 ~ 12 once.
**中文文档**
按下 Shift + Fn1 ~ 12 组合键。 | [
"Press",
"Shift",
"+",
"Fn1",
"~",
"12",
"once",
"."
] | dae909d2d28acbfa2be623aa2dffe988f3882d4d | https://github.com/MacHu-GWU/macro-project/blob/dae909d2d28acbfa2be623aa2dffe988f3882d4d/macro/bot.py#L625-L636 | train |
MacHu-GWU/macro-project | macro/bot.py | Bot.alt_tab | def alt_tab(self, n=1, pre_dl=None, post_dl=None):
"""Press Alt + Tab once, usually for switching between windows.
Tab can be tapped for n times, default once.
**中文文档**
按下 Alt + Tab 组合键, 其中Tab键按 n 次, 通常用于切换窗口。
"""
self.delay(pre_dl)
self.k.press_key(self.k.alt_k... | python | def alt_tab(self, n=1, pre_dl=None, post_dl=None):
"""Press Alt + Tab once, usually for switching between windows.
Tab can be tapped for n times, default once.
**中文文档**
按下 Alt + Tab 组合键, 其中Tab键按 n 次, 通常用于切换窗口。
"""
self.delay(pre_dl)
self.k.press_key(self.k.alt_k... | [
"def",
"alt_tab",
"(",
"self",
",",
"n",
"=",
"1",
",",
"pre_dl",
"=",
"None",
",",
"post_dl",
"=",
"None",
")",
":",
"self",
".",
"delay",
"(",
"pre_dl",
")",
"self",
".",
"k",
".",
"press_key",
"(",
"self",
".",
"k",
".",
"alt_key",
")",
"sel... | Press Alt + Tab once, usually for switching between windows.
Tab can be tapped for n times, default once.
**中文文档**
按下 Alt + Tab 组合键, 其中Tab键按 n 次, 通常用于切换窗口。 | [
"Press",
"Alt",
"+",
"Tab",
"once",
"usually",
"for",
"switching",
"between",
"windows",
".",
"Tab",
"can",
"be",
"tapped",
"for",
"n",
"times",
"default",
"once",
"."
] | dae909d2d28acbfa2be623aa2dffe988f3882d4d | https://github.com/MacHu-GWU/macro-project/blob/dae909d2d28acbfa2be623aa2dffe988f3882d4d/macro/bot.py#L638-L650 | train |
MacHu-GWU/macro-project | macro/bot.py | Bot.type_string | def type_string(self, text, interval=0, pre_dl=None, post_dl=None):
"""Enter strings.
**中文文档**
从键盘输入字符串, interval是字符间输入时间间隔, 单位是秒。
"""
self.delay(pre_dl)
self.k.type_string(text, interval)
self.delay(post_dl) | python | def type_string(self, text, interval=0, pre_dl=None, post_dl=None):
"""Enter strings.
**中文文档**
从键盘输入字符串, interval是字符间输入时间间隔, 单位是秒。
"""
self.delay(pre_dl)
self.k.type_string(text, interval)
self.delay(post_dl) | [
"def",
"type_string",
"(",
"self",
",",
"text",
",",
"interval",
"=",
"0",
",",
"pre_dl",
"=",
"None",
",",
"post_dl",
"=",
"None",
")",
":",
"self",
".",
"delay",
"(",
"pre_dl",
")",
"self",
".",
"k",
".",
"type_string",
"(",
"text",
",",
"interva... | Enter strings.
**中文文档**
从键盘输入字符串, interval是字符间输入时间间隔, 单位是秒。 | [
"Enter",
"strings",
"."
] | dae909d2d28acbfa2be623aa2dffe988f3882d4d | https://github.com/MacHu-GWU/macro-project/blob/dae909d2d28acbfa2be623aa2dffe988f3882d4d/macro/bot.py#L653-L662 | train |
CenturyLinkCloud/clc-python-sdk | src/clc/APIv2/server.py | Servers.Servers | def Servers(self,cached=True):
"""Returns list of server objects, populates if necessary.
>>> clc.v2.Servers(["NY1BTDIPHYP0101","NY1BTDIWEB0101"]).Servers()
[<clc.APIv2.server.Server object at 0x1065b0d50>, <clc.APIv2.server.Server object at 0x1065b0e50>]
>>> print _[0]
NY1BTDIPHYP0101
"""
if not hasat... | python | def Servers(self,cached=True):
"""Returns list of server objects, populates if necessary.
>>> clc.v2.Servers(["NY1BTDIPHYP0101","NY1BTDIWEB0101"]).Servers()
[<clc.APIv2.server.Server object at 0x1065b0d50>, <clc.APIv2.server.Server object at 0x1065b0e50>]
>>> print _[0]
NY1BTDIPHYP0101
"""
if not hasat... | [
"def",
"Servers",
"(",
"self",
",",
"cached",
"=",
"True",
")",
":",
"if",
"not",
"hasattr",
"(",
"self",
",",
"'_servers'",
")",
"or",
"not",
"cached",
":",
"self",
".",
"_servers",
"=",
"[",
"]",
"for",
"server",
"in",
"self",
".",
"servers_lst",
... | Returns list of server objects, populates if necessary.
>>> clc.v2.Servers(["NY1BTDIPHYP0101","NY1BTDIWEB0101"]).Servers()
[<clc.APIv2.server.Server object at 0x1065b0d50>, <clc.APIv2.server.Server object at 0x1065b0e50>]
>>> print _[0]
NY1BTDIPHYP0101 | [
"Returns",
"list",
"of",
"server",
"objects",
"populates",
"if",
"necessary",
"."
] | f4dba40c627cb08dd4b7d0d277e8d67578010b05 | https://github.com/CenturyLinkCloud/clc-python-sdk/blob/f4dba40c627cb08dd4b7d0d277e8d67578010b05/src/clc/APIv2/server.py#L90-L105 | train |
CenturyLinkCloud/clc-python-sdk | src/clc/APIv2/server.py | Server.Account | def Account(self):
"""Return account object for account containing this server.
>>> clc.v2.Server("CA3BTDICNTRLM01").Account()
<clc.APIv2.account.Account instance at 0x108789878>
>>> print _
BTDI
"""
return(clc.v2.Account(alias=self.alias,session=self.session)) | python | def Account(self):
"""Return account object for account containing this server.
>>> clc.v2.Server("CA3BTDICNTRLM01").Account()
<clc.APIv2.account.Account instance at 0x108789878>
>>> print _
BTDI
"""
return(clc.v2.Account(alias=self.alias,session=self.session)) | [
"def",
"Account",
"(",
"self",
")",
":",
"return",
"(",
"clc",
".",
"v2",
".",
"Account",
"(",
"alias",
"=",
"self",
".",
"alias",
",",
"session",
"=",
"self",
".",
"session",
")",
")"
] | Return account object for account containing this server.
>>> clc.v2.Server("CA3BTDICNTRLM01").Account()
<clc.APIv2.account.Account instance at 0x108789878>
>>> print _
BTDI | [
"Return",
"account",
"object",
"for",
"account",
"containing",
"this",
"server",
"."
] | f4dba40c627cb08dd4b7d0d277e8d67578010b05 | https://github.com/CenturyLinkCloud/clc-python-sdk/blob/f4dba40c627cb08dd4b7d0d277e8d67578010b05/src/clc/APIv2/server.py#L232-L242 | train |
CenturyLinkCloud/clc-python-sdk | src/clc/APIv2/server.py | Server.Group | def Group(self):
"""Return group object for group containing this server.
>>> clc.v2.Server("CA3BTDICNTRLM01").Group()
<clc.APIv2.group.Group object at 0x10b07b7d0>
>>> print _
Ansible Managed Servers
"""
return(clc.v2.Group(id=self.groupId,alias=self.alias,session=self.session)) | python | def Group(self):
"""Return group object for group containing this server.
>>> clc.v2.Server("CA3BTDICNTRLM01").Group()
<clc.APIv2.group.Group object at 0x10b07b7d0>
>>> print _
Ansible Managed Servers
"""
return(clc.v2.Group(id=self.groupId,alias=self.alias,session=self.session)) | [
"def",
"Group",
"(",
"self",
")",
":",
"return",
"(",
"clc",
".",
"v2",
".",
"Group",
"(",
"id",
"=",
"self",
".",
"groupId",
",",
"alias",
"=",
"self",
".",
"alias",
",",
"session",
"=",
"self",
".",
"session",
")",
")"
] | Return group object for group containing this server.
>>> clc.v2.Server("CA3BTDICNTRLM01").Group()
<clc.APIv2.group.Group object at 0x10b07b7d0>
>>> print _
Ansible Managed Servers | [
"Return",
"group",
"object",
"for",
"group",
"containing",
"this",
"server",
"."
] | f4dba40c627cb08dd4b7d0d277e8d67578010b05 | https://github.com/CenturyLinkCloud/clc-python-sdk/blob/f4dba40c627cb08dd4b7d0d277e8d67578010b05/src/clc/APIv2/server.py#L245-L255 | train |
CenturyLinkCloud/clc-python-sdk | src/clc/APIv2/server.py | Server.Disks | def Disks(self):
"""Return disks object associated with server.
>>> clc.v2.Server("WA1BTDIX01").Disks()
<clc.APIv2.disk.Disks object at 0x10feea190>
"""
if not self.disks: self.disks = clc.v2.Disks(server=self,disks_lst=self.data['details']['disks'],session=self.session)
return(self.disks) | python | def Disks(self):
"""Return disks object associated with server.
>>> clc.v2.Server("WA1BTDIX01").Disks()
<clc.APIv2.disk.Disks object at 0x10feea190>
"""
if not self.disks: self.disks = clc.v2.Disks(server=self,disks_lst=self.data['details']['disks'],session=self.session)
return(self.disks) | [
"def",
"Disks",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"disks",
":",
"self",
".",
"disks",
"=",
"clc",
".",
"v2",
".",
"Disks",
"(",
"server",
"=",
"self",
",",
"disks_lst",
"=",
"self",
".",
"data",
"[",
"'details'",
"]",
"[",
"'disks'... | Return disks object associated with server.
>>> clc.v2.Server("WA1BTDIX01").Disks()
<clc.APIv2.disk.Disks object at 0x10feea190> | [
"Return",
"disks",
"object",
"associated",
"with",
"server",
"."
] | f4dba40c627cb08dd4b7d0d277e8d67578010b05 | https://github.com/CenturyLinkCloud/clc-python-sdk/blob/f4dba40c627cb08dd4b7d0d277e8d67578010b05/src/clc/APIv2/server.py#L258-L268 | train |
CenturyLinkCloud/clc-python-sdk | src/clc/APIv2/server.py | Server.PublicIPs | def PublicIPs(self):
"""Returns PublicIPs object associated with the server.
"""
if not self.public_ips: self.public_ips = clc.v2.PublicIPs(server=self,public_ips_lst=self.ip_addresses,session=self.session)
return(self.public_ips) | python | def PublicIPs(self):
"""Returns PublicIPs object associated with the server.
"""
if not self.public_ips: self.public_ips = clc.v2.PublicIPs(server=self,public_ips_lst=self.ip_addresses,session=self.session)
return(self.public_ips) | [
"def",
"PublicIPs",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"public_ips",
":",
"self",
".",
"public_ips",
"=",
"clc",
".",
"v2",
".",
"PublicIPs",
"(",
"server",
"=",
"self",
",",
"public_ips_lst",
"=",
"self",
".",
"ip_addresses",
",",
"sessi... | Returns PublicIPs object associated with the server. | [
"Returns",
"PublicIPs",
"object",
"associated",
"with",
"the",
"server",
"."
] | f4dba40c627cb08dd4b7d0d277e8d67578010b05 | https://github.com/CenturyLinkCloud/clc-python-sdk/blob/f4dba40c627cb08dd4b7d0d277e8d67578010b05/src/clc/APIv2/server.py#L271-L277 | train |
CenturyLinkCloud/clc-python-sdk | src/clc/APIv2/server.py | Server.PriceUnits | def PriceUnits(self):
"""Returns the hourly unit component prices for this server.
Total actual price is scaled by the unit quantity.
>>> clc.v2.Server("NY1BTDIPHYP0101").PriceUnits()
{'storage': 0.00021, 'cpu': 0.01, 'managed_os': 0.0, 'memory': 0.015}
"""
try:
units = clc.v2.API.Call('GET','billing... | python | def PriceUnits(self):
"""Returns the hourly unit component prices for this server.
Total actual price is scaled by the unit quantity.
>>> clc.v2.Server("NY1BTDIPHYP0101").PriceUnits()
{'storage': 0.00021, 'cpu': 0.01, 'managed_os': 0.0, 'memory': 0.015}
"""
try:
units = clc.v2.API.Call('GET','billing... | [
"def",
"PriceUnits",
"(",
"self",
")",
":",
"try",
":",
"units",
"=",
"clc",
".",
"v2",
".",
"API",
".",
"Call",
"(",
"'GET'",
",",
"'billing/%s/serverPricing/%s'",
"%",
"(",
"self",
".",
"alias",
",",
"self",
".",
"name",
")",
",",
"session",
"=",
... | Returns the hourly unit component prices for this server.
Total actual price is scaled by the unit quantity.
>>> clc.v2.Server("NY1BTDIPHYP0101").PriceUnits()
{'storage': 0.00021, 'cpu': 0.01, 'managed_os': 0.0, 'memory': 0.015} | [
"Returns",
"the",
"hourly",
"unit",
"component",
"prices",
"for",
"this",
"server",
"."
] | f4dba40c627cb08dd4b7d0d277e8d67578010b05 | https://github.com/CenturyLinkCloud/clc-python-sdk/blob/f4dba40c627cb08dd4b7d0d277e8d67578010b05/src/clc/APIv2/server.py#L290-L311 | train |
CenturyLinkCloud/clc-python-sdk | src/clc/APIv2/server.py | Server.PriceHourly | def PriceHourly(self):
"""Returns the total hourly price for the server.
Sums unit prices with unit volumes.
>>> clc.v2.Server("NY1BTDIPHYP0101").PriceHourly()
0.02857
"""
units = self.PriceUnits()
return(units['cpu']*self.cpu+units['memory']*self.memory+units['storage']*self.storage+units['managed_o... | python | def PriceHourly(self):
"""Returns the total hourly price for the server.
Sums unit prices with unit volumes.
>>> clc.v2.Server("NY1BTDIPHYP0101").PriceHourly()
0.02857
"""
units = self.PriceUnits()
return(units['cpu']*self.cpu+units['memory']*self.memory+units['storage']*self.storage+units['managed_o... | [
"def",
"PriceHourly",
"(",
"self",
")",
":",
"units",
"=",
"self",
".",
"PriceUnits",
"(",
")",
"return",
"(",
"units",
"[",
"'cpu'",
"]",
"*",
"self",
".",
"cpu",
"+",
"units",
"[",
"'memory'",
"]",
"*",
"self",
".",
"memory",
"+",
"units",
"[",
... | Returns the total hourly price for the server.
Sums unit prices with unit volumes.
>>> clc.v2.Server("NY1BTDIPHYP0101").PriceHourly()
0.02857 | [
"Returns",
"the",
"total",
"hourly",
"price",
"for",
"the",
"server",
"."
] | f4dba40c627cb08dd4b7d0d277e8d67578010b05 | https://github.com/CenturyLinkCloud/clc-python-sdk/blob/f4dba40c627cb08dd4b7d0d277e8d67578010b05/src/clc/APIv2/server.py#L314-L326 | train |
CenturyLinkCloud/clc-python-sdk | src/clc/APIv2/server.py | Server.Credentials | def Credentials(self):
"""Returns the administrative credentials for this server.
>>> clc.v2.Server("NY1BTDIPHYP0101").Credentials()
{u'userName': u'administrator', u'password': u'dszkjh498s^'}
"""
return(clc.v2.API.Call('GET','servers/%s/%s/credentials' % (self.alias,self.name),session=self.session)) | python | def Credentials(self):
"""Returns the administrative credentials for this server.
>>> clc.v2.Server("NY1BTDIPHYP0101").Credentials()
{u'userName': u'administrator', u'password': u'dszkjh498s^'}
"""
return(clc.v2.API.Call('GET','servers/%s/%s/credentials' % (self.alias,self.name),session=self.session)) | [
"def",
"Credentials",
"(",
"self",
")",
":",
"return",
"(",
"clc",
".",
"v2",
".",
"API",
".",
"Call",
"(",
"'GET'",
",",
"'servers/%s/%s/credentials'",
"%",
"(",
"self",
".",
"alias",
",",
"self",
".",
"name",
")",
",",
"session",
"=",
"self",
".",
... | Returns the administrative credentials for this server.
>>> clc.v2.Server("NY1BTDIPHYP0101").Credentials()
{u'userName': u'administrator', u'password': u'dszkjh498s^'} | [
"Returns",
"the",
"administrative",
"credentials",
"for",
"this",
"server",
"."
] | f4dba40c627cb08dd4b7d0d277e8d67578010b05 | https://github.com/CenturyLinkCloud/clc-python-sdk/blob/f4dba40c627cb08dd4b7d0d277e8d67578010b05/src/clc/APIv2/server.py#L329-L337 | train |
CenturyLinkCloud/clc-python-sdk | src/clc/APIv2/server.py | Server.ExecutePackage | def ExecutePackage(self,package_id,parameters={}):
"""Execute an existing Bluerprint package on the server.
https://t3n.zendesk.com/entries/59727040-Execute-Package
Requires package ID, currently only available by browsing control and browsing
for the package itself. The UUID parameter is the package ID we n... | python | def ExecutePackage(self,package_id,parameters={}):
"""Execute an existing Bluerprint package on the server.
https://t3n.zendesk.com/entries/59727040-Execute-Package
Requires package ID, currently only available by browsing control and browsing
for the package itself. The UUID parameter is the package ID we n... | [
"def",
"ExecutePackage",
"(",
"self",
",",
"package_id",
",",
"parameters",
"=",
"{",
"}",
")",
":",
"return",
"(",
"clc",
".",
"v2",
".",
"Requests",
"(",
"clc",
".",
"v2",
".",
"API",
".",
"Call",
"(",
"'POST'",
",",
"'operations/%s/servers/executePack... | Execute an existing Bluerprint package on the server.
https://t3n.zendesk.com/entries/59727040-Execute-Package
Requires package ID, currently only available by browsing control and browsing
for the package itself. The UUID parameter is the package ID we need.
>>> clc.v2.Server(alias='BTDI',id='WA1BTDIKRT06'... | [
"Execute",
"an",
"existing",
"Bluerprint",
"package",
"on",
"the",
"server",
"."
] | f4dba40c627cb08dd4b7d0d277e8d67578010b05 | https://github.com/CenturyLinkCloud/clc-python-sdk/blob/f4dba40c627cb08dd4b7d0d277e8d67578010b05/src/clc/APIv2/server.py#L387-L406 | train |
CenturyLinkCloud/clc-python-sdk | src/clc/APIv2/server.py | Server.AddNIC | def AddNIC(self,network_id,ip=''):
"""Add a NIC from the provided network to server and, if provided,
assign a provided IP address
https://www.ctl.io/api-docs/v2/#servers-add-secondary-network
Requires package ID, currently only available by browsing control and browsing
for the package itself. The UUID... | python | def AddNIC(self,network_id,ip=''):
"""Add a NIC from the provided network to server and, if provided,
assign a provided IP address
https://www.ctl.io/api-docs/v2/#servers-add-secondary-network
Requires package ID, currently only available by browsing control and browsing
for the package itself. The UUID... | [
"def",
"AddNIC",
"(",
"self",
",",
"network_id",
",",
"ip",
"=",
"''",
")",
":",
"return",
"(",
"clc",
".",
"v2",
".",
"Requests",
"(",
"clc",
".",
"v2",
".",
"API",
".",
"Call",
"(",
"'POST'",
",",
"'servers/%s/%s/networks'",
"%",
"(",
"self",
"."... | Add a NIC from the provided network to server and, if provided,
assign a provided IP address
https://www.ctl.io/api-docs/v2/#servers-add-secondary-network
Requires package ID, currently only available by browsing control and browsing
for the package itself. The UUID parameter is the package ID we need.
... | [
"Add",
"a",
"NIC",
"from",
"the",
"provided",
"network",
"to",
"server",
"and",
"if",
"provided",
"assign",
"a",
"provided",
"IP",
"address"
] | f4dba40c627cb08dd4b7d0d277e8d67578010b05 | https://github.com/CenturyLinkCloud/clc-python-sdk/blob/f4dba40c627cb08dd4b7d0d277e8d67578010b05/src/clc/APIv2/server.py#L409-L435 | train |
CenturyLinkCloud/clc-python-sdk | src/clc/APIv2/server.py | Server.RemoveNIC | def RemoveNIC(self,network_id):
"""Remove the NIC associated with the provided network from the server.
https://www.ctl.io/api-docs/v2/#servers-remove-secondary-network
network_id - ID associated with the network to remove
>>> network = clc.v2.Networks(location="VA1").Get("10.128.166.0/24")
>>>... | python | def RemoveNIC(self,network_id):
"""Remove the NIC associated with the provided network from the server.
https://www.ctl.io/api-docs/v2/#servers-remove-secondary-network
network_id - ID associated with the network to remove
>>> network = clc.v2.Networks(location="VA1").Get("10.128.166.0/24")
>>>... | [
"def",
"RemoveNIC",
"(",
"self",
",",
"network_id",
")",
":",
"return",
"(",
"clc",
".",
"v2",
".",
"Requests",
"(",
"clc",
".",
"v2",
".",
"API",
".",
"Call",
"(",
"'DELETE'",
",",
"'servers/%s/%s/networks/%s'",
"%",
"(",
"self",
".",
"alias",
",",
... | Remove the NIC associated with the provided network from the server.
https://www.ctl.io/api-docs/v2/#servers-remove-secondary-network
network_id - ID associated with the network to remove
>>> network = clc.v2.Networks(location="VA1").Get("10.128.166.0/24")
>>> clc.v2.Server(alias='BTDI',id='WA1BT... | [
"Remove",
"the",
"NIC",
"associated",
"with",
"the",
"provided",
"network",
"from",
"the",
"server",
"."
] | f4dba40c627cb08dd4b7d0d277e8d67578010b05 | https://github.com/CenturyLinkCloud/clc-python-sdk/blob/f4dba40c627cb08dd4b7d0d277e8d67578010b05/src/clc/APIv2/server.py#L437-L459 | train |
CenturyLinkCloud/clc-python-sdk | src/clc/APIv2/server.py | Server.DeleteSnapshot | def DeleteSnapshot(self,names=None):
"""Removes an existing Hypervisor level snapshot.
Supply one or more snapshot names to delete them concurrently.
If no snapshot names are supplied will delete all existing snapshots.
>>> clc.v2.Server(alias='BTDI',id='WA1BTDIKRT02').DeleteSnapshot().WaitUntilComplete()
0... | python | def DeleteSnapshot(self,names=None):
"""Removes an existing Hypervisor level snapshot.
Supply one or more snapshot names to delete them concurrently.
If no snapshot names are supplied will delete all existing snapshots.
>>> clc.v2.Server(alias='BTDI',id='WA1BTDIKRT02').DeleteSnapshot().WaitUntilComplete()
0... | [
"def",
"DeleteSnapshot",
"(",
"self",
",",
"names",
"=",
"None",
")",
":",
"if",
"names",
"is",
"None",
":",
"names",
"=",
"self",
".",
"GetSnapshots",
"(",
")",
"requests_lst",
"=",
"[",
"]",
"for",
"name",
"in",
"names",
":",
"name_links",
"=",
"["... | Removes an existing Hypervisor level snapshot.
Supply one or more snapshot names to delete them concurrently.
If no snapshot names are supplied will delete all existing snapshots.
>>> clc.v2.Server(alias='BTDI',id='WA1BTDIKRT02').DeleteSnapshot().WaitUntilComplete()
0 | [
"Removes",
"an",
"existing",
"Hypervisor",
"level",
"snapshot",
"."
] | f4dba40c627cb08dd4b7d0d277e8d67578010b05 | https://github.com/CenturyLinkCloud/clc-python-sdk/blob/f4dba40c627cb08dd4b7d0d277e8d67578010b05/src/clc/APIv2/server.py#L495-L519 | train |
CenturyLinkCloud/clc-python-sdk | src/clc/APIv2/server.py | Server.RestoreSnapshot | def RestoreSnapshot(self,name=None):
"""Restores an existing Hypervisor level snapshot.
Supply snapshot name to restore
If no snapshot name is supplied will restore the first snapshot found
>>> clc.v2.Server(alias='BTDI',id='WA1BTDIKRT02').RestoreSnapshot().WaitUntilComplete()
0
"""
if not len(self.da... | python | def RestoreSnapshot(self,name=None):
"""Restores an existing Hypervisor level snapshot.
Supply snapshot name to restore
If no snapshot name is supplied will restore the first snapshot found
>>> clc.v2.Server(alias='BTDI',id='WA1BTDIKRT02').RestoreSnapshot().WaitUntilComplete()
0
"""
if not len(self.da... | [
"def",
"RestoreSnapshot",
"(",
"self",
",",
"name",
"=",
"None",
")",
":",
"if",
"not",
"len",
"(",
"self",
".",
"data",
"[",
"'details'",
"]",
"[",
"'snapshots'",
"]",
")",
":",
"raise",
"(",
"clc",
".",
"CLCException",
"(",
"\"No snapshots exist\"",
... | Restores an existing Hypervisor level snapshot.
Supply snapshot name to restore
If no snapshot name is supplied will restore the first snapshot found
>>> clc.v2.Server(alias='BTDI',id='WA1BTDIKRT02').RestoreSnapshot().WaitUntilComplete()
0 | [
"Restores",
"an",
"existing",
"Hypervisor",
"level",
"snapshot",
"."
] | f4dba40c627cb08dd4b7d0d277e8d67578010b05 | https://github.com/CenturyLinkCloud/clc-python-sdk/blob/f4dba40c627cb08dd4b7d0d277e8d67578010b05/src/clc/APIv2/server.py#L522-L541 | train |
CenturyLinkCloud/clc-python-sdk | src/clc/APIv2/server.py | Server.Create | def Create(name,template,group_id,network_id,cpu=None,memory=None,alias=None,password=None,ip_address=None,
storage_type="standard",type="standard",primary_dns=None,secondary_dns=None,
additional_disks=[],custom_fields=[],ttl=None,managed_os=False,description=None,
source_server_password=None,cp... | python | def Create(name,template,group_id,network_id,cpu=None,memory=None,alias=None,password=None,ip_address=None,
storage_type="standard",type="standard",primary_dns=None,secondary_dns=None,
additional_disks=[],custom_fields=[],ttl=None,managed_os=False,description=None,
source_server_password=None,cp... | [
"def",
"Create",
"(",
"name",
",",
"template",
",",
"group_id",
",",
"network_id",
",",
"cpu",
"=",
"None",
",",
"memory",
"=",
"None",
",",
"alias",
"=",
"None",
",",
"password",
"=",
"None",
",",
"ip_address",
"=",
"None",
",",
"storage_type",
"=",
... | Creates a new server.
https://www.centurylinkcloud.com/api-docs/v2/#servers-create-server
cpu and memory are optional and if not provided we pull from the default server size values associated with
the provided group_id.
Set ttl as number of seconds before server is to be terminated. Must be >3600
>>> d ... | [
"Creates",
"a",
"new",
"server",
"."
] | f4dba40c627cb08dd4b7d0d277e8d67578010b05 | https://github.com/CenturyLinkCloud/clc-python-sdk/blob/f4dba40c627cb08dd4b7d0d277e8d67578010b05/src/clc/APIv2/server.py#L545-L617 | train |
CenturyLinkCloud/clc-python-sdk | src/clc/APIv2/server.py | Server.Clone | def Clone(self,network_id,name=None,cpu=None,memory=None,group_id=None,alias=None,password=None,ip_address=None,
storage_type=None,type=None,primary_dns=None,secondary_dns=None,
custom_fields=None,ttl=None,managed_os=False,description=None,
source_server_password=None,cpu_autoscale_policy_id=None,a... | python | def Clone(self,network_id,name=None,cpu=None,memory=None,group_id=None,alias=None,password=None,ip_address=None,
storage_type=None,type=None,primary_dns=None,secondary_dns=None,
custom_fields=None,ttl=None,managed_os=False,description=None,
source_server_password=None,cpu_autoscale_policy_id=None,a... | [
"def",
"Clone",
"(",
"self",
",",
"network_id",
",",
"name",
"=",
"None",
",",
"cpu",
"=",
"None",
",",
"memory",
"=",
"None",
",",
"group_id",
"=",
"None",
",",
"alias",
"=",
"None",
",",
"password",
"=",
"None",
",",
"ip_address",
"=",
"None",
",... | Creates one or more clones of existing server.
https://www.centurylinkcloud.com/api-docs/v2/#servers-create-server
Set ttl as number of seconds before server is to be terminated.
* - network_id is currently a required parameter. This will change to optional once APIs are available to
return the network ... | [
"Creates",
"one",
"or",
"more",
"clones",
"of",
"existing",
"server",
"."
] | f4dba40c627cb08dd4b7d0d277e8d67578010b05 | https://github.com/CenturyLinkCloud/clc-python-sdk/blob/f4dba40c627cb08dd4b7d0d277e8d67578010b05/src/clc/APIv2/server.py#L620-L674 | train |
CenturyLinkCloud/clc-python-sdk | src/clc/APIv2/server.py | Server.ConvertToTemplate | def ConvertToTemplate(self,visibility,description=None,password=None):
"""Converts existing server to a template.
visibility is one of private or shared.
>>> d = clc.v2.Datacenter()
>>> clc.v2.Server(alias='BTDI',id='WA1BTDIAPI207').ConvertToTemplate("private","my template")
0
"""
if visibility not in... | python | def ConvertToTemplate(self,visibility,description=None,password=None):
"""Converts existing server to a template.
visibility is one of private or shared.
>>> d = clc.v2.Datacenter()
>>> clc.v2.Server(alias='BTDI',id='WA1BTDIAPI207').ConvertToTemplate("private","my template")
0
"""
if visibility not in... | [
"def",
"ConvertToTemplate",
"(",
"self",
",",
"visibility",
",",
"description",
"=",
"None",
",",
"password",
"=",
"None",
")",
":",
"if",
"visibility",
"not",
"in",
"(",
"'private'",
",",
"'shared'",
")",
":",
"raise",
"(",
"clc",
".",
"CLCException",
"... | Converts existing server to a template.
visibility is one of private or shared.
>>> d = clc.v2.Datacenter()
>>> clc.v2.Server(alias='BTDI',id='WA1BTDIAPI207').ConvertToTemplate("private","my template")
0 | [
"Converts",
"existing",
"server",
"to",
"a",
"template",
"."
] | f4dba40c627cb08dd4b7d0d277e8d67578010b05 | https://github.com/CenturyLinkCloud/clc-python-sdk/blob/f4dba40c627cb08dd4b7d0d277e8d67578010b05/src/clc/APIv2/server.py#L678-L697 | train |
CenturyLinkCloud/clc-python-sdk | src/clc/APIv2/server.py | Server.Change | def Change(self,cpu=None,memory=None,description=None,group_id=None):
"""Change existing server object.
One more more fields can be set and method will return with a requests
object for all queued activities. This is a convenience function - all
each of these changes requires a seperate API call. Some API ca... | python | def Change(self,cpu=None,memory=None,description=None,group_id=None):
"""Change existing server object.
One more more fields can be set and method will return with a requests
object for all queued activities. This is a convenience function - all
each of these changes requires a seperate API call. Some API ca... | [
"def",
"Change",
"(",
"self",
",",
"cpu",
"=",
"None",
",",
"memory",
"=",
"None",
",",
"description",
"=",
"None",
",",
"group_id",
"=",
"None",
")",
":",
"if",
"group_id",
":",
"groupId",
"=",
"group_id",
"else",
":",
"groupId",
"=",
"None",
"paylo... | Change existing server object.
One more more fields can be set and method will return with a requests
object for all queued activities. This is a convenience function - all
each of these changes requires a seperate API call. Some API calls are synchronous
(e.g. changing group ID or password) while others are... | [
"Change",
"existing",
"server",
"object",
"."
] | f4dba40c627cb08dd4b7d0d277e8d67578010b05 | https://github.com/CenturyLinkCloud/clc-python-sdk/blob/f4dba40c627cb08dd4b7d0d277e8d67578010b05/src/clc/APIv2/server.py#L701-L727 | train |
CenturyLinkCloud/clc-python-sdk | src/clc/APIv2/server.py | Server.SetPassword | def SetPassword(self,password):
"""Request change of password.
The API request requires supplying the current password. For this we issue a call
to retrieve the credentials so note there will be an activity log for retrieving the
credentials associated with any SetPassword entry
>>> s.SetPassword("newpassw... | python | def SetPassword(self,password):
"""Request change of password.
The API request requires supplying the current password. For this we issue a call
to retrieve the credentials so note there will be an activity log for retrieving the
credentials associated with any SetPassword entry
>>> s.SetPassword("newpassw... | [
"def",
"SetPassword",
"(",
"self",
",",
"password",
")",
":",
"# 0: {op: \"set\", member: \"password\", value: {current: \" r`5Mun/vT:qZ]2?z\", password: \"Savvis123!\"}}",
"if",
"self",
".",
"data",
"[",
"'status'",
"]",
"!=",
"\"active\"",
":",
"raise",
"(",
"clc",
".",... | Request change of password.
The API request requires supplying the current password. For this we issue a call
to retrieve the credentials so note there will be an activity log for retrieving the
credentials associated with any SetPassword entry
>>> s.SetPassword("newpassword") | [
"Request",
"change",
"of",
"password",
"."
] | f4dba40c627cb08dd4b7d0d277e8d67578010b05 | https://github.com/CenturyLinkCloud/clc-python-sdk/blob/f4dba40c627cb08dd4b7d0d277e8d67578010b05/src/clc/APIv2/server.py#L736-L754 | train |
CenturyLinkCloud/clc-python-sdk | src/clc/APIv2/server.py | Server.Delete | def Delete(self):
"""Delete server.
https://t3n.zendesk.com/entries/59220824-Delete-Server
>>> clc.v2.Server("WA1BTDIAPI219").Delete().WaitUntilComplete()
0
"""
return(clc.v2.Requests(clc.v2.API.Call('DELETE','servers/%s/%s' % (self.alias,self.id),session=self.session),alias=self.alias,session=self.sessi... | python | def Delete(self):
"""Delete server.
https://t3n.zendesk.com/entries/59220824-Delete-Server
>>> clc.v2.Server("WA1BTDIAPI219").Delete().WaitUntilComplete()
0
"""
return(clc.v2.Requests(clc.v2.API.Call('DELETE','servers/%s/%s' % (self.alias,self.id),session=self.session),alias=self.alias,session=self.sessi... | [
"def",
"Delete",
"(",
"self",
")",
":",
"return",
"(",
"clc",
".",
"v2",
".",
"Requests",
"(",
"clc",
".",
"v2",
".",
"API",
".",
"Call",
"(",
"'DELETE'",
",",
"'servers/%s/%s'",
"%",
"(",
"self",
".",
"alias",
",",
"self",
".",
"id",
")",
",",
... | Delete server.
https://t3n.zendesk.com/entries/59220824-Delete-Server
>>> clc.v2.Server("WA1BTDIAPI219").Delete().WaitUntilComplete()
0 | [
"Delete",
"server",
"."
] | f4dba40c627cb08dd4b7d0d277e8d67578010b05 | https://github.com/CenturyLinkCloud/clc-python-sdk/blob/f4dba40c627cb08dd4b7d0d277e8d67578010b05/src/clc/APIv2/server.py#L757-L766 | train |
CenturyLinkCloud/clc-python-sdk | src/clc/APIv2/public_ip.py | PublicIPs.Get | def Get(self,key):
"""Get public_ip by providing either the public or the internal IP address."""
for public_ip in self.public_ips:
if public_ip.id == key: return(public_ip)
elif key == public_ip.internal: return(public_ip) | python | def Get(self,key):
"""Get public_ip by providing either the public or the internal IP address."""
for public_ip in self.public_ips:
if public_ip.id == key: return(public_ip)
elif key == public_ip.internal: return(public_ip) | [
"def",
"Get",
"(",
"self",
",",
"key",
")",
":",
"for",
"public_ip",
"in",
"self",
".",
"public_ips",
":",
"if",
"public_ip",
".",
"id",
"==",
"key",
":",
"return",
"(",
"public_ip",
")",
"elif",
"key",
"==",
"public_ip",
".",
"internal",
":",
"retur... | Get public_ip by providing either the public or the internal IP address. | [
"Get",
"public_ip",
"by",
"providing",
"either",
"the",
"public",
"or",
"the",
"internal",
"IP",
"address",
"."
] | f4dba40c627cb08dd4b7d0d277e8d67578010b05 | https://github.com/CenturyLinkCloud/clc-python-sdk/blob/f4dba40c627cb08dd4b7d0d277e8d67578010b05/src/clc/APIv2/public_ip.py#L54-L59 | train |
CenturyLinkCloud/clc-python-sdk | src/clc/APIv2/public_ip.py | PublicIPs.Add | def Add(self,ports,source_restrictions=None,private_ip=None):
"""Add new public_ip.
Specify one or more ports using a list of dicts with the following keys:
protocol - TCP, UDP, or ICMP
port - int 0-65534
port_to - (optional) if specifying a range of ports then the rqange end. int 0-65534
Optionally ... | python | def Add(self,ports,source_restrictions=None,private_ip=None):
"""Add new public_ip.
Specify one or more ports using a list of dicts with the following keys:
protocol - TCP, UDP, or ICMP
port - int 0-65534
port_to - (optional) if specifying a range of ports then the rqange end. int 0-65534
Optionally ... | [
"def",
"Add",
"(",
"self",
",",
"ports",
",",
"source_restrictions",
"=",
"None",
",",
"private_ip",
"=",
"None",
")",
":",
"payload",
"=",
"{",
"'ports'",
":",
"[",
"]",
"}",
"for",
"port",
"in",
"ports",
":",
"if",
"'port_to'",
"in",
"port",
":",
... | Add new public_ip.
Specify one or more ports using a list of dicts with the following keys:
protocol - TCP, UDP, or ICMP
port - int 0-65534
port_to - (optional) if specifying a range of ports then the rqange end. int 0-65534
Optionally specify one or more source restrictions using a list of dicts with ... | [
"Add",
"new",
"public_ip",
"."
] | f4dba40c627cb08dd4b7d0d277e8d67578010b05 | https://github.com/CenturyLinkCloud/clc-python-sdk/blob/f4dba40c627cb08dd4b7d0d277e8d67578010b05/src/clc/APIv2/public_ip.py#L62-L109 | train |
CenturyLinkCloud/clc-python-sdk | src/clc/APIv2/public_ip.py | PublicIP._Load | def _Load(self,cached=True):
"""Performs a full load of all PublicIP metadata."""
if not self.data or not cached:
self.data = clc.v2.API.Call('GET','servers/%s/%s/publicIPAddresses/%s' % (self.parent.server.alias,self.parent.server.id,self.id),
session=self.session)
# build ports
self.data['_po... | python | def _Load(self,cached=True):
"""Performs a full load of all PublicIP metadata."""
if not self.data or not cached:
self.data = clc.v2.API.Call('GET','servers/%s/%s/publicIPAddresses/%s' % (self.parent.server.alias,self.parent.server.id,self.id),
session=self.session)
# build ports
self.data['_po... | [
"def",
"_Load",
"(",
"self",
",",
"cached",
"=",
"True",
")",
":",
"if",
"not",
"self",
".",
"data",
"or",
"not",
"cached",
":",
"self",
".",
"data",
"=",
"clc",
".",
"v2",
".",
"API",
".",
"Call",
"(",
"'GET'",
",",
"'servers/%s/%s/publicIPAddresses... | Performs a full load of all PublicIP metadata. | [
"Performs",
"a",
"full",
"load",
"of",
"all",
"PublicIP",
"metadata",
"."
] | f4dba40c627cb08dd4b7d0d277e8d67578010b05 | https://github.com/CenturyLinkCloud/clc-python-sdk/blob/f4dba40c627cb08dd4b7d0d277e8d67578010b05/src/clc/APIv2/public_ip.py#L125-L145 | train |
CenturyLinkCloud/clc-python-sdk | src/clc/APIv2/public_ip.py | PublicIP.Delete | def Delete(self):
"""Delete public IP.
>>> clc.v2.Server("WA1BTDIX01").PublicIPs().public_ips[0].Delete().WaitUntilComplete()
0
"""
public_ip_set = [{'public_ipId': o.id} for o in self.parent.public_ips if o!=self]
self.parent.public_ips = [o for o in self.parent.public_ips if o!=self]
return(clc.v2.Re... | python | def Delete(self):
"""Delete public IP.
>>> clc.v2.Server("WA1BTDIX01").PublicIPs().public_ips[0].Delete().WaitUntilComplete()
0
"""
public_ip_set = [{'public_ipId': o.id} for o in self.parent.public_ips if o!=self]
self.parent.public_ips = [o for o in self.parent.public_ips if o!=self]
return(clc.v2.Re... | [
"def",
"Delete",
"(",
"self",
")",
":",
"public_ip_set",
"=",
"[",
"{",
"'public_ipId'",
":",
"o",
".",
"id",
"}",
"for",
"o",
"in",
"self",
".",
"parent",
".",
"public_ips",
"if",
"o",
"!=",
"self",
"]",
"self",
".",
"parent",
".",
"public_ips",
"... | Delete public IP.
>>> clc.v2.Server("WA1BTDIX01").PublicIPs().public_ips[0].Delete().WaitUntilComplete()
0 | [
"Delete",
"public",
"IP",
"."
] | f4dba40c627cb08dd4b7d0d277e8d67578010b05 | https://github.com/CenturyLinkCloud/clc-python-sdk/blob/f4dba40c627cb08dd4b7d0d277e8d67578010b05/src/clc/APIv2/public_ip.py#L148-L161 | train |
CenturyLinkCloud/clc-python-sdk | src/clc/APIv2/public_ip.py | PublicIP.Update | def Update(self):
"""Commit current PublicIP definition to cloud.
Usually called by the class to commit changes to port and source restriction policies.
>>> clc.v2.Server("WA1BTDIX01").PublicIPs().public_ips[0].Update().WaitUntilComplete()
0
"""
return(clc.v2.Requests(clc.v2.API.Call('PUT','servers/%s/... | python | def Update(self):
"""Commit current PublicIP definition to cloud.
Usually called by the class to commit changes to port and source restriction policies.
>>> clc.v2.Server("WA1BTDIX01").PublicIPs().public_ips[0].Update().WaitUntilComplete()
0
"""
return(clc.v2.Requests(clc.v2.API.Call('PUT','servers/%s/... | [
"def",
"Update",
"(",
"self",
")",
":",
"return",
"(",
"clc",
".",
"v2",
".",
"Requests",
"(",
"clc",
".",
"v2",
".",
"API",
".",
"Call",
"(",
"'PUT'",
",",
"'servers/%s/%s/publicIPAddresses/%s'",
"%",
"(",
"self",
".",
"parent",
".",
"server",
".",
... | Commit current PublicIP definition to cloud.
Usually called by the class to commit changes to port and source restriction policies.
>>> clc.v2.Server("WA1BTDIX01").PublicIPs().public_ips[0].Update().WaitUntilComplete()
0 | [
"Commit",
"current",
"PublicIP",
"definition",
"to",
"cloud",
"."
] | f4dba40c627cb08dd4b7d0d277e8d67578010b05 | https://github.com/CenturyLinkCloud/clc-python-sdk/blob/f4dba40c627cb08dd4b7d0d277e8d67578010b05/src/clc/APIv2/public_ip.py#L164-L179 | train |
CenturyLinkCloud/clc-python-sdk | src/clc/APIv2/public_ip.py | PublicIP.AddPort | def AddPort(self,protocol,port,port_to=None):
"""Add and commit a single port.
# Add single port
>>> clc.v2.Server("WA1BTDIX01").PublicIPs().public_ips[0].AddPort(protocol='TCP',port='22').WaitUntilComplete()
0
# Add port range
>>> clc.v2.Server("WA1BTDIX01").PublicIPs().public_ips[0].AddPort(protocol='UD... | python | def AddPort(self,protocol,port,port_to=None):
"""Add and commit a single port.
# Add single port
>>> clc.v2.Server("WA1BTDIX01").PublicIPs().public_ips[0].AddPort(protocol='TCP',port='22').WaitUntilComplete()
0
# Add port range
>>> clc.v2.Server("WA1BTDIX01").PublicIPs().public_ips[0].AddPort(protocol='UD... | [
"def",
"AddPort",
"(",
"self",
",",
"protocol",
",",
"port",
",",
"port_to",
"=",
"None",
")",
":",
"self",
".",
"ports",
".",
"append",
"(",
"Port",
"(",
"self",
",",
"protocol",
",",
"port",
",",
"port_to",
")",
")",
"return",
"(",
"self",
".",
... | Add and commit a single port.
# Add single port
>>> clc.v2.Server("WA1BTDIX01").PublicIPs().public_ips[0].AddPort(protocol='TCP',port='22').WaitUntilComplete()
0
# Add port range
>>> clc.v2.Server("WA1BTDIX01").PublicIPs().public_ips[0].AddPort(protocol='UDP',port='10000',port_to='15000').WaitUntilComplete(... | [
"Add",
"and",
"commit",
"a",
"single",
"port",
"."
] | f4dba40c627cb08dd4b7d0d277e8d67578010b05 | https://github.com/CenturyLinkCloud/clc-python-sdk/blob/f4dba40c627cb08dd4b7d0d277e8d67578010b05/src/clc/APIv2/public_ip.py#L182-L197 | train |
CenturyLinkCloud/clc-python-sdk | src/clc/APIv2/public_ip.py | PublicIP.AddPorts | def AddPorts(self,ports):
"""Create one or more port access policies.
Include a list of dicts with protocol, port, and port_to (optional - for range) keys.
>>> clc.v2.Server("WA1BTDIX01").PublicIPs().public_ips[0]
.AddPorts([{'protocol': 'TCP', 'port': '80' },
{'protocol': 'UDP', 'port': '100... | python | def AddPorts(self,ports):
"""Create one or more port access policies.
Include a list of dicts with protocol, port, and port_to (optional - for range) keys.
>>> clc.v2.Server("WA1BTDIX01").PublicIPs().public_ips[0]
.AddPorts([{'protocol': 'TCP', 'port': '80' },
{'protocol': 'UDP', 'port': '100... | [
"def",
"AddPorts",
"(",
"self",
",",
"ports",
")",
":",
"for",
"port",
"in",
"ports",
":",
"if",
"'port_to'",
"in",
"port",
":",
"self",
".",
"ports",
".",
"append",
"(",
"Port",
"(",
"self",
",",
"port",
"[",
"'protocol'",
"]",
",",
"port",
"[",
... | Create one or more port access policies.
Include a list of dicts with protocol, port, and port_to (optional - for range) keys.
>>> clc.v2.Server("WA1BTDIX01").PublicIPs().public_ips[0]
.AddPorts([{'protocol': 'TCP', 'port': '80' },
{'protocol': 'UDP', 'port': '10000', 'port_to': '15000'}]).Wait... | [
"Create",
"one",
"or",
"more",
"port",
"access",
"policies",
"."
] | f4dba40c627cb08dd4b7d0d277e8d67578010b05 | https://github.com/CenturyLinkCloud/clc-python-sdk/blob/f4dba40c627cb08dd4b7d0d277e8d67578010b05/src/clc/APIv2/public_ip.py#L200-L216 | train |
CenturyLinkCloud/clc-python-sdk | src/clc/APIv2/public_ip.py | PublicIP.AddSourceRestriction | def AddSourceRestriction(self,cidr):
"""Add and commit a single source IP restriction policy.
>>> clc.v2.Server("WA1BTDIX01").PublicIPs().public_ips[0]
.AddSourceRestriction(cidr="132.200.20.1/32").WaitUntilComplete()
0
"""
self.source_restrictions.append(SourceRestriction(self,cidr))
return(self.Up... | python | def AddSourceRestriction(self,cidr):
"""Add and commit a single source IP restriction policy.
>>> clc.v2.Server("WA1BTDIX01").PublicIPs().public_ips[0]
.AddSourceRestriction(cidr="132.200.20.1/32").WaitUntilComplete()
0
"""
self.source_restrictions.append(SourceRestriction(self,cidr))
return(self.Up... | [
"def",
"AddSourceRestriction",
"(",
"self",
",",
"cidr",
")",
":",
"self",
".",
"source_restrictions",
".",
"append",
"(",
"SourceRestriction",
"(",
"self",
",",
"cidr",
")",
")",
"return",
"(",
"self",
".",
"Update",
"(",
")",
")"
] | Add and commit a single source IP restriction policy.
>>> clc.v2.Server("WA1BTDIX01").PublicIPs().public_ips[0]
.AddSourceRestriction(cidr="132.200.20.1/32").WaitUntilComplete()
0 | [
"Add",
"and",
"commit",
"a",
"single",
"source",
"IP",
"restriction",
"policy",
"."
] | f4dba40c627cb08dd4b7d0d277e8d67578010b05 | https://github.com/CenturyLinkCloud/clc-python-sdk/blob/f4dba40c627cb08dd4b7d0d277e8d67578010b05/src/clc/APIv2/public_ip.py#L219-L230 | train |
CenturyLinkCloud/clc-python-sdk | src/clc/APIv2/public_ip.py | PublicIP.AddSourceRestrictions | def AddSourceRestrictions(self,cidrs):
"""Create one or more CIDR source restriction policies.
Include a list of CIDR strings.
>>> clc.v2.Server("WA1BTDIX01").PublicIPs().public_ips[0]
.AddSourceRestrictions(cidrs=["132.200.20.1/32","132.200.20.100/32"]).WaitUntilComplete()
0
"""
for cidr in cidrs: ... | python | def AddSourceRestrictions(self,cidrs):
"""Create one or more CIDR source restriction policies.
Include a list of CIDR strings.
>>> clc.v2.Server("WA1BTDIX01").PublicIPs().public_ips[0]
.AddSourceRestrictions(cidrs=["132.200.20.1/32","132.200.20.100/32"]).WaitUntilComplete()
0
"""
for cidr in cidrs: ... | [
"def",
"AddSourceRestrictions",
"(",
"self",
",",
"cidrs",
")",
":",
"for",
"cidr",
"in",
"cidrs",
":",
"self",
".",
"source_restrictions",
".",
"append",
"(",
"SourceRestriction",
"(",
"self",
",",
"cidr",
")",
")",
"return",
"(",
"self",
".",
"Update",
... | Create one or more CIDR source restriction policies.
Include a list of CIDR strings.
>>> clc.v2.Server("WA1BTDIX01").PublicIPs().public_ips[0]
.AddSourceRestrictions(cidrs=["132.200.20.1/32","132.200.20.100/32"]).WaitUntilComplete()
0 | [
"Create",
"one",
"or",
"more",
"CIDR",
"source",
"restriction",
"policies",
"."
] | f4dba40c627cb08dd4b7d0d277e8d67578010b05 | https://github.com/CenturyLinkCloud/clc-python-sdk/blob/f4dba40c627cb08dd4b7d0d277e8d67578010b05/src/clc/APIv2/public_ip.py#L233-L246 | train |
CenturyLinkCloud/clc-python-sdk | src/clc/APIv2/public_ip.py | Port.Delete | def Delete(self):
"""Delete this port and commit change to cloud.
>>> clc.v2.Server("WA1BTDIX01").PublicIPs().public_ips[0].ports[0].Delete().WaitUntilComplete()
0
"""
self.public_ip.ports = [o for o in self.public_ip.ports if o!=self]
return(self.public_ip.Update()) | python | def Delete(self):
"""Delete this port and commit change to cloud.
>>> clc.v2.Server("WA1BTDIX01").PublicIPs().public_ips[0].ports[0].Delete().WaitUntilComplete()
0
"""
self.public_ip.ports = [o for o in self.public_ip.ports if o!=self]
return(self.public_ip.Update()) | [
"def",
"Delete",
"(",
"self",
")",
":",
"self",
".",
"public_ip",
".",
"ports",
"=",
"[",
"o",
"for",
"o",
"in",
"self",
".",
"public_ip",
".",
"ports",
"if",
"o",
"!=",
"self",
"]",
"return",
"(",
"self",
".",
"public_ip",
".",
"Update",
"(",
")... | Delete this port and commit change to cloud.
>>> clc.v2.Server("WA1BTDIX01").PublicIPs().public_ips[0].ports[0].Delete().WaitUntilComplete()
0 | [
"Delete",
"this",
"port",
"and",
"commit",
"change",
"to",
"cloud",
"."
] | f4dba40c627cb08dd4b7d0d277e8d67578010b05 | https://github.com/CenturyLinkCloud/clc-python-sdk/blob/f4dba40c627cb08dd4b7d0d277e8d67578010b05/src/clc/APIv2/public_ip.py#L274-L284 | train |
CenturyLinkCloud/clc-python-sdk | src/clc/APIv2/public_ip.py | SourceRestriction.Delete | def Delete(self):
"""Delete this source restriction and commit change to cloud.
>>> clc.v2.Server("WA1BTDIX01").PublicIPs().public_ips[0].source_restrictions[0].Delete().WaitUntilComplete()
0
"""
self.public_ip.source_restrictions = [o for o in self.public_ip.source_restrictions if o!=self]
return(self.... | python | def Delete(self):
"""Delete this source restriction and commit change to cloud.
>>> clc.v2.Server("WA1BTDIX01").PublicIPs().public_ips[0].source_restrictions[0].Delete().WaitUntilComplete()
0
"""
self.public_ip.source_restrictions = [o for o in self.public_ip.source_restrictions if o!=self]
return(self.... | [
"def",
"Delete",
"(",
"self",
")",
":",
"self",
".",
"public_ip",
".",
"source_restrictions",
"=",
"[",
"o",
"for",
"o",
"in",
"self",
".",
"public_ip",
".",
"source_restrictions",
"if",
"o",
"!=",
"self",
"]",
"return",
"(",
"self",
".",
"public_ip",
... | Delete this source restriction and commit change to cloud.
>>> clc.v2.Server("WA1BTDIX01").PublicIPs().public_ips[0].source_restrictions[0].Delete().WaitUntilComplete()
0 | [
"Delete",
"this",
"source",
"restriction",
"and",
"commit",
"change",
"to",
"cloud",
"."
] | f4dba40c627cb08dd4b7d0d277e8d67578010b05 | https://github.com/CenturyLinkCloud/clc-python-sdk/blob/f4dba40c627cb08dd4b7d0d277e8d67578010b05/src/clc/APIv2/public_ip.py#L308-L318 | train |
kamicut/tilepie | tilepie/proj.py | GoogleProjection.tile_bbox | def tile_bbox(self, tile_indices):
"""
Returns the WGS84 bbox of the specified tile
"""
(z, x, y) = tile_indices
topleft = (x * self.tilesize, (y + 1) * self.tilesize)
bottomright = ((x + 1) * self.tilesize, y * self.tilesize)
nw = self.unproject_pixels(topleft, z... | python | def tile_bbox(self, tile_indices):
"""
Returns the WGS84 bbox of the specified tile
"""
(z, x, y) = tile_indices
topleft = (x * self.tilesize, (y + 1) * self.tilesize)
bottomright = ((x + 1) * self.tilesize, y * self.tilesize)
nw = self.unproject_pixels(topleft, z... | [
"def",
"tile_bbox",
"(",
"self",
",",
"tile_indices",
")",
":",
"(",
"z",
",",
"x",
",",
"y",
")",
"=",
"tile_indices",
"topleft",
"=",
"(",
"x",
"*",
"self",
".",
"tilesize",
",",
"(",
"y",
"+",
"1",
")",
"*",
"self",
".",
"tilesize",
")",
"bo... | Returns the WGS84 bbox of the specified tile | [
"Returns",
"the",
"WGS84",
"bbox",
"of",
"the",
"specified",
"tile"
] | 103ae2be1c3c4e6f7ec4a3bdd265ffcddee92b96 | https://github.com/kamicut/tilepie/blob/103ae2be1c3c4e6f7ec4a3bdd265ffcddee92b96/tilepie/proj.py#L73-L82 | train |
kamicut/tilepie | tilepie/proj.py | GoogleProjection.unproject | def unproject(self, xy):
"""
Returns the coordinates from position in meters
"""
(x, y) = xy
lng = x/EARTH_RADIUS * RAD_TO_DEG
lat = 2 * atan(exp(y/EARTH_RADIUS)) - pi/2 * RAD_TO_DEG
return (lng, lat) | python | def unproject(self, xy):
"""
Returns the coordinates from position in meters
"""
(x, y) = xy
lng = x/EARTH_RADIUS * RAD_TO_DEG
lat = 2 * atan(exp(y/EARTH_RADIUS)) - pi/2 * RAD_TO_DEG
return (lng, lat) | [
"def",
"unproject",
"(",
"self",
",",
"xy",
")",
":",
"(",
"x",
",",
"y",
")",
"=",
"xy",
"lng",
"=",
"x",
"/",
"EARTH_RADIUS",
"*",
"RAD_TO_DEG",
"lat",
"=",
"2",
"*",
"atan",
"(",
"exp",
"(",
"y",
"/",
"EARTH_RADIUS",
")",
")",
"-",
"pi",
"... | Returns the coordinates from position in meters | [
"Returns",
"the",
"coordinates",
"from",
"position",
"in",
"meters"
] | 103ae2be1c3c4e6f7ec4a3bdd265ffcddee92b96 | https://github.com/kamicut/tilepie/blob/103ae2be1c3c4e6f7ec4a3bdd265ffcddee92b96/tilepie/proj.py#L95-L102 | train |
nuclio/nuclio-sdk-py | nuclio_sdk/response.py | Response.from_entrypoint_output | def from_entrypoint_output(json_encoder, handler_output):
"""Given a handler output's type, generates a response towards the
processor"""
response = {
'body': '',
'content_type': 'text/plain',
'headers': {},
'status_code': 200,
'body_e... | python | def from_entrypoint_output(json_encoder, handler_output):
"""Given a handler output's type, generates a response towards the
processor"""
response = {
'body': '',
'content_type': 'text/plain',
'headers': {},
'status_code': 200,
'body_e... | [
"def",
"from_entrypoint_output",
"(",
"json_encoder",
",",
"handler_output",
")",
":",
"response",
"=",
"{",
"'body'",
":",
"''",
",",
"'content_type'",
":",
"'text/plain'",
",",
"'headers'",
":",
"{",
"}",
",",
"'status_code'",
":",
"200",
",",
"'body_encodin... | Given a handler output's type, generates a response towards the
processor | [
"Given",
"a",
"handler",
"output",
"s",
"type",
"generates",
"a",
"response",
"towards",
"the",
"processor"
] | 5af9ffc19a0d96255ff430bc358be9cd7a57f424 | https://github.com/nuclio/nuclio-sdk-py/blob/5af9ffc19a0d96255ff430bc358be9cd7a57f424/nuclio_sdk/response.py#L34-L83 | train |
mjirik/imtools | imtools/sample_data.py | check_python_architecture | def check_python_architecture(pythondir, target_arch_str):
"""
functions check architecture of target python
"""
pyth_str = subprocess.check_output(
[pythondir + 'python', '-c',
'import platform; print platform.architecture()[0]'])
if pyth_str[:2] != target_arch_str:
raise E... | python | def check_python_architecture(pythondir, target_arch_str):
"""
functions check architecture of target python
"""
pyth_str = subprocess.check_output(
[pythondir + 'python', '-c',
'import platform; print platform.architecture()[0]'])
if pyth_str[:2] != target_arch_str:
raise E... | [
"def",
"check_python_architecture",
"(",
"pythondir",
",",
"target_arch_str",
")",
":",
"pyth_str",
"=",
"subprocess",
".",
"check_output",
"(",
"[",
"pythondir",
"+",
"'python'",
",",
"'-c'",
",",
"'import platform; print platform.architecture()[0]'",
"]",
")",
"if",... | functions check architecture of target python | [
"functions",
"check",
"architecture",
"of",
"target",
"python"
] | eb29fa59df0e0684d8334eb3bc5ef36ea46d1d3a | https://github.com/mjirik/imtools/blob/eb29fa59df0e0684d8334eb3bc5ef36ea46d1d3a/imtools/sample_data.py#L42-L52 | train |
mjirik/imtools | imtools/sample_data.py | downzip | def downzip(url, destination='./sample_data/'):
"""
Download, unzip and delete.
"""
# url = "http://147.228.240.61/queetech/sample-data/jatra_06mm_jenjatra.zip"
logmsg = "downloading from '" + url + "'"
print(logmsg)
logger.debug(logmsg)
local_file_name = os.path.join(destination, 'tmp.... | python | def downzip(url, destination='./sample_data/'):
"""
Download, unzip and delete.
"""
# url = "http://147.228.240.61/queetech/sample-data/jatra_06mm_jenjatra.zip"
logmsg = "downloading from '" + url + "'"
print(logmsg)
logger.debug(logmsg)
local_file_name = os.path.join(destination, 'tmp.... | [
"def",
"downzip",
"(",
"url",
",",
"destination",
"=",
"'./sample_data/'",
")",
":",
"# url = \"http://147.228.240.61/queetech/sample-data/jatra_06mm_jenjatra.zip\"",
"logmsg",
"=",
"\"downloading from '\"",
"+",
"url",
"+",
"\"'\"",
"print",
"(",
"logmsg",
")",
"logger",... | Download, unzip and delete. | [
"Download",
"unzip",
"and",
"delete",
"."
] | eb29fa59df0e0684d8334eb3bc5ef36ea46d1d3a | https://github.com/mjirik/imtools/blob/eb29fa59df0e0684d8334eb3bc5ef36ea46d1d3a/imtools/sample_data.py#L64-L77 | train |
mjirik/imtools | imtools/sample_data.py | checksum | def checksum(path, hashfunc='md5'):
"""
Return checksum given by path. Wildcards can be used in check sum. Function is strongly
dependent on checksumdir package by 'cakepietoast'.
:param path:
:param hashfunc:
:return:
"""
import checksumdir
hash_func = checksumdir.HASH_FUNCS.get(ha... | python | def checksum(path, hashfunc='md5'):
"""
Return checksum given by path. Wildcards can be used in check sum. Function is strongly
dependent on checksumdir package by 'cakepietoast'.
:param path:
:param hashfunc:
:return:
"""
import checksumdir
hash_func = checksumdir.HASH_FUNCS.get(ha... | [
"def",
"checksum",
"(",
"path",
",",
"hashfunc",
"=",
"'md5'",
")",
":",
"import",
"checksumdir",
"hash_func",
"=",
"checksumdir",
".",
"HASH_FUNCS",
".",
"get",
"(",
"hashfunc",
")",
"if",
"not",
"hash_func",
":",
"raise",
"NotImplementedError",
"(",
"'{} n... | Return checksum given by path. Wildcards can be used in check sum. Function is strongly
dependent on checksumdir package by 'cakepietoast'.
:param path:
:param hashfunc:
:return: | [
"Return",
"checksum",
"given",
"by",
"path",
".",
"Wildcards",
"can",
"be",
"used",
"in",
"check",
"sum",
".",
"Function",
"is",
"strongly",
"dependent",
"on",
"checksumdir",
"package",
"by",
"cakepietoast",
"."
] | eb29fa59df0e0684d8334eb3bc5ef36ea46d1d3a | https://github.com/mjirik/imtools/blob/eb29fa59df0e0684d8334eb3bc5ef36ea46d1d3a/imtools/sample_data.py#L166-L191 | train |
CenturyLinkCloud/clc-python-sdk | src/clc/APIv2/disk.py | Disks.Get | def Get(self,key):
"""Get disk by providing mount point or ID
If key is not unique and finds multiple matches only the first
will be returned
"""
for disk in self.disks:
if disk.id == key: return(disk)
elif key in disk.partition_paths: return(disk) | python | def Get(self,key):
"""Get disk by providing mount point or ID
If key is not unique and finds multiple matches only the first
will be returned
"""
for disk in self.disks:
if disk.id == key: return(disk)
elif key in disk.partition_paths: return(disk) | [
"def",
"Get",
"(",
"self",
",",
"key",
")",
":",
"for",
"disk",
"in",
"self",
".",
"disks",
":",
"if",
"disk",
".",
"id",
"==",
"key",
":",
"return",
"(",
"disk",
")",
"elif",
"key",
"in",
"disk",
".",
"partition_paths",
":",
"return",
"(",
"disk... | Get disk by providing mount point or ID
If key is not unique and finds multiple matches only the first
will be returned | [
"Get",
"disk",
"by",
"providing",
"mount",
"point",
"or",
"ID"
] | f4dba40c627cb08dd4b7d0d277e8d67578010b05 | https://github.com/CenturyLinkCloud/clc-python-sdk/blob/f4dba40c627cb08dd4b7d0d277e8d67578010b05/src/clc/APIv2/disk.py#L31-L40 | train |
CenturyLinkCloud/clc-python-sdk | src/clc/APIv2/disk.py | Disks.Search | def Search(self,key):
"""Search disk list by partial mount point or ID
"""
results = []
for disk in self.disks:
if disk.id.lower().find(key.lower()) != -1: results.append(disk)
# TODO - search in list to match partial mount points
elif key.lower() in disk.partition_paths: results.append(disk)
re... | python | def Search(self,key):
"""Search disk list by partial mount point or ID
"""
results = []
for disk in self.disks:
if disk.id.lower().find(key.lower()) != -1: results.append(disk)
# TODO - search in list to match partial mount points
elif key.lower() in disk.partition_paths: results.append(disk)
re... | [
"def",
"Search",
"(",
"self",
",",
"key",
")",
":",
"results",
"=",
"[",
"]",
"for",
"disk",
"in",
"self",
".",
"disks",
":",
"if",
"disk",
".",
"id",
".",
"lower",
"(",
")",
".",
"find",
"(",
"key",
".",
"lower",
"(",
")",
")",
"!=",
"-",
... | Search disk list by partial mount point or ID | [
"Search",
"disk",
"list",
"by",
"partial",
"mount",
"point",
"or",
"ID"
] | f4dba40c627cb08dd4b7d0d277e8d67578010b05 | https://github.com/CenturyLinkCloud/clc-python-sdk/blob/f4dba40c627cb08dd4b7d0d277e8d67578010b05/src/clc/APIv2/disk.py#L43-L54 | train |
CenturyLinkCloud/clc-python-sdk | src/clc/APIv2/disk.py | Disks.Add | def Add(self,size,path=None,type="partitioned"):
"""Add new disk.
This request will error if disk is protected and cannot be removed (e.g. a system disk)
# Partitioned disk
>>> clc.v2.Server("WA1BTDIX01").Disks().Add(size=20,path=None,type="raw").WaitUntilComplete()
0
# Raw disk
>>> clc.v2.Server("WA1B... | python | def Add(self,size,path=None,type="partitioned"):
"""Add new disk.
This request will error if disk is protected and cannot be removed (e.g. a system disk)
# Partitioned disk
>>> clc.v2.Server("WA1BTDIX01").Disks().Add(size=20,path=None,type="raw").WaitUntilComplete()
0
# Raw disk
>>> clc.v2.Server("WA1B... | [
"def",
"Add",
"(",
"self",
",",
"size",
",",
"path",
"=",
"None",
",",
"type",
"=",
"\"partitioned\"",
")",
":",
"if",
"type",
"==",
"\"partitioned\"",
"and",
"not",
"path",
":",
"raise",
"(",
"clc",
".",
"CLCException",
"(",
"\"Must specify path to mount ... | Add new disk.
This request will error if disk is protected and cannot be removed (e.g. a system disk)
# Partitioned disk
>>> clc.v2.Server("WA1BTDIX01").Disks().Add(size=20,path=None,type="raw").WaitUntilComplete()
0
# Raw disk
>>> clc.v2.Server("WA1BTDIX01").Disks().Add(size=20,path=None,type="raw").Wai... | [
"Add",
"new",
"disk",
"."
] | f4dba40c627cb08dd4b7d0d277e8d67578010b05 | https://github.com/CenturyLinkCloud/clc-python-sdk/blob/f4dba40c627cb08dd4b7d0d277e8d67578010b05/src/clc/APIv2/disk.py#L57-L86 | train |
CenturyLinkCloud/clc-python-sdk | src/clc/APIv2/disk.py | Disk.Grow | def Grow(self,size):
"""Grow disk to the newly specified size.
Size must be less than 1024 and must be greater than the current size.
>>> clc.v2.Server("WA1BTDIX01").Disks().disks[2].Grow(30).WaitUntilComplete()
0
"""
if size>1024: raise(clc.CLCException("Cannot grow disk beyond 1024GB"))
if size<=se... | python | def Grow(self,size):
"""Grow disk to the newly specified size.
Size must be less than 1024 and must be greater than the current size.
>>> clc.v2.Server("WA1BTDIX01").Disks().disks[2].Grow(30).WaitUntilComplete()
0
"""
if size>1024: raise(clc.CLCException("Cannot grow disk beyond 1024GB"))
if size<=se... | [
"def",
"Grow",
"(",
"self",
",",
"size",
")",
":",
"if",
"size",
">",
"1024",
":",
"raise",
"(",
"clc",
".",
"CLCException",
"(",
"\"Cannot grow disk beyond 1024GB\"",
")",
")",
"if",
"size",
"<=",
"self",
".",
"size",
":",
"raise",
"(",
"clc",
".",
... | Grow disk to the newly specified size.
Size must be less than 1024 and must be greater than the current size.
>>> clc.v2.Server("WA1BTDIX01").Disks().disks[2].Grow(30).WaitUntilComplete()
0 | [
"Grow",
"disk",
"to",
"the",
"newly",
"specified",
"size",
"."
] | f4dba40c627cb08dd4b7d0d277e8d67578010b05 | https://github.com/CenturyLinkCloud/clc-python-sdk/blob/f4dba40c627cb08dd4b7d0d277e8d67578010b05/src/clc/APIv2/disk.py#L102-L125 | train |
CenturyLinkCloud/clc-python-sdk | src/clc/APIv2/disk.py | Disk.Delete | def Delete(self):
"""Delete disk.
This request will error if disk is protected and cannot be removed (e.g. a system disk)
>>> clc.v2.Server("WA1BTDIX01").Disks().disks[2].Delete().WaitUntilComplete()
0
"""
disk_set = [{'diskId': o.id, 'sizeGB': o.size} for o in self.parent.disks if o!=self]
self.paren... | python | def Delete(self):
"""Delete disk.
This request will error if disk is protected and cannot be removed (e.g. a system disk)
>>> clc.v2.Server("WA1BTDIX01").Disks().disks[2].Delete().WaitUntilComplete()
0
"""
disk_set = [{'diskId': o.id, 'sizeGB': o.size} for o in self.parent.disks if o!=self]
self.paren... | [
"def",
"Delete",
"(",
"self",
")",
":",
"disk_set",
"=",
"[",
"{",
"'diskId'",
":",
"o",
".",
"id",
",",
"'sizeGB'",
":",
"o",
".",
"size",
"}",
"for",
"o",
"in",
"self",
".",
"parent",
".",
"disks",
"if",
"o",
"!=",
"self",
"]",
"self",
".",
... | Delete disk.
This request will error if disk is protected and cannot be removed (e.g. a system disk)
>>> clc.v2.Server("WA1BTDIX01").Disks().disks[2].Delete().WaitUntilComplete()
0 | [
"Delete",
"disk",
"."
] | f4dba40c627cb08dd4b7d0d277e8d67578010b05 | https://github.com/CenturyLinkCloud/clc-python-sdk/blob/f4dba40c627cb08dd4b7d0d277e8d67578010b05/src/clc/APIv2/disk.py#L128-L145 | train |
sio2project/filetracker | filetracker/utils.py | file_digest | def file_digest(source):
"""Calculates SHA256 digest of a file.
Args:
source: either a file-like object or a path to file
"""
hash_sha256 = hashlib.sha256()
should_close = False
if isinstance(source, six.string_types):
should_close = True
source = open(source, 'rb')
... | python | def file_digest(source):
"""Calculates SHA256 digest of a file.
Args:
source: either a file-like object or a path to file
"""
hash_sha256 = hashlib.sha256()
should_close = False
if isinstance(source, six.string_types):
should_close = True
source = open(source, 'rb')
... | [
"def",
"file_digest",
"(",
"source",
")",
":",
"hash_sha256",
"=",
"hashlib",
".",
"sha256",
"(",
")",
"should_close",
"=",
"False",
"if",
"isinstance",
"(",
"source",
",",
"six",
".",
"string_types",
")",
":",
"should_close",
"=",
"True",
"source",
"=",
... | Calculates SHA256 digest of a file.
Args:
source: either a file-like object or a path to file | [
"Calculates",
"SHA256",
"digest",
"of",
"a",
"file",
"."
] | 359b474850622e3d0c25ee2596d7242c02f84efb | https://github.com/sio2project/filetracker/blob/359b474850622e3d0c25ee2596d7242c02f84efb/filetracker/utils.py#L68-L88 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.