partition stringclasses 3
values | func_name stringlengths 1 134 | docstring stringlengths 1 46.9k | path stringlengths 4 223 | original_string stringlengths 75 104k | code stringlengths 75 104k | docstring_tokens listlengths 1 1.97k | repo stringlengths 7 55 | language stringclasses 1
value | url stringlengths 87 315 | code_tokens listlengths 19 28.4k | sha stringlengths 40 40 |
|---|---|---|---|---|---|---|---|---|---|---|---|
valid | Tetrad._store_N_samples | Find all quartets of samples and store in a large array
A chunk size is assigned for sampling from the array of quartets
based on the number of cpus available. This should be relatively
large so that we don't spend a lot of time doing I/O, but small
enough that jobs finish often for ch... | ipyrad/analysis/tetrad2.py | def _store_N_samples(self, start, ipyclient, quiet=False):
"""
Find all quartets of samples and store in a large array
A chunk size is assigned for sampling from the array of quartets
based on the number of cpus available. This should be relatively
large so that we don't spend ... | def _store_N_samples(self, start, ipyclient, quiet=False):
"""
Find all quartets of samples and store in a large array
A chunk size is assigned for sampling from the array of quartets
based on the number of cpus available. This should be relatively
large so that we don't spend ... | [
"Find",
"all",
"quartets",
"of",
"samples",
"and",
"store",
"in",
"a",
"large",
"array",
"A",
"chunk",
"size",
"is",
"assigned",
"for",
"sampling",
"from",
"the",
"array",
"of",
"quartets",
"based",
"on",
"the",
"number",
"of",
"cpus",
"available",
".",
... | dereneaton/ipyrad | python | https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/analysis/tetrad2.py#L405-L486 | [
"def",
"_store_N_samples",
"(",
"self",
",",
"start",
",",
"ipyclient",
",",
"quiet",
"=",
"False",
")",
":",
"breaks",
"=",
"2",
"if",
"self",
".",
"params",
".",
"nquartets",
"<",
"5000",
":",
"breaks",
"=",
"1",
"if",
"self",
".",
"params",
".",
... | 5eeb8a178160f45faf71bf47cec4abe998a575d1 |
valid | Tetrad._dump_qmc | Writes the inferred quartet sets from the database to a text
file to be used as input for QMC. Quartets that had no information
available (i.e., no SNPs) were written to the database as 0,0,0,0
and are excluded here from the output. | ipyrad/analysis/tetrad2.py | def _dump_qmc(self):
"""
Writes the inferred quartet sets from the database to a text
file to be used as input for QMC. Quartets that had no information
available (i.e., no SNPs) were written to the database as 0,0,0,0
and are excluded here from the output.
"""
... | def _dump_qmc(self):
"""
Writes the inferred quartet sets from the database to a text
file to be used as input for QMC. Quartets that had no information
available (i.e., no SNPs) were written to the database as 0,0,0,0
and are excluded here from the output.
"""
... | [
"Writes",
"the",
"inferred",
"quartet",
"sets",
"from",
"the",
"database",
"to",
"a",
"text",
"file",
"to",
"be",
"used",
"as",
"input",
"for",
"QMC",
".",
"Quartets",
"that",
"had",
"no",
"information",
"available",
"(",
"i",
".",
"e",
".",
"no",
"SNP... | dereneaton/ipyrad | python | https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/analysis/tetrad2.py#L490-L513 | [
"def",
"_dump_qmc",
"(",
"self",
")",
":",
"## open the h5 database",
"with",
"h5py",
".",
"File",
"(",
"self",
".",
"database",
".",
"output",
",",
"'r'",
")",
"as",
"io5",
":",
"## create an output file for writing",
"self",
".",
"files",
".",
"qdump",
"="... | 5eeb8a178160f45faf71bf47cec4abe998a575d1 |
valid | Tetrad._run_qmc | Runs quartet max-cut QMC on the quartets qdump file. | ipyrad/analysis/tetrad2.py | def _run_qmc(self, boot):
"""
Runs quartet max-cut QMC on the quartets qdump file.
"""
## build command
self._tmp = os.path.join(self.dirs, ".tmptre")
cmd = [ip.bins.qmc, "qrtt="+self.files.qdump, "otre="+self._tmp]
## run it
proc = subprocess.Popen(cmd,... | def _run_qmc(self, boot):
"""
Runs quartet max-cut QMC on the quartets qdump file.
"""
## build command
self._tmp = os.path.join(self.dirs, ".tmptre")
cmd = [ip.bins.qmc, "qrtt="+self.files.qdump, "otre="+self._tmp]
## run it
proc = subprocess.Popen(cmd,... | [
"Runs",
"quartet",
"max",
"-",
"cut",
"QMC",
"on",
"the",
"quartets",
"qdump",
"file",
"."
] | dereneaton/ipyrad | python | https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/analysis/tetrad2.py#L516-L550 | [
"def",
"_run_qmc",
"(",
"self",
",",
"boot",
")",
":",
"## build command",
"self",
".",
"_tmp",
"=",
"os",
".",
"path",
".",
"join",
"(",
"self",
".",
"dirs",
",",
"\".tmptre\"",
")",
"cmd",
"=",
"[",
"ip",
".",
"bins",
".",
"qmc",
",",
"\"qrtt=\""... | 5eeb8a178160f45faf71bf47cec4abe998a575d1 |
valid | Tetrad._compute_stats | Compute sampling stats and consens trees. | ipyrad/analysis/tetrad2.py | def _compute_stats(self, start, ipyclient, quiet=False):
"""
Compute sampling stats and consens trees.
"""
## get name indices
names = self.samples
## make a consensus from bootstrap reps.
if self.checkpoint.boots:
tre = ete3.Tree(self.trees... | def _compute_stats(self, start, ipyclient, quiet=False):
"""
Compute sampling stats and consens trees.
"""
## get name indices
names = self.samples
## make a consensus from bootstrap reps.
if self.checkpoint.boots:
tre = ete3.Tree(self.trees... | [
"Compute",
"sampling",
"stats",
"and",
"consens",
"trees",
"."
] | dereneaton/ipyrad | python | https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/analysis/tetrad2.py#L554-L626 | [
"def",
"_compute_stats",
"(",
"self",
",",
"start",
",",
"ipyclient",
",",
"quiet",
"=",
"False",
")",
":",
"## get name indices",
"names",
"=",
"self",
".",
"samples",
"## make a consensus from bootstrap reps.",
"if",
"self",
".",
"checkpoint",
".",
"boots",
":... | 5eeb8a178160f45faf71bf47cec4abe998a575d1 |
valid | Tetrad._load | Load a JSON serialized tetrad instance to continue from a checkpoint. | ipyrad/analysis/tetrad2.py | def _load(self, name, workdir, quiet=False):
"""
Load a JSON serialized tetrad instance to continue from a checkpoint.
"""
## load the JSON string and try with name+.json
path = os.path.join(workdir, name)
if not path.endswith(".tet.json"):
path += ".tet.json... | def _load(self, name, workdir, quiet=False):
"""
Load a JSON serialized tetrad instance to continue from a checkpoint.
"""
## load the JSON string and try with name+.json
path = os.path.join(workdir, name)
if not path.endswith(".tet.json"):
path += ".tet.json... | [
"Load",
"a",
"JSON",
"serialized",
"tetrad",
"instance",
"to",
"continue",
"from",
"a",
"checkpoint",
"."
] | dereneaton/ipyrad | python | https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/analysis/tetrad2.py#L664-L704 | [
"def",
"_load",
"(",
"self",
",",
"name",
",",
"workdir",
",",
"quiet",
"=",
"False",
")",
":",
"## load the JSON string and try with name+.json",
"path",
"=",
"os",
".",
"path",
".",
"join",
"(",
"workdir",
",",
"name",
")",
"if",
"not",
"path",
".",
"e... | 5eeb8a178160f45faf71bf47cec4abe998a575d1 |
valid | Tetrad._inference | Sends slices of quartet sets to parallel engines for computing,
enters results into output database, sends finished quartet sets
to QMC for tree inference, and prints progress bars. | ipyrad/analysis/tetrad2.py | def _inference(self, start, ipyclient, quiet):
"""
Sends slices of quartet sets to parallel engines for computing,
enters results into output database, sends finished quartet sets
to QMC for tree inference, and prints progress bars.
"""
## load-balancer for single-threa... | def _inference(self, start, ipyclient, quiet):
"""
Sends slices of quartet sets to parallel engines for computing,
enters results into output database, sends finished quartet sets
to QMC for tree inference, and prints progress bars.
"""
## load-balancer for single-threa... | [
"Sends",
"slices",
"of",
"quartet",
"sets",
"to",
"parallel",
"engines",
"for",
"computing",
"enters",
"results",
"into",
"output",
"database",
"sends",
"finished",
"quartet",
"sets",
"to",
"QMC",
"for",
"tree",
"inference",
"and",
"prints",
"progress",
"bars",
... | dereneaton/ipyrad | python | https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/analysis/tetrad2.py#L708-L799 | [
"def",
"_inference",
"(",
"self",
",",
"start",
",",
"ipyclient",
",",
"quiet",
")",
":",
"## load-balancer for single-threaded execution jobs",
"lbview",
"=",
"ipyclient",
".",
"load_balanced_view",
"(",
")",
"## an iterator that grabs quartet chunk start positions",
"jobs... | 5eeb8a178160f45faf71bf47cec4abe998a575d1 |
valid | Tetrad._insert_to_array | Enters results arrays into the HDF5 database. | ipyrad/analysis/tetrad2.py | def _insert_to_array(self, chunk, results):
"""
Enters results arrays into the HDF5 database.
"""
## two result arrs
chunksize = self._chunksize
qrts, invs = results
## enter into db
with h5py.File(self.database.output, 'r+') as io5:
io5['qua... | def _insert_to_array(self, chunk, results):
"""
Enters results arrays into the HDF5 database.
"""
## two result arrs
chunksize = self._chunksize
qrts, invs = results
## enter into db
with h5py.File(self.database.output, 'r+') as io5:
io5['qua... | [
"Enters",
"results",
"arrays",
"into",
"the",
"HDF5",
"database",
"."
] | dereneaton/ipyrad | python | https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/analysis/tetrad2.py#L803-L822 | [
"def",
"_insert_to_array",
"(",
"self",
",",
"chunk",
",",
"results",
")",
":",
"## two result arrs",
"chunksize",
"=",
"self",
".",
"_chunksize",
"qrts",
",",
"invs",
"=",
"results",
"## enter into db",
"with",
"h5py",
".",
"File",
"(",
"self",
".",
"databa... | 5eeb8a178160f45faf71bf47cec4abe998a575d1 |
valid | Tetrad.run | Parameters
----------
force (bool):
Overwrite existing results for object with the same name
and workdir as this one.
verbose (int):
0=primt nothing; 1=print progress bars; 2=print pringress
bars and cluster information.
ipyclient (ipyparal... | ipyrad/analysis/tetrad2.py | def run(self, force=False, quiet=False, ipyclient=None):
"""
Parameters
----------
force (bool):
Overwrite existing results for object with the same name
and workdir as this one.
verbose (int):
0=primt nothing; 1=print progress bars; 2=print pr... | def run(self, force=False, quiet=False, ipyclient=None):
"""
Parameters
----------
force (bool):
Overwrite existing results for object with the same name
and workdir as this one.
verbose (int):
0=primt nothing; 1=print progress bars; 2=print pr... | [
"Parameters",
"----------",
"force",
"(",
"bool",
")",
":",
"Overwrite",
"existing",
"results",
"for",
"object",
"with",
"the",
"same",
"name",
"and",
"workdir",
"as",
"this",
"one",
".",
"verbose",
"(",
"int",
")",
":",
"0",
"=",
"primt",
"nothing",
";"... | dereneaton/ipyrad | python | https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/analysis/tetrad2.py#L828-L959 | [
"def",
"run",
"(",
"self",
",",
"force",
"=",
"False",
",",
"quiet",
"=",
"False",
",",
"ipyclient",
"=",
"None",
")",
":",
"## force overwrite needs to clear out the HDF5 database",
"if",
"force",
":",
"self",
".",
"_refresh",
"(",
")",
"## print nquartet state... | 5eeb8a178160f45faf71bf47cec4abe998a575d1 |
valid | start_ipcluster | Start ipcluster | ipyrad/core/parallel.py | def start_ipcluster(data):
""" Start ipcluster """
## if MPI argument then use --ip arg to view all sockets
iparg = ""
if "MPI" in data._ipcluster["engines"]:
iparg = "--ip=*"
## make ipcluster arg call
standard = """
ipcluster start
--daemonize
... | def start_ipcluster(data):
""" Start ipcluster """
## if MPI argument then use --ip arg to view all sockets
iparg = ""
if "MPI" in data._ipcluster["engines"]:
iparg = "--ip=*"
## make ipcluster arg call
standard = """
ipcluster start
--daemonize
... | [
"Start",
"ipcluster"
] | dereneaton/ipyrad | python | https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/core/parallel.py#L26-L62 | [
"def",
"start_ipcluster",
"(",
"data",
")",
":",
"## if MPI argument then use --ip arg to view all sockets",
"iparg",
"=",
"\"\"",
"if",
"\"MPI\"",
"in",
"data",
".",
"_ipcluster",
"[",
"\"engines\"",
"]",
":",
"iparg",
"=",
"\"--ip=*\"",
"## make ipcluster arg call",
... | 5eeb8a178160f45faf71bf47cec4abe998a575d1 |
valid | register_ipcluster | The name is a unique id that keeps this __init__ of ipyrad distinct
from interfering with other ipcontrollers. Run statements are wrapped
so that ipcluster will be killed on exit. | ipyrad/core/parallel.py | def register_ipcluster(data):
"""
The name is a unique id that keeps this __init__ of ipyrad distinct
from interfering with other ipcontrollers. Run statements are wrapped
so that ipcluster will be killed on exit.
"""
## check if this pid already has a running cluster
data._ipcluster["cluste... | def register_ipcluster(data):
"""
The name is a unique id that keeps this __init__ of ipyrad distinct
from interfering with other ipcontrollers. Run statements are wrapped
so that ipcluster will be killed on exit.
"""
## check if this pid already has a running cluster
data._ipcluster["cluste... | [
"The",
"name",
"is",
"a",
"unique",
"id",
"that",
"keeps",
"this",
"__init__",
"of",
"ipyrad",
"distinct",
"from",
"interfering",
"with",
"other",
"ipcontrollers",
".",
"Run",
"statements",
"are",
"wrapped",
"so",
"that",
"ipcluster",
"will",
"be",
"killed",
... | dereneaton/ipyrad | python | https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/core/parallel.py#L66-L75 | [
"def",
"register_ipcluster",
"(",
"data",
")",
":",
"## check if this pid already has a running cluster",
"data",
".",
"_ipcluster",
"[",
"\"cluster_id\"",
"]",
"=",
"\"ipyrad-cli-\"",
"+",
"str",
"(",
"os",
".",
"getpid",
"(",
")",
")",
"start_ipcluster",
"(",
"d... | 5eeb8a178160f45faf71bf47cec4abe998a575d1 |
valid | get_client | Creates a client to view ipcluster engines for a given profile and
returns it with at least one engine spun up and ready to go. If no
engines are found after nwait amount of time then an error is raised.
If engines==MPI it waits a bit longer to find engines. If the number
of engines is set then it wai... | ipyrad/core/parallel.py | def get_client(cluster_id, profile, engines, timeout, cores, quiet, spacer, **kwargs):
"""
Creates a client to view ipcluster engines for a given profile and
returns it with at least one engine spun up and ready to go. If no
engines are found after nwait amount of time then an error is raised.
If... | def get_client(cluster_id, profile, engines, timeout, cores, quiet, spacer, **kwargs):
"""
Creates a client to view ipcluster engines for a given profile and
returns it with at least one engine spun up and ready to go. If no
engines are found after nwait amount of time then an error is raised.
If... | [
"Creates",
"a",
"client",
"to",
"view",
"ipcluster",
"engines",
"for",
"a",
"given",
"profile",
"and",
"returns",
"it",
"with",
"at",
"least",
"one",
"engine",
"spun",
"up",
"and",
"ready",
"to",
"go",
".",
"If",
"no",
"engines",
"are",
"found",
"after",... | dereneaton/ipyrad | python | https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/core/parallel.py#L79-L176 | [
"def",
"get_client",
"(",
"cluster_id",
",",
"profile",
",",
"engines",
",",
"timeout",
",",
"cores",
",",
"quiet",
",",
"spacer",
",",
"*",
"*",
"kwargs",
")",
":",
"## save stds for later, we're gonna hide them to prevent external printing ",
"save_stdout",
"=",
"... | 5eeb8a178160f45faf71bf47cec4abe998a575d1 |
valid | memoize | Memoization decorator for a function taking one or more arguments. | ipyrad/assemble/util.py | def memoize(func):
""" Memoization decorator for a function taking one or more arguments. """
class Memodict(dict):
""" just a dict"""
def __getitem__(self, *key):
return dict.__getitem__(self, key)
def __missing__(self, key):
""" this makes it faster """
... | def memoize(func):
""" Memoization decorator for a function taking one or more arguments. """
class Memodict(dict):
""" just a dict"""
def __getitem__(self, *key):
return dict.__getitem__(self, key)
def __missing__(self, key):
""" this makes it faster """
... | [
"Memoization",
"decorator",
"for",
"a",
"function",
"taking",
"one",
"or",
"more",
"arguments",
"."
] | dereneaton/ipyrad | python | https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/assemble/util.py#L124-L136 | [
"def",
"memoize",
"(",
"func",
")",
":",
"class",
"Memodict",
"(",
"dict",
")",
":",
"\"\"\" just a dict\"\"\"",
"def",
"__getitem__",
"(",
"self",
",",
"*",
"key",
")",
":",
"return",
"dict",
".",
"__getitem__",
"(",
"self",
",",
"key",
")",
"def",
"_... | 5eeb8a178160f45faf71bf47cec4abe998a575d1 |
valid | ambigcutters | Returns both resolutions of a cut site that has an ambiguous base in
it, else the single cut site | ipyrad/assemble/util.py | def ambigcutters(seq):
"""
Returns both resolutions of a cut site that has an ambiguous base in
it, else the single cut site
"""
resos = []
if any([i in list("RKSYWM") for i in seq]):
for base in list("RKSYWM"):
if base in seq:
resos.append(seq.replace(base, A... | def ambigcutters(seq):
"""
Returns both resolutions of a cut site that has an ambiguous base in
it, else the single cut site
"""
resos = []
if any([i in list("RKSYWM") for i in seq]):
for base in list("RKSYWM"):
if base in seq:
resos.append(seq.replace(base, A... | [
"Returns",
"both",
"resolutions",
"of",
"a",
"cut",
"site",
"that",
"has",
"an",
"ambiguous",
"base",
"in",
"it",
"else",
"the",
"single",
"cut",
"site"
] | dereneaton/ipyrad | python | https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/assemble/util.py#L192-L205 | [
"def",
"ambigcutters",
"(",
"seq",
")",
":",
"resos",
"=",
"[",
"]",
"if",
"any",
"(",
"[",
"i",
"in",
"list",
"(",
"\"RKSYWM\"",
")",
"for",
"i",
"in",
"seq",
"]",
")",
":",
"for",
"base",
"in",
"list",
"(",
"\"RKSYWM\"",
")",
":",
"if",
"base... | 5eeb8a178160f45faf71bf47cec4abe998a575d1 |
valid | splitalleles | takes diploid consensus alleles with phase data stored as a mixture
of upper and lower case characters and splits it into 2 alleles | ipyrad/assemble/util.py | def splitalleles(consensus):
""" takes diploid consensus alleles with phase data stored as a mixture
of upper and lower case characters and splits it into 2 alleles """
## store two alleles, allele1 will start with bigbase
allele1 = list(consensus)
allele2 = list(consensus)
hidx = [i for (i, j)... | def splitalleles(consensus):
""" takes diploid consensus alleles with phase data stored as a mixture
of upper and lower case characters and splits it into 2 alleles """
## store two alleles, allele1 will start with bigbase
allele1 = list(consensus)
allele2 = list(consensus)
hidx = [i for (i, j)... | [
"takes",
"diploid",
"consensus",
"alleles",
"with",
"phase",
"data",
"stored",
"as",
"a",
"mixture",
"of",
"upper",
"and",
"lower",
"case",
"characters",
"and",
"splits",
"it",
"into",
"2",
"alleles"
] | dereneaton/ipyrad | python | https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/assemble/util.py#L209-L232 | [
"def",
"splitalleles",
"(",
"consensus",
")",
":",
"## store two alleles, allele1 will start with bigbase",
"allele1",
"=",
"list",
"(",
"consensus",
")",
"allele2",
"=",
"list",
"(",
"consensus",
")",
"hidx",
"=",
"[",
"i",
"for",
"(",
"i",
",",
"j",
")",
"... | 5eeb8a178160f45faf71bf47cec4abe998a575d1 |
valid | comp | returns a seq with complement. Preserves little n's for splitters. | ipyrad/assemble/util.py | def comp(seq):
""" returns a seq with complement. Preserves little n's for splitters."""
## makes base to its small complement then makes upper
return seq.replace("A", 't')\
.replace('T', 'a')\
.replace('C', 'g')\
.replace('G', 'c')\
.replace('n', 'Z')... | def comp(seq):
""" returns a seq with complement. Preserves little n's for splitters."""
## makes base to its small complement then makes upper
return seq.replace("A", 't')\
.replace('T', 'a')\
.replace('C', 'g')\
.replace('G', 'c')\
.replace('n', 'Z')... | [
"returns",
"a",
"seq",
"with",
"complement",
".",
"Preserves",
"little",
"n",
"s",
"for",
"splitters",
"."
] | dereneaton/ipyrad | python | https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/assemble/util.py#L236-L245 | [
"def",
"comp",
"(",
"seq",
")",
":",
"## makes base to its small complement then makes upper",
"return",
"seq",
".",
"replace",
"(",
"\"A\"",
",",
"'t'",
")",
".",
"replace",
"(",
"'T'",
",",
"'a'",
")",
".",
"replace",
"(",
"'C'",
",",
"'g'",
")",
".",
... | 5eeb8a178160f45faf71bf47cec4abe998a575d1 |
valid | fullcomp | returns complement of sequence including ambiguity characters,
and saves lower case info for multiple hetero sequences | ipyrad/assemble/util.py | def fullcomp(seq):
""" returns complement of sequence including ambiguity characters,
and saves lower case info for multiple hetero sequences"""
## this is surely not the most efficient...
seq = seq.replace("A", 'u')\
.replace('T', 'v')\
.replace('C', 'p')\
.replac... | def fullcomp(seq):
""" returns complement of sequence including ambiguity characters,
and saves lower case info for multiple hetero sequences"""
## this is surely not the most efficient...
seq = seq.replace("A", 'u')\
.replace('T', 'v')\
.replace('C', 'p')\
.replac... | [
"returns",
"complement",
"of",
"sequence",
"including",
"ambiguity",
"characters",
"and",
"saves",
"lower",
"case",
"info",
"for",
"multiple",
"hetero",
"sequences"
] | dereneaton/ipyrad | python | https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/assemble/util.py#L249-L280 | [
"def",
"fullcomp",
"(",
"seq",
")",
":",
"## this is surely not the most efficient...",
"seq",
"=",
"seq",
".",
"replace",
"(",
"\"A\"",
",",
"'u'",
")",
".",
"replace",
"(",
"'T'",
",",
"'v'",
")",
".",
"replace",
"(",
"'C'",
",",
"'p'",
")",
".",
"re... | 5eeb8a178160f45faf71bf47cec4abe998a575d1 |
valid | fastq_touchup_for_vsearch_merge | option to change orientation of reads and sets Qscore to B | ipyrad/assemble/util.py | def fastq_touchup_for_vsearch_merge(read, outfile, reverse=False):
""" option to change orientation of reads and sets Qscore to B """
counts = 0
with open(outfile, 'w') as out:
## read in paired end read files 4 lines at a time
if read.endswith(".gz"):
fr1 = gzip.open(read, ... | def fastq_touchup_for_vsearch_merge(read, outfile, reverse=False):
""" option to change orientation of reads and sets Qscore to B """
counts = 0
with open(outfile, 'w') as out:
## read in paired end read files 4 lines at a time
if read.endswith(".gz"):
fr1 = gzip.open(read, ... | [
"option",
"to",
"change",
"orientation",
"of",
"reads",
"and",
"sets",
"Qscore",
"to",
"B"
] | dereneaton/ipyrad | python | https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/assemble/util.py#L284-L324 | [
"def",
"fastq_touchup_for_vsearch_merge",
"(",
"read",
",",
"outfile",
",",
"reverse",
"=",
"False",
")",
":",
"counts",
"=",
"0",
"with",
"open",
"(",
"outfile",
",",
"'w'",
")",
"as",
"out",
":",
"## read in paired end read files 4 lines at a time",
"if",
"rea... | 5eeb8a178160f45faf71bf47cec4abe998a575d1 |
valid | merge_pairs_after_refmapping | A function to merge fastq files produced by bam2fq. | ipyrad/assemble/util.py | def merge_pairs_after_refmapping(data, two_files, merged_out):
"""
A function to merge fastq files produced by bam2fq.
"""
## create temp files
nonmerged1 = tempfile.NamedTemporaryFile(
mode='wb',
dir=data.dirs.edits,
suffix="_nonmerged_R1_.fastq").name
nonmerged2 = te... | def merge_pairs_after_refmapping(data, two_files, merged_out):
"""
A function to merge fastq files produced by bam2fq.
"""
## create temp files
nonmerged1 = tempfile.NamedTemporaryFile(
mode='wb',
dir=data.dirs.edits,
suffix="_nonmerged_R1_.fastq").name
nonmerged2 = te... | [
"A",
"function",
"to",
"merge",
"fastq",
"files",
"produced",
"by",
"bam2fq",
"."
] | dereneaton/ipyrad | python | https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/assemble/util.py#L328-L439 | [
"def",
"merge_pairs_after_refmapping",
"(",
"data",
",",
"two_files",
",",
"merged_out",
")",
":",
"## create temp files ",
"nonmerged1",
"=",
"tempfile",
".",
"NamedTemporaryFile",
"(",
"mode",
"=",
"'wb'",
",",
"dir",
"=",
"data",
".",
"dirs",
".",
"edits",
... | 5eeb8a178160f45faf71bf47cec4abe998a575d1 |
valid | merge_after_pysam | This is for pysam post-flight merging. The input is a cluster
for an individual locus. We have to split the clusters, write
R1 and R2 to files then call merge_pairs(). This is not ideal,
it's slow, but it works. This is the absolute worst way to do this,
it bounces all the files for each locus off the d... | ipyrad/assemble/util.py | def merge_after_pysam(data, clust):
"""
This is for pysam post-flight merging. The input is a cluster
for an individual locus. We have to split the clusters, write
R1 and R2 to files then call merge_pairs(). This is not ideal,
it's slow, but it works. This is the absolute worst way to do this,
i... | def merge_after_pysam(data, clust):
"""
This is for pysam post-flight merging. The input is a cluster
for an individual locus. We have to split the clusters, write
R1 and R2 to files then call merge_pairs(). This is not ideal,
it's slow, but it works. This is the absolute worst way to do this,
i... | [
"This",
"is",
"for",
"pysam",
"post",
"-",
"flight",
"merging",
".",
"The",
"input",
"is",
"a",
"cluster",
"for",
"an",
"individual",
"locus",
".",
"We",
"have",
"to",
"split",
"the",
"clusters",
"write",
"R1",
"and",
"R2",
"to",
"files",
"then",
"call... | dereneaton/ipyrad | python | https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/assemble/util.py#L443-L517 | [
"def",
"merge_after_pysam",
"(",
"data",
",",
"clust",
")",
":",
"try",
":",
"r1file",
"=",
"tempfile",
".",
"NamedTemporaryFile",
"(",
"mode",
"=",
"'wb'",
",",
"delete",
"=",
"False",
",",
"dir",
"=",
"data",
".",
"dirs",
".",
"edits",
",",
"suffix",... | 5eeb8a178160f45faf71bf47cec4abe998a575d1 |
valid | merge_pairs | Merge PE reads. Takes in a list of unmerged files [r1, r2] and the
filehandle to write merged data to, and it returns the number of reads
that were merged (overlapping). If merge==0 then only concat pairs (nnnn),
no merging in vsearch.
Parameters
-----------
two_files (tuple):
A list or... | ipyrad/assemble/util.py | def merge_pairs(data, two_files, merged_out, revcomp, merge):
"""
Merge PE reads. Takes in a list of unmerged files [r1, r2] and the
filehandle to write merged data to, and it returns the number of reads
that were merged (overlapping). If merge==0 then only concat pairs (nnnn),
no merging in vsearch... | def merge_pairs(data, two_files, merged_out, revcomp, merge):
"""
Merge PE reads. Takes in a list of unmerged files [r1, r2] and the
filehandle to write merged data to, and it returns the number of reads
that were merged (overlapping). If merge==0 then only concat pairs (nnnn),
no merging in vsearch... | [
"Merge",
"PE",
"reads",
".",
"Takes",
"in",
"a",
"list",
"of",
"unmerged",
"files",
"[",
"r1",
"r2",
"]",
"and",
"the",
"filehandle",
"to",
"write",
"merged",
"data",
"to",
"and",
"it",
"returns",
"the",
"number",
"of",
"reads",
"that",
"were",
"merged... | dereneaton/ipyrad | python | https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/assemble/util.py#L521-L719 | [
"def",
"merge_pairs",
"(",
"data",
",",
"two_files",
",",
"merged_out",
",",
"revcomp",
",",
"merge",
")",
":",
"LOGGER",
".",
"debug",
"(",
"\"Entering merge_pairs()\"",
")",
"## Return the number of merged pairs",
"nmerged",
"=",
"-",
"1",
"## Check input files fr... | 5eeb8a178160f45faf71bf47cec4abe998a575d1 |
valid | revcomp | returns reverse complement of a string | ipyrad/assemble/util.py | def revcomp(sequence):
"returns reverse complement of a string"
sequence = sequence[::-1].strip()\
.replace("A", "t")\
.replace("T", "a")\
.replace("C", "g")\
.replace("G", "c").upper()
return... | def revcomp(sequence):
"returns reverse complement of a string"
sequence = sequence[::-1].strip()\
.replace("A", "t")\
.replace("T", "a")\
.replace("C", "g")\
.replace("G", "c").upper()
return... | [
"returns",
"reverse",
"complement",
"of",
"a",
"string"
] | dereneaton/ipyrad | python | https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/assemble/util.py#L798-L805 | [
"def",
"revcomp",
"(",
"sequence",
")",
":",
"sequence",
"=",
"sequence",
"[",
":",
":",
"-",
"1",
"]",
".",
"strip",
"(",
")",
".",
"replace",
"(",
"\"A\"",
",",
"\"t\"",
")",
".",
"replace",
"(",
"\"T\"",
",",
"\"a\"",
")",
".",
"replace",
"(",... | 5eeb8a178160f45faf71bf47cec4abe998a575d1 |
valid | clustdealer | return optim clusters given iterators, and whether it got all or not | ipyrad/assemble/util.py | def clustdealer(pairdealer, optim):
""" return optim clusters given iterators, and whether it got all or not"""
ccnt = 0
chunk = []
while ccnt < optim:
## try refreshing taker, else quit
try:
taker = itertools.takewhile(lambda x: x[0] != "//\n", pairdealer)
oneclu... | def clustdealer(pairdealer, optim):
""" return optim clusters given iterators, and whether it got all or not"""
ccnt = 0
chunk = []
while ccnt < optim:
## try refreshing taker, else quit
try:
taker = itertools.takewhile(lambda x: x[0] != "//\n", pairdealer)
oneclu... | [
"return",
"optim",
"clusters",
"given",
"iterators",
"and",
"whether",
"it",
"got",
"all",
"or",
"not"
] | dereneaton/ipyrad | python | https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/assemble/util.py#L865-L886 | [
"def",
"clustdealer",
"(",
"pairdealer",
",",
"optim",
")",
":",
"ccnt",
"=",
"0",
"chunk",
"=",
"[",
"]",
"while",
"ccnt",
"<",
"optim",
":",
"## try refreshing taker, else quit",
"try",
":",
"taker",
"=",
"itertools",
".",
"takewhile",
"(",
"lambda",
"x"... | 5eeb8a178160f45faf71bf47cec4abe998a575d1 |
valid | progressbar | prints a progress bar | ipyrad/assemble/util.py | def progressbar(njobs, finished, msg="", spacer=" "):
""" prints a progress bar """
if njobs:
progress = 100*(finished / float(njobs))
else:
progress = 100
hashes = '#'*int(progress/5.)
nohash = ' '*int(20-len(hashes))
if not ipyrad.__interactive__:
msg = msg.rs... | def progressbar(njobs, finished, msg="", spacer=" "):
""" prints a progress bar """
if njobs:
progress = 100*(finished / float(njobs))
else:
progress = 100
hashes = '#'*int(progress/5.)
nohash = ' '*int(20-len(hashes))
if not ipyrad.__interactive__:
msg = msg.rs... | [
"prints",
"a",
"progress",
"bar"
] | dereneaton/ipyrad | python | https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/assemble/util.py#L891-L905 | [
"def",
"progressbar",
"(",
"njobs",
",",
"finished",
",",
"msg",
"=",
"\"\"",
",",
"spacer",
"=",
"\" \"",
")",
":",
"if",
"njobs",
":",
"progress",
"=",
"100",
"*",
"(",
"finished",
"/",
"float",
"(",
"njobs",
")",
")",
"else",
":",
"progress",
"... | 5eeb8a178160f45faf71bf47cec4abe998a575d1 |
valid | get_threaded_view | gets optimum threaded view of ids given the host setup | ipyrad/assemble/util.py | def get_threaded_view(ipyclient, split=True):
""" gets optimum threaded view of ids given the host setup """
## engine ids
## e.g., [0, 1, 2, 3, 4, 5, 6, 7, 8]
eids = ipyclient.ids
## get host names
## e.g., ['a', 'a', 'b', 'b', 'a', 'c', 'c', 'c', 'c']
dview = ipyclient.direct_view()
h... | def get_threaded_view(ipyclient, split=True):
""" gets optimum threaded view of ids given the host setup """
## engine ids
## e.g., [0, 1, 2, 3, 4, 5, 6, 7, 8]
eids = ipyclient.ids
## get host names
## e.g., ['a', 'a', 'b', 'b', 'a', 'c', 'c', 'c', 'c']
dview = ipyclient.direct_view()
h... | [
"gets",
"optimum",
"threaded",
"view",
"of",
"ids",
"given",
"the",
"host",
"setup"
] | dereneaton/ipyrad | python | https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/assemble/util.py#L910-L956 | [
"def",
"get_threaded_view",
"(",
"ipyclient",
",",
"split",
"=",
"True",
")",
":",
"## engine ids",
"## e.g., [0, 1, 2, 3, 4, 5, 6, 7, 8]",
"eids",
"=",
"ipyclient",
".",
"ids",
"## get host names",
"## e.g., ['a', 'a', 'b', 'b', 'a', 'c', 'c', 'c', 'c']",
"dview",
"=",
"ip... | 5eeb8a178160f45faf71bf47cec4abe998a575d1 |
valid | detect_cpus | Detects the number of CPUs on a system. This is better than asking
ipyparallel since ipp has to wait for Engines to spin up. | ipyrad/assemble/util.py | def detect_cpus():
"""
Detects the number of CPUs on a system. This is better than asking
ipyparallel since ipp has to wait for Engines to spin up.
"""
# Linux, Unix and MacOS:
if hasattr(os, "sysconf"):
if os.sysconf_names.has_key("SC_NPROCESSORS_ONLN"):
# Linux & Unix:
... | def detect_cpus():
"""
Detects the number of CPUs on a system. This is better than asking
ipyparallel since ipp has to wait for Engines to spin up.
"""
# Linux, Unix and MacOS:
if hasattr(os, "sysconf"):
if os.sysconf_names.has_key("SC_NPROCESSORS_ONLN"):
# Linux & Unix:
... | [
"Detects",
"the",
"number",
"of",
"CPUs",
"on",
"a",
"system",
".",
"This",
"is",
"better",
"than",
"asking",
"ipyparallel",
"since",
"ipp",
"has",
"to",
"wait",
"for",
"Engines",
"to",
"spin",
"up",
"."
] | dereneaton/ipyrad | python | https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/assemble/util.py#L962-L981 | [
"def",
"detect_cpus",
"(",
")",
":",
"# Linux, Unix and MacOS:",
"if",
"hasattr",
"(",
"os",
",",
"\"sysconf\"",
")",
":",
"if",
"os",
".",
"sysconf_names",
".",
"has_key",
"(",
"\"SC_NPROCESSORS_ONLN\"",
")",
":",
"# Linux & Unix:",
"ncpus",
"=",
"os",
".",
... | 5eeb8a178160f45faf71bf47cec4abe998a575d1 |
valid | _call_structure | make the subprocess call to structure | ipyrad/analysis/structure.py | def _call_structure(mname, ename, sname, name, workdir, seed, ntaxa, nsites, kpop, rep):
""" make the subprocess call to structure """
## create call string
outname = os.path.join(workdir, "{}-K-{}-rep-{}".format(name, kpop, rep))
cmd = ["structure",
"-m", mname,
"-e", ename,
... | def _call_structure(mname, ename, sname, name, workdir, seed, ntaxa, nsites, kpop, rep):
""" make the subprocess call to structure """
## create call string
outname = os.path.join(workdir, "{}-K-{}-rep-{}".format(name, kpop, rep))
cmd = ["structure",
"-m", mname,
"-e", ename,
... | [
"make",
"the",
"subprocess",
"call",
"to",
"structure"
] | dereneaton/ipyrad | python | https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/analysis/structure.py#L450-L476 | [
"def",
"_call_structure",
"(",
"mname",
",",
"ename",
",",
"sname",
",",
"name",
",",
"workdir",
",",
"seed",
",",
"ntaxa",
",",
"nsites",
",",
"kpop",
",",
"rep",
")",
":",
"## create call string",
"outname",
"=",
"os",
".",
"path",
".",
"join",
"(",
... | 5eeb8a178160f45faf71bf47cec4abe998a575d1 |
valid | _get_clumpp_table | private function to clumpp results | ipyrad/analysis/structure.py | def _get_clumpp_table(self, kpop, max_var_multiple, quiet):
""" private function to clumpp results"""
## concat results for k=x
reps, excluded = _concat_reps(self, kpop, max_var_multiple, quiet)
if reps:
ninds = reps[0].inds
nreps = len(reps)
else:
ninds = nreps = 0
if n... | def _get_clumpp_table(self, kpop, max_var_multiple, quiet):
""" private function to clumpp results"""
## concat results for k=x
reps, excluded = _concat_reps(self, kpop, max_var_multiple, quiet)
if reps:
ninds = reps[0].inds
nreps = len(reps)
else:
ninds = nreps = 0
if n... | [
"private",
"function",
"to",
"clumpp",
"results"
] | dereneaton/ipyrad | python | https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/analysis/structure.py#L626-L690 | [
"def",
"_get_clumpp_table",
"(",
"self",
",",
"kpop",
",",
"max_var_multiple",
",",
"quiet",
")",
":",
"## concat results for k=x",
"reps",
",",
"excluded",
"=",
"_concat_reps",
"(",
"self",
",",
"kpop",
",",
"max_var_multiple",
",",
"quiet",
")",
"if",
"reps"... | 5eeb8a178160f45faf71bf47cec4abe998a575d1 |
valid | _concat_reps | Combine structure replicates into a single indfile,
returns nreps, ninds. Excludes reps with too high of
variance (set with max_variance_multiplier) to exclude
runs that did not converge. | ipyrad/analysis/structure.py | def _concat_reps(self, kpop, max_var_multiple, quiet, **kwargs):
"""
Combine structure replicates into a single indfile,
returns nreps, ninds. Excludes reps with too high of
variance (set with max_variance_multiplier) to exclude
runs that did not converge.
"""
## make an output handle... | def _concat_reps(self, kpop, max_var_multiple, quiet, **kwargs):
"""
Combine structure replicates into a single indfile,
returns nreps, ninds. Excludes reps with too high of
variance (set with max_variance_multiplier) to exclude
runs that did not converge.
"""
## make an output handle... | [
"Combine",
"structure",
"replicates",
"into",
"a",
"single",
"indfile",
"returns",
"nreps",
"ninds",
".",
"Excludes",
"reps",
"with",
"too",
"high",
"of",
"variance",
"(",
"set",
"with",
"max_variance_multiplier",
")",
"to",
"exclude",
"runs",
"that",
"did",
"... | dereneaton/ipyrad | python | https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/analysis/structure.py#L694-L748 | [
"def",
"_concat_reps",
"(",
"self",
",",
"kpop",
",",
"max_var_multiple",
",",
"quiet",
",",
"*",
"*",
"kwargs",
")",
":",
"## make an output handle",
"outf",
"=",
"os",
".",
"path",
".",
"join",
"(",
"self",
".",
"workdir",
",",
"\"{}-K-{}.indfile\"",
"."... | 5eeb8a178160f45faf71bf47cec4abe998a575d1 |
valid | _get_evanno_table | Calculates Evanno method K value scores for a series
of permuted clumpp results. | ipyrad/analysis/structure.py | def _get_evanno_table(self, kpops, max_var_multiple, quiet):
"""
Calculates Evanno method K value scores for a series
of permuted clumpp results.
"""
## iterate across k-vals
kpops = sorted(kpops)
replnliks = []
for kpop in kpops:
## concat results for k=x
reps, exclud... | def _get_evanno_table(self, kpops, max_var_multiple, quiet):
"""
Calculates Evanno method K value scores for a series
of permuted clumpp results.
"""
## iterate across k-vals
kpops = sorted(kpops)
replnliks = []
for kpop in kpops:
## concat results for k=x
reps, exclud... | [
"Calculates",
"Evanno",
"method",
"K",
"value",
"scores",
"for",
"a",
"series",
"of",
"permuted",
"clumpp",
"results",
"."
] | dereneaton/ipyrad | python | https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/analysis/structure.py#L752-L819 | [
"def",
"_get_evanno_table",
"(",
"self",
",",
"kpops",
",",
"max_var_multiple",
",",
"quiet",
")",
":",
"## iterate across k-vals",
"kpops",
"=",
"sorted",
"(",
"kpops",
")",
"replnliks",
"=",
"[",
"]",
"for",
"kpop",
"in",
"kpops",
":",
"## concat results for... | 5eeb8a178160f45faf71bf47cec4abe998a575d1 |
valid | Structure.result_files | returns a list of files that have finished structure | ipyrad/analysis/structure.py | def result_files(self):
""" returns a list of files that have finished structure """
reps = OPJ(self.workdir, self.name+"-K-*-rep-*_f")
repfiles = glob.glob(reps)
return repfiles | def result_files(self):
""" returns a list of files that have finished structure """
reps = OPJ(self.workdir, self.name+"-K-*-rep-*_f")
repfiles = glob.glob(reps)
return repfiles | [
"returns",
"a",
"list",
"of",
"files",
"that",
"have",
"finished",
"structure"
] | dereneaton/ipyrad | python | https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/analysis/structure.py#L147-L151 | [
"def",
"result_files",
"(",
"self",
")",
":",
"reps",
"=",
"OPJ",
"(",
"self",
".",
"workdir",
",",
"self",
".",
"name",
"+",
"\"-K-*-rep-*_f\"",
")",
"repfiles",
"=",
"glob",
".",
"glob",
"(",
"reps",
")",
"return",
"repfiles"
] | 5eeb8a178160f45faf71bf47cec4abe998a575d1 |
valid | Structure.run | submits a job to run on the cluster and returns an asynchronous result
object. K is the number of populations, randomseed if not set will be
randomly drawn, ipyclient if not entered will raise an error. If nreps
is set then multiple jobs will be started from new seeds, each labeled
by i... | ipyrad/analysis/structure.py | def run(self,
kpop,
nreps,
ipyclient=None,
seed=12345,
force=False,
quiet=False,
):
"""
submits a job to run on the cluster and returns an asynchronous result
object. K is the number of populations, randomseed if not set will be
... | def run(self,
kpop,
nreps,
ipyclient=None,
seed=12345,
force=False,
quiet=False,
):
"""
submits a job to run on the cluster and returns an asynchronous result
object. K is the number of populations, randomseed if not set will be
... | [
"submits",
"a",
"job",
"to",
"run",
"on",
"the",
"cluster",
"and",
"returns",
"an",
"asynchronous",
"result",
"object",
".",
"K",
"is",
"the",
"number",
"of",
"populations",
"randomseed",
"if",
"not",
"set",
"will",
"be",
"randomly",
"drawn",
"ipyclient",
... | dereneaton/ipyrad | python | https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/analysis/structure.py#L154-L289 | [
"def",
"run",
"(",
"self",
",",
"kpop",
",",
"nreps",
",",
"ipyclient",
"=",
"None",
",",
"seed",
"=",
"12345",
",",
"force",
"=",
"False",
",",
"quiet",
"=",
"False",
",",
")",
":",
"## initiate starting seed",
"np",
".",
"random",
".",
"seed",
"(",... | 5eeb8a178160f45faf71bf47cec4abe998a575d1 |
valid | Structure.write_structure_files | Prepares input files for running structure. Users typically do not need
to call this function since it is called internally by .run(). But it
is optionally available here in case users wish to generate files and
run structure separately. | ipyrad/analysis/structure.py | def write_structure_files(self, kpop, rep=1):
"""
Prepares input files for running structure. Users typically do not need
to call this function since it is called internally by .run(). But it
is optionally available here in case users wish to generate files and
run structure se... | def write_structure_files(self, kpop, rep=1):
"""
Prepares input files for running structure. Users typically do not need
to call this function since it is called internally by .run(). But it
is optionally available here in case users wish to generate files and
run structure se... | [
"Prepares",
"input",
"files",
"for",
"running",
"structure",
".",
"Users",
"typically",
"do",
"not",
"need",
"to",
"call",
"this",
"function",
"since",
"it",
"is",
"called",
"internally",
"by",
".",
"run",
"()",
".",
"But",
"it",
"is",
"optionally",
"avail... | dereneaton/ipyrad | python | https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/analysis/structure.py#L293-L355 | [
"def",
"write_structure_files",
"(",
"self",
",",
"kpop",
",",
"rep",
"=",
"1",
")",
":",
"## check params",
"self",
".",
"mainparams",
".",
"numreps",
"=",
"int",
"(",
"self",
".",
"mainparams",
".",
"numreps",
")",
"self",
".",
"mainparams",
".",
"burn... | 5eeb8a178160f45faf71bf47cec4abe998a575d1 |
valid | Structure.get_clumpp_table | Returns a dictionary of results tables for making structure barplots.
This calls the same functions used in get_evanno_table() to call
CLUMPP to permute replicates.
Parameters:
-----------
kvalues : list or int
A kvalue or list of kvalues to run CLUMPP on and return... | ipyrad/analysis/structure.py | def get_clumpp_table(self, kvalues, max_var_multiple=0, quiet=False):
"""
Returns a dictionary of results tables for making structure barplots.
This calls the same functions used in get_evanno_table() to call
CLUMPP to permute replicates.
Parameters:
-----------
... | def get_clumpp_table(self, kvalues, max_var_multiple=0, quiet=False):
"""
Returns a dictionary of results tables for making structure barplots.
This calls the same functions used in get_evanno_table() to call
CLUMPP to permute replicates.
Parameters:
-----------
... | [
"Returns",
"a",
"dictionary",
"of",
"results",
"tables",
"for",
"making",
"structure",
"barplots",
".",
"This",
"calls",
"the",
"same",
"functions",
"used",
"in",
"get_evanno_table",
"()",
"to",
"call",
"CLUMPP",
"to",
"permute",
"replicates",
"."
] | dereneaton/ipyrad | python | https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/analysis/structure.py#L359-L399 | [
"def",
"get_clumpp_table",
"(",
"self",
",",
"kvalues",
",",
"max_var_multiple",
"=",
"0",
",",
"quiet",
"=",
"False",
")",
":",
"## do not allow bad vals",
"if",
"max_var_multiple",
":",
"if",
"max_var_multiple",
"<",
"1",
":",
"raise",
"ValueError",
"(",
"'m... | 5eeb8a178160f45faf71bf47cec4abe998a575d1 |
valid | Structure.get_evanno_table | Calculates the Evanno table from results files for tests with
K-values in the input list kvalues. The values lnPK, lnPPK,
and deltaK are calculated. The max_var_multiplier arg can be used
to exclude results files based on variance of the likelihood as a
proxy for convergence.
... | ipyrad/analysis/structure.py | def get_evanno_table(self, kvalues, max_var_multiple=0, quiet=False):
"""
Calculates the Evanno table from results files for tests with
K-values in the input list kvalues. The values lnPK, lnPPK,
and deltaK are calculated. The max_var_multiplier arg can be used
to exclude result... | def get_evanno_table(self, kvalues, max_var_multiple=0, quiet=False):
"""
Calculates the Evanno table from results files for tests with
K-values in the input list kvalues. The values lnPK, lnPPK,
and deltaK are calculated. The max_var_multiplier arg can be used
to exclude result... | [
"Calculates",
"the",
"Evanno",
"table",
"from",
"results",
"files",
"for",
"tests",
"with",
"K",
"-",
"values",
"in",
"the",
"input",
"list",
"kvalues",
".",
"The",
"values",
"lnPK",
"lnPPK",
"and",
"deltaK",
"are",
"calculated",
".",
"The",
"max_var_multipl... | dereneaton/ipyrad | python | https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/analysis/structure.py#L403-L444 | [
"def",
"get_evanno_table",
"(",
"self",
",",
"kvalues",
",",
"max_var_multiple",
"=",
"0",
",",
"quiet",
"=",
"False",
")",
":",
"## do not allow bad vals",
"if",
"max_var_multiple",
":",
"if",
"max_var_multiple",
"<",
"1",
":",
"raise",
"ValueError",
"(",
"'m... | 5eeb8a178160f45faf71bf47cec4abe998a575d1 |
valid | Rep.parse | parse an _f structure output file | ipyrad/analysis/structure.py | def parse(self, psearch, dsearch):
""" parse an _f structure output file """
stable = ""
with open(self.repfile) as orep:
dat = orep.readlines()
for line in dat:
## stat lines
if "Estimated Ln Prob of Data" in line:
self... | def parse(self, psearch, dsearch):
""" parse an _f structure output file """
stable = ""
with open(self.repfile) as orep:
dat = orep.readlines()
for line in dat:
## stat lines
if "Estimated Ln Prob of Data" in line:
self... | [
"parse",
"an",
"_f",
"structure",
"output",
"file"
] | dereneaton/ipyrad | python | https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/analysis/structure.py#L843-L892 | [
"def",
"parse",
"(",
"self",
",",
"psearch",
",",
"dsearch",
")",
":",
"stable",
"=",
"\"\"",
"with",
"open",
"(",
"self",
".",
"repfile",
")",
"as",
"orep",
":",
"dat",
"=",
"orep",
".",
"readlines",
"(",
")",
"for",
"line",
"in",
"dat",
":",
"#... | 5eeb8a178160f45faf71bf47cec4abe998a575d1 |
valid | _call_raxml | call the command as sps | ipyrad/analysis/raxml.py | def _call_raxml(command_list):
""" call the command as sps """
proc = subprocess.Popen(
command_list,
stderr=subprocess.STDOUT,
stdout=subprocess.PIPE
)
comm = proc.communicate()
return comm | def _call_raxml(command_list):
""" call the command as sps """
proc = subprocess.Popen(
command_list,
stderr=subprocess.STDOUT,
stdout=subprocess.PIPE
)
comm = proc.communicate()
return comm | [
"call",
"the",
"command",
"as",
"sps"
] | dereneaton/ipyrad | python | https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/analysis/raxml.py#L254-L262 | [
"def",
"_call_raxml",
"(",
"command_list",
")",
":",
"proc",
"=",
"subprocess",
".",
"Popen",
"(",
"command_list",
",",
"stderr",
"=",
"subprocess",
".",
"STDOUT",
",",
"stdout",
"=",
"subprocess",
".",
"PIPE",
")",
"comm",
"=",
"proc",
".",
"communicate",... | 5eeb8a178160f45faf71bf47cec4abe998a575d1 |
valid | Raxml._command_list | build the command list | ipyrad/analysis/raxml.py | def _command_list(self):
""" build the command list """
cmd = [self.params.binary,
"-f", str(self.params.f),
"-T", str(self.params.T),
"-m", str(self.params.m),
"-N", str(self.params.N),
"-x", str(self.params.x),
... | def _command_list(self):
""" build the command list """
cmd = [self.params.binary,
"-f", str(self.params.f),
"-T", str(self.params.T),
"-m", str(self.params.m),
"-N", str(self.params.N),
"-x", str(self.params.x),
... | [
"build",
"the",
"command",
"list"
] | dereneaton/ipyrad | python | https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/analysis/raxml.py#L125-L142 | [
"def",
"_command_list",
"(",
"self",
")",
":",
"cmd",
"=",
"[",
"self",
".",
"params",
".",
"binary",
",",
"\"-f\"",
",",
"str",
"(",
"self",
".",
"params",
".",
"f",
")",
",",
"\"-T\"",
",",
"str",
"(",
"self",
".",
"params",
".",
"T",
")",
",... | 5eeb8a178160f45faf71bf47cec4abe998a575d1 |
valid | Raxml.run | Submits raxml job to run. If no ipyclient object is provided then
the function will block until the raxml run is finished. If an ipyclient
is provided then the job is sent to a remote engine and an asynchronous
result object is returned which can be queried or awaited until it finishes.
... | ipyrad/analysis/raxml.py | def run(self,
ipyclient=None,
quiet=False,
force=False,
block=False,
):
"""
Submits raxml job to run. If no ipyclient object is provided then
the function will block until the raxml run is finished. If an ipyclient
is provided then the job is se... | def run(self,
ipyclient=None,
quiet=False,
force=False,
block=False,
):
"""
Submits raxml job to run. If no ipyclient object is provided then
the function will block until the raxml run is finished. If an ipyclient
is provided then the job is se... | [
"Submits",
"raxml",
"job",
"to",
"run",
".",
"If",
"no",
"ipyclient",
"object",
"is",
"provided",
"then",
"the",
"function",
"will",
"block",
"until",
"the",
"raxml",
"run",
"is",
"finished",
".",
"If",
"an",
"ipyclient",
"is",
"provided",
"then",
"the",
... | dereneaton/ipyrad | python | https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/analysis/raxml.py#L151-L207 | [
"def",
"run",
"(",
"self",
",",
"ipyclient",
"=",
"None",
",",
"quiet",
"=",
"False",
",",
"force",
"=",
"False",
",",
"block",
"=",
"False",
",",
")",
":",
"## stop before trying in raxml",
"if",
"force",
":",
"for",
"key",
",",
"oldfile",
"in",
"self... | 5eeb8a178160f45faf71bf47cec4abe998a575d1 |
valid | Raxml._get_binary | find binaries available | ipyrad/analysis/raxml.py | def _get_binary(self):
""" find binaries available"""
## check for binary
backup_binaries = ["raxmlHPC-PTHREADS", "raxmlHPC-PTHREADS-SSE3"]
## check user binary first, then backups
for binary in [self.params.binary] + backup_binaries:
proc = subprocess.Popen(["which... | def _get_binary(self):
""" find binaries available"""
## check for binary
backup_binaries = ["raxmlHPC-PTHREADS", "raxmlHPC-PTHREADS-SSE3"]
## check user binary first, then backups
for binary in [self.params.binary] + backup_binaries:
proc = subprocess.Popen(["which... | [
"find",
"binaries",
"available"
] | dereneaton/ipyrad | python | https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/analysis/raxml.py#L211-L228 | [
"def",
"_get_binary",
"(",
"self",
")",
":",
"## check for binary",
"backup_binaries",
"=",
"[",
"\"raxmlHPC-PTHREADS\"",
",",
"\"raxmlHPC-PTHREADS-SSE3\"",
"]",
"## check user binary first, then backups",
"for",
"binary",
"in",
"[",
"self",
".",
"params",
".",
"binary"... | 5eeb8a178160f45faf71bf47cec4abe998a575d1 |
valid | share_matrix | returns a matrix of shared RAD-seq data
Parameters:
-----------
locifile (str):
Path to a ipyrad .loci file.
tree (str):
Path to Newick file or a Newick string representation of
a tree. If used, names will be ordered by the ladderized
tip order.
nameorder (lis... | ipyrad/plotting/share_panel_plot.py | def share_matrix(locifile, tree=None, nameorder=None):
"""
returns a matrix of shared RAD-seq data
Parameters:
-----------
locifile (str):
Path to a ipyrad .loci file.
tree (str):
Path to Newick file or a Newick string representation of
a tree. If used, names will... | def share_matrix(locifile, tree=None, nameorder=None):
"""
returns a matrix of shared RAD-seq data
Parameters:
-----------
locifile (str):
Path to a ipyrad .loci file.
tree (str):
Path to Newick file or a Newick string representation of
a tree. If used, names will... | [
"returns",
"a",
"matrix",
"of",
"shared",
"RAD",
"-",
"seq",
"data",
"Parameters",
":",
"-----------",
"locifile",
"(",
"str",
")",
":",
"Path",
"to",
"a",
"ipyrad",
".",
"loci",
"file",
".",
"tree",
"(",
"str",
")",
":",
"Path",
"to",
"Newick",
"fil... | dereneaton/ipyrad | python | https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/plotting/share_panel_plot.py#L86-L128 | [
"def",
"share_matrix",
"(",
"locifile",
",",
"tree",
"=",
"None",
",",
"nameorder",
"=",
"None",
")",
":",
"## load in the loci data",
"with",
"open",
"(",
"locifile",
",",
"'r'",
")",
"as",
"locidata",
":",
"loci",
"=",
"locidata",
".",
"read",
"(",
")"... | 5eeb8a178160f45faf71bf47cec4abe998a575d1 |
valid | _getarray | parse loci list and return presence/absence matrix
ordered by the tips on the tree or list of names. | ipyrad/plotting/share_panel_plot.py | def _getarray(loci, snames):
"""
parse loci list and return presence/absence matrix
ordered by the tips on the tree or list of names.
"""
## make an empty matrix
lxs = np.zeros((len(snames), len(loci)), dtype=np.uint64)
## fill the matrix
for loc in xrange(len(loci)):
for seq i... | def _getarray(loci, snames):
"""
parse loci list and return presence/absence matrix
ordered by the tips on the tree or list of names.
"""
## make an empty matrix
lxs = np.zeros((len(snames), len(loci)), dtype=np.uint64)
## fill the matrix
for loc in xrange(len(loci)):
for seq i... | [
"parse",
"loci",
"list",
"and",
"return",
"presence",
"/",
"absence",
"matrix",
"ordered",
"by",
"the",
"tips",
"on",
"the",
"tree",
"or",
"list",
"of",
"names",
"."
] | dereneaton/ipyrad | python | https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/plotting/share_panel_plot.py#L262-L276 | [
"def",
"_getarray",
"(",
"loci",
",",
"snames",
")",
":",
"## make an empty matrix",
"lxs",
"=",
"np",
".",
"zeros",
"(",
"(",
"len",
"(",
"snames",
")",
",",
"len",
"(",
"loci",
")",
")",
",",
"dtype",
"=",
"np",
".",
"uint64",
")",
"## fill the mat... | 5eeb8a178160f45faf71bf47cec4abe998a575d1 |
valid | batch | distributes jobs to the parallel client | ipyrad/analysis/baba.py | def batch(
baba,
ipyclient=None,
):
"""
distributes jobs to the parallel client
"""
## parse args
handle = baba.data
taxdicts = baba.tests
mindicts = baba.params.mincov
nboots = baba.params.nboots
## if ms generator make into reusable list
sims = 0
if isinstance... | def batch(
baba,
ipyclient=None,
):
"""
distributes jobs to the parallel client
"""
## parse args
handle = baba.data
taxdicts = baba.tests
mindicts = baba.params.mincov
nboots = baba.params.nboots
## if ms generator make into reusable list
sims = 0
if isinstance... | [
"distributes",
"jobs",
"to",
"the",
"parallel",
"client"
] | dereneaton/ipyrad | python | https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/analysis/baba.py#L291-L469 | [
"def",
"batch",
"(",
"baba",
",",
"ipyclient",
"=",
"None",
",",
")",
":",
"## parse args",
"handle",
"=",
"baba",
".",
"data",
"taxdicts",
"=",
"baba",
".",
"tests",
"mindicts",
"=",
"baba",
".",
"params",
".",
"mincov",
"nboots",
"=",
"baba",
".",
... | 5eeb8a178160f45faf71bf47cec4abe998a575d1 |
valid | dstat | private function to perform a single D-stat test | ipyrad/analysis/baba.py | def dstat(inarr, taxdict, mindict=1, nboots=1000, name=0):
""" private function to perform a single D-stat test"""
#if isinstance(inarr, str):
# with open(inarr, 'r') as infile:
# inarr = infile.read().strip().split("|\n")
# ## get data as an array from loci file
# ## if loci-list th... | def dstat(inarr, taxdict, mindict=1, nboots=1000, name=0):
""" private function to perform a single D-stat test"""
#if isinstance(inarr, str):
# with open(inarr, 'r') as infile:
# inarr = infile.read().strip().split("|\n")
# ## get data as an array from loci file
# ## if loci-list th... | [
"private",
"function",
"to",
"perform",
"a",
"single",
"D",
"-",
"stat",
"test"
] | dereneaton/ipyrad | python | https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/analysis/baba.py#L474-L522 | [
"def",
"dstat",
"(",
"inarr",
",",
"taxdict",
",",
"mindict",
"=",
"1",
",",
"nboots",
"=",
"1000",
",",
"name",
"=",
"0",
")",
":",
"#if isinstance(inarr, str):",
"# with open(inarr, 'r') as infile:",
"# inarr = infile.read().strip().split(\"|\\n\")",
"# ## g... | 5eeb8a178160f45faf71bf47cec4abe998a575d1 |
valid | _loci_to_arr | return a frequency array from a loci file for all loci with taxa from
taxdict and min coverage from mindict. | ipyrad/analysis/baba.py | def _loci_to_arr(loci, taxdict, mindict):
"""
return a frequency array from a loci file for all loci with taxa from
taxdict and min coverage from mindict.
"""
## make the array (4 or 5) and a mask array to remove loci without cov
nloci = len(loci)
maxlen = np.max(np.array([len(locus.split... | def _loci_to_arr(loci, taxdict, mindict):
"""
return a frequency array from a loci file for all loci with taxa from
taxdict and min coverage from mindict.
"""
## make the array (4 or 5) and a mask array to remove loci without cov
nloci = len(loci)
maxlen = np.max(np.array([len(locus.split... | [
"return",
"a",
"frequency",
"array",
"from",
"a",
"loci",
"file",
"for",
"all",
"loci",
"with",
"taxa",
"from",
"taxdict",
"and",
"min",
"coverage",
"from",
"mindict",
"."
] | dereneaton/ipyrad | python | https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/analysis/baba.py#L526-L644 | [
"def",
"_loci_to_arr",
"(",
"loci",
",",
"taxdict",
",",
"mindict",
")",
":",
"## make the array (4 or 5) and a mask array to remove loci without cov",
"nloci",
"=",
"len",
"(",
"loci",
")",
"maxlen",
"=",
"np",
".",
"max",
"(",
"np",
".",
"array",
"(",
"[",
"... | 5eeb8a178160f45faf71bf47cec4abe998a575d1 |
valid | _get_boots | return array of bootstrap D-stats | ipyrad/analysis/baba.py | def _get_boots(arr, nboots):
"""
return array of bootstrap D-stats
"""
## hold results (nboots, [dstat, ])
boots = np.zeros((nboots,))
## iterate to fill boots
for bidx in xrange(nboots):
## sample with replacement
lidx = np.random.randint(0, arr.shape[0], arr.shape[0])
... | def _get_boots(arr, nboots):
"""
return array of bootstrap D-stats
"""
## hold results (nboots, [dstat, ])
boots = np.zeros((nboots,))
## iterate to fill boots
for bidx in xrange(nboots):
## sample with replacement
lidx = np.random.randint(0, arr.shape[0], arr.shape[0])
... | [
"return",
"array",
"of",
"bootstrap",
"D",
"-",
"stats"
] | dereneaton/ipyrad | python | https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/analysis/baba.py#L811-L827 | [
"def",
"_get_boots",
"(",
"arr",
",",
"nboots",
")",
":",
"## hold results (nboots, [dstat, ])",
"boots",
"=",
"np",
".",
"zeros",
"(",
"(",
"nboots",
",",
")",
")",
"## iterate to fill boots",
"for",
"bidx",
"in",
"xrange",
"(",
"nboots",
")",
":",
"## samp... | 5eeb8a178160f45faf71bf47cec4abe998a575d1 |
valid | _get_signif_4 | returns a list of stats and an array of dstat boots. Stats includes
z-score and two-sided P-value. | ipyrad/analysis/baba.py | def _get_signif_4(arr, nboots):
"""
returns a list of stats and an array of dstat boots. Stats includes
z-score and two-sided P-value.
"""
abba, baba, dst = _prop_dstat(arr)
boots = _get_boots(arr, nboots)
estimate, stddev = (boots.mean(), boots.std())
zscore = 0.
if stddev:
... | def _get_signif_4(arr, nboots):
"""
returns a list of stats and an array of dstat boots. Stats includes
z-score and two-sided P-value.
"""
abba, baba, dst = _prop_dstat(arr)
boots = _get_boots(arr, nboots)
estimate, stddev = (boots.mean(), boots.std())
zscore = 0.
if stddev:
... | [
"returns",
"a",
"list",
"of",
"stats",
"and",
"an",
"array",
"of",
"dstat",
"boots",
".",
"Stats",
"includes",
"z",
"-",
"score",
"and",
"two",
"-",
"sided",
"P",
"-",
"value",
"."
] | dereneaton/ipyrad | python | https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/analysis/baba.py#L832-L844 | [
"def",
"_get_signif_4",
"(",
"arr",
",",
"nboots",
")",
":",
"abba",
",",
"baba",
",",
"dst",
"=",
"_prop_dstat",
"(",
"arr",
")",
"boots",
"=",
"_get_boots",
"(",
"arr",
",",
"nboots",
")",
"estimate",
",",
"stddev",
"=",
"(",
"boots",
".",
"mean",
... | 5eeb8a178160f45faf71bf47cec4abe998a575d1 |
valid | _get_signif_5 | returns a list of stats and an array of dstat boots. Stats includes
z-score and two-sided P-value. | ipyrad/analysis/baba.py | def _get_signif_5(arr, nboots):
"""
returns a list of stats and an array of dstat boots. Stats includes
z-score and two-sided P-value.
"""
statsarr = np.zeros((3, 7), dtype=np.float64)
bootsarr = np.zeros((3, nboots))
idx = 0
for acol in [2, 3, 4]:
rows = np.array([0, 1, acol,... | def _get_signif_5(arr, nboots):
"""
returns a list of stats and an array of dstat boots. Stats includes
z-score and two-sided P-value.
"""
statsarr = np.zeros((3, 7), dtype=np.float64)
bootsarr = np.zeros((3, nboots))
idx = 0
for acol in [2, 3, 4]:
rows = np.array([0, 1, acol,... | [
"returns",
"a",
"list",
"of",
"stats",
"and",
"an",
"array",
"of",
"dstat",
"boots",
".",
"Stats",
"includes",
"z",
"-",
"score",
"and",
"two",
"-",
"sided",
"P",
"-",
"value",
"."
] | dereneaton/ipyrad | python | https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/analysis/baba.py#L849-L876 | [
"def",
"_get_signif_5",
"(",
"arr",
",",
"nboots",
")",
":",
"statsarr",
"=",
"np",
".",
"zeros",
"(",
"(",
"3",
",",
"7",
")",
",",
"dtype",
"=",
"np",
".",
"float64",
")",
"bootsarr",
"=",
"np",
".",
"zeros",
"(",
"(",
"3",
",",
"nboots",
")"... | 5eeb8a178160f45faf71bf47cec4abe998a575d1 |
valid | _simulate | Enter a baba.Tree object in which the 'tree' attribute (newick
derived tree) has edge lengths in units of generations. You can
use the 'gen' parameter to multiply branch lengths by a constant.
Parameters:
-----------
nreps: (int)
Number of reps (loci) to simulate under the demographic s... | ipyrad/analysis/baba.py | def _simulate(self, nreps, admix=None, Ns=500000, gen=20):
"""
Enter a baba.Tree object in which the 'tree' attribute (newick
derived tree) has edge lengths in units of generations. You can
use the 'gen' parameter to multiply branch lengths by a constant.
Parameters:
-----------
nreps: ... | def _simulate(self, nreps, admix=None, Ns=500000, gen=20):
"""
Enter a baba.Tree object in which the 'tree' attribute (newick
derived tree) has edge lengths in units of generations. You can
use the 'gen' parameter to multiply branch lengths by a constant.
Parameters:
-----------
nreps: ... | [
"Enter",
"a",
"baba",
".",
"Tree",
"object",
"in",
"which",
"the",
"tree",
"attribute",
"(",
"newick",
"derived",
"tree",
")",
"has",
"edge",
"lengths",
"in",
"units",
"of",
"generations",
".",
"You",
"can",
"use",
"the",
"gen",
"parameter",
"to",
"multi... | dereneaton/ipyrad | python | https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/analysis/baba.py#L895-L988 | [
"def",
"_simulate",
"(",
"self",
",",
"nreps",
",",
"admix",
"=",
"None",
",",
"Ns",
"=",
"500000",
",",
"gen",
"=",
"20",
")",
":",
"## node ages",
"Taus",
"=",
"np",
".",
"array",
"(",
"list",
"(",
"set",
"(",
"self",
".",
"verts",
"[",
":",
... | 5eeb8a178160f45faf71bf47cec4abe998a575d1 |
valid | Baba.taxon_table | Returns the .tests list of taxa as a pandas dataframe.
By auto-generating this table from tests it means that
the table itself cannot be modified unless it is returned
and saved. | ipyrad/analysis/baba.py | def taxon_table(self):
"""
Returns the .tests list of taxa as a pandas dataframe.
By auto-generating this table from tests it means that
the table itself cannot be modified unless it is returned
and saved.
"""
if self.tests:
keys = sorted(self.test... | def taxon_table(self):
"""
Returns the .tests list of taxa as a pandas dataframe.
By auto-generating this table from tests it means that
the table itself cannot be modified unless it is returned
and saved.
"""
if self.tests:
keys = sorted(self.test... | [
"Returns",
"the",
".",
"tests",
"list",
"of",
"taxa",
"as",
"a",
"pandas",
"dataframe",
".",
"By",
"auto",
"-",
"generating",
"this",
"table",
"from",
"tests",
"it",
"means",
"that",
"the",
"table",
"itself",
"cannot",
"be",
"modified",
"unless",
"it",
"... | dereneaton/ipyrad | python | https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/analysis/baba.py#L117-L134 | [
"def",
"taxon_table",
"(",
"self",
")",
":",
"if",
"self",
".",
"tests",
":",
"keys",
"=",
"sorted",
"(",
"self",
".",
"tests",
"[",
"0",
"]",
".",
"keys",
"(",
")",
")",
"if",
"isinstance",
"(",
"self",
".",
"tests",
",",
"list",
")",
":",
"ld... | 5eeb8a178160f45faf71bf47cec4abe998a575d1 |
valid | Baba.run | Run a batch of dstat tests on a list of tests, where each test is
a dictionary mapping sample names to {p1 - p4} (and sometimes p5).
Parameters modifying the behavior of the run, such as the number
of bootstrap replicates (nboots) or the minimum coverage for
loci (mincov) can be set i... | ipyrad/analysis/baba.py | def run(self,
ipyclient=None,
):
"""
Run a batch of dstat tests on a list of tests, where each test is
a dictionary mapping sample names to {p1 - p4} (and sometimes p5).
Parameters modifying the behavior of the run, such as the number
of bootstrap replicates (n... | def run(self,
ipyclient=None,
):
"""
Run a batch of dstat tests on a list of tests, where each test is
a dictionary mapping sample names to {p1 - p4} (and sometimes p5).
Parameters modifying the behavior of the run, such as the number
of bootstrap replicates (n... | [
"Run",
"a",
"batch",
"of",
"dstat",
"tests",
"on",
"a",
"list",
"of",
"tests",
"where",
"each",
"test",
"is",
"a",
"dictionary",
"mapping",
"sample",
"names",
"to",
"{",
"p1",
"-",
"p4",
"}",
"(",
"and",
"sometimes",
"p5",
")",
".",
"Parameters",
"mo... | dereneaton/ipyrad | python | https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/analysis/baba.py#L138-L158 | [
"def",
"run",
"(",
"self",
",",
"ipyclient",
"=",
"None",
",",
")",
":",
"self",
".",
"results_table",
",",
"self",
".",
"results_boots",
"=",
"batch",
"(",
"self",
",",
"ipyclient",
")",
"## skip this for 5-part test results",
"if",
"not",
"isinstance",
"("... | 5eeb8a178160f45faf71bf47cec4abe998a575d1 |
valid | Baba.plot | Draw a multi-panel figure with tree, tests, and results
Parameters:
-----------
height: int
...
width: int
...
show_test_labels: bool
...
use_edge_lengths: bool
...
collapse_outgroups: bool
...
pct_tre... | ipyrad/analysis/baba.py | def plot(self,
show_test_labels=True,
use_edge_lengths=True,
collapse_outgroup=False,
pct_tree_x=0.5,
pct_tree_y=0.2,
subset_tests=None,
#toytree_kwargs=None,
*args,
**kwargs):
"""
Draw a multi-panel figure with tree... | def plot(self,
show_test_labels=True,
use_edge_lengths=True,
collapse_outgroup=False,
pct_tree_x=0.5,
pct_tree_y=0.2,
subset_tests=None,
#toytree_kwargs=None,
*args,
**kwargs):
"""
Draw a multi-panel figure with tree... | [
"Draw",
"a",
"multi",
"-",
"panel",
"figure",
"with",
"tree",
"tests",
"and",
"results",
"Parameters",
":",
"-----------",
"height",
":",
"int",
"..."
] | dereneaton/ipyrad | python | https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/analysis/baba.py#L200-L282 | [
"def",
"plot",
"(",
"self",
",",
"show_test_labels",
"=",
"True",
",",
"use_edge_lengths",
"=",
"True",
",",
"collapse_outgroup",
"=",
"False",
",",
"pct_tree_x",
"=",
"0.5",
",",
"pct_tree_y",
"=",
"0.2",
",",
"subset_tests",
"=",
"None",
",",
"#toytree_kwa... | 5eeb8a178160f45faf71bf47cec4abe998a575d1 |
valid | loci2multinex | Converts loci file format to multiple nexus formatted files, one for
each locus, and writes a mrbayes block in the nexus information. The
mrbayes block will be set to run 2 replicate chains, for [mcmc_ngen]
generations, skipping [burnin] steps, and sampling every
[mcmc_sample_freq] steps.
Para... | ipyrad/file_conversion/loci2multinex.py | def loci2multinex(name,
locifile,
subsamples=None,
outdir=None,
maxloci=None,
minSNPs=1,
seed=12345,
mcmc_burnin=int(1e6),
mcmc_ngen=int(2e6),
mcmc_sample_f... | def loci2multinex(name,
locifile,
subsamples=None,
outdir=None,
maxloci=None,
minSNPs=1,
seed=12345,
mcmc_burnin=int(1e6),
mcmc_ngen=int(2e6),
mcmc_sample_f... | [
"Converts",
"loci",
"file",
"format",
"to",
"multiple",
"nexus",
"formatted",
"files",
"one",
"for",
"each",
"locus",
"and",
"writes",
"a",
"mrbayes",
"block",
"in",
"the",
"nexus",
"information",
".",
"The",
"mrbayes",
"block",
"will",
"be",
"set",
"to",
... | dereneaton/ipyrad | python | https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/file_conversion/loci2multinex.py#L21-L130 | [
"def",
"loci2multinex",
"(",
"name",
",",
"locifile",
",",
"subsamples",
"=",
"None",
",",
"outdir",
"=",
"None",
",",
"maxloci",
"=",
"None",
",",
"minSNPs",
"=",
"1",
",",
"seed",
"=",
"12345",
",",
"mcmc_burnin",
"=",
"int",
"(",
"1e6",
")",
",",
... | 5eeb8a178160f45faf71bf47cec4abe998a575d1 |
valid | nexmake | function that takes a dictionary mapping names to
sequences, and a locus number, and writes it as a NEXUS
file with a mrbayes analysis block. | ipyrad/file_conversion/loci2multinex.py | def nexmake(mdict, nlocus, dirs, mcmc_burnin, mcmc_ngen, mcmc_sample_freq):
"""
function that takes a dictionary mapping names to
sequences, and a locus number, and writes it as a NEXUS
file with a mrbayes analysis block.
"""
## create matrix as a string
max_name_len = max([len(i) for i in... | def nexmake(mdict, nlocus, dirs, mcmc_burnin, mcmc_ngen, mcmc_sample_freq):
"""
function that takes a dictionary mapping names to
sequences, and a locus number, and writes it as a NEXUS
file with a mrbayes analysis block.
"""
## create matrix as a string
max_name_len = max([len(i) for i in... | [
"function",
"that",
"takes",
"a",
"dictionary",
"mapping",
"names",
"to",
"sequences",
"and",
"a",
"locus",
"number",
"and",
"writes",
"it",
"as",
"a",
"NEXUS",
"file",
"with",
"a",
"mrbayes",
"analysis",
"block",
"."
] | dereneaton/ipyrad | python | https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/file_conversion/loci2multinex.py#L134-L157 | [
"def",
"nexmake",
"(",
"mdict",
",",
"nlocus",
",",
"dirs",
",",
"mcmc_burnin",
",",
"mcmc_ngen",
",",
"mcmc_sample_freq",
")",
":",
"## create matrix as a string",
"max_name_len",
"=",
"max",
"(",
"[",
"len",
"(",
"i",
")",
"for",
"i",
"in",
"mdict",
"]",... | 5eeb8a178160f45faf71bf47cec4abe998a575d1 |
valid | call_fastq_dump_on_SRRs | calls fastq-dump on SRRs, relabels fastqs by their accession
names, and writes them to the workdir. Saves temp sra files
in the designated tmp folder and immediately removes them. | ipyrad/analysis/sratools.py | def call_fastq_dump_on_SRRs(self, srr, outname, paired):
"""
calls fastq-dump on SRRs, relabels fastqs by their accession
names, and writes them to the workdir. Saves temp sra files
in the designated tmp folder and immediately removes them.
"""
## build command for fastq-dumping
fd_cmd = [
... | def call_fastq_dump_on_SRRs(self, srr, outname, paired):
"""
calls fastq-dump on SRRs, relabels fastqs by their accession
names, and writes them to the workdir. Saves temp sra files
in the designated tmp folder and immediately removes them.
"""
## build command for fastq-dumping
fd_cmd = [
... | [
"calls",
"fastq",
"-",
"dump",
"on",
"SRRs",
"relabels",
"fastqs",
"by",
"their",
"accession",
"names",
"and",
"writes",
"them",
"to",
"the",
"workdir",
".",
"Saves",
"temp",
"sra",
"files",
"in",
"the",
"designated",
"tmp",
"folder",
"and",
"immediately",
... | dereneaton/ipyrad | python | https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/analysis/sratools.py#L411-L437 | [
"def",
"call_fastq_dump_on_SRRs",
"(",
"self",
",",
"srr",
",",
"outname",
",",
"paired",
")",
":",
"## build command for fastq-dumping",
"fd_cmd",
"=",
"[",
"\"fastq-dump\"",
",",
"srr",
",",
"\"--accession\"",
",",
"outname",
",",
"\"--outdir\"",
",",
"self",
... | 5eeb8a178160f45faf71bf47cec4abe998a575d1 |
valid | fields_checker | returns a fields argument formatted as a list of strings.
and doesn't allow zero. | ipyrad/analysis/sratools.py | def fields_checker(fields):
"""
returns a fields argument formatted as a list of strings.
and doesn't allow zero.
"""
## make sure fields will work
if isinstance(fields, int):
fields = str(fields)
if isinstance(fields, str):
if "," in fields:
fields = [str(i) for ... | def fields_checker(fields):
"""
returns a fields argument formatted as a list of strings.
and doesn't allow zero.
"""
## make sure fields will work
if isinstance(fields, int):
fields = str(fields)
if isinstance(fields, str):
if "," in fields:
fields = [str(i) for ... | [
"returns",
"a",
"fields",
"argument",
"formatted",
"as",
"a",
"list",
"of",
"strings",
".",
"and",
"doesn",
"t",
"allow",
"zero",
"."
] | dereneaton/ipyrad | python | https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/analysis/sratools.py#L441-L462 | [
"def",
"fields_checker",
"(",
"fields",
")",
":",
"## make sure fields will work",
"if",
"isinstance",
"(",
"fields",
",",
"int",
")",
":",
"fields",
"=",
"str",
"(",
"fields",
")",
"if",
"isinstance",
"(",
"fields",
",",
"str",
")",
":",
"if",
"\",\"",
... | 5eeb8a178160f45faf71bf47cec4abe998a575d1 |
valid | SRA.run | Download the accessions into a the designated workdir.
Parameters
----------
force: (bool)
If force=True then existing files with the same name
will be overwritten.
ipyclient: (ipyparallel.Client)
If provided, work will be distributed across a para... | ipyrad/analysis/sratools.py | def run(self,
force=False,
ipyclient=None,
name_fields=30,
name_separator="_",
dry_run=False):
"""
Download the accessions into a the designated workdir.
Parameters
----------
force: (bool)
If force=True then existing fil... | def run(self,
force=False,
ipyclient=None,
name_fields=30,
name_separator="_",
dry_run=False):
"""
Download the accessions into a the designated workdir.
Parameters
----------
force: (bool)
If force=True then existing fil... | [
"Download",
"the",
"accessions",
"into",
"a",
"the",
"designated",
"workdir",
"."
] | dereneaton/ipyrad | python | https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/analysis/sratools.py#L87-L202 | [
"def",
"run",
"(",
"self",
",",
"force",
"=",
"False",
",",
"ipyclient",
"=",
"None",
",",
"name_fields",
"=",
"30",
",",
"name_separator",
"=",
"\"_\"",
",",
"dry_run",
"=",
"False",
")",
":",
"## temporarily set directory for tmpfiles used by fastq-dump",
"## ... | 5eeb8a178160f45faf71bf47cec4abe998a575d1 |
valid | SRA._submit_jobs | Download the accessions into a the designated workdir.
If file already exists it will only be overwritten if
force=True. Temporary files are removed. | ipyrad/analysis/sratools.py | def _submit_jobs(self,
force,
ipyclient,
name_fields,
name_separator,
dry_run):
"""
Download the accessions into a the designated workdir.
If file already exists it will only be overwritten if
force=True. Temporary files are removed.
... | def _submit_jobs(self,
force,
ipyclient,
name_fields,
name_separator,
dry_run):
"""
Download the accessions into a the designated workdir.
If file already exists it will only be overwritten if
force=True. Temporary files are removed.
... | [
"Download",
"the",
"accessions",
"into",
"a",
"the",
"designated",
"workdir",
".",
"If",
"file",
"already",
"exists",
"it",
"will",
"only",
"be",
"overwritten",
"if",
"force",
"=",
"True",
".",
"Temporary",
"files",
"are",
"removed",
"."
] | dereneaton/ipyrad | python | https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/analysis/sratools.py#L206-L308 | [
"def",
"_submit_jobs",
"(",
"self",
",",
"force",
",",
"ipyclient",
",",
"name_fields",
",",
"name_separator",
",",
"dry_run",
")",
":",
"## get Run data with default fields (1,4,6,30)",
"df",
"=",
"self",
".",
"fetch_runinfo",
"(",
"range",
"(",
"31",
")",
",",... | 5eeb8a178160f45faf71bf47cec4abe998a575d1 |
valid | SRA.fetch_runinfo | Call esearch to grep SRR info for a project (SRP). Use the command
sra.fetch_fields to see available fields to be fetched. This function
returns a DataFrame with runinfo for the selected fields.
Parameters:
-----------
Fields: (tuple or list)
The default fields retur... | ipyrad/analysis/sratools.py | def fetch_runinfo(self, fields=None, quiet=False):
"""
Call esearch to grep SRR info for a project (SRP). Use the command
sra.fetch_fields to see available fields to be fetched. This function
returns a DataFrame with runinfo for the selected fields.
Parameters:
---------... | def fetch_runinfo(self, fields=None, quiet=False):
"""
Call esearch to grep SRR info for a project (SRP). Use the command
sra.fetch_fields to see available fields to be fetched. This function
returns a DataFrame with runinfo for the selected fields.
Parameters:
---------... | [
"Call",
"esearch",
"to",
"grep",
"SRR",
"info",
"for",
"a",
"project",
"(",
"SRP",
")",
".",
"Use",
"the",
"command",
"sra",
".",
"fetch_fields",
"to",
"see",
"available",
"fields",
"to",
"be",
"fetched",
".",
"This",
"function",
"returns",
"a",
"DataFra... | dereneaton/ipyrad | python | https://github.com/dereneaton/ipyrad/blob/5eeb8a178160f45faf71bf47cec4abe998a575d1/ipyrad/analysis/sratools.py#L323-L377 | [
"def",
"fetch_runinfo",
"(",
"self",
",",
"fields",
"=",
"None",
",",
"quiet",
"=",
"False",
")",
":",
"if",
"not",
"quiet",
":",
"print",
"(",
"\"\\rFetching project data...\"",
",",
"end",
"=",
"\"\"",
")",
"## if no entry then fetch (nearly) all fields.",
"if... | 5eeb8a178160f45faf71bf47cec4abe998a575d1 |
valid | Client.Async | Returns the client in async mode. | clashroyale/royaleapi/client.py | def Async(cls, token, session=None, **options):
"""Returns the client in async mode."""
return cls(token, session=session, is_async=True, **options) | def Async(cls, token, session=None, **options):
"""Returns the client in async mode."""
return cls(token, session=session, is_async=True, **options) | [
"Returns",
"the",
"client",
"in",
"async",
"mode",
"."
] | cgrok/clashroyale | python | https://github.com/cgrok/clashroyale/blob/2618f4da22a84ad3e36d2446e23436d87c423163/clashroyale/royaleapi/client.py#L94-L96 | [
"def",
"Async",
"(",
"cls",
",",
"token",
",",
"session",
"=",
"None",
",",
"*",
"*",
"options",
")",
":",
"return",
"cls",
"(",
"token",
",",
"session",
"=",
"session",
",",
"is_async",
"=",
"True",
",",
"*",
"*",
"options",
")"
] | 2618f4da22a84ad3e36d2446e23436d87c423163 |
valid | Client.get_constants | Get the CR Constants
Parameters
----------
\*\*keys: Optional[list] = None
Filter which keys should be included in the
response
\*\*exclude: Optional[list] = None
Filter which keys should be excluded from the
response
\*\*timeout: ... | clashroyale/royaleapi/client.py | def get_constants(self, **params: keys):
"""Get the CR Constants
Parameters
----------
\*\*keys: Optional[list] = None
Filter which keys should be included in the
response
\*\*exclude: Optional[list] = None
Filter which keys should be excluded... | def get_constants(self, **params: keys):
"""Get the CR Constants
Parameters
----------
\*\*keys: Optional[list] = None
Filter which keys should be included in the
response
\*\*exclude: Optional[list] = None
Filter which keys should be excluded... | [
"Get",
"the",
"CR",
"Constants"
] | cgrok/clashroyale | python | https://github.com/cgrok/clashroyale/blob/2618f4da22a84ad3e36d2446e23436d87c423163/clashroyale/royaleapi/client.py#L237-L252 | [
"def",
"get_constants",
"(",
"self",
",",
"*",
"*",
"params",
":",
"keys",
")",
":",
"url",
"=",
"self",
".",
"api",
".",
"CONSTANTS",
"return",
"self",
".",
"_get_model",
"(",
"url",
",",
"*",
"*",
"params",
")"
] | 2618f4da22a84ad3e36d2446e23436d87c423163 |
valid | Client.get_player | Get a player information
Parameters
----------
\*tags: str
Valid player tags. Minimum length: 3
Valid characters: 0289PYLQGRJCUV
\*\*keys: Optional[list] = None
Filter which keys should be included in the
response
\*\*exclude: Opti... | clashroyale/royaleapi/client.py | def get_player(self, *tags: crtag, **params: keys):
"""Get a player information
Parameters
----------
\*tags: str
Valid player tags. Minimum length: 3
Valid characters: 0289PYLQGRJCUV
\*\*keys: Optional[list] = None
Filter which keys should be... | def get_player(self, *tags: crtag, **params: keys):
"""Get a player information
Parameters
----------
\*tags: str
Valid player tags. Minimum length: 3
Valid characters: 0289PYLQGRJCUV
\*\*keys: Optional[list] = None
Filter which keys should be... | [
"Get",
"a",
"player",
"information"
] | cgrok/clashroyale | python | https://github.com/cgrok/clashroyale/blob/2618f4da22a84ad3e36d2446e23436d87c423163/clashroyale/royaleapi/client.py#L255-L273 | [
"def",
"get_player",
"(",
"self",
",",
"*",
"tags",
":",
"crtag",
",",
"*",
"*",
"params",
":",
"keys",
")",
":",
"url",
"=",
"self",
".",
"api",
".",
"PLAYER",
"+",
"'/'",
"+",
"','",
".",
"join",
"(",
"tags",
")",
"return",
"self",
".",
"_get... | 2618f4da22a84ad3e36d2446e23436d87c423163 |
valid | Client.get_player_verify | Check the API Key of a player.
This endpoint has been **restricted** to
certain members of the community
Parameters
----------
tag: str
A valid tournament tag. Minimum length: 3
Valid characters: 0289PYLQGRJCUV
apikey: str
The API Key ... | clashroyale/royaleapi/client.py | def get_player_verify(self, tag: crtag, apikey: str, **params: keys):
"""Check the API Key of a player.
This endpoint has been **restricted** to
certain members of the community
Parameters
----------
tag: str
A valid tournament tag. Minimum length: 3
... | def get_player_verify(self, tag: crtag, apikey: str, **params: keys):
"""Check the API Key of a player.
This endpoint has been **restricted** to
certain members of the community
Parameters
----------
tag: str
A valid tournament tag. Minimum length: 3
... | [
"Check",
"the",
"API",
"Key",
"of",
"a",
"player",
".",
"This",
"endpoint",
"has",
"been",
"**",
"restricted",
"**",
"to",
"certain",
"members",
"of",
"the",
"community"
] | cgrok/clashroyale | python | https://github.com/cgrok/clashroyale/blob/2618f4da22a84ad3e36d2446e23436d87c423163/clashroyale/royaleapi/client.py#L276-L299 | [
"def",
"get_player_verify",
"(",
"self",
",",
"tag",
":",
"crtag",
",",
"apikey",
":",
"str",
",",
"*",
"*",
"params",
":",
"keys",
")",
":",
"url",
"=",
"self",
".",
"api",
".",
"PLAYER",
"+",
"'/'",
"+",
"tag",
"+",
"'/verify'",
"params",
".",
... | 2618f4da22a84ad3e36d2446e23436d87c423163 |
valid | Client.get_player_battles | Get a player's battle log
Parameters
----------
\*tags: str
Valid player tags. Minimum length: 3
Valid characters: 0289PYLQGRJCUV
\*\*keys: Optional[list] = None
Filter which keys should be included in the
response
\*\*exclude: Opt... | clashroyale/royaleapi/client.py | def get_player_battles(self, *tags: crtag, **params: keys):
"""Get a player's battle log
Parameters
----------
\*tags: str
Valid player tags. Minimum length: 3
Valid characters: 0289PYLQGRJCUV
\*\*keys: Optional[list] = None
Filter which keys ... | def get_player_battles(self, *tags: crtag, **params: keys):
"""Get a player's battle log
Parameters
----------
\*tags: str
Valid player tags. Minimum length: 3
Valid characters: 0289PYLQGRJCUV
\*\*keys: Optional[list] = None
Filter which keys ... | [
"Get",
"a",
"player",
"s",
"battle",
"log"
] | cgrok/clashroyale | python | https://github.com/cgrok/clashroyale/blob/2618f4da22a84ad3e36d2446e23436d87c423163/clashroyale/royaleapi/client.py#L302-L325 | [
"def",
"get_player_battles",
"(",
"self",
",",
"*",
"tags",
":",
"crtag",
",",
"*",
"*",
"params",
":",
"keys",
")",
":",
"url",
"=",
"self",
".",
"api",
".",
"PLAYER",
"+",
"'/'",
"+",
"','",
".",
"join",
"(",
"tags",
")",
"+",
"'/battles'",
"re... | 2618f4da22a84ad3e36d2446e23436d87c423163 |
valid | Client.get_clan | Get a clan information
Parameters
----------
\*tags: str
Valid clan tags. Minimum length: 3
Valid characters: 0289PYLQGRJCUV
\*\*keys: Optional[list] = None
Filter which keys should be included in the
response
\*\*exclude: Optional... | clashroyale/royaleapi/client.py | def get_clan(self, *tags: crtag, **params: keys):
"""Get a clan information
Parameters
----------
\*tags: str
Valid clan tags. Minimum length: 3
Valid characters: 0289PYLQGRJCUV
\*\*keys: Optional[list] = None
Filter which keys should be inclu... | def get_clan(self, *tags: crtag, **params: keys):
"""Get a clan information
Parameters
----------
\*tags: str
Valid clan tags. Minimum length: 3
Valid characters: 0289PYLQGRJCUV
\*\*keys: Optional[list] = None
Filter which keys should be inclu... | [
"Get",
"a",
"clan",
"information"
] | cgrok/clashroyale | python | https://github.com/cgrok/clashroyale/blob/2618f4da22a84ad3e36d2446e23436d87c423163/clashroyale/royaleapi/client.py#L349-L367 | [
"def",
"get_clan",
"(",
"self",
",",
"*",
"tags",
":",
"crtag",
",",
"*",
"*",
"params",
":",
"keys",
")",
":",
"url",
"=",
"self",
".",
"api",
".",
"CLAN",
"+",
"'/'",
"+",
"','",
".",
"join",
"(",
"tags",
")",
"return",
"self",
".",
"_get_mod... | 2618f4da22a84ad3e36d2446e23436d87c423163 |
valid | Client.get_tracking_clans | Get a list of clans that are being
tracked by having either cr-api.com or
royaleapi.com in the description
Parameters
----------
\*\*keys: Optional[list] = None
Filter which keys should be included in the
response
\*\*exclude: Optional[list] = Non... | clashroyale/royaleapi/client.py | def get_tracking_clans(self, **params: keys):
"""Get a list of clans that are being
tracked by having either cr-api.com or
royaleapi.com in the description
Parameters
----------
\*\*keys: Optional[list] = None
Filter which keys should be included in the
... | def get_tracking_clans(self, **params: keys):
"""Get a list of clans that are being
tracked by having either cr-api.com or
royaleapi.com in the description
Parameters
----------
\*\*keys: Optional[list] = None
Filter which keys should be included in the
... | [
"Get",
"a",
"list",
"of",
"clans",
"that",
"are",
"being",
"tracked",
"by",
"having",
"either",
"cr",
"-",
"api",
".",
"com",
"or",
"royaleapi",
".",
"com",
"in",
"the",
"description"
] | cgrok/clashroyale | python | https://github.com/cgrok/clashroyale/blob/2618f4da22a84ad3e36d2446e23436d87c423163/clashroyale/royaleapi/client.py#L404-L426 | [
"def",
"get_tracking_clans",
"(",
"self",
",",
"*",
"*",
"params",
":",
"keys",
")",
":",
"url",
"=",
"self",
".",
"api",
".",
"CLAN",
"+",
"'/tracking'",
"return",
"self",
".",
"_get_model",
"(",
"url",
",",
"*",
"*",
"params",
")"
] | 2618f4da22a84ad3e36d2446e23436d87c423163 |
valid | Client.get_clan_tracking | Returns if the clan is currently being tracked
by the API by having either cr-api.com or royaleapi.com
in the clan description
Parameters
----------
\*tags: str
Valid clan tags. Minimum length: 3
Valid characters: 0289PYLQGRJCUV
\*\*keys: Optional... | clashroyale/royaleapi/client.py | def get_clan_tracking(self, *tags: crtag, **params: keys):
"""Returns if the clan is currently being tracked
by the API by having either cr-api.com or royaleapi.com
in the clan description
Parameters
----------
\*tags: str
Valid clan tags. Minimum length: 3
... | def get_clan_tracking(self, *tags: crtag, **params: keys):
"""Returns if the clan is currently being tracked
by the API by having either cr-api.com or royaleapi.com
in the clan description
Parameters
----------
\*tags: str
Valid clan tags. Minimum length: 3
... | [
"Returns",
"if",
"the",
"clan",
"is",
"currently",
"being",
"tracked",
"by",
"the",
"API",
"by",
"having",
"either",
"cr",
"-",
"api",
".",
"com",
"or",
"royaleapi",
".",
"com",
"in",
"the",
"clan",
"description"
] | cgrok/clashroyale | python | https://github.com/cgrok/clashroyale/blob/2618f4da22a84ad3e36d2446e23436d87c423163/clashroyale/royaleapi/client.py#L429-L449 | [
"def",
"get_clan_tracking",
"(",
"self",
",",
"*",
"tags",
":",
"crtag",
",",
"*",
"*",
"params",
":",
"keys",
")",
":",
"url",
"=",
"self",
".",
"api",
".",
"CLAN",
"+",
"'/'",
"+",
"','",
".",
"join",
"(",
"tags",
")",
"+",
"'/tracking'",
"retu... | 2618f4da22a84ad3e36d2446e23436d87c423163 |
valid | Client.get_clan_war | Get inforamtion about a clan's current clan war
Parameters
----------
*tag: str
A valid clan tag. Minimum length: 3
Valid characters: 0289PYLQGRJCUV
\*\*keys: Optional[list] = None
Filter which keys should be included in the
response
... | clashroyale/royaleapi/client.py | def get_clan_war(self, tag: crtag, **params: keys):
"""Get inforamtion about a clan's current clan war
Parameters
----------
*tag: str
A valid clan tag. Minimum length: 3
Valid characters: 0289PYLQGRJCUV
\*\*keys: Optional[list] = None
Filter ... | def get_clan_war(self, tag: crtag, **params: keys):
"""Get inforamtion about a clan's current clan war
Parameters
----------
*tag: str
A valid clan tag. Minimum length: 3
Valid characters: 0289PYLQGRJCUV
\*\*keys: Optional[list] = None
Filter ... | [
"Get",
"inforamtion",
"about",
"a",
"clan",
"s",
"current",
"clan",
"war"
] | cgrok/clashroyale | python | https://github.com/cgrok/clashroyale/blob/2618f4da22a84ad3e36d2446e23436d87c423163/clashroyale/royaleapi/client.py#L509-L527 | [
"def",
"get_clan_war",
"(",
"self",
",",
"tag",
":",
"crtag",
",",
"*",
"*",
"params",
":",
"keys",
")",
":",
"url",
"=",
"self",
".",
"api",
".",
"CLAN",
"+",
"'/'",
"+",
"tag",
"+",
"'/war'",
"return",
"self",
".",
"_get_model",
"(",
"url",
","... | 2618f4da22a84ad3e36d2446e23436d87c423163 |
valid | Client.get_tournament | Get a tournament information
Parameters
----------
tag: str
A valid tournament tag. Minimum length: 3
Valid characters: 0289PYLQGRJCUV
\*\*keys: Optional[list] = None
Filter which keys should be included in the
response
\*\*exclude... | clashroyale/royaleapi/client.py | def get_tournament(self, tag: crtag, **params: keys):
"""Get a tournament information
Parameters
----------
tag: str
A valid tournament tag. Minimum length: 3
Valid characters: 0289PYLQGRJCUV
\*\*keys: Optional[list] = None
Filter which keys s... | def get_tournament(self, tag: crtag, **params: keys):
"""Get a tournament information
Parameters
----------
tag: str
A valid tournament tag. Minimum length: 3
Valid characters: 0289PYLQGRJCUV
\*\*keys: Optional[list] = None
Filter which keys s... | [
"Get",
"a",
"tournament",
"information"
] | cgrok/clashroyale | python | https://github.com/cgrok/clashroyale/blob/2618f4da22a84ad3e36d2446e23436d87c423163/clashroyale/royaleapi/client.py#L556-L574 | [
"def",
"get_tournament",
"(",
"self",
",",
"tag",
":",
"crtag",
",",
"*",
"*",
"params",
":",
"keys",
")",
":",
"url",
"=",
"self",
".",
"api",
".",
"TOURNAMENT",
"+",
"'/'",
"+",
"tag",
"return",
"self",
".",
"_get_model",
"(",
"url",
",",
"*",
... | 2618f4da22a84ad3e36d2446e23436d87c423163 |
valid | Client.search_tournaments | Search for a tournament
Parameters
----------
name: str
The name of the tournament
\*\*keys: Optional[list] = None
Filter which keys should be included in the
response
\*\*exclude: Optional[list] = None
Filter which keys should be ... | clashroyale/royaleapi/client.py | def search_tournaments(self, **params: keys):
"""Search for a tournament
Parameters
----------
name: str
The name of the tournament
\*\*keys: Optional[list] = None
Filter which keys should be included in the
response
\*\*exclude: Optio... | def search_tournaments(self, **params: keys):
"""Search for a tournament
Parameters
----------
name: str
The name of the tournament
\*\*keys: Optional[list] = None
Filter which keys should be included in the
response
\*\*exclude: Optio... | [
"Search",
"for",
"a",
"tournament"
] | cgrok/clashroyale | python | https://github.com/cgrok/clashroyale/blob/2618f4da22a84ad3e36d2446e23436d87c423163/clashroyale/royaleapi/client.py#L577-L599 | [
"def",
"search_tournaments",
"(",
"self",
",",
"*",
"*",
"params",
":",
"keys",
")",
":",
"url",
"=",
"self",
".",
"api",
".",
"TOURNAMENT",
"+",
"'/search'",
"return",
"self",
".",
"_get_model",
"(",
"url",
",",
"PartialClan",
",",
"*",
"*",
"params",... | 2618f4da22a84ad3e36d2446e23436d87c423163 |
valid | Client.get_top_war_clans | Get a list of top clans by war
location_id: Optional[str] = ''
A location ID or '' (global)
See https://github.com/RoyaleAPI/cr-api-data/blob/master/json/regions.json
for a list of acceptable location IDs
\*\*keys: Optional[list] = None
Filter which keys ... | clashroyale/royaleapi/client.py | def get_top_war_clans(self, country_key='', **params: keys):
"""Get a list of top clans by war
location_id: Optional[str] = ''
A location ID or '' (global)
See https://github.com/RoyaleAPI/cr-api-data/blob/master/json/regions.json
for a list of acceptable location ID... | def get_top_war_clans(self, country_key='', **params: keys):
"""Get a list of top clans by war
location_id: Optional[str] = ''
A location ID or '' (global)
See https://github.com/RoyaleAPI/cr-api-data/blob/master/json/regions.json
for a list of acceptable location ID... | [
"Get",
"a",
"list",
"of",
"top",
"clans",
"by",
"war"
] | cgrok/clashroyale | python | https://github.com/cgrok/clashroyale/blob/2618f4da22a84ad3e36d2446e23436d87c423163/clashroyale/royaleapi/client.py#L627-L649 | [
"def",
"get_top_war_clans",
"(",
"self",
",",
"country_key",
"=",
"''",
",",
"*",
"*",
"params",
":",
"keys",
")",
":",
"url",
"=",
"self",
".",
"api",
".",
"TOP",
"+",
"'/war/'",
"+",
"str",
"(",
"country_key",
")",
"return",
"self",
".",
"_get_mode... | 2618f4da22a84ad3e36d2446e23436d87c423163 |
valid | Client.get_top_players | Get a list of top players
location_id: Optional[str] = ''
A location ID or '' (global)
See https://github.com/RoyaleAPI/cr-api-data/blob/master/json/regions.json
for a list of acceptable location IDs
\*\*keys: Optional[list] = None
Filter which keys shoul... | clashroyale/royaleapi/client.py | def get_top_players(self, country_key='', **params: keys):
"""Get a list of top players
location_id: Optional[str] = ''
A location ID or '' (global)
See https://github.com/RoyaleAPI/cr-api-data/blob/master/json/regions.json
for a list of acceptable location IDs
... | def get_top_players(self, country_key='', **params: keys):
"""Get a list of top players
location_id: Optional[str] = ''
A location ID or '' (global)
See https://github.com/RoyaleAPI/cr-api-data/blob/master/json/regions.json
for a list of acceptable location IDs
... | [
"Get",
"a",
"list",
"of",
"top",
"players"
] | cgrok/clashroyale | python | https://github.com/cgrok/clashroyale/blob/2618f4da22a84ad3e36d2446e23436d87c423163/clashroyale/royaleapi/client.py#L652-L674 | [
"def",
"get_top_players",
"(",
"self",
",",
"country_key",
"=",
"''",
",",
"*",
"*",
"params",
":",
"keys",
")",
":",
"url",
"=",
"self",
".",
"api",
".",
"TOP",
"+",
"'/players/'",
"+",
"str",
"(",
"country_key",
")",
"return",
"self",
".",
"_get_mo... | 2618f4da22a84ad3e36d2446e23436d87c423163 |
valid | Client.get_popular_clans | Get a list of most queried clans
\*\*keys: Optional[list] = None
Filter which keys should be included in the
response
\*\*exclude: Optional[list] = None
Filter which keys should be excluded from the
response
\*\*max: Optional[int] = None
... | clashroyale/royaleapi/client.py | def get_popular_clans(self, **params: keys):
"""Get a list of most queried clans
\*\*keys: Optional[list] = None
Filter which keys should be included in the
response
\*\*exclude: Optional[list] = None
Filter which keys should be excluded from the
... | def get_popular_clans(self, **params: keys):
"""Get a list of most queried clans
\*\*keys: Optional[list] = None
Filter which keys should be included in the
response
\*\*exclude: Optional[list] = None
Filter which keys should be excluded from the
... | [
"Get",
"a",
"list",
"of",
"most",
"queried",
"clans"
] | cgrok/clashroyale | python | https://github.com/cgrok/clashroyale/blob/2618f4da22a84ad3e36d2446e23436d87c423163/clashroyale/royaleapi/client.py#L677-L695 | [
"def",
"get_popular_clans",
"(",
"self",
",",
"*",
"*",
"params",
":",
"keys",
")",
":",
"url",
"=",
"self",
".",
"api",
".",
"POPULAR",
"+",
"'/clans'",
"return",
"self",
".",
"_get_model",
"(",
"url",
",",
"PartialClan",
",",
"*",
"*",
"params",
")... | 2618f4da22a84ad3e36d2446e23436d87c423163 |
valid | Client.get_popular_players | Get a list of most queried players
\*\*keys: Optional[list] = None
Filter which keys should be included in the
response
\*\*exclude: Optional[list] = None
Filter which keys should be excluded from the
response
\*\*max: Optional[int] = None
... | clashroyale/royaleapi/client.py | def get_popular_players(self, **params: keys):
"""Get a list of most queried players
\*\*keys: Optional[list] = None
Filter which keys should be included in the
response
\*\*exclude: Optional[list] = None
Filter which keys should be excluded from the
... | def get_popular_players(self, **params: keys):
"""Get a list of most queried players
\*\*keys: Optional[list] = None
Filter which keys should be included in the
response
\*\*exclude: Optional[list] = None
Filter which keys should be excluded from the
... | [
"Get",
"a",
"list",
"of",
"most",
"queried",
"players"
] | cgrok/clashroyale | python | https://github.com/cgrok/clashroyale/blob/2618f4da22a84ad3e36d2446e23436d87c423163/clashroyale/royaleapi/client.py#L698-L716 | [
"def",
"get_popular_players",
"(",
"self",
",",
"*",
"*",
"params",
":",
"keys",
")",
":",
"url",
"=",
"self",
".",
"api",
".",
"POPULAR",
"+",
"'/players'",
"return",
"self",
".",
"_get_model",
"(",
"url",
",",
"PartialPlayerClan",
",",
"*",
"*",
"par... | 2618f4da22a84ad3e36d2446e23436d87c423163 |
valid | Client.get_popular_tournaments | Get a list of most queried tournaments
\*\*keys: Optional[list] = None
Filter which keys should be included in the
response
\*\*exclude: Optional[list] = None
Filter which keys should be excluded from the
response
\*\*max: Optional[int] = None
... | clashroyale/royaleapi/client.py | def get_popular_tournaments(self, **params: keys):
"""Get a list of most queried tournaments
\*\*keys: Optional[list] = None
Filter which keys should be included in the
response
\*\*exclude: Optional[list] = None
Filter which keys should be excluded from the
... | def get_popular_tournaments(self, **params: keys):
"""Get a list of most queried tournaments
\*\*keys: Optional[list] = None
Filter which keys should be included in the
response
\*\*exclude: Optional[list] = None
Filter which keys should be excluded from the
... | [
"Get",
"a",
"list",
"of",
"most",
"queried",
"tournaments"
] | cgrok/clashroyale | python | https://github.com/cgrok/clashroyale/blob/2618f4da22a84ad3e36d2446e23436d87c423163/clashroyale/royaleapi/client.py#L719-L737 | [
"def",
"get_popular_tournaments",
"(",
"self",
",",
"*",
"*",
"params",
":",
"keys",
")",
":",
"url",
"=",
"self",
".",
"api",
".",
"POPULAR",
"+",
"'/tournament'",
"return",
"self",
".",
"_get_model",
"(",
"url",
",",
"PartialTournament",
",",
"*",
"*",... | 2618f4da22a84ad3e36d2446e23436d87c423163 |
valid | Client.get_popular_decks | Get a list of most queried decks
\*\*keys: Optional[list] = None
Filter which keys should be included in the
response
\*\*exclude: Optional[list] = None
Filter which keys should be excluded from the
response
\*\*max: Optional[int] = None
... | clashroyale/royaleapi/client.py | def get_popular_decks(self, **params: keys):
"""Get a list of most queried decks
\*\*keys: Optional[list] = None
Filter which keys should be included in the
response
\*\*exclude: Optional[list] = None
Filter which keys should be excluded from the
... | def get_popular_decks(self, **params: keys):
"""Get a list of most queried decks
\*\*keys: Optional[list] = None
Filter which keys should be included in the
response
\*\*exclude: Optional[list] = None
Filter which keys should be excluded from the
... | [
"Get",
"a",
"list",
"of",
"most",
"queried",
"decks"
] | cgrok/clashroyale | python | https://github.com/cgrok/clashroyale/blob/2618f4da22a84ad3e36d2446e23436d87c423163/clashroyale/royaleapi/client.py#L740-L758 | [
"def",
"get_popular_decks",
"(",
"self",
",",
"*",
"*",
"params",
":",
"keys",
")",
":",
"url",
"=",
"self",
".",
"api",
".",
"POPULAR",
"+",
"'/decks'",
"return",
"self",
".",
"_get_model",
"(",
"url",
",",
"*",
"*",
"params",
")"
] | 2618f4da22a84ad3e36d2446e23436d87c423163 |
valid | Client.get_known_tournaments | Get a list of queried tournaments
\*\*keys: Optional[list] = None
Filter which keys should be included in the
response
\*\*exclude: Optional[list] = None
Filter which keys should be excluded from the
response
\*\*max: Optional[int] = None
... | clashroyale/royaleapi/client.py | def get_known_tournaments(self, **params: tournamentfilter):
"""Get a list of queried tournaments
\*\*keys: Optional[list] = None
Filter which keys should be included in the
response
\*\*exclude: Optional[list] = None
Filter which keys should be excluded from... | def get_known_tournaments(self, **params: tournamentfilter):
"""Get a list of queried tournaments
\*\*keys: Optional[list] = None
Filter which keys should be included in the
response
\*\*exclude: Optional[list] = None
Filter which keys should be excluded from... | [
"Get",
"a",
"list",
"of",
"queried",
"tournaments"
] | cgrok/clashroyale | python | https://github.com/cgrok/clashroyale/blob/2618f4da22a84ad3e36d2446e23436d87c423163/clashroyale/royaleapi/client.py#L761-L779 | [
"def",
"get_known_tournaments",
"(",
"self",
",",
"*",
"*",
"params",
":",
"tournamentfilter",
")",
":",
"url",
"=",
"self",
".",
"api",
".",
"TOURNAMENT",
"+",
"'/known'",
"return",
"self",
".",
"_get_model",
"(",
"url",
",",
"PartialTournament",
",",
"*"... | 2618f4da22a84ad3e36d2446e23436d87c423163 |
valid | Client.get_player | Get information about a player
Parameters
----------
tag: str
A valid tournament tag. Minimum length: 3
Valid characters: 0289PYLQGRJCUV
timeout: Optional[int] = None
Custom timeout that overwrites Client.timeout | clashroyale/official_api/client.py | def get_player(self, tag: crtag, timeout=None):
"""Get information about a player
Parameters
----------
tag: str
A valid tournament tag. Minimum length: 3
Valid characters: 0289PYLQGRJCUV
timeout: Optional[int] = None
Custom timeout that overw... | def get_player(self, tag: crtag, timeout=None):
"""Get information about a player
Parameters
----------
tag: str
A valid tournament tag. Minimum length: 3
Valid characters: 0289PYLQGRJCUV
timeout: Optional[int] = None
Custom timeout that overw... | [
"Get",
"information",
"about",
"a",
"player"
] | cgrok/clashroyale | python | https://github.com/cgrok/clashroyale/blob/2618f4da22a84ad3e36d2446e23436d87c423163/clashroyale/official_api/client.py#L241-L253 | [
"def",
"get_player",
"(",
"self",
",",
"tag",
":",
"crtag",
",",
"timeout",
"=",
"None",
")",
":",
"url",
"=",
"self",
".",
"api",
".",
"PLAYER",
"+",
"'/'",
"+",
"tag",
"return",
"self",
".",
"_get_model",
"(",
"url",
",",
"FullPlayer",
",",
"time... | 2618f4da22a84ad3e36d2446e23436d87c423163 |
valid | Client.get_player_verify | Check the API Key of a player.
This endpoint has been **restricted** to
certain members of the community
Raises BadRequest if the apikey is invalid
Parameters
----------
tag: str
A valid tournament tag. Minimum length: 3
Valid characters: 0289PYL... | clashroyale/official_api/client.py | def get_player_verify(self, tag: crtag, apikey: str, timeout=None):
"""Check the API Key of a player.
This endpoint has been **restricted** to
certain members of the community
Raises BadRequest if the apikey is invalid
Parameters
----------
tag: str
... | def get_player_verify(self, tag: crtag, apikey: str, timeout=None):
"""Check the API Key of a player.
This endpoint has been **restricted** to
certain members of the community
Raises BadRequest if the apikey is invalid
Parameters
----------
tag: str
... | [
"Check",
"the",
"API",
"Key",
"of",
"a",
"player",
".",
"This",
"endpoint",
"has",
"been",
"**",
"restricted",
"**",
"to",
"certain",
"members",
"of",
"the",
"community"
] | cgrok/clashroyale | python | https://github.com/cgrok/clashroyale/blob/2618f4da22a84ad3e36d2446e23436d87c423163/clashroyale/official_api/client.py#L256-L274 | [
"def",
"get_player_verify",
"(",
"self",
",",
"tag",
":",
"crtag",
",",
"apikey",
":",
"str",
",",
"timeout",
"=",
"None",
")",
":",
"url",
"=",
"self",
".",
"api",
".",
"PLAYER",
"+",
"'/'",
"+",
"tag",
"+",
"'/verifytoken'",
"return",
"self",
".",
... | 2618f4da22a84ad3e36d2446e23436d87c423163 |
valid | Client.get_player_battles | Get a player's battle log
Parameters
----------
tag: str
A valid tournament tag. Minimum length: 3
Valid characters: 0289PYLQGRJCUV
\*\*limit: Optional[int] = None
Limit the number of items returned in the response
\*\*timeout: Optional[int] =... | clashroyale/official_api/client.py | def get_player_battles(self, tag: crtag, **params: keys):
"""Get a player's battle log
Parameters
----------
tag: str
A valid tournament tag. Minimum length: 3
Valid characters: 0289PYLQGRJCUV
\*\*limit: Optional[int] = None
Limit the number o... | def get_player_battles(self, tag: crtag, **params: keys):
"""Get a player's battle log
Parameters
----------
tag: str
A valid tournament tag. Minimum length: 3
Valid characters: 0289PYLQGRJCUV
\*\*limit: Optional[int] = None
Limit the number o... | [
"Get",
"a",
"player",
"s",
"battle",
"log"
] | cgrok/clashroyale | python | https://github.com/cgrok/clashroyale/blob/2618f4da22a84ad3e36d2446e23436d87c423163/clashroyale/official_api/client.py#L277-L291 | [
"def",
"get_player_battles",
"(",
"self",
",",
"tag",
":",
"crtag",
",",
"*",
"*",
"params",
":",
"keys",
")",
":",
"url",
"=",
"self",
".",
"api",
".",
"PLAYER",
"+",
"'/'",
"+",
"tag",
"+",
"'/battlelog'",
"return",
"self",
".",
"_get_model",
"(",
... | 2618f4da22a84ad3e36d2446e23436d87c423163 |
valid | Client.get_player_chests | Get information about a player's chest cycle
Parameters
----------
tag: str
A valid tournament tag. Minimum length: 3
Valid characters: 0289PYLQGRJCUV
timeout: Optional[int] = None
Custom timeout that overwrites Client.timeout | clashroyale/official_api/client.py | def get_player_chests(self, tag: crtag, timeout: int=None):
"""Get information about a player's chest cycle
Parameters
----------
tag: str
A valid tournament tag. Minimum length: 3
Valid characters: 0289PYLQGRJCUV
timeout: Optional[int] = None
... | def get_player_chests(self, tag: crtag, timeout: int=None):
"""Get information about a player's chest cycle
Parameters
----------
tag: str
A valid tournament tag. Minimum length: 3
Valid characters: 0289PYLQGRJCUV
timeout: Optional[int] = None
... | [
"Get",
"information",
"about",
"a",
"player",
"s",
"chest",
"cycle"
] | cgrok/clashroyale | python | https://github.com/cgrok/clashroyale/blob/2618f4da22a84ad3e36d2446e23436d87c423163/clashroyale/official_api/client.py#L294-L306 | [
"def",
"get_player_chests",
"(",
"self",
",",
"tag",
":",
"crtag",
",",
"timeout",
":",
"int",
"=",
"None",
")",
":",
"url",
"=",
"self",
".",
"api",
".",
"PLAYER",
"+",
"'/'",
"+",
"tag",
"+",
"'/upcomingchests'",
"return",
"self",
".",
"_get_model",
... | 2618f4da22a84ad3e36d2446e23436d87c423163 |
valid | Client.get_clan | Get inforamtion about a clan
Parameters
----------
tag: str
A valid tournament tag. Minimum length: 3
Valid characters: 0289PYLQGRJCUV
timeout: Optional[int] = None
Custom timeout that overwrites Client.timeout | clashroyale/official_api/client.py | def get_clan(self, tag: crtag, timeout: int=None):
"""Get inforamtion about a clan
Parameters
----------
tag: str
A valid tournament tag. Minimum length: 3
Valid characters: 0289PYLQGRJCUV
timeout: Optional[int] = None
Custom timeout that over... | def get_clan(self, tag: crtag, timeout: int=None):
"""Get inforamtion about a clan
Parameters
----------
tag: str
A valid tournament tag. Minimum length: 3
Valid characters: 0289PYLQGRJCUV
timeout: Optional[int] = None
Custom timeout that over... | [
"Get",
"inforamtion",
"about",
"a",
"clan"
] | cgrok/clashroyale | python | https://github.com/cgrok/clashroyale/blob/2618f4da22a84ad3e36d2446e23436d87c423163/clashroyale/official_api/client.py#L309-L321 | [
"def",
"get_clan",
"(",
"self",
",",
"tag",
":",
"crtag",
",",
"timeout",
":",
"int",
"=",
"None",
")",
":",
"url",
"=",
"self",
".",
"api",
".",
"CLAN",
"+",
"'/'",
"+",
"tag",
"return",
"self",
".",
"_get_model",
"(",
"url",
",",
"FullClan",
",... | 2618f4da22a84ad3e36d2446e23436d87c423163 |
valid | Client.search_clans | Search for a clan. At least one
of the filters must be present
Parameters
----------
name: Optional[str]
The name of a clan
(has to be at least 3 characters long)
locationId: Optional[int]
A location ID
minMembers: Optional[int]
... | clashroyale/official_api/client.py | def search_clans(self, **params: clansearch):
"""Search for a clan. At least one
of the filters must be present
Parameters
----------
name: Optional[str]
The name of a clan
(has to be at least 3 characters long)
locationId: Optional[int]
... | def search_clans(self, **params: clansearch):
"""Search for a clan. At least one
of the filters must be present
Parameters
----------
name: Optional[str]
The name of a clan
(has to be at least 3 characters long)
locationId: Optional[int]
... | [
"Search",
"for",
"a",
"clan",
".",
"At",
"least",
"one",
"of",
"the",
"filters",
"must",
"be",
"present"
] | cgrok/clashroyale | python | https://github.com/cgrok/clashroyale/blob/2618f4da22a84ad3e36d2446e23436d87c423163/clashroyale/official_api/client.py#L324-L350 | [
"def",
"search_clans",
"(",
"self",
",",
"*",
"*",
"params",
":",
"clansearch",
")",
":",
"url",
"=",
"self",
".",
"api",
".",
"CLAN",
"return",
"self",
".",
"_get_model",
"(",
"url",
",",
"PartialClan",
",",
"*",
"*",
"params",
")"
] | 2618f4da22a84ad3e36d2446e23436d87c423163 |
valid | Client.get_clan_war | Get inforamtion about a clan's current clan war
Parameters
----------
tag: str
A valid tournament tag. Minimum length: 3
Valid characters: 0289PYLQGRJCUV
timeout: Optional[int] = None
Custom timeout that overwrites Client.timeout | clashroyale/official_api/client.py | def get_clan_war(self, tag: crtag, timeout: int=None):
"""Get inforamtion about a clan's current clan war
Parameters
----------
tag: str
A valid tournament tag. Minimum length: 3
Valid characters: 0289PYLQGRJCUV
timeout: Optional[int] = None
C... | def get_clan_war(self, tag: crtag, timeout: int=None):
"""Get inforamtion about a clan's current clan war
Parameters
----------
tag: str
A valid tournament tag. Minimum length: 3
Valid characters: 0289PYLQGRJCUV
timeout: Optional[int] = None
C... | [
"Get",
"inforamtion",
"about",
"a",
"clan",
"s",
"current",
"clan",
"war"
] | cgrok/clashroyale | python | https://github.com/cgrok/clashroyale/blob/2618f4da22a84ad3e36d2446e23436d87c423163/clashroyale/official_api/client.py#L353-L365 | [
"def",
"get_clan_war",
"(",
"self",
",",
"tag",
":",
"crtag",
",",
"timeout",
":",
"int",
"=",
"None",
")",
":",
"url",
"=",
"self",
".",
"api",
".",
"CLAN",
"+",
"'/'",
"+",
"tag",
"+",
"'/currentwar'",
"return",
"self",
".",
"_get_model",
"(",
"u... | 2618f4da22a84ad3e36d2446e23436d87c423163 |
valid | Client.get_tournament | Get a tournament information
Parameters
----------
tag: str
A valid tournament tag. Minimum length: 3
Valid characters: 0289PYLQGRJCUV
\*\*timeout: Optional[int] = None
Custom timeout that overwrites Client.timeout | clashroyale/official_api/client.py | def get_tournament(self, tag: crtag, timeout=0):
"""Get a tournament information
Parameters
----------
tag: str
A valid tournament tag. Minimum length: 3
Valid characters: 0289PYLQGRJCUV
\*\*timeout: Optional[int] = None
Custom timeout that ov... | def get_tournament(self, tag: crtag, timeout=0):
"""Get a tournament information
Parameters
----------
tag: str
A valid tournament tag. Minimum length: 3
Valid characters: 0289PYLQGRJCUV
\*\*timeout: Optional[int] = None
Custom timeout that ov... | [
"Get",
"a",
"tournament",
"information"
] | cgrok/clashroyale | python | https://github.com/cgrok/clashroyale/blob/2618f4da22a84ad3e36d2446e23436d87c423163/clashroyale/official_api/client.py#L402-L414 | [
"def",
"get_tournament",
"(",
"self",
",",
"tag",
":",
"crtag",
",",
"timeout",
"=",
"0",
")",
":",
"url",
"=",
"self",
".",
"api",
".",
"TOURNAMENT",
"+",
"'/'",
"+",
"tag",
"return",
"self",
".",
"_get_model",
"(",
"url",
",",
"PartialTournament",
... | 2618f4da22a84ad3e36d2446e23436d87c423163 |
valid | Client.search_tournaments | Search for a tournament by its name
Parameters
----------
name: str
The name of a tournament
\*\*limit: Optional[int] = None
Limit the number of items returned in the response
\*\*timeout: Optional[int] = None
Custom timeout that overwrites Cl... | clashroyale/official_api/client.py | def search_tournaments(self, name: str, **params: keys):
"""Search for a tournament by its name
Parameters
----------
name: str
The name of a tournament
\*\*limit: Optional[int] = None
Limit the number of items returned in the response
\*\*timeout... | def search_tournaments(self, name: str, **params: keys):
"""Search for a tournament by its name
Parameters
----------
name: str
The name of a tournament
\*\*limit: Optional[int] = None
Limit the number of items returned in the response
\*\*timeout... | [
"Search",
"for",
"a",
"tournament",
"by",
"its",
"name"
] | cgrok/clashroyale | python | https://github.com/cgrok/clashroyale/blob/2618f4da22a84ad3e36d2446e23436d87c423163/clashroyale/official_api/client.py#L417-L431 | [
"def",
"search_tournaments",
"(",
"self",
",",
"name",
":",
"str",
",",
"*",
"*",
"params",
":",
"keys",
")",
":",
"url",
"=",
"self",
".",
"api",
".",
"TOURNAMENT",
"params",
"[",
"'name'",
"]",
"=",
"name",
"return",
"self",
".",
"_get_model",
"(",... | 2618f4da22a84ad3e36d2446e23436d87c423163 |
valid | Client.get_all_cards | Get a list of all the cards in the game
Parameters
----------
timeout: Optional[int] = None
Custom timeout that overwrites Client.timeout | clashroyale/official_api/client.py | def get_all_cards(self, timeout: int=None):
"""Get a list of all the cards in the game
Parameters
----------
timeout: Optional[int] = None
Custom timeout that overwrites Client.timeout
"""
url = self.api.CARDS
return self._get_model(url, timeout=timeo... | def get_all_cards(self, timeout: int=None):
"""Get a list of all the cards in the game
Parameters
----------
timeout: Optional[int] = None
Custom timeout that overwrites Client.timeout
"""
url = self.api.CARDS
return self._get_model(url, timeout=timeo... | [
"Get",
"a",
"list",
"of",
"all",
"the",
"cards",
"in",
"the",
"game"
] | cgrok/clashroyale | python | https://github.com/cgrok/clashroyale/blob/2618f4da22a84ad3e36d2446e23436d87c423163/clashroyale/official_api/client.py#L434-L443 | [
"def",
"get_all_cards",
"(",
"self",
",",
"timeout",
":",
"int",
"=",
"None",
")",
":",
"url",
"=",
"self",
".",
"api",
".",
"CARDS",
"return",
"self",
".",
"_get_model",
"(",
"url",
",",
"timeout",
"=",
"timeout",
")"
] | 2618f4da22a84ad3e36d2446e23436d87c423163 |
valid | Client.get_all_locations | Get a list of all locations
Parameters
----------
timeout: Optional[int] = None
Custom timeout that overwrites Client.timeout | clashroyale/official_api/client.py | def get_all_locations(self, timeout: int=None):
"""Get a list of all locations
Parameters
----------
timeout: Optional[int] = None
Custom timeout that overwrites Client.timeout
"""
url = self.api.LOCATIONS
return self._get_model(url, timeout=timeout) | def get_all_locations(self, timeout: int=None):
"""Get a list of all locations
Parameters
----------
timeout: Optional[int] = None
Custom timeout that overwrites Client.timeout
"""
url = self.api.LOCATIONS
return self._get_model(url, timeout=timeout) | [
"Get",
"a",
"list",
"of",
"all",
"locations"
] | cgrok/clashroyale | python | https://github.com/cgrok/clashroyale/blob/2618f4da22a84ad3e36d2446e23436d87c423163/clashroyale/official_api/client.py#L450-L459 | [
"def",
"get_all_locations",
"(",
"self",
",",
"timeout",
":",
"int",
"=",
"None",
")",
":",
"url",
"=",
"self",
".",
"api",
".",
"LOCATIONS",
"return",
"self",
".",
"_get_model",
"(",
"url",
",",
"timeout",
"=",
"timeout",
")"
] | 2618f4da22a84ad3e36d2446e23436d87c423163 |
valid | Client.get_location | Get a location information
Parameters
----------
location_id: int
A location ID
See https://github.com/RoyaleAPI/cr-api-data/blob/master/json/regions.json
for a list of acceptable location IDs
timeout: Optional[int] = None
Custom timeout t... | clashroyale/official_api/client.py | def get_location(self, location_id: int, timeout: int=None):
"""Get a location information
Parameters
----------
location_id: int
A location ID
See https://github.com/RoyaleAPI/cr-api-data/blob/master/json/regions.json
for a list of acceptable locatio... | def get_location(self, location_id: int, timeout: int=None):
"""Get a location information
Parameters
----------
location_id: int
A location ID
See https://github.com/RoyaleAPI/cr-api-data/blob/master/json/regions.json
for a list of acceptable locatio... | [
"Get",
"a",
"location",
"information"
] | cgrok/clashroyale | python | https://github.com/cgrok/clashroyale/blob/2618f4da22a84ad3e36d2446e23436d87c423163/clashroyale/official_api/client.py#L462-L475 | [
"def",
"get_location",
"(",
"self",
",",
"location_id",
":",
"int",
",",
"timeout",
":",
"int",
"=",
"None",
")",
":",
"url",
"=",
"self",
".",
"api",
".",
"LOCATIONS",
"+",
"'/'",
"+",
"str",
"(",
"location_id",
")",
"return",
"self",
".",
"_get_mod... | 2618f4da22a84ad3e36d2446e23436d87c423163 |
valid | Client.get_top_clans | Get a list of top clans by trophy
Parameters
----------
location_id: Optional[str] = 'global'
A location ID or global
See https://github.com/RoyaleAPI/cr-api-data/blob/master/json/regions.json
for a list of acceptable location IDs
\*\*limit: Optional[... | clashroyale/official_api/client.py | def get_top_clans(self, location_id='global', **params: keys):
"""Get a list of top clans by trophy
Parameters
----------
location_id: Optional[str] = 'global'
A location ID or global
See https://github.com/RoyaleAPI/cr-api-data/blob/master/json/regions.json
... | def get_top_clans(self, location_id='global', **params: keys):
"""Get a list of top clans by trophy
Parameters
----------
location_id: Optional[str] = 'global'
A location ID or global
See https://github.com/RoyaleAPI/cr-api-data/blob/master/json/regions.json
... | [
"Get",
"a",
"list",
"of",
"top",
"clans",
"by",
"trophy"
] | cgrok/clashroyale | python | https://github.com/cgrok/clashroyale/blob/2618f4da22a84ad3e36d2446e23436d87c423163/clashroyale/official_api/client.py#L478-L493 | [
"def",
"get_top_clans",
"(",
"self",
",",
"location_id",
"=",
"'global'",
",",
"*",
"*",
"params",
":",
"keys",
")",
":",
"url",
"=",
"self",
".",
"api",
".",
"LOCATIONS",
"+",
"'/'",
"+",
"str",
"(",
"location_id",
")",
"+",
"'/rankings/clans'",
"retu... | 2618f4da22a84ad3e36d2446e23436d87c423163 |
valid | Client.get_top_players | Get a list of top players
Parameters
----------
location_id: Optional[str] = 'global'
A location ID or global
See https://github.com/RoyaleAPI/cr-api-data/blob/master/json/regions.json
for a list of acceptable location IDs
\*\*limit: Optional[int] = N... | clashroyale/official_api/client.py | def get_top_players(self, location_id='global', **params: keys):
"""Get a list of top players
Parameters
----------
location_id: Optional[str] = 'global'
A location ID or global
See https://github.com/RoyaleAPI/cr-api-data/blob/master/json/regions.json
... | def get_top_players(self, location_id='global', **params: keys):
"""Get a list of top players
Parameters
----------
location_id: Optional[str] = 'global'
A location ID or global
See https://github.com/RoyaleAPI/cr-api-data/blob/master/json/regions.json
... | [
"Get",
"a",
"list",
"of",
"top",
"players"
] | cgrok/clashroyale | python | https://github.com/cgrok/clashroyale/blob/2618f4da22a84ad3e36d2446e23436d87c423163/clashroyale/official_api/client.py#L514-L529 | [
"def",
"get_top_players",
"(",
"self",
",",
"location_id",
"=",
"'global'",
",",
"*",
"*",
"params",
":",
"keys",
")",
":",
"url",
"=",
"self",
".",
"api",
".",
"LOCATIONS",
"+",
"'/'",
"+",
"str",
"(",
"location_id",
")",
"+",
"'/rankings/players'",
"... | 2618f4da22a84ad3e36d2446e23436d87c423163 |
valid | Client.get_clan_image | Get the clan badge image URL
Parameters
---------
obj: official_api.models.BaseAttrDict
An object that has the clan badge ID either in ``.clan.badge_id`` or ``.badge_id``
Can be a clan or a profile for example.
Returns str | clashroyale/official_api/client.py | def get_clan_image(self, obj: BaseAttrDict):
"""Get the clan badge image URL
Parameters
---------
obj: official_api.models.BaseAttrDict
An object that has the clan badge ID either in ``.clan.badge_id`` or ``.badge_id``
Can be a clan or a profile for example.
... | def get_clan_image(self, obj: BaseAttrDict):
"""Get the clan badge image URL
Parameters
---------
obj: official_api.models.BaseAttrDict
An object that has the clan badge ID either in ``.clan.badge_id`` or ``.badge_id``
Can be a clan or a profile for example.
... | [
"Get",
"the",
"clan",
"badge",
"image",
"URL"
] | cgrok/clashroyale | python | https://github.com/cgrok/clashroyale/blob/2618f4da22a84ad3e36d2446e23436d87c423163/clashroyale/official_api/client.py#L532-L557 | [
"def",
"get_clan_image",
"(",
"self",
",",
"obj",
":",
"BaseAttrDict",
")",
":",
"try",
":",
"badge_id",
"=",
"obj",
".",
"clan",
".",
"badge_id",
"except",
"AttributeError",
":",
"try",
":",
"badge_id",
"=",
"obj",
".",
"badge_id",
"except",
"AttributeErr... | 2618f4da22a84ad3e36d2446e23436d87c423163 |
valid | Client.get_arena_image | Get the arena image URL
Parameters
---------
obj: official_api.models.BaseAttrDict
An object that has the arena ID in ``.arena.id``
Can be ``Profile`` for example.
Returns None or str | clashroyale/official_api/client.py | def get_arena_image(self, obj: BaseAttrDict):
"""Get the arena image URL
Parameters
---------
obj: official_api.models.BaseAttrDict
An object that has the arena ID in ``.arena.id``
Can be ``Profile`` for example.
Returns None or str
"""
b... | def get_arena_image(self, obj: BaseAttrDict):
"""Get the arena image URL
Parameters
---------
obj: official_api.models.BaseAttrDict
An object that has the arena ID in ``.arena.id``
Can be ``Profile`` for example.
Returns None or str
"""
b... | [
"Get",
"the",
"arena",
"image",
"URL"
] | cgrok/clashroyale | python | https://github.com/cgrok/clashroyale/blob/2618f4da22a84ad3e36d2446e23436d87c423163/clashroyale/official_api/client.py#L559-L573 | [
"def",
"get_arena_image",
"(",
"self",
",",
"obj",
":",
"BaseAttrDict",
")",
":",
"badge_id",
"=",
"obj",
".",
"arena",
".",
"id",
"for",
"i",
"in",
"self",
".",
"constants",
".",
"arenas",
":",
"if",
"i",
".",
"id",
"==",
"badge_id",
":",
"return",
... | 2618f4da22a84ad3e36d2446e23436d87c423163 |
valid | Client.get_card_info | Returns card info from constants
Parameters
---------
card_name: str
A card name
Returns None or Constants | clashroyale/official_api/client.py | def get_card_info(self, card_name: str):
"""Returns card info from constants
Parameters
---------
card_name: str
A card name
Returns None or Constants
"""
for c in self.constants.cards:
if c.name == card_name:
return c | def get_card_info(self, card_name: str):
"""Returns card info from constants
Parameters
---------
card_name: str
A card name
Returns None or Constants
"""
for c in self.constants.cards:
if c.name == card_name:
return c | [
"Returns",
"card",
"info",
"from",
"constants"
] | cgrok/clashroyale | python | https://github.com/cgrok/clashroyale/blob/2618f4da22a84ad3e36d2446e23436d87c423163/clashroyale/official_api/client.py#L575-L587 | [
"def",
"get_card_info",
"(",
"self",
",",
"card_name",
":",
"str",
")",
":",
"for",
"c",
"in",
"self",
".",
"constants",
".",
"cards",
":",
"if",
"c",
".",
"name",
"==",
"card_name",
":",
"return",
"c"
] | 2618f4da22a84ad3e36d2446e23436d87c423163 |
valid | Client.get_rarity_info | Returns card info from constants
Parameters
---------
rarity: str
A rarity name
Returns None or Constants | clashroyale/official_api/client.py | def get_rarity_info(self, rarity: str):
"""Returns card info from constants
Parameters
---------
rarity: str
A rarity name
Returns None or Constants
"""
for c in self.constants.rarities:
if c.name == rarity:
return c | def get_rarity_info(self, rarity: str):
"""Returns card info from constants
Parameters
---------
rarity: str
A rarity name
Returns None or Constants
"""
for c in self.constants.rarities:
if c.name == rarity:
return c | [
"Returns",
"card",
"info",
"from",
"constants"
] | cgrok/clashroyale | python | https://github.com/cgrok/clashroyale/blob/2618f4da22a84ad3e36d2446e23436d87c423163/clashroyale/official_api/client.py#L589-L601 | [
"def",
"get_rarity_info",
"(",
"self",
",",
"rarity",
":",
"str",
")",
":",
"for",
"c",
"in",
"self",
".",
"constants",
".",
"rarities",
":",
"if",
"c",
".",
"name",
"==",
"rarity",
":",
"return",
"c"
] | 2618f4da22a84ad3e36d2446e23436d87c423163 |
valid | Client.get_deck_link | Form a deck link
Parameters
---------
deck: official_api.models.BaseAttrDict
An object is a deck. Can be retrieved from ``Player.current_deck``
Returns str | clashroyale/official_api/client.py | def get_deck_link(self, deck: BaseAttrDict):
"""Form a deck link
Parameters
---------
deck: official_api.models.BaseAttrDict
An object is a deck. Can be retrieved from ``Player.current_deck``
Returns str
"""
deck_link = 'https://link.clashroyale.com/... | def get_deck_link(self, deck: BaseAttrDict):
"""Form a deck link
Parameters
---------
deck: official_api.models.BaseAttrDict
An object is a deck. Can be retrieved from ``Player.current_deck``
Returns str
"""
deck_link = 'https://link.clashroyale.com/... | [
"Form",
"a",
"deck",
"link"
] | cgrok/clashroyale | python | https://github.com/cgrok/clashroyale/blob/2618f4da22a84ad3e36d2446e23436d87c423163/clashroyale/official_api/client.py#L603-L619 | [
"def",
"get_deck_link",
"(",
"self",
",",
"deck",
":",
"BaseAttrDict",
")",
":",
"deck_link",
"=",
"'https://link.clashroyale.com/deck/en?deck='",
"for",
"i",
"in",
"deck",
":",
"card",
"=",
"self",
".",
"get_card_info",
"(",
"i",
".",
"name",
")",
"deck_link"... | 2618f4da22a84ad3e36d2446e23436d87c423163 |
valid | Client.get_datetime | Converts a %Y%m%dT%H%M%S.%fZ to a UNIX timestamp
or a datetime.datetime object
Parameters
---------
timestamp: str
A timstamp in the %Y%m%dT%H%M%S.%fZ format, usually returned by the API
in the ``created_time`` field for example (eg. 20180718T145906.000Z)
... | clashroyale/official_api/client.py | def get_datetime(self, timestamp: str, unix=True):
"""Converts a %Y%m%dT%H%M%S.%fZ to a UNIX timestamp
or a datetime.datetime object
Parameters
---------
timestamp: str
A timstamp in the %Y%m%dT%H%M%S.%fZ format, usually returned by the API
in the ``creat... | def get_datetime(self, timestamp: str, unix=True):
"""Converts a %Y%m%dT%H%M%S.%fZ to a UNIX timestamp
or a datetime.datetime object
Parameters
---------
timestamp: str
A timstamp in the %Y%m%dT%H%M%S.%fZ format, usually returned by the API
in the ``creat... | [
"Converts",
"a",
"%Y%m%dT%H%M%S",
".",
"%fZ",
"to",
"a",
"UNIX",
"timestamp",
"or",
"a",
"datetime",
".",
"datetime",
"object"
] | cgrok/clashroyale | python | https://github.com/cgrok/clashroyale/blob/2618f4da22a84ad3e36d2446e23436d87c423163/clashroyale/official_api/client.py#L621-L639 | [
"def",
"get_datetime",
"(",
"self",
",",
"timestamp",
":",
"str",
",",
"unix",
"=",
"True",
")",
":",
"time",
"=",
"datetime",
".",
"strptime",
"(",
"timestamp",
",",
"'%Y%m%dT%H%M%S.%fZ'",
")",
"if",
"unix",
":",
"return",
"int",
"(",
"time",
".",
"ti... | 2618f4da22a84ad3e36d2446e23436d87c423163 |
valid | PartialClan.get_clan | (a)sync function to return clan. | clashroyale/royaleapi/models.py | def get_clan(self):
"""(a)sync function to return clan."""
try:
return self.client.get_clan(self.clan.tag)
except AttributeError:
try:
return self.client.get_clan(self.tag)
except AttributeError:
raise ValueError('This player do... | def get_clan(self):
"""(a)sync function to return clan."""
try:
return self.client.get_clan(self.clan.tag)
except AttributeError:
try:
return self.client.get_clan(self.tag)
except AttributeError:
raise ValueError('This player do... | [
"(",
"a",
")",
"sync",
"function",
"to",
"return",
"clan",
"."
] | cgrok/clashroyale | python | https://github.com/cgrok/clashroyale/blob/2618f4da22a84ad3e36d2446e23436d87c423163/clashroyale/royaleapi/models.py#L128-L136 | [
"def",
"get_clan",
"(",
"self",
")",
":",
"try",
":",
"return",
"self",
".",
"client",
".",
"get_clan",
"(",
"self",
".",
"clan",
".",
"tag",
")",
"except",
"AttributeError",
":",
"try",
":",
"return",
"self",
".",
"client",
".",
"get_clan",
"(",
"se... | 2618f4da22a84ad3e36d2446e23436d87c423163 |
valid | Refreshable.refresh | (a)sync refresh the data. | clashroyale/official_api/models.py | def refresh(self):
"""(a)sync refresh the data."""
if self.client.is_async:
return self._arefresh()
data, cached, ts, response = self.client._request(self.response.url, timeout=None, refresh=True)
return self.from_data(data, cached, ts, response) | def refresh(self):
"""(a)sync refresh the data."""
if self.client.is_async:
return self._arefresh()
data, cached, ts, response = self.client._request(self.response.url, timeout=None, refresh=True)
return self.from_data(data, cached, ts, response) | [
"(",
"a",
")",
"sync",
"refresh",
"the",
"data",
"."
] | cgrok/clashroyale | python | https://github.com/cgrok/clashroyale/blob/2618f4da22a84ad3e36d2446e23436d87c423163/clashroyale/official_api/models.py#L230-L235 | [
"def",
"refresh",
"(",
"self",
")",
":",
"if",
"self",
".",
"client",
".",
"is_async",
":",
"return",
"self",
".",
"_arefresh",
"(",
")",
"data",
",",
"cached",
",",
"ts",
",",
"response",
"=",
"self",
".",
"client",
".",
"_request",
"(",
"self",
"... | 2618f4da22a84ad3e36d2446e23436d87c423163 |
valid | typecasted | Decorator that converts arguments via annotations. | clashroyale/official_api/utils.py | def typecasted(func):
"""Decorator that converts arguments via annotations."""
signature = inspect.signature(func).parameters.items()
@wraps(func)
def wrapper(*args, **kwargs):
args = list(args)
new_args = []
new_kwargs = {}
for _, param in signature:
convert... | def typecasted(func):
"""Decorator that converts arguments via annotations."""
signature = inspect.signature(func).parameters.items()
@wraps(func)
def wrapper(*args, **kwargs):
args = list(args)
new_args = []
new_kwargs = {}
for _, param in signature:
convert... | [
"Decorator",
"that",
"converts",
"arguments",
"via",
"annotations",
"."
] | cgrok/clashroyale | python | https://github.com/cgrok/clashroyale/blob/2618f4da22a84ad3e36d2446e23436d87c423163/clashroyale/official_api/utils.py#L11-L36 | [
"def",
"typecasted",
"(",
"func",
")",
":",
"signature",
"=",
"inspect",
".",
"signature",
"(",
"func",
")",
".",
"parameters",
".",
"items",
"(",
")",
"@",
"wraps",
"(",
"func",
")",
"def",
"wrapper",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"... | 2618f4da22a84ad3e36d2446e23436d87c423163 |
valid | coerce_annotation | Validate that the annotation has the correct namespace,
and is well-formed.
If the annotation is not of the correct namespace, automatic conversion
is attempted.
Parameters
----------
ann : jams.Annotation
The annotation object in question
namespace : str
The namespace pat... | jams/eval.py | def coerce_annotation(ann, namespace):
'''Validate that the annotation has the correct namespace,
and is well-formed.
If the annotation is not of the correct namespace, automatic conversion
is attempted.
Parameters
----------
ann : jams.Annotation
The annotation object in question
... | def coerce_annotation(ann, namespace):
'''Validate that the annotation has the correct namespace,
and is well-formed.
If the annotation is not of the correct namespace, automatic conversion
is attempted.
Parameters
----------
ann : jams.Annotation
The annotation object in question
... | [
"Validate",
"that",
"the",
"annotation",
"has",
"the",
"correct",
"namespace",
"and",
"is",
"well",
"-",
"formed",
"."
] | marl/jams | python | https://github.com/marl/jams/blob/b16778399b9528efbd71434842a079f7691a7a66/jams/eval.py#L34-L70 | [
"def",
"coerce_annotation",
"(",
"ann",
",",
"namespace",
")",
":",
"ann",
"=",
"convert",
"(",
"ann",
",",
"namespace",
")",
"ann",
".",
"validate",
"(",
"strict",
"=",
"True",
")",
"return",
"ann"
] | b16778399b9528efbd71434842a079f7691a7a66 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.