repository_name
stringlengths
5
67
func_path_in_repository
stringlengths
4
234
func_name
stringlengths
0
314
whole_func_string
stringlengths
52
3.87M
language
stringclasses
6 values
func_code_string
stringlengths
52
3.87M
func_documentation_string
stringlengths
1
47.2k
func_code_url
stringlengths
85
339
idlesign/torrentool
torrentool/bencode.py
Bencode.encode
def encode(cls, value): """Encodes a value into bencoded bytes. :param value: Python object to be encoded (str, int, list, dict). :param str val_encoding: Encoding used by strings in a given object. :rtype: bytes """ val_encoding = 'utf-8' def encode_str(v): ...
python
def encode(cls, value): """Encodes a value into bencoded bytes. :param value: Python object to be encoded (str, int, list, dict). :param str val_encoding: Encoding used by strings in a given object. :rtype: bytes """ val_encoding = 'utf-8' def encode_str(v): ...
Encodes a value into bencoded bytes. :param value: Python object to be encoded (str, int, list, dict). :param str val_encoding: Encoding used by strings in a given object. :rtype: bytes
https://github.com/idlesign/torrentool/blob/78c474c2ecddbad2e3287b390ac8a043957f3563/torrentool/bencode.py#L27-L81
idlesign/torrentool
torrentool/bencode.py
Bencode.decode
def decode(cls, encoded): """Decodes bencoded data introduced as bytes. Returns decoded structure(s). :param bytes encoded: """ def create_dict(items): # Let's guarantee that dictionaries are sorted. k_v_pair = zip(*[iter(items)] * 2) return ...
python
def decode(cls, encoded): """Decodes bencoded data introduced as bytes. Returns decoded structure(s). :param bytes encoded: """ def create_dict(items): # Let's guarantee that dictionaries are sorted. k_v_pair = zip(*[iter(items)] * 2) return ...
Decodes bencoded data introduced as bytes. Returns decoded structure(s). :param bytes encoded:
https://github.com/idlesign/torrentool/blob/78c474c2ecddbad2e3287b390ac8a043957f3563/torrentool/bencode.py#L84-L177
idlesign/torrentool
torrentool/bencode.py
Bencode.read_string
def read_string(cls, string): """Decodes a given bencoded string or bytestring. Returns decoded structure(s). :param str string: :rtype: list """ if PY3 and not isinstance(string, byte_types): string = string.encode() return cls.decode(string)
python
def read_string(cls, string): """Decodes a given bencoded string or bytestring. Returns decoded structure(s). :param str string: :rtype: list """ if PY3 and not isinstance(string, byte_types): string = string.encode() return cls.decode(string)
Decodes a given bencoded string or bytestring. Returns decoded structure(s). :param str string: :rtype: list
https://github.com/idlesign/torrentool/blob/78c474c2ecddbad2e3287b390ac8a043957f3563/torrentool/bencode.py#L180-L191
idlesign/torrentool
torrentool/bencode.py
Bencode.read_file
def read_file(cls, filepath): """Decodes bencoded data of a given file. Returns decoded structure(s). :param str filepath: :rtype: list """ with open(filepath, mode='rb') as f: contents = f.read() return cls.decode(contents)
python
def read_file(cls, filepath): """Decodes bencoded data of a given file. Returns decoded structure(s). :param str filepath: :rtype: list """ with open(filepath, mode='rb') as f: contents = f.read() return cls.decode(contents)
Decodes bencoded data of a given file. Returns decoded structure(s). :param str filepath: :rtype: list
https://github.com/idlesign/torrentool/blob/78c474c2ecddbad2e3287b390ac8a043957f3563/torrentool/bencode.py#L194-L204
twaldear/flask-csp
flask_csp/csp.py
create_csp_header
def create_csp_header(cspDict): """ create csp header string """ policy = ['%s %s' % (k, v) for k, v in cspDict.items() if v != ''] return '; '.join(policy)
python
def create_csp_header(cspDict): """ create csp header string """ policy = ['%s %s' % (k, v) for k, v in cspDict.items() if v != ''] return '; '.join(policy)
create csp header string
https://github.com/twaldear/flask-csp/blob/0f679af368299e36ee9008861fbd4e764abf4b86/flask_csp/csp.py#L36-L39
twaldear/flask-csp
flask_csp/csp.py
csp_header
def csp_header(csp={}): """ Decorator to include csp header on app.route wrapper """ _csp = csp_default().read() _csp.update(csp) _header = '' if 'report-only' in _csp and _csp['report-only'] is True: _header = 'Content-Security-Policy-Report-Only' else: _header = 'Content-Securit...
python
def csp_header(csp={}): """ Decorator to include csp header on app.route wrapper """ _csp = csp_default().read() _csp.update(csp) _header = '' if 'report-only' in _csp and _csp['report-only'] is True: _header = 'Content-Security-Policy-Report-Only' else: _header = 'Content-Securit...
Decorator to include csp header on app.route wrapper
https://github.com/twaldear/flask-csp/blob/0f679af368299e36ee9008861fbd4e764abf4b86/flask_csp/csp.py#L41-L64
twaldear/flask-csp
flask_csp/csp.py
csp_default.read
def read(self): """ read default csp settings from json file """ with open(self.default_file) as json_file: try: return json.load(json_file) except Exception as e: raise 'empty file'
python
def read(self): """ read default csp settings from json file """ with open(self.default_file) as json_file: try: return json.load(json_file) except Exception as e: raise 'empty file'
read default csp settings from json file
https://github.com/twaldear/flask-csp/blob/0f679af368299e36ee9008861fbd4e764abf4b86/flask_csp/csp.py#L9-L15
twaldear/flask-csp
flask_csp/csp.py
csp_default.update
def update(self,updates={}): """ update csp_default.json with dict if file empty add default-src and create dict """ try: csp = self.read() except: csp = {'default-src':"'self'"} self.write(csp) csp.update(updates) self.write(csp)
python
def update(self,updates={}): """ update csp_default.json with dict if file empty add default-src and create dict """ try: csp = self.read() except: csp = {'default-src':"'self'"} self.write(csp) csp.update(updates) self.write(csp)
update csp_default.json with dict if file empty add default-src and create dict
https://github.com/twaldear/flask-csp/blob/0f679af368299e36ee9008861fbd4e764abf4b86/flask_csp/csp.py#L17-L29
pinax/pinax-images
pinax/images/views.py
ImageSetUploadView.get_image_set
def get_image_set(self): """ Obtain existing ImageSet if `pk` is specified, otherwise create a new ImageSet for the user. """ image_set_pk = self.kwargs.get("pk", None) if image_set_pk is None: return self.request.user.image_sets.create() return get_ob...
python
def get_image_set(self): """ Obtain existing ImageSet if `pk` is specified, otherwise create a new ImageSet for the user. """ image_set_pk = self.kwargs.get("pk", None) if image_set_pk is None: return self.request.user.image_sets.create() return get_ob...
Obtain existing ImageSet if `pk` is specified, otherwise create a new ImageSet for the user.
https://github.com/pinax/pinax-images/blob/7c7212f8dd741b7374c787a99adcf6d852b783da/pinax/images/views.py#L22-L30
opentracing-contrib/python-tornado
tornado_opentracing/application.py
tracer_config
def tracer_config(__init__, app, args, kwargs): """ Wraps the Tornado web application initialization so that the TornadoTracing instance is created around an OpenTracing-compatible tracer. """ __init__(*args, **kwargs) tracing = app.settings.get('opentracing_tracing') tracer_callable = app....
python
def tracer_config(__init__, app, args, kwargs): """ Wraps the Tornado web application initialization so that the TornadoTracing instance is created around an OpenTracing-compatible tracer. """ __init__(*args, **kwargs) tracing = app.settings.get('opentracing_tracing') tracer_callable = app....
Wraps the Tornado web application initialization so that the TornadoTracing instance is created around an OpenTracing-compatible tracer.
https://github.com/opentracing-contrib/python-tornado/blob/2c87f423c316805c6140d7f0613c800dd05b47dc/tornado_opentracing/application.py#L31-L64
opentracing-contrib/python-tornado
tornado_opentracing/tracing.py
TornadoTracing.trace
def trace(self, *attributes): """ Function decorator that traces functions NOTE: Must be placed before the Tornado decorators @param attributes any number of request attributes (strings) to be set as tags on the created span """ @wrapt.decorator def wrapp...
python
def trace(self, *attributes): """ Function decorator that traces functions NOTE: Must be placed before the Tornado decorators @param attributes any number of request attributes (strings) to be set as tags on the created span """ @wrapt.decorator def wrapp...
Function decorator that traces functions NOTE: Must be placed before the Tornado decorators @param attributes any number of request attributes (strings) to be set as tags on the created span
https://github.com/opentracing-contrib/python-tornado/blob/2c87f423c316805c6140d7f0613c800dd05b47dc/tornado_opentracing/tracing.py#L61-L99
opentracing-contrib/python-tornado
tornado_opentracing/tracing.py
TornadoTracing._apply_tracing
def _apply_tracing(self, handler, attributes): """ Helper function to avoid rewriting for middleware and decorator. Returns a new span from the request with logged attributes and correct operation name from the func. """ operation_name = self._get_operation_name(handler) ...
python
def _apply_tracing(self, handler, attributes): """ Helper function to avoid rewriting for middleware and decorator. Returns a new span from the request with logged attributes and correct operation name from the func. """ operation_name = self._get_operation_name(handler) ...
Helper function to avoid rewriting for middleware and decorator. Returns a new span from the request with logged attributes and correct operation name from the func.
https://github.com/opentracing-contrib/python-tornado/blob/2c87f423c316805c6140d7f0613c800dd05b47dc/tornado_opentracing/tracing.py#L109-L147
opentracing-contrib/python-tornado
tornado_opentracing/handlers.py
execute
def execute(func, handler, args, kwargs): """ Wrap the handler ``_execute`` method to trace incoming requests, extracting the context from the headers, if available. """ tracing = handler.settings.get('opentracing_tracing') with tracer_stack_context(): if tracing._trace_all: ...
python
def execute(func, handler, args, kwargs): """ Wrap the handler ``_execute`` method to trace incoming requests, extracting the context from the headers, if available. """ tracing = handler.settings.get('opentracing_tracing') with tracer_stack_context(): if tracing._trace_all: ...
Wrap the handler ``_execute`` method to trace incoming requests, extracting the context from the headers, if available.
https://github.com/opentracing-contrib/python-tornado/blob/2c87f423c316805c6140d7f0613c800dd05b47dc/tornado_opentracing/handlers.py#L20-L32
opentracing-contrib/python-tornado
tornado_opentracing/handlers.py
on_finish
def on_finish(func, handler, args, kwargs): """ Wrap the handler ``on_finish`` method to finish the Span for the given request, if available. """ tracing = handler.settings.get('opentracing_tracing') tracing._finish_tracing(handler) return func(*args, **kwargs)
python
def on_finish(func, handler, args, kwargs): """ Wrap the handler ``on_finish`` method to finish the Span for the given request, if available. """ tracing = handler.settings.get('opentracing_tracing') tracing._finish_tracing(handler) return func(*args, **kwargs)
Wrap the handler ``on_finish`` method to finish the Span for the given request, if available.
https://github.com/opentracing-contrib/python-tornado/blob/2c87f423c316805c6140d7f0613c800dd05b47dc/tornado_opentracing/handlers.py#L35-L43
opentracing-contrib/python-tornado
tornado_opentracing/handlers.py
log_exception
def log_exception(func, handler, args, kwargs): """ Wrap the handler ``log_exception`` method to finish the Span for the given request, if available. This method is called when an Exception is not handled in the user code. """ # safe-guard: expected arguments -> log_exception(self, typ, value, t...
python
def log_exception(func, handler, args, kwargs): """ Wrap the handler ``log_exception`` method to finish the Span for the given request, if available. This method is called when an Exception is not handled in the user code. """ # safe-guard: expected arguments -> log_exception(self, typ, value, t...
Wrap the handler ``log_exception`` method to finish the Span for the given request, if available. This method is called when an Exception is not handled in the user code.
https://github.com/opentracing-contrib/python-tornado/blob/2c87f423c316805c6140d7f0613c800dd05b47dc/tornado_opentracing/handlers.py#L46-L61
CZ-NIC/yangson
yangson/schemanode.py
SchemaNode.schema_root
def schema_root(self) -> "SchemaTreeNode": """Return the root node of the receiver's schema.""" sn = self while sn.parent: sn = sn.parent return sn
python
def schema_root(self) -> "SchemaTreeNode": """Return the root node of the receiver's schema.""" sn = self while sn.parent: sn = sn.parent return sn
Return the root node of the receiver's schema.
https://github.com/CZ-NIC/yangson/blob/a4b9464041fa8b28f6020a420ababf18fddf5d4a/yangson/schemanode.py#L113-L118
CZ-NIC/yangson
yangson/schemanode.py
SchemaNode.content_type
def content_type(self) -> ContentType: """Return receiver's content type.""" return self._ctype if self._ctype else self.parent.content_type()
python
def content_type(self) -> ContentType: """Return receiver's content type.""" return self._ctype if self._ctype else self.parent.content_type()
Return receiver's content type.
https://github.com/CZ-NIC/yangson/blob/a4b9464041fa8b28f6020a420ababf18fddf5d4a/yangson/schemanode.py#L120-L122
CZ-NIC/yangson
yangson/schemanode.py
SchemaNode.data_parent
def data_parent(self) -> Optional["InternalNode"]: """Return the closest ancestor data node.""" parent = self.parent while parent: if isinstance(parent, DataNode): return parent parent = parent.parent
python
def data_parent(self) -> Optional["InternalNode"]: """Return the closest ancestor data node.""" parent = self.parent while parent: if isinstance(parent, DataNode): return parent parent = parent.parent
Return the closest ancestor data node.
https://github.com/CZ-NIC/yangson/blob/a4b9464041fa8b28f6020a420ababf18fddf5d4a/yangson/schemanode.py#L124-L130
CZ-NIC/yangson
yangson/schemanode.py
SchemaNode.iname
def iname(self) -> InstanceName: """Return the instance name corresponding to the receiver.""" dp = self.data_parent() return (self.name if dp and self.ns == dp.ns else self.ns + ":" + self.name)
python
def iname(self) -> InstanceName: """Return the instance name corresponding to the receiver.""" dp = self.data_parent() return (self.name if dp and self.ns == dp.ns else self.ns + ":" + self.name)
Return the instance name corresponding to the receiver.
https://github.com/CZ-NIC/yangson/blob/a4b9464041fa8b28f6020a420ababf18fddf5d4a/yangson/schemanode.py#L132-L136
CZ-NIC/yangson
yangson/schemanode.py
SchemaNode.data_path
def data_path(self) -> DataPath: """Return the receiver's data path.""" dp = self.data_parent() return (dp.data_path() if dp else "") + "/" + self.iname()
python
def data_path(self) -> DataPath: """Return the receiver's data path.""" dp = self.data_parent() return (dp.data_path() if dp else "") + "/" + self.iname()
Return the receiver's data path.
https://github.com/CZ-NIC/yangson/blob/a4b9464041fa8b28f6020a420ababf18fddf5d4a/yangson/schemanode.py#L138-L141
CZ-NIC/yangson
yangson/schemanode.py
SchemaNode._node_digest
def _node_digest(self) -> Dict[str, Any]: """Return dictionary of receiver's properties suitable for clients.""" res = {"kind": self._yang_class()} if self.mandatory: res["mandatory"] = True if self.description: res["description"] = self.description return...
python
def _node_digest(self) -> Dict[str, Any]: """Return dictionary of receiver's properties suitable for clients.""" res = {"kind": self._yang_class()} if self.mandatory: res["mandatory"] = True if self.description: res["description"] = self.description return...
Return dictionary of receiver's properties suitable for clients.
https://github.com/CZ-NIC/yangson/blob/a4b9464041fa8b28f6020a420ababf18fddf5d4a/yangson/schemanode.py#L173-L180
CZ-NIC/yangson
yangson/schemanode.py
SchemaNode._iname2qname
def _iname2qname(self, iname: InstanceName) -> QualName: """Translate instance name to qualified name in the receiver's context. """ p, s, loc = iname.partition(":") return (loc, p) if s else (p, self.ns)
python
def _iname2qname(self, iname: InstanceName) -> QualName: """Translate instance name to qualified name in the receiver's context. """ p, s, loc = iname.partition(":") return (loc, p) if s else (p, self.ns)
Translate instance name to qualified name in the receiver's context.
https://github.com/CZ-NIC/yangson/blob/a4b9464041fa8b28f6020a420ababf18fddf5d4a/yangson/schemanode.py#L201-L205
CZ-NIC/yangson
yangson/schemanode.py
SchemaNode._handle_substatements
def _handle_substatements(self, stmt: Statement, sctx: SchemaContext) -> None: """Dispatch actions for substatements of `stmt`.""" for s in stmt.substatements: if s.prefix: key = ( sctx.schema_data.modules[sctx.text_mid].prefix_map[s.prefix][0] ...
python
def _handle_substatements(self, stmt: Statement, sctx: SchemaContext) -> None: """Dispatch actions for substatements of `stmt`.""" for s in stmt.substatements: if s.prefix: key = ( sctx.schema_data.modules[sctx.text_mid].prefix_map[s.prefix][0] ...
Dispatch actions for substatements of `stmt`.
https://github.com/CZ-NIC/yangson/blob/a4b9464041fa8b28f6020a420ababf18fddf5d4a/yangson/schemanode.py#L210-L221
CZ-NIC/yangson
yangson/schemanode.py
SchemaNode._follow_leafref
def _follow_leafref( self, xpath: "Expr", init: "TerminalNode") -> Optional["DataNode"]: """Return the data node referred to by a leafref path. Args: xpath: XPath expression compiled from a leafref path. init: initial context node """ if isinstance(xp...
python
def _follow_leafref( self, xpath: "Expr", init: "TerminalNode") -> Optional["DataNode"]: """Return the data node referred to by a leafref path. Args: xpath: XPath expression compiled from a leafref path. init: initial context node """ if isinstance(xp...
Return the data node referred to by a leafref path. Args: xpath: XPath expression compiled from a leafref path. init: initial context node
https://github.com/CZ-NIC/yangson/blob/a4b9464041fa8b28f6020a420ababf18fddf5d4a/yangson/schemanode.py#L223-L246
CZ-NIC/yangson
yangson/schemanode.py
SchemaNode._tree_line
def _tree_line(self, no_type: bool = False) -> str: """Return the receiver's contribution to tree diagram.""" return self._tree_line_prefix() + " " + self.iname()
python
def _tree_line(self, no_type: bool = False) -> str: """Return the receiver's contribution to tree diagram.""" return self._tree_line_prefix() + " " + self.iname()
Return the receiver's contribution to tree diagram.
https://github.com/CZ-NIC/yangson/blob/a4b9464041fa8b28f6020a420ababf18fddf5d4a/yangson/schemanode.py#L287-L289
CZ-NIC/yangson
yangson/schemanode.py
SchemaNode._nacm_default_deny_stmt
def _nacm_default_deny_stmt(self, stmt: Statement, sctx: SchemaContext) -> None: """Set NACM default access.""" if not hasattr(self, 'default_deny'): return if stmt.keyword == "default-deny-all": self.default_deny = DefaultDeny.all elif stmt.keyword == "default-de...
python
def _nacm_default_deny_stmt(self, stmt: Statement, sctx: SchemaContext) -> None: """Set NACM default access.""" if not hasattr(self, 'default_deny'): return if stmt.keyword == "default-deny-all": self.default_deny = DefaultDeny.all elif stmt.keyword == "default-de...
Set NACM default access.
https://github.com/CZ-NIC/yangson/blob/a4b9464041fa8b28f6020a420ababf18fddf5d4a/yangson/schemanode.py#L294-L301
CZ-NIC/yangson
yangson/schemanode.py
InternalNode.get_child
def get_child(self, name: YangIdentifier, ns: YangIdentifier = None) -> Optional[SchemaNode]: """Return receiver's schema child. Args: name: Child's name. ns: Child's namespace (= `self.ns` if absent). """ ns = ns if ns else self.ns todo...
python
def get_child(self, name: YangIdentifier, ns: YangIdentifier = None) -> Optional[SchemaNode]: """Return receiver's schema child. Args: name: Child's name. ns: Child's namespace (= `self.ns` if absent). """ ns = ns if ns else self.ns todo...
Return receiver's schema child. Args: name: Child's name. ns: Child's namespace (= `self.ns` if absent).
https://github.com/CZ-NIC/yangson/blob/a4b9464041fa8b28f6020a420ababf18fddf5d4a/yangson/schemanode.py#L351-L369
CZ-NIC/yangson
yangson/schemanode.py
InternalNode.get_schema_descendant
def get_schema_descendant( self, route: SchemaRoute) -> Optional[SchemaNode]: """Return descendant schema node or ``None`` if not found. Args: route: Schema route to the descendant node (relative to the receiver). """ node = self for p ...
python
def get_schema_descendant( self, route: SchemaRoute) -> Optional[SchemaNode]: """Return descendant schema node or ``None`` if not found. Args: route: Schema route to the descendant node (relative to the receiver). """ node = self for p ...
Return descendant schema node or ``None`` if not found. Args: route: Schema route to the descendant node (relative to the receiver).
https://github.com/CZ-NIC/yangson/blob/a4b9464041fa8b28f6020a420ababf18fddf5d4a/yangson/schemanode.py#L371-L384
CZ-NIC/yangson
yangson/schemanode.py
InternalNode.get_data_child
def get_data_child(self, name: YangIdentifier, ns: YangIdentifier = None) -> Optional["DataNode"]: """Return data node directly under the receiver.""" ns = ns if ns else self.ns todo = [] for child in self.children: if child.name == name and child.ns ==...
python
def get_data_child(self, name: YangIdentifier, ns: YangIdentifier = None) -> Optional["DataNode"]: """Return data node directly under the receiver.""" ns = ns if ns else self.ns todo = [] for child in self.children: if child.name == name and child.ns ==...
Return data node directly under the receiver.
https://github.com/CZ-NIC/yangson/blob/a4b9464041fa8b28f6020a420ababf18fddf5d4a/yangson/schemanode.py#L386-L401
CZ-NIC/yangson
yangson/schemanode.py
InternalNode.filter_children
def filter_children(self, ctype: ContentType = None) -> List[SchemaNode]: """Return receiver's children based on content type. Args: ctype: Content type. """ if ctype is None: ctype = self.content_type() return [c for c in self.children if ...
python
def filter_children(self, ctype: ContentType = None) -> List[SchemaNode]: """Return receiver's children based on content type. Args: ctype: Content type. """ if ctype is None: ctype = self.content_type() return [c for c in self.children if ...
Return receiver's children based on content type. Args: ctype: Content type.
https://github.com/CZ-NIC/yangson/blob/a4b9464041fa8b28f6020a420ababf18fddf5d4a/yangson/schemanode.py#L403-L413
CZ-NIC/yangson
yangson/schemanode.py
InternalNode.data_children
def data_children(self) -> List["DataNode"]: """Return the set of all data nodes directly under the receiver.""" res = [] for child in self.children: if isinstance(child, DataNode): res.append(child) elif not isinstance(child, SchemaTreeNode): ...
python
def data_children(self) -> List["DataNode"]: """Return the set of all data nodes directly under the receiver.""" res = [] for child in self.children: if isinstance(child, DataNode): res.append(child) elif not isinstance(child, SchemaTreeNode): ...
Return the set of all data nodes directly under the receiver.
https://github.com/CZ-NIC/yangson/blob/a4b9464041fa8b28f6020a420ababf18fddf5d4a/yangson/schemanode.py#L415-L423
CZ-NIC/yangson
yangson/schemanode.py
InternalNode.from_raw
def from_raw(self, rval: RawObject, jptr: JSONPointer = "") -> ObjectValue: """Override the superclass method.""" if not isinstance(rval, dict): raise RawTypeError(jptr, "object") res = ObjectValue() for qn in rval: if qn.startswith("@"): if qn != ...
python
def from_raw(self, rval: RawObject, jptr: JSONPointer = "") -> ObjectValue: """Override the superclass method.""" if not isinstance(rval, dict): raise RawTypeError(jptr, "object") res = ObjectValue() for qn in rval: if qn.startswith("@"): if qn != ...
Override the superclass method.
https://github.com/CZ-NIC/yangson/blob/a4b9464041fa8b28f6020a420ababf18fddf5d4a/yangson/schemanode.py#L425-L445
CZ-NIC/yangson
yangson/schemanode.py
InternalNode._validate
def _validate(self, inst: "InstanceNode", scope: ValidationScope, ctype: ContentType) -> None: """Extend the superclass method.""" if scope.value & ValidationScope.syntax.value: # schema self._check_schema_pattern(inst, ctype) for m in inst: inst._memb...
python
def _validate(self, inst: "InstanceNode", scope: ValidationScope, ctype: ContentType) -> None: """Extend the superclass method.""" if scope.value & ValidationScope.syntax.value: # schema self._check_schema_pattern(inst, ctype) for m in inst: inst._memb...
Extend the superclass method.
https://github.com/CZ-NIC/yangson/blob/a4b9464041fa8b28f6020a420ababf18fddf5d4a/yangson/schemanode.py#L471-L478
CZ-NIC/yangson
yangson/schemanode.py
InternalNode._child_inst_names
def _child_inst_names(self) -> Set[InstanceName]: """Return the set of instance names under the receiver.""" return frozenset([c.iname() for c in self.data_children()])
python
def _child_inst_names(self) -> Set[InstanceName]: """Return the set of instance names under the receiver.""" return frozenset([c.iname() for c in self.data_children()])
Return the set of instance names under the receiver.
https://github.com/CZ-NIC/yangson/blob/a4b9464041fa8b28f6020a420ababf18fddf5d4a/yangson/schemanode.py#L484-L486
CZ-NIC/yangson
yangson/schemanode.py
InternalNode._make_schema_patterns
def _make_schema_patterns(self) -> None: """Build schema pattern for the receiver and its data descendants.""" self.schema_pattern = self._schema_pattern() for dc in self.data_children(): if isinstance(dc, InternalNode): dc._make_schema_patterns()
python
def _make_schema_patterns(self) -> None: """Build schema pattern for the receiver and its data descendants.""" self.schema_pattern = self._schema_pattern() for dc in self.data_children(): if isinstance(dc, InternalNode): dc._make_schema_patterns()
Build schema pattern for the receiver and its data descendants.
https://github.com/CZ-NIC/yangson/blob/a4b9464041fa8b28f6020a420ababf18fddf5d4a/yangson/schemanode.py#L506-L511
CZ-NIC/yangson
yangson/schemanode.py
InternalNode._handle_child
def _handle_child( self, node: SchemaNode, stmt: Statement, sctx: SchemaContext) -> None: """Add child node to the receiver and handle substatements.""" if not sctx.schema_data.if_features(stmt, sctx.text_mid): return node.name = stmt.argument node.ns = sctx.defau...
python
def _handle_child( self, node: SchemaNode, stmt: Statement, sctx: SchemaContext) -> None: """Add child node to the receiver and handle substatements.""" if not sctx.schema_data.if_features(stmt, sctx.text_mid): return node.name = stmt.argument node.ns = sctx.defau...
Add child node to the receiver and handle substatements.
https://github.com/CZ-NIC/yangson/blob/a4b9464041fa8b28f6020a420ababf18fddf5d4a/yangson/schemanode.py#L549-L558
CZ-NIC/yangson
yangson/schemanode.py
InternalNode._augment_stmt
def _augment_stmt(self, stmt: Statement, sctx: SchemaContext) -> None: """Handle **augment** statement.""" if not sctx.schema_data.if_features(stmt, sctx.text_mid): return path = sctx.schema_data.sni2route(stmt.argument, sctx) target = self.get_schema_descendant(path) ...
python
def _augment_stmt(self, stmt: Statement, sctx: SchemaContext) -> None: """Handle **augment** statement.""" if not sctx.schema_data.if_features(stmt, sctx.text_mid): return path = sctx.schema_data.sni2route(stmt.argument, sctx) target = self.get_schema_descendant(path) ...
Handle **augment** statement.
https://github.com/CZ-NIC/yangson/blob/a4b9464041fa8b28f6020a420ababf18fddf5d4a/yangson/schemanode.py#L560-L570
CZ-NIC/yangson
yangson/schemanode.py
InternalNode._refine_stmt
def _refine_stmt(self, stmt: Statement, sctx: SchemaContext) -> None: """Handle **refine** statement.""" target = self.get_schema_descendant( sctx.schema_data.sni2route(stmt.argument, sctx)) if not sctx.schema_data.if_features(stmt, sctx.text_mid): target.parent.children....
python
def _refine_stmt(self, stmt: Statement, sctx: SchemaContext) -> None: """Handle **refine** statement.""" target = self.get_schema_descendant( sctx.schema_data.sni2route(stmt.argument, sctx)) if not sctx.schema_data.if_features(stmt, sctx.text_mid): target.parent.children....
Handle **refine** statement.
https://github.com/CZ-NIC/yangson/blob/a4b9464041fa8b28f6020a420ababf18fddf5d4a/yangson/schemanode.py#L572-L579
CZ-NIC/yangson
yangson/schemanode.py
InternalNode._uses_stmt
def _uses_stmt(self, stmt: Statement, sctx: SchemaContext) -> None: """Handle uses statement.""" if not sctx.schema_data.if_features(stmt, sctx.text_mid): return grp, gid = sctx.schema_data.get_definition(stmt, sctx) if stmt.find1("when"): sn = GroupNode() ...
python
def _uses_stmt(self, stmt: Statement, sctx: SchemaContext) -> None: """Handle uses statement.""" if not sctx.schema_data.if_features(stmt, sctx.text_mid): return grp, gid = sctx.schema_data.get_definition(stmt, sctx) if stmt.find1("when"): sn = GroupNode() ...
Handle uses statement.
https://github.com/CZ-NIC/yangson/blob/a4b9464041fa8b28f6020a420ababf18fddf5d4a/yangson/schemanode.py#L581-L595
CZ-NIC/yangson
yangson/schemanode.py
InternalNode._container_stmt
def _container_stmt(self, stmt: Statement, sctx: SchemaContext) -> None: """Handle container statement.""" self._handle_child(ContainerNode(), stmt, sctx)
python
def _container_stmt(self, stmt: Statement, sctx: SchemaContext) -> None: """Handle container statement.""" self._handle_child(ContainerNode(), stmt, sctx)
Handle container statement.
https://github.com/CZ-NIC/yangson/blob/a4b9464041fa8b28f6020a420ababf18fddf5d4a/yangson/schemanode.py#L597-L599
CZ-NIC/yangson
yangson/schemanode.py
InternalNode._identity_stmt
def _identity_stmt(self, stmt: Statement, sctx: SchemaContext) -> None: """Handle identity statement.""" if not sctx.schema_data.if_features(stmt, sctx.text_mid): return id = (stmt.argument, sctx.schema_data.namespace(sctx.text_mid)) adj = sctx.schema_data.identity_adjs.setde...
python
def _identity_stmt(self, stmt: Statement, sctx: SchemaContext) -> None: """Handle identity statement.""" if not sctx.schema_data.if_features(stmt, sctx.text_mid): return id = (stmt.argument, sctx.schema_data.namespace(sctx.text_mid)) adj = sctx.schema_data.identity_adjs.setde...
Handle identity statement.
https://github.com/CZ-NIC/yangson/blob/a4b9464041fa8b28f6020a420ababf18fddf5d4a/yangson/schemanode.py#L601-L613
CZ-NIC/yangson
yangson/schemanode.py
InternalNode._list_stmt
def _list_stmt(self, stmt: Statement, sctx: SchemaContext) -> None: """Handle list statement.""" self._handle_child(ListNode(), stmt, sctx)
python
def _list_stmt(self, stmt: Statement, sctx: SchemaContext) -> None: """Handle list statement.""" self._handle_child(ListNode(), stmt, sctx)
Handle list statement.
https://github.com/CZ-NIC/yangson/blob/a4b9464041fa8b28f6020a420ababf18fddf5d4a/yangson/schemanode.py#L615-L617
CZ-NIC/yangson
yangson/schemanode.py
InternalNode._choice_stmt
def _choice_stmt(self, stmt: Statement, sctx: SchemaContext) -> None: """Handle choice statement.""" self._handle_child(ChoiceNode(), stmt, sctx)
python
def _choice_stmt(self, stmt: Statement, sctx: SchemaContext) -> None: """Handle choice statement.""" self._handle_child(ChoiceNode(), stmt, sctx)
Handle choice statement.
https://github.com/CZ-NIC/yangson/blob/a4b9464041fa8b28f6020a420ababf18fddf5d4a/yangson/schemanode.py#L619-L621
CZ-NIC/yangson
yangson/schemanode.py
InternalNode._case_stmt
def _case_stmt(self, stmt: Statement, sctx: SchemaContext) -> None: """Handle case statement.""" self._handle_child(CaseNode(), stmt, sctx)
python
def _case_stmt(self, stmt: Statement, sctx: SchemaContext) -> None: """Handle case statement.""" self._handle_child(CaseNode(), stmt, sctx)
Handle case statement.
https://github.com/CZ-NIC/yangson/blob/a4b9464041fa8b28f6020a420ababf18fddf5d4a/yangson/schemanode.py#L623-L625
CZ-NIC/yangson
yangson/schemanode.py
InternalNode._leaf_stmt
def _leaf_stmt(self, stmt: Statement, sctx: SchemaContext) -> None: """Handle leaf statement.""" node = LeafNode() node.type = DataType._resolve_type( stmt.find1("type", required=True), sctx) self._handle_child(node, stmt, sctx)
python
def _leaf_stmt(self, stmt: Statement, sctx: SchemaContext) -> None: """Handle leaf statement.""" node = LeafNode() node.type = DataType._resolve_type( stmt.find1("type", required=True), sctx) self._handle_child(node, stmt, sctx)
Handle leaf statement.
https://github.com/CZ-NIC/yangson/blob/a4b9464041fa8b28f6020a420ababf18fddf5d4a/yangson/schemanode.py#L627-L632
CZ-NIC/yangson
yangson/schemanode.py
InternalNode._leaf_list_stmt
def _leaf_list_stmt(self, stmt: Statement, sctx: SchemaContext) -> None: """Handle leaf-list statement.""" node = LeafListNode() node.type = DataType._resolve_type( stmt.find1("type", required=True), sctx) self._handle_child(node, stmt, sctx)
python
def _leaf_list_stmt(self, stmt: Statement, sctx: SchemaContext) -> None: """Handle leaf-list statement.""" node = LeafListNode() node.type = DataType._resolve_type( stmt.find1("type", required=True), sctx) self._handle_child(node, stmt, sctx)
Handle leaf-list statement.
https://github.com/CZ-NIC/yangson/blob/a4b9464041fa8b28f6020a420ababf18fddf5d4a/yangson/schemanode.py#L634-L639
CZ-NIC/yangson
yangson/schemanode.py
InternalNode._rpc_action_stmt
def _rpc_action_stmt(self, stmt: Statement, sctx: SchemaContext) -> None: """Handle rpc or action statement.""" self._handle_child(RpcActionNode(), stmt, sctx)
python
def _rpc_action_stmt(self, stmt: Statement, sctx: SchemaContext) -> None: """Handle rpc or action statement.""" self._handle_child(RpcActionNode(), stmt, sctx)
Handle rpc or action statement.
https://github.com/CZ-NIC/yangson/blob/a4b9464041fa8b28f6020a420ababf18fddf5d4a/yangson/schemanode.py#L641-L643
CZ-NIC/yangson
yangson/schemanode.py
InternalNode._notification_stmt
def _notification_stmt(self, stmt: Statement, sctx: SchemaContext) -> None: """Handle notification statement.""" self._handle_child(NotificationNode(), stmt, sctx)
python
def _notification_stmt(self, stmt: Statement, sctx: SchemaContext) -> None: """Handle notification statement.""" self._handle_child(NotificationNode(), stmt, sctx)
Handle notification statement.
https://github.com/CZ-NIC/yangson/blob/a4b9464041fa8b28f6020a420ababf18fddf5d4a/yangson/schemanode.py#L645-L647
CZ-NIC/yangson
yangson/schemanode.py
InternalNode._anydata_stmt
def _anydata_stmt(self, stmt: Statement, sctx: SchemaContext) -> None: """Handle anydata statement.""" self._handle_child(AnydataNode(), stmt, sctx)
python
def _anydata_stmt(self, stmt: Statement, sctx: SchemaContext) -> None: """Handle anydata statement.""" self._handle_child(AnydataNode(), stmt, sctx)
Handle anydata statement.
https://github.com/CZ-NIC/yangson/blob/a4b9464041fa8b28f6020a420ababf18fddf5d4a/yangson/schemanode.py#L649-L651
CZ-NIC/yangson
yangson/schemanode.py
InternalNode._ascii_tree
def _ascii_tree(self, indent: str, no_types: bool, val_count: bool) -> str: """Return the receiver's subtree as ASCII art.""" def suffix(sn): return f" {{{sn.val_count}}}\n" if val_count else "\n" if not self.children: return "" cs = [] for c in self.child...
python
def _ascii_tree(self, indent: str, no_types: bool, val_count: bool) -> str: """Return the receiver's subtree as ASCII art.""" def suffix(sn): return f" {{{sn.val_count}}}\n" if val_count else "\n" if not self.children: return "" cs = [] for c in self.child...
Return the receiver's subtree as ASCII art.
https://github.com/CZ-NIC/yangson/blob/a4b9464041fa8b28f6020a420ababf18fddf5d4a/yangson/schemanode.py#L653-L668
CZ-NIC/yangson
yangson/schemanode.py
SchemaTreeNode._annotation_stmt
def _annotation_stmt(self, stmt: Statement, sctx: SchemaContext) -> None: """Handle annotation statement.""" if not sctx.schema_data.if_features(stmt, sctx.text_mid): return dst = stmt.find1("description") self.annotations[(stmt.argument, sctx.default_ns)] = Annotation( ...
python
def _annotation_stmt(self, stmt: Statement, sctx: SchemaContext) -> None: """Handle annotation statement.""" if not sctx.schema_data.if_features(stmt, sctx.text_mid): return dst = stmt.find1("description") self.annotations[(stmt.argument, sctx.default_ns)] = Annotation( ...
Handle annotation statement.
https://github.com/CZ-NIC/yangson/blob/a4b9464041fa8b28f6020a420ababf18fddf5d4a/yangson/schemanode.py#L713-L720
CZ-NIC/yangson
yangson/schemanode.py
DataNode.orphan_instance
def orphan_instance(self, rval: RawValue) -> "ObjectMember": """Return an isolated instance of the receiver. Args: rval: Raw value to be used for the returned instance. """ val = self.from_raw(rval) return ObjectMember(self.iname(), {}, val, None, self, datetime.now(...
python
def orphan_instance(self, rval: RawValue) -> "ObjectMember": """Return an isolated instance of the receiver. Args: rval: Raw value to be used for the returned instance. """ val = self.from_raw(rval) return ObjectMember(self.iname(), {}, val, None, self, datetime.now(...
Return an isolated instance of the receiver. Args: rval: Raw value to be used for the returned instance.
https://github.com/CZ-NIC/yangson/blob/a4b9464041fa8b28f6020a420ababf18fddf5d4a/yangson/schemanode.py#L731-L738
CZ-NIC/yangson
yangson/schemanode.py
DataNode.split_instance_route
def split_instance_route(self, route: "InstanceRoute") -> Optional[Tuple[ "InstanceRoute", "InstanceRoute"]]: """Split `route` into the part up to receiver and the rest. Args: route: Absolute instance route (the receiver should correspond to an instance node on t...
python
def split_instance_route(self, route: "InstanceRoute") -> Optional[Tuple[ "InstanceRoute", "InstanceRoute"]]: """Split `route` into the part up to receiver and the rest. Args: route: Absolute instance route (the receiver should correspond to an instance node on t...
Split `route` into the part up to receiver and the rest. Args: route: Absolute instance route (the receiver should correspond to an instance node on this route). Returns: A tuple consisting of - the part of `route` from the root up to and includi...
https://github.com/CZ-NIC/yangson/blob/a4b9464041fa8b28f6020a420ababf18fddf5d4a/yangson/schemanode.py#L740-L774
CZ-NIC/yangson
yangson/schemanode.py
DataNode._validate
def _validate(self, inst: "InstanceNode", scope: ValidationScope, ctype: ContentType) -> None: """Extend the superclass method.""" if scope.value & ValidationScope.semantics.value: self._check_must(inst) # must expressions super()._validate(inst, scope, ctype...
python
def _validate(self, inst: "InstanceNode", scope: ValidationScope, ctype: ContentType) -> None: """Extend the superclass method.""" if scope.value & ValidationScope.semantics.value: self._check_must(inst) # must expressions super()._validate(inst, scope, ctype...
Extend the superclass method.
https://github.com/CZ-NIC/yangson/blob/a4b9464041fa8b28f6020a420ababf18fddf5d4a/yangson/schemanode.py#L776-L781
CZ-NIC/yangson
yangson/schemanode.py
TerminalNode.content_type
def content_type(self) -> ContentType: """Override superclass method.""" if self._ctype: return self._ctype return (ContentType.config if self.parent.config else ContentType.nonconfig)
python
def content_type(self) -> ContentType: """Override superclass method.""" if self._ctype: return self._ctype return (ContentType.config if self.parent.config else ContentType.nonconfig)
Override superclass method.
https://github.com/CZ-NIC/yangson/blob/a4b9464041fa8b28f6020a420ababf18fddf5d4a/yangson/schemanode.py#L819-L824
CZ-NIC/yangson
yangson/schemanode.py
TerminalNode.from_raw
def from_raw(self, rval: RawScalar, jptr: JSONPointer = "") -> ScalarValue: """Override the superclass method.""" res = self.type.from_raw(rval) if res is None: raise RawTypeError(jptr, self.type.yang_type() + " value") return res
python
def from_raw(self, rval: RawScalar, jptr: JSONPointer = "") -> ScalarValue: """Override the superclass method.""" res = self.type.from_raw(rval) if res is None: raise RawTypeError(jptr, self.type.yang_type() + " value") return res
Override the superclass method.
https://github.com/CZ-NIC/yangson/blob/a4b9464041fa8b28f6020a420ababf18fddf5d4a/yangson/schemanode.py#L826-L831
CZ-NIC/yangson
yangson/schemanode.py
TerminalNode._validate
def _validate(self, inst: "InstanceNode", scope: ValidationScope, ctype: ContentType) -> None: """Extend the superclass method.""" if (scope.value & ValidationScope.syntax.value and inst.value not in self.type): raise YangTypeError(inst.json_pointer(), self....
python
def _validate(self, inst: "InstanceNode", scope: ValidationScope, ctype: ContentType) -> None: """Extend the superclass method.""" if (scope.value & ValidationScope.syntax.value and inst.value not in self.type): raise YangTypeError(inst.json_pointer(), self....
Extend the superclass method.
https://github.com/CZ-NIC/yangson/blob/a4b9464041fa8b28f6020a420ababf18fddf5d4a/yangson/schemanode.py#L841-L857
CZ-NIC/yangson
yangson/schemanode.py
ContainerNode._tree_line
def _tree_line(self, no_type: bool = False) -> str: """Return the receiver's contribution to tree diagram.""" return super()._tree_line() + ("!" if self.presence else "")
python
def _tree_line(self, no_type: bool = False) -> str: """Return the receiver's contribution to tree diagram.""" return super()._tree_line() + ("!" if self.presence else "")
Return the receiver's contribution to tree diagram.
https://github.com/CZ-NIC/yangson/blob/a4b9464041fa8b28f6020a420ababf18fddf5d4a/yangson/schemanode.py#L931-L933
CZ-NIC/yangson
yangson/schemanode.py
SequenceNode._validate
def _validate(self, inst: "InstanceNode", scope: ValidationScope, ctype: ContentType) -> None: """Extend the superclass method.""" if isinstance(inst, ArrayEntry): super()._validate(inst, scope, ctype) else: if scope.value & ValidationScope.semantics.val...
python
def _validate(self, inst: "InstanceNode", scope: ValidationScope, ctype: ContentType) -> None: """Extend the superclass method.""" if isinstance(inst, ArrayEntry): super()._validate(inst, scope, ctype) else: if scope.value & ValidationScope.semantics.val...
Extend the superclass method.
https://github.com/CZ-NIC/yangson/blob/a4b9464041fa8b28f6020a420ababf18fddf5d4a/yangson/schemanode.py#L951-L961
CZ-NIC/yangson
yangson/schemanode.py
SequenceNode.from_raw
def from_raw(self, rval: RawList, jptr: JSONPointer = "") -> ArrayValue: """Override the superclass method.""" if not isinstance(rval, list): raise RawTypeError(jptr, "array") res = ArrayValue() i = 0 for en in rval: i += 1 res.append(self.entr...
python
def from_raw(self, rval: RawList, jptr: JSONPointer = "") -> ArrayValue: """Override the superclass method.""" if not isinstance(rval, list): raise RawTypeError(jptr, "array") res = ArrayValue() i = 0 for en in rval: i += 1 res.append(self.entr...
Override the superclass method.
https://github.com/CZ-NIC/yangson/blob/a4b9464041fa8b28f6020a420ababf18fddf5d4a/yangson/schemanode.py#L992-L1001
CZ-NIC/yangson
yangson/schemanode.py
SequenceNode.entry_from_raw
def entry_from_raw(self, rval: RawEntry, jptr: JSONPointer = "") -> EntryValue: """Transform a raw (leaf-)list entry into the cooked form. Args: rval: raw entry (scalar or object) jptr: JSON pointer of the entry Raises: NonexistentSchemaNode: If a member ins...
python
def entry_from_raw(self, rval: RawEntry, jptr: JSONPointer = "") -> EntryValue: """Transform a raw (leaf-)list entry into the cooked form. Args: rval: raw entry (scalar or object) jptr: JSON pointer of the entry Raises: NonexistentSchemaNode: If a member ins...
Transform a raw (leaf-)list entry into the cooked form. Args: rval: raw entry (scalar or object) jptr: JSON pointer of the entry Raises: NonexistentSchemaNode: If a member inside `rval` is not defined in the schema. RawTypeError: If a sca...
https://github.com/CZ-NIC/yangson/blob/a4b9464041fa8b28f6020a420ababf18fddf5d4a/yangson/schemanode.py#L1003-L1015
CZ-NIC/yangson
yangson/schemanode.py
ListNode._check_list_props
def _check_list_props(self, inst: "InstanceNode") -> None: """Check uniqueness of keys and "unique" properties, if applicable.""" if self.keys: self._check_keys(inst) for u in self.unique: self._check_unique(u, inst)
python
def _check_list_props(self, inst: "InstanceNode") -> None: """Check uniqueness of keys and "unique" properties, if applicable.""" if self.keys: self._check_keys(inst) for u in self.unique: self._check_unique(u, inst)
Check uniqueness of keys and "unique" properties, if applicable.
https://github.com/CZ-NIC/yangson/blob/a4b9464041fa8b28f6020a420ababf18fddf5d4a/yangson/schemanode.py#L1033-L1038
CZ-NIC/yangson
yangson/schemanode.py
ListNode._tree_line
def _tree_line(self, no_type: bool = False) -> str: """Return the receiver's contribution to tree diagram.""" keys = (" [" + " ".join([k[0] for k in self.keys]) + "]" if self.keys else "") return super()._tree_line() + keys
python
def _tree_line(self, no_type: bool = False) -> str: """Return the receiver's contribution to tree diagram.""" keys = (" [" + " ".join([k[0] for k in self.keys]) + "]" if self.keys else "") return super()._tree_line() + keys
Return the receiver's contribution to tree diagram.
https://github.com/CZ-NIC/yangson/blob/a4b9464041fa8b28f6020a420ababf18fddf5d4a/yangson/schemanode.py#L1090-L1094
CZ-NIC/yangson
yangson/schemanode.py
ListNode.orphan_entry
def orphan_entry(self, rval: RawObject) -> "ArrayEntry": """Return an isolated entry of the receiver. Args: rval: Raw object to be used for the returned entry. """ val = self.entry_from_raw(rval) return ArrayEntry(0, EmptyList(), EmptyList(), val, None, self, ...
python
def orphan_entry(self, rval: RawObject) -> "ArrayEntry": """Return an isolated entry of the receiver. Args: rval: Raw object to be used for the returned entry. """ val = self.entry_from_raw(rval) return ArrayEntry(0, EmptyList(), EmptyList(), val, None, self, ...
Return an isolated entry of the receiver. Args: rval: Raw object to be used for the returned entry.
https://github.com/CZ-NIC/yangson/blob/a4b9464041fa8b28f6020a420ababf18fddf5d4a/yangson/schemanode.py#L1096-L1104
CZ-NIC/yangson
yangson/schemanode.py
ChoiceNode._active_case
def _active_case(self, value: ObjectValue) -> Optional["CaseNode"]: """Return receiver's case that's active in an instance node value.""" for c in self.children: for cc in c.data_children(): if cc.iname() in value: return c
python
def _active_case(self, value: ObjectValue) -> Optional["CaseNode"]: """Return receiver's case that's active in an instance node value.""" for c in self.children: for cc in c.data_children(): if cc.iname() in value: return c
Return receiver's case that's active in an instance node value.
https://github.com/CZ-NIC/yangson/blob/a4b9464041fa8b28f6020a420ababf18fddf5d4a/yangson/schemanode.py#L1138-L1143
CZ-NIC/yangson
yangson/schemanode.py
LeafListNode.default
def default(self) -> Optional[ScalarValue]: """Default value of the receiver, if any.""" if self.mandatory: return None if self._default is not None: return self._default return (None if self.type.default is None else ArrayValue([self.type.default]...
python
def default(self) -> Optional[ScalarValue]: """Default value of the receiver, if any.""" if self.mandatory: return None if self._default is not None: return self._default return (None if self.type.default is None else ArrayValue([self.type.default]...
Default value of the receiver, if any.
https://github.com/CZ-NIC/yangson/blob/a4b9464041fa8b28f6020a420ababf18fddf5d4a/yangson/schemanode.py#L1246-L1253
CZ-NIC/yangson
yangson/schemanode.py
AnyContentNode.from_raw
def from_raw(self, rval: RawValue, jptr: JSONPointer = "") -> Value: """Override the superclass method.""" def convert(val): if isinstance(val, list): res = ArrayValue([convert(x) for x in val]) elif isinstance(val, dict): res = ObjectValue({x: con...
python
def from_raw(self, rval: RawValue, jptr: JSONPointer = "") -> Value: """Override the superclass method.""" def convert(val): if isinstance(val, list): res = ArrayValue([convert(x) for x in val]) elif isinstance(val, dict): res = ObjectValue({x: con...
Override the superclass method.
https://github.com/CZ-NIC/yangson/blob/a4b9464041fa8b28f6020a420ababf18fddf5d4a/yangson/schemanode.py#L1297-L1307
CZ-NIC/yangson
yangson/schemanode.py
RpcActionNode._input_stmt
def _input_stmt(self, stmt: Statement, sctx: SchemaContext) -> None: """Handle RPC or action input statement.""" self.get_child("input")._handle_substatements(stmt, sctx)
python
def _input_stmt(self, stmt: Statement, sctx: SchemaContext) -> None: """Handle RPC or action input statement.""" self.get_child("input")._handle_substatements(stmt, sctx)
Handle RPC or action input statement.
https://github.com/CZ-NIC/yangson/blob/a4b9464041fa8b28f6020a420ababf18fddf5d4a/yangson/schemanode.py#L1354-L1356
CZ-NIC/yangson
yangson/schemanode.py
RpcActionNode._output_stmt
def _output_stmt(self, stmt: Statement, sctx: SchemaContext) -> None: """Handle RPC or action output statement.""" self.get_child("output")._handle_substatements(stmt, sctx)
python
def _output_stmt(self, stmt: Statement, sctx: SchemaContext) -> None: """Handle RPC or action output statement.""" self.get_child("output")._handle_substatements(stmt, sctx)
Handle RPC or action output statement.
https://github.com/CZ-NIC/yangson/blob/a4b9464041fa8b28f6020a420ababf18fddf5d4a/yangson/schemanode.py#L1358-L1360
CZ-NIC/yangson
yangson/instance.py
LinkedList.from_list
def from_list(cls, vals: List[Value] = [], reverse: bool = False) -> "LinkedList": """Create an instance from a standard list. Args: vals: Python list of instance values. """ res = EmptyList() for v in (vals if reverse else vals[::-1]): res = cls(v, res) ...
python
def from_list(cls, vals: List[Value] = [], reverse: bool = False) -> "LinkedList": """Create an instance from a standard list. Args: vals: Python list of instance values. """ res = EmptyList() for v in (vals if reverse else vals[::-1]): res = cls(v, res) ...
Create an instance from a standard list. Args: vals: Python list of instance values.
https://github.com/CZ-NIC/yangson/blob/a4b9464041fa8b28f6020a420ababf18fddf5d4a/yangson/instance.py#L56-L65
CZ-NIC/yangson
yangson/instance.py
InstanceNode.path
def path(self) -> Tuple[InstanceKey]: """Return the list of keys on the path from root to the receiver.""" res = [] inst: InstanceNode = self while inst.parinst: res.insert(0, inst._key) inst = inst.parinst return tuple(res)
python
def path(self) -> Tuple[InstanceKey]: """Return the list of keys on the path from root to the receiver.""" res = [] inst: InstanceNode = self while inst.parinst: res.insert(0, inst._key) inst = inst.parinst return tuple(res)
Return the list of keys on the path from root to the receiver.
https://github.com/CZ-NIC/yangson/blob/a4b9464041fa8b28f6020a420ababf18fddf5d4a/yangson/instance.py#L151-L158
CZ-NIC/yangson
yangson/instance.py
InstanceNode.put_member
def put_member(self, name: InstanceName, value: Value, raw: bool = False) -> "InstanceNode": """Return receiver's member with a new value. If the member is permitted by the schema but doesn't exist, it is created. Args: name: Instance name of the member. ...
python
def put_member(self, name: InstanceName, value: Value, raw: bool = False) -> "InstanceNode": """Return receiver's member with a new value. If the member is permitted by the schema but doesn't exist, it is created. Args: name: Instance name of the member. ...
Return receiver's member with a new value. If the member is permitted by the schema but doesn't exist, it is created. Args: name: Instance name of the member. value: New value of the member. raw: Flag to be set if `value` is raw. Raises: ...
https://github.com/CZ-NIC/yangson/blob/a4b9464041fa8b28f6020a420ababf18fddf5d4a/yangson/instance.py#L213-L235
CZ-NIC/yangson
yangson/instance.py
InstanceNode.delete_item
def delete_item(self, key: InstanceKey) -> "InstanceNode": """Delete an item (member or entry) from receiver's value. Args: key: Key of the item (instance name or index). Raises: NonexistentInstance: If receiver's value doesn't contain the item. InstanceValu...
python
def delete_item(self, key: InstanceKey) -> "InstanceNode": """Delete an item (member or entry) from receiver's value. Args: key: Key of the item (instance name or index). Raises: NonexistentInstance: If receiver's value doesn't contain the item. InstanceValu...
Delete an item (member or entry) from receiver's value. Args: key: Key of the item (instance name or index). Raises: NonexistentInstance: If receiver's value doesn't contain the item. InstanceValueError: If the receiver's value is a scalar.
https://github.com/CZ-NIC/yangson/blob/a4b9464041fa8b28f6020a420ababf18fddf5d4a/yangson/instance.py#L237-L255
CZ-NIC/yangson
yangson/instance.py
InstanceNode.up
def up(self) -> "InstanceNode": """Return an instance node corresponding to the receiver's parent. Raises: NonexistentInstance: If there is no parent. """ ts = max(self.timestamp, self.parinst.timestamp) return self.parinst._copy(self._zip(), ts)
python
def up(self) -> "InstanceNode": """Return an instance node corresponding to the receiver's parent. Raises: NonexistentInstance: If there is no parent. """ ts = max(self.timestamp, self.parinst.timestamp) return self.parinst._copy(self._zip(), ts)
Return an instance node corresponding to the receiver's parent. Raises: NonexistentInstance: If there is no parent.
https://github.com/CZ-NIC/yangson/blob/a4b9464041fa8b28f6020a420ababf18fddf5d4a/yangson/instance.py#L257-L264
CZ-NIC/yangson
yangson/instance.py
InstanceNode.top
def top(self) -> "InstanceNode": """Return an instance node corresponding to the root of the data tree.""" inst = self while inst.parinst: inst = inst.up() return inst
python
def top(self) -> "InstanceNode": """Return an instance node corresponding to the root of the data tree.""" inst = self while inst.parinst: inst = inst.up() return inst
Return an instance node corresponding to the root of the data tree.
https://github.com/CZ-NIC/yangson/blob/a4b9464041fa8b28f6020a420ababf18fddf5d4a/yangson/instance.py#L266-L271
CZ-NIC/yangson
yangson/instance.py
InstanceNode.update
def update(self, value: Union[RawValue, Value], raw: bool = False) -> "InstanceNode": """Update the receiver's value. Args: value: New value. raw: Flag to be set if `value` is raw. Returns: Copy of the receiver with the updated value. ...
python
def update(self, value: Union[RawValue, Value], raw: bool = False) -> "InstanceNode": """Update the receiver's value. Args: value: New value. raw: Flag to be set if `value` is raw. Returns: Copy of the receiver with the updated value. ...
Update the receiver's value. Args: value: New value. raw: Flag to be set if `value` is raw. Returns: Copy of the receiver with the updated value.
https://github.com/CZ-NIC/yangson/blob/a4b9464041fa8b28f6020a420ababf18fddf5d4a/yangson/instance.py#L273-L286
CZ-NIC/yangson
yangson/instance.py
InstanceNode.goto
def goto(self, iroute: "InstanceRoute") -> "InstanceNode": """Move the focus to an instance inside the receiver's value. Args: iroute: Instance route (relative to the receiver). Returns: The instance node corresponding to the target instance. Raises: ...
python
def goto(self, iroute: "InstanceRoute") -> "InstanceNode": """Move the focus to an instance inside the receiver's value. Args: iroute: Instance route (relative to the receiver). Returns: The instance node corresponding to the target instance. Raises: ...
Move the focus to an instance inside the receiver's value. Args: iroute: Instance route (relative to the receiver). Returns: The instance node corresponding to the target instance. Raises: InstanceValueError: If `iroute` is incompatible with the receiver's ...
https://github.com/CZ-NIC/yangson/blob/a4b9464041fa8b28f6020a420ababf18fddf5d4a/yangson/instance.py#L288-L307
CZ-NIC/yangson
yangson/instance.py
InstanceNode.peek
def peek(self, iroute: "InstanceRoute") -> Optional[Value]: """Return a value within the receiver's subtree. Args: iroute: Instance route (relative to the receiver). """ val = self.value sn = self.schema_node for sel in iroute: val, sn = sel.peek_...
python
def peek(self, iroute: "InstanceRoute") -> Optional[Value]: """Return a value within the receiver's subtree. Args: iroute: Instance route (relative to the receiver). """ val = self.value sn = self.schema_node for sel in iroute: val, sn = sel.peek_...
Return a value within the receiver's subtree. Args: iroute: Instance route (relative to the receiver).
https://github.com/CZ-NIC/yangson/blob/a4b9464041fa8b28f6020a420ababf18fddf5d4a/yangson/instance.py#L309-L321
CZ-NIC/yangson
yangson/instance.py
InstanceNode.validate
def validate(self, scope: ValidationScope = ValidationScope.all, ctype: ContentType = ContentType.config) -> None: """Validate the receiver's value. Args: scope: Scope of the validation (syntax, semantics or all). ctype: Receiver's content type. Raises:...
python
def validate(self, scope: ValidationScope = ValidationScope.all, ctype: ContentType = ContentType.config) -> None: """Validate the receiver's value. Args: scope: Scope of the validation (syntax, semantics or all). ctype: Receiver's content type. Raises:...
Validate the receiver's value. Args: scope: Scope of the validation (syntax, semantics or all). ctype: Receiver's content type. Raises: SchemaError: If the value doesn't conform to the schema. SemanticError: If the value violates a semantic constraint. ...
https://github.com/CZ-NIC/yangson/blob/a4b9464041fa8b28f6020a420ababf18fddf5d4a/yangson/instance.py#L323-L336
CZ-NIC/yangson
yangson/instance.py
InstanceNode.add_defaults
def add_defaults(self, ctype: ContentType = None) -> "InstanceNode": """Return the receiver with defaults added recursively to its value. Args: ctype: Content type of the defaults to be added. If it is ``None``, the content type will be the same as receiver's. """ ...
python
def add_defaults(self, ctype: ContentType = None) -> "InstanceNode": """Return the receiver with defaults added recursively to its value. Args: ctype: Content type of the defaults to be added. If it is ``None``, the content type will be the same as receiver's. """ ...
Return the receiver with defaults added recursively to its value. Args: ctype: Content type of the defaults to be added. If it is ``None``, the content type will be the same as receiver's.
https://github.com/CZ-NIC/yangson/blob/a4b9464041fa8b28f6020a420ababf18fddf5d4a/yangson/instance.py#L338-L365
CZ-NIC/yangson
yangson/instance.py
InstanceNode.raw_value
def raw_value(self) -> RawValue: """Return receiver's value in a raw form (ready for JSON encoding).""" if isinstance(self.value, ObjectValue): return {m: self._member(m).raw_value() for m in self.value} if isinstance(self.value, ArrayValue): return [en.raw_value() for en...
python
def raw_value(self) -> RawValue: """Return receiver's value in a raw form (ready for JSON encoding).""" if isinstance(self.value, ObjectValue): return {m: self._member(m).raw_value() for m in self.value} if isinstance(self.value, ArrayValue): return [en.raw_value() for en...
Return receiver's value in a raw form (ready for JSON encoding).
https://github.com/CZ-NIC/yangson/blob/a4b9464041fa8b28f6020a420ababf18fddf5d4a/yangson/instance.py#L367-L373
CZ-NIC/yangson
yangson/instance.py
InstanceNode._node_set
def _node_set(self) -> List["InstanceNode"]: """XPath - return the list of all receiver's nodes.""" return list(self) if isinstance(self.value, ArrayValue) else [self]
python
def _node_set(self) -> List["InstanceNode"]: """XPath - return the list of all receiver's nodes.""" return list(self) if isinstance(self.value, ArrayValue) else [self]
XPath - return the list of all receiver's nodes.
https://github.com/CZ-NIC/yangson/blob/a4b9464041fa8b28f6020a420ababf18fddf5d4a/yangson/instance.py#L418-L420
CZ-NIC/yangson
yangson/instance.py
InstanceNode._children
def _children(self, qname: Union[QualName, bool] = None) -> List["InstanceNode"]: """XPath - return the list of receiver's children.""" sn = self.schema_node if not isinstance(sn, InternalNode): return [] if qname: cn = sn.get_data_child(*qname) ...
python
def _children(self, qname: Union[QualName, bool] = None) -> List["InstanceNode"]: """XPath - return the list of receiver's children.""" sn = self.schema_node if not isinstance(sn, InternalNode): return [] if qname: cn = sn.get_data_child(*qname) ...
XPath - return the list of receiver's children.
https://github.com/CZ-NIC/yangson/blob/a4b9464041fa8b28f6020a420ababf18fddf5d4a/yangson/instance.py#L422-L450
CZ-NIC/yangson
yangson/instance.py
InstanceNode._descendants
def _descendants(self, qname: Union[QualName, bool] = None, with_self: bool = False) -> List["InstanceNode"]: """XPath - return the list of receiver's descendants.""" res = ([] if not with_self or (qname and self.qual_name != qname) else [self]) for c in self....
python
def _descendants(self, qname: Union[QualName, bool] = None, with_self: bool = False) -> List["InstanceNode"]: """XPath - return the list of receiver's descendants.""" res = ([] if not with_self or (qname and self.qual_name != qname) else [self]) for c in self....
XPath - return the list of receiver's descendants.
https://github.com/CZ-NIC/yangson/blob/a4b9464041fa8b28f6020a420ababf18fddf5d4a/yangson/instance.py#L452-L461
CZ-NIC/yangson
yangson/instance.py
InstanceNode._deref
def _deref(self) -> List["InstanceNode"]: """XPath: return the list of nodes that the receiver refers to.""" return ([] if self.is_internal() else self.schema_node.type._deref(self))
python
def _deref(self) -> List["InstanceNode"]: """XPath: return the list of nodes that the receiver refers to.""" return ([] if self.is_internal() else self.schema_node.type._deref(self))
XPath: return the list of nodes that the receiver refers to.
https://github.com/CZ-NIC/yangson/blob/a4b9464041fa8b28f6020a420ababf18fddf5d4a/yangson/instance.py#L477-L480
CZ-NIC/yangson
yangson/instance.py
ObjectMember.qual_name
def qual_name(self) -> QualName: """Return the receiver's qualified name.""" p, s, loc = self._key.partition(":") return (loc, p) if s else (p, self.namespace)
python
def qual_name(self) -> QualName: """Return the receiver's qualified name.""" p, s, loc = self._key.partition(":") return (loc, p) if s else (p, self.namespace)
Return the receiver's qualified name.
https://github.com/CZ-NIC/yangson/blob/a4b9464041fa8b28f6020a420ababf18fddf5d4a/yangson/instance.py#L524-L527
CZ-NIC/yangson
yangson/instance.py
ObjectMember.sibling
def sibling(self, name: InstanceName) -> "ObjectMember": """Return an instance node corresponding to a sibling member. Args: name: Instance name of the sibling member. Raises: NonexistentSchemaNode: If member `name` is not permitted by the schema. ...
python
def sibling(self, name: InstanceName) -> "ObjectMember": """Return an instance node corresponding to a sibling member. Args: name: Instance name of the sibling member. Raises: NonexistentSchemaNode: If member `name` is not permitted by the schema. ...
Return an instance node corresponding to a sibling member. Args: name: Instance name of the sibling member. Raises: NonexistentSchemaNode: If member `name` is not permitted by the schema. NonexistentInstance: If sibling member `name` doesn't exist.
https://github.com/CZ-NIC/yangson/blob/a4b9464041fa8b28f6020a420ababf18fddf5d4a/yangson/instance.py#L529-L549
CZ-NIC/yangson
yangson/instance.py
ObjectMember.look_up
def look_up(self, **keys: Dict[InstanceName, ScalarValue]) -> "ArrayEntry": """Return the entry with matching keys. Args: keys: Keys and values specified as keyword arguments. Raises: InstanceValueError: If the receiver's value is not a YANG list. Nonexisten...
python
def look_up(self, **keys: Dict[InstanceName, ScalarValue]) -> "ArrayEntry": """Return the entry with matching keys. Args: keys: Keys and values specified as keyword arguments. Raises: InstanceValueError: If the receiver's value is not a YANG list. Nonexisten...
Return the entry with matching keys. Args: keys: Keys and values specified as keyword arguments. Raises: InstanceValueError: If the receiver's value is not a YANG list. NonexistentInstance: If no entry with matching keys exists.
https://github.com/CZ-NIC/yangson/blob/a4b9464041fa8b28f6020a420ababf18fddf5d4a/yangson/instance.py#L551-L577
CZ-NIC/yangson
yangson/instance.py
ObjectMember._zip
def _zip(self) -> ObjectValue: """Zip the receiver into an object and return it.""" res = ObjectValue(self.siblings.copy(), self.timestamp) res[self.name] = self.value return res
python
def _zip(self) -> ObjectValue: """Zip the receiver into an object and return it.""" res = ObjectValue(self.siblings.copy(), self.timestamp) res[self.name] = self.value return res
Zip the receiver into an object and return it.
https://github.com/CZ-NIC/yangson/blob/a4b9464041fa8b28f6020a420ababf18fddf5d4a/yangson/instance.py#L579-L583
CZ-NIC/yangson
yangson/instance.py
ArrayEntry.update
def update(self, value: Union[RawValue, Value], raw: bool = False) -> "ArrayEntry": """Update the receiver's value. This method overrides the superclass method. """ return super().update(self._cook_value(value, raw), False)
python
def update(self, value: Union[RawValue, Value], raw: bool = False) -> "ArrayEntry": """Update the receiver's value. This method overrides the superclass method. """ return super().update(self._cook_value(value, raw), False)
Update the receiver's value. This method overrides the superclass method.
https://github.com/CZ-NIC/yangson/blob/a4b9464041fa8b28f6020a420ababf18fddf5d4a/yangson/instance.py#L634-L640
CZ-NIC/yangson
yangson/instance.py
ArrayEntry.previous
def previous(self) -> "ArrayEntry": """Return an instance node corresponding to the previous entry. Raises: NonexistentInstance: If the receiver is the first entry of the parent array. """ try: newval, nbef = self.before.pop() except Index...
python
def previous(self) -> "ArrayEntry": """Return an instance node corresponding to the previous entry. Raises: NonexistentInstance: If the receiver is the first entry of the parent array. """ try: newval, nbef = self.before.pop() except Index...
Return an instance node corresponding to the previous entry. Raises: NonexistentInstance: If the receiver is the first entry of the parent array.
https://github.com/CZ-NIC/yangson/blob/a4b9464041fa8b28f6020a420ababf18fddf5d4a/yangson/instance.py#L642-L655
CZ-NIC/yangson
yangson/instance.py
ArrayEntry.next
def next(self) -> "ArrayEntry": """Return an instance node corresponding to the next entry. Raises: NonexistentInstance: If the receiver is the last entry of the parent array. """ try: newval, naft = self.after.pop() except IndexError: raise N...
python
def next(self) -> "ArrayEntry": """Return an instance node corresponding to the next entry. Raises: NonexistentInstance: If the receiver is the last entry of the parent array. """ try: newval, naft = self.after.pop() except IndexError: raise N...
Return an instance node corresponding to the next entry. Raises: NonexistentInstance: If the receiver is the last entry of the parent array.
https://github.com/CZ-NIC/yangson/blob/a4b9464041fa8b28f6020a420ababf18fddf5d4a/yangson/instance.py#L657-L669
CZ-NIC/yangson
yangson/instance.py
ArrayEntry.insert_before
def insert_before(self, value: Union[RawValue, Value], raw: bool = False) -> "ArrayEntry": """Insert a new entry before the receiver. Args: value: The value of the new entry. raw: Flag to be set if `value` is raw. Returns: An instance n...
python
def insert_before(self, value: Union[RawValue, Value], raw: bool = False) -> "ArrayEntry": """Insert a new entry before the receiver. Args: value: The value of the new entry. raw: Flag to be set if `value` is raw. Returns: An instance n...
Insert a new entry before the receiver. Args: value: The value of the new entry. raw: Flag to be set if `value` is raw. Returns: An instance node of the new inserted entry.
https://github.com/CZ-NIC/yangson/blob/a4b9464041fa8b28f6020a420ababf18fddf5d4a/yangson/instance.py#L671-L684
CZ-NIC/yangson
yangson/instance.py
ArrayEntry._zip
def _zip(self) -> ArrayValue: """Zip the receiver into an array and return it.""" res = list(self.before) res.reverse() res.append(self.value) res.extend(list(self.after)) return ArrayValue(res, self.timestamp)
python
def _zip(self) -> ArrayValue: """Zip the receiver into an array and return it.""" res = list(self.before) res.reverse() res.append(self.value) res.extend(list(self.after)) return ArrayValue(res, self.timestamp)
Zip the receiver into an array and return it.
https://github.com/CZ-NIC/yangson/blob/a4b9464041fa8b28f6020a420ababf18fddf5d4a/yangson/instance.py#L705-L711
CZ-NIC/yangson
yangson/instance.py
ArrayEntry._ancestors_or_self
def _ancestors_or_self( self, qname: Union[QualName, bool] = None) -> List[InstanceNode]: """XPath - return the list of receiver's ancestors including itself.""" res = [] if qname and self.qual_name != qname else [self] return res + self.up()._ancestors(qname)
python
def _ancestors_or_self( self, qname: Union[QualName, bool] = None) -> List[InstanceNode]: """XPath - return the list of receiver's ancestors including itself.""" res = [] if qname and self.qual_name != qname else [self] return res + self.up()._ancestors(qname)
XPath - return the list of receiver's ancestors including itself.
https://github.com/CZ-NIC/yangson/blob/a4b9464041fa8b28f6020a420ababf18fddf5d4a/yangson/instance.py#L723-L727
CZ-NIC/yangson
yangson/instance.py
ArrayEntry._ancestors
def _ancestors( self, qname: Union[QualName, bool] = None) -> List[InstanceNode]: """XPath - return the list of receiver's ancestors.""" return self.up()._ancestors(qname)
python
def _ancestors( self, qname: Union[QualName, bool] = None) -> List[InstanceNode]: """XPath - return the list of receiver's ancestors.""" return self.up()._ancestors(qname)
XPath - return the list of receiver's ancestors.
https://github.com/CZ-NIC/yangson/blob/a4b9464041fa8b28f6020a420ababf18fddf5d4a/yangson/instance.py#L729-L732
CZ-NIC/yangson
yangson/instance.py
ArrayEntry._preceding_siblings
def _preceding_siblings( self, qname: Union[QualName, bool] = None) -> List[InstanceNode]: """XPath - return the list of receiver's preceding siblings.""" if qname and self.qual_name != qname: return [] res = [] en = self for _ in self.before: ...
python
def _preceding_siblings( self, qname: Union[QualName, bool] = None) -> List[InstanceNode]: """XPath - return the list of receiver's preceding siblings.""" if qname and self.qual_name != qname: return [] res = [] en = self for _ in self.before: ...
XPath - return the list of receiver's preceding siblings.
https://github.com/CZ-NIC/yangson/blob/a4b9464041fa8b28f6020a420ababf18fddf5d4a/yangson/instance.py#L734-L744
CZ-NIC/yangson
yangson/instance.py
ArrayEntry._following_siblings
def _following_siblings( self, qname: Union[QualName, bool] = None) -> List[InstanceNode]: """XPath - return the list of receiver's following siblings.""" if qname and self.qual_name != qname: return [] res = [] en = self for _ in self.after: e...
python
def _following_siblings( self, qname: Union[QualName, bool] = None) -> List[InstanceNode]: """XPath - return the list of receiver's following siblings.""" if qname and self.qual_name != qname: return [] res = [] en = self for _ in self.after: e...
XPath - return the list of receiver's following siblings.
https://github.com/CZ-NIC/yangson/blob/a4b9464041fa8b28f6020a420ababf18fddf5d4a/yangson/instance.py#L746-L756
CZ-NIC/yangson
yangson/instance.py
MemberName.peek_step
def peek_step(self, val: ObjectValue, sn: "DataNode") -> Tuple[Value, "DataNode"]: """Return member value addressed by the receiver + its schema node. Args: val: Current value (object). sn: Current schema node. """ cn = sn.get_data_child(self.n...
python
def peek_step(self, val: ObjectValue, sn: "DataNode") -> Tuple[Value, "DataNode"]: """Return member value addressed by the receiver + its schema node. Args: val: Current value (object). sn: Current schema node. """ cn = sn.get_data_child(self.n...
Return member value addressed by the receiver + its schema node. Args: val: Current value (object). sn: Current schema node.
https://github.com/CZ-NIC/yangson/blob/a4b9464041fa8b28f6020a420ababf18fddf5d4a/yangson/instance.py#L799-L811
CZ-NIC/yangson
yangson/instance.py
ActionName.peek_step
def peek_step(self, val: ObjectValue, sn: "DataNode") -> Tuple[None, "DataNode"]: """Fail because there is no action instance.""" cn = sn.get_child(self.name, self.namespace) return (None, cn)
python
def peek_step(self, val: ObjectValue, sn: "DataNode") -> Tuple[None, "DataNode"]: """Fail because there is no action instance.""" cn = sn.get_child(self.name, self.namespace) return (None, cn)
Fail because there is no action instance.
https://github.com/CZ-NIC/yangson/blob/a4b9464041fa8b28f6020a420ababf18fddf5d4a/yangson/instance.py#L825-L829