_id
stringlengths
2
7
title
stringlengths
1
88
partition
stringclasses
3 values
text
stringlengths
75
19.8k
language
stringclasses
1 value
meta_information
dict
q270400
Percentage.count
test
def count(self): """ Count the number of domain for each status. """ if self.status: # The status is parsed. # We increase the number of tested. PyFunceble.INTERN["counter"]["number"]["tested"] += 1 if ( self.status.lower...
python
{ "resource": "" }
q270401
Percentage._calculate
test
def _calculate(cls): """ Calculate the percentage of each status. """ # We map the current state/counters of the different status. percentages = { "up": PyFunceble.INTERN["counter"]["number"]["up"], "down": PyFunceble.INTERN["counter"]["number"]["down"], ...
python
{ "resource": "" }
q270402
Percentage.log
test
def log(self): """ Print on screen and on file the percentages for each status. """ if ( PyFunceble.CONFIGURATION["show_percentage"] and PyFunceble.INTERN["counter"]["number"]["tested"] > 0 ): # * We are allowed to show the percentage on scree...
python
{ "resource": "" }
q270403
Check.is_url_valid
test
def is_url_valid(self, url=None, return_base=False, return_formatted=False): """ Check if the given URL is valid. :param url: The url to validate. :type url: str :param return_base: Allow us the return of the url base (if URL formatted correctly). :type retu...
python
{ "resource": "" }
q270404
Check.is_domain_valid
test
def is_domain_valid( self, domain=None, subdomain_check=False ): # pylint:disable=too-many-return-statements, too-many-branches """ Check if the given domain is a valid. :param domain: The domain to validate. :type domain: str :param subdomain_check: Ac...
python
{ "resource": "" }
q270405
Check.is_subdomain
test
def is_subdomain(self, domain=None): """ Check if the given subdomain is a subdomain. :param domain: The domain to validate. :type domain: str :return: The validity of the subdomain. :rtype: bool """ if domain: # A domain is given. ...
python
{ "resource": "" }
q270406
Syntax.get
test
def get(cls): """ Execute the logic behind the Syntax handling. :return: The syntax status. :rtype: str """ if PyFunceble.INTERN["to_test_type"] == "domain": # We are testing for domain or ip. if Check().is_domain_valid() or Check().is_ip_valid(...
python
{ "resource": "" }
q270407
Inactive._reformat_historical_formating_error
test
def _reformat_historical_formating_error(self): # pragma: no cover """ Format the old format so it can be merged into the newer format. """ if PyFunceble.CONFIGURATION["inactive_database"]: # The database subsystem is activated. # We construct the possible path...
python
{ "resource": "" }
q270408
Inactive._retrieve
test
def _retrieve(self): """ Return the current content of the inactive-db.json file. """ if PyFunceble.CONFIGURATION["inactive_database"]: # The database subsystem is activated. # We get, format and initiate the historical database file. self._reformat_...
python
{ "resource": "" }
q270409
Inactive._backup
test
def _backup(self): """ Save the current database into the inactive-db.json file. """ if PyFunceble.CONFIGURATION["inactive_database"]: # The database subsystem is activated. # We save the current database state into the database file. Dict(PyFunceble...
python
{ "resource": "" }
q270410
Inactive._timestamp
test
def _timestamp(self): """ Get the timestamp where we are going to save our current list. :return: The timestamp to append with the currently tested element. :rtype: int|str """ if PyFunceble.CONFIGURATION["inactive_database"]: # The database subsystem is act...
python
{ "resource": "" }
q270411
Inactive.content
test
def content(cls): """ Get the content of the database. :return: The content of the database. :rtype: list """ # We initiate a variable which will save what we are going to return. result = [] if ( PyFunceble.CONFIGURATION["inactive_database"...
python
{ "resource": "" }
q270412
Inactive.is_present
test
def is_present(cls): """ Check if the currently tested element is into the database. """ if PyFunceble.CONFIGURATION["inactive_database"]: # The database subsystem is activated. if PyFunceble.INTERN["to_test"] in PyFunceble.INTERN[ "flatten_inact...
python
{ "resource": "" }
q270413
Whois._retrieve
test
def _retrieve(self): """ Retrieve the data from the database. """ if self._authorization() and "whois_db" not in PyFunceble.INTERN: # The usage of the whois database is activated. if PyFunceble.path.isfile(self.whois_db_path): # The database file...
python
{ "resource": "" }
q270414
Whois._backup
test
def _backup(self): """ Backup the database into its file. """ if self._authorization(): # We are authorized to work. # We backup the current state of the datbase. Dict(PyFunceble.INTERN["whois_db"]).to_json(self.whois_db_path)
python
{ "resource": "" }
q270415
Whois.is_in_database
test
def is_in_database(self): """ Check if the element is into the database. """ if ( self._authorization() and PyFunceble.INTERN["file_to_test"] in PyFunceble.INTERN["whois_db"] and PyFunceble.INTERN["to_test"] in PyFunceble.INTERN["whois_db"...
python
{ "resource": "" }
q270416
Whois.is_time_older
test
def is_time_older(self): """ Check if the current time is older than the one in the database. """ if ( self._authorization() and self.is_in_database() and int( PyFunceble.INTERN["whois_db"][PyFunceble.INTERN["file_to_test"]][ ...
python
{ "resource": "" }
q270417
Whois.get_expiration_date
test
def get_expiration_date(self): """ Get the expiration date from the database. :return: The expiration date from the database. :rtype: str|None """ if self._authorization() and self.is_in_database() and not self.is_time_older(): # * We are authorized to work....
python
{ "resource": "" }
q270418
Whois.add
test
def add(self): """ Add the currently tested element into the database. """ if self._authorization(): # We are authorized to work. if self.epoch < int(PyFunceble.time()): state = "past" else: state = "future" ...
python
{ "resource": "" }
q270419
AutoSave.travis_permissions
test
def travis_permissions(cls): """ Set permissions in order to avoid issues before commiting. """ if PyFunceble.CONFIGURATION["travis"]: try: build_dir = PyFunceble.environ["TRAVIS_BUILD_DIR"] commands = [ "sudo chown -R trav...
python
{ "resource": "" }
q270420
AutoSave._travis
test
def _travis(self): """ Logic behind autosave under Travis CI. """ if PyFunceble.CONFIGURATION["travis"]: try: _ = PyFunceble.environ["TRAVIS_BUILD_DIR"] time_autorisation = False try: time_autorisation = in...
python
{ "resource": "" }
q270421
Lookup.nslookup
test
def nslookup(cls): """ Implementation of UNIX nslookup. """ try: # We try to get the addresse information of the given domain or IP. if "current_test_data" in PyFunceble.INTERN: # pragma: no cover # The end-user want more information whith his t...
python
{ "resource": "" }
q270422
Lookup.whois
test
def whois(cls, whois_server, domain=None, timeout=None): # pragma: no cover """ Implementation of UNIX whois. :param whois_server: The WHOIS server to use to get the record. :type whois_server: str :param domain: The domain to get the whois record from. :type domain: s...
python
{ "resource": "" }
q270423
URL.get
test
def get(cls): # pragma: no cover """ Execute the logic behind the URL handling. :return: The status of the URL. :rtype: str """ if Check().is_url_valid() or PyFunceble.CONFIGURATION["local"]: # * The url is valid. # or # * We are tes...
python
{ "resource": "" }
q270424
Referer.get
test
def get(self): """ Return the referer aka the WHOIS server of the current domain extension. """ if not PyFunceble.CONFIGURATION["local"]: # We are not running a test in a local network. if self.domain_extension not in self.ignored_extension: # Th...
python
{ "resource": "" }
q270425
Proxy._get_current_object
test
def _get_current_object(self): """Get current object. This is useful if you want the real object behind the proxy at a time for performance reasons or because you want to pass the object into a different context. """ loc = object.__getattribute__(self, '_Proxy__local') ...
python
{ "resource": "" }
q270426
standard_paths
test
def standard_paths(): """Yield paths to standard modules.""" for is_plat_spec in [True, False]: path = distutils.sysconfig.get_python_lib(standard_lib=True, plat_specific=is_plat_spec) for name in os.listdir(path): yield name ...
python
{ "resource": "" }
q270427
standard_package_names
test
def standard_package_names(): """Yield standard module names.""" for name in standard_paths(): if name.startswith('_') or '-' in name: continue if '.' in name and name.rsplit('.')[-1] not in ['so', 'py', 'pyc']: continue yield name.split('.')[0]
python
{ "resource": "" }
q270428
unused_import_line_numbers
test
def unused_import_line_numbers(messages): """Yield line numbers of unused imports.""" for message in messages: if isinstance(message, pyflakes.messages.UnusedImport): yield message.lineno
python
{ "resource": "" }
q270429
unused_import_module_name
test
def unused_import_module_name(messages): """Yield line number and module name of unused imports.""" pattern = r'\'(.+?)\'' for message in messages: if isinstance(message, pyflakes.messages.UnusedImport): module_name = re.search(pattern, str(message)) module_name = module_name...
python
{ "resource": "" }
q270430
star_import_used_line_numbers
test
def star_import_used_line_numbers(messages): """Yield line number of star import usage.""" for message in messages: if isinstance(message, pyflakes.messages.ImportStarUsed): yield message.lineno
python
{ "resource": "" }
q270431
star_import_usage_undefined_name
test
def star_import_usage_undefined_name(messages): """Yield line number, undefined name, and its possible origin module.""" for message in messages: if isinstance(message, pyflakes.messages.ImportStarUsage): undefined_name = message.message_args[0] module_name = message.message_args...
python
{ "resource": "" }
q270432
unused_variable_line_numbers
test
def unused_variable_line_numbers(messages): """Yield line numbers of unused variables.""" for message in messages: if isinstance(message, pyflakes.messages.UnusedVariable): yield message.lineno
python
{ "resource": "" }
q270433
duplicate_key_line_numbers
test
def duplicate_key_line_numbers(messages, source): """Yield line numbers of duplicate keys.""" messages = [ message for message in messages if isinstance(message, pyflakes.messages.MultiValueRepeatedKeyLiteral)] if messages: # Filter out complex cases. We don't want to bother trying ...
python
{ "resource": "" }
q270434
create_key_to_messages_dict
test
def create_key_to_messages_dict(messages): """Return dict mapping the key to list of messages.""" dictionary = collections.defaultdict(lambda: []) for message in messages: dictionary[message.message_args[0]].append(message) return dictionary
python
{ "resource": "" }
q270435
check
test
def check(source): """Return messages from pyflakes.""" if sys.version_info[0] == 2 and isinstance(source, unicode): # Convert back to original byte string encoding, otherwise pyflakes # call to compile() will complain. See PEP 263. This only affects # Python 2. try: ...
python
{ "resource": "" }
q270436
extract_package_name
test
def extract_package_name(line): """Return package name in import statement.""" assert '\\' not in line assert '(' not in line assert ')' not in line assert ';' not in line if line.lstrip().startswith(('import', 'from')): word = line.split()[1] else: # Ignore doctests. ...
python
{ "resource": "" }
q270437
multiline_import
test
def multiline_import(line, previous_line=''): """Return True if import is spans multiples lines.""" for symbol in '()': if symbol in line: return True # Ignore doctests. if line.lstrip().startswith('>'): return True return multiline_statement(line, previous_line)
python
{ "resource": "" }
q270438
multiline_statement
test
def multiline_statement(line, previous_line=''): """Return True if this is part of a multiline statement.""" for symbol in '\\:;': if symbol in line: return True sio = io.StringIO(line) try: list(tokenize.generate_tokens(sio.readline)) return previous_line.rstrip().e...
python
{ "resource": "" }
q270439
filter_from_import
test
def filter_from_import(line, unused_module): """Parse and filter ``from something import a, b, c``. Return line without unused import modules, or `pass` if all of the module in import is unused. """ (indentation, imports) = re.split(pattern=r'\bimport\b', strin...
python
{ "resource": "" }
q270440
break_up_import
test
def break_up_import(line): """Return line with imports on separate lines.""" assert '\\' not in line assert '(' not in line assert ')' not in line assert ';' not in line assert '#' not in line assert not line.lstrip().startswith('from') newline = get_line_ending(line) if not newline...
python
{ "resource": "" }
q270441
filter_code
test
def filter_code(source, additional_imports=None, expand_star_imports=False, remove_all_unused_imports=False, remove_duplicate_keys=False, remove_unused_variables=False, ignore_init_module_imports=False, ): """Yield code ...
python
{ "resource": "" }
q270442
get_messages_by_line
test
def get_messages_by_line(messages): """Return dictionary that maps line number to message.""" line_messages = {} for message in messages: line_messages[message.lineno] = message return line_messages
python
{ "resource": "" }
q270443
filter_star_import
test
def filter_star_import(line, marked_star_import_undefined_name): """Return line with the star import expanded.""" undefined_name = sorted(set(marked_star_import_undefined_name)) return re.sub(r'\*', ', '.join(undefined_name), line)
python
{ "resource": "" }
q270444
filter_duplicate_key
test
def filter_duplicate_key(line, message, line_number, marked_line_numbers, source, previous_line=''): """Return '' if first occurrence of the key otherwise return `line`.""" if marked_line_numbers and line_number == sorted(marked_line_numbers)[0]: return '' return line
python
{ "resource": "" }
q270445
dict_entry_has_key
test
def dict_entry_has_key(line, key): """Return True if `line` is a dict entry that uses `key`. Return False for multiline cases where the line should not be removed by itself. """ if '#' in line: return False result = re.match(r'\s*(.*)\s*:\s*(.*),\s*$', line) if not result: ...
python
{ "resource": "" }
q270446
is_literal_or_name
test
def is_literal_or_name(value): """Return True if value is a literal or a name.""" try: ast.literal_eval(value) return True except (SyntaxError, ValueError): pass if value.strip() in ['dict()', 'list()', 'set()']: return True # Support removal of variables on the rig...
python
{ "resource": "" }
q270447
useless_pass_line_numbers
test
def useless_pass_line_numbers(source): """Yield line numbers of unneeded "pass" statements.""" sio = io.StringIO(source) previous_token_type = None last_pass_row = None last_pass_indentation = None previous_line = '' for token in tokenize.generate_tokens(sio.readline): token_type = t...
python
{ "resource": "" }
q270448
filter_useless_pass
test
def filter_useless_pass(source): """Yield code with useless "pass" lines removed.""" try: marked_lines = frozenset(useless_pass_line_numbers(source)) except (SyntaxError, tokenize.TokenError): marked_lines = frozenset() sio = io.StringIO(source) for line_number, line in enumerate(si...
python
{ "resource": "" }
q270449
get_indentation
test
def get_indentation(line): """Return leading whitespace.""" if line.strip(): non_whitespace_index = len(line) - len(line.lstrip()) return line[:non_whitespace_index] else: return ''
python
{ "resource": "" }
q270450
get_line_ending
test
def get_line_ending(line): """Return line ending.""" non_whitespace_index = len(line.rstrip()) - len(line) if not non_whitespace_index: return '' else: return line[non_whitespace_index:]
python
{ "resource": "" }
q270451
fix_code
test
def fix_code(source, additional_imports=None, expand_star_imports=False, remove_all_unused_imports=False, remove_duplicate_keys=False, remove_unused_variables=False, ignore_init_module_imports=False): """Return code with all filtering run on it.""" if not source: return source ...
python
{ "resource": "" }
q270452
_split_comma_separated
test
def _split_comma_separated(string): """Return a set of strings.""" return set(text.strip() for text in string.split(',') if text.strip())
python
{ "resource": "" }
q270453
is_python_file
test
def is_python_file(filename): """Return True if filename is Python file.""" if filename.endswith('.py'): return True try: with open_with_encoding( filename, None, limit_byte_check=MAX_PYTHON_FILE_DETECTION_BYTES) as f: text = f.rea...
python
{ "resource": "" }
q270454
is_exclude_file
test
def is_exclude_file(filename, exclude): """Return True if file matches exclude pattern.""" base_name = os.path.basename(filename) if base_name.startswith('.'): return True for pattern in exclude: if fnmatch.fnmatch(base_name, pattern): return True if fnmatch.fnmatch...
python
{ "resource": "" }
q270455
find_files
test
def find_files(filenames, recursive, exclude): """Yield filenames.""" while filenames: name = filenames.pop(0) if recursive and os.path.isdir(name): for root, directories, children in os.walk(name): filenames += [os.path.join(root, f) for f in children ...
python
{ "resource": "" }
q270456
_main
test
def _main(argv, standard_out, standard_error): """Return exit status. 0 means no error. """ import argparse parser = argparse.ArgumentParser(description=__doc__, prog='autoflake') parser.add_argument('-c', '--check', action='store_true', help='return error code if change...
python
{ "resource": "" }
q270457
ObtainLeaseResponsePayload.read
test
def read(self, input_stream, kmip_version=enums.KMIPVersion.KMIP_1_0): """ Read the data encoding the ObtainLease response payload and decode it into its constituent parts. Args: input_stream (stream): A data stream containing encoded object data, supporting ...
python
{ "resource": "" }
q270458
ObtainLeaseResponsePayload.write
test
def write(self, output_stream, kmip_version=enums.KMIPVersion.KMIP_1_0): """ Write the data encoding the ObtainLease response payload to a stream. Args: output_stream (stream): A data stream in which to encode object data, supporting a write method; usually a Bytearr...
python
{ "resource": "" }
q270459
CancelRequestPayload.write
test
def write(self, output_stream, kmip_version=enums.KMIPVersion.KMIP_1_0): """ Write the data encoding the Cancel request payload to a stream. Args: output_stream (stream): A data stream in which to encode object data, supporting a write method; usually a BytearrayStre...
python
{ "resource": "" }
q270460
CancelResponsePayload.read
test
def read(self, input_stream, kmip_version=enums.KMIPVersion.KMIP_1_0): """ Read the data encoding the Cancel response payload and decode it into its constituent parts. Args: input_stream (stream): A data stream containing encoded object data, supporting a rea...
python
{ "resource": "" }
q270461
Name.create
test
def create(cls, name_value, name_type): ''' Returns a Name object, populated with the given value and type ''' if isinstance(name_value, Name.NameValue): value = name_value elif isinstance(name_value, str): value = cls.NameValue(name_value) els...
python
{ "resource": "" }
q270462
Digest.read
test
def read(self, istream, kmip_version=enums.KMIPVersion.KMIP_1_0): """ Read the data encoding the Digest object and decode it into its constituent parts. Args: istream (Stream): A data stream containing encoded object data, supporting a read method; usually a ...
python
{ "resource": "" }
q270463
Digest.write
test
def write(self, ostream, kmip_version=enums.KMIPVersion.KMIP_1_0): """ Write the data encoding the Digest object to a stream. Args: ostream (Stream): A data stream in which to encode object data, supporting a write method; usually a BytearrayStream object. ...
python
{ "resource": "" }
q270464
Digest.create
test
def create(cls, hashing_algorithm=HashingAlgorithmEnum.SHA_256, digest_value=b'', key_format_type=KeyFormatTypeEnum.RAW): """ Construct a Digest object from provided digest values. Args: hashing_algorithm (HashingAlgorithm): An enumeratio...
python
{ "resource": "" }
q270465
ApplicationSpecificInformation.read
test
def read(self, istream, kmip_version=enums.KMIPVersion.KMIP_1_0): """ Read the data encoding the ApplicationSpecificInformation object and decode it into its constituent parts. Args: istream (Stream): A data stream containing encoded object data, supporting a...
python
{ "resource": "" }
q270466
ApplicationSpecificInformation.write
test
def write(self, ostream, kmip_version=enums.KMIPVersion.KMIP_1_0): """ Write the data encoding the ApplicationSpecificInformation object to a stream. Args: ostream (Stream): A data stream in which to encode object data, supporting a write method; usually a By...
python
{ "resource": "" }
q270467
ApplicationSpecificInformation.create
test
def create(cls, application_namespace, application_data): """ Construct an ApplicationSpecificInformation object from provided data and namespace values. Args: application_namespace (str): The name of the application namespace. application_data (str): Application...
python
{ "resource": "" }
q270468
DerivationParameters.read
test
def read(self, input_stream, kmip_version=enums.KMIPVersion.KMIP_1_0): """ Read the data encoding the DerivationParameters struct and decode it into its constituent parts. Args: input_stream (stream): A data stream containing encoded object data, supporting a...
python
{ "resource": "" }
q270469
DerivationParameters.write
test
def write(self, output_stream, kmip_version=enums.KMIPVersion.KMIP_1_0): """ Write the data encoding the DerivationParameters struct to a stream. Args: output_stream (stream): A data stream in which to encode object data, supporting a write method; usually a Bytearra...
python
{ "resource": "" }
q270470
GetRequestPayload.read
test
def read(self, input_stream, kmip_version=enums.KMIPVersion.KMIP_1_0): """ Read the data encoding the Get request payload and decode it into its constituent parts. Args: input_stream (stream): A data stream containing encoded object data, supporting a read me...
python
{ "resource": "" }
q270471
GetRequestPayload.write
test
def write(self, output_stream, kmip_version=enums.KMIPVersion.KMIP_1_0): """ Write the data encoding the Get request payload to a stream. Args: output_stream (stream): A data stream in which to encode object data, supporting a write method; usually a BytearrayStream ...
python
{ "resource": "" }
q270472
GetResponsePayload.read
test
def read(self, input_stream, kmip_version=enums.KMIPVersion.KMIP_1_0): """ Read the data encoding the Get response payload and decode it into its constituent parts. Args: input_stream (stream): A data stream containing encoded object data, supporting a read m...
python
{ "resource": "" }
q270473
GetResponsePayload.write
test
def write(self, output_stream, kmip_version=enums.KMIPVersion.KMIP_1_0): """ Write the data encoding the Get response payload to a stream. Args: output_stream (stream): A data stream in which to encode object data, supporting a write method; usually a BytearrayStream...
python
{ "resource": "" }
q270474
SignatureVerifyRequestPayload.read
test
def read(self, input_stream, kmip_version=enums.KMIPVersion.KMIP_1_0): """ Read the data encoding the SignatureVerify request payload and decode it into its constituent parts. Args: input_stream (stream): A data stream containing encoded object data, supporti...
python
{ "resource": "" }
q270475
SignatureVerifyRequestPayload.write
test
def write(self, output_stream, kmip_version=enums.KMIPVersion.KMIP_1_0): """ Write the data encoding the SignatureVerify request payload to a stream. Args: output_stream (stream): A data stream in which to encode object data, supporting a write method; usuall...
python
{ "resource": "" }
q270476
SignatureVerifyResponsePayload.read
test
def read(self, input_stream, kmip_version=enums.KMIPVersion.KMIP_1_0): """ Read the data encoding the SignatureVerify response payload and decode it into its constituent parts. Args: input_stream (stream): A data stream containing encoded object data, support...
python
{ "resource": "" }
q270477
KmipEngine.process_request
test
def process_request(self, request, credential=None): """ Process a KMIP request message. This routine is the main driver of the KmipEngine. It breaks apart and processes the request header, handles any message errors that may result, and then passes the set of request batch item...
python
{ "resource": "" }
q270478
KmipEngine.build_error_response
test
def build_error_response(self, version, reason, message): """ Build a simple ResponseMessage with a single error result. Args: version (ProtocolVersion): The protocol version the response should be addressed with. reason (ResultReason): An enumeration cla...
python
{ "resource": "" }
q270479
KmipEngine._process_template_attribute
test
def _process_template_attribute(self, template_attribute): """ Given a kmip.core TemplateAttribute object, extract the attribute value data into a usable dictionary format. """ attributes = {} if len(template_attribute.names) > 0: raise exceptions.ItemNotFoun...
python
{ "resource": "" }
q270480
KmipEngine._get_attributes_from_managed_object
test
def _get_attributes_from_managed_object(self, managed_object, attr_names): """ Given a kmip.pie object and a list of attribute names, attempt to get all of the existing attribute values from the object. """ attr_factory = attribute_factory.AttributeFactory() retrieved_att...
python
{ "resource": "" }
q270481
KmipEngine._get_attribute_from_managed_object
test
def _get_attribute_from_managed_object(self, managed_object, attr_name): """ Get the attribute value from the kmip.pie managed object. """ if attr_name == 'Unique Identifier': return str(managed_object.unique_identifier) elif attr_name == 'Name': names = l...
python
{ "resource": "" }
q270482
KmipEngine._set_attributes_on_managed_object
test
def _set_attributes_on_managed_object(self, managed_object, attributes): """ Given a kmip.pie object and a dictionary of attributes, attempt to set the attribute values on the object. """ for attribute_name, attribute_value in six.iteritems(attributes): object_type = ...
python
{ "resource": "" }
q270483
KmipEngine._set_attribute_on_managed_object
test
def _set_attribute_on_managed_object(self, managed_object, attribute): """ Set the attribute value on the kmip.pie managed object. """ attribute_name = attribute[0] attribute_value = attribute[1] if self._attribute_policy.is_attribute_multivalued(attribute_name): ...
python
{ "resource": "" }
q270484
KmipEngine.is_allowed
test
def is_allowed( self, policy_name, session_user, session_group, object_owner, object_type, operation ): """ Determine if object access is allowed for the provided policy and session settings. """ ...
python
{ "resource": "" }
q270485
DecryptRequestPayload.write
test
def write(self, output_stream, kmip_version=enums.KMIPVersion.KMIP_1_0): """ Write the data encoding the Decrypt request payload to a stream. Args: output_stream (stream): A data stream in which to encode object data, supporting a write method; usually a BytearrayStr...
python
{ "resource": "" }
q270486
SecretFactory.create
test
def create(self, secret_type, value=None): """ Create a secret object of the specified type with the given value. Args: secret_type (ObjectType): An ObjectType enumeration specifying the type of secret to create. value (dict): A dictionary containing secr...
python
{ "resource": "" }
q270487
KmipServerConfig.set_setting
test
def set_setting(self, setting, value): """ Set a specific setting value. This will overwrite the current setting value for the specified setting. Args: setting (string): The name of the setting to set (e.g., 'certificate_path', 'hostname'). Required....
python
{ "resource": "" }
q270488
KmipServerConfig.load_settings
test
def load_settings(self, path): """ Load configuration settings from the file pointed to by path. This will overwrite all current setting values. Args: path (string): The path to the configuration file containing the settings to load. Required. Raises...
python
{ "resource": "" }
q270489
UsageMaskType.process_bind_param
test
def process_bind_param(self, value, dialect): """ Returns the integer value of the usage mask bitmask. This value is stored in the database. Args: value(list<enums.CryptographicUsageMask>): list of enums in the usage mask dialect(string): SQL dialect ...
python
{ "resource": "" }
q270490
UsageMaskType.process_result_value
test
def process_result_value(self, value, dialect): """ Returns a new list of enums.CryptographicUsageMask Enums. This converts the integer value into the list of enums. Args: value(int): The integer value stored in the database that is used to create the list of...
python
{ "resource": "" }
q270491
LongInteger.read
test
def read(self, istream, kmip_version=enums.KMIPVersion.KMIP_1_0): """ Read the encoding of the LongInteger from the input stream. Args: istream (stream): A buffer containing the encoded bytes of a LongInteger. Usually a BytearrayStream object. Required. k...
python
{ "resource": "" }
q270492
LongInteger.write
test
def write(self, ostream, kmip_version=enums.KMIPVersion.KMIP_1_0): """ Write the encoding of the LongInteger to the output stream. Args: ostream (stream): A buffer to contain the encoded bytes of a LongInteger. Usually a BytearrayStream object. Required. ...
python
{ "resource": "" }
q270493
LongInteger.validate
test
def validate(self): """ Verify that the value of the LongInteger is valid. Raises: TypeError: if the value is not of type int or long ValueError: if the value cannot be represented by a signed 64-bit integer """ if self.value is not None: ...
python
{ "resource": "" }
q270494
BigInteger.read
test
def read(self, istream, kmip_version=enums.KMIPVersion.KMIP_1_0): """ Read the encoding of the BigInteger from the input stream. Args: istream (stream): A buffer containing the encoded bytes of the value of a BigInteger. Usually a BytearrayStream object. ...
python
{ "resource": "" }
q270495
BigInteger.write
test
def write(self, ostream, kmip_version=enums.KMIPVersion.KMIP_1_0): """ Write the encoding of the BigInteger to the output stream. Args: ostream (Stream): A buffer to contain the encoded bytes of a BigInteger object. Usually a BytearrayStream object. R...
python
{ "resource": "" }
q270496
BigInteger.validate
test
def validate(self): """ Verify that the value of the BigInteger is valid. Raises: TypeError: if the value is not of type int or long """ if self.value is not None: if not isinstance(self.value, six.integer_types): raise TypeError('expected...
python
{ "resource": "" }
q270497
Enumeration.validate
test
def validate(self): """ Verify that the value of the Enumeration is valid. Raises: TypeError: if the enum is not of type Enum ValueError: if the value is not of the expected Enum subtype or if the value cannot be represented by an unsigned 32-bit integer ...
python
{ "resource": "" }
q270498
Boolean.read_value
test
def read_value(self, istream, kmip_version=enums.KMIPVersion.KMIP_1_0): """ Read the value of the Boolean object from the input stream. Args: istream (Stream): A buffer containing the encoded bytes of the value of a Boolean object. Usually a BytearrayStream object. ...
python
{ "resource": "" }
q270499
Boolean.write_value
test
def write_value(self, ostream, kmip_version=enums.KMIPVersion.KMIP_1_0): """ Write the value of the Boolean object to the output stream. Args: ostream (Stream): A buffer to contain the encoded bytes of the value of a Boolean object. Usually a BytearrayStream object. ...
python
{ "resource": "" }