repo
stringlengths
7
55
path
stringlengths
4
223
func_name
stringlengths
1
134
original_string
stringlengths
75
104k
language
stringclasses
1 value
code
stringlengths
75
104k
code_tokens
listlengths
19
28.4k
docstring
stringlengths
1
46.9k
docstring_tokens
listlengths
1
1.97k
sha
stringlengths
40
40
url
stringlengths
87
315
partition
stringclasses
3 values
summary
stringlengths
4
350
cltl/KafNafParserPy
KafNafParserPy/markable_data.py
Cmarkables.add_external_reference
def add_external_reference(self,markable_id, external_ref): """ Adds an external reference for the given markable @type markable_id: string @param markable_id: the markable identifier @type external_ref: L{CexternalReference} @param external_ref: the external reference ob...
python
def add_external_reference(self,markable_id, external_ref): """ Adds an external reference for the given markable @type markable_id: string @param markable_id: the markable identifier @type external_ref: L{CexternalReference} @param external_ref: the external reference ob...
[ "def", "add_external_reference", "(", "self", ",", "markable_id", ",", "external_ref", ")", ":", "if", "markable_id", "in", "self", ".", "idx", ":", "markable_obj", "=", "Cterm", "(", "self", ".", "idx", "[", "markable_id", "]", ",", "self", ".", "type", ...
Adds an external reference for the given markable @type markable_id: string @param markable_id: the markable identifier @type external_ref: L{CexternalReference} @param external_ref: the external reference object
[ "Adds", "an", "external", "reference", "for", "the", "given", "markable" ]
9bc32e803c176404b255ba317479b8780ed5f569
https://github.com/cltl/KafNafParserPy/blob/9bc32e803c176404b255ba317479b8780ed5f569/KafNafParserPy/markable_data.py#L247-L259
train
Adds an external reference to the given markable
cltl/KafNafParserPy
KafNafParserPy/markable_data.py
Cmarkables.remove_markables
def remove_markables(self,list_mark_ids): """ Removes a list of markables from the layer @type list_term_ids: list @param list_term_ids: list of markable identifiers to be removed """ nodes_to_remove = set() for markable in self: if markable.get_id()...
python
def remove_markables(self,list_mark_ids): """ Removes a list of markables from the layer @type list_term_ids: list @param list_term_ids: list of markable identifiers to be removed """ nodes_to_remove = set() for markable in self: if markable.get_id()...
[ "def", "remove_markables", "(", "self", ",", "list_mark_ids", ")", ":", "nodes_to_remove", "=", "set", "(", ")", "for", "markable", "in", "self", ":", "if", "markable", ".", "get_id", "(", ")", "in", "list_mark_ids", ":", "nodes_to_remove", ".", "add", "("...
Removes a list of markables from the layer @type list_term_ids: list @param list_term_ids: list of markable identifiers to be removed
[ "Removes", "a", "list", "of", "markables", "from", "the", "layer" ]
9bc32e803c176404b255ba317479b8780ed5f569
https://github.com/cltl/KafNafParserPy/blob/9bc32e803c176404b255ba317479b8780ed5f569/KafNafParserPy/markable_data.py#L261-L277
train
Removes a list of markables from the layer.
MacHu-GWU/macro-project
recipe/might_and_magic_VI.py
learn_all_skill
def learn_all_skill(level=60, master_level=0): """在技能编辑界面学会所有的技能。运行脚本前, 将鼠标放在第一个技能的技能等级 的数字上, 并选中所有文本。然后运行此脚本, 并在1秒内切回到修改器界面。 :param level: 技能等级 :param master_level: 专精等级, 0是普通, 1是专家, 2是大师 """ level = str(level) bot.delay(1.0) for i in range(31): # 一共31个技能 bot.type_string(le...
python
def learn_all_skill(level=60, master_level=0): """在技能编辑界面学会所有的技能。运行脚本前, 将鼠标放在第一个技能的技能等级 的数字上, 并选中所有文本。然后运行此脚本, 并在1秒内切回到修改器界面。 :param level: 技能等级 :param master_level: 专精等级, 0是普通, 1是专家, 2是大师 """ level = str(level) bot.delay(1.0) for i in range(31): # 一共31个技能 bot.type_string(le...
[ "def", "learn_all_skill", "(", "level", "=", "60", ",", "master_level", "=", "0", ")", ":", "level", "=", "str", "(", "level", ")", "bot", ".", "delay", "(", "1.0", ")", "for", "i", "in", "range", "(", "31", ")", ":", "# 一共31个技能", "bot", ".", "ty...
在技能编辑界面学会所有的技能。运行脚本前, 将鼠标放在第一个技能的技能等级 的数字上, 并选中所有文本。然后运行此脚本, 并在1秒内切回到修改器界面。 :param level: 技能等级 :param master_level: 专精等级, 0是普通, 1是专家, 2是大师
[ "在技能编辑界面学会所有的技能。运行脚本前", "将鼠标放在第一个技能的技能等级", "的数字上", "并选中所有文本。然后运行此脚本", "并在1秒内切回到修改器界面。", ":", "param", "level", ":", "技能等级", ":", "param", "master_level", ":", "专精等级", "0是普通", "1是专家", "2是大师" ]
dae909d2d28acbfa2be623aa2dffe988f3882d4d
https://github.com/MacHu-GWU/macro-project/blob/dae909d2d28acbfa2be623aa2dffe988f3882d4d/recipe/might_and_magic_VI.py#L11-L25
train
Learn all skills.
Open-ET/openet-core-beta
openet/core/utils.py
getinfo
def getinfo(ee_obj, n=4): """Make an exponential back off getInfo call on an Earth Engine object""" output = None for i in range(1, n): try: output = ee_obj.getInfo() except ee.ee_exception.EEException as e: if 'Earth Engine memory capacity exceeded' in str(e): ...
python
def getinfo(ee_obj, n=4): """Make an exponential back off getInfo call on an Earth Engine object""" output = None for i in range(1, n): try: output = ee_obj.getInfo() except ee.ee_exception.EEException as e: if 'Earth Engine memory capacity exceeded' in str(e): ...
[ "def", "getinfo", "(", "ee_obj", ",", "n", "=", "4", ")", ":", "output", "=", "None", "for", "i", "in", "range", "(", "1", ",", "n", ")", ":", "try", ":", "output", "=", "ee_obj", ".", "getInfo", "(", ")", "except", "ee", ".", "ee_exception", "...
Make an exponential back off getInfo call on an Earth Engine object
[ "Make", "an", "exponential", "back", "off", "getInfo", "call", "on", "an", "Earth", "Engine", "object" ]
f2b81ccf87bf7e7fe1b9f3dd1d4081d0ec7852db
https://github.com/Open-ET/openet-core-beta/blob/f2b81ccf87bf7e7fe1b9f3dd1d4081d0ec7852db/openet/core/utils.py#L9-L27
train
Make an exponential back off getInfo call on an Earth Engine object
Open-ET/openet-core-beta
openet/core/utils.py
constant_image_value
def constant_image_value(image, crs='EPSG:32613', scale=1): """Extract the output value from a calculation done with constant images""" return getinfo(ee.Image(image).reduceRegion( reducer=ee.Reducer.first(), scale=scale, geometry=ee.Geometry.Rectangle([0, 0, 10, 10], crs, False)))
python
def constant_image_value(image, crs='EPSG:32613', scale=1): """Extract the output value from a calculation done with constant images""" return getinfo(ee.Image(image).reduceRegion( reducer=ee.Reducer.first(), scale=scale, geometry=ee.Geometry.Rectangle([0, 0, 10, 10], crs, False)))
[ "def", "constant_image_value", "(", "image", ",", "crs", "=", "'EPSG:32613'", ",", "scale", "=", "1", ")", ":", "return", "getinfo", "(", "ee", ".", "Image", "(", "image", ")", ".", "reduceRegion", "(", "reducer", "=", "ee", ".", "Reducer", ".", "first...
Extract the output value from a calculation done with constant images
[ "Extract", "the", "output", "value", "from", "a", "calculation", "done", "with", "constant", "images" ]
f2b81ccf87bf7e7fe1b9f3dd1d4081d0ec7852db
https://github.com/Open-ET/openet-core-beta/blob/f2b81ccf87bf7e7fe1b9f3dd1d4081d0ec7852db/openet/core/utils.py#L33-L37
train
Extract the output value from a calculation done with constant images
Open-ET/openet-core-beta
openet/core/utils.py
point_image_value
def point_image_value(image, xy, scale=1): """Extract the output value from a calculation at a point""" return getinfo(ee.Image(image).reduceRegion( reducer=ee.Reducer.first(), geometry=ee.Geometry.Point(xy), scale=scale))
python
def point_image_value(image, xy, scale=1): """Extract the output value from a calculation at a point""" return getinfo(ee.Image(image).reduceRegion( reducer=ee.Reducer.first(), geometry=ee.Geometry.Point(xy), scale=scale))
[ "def", "point_image_value", "(", "image", ",", "xy", ",", "scale", "=", "1", ")", ":", "return", "getinfo", "(", "ee", ".", "Image", "(", "image", ")", ".", "reduceRegion", "(", "reducer", "=", "ee", ".", "Reducer", ".", "first", "(", ")", ",", "ge...
Extract the output value from a calculation at a point
[ "Extract", "the", "output", "value", "from", "a", "calculation", "at", "a", "point" ]
f2b81ccf87bf7e7fe1b9f3dd1d4081d0ec7852db
https://github.com/Open-ET/openet-core-beta/blob/f2b81ccf87bf7e7fe1b9f3dd1d4081d0ec7852db/openet/core/utils.py#L40-L44
train
Extract the output value from a calculation at a point
Open-ET/openet-core-beta
openet/core/utils.py
point_coll_value
def point_coll_value(coll, xy, scale=1): """Extract the output value from a calculation at a point""" output = getinfo(coll.getRegion(ee.Geometry.Point(xy), scale=scale)) # Structure output to easily be converted to a Pandas dataframe # First key is band name, second key is the date string col_dict...
python
def point_coll_value(coll, xy, scale=1): """Extract the output value from a calculation at a point""" output = getinfo(coll.getRegion(ee.Geometry.Point(xy), scale=scale)) # Structure output to easily be converted to a Pandas dataframe # First key is band name, second key is the date string col_dict...
[ "def", "point_coll_value", "(", "coll", ",", "xy", ",", "scale", "=", "1", ")", ":", "output", "=", "getinfo", "(", "coll", ".", "getRegion", "(", "ee", ".", "Geometry", ".", "Point", "(", "xy", ")", ",", "scale", "=", "scale", ")", ")", "# Structu...
Extract the output value from a calculation at a point
[ "Extract", "the", "output", "value", "from", "a", "calculation", "at", "a", "point" ]
f2b81ccf87bf7e7fe1b9f3dd1d4081d0ec7852db
https://github.com/Open-ET/openet-core-beta/blob/f2b81ccf87bf7e7fe1b9f3dd1d4081d0ec7852db/openet/core/utils.py#L47-L63
train
Extract the output value from a calculation at a point
Open-ET/openet-core-beta
openet/core/utils.py
date_0utc
def date_0utc(date): """Get the 0 UTC date for a date Parameters ---------- date : ee.Date Returns ------- ee.Date """ return ee.Date.fromYMD(date.get('year'), date.get('month'), date.get('day'))
python
def date_0utc(date): """Get the 0 UTC date for a date Parameters ---------- date : ee.Date Returns ------- ee.Date """ return ee.Date.fromYMD(date.get('year'), date.get('month'), date.get('day'))
[ "def", "date_0utc", "(", "date", ")", ":", "return", "ee", ".", "Date", ".", "fromYMD", "(", "date", ".", "get", "(", "'year'", ")", ",", "date", ".", "get", "(", "'month'", ")", ",", "date", ".", "get", "(", "'day'", ")", ")" ]
Get the 0 UTC date for a date Parameters ---------- date : ee.Date Returns ------- ee.Date
[ "Get", "the", "0", "UTC", "date", "for", "a", "date" ]
f2b81ccf87bf7e7fe1b9f3dd1d4081d0ec7852db
https://github.com/Open-ET/openet-core-beta/blob/f2b81ccf87bf7e7fe1b9f3dd1d4081d0ec7852db/openet/core/utils.py#L82-L95
train
Get the 0 UTC date for a date
EVEprosper/ProsperCommon
prosper/common/prosper_version.py
get_version
def get_version( here_path, default_version=DEFAULT_VERSION, ): """tries to resolve version number Args: here_path (str): path to project local dir default_version (str): what version to return if all else fails Returns: str: semantic_version information for library...
python
def get_version( here_path, default_version=DEFAULT_VERSION, ): """tries to resolve version number Args: here_path (str): path to project local dir default_version (str): what version to return if all else fails Returns: str: semantic_version information for library...
[ "def", "get_version", "(", "here_path", ",", "default_version", "=", "DEFAULT_VERSION", ",", ")", ":", "if", "'site-packages'", "in", "here_path", ":", "# Running as dependency", "return", "_version_from_file", "(", "here_path", ")", "if", "os", ".", "environ", "....
tries to resolve version number Args: here_path (str): path to project local dir default_version (str): what version to return if all else fails Returns: str: semantic_version information for library
[ "tries", "to", "resolve", "version", "number" ]
bcada3b25420099e1f204db8d55eb268e7b4dc27
https://github.com/EVEprosper/ProsperCommon/blob/bcada3b25420099e1f204db8d55eb268e7b4dc27/prosper/common/prosper_version.py#L18-L57
train
tries to resolve version number from file
EVEprosper/ProsperCommon
prosper/common/prosper_version.py
_read_git_tags
def _read_git_tags( default_version=DEFAULT_VERSION, git_command=('git', 'tag'), ): """tries to find current git tag Notes: git_command exposed for testing null case Args: default_version (str): what version to make git_command (:obj:`list`): subprocess command ...
python
def _read_git_tags( default_version=DEFAULT_VERSION, git_command=('git', 'tag'), ): """tries to find current git tag Notes: git_command exposed for testing null case Args: default_version (str): what version to make git_command (:obj:`list`): subprocess command ...
[ "def", "_read_git_tags", "(", "default_version", "=", "DEFAULT_VERSION", ",", "git_command", "=", "(", "'git'", ",", "'tag'", ")", ",", ")", ":", "try", ":", "current_tags", "=", "check_output", "(", "git_command", ")", ".", "splitlines", "(", ")", "except",...
tries to find current git tag Notes: git_command exposed for testing null case Args: default_version (str): what version to make git_command (:obj:`list`): subprocess command Retruns: str: latest version found, or default Warns: exceptions.ProsperDefaultVersio...
[ "tries", "to", "find", "current", "git", "tag" ]
bcada3b25420099e1f204db8d55eb268e7b4dc27
https://github.com/EVEprosper/ProsperCommon/blob/bcada3b25420099e1f204db8d55eb268e7b4dc27/prosper/common/prosper_version.py#L59-L101
train
Reads git tags and returns the latest version
EVEprosper/ProsperCommon
prosper/common/prosper_version.py
_version_from_file
def _version_from_file( path_to_version, default_version=DEFAULT_VERSION, ): """for PyPI installed versions, just get data from file Args: path_to_version (str): abspath to dir where version.txt exists default_version (str): fallback version in case of error Returns: ...
python
def _version_from_file( path_to_version, default_version=DEFAULT_VERSION, ): """for PyPI installed versions, just get data from file Args: path_to_version (str): abspath to dir where version.txt exists default_version (str): fallback version in case of error Returns: ...
[ "def", "_version_from_file", "(", "path_to_version", ",", "default_version", "=", "DEFAULT_VERSION", ",", ")", ":", "version_filepath", "=", "os", ".", "path", ".", "join", "(", "path_to_version", ",", "'version.txt'", ")", "if", "not", "os", ".", "path", ".",...
for PyPI installed versions, just get data from file Args: path_to_version (str): abspath to dir where version.txt exists default_version (str): fallback version in case of error Returns: str: current working version
[ "for", "PyPI", "installed", "versions", "just", "get", "data", "from", "file" ]
bcada3b25420099e1f204db8d55eb268e7b4dc27
https://github.com/EVEprosper/ProsperCommon/blob/bcada3b25420099e1f204db8d55eb268e7b4dc27/prosper/common/prosper_version.py#L103-L127
train
for PyPI installed versions just get data from file AttributeNames path_to_version exists AttributeNames default_version is the default version in case of error
EVEprosper/ProsperCommon
prosper/common/prosper_logging.py
ProsperLogger._configure_common
def _configure_common( self, prefix, fallback_level, fallback_format, handler_name, handler, custom_args='' ): """commom configuration code Args: prefix (str): A prefix for the `log_level` and `log_forma...
python
def _configure_common( self, prefix, fallback_level, fallback_format, handler_name, handler, custom_args='' ): """commom configuration code Args: prefix (str): A prefix for the `log_level` and `log_forma...
[ "def", "_configure_common", "(", "self", ",", "prefix", ",", "fallback_level", ",", "fallback_format", ",", "handler_name", ",", "handler", ",", "custom_args", "=", "''", ")", ":", "## Retrieve settings from config ##", "log_level", "=", "self", ".", "config", "."...
commom configuration code Args: prefix (str): A prefix for the `log_level` and `log_format` keys to use with the config. #FIXME: Hacky, add separate sections for each logger config? fallback_level (str): Fallback/minimum log level, for if config does not have one. fallback_f...
[ "commom", "configuration", "code" ]
bcada3b25420099e1f204db8d55eb268e7b4dc27
https://github.com/EVEprosper/ProsperCommon/blob/bcada3b25420099e1f204db8d55eb268e7b4dc27/prosper/common/prosper_logging.py#L126-L168
train
Configure the common logging configuration for the current instance of the class.
EVEprosper/ProsperCommon
prosper/common/prosper_logging.py
ProsperLogger.configure_default_logger
def configure_default_logger( self, log_freq='midnight', log_total=30, log_level='INFO', log_format=ReportingFormats.DEFAULT.value, custom_args='' ): """default logger that every Prosper script should use!! Args: lo...
python
def configure_default_logger( self, log_freq='midnight', log_total=30, log_level='INFO', log_format=ReportingFormats.DEFAULT.value, custom_args='' ): """default logger that every Prosper script should use!! Args: lo...
[ "def", "configure_default_logger", "(", "self", ",", "log_freq", "=", "'midnight'", ",", "log_total", "=", "30", ",", "log_level", "=", "'INFO'", ",", "log_format", "=", "ReportingFormats", ".", "DEFAULT", ".", "value", ",", "custom_args", "=", "''", ")", ":...
default logger that every Prosper script should use!! Args: log_freq (str): TimedRotatingFileHandle_str -- https://docs.python.org/3/library/logging.handlers.html#timedrotatingfilehandler log_total (int): how many log_freq periods between log rotations log_level (str): minim...
[ "default", "logger", "that", "every", "Prosper", "script", "should", "use!!" ]
bcada3b25420099e1f204db8d55eb268e7b4dc27
https://github.com/EVEprosper/ProsperCommon/blob/bcada3b25420099e1f204db8d55eb268e7b4dc27/prosper/common/prosper_logging.py#L170-L215
train
Configure the default logger that every Prosper script should use!!
EVEprosper/ProsperCommon
prosper/common/prosper_logging.py
ProsperLogger.configure_debug_logger
def configure_debug_logger( self, log_level='DEBUG', log_format=ReportingFormats.STDOUT.value, custom_args='' ): """debug logger for stdout messages. Replacement for print() Note: Will try to overwrite minimum log level to enable requeste...
python
def configure_debug_logger( self, log_level='DEBUG', log_format=ReportingFormats.STDOUT.value, custom_args='' ): """debug logger for stdout messages. Replacement for print() Note: Will try to overwrite minimum log level to enable requeste...
[ "def", "configure_debug_logger", "(", "self", ",", "log_level", "=", "'DEBUG'", ",", "log_format", "=", "ReportingFormats", ".", "STDOUT", ".", "value", ",", "custom_args", "=", "''", ")", ":", "self", ".", "_configure_common", "(", "'debug_'", ",", "log_level...
debug logger for stdout messages. Replacement for print() Note: Will try to overwrite minimum log level to enable requested log_level Args: log_level (str): desired log level for handle https://docs.python.org/3/library/logging.html#logging-levels log_format (str):...
[ "debug", "logger", "for", "stdout", "messages", ".", "Replacement", "for", "print", "()" ]
bcada3b25420099e1f204db8d55eb268e7b4dc27
https://github.com/EVEprosper/ProsperCommon/blob/bcada3b25420099e1f204db8d55eb268e7b4dc27/prosper/common/prosper_logging.py#L217-L241
train
Configure debug logger for stdout messages.
EVEprosper/ProsperCommon
prosper/common/prosper_logging.py
ProsperLogger.configure_discord_logger
def configure_discord_logger( self, discord_webhook=None, discord_recipient=None, log_level='ERROR', log_format=ReportingFormats.PRETTY_PRINT.value, custom_args='' ): """logger for sending messages to Discord. Easy way to alert humans ...
python
def configure_discord_logger( self, discord_webhook=None, discord_recipient=None, log_level='ERROR', log_format=ReportingFormats.PRETTY_PRINT.value, custom_args='' ): """logger for sending messages to Discord. Easy way to alert humans ...
[ "def", "configure_discord_logger", "(", "self", ",", "discord_webhook", "=", "None", ",", "discord_recipient", "=", "None", ",", "log_level", "=", "'ERROR'", ",", "log_format", "=", "ReportingFormats", ".", "PRETTY_PRINT", ".", "value", ",", "custom_args", "=", ...
logger for sending messages to Discord. Easy way to alert humans of issues Note: Will try to overwrite minimum log level to enable requested log_level Will warn and not attach hipchat logger if missing webhook key Learn more about webhooks: https://support.discordapp.com/hc...
[ "logger", "for", "sending", "messages", "to", "Discord", ".", "Easy", "way", "to", "alert", "humans", "of", "issues" ]
bcada3b25420099e1f204db8d55eb268e7b4dc27
https://github.com/EVEprosper/ProsperCommon/blob/bcada3b25420099e1f204db8d55eb268e7b4dc27/prosper/common/prosper_logging.py#L243-L302
train
Configure the discord logger for sending messages to the Hipchat server.
EVEprosper/ProsperCommon
prosper/common/prosper_logging.py
ProsperLogger.configure_slack_logger
def configure_slack_logger( self, slack_webhook=None, log_level='ERROR', log_format=ReportingFormats.SLACK_PRINT.value, custom_args='' ): """logger for sending messages to Slack. Easy way to alert humans of issues Note: Will t...
python
def configure_slack_logger( self, slack_webhook=None, log_level='ERROR', log_format=ReportingFormats.SLACK_PRINT.value, custom_args='' ): """logger for sending messages to Slack. Easy way to alert humans of issues Note: Will t...
[ "def", "configure_slack_logger", "(", "self", ",", "slack_webhook", "=", "None", ",", "log_level", "=", "'ERROR'", ",", "log_format", "=", "ReportingFormats", ".", "SLACK_PRINT", ".", "value", ",", "custom_args", "=", "''", ")", ":", "# Override defaults if requir...
logger for sending messages to Slack. Easy way to alert humans of issues Note: Will try to overwrite minimum log level to enable requested log_level Will warn and not attach hipchat logger if missing webhook key Learn more about webhooks: https://api.slack.com/docs/message-...
[ "logger", "for", "sending", "messages", "to", "Slack", ".", "Easy", "way", "to", "alert", "humans", "of", "issues" ]
bcada3b25420099e1f204db8d55eb268e7b4dc27
https://github.com/EVEprosper/ProsperCommon/blob/bcada3b25420099e1f204db8d55eb268e7b4dc27/prosper/common/prosper_logging.py#L305-L347
train
Configure slack logger for sending messages to Slack.
EVEprosper/ProsperCommon
prosper/common/prosper_logging.py
ProsperLogger.configure_hipchat_logger
def configure_hipchat_logger( self, hipchat_webhook=None, log_level='ERROR', log_format=ReportingFormats.PRETTY_PRINT.value, custom_args='' ): """logger for sending messages to HipChat. Easy way to alert humans of issues Note: ...
python
def configure_hipchat_logger( self, hipchat_webhook=None, log_level='ERROR', log_format=ReportingFormats.PRETTY_PRINT.value, custom_args='' ): """logger for sending messages to HipChat. Easy way to alert humans of issues Note: ...
[ "def", "configure_hipchat_logger", "(", "self", ",", "hipchat_webhook", "=", "None", ",", "log_level", "=", "'ERROR'", ",", "log_format", "=", "ReportingFormats", ".", "PRETTY_PRINT", ".", "value", ",", "custom_args", "=", "''", ")", ":", "# Override defaults if r...
logger for sending messages to HipChat. Easy way to alert humans of issues Note: Will try to overwrite minimum log level to enable requested log_level Will warn and not attach hipchat logger if missing webhook key Learn more about webhooks: https://yak.crowdstrike.com/addon...
[ "logger", "for", "sending", "messages", "to", "HipChat", ".", "Easy", "way", "to", "alert", "humans", "of", "issues" ]
bcada3b25420099e1f204db8d55eb268e7b4dc27
https://github.com/EVEprosper/ProsperCommon/blob/bcada3b25420099e1f204db8d55eb268e7b4dc27/prosper/common/prosper_logging.py#L350-L395
train
Configure HipChat logger for sending messages to HipChat.
EVEprosper/ProsperCommon
prosper/common/prosper_logging.py
DiscordWebhook.webhook
def webhook(self, webhook_url): """Load object with webhook_url Args: webhook_url (str): full webhook url given by Discord 'create webhook' func """ if not webhook_url: raise Exception('Url can not be None') matcher = re.match(self.__webhook_url_format,...
python
def webhook(self, webhook_url): """Load object with webhook_url Args: webhook_url (str): full webhook url given by Discord 'create webhook' func """ if not webhook_url: raise Exception('Url can not be None') matcher = re.match(self.__webhook_url_format,...
[ "def", "webhook", "(", "self", ",", "webhook_url", ")", ":", "if", "not", "webhook_url", ":", "raise", "Exception", "(", "'Url can not be None'", ")", "matcher", "=", "re", ".", "match", "(", "self", ".", "__webhook_url_format", ",", "webhook_url", ")", "if"...
Load object with webhook_url Args: webhook_url (str): full webhook url given by Discord 'create webhook' func
[ "Load", "object", "with", "webhook_url" ]
bcada3b25420099e1f204db8d55eb268e7b4dc27
https://github.com/EVEprosper/ProsperCommon/blob/bcada3b25420099e1f204db8d55eb268e7b4dc27/prosper/common/prosper_logging.py#L472-L486
train
Load object with webhook_url
EVEprosper/ProsperCommon
prosper/common/prosper_logging.py
DiscordWebhook.api_keys
def api_keys(self, serverid, api_key): """Load object with id/API pair Args: serverid (int): Discord 'guild' webhook is attached to api_key (`str`:uuid): unique ID for webhook """ if serverid and api_key: self.can_query = True # Yes, we _are_ (will b...
python
def api_keys(self, serverid, api_key): """Load object with id/API pair Args: serverid (int): Discord 'guild' webhook is attached to api_key (`str`:uuid): unique ID for webhook """ if serverid and api_key: self.can_query = True # Yes, we _are_ (will b...
[ "def", "api_keys", "(", "self", ",", "serverid", ",", "api_key", ")", ":", "if", "serverid", "and", "api_key", ":", "self", ".", "can_query", "=", "True", "# Yes, we _are_ (will be) configured", "self", ".", "serverid", "=", "int", "(", "serverid", ")", "sel...
Load object with id/API pair Args: serverid (int): Discord 'guild' webhook is attached to api_key (`str`:uuid): unique ID for webhook
[ "Load", "object", "with", "id", "/", "API", "pair" ]
bcada3b25420099e1f204db8d55eb268e7b4dc27
https://github.com/EVEprosper/ProsperCommon/blob/bcada3b25420099e1f204db8d55eb268e7b4dc27/prosper/common/prosper_logging.py#L488-L500
train
Load object with id and API key pair.
EVEprosper/ProsperCommon
prosper/common/prosper_logging.py
HackyDiscordHandler.emit
def emit(self, record): # pragma: no cover """required classmethod for logging to execute logging message""" if record.exc_text: record.exc_text = '```python\n{0}\n```'.format(record.exc_text) # recast to code block log_msg = self.format(record) if len(log_msg) + self.alert_...
python
def emit(self, record): # pragma: no cover """required classmethod for logging to execute logging message""" if record.exc_text: record.exc_text = '```python\n{0}\n```'.format(record.exc_text) # recast to code block log_msg = self.format(record) if len(log_msg) + self.alert_...
[ "def", "emit", "(", "self", ",", "record", ")", ":", "# pragma: no cover", "if", "record", ".", "exc_text", ":", "record", ".", "exc_text", "=", "'```python\\n{0}\\n```'", ".", "format", "(", "record", ".", "exc_text", ")", "# recast to code block", "log_msg", ...
required classmethod for logging to execute logging message
[ "required", "classmethod", "for", "logging", "to", "execute", "logging", "message" ]
bcada3b25420099e1f204db8d55eb268e7b4dc27
https://github.com/EVEprosper/ProsperCommon/blob/bcada3b25420099e1f204db8d55eb268e7b4dc27/prosper/common/prosper_logging.py#L546-L557
train
Called by the logging module to execute logging message
EVEprosper/ProsperCommon
prosper/common/prosper_logging.py
HackyDiscordHandler.send_msg_to_webhook
def send_msg_to_webhook(self, message): """separated Requests logic for easier testing Args: message (str): actual logging string to be passed to REST endpoint Todo: * Requests.text/json return for better testing options """ payload = { 'cont...
python
def send_msg_to_webhook(self, message): """separated Requests logic for easier testing Args: message (str): actual logging string to be passed to REST endpoint Todo: * Requests.text/json return for better testing options """ payload = { 'cont...
[ "def", "send_msg_to_webhook", "(", "self", ",", "message", ")", ":", "payload", "=", "{", "'content'", ":", "message", "}", "header", "=", "{", "'Content-Type'", ":", "'application/json'", "}", "try", ":", "request", "=", "requests", ".", "post", "(", "sel...
separated Requests logic for easier testing Args: message (str): actual logging string to be passed to REST endpoint Todo: * Requests.text/json return for better testing options
[ "separated", "Requests", "logic", "for", "easier", "testing" ]
bcada3b25420099e1f204db8d55eb268e7b4dc27
https://github.com/EVEprosper/ProsperCommon/blob/bcada3b25420099e1f204db8d55eb268e7b4dc27/prosper/common/prosper_logging.py#L559-L592
train
Sends a message to the webhook
EVEprosper/ProsperCommon
prosper/common/prosper_logging.py
HackySlackHandler.decorate
def decorate(self, record): """add slack-specific flourishes to responses https://api.slack.com/docs/message-attachments Args: record (:obj:`logging.record`): message to log Returns: (:obj:`dict`): attachments object for reporting """ attachmen...
python
def decorate(self, record): """add slack-specific flourishes to responses https://api.slack.com/docs/message-attachments Args: record (:obj:`logging.record`): message to log Returns: (:obj:`dict`): attachments object for reporting """ attachmen...
[ "def", "decorate", "(", "self", ",", "record", ")", ":", "attachments", "=", "{", "}", "## Set color", "if", "record", ".", "levelno", ">=", "logging", ".", "ERROR", ":", "attachments", "[", "'color'", "]", "=", "'warning'", "#builtin", "if", "record", "...
add slack-specific flourishes to responses https://api.slack.com/docs/message-attachments Args: record (:obj:`logging.record`): message to log Returns: (:obj:`dict`): attachments object for reporting
[ "add", "slack", "-", "specific", "flourishes", "to", "responses" ]
bcada3b25420099e1f204db8d55eb268e7b4dc27
https://github.com/EVEprosper/ProsperCommon/blob/bcada3b25420099e1f204db8d55eb268e7b4dc27/prosper/common/prosper_logging.py#L616-L645
train
add slack - specific flourishes to responses AttributeNames
EVEprosper/ProsperCommon
prosper/common/prosper_logging.py
HackySlackHandler.send_msg_to_webhook
def send_msg_to_webhook(self, json_payload, log_msg): """push message out to webhook Args: json_payload (:obj:`dict`): preformatted payload a la https://api.slack.com/docs/message-attachments log_msg (str): actual log message """ if SILENCE_OVERRIDE: # pragma: ...
python
def send_msg_to_webhook(self, json_payload, log_msg): """push message out to webhook Args: json_payload (:obj:`dict`): preformatted payload a la https://api.slack.com/docs/message-attachments log_msg (str): actual log message """ if SILENCE_OVERRIDE: # pragma: ...
[ "def", "send_msg_to_webhook", "(", "self", ",", "json_payload", ",", "log_msg", ")", ":", "if", "SILENCE_OVERRIDE", ":", "# pragma: no cover", "return", "payload", "=", "{", "'text'", ":", "log_msg", ",", "'attachments'", ":", "[", "json_payload", "]", "}", "h...
push message out to webhook Args: json_payload (:obj:`dict`): preformatted payload a la https://api.slack.com/docs/message-attachments log_msg (str): actual log message
[ "push", "message", "out", "to", "webhook" ]
bcada3b25420099e1f204db8d55eb268e7b4dc27
https://github.com/EVEprosper/ProsperCommon/blob/bcada3b25420099e1f204db8d55eb268e7b4dc27/prosper/common/prosper_logging.py#L647-L682
train
Pushes a message to the Slack API.
EVEprosper/ProsperCommon
prosper/common/prosper_logging.py
HackyHipChatHandler.decorate
def decorate(self, record): """Build up HipChat specific values for log record Args: record (:obj:`logging.record`): log message object Returns: dict: params for POST request """ color = 'gray' if record.levelno == logging.WARNING: c...
python
def decorate(self, record): """Build up HipChat specific values for log record Args: record (:obj:`logging.record`): log message object Returns: dict: params for POST request """ color = 'gray' if record.levelno == logging.WARNING: c...
[ "def", "decorate", "(", "self", ",", "record", ")", ":", "color", "=", "'gray'", "if", "record", ".", "levelno", "==", "logging", ".", "WARNING", ":", "color", "=", "'yellow'", "if", "record", ".", "levelno", "==", "logging", ".", "INFO", ":", "color",...
Build up HipChat specific values for log record Args: record (:obj:`logging.record`): log message object Returns: dict: params for POST request
[ "Build", "up", "HipChat", "specific", "values", "for", "log", "record" ]
bcada3b25420099e1f204db8d55eb268e7b4dc27
https://github.com/EVEprosper/ProsperCommon/blob/bcada3b25420099e1f204db8d55eb268e7b4dc27/prosper/common/prosper_logging.py#L691-L721
train
Build up HipChat specific values for log record
EVEprosper/ProsperCommon
prosper/common/prosper_logging.py
HackyHipChatHandler.send_msg_to_webhook
def send_msg_to_webhook( self, json_payload, log_msg ): """todo""" if SILENCE_OVERRIDE: return params = {**json_payload, 'message': log_msg} headers = {'Content-Type': 'application/json'} try: req = requests.post( ...
python
def send_msg_to_webhook( self, json_payload, log_msg ): """todo""" if SILENCE_OVERRIDE: return params = {**json_payload, 'message': log_msg} headers = {'Content-Type': 'application/json'} try: req = requests.post( ...
[ "def", "send_msg_to_webhook", "(", "self", ",", "json_payload", ",", "log_msg", ")", ":", "if", "SILENCE_OVERRIDE", ":", "return", "params", "=", "{", "*", "*", "json_payload", ",", "'message'", ":", "log_msg", "}", "headers", "=", "{", "'Content-Type'", ":"...
todo
[ "todo" ]
bcada3b25420099e1f204db8d55eb268e7b4dc27
https://github.com/EVEprosper/ProsperCommon/blob/bcada3b25420099e1f204db8d55eb268e7b4dc27/prosper/common/prosper_logging.py#L738-L766
train
Send a log message to the webhook.
CenturyLinkCloud/clc-python-sdk
src/clc/APIv1/network.py
Network.GetNetworks
def GetNetworks(alias=None,location=None): """Gets the list of Networks mapped to the account in the specified datacenter. https://t3n.zendesk.com/entries/21024721-Get-Networks :param alias: short code for a particular account. If none will use account's default alias :param location: datacenter where group ...
python
def GetNetworks(alias=None,location=None): """Gets the list of Networks mapped to the account in the specified datacenter. https://t3n.zendesk.com/entries/21024721-Get-Networks :param alias: short code for a particular account. If none will use account's default alias :param location: datacenter where group ...
[ "def", "GetNetworks", "(", "alias", "=", "None", ",", "location", "=", "None", ")", ":", "if", "alias", "is", "None", ":", "alias", "=", "clc", ".", "v1", ".", "Account", ".", "GetAlias", "(", ")", "if", "location", "is", "None", ":", "location", "...
Gets the list of Networks mapped to the account in the specified datacenter. https://t3n.zendesk.com/entries/21024721-Get-Networks :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's primary dat...
[ "Gets", "the", "list", "of", "Networks", "mapped", "to", "the", "account", "in", "the", "specified", "datacenter", "." ]
f4dba40c627cb08dd4b7d0d277e8d67578010b05
https://github.com/CenturyLinkCloud/clc-python-sdk/blob/f4dba40c627cb08dd4b7d0d277e8d67578010b05/src/clc/APIv1/network.py#L15-L26
train
Gets the list of Networks mapped to the account in the specified datacenter.
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
Gets the details for a Network and its IP Addresses.
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
Get the variable from the closest frame in the stack
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
Delete the key from the keyring and the Key and Address objects from the database
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
Wrap accepted value in list if not wrapped.
uzumaxy/pyvalid
pyvalid/__accepts.py
Accepts.__scan_func
def __scan_func(self, args_info): """Collect information about accepted arguments in following format: ( (<argument name>, <accepted types and values>), (<argument name>, <accepted types and values>), ... ) Args: args_i...
python
def __scan_func(self, args_info): """Collect information about accepted arguments in following format: ( (<argument name>, <accepted types and values>), (<argument name>, <accepted types and values>), ... ) Args: args_i...
[ "def", "__scan_func", "(", "self", ",", "args_info", ")", ":", "# Process args.", "for", "i", ",", "accepted_arg_vals", "in", "enumerate", "(", "self", ".", "accepted_arg_values", ")", ":", "# Wrap each accepted value in the list if yet not wrapped.", "accepted_arg_vals",...
Collect information about accepted arguments in following format: ( (<argument name>, <accepted types and values>), (<argument name>, <accepted types and values>), ... ) Args: args_info (inspect.FullArgSpec): Information about ...
[ "Collect", "information", "about", "accepted", "arguments", "in", "following", "format", ":", "(", "(", "<argument", "name", ">", "<accepted", "types", "and", "values", ">", ")", "(", "<argument", "name", ">", "<accepted", "types", "and", "values", ">", ")",...
74a1a64df1cc77cac55f12f0fe0f52292c6ae479
https://github.com/uzumaxy/pyvalid/blob/74a1a64df1cc77cac55f12f0fe0f52292c6ae479/pyvalid/__accepts.py#L53-L92
train
Scan function for function and arguments.
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
Validate the arguments of the function func_name with the list of accepted values.
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
Returns the ordinal number of a given integer as a string.
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
Retrieves a file from the local store.
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
Retrieves a file identified by name in streaming mode.
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
Returns the newest available version number of the file.
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
Returns the size of the file.
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
Adds a file to the filetracker under the given name.
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
Deletes the file identified by name along with its metadata.
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
Returns list of all stored local files.
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
Load the checkers
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
Check all the things in the tree tree.
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
Check all the things and be assertive about it
phn/angles
angles.py
normalize
def normalize(num, lower=0, upper=360, b=False): """Normalize number to range [lower, upper) or [lower, upper]. Parameters ---------- num : float The number to be normalized. lower : int Lower limit of range. Default is 0. upper : int Upper limit of range. Default is 360...
python
def normalize(num, lower=0, upper=360, b=False): """Normalize number to range [lower, upper) or [lower, upper]. Parameters ---------- num : float The number to be normalized. lower : int Lower limit of range. Default is 0. upper : int Upper limit of range. Default is 360...
[ "def", "normalize", "(", "num", ",", "lower", "=", "0", ",", "upper", "=", "360", ",", "b", "=", "False", ")", ":", "if", "lower", ">=", "upper", ":", "ValueError", "(", "\"lower must be lesser than upper\"", ")", "if", "not", "b", ":", "if", "not", ...
Normalize number to range [lower, upper) or [lower, upper]. Parameters ---------- num : float The number to be normalized. lower : int Lower limit of range. Default is 0. upper : int Upper limit of range. Default is 360. b : bool Type of normalization. Default is...
[ "Normalize", "number", "to", "range", "[", "lower", "upper", ")", "or", "[", "lower", "upper", "]", "." ]
5c30ed7c3a7412177daaed180bf3b2351b287589
https://github.com/phn/angles/blob/5c30ed7c3a7412177daaed180bf3b2351b287589/angles.py#L130-L251
train
Normalizes a number to range [ lower upper ) or [ lower upper ).
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
Converts a decimal number into sexagesimal representation.
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
Combine sexagesimal components into a decimal number.
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
Return sexagesimal string of given angle in degrees or hours.
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
Parses a sexagesimal number and returns a dict containing the sexagesimal number and the sexagesimal number in the sexagesimal number.
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
Parse a string into angular position.
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
Returns the angular separation between two points on a unit sphere.
phn/angles
angles.py
bear
def bear(a1, b1, a2, b2): """Find bearing/position angle between two points on a unit sphere. 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 angles d...
python
def bear(a1, b1, a2, b2): """Find bearing/position angle between two points on a unit sphere. 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 angles d...
[ "def", "bear", "(", "a1", ",", "b1", ",", "a2", ",", "b2", ")", ":", "# Find perpendicular to the plane containing the base and", "# z-axis. Then find the perpendicular to the plane containing", "# the base and the target. The angle between these two is the", "# position angle or beari...
Find bearing/position angle between two points on a unit sphere. 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 angles defining the second point....
[ "Find", "bearing", "/", "position", "angle", "between", "two", "points", "on", "a", "unit", "sphere", "." ]
5c30ed7c3a7412177daaed180bf3b2351b287589
https://github.com/phn/angles/blob/5c30ed7c3a7412177daaed180bf3b2351b287589/angles.py#L911-L1003
train
Find the bearing and position angle between two points on a unit sphere.
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
This function converts a given position on a sphere into a simplest base of the base of the current sphere.
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
Construct Cartesian vector from spherical coordinates.
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
Returns the cross product of two sets of attributes.
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
Returns the modulus of vector.
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
Returns the angular spearation between objects in radians.
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
Find position angle between objects in radians.
cltl/KafNafParserPy
KafNafParserPy/chunk_data.py
Cchunks.to_kaf
def to_kaf(self): """ Converts the object to KAF (if it is NAF) """ if self.type == 'NAF': self.type = 'KAF' for node in self.__get_node_terms(): node.set('cid', node.get('id')) del node.attrib['id']
python
def to_kaf(self): """ Converts the object to KAF (if it is NAF) """ if self.type == 'NAF': self.type = 'KAF' for node in self.__get_node_terms(): node.set('cid', node.get('id')) del node.attrib['id']
[ "def", "to_kaf", "(", "self", ")", ":", "if", "self", ".", "type", "==", "'NAF'", ":", "self", ".", "type", "=", "'KAF'", "for", "node", "in", "self", ".", "__get_node_terms", "(", ")", ":", "node", ".", "set", "(", "'cid'", ",", "node", ".", "ge...
Converts the object to KAF (if it is NAF)
[ "Converts", "the", "object", "to", "KAF", "(", "if", "it", "is", "NAF", ")" ]
9bc32e803c176404b255ba317479b8780ed5f569
https://github.com/cltl/KafNafParserPy/blob/9bc32e803c176404b255ba317479b8780ed5f569/KafNafParserPy/chunk_data.py#L158-L166
train
Converts the object to KAF
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
Returns the chunk object for the supplied identifier
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
Adds a chunk object to the layer
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
display a value assocciated with an attribute for each DataProperty instance in dp_list
csirtgadgets/csirtg-mail-py
csirtg_mail/parse.py
make_compat_str
def make_compat_str(in_str): """ Tries to guess encoding of [str/bytes] and decode it into an unicode object. """ assert isinstance(in_str, (bytes, str, unicode)) if not in_str: return unicode() # Chardet in Py2 works on str + bytes objects if IS_PY2 and isinstance(in_str, unico...
python
def make_compat_str(in_str): """ Tries to guess encoding of [str/bytes] and decode it into an unicode object. """ assert isinstance(in_str, (bytes, str, unicode)) if not in_str: return unicode() # Chardet in Py2 works on str + bytes objects if IS_PY2 and isinstance(in_str, unico...
[ "def", "make_compat_str", "(", "in_str", ")", ":", "assert", "isinstance", "(", "in_str", ",", "(", "bytes", ",", "str", ",", "unicode", ")", ")", "if", "not", "in_str", ":", "return", "unicode", "(", ")", "# Chardet in Py2 works on str + bytes objects", "if",...
Tries to guess encoding of [str/bytes] and decode it into an unicode object.
[ "Tries", "to", "guess", "encoding", "of", "[", "str", "/", "bytes", "]", "and", "decode", "it", "into", "an", "unicode", "object", "." ]
5fe71a8e4a911619bd8c1ef8e316b963e8813a5a
https://github.com/csirtgadgets/csirtg-mail-py/blob/5fe71a8e4a911619bd8c1ef8e316b963e8813a5a/csirtg_mail/parse.py#L21-L51
train
Try to guess encoding of str and decode it into a unicode object.
csirtgadgets/csirtg-mail-py
csirtg_mail/parse.py
decode_message_headers
def decode_message_headers(msg_headers): ''' Decode MIME encoded-word headers https://en.wikipedia.org/wiki/MIME#Encoded-Word :param msg_headers: Dictionary of message headers :return: Dictionary of message headers ''' headers_to_decode = ['from', 'reply-to', 'subject', 'to'] for item...
python
def decode_message_headers(msg_headers): ''' Decode MIME encoded-word headers https://en.wikipedia.org/wiki/MIME#Encoded-Word :param msg_headers: Dictionary of message headers :return: Dictionary of message headers ''' headers_to_decode = ['from', 'reply-to', 'subject', 'to'] for item...
[ "def", "decode_message_headers", "(", "msg_headers", ")", ":", "headers_to_decode", "=", "[", "'from'", ",", "'reply-to'", ",", "'subject'", ",", "'to'", "]", "for", "item", "in", "headers_to_decode", ":", "return_list", "=", "[", "]", "try", ":", "# decode th...
Decode MIME encoded-word headers https://en.wikipedia.org/wiki/MIME#Encoded-Word :param msg_headers: Dictionary of message headers :return: Dictionary of message headers
[ "Decode", "MIME", "encoded", "-", "word", "headers", "https", ":", "//", "en", ".", "wikipedia", ".", "org", "/", "wiki", "/", "MIME#Encoded", "-", "Word" ]
5fe71a8e4a911619bd8c1ef8e316b963e8813a5a
https://github.com/csirtgadgets/csirtg-mail-py/blob/5fe71a8e4a911619bd8c1ef8e316b963e8813a5a/csirtg_mail/parse.py#L61-L85
train
Decodes the message headers from the MIME encoded - word headers .
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
Delay for dl seconds.
MacHu-GWU/macro-project
macro/bot.py
Bot.right_click
def right_click(self, x, y, n=1, pre_dl=None, post_dl=None): """Right click at ``(x, y)`` on screen for ``n`` times. at begin. **中文文档** 在屏幕的 ``(x, y)`` 坐标处右键单击 ``n`` 次。 """ self.delay(pre_dl) self.m.click(x, y, 2, n) self.delay(post_dl)
python
def right_click(self, x, y, n=1, pre_dl=None, post_dl=None): """Right click at ``(x, y)`` on screen for ``n`` times. at begin. **中文文档** 在屏幕的 ``(x, y)`` 坐标处右键单击 ``n`` 次。 """ self.delay(pre_dl) self.m.click(x, y, 2, n) self.delay(post_dl)
[ "def", "right_click", "(", "self", ",", "x", ",", "y", ",", "n", "=", "1", ",", "pre_dl", "=", "None", ",", "post_dl", "=", "None", ")", ":", "self", ".", "delay", "(", "pre_dl", ")", "self", ".", "m", ".", "click", "(", "x", ",", "y", ",", ...
Right click at ``(x, y)`` on screen for ``n`` times. at begin. **中文文档** 在屏幕的 ``(x, y)`` 坐标处右键单击 ``n`` 次。
[ "Right", "click", "at", "(", "x", "y", ")", "on", "screen", "for", "n", "times", ".", "at", "begin", "." ]
dae909d2d28acbfa2be623aa2dffe988f3882d4d
https://github.com/MacHu-GWU/macro-project/blob/dae909d2d28acbfa2be623aa2dffe988f3882d4d/macro/bot.py#L179-L189
train
Right click at x y on screen for n times.
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
Scroll up n times.
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
Scroll right n times.
MacHu-GWU/macro-project
macro/bot.py
Bot.move_to
def move_to(self, x, y, pre_dl=None, post_dl=None): """Move mouse to (x, y) **中文文档** 移动鼠标到 (x, y) 的坐标处。 """ self.delay(pre_dl) self.m.move(x, y) self.delay(post_dl)
python
def move_to(self, x, y, pre_dl=None, post_dl=None): """Move mouse to (x, y) **中文文档** 移动鼠标到 (x, y) 的坐标处。 """ self.delay(pre_dl) self.m.move(x, y) self.delay(post_dl)
[ "def", "move_to", "(", "self", ",", "x", ",", "y", ",", "pre_dl", "=", "None", ",", "post_dl", "=", "None", ")", ":", "self", ".", "delay", "(", "pre_dl", ")", "self", ".", "m", ".", "move", "(", "x", ",", "y", ")", "self", ".", "delay", "(",...
Move mouse to (x, y) **中文文档** 移动鼠标到 (x, y) 的坐标处。
[ "Move", "mouse", "to", "(", "x", "y", ")" ]
dae909d2d28acbfa2be623aa2dffe988f3882d4d
https://github.com/MacHu-GWU/macro-project/blob/dae909d2d28acbfa2be623aa2dffe988f3882d4d/macro/bot.py#L247-L256
train
Move mouse to x y
MacHu-GWU/macro-project
macro/bot.py
Bot.drag_and_release
def drag_and_release(self, start_x, start_y, end_x, end_y, pre_dl=None, post_dl=None): """Drag something from (start_x, start_y) to (end_x, endy) **中文文档** 从start的坐标处鼠标左键单击拖曳到end的坐标处 start, end是tuple. 格式是(x, y) """ self.delay(pre_dl) self.m.press(start_x, start_y...
python
def drag_and_release(self, start_x, start_y, end_x, end_y, pre_dl=None, post_dl=None): """Drag something from (start_x, start_y) to (end_x, endy) **中文文档** 从start的坐标处鼠标左键单击拖曳到end的坐标处 start, end是tuple. 格式是(x, y) """ self.delay(pre_dl) self.m.press(start_x, start_y...
[ "def", "drag_and_release", "(", "self", ",", "start_x", ",", "start_y", ",", "end_x", ",", "end_y", ",", "pre_dl", "=", "None", ",", "post_dl", "=", "None", ")", ":", "self", ".", "delay", "(", "pre_dl", ")", "self", ".", "m", ".", "press", "(", "s...
Drag something from (start_x, start_y) to (end_x, endy) **中文文档** 从start的坐标处鼠标左键单击拖曳到end的坐标处 start, end是tuple. 格式是(x, y)
[ "Drag", "something", "from", "(", "start_x", "start_y", ")", "to", "(", "end_x", "endy", ")" ]
dae909d2d28acbfa2be623aa2dffe988f3882d4d
https://github.com/MacHu-GWU/macro-project/blob/dae909d2d28acbfa2be623aa2dffe988f3882d4d/macro/bot.py#L258-L270
train
Drag something from start_x start_y to end_x end_y
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
TAP a key on keyboard for n times with interval seconds of interval.
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
Press enter key n times.
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
Press backspace key n times.
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
Press white space key n times.
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
Press Fn key n times.
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
Tap n times with interval seconds of interval.
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
Press up key n times.
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
Press down key n times.
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
Press left key n times
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
Press right key n times.
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
Presave delete key n times.
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
Insert n times.
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
Preserve home key n times.
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
Press end key n times.
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
Pres page_up key n times.
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
Pres page_down key n times.
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
Press combination of two keys like Ctrl + C Alt + F4.
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
Press two keys like Ctrl + Shift + C and tap the key n times.
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
Press Ctrl + C.
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
Press Ctrl + Fn1 ~ 12 once.
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
Press Alt + Fn1 ~ 12 once.
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
Press Shift + Fn1 ~ 12 once.
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
Press Alt + Tab once usually for switching between windows.
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
Enter strings. . type_string
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
Returns list of server objects populated if necessary.
CenturyLinkCloud/clc-python-sdk
src/clc/APIv2/server.py
Servers._Operation
def _Operation(self,operation): """Execute specified operations task against one or more servers. Returns a clc.v2.Requests object. If error due to server(s) already being in the requested state this is not raised as an error at this level. >>> clc.v2.Servers(["NY1BTDIPHYP0101","NY1BTDIWEB0101"]).Pause() <...
python
def _Operation(self,operation): """Execute specified operations task against one or more servers. Returns a clc.v2.Requests object. If error due to server(s) already being in the requested state this is not raised as an error at this level. >>> clc.v2.Servers(["NY1BTDIPHYP0101","NY1BTDIWEB0101"]).Pause() <...
[ "def", "_Operation", "(", "self", ",", "operation", ")", ":", "try", ":", "return", "(", "clc", ".", "v2", ".", "Requests", "(", "clc", ".", "v2", ".", "API", ".", "Call", "(", "'POST'", ",", "'operations/%s/servers/%s'", "%", "(", "self", ".", "alia...
Execute specified operations task against one or more servers. Returns a clc.v2.Requests object. If error due to server(s) already being in the requested state this is not raised as an error at this level. >>> clc.v2.Servers(["NY1BTDIPHYP0101","NY1BTDIWEB0101"]).Pause() <clc.APIv2.queue.Requests object at 0x...
[ "Execute", "specified", "operations", "task", "against", "one", "or", "more", "servers", "." ]
f4dba40c627cb08dd4b7d0d277e8d67578010b05
https://github.com/CenturyLinkCloud/clc-python-sdk/blob/f4dba40c627cb08dd4b7d0d277e8d67578010b05/src/clc/APIv2/server.py#L113-L133
train
Execute specified operations task against one or more servers.
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
Return account object for this server.
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
Return group object containing this server.
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
Return disks object associated with server.
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
Returns the PublicIPs object associated with the server.
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
Returns the hourly unit component prices for this server.