partition
stringclasses
3 values
func_name
stringlengths
1
134
docstring
stringlengths
1
46.9k
path
stringlengths
4
223
original_string
stringlengths
75
104k
code
stringlengths
75
104k
docstring_tokens
listlengths
1
1.97k
repo
stringlengths
7
55
language
stringclasses
1 value
url
stringlengths
87
315
code_tokens
listlengths
19
28.4k
sha
stringlengths
40
40
train
MappingJSONEncoderClassBuilder.build
Build a subclass of `MappingJSONEncoder`. :return: the built subclass
hgijson/json_converters/builders.py
def build(self) -> type: """ Build a subclass of `MappingJSONEncoder`. :return: the built subclass """ def _get_property_mappings(encoder: MappingJSONEncoder) -> List[JsonPropertyMapping]: return _get_all_property_mappings(encoder, self.mappings, self.superclasses) ...
def build(self) -> type: """ Build a subclass of `MappingJSONEncoder`. :return: the built subclass """ def _get_property_mappings(encoder: MappingJSONEncoder) -> List[JsonPropertyMapping]: return _get_all_property_mappings(encoder, self.mappings, self.superclasses) ...
[ "Build", "a", "subclass", "of", "MappingJSONEncoder", ".", ":", "return", ":", "the", "built", "subclass" ]
wtsi-hgi/python-hgijson
python
https://github.com/wtsi-hgi/python-hgijson/blob/6e8ccb562eabcaa816a136268a16504c2e0d4664/hgijson/json_converters/builders.py#L59-L97
[ "def", "build", "(", "self", ")", "->", "type", ":", "def", "_get_property_mappings", "(", "encoder", ":", "MappingJSONEncoder", ")", "->", "List", "[", "JsonPropertyMapping", "]", ":", "return", "_get_all_property_mappings", "(", "encoder", ",", "self", ".", ...
6e8ccb562eabcaa816a136268a16504c2e0d4664
train
MappingJSONDecoderClassBuilder.build
Build a subclass of `MappingJSONDecoder`. :return: the built subclass
hgijson/json_converters/builders.py
def build(self) -> type: """ Build a subclass of `MappingJSONDecoder`. :return: the built subclass """ def _get_property_mappings(encoder: MappingJSONEncoder) -> List[JsonPropertyMapping]: return _get_all_property_mappings(encoder, self.mappings, self.superclasses) ...
def build(self) -> type: """ Build a subclass of `MappingJSONDecoder`. :return: the built subclass """ def _get_property_mappings(encoder: MappingJSONEncoder) -> List[JsonPropertyMapping]: return _get_all_property_mappings(encoder, self.mappings, self.superclasses) ...
[ "Build", "a", "subclass", "of", "MappingJSONDecoder", ".", ":", "return", ":", "the", "built", "subclass" ]
wtsi-hgi/python-hgijson
python
https://github.com/wtsi-hgi/python-hgijson/blob/6e8ccb562eabcaa816a136268a16504c2e0d4664/hgijson/json_converters/builders.py#L108-L126
[ "def", "build", "(", "self", ")", "->", "type", ":", "def", "_get_property_mappings", "(", "encoder", ":", "MappingJSONEncoder", ")", "->", "List", "[", "JsonPropertyMapping", "]", ":", "return", "_get_all_property_mappings", "(", "encoder", ",", "self", ".", ...
6e8ccb562eabcaa816a136268a16504c2e0d4664
train
IPOPFSolver._solve
Solves using the Interior Point OPTimizer.
pylon/ipopf.py
def _solve(self, x0, A, l, u, xmin, xmax): """ Solves using the Interior Point OPTimizer. """ # Indexes of constrained lines. il = [i for i,ln in enumerate(self._ln) if 0.0 < ln.rate_a < 1e10] nl2 = len(il) neqnln = 2 * self._nb # no. of non-linear equality constraints ...
def _solve(self, x0, A, l, u, xmin, xmax): """ Solves using the Interior Point OPTimizer. """ # Indexes of constrained lines. il = [i for i,ln in enumerate(self._ln) if 0.0 < ln.rate_a < 1e10] nl2 = len(il) neqnln = 2 * self._nb # no. of non-linear equality constraints ...
[ "Solves", "using", "the", "Interior", "Point", "OPTimizer", "." ]
rwl/pylon
python
https://github.com/rwl/pylon/blob/916514255db1ae1661406f0283df756baf960d14/pylon/ipopf.py#L44-L86
[ "def", "_solve", "(", "self", ",", "x0", ",", "A", ",", "l", ",", "u", ",", "xmin", ",", "xmax", ")", ":", "# Indexes of constrained lines.", "il", "=", "[", "i", "for", "i", ",", "ln", "in", "enumerate", "(", "self", ".", "_ln", ")", "if", "0.0"...
916514255db1ae1661406f0283df756baf960d14
train
MarketExperiment.doOutages
Applies branch outtages.
pyreto/continuous/experiment.py
def doOutages(self): """ Applies branch outtages. """ assert len(self.branchOutages) == len(self.market.case.branches) weights = [[(False, r), (True, 1 - (r))] for r in self.branchOutages] for i, ln in enumerate(self.market.case.branches): ln.online = weighted_choic...
def doOutages(self): """ Applies branch outtages. """ assert len(self.branchOutages) == len(self.market.case.branches) weights = [[(False, r), (True, 1 - (r))] for r in self.branchOutages] for i, ln in enumerate(self.market.case.branches): ln.online = weighted_choic...
[ "Applies", "branch", "outtages", "." ]
rwl/pylon
python
https://github.com/rwl/pylon/blob/916514255db1ae1661406f0283df756baf960d14/pyreto/continuous/experiment.py#L133-L143
[ "def", "doOutages", "(", "self", ")", ":", "assert", "len", "(", "self", ".", "branchOutages", ")", "==", "len", "(", "self", ".", "market", ".", "case", ".", "branches", ")", "weights", "=", "[", "[", "(", "False", ",", "r", ")", ",", "(", "True...
916514255db1ae1661406f0283df756baf960d14
train
MarketExperiment.reset_case
Returns the case to its original state.
pyreto/continuous/experiment.py
def reset_case(self): """ Returns the case to its original state. """ for bus in self.market.case.buses: bus.p_demand = self.pdemand[bus] for task in self.tasks: for g in task.env.generators: g.p = task.env._g0[g]["p"] g.p_max = tas...
def reset_case(self): """ Returns the case to its original state. """ for bus in self.market.case.buses: bus.p_demand = self.pdemand[bus] for task in self.tasks: for g in task.env.generators: g.p = task.env._g0[g]["p"] g.p_max = tas...
[ "Returns", "the", "case", "to", "its", "original", "state", "." ]
rwl/pylon
python
https://github.com/rwl/pylon/blob/916514255db1ae1661406f0283df756baf960d14/pyreto/continuous/experiment.py#L146-L164
[ "def", "reset_case", "(", "self", ")", ":", "for", "bus", "in", "self", ".", "market", ".", "case", ".", "buses", ":", "bus", ".", "p_demand", "=", "self", ".", "pdemand", "[", "bus", "]", "for", "task", "in", "self", ".", "tasks", ":", "for", "g...
916514255db1ae1661406f0283df756baf960d14
train
MarketExperiment.doEpisodes
Do the given numer of episodes, and return the rewards of each step as a list.
pyreto/continuous/experiment.py
def doEpisodes(self, number=1): """ Do the given numer of episodes, and return the rewards of each step as a list. """ for episode in range(number): print "Starting episode %d." % episode # Initialise the profile cycle. if len(self.profile.shape) ...
def doEpisodes(self, number=1): """ Do the given numer of episodes, and return the rewards of each step as a list. """ for episode in range(number): print "Starting episode %d." % episode # Initialise the profile cycle. if len(self.profile.shape) ...
[ "Do", "the", "given", "numer", "of", "episodes", "and", "return", "the", "rewards", "of", "each", "step", "as", "a", "list", "." ]
rwl/pylon
python
https://github.com/rwl/pylon/blob/916514255db1ae1661406f0283df756baf960d14/pyreto/continuous/experiment.py#L170-L199
[ "def", "doEpisodes", "(", "self", ",", "number", "=", "1", ")", ":", "for", "episode", "in", "range", "(", "number", ")", ":", "print", "\"Starting episode %d.\"", "%", "episode", "# Initialise the profile cycle.", "if", "len", "(", "self", ".", "profile", "...
916514255db1ae1661406f0283df756baf960d14
train
MarketExperiment._oneInteraction
Coordinates one interaction between each agent and its environment.
pyreto/continuous/experiment.py
def _oneInteraction(self): """ Coordinates one interaction between each agent and its environment. """ self.stepid += 1 logger.info("Entering simulation period %d." % self.stepid) # Apply branches outages. if self.branchOutages is not None: self.doOutages() ...
def _oneInteraction(self): """ Coordinates one interaction between each agent and its environment. """ self.stepid += 1 logger.info("Entering simulation period %d." % self.stepid) # Apply branches outages. if self.branchOutages is not None: self.doOutages() ...
[ "Coordinates", "one", "interaction", "between", "each", "agent", "and", "its", "environment", "." ]
rwl/pylon
python
https://github.com/rwl/pylon/blob/916514255db1ae1661406f0283df756baf960d14/pyreto/continuous/experiment.py#L205-L246
[ "def", "_oneInteraction", "(", "self", ")", ":", "self", ".", "stepid", "+=", "1", "logger", ".", "info", "(", "\"Entering simulation period %d.\"", "%", "self", ".", "stepid", ")", "# Apply branches outages.", "if", "self", ".", "branchOutages", "is", "not", ...
916514255db1ae1661406f0283df756baf960d14
train
MarketExperiment.reset
Sets initial conditions for the experiment.
pyreto/continuous/experiment.py
def reset(self): """ Sets initial conditions for the experiment. """ self.stepid = 0 for task, agent in zip(self.tasks, self.agents): task.reset() agent.module.reset() agent.history.reset()
def reset(self): """ Sets initial conditions for the experiment. """ self.stepid = 0 for task, agent in zip(self.tasks, self.agents): task.reset() agent.module.reset() agent.history.reset()
[ "Sets", "initial", "conditions", "for", "the", "experiment", "." ]
rwl/pylon
python
https://github.com/rwl/pylon/blob/916514255db1ae1661406f0283df756baf960d14/pyreto/continuous/experiment.py#L249-L258
[ "def", "reset", "(", "self", ")", ":", "self", ".", "stepid", "=", "0", "for", "task", ",", "agent", "in", "zip", "(", "self", ".", "tasks", ",", "self", ".", "agents", ")", ":", "task", ".", "reset", "(", ")", "agent", ".", "module", ".", "res...
916514255db1ae1661406f0283df756baf960d14
train
RothErev.learn
Learn on the current dataset, either for many timesteps and even episodes (batchMode = True) or for a single timestep (batchMode = False). Batch mode is possible, because Q-Learning is an off-policy method. In batchMode, the algorithm goes through all the samples in the history ...
pyreto/roth_erev.py
def learn(self): """ Learn on the current dataset, either for many timesteps and even episodes (batchMode = True) or for a single timestep (batchMode = False). Batch mode is possible, because Q-Learning is an off-policy method. In batchMode, the algorithm goes through all the sa...
def learn(self): """ Learn on the current dataset, either for many timesteps and even episodes (batchMode = True) or for a single timestep (batchMode = False). Batch mode is possible, because Q-Learning is an off-policy method. In batchMode, the algorithm goes through all the sa...
[ "Learn", "on", "the", "current", "dataset", "either", "for", "many", "timesteps", "and", "even", "episodes", "(", "batchMode", "=", "True", ")", "or", "for", "a", "single", "timestep", "(", "batchMode", "=", "False", ")", ".", "Batch", "mode", "is", "pos...
rwl/pylon
python
https://github.com/rwl/pylon/blob/916514255db1ae1661406f0283df756baf960d14/pyreto/roth_erev.py#L112-L130
[ "def", "learn", "(", "self", ")", ":", "if", "self", ".", "batchMode", ":", "samples", "=", "self", ".", "dataset", "else", ":", "samples", "=", "[", "[", "self", ".", "dataset", ".", "getSample", "(", ")", "]", "]", "for", "seq", "in", "samples", ...
916514255db1ae1661406f0283df756baf960d14
train
RothErev._updatePropensities
Update the propensities for all actions. The propensity for last action chosen will be updated using the feedback value that resulted from performing the action. If j is the index of the last action chosen, r_j is the reward received for performing j, i is the current action being updat...
pyreto/roth_erev.py
def _updatePropensities(self, lastState, lastAction, reward): """ Update the propensities for all actions. The propensity for last action chosen will be updated using the feedback value that resulted from performing the action. If j is the index of the last action chosen, r_j is the rew...
def _updatePropensities(self, lastState, lastAction, reward): """ Update the propensities for all actions. The propensity for last action chosen will be updated using the feedback value that resulted from performing the action. If j is the index of the last action chosen, r_j is the rew...
[ "Update", "the", "propensities", "for", "all", "actions", ".", "The", "propensity", "for", "last", "action", "chosen", "will", "be", "updated", "using", "the", "feedback", "value", "that", "resulted", "from", "performing", "the", "action", "." ]
rwl/pylon
python
https://github.com/rwl/pylon/blob/916514255db1ae1661406f0283df756baf960d14/pyreto/roth_erev.py#L136-L154
[ "def", "_updatePropensities", "(", "self", ",", "lastState", ",", "lastAction", ",", "reward", ")", ":", "phi", "=", "self", ".", "recency", "for", "action", "in", "range", "(", "self", ".", "module", ".", "numActions", ")", ":", "carryOver", "=", "(", ...
916514255db1ae1661406f0283df756baf960d14
train
RothErev._experience
This is the standard experience function for the Roth-Erev algorithm. Here propensities for all actions are updated and similarity does not come into play. That is, all action choices are assumed to be equally similar. If the actionIndex points to the action the reward is associated with...
pyreto/roth_erev.py
def _experience(self, lastState, action, previousAction, reward): """ This is the standard experience function for the Roth-Erev algorithm. Here propensities for all actions are updated and similarity does not come into play. That is, all action choices are assumed to be equally similar....
def _experience(self, lastState, action, previousAction, reward): """ This is the standard experience function for the Roth-Erev algorithm. Here propensities for all actions are updated and similarity does not come into play. That is, all action choices are assumed to be equally similar....
[ "This", "is", "the", "standard", "experience", "function", "for", "the", "Roth", "-", "Erev", "algorithm", ".", "Here", "propensities", "for", "all", "actions", "are", "updated", "and", "similarity", "does", "not", "come", "into", "play", ".", "That", "is", ...
rwl/pylon
python
https://github.com/rwl/pylon/blob/916514255db1ae1661406f0283df756baf960d14/pyreto/roth_erev.py#L157-L182
[ "def", "_experience", "(", "self", ",", "lastState", ",", "action", ",", "previousAction", ",", "reward", ")", ":", "e", "=", "self", ".", "experimentation", "if", "action", "==", "previousAction", ":", "experience", "=", "reward", "*", "(", "1", "-", "e...
916514255db1ae1661406f0283df756baf960d14
train
VariantRothErev._experience
This is an altered version of the experience function for used in the standard Roth-Erev algorithm. Like in RELearner, propensities for all actions are updated and similarity does not come into play. If the actionIndex points to the action the reward is associated with (usually the last...
pyreto/roth_erev.py
def _experience(self, previousState, action, previousAction, reward): """ This is an altered version of the experience function for used in the standard Roth-Erev algorithm. Like in RELearner, propensities for all actions are updated and similarity does not come into play. If the action...
def _experience(self, previousState, action, previousAction, reward): """ This is an altered version of the experience function for used in the standard Roth-Erev algorithm. Like in RELearner, propensities for all actions are updated and similarity does not come into play. If the action...
[ "This", "is", "an", "altered", "version", "of", "the", "experience", "function", "for", "used", "in", "the", "standard", "Roth", "-", "Erev", "algorithm", ".", "Like", "in", "RELearner", "propensities", "for", "all", "actions", "are", "updated", "and", "simi...
rwl/pylon
python
https://github.com/rwl/pylon/blob/916514255db1ae1661406f0283df756baf960d14/pyreto/roth_erev.py#L202-L229
[ "def", "_experience", "(", "self", ",", "previousState", ",", "action", ",", "previousAction", ",", "reward", ")", ":", "e", "=", "self", ".", "experimentation", "if", "action", "==", "previousAction", ":", "experience", "=", "reward", "*", "(", "1", "-", ...
916514255db1ae1661406f0283df756baf960d14
train
ProportionalExplorer._forwardImplementation
Proportional probability method.
pyreto/roth_erev.py
def _forwardImplementation(self, inbuf, outbuf): """ Proportional probability method. """ assert self.module propensities = self.module.getActionValues(0) summedProps = sum(propensities) probabilities = propensities / summedProps action = eventGenerator(probabi...
def _forwardImplementation(self, inbuf, outbuf): """ Proportional probability method. """ assert self.module propensities = self.module.getActionValues(0) summedProps = sum(propensities) probabilities = propensities / summedProps action = eventGenerator(probabi...
[ "Proportional", "probability", "method", "." ]
rwl/pylon
python
https://github.com/rwl/pylon/blob/916514255db1ae1661406f0283df756baf960d14/pyreto/roth_erev.py#L254-L267
[ "def", "_forwardImplementation", "(", "self", ",", "inbuf", ",", "outbuf", ")", ":", "assert", "self", ".", "module", "propensities", "=", "self", ".", "module", ".", "getActionValues", "(", "0", ")", "summedProps", "=", "sum", "(", "propensities", ")", "p...
916514255db1ae1661406f0283df756baf960d14
train
ExcelWriter.write
Writes case data to file in Excel format.
pylon/io/excel.py
def write(self, file_or_filename): """ Writes case data to file in Excel format. """ self.book = Workbook() self._write_data(None) self.book.save(file_or_filename)
def write(self, file_or_filename): """ Writes case data to file in Excel format. """ self.book = Workbook() self._write_data(None) self.book.save(file_or_filename)
[ "Writes", "case", "data", "to", "file", "in", "Excel", "format", "." ]
rwl/pylon
python
https://github.com/rwl/pylon/blob/916514255db1ae1661406f0283df756baf960d14/pylon/io/excel.py#L38-L43
[ "def", "write", "(", "self", ",", "file_or_filename", ")", ":", "self", ".", "book", "=", "Workbook", "(", ")", "self", ".", "_write_data", "(", "None", ")", "self", ".", "book", ".", "save", "(", "file_or_filename", ")" ]
916514255db1ae1661406f0283df756baf960d14
train
ExcelWriter.write_case_data
Writes the header to file.
pylon/io/excel.py
def write_case_data(self, file): """ Writes the header to file. """ case_sheet = self.book.add_sheet("Case") case_sheet.write(0, 0, "Name") case_sheet.write(0, 1, self.case.name) case_sheet.write(1, 0, "base_mva") case_sheet.write(1, 1, self.case.base_mva)
def write_case_data(self, file): """ Writes the header to file. """ case_sheet = self.book.add_sheet("Case") case_sheet.write(0, 0, "Name") case_sheet.write(0, 1, self.case.name) case_sheet.write(1, 0, "base_mva") case_sheet.write(1, 1, self.case.base_mva)
[ "Writes", "the", "header", "to", "file", "." ]
rwl/pylon
python
https://github.com/rwl/pylon/blob/916514255db1ae1661406f0283df756baf960d14/pylon/io/excel.py#L46-L53
[ "def", "write_case_data", "(", "self", ",", "file", ")", ":", "case_sheet", "=", "self", ".", "book", ".", "add_sheet", "(", "\"Case\"", ")", "case_sheet", ".", "write", "(", "0", ",", "0", ",", "\"Name\"", ")", "case_sheet", ".", "write", "(", "0", ...
916514255db1ae1661406f0283df756baf960d14
train
ExcelWriter.write_bus_data
Writes bus data to an Excel spreadsheet.
pylon/io/excel.py
def write_bus_data(self, file): """ Writes bus data to an Excel spreadsheet. """ bus_sheet = self.book.add_sheet("Buses") for i, bus in enumerate(self.case.buses): for j, attr in enumerate(BUS_ATTRS): bus_sheet.write(i, j, getattr(bus, attr))
def write_bus_data(self, file): """ Writes bus data to an Excel spreadsheet. """ bus_sheet = self.book.add_sheet("Buses") for i, bus in enumerate(self.case.buses): for j, attr in enumerate(BUS_ATTRS): bus_sheet.write(i, j, getattr(bus, attr))
[ "Writes", "bus", "data", "to", "an", "Excel", "spreadsheet", "." ]
rwl/pylon
python
https://github.com/rwl/pylon/blob/916514255db1ae1661406f0283df756baf960d14/pylon/io/excel.py#L56-L63
[ "def", "write_bus_data", "(", "self", ",", "file", ")", ":", "bus_sheet", "=", "self", ".", "book", ".", "add_sheet", "(", "\"Buses\"", ")", "for", "i", ",", "bus", "in", "enumerate", "(", "self", ".", "case", ".", "buses", ")", ":", "for", "j", ",...
916514255db1ae1661406f0283df756baf960d14
train
ExcelWriter.write_branch_data
Writes branch data to an Excel spreadsheet.
pylon/io/excel.py
def write_branch_data(self, file): """ Writes branch data to an Excel spreadsheet. """ branch_sheet = self.book.add_sheet("Branches") for i, branch in enumerate(self.case.branches): for j, attr in enumerate(BRANCH_ATTRS): branch_sheet.write(i, j, getattr(bran...
def write_branch_data(self, file): """ Writes branch data to an Excel spreadsheet. """ branch_sheet = self.book.add_sheet("Branches") for i, branch in enumerate(self.case.branches): for j, attr in enumerate(BRANCH_ATTRS): branch_sheet.write(i, j, getattr(bran...
[ "Writes", "branch", "data", "to", "an", "Excel", "spreadsheet", "." ]
rwl/pylon
python
https://github.com/rwl/pylon/blob/916514255db1ae1661406f0283df756baf960d14/pylon/io/excel.py#L66-L73
[ "def", "write_branch_data", "(", "self", ",", "file", ")", ":", "branch_sheet", "=", "self", ".", "book", ".", "add_sheet", "(", "\"Branches\"", ")", "for", "i", ",", "branch", "in", "enumerate", "(", "self", ".", "case", ".", "branches", ")", ":", "fo...
916514255db1ae1661406f0283df756baf960d14
train
ExcelWriter.write_generator_data
Write generator data to file.
pylon/io/excel.py
def write_generator_data(self, file): """ Write generator data to file. """ generator_sheet = self.book.add_sheet("Generators") for j, generator in enumerate(self.case.generators): i = generator.bus._i for k, attr in enumerate(GENERATOR_ATTRS): ge...
def write_generator_data(self, file): """ Write generator data to file. """ generator_sheet = self.book.add_sheet("Generators") for j, generator in enumerate(self.case.generators): i = generator.bus._i for k, attr in enumerate(GENERATOR_ATTRS): ge...
[ "Write", "generator", "data", "to", "file", "." ]
rwl/pylon
python
https://github.com/rwl/pylon/blob/916514255db1ae1661406f0283df756baf960d14/pylon/io/excel.py#L76-L84
[ "def", "write_generator_data", "(", "self", ",", "file", ")", ":", "generator_sheet", "=", "self", ".", "book", ".", "add_sheet", "(", "\"Generators\"", ")", "for", "j", ",", "generator", "in", "enumerate", "(", "self", ".", "case", ".", "generators", ")",...
916514255db1ae1661406f0283df756baf960d14
train
CSVWriter.write
Writes case data as CSV.
pylon/io/excel.py
def write(self, file_or_filename): """ Writes case data as CSV. """ if isinstance(file_or_filename, basestring): file = open(file_or_filename, "wb") else: file = file_or_filename self.writer = csv.writer(file) super(CSVWriter, self).write(file)
def write(self, file_or_filename): """ Writes case data as CSV. """ if isinstance(file_or_filename, basestring): file = open(file_or_filename, "wb") else: file = file_or_filename self.writer = csv.writer(file) super(CSVWriter, self).write(file)
[ "Writes", "case", "data", "as", "CSV", "." ]
rwl/pylon
python
https://github.com/rwl/pylon/blob/916514255db1ae1661406f0283df756baf960d14/pylon/io/excel.py#L112-L122
[ "def", "write", "(", "self", ",", "file_or_filename", ")", ":", "if", "isinstance", "(", "file_or_filename", ",", "basestring", ")", ":", "file", "=", "open", "(", "file_or_filename", ",", "\"wb\"", ")", "else", ":", "file", "=", "file_or_filename", "self", ...
916514255db1ae1661406f0283df756baf960d14
train
CSVWriter.write_case_data
Writes the case data as CSV.
pylon/io/excel.py
def write_case_data(self, file): """ Writes the case data as CSV. """ writer = self._get_writer(file) writer.writerow(["Name", "base_mva"]) writer.writerow([self.case.name, self.case.base_mva])
def write_case_data(self, file): """ Writes the case data as CSV. """ writer = self._get_writer(file) writer.writerow(["Name", "base_mva"]) writer.writerow([self.case.name, self.case.base_mva])
[ "Writes", "the", "case", "data", "as", "CSV", "." ]
rwl/pylon
python
https://github.com/rwl/pylon/blob/916514255db1ae1661406f0283df756baf960d14/pylon/io/excel.py#L125-L130
[ "def", "write_case_data", "(", "self", ",", "file", ")", ":", "writer", "=", "self", ".", "_get_writer", "(", "file", ")", "writer", ".", "writerow", "(", "[", "\"Name\"", ",", "\"base_mva\"", "]", ")", "writer", ".", "writerow", "(", "[", "self", ".",...
916514255db1ae1661406f0283df756baf960d14
train
CSVWriter.write_bus_data
Writes bus data as CSV.
pylon/io/excel.py
def write_bus_data(self, file): """ Writes bus data as CSV. """ writer = self._get_writer(file) writer.writerow(BUS_ATTRS) for bus in self.case.buses: writer.writerow([getattr(bus, attr) for attr in BUS_ATTRS])
def write_bus_data(self, file): """ Writes bus data as CSV. """ writer = self._get_writer(file) writer.writerow(BUS_ATTRS) for bus in self.case.buses: writer.writerow([getattr(bus, attr) for attr in BUS_ATTRS])
[ "Writes", "bus", "data", "as", "CSV", "." ]
rwl/pylon
python
https://github.com/rwl/pylon/blob/916514255db1ae1661406f0283df756baf960d14/pylon/io/excel.py#L133-L139
[ "def", "write_bus_data", "(", "self", ",", "file", ")", ":", "writer", "=", "self", ".", "_get_writer", "(", "file", ")", "writer", ".", "writerow", "(", "BUS_ATTRS", ")", "for", "bus", "in", "self", ".", "case", ".", "buses", ":", "writer", ".", "wr...
916514255db1ae1661406f0283df756baf960d14
train
CSVWriter.write_branch_data
Writes branch data as CSV.
pylon/io/excel.py
def write_branch_data(self, file): """ Writes branch data as CSV. """ writer = self._get_writer(file) writer.writerow(BRANCH_ATTRS) for branch in self.case.branches: writer.writerow([getattr(branch, a) for a in BRANCH_ATTRS])
def write_branch_data(self, file): """ Writes branch data as CSV. """ writer = self._get_writer(file) writer.writerow(BRANCH_ATTRS) for branch in self.case.branches: writer.writerow([getattr(branch, a) for a in BRANCH_ATTRS])
[ "Writes", "branch", "data", "as", "CSV", "." ]
rwl/pylon
python
https://github.com/rwl/pylon/blob/916514255db1ae1661406f0283df756baf960d14/pylon/io/excel.py#L142-L148
[ "def", "write_branch_data", "(", "self", ",", "file", ")", ":", "writer", "=", "self", ".", "_get_writer", "(", "file", ")", "writer", ".", "writerow", "(", "BRANCH_ATTRS", ")", "for", "branch", "in", "self", ".", "case", ".", "branches", ":", "writer", ...
916514255db1ae1661406f0283df756baf960d14
train
CSVWriter.write_generator_data
Write generator data as CSV.
pylon/io/excel.py
def write_generator_data(self, file): """ Write generator data as CSV. """ writer = self._get_writer(file) writer.writerow(["bus"] + GENERATOR_ATTRS) for g in self.case.generators: i = g.bus._i writer.writerow([i] + [getattr(g,a) for a in GENERATOR_ATTRS]...
def write_generator_data(self, file): """ Write generator data as CSV. """ writer = self._get_writer(file) writer.writerow(["bus"] + GENERATOR_ATTRS) for g in self.case.generators: i = g.bus._i writer.writerow([i] + [getattr(g,a) for a in GENERATOR_ATTRS]...
[ "Write", "generator", "data", "as", "CSV", "." ]
rwl/pylon
python
https://github.com/rwl/pylon/blob/916514255db1ae1661406f0283df756baf960d14/pylon/io/excel.py#L151-L159
[ "def", "write_generator_data", "(", "self", ",", "file", ")", ":", "writer", "=", "self", ".", "_get_writer", "(", "file", ")", "writer", ".", "writerow", "(", "[", "\"bus\"", "]", "+", "GENERATOR_ATTRS", ")", "for", "g", "in", "self", ".", "case", "."...
916514255db1ae1661406f0283df756baf960d14
train
SmartMarket.getOffbids
Returns the offers/bids for the given generator.
pyreto/smart_market.py
def getOffbids(self, g): """ Returns the offers/bids for the given generator. """ if not g.is_load: offbids = [x for x in self.offers if x.generator == g] else: offbids = [x for x in self.bids if x.vLoad == g] return offbids
def getOffbids(self, g): """ Returns the offers/bids for the given generator. """ if not g.is_load: offbids = [x for x in self.offers if x.generator == g] else: offbids = [x for x in self.bids if x.vLoad == g] return offbids
[ "Returns", "the", "offers", "/", "bids", "for", "the", "given", "generator", "." ]
rwl/pylon
python
https://github.com/rwl/pylon/blob/916514255db1ae1661406f0283df756baf960d14/pyreto/smart_market.py#L120-L128
[ "def", "getOffbids", "(", "self", ",", "g", ")", ":", "if", "not", "g", ".", "is_load", ":", "offbids", "=", "[", "x", "for", "x", "in", "self", ".", "offers", "if", "x", ".", "generator", "==", "g", "]", "else", ":", "offbids", "=", "[", "x", ...
916514255db1ae1661406f0283df756baf960d14
train
SmartMarket.run
Computes cleared offers and bids.
pyreto/smart_market.py
def run(self): """ Computes cleared offers and bids. """ # Start the clock. t0 = time.time() # Manage reactive power offers/bids. haveQ = self._isReactiveMarket() # Withhold offers/bids outwith optional price limits. self._withholdOffbids() # Co...
def run(self): """ Computes cleared offers and bids. """ # Start the clock. t0 = time.time() # Manage reactive power offers/bids. haveQ = self._isReactiveMarket() # Withhold offers/bids outwith optional price limits. self._withholdOffbids() # Co...
[ "Computes", "cleared", "offers", "and", "bids", "." ]
rwl/pylon
python
https://github.com/rwl/pylon/blob/916514255db1ae1661406f0283df756baf960d14/pyreto/smart_market.py#L131-L166
[ "def", "run", "(", "self", ")", ":", "# Start the clock.", "t0", "=", "time", ".", "time", "(", ")", "# Manage reactive power offers/bids.", "haveQ", "=", "self", ".", "_isReactiveMarket", "(", ")", "# Withhold offers/bids outwith optional price limits.", "self", ".",...
916514255db1ae1661406f0283df756baf960d14
train
SmartMarket._isReactiveMarket
Returns a flag indicating the existance of offers/bids for reactive power.
pyreto/smart_market.py
def _isReactiveMarket(self): """ Returns a flag indicating the existance of offers/bids for reactive power. """ vLoads = [g for g in self.case.generators if g.is_load] if [offbid for offbid in self.offers + self.bids if offbid.reactive]: haveQ = True ...
def _isReactiveMarket(self): """ Returns a flag indicating the existance of offers/bids for reactive power. """ vLoads = [g for g in self.case.generators if g.is_load] if [offbid for offbid in self.offers + self.bids if offbid.reactive]: haveQ = True ...
[ "Returns", "a", "flag", "indicating", "the", "existance", "of", "offers", "/", "bids", "for", "reactive", "power", "." ]
rwl/pylon
python
https://github.com/rwl/pylon/blob/916514255db1ae1661406f0283df756baf960d14/pyreto/smart_market.py#L169-L191
[ "def", "_isReactiveMarket", "(", "self", ")", ":", "vLoads", "=", "[", "g", "for", "g", "in", "self", ".", "case", ".", "generators", "if", "g", ".", "is_load", "]", "if", "[", "offbid", "for", "offbid", "in", "self", ".", "offers", "+", "self", "....
916514255db1ae1661406f0283df756baf960d14
train
SmartMarket._withholdOffbids
Withholds offers/bids with invalid (<= 0.0) quantities or prices outwith the set limits.
pyreto/smart_market.py
def _withholdOffbids(self): """ Withholds offers/bids with invalid (<= 0.0) quantities or prices outwith the set limits. """ limits = self.limits # Eliminate offers (but not bids) above 'price_cap'. if not limits.has_key('max_offer'): limits['max_offer'] ...
def _withholdOffbids(self): """ Withholds offers/bids with invalid (<= 0.0) quantities or prices outwith the set limits. """ limits = self.limits # Eliminate offers (but not bids) above 'price_cap'. if not limits.has_key('max_offer'): limits['max_offer'] ...
[ "Withholds", "offers", "/", "bids", "with", "invalid", "(", "<", "=", "0", ".", "0", ")", "quantities", "or", "prices", "outwith", "the", "set", "limits", "." ]
rwl/pylon
python
https://github.com/rwl/pylon/blob/916514255db1ae1661406f0283df756baf960d14/pyreto/smart_market.py#L194-L234
[ "def", "_withholdOffbids", "(", "self", ")", ":", "limits", "=", "self", ".", "limits", "# Eliminate offers (but not bids) above 'price_cap'.", "if", "not", "limits", ".", "has_key", "(", "'max_offer'", ")", ":", "limits", "[", "'max_offer'", "]", "=", "self", "...
916514255db1ae1661406f0283df756baf960d14
train
SmartMarket._offbidToCase
Converts offers/bids to pwl functions and updates limits.
pyreto/smart_market.py
def _offbidToCase(self): """ Converts offers/bids to pwl functions and updates limits. """ generators = [g for g in self.case.generators if not g.is_load] vLoads = [g for g in self.case.generators if g.is_load] # Convert offers into piecewise linear segments and update limits. ...
def _offbidToCase(self): """ Converts offers/bids to pwl functions and updates limits. """ generators = [g for g in self.case.generators if not g.is_load] vLoads = [g for g in self.case.generators if g.is_load] # Convert offers into piecewise linear segments and update limits. ...
[ "Converts", "offers", "/", "bids", "to", "pwl", "functions", "and", "updates", "limits", "." ]
rwl/pylon
python
https://github.com/rwl/pylon/blob/916514255db1ae1661406f0283df756baf960d14/pyreto/smart_market.py#L237-L263
[ "def", "_offbidToCase", "(", "self", ")", ":", "generators", "=", "[", "g", "for", "g", "in", "self", ".", "case", ".", "generators", "if", "not", "g", ".", "is_load", "]", "vLoads", "=", "[", "g", "for", "g", "in", "self", ".", "case", ".", "gen...
916514255db1ae1661406f0283df756baf960d14
train
SmartMarket._runOPF
Computes dispatch points and LMPs using OPF.
pyreto/smart_market.py
def _runOPF(self): """ Computes dispatch points and LMPs using OPF. """ if self.decommit: solver = UDOPF(self.case, dc=(self.locationalAdjustment == "dc")) elif self.locationalAdjustment == "dc": solver = OPF(self.case, dc=True) else: solver = ...
def _runOPF(self): """ Computes dispatch points and LMPs using OPF. """ if self.decommit: solver = UDOPF(self.case, dc=(self.locationalAdjustment == "dc")) elif self.locationalAdjustment == "dc": solver = OPF(self.case, dc=True) else: solver = ...
[ "Computes", "dispatch", "points", "and", "LMPs", "using", "OPF", "." ]
rwl/pylon
python
https://github.com/rwl/pylon/blob/916514255db1ae1661406f0283df756baf960d14/pyreto/smart_market.py#L266-L281
[ "def", "_runOPF", "(", "self", ")", ":", "if", "self", ".", "decommit", ":", "solver", "=", "UDOPF", "(", "self", ".", "case", ",", "dc", "=", "(", "self", ".", "locationalAdjustment", "==", "\"dc\"", ")", ")", "elif", "self", ".", "locationalAdjustmen...
916514255db1ae1661406f0283df756baf960d14
train
SmartMarket._nodalPrices
Sets the nodal prices associated with each offer/bid.
pyreto/smart_market.py
def _nodalPrices(self, haveQ): """ Sets the nodal prices associated with each offer/bid. """ # Guarantee that cleared offer prices are >= offered prices. gteeOfferPrice = True gteeBidPrice = True for offer in self.offers: if not offer.reactive: ...
def _nodalPrices(self, haveQ): """ Sets the nodal prices associated with each offer/bid. """ # Guarantee that cleared offer prices are >= offered prices. gteeOfferPrice = True gteeBidPrice = True for offer in self.offers: if not offer.reactive: ...
[ "Sets", "the", "nodal", "prices", "associated", "with", "each", "offer", "/", "bid", "." ]
rwl/pylon
python
https://github.com/rwl/pylon/blob/916514255db1ae1661406f0283df756baf960d14/pyreto/smart_market.py#L284-L326
[ "def", "_nodalPrices", "(", "self", ",", "haveQ", ")", ":", "# Guarantee that cleared offer prices are >= offered prices.", "gteeOfferPrice", "=", "True", "gteeBidPrice", "=", "True", "for", "offer", "in", "self", ".", "offers", ":", "if", "not", "offer", ".", "re...
916514255db1ae1661406f0283df756baf960d14
train
SmartMarket._runAuction
Clears an auction to determine the quantity and price for each offer/bid.
pyreto/smart_market.py
def _runAuction(self, gteeOfferPrice, gteeBidPrice, haveQ): """ Clears an auction to determine the quantity and price for each offer/bid. """ pOffers = [offer for offer in self.offers if not offer.reactive] pBids = [bid for bid in self.bids if not bid.reactive] # Cle...
def _runAuction(self, gteeOfferPrice, gteeBidPrice, haveQ): """ Clears an auction to determine the quantity and price for each offer/bid. """ pOffers = [offer for offer in self.offers if not offer.reactive] pBids = [bid for bid in self.bids if not bid.reactive] # Cle...
[ "Clears", "an", "auction", "to", "determine", "the", "quantity", "and", "price", "for", "each", "offer", "/", "bid", "." ]
rwl/pylon
python
https://github.com/rwl/pylon/blob/916514255db1ae1661406f0283df756baf960d14/pyreto/smart_market.py#L329-L350
[ "def", "_runAuction", "(", "self", ",", "gteeOfferPrice", ",", "gteeBidPrice", ",", "haveQ", ")", ":", "pOffers", "=", "[", "offer", "for", "offer", "in", "self", ".", "offers", "if", "not", "offer", ".", "reactive", "]", "pBids", "=", "[", "bid", "for...
916514255db1ae1661406f0283df756baf960d14
train
JSONEncoder.encode
Return a JSON string representation of a Python data structure. >>> JSONEncoder().encode({"foo": ["bar", "baz"]}) '{"foo":["bar", "baz"]}'
contrib/public/services/simplejson/encoder.py
def encode(self, o): """ Return a JSON string representation of a Python data structure. >>> JSONEncoder().encode({"foo": ["bar", "baz"]}) '{"foo":["bar", "baz"]}' """ # This doesn't pass the iterator directly to ''.join() because it # sucks at reporting exceptio...
def encode(self, o): """ Return a JSON string representation of a Python data structure. >>> JSONEncoder().encode({"foo": ["bar", "baz"]}) '{"foo":["bar", "baz"]}' """ # This doesn't pass the iterator directly to ''.join() because it # sucks at reporting exceptio...
[ "Return", "a", "JSON", "string", "representation", "of", "a", "Python", "data", "structure", "." ]
rwl/pylon
python
https://github.com/rwl/pylon/blob/916514255db1ae1661406f0283df756baf960d14/contrib/public/services/simplejson/encoder.py#L278-L289
[ "def", "encode", "(", "self", ",", "o", ")", ":", "# This doesn't pass the iterator directly to ''.join() because it", "# sucks at reporting exceptions. It's going to do this internally", "# anyway because it uses PySequence_Fast or similar.", "chunks", "=", "list", "(", "self", "."...
916514255db1ae1661406f0283df756baf960d14
train
generate
:param ast_tree: AST to generate from :param model_name: class to generate :param options: dictionary of generator options :return: casadi model
src/pymoca/backends/casadi/generator.py
def generate(ast_tree: ast.Tree, model_name: str, options: Dict[str, bool]=None) -> Model: """ :param ast_tree: AST to generate from :param model_name: class to generate :param options: dictionary of generator options :return: casadi model """ if options is None: options = {} com...
def generate(ast_tree: ast.Tree, model_name: str, options: Dict[str, bool]=None) -> Model: """ :param ast_tree: AST to generate from :param model_name: class to generate :param options: dictionary of generator options :return: casadi model """ if options is None: options = {} com...
[ ":", "param", "ast_tree", ":", "AST", "to", "generate", "from", ":", "param", "model_name", ":", "class", "to", "generate", ":", "param", "options", ":", "dictionary", "of", "generator", "options", ":", "return", ":", "casadi", "model" ]
pymoca/pymoca
python
https://github.com/pymoca/pymoca/blob/14b5eb7425e96689de6cc5c10f400895d586a978/src/pymoca/backends/casadi/generator.py#L921-L936
[ "def", "generate", "(", "ast_tree", ":", "ast", ".", "Tree", ",", "model_name", ":", "str", ",", "options", ":", "Dict", "[", "str", ",", "bool", "]", "=", "None", ")", "->", "Model", ":", "if", "options", "is", "None", ":", "options", "=", "{", ...
14b5eb7425e96689de6cc5c10f400895d586a978
train
Generator.get_mx
We pull components and symbols from the AST on demand. This is to ensure that parametrized vector dimensions can be resolved. Vector dimensions need to be known at CasADi MX creation time. :param tree: :return:
src/pymoca/backends/casadi/generator.py
def get_mx(self, tree: Union[ast.Symbol, ast.ComponentRef, ast.Expression]) -> ca.MX: """ We pull components and symbols from the AST on demand. This is to ensure that parametrized vector dimensions can be resolved. Vector dimensions need to be known at CasADi MX creation time. ...
def get_mx(self, tree: Union[ast.Symbol, ast.ComponentRef, ast.Expression]) -> ca.MX: """ We pull components and symbols from the AST on demand. This is to ensure that parametrized vector dimensions can be resolved. Vector dimensions need to be known at CasADi MX creation time. ...
[ "We", "pull", "components", "and", "symbols", "from", "the", "AST", "on", "demand", ".", "This", "is", "to", "ensure", "that", "parametrized", "vector", "dimensions", "can", "be", "resolved", ".", "Vector", "dimensions", "need", "to", "be", "known", "at", ...
pymoca/pymoca
python
https://github.com/pymoca/pymoca/blob/14b5eb7425e96689de6cc5c10f400895d586a978/src/pymoca/backends/casadi/generator.py#L864-L880
[ "def", "get_mx", "(", "self", ",", "tree", ":", "Union", "[", "ast", ".", "Symbol", ",", "ast", ".", "ComponentRef", ",", "ast", ".", "Expression", "]", ")", "->", "ca", ".", "MX", ":", "if", "tree", "not", "in", "self", ".", "src", ":", "if", ...
14b5eb7425e96689de6cc5c10f400895d586a978
train
compute_file_metrics
use processors to compute file metrics.
metrics/compute.py
def compute_file_metrics(processors, language, key, token_list): """use processors to compute file metrics.""" # multiply iterator tli = itertools.tee(token_list, len(processors)) metrics = OrderedDict() # reset all processors for p in processors: p.reset() # process all tokens ...
def compute_file_metrics(processors, language, key, token_list): """use processors to compute file metrics.""" # multiply iterator tli = itertools.tee(token_list, len(processors)) metrics = OrderedDict() # reset all processors for p in processors: p.reset() # process all tokens ...
[ "use", "processors", "to", "compute", "file", "metrics", "." ]
finklabs/metrics
python
https://github.com/finklabs/metrics/blob/fd9974af498831664b9ae8e8f3834e1ec2e8a699/metrics/compute.py#L8-L26
[ "def", "compute_file_metrics", "(", "processors", ",", "language", ",", "key", ",", "token_list", ")", ":", "# multiply iterator", "tli", "=", "itertools", ".", "tee", "(", "token_list", ",", "len", "(", "processors", ")", ")", "metrics", "=", "OrderedDict", ...
fd9974af498831664b9ae8e8f3834e1ec2e8a699
train
IWNLPWrapper.load
This methods load the IWNLP.Lemmatizer json file and creates a dictionary of lowercased forms which maps each form to its possible lemmas.
iwnlp/iwnlp_wrapper.py
def load(self, lemmatizer_path): """ This methods load the IWNLP.Lemmatizer json file and creates a dictionary of lowercased forms which maps each form to its possible lemmas. """ self.lemmatizer = {} with io.open(lemmatizer_path, encoding='utf-8') as data_file: ...
def load(self, lemmatizer_path): """ This methods load the IWNLP.Lemmatizer json file and creates a dictionary of lowercased forms which maps each form to its possible lemmas. """ self.lemmatizer = {} with io.open(lemmatizer_path, encoding='utf-8') as data_file: ...
[ "This", "methods", "load", "the", "IWNLP", ".", "Lemmatizer", "json", "file", "and", "creates", "a", "dictionary", "of", "lowercased", "forms", "which", "maps", "each", "form", "to", "its", "possible", "lemmas", "." ]
Liebeck/IWNLP-py
python
https://github.com/Liebeck/IWNLP-py/blob/fd4b81769317476eac0487396cce0faf482a1913/iwnlp/iwnlp_wrapper.py#L14-L24
[ "def", "load", "(", "self", ",", "lemmatizer_path", ")", ":", "self", ".", "lemmatizer", "=", "{", "}", "with", "io", ".", "open", "(", "lemmatizer_path", ",", "encoding", "=", "'utf-8'", ")", "as", "data_file", ":", "raw", "=", "json", ".", "load", ...
fd4b81769317476eac0487396cce0faf482a1913
train
IWNLPWrapper.get_lemmas
Return all lemmas for a given word. This method assumes that the specified word is present in the dictionary :param word: Word that is present in the IWNLP lemmatizer
iwnlp/iwnlp_wrapper.py
def get_lemmas(self, word, pos=None, ignore_case=False): """ Return all lemmas for a given word. This method assumes that the specified word is present in the dictionary :param word: Word that is present in the IWNLP lemmatizer """ entries = self.get_entries(word, pos, ignore_cas...
def get_lemmas(self, word, pos=None, ignore_case=False): """ Return all lemmas for a given word. This method assumes that the specified word is present in the dictionary :param word: Word that is present in the IWNLP lemmatizer """ entries = self.get_entries(word, pos, ignore_cas...
[ "Return", "all", "lemmas", "for", "a", "given", "word", ".", "This", "method", "assumes", "that", "the", "specified", "word", "is", "present", "in", "the", "dictionary", ":", "param", "word", ":", "Word", "that", "is", "present", "in", "the", "IWNLP", "l...
Liebeck/IWNLP-py
python
https://github.com/Liebeck/IWNLP-py/blob/fd4b81769317476eac0487396cce0faf482a1913/iwnlp/iwnlp_wrapper.py#L74-L81
[ "def", "get_lemmas", "(", "self", ",", "word", ",", "pos", "=", "None", ",", "ignore_case", "=", "False", ")", ":", "entries", "=", "self", ".", "get_entries", "(", "word", ",", "pos", ",", "ignore_case", ")", "lemmas", "=", "list", "(", "set", "(", ...
fd4b81769317476eac0487396cce0faf482a1913
train
IWNLPWrapper.lemmatize
Python port of the lemmatize method, see https://github.com/Liebeck/IWNLP.Lemmatizer/blob/master/IWNLP.Lemmatizer.Predictor/IWNLPSentenceProcessor.cs
iwnlp/iwnlp_wrapper.py
def lemmatize(self, word, pos_universal_google): """ Python port of the lemmatize method, see https://github.com/Liebeck/IWNLP.Lemmatizer/blob/master/IWNLP.Lemmatizer.Predictor/IWNLPSentenceProcessor.cs """ if pos_universal_google == "NOUN": if self.contains_entry(word, "Nou...
def lemmatize(self, word, pos_universal_google): """ Python port of the lemmatize method, see https://github.com/Liebeck/IWNLP.Lemmatizer/blob/master/IWNLP.Lemmatizer.Predictor/IWNLPSentenceProcessor.cs """ if pos_universal_google == "NOUN": if self.contains_entry(word, "Nou...
[ "Python", "port", "of", "the", "lemmatize", "method", "see", "https", ":", "//", "github", ".", "com", "/", "Liebeck", "/", "IWNLP", ".", "Lemmatizer", "/", "blob", "/", "master", "/", "IWNLP", ".", "Lemmatizer", ".", "Predictor", "/", "IWNLPSentenceProces...
Liebeck/IWNLP-py
python
https://github.com/Liebeck/IWNLP-py/blob/fd4b81769317476eac0487396cce0faf482a1913/iwnlp/iwnlp_wrapper.py#L89-L125
[ "def", "lemmatize", "(", "self", ",", "word", ",", "pos_universal_google", ")", ":", "if", "pos_universal_google", "==", "\"NOUN\"", ":", "if", "self", ".", "contains_entry", "(", "word", ",", "\"Noun\"", ")", ":", "return", "self", ".", "get_lemmas", "(", ...
fd4b81769317476eac0487396cce0faf482a1913
train
_CaseWriter.write
Writes the case data to file.
pylon/io/common.py
def write(self, file_or_filename): """ Writes the case data to file. """ if isinstance(file_or_filename, basestring): file = None try: file = open(file_or_filename, "wb") except Exception, detail: logger.error("Error opening %s....
def write(self, file_or_filename): """ Writes the case data to file. """ if isinstance(file_or_filename, basestring): file = None try: file = open(file_or_filename, "wb") except Exception, detail: logger.error("Error opening %s....
[ "Writes", "the", "case", "data", "to", "file", "." ]
rwl/pylon
python
https://github.com/rwl/pylon/blob/916514255db1ae1661406f0283df756baf960d14/pylon/io/common.py#L64-L81
[ "def", "write", "(", "self", ",", "file_or_filename", ")", ":", "if", "isinstance", "(", "file_or_filename", ",", "basestring", ")", ":", "file", "=", "None", "try", ":", "file", "=", "open", "(", "file_or_filename", ",", "\"wb\"", ")", "except", "Exceptio...
916514255db1ae1661406f0283df756baf960d14
train
MappingJSONEncoder._create_serializer
Create serializer that is to be used by this encoder :return: the serializer
hgijson/json_converters/_serialization.py
def _create_serializer(self) -> JsonObjectSerializer: """ Create serializer that is to be used by this encoder :return: the serializer """ if self._serializer_cache is None: serializer_cls = type( "%sInternalSerializer" % type(self), (J...
def _create_serializer(self) -> JsonObjectSerializer: """ Create serializer that is to be used by this encoder :return: the serializer """ if self._serializer_cache is None: serializer_cls = type( "%sInternalSerializer" % type(self), (J...
[ "Create", "serializer", "that", "is", "to", "be", "used", "by", "this", "encoder", ":", "return", ":", "the", "serializer" ]
wtsi-hgi/python-hgijson
python
https://github.com/wtsi-hgi/python-hgijson/blob/6e8ccb562eabcaa816a136268a16504c2e0d4664/hgijson/json_converters/_serialization.py#L54-L69
[ "def", "_create_serializer", "(", "self", ")", "->", "JsonObjectSerializer", ":", "if", "self", ".", "_serializer_cache", "is", "None", ":", "serializer_cls", "=", "type", "(", "\"%sInternalSerializer\"", "%", "type", "(", "self", ")", ",", "(", "JsonObjectSeria...
6e8ccb562eabcaa816a136268a16504c2e0d4664
train
MappingJSONDecoder._create_deserializer
Creates a deserializer that is to be used by this decoder. :return: the deserializer
hgijson/json_converters/_serialization.py
def _create_deserializer(self) -> JsonObjectDeserializer: """ Creates a deserializer that is to be used by this decoder. :return: the deserializer """ if self._deserializer_cache is None: deserializer_cls = type( "%sInternalDeserializer" % type(self), ...
def _create_deserializer(self) -> JsonObjectDeserializer: """ Creates a deserializer that is to be used by this decoder. :return: the deserializer """ if self._deserializer_cache is None: deserializer_cls = type( "%sInternalDeserializer" % type(self), ...
[ "Creates", "a", "deserializer", "that", "is", "to", "be", "used", "by", "this", "decoder", ".", ":", "return", ":", "the", "deserializer" ]
wtsi-hgi/python-hgijson
python
https://github.com/wtsi-hgi/python-hgijson/blob/6e8ccb562eabcaa816a136268a16504c2e0d4664/hgijson/json_converters/_serialization.py#L104-L119
[ "def", "_create_deserializer", "(", "self", ")", "->", "JsonObjectDeserializer", ":", "if", "self", ".", "_deserializer_cache", "is", "None", ":", "deserializer_cls", "=", "type", "(", "\"%sInternalDeserializer\"", "%", "type", "(", "self", ")", ",", "(", "JsonO...
6e8ccb562eabcaa816a136268a16504c2e0d4664
train
ComponentRef.to_tuple
Convert the nested component reference to flat tuple of names, which is hashable and can therefore be used as dictionary key. Note that this function ignores any array indices in the component reference. :return: flattened tuple of c's names
src/pymoca/ast.py
def to_tuple(self) -> tuple: """ Convert the nested component reference to flat tuple of names, which is hashable and can therefore be used as dictionary key. Note that this function ignores any array indices in the component reference. :return: flattened tuple of c's names ...
def to_tuple(self) -> tuple: """ Convert the nested component reference to flat tuple of names, which is hashable and can therefore be used as dictionary key. Note that this function ignores any array indices in the component reference. :return: flattened tuple of c's names ...
[ "Convert", "the", "nested", "component", "reference", "to", "flat", "tuple", "of", "names", "which", "is", "hashable", "and", "can", "therefore", "be", "used", "as", "dictionary", "key", ".", "Note", "that", "this", "function", "ignores", "any", "array", "in...
pymoca/pymoca
python
https://github.com/pymoca/pymoca/blob/14b5eb7425e96689de6cc5c10f400895d586a978/src/pymoca/ast.py#L143-L154
[ "def", "to_tuple", "(", "self", ")", "->", "tuple", ":", "if", "self", ".", "child", ":", "return", "(", "self", ".", "name", ",", ")", "+", "self", ".", "child", "[", "0", "]", ".", "to_tuple", "(", ")", "else", ":", "return", "self", ".", "na...
14b5eb7425e96689de6cc5c10f400895d586a978
train
ComponentRef.from_tuple
Convert the tuple pointing to a component to a component reference. :param components: tuple of components name :return: ComponentRef
src/pymoca/ast.py
def from_tuple(cls, components: tuple) -> 'ComponentRef': """ Convert the tuple pointing to a component to a component reference. :param components: tuple of components name :return: ComponentRef """ component_ref = ComponentRef(name=components[0], child=[]) ...
def from_tuple(cls, components: tuple) -> 'ComponentRef': """ Convert the tuple pointing to a component to a component reference. :param components: tuple of components name :return: ComponentRef """ component_ref = ComponentRef(name=components[0], child=[]) ...
[ "Convert", "the", "tuple", "pointing", "to", "a", "component", "to", "a", "component", "reference", ".", ":", "param", "components", ":", "tuple", "of", "components", "name", ":", "return", ":", "ComponentRef" ]
pymoca/pymoca
python
https://github.com/pymoca/pymoca/blob/14b5eb7425e96689de6cc5c10f400895d586a978/src/pymoca/ast.py#L157-L170
[ "def", "from_tuple", "(", "cls", ",", "components", ":", "tuple", ")", "->", "'ComponentRef'", ":", "component_ref", "=", "ComponentRef", "(", "name", "=", "components", "[", "0", "]", ",", "child", "=", "[", "]", ")", "c", "=", "component_ref", "for", ...
14b5eb7425e96689de6cc5c10f400895d586a978
train
ComponentRef.from_string
Convert the string pointing to a component using dot notation to a component reference. :param s: string pointing to component using dot notation :return: ComponentRef
src/pymoca/ast.py
def from_string(cls, s: str) -> 'ComponentRef': """ Convert the string pointing to a component using dot notation to a component reference. :param s: string pointing to component using dot notation :return: ComponentRef """ components = s.split('.') retur...
def from_string(cls, s: str) -> 'ComponentRef': """ Convert the string pointing to a component using dot notation to a component reference. :param s: string pointing to component using dot notation :return: ComponentRef """ components = s.split('.') retur...
[ "Convert", "the", "string", "pointing", "to", "a", "component", "using", "dot", "notation", "to", "a", "component", "reference", ".", ":", "param", "s", ":", "string", "pointing", "to", "component", "using", "dot", "notation", ":", "return", ":", "ComponentR...
pymoca/pymoca
python
https://github.com/pymoca/pymoca/blob/14b5eb7425e96689de6cc5c10f400895d586a978/src/pymoca/ast.py#L173-L182
[ "def", "from_string", "(", "cls", ",", "s", ":", "str", ")", "->", "'ComponentRef'", ":", "components", "=", "s", ".", "split", "(", "'.'", ")", "return", "cls", ".", "from_tuple", "(", "components", ")" ]
14b5eb7425e96689de6cc5c10f400895d586a978
train
ComponentRef.concatenate
Helper function to append two component references to eachother, e.g. a "within" component ref and an "object type" component ref. :return: New component reference, with other appended to self.
src/pymoca/ast.py
def concatenate(cls, *args: List['ComponentRef']) -> 'ComponentRef': """ Helper function to append two component references to eachother, e.g. a "within" component ref and an "object type" component ref. :return: New component reference, with other appended to self. """ ...
def concatenate(cls, *args: List['ComponentRef']) -> 'ComponentRef': """ Helper function to append two component references to eachother, e.g. a "within" component ref and an "object type" component ref. :return: New component reference, with other appended to self. """ ...
[ "Helper", "function", "to", "append", "two", "component", "references", "to", "eachother", "e", ".", "g", ".", "a", "within", "component", "ref", "and", "an", "object", "type", "component", "ref", ".", ":", "return", ":", "New", "component", "reference", "...
pymoca/pymoca
python
https://github.com/pymoca/pymoca/blob/14b5eb7425e96689de6cc5c10f400895d586a978/src/pymoca/ast.py#L185-L199
[ "def", "concatenate", "(", "cls", ",", "*", "args", ":", "List", "[", "'ComponentRef'", "]", ")", "->", "'ComponentRef'", ":", "a", "=", "copy", ".", "deepcopy", "(", "args", "[", "0", "]", ")", "n", "=", "a", "for", "b", "in", "args", "[", "1", ...
14b5eb7425e96689de6cc5c10f400895d586a978
train
Class.add_class
Add a (sub)class to this class. :param c: (Sub)class to add.
src/pymoca/ast.py
def add_class(self, c: 'Class') -> None: """ Add a (sub)class to this class. :param c: (Sub)class to add. """ self.classes[c.name] = c c.parent = self
def add_class(self, c: 'Class') -> None: """ Add a (sub)class to this class. :param c: (Sub)class to add. """ self.classes[c.name] = c c.parent = self
[ "Add", "a", "(", "sub", ")", "class", "to", "this", "class", "." ]
pymoca/pymoca
python
https://github.com/pymoca/pymoca/blob/14b5eb7425e96689de6cc5c10f400895d586a978/src/pymoca/ast.py#L556-L563
[ "def", "add_class", "(", "self", ",", "c", ":", "'Class'", ")", "->", "None", ":", "self", ".", "classes", "[", "c", ".", "name", "]", "=", "c", "c", ".", "parent", "=", "self" ]
14b5eb7425e96689de6cc5c10f400895d586a978
train
generate
:param ast_tree: AST to generate from :param model_name: class to generate :return: sympy source code for model
src/pymoca/backends/sympy/generator.py
def generate(ast_tree: ast.Tree, model_name: str): """ :param ast_tree: AST to generate from :param model_name: class to generate :return: sympy source code for model """ component_ref = ast.ComponentRef.from_string(model_name) ast_tree_new = copy.deepcopy(ast_tree) ast_walker = TreeWalk...
def generate(ast_tree: ast.Tree, model_name: str): """ :param ast_tree: AST to generate from :param model_name: class to generate :return: sympy source code for model """ component_ref = ast.ComponentRef.from_string(model_name) ast_tree_new = copy.deepcopy(ast_tree) ast_walker = TreeWalk...
[ ":", "param", "ast_tree", ":", "AST", "to", "generate", "from", ":", "param", "model_name", ":", "class", "to", "generate", ":", "return", ":", "sympy", "source", "code", "for", "model" ]
pymoca/pymoca
python
https://github.com/pymoca/pymoca/blob/14b5eb7425e96689de6cc5c10f400895d586a978/src/pymoca/backends/sympy/generator.py#L203-L215
[ "def", "generate", "(", "ast_tree", ":", "ast", ".", "Tree", ",", "model_name", ":", "str", ")", ":", "component_ref", "=", "ast", ".", "ComponentRef", ".", "from_string", "(", "model_name", ")", "ast_tree_new", "=", "copy", ".", "deepcopy", "(", "ast_tree...
14b5eb7425e96689de6cc5c10f400895d586a978
train
ProfitTask.getReward
Returns the reward corresponding to the last action performed.
pyreto/discrete/task.py
def getReward(self): """ Returns the reward corresponding to the last action performed. """ t = self.env.market.period # Compute revenue minus costs. totalEarnings = 0.0 for g in self.env.generators: # Compute costs in $ (not $/hr). costs = g.tota...
def getReward(self): """ Returns the reward corresponding to the last action performed. """ t = self.env.market.period # Compute revenue minus costs. totalEarnings = 0.0 for g in self.env.generators: # Compute costs in $ (not $/hr). costs = g.tota...
[ "Returns", "the", "reward", "corresponding", "to", "the", "last", "action", "performed", "." ]
rwl/pylon
python
https://github.com/rwl/pylon/blob/916514255db1ae1661406f0283df756baf960d14/pyreto/discrete/task.py#L73-L117
[ "def", "getReward", "(", "self", ")", ":", "t", "=", "self", ".", "env", ".", "market", ".", "period", "# Compute revenue minus costs.", "totalEarnings", "=", "0.0", "for", "g", "in", "self", ".", "env", ".", "generators", ":", "# Compute costs in $ (not $/hr)...
916514255db1ae1661406f0283df756baf960d14
train
ProfitTask.performAction
The action vector is stripped and the only element is cast to integer and given to the super class.
pyreto/discrete/task.py
def performAction(self, action): """ The action vector is stripped and the only element is cast to integer and given to the super class. """ self.t += 1 super(ProfitTask, self).performAction(int(action[0])) self.samples += 1
def performAction(self, action): """ The action vector is stripped and the only element is cast to integer and given to the super class. """ self.t += 1 super(ProfitTask, self).performAction(int(action[0])) self.samples += 1
[ "The", "action", "vector", "is", "stripped", "and", "the", "only", "element", "is", "cast", "to", "integer", "and", "given", "to", "the", "super", "class", "." ]
rwl/pylon
python
https://github.com/rwl/pylon/blob/916514255db1ae1661406f0283df756baf960d14/pyreto/discrete/task.py#L120-L126
[ "def", "performAction", "(", "self", ",", "action", ")", ":", "self", ".", "t", "+=", "1", "super", "(", "ProfitTask", ",", "self", ")", ".", "performAction", "(", "int", "(", "action", "[", "0", "]", ")", ")", "self", ".", "samples", "+=", "1" ]
916514255db1ae1661406f0283df756baf960d14
train
ProfitTask.addReward
A filtered mapping towards performAction of the underlying environment.
pyreto/discrete/task.py
def addReward(self, r=None): """ A filtered mapping towards performAction of the underlying environment. """ r = self.getReward() if r is None else r # by default, the cumulative reward is just the sum over the episode if self.discount: self.cumulativeRew...
def addReward(self, r=None): """ A filtered mapping towards performAction of the underlying environment. """ r = self.getReward() if r is None else r # by default, the cumulative reward is just the sum over the episode if self.discount: self.cumulativeRew...
[ "A", "filtered", "mapping", "towards", "performAction", "of", "the", "underlying", "environment", "." ]
rwl/pylon
python
https://github.com/rwl/pylon/blob/916514255db1ae1661406f0283df756baf960d14/pyreto/discrete/task.py#L156-L166
[ "def", "addReward", "(", "self", ",", "r", "=", "None", ")", ":", "r", "=", "self", ".", "getReward", "(", ")", "if", "r", "is", "None", "else", "r", "# by default, the cumulative reward is just the sum over the episode", "if", "self", ".", "discount", ":", ...
916514255db1ae1661406f0283df756baf960d14
train
StateEstimator.run
Solves a state estimation problem.
pylon/estimator.py
def run(self): """ Solves a state estimation problem. """ case = self.case baseMVA = case.base_mva buses = self.case.connected_buses branches = case.online_branches generators = case.online_generators meas = self.measurements # Update indices. ...
def run(self): """ Solves a state estimation problem. """ case = self.case baseMVA = case.base_mva buses = self.case.connected_buses branches = case.online_branches generators = case.online_generators meas = self.measurements # Update indices. ...
[ "Solves", "a", "state", "estimation", "problem", "." ]
rwl/pylon
python
https://github.com/rwl/pylon/blob/916514255db1ae1661406f0283df756baf960d14/pylon/estimator.py#L109-L297
[ "def", "run", "(", "self", ")", ":", "case", "=", "self", ".", "case", "baseMVA", "=", "case", ".", "base_mva", "buses", "=", "self", ".", "case", ".", "connected_buses", "branches", "=", "case", ".", "online_branches", "generators", "=", "case", ".", ...
916514255db1ae1661406f0283df756baf960d14
train
StateEstimator.getV0
Returns the initial voltage profile.
pylon/estimator.py
def getV0(self, v_mag_guess, buses, generators, type=CASE_GUESS): """ Returns the initial voltage profile. """ if type == CASE_GUESS: Va = array([b.v_angle * (pi / 180.0) for b in buses]) Vm = array([b.v_magnitude for b in buses]) V0 = Vm * exp(1j * Va) ...
def getV0(self, v_mag_guess, buses, generators, type=CASE_GUESS): """ Returns the initial voltage profile. """ if type == CASE_GUESS: Va = array([b.v_angle * (pi / 180.0) for b in buses]) Vm = array([b.v_magnitude for b in buses]) V0 = Vm * exp(1j * Va) ...
[ "Returns", "the", "initial", "voltage", "profile", "." ]
rwl/pylon
python
https://github.com/rwl/pylon/blob/916514255db1ae1661406f0283df756baf960d14/pylon/estimator.py#L300-L321
[ "def", "getV0", "(", "self", ",", "v_mag_guess", ",", "buses", ",", "generators", ",", "type", "=", "CASE_GUESS", ")", ":", "if", "type", "==", "CASE_GUESS", ":", "Va", "=", "array", "(", "[", "b", ".", "v_angle", "*", "(", "pi", "/", "180.0", ")",...
916514255db1ae1661406f0283df756baf960d14
train
StateEstimator.output_solution
Prints comparison of measurements and their estimations.
pylon/estimator.py
def output_solution(self, fd, z, z_est, error_sqrsum): """ Prints comparison of measurements and their estimations. """ col_width = 11 sep = ("=" * col_width + " ") * 4 + "\n" fd.write("State Estimation\n") fd.write("-" * 16 + "\n") fd.write(sep) fd.write...
def output_solution(self, fd, z, z_est, error_sqrsum): """ Prints comparison of measurements and their estimations. """ col_width = 11 sep = ("=" * col_width + " ") * 4 + "\n" fd.write("State Estimation\n") fd.write("-" * 16 + "\n") fd.write(sep) fd.write...
[ "Prints", "comparison", "of", "measurements", "and", "their", "estimations", "." ]
rwl/pylon
python
https://github.com/rwl/pylon/blob/916514255db1ae1661406f0283df756baf960d14/pylon/estimator.py#L324-L352
[ "def", "output_solution", "(", "self", ",", "fd", ",", "z", ",", "z_est", ",", "error_sqrsum", ")", ":", "col_width", "=", "11", "sep", "=", "(", "\"=\"", "*", "col_width", "+", "\" \"", ")", "*", "4", "+", "\"\\n\"", "fd", ".", "write", "(", "\"St...
916514255db1ae1661406f0283df756baf960d14
train
Auction.run
Clears a set of bids and offers.
pyreto/auction.py
def run(self): """ Clears a set of bids and offers. """ # Compute cleared offer/bid quantities from total dispatched quantity. self._clearQuantities() # Compute shift values to add to lam to get desired pricing. # lao, fro, lab, frb = self._first_rejected_last_accepted() ...
def run(self): """ Clears a set of bids and offers. """ # Compute cleared offer/bid quantities from total dispatched quantity. self._clearQuantities() # Compute shift values to add to lam to get desired pricing. # lao, fro, lab, frb = self._first_rejected_last_accepted() ...
[ "Clears", "a", "set", "of", "bids", "and", "offers", "." ]
rwl/pylon
python
https://github.com/rwl/pylon/blob/916514255db1ae1661406f0283df756baf960d14/pyreto/auction.py#L85-L103
[ "def", "run", "(", "self", ")", ":", "# Compute cleared offer/bid quantities from total dispatched quantity.", "self", ".", "_clearQuantities", "(", ")", "# Compute shift values to add to lam to get desired pricing.", "# lao, fro, lab, frb = self._first_rejected_last_accepted()", ...
916514255db1ae1661406f0283df756baf960d14
train
Auction._clearQuantities
Computes the cleared quantities for each offer/bid according to the dispatched output from the OPF solution.
pyreto/auction.py
def _clearQuantities(self): """ Computes the cleared quantities for each offer/bid according to the dispatched output from the OPF solution. """ generators = [g for g in self.case.generators if not g.is_load] vLoads = [g for g in self.case.generators if g.is_load] for g ...
def _clearQuantities(self): """ Computes the cleared quantities for each offer/bid according to the dispatched output from the OPF solution. """ generators = [g for g in self.case.generators if not g.is_load] vLoads = [g for g in self.case.generators if g.is_load] for g ...
[ "Computes", "the", "cleared", "quantities", "for", "each", "offer", "/", "bid", "according", "to", "the", "dispatched", "output", "from", "the", "OPF", "solution", "." ]
rwl/pylon
python
https://github.com/rwl/pylon/blob/916514255db1ae1661406f0283df756baf960d14/pyreto/auction.py#L106-L117
[ "def", "_clearQuantities", "(", "self", ")", ":", "generators", "=", "[", "g", "for", "g", "in", "self", ".", "case", ".", "generators", "if", "not", "g", ".", "is_load", "]", "vLoads", "=", "[", "g", "for", "g", "in", "self", ".", "case", ".", "...
916514255db1ae1661406f0283df756baf960d14
train
Auction._clearQuantity
Computes the cleared bid quantity from total dispatched quantity.
pyreto/auction.py
def _clearQuantity(self, offbids, gen): """ Computes the cleared bid quantity from total dispatched quantity. """ # Filter out offers/bids not applicable to the generator in question. gOffbids = [offer for offer in offbids if offer.generator == gen] # Offers/bids within valid pr...
def _clearQuantity(self, offbids, gen): """ Computes the cleared bid quantity from total dispatched quantity. """ # Filter out offers/bids not applicable to the generator in question. gOffbids = [offer for offer in offbids if offer.generator == gen] # Offers/bids within valid pr...
[ "Computes", "the", "cleared", "bid", "quantity", "from", "total", "dispatched", "quantity", "." ]
rwl/pylon
python
https://github.com/rwl/pylon/blob/916514255db1ae1661406f0283df756baf960d14/pyreto/auction.py#L120-L158
[ "def", "_clearQuantity", "(", "self", ",", "offbids", ",", "gen", ")", ":", "# Filter out offers/bids not applicable to the generator in question.", "gOffbids", "=", "[", "offer", "for", "offer", "in", "offbids", "if", "offer", ".", "generator", "==", "gen", "]", ...
916514255db1ae1661406f0283df756baf960d14
train
Auction._clearPrices
Clears prices according to auction type.
pyreto/auction.py
def _clearPrices(self): """ Clears prices according to auction type. """ for offbid in self.offers + self.bids: if self.auctionType == DISCRIMINATIVE: offbid.clearedPrice = offbid.price elif self.auctionType == FIRST_PRICE: offbid.clearedPr...
def _clearPrices(self): """ Clears prices according to auction type. """ for offbid in self.offers + self.bids: if self.auctionType == DISCRIMINATIVE: offbid.clearedPrice = offbid.price elif self.auctionType == FIRST_PRICE: offbid.clearedPr...
[ "Clears", "prices", "according", "to", "auction", "type", "." ]
rwl/pylon
python
https://github.com/rwl/pylon/blob/916514255db1ae1661406f0283df756baf960d14/pyreto/auction.py#L219-L228
[ "def", "_clearPrices", "(", "self", ")", ":", "for", "offbid", "in", "self", ".", "offers", "+", "self", ".", "bids", ":", "if", "self", ".", "auctionType", "==", "DISCRIMINATIVE", ":", "offbid", ".", "clearedPrice", "=", "offbid", ".", "price", "elif", ...
916514255db1ae1661406f0283df756baf960d14
train
Auction._clipPrices
Clip cleared prices according to guarantees and limits.
pyreto/auction.py
def _clipPrices(self): """ Clip cleared prices according to guarantees and limits. """ # Guarantee that cleared offer prices are >= offers. if self.guaranteeOfferPrice: for offer in self.offers: if offer.accepted and offer.clearedPrice < offer.price: ...
def _clipPrices(self): """ Clip cleared prices according to guarantees and limits. """ # Guarantee that cleared offer prices are >= offers. if self.guaranteeOfferPrice: for offer in self.offers: if offer.accepted and offer.clearedPrice < offer.price: ...
[ "Clip", "cleared", "prices", "according", "to", "guarantees", "and", "limits", "." ]
rwl/pylon
python
https://github.com/rwl/pylon/blob/916514255db1ae1661406f0283df756baf960d14/pyreto/auction.py#L265-L311
[ "def", "_clipPrices", "(", "self", ")", ":", "# Guarantee that cleared offer prices are >= offers.", "if", "self", ".", "guaranteeOfferPrice", ":", "for", "offer", "in", "self", ".", "offers", ":", "if", "offer", ".", "accepted", "and", "offer", ".", "clearedPrice...
916514255db1ae1661406f0283df756baf960d14
train
Auction._logClearances
Logs offer/bid cleared values.
pyreto/auction.py
def _logClearances(self): """ Logs offer/bid cleared values. """ for offer in self.offers: logger.info("%.2fMW offer cleared at %.2f$/MWh for %s (%.2f)." % (offer.clearedQuantity, offer.clearedPrice, offer.generator.name, offer.revenue...
def _logClearances(self): """ Logs offer/bid cleared values. """ for offer in self.offers: logger.info("%.2fMW offer cleared at %.2f$/MWh for %s (%.2f)." % (offer.clearedQuantity, offer.clearedPrice, offer.generator.name, offer.revenue...
[ "Logs", "offer", "/", "bid", "cleared", "values", "." ]
rwl/pylon
python
https://github.com/rwl/pylon/blob/916514255db1ae1661406f0283df756baf960d14/pyreto/auction.py#L314-L324
[ "def", "_logClearances", "(", "self", ")", ":", "for", "offer", "in", "self", ".", "offers", ":", "logger", ".", "info", "(", "\"%.2fMW offer cleared at %.2f$/MWh for %s (%.2f).\"", "%", "(", "offer", ".", "clearedQuantity", ",", "offer", ".", "clearedPrice", ",...
916514255db1ae1661406f0283df756baf960d14
train
wait_for_response
Try make a GET request with an HTTP client against a certain path and return once any response has been received, ignoring any errors. :param ContainerHttpClient client: The HTTP client to use to connect to the container. :param timeout: Timeout value in seconds. :param path: HT...
seaworthy/client.py
def wait_for_response(client, timeout, path='/', expected_status_code=None): """ Try make a GET request with an HTTP client against a certain path and return once any response has been received, ignoring any errors. :param ContainerHttpClient client: The HTTP client to use to connect to the con...
def wait_for_response(client, timeout, path='/', expected_status_code=None): """ Try make a GET request with an HTTP client against a certain path and return once any response has been received, ignoring any errors. :param ContainerHttpClient client: The HTTP client to use to connect to the con...
[ "Try", "make", "a", "GET", "request", "with", "an", "HTTP", "client", "against", "a", "certain", "path", "and", "return", "once", "any", "response", "has", "been", "received", "ignoring", "any", "errors", "." ]
praekeltfoundation/seaworthy
python
https://github.com/praekeltfoundation/seaworthy/blob/6f10a19b45d4ea1dc3bd0553cc4d0438696c079c/seaworthy/client.py#L205-L248
[ "def", "wait_for_response", "(", "client", ",", "timeout", ",", "path", "=", "'/'", ",", "expected_status_code", "=", "None", ")", ":", "# We want time.monotonic on Pythons that have it, otherwise time.time will", "# have to do.", "get_time", "=", "getattr", "(", "time", ...
6f10a19b45d4ea1dc3bd0553cc4d0438696c079c
train
ContainerHttpClient.for_container
:param container: The container to make requests against. :param container_port: The container port to make requests against. If ``None``, the first container port is used. :returns: A ContainerClient object configured to make requests to the c...
seaworthy/client.py
def for_container(cls, container, container_port=None): """ :param container: The container to make requests against. :param container_port: The container port to make requests against. If ``None``, the first container port is used. :returns: ...
def for_container(cls, container, container_port=None): """ :param container: The container to make requests against. :param container_port: The container port to make requests against. If ``None``, the first container port is used. :returns: ...
[ ":", "param", "container", ":", "The", "container", "to", "make", "requests", "against", ".", ":", "param", "container_port", ":", "The", "container", "port", "to", "make", "requests", "against", ".", "If", "None", "the", "first", "container", "port", "is", ...
praekeltfoundation/seaworthy
python
https://github.com/praekeltfoundation/seaworthy/blob/6f10a19b45d4ea1dc3bd0553cc4d0438696c079c/seaworthy/client.py#L66-L82
[ "def", "for_container", "(", "cls", ",", "container", ",", "container_port", "=", "None", ")", ":", "if", "container_port", "is", "not", "None", ":", "host", ",", "port", "=", "container", ".", "get_host_port", "(", "container_port", ")", "else", ":", "hos...
6f10a19b45d4ea1dc3bd0553cc4d0438696c079c
train
ContainerHttpClient.request
Make a request against a container. :param method: The HTTP method to use. :param list path: The HTTP path (either absolute or relative). :param dict url_kwargs: Parameters to override in the generated URL. See `~hyperlink.URL`. :param kwargs: ...
seaworthy/client.py
def request(self, method, path=None, url_kwargs=None, **kwargs): """ Make a request against a container. :param method: The HTTP method to use. :param list path: The HTTP path (either absolute or relative). :param dict url_kwargs: Parameters t...
def request(self, method, path=None, url_kwargs=None, **kwargs): """ Make a request against a container. :param method: The HTTP method to use. :param list path: The HTTP path (either absolute or relative). :param dict url_kwargs: Parameters t...
[ "Make", "a", "request", "against", "a", "container", "." ]
praekeltfoundation/seaworthy
python
https://github.com/praekeltfoundation/seaworthy/blob/6f10a19b45d4ea1dc3bd0553cc4d0438696c079c/seaworthy/client.py#L90-L104
[ "def", "request", "(", "self", ",", "method", ",", "path", "=", "None", ",", "url_kwargs", "=", "None", ",", "*", "*", "kwargs", ")", ":", "return", "self", ".", "_session", ".", "request", "(", "method", ",", "self", ".", "_url", "(", "path", ",",...
6f10a19b45d4ea1dc3bd0553cc4d0438696c079c
train
ContainerHttpClient.get
Sends a GET request. :param path: The HTTP path (either absolute or relative). :param url_kwargs: Parameters to override in the generated URL. See `~hyperlink.URL`. :param **kwargs: Optional arguments that ``request`` takes. :return: response object
seaworthy/client.py
def get(self, path=None, url_kwargs=None, **kwargs): """ Sends a GET request. :param path: The HTTP path (either absolute or relative). :param url_kwargs: Parameters to override in the generated URL. See `~hyperlink.URL`. :param **kwargs: Opti...
def get(self, path=None, url_kwargs=None, **kwargs): """ Sends a GET request. :param path: The HTTP path (either absolute or relative). :param url_kwargs: Parameters to override in the generated URL. See `~hyperlink.URL`. :param **kwargs: Opti...
[ "Sends", "a", "GET", "request", "." ]
praekeltfoundation/seaworthy
python
https://github.com/praekeltfoundation/seaworthy/blob/6f10a19b45d4ea1dc3bd0553cc4d0438696c079c/seaworthy/client.py#L106-L118
[ "def", "get", "(", "self", ",", "path", "=", "None", ",", "url_kwargs", "=", "None", ",", "*", "*", "kwargs", ")", ":", "return", "self", ".", "_session", ".", "get", "(", "self", ".", "_url", "(", "path", ",", "url_kwargs", ")", ",", "*", "*", ...
6f10a19b45d4ea1dc3bd0553cc4d0438696c079c
train
ContainerHttpClient.options
Sends an OPTIONS request. :param path: The HTTP path (either absolute or relative). :param url_kwargs: Parameters to override in the generated URL. See `~hyperlink.URL`. :param **kwargs: Optional arguments that ``request`` takes. :return: response obj...
seaworthy/client.py
def options(self, path=None, url_kwargs=None, **kwargs): """ Sends an OPTIONS request. :param path: The HTTP path (either absolute or relative). :param url_kwargs: Parameters to override in the generated URL. See `~hyperlink.URL`. :param **kwargs: ...
def options(self, path=None, url_kwargs=None, **kwargs): """ Sends an OPTIONS request. :param path: The HTTP path (either absolute or relative). :param url_kwargs: Parameters to override in the generated URL. See `~hyperlink.URL`. :param **kwargs: ...
[ "Sends", "an", "OPTIONS", "request", "." ]
praekeltfoundation/seaworthy
python
https://github.com/praekeltfoundation/seaworthy/blob/6f10a19b45d4ea1dc3bd0553cc4d0438696c079c/seaworthy/client.py#L120-L132
[ "def", "options", "(", "self", ",", "path", "=", "None", ",", "url_kwargs", "=", "None", ",", "*", "*", "kwargs", ")", ":", "return", "self", ".", "_session", ".", "options", "(", "self", ".", "_url", "(", "path", ",", "url_kwargs", ")", ",", "*", ...
6f10a19b45d4ea1dc3bd0553cc4d0438696c079c
train
ContainerHttpClient.head
Sends a HEAD request. :param path: The HTTP path (either absolute or relative). :param url_kwargs: Parameters to override in the generated URL. See `~hyperlink.URL`. :param **kwargs: Optional arguments that ``request`` takes. :return: response object
seaworthy/client.py
def head(self, path=None, url_kwargs=None, **kwargs): """ Sends a HEAD request. :param path: The HTTP path (either absolute or relative). :param url_kwargs: Parameters to override in the generated URL. See `~hyperlink.URL`. :param **kwargs: Op...
def head(self, path=None, url_kwargs=None, **kwargs): """ Sends a HEAD request. :param path: The HTTP path (either absolute or relative). :param url_kwargs: Parameters to override in the generated URL. See `~hyperlink.URL`. :param **kwargs: Op...
[ "Sends", "a", "HEAD", "request", "." ]
praekeltfoundation/seaworthy
python
https://github.com/praekeltfoundation/seaworthy/blob/6f10a19b45d4ea1dc3bd0553cc4d0438696c079c/seaworthy/client.py#L134-L146
[ "def", "head", "(", "self", ",", "path", "=", "None", ",", "url_kwargs", "=", "None", ",", "*", "*", "kwargs", ")", ":", "return", "self", ".", "_session", ".", "head", "(", "self", ".", "_url", "(", "path", ",", "url_kwargs", ")", ",", "*", "*",...
6f10a19b45d4ea1dc3bd0553cc4d0438696c079c
train
ContainerHttpClient.post
Sends a POST request. :param path: The HTTP path (either absolute or relative). :param url_kwargs: Parameters to override in the generated URL. See `~hyperlink.URL`. :param **kwargs: Optional arguments that ``request`` takes. :return: response object
seaworthy/client.py
def post(self, path=None, url_kwargs=None, **kwargs): """ Sends a POST request. :param path: The HTTP path (either absolute or relative). :param url_kwargs: Parameters to override in the generated URL. See `~hyperlink.URL`. :param **kwargs: Op...
def post(self, path=None, url_kwargs=None, **kwargs): """ Sends a POST request. :param path: The HTTP path (either absolute or relative). :param url_kwargs: Parameters to override in the generated URL. See `~hyperlink.URL`. :param **kwargs: Op...
[ "Sends", "a", "POST", "request", "." ]
praekeltfoundation/seaworthy
python
https://github.com/praekeltfoundation/seaworthy/blob/6f10a19b45d4ea1dc3bd0553cc4d0438696c079c/seaworthy/client.py#L148-L160
[ "def", "post", "(", "self", ",", "path", "=", "None", ",", "url_kwargs", "=", "None", ",", "*", "*", "kwargs", ")", ":", "return", "self", ".", "_session", ".", "post", "(", "self", ".", "_url", "(", "path", ",", "url_kwargs", ")", ",", "*", "*",...
6f10a19b45d4ea1dc3bd0553cc4d0438696c079c
train
ContainerHttpClient.put
Sends a PUT request. :param path: The HTTP path (either absolute or relative). :param url_kwargs: Parameters to override in the generated URL. See `~hyperlink.URL`. :param **kwargs: Optional arguments that ``request`` takes. :return: response object
seaworthy/client.py
def put(self, path=None, url_kwargs=None, **kwargs): """ Sends a PUT request. :param path: The HTTP path (either absolute or relative). :param url_kwargs: Parameters to override in the generated URL. See `~hyperlink.URL`. :param **kwargs: Opti...
def put(self, path=None, url_kwargs=None, **kwargs): """ Sends a PUT request. :param path: The HTTP path (either absolute or relative). :param url_kwargs: Parameters to override in the generated URL. See `~hyperlink.URL`. :param **kwargs: Opti...
[ "Sends", "a", "PUT", "request", "." ]
praekeltfoundation/seaworthy
python
https://github.com/praekeltfoundation/seaworthy/blob/6f10a19b45d4ea1dc3bd0553cc4d0438696c079c/seaworthy/client.py#L162-L174
[ "def", "put", "(", "self", ",", "path", "=", "None", ",", "url_kwargs", "=", "None", ",", "*", "*", "kwargs", ")", ":", "return", "self", ".", "_session", ".", "put", "(", "self", ".", "_url", "(", "path", ",", "url_kwargs", ")", ",", "*", "*", ...
6f10a19b45d4ea1dc3bd0553cc4d0438696c079c
train
ContainerHttpClient.patch
Sends a PUT request. :param path: The HTTP path (either absolute or relative). :param url_kwargs: Parameters to override in the generated URL. See `~hyperlink.URL`. :param **kwargs: Optional arguments that ``request`` takes. :return: response object
seaworthy/client.py
def patch(self, path=None, url_kwargs=None, **kwargs): """ Sends a PUT request. :param path: The HTTP path (either absolute or relative). :param url_kwargs: Parameters to override in the generated URL. See `~hyperlink.URL`. :param **kwargs: Op...
def patch(self, path=None, url_kwargs=None, **kwargs): """ Sends a PUT request. :param path: The HTTP path (either absolute or relative). :param url_kwargs: Parameters to override in the generated URL. See `~hyperlink.URL`. :param **kwargs: Op...
[ "Sends", "a", "PUT", "request", "." ]
praekeltfoundation/seaworthy
python
https://github.com/praekeltfoundation/seaworthy/blob/6f10a19b45d4ea1dc3bd0553cc4d0438696c079c/seaworthy/client.py#L176-L188
[ "def", "patch", "(", "self", ",", "path", "=", "None", ",", "url_kwargs", "=", "None", ",", "*", "*", "kwargs", ")", ":", "return", "self", ".", "_session", ".", "patch", "(", "self", ".", "_url", "(", "path", ",", "url_kwargs", ")", ",", "*", "*...
6f10a19b45d4ea1dc3bd0553cc4d0438696c079c
train
ContainerHttpClient.delete
Sends a PUT request. :param path: The HTTP path (either absolute or relative). :param url_kwargs: Parameters to override in the generated URL. See `~hyperlink.URL`. :param **kwargs: Optional arguments that ``request`` takes. :return: response object
seaworthy/client.py
def delete(self, path=None, url_kwargs=None, **kwargs): """ Sends a PUT request. :param path: The HTTP path (either absolute or relative). :param url_kwargs: Parameters to override in the generated URL. See `~hyperlink.URL`. :param **kwargs: O...
def delete(self, path=None, url_kwargs=None, **kwargs): """ Sends a PUT request. :param path: The HTTP path (either absolute or relative). :param url_kwargs: Parameters to override in the generated URL. See `~hyperlink.URL`. :param **kwargs: O...
[ "Sends", "a", "PUT", "request", "." ]
praekeltfoundation/seaworthy
python
https://github.com/praekeltfoundation/seaworthy/blob/6f10a19b45d4ea1dc3bd0553cc4d0438696c079c/seaworthy/client.py#L190-L202
[ "def", "delete", "(", "self", ",", "path", "=", "None", ",", "url_kwargs", "=", "None", ",", "*", "*", "kwargs", ")", ":", "return", "self", ".", "_session", ".", "delete", "(", "self", ".", "_url", "(", "path", ",", "url_kwargs", ")", ",", "*", ...
6f10a19b45d4ea1dc3bd0553cc4d0438696c079c
train
iuwt_decomposition
This function serves as a handler for the different implementations of the IUWT decomposition. It allows the different methods to be used almost interchangeably. INPUTS: in1 (no default): Array on which the decomposition is to be performed. scale_count (no default): ...
pymoresane/iuwt.py
def iuwt_decomposition(in1, scale_count, scale_adjust=0, mode='ser', core_count=2, store_smoothed=False, store_on_gpu=False): """ This function serves as a handler for the different implementations of the IUWT decomposition. It allows the different methods to be used almost interchang...
def iuwt_decomposition(in1, scale_count, scale_adjust=0, mode='ser', core_count=2, store_smoothed=False, store_on_gpu=False): """ This function serves as a handler for the different implementations of the IUWT decomposition. It allows the different methods to be used almost interchang...
[ "This", "function", "serves", "as", "a", "handler", "for", "the", "different", "implementations", "of", "the", "IUWT", "decomposition", ".", "It", "allows", "the", "different", "methods", "to", "be", "used", "almost", "interchangeably", "." ]
ratt-ru/PyMORESANE
python
https://github.com/ratt-ru/PyMORESANE/blob/b024591ad0bbb69320d08841f28a2c27f62ae1af/pymoresane/iuwt.py#L17-L41
[ "def", "iuwt_decomposition", "(", "in1", ",", "scale_count", ",", "scale_adjust", "=", "0", ",", "mode", "=", "'ser'", ",", "core_count", "=", "2", ",", "store_smoothed", "=", "False", ",", "store_on_gpu", "=", "False", ")", ":", "if", "mode", "==", "'se...
b024591ad0bbb69320d08841f28a2c27f62ae1af
train
iuwt_recomposition
This function serves as a handler for the different implementations of the IUWT recomposition. It allows the different methods to be used almost interchangeably. INPUTS: in1 (no default): Array on which the decomposition is to be performed. scale_adjust (no default): ...
pymoresane/iuwt.py
def iuwt_recomposition(in1, scale_adjust=0, mode='ser', core_count=1, store_on_gpu=False, smoothed_array=None): """ This function serves as a handler for the different implementations of the IUWT recomposition. It allows the different methods to be used almost interchangeably. INPUTS: in1 ...
def iuwt_recomposition(in1, scale_adjust=0, mode='ser', core_count=1, store_on_gpu=False, smoothed_array=None): """ This function serves as a handler for the different implementations of the IUWT recomposition. It allows the different methods to be used almost interchangeably. INPUTS: in1 ...
[ "This", "function", "serves", "as", "a", "handler", "for", "the", "different", "implementations", "of", "the", "IUWT", "recomposition", ".", "It", "allows", "the", "different", "methods", "to", "be", "used", "almost", "interchangeably", "." ]
ratt-ru/PyMORESANE
python
https://github.com/ratt-ru/PyMORESANE/blob/b024591ad0bbb69320d08841f28a2c27f62ae1af/pymoresane/iuwt.py#L43-L64
[ "def", "iuwt_recomposition", "(", "in1", ",", "scale_adjust", "=", "0", ",", "mode", "=", "'ser'", ",", "core_count", "=", "1", ",", "store_on_gpu", "=", "False", ",", "smoothed_array", "=", "None", ")", ":", "if", "mode", "==", "'ser'", ":", "return", ...
b024591ad0bbb69320d08841f28a2c27f62ae1af
train
ser_iuwt_decomposition
This function calls the a trous algorithm code to decompose the input into its wavelet coefficients. This is the isotropic undecimated wavelet transform implemented for a single CPU core. INPUTS: in1 (no default): Array on which the decomposition is to be performed. scale_count ...
pymoresane/iuwt.py
def ser_iuwt_decomposition(in1, scale_count, scale_adjust, store_smoothed): """ This function calls the a trous algorithm code to decompose the input into its wavelet coefficients. This is the isotropic undecimated wavelet transform implemented for a single CPU core. INPUTS: in1 (no...
def ser_iuwt_decomposition(in1, scale_count, scale_adjust, store_smoothed): """ This function calls the a trous algorithm code to decompose the input into its wavelet coefficients. This is the isotropic undecimated wavelet transform implemented for a single CPU core. INPUTS: in1 (no...
[ "This", "function", "calls", "the", "a", "trous", "algorithm", "code", "to", "decompose", "the", "input", "into", "its", "wavelet", "coefficients", ".", "This", "is", "the", "isotropic", "undecimated", "wavelet", "transform", "implemented", "for", "a", "single",...
ratt-ru/PyMORESANE
python
https://github.com/ratt-ru/PyMORESANE/blob/b024591ad0bbb69320d08841f28a2c27f62ae1af/pymoresane/iuwt.py#L66-L111
[ "def", "ser_iuwt_decomposition", "(", "in1", ",", "scale_count", ",", "scale_adjust", ",", "store_smoothed", ")", ":", "wavelet_filter", "=", "(", "1.", "/", "16", ")", "*", "np", ".", "array", "(", "[", "1", ",", "4", ",", "6", ",", "4", ",", "1", ...
b024591ad0bbb69320d08841f28a2c27f62ae1af
train
ser_iuwt_recomposition
This function calls the a trous algorithm code to recompose the input into a single array. This is the implementation of the isotropic undecimated wavelet transform recomposition for a single CPU core. INPUTS: in1 (no default): Array containing wavelet coefficients. scale_adjust (no de...
pymoresane/iuwt.py
def ser_iuwt_recomposition(in1, scale_adjust, smoothed_array): """ This function calls the a trous algorithm code to recompose the input into a single array. This is the implementation of the isotropic undecimated wavelet transform recomposition for a single CPU core. INPUTS: in1 (no de...
def ser_iuwt_recomposition(in1, scale_adjust, smoothed_array): """ This function calls the a trous algorithm code to recompose the input into a single array. This is the implementation of the isotropic undecimated wavelet transform recomposition for a single CPU core. INPUTS: in1 (no de...
[ "This", "function", "calls", "the", "a", "trous", "algorithm", "code", "to", "recompose", "the", "input", "into", "a", "single", "array", ".", "This", "is", "the", "implementation", "of", "the", "isotropic", "undecimated", "wavelet", "transform", "recomposition"...
ratt-ru/PyMORESANE
python
https://github.com/ratt-ru/PyMORESANE/blob/b024591ad0bbb69320d08841f28a2c27f62ae1af/pymoresane/iuwt.py#L113-L149
[ "def", "ser_iuwt_recomposition", "(", "in1", ",", "scale_adjust", ",", "smoothed_array", ")", ":", "wavelet_filter", "=", "(", "1.", "/", "16", ")", "*", "np", ".", "array", "(", "[", "1", ",", "4", ",", "6", ",", "4", ",", "1", "]", ")", "# Filter...
b024591ad0bbb69320d08841f28a2c27f62ae1af
train
ser_a_trous
The following is a serial implementation of the a trous algorithm. Accepts the following parameters: INPUTS: filter (no default): The filter-bank which is applied to the components of the transform. C0 (no default): The current array on which filtering is to be performed. scale ...
pymoresane/iuwt.py
def ser_a_trous(C0, filter, scale): """ The following is a serial implementation of the a trous algorithm. Accepts the following parameters: INPUTS: filter (no default): The filter-bank which is applied to the components of the transform. C0 (no default): The current array on whic...
def ser_a_trous(C0, filter, scale): """ The following is a serial implementation of the a trous algorithm. Accepts the following parameters: INPUTS: filter (no default): The filter-bank which is applied to the components of the transform. C0 (no default): The current array on whic...
[ "The", "following", "is", "a", "serial", "implementation", "of", "the", "a", "trous", "algorithm", ".", "Accepts", "the", "following", "parameters", ":" ]
ratt-ru/PyMORESANE
python
https://github.com/ratt-ru/PyMORESANE/blob/b024591ad0bbb69320d08841f28a2c27f62ae1af/pymoresane/iuwt.py#L151-L191
[ "def", "ser_a_trous", "(", "C0", ",", "filter", ",", "scale", ")", ":", "tmp", "=", "filter", "[", "2", "]", "*", "C0", "tmp", "[", "(", "2", "**", "(", "scale", "+", "1", ")", ")", ":", ",", ":", "]", "+=", "filter", "[", "0", "]", "*", ...
b024591ad0bbb69320d08841f28a2c27f62ae1af
train
mp_iuwt_decomposition
This function calls the a trous algorithm code to decompose the input into its wavelet coefficients. This is the isotropic undecimated wavelet transform implemented for multiple CPU cores. NOTE: Python is not well suited to multiprocessing - this may not improve execution speed. INPUTS: in1 ...
pymoresane/iuwt.py
def mp_iuwt_decomposition(in1, scale_count, scale_adjust, store_smoothed, core_count): """ This function calls the a trous algorithm code to decompose the input into its wavelet coefficients. This is the isotropic undecimated wavelet transform implemented for multiple CPU cores. NOTE: Python is not well sui...
def mp_iuwt_decomposition(in1, scale_count, scale_adjust, store_smoothed, core_count): """ This function calls the a trous algorithm code to decompose the input into its wavelet coefficients. This is the isotropic undecimated wavelet transform implemented for multiple CPU cores. NOTE: Python is not well sui...
[ "This", "function", "calls", "the", "a", "trous", "algorithm", "code", "to", "decompose", "the", "input", "into", "its", "wavelet", "coefficients", ".", "This", "is", "the", "isotropic", "undecimated", "wavelet", "transform", "implemented", "for", "multiple", "C...
ratt-ru/PyMORESANE
python
https://github.com/ratt-ru/PyMORESANE/blob/b024591ad0bbb69320d08841f28a2c27f62ae1af/pymoresane/iuwt.py#L193-L240
[ "def", "mp_iuwt_decomposition", "(", "in1", ",", "scale_count", ",", "scale_adjust", ",", "store_smoothed", ",", "core_count", ")", ":", "wavelet_filter", "=", "(", "1.", "/", "16", ")", "*", "np", ".", "array", "(", "[", "1", ",", "4", ",", "6", ",", ...
b024591ad0bbb69320d08841f28a2c27f62ae1af
train
mp_iuwt_recomposition
This function calls the a trous algorithm code to recompose the input into a single array. This is the implementation of the isotropic undecimated wavelet transform recomposition for multiple CPU cores. INPUTS: in1 (no default): Array containing wavelet coefficients. scale_adjust (no d...
pymoresane/iuwt.py
def mp_iuwt_recomposition(in1, scale_adjust, core_count, smoothed_array): """ This function calls the a trous algorithm code to recompose the input into a single array. This is the implementation of the isotropic undecimated wavelet transform recomposition for multiple CPU cores. INPUTS: in1 ...
def mp_iuwt_recomposition(in1, scale_adjust, core_count, smoothed_array): """ This function calls the a trous algorithm code to recompose the input into a single array. This is the implementation of the isotropic undecimated wavelet transform recomposition for multiple CPU cores. INPUTS: in1 ...
[ "This", "function", "calls", "the", "a", "trous", "algorithm", "code", "to", "recompose", "the", "input", "into", "a", "single", "array", ".", "This", "is", "the", "implementation", "of", "the", "isotropic", "undecimated", "wavelet", "transform", "recomposition"...
ratt-ru/PyMORESANE
python
https://github.com/ratt-ru/PyMORESANE/blob/b024591ad0bbb69320d08841f28a2c27f62ae1af/pymoresane/iuwt.py#L242-L279
[ "def", "mp_iuwt_recomposition", "(", "in1", ",", "scale_adjust", ",", "core_count", ",", "smoothed_array", ")", ":", "wavelet_filter", "=", "(", "1.", "/", "16", ")", "*", "np", ".", "array", "(", "[", "1", ",", "4", ",", "6", ",", "4", ",", "1", "...
b024591ad0bbb69320d08841f28a2c27f62ae1af
train
mp_a_trous
This is a reimplementation of the a trous filter which makes use of multiprocessing. In particular, it divides the input array of dimensions NxN into M smaller arrays of dimensions (N/M)xN, where M is the number of cores which are to be used. INPUTS: C0 (no default): The current array wh...
pymoresane/iuwt.py
def mp_a_trous(C0, wavelet_filter, scale, core_count): """ This is a reimplementation of the a trous filter which makes use of multiprocessing. In particular, it divides the input array of dimensions NxN into M smaller arrays of dimensions (N/M)xN, where M is the number of cores which are to be used. ...
def mp_a_trous(C0, wavelet_filter, scale, core_count): """ This is a reimplementation of the a trous filter which makes use of multiprocessing. In particular, it divides the input array of dimensions NxN into M smaller arrays of dimensions (N/M)xN, where M is the number of cores which are to be used. ...
[ "This", "is", "a", "reimplementation", "of", "the", "a", "trous", "filter", "which", "makes", "use", "of", "multiprocessing", ".", "In", "particular", "it", "divides", "the", "input", "array", "of", "dimensions", "NxN", "into", "M", "smaller", "arrays", "of"...
ratt-ru/PyMORESANE
python
https://github.com/ratt-ru/PyMORESANE/blob/b024591ad0bbb69320d08841f28a2c27f62ae1af/pymoresane/iuwt.py#L281-L328
[ "def", "mp_a_trous", "(", "C0", ",", "wavelet_filter", ",", "scale", ",", "core_count", ")", ":", "# Creates an array which may be accessed by multiple processes.", "shared_array_base", "=", "mp", ".", "Array", "(", "ctypes", ".", "c_float", ",", "C0", ".", "shape",...
b024591ad0bbb69320d08841f28a2c27f62ae1af
train
mp_a_trous_kernel
This is the convolution step of the a trous algorithm. INPUTS: C0 (no default): The current array which is to be decomposed. wavelet_filter (no default): The filter-bank which is applied to the elements of the transform. scale (no default): The scale at which d...
pymoresane/iuwt.py
def mp_a_trous_kernel(C0, wavelet_filter, scale, slice_ind, slice_width, r_or_c="row"): """ This is the convolution step of the a trous algorithm. INPUTS: C0 (no default): The current array which is to be decomposed. wavelet_filter (no default): The filter-bank which is ap...
def mp_a_trous_kernel(C0, wavelet_filter, scale, slice_ind, slice_width, r_or_c="row"): """ This is the convolution step of the a trous algorithm. INPUTS: C0 (no default): The current array which is to be decomposed. wavelet_filter (no default): The filter-bank which is ap...
[ "This", "is", "the", "convolution", "step", "of", "the", "a", "trous", "algorithm", "." ]
ratt-ru/PyMORESANE
python
https://github.com/ratt-ru/PyMORESANE/blob/b024591ad0bbb69320d08841f28a2c27f62ae1af/pymoresane/iuwt.py#L330-L382
[ "def", "mp_a_trous_kernel", "(", "C0", ",", "wavelet_filter", ",", "scale", ",", "slice_ind", ",", "slice_width", ",", "r_or_c", "=", "\"row\"", ")", ":", "lower_bound", "=", "slice_ind", "*", "slice_width", "upper_bound", "=", "(", "slice_ind", "+", "1", ")...
b024591ad0bbb69320d08841f28a2c27f62ae1af
train
gpu_iuwt_decomposition
This function calls the a trous algorithm code to decompose the input into its wavelet coefficients. This is the isotropic undecimated wavelet transform implemented for a GPU. INPUTS: in1 (no default): Array on which the decomposition is to be performed. scale_count (no defaul...
pymoresane/iuwt.py
def gpu_iuwt_decomposition(in1, scale_count, scale_adjust, store_smoothed, store_on_gpu): """ This function calls the a trous algorithm code to decompose the input into its wavelet coefficients. This is the isotropic undecimated wavelet transform implemented for a GPU. INPUTS: in1 (...
def gpu_iuwt_decomposition(in1, scale_count, scale_adjust, store_smoothed, store_on_gpu): """ This function calls the a trous algorithm code to decompose the input into its wavelet coefficients. This is the isotropic undecimated wavelet transform implemented for a GPU. INPUTS: in1 (...
[ "This", "function", "calls", "the", "a", "trous", "algorithm", "code", "to", "decompose", "the", "input", "into", "its", "wavelet", "coefficients", ".", "This", "is", "the", "isotropic", "undecimated", "wavelet", "transform", "implemented", "for", "a", "GPU", ...
ratt-ru/PyMORESANE
python
https://github.com/ratt-ru/PyMORESANE/blob/b024591ad0bbb69320d08841f28a2c27f62ae1af/pymoresane/iuwt.py#L384-L499
[ "def", "gpu_iuwt_decomposition", "(", "in1", ",", "scale_count", ",", "scale_adjust", ",", "store_smoothed", ",", "store_on_gpu", ")", ":", "# The following simple kernel just allows for the construction of a 3D decomposition on the GPU.", "ker", "=", "SourceModule", "(", "\"\"...
b024591ad0bbb69320d08841f28a2c27f62ae1af
train
gpu_iuwt_recomposition
This function calls the a trous algorithm code to recompose the input into a single array. This is the implementation of the isotropic undecimated wavelet transform recomposition for a GPU. INPUTS: in1 (no default): Array containing wavelet coefficients. scale_adjust (no default): In...
pymoresane/iuwt.py
def gpu_iuwt_recomposition(in1, scale_adjust, store_on_gpu, smoothed_array): """ This function calls the a trous algorithm code to recompose the input into a single array. This is the implementation of the isotropic undecimated wavelet transform recomposition for a GPU. INPUTS: in1 (no ...
def gpu_iuwt_recomposition(in1, scale_adjust, store_on_gpu, smoothed_array): """ This function calls the a trous algorithm code to recompose the input into a single array. This is the implementation of the isotropic undecimated wavelet transform recomposition for a GPU. INPUTS: in1 (no ...
[ "This", "function", "calls", "the", "a", "trous", "algorithm", "code", "to", "recompose", "the", "input", "into", "a", "single", "array", ".", "This", "is", "the", "implementation", "of", "the", "isotropic", "undecimated", "wavelet", "transform", "recomposition"...
ratt-ru/PyMORESANE
python
https://github.com/ratt-ru/PyMORESANE/blob/b024591ad0bbb69320d08841f28a2c27f62ae1af/pymoresane/iuwt.py#L501-L581
[ "def", "gpu_iuwt_recomposition", "(", "in1", ",", "scale_adjust", ",", "store_on_gpu", ",", "smoothed_array", ")", ":", "wavelet_filter", "=", "(", "1.", "/", "16", ")", "*", "np", ".", "array", "(", "[", "1", ",", "4", ",", "6", ",", "4", ",", "1", ...
b024591ad0bbb69320d08841f28a2c27f62ae1af
train
gpu_a_trous
Simple convenience function so that the a trous kernels can be easily accessed by any function.
pymoresane/iuwt.py
def gpu_a_trous(): """ Simple convenience function so that the a trous kernels can be easily accessed by any function. """ ker1 = SourceModule(""" __global__ void gpu_a_trous_row_kernel(float *in1, float *in2, float *wfil, int *scale) { ...
def gpu_a_trous(): """ Simple convenience function so that the a trous kernels can be easily accessed by any function. """ ker1 = SourceModule(""" __global__ void gpu_a_trous_row_kernel(float *in1, float *in2, float *wfil, int *scale) { ...
[ "Simple", "convenience", "function", "so", "that", "the", "a", "trous", "kernels", "can", "be", "easily", "accessed", "by", "any", "function", "." ]
ratt-ru/PyMORESANE
python
https://github.com/ratt-ru/PyMORESANE/blob/b024591ad0bbb69320d08841f28a2c27f62ae1af/pymoresane/iuwt.py#L583-L661
[ "def", "gpu_a_trous", "(", ")", ":", "ker1", "=", "SourceModule", "(", "\"\"\"\n __global__ void gpu_a_trous_row_kernel(float *in1, float *in2, float *wfil, int *scale)\n {\n const int len = gridDim.x*blockDim.x;\n ...
b024591ad0bbb69320d08841f28a2c27f62ae1af
train
unauth
logout and remove all session data
examples/django/example/djfoursquare/views.py
def unauth(request): """ logout and remove all session data """ if check_key(request): api = get_api(request) request.session.clear() logout(request) return HttpResponseRedirect(reverse('main'))
def unauth(request): """ logout and remove all session data """ if check_key(request): api = get_api(request) request.session.clear() logout(request) return HttpResponseRedirect(reverse('main'))
[ "logout", "and", "remove", "all", "session", "data" ]
marcelcaraciolo/foursquare
python
https://github.com/marcelcaraciolo/foursquare/blob/a8bda33cc2d61e25aa8df72011246269fd98aa13/examples/django/example/djfoursquare/views.py#L22-L30
[ "def", "unauth", "(", "request", ")", ":", "if", "check_key", "(", "request", ")", ":", "api", "=", "get_api", "(", "request", ")", "request", ".", "session", ".", "clear", "(", ")", "logout", "(", "request", ")", "return", "HttpResponseRedirect", "(", ...
a8bda33cc2d61e25aa8df72011246269fd98aa13
train
info
display some user info to show we have authenticated successfully
examples/django/example/djfoursquare/views.py
def info(request): """ display some user info to show we have authenticated successfully """ if check_key(request): api = get_api(request) user = api.users(id='self') print dir(user) return render_to_response('djfoursquare/info.html', {'user': user}) else: ret...
def info(request): """ display some user info to show we have authenticated successfully """ if check_key(request): api = get_api(request) user = api.users(id='self') print dir(user) return render_to_response('djfoursquare/info.html', {'user': user}) else: ret...
[ "display", "some", "user", "info", "to", "show", "we", "have", "authenticated", "successfully" ]
marcelcaraciolo/foursquare
python
https://github.com/marcelcaraciolo/foursquare/blob/a8bda33cc2d61e25aa8df72011246269fd98aa13/examples/django/example/djfoursquare/views.py#L33-L43
[ "def", "info", "(", "request", ")", ":", "if", "check_key", "(", "request", ")", ":", "api", "=", "get_api", "(", "request", ")", "user", "=", "api", ".", "users", "(", "id", "=", "'self'", ")", "print", "dir", "(", "user", ")", "return", "render_t...
a8bda33cc2d61e25aa8df72011246269fd98aa13
train
check_key
Check to see if we already have an access_key stored, if we do then we have already gone through OAuth. If not then we haven't and we probably need to.
examples/django/example/djfoursquare/views.py
def check_key(request): """ Check to see if we already have an access_key stored, if we do then we have already gone through OAuth. If not then we haven't and we probably need to. """ try: access_key = request.session.get('oauth_token', None) if not access_key: return...
def check_key(request): """ Check to see if we already have an access_key stored, if we do then we have already gone through OAuth. If not then we haven't and we probably need to. """ try: access_key = request.session.get('oauth_token', None) if not access_key: return...
[ "Check", "to", "see", "if", "we", "already", "have", "an", "access_key", "stored", "if", "we", "do", "then", "we", "have", "already", "gone", "through", "OAuth", ".", "If", "not", "then", "we", "haven", "t", "and", "we", "probably", "need", "to", "." ]
marcelcaraciolo/foursquare
python
https://github.com/marcelcaraciolo/foursquare/blob/a8bda33cc2d61e25aa8df72011246269fd98aa13/examples/django/example/djfoursquare/views.py#L73-L85
[ "def", "check_key", "(", "request", ")", ":", "try", ":", "access_key", "=", "request", ".", "session", ".", "get", "(", "'oauth_token'", ",", "None", ")", "if", "not", "access_key", ":", "return", "False", "except", "KeyError", ":", "return", "False", "...
a8bda33cc2d61e25aa8df72011246269fd98aa13
train
stream_timeout
Iterate over items in a streaming response from the Docker client within a timeout. :param ~docker.types.daemon.CancellableStream stream: Stream from the Docker client to consume items from. :param timeout: Timeout value in seconds. :param timeout_msg: Message to raise in the ex...
seaworthy/stream/_timeout.py
def stream_timeout(stream, timeout, timeout_msg=None): """ Iterate over items in a streaming response from the Docker client within a timeout. :param ~docker.types.daemon.CancellableStream stream: Stream from the Docker client to consume items from. :param timeout: Timeout value in ...
def stream_timeout(stream, timeout, timeout_msg=None): """ Iterate over items in a streaming response from the Docker client within a timeout. :param ~docker.types.daemon.CancellableStream stream: Stream from the Docker client to consume items from. :param timeout: Timeout value in ...
[ "Iterate", "over", "items", "in", "a", "streaming", "response", "from", "the", "Docker", "client", "within", "a", "timeout", "." ]
praekeltfoundation/seaworthy
python
https://github.com/praekeltfoundation/seaworthy/blob/6f10a19b45d4ea1dc3bd0553cc4d0438696c079c/seaworthy/stream/_timeout.py#L4-L41
[ "def", "stream_timeout", "(", "stream", ",", "timeout", ",", "timeout_msg", "=", "None", ")", ":", "timed_out", "=", "threading", ".", "Event", "(", ")", "def", "timeout_func", "(", ")", ":", "timed_out", ".", "set", "(", ")", "stream", ".", "close", "...
6f10a19b45d4ea1dc3bd0553cc4d0438696c079c
train
AbstractCallable.get_state
Get per-program state.
src/automate/callable.py
def get_state(self, caller): """ Get per-program state. """ if caller in self.state: return self.state[caller] else: rv = self.state[caller] = DictObject() return rv
def get_state(self, caller): """ Get per-program state. """ if caller in self.state: return self.state[caller] else: rv = self.state[caller] = DictObject() return rv
[ "Get", "per", "-", "program", "state", "." ]
tuomas2/automate
python
https://github.com/tuomas2/automate/blob/d8a8cd03cd0da047e033a2d305f3f260f8c4e017/src/automate/callable.py#L74-L83
[ "def", "get_state", "(", "self", ",", "caller", ")", ":", "if", "caller", "in", "self", ".", "state", ":", "return", "self", ".", "state", "[", "caller", "]", "else", ":", "rv", "=", "self", ".", "state", "[", "caller", "]", "=", "DictObject", "(",...
d8a8cd03cd0da047e033a2d305f3f260f8c4e017
train
AbstractCallable.call_eval
Value might be either name registered in System namespace, or object, either StatusObject or Callable. If Callable, evaluate :meth:`.call` method. If StatusObject, return status.
src/automate/callable.py
def call_eval(self, value, caller, return_value=True, **kwargs): """ Value might be either name registered in System namespace, or object, either StatusObject or Callable. If Callable, evaluate :meth:`.call` method. If StatusObject, return status. """ value = ...
def call_eval(self, value, caller, return_value=True, **kwargs): """ Value might be either name registered in System namespace, or object, either StatusObject or Callable. If Callable, evaluate :meth:`.call` method. If StatusObject, return status. """ value = ...
[ "Value", "might", "be", "either", "name", "registered", "in", "System", "namespace", "or", "object", "either", "StatusObject", "or", "Callable", ".", "If", "Callable", "evaluate", ":", "meth", ":", ".", "call", "method", ".", "If", "StatusObject", "return", ...
tuomas2/automate
python
https://github.com/tuomas2/automate/blob/d8a8cd03cd0da047e033a2d305f3f260f8c4e017/src/automate/callable.py#L165-L177
[ "def", "call_eval", "(", "self", ",", "value", ",", "caller", ",", "return_value", "=", "True", ",", "*", "*", "kwargs", ")", ":", "value", "=", "self", ".", "name_to_system_object", "(", "value", ")", "if", "return_value", "and", "isinstance", "(", "val...
d8a8cd03cd0da047e033a2d305f3f260f8c4e017
train
AbstractCallable.setup_callable_system
This function basically sets up :attr:`.system`, if it is not yet set up. After that, other Callable initialization actions are performed. :param init: value ``True`` is given when running this at the initialization phase. Then system attribute is set already, but calla...
src/automate/callable.py
def setup_callable_system(self, system, init=False): """ This function basically sets up :attr:`.system`, if it is not yet set up. After that, other Callable initialization actions are performed. :param init: value ``True`` is given when running this at the initialization ph...
def setup_callable_system(self, system, init=False): """ This function basically sets up :attr:`.system`, if it is not yet set up. After that, other Callable initialization actions are performed. :param init: value ``True`` is given when running this at the initialization ph...
[ "This", "function", "basically", "sets", "up", ":", "attr", ":", ".", "system", "if", "it", "is", "not", "yet", "set", "up", ".", "After", "that", "other", "Callable", "initialization", "actions", "are", "performed", "." ]
tuomas2/automate
python
https://github.com/tuomas2/automate/blob/d8a8cd03cd0da047e033a2d305f3f260f8c4e017/src/automate/callable.py#L192-L211
[ "def", "setup_callable_system", "(", "self", ",", "system", ",", "init", "=", "False", ")", ":", "if", "not", "self", ".", "system", "or", "init", ":", "self", ".", "system", "=", "system", "self", ".", "_fix_list", "(", "self", ".", "_args", ")", "s...
d8a8cd03cd0da047e033a2d305f3f260f8c4e017
train
AbstractCallable.name_to_system_object
Return object for given name registered in System namespace.
src/automate/callable.py
def name_to_system_object(self, value): """ Return object for given name registered in System namespace. """ if not self.system: raise SystemNotReady if isinstance(value, (str, Object)): rv = self.system.name_to_system_object(value) return rv ...
def name_to_system_object(self, value): """ Return object for given name registered in System namespace. """ if not self.system: raise SystemNotReady if isinstance(value, (str, Object)): rv = self.system.name_to_system_object(value) return rv ...
[ "Return", "object", "for", "given", "name", "registered", "in", "System", "namespace", "." ]
tuomas2/automate
python
https://github.com/tuomas2/automate/blob/d8a8cd03cd0da047e033a2d305f3f260f8c4e017/src/automate/callable.py#L250-L261
[ "def", "name_to_system_object", "(", "self", ",", "value", ")", ":", "if", "not", "self", ".", "system", ":", "raise", "SystemNotReady", "if", "isinstance", "(", "value", ",", "(", "str", ",", "Object", ")", ")", ":", "rv", "=", "self", ".", "system", ...
d8a8cd03cd0da047e033a2d305f3f260f8c4e017
train
AbstractCallable.collect
Recursively collect all potential triggers/targets in this node and its children. Define targets and triggers of this particular callable in :meth:`_give_triggers` and :meth:`_give_targets`. :param str target: valid values: ``'targets'`` and ``'triggers'``
src/automate/callable.py
def collect(self, target): """Recursively collect all potential triggers/targets in this node and its children. Define targets and triggers of this particular callable in :meth:`_give_triggers` and :meth:`_give_targets`. :param str target: valid values: ``'targets'`` and ``'triggers'`` ...
def collect(self, target): """Recursively collect all potential triggers/targets in this node and its children. Define targets and triggers of this particular callable in :meth:`_give_triggers` and :meth:`_give_targets`. :param str target: valid values: ``'targets'`` and ``'triggers'`` ...
[ "Recursively", "collect", "all", "potential", "triggers", "/", "targets", "in", "this", "node", "and", "its", "children", ".", "Define", "targets", "and", "triggers", "of", "this", "particular", "callable", "in", ":", "meth", ":", "_give_triggers", "and", ":",...
tuomas2/automate
python
https://github.com/tuomas2/automate/blob/d8a8cd03cd0da047e033a2d305f3f260f8c4e017/src/automate/callable.py#L263-L288
[ "def", "collect", "(", "self", ",", "target", ")", ":", "statusobjects", "=", "set", "(", ")", "callables", "=", "set", "(", ")", "objs_from_this_obj", "=", "getattr", "(", "self", ",", "'_give_%s'", "%", "target", ")", "(", ")", "if", "not", "is_itera...
d8a8cd03cd0da047e033a2d305f3f260f8c4e017
train
AbstractCallable.cancel
Recursively cancel all threaded background processes of this Callable. This is called automatically for actions if program deactivates.
src/automate/callable.py
def cancel(self, caller): """ Recursively cancel all threaded background processes of this Callable. This is called automatically for actions if program deactivates. """ for o in {i for i in self.children if isinstance(i, AbstractCallable)}: o.cancel(caller)
def cancel(self, caller): """ Recursively cancel all threaded background processes of this Callable. This is called automatically for actions if program deactivates. """ for o in {i for i in self.children if isinstance(i, AbstractCallable)}: o.cancel(caller)
[ "Recursively", "cancel", "all", "threaded", "background", "processes", "of", "this", "Callable", ".", "This", "is", "called", "automatically", "for", "actions", "if", "program", "deactivates", "." ]
tuomas2/automate
python
https://github.com/tuomas2/automate/blob/d8a8cd03cd0da047e033a2d305f3f260f8c4e017/src/automate/callable.py#L311-L317
[ "def", "cancel", "(", "self", ",", "caller", ")", ":", "for", "o", "in", "{", "i", "for", "i", "in", "self", ".", "children", "if", "isinstance", "(", "i", ",", "AbstractCallable", ")", "}", ":", "o", ".", "cancel", "(", "caller", ")" ]
d8a8cd03cd0da047e033a2d305f3f260f8c4e017
train
AbstractCallable.give_str
Give string representation of the callable.
src/automate/callable.py
def give_str(self): """ Give string representation of the callable. """ args = self._args[:] kwargs = self._kwargs return self._give_str(args, kwargs)
def give_str(self): """ Give string representation of the callable. """ args = self._args[:] kwargs = self._kwargs return self._give_str(args, kwargs)
[ "Give", "string", "representation", "of", "the", "callable", "." ]
tuomas2/automate
python
https://github.com/tuomas2/automate/blob/d8a8cd03cd0da047e033a2d305f3f260f8c4e017/src/automate/callable.py#L333-L339
[ "def", "give_str", "(", "self", ")", ":", "args", "=", "self", ".", "_args", "[", ":", "]", "kwargs", "=", "self", ".", "_kwargs", "return", "self", ".", "_give_str", "(", "args", ",", "kwargs", ")" ]
d8a8cd03cd0da047e033a2d305f3f260f8c4e017
train
AbstractCallable.give_str_indented
Give indented string representation of the callable. This is used in :ref:`automate-webui`.
src/automate/callable.py
def give_str_indented(self, tags=False): """ Give indented string representation of the callable. This is used in :ref:`automate-webui`. """ args = self._args[:] kwargs = self._kwargs rv = self._give_str_indented(args, kwargs, tags) if not tags: ...
def give_str_indented(self, tags=False): """ Give indented string representation of the callable. This is used in :ref:`automate-webui`. """ args = self._args[:] kwargs = self._kwargs rv = self._give_str_indented(args, kwargs, tags) if not tags: ...
[ "Give", "indented", "string", "representation", "of", "the", "callable", ".", "This", "is", "used", "in", ":", "ref", ":", "automate", "-", "webui", "." ]
tuomas2/automate
python
https://github.com/tuomas2/automate/blob/d8a8cd03cd0da047e033a2d305f3f260f8c4e017/src/automate/callable.py#L382-L392
[ "def", "give_str_indented", "(", "self", ",", "tags", "=", "False", ")", ":", "args", "=", "self", ".", "_args", "[", ":", "]", "kwargs", "=", "self", ".", "_kwargs", "rv", "=", "self", ".", "_give_str_indented", "(", "args", ",", "kwargs", ",", "tag...
d8a8cd03cd0da047e033a2d305f3f260f8c4e017
train
PolrApi._make_request
Prepares the request and catches common errors and returns tuple of data and the request response. Read more about error codes: https://docs.polrproject.org/en/latest/developer-guide/api/#http-error-codes :param endpoint: full endpoint url :type endpoint: str :param params: parameters ...
mypolr/polr_api.py
def _make_request(self, endpoint, params): """ Prepares the request and catches common errors and returns tuple of data and the request response. Read more about error codes: https://docs.polrproject.org/en/latest/developer-guide/api/#http-error-codes :param endpoint: full endpoint url...
def _make_request(self, endpoint, params): """ Prepares the request and catches common errors and returns tuple of data and the request response. Read more about error codes: https://docs.polrproject.org/en/latest/developer-guide/api/#http-error-codes :param endpoint: full endpoint url...
[ "Prepares", "the", "request", "and", "catches", "common", "errors", "and", "returns", "tuple", "of", "data", "and", "the", "request", "response", "." ]
fauskanger/mypolr
python
https://github.com/fauskanger/mypolr/blob/46eb4fc5ba0f65412634a37e30e05de79fc9db4c/mypolr/polr_api.py#L42-L74
[ "def", "_make_request", "(", "self", ",", "endpoint", ",", "params", ")", ":", "# params = {", "# **self._base_params, # Mind order to allow params to overwrite base params", "# **params", "# }", "full_params", "=", "self", ".", "_base_params", ".", "copy", "(", ...
46eb4fc5ba0f65412634a37e30e05de79fc9db4c
train
PolrApi.shorten
Creates a short url if valid :param str long_url: The url to shorten. :param custom_ending: The custom url to create if available. :type custom_ending: str or None :param bool is_secret: if not public, it's secret :return: a short link :rtype: str
mypolr/polr_api.py
def shorten(self, long_url, custom_ending=None, is_secret=False): """ Creates a short url if valid :param str long_url: The url to shorten. :param custom_ending: The custom url to create if available. :type custom_ending: str or None :param bool is_secret: if not public,...
def shorten(self, long_url, custom_ending=None, is_secret=False): """ Creates a short url if valid :param str long_url: The url to shorten. :param custom_ending: The custom url to create if available. :type custom_ending: str or None :param bool is_secret: if not public,...
[ "Creates", "a", "short", "url", "if", "valid" ]
fauskanger/mypolr
python
https://github.com/fauskanger/mypolr/blob/46eb4fc5ba0f65412634a37e30e05de79fc9db4c/mypolr/polr_api.py#L76-L103
[ "def", "shorten", "(", "self", ",", "long_url", ",", "custom_ending", "=", "None", ",", "is_secret", "=", "False", ")", ":", "params", "=", "{", "'url'", ":", "long_url", ",", "'is_secret'", ":", "'true'", "if", "is_secret", "else", "'false'", ",", "'cus...
46eb4fc5ba0f65412634a37e30e05de79fc9db4c
train
PolrApi._get_ending
Returns the short url ending from a short url or an short url ending. Example: - Given `<your Polr server>/5N3f8`, return `5N3f8`. - Given `5N3f8`, return `5N3f8`. :param lookup_url: A short url or short url ending :type lookup_url: str :return: The url ending ...
mypolr/polr_api.py
def _get_ending(self, lookup_url): """ Returns the short url ending from a short url or an short url ending. Example: - Given `<your Polr server>/5N3f8`, return `5N3f8`. - Given `5N3f8`, return `5N3f8`. :param lookup_url: A short url or short url ending :type ...
def _get_ending(self, lookup_url): """ Returns the short url ending from a short url or an short url ending. Example: - Given `<your Polr server>/5N3f8`, return `5N3f8`. - Given `5N3f8`, return `5N3f8`. :param lookup_url: A short url or short url ending :type ...
[ "Returns", "the", "short", "url", "ending", "from", "a", "short", "url", "or", "an", "short", "url", "ending", "." ]
fauskanger/mypolr
python
https://github.com/fauskanger/mypolr/blob/46eb4fc5ba0f65412634a37e30e05de79fc9db4c/mypolr/polr_api.py#L105-L120
[ "def", "_get_ending", "(", "self", ",", "lookup_url", ")", ":", "if", "lookup_url", ".", "startswith", "(", "self", ".", "api_server", ")", ":", "return", "lookup_url", "[", "len", "(", "self", ".", "api_server", ")", "+", "1", ":", "]", "return", "loo...
46eb4fc5ba0f65412634a37e30e05de79fc9db4c
train
PolrApi.lookup
Looks up the url_ending to obtain information about the short url. If it exists, the API will return a dictionary with information, including the long_url that is the destination of the given short url URL. The lookup object looks like something like this: .. code-block:: python ...
mypolr/polr_api.py
def lookup(self, lookup_url, url_key=None): """ Looks up the url_ending to obtain information about the short url. If it exists, the API will return a dictionary with information, including the long_url that is the destination of the given short url URL. The lookup object look...
def lookup(self, lookup_url, url_key=None): """ Looks up the url_ending to obtain information about the short url. If it exists, the API will return a dictionary with information, including the long_url that is the destination of the given short url URL. The lookup object look...
[ "Looks", "up", "the", "url_ending", "to", "obtain", "information", "about", "the", "short", "url", "." ]
fauskanger/mypolr
python
https://github.com/fauskanger/mypolr/blob/46eb4fc5ba0f65412634a37e30e05de79fc9db4c/mypolr/polr_api.py#L122-L173
[ "def", "lookup", "(", "self", ",", "lookup_url", ",", "url_key", "=", "None", ")", ":", "url_ending", "=", "self", ".", "_get_ending", "(", "lookup_url", ")", "params", "=", "{", "'url_ending'", ":", "url_ending", ",", "'url_key'", ":", "url_key", "}", "...
46eb4fc5ba0f65412634a37e30e05de79fc9db4c
train
beam_fit
The following contructs a restoring beam from the psf. This is accoplished by fitting an elliptical Gaussian to the central lobe of the PSF. INPUTS: psf (no default): Array containing the psf for the image in question. cdelt1, cdelt2 (no default): Header of the psf.
pymoresane/beam_fit.py
def beam_fit(psf, cdelt1, cdelt2): """ The following contructs a restoring beam from the psf. This is accoplished by fitting an elliptical Gaussian to the central lobe of the PSF. INPUTS: psf (no default): Array containing the psf for the image in question. cdelt1, cdelt2 (no default...
def beam_fit(psf, cdelt1, cdelt2): """ The following contructs a restoring beam from the psf. This is accoplished by fitting an elliptical Gaussian to the central lobe of the PSF. INPUTS: psf (no default): Array containing the psf for the image in question. cdelt1, cdelt2 (no default...
[ "The", "following", "contructs", "a", "restoring", "beam", "from", "the", "psf", ".", "This", "is", "accoplished", "by", "fitting", "an", "elliptical", "Gaussian", "to", "the", "central", "lobe", "of", "the", "PSF", "." ]
ratt-ru/PyMORESANE
python
https://github.com/ratt-ru/PyMORESANE/blob/b024591ad0bbb69320d08841f28a2c27f62ae1af/pymoresane/beam_fit.py#L6-L69
[ "def", "beam_fit", "(", "psf", ",", "cdelt1", ",", "cdelt2", ")", ":", "if", "psf", ".", "shape", ">", "512", ":", "psf_slice", "=", "tuple", "(", "[", "slice", "(", "psf", ".", "shape", "[", "0", "]", "/", "2", "-", "256", ",", "psf", ".", "...
b024591ad0bbb69320d08841f28a2c27f62ae1af
train
make_argparser
Setup argparse arguments. :return: The parser which :class:`MypolrCli` expects parsed arguments from. :rtype: argparse.ArgumentParser
mypolr/cli.py
def make_argparser(): """ Setup argparse arguments. :return: The parser which :class:`MypolrCli` expects parsed arguments from. :rtype: argparse.ArgumentParser """ parser = argparse.ArgumentParser(prog='mypolr', description="Interacts with the Polr Project's...
def make_argparser(): """ Setup argparse arguments. :return: The parser which :class:`MypolrCli` expects parsed arguments from. :rtype: argparse.ArgumentParser """ parser = argparse.ArgumentParser(prog='mypolr', description="Interacts with the Polr Project's...
[ "Setup", "argparse", "arguments", "." ]
fauskanger/mypolr
python
https://github.com/fauskanger/mypolr/blob/46eb4fc5ba0f65412634a37e30e05de79fc9db4c/mypolr/cli.py#L18-L61
[ "def", "make_argparser", "(", ")", ":", "parser", "=", "argparse", ".", "ArgumentParser", "(", "prog", "=", "'mypolr'", ",", "description", "=", "\"Interacts with the Polr Project's API.\\n\\n\"", "\"User Guide and documentation: https://mypolr.readthedocs.io\"", ",", "format...
46eb4fc5ba0f65412634a37e30e05de79fc9db4c
train
estimate_threshold
This function estimates the noise using the MAD estimator. INPUTS: in1 (no default): The array from which the noise is estimated OUTPUTS: out1 An array of per-scale noise estimates.
pymoresane/iuwt_toolbox.py
def estimate_threshold(in1, edge_excl=0, int_excl=0): """ This function estimates the noise using the MAD estimator. INPUTS: in1 (no default): The array from which the noise is estimated OUTPUTS: out1 An array of per-scale noise estimates. """ ...
def estimate_threshold(in1, edge_excl=0, int_excl=0): """ This function estimates the noise using the MAD estimator. INPUTS: in1 (no default): The array from which the noise is estimated OUTPUTS: out1 An array of per-scale noise estimates. """ ...
[ "This", "function", "estimates", "the", "noise", "using", "the", "MAD", "estimator", "." ]
ratt-ru/PyMORESANE
python
https://github.com/ratt-ru/PyMORESANE/blob/b024591ad0bbb69320d08841f28a2c27f62ae1af/pymoresane/iuwt_toolbox.py#L17-L48
[ "def", "estimate_threshold", "(", "in1", ",", "edge_excl", "=", "0", ",", "int_excl", "=", "0", ")", ":", "out1", "=", "np", ".", "empty", "(", "[", "in1", ".", "shape", "[", "0", "]", "]", ")", "mid", "=", "in1", ".", "shape", "[", "1", "]", ...
b024591ad0bbb69320d08841f28a2c27f62ae1af