forked from materialsproject/pymatgen
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest.py
More file actions
20 lines (16 loc) · 620 Bytes
/
test.py
File metadata and controls
20 lines (16 loc) · 620 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
import os
# thanks https://stackoverflow.com/a/36693250
def package_files(directory, extensions):
"""
Walk package directory to make sure we include all relevant files in
package.
"""
paths = []
for (path, directories, filenames) in os.walk(directory):
for filename in filenames:
if any([filename.endswith(ext) for ext in extensions]):
paths.append(os.path.join("..", path, filename))
return paths
json_yaml_csv_files = package_files("pymatgen", ["yaml", "json", "csv", "yaml.gz", "json.gz", "csv.gz"])
import pprint
pprint.pprint(json_yaml_csv_files)