repository_name
stringlengths
5
67
func_path_in_repository
stringlengths
4
234
func_name
stringlengths
0
314
whole_func_string
stringlengths
52
3.87M
language
stringclasses
6 values
func_code_string
stringlengths
52
3.87M
func_documentation_string
stringlengths
1
47.2k
func_code_url
stringlengths
85
339
Nike-Inc/cerberus-python-client
cerberus/client.py
CerberusClient.list_roles
def list_roles(self): """Simplified version of get_roles that returns a dict of just name: id for the roles""" json_resp = self.get_roles() temp_dict = {} for item in json_resp: temp_dict[item["name"]] = item["id"] return temp_dict
python
def list_roles(self): """Simplified version of get_roles that returns a dict of just name: id for the roles""" json_resp = self.get_roles() temp_dict = {} for item in json_resp: temp_dict[item["name"]] = item["id"] return temp_dict
Simplified version of get_roles that returns a dict of just name: id for the roles
https://github.com/Nike-Inc/cerberus-python-client/blob/ef38356822e722fcb6a6ed4a1b38a5b493e753ae/cerberus/client.py#L115-L122
Nike-Inc/cerberus-python-client
cerberus/client.py
CerberusClient.get_categories
def get_categories(self): """ Return a list of categories that a safe deposit box can belong to""" sdb_resp = get_with_retry(self.cerberus_url + '/v1/category', headers=self.HEADERS) throw_if_bad_response(sdb_resp) return sdb_resp.json()
python
def get_categories(self): """ Return a list of categories that a safe deposit box can belong to""" sdb_resp = get_with_retry(self.cerberus_url + '/v1/category', headers=self.HEADERS) throw_if_bad_response(sdb_resp) return sdb_resp.json()
Return a list of categories that a safe deposit box can belong to
https://github.com/Nike-Inc/cerberus-python-client/blob/ef38356822e722fcb6a6ed4a1b38a5b493e753ae/cerberus/client.py#L124-L130
Nike-Inc/cerberus-python-client
cerberus/client.py
CerberusClient.create_sdb
def create_sdb(self, name, category_id, owner, description="", user_group_permissions=None, iam_principal_permissions=None): """Create a safe deposit box. You need to refresh your token before the iam role is granted permission to the new safe deposit box. Keyword arguments: ...
python
def create_sdb(self, name, category_id, owner, description="", user_group_permissions=None, iam_principal_permissions=None): """Create a safe deposit box. You need to refresh your token before the iam role is granted permission to the new safe deposit box. Keyword arguments: ...
Create a safe deposit box. You need to refresh your token before the iam role is granted permission to the new safe deposit box. Keyword arguments: name (string) -- name of the safe deposit box category_id (string) -- category id that determines where to store the sdb. (ex: shar...
https://github.com/Nike-Inc/cerberus-python-client/blob/ef38356822e722fcb6a6ed4a1b38a5b493e753ae/cerberus/client.py#L132-L170
Nike-Inc/cerberus-python-client
cerberus/client.py
CerberusClient.delete_sdb
def delete_sdb(self, sdb_id): """ Delete a safe deposit box specified by id Keyword arguments: sdb_id -- this is the id of the safe deposit box, not the path.""" sdb_resp = delete_with_retry(self.cerberus_url + '/v2/safe-deposit-box/' + sdb_id, headers...
python
def delete_sdb(self, sdb_id): """ Delete a safe deposit box specified by id Keyword arguments: sdb_id -- this is the id of the safe deposit box, not the path.""" sdb_resp = delete_with_retry(self.cerberus_url + '/v2/safe-deposit-box/' + sdb_id, headers...
Delete a safe deposit box specified by id Keyword arguments: sdb_id -- this is the id of the safe deposit box, not the path.
https://github.com/Nike-Inc/cerberus-python-client/blob/ef38356822e722fcb6a6ed4a1b38a5b493e753ae/cerberus/client.py#L172-L180
Nike-Inc/cerberus-python-client
cerberus/client.py
CerberusClient.get_sdb_path
def get_sdb_path(self, sdb): """Return the path for a SDB""" sdb_id = self.get_sdb_id(sdb) sdb_resp = get_with_retry( self.cerberus_url + '/v1/safe-deposit-box/' + sdb_id + '/', headers=self.HEADERS ) throw_if_bad_response(sdb_resp) return sdb_re...
python
def get_sdb_path(self, sdb): """Return the path for a SDB""" sdb_id = self.get_sdb_id(sdb) sdb_resp = get_with_retry( self.cerberus_url + '/v1/safe-deposit-box/' + sdb_id + '/', headers=self.HEADERS ) throw_if_bad_response(sdb_resp) return sdb_re...
Return the path for a SDB
https://github.com/Nike-Inc/cerberus-python-client/blob/ef38356822e722fcb6a6ed4a1b38a5b493e753ae/cerberus/client.py#L190-L200
Nike-Inc/cerberus-python-client
cerberus/client.py
CerberusClient.get_sdb_keys
def get_sdb_keys(self, path): """Return the keys for a SDB, which are need for the full secure data path""" list_resp = get_with_retry( self.cerberus_url + '/v1/secret/' + path + '/?list=true', headers=self.HEADERS ) throw_if_bad_response(list_resp) retu...
python
def get_sdb_keys(self, path): """Return the keys for a SDB, which are need for the full secure data path""" list_resp = get_with_retry( self.cerberus_url + '/v1/secret/' + path + '/?list=true', headers=self.HEADERS ) throw_if_bad_response(list_resp) retu...
Return the keys for a SDB, which are need for the full secure data path
https://github.com/Nike-Inc/cerberus-python-client/blob/ef38356822e722fcb6a6ed4a1b38a5b493e753ae/cerberus/client.py#L202-L211
Nike-Inc/cerberus-python-client
cerberus/client.py
CerberusClient.get_sdb_id
def get_sdb_id(self, sdb): """ Return the ID for the given safe deposit box. Keyword arguments: sdb -- This is the name of the safe deposit box, not the path""" json_resp = self.get_sdbs() for r in json_resp: if r['name'] == sdb: return str(r['id']) ...
python
def get_sdb_id(self, sdb): """ Return the ID for the given safe deposit box. Keyword arguments: sdb -- This is the name of the safe deposit box, not the path""" json_resp = self.get_sdbs() for r in json_resp: if r['name'] == sdb: return str(r['id']) ...
Return the ID for the given safe deposit box. Keyword arguments: sdb -- This is the name of the safe deposit box, not the path
https://github.com/Nike-Inc/cerberus-python-client/blob/ef38356822e722fcb6a6ed4a1b38a5b493e753ae/cerberus/client.py#L213-L225
Nike-Inc/cerberus-python-client
cerberus/client.py
CerberusClient.get_sdb_id_by_path
def get_sdb_id_by_path(self, sdb_path): """ Given the path, return the ID for the given safe deposit box.""" json_resp = self.get_sdbs() # Deal with the supplied path possibly missing an ending slash path = self._add_slash(sdb_path) for r in json_resp: if r['path'] ...
python
def get_sdb_id_by_path(self, sdb_path): """ Given the path, return the ID for the given safe deposit box.""" json_resp = self.get_sdbs() # Deal with the supplied path possibly missing an ending slash path = self._add_slash(sdb_path) for r in json_resp: if r['path'] ...
Given the path, return the ID for the given safe deposit box.
https://github.com/Nike-Inc/cerberus-python-client/blob/ef38356822e722fcb6a6ed4a1b38a5b493e753ae/cerberus/client.py#L227-L240
Nike-Inc/cerberus-python-client
cerberus/client.py
CerberusClient.get_sdb_by_id
def get_sdb_by_id(self, sdb_id): """ Return the details for the given safe deposit box id Keyword arguments: sdb_id -- this is the id of the safe deposit box, not the path. """ sdb_resp = get_with_retry(self.cerberus_url + '/v2/safe-deposit-box/' + sdb_id, ...
python
def get_sdb_by_id(self, sdb_id): """ Return the details for the given safe deposit box id Keyword arguments: sdb_id -- this is the id of the safe deposit box, not the path. """ sdb_resp = get_with_retry(self.cerberus_url + '/v2/safe-deposit-box/' + sdb_id, ...
Return the details for the given safe deposit box id Keyword arguments: sdb_id -- this is the id of the safe deposit box, not the path.
https://github.com/Nike-Inc/cerberus-python-client/blob/ef38356822e722fcb6a6ed4a1b38a5b493e753ae/cerberus/client.py#L242-L253
Nike-Inc/cerberus-python-client
cerberus/client.py
CerberusClient.get_sdb_secret_version_paths
def get_sdb_secret_version_paths(self, sdb_id): """ Get SDB secret version paths. This function takes the sdb_id """ sdb_resp = get_with_retry(str.join('', [self.cerberus_url, '/v1/sdb-secret-version-paths/', sdb_id]), headers=self.HEADERS) throw_if_bad_response...
python
def get_sdb_secret_version_paths(self, sdb_id): """ Get SDB secret version paths. This function takes the sdb_id """ sdb_resp = get_with_retry(str.join('', [self.cerberus_url, '/v1/sdb-secret-version-paths/', sdb_id]), headers=self.HEADERS) throw_if_bad_response...
Get SDB secret version paths. This function takes the sdb_id
https://github.com/Nike-Inc/cerberus-python-client/blob/ef38356822e722fcb6a6ed4a1b38a5b493e753ae/cerberus/client.py#L271-L278
Nike-Inc/cerberus-python-client
cerberus/client.py
CerberusClient.list_sdbs
def list_sdbs(self): """ Return sdbs by Name """ sdb_raw = self.get_sdbs() sdbs = [] for s in sdb_raw: sdbs.append(s['name']) return sdbs
python
def list_sdbs(self): """ Return sdbs by Name """ sdb_raw = self.get_sdbs() sdbs = [] for s in sdb_raw: sdbs.append(s['name']) return sdbs
Return sdbs by Name
https://github.com/Nike-Inc/cerberus-python-client/blob/ef38356822e722fcb6a6ed4a1b38a5b493e753ae/cerberus/client.py#L284-L291
Nike-Inc/cerberus-python-client
cerberus/client.py
CerberusClient.update_sdb
def update_sdb(self, sdb_id, owner=None, description=None, user_group_permissions=None, iam_principal_permissions=None): """ Update a safe deposit box. Keyword arguments: owner (string) -- AD group that owns the safe deposit box description (string) -...
python
def update_sdb(self, sdb_id, owner=None, description=None, user_group_permissions=None, iam_principal_permissions=None): """ Update a safe deposit box. Keyword arguments: owner (string) -- AD group that owns the safe deposit box description (string) -...
Update a safe deposit box. Keyword arguments: owner (string) -- AD group that owns the safe deposit box description (string) -- Description of the safe deposit box user_group_permissions (list) -- list of dictionaries containing the key name and maybe role_id ia...
https://github.com/Nike-Inc/cerberus-python-client/blob/ef38356822e722fcb6a6ed4a1b38a5b493e753ae/cerberus/client.py#L293-L329
Nike-Inc/cerberus-python-client
cerberus/client.py
CerberusClient.delete_file
def delete_file(self, secure_data_path): """Delete a file at the given secure data path""" secret_resp = delete_with_retry(self.cerberus_url + '/v1/secure-file/' + secure_data_path, headers=self.HEADERS) throw_if_bad_response(secret_resp) return secr...
python
def delete_file(self, secure_data_path): """Delete a file at the given secure data path""" secret_resp = delete_with_retry(self.cerberus_url + '/v1/secure-file/' + secure_data_path, headers=self.HEADERS) throw_if_bad_response(secret_resp) return secr...
Delete a file at the given secure data path
https://github.com/Nike-Inc/cerberus-python-client/blob/ef38356822e722fcb6a6ed4a1b38a5b493e753ae/cerberus/client.py#L332-L337
Nike-Inc/cerberus-python-client
cerberus/client.py
CerberusClient.get_file_metadata
def get_file_metadata(self, secure_data_path, version=None): """Get just the metadata for a file, not the content""" if not version: version = "CURRENT" payload = {'versionId': str(version)} secret_resp = head_with_retry(str.join('', [self.cerberus_url, '/v1/secure-file/', s...
python
def get_file_metadata(self, secure_data_path, version=None): """Get just the metadata for a file, not the content""" if not version: version = "CURRENT" payload = {'versionId': str(version)} secret_resp = head_with_retry(str.join('', [self.cerberus_url, '/v1/secure-file/', s...
Get just the metadata for a file, not the content
https://github.com/Nike-Inc/cerberus-python-client/blob/ef38356822e722fcb6a6ed4a1b38a5b493e753ae/cerberus/client.py#L339-L350
Nike-Inc/cerberus-python-client
cerberus/client.py
CerberusClient._parse_metadata_filename
def _parse_metadata_filename(self, metadata): """ Parse the header metadata to pull out the filename and then store it under the key 'filename' """ index = metadata['Content-Disposition'].index('=')+1 metadata['filename'] = metadata['Content-Disposition'][index:].replace('"', '')...
python
def _parse_metadata_filename(self, metadata): """ Parse the header metadata to pull out the filename and then store it under the key 'filename' """ index = metadata['Content-Disposition'].index('=')+1 metadata['filename'] = metadata['Content-Disposition'][index:].replace('"', '')...
Parse the header metadata to pull out the filename and then store it under the key 'filename'
https://github.com/Nike-Inc/cerberus-python-client/blob/ef38356822e722fcb6a6ed4a1b38a5b493e753ae/cerberus/client.py#L371-L377
Nike-Inc/cerberus-python-client
cerberus/client.py
CerberusClient.get_file
def get_file(self, secure_data_path, version=None): """ Return a requests.structures.CaseInsensitiveDict object containing a file and the metadata/header information around it. The binary data of the file is under the key 'data' """ query = self._get_file(secure_data_pa...
python
def get_file(self, secure_data_path, version=None): """ Return a requests.structures.CaseInsensitiveDict object containing a file and the metadata/header information around it. The binary data of the file is under the key 'data' """ query = self._get_file(secure_data_pa...
Return a requests.structures.CaseInsensitiveDict object containing a file and the metadata/header information around it. The binary data of the file is under the key 'data'
https://github.com/Nike-Inc/cerberus-python-client/blob/ef38356822e722fcb6a6ed4a1b38a5b493e753ae/cerberus/client.py#L379-L392
Nike-Inc/cerberus-python-client
cerberus/client.py
CerberusClient.get_file_versions
def get_file_versions(self, secure_data_path, limit=None, offset=None): """ Get versions of a particular file This is just a shim to get_secret_versions secure_data_path -- full path to the file in the safety deposit box limit -- Default(100), limits how many records to be retur...
python
def get_file_versions(self, secure_data_path, limit=None, offset=None): """ Get versions of a particular file This is just a shim to get_secret_versions secure_data_path -- full path to the file in the safety deposit box limit -- Default(100), limits how many records to be retur...
Get versions of a particular file This is just a shim to get_secret_versions secure_data_path -- full path to the file in the safety deposit box limit -- Default(100), limits how many records to be returned from the api at once. offset -- Default(0), used for pagination. Will request r...
https://github.com/Nike-Inc/cerberus-python-client/blob/ef38356822e722fcb6a6ed4a1b38a5b493e753ae/cerberus/client.py#L405-L415
Nike-Inc/cerberus-python-client
cerberus/client.py
CerberusClient._get_all_file_version_ids
def _get_all_file_version_ids(self, secure_data_path, limit=None): """ Convenience function that returns a generator that will paginate over the file version ids secure_data_path -- full path to the file in the safety deposit box limit -- Default(100), limits how many records to be retur...
python
def _get_all_file_version_ids(self, secure_data_path, limit=None): """ Convenience function that returns a generator that will paginate over the file version ids secure_data_path -- full path to the file in the safety deposit box limit -- Default(100), limits how many records to be retur...
Convenience function that returns a generator that will paginate over the file version ids secure_data_path -- full path to the file in the safety deposit box limit -- Default(100), limits how many records to be returned from the api at once.
https://github.com/Nike-Inc/cerberus-python-client/blob/ef38356822e722fcb6a6ed4a1b38a5b493e753ae/cerberus/client.py#L417-L431
Nike-Inc/cerberus-python-client
cerberus/client.py
CerberusClient._get_all_file_versions
def _get_all_file_versions(self, secure_data_path, limit=None): """ Convenience function that returns a generator yielding the contents of all versions of a file and its version info secure_data_path -- full path to the file in the safety deposit box limit -- Default(100), limit...
python
def _get_all_file_versions(self, secure_data_path, limit=None): """ Convenience function that returns a generator yielding the contents of all versions of a file and its version info secure_data_path -- full path to the file in the safety deposit box limit -- Default(100), limit...
Convenience function that returns a generator yielding the contents of all versions of a file and its version info secure_data_path -- full path to the file in the safety deposit box limit -- Default(100), limits how many records to be returned from the api at once.
https://github.com/Nike-Inc/cerberus-python-client/blob/ef38356822e722fcb6a6ed4a1b38a5b493e753ae/cerberus/client.py#L433-L443
Nike-Inc/cerberus-python-client
cerberus/client.py
CerberusClient.list_files
def list_files(self, secure_data_path, limit=None, offset=None): """Return the list of files in the path. May need to be paginated""" # Make sure that limit and offset are in range. # Set the normal defaults if not limit or limit <= 0: limit = 100 if not offset or ...
python
def list_files(self, secure_data_path, limit=None, offset=None): """Return the list of files in the path. May need to be paginated""" # Make sure that limit and offset are in range. # Set the normal defaults if not limit or limit <= 0: limit = 100 if not offset or ...
Return the list of files in the path. May need to be paginated
https://github.com/Nike-Inc/cerberus-python-client/blob/ef38356822e722fcb6a6ed4a1b38a5b493e753ae/cerberus/client.py#L445-L464
Nike-Inc/cerberus-python-client
cerberus/client.py
CerberusClient.put_file
def put_file(self, secure_data_path, filehandle, content_type=None): """ Upload a file to a secure data path provided Keyword arguments: secure_data_path -- full path in the safety deposit box that contains the file key to store things under filehandle -- Pass an opened filehand...
python
def put_file(self, secure_data_path, filehandle, content_type=None): """ Upload a file to a secure data path provided Keyword arguments: secure_data_path -- full path in the safety deposit box that contains the file key to store things under filehandle -- Pass an opened filehand...
Upload a file to a secure data path provided Keyword arguments: secure_data_path -- full path in the safety deposit box that contains the file key to store things under filehandle -- Pass an opened filehandle to the file you want to upload. Make sure that the file was opened in binar...
https://github.com/Nike-Inc/cerberus-python-client/blob/ef38356822e722fcb6a6ed4a1b38a5b493e753ae/cerberus/client.py#L466-L493
Nike-Inc/cerberus-python-client
cerberus/client.py
CerberusClient.get_secret
def get_secret(self, secure_data_path, key, version=None): """ (Deprecated)Return the secret based on the secure data path and key This method is deprecated because it misleads users into thinking they're only getting one value from Cerberus when in reality they're getting all values, f...
python
def get_secret(self, secure_data_path, key, version=None): """ (Deprecated)Return the secret based on the secure data path and key This method is deprecated because it misleads users into thinking they're only getting one value from Cerberus when in reality they're getting all values, f...
(Deprecated)Return the secret based on the secure data path and key This method is deprecated because it misleads users into thinking they're only getting one value from Cerberus when in reality they're getting all values, from which a single value is returned. Use get_secrets_data(secure_data_...
https://github.com/Nike-Inc/cerberus-python-client/blob/ef38356822e722fcb6a6ed4a1b38a5b493e753ae/cerberus/client.py#L503-L521
Nike-Inc/cerberus-python-client
cerberus/client.py
CerberusClient._get_secrets
def _get_secrets(self, secure_data_path, version=None): """ Return full json secrets based on the secure data path Keyword arguments: secure_data_path (string) -- full path in the secret deposit box that contains the key /shared/sdb-path/secret ...
python
def _get_secrets(self, secure_data_path, version=None): """ Return full json secrets based on the secure data path Keyword arguments: secure_data_path (string) -- full path in the secret deposit box that contains the key /shared/sdb-path/secret ...
Return full json secrets based on the secure data path Keyword arguments: secure_data_path (string) -- full path in the secret deposit box that contains the key /shared/sdb-path/secret
https://github.com/Nike-Inc/cerberus-python-client/blob/ef38356822e722fcb6a6ed4a1b38a5b493e753ae/cerberus/client.py#L523-L539
Nike-Inc/cerberus-python-client
cerberus/client.py
CerberusClient.get_secrets
def get_secrets(self, secure_data_path, version=None): """(Deprecated)Return json secrets based on the secure data path This method is deprecated because an addition step of reading value with ['data'] key from the returned data is required to get secrets, which contradicts the method name. ...
python
def get_secrets(self, secure_data_path, version=None): """(Deprecated)Return json secrets based on the secure data path This method is deprecated because an addition step of reading value with ['data'] key from the returned data is required to get secrets, which contradicts the method name. ...
(Deprecated)Return json secrets based on the secure data path This method is deprecated because an addition step of reading value with ['data'] key from the returned data is required to get secrets, which contradicts the method name. Use get_secrets_data(secure_data_path) instead. (See ...
https://github.com/Nike-Inc/cerberus-python-client/blob/ef38356822e722fcb6a6ed4a1b38a5b493e753ae/cerberus/client.py#L541-L553
Nike-Inc/cerberus-python-client
cerberus/client.py
CerberusClient.get_secret_versions
def get_secret_versions(self, secure_data_path, limit=None, offset=None): """ Get versions of a particular secret key secure_data_path -- full path to the key in the safety deposit box limit -- Default(100), limits how many records to be returned from the api at once. offset -- ...
python
def get_secret_versions(self, secure_data_path, limit=None, offset=None): """ Get versions of a particular secret key secure_data_path -- full path to the key in the safety deposit box limit -- Default(100), limits how many records to be returned from the api at once. offset -- ...
Get versions of a particular secret key secure_data_path -- full path to the key in the safety deposit box limit -- Default(100), limits how many records to be returned from the api at once. offset -- Default(0), used for pagination. Will request records from the given offset.
https://github.com/Nike-Inc/cerberus-python-client/blob/ef38356822e722fcb6a6ed4a1b38a5b493e753ae/cerberus/client.py#L564-L585
Nike-Inc/cerberus-python-client
cerberus/client.py
CerberusClient._get_all_secret_version_ids
def _get_all_secret_version_ids(self, secure_data_path, limit=None): """ Convenience function that returns a generator that will paginate over the secret version ids secure_data_path -- full path to the key in the safety deposit box limit -- Default(100), limits how many records to be re...
python
def _get_all_secret_version_ids(self, secure_data_path, limit=None): """ Convenience function that returns a generator that will paginate over the secret version ids secure_data_path -- full path to the key in the safety deposit box limit -- Default(100), limits how many records to be re...
Convenience function that returns a generator that will paginate over the secret version ids secure_data_path -- full path to the key in the safety deposit box limit -- Default(100), limits how many records to be returned from the api at once.
https://github.com/Nike-Inc/cerberus-python-client/blob/ef38356822e722fcb6a6ed4a1b38a5b493e753ae/cerberus/client.py#L587-L601
Nike-Inc/cerberus-python-client
cerberus/client.py
CerberusClient._get_all_secret_versions
def _get_all_secret_versions(self, secure_data_path, limit=None): """ Convenience function that returns a generator yielding the contents of secrets and their version info secure_data_path -- full path to the key in the safety deposit box limit -- Default(100), limits how many records to...
python
def _get_all_secret_versions(self, secure_data_path, limit=None): """ Convenience function that returns a generator yielding the contents of secrets and their version info secure_data_path -- full path to the key in the safety deposit box limit -- Default(100), limits how many records to...
Convenience function that returns a generator yielding the contents of secrets and their version info secure_data_path -- full path to the key in the safety deposit box limit -- Default(100), limits how many records to be returned from the api at once.
https://github.com/Nike-Inc/cerberus-python-client/blob/ef38356822e722fcb6a6ed4a1b38a5b493e753ae/cerberus/client.py#L603-L611
Nike-Inc/cerberus-python-client
cerberus/client.py
CerberusClient.list_secrets
def list_secrets(self, secure_data_path): """Return json secrets based on the secure_data_path, this will list keys in a folder""" # Because of the addition of versionId and the way URLs are constructed, secure_data_path should # always end in a '/'. secure_data_path = self._add_slash(...
python
def list_secrets(self, secure_data_path): """Return json secrets based on the secure_data_path, this will list keys in a folder""" # Because of the addition of versionId and the way URLs are constructed, secure_data_path should # always end in a '/'. secure_data_path = self._add_slash(...
Return json secrets based on the secure_data_path, this will list keys in a folder
https://github.com/Nike-Inc/cerberus-python-client/blob/ef38356822e722fcb6a6ed4a1b38a5b493e753ae/cerberus/client.py#L613-L622
Nike-Inc/cerberus-python-client
cerberus/client.py
CerberusClient.put_secret
def put_secret(self, secure_data_path, secret, merge=True): """Write secret(s) to a secure data path provided a dictionary of key/values Keyword arguments: secure_data_path -- full path in the safety deposit box that contains the key secret -- A dictionary containing key/values to be wr...
python
def put_secret(self, secure_data_path, secret, merge=True): """Write secret(s) to a secure data path provided a dictionary of key/values Keyword arguments: secure_data_path -- full path in the safety deposit box that contains the key secret -- A dictionary containing key/values to be wr...
Write secret(s) to a secure data path provided a dictionary of key/values Keyword arguments: secure_data_path -- full path in the safety deposit box that contains the key secret -- A dictionary containing key/values to be written at the secure data path merge -- Boolean that determines ...
https://github.com/Nike-Inc/cerberus-python-client/blob/ef38356822e722fcb6a6ed4a1b38a5b493e753ae/cerberus/client.py#L624-L643
Nike-Inc/cerberus-python-client
cerberus/client.py
CerberusClient.secret_merge
def secret_merge(self, secure_data_path, key): """Compare key/values at secure_data_path and merges them. New values will overwrite old.""" get_resp = get_with_retry(self.cerberus_url + '/v1/secret/' + secure_data_path, headers=self.HEADERS) temp_key = {} # Ignore a return of 404 since ...
python
def secret_merge(self, secure_data_path, key): """Compare key/values at secure_data_path and merges them. New values will overwrite old.""" get_resp = get_with_retry(self.cerberus_url + '/v1/secret/' + secure_data_path, headers=self.HEADERS) temp_key = {} # Ignore a return of 404 since ...
Compare key/values at secure_data_path and merges them. New values will overwrite old.
https://github.com/Nike-Inc/cerberus-python-client/blob/ef38356822e722fcb6a6ed4a1b38a5b493e753ae/cerberus/client.py#L645-L665
Nike-Inc/cerberus-python-client
cerberus/aws_auth.py
AWSAuth._get_v4_signed_headers
def _get_v4_signed_headers(self): """Returns V4 signed get-caller-identity request headers""" if self.aws_session is None: boto_session = session.Session() creds = boto_session.get_credentials() else: creds = self.aws_session.get_credentials() if creds...
python
def _get_v4_signed_headers(self): """Returns V4 signed get-caller-identity request headers""" if self.aws_session is None: boto_session = session.Session() creds = boto_session.get_credentials() else: creds = self.aws_session.get_credentials() if creds...
Returns V4 signed get-caller-identity request headers
https://github.com/Nike-Inc/cerberus-python-client/blob/ef38356822e722fcb6a6ed4a1b38a5b493e753ae/cerberus/aws_auth.py#L39-L57
Nike-Inc/cerberus-python-client
cerberus/aws_auth.py
AWSAuth.get_token
def get_token(self): """Returns a client token from Cerberus""" signed_headers = self._get_v4_signed_headers() for header in self.HEADERS: signed_headers[header] = self.HEADERS[header] resp = post_with_retry(self.cerberus_url + '/v2/auth/sts-identity', headers=signed_headers...
python
def get_token(self): """Returns a client token from Cerberus""" signed_headers = self._get_v4_signed_headers() for header in self.HEADERS: signed_headers[header] = self.HEADERS[header] resp = post_with_retry(self.cerberus_url + '/v2/auth/sts-identity', headers=signed_headers...
Returns a client token from Cerberus
https://github.com/Nike-Inc/cerberus-python-client/blob/ef38356822e722fcb6a6ed4a1b38a5b493e753ae/cerberus/aws_auth.py#L59-L74
quintusdias/glymur
glymur/_tiff.py
tiff_header
def tiff_header(read_buffer): """ Interpret the uuid raw data as a tiff header. """ # First 8 should be (73, 73, 42, 8) or (77, 77, 42, 8) data = struct.unpack('BB', read_buffer[0:2]) if data[0] == 73 and data[1] == 73: # little endian endian = '<' elif data[0] == 77 and data...
python
def tiff_header(read_buffer): """ Interpret the uuid raw data as a tiff header. """ # First 8 should be (73, 73, 42, 8) or (77, 77, 42, 8) data = struct.unpack('BB', read_buffer[0:2]) if data[0] == 73 and data[1] == 73: # little endian endian = '<' elif data[0] == 77 and data...
Interpret the uuid raw data as a tiff header.
https://github.com/quintusdias/glymur/blob/8b8fb091130fff00f1028dc82219e69e3f9baf6d/glymur/_tiff.py#L11-L36
quintusdias/glymur
glymur/_tiff.py
Ifd.parse_tag
def parse_tag(self, dtype, count, offset_buf): """Interpret an Exif image tag data payload. """ try: fmt = self.datatype2fmt[dtype][0] * count payload_size = self.datatype2fmt[dtype][1] * count except KeyError: msg = 'Invalid TIFF tag datatype ({0}).'....
python
def parse_tag(self, dtype, count, offset_buf): """Interpret an Exif image tag data payload. """ try: fmt = self.datatype2fmt[dtype][0] * count payload_size = self.datatype2fmt[dtype][1] * count except KeyError: msg = 'Invalid TIFF tag datatype ({0}).'....
Interpret an Exif image tag data payload.
https://github.com/quintusdias/glymur/blob/8b8fb091130fff00f1028dc82219e69e3f9baf6d/glymur/_tiff.py#L90-L127
quintusdias/glymur
glymur/_tiff.py
Ifd.post_process
def post_process(self, tagnum2name): """Map the tag name instead of tag number to the tag value. """ for tag, value in self.raw_ifd.items(): try: tag_name = tagnum2name[tag] except KeyError: # Ok, we don't recognize this tag. Just use the ...
python
def post_process(self, tagnum2name): """Map the tag name instead of tag number to the tag value. """ for tag, value in self.raw_ifd.items(): try: tag_name = tagnum2name[tag] except KeyError: # Ok, we don't recognize this tag. Just use the ...
Map the tag name instead of tag number to the tag value.
https://github.com/quintusdias/glymur/blob/8b8fb091130fff00f1028dc82219e69e3f9baf6d/glymur/_tiff.py#L129-L140
keenlabs/KeenClient-Python
keen/saved_queries.py
SavedQueriesInterface.all
def all(self): """ Gets all saved queries for a project from the Keen IO API. Master key must be set. """ response = self._get_json(HTTPMethods.GET, self.saved_query_url, self._get_master_key()) return response
python
def all(self): """ Gets all saved queries for a project from the Keen IO API. Master key must be set. """ response = self._get_json(HTTPMethods.GET, self.saved_query_url, self._get_master_key()) return response
Gets all saved queries for a project from the Keen IO API. Master key must be set.
https://github.com/keenlabs/KeenClient-Python/blob/266387c3376d1e000d117e17c45045ae3439d43f/keen/saved_queries.py#L24-L32
keenlabs/KeenClient-Python
keen/saved_queries.py
SavedQueriesInterface.get
def get(self, query_name): """ Gets a single saved query for a project from the Keen IO API given a query name. Master key must be set. """ url = "{0}/{1}".format(self.saved_query_url, query_name) response = self._get_json(HTTPMethods.GET, url, self._get_master_k...
python
def get(self, query_name): """ Gets a single saved query for a project from the Keen IO API given a query name. Master key must be set. """ url = "{0}/{1}".format(self.saved_query_url, query_name) response = self._get_json(HTTPMethods.GET, url, self._get_master_k...
Gets a single saved query for a project from the Keen IO API given a query name. Master key must be set.
https://github.com/keenlabs/KeenClient-Python/blob/266387c3376d1e000d117e17c45045ae3439d43f/keen/saved_queries.py#L35-L45
keenlabs/KeenClient-Python
keen/saved_queries.py
SavedQueriesInterface.results
def results(self, query_name): """ Gets a single saved query with a 'result' object for a project from the Keen IO API given a query name. Read or Master key must be set. """ url = "{0}/{1}/result".format(self.saved_query_url, query_name) response = self._get_jso...
python
def results(self, query_name): """ Gets a single saved query with a 'result' object for a project from the Keen IO API given a query name. Read or Master key must be set. """ url = "{0}/{1}/result".format(self.saved_query_url, query_name) response = self._get_jso...
Gets a single saved query with a 'result' object for a project from the Keen IO API given a query name. Read or Master key must be set.
https://github.com/keenlabs/KeenClient-Python/blob/266387c3376d1e000d117e17c45045ae3439d43f/keen/saved_queries.py#L48-L58
keenlabs/KeenClient-Python
keen/saved_queries.py
SavedQueriesInterface.create
def create(self, query_name, saved_query): """ Creates the saved query via a PUT request to Keen IO Saved Query endpoint. Master key must be set. """ url = "{0}/{1}".format(self.saved_query_url, query_name) payload = saved_query # To support clients that may have...
python
def create(self, query_name, saved_query): """ Creates the saved query via a PUT request to Keen IO Saved Query endpoint. Master key must be set. """ url = "{0}/{1}".format(self.saved_query_url, query_name) payload = saved_query # To support clients that may have...
Creates the saved query via a PUT request to Keen IO Saved Query endpoint. Master key must be set.
https://github.com/keenlabs/KeenClient-Python/blob/266387c3376d1e000d117e17c45045ae3439d43f/keen/saved_queries.py#L61-L78
keenlabs/KeenClient-Python
keen/saved_queries.py
SavedQueriesInterface.update
def update(self, query_name, saved_query_attributes): """ Given a dict of attributes to be updated, update only those attributes in the Saved Query at the resource given by 'query_name'. This will perform two HTTP requests--one to fetch the query definition, and one to set the ne...
python
def update(self, query_name, saved_query_attributes): """ Given a dict of attributes to be updated, update only those attributes in the Saved Query at the resource given by 'query_name'. This will perform two HTTP requests--one to fetch the query definition, and one to set the ne...
Given a dict of attributes to be updated, update only those attributes in the Saved Query at the resource given by 'query_name'. This will perform two HTTP requests--one to fetch the query definition, and one to set the new attributes. This method will intend to preserve any other proper...
https://github.com/keenlabs/KeenClient-Python/blob/266387c3376d1e000d117e17c45045ae3439d43f/keen/saved_queries.py#L93-L139
keenlabs/KeenClient-Python
keen/saved_queries.py
SavedQueriesInterface.delete
def delete(self, query_name): """ Deletes a saved query from a project with a query name. Master key must be set. """ url = "{0}/{1}".format(self.saved_query_url, query_name) self._get_json(HTTPMethods.DELETE, url, self._get_master_key()) return True
python
def delete(self, query_name): """ Deletes a saved query from a project with a query name. Master key must be set. """ url = "{0}/{1}".format(self.saved_query_url, query_name) self._get_json(HTTPMethods.DELETE, url, self._get_master_key()) return True
Deletes a saved query from a project with a query name. Master key must be set.
https://github.com/keenlabs/KeenClient-Python/blob/266387c3376d1e000d117e17c45045ae3439d43f/keen/saved_queries.py#L142-L151
keenlabs/KeenClient-Python
keen/scoped_keys.py
pad_aes256
def pad_aes256(s): """ Pads an input string to a given block size. :param s: string :returns: The padded string. """ if len(s) % AES.block_size == 0: return s return Padding.appendPadding(s, blocksize=AES.block_size)
python
def pad_aes256(s): """ Pads an input string to a given block size. :param s: string :returns: The padded string. """ if len(s) % AES.block_size == 0: return s return Padding.appendPadding(s, blocksize=AES.block_size)
Pads an input string to a given block size. :param s: string :returns: The padded string.
https://github.com/keenlabs/KeenClient-Python/blob/266387c3376d1e000d117e17c45045ae3439d43f/keen/scoped_keys.py#L23-L32
keenlabs/KeenClient-Python
keen/scoped_keys.py
unpad_aes256
def unpad_aes256(s): """ Removes padding from an input string based on a given block size. :param s: string :returns: The unpadded string. """ if not s: return s try: return Padding.removePadding(s, blocksize=AES.block_size) except AssertionError: # if there's an...
python
def unpad_aes256(s): """ Removes padding from an input string based on a given block size. :param s: string :returns: The unpadded string. """ if not s: return s try: return Padding.removePadding(s, blocksize=AES.block_size) except AssertionError: # if there's an...
Removes padding from an input string based on a given block size. :param s: string :returns: The unpadded string.
https://github.com/keenlabs/KeenClient-Python/blob/266387c3376d1e000d117e17c45045ae3439d43f/keen/scoped_keys.py#L35-L48
keenlabs/KeenClient-Python
keen/scoped_keys.py
old_pad
def old_pad(s): """ Pads an input string to a given block size. :param s: string :returns: The padded string. """ if len(s) % OLD_BLOCK_SIZE == 0: return s return Padding.appendPadding(s, blocksize=OLD_BLOCK_SIZE)
python
def old_pad(s): """ Pads an input string to a given block size. :param s: string :returns: The padded string. """ if len(s) % OLD_BLOCK_SIZE == 0: return s return Padding.appendPadding(s, blocksize=OLD_BLOCK_SIZE)
Pads an input string to a given block size. :param s: string :returns: The padded string.
https://github.com/keenlabs/KeenClient-Python/blob/266387c3376d1e000d117e17c45045ae3439d43f/keen/scoped_keys.py#L51-L60
keenlabs/KeenClient-Python
keen/scoped_keys.py
old_unpad
def old_unpad(s): """ Removes padding from an input string based on a given block size. :param s: string :returns: The unpadded string. """ if not s: return s try: return Padding.removePadding(s, blocksize=OLD_BLOCK_SIZE) except AssertionError: # if there's an er...
python
def old_unpad(s): """ Removes padding from an input string based on a given block size. :param s: string :returns: The unpadded string. """ if not s: return s try: return Padding.removePadding(s, blocksize=OLD_BLOCK_SIZE) except AssertionError: # if there's an er...
Removes padding from an input string based on a given block size. :param s: string :returns: The unpadded string.
https://github.com/keenlabs/KeenClient-Python/blob/266387c3376d1e000d117e17c45045ae3439d43f/keen/scoped_keys.py#L63-L76
keenlabs/KeenClient-Python
keen/scoped_keys.py
encode_aes256
def encode_aes256(key, plaintext): """ Utility method to encode some given plaintext with the given key. Important thing to note: This is not a general purpose encryption method - it has specific semantics (see below for details). Takes the given hex string key and converts it to a 256 bit binary ...
python
def encode_aes256(key, plaintext): """ Utility method to encode some given plaintext with the given key. Important thing to note: This is not a general purpose encryption method - it has specific semantics (see below for details). Takes the given hex string key and converts it to a 256 bit binary ...
Utility method to encode some given plaintext with the given key. Important thing to note: This is not a general purpose encryption method - it has specific semantics (see below for details). Takes the given hex string key and converts it to a 256 bit binary blob. Then pads the given plaintext to AES ...
https://github.com/keenlabs/KeenClient-Python/blob/266387c3376d1e000d117e17c45045ae3439d43f/keen/scoped_keys.py#L80-L107
keenlabs/KeenClient-Python
keen/scoped_keys.py
decode_aes256
def decode_aes256(key, iv_plus_encrypted): """ Utility method to decode a payload consisting of the hexed IV + the hexed ciphertext using the given key. See above for more details. :param key: string, 64 hex characters long :param iv_plus_encrypted: string, a hexed IV + hexed ciphertext """ ...
python
def decode_aes256(key, iv_plus_encrypted): """ Utility method to decode a payload consisting of the hexed IV + the hexed ciphertext using the given key. See above for more details. :param key: string, 64 hex characters long :param iv_plus_encrypted: string, a hexed IV + hexed ciphertext """ ...
Utility method to decode a payload consisting of the hexed IV + the hexed ciphertext using the given key. See above for more details. :param key: string, 64 hex characters long :param iv_plus_encrypted: string, a hexed IV + hexed ciphertext
https://github.com/keenlabs/KeenClient-Python/blob/266387c3376d1e000d117e17c45045ae3439d43f/keen/scoped_keys.py#L110-L131
keenlabs/KeenClient-Python
keen/scoped_keys.py
old_encode_aes
def old_encode_aes(key, plaintext): """ Utility method to encode some given plaintext with the given key. Important thing to note: This is not a general purpose encryption method - it has specific semantics (see below for details). Takes the given key, pads it to 32 bytes. Then takes the given pla...
python
def old_encode_aes(key, plaintext): """ Utility method to encode some given plaintext with the given key. Important thing to note: This is not a general purpose encryption method - it has specific semantics (see below for details). Takes the given key, pads it to 32 bytes. Then takes the given pla...
Utility method to encode some given plaintext with the given key. Important thing to note: This is not a general purpose encryption method - it has specific semantics (see below for details). Takes the given key, pads it to 32 bytes. Then takes the given plaintext and pads that to a 32 byte block size...
https://github.com/keenlabs/KeenClient-Python/blob/266387c3376d1e000d117e17c45045ae3439d43f/keen/scoped_keys.py#L134-L157
keenlabs/KeenClient-Python
keen/scoped_keys.py
old_decode_aes
def old_decode_aes(key, iv_plus_encrypted): """ Utility method to decode a payload consisting of the hexed IV + the hexed ciphertext using the given key. See above for more details. :param key: string, <= 32 bytes long :param iv_plus_encrypted: string, a hexed IV + hexed ciphertext """ # gr...
python
def old_decode_aes(key, iv_plus_encrypted): """ Utility method to decode a payload consisting of the hexed IV + the hexed ciphertext using the given key. See above for more details. :param key: string, <= 32 bytes long :param iv_plus_encrypted: string, a hexed IV + hexed ciphertext """ # gr...
Utility method to decode a payload consisting of the hexed IV + the hexed ciphertext using the given key. See above for more details. :param key: string, <= 32 bytes long :param iv_plus_encrypted: string, a hexed IV + hexed ciphertext
https://github.com/keenlabs/KeenClient-Python/blob/266387c3376d1e000d117e17c45045ae3439d43f/keen/scoped_keys.py#L160-L180
Nike-Inc/cerberus-python-client
cerberus/user_auth.py
UserAuth.get_auth
def get_auth(self): """Returns auth response which has client token unless MFA is required""" auth_resp = get_with_retry(self.cerberus_url + '/v2/auth/user', auth=(self.username, self.password), headers=self.HEADERS) if auth_resp...
python
def get_auth(self): """Returns auth response which has client token unless MFA is required""" auth_resp = get_with_retry(self.cerberus_url + '/v2/auth/user', auth=(self.username, self.password), headers=self.HEADERS) if auth_resp...
Returns auth response which has client token unless MFA is required
https://github.com/Nike-Inc/cerberus-python-client/blob/ef38356822e722fcb6a6ed4a1b38a5b493e753ae/cerberus/user_auth.py#L32-L41
Nike-Inc/cerberus-python-client
cerberus/user_auth.py
UserAuth.get_token
def get_token(self): """sets client token from Cerberus""" auth_resp = self.get_auth() if auth_resp['status'] == 'mfa_req': token_resp = self.get_mfa(auth_resp) else: token_resp = auth_resp token = token_resp['data']['client_token']['client_token'] ...
python
def get_token(self): """sets client token from Cerberus""" auth_resp = self.get_auth() if auth_resp['status'] == 'mfa_req': token_resp = self.get_mfa(auth_resp) else: token_resp = auth_resp token = token_resp['data']['client_token']['client_token'] ...
sets client token from Cerberus
https://github.com/Nike-Inc/cerberus-python-client/blob/ef38356822e722fcb6a6ed4a1b38a5b493e753ae/cerberus/user_auth.py#L43-L53
Nike-Inc/cerberus-python-client
cerberus/user_auth.py
UserAuth.get_mfa
def get_mfa(self, auth_resp): """Gets MFA code from user and returns response which includes the client token""" devices = auth_resp['data']['devices'] if len(devices) == 1: # If there's only one option, don't show selection prompt selection = "0" x = 1 ...
python
def get_mfa(self, auth_resp): """Gets MFA code from user and returns response which includes the client token""" devices = auth_resp['data']['devices'] if len(devices) == 1: # If there's only one option, don't show selection prompt selection = "0" x = 1 ...
Gets MFA code from user and returns response which includes the client token
https://github.com/Nike-Inc/cerberus-python-client/blob/ef38356822e722fcb6a6ed4a1b38a5b493e753ae/cerberus/user_auth.py#L55-L91
quintusdias/glymur
glymur/jp2box.py
_parse_standard_flag
def _parse_standard_flag(read_buffer, mask_length): """Construct standard flag, standard mask data from the file. Specifically working on Reader Requirements box. Parameters ---------- fptr : file object File object for JP2K file. mask_length : int Length of standard mask flag ...
python
def _parse_standard_flag(read_buffer, mask_length): """Construct standard flag, standard mask data from the file. Specifically working on Reader Requirements box. Parameters ---------- fptr : file object File object for JP2K file. mask_length : int Length of standard mask flag ...
Construct standard flag, standard mask data from the file. Specifically working on Reader Requirements box. Parameters ---------- fptr : file object File object for JP2K file. mask_length : int Length of standard mask flag
https://github.com/quintusdias/glymur/blob/8b8fb091130fff00f1028dc82219e69e3f9baf6d/glymur/jp2box.py#L2391-L2418
quintusdias/glymur
glymur/jp2box.py
_parse_vendor_features
def _parse_vendor_features(read_buffer, mask_length): """Construct vendor features, vendor mask data from the file. Specifically working on Reader Requirements box. Parameters ---------- fptr : file object File object for JP2K file. mask_length : int Length of vendor mask flag ...
python
def _parse_vendor_features(read_buffer, mask_length): """Construct vendor features, vendor mask data from the file. Specifically working on Reader Requirements box. Parameters ---------- fptr : file object File object for JP2K file. mask_length : int Length of vendor mask flag ...
Construct vendor features, vendor mask data from the file. Specifically working on Reader Requirements box. Parameters ---------- fptr : file object File object for JP2K file. mask_length : int Length of vendor mask flag
https://github.com/quintusdias/glymur/blob/8b8fb091130fff00f1028dc82219e69e3f9baf6d/glymur/jp2box.py#L2421-L2452
quintusdias/glymur
glymur/jp2box.py
Jp2kBox._dispatch_validation_error
def _dispatch_validation_error(self, msg, writing=False): """Issue either a warning or an error depending on circumstance. If writing to file, then error out, as we do not wish to create bad JP2 files. If reading, then we should be more lenient and just warn. """ if writing: ...
python
def _dispatch_validation_error(self, msg, writing=False): """Issue either a warning or an error depending on circumstance. If writing to file, then error out, as we do not wish to create bad JP2 files. If reading, then we should be more lenient and just warn. """ if writing: ...
Issue either a warning or an error depending on circumstance. If writing to file, then error out, as we do not wish to create bad JP2 files. If reading, then we should be more lenient and just warn.
https://github.com/quintusdias/glymur/blob/8b8fb091130fff00f1028dc82219e69e3f9baf6d/glymur/jp2box.py#L99-L108
quintusdias/glymur
glymur/jp2box.py
Jp2kBox._str_superbox
def _str_superbox(self): """__str__ method for all superboxes.""" msg = Jp2kBox.__str__(self) for box in self.box: boxstr = str(box) # Indent the child boxes to make the association clear. msg += '\n' + self._indent(boxstr) return msg
python
def _str_superbox(self): """__str__ method for all superboxes.""" msg = Jp2kBox.__str__(self) for box in self.box: boxstr = str(box) # Indent the child boxes to make the association clear. msg += '\n' + self._indent(boxstr) return msg
__str__ method for all superboxes.
https://github.com/quintusdias/glymur/blob/8b8fb091130fff00f1028dc82219e69e3f9baf6d/glymur/jp2box.py#L116-L123
quintusdias/glymur
glymur/jp2box.py
Jp2kBox._indent
def _indent(self, textstr, indent_level=4): """ Indent a string. Textwrap's indent method only exists for 3.3 or above. In 2.7 we have to fake it. Parameters ---------- textstring : str String to be indented. indent_level : str N...
python
def _indent(self, textstr, indent_level=4): """ Indent a string. Textwrap's indent method only exists for 3.3 or above. In 2.7 we have to fake it. Parameters ---------- textstring : str String to be indented. indent_level : str N...
Indent a string. Textwrap's indent method only exists for 3.3 or above. In 2.7 we have to fake it. Parameters ---------- textstring : str String to be indented. indent_level : str Number of spaces of indentation to add. Returns ...
https://github.com/quintusdias/glymur/blob/8b8fb091130fff00f1028dc82219e69e3f9baf6d/glymur/jp2box.py#L125-L148
quintusdias/glymur
glymur/jp2box.py
Jp2kBox._write_superbox
def _write_superbox(self, fptr, box_id): """Write a superbox. Parameters ---------- fptr : file or file object Superbox (box of boxes) to be written to this file. box_id : bytes 4-byte sequence that identifies the superbox. """ # Write the...
python
def _write_superbox(self, fptr, box_id): """Write a superbox. Parameters ---------- fptr : file or file object Superbox (box of boxes) to be written to this file. box_id : bytes 4-byte sequence that identifies the superbox. """ # Write the...
Write a superbox. Parameters ---------- fptr : file or file object Superbox (box of boxes) to be written to this file. box_id : bytes 4-byte sequence that identifies the superbox.
https://github.com/quintusdias/glymur/blob/8b8fb091130fff00f1028dc82219e69e3f9baf6d/glymur/jp2box.py#L150-L169
quintusdias/glymur
glymur/jp2box.py
Jp2kBox._parse_this_box
def _parse_this_box(self, fptr, box_id, start, num_bytes): """Parse the current box. Parameters ---------- fptr : file Open file object, currently points to start of box payload, not the start of the box. box_id : str 4-letter identifier for t...
python
def _parse_this_box(self, fptr, box_id, start, num_bytes): """Parse the current box. Parameters ---------- fptr : file Open file object, currently points to start of box payload, not the start of the box. box_id : str 4-letter identifier for t...
Parse the current box. Parameters ---------- fptr : file Open file object, currently points to start of box payload, not the start of the box. box_id : str 4-letter identifier for the current box. start, num_bytes : int Byte offset...
https://github.com/quintusdias/glymur/blob/8b8fb091130fff00f1028dc82219e69e3f9baf6d/glymur/jp2box.py#L171-L218
quintusdias/glymur
glymur/jp2box.py
Jp2kBox.parse_superbox
def parse_superbox(self, fptr): """Parse a superbox (box consisting of nothing but other boxes. Parameters ---------- fptr : file Open file object. Returns ------- list List of top-level boxes in the JPEG 2000 file. """ s...
python
def parse_superbox(self, fptr): """Parse a superbox (box consisting of nothing but other boxes. Parameters ---------- fptr : file Open file object. Returns ------- list List of top-level boxes in the JPEG 2000 file. """ s...
Parse a superbox (box consisting of nothing but other boxes. Parameters ---------- fptr : file Open file object. Returns ------- list List of top-level boxes in the JPEG 2000 file.
https://github.com/quintusdias/glymur/blob/8b8fb091130fff00f1028dc82219e69e3f9baf6d/glymur/jp2box.py#L220-L288
quintusdias/glymur
glymur/jp2box.py
ColourSpecificationBox._validate
def _validate(self, writing=False): """Verify that the box obeys the specifications.""" if self.colorspace is not None and self.icc_profile is not None: msg = ("Colorspace and icc_profile cannot both be set when " "creating a ColourSpecificationBox.") self._dis...
python
def _validate(self, writing=False): """Verify that the box obeys the specifications.""" if self.colorspace is not None and self.icc_profile is not None: msg = ("Colorspace and icc_profile cannot both be set when " "creating a ColourSpecificationBox.") self._dis...
Verify that the box obeys the specifications.
https://github.com/quintusdias/glymur/blob/8b8fb091130fff00f1028dc82219e69e3f9baf6d/glymur/jp2box.py#L337-L358
quintusdias/glymur
glymur/jp2box.py
ColourSpecificationBox._write_validate
def _write_validate(self): """In addition to constructor validation steps, run validation steps for writing.""" if self.colorspace is None: msg = ("Writing colr boxes without enumerated " "colorspaces is not supported at this time.") self._dispatch_vali...
python
def _write_validate(self): """In addition to constructor validation steps, run validation steps for writing.""" if self.colorspace is None: msg = ("Writing colr boxes without enumerated " "colorspaces is not supported at this time.") self._dispatch_vali...
In addition to constructor validation steps, run validation steps for writing.
https://github.com/quintusdias/glymur/blob/8b8fb091130fff00f1028dc82219e69e3f9baf6d/glymur/jp2box.py#L360-L374
quintusdias/glymur
glymur/jp2box.py
ColourSpecificationBox.write
def write(self, fptr): """Write an Colour Specification box to file. """ self._write_validate() length = 15 if self.icc_profile is None else 11 + len(self.icc_profile) fptr.write(struct.pack('>I4s', length, b'colr')) read_buffer = struct.pack('>BBBI', ...
python
def write(self, fptr): """Write an Colour Specification box to file. """ self._write_validate() length = 15 if self.icc_profile is None else 11 + len(self.icc_profile) fptr.write(struct.pack('>I4s', length, b'colr')) read_buffer = struct.pack('>BBBI', ...
Write an Colour Specification box to file.
https://github.com/quintusdias/glymur/blob/8b8fb091130fff00f1028dc82219e69e3f9baf6d/glymur/jp2box.py#L436-L448
quintusdias/glymur
glymur/jp2box.py
ColourSpecificationBox.parse
def parse(cls, fptr, offset, length): """Parse JPEG 2000 color specification box. Parameters ---------- fptr : file Open file object. offset : int Start position of box in bytes. length : int Length of the box in bytes. Return...
python
def parse(cls, fptr, offset, length): """Parse JPEG 2000 color specification box. Parameters ---------- fptr : file Open file object. offset : int Start position of box in bytes. length : int Length of the box in bytes. Return...
Parse JPEG 2000 color specification box. Parameters ---------- fptr : file Open file object. offset : int Start position of box in bytes. length : int Length of the box in bytes. Returns ------- ColourSpecificationBox ...
https://github.com/quintusdias/glymur/blob/8b8fb091130fff00f1028dc82219e69e3f9baf6d/glymur/jp2box.py#L451-L501
quintusdias/glymur
glymur/jp2box.py
ChannelDefinitionBox._validate
def _validate(self, writing=False): """Verify that the box obeys the specifications.""" # channel type and association must be specified. if not ((len(self.index) == len(self.channel_type)) and (len(self.channel_type) == len(self.association))): msg = ("The length of ...
python
def _validate(self, writing=False): """Verify that the box obeys the specifications.""" # channel type and association must be specified. if not ((len(self.index) == len(self.channel_type)) and (len(self.channel_type) == len(self.association))): msg = ("The length of ...
Verify that the box obeys the specifications.
https://github.com/quintusdias/glymur/blob/8b8fb091130fff00f1028dc82219e69e3f9baf6d/glymur/jp2box.py#L541-L563
quintusdias/glymur
glymur/jp2box.py
ChannelDefinitionBox.write
def write(self, fptr): """Write a channel definition box to file. """ self._validate(writing=True) num_components = len(self.association) fptr.write(struct.pack('>I4s', 8 + 2 + num_components * 6, b'cdef')) fptr.write(struct.pack('>H', num_components)) for j in ra...
python
def write(self, fptr): """Write a channel definition box to file. """ self._validate(writing=True) num_components = len(self.association) fptr.write(struct.pack('>I4s', 8 + 2 + num_components * 6, b'cdef')) fptr.write(struct.pack('>H', num_components)) for j in ra...
Write a channel definition box to file.
https://github.com/quintusdias/glymur/blob/8b8fb091130fff00f1028dc82219e69e3f9baf6d/glymur/jp2box.py#L597-L608
quintusdias/glymur
glymur/jp2box.py
ChannelDefinitionBox.parse
def parse(cls, fptr, offset, length): """Parse component definition box. Parameters ---------- fptr : file Open file object. offset : int Start position of box in bytes. length : int Length of the box in bytes. Returns ...
python
def parse(cls, fptr, offset, length): """Parse component definition box. Parameters ---------- fptr : file Open file object. offset : int Start position of box in bytes. length : int Length of the box in bytes. Returns ...
Parse component definition box. Parameters ---------- fptr : file Open file object. offset : int Start position of box in bytes. length : int Length of the box in bytes. Returns ------- ComponentDefinitionBox ...
https://github.com/quintusdias/glymur/blob/8b8fb091130fff00f1028dc82219e69e3f9baf6d/glymur/jp2box.py#L611-L643
quintusdias/glymur
glymur/jp2box.py
ColourGroupBox._validate
def _validate(self, writing=True): """Verify that the box obeys the specifications.""" if any([box.box_id != 'colr' for box in self.box]): msg = ("Colour group boxes can only contain colour specification " "boxes.") self._dispatch_validation_error(msg, writing=...
python
def _validate(self, writing=True): """Verify that the box obeys the specifications.""" if any([box.box_id != 'colr' for box in self.box]): msg = ("Colour group boxes can only contain colour specification " "boxes.") self._dispatch_validation_error(msg, writing=...
Verify that the box obeys the specifications.
https://github.com/quintusdias/glymur/blob/8b8fb091130fff00f1028dc82219e69e3f9baf6d/glymur/jp2box.py#L744-L749
quintusdias/glymur
glymur/jp2box.py
ColourGroupBox.write
def write(self, fptr): """Write a colour group box to file. """ self._validate(writing=True) self._write_superbox(fptr, b'cgrp')
python
def write(self, fptr): """Write a colour group box to file. """ self._validate(writing=True) self._write_superbox(fptr, b'cgrp')
Write a colour group box to file.
https://github.com/quintusdias/glymur/blob/8b8fb091130fff00f1028dc82219e69e3f9baf6d/glymur/jp2box.py#L751-L755
quintusdias/glymur
glymur/jp2box.py
ComponentMappingBox.write
def write(self, fptr): """Write a Component Mapping box to file. """ length = 8 + 4 * len(self.component_index) write_buffer = struct.pack('>I4s', length, b'cmap') fptr.write(write_buffer) for j in range(len(self.component_index)): write_buffer = struct.pack(...
python
def write(self, fptr): """Write a Component Mapping box to file. """ length = 8 + 4 * len(self.component_index) write_buffer = struct.pack('>I4s', length, b'cmap') fptr.write(write_buffer) for j in range(len(self.component_index)): write_buffer = struct.pack(...
Write a Component Mapping box to file.
https://github.com/quintusdias/glymur/blob/8b8fb091130fff00f1028dc82219e69e3f9baf6d/glymur/jp2box.py#L914-L926
quintusdias/glymur
glymur/jp2box.py
ComponentMappingBox.parse
def parse(cls, fptr, offset, length): """Parse component mapping box. Parameters ---------- fptr : file Open file object. offset : int Start position of box in bytes. length : int Length of the box in bytes. Returns --...
python
def parse(cls, fptr, offset, length): """Parse component mapping box. Parameters ---------- fptr : file Open file object. offset : int Start position of box in bytes. length : int Length of the box in bytes. Returns --...
Parse component mapping box. Parameters ---------- fptr : file Open file object. offset : int Start position of box in bytes. length : int Length of the box in bytes. Returns ------- ComponentMappingBox Ins...
https://github.com/quintusdias/glymur/blob/8b8fb091130fff00f1028dc82219e69e3f9baf6d/glymur/jp2box.py#L929-L957
quintusdias/glymur
glymur/jp2box.py
ContiguousCodestreamBox.parse
def parse(cls, fptr, offset=0, length=0): """Parse a codestream box. Parameters ---------- fptr : file Open file object. offset : int Start position of box in bytes. length : int Length of the box in bytes. Returns ---...
python
def parse(cls, fptr, offset=0, length=0): """Parse a codestream box. Parameters ---------- fptr : file Open file object. offset : int Start position of box in bytes. length : int Length of the box in bytes. Returns ---...
Parse a codestream box. Parameters ---------- fptr : file Open file object. offset : int Start position of box in bytes. length : int Length of the box in bytes. Returns ------- ContiguousCodestreamBox Inst...
https://github.com/quintusdias/glymur/blob/8b8fb091130fff00f1028dc82219e69e3f9baf6d/glymur/jp2box.py#L1029-L1055
quintusdias/glymur
glymur/jp2box.py
DataReferenceBox._validate
def _validate(self, writing=False): """Verify that the box obeys the specifications.""" for box in self.DR: if box.box_id != 'url ': msg = ('Child boxes of a data reference box can only be data ' 'entry URL boxes.') self._dispatch_valida...
python
def _validate(self, writing=False): """Verify that the box obeys the specifications.""" for box in self.DR: if box.box_id != 'url ': msg = ('Child boxes of a data reference box can only be data ' 'entry URL boxes.') self._dispatch_valida...
Verify that the box obeys the specifications.
https://github.com/quintusdias/glymur/blob/8b8fb091130fff00f1028dc82219e69e3f9baf6d/glymur/jp2box.py#L1087-L1093
quintusdias/glymur
glymur/jp2box.py
DataReferenceBox.write
def write(self, fptr): """Write a Data Reference box to file. """ self._write_validate() # Very similar to the way a superbox is written. orig_pos = fptr.tell() fptr.write(struct.pack('>I4s', 0, b'dtbl')) # Write the number of data entry url boxes. write...
python
def write(self, fptr): """Write a Data Reference box to file. """ self._write_validate() # Very similar to the way a superbox is written. orig_pos = fptr.tell() fptr.write(struct.pack('>I4s', 0, b'dtbl')) # Write the number of data entry url boxes. write...
Write a Data Reference box to file.
https://github.com/quintusdias/glymur/blob/8b8fb091130fff00f1028dc82219e69e3f9baf6d/glymur/jp2box.py#L1103-L1122
quintusdias/glymur
glymur/jp2box.py
DataReferenceBox.parse
def parse(cls, fptr, offset, length): """Parse data reference box. Parameters ---------- fptr : file Open file object. offset : int Start position of box in bytes. length : int Length of the box in bytes. Returns -----...
python
def parse(cls, fptr, offset, length): """Parse data reference box. Parameters ---------- fptr : file Open file object. offset : int Start position of box in bytes. length : int Length of the box in bytes. Returns -----...
Parse data reference box. Parameters ---------- fptr : file Open file object. offset : int Start position of box in bytes. length : int Length of the box in bytes. Returns ------- DataReferenceBox Instance ...
https://github.com/quintusdias/glymur/blob/8b8fb091130fff00f1028dc82219e69e3f9baf6d/glymur/jp2box.py#L1146-L1189
quintusdias/glymur
glymur/jp2box.py
FileTypeBox._validate
def _validate(self, writing=False): """ Validate the box before writing to file. """ if self.brand not in ['jp2 ', 'jpx ']: msg = ("The file type brand was '{brand}'. " "It should be either 'jp2 ' or 'jpx '.") msg = msg.format(brand=self.brand)...
python
def _validate(self, writing=False): """ Validate the box before writing to file. """ if self.brand not in ['jp2 ', 'jpx ']: msg = ("The file type brand was '{brand}'. " "It should be either 'jp2 ' or 'jpx '.") msg = msg.format(brand=self.brand)...
Validate the box before writing to file.
https://github.com/quintusdias/glymur/blob/8b8fb091130fff00f1028dc82219e69e3f9baf6d/glymur/jp2box.py#L1255-L1277
quintusdias/glymur
glymur/jp2box.py
FileTypeBox.write
def write(self, fptr): """Write a File Type box to file. """ self._validate(writing=True) length = 16 + 4 * len(self.compatibility_list) fptr.write(struct.pack('>I4s', length, b'ftyp')) fptr.write(self.brand.encode()) fptr.write(struct.pack('>I', self.minor_versio...
python
def write(self, fptr): """Write a File Type box to file. """ self._validate(writing=True) length = 16 + 4 * len(self.compatibility_list) fptr.write(struct.pack('>I4s', length, b'ftyp')) fptr.write(self.brand.encode()) fptr.write(struct.pack('>I', self.minor_versio...
Write a File Type box to file.
https://github.com/quintusdias/glymur/blob/8b8fb091130fff00f1028dc82219e69e3f9baf6d/glymur/jp2box.py#L1279-L1289
quintusdias/glymur
glymur/jp2box.py
FileTypeBox.parse
def parse(cls, fptr, offset, length): """Parse JPEG 2000 file type box. Parameters ---------- f : file Open file object. offset : int Start position of box in bytes. length : int Length of the box in bytes. Returns ---...
python
def parse(cls, fptr, offset, length): """Parse JPEG 2000 file type box. Parameters ---------- f : file Open file object. offset : int Start position of box in bytes. length : int Length of the box in bytes. Returns ---...
Parse JPEG 2000 file type box. Parameters ---------- f : file Open file object. offset : int Start position of box in bytes. length : int Length of the box in bytes. Returns ------- FileTypeBox Instance of ...
https://github.com/quintusdias/glymur/blob/8b8fb091130fff00f1028dc82219e69e3f9baf6d/glymur/jp2box.py#L1292-L1333
quintusdias/glymur
glymur/jp2box.py
FragmentListBox._validate
def _validate(self, writing=False): """Validate internal correctness.""" if (((len(self.fragment_offset) != len(self.fragment_length)) or (len(self.fragment_length) != len(self.data_reference)))): msg = ("The lengths of the fragment offsets ({len_offsets}), " ...
python
def _validate(self, writing=False): """Validate internal correctness.""" if (((len(self.fragment_offset) != len(self.fragment_length)) or (len(self.fragment_length) != len(self.data_reference)))): msg = ("The lengths of the fragment offsets ({len_offsets}), " ...
Validate internal correctness.
https://github.com/quintusdias/glymur/blob/8b8fb091130fff00f1028dc82219e69e3f9baf6d/glymur/jp2box.py#L1363-L1379
quintusdias/glymur
glymur/jp2box.py
FragmentListBox.write
def write(self, fptr): """Write a fragment list box to file. """ self._validate(writing=True) num_items = len(self.fragment_offset) length = 8 + 2 + num_items * 14 fptr.write(struct.pack('>I4s', length, b'flst')) fptr.write(struct.pack('>H', num_items)) fo...
python
def write(self, fptr): """Write a fragment list box to file. """ self._validate(writing=True) num_items = len(self.fragment_offset) length = 8 + 2 + num_items * 14 fptr.write(struct.pack('>I4s', length, b'flst')) fptr.write(struct.pack('>H', num_items)) fo...
Write a fragment list box to file.
https://github.com/quintusdias/glymur/blob/8b8fb091130fff00f1028dc82219e69e3f9baf6d/glymur/jp2box.py#L1408-L1421
quintusdias/glymur
glymur/jp2box.py
FragmentListBox.parse
def parse(cls, fptr, offset, length): """Parse JPX free box. Parameters ---------- f : file Open file object. offset : int Start position of box in bytes. length : int Length of the box in bytes. Returns ------- ...
python
def parse(cls, fptr, offset, length): """Parse JPX free box. Parameters ---------- f : file Open file object. offset : int Start position of box in bytes. length : int Length of the box in bytes. Returns ------- ...
Parse JPX free box. Parameters ---------- f : file Open file object. offset : int Start position of box in bytes. length : int Length of the box in bytes. Returns ------- FragmentListBox Instance of the cur...
https://github.com/quintusdias/glymur/blob/8b8fb091130fff00f1028dc82219e69e3f9baf6d/glymur/jp2box.py#L1424-L1452
quintusdias/glymur
glymur/jp2box.py
FragmentTableBox._validate
def _validate(self, writing=False): """Self-validate the box before writing.""" box_ids = [box.box_id for box in self.box] if len(box_ids) != 1 or box_ids[0] != 'flst': msg = ("Fragment table boxes must have a single fragment list " "box as a child box.") ...
python
def _validate(self, writing=False): """Self-validate the box before writing.""" box_ids = [box.box_id for box in self.box] if len(box_ids) != 1 or box_ids[0] != 'flst': msg = ("Fragment table boxes must have a single fragment list " "box as a child box.") ...
Self-validate the box before writing.
https://github.com/quintusdias/glymur/blob/8b8fb091130fff00f1028dc82219e69e3f9baf6d/glymur/jp2box.py#L1515-L1521
quintusdias/glymur
glymur/jp2box.py
FragmentTableBox.write
def write(self, fptr): """Write a fragment table box to file. """ self._validate(writing=True) self._write_superbox(fptr, b'ftbl')
python
def write(self, fptr): """Write a fragment table box to file. """ self._validate(writing=True) self._write_superbox(fptr, b'ftbl')
Write a fragment table box to file.
https://github.com/quintusdias/glymur/blob/8b8fb091130fff00f1028dc82219e69e3f9baf6d/glymur/jp2box.py#L1523-L1527
quintusdias/glymur
glymur/jp2box.py
FreeBox.parse
def parse(cls, fptr, offset, length): """Parse JPX free box. Parameters ---------- f : file Open file object. offset : int Start position of box in bytes. length : int Length of the box in bytes. Returns ------- ...
python
def parse(cls, fptr, offset, length): """Parse JPX free box. Parameters ---------- f : file Open file object. offset : int Start position of box in bytes. length : int Length of the box in bytes. Returns ------- ...
Parse JPX free box. Parameters ---------- f : file Open file object. offset : int Start position of box in bytes. length : int Length of the box in bytes. Returns ------- FreeBox Instance of the current fre...
https://github.com/quintusdias/glymur/blob/8b8fb091130fff00f1028dc82219e69e3f9baf6d/glymur/jp2box.py#L1560-L1580
quintusdias/glymur
glymur/jp2box.py
ImageHeaderBox.write
def write(self, fptr): """Write an Image Header box to file. """ fptr.write(struct.pack('>I4s', 22, b'ihdr')) # signedness and bps are stored together in a single byte bit_depth_signedness = 0x80 if self.signed else 0x00 bit_depth_signedness |= self.bits_per_component - ...
python
def write(self, fptr): """Write an Image Header box to file. """ fptr.write(struct.pack('>I4s', 22, b'ihdr')) # signedness and bps are stored together in a single byte bit_depth_signedness = 0x80 if self.signed else 0x00 bit_depth_signedness |= self.bits_per_component - ...
Write an Image Header box to file.
https://github.com/quintusdias/glymur/blob/8b8fb091130fff00f1028dc82219e69e3f9baf6d/glymur/jp2box.py#L1682-L1698
quintusdias/glymur
glymur/jp2box.py
ImageHeaderBox.parse
def parse(cls, fptr, offset, length): """Parse JPEG 2000 image header box. Parameters ---------- fptr : file Open file object. offset : int Start position of box in bytes. length : int Length of the box in bytes. Returns ...
python
def parse(cls, fptr, offset, length): """Parse JPEG 2000 image header box. Parameters ---------- fptr : file Open file object. offset : int Start position of box in bytes. length : int Length of the box in bytes. Returns ...
Parse JPEG 2000 image header box. Parameters ---------- fptr : file Open file object. offset : int Start position of box in bytes. length : int Length of the box in bytes. Returns ------- ImageHeaderBox Ins...
https://github.com/quintusdias/glymur/blob/8b8fb091130fff00f1028dc82219e69e3f9baf6d/glymur/jp2box.py#L1701-L1736
quintusdias/glymur
glymur/jp2box.py
BitsPerComponentBox.parse
def parse(cls, fptr, offset, length): """Parse bits per component box. Parameters ---------- fptr : file Open file object. offset : int Start position of box in bytes. length : int Length of the box in bytes. Returns -...
python
def parse(cls, fptr, offset, length): """Parse bits per component box. Parameters ---------- fptr : file Open file object. offset : int Start position of box in bytes. length : int Length of the box in bytes. Returns -...
Parse bits per component box. Parameters ---------- fptr : file Open file object. offset : int Start position of box in bytes. length : int Length of the box in bytes. Returns ------- BitsPerComponent Insta...
https://github.com/quintusdias/glymur/blob/8b8fb091130fff00f1028dc82219e69e3f9baf6d/glymur/jp2box.py#L1852-L1874
quintusdias/glymur
glymur/jp2box.py
JP2HeaderBox.parse
def parse(cls, fptr, offset, length): """Parse JPEG 2000 header box. Parameters ---------- fptr : file Open file object. offset : int Start position of box in bytes. length : int Length of the box in bytes. Returns ---...
python
def parse(cls, fptr, offset, length): """Parse JPEG 2000 header box. Parameters ---------- fptr : file Open file object. offset : int Start position of box in bytes. length : int Length of the box in bytes. Returns ---...
Parse JPEG 2000 header box. Parameters ---------- fptr : file Open file object. offset : int Start position of box in bytes. length : int Length of the box in bytes. Returns ------- JP2HeaderBox Instance of...
https://github.com/quintusdias/glymur/blob/8b8fb091130fff00f1028dc82219e69e3f9baf6d/glymur/jp2box.py#L1916-L1939
quintusdias/glymur
glymur/jp2box.py
JPEG2000SignatureBox.write
def write(self, fptr): """Write a JPEG 2000 Signature box to file. """ fptr.write(struct.pack('>I4s', 12, b'jP ')) fptr.write(struct.pack('>BBBB', *self.signature))
python
def write(self, fptr): """Write a JPEG 2000 Signature box to file. """ fptr.write(struct.pack('>I4s', 12, b'jP ')) fptr.write(struct.pack('>BBBB', *self.signature))
Write a JPEG 2000 Signature box to file.
https://github.com/quintusdias/glymur/blob/8b8fb091130fff00f1028dc82219e69e3f9baf6d/glymur/jp2box.py#L1982-L1986
quintusdias/glymur
glymur/jp2box.py
JPEG2000SignatureBox.parse
def parse(cls, fptr, offset, length): """Parse JPEG 2000 signature box. Parameters ---------- fptr : file Open file object. offset : int Start position of box in bytes. length : int Length of the box in bytes. Returns ...
python
def parse(cls, fptr, offset, length): """Parse JPEG 2000 signature box. Parameters ---------- fptr : file Open file object. offset : int Start position of box in bytes. length : int Length of the box in bytes. Returns ...
Parse JPEG 2000 signature box. Parameters ---------- fptr : file Open file object. offset : int Start position of box in bytes. length : int Length of the box in bytes. Returns ------- JPEG2000SignatureBox ...
https://github.com/quintusdias/glymur/blob/8b8fb091130fff00f1028dc82219e69e3f9baf6d/glymur/jp2box.py#L1989-L2009
quintusdias/glymur
glymur/jp2box.py
PaletteBox._validate
def _validate(self, writing=False): """Verify that the box obeys the specifications.""" if ((len(self.bits_per_component) != len(self.signed)) or (len(self.signed) != self.palette.shape[1])): msg = ("The length of the 'bits_per_component' and the 'signed' " ...
python
def _validate(self, writing=False): """Verify that the box obeys the specifications.""" if ((len(self.bits_per_component) != len(self.signed)) or (len(self.signed) != self.palette.shape[1])): msg = ("The length of the 'bits_per_component' and the 'signed' " ...
Verify that the box obeys the specifications.
https://github.com/quintusdias/glymur/blob/8b8fb091130fff00f1028dc82219e69e3f9baf6d/glymur/jp2box.py#L2041-L2053
quintusdias/glymur
glymur/jp2box.py
PaletteBox.write
def write(self, fptr): """Write a Palette box to file. """ self._validate(writing=True) bytes_per_row = sum(self.bits_per_component) / 8 bytes_per_palette = bytes_per_row * self.palette.shape[0] box_length = 8 + 3 + self.palette.shape[1] + bytes_per_palette # Wri...
python
def write(self, fptr): """Write a Palette box to file. """ self._validate(writing=True) bytes_per_row = sum(self.bits_per_component) / 8 bytes_per_palette = bytes_per_row * self.palette.shape[0] box_length = 8 + 3 + self.palette.shape[1] + bytes_per_palette # Wri...
Write a Palette box to file.
https://github.com/quintusdias/glymur/blob/8b8fb091130fff00f1028dc82219e69e3f9baf6d/glymur/jp2box.py#L2073-L2097
quintusdias/glymur
glymur/jp2box.py
PaletteBox.parse
def parse(cls, fptr, offset, length): """Parse palette box. Parameters ---------- fptr : file Open file object. offset : int Start position of box in bytes. length : int Length of the box in bytes. Returns ------- ...
python
def parse(cls, fptr, offset, length): """Parse palette box. Parameters ---------- fptr : file Open file object. offset : int Start position of box in bytes. length : int Length of the box in bytes. Returns ------- ...
Parse palette box. Parameters ---------- fptr : file Open file object. offset : int Start position of box in bytes. length : int Length of the box in bytes. Returns ------- PaletteBox Instance of the curren...
https://github.com/quintusdias/glymur/blob/8b8fb091130fff00f1028dc82219e69e3f9baf6d/glymur/jp2box.py#L2100-L2141
quintusdias/glymur
glymur/jp2box.py
ReaderRequirementsBox.parse
def parse(cls, fptr, offset, length): """Parse reader requirements box. Parameters ---------- fptr : file Open file object. offset : int Start position of box in bytes. length : int Length of the box in bytes. Returns ...
python
def parse(cls, fptr, offset, length): """Parse reader requirements box. Parameters ---------- fptr : file Open file object. offset : int Start position of box in bytes. length : int Length of the box in bytes. Returns ...
Parse reader requirements box. Parameters ---------- fptr : file Open file object. offset : int Start position of box in bytes. length : int Length of the box in bytes. Returns ------- ReaderRequirementsBox ...
https://github.com/quintusdias/glymur/blob/8b8fb091130fff00f1028dc82219e69e3f9baf6d/glymur/jp2box.py#L2337-L2388
quintusdias/glymur
glymur/jp2box.py
CaptureResolutionBox.parse
def parse(cls, fptr, offset, length): """Parse CaptureResolutionBox. Parameters ---------- fptr : file Open file object. offset : int Start position of box in bytes. length : int Length of the box in bytes. Returns ---...
python
def parse(cls, fptr, offset, length): """Parse CaptureResolutionBox. Parameters ---------- fptr : file Open file object. offset : int Start position of box in bytes. length : int Length of the box in bytes. Returns ---...
Parse CaptureResolutionBox. Parameters ---------- fptr : file Open file object. offset : int Start position of box in bytes. length : int Length of the box in bytes. Returns ------- CaptureResolutionBox Ins...
https://github.com/quintusdias/glymur/blob/8b8fb091130fff00f1028dc82219e69e3f9baf6d/glymur/jp2box.py#L2566-L2588
quintusdias/glymur
glymur/jp2box.py
LabelBox.write
def write(self, fptr): """Write a Label box to file. """ length = 8 + len(self.label.encode()) fptr.write(struct.pack('>I4s', length, b'lbl ')) fptr.write(self.label.encode())
python
def write(self, fptr): """Write a Label box to file. """ length = 8 + len(self.label.encode()) fptr.write(struct.pack('>I4s', length, b'lbl ')) fptr.write(self.label.encode())
Write a Label box to file.
https://github.com/quintusdias/glymur/blob/8b8fb091130fff00f1028dc82219e69e3f9baf6d/glymur/jp2box.py#L2707-L2712
quintusdias/glymur
glymur/jp2box.py
LabelBox.parse
def parse(cls, fptr, offset, length): """Parse Label box. Parameters ---------- fptr : file Open file object. offset : int Start position of box in bytes. length : int Length of the box in bytes. Returns ------- ...
python
def parse(cls, fptr, offset, length): """Parse Label box. Parameters ---------- fptr : file Open file object. offset : int Start position of box in bytes. length : int Length of the box in bytes. Returns ------- ...
Parse Label box. Parameters ---------- fptr : file Open file object. offset : int Start position of box in bytes. length : int Length of the box in bytes. Returns ------- LabelBox Instance of the current la...
https://github.com/quintusdias/glymur/blob/8b8fb091130fff00f1028dc82219e69e3f9baf6d/glymur/jp2box.py#L2715-L2735
quintusdias/glymur
glymur/jp2box.py
NumberListBox.parse
def parse(cls, fptr, offset, length): """Parse number list box. Parameters ---------- fptr : file Open file object. offset : int Start position of box in bytes. length : int Length of the box in bytes. Returns ------- ...
python
def parse(cls, fptr, offset, length): """Parse number list box. Parameters ---------- fptr : file Open file object. offset : int Start position of box in bytes. length : int Length of the box in bytes. Returns ------- ...
Parse number list box. Parameters ---------- fptr : file Open file object. offset : int Start position of box in bytes. length : int Length of the box in bytes. Returns ------- LabelBox Instance of the curr...
https://github.com/quintusdias/glymur/blob/8b8fb091130fff00f1028dc82219e69e3f9baf6d/glymur/jp2box.py#L2796-L2817
quintusdias/glymur
glymur/jp2box.py
NumberListBox.write
def write(self, fptr): """Write a NumberList box to file. """ fptr.write(struct.pack('>I4s', len(self.associations) * 4 + 8, b'nlst')) fmt = '>' + 'I' * len(self.associations) write_buffer = struct.pack(fmt, *self.associations) fptr.write(w...
python
def write(self, fptr): """Write a NumberList box to file. """ fptr.write(struct.pack('>I4s', len(self.associations) * 4 + 8, b'nlst')) fmt = '>' + 'I' * len(self.associations) write_buffer = struct.pack(fmt, *self.associations) fptr.write(w...
Write a NumberList box to file.
https://github.com/quintusdias/glymur/blob/8b8fb091130fff00f1028dc82219e69e3f9baf6d/glymur/jp2box.py#L2819-L2827
quintusdias/glymur
glymur/jp2box.py
XMLBox.write
def write(self, fptr): """ Write an XML box to file. """ read_buffer = ET.tostring(self.xml.getroot(), encoding='utf-8') fptr.write(struct.pack('>I4s', len(read_buffer) + 8, b'xml ')) fptr.write(read_buffer)
python
def write(self, fptr): """ Write an XML box to file. """ read_buffer = ET.tostring(self.xml.getroot(), encoding='utf-8') fptr.write(struct.pack('>I4s', len(read_buffer) + 8, b'xml ')) fptr.write(read_buffer)
Write an XML box to file.
https://github.com/quintusdias/glymur/blob/8b8fb091130fff00f1028dc82219e69e3f9baf6d/glymur/jp2box.py#L2892-L2898