-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #14 from pheetah/dev-2
Dev 2
- Loading branch information
Showing
9 changed files
with
184 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
import os | ||
from typing import Optional | ||
|
||
import typer | ||
|
||
from client import DocupytClient, FileFormat | ||
|
||
app = typer.Typer() | ||
|
||
client = DocupytClient() | ||
|
||
|
||
def get_filepaths(directory): | ||
""" | ||
This function will generate the file names in a directory | ||
tree by walking the tree either top-down or bottom-up. For each | ||
directory in the tree rooted at directory top (including top itself), | ||
it yields a 3-tuple (dirpath, dirnames, filenames). | ||
""" | ||
file_paths = [] | ||
|
||
for root, directories, files in os.walk(directory): | ||
for filename in files: | ||
filepath = os.path.join(root, filename) | ||
file_paths.append(filepath) | ||
|
||
return file_paths | ||
|
||
|
||
@app.command() | ||
def docupyt(path: Optional[str] = None, out_path: Optional[str] = "_outputs"): | ||
if not path: | ||
raise ValueError("Path is required") | ||
|
||
if not os.path.exists(out_path): | ||
os.mkdir(out_path) | ||
|
||
formats = [] | ||
|
||
for filepath in get_filepaths(path): | ||
formats.append( | ||
FileFormat( | ||
input_path=filepath, | ||
) | ||
) | ||
|
||
client.draw_epc(out_path=out_path, file_format=formats) | ||
|
||
|
||
if __name__ == "__main__": | ||
app() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
# main | ||
code-tokenize==0.2.0 | ||
typer==0.12.3 | ||
# test | ||
pytest-cov==4.1.0 | ||
pytest==7.4.3 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
from setuptools import find_packages, setup | ||
|
||
setup( | ||
name="docupyt", | ||
version="0.1.1", | ||
author="Eyup Fatih Ersoy", | ||
author_email="eyupfatih.ersoy@hotmail.com", | ||
description="Docupyt", | ||
packages=find_packages(""), | ||
classifiers=[ | ||
"Programming Language :: Python :: 3", | ||
"License :: OSI Approved :: MIT License", | ||
"Operating System :: OS Independent", | ||
], | ||
python_requires=">=3.6", | ||
) |