openc2lib.types.data.nsid

 1class Nsid(str):
 2	""" OpenC2 Namespace Identifier
 3
 4		Namespace identifiers are described in Sec. 3.1.4. This class implements the required
 5			controls on the string length.
 6	"""
 7	def __init__(self, nsid):
 8		""" Initialize `Nsid`
 9
10			:param nsid: Text string (must be more than 1 and less than 16 characters.
11		"""
12		if len(nsid) > 16 or len(nsid) < 1:
13			raise ValueError("Nsid must be between 1 and 16 characters")
14		self = nsid
15
16	@classmethod
17	def fromdict(cls, name, e):
18		""" Create `Nsid` instance
19
20			Create `Nsid` instance from string.
21			This method is provided to deserialize an OpenC2 message according to the openc2lib approach.
22			This method should only be used internally the openc2lib.
23			:param name: Text string with the namespace identifier..
24			:param e: `Encoder` instance to be used (only included to be compliance with the function footprint.
25			:return: `Version` instance.
26		"""
27		return Nsid(name)
28	
class Nsid(builtins.str):
 3class Nsid(str):
 4	""" OpenC2 Namespace Identifier
 5
 6		Namespace identifiers are described in Sec. 3.1.4. This class implements the required
 7			controls on the string length.
 8	"""
 9	def __init__(self, nsid):
10		""" Initialize `Nsid`
11
12			:param nsid: Text string (must be more than 1 and less than 16 characters.
13		"""
14		if len(nsid) > 16 or len(nsid) < 1:
15			raise ValueError("Nsid must be between 1 and 16 characters")
16		self = nsid
17
18	@classmethod
19	def fromdict(cls, name, e):
20		""" Create `Nsid` instance
21
22			Create `Nsid` instance from string.
23			This method is provided to deserialize an OpenC2 message according to the openc2lib approach.
24			This method should only be used internally the openc2lib.
25			:param name: Text string with the namespace identifier..
26			:param e: `Encoder` instance to be used (only included to be compliance with the function footprint.
27			:return: `Version` instance.
28		"""
29		return Nsid(name)

OpenC2 Namespace Identifier

Namespace identifiers are described in Sec. 3.1.4. This class implements the required controls on the string length.

Nsid(nsid)
 9	def __init__(self, nsid):
10		""" Initialize `Nsid`
11
12			:param nsid: Text string (must be more than 1 and less than 16 characters.
13		"""
14		if len(nsid) > 16 or len(nsid) < 1:
15			raise ValueError("Nsid must be between 1 and 16 characters")
16		self = nsid

Initialize Nsid

Parameters
  • nsid: Text string (must be more than 1 and less than 16 characters.
@classmethod
def fromdict(cls, name, e):
18	@classmethod
19	def fromdict(cls, name, e):
20		""" Create `Nsid` instance
21
22			Create `Nsid` instance from string.
23			This method is provided to deserialize an OpenC2 message according to the openc2lib approach.
24			This method should only be used internally the openc2lib.
25			:param name: Text string with the namespace identifier..
26			:param e: `Encoder` instance to be used (only included to be compliance with the function footprint.
27			:return: `Version` instance.
28		"""
29		return Nsid(name)

Create Nsid instance

Create Nsid instance from string. This method is provided to deserialize an OpenC2 message according to the openc2lib approach. This method should only be used internally the openc2lib.

Parameters
  • name: Text string with the namespace identifier..
  • e: Encoder instance to be used (only included to be compliance with the function footprint.
Returns

Version instance.

Inherited Members
builtins.str
encode
replace
split
rsplit
join
capitalize
casefold
title
center
count
expandtabs
find
partition
index
ljust
lower
lstrip
rfind
rindex
rjust
rstrip
rpartition
splitlines
strip
swapcase
translate
upper
startswith
endswith
removeprefix
removesuffix
isascii
islower
isupper
istitle
isspace
isdecimal
isdigit
isnumeric
isalpha
isalnum
isidentifier
isprintable
zfill
format
format_map
maketrans