File tree Expand file tree Collapse file tree 1 file changed +12
-3
lines changed Expand file tree Collapse file tree 1 file changed +12
-3
lines changed Original file line number Diff line number Diff line change 1- import tomli # or import tomllib for Python 3.11+
2- import hashlib
31import sys
42from pathlib import Path
53from collections import defaultdict
64
5+ # Use tomllib if available (Python 3.11+), otherwise fall back to tomli
6+ try :
7+ import tomllib # Python 3.11+
8+ except ImportError :
9+ try :
10+ import tomli as tomllib # For older Python versions
11+ except ImportError :
12+ print ("Please install tomli for Python < 3.11: pip install tomli" )
13+ sys .exit (1 )
14+
15+
716
817def parse_pylock_toml (path ):
918 with open (path , "rb" ) as f :
10- data = tomli .load (f )
19+ data = tomllib .load (f )
1120
1221 # This dictionary maps package names to (version, [hashes])
1322 package_hashes = defaultdict (lambda : {"version" : "" , "hashes" : []})
You can’t perform that action at this time.
0 commit comments