Skip to content

Commit 16fe79e

Browse files
committed
Small fixes
1 parent fb31b0e commit 16fe79e

File tree

3 files changed

+2
-23
lines changed

3 files changed

+2
-23
lines changed

rust/src/caching.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ use pyo3::types::{PyDict, PySet};
77
use pyo3::types::{PyDictMethods, PySetMethods};
88
use pyo3::{Bound, PyAny, PyResult, Python, pyfunction};
99
use std::collections::{HashMap, HashSet};
10-
use serde_json;
1110

1211
/// Writes the cache file containing all the imports for a given package.
1312
/// Args:
@@ -16,7 +15,7 @@ use serde_json;
1615
/// - file_system: The file system interface to use. (A BasicFileSystem.)
1716
#[pyfunction]
1817
pub fn write_cache_data_map_file<'py>(
19-
py: Python<'py>,
18+
_py: Python<'py>,
2019
filename: &str,
2120
imports_by_module: Bound<'py, PyDict>,
2221
file_system: Bound<'py, PyAny>,

rust/src/module_finding.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ impl fmt::Display for Module {
2020
}
2121
}
2222

23-
2423
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
2524
/// Set of modules found under a single package, together with metadata.
2625
pub struct FoundPackage {

src/grimp/adaptors/caching.py

Lines changed: 1 addition & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,7 @@ def write(
120120
self,
121121
imports_by_module: Dict[Module, Set[DirectImport]],
122122
) -> None:
123+
self._write_marker_files_if_not_already_there()
123124
# Write data file.
124125
data_cache_filename = self.file_system.join(
125126
self.cache_dir,
@@ -129,31 +130,11 @@ def write(
129130
exclude_type_checking_imports=self.exclude_type_checking_imports,
130131
),
131132
)
132-
# Rust version
133133
rust.write_cache_data_map_file(
134134
filename=data_cache_filename,
135135
imports_by_module=imports_by_module,
136136
file_system=self.file_system,
137137
)
138-
self._write_marker_files_if_not_already_there()
139-
# Python version
140-
primitives_map: PrimitiveFormat = {}
141-
for found_package in self.found_packages:
142-
primitives_map_for_found_package: PrimitiveFormat = {
143-
module_file.module.name: [
144-
(
145-
direct_import.imported.name,
146-
direct_import.line_number,
147-
direct_import.line_contents,
148-
)
149-
for direct_import in imports_by_module[module_file.module]
150-
]
151-
for module_file in found_package.module_files
152-
}
153-
primitives_map.update(primitives_map_for_found_package)
154-
155-
serialized = json.dumps(primitives_map)
156-
# self.file_system.write(data_cache_filename, serialized)
157138

158139
logger.info(f"Wrote data cache file {data_cache_filename}.")
159140

0 commit comments

Comments
 (0)