repository_name stringlengths 5 67 | func_path_in_repository stringlengths 4 234 | func_name stringlengths 0 314 | whole_func_string stringlengths 52 3.87M | language stringclasses 6
values | func_code_string stringlengths 52 3.87M | func_code_tokens listlengths 15 672k | func_documentation_string stringlengths 1 47.2k | func_documentation_tokens listlengths 1 3.92k | split_name stringclasses 1
value | func_code_url stringlengths 85 339 |
|---|---|---|---|---|---|---|---|---|---|---|
ttinies/sc2gameLobby | sc2gameLobby/resultHandler.py | playerSurrendered | def playerSurrendered(cfg):
"""the player has forceibly left the game"""
if cfg.numAgents + cfg.numBots == 2:
otherResult = c.RESULT_VICTORY
else: otherResult = c.RESULT_UNDECIDED # if multiple players remain, they need to finish the match
return assignValue(cfg, c.RESULT_DEFEAT, otherResult) | python | def playerSurrendered(cfg):
"""the player has forceibly left the game"""
if cfg.numAgents + cfg.numBots == 2:
otherResult = c.RESULT_VICTORY
else: otherResult = c.RESULT_UNDECIDED # if multiple players remain, they need to finish the match
return assignValue(cfg, c.RESULT_DEFEAT, otherResult) | [
"def",
"playerSurrendered",
"(",
"cfg",
")",
":",
"if",
"cfg",
".",
"numAgents",
"+",
"cfg",
".",
"numBots",
"==",
"2",
":",
"otherResult",
"=",
"c",
".",
"RESULT_VICTORY",
"else",
":",
"otherResult",
"=",
"c",
".",
"RESULT_UNDECIDED",
"# if multiple players... | the player has forceibly left the game | [
"the",
"player",
"has",
"forceibly",
"left",
"the",
"game"
] | train | https://github.com/ttinies/sc2gameLobby/blob/5352d51d53ddeb4858e92e682da89c4434123e52/sc2gameLobby/resultHandler.py#L18-L23 |
ttinies/sc2gameLobby | sc2gameLobby/resultHandler.py | assignValue | def assignValue(cfg, playerValue, otherValue):
"""artificially determine match results given match circumstances.
WARNING: cheating will be detected and your player will be banned from server"""
player = cfg.whoAmI()
result = {}
for p in cfg.players:
if p.name == player.name: val = playerV... | python | def assignValue(cfg, playerValue, otherValue):
"""artificially determine match results given match circumstances.
WARNING: cheating will be detected and your player will be banned from server"""
player = cfg.whoAmI()
result = {}
for p in cfg.players:
if p.name == player.name: val = playerV... | [
"def",
"assignValue",
"(",
"cfg",
",",
"playerValue",
",",
"otherValue",
")",
":",
"player",
"=",
"cfg",
".",
"whoAmI",
"(",
")",
"result",
"=",
"{",
"}",
"for",
"p",
"in",
"cfg",
".",
"players",
":",
"if",
"p",
".",
"name",
"==",
"player",
".",
... | artificially determine match results given match circumstances.
WARNING: cheating will be detected and your player will be banned from server | [
"artificially",
"determine",
"match",
"results",
"given",
"match",
"circumstances",
".",
"WARNING",
":",
"cheating",
"will",
"be",
"detected",
"and",
"your",
"player",
"will",
"be",
"banned",
"from",
"server"
] | train | https://github.com/ttinies/sc2gameLobby/blob/5352d51d53ddeb4858e92e682da89c4434123e52/sc2gameLobby/resultHandler.py#L39-L48 |
ttinies/sc2gameLobby | sc2gameLobby/resultHandler.py | idPlayerResults | def idPlayerResults(cfg, rawResult):
"""interpret standard rawResult for all players with known IDs"""
result = {}
knownPlayers = []
dictResult = {plyrRes.player_id : plyrRes.result for plyrRes in rawResult}
for p in cfg.players:
if p.playerID and p.playerID in dictResult: # identified playe... | python | def idPlayerResults(cfg, rawResult):
"""interpret standard rawResult for all players with known IDs"""
result = {}
knownPlayers = []
dictResult = {plyrRes.player_id : plyrRes.result for plyrRes in rawResult}
for p in cfg.players:
if p.playerID and p.playerID in dictResult: # identified playe... | [
"def",
"idPlayerResults",
"(",
"cfg",
",",
"rawResult",
")",
":",
"result",
"=",
"{",
"}",
"knownPlayers",
"=",
"[",
"]",
"dictResult",
"=",
"{",
"plyrRes",
".",
"player_id",
":",
"plyrRes",
".",
"result",
"for",
"plyrRes",
"in",
"rawResult",
"}",
"for",... | interpret standard rawResult for all players with known IDs | [
"interpret",
"standard",
"rawResult",
"for",
"all",
"players",
"with",
"known",
"IDs"
] | train | https://github.com/ttinies/sc2gameLobby/blob/5352d51d53ddeb4858e92e682da89c4434123e52/sc2gameLobby/resultHandler.py#L52-L68 |
bitlabstudio/django-generic-positions | generic_positions/admin.py | GenericPositionsAdmin.save_model | def save_model(self, request, obj, form, change):
"""Add an ObjectPosition to the object."""
super(GenericPositionsAdmin, self).save_model(request, obj, form,
change)
c_type = ContentType.objects.get_for_model(obj)
try:
Ob... | python | def save_model(self, request, obj, form, change):
"""Add an ObjectPosition to the object."""
super(GenericPositionsAdmin, self).save_model(request, obj, form,
change)
c_type = ContentType.objects.get_for_model(obj)
try:
Ob... | [
"def",
"save_model",
"(",
"self",
",",
"request",
",",
"obj",
",",
"form",
",",
"change",
")",
":",
"super",
"(",
"GenericPositionsAdmin",
",",
"self",
")",
".",
"save_model",
"(",
"request",
",",
"obj",
",",
"form",
",",
"change",
")",
"c_type",
"=",
... | Add an ObjectPosition to the object. | [
"Add",
"an",
"ObjectPosition",
"to",
"the",
"object",
"."
] | train | https://github.com/bitlabstudio/django-generic-positions/blob/75cac9b004fcb8e27ce167980489ffcabd49d723/generic_positions/admin.py#L19-L36 |
rodynnz/xccdf | src/xccdf/models/profile.py | Profile.as_dict | def as_dict(self):
"""
Serializes the object necessary data in a dictionary.
:returns: Serialized data in a dictionary.
:rtype: dict
"""
result_dict = super(Profile, self).as_dict()
statuses = list()
version = None
titles = list()
descri... | python | def as_dict(self):
"""
Serializes the object necessary data in a dictionary.
:returns: Serialized data in a dictionary.
:rtype: dict
"""
result_dict = super(Profile, self).as_dict()
statuses = list()
version = None
titles = list()
descri... | [
"def",
"as_dict",
"(",
"self",
")",
":",
"result_dict",
"=",
"super",
"(",
"Profile",
",",
"self",
")",
".",
"as_dict",
"(",
")",
"statuses",
"=",
"list",
"(",
")",
"version",
"=",
"None",
"titles",
"=",
"list",
"(",
")",
"descriptions",
"=",
"list",... | Serializes the object necessary data in a dictionary.
:returns: Serialized data in a dictionary.
:rtype: dict | [
"Serializes",
"the",
"object",
"necessary",
"data",
"in",
"a",
"dictionary",
"."
] | train | https://github.com/rodynnz/xccdf/blob/1b9dc2f06b5cce8db2a54c5f95a8f6bcf5cb6981/src/xccdf/models/profile.py#L129-L173 |
rodynnz/xccdf | src/xccdf/models/profile.py | Profile.update_xml_element | def update_xml_element(self):
"""
Updates the xml element contents to matches the instance contents.
:returns: Updated XML element.
:rtype: lxml.etree._Element
"""
if not hasattr(self, 'xml_element'):
self.xml_element = etree.Element(self.name, nsmap=NSMAP)
... | python | def update_xml_element(self):
"""
Updates the xml element contents to matches the instance contents.
:returns: Updated XML element.
:rtype: lxml.etree._Element
"""
if not hasattr(self, 'xml_element'):
self.xml_element = etree.Element(self.name, nsmap=NSMAP)
... | [
"def",
"update_xml_element",
"(",
"self",
")",
":",
"if",
"not",
"hasattr",
"(",
"self",
",",
"'xml_element'",
")",
":",
"self",
".",
"xml_element",
"=",
"etree",
".",
"Element",
"(",
"self",
".",
"name",
",",
"nsmap",
"=",
"NSMAP",
")",
"self",
".",
... | Updates the xml element contents to matches the instance contents.
:returns: Updated XML element.
:rtype: lxml.etree._Element | [
"Updates",
"the",
"xml",
"element",
"contents",
"to",
"matches",
"the",
"instance",
"contents",
"."
] | train | https://github.com/rodynnz/xccdf/blob/1b9dc2f06b5cce8db2a54c5f95a8f6bcf5cb6981/src/xccdf/models/profile.py#L175-L200 |
danielfrg/datasciencebox | datasciencebox/salt/_states/conda.py | managed | def managed(name, packages=None, requirements=None, saltenv='base', user=None):
"""
Create and install python requirements in a conda enviroment
pip is installed by default in the new enviroment
name : path to the enviroment to be created
packages : None
single package or list of packages t... | python | def managed(name, packages=None, requirements=None, saltenv='base', user=None):
"""
Create and install python requirements in a conda enviroment
pip is installed by default in the new enviroment
name : path to the enviroment to be created
packages : None
single package or list of packages t... | [
"def",
"managed",
"(",
"name",
",",
"packages",
"=",
"None",
",",
"requirements",
"=",
"None",
",",
"saltenv",
"=",
"'base'",
",",
"user",
"=",
"None",
")",
":",
"ret",
"=",
"{",
"'name'",
":",
"name",
",",
"'changes'",
":",
"{",
"}",
",",
"'commen... | Create and install python requirements in a conda enviroment
pip is installed by default in the new enviroment
name : path to the enviroment to be created
packages : None
single package or list of packages to install i.e. numpy, scipy=0.13.3, pandas
requirements : None
path to a `requir... | [
"Create",
"and",
"install",
"python",
"requirements",
"in",
"a",
"conda",
"enviroment",
"pip",
"is",
"installed",
"by",
"default",
"in",
"the",
"new",
"enviroment"
] | train | https://github.com/danielfrg/datasciencebox/blob/6b7aa642c6616a46547035fcb815acc1de605a6f/datasciencebox/salt/_states/conda.py#L15-L60 |
danielfrg/datasciencebox | datasciencebox/salt/_states/conda.py | installed | def installed(name, env=None, saltenv='base', user=None):
"""
Installs a single package, list of packages (comma separated) or packages in a requirements.txt
Checks if the package is already in the environment.
Check ocurres here so is only needed to `conda list` and `pip freeze` once
name
... | python | def installed(name, env=None, saltenv='base', user=None):
"""
Installs a single package, list of packages (comma separated) or packages in a requirements.txt
Checks if the package is already in the environment.
Check ocurres here so is only needed to `conda list` and `pip freeze` once
name
... | [
"def",
"installed",
"(",
"name",
",",
"env",
"=",
"None",
",",
"saltenv",
"=",
"'base'",
",",
"user",
"=",
"None",
")",
":",
"ret",
"=",
"{",
"'name'",
":",
"name",
",",
"'changes'",
":",
"{",
"}",
",",
"'comment'",
":",
"''",
",",
"'result'",
":... | Installs a single package, list of packages (comma separated) or packages in a requirements.txt
Checks if the package is already in the environment.
Check ocurres here so is only needed to `conda list` and `pip freeze` once
name
name of the package(s) or path to the requirements.txt
env : None... | [
"Installs",
"a",
"single",
"package",
"list",
"of",
"packages",
"(",
"comma",
"separated",
")",
"or",
"packages",
"in",
"a",
"requirements",
".",
"txt"
] | train | https://github.com/danielfrg/datasciencebox/blob/6b7aa642c6616a46547035fcb815acc1de605a6f/datasciencebox/salt/_states/conda.py#L63-L140 |
Parsl/libsubmit | libsubmit/providers/grid_engine/grid_engine.py | GridEngineProvider.get_configs | def get_configs(self, command):
"""Compose a dictionary with information for writing the submit script."""
logger.debug("Requesting one block with {} nodes per block and {} tasks per node".format(
self.nodes_per_block, self.tasks_per_node))
job_config = {}
job_config["submi... | python | def get_configs(self, command):
"""Compose a dictionary with information for writing the submit script."""
logger.debug("Requesting one block with {} nodes per block and {} tasks per node".format(
self.nodes_per_block, self.tasks_per_node))
job_config = {}
job_config["submi... | [
"def",
"get_configs",
"(",
"self",
",",
"command",
")",
":",
"logger",
".",
"debug",
"(",
"\"Requesting one block with {} nodes per block and {} tasks per node\"",
".",
"format",
"(",
"self",
".",
"nodes_per_block",
",",
"self",
".",
"tasks_per_node",
")",
")",
"job... | Compose a dictionary with information for writing the submit script. | [
"Compose",
"a",
"dictionary",
"with",
"information",
"for",
"writing",
"the",
"submit",
"script",
"."
] | train | https://github.com/Parsl/libsubmit/blob/27a41c16dd6f1c16d830a9ce1c97804920a59f64/libsubmit/providers/grid_engine/grid_engine.py#L98-L114 |
Parsl/libsubmit | libsubmit/providers/grid_engine/grid_engine.py | GridEngineProvider.submit | def submit(self, command="", blocksize=1, job_name="parsl.auto"):
''' The submit method takes the command string to be executed upon
instantiation of a resource most often to start a pilot (such as IPP engine
or even Swift-T engines).
Args :
- command (str) : The bash comma... | python | def submit(self, command="", blocksize=1, job_name="parsl.auto"):
''' The submit method takes the command string to be executed upon
instantiation of a resource most often to start a pilot (such as IPP engine
or even Swift-T engines).
Args :
- command (str) : The bash comma... | [
"def",
"submit",
"(",
"self",
",",
"command",
"=",
"\"\"",
",",
"blocksize",
"=",
"1",
",",
"job_name",
"=",
"\"parsl.auto\"",
")",
":",
"# Note: Fix this later to avoid confusing behavior.",
"# We should always allocate blocks in integer counts of node_granularity",
"if",
... | The submit method takes the command string to be executed upon
instantiation of a resource most often to start a pilot (such as IPP engine
or even Swift-T engines).
Args :
- command (str) : The bash command string to be executed.
- blocksize (int) : Blocksize to be req... | [
"The",
"submit",
"method",
"takes",
"the",
"command",
"string",
"to",
"be",
"executed",
"upon",
"instantiation",
"of",
"a",
"resource",
"most",
"often",
"to",
"start",
"a",
"pilot",
"(",
"such",
"as",
"IPP",
"engine",
"or",
"even",
"Swift",
"-",
"T",
"en... | train | https://github.com/Parsl/libsubmit/blob/27a41c16dd6f1c16d830a9ce1c97804920a59f64/libsubmit/providers/grid_engine/grid_engine.py#L116-L165 |
klen/makesite | makesite/modules/django/main/utils/models.py | update | def update(instance, full_clean=True, post_save=False, **kwargs):
"Atomically update instance, setting field/value pairs from kwargs"
# apply the updated args to the instance to mimic the change
# note that these might slightly differ from the true database values
# as the DB could have been updated by... | python | def update(instance, full_clean=True, post_save=False, **kwargs):
"Atomically update instance, setting field/value pairs from kwargs"
# apply the updated args to the instance to mimic the change
# note that these might slightly differ from the true database values
# as the DB could have been updated by... | [
"def",
"update",
"(",
"instance",
",",
"full_clean",
"=",
"True",
",",
"post_save",
"=",
"False",
",",
"*",
"*",
"kwargs",
")",
":",
"# apply the updated args to the instance to mimic the change",
"# note that these might slightly differ from the true database values",
"# as ... | Atomically update instance, setting field/value pairs from kwargs | [
"Atomically",
"update",
"instance",
"setting",
"field",
"/",
"value",
"pairs",
"from",
"kwargs"
] | train | https://github.com/klen/makesite/blob/f6f77a43a04a256189e8fffbeac1ffd63f35a10c/makesite/modules/django/main/utils/models.py#L40-L67 |
l0b0/qr2scad | qr2scad/qr2scad.py | qr2scad | def qr2scad(stream):
"""Convert black pixels to OpenSCAD cubes."""
img = Image.open(stream)
# Convert to black and white 8-bit
if img.mode != 'L':
img = img.convert('L')
# Invert color to get the right bounding box
img = ImageOps.invert(img)
bbox = img.getbbox()
# Crop to on... | python | def qr2scad(stream):
"""Convert black pixels to OpenSCAD cubes."""
img = Image.open(stream)
# Convert to black and white 8-bit
if img.mode != 'L':
img = img.convert('L')
# Invert color to get the right bounding box
img = ImageOps.invert(img)
bbox = img.getbbox()
# Crop to on... | [
"def",
"qr2scad",
"(",
"stream",
")",
":",
"img",
"=",
"Image",
".",
"open",
"(",
"stream",
")",
"# Convert to black and white 8-bit",
"if",
"img",
".",
"mode",
"!=",
"'L'",
":",
"img",
"=",
"img",
".",
"convert",
"(",
"'L'",
")",
"# Invert color to get th... | Convert black pixels to OpenSCAD cubes. | [
"Convert",
"black",
"pixels",
"to",
"OpenSCAD",
"cubes",
"."
] | train | https://github.com/l0b0/qr2scad/blob/f1df1d5ba98ab92e9fb11cb5e748be532e7df3cb/qr2scad/qr2scad.py#L55-L112 |
onjin/runenv | runenv/__init__.py | run | def run(*args):
"""Load given `envfile` and run `command` with `params`"""
if not args:
args = sys.argv[1:]
if len(args) < 2:
print('Usage: runenv <envfile> <command> <params>')
sys.exit(0)
os.environ.update(create_env(args[0]))
os.environ['_RUNENV_WRAPPED'] = '1'
runna... | python | def run(*args):
"""Load given `envfile` and run `command` with `params`"""
if not args:
args = sys.argv[1:]
if len(args) < 2:
print('Usage: runenv <envfile> <command> <params>')
sys.exit(0)
os.environ.update(create_env(args[0]))
os.environ['_RUNENV_WRAPPED'] = '1'
runna... | [
"def",
"run",
"(",
"*",
"args",
")",
":",
"if",
"not",
"args",
":",
"args",
"=",
"sys",
".",
"argv",
"[",
"1",
":",
"]",
"if",
"len",
"(",
"args",
")",
"<",
"2",
":",
"print",
"(",
"'Usage: runenv <envfile> <command> <params>'",
")",
"sys",
".",
"e... | Load given `envfile` and run `command` with `params` | [
"Load",
"given",
"envfile",
"and",
"run",
"command",
"with",
"params"
] | train | https://github.com/onjin/runenv/blob/1a1d31bc2d20a48e3c251d8e490bbad485b09e1c/runenv/__init__.py#L17-L41 |
onjin/runenv | runenv/__init__.py | create_env | def create_env(env_file):
"""Create environ dictionary from current os.environ and
variables got from given `env_file`"""
environ = {}
with open(env_file, 'r') as f:
for line in f.readlines():
line = line.rstrip(os.linesep)
if '=' not in line:
continue
... | python | def create_env(env_file):
"""Create environ dictionary from current os.environ and
variables got from given `env_file`"""
environ = {}
with open(env_file, 'r') as f:
for line in f.readlines():
line = line.rstrip(os.linesep)
if '=' not in line:
continue
... | [
"def",
"create_env",
"(",
"env_file",
")",
":",
"environ",
"=",
"{",
"}",
"with",
"open",
"(",
"env_file",
",",
"'r'",
")",
"as",
"f",
":",
"for",
"line",
"in",
"f",
".",
"readlines",
"(",
")",
":",
"line",
"=",
"line",
".",
"rstrip",
"(",
"os",
... | Create environ dictionary from current os.environ and
variables got from given `env_file` | [
"Create",
"environ",
"dictionary",
"from",
"current",
"os",
".",
"environ",
"and",
"variables",
"got",
"from",
"given",
"env_file"
] | train | https://github.com/onjin/runenv/blob/1a1d31bc2d20a48e3c251d8e490bbad485b09e1c/runenv/__init__.py#L52-L66 |
klen/makesite | makesite/main.py | info | def info(args):
" Show information about site. "
site = find_site(args.PATH)
print_header("%s -- install information" % site.get_name())
LOGGER.debug(site.get_info(full=True))
return True | python | def info(args):
" Show information about site. "
site = find_site(args.PATH)
print_header("%s -- install information" % site.get_name())
LOGGER.debug(site.get_info(full=True))
return True | [
"def",
"info",
"(",
"args",
")",
":",
"site",
"=",
"find_site",
"(",
"args",
".",
"PATH",
")",
"print_header",
"(",
"\"%s -- install information\"",
"%",
"site",
".",
"get_name",
"(",
")",
")",
"LOGGER",
".",
"debug",
"(",
"site",
".",
"get_info",
"(",
... | Show information about site. | [
"Show",
"information",
"about",
"site",
"."
] | train | https://github.com/klen/makesite/blob/f6f77a43a04a256189e8fffbeac1ffd63f35a10c/makesite/main.py#L17-L23 |
klen/makesite | makesite/main.py | ls | def ls(args):
"""
List sites
----------
Show list of installed sites.
::
usage: makesite ls [-h] [-v] [-p PATH]
Show list of installed sites.
optional arguments:
-p PATH, --path PATH path to makesite sites instalation dir. you can set it
... | python | def ls(args):
"""
List sites
----------
Show list of installed sites.
::
usage: makesite ls [-h] [-v] [-p PATH]
Show list of installed sites.
optional arguments:
-p PATH, --path PATH path to makesite sites instalation dir. you can set it
... | [
"def",
"ls",
"(",
"args",
")",
":",
"assert",
"args",
".",
"path",
",",
"\"Not finded MAKESITE HOME.\"",
"print_header",
"(",
"\"Installed sites:\"",
")",
"for",
"site",
"in",
"gen_sites",
"(",
"args",
".",
"path",
")",
":",
"LOGGER",
".",
"debug",
"(",
"s... | List sites
----------
Show list of installed sites.
::
usage: makesite ls [-h] [-v] [-p PATH]
Show list of installed sites.
optional arguments:
-p PATH, --path PATH path to makesite sites instalation dir. you can set it
in $makesite_home ... | [
"List",
"sites",
"----------"
] | train | https://github.com/klen/makesite/blob/f6f77a43a04a256189e8fffbeac1ffd63f35a10c/makesite/main.py#L32-L60 |
klen/makesite | makesite/main.py | update | def update(args):
"""
Run site update
---------------
Run updates for site or all installed.
::
usage: main.py update [-h] [-v] [-p PATH] [SITE]
Run site update
positional arguments:
SITE Path to site or name (project.branch)
optional ar... | python | def update(args):
"""
Run site update
---------------
Run updates for site or all installed.
::
usage: main.py update [-h] [-v] [-p PATH] [SITE]
Run site update
positional arguments:
SITE Path to site or name (project.branch)
optional ar... | [
"def",
"update",
"(",
"args",
")",
":",
"if",
"args",
".",
"SITE",
":",
"site",
"=",
"find_site",
"(",
"args",
".",
"SITE",
",",
"path",
"=",
"args",
".",
"path",
")",
"return",
"site",
".",
"run_update",
"(",
")",
"for",
"site",
"in",
"gen_sites",... | Run site update
---------------
Run updates for site or all installed.
::
usage: main.py update [-h] [-v] [-p PATH] [SITE]
Run site update
positional arguments:
SITE Path to site or name (project.branch)
optional arguments:
-p PATH, --pa... | [
"Run",
"site",
"update",
"---------------"
] | train | https://github.com/klen/makesite/blob/f6f77a43a04a256189e8fffbeac1ffd63f35a10c/makesite/main.py#L71-L113 |
klen/makesite | makesite/main.py | module | def module(args):
" Copy module source to current directory. "
mod = op.join(settings.MOD_DIR, args.MODULE)
assert op.exists(mod), "Not found module: %s" % args.MODULE
if not args.DEST.startswith(op.sep):
args.DEST = op.join(getcwd(), args.DEST)
print_header("Copy module source")
copytr... | python | def module(args):
" Copy module source to current directory. "
mod = op.join(settings.MOD_DIR, args.MODULE)
assert op.exists(mod), "Not found module: %s" % args.MODULE
if not args.DEST.startswith(op.sep):
args.DEST = op.join(getcwd(), args.DEST)
print_header("Copy module source")
copytr... | [
"def",
"module",
"(",
"args",
")",
":",
"mod",
"=",
"op",
".",
"join",
"(",
"settings",
".",
"MOD_DIR",
",",
"args",
".",
"MODULE",
")",
"assert",
"op",
".",
"exists",
"(",
"mod",
")",
",",
"\"Not found module: %s\"",
"%",
"args",
".",
"MODULE",
"if"... | Copy module source to current directory. | [
"Copy",
"module",
"source",
"to",
"current",
"directory",
"."
] | train | https://github.com/klen/makesite/blob/f6f77a43a04a256189e8fffbeac1ffd63f35a10c/makesite/main.py#L120-L128 |
klen/makesite | makesite/main.py | uninstall | def uninstall(args):
" Uninstall site. "
site = find_site(args.PATH)
site.run_remove()
site.clean()
if not listdir(op.dirname(site.deploy_dir)):
call('sudo rm -rf %s' % op.dirname(site.deploy_dir)) | python | def uninstall(args):
" Uninstall site. "
site = find_site(args.PATH)
site.run_remove()
site.clean()
if not listdir(op.dirname(site.deploy_dir)):
call('sudo rm -rf %s' % op.dirname(site.deploy_dir)) | [
"def",
"uninstall",
"(",
"args",
")",
":",
"site",
"=",
"find_site",
"(",
"args",
".",
"PATH",
")",
"site",
".",
"run_remove",
"(",
")",
"site",
".",
"clean",
"(",
")",
"if",
"not",
"listdir",
"(",
"op",
".",
"dirname",
"(",
"site",
".",
"deploy_di... | Uninstall site. | [
"Uninstall",
"site",
"."
] | train | https://github.com/klen/makesite/blob/f6f77a43a04a256189e8fffbeac1ffd63f35a10c/makesite/main.py#L132-L139 |
klen/makesite | makesite/main.py | template | def template(args):
" Add or remove templates from site. "
site = Site(args.PATH)
if args.ACTION == "add":
return site.add_template(args.TEMPLATE)
return site.remove_template(args.TEMPLATE) | python | def template(args):
" Add or remove templates from site. "
site = Site(args.PATH)
if args.ACTION == "add":
return site.add_template(args.TEMPLATE)
return site.remove_template(args.TEMPLATE) | [
"def",
"template",
"(",
"args",
")",
":",
"site",
"=",
"Site",
"(",
"args",
".",
"PATH",
")",
"if",
"args",
".",
"ACTION",
"==",
"\"add\"",
":",
"return",
"site",
".",
"add_template",
"(",
"args",
".",
"TEMPLATE",
")",
"return",
"site",
".",
"remove_... | Add or remove templates from site. | [
"Add",
"or",
"remove",
"templates",
"from",
"site",
"."
] | train | https://github.com/klen/makesite/blob/f6f77a43a04a256189e8fffbeac1ffd63f35a10c/makesite/main.py#L147-L152 |
klen/makesite | makesite/main.py | shell | def shell(args):
" A helper command to be used for shell integration "
print
print "# Makesite integration "
print "# ==================== "
print "export MAKESITE_HOME=%s" % args.path
print "source %s" % op.join(settings.BASEDIR, 'shell.sh')
print | python | def shell(args):
" A helper command to be used for shell integration "
print
print "# Makesite integration "
print "# ==================== "
print "export MAKESITE_HOME=%s" % args.path
print "source %s" % op.join(settings.BASEDIR, 'shell.sh')
print | [
"def",
"shell",
"(",
"args",
")",
":",
"print",
"print",
"\"# Makesite integration \"",
"print",
"\"# ==================== \"",
"print",
"\"export MAKESITE_HOME=%s\"",
"%",
"args",
".",
"path",
"print",
"\"source %s\"",
"%",
"op",
".",
"join",
"(",
"settings",
".",
... | A helper command to be used for shell integration | [
"A",
"helper",
"command",
"to",
"be",
"used",
"for",
"shell",
"integration"
] | train | https://github.com/klen/makesite/blob/f6f77a43a04a256189e8fffbeac1ffd63f35a10c/makesite/main.py#L161-L168 |
klen/makesite | makesite/main.py | install | def install(args):
" Install site from sources or module "
# Deactivate virtualenv
if 'VIRTUAL_ENV' in environ:
LOGGER.warning('Virtualenv enabled: %s' % environ['VIRTUAL_ENV'])
# Install from base modules
if args.module:
args.src = op.join(settings.MOD_DIR, args.module)
as... | python | def install(args):
" Install site from sources or module "
# Deactivate virtualenv
if 'VIRTUAL_ENV' in environ:
LOGGER.warning('Virtualenv enabled: %s' % environ['VIRTUAL_ENV'])
# Install from base modules
if args.module:
args.src = op.join(settings.MOD_DIR, args.module)
as... | [
"def",
"install",
"(",
"args",
")",
":",
"# Deactivate virtualenv",
"if",
"'VIRTUAL_ENV'",
"in",
"environ",
":",
"LOGGER",
".",
"warning",
"(",
"'Virtualenv enabled: %s'",
"%",
"environ",
"[",
"'VIRTUAL_ENV'",
"]",
")",
"# Install from base modules",
"if",
"args",
... | Install site from sources or module | [
"Install",
"site",
"from",
"sources",
"or",
"module"
] | train | https://github.com/klen/makesite/blob/f6f77a43a04a256189e8fffbeac1ffd63f35a10c/makesite/main.py#L191-L233 |
klen/makesite | makesite/main.py | autocomplete | def autocomplete(force=False):
" Shell autocompletion support. "
if 'MAKESITE_AUTO_COMPLETE' not in environ and not force:
return
commands = filter(lambda cmd: cmd != 'main', ACTIONS.keys())
cwords = environ['COMP_WORDS'].split()[1:]
cword = int(environ['COMP_CWORD'])
try:
cu... | python | def autocomplete(force=False):
" Shell autocompletion support. "
if 'MAKESITE_AUTO_COMPLETE' not in environ and not force:
return
commands = filter(lambda cmd: cmd != 'main', ACTIONS.keys())
cwords = environ['COMP_WORDS'].split()[1:]
cword = int(environ['COMP_CWORD'])
try:
cu... | [
"def",
"autocomplete",
"(",
"force",
"=",
"False",
")",
":",
"if",
"'MAKESITE_AUTO_COMPLETE'",
"not",
"in",
"environ",
"and",
"not",
"force",
":",
"return",
"commands",
"=",
"filter",
"(",
"lambda",
"cmd",
":",
"cmd",
"!=",
"'main'",
",",
"ACTIONS",
".",
... | Shell autocompletion support. | [
"Shell",
"autocompletion",
"support",
"."
] | train | https://github.com/klen/makesite/blob/f6f77a43a04a256189e8fffbeac1ffd63f35a10c/makesite/main.py#L236-L276 |
klen/makesite | makesite/main.py | main | def main(args=None):
" Base dispather "
try:
start = datetime.now()
LOGGER.info('MAKESITE Version %s' % version)
LOGGER.info('Started at %s' % start.strftime("%Y-%m-%d %H:%M:%S"))
LOGGER.info('Logfile: %s' % LOGFILE_HANDLER.stream.name)
LOGGER.info('-' * 60)
if ... | python | def main(args=None):
" Base dispather "
try:
start = datetime.now()
LOGGER.info('MAKESITE Version %s' % version)
LOGGER.info('Started at %s' % start.strftime("%Y-%m-%d %H:%M:%S"))
LOGGER.info('Logfile: %s' % LOGFILE_HANDLER.stream.name)
LOGGER.info('-' * 60)
if ... | [
"def",
"main",
"(",
"args",
"=",
"None",
")",
":",
"try",
":",
"start",
"=",
"datetime",
".",
"now",
"(",
")",
"LOGGER",
".",
"info",
"(",
"'MAKESITE Version %s'",
"%",
"version",
")",
"LOGGER",
".",
"info",
"(",
"'Started at %s'",
"%",
"start",
".",
... | Base dispather | [
"Base",
"dispather"
] | train | https://github.com/klen/makesite/blob/f6f77a43a04a256189e8fffbeac1ffd63f35a10c/makesite/main.py#L284-L313 |
klen/makesite | makesite/main.py | console | def console():
" Enter point "
autocomplete()
config = settings.MakesiteParser()
config.read([
settings.BASECONFIG, settings.HOMECONFIG,
op.join(settings.MAKESITE_HOME or '', settings.CFGNAME),
op.join(op.curdir, settings.CFGNAME),
])
argv = []
alias = dict(config.ite... | python | def console():
" Enter point "
autocomplete()
config = settings.MakesiteParser()
config.read([
settings.BASECONFIG, settings.HOMECONFIG,
op.join(settings.MAKESITE_HOME or '', settings.CFGNAME),
op.join(op.curdir, settings.CFGNAME),
])
argv = []
alias = dict(config.ite... | [
"def",
"console",
"(",
")",
":",
"autocomplete",
"(",
")",
"config",
"=",
"settings",
".",
"MakesiteParser",
"(",
")",
"config",
".",
"read",
"(",
"[",
"settings",
".",
"BASECONFIG",
",",
"settings",
".",
"HOMECONFIG",
",",
"op",
".",
"join",
"(",
"set... | Enter point | [
"Enter",
"point"
] | train | https://github.com/klen/makesite/blob/f6f77a43a04a256189e8fffbeac1ffd63f35a10c/makesite/main.py#L316-L334 |
acorg/pymds | pymds/mds.py | DistanceMatrix._gradient | def _gradient(self, diff, d, coords):
"""Compute the gradient.
Args:
diff (`array-like`): [`m`, `m`] matrix. `D` - `d`
d (`array-like`): [`m`, `m`] matrix.
coords (`array-like`): [`m`, `n`] matrix.
Returns:
`np.array`: Gradient, shape [`m`, `n`].... | python | def _gradient(self, diff, d, coords):
"""Compute the gradient.
Args:
diff (`array-like`): [`m`, `m`] matrix. `D` - `d`
d (`array-like`): [`m`, `m`] matrix.
coords (`array-like`): [`m`, `n`] matrix.
Returns:
`np.array`: Gradient, shape [`m`, `n`].... | [
"def",
"_gradient",
"(",
"self",
",",
"diff",
",",
"d",
",",
"coords",
")",
":",
"denom",
"=",
"np",
".",
"copy",
"(",
"d",
")",
"denom",
"[",
"denom",
"==",
"0",
"]",
"=",
"1e-5",
"with",
"np",
".",
"errstate",
"(",
"divide",
"=",
"'ignore'",
... | Compute the gradient.
Args:
diff (`array-like`): [`m`, `m`] matrix. `D` - `d`
d (`array-like`): [`m`, `m`] matrix.
coords (`array-like`): [`m`, `n`] matrix.
Returns:
`np.array`: Gradient, shape [`m`, `n`]. | [
"Compute",
"the",
"gradient",
"."
] | train | https://github.com/acorg/pymds/blob/b82939c9df0d434538bd30b7b548908a40f70bbe/pymds/mds.py#L82-L110 |
acorg/pymds | pymds/mds.py | DistanceMatrix._error_and_gradient | def _error_and_gradient(self, x):
"""Compute the error and the gradient.
This is the function optimized by :obj:`scipy.optimize.minimize`.
Args:
x (`array-like`): [`m` * `n`, ] matrix.
Returns:
`tuple`: containing:
- Error (`float`)
... | python | def _error_and_gradient(self, x):
"""Compute the error and the gradient.
This is the function optimized by :obj:`scipy.optimize.minimize`.
Args:
x (`array-like`): [`m` * `n`, ] matrix.
Returns:
`tuple`: containing:
- Error (`float`)
... | [
"def",
"_error_and_gradient",
"(",
"self",
",",
"x",
")",
":",
"coords",
"=",
"x",
".",
"reshape",
"(",
"(",
"self",
".",
"m",
",",
"self",
".",
"n",
")",
")",
"d",
"=",
"squareform",
"(",
"pdist",
"(",
"coords",
")",
")",
"diff",
"=",
"self",
... | Compute the error and the gradient.
This is the function optimized by :obj:`scipy.optimize.minimize`.
Args:
x (`array-like`): [`m` * `n`, ] matrix.
Returns:
`tuple`: containing:
- Error (`float`)
- Gradient (`np.array`) [`m`, `n`] | [
"Compute",
"the",
"error",
"and",
"the",
"gradient",
"."
] | train | https://github.com/acorg/pymds/blob/b82939c9df0d434538bd30b7b548908a40f70bbe/pymds/mds.py#L112-L131 |
acorg/pymds | pymds/mds.py | DistanceMatrix.optimize | def optimize(self, start=None, n=2):
"""Run multidimensional scaling on this distance matrix.
Args:
start (`None` or `array-like`): Starting coordinates. If
`start=None`, random starting coordinates are used. If
`array-like` must have shape [`m` * `n`, ].
... | python | def optimize(self, start=None, n=2):
"""Run multidimensional scaling on this distance matrix.
Args:
start (`None` or `array-like`): Starting coordinates. If
`start=None`, random starting coordinates are used. If
`array-like` must have shape [`m` * `n`, ].
... | [
"def",
"optimize",
"(",
"self",
",",
"start",
"=",
"None",
",",
"n",
"=",
"2",
")",
":",
"self",
".",
"n",
"=",
"n",
"if",
"start",
"is",
"None",
":",
"start",
"=",
"np",
".",
"random",
".",
"rand",
"(",
"self",
".",
"m",
"*",
"self",
".",
... | Run multidimensional scaling on this distance matrix.
Args:
start (`None` or `array-like`): Starting coordinates. If
`start=None`, random starting coordinates are used. If
`array-like` must have shape [`m` * `n`, ].
n (`int`): Number of dimensions to embe... | [
"Run",
"multidimensional",
"scaling",
"on",
"this",
"distance",
"matrix",
"."
] | train | https://github.com/acorg/pymds/blob/b82939c9df0d434538bd30b7b548908a40f70bbe/pymds/mds.py#L133-L176 |
acorg/pymds | pymds/mds.py | DistanceMatrix.optimize_batch | def optimize_batch(self, batchsize=10, returns='best', paralell=True):
"""
Run multiple optimizations using different starting coordinates.
Args:
batchsize (`int`): Number of optimizations to run.
returns (`str`): If ``'all'``, return results of all optimizations,
... | python | def optimize_batch(self, batchsize=10, returns='best', paralell=True):
"""
Run multiple optimizations using different starting coordinates.
Args:
batchsize (`int`): Number of optimizations to run.
returns (`str`): If ``'all'``, return results of all optimizations,
... | [
"def",
"optimize_batch",
"(",
"self",
",",
"batchsize",
"=",
"10",
",",
"returns",
"=",
"'best'",
",",
"paralell",
"=",
"True",
")",
":",
"if",
"returns",
"not",
"in",
"(",
"'best'",
",",
"'all'",
")",
":",
"raise",
"ValueError",
"(",
"'returns must be e... | Run multiple optimizations using different starting coordinates.
Args:
batchsize (`int`): Number of optimizations to run.
returns (`str`): If ``'all'``, return results of all optimizations,
ordered by stress, ascending. If ``'best'`` return the
projection... | [
"Run",
"multiple",
"optimizations",
"using",
"different",
"starting",
"coordinates",
"."
] | train | https://github.com/acorg/pymds/blob/b82939c9df0d434538bd30b7b548908a40f70bbe/pymds/mds.py#L178-L230 |
acorg/pymds | pymds/mds.py | Projection.from_optimize_result | def from_optimize_result(cls, result, n, m, index=None):
"""Construct a Projection from the output of an optimization.
Args:
result (:py:class:`scipy.optimize.OptimizeResult`): Object
returned by :py:func:`scipy.optimize.minimize`.
n (`int`): Number of dimension... | python | def from_optimize_result(cls, result, n, m, index=None):
"""Construct a Projection from the output of an optimization.
Args:
result (:py:class:`scipy.optimize.OptimizeResult`): Object
returned by :py:func:`scipy.optimize.minimize`.
n (`int`): Number of dimension... | [
"def",
"from_optimize_result",
"(",
"cls",
",",
"result",
",",
"n",
",",
"m",
",",
"index",
"=",
"None",
")",
":",
"coords",
"=",
"pd",
".",
"DataFrame",
"(",
"result",
".",
"x",
".",
"reshape",
"(",
"(",
"m",
",",
"n",
")",
")",
",",
"index",
... | Construct a Projection from the output of an optimization.
Args:
result (:py:class:`scipy.optimize.OptimizeResult`): Object
returned by :py:func:`scipy.optimize.minimize`.
n (`int`): Number of dimensions.
m (`int`): Number of samples.
index (`lis... | [
"Construct",
"a",
"Projection",
"from",
"the",
"output",
"of",
"an",
"optimization",
"."
] | train | https://github.com/acorg/pymds/blob/b82939c9df0d434538bd30b7b548908a40f70bbe/pymds/mds.py#L249-L265 |
acorg/pymds | pymds/mds.py | Projection._get_samples_shared_with | def _get_samples_shared_with(self, other, index=None):
"""Find samples shared with another dataset.
Args:
other
(:py:class:`pymds.Projection` or :py:class:`pandas.DataFrame`
or `array-like`):
The other dataset. If `other` is an instance of... | python | def _get_samples_shared_with(self, other, index=None):
"""Find samples shared with another dataset.
Args:
other
(:py:class:`pymds.Projection` or :py:class:`pandas.DataFrame`
or `array-like`):
The other dataset. If `other` is an instance of... | [
"def",
"_get_samples_shared_with",
"(",
"self",
",",
"other",
",",
"index",
"=",
"None",
")",
":",
"if",
"isinstance",
"(",
"other",
",",
"(",
"pd",
".",
"DataFrame",
",",
"Projection",
")",
")",
":",
"df_other",
"=",
"other",
".",
"coords",
"if",
"isi... | Find samples shared with another dataset.
Args:
other
(:py:class:`pymds.Projection` or :py:class:`pandas.DataFrame`
or `array-like`):
The other dataset. If `other` is an instance of
:py:class:`pymds.Projection` or :py:class:`pandas... | [
"Find",
"samples",
"shared",
"with",
"another",
"dataset",
"."
] | train | https://github.com/acorg/pymds/blob/b82939c9df0d434538bd30b7b548908a40f70bbe/pymds/mds.py#L267-L328 |
acorg/pymds | pymds/mds.py | Projection.plot | def plot(self, **kwds):
"""Plot the coordinates in the first two dimensions of the projection.
Removes axis and tick labels, and sets the grid spacing to 1 unit.
One way to display the grid is to use `Seaborn`_:
Args:
**kwds: Passed to :py:meth:`pandas.DataFrame.plot.scatte... | python | def plot(self, **kwds):
"""Plot the coordinates in the first two dimensions of the projection.
Removes axis and tick labels, and sets the grid spacing to 1 unit.
One way to display the grid is to use `Seaborn`_:
Args:
**kwds: Passed to :py:meth:`pandas.DataFrame.plot.scatte... | [
"def",
"plot",
"(",
"self",
",",
"*",
"*",
"kwds",
")",
":",
"ax",
"=",
"plt",
".",
"gca",
"(",
")",
"self",
".",
"coords",
".",
"plot",
".",
"scatter",
"(",
"x",
"=",
"0",
",",
"y",
"=",
"1",
",",
"ax",
"=",
"ax",
",",
"*",
"*",
"kwds",
... | Plot the coordinates in the first two dimensions of the projection.
Removes axis and tick labels, and sets the grid spacing to 1 unit.
One way to display the grid is to use `Seaborn`_:
Args:
**kwds: Passed to :py:meth:`pandas.DataFrame.plot.scatter`.
Examples:
... | [
"Plot",
"the",
"coordinates",
"in",
"the",
"first",
"two",
"dimensions",
"of",
"the",
"projection",
"."
] | train | https://github.com/acorg/pymds/blob/b82939c9df0d434538bd30b7b548908a40f70bbe/pymds/mds.py#L330-L368 |
acorg/pymds | pymds/mds.py | Projection.plot_lines_to | def plot_lines_to(self, other, index=None, **kwds):
"""Plot lines from samples shared between this projection and another
dataset.
Args:
other
(:py:class:`pymds.Projection` or :py:class:`pandas.DataFrame`
or `array-like`):
The other da... | python | def plot_lines_to(self, other, index=None, **kwds):
"""Plot lines from samples shared between this projection and another
dataset.
Args:
other
(:py:class:`pymds.Projection` or :py:class:`pandas.DataFrame`
or `array-like`):
The other da... | [
"def",
"plot_lines_to",
"(",
"self",
",",
"other",
",",
"index",
"=",
"None",
",",
"*",
"*",
"kwds",
")",
":",
"start",
",",
"end",
"=",
"self",
".",
"_get_samples_shared_with",
"(",
"other",
",",
"index",
"=",
"index",
")",
"segments",
"=",
"[",
"["... | Plot lines from samples shared between this projection and another
dataset.
Args:
other
(:py:class:`pymds.Projection` or :py:class:`pandas.DataFrame`
or `array-like`):
The other dataset to plot lines to. If other is an instance of
... | [
"Plot",
"lines",
"from",
"samples",
"shared",
"between",
"this",
"projection",
"and",
"another",
"dataset",
"."
] | train | https://github.com/acorg/pymds/blob/b82939c9df0d434538bd30b7b548908a40f70bbe/pymds/mds.py#L370-L405 |
acorg/pymds | pymds/mds.py | Projection.orient_to | def orient_to(self, other, index=None, inplace=False, scaling=False):
"""Orient this Projection to another dataset.
Orient this projection using reflection, rotation and translation to
match another projection using procrustes superimposition. Scaling is
optional.
Args:
... | python | def orient_to(self, other, index=None, inplace=False, scaling=False):
"""Orient this Projection to another dataset.
Orient this projection using reflection, rotation and translation to
match another projection using procrustes superimposition. Scaling is
optional.
Args:
... | [
"def",
"orient_to",
"(",
"self",
",",
"other",
",",
"index",
"=",
"None",
",",
"inplace",
"=",
"False",
",",
"scaling",
"=",
"False",
")",
":",
"arr_self",
",",
"arr_other",
"=",
"self",
".",
"_get_samples_shared_with",
"(",
"other",
",",
"index",
"=",
... | Orient this Projection to another dataset.
Orient this projection using reflection, rotation and translation to
match another projection using procrustes superimposition. Scaling is
optional.
Args:
other
(:py:class:`pymds.Projection` or :py:class:`pandas.Dat... | [
"Orient",
"this",
"Projection",
"to",
"another",
"dataset",
"."
] | train | https://github.com/acorg/pymds/blob/b82939c9df0d434538bd30b7b548908a40f70bbe/pymds/mds.py#L407-L471 |
danielfrg/datasciencebox | datasciencebox/salt/_modules/conda.py | conda_prefix | def conda_prefix(user=None):
"""
Get the conda prefix for a particular user (~/anaconda)
If user is None it defaults to /opt/anaconda
"""
if user == 'root':
return __salt__['grains.get']('conda:prefix', default='/opt/anaconda')
else:
if user is None:
user = __salt__['... | python | def conda_prefix(user=None):
"""
Get the conda prefix for a particular user (~/anaconda)
If user is None it defaults to /opt/anaconda
"""
if user == 'root':
return __salt__['grains.get']('conda:prefix', default='/opt/anaconda')
else:
if user is None:
user = __salt__['... | [
"def",
"conda_prefix",
"(",
"user",
"=",
"None",
")",
":",
"if",
"user",
"==",
"'root'",
":",
"return",
"__salt__",
"[",
"'grains.get'",
"]",
"(",
"'conda:prefix'",
",",
"default",
"=",
"'/opt/anaconda'",
")",
"else",
":",
"if",
"user",
"is",
"None",
":"... | Get the conda prefix for a particular user (~/anaconda)
If user is None it defaults to /opt/anaconda | [
"Get",
"the",
"conda",
"prefix",
"for",
"a",
"particular",
"user",
"(",
"~",
"/",
"anaconda",
")",
"If",
"user",
"is",
"None",
"it",
"defaults",
"to",
"/",
"opt",
"/",
"anaconda"
] | train | https://github.com/danielfrg/datasciencebox/blob/6b7aa642c6616a46547035fcb815acc1de605a6f/datasciencebox/salt/_modules/conda.py#L15-L27 |
danielfrg/datasciencebox | datasciencebox/salt/_modules/conda.py | create | def create(name, packages=None, user=None):
"""
Create a conda env
"""
packages = packages or ''
packages = packages.split(',')
packages.append('pip')
args = packages + ['--yes', '-q']
cmd = _create_conda_cmd('create', args=args, env=name, user=user)
ret = _execcmd(cmd, user=user, re... | python | def create(name, packages=None, user=None):
"""
Create a conda env
"""
packages = packages or ''
packages = packages.split(',')
packages.append('pip')
args = packages + ['--yes', '-q']
cmd = _create_conda_cmd('create', args=args, env=name, user=user)
ret = _execcmd(cmd, user=user, re... | [
"def",
"create",
"(",
"name",
",",
"packages",
"=",
"None",
",",
"user",
"=",
"None",
")",
":",
"packages",
"=",
"packages",
"or",
"''",
"packages",
"=",
"packages",
".",
"split",
"(",
"','",
")",
"packages",
".",
"append",
"(",
"'pip'",
")",
"args",... | Create a conda env | [
"Create",
"a",
"conda",
"env"
] | train | https://github.com/danielfrg/datasciencebox/blob/6b7aa642c6616a46547035fcb815acc1de605a6f/datasciencebox/salt/_modules/conda.py#L30-L51 |
danielfrg/datasciencebox | datasciencebox/salt/_modules/conda.py | list_ | def list_(env=None, user=None):
"""
List the installed packages on an environment
Returns
-------
Dictionary: {package: {version: 1.0.0, build: 1 } ... }
"""
cmd = _create_conda_cmd('list', args=['--json'], env=env, user=user)
ret = _execcmd(cmd, user=user)
if ret['retcode'] == ... | python | def list_(env=None, user=None):
"""
List the installed packages on an environment
Returns
-------
Dictionary: {package: {version: 1.0.0, build: 1 } ... }
"""
cmd = _create_conda_cmd('list', args=['--json'], env=env, user=user)
ret = _execcmd(cmd, user=user)
if ret['retcode'] == ... | [
"def",
"list_",
"(",
"env",
"=",
"None",
",",
"user",
"=",
"None",
")",
":",
"cmd",
"=",
"_create_conda_cmd",
"(",
"'list'",
",",
"args",
"=",
"[",
"'--json'",
"]",
",",
"env",
"=",
"env",
",",
"user",
"=",
"user",
")",
"ret",
"=",
"_execcmd",
"(... | List the installed packages on an environment
Returns
-------
Dictionary: {package: {version: 1.0.0, build: 1 } ... } | [
"List",
"the",
"installed",
"packages",
"on",
"an",
"environment"
] | train | https://github.com/danielfrg/datasciencebox/blob/6b7aa642c6616a46547035fcb815acc1de605a6f/datasciencebox/salt/_modules/conda.py#L67-L86 |
danielfrg/datasciencebox | datasciencebox/salt/_modules/conda.py | update | def update(packages, env=None, user=None):
"""
Update conda packages in a conda env
Attributes
----------
packages: list of packages comma delimited
"""
packages = ' '.join(packages.split(','))
cmd = _create_conda_cmd('update', args=[packages, '--yes', '-q'], env=env, user=user)
... | python | def update(packages, env=None, user=None):
"""
Update conda packages in a conda env
Attributes
----------
packages: list of packages comma delimited
"""
packages = ' '.join(packages.split(','))
cmd = _create_conda_cmd('update', args=[packages, '--yes', '-q'], env=env, user=user)
... | [
"def",
"update",
"(",
"packages",
",",
"env",
"=",
"None",
",",
"user",
"=",
"None",
")",
":",
"packages",
"=",
"' '",
".",
"join",
"(",
"packages",
".",
"split",
"(",
"','",
")",
")",
"cmd",
"=",
"_create_conda_cmd",
"(",
"'update'",
",",
"args",
... | Update conda packages in a conda env
Attributes
----------
packages: list of packages comma delimited | [
"Update",
"conda",
"packages",
"in",
"a",
"conda",
"env"
] | train | https://github.com/danielfrg/datasciencebox/blob/6b7aa642c6616a46547035fcb815acc1de605a6f/datasciencebox/salt/_modules/conda.py#L89-L99 |
danielfrg/datasciencebox | datasciencebox/salt/_modules/conda.py | remove | def remove(packages, env=None, user=None):
"""
Remove conda packages in a conda env
Attributes
----------
packages: list of packages comma delimited
"""
packages = ' '.join(packages.split(','))
cmd = _create_conda_cmd('remove', args=[packages, '--yes', '-q'], env=env, user=user)
... | python | def remove(packages, env=None, user=None):
"""
Remove conda packages in a conda env
Attributes
----------
packages: list of packages comma delimited
"""
packages = ' '.join(packages.split(','))
cmd = _create_conda_cmd('remove', args=[packages, '--yes', '-q'], env=env, user=user)
... | [
"def",
"remove",
"(",
"packages",
",",
"env",
"=",
"None",
",",
"user",
"=",
"None",
")",
":",
"packages",
"=",
"' '",
".",
"join",
"(",
"packages",
".",
"split",
"(",
"','",
")",
")",
"cmd",
"=",
"_create_conda_cmd",
"(",
"'remove'",
",",
"args",
... | Remove conda packages in a conda env
Attributes
----------
packages: list of packages comma delimited | [
"Remove",
"conda",
"packages",
"in",
"a",
"conda",
"env"
] | train | https://github.com/danielfrg/datasciencebox/blob/6b7aa642c6616a46547035fcb815acc1de605a6f/datasciencebox/salt/_modules/conda.py#L102-L112 |
danielfrg/datasciencebox | datasciencebox/salt/_modules/conda.py | _create_conda_cmd | def _create_conda_cmd(conda_cmd, args=None, env=None, user=None):
"""
Utility to create a valid conda command
"""
cmd = [_get_conda_path(user=user), conda_cmd]
if env:
cmd.extend(['-n', env])
if args is not None and isinstance(args, list) and args != []:
cmd.extend(args)
retu... | python | def _create_conda_cmd(conda_cmd, args=None, env=None, user=None):
"""
Utility to create a valid conda command
"""
cmd = [_get_conda_path(user=user), conda_cmd]
if env:
cmd.extend(['-n', env])
if args is not None and isinstance(args, list) and args != []:
cmd.extend(args)
retu... | [
"def",
"_create_conda_cmd",
"(",
"conda_cmd",
",",
"args",
"=",
"None",
",",
"env",
"=",
"None",
",",
"user",
"=",
"None",
")",
":",
"cmd",
"=",
"[",
"_get_conda_path",
"(",
"user",
"=",
"user",
")",
",",
"conda_cmd",
"]",
"if",
"env",
":",
"cmd",
... | Utility to create a valid conda command | [
"Utility",
"to",
"create",
"a",
"valid",
"conda",
"command"
] | train | https://github.com/danielfrg/datasciencebox/blob/6b7aa642c6616a46547035fcb815acc1de605a6f/datasciencebox/salt/_modules/conda.py#L115-L124 |
laginha/django-mobileesp | src/django_mobileesp/mdetect.py | UAgentInfo.initDeviceScan | def initDeviceScan(self):
"""Initialize Key Stored Values."""
self.__isIphone = self.detectIphoneOrIpod()
self.__isAndroidPhone = self.detectAndroidPhone()
self.__isTierTablet = self.detectTierTablet()
self.__isTierIphone = self.detectTierIphone()
self.__isTierRichCss = s... | python | def initDeviceScan(self):
"""Initialize Key Stored Values."""
self.__isIphone = self.detectIphoneOrIpod()
self.__isAndroidPhone = self.detectAndroidPhone()
self.__isTierTablet = self.detectTierTablet()
self.__isTierIphone = self.detectTierIphone()
self.__isTierRichCss = s... | [
"def",
"initDeviceScan",
"(",
"self",
")",
":",
"self",
".",
"__isIphone",
"=",
"self",
".",
"detectIphoneOrIpod",
"(",
")",
"self",
".",
"__isAndroidPhone",
"=",
"self",
".",
"detectAndroidPhone",
"(",
")",
"self",
".",
"__isTierTablet",
"=",
"self",
".",
... | Initialize Key Stored Values. | [
"Initialize",
"Key",
"Stored",
"Values",
"."
] | train | https://github.com/laginha/django-mobileesp/blob/91d4babb2343b992970bdb076508d380680c8b7e/src/django_mobileesp/mdetect.py#L259-L266 |
laginha/django-mobileesp | src/django_mobileesp/mdetect.py | UAgentInfo.detectIphone | def detectIphone(self):
"""Return detection of an iPhone
Detects if the current device is an iPhone.
"""
# The iPad and iPod touch say they're an iPhone! So let's disambiguate.
return UAgentInfo.deviceIphone in self.__userAgent \
and not self.detectIpad() \
... | python | def detectIphone(self):
"""Return detection of an iPhone
Detects if the current device is an iPhone.
"""
# The iPad and iPod touch say they're an iPhone! So let's disambiguate.
return UAgentInfo.deviceIphone in self.__userAgent \
and not self.detectIpad() \
... | [
"def",
"detectIphone",
"(",
"self",
")",
":",
"# The iPad and iPod touch say they're an iPhone! So let's disambiguate.",
"return",
"UAgentInfo",
".",
"deviceIphone",
"in",
"self",
".",
"__userAgent",
"and",
"not",
"self",
".",
"detectIpad",
"(",
")",
"and",
"not",
"se... | Return detection of an iPhone
Detects if the current device is an iPhone. | [
"Return",
"detection",
"of",
"an",
"iPhone"
] | train | https://github.com/laginha/django-mobileesp/blob/91d4babb2343b992970bdb076508d380680c8b7e/src/django_mobileesp/mdetect.py#L268-L276 |
laginha/django-mobileesp | src/django_mobileesp/mdetect.py | UAgentInfo.detectIphoneOrIpod | def detectIphoneOrIpod(self):
"""Return detection of an iPhone or iPod Touch
Detects if the current device is an iPhone or iPod Touch.
"""
#We repeat the searches here because some iPods may report themselves as an iPhone, which would be okay.
return UAgentInfo.deviceIphone in s... | python | def detectIphoneOrIpod(self):
"""Return detection of an iPhone or iPod Touch
Detects if the current device is an iPhone or iPod Touch.
"""
#We repeat the searches here because some iPods may report themselves as an iPhone, which would be okay.
return UAgentInfo.deviceIphone in s... | [
"def",
"detectIphoneOrIpod",
"(",
"self",
")",
":",
"#We repeat the searches here because some iPods may report themselves as an iPhone, which would be okay.",
"return",
"UAgentInfo",
".",
"deviceIphone",
"in",
"self",
".",
"__userAgent",
"or",
"UAgentInfo",
".",
"deviceIpod",
... | Return detection of an iPhone or iPod Touch
Detects if the current device is an iPhone or iPod Touch. | [
"Return",
"detection",
"of",
"an",
"iPhone",
"or",
"iPod",
"Touch"
] | train | https://github.com/laginha/django-mobileesp/blob/91d4babb2343b992970bdb076508d380680c8b7e/src/django_mobileesp/mdetect.py#L293-L300 |
laginha/django-mobileesp | src/django_mobileesp/mdetect.py | UAgentInfo.detectAndroid | def detectAndroid(self):
"""Return detection of an Android device
Detects *any* Android OS-based device: phone, tablet, and multi-media player.
Also detects Google TV.
"""
if UAgentInfo.deviceAndroid in self.__userAgent \
or self.detectGoogleTV():
return T... | python | def detectAndroid(self):
"""Return detection of an Android device
Detects *any* Android OS-based device: phone, tablet, and multi-media player.
Also detects Google TV.
"""
if UAgentInfo.deviceAndroid in self.__userAgent \
or self.detectGoogleTV():
return T... | [
"def",
"detectAndroid",
"(",
"self",
")",
":",
"if",
"UAgentInfo",
".",
"deviceAndroid",
"in",
"self",
".",
"__userAgent",
"or",
"self",
".",
"detectGoogleTV",
"(",
")",
":",
"return",
"True",
"return",
"False"
] | Return detection of an Android device
Detects *any* Android OS-based device: phone, tablet, and multi-media player.
Also detects Google TV. | [
"Return",
"detection",
"of",
"an",
"Android",
"device"
] | train | https://github.com/laginha/django-mobileesp/blob/91d4babb2343b992970bdb076508d380680c8b7e/src/django_mobileesp/mdetect.py#L310-L320 |
laginha/django-mobileesp | src/django_mobileesp/mdetect.py | UAgentInfo.detectAndroidPhone | def detectAndroidPhone(self):
"""Return detection of an Android phone
Detects if the current device is a (small-ish) Android OS-based device
used for calling and/or multi-media (like a Samsung Galaxy Player).
Google says these devices will have 'Android' AND 'mobile' in user agent.
... | python | def detectAndroidPhone(self):
"""Return detection of an Android phone
Detects if the current device is a (small-ish) Android OS-based device
used for calling and/or multi-media (like a Samsung Galaxy Player).
Google says these devices will have 'Android' AND 'mobile' in user agent.
... | [
"def",
"detectAndroidPhone",
"(",
"self",
")",
":",
"#First, let's make sure we're on an Android device.",
"if",
"not",
"self",
".",
"detectAndroid",
"(",
")",
":",
"return",
"False",
"#If it's Android and has 'mobile' in it, Google says it's a phone.",
"if",
"UAgentInfo",
".... | Return detection of an Android phone
Detects if the current device is a (small-ish) Android OS-based device
used for calling and/or multi-media (like a Samsung Galaxy Player).
Google says these devices will have 'Android' AND 'mobile' in user agent.
Ignores tablets (Honeycomb and later... | [
"Return",
"detection",
"of",
"an",
"Android",
"phone"
] | train | https://github.com/laginha/django-mobileesp/blob/91d4babb2343b992970bdb076508d380680c8b7e/src/django_mobileesp/mdetect.py#L322-L342 |
laginha/django-mobileesp | src/django_mobileesp/mdetect.py | UAgentInfo.detectAndroidTablet | def detectAndroidTablet(self):
"""Return detection of an Android tablet
Detects if the current device is a (self-reported) Android tablet.
Google says these devices will have 'Android' and NOT 'mobile' in their user agent.
"""
#First, let's make sure we're on an Android device.
... | python | def detectAndroidTablet(self):
"""Return detection of an Android tablet
Detects if the current device is a (self-reported) Android tablet.
Google says these devices will have 'Android' and NOT 'mobile' in their user agent.
"""
#First, let's make sure we're on an Android device.
... | [
"def",
"detectAndroidTablet",
"(",
"self",
")",
":",
"#First, let's make sure we're on an Android device.",
"if",
"not",
"self",
".",
"detectAndroid",
"(",
")",
":",
"return",
"False",
"#Special check for Android devices with Opera Mobile/Mini. They should NOT report here.",
"if"... | Return detection of an Android tablet
Detects if the current device is a (self-reported) Android tablet.
Google says these devices will have 'Android' and NOT 'mobile' in their user agent. | [
"Return",
"detection",
"of",
"an",
"Android",
"tablet"
] | train | https://github.com/laginha/django-mobileesp/blob/91d4babb2343b992970bdb076508d380680c8b7e/src/django_mobileesp/mdetect.py#L344-L359 |
laginha/django-mobileesp | src/django_mobileesp/mdetect.py | UAgentInfo.detectS60OssBrowser | def detectS60OssBrowser(self):
"""Return detection of Symbian S60 Browser
Detects if the current browser is the Symbian S60 Open Source Browser.
"""
#First, test for WebKit, then make sure it's either Symbian or S60.
return self.detectWebkit() \
and (UAgentInfo.devic... | python | def detectS60OssBrowser(self):
"""Return detection of Symbian S60 Browser
Detects if the current browser is the Symbian S60 Open Source Browser.
"""
#First, test for WebKit, then make sure it's either Symbian or S60.
return self.detectWebkit() \
and (UAgentInfo.devic... | [
"def",
"detectS60OssBrowser",
"(",
"self",
")",
":",
"#First, test for WebKit, then make sure it's either Symbian or S60.",
"return",
"self",
".",
"detectWebkit",
"(",
")",
"and",
"(",
"UAgentInfo",
".",
"deviceSymbian",
"in",
"self",
".",
"__userAgent",
"or",
"UAgentIn... | Return detection of Symbian S60 Browser
Detects if the current browser is the Symbian S60 Open Source Browser. | [
"Return",
"detection",
"of",
"Symbian",
"S60",
"Browser"
] | train | https://github.com/laginha/django-mobileesp/blob/91d4babb2343b992970bdb076508d380680c8b7e/src/django_mobileesp/mdetect.py#L384-L392 |
laginha/django-mobileesp | src/django_mobileesp/mdetect.py | UAgentInfo.detectSymbianOS | def detectSymbianOS(self):
"""Return detection of SymbianOS
Detects if the current device is any Symbian OS-based device,
including older S60, Series 70, Series 80, Series 90, and UIQ,
or other browsers running on these devices.
"""
return UAgentInfo.deviceSymbian in sel... | python | def detectSymbianOS(self):
"""Return detection of SymbianOS
Detects if the current device is any Symbian OS-based device,
including older S60, Series 70, Series 80, Series 90, and UIQ,
or other browsers running on these devices.
"""
return UAgentInfo.deviceSymbian in sel... | [
"def",
"detectSymbianOS",
"(",
"self",
")",
":",
"return",
"UAgentInfo",
".",
"deviceSymbian",
"in",
"self",
".",
"__userAgent",
"or",
"UAgentInfo",
".",
"deviceS60",
"in",
"self",
".",
"__userAgent",
"or",
"UAgentInfo",
".",
"deviceS70",
"in",
"self",
".",
... | Return detection of SymbianOS
Detects if the current device is any Symbian OS-based device,
including older S60, Series 70, Series 80, Series 90, and UIQ,
or other browsers running on these devices. | [
"Return",
"detection",
"of",
"SymbianOS"
] | train | https://github.com/laginha/django-mobileesp/blob/91d4babb2343b992970bdb076508d380680c8b7e/src/django_mobileesp/mdetect.py#L394-L405 |
laginha/django-mobileesp | src/django_mobileesp/mdetect.py | UAgentInfo.detectWindowsMobile | def detectWindowsMobile(self):
"""Return detection of Windows Mobile
Detects if the current browser is a Windows Mobile device.
Excludes Windows Phone 7 devices.
Focuses on Windows Mobile 6.xx and earlier.
"""
#Exclude new Windows Phone.
if self.detectWindowsPhon... | python | def detectWindowsMobile(self):
"""Return detection of Windows Mobile
Detects if the current browser is a Windows Mobile device.
Excludes Windows Phone 7 devices.
Focuses on Windows Mobile 6.xx and earlier.
"""
#Exclude new Windows Phone.
if self.detectWindowsPhon... | [
"def",
"detectWindowsMobile",
"(",
"self",
")",
":",
"#Exclude new Windows Phone.",
"if",
"self",
".",
"detectWindowsPhone",
"(",
")",
":",
"return",
"False",
"#Most devices use 'Windows CE', but some report 'iemobile'",
"# and some older ones report as 'PIE' for Pocket IE.",
"#... | Return detection of Windows Mobile
Detects if the current browser is a Windows Mobile device.
Excludes Windows Phone 7 devices.
Focuses on Windows Mobile 6.xx and earlier. | [
"Return",
"detection",
"of",
"Windows",
"Mobile"
] | train | https://github.com/laginha/django-mobileesp/blob/91d4babb2343b992970bdb076508d380680c8b7e/src/django_mobileesp/mdetect.py#L441-L468 |
laginha/django-mobileesp | src/django_mobileesp/mdetect.py | UAgentInfo.detectBlackBerry | def detectBlackBerry(self):
"""Return detection of Blackberry
Detects if the current browser is any BlackBerry.
Includes the PlayBook.
"""
return UAgentInfo.deviceBB in self.__userAgent \
or UAgentInfo.vndRIM in self.__httpAccept | python | def detectBlackBerry(self):
"""Return detection of Blackberry
Detects if the current browser is any BlackBerry.
Includes the PlayBook.
"""
return UAgentInfo.deviceBB in self.__userAgent \
or UAgentInfo.vndRIM in self.__httpAccept | [
"def",
"detectBlackBerry",
"(",
"self",
")",
":",
"return",
"UAgentInfo",
".",
"deviceBB",
"in",
"self",
".",
"__userAgent",
"or",
"UAgentInfo",
".",
"vndRIM",
"in",
"self",
".",
"__httpAccept"
] | Return detection of Blackberry
Detects if the current browser is any BlackBerry.
Includes the PlayBook. | [
"Return",
"detection",
"of",
"Blackberry"
] | train | https://github.com/laginha/django-mobileesp/blob/91d4babb2343b992970bdb076508d380680c8b7e/src/django_mobileesp/mdetect.py#L470-L477 |
laginha/django-mobileesp | src/django_mobileesp/mdetect.py | UAgentInfo.detectBlackBerry10Phone | def detectBlackBerry10Phone(self):
"""Return detection of a Blackberry 10 OS phone
Detects if the current browser is a BlackBerry 10 OS phone.
Excludes the PlayBook.
"""
return UAgentInfo.deviceBB10 in self.__userAgent \
and UAgentInfo.mobile in self.__userAgent | python | def detectBlackBerry10Phone(self):
"""Return detection of a Blackberry 10 OS phone
Detects if the current browser is a BlackBerry 10 OS phone.
Excludes the PlayBook.
"""
return UAgentInfo.deviceBB10 in self.__userAgent \
and UAgentInfo.mobile in self.__userAgent | [
"def",
"detectBlackBerry10Phone",
"(",
"self",
")",
":",
"return",
"UAgentInfo",
".",
"deviceBB10",
"in",
"self",
".",
"__userAgent",
"and",
"UAgentInfo",
".",
"mobile",
"in",
"self",
".",
"__userAgent"
] | Return detection of a Blackberry 10 OS phone
Detects if the current browser is a BlackBerry 10 OS phone.
Excludes the PlayBook. | [
"Return",
"detection",
"of",
"a",
"Blackberry",
"10",
"OS",
"phone"
] | train | https://github.com/laginha/django-mobileesp/blob/91d4babb2343b992970bdb076508d380680c8b7e/src/django_mobileesp/mdetect.py#L479-L486 |
laginha/django-mobileesp | src/django_mobileesp/mdetect.py | UAgentInfo.detectBlackBerryTouch | def detectBlackBerryTouch(self):
"""Return detection of a Blackberry touchscreen device
Detects if the current browser is a BlackBerry Touch
device, such as the Storm, Torch, and Bold Touch. Excludes the Playbook.
"""
return UAgentInfo.deviceBBStorm in self.__userAgent \
... | python | def detectBlackBerryTouch(self):
"""Return detection of a Blackberry touchscreen device
Detects if the current browser is a BlackBerry Touch
device, such as the Storm, Torch, and Bold Touch. Excludes the Playbook.
"""
return UAgentInfo.deviceBBStorm in self.__userAgent \
... | [
"def",
"detectBlackBerryTouch",
"(",
"self",
")",
":",
"return",
"UAgentInfo",
".",
"deviceBBStorm",
"in",
"self",
".",
"__userAgent",
"or",
"UAgentInfo",
".",
"deviceBBTorch",
"in",
"self",
".",
"__userAgent",
"or",
"UAgentInfo",
".",
"deviceBBBoldTouch",
"in",
... | Return detection of a Blackberry touchscreen device
Detects if the current browser is a BlackBerry Touch
device, such as the Storm, Torch, and Bold Touch. Excludes the Playbook. | [
"Return",
"detection",
"of",
"a",
"Blackberry",
"touchscreen",
"device"
] | train | https://github.com/laginha/django-mobileesp/blob/91d4babb2343b992970bdb076508d380680c8b7e/src/django_mobileesp/mdetect.py#L507-L516 |
laginha/django-mobileesp | src/django_mobileesp/mdetect.py | UAgentInfo.detectBlackBerryHigh | def detectBlackBerryHigh(self):
"""Return detection of a Blackberry device with a better browser
Detects if the current browser is a BlackBerry device AND
has a more capable recent browser. Excludes the Playbook.
Examples, Storm, Bold, Tour, Curve2
Excludes the new BlackBerry OS... | python | def detectBlackBerryHigh(self):
"""Return detection of a Blackberry device with a better browser
Detects if the current browser is a BlackBerry device AND
has a more capable recent browser. Excludes the Playbook.
Examples, Storm, Bold, Tour, Curve2
Excludes the new BlackBerry OS... | [
"def",
"detectBlackBerryHigh",
"(",
"self",
")",
":",
"#Disambiguate for BlackBerry OS 6 or 7 (WebKit) browser",
"if",
"self",
".",
"detectBlackBerryWebKit",
"(",
")",
":",
"return",
"False",
"if",
"not",
"self",
".",
"detectBlackBerry",
"(",
")",
":",
"return",
"Fa... | Return detection of a Blackberry device with a better browser
Detects if the current browser is a BlackBerry device AND
has a more capable recent browser. Excludes the Playbook.
Examples, Storm, Bold, Tour, Curve2
Excludes the new BlackBerry OS 6 and 7 browser!! | [
"Return",
"detection",
"of",
"a",
"Blackberry",
"device",
"with",
"a",
"better",
"browser"
] | train | https://github.com/laginha/django-mobileesp/blob/91d4babb2343b992970bdb076508d380680c8b7e/src/django_mobileesp/mdetect.py#L518-L535 |
laginha/django-mobileesp | src/django_mobileesp/mdetect.py | UAgentInfo.detectPalmOS | def detectPalmOS(self):
"""Return detection of a PalmOS device
Detects if the current browser is on a PalmOS device.
"""
#Most devices nowadays report as 'Palm', but some older ones reported as Blazer or Xiino.
if UAgentInfo.devicePalm in self.__userAgent \
or UAgentI... | python | def detectPalmOS(self):
"""Return detection of a PalmOS device
Detects if the current browser is on a PalmOS device.
"""
#Most devices nowadays report as 'Palm', but some older ones reported as Blazer or Xiino.
if UAgentInfo.devicePalm in self.__userAgent \
or UAgentI... | [
"def",
"detectPalmOS",
"(",
"self",
")",
":",
"#Most devices nowadays report as 'Palm', but some older ones reported as Blazer or Xiino.",
"if",
"UAgentInfo",
".",
"devicePalm",
"in",
"self",
".",
"__userAgent",
"or",
"UAgentInfo",
".",
"engineBlazer",
"in",
"self",
".",
... | Return detection of a PalmOS device
Detects if the current browser is on a PalmOS device. | [
"Return",
"detection",
"of",
"a",
"PalmOS",
"device"
] | train | https://github.com/laginha/django-mobileesp/blob/91d4babb2343b992970bdb076508d380680c8b7e/src/django_mobileesp/mdetect.py#L551-L562 |
laginha/django-mobileesp | src/django_mobileesp/mdetect.py | UAgentInfo.detectWebOSTablet | def detectWebOSTablet(self):
"""Return detection of an HP WebOS tablet
Detects if the current browser is on an HP tablet running WebOS.
"""
return UAgentInfo.deviceWebOShp in self.__userAgent \
and UAgentInfo.deviceTablet in self.__userAgent | python | def detectWebOSTablet(self):
"""Return detection of an HP WebOS tablet
Detects if the current browser is on an HP tablet running WebOS.
"""
return UAgentInfo.deviceWebOShp in self.__userAgent \
and UAgentInfo.deviceTablet in self.__userAgent | [
"def",
"detectWebOSTablet",
"(",
"self",
")",
":",
"return",
"UAgentInfo",
".",
"deviceWebOShp",
"in",
"self",
".",
"__userAgent",
"and",
"UAgentInfo",
".",
"deviceTablet",
"in",
"self",
".",
"__userAgent"
] | Return detection of an HP WebOS tablet
Detects if the current browser is on an HP tablet running WebOS. | [
"Return",
"detection",
"of",
"an",
"HP",
"WebOS",
"tablet"
] | train | https://github.com/laginha/django-mobileesp/blob/91d4babb2343b992970bdb076508d380680c8b7e/src/django_mobileesp/mdetect.py#L572-L578 |
laginha/django-mobileesp | src/django_mobileesp/mdetect.py | UAgentInfo.detectWebOSTV | def detectWebOSTV(self):
"""Return detection of a WebOS smart TV
Detects if the current browser is on a WebOS smart TV.
"""
return UAgentInfo.deviceWebOStv in self.__userAgent \
and UAgentInfo.smartTV2 in self.__userAgent | python | def detectWebOSTV(self):
"""Return detection of a WebOS smart TV
Detects if the current browser is on a WebOS smart TV.
"""
return UAgentInfo.deviceWebOStv in self.__userAgent \
and UAgentInfo.smartTV2 in self.__userAgent | [
"def",
"detectWebOSTV",
"(",
"self",
")",
":",
"return",
"UAgentInfo",
".",
"deviceWebOStv",
"in",
"self",
".",
"__userAgent",
"and",
"UAgentInfo",
".",
"smartTV2",
"in",
"self",
".",
"__userAgent"
] | Return detection of a WebOS smart TV
Detects if the current browser is on a WebOS smart TV. | [
"Return",
"detection",
"of",
"a",
"WebOS",
"smart",
"TV"
] | train | https://github.com/laginha/django-mobileesp/blob/91d4babb2343b992970bdb076508d380680c8b7e/src/django_mobileesp/mdetect.py#L580-L586 |
laginha/django-mobileesp | src/django_mobileesp/mdetect.py | UAgentInfo.detectTizen | def detectTizen(self):
"""Return detection of a Tizen device
Detects a device running the Tizen smartphone OS.
"""
return UAgentInfo.deviceTizen in self.__userAgent \
and UAgentInfo.mobile in self.__userAgent | python | def detectTizen(self):
"""Return detection of a Tizen device
Detects a device running the Tizen smartphone OS.
"""
return UAgentInfo.deviceTizen in self.__userAgent \
and UAgentInfo.mobile in self.__userAgent | [
"def",
"detectTizen",
"(",
"self",
")",
":",
"return",
"UAgentInfo",
".",
"deviceTizen",
"in",
"self",
".",
"__userAgent",
"and",
"UAgentInfo",
".",
"mobile",
"in",
"self",
".",
"__userAgent"
] | Return detection of a Tizen device
Detects a device running the Tizen smartphone OS. | [
"Return",
"detection",
"of",
"a",
"Tizen",
"device"
] | train | https://github.com/laginha/django-mobileesp/blob/91d4babb2343b992970bdb076508d380680c8b7e/src/django_mobileesp/mdetect.py#L603-L609 |
laginha/django-mobileesp | src/django_mobileesp/mdetect.py | UAgentInfo.detectTizenTV | def detectTizenTV(self):
"""Return detection of a Tizen smart TV
Detects if the current browser is on a Tizen smart TV.
"""
return UAgentInfo.deviceTizen in self.__userAgent \
and UAgentInfo.smartTV1 in self.__userAgent | python | def detectTizenTV(self):
"""Return detection of a Tizen smart TV
Detects if the current browser is on a Tizen smart TV.
"""
return UAgentInfo.deviceTizen in self.__userAgent \
and UAgentInfo.smartTV1 in self.__userAgent | [
"def",
"detectTizenTV",
"(",
"self",
")",
":",
"return",
"UAgentInfo",
".",
"deviceTizen",
"in",
"self",
".",
"__userAgent",
"and",
"UAgentInfo",
".",
"smartTV1",
"in",
"self",
".",
"__userAgent"
] | Return detection of a Tizen smart TV
Detects if the current browser is on a Tizen smart TV. | [
"Return",
"detection",
"of",
"a",
"Tizen",
"smart",
"TV"
] | train | https://github.com/laginha/django-mobileesp/blob/91d4babb2343b992970bdb076508d380680c8b7e/src/django_mobileesp/mdetect.py#L611-L617 |
laginha/django-mobileesp | src/django_mobileesp/mdetect.py | UAgentInfo.detectMeegoPhone | def detectMeegoPhone(self):
"""Return detection of a Meego phone
Detects a phone running the Meego OS.
"""
return UAgentInfo.deviceMeego in self.__userAgent \
and UAgentInfo.mobi in self.__userAgent | python | def detectMeegoPhone(self):
"""Return detection of a Meego phone
Detects a phone running the Meego OS.
"""
return UAgentInfo.deviceMeego in self.__userAgent \
and UAgentInfo.mobi in self.__userAgent | [
"def",
"detectMeegoPhone",
"(",
"self",
")",
":",
"return",
"UAgentInfo",
".",
"deviceMeego",
"in",
"self",
".",
"__userAgent",
"and",
"UAgentInfo",
".",
"mobi",
"in",
"self",
".",
"__userAgent"
] | Return detection of a Meego phone
Detects a phone running the Meego OS. | [
"Return",
"detection",
"of",
"a",
"Meego",
"phone"
] | train | https://github.com/laginha/django-mobileesp/blob/91d4babb2343b992970bdb076508d380680c8b7e/src/django_mobileesp/mdetect.py#L626-L632 |
laginha/django-mobileesp | src/django_mobileesp/mdetect.py | UAgentInfo.detectFirefoxOSPhone | def detectFirefoxOSPhone(self):
"""Return detection of a Firefox OS phone
Detects a phone (probably) running the Firefox OS.
"""
if self.detectIos() \
or self.detectAndroid() \
or self.detectSailfish():
return False
if UAgentInfo.engineFirefo... | python | def detectFirefoxOSPhone(self):
"""Return detection of a Firefox OS phone
Detects a phone (probably) running the Firefox OS.
"""
if self.detectIos() \
or self.detectAndroid() \
or self.detectSailfish():
return False
if UAgentInfo.engineFirefo... | [
"def",
"detectFirefoxOSPhone",
"(",
"self",
")",
":",
"if",
"self",
".",
"detectIos",
"(",
")",
"or",
"self",
".",
"detectAndroid",
"(",
")",
"or",
"self",
".",
"detectSailfish",
"(",
")",
":",
"return",
"False",
"if",
"UAgentInfo",
".",
"engineFirefox",
... | Return detection of a Firefox OS phone
Detects a phone (probably) running the Firefox OS. | [
"Return",
"detection",
"of",
"a",
"Firefox",
"OS",
"phone"
] | train | https://github.com/laginha/django-mobileesp/blob/91d4babb2343b992970bdb076508d380680c8b7e/src/django_mobileesp/mdetect.py#L642-L656 |
laginha/django-mobileesp | src/django_mobileesp/mdetect.py | UAgentInfo.detectFirefoxOSTablet | def detectFirefoxOSTablet(self):
"""Return detection of a Firefox OS tablet
Detects a tablet (probably) running the Firefox OS.
"""
if self.detectIos() \
or self.detectAndroid() \
or self.detectSailfish():
return False
if UAgentInfo.engineFir... | python | def detectFirefoxOSTablet(self):
"""Return detection of a Firefox OS tablet
Detects a tablet (probably) running the Firefox OS.
"""
if self.detectIos() \
or self.detectAndroid() \
or self.detectSailfish():
return False
if UAgentInfo.engineFir... | [
"def",
"detectFirefoxOSTablet",
"(",
"self",
")",
":",
"if",
"self",
".",
"detectIos",
"(",
")",
"or",
"self",
".",
"detectAndroid",
"(",
")",
"or",
"self",
".",
"detectSailfish",
"(",
")",
":",
"return",
"False",
"if",
"UAgentInfo",
".",
"engineFirefox",
... | Return detection of a Firefox OS tablet
Detects a tablet (probably) running the Firefox OS. | [
"Return",
"detection",
"of",
"a",
"Firefox",
"OS",
"tablet"
] | train | https://github.com/laginha/django-mobileesp/blob/91d4babb2343b992970bdb076508d380680c8b7e/src/django_mobileesp/mdetect.py#L658-L672 |
laginha/django-mobileesp | src/django_mobileesp/mdetect.py | UAgentInfo.detectSailfishPhone | def detectSailfishPhone(self):
"""Return detection of a Sailfish phone
Detects a phone running the Sailfish OS.
"""
if self.detectSailfish() \
and UAgentInfo.mobile in self.__userAgent:
return True
return False | python | def detectSailfishPhone(self):
"""Return detection of a Sailfish phone
Detects a phone running the Sailfish OS.
"""
if self.detectSailfish() \
and UAgentInfo.mobile in self.__userAgent:
return True
return False | [
"def",
"detectSailfishPhone",
"(",
"self",
")",
":",
"if",
"self",
".",
"detectSailfish",
"(",
")",
"and",
"UAgentInfo",
".",
"mobile",
"in",
"self",
".",
"__userAgent",
":",
"return",
"True",
"return",
"False"
] | Return detection of a Sailfish phone
Detects a phone running the Sailfish OS. | [
"Return",
"detection",
"of",
"a",
"Sailfish",
"phone"
] | train | https://github.com/laginha/django-mobileesp/blob/91d4babb2343b992970bdb076508d380680c8b7e/src/django_mobileesp/mdetect.py#L681-L690 |
laginha/django-mobileesp | src/django_mobileesp/mdetect.py | UAgentInfo.detectUbuntuPhone | def detectUbuntuPhone(self):
"""Return detection of an Ubuntu Mobile OS phone
Detects a phone running the Ubuntu Mobile OS.
"""
if UAgentInfo.deviceUbuntu in self.__userAgent \
and UAgentInfo.mobile in self.__userAgent:
return True
return False | python | def detectUbuntuPhone(self):
"""Return detection of an Ubuntu Mobile OS phone
Detects a phone running the Ubuntu Mobile OS.
"""
if UAgentInfo.deviceUbuntu in self.__userAgent \
and UAgentInfo.mobile in self.__userAgent:
return True
return False | [
"def",
"detectUbuntuPhone",
"(",
"self",
")",
":",
"if",
"UAgentInfo",
".",
"deviceUbuntu",
"in",
"self",
".",
"__userAgent",
"and",
"UAgentInfo",
".",
"mobile",
"in",
"self",
".",
"__userAgent",
":",
"return",
"True",
"return",
"False"
] | Return detection of an Ubuntu Mobile OS phone
Detects a phone running the Ubuntu Mobile OS. | [
"Return",
"detection",
"of",
"an",
"Ubuntu",
"Mobile",
"OS",
"phone"
] | train | https://github.com/laginha/django-mobileesp/blob/91d4babb2343b992970bdb076508d380680c8b7e/src/django_mobileesp/mdetect.py#L700-L709 |
laginha/django-mobileesp | src/django_mobileesp/mdetect.py | UAgentInfo.detectUbuntuTablet | def detectUbuntuTablet(self):
"""Return detection of an Ubuntu Mobile OS tablet
Detects a tablet running the Ubuntu Mobile OS.
"""
if UAgentInfo.deviceUbuntu in self.__userAgent \
and UAgentInfo.deviceTablet in self.__userAgent:
return True
return False | python | def detectUbuntuTablet(self):
"""Return detection of an Ubuntu Mobile OS tablet
Detects a tablet running the Ubuntu Mobile OS.
"""
if UAgentInfo.deviceUbuntu in self.__userAgent \
and UAgentInfo.deviceTablet in self.__userAgent:
return True
return False | [
"def",
"detectUbuntuTablet",
"(",
"self",
")",
":",
"if",
"UAgentInfo",
".",
"deviceUbuntu",
"in",
"self",
".",
"__userAgent",
"and",
"UAgentInfo",
".",
"deviceTablet",
"in",
"self",
".",
"__userAgent",
":",
"return",
"True",
"return",
"False"
] | Return detection of an Ubuntu Mobile OS tablet
Detects a tablet running the Ubuntu Mobile OS. | [
"Return",
"detection",
"of",
"an",
"Ubuntu",
"Mobile",
"OS",
"tablet"
] | train | https://github.com/laginha/django-mobileesp/blob/91d4babb2343b992970bdb076508d380680c8b7e/src/django_mobileesp/mdetect.py#L711-L720 |
laginha/django-mobileesp | src/django_mobileesp/mdetect.py | UAgentInfo.detectDangerHiptop | def detectDangerHiptop(self):
"""Return detection of a Danger Hiptop
Detects the Danger Hiptop device.
"""
return UAgentInfo.deviceDanger in self.__userAgent \
or UAgentInfo.deviceHiptop in self.__userAgent | python | def detectDangerHiptop(self):
"""Return detection of a Danger Hiptop
Detects the Danger Hiptop device.
"""
return UAgentInfo.deviceDanger in self.__userAgent \
or UAgentInfo.deviceHiptop in self.__userAgent | [
"def",
"detectDangerHiptop",
"(",
"self",
")",
":",
"return",
"UAgentInfo",
".",
"deviceDanger",
"in",
"self",
".",
"__userAgent",
"or",
"UAgentInfo",
".",
"deviceHiptop",
"in",
"self",
".",
"__userAgent"
] | Return detection of a Danger Hiptop
Detects the Danger Hiptop device. | [
"Return",
"detection",
"of",
"a",
"Danger",
"Hiptop"
] | train | https://github.com/laginha/django-mobileesp/blob/91d4babb2343b992970bdb076508d380680c8b7e/src/django_mobileesp/mdetect.py#L729-L735 |
laginha/django-mobileesp | src/django_mobileesp/mdetect.py | UAgentInfo.detectOperaMobile | def detectOperaMobile(self):
"""Return detection of an Opera browser for a mobile device
Detects Opera Mobile or Opera Mini.
"""
return UAgentInfo.engineOpera in self.__userAgent \
and (UAgentInfo.mini in self.__userAgent
or UAgentInfo.mobi in self.__userAgen... | python | def detectOperaMobile(self):
"""Return detection of an Opera browser for a mobile device
Detects Opera Mobile or Opera Mini.
"""
return UAgentInfo.engineOpera in self.__userAgent \
and (UAgentInfo.mini in self.__userAgent
or UAgentInfo.mobi in self.__userAgen... | [
"def",
"detectOperaMobile",
"(",
"self",
")",
":",
"return",
"UAgentInfo",
".",
"engineOpera",
"in",
"self",
".",
"__userAgent",
"and",
"(",
"UAgentInfo",
".",
"mini",
"in",
"self",
".",
"__userAgent",
"or",
"UAgentInfo",
".",
"mobi",
"in",
"self",
".",
"_... | Return detection of an Opera browser for a mobile device
Detects Opera Mobile or Opera Mini. | [
"Return",
"detection",
"of",
"an",
"Opera",
"browser",
"for",
"a",
"mobile",
"device"
] | train | https://github.com/laginha/django-mobileesp/blob/91d4babb2343b992970bdb076508d380680c8b7e/src/django_mobileesp/mdetect.py#L737-L744 |
laginha/django-mobileesp | src/django_mobileesp/mdetect.py | UAgentInfo.detectWapWml | def detectWapWml(self):
"""Return detection of a WAP- or WML-capable device
Detects whether the device supports WAP or WML.
"""
return UAgentInfo.vndwap in self.__httpAccept \
or UAgentInfo.wml in self.__httpAccept | python | def detectWapWml(self):
"""Return detection of a WAP- or WML-capable device
Detects whether the device supports WAP or WML.
"""
return UAgentInfo.vndwap in self.__httpAccept \
or UAgentInfo.wml in self.__httpAccept | [
"def",
"detectWapWml",
"(",
"self",
")",
":",
"return",
"UAgentInfo",
".",
"vndwap",
"in",
"self",
".",
"__httpAccept",
"or",
"UAgentInfo",
".",
"wml",
"in",
"self",
".",
"__httpAccept"
] | Return detection of a WAP- or WML-capable device
Detects whether the device supports WAP or WML. | [
"Return",
"detection",
"of",
"a",
"WAP",
"-",
"or",
"WML",
"-",
"capable",
"device"
] | train | https://github.com/laginha/django-mobileesp/blob/91d4babb2343b992970bdb076508d380680c8b7e/src/django_mobileesp/mdetect.py#L746-L752 |
laginha/django-mobileesp | src/django_mobileesp/mdetect.py | UAgentInfo.detectGamingHandheld | def detectGamingHandheld(self):
"""Return detection of a gaming handheld with a modern iPhone-class browser
Detects if the current device is a handheld gaming device with
a touchscreen and modern iPhone-class browser. Includes the Playstation Vita.
"""
return UAgentInfo.devicePl... | python | def detectGamingHandheld(self):
"""Return detection of a gaming handheld with a modern iPhone-class browser
Detects if the current device is a handheld gaming device with
a touchscreen and modern iPhone-class browser. Includes the Playstation Vita.
"""
return UAgentInfo.devicePl... | [
"def",
"detectGamingHandheld",
"(",
"self",
")",
":",
"return",
"UAgentInfo",
".",
"devicePlaystation",
"in",
"self",
".",
"__userAgent",
"and",
"UAgentInfo",
".",
"devicePlaystationVita",
"in",
"self",
".",
"__userAgent"
] | Return detection of a gaming handheld with a modern iPhone-class browser
Detects if the current device is a handheld gaming device with
a touchscreen and modern iPhone-class browser. Includes the Playstation Vita. | [
"Return",
"detection",
"of",
"a",
"gaming",
"handheld",
"with",
"a",
"modern",
"iPhone",
"-",
"class",
"browser"
] | train | https://github.com/laginha/django-mobileesp/blob/91d4babb2343b992970bdb076508d380680c8b7e/src/django_mobileesp/mdetect.py#L778-L785 |
laginha/django-mobileesp | src/django_mobileesp/mdetect.py | UAgentInfo.detectNintendo | def detectNintendo(self):
"""Return detection of Nintendo
Detects if the current device is a Nintendo game device.
"""
return UAgentInfo.deviceNintendo in self.__userAgent \
or UAgentInfo.deviceNintendo in self.__userAgent \
or UAgentInfo.deviceNintendo in self._... | python | def detectNintendo(self):
"""Return detection of Nintendo
Detects if the current device is a Nintendo game device.
"""
return UAgentInfo.deviceNintendo in self.__userAgent \
or UAgentInfo.deviceNintendo in self.__userAgent \
or UAgentInfo.deviceNintendo in self._... | [
"def",
"detectNintendo",
"(",
"self",
")",
":",
"return",
"UAgentInfo",
".",
"deviceNintendo",
"in",
"self",
".",
"__userAgent",
"or",
"UAgentInfo",
".",
"deviceNintendo",
"in",
"self",
".",
"__userAgent",
"or",
"UAgentInfo",
".",
"deviceNintendo",
"in",
"self",... | Return detection of Nintendo
Detects if the current device is a Nintendo game device. | [
"Return",
"detection",
"of",
"Nintendo"
] | train | https://github.com/laginha/django-mobileesp/blob/91d4babb2343b992970bdb076508d380680c8b7e/src/django_mobileesp/mdetect.py#L787-L794 |
laginha/django-mobileesp | src/django_mobileesp/mdetect.py | UAgentInfo.detectMidpCapable | def detectMidpCapable(self):
"""Return detection of a MIDP mobile Java-capable device
Detects if the current device supports MIDP, a mobile Java technology.
"""
return UAgentInfo.deviceMidp in self.__userAgent \
or UAgentInfo.deviceMidp in self.__httpAccept | python | def detectMidpCapable(self):
"""Return detection of a MIDP mobile Java-capable device
Detects if the current device supports MIDP, a mobile Java technology.
"""
return UAgentInfo.deviceMidp in self.__userAgent \
or UAgentInfo.deviceMidp in self.__httpAccept | [
"def",
"detectMidpCapable",
"(",
"self",
")",
":",
"return",
"UAgentInfo",
".",
"deviceMidp",
"in",
"self",
".",
"__userAgent",
"or",
"UAgentInfo",
".",
"deviceMidp",
"in",
"self",
".",
"__httpAccept"
] | Return detection of a MIDP mobile Java-capable device
Detects if the current device supports MIDP, a mobile Java technology. | [
"Return",
"detection",
"of",
"a",
"MIDP",
"mobile",
"Java",
"-",
"capable",
"device"
] | train | https://github.com/laginha/django-mobileesp/blob/91d4babb2343b992970bdb076508d380680c8b7e/src/django_mobileesp/mdetect.py#L812-L818 |
laginha/django-mobileesp | src/django_mobileesp/mdetect.py | UAgentInfo.detectMaemoTablet | def detectMaemoTablet(self):
"""Return detection of a Maemo OS tablet
Detects if the current device is on one of the Maemo-based Nokia Internet Tablets.
"""
if UAgentInfo.maemo in self.__userAgent:
return True
return UAgentInfo.linux in self.__userAgent \
... | python | def detectMaemoTablet(self):
"""Return detection of a Maemo OS tablet
Detects if the current device is on one of the Maemo-based Nokia Internet Tablets.
"""
if UAgentInfo.maemo in self.__userAgent:
return True
return UAgentInfo.linux in self.__userAgent \
... | [
"def",
"detectMaemoTablet",
"(",
"self",
")",
":",
"if",
"UAgentInfo",
".",
"maemo",
"in",
"self",
".",
"__userAgent",
":",
"return",
"True",
"return",
"UAgentInfo",
".",
"linux",
"in",
"self",
".",
"__userAgent",
"and",
"UAgentInfo",
".",
"deviceTablet",
"i... | Return detection of a Maemo OS tablet
Detects if the current device is on one of the Maemo-based Nokia Internet Tablets. | [
"Return",
"detection",
"of",
"a",
"Maemo",
"OS",
"tablet"
] | train | https://github.com/laginha/django-mobileesp/blob/91d4babb2343b992970bdb076508d380680c8b7e/src/django_mobileesp/mdetect.py#L820-L831 |
laginha/django-mobileesp | src/django_mobileesp/mdetect.py | UAgentInfo.detectSonyMylo | def detectSonyMylo(self):
"""Return detection of a Sony Mylo device
Detects if the current browser is a Sony Mylo device.
"""
return UAgentInfo.manuSony in self.__userAgent \
and (UAgentInfo.qtembedded in self.__userAgent
or UAgentInfo.mylocom2 in self.__user... | python | def detectSonyMylo(self):
"""Return detection of a Sony Mylo device
Detects if the current browser is a Sony Mylo device.
"""
return UAgentInfo.manuSony in self.__userAgent \
and (UAgentInfo.qtembedded in self.__userAgent
or UAgentInfo.mylocom2 in self.__user... | [
"def",
"detectSonyMylo",
"(",
"self",
")",
":",
"return",
"UAgentInfo",
".",
"manuSony",
"in",
"self",
".",
"__userAgent",
"and",
"(",
"UAgentInfo",
".",
"qtembedded",
"in",
"self",
".",
"__userAgent",
"or",
"UAgentInfo",
".",
"mylocom2",
"in",
"self",
".",
... | Return detection of a Sony Mylo device
Detects if the current browser is a Sony Mylo device. | [
"Return",
"detection",
"of",
"a",
"Sony",
"Mylo",
"device"
] | train | https://github.com/laginha/django-mobileesp/blob/91d4babb2343b992970bdb076508d380680c8b7e/src/django_mobileesp/mdetect.py#L840-L847 |
laginha/django-mobileesp | src/django_mobileesp/mdetect.py | UAgentInfo.detectSmartphone | def detectSmartphone(self):
"""Return detection of a general smartphone device
Checks to see whether the device is *any* 'smartphone'.
Note: It's better to use DetectTierIphone() for modern touchscreen devices.
"""
return self.detectTierIphone() \
or self.detectS60Os... | python | def detectSmartphone(self):
"""Return detection of a general smartphone device
Checks to see whether the device is *any* 'smartphone'.
Note: It's better to use DetectTierIphone() for modern touchscreen devices.
"""
return self.detectTierIphone() \
or self.detectS60Os... | [
"def",
"detectSmartphone",
"(",
"self",
")",
":",
"return",
"self",
".",
"detectTierIphone",
"(",
")",
"or",
"self",
".",
"detectS60OssBrowser",
"(",
")",
"or",
"self",
".",
"detectSymbianOS",
"(",
")",
"or",
"self",
".",
"detectWindowsMobile",
"(",
")",
"... | Return detection of a general smartphone device
Checks to see whether the device is *any* 'smartphone'.
Note: It's better to use DetectTierIphone() for modern touchscreen devices. | [
"Return",
"detection",
"of",
"a",
"general",
"smartphone",
"device"
] | train | https://github.com/laginha/django-mobileesp/blob/91d4babb2343b992970bdb076508d380680c8b7e/src/django_mobileesp/mdetect.py#L852-L864 |
laginha/django-mobileesp | src/django_mobileesp/mdetect.py | UAgentInfo.detectMobileQuick | def detectMobileQuick(self):
"""Return detection of any mobile device using the quicker method
Detects if the current device is a mobile device.
This method catches most of the popular modern devices.
Excludes Apple iPads and other modern tablets.
"""
#Let's exclude tabl... | python | def detectMobileQuick(self):
"""Return detection of any mobile device using the quicker method
Detects if the current device is a mobile device.
This method catches most of the popular modern devices.
Excludes Apple iPads and other modern tablets.
"""
#Let's exclude tabl... | [
"def",
"detectMobileQuick",
"(",
"self",
")",
":",
"#Let's exclude tablets",
"if",
"self",
".",
"__isTierTablet",
":",
"return",
"False",
"#Most mobile browsing is done on smartphones",
"if",
"self",
".",
"detectSmartphone",
"(",
")",
":",
"return",
"True",
"#Catch-al... | Return detection of any mobile device using the quicker method
Detects if the current device is a mobile device.
This method catches most of the popular modern devices.
Excludes Apple iPads and other modern tablets. | [
"Return",
"detection",
"of",
"any",
"mobile",
"device",
"using",
"the",
"quicker",
"method"
] | train | https://github.com/laginha/django-mobileesp/blob/91d4babb2343b992970bdb076508d380680c8b7e/src/django_mobileesp/mdetect.py#L866-L902 |
laginha/django-mobileesp | src/django_mobileesp/mdetect.py | UAgentInfo.detectMobileLong | def detectMobileLong(self):
"""Return detection of any mobile device using the more thorough method
The longer and more thorough way to detect for a mobile device.
Will probably detect most feature phones,
smartphone-class devices, Internet Tablets,
Internet-enabled game console... | python | def detectMobileLong(self):
"""Return detection of any mobile device using the more thorough method
The longer and more thorough way to detect for a mobile device.
Will probably detect most feature phones,
smartphone-class devices, Internet Tablets,
Internet-enabled game console... | [
"def",
"detectMobileLong",
"(",
"self",
")",
":",
"if",
"self",
".",
"detectMobileQuick",
"(",
")",
"or",
"self",
".",
"detectGameConsole",
"(",
")",
":",
"return",
"True",
"if",
"self",
".",
"detectDangerHiptop",
"(",
")",
"or",
"self",
".",
"detectMaemoT... | Return detection of any mobile device using the more thorough method
The longer and more thorough way to detect for a mobile device.
Will probably detect most feature phones,
smartphone-class devices, Internet Tablets,
Internet-enabled game consoles, etc.
This ought to catch a l... | [
"Return",
"detection",
"of",
"any",
"mobile",
"device",
"using",
"the",
"more",
"thorough",
"method"
] | train | https://github.com/laginha/django-mobileesp/blob/91d4babb2343b992970bdb076508d380680c8b7e/src/django_mobileesp/mdetect.py#L904-L937 |
laginha/django-mobileesp | src/django_mobileesp/mdetect.py | UAgentInfo.detectTierTablet | def detectTierTablet(self):
"""Return detection of any device in the Tablet Tier
The quick way to detect for a tier of devices.
This method detects for the new generation of
HTML 5 capable, larger screen tablets.
Includes iPad, Android (e.g., Xoom), BB Playbook, WebOS, etc.
... | python | def detectTierTablet(self):
"""Return detection of any device in the Tablet Tier
The quick way to detect for a tier of devices.
This method detects for the new generation of
HTML 5 capable, larger screen tablets.
Includes iPad, Android (e.g., Xoom), BB Playbook, WebOS, etc.
... | [
"def",
"detectTierTablet",
"(",
"self",
")",
":",
"return",
"self",
".",
"detectIpad",
"(",
")",
"or",
"self",
".",
"detectAndroidTablet",
"(",
")",
"or",
"self",
".",
"detectBlackBerryTablet",
"(",
")",
"or",
"self",
".",
"detectFirefoxOSTablet",
"(",
")",
... | Return detection of any device in the Tablet Tier
The quick way to detect for a tier of devices.
This method detects for the new generation of
HTML 5 capable, larger screen tablets.
Includes iPad, Android (e.g., Xoom), BB Playbook, WebOS, etc. | [
"Return",
"detection",
"of",
"any",
"device",
"in",
"the",
"Tablet",
"Tier"
] | train | https://github.com/laginha/django-mobileesp/blob/91d4babb2343b992970bdb076508d380680c8b7e/src/django_mobileesp/mdetect.py#L942-L955 |
laginha/django-mobileesp | src/django_mobileesp/mdetect.py | UAgentInfo.detectTierIphone | def detectTierIphone(self):
"""Return detection of any device in the iPhone/Android/WP7/WebOS Tier
The quick way to detect for a tier of devices.
This method detects for devices which can
display iPhone-optimized web content.
Includes iPhone, iPod Touch, Android, Windows Phone 7... | python | def detectTierIphone(self):
"""Return detection of any device in the iPhone/Android/WP7/WebOS Tier
The quick way to detect for a tier of devices.
This method detects for devices which can
display iPhone-optimized web content.
Includes iPhone, iPod Touch, Android, Windows Phone 7... | [
"def",
"detectTierIphone",
"(",
"self",
")",
":",
"return",
"self",
".",
"__isIphone",
"or",
"self",
".",
"__isAndroidPhone",
"or",
"self",
".",
"detectWindowsPhone",
"(",
")",
"or",
"self",
".",
"detectBlackBerry10Phone",
"(",
")",
"or",
"self",
".",
"detec... | Return detection of any device in the iPhone/Android/WP7/WebOS Tier
The quick way to detect for a tier of devices.
This method detects for devices which can
display iPhone-optimized web content.
Includes iPhone, iPod Touch, Android, Windows Phone 7, Palm WebOS, etc. | [
"Return",
"detection",
"of",
"any",
"device",
"in",
"the",
"iPhone",
"/",
"Android",
"/",
"WP7",
"/",
"WebOS",
"Tier"
] | train | https://github.com/laginha/django-mobileesp/blob/91d4babb2343b992970bdb076508d380680c8b7e/src/django_mobileesp/mdetect.py#L957-L975 |
laginha/django-mobileesp | src/django_mobileesp/mdetect.py | UAgentInfo.detectTierRichCss | def detectTierRichCss(self):
"""Return detection of any device in the 'Rich CSS' Tier
The quick way to detect for a tier of devices.
This method detects for devices which are likely to be capable
of viewing CSS content optimized for the iPhone,
but may not necessarily support Ja... | python | def detectTierRichCss(self):
"""Return detection of any device in the 'Rich CSS' Tier
The quick way to detect for a tier of devices.
This method detects for devices which are likely to be capable
of viewing CSS content optimized for the iPhone,
but may not necessarily support Ja... | [
"def",
"detectTierRichCss",
"(",
"self",
")",
":",
"#The following devices are explicitly ok.",
"#Note: 'High' BlackBerry devices ONLY",
"if",
"not",
"self",
".",
"detectMobileQuick",
"(",
")",
":",
"return",
"False",
"#Exclude iPhone Tier and e-Ink Kindle devices",
"if",
"se... | Return detection of any device in the 'Rich CSS' Tier
The quick way to detect for a tier of devices.
This method detects for devices which are likely to be capable
of viewing CSS content optimized for the iPhone,
but may not necessarily support JavaScript.
Excludes all iPhone Ti... | [
"Return",
"detection",
"of",
"any",
"device",
"in",
"the",
"Rich",
"CSS",
"Tier"
] | train | https://github.com/laginha/django-mobileesp/blob/91d4babb2343b992970bdb076508d380680c8b7e/src/django_mobileesp/mdetect.py#L977-L1001 |
rodynnz/xccdf | src/xccdf/models/status.py | Status.str_to_date | def str_to_date(self):
"""
Returns the date attribute as a date object.
:returns: Date of the status if it exists.
:rtype: date or NoneType
"""
if hasattr(self, 'date'):
return date(*list(map(int, self.date.split('-'))))
else:
return None | python | def str_to_date(self):
"""
Returns the date attribute as a date object.
:returns: Date of the status if it exists.
:rtype: date or NoneType
"""
if hasattr(self, 'date'):
return date(*list(map(int, self.date.split('-'))))
else:
return None | [
"def",
"str_to_date",
"(",
"self",
")",
":",
"if",
"hasattr",
"(",
"self",
",",
"'date'",
")",
":",
"return",
"date",
"(",
"*",
"list",
"(",
"map",
"(",
"int",
",",
"self",
".",
"date",
".",
"split",
"(",
"'-'",
")",
")",
")",
")",
"else",
":",... | Returns the date attribute as a date object.
:returns: Date of the status if it exists.
:rtype: date or NoneType | [
"Returns",
"the",
"date",
"attribute",
"as",
"a",
"date",
"object",
"."
] | train | https://github.com/rodynnz/xccdf/blob/1b9dc2f06b5cce8db2a54c5f95a8f6bcf5cb6981/src/xccdf/models/status.py#L69-L80 |
rodynnz/xccdf | src/xccdf/models/status.py | Status.update_xml_element | def update_xml_element(self):
"""
Updates the xml element contents to matches the instance contents.
:returns: Updated XML element.
:rtype: lxml.etree._Element
"""
if not hasattr(self, 'xml_element'):
self.xml_element = etree.Element(self.name, nsmap=NSMAP)
... | python | def update_xml_element(self):
"""
Updates the xml element contents to matches the instance contents.
:returns: Updated XML element.
:rtype: lxml.etree._Element
"""
if not hasattr(self, 'xml_element'):
self.xml_element = etree.Element(self.name, nsmap=NSMAP)
... | [
"def",
"update_xml_element",
"(",
"self",
")",
":",
"if",
"not",
"hasattr",
"(",
"self",
",",
"'xml_element'",
")",
":",
"self",
".",
"xml_element",
"=",
"etree",
".",
"Element",
"(",
"self",
".",
"name",
",",
"nsmap",
"=",
"NSMAP",
")",
"if",
"hasattr... | Updates the xml element contents to matches the instance contents.
:returns: Updated XML element.
:rtype: lxml.etree._Element | [
"Updates",
"the",
"xml",
"element",
"contents",
"to",
"matches",
"the",
"instance",
"contents",
"."
] | train | https://github.com/rodynnz/xccdf/blob/1b9dc2f06b5cce8db2a54c5f95a8f6bcf5cb6981/src/xccdf/models/status.py#L82-L97 |
ereOn/azmq | azmq/common.py | cancel_on_closing | def cancel_on_closing(func):
"""
Automatically cancels a function or coroutine when the defining instance
gets closed.
:param func: The function to cancel on closing.
:returns: A decorated function or coroutine.
"""
@wraps(func)
async def wrapper(self, *args, **kwargs):
return a... | python | def cancel_on_closing(func):
"""
Automatically cancels a function or coroutine when the defining instance
gets closed.
:param func: The function to cancel on closing.
:returns: A decorated function or coroutine.
"""
@wraps(func)
async def wrapper(self, *args, **kwargs):
return a... | [
"def",
"cancel_on_closing",
"(",
"func",
")",
":",
"@",
"wraps",
"(",
"func",
")",
"async",
"def",
"wrapper",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"await",
"self",
".",
"await_until_closing",
"(",
"func",
"(",
"... | Automatically cancels a function or coroutine when the defining instance
gets closed.
:param func: The function to cancel on closing.
:returns: A decorated function or coroutine. | [
"Automatically",
"cancels",
"a",
"function",
"or",
"coroutine",
"when",
"the",
"defining",
"instance",
"gets",
"closed",
"."
] | train | https://github.com/ereOn/azmq/blob/9f40d6d721eea7f7659ec6cc668811976db59854/azmq/common.py#L21-L33 |
ereOn/azmq | azmq/common.py | ClosableAsyncObject.await_until_closing | async def await_until_closing(self, coro):
"""
Wait for some task to complete but aborts as soon asthe instance is
being closed.
:param coro: The coroutine or future-like object to wait for.
"""
wait_task = asyncio.ensure_future(self.wait_closing(), loop=self.loop)
... | python | async def await_until_closing(self, coro):
"""
Wait for some task to complete but aborts as soon asthe instance is
being closed.
:param coro: The coroutine or future-like object to wait for.
"""
wait_task = asyncio.ensure_future(self.wait_closing(), loop=self.loop)
... | [
"async",
"def",
"await_until_closing",
"(",
"self",
",",
"coro",
")",
":",
"wait_task",
"=",
"asyncio",
".",
"ensure_future",
"(",
"self",
".",
"wait_closing",
"(",
")",
",",
"loop",
"=",
"self",
".",
"loop",
")",
"coro_task",
"=",
"asyncio",
".",
"ensur... | Wait for some task to complete but aborts as soon asthe instance is
being closed.
:param coro: The coroutine or future-like object to wait for. | [
"Wait",
"for",
"some",
"task",
"to",
"complete",
"but",
"aborts",
"as",
"soon",
"asthe",
"instance",
"is",
"being",
"closed",
"."
] | train | https://github.com/ereOn/azmq/blob/9f40d6d721eea7f7659ec6cc668811976db59854/azmq/common.py#L71-L94 |
ereOn/azmq | azmq/common.py | ClosableAsyncObject._set_closed | def _set_closed(self, future):
"""
Indicate that the instance is effectively closed.
:param future: The close future.
"""
logger.debug("%s[%s] closed.", self.__class__.__name__, id(self))
self.on_closed.emit(self)
self._closed_future.set_result(future.result()) | python | def _set_closed(self, future):
"""
Indicate that the instance is effectively closed.
:param future: The close future.
"""
logger.debug("%s[%s] closed.", self.__class__.__name__, id(self))
self.on_closed.emit(self)
self._closed_future.set_result(future.result()) | [
"def",
"_set_closed",
"(",
"self",
",",
"future",
")",
":",
"logger",
".",
"debug",
"(",
"\"%s[%s] closed.\"",
",",
"self",
".",
"__class__",
".",
"__name__",
",",
"id",
"(",
"self",
")",
")",
"self",
".",
"on_closed",
".",
"emit",
"(",
"self",
")",
... | Indicate that the instance is effectively closed.
:param future: The close future. | [
"Indicate",
"that",
"the",
"instance",
"is",
"effectively",
"closed",
"."
] | train | https://github.com/ereOn/azmq/blob/9f40d6d721eea7f7659ec6cc668811976db59854/azmq/common.py#L146-L154 |
ereOn/azmq | azmq/common.py | ClosableAsyncObject.close | def close(self):
"""
Close the instance.
"""
if not self.closed and not self.closing:
logger.debug(
"%s[%s] closing...",
self.__class__.__name__,
id(self),
)
self._closing.set()
future = async... | python | def close(self):
"""
Close the instance.
"""
if not self.closed and not self.closing:
logger.debug(
"%s[%s] closing...",
self.__class__.__name__,
id(self),
)
self._closing.set()
future = async... | [
"def",
"close",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"closed",
"and",
"not",
"self",
".",
"closing",
":",
"logger",
".",
"debug",
"(",
"\"%s[%s] closing...\"",
",",
"self",
".",
"__class__",
".",
"__name__",
",",
"id",
"(",
"self",
")",
"... | Close the instance. | [
"Close",
"the",
"instance",
"."
] | train | https://github.com/ereOn/azmq/blob/9f40d6d721eea7f7659ec6cc668811976db59854/azmq/common.py#L156-L168 |
ereOn/azmq | azmq/common.py | CompositeClosableAsyncObject.register_child | def register_child(self, child):
"""
Register a new child that will be closed whenever the current instance
closes.
:param child: The child instance.
"""
if self.closing:
child.close()
else:
self._children.add(child)
child.on_c... | python | def register_child(self, child):
"""
Register a new child that will be closed whenever the current instance
closes.
:param child: The child instance.
"""
if self.closing:
child.close()
else:
self._children.add(child)
child.on_c... | [
"def",
"register_child",
"(",
"self",
",",
"child",
")",
":",
"if",
"self",
".",
"closing",
":",
"child",
".",
"close",
"(",
")",
"else",
":",
"self",
".",
"_children",
".",
"add",
"(",
"child",
")",
"child",
".",
"on_closed",
".",
"connect",
"(",
... | Register a new child that will be closed whenever the current instance
closes.
:param child: The child instance. | [
"Register",
"a",
"new",
"child",
"that",
"will",
"be",
"closed",
"whenever",
"the",
"current",
"instance",
"closes",
"."
] | train | https://github.com/ereOn/azmq/blob/9f40d6d721eea7f7659ec6cc668811976db59854/azmq/common.py#L202-L213 |
ereOn/azmq | azmq/common.py | CompositeClosableAsyncObject.unregister_child | def unregister_child(self, child):
"""
Unregister an existing child that is no longer to be owned by the
current instance.
:param child: The child instance.
"""
self._children.remove(child)
child.on_closed.disconnect(self.unregister_child) | python | def unregister_child(self, child):
"""
Unregister an existing child that is no longer to be owned by the
current instance.
:param child: The child instance.
"""
self._children.remove(child)
child.on_closed.disconnect(self.unregister_child) | [
"def",
"unregister_child",
"(",
"self",
",",
"child",
")",
":",
"self",
".",
"_children",
".",
"remove",
"(",
"child",
")",
"child",
".",
"on_closed",
".",
"disconnect",
"(",
"self",
".",
"unregister_child",
")"
] | Unregister an existing child that is no longer to be owned by the
current instance.
:param child: The child instance. | [
"Unregister",
"an",
"existing",
"child",
"that",
"is",
"no",
"longer",
"to",
"be",
"owned",
"by",
"the",
"current",
"instance",
"."
] | train | https://github.com/ereOn/azmq/blob/9f40d6d721eea7f7659ec6cc668811976db59854/azmq/common.py#L215-L223 |
ereOn/azmq | azmq/common.py | AsyncTimeout.on_open | def on_open(self, callback, timeout):
"""
Initialize a new timeout.
:param callback: The callback to execute when the timeout reaches the
end of its life. May be a coroutine function.
:param timeout: The maximum time to wait for, in seconds.
"""
super().on_o... | python | def on_open(self, callback, timeout):
"""
Initialize a new timeout.
:param callback: The callback to execute when the timeout reaches the
end of its life. May be a coroutine function.
:param timeout: The maximum time to wait for, in seconds.
"""
super().on_o... | [
"def",
"on_open",
"(",
"self",
",",
"callback",
",",
"timeout",
")",
":",
"super",
"(",
")",
".",
"on_open",
"(",
")",
"self",
".",
"callback",
"=",
"callback",
"self",
".",
"timeout",
"=",
"timeout",
"self",
".",
"revive_event",
"=",
"asyncio",
".",
... | Initialize a new timeout.
:param callback: The callback to execute when the timeout reaches the
end of its life. May be a coroutine function.
:param timeout: The maximum time to wait for, in seconds. | [
"Initialize",
"a",
"new",
"timeout",
"."
] | train | https://github.com/ereOn/azmq/blob/9f40d6d721eea7f7659ec6cc668811976db59854/azmq/common.py#L260-L271 |
ereOn/azmq | azmq/common.py | AsyncTimeout.revive | def revive(self, timeout=None):
"""
Revive the timeout.
:param timeout: If not `None`, specifies a new timeout value to use.
"""
if timeout is not None:
self.timeout = timeout
self.revive_event.set() | python | def revive(self, timeout=None):
"""
Revive the timeout.
:param timeout: If not `None`, specifies a new timeout value to use.
"""
if timeout is not None:
self.timeout = timeout
self.revive_event.set() | [
"def",
"revive",
"(",
"self",
",",
"timeout",
"=",
"None",
")",
":",
"if",
"timeout",
"is",
"not",
"None",
":",
"self",
".",
"timeout",
"=",
"timeout",
"self",
".",
"revive_event",
".",
"set",
"(",
")"
] | Revive the timeout.
:param timeout: If not `None`, specifies a new timeout value to use. | [
"Revive",
"the",
"timeout",
"."
] | train | https://github.com/ereOn/azmq/blob/9f40d6d721eea7f7659ec6cc668811976db59854/azmq/common.py#L291-L300 |
ereOn/azmq | azmq/common.py | AsyncPeriodicTimer.on_open | def on_open(self, callback, period):
"""
Initialize a new timer.
:param callback: The function or coroutine function to call on each
tick.
:param period: The interval of time between two ticks.
"""
super().on_open()
self.callback = callback
se... | python | def on_open(self, callback, period):
"""
Initialize a new timer.
:param callback: The function or coroutine function to call on each
tick.
:param period: The interval of time between two ticks.
"""
super().on_open()
self.callback = callback
se... | [
"def",
"on_open",
"(",
"self",
",",
"callback",
",",
"period",
")",
":",
"super",
"(",
")",
".",
"on_open",
"(",
")",
"self",
".",
"callback",
"=",
"callback",
"self",
".",
"period",
"=",
"period",
"self",
".",
"reset_event",
"=",
"asyncio",
".",
"Ev... | Initialize a new timer.
:param callback: The function or coroutine function to call on each
tick.
:param period: The interval of time between two ticks. | [
"Initialize",
"a",
"new",
"timer",
"."
] | train | https://github.com/ereOn/azmq/blob/9f40d6d721eea7f7659ec6cc668811976db59854/azmq/common.py#L307-L318 |
ereOn/azmq | azmq/common.py | AsyncPeriodicTimer.reset | def reset(self, period=None):
"""
Reset the internal timer, effectively causing the next tick to happen
in `self.period` seconds.
:param period: If not `None`, specifies a new period to use.
"""
if period is not None:
self.period = period
self.reset_... | python | def reset(self, period=None):
"""
Reset the internal timer, effectively causing the next tick to happen
in `self.period` seconds.
:param period: If not `None`, specifies a new period to use.
"""
if period is not None:
self.period = period
self.reset_... | [
"def",
"reset",
"(",
"self",
",",
"period",
"=",
"None",
")",
":",
"if",
"period",
"is",
"not",
"None",
":",
"self",
".",
"period",
"=",
"period",
"self",
".",
"reset_event",
".",
"set",
"(",
")"
] | Reset the internal timer, effectively causing the next tick to happen
in `self.period` seconds.
:param period: If not `None`, specifies a new period to use. | [
"Reset",
"the",
"internal",
"timer",
"effectively",
"causing",
"the",
"next",
"tick",
"to",
"happen",
"in",
"self",
".",
"period",
"seconds",
"."
] | train | https://github.com/ereOn/azmq/blob/9f40d6d721eea7f7659ec6cc668811976db59854/azmq/common.py#L339-L349 |
ereOn/azmq | azmq/common.py | AsyncBox.read | async def read(self):
"""
Read from the box in a blocking manner.
:returns: An item from the box.
"""
result = await self._queue.get()
self._can_write.set()
if self._queue.empty():
self._can_read.clear()
return result | python | async def read(self):
"""
Read from the box in a blocking manner.
:returns: An item from the box.
"""
result = await self._queue.get()
self._can_write.set()
if self._queue.empty():
self._can_read.clear()
return result | [
"async",
"def",
"read",
"(",
"self",
")",
":",
"result",
"=",
"await",
"self",
".",
"_queue",
".",
"get",
"(",
")",
"self",
".",
"_can_write",
".",
"set",
"(",
")",
"if",
"self",
".",
"_queue",
".",
"empty",
"(",
")",
":",
"self",
".",
"_can_read... | Read from the box in a blocking manner.
:returns: An item from the box. | [
"Read",
"from",
"the",
"box",
"in",
"a",
"blocking",
"manner",
"."
] | train | https://github.com/ereOn/azmq/blob/9f40d6d721eea7f7659ec6cc668811976db59854/azmq/common.py#L361-L374 |
ereOn/azmq | azmq/common.py | AsyncBox.read_nowait | def read_nowait(self):
"""
Read from the box in a non-blocking manner.
If the box is empty, an exception is thrown. You should always check
for emptiness with `empty` or `wait_not_empty` before calling this
method.
:returns: An item from the box.
"""
res... | python | def read_nowait(self):
"""
Read from the box in a non-blocking manner.
If the box is empty, an exception is thrown. You should always check
for emptiness with `empty` or `wait_not_empty` before calling this
method.
:returns: An item from the box.
"""
res... | [
"def",
"read_nowait",
"(",
"self",
")",
":",
"result",
"=",
"self",
".",
"_queue",
".",
"get_nowait",
"(",
")",
"self",
".",
"_can_write",
".",
"set",
"(",
")",
"if",
"self",
".",
"_queue",
".",
"empty",
"(",
")",
":",
"self",
".",
"_can_read",
"."... | Read from the box in a non-blocking manner.
If the box is empty, an exception is thrown. You should always check
for emptiness with `empty` or `wait_not_empty` before calling this
method.
:returns: An item from the box. | [
"Read",
"from",
"the",
"box",
"in",
"a",
"non",
"-",
"blocking",
"manner",
"."
] | train | https://github.com/ereOn/azmq/blob/9f40d6d721eea7f7659ec6cc668811976db59854/azmq/common.py#L376-L393 |
ereOn/azmq | azmq/common.py | AsyncBox.write | async def write(self, item):
"""
Write an item in the queue.
:param item: The item.
"""
await self._queue.put(item)
self._can_read.set()
if self._queue.full():
self._can_write.clear() | python | async def write(self, item):
"""
Write an item in the queue.
:param item: The item.
"""
await self._queue.put(item)
self._can_read.set()
if self._queue.full():
self._can_write.clear() | [
"async",
"def",
"write",
"(",
"self",
",",
"item",
")",
":",
"await",
"self",
".",
"_queue",
".",
"put",
"(",
"item",
")",
"self",
".",
"_can_read",
".",
"set",
"(",
")",
"if",
"self",
".",
"_queue",
".",
"full",
"(",
")",
":",
"self",
".",
"_c... | Write an item in the queue.
:param item: The item. | [
"Write",
"an",
"item",
"in",
"the",
"queue",
"."
] | train | https://github.com/ereOn/azmq/blob/9f40d6d721eea7f7659ec6cc668811976db59854/azmq/common.py#L416-L426 |
ereOn/azmq | azmq/common.py | AsyncBox.write_nowait | def write_nowait(self, item):
"""
Write in the box in a non-blocking manner.
If the box is full, an exception is thrown. You should always check
for fullness with `full` or `wait_not_full` before calling this method.
:param item: An item.
"""
self._queue.put_now... | python | def write_nowait(self, item):
"""
Write in the box in a non-blocking manner.
If the box is full, an exception is thrown. You should always check
for fullness with `full` or `wait_not_full` before calling this method.
:param item: An item.
"""
self._queue.put_now... | [
"def",
"write_nowait",
"(",
"self",
",",
"item",
")",
":",
"self",
".",
"_queue",
".",
"put_nowait",
"(",
"item",
")",
"self",
".",
"_can_read",
".",
"set",
"(",
")",
"if",
"self",
".",
"_queue",
".",
"full",
"(",
")",
":",
"self",
".",
"_can_write... | Write in the box in a non-blocking manner.
If the box is full, an exception is thrown. You should always check
for fullness with `full` or `wait_not_full` before calling this method.
:param item: An item. | [
"Write",
"in",
"the",
"box",
"in",
"a",
"non",
"-",
"blocking",
"manner",
"."
] | train | https://github.com/ereOn/azmq/blob/9f40d6d721eea7f7659ec6cc668811976db59854/azmq/common.py#L428-L441 |
ereOn/azmq | azmq/common.py | AsyncBox.clone | def clone(self):
"""
Clone the box.
:returns: A new box with the same item queue.
The cloned box is not closed, no matter the initial state of the
original instance.
"""
result = AsyncBox(maxsize=self._maxsize, loop=self.loop)
result._queue = self._queue... | python | def clone(self):
"""
Clone the box.
:returns: A new box with the same item queue.
The cloned box is not closed, no matter the initial state of the
original instance.
"""
result = AsyncBox(maxsize=self._maxsize, loop=self.loop)
result._queue = self._queue... | [
"def",
"clone",
"(",
"self",
")",
":",
"result",
"=",
"AsyncBox",
"(",
"maxsize",
"=",
"self",
".",
"_maxsize",
",",
"loop",
"=",
"self",
".",
"loop",
")",
"result",
".",
"_queue",
"=",
"self",
".",
"_queue",
"result",
".",
"_can_read",
"=",
"self",
... | Clone the box.
:returns: A new box with the same item queue.
The cloned box is not closed, no matter the initial state of the
original instance. | [
"Clone",
"the",
"box",
"."
] | train | https://github.com/ereOn/azmq/blob/9f40d6d721eea7f7659ec6cc668811976db59854/azmq/common.py#L453-L467 |
revarbat/pymuv | pymuv/lvalue.py | LValue.get_expr | def get_expr(self, ctx):
"""
Returns the MUF needed to get the contents of the lvalue.
Returned MUF will push the contained value onto the stack.
"""
varname = ctx.lookup_variable(self.varname)
if varname is None:
val = ctx.lookup_constant(self.varname)
... | python | def get_expr(self, ctx):
"""
Returns the MUF needed to get the contents of the lvalue.
Returned MUF will push the contained value onto the stack.
"""
varname = ctx.lookup_variable(self.varname)
if varname is None:
val = ctx.lookup_constant(self.varname)
... | [
"def",
"get_expr",
"(",
"self",
",",
"ctx",
")",
":",
"varname",
"=",
"ctx",
".",
"lookup_variable",
"(",
"self",
".",
"varname",
")",
"if",
"varname",
"is",
"None",
":",
"val",
"=",
"ctx",
".",
"lookup_constant",
"(",
"self",
".",
"varname",
")",
"i... | Returns the MUF needed to get the contents of the lvalue.
Returned MUF will push the contained value onto the stack. | [
"Returns",
"the",
"MUF",
"needed",
"to",
"get",
"the",
"contents",
"of",
"the",
"lvalue",
".",
"Returned",
"MUF",
"will",
"push",
"the",
"contained",
"value",
"onto",
"the",
"stack",
"."
] | train | https://github.com/revarbat/pymuv/blob/cefa2f2d35fc32054b9595da5f3393f6cceee5e0/pymuv/lvalue.py#L12-L43 |
revarbat/pymuv | pymuv/lvalue.py | LValue.set_expr | def set_expr(self, ctx):
"""
Returns the MUF needed to do an assign on the lvalue. (=)
Returned MUF expects a value to be on the stack.
"""
if self.readonly:
raise MuvError(
"Cannot assign value to constant '%s'." % self.varname,
positi... | python | def set_expr(self, ctx):
"""
Returns the MUF needed to do an assign on the lvalue. (=)
Returned MUF expects a value to be on the stack.
"""
if self.readonly:
raise MuvError(
"Cannot assign value to constant '%s'." % self.varname,
positi... | [
"def",
"set_expr",
"(",
"self",
",",
"ctx",
")",
":",
"if",
"self",
".",
"readonly",
":",
"raise",
"MuvError",
"(",
"\"Cannot assign value to constant '%s'.\"",
"%",
"self",
".",
"varname",
",",
"position",
"=",
"self",
".",
"position",
")",
"if",
"self",
... | Returns the MUF needed to do an assign on the lvalue. (=)
Returned MUF expects a value to be on the stack. | [
"Returns",
"the",
"MUF",
"needed",
"to",
"do",
"an",
"assign",
"on",
"the",
"lvalue",
".",
"(",
"=",
")",
"Returned",
"MUF",
"expects",
"a",
"value",
"to",
"be",
"on",
"the",
"stack",
"."
] | train | https://github.com/revarbat/pymuv/blob/cefa2f2d35fc32054b9595da5f3393f6cceee5e0/pymuv/lvalue.py#L45-L99 |
revarbat/pymuv | pymuv/lvalue.py | LValue.oper_set_expr | def oper_set_expr(self, ctx, oper, val):
"""
Returns the MUF needed to do an oper-assign on the lvalue. (+=, etc.)
"""
if self.readonly:
raise MuvError(
"Cannot assign value to constant '%s'." % self.varname,
position=self.position
... | python | def oper_set_expr(self, ctx, oper, val):
"""
Returns the MUF needed to do an oper-assign on the lvalue. (+=, etc.)
"""
if self.readonly:
raise MuvError(
"Cannot assign value to constant '%s'." % self.varname,
position=self.position
... | [
"def",
"oper_set_expr",
"(",
"self",
",",
"ctx",
",",
"oper",
",",
"val",
")",
":",
"if",
"self",
".",
"readonly",
":",
"raise",
"MuvError",
"(",
"\"Cannot assign value to constant '%s'.\"",
"%",
"self",
".",
"varname",
",",
"position",
"=",
"self",
".",
"... | Returns the MUF needed to do an oper-assign on the lvalue. (+=, etc.) | [
"Returns",
"the",
"MUF",
"needed",
"to",
"do",
"an",
"oper",
"-",
"assign",
"on",
"the",
"lvalue",
".",
"(",
"+",
"=",
"etc",
".",
")"
] | train | https://github.com/revarbat/pymuv/blob/cefa2f2d35fc32054b9595da5f3393f6cceee5e0/pymuv/lvalue.py#L101-L202 |
revarbat/pymuv | pymuv/lvalue.py | LValue.unary_set_expr | def unary_set_expr(self, ctx, oper, postoper=False):
"""
Returns the MUF needed to do an unary operation on the lvalue. (++, --.)
"""
if self.readonly:
raise MuvError(
"Cannot increment or decrement constant '%s'." % self.varname,
position=self... | python | def unary_set_expr(self, ctx, oper, postoper=False):
"""
Returns the MUF needed to do an unary operation on the lvalue. (++, --.)
"""
if self.readonly:
raise MuvError(
"Cannot increment or decrement constant '%s'." % self.varname,
position=self... | [
"def",
"unary_set_expr",
"(",
"self",
",",
"ctx",
",",
"oper",
",",
"postoper",
"=",
"False",
")",
":",
"if",
"self",
".",
"readonly",
":",
"raise",
"MuvError",
"(",
"\"Cannot increment or decrement constant '%s'.\"",
"%",
"self",
".",
"varname",
",",
"positio... | Returns the MUF needed to do an unary operation on the lvalue. (++, --.) | [
"Returns",
"the",
"MUF",
"needed",
"to",
"do",
"an",
"unary",
"operation",
"on",
"the",
"lvalue",
".",
"(",
"++",
"--",
".",
")"
] | train | https://github.com/revarbat/pymuv/blob/cefa2f2d35fc32054b9595da5f3393f6cceee5e0/pymuv/lvalue.py#L204-L298 |
revarbat/pymuv | pymuv/lvalue.py | LValue.del_expr | def del_expr(self, ctx):
"""
Returns the MUF needed to delete a given lvalue. (ie: array item)
Returned MUF will set a bare variable to 0, and will remove the
given indexed item for an indexed array or dictionary.
"""
if self.readonly:
raise MuvError(
... | python | def del_expr(self, ctx):
"""
Returns the MUF needed to delete a given lvalue. (ie: array item)
Returned MUF will set a bare variable to 0, and will remove the
given indexed item for an indexed array or dictionary.
"""
if self.readonly:
raise MuvError(
... | [
"def",
"del_expr",
"(",
"self",
",",
"ctx",
")",
":",
"if",
"self",
".",
"readonly",
":",
"raise",
"MuvError",
"(",
"\"Cannot assign value to constant '%s'.\"",
"%",
"self",
".",
"varname",
",",
"position",
"=",
"self",
".",
"position",
")",
"varname",
"=",
... | Returns the MUF needed to delete a given lvalue. (ie: array item)
Returned MUF will set a bare variable to 0, and will remove the
given indexed item for an indexed array or dictionary. | [
"Returns",
"the",
"MUF",
"needed",
"to",
"delete",
"a",
"given",
"lvalue",
".",
"(",
"ie",
":",
"array",
"item",
")",
"Returned",
"MUF",
"will",
"set",
"a",
"bare",
"variable",
"to",
"0",
"and",
"will",
"remove",
"the",
"given",
"indexed",
"item",
"for... | train | https://github.com/revarbat/pymuv/blob/cefa2f2d35fc32054b9595da5f3393f6cceee5e0/pymuv/lvalue.py#L300-L339 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.