Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
joneugster committed Sep 2, 2024
1 parent 5a61607 commit 457d10b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
12 changes: 6 additions & 6 deletions ImportGraph/Cli.lean
Original file line number Diff line number Diff line change
Expand Up @@ -56,16 +56,16 @@ open IO.FS IO.Process Name in
/-- Implementation of the import graph command line program. -/
def importGraphCLI (args : Cli.Parsed) : IO UInt32 := do
-- file extensions that should be created
let extensions : Array String := match args.variableArgsAs! String with
| #[] => #["dot"]
let extensions : HashSet String := match args.variableArgsAs! String with
| #[] => HashSet.empty.insert "dot"
| outputs => outputs.foldl (fun acc (o : String) =>
match FilePath.extension o with
| none => if acc.contains "dot" then acc else acc.push "dot"
| some "gexf" => if acc.contains "gexf" then acc else acc.push "gexf"
| some "html" => if acc.contains "gexf" then acc else acc.push "gexf"
| none => acc.insert "dot"
| some "gexf" => acc.insert "gexf"
| some "html" => acc.insert "gexf"
-- currently all other formats are handled by passing the `.dot` file to
-- graphviz
| some _ => if acc.contains "dot" then acc else acc.push "dot" ) #[]
| some _ => acc.insert "dot" ) {}

let to ← match args.flag? "to" with
| some to => pure <| to.as! ModuleName
Expand Down
2 changes: 1 addition & 1 deletion ImportGraph/Gexf.lean
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def isBlackListed (env : Environment) (declName : Name) : Bool :=

/-- Get number of non-blacklisted declarations per file. -/
def getNumberOfDeclsPerFile (env: Environment) : NameMap Nat :=
env.const2ModIdx.fold (fun acc n idx =>
env.const2ModIdx.fold (fun acc n (idx : ModuleIdx) =>
let mod := env.allImportedModuleNames.get! idx
if isBlackListed env n then acc else acc.insert mod ((acc.findD mod 0) + 1)
) {}
Expand Down

0 comments on commit 457d10b

Please sign in to comment.