Skip to content

Commit

Permalink
chore: add wanted prop states python bindings
Browse files Browse the repository at this point in the history
  • Loading branch information
dankotov committed Aug 29, 2024
1 parent 7997eaa commit 0177420
Show file tree
Hide file tree
Showing 3 changed files with 201 additions and 8 deletions.
11 changes: 11 additions & 0 deletions src/parser/src/first_pass/parser_settings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,17 @@ pub fn rm_user_friendly_names(names: &Vec<String>) -> Result<Vec<String>, DemoPa
Ok(real_names)
}

pub fn rm_map_user_friendly_names(map: &AHashMap<String, Variant>) -> Result<AHashMap<String, Variant>, DemoParserError> {
let mut real_names_map: AHashMap<String, Variant> = AHashMap::default();
for (name, variant) in map {
match FRIENDLY_NAMES_MAPPING.get(&name) {
Some(real_name) => real_names_map.insert(real_name.to_string(), variant.clone()),
None => return Err(DemoParserError::UnknownPropName(name.to_string())),
};
}
Ok(real_names_map)
}

pub fn create_mmap(path: String) -> Result<Mmap, DemoParserError> {
let file = match File::open(path) {
Err(e) => return Err(DemoParserError::FileNotFound(format!("{}", e))),
Expand Down
10 changes: 5 additions & 5 deletions src/python/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 0177420

Please sign in to comment.