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 |
|---|---|---|---|---|---|---|---|
CZ-NIC/yangson | yangson/instance.py | EntryIndex.peek_step | def peek_step(self, val: ArrayValue,
sn: "DataNode") -> Tuple[Optional[Value], "DataNode"]:
"""Return entry value addressed by the receiver + its schema node.
Args:
val: Current value (array).
sn: Current schema node.
"""
try:
retur... | python | def peek_step(self, val: ArrayValue,
sn: "DataNode") -> Tuple[Optional[Value], "DataNode"]:
"""Return entry value addressed by the receiver + its schema node.
Args:
val: Current value (array).
sn: Current schema node.
"""
try:
retur... | Return entry value addressed by the receiver + its schema node.
Args:
val: Current value (array).
sn: Current schema node. | https://github.com/CZ-NIC/yangson/blob/a4b9464041fa8b28f6020a420ababf18fddf5d4a/yangson/instance.py#L854-L865 |
CZ-NIC/yangson | yangson/instance.py | EntryValue.parse_value | def parse_value(self, sn: "DataNode") -> ScalarValue:
"""Let schema node's type parse the receiver's value."""
res = sn.type.parse_value(self.value)
if res is None:
raise InvalidKeyValue(self.value)
return res | python | def parse_value(self, sn: "DataNode") -> ScalarValue:
"""Let schema node's type parse the receiver's value."""
res = sn.type.parse_value(self.value)
if res is None:
raise InvalidKeyValue(self.value)
return res | Let schema node's type parse the receiver's value. | https://github.com/CZ-NIC/yangson/blob/a4b9464041fa8b28f6020a420ababf18fddf5d4a/yangson/instance.py#L894-L899 |
CZ-NIC/yangson | yangson/instance.py | EntryValue.peek_step | def peek_step(self, val: ArrayValue,
sn: "DataNode") -> Tuple[Value, "DataNode"]:
"""Return entry value addressed by the receiver + its schema node.
Args:
val: Current value (array).
sn: Current schema node.
"""
try:
return (val[val... | python | def peek_step(self, val: ArrayValue,
sn: "DataNode") -> Tuple[Value, "DataNode"]:
"""Return entry value addressed by the receiver + its schema node.
Args:
val: Current value (array).
sn: Current schema node.
"""
try:
return (val[val... | Return entry value addressed by the receiver + its schema node.
Args:
val: Current value (array).
sn: Current schema node. | https://github.com/CZ-NIC/yangson/blob/a4b9464041fa8b28f6020a420ababf18fddf5d4a/yangson/instance.py#L901-L912 |
CZ-NIC/yangson | yangson/instance.py | EntryValue.goto_step | def goto_step(self, inst: InstanceNode) -> InstanceNode:
"""Return member instance of `inst` addressed by the receiver.
Args:
inst: Current instance.
"""
try:
return inst._entry(
inst.value.index(self.parse_value(inst.schema_node)))
except... | python | def goto_step(self, inst: InstanceNode) -> InstanceNode:
"""Return member instance of `inst` addressed by the receiver.
Args:
inst: Current instance.
"""
try:
return inst._entry(
inst.value.index(self.parse_value(inst.schema_node)))
except... | Return member instance of `inst` addressed by the receiver.
Args:
inst: Current instance. | https://github.com/CZ-NIC/yangson/blob/a4b9464041fa8b28f6020a420ababf18fddf5d4a/yangson/instance.py#L914-L925 |
CZ-NIC/yangson | yangson/instance.py | EntryKeys.parse_keys | def parse_keys(self, sn: "DataNode") -> Dict[InstanceName, ScalarValue]:
"""Parse key dictionary in the context of a schema node.
Args:
sn: Schema node corresponding to a list.
"""
res = {}
for k in self.keys:
knod = sn.get_data_child(*k)
if k... | python | def parse_keys(self, sn: "DataNode") -> Dict[InstanceName, ScalarValue]:
"""Parse key dictionary in the context of a schema node.
Args:
sn: Schema node corresponding to a list.
"""
res = {}
for k in self.keys:
knod = sn.get_data_child(*k)
if k... | Parse key dictionary in the context of a schema node.
Args:
sn: Schema node corresponding to a list. | https://github.com/CZ-NIC/yangson/blob/a4b9464041fa8b28f6020a420ababf18fddf5d4a/yangson/instance.py#L951-L966 |
CZ-NIC/yangson | yangson/instance.py | EntryKeys.peek_step | def peek_step(self, val: ArrayValue,
sn: "DataNode") -> Tuple[ObjectValue, "DataNode"]:
"""Return the entry addressed by the receiver + its schema node.
Args:
val: Current value (array).
sn: Current schema node.
"""
keys = self.parse_keys(sn)
... | python | def peek_step(self, val: ArrayValue,
sn: "DataNode") -> Tuple[ObjectValue, "DataNode"]:
"""Return the entry addressed by the receiver + its schema node.
Args:
val: Current value (array).
sn: Current schema node.
"""
keys = self.parse_keys(sn)
... | Return the entry addressed by the receiver + its schema node.
Args:
val: Current value (array).
sn: Current schema node. | https://github.com/CZ-NIC/yangson/blob/a4b9464041fa8b28f6020a420ababf18fddf5d4a/yangson/instance.py#L968-L988 |
CZ-NIC/yangson | yangson/instance.py | EntryKeys.goto_step | def goto_step(self, inst: InstanceNode) -> InstanceNode:
"""Return member instance of `inst` addressed by the receiver.
Args:
inst: Current instance.
"""
return inst.look_up(**self.parse_keys(inst.schema_node)) | python | def goto_step(self, inst: InstanceNode) -> InstanceNode:
"""Return member instance of `inst` addressed by the receiver.
Args:
inst: Current instance.
"""
return inst.look_up(**self.parse_keys(inst.schema_node)) | Return member instance of `inst` addressed by the receiver.
Args:
inst: Current instance. | https://github.com/CZ-NIC/yangson/blob/a4b9464041fa8b28f6020a420ababf18fddf5d4a/yangson/instance.py#L990-L996 |
CZ-NIC/yangson | yangson/instance.py | ResourceIdParser.parse | def parse(self) -> InstanceRoute:
"""Parse resource identifier."""
res = InstanceRoute()
if self.at_end():
return res
if self.peek() == "/":
self.offset += 1
if self.at_end():
return res
sn = self.schema_node
while True:
... | python | def parse(self) -> InstanceRoute:
"""Parse resource identifier."""
res = InstanceRoute()
if self.at_end():
return res
if self.peek() == "/":
self.offset += 1
if self.at_end():
return res
sn = self.schema_node
while True:
... | Parse resource identifier. | https://github.com/CZ-NIC/yangson/blob/a4b9464041fa8b28f6020a420ababf18fddf5d4a/yangson/instance.py#L1011-L1041 |
CZ-NIC/yangson | yangson/instance.py | ResourceIdParser._key_values | def _key_values(self, sn: "SequenceNode") -> Union[EntryKeys, EntryValue]:
"""Parse leaf-list value or list keys."""
try:
keys = self.up_to("/")
except EndOfInput:
keys = self.remaining()
if not keys:
raise UnexpectedInput(self, "entry value or keys")
... | python | def _key_values(self, sn: "SequenceNode") -> Union[EntryKeys, EntryValue]:
"""Parse leaf-list value or list keys."""
try:
keys = self.up_to("/")
except EndOfInput:
keys = self.remaining()
if not keys:
raise UnexpectedInput(self, "entry value or keys")
... | Parse leaf-list value or list keys. | https://github.com/CZ-NIC/yangson/blob/a4b9464041fa8b28f6020a420ababf18fddf5d4a/yangson/instance.py#L1043-L1064 |
CZ-NIC/yangson | yangson/instance.py | InstanceIdParser.parse | def parse(self) -> InstanceRoute:
"""Parse instance identifier."""
res = InstanceRoute()
while True:
self.char("/")
res.append(MemberName(*self.prefixed_name()))
try:
next = self.peek()
except EndOfInput:
return res
... | python | def parse(self) -> InstanceRoute:
"""Parse instance identifier."""
res = InstanceRoute()
while True:
self.char("/")
res.append(MemberName(*self.prefixed_name()))
try:
next = self.peek()
except EndOfInput:
return res
... | Parse instance identifier. | https://github.com/CZ-NIC/yangson/blob/a4b9464041fa8b28f6020a420ababf18fddf5d4a/yangson/instance.py#L1070-L1097 |
CZ-NIC/yangson | yangson/statement.py | Statement.find1 | def find1(self, kw: YangIdentifier, arg: str = None,
pref: YangIdentifier = None,
required: bool = False) -> Optional["Statement"]:
"""Return first substatement with the given parameters.
Args:
kw: Statement keyword (local part for extensions).
arg: A... | python | def find1(self, kw: YangIdentifier, arg: str = None,
pref: YangIdentifier = None,
required: bool = False) -> Optional["Statement"]:
"""Return first substatement with the given parameters.
Args:
kw: Statement keyword (local part for extensions).
arg: A... | Return first substatement with the given parameters.
Args:
kw: Statement keyword (local part for extensions).
arg: Argument (all arguments will match if ``None``).
pref: Keyword prefix (``None`` for built-in statements).
required: Should an exception be raised on... | https://github.com/CZ-NIC/yangson/blob/a4b9464041fa8b28f6020a420ababf18fddf5d4a/yangson/statement.py#L70-L90 |
CZ-NIC/yangson | yangson/statement.py | Statement.find_all | def find_all(self, kw: YangIdentifier,
pref: YangIdentifier = None) -> List["Statement"]:
"""Return the list all substatements with the given keyword and prefix.
Args:
kw: Statement keyword (local part for extensions).
pref: Keyword prefix (``None`` for built-in... | python | def find_all(self, kw: YangIdentifier,
pref: YangIdentifier = None) -> List["Statement"]:
"""Return the list all substatements with the given keyword and prefix.
Args:
kw: Statement keyword (local part for extensions).
pref: Keyword prefix (``None`` for built-in... | Return the list all substatements with the given keyword and prefix.
Args:
kw: Statement keyword (local part for extensions).
pref: Keyword prefix (``None`` for built-in statements). | https://github.com/CZ-NIC/yangson/blob/a4b9464041fa8b28f6020a420ababf18fddf5d4a/yangson/statement.py#L92-L101 |
CZ-NIC/yangson | yangson/statement.py | Statement.get_definition | def get_definition(self, name: YangIdentifier,
kw: YangIdentifier) -> Optional["Statement"]:
"""Search ancestor statements for a definition.
Args:
name: Name of a grouping or datatype (with no prefix).
kw: ``grouping`` or ``typedef``.
Raises:
... | python | def get_definition(self, name: YangIdentifier,
kw: YangIdentifier) -> Optional["Statement"]:
"""Search ancestor statements for a definition.
Args:
name: Name of a grouping or datatype (with no prefix).
kw: ``grouping`` or ``typedef``.
Raises:
... | Search ancestor statements for a definition.
Args:
name: Name of a grouping or datatype (with no prefix).
kw: ``grouping`` or ``typedef``.
Raises:
DefinitionNotFound: If the definition is not found. | https://github.com/CZ-NIC/yangson/blob/a4b9464041fa8b28f6020a420ababf18fddf5d4a/yangson/statement.py#L103-L120 |
CZ-NIC/yangson | yangson/statement.py | Statement.get_error_info | def get_error_info(self) -> Tuple[Optional[str], Optional[str]]:
"""Return receiver's error tag and error message if present."""
etag = self.find1("error-app-tag")
emsg = self.find1("error-message")
return (etag.argument if etag else None, emsg.argument if emsg else None) | python | def get_error_info(self) -> Tuple[Optional[str], Optional[str]]:
"""Return receiver's error tag and error message if present."""
etag = self.find1("error-app-tag")
emsg = self.find1("error-message")
return (etag.argument if etag else None, emsg.argument if emsg else None) | Return receiver's error tag and error message if present. | https://github.com/CZ-NIC/yangson/blob/a4b9464041fa8b28f6020a420ababf18fddf5d4a/yangson/statement.py#L122-L126 |
CZ-NIC/yangson | yangson/statement.py | ModuleParser.parse | def parse(self) -> Statement:
"""Parse a complete YANG module or submodule.
Args:
mtext: YANG module text.
Raises:
EndOfInput: If past the end of input.
ModuleNameMismatch: If parsed module name doesn't match `self.name`.
ModuleRevisionMismatch: ... | python | def parse(self) -> Statement:
"""Parse a complete YANG module or submodule.
Args:
mtext: YANG module text.
Raises:
EndOfInput: If past the end of input.
ModuleNameMismatch: If parsed module name doesn't match `self.name`.
ModuleRevisionMismatch: ... | Parse a complete YANG module or submodule.
Args:
mtext: YANG module text.
Raises:
EndOfInput: If past the end of input.
ModuleNameMismatch: If parsed module name doesn't match `self.name`.
ModuleRevisionMismatch: If parsed revision date doesn't match `se... | https://github.com/CZ-NIC/yangson/blob/a4b9464041fa8b28f6020a420ababf18fddf5d4a/yangson/statement.py#L147-L175 |
CZ-NIC/yangson | yangson/statement.py | ModuleParser.unescape | def unescape(cls, text: str) -> str:
"""Replace escape sequence with corresponding characters.
Args:
text: Text to unescape.
"""
chop = text.split("\\", 1)
try:
return (chop[0] if len(chop) == 1
else chop[0] + cls.unescape_map[chop[1][... | python | def unescape(cls, text: str) -> str:
"""Replace escape sequence with corresponding characters.
Args:
text: Text to unescape.
"""
chop = text.split("\\", 1)
try:
return (chop[0] if len(chop) == 1
else chop[0] + cls.unescape_map[chop[1][... | Replace escape sequence with corresponding characters.
Args:
text: Text to unescape. | https://github.com/CZ-NIC/yangson/blob/a4b9464041fa8b28f6020a420ababf18fddf5d4a/yangson/statement.py#L182-L194 |
CZ-NIC/yangson | yangson/statement.py | ModuleParser.opt_separator | def opt_separator(self) -> bool:
"""Parse an optional separator and return ``True`` if found.
Raises:
EndOfInput: If past the end of input.
"""
start = self.offset
self.dfa([
{ # state 0: whitespace
"": lambda: -1,
" ": la... | python | def opt_separator(self) -> bool:
"""Parse an optional separator and return ``True`` if found.
Raises:
EndOfInput: If past the end of input.
"""
start = self.offset
self.dfa([
{ # state 0: whitespace
"": lambda: -1,
" ": la... | Parse an optional separator and return ``True`` if found.
Raises:
EndOfInput: If past the end of input. | https://github.com/CZ-NIC/yangson/blob/a4b9464041fa8b28f6020a420ababf18fddf5d4a/yangson/statement.py#L196-L234 |
CZ-NIC/yangson | yangson/statement.py | ModuleParser.keyword | def keyword(self) -> Tuple[Optional[str], str]:
"""Parse a YANG statement keyword.
Raises:
EndOfInput: If past the end of input.
UnexpectedInput: If no syntactically correct keyword is found.
"""
i1 = self.yang_identifier()
if self.peek() == ":":
... | python | def keyword(self) -> Tuple[Optional[str], str]:
"""Parse a YANG statement keyword.
Raises:
EndOfInput: If past the end of input.
UnexpectedInput: If no syntactically correct keyword is found.
"""
i1 = self.yang_identifier()
if self.peek() == ":":
... | Parse a YANG statement keyword.
Raises:
EndOfInput: If past the end of input.
UnexpectedInput: If no syntactically correct keyword is found. | https://github.com/CZ-NIC/yangson/blob/a4b9464041fa8b28f6020a420ababf18fddf5d4a/yangson/statement.py#L247-L259 |
CZ-NIC/yangson | yangson/statement.py | ModuleParser.statement | def statement(self) -> Statement:
"""Parse YANG statement.
Raises:
EndOfInput: If past the end of input.
UnexpectedInput: If no syntactically correct statement is found.
"""
pref, kw = self.keyword()
pres = self.opt_separator()
next = self.peek()
... | python | def statement(self) -> Statement:
"""Parse YANG statement.
Raises:
EndOfInput: If past the end of input.
UnexpectedInput: If no syntactically correct statement is found.
"""
pref, kw = self.keyword()
pres = self.opt_separator()
next = self.peek()
... | Parse YANG statement.
Raises:
EndOfInput: If past the end of input.
UnexpectedInput: If no syntactically correct statement is found. | https://github.com/CZ-NIC/yangson/blob/a4b9464041fa8b28f6020a420ababf18fddf5d4a/yangson/statement.py#L261-L289 |
CZ-NIC/yangson | yangson/statement.py | ModuleParser.argument | def argument(self) -> bool:
"""Parse statement argument.
Return ``True`` if the argument is followed by block of substatements.
"""
next = self.peek()
if next == "'":
quoted = True
self.sq_argument()
elif next == '"':
quoted = True
... | python | def argument(self) -> bool:
"""Parse statement argument.
Return ``True`` if the argument is followed by block of substatements.
"""
next = self.peek()
if next == "'":
quoted = True
self.sq_argument()
elif next == '"':
quoted = True
... | Parse statement argument.
Return ``True`` if the argument is followed by block of substatements. | https://github.com/CZ-NIC/yangson/blob/a4b9464041fa8b28f6020a420ababf18fddf5d4a/yangson/statement.py#L291-L320 |
CZ-NIC/yangson | yangson/statement.py | ModuleParser.dq_argument | def dq_argument(self) -> str:
"""Parse double-quoted argument.
Raises:
EndOfInput: If past the end of input.
"""
def escape():
self._escape = True
return 1
self._escape = False # any escaped chars?
self.offset += 1
... | python | def dq_argument(self) -> str:
"""Parse double-quoted argument.
Raises:
EndOfInput: If past the end of input.
"""
def escape():
self._escape = True
return 1
self._escape = False # any escaped chars?
self.offset += 1
... | Parse double-quoted argument.
Raises:
EndOfInput: If past the end of input. | https://github.com/CZ-NIC/yangson/blob/a4b9464041fa8b28f6020a420ababf18fddf5d4a/yangson/statement.py#L331-L354 |
CZ-NIC/yangson | yangson/statement.py | ModuleParser.unq_argument | def unq_argument(self) -> str:
"""Parse unquoted argument.
Raises:
EndOfInput: If past the end of input.
"""
start = self.offset
self.dfa([
{ # state 0: argument
"": lambda: 0,
";": lambda: -1,
" ": lambda:... | python | def unq_argument(self) -> str:
"""Parse unquoted argument.
Raises:
EndOfInput: If past the end of input.
"""
start = self.offset
self.dfa([
{ # state 0: argument
"": lambda: 0,
";": lambda: -1,
" ": lambda:... | Parse unquoted argument.
Raises:
EndOfInput: If past the end of input. | https://github.com/CZ-NIC/yangson/blob/a4b9464041fa8b28f6020a420ababf18fddf5d4a/yangson/statement.py#L356-L379 |
CZ-NIC/yangson | yangson/statement.py | ModuleParser.substatements | def substatements(self) -> List[Statement]:
"""Parse substatements.
Raises:
EndOfInput: If past the end of input.
"""
res = []
self.opt_separator()
while self.peek() != "}":
res.append(self.statement())
self.opt_separator()
sel... | python | def substatements(self) -> List[Statement]:
"""Parse substatements.
Raises:
EndOfInput: If past the end of input.
"""
res = []
self.opt_separator()
while self.peek() != "}":
res.append(self.statement())
self.opt_separator()
sel... | Parse substatements.
Raises:
EndOfInput: If past the end of input. | https://github.com/CZ-NIC/yangson/blob/a4b9464041fa8b28f6020a420ababf18fddf5d4a/yangson/statement.py#L381-L393 |
CZ-NIC/yangson | yangson/schemadata.py | SchemaData._from_yang_library | def _from_yang_library(self, yang_lib: Dict[str, Any]) -> None:
"""Set the schema structures from YANG library data.
Args:
yang_lib: Dictionary with YANG library data.
Raises:
BadYangLibraryData: If YANG library data is invalid.
FeaturePrerequisiteError: If ... | python | def _from_yang_library(self, yang_lib: Dict[str, Any]) -> None:
"""Set the schema structures from YANG library data.
Args:
yang_lib: Dictionary with YANG library data.
Raises:
BadYangLibraryData: If YANG library data is invalid.
FeaturePrerequisiteError: If ... | Set the schema structures from YANG library data.
Args:
yang_lib: Dictionary with YANG library data.
Raises:
BadYangLibraryData: If YANG library data is invalid.
FeaturePrerequisiteError: If a pre-requisite feature isn't
supported.
Multip... | https://github.com/CZ-NIC/yangson/blob/a4b9464041fa8b28f6020a420ababf18fddf5d4a/yangson/schemadata.py#L103-L150 |
CZ-NIC/yangson | yangson/schemadata.py | SchemaData._load_module | def _load_module(self, name: YangIdentifier,
rev: RevisionDate) -> Statement:
"""Read and parse a YANG module or submodule."""
for d in self.module_search_path:
run = 0
while run < 2:
fn = f"{d}/{name}"
if rev and run == 0:
... | python | def _load_module(self, name: YangIdentifier,
rev: RevisionDate) -> Statement:
"""Read and parse a YANG module or submodule."""
for d in self.module_search_path:
run = 0
while run < 2:
fn = f"{d}/{name}"
if rev and run == 0:
... | Read and parse a YANG module or submodule. | https://github.com/CZ-NIC/yangson/blob/a4b9464041fa8b28f6020a420ababf18fddf5d4a/yangson/schemadata.py#L152-L169 |
CZ-NIC/yangson | yangson/schemadata.py | SchemaData._check_feature_dependences | def _check_feature_dependences(self):
"""Verify feature dependences."""
for mid in self.modules:
for fst in self.modules[mid].statement.find_all("feature"):
fn, fid = self.resolve_pname(fst.argument, mid)
if fn not in self.modules[fid].features:
... | python | def _check_feature_dependences(self):
"""Verify feature dependences."""
for mid in self.modules:
for fst in self.modules[mid].statement.find_all("feature"):
fn, fid = self.resolve_pname(fst.argument, mid)
if fn not in self.modules[fid].features:
... | Verify feature dependences. | https://github.com/CZ-NIC/yangson/blob/a4b9464041fa8b28f6020a420ababf18fddf5d4a/yangson/schemadata.py#L208-L216 |
CZ-NIC/yangson | yangson/schemadata.py | SchemaData.namespace | def namespace(self, mid: ModuleId) -> YangIdentifier:
"""Return the namespace corresponding to a module or submodule.
Args:
mid: Module identifier.
Raises:
ModuleNotRegistered: If `mid` is not registered in the data model.
"""
try:
mdata = se... | python | def namespace(self, mid: ModuleId) -> YangIdentifier:
"""Return the namespace corresponding to a module or submodule.
Args:
mid: Module identifier.
Raises:
ModuleNotRegistered: If `mid` is not registered in the data model.
"""
try:
mdata = se... | Return the namespace corresponding to a module or submodule.
Args:
mid: Module identifier.
Raises:
ModuleNotRegistered: If `mid` is not registered in the data model. | https://github.com/CZ-NIC/yangson/blob/a4b9464041fa8b28f6020a420ababf18fddf5d4a/yangson/schemadata.py#L218-L231 |
CZ-NIC/yangson | yangson/schemadata.py | SchemaData.last_revision | def last_revision(self, mod: YangIdentifier) -> ModuleId:
"""Return the last revision of a module that's part of the data model.
Args:
mod: Name of a module or submodule.
Raises:
ModuleNotRegistered: If the module `mod` is not present in the
data model.
... | python | def last_revision(self, mod: YangIdentifier) -> ModuleId:
"""Return the last revision of a module that's part of the data model.
Args:
mod: Name of a module or submodule.
Raises:
ModuleNotRegistered: If the module `mod` is not present in the
data model.
... | Return the last revision of a module that's part of the data model.
Args:
mod: Name of a module or submodule.
Raises:
ModuleNotRegistered: If the module `mod` is not present in the
data model. | https://github.com/CZ-NIC/yangson/blob/a4b9464041fa8b28f6020a420ababf18fddf5d4a/yangson/schemadata.py#L233-L246 |
CZ-NIC/yangson | yangson/schemadata.py | SchemaData.prefix2ns | def prefix2ns(self, prefix: YangIdentifier, mid: ModuleId) -> YangIdentifier:
"""Return the namespace corresponding to a prefix.
Args:
prefix: Prefix associated with a module and its namespace.
mid: Identifier of the module in which the prefix is declared.
Raises:
... | python | def prefix2ns(self, prefix: YangIdentifier, mid: ModuleId) -> YangIdentifier:
"""Return the namespace corresponding to a prefix.
Args:
prefix: Prefix associated with a module and its namespace.
mid: Identifier of the module in which the prefix is declared.
Raises:
... | Return the namespace corresponding to a prefix.
Args:
prefix: Prefix associated with a module and its namespace.
mid: Identifier of the module in which the prefix is declared.
Raises:
ModuleNotRegistered: If `mid` is not registered in the data model.
Unk... | https://github.com/CZ-NIC/yangson/blob/a4b9464041fa8b28f6020a420ababf18fddf5d4a/yangson/schemadata.py#L248-L266 |
CZ-NIC/yangson | yangson/schemadata.py | SchemaData.resolve_pname | def resolve_pname(self, pname: PrefName,
mid: ModuleId) -> Tuple[YangIdentifier, ModuleId]:
"""Return the name and module identifier in which the name is defined.
Args:
pname: Name with an optional prefix.
mid: Identifier of the module in which `pname` appe... | python | def resolve_pname(self, pname: PrefName,
mid: ModuleId) -> Tuple[YangIdentifier, ModuleId]:
"""Return the name and module identifier in which the name is defined.
Args:
pname: Name with an optional prefix.
mid: Identifier of the module in which `pname` appe... | Return the name and module identifier in which the name is defined.
Args:
pname: Name with an optional prefix.
mid: Identifier of the module in which `pname` appears.
Raises:
ModuleNotRegistered: If `mid` is not registered in the data model.
UnknownPrefi... | https://github.com/CZ-NIC/yangson/blob/a4b9464041fa8b28f6020a420ababf18fddf5d4a/yangson/schemadata.py#L268-L288 |
CZ-NIC/yangson | yangson/schemadata.py | SchemaData.translate_pname | def translate_pname(self, pname: PrefName, mid: ModuleId) -> QualName:
"""Translate a prefixed name to a qualified name.
Args:
pname: Name with an optional prefix.
mid: Identifier of the module in which `pname` appears.
Raises:
ModuleNotRegistered: If `mid` is... | python | def translate_pname(self, pname: PrefName, mid: ModuleId) -> QualName:
"""Translate a prefixed name to a qualified name.
Args:
pname: Name with an optional prefix.
mid: Identifier of the module in which `pname` appears.
Raises:
ModuleNotRegistered: If `mid` is... | Translate a prefixed name to a qualified name.
Args:
pname: Name with an optional prefix.
mid: Identifier of the module in which `pname` appears.
Raises:
ModuleNotRegistered: If `mid` is not registered in the data model.
UnknownPrefix: If the prefix specif... | https://github.com/CZ-NIC/yangson/blob/a4b9464041fa8b28f6020a420ababf18fddf5d4a/yangson/schemadata.py#L290-L300 |
CZ-NIC/yangson | yangson/schemadata.py | SchemaData.translate_node_id | def translate_node_id(self, ni: PrefName, sctx: SchemaContext) -> QualName:
"""Translate node identifier to a qualified name.
Args:
ni: Node identifier (with optional prefix).
sctx: SchemaContext.
Raises:
ModuleNotRegistered: If `mid` is not registered in th... | python | def translate_node_id(self, ni: PrefName, sctx: SchemaContext) -> QualName:
"""Translate node identifier to a qualified name.
Args:
ni: Node identifier (with optional prefix).
sctx: SchemaContext.
Raises:
ModuleNotRegistered: If `mid` is not registered in th... | Translate node identifier to a qualified name.
Args:
ni: Node identifier (with optional prefix).
sctx: SchemaContext.
Raises:
ModuleNotRegistered: If `mid` is not registered in the data model.
UnknownPrefix: If the prefix specified in `ni` is not declare... | https://github.com/CZ-NIC/yangson/blob/a4b9464041fa8b28f6020a420ababf18fddf5d4a/yangson/schemadata.py#L302-L323 |
CZ-NIC/yangson | yangson/schemadata.py | SchemaData.prefix | def prefix(self, imod: YangIdentifier, mid: ModuleId) -> YangIdentifier:
"""Return the prefix corresponding to an implemented module.
Args:
imod: Name of an implemented module.
mid: Identifier of the context module.
Raises:
ModuleNotImplemented: If `imod` is... | python | def prefix(self, imod: YangIdentifier, mid: ModuleId) -> YangIdentifier:
"""Return the prefix corresponding to an implemented module.
Args:
imod: Name of an implemented module.
mid: Identifier of the context module.
Raises:
ModuleNotImplemented: If `imod` is... | Return the prefix corresponding to an implemented module.
Args:
imod: Name of an implemented module.
mid: Identifier of the context module.
Raises:
ModuleNotImplemented: If `imod` is not implemented.
ModuleNotRegistered: If `mid` is not registered in YAN... | https://github.com/CZ-NIC/yangson/blob/a4b9464041fa8b28f6020a420ababf18fddf5d4a/yangson/schemadata.py#L325-L348 |
CZ-NIC/yangson | yangson/schemadata.py | SchemaData.sni2route | def sni2route(self, sni: SchemaNodeId, sctx: SchemaContext) -> SchemaRoute:
"""Translate schema node identifier to a schema route.
Args:
sni: Schema node identifier (absolute or relative).
sctx: Schema context.
Raises:
ModuleNotRegistered: If `mid` is not re... | python | def sni2route(self, sni: SchemaNodeId, sctx: SchemaContext) -> SchemaRoute:
"""Translate schema node identifier to a schema route.
Args:
sni: Schema node identifier (absolute or relative).
sctx: Schema context.
Raises:
ModuleNotRegistered: If `mid` is not re... | Translate schema node identifier to a schema route.
Args:
sni: Schema node identifier (absolute or relative).
sctx: Schema context.
Raises:
ModuleNotRegistered: If `mid` is not registered in the data model.
UnknownPrefix: If a prefix specified in `sni` i... | https://github.com/CZ-NIC/yangson/blob/a4b9464041fa8b28f6020a420ababf18fddf5d4a/yangson/schemadata.py#L350-L365 |
CZ-NIC/yangson | yangson/schemadata.py | SchemaData.path2route | def path2route(path: SchemaPath) -> SchemaRoute:
"""Translate a schema/data path to a schema/data route.
Args:
path: Schema path.
Raises:
InvalidSchemaPath: Invalid path.
"""
if path == "/" or path == "":
return []
nlist = path.split(... | python | def path2route(path: SchemaPath) -> SchemaRoute:
"""Translate a schema/data path to a schema/data route.
Args:
path: Schema path.
Raises:
InvalidSchemaPath: Invalid path.
"""
if path == "/" or path == "":
return []
nlist = path.split(... | Translate a schema/data path to a schema/data route.
Args:
path: Schema path.
Raises:
InvalidSchemaPath: Invalid path. | https://github.com/CZ-NIC/yangson/blob/a4b9464041fa8b28f6020a420ababf18fddf5d4a/yangson/schemadata.py#L368-L393 |
CZ-NIC/yangson | yangson/schemadata.py | SchemaData.get_definition | def get_definition(self, stmt: Statement,
sctx: SchemaContext) -> Tuple[Statement, SchemaContext]:
"""Find the statement defining a grouping or derived type.
Args:
stmt: YANG "uses" or "type" statement.
sctx: Schema context where the definition is used.
... | python | def get_definition(self, stmt: Statement,
sctx: SchemaContext) -> Tuple[Statement, SchemaContext]:
"""Find the statement defining a grouping or derived type.
Args:
stmt: YANG "uses" or "type" statement.
sctx: Schema context where the definition is used.
... | Find the statement defining a grouping or derived type.
Args:
stmt: YANG "uses" or "type" statement.
sctx: Schema context where the definition is used.
Returns:
A tuple consisting of the definition statement ('grouping' or
'typedef') and schema context o... | https://github.com/CZ-NIC/yangson/blob/a4b9464041fa8b28f6020a420ababf18fddf5d4a/yangson/schemadata.py#L395-L434 |
CZ-NIC/yangson | yangson/schemadata.py | SchemaData.is_derived_from | def is_derived_from(self, identity: QualName, base: QualName) -> bool:
"""Return ``True`` if `identity` is derived from `base`."""
try:
bases = self.identity_adjs[identity].bases
except KeyError:
return False
if base in bases:
return True
for i... | python | def is_derived_from(self, identity: QualName, base: QualName) -> bool:
"""Return ``True`` if `identity` is derived from `base`."""
try:
bases = self.identity_adjs[identity].bases
except KeyError:
return False
if base in bases:
return True
for i... | Return ``True`` if `identity` is derived from `base`. | https://github.com/CZ-NIC/yangson/blob/a4b9464041fa8b28f6020a420ababf18fddf5d4a/yangson/schemadata.py#L436-L447 |
CZ-NIC/yangson | yangson/schemadata.py | SchemaData.derived_from | def derived_from(self, identity: QualName) -> MutableSet[QualName]:
"""Return list of identities transitively derived from `identity`."""
try:
res = self.identity_adjs[identity].derivs
except KeyError:
return set()
for id in res.copy():
res |= self.der... | python | def derived_from(self, identity: QualName) -> MutableSet[QualName]:
"""Return list of identities transitively derived from `identity`."""
try:
res = self.identity_adjs[identity].derivs
except KeyError:
return set()
for id in res.copy():
res |= self.der... | Return list of identities transitively derived from `identity`. | https://github.com/CZ-NIC/yangson/blob/a4b9464041fa8b28f6020a420ababf18fddf5d4a/yangson/schemadata.py#L449-L457 |
CZ-NIC/yangson | yangson/schemadata.py | SchemaData.derived_from_all | def derived_from_all(self, identities: List[QualName]) -> MutableSet[QualName]:
"""Return list of identities transitively derived from all `identity`."""
if not identities:
return set()
res = self.derived_from(identities[0])
for id in identities[1:]:
res &= self.d... | python | def derived_from_all(self, identities: List[QualName]) -> MutableSet[QualName]:
"""Return list of identities transitively derived from all `identity`."""
if not identities:
return set()
res = self.derived_from(identities[0])
for id in identities[1:]:
res &= self.d... | Return list of identities transitively derived from all `identity`. | https://github.com/CZ-NIC/yangson/blob/a4b9464041fa8b28f6020a420ababf18fddf5d4a/yangson/schemadata.py#L459-L466 |
CZ-NIC/yangson | yangson/schemadata.py | SchemaData.if_features | def if_features(self, stmt: Statement, mid: ModuleId) -> bool:
"""Evaluate ``if-feature`` substatements on a statement, if any.
Args:
stmt: Yang statement that is tested on if-features.
mid: Identifier of the module in which `stmt` is present.
Raises:
Module... | python | def if_features(self, stmt: Statement, mid: ModuleId) -> bool:
"""Evaluate ``if-feature`` substatements on a statement, if any.
Args:
stmt: Yang statement that is tested on if-features.
mid: Identifier of the module in which `stmt` is present.
Raises:
Module... | Evaluate ``if-feature`` substatements on a statement, if any.
Args:
stmt: Yang statement that is tested on if-features.
mid: Identifier of the module in which `stmt` is present.
Raises:
ModuleNotRegistered: If `mid` is not registered in the data model.
I... | https://github.com/CZ-NIC/yangson/blob/a4b9464041fa8b28f6020a420ababf18fddf5d4a/yangson/schemadata.py#L468-L488 |
CZ-NIC/yangson | yangson/schemadata.py | FeatureExprParser.parse | def parse(self) -> bool:
"""Parse and evaluate a complete feature expression.
Raises:
InvalidFeatureExpression: If the if-feature expression is not
syntactically correct.
UnknownPrefix: If a prefix of a feature name is not declared.
"""
self.skip_... | python | def parse(self) -> bool:
"""Parse and evaluate a complete feature expression.
Raises:
InvalidFeatureExpression: If the if-feature expression is not
syntactically correct.
UnknownPrefix: If a prefix of a feature name is not declared.
"""
self.skip_... | Parse and evaluate a complete feature expression.
Raises:
InvalidFeatureExpression: If the if-feature expression is not
syntactically correct.
UnknownPrefix: If a prefix of a feature name is not declared. | https://github.com/CZ-NIC/yangson/blob/a4b9464041fa8b28f6020a420ababf18fddf5d4a/yangson/schemadata.py#L509-L522 |
CZ-NIC/yangson | yangson/parser.py | Parser.char | def char(self, c: str) -> None:
"""Parse the specified character.
Args:
c: One-character string.
Raises:
EndOfInput: If past the end of `self.input`.
UnexpectedInput: If the next character is different from `c`.
"""
if self.peek() == c:
... | python | def char(self, c: str) -> None:
"""Parse the specified character.
Args:
c: One-character string.
Raises:
EndOfInput: If past the end of `self.input`.
UnexpectedInput: If the next character is different from `c`.
"""
if self.peek() == c:
... | Parse the specified character.
Args:
c: One-character string.
Raises:
EndOfInput: If past the end of `self.input`.
UnexpectedInput: If the next character is different from `c`. | https://github.com/CZ-NIC/yangson/blob/a4b9464041fa8b28f6020a420ababf18fddf5d4a/yangson/parser.py#L83-L96 |
CZ-NIC/yangson | yangson/parser.py | Parser.dfa | def dfa(self, ttab: TransitionTable, init: int = 0) -> int:
"""Run a DFA and return the final (negative) state.
Args:
ttab: Transition table (with possible side-effects).
init: Initial state.
Raises:
EndOfInput: If past the end of `self.input`.
"""
... | python | def dfa(self, ttab: TransitionTable, init: int = 0) -> int:
"""Run a DFA and return the final (negative) state.
Args:
ttab: Transition table (with possible side-effects).
init: Initial state.
Raises:
EndOfInput: If past the end of `self.input`.
"""
... | Run a DFA and return the final (negative) state.
Args:
ttab: Transition table (with possible side-effects).
init: Initial state.
Raises:
EndOfInput: If past the end of `self.input`. | https://github.com/CZ-NIC/yangson/blob/a4b9464041fa8b28f6020a420ababf18fddf5d4a/yangson/parser.py#L98-L115 |
CZ-NIC/yangson | yangson/parser.py | Parser.line_column | def line_column(self) -> Tuple[int, int]:
"""Return line and column coordinates."""
ln = self.input.count("\n", 0, self.offset)
c = (self.offset if ln == 0 else
self.offset - self.input.rfind("\n", 0, self.offset) - 1)
return (ln + 1, c) | python | def line_column(self) -> Tuple[int, int]:
"""Return line and column coordinates."""
ln = self.input.count("\n", 0, self.offset)
c = (self.offset if ln == 0 else
self.offset - self.input.rfind("\n", 0, self.offset) - 1)
return (ln + 1, c) | Return line and column coordinates. | https://github.com/CZ-NIC/yangson/blob/a4b9464041fa8b28f6020a420ababf18fddf5d4a/yangson/parser.py#L117-L122 |
CZ-NIC/yangson | yangson/parser.py | Parser.match_regex | def match_regex(self, regex: Pattern, required: bool = False,
meaning: str = "") -> str:
"""Parse input based on a regular expression .
Args:
regex: Compiled regular expression object.
required: Should the exception be raised on unexpected input?
... | python | def match_regex(self, regex: Pattern, required: bool = False,
meaning: str = "") -> str:
"""Parse input based on a regular expression .
Args:
regex: Compiled regular expression object.
required: Should the exception be raised on unexpected input?
... | Parse input based on a regular expression .
Args:
regex: Compiled regular expression object.
required: Should the exception be raised on unexpected input?
meaning: Meaning of `regex` (for use in error messages).
Raises:
UnexpectedInput: If no syntactical... | https://github.com/CZ-NIC/yangson/blob/a4b9464041fa8b28f6020a420ababf18fddf5d4a/yangson/parser.py#L124-L141 |
CZ-NIC/yangson | yangson/parser.py | Parser.one_of | def one_of(self, chset: str) -> str:
"""Parse one character form the specified set.
Args:
chset: string of characters to try as alternatives.
Returns:
The character that was actually matched.
Raises:
UnexpectedInput: If the next character is not in ... | python | def one_of(self, chset: str) -> str:
"""Parse one character form the specified set.
Args:
chset: string of characters to try as alternatives.
Returns:
The character that was actually matched.
Raises:
UnexpectedInput: If the next character is not in ... | Parse one character form the specified set.
Args:
chset: string of characters to try as alternatives.
Returns:
The character that was actually matched.
Raises:
UnexpectedInput: If the next character is not in `chset`. | https://github.com/CZ-NIC/yangson/blob/a4b9464041fa8b28f6020a420ababf18fddf5d4a/yangson/parser.py#L143-L159 |
CZ-NIC/yangson | yangson/parser.py | Parser.peek | def peek(self) -> str:
"""Return the next character without advancing offset.
Raises:
EndOfInput: If past the end of `self.input`.
"""
try:
return self.input[self.offset]
except IndexError:
raise EndOfInput(self) | python | def peek(self) -> str:
"""Return the next character without advancing offset.
Raises:
EndOfInput: If past the end of `self.input`.
"""
try:
return self.input[self.offset]
except IndexError:
raise EndOfInput(self) | Return the next character without advancing offset.
Raises:
EndOfInput: If past the end of `self.input`. | https://github.com/CZ-NIC/yangson/blob/a4b9464041fa8b28f6020a420ababf18fddf5d4a/yangson/parser.py#L161-L170 |
CZ-NIC/yangson | yangson/parser.py | Parser.prefixed_name | def prefixed_name(self) -> Tuple[YangIdentifier, Optional[YangIdentifier]]:
"""Parse identifier with an optional colon-separated prefix."""
i1 = self.yang_identifier()
try:
next = self.peek()
except EndOfInput:
return (i1, None)
if next != ":":
... | python | def prefixed_name(self) -> Tuple[YangIdentifier, Optional[YangIdentifier]]:
"""Parse identifier with an optional colon-separated prefix."""
i1 = self.yang_identifier()
try:
next = self.peek()
except EndOfInput:
return (i1, None)
if next != ":":
... | Parse identifier with an optional colon-separated prefix. | https://github.com/CZ-NIC/yangson/blob/a4b9464041fa8b28f6020a420ababf18fddf5d4a/yangson/parser.py#L172-L182 |
CZ-NIC/yangson | yangson/parser.py | Parser.remaining | def remaining(self) -> str:
"""Return the remaining part of the input string."""
res = self.input[self.offset:]
self.offset = len(self.input)
return res | python | def remaining(self) -> str:
"""Return the remaining part of the input string."""
res = self.input[self.offset:]
self.offset = len(self.input)
return res | Return the remaining part of the input string. | https://github.com/CZ-NIC/yangson/blob/a4b9464041fa8b28f6020a420ababf18fddf5d4a/yangson/parser.py#L184-L188 |
CZ-NIC/yangson | yangson/parser.py | Parser.up_to | def up_to(self, term: str) -> str:
"""Parse and return segment terminated by the first occurence of a string.
Args:
term: Terminating string.
Raises:
EndOfInput: If `term` does not occur in the rest of the input text.
"""
end = self.input.find(term, self... | python | def up_to(self, term: str) -> str:
"""Parse and return segment terminated by the first occurence of a string.
Args:
term: Terminating string.
Raises:
EndOfInput: If `term` does not occur in the rest of the input text.
"""
end = self.input.find(term, self... | Parse and return segment terminated by the first occurence of a string.
Args:
term: Terminating string.
Raises:
EndOfInput: If `term` does not occur in the rest of the input text. | https://github.com/CZ-NIC/yangson/blob/a4b9464041fa8b28f6020a420ababf18fddf5d4a/yangson/parser.py#L213-L227 |
CZ-NIC/yangson | yangson/constraint.py | Intervals.restrict_with | def restrict_with(self, expr: str, error_tag: str = None,
error_message: str = None) -> None:
"""Combine the receiver with new intervals.
Args:
expr: "range" or "length" expression.
error_tag: error tag of the new expression.
error_message: erro... | python | def restrict_with(self, expr: str, error_tag: str = None,
error_message: str = None) -> None:
"""Combine the receiver with new intervals.
Args:
expr: "range" or "length" expression.
error_tag: error tag of the new expression.
error_message: erro... | Combine the receiver with new intervals.
Args:
expr: "range" or "length" expression.
error_tag: error tag of the new expression.
error_message: error message for the new expression.
Raises:
InvalidArgument: If parsing of `expr` fails. | https://github.com/CZ-NIC/yangson/blob/a4b9464041fa8b28f6020a420ababf18fddf5d4a/yangson/constraint.py#L84-L126 |
coin-or/GiMPy | src/gimpy/tree.py | Tree.add_root | def add_root(self, root, **attrs):
'''
API: add_root(self, root, **attrs)
Description:
Adds root node to the tree with name root and returns root Node
instance.
Input:
root: Root node name.
attrs: Root node attributes.
Post:
... | python | def add_root(self, root, **attrs):
'''
API: add_root(self, root, **attrs)
Description:
Adds root node to the tree with name root and returns root Node
instance.
Input:
root: Root node name.
attrs: Root node attributes.
Post:
... | API: add_root(self, root, **attrs)
Description:
Adds root node to the tree with name root and returns root Node
instance.
Input:
root: Root node name.
attrs: Root node attributes.
Post:
Changes self.root.
Return:
Ret... | https://github.com/coin-or/GiMPy/blob/51853122a50eb6019d06bbdedbfc396a833b5a22/src/gimpy/tree.py#L66-L82 |
coin-or/GiMPy | src/gimpy/tree.py | Tree.add_child | def add_child(self, n, parent, **attrs):
'''
API: add_child(self, n, parent, **attrs)
Description:
Adds child n to node parent and return Node n.
Pre:
Node with name parent should exist.
Input:
n: Child node name.
parent: Parent nod... | python | def add_child(self, n, parent, **attrs):
'''
API: add_child(self, n, parent, **attrs)
Description:
Adds child n to node parent and return Node n.
Pre:
Node with name parent should exist.
Input:
n: Child node name.
parent: Parent nod... | API: add_child(self, n, parent, **attrs)
Description:
Adds child n to node parent and return Node n.
Pre:
Node with name parent should exist.
Input:
n: Child node name.
parent: Parent node name.
attrs: Attributes of node being added.
... | https://github.com/coin-or/GiMPy/blob/51853122a50eb6019d06bbdedbfc396a833b5a22/src/gimpy/tree.py#L84-L104 |
coin-or/GiMPy | src/gimpy/tree.py | Tree.dfs | def dfs(self, root = None, display = None):
'''
API: dfs(self, root = None, display = None)
Description:
Searches tree starting from node named root using depth-first
strategy if root argument is provided. Starts search from root node
of the tree otherwise.
... | python | def dfs(self, root = None, display = None):
'''
API: dfs(self, root = None, display = None)
Description:
Searches tree starting from node named root using depth-first
strategy if root argument is provided. Starts search from root node
of the tree otherwise.
... | API: dfs(self, root = None, display = None)
Description:
Searches tree starting from node named root using depth-first
strategy if root argument is provided. Starts search from root node
of the tree otherwise.
Pre:
Node indicated by root argument should ex... | https://github.com/coin-or/GiMPy/blob/51853122a50eb6019d06bbdedbfc396a833b5a22/src/gimpy/tree.py#L106-L123 |
coin-or/GiMPy | src/gimpy/tree.py | Tree.bfs | def bfs(self, root = None, display = None):
'''
API: bfs(self, root = None, display = None)
Description:
Searches tree starting from node named root using breadth-first
strategy if root argument is provided. Starts search from root node
of the tree otherwise.
... | python | def bfs(self, root = None, display = None):
'''
API: bfs(self, root = None, display = None)
Description:
Searches tree starting from node named root using breadth-first
strategy if root argument is provided. Starts search from root node
of the tree otherwise.
... | API: bfs(self, root = None, display = None)
Description:
Searches tree starting from node named root using breadth-first
strategy if root argument is provided. Starts search from root node
of the tree otherwise.
Pre:
Node indicated by root argument should ... | https://github.com/coin-or/GiMPy/blob/51853122a50eb6019d06bbdedbfc396a833b5a22/src/gimpy/tree.py#L125-L142 |
coin-or/GiMPy | src/gimpy/tree.py | Tree.traverse | def traverse(self, root = None, display = None, q = Stack()):
'''
API: traverse(self, root = None, display = None, q = Stack())
Description:
Traverses tree starting from node named root. Used strategy (BFS,
DFS) is controlled by argument q. It is a DFS if q is Queue(), BF... | python | def traverse(self, root = None, display = None, q = Stack()):
'''
API: traverse(self, root = None, display = None, q = Stack())
Description:
Traverses tree starting from node named root. Used strategy (BFS,
DFS) is controlled by argument q. It is a DFS if q is Queue(), BF... | API: traverse(self, root = None, display = None, q = Stack())
Description:
Traverses tree starting from node named root. Used strategy (BFS,
DFS) is controlled by argument q. It is a DFS if q is Queue(), BFS
if q is Stack(). Starts search from root argument if it is given.
... | https://github.com/coin-or/GiMPy/blob/51853122a50eb6019d06bbdedbfc396a833b5a22/src/gimpy/tree.py#L144-L177 |
coin-or/GiMPy | src/gimpy/tree.py | BinaryTree.add_right_child | def add_right_child(self, n, parent, **attrs):
'''
API: add_right_child(self, n, parent, **attrs)
Description:
Adds right child n to node parent.
Pre:
Right child of parent should not exist.
Input:
n: Node name.
parent: Parent node ... | python | def add_right_child(self, n, parent, **attrs):
'''
API: add_right_child(self, n, parent, **attrs)
Description:
Adds right child n to node parent.
Pre:
Right child of parent should not exist.
Input:
n: Node name.
parent: Parent node ... | API: add_right_child(self, n, parent, **attrs)
Description:
Adds right child n to node parent.
Pre:
Right child of parent should not exist.
Input:
n: Node name.
parent: Parent node name.
attrs: Attributes of node n. | https://github.com/coin-or/GiMPy/blob/51853122a50eb6019d06bbdedbfc396a833b5a22/src/gimpy/tree.py#L209-L226 |
coin-or/GiMPy | src/gimpy/tree.py | BinaryTree.add_left_child | def add_left_child(self, n, parent, **attrs):
'''
API: add_left_child(self, n, parent, **attrs)
Description:
Adds left child n to node parent.
Pre:
Left child of parent should not exist.
Input:
n: Node name.
parent: Parent node name... | python | def add_left_child(self, n, parent, **attrs):
'''
API: add_left_child(self, n, parent, **attrs)
Description:
Adds left child n to node parent.
Pre:
Left child of parent should not exist.
Input:
n: Node name.
parent: Parent node name... | API: add_left_child(self, n, parent, **attrs)
Description:
Adds left child n to node parent.
Pre:
Left child of parent should not exist.
Input:
n: Node name.
parent: Parent node name.
attrs: Attributes of node n. | https://github.com/coin-or/GiMPy/blob/51853122a50eb6019d06bbdedbfc396a833b5a22/src/gimpy/tree.py#L228-L245 |
coin-or/GiMPy | src/gimpy/tree.py | BinaryTree.get_right_child | def get_right_child(self, n):
'''
API: get_right_child(self, n)
Description:
Returns right child of node n. n can be Node() instance or string
(name of node).
Pre:
Node n should be present in the tree.
Input:
n: Node name or Node() ... | python | def get_right_child(self, n):
'''
API: get_right_child(self, n)
Description:
Returns right child of node n. n can be Node() instance or string
(name of node).
Pre:
Node n should be present in the tree.
Input:
n: Node name or Node() ... | API: get_right_child(self, n)
Description:
Returns right child of node n. n can be Node() instance or string
(name of node).
Pre:
Node n should be present in the tree.
Input:
n: Node name or Node() instance.
Return:
Returns name... | https://github.com/coin-or/GiMPy/blob/51853122a50eb6019d06bbdedbfc396a833b5a22/src/gimpy/tree.py#L247-L262 |
coin-or/GiMPy | src/gimpy/tree.py | BinaryTree.get_left_child | def get_left_child(self, n):
'''
API: get_left_child(self, n)
Description:
Returns left child of node n. n can be Node() instance or string
(name of node).
Pre:
Node n should be present in the tree.
Input:
n: Node name or Node() ins... | python | def get_left_child(self, n):
'''
API: get_left_child(self, n)
Description:
Returns left child of node n. n can be Node() instance or string
(name of node).
Pre:
Node n should be present in the tree.
Input:
n: Node name or Node() ins... | API: get_left_child(self, n)
Description:
Returns left child of node n. n can be Node() instance or string
(name of node).
Pre:
Node n should be present in the tree.
Input:
n: Node name or Node() instance.
Return:
Returns name o... | https://github.com/coin-or/GiMPy/blob/51853122a50eb6019d06bbdedbfc396a833b5a22/src/gimpy/tree.py#L264-L279 |
coin-or/GiMPy | src/gimpy/tree.py | BinaryTree.del_node | def del_node(self, n):
'''
API: del_node(self, n)
Description:
Removes node n from tree.
Pre:
Node n should be present in the tree.
Input:
n: Node name.
'''
parent = self.get_node_attr(n, 'parent')
if self.get_node_attr(... | python | def del_node(self, n):
'''
API: del_node(self, n)
Description:
Removes node n from tree.
Pre:
Node n should be present in the tree.
Input:
n: Node name.
'''
parent = self.get_node_attr(n, 'parent')
if self.get_node_attr(... | API: del_node(self, n)
Description:
Removes node n from tree.
Pre:
Node n should be present in the tree.
Input:
n: Node name. | https://github.com/coin-or/GiMPy/blob/51853122a50eb6019d06bbdedbfc396a833b5a22/src/gimpy/tree.py#L281-L296 |
coin-or/GiMPy | src/gimpy/tree.py | BinaryTree.print_nodes | def print_nodes(self, order = 'in', priority = 'L', display = None,
root = None):
'''
API: print_nodes(self, order = 'in', priority = 'L', display = None,
root = None)
Description:
A recursive function that prints nodes to stdout starting from
... | python | def print_nodes(self, order = 'in', priority = 'L', display = None,
root = None):
'''
API: print_nodes(self, order = 'in', priority = 'L', display = None,
root = None)
Description:
A recursive function that prints nodes to stdout starting from
... | API: print_nodes(self, order = 'in', priority = 'L', display = None,
root = None)
Description:
A recursive function that prints nodes to stdout starting from
root.
Input:
order: Order of printing. Acceptable arguments are 'pre', 'in',
'... | https://github.com/coin-or/GiMPy/blob/51853122a50eb6019d06bbdedbfc396a833b5a22/src/gimpy/tree.py#L298-L345 |
coin-or/GiMPy | src/gimpy/tree.py | BinaryTree.dfs | def dfs(self, root = None, display = None, priority = 'L'):
'''
API: dfs(self, root=None, display=None, priority='L', order='in')
Description:
Searches tree starting from node named root using depth-first
strategy if root argument is provided. Starts search from root node... | python | def dfs(self, root = None, display = None, priority = 'L'):
'''
API: dfs(self, root=None, display=None, priority='L', order='in')
Description:
Searches tree starting from node named root using depth-first
strategy if root argument is provided. Starts search from root node... | API: dfs(self, root=None, display=None, priority='L', order='in')
Description:
Searches tree starting from node named root using depth-first
strategy if root argument is provided. Starts search from root node
of the tree otherwise.
Input:
root: Starting no... | https://github.com/coin-or/GiMPy/blob/51853122a50eb6019d06bbdedbfc396a833b5a22/src/gimpy/tree.py#L347-L362 |
coin-or/GiMPy | src/gimpy/tree.py | BinaryTree.bfs | def bfs(self, root = None, display = None, priority = 'L'):
'''
API: bfs(self, root=None, display=None, priority='L', order='in')
Description:
Searches tree starting from node named root using breadth-first
strategy if root argument is provided. Starts search from root no... | python | def bfs(self, root = None, display = None, priority = 'L'):
'''
API: bfs(self, root=None, display=None, priority='L', order='in')
Description:
Searches tree starting from node named root using breadth-first
strategy if root argument is provided. Starts search from root no... | API: bfs(self, root=None, display=None, priority='L', order='in')
Description:
Searches tree starting from node named root using breadth-first
strategy if root argument is provided. Starts search from root node
of the tree otherwise.
Input:
root: Starting ... | https://github.com/coin-or/GiMPy/blob/51853122a50eb6019d06bbdedbfc396a833b5a22/src/gimpy/tree.py#L364-L379 |
coin-or/GiMPy | src/gimpy/tree.py | BinaryTree.traverse | def traverse(self, root = None, display = None, q = Stack(),
priority = 'L'):
'''
API: traverse(self, root=None, display=None, q=Stack(), priority='L',
order='in')
Description:
Traverses tree starting from node named root if root argument is
... | python | def traverse(self, root = None, display = None, q = Stack(),
priority = 'L'):
'''
API: traverse(self, root=None, display=None, q=Stack(), priority='L',
order='in')
Description:
Traverses tree starting from node named root if root argument is
... | API: traverse(self, root=None, display=None, q=Stack(), priority='L',
order='in')
Description:
Traverses tree starting from node named root if root argument is
provided. Starts search from root node of the tree otherwise. Search
strategy is determined by... | https://github.com/coin-or/GiMPy/blob/51853122a50eb6019d06bbdedbfc396a833b5a22/src/gimpy/tree.py#L381-L431 |
CZ-NIC/yangson | tools/python/mkylib.py | module_entry | def module_entry(yfile):
"""Add entry for one file containing YANG module text.
Args:
yfile (file): File containing a YANG module or submodule.
"""
ytxt = yfile.read()
mp = ModuleParser(ytxt)
mst = mp.statement()
submod = mst.keyword == "submodule"
import_only = True
rev = "... | python | def module_entry(yfile):
"""Add entry for one file containing YANG module text.
Args:
yfile (file): File containing a YANG module or submodule.
"""
ytxt = yfile.read()
mp = ModuleParser(ytxt)
mst = mp.statement()
submod = mst.keyword == "submodule"
import_only = True
rev = "... | Add entry for one file containing YANG module text.
Args:
yfile (file): File containing a YANG module or submodule. | https://github.com/CZ-NIC/yangson/blob/a4b9464041fa8b28f6020a420ababf18fddf5d4a/tools/python/mkylib.py#L27-L63 |
CZ-NIC/yangson | yangson/schpattern.py | ConditionalPattern.nullable | def nullable(self, ctype: ContentType) -> bool:
"""Override the superclass method."""
return (not self.check_when() or self.pattern.nullable(ctype)) | python | def nullable(self, ctype: ContentType) -> bool:
"""Override the superclass method."""
return (not self.check_when() or self.pattern.nullable(ctype)) | Override the superclass method. | https://github.com/CZ-NIC/yangson/blob/a4b9464041fa8b28f6020a420ababf18fddf5d4a/yangson/schpattern.py#L138-L140 |
CZ-NIC/yangson | yangson/schpattern.py | ConditionalPattern.deriv | def deriv(self, x: str, ctype: ContentType) -> SchemaPattern:
"""Return derivative of the receiver."""
return (self.pattern.deriv(x, ctype) if self.check_when() else
NotAllowed()) | python | def deriv(self, x: str, ctype: ContentType) -> SchemaPattern:
"""Return derivative of the receiver."""
return (self.pattern.deriv(x, ctype) if self.check_when() else
NotAllowed()) | Return derivative of the receiver. | https://github.com/CZ-NIC/yangson/blob/a4b9464041fa8b28f6020a420ababf18fddf5d4a/yangson/schpattern.py#L142-L145 |
CZ-NIC/yangson | yangson/schpattern.py | Member.deriv | def deriv(self, x: str, ctype: ContentType) -> SchemaPattern:
"""Return derivative of the receiver."""
return (Empty() if
self.name == x and self._active(ctype)
else NotAllowed()) | python | def deriv(self, x: str, ctype: ContentType) -> SchemaPattern:
"""Return derivative of the receiver."""
return (Empty() if
self.name == x and self._active(ctype)
else NotAllowed()) | Return derivative of the receiver. | https://github.com/CZ-NIC/yangson/blob/a4b9464041fa8b28f6020a420ababf18fddf5d4a/yangson/schpattern.py#L175-L179 |
CZ-NIC/yangson | yangson/schpattern.py | Alternative.nullable | def nullable(self, ctype: ContentType) -> bool:
"""Override the superclass method."""
return self.left.nullable(ctype) or self.right.nullable(ctype) | python | def nullable(self, ctype: ContentType) -> bool:
"""Override the superclass method."""
return self.left.nullable(ctype) or self.right.nullable(ctype) | Override the superclass method. | https://github.com/CZ-NIC/yangson/blob/a4b9464041fa8b28f6020a420ababf18fddf5d4a/yangson/schpattern.py#L210-L212 |
CZ-NIC/yangson | yangson/schpattern.py | Alternative.deriv | def deriv(self, x: str, ctype: ContentType) -> SchemaPattern:
"""Return derivative of the receiver."""
return Alternative.combine(self.left.deriv(x, ctype),
self.right.deriv(x, ctype)) | python | def deriv(self, x: str, ctype: ContentType) -> SchemaPattern:
"""Return derivative of the receiver."""
return Alternative.combine(self.left.deriv(x, ctype),
self.right.deriv(x, ctype)) | Return derivative of the receiver. | https://github.com/CZ-NIC/yangson/blob/a4b9464041fa8b28f6020a420ababf18fddf5d4a/yangson/schpattern.py#L214-L217 |
CZ-NIC/yangson | yangson/datamodel.py | DataModel.from_file | def from_file(cls, name: str, mod_path: Tuple[str] = (".",),
description: str = None) -> "DataModel":
"""Initialize the data model from a file with YANG library data.
Args:
name: Name of a file with YANG library data.
mod_path: Tuple of directories where to loo... | python | def from_file(cls, name: str, mod_path: Tuple[str] = (".",),
description: str = None) -> "DataModel":
"""Initialize the data model from a file with YANG library data.
Args:
name: Name of a file with YANG library data.
mod_path: Tuple of directories where to loo... | Initialize the data model from a file with YANG library data.
Args:
name: Name of a file with YANG library data.
mod_path: Tuple of directories where to look for YANG modules.
description: Optional description of the data model.
Returns:
The data model ... | https://github.com/CZ-NIC/yangson/blob/a4b9464041fa8b28f6020a420ababf18fddf5d4a/yangson/datamodel.py#L41-L58 |
CZ-NIC/yangson | yangson/datamodel.py | DataModel.module_set_id | def module_set_id(self) -> str:
"""Compute unique id of YANG modules comprising the data model.
Returns:
String consisting of hexadecimal digits.
"""
fnames = sorted(["@".join(m) for m in self.schema_data.modules])
return hashlib.sha1("".join(fnames).encode("ascii"))... | python | def module_set_id(self) -> str:
"""Compute unique id of YANG modules comprising the data model.
Returns:
String consisting of hexadecimal digits.
"""
fnames = sorted(["@".join(m) for m in self.schema_data.modules])
return hashlib.sha1("".join(fnames).encode("ascii"))... | Compute unique id of YANG modules comprising the data model.
Returns:
String consisting of hexadecimal digits. | https://github.com/CZ-NIC/yangson/blob/a4b9464041fa8b28f6020a420ababf18fddf5d4a/yangson/datamodel.py#L91-L98 |
CZ-NIC/yangson | yangson/datamodel.py | DataModel.from_raw | def from_raw(self, robj: RawObject) -> RootNode:
"""Create an instance node from a raw data tree.
Args:
robj: Dictionary representing a raw data tree.
Returns:
Root instance node.
"""
cooked = self.schema.from_raw(robj)
return RootNode(cooked, se... | python | def from_raw(self, robj: RawObject) -> RootNode:
"""Create an instance node from a raw data tree.
Args:
robj: Dictionary representing a raw data tree.
Returns:
Root instance node.
"""
cooked = self.schema.from_raw(robj)
return RootNode(cooked, se... | Create an instance node from a raw data tree.
Args:
robj: Dictionary representing a raw data tree.
Returns:
Root instance node. | https://github.com/CZ-NIC/yangson/blob/a4b9464041fa8b28f6020a420ababf18fddf5d4a/yangson/datamodel.py#L100-L110 |
CZ-NIC/yangson | yangson/datamodel.py | DataModel.get_schema_node | def get_schema_node(self, path: SchemaPath) -> Optional[SchemaNode]:
"""Return the schema node addressed by a schema path.
Args:
path: Schema path.
Returns:
Schema node if found in the schema, or ``None``.
Raises:
InvalidSchemaPath: If the schema pa... | python | def get_schema_node(self, path: SchemaPath) -> Optional[SchemaNode]:
"""Return the schema node addressed by a schema path.
Args:
path: Schema path.
Returns:
Schema node if found in the schema, or ``None``.
Raises:
InvalidSchemaPath: If the schema pa... | Return the schema node addressed by a schema path.
Args:
path: Schema path.
Returns:
Schema node if found in the schema, or ``None``.
Raises:
InvalidSchemaPath: If the schema path is invalid. | https://github.com/CZ-NIC/yangson/blob/a4b9464041fa8b28f6020a420ababf18fddf5d4a/yangson/datamodel.py#L112-L125 |
CZ-NIC/yangson | yangson/datamodel.py | DataModel.get_data_node | def get_data_node(self, path: DataPath) -> Optional[DataNode]:
"""Return the data node addressed by a data path.
Args:
path: Data path.
Returns:
Data node if found in the schema, or ``None``.
Raises:
InvalidSchemaPath: If the schema path is invalid.... | python | def get_data_node(self, path: DataPath) -> Optional[DataNode]:
"""Return the data node addressed by a data path.
Args:
path: Data path.
Returns:
Data node if found in the schema, or ``None``.
Raises:
InvalidSchemaPath: If the schema path is invalid.... | Return the data node addressed by a data path.
Args:
path: Data path.
Returns:
Data node if found in the schema, or ``None``.
Raises:
InvalidSchemaPath: If the schema path is invalid. | https://github.com/CZ-NIC/yangson/blob/a4b9464041fa8b28f6020a420ababf18fddf5d4a/yangson/datamodel.py#L127-L145 |
CZ-NIC/yangson | yangson/datamodel.py | DataModel.ascii_tree | def ascii_tree(self, no_types: bool = False, val_count: bool = False) -> str:
"""Generate ASCII art representation of the schema tree.
Args:
no_types: Suppress output of data type info.
val_count: Show accumulated validation counts.
Returns:
String with the ... | python | def ascii_tree(self, no_types: bool = False, val_count: bool = False) -> str:
"""Generate ASCII art representation of the schema tree.
Args:
no_types: Suppress output of data type info.
val_count: Show accumulated validation counts.
Returns:
String with the ... | Generate ASCII art representation of the schema tree.
Args:
no_types: Suppress output of data type info.
val_count: Show accumulated validation counts.
Returns:
String with the ASCII tree. | https://github.com/CZ-NIC/yangson/blob/a4b9464041fa8b28f6020a420ababf18fddf5d4a/yangson/datamodel.py#L147-L157 |
CZ-NIC/yangson | yangson/datamodel.py | DataModel.schema_digest | def schema_digest(self) -> str:
"""Generate schema digest (to be used primarily by clients).
Returns:
Condensed information about the schema in JSON format.
"""
res = self.schema._node_digest()
res["config"] = True
return json.dumps(res) | python | def schema_digest(self) -> str:
"""Generate schema digest (to be used primarily by clients).
Returns:
Condensed information about the schema in JSON format.
"""
res = self.schema._node_digest()
res["config"] = True
return json.dumps(res) | Generate schema digest (to be used primarily by clients).
Returns:
Condensed information about the schema in JSON format. | https://github.com/CZ-NIC/yangson/blob/a4b9464041fa8b28f6020a420ababf18fddf5d4a/yangson/datamodel.py#L169-L177 |
CZ-NIC/yangson | yangson/xpathparser.py | XPathParser._qname | def _qname(self) -> Optional[QualName]:
"""Parse XML QName."""
if self.test_string("*"):
self.skip_ws()
return False
ident = self.yang_identifier()
ws = self.skip_ws()
try:
next = self.peek()
except EndOfInput:
return ident,... | python | def _qname(self) -> Optional[QualName]:
"""Parse XML QName."""
if self.test_string("*"):
self.skip_ws()
return False
ident = self.yang_identifier()
ws = self.skip_ws()
try:
next = self.peek()
except EndOfInput:
return ident,... | Parse XML QName. | https://github.com/CZ-NIC/yangson/blob/a4b9464041fa8b28f6020a420ababf18fddf5d4a/yangson/xpathparser.py#L303-L323 |
coin-or/GiMPy | src/gimpy/global_constants.py | needs_quotes | def needs_quotes(s):
"""Checks whether a string is a dot language ID.
It will check whether the string is solely composed
by the characters allowed in an ID or not.
If the string is one of the reserved keywords it will
need quotes too but the user will need to add them
manually.
"""
# If... | python | def needs_quotes(s):
"""Checks whether a string is a dot language ID.
It will check whether the string is solely composed
by the characters allowed in an ID or not.
If the string is one of the reserved keywords it will
need quotes too but the user will need to add them
manually.
"""
# If... | Checks whether a string is a dot language ID.
It will check whether the string is solely composed
by the characters allowed in an ID or not.
If the string is one of the reserved keywords it will
need quotes too but the user will need to add them
manually. | https://github.com/coin-or/GiMPy/blob/51853122a50eb6019d06bbdedbfc396a833b5a22/src/gimpy/global_constants.py#L147-L172 |
CZ-NIC/yangson | yangson/__main__.py | main | def main(ylib: str = None, path: str = None,
scope: ValidationScope = ValidationScope.all,
ctype: ContentType = ContentType.config, set_id: bool = False,
tree: bool = False, no_types: bool = False,
digest: bool = False, validate: str = None) -> int:
"""Entry-point for a validatio... | python | def main(ylib: str = None, path: str = None,
scope: ValidationScope = ValidationScope.all,
ctype: ContentType = ContentType.config, set_id: bool = False,
tree: bool = False, no_types: bool = False,
digest: bool = False, validate: str = None) -> int:
"""Entry-point for a validatio... | Entry-point for a validation script.
Args:
ylib: Name of the file with YANG library
path: Colon-separated list of directories to search for YANG modules.
scope: Validation scope (syntax, semantics or all).
ctype: Content type of the data instance (config, nonconfig or all)
... | https://github.com/CZ-NIC/yangson/blob/a4b9464041fa8b28f6020a420ababf18fddf5d4a/yangson/__main__.py#L34-L165 |
coin-or/GiMPy | src/gimpy/graph.py | Node.to_string | def to_string(self):
'''
API: to_string(self)
Description:
Returns string representation of node in dot language.
Return:
String representation of node.
'''
node = list()
node.append(quote_if_necessary(str(self.name)))
node.append(' [')... | python | def to_string(self):
'''
API: to_string(self)
Description:
Returns string representation of node in dot language.
Return:
String representation of node.
'''
node = list()
node.append(quote_if_necessary(str(self.name)))
node.append(' [')... | API: to_string(self)
Description:
Returns string representation of node in dot language.
Return:
String representation of node. | https://github.com/coin-or/GiMPy/blob/51853122a50eb6019d06bbdedbfc396a833b5a22/src/gimpy/graph.py#L160-L181 |
coin-or/GiMPy | src/gimpy/graph.py | Graph.add_node | def add_node(self, name, **attr):
'''
API: add_node(self, name, **attr)
Description:
Adds node to the graph.
Pre:
Graph should not contain a node with this name. We do not allow
multiple nodes with the same name.
Input:
name: Name of th... | python | def add_node(self, name, **attr):
'''
API: add_node(self, name, **attr)
Description:
Adds node to the graph.
Pre:
Graph should not contain a node with this name. We do not allow
multiple nodes with the same name.
Input:
name: Name of th... | API: add_node(self, name, **attr)
Description:
Adds node to the graph.
Pre:
Graph should not contain a node with this name. We do not allow
multiple nodes with the same name.
Input:
name: Name of the node.
attr: Node attributes.
Pos... | https://github.com/coin-or/GiMPy/blob/51853122a50eb6019d06bbdedbfc396a833b5a22/src/gimpy/graph.py#L286-L308 |
coin-or/GiMPy | src/gimpy/graph.py | Graph.del_node | def del_node(self, name):
'''
API: del_node(self, name)
Description:
Removes node from Graph.
Input:
name: Name of the node.
Pre:
Graph should contain a node with this name.
Post:
self.neighbors, self.nodes and self.in_neighbors... | python | def del_node(self, name):
'''
API: del_node(self, name)
Description:
Removes node from Graph.
Input:
name: Name of the node.
Pre:
Graph should contain a node with this name.
Post:
self.neighbors, self.nodes and self.in_neighbors... | API: del_node(self, name)
Description:
Removes node from Graph.
Input:
name: Name of the node.
Pre:
Graph should contain a node with this name.
Post:
self.neighbors, self.nodes and self.in_neighbors are updated. | https://github.com/coin-or/GiMPy/blob/51853122a50eb6019d06bbdedbfc396a833b5a22/src/gimpy/graph.py#L310-L336 |
coin-or/GiMPy | src/gimpy/graph.py | Graph.add_edge | def add_edge(self, name1, name2, **attr):
'''
API: add_edge(self, name1, name2, **attr)
Description:
Adds edge to the graph. Sets edge attributes using attr argument.
Input:
name1: Name of the source node (if directed).
name2: Name of the sink node (if dir... | python | def add_edge(self, name1, name2, **attr):
'''
API: add_edge(self, name1, name2, **attr)
Description:
Adds edge to the graph. Sets edge attributes using attr argument.
Input:
name1: Name of the source node (if directed).
name2: Name of the sink node (if dir... | API: add_edge(self, name1, name2, **attr)
Description:
Adds edge to the graph. Sets edge attributes using attr argument.
Input:
name1: Name of the source node (if directed).
name2: Name of the sink node (if directed).
attr: Edge attributes.
Pre:
... | https://github.com/coin-or/GiMPy/blob/51853122a50eb6019d06bbdedbfc396a833b5a22/src/gimpy/graph.py#L338-L370 |
coin-or/GiMPy | src/gimpy/graph.py | Graph.del_edge | def del_edge(self, e):
'''
API: del_edge(self, e)
Description:
Removes edge from graph.
Input:
e: Tuple that represents edge, in (source,sink) form.
Pre:
Graph should contain this edge.
Post:
self.edge_attr, self.neighbors and s... | python | def del_edge(self, e):
'''
API: del_edge(self, e)
Description:
Removes edge from graph.
Input:
e: Tuple that represents edge, in (source,sink) form.
Pre:
Graph should contain this edge.
Post:
self.edge_attr, self.neighbors and s... | API: del_edge(self, e)
Description:
Removes edge from graph.
Input:
e: Tuple that represents edge, in (source,sink) form.
Pre:
Graph should contain this edge.
Post:
self.edge_attr, self.neighbors and self.in_neighbors are updated. | https://github.com/coin-or/GiMPy/blob/51853122a50eb6019d06bbdedbfc396a833b5a22/src/gimpy/graph.py#L372-L400 |
coin-or/GiMPy | src/gimpy/graph.py | Graph.check_edge | def check_edge(self, name1, name2):
'''
API: check_edge(self, name1, name2)
Description:
Return True if edge exists, False otherwise.
Input:
name1: name of the source node.
name2: name of the sink node.
Return:
Returns True if edge exis... | python | def check_edge(self, name1, name2):
'''
API: check_edge(self, name1, name2)
Description:
Return True if edge exists, False otherwise.
Input:
name1: name of the source node.
name2: name of the sink node.
Return:
Returns True if edge exis... | API: check_edge(self, name1, name2)
Description:
Return True if edge exists, False otherwise.
Input:
name1: name of the source node.
name2: name of the sink node.
Return:
Returns True if edge exists, False otherwise. | https://github.com/coin-or/GiMPy/blob/51853122a50eb6019d06bbdedbfc396a833b5a22/src/gimpy/graph.py#L429-L444 |
coin-or/GiMPy | src/gimpy/graph.py | Graph.get_edge_attr | def get_edge_attr(self, n, m, attr):
'''
API: get_edge_attr(self, n, m, attr)
Description:
Returns attribute attr of edge (n,m).
Input:
n: Source node name.
m: Sink node name.
attr: Attribute of edge.
Pre:
Graph should have ... | python | def get_edge_attr(self, n, m, attr):
'''
API: get_edge_attr(self, n, m, attr)
Description:
Returns attribute attr of edge (n,m).
Input:
n: Source node name.
m: Sink node name.
attr: Attribute of edge.
Pre:
Graph should have ... | API: get_edge_attr(self, n, m, attr)
Description:
Returns attribute attr of edge (n,m).
Input:
n: Source node name.
m: Sink node name.
attr: Attribute of edge.
Pre:
Graph should have this edge.
Return:
Value of edge attr... | https://github.com/coin-or/GiMPy/blob/51853122a50eb6019d06bbdedbfc396a833b5a22/src/gimpy/graph.py#L501-L521 |
coin-or/GiMPy | src/gimpy/graph.py | Graph.set_node_attr | def set_node_attr(self, name, attr, value):
'''
API: set_node_attr(self, name, attr)
Description:
Sets attr attribute of node named name to value.
Input:
name: Name of node.
attr: Attribute of node to set.
Pre:
Graph should have this no... | python | def set_node_attr(self, name, attr, value):
'''
API: set_node_attr(self, name, attr)
Description:
Sets attr attribute of node named name to value.
Input:
name: Name of node.
attr: Attribute of node to set.
Pre:
Graph should have this no... | API: set_node_attr(self, name, attr)
Description:
Sets attr attribute of node named name to value.
Input:
name: Name of node.
attr: Attribute of node to set.
Pre:
Graph should have this node.
Post:
Node attribute will be updated. | https://github.com/coin-or/GiMPy/blob/51853122a50eb6019d06bbdedbfc396a833b5a22/src/gimpy/graph.py#L523-L536 |
coin-or/GiMPy | src/gimpy/graph.py | Graph.set_edge_attr | def set_edge_attr(self, n, m, attr, value):
'''
API: set_edge_attr(self, n, m, attr, value)
Description:
Sets attr attribute of edge (n,m) to value.
Input:
n: Source node name.
m: Sink node name.
attr: Attribute of edge to set.
valu... | python | def set_edge_attr(self, n, m, attr, value):
'''
API: set_edge_attr(self, n, m, attr, value)
Description:
Sets attr attribute of edge (n,m) to value.
Input:
n: Source node name.
m: Sink node name.
attr: Attribute of edge to set.
valu... | API: set_edge_attr(self, n, m, attr, value)
Description:
Sets attr attribute of edge (n,m) to value.
Input:
n: Source node name.
m: Sink node name.
attr: Attribute of edge to set.
value: New value of attribute.
Pre:
Graph should... | https://github.com/coin-or/GiMPy/blob/51853122a50eb6019d06bbdedbfc396a833b5a22/src/gimpy/graph.py#L538-L559 |
coin-or/GiMPy | src/gimpy/graph.py | Graph.edge_to_string | def edge_to_string(self, e):
'''
API: edge_to_string(self, e)
Description:
Return string that represents edge e in dot language.
Input:
e: Edge tuple in (source,sink) format.
Pre:
Graph should have this edge.
Return:
String that... | python | def edge_to_string(self, e):
'''
API: edge_to_string(self, e)
Description:
Return string that represents edge e in dot language.
Input:
e: Edge tuple in (source,sink) format.
Pre:
Graph should have this edge.
Return:
String that... | API: edge_to_string(self, e)
Description:
Return string that represents edge e in dot language.
Input:
e: Edge tuple in (source,sink) format.
Pre:
Graph should have this edge.
Return:
String that represents given edge. | https://github.com/coin-or/GiMPy/blob/51853122a50eb6019d06bbdedbfc396a833b5a22/src/gimpy/graph.py#L603-L630 |
coin-or/GiMPy | src/gimpy/graph.py | Graph.to_string | def to_string(self):
'''
API: to_string(self)
Description:
This method is based on pydot Graph class with the same name.
Returns a string representation of the graph in dot language.
It will return the graph and all its subelements in string form.
Return:
... | python | def to_string(self):
'''
API: to_string(self)
Description:
This method is based on pydot Graph class with the same name.
Returns a string representation of the graph in dot language.
It will return the graph and all its subelements in string form.
Return:
... | API: to_string(self)
Description:
This method is based on pydot Graph class with the same name.
Returns a string representation of the graph in dot language.
It will return the graph and all its subelements in string form.
Return:
String that represents graph in dot l... | https://github.com/coin-or/GiMPy/blob/51853122a50eb6019d06bbdedbfc396a833b5a22/src/gimpy/graph.py#L632-L697 |
coin-or/GiMPy | src/gimpy/graph.py | Graph.label_components | def label_components(self, display = None):
'''
API: label_components(self, display=None)
Description:
This method labels the nodes of an undirected graph with component
numbers so that each node has the same label as all nodes in the
same component. It will display the a... | python | def label_components(self, display = None):
'''
API: label_components(self, display=None)
Description:
This method labels the nodes of an undirected graph with component
numbers so that each node has the same label as all nodes in the
same component. It will display the a... | API: label_components(self, display=None)
Description:
This method labels the nodes of an undirected graph with component
numbers so that each node has the same label as all nodes in the
same component. It will display the algortihm if display argument is
provided.
Input:... | https://github.com/coin-or/GiMPy/blob/51853122a50eb6019d06bbdedbfc396a833b5a22/src/gimpy/graph.py#L699-L727 |
coin-or/GiMPy | src/gimpy/graph.py | Graph.tarjan | def tarjan(self):
'''
API: tarjan(self)
Description:
Implements Tarjan's algorithm for determining strongly connected set of
nodes.
Pre:
self.graph_type should be DIRECTED_GRAPH.
Post:
Nodes will have 'component' attribute that will have co... | python | def tarjan(self):
'''
API: tarjan(self)
Description:
Implements Tarjan's algorithm for determining strongly connected set of
nodes.
Pre:
self.graph_type should be DIRECTED_GRAPH.
Post:
Nodes will have 'component' attribute that will have co... | API: tarjan(self)
Description:
Implements Tarjan's algorithm for determining strongly connected set of
nodes.
Pre:
self.graph_type should be DIRECTED_GRAPH.
Post:
Nodes will have 'component' attribute that will have component
number as value. C... | https://github.com/coin-or/GiMPy/blob/51853122a50eb6019d06bbdedbfc396a833b5a22/src/gimpy/graph.py#L729-L746 |
coin-or/GiMPy | src/gimpy/graph.py | Graph.strong_connect | def strong_connect(self, q, node, index, component):
'''
API: strong_connect (self, q, node, index, component)
Description:
Used by tarjan method. This method should not be called directly by
user.
Input:
q: Node list.
node: Node that is being conn... | python | def strong_connect(self, q, node, index, component):
'''
API: strong_connect (self, q, node, index, component)
Description:
Used by tarjan method. This method should not be called directly by
user.
Input:
q: Node list.
node: Node that is being conn... | API: strong_connect (self, q, node, index, component)
Description:
Used by tarjan method. This method should not be called directly by
user.
Input:
q: Node list.
node: Node that is being connected to nodes in q.
index: Index used by tarjan method.
... | https://github.com/coin-or/GiMPy/blob/51853122a50eb6019d06bbdedbfc396a833b5a22/src/gimpy/graph.py#L748-L790 |
coin-or/GiMPy | src/gimpy/graph.py | Graph.dfs | def dfs(self, root, disc_count = 0, finish_count = 1, component = None,
transpose = False, display = None, pred = None):
'''
API: dfs(self, root, disc_count = 0, finish_count = 1, component=None,
transpose=False)
Description:
Make a depth-first search starting fro... | python | def dfs(self, root, disc_count = 0, finish_count = 1, component = None,
transpose = False, display = None, pred = None):
'''
API: dfs(self, root, disc_count = 0, finish_count = 1, component=None,
transpose=False)
Description:
Make a depth-first search starting fro... | API: dfs(self, root, disc_count = 0, finish_count = 1, component=None,
transpose=False)
Description:
Make a depth-first search starting from node with name root.
Input:
root: Starting node name.
disc_count: Discovery time.
finish_count: Finishing t... | https://github.com/coin-or/GiMPy/blob/51853122a50eb6019d06bbdedbfc396a833b5a22/src/gimpy/graph.py#L808-L877 |
coin-or/GiMPy | src/gimpy/graph.py | Graph.bfs | def bfs(self, root, display = None, component = None):
'''
API: bfs(self, root, display = None, component=None)
Description:
Make a breadth-first search starting from node with name root.
Input:
root: Starting node name.
display: display method.
... | python | def bfs(self, root, display = None, component = None):
'''
API: bfs(self, root, display = None, component=None)
Description:
Make a breadth-first search starting from node with name root.
Input:
root: Starting node name.
display: display method.
... | API: bfs(self, root, display = None, component=None)
Description:
Make a breadth-first search starting from node with name root.
Input:
root: Starting node name.
display: display method.
component: component number.
Post:
Nodes will have 'c... | https://github.com/coin-or/GiMPy/blob/51853122a50eb6019d06bbdedbfc396a833b5a22/src/gimpy/graph.py#L879-L892 |
coin-or/GiMPy | src/gimpy/graph.py | Graph.search | def search(self, source, destination = None, display = None,
component = None, q = None,
algo = 'DFS', reverse = False, **kargs):
'''
API: search(self, source, destination = None, display = None,
component = None, q = Stack(),
algo = 'DFS', rev... | python | def search(self, source, destination = None, display = None,
component = None, q = None,
algo = 'DFS', reverse = False, **kargs):
'''
API: search(self, source, destination = None, display = None,
component = None, q = Stack(),
algo = 'DFS', rev... | API: search(self, source, destination = None, display = None,
component = None, q = Stack(),
algo = 'DFS', reverse = False, **kargs)
Description:
Generic search method. Changes behavior (dfs,bfs,dijkstra,prim)
according to algo argument.
if destination is no... | https://github.com/coin-or/GiMPy/blob/51853122a50eb6019d06bbdedbfc396a833b5a22/src/gimpy/graph.py#L894-L1013 |
coin-or/GiMPy | src/gimpy/graph.py | Graph.process_node_search | def process_node_search(self, node, q, **kwargs):
'''
API: process_node_search(self, node, q, **kwargs)
Description:
Used by search() method. Process nodes along the search. Should not be
called by user directly.
Input:
node: Name of the node being processed.
... | python | def process_node_search(self, node, q, **kwargs):
'''
API: process_node_search(self, node, q, **kwargs)
Description:
Used by search() method. Process nodes along the search. Should not be
called by user directly.
Input:
node: Name of the node being processed.
... | API: process_node_search(self, node, q, **kwargs)
Description:
Used by search() method. Process nodes along the search. Should not be
called by user directly.
Input:
node: Name of the node being processed.
q: Queue data structure.
kwargs: Keyword argum... | https://github.com/coin-or/GiMPy/blob/51853122a50eb6019d06bbdedbfc396a833b5a22/src/gimpy/graph.py#L1015-L1029 |
coin-or/GiMPy | src/gimpy/graph.py | Graph.process_edge_dijkstra | def process_edge_dijkstra(self, current, neighbor, pred, q, component):
'''
API: process_edge_dijkstra(self, current, neighbor, pred, q, component)
Description:
Used by search() method if the algo argument is 'Dijkstra'. Processes
edges along Dijkstra's algorithm. User does not n... | python | def process_edge_dijkstra(self, current, neighbor, pred, q, component):
'''
API: process_edge_dijkstra(self, current, neighbor, pred, q, component)
Description:
Used by search() method if the algo argument is 'Dijkstra'. Processes
edges along Dijkstra's algorithm. User does not n... | API: process_edge_dijkstra(self, current, neighbor, pred, q, component)
Description:
Used by search() method if the algo argument is 'Dijkstra'. Processes
edges along Dijkstra's algorithm. User does not need to call this
method directly.
Input:
current: Name of the cu... | https://github.com/coin-or/GiMPy/blob/51853122a50eb6019d06bbdedbfc396a833b5a22/src/gimpy/graph.py#L1031-L1062 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.