/usr/lib/python3/dist-packages/landscape/lib/apt/package/__pycache__
Edit: /usr/lib/python3/dist-packages/landscape/lib/apt/package/__pycache__/store.cpython-310.pyc (20923B)
o
c^B @ s d Z ddlZzddlZW n ey ddlmZ Y nw ddlmZmZ ddl m
Z
ddlmZ G dd de
ZG d d
d
e
ZG dd deZG d
d deZG dd deZG dd deZG dd deZdd Zdd Zdd ZdS )zEProvide access to the persistent data used by L{PackageTaskHandler}s. N)dbapi2) iteritemslong)bpickle)with_cursorc @ e Zd ZdZdS )UnknownHashIDRequestz$Raised for unknown hash id requests.N__name__
__module____qualname____doc__ r r A/usr/lib/python3/dist-packages/landscape/lib/apt/package/store.pyr r c @ r )InvalidHashIdDbzARaised when trying to add an invalid hash=>id lookaside database.Nr r r r r r r r c @ sl e Zd ZdZdZdd Zdd Zedd Zed d
Z edd Z
ed
d Zedd Zedd Z
dS )HashIdStorea C{HashIdStore} stores package hash=>id mappings in a file.
The file is a SQLite database that contains a single table called "hash".
The table schema is defined in L{ensure_hash_id_schema}.
@param filename: The file where the mappings are persisted to.
Nc C s
|| _ d S N) _filenameselffilenamer r r __init__! s
zHashIdStore.__init__c C s t | j d S r )ensure_hash_id_schema_dbr r r r _ensure_schema$ s zHashIdStore._ensure_schemac C s, t |D ]\}}|d|t|f qdS )zbSet the ids of a set of hashes.
@param hash_ids: a C{dict} of hash=>id mappings.
zREPLACE INTO hash VALUES (?, ?)N)r executesqlite3Binary)r cursorhash_idshashidr r r set_hash_ids' s
zHashIdStore.set_hash_idsc C s, | dt|f | }|r|d S dS )zReturn the id associated to C{hash}, or C{None} if not available.
@param hash: a C{bytes} representing a hash.
SELECT id FROM hash WHERE hash=?r N)r r r fetchone)r r r" valuer r r get_hash_id1 s
zHashIdStore.get_hash_idc C | d dd | D S )z=Return a C{dict} holding all the available hash=>id mappings.zSELECT hash, id FROM hashc S s i | ]}t |d |d qS r bytes.0rowr r r
B s z,HashIdStore.get_hash_ids..r fetchallr r r r r get_hash_ids>
zHashIdStore.get_hash_idsc C s<