How to use _get_schema method in pandera

Best Python code snippet using pandera_python

contract.py

Source:contract.py Github

copy

Full Screen

...24 def get_section(self, section):25 code = self.get_code()26 return next(s for s in code if s['prim'] == section)27 @lru_cache(maxsize=None)28 def _get_schema(self, section):29 return build_schema(self.get_section(section))30 def _get_big_map_schema(self):31 schema = self._get_schema('storage')32 root = next(k for k, v in schema.type_map.items() if v['prim'] == 'big_map')33 key_path, val_path = root + '0', root + '1'34 return schema, key_path, val_path35 @classmethod36 def from_code(cls, code):37 return Contract(code=code)38 @classmethod39 def from_string(cls, text):40 code = micheline_parser.parse(text)41 return cls.from_code(code)42 @classmethod43 def from_file(cls, path):44 with open(path) as f:45 return cls.from_string(f.read())46 def decode_storage(self, data=None, annotations=True, literals=True):47 if data is None:48 data = self.get('script')['storage']49 return decode_data(50 data=data,51 schema=self._get_schema('storage'),52 annotations=annotations,53 literals=literals54 )55 def encode_storage(self, data):56 return encode_data(57 data=data,58 schema=self._get_schema('storage')59 )60 def decode_parameters(self, data, annotations=True, literals=True):61 return decode_data(62 data=data,63 schema=self._get_schema('parameter'),64 annotations=annotations,65 literals=literals66 )67 def encode_parameters(self, data):68 return encode_data(69 data=data,70 schema=self._get_schema('parameter')71 )72 def storage_schema(self):73 return decode_schema(self._get_schema('storage'))74 def parameter_schema(self):75 return decode_schema(self._get_schema('parameter'))76 def big_map_get(self, key):77 schema, key_path, val_path = self._get_big_map_schema()78 query = dict(79 key=encode_data(key, schema, root=key_path),80 type=schema.type_map[key_path]81 )82 value = self._node.post(f'{self._path}/big_map_get', json=query)83 return decode_data(value, schema, root=val_path)84 def big_map_diff_decode(self, data):85 schema, key_path, val_path = self._get_big_map_schema()86 return {87 decode_data(item['key'], schema, root=key_path):88 decode_data(item['value'], schema, root=val_path)89 for item in data...

Full Screen

Full Screen

schemas.py

Source:schemas.py Github

copy

Full Screen

1import os2import json3import aavm4_SCHEMAS_DIR = os.path.join(os.path.dirname(aavm.__file__), 'schemas')5def _get_schema(schema_fpath: str) -> dict:6 if not os.path.isfile(schema_fpath):7 raise FileNotFoundError(schema_fpath)8 with open(schema_fpath, 'r') as fin:9 return json.load(fin)10def get_machine_schema(schema: str) -> dict:11 schema_fpath = os.path.join(_SCHEMAS_DIR, "machine.json", f"{schema}.json")12 return _get_schema(schema_fpath)13def get_runtime_schema(schema: str) -> dict:14 schema_fpath = os.path.join(_SCHEMAS_DIR, "runtime.json", f"{schema}.json")15 return _get_schema(schema_fpath)16def get_index_schema(schema: str) -> dict:17 schema_fpath = os.path.join(_SCHEMAS_DIR, "index", f"{schema}.json")18 return _get_schema(schema_fpath)19__all__ = [20 "get_machine_schema",21 "get_runtime_schema",22 "get_index_schema"...

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run pandera automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful