INSTRUCTION stringlengths 1 8.43k | RESPONSE stringlengths 75 104k |
|---|---|
Updates the status of this invoice based upon the total payments. | def update_status(self):
''' Updates the status of this invoice based upon the total
payments.'''
old_status = self.invoice.status
total_paid = self.invoice.total_payments()
num_payments = commerce.PaymentBase.objects.filter(
invoice=self.invoice,
).count()
... |
Marks the invoice as paid and updates the attached cart if necessary. | def _mark_paid(self):
''' Marks the invoice as paid, and updates the attached cart if
necessary. '''
cart = self.invoice.cart
if cart:
cart.status = commerce.Cart.STATUS_PAID
cart.save()
self.invoice.status = commerce.Invoice.STATUS_PAID
self.invoi... |
Marks the invoice as refunded and updates the attached cart if necessary. | def _mark_refunded(self):
''' Marks the invoice as refunded, and updates the attached cart if
necessary. '''
self._release_cart()
self.invoice.status = commerce.Invoice.STATUS_REFUNDED
self.invoice.save() |
Marks the invoice as refunded and updates the attached cart if necessary. | def _mark_void(self):
''' Marks the invoice as refunded, and updates the attached cart if
necessary. '''
self.invoice.status = commerce.Invoice.STATUS_VOID
self.invoice.save() |
Returns true if there is no cart or if the revision of this invoice matches the current revision of the cart. | def _invoice_matches_cart(self):
''' Returns true if there is no cart, or if the revision of this
invoice matches the current revision of the cart. '''
self._refresh()
cart = self.invoice.cart
if not cart:
return True
return cart.revision == self.invoice.ca... |
Voids this invoice if the attached cart is no longer valid because the cart revision has changed or the reservations have expired. | def update_validity(self):
''' Voids this invoice if the attached cart is no longer valid because
the cart revision has changed, or the reservations have expired. '''
is_valid = self._invoice_matches_cart()
cart = self.invoice.cart
if self.invoice.is_unpaid and is_valid and cart... |
Voids the invoice if it is valid to do so. | def void(self):
''' Voids the invoice if it is valid to do so. '''
if self.invoice.total_payments() > 0:
raise ValidationError("Invoices with payments must be refunded.")
elif self.invoice.is_refunded:
raise ValidationError("Refunded invoices may not be voided.")
... |
Refunds the invoice by generating a CreditNote for the value of all of the payments against the cart. | def refund(self):
''' Refunds the invoice by generating a CreditNote for the value of
all of the payments against the cart.
The invoice is marked as refunded, and the underlying cart is marked
as released.
'''
if self.invoice.is_void:
raise ValidationError(... |
Sends out an e - mail notifying the user about something to do with that invoice. | def email(cls, invoice, kind):
''' Sends out an e-mail notifying the user about something to do
with that invoice. '''
context = {
"invoice": invoice,
}
send_email([invoice.user.email], kind, context=context) |
Sends out all of the necessary notifications that the status of the invoice has changed to: | def email_on_invoice_change(cls, invoice, old_status, new_status):
''' Sends out all of the necessary notifications that the status of the
invoice has changed to:
- Invoice is now paid
- Invoice is now refunded
'''
# The statuses that we don't care about.
silen... |
Update the object with new data. | def update(self, data):
"""Update the object with new data."""
fields = [
'id',
'status',
'type',
'persistence',
'date_start',
'date_finish',
'date_created',
'date_modified',
'checksum',
... |
Reduce dicts of dicts to dot separated keys. | def _flatten_field(self, field, schema, path):
"""Reduce dicts of dicts to dot separated keys."""
flat = {}
for field_schema, fields, path in iterate_schema(field, schema, path):
name = field_schema['name']
typ = field_schema['type']
label = field_schema['labe... |
Print annotation key: value pairs to standard output. | def print_annotation(self):
"""Print annotation "key: value" pairs to standard output."""
for path, ann in self.annotation.items():
print("{}: {}".format(path, ann['value'])) |
Print file fields to standard output. | def print_downloads(self):
"""Print file fields to standard output."""
for path, ann in self.annotation.items():
if path.startswith('output') and ann['type'] == 'basic:file:':
print("{}: {}".format(path, ann['value']['file'])) |
Download a file. | def download(self, field):
"""Download a file.
:param field: file field to download
:type field: string
:rtype: a file handle
"""
if not field.startswith('output'):
raise ValueError("Only processor results (output.* fields) can be downloaded")
if fi... |
Add arguments to the parser for collection in app. args. | def add_arguments(cls, parser):
"""Add arguments to the parser for collection in app.args.
Args:
parser:
`argparse.ArgumentParser`. Parser.
Arguments added here are server on
self.args.
"""
parser.add_argument(
'-t... |
Return a list: obj: GenProject projects. | def projects(self):
"""Return a list :obj:`GenProject` projects.
:rtype: list of :obj:`GenProject` projects
"""
if not ('projects' in self.cache and self.cache['projects']):
self.cache['projects'] = {c['id']: GenProject(c, self) for c in self.api.case.get()['objects']}
... |
Return a list of Data objects for given project. | def project_data(self, project):
"""Return a list of Data objects for given project.
:param project: ObjectId or slug of Genesis project
:type project: string
:rtype: list of Data objects
"""
projobjects = self.cache['project_objects']
objects = self.cache['obje... |
Query for Data object annotation. | def data(self, **query):
"""Query for Data object annotation."""
objects = self.cache['objects']
data = self.api.data.get(**query)['objects']
data_objects = []
for d in data:
_id = d['id']
if _id in objects:
# Update existing object
... |
Return a list of Processor objects. | def processors(self, processor_name=None):
"""Return a list of Processor objects.
:param project_id: ObjectId of Genesis project
:type project_id: string
:rtype: list of Processor objects
"""
if processor_name:
return self.api.processor.get(name=processor_na... |
Print processor input fields and types. | def print_processor_inputs(self, processor_name):
"""Print processor input fields and types.
:param processor_name: Processor object name
:type processor_name: string
"""
p = self.processors(processor_name=processor_name)
if len(p) == 1:
p = p[0]
el... |
POST JSON data object to server | def rundata(self, strjson):
"""POST JSON data object to server"""
d = json.loads(strjson)
return self.api.data.post(d) |
Create an object of resource: | def create(self, data, resource='data'):
"""Create an object of resource:
* data
* project
* processor
* trigger
* template
:param data: Object values
:type data: dict
:param resource: Resource name
:type resource: string
"""
... |
Upload files and data objects. | def upload(self, project_id, processor_name, **fields):
"""Upload files and data objects.
:param project_id: ObjectId of Genesis project
:type project_id: string
:param processor_name: Processor object name
:type processor_name: string
:param fields: Processor field-valu... |
Upload a single file on the platform. | def _upload_file(self, fn):
"""Upload a single file on the platform.
File is uploaded in chunks of 1,024 bytes.
:param fn: File path
:type fn: string
"""
size = os.path.getsize(fn)
counter = 0
base_name = os.path.basename(fn)
session_id = str(uu... |
Download files of data objects. | def download(self, data_objects, field):
"""Download files of data objects.
:param data_objects: Data object ids
:type data_objects: list of UUID strings
:param field: Download field name
:type field: string
:rtype: generator of requests.Response objects
"""
... |
Gets the subclasses of a class. | def get_subclasses(c):
"""Gets the subclasses of a class."""
subclasses = c.__subclasses__()
for d in list(subclasses):
subclasses.extend(get_subclasses(d))
return subclasses |
Add arguments to the parser for collection in app. args. | def add_arguments(cls, parser):
"""Add arguments to the parser for collection in app.args.
Args:
parser:
`argparse.ArgumentParser`. Parser.
Arguments added here are server on
self.args.
"""
parser.add_argument(
'-a... |
Returns repository and project. | def get_repo_and_project(self):
"""Returns repository and project."""
app = self.app
# Get repo
repo = app.data.apply('github-repo', app.args.github_repo,
app.prompt_repo,
on_load=app.github.get_repo,
on_save=lambda r: r.id
)
asse... |
for each variant yields evidence and associated phenotypes both current and suggested | def get_variant_phenotypes_with_suggested_changes(variant_id_list):
'''for each variant, yields evidence and associated phenotypes, both current and suggested'''
variants = civic.get_variants_by_ids(variant_id_list)
evidence = list()
for variant in variants:
evidence.extend(variant.evidence)
... |
for each variant yields evidence and merged phenotype from applying suggested changes to current | def get_variant_phenotypes_with_suggested_changes_merged(variant_id_list):
'''for each variant, yields evidence and merged phenotype from applying suggested changes to current'''
for evidence, phenotype_status in get_variant_phenotypes_with_suggested_changes(variant_id_list):
final = phenotype_status['c... |
Search the cache for variants matching provided coordinates using the corresponding search mode. | def search_variants_by_coordinates(coordinate_query, search_mode='any'):
"""
Search the cache for variants matching provided coordinates using the corresponding search mode.
:param coordinate_query: A civic CoordinateQuery object
start: the genomic start coordinate of the query
... |
An interator to search the cache for variants matching the set of sorted coordinates and yield matches corresponding to the search mode. | def bulk_search_variants_by_coordinates(sorted_queries, search_mode='any'):
"""
An interator to search the cache for variants matching the set of sorted coordinates and yield
matches corresponding to the search mode.
:param sorted_queries: A list of civic CoordinateQuery objects, sorted by coordinate.... |
Updates record and returns True if record is complete after update else False. | def update(self, allow_partial=True, force=False, **kwargs):
"""Updates record and returns True if record is complete after update, else False."""
if kwargs:
self.__init__(partial=allow_partial, force=force, **kwargs)
return not self._partial
if not force and CACHE.get(h... |
Returns a unique list of seq | def uniqify(cls, seq):
"""Returns a unique list of seq"""
seen = set()
seen_add = seen.add
return [ x for x in seq if x not in seen and not seen_add(x)] |
Connects to Github and Asana and authenticates via OAuth. | def authenticate(self):
"""Connects to Github and Asana and authenticates via OAuth."""
if self.oauth:
return False
# Save asana.
self.settings.apply('api-asana', self.args.asana_api,
"enter asana api key")
# Save github.com
self.settings.apply('... |
Given a list of values and names accepts the index value or name. | def _list_select(cls, lst, prompt, offset=0):
"""Given a list of values and names, accepts the index value or name."""
inp = raw_input("select %s: " % prompt)
assert inp, "value required."
try:
return lst[int(inp)+offset]
except ValueError:
return inp
... |
Saves a issue data ( tasks etc. ) to local data. | def save_issue_data_task(self, issue, task_id, namespace='open'):
"""Saves a issue data (tasks, etc.) to local data.
Args:
issue:
`int`. Github issue number.
task:
`int`. Asana task ID.
namespace:
`str`. Namespace for s... |
Returns issue data from local data. | def get_saved_issue_data(self, issue, namespace='open'):
"""Returns issue data from local data.
Args:
issue:
`int`. Github issue number.
namespace:
`str`. Namespace for storing this issue.
"""
if isinstance(issue, int):
... |
Moves an issue_data from one namespace to another. | def move_saved_issue_data(self, issue, ns, other_ns):
"""Moves an issue_data from one namespace to another."""
if isinstance(issue, int):
issue_number = str(issue)
elif isinstance(issue, basestring):
issue_number = issue
else:
issue_number = issue.num... |
Returns task data from local data. | def get_saved_task_data(self, task):
"""Returns task data from local data.
Args:
task:
`int`. Asana task number.
"""
if isinstance(task, int):
task_number = str(task)
elif isinstance(task, basestring):
task_number = task
... |
Retrieves a task from asana. | def get_asana_task(self, asana_task_id):
"""Retrieves a task from asana."""
try:
return self.asana.tasks.find_by_id(asana_task_id)
except asana_errors.NotFoundError:
return None
except asana_errors.ForbiddenError:
return None |
Save data. | def save(self):
"""Save data."""
with open(self.filename, 'wb') as file:
self.prune()
self.data['version'] = self.version
json.dump(self.data,
file,
sort_keys=True, indent=2) |
Applies a setting value to a key if the value is not None. | def apply(self, key, value, prompt=None,
on_load=lambda a: a, on_save=lambda a: a):
"""Applies a setting value to a key, if the value is not `None`.
Returns without prompting if either of the following:
* `value` is not `None`
* already present in the dictionary
... |
Add arguments to the parser for collection in app. args. | def add_arguments(cls, parser):
"""Add arguments to the parser for collection in app.args.
Args:
parser:
`argparse.ArgumentParser`. Parser.
Arguments added here are server on
self.args.
"""
parser.add_argument(
'-i... |
Decorator for retrying tasks with special cases. | def transport_task(func):
"""Decorator for retrying tasks with special cases."""
def wrapped_func(*args, **kwargs):
tries = 0
while True:
try:
try:
return func(*args, **kwargs)
except (asana_errors.InvalidRequestError,
... |
Waits until queue is empty. | def flush(callback=None):
"""Waits until queue is empty."""
while True:
if shutdown_event.is_set():
return
if callable(callback):
callback()
try:
item = queue.get(timeout=1)
queue.put(item) # put it back, we're just peeking.
exc... |
Creates a task | def task_create(asana_workspace_id, name, notes, assignee, projects,
completed, **kwargs):
"""Creates a task"""
put("task_create",
asana_workspace_id=asana_workspace_id,
name=name,
notes=notes,
assignee=assignee,
projects=projects,
completed=comple... |
Returns formatting for the tasks section of asana. | def format_task_numbers_with_links(tasks):
"""Returns formatting for the tasks section of asana."""
project_id = data.get('asana-project', None)
def _task_format(task_id):
if project_id:
asana_url = tool.ToolApp.make_asana_url(project_id, task_id)
return "[#%d](%s)" % (task... |
Creates a missing task. | def create_missing_task(self,
asana_workspace_id,
name,
assignee,
projects,
completed,
issue_number,
issue_html_url,
... |
Applies task numbers to an issue. | def apply_tasks_to_issue(self, tasks, issue_number, issue_body):
"""Applies task numbers to an issue."""
issue_body = issue_body
task_numbers = format_task_numbers_with_links(tasks)
if task_numbers:
new_body = ASANA_SECTION_RE.sub('', issue_body)
new_body = new_bo... |
Return a list of data types. | def data_types(self):
"""Return a list of data types."""
data = self.gencloud.project_data(self.id)
return sorted(set(d.type for d in data)) |
Query for Data object annotation. | def data(self, **query):
"""Query for Data object annotation."""
data = self.gencloud.project_data(self.id)
query['case_ids__contains'] = self.id
ids = set(d['id'] for d in self.gencloud.api.dataid.get(**query)['objects'])
return [d for d in data if d.id in ids] |
Send string to module level log | def ekm_log(logstr, priority=3):
""" Send string to module level log
Args:
logstr (str): string to print.
priority (int): priority, supports 3 (default) and 4 (special).
"""
if priority <= ekmmeters_log_level:
dt = datetime.datetime
stamp = datetime.datetime.now().strfti... |
Required initialization call wraps pyserial constructor. | def initPort(self):
""" Required initialization call, wraps pyserial constructor. """
try:
self.m_ser = serial.Serial(port=self.m_ttyport,
baudrate=self.m_baudrate,
timeout=0,
... |
Passthrough for pyserial Serial. write (). | def write(self, output):
"""Passthrough for pyserial Serial.write().
Args:
output (str): Block to write to port
"""
view_str = output.encode('ascii', 'ignore')
if (len(view_str) > 0):
self.m_ser.write(view_str)
self.m_ser.flush()
s... |
Optional polling loop control | def setPollingValues(self, max_waits, wait_sleep):
""" Optional polling loop control
Args:
max_waits (int): waits
wait_sleep (int): ms per wait
"""
self.m_max_waits = max_waits
self.m_wait_sleep = wait_sleep |
Poll for finished block or first byte ACK. Args: context ( str ): internal serial call context. | def getResponse(self, context=""):
""" Poll for finished block or first byte ACK.
Args:
context (str): internal serial call context.
Returns:
string: Response, implict cast from byte array.
"""
waits = 0 # allowed interval counter
response_str = ... |
Use the serial block definitions in V3 and V4 to create one field list. | def combineAB(self):
""" Use the serial block definitions in V3 and V4 to create one field list. """
v4definition_meter = V4Meter()
v4definition_meter.makeAB()
defv4 = v4definition_meter.getReadBuffer()
v3definition_meter = V3Meter()
v3definition_meter.makeReturnFormat()... |
Translate FieldType to portable SQL Type. Override if needful. Args: fld_type ( int ):: class: ~ekmmeters. FieldType in serial block. fld_len ( int ): Binary length in serial block | def mapTypeToSql(fld_type=FieldType.NoType, fld_len=0):
""" Translate FieldType to portable SQL Type. Override if needful.
Args:
fld_type (int): :class:`~ekmmeters.FieldType` in serial block.
fld_len (int): Binary length in serial block
Returns:
string: Port... |
Return query portion below CREATE. Args: qry_str ( str ): String as built. | def fillCreate(self, qry_str):
""" Return query portion below CREATE.
Args:
qry_str (str): String as built.
Returns:
string: Passed string with fields appended.
"""
count = 0
for fld in self.m_all_fields:
fld_type = self.m_all_fields[f... |
Reasonably portable SQL CREATE for defined fields. Returns: string: Portable as possible SQL Create for all - reads table. | def sqlCreate(self):
""" Reasonably portable SQL CREATE for defined fields.
Returns:
string: Portable as possible SQL Create for all-reads table.
"""
count = 0
qry_str = "CREATE TABLE Meter_Reads ( \n\r"
qry_str = self.fillCreate(qry_str)
ekm_log(qry_s... |
Reasonably portable SQL INSERT for from combined read buffer. Args: def_buf ( SerialBlock ): Database only serial block of all fields. raw_a ( str ): Raw A read as hex string. raw_b ( str ): Raw B read ( if exists otherwise empty ) as hex string. | def sqlInsert(def_buf, raw_a, raw_b):
""" Reasonably portable SQL INSERT for from combined read buffer.
Args:
def_buf (SerialBlock): Database only serial block of all fields.
raw_a (str): Raw A read as hex string.
raw_b (str): Raw B read (if exists, otherwise empty) a... |
Call overridden dbExec () with built insert statement. Args: def_buf ( SerialBlock ): Block of read buffer fields to write. raw_a ( str ): Hex string of raw A read. raw_b ( str ): Hex string of raw B read or empty. | def dbInsert(self, def_buf, raw_a, raw_b):
""" Call overridden dbExec() with built insert statement.
Args:
def_buf (SerialBlock): Block of read buffer fields to write.
raw_a (str): Hex string of raw A read.
raw_b (str): Hex string of raw B read or empty.
"""
... |
Required override of dbExec () from MeterDB () run query. Args: query_str ( str ): query to run | def dbExec(self, query_str):
""" Required override of dbExec() from MeterDB(), run query.
Args:
query_str (str): query to run
"""
try:
connection = sqlite3.connect(self.m_connection_string)
cursor = connection.cursor()
cursor.execute(query_... |
Sqlite callback accepting the cursor and the original row as a tuple. | def dict_factory(self, cursor, row):
""" Sqlite callback accepting the cursor and the original row as a tuple.
Simple return of JSON safe types.
Args:
cursor (sqlite cursor): Original cursory
row (sqlite row tuple): Original row.
Returns:
dict: mod... |
Sqlite callback accepting the cursor and the original row as a tuple. | def raw_dict_factory(cursor, row):
""" Sqlite callback accepting the cursor and the original row as a tuple.
Simple return of JSON safe types, including raw read hex strings.
Args:
cursor (sqlite cursor): Original cursory
row (sqlite row tuple): Original row.
... |
Simple since Time_Stamp query returned as JSON records. | def renderJsonReadsSince(self, timestamp, meter):
""" Simple since Time_Stamp query returned as JSON records.
Args:
timestamp (int): Epoch time in seconds.
meter (str): 12 character meter address to query
Returns:
str: JSON rendered read records.
""... |
Set context string for serial command. Private setter. | def setContext(self, context_str):
""" Set context string for serial command. Private setter.
Args:
context_str (str): Command specific string.
"""
if (len(self.m_context) == 0) and (len(context_str) >= 7):
if context_str[0:7] != "request":
ekm_l... |
Drop in pure python replacement for ekmcrc. c extension. | def calc_crc16(buf):
""" Drop in pure python replacement for ekmcrc.c extension.
Args:
buf (bytes): String or byte array (implicit Python 2.7 cast)
Returns:
str: 16 bit CRC per EKM Omnimeters formatted as hex string.
"""
crc_table = [0x0000, 0xc0c1, 0xc1... |
Simple wrap to calc legacy PF value | def calcPF(pf):
""" Simple wrap to calc legacy PF value
Args:
pf: meter power factor reading
Returns:
int: legacy push pf
"""
pf_y = pf[:1]
pf_x = pf[1:]
result = 100
if pf_y == CosTheta.CapacitiveLead:
result = 200 - ... |
Serial call to set max demand period. | def setMaxDemandPeriod(self, period, password="00000000"):
""" Serial call to set max demand period.
Args:
period (int): : as int.
password (str): Optional password.
Returns:
bool: True on completion with ACK.
"""
result = False
self.... |
Serial Call to set meter password. USE WITH CAUTION. | def setMeterPassword(self, new_pwd, pwd="00000000"):
""" Serial Call to set meter password. USE WITH CAUTION.
Args:
new_pwd (str): 8 digit numeric password to set
pwd (str): Old 8 digit numeric password.
Returns:
bool: True on completion with ACK.
"... |
Wrapper for struct. unpack with SerialBlock buffer definitionns. | def unpackStruct(self, data, def_buf):
""" Wrapper for struct.unpack with SerialBlock buffer definitionns.
Args:
data (str): Implicit cast bytes to str, serial port return.
def_buf (SerialBlock): Block object holding field lengths.
Returns:
tuple: parsed res... |
Move data from raw tuple into scaled and conveted values. | def convertData(self, contents, def_buf, kwh_scale=ScaleKWH.EmptyScale):
""" Move data from raw tuple into scaled and conveted values.
Args:
contents (tuple): Breakout of passed block from unpackStruct().
def_buf (): Read buffer destination.
kwh_scale (int): :class:... |
Translate the passed serial block into string only JSON. | def jsonRender(self, def_buf):
""" Translate the passed serial block into string only JSON.
Args:
def_buf (SerialBlock): Any :class:`~ekmmeters.SerialBlock` object.
Returns:
str: JSON rendering of meter record.
"""
try:
ret_dict = SerialBlock... |
Internal read CRC wrapper. | def crcMeterRead(self, raw_read, def_buf):
""" Internal read CRC wrapper.
Args:
raw_read (str): Bytes with implicit string cast from serial read
def_buf (SerialBlock): Populated read buffer.
Returns:
bool: True if passed CRC equals calculated CRC.
"... |
Break out a date from Omnimeter read. | def splitEkmDate(dateint):
"""Break out a date from Omnimeter read.
Note a corrupt date will raise an exception when you
convert it to int to hand to this method.
Args:
dateint (int): Omnimeter datetime as int.
Returns:
tuple: Named tuple which breaks ... |
Remove an observer from the meter update () chain. | def unregisterObserver(self, observer):
""" Remove an observer from the meter update() chain.
Args:
observer (MeterObserver): Subclassed MeterObserver.
"""
if observer in self.m_observers:
self.m_observers.remove(observer)
pass |
Initialize first tariff schedule: class: ~ekmmeters. SerialBlock. | def initSchd_1_to_4(self):
""" Initialize first tariff schedule :class:`~ekmmeters.SerialBlock`. """
self.m_schd_1_to_4["reserved_40"] = [6, FieldType.Hex, ScaleType.No, "", 0, False, False]
self.m_schd_1_to_4["Schedule_1_Period_1_Hour"] = [2, FieldType.Int, ScaleType.No, "", 0, False, True]
... |
Initialize second ( and last ) tariff schedule: class: ~ekmmeters. SerialBlock. | def initSchd_5_to_6(self):
""" Initialize second(and last) tariff schedule :class:`~ekmmeters.SerialBlock`. """
self.m_schd_5_to_6["reserved_30"] = [6, FieldType.Hex, ScaleType.No, "", 0, False, False]
self.m_schd_5_to_6["Schedule_5_Period_1_Hour"] = [2, FieldType.Int, ScaleType.No, "", 0, False... |
Return the requested tariff schedule: class: ~ekmmeters. SerialBlock for meter. | def getSchedulesBuffer(self, period_group):
""" Return the requested tariff schedule :class:`~ekmmeters.SerialBlock` for meter.
Args:
period_group (int): A :class:`~ekmmeters.ReadSchedules` value.
Returns:
SerialBlock: The requested tariff schedules for meter.
... |
Initialize holidays: class: ~ekmmeters. SerialBlock | def initHldyDates(self):
""" Initialize holidays :class:`~ekmmeters.SerialBlock` """
self.m_hldy["reserved_20"] = [6, FieldType.Hex, ScaleType.No, "", 0, False, False]
self.m_hldy["Holiday_1_Mon"] = [2, FieldType.Int, ScaleType.No, "", 0, False, True]
self.m_hldy["Holiday_1_Day"] = [2, F... |
Initialize first month tariff: class: ~ekmmeters. SerialBlock for meter | def initMons(self):
""" Initialize first month tariff :class:`~ekmmeters.SerialBlock` for meter """
self.m_mons["reserved_echo_cmd"] = [6, FieldType.Hex, ScaleType.No, "", 0, False, False]
self.m_mons["Month_1_Tot"] = [8, FieldType.Float, ScaleType.KWH, "", 0, False, False]
self.m_mons["... |
Initialize second ( and last ) month tarifff: class: ~ekmmeters. SerialBlock for meter. | def initRevMons(self):
""" Initialize second (and last) month tarifff :class:`~ekmmeters.SerialBlock` for meter. """
self.m_rev_mons["reserved_echo_cmd"] = [6, FieldType.Hex, ScaleType.No, "", 0, False, False]
self.m_rev_mons["Month_1_Tot"] = [8, FieldType.Float, ScaleType.KWH, "", 0, False, Fal... |
Get the months tariff SerialBlock for meter. | def getMonthsBuffer(self, direction):
""" Get the months tariff SerialBlock for meter.
Args:
direction (int): A :class:`~ekmmeters.ReadMonths` value.
Returns:
SerialBlock: Requested months tariffs buffer.
"""
if direction == ReadMonths.kWhReverse:
... |
Serial set time with day of week calculation. | def setTime(self, yy, mm, dd, hh, minutes, ss, password="00000000"):
""" Serial set time with day of week calculation.
Args:
yy (int): Last two digits of year.
mm (int): Month 1-12.
dd (int): Day 1-31
hh (int): Hour 0 to 23.
minutes (int): Min... |
Serial call to set CT ratio for attached inductive pickup. | def setCTRatio(self, new_ct, password="00000000"):
""" Serial call to set CT ratio for attached inductive pickup.
Args:
new_ct (int): A :class:`~ekmmeters.CTRatio` value, a legal amperage setting.
password (str): Optional password.
Returns:
bool: True on com... |
Assign one schedule tariff period to meter bufffer. | def assignSchedule(self, schedule, period, hour, minute, tariff):
""" Assign one schedule tariff period to meter bufffer.
Args:
schedule (int): A :class:`~ekmmeters.Schedules` value or in range(Extents.Schedules).
tariff (int): :class:`~ekmmeters.Tariffs` value or in range(Exten... |
Define a single season and assign a schedule | def assignSeasonSchedule(self, season, month, day, schedule):
""" Define a single season and assign a schedule
Args:
season (int): A :class:`~ekmmeters.Seasons` value or in range(Extent.Seasons).
month (int): Month 1-12.
day (int): Day 1-31.
schedule (in... |
Serial command to set seasons table. | def setSeasonSchedules(self, cmd_dict=None, password="00000000"):
""" Serial command to set seasons table.
If no dictionary is passed, the meter object buffer is used.
Args:
cmd_dict (dict): Optional dictionary of season schedules.
password (str): Optional password
... |
Set a singe holiday day and month in object buffer. | def assignHolidayDate(self, holiday, month, day):
""" Set a singe holiday day and month in object buffer.
There is no class style enum for holidays.
Args:
holiday (int): 0-19 or range(Extents.Holidays).
month (int): Month 1-12.
day (int): Day 1-31
R... |
Serial call to set holiday list. | def setHolidayDates(self, cmd_dict=None, password="00000000"):
""" Serial call to set holiday list.
If a buffer dictionary is not supplied, the method will use
the class object buffer populated with assignHolidayDate.
Args:
cmd_dict (dict): Optional dictionary of holidays.
... |
Serial call to set weekend and holiday: class: ~ekmmeters. Schedules. | def setWeekendHolidaySchedules(self, new_wknd, new_hldy, password="00000000"):
""" Serial call to set weekend and holiday :class:`~ekmmeters.Schedules`.
Args:
new_wknd (int): :class:`~ekmmeters.Schedules` value to assign.
new_hldy (int): :class:`~ekmmeters.Schedules` value to as... |
Serial call to read schedule tariffs buffer | def readSchedules(self, tableset):
""" Serial call to read schedule tariffs buffer
Args:
tableset (int): :class:`~ekmmeters.ReadSchedules` buffer to return.
Returns:
bool: True on completion and ACK.
"""
self.setContext("readSchedules")
try:
... |
Read a single schedule tariff from meter object buffer. | def extractSchedule(self, schedule, period):
""" Read a single schedule tariff from meter object buffer.
Args:
schedule (int): A :class:`~ekmmeters.Schedules` value or in range(Extent.Schedules).
tariff (int): A :class:`~ekmmeters.Tariffs` value or in range(Extent.Tariffs).
... |
Serial call to read month tariffs block into meter object buffer. | def readMonthTariffs(self, months_type):
""" Serial call to read month tariffs block into meter object buffer.
Args:
months_type (int): A :class:`~ekmmeters.ReadMonths` value.
Returns:
bool: True on completion.
"""
self.setContext("readMonthTariffs")
... |
Extract the tariff for a single month from the meter object buffer. | def extractMonthTariff(self, month):
""" Extract the tariff for a single month from the meter object buffer.
Args:
month (int): A :class:`~ekmmeters.Months` value or range(Extents.Months).
Returns:
tuple: The eight tariff period totals for month. The return tuple break... |
Serial call to read holiday dates into meter object buffer. | def readHolidayDates(self):
""" Serial call to read holiday dates into meter object buffer.
Returns:
bool: True on completion.
"""
self.setContext("readHolidayDates")
try:
req_str = "0152310230304230282903"
self.request(False)
req_... |
Read a single holiday date from meter buffer. | def extractHolidayDate(self, setting_holiday):
""" Read a single holiday date from meter buffer.
Args:
setting_holiday (int): Holiday from 0-19 or in range(Extents.Holidays)
Returns:
tuple: Holiday tuple, elements are strings.
=============== =============... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.