text stringlengths 0 828 |
|---|
1964,"def from_json(cls, data): |
""""""Decode a JSON string and inflate a node instance."""""" |
# Decode JSON string |
assert isinstance(data, str) |
data = json.loads(data) |
assert isinstance(data, dict) |
return cls.from_dict(data)" |
1965,"def _pred(aclass): |
"""""" |
:param aclass |
:return: boolean |
"""""" |
isaclass = inspect.isclass(aclass) |
return isaclass and aclass.__module__ == _pred.__module__" |
1966,"def extract_keywords(func): |
"""""" |
Parses the keywords from the given function. |
:param func | <function> |
"""""" |
if hasattr(func, 'im_func'): |
func = func.im_func |
try: |
return func.func_code.co_varnames[-len(func.func_defaults):] |
except (TypeError, ValueError, IndexError): |
return tuple()" |
1967,"def _get_adv_trans_stats(self, cmd, return_tdo=False): |
""""""Utility function to fetch the transfer statistics for the last |
advanced transfer. Checking the stats appears to sync the |
controller. For details on the advanced transfer please refer |
to the documentation at |
http://diamondman.github.io/Adapt/cable_digilent_adept.html#bulk-requests |
"""""" |
t = time() |
code, res = self.bulkCommand(b'\x03\x02%c\x00'%(0x80|cmd), 10) |
if self._scanchain and self._scanchain._print_statistics: |
print(""GET STATS TIME"", time()-t)#pragma: no cover |
if len(res) == 4: |
count = struct.unpack('<I', res)[0] |
return count |
elif len(res) == 8: |
written, read = struct.unpack('<II', res) |
return written, read |
return res" |
1968,"def jtag_enable(self): |
"""""" |
Enables JTAG output on the controller. JTAG operations executed |
before this function is called will return useless data or fail. |
Usage: |
>>> from proteusisc import getAttachedControllers, bitarray |
>>> c = getAttachedControllers()[0] |
>>> c.jtag_enable() |
>>> c.write_tms_bits(bitarray(""001011111""), return_tdo=True) |
>>> c.jtag_disable() |
"""""" |
status, _ = self.bulkCommand(_BMSG_ENABLE_JTAG) |
if status == 0: |
self._jtagon = True |
elif status == 3: |
self._jtagon = True |
raise JTAGAlreadyEnabledError() |
else: |
raise JTAGEnableFailedError(""Error enabling JTAG. Error code: %s."" %status)" |
1969,"def jtag_disable(self): |
"""""" |
Disables JTAG output on the controller. JTAG operations executed |
immediately after this function will return useless data or fail. |
Usage: |
>>> from proteusisc import getAttachedControllers, bitarray |
>>> c = getAttachedControllers()[0] |
>>> c.jtag_enable() |
>>> c.write_tms_bits(bitarray(""001011111""), return_tdo=True) |
>>> c.jtag_disable() |
"""""" |
if not self._jtagon: return |
status, _ = self.bulkCommand(_BMSG_DISABLE_JTAG) |
if status == 0: |
self._jtagon = False |
elif status == 3: |
raise JTAGControlError(""Error Code %s""%status) |
self.close_handle()" |
1970,"def write_tms_bits(self, data, return_tdo=False, TDI=False): |
"""""" |
Command controller to write TMS data (with constant TDI bit) |
to the physical scan chain. Optionally return TDO bits sent |
back from scan the chain. |
Args: |
data - bits to send over TMS line of scan chain (bitarray) |
return_tdo (bool) - return the devices bitarray response |
TDI (bool) - whether TDI should send a bitarray of all 0's |
of same length as `data` (i.e False) or all 1's |
(i.e. True) |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.