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
test
Meter.extractHolidayWeekendSchedules
extract holiday and weekend :class:`~ekmmeters.Schedule` from meter object buffer. Returns: tuple: Holiday and weekend :class:`~ekmmeters.Schedule` values, as strings. ======= ====================================== Holiday :class:`~ekmmeters.Schedule` as string ...
ekmmeters.py
def extractHolidayWeekendSchedules(self): """ extract holiday and weekend :class:`~ekmmeters.Schedule` from meter object buffer. Returns: tuple: Holiday and weekend :class:`~ekmmeters.Schedule` values, as strings. ======= ====================================== Holid...
def extractHolidayWeekendSchedules(self): """ extract holiday and weekend :class:`~ekmmeters.Schedule` from meter object buffer. Returns: tuple: Holiday and weekend :class:`~ekmmeters.Schedule` values, as strings. ======= ====================================== Holid...
[ "extract", "holiday", "and", "weekend", ":", "class", ":", "~ekmmeters", ".", "Schedule", "from", "meter", "object", "buffer", "." ]
ekmmetering/ekmmeters
python
https://github.com/ekmmetering/ekmmeters/blob/b3748bdf30263bfa46ea40157bdf8df2522e1904/ekmmeters.py#L2931-L2946
[ "def", "extractHolidayWeekendSchedules", "(", "self", ")", ":", "result", "=", "namedtuple", "(", "\"result\"", ",", "[", "\"Weekend\"", ",", "\"Holiday\"", "]", ")", "result", ".", "Weekend", "=", "self", ".", "m_hldy", "[", "\"Weekend_Schd\"", "]", "[", "M...
b3748bdf30263bfa46ea40157bdf8df2522e1904
test
Meter.readSettings
Recommended call to read all meter settings at once. Returns: bool: True if all subsequent serial calls completed with ACK.
ekmmeters.py
def readSettings(self): """Recommended call to read all meter settings at once. Returns: bool: True if all subsequent serial calls completed with ACK. """ success = (self.readHolidayDates() and self.readMonthTariffs(ReadMonths.kWh) and s...
def readSettings(self): """Recommended call to read all meter settings at once. Returns: bool: True if all subsequent serial calls completed with ACK. """ success = (self.readHolidayDates() and self.readMonthTariffs(ReadMonths.kWh) and s...
[ "Recommended", "call", "to", "read", "all", "meter", "settings", "at", "once", "." ]
ekmmetering/ekmmeters
python
https://github.com/ekmmetering/ekmmeters/blob/b3748bdf30263bfa46ea40157bdf8df2522e1904/ekmmeters.py#L2948-L2959
[ "def", "readSettings", "(", "self", ")", ":", "success", "=", "(", "self", ".", "readHolidayDates", "(", ")", "and", "self", ".", "readMonthTariffs", "(", "ReadMonths", ".", "kWh", ")", "and", "self", ".", "readMonthTariffs", "(", "ReadMonths", ".", "kWhRe...
b3748bdf30263bfa46ea40157bdf8df2522e1904
test
Meter.writeCmdMsg
Internal method to set the command result string. Args: msg (str): Message built during command.
ekmmeters.py
def writeCmdMsg(self, msg): """ Internal method to set the command result string. Args: msg (str): Message built during command. """ ekm_log("(writeCmdMsg | " + self.getContext() + ") " + msg) self.m_command_msg = msg
def writeCmdMsg(self, msg): """ Internal method to set the command result string. Args: msg (str): Message built during command. """ ekm_log("(writeCmdMsg | " + self.getContext() + ") " + msg) self.m_command_msg = msg
[ "Internal", "method", "to", "set", "the", "command", "result", "string", "." ]
ekmmetering/ekmmeters
python
https://github.com/ekmmetering/ekmmeters/blob/b3748bdf30263bfa46ea40157bdf8df2522e1904/ekmmeters.py#L2961-L2968
[ "def", "writeCmdMsg", "(", "self", ",", "msg", ")", ":", "ekm_log", "(", "\"(writeCmdMsg | \"", "+", "self", ".", "getContext", "(", ")", "+", "\") \"", "+", "msg", ")", "self", ".", "m_command_msg", "=", "msg" ]
b3748bdf30263bfa46ea40157bdf8df2522e1904
test
Meter.serialCmdPwdAuth
Password step of set commands This method is normally called within another serial command, so it does not issue a termination string. Any default password is set in the caller parameter list, never here. Args: password_str (str): Required password. Returns: ...
ekmmeters.py
def serialCmdPwdAuth(self, password_str): """ Password step of set commands This method is normally called within another serial command, so it does not issue a termination string. Any default password is set in the caller parameter list, never here. Args: password...
def serialCmdPwdAuth(self, password_str): """ Password step of set commands This method is normally called within another serial command, so it does not issue a termination string. Any default password is set in the caller parameter list, never here. Args: password...
[ "Password", "step", "of", "set", "commands" ]
ekmmetering/ekmmeters
python
https://github.com/ekmmetering/ekmmeters/blob/b3748bdf30263bfa46ea40157bdf8df2522e1904/ekmmeters.py#L2982-L3011
[ "def", "serialCmdPwdAuth", "(", "self", ",", "password_str", ")", ":", "result", "=", "False", "try", ":", "req_start", "=", "\"0150310228\"", "+", "binascii", ".", "hexlify", "(", "password_str", ")", "+", "\"2903\"", "req_crc", "=", "self", ".", "calc_crc1...
b3748bdf30263bfa46ea40157bdf8df2522e1904
test
V3Meter.initWorkFormat
Initialize :class:`~ekmmeters.SerialBlock` for V3 read.
ekmmeters.py
def initWorkFormat(self): """ Initialize :class:`~ekmmeters.SerialBlock` for V3 read. """ self.m_blk_a["reserved_10"] = [1, FieldType.Hex, ScaleType.No, "", 0, False, False] self.m_blk_a[Field.Model] = [2, FieldType.Hex, ScaleType.No, "", 0, False, True] self.m_blk_a[Field.Firmware] = [1...
def initWorkFormat(self): """ Initialize :class:`~ekmmeters.SerialBlock` for V3 read. """ self.m_blk_a["reserved_10"] = [1, FieldType.Hex, ScaleType.No, "", 0, False, False] self.m_blk_a[Field.Model] = [2, FieldType.Hex, ScaleType.No, "", 0, False, True] self.m_blk_a[Field.Firmware] = [1...
[ "Initialize", ":", "class", ":", "~ekmmeters", ".", "SerialBlock", "for", "V3", "read", "." ]
ekmmetering/ekmmeters
python
https://github.com/ekmmetering/ekmmeters/blob/b3748bdf30263bfa46ea40157bdf8df2522e1904/ekmmeters.py#L3093-L3139
[ "def", "initWorkFormat", "(", "self", ")", ":", "self", ".", "m_blk_a", "[", "\"reserved_10\"", "]", "=", "[", "1", ",", "FieldType", ".", "Hex", ",", "ScaleType", ".", "No", ",", "\"\"", ",", "0", ",", "False", ",", "False", "]", "self", ".", "m_b...
b3748bdf30263bfa46ea40157bdf8df2522e1904
test
V3Meter.request
Required request() override for v3 and standard method to read meter. Args: send_terminator (bool): Send termination string at end of read. Returns: bool: CRC request flag result from most recent read
ekmmeters.py
def request(self, send_terminator = False): """Required request() override for v3 and standard method to read meter. Args: send_terminator (bool): Send termination string at end of read. Returns: bool: CRC request flag result from most recent read """ se...
def request(self, send_terminator = False): """Required request() override for v3 and standard method to read meter. Args: send_terminator (bool): Send termination string at end of read. Returns: bool: CRC request flag result from most recent read """ se...
[ "Required", "request", "()", "override", "for", "v3", "and", "standard", "method", "to", "read", "meter", "." ]
ekmmetering/ekmmeters
python
https://github.com/ekmmetering/ekmmeters/blob/b3748bdf30263bfa46ea40157bdf8df2522e1904/ekmmeters.py#L3141-L3169
[ "def", "request", "(", "self", ",", "send_terminator", "=", "False", ")", ":", "self", ".", "m_a_crc", "=", "False", "start_context", "=", "self", ".", "getContext", "(", ")", "self", ".", "setContext", "(", "\"request[v3A]\"", ")", "try", ":", "self", "...
b3748bdf30263bfa46ea40157bdf8df2522e1904
test
V3Meter.makeReturnFormat
Strip reserved and CRC for m_req :class:`~ekmmeters.SerialBlock`.
ekmmeters.py
def makeReturnFormat(self): """ Strip reserved and CRC for m_req :class:`~ekmmeters.SerialBlock`. """ for fld in self.m_blk_a: compare_fld = fld.upper() if not "RESERVED" in compare_fld and not "CRC" in compare_fld: self.m_req[fld] = self.m_blk_a[fld] pass
def makeReturnFormat(self): """ Strip reserved and CRC for m_req :class:`~ekmmeters.SerialBlock`. """ for fld in self.m_blk_a: compare_fld = fld.upper() if not "RESERVED" in compare_fld and not "CRC" in compare_fld: self.m_req[fld] = self.m_blk_a[fld] pass
[ "Strip", "reserved", "and", "CRC", "for", "m_req", ":", "class", ":", "~ekmmeters", ".", "SerialBlock", "." ]
ekmmetering/ekmmeters
python
https://github.com/ekmmetering/ekmmeters/blob/b3748bdf30263bfa46ea40157bdf8df2522e1904/ekmmeters.py#L3171-L3177
[ "def", "makeReturnFormat", "(", "self", ")", ":", "for", "fld", "in", "self", ".", "m_blk_a", ":", "compare_fld", "=", "fld", ".", "upper", "(", ")", "if", "not", "\"RESERVED\"", "in", "compare_fld", "and", "not", "\"CRC\"", "in", "compare_fld", ":", "se...
b3748bdf30263bfa46ea40157bdf8df2522e1904
test
V3Meter.insert
Insert to :class:`~ekmmeters.MeterDB` subclass. Please note MeterDB subclassing is only for simplest-case. Args: meter_db (MeterDB): Instance of subclass of MeterDB.
ekmmeters.py
def insert(self, meter_db): """ Insert to :class:`~ekmmeters.MeterDB` subclass. Please note MeterDB subclassing is only for simplest-case. Args: meter_db (MeterDB): Instance of subclass of MeterDB. """ if meter_db: meter_db.dbInsert(self.m_req, self.m_r...
def insert(self, meter_db): """ Insert to :class:`~ekmmeters.MeterDB` subclass. Please note MeterDB subclassing is only for simplest-case. Args: meter_db (MeterDB): Instance of subclass of MeterDB. """ if meter_db: meter_db.dbInsert(self.m_req, self.m_r...
[ "Insert", "to", ":", "class", ":", "~ekmmeters", ".", "MeterDB", "subclass", "." ]
ekmmetering/ekmmeters
python
https://github.com/ekmmetering/ekmmeters/blob/b3748bdf30263bfa46ea40157bdf8df2522e1904/ekmmeters.py#L3189-L3201
[ "def", "insert", "(", "self", ",", "meter_db", ")", ":", "if", "meter_db", ":", "meter_db", ".", "dbInsert", "(", "self", ".", "m_req", ",", "self", ".", "m_raw_read_a", ",", "self", ".", "m_raw_read_b", ")", "else", ":", "ekm_log", "(", "\"Attempt to in...
b3748bdf30263bfa46ea40157bdf8df2522e1904
test
V3Meter.updateObservers
Fire update method in all attached observers in order of attachment.
ekmmeters.py
def updateObservers(self): """ Fire update method in all attached observers in order of attachment. """ for observer in self.m_observers: try: observer.update(self.m_req) except: ekm_log(traceback.format_exc(sys.exc_info()))
def updateObservers(self): """ Fire update method in all attached observers in order of attachment. """ for observer in self.m_observers: try: observer.update(self.m_req) except: ekm_log(traceback.format_exc(sys.exc_info()))
[ "Fire", "update", "method", "in", "all", "attached", "observers", "in", "order", "of", "attachment", "." ]
ekmmetering/ekmmeters
python
https://github.com/ekmmetering/ekmmeters/blob/b3748bdf30263bfa46ea40157bdf8df2522e1904/ekmmeters.py#L3203-L3209
[ "def", "updateObservers", "(", "self", ")", ":", "for", "observer", "in", "self", ".", "m_observers", ":", "try", ":", "observer", ".", "update", "(", "self", ".", "m_req", ")", "except", ":", "ekm_log", "(", "traceback", ".", "format_exc", "(", "sys", ...
b3748bdf30263bfa46ea40157bdf8df2522e1904
test
V3Meter.getField
Return :class:`~ekmmeters.Field` content, scaled and formatted. Args: fld_name (str): A :class:`~ekmmeters.Field` value which is on your meter. Returns: str: String value (scaled if numeric) for the field.
ekmmeters.py
def getField(self, fld_name): """ Return :class:`~ekmmeters.Field` content, scaled and formatted. Args: fld_name (str): A :class:`~ekmmeters.Field` value which is on your meter. Returns: str: String value (scaled if numeric) for the field. """ result = "...
def getField(self, fld_name): """ Return :class:`~ekmmeters.Field` content, scaled and formatted. Args: fld_name (str): A :class:`~ekmmeters.Field` value which is on your meter. Returns: str: String value (scaled if numeric) for the field. """ result = "...
[ "Return", ":", "class", ":", "~ekmmeters", ".", "Field", "content", "scaled", "and", "formatted", "." ]
ekmmetering/ekmmeters
python
https://github.com/ekmmetering/ekmmeters/blob/b3748bdf30263bfa46ea40157bdf8df2522e1904/ekmmeters.py#L3211-L3226
[ "def", "getField", "(", "self", ",", "fld_name", ")", ":", "result", "=", "\"\"", "if", "fld_name", "in", "self", ".", "m_req", ":", "result", "=", "self", ".", "m_req", "[", "fld_name", "]", "[", "MeterData", ".", "StringValue", "]", "else", ":", "e...
b3748bdf30263bfa46ea40157bdf8df2522e1904
test
V4Meter.initFormatA
Initialize A read :class:`~ekmmeters.SerialBlock`.
ekmmeters.py
def initFormatA(self): """ Initialize A read :class:`~ekmmeters.SerialBlock`.""" self.m_blk_a["reserved_1"] = [1, FieldType.Hex, ScaleType.No, "", 0, False, False] self.m_blk_a[Field.Model] = [2, FieldType.Hex, ScaleType.No, "", 0, False, True] self.m_blk_a[Field.Firmware] = [1, FieldTyp...
def initFormatA(self): """ Initialize A read :class:`~ekmmeters.SerialBlock`.""" self.m_blk_a["reserved_1"] = [1, FieldType.Hex, ScaleType.No, "", 0, False, False] self.m_blk_a[Field.Model] = [2, FieldType.Hex, ScaleType.No, "", 0, False, True] self.m_blk_a[Field.Firmware] = [1, FieldTyp...
[ "Initialize", "A", "read", ":", "class", ":", "~ekmmeters", ".", "SerialBlock", "." ]
ekmmetering/ekmmeters
python
https://github.com/ekmmetering/ekmmeters/blob/b3748bdf30263bfa46ea40157bdf8df2522e1904/ekmmeters.py#L3299-L3349
[ "def", "initFormatA", "(", "self", ")", ":", "self", ".", "m_blk_a", "[", "\"reserved_1\"", "]", "=", "[", "1", ",", "FieldType", ".", "Hex", ",", "ScaleType", ".", "No", ",", "\"\"", ",", "0", ",", "False", ",", "False", "]", "self", ".", "m_blk_a...
b3748bdf30263bfa46ea40157bdf8df2522e1904
test
V4Meter.initFormatB
Initialize B read :class:`~ekmmeters.SerialBlock`.
ekmmeters.py
def initFormatB(self): """ Initialize B read :class:`~ekmmeters.SerialBlock`.""" self.m_blk_b["reserved_5"] = [1, FieldType.Hex, ScaleType.No, "", 0, False, False] self.m_blk_b[Field.Model] = [2, FieldType.Hex, ScaleType.No, "", 0, False, True] self.m_blk_b[Field.Firmware] = [1, FieldTyp...
def initFormatB(self): """ Initialize B read :class:`~ekmmeters.SerialBlock`.""" self.m_blk_b["reserved_5"] = [1, FieldType.Hex, ScaleType.No, "", 0, False, False] self.m_blk_b[Field.Model] = [2, FieldType.Hex, ScaleType.No, "", 0, False, True] self.m_blk_b[Field.Firmware] = [1, FieldTyp...
[ "Initialize", "B", "read", ":", "class", ":", "~ekmmeters", ".", "SerialBlock", "." ]
ekmmetering/ekmmeters
python
https://github.com/ekmmetering/ekmmeters/blob/b3748bdf30263bfa46ea40157bdf8df2522e1904/ekmmeters.py#L3351-L3401
[ "def", "initFormatB", "(", "self", ")", ":", "self", ".", "m_blk_b", "[", "\"reserved_5\"", "]", "=", "[", "1", ",", "FieldType", ".", "Hex", ",", "ScaleType", ".", "No", ",", "\"\"", ",", "0", ",", "False", ",", "False", "]", "self", ".", "m_blk_b...
b3748bdf30263bfa46ea40157bdf8df2522e1904
test
V4Meter.initLcdLookup
Initialize lookup table for string input of LCD fields
ekmmeters.py
def initLcdLookup(self): """ Initialize lookup table for string input of LCD fields """ self.m_lcd_lookup["kWh_Tot"] = LCDItems.kWh_Tot self.m_lcd_lookup["Rev_kWh_Tot"] = LCDItems.Rev_kWh_Tot self.m_lcd_lookup["RMS_Volts_Ln_1"] = LCDItems.RMS_Volts_Ln_1 self.m_lcd_lookup["RMS_Vol...
def initLcdLookup(self): """ Initialize lookup table for string input of LCD fields """ self.m_lcd_lookup["kWh_Tot"] = LCDItems.kWh_Tot self.m_lcd_lookup["Rev_kWh_Tot"] = LCDItems.Rev_kWh_Tot self.m_lcd_lookup["RMS_Volts_Ln_1"] = LCDItems.RMS_Volts_Ln_1 self.m_lcd_lookup["RMS_Vol...
[ "Initialize", "lookup", "table", "for", "string", "input", "of", "LCD", "fields" ]
ekmmetering/ekmmeters
python
https://github.com/ekmmetering/ekmmeters/blob/b3748bdf30263bfa46ea40157bdf8df2522e1904/ekmmeters.py#L3403-L3446
[ "def", "initLcdLookup", "(", "self", ")", ":", "self", ".", "m_lcd_lookup", "[", "\"kWh_Tot\"", "]", "=", "LCDItems", ".", "kWh_Tot", "self", ".", "m_lcd_lookup", "[", "\"Rev_kWh_Tot\"", "]", "=", "LCDItems", ".", "Rev_kWh_Tot", "self", ".", "m_lcd_lookup", ...
b3748bdf30263bfa46ea40157bdf8df2522e1904
test
V4Meter.request
Combined A and B read for V4 meter. Args: send_terminator (bool): Send termination string at end of read. Returns: bool: True on completion.
ekmmeters.py
def request(self, send_terminator = False): """ Combined A and B read for V4 meter. Args: send_terminator (bool): Send termination string at end of read. Returns: bool: True on completion. """ try: retA = self.requestA() retB = se...
def request(self, send_terminator = False): """ Combined A and B read for V4 meter. Args: send_terminator (bool): Send termination string at end of read. Returns: bool: True on completion. """ try: retA = self.requestA() retB = se...
[ "Combined", "A", "and", "B", "read", "for", "V4", "meter", "." ]
ekmmetering/ekmmeters
python
https://github.com/ekmmetering/ekmmeters/blob/b3748bdf30263bfa46ea40157bdf8df2522e1904/ekmmeters.py#L3448-L3468
[ "def", "request", "(", "self", ",", "send_terminator", "=", "False", ")", ":", "try", ":", "retA", "=", "self", ".", "requestA", "(", ")", "retB", "=", "self", ".", "requestB", "(", ")", "if", "retA", "and", "retB", ":", "self", ".", "makeAB", "(",...
b3748bdf30263bfa46ea40157bdf8df2522e1904
test
V4Meter.requestA
Issue an A read on V4 meter. Returns: bool: True if CRC match at end of call.
ekmmeters.py
def requestA(self): """Issue an A read on V4 meter. Returns: bool: True if CRC match at end of call. """ work_context = self.getContext() self.setContext("request[v4A]") self.m_serial_port.write("2f3f".decode("hex") + self.m_meter_address + "3030210d0a".decod...
def requestA(self): """Issue an A read on V4 meter. Returns: bool: True if CRC match at end of call. """ work_context = self.getContext() self.setContext("request[v4A]") self.m_serial_port.write("2f3f".decode("hex") + self.m_meter_address + "3030210d0a".decod...
[ "Issue", "an", "A", "read", "on", "V4", "meter", "." ]
ekmmetering/ekmmeters
python
https://github.com/ekmmetering/ekmmeters/blob/b3748bdf30263bfa46ea40157bdf8df2522e1904/ekmmeters.py#L3470-L3485
[ "def", "requestA", "(", "self", ")", ":", "work_context", "=", "self", ".", "getContext", "(", ")", "self", ".", "setContext", "(", "\"request[v4A]\"", ")", "self", ".", "m_serial_port", ".", "write", "(", "\"2f3f\"", ".", "decode", "(", "\"hex\"", ")", ...
b3748bdf30263bfa46ea40157bdf8df2522e1904
test
V4Meter.requestB
Issue a B read on V4 meter. Returns: bool: True if CRC match at end of call.
ekmmeters.py
def requestB(self): """ Issue a B read on V4 meter. Returns: bool: True if CRC match at end of call. """ work_context = self.getContext() self.setContext("request[v4B]") self.m_serial_port.write("2f3f".decode("hex") + self.m_meter_address + "3031210d0a".decod...
def requestB(self): """ Issue a B read on V4 meter. Returns: bool: True if CRC match at end of call. """ work_context = self.getContext() self.setContext("request[v4B]") self.m_serial_port.write("2f3f".decode("hex") + self.m_meter_address + "3031210d0a".decod...
[ "Issue", "a", "B", "read", "on", "V4", "meter", "." ]
ekmmetering/ekmmeters
python
https://github.com/ekmmetering/ekmmeters/blob/b3748bdf30263bfa46ea40157bdf8df2522e1904/ekmmeters.py#L3487-L3501
[ "def", "requestB", "(", "self", ")", ":", "work_context", "=", "self", ".", "getContext", "(", ")", "self", ".", "setContext", "(", "\"request[v4B]\"", ")", "self", ".", "m_serial_port", ".", "write", "(", "\"2f3f\"", ".", "decode", "(", "\"hex\"", ")", ...
b3748bdf30263bfa46ea40157bdf8df2522e1904
test
V4Meter.makeAB
Munge A and B reads into single serial block with only unique fields.
ekmmeters.py
def makeAB(self): """ Munge A and B reads into single serial block with only unique fields.""" for fld in self.m_blk_a: compare_fld = fld.upper() if not "RESERVED" in compare_fld and not "CRC" in compare_fld: self.m_req[fld] = self.m_blk_a[fld] for fld in ...
def makeAB(self): """ Munge A and B reads into single serial block with only unique fields.""" for fld in self.m_blk_a: compare_fld = fld.upper() if not "RESERVED" in compare_fld and not "CRC" in compare_fld: self.m_req[fld] = self.m_blk_a[fld] for fld in ...
[ "Munge", "A", "and", "B", "reads", "into", "single", "serial", "block", "with", "only", "unique", "fields", "." ]
ekmmetering/ekmmeters
python
https://github.com/ekmmetering/ekmmeters/blob/b3748bdf30263bfa46ea40157bdf8df2522e1904/ekmmeters.py#L3503-L3513
[ "def", "makeAB", "(", "self", ")", ":", "for", "fld", "in", "self", ".", "m_blk_a", ":", "compare_fld", "=", "fld", ".", "upper", "(", ")", "if", "not", "\"RESERVED\"", "in", "compare_fld", "and", "not", "\"CRC\"", "in", "compare_fld", ":", "self", "."...
b3748bdf30263bfa46ea40157bdf8df2522e1904
test
V4Meter.calculateFields
Write calculated fields for read buffer.
ekmmeters.py
def calculateFields(self): """Write calculated fields for read buffer.""" pf1 = self.m_blk_b[Field.Cos_Theta_Ln_1][MeterData.StringValue] pf2 = self.m_blk_b[Field.Cos_Theta_Ln_2][MeterData.StringValue] pf3 = self.m_blk_b[Field.Cos_Theta_Ln_3][MeterData.StringValue] pf1_int = sel...
def calculateFields(self): """Write calculated fields for read buffer.""" pf1 = self.m_blk_b[Field.Cos_Theta_Ln_1][MeterData.StringValue] pf2 = self.m_blk_b[Field.Cos_Theta_Ln_2][MeterData.StringValue] pf3 = self.m_blk_b[Field.Cos_Theta_Ln_3][MeterData.StringValue] pf1_int = sel...
[ "Write", "calculated", "fields", "for", "read", "buffer", "." ]
ekmmetering/ekmmeters
python
https://github.com/ekmmetering/ekmmeters/blob/b3748bdf30263bfa46ea40157bdf8df2522e1904/ekmmeters.py#L3543-L3616
[ "def", "calculateFields", "(", "self", ")", ":", "pf1", "=", "self", ".", "m_blk_b", "[", "Field", ".", "Cos_Theta_Ln_1", "]", "[", "MeterData", ".", "StringValue", "]", "pf2", "=", "self", ".", "m_blk_b", "[", "Field", ".", "Cos_Theta_Ln_2", "]", "[", ...
b3748bdf30263bfa46ea40157bdf8df2522e1904
test
V4Meter.setLCDCmd
Single call wrapper for LCD set." Wraps :func:`~ekmmeters.V4Meter.setLcd` and associated init and add methods. Args: display_list (list): List composed of :class:`~ekmmeters.LCDItems` password (str): Optional password. Returns: bool: Passthrough from :func:...
ekmmeters.py
def setLCDCmd(self, display_list, password="00000000"): """ Single call wrapper for LCD set." Wraps :func:`~ekmmeters.V4Meter.setLcd` and associated init and add methods. Args: display_list (list): List composed of :class:`~ekmmeters.LCDItems` password (str): Optional p...
def setLCDCmd(self, display_list, password="00000000"): """ Single call wrapper for LCD set." Wraps :func:`~ekmmeters.V4Meter.setLcd` and associated init and add methods. Args: display_list (list): List composed of :class:`~ekmmeters.LCDItems` password (str): Optional p...
[ "Single", "call", "wrapper", "for", "LCD", "set", "." ]
ekmmetering/ekmmeters
python
https://github.com/ekmmetering/ekmmeters/blob/b3748bdf30263bfa46ea40157bdf8df2522e1904/ekmmeters.py#L3657-L3683
[ "def", "setLCDCmd", "(", "self", ",", "display_list", ",", "password", "=", "\"00000000\"", ")", ":", "result", "=", "False", "try", ":", "self", ".", "initLcd", "(", ")", "item_cnt", "=", "len", "(", "display_list", ")", "if", "(", "item_cnt", ">", "4...
b3748bdf30263bfa46ea40157bdf8df2522e1904
test
V4Meter.setRelay
Serial call to set relay. Args: seconds (int): Seconds to hold, ero is hold forever. See :class:`~ekmmeters.RelayInterval`. relay (int): Selected relay, see :class:`~ekmmeters.Relay`. status (int): Status to set, see :class:`~ekmmeters.RelayState` password (str):...
ekmmeters.py
def setRelay(self, seconds, relay, status, password="00000000"): """Serial call to set relay. Args: seconds (int): Seconds to hold, ero is hold forever. See :class:`~ekmmeters.RelayInterval`. relay (int): Selected relay, see :class:`~ekmmeters.Relay`. status (int): S...
def setRelay(self, seconds, relay, status, password="00000000"): """Serial call to set relay. Args: seconds (int): Seconds to hold, ero is hold forever. See :class:`~ekmmeters.RelayInterval`. relay (int): Selected relay, see :class:`~ekmmeters.Relay`. status (int): S...
[ "Serial", "call", "to", "set", "relay", "." ]
ekmmetering/ekmmeters
python
https://github.com/ekmmetering/ekmmeters/blob/b3748bdf30263bfa46ea40157bdf8df2522e1904/ekmmeters.py#L3685-L3734
[ "def", "setRelay", "(", "self", ",", "seconds", ",", "relay", ",", "status", ",", "password", "=", "\"00000000\"", ")", ":", "result", "=", "False", "self", ".", "setContext", "(", "\"setRelay\"", ")", "try", ":", "self", ".", "clearCmdMsg", "(", ")", ...
b3748bdf30263bfa46ea40157bdf8df2522e1904
test
V4Meter.serialPostEnd
Send termination string to implicit current meter.
ekmmeters.py
def serialPostEnd(self): """ Send termination string to implicit current meter.""" ekm_log("Termination string sent (" + self.m_context + ")") try: self.m_serial_port.write("0142300375".decode("hex")) except: ekm_log(traceback.format_exc(sys.exc_info())) ...
def serialPostEnd(self): """ Send termination string to implicit current meter.""" ekm_log("Termination string sent (" + self.m_context + ")") try: self.m_serial_port.write("0142300375".decode("hex")) except: ekm_log(traceback.format_exc(sys.exc_info())) ...
[ "Send", "termination", "string", "to", "implicit", "current", "meter", "." ]
ekmmetering/ekmmeters
python
https://github.com/ekmmetering/ekmmeters/blob/b3748bdf30263bfa46ea40157bdf8df2522e1904/ekmmeters.py#L3736-L3745
[ "def", "serialPostEnd", "(", "self", ")", ":", "ekm_log", "(", "\"Termination string sent (\"", "+", "self", ".", "m_context", "+", "\")\"", ")", "try", ":", "self", ".", "m_serial_port", ".", "write", "(", "\"0142300375\"", ".", "decode", "(", "\"hex\"", ")...
b3748bdf30263bfa46ea40157bdf8df2522e1904
test
V4Meter.setPulseInputRatio
Serial call to set pulse input ratio on a line. Args: line_in (int): Member of :class:`~ekmmeters.Pulse` new_cnst (int): New pulse input ratio password (str): Optional password Returns:
ekmmeters.py
def setPulseInputRatio(self, line_in, new_cnst, password="00000000"): """Serial call to set pulse input ratio on a line. Args: line_in (int): Member of :class:`~ekmmeters.Pulse` new_cnst (int): New pulse input ratio password (str): Optional password Returns:...
def setPulseInputRatio(self, line_in, new_cnst, password="00000000"): """Serial call to set pulse input ratio on a line. Args: line_in (int): Member of :class:`~ekmmeters.Pulse` new_cnst (int): New pulse input ratio password (str): Optional password Returns:...
[ "Serial", "call", "to", "set", "pulse", "input", "ratio", "on", "a", "line", "." ]
ekmmetering/ekmmeters
python
https://github.com/ekmmetering/ekmmeters/blob/b3748bdf30263bfa46ea40157bdf8df2522e1904/ekmmeters.py#L3747-L3782
[ "def", "setPulseInputRatio", "(", "self", ",", "line_in", ",", "new_cnst", ",", "password", "=", "\"00000000\"", ")", ":", "result", "=", "False", "self", ".", "setContext", "(", "\"setPulseInputRatio\"", ")", "try", ":", "if", "not", "self", ".", "requestA"...
b3748bdf30263bfa46ea40157bdf8df2522e1904
test
V4Meter.setZeroResettableKWH
Serial call to zero resettable kWh registers. Args: password (str): Optional password. Returns: bool: True on completion and ACK.
ekmmeters.py
def setZeroResettableKWH(self, password="00000000"): """ Serial call to zero resettable kWh registers. Args: password (str): Optional password. Returns: bool: True on completion and ACK. """ result = False self.setContext("setZeroResettableKWH") ...
def setZeroResettableKWH(self, password="00000000"): """ Serial call to zero resettable kWh registers. Args: password (str): Optional password. Returns: bool: True on completion and ACK. """ result = False self.setContext("setZeroResettableKWH") ...
[ "Serial", "call", "to", "zero", "resettable", "kWh", "registers", "." ]
ekmmetering/ekmmeters
python
https://github.com/ekmmetering/ekmmeters/blob/b3748bdf30263bfa46ea40157bdf8df2522e1904/ekmmeters.py#L3784-L3813
[ "def", "setZeroResettableKWH", "(", "self", ",", "password", "=", "\"00000000\"", ")", ":", "result", "=", "False", "self", ".", "setContext", "(", "\"setZeroResettableKWH\"", ")", "try", ":", "if", "not", "self", ".", "requestA", "(", ")", ":", "self", "....
b3748bdf30263bfa46ea40157bdf8df2522e1904
test
V4Meter.setLCD
Serial call to set LCD using meter object bufer. Used with :func:`~ekmmeters.V4Meter.addLcdItem`. Args: password (str): Optional password Returns: bool: True on completion and ACK.
ekmmeters.py
def setLCD(self, password="00000000"): """ Serial call to set LCD using meter object bufer. Used with :func:`~ekmmeters.V4Meter.addLcdItem`. Args: password (str): Optional password Returns: bool: True on completion and ACK. """ result = False ...
def setLCD(self, password="00000000"): """ Serial call to set LCD using meter object bufer. Used with :func:`~ekmmeters.V4Meter.addLcdItem`. Args: password (str): Optional password Returns: bool: True on completion and ACK. """ result = False ...
[ "Serial", "call", "to", "set", "LCD", "using", "meter", "object", "bufer", "." ]
ekmmetering/ekmmeters
python
https://github.com/ekmmetering/ekmmeters/blob/b3748bdf30263bfa46ea40157bdf8df2522e1904/ekmmeters.py#L3868-L3918
[ "def", "setLCD", "(", "self", ",", "password", "=", "\"00000000\"", ")", ":", "result", "=", "False", "self", ".", "setContext", "(", "\"setLCD\"", ")", "try", ":", "self", ".", "clearCmdMsg", "(", ")", "if", "len", "(", "password", ")", "!=", "8", "...
b3748bdf30263bfa46ea40157bdf8df2522e1904
test
iterate_fields
Recursively iterate over all DictField sub-fields. :param fields: Field instance (e.g. input) :type fields: dict :param schema: Schema instance (e.g. input_schema) :type schema: dict
genesis/utils.py
def iterate_fields(fields, schema): """Recursively iterate over all DictField sub-fields. :param fields: Field instance (e.g. input) :type fields: dict :param schema: Schema instance (e.g. input_schema) :type schema: dict """ schema_dict = {val['name']: val for val in schema} for field...
def iterate_fields(fields, schema): """Recursively iterate over all DictField sub-fields. :param fields: Field instance (e.g. input) :type fields: dict :param schema: Schema instance (e.g. input_schema) :type schema: dict """ schema_dict = {val['name']: val for val in schema} for field...
[ "Recursively", "iterate", "over", "all", "DictField", "sub", "-", "fields", "." ]
genialis/genesis-pyapi
python
https://github.com/genialis/genesis-pyapi/blob/dfe9bcc8b332a8b9873db4ab9994b0cc10eb209a/genesis/utils.py#L4-L19
[ "def", "iterate_fields", "(", "fields", ",", "schema", ")", ":", "schema_dict", "=", "{", "val", "[", "'name'", "]", ":", "val", "for", "val", "in", "schema", "}", "for", "field_id", ",", "properties", "in", "fields", ".", "iteritems", "(", ")", ":", ...
dfe9bcc8b332a8b9873db4ab9994b0cc10eb209a
test
iterate_schema
Recursively iterate over all schema sub-fields. :param fields: Field instance (e.g. input) :type fields: dict :param schema: Schema instance (e.g. input_schema) :type schema: dict :path schema: Field path :path schema: string
genesis/utils.py
def iterate_schema(fields, schema, path=None): """Recursively iterate over all schema sub-fields. :param fields: Field instance (e.g. input) :type fields: dict :param schema: Schema instance (e.g. input_schema) :type schema: dict :path schema: Field path :path schema: string """ fo...
def iterate_schema(fields, schema, path=None): """Recursively iterate over all schema sub-fields. :param fields: Field instance (e.g. input) :type fields: dict :param schema: Schema instance (e.g. input_schema) :type schema: dict :path schema: Field path :path schema: string """ fo...
[ "Recursively", "iterate", "over", "all", "schema", "sub", "-", "fields", "." ]
genialis/genesis-pyapi
python
https://github.com/genialis/genesis-pyapi/blob/dfe9bcc8b332a8b9873db4ab9994b0cc10eb209a/genesis/utils.py#L36-L58
[ "def", "iterate_schema", "(", "fields", ",", "schema", ",", "path", "=", "None", ")", ":", "for", "field_schema", "in", "schema", ":", "name", "=", "field_schema", "[", "'name'", "]", "if", "'group'", "in", "field_schema", ":", "for", "rvals", "in", "ite...
dfe9bcc8b332a8b9873db4ab9994b0cc10eb209a
test
paragraphs
Random paragraphs.
forgery_py/forgery/lorem_ipsum.py
def paragraphs(quantity=2, separator='\n\n', wrap_start='', wrap_end='', html=False, sentences_quantity=3, as_list=False): """Random paragraphs.""" if html: wrap_start = '<p>' wrap_end = '</p>' separator = '\n\n' result = [] for i in xrange(0, quantity): r...
def paragraphs(quantity=2, separator='\n\n', wrap_start='', wrap_end='', html=False, sentences_quantity=3, as_list=False): """Random paragraphs.""" if html: wrap_start = '<p>' wrap_end = '</p>' separator = '\n\n' result = [] for i in xrange(0, quantity): r...
[ "Random", "paragraphs", "." ]
tomekwojcik/ForgeryPy
python
https://github.com/tomekwojcik/ForgeryPy/blob/0d1864e86b4362d8d6c215c618e8451d39a7a567/forgery_py/forgery/lorem_ipsum.py#L91-L106
[ "def", "paragraphs", "(", "quantity", "=", "2", ",", "separator", "=", "'\\n\\n'", ",", "wrap_start", "=", "''", ",", "wrap_end", "=", "''", ",", "html", "=", "False", ",", "sentences_quantity", "=", "3", ",", "as_list", "=", "False", ")", ":", "if", ...
0d1864e86b4362d8d6c215c618e8451d39a7a567
test
text
Random text. If `length` is present the text will be exactly this chars long. Else the text will be something between `at_least` and `at_most` chars long.
forgery_py/forgery/basic.py
def text(length=None, at_least=10, at_most=15, lowercase=True, uppercase=True, digits=True, spaces=True, punctuation=False): """ Random text. If `length` is present the text will be exactly this chars long. Else the text will be something between `at_least` and `at_most` chars long. """ ...
def text(length=None, at_least=10, at_most=15, lowercase=True, uppercase=True, digits=True, spaces=True, punctuation=False): """ Random text. If `length` is present the text will be exactly this chars long. Else the text will be something between `at_least` and `at_most` chars long. """ ...
[ "Random", "text", "." ]
tomekwojcik/ForgeryPy
python
https://github.com/tomekwojcik/ForgeryPy/blob/0d1864e86b4362d8d6c215c618e8451d39a7a567/forgery_py/forgery/basic.py#L42-L76
[ "def", "text", "(", "length", "=", "None", ",", "at_least", "=", "10", ",", "at_most", "=", "15", ",", "lowercase", "=", "True", ",", "uppercase", "=", "True", ",", "digits", "=", "True", ",", "spaces", "=", "True", ",", "punctuation", "=", "False", ...
0d1864e86b4362d8d6c215c618e8451d39a7a567
test
Sync.add_arguments
Add arguments to the parser for collection in app.args. Args: parser: `argparse.ArgumentParser`. Parser. Arguments added here are server on self.args.
asana_hub/actions/sync.py
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( '-c...
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( '-c...
[ "Add", "arguments", "to", "the", "parser", "for", "collection", "in", "app", ".", "args", "." ]
Loudr/asana-hub
python
https://github.com/Loudr/asana-hub/blob/af996ce890ed23d8ede5bf68dcd318e3438829cb/asana_hub/actions/sync.py#L30-L52
[ "def", "add_arguments", "(", "cls", ",", "parser", ")", ":", "parser", ".", "add_argument", "(", "'-c'", ",", "'--create-missing-tasks'", ",", "action", "=", "'store_true'", ",", "dest", "=", "'create_missing_tasks'", ",", "help", "=", "\"[sync] create asana tasks...
af996ce890ed23d8ede5bf68dcd318e3438829cb
test
Sync.apply_tasks_to_issue
Applies task numbers to an issue.
asana_hub/actions/sync.py
def apply_tasks_to_issue(self, issue, tasks, issue_body=None): """Applies task numbers to an issue.""" issue_body = issue_body or issue.body task_numbers = transport.format_task_numbers_with_links(tasks) if task_numbers: new_body = transport.ASANA_SECTION_RE.sub('', issue_bod...
def apply_tasks_to_issue(self, issue, tasks, issue_body=None): """Applies task numbers to an issue.""" issue_body = issue_body or issue.body task_numbers = transport.format_task_numbers_with_links(tasks) if task_numbers: new_body = transport.ASANA_SECTION_RE.sub('', issue_bod...
[ "Applies", "task", "numbers", "to", "an", "issue", "." ]
Loudr/asana-hub
python
https://github.com/Loudr/asana-hub/blob/af996ce890ed23d8ede5bf68dcd318e3438829cb/asana_hub/actions/sync.py#L54-L65
[ "def", "apply_tasks_to_issue", "(", "self", ",", "issue", ",", "tasks", ",", "issue_body", "=", "None", ")", ":", "issue_body", "=", "issue_body", "or", "issue", ".", "body", "task_numbers", "=", "transport", ".", "format_task_numbers_with_links", "(", "tasks", ...
af996ce890ed23d8ede5bf68dcd318e3438829cb
test
Sync.sync_labels
Creates a local map of github labels/milestones to asana tags.
asana_hub/actions/sync.py
def sync_labels(self, repo): """Creates a local map of github labels/milestones to asana tags.""" logging.info("syncing new github.com labels to tags") # create label tag map ltm = self.app.data.get("label-tag-map", {}) # loop over labels, if they don't have tags, make them ...
def sync_labels(self, repo): """Creates a local map of github labels/milestones to asana tags.""" logging.info("syncing new github.com labels to tags") # create label tag map ltm = self.app.data.get("label-tag-map", {}) # loop over labels, if they don't have tags, make them ...
[ "Creates", "a", "local", "map", "of", "github", "labels", "/", "milestones", "to", "asana", "tags", "." ]
Loudr/asana-hub
python
https://github.com/Loudr/asana-hub/blob/af996ce890ed23d8ede5bf68dcd318e3438829cb/asana_hub/actions/sync.py#L67-L102
[ "def", "sync_labels", "(", "self", ",", "repo", ")", ":", "logging", ".", "info", "(", "\"syncing new github.com labels to tags\"", ")", "# create label tag map", "ltm", "=", "self", ".", "app", ".", "data", ".", "get", "(", "\"label-tag-map\"", ",", "{", "}",...
af996ce890ed23d8ede5bf68dcd318e3438829cb
test
FormatterMixin.statistics
Return output for the combined time and result summary statistics.
ivoire/result.py
def statistics(self, elapsed, result): """ Return output for the combined time and result summary statistics. """ return "\n".join((self.timing(elapsed), self.result_summary(result)))
def statistics(self, elapsed, result): """ Return output for the combined time and result summary statistics. """ return "\n".join((self.timing(elapsed), self.result_summary(result)))
[ "Return", "output", "for", "the", "combined", "time", "and", "result", "summary", "statistics", "." ]
Julian/Ivoire
python
https://github.com/Julian/Ivoire/blob/5b8218cffa409ed733cf850a6fde16fafb8fc2af/ivoire/result.py#L77-L83
[ "def", "statistics", "(", "self", ",", "elapsed", ",", "result", ")", ":", "return", "\"\\n\"", ".", "join", "(", "(", "self", ".", "timing", "(", "elapsed", ")", ",", "self", ".", "result_summary", "(", "result", ")", ")", ")" ]
5b8218cffa409ed733cf850a6fde16fafb8fc2af
test
Colored.color
Color some text in the given ANSI color.
ivoire/result.py
def color(self, color, text): """ Color some text in the given ANSI color. """ return "{escape}{text}{reset}".format( escape=self.ANSI[color], text=text, reset=self.ANSI["reset"], )
def color(self, color, text): """ Color some text in the given ANSI color. """ return "{escape}{text}{reset}".format( escape=self.ANSI[color], text=text, reset=self.ANSI["reset"], )
[ "Color", "some", "text", "in", "the", "given", "ANSI", "color", "." ]
Julian/Ivoire
python
https://github.com/Julian/Ivoire/blob/5b8218cffa409ed733cf850a6fde16fafb8fc2af/ivoire/result.py#L129-L137
[ "def", "color", "(", "self", ",", "color", ",", "text", ")", ":", "return", "\"{escape}{text}{reset}\"", ".", "format", "(", "escape", "=", "self", ".", "ANSI", "[", "color", "]", ",", "text", "=", "text", ",", "reset", "=", "self", ".", "ANSI", "[",...
5b8218cffa409ed733cf850a6fde16fafb8fc2af
test
DotsFormatter.show
Write the text to the stream and flush immediately.
ivoire/result.py
def show(self, text): """ Write the text to the stream and flush immediately. """ self.stream.write(text) self.stream.flush()
def show(self, text): """ Write the text to the stream and flush immediately. """ self.stream.write(text) self.stream.flush()
[ "Write", "the", "text", "to", "the", "stream", "and", "flush", "immediately", "." ]
Julian/Ivoire
python
https://github.com/Julian/Ivoire/blob/5b8218cffa409ed733cf850a6fde16fafb8fc2af/ivoire/result.py#L165-L172
[ "def", "show", "(", "self", ",", "text", ")", ":", "self", ".", "stream", ".", "write", "(", "text", ")", "self", ".", "stream", ".", "flush", "(", ")" ]
5b8218cffa409ed733cf850a6fde16fafb8fc2af
test
DotsFormatter.result_summary
Return a summary of the results.
ivoire/result.py
def result_summary(self, result): """ Return a summary of the results. """ return "{} examples, {} errors, {} failures\n".format( result.testsRun, len(result.errors), len(result.failures), )
def result_summary(self, result): """ Return a summary of the results. """ return "{} examples, {} errors, {} failures\n".format( result.testsRun, len(result.errors), len(result.failures), )
[ "Return", "a", "summary", "of", "the", "results", "." ]
Julian/Ivoire
python
https://github.com/Julian/Ivoire/blob/5b8218cffa409ed733cf850a6fde16fafb8fc2af/ivoire/result.py#L206-L214
[ "def", "result_summary", "(", "self", ",", "result", ")", ":", "return", "\"{} examples, {} errors, {} failures\\n\"", ".", "format", "(", "result", ".", "testsRun", ",", "len", "(", "result", ".", "errors", ")", ",", "len", "(", "result", ".", "failures", "...
5b8218cffa409ed733cf850a6fde16fafb8fc2af
test
parse
Parse some arguments using the parser.
ivoire/run.py
def parse(argv=None): """ Parse some arguments using the parser. """ if argv is None: argv = sys.argv[1:] # Evade http://bugs.python.org/issue9253 if not argv or argv[0] not in {"run", "transform"}: argv = ["run"] + argv arguments = _clean(_parser.parse_args(argv)) re...
def parse(argv=None): """ Parse some arguments using the parser. """ if argv is None: argv = sys.argv[1:] # Evade http://bugs.python.org/issue9253 if not argv or argv[0] not in {"run", "transform"}: argv = ["run"] + argv arguments = _clean(_parser.parse_args(argv)) re...
[ "Parse", "some", "arguments", "using", "the", "parser", "." ]
Julian/Ivoire
python
https://github.com/Julian/Ivoire/blob/5b8218cffa409ed733cf850a6fde16fafb8fc2af/ivoire/run.py#L45-L59
[ "def", "parse", "(", "argv", "=", "None", ")", ":", "if", "argv", "is", "None", ":", "argv", "=", "sys", ".", "argv", "[", "1", ":", "]", "# Evade http://bugs.python.org/issue9253", "if", "not", "argv", "or", "argv", "[", "0", "]", "not", "in", "{", ...
5b8218cffa409ed733cf850a6fde16fafb8fc2af
test
setup
Setup the environment for an example run.
ivoire/run.py
def setup(config): """ Setup the environment for an example run. """ formatter = config.Formatter() if config.verbose: formatter = result.Verbose(formatter) if config.color: formatter = result.Colored(formatter) current_result = result.ExampleResult(formatter) ivoire...
def setup(config): """ Setup the environment for an example run. """ formatter = config.Formatter() if config.verbose: formatter = result.Verbose(formatter) if config.color: formatter = result.Colored(formatter) current_result = result.ExampleResult(formatter) ivoire...
[ "Setup", "the", "environment", "for", "an", "example", "run", "." ]
Julian/Ivoire
python
https://github.com/Julian/Ivoire/blob/5b8218cffa409ed733cf850a6fde16fafb8fc2af/ivoire/run.py#L68-L83
[ "def", "setup", "(", "config", ")", ":", "formatter", "=", "config", ".", "Formatter", "(", ")", "if", "config", ".", "verbose", ":", "formatter", "=", "result", ".", "Verbose", "(", "formatter", ")", "if", "config", ".", "color", ":", "formatter", "="...
5b8218cffa409ed733cf850a6fde16fafb8fc2af
test
run
Time to run.
ivoire/run.py
def run(config): """ Time to run. """ setup(config) if config.exitfirst: ivoire.current_result.failfast = True ivoire.current_result.startTestRun() for spec in config.specs: try: load_by_name(spec) except Exception: ivoire.current_result.a...
def run(config): """ Time to run. """ setup(config) if config.exitfirst: ivoire.current_result.failfast = True ivoire.current_result.startTestRun() for spec in config.specs: try: load_by_name(spec) except Exception: ivoire.current_result.a...
[ "Time", "to", "run", "." ]
Julian/Ivoire
python
https://github.com/Julian/Ivoire/blob/5b8218cffa409ed733cf850a6fde16fafb8fc2af/ivoire/run.py#L86-L109
[ "def", "run", "(", "config", ")", ":", "setup", "(", "config", ")", "if", "config", ".", "exitfirst", ":", "ivoire", ".", "current_result", ".", "failfast", "=", "True", "ivoire", ".", "current_result", ".", "startTestRun", "(", ")", "for", "spec", "in",...
5b8218cffa409ed733cf850a6fde16fafb8fc2af
test
transform
Run in transform mode.
ivoire/run.py
def transform(config): """ Run in transform mode. """ if transform_possible: ExampleLoader.register() args, sys.argv[1:] = sys.argv[1:], config.args try: return runpy.run_path(config.runner, run_name="__main__") finally: sys.argv[1:] = args
def transform(config): """ Run in transform mode. """ if transform_possible: ExampleLoader.register() args, sys.argv[1:] = sys.argv[1:], config.args try: return runpy.run_path(config.runner, run_name="__main__") finally: sys.argv[1:] = args
[ "Run", "in", "transform", "mode", "." ]
Julian/Ivoire
python
https://github.com/Julian/Ivoire/blob/5b8218cffa409ed733cf850a6fde16fafb8fc2af/ivoire/run.py#L112-L125
[ "def", "transform", "(", "config", ")", ":", "if", "transform_possible", ":", "ExampleLoader", ".", "register", "(", ")", "args", ",", "sys", ".", "argv", "[", "1", ":", "]", "=", "sys", ".", "argv", "[", "1", ":", "]", ",", "config", ".", "args", ...
5b8218cffa409ed733cf850a6fde16fafb8fc2af
test
ExampleTransformer.visit_With
with describe(thing) as it: ... | v class TestThing(TestCase): ...
ivoire/transform.py
def visit_With(self, node): """ with describe(thing) as it: ... | v class TestThing(TestCase): ... """ withitem, = node.items context = withitem.context_expr if context.func.id == "describe": descr...
def visit_With(self, node): """ with describe(thing) as it: ... | v class TestThing(TestCase): ... """ withitem, = node.items context = withitem.context_expr if context.func.id == "describe": descr...
[ "with", "describe", "(", "thing", ")", "as", "it", ":", "..." ]
Julian/Ivoire
python
https://github.com/Julian/Ivoire/blob/5b8218cffa409ed733cf850a6fde16fafb8fc2af/ivoire/transform.py#L32-L53
[ "def", "visit_With", "(", "self", ",", "node", ")", ":", "withitem", ",", "=", "node", ".", "items", "context", "=", "withitem", ".", "context_expr", "if", "context", ".", "func", ".", "id", "==", "\"describe\"", ":", "describes", "=", "context", ".", ...
5b8218cffa409ed733cf850a6fde16fafb8fc2af
test
ExampleTransformer.transform_describe
Transform a describe node into a ``TestCase``. ``node`` is the node object. ``describes`` is the name of the object being described. ``context_variable`` is the name bound in the context manager (usually "it").
ivoire/transform.py
def transform_describe(self, node, describes, context_variable): """ Transform a describe node into a ``TestCase``. ``node`` is the node object. ``describes`` is the name of the object being described. ``context_variable`` is the name bound in the context manager (usually ...
def transform_describe(self, node, describes, context_variable): """ Transform a describe node into a ``TestCase``. ``node`` is the node object. ``describes`` is the name of the object being described. ``context_variable`` is the name bound in the context manager (usually ...
[ "Transform", "a", "describe", "node", "into", "a", "TestCase", "." ]
Julian/Ivoire
python
https://github.com/Julian/Ivoire/blob/5b8218cffa409ed733cf850a6fde16fafb8fc2af/ivoire/transform.py#L55-L75
[ "def", "transform_describe", "(", "self", ",", "node", ",", "describes", ",", "context_variable", ")", ":", "body", "=", "self", ".", "transform_describe_body", "(", "node", ".", "body", ",", "context_variable", ")", "return", "ast", ".", "ClassDef", "(", "n...
5b8218cffa409ed733cf850a6fde16fafb8fc2af
test
ExampleTransformer.transform_describe_body
Transform the body of an ``ExampleGroup``. ``body`` is the body. ``group_var`` is the name bound to the example group in the context manager (usually "it").
ivoire/transform.py
def transform_describe_body(self, body, group_var): """ Transform the body of an ``ExampleGroup``. ``body`` is the body. ``group_var`` is the name bound to the example group in the context manager (usually "it"). """ for node in body: withitem, = no...
def transform_describe_body(self, body, group_var): """ Transform the body of an ``ExampleGroup``. ``body`` is the body. ``group_var`` is the name bound to the example group in the context manager (usually "it"). """ for node in body: withitem, = no...
[ "Transform", "the", "body", "of", "an", "ExampleGroup", "." ]
Julian/Ivoire
python
https://github.com/Julian/Ivoire/blob/5b8218cffa409ed733cf850a6fde16fafb8fc2af/ivoire/transform.py#L77-L94
[ "def", "transform_describe_body", "(", "self", ",", "body", ",", "group_var", ")", ":", "for", "node", "in", "body", ":", "withitem", ",", "=", "node", ".", "items", "context_expr", "=", "withitem", ".", "context_expr", "name", "=", "context_expr", ".", "a...
5b8218cffa409ed733cf850a6fde16fafb8fc2af
test
ExampleTransformer.transform_example
Transform an example node into a test method. Returns the unchanged node if it wasn't an ``Example``. ``node`` is the node object. ``name`` is the name of the example being described. ``context_variable`` is the name bound in the context manager (usually "test"). ``grou...
ivoire/transform.py
def transform_example(self, node, name, context_variable, group_variable): """ Transform an example node into a test method. Returns the unchanged node if it wasn't an ``Example``. ``node`` is the node object. ``name`` is the name of the example being described. ``conte...
def transform_example(self, node, name, context_variable, group_variable): """ Transform an example node into a test method. Returns the unchanged node if it wasn't an ``Example``. ``node`` is the node object. ``name`` is the name of the example being described. ``conte...
[ "Transform", "an", "example", "node", "into", "a", "test", "method", "." ]
Julian/Ivoire
python
https://github.com/Julian/Ivoire/blob/5b8218cffa409ed733cf850a6fde16fafb8fc2af/ivoire/transform.py#L96-L119
[ "def", "transform_example", "(", "self", ",", "node", ",", "name", ",", "context_variable", ",", "group_variable", ")", ":", "test_name", "=", "\"_\"", ".", "join", "(", "[", "\"test\"", ",", "group_variable", "]", "+", "name", ".", "split", "(", ")", ")...
5b8218cffa409ed733cf850a6fde16fafb8fc2af
test
ExampleTransformer.transform_example_body
Transform the body of an ``Example`` into the body of a method. Replaces instances of ``context_variable`` to refer to ``self``. ``body`` is the body. ``context_variable`` is the name bound in the surrounding context manager to the example (usually "test").
ivoire/transform.py
def transform_example_body(self, body, context_variable): """ Transform the body of an ``Example`` into the body of a method. Replaces instances of ``context_variable`` to refer to ``self``. ``body`` is the body. ``context_variable`` is the name bound in the surrounding context...
def transform_example_body(self, body, context_variable): """ Transform the body of an ``Example`` into the body of a method. Replaces instances of ``context_variable`` to refer to ``self``. ``body`` is the body. ``context_variable`` is the name bound in the surrounding context...
[ "Transform", "the", "body", "of", "an", "Example", "into", "the", "body", "of", "a", "method", "." ]
Julian/Ivoire
python
https://github.com/Julian/Ivoire/blob/5b8218cffa409ed733cf850a6fde16fafb8fc2af/ivoire/transform.py#L121-L138
[ "def", "transform_example_body", "(", "self", ",", "body", ",", "context_variable", ")", ":", "for", "node", "in", "body", ":", "for", "child", "in", "ast", ".", "walk", "(", "node", ")", ":", "if", "isinstance", "(", "child", ",", "ast", ".", "Name", ...
5b8218cffa409ed733cf850a6fde16fafb8fc2af
test
ExampleTransformer.takes_only_self
Return an argument list node that takes only ``self``.
ivoire/transform.py
def takes_only_self(self): """ Return an argument list node that takes only ``self``. """ return ast.arguments( args=[ast.arg(arg="self")], defaults=[], kw_defaults=[], kwonlyargs=[], )
def takes_only_self(self): """ Return an argument list node that takes only ``self``. """ return ast.arguments( args=[ast.arg(arg="self")], defaults=[], kw_defaults=[], kwonlyargs=[], )
[ "Return", "an", "argument", "list", "node", "that", "takes", "only", "self", "." ]
Julian/Ivoire
python
https://github.com/Julian/Ivoire/blob/5b8218cffa409ed733cf850a6fde16fafb8fc2af/ivoire/transform.py#L141-L152
[ "def", "takes_only_self", "(", "self", ")", ":", "return", "ast", ".", "arguments", "(", "args", "=", "[", "ast", ".", "arg", "(", "arg", "=", "\"self\"", ")", "]", ",", "defaults", "=", "[", "]", ",", "kw_defaults", "=", "[", "]", ",", "kwonlyargs...
5b8218cffa409ed733cf850a6fde16fafb8fc2af
test
ExampleLoader.register
Register the path hook.
ivoire/transform.py
def register(cls): """ Register the path hook. """ cls._finder = FileFinder.path_hook((cls, [cls.suffix])) sys.path_hooks.append(cls._finder)
def register(cls): """ Register the path hook. """ cls._finder = FileFinder.path_hook((cls, [cls.suffix])) sys.path_hooks.append(cls._finder)
[ "Register", "the", "path", "hook", "." ]
Julian/Ivoire
python
https://github.com/Julian/Ivoire/blob/5b8218cffa409ed733cf850a6fde16fafb8fc2af/ivoire/transform.py#L160-L167
[ "def", "register", "(", "cls", ")", ":", "cls", ".", "_finder", "=", "FileFinder", ".", "path_hook", "(", "(", "cls", ",", "[", "cls", ".", "suffix", "]", ")", ")", "sys", ".", "path_hooks", ".", "append", "(", "cls", ".", "_finder", ")" ]
5b8218cffa409ed733cf850a6fde16fafb8fc2af
test
ExampleLoader.source_to_code
Transform the source code, then return the code object.
ivoire/transform.py
def source_to_code(self, source_bytes, source_path): """ Transform the source code, then return the code object. """ node = ast.parse(source_bytes) transformed = ExampleTransformer().transform(node) return compile(transformed, source_path, "exec", dont_inherit=True)
def source_to_code(self, source_bytes, source_path): """ Transform the source code, then return the code object. """ node = ast.parse(source_bytes) transformed = ExampleTransformer().transform(node) return compile(transformed, source_path, "exec", dont_inherit=True)
[ "Transform", "the", "source", "code", "then", "return", "the", "code", "object", "." ]
Julian/Ivoire
python
https://github.com/Julian/Ivoire/blob/5b8218cffa409ed733cf850a6fde16fafb8fc2af/ivoire/transform.py#L178-L186
[ "def", "source_to_code", "(", "self", ",", "source_bytes", ",", "source_path", ")", ":", "node", "=", "ast", ".", "parse", "(", "source_bytes", ")", "transformed", "=", "ExampleTransformer", "(", ")", ".", "transform", "(", "node", ")", "return", "compile", ...
5b8218cffa409ed733cf850a6fde16fafb8fc2af
test
apply_argument_parser
Apply the argument parser.
pycoeman/utils_execution.py
def apply_argument_parser(argumentsParser, options=None): """ Apply the argument parser. """ if options is not None: args = argumentsParser.parse_args(options) else: args = argumentsParser.parse_args() return args
def apply_argument_parser(argumentsParser, options=None): """ Apply the argument parser. """ if options is not None: args = argumentsParser.parse_args(options) else: args = argumentsParser.parse_args() return args
[ "Apply", "the", "argument", "parser", "." ]
NLeSC/pycoeman
python
https://github.com/NLeSC/pycoeman/blob/246d517b55cb98eb46f69aae453492cf9dd9d5af/pycoeman/utils_execution.py#L51-L57
[ "def", "apply_argument_parser", "(", "argumentsParser", ",", "options", "=", "None", ")", ":", "if", "options", "is", "not", "None", ":", "args", "=", "argumentsParser", ".", "parse_args", "(", "options", ")", "else", ":", "args", "=", "argumentsParser", "."...
246d517b55cb98eb46f69aae453492cf9dd9d5af
test
load_by_name
Load a spec from either a file path or a fully qualified name.
ivoire/load.py
def load_by_name(name): """ Load a spec from either a file path or a fully qualified name. """ if os.path.exists(name): load_from_path(name) else: __import__(name)
def load_by_name(name): """ Load a spec from either a file path or a fully qualified name. """ if os.path.exists(name): load_from_path(name) else: __import__(name)
[ "Load", "a", "spec", "from", "either", "a", "file", "path", "or", "a", "fully", "qualified", "name", "." ]
Julian/Ivoire
python
https://github.com/Julian/Ivoire/blob/5b8218cffa409ed733cf850a6fde16fafb8fc2af/ivoire/load.py#L6-L15
[ "def", "load_by_name", "(", "name", ")", ":", "if", "os", ".", "path", ".", "exists", "(", "name", ")", ":", "load_from_path", "(", "name", ")", "else", ":", "__import__", "(", "name", ")" ]
5b8218cffa409ed733cf850a6fde16fafb8fc2af
test
load_from_path
Load a spec from a given path, discovering specs if a directory is given.
ivoire/load.py
def load_from_path(path): """ Load a spec from a given path, discovering specs if a directory is given. """ if os.path.isdir(path): paths = discover(path) else: paths = [path] for path in paths: name = os.path.basename(os.path.splitext(path)[0]) imp.load_source...
def load_from_path(path): """ Load a spec from a given path, discovering specs if a directory is given. """ if os.path.isdir(path): paths = discover(path) else: paths = [path] for path in paths: name = os.path.basename(os.path.splitext(path)[0]) imp.load_source...
[ "Load", "a", "spec", "from", "a", "given", "path", "discovering", "specs", "if", "a", "directory", "is", "given", "." ]
Julian/Ivoire
python
https://github.com/Julian/Ivoire/blob/5b8218cffa409ed733cf850a6fde16fafb8fc2af/ivoire/load.py#L18-L31
[ "def", "load_from_path", "(", "path", ")", ":", "if", "os", ".", "path", ".", "isdir", "(", "path", ")", ":", "paths", "=", "discover", "(", "path", ")", "else", ":", "paths", "=", "[", "path", "]", "for", "path", "in", "paths", ":", "name", "=",...
5b8218cffa409ed733cf850a6fde16fafb8fc2af
test
discover
Discover all of the specs recursively inside ``path``. Successively yields the (full) relative paths to each spec.
ivoire/load.py
def discover(path, filter_specs=filter_specs): """ Discover all of the specs recursively inside ``path``. Successively yields the (full) relative paths to each spec. """ for dirpath, _, filenames in os.walk(path): for spec in filter_specs(filenames): yield os.path.join(dirpath...
def discover(path, filter_specs=filter_specs): """ Discover all of the specs recursively inside ``path``. Successively yields the (full) relative paths to each spec. """ for dirpath, _, filenames in os.walk(path): for spec in filter_specs(filenames): yield os.path.join(dirpath...
[ "Discover", "all", "of", "the", "specs", "recursively", "inside", "path", "." ]
Julian/Ivoire
python
https://github.com/Julian/Ivoire/blob/5b8218cffa409ed733cf850a6fde16fafb8fc2af/ivoire/load.py#L43-L53
[ "def", "discover", "(", "path", ",", "filter_specs", "=", "filter_specs", ")", ":", "for", "dirpath", ",", "_", ",", "filenames", "in", "os", ".", "walk", "(", "path", ")", ":", "for", "spec", "in", "filter_specs", "(", "filenames", ")", ":", "yield", ...
5b8218cffa409ed733cf850a6fde16fafb8fc2af
test
checker
Construct a function that checks a directory for process configuration The function checks for additions or removals of JSON process configuration files and calls the appropriate receiver methods. :param location: string, the directory to monitor :param receiver: IEventReceiver :returns: a fun...
ncolony/directory_monitor.py
def checker(location, receiver): """Construct a function that checks a directory for process configuration The function checks for additions or removals of JSON process configuration files and calls the appropriate receiver methods. :param location: string, the directory to monitor :param rece...
def checker(location, receiver): """Construct a function that checks a directory for process configuration The function checks for additions or removals of JSON process configuration files and calls the appropriate receiver methods. :param location: string, the directory to monitor :param rece...
[ "Construct", "a", "function", "that", "checks", "a", "directory", "for", "process", "configuration" ]
ncolony/ncolony
python
https://github.com/ncolony/ncolony/blob/6ac71bda1de6706fb34244ae4972e36db5f062d3/ncolony/directory_monitor.py#L15-L52
[ "def", "checker", "(", "location", ",", "receiver", ")", ":", "path", "=", "filepath", ".", "FilePath", "(", "location", ")", "files", "=", "set", "(", ")", "filesContents", "=", "{", "}", "def", "_check", "(", "path", ")", ":", "currentFiles", "=", ...
6ac71bda1de6706fb34244ae4972e36db5f062d3
test
messages
Construct a function that checks a directory for messages The function checks for new messages and calls the appropriate method on the receiver. Sent messages are deleted. :param location: string, the directory to monitor :param receiver: IEventReceiver :returns: a function with no parameters
ncolony/directory_monitor.py
def messages(location, receiver): """Construct a function that checks a directory for messages The function checks for new messages and calls the appropriate method on the receiver. Sent messages are deleted. :param location: string, the directory to monitor :param receiver: IEventReceiver ...
def messages(location, receiver): """Construct a function that checks a directory for messages The function checks for new messages and calls the appropriate method on the receiver. Sent messages are deleted. :param location: string, the directory to monitor :param receiver: IEventReceiver ...
[ "Construct", "a", "function", "that", "checks", "a", "directory", "for", "messages" ]
ncolony/ncolony
python
https://github.com/ncolony/ncolony/blob/6ac71bda1de6706fb34244ae4972e36db5f062d3/ncolony/directory_monitor.py#L55-L75
[ "def", "messages", "(", "location", ",", "receiver", ")", ":", "path", "=", "filepath", ".", "FilePath", "(", "location", ")", "def", "_check", "(", "path", ")", ":", "messageFiles", "=", "path", ".", "globChildren", "(", "'*'", ")", "for", "message", ...
6ac71bda1de6706fb34244ae4972e36db5f062d3
test
add
Add a process. :param places: a Places instance :param name: string, the logical name of the process :param cmd: string, executable :param args: list of strings, command-line arguments :param env: dictionary mapping strings to strings (will be environment in subprocess) :param uid: int...
ncolony/ctllib.py
def add(places, name, cmd, args, env=None, uid=None, gid=None, extras=None, env_inherit=None): """Add a process. :param places: a Places instance :param name: string, the logical name of the process :param cmd: string, executable :param args: list of strings, command-line arguments :par...
def add(places, name, cmd, args, env=None, uid=None, gid=None, extras=None, env_inherit=None): """Add a process. :param places: a Places instance :param name: string, the logical name of the process :param cmd: string, executable :param args: list of strings, command-line arguments :par...
[ "Add", "a", "process", "." ]
ncolony/ncolony
python
https://github.com/ncolony/ncolony/blob/6ac71bda1de6706fb34244ae4972e36db5f062d3/ncolony/ctllib.py#L56-L91
[ "def", "add", "(", "places", ",", "name", ",", "cmd", ",", "args", ",", "env", "=", "None", ",", "uid", "=", "None", ",", "gid", "=", "None", ",", "extras", "=", "None", ",", "env_inherit", "=", "None", ")", ":", "args", "=", "[", "cmd", "]", ...
6ac71bda1de6706fb34244ae4972e36db5f062d3
test
remove
Remove a process :params places: a Places instance :params name: string, the logical name of the process :returns: None
ncolony/ctllib.py
def remove(places, name): """Remove a process :params places: a Places instance :params name: string, the logical name of the process :returns: None """ config = filepath.FilePath(places.config) fle = config.child(name) fle.remove()
def remove(places, name): """Remove a process :params places: a Places instance :params name: string, the logical name of the process :returns: None """ config = filepath.FilePath(places.config) fle = config.child(name) fle.remove()
[ "Remove", "a", "process" ]
ncolony/ncolony
python
https://github.com/ncolony/ncolony/blob/6ac71bda1de6706fb34244ae4972e36db5f062d3/ncolony/ctllib.py#L95-L104
[ "def", "remove", "(", "places", ",", "name", ")", ":", "config", "=", "filepath", ".", "FilePath", "(", "places", ".", "config", ")", "fle", "=", "config", ".", "child", "(", "name", ")", "fle", ".", "remove", "(", ")" ]
6ac71bda1de6706fb34244ae4972e36db5f062d3
test
restart
Restart a process :params places: a Places instance :params name: string, the logical name of the process :returns: None
ncolony/ctllib.py
def restart(places, name): """Restart a process :params places: a Places instance :params name: string, the logical name of the process :returns: None """ content = _dumps(dict(type='RESTART', name=name)) _addMessage(places, content)
def restart(places, name): """Restart a process :params places: a Places instance :params name: string, the logical name of the process :returns: None """ content = _dumps(dict(type='RESTART', name=name)) _addMessage(places, content)
[ "Restart", "a", "process" ]
ncolony/ncolony
python
https://github.com/ncolony/ncolony/blob/6ac71bda1de6706fb34244ae4972e36db5f062d3/ncolony/ctllib.py#L114-L122
[ "def", "restart", "(", "places", ",", "name", ")", ":", "content", "=", "_dumps", "(", "dict", "(", "type", "=", "'RESTART'", ",", "name", "=", "name", ")", ")", "_addMessage", "(", "places", ",", "content", ")" ]
6ac71bda1de6706fb34244ae4972e36db5f062d3
test
call
Call results.func on the attributes of results :params result: dictionary-like object :returns: None
ncolony/ctllib.py
def call(results): """Call results.func on the attributes of results :params result: dictionary-like object :returns: None """ results = vars(results) places = Places(config=results.pop('config'), messages=results.pop('messages')) func = results.pop('func') func(plac...
def call(results): """Call results.func on the attributes of results :params result: dictionary-like object :returns: None """ results = vars(results) places = Places(config=results.pop('config'), messages=results.pop('messages')) func = results.pop('func') func(plac...
[ "Call", "results", ".", "func", "on", "the", "attributes", "of", "results" ]
ncolony/ncolony
python
https://github.com/ncolony/ncolony/blob/6ac71bda1de6706fb34244ae4972e36db5f062d3/ncolony/ctllib.py#L165-L175
[ "def", "call", "(", "results", ")", ":", "results", "=", "vars", "(", "results", ")", "places", "=", "Places", "(", "config", "=", "results", ".", "pop", "(", "'config'", ")", ",", "messages", "=", "results", ".", "pop", "(", "'messages'", ")", ")", ...
6ac71bda1de6706fb34244ae4972e36db5f062d3
test
get
Return a service which monitors processes based on directory contents Construct and return a service that, when started, will run processes based on the contents of the 'config' directory, restarting them if file contents change and stopping them if the file is removed. It also listens for restart and...
ncolony/service.py
def get(config, messages, freq, pidDir=None, reactor=None): """Return a service which monitors processes based on directory contents Construct and return a service that, when started, will run processes based on the contents of the 'config' directory, restarting them if file contents change and stoppin...
def get(config, messages, freq, pidDir=None, reactor=None): """Return a service which monitors processes based on directory contents Construct and return a service that, when started, will run processes based on the contents of the 'config' directory, restarting them if file contents change and stoppin...
[ "Return", "a", "service", "which", "monitors", "processes", "based", "on", "directory", "contents" ]
ncolony/ncolony
python
https://github.com/ncolony/ncolony/blob/6ac71bda1de6706fb34244ae4972e36db5f062d3/ncolony/service.py#L54-L92
[ "def", "get", "(", "config", ",", "messages", ",", "freq", ",", "pidDir", "=", "None", ",", "reactor", "=", "None", ")", ":", "ret", "=", "taservice", ".", "MultiService", "(", ")", "args", "=", "(", ")", "if", "reactor", "is", "not", "None", ":", ...
6ac71bda1de6706fb34244ae4972e36db5f062d3
test
makeService
Return a service based on parsed command-line options :param opt: dict-like object. Relevant keys are config, messages, pid, frequency, threshold, killtime, minrestartdelay and maxrestartdelay :returns: service, {twisted.application.interfaces.IService}
ncolony/service.py
def makeService(opt): """Return a service based on parsed command-line options :param opt: dict-like object. Relevant keys are config, messages, pid, frequency, threshold, killtime, minrestartdelay and maxrestartdelay :returns: service, {twisted.application.interfaces.IServi...
def makeService(opt): """Return a service based on parsed command-line options :param opt: dict-like object. Relevant keys are config, messages, pid, frequency, threshold, killtime, minrestartdelay and maxrestartdelay :returns: service, {twisted.application.interfaces.IServi...
[ "Return", "a", "service", "based", "on", "parsed", "command", "-", "line", "options" ]
ncolony/ncolony
python
https://github.com/ncolony/ncolony/blob/6ac71bda1de6706fb34244ae4972e36db5f062d3/ncolony/service.py#L117-L132
[ "def", "makeService", "(", "opt", ")", ":", "ret", "=", "get", "(", "config", "=", "opt", "[", "'config'", "]", ",", "messages", "=", "opt", "[", "'messages'", "]", ",", "pidDir", "=", "opt", "[", "'pid'", "]", ",", "freq", "=", "opt", "[", "'fre...
6ac71bda1de6706fb34244ae4972e36db5f062d3
test
Nodelist.refresh_session
Adds or refreshes a particular node in the nodelist, attributing the current time with the node_id. :param string node_id: optional, the connection id of the node whose session should be refreshed
phonon/nodelist.py
def refresh_session(self, node_id=None): """ Adds or refreshes a particular node in the nodelist, attributing the current time with the node_id. :param string node_id: optional, the connection id of the node whose session should be refreshed """ if not node_id: ...
def refresh_session(self, node_id=None): """ Adds or refreshes a particular node in the nodelist, attributing the current time with the node_id. :param string node_id: optional, the connection id of the node whose session should be refreshed """ if not node_id: ...
[ "Adds", "or", "refreshes", "a", "particular", "node", "in", "the", "nodelist", "attributing", "the", "current", "time", "with", "the", "node_id", "." ]
buzzfeed/phonon
python
https://github.com/buzzfeed/phonon/blob/32fd036d64fab19c554e841f162466f6eb28b50f/phonon/nodelist.py#L27-L38
[ "def", "refresh_session", "(", "self", ",", "node_id", "=", "None", ")", ":", "if", "not", "node_id", ":", "node_id", "=", "self", ".", "conn", ".", "id", "self", ".", "conn", ".", "client", ".", "hset", "(", "self", ".", "nodelist_key", ",", "node_i...
32fd036d64fab19c554e841f162466f6eb28b50f
test
Nodelist.find_expired_nodes
Detects connections that have held a reference for longer than its process_ttl without refreshing its session. This function does not actually removed them from the hash. (See remove_expired_nodes.) :param list node_ids: optional, a list of ids to check to see if they have expired. ...
phonon/nodelist.py
def find_expired_nodes(self, node_ids=None): """ Detects connections that have held a reference for longer than its process_ttl without refreshing its session. This function does not actually removed them from the hash. (See remove_expired_nodes.) :param list node_ids: optional,...
def find_expired_nodes(self, node_ids=None): """ Detects connections that have held a reference for longer than its process_ttl without refreshing its session. This function does not actually removed them from the hash. (See remove_expired_nodes.) :param list node_ids: optional,...
[ "Detects", "connections", "that", "have", "held", "a", "reference", "for", "longer", "than", "its", "process_ttl", "without", "refreshing", "its", "session", ".", "This", "function", "does", "not", "actually", "removed", "them", "from", "the", "hash", ".", "("...
buzzfeed/phonon
python
https://github.com/buzzfeed/phonon/blob/32fd036d64fab19c554e841f162466f6eb28b50f/phonon/nodelist.py#L40-L57
[ "def", "find_expired_nodes", "(", "self", ",", "node_ids", "=", "None", ")", ":", "if", "node_ids", ":", "nodes", "=", "zip", "(", "node_ids", ",", "[", "int", "(", "t", ")", "for", "t", "in", "self", ".", "conn", ".", "client", ".", "hmget", "(", ...
32fd036d64fab19c554e841f162466f6eb28b50f
test
Nodelist.remove_expired_nodes
Removes all expired nodes from the nodelist. If a set of node_ids is passed in, those ids are checked to ensure they haven't been refreshed prior to a lock being acquired. Should only be run with a lock. :param list node_ids: optional, a list of node_ids to remove. They w...
phonon/nodelist.py
def remove_expired_nodes(self, node_ids=None): """ Removes all expired nodes from the nodelist. If a set of node_ids is passed in, those ids are checked to ensure they haven't been refreshed prior to a lock being acquired. Should only be run with a lock. :param list no...
def remove_expired_nodes(self, node_ids=None): """ Removes all expired nodes from the nodelist. If a set of node_ids is passed in, those ids are checked to ensure they haven't been refreshed prior to a lock being acquired. Should only be run with a lock. :param list no...
[ "Removes", "all", "expired", "nodes", "from", "the", "nodelist", ".", "If", "a", "set", "of", "node_ids", "is", "passed", "in", "those", "ids", "are", "checked", "to", "ensure", "they", "haven", "t", "been", "refreshed", "prior", "to", "a", "lock", "bein...
buzzfeed/phonon
python
https://github.com/buzzfeed/phonon/blob/32fd036d64fab19c554e841f162466f6eb28b50f/phonon/nodelist.py#L59-L73
[ "def", "remove_expired_nodes", "(", "self", ",", "node_ids", "=", "None", ")", ":", "nodes", "=", "self", ".", "find_expired_nodes", "(", "node_ids", ")", "if", "nodes", ":", "self", ".", "conn", ".", "client", ".", "hdel", "(", "self", ".", "nodelist_ke...
32fd036d64fab19c554e841f162466f6eb28b50f
test
Nodelist.remove_node
Removes a particular node from the nodelist. :param string node_id: optional, the process id of the node to remove
phonon/nodelist.py
def remove_node(self, node_id=None): """ Removes a particular node from the nodelist. :param string node_id: optional, the process id of the node to remove """ if not node_id: node_id = self.conn.id self.conn.client.hdel(self.nodelist_key, node_id)
def remove_node(self, node_id=None): """ Removes a particular node from the nodelist. :param string node_id: optional, the process id of the node to remove """ if not node_id: node_id = self.conn.id self.conn.client.hdel(self.nodelist_key, node_id)
[ "Removes", "a", "particular", "node", "from", "the", "nodelist", "." ]
buzzfeed/phonon
python
https://github.com/buzzfeed/phonon/blob/32fd036d64fab19c554e841f162466f6eb28b50f/phonon/nodelist.py#L75-L84
[ "def", "remove_node", "(", "self", ",", "node_id", "=", "None", ")", ":", "if", "not", "node_id", ":", "node_id", "=", "self", ".", "conn", ".", "id", "self", ".", "conn", ".", "client", ".", "hdel", "(", "self", ".", "nodelist_key", ",", "node_id", ...
32fd036d64fab19c554e841f162466f6eb28b50f
test
Nodelist.get_last_updated
Returns the time a particular node has been last refreshed. :param string node_id: optional, the connection id of the node to retrieve :rtype: int :returns: Returns a unix timestamp if it exists, otherwise None
phonon/nodelist.py
def get_last_updated(self, node_id=None): """ Returns the time a particular node has been last refreshed. :param string node_id: optional, the connection id of the node to retrieve :rtype: int :returns: Returns a unix timestamp if it exists, otherwise None """ i...
def get_last_updated(self, node_id=None): """ Returns the time a particular node has been last refreshed. :param string node_id: optional, the connection id of the node to retrieve :rtype: int :returns: Returns a unix timestamp if it exists, otherwise None """ i...
[ "Returns", "the", "time", "a", "particular", "node", "has", "been", "last", "refreshed", "." ]
buzzfeed/phonon
python
https://github.com/buzzfeed/phonon/blob/32fd036d64fab19c554e841f162466f6eb28b50f/phonon/nodelist.py#L94-L107
[ "def", "get_last_updated", "(", "self", ",", "node_id", "=", "None", ")", ":", "if", "not", "node_id", ":", "node_id", "=", "self", ".", "conn", ".", "id", "dt", "=", "self", ".", "conn", ".", "client", ".", "hget", "(", "self", ".", "nodelist_key", ...
32fd036d64fab19c554e841f162466f6eb28b50f
test
Nodelist.get_all_nodes
Returns all nodes in the hash with the time they were last refreshed as a dictionary. :rtype: dict(string, int) :returns: A dictionary of strings and corresponding timestamps
phonon/nodelist.py
def get_all_nodes(self): """ Returns all nodes in the hash with the time they were last refreshed as a dictionary. :rtype: dict(string, int) :returns: A dictionary of strings and corresponding timestamps """ nodes = self.conn.client.hgetall(self.nodelist_key) ...
def get_all_nodes(self): """ Returns all nodes in the hash with the time they were last refreshed as a dictionary. :rtype: dict(string, int) :returns: A dictionary of strings and corresponding timestamps """ nodes = self.conn.client.hgetall(self.nodelist_key) ...
[ "Returns", "all", "nodes", "in", "the", "hash", "with", "the", "time", "they", "were", "last", "refreshed", "as", "a", "dictionary", "." ]
buzzfeed/phonon
python
https://github.com/buzzfeed/phonon/blob/32fd036d64fab19c554e841f162466f6eb28b50f/phonon/nodelist.py#L109-L119
[ "def", "get_all_nodes", "(", "self", ")", ":", "nodes", "=", "self", ".", "conn", ".", "client", ".", "hgetall", "(", "self", ".", "nodelist_key", ")", "return", "{", "node_id", ":", "int", "(", "dt", ")", "for", "(", "node_id", ",", "dt", ")", "in...
32fd036d64fab19c554e841f162466f6eb28b50f
test
Reference.refresh_session
Update the session for this node. Specifically; lock on the reflist, then update the time this node acquired the reference. This method should only be called while the reference is locked.
phonon/reference.py
def refresh_session(self): """ Update the session for this node. Specifically; lock on the reflist, then update the time this node acquired the reference. This method should only be called while the reference is locked. """ expired_nodes = self.nodelist.find_expired_nod...
def refresh_session(self): """ Update the session for this node. Specifically; lock on the reflist, then update the time this node acquired the reference. This method should only be called while the reference is locked. """ expired_nodes = self.nodelist.find_expired_nod...
[ "Update", "the", "session", "for", "this", "node", ".", "Specifically", ";", "lock", "on", "the", "reflist", "then", "update", "the", "time", "this", "node", "acquired", "the", "reference", "." ]
buzzfeed/phonon
python
https://github.com/buzzfeed/phonon/blob/32fd036d64fab19c554e841f162466f6eb28b50f/phonon/reference.py#L74-L84
[ "def", "refresh_session", "(", "self", ")", ":", "expired_nodes", "=", "self", ".", "nodelist", ".", "find_expired_nodes", "(", ")", "if", "expired_nodes", ":", "self", ".", "nodelist", ".", "remove_expired_nodes", "(", "expired_nodes", ")", "self", ".", "node...
32fd036d64fab19c554e841f162466f6eb28b50f
test
Reference.increment_times_modified
Increments the number of times this resource has been modified by all processes.
phonon/reference.py
def increment_times_modified(self): """ Increments the number of times this resource has been modified by all processes. """ rc = self.conn.client.incr(self.times_modified_key) self.conn.client.pexpire(self.times_modified_key, phonon.s_to_...
def increment_times_modified(self): """ Increments the number of times this resource has been modified by all processes. """ rc = self.conn.client.incr(self.times_modified_key) self.conn.client.pexpire(self.times_modified_key, phonon.s_to_...
[ "Increments", "the", "number", "of", "times", "this", "resource", "has", "been", "modified", "by", "all", "processes", "." ]
buzzfeed/phonon
python
https://github.com/buzzfeed/phonon/blob/32fd036d64fab19c554e841f162466f6eb28b50f/phonon/reference.py#L86-L93
[ "def", "increment_times_modified", "(", "self", ")", ":", "rc", "=", "self", ".", "conn", ".", "client", ".", "incr", "(", "self", ".", "times_modified_key", ")", "self", ".", "conn", ".", "client", ".", "pexpire", "(", "self", ".", "times_modified_key", ...
32fd036d64fab19c554e841f162466f6eb28b50f
test
Reference.get_times_modified
:returns: The total number of times increment_times_modified has been called for this resource by all processes. :rtype: int
phonon/reference.py
def get_times_modified(self): """ :returns: The total number of times increment_times_modified has been called for this resource by all processes. :rtype: int """ times_modified = self.conn.client.get(self.times_modified_key) if times_modified is None: return ...
def get_times_modified(self): """ :returns: The total number of times increment_times_modified has been called for this resource by all processes. :rtype: int """ times_modified = self.conn.client.get(self.times_modified_key) if times_modified is None: return ...
[ ":", "returns", ":", "The", "total", "number", "of", "times", "increment_times_modified", "has", "been", "called", "for", "this", "resource", "by", "all", "processes", ".", ":", "rtype", ":", "int" ]
buzzfeed/phonon
python
https://github.com/buzzfeed/phonon/blob/32fd036d64fab19c554e841f162466f6eb28b50f/phonon/reference.py#L95-L103
[ "def", "get_times_modified", "(", "self", ")", ":", "times_modified", "=", "self", ".", "conn", ".", "client", ".", "get", "(", "self", ".", "times_modified_key", ")", "if", "times_modified", "is", "None", ":", "return", "0", "return", "int", "(", "times_m...
32fd036d64fab19c554e841f162466f6eb28b50f
test
Reference.count
:returns: The total number of elements in the reference list. :rtype: int
phonon/reference.py
def count(self): """ :returns: The total number of elements in the reference list. :rtype: int """ references = self.conn.client.get(self.refcount_key) if references is None: return 0 return int(references)
def count(self): """ :returns: The total number of elements in the reference list. :rtype: int """ references = self.conn.client.get(self.refcount_key) if references is None: return 0 return int(references)
[ ":", "returns", ":", "The", "total", "number", "of", "elements", "in", "the", "reference", "list", ".", ":", "rtype", ":", "int" ]
buzzfeed/phonon
python
https://github.com/buzzfeed/phonon/blob/32fd036d64fab19c554e841f162466f6eb28b50f/phonon/reference.py#L105-L113
[ "def", "count", "(", "self", ")", ":", "references", "=", "self", ".", "conn", ".", "client", ".", "get", "(", "self", ".", "refcount_key", ")", "if", "references", "is", "None", ":", "return", "0", "return", "int", "(", "references", ")" ]
32fd036d64fab19c554e841f162466f6eb28b50f
test
Reference.dereference
This method should only be called while the reference is locked. Decrements the reference count for the resource. If this process holds the only reference at the time we finish dereferencing it; True is returned. Operating on the resource after it has been dereferenced is undefined beha...
phonon/reference.py
def dereference(self, callback=None, args=None, kwargs=None): """ This method should only be called while the reference is locked. Decrements the reference count for the resource. If this process holds the only reference at the time we finish dereferencing it; True is returned. ...
def dereference(self, callback=None, args=None, kwargs=None): """ This method should only be called while the reference is locked. Decrements the reference count for the resource. If this process holds the only reference at the time we finish dereferencing it; True is returned. ...
[ "This", "method", "should", "only", "be", "called", "while", "the", "reference", "is", "locked", "." ]
buzzfeed/phonon
python
https://github.com/buzzfeed/phonon/blob/32fd036d64fab19c554e841f162466f6eb28b50f/phonon/reference.py#L115-L170
[ "def", "dereference", "(", "self", ",", "callback", "=", "None", ",", "args", "=", "None", ",", "kwargs", "=", "None", ")", ":", "if", "args", "is", "None", ":", "args", "=", "tuple", "(", ")", "if", "kwargs", "is", "None", ":", "kwargs", "=", "{...
32fd036d64fab19c554e841f162466f6eb28b50f
test
delimit
Returns a list of tokens interleaved with the delimiter.
cypher/utils.py
def delimit(values, delimiter=', '): "Returns a list of tokens interleaved with the delimiter." toks = [] if not values: return toks if not isinstance(delimiter, (list, tuple)): delimiter = [delimiter] last = len(values) - 1 for i, value in enumerate(values): toks.app...
def delimit(values, delimiter=', '): "Returns a list of tokens interleaved with the delimiter." toks = [] if not values: return toks if not isinstance(delimiter, (list, tuple)): delimiter = [delimiter] last = len(values) - 1 for i, value in enumerate(values): toks.app...
[ "Returns", "a", "list", "of", "tokens", "interleaved", "with", "the", "delimiter", "." ]
bruth/cypher
python
https://github.com/bruth/cypher/blob/4f962f51539ac5a667ab5a050b6b4052d4c10c0f/cypher/utils.py#L4-L22
[ "def", "delimit", "(", "values", ",", "delimiter", "=", "', '", ")", ":", "toks", "=", "[", "]", "if", "not", "values", ":", "return", "toks", "if", "not", "isinstance", "(", "delimiter", ",", "(", "list", ",", "tuple", ")", ")", ":", "delimiter", ...
4f962f51539ac5a667ab5a050b6b4052d4c10c0f
test
check
check which processes need to be restarted :params path: a twisted.python.filepath.FilePath with configurations :params start: when the checker started running :params now: current time :returns: list of strings
ncolony/beatcheck.py
def check(path, start, now): """check which processes need to be restarted :params path: a twisted.python.filepath.FilePath with configurations :params start: when the checker started running :params now: current time :returns: list of strings """ return [child.basename() for child in path....
def check(path, start, now): """check which processes need to be restarted :params path: a twisted.python.filepath.FilePath with configurations :params start: when the checker started running :params now: current time :returns: list of strings """ return [child.basename() for child in path....
[ "check", "which", "processes", "need", "to", "be", "restarted" ]
ncolony/ncolony
python
https://github.com/ncolony/ncolony/blob/6ac71bda1de6706fb34244ae4972e36db5f062d3/ncolony/beatcheck.py#L33-L42
[ "def", "check", "(", "path", ",", "start", ",", "now", ")", ":", "return", "[", "child", ".", "basename", "(", ")", "for", "child", "in", "path", ".", "children", "(", ")", "if", "_isbad", "(", "child", ",", "start", ",", "now", ")", "]" ]
6ac71bda1de6706fb34244ae4972e36db5f062d3
test
parseConfig
Parse configuration :params opt: dict-like object with config and messages keys :returns: restarter, path
ncolony/beatcheck.py
def parseConfig(opt): """Parse configuration :params opt: dict-like object with config and messages keys :returns: restarter, path """ places = ctllib.Places(config=opt['config'], messages=opt['messages']) restarter = functools.partial(ctllib.restart, places) path = filepath.FilePath(opt['c...
def parseConfig(opt): """Parse configuration :params opt: dict-like object with config and messages keys :returns: restarter, path """ places = ctllib.Places(config=opt['config'], messages=opt['messages']) restarter = functools.partial(ctllib.restart, places) path = filepath.FilePath(opt['c...
[ "Parse", "configuration" ]
ncolony/ncolony
python
https://github.com/ncolony/ncolony/blob/6ac71bda1de6706fb34244ae4972e36db5f062d3/ncolony/beatcheck.py#L80-L89
[ "def", "parseConfig", "(", "opt", ")", ":", "places", "=", "ctllib", ".", "Places", "(", "config", "=", "opt", "[", "'config'", "]", ",", "messages", "=", "opt", "[", "'messages'", "]", ")", "restarter", "=", "functools", ".", "partial", "(", "ctllib",...
6ac71bda1de6706fb34244ae4972e36db5f062d3
test
makeService
Make a service :params opt: dictionary-like object with 'freq', 'config' and 'messages' :returns: twisted.application.internet.TimerService that at opt['freq'] checks for stale processes in opt['config'], and sends restart messages through opt['messages']
ncolony/beatcheck.py
def makeService(opt): """Make a service :params opt: dictionary-like object with 'freq', 'config' and 'messages' :returns: twisted.application.internet.TimerService that at opt['freq'] checks for stale processes in opt['config'], and sends restart messages through opt['messages'...
def makeService(opt): """Make a service :params opt: dictionary-like object with 'freq', 'config' and 'messages' :returns: twisted.application.internet.TimerService that at opt['freq'] checks for stale processes in opt['config'], and sends restart messages through opt['messages'...
[ "Make", "a", "service" ]
ncolony/ncolony
python
https://github.com/ncolony/ncolony/blob/6ac71bda1de6706fb34244ae4972e36db5f062d3/ncolony/beatcheck.py#L92-L106
[ "def", "makeService", "(", "opt", ")", ":", "restarter", ",", "path", "=", "parseConfig", "(", "opt", ")", "now", "=", "time", ".", "time", "(", ")", "checker", "=", "functools", ".", "partial", "(", "check", ",", "path", ",", "now", ")", "beatcheck"...
6ac71bda1de6706fb34244ae4972e36db5f062d3
test
Reader.expected_error
Generate a basic error to include the current state. A parser can supply only a representation of what it is expecting to this method and the reader will provide the context, including the index to the error. Args: expected: A representation of what the parser is currently ...
parsita/state.py
def expected_error(self, expected: str) -> str: """Generate a basic error to include the current state. A parser can supply only a representation of what it is expecting to this method and the reader will provide the context, including the index to the error. Args: ...
def expected_error(self, expected: str) -> str: """Generate a basic error to include the current state. A parser can supply only a representation of what it is expecting to this method and the reader will provide the context, including the index to the error. Args: ...
[ "Generate", "a", "basic", "error", "to", "include", "the", "current", "state", "." ]
drhagen/parsita
python
https://github.com/drhagen/parsita/blob/d97414a05541f48231381f607d1d2e6b50781d39/parsita/state.py#L31-L48
[ "def", "expected_error", "(", "self", ",", "expected", ":", "str", ")", "->", "str", ":", "if", "self", ".", "finished", ":", "return", "'Expected {} but found end of source'", ".", "format", "(", "expected", ")", "else", ":", "return", "'Expected {} but found {...
d97414a05541f48231381f607d1d2e6b50781d39
test
Reader.recursion_error
Generate an error to indicate that infinite recursion was encountered. A parser can supply a representation of itself to this method and the reader will supply the context, including the location where the parser stalled. Args: repeated_parser: A representation of the repea...
parsita/state.py
def recursion_error(self, repeated_parser: str): """Generate an error to indicate that infinite recursion was encountered. A parser can supply a representation of itself to this method and the reader will supply the context, including the location where the parser stalled. Args...
def recursion_error(self, repeated_parser: str): """Generate an error to indicate that infinite recursion was encountered. A parser can supply a representation of itself to this method and the reader will supply the context, including the location where the parser stalled. Args...
[ "Generate", "an", "error", "to", "indicate", "that", "infinite", "recursion", "was", "encountered", "." ]
drhagen/parsita
python
https://github.com/drhagen/parsita/blob/d97414a05541f48231381f607d1d2e6b50781d39/parsita/state.py#L50-L69
[ "def", "recursion_error", "(", "self", ",", "repeated_parser", ":", "str", ")", ":", "if", "self", ".", "finished", ":", "return", "'Infinite recursion detected in {}; empty string was matched and will be matched forever at '", "'end of source'", ".", "format", "(", "repeat...
d97414a05541f48231381f607d1d2e6b50781d39
test
StringReader.expected_error
Generate a basic error to include the current state. A parser can supply only a representation of what it is expecting to this method and the reader will provide the context, including the line and character positions. Args: expected: A representation of what the parser is ...
parsita/state.py
def expected_error(self, expected: str) -> str: """Generate a basic error to include the current state. A parser can supply only a representation of what it is expecting to this method and the reader will provide the context, including the line and character positions. Args: ...
def expected_error(self, expected: str) -> str: """Generate a basic error to include the current state. A parser can supply only a representation of what it is expecting to this method and the reader will provide the context, including the line and character positions. Args: ...
[ "Generate", "a", "basic", "error", "to", "include", "the", "current", "state", "." ]
drhagen/parsita
python
https://github.com/drhagen/parsita/blob/d97414a05541f48231381f607d1d2e6b50781d39/parsita/state.py#L164-L184
[ "def", "expected_error", "(", "self", ",", "expected", ":", "str", ")", "->", "str", ":", "if", "self", ".", "finished", ":", "return", "super", "(", ")", ".", "expected_error", "(", "expected", ")", "else", ":", "line_index", ",", "character_index", ","...
d97414a05541f48231381f607d1d2e6b50781d39
test
StringReader.recursion_error
Generate an error to indicate that infinite recursion was encountered. A parser can supply a representation of itself to this method and the reader will supply the context, including the location where the parser stalled. Args: repeated_parser: A representation of the repea...
parsita/state.py
def recursion_error(self, repeated_parser: str): """Generate an error to indicate that infinite recursion was encountered. A parser can supply a representation of itself to this method and the reader will supply the context, including the location where the parser stalled. Args...
def recursion_error(self, repeated_parser: str): """Generate an error to indicate that infinite recursion was encountered. A parser can supply a representation of itself to this method and the reader will supply the context, including the location where the parser stalled. Args...
[ "Generate", "an", "error", "to", "indicate", "that", "infinite", "recursion", "was", "encountered", "." ]
drhagen/parsita
python
https://github.com/drhagen/parsita/blob/d97414a05541f48231381f607d1d2e6b50781d39/parsita/state.py#L186-L205
[ "def", "recursion_error", "(", "self", ",", "repeated_parser", ":", "str", ")", ":", "if", "self", ".", "finished", ":", "return", "super", "(", ")", ".", "recursion_error", "(", "repeated_parser", ")", "else", ":", "line_index", ",", "character_index", ",",...
d97414a05541f48231381f607d1d2e6b50781d39
test
Status.merge
Merge the failure message from another status into this one. Whichever status represents parsing that has gone the farthest is retained. If both statuses have gone the same distance, then the expected values from both are retained. Args: status: The status to merge into thi...
parsita/state.py
def merge(self, status: 'Status[Input, Output]') -> 'Status[Input, Output]': """Merge the failure message from another status into this one. Whichever status represents parsing that has gone the farthest is retained. If both statuses have gone the same distance, then the expected values...
def merge(self, status: 'Status[Input, Output]') -> 'Status[Input, Output]': """Merge the failure message from another status into this one. Whichever status represents parsing that has gone the farthest is retained. If both statuses have gone the same distance, then the expected values...
[ "Merge", "the", "failure", "message", "from", "another", "status", "into", "this", "one", "." ]
drhagen/parsita
python
https://github.com/drhagen/parsita/blob/d97414a05541f48231381f607d1d2e6b50781d39/parsita/state.py#L298-L330
[ "def", "merge", "(", "self", ",", "status", ":", "'Status[Input, Output]'", ")", "->", "'Status[Input, Output]'", ":", "if", "status", "is", "None", "or", "status", ".", "farthest", "is", "None", ":", "# No new message; simply return unchanged", "pass", "elif", "s...
d97414a05541f48231381f607d1d2e6b50781d39
test
exists
Query to test if a value exists.
cypher/shortcuts.py
def exists(value): "Query to test if a value exists." if not isinstance(value, Token): raise TypeError('value must be a token') if not hasattr(value, 'identifier'): raise TypeError('value must support an identifier') if not value.identifier: value = value.__class__(**value.__di...
def exists(value): "Query to test if a value exists." if not isinstance(value, Token): raise TypeError('value must be a token') if not hasattr(value, 'identifier'): raise TypeError('value must support an identifier') if not value.identifier: value = value.__class__(**value.__di...
[ "Query", "to", "test", "if", "a", "value", "exists", "." ]
bruth/cypher
python
https://github.com/bruth/cypher/blob/4f962f51539ac5a667ab5a050b6b4052d4c10c0f/cypher/shortcuts.py#L5-L23
[ "def", "exists", "(", "value", ")", ":", "if", "not", "isinstance", "(", "value", ",", "Token", ")", ":", "raise", "TypeError", "(", "'value must be a token'", ")", "if", "not", "hasattr", "(", "value", ",", "'identifier'", ")", ":", "raise", "TypeError", ...
4f962f51539ac5a667ab5a050b6b4052d4c10c0f
test
get
Query to get the value.
cypher/shortcuts.py
def get(value): "Query to get the value." if not isinstance(value, Token): raise TypeError('value must be a token') if not hasattr(value, 'identifier'): raise TypeError('value must support an identifier') if not value.identifier: value = value.__class__(**value.__dict__) ...
def get(value): "Query to get the value." if not isinstance(value, Token): raise TypeError('value must be a token') if not hasattr(value, 'identifier'): raise TypeError('value must support an identifier') if not value.identifier: value = value.__class__(**value.__dict__) ...
[ "Query", "to", "get", "the", "value", "." ]
bruth/cypher
python
https://github.com/bruth/cypher/blob/4f962f51539ac5a667ab5a050b6b4052d4c10c0f/cypher/shortcuts.py#L26-L43
[ "def", "get", "(", "value", ")", ":", "if", "not", "isinstance", "(", "value", ",", "Token", ")", ":", "raise", "TypeError", "(", "'value must be a token'", ")", "if", "not", "hasattr", "(", "value", ",", "'identifier'", ")", ":", "raise", "TypeError", "...
4f962f51539ac5a667ab5a050b6b4052d4c10c0f
test
constant
Produce a function that always returns a supplied value. Args: x: Any object. Returns: A function that accepts any number of positional and keyword arguments, discards them, and returns ``x``.
parsita/util.py
def constant(x: A) -> Callable[..., A]: """Produce a function that always returns a supplied value. Args: x: Any object. Returns: A function that accepts any number of positional and keyword arguments, discards them, and returns ``x``. """ def constanted(*args, **kwargs): ...
def constant(x: A) -> Callable[..., A]: """Produce a function that always returns a supplied value. Args: x: Any object. Returns: A function that accepts any number of positional and keyword arguments, discards them, and returns ``x``. """ def constanted(*args, **kwargs): ...
[ "Produce", "a", "function", "that", "always", "returns", "a", "supplied", "value", "." ]
drhagen/parsita
python
https://github.com/drhagen/parsita/blob/d97414a05541f48231381f607d1d2e6b50781d39/parsita/util.py#L6-L19
[ "def", "constant", "(", "x", ":", "A", ")", "->", "Callable", "[", "...", ",", "A", "]", ":", "def", "constanted", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "return", "x", "return", "constanted" ]
d97414a05541f48231381f607d1d2e6b50781d39
test
splat
Convert a function taking multiple arguments into a function taking a single iterable argument. Args: f: Any function Returns: A function that accepts a single iterable argument. Each element of this iterable argument is passed as an argument to ``f``. Example: $ def f(a, ...
parsita/util.py
def splat(f: Callable[..., A]) -> Callable[[Iterable], A]: """Convert a function taking multiple arguments into a function taking a single iterable argument. Args: f: Any function Returns: A function that accepts a single iterable argument. Each element of this iterable argument is passed ...
def splat(f: Callable[..., A]) -> Callable[[Iterable], A]: """Convert a function taking multiple arguments into a function taking a single iterable argument. Args: f: Any function Returns: A function that accepts a single iterable argument. Each element of this iterable argument is passed ...
[ "Convert", "a", "function", "taking", "multiple", "arguments", "into", "a", "function", "taking", "a", "single", "iterable", "argument", "." ]
drhagen/parsita
python
https://github.com/drhagen/parsita/blob/d97414a05541f48231381f607d1d2e6b50781d39/parsita/util.py#L22-L44
[ "def", "splat", "(", "f", ":", "Callable", "[", "...", ",", "A", "]", ")", "->", "Callable", "[", "[", "Iterable", "]", ",", "A", "]", ":", "def", "splatted", "(", "args", ")", ":", "return", "f", "(", "*", "args", ")", "return", "splatted" ]
d97414a05541f48231381f607d1d2e6b50781d39
test
unsplat
Convert a function taking a single iterable argument into a function taking multiple arguments. Args: f: Any function taking a single iterable argument Returns: A function that accepts multiple arguments. Each argument of this function is passed as an element of an iterable to ``f``. ...
parsita/util.py
def unsplat(f: Callable[[Iterable], A]) -> Callable[..., A]: """Convert a function taking a single iterable argument into a function taking multiple arguments. Args: f: Any function taking a single iterable argument Returns: A function that accepts multiple arguments. Each argument of this...
def unsplat(f: Callable[[Iterable], A]) -> Callable[..., A]: """Convert a function taking a single iterable argument into a function taking multiple arguments. Args: f: Any function taking a single iterable argument Returns: A function that accepts multiple arguments. Each argument of this...
[ "Convert", "a", "function", "taking", "a", "single", "iterable", "argument", "into", "a", "function", "taking", "multiple", "arguments", "." ]
drhagen/parsita
python
https://github.com/drhagen/parsita/blob/d97414a05541f48231381f607d1d2e6b50781d39/parsita/util.py#L47-L69
[ "def", "unsplat", "(", "f", ":", "Callable", "[", "[", "Iterable", "]", ",", "A", "]", ")", "->", "Callable", "[", "...", ",", "A", "]", ":", "def", "unsplatted", "(", "*", "args", ")", ":", "return", "f", "(", "args", ")", "return", "unsplatted"...
d97414a05541f48231381f607d1d2e6b50781d39
test
runProcess
Run a process, return a deferred that fires when it is done :params args: Process arguments :params timeout: Time before terminating process :params grace: Time before killing process after terminating it :params reactor: IReactorProcess and IReactorTime :returns: deferred that fires with success w...
ncolony/schedulelib.py
def runProcess(args, timeout, grace, reactor): """Run a process, return a deferred that fires when it is done :params args: Process arguments :params timeout: Time before terminating process :params grace: Time before killing process after terminating it :params reactor: IReactorProcess and IReacto...
def runProcess(args, timeout, grace, reactor): """Run a process, return a deferred that fires when it is done :params args: Process arguments :params timeout: Time before terminating process :params grace: Time before killing process after terminating it :params reactor: IReactorProcess and IReacto...
[ "Run", "a", "process", "return", "a", "deferred", "that", "fires", "when", "it", "is", "done" ]
ncolony/ncolony
python
https://github.com/ncolony/ncolony/blob/6ac71bda1de6706fb34244ae4972e36db5f062d3/ncolony/schedulelib.py#L70-L100
[ "def", "runProcess", "(", "args", ",", "timeout", ",", "grace", ",", "reactor", ")", ":", "deferred", "=", "defer", ".", "Deferred", "(", ")", "protocol", "=", "ProcessProtocol", "(", "deferred", ")", "process", "=", "reactor", ".", "spawnProcess", "(", ...
6ac71bda1de6706fb34244ae4972e36db5f062d3
test
makeService
Make scheduler service :params opts: dict-like object. keys: frequency, args, timeout, grace
ncolony/schedulelib.py
def makeService(opts): """Make scheduler service :params opts: dict-like object. keys: frequency, args, timeout, grace """ ser = tainternet.TimerService(opts['frequency'], runProcess, opts['args'], opts['timeout'], opts['grace'], tireactor) ret = service.Mul...
def makeService(opts): """Make scheduler service :params opts: dict-like object. keys: frequency, args, timeout, grace """ ser = tainternet.TimerService(opts['frequency'], runProcess, opts['args'], opts['timeout'], opts['grace'], tireactor) ret = service.Mul...
[ "Make", "scheduler", "service" ]
ncolony/ncolony
python
https://github.com/ncolony/ncolony/blob/6ac71bda1de6706fb34244ae4972e36db5f062d3/ncolony/schedulelib.py#L129-L141
[ "def", "makeService", "(", "opts", ")", ":", "ser", "=", "tainternet", ".", "TimerService", "(", "opts", "[", "'frequency'", "]", ",", "runProcess", ",", "opts", "[", "'args'", "]", ",", "opts", "[", "'timeout'", "]", ",", "opts", "[", "'grace'", "]", ...
6ac71bda1de6706fb34244ae4972e36db5f062d3
test
completely_parse_reader
Consume reader and return Success only on complete consumption. This is a helper function for ``parse`` methods, which return ``Success`` when the input is completely consumed and ``Failure`` with an appropriate message otherwise. Args: parser: The parser doing the consuming reader: Th...
parsita/parsers.py
def completely_parse_reader(parser: Parser[Input, Output], reader: Reader[Input]) -> Result[Output]: """Consume reader and return Success only on complete consumption. This is a helper function for ``parse`` methods, which return ``Success`` when the input is completely consumed and ``Failure`` with an app...
def completely_parse_reader(parser: Parser[Input, Output], reader: Reader[Input]) -> Result[Output]: """Consume reader and return Success only on complete consumption. This is a helper function for ``parse`` methods, which return ``Success`` when the input is completely consumed and ``Failure`` with an app...
[ "Consume", "reader", "and", "return", "Success", "only", "on", "complete", "consumption", "." ]
drhagen/parsita
python
https://github.com/drhagen/parsita/blob/d97414a05541f48231381f607d1d2e6b50781d39/parsita/parsers.py#L155-L182
[ "def", "completely_parse_reader", "(", "parser", ":", "Parser", "[", "Input", ",", "Output", "]", ",", "reader", ":", "Reader", "[", "Input", "]", ")", "->", "Result", "[", "Output", "]", ":", "result", "=", "(", "parser", "<<", "eof", ")", ".", "con...
d97414a05541f48231381f607d1d2e6b50781d39
test
lit
Match a literal sequence. In the `TextParsers`` context, this matches the literal string provided. In the ``GeneralParsers`` context, this matches a sequence of input. If multiple literals are provided, they are treated as alternatives. e.g. ``lit('+', '-')`` is the same as ``lit('+') | lit('-')``...
parsita/parsers.py
def lit(literal: Sequence[Input], *literals: Sequence[Sequence[Input]]) -> Parser: """Match a literal sequence. In the `TextParsers`` context, this matches the literal string provided. In the ``GeneralParsers`` context, this matches a sequence of input. If multiple literals are provided, they are ...
def lit(literal: Sequence[Input], *literals: Sequence[Sequence[Input]]) -> Parser: """Match a literal sequence. In the `TextParsers`` context, this matches the literal string provided. In the ``GeneralParsers`` context, this matches a sequence of input. If multiple literals are provided, they are ...
[ "Match", "a", "literal", "sequence", "." ]
drhagen/parsita
python
https://github.com/drhagen/parsita/blob/d97414a05541f48231381f607d1d2e6b50781d39/parsita/parsers.py#L232-L254
[ "def", "lit", "(", "literal", ":", "Sequence", "[", "Input", "]", ",", "*", "literals", ":", "Sequence", "[", "Sequence", "[", "Input", "]", "]", ")", "->", "Parser", ":", "if", "len", "(", "literals", ")", ">", "0", ":", "return", "AlternativeParser...
d97414a05541f48231381f607d1d2e6b50781d39
test
opt
Optionally match a parser. An ``OptionalParser`` attempts to match ``parser``. If it succeeds, it returns a list of length one with the value returned by the parser as the only element. If it fails, it returns an empty list. Args: parser: Parser or literal
parsita/parsers.py
def opt(parser: Union[Parser, Sequence[Input]]) -> OptionalParser: """Optionally match a parser. An ``OptionalParser`` attempts to match ``parser``. If it succeeds, it returns a list of length one with the value returned by the parser as the only element. If it fails, it returns an empty list. Arg...
def opt(parser: Union[Parser, Sequence[Input]]) -> OptionalParser: """Optionally match a parser. An ``OptionalParser`` attempts to match ``parser``. If it succeeds, it returns a list of length one with the value returned by the parser as the only element. If it fails, it returns an empty list. Arg...
[ "Optionally", "match", "a", "parser", "." ]
drhagen/parsita
python
https://github.com/drhagen/parsita/blob/d97414a05541f48231381f607d1d2e6b50781d39/parsita/parsers.py#L318-L330
[ "def", "opt", "(", "parser", ":", "Union", "[", "Parser", ",", "Sequence", "[", "Input", "]", "]", ")", "->", "OptionalParser", ":", "if", "isinstance", "(", "parser", ",", "str", ")", ":", "parser", "=", "lit", "(", "parser", ")", "return", "Optiona...
d97414a05541f48231381f607d1d2e6b50781d39
test
rep1
Match a parser one or more times repeatedly. This matches ``parser`` multiple times in a row. If it matches as least once, it returns a list of values from each time ``parser`` matched. If it does not match ``parser`` at all, it fails. Args: parser: Parser or literal
parsita/parsers.py
def rep1(parser: Union[Parser, Sequence[Input]]) -> RepeatedOnceParser: """Match a parser one or more times repeatedly. This matches ``parser`` multiple times in a row. If it matches as least once, it returns a list of values from each time ``parser`` matched. If it does not match ``parser`` at all, it...
def rep1(parser: Union[Parser, Sequence[Input]]) -> RepeatedOnceParser: """Match a parser one or more times repeatedly. This matches ``parser`` multiple times in a row. If it matches as least once, it returns a list of values from each time ``parser`` matched. If it does not match ``parser`` at all, it...
[ "Match", "a", "parser", "one", "or", "more", "times", "repeatedly", "." ]
drhagen/parsita
python
https://github.com/drhagen/parsita/blob/d97414a05541f48231381f607d1d2e6b50781d39/parsita/parsers.py#L451-L463
[ "def", "rep1", "(", "parser", ":", "Union", "[", "Parser", ",", "Sequence", "[", "Input", "]", "]", ")", "->", "RepeatedOnceParser", ":", "if", "isinstance", "(", "parser", ",", "str", ")", ":", "parser", "=", "lit", "(", "parser", ")", "return", "Re...
d97414a05541f48231381f607d1d2e6b50781d39
test
rep
Match a parser zero or more times repeatedly. This matches ``parser`` multiple times in a row. A list is returned containing the value from each match. If there are no matches, an empty list is returned. Args: parser: Parser or literal
parsita/parsers.py
def rep(parser: Union[Parser, Sequence[Input]]) -> RepeatedParser: """Match a parser zero or more times repeatedly. This matches ``parser`` multiple times in a row. A list is returned containing the value from each match. If there are no matches, an empty list is returned. Args: parser: Pa...
def rep(parser: Union[Parser, Sequence[Input]]) -> RepeatedParser: """Match a parser zero or more times repeatedly. This matches ``parser`` multiple times in a row. A list is returned containing the value from each match. If there are no matches, an empty list is returned. Args: parser: Pa...
[ "Match", "a", "parser", "zero", "or", "more", "times", "repeatedly", "." ]
drhagen/parsita
python
https://github.com/drhagen/parsita/blob/d97414a05541f48231381f607d1d2e6b50781d39/parsita/parsers.py#L491-L503
[ "def", "rep", "(", "parser", ":", "Union", "[", "Parser", ",", "Sequence", "[", "Input", "]", "]", ")", "->", "RepeatedParser", ":", "if", "isinstance", "(", "parser", ",", "str", ")", ":", "parser", "=", "lit", "(", "parser", ")", "return", "Repeate...
d97414a05541f48231381f607d1d2e6b50781d39
test
rep1sep
Match a parser one or more times separated by another parser. This matches repeated sequences of ``parser`` separated by ``separator``. If there is at least one match, a list containing the values of the ``parser`` matches is returned. The values from ``separator`` are discarded. If it does not match `...
parsita/parsers.py
def rep1sep(parser: Union[Parser, Sequence[Input]], separator: Union[Parser, Sequence[Input]]) \ -> RepeatedOnceSeparatedParser: """Match a parser one or more times separated by another parser. This matches repeated sequences of ``parser`` separated by ``separator``. If there is at least one match,...
def rep1sep(parser: Union[Parser, Sequence[Input]], separator: Union[Parser, Sequence[Input]]) \ -> RepeatedOnceSeparatedParser: """Match a parser one or more times separated by another parser. This matches repeated sequences of ``parser`` separated by ``separator``. If there is at least one match,...
[ "Match", "a", "parser", "one", "or", "more", "times", "separated", "by", "another", "parser", "." ]
drhagen/parsita
python
https://github.com/drhagen/parsita/blob/d97414a05541f48231381f607d1d2e6b50781d39/parsita/parsers.py#L543-L560
[ "def", "rep1sep", "(", "parser", ":", "Union", "[", "Parser", ",", "Sequence", "[", "Input", "]", "]", ",", "separator", ":", "Union", "[", "Parser", ",", "Sequence", "[", "Input", "]", "]", ")", "->", "RepeatedOnceSeparatedParser", ":", "if", "isinstanc...
d97414a05541f48231381f607d1d2e6b50781d39
test
repsep
Match a parser zero or more times separated by another parser. This matches repeated sequences of ``parser`` separated by ``separator``. A list is returned containing the value from each match of ``parser``. The values from ``separator`` are discarded. If there are no matches, an empty list is returned...
parsita/parsers.py
def repsep(parser: Union[Parser, Sequence[Input]], separator: Union[Parser, Sequence[Input]]) \ -> RepeatedSeparatedParser: """Match a parser zero or more times separated by another parser. This matches repeated sequences of ``parser`` separated by ``separator``. A list is returned containing the v...
def repsep(parser: Union[Parser, Sequence[Input]], separator: Union[Parser, Sequence[Input]]) \ -> RepeatedSeparatedParser: """Match a parser zero or more times separated by another parser. This matches repeated sequences of ``parser`` separated by ``separator``. A list is returned containing the v...
[ "Match", "a", "parser", "zero", "or", "more", "times", "separated", "by", "another", "parser", "." ]
drhagen/parsita
python
https://github.com/drhagen/parsita/blob/d97414a05541f48231381f607d1d2e6b50781d39/parsita/parsers.py#L600-L617
[ "def", "repsep", "(", "parser", ":", "Union", "[", "Parser", ",", "Sequence", "[", "Input", "]", "]", ",", "separator", ":", "Union", "[", "Parser", ",", "Sequence", "[", "Input", "]", "]", ")", "->", "RepeatedSeparatedParser", ":", "if", "isinstance", ...
d97414a05541f48231381f607d1d2e6b50781d39
test
check
Check all processes
ncolony/httpcheck.py
def check(settings, states, location): """Check all processes""" children = {child.basename(): child for child in location.children()} last = set(states) current = set(children) gone = last - current added = current - last for name in gone: states[name].close() del states[nam...
def check(settings, states, location): """Check all processes""" children = {child.basename(): child for child in location.children()} last = set(states) current = set(children) gone = last - current added = current - last for name in gone: states[name].close() del states[nam...
[ "Check", "all", "processes" ]
ncolony/ncolony
python
https://github.com/ncolony/ncolony/blob/6ac71bda1de6706fb34244ae4972e36db5f062d3/ncolony/httpcheck.py#L168-L180
[ "def", "check", "(", "settings", ",", "states", ",", "location", ")", ":", "children", "=", "{", "child", ".", "basename", "(", ")", ":", "child", "for", "child", "in", "location", ".", "children", "(", ")", "}", "last", "=", "set", "(", "states", ...
6ac71bda1de6706fb34244ae4972e36db5f062d3
test
makeService
Make a service :params opt: dictionary-like object with 'freq', 'config' and 'messages' :returns: twisted.application.internet.TimerService that at opt['freq'] checks for stale processes in opt['config'], and sends restart messages through opt['messages']
ncolony/httpcheck.py
def makeService(opt): """Make a service :params opt: dictionary-like object with 'freq', 'config' and 'messages' :returns: twisted.application.internet.TimerService that at opt['freq'] checks for stale processes in opt['config'], and sends restart messages through opt['messages'...
def makeService(opt): """Make a service :params opt: dictionary-like object with 'freq', 'config' and 'messages' :returns: twisted.application.internet.TimerService that at opt['freq'] checks for stale processes in opt['config'], and sends restart messages through opt['messages'...
[ "Make", "a", "service" ]
ncolony/ncolony
python
https://github.com/ncolony/ncolony/blob/6ac71bda1de6706fb34244ae4972e36db5f062d3/ncolony/httpcheck.py#L197-L213
[ "def", "makeService", "(", "opt", ")", ":", "restarter", ",", "path", "=", "beatcheck", ".", "parseConfig", "(", "opt", ")", "pool", "=", "client", ".", "HTTPConnectionPool", "(", "reactor", ")", "agent", "=", "client", ".", "Agent", "(", "reactor", "=",...
6ac71bda1de6706fb34244ae4972e36db5f062d3
test
State.close
Discard data and cancel all calls. Instance cannot be reused after closing.
ncolony/httpcheck.py
def close(self): """Discard data and cancel all calls. Instance cannot be reused after closing. """ if self.closed: raise ValueError("Cannot close a closed state") if self.call is not None: self.call.cancel() self.closed = True
def close(self): """Discard data and cancel all calls. Instance cannot be reused after closing. """ if self.closed: raise ValueError("Cannot close a closed state") if self.call is not None: self.call.cancel() self.closed = True
[ "Discard", "data", "and", "cancel", "all", "calls", "." ]
ncolony/ncolony
python
https://github.com/ncolony/ncolony/blob/6ac71bda1de6706fb34244ae4972e36db5f062d3/ncolony/httpcheck.py#L97-L106
[ "def", "close", "(", "self", ")", ":", "if", "self", ".", "closed", ":", "raise", "ValueError", "(", "\"Cannot close a closed state\"", ")", "if", "self", ".", "call", "is", "not", "None", ":", "self", ".", "call", ".", "cancel", "(", ")", "self", ".",...
6ac71bda1de6706fb34244ae4972e36db5f062d3
test
State.check
Check the state of HTTP
ncolony/httpcheck.py
def check(self): """Check the state of HTTP""" if self.closed: raise ValueError("Cannot check a closed state") self._maybeReset() if self.url is None: return False return self._maybeCheck()
def check(self): """Check the state of HTTP""" if self.closed: raise ValueError("Cannot check a closed state") self._maybeReset() if self.url is None: return False return self._maybeCheck()
[ "Check", "the", "state", "of", "HTTP" ]
ncolony/ncolony
python
https://github.com/ncolony/ncolony/blob/6ac71bda1de6706fb34244ae4972e36db5f062d3/ncolony/httpcheck.py#L108-L115
[ "def", "check", "(", "self", ")", ":", "if", "self", ".", "closed", ":", "raise", "ValueError", "(", "\"Cannot check a closed state\"", ")", "self", ".", "_maybeReset", "(", ")", "if", "self", ".", "url", "is", "None", ":", "return", "False", "return", "...
6ac71bda1de6706fb34244ae4972e36db5f062d3
test
makeService
Make a service :returns: an IService
ncolony/client/heart.py
def makeService(): """Make a service :returns: an IService """ configJSON = os.environ.get('NCOLONY_CONFIG') if configJSON is None: return None config = json.loads(configJSON) params = config.get('ncolony.beatcheck') if params is None: return None myFilePath = filepa...
def makeService(): """Make a service :returns: an IService """ configJSON = os.environ.get('NCOLONY_CONFIG') if configJSON is None: return None config = json.loads(configJSON) params = config.get('ncolony.beatcheck') if params is None: return None myFilePath = filepa...
[ "Make", "a", "service" ]
ncolony/ncolony
python
https://github.com/ncolony/ncolony/blob/6ac71bda1de6706fb34244ae4972e36db5f062d3/ncolony/client/heart.py#L36-L54
[ "def", "makeService", "(", ")", ":", "configJSON", "=", "os", ".", "environ", ".", "get", "(", "'NCOLONY_CONFIG'", ")", "if", "configJSON", "is", "None", ":", "return", "None", "config", "=", "json", ".", "loads", "(", "configJSON", ")", "params", "=", ...
6ac71bda1de6706fb34244ae4972e36db5f062d3
test
maybeAddHeart
Add a heart to a service collection Add a heart to a service.IServiceCollector if the heart is not None. :params master: a service.IServiceCollector
ncolony/client/heart.py
def maybeAddHeart(master): """Add a heart to a service collection Add a heart to a service.IServiceCollector if the heart is not None. :params master: a service.IServiceCollector """ heartSer = makeService() if heartSer is None: return heartSer.setName('heart') heartSer.set...
def maybeAddHeart(master): """Add a heart to a service collection Add a heart to a service.IServiceCollector if the heart is not None. :params master: a service.IServiceCollector """ heartSer = makeService() if heartSer is None: return heartSer.setName('heart') heartSer.set...
[ "Add", "a", "heart", "to", "a", "service", "collection" ]
ncolony/ncolony
python
https://github.com/ncolony/ncolony/blob/6ac71bda1de6706fb34244ae4972e36db5f062d3/ncolony/client/heart.py#L57-L69
[ "def", "maybeAddHeart", "(", "master", ")", ":", "heartSer", "=", "makeService", "(", ")", "if", "heartSer", "is", "None", ":", "return", "heartSer", ".", "setName", "(", "'heart'", ")", "heartSer", ".", "setServiceParent", "(", "master", ")" ]
6ac71bda1de6706fb34244ae4972e36db5f062d3
test
wrapHeart
Wrap a service in a MultiService with a heart
ncolony/client/heart.py
def wrapHeart(service): """Wrap a service in a MultiService with a heart""" master = taservice.MultiService() service.setServiceParent(master) maybeAddHeart(master) return master
def wrapHeart(service): """Wrap a service in a MultiService with a heart""" master = taservice.MultiService() service.setServiceParent(master) maybeAddHeart(master) return master
[ "Wrap", "a", "service", "in", "a", "MultiService", "with", "a", "heart" ]
ncolony/ncolony
python
https://github.com/ncolony/ncolony/blob/6ac71bda1de6706fb34244ae4972e36db5f062d3/ncolony/client/heart.py#L72-L77
[ "def", "wrapHeart", "(", "service", ")", ":", "master", "=", "taservice", ".", "MultiService", "(", ")", "service", ".", "setServiceParent", "(", "master", ")", "maybeAddHeart", "(", "master", ")", "return", "master" ]
6ac71bda1de6706fb34244ae4972e36db5f062d3