id int32 0 252k | repo stringlengths 7 55 | path stringlengths 4 127 | func_name stringlengths 1 88 | original_string stringlengths 75 19.8k | language stringclasses 1
value | code stringlengths 75 19.8k | code_tokens list | docstring stringlengths 3 17.3k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 87 242 |
|---|---|---|---|---|---|---|---|---|---|---|---|
48,300 | zhanglab/psamm | psamm/lpsolver/generic.py | filter_solvers | def filter_solvers(solvers, requirements):
"""Yield solvers that fullfil the requirements."""
for solver in solvers:
for req, value in iteritems(requirements):
if (req in ('integer', 'quadratic', 'rational', 'name') and
(req not in solver or solver[req] != value)):
... | python | def filter_solvers(solvers, requirements):
"""Yield solvers that fullfil the requirements."""
for solver in solvers:
for req, value in iteritems(requirements):
if (req in ('integer', 'quadratic', 'rational', 'name') and
(req not in solver or solver[req] != value)):
... | [
"def",
"filter_solvers",
"(",
"solvers",
",",
"requirements",
")",
":",
"for",
"solver",
"in",
"solvers",
":",
"for",
"req",
",",
"value",
"in",
"iteritems",
"(",
"requirements",
")",
":",
"if",
"(",
"req",
"in",
"(",
"'integer'",
",",
"'quadratic'",
","... | Yield solvers that fullfil the requirements. | [
"Yield",
"solvers",
"that",
"fullfil",
"the",
"requirements",
"."
] | dc427848c4f9d109ca590f0afa024c63b685b3f4 | https://github.com/zhanglab/psamm/blob/dc427848c4f9d109ca590f0afa024c63b685b3f4/psamm/lpsolver/generic.py#L96-L104 |
48,301 | zhanglab/psamm | psamm/lpsolver/generic.py | parse_solver_setting | def parse_solver_setting(s):
"""Parse a string containing a solver setting"""
try:
key, value = s.split('=', 1)
except ValueError:
key, value = s, 'yes'
if key in ('rational', 'integer', 'quadratic'):
value = value.lower() in ('1', 'yes', 'true', 'on')
elif key in ('threads... | python | def parse_solver_setting(s):
"""Parse a string containing a solver setting"""
try:
key, value = s.split('=', 1)
except ValueError:
key, value = s, 'yes'
if key in ('rational', 'integer', 'quadratic'):
value = value.lower() in ('1', 'yes', 'true', 'on')
elif key in ('threads... | [
"def",
"parse_solver_setting",
"(",
"s",
")",
":",
"try",
":",
"key",
",",
"value",
"=",
"s",
".",
"split",
"(",
"'='",
",",
"1",
")",
"except",
"ValueError",
":",
"key",
",",
"value",
"=",
"s",
",",
"'yes'",
"if",
"key",
"in",
"(",
"'rational'",
... | Parse a string containing a solver setting | [
"Parse",
"a",
"string",
"containing",
"a",
"solver",
"setting"
] | dc427848c4f9d109ca590f0afa024c63b685b3f4 | https://github.com/zhanglab/psamm/blob/dc427848c4f9d109ca590f0afa024c63b685b3f4/psamm/lpsolver/generic.py#L159-L175 |
48,302 | zhanglab/psamm | psamm/metabolicmodel.py | MetabolicModel.get_reaction_values | def get_reaction_values(self, reaction_id):
"""Return stoichiometric values of reaction as a dictionary"""
if reaction_id not in self._reaction_set:
raise ValueError('Unknown reaction: {}'.format(repr(reaction_id)))
return self._database.get_reaction_values(reaction_id) | python | def get_reaction_values(self, reaction_id):
"""Return stoichiometric values of reaction as a dictionary"""
if reaction_id not in self._reaction_set:
raise ValueError('Unknown reaction: {}'.format(repr(reaction_id)))
return self._database.get_reaction_values(reaction_id) | [
"def",
"get_reaction_values",
"(",
"self",
",",
"reaction_id",
")",
":",
"if",
"reaction_id",
"not",
"in",
"self",
".",
"_reaction_set",
":",
"raise",
"ValueError",
"(",
"'Unknown reaction: {}'",
".",
"format",
"(",
"repr",
"(",
"reaction_id",
")",
")",
")",
... | Return stoichiometric values of reaction as a dictionary | [
"Return",
"stoichiometric",
"values",
"of",
"reaction",
"as",
"a",
"dictionary"
] | dc427848c4f9d109ca590f0afa024c63b685b3f4 | https://github.com/zhanglab/psamm/blob/dc427848c4f9d109ca590f0afa024c63b685b3f4/psamm/metabolicmodel.py#L211-L215 |
48,303 | zhanglab/psamm | psamm/metabolicmodel.py | MetabolicModel.get_compound_reactions | def get_compound_reactions(self, compound_id):
"""Iterate over all reaction ids the includes the given compound"""
if compound_id not in self._compound_set:
raise ValueError('Compound not in model: {}'.format(compound_id))
for reaction_id in self._database.get_compound_reactions(com... | python | def get_compound_reactions(self, compound_id):
"""Iterate over all reaction ids the includes the given compound"""
if compound_id not in self._compound_set:
raise ValueError('Compound not in model: {}'.format(compound_id))
for reaction_id in self._database.get_compound_reactions(com... | [
"def",
"get_compound_reactions",
"(",
"self",
",",
"compound_id",
")",
":",
"if",
"compound_id",
"not",
"in",
"self",
".",
"_compound_set",
":",
"raise",
"ValueError",
"(",
"'Compound not in model: {}'",
".",
"format",
"(",
"compound_id",
")",
")",
"for",
"react... | Iterate over all reaction ids the includes the given compound | [
"Iterate",
"over",
"all",
"reaction",
"ids",
"the",
"includes",
"the",
"given",
"compound"
] | dc427848c4f9d109ca590f0afa024c63b685b3f4 | https://github.com/zhanglab/psamm/blob/dc427848c4f9d109ca590f0afa024c63b685b3f4/psamm/metabolicmodel.py#L217-L224 |
48,304 | zhanglab/psamm | psamm/metabolicmodel.py | MetabolicModel.is_reversible | def is_reversible(self, reaction_id):
"""Whether the given reaction is reversible"""
if reaction_id not in self._reaction_set:
raise ValueError('Reaction not in model: {}'.format(reaction_id))
return self._database.is_reversible(reaction_id) | python | def is_reversible(self, reaction_id):
"""Whether the given reaction is reversible"""
if reaction_id not in self._reaction_set:
raise ValueError('Reaction not in model: {}'.format(reaction_id))
return self._database.is_reversible(reaction_id) | [
"def",
"is_reversible",
"(",
"self",
",",
"reaction_id",
")",
":",
"if",
"reaction_id",
"not",
"in",
"self",
".",
"_reaction_set",
":",
"raise",
"ValueError",
"(",
"'Reaction not in model: {}'",
".",
"format",
"(",
"reaction_id",
")",
")",
"return",
"self",
".... | Whether the given reaction is reversible | [
"Whether",
"the",
"given",
"reaction",
"is",
"reversible"
] | dc427848c4f9d109ca590f0afa024c63b685b3f4 | https://github.com/zhanglab/psamm/blob/dc427848c4f9d109ca590f0afa024c63b685b3f4/psamm/metabolicmodel.py#L226-L230 |
48,305 | zhanglab/psamm | psamm/metabolicmodel.py | MetabolicModel.is_exchange | def is_exchange(self, reaction_id):
"""Whether the given reaction is an exchange reaction."""
reaction = self.get_reaction(reaction_id)
return (len(reaction.left) == 0) != (len(reaction.right) == 0) | python | def is_exchange(self, reaction_id):
"""Whether the given reaction is an exchange reaction."""
reaction = self.get_reaction(reaction_id)
return (len(reaction.left) == 0) != (len(reaction.right) == 0) | [
"def",
"is_exchange",
"(",
"self",
",",
"reaction_id",
")",
":",
"reaction",
"=",
"self",
".",
"get_reaction",
"(",
"reaction_id",
")",
"return",
"(",
"len",
"(",
"reaction",
".",
"left",
")",
"==",
"0",
")",
"!=",
"(",
"len",
"(",
"reaction",
".",
"... | Whether the given reaction is an exchange reaction. | [
"Whether",
"the",
"given",
"reaction",
"is",
"an",
"exchange",
"reaction",
"."
] | dc427848c4f9d109ca590f0afa024c63b685b3f4 | https://github.com/zhanglab/psamm/blob/dc427848c4f9d109ca590f0afa024c63b685b3f4/psamm/metabolicmodel.py#L232-L235 |
48,306 | zhanglab/psamm | psamm/metabolicmodel.py | MetabolicModel.add_reaction | def add_reaction(self, reaction_id):
"""Add reaction to model"""
if reaction_id in self._reaction_set:
return
reaction = self._database.get_reaction(reaction_id)
self._reaction_set.add(reaction_id)
for compound, _ in reaction.compounds:
self._compound_se... | python | def add_reaction(self, reaction_id):
"""Add reaction to model"""
if reaction_id in self._reaction_set:
return
reaction = self._database.get_reaction(reaction_id)
self._reaction_set.add(reaction_id)
for compound, _ in reaction.compounds:
self._compound_se... | [
"def",
"add_reaction",
"(",
"self",
",",
"reaction_id",
")",
":",
"if",
"reaction_id",
"in",
"self",
".",
"_reaction_set",
":",
"return",
"reaction",
"=",
"self",
".",
"_database",
".",
"get_reaction",
"(",
"reaction_id",
")",
"self",
".",
"_reaction_set",
"... | Add reaction to model | [
"Add",
"reaction",
"to",
"model"
] | dc427848c4f9d109ca590f0afa024c63b685b3f4 | https://github.com/zhanglab/psamm/blob/dc427848c4f9d109ca590f0afa024c63b685b3f4/psamm/metabolicmodel.py#L241-L250 |
48,307 | zhanglab/psamm | psamm/metabolicmodel.py | MetabolicModel.remove_reaction | def remove_reaction(self, reaction):
"""Remove reaction from model"""
if reaction not in self._reaction_set:
return
self._reaction_set.remove(reaction)
self._limits_lower.pop(reaction, None)
self._limits_upper.pop(reaction, None)
# Remove compound from comp... | python | def remove_reaction(self, reaction):
"""Remove reaction from model"""
if reaction not in self._reaction_set:
return
self._reaction_set.remove(reaction)
self._limits_lower.pop(reaction, None)
self._limits_upper.pop(reaction, None)
# Remove compound from comp... | [
"def",
"remove_reaction",
"(",
"self",
",",
"reaction",
")",
":",
"if",
"reaction",
"not",
"in",
"self",
".",
"_reaction_set",
":",
"return",
"self",
".",
"_reaction_set",
".",
"remove",
"(",
"reaction",
")",
"self",
".",
"_limits_lower",
".",
"pop",
"(",
... | Remove reaction from model | [
"Remove",
"reaction",
"from",
"model"
] | dc427848c4f9d109ca590f0afa024c63b685b3f4 | https://github.com/zhanglab/psamm/blob/dc427848c4f9d109ca590f0afa024c63b685b3f4/psamm/metabolicmodel.py#L252-L269 |
48,308 | zhanglab/psamm | psamm/metabolicmodel.py | MetabolicModel.copy | def copy(self):
"""Return copy of model"""
model = self.__class__(self._database)
model._limits_lower = dict(self._limits_lower)
model._limits_upper = dict(self._limits_upper)
model._reaction_set = set(self._reaction_set)
model._compound_set = set(self._compound_set)
... | python | def copy(self):
"""Return copy of model"""
model = self.__class__(self._database)
model._limits_lower = dict(self._limits_lower)
model._limits_upper = dict(self._limits_upper)
model._reaction_set = set(self._reaction_set)
model._compound_set = set(self._compound_set)
... | [
"def",
"copy",
"(",
"self",
")",
":",
"model",
"=",
"self",
".",
"__class__",
"(",
"self",
".",
"_database",
")",
"model",
".",
"_limits_lower",
"=",
"dict",
"(",
"self",
".",
"_limits_lower",
")",
"model",
".",
"_limits_upper",
"=",
"dict",
"(",
"self... | Return copy of model | [
"Return",
"copy",
"of",
"model"
] | dc427848c4f9d109ca590f0afa024c63b685b3f4 | https://github.com/zhanglab/psamm/blob/dc427848c4f9d109ca590f0afa024c63b685b3f4/psamm/metabolicmodel.py#L271-L279 |
48,309 | zhanglab/psamm | psamm/metabolicmodel.py | MetabolicModel.load_model | def load_model(cls, database, reaction_iter=None, exchange=None,
limits=None, v_max=None):
"""Get model from reaction name iterator.
The model will contain all reactions of the iterator.
"""
model_args = {}
if v_max is not None:
model_args['v_max'... | python | def load_model(cls, database, reaction_iter=None, exchange=None,
limits=None, v_max=None):
"""Get model from reaction name iterator.
The model will contain all reactions of the iterator.
"""
model_args = {}
if v_max is not None:
model_args['v_max'... | [
"def",
"load_model",
"(",
"cls",
",",
"database",
",",
"reaction_iter",
"=",
"None",
",",
"exchange",
"=",
"None",
",",
"limits",
"=",
"None",
",",
"v_max",
"=",
"None",
")",
":",
"model_args",
"=",
"{",
"}",
"if",
"v_max",
"is",
"not",
"None",
":",
... | Get model from reaction name iterator.
The model will contain all reactions of the iterator. | [
"Get",
"model",
"from",
"reaction",
"name",
"iterator",
"."
] | dc427848c4f9d109ca590f0afa024c63b685b3f4 | https://github.com/zhanglab/psamm/blob/dc427848c4f9d109ca590f0afa024c63b685b3f4/psamm/metabolicmodel.py#L282-L325 |
48,310 | zhanglab/psamm | psamm/commands/fba.py | FluxBalanceCommand.run | def run(self):
"""Run flux analysis command."""
# Load compound information
def compound_name(id):
if id not in self._model.compounds:
return id
return self._model.compounds[id].properties.get('name', id)
# Reaction genes information
def ... | python | def run(self):
"""Run flux analysis command."""
# Load compound information
def compound_name(id):
if id not in self._model.compounds:
return id
return self._model.compounds[id].properties.get('name', id)
# Reaction genes information
def ... | [
"def",
"run",
"(",
"self",
")",
":",
"# Load compound information",
"def",
"compound_name",
"(",
"id",
")",
":",
"if",
"id",
"not",
"in",
"self",
".",
"_model",
".",
"compounds",
":",
"return",
"id",
"return",
"self",
".",
"_model",
".",
"compounds",
"["... | Run flux analysis command. | [
"Run",
"flux",
"analysis",
"command",
"."
] | dc427848c4f9d109ca590f0afa024c63b685b3f4 | https://github.com/zhanglab/psamm/blob/dc427848c4f9d109ca590f0afa024c63b685b3f4/psamm/commands/fba.py#L46-L95 |
48,311 | zhanglab/psamm | psamm/commands/fba.py | FluxBalanceCommand.run_fba_minimized | def run_fba_minimized(self, reaction):
"""Run normal FBA and flux minimization on model."""
epsilon = self._args.epsilon
solver = self._get_solver()
p = fluxanalysis.FluxBalanceProblem(self._mm, solver)
start_time = time.time()
# Maximize reaction flux
try:
... | python | def run_fba_minimized(self, reaction):
"""Run normal FBA and flux minimization on model."""
epsilon = self._args.epsilon
solver = self._get_solver()
p = fluxanalysis.FluxBalanceProblem(self._mm, solver)
start_time = time.time()
# Maximize reaction flux
try:
... | [
"def",
"run_fba_minimized",
"(",
"self",
",",
"reaction",
")",
":",
"epsilon",
"=",
"self",
".",
"_args",
".",
"epsilon",
"solver",
"=",
"self",
".",
"_get_solver",
"(",
")",
"p",
"=",
"fluxanalysis",
".",
"FluxBalanceProblem",
"(",
"self",
".",
"_mm",
"... | Run normal FBA and flux minimization on model. | [
"Run",
"normal",
"FBA",
"and",
"flux",
"minimization",
"on",
"model",
"."
] | dc427848c4f9d109ca590f0afa024c63b685b3f4 | https://github.com/zhanglab/psamm/blob/dc427848c4f9d109ca590f0afa024c63b685b3f4/psamm/commands/fba.py#L115-L147 |
48,312 | zhanglab/psamm | psamm/commands/fba.py | FluxBalanceCommand.run_tfba | def run_tfba(self, reaction):
"""Run FBA and tFBA on model."""
solver = self._get_solver(integer=True)
p = fluxanalysis.FluxBalanceProblem(self._mm, solver)
start_time = time.time()
p.add_thermodynamic()
try:
p.maximize(reaction)
except fluxanalysi... | python | def run_tfba(self, reaction):
"""Run FBA and tFBA on model."""
solver = self._get_solver(integer=True)
p = fluxanalysis.FluxBalanceProblem(self._mm, solver)
start_time = time.time()
p.add_thermodynamic()
try:
p.maximize(reaction)
except fluxanalysi... | [
"def",
"run_tfba",
"(",
"self",
",",
"reaction",
")",
":",
"solver",
"=",
"self",
".",
"_get_solver",
"(",
"integer",
"=",
"True",
")",
"p",
"=",
"fluxanalysis",
".",
"FluxBalanceProblem",
"(",
"self",
".",
"_mm",
",",
"solver",
")",
"start_time",
"=",
... | Run FBA and tFBA on model. | [
"Run",
"FBA",
"and",
"tFBA",
"on",
"model",
"."
] | dc427848c4f9d109ca590f0afa024c63b685b3f4 | https://github.com/zhanglab/psamm/blob/dc427848c4f9d109ca590f0afa024c63b685b3f4/psamm/commands/fba.py#L149-L168 |
48,313 | zhanglab/psamm | psamm/massconsistency.py | is_consistent | def is_consistent(database, solver, exchange=set(), zeromass=set()):
"""Try to assign a positive mass to each compound
Return True if successful. The masses are simply constrained by m_i > 1 and
finding a solution under these conditions proves that the database is mass
consistent.
"""
prob = s... | python | def is_consistent(database, solver, exchange=set(), zeromass=set()):
"""Try to assign a positive mass to each compound
Return True if successful. The masses are simply constrained by m_i > 1 and
finding a solution under these conditions proves that the database is mass
consistent.
"""
prob = s... | [
"def",
"is_consistent",
"(",
"database",
",",
"solver",
",",
"exchange",
"=",
"set",
"(",
")",
",",
"zeromass",
"=",
"set",
"(",
")",
")",
":",
"prob",
"=",
"solver",
".",
"create_problem",
"(",
")",
"compound_set",
"=",
"_non_localized_compounds",
"(",
... | Try to assign a positive mass to each compound
Return True if successful. The masses are simply constrained by m_i > 1 and
finding a solution under these conditions proves that the database is mass
consistent. | [
"Try",
"to",
"assign",
"a",
"positive",
"mass",
"to",
"each",
"compound"
] | dc427848c4f9d109ca590f0afa024c63b685b3f4 | https://github.com/zhanglab/psamm/blob/dc427848c4f9d109ca590f0afa024c63b685b3f4/psamm/massconsistency.py#L44-L71 |
48,314 | zhanglab/psamm | psamm/massconsistency.py | check_reaction_consistency | def check_reaction_consistency(database, solver, exchange=set(),
checked=set(), zeromass=set(), weights={}):
"""Check inconsistent reactions by minimizing mass residuals
Return a reaction iterable, and compound iterable. The reaction iterable
yields reaction ids and mass resi... | python | def check_reaction_consistency(database, solver, exchange=set(),
checked=set(), zeromass=set(), weights={}):
"""Check inconsistent reactions by minimizing mass residuals
Return a reaction iterable, and compound iterable. The reaction iterable
yields reaction ids and mass resi... | [
"def",
"check_reaction_consistency",
"(",
"database",
",",
"solver",
",",
"exchange",
"=",
"set",
"(",
")",
",",
"checked",
"=",
"set",
"(",
")",
",",
"zeromass",
"=",
"set",
"(",
")",
",",
"weights",
"=",
"{",
"}",
")",
":",
"# Create Flux balance probl... | Check inconsistent reactions by minimizing mass residuals
Return a reaction iterable, and compound iterable. The reaction iterable
yields reaction ids and mass residuals. The compound iterable yields
compound ids and mass assignments.
Each compound is assigned a mass of at least one, and the masses ar... | [
"Check",
"inconsistent",
"reactions",
"by",
"minimizing",
"mass",
"residuals"
] | dc427848c4f9d109ca590f0afa024c63b685b3f4 | https://github.com/zhanglab/psamm/blob/dc427848c4f9d109ca590f0afa024c63b685b3f4/psamm/massconsistency.py#L74-L138 |
48,315 | zhanglab/psamm | psamm/massconsistency.py | check_compound_consistency | def check_compound_consistency(database, solver, exchange=set(),
zeromass=set()):
"""Yield each compound in the database with assigned mass
Each compound will be assigned a mass and the number of compounds having a
positive mass will be approximately maximized.
This is a... | python | def check_compound_consistency(database, solver, exchange=set(),
zeromass=set()):
"""Yield each compound in the database with assigned mass
Each compound will be assigned a mass and the number of compounds having a
positive mass will be approximately maximized.
This is a... | [
"def",
"check_compound_consistency",
"(",
"database",
",",
"solver",
",",
"exchange",
"=",
"set",
"(",
")",
",",
"zeromass",
"=",
"set",
"(",
")",
")",
":",
"# Create mass balance problem",
"prob",
"=",
"solver",
".",
"create_problem",
"(",
")",
"compound_set"... | Yield each compound in the database with assigned mass
Each compound will be assigned a mass and the number of compounds having a
positive mass will be approximately maximized.
This is an implementation of the solution originally proposed by
[Gevorgyan08]_ but using the new method proposed by [Thiele... | [
"Yield",
"each",
"compound",
"in",
"the",
"database",
"with",
"assigned",
"mass"
] | dc427848c4f9d109ca590f0afa024c63b685b3f4 | https://github.com/zhanglab/psamm/blob/dc427848c4f9d109ca590f0afa024c63b685b3f4/psamm/massconsistency.py#L141-L186 |
48,316 | zhanglab/psamm | psamm/util.py | create_unique_id | def create_unique_id(prefix, existing_ids):
"""Return a unique string ID from the prefix.
First check if the prefix is itself a unique ID in the set-like parameter
existing_ids. If not, try integers in ascending order appended to the
prefix until a unique ID is found.
"""
if prefix in existing_... | python | def create_unique_id(prefix, existing_ids):
"""Return a unique string ID from the prefix.
First check if the prefix is itself a unique ID in the set-like parameter
existing_ids. If not, try integers in ascending order appended to the
prefix until a unique ID is found.
"""
if prefix in existing_... | [
"def",
"create_unique_id",
"(",
"prefix",
",",
"existing_ids",
")",
":",
"if",
"prefix",
"in",
"existing_ids",
":",
"suffix",
"=",
"1",
"while",
"True",
":",
"new_id",
"=",
"'{}_{}'",
".",
"format",
"(",
"prefix",
",",
"suffix",
")",
"if",
"new_id",
"not... | Return a unique string ID from the prefix.
First check if the prefix is itself a unique ID in the set-like parameter
existing_ids. If not, try integers in ascending order appended to the
prefix until a unique ID is found. | [
"Return",
"a",
"unique",
"string",
"ID",
"from",
"the",
"prefix",
"."
] | dc427848c4f9d109ca590f0afa024c63b685b3f4 | https://github.com/zhanglab/psamm/blob/dc427848c4f9d109ca590f0afa024c63b685b3f4/psamm/util.py#L178-L193 |
48,317 | zhanglab/psamm | psamm/util.py | git_try_describe | def git_try_describe(repo_path):
"""Try to describe the current commit of a Git repository.
Return a string containing a string with the commit ID and/or a base tag,
if successful. Otherwise, return None.
"""
try:
p = subprocess.Popen(['git', 'describe', '--always', '--dirty'],
... | python | def git_try_describe(repo_path):
"""Try to describe the current commit of a Git repository.
Return a string containing a string with the commit ID and/or a base tag,
if successful. Otherwise, return None.
"""
try:
p = subprocess.Popen(['git', 'describe', '--always', '--dirty'],
... | [
"def",
"git_try_describe",
"(",
"repo_path",
")",
":",
"try",
":",
"p",
"=",
"subprocess",
".",
"Popen",
"(",
"[",
"'git'",
",",
"'describe'",
",",
"'--always'",
",",
"'--dirty'",
"]",
",",
"cwd",
"=",
"repo_path",
",",
"stdout",
"=",
"subprocess",
".",
... | Try to describe the current commit of a Git repository.
Return a string containing a string with the commit ID and/or a base tag,
if successful. Otherwise, return None. | [
"Try",
"to",
"describe",
"the",
"current",
"commit",
"of",
"a",
"Git",
"repository",
"."
] | dc427848c4f9d109ca590f0afa024c63b685b3f4 | https://github.com/zhanglab/psamm/blob/dc427848c4f9d109ca590f0afa024c63b685b3f4/psamm/util.py#L196-L213 |
48,318 | zhanglab/psamm | psamm/util.py | convex_cardinality_relaxed | def convex_cardinality_relaxed(f, epsilon=1e-5):
"""Transform L1-norm optimization function into cardinality optimization.
The given function must optimize a convex problem with
a weighted L1-norm as the objective. The transformed function
will apply the iterated weighted L1 heuristic to approximately
... | python | def convex_cardinality_relaxed(f, epsilon=1e-5):
"""Transform L1-norm optimization function into cardinality optimization.
The given function must optimize a convex problem with
a weighted L1-norm as the objective. The transformed function
will apply the iterated weighted L1 heuristic to approximately
... | [
"def",
"convex_cardinality_relaxed",
"(",
"f",
",",
"epsilon",
"=",
"1e-5",
")",
":",
"def",
"convex_cardinality_wrapper",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"def",
"dict_result",
"(",
"r",
")",
":",
"if",
"isinstance",
"(",
"r",
",",
... | Transform L1-norm optimization function into cardinality optimization.
The given function must optimize a convex problem with
a weighted L1-norm as the objective. The transformed function
will apply the iterated weighted L1 heuristic to approximately
optimize the cardinality of the solution. This metho... | [
"Transform",
"L1",
"-",
"norm",
"optimization",
"function",
"into",
"cardinality",
"optimization",
"."
] | dc427848c4f9d109ca590f0afa024c63b685b3f4 | https://github.com/zhanglab/psamm/blob/dc427848c4f9d109ca590f0afa024c63b685b3f4/psamm/util.py#L216-L267 |
48,319 | zhanglab/psamm | psamm/util.py | LoggerFile.write | def write(self, s):
"""Write message to logger."""
for line in re.split(r'\n+', s):
if line != '':
self._logger.log(self._level, line) | python | def write(self, s):
"""Write message to logger."""
for line in re.split(r'\n+', s):
if line != '':
self._logger.log(self._level, line) | [
"def",
"write",
"(",
"self",
",",
"s",
")",
":",
"for",
"line",
"in",
"re",
".",
"split",
"(",
"r'\\n+'",
",",
"s",
")",
":",
"if",
"line",
"!=",
"''",
":",
"self",
".",
"_logger",
".",
"log",
"(",
"self",
".",
"_level",
",",
"line",
")"
] | Write message to logger. | [
"Write",
"message",
"to",
"logger",
"."
] | dc427848c4f9d109ca590f0afa024c63b685b3f4 | https://github.com/zhanglab/psamm/blob/dc427848c4f9d109ca590f0afa024c63b685b3f4/psamm/util.py#L54-L58 |
48,320 | hearsaycorp/normalize | normalize/property/__init__.py | Property.fullname | def fullname(self):
"""Returns the name of the ``Record`` class this ``Property`` is
attached to, and attribute name it is attached as."""
if not self.bound:
if self.name is not None:
return "(unbound).%s" % self.name
else:
return "(unbound... | python | def fullname(self):
"""Returns the name of the ``Record`` class this ``Property`` is
attached to, and attribute name it is attached as."""
if not self.bound:
if self.name is not None:
return "(unbound).%s" % self.name
else:
return "(unbound... | [
"def",
"fullname",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"bound",
":",
"if",
"self",
".",
"name",
"is",
"not",
"None",
":",
"return",
"\"(unbound).%s\"",
"%",
"self",
".",
"name",
"else",
":",
"return",
"\"(unbound)\"",
"elif",
"not",
"self"... | Returns the name of the ``Record`` class this ``Property`` is
attached to, and attribute name it is attached as. | [
"Returns",
"the",
"name",
"of",
"the",
"Record",
"class",
"this",
"Property",
"is",
"attached",
"to",
"and",
"attribute",
"name",
"it",
"is",
"attached",
"as",
"."
] | 8b36522ddca6d41b434580bd848f3bdaa7a999c8 | https://github.com/hearsaycorp/normalize/blob/8b36522ddca6d41b434580bd848f3bdaa7a999c8/normalize/property/__init__.py#L189-L201 |
48,321 | zhanglab/psamm | psamm/commands/robustness.py | RobustnessCommand.run | def run(self):
"""Run robustness command."""
reaction = self._get_objective()
if not self._mm.has_reaction(reaction):
self.fail('Specified biomass reaction is not in model: {}'.format(
reaction))
varying_reaction = self._args.varying
if not self._mm.... | python | def run(self):
"""Run robustness command."""
reaction = self._get_objective()
if not self._mm.has_reaction(reaction):
self.fail('Specified biomass reaction is not in model: {}'.format(
reaction))
varying_reaction = self._args.varying
if not self._mm.... | [
"def",
"run",
"(",
"self",
")",
":",
"reaction",
"=",
"self",
".",
"_get_objective",
"(",
")",
"if",
"not",
"self",
".",
"_mm",
".",
"has_reaction",
"(",
"reaction",
")",
":",
"self",
".",
"fail",
"(",
"'Specified biomass reaction is not in model: {}'",
".",... | Run robustness command. | [
"Run",
"robustness",
"command",
"."
] | dc427848c4f9d109ca590f0afa024c63b685b3f4 | https://github.com/zhanglab/psamm/blob/dc427848c4f9d109ca590f0afa024c63b685b3f4/psamm/commands/robustness.py#L63-L146 |
48,322 | zhanglab/psamm | psamm/lpsolver/glpk.py | Problem.set_objective | def set_objective(self, expression):
"""Set objective of problem."""
if isinstance(expression, numbers.Number):
# Allow expressions with no variables as objective,
# represented as a number
expression = Expression(offset=expression)
# Clear previous objectiv... | python | def set_objective(self, expression):
"""Set objective of problem."""
if isinstance(expression, numbers.Number):
# Allow expressions with no variables as objective,
# represented as a number
expression = Expression(offset=expression)
# Clear previous objectiv... | [
"def",
"set_objective",
"(",
"self",
",",
"expression",
")",
":",
"if",
"isinstance",
"(",
"expression",
",",
"numbers",
".",
"Number",
")",
":",
"# Allow expressions with no variables as objective,",
"# represented as a number",
"expression",
"=",
"Expression",
"(",
... | Set objective of problem. | [
"Set",
"objective",
"of",
"problem",
"."
] | dc427848c4f9d109ca590f0afa024c63b685b3f4 | https://github.com/zhanglab/psamm/blob/dc427848c4f9d109ca590f0afa024c63b685b3f4/psamm/lpsolver/glpk.py#L242-L258 |
48,323 | zhanglab/psamm | psamm/lpsolver/glpk.py | Result.status | def status(self):
"""Return string indicating the error encountered on failure."""
self._check_valid()
if self._ret_val == swiglpk.GLP_ENOPFS:
return 'No primal feasible solution'
elif self._ret_val == swiglpk.GLP_ENODFS:
return 'No dual feasible solution'
... | python | def status(self):
"""Return string indicating the error encountered on failure."""
self._check_valid()
if self._ret_val == swiglpk.GLP_ENOPFS:
return 'No primal feasible solution'
elif self._ret_val == swiglpk.GLP_ENODFS:
return 'No dual feasible solution'
... | [
"def",
"status",
"(",
"self",
")",
":",
"self",
".",
"_check_valid",
"(",
")",
"if",
"self",
".",
"_ret_val",
"==",
"swiglpk",
".",
"GLP_ENOPFS",
":",
"return",
"'No primal feasible solution'",
"elif",
"self",
".",
"_ret_val",
"==",
"swiglpk",
".",
"GLP_ENOD... | Return string indicating the error encountered on failure. | [
"Return",
"string",
"indicating",
"the",
"error",
"encountered",
"on",
"failure",
"."
] | dc427848c4f9d109ca590f0afa024c63b685b3f4 | https://github.com/zhanglab/psamm/blob/dc427848c4f9d109ca590f0afa024c63b685b3f4/psamm/lpsolver/glpk.py#L407-L414 |
48,324 | zhanglab/psamm | psamm/mapmaker.py | default_weight | def default_weight(element):
"""Return weight of formula element.
This implements the default weight proposed for MapMaker.
"""
if element in (Atom.N, Atom.O, Atom.P):
return 0.4
elif isinstance(element, Radical):
return 40.0
return 1.0 | python | def default_weight(element):
"""Return weight of formula element.
This implements the default weight proposed for MapMaker.
"""
if element in (Atom.N, Atom.O, Atom.P):
return 0.4
elif isinstance(element, Radical):
return 40.0
return 1.0 | [
"def",
"default_weight",
"(",
"element",
")",
":",
"if",
"element",
"in",
"(",
"Atom",
".",
"N",
",",
"Atom",
".",
"O",
",",
"Atom",
".",
"P",
")",
":",
"return",
"0.4",
"elif",
"isinstance",
"(",
"element",
",",
"Radical",
")",
":",
"return",
"40.... | Return weight of formula element.
This implements the default weight proposed for MapMaker. | [
"Return",
"weight",
"of",
"formula",
"element",
"."
] | dc427848c4f9d109ca590f0afa024c63b685b3f4 | https://github.com/zhanglab/psamm/blob/dc427848c4f9d109ca590f0afa024c63b685b3f4/psamm/mapmaker.py#L31-L40 |
48,325 | zhanglab/psamm | psamm/mapmaker.py | _weighted_formula | def _weighted_formula(form, weight_func):
"""Yield weight of each formula element."""
for e, mf in form.items():
if e == Atom.H:
continue
yield e, mf, weight_func(e) | python | def _weighted_formula(form, weight_func):
"""Yield weight of each formula element."""
for e, mf in form.items():
if e == Atom.H:
continue
yield e, mf, weight_func(e) | [
"def",
"_weighted_formula",
"(",
"form",
",",
"weight_func",
")",
":",
"for",
"e",
",",
"mf",
"in",
"form",
".",
"items",
"(",
")",
":",
"if",
"e",
"==",
"Atom",
".",
"H",
":",
"continue",
"yield",
"e",
",",
"mf",
",",
"weight_func",
"(",
"e",
")... | Yield weight of each formula element. | [
"Yield",
"weight",
"of",
"each",
"formula",
"element",
"."
] | dc427848c4f9d109ca590f0afa024c63b685b3f4 | https://github.com/zhanglab/psamm/blob/dc427848c4f9d109ca590f0afa024c63b685b3f4/psamm/mapmaker.py#L43-L49 |
48,326 | zhanglab/psamm | psamm/mapmaker.py | _transfers | def _transfers(reaction, delta, elements, result, epsilon):
"""Yield transfers obtained from result."""
left = set(c for c, _ in reaction.left)
right = set(c for c, _ in reaction.right)
for c1, c2 in product(left, right):
items = {}
for e in elements:
v = result.get_value(del... | python | def _transfers(reaction, delta, elements, result, epsilon):
"""Yield transfers obtained from result."""
left = set(c for c, _ in reaction.left)
right = set(c for c, _ in reaction.right)
for c1, c2 in product(left, right):
items = {}
for e in elements:
v = result.get_value(del... | [
"def",
"_transfers",
"(",
"reaction",
",",
"delta",
",",
"elements",
",",
"result",
",",
"epsilon",
")",
":",
"left",
"=",
"set",
"(",
"c",
"for",
"c",
",",
"_",
"in",
"reaction",
".",
"left",
")",
"right",
"=",
"set",
"(",
"c",
"for",
"c",
",",
... | Yield transfers obtained from result. | [
"Yield",
"transfers",
"obtained",
"from",
"result",
"."
] | dc427848c4f9d109ca590f0afa024c63b685b3f4 | https://github.com/zhanglab/psamm/blob/dc427848c4f9d109ca590f0afa024c63b685b3f4/psamm/mapmaker.py#L52-L67 |
48,327 | hearsaycorp/normalize | normalize/coll.py | _make_generic | def _make_generic(of, coll):
"""Used to make a new Collection type, without that type having to be
defined explicitly. Generates a new type name using the item type and a
'suffix' Collection class property.
args:
``of=``\ *Record type*
The type of values of the collection
... | python | def _make_generic(of, coll):
"""Used to make a new Collection type, without that type having to be
defined explicitly. Generates a new type name using the item type and a
'suffix' Collection class property.
args:
``of=``\ *Record type*
The type of values of the collection
... | [
"def",
"_make_generic",
"(",
"of",
",",
"coll",
")",
":",
"assert",
"(",
"issubclass",
"(",
"coll",
",",
"Collection",
")",
")",
"key",
"=",
"(",
"coll",
".",
"__name__",
",",
"\"%s.%s\"",
"%",
"(",
"of",
".",
"__module__",
",",
"of",
".",
"__name__"... | Used to make a new Collection type, without that type having to be
defined explicitly. Generates a new type name using the item type and a
'suffix' Collection class property.
args:
``of=``\ *Record type*
The type of values of the collection
``coll=``\ *Collection sub-class*
... | [
"Used",
"to",
"make",
"a",
"new",
"Collection",
"type",
"without",
"that",
"type",
"having",
"to",
"be",
"defined",
"explicitly",
".",
"Generates",
"a",
"new",
"type",
"name",
"using",
"the",
"item",
"type",
"and",
"a",
"suffix",
"Collection",
"class",
"pr... | 8b36522ddca6d41b434580bd848f3bdaa7a999c8 | https://github.com/hearsaycorp/normalize/blob/8b36522ddca6d41b434580bd848f3bdaa7a999c8/normalize/coll.py#L470-L498 |
48,328 | hearsaycorp/normalize | normalize/coll.py | Collection.coerce_value | def coerce_value(cls, v):
"""Coerce a value to the right type for the collection, or return it if
it is already of the right type."""
if isinstance(v, cls.itemtype):
return v
else:
try:
return cls.coerceitem(v)
except Exception as e:
... | python | def coerce_value(cls, v):
"""Coerce a value to the right type for the collection, or return it if
it is already of the right type."""
if isinstance(v, cls.itemtype):
return v
else:
try:
return cls.coerceitem(v)
except Exception as e:
... | [
"def",
"coerce_value",
"(",
"cls",
",",
"v",
")",
":",
"if",
"isinstance",
"(",
"v",
",",
"cls",
".",
"itemtype",
")",
":",
"return",
"v",
"else",
":",
"try",
":",
"return",
"cls",
".",
"coerceitem",
"(",
"v",
")",
"except",
"Exception",
"as",
"e",... | Coerce a value to the right type for the collection, or return it if
it is already of the right type. | [
"Coerce",
"a",
"value",
"to",
"the",
"right",
"type",
"for",
"the",
"collection",
"or",
"return",
"it",
"if",
"it",
"is",
"already",
"of",
"the",
"right",
"type",
"."
] | 8b36522ddca6d41b434580bd848f3bdaa7a999c8 | https://github.com/hearsaycorp/normalize/blob/8b36522ddca6d41b434580bd848f3bdaa7a999c8/normalize/coll.py#L133-L147 |
48,329 | hearsaycorp/normalize | normalize/coll.py | ListCollection.extend | def extend(self, iterable):
"""Adds new values to the end of the collection, coercing items.
"""
# perhaps: self[len(self):len(self)] = iterable
self._values.extend(self.coerce_value(item) for item in iterable) | python | def extend(self, iterable):
"""Adds new values to the end of the collection, coercing items.
"""
# perhaps: self[len(self):len(self)] = iterable
self._values.extend(self.coerce_value(item) for item in iterable) | [
"def",
"extend",
"(",
"self",
",",
"iterable",
")",
":",
"# perhaps: self[len(self):len(self)] = iterable",
"self",
".",
"_values",
".",
"extend",
"(",
"self",
".",
"coerce_value",
"(",
"item",
")",
"for",
"item",
"in",
"iterable",
")"
] | Adds new values to the end of the collection, coercing items. | [
"Adds",
"new",
"values",
"to",
"the",
"end",
"of",
"the",
"collection",
"coercing",
"items",
"."
] | 8b36522ddca6d41b434580bd848f3bdaa7a999c8 | https://github.com/hearsaycorp/normalize/blob/8b36522ddca6d41b434580bd848f3bdaa7a999c8/normalize/coll.py#L344-L348 |
48,330 | wrongwaycn/ssdb-py | ssdb/client.py | StrictSSDB.parse_response | def parse_response(self, connection, command_name, **options):
"""
Parses a response from the ssdb server
"""
response = connection.read_response()
if command_name in self.response_callbacks and len(response):
status = nativestr(response[0])
if status == R... | python | def parse_response(self, connection, command_name, **options):
"""
Parses a response from the ssdb server
"""
response = connection.read_response()
if command_name in self.response_callbacks and len(response):
status = nativestr(response[0])
if status == R... | [
"def",
"parse_response",
"(",
"self",
",",
"connection",
",",
"command_name",
",",
"*",
"*",
"options",
")",
":",
"response",
"=",
"connection",
".",
"read_response",
"(",
")",
"if",
"command_name",
"in",
"self",
".",
"response_callbacks",
"and",
"len",
"(",... | Parses a response from the ssdb server | [
"Parses",
"a",
"response",
"from",
"the",
"ssdb",
"server"
] | ce7b1542f0faa06fe71a60c667fe15992af0f621 | https://github.com/wrongwaycn/ssdb-py/blob/ce7b1542f0faa06fe71a60c667fe15992af0f621/ssdb/client.py#L227-L242 |
48,331 | wrongwaycn/ssdb-py | ssdb/client.py | StrictSSDB.incr | def incr(self, name, amount=1):
"""
Increase the value at key ``name`` by ``amount``. If no key exists, the value
will be initialized as ``amount`` .
Like **Redis.INCR**
:param string name: the key name
:param int amount: increments
:return: the integer value at... | python | def incr(self, name, amount=1):
"""
Increase the value at key ``name`` by ``amount``. If no key exists, the value
will be initialized as ``amount`` .
Like **Redis.INCR**
:param string name: the key name
:param int amount: increments
:return: the integer value at... | [
"def",
"incr",
"(",
"self",
",",
"name",
",",
"amount",
"=",
"1",
")",
":",
"amount",
"=",
"get_integer",
"(",
"'amount'",
",",
"amount",
")",
"return",
"self",
".",
"execute_command",
"(",
"'incr'",
",",
"name",
",",
"amount",
")"
] | Increase the value at key ``name`` by ``amount``. If no key exists, the value
will be initialized as ``amount`` .
Like **Redis.INCR**
:param string name: the key name
:param int amount: increments
:return: the integer value at key ``name``
:rtype: int
>>> ssdb.... | [
"Increase",
"the",
"value",
"at",
"key",
"name",
"by",
"amount",
".",
"If",
"no",
"key",
"exists",
"the",
"value",
"will",
"be",
"initialized",
"as",
"amount",
"."
] | ce7b1542f0faa06fe71a60c667fe15992af0f621 | https://github.com/wrongwaycn/ssdb-py/blob/ce7b1542f0faa06fe71a60c667fe15992af0f621/ssdb/client.py#L426-L448 |
48,332 | wrongwaycn/ssdb-py | ssdb/client.py | StrictSSDB.decr | def decr(self, name, amount=1):
"""
Decrease the value at key ``name`` by ``amount``. If no key exists, the value
will be initialized as 0 - ``amount`` .
Like **Redis.DECR**
:param string name: the key name
:param int amount: decrements
:return: the integer valu... | python | def decr(self, name, amount=1):
"""
Decrease the value at key ``name`` by ``amount``. If no key exists, the value
will be initialized as 0 - ``amount`` .
Like **Redis.DECR**
:param string name: the key name
:param int amount: decrements
:return: the integer valu... | [
"def",
"decr",
"(",
"self",
",",
"name",
",",
"amount",
"=",
"1",
")",
":",
"amount",
"=",
"get_positive_integer",
"(",
"'amount'",
",",
"amount",
")",
"return",
"self",
".",
"execute_command",
"(",
"'decr'",
",",
"name",
",",
"amount",
")"
] | Decrease the value at key ``name`` by ``amount``. If no key exists, the value
will be initialized as 0 - ``amount`` .
Like **Redis.DECR**
:param string name: the key name
:param int amount: decrements
:return: the integer value at key ``name``
:rtype: int
>>> s... | [
"Decrease",
"the",
"value",
"at",
"key",
"name",
"by",
"amount",
".",
"If",
"no",
"key",
"exists",
"the",
"value",
"will",
"be",
"initialized",
"as",
"0",
"-",
"amount",
"."
] | ce7b1542f0faa06fe71a60c667fe15992af0f621 | https://github.com/wrongwaycn/ssdb-py/blob/ce7b1542f0faa06fe71a60c667fe15992af0f621/ssdb/client.py#L450-L470 |
48,333 | wrongwaycn/ssdb-py | ssdb/client.py | StrictSSDB.getbit | def getbit(self, name, offset):
"""
Returns a boolean indicating the value of ``offset`` in ``name``
Like **Redis.GETBIT**
:param string name: the key name
:param int offset: the bit position
:param bool val: the bit value
:return: the bit at the ``offset`` , ``... | python | def getbit(self, name, offset):
"""
Returns a boolean indicating the value of ``offset`` in ``name``
Like **Redis.GETBIT**
:param string name: the key name
:param int offset: the bit position
:param bool val: the bit value
:return: the bit at the ``offset`` , ``... | [
"def",
"getbit",
"(",
"self",
",",
"name",
",",
"offset",
")",
":",
"offset",
"=",
"get_positive_integer",
"(",
"'offset'",
",",
"offset",
")",
"return",
"self",
".",
"execute_command",
"(",
"'getbit'",
",",
"name",
",",
"offset",
")"
] | Returns a boolean indicating the value of ``offset`` in ``name``
Like **Redis.GETBIT**
:param string name: the key name
:param int offset: the bit position
:param bool val: the bit value
:return: the bit at the ``offset`` , ``False`` if key doesn't exist or
offset exce... | [
"Returns",
"a",
"boolean",
"indicating",
"the",
"value",
"of",
"offset",
"in",
"name"
] | ce7b1542f0faa06fe71a60c667fe15992af0f621 | https://github.com/wrongwaycn/ssdb-py/blob/ce7b1542f0faa06fe71a60c667fe15992af0f621/ssdb/client.py#L472-L493 |
48,334 | wrongwaycn/ssdb-py | ssdb/client.py | StrictSSDB.countbit | def countbit(self, name, start=None, size=None):
"""
Returns the count of set bits in the value of ``key``. Optional
``start`` and ``size`` paramaters indicate which bytes to consider.
Similiar with **Redis.BITCOUNT**
:param string name: the key name
:param int start: ... | python | def countbit(self, name, start=None, size=None):
"""
Returns the count of set bits in the value of ``key``. Optional
``start`` and ``size`` paramaters indicate which bytes to consider.
Similiar with **Redis.BITCOUNT**
:param string name: the key name
:param int start: ... | [
"def",
"countbit",
"(",
"self",
",",
"name",
",",
"start",
"=",
"None",
",",
"size",
"=",
"None",
")",
":",
"if",
"start",
"is",
"not",
"None",
"and",
"size",
"is",
"not",
"None",
":",
"start",
"=",
"get_integer",
"(",
"'start'",
",",
"start",
")",... | Returns the count of set bits in the value of ``key``. Optional
``start`` and ``size`` paramaters indicate which bytes to consider.
Similiar with **Redis.BITCOUNT**
:param string name: the key name
:param int start: Optional, if start is negative, count from start'th
characte... | [
"Returns",
"the",
"count",
"of",
"set",
"bits",
"in",
"the",
"value",
"of",
"key",
".",
"Optional",
"start",
"and",
"size",
"paramaters",
"indicate",
"which",
"bytes",
"to",
"consider",
"."
] | ce7b1542f0faa06fe71a60c667fe15992af0f621 | https://github.com/wrongwaycn/ssdb-py/blob/ce7b1542f0faa06fe71a60c667fe15992af0f621/ssdb/client.py#L523-L556 |
48,335 | wrongwaycn/ssdb-py | ssdb/client.py | StrictSSDB.substr | def substr(self, name, start=None, size=None):
"""
Return a substring of the string at key ``name``. ``start`` and ``size``
are 0-based integers specifying the portion of the string to return.
Like **Redis.SUBSTR**
:param string name: the key name
:param int start: Opti... | python | def substr(self, name, start=None, size=None):
"""
Return a substring of the string at key ``name``. ``start`` and ``size``
are 0-based integers specifying the portion of the string to return.
Like **Redis.SUBSTR**
:param string name: the key name
:param int start: Opti... | [
"def",
"substr",
"(",
"self",
",",
"name",
",",
"start",
"=",
"None",
",",
"size",
"=",
"None",
")",
":",
"if",
"start",
"is",
"not",
"None",
"and",
"size",
"is",
"not",
"None",
":",
"start",
"=",
"get_integer",
"(",
"'start'",
",",
"start",
")",
... | Return a substring of the string at key ``name``. ``start`` and ``size``
are 0-based integers specifying the portion of the string to return.
Like **Redis.SUBSTR**
:param string name: the key name
:param int start: Optional, the offset of first byte returned. If start
is negat... | [
"Return",
"a",
"substring",
"of",
"the",
"string",
"at",
"key",
"name",
".",
"start",
"and",
"size",
"are",
"0",
"-",
"based",
"integers",
"specifying",
"the",
"portion",
"of",
"the",
"string",
"to",
"return",
"."
] | ce7b1542f0faa06fe71a60c667fe15992af0f621 | https://github.com/wrongwaycn/ssdb-py/blob/ce7b1542f0faa06fe71a60c667fe15992af0f621/ssdb/client.py#L559-L591 |
48,336 | wrongwaycn/ssdb-py | ssdb/client.py | StrictSSDB.keys | def keys(self, name_start, name_end, limit=10):
"""
Return a list of the top ``limit`` keys between ``name_start`` and
``name_end``
Similiar with **Redis.KEYS**
.. note:: The range is (``name_start``, ``name_end``]. ``name_start``
isn't in the range, but ``na... | python | def keys(self, name_start, name_end, limit=10):
"""
Return a list of the top ``limit`` keys between ``name_start`` and
``name_end``
Similiar with **Redis.KEYS**
.. note:: The range is (``name_start``, ``name_end``]. ``name_start``
isn't in the range, but ``na... | [
"def",
"keys",
"(",
"self",
",",
"name_start",
",",
"name_end",
",",
"limit",
"=",
"10",
")",
":",
"limit",
"=",
"get_positive_integer",
"(",
"'limit'",
",",
"limit",
")",
"return",
"self",
".",
"execute_command",
"(",
"'keys'",
",",
"name_start",
",",
"... | Return a list of the top ``limit`` keys between ``name_start`` and
``name_end``
Similiar with **Redis.KEYS**
.. note:: The range is (``name_start``, ``name_end``]. ``name_start``
isn't in the range, but ``name_end`` is.
:param string name_start: The lower bound(not ... | [
"Return",
"a",
"list",
"of",
"the",
"top",
"limit",
"keys",
"between",
"name_start",
"and",
"name_end"
] | ce7b1542f0faa06fe71a60c667fe15992af0f621 | https://github.com/wrongwaycn/ssdb-py/blob/ce7b1542f0faa06fe71a60c667fe15992af0f621/ssdb/client.py#L664-L692 |
48,337 | wrongwaycn/ssdb-py | ssdb/client.py | StrictSSDB.hincr | def hincr(self, name, key, amount=1):
"""
Increase the value of ``key`` in hash ``name`` by ``amount``. If no key
exists, the value will be initialized as ``amount``
Like **Redis.HINCR**
:param string name: the hash name
:param string key: the key name
... | python | def hincr(self, name, key, amount=1):
"""
Increase the value of ``key`` in hash ``name`` by ``amount``. If no key
exists, the value will be initialized as ``amount``
Like **Redis.HINCR**
:param string name: the hash name
:param string key: the key name
... | [
"def",
"hincr",
"(",
"self",
",",
"name",
",",
"key",
",",
"amount",
"=",
"1",
")",
":",
"amount",
"=",
"get_integer",
"(",
"'amount'",
",",
"amount",
")",
"return",
"self",
".",
"execute_command",
"(",
"'hincr'",
",",
"name",
",",
"key",
",",
"amoun... | Increase the value of ``key`` in hash ``name`` by ``amount``. If no key
exists, the value will be initialized as ``amount``
Like **Redis.HINCR**
:param string name: the hash name
:param string key: the key name
:param int amount: increments
:return: the ... | [
"Increase",
"the",
"value",
"of",
"key",
"in",
"hash",
"name",
"by",
"amount",
".",
"If",
"no",
"key",
"exists",
"the",
"value",
"will",
"be",
"initialized",
"as",
"amount"
] | ce7b1542f0faa06fe71a60c667fe15992af0f621 | https://github.com/wrongwaycn/ssdb-py/blob/ce7b1542f0faa06fe71a60c667fe15992af0f621/ssdb/client.py#L869-L892 |
48,338 | wrongwaycn/ssdb-py | ssdb/client.py | StrictSSDB.hdecr | def hdecr(self, name, key, amount=1):
"""
Decrease the value of ``key`` in hash ``name`` by ``amount``. If no key
exists, the value will be initialized as 0 - ``amount``
:param string name: the hash name
:param string key: the key name
:param int amount: increme... | python | def hdecr(self, name, key, amount=1):
"""
Decrease the value of ``key`` in hash ``name`` by ``amount``. If no key
exists, the value will be initialized as 0 - ``amount``
:param string name: the hash name
:param string key: the key name
:param int amount: increme... | [
"def",
"hdecr",
"(",
"self",
",",
"name",
",",
"key",
",",
"amount",
"=",
"1",
")",
":",
"amount",
"=",
"get_positive_integer",
"(",
"'amount'",
",",
"amount",
")",
"return",
"self",
".",
"execute_command",
"(",
"'hdecr'",
",",
"name",
",",
"key",
",",... | Decrease the value of ``key`` in hash ``name`` by ``amount``. If no key
exists, the value will be initialized as 0 - ``amount``
:param string name: the hash name
:param string key: the key name
:param int amount: increments
:return: the integer value of ``key`` in hash ... | [
"Decrease",
"the",
"value",
"of",
"key",
"in",
"hash",
"name",
"by",
"amount",
".",
"If",
"no",
"key",
"exists",
"the",
"value",
"will",
"be",
"initialized",
"as",
"0",
"-",
"amount"
] | ce7b1542f0faa06fe71a60c667fe15992af0f621 | https://github.com/wrongwaycn/ssdb-py/blob/ce7b1542f0faa06fe71a60c667fe15992af0f621/ssdb/client.py#L894-L915 |
48,339 | wrongwaycn/ssdb-py | ssdb/client.py | StrictSSDB.hkeys | def hkeys(self, name, key_start, key_end, limit=10):
"""
Return a list of the top ``limit`` keys between ``key_start`` and
``key_end`` in hash ``name``
Similiar with **Redis.HKEYS**
.. note:: The range is (``key_start``, ``key_end``]. The ``key_start``
isn't ... | python | def hkeys(self, name, key_start, key_end, limit=10):
"""
Return a list of the top ``limit`` keys between ``key_start`` and
``key_end`` in hash ``name``
Similiar with **Redis.HKEYS**
.. note:: The range is (``key_start``, ``key_end``]. The ``key_start``
isn't ... | [
"def",
"hkeys",
"(",
"self",
",",
"name",
",",
"key_start",
",",
"key_end",
",",
"limit",
"=",
"10",
")",
":",
"limit",
"=",
"get_positive_integer",
"(",
"'limit'",
",",
"limit",
")",
"return",
"self",
".",
"execute_command",
"(",
"'hkeys'",
",",
"name",... | Return a list of the top ``limit`` keys between ``key_start`` and
``key_end`` in hash ``name``
Similiar with **Redis.HKEYS**
.. note:: The range is (``key_start``, ``key_end``]. The ``key_start``
isn't in the range, but ``key_end`` is.
:param string name: the hash n... | [
"Return",
"a",
"list",
"of",
"the",
"top",
"limit",
"keys",
"between",
"key_start",
"and",
"key_end",
"in",
"hash",
"name"
] | ce7b1542f0faa06fe71a60c667fe15992af0f621 | https://github.com/wrongwaycn/ssdb-py/blob/ce7b1542f0faa06fe71a60c667fe15992af0f621/ssdb/client.py#L999-L1028 |
48,340 | wrongwaycn/ssdb-py | ssdb/client.py | StrictSSDB.hlist | def hlist(self, name_start, name_end, limit=10):
"""
Return a list of the top ``limit`` hash's name between ``name_start`` and
``name_end`` in ascending order
.. note:: The range is (``name_start``, ``name_end``]. The ``name_start``
isn't in the range, but ``name_end`` is.
... | python | def hlist(self, name_start, name_end, limit=10):
"""
Return a list of the top ``limit`` hash's name between ``name_start`` and
``name_end`` in ascending order
.. note:: The range is (``name_start``, ``name_end``]. The ``name_start``
isn't in the range, but ``name_end`` is.
... | [
"def",
"hlist",
"(",
"self",
",",
"name_start",
",",
"name_end",
",",
"limit",
"=",
"10",
")",
":",
"limit",
"=",
"get_positive_integer",
"(",
"'limit'",
",",
"limit",
")",
"return",
"self",
".",
"execute_command",
"(",
"'hlist'",
",",
"name_start",
",",
... | Return a list of the top ``limit`` hash's name between ``name_start`` and
``name_end`` in ascending order
.. note:: The range is (``name_start``, ``name_end``]. The ``name_start``
isn't in the range, but ``name_end`` is.
:param string name_start: The lower bound(not included) of has... | [
"Return",
"a",
"list",
"of",
"the",
"top",
"limit",
"hash",
"s",
"name",
"between",
"name_start",
"and",
"name_end",
"in",
"ascending",
"order"
] | ce7b1542f0faa06fe71a60c667fe15992af0f621 | https://github.com/wrongwaycn/ssdb-py/blob/ce7b1542f0faa06fe71a60c667fe15992af0f621/ssdb/client.py#L1045-L1069 |
48,341 | wrongwaycn/ssdb-py | ssdb/client.py | StrictSSDB.hrlist | def hrlist(self, name_start, name_end, limit=10):
"""
Return a list of the top ``limit`` hash's name between ``name_start`` and
``name_end`` in descending order
.. note:: The range is (``name_start``, ``name_end``]. The ``name_start``
isn't in the range, but ``name_end`` is.
... | python | def hrlist(self, name_start, name_end, limit=10):
"""
Return a list of the top ``limit`` hash's name between ``name_start`` and
``name_end`` in descending order
.. note:: The range is (``name_start``, ``name_end``]. The ``name_start``
isn't in the range, but ``name_end`` is.
... | [
"def",
"hrlist",
"(",
"self",
",",
"name_start",
",",
"name_end",
",",
"limit",
"=",
"10",
")",
":",
"limit",
"=",
"get_positive_integer",
"(",
"'limit'",
",",
"limit",
")",
"return",
"self",
".",
"execute_command",
"(",
"'hrlist'",
",",
"name_start",
",",... | Return a list of the top ``limit`` hash's name between ``name_start`` and
``name_end`` in descending order
.. note:: The range is (``name_start``, ``name_end``]. The ``name_start``
isn't in the range, but ``name_end`` is.
:param string name_start: The lower bound(not included) of ha... | [
"Return",
"a",
"list",
"of",
"the",
"top",
"limit",
"hash",
"s",
"name",
"between",
"name_start",
"and",
"name_end",
"in",
"descending",
"order"
] | ce7b1542f0faa06fe71a60c667fe15992af0f621 | https://github.com/wrongwaycn/ssdb-py/blob/ce7b1542f0faa06fe71a60c667fe15992af0f621/ssdb/client.py#L1071-L1095 |
48,342 | wrongwaycn/ssdb-py | ssdb/client.py | StrictSSDB.zset | def zset(self, name, key, score=1):
"""
Set the score of ``key`` from the zset ``name`` to ``score``
Like **Redis.ZADD**
:param string name: the zset name
:param string key: the key name
:param int score: the score for ranking
:return: ``True`` if ``zset`` creat... | python | def zset(self, name, key, score=1):
"""
Set the score of ``key`` from the zset ``name`` to ``score``
Like **Redis.ZADD**
:param string name: the zset name
:param string key: the key name
:param int score: the score for ranking
:return: ``True`` if ``zset`` creat... | [
"def",
"zset",
"(",
"self",
",",
"name",
",",
"key",
",",
"score",
"=",
"1",
")",
":",
"score",
"=",
"get_integer",
"(",
"'score'",
",",
"score",
")",
"return",
"self",
".",
"execute_command",
"(",
"'zset'",
",",
"name",
",",
"key",
",",
"score",
"... | Set the score of ``key`` from the zset ``name`` to ``score``
Like **Redis.ZADD**
:param string name: the zset name
:param string key: the key name
:param int score: the score for ranking
:return: ``True`` if ``zset`` created a new score, otherwise ``False``
:rtype: bool... | [
"Set",
"the",
"score",
"of",
"key",
"from",
"the",
"zset",
"name",
"to",
"score"
] | ce7b1542f0faa06fe71a60c667fe15992af0f621 | https://github.com/wrongwaycn/ssdb-py/blob/ce7b1542f0faa06fe71a60c667fe15992af0f621/ssdb/client.py#L1159-L1181 |
48,343 | wrongwaycn/ssdb-py | ssdb/client.py | StrictSSDB.zincr | def zincr(self, name, key, amount=1):
"""
Increase the score of ``key`` in zset ``name`` by ``amount``. If no key
exists, the value will be initialized as ``amount``
Like **Redis.ZINCR**
:param string name: the zset name
:param string key: the key name
:... | python | def zincr(self, name, key, amount=1):
"""
Increase the score of ``key`` in zset ``name`` by ``amount``. If no key
exists, the value will be initialized as ``amount``
Like **Redis.ZINCR**
:param string name: the zset name
:param string key: the key name
:... | [
"def",
"zincr",
"(",
"self",
",",
"name",
",",
"key",
",",
"amount",
"=",
"1",
")",
":",
"amount",
"=",
"get_integer",
"(",
"'amount'",
",",
"amount",
")",
"return",
"self",
".",
"execute_command",
"(",
"'zincr'",
",",
"name",
",",
"key",
",",
"amoun... | Increase the score of ``key`` in zset ``name`` by ``amount``. If no key
exists, the value will be initialized as ``amount``
Like **Redis.ZINCR**
:param string name: the zset name
:param string key: the key name
:param int amount: increments
:return: the integer ... | [
"Increase",
"the",
"score",
"of",
"key",
"in",
"zset",
"name",
"by",
"amount",
".",
"If",
"no",
"key",
"exists",
"the",
"value",
"will",
"be",
"initialized",
"as",
"amount"
] | ce7b1542f0faa06fe71a60c667fe15992af0f621 | https://github.com/wrongwaycn/ssdb-py/blob/ce7b1542f0faa06fe71a60c667fe15992af0f621/ssdb/client.py#L1275-L1298 |
48,344 | wrongwaycn/ssdb-py | ssdb/client.py | StrictSSDB.zdecr | def zdecr(self, name, key, amount=1):
"""
Decrease the value of ``key`` in zset ``name`` by ``amount``. If no key
exists, the value will be initialized as 0 - ``amount``
:param string name: the zset name
:param string key: the key name
:param int amount: increme... | python | def zdecr(self, name, key, amount=1):
"""
Decrease the value of ``key`` in zset ``name`` by ``amount``. If no key
exists, the value will be initialized as 0 - ``amount``
:param string name: the zset name
:param string key: the key name
:param int amount: increme... | [
"def",
"zdecr",
"(",
"self",
",",
"name",
",",
"key",
",",
"amount",
"=",
"1",
")",
":",
"amount",
"=",
"get_positive_integer",
"(",
"'amount'",
",",
"amount",
")",
"return",
"self",
".",
"execute_command",
"(",
"'zdecr'",
",",
"name",
",",
"key",
",",... | Decrease the value of ``key`` in zset ``name`` by ``amount``. If no key
exists, the value will be initialized as 0 - ``amount``
:param string name: the zset name
:param string key: the key name
:param int amount: increments
:return: the integer value of ``key`` in zset ... | [
"Decrease",
"the",
"value",
"of",
"key",
"in",
"zset",
"name",
"by",
"amount",
".",
"If",
"no",
"key",
"exists",
"the",
"value",
"will",
"be",
"initialized",
"as",
"0",
"-",
"amount"
] | ce7b1542f0faa06fe71a60c667fe15992af0f621 | https://github.com/wrongwaycn/ssdb-py/blob/ce7b1542f0faa06fe71a60c667fe15992af0f621/ssdb/client.py#L1300-L1321 |
48,345 | wrongwaycn/ssdb-py | ssdb/client.py | StrictSSDB.zlist | def zlist(self, name_start, name_end, limit=10):
"""
Return a list of the top ``limit`` zset's name between ``name_start`` and
``name_end`` in ascending order
.. note:: The range is (``name_start``, ``name_end``]. The ``name_start``
isn't in the range, but ``name_end`` is.
... | python | def zlist(self, name_start, name_end, limit=10):
"""
Return a list of the top ``limit`` zset's name between ``name_start`` and
``name_end`` in ascending order
.. note:: The range is (``name_start``, ``name_end``]. The ``name_start``
isn't in the range, but ``name_end`` is.
... | [
"def",
"zlist",
"(",
"self",
",",
"name_start",
",",
"name_end",
",",
"limit",
"=",
"10",
")",
":",
"limit",
"=",
"get_positive_integer",
"(",
"'limit'",
",",
"limit",
")",
"return",
"self",
".",
"execute_command",
"(",
"'zlist'",
",",
"name_start",
",",
... | Return a list of the top ``limit`` zset's name between ``name_start`` and
``name_end`` in ascending order
.. note:: The range is (``name_start``, ``name_end``]. The ``name_start``
isn't in the range, but ``name_end`` is.
:param string name_start: The lower bound(not included) of zse... | [
"Return",
"a",
"list",
"of",
"the",
"top",
"limit",
"zset",
"s",
"name",
"between",
"name_start",
"and",
"name_end",
"in",
"ascending",
"order"
] | ce7b1542f0faa06fe71a60c667fe15992af0f621 | https://github.com/wrongwaycn/ssdb-py/blob/ce7b1542f0faa06fe71a60c667fe15992af0f621/ssdb/client.py#L1401-L1425 |
48,346 | wrongwaycn/ssdb-py | ssdb/client.py | StrictSSDB.zrlist | def zrlist(self, name_start, name_end, limit=10):
"""
Return a list of the top ``limit`` zset's name between ``name_start`` and
``name_end`` in descending order
.. note:: The range is (``name_start``, ``name_end``]. The ``name_start``
isn't in the range, but ``name_end`` is.
... | python | def zrlist(self, name_start, name_end, limit=10):
"""
Return a list of the top ``limit`` zset's name between ``name_start`` and
``name_end`` in descending order
.. note:: The range is (``name_start``, ``name_end``]. The ``name_start``
isn't in the range, but ``name_end`` is.
... | [
"def",
"zrlist",
"(",
"self",
",",
"name_start",
",",
"name_end",
",",
"limit",
"=",
"10",
")",
":",
"limit",
"=",
"get_positive_integer",
"(",
"'limit'",
",",
"limit",
")",
"return",
"self",
".",
"execute_command",
"(",
"'zrlist'",
",",
"name_start",
",",... | Return a list of the top ``limit`` zset's name between ``name_start`` and
``name_end`` in descending order
.. note:: The range is (``name_start``, ``name_end``]. The ``name_start``
isn't in the range, but ``name_end`` is.
:param string name_start: The lower bound(not included) of zs... | [
"Return",
"a",
"list",
"of",
"the",
"top",
"limit",
"zset",
"s",
"name",
"between",
"name_start",
"and",
"name_end",
"in",
"descending",
"order"
] | ce7b1542f0faa06fe71a60c667fe15992af0f621 | https://github.com/wrongwaycn/ssdb-py/blob/ce7b1542f0faa06fe71a60c667fe15992af0f621/ssdb/client.py#L1427-L1451 |
48,347 | wrongwaycn/ssdb-py | ssdb/client.py | StrictSSDB.zkeys | def zkeys(self, name, key_start, score_start, score_end, limit=10):
"""
Return a list of the top ``limit`` keys after ``key_start`` from zset
``name`` with scores between ``score_start`` and ``score_end``
.. note:: The range is (``key_start``+``score_start``, ``key_end``]. That
... | python | def zkeys(self, name, key_start, score_start, score_end, limit=10):
"""
Return a list of the top ``limit`` keys after ``key_start`` from zset
``name`` with scores between ``score_start`` and ``score_end``
.. note:: The range is (``key_start``+``score_start``, ``key_end``]. That
... | [
"def",
"zkeys",
"(",
"self",
",",
"name",
",",
"key_start",
",",
"score_start",
",",
"score_end",
",",
"limit",
"=",
"10",
")",
":",
"score_start",
"=",
"get_integer_or_emptystring",
"(",
"'score_start'",
",",
"score_start",
")",
"score_end",
"=",
"get_integer... | Return a list of the top ``limit`` keys after ``key_start`` from zset
``name`` with scores between ``score_start`` and ``score_end``
.. note:: The range is (``key_start``+``score_start``, ``key_end``]. That
means (key.score == score_start && key > key_start || key.score >
score_s... | [
"Return",
"a",
"list",
"of",
"the",
"top",
"limit",
"keys",
"after",
"key_start",
"from",
"zset",
"name",
"with",
"scores",
"between",
"score_start",
"and",
"score_end"
] | ce7b1542f0faa06fe71a60c667fe15992af0f621 | https://github.com/wrongwaycn/ssdb-py/blob/ce7b1542f0faa06fe71a60c667fe15992af0f621/ssdb/client.py#L1453-L1484 |
48,348 | wrongwaycn/ssdb-py | ssdb/client.py | StrictSSDB.zcount | def zcount(self, name, score_start, score_end):
"""
Returns the number of elements in the sorted set at key ``name`` with
a score between ``score_start`` and ``score_end``.
Like **Redis.ZCOUNT**
.. note:: The range is [``score_start``, ``score_end``]
:param string name... | python | def zcount(self, name, score_start, score_end):
"""
Returns the number of elements in the sorted set at key ``name`` with
a score between ``score_start`` and ``score_end``.
Like **Redis.ZCOUNT**
.. note:: The range is [``score_start``, ``score_end``]
:param string name... | [
"def",
"zcount",
"(",
"self",
",",
"name",
",",
"score_start",
",",
"score_end",
")",
":",
"score_start",
"=",
"get_integer_or_emptystring",
"(",
"'score_start'",
",",
"score_start",
")",
"score_end",
"=",
"get_integer_or_emptystring",
"(",
"'score_end'",
",",
"sc... | Returns the number of elements in the sorted set at key ``name`` with
a score between ``score_start`` and ``score_end``.
Like **Redis.ZCOUNT**
.. note:: The range is [``score_start``, ``score_end``]
:param string name: the zset name
:param int score_start: The minimum score re... | [
"Returns",
"the",
"number",
"of",
"elements",
"in",
"the",
"sorted",
"set",
"at",
"key",
"name",
"with",
"a",
"score",
"between",
"score_start",
"and",
"score_end",
"."
] | ce7b1542f0faa06fe71a60c667fe15992af0f621 | https://github.com/wrongwaycn/ssdb-py/blob/ce7b1542f0faa06fe71a60c667fe15992af0f621/ssdb/client.py#L1660-L1686 |
48,349 | wrongwaycn/ssdb-py | ssdb/client.py | StrictSSDB.qget | def qget(self, name, index):
"""
Get the element of ``index`` within the queue ``name``
:param string name: the queue name
:param int index: the specified index, can < 0
:return: the value at ``index`` within queue ``name`` , or ``None`` if the
element doesn't exist
... | python | def qget(self, name, index):
"""
Get the element of ``index`` within the queue ``name``
:param string name: the queue name
:param int index: the specified index, can < 0
:return: the value at ``index`` within queue ``name`` , or ``None`` if the
element doesn't exist
... | [
"def",
"qget",
"(",
"self",
",",
"name",
",",
"index",
")",
":",
"index",
"=",
"get_integer",
"(",
"'index'",
",",
"index",
")",
"return",
"self",
".",
"execute_command",
"(",
"'qget'",
",",
"name",
",",
"index",
")"
] | Get the element of ``index`` within the queue ``name``
:param string name: the queue name
:param int index: the specified index, can < 0
:return: the value at ``index`` within queue ``name`` , or ``None`` if the
element doesn't exist
:rtype: string | [
"Get",
"the",
"element",
"of",
"index",
"within",
"the",
"queue",
"name"
] | ce7b1542f0faa06fe71a60c667fe15992af0f621 | https://github.com/wrongwaycn/ssdb-py/blob/ce7b1542f0faa06fe71a60c667fe15992af0f621/ssdb/client.py#L1793-L1805 |
48,350 | wrongwaycn/ssdb-py | ssdb/client.py | StrictSSDB.qset | def qset(self, name, index, value):
"""
Set the list element at ``index`` to ``value``.
:param string name: the queue name
:param int index: the specified index, can < 0
:param string value: the element value
:return: Unknown
:rtype: True
"""
... | python | def qset(self, name, index, value):
"""
Set the list element at ``index`` to ``value``.
:param string name: the queue name
:param int index: the specified index, can < 0
:param string value: the element value
:return: Unknown
:rtype: True
"""
... | [
"def",
"qset",
"(",
"self",
",",
"name",
",",
"index",
",",
"value",
")",
":",
"index",
"=",
"get_integer",
"(",
"'index'",
",",
"index",
")",
"return",
"self",
".",
"execute_command",
"(",
"'qset'",
",",
"name",
",",
"index",
",",
"value",
")"
] | Set the list element at ``index`` to ``value``.
:param string name: the queue name
:param int index: the specified index, can < 0
:param string value: the element value
:return: Unknown
:rtype: True | [
"Set",
"the",
"list",
"element",
"at",
"index",
"to",
"value",
"."
] | ce7b1542f0faa06fe71a60c667fe15992af0f621 | https://github.com/wrongwaycn/ssdb-py/blob/ce7b1542f0faa06fe71a60c667fe15992af0f621/ssdb/client.py#L1807-L1819 |
48,351 | wrongwaycn/ssdb-py | ssdb/client.py | StrictSSDB.qpop_front | def qpop_front(self, name, size=1):
"""
Remove and return the first ``size`` item of the list ``name``
Like **Redis.LPOP**
:param string name: the queue name
:param int size: the length of result
:return: the list of pop elements
:rtype: list
... | python | def qpop_front(self, name, size=1):
"""
Remove and return the first ``size`` item of the list ``name``
Like **Redis.LPOP**
:param string name: the queue name
:param int size: the length of result
:return: the list of pop elements
:rtype: list
... | [
"def",
"qpop_front",
"(",
"self",
",",
"name",
",",
"size",
"=",
"1",
")",
":",
"size",
"=",
"get_positive_integer",
"(",
"\"size\"",
",",
"size",
")",
"return",
"self",
".",
"execute_command",
"(",
"'qpop_front'",
",",
"name",
",",
"size",
")"
] | Remove and return the first ``size`` item of the list ``name``
Like **Redis.LPOP**
:param string name: the queue name
:param int size: the length of result
:return: the list of pop elements
:rtype: list | [
"Remove",
"and",
"return",
"the",
"first",
"size",
"item",
"of",
"the",
"list",
"name"
] | ce7b1542f0faa06fe71a60c667fe15992af0f621 | https://github.com/wrongwaycn/ssdb-py/blob/ce7b1542f0faa06fe71a60c667fe15992af0f621/ssdb/client.py#L1851-L1864 |
48,352 | wrongwaycn/ssdb-py | ssdb/client.py | StrictSSDB.qpop_back | def qpop_back(self, name, size=1):
"""
Remove and return the last ``size`` item of the list ``name``
Like **Redis.RPOP**
:param string name: the queue name
:param int size: the length of result
:return: the list of pop elements
:rtype: list
"""
... | python | def qpop_back(self, name, size=1):
"""
Remove and return the last ``size`` item of the list ``name``
Like **Redis.RPOP**
:param string name: the queue name
:param int size: the length of result
:return: the list of pop elements
:rtype: list
"""
... | [
"def",
"qpop_back",
"(",
"self",
",",
"name",
",",
"size",
"=",
"1",
")",
":",
"size",
"=",
"get_positive_integer",
"(",
"\"size\"",
",",
"size",
")",
"return",
"self",
".",
"execute_command",
"(",
"'qpop_back'",
",",
"name",
",",
"size",
")"
] | Remove and return the last ``size`` item of the list ``name``
Like **Redis.RPOP**
:param string name: the queue name
:param int size: the length of result
:return: the list of pop elements
:rtype: list | [
"Remove",
"and",
"return",
"the",
"last",
"size",
"item",
"of",
"the",
"list",
"name"
] | ce7b1542f0faa06fe71a60c667fe15992af0f621 | https://github.com/wrongwaycn/ssdb-py/blob/ce7b1542f0faa06fe71a60c667fe15992af0f621/ssdb/client.py#L1867-L1880 |
48,353 | wrongwaycn/ssdb-py | ssdb/client.py | StrictSSDB.qlist | def qlist(self, name_start, name_end, limit):
"""
Return a list of the top ``limit`` keys between ``name_start`` and
``name_end`` in ascending order
.. note:: The range is (``name_start``, ``name_end``]. ``name_start``
isn't in the range, but ``name_end`` is.
:param... | python | def qlist(self, name_start, name_end, limit):
"""
Return a list of the top ``limit`` keys between ``name_start`` and
``name_end`` in ascending order
.. note:: The range is (``name_start``, ``name_end``]. ``name_start``
isn't in the range, but ``name_end`` is.
:param... | [
"def",
"qlist",
"(",
"self",
",",
"name_start",
",",
"name_end",
",",
"limit",
")",
":",
"limit",
"=",
"get_positive_integer",
"(",
"\"limit\"",
",",
"limit",
")",
"return",
"self",
".",
"execute_command",
"(",
"'qlist'",
",",
"name_start",
",",
"name_end",
... | Return a list of the top ``limit`` keys between ``name_start`` and
``name_end`` in ascending order
.. note:: The range is (``name_start``, ``name_end``]. ``name_start``
isn't in the range, but ``name_end`` is.
:param string name_start: The lower bound(not included) of keys to be
... | [
"Return",
"a",
"list",
"of",
"the",
"top",
"limit",
"keys",
"between",
"name_start",
"and",
"name_end",
"in",
"ascending",
"order"
] | ce7b1542f0faa06fe71a60c667fe15992af0f621 | https://github.com/wrongwaycn/ssdb-py/blob/ce7b1542f0faa06fe71a60c667fe15992af0f621/ssdb/client.py#L1914-L1938 |
48,354 | wrongwaycn/ssdb-py | ssdb/client.py | StrictSSDB.qrlist | def qrlist(self, name_start, name_end, limit):
"""
Return a list of the top ``limit`` keys between ``name_start`` and
``name_end`` in descending order
.. note:: The range is (``name_start``, ``name_end``]. ``name_start``
isn't in the range, but ``name_end`` is.
:par... | python | def qrlist(self, name_start, name_end, limit):
"""
Return a list of the top ``limit`` keys between ``name_start`` and
``name_end`` in descending order
.. note:: The range is (``name_start``, ``name_end``]. ``name_start``
isn't in the range, but ``name_end`` is.
:par... | [
"def",
"qrlist",
"(",
"self",
",",
"name_start",
",",
"name_end",
",",
"limit",
")",
":",
"limit",
"=",
"get_positive_integer",
"(",
"\"limit\"",
",",
"limit",
")",
"return",
"self",
".",
"execute_command",
"(",
"'qrlist'",
",",
"name_start",
",",
"name_end"... | Return a list of the top ``limit`` keys between ``name_start`` and
``name_end`` in descending order
.. note:: The range is (``name_start``, ``name_end``]. ``name_start``
isn't in the range, but ``name_end`` is.
:param string name_start: The lower bound(not included) of keys to be
... | [
"Return",
"a",
"list",
"of",
"the",
"top",
"limit",
"keys",
"between",
"name_start",
"and",
"name_end",
"in",
"descending",
"order"
] | ce7b1542f0faa06fe71a60c667fe15992af0f621 | https://github.com/wrongwaycn/ssdb-py/blob/ce7b1542f0faa06fe71a60c667fe15992af0f621/ssdb/client.py#L1940-L1964 |
48,355 | wrongwaycn/ssdb-py | ssdb/client.py | StrictSSDB.qrange | def qrange(self, name, offset, limit):
"""
Return a ``limit`` slice of the list ``name`` at position ``offset``
``offset`` can be negative numbers just like Python slicing notation
Similiar with **Redis.LRANGE**
:param string name: the queue name
:param int offset: the... | python | def qrange(self, name, offset, limit):
"""
Return a ``limit`` slice of the list ``name`` at position ``offset``
``offset`` can be negative numbers just like Python slicing notation
Similiar with **Redis.LRANGE**
:param string name: the queue name
:param int offset: the... | [
"def",
"qrange",
"(",
"self",
",",
"name",
",",
"offset",
",",
"limit",
")",
":",
"offset",
"=",
"get_integer",
"(",
"'offset'",
",",
"offset",
")",
"limit",
"=",
"get_positive_integer",
"(",
"'limit'",
",",
"limit",
")",
"return",
"self",
".",
"execute_... | Return a ``limit`` slice of the list ``name`` at position ``offset``
``offset`` can be negative numbers just like Python slicing notation
Similiar with **Redis.LRANGE**
:param string name: the queue name
:param int offset: the returned list will start at this offset
:param int... | [
"Return",
"a",
"limit",
"slice",
"of",
"the",
"list",
"name",
"at",
"position",
"offset"
] | ce7b1542f0faa06fe71a60c667fe15992af0f621 | https://github.com/wrongwaycn/ssdb-py/blob/ce7b1542f0faa06fe71a60c667fe15992af0f621/ssdb/client.py#L1988-L2005 |
48,356 | wrongwaycn/ssdb-py | ssdb/client.py | SSDB.setx | def setx(self, name, value, ttl):
"""
Set the value of key ``name`` to ``value`` that expires in ``ttl``
seconds. ``ttl`` can be represented by an integer or a Python
timedelta object.
Like **Redis.SETEX**
:param string name: the key name
:param string value: a ... | python | def setx(self, name, value, ttl):
"""
Set the value of key ``name`` to ``value`` that expires in ``ttl``
seconds. ``ttl`` can be represented by an integer or a Python
timedelta object.
Like **Redis.SETEX**
:param string name: the key name
:param string value: a ... | [
"def",
"setx",
"(",
"self",
",",
"name",
",",
"value",
",",
"ttl",
")",
":",
"if",
"isinstance",
"(",
"ttl",
",",
"datetime",
".",
"timedelta",
")",
":",
"ttl",
"=",
"ttl",
".",
"seconds",
"+",
"ttl",
".",
"days",
"*",
"24",
"*",
"3600",
"ttl",
... | Set the value of key ``name`` to ``value`` that expires in ``ttl``
seconds. ``ttl`` can be represented by an integer or a Python
timedelta object.
Like **Redis.SETEX**
:param string name: the key name
:param string value: a string or an object can be converted to string
... | [
"Set",
"the",
"value",
"of",
"key",
"name",
"to",
"value",
"that",
"expires",
"in",
"ttl",
"seconds",
".",
"ttl",
"can",
"be",
"represented",
"by",
"an",
"integer",
"or",
"a",
"Python",
"timedelta",
"object",
"."
] | ce7b1542f0faa06fe71a60c667fe15992af0f621 | https://github.com/wrongwaycn/ssdb-py/blob/ce7b1542f0faa06fe71a60c667fe15992af0f621/ssdb/client.py#L2153-L2179 |
48,357 | merll/docker-fabric | dockerfabric/utils/net.py | get_ip6_address | def get_ip6_address(interface_name, expand=False):
"""
Extracts the IPv6 address for a particular interface from `ifconfig`.
:param interface_name: Name of the network interface (e.g. ``eth0``).
:type interface_name: unicode
:param expand: If set to ``True``, an abbreviated address is expanded to t... | python | def get_ip6_address(interface_name, expand=False):
"""
Extracts the IPv6 address for a particular interface from `ifconfig`.
:param interface_name: Name of the network interface (e.g. ``eth0``).
:type interface_name: unicode
:param expand: If set to ``True``, an abbreviated address is expanded to t... | [
"def",
"get_ip6_address",
"(",
"interface_name",
",",
"expand",
"=",
"False",
")",
":",
"address",
"=",
"_get_address",
"(",
"interface_name",
",",
"IP6_PATTERN",
")",
"if",
"address",
"and",
"expand",
":",
"return",
"':'",
".",
"join",
"(",
"_expand_groups",
... | Extracts the IPv6 address for a particular interface from `ifconfig`.
:param interface_name: Name of the network interface (e.g. ``eth0``).
:type interface_name: unicode
:param expand: If set to ``True``, an abbreviated address is expanded to the full address.
:type expand: bool
:return: IPv6 addre... | [
"Extracts",
"the",
"IPv6",
"address",
"for",
"a",
"particular",
"interface",
"from",
"ifconfig",
"."
] | 785d84e40e17265b667d8b11a6e30d8e6b2bf8d4 | https://github.com/merll/docker-fabric/blob/785d84e40e17265b667d8b11a6e30d8e6b2bf8d4/dockerfabric/utils/net.py#L47-L61 |
48,358 | merll/docker-fabric | dockerfabric/utils/base.py | get_current_roles | def get_current_roles():
"""
Determines the list of roles, that the current host is assigned to. If ``env.roledefs`` is not set, an empty list
is returned.
:return: List of roles of the current host.
:rtype: list
"""
current_host = env.host_string
roledefs = env.get('roledefs')
if r... | python | def get_current_roles():
"""
Determines the list of roles, that the current host is assigned to. If ``env.roledefs`` is not set, an empty list
is returned.
:return: List of roles of the current host.
:rtype: list
"""
current_host = env.host_string
roledefs = env.get('roledefs')
if r... | [
"def",
"get_current_roles",
"(",
")",
":",
"current_host",
"=",
"env",
".",
"host_string",
"roledefs",
"=",
"env",
".",
"get",
"(",
"'roledefs'",
")",
"if",
"roledefs",
":",
"return",
"[",
"role",
"for",
"role",
",",
"hosts",
"in",
"six",
".",
"iteritems... | Determines the list of roles, that the current host is assigned to. If ``env.roledefs`` is not set, an empty list
is returned.
:return: List of roles of the current host.
:rtype: list | [
"Determines",
"the",
"list",
"of",
"roles",
"that",
"the",
"current",
"host",
"is",
"assigned",
"to",
".",
"If",
"env",
".",
"roledefs",
"is",
"not",
"set",
"an",
"empty",
"list",
"is",
"returned",
"."
] | 785d84e40e17265b667d8b11a6e30d8e6b2bf8d4 | https://github.com/merll/docker-fabric/blob/785d84e40e17265b667d8b11a6e30d8e6b2bf8d4/dockerfabric/utils/base.py#L11-L23 |
48,359 | zhanglab/psamm | psamm/gapfilling.py | add_all_database_reactions | def add_all_database_reactions(model, compartments):
"""Add all reactions from database that occur in given compartments.
Args:
model: :class:`psamm.metabolicmodel.MetabolicModel`.
"""
added = set()
for rxnid in model.database.reactions:
reaction = model.database.get_reaction(rxnid... | python | def add_all_database_reactions(model, compartments):
"""Add all reactions from database that occur in given compartments.
Args:
model: :class:`psamm.metabolicmodel.MetabolicModel`.
"""
added = set()
for rxnid in model.database.reactions:
reaction = model.database.get_reaction(rxnid... | [
"def",
"add_all_database_reactions",
"(",
"model",
",",
"compartments",
")",
":",
"added",
"=",
"set",
"(",
")",
"for",
"rxnid",
"in",
"model",
".",
"database",
".",
"reactions",
":",
"reaction",
"=",
"model",
".",
"database",
".",
"get_reaction",
"(",
"rx... | Add all reactions from database that occur in given compartments.
Args:
model: :class:`psamm.metabolicmodel.MetabolicModel`. | [
"Add",
"all",
"reactions",
"from",
"database",
"that",
"occur",
"in",
"given",
"compartments",
"."
] | dc427848c4f9d109ca590f0afa024c63b685b3f4 | https://github.com/zhanglab/psamm/blob/dc427848c4f9d109ca590f0afa024c63b685b3f4/psamm/gapfilling.py#L38-L54 |
48,360 | zhanglab/psamm | psamm/gapfilling.py | add_all_exchange_reactions | def add_all_exchange_reactions(model, compartment, allow_duplicates=False):
"""Add all exchange reactions to database and to model.
Args:
model: :class:`psamm.metabolicmodel.MetabolicModel`.
"""
all_reactions = {}
if not allow_duplicates:
# TODO: Avoid adding reactions that already... | python | def add_all_exchange_reactions(model, compartment, allow_duplicates=False):
"""Add all exchange reactions to database and to model.
Args:
model: :class:`psamm.metabolicmodel.MetabolicModel`.
"""
all_reactions = {}
if not allow_duplicates:
# TODO: Avoid adding reactions that already... | [
"def",
"add_all_exchange_reactions",
"(",
"model",
",",
"compartment",
",",
"allow_duplicates",
"=",
"False",
")",
":",
"all_reactions",
"=",
"{",
"}",
"if",
"not",
"allow_duplicates",
":",
"# TODO: Avoid adding reactions that already exist in the database.",
"# This should... | Add all exchange reactions to database and to model.
Args:
model: :class:`psamm.metabolicmodel.MetabolicModel`. | [
"Add",
"all",
"exchange",
"reactions",
"to",
"database",
"and",
"to",
"model",
"."
] | dc427848c4f9d109ca590f0afa024c63b685b3f4 | https://github.com/zhanglab/psamm/blob/dc427848c4f9d109ca590f0afa024c63b685b3f4/psamm/gapfilling.py#L57-L95 |
48,361 | zhanglab/psamm | psamm/gapfilling.py | add_all_transport_reactions | def add_all_transport_reactions(model, boundaries, allow_duplicates=False):
"""Add all transport reactions to database and to model.
Add transport reactions for all boundaries. Boundaries are defined
by pairs (2-tuples) of compartment IDs. Transport reactions are
added for all compounds in the model, n... | python | def add_all_transport_reactions(model, boundaries, allow_duplicates=False):
"""Add all transport reactions to database and to model.
Add transport reactions for all boundaries. Boundaries are defined
by pairs (2-tuples) of compartment IDs. Transport reactions are
added for all compounds in the model, n... | [
"def",
"add_all_transport_reactions",
"(",
"model",
",",
"boundaries",
",",
"allow_duplicates",
"=",
"False",
")",
":",
"all_reactions",
"=",
"{",
"}",
"if",
"not",
"allow_duplicates",
":",
"# TODO: Avoid adding reactions that already exist in the database.",
"# This should... | Add all transport reactions to database and to model.
Add transport reactions for all boundaries. Boundaries are defined
by pairs (2-tuples) of compartment IDs. Transport reactions are
added for all compounds in the model, not just for compounds in the
two boundary compartments.
Args:
mode... | [
"Add",
"all",
"transport",
"reactions",
"to",
"database",
"and",
"to",
"model",
"."
] | dc427848c4f9d109ca590f0afa024c63b685b3f4 | https://github.com/zhanglab/psamm/blob/dc427848c4f9d109ca590f0afa024c63b685b3f4/psamm/gapfilling.py#L98-L156 |
48,362 | zhanglab/psamm | psamm/gapfilling.py | create_extended_model | def create_extended_model(model, db_penalty=None, ex_penalty=None,
tp_penalty=None, penalties=None):
"""Create an extended model for gap-filling.
Create a :class:`psamm.metabolicmodel.MetabolicModel` with
all reactions added (the reaction database in the model is taken
to be t... | python | def create_extended_model(model, db_penalty=None, ex_penalty=None,
tp_penalty=None, penalties=None):
"""Create an extended model for gap-filling.
Create a :class:`psamm.metabolicmodel.MetabolicModel` with
all reactions added (the reaction database in the model is taken
to be t... | [
"def",
"create_extended_model",
"(",
"model",
",",
"db_penalty",
"=",
"None",
",",
"ex_penalty",
"=",
"None",
",",
"tp_penalty",
"=",
"None",
",",
"penalties",
"=",
"None",
")",
":",
"# Create metabolic model",
"model_extended",
"=",
"model",
".",
"create_metabo... | Create an extended model for gap-filling.
Create a :class:`psamm.metabolicmodel.MetabolicModel` with
all reactions added (the reaction database in the model is taken
to be the universal database) and also with artificial exchange
and transport reactions added. Return the extended
:class:`psamm.meta... | [
"Create",
"an",
"extended",
"model",
"for",
"gap",
"-",
"filling",
"."
] | dc427848c4f9d109ca590f0afa024c63b685b3f4 | https://github.com/zhanglab/psamm/blob/dc427848c4f9d109ca590f0afa024c63b685b3f4/psamm/gapfilling.py#L159-L231 |
48,363 | zhanglab/psamm | psamm/commands/formulacheck.py | FormulaBalanceCommand.run | def run(self):
"""Run formula balance command"""
# Create a set of excluded reactions
exclude = set(self._args.exclude)
count = 0
unbalanced = 0
unchecked = 0
for reaction, result in formula_balance(self._model):
count += 1
if reaction.id... | python | def run(self):
"""Run formula balance command"""
# Create a set of excluded reactions
exclude = set(self._args.exclude)
count = 0
unbalanced = 0
unchecked = 0
for reaction, result in formula_balance(self._model):
count += 1
if reaction.id... | [
"def",
"run",
"(",
"self",
")",
":",
"# Create a set of excluded reactions",
"exclude",
"=",
"set",
"(",
"self",
".",
"_args",
".",
"exclude",
")",
"count",
"=",
"0",
"unbalanced",
"=",
"0",
"unchecked",
"=",
"0",
"for",
"reaction",
",",
"result",
"in",
... | Run formula balance command | [
"Run",
"formula",
"balance",
"command"
] | dc427848c4f9d109ca590f0afa024c63b685b3f4 | https://github.com/zhanglab/psamm/blob/dc427848c4f9d109ca590f0afa024c63b685b3f4/psamm/commands/formulacheck.py#L44-L76 |
48,364 | zhanglab/psamm | psamm/database.py | ChainedDatabase._is_shadowed | def _is_shadowed(self, reaction_id, database):
"""Whether reaction in database is shadowed by another database"""
for other_database in self._databases:
if other_database == database:
break
if other_database.has_reaction(reaction_id):
return True
... | python | def _is_shadowed(self, reaction_id, database):
"""Whether reaction in database is shadowed by another database"""
for other_database in self._databases:
if other_database == database:
break
if other_database.has_reaction(reaction_id):
return True
... | [
"def",
"_is_shadowed",
"(",
"self",
",",
"reaction_id",
",",
"database",
")",
":",
"for",
"other_database",
"in",
"self",
".",
"_databases",
":",
"if",
"other_database",
"==",
"database",
":",
"break",
"if",
"other_database",
".",
"has_reaction",
"(",
"reactio... | Whether reaction in database is shadowed by another database | [
"Whether",
"reaction",
"in",
"database",
"is",
"shadowed",
"by",
"another",
"database"
] | dc427848c4f9d109ca590f0afa024c63b685b3f4 | https://github.com/zhanglab/psamm/blob/dc427848c4f9d109ca590f0afa024c63b685b3f4/psamm/database.py#L256-L263 |
48,365 | merll/docker-fabric | dockerfabric/apiclient.py | DockerFabricClient.push_log | def push_log(self, info, level=None, *args, **kwargs):
"""
Prints the log as usual for fabric output, enhanced with the prefix "docker".
:param info: Log output.
:type info: unicode
:param level: Logging level. Has no effect here.
:type level: int
"""
if ... | python | def push_log(self, info, level=None, *args, **kwargs):
"""
Prints the log as usual for fabric output, enhanced with the prefix "docker".
:param info: Log output.
:type info: unicode
:param level: Logging level. Has no effect here.
:type level: int
"""
if ... | [
"def",
"push_log",
"(",
"self",
",",
"info",
",",
"level",
"=",
"None",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"args",
":",
"msg",
"=",
"info",
"%",
"args",
"else",
":",
"msg",
"=",
"info",
"try",
":",
"puts",
"(",
"'docker:... | Prints the log as usual for fabric output, enhanced with the prefix "docker".
:param info: Log output.
:type info: unicode
:param level: Logging level. Has no effect here.
:type level: int | [
"Prints",
"the",
"log",
"as",
"usual",
"for",
"fabric",
"output",
"enhanced",
"with",
"the",
"prefix",
"docker",
"."
] | 785d84e40e17265b667d8b11a6e30d8e6b2bf8d4 | https://github.com/merll/docker-fabric/blob/785d84e40e17265b667d8b11a6e30d8e6b2bf8d4/dockerfabric/apiclient.py#L106-L122 |
48,366 | merll/docker-fabric | dockerfabric/apiclient.py | DockerFabricClient.push_progress | def push_progress(self, status, object_id, progress):
"""
Prints progress information.
:param status: Status text.
:type status: unicode
:param object_id: Object that the progress is reported on.
:type object_id: unicode
:param progress: Progress bar.
:ty... | python | def push_progress(self, status, object_id, progress):
"""
Prints progress information.
:param status: Status text.
:type status: unicode
:param object_id: Object that the progress is reported on.
:type object_id: unicode
:param progress: Progress bar.
:ty... | [
"def",
"push_progress",
"(",
"self",
",",
"status",
",",
"object_id",
",",
"progress",
")",
":",
"fastprint",
"(",
"progress_fmt",
"(",
"status",
",",
"object_id",
",",
"progress",
")",
",",
"end",
"=",
"'\\n'",
")"
] | Prints progress information.
:param status: Status text.
:type status: unicode
:param object_id: Object that the progress is reported on.
:type object_id: unicode
:param progress: Progress bar.
:type progress: unicode | [
"Prints",
"progress",
"information",
"."
] | 785d84e40e17265b667d8b11a6e30d8e6b2bf8d4 | https://github.com/merll/docker-fabric/blob/785d84e40e17265b667d8b11a6e30d8e6b2bf8d4/dockerfabric/apiclient.py#L124-L135 |
48,367 | merll/docker-fabric | dockerfabric/apiclient.py | DockerFabricClient.close | def close(self):
"""
Closes the connection and any tunnels created for it.
"""
try:
super(DockerFabricClient, self).close()
finally:
if self._tunnel is not None:
self._tunnel.close() | python | def close(self):
"""
Closes the connection and any tunnels created for it.
"""
try:
super(DockerFabricClient, self).close()
finally:
if self._tunnel is not None:
self._tunnel.close() | [
"def",
"close",
"(",
"self",
")",
":",
"try",
":",
"super",
"(",
"DockerFabricClient",
",",
"self",
")",
".",
"close",
"(",
")",
"finally",
":",
"if",
"self",
".",
"_tunnel",
"is",
"not",
"None",
":",
"self",
".",
"_tunnel",
".",
"close",
"(",
")"
... | Closes the connection and any tunnels created for it. | [
"Closes",
"the",
"connection",
"and",
"any",
"tunnels",
"created",
"for",
"it",
"."
] | 785d84e40e17265b667d8b11a6e30d8e6b2bf8d4 | https://github.com/merll/docker-fabric/blob/785d84e40e17265b667d8b11a6e30d8e6b2bf8d4/dockerfabric/apiclient.py#L137-L145 |
48,368 | zhanglab/psamm | psamm/lpsolver/lp.py | ranged_property | def ranged_property(min=None, max=None):
"""Decorator for creating ranged property with fixed bounds."""
min_value = -_INF if min is None else min
max_value = _INF if max is None else max
return lambda fget: RangedProperty(
fget, fmin=lambda obj: min_value, fmax=lambda obj: max_value) | python | def ranged_property(min=None, max=None):
"""Decorator for creating ranged property with fixed bounds."""
min_value = -_INF if min is None else min
max_value = _INF if max is None else max
return lambda fget: RangedProperty(
fget, fmin=lambda obj: min_value, fmax=lambda obj: max_value) | [
"def",
"ranged_property",
"(",
"min",
"=",
"None",
",",
"max",
"=",
"None",
")",
":",
"min_value",
"=",
"-",
"_INF",
"if",
"min",
"is",
"None",
"else",
"min",
"max_value",
"=",
"_INF",
"if",
"max",
"is",
"None",
"else",
"max",
"return",
"lambda",
"fg... | Decorator for creating ranged property with fixed bounds. | [
"Decorator",
"for",
"creating",
"ranged",
"property",
"with",
"fixed",
"bounds",
"."
] | dc427848c4f9d109ca590f0afa024c63b685b3f4 | https://github.com/zhanglab/psamm/blob/dc427848c4f9d109ca590f0afa024c63b685b3f4/psamm/lpsolver/lp.py#L145-L150 |
48,369 | zhanglab/psamm | psamm/lpsolver/lp.py | _RangedAccessor.value | def value(self):
"""Value of property."""
if self._prop.fget is None:
raise AttributeError('Unable to read attribute')
return self._prop.fget(self._obj) | python | def value(self):
"""Value of property."""
if self._prop.fget is None:
raise AttributeError('Unable to read attribute')
return self._prop.fget(self._obj) | [
"def",
"value",
"(",
"self",
")",
":",
"if",
"self",
".",
"_prop",
".",
"fget",
"is",
"None",
":",
"raise",
"AttributeError",
"(",
"'Unable to read attribute'",
")",
"return",
"self",
".",
"_prop",
".",
"fget",
"(",
"self",
".",
"_obj",
")"
] | Value of property. | [
"Value",
"of",
"property",
"."
] | dc427848c4f9d109ca590f0afa024c63b685b3f4 | https://github.com/zhanglab/psamm/blob/dc427848c4f9d109ca590f0afa024c63b685b3f4/psamm/lpsolver/lp.py#L69-L73 |
48,370 | zhanglab/psamm | psamm/lpsolver/lp.py | _RangedAccessor.min | def min(self):
"""Minimum value."""
if self._prop.fmin is None:
return -_INF
return self._prop.fmin(self._obj) | python | def min(self):
"""Minimum value."""
if self._prop.fmin is None:
return -_INF
return self._prop.fmin(self._obj) | [
"def",
"min",
"(",
"self",
")",
":",
"if",
"self",
".",
"_prop",
".",
"fmin",
"is",
"None",
":",
"return",
"-",
"_INF",
"return",
"self",
".",
"_prop",
".",
"fmin",
"(",
"self",
".",
"_obj",
")"
] | Minimum value. | [
"Minimum",
"value",
"."
] | dc427848c4f9d109ca590f0afa024c63b685b3f4 | https://github.com/zhanglab/psamm/blob/dc427848c4f9d109ca590f0afa024c63b685b3f4/psamm/lpsolver/lp.py#L88-L92 |
48,371 | zhanglab/psamm | psamm/lpsolver/lp.py | _RangedAccessor.max | def max(self):
"""Maximum value."""
if self._prop.fmax is None:
return _INF
return self._prop.fmax(self._obj) | python | def max(self):
"""Maximum value."""
if self._prop.fmax is None:
return _INF
return self._prop.fmax(self._obj) | [
"def",
"max",
"(",
"self",
")",
":",
"if",
"self",
".",
"_prop",
".",
"fmax",
"is",
"None",
":",
"return",
"_INF",
"return",
"self",
".",
"_prop",
".",
"fmax",
"(",
"self",
".",
"_obj",
")"
] | Maximum value. | [
"Maximum",
"value",
"."
] | dc427848c4f9d109ca590f0afa024c63b685b3f4 | https://github.com/zhanglab/psamm/blob/dc427848c4f9d109ca590f0afa024c63b685b3f4/psamm/lpsolver/lp.py#L95-L99 |
48,372 | zhanglab/psamm | psamm/lpsolver/lp.py | VariableNamespace.define | def define(self, names, **kwargs):
"""Define variables within the namespace.
This is similar to :meth:`.Problem.define` except that names must be
given as an iterable. This method accepts the same keyword arguments
as :meth:`.Problem.define`.
"""
define_kwargs = dict(sel... | python | def define(self, names, **kwargs):
"""Define variables within the namespace.
This is similar to :meth:`.Problem.define` except that names must be
given as an iterable. This method accepts the same keyword arguments
as :meth:`.Problem.define`.
"""
define_kwargs = dict(sel... | [
"def",
"define",
"(",
"self",
",",
"names",
",",
"*",
"*",
"kwargs",
")",
":",
"define_kwargs",
"=",
"dict",
"(",
"self",
".",
"_define_kwargs",
")",
"define_kwargs",
".",
"update",
"(",
"kwargs",
")",
"self",
".",
"_problem",
".",
"define",
"(",
"*",
... | Define variables within the namespace.
This is similar to :meth:`.Problem.define` except that names must be
given as an iterable. This method accepts the same keyword arguments
as :meth:`.Problem.define`. | [
"Define",
"variables",
"within",
"the",
"namespace",
"."
] | dc427848c4f9d109ca590f0afa024c63b685b3f4 | https://github.com/zhanglab/psamm/blob/dc427848c4f9d109ca590f0afa024c63b685b3f4/psamm/lpsolver/lp.py#L581-L591 |
48,373 | zhanglab/psamm | psamm/lpsolver/lp.py | VariableNamespace.set | def set(self, names):
"""Return a variable set of the given names in the namespace.
>>> v = prob.namespace(name='v')
>>> v.define([1, 2, 5], lower=0, upper=10)
>>> prob.add_linear_constraints(v.set([1, 2]) >= 4)
"""
return self._problem.set((self, name) for name in names... | python | def set(self, names):
"""Return a variable set of the given names in the namespace.
>>> v = prob.namespace(name='v')
>>> v.define([1, 2, 5], lower=0, upper=10)
>>> prob.add_linear_constraints(v.set([1, 2]) >= 4)
"""
return self._problem.set((self, name) for name in names... | [
"def",
"set",
"(",
"self",
",",
"names",
")",
":",
"return",
"self",
".",
"_problem",
".",
"set",
"(",
"(",
"self",
",",
"name",
")",
"for",
"name",
"in",
"names",
")"
] | Return a variable set of the given names in the namespace.
>>> v = prob.namespace(name='v')
>>> v.define([1, 2, 5], lower=0, upper=10)
>>> prob.add_linear_constraints(v.set([1, 2]) >= 4) | [
"Return",
"a",
"variable",
"set",
"of",
"the",
"given",
"names",
"in",
"the",
"namespace",
"."
] | dc427848c4f9d109ca590f0afa024c63b685b3f4 | https://github.com/zhanglab/psamm/blob/dc427848c4f9d109ca590f0afa024c63b685b3f4/psamm/lpsolver/lp.py#L605-L612 |
48,374 | zhanglab/psamm | psamm/lpsolver/lp.py | VariableNamespace.expr | def expr(self, items):
"""Return the sum of each name multiplied by a coefficient.
>>> v = prob.namespace(name='v')
>>> v.define(['a', 'b', 'c'], lower=0, upper=10)
>>> prob.set_objective(v.expr([('a', 2), ('b', 1)]))
"""
return Expression({(self, name): value for name, ... | python | def expr(self, items):
"""Return the sum of each name multiplied by a coefficient.
>>> v = prob.namespace(name='v')
>>> v.define(['a', 'b', 'c'], lower=0, upper=10)
>>> prob.set_objective(v.expr([('a', 2), ('b', 1)]))
"""
return Expression({(self, name): value for name, ... | [
"def",
"expr",
"(",
"self",
",",
"items",
")",
":",
"return",
"Expression",
"(",
"{",
"(",
"self",
",",
"name",
")",
":",
"value",
"for",
"name",
",",
"value",
"in",
"items",
"}",
")"
] | Return the sum of each name multiplied by a coefficient.
>>> v = prob.namespace(name='v')
>>> v.define(['a', 'b', 'c'], lower=0, upper=10)
>>> prob.set_objective(v.expr([('a', 2), ('b', 1)])) | [
"Return",
"the",
"sum",
"of",
"each",
"name",
"multiplied",
"by",
"a",
"coefficient",
"."
] | dc427848c4f9d109ca590f0afa024c63b685b3f4 | https://github.com/zhanglab/psamm/blob/dc427848c4f9d109ca590f0afa024c63b685b3f4/psamm/lpsolver/lp.py#L623-L630 |
48,375 | zhanglab/psamm | psamm/lpsolver/lp.py | Result.get_value | def get_value(self, expression):
"""Get value of variable or expression in result
Expression can be an object defined as a name in the problem, in which
case the corresponding value is simply returned. If expression is an
actual :class:`.Expression` object, it will be evaluated using th... | python | def get_value(self, expression):
"""Get value of variable or expression in result
Expression can be an object defined as a name in the problem, in which
case the corresponding value is simply returned. If expression is an
actual :class:`.Expression` object, it will be evaluated using th... | [
"def",
"get_value",
"(",
"self",
",",
"expression",
")",
":",
"if",
"isinstance",
"(",
"expression",
",",
"Expression",
")",
":",
"return",
"self",
".",
"_evaluate_expression",
"(",
"expression",
")",
"elif",
"not",
"self",
".",
"_has_variable",
"(",
"expres... | Get value of variable or expression in result
Expression can be an object defined as a name in the problem, in which
case the corresponding value is simply returned. If expression is an
actual :class:`.Expression` object, it will be evaluated using the
values from the result. | [
"Get",
"value",
"of",
"variable",
"or",
"expression",
"in",
"result"
] | dc427848c4f9d109ca590f0afa024c63b685b3f4 | https://github.com/zhanglab/psamm/blob/dc427848c4f9d109ca590f0afa024c63b685b3f4/psamm/lpsolver/lp.py#L881-L894 |
48,376 | zhanglab/psamm | psamm/lpsolver/gurobi.py | Problem.set_objective | def set_objective(self, expression):
"""Set linear objective of problem."""
if isinstance(expression, numbers.Number):
# Allow expressions with no variables as objective,
# represented as a number
expression = Expression()
self._p.setObjective(
s... | python | def set_objective(self, expression):
"""Set linear objective of problem."""
if isinstance(expression, numbers.Number):
# Allow expressions with no variables as objective,
# represented as a number
expression = Expression()
self._p.setObjective(
s... | [
"def",
"set_objective",
"(",
"self",
",",
"expression",
")",
":",
"if",
"isinstance",
"(",
"expression",
",",
"numbers",
".",
"Number",
")",
":",
"# Allow expressions with no variables as objective,",
"# represented as a number",
"expression",
"=",
"Expression",
"(",
... | Set linear objective of problem. | [
"Set",
"linear",
"objective",
"of",
"problem",
"."
] | dc427848c4f9d109ca590f0afa024c63b685b3f4 | https://github.com/zhanglab/psamm/blob/dc427848c4f9d109ca590f0afa024c63b685b3f4/psamm/lpsolver/gurobi.py#L217-L226 |
48,377 | zhanglab/psamm | psamm/commands/console.py | ConsoleCommand.open_python | def open_python(self, message, namespace):
"""Open interactive python console"""
# Importing readline will in some cases print weird escape
# characters to stdout. To avoid this we only import readline
# and related packages at this point when we are certain
# they are needed.
... | python | def open_python(self, message, namespace):
"""Open interactive python console"""
# Importing readline will in some cases print weird escape
# characters to stdout. To avoid this we only import readline
# and related packages at this point when we are certain
# they are needed.
... | [
"def",
"open_python",
"(",
"self",
",",
"message",
",",
"namespace",
")",
":",
"# Importing readline will in some cases print weird escape",
"# characters to stdout. To avoid this we only import readline",
"# and related packages at this point when we are certain",
"# they are needed.",
... | Open interactive python console | [
"Open",
"interactive",
"python",
"console"
] | dc427848c4f9d109ca590f0afa024c63b685b3f4 | https://github.com/zhanglab/psamm/blob/dc427848c4f9d109ca590f0afa024c63b685b3f4/psamm/commands/console.py#L32-L46 |
48,378 | zhanglab/psamm | psamm/commands/duplicatescheck.py | DuplicatesCheck.run | def run(self):
"""Run check for duplicates"""
# Create dictonary of signatures
database_signatures = {}
for entry in self._model.reactions:
signature = reaction_signature(
entry.equation, direction=self._args.compare_direction,
stoichiometry=s... | python | def run(self):
"""Run check for duplicates"""
# Create dictonary of signatures
database_signatures = {}
for entry in self._model.reactions:
signature = reaction_signature(
entry.equation, direction=self._args.compare_direction,
stoichiometry=s... | [
"def",
"run",
"(",
"self",
")",
":",
"# Create dictonary of signatures",
"database_signatures",
"=",
"{",
"}",
"for",
"entry",
"in",
"self",
".",
"_model",
".",
"reactions",
":",
"signature",
"=",
"reaction_signature",
"(",
"entry",
".",
"equation",
",",
"dire... | Run check for duplicates | [
"Run",
"check",
"for",
"duplicates"
] | dc427848c4f9d109ca590f0afa024c63b685b3f4 | https://github.com/zhanglab/psamm/blob/dc427848c4f9d109ca590f0afa024c63b685b3f4/psamm/commands/duplicatescheck.py#L78-L98 |
48,379 | zhanglab/psamm | psamm/balancecheck.py | reaction_charge | def reaction_charge(reaction, compound_charge):
"""Calculate the overall charge for the specified reaction.
Args:
reaction: :class:`psamm.reaction.Reaction`.
compound_charge: a map from each compound to charge values.
"""
charge_sum = 0.0
for compound, value in reaction.compounds:
... | python | def reaction_charge(reaction, compound_charge):
"""Calculate the overall charge for the specified reaction.
Args:
reaction: :class:`psamm.reaction.Reaction`.
compound_charge: a map from each compound to charge values.
"""
charge_sum = 0.0
for compound, value in reaction.compounds:
... | [
"def",
"reaction_charge",
"(",
"reaction",
",",
"compound_charge",
")",
":",
"charge_sum",
"=",
"0.0",
"for",
"compound",
",",
"value",
"in",
"reaction",
".",
"compounds",
":",
"charge",
"=",
"compound_charge",
".",
"get",
"(",
"compound",
".",
"name",
",",
... | Calculate the overall charge for the specified reaction.
Args:
reaction: :class:`psamm.reaction.Reaction`.
compound_charge: a map from each compound to charge values. | [
"Calculate",
"the",
"overall",
"charge",
"for",
"the",
"specified",
"reaction",
"."
] | dc427848c4f9d109ca590f0afa024c63b685b3f4 | https://github.com/zhanglab/psamm/blob/dc427848c4f9d109ca590f0afa024c63b685b3f4/psamm/balancecheck.py#L31-L43 |
48,380 | zhanglab/psamm | psamm/balancecheck.py | charge_balance | def charge_balance(model):
"""Calculate the overall charge for all reactions in the model.
Yield (reaction, charge) pairs.
Args:
model: :class:`psamm.datasource.native.NativeModel`.
"""
compound_charge = {}
for compound in model.compounds:
if compound.charge is not None:
... | python | def charge_balance(model):
"""Calculate the overall charge for all reactions in the model.
Yield (reaction, charge) pairs.
Args:
model: :class:`psamm.datasource.native.NativeModel`.
"""
compound_charge = {}
for compound in model.compounds:
if compound.charge is not None:
... | [
"def",
"charge_balance",
"(",
"model",
")",
":",
"compound_charge",
"=",
"{",
"}",
"for",
"compound",
"in",
"model",
".",
"compounds",
":",
"if",
"compound",
".",
"charge",
"is",
"not",
"None",
":",
"compound_charge",
"[",
"compound",
".",
"id",
"]",
"="... | Calculate the overall charge for all reactions in the model.
Yield (reaction, charge) pairs.
Args:
model: :class:`psamm.datasource.native.NativeModel`. | [
"Calculate",
"the",
"overall",
"charge",
"for",
"all",
"reactions",
"in",
"the",
"model",
"."
] | dc427848c4f9d109ca590f0afa024c63b685b3f4 | https://github.com/zhanglab/psamm/blob/dc427848c4f9d109ca590f0afa024c63b685b3f4/psamm/balancecheck.py#L46-L62 |
48,381 | zhanglab/psamm | psamm/balancecheck.py | reaction_formula | def reaction_formula(reaction, compound_formula):
"""Calculate formula compositions for both sides of the specified reaction.
If the compounds in the reaction all have formula, then calculate and
return the chemical compositions for both sides, otherwise return `None`.
Args:
reaction: :class:`... | python | def reaction_formula(reaction, compound_formula):
"""Calculate formula compositions for both sides of the specified reaction.
If the compounds in the reaction all have formula, then calculate and
return the chemical compositions for both sides, otherwise return `None`.
Args:
reaction: :class:`... | [
"def",
"reaction_formula",
"(",
"reaction",
",",
"compound_formula",
")",
":",
"def",
"multiply_formula",
"(",
"compound_list",
")",
":",
"for",
"compound",
",",
"count",
"in",
"compound_list",
":",
"yield",
"count",
"*",
"compound_formula",
"[",
"compound",
"."... | Calculate formula compositions for both sides of the specified reaction.
If the compounds in the reaction all have formula, then calculate and
return the chemical compositions for both sides, otherwise return `None`.
Args:
reaction: :class:`psamm.reaction.Reaction`.
compound_formula: a map... | [
"Calculate",
"formula",
"compositions",
"for",
"both",
"sides",
"of",
"the",
"specified",
"reaction",
"."
] | dc427848c4f9d109ca590f0afa024c63b685b3f4 | https://github.com/zhanglab/psamm/blob/dc427848c4f9d109ca590f0afa024c63b685b3f4/psamm/balancecheck.py#L65-L88 |
48,382 | zhanglab/psamm | psamm/balancecheck.py | formula_balance | def formula_balance(model):
"""Calculate formula compositions for each reaction.
Call :func:`reaction_formula` for each reaction.
Yield (reaction, result) pairs, where result has two formula compositions
or `None`.
Args:
model: :class:`psamm.datasource.native.NativeModel`.
"""
# M... | python | def formula_balance(model):
"""Calculate formula compositions for each reaction.
Call :func:`reaction_formula` for each reaction.
Yield (reaction, result) pairs, where result has two formula compositions
or `None`.
Args:
model: :class:`psamm.datasource.native.NativeModel`.
"""
# M... | [
"def",
"formula_balance",
"(",
"model",
")",
":",
"# Mapping from compound id to formula",
"compound_formula",
"=",
"{",
"}",
"for",
"compound",
"in",
"model",
".",
"compounds",
":",
"if",
"compound",
".",
"formula",
"is",
"not",
"None",
":",
"try",
":",
"f",
... | Calculate formula compositions for each reaction.
Call :func:`reaction_formula` for each reaction.
Yield (reaction, result) pairs, where result has two formula compositions
or `None`.
Args:
model: :class:`psamm.datasource.native.NativeModel`. | [
"Calculate",
"formula",
"compositions",
"for",
"each",
"reaction",
"."
] | dc427848c4f9d109ca590f0afa024c63b685b3f4 | https://github.com/zhanglab/psamm/blob/dc427848c4f9d109ca590f0afa024c63b685b3f4/psamm/balancecheck.py#L91-L117 |
48,383 | zhanglab/psamm | psamm/commands/fluxcheck.py | FluxConsistencyCommand.run | def run(self):
"""Run flux consistency check command"""
# Load compound information
def compound_name(id):
if id not in self._model.compounds:
return id
return self._model.compounds[id].properties.get('name', id)
epsilon = self._args.epsilon
... | python | def run(self):
"""Run flux consistency check command"""
# Load compound information
def compound_name(id):
if id not in self._model.compounds:
return id
return self._model.compounds[id].properties.get('name', id)
epsilon = self._args.epsilon
... | [
"def",
"run",
"(",
"self",
")",
":",
"# Load compound information",
"def",
"compound_name",
"(",
"id",
")",
":",
"if",
"id",
"not",
"in",
"self",
".",
"_model",
".",
"compounds",
":",
"return",
"id",
"return",
"self",
".",
"_model",
".",
"compounds",
"["... | Run flux consistency check command | [
"Run",
"flux",
"consistency",
"check",
"command"
] | dc427848c4f9d109ca590f0afa024c63b685b3f4 | https://github.com/zhanglab/psamm/blob/dc427848c4f9d109ca590f0afa024c63b685b3f4/psamm/commands/fluxcheck.py#L62-L157 |
48,384 | zhanglab/psamm | psamm/commands/chargecheck.py | ChargeBalanceCommand.run | def run(self):
"""Run charge balance command"""
# Load compound information
def compound_name(id):
if id not in self._model.compounds:
return id
return self._model.compounds[id].properties.get('name', id)
# Create a set of excluded reactions
... | python | def run(self):
"""Run charge balance command"""
# Load compound information
def compound_name(id):
if id not in self._model.compounds:
return id
return self._model.compounds[id].properties.get('name', id)
# Create a set of excluded reactions
... | [
"def",
"run",
"(",
"self",
")",
":",
"# Load compound information",
"def",
"compound_name",
"(",
"id",
")",
":",
"if",
"id",
"not",
"in",
"self",
".",
"_model",
".",
"compounds",
":",
"return",
"id",
"return",
"self",
".",
"_model",
".",
"compounds",
"["... | Run charge balance command | [
"Run",
"charge",
"balance",
"command"
] | dc427848c4f9d109ca590f0afa024c63b685b3f4 | https://github.com/zhanglab/psamm/blob/dc427848c4f9d109ca590f0afa024c63b685b3f4/psamm/commands/chargecheck.py#L48-L81 |
48,385 | hearsaycorp/normalize | normalize/property/meta.py | create_property_type_from_traits | def create_property_type_from_traits(trait_set):
"""Takes an iterable of trait names, and tries to compose a property type
from that. Raises an exception if this is not possible. Extra traits not
requested are not acceptable.
If this automatic generation doesn't work for you for some reason, then
... | python | def create_property_type_from_traits(trait_set):
"""Takes an iterable of trait names, and tries to compose a property type
from that. Raises an exception if this is not possible. Extra traits not
requested are not acceptable.
If this automatic generation doesn't work for you for some reason, then
... | [
"def",
"create_property_type_from_traits",
"(",
"trait_set",
")",
":",
"wanted_traits",
"=",
"set",
"(",
"trait_set",
")",
"stock_types",
"=",
"dict",
"(",
"(",
"k",
",",
"v",
")",
"for",
"k",
",",
"v",
"in",
"PROPERTY_TYPES",
".",
"items",
"(",
")",
"if... | Takes an iterable of trait names, and tries to compose a property type
from that. Raises an exception if this is not possible. Extra traits not
requested are not acceptable.
If this automatic generation doesn't work for you for some reason, then
compose your property types manually.
The details ... | [
"Takes",
"an",
"iterable",
"of",
"trait",
"names",
"and",
"tries",
"to",
"compose",
"a",
"property",
"type",
"from",
"that",
".",
"Raises",
"an",
"exception",
"if",
"this",
"is",
"not",
"possible",
".",
"Extra",
"traits",
"not",
"requested",
"are",
"not",
... | 8b36522ddca6d41b434580bd848f3bdaa7a999c8 | https://github.com/hearsaycorp/normalize/blob/8b36522ddca6d41b434580bd848f3bdaa7a999c8/normalize/property/meta.py#L131-L216 |
48,386 | zhanglab/psamm | psamm/importers/sbml.py | BaseImporter._resolve_source | def _resolve_source(self, source):
"""Resolve source to filepath if it is a directory."""
if os.path.isdir(source):
sources = glob.glob(os.path.join(source, '*.sbml'))
if len(sources) == 0:
raise ModelLoadError('No .sbml file found in source directory')
... | python | def _resolve_source(self, source):
"""Resolve source to filepath if it is a directory."""
if os.path.isdir(source):
sources = glob.glob(os.path.join(source, '*.sbml'))
if len(sources) == 0:
raise ModelLoadError('No .sbml file found in source directory')
... | [
"def",
"_resolve_source",
"(",
"self",
",",
"source",
")",
":",
"if",
"os",
".",
"path",
".",
"isdir",
"(",
"source",
")",
":",
"sources",
"=",
"glob",
".",
"glob",
"(",
"os",
".",
"path",
".",
"join",
"(",
"source",
",",
"'*.sbml'",
")",
")",
"i... | Resolve source to filepath if it is a directory. | [
"Resolve",
"source",
"to",
"filepath",
"if",
"it",
"is",
"a",
"directory",
"."
] | dc427848c4f9d109ca590f0afa024c63b685b3f4 | https://github.com/zhanglab/psamm/blob/dc427848c4f9d109ca590f0afa024c63b685b3f4/psamm/importers/sbml.py#L44-L54 |
48,387 | zhanglab/psamm | psamm/reaction.py | Direction.flipped | def flipped(self):
"""Return the flipped version of this direction."""
forward, reverse = self.value
return self.__class__((reverse, forward)) | python | def flipped(self):
"""Return the flipped version of this direction."""
forward, reverse = self.value
return self.__class__((reverse, forward)) | [
"def",
"flipped",
"(",
"self",
")",
":",
"forward",
",",
"reverse",
"=",
"self",
".",
"value",
"return",
"self",
".",
"__class__",
"(",
"(",
"reverse",
",",
"forward",
")",
")"
] | Return the flipped version of this direction. | [
"Return",
"the",
"flipped",
"version",
"of",
"this",
"direction",
"."
] | dc427848c4f9d109ca590f0afa024c63b685b3f4 | https://github.com/zhanglab/psamm/blob/dc427848c4f9d109ca590f0afa024c63b685b3f4/psamm/reaction.py#L156-L159 |
48,388 | zhanglab/psamm | psamm/commands/fva.py | FluxVariabilityCommand.run | def run(self):
"""Run flux variability command"""
# Load compound information
def compound_name(id):
if id not in self._model.compounds:
return id
return self._model.compounds[id].properties.get('name', id)
reaction = self._get_objective()
... | python | def run(self):
"""Run flux variability command"""
# Load compound information
def compound_name(id):
if id not in self._model.compounds:
return id
return self._model.compounds[id].properties.get('name', id)
reaction = self._get_objective()
... | [
"def",
"run",
"(",
"self",
")",
":",
"# Load compound information",
"def",
"compound_name",
"(",
"id",
")",
":",
"if",
"id",
"not",
"in",
"self",
".",
"_model",
".",
"compounds",
":",
"return",
"id",
"return",
"self",
".",
"_model",
".",
"compounds",
"["... | Run flux variability command | [
"Run",
"flux",
"variability",
"command"
] | dc427848c4f9d109ca590f0afa024c63b685b3f4 | https://github.com/zhanglab/psamm/blob/dc427848c4f9d109ca590f0afa024c63b685b3f4/psamm/commands/fva.py#L46-L112 |
48,389 | hearsaycorp/normalize | normalize/empty.py | placeholder | def placeholder(type_):
"""Returns the EmptyVal instance for the given type"""
typetuple = type_ if isinstance(type_, tuple) else (type_,)
if any in typetuple:
typetuple = any
if typetuple not in EMPTY_VALS:
EMPTY_VALS[typetuple] = EmptyVal(typetuple)
return EMPTY_VALS[typetuple] | python | def placeholder(type_):
"""Returns the EmptyVal instance for the given type"""
typetuple = type_ if isinstance(type_, tuple) else (type_,)
if any in typetuple:
typetuple = any
if typetuple not in EMPTY_VALS:
EMPTY_VALS[typetuple] = EmptyVal(typetuple)
return EMPTY_VALS[typetuple] | [
"def",
"placeholder",
"(",
"type_",
")",
":",
"typetuple",
"=",
"type_",
"if",
"isinstance",
"(",
"type_",
",",
"tuple",
")",
"else",
"(",
"type_",
",",
")",
"if",
"any",
"in",
"typetuple",
":",
"typetuple",
"=",
"any",
"if",
"typetuple",
"not",
"in",
... | Returns the EmptyVal instance for the given type | [
"Returns",
"the",
"EmptyVal",
"instance",
"for",
"the",
"given",
"type"
] | 8b36522ddca6d41b434580bd848f3bdaa7a999c8 | https://github.com/hearsaycorp/normalize/blob/8b36522ddca6d41b434580bd848f3bdaa7a999c8/normalize/empty.py#L8-L15 |
48,390 | hearsaycorp/normalize | normalize/empty.py | itertypes | def itertypes(iterable):
"""Iterates over an iterable containing either type objects or tuples of
type objects and yields once for every type object found."""
seen = set()
for entry in iterable:
if isinstance(entry, tuple):
for type_ in entry:
if type_ not in seen:
... | python | def itertypes(iterable):
"""Iterates over an iterable containing either type objects or tuples of
type objects and yields once for every type object found."""
seen = set()
for entry in iterable:
if isinstance(entry, tuple):
for type_ in entry:
if type_ not in seen:
... | [
"def",
"itertypes",
"(",
"iterable",
")",
":",
"seen",
"=",
"set",
"(",
")",
"for",
"entry",
"in",
"iterable",
":",
"if",
"isinstance",
"(",
"entry",
",",
"tuple",
")",
":",
"for",
"type_",
"in",
"entry",
":",
"if",
"type_",
"not",
"in",
"seen",
":... | Iterates over an iterable containing either type objects or tuples of
type objects and yields once for every type object found. | [
"Iterates",
"over",
"an",
"iterable",
"containing",
"either",
"type",
"objects",
"or",
"tuples",
"of",
"type",
"objects",
"and",
"yields",
"once",
"for",
"every",
"type",
"object",
"found",
"."
] | 8b36522ddca6d41b434580bd848f3bdaa7a999c8 | https://github.com/hearsaycorp/normalize/blob/8b36522ddca6d41b434580bd848f3bdaa7a999c8/normalize/empty.py#L18-L31 |
48,391 | merll/docker-fabric | dockerfabric/utils/files.py | remove_ignore | def remove_ignore(path, use_sudo=False, force=False):
"""
Recursively removes a file or directory, ignoring any errors that may occur. Should only be used for temporary
files that can be assumed to be cleaned up at a later point.
:param path: Path to file or directory to remove.
:type path: unicode... | python | def remove_ignore(path, use_sudo=False, force=False):
"""
Recursively removes a file or directory, ignoring any errors that may occur. Should only be used for temporary
files that can be assumed to be cleaned up at a later point.
:param path: Path to file or directory to remove.
:type path: unicode... | [
"def",
"remove_ignore",
"(",
"path",
",",
"use_sudo",
"=",
"False",
",",
"force",
"=",
"False",
")",
":",
"which",
"=",
"sudo",
"if",
"use_sudo",
"else",
"run",
"which",
"(",
"rm",
"(",
"path",
",",
"recursive",
"=",
"True",
",",
"force",
"=",
"force... | Recursively removes a file or directory, ignoring any errors that may occur. Should only be used for temporary
files that can be assumed to be cleaned up at a later point.
:param path: Path to file or directory to remove.
:type path: unicode
:param use_sudo: Use the `sudo` command.
:type use_sudo: ... | [
"Recursively",
"removes",
"a",
"file",
"or",
"directory",
"ignoring",
"any",
"errors",
"that",
"may",
"occur",
".",
"Should",
"only",
"be",
"used",
"for",
"temporary",
"files",
"that",
"can",
"be",
"assumed",
"to",
"be",
"cleaned",
"up",
"at",
"a",
"later"... | 785d84e40e17265b667d8b11a6e30d8e6b2bf8d4 | https://github.com/merll/docker-fabric/blob/785d84e40e17265b667d8b11a6e30d8e6b2bf8d4/dockerfabric/utils/files.py#L29-L42 |
48,392 | merll/docker-fabric | dockerfabric/utils/files.py | is_directory | def is_directory(path, use_sudo=False):
"""
Check if the remote path exists and is a directory.
:param path: Remote path to check.
:type path: unicode
:param use_sudo: Use the `sudo` command.
:type use_sudo: bool
:return: `True` if the path exists and is a directory; `False` if it exists, b... | python | def is_directory(path, use_sudo=False):
"""
Check if the remote path exists and is a directory.
:param path: Remote path to check.
:type path: unicode
:param use_sudo: Use the `sudo` command.
:type use_sudo: bool
:return: `True` if the path exists and is a directory; `False` if it exists, b... | [
"def",
"is_directory",
"(",
"path",
",",
"use_sudo",
"=",
"False",
")",
":",
"result",
"=",
"single_line_stdout",
"(",
"'if [[ -f {0} ]]; then echo 0; elif [[ -d {0} ]]; then echo 1; else echo -1; fi'",
".",
"format",
"(",
"path",
")",
",",
"sudo",
"=",
"use_sudo",
",... | Check if the remote path exists and is a directory.
:param path: Remote path to check.
:type path: unicode
:param use_sudo: Use the `sudo` command.
:type use_sudo: bool
:return: `True` if the path exists and is a directory; `False` if it exists, but is a file; `None` if it does not
exist.
... | [
"Check",
"if",
"the",
"remote",
"path",
"exists",
"and",
"is",
"a",
"directory",
"."
] | 785d84e40e17265b667d8b11a6e30d8e6b2bf8d4 | https://github.com/merll/docker-fabric/blob/785d84e40e17265b667d8b11a6e30d8e6b2bf8d4/dockerfabric/utils/files.py#L45-L63 |
48,393 | merll/docker-fabric | dockerfabric/utils/files.py | temp_dir | def temp_dir(apply_chown=None, apply_chmod=None, remove_using_sudo=None, remove_force=False):
"""
Creates a temporary directory on the remote machine. The directory is removed when no longer needed. Failure to do
so will be ignored.
:param apply_chown: Optional; change the owner of the directory.
:... | python | def temp_dir(apply_chown=None, apply_chmod=None, remove_using_sudo=None, remove_force=False):
"""
Creates a temporary directory on the remote machine. The directory is removed when no longer needed. Failure to do
so will be ignored.
:param apply_chown: Optional; change the owner of the directory.
:... | [
"def",
"temp_dir",
"(",
"apply_chown",
"=",
"None",
",",
"apply_chmod",
"=",
"None",
",",
"remove_using_sudo",
"=",
"None",
",",
"remove_force",
"=",
"False",
")",
":",
"path",
"=",
"get_remote_temp",
"(",
")",
"try",
":",
"if",
"apply_chmod",
":",
"run",
... | Creates a temporary directory on the remote machine. The directory is removed when no longer needed. Failure to do
so will be ignored.
:param apply_chown: Optional; change the owner of the directory.
:type apply_chown: unicode
:param apply_chmod: Optional; change the permissions of the directory.
:... | [
"Creates",
"a",
"temporary",
"directory",
"on",
"the",
"remote",
"machine",
".",
"The",
"directory",
"is",
"removed",
"when",
"no",
"longer",
"needed",
".",
"Failure",
"to",
"do",
"so",
"will",
"be",
"ignored",
"."
] | 785d84e40e17265b667d8b11a6e30d8e6b2bf8d4 | https://github.com/merll/docker-fabric/blob/785d84e40e17265b667d8b11a6e30d8e6b2bf8d4/dockerfabric/utils/files.py#L67-L94 |
48,394 | merll/docker-fabric | dockerfabric/utils/files.py | local_temp_dir | def local_temp_dir():
"""
Creates a local temporary directory. The directory is removed when no longer needed. Failure to do
so will be ignored.
:return: Path to the temporary directory.
:rtype: unicode
"""
path = tempfile.mkdtemp()
yield path
shutil.rmtree(path, ignore_errors=True) | python | def local_temp_dir():
"""
Creates a local temporary directory. The directory is removed when no longer needed. Failure to do
so will be ignored.
:return: Path to the temporary directory.
:rtype: unicode
"""
path = tempfile.mkdtemp()
yield path
shutil.rmtree(path, ignore_errors=True) | [
"def",
"local_temp_dir",
"(",
")",
":",
"path",
"=",
"tempfile",
".",
"mkdtemp",
"(",
")",
"yield",
"path",
"shutil",
".",
"rmtree",
"(",
"path",
",",
"ignore_errors",
"=",
"True",
")"
] | Creates a local temporary directory. The directory is removed when no longer needed. Failure to do
so will be ignored.
:return: Path to the temporary directory.
:rtype: unicode | [
"Creates",
"a",
"local",
"temporary",
"directory",
".",
"The",
"directory",
"is",
"removed",
"when",
"no",
"longer",
"needed",
".",
"Failure",
"to",
"do",
"so",
"will",
"be",
"ignored",
"."
] | 785d84e40e17265b667d8b11a6e30d8e6b2bf8d4 | https://github.com/merll/docker-fabric/blob/785d84e40e17265b667d8b11a6e30d8e6b2bf8d4/dockerfabric/utils/files.py#L98-L108 |
48,395 | inveniosoftware/invenio-rest | invenio_rest/errors.py | SameContentException.get_response | def get_response(self, environ=None):
"""Get a list of headers."""
response = super(SameContentException, self).get_response(
environ=environ
)
if self.etag is not None:
response.set_etag(self.etag)
if self.last_modified is not None:
response.h... | python | def get_response(self, environ=None):
"""Get a list of headers."""
response = super(SameContentException, self).get_response(
environ=environ
)
if self.etag is not None:
response.set_etag(self.etag)
if self.last_modified is not None:
response.h... | [
"def",
"get_response",
"(",
"self",
",",
"environ",
"=",
"None",
")",
":",
"response",
"=",
"super",
"(",
"SameContentException",
",",
"self",
")",
".",
"get_response",
"(",
"environ",
"=",
"environ",
")",
"if",
"self",
".",
"etag",
"is",
"not",
"None",
... | Get a list of headers. | [
"Get",
"a",
"list",
"of",
"headers",
"."
] | 4271708f0e2877e5100236be9242035b95b5ae6e | https://github.com/inveniosoftware/invenio-rest/blob/4271708f0e2877e5100236be9242035b95b5ae6e/invenio_rest/errors.py#L137-L146 |
48,396 | zhanglab/psamm | psamm/fluxcoupling.py | classify_coupling | def classify_coupling(coupling):
"""Return a constant indicating the type of coupling.
Depending on the type of coupling, one of the constants from
:class:`.CouplingClass` is returned.
Args:
coupling: Tuple of minimum and maximum flux ratio
"""
lower, upper = coupling
if lower is ... | python | def classify_coupling(coupling):
"""Return a constant indicating the type of coupling.
Depending on the type of coupling, one of the constants from
:class:`.CouplingClass` is returned.
Args:
coupling: Tuple of minimum and maximum flux ratio
"""
lower, upper = coupling
if lower is ... | [
"def",
"classify_coupling",
"(",
"coupling",
")",
":",
"lower",
",",
"upper",
"=",
"coupling",
"if",
"lower",
"is",
"None",
"and",
"upper",
"is",
"None",
":",
"return",
"CouplingClass",
".",
"Uncoupled",
"elif",
"lower",
"is",
"None",
"or",
"upper",
"is",
... | Return a constant indicating the type of coupling.
Depending on the type of coupling, one of the constants from
:class:`.CouplingClass` is returned.
Args:
coupling: Tuple of minimum and maximum flux ratio | [
"Return",
"a",
"constant",
"indicating",
"the",
"type",
"of",
"coupling",
"."
] | dc427848c4f9d109ca590f0afa024c63b685b3f4 | https://github.com/zhanglab/psamm/blob/dc427848c4f9d109ca590f0afa024c63b685b3f4/psamm/fluxcoupling.py#L124-L146 |
48,397 | zhanglab/psamm | psamm/fluxcoupling.py | FluxCouplingProblem.solve | def solve(self, reaction_1, reaction_2):
"""Return the flux coupling between two reactions
The flux coupling is returned as a tuple indicating the minimum and
maximum value of the v1/v2 reaction flux ratio. A value of None as
either the minimum or maximum indicates that the interval is ... | python | def solve(self, reaction_1, reaction_2):
"""Return the flux coupling between two reactions
The flux coupling is returned as a tuple indicating the minimum and
maximum value of the v1/v2 reaction flux ratio. A value of None as
either the minimum or maximum indicates that the interval is ... | [
"def",
"solve",
"(",
"self",
",",
"reaction_1",
",",
"reaction_2",
")",
":",
"# Update objective for reaction_1",
"self",
".",
"_prob",
".",
"set_objective",
"(",
"self",
".",
"_vbow",
"(",
"reaction_1",
")",
")",
"# Update constraint for reaction_2",
"if",
"self"... | Return the flux coupling between two reactions
The flux coupling is returned as a tuple indicating the minimum and
maximum value of the v1/v2 reaction flux ratio. A value of None as
either the minimum or maximum indicates that the interval is unbounded
in that direction. | [
"Return",
"the",
"flux",
"coupling",
"between",
"two",
"reactions"
] | dc427848c4f9d109ca590f0afa024c63b685b3f4 | https://github.com/zhanglab/psamm/blob/dc427848c4f9d109ca590f0afa024c63b685b3f4/psamm/fluxcoupling.py#L94-L121 |
48,398 | merll/docker-fabric | dockerfabric/actions.py | perform | def perform(action_name, container, **kwargs):
"""
Performs an action on the given container map and configuration.
:param action_name: Name of the action (e.g. ``update``).
:param container: Container configuration name.
:param kwargs: Keyword arguments for the action implementation.
"""
c... | python | def perform(action_name, container, **kwargs):
"""
Performs an action on the given container map and configuration.
:param action_name: Name of the action (e.g. ``update``).
:param container: Container configuration name.
:param kwargs: Keyword arguments for the action implementation.
"""
c... | [
"def",
"perform",
"(",
"action_name",
",",
"container",
",",
"*",
"*",
"kwargs",
")",
":",
"cf",
"=",
"container_fabric",
"(",
")",
"cf",
".",
"call",
"(",
"action_name",
",",
"container",
",",
"*",
"*",
"kwargs",
")"
] | Performs an action on the given container map and configuration.
:param action_name: Name of the action (e.g. ``update``).
:param container: Container configuration name.
:param kwargs: Keyword arguments for the action implementation. | [
"Performs",
"an",
"action",
"on",
"the",
"given",
"container",
"map",
"and",
"configuration",
"."
] | 785d84e40e17265b667d8b11a6e30d8e6b2bf8d4 | https://github.com/merll/docker-fabric/blob/785d84e40e17265b667d8b11a6e30d8e6b2bf8d4/dockerfabric/actions.py#L16-L25 |
48,399 | zhanglab/psamm | psamm/datasource/sbml.py | convert_sbml_model | def convert_sbml_model(model):
"""Convert raw SBML model to extended model.
Args:
model: :class:`NativeModel` obtained from :class:`SBMLReader`.
"""
biomass_reactions = set()
for reaction in model.reactions:
# Extract limits
if reaction.id not in model.limits:
lo... | python | def convert_sbml_model(model):
"""Convert raw SBML model to extended model.
Args:
model: :class:`NativeModel` obtained from :class:`SBMLReader`.
"""
biomass_reactions = set()
for reaction in model.reactions:
# Extract limits
if reaction.id not in model.limits:
lo... | [
"def",
"convert_sbml_model",
"(",
"model",
")",
":",
"biomass_reactions",
"=",
"set",
"(",
")",
"for",
"reaction",
"in",
"model",
".",
"reactions",
":",
"# Extract limits",
"if",
"reaction",
".",
"id",
"not",
"in",
"model",
".",
"limits",
":",
"lower",
","... | Convert raw SBML model to extended model.
Args:
model: :class:`NativeModel` obtained from :class:`SBMLReader`. | [
"Convert",
"raw",
"SBML",
"model",
"to",
"extended",
"model",
"."
] | dc427848c4f9d109ca590f0afa024c63b685b3f4 | https://github.com/zhanglab/psamm/blob/dc427848c4f9d109ca590f0afa024c63b685b3f4/psamm/datasource/sbml.py#L1268-L1299 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.