code
stringlengths
1
18.2k
of the key file that should be in PEM format and contains # the public portion of the RSA key. with open(filepath, 'rb') as file_object: rsa_pubkey_pem = file_object.read().decode('utf-8') # Convert 'rsa_pubkey_pem' to 'securesystemslib.formats.RSAKEY_SCHEMA' format. try: rsakey_dict = securesystemslib.keys.import_rsak...
def generate_and_write_ed25519_keypair(filepath=None, password=None): """ <Purpose> Generate an Ed25519 keypair, where the encrypted key (using 'password' as the passphrase) is saved to <'filepath'>. The public key portion of the generated Ed25519 key is saved to <'filepath'>.pub. If the filepath is not given, the KEYI...
'cryptography's approach: "Encrypt using the best available encryption for a given key's backend. This is a curated encryption choice and the algorithm may change over time." <Arguments> filepath: The public and private key files are saved to <filepath>.pub and <filepath>, respectively. If the filepath is not given, th...
is the generated key's KEYID. password: The password, or passphrase, to encrypt the private portion of the generated Ed25519 key. A symmetric encryption key is derived from 'password', so it is not directly used. <Exceptions> securesystemslib.exceptions.FormatError, if the arguments are improperly formatted. securesyst...
""" # Generate a new Ed25519 key object. ed25519_key = securesystemslib.keys.generate_ed25519_key() if not filepath: filepath = os.path.join(os.getcwd(), ed25519_key['keyid']) else: logger.debug('The filepath has been specified. Not using the key\'s' ' KEYID as the default filepath.') # Does 'filepath' have the correct...
Raise 'securesystemslib.exceptions.FormatError' if there is a mismatch. securesystemslib.formats.PATH_SCHEMA.check_match(filepath) # If the caller does not provide a password argument, prompt for one. if password is None: # pragma: no cover # It is safe to specify the full path of 'filepath' in the prompt and not # wor...
full path in exceptions # and log files. password = get_password('Enter a password for the Ed25519' ' key (' + Fore.RED + filepath + Fore.RESET + '): ', confirm=True) else: logger.debug('The password has been specified. Not prompting for one.') # Does 'password' have the correct format? securesystemslib.formats.PASSWOR...
directories, if necessary). securesystemslib.util.ensure_parent_dir(filepath) # Create a temporary file, write the contents of the public key, and move # to final destination. file_object = securesystemslib.util.TempFile() # Generate the ed25519 public key file contents in metadata format (i.e., # does not include the ...
public key (i.e., 'public', which is in PEM format) to # '<filepath>.pub'. (1) Create a temporary file, (2) write the contents of # the public key, and (3) move to final destination. # The temporary file is closed after the final move. file_object.move(filepath + '.pub') # Write the encrypted key string, conformant to ...
key if 'password' is set. if len(password): ed25519_key = securesystemslib.keys.encrypt_key(ed25519_key, password) else: logger.debug('An empty password was given. ' 'Not encrypting the private key.') ed25519_key = json.dumps(ed25519_key) # Raise 'securesystemslib.exceptions.CryptoError' if 'ed25519_key' cannot be # en...
def import_ed25519_publickey_from_file(filepath): """ <Purpose> Load the ED25519 public key object (conformant to 'securesystemslib.formats.KEY_SCHEMA') stored in 'filepath'. Return 'filepath' in securesystemslib.formats.ED25519KEY_SCHEMA format. If the key object in 'filepath' contains a private key, it is discarded. ...
saved. <Returns> An ED25519 key object conformant to 'securesystemslib.formats.ED25519KEY_SCHEMA'. """ # Does 'filepath' have the correct format? # Ensure the arguments have the appropriate number of objects and object # types, and that all dict keys are properly named. # Raise 'securesystemslib.exceptions.FormatError'...
object in securesystemslib.formats.ED25519KEY_SCHEMA' format that # also includes the keyid. ed25519_key_metadata = securesystemslib.util.load_json_file(filepath) ed25519_key, junk = \ securesystemslib.keys.format_metadata_to_key(ed25519_key_metadata) # Raise an exception if an unexpected key type is imported. Redundan...
def import_ed25519_privatekey_from_file(filepath, password=None, prompt=False): """ <Purpose> Import the encrypted ed25519 key file in 'filepath', decrypt it, and return the key object in 'securesystemslib.formats.ED25519KEY_SCHEMA' format. The private key (may also contain the public part) is encrypted with AES 256 an...
to import the private key (i.e., the encrypted key file 'filepath' must be decrypted before the ed25519 key object can be returned. prompt: If True the user is prompted for a passphrase to decrypt 'filepath'. Default is False. <Exceptions> securesystemslib.exceptions.FormatError, if the arguments are improperly formatt...
decrypted. <Side Effects> 'password' is used to decrypt the 'filepath' key file. <Returns> An ed25519 key object of the form: 'securesystemslib.formats.ED25519KEY_SCHEMA'. """ # Does 'filepath' have the correct format? # Ensure the arguments have the appropriate number of objects and object # types, and that all dict k...
raise ValueError("Passing 'password' and 'prompt' True is not allowed.") # If 'password' was passed check format and that it is not empty. if password is not None: securesystemslib.formats.PASSWORD_SCHEMA.check_match(password) # TODO: PASSWORD_SCHEMA should be securesystemslib.schema.AnyString(min=1) if not len(passwor...
improve usability). # It is safe to specify the full path of 'filepath' in the prompt and not # worry about leaking sensitive information about the key's location. # However, care should be taken when including the full path in exceptions # and log files. # NOTE: A user who gets prompted for a password, can only signal...
encrypted by entering no password in the prompt, as opposed # to a programmer who can call the function with or without a 'password'. # Hence, we treat an empty password here, as if no 'password' was passed. password = get_password('Enter a password for an encrypted RSA' ' file \'' + Fore.RED + filepath + Fore.RESET + ...
an empty string for the password, explicitly set the # password to None, because some functions may expect this later. if len(password) == 0: # pragma: no cover password = None # Finally, regardless of password, try decrypting the key, if necessary. # Otherwise, load it straight from the disk. with open(filepath, 'rb')...
def generate_and_write_ecdsa_keypair(filepath=None, password=None): """ <Purpose> Generate an ECDSA keypair, where the encrypted key (using 'password' as the passphrase) is saved to <'filepath'>. The public key portion of the generated ECDSA key is saved to <'filepath'>.pub. If the filepath is not given, the KEYID is u...
private key is encrypted according to 'cryptography's approach: "Encrypt using the best available encryption for a given key's backend. This is a curated encryption choice and the algorithm may change over time." <Arguments> filepath: The public and private key files are saved to <filepath>.pub and <filepath>, respecti...
directory as <KEYID>.pub and <KEYID>. KEYID is the generated key's KEYID. password: The password, or passphrase, to encrypt the private portion of the generated ECDSA key. A symmetric encryption key is derived from 'password', so it is not directly used. <Exceptions> securesystemslib.exceptions.FormatError, if the argu...
The 'filepath' of the written key. """ # Generate a new ECDSA key object. The 'cryptography' library is currently # supported and performs the actual cryptographic operations. ecdsa_key = securesystemslib.keys.generate_ecdsa_key() if not filepath: filepath = os.path.join(os.getcwd(), ecdsa_key['keyid']) else: logger.de...
there is a mismatch. securesystemslib.formats.PATH_SCHEMA.check_match(filepath) # If the caller does not provide a password argument, prompt for one. if password is None: # pragma: no cover # It is safe to specify the full path of 'filepath' in the prompt and not # worry about leaking sensitive information about the ke...
exceptions # and log files. password = get_password('Enter a password for the ECDSA' ' key (' + Fore.RED + filepath + Fore.RESET + '): ', confirm=True) else: logger.debug('The password has been specified. Not prompting for one') # Does 'password' have the correct format? securesystemslib.formats.PASSWORD_SCHEMA.check_m...
securesystemslib.util.ensure_parent_dir(filepath) # Create a temporary file, write the contents of the public key, and move # to final destination. file_object = securesystemslib.util.TempFile() # Generate the ECDSA public key file contents in metadata format (i.e., does # not include the keyid portion). keytype = ecds...
'public', which is in PEM format) to # '<filepath>.pub'. (1) Create a temporary file, (2) write the contents of # the public key, and (3) move to final destination. file_object.move(filepath + '.pub') # Write the encrypted key string, conformant to # 'securesystemslib.formats.ENCRYPTEDKEY_SCHEMA', to '<filepath>'. file...
def import_ecdsa_publickey_from_file(filepath): """ <Purpose> Load the ECDSA public key object (conformant to 'securesystemslib.formats.KEY_SCHEMA') stored in 'filepath'. Return 'filepath' in securesystemslib.formats.ECDSAKEY_SCHEMA format. If the key object in 'filepath' contains a private key, it is discarded. <Argum...
saved. <Returns> An ECDSA key object conformant to 'securesystemslib.formats.ECDSAKEY_SCHEMA'. """ # Does 'filepath' have the correct format? # Ensure the arguments have the appropriate number of objects and object # types, and that all dict keys are properly named. # Raise 'securesystemslib.exceptions.FormatError' if ...
object in securesystemslib.formats.ECDSAKEY_SCHEMA' format that # also includes the keyid. ecdsa_key_metadata = securesystemslib.util.load_json_file(filepath) ecdsa_key, junk = \ securesystemslib.keys.format_metadata_to_key(ecdsa_key_metadata) # Raise an exception if an unexpected key type is imported. Redundant # vali...
def import_ecdsa_privatekey_from_file(filepath, password=None): """ <Purpose> Import the encrypted ECDSA key file in 'filepath', decrypt it, and return the key object in 'securesystemslib.formats.ECDSAKEY_SCHEMA' format. The 'cryptography' library is currently supported and performs the actual cryptographic routine. <A...
the ECDSA key object can be returned. <Exceptions> securesystemslib.exceptions.FormatError, if the arguments are improperly formatted or the imported key object contains an invalid key type (i.e., not 'ecdsa-sha2-nistp256'). securesystemslib.exceptions.CryptoError, if 'filepath' cannot be decrypted. <Side Effects> 'pas...
the arguments have the appropriate number of objects and object # types, and that all dict keys are properly named. # Raise 'securesystemslib.exceptions.FormatError' if there is a mismatch. securesystemslib.formats.PATH_SCHEMA.check_match(filepath) # If the caller does not provide a password argument, prompt for one. #...
None: # pragma: no cover # It is safe to specify the full path of 'filepath' in the prompt and not # worry about leaking sensitive information about the key's location. # However, care should be taken when including the full path in exceptions # and log files. password = get_password('Enter a password for the encrypted...
+ Fore.RESET + '): ', confirm=False) # Does 'password' have the correct format? securesystemslib.formats.PASSWORD_SCHEMA.check_match(password) # Store the encrypted contents of 'filepath' prior to calling the decryption # routine. encrypted_key = None with open(filepath, 'rb') as file_object: encrypted_key = file_objec...
fails. key_object = securesystemslib.keys.decrypt_key(encrypted_key.decode('utf-8'), password) # Raise an exception if an unexpected key type is imported. if key_object['keytype'] != 'ecdsa-sha2-nistp256': message = 'Invalid key type loaded: ' + repr(key_object['keytype']) raise securesystemslib.exceptions.FormatError(...
def wait_until_element_has_focus(self, locator, timeout=None): """Waits until the element identified by `locator` has focus. You might rather want to use `Element Focus Should Be Set` | *Argument* | *Description* | *Example* | | locator | Selenium 2 element locator | id=my_id | | timeout | maximum time to wait before t...
on '%s'" % (locator)) self._wait_until_no_error(timeout, self._check_element_focus_exp, True, locator, timeout)
def wait_until_element_does_not_have_focus(self, locator, timeout=None): """Waits until the element identified by `locator` doesn't have focus. You might rather want to use `Element Focus Should Not Be Set` | *Argument* | *Description* | *Example* | | locator | Selenium 2 element locator | id=my_id | | timeout | maximu...
until '%s' does not have focus" % (locator)) self._wait_until_no_error(timeout, self._check_element_focus_exp, False, locator, timeout)
def wait_until_element_value_is(self, locator, expected, strip=False, timeout=None): """Waits until the element identified by `locator` value is exactly the expected value. You might want to use `Element Value Should Be` instead. | *Argument* | *Description* | *Example* | | locator | Selenium 2 element locator | id=my_...
it should strip the value of the field before comparison | ${True} / ${False} | | timeout | maximum time to wait before the function throws an element not found error (default=None) | 5s |""" self._info("Waiting for '%s' value to be '%s'" % (locator, expected)) self._wait_until_no_error(timeout, self._check_element_val...
def wait_until_element_value_contains(self, locator, expected, timeout=None): """Waits until the element identified by `locator` contains the expected value. You might want to use `Element Value Should Contain` instead. | *Argument* | *Description* | *Example* | | locator | Selenium 2 element locator | id=my_id | | exp...
element not found error (default=None) | 5s |""" self._info("Waiting for '%s' value to contain '%s'" % (locator, expected)) self._wait_until_no_error(timeout, self._check_element_value_exp, True, locator, expected, False, timeout)
def set_element_focus(self, locator): """Sets focus on the element identified by `locator`. Should be used with elements meant to have focus only, such as text fields. This keywords also waits for the focus to be active by calling the `Wait Until Element Has Focus` keyword. | *Argument* | *Description* | *Example* | | ...
element '%s'" % (locator)) element = self._element_find(locator, True, True) element.send_keys(Keys.NULL) self._wait_until_no_error(None, self._check_element_focus, True, locator)
def clear_input_field(self, locator, method=0): """Clears the text field identified by `locator` The element.clear() method doesn't seem to work properly on all browsers, so this keyword was created to offer alternatives. The `method` argument defines the method it should use in order to clear the target field. 0 = Use...
presses CTRL + A, and then DELETE \n 2 = Repeatedly presses BACKSPACE until the field is empty This keyword, when using a method other than '2' does not validate it successfully cleared the field, you should handle this verification by yourself. When using the method '2', it presses delete until the field's value is em...
locator | Selenium 2 element locator | id=my_id | | method | the clearing method that should be used | no example provided |""" element = self._element_find(locator, True, True) if (int(method) == 0): self._info("Clearing input on element '%s'" % (locator)) element.clear() elif (int(method) == 1): self._info("Clearing ...
(int(method) == 2): self._info("Clearing input on element '%s' by repeatedly pressing BACKSPACE" % (locator)) while (len(element.get_attribute('value')) != 0): element.send_keys(Keys.BACKSPACE) else: element.clear()
def element_text_color_should_be(self, locator, expected): """Verifies the element identified by `locator` has the expected text color (it verifies the CSS attribute color). Color should be in RGBA format. Example of rgba format: rgba(RED, GREEN, BLUE, ALPHA) | *Argument* | *Description* | *Example* | | locator | Selen...
element '%s' has text color '%s'" % (locator, expected)) self._check_element_css_value(locator, 'color', expected)
def element_background_color_should_be(self, locator, expected): """Verifies the element identified by `locator` has the expected background color (it verifies the CSS attribute background-color). Color should be in RGBA format. Example of rgba format: rgba(RED, GREEN, BLUE, ALPHA) | *Argument* | *Description* | *Examp...
element '%s' has background color '%s'" % (locator, expected)) self._check_element_css_value(locator, 'background-color', expected)
def element_width_should_be(self, locator, expected): """Verifies the element identified by `locator` has the expected width. Expected width should be in pixels. | *Argument* | *Description* | *Example* | | locator | Selenium 2 element locator | id=my_id | | expected | expected width | 800 |""" self._info("Verifying el...
def element_height_should_be(self, locator, expected): """Verifies the element identified by `locator` has the expected height. Expected height should be in pixels. | *Argument* | *Description* | *Example* | | locator | Selenium 2 element locator | id=my_id | | expected | expected height | 600 |""" self._info("Verifyin...
def element_value_should_be(self, locator, expected, strip=False): """Verifies the element identified by `locator` has the expected value. | *Argument* | *Description* | *Example* | | locator | Selenium 2 element locator | id=my_id | | expected | expected value | My Name Is Slim Shady | | strip | Boolean, determines wh...
|""" self._info("Verifying element '%s' value is '%s'" % (locator, expected)) element = self._element_find(locator, True, True) value = element.get_attribute('value') if (strip): value = value.strip() if str(value) == expected: return else: raise AssertionError("Element '%s' value was not '%s', it was '%s'" % (locator,...
def element_value_should_not_be(self, locator, value, strip=False): """Verifies the element identified by `locator` is not the specified value. | *Argument* | *Description* | *Example* | | locator | Selenium 2 element locator | id=my_id | | value | value it should not be | My Name Is Slim Shady | | strip | Boolean, det...
| ${True} / ${False} |""" self._info("Verifying element '%s' value is not '%s'" % (locator, value)) element = self._element_find(locator, True, True) elem_value = str(element.get_attribute('value')) if (strip): elem_value = elem_value.strip() if elem_value == value: raise AssertionError("Value was '%s' for element '%s'...
def element_value_should_contain(self, locator, expected): """Verifies the element identified by `locator` contains the expected value. | *Argument* | *Description* | *Example* | | locator | Selenium 2 element locator | id=my_id | | expected | expected value | Slim Shady |""" self._info("Verifying element '%s' value co...
AssertionError("Value '%s' did not appear in element '%s'. It's value was '%s'" % (expected, locator, value))
def element_value_should_not_contain(self, locator, value): """Verifies the element identified by `locator` does not contain the specified value. | *Argument* | *Description* | *Example* | | locator | Selenium 2 element locator | id=my_id | | value | value it should not contain | Slim Shady |""" self._info("Verifying e...
if value in elem_value: raise AssertionError("Value '%s' was found in element '%s' while it shouldn't have" % (value, locator))
def element_focus_should_be_set(self, locator): """Verifies the element identified by `locator` has focus. | *Argument* | *Description* | *Example* | | locator | Selenium 2 element locator | id=my_id |""" self._info("Verifying element '%s' focus is set" % locator) self._check_element_focus(True, locator)
def element_focus_should_not_be_set(self, locator): """Verifies the element identified by `locator` does not have focus. | *Argument* | *Description* | *Example* | | locator | Selenium 2 element locator | id=my_id |""" self._info("Verifying element '%s' focus is not set" % locator) self._check_element_focus(False, loca...
def element_css_attribute_should_be(self, locator, prop, expected): """Verifies the element identified by `locator` has the expected value for the targeted `prop`. | *Argument* | *Description* | *Example* | | locator | Selenium 2 element locator | id=my_id | | prop | targeted css attribute | background-color | | expect...
a value of '%s'" % (locator, prop, expected)) self._check_element_css_value(locator, prop, expected)
def wait_until_page_contains_elements(self, timeout, *locators): """This is a copy of `Wait Until Page Contains Element` but it allows multiple arguments in order to wait for more than one element. | *Argument* | *Description* | *Example* | | timeout | maximum time to wait, if set to ${None} it will use Selenium's defa...
|""" self._wait_until_no_error(timeout, self._wait_for_elements, locators)
def wait_until_page_contains_one_of_these_elements(self, timeout, *locators): """Waits until at least one of the specified elements is found. | *Argument* | *Description* | *Example* | | timeout | maximum time to wait, if set to ${None} it will use Selenium's default timeout | 5s | | *locators | Selenium 2 element loca...
def wait_until_page_does_not_contain_these_elements(self, timeout, *locators): """Waits until all of the specified elements are not found on the page. | *Argument* | *Description* | *Example* | | timeout | maximum time to wait, if set to ${None} it will use Selenium's default timeout | 5s | | *locators | Selenium 2 ele...
def tap_key(self, key, complementKey=None) : """Presses the specified `key`. The `complementKey` defines the key to hold when pressing the specified `key`. For example, you could use ${VK_TAB} as `key` and use ${VK_SHIFT} as `complementKey' in order to press Shift + Tab (back tab) | =Argument= | =Description= | =Exampl...
key to hold while pressing the key passed in previous argument | ${VK_ALT} |""" driver = self._current_browser() if (complementKey is not None) : ActionChains(driver).key_down(complementKey).send_keys(key).key_up(complementKey).perform() else : ActionChains(driver).send_keys(key).perform()
def wait_until_element_is_clickable(self, locator, timeout=None): """Clicks the element specified by `locator` until the operation succeeds. This should be used with buttons that are generated in real-time and that don't have their click handling available immediately. This keyword avoids unclickable element exceptions...
if set to ${None} it will use Selenium's default timeout | 5s |""" self._wait_until_no_error(timeout, self._wait_for_click_to_succeed, locator)
def _visitor_impl(self, arg): """Actual visitor method implementation.""" if (_qualname(type(self)), type(arg)) in _methods: method = _methods[(_qualname(type(self)), type(arg))] return method(self, arg) else: # if no visitor method found for this arg type, # search in parent arg type: arg_parent_type = arg.__class__._...
class ' + str(type(arg)))
def visitor(arg_type): """Decorator that creates a visitor method.""" def decorator(fn): declaring_class = _declaring_class(fn) _methods[(declaring_class, arg_type)] = fn # Replace all decorated methods with _visitor_impl return _visitor_impl return decorator
def absolute(parser, token): ''' Returns a full absolute URL based on the request host. This template tag takes exactly the same paramters as url template tag. ''' node = url(parser, token) return AbsoluteUrlNode( view_name=node.view_name, args=node.args, kwargs=node.kwargs, asvar=node.asvar )
def site(parser, token): ''' Returns a full absolute URL based on the current site. This template tag takes exactly the same paramters as url template tag. ''' node = url(parser, token) return SiteUrlNode( view_name=node.view_name, args=node.args, kwargs=node.kwargs, asvar=node.asvar )
def _wait_until_exp(self, timeout, error, function, *args): """This replaces the method from Selenium2Library to fix the major logic error in it""" error = error.replace('<TIMEOUT>', self._format_timeout(timeout)) def wait_func(): return None if function(*args) else error self._wait_until_no_error_exp(timeout, wait_fun...
def _wait_until_no_error_exp(self, timeout, wait_func, *args): """This replaces the method from Selenium2Library to fix the major logic error in it""" timeout = robot.utils.timestr_to_secs(timeout) if timeout is not None else self._timeout_in_secs maxtime = time.time() + timeout while True: try: timeout_error = wait_fu...
def rst(filename): ''' Load rst file and sanitize it for PyPI. Remove unsupported github tags: - code-block directive ''' content = open(filename).read() return re.sub(r'\.\.\s? code-block::\s*(\w|\+)+', '::', content)
def get_callable_method_dict(obj): """Returns a dictionary of callable methods of object `obj`. @param obj: ZOS API Python COM object @return: a dictionary of callable methods Notes: the function only returns the callable attributes that are listed by dir() function. Properties are not returned. """ methodDict = {} for...
methodDict
def replicate_methods(srcObj, dstObj): """Replicate callable methods from a `srcObj` to `dstObj` (generally a wrapper object). @param srcObj: source object @param dstObj: destination object of the same type. @return : none Implementer notes: 1. Once the methods are mapped from the `srcObj` to the `dstObj`, the method c...
a 'key' and 'value' look like: key: MakeSequential value: <bound method IOpticalSystem.MakeSequential of <win32com.gen_py.ZOSAPI_Interfaces.IOpticalSystem instance at 0x77183968>> """ # prevent methods that we intend to specialize from being mapped. The specialized # (overridden) methods are methods with the same name ...
script such as i_analyses_methods.py for I_Analyses overridden_methods = get_callable_method_dict(type(dstObj)).keys() #overridden_attrs = [each for each in type(dstObj).__dict__.keys() if not each.startswith('_')] # def zos_wrapper_deco(func): def wrapper(*args, **kwargs): return wrapped_zos_object(func(*args, **kwarg...
')' return wrapper # for key, value in get_callable_method_dict(srcObj).items(): if key not in overridden_methods: setattr(dstObj, key, zos_wrapper_deco(value))
def get_properties(zos_obj): """Returns a lists of properties bound to the object `zos_obj` @param zos_obj: ZOS API Python COM object @return prop_get: list of properties that are only getters @return prop_set: list of properties that are both getters and setters """ prop_get = set(zos_obj._prop_map_get_.keys()) prop_s...
return list(prop_get), list(prop_set)
def managed_wrapper_class_factory(zos_obj): """Creates and returns a wrapper class of a ZOS object, exposing the ZOS objects methods and propertis, and patching custom specialized attributes @param zos_obj: ZOS API Python COM object """ cls_name = repr(zos_obj).split()[0].split('.')[-1] dispatch_attr = '_' + cls_name.l...
objects base_cls_list = inheritance_dict.get(cls_name, None) if base_cls_list: for base_cls_name in base_cls_list: getters, setters = get_properties(_CastTo(zos_obj, base_cls_name)) for each in getters: exec("p{} = ZOSPropMapper('{}', '{}', cast_to='{}')".format(each, dispatch_attr, each, base_cls_name), globals(), cdi...
= ZOSPropMapper('{}', '{}')".format(each, dispatch_attr, each), globals(), cdict) for each in setters: exec("p{} = ZOSPropMapper('{}', '{}', setter=True)".format(each, dispatch_attr, each), globals(), cdict) def __init__(self, zos_obj): # dispatcher attribute cls_name = repr(zos_obj).split()[0].split('.')[-1] dispatch_...
# patch the methods of the base class(s) of the given ZOS object if self._base_cls_list: for base_cls_name in self._base_cls_list: replicate_methods(_CastTo(zos_obj, base_cls_name), self) # patch the methods of given ZOS object replicate_methods(zos_obj, self) # mark object as wrapped to prevent it from being wrapped s...
attrname)) def __repr__(self): if type(self).__name__ == 'IZOSAPI_Application': repr_str = "{.__name__}(NumberOfOpticalSystems = {})".format(type(self), self.pNumberOfOpticalSystems) else: repr_str = "{.__name__}".format(type(self)) return repr_str cdict['__init__'] = __init__ cdict['__getattr__'] = __getattr__ cdict['...
type(cls_name, (), cdict)
def wrapped_zos_object(zos_obj): """Helper function to wrap ZOS API COM objects. @param zos_obj : ZOS API Python COM object @return: instance of the wrapped ZOS API class. If the input object is not a ZOS-API COM object or if it is already wrapped, then the object is returned without wrapping. Notes: The function dynam...