repo stringlengths 7 55 | path stringlengths 4 223 | func_name stringlengths 1 134 | original_string stringlengths 75 104k | language stringclasses 1
value | code stringlengths 75 104k | code_tokens listlengths 19 28.4k | docstring stringlengths 1 46.9k | docstring_tokens listlengths 1 1.97k | sha stringlengths 40 40 | url stringlengths 87 315 | partition stringclasses 3
values | summary stringlengths 4 350 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
warrenspe/hconf | hconf/Config.py | ConfigManager._setDefaults | def _setDefaults(self):
"""
Sets all the expected configuration options on the config object as either the requested default value, or None.
"""
for configName, configDict in self.configs.items():
self._setConfig(configName, configDict['default']) | python | def _setDefaults(self):
"""
Sets all the expected configuration options on the config object as either the requested default value, or None.
"""
for configName, configDict in self.configs.items():
self._setConfig(configName, configDict['default']) | [
"def",
"_setDefaults",
"(",
"self",
")",
":",
"for",
"configName",
",",
"configDict",
"in",
"self",
".",
"configs",
".",
"items",
"(",
")",
":",
"self",
".",
"_setConfig",
"(",
"configName",
",",
"configDict",
"[",
"'default'",
"]",
")"
] | Sets all the expected configuration options on the config object as either the requested default value, or None. | [
"Sets",
"all",
"the",
"expected",
"configuration",
"options",
"on",
"the",
"config",
"object",
"as",
"either",
"the",
"requested",
"default",
"value",
"or",
"None",
"."
] | 12074d15dc3641d3903488c95d89a507386a32d5 | https://github.com/warrenspe/hconf/blob/12074d15dc3641d3903488c95d89a507386a32d5/hconf/Config.py#L122-L128 | train | Sets all the expected configuration options on the config object as either the requested default value or None. |
warrenspe/hconf | hconf/Config.py | ConfigManager._ensureRequired | def _ensureRequired(self):
"""
Ensures that all configuration options marked as being required have been passed (ie are non-None).
Raises a MissingConfigurationException if a required configuration option was not passed.
"""
for configName, configDict in self.configs.items():
... | python | def _ensureRequired(self):
"""
Ensures that all configuration options marked as being required have been passed (ie are non-None).
Raises a MissingConfigurationException if a required configuration option was not passed.
"""
for configName, configDict in self.configs.items():
... | [
"def",
"_ensureRequired",
"(",
"self",
")",
":",
"for",
"configName",
",",
"configDict",
"in",
"self",
".",
"configs",
".",
"items",
"(",
")",
":",
"if",
"configDict",
"[",
"'required'",
"]",
":",
"if",
"getattr",
"(",
"self",
".",
"_config",
",",
"con... | Ensures that all configuration options marked as being required have been passed (ie are non-None).
Raises a MissingConfigurationException if a required configuration option was not passed. | [
"Ensures",
"that",
"all",
"configuration",
"options",
"marked",
"as",
"being",
"required",
"have",
"been",
"passed",
"(",
"ie",
"are",
"non",
"-",
"None",
")",
".",
"Raises",
"a",
"MissingConfigurationException",
"if",
"a",
"required",
"configuration",
"option",... | 12074d15dc3641d3903488c95d89a507386a32d5 | https://github.com/warrenspe/hconf/blob/12074d15dc3641d3903488c95d89a507386a32d5/hconf/Config.py#L130-L139 | train | Ensures that all configuration options marked as required have been passed. |
warrenspe/hconf | hconf/Config.py | ConfigManager._cast | def _cast(self):
"""
Iterates through our parsed configuration options and cast any options with marked cast types.
"""
for configName, configDict in self.configs.items():
if configDict['cast'] is not None:
configValue = getattr(self._config, configName)
... | python | def _cast(self):
"""
Iterates through our parsed configuration options and cast any options with marked cast types.
"""
for configName, configDict in self.configs.items():
if configDict['cast'] is not None:
configValue = getattr(self._config, configName)
... | [
"def",
"_cast",
"(",
"self",
")",
":",
"for",
"configName",
",",
"configDict",
"in",
"self",
".",
"configs",
".",
"items",
"(",
")",
":",
"if",
"configDict",
"[",
"'cast'",
"]",
"is",
"not",
"None",
":",
"configValue",
"=",
"getattr",
"(",
"self",
".... | Iterates through our parsed configuration options and cast any options with marked cast types. | [
"Iterates",
"through",
"our",
"parsed",
"configuration",
"options",
"and",
"cast",
"any",
"options",
"with",
"marked",
"cast",
"types",
"."
] | 12074d15dc3641d3903488c95d89a507386a32d5 | https://github.com/warrenspe/hconf/blob/12074d15dc3641d3903488c95d89a507386a32d5/hconf/Config.py#L141-L154 | train | Casts all configuration options with marked cast types. |
juju/theblues | theblues/jimm.py | JIMM.list_models | def list_models(self, macaroons):
""" Get the logged in user's models from the JIMM controller.
@param macaroons The discharged JIMM macaroons.
@return The json decoded list of environments.
"""
return make_request("{}model".format(self.url), timeout=self.timeout,
... | python | def list_models(self, macaroons):
""" Get the logged in user's models from the JIMM controller.
@param macaroons The discharged JIMM macaroons.
@return The json decoded list of environments.
"""
return make_request("{}model".format(self.url), timeout=self.timeout,
... | [
"def",
"list_models",
"(",
"self",
",",
"macaroons",
")",
":",
"return",
"make_request",
"(",
"\"{}model\"",
".",
"format",
"(",
"self",
".",
"url",
")",
",",
"timeout",
"=",
"self",
".",
"timeout",
",",
"client",
"=",
"self",
".",
"_client",
",",
"coo... | Get the logged in user's models from the JIMM controller.
@param macaroons The discharged JIMM macaroons.
@return The json decoded list of environments. | [
"Get",
"the",
"logged",
"in",
"user",
"s",
"models",
"from",
"the",
"JIMM",
"controller",
"."
] | f4431f29e43d04fc32f38f4f86cea45cd4e6ae98 | https://github.com/juju/theblues/blob/f4431f29e43d04fc32f38f4f86cea45cd4e6ae98/theblues/jimm.py#L31-L38 | train | Get the list of models from the JIMM controller. |
accraze/python-markov-novel | src/markov_novel/novel.py | Novel.write | def write(self, novel_title='novel', filetype='txt'):
"""
Composes chapters
and writes the novel to a text file
"""
self._compose_chapters()
self._write_to_file(novel_title, filetype) | python | def write(self, novel_title='novel', filetype='txt'):
"""
Composes chapters
and writes the novel to a text file
"""
self._compose_chapters()
self._write_to_file(novel_title, filetype) | [
"def",
"write",
"(",
"self",
",",
"novel_title",
"=",
"'novel'",
",",
"filetype",
"=",
"'txt'",
")",
":",
"self",
".",
"_compose_chapters",
"(",
")",
"self",
".",
"_write_to_file",
"(",
"novel_title",
",",
"filetype",
")"
] | Composes chapters
and writes the novel to a text file | [
"Composes",
"chapters",
"and",
"writes",
"the",
"novel",
"to",
"a",
"text",
"file"
] | ff451639e93a3ac11fb0268b92bc0cffc00bfdbe | https://github.com/accraze/python-markov-novel/blob/ff451639e93a3ac11fb0268b92bc0cffc00bfdbe/src/markov_novel/novel.py#L15-L21 | train | Write the novel to a text file. |
accraze/python-markov-novel | src/markov_novel/novel.py | Novel._compose_chapters | def _compose_chapters(self):
"""
Creates a chapters
and appends them to list
"""
for count in range(self.chapter_count):
chapter_num = count + 1
c = Chapter(self.markov, chapter_num)
self.chapters.append(c) | python | def _compose_chapters(self):
"""
Creates a chapters
and appends them to list
"""
for count in range(self.chapter_count):
chapter_num = count + 1
c = Chapter(self.markov, chapter_num)
self.chapters.append(c) | [
"def",
"_compose_chapters",
"(",
"self",
")",
":",
"for",
"count",
"in",
"range",
"(",
"self",
".",
"chapter_count",
")",
":",
"chapter_num",
"=",
"count",
"+",
"1",
"c",
"=",
"Chapter",
"(",
"self",
".",
"markov",
",",
"chapter_num",
")",
"self",
".",... | Creates a chapters
and appends them to list | [
"Creates",
"a",
"chapters",
"and",
"appends",
"them",
"to",
"list"
] | ff451639e93a3ac11fb0268b92bc0cffc00bfdbe | https://github.com/accraze/python-markov-novel/blob/ff451639e93a3ac11fb0268b92bc0cffc00bfdbe/src/markov_novel/novel.py#L23-L31 | train | Creates a chapters based on the markov and chapter count. |
joeyespo/path-and-address | path_and_address/validation.py | valid_address | def valid_address(address):
"""
Determines whether the specified address string is valid.
"""
if not address:
return False
components = str(address).split(':')
if len(components) > 2 or not valid_hostname(components[0]):
return False
if len(components) == 2 and not valid_po... | python | def valid_address(address):
"""
Determines whether the specified address string is valid.
"""
if not address:
return False
components = str(address).split(':')
if len(components) > 2 or not valid_hostname(components[0]):
return False
if len(components) == 2 and not valid_po... | [
"def",
"valid_address",
"(",
"address",
")",
":",
"if",
"not",
"address",
":",
"return",
"False",
"components",
"=",
"str",
"(",
"address",
")",
".",
"split",
"(",
"':'",
")",
"if",
"len",
"(",
"components",
")",
">",
"2",
"or",
"not",
"valid_hostname"... | Determines whether the specified address string is valid. | [
"Determines",
"whether",
"the",
"specified",
"address",
"string",
"is",
"valid",
"."
] | f8193a09f4b785574d920e8a2aeeb55ea6ff4e20 | https://github.com/joeyespo/path-and-address/blob/f8193a09f4b785574d920e8a2aeeb55ea6ff4e20/path_and_address/validation.py#L7-L21 | train | Determines whether the specified address string is valid. |
joeyespo/path-and-address | path_and_address/validation.py | valid_hostname | def valid_hostname(host):
"""
Returns whether the specified string is a valid hostname.
"""
if len(host) > 255:
return False
if host[-1:] == '.':
host = host[:-1]
return all(_hostname_re.match(c) for c in host.split('.')) | python | def valid_hostname(host):
"""
Returns whether the specified string is a valid hostname.
"""
if len(host) > 255:
return False
if host[-1:] == '.':
host = host[:-1]
return all(_hostname_re.match(c) for c in host.split('.')) | [
"def",
"valid_hostname",
"(",
"host",
")",
":",
"if",
"len",
"(",
"host",
")",
">",
"255",
":",
"return",
"False",
"if",
"host",
"[",
"-",
"1",
":",
"]",
"==",
"'.'",
":",
"host",
"=",
"host",
"[",
":",
"-",
"1",
"]",
"return",
"all",
"(",
"_... | Returns whether the specified string is a valid hostname. | [
"Returns",
"whether",
"the",
"specified",
"string",
"is",
"a",
"valid",
"hostname",
"."
] | f8193a09f4b785574d920e8a2aeeb55ea6ff4e20 | https://github.com/joeyespo/path-and-address/blob/f8193a09f4b785574d920e8a2aeeb55ea6ff4e20/path_and_address/validation.py#L24-L34 | train | Returns whether the specified string is a valid hostname. |
DarkEnergySurvey/ugali | ugali/analysis/imf.py | IMF.integrate | def integrate(self, mass_min, mass_max, log_mode=True, weight=False, steps=1e4):
""" Numerical Riemannn integral of the IMF (stupid simple).
Parameters:
-----------
mass_min: minimum mass bound for integration (solar masses)
mass_max: maximum mass bound for integration (solar ma... | python | def integrate(self, mass_min, mass_max, log_mode=True, weight=False, steps=1e4):
""" Numerical Riemannn integral of the IMF (stupid simple).
Parameters:
-----------
mass_min: minimum mass bound for integration (solar masses)
mass_max: maximum mass bound for integration (solar ma... | [
"def",
"integrate",
"(",
"self",
",",
"mass_min",
",",
"mass_max",
",",
"log_mode",
"=",
"True",
",",
"weight",
"=",
"False",
",",
"steps",
"=",
"1e4",
")",
":",
"if",
"log_mode",
":",
"d_log_mass",
"=",
"(",
"np",
".",
"log10",
"(",
"mass_max",
")",... | Numerical Riemannn integral of the IMF (stupid simple).
Parameters:
-----------
mass_min: minimum mass bound for integration (solar masses)
mass_max: maximum mass bound for integration (solar masses)
log_mode[True]: use logarithmic steps in stellar mass as oppose to linear
... | [
"Numerical",
"Riemannn",
"integral",
"of",
"the",
"IMF",
"(",
"stupid",
"simple",
")",
"."
] | 21e890b4117fc810afb6fb058e8055d564f03382 | https://github.com/DarkEnergySurvey/ugali/blob/21e890b4117fc810afb6fb058e8055d564f03382/ugali/analysis/imf.py#L23-L54 | train | Integrates the IMF by integrating the mass between mass_min and mass_max. |
DarkEnergySurvey/ugali | ugali/analysis/imf.py | IMF.sample | def sample(self, n, mass_min=0.1, mass_max=10., steps=10000, seed=None):
"""
Sample initial mass values between mass_min and mass_max,
following the IMF distribution.
ADW: Should this be `sample` or `simulate`?
Parameters:
-----------
n : number of samples to dr... | python | def sample(self, n, mass_min=0.1, mass_max=10., steps=10000, seed=None):
"""
Sample initial mass values between mass_min and mass_max,
following the IMF distribution.
ADW: Should this be `sample` or `simulate`?
Parameters:
-----------
n : number of samples to dr... | [
"def",
"sample",
"(",
"self",
",",
"n",
",",
"mass_min",
"=",
"0.1",
",",
"mass_max",
"=",
"10.",
",",
"steps",
"=",
"10000",
",",
"seed",
"=",
"None",
")",
":",
"if",
"seed",
"is",
"not",
"None",
":",
"np",
".",
"random",
".",
"seed",
"(",
"se... | Sample initial mass values between mass_min and mass_max,
following the IMF distribution.
ADW: Should this be `sample` or `simulate`?
Parameters:
-----------
n : number of samples to draw
mass_min : minimum mass to sample from
mass_max : maximum mass to sample f... | [
"Sample",
"initial",
"mass",
"values",
"between",
"mass_min",
"and",
"mass_max",
"following",
"the",
"IMF",
"distribution",
"."
] | 21e890b4117fc810afb6fb058e8055d564f03382 | https://github.com/DarkEnergySurvey/ugali/blob/21e890b4117fc810afb6fb058e8055d564f03382/ugali/analysis/imf.py#L56-L81 | train | Draw random values from the ISOchrone. |
DarkEnergySurvey/ugali | ugali/analysis/imf.py | Chabrier2003.pdf | def pdf(cls, mass, log_mode=True):
""" PDF for the Chabrier IMF.
The functional form and coefficients are described in Eq 17
and Tab 1 of Chabrier (2003):
m <= 1 Msun: E(log m) = A1*exp(-(log m - log m_c)^2 / 2 sigma^2)
m > 1 Msun: E(log m) = A2 * m^-x
... | python | def pdf(cls, mass, log_mode=True):
""" PDF for the Chabrier IMF.
The functional form and coefficients are described in Eq 17
and Tab 1 of Chabrier (2003):
m <= 1 Msun: E(log m) = A1*exp(-(log m - log m_c)^2 / 2 sigma^2)
m > 1 Msun: E(log m) = A2 * m^-x
... | [
"def",
"pdf",
"(",
"cls",
",",
"mass",
",",
"log_mode",
"=",
"True",
")",
":",
"log_mass",
"=",
"np",
".",
"log10",
"(",
"mass",
")",
"# Constants from Chabrier 2003",
"m_c",
"=",
"0.079",
"sigma",
"=",
"0.69",
"x",
"=",
"1.3",
"# This value is set to norm... | PDF for the Chabrier IMF.
The functional form and coefficients are described in Eq 17
and Tab 1 of Chabrier (2003):
m <= 1 Msun: E(log m) = A1*exp(-(log m - log m_c)^2 / 2 sigma^2)
m > 1 Msun: E(log m) = A2 * m^-x
A1 = 1.58 : normalization [ log(Msun)^... | [
"PDF",
"for",
"the",
"Chabrier",
"IMF",
".",
"The",
"functional",
"form",
"and",
"coefficients",
"are",
"described",
"in",
"Eq",
"17",
"and",
"Tab",
"1",
"of",
"Chabrier",
"(",
"2003",
")",
":"
] | 21e890b4117fc810afb6fb058e8055d564f03382 | https://github.com/DarkEnergySurvey/ugali/blob/21e890b4117fc810afb6fb058e8055d564f03382/ugali/analysis/imf.py#L95-L144 | train | PDF for Chabrier 2003. |
DarkEnergySurvey/ugali | ugali/analysis/imf.py | Kroupa2001.pdf | def pdf(cls, mass, log_mode=True):
""" PDF for the Kroupa IMF.
Normalization is set over the mass range from 0.1 Msun to 100 Msun
"""
log_mass = np.log10(mass)
# From Eq 2
mb = mbreak = [0.08, 0.5] # Msun
a = alpha = [0.3, 1.3, 2.3] # alpha
# Normalizat... | python | def pdf(cls, mass, log_mode=True):
""" PDF for the Kroupa IMF.
Normalization is set over the mass range from 0.1 Msun to 100 Msun
"""
log_mass = np.log10(mass)
# From Eq 2
mb = mbreak = [0.08, 0.5] # Msun
a = alpha = [0.3, 1.3, 2.3] # alpha
# Normalizat... | [
"def",
"pdf",
"(",
"cls",
",",
"mass",
",",
"log_mode",
"=",
"True",
")",
":",
"log_mass",
"=",
"np",
".",
"log10",
"(",
"mass",
")",
"# From Eq 2",
"mb",
"=",
"mbreak",
"=",
"[",
"0.08",
",",
"0.5",
"]",
"# Msun",
"a",
"=",
"alpha",
"=",
"[",
... | PDF for the Kroupa IMF.
Normalization is set over the mass range from 0.1 Msun to 100 Msun | [
"PDF",
"for",
"the",
"Kroupa",
"IMF",
"."
] | 21e890b4117fc810afb6fb058e8055d564f03382 | https://github.com/DarkEnergySurvey/ugali/blob/21e890b4117fc810afb6fb058e8055d564f03382/ugali/analysis/imf.py#L155-L181 | train | PDF for the Kroupa IMF. |
DarkEnergySurvey/ugali | ugali/analysis/imf.py | Salpeter1955.pdf | def pdf(cls, mass, log_mode=True):
""" PDF for the Salpeter IMF.
Value of 'a' is set to normalize the IMF to 1 between 0.1 and 100 Msun
"""
alpha = 2.35
a = 0.060285569480482866
dn_dm = a * mass**(-alpha)
if log_mode:
# Number per logarithmic mass ... | python | def pdf(cls, mass, log_mode=True):
""" PDF for the Salpeter IMF.
Value of 'a' is set to normalize the IMF to 1 between 0.1 and 100 Msun
"""
alpha = 2.35
a = 0.060285569480482866
dn_dm = a * mass**(-alpha)
if log_mode:
# Number per logarithmic mass ... | [
"def",
"pdf",
"(",
"cls",
",",
"mass",
",",
"log_mode",
"=",
"True",
")",
":",
"alpha",
"=",
"2.35",
"a",
"=",
"0.060285569480482866",
"dn_dm",
"=",
"a",
"*",
"mass",
"**",
"(",
"-",
"alpha",
")",
"if",
"log_mode",
":",
"# Number per logarithmic mass ran... | PDF for the Salpeter IMF.
Value of 'a' is set to normalize the IMF to 1 between 0.1 and 100 Msun | [
"PDF",
"for",
"the",
"Salpeter",
"IMF",
"."
] | 21e890b4117fc810afb6fb058e8055d564f03382 | https://github.com/DarkEnergySurvey/ugali/blob/21e890b4117fc810afb6fb058e8055d564f03382/ugali/analysis/imf.py#L191-L206 | train | PDF for the Salpeter IMF. |
warrenspe/hconf | hconf/subparsers/_subparser.py | ConfigFileSubparser._getConfigFile | def _getConfigFile(self, config):
"""
Retrieves a file descriptor to a configuration file to process.
Inputs: config - The _Config object which is being populated.
Outputs: An open file descriptor to the configuration file to parse in read mode if successful, else None.
"""
... | python | def _getConfigFile(self, config):
"""
Retrieves a file descriptor to a configuration file to process.
Inputs: config - The _Config object which is being populated.
Outputs: An open file descriptor to the configuration file to parse in read mode if successful, else None.
"""
... | [
"def",
"_getConfigFile",
"(",
"self",
",",
"config",
")",
":",
"joinPath",
"=",
"lambda",
"p",
":",
"(",
"os",
".",
"path",
".",
"join",
"(",
"p",
")",
"if",
"isinstance",
"(",
"p",
",",
"(",
"tuple",
",",
"list",
")",
")",
"else",
"p",
")",
"i... | Retrieves a file descriptor to a configuration file to process.
Inputs: config - The _Config object which is being populated.
Outputs: An open file descriptor to the configuration file to parse in read mode if successful, else None. | [
"Retrieves",
"a",
"file",
"descriptor",
"to",
"a",
"configuration",
"file",
"to",
"process",
"."
] | 12074d15dc3641d3903488c95d89a507386a32d5 | https://github.com/warrenspe/hconf/blob/12074d15dc3641d3903488c95d89a507386a32d5/hconf/subparsers/_subparser.py#L83-L107 | train | Returns an open file descriptor to a configuration file to process in read mode if successful else None. |
schlamar/latexmk.py | latexmake.py | _count_citations | def _count_citations(aux_file):
'''
Counts the citations in an aux-file.
@return: defaultdict(int) - {citation_name: number, ...}
'''
counter = defaultdict(int)
with open(aux_file) as fobj:
content = fobj.read()
for match in CITE_PATTERN.finditer(content):
name = match.grou... | python | def _count_citations(aux_file):
'''
Counts the citations in an aux-file.
@return: defaultdict(int) - {citation_name: number, ...}
'''
counter = defaultdict(int)
with open(aux_file) as fobj:
content = fobj.read()
for match in CITE_PATTERN.finditer(content):
name = match.grou... | [
"def",
"_count_citations",
"(",
"aux_file",
")",
":",
"counter",
"=",
"defaultdict",
"(",
"int",
")",
"with",
"open",
"(",
"aux_file",
")",
"as",
"fobj",
":",
"content",
"=",
"fobj",
".",
"read",
"(",
")",
"for",
"match",
"in",
"CITE_PATTERN",
".",
"fi... | Counts the citations in an aux-file.
@return: defaultdict(int) - {citation_name: number, ...} | [
"Counts",
"the",
"citations",
"in",
"an",
"aux",
"-",
"file",
"."
] | 88baba40ff3e844e4542de60d2032503e206d996 | https://github.com/schlamar/latexmk.py/blob/88baba40ff3e844e4542de60d2032503e206d996/latexmake.py#L429-L443 | train | Counts the citations in an aux - file. |
schlamar/latexmk.py | latexmake.py | main | def main():
'''
Set up "optparse" and pass the options to
a new instance of L{LatexMaker}.
'''
prog = 'latexmk.py'
version = __version__
usage = '%prog [options] [filename]'
# Read description from doc
doc_text = ''
for line in __doc__.splitlines():
if line.find('#') == ... | python | def main():
'''
Set up "optparse" and pass the options to
a new instance of L{LatexMaker}.
'''
prog = 'latexmk.py'
version = __version__
usage = '%prog [options] [filename]'
# Read description from doc
doc_text = ''
for line in __doc__.splitlines():
if line.find('#') == ... | [
"def",
"main",
"(",
")",
":",
"prog",
"=",
"'latexmk.py'",
"version",
"=",
"__version__",
"usage",
"=",
"'%prog [options] [filename]'",
"# Read description from doc",
"doc_text",
"=",
"''",
"for",
"line",
"in",
"__doc__",
".",
"splitlines",
"(",
")",
":",
"if",
... | Set up "optparse" and pass the options to
a new instance of L{LatexMaker}. | [
"Set",
"up",
"optparse",
"and",
"pass",
"the",
"options",
"to",
"a",
"new",
"instance",
"of",
"L",
"{",
"LatexMaker",
"}",
"."
] | 88baba40ff3e844e4542de60d2032503e206d996 | https://github.com/schlamar/latexmk.py/blob/88baba40ff3e844e4542de60d2032503e206d996/latexmake.py#L446-L493 | train | This function is the main function of the LaTeXMK command line interface. It is used to parse the command line arguments and return the resulting object. |
schlamar/latexmk.py | latexmake.py | LatexMaker._setup_logger | def _setup_logger(self):
'''Set up a logger.'''
log = logging.getLogger('latexmk.py')
handler = logging.StreamHandler()
log.addHandler(handler)
if self.opt.verbose:
log.setLevel(logging.INFO)
return log | python | def _setup_logger(self):
'''Set up a logger.'''
log = logging.getLogger('latexmk.py')
handler = logging.StreamHandler()
log.addHandler(handler)
if self.opt.verbose:
log.setLevel(logging.INFO)
return log | [
"def",
"_setup_logger",
"(",
"self",
")",
":",
"log",
"=",
"logging",
".",
"getLogger",
"(",
"'latexmk.py'",
")",
"handler",
"=",
"logging",
".",
"StreamHandler",
"(",
")",
"log",
".",
"addHandler",
"(",
"handler",
")",
"if",
"self",
".",
"opt",
".",
"... | Set up a logger. | [
"Set",
"up",
"a",
"logger",
"."
] | 88baba40ff3e844e4542de60d2032503e206d996 | https://github.com/schlamar/latexmk.py/blob/88baba40ff3e844e4542de60d2032503e206d996/latexmake.py#L84-L93 | train | Set up a logger. |
schlamar/latexmk.py | latexmake.py | LatexMaker._parse_texlipse_config | def _parse_texlipse_config(self):
'''
Read the project name from the texlipse
config file ".texlipse".
'''
# If Eclipse's workspace refresh, the
# ".texlipse"-File will be newly created,
# so try again after short sleep if
# the file is still missing.
... | python | def _parse_texlipse_config(self):
'''
Read the project name from the texlipse
config file ".texlipse".
'''
# If Eclipse's workspace refresh, the
# ".texlipse"-File will be newly created,
# so try again after short sleep if
# the file is still missing.
... | [
"def",
"_parse_texlipse_config",
"(",
"self",
")",
":",
"# If Eclipse's workspace refresh, the",
"# \".texlipse\"-File will be newly created,",
"# so try again after short sleep if",
"# the file is still missing.",
"if",
"not",
"os",
".",
"path",
".",
"isfile",
"(",
"'.texlipse'"... | Read the project name from the texlipse
config file ".texlipse". | [
"Read",
"the",
"project",
"name",
"from",
"the",
"texlipse",
"config",
"file",
".",
"texlipse",
"."
] | 88baba40ff3e844e4542de60d2032503e206d996 | https://github.com/schlamar/latexmk.py/blob/88baba40ff3e844e4542de60d2032503e206d996/latexmake.py#L95-L122 | train | Parse the. texlipse config file. |
schlamar/latexmk.py | latexmake.py | LatexMaker._read_latex_files | def _read_latex_files(self):
'''
Check if some latex output files exist
before first latex run, process them and return
the generated data.
- Parsing *.aux for citations counter and
existing glossaries.
- Getting content of files to detect changes.
... | python | def _read_latex_files(self):
'''
Check if some latex output files exist
before first latex run, process them and return
the generated data.
- Parsing *.aux for citations counter and
existing glossaries.
- Getting content of files to detect changes.
... | [
"def",
"_read_latex_files",
"(",
"self",
")",
":",
"if",
"os",
".",
"path",
".",
"isfile",
"(",
"'%s.aux'",
"%",
"self",
".",
"project_name",
")",
":",
"cite_counter",
"=",
"self",
".",
"generate_citation_counter",
"(",
")",
"self",
".",
"read_glossaries",
... | Check if some latex output files exist
before first latex run, process them and return
the generated data.
- Parsing *.aux for citations counter and
existing glossaries.
- Getting content of files to detect changes.
- *.toc file
- al... | [
"Check",
"if",
"some",
"latex",
"output",
"files",
"exist",
"before",
"first",
"latex",
"run",
"process",
"them",
"and",
"return",
"the",
"generated",
"data",
"."
] | 88baba40ff3e844e4542de60d2032503e206d996 | https://github.com/schlamar/latexmk.py/blob/88baba40ff3e844e4542de60d2032503e206d996/latexmake.py#L124-L158 | train | Read all latex output files and return the citations counter toc file and gloss files. |
schlamar/latexmk.py | latexmake.py | LatexMaker._is_toc_changed | def _is_toc_changed(self, toc_file):
'''
Test if the *.toc file has changed during
the first latex run.
'''
fname = '%s.toc' % self.project_name
if os.path.isfile(fname):
with open(fname) as fobj:
if fobj.read() != toc_file:
... | python | def _is_toc_changed(self, toc_file):
'''
Test if the *.toc file has changed during
the first latex run.
'''
fname = '%s.toc' % self.project_name
if os.path.isfile(fname):
with open(fname) as fobj:
if fobj.read() != toc_file:
... | [
"def",
"_is_toc_changed",
"(",
"self",
",",
"toc_file",
")",
":",
"fname",
"=",
"'%s.toc'",
"%",
"self",
".",
"project_name",
"if",
"os",
".",
"path",
".",
"isfile",
"(",
"fname",
")",
":",
"with",
"open",
"(",
"fname",
")",
"as",
"fobj",
":",
"if",
... | Test if the *.toc file has changed during
the first latex run. | [
"Test",
"if",
"the",
"*",
".",
"toc",
"file",
"has",
"changed",
"during",
"the",
"first",
"latex",
"run",
"."
] | 88baba40ff3e844e4542de60d2032503e206d996 | https://github.com/schlamar/latexmk.py/blob/88baba40ff3e844e4542de60d2032503e206d996/latexmake.py#L160-L169 | train | Test if the. toc file has changed during latex run. |
schlamar/latexmk.py | latexmake.py | LatexMaker._need_bib_run | def _need_bib_run(self, old_cite_counter):
'''
Determine if you need to run "bibtex".
1. Check if *.bib exists.
2. Check latex output for hints.
3. Test if the numbers of citations changed
during first latex run.
4. Examine *.bib for changes.
'''
... | python | def _need_bib_run(self, old_cite_counter):
'''
Determine if you need to run "bibtex".
1. Check if *.bib exists.
2. Check latex output for hints.
3. Test if the numbers of citations changed
during first latex run.
4. Examine *.bib for changes.
'''
... | [
"def",
"_need_bib_run",
"(",
"self",
",",
"old_cite_counter",
")",
":",
"with",
"open",
"(",
"'%s.aux'",
"%",
"self",
".",
"project_name",
")",
"as",
"fobj",
":",
"match",
"=",
"BIB_PATTERN",
".",
"search",
"(",
"fobj",
".",
"read",
"(",
")",
")",
"if"... | Determine if you need to run "bibtex".
1. Check if *.bib exists.
2. Check latex output for hints.
3. Test if the numbers of citations changed
during first latex run.
4. Examine *.bib for changes. | [
"Determine",
"if",
"you",
"need",
"to",
"run",
"bibtex",
".",
"1",
".",
"Check",
"if",
"*",
".",
"bib",
"exists",
".",
"2",
".",
"Check",
"latex",
"output",
"for",
"hints",
".",
"3",
".",
"Test",
"if",
"the",
"numbers",
"of",
"citations",
"changed",
... | 88baba40ff3e844e4542de60d2032503e206d996 | https://github.com/schlamar/latexmk.py/blob/88baba40ff3e844e4542de60d2032503e206d996/latexmake.py#L171-L202 | train | Determine if we need to run bibtex. |
schlamar/latexmk.py | latexmake.py | LatexMaker.read_glossaries | def read_glossaries(self):
'''
Read all existing glossaries in the main aux-file.
'''
filename = '%s.aux' % self.project_name
with open(filename) as fobj:
main_aux = fobj.read()
pattern = r'\\@newglossary\{(.*)\}\{.*\}\{(.*)\}\{(.*)\}'
for match in re... | python | def read_glossaries(self):
'''
Read all existing glossaries in the main aux-file.
'''
filename = '%s.aux' % self.project_name
with open(filename) as fobj:
main_aux = fobj.read()
pattern = r'\\@newglossary\{(.*)\}\{.*\}\{(.*)\}\{(.*)\}'
for match in re... | [
"def",
"read_glossaries",
"(",
"self",
")",
":",
"filename",
"=",
"'%s.aux'",
"%",
"self",
".",
"project_name",
"with",
"open",
"(",
"filename",
")",
"as",
"fobj",
":",
"main_aux",
"=",
"fobj",
".",
"read",
"(",
")",
"pattern",
"=",
"r'\\\\@newglossary\\{(... | Read all existing glossaries in the main aux-file. | [
"Read",
"all",
"existing",
"glossaries",
"in",
"the",
"main",
"aux",
"-",
"file",
"."
] | 88baba40ff3e844e4542de60d2032503e206d996 | https://github.com/schlamar/latexmk.py/blob/88baba40ff3e844e4542de60d2032503e206d996/latexmake.py#L204-L215 | train | Read all existing glossaries in the main aux - file. |
schlamar/latexmk.py | latexmake.py | LatexMaker.check_errors | def check_errors(self):
'''
Check if errors occured during a latex run by
scanning the output.
'''
errors = ERROR_PATTTERN.findall(self.out)
# "errors" is a list of tuples
if errors:
self.log.error('! Errors occurred:')
self.log.error('\n'... | python | def check_errors(self):
'''
Check if errors occured during a latex run by
scanning the output.
'''
errors = ERROR_PATTTERN.findall(self.out)
# "errors" is a list of tuples
if errors:
self.log.error('! Errors occurred:')
self.log.error('\n'... | [
"def",
"check_errors",
"(",
"self",
")",
":",
"errors",
"=",
"ERROR_PATTTERN",
".",
"findall",
"(",
"self",
".",
"out",
")",
"# \"errors\" is a list of tuples",
"if",
"errors",
":",
"self",
".",
"log",
".",
"error",
"(",
"'! Errors occurred:'",
")",
"self",
... | Check if errors occured during a latex run by
scanning the output. | [
"Check",
"if",
"errors",
"occured",
"during",
"a",
"latex",
"run",
"by",
"scanning",
"the",
"output",
"."
] | 88baba40ff3e844e4542de60d2032503e206d996 | https://github.com/schlamar/latexmk.py/blob/88baba40ff3e844e4542de60d2032503e206d996/latexmake.py#L217-L236 | train | Check if errors occured during a latex run by
clf. |
schlamar/latexmk.py | latexmake.py | LatexMaker.generate_citation_counter | def generate_citation_counter(self):
'''
Generate dictionary with the number of citations in all
included files. If this changes after the first latex run,
you have to run "bibtex".
'''
cite_counter = dict()
filename = '%s.aux' % self.project_name
with ope... | python | def generate_citation_counter(self):
'''
Generate dictionary with the number of citations in all
included files. If this changes after the first latex run,
you have to run "bibtex".
'''
cite_counter = dict()
filename = '%s.aux' % self.project_name
with ope... | [
"def",
"generate_citation_counter",
"(",
"self",
")",
":",
"cite_counter",
"=",
"dict",
"(",
")",
"filename",
"=",
"'%s.aux'",
"%",
"self",
".",
"project_name",
"with",
"open",
"(",
"filename",
")",
"as",
"fobj",
":",
"main_aux",
"=",
"fobj",
".",
"read",
... | Generate dictionary with the number of citations in all
included files. If this changes after the first latex run,
you have to run "bibtex". | [
"Generate",
"dictionary",
"with",
"the",
"number",
"of",
"citations",
"in",
"all",
"included",
"files",
".",
"If",
"this",
"changes",
"after",
"the",
"first",
"latex",
"run",
"you",
"have",
"to",
"run",
"bibtex",
"."
] | 88baba40ff3e844e4542de60d2032503e206d996 | https://github.com/schlamar/latexmk.py/blob/88baba40ff3e844e4542de60d2032503e206d996/latexmake.py#L238-L259 | train | Generate dictionary with the number of citations in all
included files. |
schlamar/latexmk.py | latexmake.py | LatexMaker.latex_run | def latex_run(self):
'''
Start latex run.
'''
self.log.info('Running %s...' % self.latex_cmd)
cmd = [self.latex_cmd]
cmd.extend(LATEX_FLAGS)
cmd.append('%s.tex' % self.project_name)
try:
with open(os.devnull, 'w') as null:
Popen... | python | def latex_run(self):
'''
Start latex run.
'''
self.log.info('Running %s...' % self.latex_cmd)
cmd = [self.latex_cmd]
cmd.extend(LATEX_FLAGS)
cmd.append('%s.tex' % self.project_name)
try:
with open(os.devnull, 'w') as null:
Popen... | [
"def",
"latex_run",
"(",
"self",
")",
":",
"self",
".",
"log",
".",
"info",
"(",
"'Running %s...'",
"%",
"self",
".",
"latex_cmd",
")",
"cmd",
"=",
"[",
"self",
".",
"latex_cmd",
"]",
"cmd",
".",
"extend",
"(",
"LATEX_FLAGS",
")",
"cmd",
".",
"append... | Start latex run. | [
"Start",
"latex",
"run",
"."
] | 88baba40ff3e844e4542de60d2032503e206d996 | https://github.com/schlamar/latexmk.py/blob/88baba40ff3e844e4542de60d2032503e206d996/latexmake.py#L261-L279 | train | Start latex run. |
schlamar/latexmk.py | latexmake.py | LatexMaker.bibtex_run | def bibtex_run(self):
'''
Start bibtex run.
'''
self.log.info('Running bibtex...')
try:
with open(os.devnull, 'w') as null:
Popen(['bibtex', self.project_name], stdout=null).wait()
except OSError:
self.log.error(NO_LATEX_ERROR % 'bi... | python | def bibtex_run(self):
'''
Start bibtex run.
'''
self.log.info('Running bibtex...')
try:
with open(os.devnull, 'w') as null:
Popen(['bibtex', self.project_name], stdout=null).wait()
except OSError:
self.log.error(NO_LATEX_ERROR % 'bi... | [
"def",
"bibtex_run",
"(",
"self",
")",
":",
"self",
".",
"log",
".",
"info",
"(",
"'Running bibtex...'",
")",
"try",
":",
"with",
"open",
"(",
"os",
".",
"devnull",
",",
"'w'",
")",
"as",
"null",
":",
"Popen",
"(",
"[",
"'bibtex'",
",",
"self",
"."... | Start bibtex run. | [
"Start",
"bibtex",
"run",
"."
] | 88baba40ff3e844e4542de60d2032503e206d996 | https://github.com/schlamar/latexmk.py/blob/88baba40ff3e844e4542de60d2032503e206d996/latexmake.py#L281-L294 | train | Start bibtex run. |
schlamar/latexmk.py | latexmake.py | LatexMaker.makeindex_runs | def makeindex_runs(self, gloss_files):
'''
Check for each glossary if it has to be regenerated
with "makeindex".
@return: True if "makeindex" was called.
'''
gloss_changed = False
for gloss in self.glossaries:
make_gloss = False
ext_i, ext... | python | def makeindex_runs(self, gloss_files):
'''
Check for each glossary if it has to be regenerated
with "makeindex".
@return: True if "makeindex" was called.
'''
gloss_changed = False
for gloss in self.glossaries:
make_gloss = False
ext_i, ext... | [
"def",
"makeindex_runs",
"(",
"self",
",",
"gloss_files",
")",
":",
"gloss_changed",
"=",
"False",
"for",
"gloss",
"in",
"self",
".",
"glossaries",
":",
"make_gloss",
"=",
"False",
"ext_i",
",",
"ext_o",
"=",
"self",
".",
"glossaries",
"[",
"gloss",
"]",
... | Check for each glossary if it has to be regenerated
with "makeindex".
@return: True if "makeindex" was called. | [
"Check",
"for",
"each",
"glossary",
"if",
"it",
"has",
"to",
"be",
"regenerated",
"with",
"makeindex",
"."
] | 88baba40ff3e844e4542de60d2032503e206d996 | https://github.com/schlamar/latexmk.py/blob/88baba40ff3e844e4542de60d2032503e206d996/latexmake.py#L296-L334 | train | Check for each glossary if it has to be regenerated
with makeindex. |
schlamar/latexmk.py | latexmake.py | LatexMaker.open_preview | def open_preview(self):
'''
Try to open a preview of the generated document.
Currently only supported on Windows.
'''
self.log.info('Opening preview...')
if self.opt.pdf:
ext = 'pdf'
else:
ext = 'dvi'
filename = '%s.%s' % (self.proj... | python | def open_preview(self):
'''
Try to open a preview of the generated document.
Currently only supported on Windows.
'''
self.log.info('Opening preview...')
if self.opt.pdf:
ext = 'pdf'
else:
ext = 'dvi'
filename = '%s.%s' % (self.proj... | [
"def",
"open_preview",
"(",
"self",
")",
":",
"self",
".",
"log",
".",
"info",
"(",
"'Opening preview...'",
")",
"if",
"self",
".",
"opt",
".",
"pdf",
":",
"ext",
"=",
"'pdf'",
"else",
":",
"ext",
"=",
"'dvi'",
"filename",
"=",
"'%s.%s'",
"%",
"(",
... | Try to open a preview of the generated document.
Currently only supported on Windows. | [
"Try",
"to",
"open",
"a",
"preview",
"of",
"the",
"generated",
"document",
".",
"Currently",
"only",
"supported",
"on",
"Windows",
"."
] | 88baba40ff3e844e4542de60d2032503e206d996 | https://github.com/schlamar/latexmk.py/blob/88baba40ff3e844e4542de60d2032503e206d996/latexmake.py#L336-L361 | train | Try to open a preview of the generated document. |
schlamar/latexmk.py | latexmake.py | LatexMaker.need_latex_rerun | def need_latex_rerun(self):
'''
Test for all rerun patterns if they match the output.
'''
for pattern in LATEX_RERUN_PATTERNS:
if pattern.search(self.out):
return True
return False | python | def need_latex_rerun(self):
'''
Test for all rerun patterns if they match the output.
'''
for pattern in LATEX_RERUN_PATTERNS:
if pattern.search(self.out):
return True
return False | [
"def",
"need_latex_rerun",
"(",
"self",
")",
":",
"for",
"pattern",
"in",
"LATEX_RERUN_PATTERNS",
":",
"if",
"pattern",
".",
"search",
"(",
"self",
".",
"out",
")",
":",
"return",
"True",
"return",
"False"
] | Test for all rerun patterns if they match the output. | [
"Test",
"for",
"all",
"rerun",
"patterns",
"if",
"they",
"match",
"the",
"output",
"."
] | 88baba40ff3e844e4542de60d2032503e206d996 | https://github.com/schlamar/latexmk.py/blob/88baba40ff3e844e4542de60d2032503e206d996/latexmake.py#L363-L370 | train | Test for all rerun patterns that match the output. |
schlamar/latexmk.py | latexmake.py | LatexMaker.run | def run(self):
'''Run the LaTeX compilation.'''
# store files
self.old_dir = []
if self.opt.clean:
self.old_dir = os.listdir('.')
cite_counter, toc_file, gloss_files = self._read_latex_files()
self.latex_run()
self.read_glossaries()
gloss_ch... | python | def run(self):
'''Run the LaTeX compilation.'''
# store files
self.old_dir = []
if self.opt.clean:
self.old_dir = os.listdir('.')
cite_counter, toc_file, gloss_files = self._read_latex_files()
self.latex_run()
self.read_glossaries()
gloss_ch... | [
"def",
"run",
"(",
"self",
")",
":",
"# store files",
"self",
".",
"old_dir",
"=",
"[",
"]",
"if",
"self",
".",
"opt",
".",
"clean",
":",
"self",
".",
"old_dir",
"=",
"os",
".",
"listdir",
"(",
"'.'",
")",
"cite_counter",
",",
"toc_file",
",",
"glo... | Run the LaTeX compilation. | [
"Run",
"the",
"LaTeX",
"compilation",
"."
] | 88baba40ff3e844e4542de60d2032503e206d996 | https://github.com/schlamar/latexmk.py/blob/88baba40ff3e844e4542de60d2032503e206d996/latexmake.py#L372-L426 | train | Run the LaTeX compilation. |
DarkEnergySurvey/ugali | ugali/analysis/farm.py | Farm.command | def command(self, outfile, configfile, pix):
"""
Generate the command for running the likelihood scan.
"""
params = dict(script=self.config['scan']['script'],
config=configfile, outfile=outfile,
nside=self.nside_likelihood, pix=pix,
... | python | def command(self, outfile, configfile, pix):
"""
Generate the command for running the likelihood scan.
"""
params = dict(script=self.config['scan']['script'],
config=configfile, outfile=outfile,
nside=self.nside_likelihood, pix=pix,
... | [
"def",
"command",
"(",
"self",
",",
"outfile",
",",
"configfile",
",",
"pix",
")",
":",
"params",
"=",
"dict",
"(",
"script",
"=",
"self",
".",
"config",
"[",
"'scan'",
"]",
"[",
"'script'",
"]",
",",
"config",
"=",
"configfile",
",",
"outfile",
"=",... | Generate the command for running the likelihood scan. | [
"Generate",
"the",
"command",
"for",
"running",
"the",
"likelihood",
"scan",
"."
] | 21e890b4117fc810afb6fb058e8055d564f03382 | https://github.com/DarkEnergySurvey/ugali/blob/21e890b4117fc810afb6fb058e8055d564f03382/ugali/analysis/farm.py#L47-L56 | train | Generate the command to run the likelihood scan. |
DarkEnergySurvey/ugali | ugali/analysis/farm.py | Farm.footprint | def footprint(self, nside=None):
"""
UNTESTED.
Should return a boolean array representing the pixels in the footprint.
"""
if nside is None:
nside = self.nside_pixel
elif nside < self.nside_catalog:
raise Exception('Requested nside=%i is less than... | python | def footprint(self, nside=None):
"""
UNTESTED.
Should return a boolean array representing the pixels in the footprint.
"""
if nside is None:
nside = self.nside_pixel
elif nside < self.nside_catalog:
raise Exception('Requested nside=%i is less than... | [
"def",
"footprint",
"(",
"self",
",",
"nside",
"=",
"None",
")",
":",
"if",
"nside",
"is",
"None",
":",
"nside",
"=",
"self",
".",
"nside_pixel",
"elif",
"nside",
"<",
"self",
".",
"nside_catalog",
":",
"raise",
"Exception",
"(",
"'Requested nside=%i is le... | UNTESTED.
Should return a boolean array representing the pixels in the footprint. | [
"UNTESTED",
".",
"Should",
"return",
"a",
"boolean",
"array",
"representing",
"the",
"pixels",
"in",
"the",
"footprint",
"."
] | 21e890b4117fc810afb6fb058e8055d564f03382 | https://github.com/DarkEnergySurvey/ugali/blob/21e890b4117fc810afb6fb058e8055d564f03382/ugali/analysis/farm.py#L59-L72 | train | Returns a boolean array representing the pixels in the footprint. |
DarkEnergySurvey/ugali | ugali/analysis/farm.py | Farm.inFootprint | def inFootprint(self, pixels, nside=None):
"""
Open each valid filename for the set of pixels and determine the set
of subpixels with valid data.
"""
if np.isscalar(pixels): pixels = np.array([pixels])
if nside is None: nside = self.nside_likelihood
inside = np.... | python | def inFootprint(self, pixels, nside=None):
"""
Open each valid filename for the set of pixels and determine the set
of subpixels with valid data.
"""
if np.isscalar(pixels): pixels = np.array([pixels])
if nside is None: nside = self.nside_likelihood
inside = np.... | [
"def",
"inFootprint",
"(",
"self",
",",
"pixels",
",",
"nside",
"=",
"None",
")",
":",
"if",
"np",
".",
"isscalar",
"(",
"pixels",
")",
":",
"pixels",
"=",
"np",
".",
"array",
"(",
"[",
"pixels",
"]",
")",
"if",
"nside",
"is",
"None",
":",
"nside... | Open each valid filename for the set of pixels and determine the set
of subpixels with valid data. | [
"Open",
"each",
"valid",
"filename",
"for",
"the",
"set",
"of",
"pixels",
"and",
"determine",
"the",
"set",
"of",
"subpixels",
"with",
"valid",
"data",
"."
] | 21e890b4117fc810afb6fb058e8055d564f03382 | https://github.com/DarkEnergySurvey/ugali/blob/21e890b4117fc810afb6fb058e8055d564f03382/ugali/analysis/farm.py#L75-L102 | train | Determine the set of set
of subpixels with valid data. |
DarkEnergySurvey/ugali | ugali/analysis/farm.py | Farm.submit_all | def submit_all(self, coords=None, queue=None, debug=False):
"""
Submit likelihood analyses on a set of coordinates. If
coords is `None`, submit all coordinates in the footprint.
Inputs:
coords : Array of target locations in Galactic coordinates.
queue : Overwrite submi... | python | def submit_all(self, coords=None, queue=None, debug=False):
"""
Submit likelihood analyses on a set of coordinates. If
coords is `None`, submit all coordinates in the footprint.
Inputs:
coords : Array of target locations in Galactic coordinates.
queue : Overwrite submi... | [
"def",
"submit_all",
"(",
"self",
",",
"coords",
"=",
"None",
",",
"queue",
"=",
"None",
",",
"debug",
"=",
"False",
")",
":",
"if",
"coords",
"is",
"None",
":",
"pixels",
"=",
"np",
".",
"arange",
"(",
"hp",
".",
"nside2npix",
"(",
"self",
".",
... | Submit likelihood analyses on a set of coordinates. If
coords is `None`, submit all coordinates in the footprint.
Inputs:
coords : Array of target locations in Galactic coordinates.
queue : Overwrite submit queue.
debug : Don't run. | [
"Submit",
"likelihood",
"analyses",
"on",
"a",
"set",
"of",
"coordinates",
".",
"If",
"coords",
"is",
"None",
"submit",
"all",
"coordinates",
"in",
"the",
"footprint",
"."
] | 21e890b4117fc810afb6fb058e8055d564f03382 | https://github.com/DarkEnergySurvey/ugali/blob/21e890b4117fc810afb6fb058e8055d564f03382/ugali/analysis/farm.py#L104-L153 | train | Submit likelihood analyses on a set of target locations. |
DarkEnergySurvey/ugali | ugali/analysis/farm.py | Farm.submit | def submit(self, pixels, queue=None, debug=False, configfile=None):
"""
Submit the likelihood job for the given pixel(s).
"""
# For backwards compatibility
batch = self.config['scan'].get('batch',self.config['batch'])
queue = batch['cluster'] if queue is None else queue
... | python | def submit(self, pixels, queue=None, debug=False, configfile=None):
"""
Submit the likelihood job for the given pixel(s).
"""
# For backwards compatibility
batch = self.config['scan'].get('batch',self.config['batch'])
queue = batch['cluster'] if queue is None else queue
... | [
"def",
"submit",
"(",
"self",
",",
"pixels",
",",
"queue",
"=",
"None",
",",
"debug",
"=",
"False",
",",
"configfile",
"=",
"None",
")",
":",
"# For backwards compatibility",
"batch",
"=",
"self",
".",
"config",
"[",
"'scan'",
"]",
".",
"get",
"(",
"'b... | Submit the likelihood job for the given pixel(s). | [
"Submit",
"the",
"likelihood",
"job",
"for",
"the",
"given",
"pixel",
"(",
"s",
")",
"."
] | 21e890b4117fc810afb6fb058e8055d564f03382 | https://github.com/DarkEnergySurvey/ugali/blob/21e890b4117fc810afb6fb058e8055d564f03382/ugali/analysis/farm.py#L155-L226 | train | Submit a likelihood job for the given pixels. |
Genida/django-appsettings | src/appsettings/__init__.py | AppSettings.check | def check(cls):
"""
Class method to check every settings.
Will raise an ``ImproperlyConfigured`` exception with explanation.
"""
if cls == AppSettings:
return None
exceptions = []
for setting in cls.settings.values():
try:
... | python | def check(cls):
"""
Class method to check every settings.
Will raise an ``ImproperlyConfigured`` exception with explanation.
"""
if cls == AppSettings:
return None
exceptions = []
for setting in cls.settings.values():
try:
... | [
"def",
"check",
"(",
"cls",
")",
":",
"if",
"cls",
"==",
"AppSettings",
":",
"return",
"None",
"exceptions",
"=",
"[",
"]",
"for",
"setting",
"in",
"cls",
".",
"settings",
".",
"values",
"(",
")",
":",
"try",
":",
"setting",
".",
"check",
"(",
")",... | Class method to check every settings.
Will raise an ``ImproperlyConfigured`` exception with explanation. | [
"Class",
"method",
"to",
"check",
"every",
"settings",
"."
] | f98867d133558af7dc067f12b44fc1ee4edd4239 | https://github.com/Genida/django-appsettings/blob/f98867d133558af7dc067f12b44fc1ee4edd4239/src/appsettings/__init__.py#L192-L209 | train | Check every settings. |
DarkEnergySurvey/ugali | ugali/utils/mlab.py | rec_append_fields | def rec_append_fields(rec, names, arrs, dtypes=None):
"""
Return a new record array with field names populated with data
from arrays in *arrs*. If appending a single field, then *names*,
*arrs* and *dtypes* do not have to be lists. They can just be the
values themselves.
"""
if (not isstrin... | python | def rec_append_fields(rec, names, arrs, dtypes=None):
"""
Return a new record array with field names populated with data
from arrays in *arrs*. If appending a single field, then *names*,
*arrs* and *dtypes* do not have to be lists. They can just be the
values themselves.
"""
if (not isstrin... | [
"def",
"rec_append_fields",
"(",
"rec",
",",
"names",
",",
"arrs",
",",
"dtypes",
"=",
"None",
")",
":",
"if",
"(",
"not",
"isstring",
"(",
"names",
")",
"and",
"iterable",
"(",
"names",
")",
"and",
"len",
"(",
"names",
")",
"and",
"isstring",
"(",
... | Return a new record array with field names populated with data
from arrays in *arrs*. If appending a single field, then *names*,
*arrs* and *dtypes* do not have to be lists. They can just be the
values themselves. | [
"Return",
"a",
"new",
"record",
"array",
"with",
"field",
"names",
"populated",
"with",
"data",
"from",
"arrays",
"in",
"*",
"arrs",
"*",
".",
"If",
"appending",
"a",
"single",
"field",
"then",
"*",
"names",
"*",
"*",
"arrs",
"*",
"and",
"*",
"dtypes",... | 21e890b4117fc810afb6fb058e8055d564f03382 | https://github.com/DarkEnergySurvey/ugali/blob/21e890b4117fc810afb6fb058e8055d564f03382/ugali/utils/mlab.py#L20-L52 | train | Append fields to a record array. |
alphagov/performanceplatform-collector | performanceplatform/collector/arguments.py | parse_args | def parse_args(name="", args=None):
"""Parse command line argument for a collector
Returns an argparse.Namespace with 'config' and 'query' options"""
def _load_json_file(path):
with open(path) as f:
json_data = json.load(f)
json_data['path_to_json_file'] = path
r... | python | def parse_args(name="", args=None):
"""Parse command line argument for a collector
Returns an argparse.Namespace with 'config' and 'query' options"""
def _load_json_file(path):
with open(path) as f:
json_data = json.load(f)
json_data['path_to_json_file'] = path
r... | [
"def",
"parse_args",
"(",
"name",
"=",
"\"\"",
",",
"args",
"=",
"None",
")",
":",
"def",
"_load_json_file",
"(",
"path",
")",
":",
"with",
"open",
"(",
"path",
")",
"as",
"f",
":",
"json_data",
"=",
"json",
".",
"load",
"(",
"f",
")",
"json_data",... | Parse command line argument for a collector
Returns an argparse.Namespace with 'config' and 'query' options | [
"Parse",
"command",
"line",
"argument",
"for",
"a",
"collector"
] | de68ab4aa500c31e436e050fa1268fa928c522a5 | https://github.com/alphagov/performanceplatform-collector/blob/de68ab4aa500c31e436e050fa1268fa928c522a5/performanceplatform/collector/arguments.py#L6-L63 | train | Parse command line arguments for a collector and return a Namespace with config and query options |
warrenspe/hconf | hconf/subparsers/json_.py | JSON.parse | def parse(self, configManager, config):
"""
Parse configuration options out of a YAML configuration file.
Inputs: configManager - Our parent ConfigManager instance which is constructing the Config object.
config - The _Config object containing configuration options popula... | python | def parse(self, configManager, config):
"""
Parse configuration options out of a YAML configuration file.
Inputs: configManager - Our parent ConfigManager instance which is constructing the Config object.
config - The _Config object containing configuration options popula... | [
"def",
"parse",
"(",
"self",
",",
"configManager",
",",
"config",
")",
":",
"jsonConfigs",
"=",
"json",
".",
"loads",
"(",
"self",
".",
"jsonString",
")",
"if",
"isinstance",
"(",
"jsonConfigs",
",",
"dict",
")",
":",
"return",
"jsonConfigs",
"raise",
"s... | Parse configuration options out of a YAML configuration file.
Inputs: configManager - Our parent ConfigManager instance which is constructing the Config object.
config - The _Config object containing configuration options populated thus far.
Outputs: A dictionary of new configur... | [
"Parse",
"configuration",
"options",
"out",
"of",
"a",
"YAML",
"configuration",
"file",
"."
] | 12074d15dc3641d3903488c95d89a507386a32d5 | https://github.com/warrenspe/hconf/blob/12074d15dc3641d3903488c95d89a507386a32d5/hconf/subparsers/json_.py#L41-L56 | train | Parse the configuration options out of a YAML configuration file. |
consbio/ncdjango | ncdjango/config.py | ConfigurationBase.set_time_index_from_datetime | def set_time_index_from_datetime(self, value, best_fit=True):
"""
Sets the time_index parameter from a datetime using start/end/interval/units information from the service
configuration. If best_fit is True, the method will match the closest time index for the given value, otherwise
it w... | python | def set_time_index_from_datetime(self, value, best_fit=True):
"""
Sets the time_index parameter from a datetime using start/end/interval/units information from the service
configuration. If best_fit is True, the method will match the closest time index for the given value, otherwise
it w... | [
"def",
"set_time_index_from_datetime",
"(",
"self",
",",
"value",
",",
"best_fit",
"=",
"True",
")",
":",
"steps",
"=",
"self",
".",
"variable",
".",
"time_stops",
"if",
"value",
"in",
"steps",
":",
"self",
".",
"time_index",
"=",
"steps",
".",
"index",
... | Sets the time_index parameter from a datetime using start/end/interval/units information from the service
configuration. If best_fit is True, the method will match the closest time index for the given value, otherwise
it will raise a ValueError for any value which doesn't exactly match a time index. | [
"Sets",
"the",
"time_index",
"parameter",
"from",
"a",
"datetime",
"using",
"start",
"/",
"end",
"/",
"interval",
"/",
"units",
"information",
"from",
"the",
"service",
"configuration",
".",
"If",
"best_fit",
"is",
"True",
"the",
"method",
"will",
"match",
"... | f807bfd1e4083ab29fbc3c4d4418be108383a710 | https://github.com/consbio/ncdjango/blob/f807bfd1e4083ab29fbc3c4d4418be108383a710/ncdjango/config.py#L28-L41 | train | Sets the time_index parameter from a datetime using start end interval and units information from the service
configuration. |
consbio/ncdjango | ncdjango/config.py | RenderConfiguration.hash | def hash(self):
"""
Returns a hash of this render configuration from the variable, renderer, and time_index parameters. Used for
caching the full-extent, native projection render so that subsequent requests can be served by a warp
operation only.
"""
renderer_str = "{}|{... | python | def hash(self):
"""
Returns a hash of this render configuration from the variable, renderer, and time_index parameters. Used for
caching the full-extent, native projection render so that subsequent requests can be served by a warp
operation only.
"""
renderer_str = "{}|{... | [
"def",
"hash",
"(",
"self",
")",
":",
"renderer_str",
"=",
"\"{}|{}|{}|{}\"",
".",
"format",
"(",
"self",
".",
"renderer",
".",
"__class__",
".",
"__name__",
",",
"self",
".",
"renderer",
".",
"colormap",
",",
"self",
".",
"renderer",
".",
"fill_value",
... | Returns a hash of this render configuration from the variable, renderer, and time_index parameters. Used for
caching the full-extent, native projection render so that subsequent requests can be served by a warp
operation only. | [
"Returns",
"a",
"hash",
"of",
"this",
"render",
"configuration",
"from",
"the",
"variable",
"renderer",
"and",
"time_index",
"parameters",
".",
"Used",
"for",
"caching",
"the",
"full",
"-",
"extent",
"native",
"projection",
"render",
"so",
"that",
"subsequent",
... | f807bfd1e4083ab29fbc3c4d4418be108383a710 | https://github.com/consbio/ncdjango/blob/f807bfd1e4083ab29fbc3c4d4418be108383a710/ncdjango/config.py#L54-L70 | train | Returns a hash of the current render configuration from the variable renderer and time_index parameters. |
DarkEnergySurvey/ugali | ugali/utils/factory.py | factory | def factory(type, module=None, **kwargs):
"""
Factory for creating objects. Arguments are passed directly to the
constructor of the chosen class.
"""
cls = type
if module is None: module = __name__
fn = lambda member: inspect.isclass(member) and member.__module__==module
classes = odict(... | python | def factory(type, module=None, **kwargs):
"""
Factory for creating objects. Arguments are passed directly to the
constructor of the chosen class.
"""
cls = type
if module is None: module = __name__
fn = lambda member: inspect.isclass(member) and member.__module__==module
classes = odict(... | [
"def",
"factory",
"(",
"type",
",",
"module",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"cls",
"=",
"type",
"if",
"module",
"is",
"None",
":",
"module",
"=",
"__name__",
"fn",
"=",
"lambda",
"member",
":",
"inspect",
".",
"isclass",
"(",
"mem... | Factory for creating objects. Arguments are passed directly to the
constructor of the chosen class. | [
"Factory",
"for",
"creating",
"objects",
".",
"Arguments",
"are",
"passed",
"directly",
"to",
"the",
"constructor",
"of",
"the",
"chosen",
"class",
"."
] | 21e890b4117fc810afb6fb058e8055d564f03382 | https://github.com/DarkEnergySurvey/ugali/blob/21e890b4117fc810afb6fb058e8055d564f03382/ugali/utils/factory.py#L9-L23 | train | Factory for creating objects of the specified type. Arguments are passed directly to the
constructor of the chosen class. |
DarkEnergySurvey/ugali | ugali/utils/idl.py | jprecess | def jprecess(ra, dec, mu_radec=None, parallax=None, rad_vel=None, epoch=None):
"""
NAME:
JPRECESS
PURPOSE:
Precess astronomical coordinates from B1950 to J2000
EXPLANATION:
Calculate the mean place of a star at J2000.0 on the FK5 system from the
mean place at B1950.0 o... | python | def jprecess(ra, dec, mu_radec=None, parallax=None, rad_vel=None, epoch=None):
"""
NAME:
JPRECESS
PURPOSE:
Precess astronomical coordinates from B1950 to J2000
EXPLANATION:
Calculate the mean place of a star at J2000.0 on the FK5 system from the
mean place at B1950.0 o... | [
"def",
"jprecess",
"(",
"ra",
",",
"dec",
",",
"mu_radec",
"=",
"None",
",",
"parallax",
"=",
"None",
",",
"rad_vel",
"=",
"None",
",",
"epoch",
"=",
"None",
")",
":",
"if",
"isinstance",
"(",
"ra",
",",
"ndarray",
")",
":",
"ra",
"=",
"array",
"... | NAME:
JPRECESS
PURPOSE:
Precess astronomical coordinates from B1950 to J2000
EXPLANATION:
Calculate the mean place of a star at J2000.0 on the FK5 system from the
mean place at B1950.0 on the FK4 system.
Use BPRECESS for the reverse direction J2000 ==> B1950
... | [
"NAME",
":",
"JPRECESS",
"PURPOSE",
":",
"Precess",
"astronomical",
"coordinates",
"from",
"B1950",
"to",
"J2000",
"EXPLANATION",
":",
"Calculate",
"the",
"mean",
"place",
"of",
"a",
"star",
"at",
"J2000",
".",
"0",
"on",
"the",
"FK5",
"system",
"from",
"t... | 21e890b4117fc810afb6fb058e8055d564f03382 | https://github.com/DarkEnergySurvey/ugali/blob/21e890b4117fc810afb6fb058e8055d564f03382/ugali/utils/idl.py#L5-L211 | train | This function calculates the mean place of a star at a given J2000 position. |
DarkEnergySurvey/ugali | ugali/utils/idl.py | bprecess | def bprecess(ra0, dec0, mu_radec=None, parallax=None, rad_vel=None, epoch=None):
"""
NAME:
BPRECESS
PURPOSE:
Precess positions from J2000.0 (FK5) to B1950.0 (FK4)
EXPLANATION:
Calculates the mean place of a star at B1950.0 on the FK4 system from
the mean place at J... | python | def bprecess(ra0, dec0, mu_radec=None, parallax=None, rad_vel=None, epoch=None):
"""
NAME:
BPRECESS
PURPOSE:
Precess positions from J2000.0 (FK5) to B1950.0 (FK4)
EXPLANATION:
Calculates the mean place of a star at B1950.0 on the FK4 system from
the mean place at J... | [
"def",
"bprecess",
"(",
"ra0",
",",
"dec0",
",",
"mu_radec",
"=",
"None",
",",
"parallax",
"=",
"None",
",",
"rad_vel",
"=",
"None",
",",
"epoch",
"=",
"None",
")",
":",
"scal",
"=",
"True",
"if",
"isinstance",
"(",
"ra0",
",",
"ndarray",
")",
":",... | NAME:
BPRECESS
PURPOSE:
Precess positions from J2000.0 (FK5) to B1950.0 (FK4)
EXPLANATION:
Calculates the mean place of a star at B1950.0 on the FK4 system from
the mean place at J2000.0 on the FK5 system.
CALLING SEQUENCE:
bprecess, ra, dec, ra_1950, de... | [
"NAME",
":",
"BPRECESS",
"PURPOSE",
":",
"Precess",
"positions",
"from",
"J2000",
".",
"0",
"(",
"FK5",
")",
"to",
"B1950",
".",
"0",
"(",
"FK4",
")",
"EXPLANATION",
":",
"Calculates",
"the",
"mean",
"place",
"of",
"a",
"star",
"at",
"B1950",
".",
"0... | 21e890b4117fc810afb6fb058e8055d564f03382 | https://github.com/DarkEnergySurvey/ugali/blob/21e890b4117fc810afb6fb058e8055d564f03382/ugali/utils/idl.py#L214-L418 | train | A function that calculates the mean place of a star at B1950. 0 on the FK4 system. |
consbio/ncdjango | ncdjango/interfaces/arcgis_extended/utils.py | get_renderer_from_definition | def get_renderer_from_definition(config):
"""Returns a renderer object based on the configuration (as a dictionary)"""
options = config.get('options', {})
try:
renderer_type = config['type']
renderer_colors = [(float(x[0]), hex_to_color(x[1])) for x in config['colors']]
fill_value ... | python | def get_renderer_from_definition(config):
"""Returns a renderer object based on the configuration (as a dictionary)"""
options = config.get('options', {})
try:
renderer_type = config['type']
renderer_colors = [(float(x[0]), hex_to_color(x[1])) for x in config['colors']]
fill_value ... | [
"def",
"get_renderer_from_definition",
"(",
"config",
")",
":",
"options",
"=",
"config",
".",
"get",
"(",
"'options'",
",",
"{",
"}",
")",
"try",
":",
"renderer_type",
"=",
"config",
"[",
"'type'",
"]",
"renderer_colors",
"=",
"[",
"(",
"float",
"(",
"x... | Returns a renderer object based on the configuration (as a dictionary) | [
"Returns",
"a",
"renderer",
"object",
"based",
"on",
"the",
"configuration",
"(",
"as",
"a",
"dictionary",
")"
] | f807bfd1e4083ab29fbc3c4d4418be108383a710 | https://github.com/consbio/ncdjango/blob/f807bfd1e4083ab29fbc3c4d4418be108383a710/ncdjango/interfaces/arcgis_extended/utils.py#L8-L43 | train | Returns a renderer object based on the configuration |
consbio/ncdjango | ncdjango/interfaces/arcgis_extended/utils.py | get_definition_from_renderer | def get_definition_from_renderer(renderer):
"""Returns a dictionary definition of the given renderer"""
config = {
'colors': [[x[0], x[1].to_hex()] for x in renderer.colormap],
'options': {}
}
if renderer.fill_value:
config['options']['fill_value'] = renderer.fill_value
if... | python | def get_definition_from_renderer(renderer):
"""Returns a dictionary definition of the given renderer"""
config = {
'colors': [[x[0], x[1].to_hex()] for x in renderer.colormap],
'options': {}
}
if renderer.fill_value:
config['options']['fill_value'] = renderer.fill_value
if... | [
"def",
"get_definition_from_renderer",
"(",
"renderer",
")",
":",
"config",
"=",
"{",
"'colors'",
":",
"[",
"[",
"x",
"[",
"0",
"]",
",",
"x",
"[",
"1",
"]",
".",
"to_hex",
"(",
")",
"]",
"for",
"x",
"in",
"renderer",
".",
"colormap",
"]",
",",
"... | Returns a dictionary definition of the given renderer | [
"Returns",
"a",
"dictionary",
"definition",
"of",
"the",
"given",
"renderer"
] | f807bfd1e4083ab29fbc3c4d4418be108383a710 | https://github.com/consbio/ncdjango/blob/f807bfd1e4083ab29fbc3c4d4418be108383a710/ncdjango/interfaces/arcgis_extended/utils.py#L46-L69 | train | Returns a dictionary definition of the given renderer |
DarkEnergySurvey/ugali | ugali/analysis/source.py | Source.params | def params(self):
""" Return a *copy* (we hope) of the parameters.
DANGER: Altering properties directly doesn't call model._cache
"""
params = odict([])
for key,model in self.models.items():
params.update(model.params)
return params | python | def params(self):
""" Return a *copy* (we hope) of the parameters.
DANGER: Altering properties directly doesn't call model._cache
"""
params = odict([])
for key,model in self.models.items():
params.update(model.params)
return params | [
"def",
"params",
"(",
"self",
")",
":",
"params",
"=",
"odict",
"(",
"[",
"]",
")",
"for",
"key",
",",
"model",
"in",
"self",
".",
"models",
".",
"items",
"(",
")",
":",
"params",
".",
"update",
"(",
"model",
".",
"params",
")",
"return",
"params... | Return a *copy* (we hope) of the parameters.
DANGER: Altering properties directly doesn't call model._cache | [
"Return",
"a",
"*",
"copy",
"*",
"(",
"we",
"hope",
")",
"of",
"the",
"parameters",
".",
"DANGER",
":",
"Altering",
"properties",
"directly",
"doesn",
"t",
"call",
"model",
".",
"_cache"
] | 21e890b4117fc810afb6fb058e8055d564f03382 | https://github.com/DarkEnergySurvey/ugali/blob/21e890b4117fc810afb6fb058e8055d564f03382/ugali/analysis/source.py#L90-L97 | train | Return a copy of the parameters. |
DarkEnergySurvey/ugali | ugali/analysis/source.py | Source.set_model | def set_model(self, name, model):
""" Set a model.
Parameters
----------
name : name of the model -- e.g., richness, kernel, isochrone, etc.
model : the model instance
Returns
-------
None
"""
# Careful to not use `hasattr`
# htt... | python | def set_model(self, name, model):
""" Set a model.
Parameters
----------
name : name of the model -- e.g., richness, kernel, isochrone, etc.
model : the model instance
Returns
-------
None
"""
# Careful to not use `hasattr`
# htt... | [
"def",
"set_model",
"(",
"self",
",",
"name",
",",
"model",
")",
":",
"# Careful to not use `hasattr`",
"# https://hynek.me/articles/hasattr/",
"try",
":",
"self",
".",
"__getattribute__",
"(",
"'models'",
")",
"except",
"AttributeError",
":",
"object",
".",
"__seta... | Set a model.
Parameters
----------
name : name of the model -- e.g., richness, kernel, isochrone, etc.
model : the model instance
Returns
-------
None | [
"Set",
"a",
"model",
"."
] | 21e890b4117fc810afb6fb058e8055d564f03382 | https://github.com/DarkEnergySurvey/ugali/blob/21e890b4117fc810afb6fb058e8055d564f03382/ugali/analysis/source.py#L170-L188 | train | Set a model instance for the current object. |
DarkEnergySurvey/ugali | ugali/analysis/source.py | Source.set_params | def set_params(self,**kwargs):
""" Set the parameter values """
for key,value in list(kwargs.items()):
setattr(self,key,value) | python | def set_params(self,**kwargs):
""" Set the parameter values """
for key,value in list(kwargs.items()):
setattr(self,key,value) | [
"def",
"set_params",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"for",
"key",
",",
"value",
"in",
"list",
"(",
"kwargs",
".",
"items",
"(",
")",
")",
":",
"setattr",
"(",
"self",
",",
"key",
",",
"value",
")"
] | Set the parameter values | [
"Set",
"the",
"parameter",
"values"
] | 21e890b4117fc810afb6fb058e8055d564f03382 | https://github.com/DarkEnergySurvey/ugali/blob/21e890b4117fc810afb6fb058e8055d564f03382/ugali/analysis/source.py#L196-L199 | train | Set the parameter values |
DarkEnergySurvey/ugali | ugali/analysis/source.py | Source.get_params | def get_params(self):
""" Get an odict of the parameter names and values """
return odict([(key,param.value) for key,param in self.params.items()]) | python | def get_params(self):
""" Get an odict of the parameter names and values """
return odict([(key,param.value) for key,param in self.params.items()]) | [
"def",
"get_params",
"(",
"self",
")",
":",
"return",
"odict",
"(",
"[",
"(",
"key",
",",
"param",
".",
"value",
")",
"for",
"key",
",",
"param",
"in",
"self",
".",
"params",
".",
"items",
"(",
")",
"]",
")"
] | Get an odict of the parameter names and values | [
"Get",
"an",
"odict",
"of",
"the",
"parameter",
"names",
"and",
"values"
] | 21e890b4117fc810afb6fb058e8055d564f03382 | https://github.com/DarkEnergySurvey/ugali/blob/21e890b4117fc810afb6fb058e8055d564f03382/ugali/analysis/source.py#L201-L203 | train | Get an odict of the parameter names and values |
DarkEnergySurvey/ugali | ugali/analysis/source.py | Source.get_free_params | def get_free_params(self):
""" Get an odict of free parameter names and values """
return odict([(key,param.value) for key,param in self.params.items() if param.free]) | python | def get_free_params(self):
""" Get an odict of free parameter names and values """
return odict([(key,param.value) for key,param in self.params.items() if param.free]) | [
"def",
"get_free_params",
"(",
"self",
")",
":",
"return",
"odict",
"(",
"[",
"(",
"key",
",",
"param",
".",
"value",
")",
"for",
"key",
",",
"param",
"in",
"self",
".",
"params",
".",
"items",
"(",
")",
"if",
"param",
".",
"free",
"]",
")"
] | Get an odict of free parameter names and values | [
"Get",
"an",
"odict",
"of",
"free",
"parameter",
"names",
"and",
"values"
] | 21e890b4117fc810afb6fb058e8055d564f03382 | https://github.com/DarkEnergySurvey/ugali/blob/21e890b4117fc810afb6fb058e8055d564f03382/ugali/analysis/source.py#L205-L207 | train | Get an odict of free parameter names and values |
totalgood/pugnlp | src/pugnlp/regexes.py | iter_finds | def iter_finds(regex_obj, s):
"""Generate all matches found within a string for a regex and yield each match as a string"""
if isinstance(regex_obj, str):
for m in re.finditer(regex_obj, s):
yield m.group()
else:
for m in regex_obj.finditer(s):
yield m.group() | python | def iter_finds(regex_obj, s):
"""Generate all matches found within a string for a regex and yield each match as a string"""
if isinstance(regex_obj, str):
for m in re.finditer(regex_obj, s):
yield m.group()
else:
for m in regex_obj.finditer(s):
yield m.group() | [
"def",
"iter_finds",
"(",
"regex_obj",
",",
"s",
")",
":",
"if",
"isinstance",
"(",
"regex_obj",
",",
"str",
")",
":",
"for",
"m",
"in",
"re",
".",
"finditer",
"(",
"regex_obj",
",",
"s",
")",
":",
"yield",
"m",
".",
"group",
"(",
")",
"else",
":... | Generate all matches found within a string for a regex and yield each match as a string | [
"Generate",
"all",
"matches",
"found",
"within",
"a",
"string",
"for",
"a",
"regex",
"and",
"yield",
"each",
"match",
"as",
"a",
"string"
] | c43445b14afddfdeadc5f3076675c9e8fc1ee67c | https://github.com/totalgood/pugnlp/blob/c43445b14afddfdeadc5f3076675c9e8fc1ee67c/src/pugnlp/regexes.py#L292-L299 | train | Generate all matches found within a string for a regex and yield each match as a string |
totalgood/pugnlp | src/pugnlp/regexes.py | wrap | def wrap(s, prefix=r'\b', suffix=r'\b', grouper='()'):
r"""Wrap a string (tyically a regex) with a prefix and suffix (usually a nonconuming word break)
Arguments:
prefix, suffix (str): strings to append to the front and back of the provided string
grouper (2-len str or 2-tuple): characters or string... | python | def wrap(s, prefix=r'\b', suffix=r'\b', grouper='()'):
r"""Wrap a string (tyically a regex) with a prefix and suffix (usually a nonconuming word break)
Arguments:
prefix, suffix (str): strings to append to the front and back of the provided string
grouper (2-len str or 2-tuple): characters or string... | [
"def",
"wrap",
"(",
"s",
",",
"prefix",
"=",
"r'\\b'",
",",
"suffix",
"=",
"r'\\b'",
",",
"grouper",
"=",
"'()'",
")",
":",
"return",
"(",
"(",
"prefix",
"or",
"''",
")",
"+",
"try_get",
"(",
"grouper",
",",
"0",
",",
"''",
")",
"+",
"(",
"s",
... | r"""Wrap a string (tyically a regex) with a prefix and suffix (usually a nonconuming word break)
Arguments:
prefix, suffix (str): strings to append to the front and back of the provided string
grouper (2-len str or 2-tuple): characters or strings to separate prefix and suffix from the middle
>>> wra... | [
"r",
"Wrap",
"a",
"string",
"(",
"tyically",
"a",
"regex",
")",
"with",
"a",
"prefix",
"and",
"suffix",
"(",
"usually",
"a",
"nonconuming",
"word",
"break",
")",
"Arguments",
":",
"prefix",
"suffix",
"(",
"str",
")",
":",
"strings",
"to",
"append",
"to... | c43445b14afddfdeadc5f3076675c9e8fc1ee67c | https://github.com/totalgood/pugnlp/blob/c43445b14afddfdeadc5f3076675c9e8fc1ee67c/src/pugnlp/regexes.py#L316-L327 | train | r Wrap a string with a prefix and suffix |
DarkEnergySurvey/ugali | ugali/isochrone/composite.py | CompositeIsochrone.composite_decorator | def composite_decorator(func):
"""
Decorator for wrapping functions that calculate a weighted sum
"""
@wraps(func)
def wrapper(self, *args, **kwargs):
total = []
for weight,iso in zip(self.weights,self.isochrones):
subfunc = getattr(iso,fun... | python | def composite_decorator(func):
"""
Decorator for wrapping functions that calculate a weighted sum
"""
@wraps(func)
def wrapper(self, *args, **kwargs):
total = []
for weight,iso in zip(self.weights,self.isochrones):
subfunc = getattr(iso,fun... | [
"def",
"composite_decorator",
"(",
"func",
")",
":",
"@",
"wraps",
"(",
"func",
")",
"def",
"wrapper",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"total",
"=",
"[",
"]",
"for",
"weight",
",",
"iso",
"in",
"zip",
"(",
"self"... | Decorator for wrapping functions that calculate a weighted sum | [
"Decorator",
"for",
"wrapping",
"functions",
"that",
"calculate",
"a",
"weighted",
"sum"
] | 21e890b4117fc810afb6fb058e8055d564f03382 | https://github.com/DarkEnergySurvey/ugali/blob/21e890b4117fc810afb6fb058e8055d564f03382/ugali/isochrone/composite.py#L83-L94 | train | Decorator for wrapping functions that calculate a weighted sum
|
DarkEnergySurvey/ugali | ugali/observation/catalog.py | mergeCatalogs | def mergeCatalogs(catalog_list):
"""
Merge a list of Catalogs.
Parameters:
-----------
catalog_list : List of Catalog objects.
Returns:
--------
catalog : Combined Catalog object
"""
# Check the columns
for c in catalog_list:
if c.data.dtype.names != catalog_l... | python | def mergeCatalogs(catalog_list):
"""
Merge a list of Catalogs.
Parameters:
-----------
catalog_list : List of Catalog objects.
Returns:
--------
catalog : Combined Catalog object
"""
# Check the columns
for c in catalog_list:
if c.data.dtype.names != catalog_l... | [
"def",
"mergeCatalogs",
"(",
"catalog_list",
")",
":",
"# Check the columns",
"for",
"c",
"in",
"catalog_list",
":",
"if",
"c",
".",
"data",
".",
"dtype",
".",
"names",
"!=",
"catalog_list",
"[",
"0",
"]",
".",
"data",
".",
"dtype",
".",
"names",
":",
... | Merge a list of Catalogs.
Parameters:
-----------
catalog_list : List of Catalog objects.
Returns:
--------
catalog : Combined Catalog object | [
"Merge",
"a",
"list",
"of",
"Catalogs",
"."
] | 21e890b4117fc810afb6fb058e8055d564f03382 | https://github.com/DarkEnergySurvey/ugali/blob/21e890b4117fc810afb6fb058e8055d564f03382/ugali/observation/catalog.py#L254-L273 | train | Merge a list of Catalogs into a single object. |
DarkEnergySurvey/ugali | ugali/observation/catalog.py | Catalog.applyCut | def applyCut(self, cut):
"""
Return a new catalog which is a subset of objects selected
using the input cut array.
NOTE: This is really a *selection* (i.e., objects are retained if the value of 'cut' is True)
"""
return Catalog(self.config, data=self.data[cut]) | python | def applyCut(self, cut):
"""
Return a new catalog which is a subset of objects selected
using the input cut array.
NOTE: This is really a *selection* (i.e., objects are retained if the value of 'cut' is True)
"""
return Catalog(self.config, data=self.data[cut]) | [
"def",
"applyCut",
"(",
"self",
",",
"cut",
")",
":",
"return",
"Catalog",
"(",
"self",
".",
"config",
",",
"data",
"=",
"self",
".",
"data",
"[",
"cut",
"]",
")"
] | Return a new catalog which is a subset of objects selected
using the input cut array.
NOTE: This is really a *selection* (i.e., objects are retained if the value of 'cut' is True) | [
"Return",
"a",
"new",
"catalog",
"which",
"is",
"a",
"subset",
"of",
"objects",
"selected",
"using",
"the",
"input",
"cut",
"array",
"."
] | 21e890b4117fc810afb6fb058e8055d564f03382 | https://github.com/DarkEnergySurvey/ugali/blob/21e890b4117fc810afb6fb058e8055d564f03382/ugali/observation/catalog.py#L54-L61 | train | Returns a new catalog which is a subset of objects selectedby the input cut array. |
DarkEnergySurvey/ugali | ugali/observation/catalog.py | Catalog.bootstrap | def bootstrap(self, mc_bit=0x10, seed=None):
"""
Return a random catalog by boostrapping the colors of the objects in the current catalog.
"""
if seed is not None: np.random.seed(seed)
data = copy.deepcopy(self.data)
idx = np.random.randint(0,len(data),len(data))
... | python | def bootstrap(self, mc_bit=0x10, seed=None):
"""
Return a random catalog by boostrapping the colors of the objects in the current catalog.
"""
if seed is not None: np.random.seed(seed)
data = copy.deepcopy(self.data)
idx = np.random.randint(0,len(data),len(data))
... | [
"def",
"bootstrap",
"(",
"self",
",",
"mc_bit",
"=",
"0x10",
",",
"seed",
"=",
"None",
")",
":",
"if",
"seed",
"is",
"not",
"None",
":",
"np",
".",
"random",
".",
"seed",
"(",
"seed",
")",
"data",
"=",
"copy",
".",
"deepcopy",
"(",
"self",
".",
... | Return a random catalog by boostrapping the colors of the objects in the current catalog. | [
"Return",
"a",
"random",
"catalog",
"by",
"boostrapping",
"the",
"colors",
"of",
"the",
"objects",
"in",
"the",
"current",
"catalog",
"."
] | 21e890b4117fc810afb6fb058e8055d564f03382 | https://github.com/DarkEnergySurvey/ugali/blob/21e890b4117fc810afb6fb058e8055d564f03382/ugali/observation/catalog.py#L63-L75 | train | Return a random catalog by boostrapping the colors of the objects in the current catalog. |
DarkEnergySurvey/ugali | ugali/observation/catalog.py | Catalog.project | def project(self, projector = None):
"""
Project coordinates on sphere to image plane using Projector class.
"""
msg = "'%s.project': ADW 2018-05-05"%self.__class__.__name__
DeprecationWarning(msg)
if projector is None:
try:
self.projector = ug... | python | def project(self, projector = None):
"""
Project coordinates on sphere to image plane using Projector class.
"""
msg = "'%s.project': ADW 2018-05-05"%self.__class__.__name__
DeprecationWarning(msg)
if projector is None:
try:
self.projector = ug... | [
"def",
"project",
"(",
"self",
",",
"projector",
"=",
"None",
")",
":",
"msg",
"=",
"\"'%s.project': ADW 2018-05-05\"",
"%",
"self",
".",
"__class__",
".",
"__name__",
"DeprecationWarning",
"(",
"msg",
")",
"if",
"projector",
"is",
"None",
":",
"try",
":",
... | Project coordinates on sphere to image plane using Projector class. | [
"Project",
"coordinates",
"on",
"sphere",
"to",
"image",
"plane",
"using",
"Projector",
"class",
"."
] | 21e890b4117fc810afb6fb058e8055d564f03382 | https://github.com/DarkEnergySurvey/ugali/blob/21e890b4117fc810afb6fb058e8055d564f03382/ugali/observation/catalog.py#L77-L93 | train | Project coordinates on sphere to image plane using Projector class. |
DarkEnergySurvey/ugali | ugali/observation/catalog.py | Catalog.spatialBin | def spatialBin(self, roi):
"""
Calculate indices of ROI pixels corresponding to object locations.
"""
if hasattr(self,'pixel_roi_index') and hasattr(self,'pixel'):
logger.warning('Catalog alread spatially binned')
return
# ADW: Not safe to set index = -1... | python | def spatialBin(self, roi):
"""
Calculate indices of ROI pixels corresponding to object locations.
"""
if hasattr(self,'pixel_roi_index') and hasattr(self,'pixel'):
logger.warning('Catalog alread spatially binned')
return
# ADW: Not safe to set index = -1... | [
"def",
"spatialBin",
"(",
"self",
",",
"roi",
")",
":",
"if",
"hasattr",
"(",
"self",
",",
"'pixel_roi_index'",
")",
"and",
"hasattr",
"(",
"self",
",",
"'pixel'",
")",
":",
"logger",
".",
"warning",
"(",
"'Catalog alread spatially binned'",
")",
"return",
... | Calculate indices of ROI pixels corresponding to object locations. | [
"Calculate",
"indices",
"of",
"ROI",
"pixels",
"corresponding",
"to",
"object",
"locations",
"."
] | 21e890b4117fc810afb6fb058e8055d564f03382 | https://github.com/DarkEnergySurvey/ugali/blob/21e890b4117fc810afb6fb058e8055d564f03382/ugali/observation/catalog.py#L95-L108 | train | Calculate indices of ROI pixels corresponding to objects locations. |
DarkEnergySurvey/ugali | ugali/observation/catalog.py | Catalog.write | def write(self, outfile, clobber=True, **kwargs):
"""
Write the current object catalog to FITS file.
Parameters:
-----------
filename : the FITS file to write.
clobber : remove existing file
kwargs : passed to fitsio.write
Returns:
--------
... | python | def write(self, outfile, clobber=True, **kwargs):
"""
Write the current object catalog to FITS file.
Parameters:
-----------
filename : the FITS file to write.
clobber : remove existing file
kwargs : passed to fitsio.write
Returns:
--------
... | [
"def",
"write",
"(",
"self",
",",
"outfile",
",",
"clobber",
"=",
"True",
",",
"*",
"*",
"kwargs",
")",
":",
"fitsio",
".",
"write",
"(",
"outfile",
",",
"self",
".",
"data",
",",
"clobber",
"=",
"True",
",",
"*",
"*",
"kwargs",
")"
] | Write the current object catalog to FITS file.
Parameters:
-----------
filename : the FITS file to write.
clobber : remove existing file
kwargs : passed to fitsio.write
Returns:
--------
None | [
"Write",
"the",
"current",
"object",
"catalog",
"to",
"FITS",
"file",
"."
] | 21e890b4117fc810afb6fb058e8055d564f03382 | https://github.com/DarkEnergySurvey/ugali/blob/21e890b4117fc810afb6fb058e8055d564f03382/ugali/observation/catalog.py#L110-L124 | train | Writes the current object catalog to a FITS file. |
DarkEnergySurvey/ugali | ugali/observation/catalog.py | Catalog._parse | def _parse(self, roi=None, filenames=None):
"""
Parse catalog FITS files into recarray.
Parameters:
-----------
roi : The region of interest; if 'roi=None', read all catalog files
Returns:
--------
None
"""
if (roi is not None) an... | python | def _parse(self, roi=None, filenames=None):
"""
Parse catalog FITS files into recarray.
Parameters:
-----------
roi : The region of interest; if 'roi=None', read all catalog files
Returns:
--------
None
"""
if (roi is not None) an... | [
"def",
"_parse",
"(",
"self",
",",
"roi",
"=",
"None",
",",
"filenames",
"=",
"None",
")",
":",
"if",
"(",
"roi",
"is",
"not",
"None",
")",
"and",
"(",
"filenames",
"is",
"not",
"None",
")",
":",
"msg",
"=",
"\"Cannot take both roi and filenames\"",
"r... | Parse catalog FITS files into recarray.
Parameters:
-----------
roi : The region of interest; if 'roi=None', read all catalog files
Returns:
--------
None | [
"Parse",
"catalog",
"FITS",
"files",
"into",
"recarray",
"."
] | 21e890b4117fc810afb6fb058e8055d564f03382 | https://github.com/DarkEnergySurvey/ugali/blob/21e890b4117fc810afb6fb058e8055d564f03382/ugali/observation/catalog.py#L126-L161 | train | Parse the FITS files into recarray. |
DarkEnergySurvey/ugali | ugali/observation/catalog.py | Catalog._defineVariables | def _defineVariables(self):
"""
Helper funtion to define pertinent variables from catalog data.
ADW (20170627): This has largely been replaced by properties.
"""
logger.info('Catalog contains %i objects'%(len(self.data)))
mc_source_id_field = self.config['catalog']['mc_... | python | def _defineVariables(self):
"""
Helper funtion to define pertinent variables from catalog data.
ADW (20170627): This has largely been replaced by properties.
"""
logger.info('Catalog contains %i objects'%(len(self.data)))
mc_source_id_field = self.config['catalog']['mc_... | [
"def",
"_defineVariables",
"(",
"self",
")",
":",
"logger",
".",
"info",
"(",
"'Catalog contains %i objects'",
"%",
"(",
"len",
"(",
"self",
".",
"data",
")",
")",
")",
"mc_source_id_field",
"=",
"self",
".",
"config",
"[",
"'catalog'",
"]",
"[",
"'mc_sour... | Helper funtion to define pertinent variables from catalog data.
ADW (20170627): This has largely been replaced by properties. | [
"Helper",
"funtion",
"to",
"define",
"pertinent",
"variables",
"from",
"catalog",
"data",
"."
] | 21e890b4117fc810afb6fb058e8055d564f03382 | https://github.com/DarkEnergySurvey/ugali/blob/21e890b4117fc810afb6fb058e8055d564f03382/ugali/observation/catalog.py#L178-L193 | train | Internal helper function to define pertinent variables from catalog data. |
consbio/ncdjango | ncdjango/geoprocessing/workflow.py | Workflow.add_node | def add_node(self, node_id, task, inputs):
"""
Adds a node to the workflow.
:param node_id: A unique identifier for the new node.
:param task: The task to run.
:param inputs: A mapping of inputs from workflow inputs, or outputs from other nodes. The format should be
... | python | def add_node(self, node_id, task, inputs):
"""
Adds a node to the workflow.
:param node_id: A unique identifier for the new node.
:param task: The task to run.
:param inputs: A mapping of inputs from workflow inputs, or outputs from other nodes. The format should be
... | [
"def",
"add_node",
"(",
"self",
",",
"node_id",
",",
"task",
",",
"inputs",
")",
":",
"if",
"node_id",
"in",
"self",
".",
"nodes_by_id",
":",
"raise",
"ValueError",
"(",
"'The node {0} already exists in this workflow.'",
".",
"format",
"(",
"node_id",
")",
")"... | Adds a node to the workflow.
:param node_id: A unique identifier for the new node.
:param task: The task to run.
:param inputs: A mapping of inputs from workflow inputs, or outputs from other nodes. The format should be
`{input_name: (source, value), ...}` where `input_name` is the ... | [
"Adds",
"a",
"node",
"to",
"the",
"workflow",
"."
] | f807bfd1e4083ab29fbc3c4d4418be108383a710 | https://github.com/consbio/ncdjango/blob/f807bfd1e4083ab29fbc3c4d4418be108383a710/ncdjango/geoprocessing/workflow.py#L179-L201 | train | Adds a node to the workflow. |
consbio/ncdjango | ncdjango/geoprocessing/workflow.py | Workflow.map_output | def map_output(self, node_id, node_output_name, parameter_name):
"""
Maps the output from a node to a workflow output.
:param node_id: The id of the node to map from.
:param node_output_name: The output parameter name for the node task to map to the workflow output.
:param param... | python | def map_output(self, node_id, node_output_name, parameter_name):
"""
Maps the output from a node to a workflow output.
:param node_id: The id of the node to map from.
:param node_output_name: The output parameter name for the node task to map to the workflow output.
:param param... | [
"def",
"map_output",
"(",
"self",
",",
"node_id",
",",
"node_output_name",
",",
"parameter_name",
")",
":",
"self",
".",
"output_mapping",
"[",
"parameter_name",
"]",
"=",
"(",
"node_id",
",",
"node_output_name",
")",
"dependents",
"=",
"self",
".",
"dependent... | Maps the output from a node to a workflow output.
:param node_id: The id of the node to map from.
:param node_output_name: The output parameter name for the node task to map to the workflow output.
:param parameter_name: The workflow output parameter name. | [
"Maps",
"the",
"output",
"from",
"a",
"node",
"to",
"a",
"workflow",
"output",
"."
] | f807bfd1e4083ab29fbc3c4d4418be108383a710 | https://github.com/consbio/ncdjango/blob/f807bfd1e4083ab29fbc3c4d4418be108383a710/ncdjango/geoprocessing/workflow.py#L203-L216 | train | Maps the output from a node to a workflow output. |
consbio/ncdjango | ncdjango/geoprocessing/workflow.py | Workflow.to_json | def to_json(self, indent=None):
"""Serialize this workflow to JSON"""
inputs = ParameterCollection(self.inputs)
d = {
'meta': {
'name': self.name,
'description': self.description
},
'inputs': [],
'workflow': [],
... | python | def to_json(self, indent=None):
"""Serialize this workflow to JSON"""
inputs = ParameterCollection(self.inputs)
d = {
'meta': {
'name': self.name,
'description': self.description
},
'inputs': [],
'workflow': [],
... | [
"def",
"to_json",
"(",
"self",
",",
"indent",
"=",
"None",
")",
":",
"inputs",
"=",
"ParameterCollection",
"(",
"self",
".",
"inputs",
")",
"d",
"=",
"{",
"'meta'",
":",
"{",
"'name'",
":",
"self",
".",
"name",
",",
"'description'",
":",
"self",
".",... | Serialize this workflow to JSON | [
"Serialize",
"this",
"workflow",
"to",
"JSON"
] | f807bfd1e4083ab29fbc3c4d4418be108383a710 | https://github.com/consbio/ncdjango/blob/f807bfd1e4083ab29fbc3c4d4418be108383a710/ncdjango/geoprocessing/workflow.py#L218-L272 | train | Serialize this workflow to JSON |
consbio/ncdjango | ncdjango/geoprocessing/workflow.py | Workflow.from_json | def from_json(cls, text):
"""Return a new workflow, deserialized from a JSON string"""
d = json.loads(text)
meta = d.get('meta', {})
workflow = cls(name=meta.get('name'), description=meta.get('description'))
for workflow_input in d.get('inputs', []):
parameter_cls ... | python | def from_json(cls, text):
"""Return a new workflow, deserialized from a JSON string"""
d = json.loads(text)
meta = d.get('meta', {})
workflow = cls(name=meta.get('name'), description=meta.get('description'))
for workflow_input in d.get('inputs', []):
parameter_cls ... | [
"def",
"from_json",
"(",
"cls",
",",
"text",
")",
":",
"d",
"=",
"json",
".",
"loads",
"(",
"text",
")",
"meta",
"=",
"d",
".",
"get",
"(",
"'meta'",
",",
"{",
"}",
")",
"workflow",
"=",
"cls",
"(",
"name",
"=",
"meta",
".",
"get",
"(",
"'nam... | Return a new workflow, deserialized from a JSON string | [
"Return",
"a",
"new",
"workflow",
"deserialized",
"from",
"a",
"JSON",
"string"
] | f807bfd1e4083ab29fbc3c4d4418be108383a710 | https://github.com/consbio/ncdjango/blob/f807bfd1e4083ab29fbc3c4d4418be108383a710/ncdjango/geoprocessing/workflow.py#L275-L313 | train | Return a new workflow deserialized from a JSON string |
MasterKale/django-cra-helper | cra_helper/management/commands/runserver.py | Command.get_handler | def get_handler(self, *args, **options):
'''
Return the static files serving handler wrapping the default handler,
if static files should be served. Otherwise return the default handler.
'''
handler = super().get_handler(*args, **options)
use_static_handler = options['use... | python | def get_handler(self, *args, **options):
'''
Return the static files serving handler wrapping the default handler,
if static files should be served. Otherwise return the default handler.
'''
handler = super().get_handler(*args, **options)
use_static_handler = options['use... | [
"def",
"get_handler",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"options",
")",
":",
"handler",
"=",
"super",
"(",
")",
".",
"get_handler",
"(",
"*",
"args",
",",
"*",
"*",
"options",
")",
"use_static_handler",
"=",
"options",
"[",
"'use_static_han... | Return the static files serving handler wrapping the default handler,
if static files should be served. Otherwise return the default handler. | [
"Return",
"the",
"static",
"files",
"serving",
"handler",
"wrapping",
"the",
"default",
"handler",
"if",
"static",
"files",
"should",
"be",
"served",
".",
"Otherwise",
"return",
"the",
"default",
"handler",
"."
] | ba50c643c181a18b80ee9bbdbea74b58abd6daad | https://github.com/MasterKale/django-cra-helper/blob/ba50c643c181a18b80ee9bbdbea74b58abd6daad/cra_helper/management/commands/runserver.py#L11-L21 | train | Returns the handler wrapping the default handler if static files should be served. Otherwise return the default handler. |
DarkEnergySurvey/ugali | ugali/utils/skymap.py | surveyPixel | def surveyPixel(lon, lat, nside_pix, nside_subpix = None):
"""
Return the set of HEALPix pixels that cover the given coordinates at resolution nside.
Optionally return the set of subpixels within those pixels at resolution nside_subpix
"""
pix = np.unique(ang2pix(nside_pix, lon, lat))
if nside_s... | python | def surveyPixel(lon, lat, nside_pix, nside_subpix = None):
"""
Return the set of HEALPix pixels that cover the given coordinates at resolution nside.
Optionally return the set of subpixels within those pixels at resolution nside_subpix
"""
pix = np.unique(ang2pix(nside_pix, lon, lat))
if nside_s... | [
"def",
"surveyPixel",
"(",
"lon",
",",
"lat",
",",
"nside_pix",
",",
"nside_subpix",
"=",
"None",
")",
":",
"pix",
"=",
"np",
".",
"unique",
"(",
"ang2pix",
"(",
"nside_pix",
",",
"lon",
",",
"lat",
")",
")",
"if",
"nside_subpix",
"is",
"None",
":",
... | Return the set of HEALPix pixels that cover the given coordinates at resolution nside.
Optionally return the set of subpixels within those pixels at resolution nside_subpix | [
"Return",
"the",
"set",
"of",
"HEALPix",
"pixels",
"that",
"cover",
"the",
"given",
"coordinates",
"at",
"resolution",
"nside",
".",
"Optionally",
"return",
"the",
"set",
"of",
"subpixels",
"within",
"those",
"pixels",
"at",
"resolution",
"nside_subpix"
] | 21e890b4117fc810afb6fb058e8055d564f03382 | https://github.com/DarkEnergySurvey/ugali/blob/21e890b4117fc810afb6fb058e8055d564f03382/ugali/utils/skymap.py#L17-L30 | train | Return the set of HEALPix pixels that cover the given coordinates at resolution nside. |
DarkEnergySurvey/ugali | ugali/utils/skymap.py | inFootprint | def inFootprint(config, pixels, nside=None):
"""
Open each valid filename for the set of pixels and determine the set
of subpixels with valid data.
"""
config = Config(config)
nside_catalog = config['coords']['nside_catalog']
nside_likelihood = config['coords']['nside_likelihood']
ns... | python | def inFootprint(config, pixels, nside=None):
"""
Open each valid filename for the set of pixels and determine the set
of subpixels with valid data.
"""
config = Config(config)
nside_catalog = config['coords']['nside_catalog']
nside_likelihood = config['coords']['nside_likelihood']
ns... | [
"def",
"inFootprint",
"(",
"config",
",",
"pixels",
",",
"nside",
"=",
"None",
")",
":",
"config",
"=",
"Config",
"(",
"config",
")",
"nside_catalog",
"=",
"config",
"[",
"'coords'",
"]",
"[",
"'nside_catalog'",
"]",
"nside_likelihood",
"=",
"config",
"[",... | Open each valid filename for the set of pixels and determine the set
of subpixels with valid data. | [
"Open",
"each",
"valid",
"filename",
"for",
"the",
"set",
"of",
"pixels",
"and",
"determine",
"the",
"set",
"of",
"subpixels",
"with",
"valid",
"data",
"."
] | 21e890b4117fc810afb6fb058e8055d564f03382 | https://github.com/DarkEnergySurvey/ugali/blob/21e890b4117fc810afb6fb058e8055d564f03382/ugali/utils/skymap.py#L32-L66 | train | Open each valid filename for the set of pixels and determine the set
of subpixels with valid data. |
DarkEnergySurvey/ugali | ugali/utils/skymap.py | footprint | def footprint(config, nside=None):
"""
UNTESTED.
Should return a boolean array representing the pixels in the footprint.
"""
config = Config(config)
if nside is None:
nside = config['coords']['nside_pixel']
elif nside < config['coords']['nside_catalog']:
raise Exception('Requ... | python | def footprint(config, nside=None):
"""
UNTESTED.
Should return a boolean array representing the pixels in the footprint.
"""
config = Config(config)
if nside is None:
nside = config['coords']['nside_pixel']
elif nside < config['coords']['nside_catalog']:
raise Exception('Requ... | [
"def",
"footprint",
"(",
"config",
",",
"nside",
"=",
"None",
")",
":",
"config",
"=",
"Config",
"(",
"config",
")",
"if",
"nside",
"is",
"None",
":",
"nside",
"=",
"config",
"[",
"'coords'",
"]",
"[",
"'nside_pixel'",
"]",
"elif",
"nside",
"<",
"con... | UNTESTED.
Should return a boolean array representing the pixels in the footprint. | [
"UNTESTED",
".",
"Should",
"return",
"a",
"boolean",
"array",
"representing",
"the",
"pixels",
"in",
"the",
"footprint",
"."
] | 21e890b4117fc810afb6fb058e8055d564f03382 | https://github.com/DarkEnergySurvey/ugali/blob/21e890b4117fc810afb6fb058e8055d564f03382/ugali/utils/skymap.py#L68-L81 | train | Returns a boolean array representing the pixels in the footprint. |
DarkEnergySurvey/ugali | ugali/utils/skymap.py | allSkyCoordinates | def allSkyCoordinates(nside):
"""
Generate a set of coordinates at the centers of pixels of resolutions nside across the full sky.
"""
lon,lat = pix2ang(nside, np.arange(0, hp.nside2npix(nside)))
return lon, lat | python | def allSkyCoordinates(nside):
"""
Generate a set of coordinates at the centers of pixels of resolutions nside across the full sky.
"""
lon,lat = pix2ang(nside, np.arange(0, hp.nside2npix(nside)))
return lon, lat | [
"def",
"allSkyCoordinates",
"(",
"nside",
")",
":",
"lon",
",",
"lat",
"=",
"pix2ang",
"(",
"nside",
",",
"np",
".",
"arange",
"(",
"0",
",",
"hp",
".",
"nside2npix",
"(",
"nside",
")",
")",
")",
"return",
"lon",
",",
"lat"
] | Generate a set of coordinates at the centers of pixels of resolutions nside across the full sky. | [
"Generate",
"a",
"set",
"of",
"coordinates",
"at",
"the",
"centers",
"of",
"pixels",
"of",
"resolutions",
"nside",
"across",
"the",
"full",
"sky",
"."
] | 21e890b4117fc810afb6fb058e8055d564f03382 | https://github.com/DarkEnergySurvey/ugali/blob/21e890b4117fc810afb6fb058e8055d564f03382/ugali/utils/skymap.py#L86-L91 | train | Generate a set of coordinates at the centers of pixels of resolutions nside across the full sky.
|
DarkEnergySurvey/ugali | ugali/utils/skymap.py | randomPositions | def randomPositions(input, nside_pix, n=1):
"""
Generate n random positions within a full HEALPix mask of booleans, or a set of (lon, lat) coordinates.
Parameters:
-----------
input : (1) full HEALPix mask of booleans, or (2) a set of (lon, lat) coordinates for catalog objects that define the o... | python | def randomPositions(input, nside_pix, n=1):
"""
Generate n random positions within a full HEALPix mask of booleans, or a set of (lon, lat) coordinates.
Parameters:
-----------
input : (1) full HEALPix mask of booleans, or (2) a set of (lon, lat) coordinates for catalog objects that define the o... | [
"def",
"randomPositions",
"(",
"input",
",",
"nside_pix",
",",
"n",
"=",
"1",
")",
":",
"input",
"=",
"np",
".",
"array",
"(",
"input",
")",
"if",
"len",
"(",
"input",
".",
"shape",
")",
"==",
"1",
":",
"if",
"hp",
".",
"npix2nside",
"(",
"len",
... | Generate n random positions within a full HEALPix mask of booleans, or a set of (lon, lat) coordinates.
Parameters:
-----------
input : (1) full HEALPix mask of booleans, or (2) a set of (lon, lat) coordinates for catalog objects that define the occupied pixels.
nside_pix : nside_pix is meant to be... | [
"Generate",
"n",
"random",
"positions",
"within",
"a",
"full",
"HEALPix",
"mask",
"of",
"booleans",
"or",
"a",
"set",
"of",
"(",
"lon",
"lat",
")",
"coordinates",
"."
] | 21e890b4117fc810afb6fb058e8055d564f03382 | https://github.com/DarkEnergySurvey/ugali/blob/21e890b4117fc810afb6fb058e8055d564f03382/ugali/utils/skymap.py#L94-L149 | train | Generate n random positions within a full HEALPix mask. |
DarkEnergySurvey/ugali | ugali/utils/skymap.py | randomPositionsMask | def randomPositionsMask(mask, nside_pix, n):
"""
Generate n random positions within a HEALPix mask of booleans.
KCB: Likely superceded by the randomPositions function, but more generic.
"""
npix = len(mask)
nside = hp.npix2nside(npix)
# Estimate the number of points that need to be th... | python | def randomPositionsMask(mask, nside_pix, n):
"""
Generate n random positions within a HEALPix mask of booleans.
KCB: Likely superceded by the randomPositions function, but more generic.
"""
npix = len(mask)
nside = hp.npix2nside(npix)
# Estimate the number of points that need to be th... | [
"def",
"randomPositionsMask",
"(",
"mask",
",",
"nside_pix",
",",
"n",
")",
":",
"npix",
"=",
"len",
"(",
"mask",
")",
"nside",
"=",
"hp",
".",
"npix2nside",
"(",
"npix",
")",
"# Estimate the number of points that need to be thrown based off",
"# coverage fraction o... | Generate n random positions within a HEALPix mask of booleans.
KCB: Likely superceded by the randomPositions function, but more generic. | [
"Generate",
"n",
"random",
"positions",
"within",
"a",
"HEALPix",
"mask",
"of",
"booleans",
"."
] | 21e890b4117fc810afb6fb058e8055d564f03382 | https://github.com/DarkEnergySurvey/ugali/blob/21e890b4117fc810afb6fb058e8055d564f03382/ugali/utils/skymap.py#L153-L185 | train | Generate n random positions within a HEALPix mask. |
dwavesystems/dwave_embedding_utilities | dwave_embedding_utilities.py | embed_ising | def embed_ising(source_linear, source_quadratic, embedding, target_adjacency, chain_strength=1.0):
"""Embeds a logical Ising model onto another graph via an embedding.
Args:
source_linear (dict): The linear biases to be embedded. Should be a dict of
the form {v: bias, ...} where v is a vari... | python | def embed_ising(source_linear, source_quadratic, embedding, target_adjacency, chain_strength=1.0):
"""Embeds a logical Ising model onto another graph via an embedding.
Args:
source_linear (dict): The linear biases to be embedded. Should be a dict of
the form {v: bias, ...} where v is a vari... | [
"def",
"embed_ising",
"(",
"source_linear",
",",
"source_quadratic",
",",
"embedding",
",",
"target_adjacency",
",",
"chain_strength",
"=",
"1.0",
")",
":",
"# store variables in the target graph that the embedding hasn't used",
"unused",
"=",
"{",
"v",
"for",
"v",
"in"... | Embeds a logical Ising model onto another graph via an embedding.
Args:
source_linear (dict): The linear biases to be embedded. Should be a dict of
the form {v: bias, ...} where v is a variable in the source model
and bias is the linear bias associated with v.
source_quadrat... | [
"Embeds",
"a",
"logical",
"Ising",
"model",
"onto",
"another",
"graph",
"via",
"an",
"embedding",
"."
] | 2e485e0ae89d96f3c0005f144bab4b465a3039a3 | https://github.com/dwavesystems/dwave_embedding_utilities/blob/2e485e0ae89d96f3c0005f144bab4b465a3039a3/dwave_embedding_utilities.py#L163-L278 | train | Embeds a logical Ising model onto another graph via an embedding. |
dwavesystems/dwave_embedding_utilities | dwave_embedding_utilities.py | chain_break_frequency | def chain_break_frequency(samples, embedding):
"""Determines the frequency of chain breaks in the given samples.
Args:
samples (iterable): An iterable of samples where each sample
is a dict of the form {v: val, ...} where v is a variable
in the target graph and val is the associ... | python | def chain_break_frequency(samples, embedding):
"""Determines the frequency of chain breaks in the given samples.
Args:
samples (iterable): An iterable of samples where each sample
is a dict of the form {v: val, ...} where v is a variable
in the target graph and val is the associ... | [
"def",
"chain_break_frequency",
"(",
"samples",
",",
"embedding",
")",
":",
"counts",
"=",
"{",
"v",
":",
"0",
"for",
"v",
"in",
"embedding",
"}",
"total",
"=",
"0",
"for",
"sample",
"in",
"samples",
":",
"for",
"v",
",",
"chain",
"in",
"iteritems",
... | Determines the frequency of chain breaks in the given samples.
Args:
samples (iterable): An iterable of samples where each sample
is a dict of the form {v: val, ...} where v is a variable
in the target graph and val is the associated value as
determined by a binary quadr... | [
"Determines",
"the",
"frequency",
"of",
"chain",
"breaks",
"in",
"the",
"given",
"samples",
"."
] | 2e485e0ae89d96f3c0005f144bab4b465a3039a3 | https://github.com/dwavesystems/dwave_embedding_utilities/blob/2e485e0ae89d96f3c0005f144bab4b465a3039a3/dwave_embedding_utilities.py#L331-L359 | train | Determines the frequency of chain breaks in the given samples. |
dwavesystems/dwave_embedding_utilities | dwave_embedding_utilities.py | unembed_samples | def unembed_samples(samples, embedding, chain_break_method=None):
"""Return samples over the variables in the source graph.
Args:
samples (iterable): An iterable of samples where each sample
is a dict of the form {v: val, ...} where v is a variable
in the target model and val is... | python | def unembed_samples(samples, embedding, chain_break_method=None):
"""Return samples over the variables in the source graph.
Args:
samples (iterable): An iterable of samples where each sample
is a dict of the form {v: val, ...} where v is a variable
in the target model and val is... | [
"def",
"unembed_samples",
"(",
"samples",
",",
"embedding",
",",
"chain_break_method",
"=",
"None",
")",
":",
"if",
"chain_break_method",
"is",
"None",
":",
"chain_break_method",
"=",
"majority_vote",
"return",
"list",
"(",
"itertools",
".",
"chain",
"(",
"*",
... | Return samples over the variables in the source graph.
Args:
samples (iterable): An iterable of samples where each sample
is a dict of the form {v: val, ...} where v is a variable
in the target model and val is the associated value as
determined by a binary quadratic mod... | [
"Return",
"samples",
"over",
"the",
"variables",
"in",
"the",
"source",
"graph",
"."
] | 2e485e0ae89d96f3c0005f144bab4b465a3039a3 | https://github.com/dwavesystems/dwave_embedding_utilities/blob/2e485e0ae89d96f3c0005f144bab4b465a3039a3/dwave_embedding_utilities.py#L362-L384 | train | Return samples over the variables in the source graph that are not in the target graph. |
dwavesystems/dwave_embedding_utilities | dwave_embedding_utilities.py | discard | def discard(sample, embedding):
"""Discards the sample if broken.
Args:
sample (dict): A sample of the form {v: val, ...} where v is
a variable in the target graph and val is the associated value as
determined by a binary quadratic model sampler.
embedding (dict): The ma... | python | def discard(sample, embedding):
"""Discards the sample if broken.
Args:
sample (dict): A sample of the form {v: val, ...} where v is
a variable in the target graph and val is the associated value as
determined by a binary quadratic model sampler.
embedding (dict): The ma... | [
"def",
"discard",
"(",
"sample",
",",
"embedding",
")",
":",
"unembeded",
"=",
"{",
"}",
"for",
"v",
",",
"chain",
"in",
"iteritems",
"(",
"embedding",
")",
":",
"vals",
"=",
"[",
"sample",
"[",
"u",
"]",
"for",
"u",
"in",
"chain",
"]",
"if",
"_a... | Discards the sample if broken.
Args:
sample (dict): A sample of the form {v: val, ...} where v is
a variable in the target graph and val is the associated value as
determined by a binary quadratic model sampler.
embedding (dict): The mapping from the source graph to the targ... | [
"Discards",
"the",
"sample",
"if",
"broken",
"."
] | 2e485e0ae89d96f3c0005f144bab4b465a3039a3 | https://github.com/dwavesystems/dwave_embedding_utilities/blob/2e485e0ae89d96f3c0005f144bab4b465a3039a3/dwave_embedding_utilities.py#L387-L412 | train | Discards the sample if broken. |
dwavesystems/dwave_embedding_utilities | dwave_embedding_utilities.py | majority_vote | def majority_vote(sample, embedding):
"""Determines the sample values by majority vote.
Args:
sample (dict): A sample of the form {v: val, ...} where v is
a variable in the target graph and val is the associated value as
determined by a binary quadratic model sampler.
em... | python | def majority_vote(sample, embedding):
"""Determines the sample values by majority vote.
Args:
sample (dict): A sample of the form {v: val, ...} where v is
a variable in the target graph and val is the associated value as
determined by a binary quadratic model sampler.
em... | [
"def",
"majority_vote",
"(",
"sample",
",",
"embedding",
")",
":",
"unembeded",
"=",
"{",
"}",
"for",
"v",
",",
"chain",
"in",
"iteritems",
"(",
"embedding",
")",
":",
"vals",
"=",
"[",
"sample",
"[",
"u",
"]",
"for",
"u",
"in",
"chain",
"]",
"if",... | Determines the sample values by majority vote.
Args:
sample (dict): A sample of the form {v: val, ...} where v is
a variable in the target graph and val is the associated value as
determined by a binary quadratic model sampler.
embedding (dict): The mapping from the source g... | [
"Determines",
"the",
"sample",
"values",
"by",
"majority",
"vote",
"."
] | 2e485e0ae89d96f3c0005f144bab4b465a3039a3 | https://github.com/dwavesystems/dwave_embedding_utilities/blob/2e485e0ae89d96f3c0005f144bab4b465a3039a3/dwave_embedding_utilities.py#L415-L441 | train | Determines the sample values by majority vote. |
dwavesystems/dwave_embedding_utilities | dwave_embedding_utilities.py | weighted_random | def weighted_random(sample, embedding):
"""Determines the sample values by weighed random choice.
Args:
sample (dict): A sample of the form {v: val, ...} where v is
a variable in the target graph and val is the associated value as
determined by a binary quadratic model sampler.
... | python | def weighted_random(sample, embedding):
"""Determines the sample values by weighed random choice.
Args:
sample (dict): A sample of the form {v: val, ...} where v is
a variable in the target graph and val is the associated value as
determined by a binary quadratic model sampler.
... | [
"def",
"weighted_random",
"(",
"sample",
",",
"embedding",
")",
":",
"unembeded",
"=",
"{",
"}",
"for",
"v",
",",
"chain",
"in",
"iteritems",
"(",
"embedding",
")",
":",
"vals",
"=",
"[",
"sample",
"[",
"u",
"]",
"for",
"u",
"in",
"chain",
"]",
"# ... | Determines the sample values by weighed random choice.
Args:
sample (dict): A sample of the form {v: val, ...} where v is
a variable in the target graph and val is the associated value as
determined by a binary quadratic model sampler.
embedding (dict): The mapping from the ... | [
"Determines",
"the",
"sample",
"values",
"by",
"weighed",
"random",
"choice",
"."
] | 2e485e0ae89d96f3c0005f144bab4b465a3039a3 | https://github.com/dwavesystems/dwave_embedding_utilities/blob/2e485e0ae89d96f3c0005f144bab4b465a3039a3/dwave_embedding_utilities.py#L444-L470 | train | Returns the sample values by weighed random choice. |
dwavesystems/dwave_embedding_utilities | dwave_embedding_utilities.py | _all_equal | def _all_equal(iterable):
"""True if all values in `iterable` are equal, else False."""
iterator = iter(iterable)
first = next(iterator)
return all(first == rest for rest in iterator) | python | def _all_equal(iterable):
"""True if all values in `iterable` are equal, else False."""
iterator = iter(iterable)
first = next(iterator)
return all(first == rest for rest in iterator) | [
"def",
"_all_equal",
"(",
"iterable",
")",
":",
"iterator",
"=",
"iter",
"(",
"iterable",
")",
"first",
"=",
"next",
"(",
"iterator",
")",
"return",
"all",
"(",
"first",
"==",
"rest",
"for",
"rest",
"in",
"iterator",
")"
] | True if all values in `iterable` are equal, else False. | [
"True",
"if",
"all",
"values",
"in",
"iterable",
"are",
"equal",
"else",
"False",
"."
] | 2e485e0ae89d96f3c0005f144bab4b465a3039a3 | https://github.com/dwavesystems/dwave_embedding_utilities/blob/2e485e0ae89d96f3c0005f144bab4b465a3039a3/dwave_embedding_utilities.py#L549-L553 | train | True if all values in iterable are equal. |
dwavesystems/dwave_embedding_utilities | dwave_embedding_utilities.py | _most_common | def _most_common(iterable):
"""Returns the most common element in `iterable`."""
data = Counter(iterable)
return max(data, key=data.__getitem__) | python | def _most_common(iterable):
"""Returns the most common element in `iterable`."""
data = Counter(iterable)
return max(data, key=data.__getitem__) | [
"def",
"_most_common",
"(",
"iterable",
")",
":",
"data",
"=",
"Counter",
"(",
"iterable",
")",
"return",
"max",
"(",
"data",
",",
"key",
"=",
"data",
".",
"__getitem__",
")"
] | Returns the most common element in `iterable`. | [
"Returns",
"the",
"most",
"common",
"element",
"in",
"iterable",
"."
] | 2e485e0ae89d96f3c0005f144bab4b465a3039a3 | https://github.com/dwavesystems/dwave_embedding_utilities/blob/2e485e0ae89d96f3c0005f144bab4b465a3039a3/dwave_embedding_utilities.py#L556-L559 | train | Returns the most common element in iterable. |
DarkEnergySurvey/ugali | ugali/analysis/mcmc.py | createMCMC | def createMCMC(config,srcfile,section='source',samples=None):
""" Create an MCMC instance """
source = ugali.analysis.source.Source()
source.load(srcfile,section=section)
loglike = ugali.analysis.loglike.createLoglike(config,source)
mcmc = MCMC(config,loglike)
if samples is not None:
m... | python | def createMCMC(config,srcfile,section='source',samples=None):
""" Create an MCMC instance """
source = ugali.analysis.source.Source()
source.load(srcfile,section=section)
loglike = ugali.analysis.loglike.createLoglike(config,source)
mcmc = MCMC(config,loglike)
if samples is not None:
m... | [
"def",
"createMCMC",
"(",
"config",
",",
"srcfile",
",",
"section",
"=",
"'source'",
",",
"samples",
"=",
"None",
")",
":",
"source",
"=",
"ugali",
".",
"analysis",
".",
"source",
".",
"Source",
"(",
")",
"source",
".",
"load",
"(",
"srcfile",
",",
"... | Create an MCMC instance | [
"Create",
"an",
"MCMC",
"instance"
] | 21e890b4117fc810afb6fb058e8055d564f03382 | https://github.com/DarkEnergySurvey/ugali/blob/21e890b4117fc810afb6fb058e8055d564f03382/ugali/analysis/mcmc.py#L280-L291 | train | Create an MCMC instance from a source file. |
DarkEnergySurvey/ugali | ugali/analysis/mcmc.py | MCMC.lnlike | def lnlike(self, theta):
""" Logarithm of the likelihood """
params,loglike = self.params,self.loglike
kwargs = dict(list(zip(params,theta)))
try:
lnlike = loglike.value(**kwargs)
except ValueError as AssertionError:
lnlike = -np.inf
return lnlike | python | def lnlike(self, theta):
""" Logarithm of the likelihood """
params,loglike = self.params,self.loglike
kwargs = dict(list(zip(params,theta)))
try:
lnlike = loglike.value(**kwargs)
except ValueError as AssertionError:
lnlike = -np.inf
return lnlike | [
"def",
"lnlike",
"(",
"self",
",",
"theta",
")",
":",
"params",
",",
"loglike",
"=",
"self",
".",
"params",
",",
"self",
".",
"loglike",
"kwargs",
"=",
"dict",
"(",
"list",
"(",
"zip",
"(",
"params",
",",
"theta",
")",
")",
")",
"try",
":",
"lnli... | Logarithm of the likelihood | [
"Logarithm",
"of",
"the",
"likelihood"
] | 21e890b4117fc810afb6fb058e8055d564f03382 | https://github.com/DarkEnergySurvey/ugali/blob/21e890b4117fc810afb6fb058e8055d564f03382/ugali/analysis/mcmc.py#L150-L158 | train | Logarithm of the likelihood of the likelihood of the current instance of the class. |
DarkEnergySurvey/ugali | ugali/analysis/mcmc.py | MCMC.lnprior | def lnprior(self,theta):
""" Logarithm of the prior """
params,priors = self.params,self.priors
kwargs = dict(list(zip(params,theta)))
err = np.seterr(invalid='raise')
try:
lnprior = np.sum(np.log([priors[k](v) for k,v in list(kwargs.items())]))
except (Floati... | python | def lnprior(self,theta):
""" Logarithm of the prior """
params,priors = self.params,self.priors
kwargs = dict(list(zip(params,theta)))
err = np.seterr(invalid='raise')
try:
lnprior = np.sum(np.log([priors[k](v) for k,v in list(kwargs.items())]))
except (Floati... | [
"def",
"lnprior",
"(",
"self",
",",
"theta",
")",
":",
"params",
",",
"priors",
"=",
"self",
".",
"params",
",",
"self",
".",
"priors",
"kwargs",
"=",
"dict",
"(",
"list",
"(",
"zip",
"(",
"params",
",",
"theta",
")",
")",
")",
"err",
"=",
"np",
... | Logarithm of the prior | [
"Logarithm",
"of",
"the",
"prior"
] | 21e890b4117fc810afb6fb058e8055d564f03382 | https://github.com/DarkEnergySurvey/ugali/blob/21e890b4117fc810afb6fb058e8055d564f03382/ugali/analysis/mcmc.py#L160-L170 | train | Logarithm of the prior |
DarkEnergySurvey/ugali | ugali/analysis/mcmc.py | MCMC.lnprob | def lnprob(self,theta):
""" Logarithm of the probability """
global niter
params,priors,loglike = self.params,self.priors,self.loglike
# Avoid extra likelihood calls with bad priors
_lnprior = self.lnprior(theta)
if np.isfinite(_lnprior):
_lnlike = self.lnlike... | python | def lnprob(self,theta):
""" Logarithm of the probability """
global niter
params,priors,loglike = self.params,self.priors,self.loglike
# Avoid extra likelihood calls with bad priors
_lnprior = self.lnprior(theta)
if np.isfinite(_lnprior):
_lnlike = self.lnlike... | [
"def",
"lnprob",
"(",
"self",
",",
"theta",
")",
":",
"global",
"niter",
"params",
",",
"priors",
",",
"loglike",
"=",
"self",
".",
"params",
",",
"self",
".",
"priors",
",",
"self",
".",
"loglike",
"# Avoid extra likelihood calls with bad priors",
"_lnprior",... | Logarithm of the probability | [
"Logarithm",
"of",
"the",
"probability"
] | 21e890b4117fc810afb6fb058e8055d564f03382 | https://github.com/DarkEnergySurvey/ugali/blob/21e890b4117fc810afb6fb058e8055d564f03382/ugali/analysis/mcmc.py#L172-L192 | train | Logarithm of the probability of the current state of the object. |
DarkEnergySurvey/ugali | ugali/analysis/loglike.py | write_membership | def write_membership(filename,config,srcfile,section=None):
"""
Top level interface to write the membership from a config and source model.
"""
source = Source()
source.load(srcfile,section=section)
loglike = createLoglike(config,source)
loglike.write_membership(filename) | python | def write_membership(filename,config,srcfile,section=None):
"""
Top level interface to write the membership from a config and source model.
"""
source = Source()
source.load(srcfile,section=section)
loglike = createLoglike(config,source)
loglike.write_membership(filename) | [
"def",
"write_membership",
"(",
"filename",
",",
"config",
",",
"srcfile",
",",
"section",
"=",
"None",
")",
":",
"source",
"=",
"Source",
"(",
")",
"source",
".",
"load",
"(",
"srcfile",
",",
"section",
"=",
"section",
")",
"loglike",
"=",
"createLoglik... | Top level interface to write the membership from a config and source model. | [
"Top",
"level",
"interface",
"to",
"write",
"the",
"membership",
"from",
"a",
"config",
"and",
"source",
"model",
"."
] | 21e890b4117fc810afb6fb058e8055d564f03382 | https://github.com/DarkEnergySurvey/ugali/blob/21e890b4117fc810afb6fb058e8055d564f03382/ugali/analysis/loglike.py#L512-L519 | train | Write the membership of a log - like model to a file. |
DarkEnergySurvey/ugali | ugali/analysis/loglike.py | createCatalog | def createCatalog(config,roi=None,lon=None,lat=None):
"""
Create a catalog object
"""
import ugali.observation.catalog
if roi is None: roi = createROI(config,lon,lat)
catalog = ugali.observation.catalog.Catalog(config,roi=roi)
return catalog | python | def createCatalog(config,roi=None,lon=None,lat=None):
"""
Create a catalog object
"""
import ugali.observation.catalog
if roi is None: roi = createROI(config,lon,lat)
catalog = ugali.observation.catalog.Catalog(config,roi=roi)
return catalog | [
"def",
"createCatalog",
"(",
"config",
",",
"roi",
"=",
"None",
",",
"lon",
"=",
"None",
",",
"lat",
"=",
"None",
")",
":",
"import",
"ugali",
".",
"observation",
".",
"catalog",
"if",
"roi",
"is",
"None",
":",
"roi",
"=",
"createROI",
"(",
"config",... | Create a catalog object | [
"Create",
"a",
"catalog",
"object"
] | 21e890b4117fc810afb6fb058e8055d564f03382 | https://github.com/DarkEnergySurvey/ugali/blob/21e890b4117fc810afb6fb058e8055d564f03382/ugali/analysis/loglike.py#L566-L573 | train | Create a catalog object |
DarkEnergySurvey/ugali | ugali/analysis/loglike.py | simulateCatalog | def simulateCatalog(config,roi=None,lon=None,lat=None):
"""
Simulate a catalog object.
"""
import ugali.simulation.simulator
if roi is None: roi = createROI(config,lon,lat)
sim = ugali.simulation.simulator.Simulator(config,roi)
return sim.catalog() | python | def simulateCatalog(config,roi=None,lon=None,lat=None):
"""
Simulate a catalog object.
"""
import ugali.simulation.simulator
if roi is None: roi = createROI(config,lon,lat)
sim = ugali.simulation.simulator.Simulator(config,roi)
return sim.catalog() | [
"def",
"simulateCatalog",
"(",
"config",
",",
"roi",
"=",
"None",
",",
"lon",
"=",
"None",
",",
"lat",
"=",
"None",
")",
":",
"import",
"ugali",
".",
"simulation",
".",
"simulator",
"if",
"roi",
"is",
"None",
":",
"roi",
"=",
"createROI",
"(",
"confi... | Simulate a catalog object. | [
"Simulate",
"a",
"catalog",
"object",
"."
] | 21e890b4117fc810afb6fb058e8055d564f03382 | https://github.com/DarkEnergySurvey/ugali/blob/21e890b4117fc810afb6fb058e8055d564f03382/ugali/analysis/loglike.py#L576-L583 | train | Simulate a catalog object. |
DarkEnergySurvey/ugali | ugali/analysis/loglike.py | LogLikelihood.calc_observable_fraction | def calc_observable_fraction(self,distance_modulus):
"""
Calculated observable fraction within each pixel of the target region.
"""
# This is the observable fraction after magnitude cuts in each
# pixel of the ROI.
observable_fraction = self.isochrone.observableFraction(... | python | def calc_observable_fraction(self,distance_modulus):
"""
Calculated observable fraction within each pixel of the target region.
"""
# This is the observable fraction after magnitude cuts in each
# pixel of the ROI.
observable_fraction = self.isochrone.observableFraction(... | [
"def",
"calc_observable_fraction",
"(",
"self",
",",
"distance_modulus",
")",
":",
"# This is the observable fraction after magnitude cuts in each ",
"# pixel of the ROI.",
"observable_fraction",
"=",
"self",
".",
"isochrone",
".",
"observableFraction",
"(",
"self",
".",
"mas... | Calculated observable fraction within each pixel of the target region. | [
"Calculated",
"observable",
"fraction",
"within",
"each",
"pixel",
"of",
"the",
"target",
"region",
"."
] | 21e890b4117fc810afb6fb058e8055d564f03382 | https://github.com/DarkEnergySurvey/ugali/blob/21e890b4117fc810afb6fb058e8055d564f03382/ugali/analysis/loglike.py#L265-L277 | train | Calculates the observable fraction within each pixel of the source region. |
DarkEnergySurvey/ugali | ugali/analysis/loglike.py | LogLikelihood.calc_signal_color1 | def calc_signal_color1(self, distance_modulus, mass_steps=10000):
"""
Compute signal color probability (u_color) for each catalog object on the fly.
"""
mag_1, mag_2 = self.catalog.mag_1,self.catalog.mag_2
mag_err_1, mag_err_2 = self.catalog.mag_err_1,self.catalog.mag_err_2
... | python | def calc_signal_color1(self, distance_modulus, mass_steps=10000):
"""
Compute signal color probability (u_color) for each catalog object on the fly.
"""
mag_1, mag_2 = self.catalog.mag_1,self.catalog.mag_2
mag_err_1, mag_err_2 = self.catalog.mag_err_1,self.catalog.mag_err_2
... | [
"def",
"calc_signal_color1",
"(",
"self",
",",
"distance_modulus",
",",
"mass_steps",
"=",
"10000",
")",
":",
"mag_1",
",",
"mag_2",
"=",
"self",
".",
"catalog",
".",
"mag_1",
",",
"self",
".",
"catalog",
".",
"mag_2",
"mag_err_1",
",",
"mag_err_2",
"=",
... | Compute signal color probability (u_color) for each catalog object on the fly. | [
"Compute",
"signal",
"color",
"probability",
"(",
"u_color",
")",
"for",
"each",
"catalog",
"object",
"on",
"the",
"fly",
"."
] | 21e890b4117fc810afb6fb058e8055d564f03382 | https://github.com/DarkEnergySurvey/ugali/blob/21e890b4117fc810afb6fb058e8055d564f03382/ugali/analysis/loglike.py#L279-L290 | train | Calculates signal color probability for each catalog object on the fly. |
DarkEnergySurvey/ugali | ugali/analysis/loglike.py | LogLikelihood.calc_signal_color2 | def calc_signal_color2(self, distance_modulus, mass_steps=1000):
"""
Compute signal color probability (u_color) for each catalog object on the fly.
"""
logger.info('Calculating signal color from MMD')
mag_1, mag_2 = self.catalog.mag_1,self.catalog.mag_2
lon, lat = self.c... | python | def calc_signal_color2(self, distance_modulus, mass_steps=1000):
"""
Compute signal color probability (u_color) for each catalog object on the fly.
"""
logger.info('Calculating signal color from MMD')
mag_1, mag_2 = self.catalog.mag_1,self.catalog.mag_2
lon, lat = self.c... | [
"def",
"calc_signal_color2",
"(",
"self",
",",
"distance_modulus",
",",
"mass_steps",
"=",
"1000",
")",
":",
"logger",
".",
"info",
"(",
"'Calculating signal color from MMD'",
")",
"mag_1",
",",
"mag_2",
"=",
"self",
".",
"catalog",
".",
"mag_1",
",",
"self",
... | Compute signal color probability (u_color) for each catalog object on the fly. | [
"Compute",
"signal",
"color",
"probability",
"(",
"u_color",
")",
"for",
"each",
"catalog",
"object",
"on",
"the",
"fly",
"."
] | 21e890b4117fc810afb6fb058e8055d564f03382 | https://github.com/DarkEnergySurvey/ugali/blob/21e890b4117fc810afb6fb058e8055d564f03382/ugali/analysis/loglike.py#L292-L307 | train | Calculates signal color probability for each catalog object on the fly. |
DarkEnergySurvey/ugali | ugali/analysis/loglike.py | LogLikelihood.calc_surface_intensity | def calc_surface_intensity(self, factor=10):
"""Calculate the surface intensity for each pixel in the interior
region of the ROI. Pixels are adaptively subsampled around the
kernel centroid out to a radius of 'factor * max_pixrad'.
Parameters:
-----------
factor : the ra... | python | def calc_surface_intensity(self, factor=10):
"""Calculate the surface intensity for each pixel in the interior
region of the ROI. Pixels are adaptively subsampled around the
kernel centroid out to a radius of 'factor * max_pixrad'.
Parameters:
-----------
factor : the ra... | [
"def",
"calc_surface_intensity",
"(",
"self",
",",
"factor",
"=",
"10",
")",
":",
"# First we calculate the surface intensity at native resolution",
"pixels",
"=",
"self",
".",
"roi",
".",
"pixels_interior",
"nside_in",
"=",
"self",
".",
"config",
"[",
"'coords'",
"... | Calculate the surface intensity for each pixel in the interior
region of the ROI. Pixels are adaptively subsampled around the
kernel centroid out to a radius of 'factor * max_pixrad'.
Parameters:
-----------
factor : the radius of the oversample region in units of max_pixrad
... | [
"Calculate",
"the",
"surface",
"intensity",
"for",
"each",
"pixel",
"in",
"the",
"interior",
"region",
"of",
"the",
"ROI",
".",
"Pixels",
"are",
"adaptively",
"subsampled",
"around",
"the",
"kernel",
"centroid",
"out",
"to",
"a",
"radius",
"of",
"factor",
"*... | 21e890b4117fc810afb6fb058e8055d564f03382 | https://github.com/DarkEnergySurvey/ugali/blob/21e890b4117fc810afb6fb058e8055d564f03382/ugali/analysis/loglike.py#L312-L348 | train | Calculates the surface intensity for each pixel in the interior of the ROI. |
DarkEnergySurvey/ugali | ugali/analysis/loglike.py | LogLikelihood.calc_signal_spatial | def calc_signal_spatial(self):
"""
Calculate the spatial signal probability for each catalog object.
Parameters:
-----------
None
Returns:
--------
u_spatial : array of spatial probabilities per object
"""
# Calculate the surface intensit... | python | def calc_signal_spatial(self):
"""
Calculate the spatial signal probability for each catalog object.
Parameters:
-----------
None
Returns:
--------
u_spatial : array of spatial probabilities per object
"""
# Calculate the surface intensit... | [
"def",
"calc_signal_spatial",
"(",
"self",
")",
":",
"# Calculate the surface intensity",
"self",
".",
"surface_intensity_sparse",
"=",
"self",
".",
"calc_surface_intensity",
"(",
")",
"# Calculate the probability per object-by-object level",
"self",
".",
"surface_intensity_obj... | Calculate the spatial signal probability for each catalog object.
Parameters:
-----------
None
Returns:
--------
u_spatial : array of spatial probabilities per object | [
"Calculate",
"the",
"spatial",
"signal",
"probability",
"for",
"each",
"catalog",
"object",
"."
] | 21e890b4117fc810afb6fb058e8055d564f03382 | https://github.com/DarkEnergySurvey/ugali/blob/21e890b4117fc810afb6fb058e8055d564f03382/ugali/analysis/loglike.py#L350-L371 | train | Calculates the spatial signal probability for each object - by - object level. |
DarkEnergySurvey/ugali | ugali/analysis/loglike.py | LogLikelihood.fit_richness | def fit_richness(self, atol=1.e-3, maxiter=50):
"""
Maximize the log-likelihood as a function of richness.
ADW 2018-06-04: Does it make sense to set the richness to the mle?
Parameters:
-----------
atol : absolute tolerence for conversion
maxiter : maximum numbe... | python | def fit_richness(self, atol=1.e-3, maxiter=50):
"""
Maximize the log-likelihood as a function of richness.
ADW 2018-06-04: Does it make sense to set the richness to the mle?
Parameters:
-----------
atol : absolute tolerence for conversion
maxiter : maximum numbe... | [
"def",
"fit_richness",
"(",
"self",
",",
"atol",
"=",
"1.e-3",
",",
"maxiter",
"=",
"50",
")",
":",
"# Check whether the signal probability for all objects are zero",
"# This can occur for finite kernels on the edge of the survey footprint",
"if",
"np",
".",
"isnan",
"(",
"... | Maximize the log-likelihood as a function of richness.
ADW 2018-06-04: Does it make sense to set the richness to the mle?
Parameters:
-----------
atol : absolute tolerence for conversion
maxiter : maximum number of iterations
Returns:
--------
loglike, ... | [
"Maximize",
"the",
"log",
"-",
"likelihood",
"as",
"a",
"function",
"of",
"richness",
"."
] | 21e890b4117fc810afb6fb058e8055d564f03382 | https://github.com/DarkEnergySurvey/ugali/blob/21e890b4117fc810afb6fb058e8055d564f03382/ugali/analysis/loglike.py#L380-L431 | train | Fits the log - likelihood of the current object to a function of richness. |
DarkEnergySurvey/ugali | ugali/analysis/loglike.py | LogLikelihood.write_membership | def write_membership(self,filename):
"""
Write a catalog file of the likelihood region including
membership properties.
Parameters:
-----------
filename : output filename
Returns:
--------
None
"""
# Column names
n... | python | def write_membership(self,filename):
"""
Write a catalog file of the likelihood region including
membership properties.
Parameters:
-----------
filename : output filename
Returns:
--------
None
"""
# Column names
n... | [
"def",
"write_membership",
"(",
"self",
",",
"filename",
")",
":",
"# Column names",
"name_objid",
"=",
"self",
".",
"config",
"[",
"'catalog'",
"]",
"[",
"'objid_field'",
"]",
"name_mag_1",
"=",
"self",
".",
"config",
"[",
"'catalog'",
"]",
"[",
"'mag_1_fie... | Write a catalog file of the likelihood region including
membership properties.
Parameters:
-----------
filename : output filename
Returns:
--------
None | [
"Write",
"a",
"catalog",
"file",
"of",
"the",
"likelihood",
"region",
"including",
"membership",
"properties",
"."
] | 21e890b4117fc810afb6fb058e8055d564f03382 | https://github.com/DarkEnergySurvey/ugali/blob/21e890b4117fc810afb6fb058e8055d564f03382/ugali/analysis/loglike.py#L451-L510 | train | Writes a catalog file of the likelihood region including the membership properties. |
akx/lepo | lepo/apidef/doc.py | APIDefinition.resolve_reference | def resolve_reference(self, ref):
"""
Resolve a JSON Pointer object reference to the object itself.
:param ref: Reference string (`#/foo/bar`, for instance)
:return: The object, if found
:raises jsonschema.exceptions.RefResolutionError: if there is trouble resolving the referenc... | python | def resolve_reference(self, ref):
"""
Resolve a JSON Pointer object reference to the object itself.
:param ref: Reference string (`#/foo/bar`, for instance)
:return: The object, if found
:raises jsonschema.exceptions.RefResolutionError: if there is trouble resolving the referenc... | [
"def",
"resolve_reference",
"(",
"self",
",",
"ref",
")",
":",
"url",
",",
"resolved",
"=",
"self",
".",
"resolver",
".",
"resolve",
"(",
"ref",
")",
"return",
"resolved"
] | Resolve a JSON Pointer object reference to the object itself.
:param ref: Reference string (`#/foo/bar`, for instance)
:return: The object, if found
:raises jsonschema.exceptions.RefResolutionError: if there is trouble resolving the reference | [
"Resolve",
"a",
"JSON",
"Pointer",
"object",
"reference",
"to",
"the",
"object",
"itself",
"."
] | 34cfb24a40f18ea40f672c1ea9a0734ee1816b7d | https://github.com/akx/lepo/blob/34cfb24a40f18ea40f672c1ea9a0734ee1816b7d/lepo/apidef/doc.py#L25-L34 | train | Resolve a JSON Pointer object reference to the object itself. |
akx/lepo | lepo/apidef/doc.py | APIDefinition.get_path | def get_path(self, path):
"""
Construct a Path object from a path string.
The Path string must be declared in the API.
:type path: str
:rtype: lepo.path.Path
"""
mapping = self.get_path_mapping(path)
return self.path_class(api=self, path=path, mapping=ma... | python | def get_path(self, path):
"""
Construct a Path object from a path string.
The Path string must be declared in the API.
:type path: str
:rtype: lepo.path.Path
"""
mapping = self.get_path_mapping(path)
return self.path_class(api=self, path=path, mapping=ma... | [
"def",
"get_path",
"(",
"self",
",",
"path",
")",
":",
"mapping",
"=",
"self",
".",
"get_path_mapping",
"(",
"path",
")",
"return",
"self",
".",
"path_class",
"(",
"api",
"=",
"self",
",",
"path",
"=",
"path",
",",
"mapping",
"=",
"mapping",
")"
] | Construct a Path object from a path string.
The Path string must be declared in the API.
:type path: str
:rtype: lepo.path.Path | [
"Construct",
"a",
"Path",
"object",
"from",
"a",
"path",
"string",
"."
] | 34cfb24a40f18ea40f672c1ea9a0734ee1816b7d | https://github.com/akx/lepo/blob/34cfb24a40f18ea40f672c1ea9a0734ee1816b7d/lepo/apidef/doc.py#L43-L53 | train | Construct a Path object from a path string. |
akx/lepo | lepo/apidef/doc.py | APIDefinition.from_file | def from_file(cls, filename):
"""
Construct an APIDefinition by parsing the given `filename`.
If PyYAML is installed, YAML files are supported.
JSON files are always supported.
:param filename: The filename to read.
:rtype: APIDefinition
"""
with open(fi... | python | def from_file(cls, filename):
"""
Construct an APIDefinition by parsing the given `filename`.
If PyYAML is installed, YAML files are supported.
JSON files are always supported.
:param filename: The filename to read.
:rtype: APIDefinition
"""
with open(fi... | [
"def",
"from_file",
"(",
"cls",
",",
"filename",
")",
":",
"with",
"open",
"(",
"filename",
")",
"as",
"infp",
":",
"if",
"filename",
".",
"endswith",
"(",
"'.yaml'",
")",
"or",
"filename",
".",
"endswith",
"(",
"'.yml'",
")",
":",
"import",
"yaml",
... | Construct an APIDefinition by parsing the given `filename`.
If PyYAML is installed, YAML files are supported.
JSON files are always supported.
:param filename: The filename to read.
:rtype: APIDefinition | [
"Construct",
"an",
"APIDefinition",
"by",
"parsing",
"the",
"given",
"filename",
"."
] | 34cfb24a40f18ea40f672c1ea9a0734ee1816b7d | https://github.com/akx/lepo/blob/34cfb24a40f18ea40f672c1ea9a0734ee1816b7d/lepo/apidef/doc.py#L65-L82 | train | Construct an APIDefinition by parsing the given filename. |
akx/lepo | lepo/utils.py | maybe_resolve | def maybe_resolve(object, resolve):
"""
Call `resolve` on the `object`'s `$ref` value if it has one.
:param object: An object.
:param resolve: A resolving function.
:return: An object, or some other object! :sparkles:
"""
if isinstance(object, dict) and object.get('$ref'):
return re... | python | def maybe_resolve(object, resolve):
"""
Call `resolve` on the `object`'s `$ref` value if it has one.
:param object: An object.
:param resolve: A resolving function.
:return: An object, or some other object! :sparkles:
"""
if isinstance(object, dict) and object.get('$ref'):
return re... | [
"def",
"maybe_resolve",
"(",
"object",
",",
"resolve",
")",
":",
"if",
"isinstance",
"(",
"object",
",",
"dict",
")",
"and",
"object",
".",
"get",
"(",
"'$ref'",
")",
":",
"return",
"resolve",
"(",
"object",
"[",
"'$ref'",
"]",
")",
"return",
"object"
... | Call `resolve` on the `object`'s `$ref` value if it has one.
:param object: An object.
:param resolve: A resolving function.
:return: An object, or some other object! :sparkles: | [
"Call",
"resolve",
"on",
"the",
"object",
"s",
"$ref",
"value",
"if",
"it",
"has",
"one",
"."
] | 34cfb24a40f18ea40f672c1ea9a0734ee1816b7d | https://github.com/akx/lepo/blob/34cfb24a40f18ea40f672c1ea9a0734ee1816b7d/lepo/utils.py#L6-L16 | train | Resolve the object s ID if it has one. |
warrenspe/hconf | hconf/subparsers/yaml_.py | YAML.parse | def parse(self, configManager, config):
"""
Parse configuration options out of a YAML configuration file.
Inputs: configManager - Our parent ConfigManager instance which is constructing the Config object.
config - The _Config object containing configuration options popula... | python | def parse(self, configManager, config):
"""
Parse configuration options out of a YAML configuration file.
Inputs: configManager - Our parent ConfigManager instance which is constructing the Config object.
config - The _Config object containing configuration options popula... | [
"def",
"parse",
"(",
"self",
",",
"configManager",
",",
"config",
")",
":",
"configFile",
"=",
"self",
".",
"_getConfigFile",
"(",
"config",
")",
"if",
"not",
"configFile",
":",
"return",
"dict",
"(",
")",
"yamlConfigs",
"=",
"yaml",
".",
"load",
"(",
... | Parse configuration options out of a YAML configuration file.
Inputs: configManager - Our parent ConfigManager instance which is constructing the Config object.
config - The _Config object containing configuration options populated thus far.
Outputs: A dictionary of new configur... | [
"Parse",
"configuration",
"options",
"out",
"of",
"a",
"YAML",
"configuration",
"file",
"."
] | 12074d15dc3641d3903488c95d89a507386a32d5 | https://github.com/warrenspe/hconf/blob/12074d15dc3641d3903488c95d89a507386a32d5/hconf/subparsers/yaml_.py#L32-L52 | train | Parse configuration options out of a YAML configuration file. |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.