def layers(cfr_title, cfr_part): """Build all layers for all known versions.""" logger.info("Build layers - %s CFR %s", cfr_title, cfr_part) for tree_entry in utils.relevant_paths(entry.Tree(), cfr_title, cfr_part): tree_title, tree_part, version_id = tree_entry.path version_entry = entry.Version(tree_title, tree_part, version_id) stale = stale_layers(tree_entry, 'cfr') if stale: process_cfr_layers(stale, tree_title, version_entry) if cfr_title is None and cfr_part is None: for preamble_entry in entry.Preamble().sub_entries(): stale = stale_layers(preamble_entry, 'preamble') if stale: process_preamble_layers(stale, preamble_entry)
def write_layers(client, only_title, only_part): """Write all layers that match the filtering criteria. If CFR title/part are used to filter, only process CFR layers. Otherwise, process all layers.""" for layer_entry in utils.relevant_paths(entry.Layer.cfr(), only_title, only_part): _, cfr_title, cfr_part, version_id, layer_name = layer_entry.path layer = layer_entry.read() doc_id = version_id + '/' + cfr_part client.layer(layer_name, 'cfr', doc_id).write(layer) if only_title is None and only_part is None: for sub_entry in entry.Layer().sub_entries(): if sub_entry.path[0] == 'cfr': continue doc_type, doc_id, layer_name = sub_entry.path layer = sub_entry.read() client.layer(layer_name, doc_type, doc_id).write(layer)
def write_layers(client, only_title, only_part): """Write all layers that match the filtering criteria. If CFR title/part are used to filter, only process CFR layers. Otherwise, process all layers.""" for layer_entry in utils.relevant_paths(entry.Layer.cfr(), only_title, only_part): _, _, cfr_part, version_id, layer_name = layer_entry.path layer = layer_entry.read() doc_id = version_id + '/' + cfr_part client.layer(layer_name, 'cfr', doc_id).write(layer) if only_title is None and only_part is None: for sub_entry in entry.Layer().sub_entries(): if sub_entry.path[0] == 'cfr': continue doc_type, doc_id, layer_name = sub_entry.path layer = sub_entry.read() client.layer(layer_name, doc_type, doc_id).write(layer)
def write_layers(client, only_title, only_part): """Write all layers that match the filtering criteria. If CFR title/part are used to filter, only process CFR layers. Otherwise, process all layers.""" for layer_dir in utils.relevant_paths(entry.Layer.cfr(), only_title, only_part): _, cfr_title, cfr_part, version_id = layer_dir.path for layer_name in layer_dir: layer = (layer_dir / layer_name).read() doc_id = version_id + '/' + cfr_part client.layer(layer_name, 'cfr', doc_id).write(layer) if only_title is None and only_part is None: non_cfr_doc_types = [doc_type for doc_type in entry.Layer() if doc_type != 'cfr'] for doc_type in non_cfr_doc_types: for doc_id in entry.Layer(doc_type): for layer_name in entry.Layer(doc_type, doc_id): layer = entry.Layer(doc_type, doc_id, layer_name).read() client.layer(layer_name, doc_type, doc_id).write(layer)
def write_diffs(client, only_title, only_part): for diff_dir in utils.relevant_paths(entry.Diff(), only_title, only_part): cfr_title, cfr_part, lhs_id = diff_dir.path for rhs_id in diff_dir: diff = (diff_dir / rhs_id).read() client.diff(cfr_part, lhs_id, rhs_id).write(diff)
def write_trees(client, only_title, only_part): for tree_entry in utils.relevant_paths(entry.Tree(), only_title, only_part): cfr_title, cfr_part, version_id = tree_entry.path content = tree_entry.read() client.regulation(cfr_part, version_id).write(content)
def write_diffs(client, only_title, only_part): for diff_entry in utils.relevant_paths(entry.Diff(), only_title, only_part): cfr_title, cfr_part, lhs_id, rhs_id = diff_entry.path diff = diff_entry.read() client.diff(cfr_part, lhs_id, rhs_id).write(diff)
def write_diffs(client, only_title, only_part): for diff_entry in utils.relevant_paths(entry.Diff(), only_title, only_part): _, cfr_part, lhs_id, rhs_id = diff_entry.path diff = diff_entry.read() client.diff(cfr_part, lhs_id, rhs_id).write(diff)
def write_trees(client, only_title, only_part): for tree_entry in utils.relevant_paths(entry.Tree(), only_title, only_part): _, cfr_part, version_id = tree_entry.path content = tree_entry.read() client.regulation(cfr_part, version_id).write(content)