body_hash stringlengths 64 64 | body stringlengths 23 109k | docstring stringlengths 1 57k | path stringlengths 4 198 | name stringlengths 1 115 | repository_name stringlengths 7 111 | repository_stars float64 0 191k | lang stringclasses 1 value | body_without_docstring stringlengths 14 108k | unified stringlengths 45 133k |
|---|---|---|---|---|---|---|---|---|---|
ba74b4b01c3456270191df9de337376b498b7b40d7f221f1dbd7ab6fa2d6cc49 | def forward(self, species_coordinates: Tuple[(Tensor, Tensor)], cell: Optional[Tensor]=None, pbc: Optional[Tensor]=None) -> SpeciesEnergies:
'Calculates predicted properties for minibatch of configurations\n\n Args:\n species_coordinates: minibatch of configurations\n cell: the cell used in PBC computation, set to None if PBC is not enabled\n pbc: the bool tensor indicating which direction PBC is enabled, set to None if PBC is not enabled\n\n Returns:\n species_energies: energies for the given configurations\n\n .. note:: The coordinates, and cell are in Angstrom, and the energies\n will be in Hartree.\n '
if self.periodic_table_index:
species_coordinates = self.species_converter(species_coordinates)
species_aevs = self.aev_computer(species_coordinates, cell=cell, pbc=pbc)
species_energies = self.neural_networks(species_aevs)
return self.energy_shifter(species_energies) | Calculates predicted properties for minibatch of configurations
Args:
species_coordinates: minibatch of configurations
cell: the cell used in PBC computation, set to None if PBC is not enabled
pbc: the bool tensor indicating which direction PBC is enabled, set to None if PBC is not enabled
Returns:
species_energies: energies for the given configurations
.. note:: The coordinates, and cell are in Angstrom, and the energies
will be in Hartree. | torchani/models.py | forward | akhdhys/torchani | 0 | python | def forward(self, species_coordinates: Tuple[(Tensor, Tensor)], cell: Optional[Tensor]=None, pbc: Optional[Tensor]=None) -> SpeciesEnergies:
'Calculates predicted properties for minibatch of configurations\n\n Args:\n species_coordinates: minibatch of configurations\n cell: the cell used in PBC computation, set to None if PBC is not enabled\n pbc: the bool tensor indicating which direction PBC is enabled, set to None if PBC is not enabled\n\n Returns:\n species_energies: energies for the given configurations\n\n .. note:: The coordinates, and cell are in Angstrom, and the energies\n will be in Hartree.\n '
if self.periodic_table_index:
species_coordinates = self.species_converter(species_coordinates)
species_aevs = self.aev_computer(species_coordinates, cell=cell, pbc=pbc)
species_energies = self.neural_networks(species_aevs)
return self.energy_shifter(species_energies) | def forward(self, species_coordinates: Tuple[(Tensor, Tensor)], cell: Optional[Tensor]=None, pbc: Optional[Tensor]=None) -> SpeciesEnergies:
'Calculates predicted properties for minibatch of configurations\n\n Args:\n species_coordinates: minibatch of configurations\n cell: the cell used in PBC computation, set to None if PBC is not enabled\n pbc: the bool tensor indicating which direction PBC is enabled, set to None if PBC is not enabled\n\n Returns:\n species_energies: energies for the given configurations\n\n .. note:: The coordinates, and cell are in Angstrom, and the energies\n will be in Hartree.\n '
if self.periodic_table_index:
species_coordinates = self.species_converter(species_coordinates)
species_aevs = self.aev_computer(species_coordinates, cell=cell, pbc=pbc)
species_energies = self.neural_networks(species_aevs)
return self.energy_shifter(species_energies)<|docstring|>Calculates predicted properties for minibatch of configurations
Args:
species_coordinates: minibatch of configurations
cell: the cell used in PBC computation, set to None if PBC is not enabled
pbc: the bool tensor indicating which direction PBC is enabled, set to None if PBC is not enabled
Returns:
species_energies: energies for the given configurations
.. note:: The coordinates, and cell are in Angstrom, and the energies
will be in Hartree.<|endoftext|> |
3aa27247fd859a7d612e6ef99bddc510848453e9402b49c1e52797598813097a | def __getitem__(self, index):
"Get a single 'AEVComputer -> ANIModel -> EnergyShifter' sequential model\n\n Indexing allows access to a single model inside the ensemble\n that can be used directly for calculations. The model consists\n of a sequence AEVComputer -> ANIModel -> EnergyShifter\n and can return an ase calculator and convert species to tensor.\n\n Args:\n index (:class:`int`): Index of the model\n\n Returns:\n ret: (:class:`Sequential`): Sequential model ready for\n calculations\n "
if self.periodic_table_index:
ret = Sequential(self.species_converter, self.aev_computer, self.neural_networks[index], self.energy_shifter)
else:
ret = Sequential(self.aev_computer, self.neural_networks[index], self.energy_shifter)
def ase(**kwargs):
'Attach an ase calculator '
from . import ase
return ase.Calculator(self.species, ret, **kwargs)
ret.ase = ase
ret.species_to_tensor = self.consts.species_to_tensor
return ret | Get a single 'AEVComputer -> ANIModel -> EnergyShifter' sequential model
Indexing allows access to a single model inside the ensemble
that can be used directly for calculations. The model consists
of a sequence AEVComputer -> ANIModel -> EnergyShifter
and can return an ase calculator and convert species to tensor.
Args:
index (:class:`int`): Index of the model
Returns:
ret: (:class:`Sequential`): Sequential model ready for
calculations | torchani/models.py | __getitem__ | akhdhys/torchani | 0 | python | def __getitem__(self, index):
"Get a single 'AEVComputer -> ANIModel -> EnergyShifter' sequential model\n\n Indexing allows access to a single model inside the ensemble\n that can be used directly for calculations. The model consists\n of a sequence AEVComputer -> ANIModel -> EnergyShifter\n and can return an ase calculator and convert species to tensor.\n\n Args:\n index (:class:`int`): Index of the model\n\n Returns:\n ret: (:class:`Sequential`): Sequential model ready for\n calculations\n "
if self.periodic_table_index:
ret = Sequential(self.species_converter, self.aev_computer, self.neural_networks[index], self.energy_shifter)
else:
ret = Sequential(self.aev_computer, self.neural_networks[index], self.energy_shifter)
def ase(**kwargs):
'Attach an ase calculator '
from . import ase
return ase.Calculator(self.species, ret, **kwargs)
ret.ase = ase
ret.species_to_tensor = self.consts.species_to_tensor
return ret | def __getitem__(self, index):
"Get a single 'AEVComputer -> ANIModel -> EnergyShifter' sequential model\n\n Indexing allows access to a single model inside the ensemble\n that can be used directly for calculations. The model consists\n of a sequence AEVComputer -> ANIModel -> EnergyShifter\n and can return an ase calculator and convert species to tensor.\n\n Args:\n index (:class:`int`): Index of the model\n\n Returns:\n ret: (:class:`Sequential`): Sequential model ready for\n calculations\n "
if self.periodic_table_index:
ret = Sequential(self.species_converter, self.aev_computer, self.neural_networks[index], self.energy_shifter)
else:
ret = Sequential(self.aev_computer, self.neural_networks[index], self.energy_shifter)
def ase(**kwargs):
'Attach an ase calculator '
from . import ase
return ase.Calculator(self.species, ret, **kwargs)
ret.ase = ase
ret.species_to_tensor = self.consts.species_to_tensor
return ret<|docstring|>Get a single 'AEVComputer -> ANIModel -> EnergyShifter' sequential model
Indexing allows access to a single model inside the ensemble
that can be used directly for calculations. The model consists
of a sequence AEVComputer -> ANIModel -> EnergyShifter
and can return an ase calculator and convert species to tensor.
Args:
index (:class:`int`): Index of the model
Returns:
ret: (:class:`Sequential`): Sequential model ready for
calculations<|endoftext|> |
f715fbe24231ba8cb4a8633a4fda1268ec27dca9ef933cf43f03cd2ea45e7596 | def __len__(self):
'Get the number of networks in the ensemble\n\n Returns:\n length (:class:`int`): Number of networks in the ensemble\n '
return len(self.neural_networks) | Get the number of networks in the ensemble
Returns:
length (:class:`int`): Number of networks in the ensemble | torchani/models.py | __len__ | akhdhys/torchani | 0 | python | def __len__(self):
'Get the number of networks in the ensemble\n\n Returns:\n length (:class:`int`): Number of networks in the ensemble\n '
return len(self.neural_networks) | def __len__(self):
'Get the number of networks in the ensemble\n\n Returns:\n length (:class:`int`): Number of networks in the ensemble\n '
return len(self.neural_networks)<|docstring|>Get the number of networks in the ensemble
Returns:
length (:class:`int`): Number of networks in the ensemble<|endoftext|> |
bb085bb26bee7f47a80b202c47df1108ac5c1f5e49ad701f1cc5ce6cb709bccc | def ase(self, **kwargs):
'Get an ASE Calculator using this ANI model ensemble\n\n Arguments:\n kwargs: ase.Calculator kwargs\n\n Returns:\n calculator (:class:`int`): A calculator to be used with ASE\n '
from . import ase
return ase.Calculator(self.species, self, **kwargs) | Get an ASE Calculator using this ANI model ensemble
Arguments:
kwargs: ase.Calculator kwargs
Returns:
calculator (:class:`int`): A calculator to be used with ASE | torchani/models.py | ase | akhdhys/torchani | 0 | python | def ase(self, **kwargs):
'Get an ASE Calculator using this ANI model ensemble\n\n Arguments:\n kwargs: ase.Calculator kwargs\n\n Returns:\n calculator (:class:`int`): A calculator to be used with ASE\n '
from . import ase
return ase.Calculator(self.species, self, **kwargs) | def ase(self, **kwargs):
'Get an ASE Calculator using this ANI model ensemble\n\n Arguments:\n kwargs: ase.Calculator kwargs\n\n Returns:\n calculator (:class:`int`): A calculator to be used with ASE\n '
from . import ase
return ase.Calculator(self.species, self, **kwargs)<|docstring|>Get an ASE Calculator using this ANI model ensemble
Arguments:
kwargs: ase.Calculator kwargs
Returns:
calculator (:class:`int`): A calculator to be used with ASE<|endoftext|> |
5f75f4509e9ec3f3ad87f6069e143aa4d69c6e3ef44e24c17e21852806253871 | def species_to_tensor(self, *args, **kwargs):
'Convert species from strings to tensor.\n\n See also :method:`torchani.neurochem.Constant.species_to_tensor`\n\n Arguments:\n species (:class:`str`): A string of chemical symbols\n\n Returns:\n tensor (:class:`torch.Tensor`): A 1D tensor of integers\n '
return self.consts.species_to_tensor(*args, **kwargs).to(self.aev_computer.ShfR.device) | Convert species from strings to tensor.
See also :method:`torchani.neurochem.Constant.species_to_tensor`
Arguments:
species (:class:`str`): A string of chemical symbols
Returns:
tensor (:class:`torch.Tensor`): A 1D tensor of integers | torchani/models.py | species_to_tensor | akhdhys/torchani | 0 | python | def species_to_tensor(self, *args, **kwargs):
'Convert species from strings to tensor.\n\n See also :method:`torchani.neurochem.Constant.species_to_tensor`\n\n Arguments:\n species (:class:`str`): A string of chemical symbols\n\n Returns:\n tensor (:class:`torch.Tensor`): A 1D tensor of integers\n '
return self.consts.species_to_tensor(*args, **kwargs).to(self.aev_computer.ShfR.device) | def species_to_tensor(self, *args, **kwargs):
'Convert species from strings to tensor.\n\n See also :method:`torchani.neurochem.Constant.species_to_tensor`\n\n Arguments:\n species (:class:`str`): A string of chemical symbols\n\n Returns:\n tensor (:class:`torch.Tensor`): A 1D tensor of integers\n '
return self.consts.species_to_tensor(*args, **kwargs).to(self.aev_computer.ShfR.device)<|docstring|>Convert species from strings to tensor.
See also :method:`torchani.neurochem.Constant.species_to_tensor`
Arguments:
species (:class:`str`): A string of chemical symbols
Returns:
tensor (:class:`torch.Tensor`): A 1D tensor of integers<|endoftext|> |
0de4d261e58c34d7c7bcfd8dbb90154ed5877bc875d3ae8c81f1ca1dadc2e5dc | def ase(**kwargs):
'Attach an ase calculator '
from . import ase
return ase.Calculator(self.species, ret, **kwargs) | Attach an ase calculator | torchani/models.py | ase | akhdhys/torchani | 0 | python | def ase(**kwargs):
' '
from . import ase
return ase.Calculator(self.species, ret, **kwargs) | def ase(**kwargs):
' '
from . import ase
return ase.Calculator(self.species, ret, **kwargs)<|docstring|>Attach an ase calculator<|endoftext|> |
28c989a7975a04eea7a4e6d1959adf78ae64181a49c21d37d5ca3e6df5d2f87d | def test_basic_IOHandler(self):
'Test basic IOHandler'
self.assertTrue(os.path.isdir(self.iohandler.workdir)) | Test basic IOHandler | tests/test_inout.py | test_basic_IOHandler | huard/pywps | 1 | python | def test_basic_IOHandler(self):
self.assertTrue(os.path.isdir(self.iohandler.workdir)) | def test_basic_IOHandler(self):
self.assertTrue(os.path.isdir(self.iohandler.workdir))<|docstring|>Test basic IOHandler<|endoftext|> |
f4c725d7b91306f413278bdc807efcd76b4593ed5ec05ebcb7b5cc5531b4d353 | def test_validator(self):
'Test available validation function\n '
self.assertEqual(self.iohandler.validator, emptyvalidator) | Test available validation function | tests/test_inout.py | test_validator | huard/pywps | 1 | python | def test_validator(self):
'\n '
self.assertEqual(self.iohandler.validator, emptyvalidator) | def test_validator(self):
'\n '
self.assertEqual(self.iohandler.validator, emptyvalidator)<|docstring|>Test available validation function<|endoftext|> |
2f5edc1455be3a2481b7c75c78cbbf221365908ded6cbbc1717ee287f533e86b | def _test_outout(self, source_type, suffix=''):
'Test all outputs'
self.assertEqual(source_type, self.iohandler.source_type, 'Source type properly set')
self.assertEqual(self._value, self.iohandler.data, 'Data obtained')
if (self.iohandler.source_type == SOURCE_TYPE.STREAM):
source = StringIO(text_type(self._value))
self.iohandler.stream = source
file_path = self.iohandler.file
self.assertTrue(file_path.endswith(suffix))
file_handler = open(file_path)
self.assertEqual(self._value, file_handler.read(), 'File obtained')
file_handler.close()
if (self.iohandler.source_type == SOURCE_TYPE.STREAM):
source = StringIO(text_type(self._value))
self.iohandler.stream = source
stream_val = self.iohandler.stream.read()
self.iohandler.stream.close()
if (type(stream_val) == type(b'')):
self.assertEqual(str.encode(self._value), stream_val, 'Stream obtained')
else:
self.assertEqual(self._value, stream_val, 'Stream obtained')
if (self.iohandler.source_type == SOURCE_TYPE.STREAM):
source = StringIO(text_type(self._value))
self.iohandler.stream = source
self.skipTest('Memory object not implemented')
self.assertEqual(stream_val, self.iohandler.memory_object, 'Memory object obtained') | Test all outputs | tests/test_inout.py | _test_outout | huard/pywps | 1 | python | def _test_outout(self, source_type, suffix=):
self.assertEqual(source_type, self.iohandler.source_type, 'Source type properly set')
self.assertEqual(self._value, self.iohandler.data, 'Data obtained')
if (self.iohandler.source_type == SOURCE_TYPE.STREAM):
source = StringIO(text_type(self._value))
self.iohandler.stream = source
file_path = self.iohandler.file
self.assertTrue(file_path.endswith(suffix))
file_handler = open(file_path)
self.assertEqual(self._value, file_handler.read(), 'File obtained')
file_handler.close()
if (self.iohandler.source_type == SOURCE_TYPE.STREAM):
source = StringIO(text_type(self._value))
self.iohandler.stream = source
stream_val = self.iohandler.stream.read()
self.iohandler.stream.close()
if (type(stream_val) == type(b)):
self.assertEqual(str.encode(self._value), stream_val, 'Stream obtained')
else:
self.assertEqual(self._value, stream_val, 'Stream obtained')
if (self.iohandler.source_type == SOURCE_TYPE.STREAM):
source = StringIO(text_type(self._value))
self.iohandler.stream = source
self.skipTest('Memory object not implemented')
self.assertEqual(stream_val, self.iohandler.memory_object, 'Memory object obtained') | def _test_outout(self, source_type, suffix=):
self.assertEqual(source_type, self.iohandler.source_type, 'Source type properly set')
self.assertEqual(self._value, self.iohandler.data, 'Data obtained')
if (self.iohandler.source_type == SOURCE_TYPE.STREAM):
source = StringIO(text_type(self._value))
self.iohandler.stream = source
file_path = self.iohandler.file
self.assertTrue(file_path.endswith(suffix))
file_handler = open(file_path)
self.assertEqual(self._value, file_handler.read(), 'File obtained')
file_handler.close()
if (self.iohandler.source_type == SOURCE_TYPE.STREAM):
source = StringIO(text_type(self._value))
self.iohandler.stream = source
stream_val = self.iohandler.stream.read()
self.iohandler.stream.close()
if (type(stream_val) == type(b)):
self.assertEqual(str.encode(self._value), stream_val, 'Stream obtained')
else:
self.assertEqual(self._value, stream_val, 'Stream obtained')
if (self.iohandler.source_type == SOURCE_TYPE.STREAM):
source = StringIO(text_type(self._value))
self.iohandler.stream = source
self.skipTest('Memory object not implemented')
self.assertEqual(stream_val, self.iohandler.memory_object, 'Memory object obtained')<|docstring|>Test all outputs<|endoftext|> |
107de9576ff5db8f26dd41e001212a0eee7a440ea8283cd492ddd6a7e19e4b0d | def test_data(self):
'Test data input IOHandler'
self.iohandler.data = self._value
self.iohandler.data_format = Format('foo', extension='.foo')
self._test_outout(SOURCE_TYPE.DATA, '.foo') | Test data input IOHandler | tests/test_inout.py | test_data | huard/pywps | 1 | python | def test_data(self):
self.iohandler.data = self._value
self.iohandler.data_format = Format('foo', extension='.foo')
self._test_outout(SOURCE_TYPE.DATA, '.foo') | def test_data(self):
self.iohandler.data = self._value
self.iohandler.data_format = Format('foo', extension='.foo')
self._test_outout(SOURCE_TYPE.DATA, '.foo')<|docstring|>Test data input IOHandler<|endoftext|> |
eb1bbf5c2206b67f2be612df0eebd5e2f63ce3fe6aabc4ef1b11c7357e523780 | def test_stream(self):
'Test stream input IOHandler'
source = StringIO(text_type(self._value))
self.iohandler.stream = source
self._test_outout(SOURCE_TYPE.STREAM) | Test stream input IOHandler | tests/test_inout.py | test_stream | huard/pywps | 1 | python | def test_stream(self):
source = StringIO(text_type(self._value))
self.iohandler.stream = source
self._test_outout(SOURCE_TYPE.STREAM) | def test_stream(self):
source = StringIO(text_type(self._value))
self.iohandler.stream = source
self._test_outout(SOURCE_TYPE.STREAM)<|docstring|>Test stream input IOHandler<|endoftext|> |
4db4ad10a18926226e6f141fe23264e5762058a4a0095445ff34bd987db2e087 | def test_file(self):
'Test file input IOHandler'
(fd, tmp_file) = tempfile.mkstemp()
source = tmp_file
file_handler = open(tmp_file, 'w')
file_handler.write(self._value)
file_handler.close()
self.iohandler.file = source
self._test_outout(SOURCE_TYPE.FILE) | Test file input IOHandler | tests/test_inout.py | test_file | huard/pywps | 1 | python | def test_file(self):
(fd, tmp_file) = tempfile.mkstemp()
source = tmp_file
file_handler = open(tmp_file, 'w')
file_handler.write(self._value)
file_handler.close()
self.iohandler.file = source
self._test_outout(SOURCE_TYPE.FILE) | def test_file(self):
(fd, tmp_file) = tempfile.mkstemp()
source = tmp_file
file_handler = open(tmp_file, 'w')
file_handler.write(self._value)
file_handler.close()
self.iohandler.file = source
self._test_outout(SOURCE_TYPE.FILE)<|docstring|>Test file input IOHandler<|endoftext|> |
180aba3087b8fa322bdc82040a89775f73fd86ef9287e58ea2cd92942b5238cd | def test_workdir(self):
'Test workdir'
workdir = tempfile.mkdtemp()
self.iohandler.workdir = workdir
self.assertTrue(os.path.isdir(self.iohandler.workdir))
workdir = tempfile.mkdtemp()
self.iohandler.workdir = workdir
self.assertTrue(os.path.isdir(self.iohandler.workdir)) | Test workdir | tests/test_inout.py | test_workdir | huard/pywps | 1 | python | def test_workdir(self):
workdir = tempfile.mkdtemp()
self.iohandler.workdir = workdir
self.assertTrue(os.path.isdir(self.iohandler.workdir))
workdir = tempfile.mkdtemp()
self.iohandler.workdir = workdir
self.assertTrue(os.path.isdir(self.iohandler.workdir)) | def test_workdir(self):
workdir = tempfile.mkdtemp()
self.iohandler.workdir = workdir
self.assertTrue(os.path.isdir(self.iohandler.workdir))
workdir = tempfile.mkdtemp()
self.iohandler.workdir = workdir
self.assertTrue(os.path.isdir(self.iohandler.workdir))<|docstring|>Test workdir<|endoftext|> |
2821b7d9a21bb86f70080485e31faef7dbc90f11c14b4cb51e6e00e1bd5416bb | def test_memory(self):
'Test data input IOHandler'
self.skipTest('Memory object not implemented') | Test data input IOHandler | tests/test_inout.py | test_memory | huard/pywps | 1 | python | def test_memory(self):
self.skipTest('Memory object not implemented') | def test_memory(self):
self.skipTest('Memory object not implemented')<|docstring|>Test data input IOHandler<|endoftext|> |
42917c5e7b61f1087cdee0c2c74d406826242d686e1198f81140ed5d759a12aa | def soup_maker(fh):
' Takes a file handler returns BeautifulSoup'
try:
from bs4 import BeautifulSoup
soup = BeautifulSoup(fh, 'lxml')
for tag in soup.find_all():
tag.name = tag.name.lower()
except ImportError:
from BeautifulSoup import BeautifulStoneSoup
soup = BeautifulStoneSoup(fh)
return soup | Takes a file handler returns BeautifulSoup | pv/pv4xa.py | soup_maker | stormasm/soup-xbrl | 0 | python | def soup_maker(fh):
' '
try:
from bs4 import BeautifulSoup
soup = BeautifulSoup(fh, 'lxml')
for tag in soup.find_all():
tag.name = tag.name.lower()
except ImportError:
from BeautifulSoup import BeautifulStoneSoup
soup = BeautifulStoneSoup(fh)
return soup | def soup_maker(fh):
' '
try:
from bs4 import BeautifulSoup
soup = BeautifulSoup(fh, 'lxml')
for tag in soup.find_all():
tag.name = tag.name.lower()
except ImportError:
from BeautifulSoup import BeautifulStoneSoup
soup = BeautifulStoneSoup(fh)
return soup<|docstring|>Takes a file handler returns BeautifulSoup<|endoftext|> |
08470807372e14140bf6fbe34b53773224194c9eaf0ddd8fbc7d00658a936f68 | def __init__(self, fh):
'\n fh should be a seekable file-like byte stream object\n '
self.headers = odict.OrderedDict()
self.fh = fh | fh should be a seekable file-like byte stream object | pv/pv4xa.py | __init__ | stormasm/soup-xbrl | 0 | python | def __init__(self, fh):
'\n \n '
self.headers = odict.OrderedDict()
self.fh = fh | def __init__(self, fh):
'\n \n '
self.headers = odict.OrderedDict()
self.fh = fh<|docstring|>fh should be a seekable file-like byte stream object<|endoftext|> |
e951956b85a44631ebb0324c1b255c763888caf363a4c0ff35c3fe3e6a424d82 | @classmethod
def parse(self, file_handle):
'\n parse is the main entry point for an XBRLParser. It takes a file\n handle.\n '
xbrl_obj = XBRL()
if (not hasattr(file_handle, 'read')):
file_handler = open(file_handle)
else:
file_handler = file_handle
xbrl_file = XBRLPreprocessedFile(file_handler)
xbrl = soup_maker(xbrl_file.fh)
file_handler.close()
xbrl_base = xbrl.find(name=re.compile('xbrl*:*'))
if ((xbrl.find('xbrl') is None) and (xbrl_base is None)):
raise XBRLParserException('The xbrl file is empty!')
lookahead = xbrl.find(name=re.compile('context', (re.IGNORECASE | re.MULTILINE))).name
if (':' in lookahead):
self.xbrl_base = (lookahead.split(':')[0] + ':')
else:
self.xbrl_base = ''
return xbrl | parse is the main entry point for an XBRLParser. It takes a file
handle. | pv/pv4xa.py | parse | stormasm/soup-xbrl | 0 | python | @classmethod
def parse(self, file_handle):
'\n parse is the main entry point for an XBRLParser. It takes a file\n handle.\n '
xbrl_obj = XBRL()
if (not hasattr(file_handle, 'read')):
file_handler = open(file_handle)
else:
file_handler = file_handle
xbrl_file = XBRLPreprocessedFile(file_handler)
xbrl = soup_maker(xbrl_file.fh)
file_handler.close()
xbrl_base = xbrl.find(name=re.compile('xbrl*:*'))
if ((xbrl.find('xbrl') is None) and (xbrl_base is None)):
raise XBRLParserException('The xbrl file is empty!')
lookahead = xbrl.find(name=re.compile('context', (re.IGNORECASE | re.MULTILINE))).name
if (':' in lookahead):
self.xbrl_base = (lookahead.split(':')[0] + ':')
else:
self.xbrl_base =
return xbrl | @classmethod
def parse(self, file_handle):
'\n parse is the main entry point for an XBRLParser. It takes a file\n handle.\n '
xbrl_obj = XBRL()
if (not hasattr(file_handle, 'read')):
file_handler = open(file_handle)
else:
file_handler = file_handle
xbrl_file = XBRLPreprocessedFile(file_handler)
xbrl = soup_maker(xbrl_file.fh)
file_handler.close()
xbrl_base = xbrl.find(name=re.compile('xbrl*:*'))
if ((xbrl.find('xbrl') is None) and (xbrl_base is None)):
raise XBRLParserException('The xbrl file is empty!')
lookahead = xbrl.find(name=re.compile('context', (re.IGNORECASE | re.MULTILINE))).name
if (':' in lookahead):
self.xbrl_base = (lookahead.split(':')[0] + ':')
else:
self.xbrl_base =
return xbrl<|docstring|>parse is the main entry point for an XBRLParser. It takes a file
handle.<|endoftext|> |
f110eb5ba657cdb04fd76ad9f140f5b6e270ead0944a5b4adf775ebdbe55e0f7 | @classmethod
def parseGAAP(self, xbrl, doc_date='', context='current', ignore_errors=0):
'\n Parse GAAP from our XBRL soup and return a GAAP object.\n '
gaap_obj = GAAP()
if (ignore_errors == 2):
logging.basicConfig(filename='/tmp/xbrl.log', level=logging.ERROR, format='%(asctime)s %(levelname)s %(name)s %(message)s')
logger = logging.getLogger(__name__)
else:
logger = None
if (doc_date == ''):
doc_date = str(datetime.date.today())
doc_date = re.sub('[^0-9]+', '', doc_date)
if (context == 'current'):
context = 90
if (context == 'year'):
context = 360
context = int(context)
if ((context % 90) == 0):
context_extended = list(range(context, (context + 9)))
expected_start_date = (datetime.datetime.strptime(doc_date, '%Y%m%d') - datetime.timedelta(days=context))
elif (context == 'instant'):
expected_start_date = None
else:
raise XBRLParserException('invalid context')
if (context != 'instant'):
expected_end_date = datetime.datetime.strptime(doc_date, '%Y%m%d')
doc_root = ''
if (len(self.xbrl_base) > 1):
doc_root = self.xbrl_base
context_ids = []
context_tags = xbrl.find_all(name=re.compile((doc_root + 'context'), (re.IGNORECASE | re.MULTILINE)))
print('number of context_tags =', len(context_tags))
try:
for context_tag in context_tags:
if (context_tag.find((doc_root + 'entity')) is None):
continue
if (context_tag.find((doc_root + 'entity')).find((doc_root + 'segment')) is None):
context_id = context_tag.attrs['id']
found_start_date = None
found_end_date = None
if context_tag.find((doc_root + 'instant')):
instant = datetime.datetime.strptime(re.compile('[^\\d]+').sub('', context_tag.find((doc_root + 'instant')).text)[:8], '%Y%m%d')
if (instant == expected_end_date):
context_ids.append(context_id)
continue
if context_tag.find((doc_root + 'period')).find((doc_root + 'startdate')):
found_start_date = datetime.datetime.strptime(re.compile('[^\\d]+').sub('', context_tag.find((doc_root + 'period')).find((doc_root + 'startdate')).text)[:8], '%Y%m%d')
if context_tag.find((doc_root + 'period')).find((doc_root + 'enddate')):
found_end_date = datetime.datetime.strptime(re.compile('[^\\d]+').sub('', context_tag.find((doc_root + 'period')).find((doc_root + 'enddate')).text)[:8], '%Y%m%d')
if (found_end_date and found_start_date):
for ce in context_extended:
if ((found_end_date - found_start_date) == datetime.timedelta(days=ce)):
if (found_end_date == expected_end_date):
context_ids.append(context_id)
except IndexError:
raise XBRLParserException('problem getting contexts')
liabilities_and_equity = xbrl.find_all(name=re.compile('(us-gaap:)[^s]*(liabilitiesand)', (re.IGNORECASE | re.MULTILINE)))
gaap_obj.liabilities_and_equity = self.data_processing(liabilities_and_equity, xbrl, ignore_errors, logger, context_ids)
liabilities = xbrl.find_all(name=re.compile('(us-gaap:)[^s]*(liabilities)', (re.IGNORECASE | re.MULTILINE)))
gaap_obj.liabilities = self.data_processing(liabilities, xbrl, ignore_errors, logger, context_ids)
cash_and_cashequivalents = xbrl.find_all(name=re.compile('(us-gaap:)[^s]*(cashandcashequivalentsatcarryingvalue)', (re.IGNORECASE | re.MULTILINE)))
gaap_obj.cash_and_cashequivalents = self.data_processing(cash_and_cashequivalents, xbrl, ignore_errors, logger, context_ids)
return gaap_obj | Parse GAAP from our XBRL soup and return a GAAP object. | pv/pv4xa.py | parseGAAP | stormasm/soup-xbrl | 0 | python | @classmethod
def parseGAAP(self, xbrl, doc_date=, context='current', ignore_errors=0):
'\n \n '
gaap_obj = GAAP()
if (ignore_errors == 2):
logging.basicConfig(filename='/tmp/xbrl.log', level=logging.ERROR, format='%(asctime)s %(levelname)s %(name)s %(message)s')
logger = logging.getLogger(__name__)
else:
logger = None
if (doc_date == ):
doc_date = str(datetime.date.today())
doc_date = re.sub('[^0-9]+', , doc_date)
if (context == 'current'):
context = 90
if (context == 'year'):
context = 360
context = int(context)
if ((context % 90) == 0):
context_extended = list(range(context, (context + 9)))
expected_start_date = (datetime.datetime.strptime(doc_date, '%Y%m%d') - datetime.timedelta(days=context))
elif (context == 'instant'):
expected_start_date = None
else:
raise XBRLParserException('invalid context')
if (context != 'instant'):
expected_end_date = datetime.datetime.strptime(doc_date, '%Y%m%d')
doc_root =
if (len(self.xbrl_base) > 1):
doc_root = self.xbrl_base
context_ids = []
context_tags = xbrl.find_all(name=re.compile((doc_root + 'context'), (re.IGNORECASE | re.MULTILINE)))
print('number of context_tags =', len(context_tags))
try:
for context_tag in context_tags:
if (context_tag.find((doc_root + 'entity')) is None):
continue
if (context_tag.find((doc_root + 'entity')).find((doc_root + 'segment')) is None):
context_id = context_tag.attrs['id']
found_start_date = None
found_end_date = None
if context_tag.find((doc_root + 'instant')):
instant = datetime.datetime.strptime(re.compile('[^\\d]+').sub(, context_tag.find((doc_root + 'instant')).text)[:8], '%Y%m%d')
if (instant == expected_end_date):
context_ids.append(context_id)
continue
if context_tag.find((doc_root + 'period')).find((doc_root + 'startdate')):
found_start_date = datetime.datetime.strptime(re.compile('[^\\d]+').sub(, context_tag.find((doc_root + 'period')).find((doc_root + 'startdate')).text)[:8], '%Y%m%d')
if context_tag.find((doc_root + 'period')).find((doc_root + 'enddate')):
found_end_date = datetime.datetime.strptime(re.compile('[^\\d]+').sub(, context_tag.find((doc_root + 'period')).find((doc_root + 'enddate')).text)[:8], '%Y%m%d')
if (found_end_date and found_start_date):
for ce in context_extended:
if ((found_end_date - found_start_date) == datetime.timedelta(days=ce)):
if (found_end_date == expected_end_date):
context_ids.append(context_id)
except IndexError:
raise XBRLParserException('problem getting contexts')
liabilities_and_equity = xbrl.find_all(name=re.compile('(us-gaap:)[^s]*(liabilitiesand)', (re.IGNORECASE | re.MULTILINE)))
gaap_obj.liabilities_and_equity = self.data_processing(liabilities_and_equity, xbrl, ignore_errors, logger, context_ids)
liabilities = xbrl.find_all(name=re.compile('(us-gaap:)[^s]*(liabilities)', (re.IGNORECASE | re.MULTILINE)))
gaap_obj.liabilities = self.data_processing(liabilities, xbrl, ignore_errors, logger, context_ids)
cash_and_cashequivalents = xbrl.find_all(name=re.compile('(us-gaap:)[^s]*(cashandcashequivalentsatcarryingvalue)', (re.IGNORECASE | re.MULTILINE)))
gaap_obj.cash_and_cashequivalents = self.data_processing(cash_and_cashequivalents, xbrl, ignore_errors, logger, context_ids)
return gaap_obj | @classmethod
def parseGAAP(self, xbrl, doc_date=, context='current', ignore_errors=0):
'\n \n '
gaap_obj = GAAP()
if (ignore_errors == 2):
logging.basicConfig(filename='/tmp/xbrl.log', level=logging.ERROR, format='%(asctime)s %(levelname)s %(name)s %(message)s')
logger = logging.getLogger(__name__)
else:
logger = None
if (doc_date == ):
doc_date = str(datetime.date.today())
doc_date = re.sub('[^0-9]+', , doc_date)
if (context == 'current'):
context = 90
if (context == 'year'):
context = 360
context = int(context)
if ((context % 90) == 0):
context_extended = list(range(context, (context + 9)))
expected_start_date = (datetime.datetime.strptime(doc_date, '%Y%m%d') - datetime.timedelta(days=context))
elif (context == 'instant'):
expected_start_date = None
else:
raise XBRLParserException('invalid context')
if (context != 'instant'):
expected_end_date = datetime.datetime.strptime(doc_date, '%Y%m%d')
doc_root =
if (len(self.xbrl_base) > 1):
doc_root = self.xbrl_base
context_ids = []
context_tags = xbrl.find_all(name=re.compile((doc_root + 'context'), (re.IGNORECASE | re.MULTILINE)))
print('number of context_tags =', len(context_tags))
try:
for context_tag in context_tags:
if (context_tag.find((doc_root + 'entity')) is None):
continue
if (context_tag.find((doc_root + 'entity')).find((doc_root + 'segment')) is None):
context_id = context_tag.attrs['id']
found_start_date = None
found_end_date = None
if context_tag.find((doc_root + 'instant')):
instant = datetime.datetime.strptime(re.compile('[^\\d]+').sub(, context_tag.find((doc_root + 'instant')).text)[:8], '%Y%m%d')
if (instant == expected_end_date):
context_ids.append(context_id)
continue
if context_tag.find((doc_root + 'period')).find((doc_root + 'startdate')):
found_start_date = datetime.datetime.strptime(re.compile('[^\\d]+').sub(, context_tag.find((doc_root + 'period')).find((doc_root + 'startdate')).text)[:8], '%Y%m%d')
if context_tag.find((doc_root + 'period')).find((doc_root + 'enddate')):
found_end_date = datetime.datetime.strptime(re.compile('[^\\d]+').sub(, context_tag.find((doc_root + 'period')).find((doc_root + 'enddate')).text)[:8], '%Y%m%d')
if (found_end_date and found_start_date):
for ce in context_extended:
if ((found_end_date - found_start_date) == datetime.timedelta(days=ce)):
if (found_end_date == expected_end_date):
context_ids.append(context_id)
except IndexError:
raise XBRLParserException('problem getting contexts')
liabilities_and_equity = xbrl.find_all(name=re.compile('(us-gaap:)[^s]*(liabilitiesand)', (re.IGNORECASE | re.MULTILINE)))
gaap_obj.liabilities_and_equity = self.data_processing(liabilities_and_equity, xbrl, ignore_errors, logger, context_ids)
liabilities = xbrl.find_all(name=re.compile('(us-gaap:)[^s]*(liabilities)', (re.IGNORECASE | re.MULTILINE)))
gaap_obj.liabilities = self.data_processing(liabilities, xbrl, ignore_errors, logger, context_ids)
cash_and_cashequivalents = xbrl.find_all(name=re.compile('(us-gaap:)[^s]*(cashandcashequivalentsatcarryingvalue)', (re.IGNORECASE | re.MULTILINE)))
gaap_obj.cash_and_cashequivalents = self.data_processing(cash_and_cashequivalents, xbrl, ignore_errors, logger, context_ids)
return gaap_obj<|docstring|>Parse GAAP from our XBRL soup and return a GAAP object.<|endoftext|> |
2a666136a7f0657a6ac148d8136a3c8b686ade1a6617da38b11d56e71bbfdbef | @staticmethod
def trim_decimals(s, precision=(- 3)):
'\n Convert from scientific notation using precision\n '
encoded = s.encode('ascii', 'ignore')
str_val = ''
if six.PY3:
str_val = str(encoded, encoding='ascii', errors='ignore')[:precision]
elif (precision == 0):
str_val = str(encoded)
else:
str_val = str(encoded)[:precision]
if (len(str_val) > 0):
return float(str_val)
else:
return 0 | Convert from scientific notation using precision | pv/pv4xa.py | trim_decimals | stormasm/soup-xbrl | 0 | python | @staticmethod
def trim_decimals(s, precision=(- 3)):
'\n \n '
encoded = s.encode('ascii', 'ignore')
str_val =
if six.PY3:
str_val = str(encoded, encoding='ascii', errors='ignore')[:precision]
elif (precision == 0):
str_val = str(encoded)
else:
str_val = str(encoded)[:precision]
if (len(str_val) > 0):
return float(str_val)
else:
return 0 | @staticmethod
def trim_decimals(s, precision=(- 3)):
'\n \n '
encoded = s.encode('ascii', 'ignore')
str_val =
if six.PY3:
str_val = str(encoded, encoding='ascii', errors='ignore')[:precision]
elif (precision == 0):
str_val = str(encoded)
else:
str_val = str(encoded)[:precision]
if (len(str_val) > 0):
return float(str_val)
else:
return 0<|docstring|>Convert from scientific notation using precision<|endoftext|> |
2fa183b906b775bfae393111a207c52dacc88ce8a5cb9a7bd1f32edbc905cb65 | @staticmethod
def is_number(s):
'\n Test if value is numeric\n '
try:
s = float(s)
return True
except ValueError:
return False | Test if value is numeric | pv/pv4xa.py | is_number | stormasm/soup-xbrl | 0 | python | @staticmethod
def is_number(s):
'\n \n '
try:
s = float(s)
return True
except ValueError:
return False | @staticmethod
def is_number(s):
'\n \n '
try:
s = float(s)
return True
except ValueError:
return False<|docstring|>Test if value is numeric<|endoftext|> |
c0ff83187f05b2c0d009a70994337c9cbff34e97c25dcbdc1ec18ac3fd5d36ed | @classmethod
def data_processing(self, elements, xbrl, ignore_errors, logger, context_ids=[], **kwargs):
'\n Process a XBRL tag object and extract the correct value as\n stated by the context.\n '
options = kwargs.get('options', {'type': 'Number', 'no_context': False})
if (options['type'] == 'String'):
if (len(elements) > 0):
return elements[0].text
if (options['no_context'] == True):
if ((len(elements) > 0) and XBRLParser().is_number(elements[0].text)):
return elements[0].text
for context_id in context_ids:
print(context_id)
try:
correct_elements = []
for element in elements:
std = element.attrs['contextref']
if (std in context_ids):
correct_elements.append(element)
elements = correct_elements
if ((len(elements) > 0) and XBRLParser().is_number(elements[0].text)):
decimals = elements[0].attrs['decimals']
if (decimals is not None):
attr_precision = decimals
if ((xbrl.precision != 0) and (xbrl.precison != attr_precision)):
xbrl.precision = attr_precision
if elements:
return XBRLParser().trim_decimals(elements[0].text, int(xbrl.precision))
else:
return 0
else:
return 0
except Exception as e:
if (ignore_errors == 0):
raise XBRLParserException('value extraction error')
elif (ignore_errors == 1):
return 0
elif (ignore_errors == 2):
logger.error(((str(e) + ' error at ') + ''.join(elements[0].text))) | Process a XBRL tag object and extract the correct value as
stated by the context. | pv/pv4xa.py | data_processing | stormasm/soup-xbrl | 0 | python | @classmethod
def data_processing(self, elements, xbrl, ignore_errors, logger, context_ids=[], **kwargs):
'\n Process a XBRL tag object and extract the correct value as\n stated by the context.\n '
options = kwargs.get('options', {'type': 'Number', 'no_context': False})
if (options['type'] == 'String'):
if (len(elements) > 0):
return elements[0].text
if (options['no_context'] == True):
if ((len(elements) > 0) and XBRLParser().is_number(elements[0].text)):
return elements[0].text
for context_id in context_ids:
print(context_id)
try:
correct_elements = []
for element in elements:
std = element.attrs['contextref']
if (std in context_ids):
correct_elements.append(element)
elements = correct_elements
if ((len(elements) > 0) and XBRLParser().is_number(elements[0].text)):
decimals = elements[0].attrs['decimals']
if (decimals is not None):
attr_precision = decimals
if ((xbrl.precision != 0) and (xbrl.precison != attr_precision)):
xbrl.precision = attr_precision
if elements:
return XBRLParser().trim_decimals(elements[0].text, int(xbrl.precision))
else:
return 0
else:
return 0
except Exception as e:
if (ignore_errors == 0):
raise XBRLParserException('value extraction error')
elif (ignore_errors == 1):
return 0
elif (ignore_errors == 2):
logger.error(((str(e) + ' error at ') + .join(elements[0].text))) | @classmethod
def data_processing(self, elements, xbrl, ignore_errors, logger, context_ids=[], **kwargs):
'\n Process a XBRL tag object and extract the correct value as\n stated by the context.\n '
options = kwargs.get('options', {'type': 'Number', 'no_context': False})
if (options['type'] == 'String'):
if (len(elements) > 0):
return elements[0].text
if (options['no_context'] == True):
if ((len(elements) > 0) and XBRLParser().is_number(elements[0].text)):
return elements[0].text
for context_id in context_ids:
print(context_id)
try:
correct_elements = []
for element in elements:
std = element.attrs['contextref']
if (std in context_ids):
correct_elements.append(element)
elements = correct_elements
if ((len(elements) > 0) and XBRLParser().is_number(elements[0].text)):
decimals = elements[0].attrs['decimals']
if (decimals is not None):
attr_precision = decimals
if ((xbrl.precision != 0) and (xbrl.precison != attr_precision)):
xbrl.precision = attr_precision
if elements:
return XBRLParser().trim_decimals(elements[0].text, int(xbrl.precision))
else:
return 0
else:
return 0
except Exception as e:
if (ignore_errors == 0):
raise XBRLParserException('value extraction error')
elif (ignore_errors == 1):
return 0
elif (ignore_errors == 2):
logger.error(((str(e) + ' error at ') + .join(elements[0].text)))<|docstring|>Process a XBRL tag object and extract the correct value as
stated by the context.<|endoftext|> |
d39fda6cedf7b7168108b040214f027c977e874631c0747b07d6e7bd9b6d3c81 | def __init__(__self__, *, auth_parameters: pulumi.Input['EventConnectionAuthParametersArgs'], authorization_type: pulumi.Input[str], description: Optional[pulumi.Input[str]]=None, name: Optional[pulumi.Input[str]]=None):
"\n The set of arguments for constructing a EventConnection resource.\n :param pulumi.Input['EventConnectionAuthParametersArgs'] auth_parameters: Parameters used for authorization. A maximum of 1 are allowed. Documented below.\n :param pulumi.Input[str] authorization_type: Choose the type of authorization to use for the connection. One of `API_KEY`,`BASIC`,`OAUTH_CLIENT_CREDENTIALS`.\n :param pulumi.Input[str] description: Enter a description for the connection. Maximum of 512 characters.\n :param pulumi.Input[str] name: The name of the new connection. Maximum of 64 characters consisting of numbers, lower/upper case letters, .,-,_.\n "
pulumi.set(__self__, 'auth_parameters', auth_parameters)
pulumi.set(__self__, 'authorization_type', authorization_type)
if (description is not None):
pulumi.set(__self__, 'description', description)
if (name is not None):
pulumi.set(__self__, 'name', name) | The set of arguments for constructing a EventConnection resource.
:param pulumi.Input['EventConnectionAuthParametersArgs'] auth_parameters: Parameters used for authorization. A maximum of 1 are allowed. Documented below.
:param pulumi.Input[str] authorization_type: Choose the type of authorization to use for the connection. One of `API_KEY`,`BASIC`,`OAUTH_CLIENT_CREDENTIALS`.
:param pulumi.Input[str] description: Enter a description for the connection. Maximum of 512 characters.
:param pulumi.Input[str] name: The name of the new connection. Maximum of 64 characters consisting of numbers, lower/upper case letters, .,-,_. | sdk/python/pulumi_aws/cloudwatch/event_connection.py | __init__ | rapzo/pulumi-aws | 260 | python | def __init__(__self__, *, auth_parameters: pulumi.Input['EventConnectionAuthParametersArgs'], authorization_type: pulumi.Input[str], description: Optional[pulumi.Input[str]]=None, name: Optional[pulumi.Input[str]]=None):
"\n The set of arguments for constructing a EventConnection resource.\n :param pulumi.Input['EventConnectionAuthParametersArgs'] auth_parameters: Parameters used for authorization. A maximum of 1 are allowed. Documented below.\n :param pulumi.Input[str] authorization_type: Choose the type of authorization to use for the connection. One of `API_KEY`,`BASIC`,`OAUTH_CLIENT_CREDENTIALS`.\n :param pulumi.Input[str] description: Enter a description for the connection. Maximum of 512 characters.\n :param pulumi.Input[str] name: The name of the new connection. Maximum of 64 characters consisting of numbers, lower/upper case letters, .,-,_.\n "
pulumi.set(__self__, 'auth_parameters', auth_parameters)
pulumi.set(__self__, 'authorization_type', authorization_type)
if (description is not None):
pulumi.set(__self__, 'description', description)
if (name is not None):
pulumi.set(__self__, 'name', name) | def __init__(__self__, *, auth_parameters: pulumi.Input['EventConnectionAuthParametersArgs'], authorization_type: pulumi.Input[str], description: Optional[pulumi.Input[str]]=None, name: Optional[pulumi.Input[str]]=None):
"\n The set of arguments for constructing a EventConnection resource.\n :param pulumi.Input['EventConnectionAuthParametersArgs'] auth_parameters: Parameters used for authorization. A maximum of 1 are allowed. Documented below.\n :param pulumi.Input[str] authorization_type: Choose the type of authorization to use for the connection. One of `API_KEY`,`BASIC`,`OAUTH_CLIENT_CREDENTIALS`.\n :param pulumi.Input[str] description: Enter a description for the connection. Maximum of 512 characters.\n :param pulumi.Input[str] name: The name of the new connection. Maximum of 64 characters consisting of numbers, lower/upper case letters, .,-,_.\n "
pulumi.set(__self__, 'auth_parameters', auth_parameters)
pulumi.set(__self__, 'authorization_type', authorization_type)
if (description is not None):
pulumi.set(__self__, 'description', description)
if (name is not None):
pulumi.set(__self__, 'name', name)<|docstring|>The set of arguments for constructing a EventConnection resource.
:param pulumi.Input['EventConnectionAuthParametersArgs'] auth_parameters: Parameters used for authorization. A maximum of 1 are allowed. Documented below.
:param pulumi.Input[str] authorization_type: Choose the type of authorization to use for the connection. One of `API_KEY`,`BASIC`,`OAUTH_CLIENT_CREDENTIALS`.
:param pulumi.Input[str] description: Enter a description for the connection. Maximum of 512 characters.
:param pulumi.Input[str] name: The name of the new connection. Maximum of 64 characters consisting of numbers, lower/upper case letters, .,-,_.<|endoftext|> |
f2c45666c6ef7c7b8b86ebaeb17380254a8584dee91557884bde44032f44a8ff | @property
@pulumi.getter(name='authParameters')
def auth_parameters(self) -> pulumi.Input['EventConnectionAuthParametersArgs']:
'\n Parameters used for authorization. A maximum of 1 are allowed. Documented below.\n '
return pulumi.get(self, 'auth_parameters') | Parameters used for authorization. A maximum of 1 are allowed. Documented below. | sdk/python/pulumi_aws/cloudwatch/event_connection.py | auth_parameters | rapzo/pulumi-aws | 260 | python | @property
@pulumi.getter(name='authParameters')
def auth_parameters(self) -> pulumi.Input['EventConnectionAuthParametersArgs']:
'\n \n '
return pulumi.get(self, 'auth_parameters') | @property
@pulumi.getter(name='authParameters')
def auth_parameters(self) -> pulumi.Input['EventConnectionAuthParametersArgs']:
'\n \n '
return pulumi.get(self, 'auth_parameters')<|docstring|>Parameters used for authorization. A maximum of 1 are allowed. Documented below.<|endoftext|> |
8a0190beff106cd1e5a7f9499c59eef075a5feb08e011d3bfdb3b60947c70cbf | @property
@pulumi.getter(name='authorizationType')
def authorization_type(self) -> pulumi.Input[str]:
'\n Choose the type of authorization to use for the connection. One of `API_KEY`,`BASIC`,`OAUTH_CLIENT_CREDENTIALS`.\n '
return pulumi.get(self, 'authorization_type') | Choose the type of authorization to use for the connection. One of `API_KEY`,`BASIC`,`OAUTH_CLIENT_CREDENTIALS`. | sdk/python/pulumi_aws/cloudwatch/event_connection.py | authorization_type | rapzo/pulumi-aws | 260 | python | @property
@pulumi.getter(name='authorizationType')
def authorization_type(self) -> pulumi.Input[str]:
'\n \n '
return pulumi.get(self, 'authorization_type') | @property
@pulumi.getter(name='authorizationType')
def authorization_type(self) -> pulumi.Input[str]:
'\n \n '
return pulumi.get(self, 'authorization_type')<|docstring|>Choose the type of authorization to use for the connection. One of `API_KEY`,`BASIC`,`OAUTH_CLIENT_CREDENTIALS`.<|endoftext|> |
8206f3a2a83517654d762eccc5bc2f042e7694d2fbe545d2d28feb114d77cafd | @property
@pulumi.getter
def description(self) -> Optional[pulumi.Input[str]]:
'\n Enter a description for the connection. Maximum of 512 characters.\n '
return pulumi.get(self, 'description') | Enter a description for the connection. Maximum of 512 characters. | sdk/python/pulumi_aws/cloudwatch/event_connection.py | description | rapzo/pulumi-aws | 260 | python | @property
@pulumi.getter
def description(self) -> Optional[pulumi.Input[str]]:
'\n \n '
return pulumi.get(self, 'description') | @property
@pulumi.getter
def description(self) -> Optional[pulumi.Input[str]]:
'\n \n '
return pulumi.get(self, 'description')<|docstring|>Enter a description for the connection. Maximum of 512 characters.<|endoftext|> |
15c3afbb559d1f242baab4871cf05a943dba8fd45484840cf04e954f99747c5f | @property
@pulumi.getter
def name(self) -> Optional[pulumi.Input[str]]:
'\n The name of the new connection. Maximum of 64 characters consisting of numbers, lower/upper case letters, .,-,_.\n '
return pulumi.get(self, 'name') | The name of the new connection. Maximum of 64 characters consisting of numbers, lower/upper case letters, .,-,_. | sdk/python/pulumi_aws/cloudwatch/event_connection.py | name | rapzo/pulumi-aws | 260 | python | @property
@pulumi.getter
def name(self) -> Optional[pulumi.Input[str]]:
'\n \n '
return pulumi.get(self, 'name') | @property
@pulumi.getter
def name(self) -> Optional[pulumi.Input[str]]:
'\n \n '
return pulumi.get(self, 'name')<|docstring|>The name of the new connection. Maximum of 64 characters consisting of numbers, lower/upper case letters, .,-,_.<|endoftext|> |
c3b201373a0991ac5d7e852f4e2cc539d64c608270fe2c485fc027d89abcaf01 | def __init__(__self__, *, arn: Optional[pulumi.Input[str]]=None, auth_parameters: Optional[pulumi.Input['EventConnectionAuthParametersArgs']]=None, authorization_type: Optional[pulumi.Input[str]]=None, description: Optional[pulumi.Input[str]]=None, name: Optional[pulumi.Input[str]]=None, secret_arn: Optional[pulumi.Input[str]]=None):
"\n Input properties used for looking up and filtering EventConnection resources.\n :param pulumi.Input[str] arn: The Amazon Resource Name (ARN) of the connection.\n :param pulumi.Input['EventConnectionAuthParametersArgs'] auth_parameters: Parameters used for authorization. A maximum of 1 are allowed. Documented below.\n :param pulumi.Input[str] authorization_type: Choose the type of authorization to use for the connection. One of `API_KEY`,`BASIC`,`OAUTH_CLIENT_CREDENTIALS`.\n :param pulumi.Input[str] description: Enter a description for the connection. Maximum of 512 characters.\n :param pulumi.Input[str] name: The name of the new connection. Maximum of 64 characters consisting of numbers, lower/upper case letters, .,-,_.\n :param pulumi.Input[str] secret_arn: The Amazon Resource Name (ARN) of the secret created from the authorization parameters specified for the connection.\n "
if (arn is not None):
pulumi.set(__self__, 'arn', arn)
if (auth_parameters is not None):
pulumi.set(__self__, 'auth_parameters', auth_parameters)
if (authorization_type is not None):
pulumi.set(__self__, 'authorization_type', authorization_type)
if (description is not None):
pulumi.set(__self__, 'description', description)
if (name is not None):
pulumi.set(__self__, 'name', name)
if (secret_arn is not None):
pulumi.set(__self__, 'secret_arn', secret_arn) | Input properties used for looking up and filtering EventConnection resources.
:param pulumi.Input[str] arn: The Amazon Resource Name (ARN) of the connection.
:param pulumi.Input['EventConnectionAuthParametersArgs'] auth_parameters: Parameters used for authorization. A maximum of 1 are allowed. Documented below.
:param pulumi.Input[str] authorization_type: Choose the type of authorization to use for the connection. One of `API_KEY`,`BASIC`,`OAUTH_CLIENT_CREDENTIALS`.
:param pulumi.Input[str] description: Enter a description for the connection. Maximum of 512 characters.
:param pulumi.Input[str] name: The name of the new connection. Maximum of 64 characters consisting of numbers, lower/upper case letters, .,-,_.
:param pulumi.Input[str] secret_arn: The Amazon Resource Name (ARN) of the secret created from the authorization parameters specified for the connection. | sdk/python/pulumi_aws/cloudwatch/event_connection.py | __init__ | rapzo/pulumi-aws | 260 | python | def __init__(__self__, *, arn: Optional[pulumi.Input[str]]=None, auth_parameters: Optional[pulumi.Input['EventConnectionAuthParametersArgs']]=None, authorization_type: Optional[pulumi.Input[str]]=None, description: Optional[pulumi.Input[str]]=None, name: Optional[pulumi.Input[str]]=None, secret_arn: Optional[pulumi.Input[str]]=None):
"\n Input properties used for looking up and filtering EventConnection resources.\n :param pulumi.Input[str] arn: The Amazon Resource Name (ARN) of the connection.\n :param pulumi.Input['EventConnectionAuthParametersArgs'] auth_parameters: Parameters used for authorization. A maximum of 1 are allowed. Documented below.\n :param pulumi.Input[str] authorization_type: Choose the type of authorization to use for the connection. One of `API_KEY`,`BASIC`,`OAUTH_CLIENT_CREDENTIALS`.\n :param pulumi.Input[str] description: Enter a description for the connection. Maximum of 512 characters.\n :param pulumi.Input[str] name: The name of the new connection. Maximum of 64 characters consisting of numbers, lower/upper case letters, .,-,_.\n :param pulumi.Input[str] secret_arn: The Amazon Resource Name (ARN) of the secret created from the authorization parameters specified for the connection.\n "
if (arn is not None):
pulumi.set(__self__, 'arn', arn)
if (auth_parameters is not None):
pulumi.set(__self__, 'auth_parameters', auth_parameters)
if (authorization_type is not None):
pulumi.set(__self__, 'authorization_type', authorization_type)
if (description is not None):
pulumi.set(__self__, 'description', description)
if (name is not None):
pulumi.set(__self__, 'name', name)
if (secret_arn is not None):
pulumi.set(__self__, 'secret_arn', secret_arn) | def __init__(__self__, *, arn: Optional[pulumi.Input[str]]=None, auth_parameters: Optional[pulumi.Input['EventConnectionAuthParametersArgs']]=None, authorization_type: Optional[pulumi.Input[str]]=None, description: Optional[pulumi.Input[str]]=None, name: Optional[pulumi.Input[str]]=None, secret_arn: Optional[pulumi.Input[str]]=None):
"\n Input properties used for looking up and filtering EventConnection resources.\n :param pulumi.Input[str] arn: The Amazon Resource Name (ARN) of the connection.\n :param pulumi.Input['EventConnectionAuthParametersArgs'] auth_parameters: Parameters used for authorization. A maximum of 1 are allowed. Documented below.\n :param pulumi.Input[str] authorization_type: Choose the type of authorization to use for the connection. One of `API_KEY`,`BASIC`,`OAUTH_CLIENT_CREDENTIALS`.\n :param pulumi.Input[str] description: Enter a description for the connection. Maximum of 512 characters.\n :param pulumi.Input[str] name: The name of the new connection. Maximum of 64 characters consisting of numbers, lower/upper case letters, .,-,_.\n :param pulumi.Input[str] secret_arn: The Amazon Resource Name (ARN) of the secret created from the authorization parameters specified for the connection.\n "
if (arn is not None):
pulumi.set(__self__, 'arn', arn)
if (auth_parameters is not None):
pulumi.set(__self__, 'auth_parameters', auth_parameters)
if (authorization_type is not None):
pulumi.set(__self__, 'authorization_type', authorization_type)
if (description is not None):
pulumi.set(__self__, 'description', description)
if (name is not None):
pulumi.set(__self__, 'name', name)
if (secret_arn is not None):
pulumi.set(__self__, 'secret_arn', secret_arn)<|docstring|>Input properties used for looking up and filtering EventConnection resources.
:param pulumi.Input[str] arn: The Amazon Resource Name (ARN) of the connection.
:param pulumi.Input['EventConnectionAuthParametersArgs'] auth_parameters: Parameters used for authorization. A maximum of 1 are allowed. Documented below.
:param pulumi.Input[str] authorization_type: Choose the type of authorization to use for the connection. One of `API_KEY`,`BASIC`,`OAUTH_CLIENT_CREDENTIALS`.
:param pulumi.Input[str] description: Enter a description for the connection. Maximum of 512 characters.
:param pulumi.Input[str] name: The name of the new connection. Maximum of 64 characters consisting of numbers, lower/upper case letters, .,-,_.
:param pulumi.Input[str] secret_arn: The Amazon Resource Name (ARN) of the secret created from the authorization parameters specified for the connection.<|endoftext|> |
5d08136c3d0a0ec3b16b3a665bcf3da65c8a659d8564e1719b4517f91bbc6a6f | @property
@pulumi.getter
def arn(self) -> Optional[pulumi.Input[str]]:
'\n The Amazon Resource Name (ARN) of the connection.\n '
return pulumi.get(self, 'arn') | The Amazon Resource Name (ARN) of the connection. | sdk/python/pulumi_aws/cloudwatch/event_connection.py | arn | rapzo/pulumi-aws | 260 | python | @property
@pulumi.getter
def arn(self) -> Optional[pulumi.Input[str]]:
'\n \n '
return pulumi.get(self, 'arn') | @property
@pulumi.getter
def arn(self) -> Optional[pulumi.Input[str]]:
'\n \n '
return pulumi.get(self, 'arn')<|docstring|>The Amazon Resource Name (ARN) of the connection.<|endoftext|> |
9bc2975e4b64f7e4f9186b67453756a1206406e280a007ac4c774d7826ab97d9 | @property
@pulumi.getter(name='authParameters')
def auth_parameters(self) -> Optional[pulumi.Input['EventConnectionAuthParametersArgs']]:
'\n Parameters used for authorization. A maximum of 1 are allowed. Documented below.\n '
return pulumi.get(self, 'auth_parameters') | Parameters used for authorization. A maximum of 1 are allowed. Documented below. | sdk/python/pulumi_aws/cloudwatch/event_connection.py | auth_parameters | rapzo/pulumi-aws | 260 | python | @property
@pulumi.getter(name='authParameters')
def auth_parameters(self) -> Optional[pulumi.Input['EventConnectionAuthParametersArgs']]:
'\n \n '
return pulumi.get(self, 'auth_parameters') | @property
@pulumi.getter(name='authParameters')
def auth_parameters(self) -> Optional[pulumi.Input['EventConnectionAuthParametersArgs']]:
'\n \n '
return pulumi.get(self, 'auth_parameters')<|docstring|>Parameters used for authorization. A maximum of 1 are allowed. Documented below.<|endoftext|> |
e495d49796c819fb79bf8cf5ea32a80ec224817264c38dcfe714abb58b2be103 | @property
@pulumi.getter(name='authorizationType')
def authorization_type(self) -> Optional[pulumi.Input[str]]:
'\n Choose the type of authorization to use for the connection. One of `API_KEY`,`BASIC`,`OAUTH_CLIENT_CREDENTIALS`.\n '
return pulumi.get(self, 'authorization_type') | Choose the type of authorization to use for the connection. One of `API_KEY`,`BASIC`,`OAUTH_CLIENT_CREDENTIALS`. | sdk/python/pulumi_aws/cloudwatch/event_connection.py | authorization_type | rapzo/pulumi-aws | 260 | python | @property
@pulumi.getter(name='authorizationType')
def authorization_type(self) -> Optional[pulumi.Input[str]]:
'\n \n '
return pulumi.get(self, 'authorization_type') | @property
@pulumi.getter(name='authorizationType')
def authorization_type(self) -> Optional[pulumi.Input[str]]:
'\n \n '
return pulumi.get(self, 'authorization_type')<|docstring|>Choose the type of authorization to use for the connection. One of `API_KEY`,`BASIC`,`OAUTH_CLIENT_CREDENTIALS`.<|endoftext|> |
8206f3a2a83517654d762eccc5bc2f042e7694d2fbe545d2d28feb114d77cafd | @property
@pulumi.getter
def description(self) -> Optional[pulumi.Input[str]]:
'\n Enter a description for the connection. Maximum of 512 characters.\n '
return pulumi.get(self, 'description') | Enter a description for the connection. Maximum of 512 characters. | sdk/python/pulumi_aws/cloudwatch/event_connection.py | description | rapzo/pulumi-aws | 260 | python | @property
@pulumi.getter
def description(self) -> Optional[pulumi.Input[str]]:
'\n \n '
return pulumi.get(self, 'description') | @property
@pulumi.getter
def description(self) -> Optional[pulumi.Input[str]]:
'\n \n '
return pulumi.get(self, 'description')<|docstring|>Enter a description for the connection. Maximum of 512 characters.<|endoftext|> |
15c3afbb559d1f242baab4871cf05a943dba8fd45484840cf04e954f99747c5f | @property
@pulumi.getter
def name(self) -> Optional[pulumi.Input[str]]:
'\n The name of the new connection. Maximum of 64 characters consisting of numbers, lower/upper case letters, .,-,_.\n '
return pulumi.get(self, 'name') | The name of the new connection. Maximum of 64 characters consisting of numbers, lower/upper case letters, .,-,_. | sdk/python/pulumi_aws/cloudwatch/event_connection.py | name | rapzo/pulumi-aws | 260 | python | @property
@pulumi.getter
def name(self) -> Optional[pulumi.Input[str]]:
'\n \n '
return pulumi.get(self, 'name') | @property
@pulumi.getter
def name(self) -> Optional[pulumi.Input[str]]:
'\n \n '
return pulumi.get(self, 'name')<|docstring|>The name of the new connection. Maximum of 64 characters consisting of numbers, lower/upper case letters, .,-,_.<|endoftext|> |
f15b42ba616bd984e8414daf873895c7d9fff33156b812dcece4a894106b1841 | @property
@pulumi.getter(name='secretArn')
def secret_arn(self) -> Optional[pulumi.Input[str]]:
'\n The Amazon Resource Name (ARN) of the secret created from the authorization parameters specified for the connection.\n '
return pulumi.get(self, 'secret_arn') | The Amazon Resource Name (ARN) of the secret created from the authorization parameters specified for the connection. | sdk/python/pulumi_aws/cloudwatch/event_connection.py | secret_arn | rapzo/pulumi-aws | 260 | python | @property
@pulumi.getter(name='secretArn')
def secret_arn(self) -> Optional[pulumi.Input[str]]:
'\n \n '
return pulumi.get(self, 'secret_arn') | @property
@pulumi.getter(name='secretArn')
def secret_arn(self) -> Optional[pulumi.Input[str]]:
'\n \n '
return pulumi.get(self, 'secret_arn')<|docstring|>The Amazon Resource Name (ARN) of the secret created from the authorization parameters specified for the connection.<|endoftext|> |
ffe41025fea398b5794bb32163615546a18d689567170acb741c4e1dc6b63225 | @overload
def __init__(__self__, resource_name: str, opts: Optional[pulumi.ResourceOptions]=None, auth_parameters: Optional[pulumi.Input[pulumi.InputType['EventConnectionAuthParametersArgs']]]=None, authorization_type: Optional[pulumi.Input[str]]=None, description: Optional[pulumi.Input[str]]=None, name: Optional[pulumi.Input[str]]=None, __props__=None):
'\n Provides an EventBridge connection resource.\n\n > **Note:** EventBridge was formerly known as CloudWatch Events. The functionality is identical.\n\n ## Example Usage\n\n ```python\n import pulumi\n import pulumi_aws as aws\n\n test = aws.cloudwatch.EventConnection("test",\n auth_parameters=aws.cloudwatch.EventConnectionAuthParametersArgs(\n api_key=aws.cloudwatch.EventConnectionAuthParametersApiKeyArgs(\n key="x-signature",\n value="1234",\n ),\n ),\n authorization_type="API_KEY",\n description="A connection description")\n ```\n ### Basic Authorization\n\n ```python\n import pulumi\n import pulumi_aws as aws\n\n test = aws.cloudwatch.EventConnection("test",\n auth_parameters=aws.cloudwatch.EventConnectionAuthParametersArgs(\n basic=aws.cloudwatch.EventConnectionAuthParametersBasicArgs(\n password="Pass1234!",\n username="user",\n ),\n ),\n authorization_type="BASIC",\n description="A connection description")\n ```\n ### OAuth Authorization\n\n ```python\n import pulumi\n import pulumi_aws as aws\n\n test = aws.cloudwatch.EventConnection("test",\n auth_parameters=aws.cloudwatch.EventConnectionAuthParametersArgs(\n oauth=aws.cloudwatch.EventConnectionAuthParametersOauthArgs(\n authorization_endpoint="https://auth.url.com/endpoint",\n client_parameters=aws.cloudwatch.EventConnectionAuthParametersOauthClientParametersArgs(\n client_id="1234567890",\n client_secret="Pass1234!",\n ),\n http_method="GET",\n oauth_http_parameters=aws.cloudwatch.EventConnectionAuthParametersOauthOauthHttpParametersArgs(\n body=[{\n "isValueSecret": False,\n "key": "body-parameter-key",\n "value": "body-parameter-value",\n }],\n header=[{\n "isValueSecret": False,\n "key": "header-parameter-key",\n "value": "header-parameter-value",\n }],\n query_string=[{\n "isValueSecret": False,\n "key": "query-string-parameter-key",\n "value": "query-string-parameter-value",\n }],\n ),\n ),\n ),\n authorization_type="OAUTH_CLIENT_CREDENTIALS",\n description="A connection description")\n ```\n ### Invocation Http Parameters\n\n ```python\n import pulumi\n import pulumi_aws as aws\n\n test = aws.cloudwatch.EventConnection("test",\n auth_parameters=aws.cloudwatch.EventConnectionAuthParametersArgs(\n basic=aws.cloudwatch.EventConnectionAuthParametersBasicArgs(\n password="Pass1234!",\n username="user",\n ),\n invocation_http_parameters=aws.cloudwatch.EventConnectionAuthParametersInvocationHttpParametersArgs(\n body=[\n {\n "isValueSecret": False,\n "key": "body-parameter-key",\n "value": "body-parameter-value",\n },\n {\n "isValueSecret": True,\n "key": "body-parameter-key2",\n "value": "body-parameter-value2",\n },\n ],\n header=[{\n "isValueSecret": False,\n "key": "header-parameter-key",\n "value": "header-parameter-value",\n }],\n query_string=[{\n "isValueSecret": False,\n "key": "query-string-parameter-key",\n "value": "query-string-parameter-value",\n }],\n ),\n ),\n authorization_type="BASIC",\n description="A connection description")\n ```\n\n ## Import\n\n EventBridge Connection can be imported using the `name`, e.g. console\n\n ```sh\n $ pulumi import aws:cloudwatch/eventConnection:EventConnection test ngrok-connection\n ```\n\n :param str resource_name: The name of the resource.\n :param pulumi.ResourceOptions opts: Options for the resource.\n :param pulumi.Input[pulumi.InputType[\'EventConnectionAuthParametersArgs\']] auth_parameters: Parameters used for authorization. A maximum of 1 are allowed. Documented below.\n :param pulumi.Input[str] authorization_type: Choose the type of authorization to use for the connection. One of `API_KEY`,`BASIC`,`OAUTH_CLIENT_CREDENTIALS`.\n :param pulumi.Input[str] description: Enter a description for the connection. Maximum of 512 characters.\n :param pulumi.Input[str] name: The name of the new connection. Maximum of 64 characters consisting of numbers, lower/upper case letters, .,-,_.\n '
... | Provides an EventBridge connection resource.
> **Note:** EventBridge was formerly known as CloudWatch Events. The functionality is identical.
## Example Usage
```python
import pulumi
import pulumi_aws as aws
test = aws.cloudwatch.EventConnection("test",
auth_parameters=aws.cloudwatch.EventConnectionAuthParametersArgs(
api_key=aws.cloudwatch.EventConnectionAuthParametersApiKeyArgs(
key="x-signature",
value="1234",
),
),
authorization_type="API_KEY",
description="A connection description")
```
### Basic Authorization
```python
import pulumi
import pulumi_aws as aws
test = aws.cloudwatch.EventConnection("test",
auth_parameters=aws.cloudwatch.EventConnectionAuthParametersArgs(
basic=aws.cloudwatch.EventConnectionAuthParametersBasicArgs(
password="Pass1234!",
username="user",
),
),
authorization_type="BASIC",
description="A connection description")
```
### OAuth Authorization
```python
import pulumi
import pulumi_aws as aws
test = aws.cloudwatch.EventConnection("test",
auth_parameters=aws.cloudwatch.EventConnectionAuthParametersArgs(
oauth=aws.cloudwatch.EventConnectionAuthParametersOauthArgs(
authorization_endpoint="https://auth.url.com/endpoint",
client_parameters=aws.cloudwatch.EventConnectionAuthParametersOauthClientParametersArgs(
client_id="1234567890",
client_secret="Pass1234!",
),
http_method="GET",
oauth_http_parameters=aws.cloudwatch.EventConnectionAuthParametersOauthOauthHttpParametersArgs(
body=[{
"isValueSecret": False,
"key": "body-parameter-key",
"value": "body-parameter-value",
}],
header=[{
"isValueSecret": False,
"key": "header-parameter-key",
"value": "header-parameter-value",
}],
query_string=[{
"isValueSecret": False,
"key": "query-string-parameter-key",
"value": "query-string-parameter-value",
}],
),
),
),
authorization_type="OAUTH_CLIENT_CREDENTIALS",
description="A connection description")
```
### Invocation Http Parameters
```python
import pulumi
import pulumi_aws as aws
test = aws.cloudwatch.EventConnection("test",
auth_parameters=aws.cloudwatch.EventConnectionAuthParametersArgs(
basic=aws.cloudwatch.EventConnectionAuthParametersBasicArgs(
password="Pass1234!",
username="user",
),
invocation_http_parameters=aws.cloudwatch.EventConnectionAuthParametersInvocationHttpParametersArgs(
body=[
{
"isValueSecret": False,
"key": "body-parameter-key",
"value": "body-parameter-value",
},
{
"isValueSecret": True,
"key": "body-parameter-key2",
"value": "body-parameter-value2",
},
],
header=[{
"isValueSecret": False,
"key": "header-parameter-key",
"value": "header-parameter-value",
}],
query_string=[{
"isValueSecret": False,
"key": "query-string-parameter-key",
"value": "query-string-parameter-value",
}],
),
),
authorization_type="BASIC",
description="A connection description")
```
## Import
EventBridge Connection can be imported using the `name`, e.g. console
```sh
$ pulumi import aws:cloudwatch/eventConnection:EventConnection test ngrok-connection
```
:param str resource_name: The name of the resource.
:param pulumi.ResourceOptions opts: Options for the resource.
:param pulumi.Input[pulumi.InputType['EventConnectionAuthParametersArgs']] auth_parameters: Parameters used for authorization. A maximum of 1 are allowed. Documented below.
:param pulumi.Input[str] authorization_type: Choose the type of authorization to use for the connection. One of `API_KEY`,`BASIC`,`OAUTH_CLIENT_CREDENTIALS`.
:param pulumi.Input[str] description: Enter a description for the connection. Maximum of 512 characters.
:param pulumi.Input[str] name: The name of the new connection. Maximum of 64 characters consisting of numbers, lower/upper case letters, .,-,_. | sdk/python/pulumi_aws/cloudwatch/event_connection.py | __init__ | rapzo/pulumi-aws | 260 | python | @overload
def __init__(__self__, resource_name: str, opts: Optional[pulumi.ResourceOptions]=None, auth_parameters: Optional[pulumi.Input[pulumi.InputType['EventConnectionAuthParametersArgs']]]=None, authorization_type: Optional[pulumi.Input[str]]=None, description: Optional[pulumi.Input[str]]=None, name: Optional[pulumi.Input[str]]=None, __props__=None):
'\n Provides an EventBridge connection resource.\n\n > **Note:** EventBridge was formerly known as CloudWatch Events. The functionality is identical.\n\n ## Example Usage\n\n ```python\n import pulumi\n import pulumi_aws as aws\n\n test = aws.cloudwatch.EventConnection("test",\n auth_parameters=aws.cloudwatch.EventConnectionAuthParametersArgs(\n api_key=aws.cloudwatch.EventConnectionAuthParametersApiKeyArgs(\n key="x-signature",\n value="1234",\n ),\n ),\n authorization_type="API_KEY",\n description="A connection description")\n ```\n ### Basic Authorization\n\n ```python\n import pulumi\n import pulumi_aws as aws\n\n test = aws.cloudwatch.EventConnection("test",\n auth_parameters=aws.cloudwatch.EventConnectionAuthParametersArgs(\n basic=aws.cloudwatch.EventConnectionAuthParametersBasicArgs(\n password="Pass1234!",\n username="user",\n ),\n ),\n authorization_type="BASIC",\n description="A connection description")\n ```\n ### OAuth Authorization\n\n ```python\n import pulumi\n import pulumi_aws as aws\n\n test = aws.cloudwatch.EventConnection("test",\n auth_parameters=aws.cloudwatch.EventConnectionAuthParametersArgs(\n oauth=aws.cloudwatch.EventConnectionAuthParametersOauthArgs(\n authorization_endpoint="https://auth.url.com/endpoint",\n client_parameters=aws.cloudwatch.EventConnectionAuthParametersOauthClientParametersArgs(\n client_id="1234567890",\n client_secret="Pass1234!",\n ),\n http_method="GET",\n oauth_http_parameters=aws.cloudwatch.EventConnectionAuthParametersOauthOauthHttpParametersArgs(\n body=[{\n "isValueSecret": False,\n "key": "body-parameter-key",\n "value": "body-parameter-value",\n }],\n header=[{\n "isValueSecret": False,\n "key": "header-parameter-key",\n "value": "header-parameter-value",\n }],\n query_string=[{\n "isValueSecret": False,\n "key": "query-string-parameter-key",\n "value": "query-string-parameter-value",\n }],\n ),\n ),\n ),\n authorization_type="OAUTH_CLIENT_CREDENTIALS",\n description="A connection description")\n ```\n ### Invocation Http Parameters\n\n ```python\n import pulumi\n import pulumi_aws as aws\n\n test = aws.cloudwatch.EventConnection("test",\n auth_parameters=aws.cloudwatch.EventConnectionAuthParametersArgs(\n basic=aws.cloudwatch.EventConnectionAuthParametersBasicArgs(\n password="Pass1234!",\n username="user",\n ),\n invocation_http_parameters=aws.cloudwatch.EventConnectionAuthParametersInvocationHttpParametersArgs(\n body=[\n {\n "isValueSecret": False,\n "key": "body-parameter-key",\n "value": "body-parameter-value",\n },\n {\n "isValueSecret": True,\n "key": "body-parameter-key2",\n "value": "body-parameter-value2",\n },\n ],\n header=[{\n "isValueSecret": False,\n "key": "header-parameter-key",\n "value": "header-parameter-value",\n }],\n query_string=[{\n "isValueSecret": False,\n "key": "query-string-parameter-key",\n "value": "query-string-parameter-value",\n }],\n ),\n ),\n authorization_type="BASIC",\n description="A connection description")\n ```\n\n ## Import\n\n EventBridge Connection can be imported using the `name`, e.g. console\n\n ```sh\n $ pulumi import aws:cloudwatch/eventConnection:EventConnection test ngrok-connection\n ```\n\n :param str resource_name: The name of the resource.\n :param pulumi.ResourceOptions opts: Options for the resource.\n :param pulumi.Input[pulumi.InputType[\'EventConnectionAuthParametersArgs\']] auth_parameters: Parameters used for authorization. A maximum of 1 are allowed. Documented below.\n :param pulumi.Input[str] authorization_type: Choose the type of authorization to use for the connection. One of `API_KEY`,`BASIC`,`OAUTH_CLIENT_CREDENTIALS`.\n :param pulumi.Input[str] description: Enter a description for the connection. Maximum of 512 characters.\n :param pulumi.Input[str] name: The name of the new connection. Maximum of 64 characters consisting of numbers, lower/upper case letters, .,-,_.\n '
... | @overload
def __init__(__self__, resource_name: str, opts: Optional[pulumi.ResourceOptions]=None, auth_parameters: Optional[pulumi.Input[pulumi.InputType['EventConnectionAuthParametersArgs']]]=None, authorization_type: Optional[pulumi.Input[str]]=None, description: Optional[pulumi.Input[str]]=None, name: Optional[pulumi.Input[str]]=None, __props__=None):
'\n Provides an EventBridge connection resource.\n\n > **Note:** EventBridge was formerly known as CloudWatch Events. The functionality is identical.\n\n ## Example Usage\n\n ```python\n import pulumi\n import pulumi_aws as aws\n\n test = aws.cloudwatch.EventConnection("test",\n auth_parameters=aws.cloudwatch.EventConnectionAuthParametersArgs(\n api_key=aws.cloudwatch.EventConnectionAuthParametersApiKeyArgs(\n key="x-signature",\n value="1234",\n ),\n ),\n authorization_type="API_KEY",\n description="A connection description")\n ```\n ### Basic Authorization\n\n ```python\n import pulumi\n import pulumi_aws as aws\n\n test = aws.cloudwatch.EventConnection("test",\n auth_parameters=aws.cloudwatch.EventConnectionAuthParametersArgs(\n basic=aws.cloudwatch.EventConnectionAuthParametersBasicArgs(\n password="Pass1234!",\n username="user",\n ),\n ),\n authorization_type="BASIC",\n description="A connection description")\n ```\n ### OAuth Authorization\n\n ```python\n import pulumi\n import pulumi_aws as aws\n\n test = aws.cloudwatch.EventConnection("test",\n auth_parameters=aws.cloudwatch.EventConnectionAuthParametersArgs(\n oauth=aws.cloudwatch.EventConnectionAuthParametersOauthArgs(\n authorization_endpoint="https://auth.url.com/endpoint",\n client_parameters=aws.cloudwatch.EventConnectionAuthParametersOauthClientParametersArgs(\n client_id="1234567890",\n client_secret="Pass1234!",\n ),\n http_method="GET",\n oauth_http_parameters=aws.cloudwatch.EventConnectionAuthParametersOauthOauthHttpParametersArgs(\n body=[{\n "isValueSecret": False,\n "key": "body-parameter-key",\n "value": "body-parameter-value",\n }],\n header=[{\n "isValueSecret": False,\n "key": "header-parameter-key",\n "value": "header-parameter-value",\n }],\n query_string=[{\n "isValueSecret": False,\n "key": "query-string-parameter-key",\n "value": "query-string-parameter-value",\n }],\n ),\n ),\n ),\n authorization_type="OAUTH_CLIENT_CREDENTIALS",\n description="A connection description")\n ```\n ### Invocation Http Parameters\n\n ```python\n import pulumi\n import pulumi_aws as aws\n\n test = aws.cloudwatch.EventConnection("test",\n auth_parameters=aws.cloudwatch.EventConnectionAuthParametersArgs(\n basic=aws.cloudwatch.EventConnectionAuthParametersBasicArgs(\n password="Pass1234!",\n username="user",\n ),\n invocation_http_parameters=aws.cloudwatch.EventConnectionAuthParametersInvocationHttpParametersArgs(\n body=[\n {\n "isValueSecret": False,\n "key": "body-parameter-key",\n "value": "body-parameter-value",\n },\n {\n "isValueSecret": True,\n "key": "body-parameter-key2",\n "value": "body-parameter-value2",\n },\n ],\n header=[{\n "isValueSecret": False,\n "key": "header-parameter-key",\n "value": "header-parameter-value",\n }],\n query_string=[{\n "isValueSecret": False,\n "key": "query-string-parameter-key",\n "value": "query-string-parameter-value",\n }],\n ),\n ),\n authorization_type="BASIC",\n description="A connection description")\n ```\n\n ## Import\n\n EventBridge Connection can be imported using the `name`, e.g. console\n\n ```sh\n $ pulumi import aws:cloudwatch/eventConnection:EventConnection test ngrok-connection\n ```\n\n :param str resource_name: The name of the resource.\n :param pulumi.ResourceOptions opts: Options for the resource.\n :param pulumi.Input[pulumi.InputType[\'EventConnectionAuthParametersArgs\']] auth_parameters: Parameters used for authorization. A maximum of 1 are allowed. Documented below.\n :param pulumi.Input[str] authorization_type: Choose the type of authorization to use for the connection. One of `API_KEY`,`BASIC`,`OAUTH_CLIENT_CREDENTIALS`.\n :param pulumi.Input[str] description: Enter a description for the connection. Maximum of 512 characters.\n :param pulumi.Input[str] name: The name of the new connection. Maximum of 64 characters consisting of numbers, lower/upper case letters, .,-,_.\n '
...<|docstring|>Provides an EventBridge connection resource.
> **Note:** EventBridge was formerly known as CloudWatch Events. The functionality is identical.
## Example Usage
```python
import pulumi
import pulumi_aws as aws
test = aws.cloudwatch.EventConnection("test",
auth_parameters=aws.cloudwatch.EventConnectionAuthParametersArgs(
api_key=aws.cloudwatch.EventConnectionAuthParametersApiKeyArgs(
key="x-signature",
value="1234",
),
),
authorization_type="API_KEY",
description="A connection description")
```
### Basic Authorization
```python
import pulumi
import pulumi_aws as aws
test = aws.cloudwatch.EventConnection("test",
auth_parameters=aws.cloudwatch.EventConnectionAuthParametersArgs(
basic=aws.cloudwatch.EventConnectionAuthParametersBasicArgs(
password="Pass1234!",
username="user",
),
),
authorization_type="BASIC",
description="A connection description")
```
### OAuth Authorization
```python
import pulumi
import pulumi_aws as aws
test = aws.cloudwatch.EventConnection("test",
auth_parameters=aws.cloudwatch.EventConnectionAuthParametersArgs(
oauth=aws.cloudwatch.EventConnectionAuthParametersOauthArgs(
authorization_endpoint="https://auth.url.com/endpoint",
client_parameters=aws.cloudwatch.EventConnectionAuthParametersOauthClientParametersArgs(
client_id="1234567890",
client_secret="Pass1234!",
),
http_method="GET",
oauth_http_parameters=aws.cloudwatch.EventConnectionAuthParametersOauthOauthHttpParametersArgs(
body=[{
"isValueSecret": False,
"key": "body-parameter-key",
"value": "body-parameter-value",
}],
header=[{
"isValueSecret": False,
"key": "header-parameter-key",
"value": "header-parameter-value",
}],
query_string=[{
"isValueSecret": False,
"key": "query-string-parameter-key",
"value": "query-string-parameter-value",
}],
),
),
),
authorization_type="OAUTH_CLIENT_CREDENTIALS",
description="A connection description")
```
### Invocation Http Parameters
```python
import pulumi
import pulumi_aws as aws
test = aws.cloudwatch.EventConnection("test",
auth_parameters=aws.cloudwatch.EventConnectionAuthParametersArgs(
basic=aws.cloudwatch.EventConnectionAuthParametersBasicArgs(
password="Pass1234!",
username="user",
),
invocation_http_parameters=aws.cloudwatch.EventConnectionAuthParametersInvocationHttpParametersArgs(
body=[
{
"isValueSecret": False,
"key": "body-parameter-key",
"value": "body-parameter-value",
},
{
"isValueSecret": True,
"key": "body-parameter-key2",
"value": "body-parameter-value2",
},
],
header=[{
"isValueSecret": False,
"key": "header-parameter-key",
"value": "header-parameter-value",
}],
query_string=[{
"isValueSecret": False,
"key": "query-string-parameter-key",
"value": "query-string-parameter-value",
}],
),
),
authorization_type="BASIC",
description="A connection description")
```
## Import
EventBridge Connection can be imported using the `name`, e.g. console
```sh
$ pulumi import aws:cloudwatch/eventConnection:EventConnection test ngrok-connection
```
:param str resource_name: The name of the resource.
:param pulumi.ResourceOptions opts: Options for the resource.
:param pulumi.Input[pulumi.InputType['EventConnectionAuthParametersArgs']] auth_parameters: Parameters used for authorization. A maximum of 1 are allowed. Documented below.
:param pulumi.Input[str] authorization_type: Choose the type of authorization to use for the connection. One of `API_KEY`,`BASIC`,`OAUTH_CLIENT_CREDENTIALS`.
:param pulumi.Input[str] description: Enter a description for the connection. Maximum of 512 characters.
:param pulumi.Input[str] name: The name of the new connection. Maximum of 64 characters consisting of numbers, lower/upper case letters, .,-,_.<|endoftext|> |
98a9a37f8ed5a29fef0a2b8e3ec691eeefee8b2ad16bd54e9728f63fd3b9f1d8 | @overload
def __init__(__self__, resource_name: str, args: EventConnectionArgs, opts: Optional[pulumi.ResourceOptions]=None):
'\n Provides an EventBridge connection resource.\n\n > **Note:** EventBridge was formerly known as CloudWatch Events. The functionality is identical.\n\n ## Example Usage\n\n ```python\n import pulumi\n import pulumi_aws as aws\n\n test = aws.cloudwatch.EventConnection("test",\n auth_parameters=aws.cloudwatch.EventConnectionAuthParametersArgs(\n api_key=aws.cloudwatch.EventConnectionAuthParametersApiKeyArgs(\n key="x-signature",\n value="1234",\n ),\n ),\n authorization_type="API_KEY",\n description="A connection description")\n ```\n ### Basic Authorization\n\n ```python\n import pulumi\n import pulumi_aws as aws\n\n test = aws.cloudwatch.EventConnection("test",\n auth_parameters=aws.cloudwatch.EventConnectionAuthParametersArgs(\n basic=aws.cloudwatch.EventConnectionAuthParametersBasicArgs(\n password="Pass1234!",\n username="user",\n ),\n ),\n authorization_type="BASIC",\n description="A connection description")\n ```\n ### OAuth Authorization\n\n ```python\n import pulumi\n import pulumi_aws as aws\n\n test = aws.cloudwatch.EventConnection("test",\n auth_parameters=aws.cloudwatch.EventConnectionAuthParametersArgs(\n oauth=aws.cloudwatch.EventConnectionAuthParametersOauthArgs(\n authorization_endpoint="https://auth.url.com/endpoint",\n client_parameters=aws.cloudwatch.EventConnectionAuthParametersOauthClientParametersArgs(\n client_id="1234567890",\n client_secret="Pass1234!",\n ),\n http_method="GET",\n oauth_http_parameters=aws.cloudwatch.EventConnectionAuthParametersOauthOauthHttpParametersArgs(\n body=[{\n "isValueSecret": False,\n "key": "body-parameter-key",\n "value": "body-parameter-value",\n }],\n header=[{\n "isValueSecret": False,\n "key": "header-parameter-key",\n "value": "header-parameter-value",\n }],\n query_string=[{\n "isValueSecret": False,\n "key": "query-string-parameter-key",\n "value": "query-string-parameter-value",\n }],\n ),\n ),\n ),\n authorization_type="OAUTH_CLIENT_CREDENTIALS",\n description="A connection description")\n ```\n ### Invocation Http Parameters\n\n ```python\n import pulumi\n import pulumi_aws as aws\n\n test = aws.cloudwatch.EventConnection("test",\n auth_parameters=aws.cloudwatch.EventConnectionAuthParametersArgs(\n basic=aws.cloudwatch.EventConnectionAuthParametersBasicArgs(\n password="Pass1234!",\n username="user",\n ),\n invocation_http_parameters=aws.cloudwatch.EventConnectionAuthParametersInvocationHttpParametersArgs(\n body=[\n {\n "isValueSecret": False,\n "key": "body-parameter-key",\n "value": "body-parameter-value",\n },\n {\n "isValueSecret": True,\n "key": "body-parameter-key2",\n "value": "body-parameter-value2",\n },\n ],\n header=[{\n "isValueSecret": False,\n "key": "header-parameter-key",\n "value": "header-parameter-value",\n }],\n query_string=[{\n "isValueSecret": False,\n "key": "query-string-parameter-key",\n "value": "query-string-parameter-value",\n }],\n ),\n ),\n authorization_type="BASIC",\n description="A connection description")\n ```\n\n ## Import\n\n EventBridge Connection can be imported using the `name`, e.g. console\n\n ```sh\n $ pulumi import aws:cloudwatch/eventConnection:EventConnection test ngrok-connection\n ```\n\n :param str resource_name: The name of the resource.\n :param EventConnectionArgs args: The arguments to use to populate this resource\'s properties.\n :param pulumi.ResourceOptions opts: Options for the resource.\n '
... | Provides an EventBridge connection resource.
> **Note:** EventBridge was formerly known as CloudWatch Events. The functionality is identical.
## Example Usage
```python
import pulumi
import pulumi_aws as aws
test = aws.cloudwatch.EventConnection("test",
auth_parameters=aws.cloudwatch.EventConnectionAuthParametersArgs(
api_key=aws.cloudwatch.EventConnectionAuthParametersApiKeyArgs(
key="x-signature",
value="1234",
),
),
authorization_type="API_KEY",
description="A connection description")
```
### Basic Authorization
```python
import pulumi
import pulumi_aws as aws
test = aws.cloudwatch.EventConnection("test",
auth_parameters=aws.cloudwatch.EventConnectionAuthParametersArgs(
basic=aws.cloudwatch.EventConnectionAuthParametersBasicArgs(
password="Pass1234!",
username="user",
),
),
authorization_type="BASIC",
description="A connection description")
```
### OAuth Authorization
```python
import pulumi
import pulumi_aws as aws
test = aws.cloudwatch.EventConnection("test",
auth_parameters=aws.cloudwatch.EventConnectionAuthParametersArgs(
oauth=aws.cloudwatch.EventConnectionAuthParametersOauthArgs(
authorization_endpoint="https://auth.url.com/endpoint",
client_parameters=aws.cloudwatch.EventConnectionAuthParametersOauthClientParametersArgs(
client_id="1234567890",
client_secret="Pass1234!",
),
http_method="GET",
oauth_http_parameters=aws.cloudwatch.EventConnectionAuthParametersOauthOauthHttpParametersArgs(
body=[{
"isValueSecret": False,
"key": "body-parameter-key",
"value": "body-parameter-value",
}],
header=[{
"isValueSecret": False,
"key": "header-parameter-key",
"value": "header-parameter-value",
}],
query_string=[{
"isValueSecret": False,
"key": "query-string-parameter-key",
"value": "query-string-parameter-value",
}],
),
),
),
authorization_type="OAUTH_CLIENT_CREDENTIALS",
description="A connection description")
```
### Invocation Http Parameters
```python
import pulumi
import pulumi_aws as aws
test = aws.cloudwatch.EventConnection("test",
auth_parameters=aws.cloudwatch.EventConnectionAuthParametersArgs(
basic=aws.cloudwatch.EventConnectionAuthParametersBasicArgs(
password="Pass1234!",
username="user",
),
invocation_http_parameters=aws.cloudwatch.EventConnectionAuthParametersInvocationHttpParametersArgs(
body=[
{
"isValueSecret": False,
"key": "body-parameter-key",
"value": "body-parameter-value",
},
{
"isValueSecret": True,
"key": "body-parameter-key2",
"value": "body-parameter-value2",
},
],
header=[{
"isValueSecret": False,
"key": "header-parameter-key",
"value": "header-parameter-value",
}],
query_string=[{
"isValueSecret": False,
"key": "query-string-parameter-key",
"value": "query-string-parameter-value",
}],
),
),
authorization_type="BASIC",
description="A connection description")
```
## Import
EventBridge Connection can be imported using the `name`, e.g. console
```sh
$ pulumi import aws:cloudwatch/eventConnection:EventConnection test ngrok-connection
```
:param str resource_name: The name of the resource.
:param EventConnectionArgs args: The arguments to use to populate this resource's properties.
:param pulumi.ResourceOptions opts: Options for the resource. | sdk/python/pulumi_aws/cloudwatch/event_connection.py | __init__ | rapzo/pulumi-aws | 260 | python | @overload
def __init__(__self__, resource_name: str, args: EventConnectionArgs, opts: Optional[pulumi.ResourceOptions]=None):
'\n Provides an EventBridge connection resource.\n\n > **Note:** EventBridge was formerly known as CloudWatch Events. The functionality is identical.\n\n ## Example Usage\n\n ```python\n import pulumi\n import pulumi_aws as aws\n\n test = aws.cloudwatch.EventConnection("test",\n auth_parameters=aws.cloudwatch.EventConnectionAuthParametersArgs(\n api_key=aws.cloudwatch.EventConnectionAuthParametersApiKeyArgs(\n key="x-signature",\n value="1234",\n ),\n ),\n authorization_type="API_KEY",\n description="A connection description")\n ```\n ### Basic Authorization\n\n ```python\n import pulumi\n import pulumi_aws as aws\n\n test = aws.cloudwatch.EventConnection("test",\n auth_parameters=aws.cloudwatch.EventConnectionAuthParametersArgs(\n basic=aws.cloudwatch.EventConnectionAuthParametersBasicArgs(\n password="Pass1234!",\n username="user",\n ),\n ),\n authorization_type="BASIC",\n description="A connection description")\n ```\n ### OAuth Authorization\n\n ```python\n import pulumi\n import pulumi_aws as aws\n\n test = aws.cloudwatch.EventConnection("test",\n auth_parameters=aws.cloudwatch.EventConnectionAuthParametersArgs(\n oauth=aws.cloudwatch.EventConnectionAuthParametersOauthArgs(\n authorization_endpoint="https://auth.url.com/endpoint",\n client_parameters=aws.cloudwatch.EventConnectionAuthParametersOauthClientParametersArgs(\n client_id="1234567890",\n client_secret="Pass1234!",\n ),\n http_method="GET",\n oauth_http_parameters=aws.cloudwatch.EventConnectionAuthParametersOauthOauthHttpParametersArgs(\n body=[{\n "isValueSecret": False,\n "key": "body-parameter-key",\n "value": "body-parameter-value",\n }],\n header=[{\n "isValueSecret": False,\n "key": "header-parameter-key",\n "value": "header-parameter-value",\n }],\n query_string=[{\n "isValueSecret": False,\n "key": "query-string-parameter-key",\n "value": "query-string-parameter-value",\n }],\n ),\n ),\n ),\n authorization_type="OAUTH_CLIENT_CREDENTIALS",\n description="A connection description")\n ```\n ### Invocation Http Parameters\n\n ```python\n import pulumi\n import pulumi_aws as aws\n\n test = aws.cloudwatch.EventConnection("test",\n auth_parameters=aws.cloudwatch.EventConnectionAuthParametersArgs(\n basic=aws.cloudwatch.EventConnectionAuthParametersBasicArgs(\n password="Pass1234!",\n username="user",\n ),\n invocation_http_parameters=aws.cloudwatch.EventConnectionAuthParametersInvocationHttpParametersArgs(\n body=[\n {\n "isValueSecret": False,\n "key": "body-parameter-key",\n "value": "body-parameter-value",\n },\n {\n "isValueSecret": True,\n "key": "body-parameter-key2",\n "value": "body-parameter-value2",\n },\n ],\n header=[{\n "isValueSecret": False,\n "key": "header-parameter-key",\n "value": "header-parameter-value",\n }],\n query_string=[{\n "isValueSecret": False,\n "key": "query-string-parameter-key",\n "value": "query-string-parameter-value",\n }],\n ),\n ),\n authorization_type="BASIC",\n description="A connection description")\n ```\n\n ## Import\n\n EventBridge Connection can be imported using the `name`, e.g. console\n\n ```sh\n $ pulumi import aws:cloudwatch/eventConnection:EventConnection test ngrok-connection\n ```\n\n :param str resource_name: The name of the resource.\n :param EventConnectionArgs args: The arguments to use to populate this resource\'s properties.\n :param pulumi.ResourceOptions opts: Options for the resource.\n '
... | @overload
def __init__(__self__, resource_name: str, args: EventConnectionArgs, opts: Optional[pulumi.ResourceOptions]=None):
'\n Provides an EventBridge connection resource.\n\n > **Note:** EventBridge was formerly known as CloudWatch Events. The functionality is identical.\n\n ## Example Usage\n\n ```python\n import pulumi\n import pulumi_aws as aws\n\n test = aws.cloudwatch.EventConnection("test",\n auth_parameters=aws.cloudwatch.EventConnectionAuthParametersArgs(\n api_key=aws.cloudwatch.EventConnectionAuthParametersApiKeyArgs(\n key="x-signature",\n value="1234",\n ),\n ),\n authorization_type="API_KEY",\n description="A connection description")\n ```\n ### Basic Authorization\n\n ```python\n import pulumi\n import pulumi_aws as aws\n\n test = aws.cloudwatch.EventConnection("test",\n auth_parameters=aws.cloudwatch.EventConnectionAuthParametersArgs(\n basic=aws.cloudwatch.EventConnectionAuthParametersBasicArgs(\n password="Pass1234!",\n username="user",\n ),\n ),\n authorization_type="BASIC",\n description="A connection description")\n ```\n ### OAuth Authorization\n\n ```python\n import pulumi\n import pulumi_aws as aws\n\n test = aws.cloudwatch.EventConnection("test",\n auth_parameters=aws.cloudwatch.EventConnectionAuthParametersArgs(\n oauth=aws.cloudwatch.EventConnectionAuthParametersOauthArgs(\n authorization_endpoint="https://auth.url.com/endpoint",\n client_parameters=aws.cloudwatch.EventConnectionAuthParametersOauthClientParametersArgs(\n client_id="1234567890",\n client_secret="Pass1234!",\n ),\n http_method="GET",\n oauth_http_parameters=aws.cloudwatch.EventConnectionAuthParametersOauthOauthHttpParametersArgs(\n body=[{\n "isValueSecret": False,\n "key": "body-parameter-key",\n "value": "body-parameter-value",\n }],\n header=[{\n "isValueSecret": False,\n "key": "header-parameter-key",\n "value": "header-parameter-value",\n }],\n query_string=[{\n "isValueSecret": False,\n "key": "query-string-parameter-key",\n "value": "query-string-parameter-value",\n }],\n ),\n ),\n ),\n authorization_type="OAUTH_CLIENT_CREDENTIALS",\n description="A connection description")\n ```\n ### Invocation Http Parameters\n\n ```python\n import pulumi\n import pulumi_aws as aws\n\n test = aws.cloudwatch.EventConnection("test",\n auth_parameters=aws.cloudwatch.EventConnectionAuthParametersArgs(\n basic=aws.cloudwatch.EventConnectionAuthParametersBasicArgs(\n password="Pass1234!",\n username="user",\n ),\n invocation_http_parameters=aws.cloudwatch.EventConnectionAuthParametersInvocationHttpParametersArgs(\n body=[\n {\n "isValueSecret": False,\n "key": "body-parameter-key",\n "value": "body-parameter-value",\n },\n {\n "isValueSecret": True,\n "key": "body-parameter-key2",\n "value": "body-parameter-value2",\n },\n ],\n header=[{\n "isValueSecret": False,\n "key": "header-parameter-key",\n "value": "header-parameter-value",\n }],\n query_string=[{\n "isValueSecret": False,\n "key": "query-string-parameter-key",\n "value": "query-string-parameter-value",\n }],\n ),\n ),\n authorization_type="BASIC",\n description="A connection description")\n ```\n\n ## Import\n\n EventBridge Connection can be imported using the `name`, e.g. console\n\n ```sh\n $ pulumi import aws:cloudwatch/eventConnection:EventConnection test ngrok-connection\n ```\n\n :param str resource_name: The name of the resource.\n :param EventConnectionArgs args: The arguments to use to populate this resource\'s properties.\n :param pulumi.ResourceOptions opts: Options for the resource.\n '
...<|docstring|>Provides an EventBridge connection resource.
> **Note:** EventBridge was formerly known as CloudWatch Events. The functionality is identical.
## Example Usage
```python
import pulumi
import pulumi_aws as aws
test = aws.cloudwatch.EventConnection("test",
auth_parameters=aws.cloudwatch.EventConnectionAuthParametersArgs(
api_key=aws.cloudwatch.EventConnectionAuthParametersApiKeyArgs(
key="x-signature",
value="1234",
),
),
authorization_type="API_KEY",
description="A connection description")
```
### Basic Authorization
```python
import pulumi
import pulumi_aws as aws
test = aws.cloudwatch.EventConnection("test",
auth_parameters=aws.cloudwatch.EventConnectionAuthParametersArgs(
basic=aws.cloudwatch.EventConnectionAuthParametersBasicArgs(
password="Pass1234!",
username="user",
),
),
authorization_type="BASIC",
description="A connection description")
```
### OAuth Authorization
```python
import pulumi
import pulumi_aws as aws
test = aws.cloudwatch.EventConnection("test",
auth_parameters=aws.cloudwatch.EventConnectionAuthParametersArgs(
oauth=aws.cloudwatch.EventConnectionAuthParametersOauthArgs(
authorization_endpoint="https://auth.url.com/endpoint",
client_parameters=aws.cloudwatch.EventConnectionAuthParametersOauthClientParametersArgs(
client_id="1234567890",
client_secret="Pass1234!",
),
http_method="GET",
oauth_http_parameters=aws.cloudwatch.EventConnectionAuthParametersOauthOauthHttpParametersArgs(
body=[{
"isValueSecret": False,
"key": "body-parameter-key",
"value": "body-parameter-value",
}],
header=[{
"isValueSecret": False,
"key": "header-parameter-key",
"value": "header-parameter-value",
}],
query_string=[{
"isValueSecret": False,
"key": "query-string-parameter-key",
"value": "query-string-parameter-value",
}],
),
),
),
authorization_type="OAUTH_CLIENT_CREDENTIALS",
description="A connection description")
```
### Invocation Http Parameters
```python
import pulumi
import pulumi_aws as aws
test = aws.cloudwatch.EventConnection("test",
auth_parameters=aws.cloudwatch.EventConnectionAuthParametersArgs(
basic=aws.cloudwatch.EventConnectionAuthParametersBasicArgs(
password="Pass1234!",
username="user",
),
invocation_http_parameters=aws.cloudwatch.EventConnectionAuthParametersInvocationHttpParametersArgs(
body=[
{
"isValueSecret": False,
"key": "body-parameter-key",
"value": "body-parameter-value",
},
{
"isValueSecret": True,
"key": "body-parameter-key2",
"value": "body-parameter-value2",
},
],
header=[{
"isValueSecret": False,
"key": "header-parameter-key",
"value": "header-parameter-value",
}],
query_string=[{
"isValueSecret": False,
"key": "query-string-parameter-key",
"value": "query-string-parameter-value",
}],
),
),
authorization_type="BASIC",
description="A connection description")
```
## Import
EventBridge Connection can be imported using the `name`, e.g. console
```sh
$ pulumi import aws:cloudwatch/eventConnection:EventConnection test ngrok-connection
```
:param str resource_name: The name of the resource.
:param EventConnectionArgs args: The arguments to use to populate this resource's properties.
:param pulumi.ResourceOptions opts: Options for the resource.<|endoftext|> |
2082d0c2c51b796fff87b74b98396ae10f87fb61492cfc90cb9d4b429bc195bc | @staticmethod
def get(resource_name: str, id: pulumi.Input[str], opts: Optional[pulumi.ResourceOptions]=None, arn: Optional[pulumi.Input[str]]=None, auth_parameters: Optional[pulumi.Input[pulumi.InputType['EventConnectionAuthParametersArgs']]]=None, authorization_type: Optional[pulumi.Input[str]]=None, description: Optional[pulumi.Input[str]]=None, name: Optional[pulumi.Input[str]]=None, secret_arn: Optional[pulumi.Input[str]]=None) -> 'EventConnection':
"\n Get an existing EventConnection resource's state with the given name, id, and optional extra\n properties used to qualify the lookup.\n\n :param str resource_name: The unique name of the resulting resource.\n :param pulumi.Input[str] id: The unique provider ID of the resource to lookup.\n :param pulumi.ResourceOptions opts: Options for the resource.\n :param pulumi.Input[str] arn: The Amazon Resource Name (ARN) of the connection.\n :param pulumi.Input[pulumi.InputType['EventConnectionAuthParametersArgs']] auth_parameters: Parameters used for authorization. A maximum of 1 are allowed. Documented below.\n :param pulumi.Input[str] authorization_type: Choose the type of authorization to use for the connection. One of `API_KEY`,`BASIC`,`OAUTH_CLIENT_CREDENTIALS`.\n :param pulumi.Input[str] description: Enter a description for the connection. Maximum of 512 characters.\n :param pulumi.Input[str] name: The name of the new connection. Maximum of 64 characters consisting of numbers, lower/upper case letters, .,-,_.\n :param pulumi.Input[str] secret_arn: The Amazon Resource Name (ARN) of the secret created from the authorization parameters specified for the connection.\n "
opts = pulumi.ResourceOptions.merge(opts, pulumi.ResourceOptions(id=id))
__props__ = _EventConnectionState.__new__(_EventConnectionState)
__props__.__dict__['arn'] = arn
__props__.__dict__['auth_parameters'] = auth_parameters
__props__.__dict__['authorization_type'] = authorization_type
__props__.__dict__['description'] = description
__props__.__dict__['name'] = name
__props__.__dict__['secret_arn'] = secret_arn
return EventConnection(resource_name, opts=opts, __props__=__props__) | Get an existing EventConnection resource's state with the given name, id, and optional extra
properties used to qualify the lookup.
:param str resource_name: The unique name of the resulting resource.
:param pulumi.Input[str] id: The unique provider ID of the resource to lookup.
:param pulumi.ResourceOptions opts: Options for the resource.
:param pulumi.Input[str] arn: The Amazon Resource Name (ARN) of the connection.
:param pulumi.Input[pulumi.InputType['EventConnectionAuthParametersArgs']] auth_parameters: Parameters used for authorization. A maximum of 1 are allowed. Documented below.
:param pulumi.Input[str] authorization_type: Choose the type of authorization to use for the connection. One of `API_KEY`,`BASIC`,`OAUTH_CLIENT_CREDENTIALS`.
:param pulumi.Input[str] description: Enter a description for the connection. Maximum of 512 characters.
:param pulumi.Input[str] name: The name of the new connection. Maximum of 64 characters consisting of numbers, lower/upper case letters, .,-,_.
:param pulumi.Input[str] secret_arn: The Amazon Resource Name (ARN) of the secret created from the authorization parameters specified for the connection. | sdk/python/pulumi_aws/cloudwatch/event_connection.py | get | rapzo/pulumi-aws | 260 | python | @staticmethod
def get(resource_name: str, id: pulumi.Input[str], opts: Optional[pulumi.ResourceOptions]=None, arn: Optional[pulumi.Input[str]]=None, auth_parameters: Optional[pulumi.Input[pulumi.InputType['EventConnectionAuthParametersArgs']]]=None, authorization_type: Optional[pulumi.Input[str]]=None, description: Optional[pulumi.Input[str]]=None, name: Optional[pulumi.Input[str]]=None, secret_arn: Optional[pulumi.Input[str]]=None) -> 'EventConnection':
"\n Get an existing EventConnection resource's state with the given name, id, and optional extra\n properties used to qualify the lookup.\n\n :param str resource_name: The unique name of the resulting resource.\n :param pulumi.Input[str] id: The unique provider ID of the resource to lookup.\n :param pulumi.ResourceOptions opts: Options for the resource.\n :param pulumi.Input[str] arn: The Amazon Resource Name (ARN) of the connection.\n :param pulumi.Input[pulumi.InputType['EventConnectionAuthParametersArgs']] auth_parameters: Parameters used for authorization. A maximum of 1 are allowed. Documented below.\n :param pulumi.Input[str] authorization_type: Choose the type of authorization to use for the connection. One of `API_KEY`,`BASIC`,`OAUTH_CLIENT_CREDENTIALS`.\n :param pulumi.Input[str] description: Enter a description for the connection. Maximum of 512 characters.\n :param pulumi.Input[str] name: The name of the new connection. Maximum of 64 characters consisting of numbers, lower/upper case letters, .,-,_.\n :param pulumi.Input[str] secret_arn: The Amazon Resource Name (ARN) of the secret created from the authorization parameters specified for the connection.\n "
opts = pulumi.ResourceOptions.merge(opts, pulumi.ResourceOptions(id=id))
__props__ = _EventConnectionState.__new__(_EventConnectionState)
__props__.__dict__['arn'] = arn
__props__.__dict__['auth_parameters'] = auth_parameters
__props__.__dict__['authorization_type'] = authorization_type
__props__.__dict__['description'] = description
__props__.__dict__['name'] = name
__props__.__dict__['secret_arn'] = secret_arn
return EventConnection(resource_name, opts=opts, __props__=__props__) | @staticmethod
def get(resource_name: str, id: pulumi.Input[str], opts: Optional[pulumi.ResourceOptions]=None, arn: Optional[pulumi.Input[str]]=None, auth_parameters: Optional[pulumi.Input[pulumi.InputType['EventConnectionAuthParametersArgs']]]=None, authorization_type: Optional[pulumi.Input[str]]=None, description: Optional[pulumi.Input[str]]=None, name: Optional[pulumi.Input[str]]=None, secret_arn: Optional[pulumi.Input[str]]=None) -> 'EventConnection':
"\n Get an existing EventConnection resource's state with the given name, id, and optional extra\n properties used to qualify the lookup.\n\n :param str resource_name: The unique name of the resulting resource.\n :param pulumi.Input[str] id: The unique provider ID of the resource to lookup.\n :param pulumi.ResourceOptions opts: Options for the resource.\n :param pulumi.Input[str] arn: The Amazon Resource Name (ARN) of the connection.\n :param pulumi.Input[pulumi.InputType['EventConnectionAuthParametersArgs']] auth_parameters: Parameters used for authorization. A maximum of 1 are allowed. Documented below.\n :param pulumi.Input[str] authorization_type: Choose the type of authorization to use for the connection. One of `API_KEY`,`BASIC`,`OAUTH_CLIENT_CREDENTIALS`.\n :param pulumi.Input[str] description: Enter a description for the connection. Maximum of 512 characters.\n :param pulumi.Input[str] name: The name of the new connection. Maximum of 64 characters consisting of numbers, lower/upper case letters, .,-,_.\n :param pulumi.Input[str] secret_arn: The Amazon Resource Name (ARN) of the secret created from the authorization parameters specified for the connection.\n "
opts = pulumi.ResourceOptions.merge(opts, pulumi.ResourceOptions(id=id))
__props__ = _EventConnectionState.__new__(_EventConnectionState)
__props__.__dict__['arn'] = arn
__props__.__dict__['auth_parameters'] = auth_parameters
__props__.__dict__['authorization_type'] = authorization_type
__props__.__dict__['description'] = description
__props__.__dict__['name'] = name
__props__.__dict__['secret_arn'] = secret_arn
return EventConnection(resource_name, opts=opts, __props__=__props__)<|docstring|>Get an existing EventConnection resource's state with the given name, id, and optional extra
properties used to qualify the lookup.
:param str resource_name: The unique name of the resulting resource.
:param pulumi.Input[str] id: The unique provider ID of the resource to lookup.
:param pulumi.ResourceOptions opts: Options for the resource.
:param pulumi.Input[str] arn: The Amazon Resource Name (ARN) of the connection.
:param pulumi.Input[pulumi.InputType['EventConnectionAuthParametersArgs']] auth_parameters: Parameters used for authorization. A maximum of 1 are allowed. Documented below.
:param pulumi.Input[str] authorization_type: Choose the type of authorization to use for the connection. One of `API_KEY`,`BASIC`,`OAUTH_CLIENT_CREDENTIALS`.
:param pulumi.Input[str] description: Enter a description for the connection. Maximum of 512 characters.
:param pulumi.Input[str] name: The name of the new connection. Maximum of 64 characters consisting of numbers, lower/upper case letters, .,-,_.
:param pulumi.Input[str] secret_arn: The Amazon Resource Name (ARN) of the secret created from the authorization parameters specified for the connection.<|endoftext|> |
504bcc4f9fcd7a9b3d7c70f0f65f048a9e29c3bb41d72293077e631c07f9f6e9 | @property
@pulumi.getter
def arn(self) -> pulumi.Output[str]:
'\n The Amazon Resource Name (ARN) of the connection.\n '
return pulumi.get(self, 'arn') | The Amazon Resource Name (ARN) of the connection. | sdk/python/pulumi_aws/cloudwatch/event_connection.py | arn | rapzo/pulumi-aws | 260 | python | @property
@pulumi.getter
def arn(self) -> pulumi.Output[str]:
'\n \n '
return pulumi.get(self, 'arn') | @property
@pulumi.getter
def arn(self) -> pulumi.Output[str]:
'\n \n '
return pulumi.get(self, 'arn')<|docstring|>The Amazon Resource Name (ARN) of the connection.<|endoftext|> |
cf35fbe1c4be43aa07a5857208b96f470857fcf766e60fce98d44dc5cdec8985 | @property
@pulumi.getter(name='authParameters')
def auth_parameters(self) -> pulumi.Output['outputs.EventConnectionAuthParameters']:
'\n Parameters used for authorization. A maximum of 1 are allowed. Documented below.\n '
return pulumi.get(self, 'auth_parameters') | Parameters used for authorization. A maximum of 1 are allowed. Documented below. | sdk/python/pulumi_aws/cloudwatch/event_connection.py | auth_parameters | rapzo/pulumi-aws | 260 | python | @property
@pulumi.getter(name='authParameters')
def auth_parameters(self) -> pulumi.Output['outputs.EventConnectionAuthParameters']:
'\n \n '
return pulumi.get(self, 'auth_parameters') | @property
@pulumi.getter(name='authParameters')
def auth_parameters(self) -> pulumi.Output['outputs.EventConnectionAuthParameters']:
'\n \n '
return pulumi.get(self, 'auth_parameters')<|docstring|>Parameters used for authorization. A maximum of 1 are allowed. Documented below.<|endoftext|> |
e996d37ed4bcdb100bfc919ca076a24fac1a555034b82752434e3b40d22f0fd6 | @property
@pulumi.getter(name='authorizationType')
def authorization_type(self) -> pulumi.Output[str]:
'\n Choose the type of authorization to use for the connection. One of `API_KEY`,`BASIC`,`OAUTH_CLIENT_CREDENTIALS`.\n '
return pulumi.get(self, 'authorization_type') | Choose the type of authorization to use for the connection. One of `API_KEY`,`BASIC`,`OAUTH_CLIENT_CREDENTIALS`. | sdk/python/pulumi_aws/cloudwatch/event_connection.py | authorization_type | rapzo/pulumi-aws | 260 | python | @property
@pulumi.getter(name='authorizationType')
def authorization_type(self) -> pulumi.Output[str]:
'\n \n '
return pulumi.get(self, 'authorization_type') | @property
@pulumi.getter(name='authorizationType')
def authorization_type(self) -> pulumi.Output[str]:
'\n \n '
return pulumi.get(self, 'authorization_type')<|docstring|>Choose the type of authorization to use for the connection. One of `API_KEY`,`BASIC`,`OAUTH_CLIENT_CREDENTIALS`.<|endoftext|> |
5233f9914666662af62d615e8e433b54093fcec7f3cca1632de19e417bcfa2cd | @property
@pulumi.getter
def description(self) -> pulumi.Output[Optional[str]]:
'\n Enter a description for the connection. Maximum of 512 characters.\n '
return pulumi.get(self, 'description') | Enter a description for the connection. Maximum of 512 characters. | sdk/python/pulumi_aws/cloudwatch/event_connection.py | description | rapzo/pulumi-aws | 260 | python | @property
@pulumi.getter
def description(self) -> pulumi.Output[Optional[str]]:
'\n \n '
return pulumi.get(self, 'description') | @property
@pulumi.getter
def description(self) -> pulumi.Output[Optional[str]]:
'\n \n '
return pulumi.get(self, 'description')<|docstring|>Enter a description for the connection. Maximum of 512 characters.<|endoftext|> |
77dbc218eb7b95b5202c08b3386509fc48a13355a6f1859bdc918c3ff665eeaa | @property
@pulumi.getter
def name(self) -> pulumi.Output[str]:
'\n The name of the new connection. Maximum of 64 characters consisting of numbers, lower/upper case letters, .,-,_.\n '
return pulumi.get(self, 'name') | The name of the new connection. Maximum of 64 characters consisting of numbers, lower/upper case letters, .,-,_. | sdk/python/pulumi_aws/cloudwatch/event_connection.py | name | rapzo/pulumi-aws | 260 | python | @property
@pulumi.getter
def name(self) -> pulumi.Output[str]:
'\n \n '
return pulumi.get(self, 'name') | @property
@pulumi.getter
def name(self) -> pulumi.Output[str]:
'\n \n '
return pulumi.get(self, 'name')<|docstring|>The name of the new connection. Maximum of 64 characters consisting of numbers, lower/upper case letters, .,-,_.<|endoftext|> |
096ed7257c9e68b1f7f4559d264a52f4ed6f17584dfe1b386f30607808e6a81f | @property
@pulumi.getter(name='secretArn')
def secret_arn(self) -> pulumi.Output[str]:
'\n The Amazon Resource Name (ARN) of the secret created from the authorization parameters specified for the connection.\n '
return pulumi.get(self, 'secret_arn') | The Amazon Resource Name (ARN) of the secret created from the authorization parameters specified for the connection. | sdk/python/pulumi_aws/cloudwatch/event_connection.py | secret_arn | rapzo/pulumi-aws | 260 | python | @property
@pulumi.getter(name='secretArn')
def secret_arn(self) -> pulumi.Output[str]:
'\n \n '
return pulumi.get(self, 'secret_arn') | @property
@pulumi.getter(name='secretArn')
def secret_arn(self) -> pulumi.Output[str]:
'\n \n '
return pulumi.get(self, 'secret_arn')<|docstring|>The Amazon Resource Name (ARN) of the secret created from the authorization parameters specified for the connection.<|endoftext|> |
fb254f9d0452df8bfcd985dbd821fbf3f625806398659e0858a418905661a94d | def __repr__(self):
'\n Represent detailed ZabbixMetric view.\n '
result = json.dumps(self.__dict__)
logger.debug('{0}: {1}'.format(self.__class__.__name__, result))
return result | Represent detailed ZabbixMetric view. | Custom/events/Zabbix/API/zabbix/sender.py | __repr__ | aplishka-az/Deadline | 113 | python | def __repr__(self):
'\n \n '
result = json.dumps(self.__dict__)
logger.debug('{0}: {1}'.format(self.__class__.__name__, result))
return result | def __repr__(self):
'\n \n '
result = json.dumps(self.__dict__)
logger.debug('{0}: {1}'.format(self.__class__.__name__, result))
return result<|docstring|>Represent detailed ZabbixMetric view.<|endoftext|> |
784afb8fdab91c3dedd74ec6532208a1fcaed7da9400ced5d68b5c867dc9d606 | def __load_from_config(self, config_file):
"\n Load zabbix server ip address and port from zabbix agent file\n\n If Server or Port variable won't be found if the file, they will be\n seted up from defaults: 127.0.0.1:10051\n "
if (config_file and isinstance(config_file, bool)):
config_file = '/etc/zabbix/zabbix_agentd.conf'
result = None
try:
'This is workaround for config wile without sections'
with open(config_file, 'r') as f:
config_file_data = ('[root]\n' + f.read())
except:
result = False
exit()
config_file_fp = StringIO.StringIO(config_file_data)
config = ConfigParser.RawConfigParser({'Server': '127.0.0.1', 'Port': 10051})
config.readfp(config_file_fp)
zabbix_server = config.get('root', 'Server')
zabbix_port = config.get('root', 'Port')
zabbix_server_list = [server.strip() for server in zabbix_server.split(',')]
result = [(server, zabbix_port) for server in zabbix_server_list]
return result | Load zabbix server ip address and port from zabbix agent file
If Server or Port variable won't be found if the file, they will be
seted up from defaults: 127.0.0.1:10051 | Custom/events/Zabbix/API/zabbix/sender.py | __load_from_config | aplishka-az/Deadline | 113 | python | def __load_from_config(self, config_file):
"\n Load zabbix server ip address and port from zabbix agent file\n\n If Server or Port variable won't be found if the file, they will be\n seted up from defaults: 127.0.0.1:10051\n "
if (config_file and isinstance(config_file, bool)):
config_file = '/etc/zabbix/zabbix_agentd.conf'
result = None
try:
'This is workaround for config wile without sections'
with open(config_file, 'r') as f:
config_file_data = ('[root]\n' + f.read())
except:
result = False
exit()
config_file_fp = StringIO.StringIO(config_file_data)
config = ConfigParser.RawConfigParser({'Server': '127.0.0.1', 'Port': 10051})
config.readfp(config_file_fp)
zabbix_server = config.get('root', 'Server')
zabbix_port = config.get('root', 'Port')
zabbix_server_list = [server.strip() for server in zabbix_server.split(',')]
result = [(server, zabbix_port) for server in zabbix_server_list]
return result | def __load_from_config(self, config_file):
"\n Load zabbix server ip address and port from zabbix agent file\n\n If Server or Port variable won't be found if the file, they will be\n seted up from defaults: 127.0.0.1:10051\n "
if (config_file and isinstance(config_file, bool)):
config_file = '/etc/zabbix/zabbix_agentd.conf'
result = None
try:
'This is workaround for config wile without sections'
with open(config_file, 'r') as f:
config_file_data = ('[root]\n' + f.read())
except:
result = False
exit()
config_file_fp = StringIO.StringIO(config_file_data)
config = ConfigParser.RawConfigParser({'Server': '127.0.0.1', 'Port': 10051})
config.readfp(config_file_fp)
zabbix_server = config.get('root', 'Server')
zabbix_port = config.get('root', 'Port')
zabbix_server_list = [server.strip() for server in zabbix_server.split(',')]
result = [(server, zabbix_port) for server in zabbix_server_list]
return result<|docstring|>Load zabbix server ip address and port from zabbix agent file
If Server or Port variable won't be found if the file, they will be
seted up from defaults: 127.0.0.1:10051<|endoftext|> |
08835558611e995116379918e72efa1cfb1ffd5b61b034c484c83153c6f57abf | def __receive(self, socket, count):
'\n Reads socket to receive data from zabbix server.\n\n Attributes:\n socket (socket): Socket object from which data should be read\n count (int): Amount of data that should be read from socket, in bytes.\n '
buf = ''
while (len(buf) < count):
chunk = socket.recv((count - len(buf)))
if (not chunk):
break
buf += chunk
return buf | Reads socket to receive data from zabbix server.
Attributes:
socket (socket): Socket object from which data should be read
count (int): Amount of data that should be read from socket, in bytes. | Custom/events/Zabbix/API/zabbix/sender.py | __receive | aplishka-az/Deadline | 113 | python | def __receive(self, socket, count):
'\n Reads socket to receive data from zabbix server.\n\n Attributes:\n socket (socket): Socket object from which data should be read\n count (int): Amount of data that should be read from socket, in bytes.\n '
buf =
while (len(buf) < count):
chunk = socket.recv((count - len(buf)))
if (not chunk):
break
buf += chunk
return buf | def __receive(self, socket, count):
'\n Reads socket to receive data from zabbix server.\n\n Attributes:\n socket (socket): Socket object from which data should be read\n count (int): Amount of data that should be read from socket, in bytes.\n '
buf =
while (len(buf) < count):
chunk = socket.recv((count - len(buf)))
if (not chunk):
break
buf += chunk
return buf<|docstring|>Reads socket to receive data from zabbix server.
Attributes:
socket (socket): Socket object from which data should be read
count (int): Amount of data that should be read from socket, in bytes.<|endoftext|> |
38693edd97f49ba3a32254e838c153b5ff902ef534bcf7aa2ec25ff9fd80bb95 | def __create_messages(self, metrics_array):
'\n Create a list of zabbix messages, from a list of ZabbixMetrics.\n\n Attributes:\n metrics_array (list of ZabbixMetrics): List of ZabbixMetrics\n\n Returns:\n list of str: List of zabbix messages\n '
metrics = []
for m in metrics_array:
metrics.append(str(m))
logger.debug('{0}.__create_messages: {1}'.format(self.cn, metrics))
return metrics | Create a list of zabbix messages, from a list of ZabbixMetrics.
Attributes:
metrics_array (list of ZabbixMetrics): List of ZabbixMetrics
Returns:
list of str: List of zabbix messages | Custom/events/Zabbix/API/zabbix/sender.py | __create_messages | aplishka-az/Deadline | 113 | python | def __create_messages(self, metrics_array):
'\n Create a list of zabbix messages, from a list of ZabbixMetrics.\n\n Attributes:\n metrics_array (list of ZabbixMetrics): List of ZabbixMetrics\n\n Returns:\n list of str: List of zabbix messages\n '
metrics = []
for m in metrics_array:
metrics.append(str(m))
logger.debug('{0}.__create_messages: {1}'.format(self.cn, metrics))
return metrics | def __create_messages(self, metrics_array):
'\n Create a list of zabbix messages, from a list of ZabbixMetrics.\n\n Attributes:\n metrics_array (list of ZabbixMetrics): List of ZabbixMetrics\n\n Returns:\n list of str: List of zabbix messages\n '
metrics = []
for m in metrics_array:
metrics.append(str(m))
logger.debug('{0}.__create_messages: {1}'.format(self.cn, metrics))
return metrics<|docstring|>Create a list of zabbix messages, from a list of ZabbixMetrics.
Attributes:
metrics_array (list of ZabbixMetrics): List of ZabbixMetrics
Returns:
list of str: List of zabbix messages<|endoftext|> |
255db727410b30bb4048fae8fd34ddfe0d32b87a314c4c16ed68b0b9c447dca5 | def __create_request(self, messages):
'\n Create a formated request to zabbix from a list of messages.\n\n Attributes:\n messages (list of str): List zabbix messages\n\n Returns:\n str: Formated request to zabbix\n '
request = '{{"request":"sender data","data":[{0}]}}'.format(','.join(messages))
logger.debug('{0}.__create_request: {1}'.format(self.cn, request))
return request | Create a formated request to zabbix from a list of messages.
Attributes:
messages (list of str): List zabbix messages
Returns:
str: Formated request to zabbix | Custom/events/Zabbix/API/zabbix/sender.py | __create_request | aplishka-az/Deadline | 113 | python | def __create_request(self, messages):
'\n Create a formated request to zabbix from a list of messages.\n\n Attributes:\n messages (list of str): List zabbix messages\n\n Returns:\n str: Formated request to zabbix\n '
request = '{{"request":"sender data","data":[{0}]}}'.format(','.join(messages))
logger.debug('{0}.__create_request: {1}'.format(self.cn, request))
return request | def __create_request(self, messages):
'\n Create a formated request to zabbix from a list of messages.\n\n Attributes:\n messages (list of str): List zabbix messages\n\n Returns:\n str: Formated request to zabbix\n '
request = '{{"request":"sender data","data":[{0}]}}'.format(','.join(messages))
logger.debug('{0}.__create_request: {1}'.format(self.cn, request))
return request<|docstring|>Create a formated request to zabbix from a list of messages.
Attributes:
messages (list of str): List zabbix messages
Returns:
str: Formated request to zabbix<|endoftext|> |
d2c8c1d96f18999f6a1634d57a9283d56700d310ccd443e5f6866ae43f59f826 | def __create_packet(self, request):
'\n Create a formated packet from a request.\n\n Attributes:\n request (str): Request string to zabbix\n\n Returns:\n str: Packet string to zabbix\n '
data_len = struct.pack('<Q', len(request))
packet = (('ZBXD\x01' + data_len) + request)
logger.debug('{0}.__create_packet (str): {1}'.format(self.cn, packet))
logger.debug('{0}.__create_packet (hex): {1}'.format(self.cn, ':'.join((x.encode('hex') for x in packet))))
return packet | Create a formated packet from a request.
Attributes:
request (str): Request string to zabbix
Returns:
str: Packet string to zabbix | Custom/events/Zabbix/API/zabbix/sender.py | __create_packet | aplishka-az/Deadline | 113 | python | def __create_packet(self, request):
'\n Create a formated packet from a request.\n\n Attributes:\n request (str): Request string to zabbix\n\n Returns:\n str: Packet string to zabbix\n '
data_len = struct.pack('<Q', len(request))
packet = (('ZBXD\x01' + data_len) + request)
logger.debug('{0}.__create_packet (str): {1}'.format(self.cn, packet))
logger.debug('{0}.__create_packet (hex): {1}'.format(self.cn, ':'.join((x.encode('hex') for x in packet))))
return packet | def __create_packet(self, request):
'\n Create a formated packet from a request.\n\n Attributes:\n request (str): Request string to zabbix\n\n Returns:\n str: Packet string to zabbix\n '
data_len = struct.pack('<Q', len(request))
packet = (('ZBXD\x01' + data_len) + request)
logger.debug('{0}.__create_packet (str): {1}'.format(self.cn, packet))
logger.debug('{0}.__create_packet (hex): {1}'.format(self.cn, ':'.join((x.encode('hex') for x in packet))))
return packet<|docstring|>Create a formated packet from a request.
Attributes:
request (str): Request string to zabbix
Returns:
str: Packet string to zabbix<|endoftext|> |
dcdba4999241ee83a27226fc403233ad402ef05d69e461fededde025320c64af | def __get_response(self, connection):
'\n Get response from zabbix server, reads from self.socket.\n\n Returns:\n str: JSON response from zabbix server\n '
result = None
response_header = self.__receive(connection, 13)
logger.debug('{0}.__get_response.response_header: {1}'.format(self.cn, response_header))
if ((not response_header.startswith('ZBXD\x01')) or (len(response_header) != 13)):
logger.debug('{0}.__get_response: Wrong zabbix response'.format(self.cn))
result = False
else:
response_len = struct.unpack('<Q', response_header[5:])[0]
try:
response_body = connection.recv(response_len)
finally:
connection.close()
result = json.loads(response_body)
logger.debug('{0}.__get_response: {1}'.format(self.cn, result))
return result | Get response from zabbix server, reads from self.socket.
Returns:
str: JSON response from zabbix server | Custom/events/Zabbix/API/zabbix/sender.py | __get_response | aplishka-az/Deadline | 113 | python | def __get_response(self, connection):
'\n Get response from zabbix server, reads from self.socket.\n\n Returns:\n str: JSON response from zabbix server\n '
result = None
response_header = self.__receive(connection, 13)
logger.debug('{0}.__get_response.response_header: {1}'.format(self.cn, response_header))
if ((not response_header.startswith('ZBXD\x01')) or (len(response_header) != 13)):
logger.debug('{0}.__get_response: Wrong zabbix response'.format(self.cn))
result = False
else:
response_len = struct.unpack('<Q', response_header[5:])[0]
try:
response_body = connection.recv(response_len)
finally:
connection.close()
result = json.loads(response_body)
logger.debug('{0}.__get_response: {1}'.format(self.cn, result))
return result | def __get_response(self, connection):
'\n Get response from zabbix server, reads from self.socket.\n\n Returns:\n str: JSON response from zabbix server\n '
result = None
response_header = self.__receive(connection, 13)
logger.debug('{0}.__get_response.response_header: {1}'.format(self.cn, response_header))
if ((not response_header.startswith('ZBXD\x01')) or (len(response_header) != 13)):
logger.debug('{0}.__get_response: Wrong zabbix response'.format(self.cn))
result = False
else:
response_len = struct.unpack('<Q', response_header[5:])[0]
try:
response_body = connection.recv(response_len)
finally:
connection.close()
result = json.loads(response_body)
logger.debug('{0}.__get_response: {1}'.format(self.cn, result))
return result<|docstring|>Get response from zabbix server, reads from self.socket.
Returns:
str: JSON response from zabbix server<|endoftext|> |
9c5bd0f66c7b9103ac64743baef97b473e82c80e712cba657514d730b41f475b | def send(self, metrics):
'\n Send the metrics to zabbix server.\n\n Attributes:\n metrics (list of ZabbixMetrics): List of metrics that will be send to Zabbix\n\n Returns:\n bool: True if sent successful, False if was an error.\n '
result = None
messages = self.__create_messages(metrics)
request = self.__create_request(messages)
packet = self.__create_packet(request)
for host_addr in self.zabbix_uri:
logger.debug('{0}.send({1}): connecting'.format(self.cn, host_addr))
connection = socket.socket()
connection.connect(host_addr)
try:
connection.sendall(packet)
except Exception as e:
logger.debug('{0}.send: Error while sending the data to zabbix\nERROR:{1}'.format(self.cn, e))
connection.close()
exit()
response = self.__get_response(connection)
logger.debug('{0}.send({1}): {2}'.format(self.cn, host_addr, response))
if (response.get('response') == 'success'):
result = True
else:
logger.debug('{0}.send: Got error from zabbix => {1}'.format(self.cn, response))
raise Exception('Zabbix Server ({0}) reject packet.'.format(host_addr))
return result | Send the metrics to zabbix server.
Attributes:
metrics (list of ZabbixMetrics): List of metrics that will be send to Zabbix
Returns:
bool: True if sent successful, False if was an error. | Custom/events/Zabbix/API/zabbix/sender.py | send | aplishka-az/Deadline | 113 | python | def send(self, metrics):
'\n Send the metrics to zabbix server.\n\n Attributes:\n metrics (list of ZabbixMetrics): List of metrics that will be send to Zabbix\n\n Returns:\n bool: True if sent successful, False if was an error.\n '
result = None
messages = self.__create_messages(metrics)
request = self.__create_request(messages)
packet = self.__create_packet(request)
for host_addr in self.zabbix_uri:
logger.debug('{0}.send({1}): connecting'.format(self.cn, host_addr))
connection = socket.socket()
connection.connect(host_addr)
try:
connection.sendall(packet)
except Exception as e:
logger.debug('{0}.send: Error while sending the data to zabbix\nERROR:{1}'.format(self.cn, e))
connection.close()
exit()
response = self.__get_response(connection)
logger.debug('{0}.send({1}): {2}'.format(self.cn, host_addr, response))
if (response.get('response') == 'success'):
result = True
else:
logger.debug('{0}.send: Got error from zabbix => {1}'.format(self.cn, response))
raise Exception('Zabbix Server ({0}) reject packet.'.format(host_addr))
return result | def send(self, metrics):
'\n Send the metrics to zabbix server.\n\n Attributes:\n metrics (list of ZabbixMetrics): List of metrics that will be send to Zabbix\n\n Returns:\n bool: True if sent successful, False if was an error.\n '
result = None
messages = self.__create_messages(metrics)
request = self.__create_request(messages)
packet = self.__create_packet(request)
for host_addr in self.zabbix_uri:
logger.debug('{0}.send({1}): connecting'.format(self.cn, host_addr))
connection = socket.socket()
connection.connect(host_addr)
try:
connection.sendall(packet)
except Exception as e:
logger.debug('{0}.send: Error while sending the data to zabbix\nERROR:{1}'.format(self.cn, e))
connection.close()
exit()
response = self.__get_response(connection)
logger.debug('{0}.send({1}): {2}'.format(self.cn, host_addr, response))
if (response.get('response') == 'success'):
result = True
else:
logger.debug('{0}.send: Got error from zabbix => {1}'.format(self.cn, response))
raise Exception('Zabbix Server ({0}) reject packet.'.format(host_addr))
return result<|docstring|>Send the metrics to zabbix server.
Attributes:
metrics (list of ZabbixMetrics): List of metrics that will be send to Zabbix
Returns:
bool: True if sent successful, False if was an error.<|endoftext|> |
4c2f56e184737b1a7c42125424a9cb42c3a29d443de76b4c3233ae446923ac52 | def _u_naught_simple(self):
'\n initial guess of the Lagrangian multiplier\n '
return np.random.rand(self.mrows) | initial guess of the Lagrangian multiplier | Setcover/setcover.py | _u_naught_simple | guangtunbenzhu/BGT-Cosmology | 1 | python | def _u_naught_simple(self):
'\n \n '
return np.random.rand(self.mrows) | def _u_naught_simple(self):
'\n \n '
return np.random.rand(self.mrows)<|docstring|>initial guess of the Lagrangian multiplier<|endoftext|> |
cadb2e3e59742ae1f78475eb4243c71aaa4f871ee1d30e291dc1fe0934e6bdfe | def _u_naught(self):
'\n initial guess of the Lagrangian multiplier\n '
adjusted_cost = (self.c / self.a_csc.dot(np.ones(self.mrows)))
cost_matrix = ((adjusted_cost * self.a) + (np.amax(adjusted_cost) * (~ self.a)))
return adjusted_cost[np.argmin(cost_matrix, axis=1)] | initial guess of the Lagrangian multiplier | Setcover/setcover.py | _u_naught | guangtunbenzhu/BGT-Cosmology | 1 | python | def _u_naught(self):
'\n \n '
adjusted_cost = (self.c / self.a_csc.dot(np.ones(self.mrows)))
cost_matrix = ((adjusted_cost * self.a) + (np.amax(adjusted_cost) * (~ self.a)))
return adjusted_cost[np.argmin(cost_matrix, axis=1)] | def _u_naught(self):
'\n \n '
adjusted_cost = (self.c / self.a_csc.dot(np.ones(self.mrows)))
cost_matrix = ((adjusted_cost * self.a) + (np.amax(adjusted_cost) * (~ self.a)))
return adjusted_cost[np.argmin(cost_matrix, axis=1)]<|docstring|>initial guess of the Lagrangian multiplier<|endoftext|> |
a93dad59c1280928cd9a54ff6f4ea1c83372bd3749638e45105be5c208786922 | def greedy(self, u=None, niters_max=1000):
'\n heuristic greedy method to select a set of columns to cover all the rows\n '
niters = 1
if (u is None):
u = self.u
utmp = np.copy(u)
iuncovered = (~ np.any(self.a[(:, self.s)], axis=1))
score = np.zeros(self.ncols)
while ((np.count_nonzero(iuncovered) > 0) and (niters <= niters_max)):
mu = self.a_csc.dot(iuncovered.astype(int)).astype(float)
mu[(mu <= _smallnumber)] = _smallnumber
utmp[(~ iuncovered)] = 0
gamma = (self.c - self.a_csc.dot(utmp))
select_gamma = (gamma >= 0)
if (np.count_nonzero(select_gamma) > 0):
score[select_gamma] = (gamma[select_gamma] / mu[select_gamma])
if (np.count_nonzero((~ select_gamma)) > 0):
score[(~ select_gamma)] = (gamma[(~ select_gamma)] * mu[(~ select_gamma)])
inewcolumn = np.nonzero((~ self.s))[0][np.argmin(score[(~ self.s)])]
self.s[inewcolumn] = True
iuncovered = (~ np.logical_or((~ iuncovered), self.a[(:, inewcolumn)]))
niters = (niters + 1)
if (niters == niters_max):
warnings.warn('Iteration reaches maximum = {0}'.format(niters_max))
return self.total_cost | heuristic greedy method to select a set of columns to cover all the rows | Setcover/setcover.py | greedy | guangtunbenzhu/BGT-Cosmology | 1 | python | def greedy(self, u=None, niters_max=1000):
'\n \n '
niters = 1
if (u is None):
u = self.u
utmp = np.copy(u)
iuncovered = (~ np.any(self.a[(:, self.s)], axis=1))
score = np.zeros(self.ncols)
while ((np.count_nonzero(iuncovered) > 0) and (niters <= niters_max)):
mu = self.a_csc.dot(iuncovered.astype(int)).astype(float)
mu[(mu <= _smallnumber)] = _smallnumber
utmp[(~ iuncovered)] = 0
gamma = (self.c - self.a_csc.dot(utmp))
select_gamma = (gamma >= 0)
if (np.count_nonzero(select_gamma) > 0):
score[select_gamma] = (gamma[select_gamma] / mu[select_gamma])
if (np.count_nonzero((~ select_gamma)) > 0):
score[(~ select_gamma)] = (gamma[(~ select_gamma)] * mu[(~ select_gamma)])
inewcolumn = np.nonzero((~ self.s))[0][np.argmin(score[(~ self.s)])]
self.s[inewcolumn] = True
iuncovered = (~ np.logical_or((~ iuncovered), self.a[(:, inewcolumn)]))
niters = (niters + 1)
if (niters == niters_max):
warnings.warn('Iteration reaches maximum = {0}'.format(niters_max))
return self.total_cost | def greedy(self, u=None, niters_max=1000):
'\n \n '
niters = 1
if (u is None):
u = self.u
utmp = np.copy(u)
iuncovered = (~ np.any(self.a[(:, self.s)], axis=1))
score = np.zeros(self.ncols)
while ((np.count_nonzero(iuncovered) > 0) and (niters <= niters_max)):
mu = self.a_csc.dot(iuncovered.astype(int)).astype(float)
mu[(mu <= _smallnumber)] = _smallnumber
utmp[(~ iuncovered)] = 0
gamma = (self.c - self.a_csc.dot(utmp))
select_gamma = (gamma >= 0)
if (np.count_nonzero(select_gamma) > 0):
score[select_gamma] = (gamma[select_gamma] / mu[select_gamma])
if (np.count_nonzero((~ select_gamma)) > 0):
score[(~ select_gamma)] = (gamma[(~ select_gamma)] * mu[(~ select_gamma)])
inewcolumn = np.nonzero((~ self.s))[0][np.argmin(score[(~ self.s)])]
self.s[inewcolumn] = True
iuncovered = (~ np.logical_or((~ iuncovered), self.a[(:, inewcolumn)]))
niters = (niters + 1)
if (niters == niters_max):
warnings.warn('Iteration reaches maximum = {0}'.format(niters_max))
return self.total_cost<|docstring|>heuristic greedy method to select a set of columns to cover all the rows<|endoftext|> |
36de536f4bcf037c26159a701e7665c85099fdf2a2838760d6109f1060ed9e90 | def update_core(self):
'\n Removing fixed columns\n '
if (~ np.any(self.f)):
a_csr = sparse.csr_matrix(self.a, copy=True)
a_csc = sparse.csr_matrix(self.a.T, copy=True)
else:
a_csr = sparse.csr_matrix(self.a[(:, (~ self.f))][((~ self.f_covered), :)], copy=True)
a_csc = sparse.csr_matrix(self.a[(:, (~ self.f))][((~ self.f_covered), :)].T, copy=True)
return (a_csr, a_csc) | Removing fixed columns | Setcover/setcover.py | update_core | guangtunbenzhu/BGT-Cosmology | 1 | python | def update_core(self):
'\n \n '
if (~ np.any(self.f)):
a_csr = sparse.csr_matrix(self.a, copy=True)
a_csc = sparse.csr_matrix(self.a.T, copy=True)
else:
a_csr = sparse.csr_matrix(self.a[(:, (~ self.f))][((~ self.f_covered), :)], copy=True)
a_csc = sparse.csr_matrix(self.a[(:, (~ self.f))][((~ self.f_covered), :)].T, copy=True)
return (a_csr, a_csc) | def update_core(self):
'\n \n '
if (~ np.any(self.f)):
a_csr = sparse.csr_matrix(self.a, copy=True)
a_csc = sparse.csr_matrix(self.a.T, copy=True)
else:
a_csr = sparse.csr_matrix(self.a[(:, (~ self.f))][((~ self.f_covered), :)], copy=True)
a_csc = sparse.csr_matrix(self.a[(:, (~ self.f))][((~ self.f_covered), :)].T, copy=True)
return (a_csr, a_csc)<|docstring|>Removing fixed columns<|endoftext|> |
8fc442806b1ff1feda88013bec232bab781d42ffa35a27a86655fe44fb6bb9c3 | def subgradient(self):
'\n subgradient step for the core problem N\\S. \n '
UB_full = self.total_cost
ufull = np.copy(self.u)
(a_csr, a_csc) = self.update_core()
mrows = a_csr.shape[0]
ncols = a_csr.shape[1]
u_this = self.u[(~ self.f_covered)]
UB_fixed = np.einsum('i->', self.c[self.f])
UB = (UB_full - UB_fixed)
cost = self.c[(~ self.f)]
u_sequence = np.zeros((mrows, self.subg_nsteps))
Lu_sequence = np.zeros(self.subg_nsteps)
x = np.zeros(ncols, dtype=bool)
niters_max = self.subg_maxsteps
maxfracchange = self.subg_maxfracchange
maxabschange = self.subg_maxabschange
f_change = _largenumber
a_change = _largenumber
niters = 0
Lu_max0 = 0
while (((f_change > maxfracchange) or (a_change > maxabschange)) and (niters < niters_max)):
u_this = ((1.0 + (((np.random.rand(mrows) * 2.0) - 1) * self.u_perturb)) * u_this)
u_sequence[(:, 0)] = u_this
cost_u = (cost - a_csc.dot(u_sequence[(:, 0)]))
Lu_sequence[0] = (np.einsum('i->', cost_u[(cost_u < 0)]) + np.einsum('i->', u_sequence[(:, 0)]))
for i in np.arange((self.subg_nsteps - 1)):
x[0:] = False
x[(cost_u < 0)] = True
s_u = (1.0 - a_csr.dot(x.astype(int)))
s_u_norm = np.einsum('i,i', s_u, s_u)
u_temp = (u_sequence[(:, i)] + (((self.stepsize * (UB - Lu_sequence[i])) / s_u_norm) * s_u))
u_temp[(u_temp < 0)] = 0
u_sequence[(:, (i + 1))] = u_temp
cost_u = (cost - a_csc.dot(u_sequence[(:, (i + 1))]))
Lu_sequence[(i + 1)] = (np.einsum('i->', cost_u[(cost_u < 0)]) + np.einsum('i->', u_sequence[(:, (i + 1))]))
if (np.mod((i + 1), self.subg_nadaptive) == 0):
Lu_max_adapt = np.amax(Lu_sequence[((i + 1) - self.subg_nadaptive):(i + 1)])
Lu_min_adapt = np.amin(Lu_sequence[((i + 1) - self.subg_nadaptive):(i + 1)])
if (Lu_max_adapt <= 0.0):
Lu_max_adapt = _smallnumber
f_change_adapt = ((Lu_max_adapt - Lu_min_adapt) / np.fabs(Lu_max_adapt))
if (f_change_adapt > self.max_adapt):
self.stepsize = (self.stepsize * 0.5)
elif (f_change_adapt < self.min_adapt):
self.stepsize = (self.stepsize * 1.5)
i_optimal = np.argmax(Lu_sequence[((i + 1) - self.subg_nadaptive):(i + 1)])
if (i_optimal != (self.subg_nadaptive - 1)):
u_temp = u_sequence[(:, i)]
u_sequence[(:, i)] = u_sequence[(:, (((i + 1) - self.subg_nadaptive) + i_optimal))]
u_sequence[(:, (((i + 1) - self.subg_nadaptive) + i_optimal))] = u_temp
Lu_sequence[(((i + 1) - self.subg_nadaptive) + i_optimal)] = Lu_sequence[i]
Lu_sequence[i] = Lu_max_adapt
Lu_max = np.amax(Lu_sequence)
i_optimal = np.argmax(Lu_sequence)
u_this = u_sequence[(:, i_optimal)]
niters = (niters + 1)
a_change = (Lu_max - Lu_max0)
f_change = (a_change / np.fabs(Lu_max))
Lu_max0 = Lu_max
if (niters == niters_max):
warnings.warn('Iteration reaches maximum = {0}'.format(niters))
self.u[(~ self.f_covered)] = u_this
u_sequence_full = np.zeros((self.mrows, self.subg_nsteps))
Lu_sequence_full = np.zeros(self.subg_nsteps)
u_sequence_full[(self.f_covered, :)] = self.u[self.f_covered][(:, np.newaxis)]
u_sequence_full[((~ self.f_covered), :)] = u_sequence
cost_u_full = (self.c - self.a_csc.dot(u_sequence_full[(:, 0)]))
Lu_sequence_full[0] = (np.einsum('i->', cost_u_full[(cost_u_full < 0)]) + np.einsum('i->', u_sequence_full[(:, 0)]))
Lu_sequence_full = (Lu_sequence + (Lu_sequence_full[0] - Lu_sequence[0]))
return (u_sequence_full, Lu_sequence_full) | subgradient step for the core problem N\S. | Setcover/setcover.py | subgradient | guangtunbenzhu/BGT-Cosmology | 1 | python | def subgradient(self):
'\n subgradient step for the core problem N\\S. \n '
UB_full = self.total_cost
ufull = np.copy(self.u)
(a_csr, a_csc) = self.update_core()
mrows = a_csr.shape[0]
ncols = a_csr.shape[1]
u_this = self.u[(~ self.f_covered)]
UB_fixed = np.einsum('i->', self.c[self.f])
UB = (UB_full - UB_fixed)
cost = self.c[(~ self.f)]
u_sequence = np.zeros((mrows, self.subg_nsteps))
Lu_sequence = np.zeros(self.subg_nsteps)
x = np.zeros(ncols, dtype=bool)
niters_max = self.subg_maxsteps
maxfracchange = self.subg_maxfracchange
maxabschange = self.subg_maxabschange
f_change = _largenumber
a_change = _largenumber
niters = 0
Lu_max0 = 0
while (((f_change > maxfracchange) or (a_change > maxabschange)) and (niters < niters_max)):
u_this = ((1.0 + (((np.random.rand(mrows) * 2.0) - 1) * self.u_perturb)) * u_this)
u_sequence[(:, 0)] = u_this
cost_u = (cost - a_csc.dot(u_sequence[(:, 0)]))
Lu_sequence[0] = (np.einsum('i->', cost_u[(cost_u < 0)]) + np.einsum('i->', u_sequence[(:, 0)]))
for i in np.arange((self.subg_nsteps - 1)):
x[0:] = False
x[(cost_u < 0)] = True
s_u = (1.0 - a_csr.dot(x.astype(int)))
s_u_norm = np.einsum('i,i', s_u, s_u)
u_temp = (u_sequence[(:, i)] + (((self.stepsize * (UB - Lu_sequence[i])) / s_u_norm) * s_u))
u_temp[(u_temp < 0)] = 0
u_sequence[(:, (i + 1))] = u_temp
cost_u = (cost - a_csc.dot(u_sequence[(:, (i + 1))]))
Lu_sequence[(i + 1)] = (np.einsum('i->', cost_u[(cost_u < 0)]) + np.einsum('i->', u_sequence[(:, (i + 1))]))
if (np.mod((i + 1), self.subg_nadaptive) == 0):
Lu_max_adapt = np.amax(Lu_sequence[((i + 1) - self.subg_nadaptive):(i + 1)])
Lu_min_adapt = np.amin(Lu_sequence[((i + 1) - self.subg_nadaptive):(i + 1)])
if (Lu_max_adapt <= 0.0):
Lu_max_adapt = _smallnumber
f_change_adapt = ((Lu_max_adapt - Lu_min_adapt) / np.fabs(Lu_max_adapt))
if (f_change_adapt > self.max_adapt):
self.stepsize = (self.stepsize * 0.5)
elif (f_change_adapt < self.min_adapt):
self.stepsize = (self.stepsize * 1.5)
i_optimal = np.argmax(Lu_sequence[((i + 1) - self.subg_nadaptive):(i + 1)])
if (i_optimal != (self.subg_nadaptive - 1)):
u_temp = u_sequence[(:, i)]
u_sequence[(:, i)] = u_sequence[(:, (((i + 1) - self.subg_nadaptive) + i_optimal))]
u_sequence[(:, (((i + 1) - self.subg_nadaptive) + i_optimal))] = u_temp
Lu_sequence[(((i + 1) - self.subg_nadaptive) + i_optimal)] = Lu_sequence[i]
Lu_sequence[i] = Lu_max_adapt
Lu_max = np.amax(Lu_sequence)
i_optimal = np.argmax(Lu_sequence)
u_this = u_sequence[(:, i_optimal)]
niters = (niters + 1)
a_change = (Lu_max - Lu_max0)
f_change = (a_change / np.fabs(Lu_max))
Lu_max0 = Lu_max
if (niters == niters_max):
warnings.warn('Iteration reaches maximum = {0}'.format(niters))
self.u[(~ self.f_covered)] = u_this
u_sequence_full = np.zeros((self.mrows, self.subg_nsteps))
Lu_sequence_full = np.zeros(self.subg_nsteps)
u_sequence_full[(self.f_covered, :)] = self.u[self.f_covered][(:, np.newaxis)]
u_sequence_full[((~ self.f_covered), :)] = u_sequence
cost_u_full = (self.c - self.a_csc.dot(u_sequence_full[(:, 0)]))
Lu_sequence_full[0] = (np.einsum('i->', cost_u_full[(cost_u_full < 0)]) + np.einsum('i->', u_sequence_full[(:, 0)]))
Lu_sequence_full = (Lu_sequence + (Lu_sequence_full[0] - Lu_sequence[0]))
return (u_sequence_full, Lu_sequence_full) | def subgradient(self):
'\n subgradient step for the core problem N\\S. \n '
UB_full = self.total_cost
ufull = np.copy(self.u)
(a_csr, a_csc) = self.update_core()
mrows = a_csr.shape[0]
ncols = a_csr.shape[1]
u_this = self.u[(~ self.f_covered)]
UB_fixed = np.einsum('i->', self.c[self.f])
UB = (UB_full - UB_fixed)
cost = self.c[(~ self.f)]
u_sequence = np.zeros((mrows, self.subg_nsteps))
Lu_sequence = np.zeros(self.subg_nsteps)
x = np.zeros(ncols, dtype=bool)
niters_max = self.subg_maxsteps
maxfracchange = self.subg_maxfracchange
maxabschange = self.subg_maxabschange
f_change = _largenumber
a_change = _largenumber
niters = 0
Lu_max0 = 0
while (((f_change > maxfracchange) or (a_change > maxabschange)) and (niters < niters_max)):
u_this = ((1.0 + (((np.random.rand(mrows) * 2.0) - 1) * self.u_perturb)) * u_this)
u_sequence[(:, 0)] = u_this
cost_u = (cost - a_csc.dot(u_sequence[(:, 0)]))
Lu_sequence[0] = (np.einsum('i->', cost_u[(cost_u < 0)]) + np.einsum('i->', u_sequence[(:, 0)]))
for i in np.arange((self.subg_nsteps - 1)):
x[0:] = False
x[(cost_u < 0)] = True
s_u = (1.0 - a_csr.dot(x.astype(int)))
s_u_norm = np.einsum('i,i', s_u, s_u)
u_temp = (u_sequence[(:, i)] + (((self.stepsize * (UB - Lu_sequence[i])) / s_u_norm) * s_u))
u_temp[(u_temp < 0)] = 0
u_sequence[(:, (i + 1))] = u_temp
cost_u = (cost - a_csc.dot(u_sequence[(:, (i + 1))]))
Lu_sequence[(i + 1)] = (np.einsum('i->', cost_u[(cost_u < 0)]) + np.einsum('i->', u_sequence[(:, (i + 1))]))
if (np.mod((i + 1), self.subg_nadaptive) == 0):
Lu_max_adapt = np.amax(Lu_sequence[((i + 1) - self.subg_nadaptive):(i + 1)])
Lu_min_adapt = np.amin(Lu_sequence[((i + 1) - self.subg_nadaptive):(i + 1)])
if (Lu_max_adapt <= 0.0):
Lu_max_adapt = _smallnumber
f_change_adapt = ((Lu_max_adapt - Lu_min_adapt) / np.fabs(Lu_max_adapt))
if (f_change_adapt > self.max_adapt):
self.stepsize = (self.stepsize * 0.5)
elif (f_change_adapt < self.min_adapt):
self.stepsize = (self.stepsize * 1.5)
i_optimal = np.argmax(Lu_sequence[((i + 1) - self.subg_nadaptive):(i + 1)])
if (i_optimal != (self.subg_nadaptive - 1)):
u_temp = u_sequence[(:, i)]
u_sequence[(:, i)] = u_sequence[(:, (((i + 1) - self.subg_nadaptive) + i_optimal))]
u_sequence[(:, (((i + 1) - self.subg_nadaptive) + i_optimal))] = u_temp
Lu_sequence[(((i + 1) - self.subg_nadaptive) + i_optimal)] = Lu_sequence[i]
Lu_sequence[i] = Lu_max_adapt
Lu_max = np.amax(Lu_sequence)
i_optimal = np.argmax(Lu_sequence)
u_this = u_sequence[(:, i_optimal)]
niters = (niters + 1)
a_change = (Lu_max - Lu_max0)
f_change = (a_change / np.fabs(Lu_max))
Lu_max0 = Lu_max
if (niters == niters_max):
warnings.warn('Iteration reaches maximum = {0}'.format(niters))
self.u[(~ self.f_covered)] = u_this
u_sequence_full = np.zeros((self.mrows, self.subg_nsteps))
Lu_sequence_full = np.zeros(self.subg_nsteps)
u_sequence_full[(self.f_covered, :)] = self.u[self.f_covered][(:, np.newaxis)]
u_sequence_full[((~ self.f_covered), :)] = u_sequence
cost_u_full = (self.c - self.a_csc.dot(u_sequence_full[(:, 0)]))
Lu_sequence_full[0] = (np.einsum('i->', cost_u_full[(cost_u_full < 0)]) + np.einsum('i->', u_sequence_full[(:, 0)]))
Lu_sequence_full = (Lu_sequence + (Lu_sequence_full[0] - Lu_sequence[0]))
return (u_sequence_full, Lu_sequence_full)<|docstring|>subgradient step for the core problem N\S.<|endoftext|> |
00ef01557232104d5b10d2a108e93fda8b249a48308211015b7584ff5bcb792b | def fix_col(self, u=None):
'\n Note this needs to be done after greedy()\n '
if (u is None):
u = self.u
utmp = np.copy(u)
cost_u = (self.c - self.a_csc.dot(utmp))
x = np.copy(self.s)
UB = self.total_cost
LB = (np.einsum('i->', cost_u[(cost_u < 0)]) + np.einsum('i->', utmp))
cost_u[(cost_u < 0)] = 0.0
s_u = self.a_csr.dot(x.astype(int)).astype(float)
if (np.count_nonzero(s_u) < 1.0):
raise ValueError('The solution you give is not a solution!')
gap = ((utmp * (s_u - 1.0)) / s_u)
delta = (cost_u + self.a_csc.dot(gap))
isort = np.argsort(delta[x])
print('Gap = {0}, UB-LB = {1}.'.format(np.sum(delta[x]), (UB - LB)))
n_covered_row = self.a_csc.dot(np.ones(self.mrows))
ntotal_covered_row = np.cumsum(n_covered_row[x][isort])
iwhere = np.where((ntotal_covered_row >= (self.mrows * self.pi)))[0]
self.reset_f()
if (iwhere.size > 0):
itemp = iwhere[0]
self.f[x.nonzero()[0][isort[0:itemp]]] = True
self.f_covered = np.any(self.a[(:, self.f)], axis=1) | Note this needs to be done after greedy() | Setcover/setcover.py | fix_col | guangtunbenzhu/BGT-Cosmology | 1 | python | def fix_col(self, u=None):
'\n \n '
if (u is None):
u = self.u
utmp = np.copy(u)
cost_u = (self.c - self.a_csc.dot(utmp))
x = np.copy(self.s)
UB = self.total_cost
LB = (np.einsum('i->', cost_u[(cost_u < 0)]) + np.einsum('i->', utmp))
cost_u[(cost_u < 0)] = 0.0
s_u = self.a_csr.dot(x.astype(int)).astype(float)
if (np.count_nonzero(s_u) < 1.0):
raise ValueError('The solution you give is not a solution!')
gap = ((utmp * (s_u - 1.0)) / s_u)
delta = (cost_u + self.a_csc.dot(gap))
isort = np.argsort(delta[x])
print('Gap = {0}, UB-LB = {1}.'.format(np.sum(delta[x]), (UB - LB)))
n_covered_row = self.a_csc.dot(np.ones(self.mrows))
ntotal_covered_row = np.cumsum(n_covered_row[x][isort])
iwhere = np.where((ntotal_covered_row >= (self.mrows * self.pi)))[0]
self.reset_f()
if (iwhere.size > 0):
itemp = iwhere[0]
self.f[x.nonzero()[0][isort[0:itemp]]] = True
self.f_covered = np.any(self.a[(:, self.f)], axis=1) | def fix_col(self, u=None):
'\n \n '
if (u is None):
u = self.u
utmp = np.copy(u)
cost_u = (self.c - self.a_csc.dot(utmp))
x = np.copy(self.s)
UB = self.total_cost
LB = (np.einsum('i->', cost_u[(cost_u < 0)]) + np.einsum('i->', utmp))
cost_u[(cost_u < 0)] = 0.0
s_u = self.a_csr.dot(x.astype(int)).astype(float)
if (np.count_nonzero(s_u) < 1.0):
raise ValueError('The solution you give is not a solution!')
gap = ((utmp * (s_u - 1.0)) / s_u)
delta = (cost_u + self.a_csc.dot(gap))
isort = np.argsort(delta[x])
print('Gap = {0}, UB-LB = {1}.'.format(np.sum(delta[x]), (UB - LB)))
n_covered_row = self.a_csc.dot(np.ones(self.mrows))
ntotal_covered_row = np.cumsum(n_covered_row[x][isort])
iwhere = np.where((ntotal_covered_row >= (self.mrows * self.pi)))[0]
self.reset_f()
if (iwhere.size > 0):
itemp = iwhere[0]
self.f[x.nonzero()[0][isort[0:itemp]]] = True
self.f_covered = np.any(self.a[(:, self.f)], axis=1)<|docstring|>Note this needs to be done after greedy()<|endoftext|> |
355748bff181ee3434ba86493ac58bcf900bb12601afc3006b7a98af42fe442c | def ev_q_log_p_z_given_v_naive(phi, gamma_1, gamma_2):
'\n TODO\n :param phi:\n :param gamma_1:\n :param gamma_2:\n :return:\n '
[n, t] = np.shape(phi)
assert (t == (np.size(gamma_1) + 1)), 'q(V) must have T-1 variational parameters.'
assert (t == (np.size(gamma_2) + 1)), 'q(V) must have T-1 variational parameters.'
reverse_phi = phi[(:, ::(- 1))]
phi_cumsum = np.cumsum(reverse_phi, axis=(- 1))
reverse_phi_cumsum = phi_cumsum[(:, ::(- 1))]
ev_q_log_p_z_given_v = np.sum(((phi[(:, 0:(- 1))] * (digamma(gamma_1) - digamma((gamma_1 + gamma_2)))) + (reverse_phi_cumsum[(:, 1:)] * (digamma(gamma_2) - digamma((gamma_1 + gamma_2))))))
return ev_q_log_p_z_given_v | TODO
:param phi:
:param gamma_1:
:param gamma_2:
:return: | test/unittests/dp_unittests.py | ev_q_log_p_z_given_v_naive | AndrewRLawrence/dp_gp_lvm | 1 | python | def ev_q_log_p_z_given_v_naive(phi, gamma_1, gamma_2):
'\n TODO\n :param phi:\n :param gamma_1:\n :param gamma_2:\n :return:\n '
[n, t] = np.shape(phi)
assert (t == (np.size(gamma_1) + 1)), 'q(V) must have T-1 variational parameters.'
assert (t == (np.size(gamma_2) + 1)), 'q(V) must have T-1 variational parameters.'
reverse_phi = phi[(:, ::(- 1))]
phi_cumsum = np.cumsum(reverse_phi, axis=(- 1))
reverse_phi_cumsum = phi_cumsum[(:, ::(- 1))]
ev_q_log_p_z_given_v = np.sum(((phi[(:, 0:(- 1))] * (digamma(gamma_1) - digamma((gamma_1 + gamma_2)))) + (reverse_phi_cumsum[(:, 1:)] * (digamma(gamma_2) - digamma((gamma_1 + gamma_2))))))
return ev_q_log_p_z_given_v | def ev_q_log_p_z_given_v_naive(phi, gamma_1, gamma_2):
'\n TODO\n :param phi:\n :param gamma_1:\n :param gamma_2:\n :return:\n '
[n, t] = np.shape(phi)
assert (t == (np.size(gamma_1) + 1)), 'q(V) must have T-1 variational parameters.'
assert (t == (np.size(gamma_2) + 1)), 'q(V) must have T-1 variational parameters.'
reverse_phi = phi[(:, ::(- 1))]
phi_cumsum = np.cumsum(reverse_phi, axis=(- 1))
reverse_phi_cumsum = phi_cumsum[(:, ::(- 1))]
ev_q_log_p_z_given_v = np.sum(((phi[(:, 0:(- 1))] * (digamma(gamma_1) - digamma((gamma_1 + gamma_2)))) + (reverse_phi_cumsum[(:, 1:)] * (digamma(gamma_2) - digamma((gamma_1 + gamma_2))))))
return ev_q_log_p_z_given_v<|docstring|>TODO
:param phi:
:param gamma_1:
:param gamma_2:
:return:<|endoftext|> |
5ed62be19f4f31afb71de28f196c4df83b4bca074c7ca039eed3903e76a6fa02 | def ev_q_log_p_v_given_alpha_naive(gamma_1, gamma_2, w_1, w_2):
'\n TODO\n :param gamma_1:\n :param gamma_2:\n :param w_1:\n :param w_2:\n :return:\n '
t = (np.size(gamma_1) + 1)
assert (t == (np.size(gamma_2) + 1)), 'q(V) must have T-1 variational parameters.'
ev_q_log_p_v_given_alpha = (((t - 1.0) * (digamma(w_1) - np.log(w_2))) + (((w_1 / w_2) - 1.0) * np.sum((digamma(gamma_2) - digamma((gamma_1 + gamma_2))))))
return ev_q_log_p_v_given_alpha | TODO
:param gamma_1:
:param gamma_2:
:param w_1:
:param w_2:
:return: | test/unittests/dp_unittests.py | ev_q_log_p_v_given_alpha_naive | AndrewRLawrence/dp_gp_lvm | 1 | python | def ev_q_log_p_v_given_alpha_naive(gamma_1, gamma_2, w_1, w_2):
'\n TODO\n :param gamma_1:\n :param gamma_2:\n :param w_1:\n :param w_2:\n :return:\n '
t = (np.size(gamma_1) + 1)
assert (t == (np.size(gamma_2) + 1)), 'q(V) must have T-1 variational parameters.'
ev_q_log_p_v_given_alpha = (((t - 1.0) * (digamma(w_1) - np.log(w_2))) + (((w_1 / w_2) - 1.0) * np.sum((digamma(gamma_2) - digamma((gamma_1 + gamma_2))))))
return ev_q_log_p_v_given_alpha | def ev_q_log_p_v_given_alpha_naive(gamma_1, gamma_2, w_1, w_2):
'\n TODO\n :param gamma_1:\n :param gamma_2:\n :param w_1:\n :param w_2:\n :return:\n '
t = (np.size(gamma_1) + 1)
assert (t == (np.size(gamma_2) + 1)), 'q(V) must have T-1 variational parameters.'
ev_q_log_p_v_given_alpha = (((t - 1.0) * (digamma(w_1) - np.log(w_2))) + (((w_1 / w_2) - 1.0) * np.sum((digamma(gamma_2) - digamma((gamma_1 + gamma_2))))))
return ev_q_log_p_v_given_alpha<|docstring|>TODO
:param gamma_1:
:param gamma_2:
:param w_1:
:param w_2:
:return:<|endoftext|> |
e5052f5299958ce9f64da57f42eb014e504e7ecbfb86ee190fa4e582f0d350a4 | def ev_q_log_p_alpha_naive(w_1, w_2, s_1, s_2):
'\n TODO\n :param w_1:\n :param w_2:\n :param s_1:\n :param s_2:\n :return:\n '
ev_q_log_p_alpha = ((((s_1 * np.log(s_2)) - gammaln(s_1)) + ((s_1 - 1.0) * (digamma(w_1) - np.log(w_2)))) - (s_2 * (w_1 / w_2)))
return ev_q_log_p_alpha | TODO
:param w_1:
:param w_2:
:param s_1:
:param s_2:
:return: | test/unittests/dp_unittests.py | ev_q_log_p_alpha_naive | AndrewRLawrence/dp_gp_lvm | 1 | python | def ev_q_log_p_alpha_naive(w_1, w_2, s_1, s_2):
'\n TODO\n :param w_1:\n :param w_2:\n :param s_1:\n :param s_2:\n :return:\n '
ev_q_log_p_alpha = ((((s_1 * np.log(s_2)) - gammaln(s_1)) + ((s_1 - 1.0) * (digamma(w_1) - np.log(w_2)))) - (s_2 * (w_1 / w_2)))
return ev_q_log_p_alpha | def ev_q_log_p_alpha_naive(w_1, w_2, s_1, s_2):
'\n TODO\n :param w_1:\n :param w_2:\n :param s_1:\n :param s_2:\n :return:\n '
ev_q_log_p_alpha = ((((s_1 * np.log(s_2)) - gammaln(s_1)) + ((s_1 - 1.0) * (digamma(w_1) - np.log(w_2)))) - (s_2 * (w_1 / w_2)))
return ev_q_log_p_alpha<|docstring|>TODO
:param w_1:
:param w_2:
:param s_1:
:param s_2:
:return:<|endoftext|> |
a664f9da50ddea2c591e94226b3b5963ceec7b679a1114d898e7e1dce37aa473 | def entropy_q_z_naive(phi):
'\n TODO\n :param phi:\n :return:\n '
return np.sum(np.negative(np.sum((phi * np.log(phi)), axis=(- 1)))) | TODO
:param phi:
:return: | test/unittests/dp_unittests.py | entropy_q_z_naive | AndrewRLawrence/dp_gp_lvm | 1 | python | def entropy_q_z_naive(phi):
'\n TODO\n :param phi:\n :return:\n '
return np.sum(np.negative(np.sum((phi * np.log(phi)), axis=(- 1)))) | def entropy_q_z_naive(phi):
'\n TODO\n :param phi:\n :return:\n '
return np.sum(np.negative(np.sum((phi * np.log(phi)), axis=(- 1))))<|docstring|>TODO
:param phi:
:return:<|endoftext|> |
53bbc0f960b9a53e6d12c9fb9dde85218c050ae2a7a5e4801fc5304df3fe012e | def entropy_q_v_naive(gamma_1, gamma_2):
'\n TODO\n :param gamma_1:\n :param gamma_2:\n :return:\n '
total_concentration = (gamma_1 + gamma_2)
return np.sum((((((gammaln(gamma_1) + gammaln(gamma_2)) - gammaln(total_concentration)) - ((gamma_1 - 1.0) * digamma(gamma_1))) - ((gamma_2 - 1.0) * digamma(gamma_2))) + ((total_concentration - 2.0) * digamma(total_concentration)))) | TODO
:param gamma_1:
:param gamma_2:
:return: | test/unittests/dp_unittests.py | entropy_q_v_naive | AndrewRLawrence/dp_gp_lvm | 1 | python | def entropy_q_v_naive(gamma_1, gamma_2):
'\n TODO\n :param gamma_1:\n :param gamma_2:\n :return:\n '
total_concentration = (gamma_1 + gamma_2)
return np.sum((((((gammaln(gamma_1) + gammaln(gamma_2)) - gammaln(total_concentration)) - ((gamma_1 - 1.0) * digamma(gamma_1))) - ((gamma_2 - 1.0) * digamma(gamma_2))) + ((total_concentration - 2.0) * digamma(total_concentration)))) | def entropy_q_v_naive(gamma_1, gamma_2):
'\n TODO\n :param gamma_1:\n :param gamma_2:\n :return:\n '
total_concentration = (gamma_1 + gamma_2)
return np.sum((((((gammaln(gamma_1) + gammaln(gamma_2)) - gammaln(total_concentration)) - ((gamma_1 - 1.0) * digamma(gamma_1))) - ((gamma_2 - 1.0) * digamma(gamma_2))) + ((total_concentration - 2.0) * digamma(total_concentration))))<|docstring|>TODO
:param gamma_1:
:param gamma_2:
:return:<|endoftext|> |
ec24aa998085f2f0c37c73db5fb0cf6543cff4422ca8ae3c06f218e1a0863e85 | def entropy_q_alpha_naive(w_1, w_2):
'\n TODO\n :param w_1:\n :param w_2:\n :return:\n '
return (((w_1 - np.log(w_2)) + gammaln(w_1)) + ((1.0 - w_1) * digamma(w_1))) | TODO
:param w_1:
:param w_2:
:return: | test/unittests/dp_unittests.py | entropy_q_alpha_naive | AndrewRLawrence/dp_gp_lvm | 1 | python | def entropy_q_alpha_naive(w_1, w_2):
'\n TODO\n :param w_1:\n :param w_2:\n :return:\n '
return (((w_1 - np.log(w_2)) + gammaln(w_1)) + ((1.0 - w_1) * digamma(w_1))) | def entropy_q_alpha_naive(w_1, w_2):
'\n TODO\n :param w_1:\n :param w_2:\n :return:\n '
return (((w_1 - np.log(w_2)) + gammaln(w_1)) + ((1.0 - w_1) * digamma(w_1)))<|docstring|>TODO
:param w_1:
:param w_2:
:return:<|endoftext|> |
9f7e2b9a627ed3b351c44f97d912cddf75461675e07306b2059e8bada687cb18 | def elbo_naive(phi, gamma_1, gamma_2, w_1, w_2, s_1, s_2):
'\n TODO\n :param phi:\n :param gamma_1:\n :param gamma_2:\n :param w_1:\n :param w_2:\n :param s_1:\n :param s_2:\n :return:\n '
elbo = (((((ev_q_log_p_z_given_v_naive(phi=phi, gamma_1=gamma_1, gamma_2=gamma_2) + ev_q_log_p_v_given_alpha_naive(gamma_1=gamma_1, gamma_2=gamma_2, w_1=w_1, w_2=w_2)) + ev_q_log_p_alpha_naive(w_1=w_1, w_2=w_2, s_1=s_1, s_2=s_2)) + entropy_q_z_naive(phi=phi)) + entropy_q_v_naive(gamma_1=gamma_1, gamma_2=gamma_2)) + entropy_q_alpha_naive(w_1=w_1, w_2=w_2))
return elbo | TODO
:param phi:
:param gamma_1:
:param gamma_2:
:param w_1:
:param w_2:
:param s_1:
:param s_2:
:return: | test/unittests/dp_unittests.py | elbo_naive | AndrewRLawrence/dp_gp_lvm | 1 | python | def elbo_naive(phi, gamma_1, gamma_2, w_1, w_2, s_1, s_2):
'\n TODO\n :param phi:\n :param gamma_1:\n :param gamma_2:\n :param w_1:\n :param w_2:\n :param s_1:\n :param s_2:\n :return:\n '
elbo = (((((ev_q_log_p_z_given_v_naive(phi=phi, gamma_1=gamma_1, gamma_2=gamma_2) + ev_q_log_p_v_given_alpha_naive(gamma_1=gamma_1, gamma_2=gamma_2, w_1=w_1, w_2=w_2)) + ev_q_log_p_alpha_naive(w_1=w_1, w_2=w_2, s_1=s_1, s_2=s_2)) + entropy_q_z_naive(phi=phi)) + entropy_q_v_naive(gamma_1=gamma_1, gamma_2=gamma_2)) + entropy_q_alpha_naive(w_1=w_1, w_2=w_2))
return elbo | def elbo_naive(phi, gamma_1, gamma_2, w_1, w_2, s_1, s_2):
'\n TODO\n :param phi:\n :param gamma_1:\n :param gamma_2:\n :param w_1:\n :param w_2:\n :param s_1:\n :param s_2:\n :return:\n '
elbo = (((((ev_q_log_p_z_given_v_naive(phi=phi, gamma_1=gamma_1, gamma_2=gamma_2) + ev_q_log_p_v_given_alpha_naive(gamma_1=gamma_1, gamma_2=gamma_2, w_1=w_1, w_2=w_2)) + ev_q_log_p_alpha_naive(w_1=w_1, w_2=w_2, s_1=s_1, s_2=s_2)) + entropy_q_z_naive(phi=phi)) + entropy_q_v_naive(gamma_1=gamma_1, gamma_2=gamma_2)) + entropy_q_alpha_naive(w_1=w_1, w_2=w_2))
return elbo<|docstring|>TODO
:param phi:
:param gamma_1:
:param gamma_2:
:param w_1:
:param w_2:
:param s_1:
:param s_2:
:return:<|endoftext|> |
ab6d8e8998ce222bf0e22b413c6b24286f9dcacca183b69255b6535e201002b3 | def setUp(self, seed=1):
'\n TODO\n :param seed:\n :return:\n '
np.random.seed(seed=seed)
self.n = 10
self.t = 20
self.s_1 = np.square(np.random.normal(loc=1.0, scale=0.05))
self.s_2 = np.square(np.random.normal(loc=1.0, scale=0.05))
alpha_prior_params = np.array([self.s_1, self.s_2])
self.dp = dirichlet_process(num_samples=self.n, truncation_level=self.t, alpha_prior_params=alpha_prior_params)
self.tf_session = tf.Session()
self.tf_session.run(tf.global_variables_initializer())
self.phi = self.tf_session.run(self.dp.q_z)
(self.gamma_1, self.gamma_2) = self.tf_session.run(self.dp.q_v)
(self.w_1, self.w_2) = self.tf_session.run(self.dp.q_alpha) | TODO
:param seed:
:return: | test/unittests/dp_unittests.py | setUp | AndrewRLawrence/dp_gp_lvm | 1 | python | def setUp(self, seed=1):
'\n TODO\n :param seed:\n :return:\n '
np.random.seed(seed=seed)
self.n = 10
self.t = 20
self.s_1 = np.square(np.random.normal(loc=1.0, scale=0.05))
self.s_2 = np.square(np.random.normal(loc=1.0, scale=0.05))
alpha_prior_params = np.array([self.s_1, self.s_2])
self.dp = dirichlet_process(num_samples=self.n, truncation_level=self.t, alpha_prior_params=alpha_prior_params)
self.tf_session = tf.Session()
self.tf_session.run(tf.global_variables_initializer())
self.phi = self.tf_session.run(self.dp.q_z)
(self.gamma_1, self.gamma_2) = self.tf_session.run(self.dp.q_v)
(self.w_1, self.w_2) = self.tf_session.run(self.dp.q_alpha) | def setUp(self, seed=1):
'\n TODO\n :param seed:\n :return:\n '
np.random.seed(seed=seed)
self.n = 10
self.t = 20
self.s_1 = np.square(np.random.normal(loc=1.0, scale=0.05))
self.s_2 = np.square(np.random.normal(loc=1.0, scale=0.05))
alpha_prior_params = np.array([self.s_1, self.s_2])
self.dp = dirichlet_process(num_samples=self.n, truncation_level=self.t, alpha_prior_params=alpha_prior_params)
self.tf_session = tf.Session()
self.tf_session.run(tf.global_variables_initializer())
self.phi = self.tf_session.run(self.dp.q_z)
(self.gamma_1, self.gamma_2) = self.tf_session.run(self.dp.q_v)
(self.w_1, self.w_2) = self.tf_session.run(self.dp.q_alpha)<|docstring|>TODO
:param seed:
:return:<|endoftext|> |
f115f5289263e19ae92d9f441db50dee8b123df23db44ed8b22233bfc0118c3d | def tearDown(self):
'\n Close the TensorFlow session.\n '
self.tf_session.close() | Close the TensorFlow session. | test/unittests/dp_unittests.py | tearDown | AndrewRLawrence/dp_gp_lvm | 1 | python | def tearDown(self):
'\n \n '
self.tf_session.close() | def tearDown(self):
'\n \n '
self.tf_session.close()<|docstring|>Close the TensorFlow session.<|endoftext|> |
11e86677bd7ba5d2eba812fad446bacb7bca4d9e3a03c10aec71d80a5598179b | def __str__(self):
'Return a user friendly representation of the user.' | Return a user friendly representation of the user. | Latest/venv/Lib/site-packages/apptools/permissions/i_user.py | __str__ | adamcvj/SatelliteTracker | 1 | python | def __str__(self):
| def __str__(self):
<|docstring|>Return a user friendly representation of the user.<|endoftext|> |
2b72e8621f1fe8779785cf76640bed15d66bfb3997a9b1a53a793eeb54d96525 | def processCacheCommand(wfInstance: WF, args: argparse.Namespace, logLevel) -> int:
'\n This method processes the cache subcommands, and returns the retval\n to be used with sys.exit\n '
(cH, cPath) = wfInstance.getCacheHandler(args.cache_type)
retval = 0
if (args.cache_command == WfExS_Cache_Commands.List):
if (logLevel <= logging.INFO):
contents = sorted(map((lambda l: l[1]), cH.list(cPath, *args.cache_command_args, acceptGlob=args.filesAsGlobs)), key=(lambda x: x['stamp']))
for entry in contents:
json.dump(entry, sys.stdout, indent=4, sort_keys=True)
print()
else:
contents = sorted(map((lambda l: l[0]), cH.list(cPath, *args.cache_command_args, acceptGlob=args.filesAsGlobs)))
for entry in contents:
print(entry)
elif (args.cache_command == WfExS_Cache_Commands.Remove):
print('\n'.join(map((lambda x: '\t'.join(x)), cH.remove(cPath, *args.cache_command_args, acceptGlob=args.filesAsGlobs, doRemoveFiles=args.doCacheRecursively))))
elif (args.cache_command == WfExS_Cache_Commands.Inject):
injected_uri = args.cache_command_args[0]
finalCachedFilename = args.cache_command_args[1]
cH.inject(cPath, injected_uri, finalCachedFilename=finalCachedFilename)
return retval | This method processes the cache subcommands, and returns the retval
to be used with sys.exit | WfExS-backend.py | processCacheCommand | Acivico/WfExS-backend | 1 | python | def processCacheCommand(wfInstance: WF, args: argparse.Namespace, logLevel) -> int:
'\n This method processes the cache subcommands, and returns the retval\n to be used with sys.exit\n '
(cH, cPath) = wfInstance.getCacheHandler(args.cache_type)
retval = 0
if (args.cache_command == WfExS_Cache_Commands.List):
if (logLevel <= logging.INFO):
contents = sorted(map((lambda l: l[1]), cH.list(cPath, *args.cache_command_args, acceptGlob=args.filesAsGlobs)), key=(lambda x: x['stamp']))
for entry in contents:
json.dump(entry, sys.stdout, indent=4, sort_keys=True)
print()
else:
contents = sorted(map((lambda l: l[0]), cH.list(cPath, *args.cache_command_args, acceptGlob=args.filesAsGlobs)))
for entry in contents:
print(entry)
elif (args.cache_command == WfExS_Cache_Commands.Remove):
print('\n'.join(map((lambda x: '\t'.join(x)), cH.remove(cPath, *args.cache_command_args, acceptGlob=args.filesAsGlobs, doRemoveFiles=args.doCacheRecursively))))
elif (args.cache_command == WfExS_Cache_Commands.Inject):
injected_uri = args.cache_command_args[0]
finalCachedFilename = args.cache_command_args[1]
cH.inject(cPath, injected_uri, finalCachedFilename=finalCachedFilename)
return retval | def processCacheCommand(wfInstance: WF, args: argparse.Namespace, logLevel) -> int:
'\n This method processes the cache subcommands, and returns the retval\n to be used with sys.exit\n '
(cH, cPath) = wfInstance.getCacheHandler(args.cache_type)
retval = 0
if (args.cache_command == WfExS_Cache_Commands.List):
if (logLevel <= logging.INFO):
contents = sorted(map((lambda l: l[1]), cH.list(cPath, *args.cache_command_args, acceptGlob=args.filesAsGlobs)), key=(lambda x: x['stamp']))
for entry in contents:
json.dump(entry, sys.stdout, indent=4, sort_keys=True)
print()
else:
contents = sorted(map((lambda l: l[0]), cH.list(cPath, *args.cache_command_args, acceptGlob=args.filesAsGlobs)))
for entry in contents:
print(entry)
elif (args.cache_command == WfExS_Cache_Commands.Remove):
print('\n'.join(map((lambda x: '\t'.join(x)), cH.remove(cPath, *args.cache_command_args, acceptGlob=args.filesAsGlobs, doRemoveFiles=args.doCacheRecursively))))
elif (args.cache_command == WfExS_Cache_Commands.Inject):
injected_uri = args.cache_command_args[0]
finalCachedFilename = args.cache_command_args[1]
cH.inject(cPath, injected_uri, finalCachedFilename=finalCachedFilename)
return retval<|docstring|>This method processes the cache subcommands, and returns the retval
to be used with sys.exit<|endoftext|> |
fde7aba504267367193b664e0428a77566528bc4ada625a2c77337d9ece0288b | def _send_request(self, http_request, **kwargs):
"Runs the network request through the client's chained policies.\n\n :param http_request: The network request you want to make. Required.\n :type http_request: ~azure.core.pipeline.transport.HttpRequest\n :keyword bool stream: Whether the response payload will be streamed. Defaults to True.\n :return: The response of your network call. Does not do error handling on your response.\n :rtype: ~azure.core.pipeline.transport.HttpResponse\n "
path_format_arguments = {'subscriptionId': self._serialize.url('self._config.subscription_id', self._config.subscription_id, 'str')}
http_request.url = self._client.format_url(http_request.url, **path_format_arguments)
stream = kwargs.pop('stream', True)
pipeline_response = self._client._pipeline.run(http_request, stream=stream, **kwargs)
return pipeline_response.http_response | Runs the network request through the client's chained policies.
:param http_request: The network request you want to make. Required.
:type http_request: ~azure.core.pipeline.transport.HttpRequest
:keyword bool stream: Whether the response payload will be streamed. Defaults to True.
:return: The response of your network call. Does not do error handling on your response.
:rtype: ~azure.core.pipeline.transport.HttpResponse | sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/v2019_06_01_preview/_template_specs_client.py | _send_request | jayachithra/azure-sdk-for-python | 2,728 | python | def _send_request(self, http_request, **kwargs):
"Runs the network request through the client's chained policies.\n\n :param http_request: The network request you want to make. Required.\n :type http_request: ~azure.core.pipeline.transport.HttpRequest\n :keyword bool stream: Whether the response payload will be streamed. Defaults to True.\n :return: The response of your network call. Does not do error handling on your response.\n :rtype: ~azure.core.pipeline.transport.HttpResponse\n "
path_format_arguments = {'subscriptionId': self._serialize.url('self._config.subscription_id', self._config.subscription_id, 'str')}
http_request.url = self._client.format_url(http_request.url, **path_format_arguments)
stream = kwargs.pop('stream', True)
pipeline_response = self._client._pipeline.run(http_request, stream=stream, **kwargs)
return pipeline_response.http_response | def _send_request(self, http_request, **kwargs):
"Runs the network request through the client's chained policies.\n\n :param http_request: The network request you want to make. Required.\n :type http_request: ~azure.core.pipeline.transport.HttpRequest\n :keyword bool stream: Whether the response payload will be streamed. Defaults to True.\n :return: The response of your network call. Does not do error handling on your response.\n :rtype: ~azure.core.pipeline.transport.HttpResponse\n "
path_format_arguments = {'subscriptionId': self._serialize.url('self._config.subscription_id', self._config.subscription_id, 'str')}
http_request.url = self._client.format_url(http_request.url, **path_format_arguments)
stream = kwargs.pop('stream', True)
pipeline_response = self._client._pipeline.run(http_request, stream=stream, **kwargs)
return pipeline_response.http_response<|docstring|>Runs the network request through the client's chained policies.
:param http_request: The network request you want to make. Required.
:type http_request: ~azure.core.pipeline.transport.HttpRequest
:keyword bool stream: Whether the response payload will be streamed. Defaults to True.
:return: The response of your network call. Does not do error handling on your response.
:rtype: ~azure.core.pipeline.transport.HttpResponse<|endoftext|> |
ab8d0c3d78a88b052359f1504ad1b2a532fd27932569f0d221627cc9fe0283dc | def test_model_eq():
'Model equality comparison.'
test_model = Model(ALCRNI_DBF, ['AL', 'CR'], 'L12_FCC')
assert (test_model == test_model)
assert (test_model == Model(ALCRNI_DBF, ['AL', 'CR'], 'L12_FCC'))
assert (not (test_model == Model(ALCRNI_DBF, ['NI', 'CR'], 'L12_FCC')))
assert (not (test_model == 42))
assert (not (test_model == None))
assert (not (42 == test_model))
assert (not (None == test_model)) | Model equality comparison. | pycalphad/tests/test_model.py | test_model_eq | wahab2604/pycalphad | 162 | python | def test_model_eq():
test_model = Model(ALCRNI_DBF, ['AL', 'CR'], 'L12_FCC')
assert (test_model == test_model)
assert (test_model == Model(ALCRNI_DBF, ['AL', 'CR'], 'L12_FCC'))
assert (not (test_model == Model(ALCRNI_DBF, ['NI', 'CR'], 'L12_FCC')))
assert (not (test_model == 42))
assert (not (test_model == None))
assert (not (42 == test_model))
assert (not (None == test_model)) | def test_model_eq():
test_model = Model(ALCRNI_DBF, ['AL', 'CR'], 'L12_FCC')
assert (test_model == test_model)
assert (test_model == Model(ALCRNI_DBF, ['AL', 'CR'], 'L12_FCC'))
assert (not (test_model == Model(ALCRNI_DBF, ['NI', 'CR'], 'L12_FCC')))
assert (not (test_model == 42))
assert (not (test_model == None))
assert (not (42 == test_model))
assert (not (None == test_model))<|docstring|>Model equality comparison.<|endoftext|> |
8adc9fa3e6a6949d559a77d2e4546ccce1cb01a08d2696744e230c3096926848 | def test_model_ne():
'Model inequality comparison.'
test_model = Model(ALCRNI_DBF, ['AL', 'CR'], 'L12_FCC')
assert (not (test_model != test_model))
assert (not (test_model != Model(ALCRNI_DBF, ['AL', 'CR'], 'L12_FCC')))
assert (test_model != Model(ALCRNI_DBF, ['NI', 'CR'], 'L12_FCC'))
assert (test_model != 42)
assert (test_model != None)
assert (42 != test_model)
assert (None != test_model) | Model inequality comparison. | pycalphad/tests/test_model.py | test_model_ne | wahab2604/pycalphad | 162 | python | def test_model_ne():
test_model = Model(ALCRNI_DBF, ['AL', 'CR'], 'L12_FCC')
assert (not (test_model != test_model))
assert (not (test_model != Model(ALCRNI_DBF, ['AL', 'CR'], 'L12_FCC')))
assert (test_model != Model(ALCRNI_DBF, ['NI', 'CR'], 'L12_FCC'))
assert (test_model != 42)
assert (test_model != None)
assert (42 != test_model)
assert (None != test_model) | def test_model_ne():
test_model = Model(ALCRNI_DBF, ['AL', 'CR'], 'L12_FCC')
assert (not (test_model != test_model))
assert (not (test_model != Model(ALCRNI_DBF, ['AL', 'CR'], 'L12_FCC')))
assert (test_model != Model(ALCRNI_DBF, ['NI', 'CR'], 'L12_FCC'))
assert (test_model != 42)
assert (test_model != None)
assert (42 != test_model)
assert (None != test_model)<|docstring|>Model inequality comparison.<|endoftext|> |
40f1aaee7306155c240cdce4082c2140a24250b3bbf9959e2858462dfecfcbb4 | def test_export_import():
'Equivalence of Model using re-imported database.'
test_model = Model(Database.from_string(ALNIPT_DBF.to_string(fmt='tdb', if_incompatible='ignore'), fmt='tdb'), ['PT', 'NI', 'VA'], 'FCC_L12')
ref_model = Model(ALNIPT_DBF, ['NI', 'PT', 'VA'], 'FCC_L12')
assert (test_model == ref_model) | Equivalence of Model using re-imported database. | pycalphad/tests/test_model.py | test_export_import | wahab2604/pycalphad | 162 | python | def test_export_import():
test_model = Model(Database.from_string(ALNIPT_DBF.to_string(fmt='tdb', if_incompatible='ignore'), fmt='tdb'), ['PT', 'NI', 'VA'], 'FCC_L12')
ref_model = Model(ALNIPT_DBF, ['NI', 'PT', 'VA'], 'FCC_L12')
assert (test_model == ref_model) | def test_export_import():
test_model = Model(Database.from_string(ALNIPT_DBF.to_string(fmt='tdb', if_incompatible='ignore'), fmt='tdb'), ['PT', 'NI', 'VA'], 'FCC_L12')
ref_model = Model(ALNIPT_DBF, ['NI', 'PT', 'VA'], 'FCC_L12')
assert (test_model == ref_model)<|docstring|>Equivalence of Model using re-imported database.<|endoftext|> |
1fc7f45b0b9f8aaef14d706649bb9cb079b1db2e07825906080046b8969e3b7e | def test_custom_model_contributions():
'Building a custom model using contributions.'
class CustomModel(Model):
contributions = [('zzz', 'test'), ('xxx', 'test2'), ('yyy', 'test3')]
def test(self, dbe):
return 0
def test2(self, dbe):
return 0
def test3(self, dbe):
return 0
CustomModel(ALCRNI_DBF, ['AL', 'CR'], 'L12_FCC') | Building a custom model using contributions. | pycalphad/tests/test_model.py | test_custom_model_contributions | wahab2604/pycalphad | 162 | python | def test_custom_model_contributions():
class CustomModel(Model):
contributions = [('zzz', 'test'), ('xxx', 'test2'), ('yyy', 'test3')]
def test(self, dbe):
return 0
def test2(self, dbe):
return 0
def test3(self, dbe):
return 0
CustomModel(ALCRNI_DBF, ['AL', 'CR'], 'L12_FCC') | def test_custom_model_contributions():
class CustomModel(Model):
contributions = [('zzz', 'test'), ('xxx', 'test2'), ('yyy', 'test3')]
def test(self, dbe):
return 0
def test2(self, dbe):
return 0
def test3(self, dbe):
return 0
CustomModel(ALCRNI_DBF, ['AL', 'CR'], 'L12_FCC')<|docstring|>Building a custom model using contributions.<|endoftext|> |
bc21bab409d1517005a1e3c2f994cf6725014934295785b229c39c68d1ce5d96 | def test_degree_of_ordering():
'Degree of ordering should be calculated properly.'
my_phases = ['B2_BCC']
comps = ['AL', 'FE', 'VA']
conds = {v.T: 300, v.P: 101325, v.X('AL'): 0.25}
eqx = equilibrium(ALFE_DBF, comps, my_phases, conds, output='degree_of_ordering', verbose=True)
print('Degree of ordering: {}'.format(eqx.degree_of_ordering.sel(vertex=0).values.flatten()))
assert np.isclose(eqx.degree_of_ordering.sel(vertex=0).values.flatten(), np.array([0.6666]), atol=0.0001) | Degree of ordering should be calculated properly. | pycalphad/tests/test_model.py | test_degree_of_ordering | wahab2604/pycalphad | 162 | python | def test_degree_of_ordering():
my_phases = ['B2_BCC']
comps = ['AL', 'FE', 'VA']
conds = {v.T: 300, v.P: 101325, v.X('AL'): 0.25}
eqx = equilibrium(ALFE_DBF, comps, my_phases, conds, output='degree_of_ordering', verbose=True)
print('Degree of ordering: {}'.format(eqx.degree_of_ordering.sel(vertex=0).values.flatten()))
assert np.isclose(eqx.degree_of_ordering.sel(vertex=0).values.flatten(), np.array([0.6666]), atol=0.0001) | def test_degree_of_ordering():
my_phases = ['B2_BCC']
comps = ['AL', 'FE', 'VA']
conds = {v.T: 300, v.P: 101325, v.X('AL'): 0.25}
eqx = equilibrium(ALFE_DBF, comps, my_phases, conds, output='degree_of_ordering', verbose=True)
print('Degree of ordering: {}'.format(eqx.degree_of_ordering.sel(vertex=0).values.flatten()))
assert np.isclose(eqx.degree_of_ordering.sel(vertex=0).values.flatten(), np.array([0.6666]), atol=0.0001)<|docstring|>Degree of ordering should be calculated properly.<|endoftext|> |
0d76063770b93230b9eed7a5cc57bfbec2ad209c1b1a7e2d6c065fece5ae0f84 | def test_detect_pure_vacancy_phases():
'Detecting a pure vacancy phase'
dbf = Database(ZRO2_CUBIC_BCC_TDB)
with pytest.raises(DofError):
Model(dbf, ['AL', 'CU', 'VA'], 'ZRO2_CUBIC') | Detecting a pure vacancy phase | pycalphad/tests/test_model.py | test_detect_pure_vacancy_phases | wahab2604/pycalphad | 162 | python | def test_detect_pure_vacancy_phases():
dbf = Database(ZRO2_CUBIC_BCC_TDB)
with pytest.raises(DofError):
Model(dbf, ['AL', 'CU', 'VA'], 'ZRO2_CUBIC') | def test_detect_pure_vacancy_phases():
dbf = Database(ZRO2_CUBIC_BCC_TDB)
with pytest.raises(DofError):
Model(dbf, ['AL', 'CU', 'VA'], 'ZRO2_CUBIC')<|docstring|>Detecting a pure vacancy phase<|endoftext|> |
266636c8ab53b3c3898180f6b11612c781b4c99607c7b0ffef16d24b7f99e701 | def test_constituents_not_in_model():
'Test that parameters with constituent arrays not matching the phase model are filtered out correctly'
dbf = Database(TDB_PARAMETER_FILTERS_TEST)
modA = Model(dbf, ['A', 'B'], 'ALPHA')
modB = Model(dbf, ['B', 'C'], 'BETA')
assert (v.SiteFraction('ALPHA', 0, 'B') not in modA.ast.free_symbols)
assert (v.SiteFraction('BETA', 1, 'D') not in modB.ast.free_symbols)
assert (v.SiteFraction('BETA', 2, 'C') not in modB.ast.free_symbols) | Test that parameters with constituent arrays not matching the phase model are filtered out correctly | pycalphad/tests/test_model.py | test_constituents_not_in_model | wahab2604/pycalphad | 162 | python | def test_constituents_not_in_model():
dbf = Database(TDB_PARAMETER_FILTERS_TEST)
modA = Model(dbf, ['A', 'B'], 'ALPHA')
modB = Model(dbf, ['B', 'C'], 'BETA')
assert (v.SiteFraction('ALPHA', 0, 'B') not in modA.ast.free_symbols)
assert (v.SiteFraction('BETA', 1, 'D') not in modB.ast.free_symbols)
assert (v.SiteFraction('BETA', 2, 'C') not in modB.ast.free_symbols) | def test_constituents_not_in_model():
dbf = Database(TDB_PARAMETER_FILTERS_TEST)
modA = Model(dbf, ['A', 'B'], 'ALPHA')
modB = Model(dbf, ['B', 'C'], 'BETA')
assert (v.SiteFraction('ALPHA', 0, 'B') not in modA.ast.free_symbols)
assert (v.SiteFraction('BETA', 1, 'D') not in modB.ast.free_symbols)
assert (v.SiteFraction('BETA', 2, 'C') not in modB.ast.free_symbols)<|docstring|>Test that parameters with constituent arrays not matching the phase model are filtered out correctly<|endoftext|> |
c51a184e1264ea130410665404cddb38de501625f23d754d1708a8a7e090f566 | def interact_with_learning_agent(agent, end_time='143000'):
'\n Note:\n When integrate with master_script, replease:\n 1. envLAS._self_observe() -> get_obseravtion()\n 2. envLAS.step(action) -> take_action(action)\n Parameters\n ----------\n agent: learning agent object\n \n end_time: str (in format %HH%MM%SS)\n the end time of interaction\n '
logging.info('{}: Start interaction. Default End_time: {}'.format(agent.name, end_time))
while (not (datetime.now().strftime('%H%M%S') > end_time)):
observation = envLAS._self_observe()
(take_action_flag, action) = agent.feed_observation(observation)
if (take_action_flag == True):
(observation, _, _, _) = envLAS.step(action)
logging.info('{}: Interaction is done. Saving learned models...'.format(agent.name))
agent.stop()
logging.info('{}: Saving learned models done.'.format(agent.name)) | Note:
When integrate with master_script, replease:
1. envLAS._self_observe() -> get_obseravtion()
2. envLAS.step(action) -> take_action(action)
Parameters
----------
agent: learning agent object
end_time: str (in format %HH%MM%SS)
the end time of interaction | Integration_Demo_for_ROM_Exhibit_new.py | interact_with_learning_agent | UWaterloo-ASL/LAS_Gym | 1 | python | def interact_with_learning_agent(agent, end_time='143000'):
'\n Note:\n When integrate with master_script, replease:\n 1. envLAS._self_observe() -> get_obseravtion()\n 2. envLAS.step(action) -> take_action(action)\n Parameters\n ----------\n agent: learning agent object\n \n end_time: str (in format %HH%MM%SS)\n the end time of interaction\n '
logging.info('{}: Start interaction. Default End_time: {}'.format(agent.name, end_time))
while (not (datetime.now().strftime('%H%M%S') > end_time)):
observation = envLAS._self_observe()
(take_action_flag, action) = agent.feed_observation(observation)
if (take_action_flag == True):
(observation, _, _, _) = envLAS.step(action)
logging.info('{}: Interaction is done. Saving learned models...'.format(agent.name))
agent.stop()
logging.info('{}: Saving learned models done.'.format(agent.name)) | def interact_with_learning_agent(agent, end_time='143000'):
'\n Note:\n When integrate with master_script, replease:\n 1. envLAS._self_observe() -> get_obseravtion()\n 2. envLAS.step(action) -> take_action(action)\n Parameters\n ----------\n agent: learning agent object\n \n end_time: str (in format %HH%MM%SS)\n the end time of interaction\n '
logging.info('{}: Start interaction. Default End_time: {}'.format(agent.name, end_time))
while (not (datetime.now().strftime('%H%M%S') > end_time)):
observation = envLAS._self_observe()
(take_action_flag, action) = agent.feed_observation(observation)
if (take_action_flag == True):
(observation, _, _, _) = envLAS.step(action)
logging.info('{}: Interaction is done. Saving learned models...'.format(agent.name))
agent.stop()
logging.info('{}: Saving learned models done.'.format(agent.name))<|docstring|>Note:
When integrate with master_script, replease:
1. envLAS._self_observe() -> get_obseravtion()
2. envLAS.step(action) -> take_action(action)
Parameters
----------
agent: learning agent object
end_time: str (in format %HH%MM%SS)
the end time of interaction<|endoftext|> |
970e13a9e084e533e463782587b88af45ff567ceb9d25b9d5eab14afad416720 | def interact_with_prescribed_behavior(agent='prescribed_behavior', end_time='130000'):
'\n TODO: Please put prescribed behavior in this function.\n \n Parameters\n ----------\n agent: str\n not important paramter just for keeping the same format with interact_with_learning_agent\n \n end_time: str (in format %HH%MM%SS)\n the end time of interaction\n '
logging.info('{}: Start interaction. Default End_time: {}'.format(agent, end_time))
while (not (datetime.now().strftime('%H%M%S') > end_time)):
observation = envLAS._self_observe()
action = envLAS.action_space.sample()
(observation, _, _, _) = envLAS.step(action)
logging.info('{}: Interaction is done.'.format(agent)) | TODO: Please put prescribed behavior in this function.
Parameters
----------
agent: str
not important paramter just for keeping the same format with interact_with_learning_agent
end_time: str (in format %HH%MM%SS)
the end time of interaction | Integration_Demo_for_ROM_Exhibit_new.py | interact_with_prescribed_behavior | UWaterloo-ASL/LAS_Gym | 1 | python | def interact_with_prescribed_behavior(agent='prescribed_behavior', end_time='130000'):
'\n TODO: Please put prescribed behavior in this function.\n \n Parameters\n ----------\n agent: str\n not important paramter just for keeping the same format with interact_with_learning_agent\n \n end_time: str (in format %HH%MM%SS)\n the end time of interaction\n '
logging.info('{}: Start interaction. Default End_time: {}'.format(agent, end_time))
while (not (datetime.now().strftime('%H%M%S') > end_time)):
observation = envLAS._self_observe()
action = envLAS.action_space.sample()
(observation, _, _, _) = envLAS.step(action)
logging.info('{}: Interaction is done.'.format(agent)) | def interact_with_prescribed_behavior(agent='prescribed_behavior', end_time='130000'):
'\n TODO: Please put prescribed behavior in this function.\n \n Parameters\n ----------\n agent: str\n not important paramter just for keeping the same format with interact_with_learning_agent\n \n end_time: str (in format %HH%MM%SS)\n the end time of interaction\n '
logging.info('{}: Start interaction. Default End_time: {}'.format(agent, end_time))
while (not (datetime.now().strftime('%H%M%S') > end_time)):
observation = envLAS._self_observe()
action = envLAS.action_space.sample()
(observation, _, _, _) = envLAS.step(action)
logging.info('{}: Interaction is done.'.format(agent))<|docstring|>TODO: Please put prescribed behavior in this function.
Parameters
----------
agent: str
not important paramter just for keeping the same format with interact_with_learning_agent
end_time: str (in format %HH%MM%SS)
the end time of interaction<|endoftext|> |
d99e85291c69e7b135797f4b0fcb93f5380e58639e6cb4ce582846918ef956e8 | def interaction_mode_scheduler(interaction_mode, agent, start_time, end_time, schedule_start_time):
"\n Parameters\n ----------\n interaction_mode: func\n function\n \n agent: depends on interaction mode\n 1. agent object: for learning agent\n 2. 'priscribed_behavior': for priscribed behavior\n \n start_time: str (with format'hhmmss')\n \n end_time: str (with format'hhmmss')\n \n schedule_start_time: datetime object\n \n Returns\n -------\n interaction_thread\n a delayed thread for an interaction mode which will start at a given time.\n "
start_delay = (datetime.strptime(((date.today().strftime('%Y%m%d') + '-') + start_time), '%Y%m%d-%H%M%S') - schedule_start_time).total_seconds()
if (start_delay < 0):
logging.error('{} starts earlier than schedualing time!'.format(interaction_mode.__name__))
interaction_thread = Timer(interval=start_delay, function=interaction_mode, kwargs={'agent': agent, 'end_time': end_time})
return interaction_thread | Parameters
----------
interaction_mode: func
function
agent: depends on interaction mode
1. agent object: for learning agent
2. 'priscribed_behavior': for priscribed behavior
start_time: str (with format'hhmmss')
end_time: str (with format'hhmmss')
schedule_start_time: datetime object
Returns
-------
interaction_thread
a delayed thread for an interaction mode which will start at a given time. | Integration_Demo_for_ROM_Exhibit_new.py | interaction_mode_scheduler | UWaterloo-ASL/LAS_Gym | 1 | python | def interaction_mode_scheduler(interaction_mode, agent, start_time, end_time, schedule_start_time):
"\n Parameters\n ----------\n interaction_mode: func\n function\n \n agent: depends on interaction mode\n 1. agent object: for learning agent\n 2. 'priscribed_behavior': for priscribed behavior\n \n start_time: str (with format'hhmmss')\n \n end_time: str (with format'hhmmss')\n \n schedule_start_time: datetime object\n \n Returns\n -------\n interaction_thread\n a delayed thread for an interaction mode which will start at a given time.\n "
start_delay = (datetime.strptime(((date.today().strftime('%Y%m%d') + '-') + start_time), '%Y%m%d-%H%M%S') - schedule_start_time).total_seconds()
if (start_delay < 0):
logging.error('{} starts earlier than schedualing time!'.format(interaction_mode.__name__))
interaction_thread = Timer(interval=start_delay, function=interaction_mode, kwargs={'agent': agent, 'end_time': end_time})
return interaction_thread | def interaction_mode_scheduler(interaction_mode, agent, start_time, end_time, schedule_start_time):
"\n Parameters\n ----------\n interaction_mode: func\n function\n \n agent: depends on interaction mode\n 1. agent object: for learning agent\n 2. 'priscribed_behavior': for priscribed behavior\n \n start_time: str (with format'hhmmss')\n \n end_time: str (with format'hhmmss')\n \n schedule_start_time: datetime object\n \n Returns\n -------\n interaction_thread\n a delayed thread for an interaction mode which will start at a given time.\n "
start_delay = (datetime.strptime(((date.today().strftime('%Y%m%d') + '-') + start_time), '%Y%m%d-%H%M%S') - schedule_start_time).total_seconds()
if (start_delay < 0):
logging.error('{} starts earlier than schedualing time!'.format(interaction_mode.__name__))
interaction_thread = Timer(interval=start_delay, function=interaction_mode, kwargs={'agent': agent, 'end_time': end_time})
return interaction_thread<|docstring|>Parameters
----------
interaction_mode: func
function
agent: depends on interaction mode
1. agent object: for learning agent
2. 'priscribed_behavior': for priscribed behavior
start_time: str (with format'hhmmss')
end_time: str (with format'hhmmss')
schedule_start_time: datetime object
Returns
-------
interaction_thread
a delayed thread for an interaction mode which will start at a given time.<|endoftext|> |
3282fbcbb4094a93a6530cacf182e1b40d605118e6633146ada856ca2865091d | def _get_peer_group_name(self):
'\n Getter method for peer_group_name, mapped from YANG variable /network_instances/network_instance/protocols/protocol/bgp/peer_groups/peer_group/config/peer_group_name (string)\n\n YANG Description: Name of the BGP peer-group\n '
return self.__peer_group_name | Getter method for peer_group_name, mapped from YANG variable /network_instances/network_instance/protocols/protocol/bgp/peer_groups/peer_group/config/peer_group_name (string)
YANG Description: Name of the BGP peer-group | napalm_yang/models/openconfig/network_instances/network_instance/protocols/protocol/bgp/peer_groups/peer_group/config/__init__.py | _get_peer_group_name | ckishimo/napalm-yang | 64 | python | def _get_peer_group_name(self):
'\n Getter method for peer_group_name, mapped from YANG variable /network_instances/network_instance/protocols/protocol/bgp/peer_groups/peer_group/config/peer_group_name (string)\n\n YANG Description: Name of the BGP peer-group\n '
return self.__peer_group_name | def _get_peer_group_name(self):
'\n Getter method for peer_group_name, mapped from YANG variable /network_instances/network_instance/protocols/protocol/bgp/peer_groups/peer_group/config/peer_group_name (string)\n\n YANG Description: Name of the BGP peer-group\n '
return self.__peer_group_name<|docstring|>Getter method for peer_group_name, mapped from YANG variable /network_instances/network_instance/protocols/protocol/bgp/peer_groups/peer_group/config/peer_group_name (string)
YANG Description: Name of the BGP peer-group<|endoftext|> |
52c992a6ed733de3c78b0abd2c5877209877fa20131714d7f2152550355d628a | def _set_peer_group_name(self, v, load=False):
'\n Setter method for peer_group_name, mapped from YANG variable /network_instances/network_instance/protocols/protocol/bgp/peer_groups/peer_group/config/peer_group_name (string)\n If this variable is read-only (config: false) in the\n source YANG file, then _set_peer_group_name is considered as a private\n method. Backends looking to populate this variable should\n do so via calling thisObj._set_peer_group_name() directly.\n\n YANG Description: Name of the BGP peer-group\n '
if hasattr(v, '_utype'):
v = v._utype(v)
try:
t = YANGDynClass(v, base=six.text_type, is_leaf=True, yang_name='peer-group-name', parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/network-instance', defining_module='openconfig-network-instance', yang_type='string', is_config=True)
except (TypeError, ValueError):
raise ValueError({'error-string': 'peer_group_name must be of a type compatible with string', 'defined-type': 'string', 'generated-type': 'YANGDynClass(base=six.text_type, is_leaf=True, yang_name="peer-group-name", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace=\'http://openconfig.net/yang/network-instance\', defining_module=\'openconfig-network-instance\', yang_type=\'string\', is_config=True)'})
self.__peer_group_name = t
if hasattr(self, '_set'):
self._set() | Setter method for peer_group_name, mapped from YANG variable /network_instances/network_instance/protocols/protocol/bgp/peer_groups/peer_group/config/peer_group_name (string)
If this variable is read-only (config: false) in the
source YANG file, then _set_peer_group_name is considered as a private
method. Backends looking to populate this variable should
do so via calling thisObj._set_peer_group_name() directly.
YANG Description: Name of the BGP peer-group | napalm_yang/models/openconfig/network_instances/network_instance/protocols/protocol/bgp/peer_groups/peer_group/config/__init__.py | _set_peer_group_name | ckishimo/napalm-yang | 64 | python | def _set_peer_group_name(self, v, load=False):
'\n Setter method for peer_group_name, mapped from YANG variable /network_instances/network_instance/protocols/protocol/bgp/peer_groups/peer_group/config/peer_group_name (string)\n If this variable is read-only (config: false) in the\n source YANG file, then _set_peer_group_name is considered as a private\n method. Backends looking to populate this variable should\n do so via calling thisObj._set_peer_group_name() directly.\n\n YANG Description: Name of the BGP peer-group\n '
if hasattr(v, '_utype'):
v = v._utype(v)
try:
t = YANGDynClass(v, base=six.text_type, is_leaf=True, yang_name='peer-group-name', parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/network-instance', defining_module='openconfig-network-instance', yang_type='string', is_config=True)
except (TypeError, ValueError):
raise ValueError({'error-string': 'peer_group_name must be of a type compatible with string', 'defined-type': 'string', 'generated-type': 'YANGDynClass(base=six.text_type, is_leaf=True, yang_name="peer-group-name", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace=\'http://openconfig.net/yang/network-instance\', defining_module=\'openconfig-network-instance\', yang_type=\'string\', is_config=True)'})
self.__peer_group_name = t
if hasattr(self, '_set'):
self._set() | def _set_peer_group_name(self, v, load=False):
'\n Setter method for peer_group_name, mapped from YANG variable /network_instances/network_instance/protocols/protocol/bgp/peer_groups/peer_group/config/peer_group_name (string)\n If this variable is read-only (config: false) in the\n source YANG file, then _set_peer_group_name is considered as a private\n method. Backends looking to populate this variable should\n do so via calling thisObj._set_peer_group_name() directly.\n\n YANG Description: Name of the BGP peer-group\n '
if hasattr(v, '_utype'):
v = v._utype(v)
try:
t = YANGDynClass(v, base=six.text_type, is_leaf=True, yang_name='peer-group-name', parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/network-instance', defining_module='openconfig-network-instance', yang_type='string', is_config=True)
except (TypeError, ValueError):
raise ValueError({'error-string': 'peer_group_name must be of a type compatible with string', 'defined-type': 'string', 'generated-type': 'YANGDynClass(base=six.text_type, is_leaf=True, yang_name="peer-group-name", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace=\'http://openconfig.net/yang/network-instance\', defining_module=\'openconfig-network-instance\', yang_type=\'string\', is_config=True)'})
self.__peer_group_name = t
if hasattr(self, '_set'):
self._set()<|docstring|>Setter method for peer_group_name, mapped from YANG variable /network_instances/network_instance/protocols/protocol/bgp/peer_groups/peer_group/config/peer_group_name (string)
If this variable is read-only (config: false) in the
source YANG file, then _set_peer_group_name is considered as a private
method. Backends looking to populate this variable should
do so via calling thisObj._set_peer_group_name() directly.
YANG Description: Name of the BGP peer-group<|endoftext|> |
a8175920b5e320271df184e8836b761b9b30e00a65c48f60e6a3ca5fc484ddc2 | def _get_peer_as(self):
'\n Getter method for peer_as, mapped from YANG variable /network_instances/network_instance/protocols/protocol/bgp/peer_groups/peer_group/config/peer_as (oc-inet:as-number)\n\n YANG Description: AS number of the peer.\n '
return self.__peer_as | Getter method for peer_as, mapped from YANG variable /network_instances/network_instance/protocols/protocol/bgp/peer_groups/peer_group/config/peer_as (oc-inet:as-number)
YANG Description: AS number of the peer. | napalm_yang/models/openconfig/network_instances/network_instance/protocols/protocol/bgp/peer_groups/peer_group/config/__init__.py | _get_peer_as | ckishimo/napalm-yang | 64 | python | def _get_peer_as(self):
'\n Getter method for peer_as, mapped from YANG variable /network_instances/network_instance/protocols/protocol/bgp/peer_groups/peer_group/config/peer_as (oc-inet:as-number)\n\n YANG Description: AS number of the peer.\n '
return self.__peer_as | def _get_peer_as(self):
'\n Getter method for peer_as, mapped from YANG variable /network_instances/network_instance/protocols/protocol/bgp/peer_groups/peer_group/config/peer_as (oc-inet:as-number)\n\n YANG Description: AS number of the peer.\n '
return self.__peer_as<|docstring|>Getter method for peer_as, mapped from YANG variable /network_instances/network_instance/protocols/protocol/bgp/peer_groups/peer_group/config/peer_as (oc-inet:as-number)
YANG Description: AS number of the peer.<|endoftext|> |
4564466645b4f2db428df2ba4b42183157732fa900f5baaa9733be57926a119a | def _set_peer_as(self, v, load=False):
'\n Setter method for peer_as, mapped from YANG variable /network_instances/network_instance/protocols/protocol/bgp/peer_groups/peer_group/config/peer_as (oc-inet:as-number)\n If this variable is read-only (config: false) in the\n source YANG file, then _set_peer_as is considered as a private\n method. Backends looking to populate this variable should\n do so via calling thisObj._set_peer_as() directly.\n\n YANG Description: AS number of the peer.\n '
if hasattr(v, '_utype'):
v = v._utype(v)
try:
t = YANGDynClass(v, base=RestrictedClassType(base_type=long, restriction_dict={'range': ['0..4294967295']}, int_size=32), is_leaf=True, yang_name='peer-as', parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/network-instance', defining_module='openconfig-network-instance', yang_type='oc-inet:as-number', is_config=True)
except (TypeError, ValueError):
raise ValueError({'error-string': 'peer_as must be of a type compatible with oc-inet:as-number', 'defined-type': 'oc-inet:as-number', 'generated-type': 'YANGDynClass(base=RestrictedClassType(base_type=long, restriction_dict={\'range\': [\'0..4294967295\']}, int_size=32), is_leaf=True, yang_name="peer-as", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace=\'http://openconfig.net/yang/network-instance\', defining_module=\'openconfig-network-instance\', yang_type=\'oc-inet:as-number\', is_config=True)'})
self.__peer_as = t
if hasattr(self, '_set'):
self._set() | Setter method for peer_as, mapped from YANG variable /network_instances/network_instance/protocols/protocol/bgp/peer_groups/peer_group/config/peer_as (oc-inet:as-number)
If this variable is read-only (config: false) in the
source YANG file, then _set_peer_as is considered as a private
method. Backends looking to populate this variable should
do so via calling thisObj._set_peer_as() directly.
YANG Description: AS number of the peer. | napalm_yang/models/openconfig/network_instances/network_instance/protocols/protocol/bgp/peer_groups/peer_group/config/__init__.py | _set_peer_as | ckishimo/napalm-yang | 64 | python | def _set_peer_as(self, v, load=False):
'\n Setter method for peer_as, mapped from YANG variable /network_instances/network_instance/protocols/protocol/bgp/peer_groups/peer_group/config/peer_as (oc-inet:as-number)\n If this variable is read-only (config: false) in the\n source YANG file, then _set_peer_as is considered as a private\n method. Backends looking to populate this variable should\n do so via calling thisObj._set_peer_as() directly.\n\n YANG Description: AS number of the peer.\n '
if hasattr(v, '_utype'):
v = v._utype(v)
try:
t = YANGDynClass(v, base=RestrictedClassType(base_type=long, restriction_dict={'range': ['0..4294967295']}, int_size=32), is_leaf=True, yang_name='peer-as', parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/network-instance', defining_module='openconfig-network-instance', yang_type='oc-inet:as-number', is_config=True)
except (TypeError, ValueError):
raise ValueError({'error-string': 'peer_as must be of a type compatible with oc-inet:as-number', 'defined-type': 'oc-inet:as-number', 'generated-type': 'YANGDynClass(base=RestrictedClassType(base_type=long, restriction_dict={\'range\': [\'0..4294967295\']}, int_size=32), is_leaf=True, yang_name="peer-as", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace=\'http://openconfig.net/yang/network-instance\', defining_module=\'openconfig-network-instance\', yang_type=\'oc-inet:as-number\', is_config=True)'})
self.__peer_as = t
if hasattr(self, '_set'):
self._set() | def _set_peer_as(self, v, load=False):
'\n Setter method for peer_as, mapped from YANG variable /network_instances/network_instance/protocols/protocol/bgp/peer_groups/peer_group/config/peer_as (oc-inet:as-number)\n If this variable is read-only (config: false) in the\n source YANG file, then _set_peer_as is considered as a private\n method. Backends looking to populate this variable should\n do so via calling thisObj._set_peer_as() directly.\n\n YANG Description: AS number of the peer.\n '
if hasattr(v, '_utype'):
v = v._utype(v)
try:
t = YANGDynClass(v, base=RestrictedClassType(base_type=long, restriction_dict={'range': ['0..4294967295']}, int_size=32), is_leaf=True, yang_name='peer-as', parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/network-instance', defining_module='openconfig-network-instance', yang_type='oc-inet:as-number', is_config=True)
except (TypeError, ValueError):
raise ValueError({'error-string': 'peer_as must be of a type compatible with oc-inet:as-number', 'defined-type': 'oc-inet:as-number', 'generated-type': 'YANGDynClass(base=RestrictedClassType(base_type=long, restriction_dict={\'range\': [\'0..4294967295\']}, int_size=32), is_leaf=True, yang_name="peer-as", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace=\'http://openconfig.net/yang/network-instance\', defining_module=\'openconfig-network-instance\', yang_type=\'oc-inet:as-number\', is_config=True)'})
self.__peer_as = t
if hasattr(self, '_set'):
self._set()<|docstring|>Setter method for peer_as, mapped from YANG variable /network_instances/network_instance/protocols/protocol/bgp/peer_groups/peer_group/config/peer_as (oc-inet:as-number)
If this variable is read-only (config: false) in the
source YANG file, then _set_peer_as is considered as a private
method. Backends looking to populate this variable should
do so via calling thisObj._set_peer_as() directly.
YANG Description: AS number of the peer.<|endoftext|> |
c2a20a19fc55f0db7615ba0cb0a48ebd9db35c8188574aa3af38c678fcace99a | def _get_local_as(self):
'\n Getter method for local_as, mapped from YANG variable /network_instances/network_instance/protocols/protocol/bgp/peer_groups/peer_group/config/local_as (oc-inet:as-number)\n\n YANG Description: The local autonomous system number that is to be used\nwhen establishing sessions with the remote peer or peer\ngroup, if this differs from the global BGP router\nautonomous system number.\n '
return self.__local_as | Getter method for local_as, mapped from YANG variable /network_instances/network_instance/protocols/protocol/bgp/peer_groups/peer_group/config/local_as (oc-inet:as-number)
YANG Description: The local autonomous system number that is to be used
when establishing sessions with the remote peer or peer
group, if this differs from the global BGP router
autonomous system number. | napalm_yang/models/openconfig/network_instances/network_instance/protocols/protocol/bgp/peer_groups/peer_group/config/__init__.py | _get_local_as | ckishimo/napalm-yang | 64 | python | def _get_local_as(self):
'\n Getter method for local_as, mapped from YANG variable /network_instances/network_instance/protocols/protocol/bgp/peer_groups/peer_group/config/local_as (oc-inet:as-number)\n\n YANG Description: The local autonomous system number that is to be used\nwhen establishing sessions with the remote peer or peer\ngroup, if this differs from the global BGP router\nautonomous system number.\n '
return self.__local_as | def _get_local_as(self):
'\n Getter method for local_as, mapped from YANG variable /network_instances/network_instance/protocols/protocol/bgp/peer_groups/peer_group/config/local_as (oc-inet:as-number)\n\n YANG Description: The local autonomous system number that is to be used\nwhen establishing sessions with the remote peer or peer\ngroup, if this differs from the global BGP router\nautonomous system number.\n '
return self.__local_as<|docstring|>Getter method for local_as, mapped from YANG variable /network_instances/network_instance/protocols/protocol/bgp/peer_groups/peer_group/config/local_as (oc-inet:as-number)
YANG Description: The local autonomous system number that is to be used
when establishing sessions with the remote peer or peer
group, if this differs from the global BGP router
autonomous system number.<|endoftext|> |
e24163c1c8ef1af3799b7391023cb38df0692118bb1d12785a7d8d38eac9c8d0 | def _set_local_as(self, v, load=False):
'\n Setter method for local_as, mapped from YANG variable /network_instances/network_instance/protocols/protocol/bgp/peer_groups/peer_group/config/local_as (oc-inet:as-number)\n If this variable is read-only (config: false) in the\n source YANG file, then _set_local_as is considered as a private\n method. Backends looking to populate this variable should\n do so via calling thisObj._set_local_as() directly.\n\n YANG Description: The local autonomous system number that is to be used\nwhen establishing sessions with the remote peer or peer\ngroup, if this differs from the global BGP router\nautonomous system number.\n '
if hasattr(v, '_utype'):
v = v._utype(v)
try:
t = YANGDynClass(v, base=RestrictedClassType(base_type=long, restriction_dict={'range': ['0..4294967295']}, int_size=32), is_leaf=True, yang_name='local-as', parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/network-instance', defining_module='openconfig-network-instance', yang_type='oc-inet:as-number', is_config=True)
except (TypeError, ValueError):
raise ValueError({'error-string': 'local_as must be of a type compatible with oc-inet:as-number', 'defined-type': 'oc-inet:as-number', 'generated-type': 'YANGDynClass(base=RestrictedClassType(base_type=long, restriction_dict={\'range\': [\'0..4294967295\']}, int_size=32), is_leaf=True, yang_name="local-as", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace=\'http://openconfig.net/yang/network-instance\', defining_module=\'openconfig-network-instance\', yang_type=\'oc-inet:as-number\', is_config=True)'})
self.__local_as = t
if hasattr(self, '_set'):
self._set() | Setter method for local_as, mapped from YANG variable /network_instances/network_instance/protocols/protocol/bgp/peer_groups/peer_group/config/local_as (oc-inet:as-number)
If this variable is read-only (config: false) in the
source YANG file, then _set_local_as is considered as a private
method. Backends looking to populate this variable should
do so via calling thisObj._set_local_as() directly.
YANG Description: The local autonomous system number that is to be used
when establishing sessions with the remote peer or peer
group, if this differs from the global BGP router
autonomous system number. | napalm_yang/models/openconfig/network_instances/network_instance/protocols/protocol/bgp/peer_groups/peer_group/config/__init__.py | _set_local_as | ckishimo/napalm-yang | 64 | python | def _set_local_as(self, v, load=False):
'\n Setter method for local_as, mapped from YANG variable /network_instances/network_instance/protocols/protocol/bgp/peer_groups/peer_group/config/local_as (oc-inet:as-number)\n If this variable is read-only (config: false) in the\n source YANG file, then _set_local_as is considered as a private\n method. Backends looking to populate this variable should\n do so via calling thisObj._set_local_as() directly.\n\n YANG Description: The local autonomous system number that is to be used\nwhen establishing sessions with the remote peer or peer\ngroup, if this differs from the global BGP router\nautonomous system number.\n '
if hasattr(v, '_utype'):
v = v._utype(v)
try:
t = YANGDynClass(v, base=RestrictedClassType(base_type=long, restriction_dict={'range': ['0..4294967295']}, int_size=32), is_leaf=True, yang_name='local-as', parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/network-instance', defining_module='openconfig-network-instance', yang_type='oc-inet:as-number', is_config=True)
except (TypeError, ValueError):
raise ValueError({'error-string': 'local_as must be of a type compatible with oc-inet:as-number', 'defined-type': 'oc-inet:as-number', 'generated-type': 'YANGDynClass(base=RestrictedClassType(base_type=long, restriction_dict={\'range\': [\'0..4294967295\']}, int_size=32), is_leaf=True, yang_name="local-as", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace=\'http://openconfig.net/yang/network-instance\', defining_module=\'openconfig-network-instance\', yang_type=\'oc-inet:as-number\', is_config=True)'})
self.__local_as = t
if hasattr(self, '_set'):
self._set() | def _set_local_as(self, v, load=False):
'\n Setter method for local_as, mapped from YANG variable /network_instances/network_instance/protocols/protocol/bgp/peer_groups/peer_group/config/local_as (oc-inet:as-number)\n If this variable is read-only (config: false) in the\n source YANG file, then _set_local_as is considered as a private\n method. Backends looking to populate this variable should\n do so via calling thisObj._set_local_as() directly.\n\n YANG Description: The local autonomous system number that is to be used\nwhen establishing sessions with the remote peer or peer\ngroup, if this differs from the global BGP router\nautonomous system number.\n '
if hasattr(v, '_utype'):
v = v._utype(v)
try:
t = YANGDynClass(v, base=RestrictedClassType(base_type=long, restriction_dict={'range': ['0..4294967295']}, int_size=32), is_leaf=True, yang_name='local-as', parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/network-instance', defining_module='openconfig-network-instance', yang_type='oc-inet:as-number', is_config=True)
except (TypeError, ValueError):
raise ValueError({'error-string': 'local_as must be of a type compatible with oc-inet:as-number', 'defined-type': 'oc-inet:as-number', 'generated-type': 'YANGDynClass(base=RestrictedClassType(base_type=long, restriction_dict={\'range\': [\'0..4294967295\']}, int_size=32), is_leaf=True, yang_name="local-as", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace=\'http://openconfig.net/yang/network-instance\', defining_module=\'openconfig-network-instance\', yang_type=\'oc-inet:as-number\', is_config=True)'})
self.__local_as = t
if hasattr(self, '_set'):
self._set()<|docstring|>Setter method for local_as, mapped from YANG variable /network_instances/network_instance/protocols/protocol/bgp/peer_groups/peer_group/config/local_as (oc-inet:as-number)
If this variable is read-only (config: false) in the
source YANG file, then _set_local_as is considered as a private
method. Backends looking to populate this variable should
do so via calling thisObj._set_local_as() directly.
YANG Description: The local autonomous system number that is to be used
when establishing sessions with the remote peer or peer
group, if this differs from the global BGP router
autonomous system number.<|endoftext|> |
eb806ed21b17b2189a96d7abe36ee71860c3058168a1d4630cc962523fd2dc94 | def _get_peer_type(self):
'\n Getter method for peer_type, mapped from YANG variable /network_instances/network_instance/protocols/protocol/bgp/peer_groups/peer_group/config/peer_type (oc-bgp-types:peer-type)\n\n YANG Description: Explicitly designate the peer or peer group as internal\n(iBGP) or external (eBGP).\n '
return self.__peer_type | Getter method for peer_type, mapped from YANG variable /network_instances/network_instance/protocols/protocol/bgp/peer_groups/peer_group/config/peer_type (oc-bgp-types:peer-type)
YANG Description: Explicitly designate the peer or peer group as internal
(iBGP) or external (eBGP). | napalm_yang/models/openconfig/network_instances/network_instance/protocols/protocol/bgp/peer_groups/peer_group/config/__init__.py | _get_peer_type | ckishimo/napalm-yang | 64 | python | def _get_peer_type(self):
'\n Getter method for peer_type, mapped from YANG variable /network_instances/network_instance/protocols/protocol/bgp/peer_groups/peer_group/config/peer_type (oc-bgp-types:peer-type)\n\n YANG Description: Explicitly designate the peer or peer group as internal\n(iBGP) or external (eBGP).\n '
return self.__peer_type | def _get_peer_type(self):
'\n Getter method for peer_type, mapped from YANG variable /network_instances/network_instance/protocols/protocol/bgp/peer_groups/peer_group/config/peer_type (oc-bgp-types:peer-type)\n\n YANG Description: Explicitly designate the peer or peer group as internal\n(iBGP) or external (eBGP).\n '
return self.__peer_type<|docstring|>Getter method for peer_type, mapped from YANG variable /network_instances/network_instance/protocols/protocol/bgp/peer_groups/peer_group/config/peer_type (oc-bgp-types:peer-type)
YANG Description: Explicitly designate the peer or peer group as internal
(iBGP) or external (eBGP).<|endoftext|> |
d3d5b2987b8079fd02ad0a2295c9f9a3b65d1b2ab2dc2a7b9ffe6b9aa00661b9 | def _set_peer_type(self, v, load=False):
'\n Setter method for peer_type, mapped from YANG variable /network_instances/network_instance/protocols/protocol/bgp/peer_groups/peer_group/config/peer_type (oc-bgp-types:peer-type)\n If this variable is read-only (config: false) in the\n source YANG file, then _set_peer_type is considered as a private\n method. Backends looking to populate this variable should\n do so via calling thisObj._set_peer_type() directly.\n\n YANG Description: Explicitly designate the peer or peer group as internal\n(iBGP) or external (eBGP).\n '
if hasattr(v, '_utype'):
v = v._utype(v)
try:
t = YANGDynClass(v, base=RestrictedClassType(base_type=six.text_type, restriction_type='dict_key', restriction_arg={'INTERNAL': {}, 'EXTERNAL': {}}), is_leaf=True, yang_name='peer-type', parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/network-instance', defining_module='openconfig-network-instance', yang_type='oc-bgp-types:peer-type', is_config=True)
except (TypeError, ValueError):
raise ValueError({'error-string': 'peer_type must be of a type compatible with oc-bgp-types:peer-type', 'defined-type': 'oc-bgp-types:peer-type', 'generated-type': 'YANGDynClass(base=RestrictedClassType(base_type=six.text_type, restriction_type="dict_key", restriction_arg={\'INTERNAL\': {}, \'EXTERNAL\': {}},), is_leaf=True, yang_name="peer-type", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace=\'http://openconfig.net/yang/network-instance\', defining_module=\'openconfig-network-instance\', yang_type=\'oc-bgp-types:peer-type\', is_config=True)'})
self.__peer_type = t
if hasattr(self, '_set'):
self._set() | Setter method for peer_type, mapped from YANG variable /network_instances/network_instance/protocols/protocol/bgp/peer_groups/peer_group/config/peer_type (oc-bgp-types:peer-type)
If this variable is read-only (config: false) in the
source YANG file, then _set_peer_type is considered as a private
method. Backends looking to populate this variable should
do so via calling thisObj._set_peer_type() directly.
YANG Description: Explicitly designate the peer or peer group as internal
(iBGP) or external (eBGP). | napalm_yang/models/openconfig/network_instances/network_instance/protocols/protocol/bgp/peer_groups/peer_group/config/__init__.py | _set_peer_type | ckishimo/napalm-yang | 64 | python | def _set_peer_type(self, v, load=False):
'\n Setter method for peer_type, mapped from YANG variable /network_instances/network_instance/protocols/protocol/bgp/peer_groups/peer_group/config/peer_type (oc-bgp-types:peer-type)\n If this variable is read-only (config: false) in the\n source YANG file, then _set_peer_type is considered as a private\n method. Backends looking to populate this variable should\n do so via calling thisObj._set_peer_type() directly.\n\n YANG Description: Explicitly designate the peer or peer group as internal\n(iBGP) or external (eBGP).\n '
if hasattr(v, '_utype'):
v = v._utype(v)
try:
t = YANGDynClass(v, base=RestrictedClassType(base_type=six.text_type, restriction_type='dict_key', restriction_arg={'INTERNAL': {}, 'EXTERNAL': {}}), is_leaf=True, yang_name='peer-type', parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/network-instance', defining_module='openconfig-network-instance', yang_type='oc-bgp-types:peer-type', is_config=True)
except (TypeError, ValueError):
raise ValueError({'error-string': 'peer_type must be of a type compatible with oc-bgp-types:peer-type', 'defined-type': 'oc-bgp-types:peer-type', 'generated-type': 'YANGDynClass(base=RestrictedClassType(base_type=six.text_type, restriction_type="dict_key", restriction_arg={\'INTERNAL\': {}, \'EXTERNAL\': {}},), is_leaf=True, yang_name="peer-type", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace=\'http://openconfig.net/yang/network-instance\', defining_module=\'openconfig-network-instance\', yang_type=\'oc-bgp-types:peer-type\', is_config=True)'})
self.__peer_type = t
if hasattr(self, '_set'):
self._set() | def _set_peer_type(self, v, load=False):
'\n Setter method for peer_type, mapped from YANG variable /network_instances/network_instance/protocols/protocol/bgp/peer_groups/peer_group/config/peer_type (oc-bgp-types:peer-type)\n If this variable is read-only (config: false) in the\n source YANG file, then _set_peer_type is considered as a private\n method. Backends looking to populate this variable should\n do so via calling thisObj._set_peer_type() directly.\n\n YANG Description: Explicitly designate the peer or peer group as internal\n(iBGP) or external (eBGP).\n '
if hasattr(v, '_utype'):
v = v._utype(v)
try:
t = YANGDynClass(v, base=RestrictedClassType(base_type=six.text_type, restriction_type='dict_key', restriction_arg={'INTERNAL': {}, 'EXTERNAL': {}}), is_leaf=True, yang_name='peer-type', parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/network-instance', defining_module='openconfig-network-instance', yang_type='oc-bgp-types:peer-type', is_config=True)
except (TypeError, ValueError):
raise ValueError({'error-string': 'peer_type must be of a type compatible with oc-bgp-types:peer-type', 'defined-type': 'oc-bgp-types:peer-type', 'generated-type': 'YANGDynClass(base=RestrictedClassType(base_type=six.text_type, restriction_type="dict_key", restriction_arg={\'INTERNAL\': {}, \'EXTERNAL\': {}},), is_leaf=True, yang_name="peer-type", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace=\'http://openconfig.net/yang/network-instance\', defining_module=\'openconfig-network-instance\', yang_type=\'oc-bgp-types:peer-type\', is_config=True)'})
self.__peer_type = t
if hasattr(self, '_set'):
self._set()<|docstring|>Setter method for peer_type, mapped from YANG variable /network_instances/network_instance/protocols/protocol/bgp/peer_groups/peer_group/config/peer_type (oc-bgp-types:peer-type)
If this variable is read-only (config: false) in the
source YANG file, then _set_peer_type is considered as a private
method. Backends looking to populate this variable should
do so via calling thisObj._set_peer_type() directly.
YANG Description: Explicitly designate the peer or peer group as internal
(iBGP) or external (eBGP).<|endoftext|> |
c49abcb46396dc99570e882300ad82fa41e6a72c38d8008b5cc395506c383ef5 | def _get_auth_password(self):
'\n Getter method for auth_password, mapped from YANG variable /network_instances/network_instance/protocols/protocol/bgp/peer_groups/peer_group/config/auth_password (oc-types:routing-password)\n\n YANG Description: Configures an MD5 authentication password for use with\nneighboring devices.\n '
return self.__auth_password | Getter method for auth_password, mapped from YANG variable /network_instances/network_instance/protocols/protocol/bgp/peer_groups/peer_group/config/auth_password (oc-types:routing-password)
YANG Description: Configures an MD5 authentication password for use with
neighboring devices. | napalm_yang/models/openconfig/network_instances/network_instance/protocols/protocol/bgp/peer_groups/peer_group/config/__init__.py | _get_auth_password | ckishimo/napalm-yang | 64 | python | def _get_auth_password(self):
'\n Getter method for auth_password, mapped from YANG variable /network_instances/network_instance/protocols/protocol/bgp/peer_groups/peer_group/config/auth_password (oc-types:routing-password)\n\n YANG Description: Configures an MD5 authentication password for use with\nneighboring devices.\n '
return self.__auth_password | def _get_auth_password(self):
'\n Getter method for auth_password, mapped from YANG variable /network_instances/network_instance/protocols/protocol/bgp/peer_groups/peer_group/config/auth_password (oc-types:routing-password)\n\n YANG Description: Configures an MD5 authentication password for use with\nneighboring devices.\n '
return self.__auth_password<|docstring|>Getter method for auth_password, mapped from YANG variable /network_instances/network_instance/protocols/protocol/bgp/peer_groups/peer_group/config/auth_password (oc-types:routing-password)
YANG Description: Configures an MD5 authentication password for use with
neighboring devices.<|endoftext|> |
401b130d449c32655b912d3c0614c07e94e5546569f6db05c544048471567a02 | def _set_auth_password(self, v, load=False):
'\n Setter method for auth_password, mapped from YANG variable /network_instances/network_instance/protocols/protocol/bgp/peer_groups/peer_group/config/auth_password (oc-types:routing-password)\n If this variable is read-only (config: false) in the\n source YANG file, then _set_auth_password is considered as a private\n method. Backends looking to populate this variable should\n do so via calling thisObj._set_auth_password() directly.\n\n YANG Description: Configures an MD5 authentication password for use with\nneighboring devices.\n '
if hasattr(v, '_utype'):
v = v._utype(v)
try:
t = YANGDynClass(v, base=six.text_type, is_leaf=True, yang_name='auth-password', parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/network-instance', defining_module='openconfig-network-instance', yang_type='oc-types:routing-password', is_config=True)
except (TypeError, ValueError):
raise ValueError({'error-string': 'auth_password must be of a type compatible with oc-types:routing-password', 'defined-type': 'oc-types:routing-password', 'generated-type': 'YANGDynClass(base=six.text_type, is_leaf=True, yang_name="auth-password", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace=\'http://openconfig.net/yang/network-instance\', defining_module=\'openconfig-network-instance\', yang_type=\'oc-types:routing-password\', is_config=True)'})
self.__auth_password = t
if hasattr(self, '_set'):
self._set() | Setter method for auth_password, mapped from YANG variable /network_instances/network_instance/protocols/protocol/bgp/peer_groups/peer_group/config/auth_password (oc-types:routing-password)
If this variable is read-only (config: false) in the
source YANG file, then _set_auth_password is considered as a private
method. Backends looking to populate this variable should
do so via calling thisObj._set_auth_password() directly.
YANG Description: Configures an MD5 authentication password for use with
neighboring devices. | napalm_yang/models/openconfig/network_instances/network_instance/protocols/protocol/bgp/peer_groups/peer_group/config/__init__.py | _set_auth_password | ckishimo/napalm-yang | 64 | python | def _set_auth_password(self, v, load=False):
'\n Setter method for auth_password, mapped from YANG variable /network_instances/network_instance/protocols/protocol/bgp/peer_groups/peer_group/config/auth_password (oc-types:routing-password)\n If this variable is read-only (config: false) in the\n source YANG file, then _set_auth_password is considered as a private\n method. Backends looking to populate this variable should\n do so via calling thisObj._set_auth_password() directly.\n\n YANG Description: Configures an MD5 authentication password for use with\nneighboring devices.\n '
if hasattr(v, '_utype'):
v = v._utype(v)
try:
t = YANGDynClass(v, base=six.text_type, is_leaf=True, yang_name='auth-password', parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/network-instance', defining_module='openconfig-network-instance', yang_type='oc-types:routing-password', is_config=True)
except (TypeError, ValueError):
raise ValueError({'error-string': 'auth_password must be of a type compatible with oc-types:routing-password', 'defined-type': 'oc-types:routing-password', 'generated-type': 'YANGDynClass(base=six.text_type, is_leaf=True, yang_name="auth-password", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace=\'http://openconfig.net/yang/network-instance\', defining_module=\'openconfig-network-instance\', yang_type=\'oc-types:routing-password\', is_config=True)'})
self.__auth_password = t
if hasattr(self, '_set'):
self._set() | def _set_auth_password(self, v, load=False):
'\n Setter method for auth_password, mapped from YANG variable /network_instances/network_instance/protocols/protocol/bgp/peer_groups/peer_group/config/auth_password (oc-types:routing-password)\n If this variable is read-only (config: false) in the\n source YANG file, then _set_auth_password is considered as a private\n method. Backends looking to populate this variable should\n do so via calling thisObj._set_auth_password() directly.\n\n YANG Description: Configures an MD5 authentication password for use with\nneighboring devices.\n '
if hasattr(v, '_utype'):
v = v._utype(v)
try:
t = YANGDynClass(v, base=six.text_type, is_leaf=True, yang_name='auth-password', parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/network-instance', defining_module='openconfig-network-instance', yang_type='oc-types:routing-password', is_config=True)
except (TypeError, ValueError):
raise ValueError({'error-string': 'auth_password must be of a type compatible with oc-types:routing-password', 'defined-type': 'oc-types:routing-password', 'generated-type': 'YANGDynClass(base=six.text_type, is_leaf=True, yang_name="auth-password", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace=\'http://openconfig.net/yang/network-instance\', defining_module=\'openconfig-network-instance\', yang_type=\'oc-types:routing-password\', is_config=True)'})
self.__auth_password = t
if hasattr(self, '_set'):
self._set()<|docstring|>Setter method for auth_password, mapped from YANG variable /network_instances/network_instance/protocols/protocol/bgp/peer_groups/peer_group/config/auth_password (oc-types:routing-password)
If this variable is read-only (config: false) in the
source YANG file, then _set_auth_password is considered as a private
method. Backends looking to populate this variable should
do so via calling thisObj._set_auth_password() directly.
YANG Description: Configures an MD5 authentication password for use with
neighboring devices.<|endoftext|> |
d893062721e5a3fd147c261456aeef656854784c3cb5fa7bea6df33a756ca117 | def _get_remove_private_as(self):
'\n Getter method for remove_private_as, mapped from YANG variable /network_instances/network_instance/protocols/protocol/bgp/peer_groups/peer_group/config/remove_private_as (oc-bgp-types:remove-private-as-option)\n\n YANG Description: Remove private AS numbers from updates sent to peers - when\nthis leaf is not specified, the AS_PATH attribute should be\nsent to the peer unchanged\n '
return self.__remove_private_as | Getter method for remove_private_as, mapped from YANG variable /network_instances/network_instance/protocols/protocol/bgp/peer_groups/peer_group/config/remove_private_as (oc-bgp-types:remove-private-as-option)
YANG Description: Remove private AS numbers from updates sent to peers - when
this leaf is not specified, the AS_PATH attribute should be
sent to the peer unchanged | napalm_yang/models/openconfig/network_instances/network_instance/protocols/protocol/bgp/peer_groups/peer_group/config/__init__.py | _get_remove_private_as | ckishimo/napalm-yang | 64 | python | def _get_remove_private_as(self):
'\n Getter method for remove_private_as, mapped from YANG variable /network_instances/network_instance/protocols/protocol/bgp/peer_groups/peer_group/config/remove_private_as (oc-bgp-types:remove-private-as-option)\n\n YANG Description: Remove private AS numbers from updates sent to peers - when\nthis leaf is not specified, the AS_PATH attribute should be\nsent to the peer unchanged\n '
return self.__remove_private_as | def _get_remove_private_as(self):
'\n Getter method for remove_private_as, mapped from YANG variable /network_instances/network_instance/protocols/protocol/bgp/peer_groups/peer_group/config/remove_private_as (oc-bgp-types:remove-private-as-option)\n\n YANG Description: Remove private AS numbers from updates sent to peers - when\nthis leaf is not specified, the AS_PATH attribute should be\nsent to the peer unchanged\n '
return self.__remove_private_as<|docstring|>Getter method for remove_private_as, mapped from YANG variable /network_instances/network_instance/protocols/protocol/bgp/peer_groups/peer_group/config/remove_private_as (oc-bgp-types:remove-private-as-option)
YANG Description: Remove private AS numbers from updates sent to peers - when
this leaf is not specified, the AS_PATH attribute should be
sent to the peer unchanged<|endoftext|> |
d76899ed4f273fcc21b967d3c6af7610f32e86fc12133cdbb530a1ffdce15ae1 | def _set_remove_private_as(self, v, load=False):
'\n Setter method for remove_private_as, mapped from YANG variable /network_instances/network_instance/protocols/protocol/bgp/peer_groups/peer_group/config/remove_private_as (oc-bgp-types:remove-private-as-option)\n If this variable is read-only (config: false) in the\n source YANG file, then _set_remove_private_as is considered as a private\n method. Backends looking to populate this variable should\n do so via calling thisObj._set_remove_private_as() directly.\n\n YANG Description: Remove private AS numbers from updates sent to peers - when\nthis leaf is not specified, the AS_PATH attribute should be\nsent to the peer unchanged\n '
if hasattr(v, '_utype'):
v = v._utype(v)
try:
t = YANGDynClass(v, base=RestrictedClassType(base_type=six.text_type, restriction_type='dict_key', restriction_arg={'PRIVATE_AS_REMOVE_ALL': {'@module': 'openconfig-bgp-types', '@namespace': 'http://openconfig.net/yang/bgp-types'}, 'oc-bgp-types:PRIVATE_AS_REMOVE_ALL': {'@module': 'openconfig-bgp-types', '@namespace': 'http://openconfig.net/yang/bgp-types'}, 'PRIVATE_AS_REPLACE_ALL': {'@module': 'openconfig-bgp-types', '@namespace': 'http://openconfig.net/yang/bgp-types'}, 'oc-bgp-types:PRIVATE_AS_REPLACE_ALL': {'@module': 'openconfig-bgp-types', '@namespace': 'http://openconfig.net/yang/bgp-types'}}), is_leaf=True, yang_name='remove-private-as', parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/network-instance', defining_module='openconfig-network-instance', yang_type='oc-bgp-types:remove-private-as-option', is_config=True)
except (TypeError, ValueError):
raise ValueError({'error-string': 'remove_private_as must be of a type compatible with oc-bgp-types:remove-private-as-option', 'defined-type': 'oc-bgp-types:remove-private-as-option', 'generated-type': 'YANGDynClass(base=RestrictedClassType(base_type=six.text_type, restriction_type="dict_key", restriction_arg={\'PRIVATE_AS_REMOVE_ALL\': {\'@module\': \'openconfig-bgp-types\', \'@namespace\': \'http://openconfig.net/yang/bgp-types\'}, \'oc-bgp-types:PRIVATE_AS_REMOVE_ALL\': {\'@module\': \'openconfig-bgp-types\', \'@namespace\': \'http://openconfig.net/yang/bgp-types\'}, \'PRIVATE_AS_REPLACE_ALL\': {\'@module\': \'openconfig-bgp-types\', \'@namespace\': \'http://openconfig.net/yang/bgp-types\'}, \'oc-bgp-types:PRIVATE_AS_REPLACE_ALL\': {\'@module\': \'openconfig-bgp-types\', \'@namespace\': \'http://openconfig.net/yang/bgp-types\'}},), is_leaf=True, yang_name="remove-private-as", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace=\'http://openconfig.net/yang/network-instance\', defining_module=\'openconfig-network-instance\', yang_type=\'oc-bgp-types:remove-private-as-option\', is_config=True)'})
self.__remove_private_as = t
if hasattr(self, '_set'):
self._set() | Setter method for remove_private_as, mapped from YANG variable /network_instances/network_instance/protocols/protocol/bgp/peer_groups/peer_group/config/remove_private_as (oc-bgp-types:remove-private-as-option)
If this variable is read-only (config: false) in the
source YANG file, then _set_remove_private_as is considered as a private
method. Backends looking to populate this variable should
do so via calling thisObj._set_remove_private_as() directly.
YANG Description: Remove private AS numbers from updates sent to peers - when
this leaf is not specified, the AS_PATH attribute should be
sent to the peer unchanged | napalm_yang/models/openconfig/network_instances/network_instance/protocols/protocol/bgp/peer_groups/peer_group/config/__init__.py | _set_remove_private_as | ckishimo/napalm-yang | 64 | python | def _set_remove_private_as(self, v, load=False):
'\n Setter method for remove_private_as, mapped from YANG variable /network_instances/network_instance/protocols/protocol/bgp/peer_groups/peer_group/config/remove_private_as (oc-bgp-types:remove-private-as-option)\n If this variable is read-only (config: false) in the\n source YANG file, then _set_remove_private_as is considered as a private\n method. Backends looking to populate this variable should\n do so via calling thisObj._set_remove_private_as() directly.\n\n YANG Description: Remove private AS numbers from updates sent to peers - when\nthis leaf is not specified, the AS_PATH attribute should be\nsent to the peer unchanged\n '
if hasattr(v, '_utype'):
v = v._utype(v)
try:
t = YANGDynClass(v, base=RestrictedClassType(base_type=six.text_type, restriction_type='dict_key', restriction_arg={'PRIVATE_AS_REMOVE_ALL': {'@module': 'openconfig-bgp-types', '@namespace': 'http://openconfig.net/yang/bgp-types'}, 'oc-bgp-types:PRIVATE_AS_REMOVE_ALL': {'@module': 'openconfig-bgp-types', '@namespace': 'http://openconfig.net/yang/bgp-types'}, 'PRIVATE_AS_REPLACE_ALL': {'@module': 'openconfig-bgp-types', '@namespace': 'http://openconfig.net/yang/bgp-types'}, 'oc-bgp-types:PRIVATE_AS_REPLACE_ALL': {'@module': 'openconfig-bgp-types', '@namespace': 'http://openconfig.net/yang/bgp-types'}}), is_leaf=True, yang_name='remove-private-as', parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/network-instance', defining_module='openconfig-network-instance', yang_type='oc-bgp-types:remove-private-as-option', is_config=True)
except (TypeError, ValueError):
raise ValueError({'error-string': 'remove_private_as must be of a type compatible with oc-bgp-types:remove-private-as-option', 'defined-type': 'oc-bgp-types:remove-private-as-option', 'generated-type': 'YANGDynClass(base=RestrictedClassType(base_type=six.text_type, restriction_type="dict_key", restriction_arg={\'PRIVATE_AS_REMOVE_ALL\': {\'@module\': \'openconfig-bgp-types\', \'@namespace\': \'http://openconfig.net/yang/bgp-types\'}, \'oc-bgp-types:PRIVATE_AS_REMOVE_ALL\': {\'@module\': \'openconfig-bgp-types\', \'@namespace\': \'http://openconfig.net/yang/bgp-types\'}, \'PRIVATE_AS_REPLACE_ALL\': {\'@module\': \'openconfig-bgp-types\', \'@namespace\': \'http://openconfig.net/yang/bgp-types\'}, \'oc-bgp-types:PRIVATE_AS_REPLACE_ALL\': {\'@module\': \'openconfig-bgp-types\', \'@namespace\': \'http://openconfig.net/yang/bgp-types\'}},), is_leaf=True, yang_name="remove-private-as", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace=\'http://openconfig.net/yang/network-instance\', defining_module=\'openconfig-network-instance\', yang_type=\'oc-bgp-types:remove-private-as-option\', is_config=True)'})
self.__remove_private_as = t
if hasattr(self, '_set'):
self._set() | def _set_remove_private_as(self, v, load=False):
'\n Setter method for remove_private_as, mapped from YANG variable /network_instances/network_instance/protocols/protocol/bgp/peer_groups/peer_group/config/remove_private_as (oc-bgp-types:remove-private-as-option)\n If this variable is read-only (config: false) in the\n source YANG file, then _set_remove_private_as is considered as a private\n method. Backends looking to populate this variable should\n do so via calling thisObj._set_remove_private_as() directly.\n\n YANG Description: Remove private AS numbers from updates sent to peers - when\nthis leaf is not specified, the AS_PATH attribute should be\nsent to the peer unchanged\n '
if hasattr(v, '_utype'):
v = v._utype(v)
try:
t = YANGDynClass(v, base=RestrictedClassType(base_type=six.text_type, restriction_type='dict_key', restriction_arg={'PRIVATE_AS_REMOVE_ALL': {'@module': 'openconfig-bgp-types', '@namespace': 'http://openconfig.net/yang/bgp-types'}, 'oc-bgp-types:PRIVATE_AS_REMOVE_ALL': {'@module': 'openconfig-bgp-types', '@namespace': 'http://openconfig.net/yang/bgp-types'}, 'PRIVATE_AS_REPLACE_ALL': {'@module': 'openconfig-bgp-types', '@namespace': 'http://openconfig.net/yang/bgp-types'}, 'oc-bgp-types:PRIVATE_AS_REPLACE_ALL': {'@module': 'openconfig-bgp-types', '@namespace': 'http://openconfig.net/yang/bgp-types'}}), is_leaf=True, yang_name='remove-private-as', parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/network-instance', defining_module='openconfig-network-instance', yang_type='oc-bgp-types:remove-private-as-option', is_config=True)
except (TypeError, ValueError):
raise ValueError({'error-string': 'remove_private_as must be of a type compatible with oc-bgp-types:remove-private-as-option', 'defined-type': 'oc-bgp-types:remove-private-as-option', 'generated-type': 'YANGDynClass(base=RestrictedClassType(base_type=six.text_type, restriction_type="dict_key", restriction_arg={\'PRIVATE_AS_REMOVE_ALL\': {\'@module\': \'openconfig-bgp-types\', \'@namespace\': \'http://openconfig.net/yang/bgp-types\'}, \'oc-bgp-types:PRIVATE_AS_REMOVE_ALL\': {\'@module\': \'openconfig-bgp-types\', \'@namespace\': \'http://openconfig.net/yang/bgp-types\'}, \'PRIVATE_AS_REPLACE_ALL\': {\'@module\': \'openconfig-bgp-types\', \'@namespace\': \'http://openconfig.net/yang/bgp-types\'}, \'oc-bgp-types:PRIVATE_AS_REPLACE_ALL\': {\'@module\': \'openconfig-bgp-types\', \'@namespace\': \'http://openconfig.net/yang/bgp-types\'}},), is_leaf=True, yang_name="remove-private-as", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace=\'http://openconfig.net/yang/network-instance\', defining_module=\'openconfig-network-instance\', yang_type=\'oc-bgp-types:remove-private-as-option\', is_config=True)'})
self.__remove_private_as = t
if hasattr(self, '_set'):
self._set()<|docstring|>Setter method for remove_private_as, mapped from YANG variable /network_instances/network_instance/protocols/protocol/bgp/peer_groups/peer_group/config/remove_private_as (oc-bgp-types:remove-private-as-option)
If this variable is read-only (config: false) in the
source YANG file, then _set_remove_private_as is considered as a private
method. Backends looking to populate this variable should
do so via calling thisObj._set_remove_private_as() directly.
YANG Description: Remove private AS numbers from updates sent to peers - when
this leaf is not specified, the AS_PATH attribute should be
sent to the peer unchanged<|endoftext|> |
d5c581c25d849a1453e2a27227a99dfcfc522d012cbc331c93574ebf60c13e69 | def _get_route_flap_damping(self):
'\n Getter method for route_flap_damping, mapped from YANG variable /network_instances/network_instance/protocols/protocol/bgp/peer_groups/peer_group/config/route_flap_damping (boolean)\n\n YANG Description: Enable route flap damping.\n '
return self.__route_flap_damping | Getter method for route_flap_damping, mapped from YANG variable /network_instances/network_instance/protocols/protocol/bgp/peer_groups/peer_group/config/route_flap_damping (boolean)
YANG Description: Enable route flap damping. | napalm_yang/models/openconfig/network_instances/network_instance/protocols/protocol/bgp/peer_groups/peer_group/config/__init__.py | _get_route_flap_damping | ckishimo/napalm-yang | 64 | python | def _get_route_flap_damping(self):
'\n Getter method for route_flap_damping, mapped from YANG variable /network_instances/network_instance/protocols/protocol/bgp/peer_groups/peer_group/config/route_flap_damping (boolean)\n\n YANG Description: Enable route flap damping.\n '
return self.__route_flap_damping | def _get_route_flap_damping(self):
'\n Getter method for route_flap_damping, mapped from YANG variable /network_instances/network_instance/protocols/protocol/bgp/peer_groups/peer_group/config/route_flap_damping (boolean)\n\n YANG Description: Enable route flap damping.\n '
return self.__route_flap_damping<|docstring|>Getter method for route_flap_damping, mapped from YANG variable /network_instances/network_instance/protocols/protocol/bgp/peer_groups/peer_group/config/route_flap_damping (boolean)
YANG Description: Enable route flap damping.<|endoftext|> |
515a8f221a6c2f33136e65d5d8a735ff18c1bb1e4ef62ee971544214d8bd6710 | def _set_route_flap_damping(self, v, load=False):
'\n Setter method for route_flap_damping, mapped from YANG variable /network_instances/network_instance/protocols/protocol/bgp/peer_groups/peer_group/config/route_flap_damping (boolean)\n If this variable is read-only (config: false) in the\n source YANG file, then _set_route_flap_damping is considered as a private\n method. Backends looking to populate this variable should\n do so via calling thisObj._set_route_flap_damping() directly.\n\n YANG Description: Enable route flap damping.\n '
if hasattr(v, '_utype'):
v = v._utype(v)
try:
t = YANGDynClass(v, base=YANGBool, default=YANGBool('false'), is_leaf=True, yang_name='route-flap-damping', parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/network-instance', defining_module='openconfig-network-instance', yang_type='boolean', is_config=True)
except (TypeError, ValueError):
raise ValueError({'error-string': 'route_flap_damping must be of a type compatible with boolean', 'defined-type': 'boolean', 'generated-type': 'YANGDynClass(base=YANGBool, default=YANGBool("false"), is_leaf=True, yang_name="route-flap-damping", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace=\'http://openconfig.net/yang/network-instance\', defining_module=\'openconfig-network-instance\', yang_type=\'boolean\', is_config=True)'})
self.__route_flap_damping = t
if hasattr(self, '_set'):
self._set() | Setter method for route_flap_damping, mapped from YANG variable /network_instances/network_instance/protocols/protocol/bgp/peer_groups/peer_group/config/route_flap_damping (boolean)
If this variable is read-only (config: false) in the
source YANG file, then _set_route_flap_damping is considered as a private
method. Backends looking to populate this variable should
do so via calling thisObj._set_route_flap_damping() directly.
YANG Description: Enable route flap damping. | napalm_yang/models/openconfig/network_instances/network_instance/protocols/protocol/bgp/peer_groups/peer_group/config/__init__.py | _set_route_flap_damping | ckishimo/napalm-yang | 64 | python | def _set_route_flap_damping(self, v, load=False):
'\n Setter method for route_flap_damping, mapped from YANG variable /network_instances/network_instance/protocols/protocol/bgp/peer_groups/peer_group/config/route_flap_damping (boolean)\n If this variable is read-only (config: false) in the\n source YANG file, then _set_route_flap_damping is considered as a private\n method. Backends looking to populate this variable should\n do so via calling thisObj._set_route_flap_damping() directly.\n\n YANG Description: Enable route flap damping.\n '
if hasattr(v, '_utype'):
v = v._utype(v)
try:
t = YANGDynClass(v, base=YANGBool, default=YANGBool('false'), is_leaf=True, yang_name='route-flap-damping', parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/network-instance', defining_module='openconfig-network-instance', yang_type='boolean', is_config=True)
except (TypeError, ValueError):
raise ValueError({'error-string': 'route_flap_damping must be of a type compatible with boolean', 'defined-type': 'boolean', 'generated-type': 'YANGDynClass(base=YANGBool, default=YANGBool("false"), is_leaf=True, yang_name="route-flap-damping", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace=\'http://openconfig.net/yang/network-instance\', defining_module=\'openconfig-network-instance\', yang_type=\'boolean\', is_config=True)'})
self.__route_flap_damping = t
if hasattr(self, '_set'):
self._set() | def _set_route_flap_damping(self, v, load=False):
'\n Setter method for route_flap_damping, mapped from YANG variable /network_instances/network_instance/protocols/protocol/bgp/peer_groups/peer_group/config/route_flap_damping (boolean)\n If this variable is read-only (config: false) in the\n source YANG file, then _set_route_flap_damping is considered as a private\n method. Backends looking to populate this variable should\n do so via calling thisObj._set_route_flap_damping() directly.\n\n YANG Description: Enable route flap damping.\n '
if hasattr(v, '_utype'):
v = v._utype(v)
try:
t = YANGDynClass(v, base=YANGBool, default=YANGBool('false'), is_leaf=True, yang_name='route-flap-damping', parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/network-instance', defining_module='openconfig-network-instance', yang_type='boolean', is_config=True)
except (TypeError, ValueError):
raise ValueError({'error-string': 'route_flap_damping must be of a type compatible with boolean', 'defined-type': 'boolean', 'generated-type': 'YANGDynClass(base=YANGBool, default=YANGBool("false"), is_leaf=True, yang_name="route-flap-damping", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace=\'http://openconfig.net/yang/network-instance\', defining_module=\'openconfig-network-instance\', yang_type=\'boolean\', is_config=True)'})
self.__route_flap_damping = t
if hasattr(self, '_set'):
self._set()<|docstring|>Setter method for route_flap_damping, mapped from YANG variable /network_instances/network_instance/protocols/protocol/bgp/peer_groups/peer_group/config/route_flap_damping (boolean)
If this variable is read-only (config: false) in the
source YANG file, then _set_route_flap_damping is considered as a private
method. Backends looking to populate this variable should
do so via calling thisObj._set_route_flap_damping() directly.
YANG Description: Enable route flap damping.<|endoftext|> |
dbf6c96a4637c9a3755853e0476965a2fbcbd3170a369fd82d01f779aaaac676 | def _get_send_community(self):
'\n Getter method for send_community, mapped from YANG variable /network_instances/network_instance/protocols/protocol/bgp/peer_groups/peer_group/config/send_community (oc-bgp-types:community-type)\n\n YANG Description: Specify which types of community should be sent to the\nneighbor or group. The default is to not send the\ncommunity attribute\n '
return self.__send_community | Getter method for send_community, mapped from YANG variable /network_instances/network_instance/protocols/protocol/bgp/peer_groups/peer_group/config/send_community (oc-bgp-types:community-type)
YANG Description: Specify which types of community should be sent to the
neighbor or group. The default is to not send the
community attribute | napalm_yang/models/openconfig/network_instances/network_instance/protocols/protocol/bgp/peer_groups/peer_group/config/__init__.py | _get_send_community | ckishimo/napalm-yang | 64 | python | def _get_send_community(self):
'\n Getter method for send_community, mapped from YANG variable /network_instances/network_instance/protocols/protocol/bgp/peer_groups/peer_group/config/send_community (oc-bgp-types:community-type)\n\n YANG Description: Specify which types of community should be sent to the\nneighbor or group. The default is to not send the\ncommunity attribute\n '
return self.__send_community | def _get_send_community(self):
'\n Getter method for send_community, mapped from YANG variable /network_instances/network_instance/protocols/protocol/bgp/peer_groups/peer_group/config/send_community (oc-bgp-types:community-type)\n\n YANG Description: Specify which types of community should be sent to the\nneighbor or group. The default is to not send the\ncommunity attribute\n '
return self.__send_community<|docstring|>Getter method for send_community, mapped from YANG variable /network_instances/network_instance/protocols/protocol/bgp/peer_groups/peer_group/config/send_community (oc-bgp-types:community-type)
YANG Description: Specify which types of community should be sent to the
neighbor or group. The default is to not send the
community attribute<|endoftext|> |
fd1fed6de97115fdb7eea2724329f40d9875d2a2be74ac26219afb0d188207dc | def _set_send_community(self, v, load=False):
'\n Setter method for send_community, mapped from YANG variable /network_instances/network_instance/protocols/protocol/bgp/peer_groups/peer_group/config/send_community (oc-bgp-types:community-type)\n If this variable is read-only (config: false) in the\n source YANG file, then _set_send_community is considered as a private\n method. Backends looking to populate this variable should\n do so via calling thisObj._set_send_community() directly.\n\n YANG Description: Specify which types of community should be sent to the\nneighbor or group. The default is to not send the\ncommunity attribute\n '
if hasattr(v, '_utype'):
v = v._utype(v)
try:
t = YANGDynClass(v, base=RestrictedClassType(base_type=six.text_type, restriction_type='dict_key', restriction_arg={'STANDARD': {}, 'EXTENDED': {}, 'BOTH': {}, 'NONE': {}}), default=six.text_type('NONE'), is_leaf=True, yang_name='send-community', parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/network-instance', defining_module='openconfig-network-instance', yang_type='oc-bgp-types:community-type', is_config=True)
except (TypeError, ValueError):
raise ValueError({'error-string': 'send_community must be of a type compatible with oc-bgp-types:community-type', 'defined-type': 'oc-bgp-types:community-type', 'generated-type': 'YANGDynClass(base=RestrictedClassType(base_type=six.text_type, restriction_type="dict_key", restriction_arg={\'STANDARD\': {}, \'EXTENDED\': {}, \'BOTH\': {}, \'NONE\': {}},), default=six.text_type("NONE"), is_leaf=True, yang_name="send-community", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace=\'http://openconfig.net/yang/network-instance\', defining_module=\'openconfig-network-instance\', yang_type=\'oc-bgp-types:community-type\', is_config=True)'})
self.__send_community = t
if hasattr(self, '_set'):
self._set() | Setter method for send_community, mapped from YANG variable /network_instances/network_instance/protocols/protocol/bgp/peer_groups/peer_group/config/send_community (oc-bgp-types:community-type)
If this variable is read-only (config: false) in the
source YANG file, then _set_send_community is considered as a private
method. Backends looking to populate this variable should
do so via calling thisObj._set_send_community() directly.
YANG Description: Specify which types of community should be sent to the
neighbor or group. The default is to not send the
community attribute | napalm_yang/models/openconfig/network_instances/network_instance/protocols/protocol/bgp/peer_groups/peer_group/config/__init__.py | _set_send_community | ckishimo/napalm-yang | 64 | python | def _set_send_community(self, v, load=False):
'\n Setter method for send_community, mapped from YANG variable /network_instances/network_instance/protocols/protocol/bgp/peer_groups/peer_group/config/send_community (oc-bgp-types:community-type)\n If this variable is read-only (config: false) in the\n source YANG file, then _set_send_community is considered as a private\n method. Backends looking to populate this variable should\n do so via calling thisObj._set_send_community() directly.\n\n YANG Description: Specify which types of community should be sent to the\nneighbor or group. The default is to not send the\ncommunity attribute\n '
if hasattr(v, '_utype'):
v = v._utype(v)
try:
t = YANGDynClass(v, base=RestrictedClassType(base_type=six.text_type, restriction_type='dict_key', restriction_arg={'STANDARD': {}, 'EXTENDED': {}, 'BOTH': {}, 'NONE': {}}), default=six.text_type('NONE'), is_leaf=True, yang_name='send-community', parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/network-instance', defining_module='openconfig-network-instance', yang_type='oc-bgp-types:community-type', is_config=True)
except (TypeError, ValueError):
raise ValueError({'error-string': 'send_community must be of a type compatible with oc-bgp-types:community-type', 'defined-type': 'oc-bgp-types:community-type', 'generated-type': 'YANGDynClass(base=RestrictedClassType(base_type=six.text_type, restriction_type="dict_key", restriction_arg={\'STANDARD\': {}, \'EXTENDED\': {}, \'BOTH\': {}, \'NONE\': {}},), default=six.text_type("NONE"), is_leaf=True, yang_name="send-community", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace=\'http://openconfig.net/yang/network-instance\', defining_module=\'openconfig-network-instance\', yang_type=\'oc-bgp-types:community-type\', is_config=True)'})
self.__send_community = t
if hasattr(self, '_set'):
self._set() | def _set_send_community(self, v, load=False):
'\n Setter method for send_community, mapped from YANG variable /network_instances/network_instance/protocols/protocol/bgp/peer_groups/peer_group/config/send_community (oc-bgp-types:community-type)\n If this variable is read-only (config: false) in the\n source YANG file, then _set_send_community is considered as a private\n method. Backends looking to populate this variable should\n do so via calling thisObj._set_send_community() directly.\n\n YANG Description: Specify which types of community should be sent to the\nneighbor or group. The default is to not send the\ncommunity attribute\n '
if hasattr(v, '_utype'):
v = v._utype(v)
try:
t = YANGDynClass(v, base=RestrictedClassType(base_type=six.text_type, restriction_type='dict_key', restriction_arg={'STANDARD': {}, 'EXTENDED': {}, 'BOTH': {}, 'NONE': {}}), default=six.text_type('NONE'), is_leaf=True, yang_name='send-community', parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/network-instance', defining_module='openconfig-network-instance', yang_type='oc-bgp-types:community-type', is_config=True)
except (TypeError, ValueError):
raise ValueError({'error-string': 'send_community must be of a type compatible with oc-bgp-types:community-type', 'defined-type': 'oc-bgp-types:community-type', 'generated-type': 'YANGDynClass(base=RestrictedClassType(base_type=six.text_type, restriction_type="dict_key", restriction_arg={\'STANDARD\': {}, \'EXTENDED\': {}, \'BOTH\': {}, \'NONE\': {}},), default=six.text_type("NONE"), is_leaf=True, yang_name="send-community", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace=\'http://openconfig.net/yang/network-instance\', defining_module=\'openconfig-network-instance\', yang_type=\'oc-bgp-types:community-type\', is_config=True)'})
self.__send_community = t
if hasattr(self, '_set'):
self._set()<|docstring|>Setter method for send_community, mapped from YANG variable /network_instances/network_instance/protocols/protocol/bgp/peer_groups/peer_group/config/send_community (oc-bgp-types:community-type)
If this variable is read-only (config: false) in the
source YANG file, then _set_send_community is considered as a private
method. Backends looking to populate this variable should
do so via calling thisObj._set_send_community() directly.
YANG Description: Specify which types of community should be sent to the
neighbor or group. The default is to not send the
community attribute<|endoftext|> |
43dda6c2cbd15f2655f3e5ed76d3a53219eefffe845436a82a6e875c7513c00f | def _get_description(self):
'\n Getter method for description, mapped from YANG variable /network_instances/network_instance/protocols/protocol/bgp/peer_groups/peer_group/config/description (string)\n\n YANG Description: An optional textual description (intended primarily for use\nwith a peer or group\n '
return self.__description | Getter method for description, mapped from YANG variable /network_instances/network_instance/protocols/protocol/bgp/peer_groups/peer_group/config/description (string)
YANG Description: An optional textual description (intended primarily for use
with a peer or group | napalm_yang/models/openconfig/network_instances/network_instance/protocols/protocol/bgp/peer_groups/peer_group/config/__init__.py | _get_description | ckishimo/napalm-yang | 64 | python | def _get_description(self):
'\n Getter method for description, mapped from YANG variable /network_instances/network_instance/protocols/protocol/bgp/peer_groups/peer_group/config/description (string)\n\n YANG Description: An optional textual description (intended primarily for use\nwith a peer or group\n '
return self.__description | def _get_description(self):
'\n Getter method for description, mapped from YANG variable /network_instances/network_instance/protocols/protocol/bgp/peer_groups/peer_group/config/description (string)\n\n YANG Description: An optional textual description (intended primarily for use\nwith a peer or group\n '
return self.__description<|docstring|>Getter method for description, mapped from YANG variable /network_instances/network_instance/protocols/protocol/bgp/peer_groups/peer_group/config/description (string)
YANG Description: An optional textual description (intended primarily for use
with a peer or group<|endoftext|> |
4a27a8cc277b015984484b497f2da4d64a64059335273d5d44f0c6aaea9cf7ea | def _set_description(self, v, load=False):
'\n Setter method for description, mapped from YANG variable /network_instances/network_instance/protocols/protocol/bgp/peer_groups/peer_group/config/description (string)\n If this variable is read-only (config: false) in the\n source YANG file, then _set_description is considered as a private\n method. Backends looking to populate this variable should\n do so via calling thisObj._set_description() directly.\n\n YANG Description: An optional textual description (intended primarily for use\nwith a peer or group\n '
if hasattr(v, '_utype'):
v = v._utype(v)
try:
t = YANGDynClass(v, base=six.text_type, is_leaf=True, yang_name='description', parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/network-instance', defining_module='openconfig-network-instance', yang_type='string', is_config=True)
except (TypeError, ValueError):
raise ValueError({'error-string': 'description must be of a type compatible with string', 'defined-type': 'string', 'generated-type': 'YANGDynClass(base=six.text_type, is_leaf=True, yang_name="description", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace=\'http://openconfig.net/yang/network-instance\', defining_module=\'openconfig-network-instance\', yang_type=\'string\', is_config=True)'})
self.__description = t
if hasattr(self, '_set'):
self._set() | Setter method for description, mapped from YANG variable /network_instances/network_instance/protocols/protocol/bgp/peer_groups/peer_group/config/description (string)
If this variable is read-only (config: false) in the
source YANG file, then _set_description is considered as a private
method. Backends looking to populate this variable should
do so via calling thisObj._set_description() directly.
YANG Description: An optional textual description (intended primarily for use
with a peer or group | napalm_yang/models/openconfig/network_instances/network_instance/protocols/protocol/bgp/peer_groups/peer_group/config/__init__.py | _set_description | ckishimo/napalm-yang | 64 | python | def _set_description(self, v, load=False):
'\n Setter method for description, mapped from YANG variable /network_instances/network_instance/protocols/protocol/bgp/peer_groups/peer_group/config/description (string)\n If this variable is read-only (config: false) in the\n source YANG file, then _set_description is considered as a private\n method. Backends looking to populate this variable should\n do so via calling thisObj._set_description() directly.\n\n YANG Description: An optional textual description (intended primarily for use\nwith a peer or group\n '
if hasattr(v, '_utype'):
v = v._utype(v)
try:
t = YANGDynClass(v, base=six.text_type, is_leaf=True, yang_name='description', parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/network-instance', defining_module='openconfig-network-instance', yang_type='string', is_config=True)
except (TypeError, ValueError):
raise ValueError({'error-string': 'description must be of a type compatible with string', 'defined-type': 'string', 'generated-type': 'YANGDynClass(base=six.text_type, is_leaf=True, yang_name="description", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace=\'http://openconfig.net/yang/network-instance\', defining_module=\'openconfig-network-instance\', yang_type=\'string\', is_config=True)'})
self.__description = t
if hasattr(self, '_set'):
self._set() | def _set_description(self, v, load=False):
'\n Setter method for description, mapped from YANG variable /network_instances/network_instance/protocols/protocol/bgp/peer_groups/peer_group/config/description (string)\n If this variable is read-only (config: false) in the\n source YANG file, then _set_description is considered as a private\n method. Backends looking to populate this variable should\n do so via calling thisObj._set_description() directly.\n\n YANG Description: An optional textual description (intended primarily for use\nwith a peer or group\n '
if hasattr(v, '_utype'):
v = v._utype(v)
try:
t = YANGDynClass(v, base=six.text_type, is_leaf=True, yang_name='description', parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/network-instance', defining_module='openconfig-network-instance', yang_type='string', is_config=True)
except (TypeError, ValueError):
raise ValueError({'error-string': 'description must be of a type compatible with string', 'defined-type': 'string', 'generated-type': 'YANGDynClass(base=six.text_type, is_leaf=True, yang_name="description", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace=\'http://openconfig.net/yang/network-instance\', defining_module=\'openconfig-network-instance\', yang_type=\'string\', is_config=True)'})
self.__description = t
if hasattr(self, '_set'):
self._set()<|docstring|>Setter method for description, mapped from YANG variable /network_instances/network_instance/protocols/protocol/bgp/peer_groups/peer_group/config/description (string)
If this variable is read-only (config: false) in the
source YANG file, then _set_description is considered as a private
method. Backends looking to populate this variable should
do so via calling thisObj._set_description() directly.
YANG Description: An optional textual description (intended primarily for use
with a peer or group<|endoftext|> |
3282fbcbb4094a93a6530cacf182e1b40d605118e6633146ada856ca2865091d | def _get_peer_group_name(self):
'\n Getter method for peer_group_name, mapped from YANG variable /network_instances/network_instance/protocols/protocol/bgp/peer_groups/peer_group/config/peer_group_name (string)\n\n YANG Description: Name of the BGP peer-group\n '
return self.__peer_group_name | Getter method for peer_group_name, mapped from YANG variable /network_instances/network_instance/protocols/protocol/bgp/peer_groups/peer_group/config/peer_group_name (string)
YANG Description: Name of the BGP peer-group | napalm_yang/models/openconfig/network_instances/network_instance/protocols/protocol/bgp/peer_groups/peer_group/config/__init__.py | _get_peer_group_name | ckishimo/napalm-yang | 64 | python | def _get_peer_group_name(self):
'\n Getter method for peer_group_name, mapped from YANG variable /network_instances/network_instance/protocols/protocol/bgp/peer_groups/peer_group/config/peer_group_name (string)\n\n YANG Description: Name of the BGP peer-group\n '
return self.__peer_group_name | def _get_peer_group_name(self):
'\n Getter method for peer_group_name, mapped from YANG variable /network_instances/network_instance/protocols/protocol/bgp/peer_groups/peer_group/config/peer_group_name (string)\n\n YANG Description: Name of the BGP peer-group\n '
return self.__peer_group_name<|docstring|>Getter method for peer_group_name, mapped from YANG variable /network_instances/network_instance/protocols/protocol/bgp/peer_groups/peer_group/config/peer_group_name (string)
YANG Description: Name of the BGP peer-group<|endoftext|> |
52c992a6ed733de3c78b0abd2c5877209877fa20131714d7f2152550355d628a | def _set_peer_group_name(self, v, load=False):
'\n Setter method for peer_group_name, mapped from YANG variable /network_instances/network_instance/protocols/protocol/bgp/peer_groups/peer_group/config/peer_group_name (string)\n If this variable is read-only (config: false) in the\n source YANG file, then _set_peer_group_name is considered as a private\n method. Backends looking to populate this variable should\n do so via calling thisObj._set_peer_group_name() directly.\n\n YANG Description: Name of the BGP peer-group\n '
if hasattr(v, '_utype'):
v = v._utype(v)
try:
t = YANGDynClass(v, base=six.text_type, is_leaf=True, yang_name='peer-group-name', parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/network-instance', defining_module='openconfig-network-instance', yang_type='string', is_config=True)
except (TypeError, ValueError):
raise ValueError({'error-string': 'peer_group_name must be of a type compatible with string', 'defined-type': 'string', 'generated-type': 'YANGDynClass(base=six.text_type, is_leaf=True, yang_name="peer-group-name", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace=\'http://openconfig.net/yang/network-instance\', defining_module=\'openconfig-network-instance\', yang_type=\'string\', is_config=True)'})
self.__peer_group_name = t
if hasattr(self, '_set'):
self._set() | Setter method for peer_group_name, mapped from YANG variable /network_instances/network_instance/protocols/protocol/bgp/peer_groups/peer_group/config/peer_group_name (string)
If this variable is read-only (config: false) in the
source YANG file, then _set_peer_group_name is considered as a private
method. Backends looking to populate this variable should
do so via calling thisObj._set_peer_group_name() directly.
YANG Description: Name of the BGP peer-group | napalm_yang/models/openconfig/network_instances/network_instance/protocols/protocol/bgp/peer_groups/peer_group/config/__init__.py | _set_peer_group_name | ckishimo/napalm-yang | 64 | python | def _set_peer_group_name(self, v, load=False):
'\n Setter method for peer_group_name, mapped from YANG variable /network_instances/network_instance/protocols/protocol/bgp/peer_groups/peer_group/config/peer_group_name (string)\n If this variable is read-only (config: false) in the\n source YANG file, then _set_peer_group_name is considered as a private\n method. Backends looking to populate this variable should\n do so via calling thisObj._set_peer_group_name() directly.\n\n YANG Description: Name of the BGP peer-group\n '
if hasattr(v, '_utype'):
v = v._utype(v)
try:
t = YANGDynClass(v, base=six.text_type, is_leaf=True, yang_name='peer-group-name', parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/network-instance', defining_module='openconfig-network-instance', yang_type='string', is_config=True)
except (TypeError, ValueError):
raise ValueError({'error-string': 'peer_group_name must be of a type compatible with string', 'defined-type': 'string', 'generated-type': 'YANGDynClass(base=six.text_type, is_leaf=True, yang_name="peer-group-name", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace=\'http://openconfig.net/yang/network-instance\', defining_module=\'openconfig-network-instance\', yang_type=\'string\', is_config=True)'})
self.__peer_group_name = t
if hasattr(self, '_set'):
self._set() | def _set_peer_group_name(self, v, load=False):
'\n Setter method for peer_group_name, mapped from YANG variable /network_instances/network_instance/protocols/protocol/bgp/peer_groups/peer_group/config/peer_group_name (string)\n If this variable is read-only (config: false) in the\n source YANG file, then _set_peer_group_name is considered as a private\n method. Backends looking to populate this variable should\n do so via calling thisObj._set_peer_group_name() directly.\n\n YANG Description: Name of the BGP peer-group\n '
if hasattr(v, '_utype'):
v = v._utype(v)
try:
t = YANGDynClass(v, base=six.text_type, is_leaf=True, yang_name='peer-group-name', parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/network-instance', defining_module='openconfig-network-instance', yang_type='string', is_config=True)
except (TypeError, ValueError):
raise ValueError({'error-string': 'peer_group_name must be of a type compatible with string', 'defined-type': 'string', 'generated-type': 'YANGDynClass(base=six.text_type, is_leaf=True, yang_name="peer-group-name", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace=\'http://openconfig.net/yang/network-instance\', defining_module=\'openconfig-network-instance\', yang_type=\'string\', is_config=True)'})
self.__peer_group_name = t
if hasattr(self, '_set'):
self._set()<|docstring|>Setter method for peer_group_name, mapped from YANG variable /network_instances/network_instance/protocols/protocol/bgp/peer_groups/peer_group/config/peer_group_name (string)
If this variable is read-only (config: false) in the
source YANG file, then _set_peer_group_name is considered as a private
method. Backends looking to populate this variable should
do so via calling thisObj._set_peer_group_name() directly.
YANG Description: Name of the BGP peer-group<|endoftext|> |
a8175920b5e320271df184e8836b761b9b30e00a65c48f60e6a3ca5fc484ddc2 | def _get_peer_as(self):
'\n Getter method for peer_as, mapped from YANG variable /network_instances/network_instance/protocols/protocol/bgp/peer_groups/peer_group/config/peer_as (oc-inet:as-number)\n\n YANG Description: AS number of the peer.\n '
return self.__peer_as | Getter method for peer_as, mapped from YANG variable /network_instances/network_instance/protocols/protocol/bgp/peer_groups/peer_group/config/peer_as (oc-inet:as-number)
YANG Description: AS number of the peer. | napalm_yang/models/openconfig/network_instances/network_instance/protocols/protocol/bgp/peer_groups/peer_group/config/__init__.py | _get_peer_as | ckishimo/napalm-yang | 64 | python | def _get_peer_as(self):
'\n Getter method for peer_as, mapped from YANG variable /network_instances/network_instance/protocols/protocol/bgp/peer_groups/peer_group/config/peer_as (oc-inet:as-number)\n\n YANG Description: AS number of the peer.\n '
return self.__peer_as | def _get_peer_as(self):
'\n Getter method for peer_as, mapped from YANG variable /network_instances/network_instance/protocols/protocol/bgp/peer_groups/peer_group/config/peer_as (oc-inet:as-number)\n\n YANG Description: AS number of the peer.\n '
return self.__peer_as<|docstring|>Getter method for peer_as, mapped from YANG variable /network_instances/network_instance/protocols/protocol/bgp/peer_groups/peer_group/config/peer_as (oc-inet:as-number)
YANG Description: AS number of the peer.<|endoftext|> |
4564466645b4f2db428df2ba4b42183157732fa900f5baaa9733be57926a119a | def _set_peer_as(self, v, load=False):
'\n Setter method for peer_as, mapped from YANG variable /network_instances/network_instance/protocols/protocol/bgp/peer_groups/peer_group/config/peer_as (oc-inet:as-number)\n If this variable is read-only (config: false) in the\n source YANG file, then _set_peer_as is considered as a private\n method. Backends looking to populate this variable should\n do so via calling thisObj._set_peer_as() directly.\n\n YANG Description: AS number of the peer.\n '
if hasattr(v, '_utype'):
v = v._utype(v)
try:
t = YANGDynClass(v, base=RestrictedClassType(base_type=long, restriction_dict={'range': ['0..4294967295']}, int_size=32), is_leaf=True, yang_name='peer-as', parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/network-instance', defining_module='openconfig-network-instance', yang_type='oc-inet:as-number', is_config=True)
except (TypeError, ValueError):
raise ValueError({'error-string': 'peer_as must be of a type compatible with oc-inet:as-number', 'defined-type': 'oc-inet:as-number', 'generated-type': 'YANGDynClass(base=RestrictedClassType(base_type=long, restriction_dict={\'range\': [\'0..4294967295\']}, int_size=32), is_leaf=True, yang_name="peer-as", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace=\'http://openconfig.net/yang/network-instance\', defining_module=\'openconfig-network-instance\', yang_type=\'oc-inet:as-number\', is_config=True)'})
self.__peer_as = t
if hasattr(self, '_set'):
self._set() | Setter method for peer_as, mapped from YANG variable /network_instances/network_instance/protocols/protocol/bgp/peer_groups/peer_group/config/peer_as (oc-inet:as-number)
If this variable is read-only (config: false) in the
source YANG file, then _set_peer_as is considered as a private
method. Backends looking to populate this variable should
do so via calling thisObj._set_peer_as() directly.
YANG Description: AS number of the peer. | napalm_yang/models/openconfig/network_instances/network_instance/protocols/protocol/bgp/peer_groups/peer_group/config/__init__.py | _set_peer_as | ckishimo/napalm-yang | 64 | python | def _set_peer_as(self, v, load=False):
'\n Setter method for peer_as, mapped from YANG variable /network_instances/network_instance/protocols/protocol/bgp/peer_groups/peer_group/config/peer_as (oc-inet:as-number)\n If this variable is read-only (config: false) in the\n source YANG file, then _set_peer_as is considered as a private\n method. Backends looking to populate this variable should\n do so via calling thisObj._set_peer_as() directly.\n\n YANG Description: AS number of the peer.\n '
if hasattr(v, '_utype'):
v = v._utype(v)
try:
t = YANGDynClass(v, base=RestrictedClassType(base_type=long, restriction_dict={'range': ['0..4294967295']}, int_size=32), is_leaf=True, yang_name='peer-as', parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/network-instance', defining_module='openconfig-network-instance', yang_type='oc-inet:as-number', is_config=True)
except (TypeError, ValueError):
raise ValueError({'error-string': 'peer_as must be of a type compatible with oc-inet:as-number', 'defined-type': 'oc-inet:as-number', 'generated-type': 'YANGDynClass(base=RestrictedClassType(base_type=long, restriction_dict={\'range\': [\'0..4294967295\']}, int_size=32), is_leaf=True, yang_name="peer-as", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace=\'http://openconfig.net/yang/network-instance\', defining_module=\'openconfig-network-instance\', yang_type=\'oc-inet:as-number\', is_config=True)'})
self.__peer_as = t
if hasattr(self, '_set'):
self._set() | def _set_peer_as(self, v, load=False):
'\n Setter method for peer_as, mapped from YANG variable /network_instances/network_instance/protocols/protocol/bgp/peer_groups/peer_group/config/peer_as (oc-inet:as-number)\n If this variable is read-only (config: false) in the\n source YANG file, then _set_peer_as is considered as a private\n method. Backends looking to populate this variable should\n do so via calling thisObj._set_peer_as() directly.\n\n YANG Description: AS number of the peer.\n '
if hasattr(v, '_utype'):
v = v._utype(v)
try:
t = YANGDynClass(v, base=RestrictedClassType(base_type=long, restriction_dict={'range': ['0..4294967295']}, int_size=32), is_leaf=True, yang_name='peer-as', parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/network-instance', defining_module='openconfig-network-instance', yang_type='oc-inet:as-number', is_config=True)
except (TypeError, ValueError):
raise ValueError({'error-string': 'peer_as must be of a type compatible with oc-inet:as-number', 'defined-type': 'oc-inet:as-number', 'generated-type': 'YANGDynClass(base=RestrictedClassType(base_type=long, restriction_dict={\'range\': [\'0..4294967295\']}, int_size=32), is_leaf=True, yang_name="peer-as", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace=\'http://openconfig.net/yang/network-instance\', defining_module=\'openconfig-network-instance\', yang_type=\'oc-inet:as-number\', is_config=True)'})
self.__peer_as = t
if hasattr(self, '_set'):
self._set()<|docstring|>Setter method for peer_as, mapped from YANG variable /network_instances/network_instance/protocols/protocol/bgp/peer_groups/peer_group/config/peer_as (oc-inet:as-number)
If this variable is read-only (config: false) in the
source YANG file, then _set_peer_as is considered as a private
method. Backends looking to populate this variable should
do so via calling thisObj._set_peer_as() directly.
YANG Description: AS number of the peer.<|endoftext|> |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.