Spaces:
Sleeping
Sleeping
alaahussein
commited on
Commit
•
a17642c
1
Parent(s):
0a6555b
Upload folder using huggingface_hub
Browse filesThis view is limited to 50 files because it contains too many changes.
See raw diff
- .DS_Store +0 -0
- .gitattributes +67 -0
- README.md +3 -8
- data_preparation_3.py +78 -0
- env/bin/Activate.ps1 +241 -0
- env/bin/__pycache__/jp.cpython-39.pyc +0 -0
- env/bin/activate +66 -0
- env/bin/activate.csh +25 -0
- env/bin/activate.fish +64 -0
- env/bin/alembic +8 -0
- env/bin/celery +8 -0
- env/bin/cmark +8 -0
- env/bin/dagshub +8 -0
- env/bin/distro +8 -0
- env/bin/dul-receive-pack +31 -0
- env/bin/dul-upload-pack +31 -0
- env/bin/dulwich +8 -0
- env/bin/dvc +8 -0
- env/bin/dvc-data +8 -0
- env/bin/f2py +8 -0
- env/bin/flask +8 -0
- env/bin/fonttools +8 -0
- env/bin/gql-cli +8 -0
- env/bin/gto +8 -0
- env/bin/gunicorn +8 -0
- env/bin/httpx +8 -0
- env/bin/jp.py +54 -0
- env/bin/mako-render +8 -0
- env/bin/markdown-it +8 -0
- env/bin/markdown_py +8 -0
- env/bin/mlflow +8 -0
- env/bin/normalizer +8 -0
- env/bin/pip +8 -0
- env/bin/pip3 +8 -0
- env/bin/pip3.10 +8 -0
- env/bin/pip3.9 +8 -0
- env/bin/pyftmerge +8 -0
- env/bin/pyftsubset +8 -0
- env/bin/pygmentize +8 -0
- env/bin/pygrun +164 -0
- env/bin/pysemver +8 -0
- env/bin/python +3 -0
- env/bin/python3 +3 -0
- env/bin/python3.9 +3 -0
- env/bin/shortuuid +8 -0
- env/bin/shtab +8 -0
- env/bin/sqlformat +8 -0
- env/bin/tabulate +8 -0
- env/bin/tqdm +8 -0
- env/bin/ttx +8 -0
.DS_Store
ADDED
Binary file (6.15 kB). View file
|
|
.gitattributes
CHANGED
@@ -33,3 +33,70 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
36 |
+
env/bin/python filter=lfs diff=lfs merge=lfs -text
|
37 |
+
env/bin/python3 filter=lfs diff=lfs merge=lfs -text
|
38 |
+
env/bin/python3.9 filter=lfs diff=lfs merge=lfs -text
|
39 |
+
env/lib/python3.9/site-packages/PIL/.dylibs/libfreetype.6.dylib filter=lfs diff=lfs merge=lfs -text
|
40 |
+
env/lib/python3.9/site-packages/PIL/.dylibs/libharfbuzz.0.dylib filter=lfs diff=lfs merge=lfs -text
|
41 |
+
env/lib/python3.9/site-packages/cryptography/hazmat/bindings/_rust.abi3.so filter=lfs diff=lfs merge=lfs -text
|
42 |
+
env/lib/python3.9/site-packages/mlflow/server/js/build/static/js/850.191b69b2.chunk.js.map filter=lfs diff=lfs merge=lfs -text
|
43 |
+
env/lib/python3.9/site-packages/mlflow/server/js/build/static/js/main.869400b7.js.map filter=lfs diff=lfs merge=lfs -text
|
44 |
+
env/lib/python3.9/site-packages/numpy/.dylibs/libgfortran.5.dylib filter=lfs diff=lfs merge=lfs -text
|
45 |
+
env/lib/python3.9/site-packages/numpy/.dylibs/libopenblas64_.0.dylib filter=lfs diff=lfs merge=lfs -text
|
46 |
+
env/lib/python3.9/site-packages/numpy/core/_multiarray_umath.cpython-39-darwin.so filter=lfs diff=lfs merge=lfs -text
|
47 |
+
env/lib/python3.9/site-packages/numpy/core/_simd.cpython-39-darwin.so filter=lfs diff=lfs merge=lfs -text
|
48 |
+
env/lib/python3.9/site-packages/pandas/_libs/algos.cpython-39-darwin.so filter=lfs diff=lfs merge=lfs -text
|
49 |
+
env/lib/python3.9/site-packages/pandas/_libs/groupby.cpython-39-darwin.so filter=lfs diff=lfs merge=lfs -text
|
50 |
+
env/lib/python3.9/site-packages/pandas/_libs/hashtable.cpython-39-darwin.so filter=lfs diff=lfs merge=lfs -text
|
51 |
+
env/lib/python3.9/site-packages/pandas/_libs/interval.cpython-39-darwin.so filter=lfs diff=lfs merge=lfs -text
|
52 |
+
env/lib/python3.9/site-packages/pandas/_libs/join.cpython-39-darwin.so filter=lfs diff=lfs merge=lfs -text
|
53 |
+
env/lib/python3.9/site-packages/pandas/_libs/tslibs/offsets.cpython-39-darwin.so filter=lfs diff=lfs merge=lfs -text
|
54 |
+
env/lib/python3.9/site-packages/pyarrow/_compute.cpython-39-darwin.so filter=lfs diff=lfs merge=lfs -text
|
55 |
+
env/lib/python3.9/site-packages/pyarrow/_dataset.cpython-39-darwin.so filter=lfs diff=lfs merge=lfs -text
|
56 |
+
env/lib/python3.9/site-packages/pyarrow/_flight.cpython-39-darwin.so filter=lfs diff=lfs merge=lfs -text
|
57 |
+
env/lib/python3.9/site-packages/pyarrow/lib.cpython-39-darwin.so filter=lfs diff=lfs merge=lfs -text
|
58 |
+
env/lib/python3.9/site-packages/pyarrow/libarrow.1500.dylib filter=lfs diff=lfs merge=lfs -text
|
59 |
+
env/lib/python3.9/site-packages/pyarrow/libarrow_acero.1500.dylib filter=lfs diff=lfs merge=lfs -text
|
60 |
+
env/lib/python3.9/site-packages/pyarrow/libarrow_dataset.1500.dylib filter=lfs diff=lfs merge=lfs -text
|
61 |
+
env/lib/python3.9/site-packages/pyarrow/libarrow_flight.1500.dylib filter=lfs diff=lfs merge=lfs -text
|
62 |
+
env/lib/python3.9/site-packages/pyarrow/libarrow_python.dylib filter=lfs diff=lfs merge=lfs -text
|
63 |
+
env/lib/python3.9/site-packages/pyarrow/libarrow_substrait.1500.dylib filter=lfs diff=lfs merge=lfs -text
|
64 |
+
env/lib/python3.9/site-packages/pyarrow/libparquet.1500.dylib filter=lfs diff=lfs merge=lfs -text
|
65 |
+
env/lib/python3.9/site-packages/pydantic_core/_pydantic_core.cpython-39-darwin.so filter=lfs diff=lfs merge=lfs -text
|
66 |
+
env/lib/python3.9/site-packages/pygit2/.dylibs/libcrypto.3.dylib filter=lfs diff=lfs merge=lfs -text
|
67 |
+
env/lib/python3.9/site-packages/pygit2/.dylibs/libgit2.1.7.2.dylib filter=lfs diff=lfs merge=lfs -text
|
68 |
+
env/lib/python3.9/site-packages/pygit2/.dylibs/libssl.3.dylib filter=lfs diff=lfs merge=lfs -text
|
69 |
+
env/lib/python3.9/site-packages/scipy/.dylibs/libgfortran.5.dylib filter=lfs diff=lfs merge=lfs -text
|
70 |
+
env/lib/python3.9/site-packages/scipy/.dylibs/libopenblas.0.dylib filter=lfs diff=lfs merge=lfs -text
|
71 |
+
env/lib/python3.9/site-packages/scipy/fft/_pocketfft/pypocketfft.cpython-39-darwin.so filter=lfs diff=lfs merge=lfs -text
|
72 |
+
env/lib/python3.9/site-packages/scipy/io/_fast_matrix_market/_fmm_core.cpython-39-darwin.so filter=lfs diff=lfs merge=lfs -text
|
73 |
+
env/lib/python3.9/site-packages/scipy/linalg/_flapack.cpython-39-darwin.so filter=lfs diff=lfs merge=lfs -text
|
74 |
+
env/lib/python3.9/site-packages/scipy/misc/face.dat filter=lfs diff=lfs merge=lfs -text
|
75 |
+
env/lib/python3.9/site-packages/scipy/optimize/_highs/_highs_wrapper.cpython-39-darwin.so filter=lfs diff=lfs merge=lfs -text
|
76 |
+
env/lib/python3.9/site-packages/scipy/sparse/_sparsetools.cpython-39-darwin.so filter=lfs diff=lfs merge=lfs -text
|
77 |
+
env/lib/python3.9/site-packages/scipy/spatial/_qhull.cpython-39-darwin.so filter=lfs diff=lfs merge=lfs -text
|
78 |
+
env/lib/python3.9/site-packages/scipy/special/_ufuncs.cpython-39-darwin.so filter=lfs diff=lfs merge=lfs -text
|
79 |
+
env/lib/python3.9/site-packages/scipy/special/cython_special.cpython-39-darwin.so filter=lfs diff=lfs merge=lfs -text
|
80 |
+
env/lib/python3.9/site-packages/scipy/stats/_unuran/unuran_wrapper.cpython-39-darwin.so filter=lfs diff=lfs merge=lfs -text
|
81 |
+
env/lib/python3.9/site-packages/sklearn/_loss/_loss.cpython-39-darwin.so filter=lfs diff=lfs merge=lfs -text
|
82 |
+
venv/bin/python filter=lfs diff=lfs merge=lfs -text
|
83 |
+
venv/bin/python3 filter=lfs diff=lfs merge=lfs -text
|
84 |
+
venv/bin/python3.9 filter=lfs diff=lfs merge=lfs -text
|
85 |
+
venv/bin/ruff filter=lfs diff=lfs merge=lfs -text
|
86 |
+
venv/lib/python3.9/site-packages/PIL/.dylibs/libfreetype.6.dylib filter=lfs diff=lfs merge=lfs -text
|
87 |
+
venv/lib/python3.9/site-packages/PIL/.dylibs/libharfbuzz.0.dylib filter=lfs diff=lfs merge=lfs -text
|
88 |
+
venv/lib/python3.9/site-packages/altair/vegalite/v5/schema/__pycache__/channels.cpython-39.pyc filter=lfs diff=lfs merge=lfs -text
|
89 |
+
venv/lib/python3.9/site-packages/altair/vegalite/v5/schema/__pycache__/core.cpython-39.pyc filter=lfs diff=lfs merge=lfs -text
|
90 |
+
venv/lib/python3.9/site-packages/gradio/frpc_darwin_amd64_v0.2 filter=lfs diff=lfs merge=lfs -text
|
91 |
+
venv/lib/python3.9/site-packages/gradio/templates/frontend/assets/Index-d168f24a.js.map filter=lfs diff=lfs merge=lfs -text
|
92 |
+
venv/lib/python3.9/site-packages/numpy/.dylibs/libgfortran.5.dylib filter=lfs diff=lfs merge=lfs -text
|
93 |
+
venv/lib/python3.9/site-packages/numpy/.dylibs/libopenblas64_.0.dylib filter=lfs diff=lfs merge=lfs -text
|
94 |
+
venv/lib/python3.9/site-packages/numpy/core/_multiarray_umath.cpython-39-darwin.so filter=lfs diff=lfs merge=lfs -text
|
95 |
+
venv/lib/python3.9/site-packages/numpy/core/_simd.cpython-39-darwin.so filter=lfs diff=lfs merge=lfs -text
|
96 |
+
venv/lib/python3.9/site-packages/pandas/_libs/algos.cpython-39-darwin.so filter=lfs diff=lfs merge=lfs -text
|
97 |
+
venv/lib/python3.9/site-packages/pandas/_libs/groupby.cpython-39-darwin.so filter=lfs diff=lfs merge=lfs -text
|
98 |
+
venv/lib/python3.9/site-packages/pandas/_libs/hashtable.cpython-39-darwin.so filter=lfs diff=lfs merge=lfs -text
|
99 |
+
venv/lib/python3.9/site-packages/pandas/_libs/interval.cpython-39-darwin.so filter=lfs diff=lfs merge=lfs -text
|
100 |
+
venv/lib/python3.9/site-packages/pandas/_libs/join.cpython-39-darwin.so filter=lfs diff=lfs merge=lfs -text
|
101 |
+
venv/lib/python3.9/site-packages/pandas/_libs/tslibs/offsets.cpython-39-darwin.so filter=lfs diff=lfs merge=lfs -text
|
102 |
+
venv/lib/python3.9/site-packages/pydantic_core/_pydantic_core.cpython-39-darwin.so filter=lfs diff=lfs merge=lfs -text
|
README.md
CHANGED
@@ -1,12 +1,7 @@
|
|
1 |
---
|
2 |
-
title: Winemakers
|
3 |
-
|
4 |
-
colorFrom: purple
|
5 |
-
colorTo: gray
|
6 |
sdk: gradio
|
7 |
sdk_version: 4.27.0
|
8 |
-
app_file: app.py
|
9 |
-
pinned: false
|
10 |
---
|
11 |
-
|
12 |
-
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
|
|
1 |
---
|
2 |
+
title: Winemakers-Diemma
|
3 |
+
app_file: wine_decision_app.py
|
|
|
|
|
4 |
sdk: gradio
|
5 |
sdk_version: 4.27.0
|
|
|
|
|
6 |
---
|
7 |
+
# Winemakers-Dilemma
|
|
data_preparation_3.py
ADDED
@@ -0,0 +1,78 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import pandas as pd
|
2 |
+
from sklearn.model_selection import train_test_split
|
3 |
+
from sklearn.preprocessing import StandardScaler
|
4 |
+
from sklearn.ensemble import RandomForestClassifier
|
5 |
+
from sklearn.metrics import classification_report, confusion_matrix
|
6 |
+
from imblearn.over_sampling import SMOTE
|
7 |
+
from imblearn.pipeline import Pipeline as imbpipeline
|
8 |
+
import mlflow
|
9 |
+
import dagshub
|
10 |
+
|
11 |
+
# Initialize DagsHub and MLflow for tracking
|
12 |
+
dagshub.init(repo_owner='alaa.hussein401', repo_name='Winemakers-Dilemma', mlflow=True)
|
13 |
+
mlflow.set_tracking_uri('https://dagshub.com/alaa.hussein401/Winemakers-Dilemma.mlflow')
|
14 |
+
|
15 |
+
# Start an MLflow run
|
16 |
+
with mlflow.start_run():
|
17 |
+
# Load the dataset
|
18 |
+
df = pd.read_csv('vineyard_weather_1948-2017.csv')
|
19 |
+
|
20 |
+
# Preprocess and feature engineering
|
21 |
+
df['DATE'] = pd.to_datetime(df['DATE'], format='%Y-%m-%d')
|
22 |
+
df['year'] = df['DATE'].dt.year
|
23 |
+
df['week_of_year'] = df['DATE'].dt.isocalendar().week
|
24 |
+
|
25 |
+
# Filter data for weeks 35 to 40
|
26 |
+
df_filtered = df[(df['week_of_year'] >= 35) & (df['week_of_year'] <= 40)]
|
27 |
+
|
28 |
+
# Aggregate data by year and week number
|
29 |
+
weekly_data = df_filtered.groupby(['year', 'week_of_year']).agg({
|
30 |
+
'PRCP': 'sum',
|
31 |
+
'TMAX': 'mean',
|
32 |
+
'TMIN': 'mean',
|
33 |
+
}).reset_index()
|
34 |
+
|
35 |
+
# Feature engineering
|
36 |
+
weekly_data['PRCP_lag1'] = weekly_data['PRCP'].shift(1)
|
37 |
+
weekly_data['PRCP_lag2'] = weekly_data['PRCP'].shift(2)
|
38 |
+
weekly_data['PRCP_MA3'] = weekly_data['PRCP'].rolling(window=3).mean()
|
39 |
+
|
40 |
+
# Drop rows with NaN values that were created by shifts and rolling means
|
41 |
+
weekly_data.dropna(inplace=True)
|
42 |
+
|
43 |
+
# Select features for training
|
44 |
+
features = ['TMAX', 'TMIN', 'PRCP_lag1', 'PRCP_lag2', 'PRCP_MA3']
|
45 |
+
X = weekly_data[features]
|
46 |
+
y = (weekly_data['PRCP'] >= 0.35).astype(int)
|
47 |
+
|
48 |
+
# Split into train and test sets
|
49 |
+
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2, random_state=42)
|
50 |
+
|
51 |
+
# Create a pipeline that first standardizes the data, then applies SMOTE, and finally fits the model
|
52 |
+
pipeline = imbpipeline([
|
53 |
+
('scaler', StandardScaler()),
|
54 |
+
('smote', SMOTE(random_state=42)),
|
55 |
+
('classifier', RandomForestClassifier(n_estimators=200, random_state=42))
|
56 |
+
])
|
57 |
+
|
58 |
+
# Fit the pipeline
|
59 |
+
pipeline.fit(X_train, y_train)
|
60 |
+
|
61 |
+
# Make predictions
|
62 |
+
y_pred = pipeline.predict(X_test)
|
63 |
+
|
64 |
+
# Log parameters, metrics, and artifacts
|
65 |
+
mlflow.log_params(pipeline.named_steps['classifier'].get_params())
|
66 |
+
mlflow.log_metric('accuracy', pipeline.score(X_test, y_test))
|
67 |
+
|
68 |
+
# Generate and log classification report
|
69 |
+
report = classification_report(y_test, y_pred)
|
70 |
+
mlflow.log_text(report, 'classification_report_3.txt')
|
71 |
+
|
72 |
+
# Generate and log confusion matrix
|
73 |
+
conf_matrix = confusion_matrix(y_test, y_pred)
|
74 |
+
mlflow.log_text(str(conf_matrix), 'confusion_matrix_3.txt')
|
75 |
+
|
76 |
+
# Print the classification report and confusion matrix
|
77 |
+
print(report)
|
78 |
+
print(conf_matrix)
|
env/bin/Activate.ps1
ADDED
@@ -0,0 +1,241 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<#
|
2 |
+
.Synopsis
|
3 |
+
Activate a Python virtual environment for the current PowerShell session.
|
4 |
+
|
5 |
+
.Description
|
6 |
+
Pushes the python executable for a virtual environment to the front of the
|
7 |
+
$Env:PATH environment variable and sets the prompt to signify that you are
|
8 |
+
in a Python virtual environment. Makes use of the command line switches as
|
9 |
+
well as the `pyvenv.cfg` file values present in the virtual environment.
|
10 |
+
|
11 |
+
.Parameter VenvDir
|
12 |
+
Path to the directory that contains the virtual environment to activate. The
|
13 |
+
default value for this is the parent of the directory that the Activate.ps1
|
14 |
+
script is located within.
|
15 |
+
|
16 |
+
.Parameter Prompt
|
17 |
+
The prompt prefix to display when this virtual environment is activated. By
|
18 |
+
default, this prompt is the name of the virtual environment folder (VenvDir)
|
19 |
+
surrounded by parentheses and followed by a single space (ie. '(.venv) ').
|
20 |
+
|
21 |
+
.Example
|
22 |
+
Activate.ps1
|
23 |
+
Activates the Python virtual environment that contains the Activate.ps1 script.
|
24 |
+
|
25 |
+
.Example
|
26 |
+
Activate.ps1 -Verbose
|
27 |
+
Activates the Python virtual environment that contains the Activate.ps1 script,
|
28 |
+
and shows extra information about the activation as it executes.
|
29 |
+
|
30 |
+
.Example
|
31 |
+
Activate.ps1 -VenvDir C:\Users\MyUser\Common\.venv
|
32 |
+
Activates the Python virtual environment located in the specified location.
|
33 |
+
|
34 |
+
.Example
|
35 |
+
Activate.ps1 -Prompt "MyPython"
|
36 |
+
Activates the Python virtual environment that contains the Activate.ps1 script,
|
37 |
+
and prefixes the current prompt with the specified string (surrounded in
|
38 |
+
parentheses) while the virtual environment is active.
|
39 |
+
|
40 |
+
.Notes
|
41 |
+
On Windows, it may be required to enable this Activate.ps1 script by setting the
|
42 |
+
execution policy for the user. You can do this by issuing the following PowerShell
|
43 |
+
command:
|
44 |
+
|
45 |
+
PS C:\> Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser
|
46 |
+
|
47 |
+
For more information on Execution Policies:
|
48 |
+
https://go.microsoft.com/fwlink/?LinkID=135170
|
49 |
+
|
50 |
+
#>
|
51 |
+
Param(
|
52 |
+
[Parameter(Mandatory = $false)]
|
53 |
+
[String]
|
54 |
+
$VenvDir,
|
55 |
+
[Parameter(Mandatory = $false)]
|
56 |
+
[String]
|
57 |
+
$Prompt
|
58 |
+
)
|
59 |
+
|
60 |
+
<# Function declarations --------------------------------------------------- #>
|
61 |
+
|
62 |
+
<#
|
63 |
+
.Synopsis
|
64 |
+
Remove all shell session elements added by the Activate script, including the
|
65 |
+
addition of the virtual environment's Python executable from the beginning of
|
66 |
+
the PATH variable.
|
67 |
+
|
68 |
+
.Parameter NonDestructive
|
69 |
+
If present, do not remove this function from the global namespace for the
|
70 |
+
session.
|
71 |
+
|
72 |
+
#>
|
73 |
+
function global:deactivate ([switch]$NonDestructive) {
|
74 |
+
# Revert to original values
|
75 |
+
|
76 |
+
# The prior prompt:
|
77 |
+
if (Test-Path -Path Function:_OLD_VIRTUAL_PROMPT) {
|
78 |
+
Copy-Item -Path Function:_OLD_VIRTUAL_PROMPT -Destination Function:prompt
|
79 |
+
Remove-Item -Path Function:_OLD_VIRTUAL_PROMPT
|
80 |
+
}
|
81 |
+
|
82 |
+
# The prior PYTHONHOME:
|
83 |
+
if (Test-Path -Path Env:_OLD_VIRTUAL_PYTHONHOME) {
|
84 |
+
Copy-Item -Path Env:_OLD_VIRTUAL_PYTHONHOME -Destination Env:PYTHONHOME
|
85 |
+
Remove-Item -Path Env:_OLD_VIRTUAL_PYTHONHOME
|
86 |
+
}
|
87 |
+
|
88 |
+
# The prior PATH:
|
89 |
+
if (Test-Path -Path Env:_OLD_VIRTUAL_PATH) {
|
90 |
+
Copy-Item -Path Env:_OLD_VIRTUAL_PATH -Destination Env:PATH
|
91 |
+
Remove-Item -Path Env:_OLD_VIRTUAL_PATH
|
92 |
+
}
|
93 |
+
|
94 |
+
# Just remove the VIRTUAL_ENV altogether:
|
95 |
+
if (Test-Path -Path Env:VIRTUAL_ENV) {
|
96 |
+
Remove-Item -Path env:VIRTUAL_ENV
|
97 |
+
}
|
98 |
+
|
99 |
+
# Just remove the _PYTHON_VENV_PROMPT_PREFIX altogether:
|
100 |
+
if (Get-Variable -Name "_PYTHON_VENV_PROMPT_PREFIX" -ErrorAction SilentlyContinue) {
|
101 |
+
Remove-Variable -Name _PYTHON_VENV_PROMPT_PREFIX -Scope Global -Force
|
102 |
+
}
|
103 |
+
|
104 |
+
# Leave deactivate function in the global namespace if requested:
|
105 |
+
if (-not $NonDestructive) {
|
106 |
+
Remove-Item -Path function:deactivate
|
107 |
+
}
|
108 |
+
}
|
109 |
+
|
110 |
+
<#
|
111 |
+
.Description
|
112 |
+
Get-PyVenvConfig parses the values from the pyvenv.cfg file located in the
|
113 |
+
given folder, and returns them in a map.
|
114 |
+
|
115 |
+
For each line in the pyvenv.cfg file, if that line can be parsed into exactly
|
116 |
+
two strings separated by `=` (with any amount of whitespace surrounding the =)
|
117 |
+
then it is considered a `key = value` line. The left hand string is the key,
|
118 |
+
the right hand is the value.
|
119 |
+
|
120 |
+
If the value starts with a `'` or a `"` then the first and last character is
|
121 |
+
stripped from the value before being captured.
|
122 |
+
|
123 |
+
.Parameter ConfigDir
|
124 |
+
Path to the directory that contains the `pyvenv.cfg` file.
|
125 |
+
#>
|
126 |
+
function Get-PyVenvConfig(
|
127 |
+
[String]
|
128 |
+
$ConfigDir
|
129 |
+
) {
|
130 |
+
Write-Verbose "Given ConfigDir=$ConfigDir, obtain values in pyvenv.cfg"
|
131 |
+
|
132 |
+
# Ensure the file exists, and issue a warning if it doesn't (but still allow the function to continue).
|
133 |
+
$pyvenvConfigPath = Join-Path -Resolve -Path $ConfigDir -ChildPath 'pyvenv.cfg' -ErrorAction Continue
|
134 |
+
|
135 |
+
# An empty map will be returned if no config file is found.
|
136 |
+
$pyvenvConfig = @{ }
|
137 |
+
|
138 |
+
if ($pyvenvConfigPath) {
|
139 |
+
|
140 |
+
Write-Verbose "File exists, parse `key = value` lines"
|
141 |
+
$pyvenvConfigContent = Get-Content -Path $pyvenvConfigPath
|
142 |
+
|
143 |
+
$pyvenvConfigContent | ForEach-Object {
|
144 |
+
$keyval = $PSItem -split "\s*=\s*", 2
|
145 |
+
if ($keyval[0] -and $keyval[1]) {
|
146 |
+
$val = $keyval[1]
|
147 |
+
|
148 |
+
# Remove extraneous quotations around a string value.
|
149 |
+
if ("'""".Contains($val.Substring(0, 1))) {
|
150 |
+
$val = $val.Substring(1, $val.Length - 2)
|
151 |
+
}
|
152 |
+
|
153 |
+
$pyvenvConfig[$keyval[0]] = $val
|
154 |
+
Write-Verbose "Adding Key: '$($keyval[0])'='$val'"
|
155 |
+
}
|
156 |
+
}
|
157 |
+
}
|
158 |
+
return $pyvenvConfig
|
159 |
+
}
|
160 |
+
|
161 |
+
|
162 |
+
<# Begin Activate script --------------------------------------------------- #>
|
163 |
+
|
164 |
+
# Determine the containing directory of this script
|
165 |
+
$VenvExecPath = Split-Path -Parent $MyInvocation.MyCommand.Definition
|
166 |
+
$VenvExecDir = Get-Item -Path $VenvExecPath
|
167 |
+
|
168 |
+
Write-Verbose "Activation script is located in path: '$VenvExecPath'"
|
169 |
+
Write-Verbose "VenvExecDir Fullname: '$($VenvExecDir.FullName)"
|
170 |
+
Write-Verbose "VenvExecDir Name: '$($VenvExecDir.Name)"
|
171 |
+
|
172 |
+
# Set values required in priority: CmdLine, ConfigFile, Default
|
173 |
+
# First, get the location of the virtual environment, it might not be
|
174 |
+
# VenvExecDir if specified on the command line.
|
175 |
+
if ($VenvDir) {
|
176 |
+
Write-Verbose "VenvDir given as parameter, using '$VenvDir' to determine values"
|
177 |
+
}
|
178 |
+
else {
|
179 |
+
Write-Verbose "VenvDir not given as a parameter, using parent directory name as VenvDir."
|
180 |
+
$VenvDir = $VenvExecDir.Parent.FullName.TrimEnd("\\/")
|
181 |
+
Write-Verbose "VenvDir=$VenvDir"
|
182 |
+
}
|
183 |
+
|
184 |
+
# Next, read the `pyvenv.cfg` file to determine any required value such
|
185 |
+
# as `prompt`.
|
186 |
+
$pyvenvCfg = Get-PyVenvConfig -ConfigDir $VenvDir
|
187 |
+
|
188 |
+
# Next, set the prompt from the command line, or the config file, or
|
189 |
+
# just use the name of the virtual environment folder.
|
190 |
+
if ($Prompt) {
|
191 |
+
Write-Verbose "Prompt specified as argument, using '$Prompt'"
|
192 |
+
}
|
193 |
+
else {
|
194 |
+
Write-Verbose "Prompt not specified as argument to script, checking pyvenv.cfg value"
|
195 |
+
if ($pyvenvCfg -and $pyvenvCfg['prompt']) {
|
196 |
+
Write-Verbose " Setting based on value in pyvenv.cfg='$($pyvenvCfg['prompt'])'"
|
197 |
+
$Prompt = $pyvenvCfg['prompt'];
|
198 |
+
}
|
199 |
+
else {
|
200 |
+
Write-Verbose " Setting prompt based on parent's directory's name. (Is the directory name passed to venv module when creating the virtual environment)"
|
201 |
+
Write-Verbose " Got leaf-name of $VenvDir='$(Split-Path -Path $venvDir -Leaf)'"
|
202 |
+
$Prompt = Split-Path -Path $venvDir -Leaf
|
203 |
+
}
|
204 |
+
}
|
205 |
+
|
206 |
+
Write-Verbose "Prompt = '$Prompt'"
|
207 |
+
Write-Verbose "VenvDir='$VenvDir'"
|
208 |
+
|
209 |
+
# Deactivate any currently active virtual environment, but leave the
|
210 |
+
# deactivate function in place.
|
211 |
+
deactivate -nondestructive
|
212 |
+
|
213 |
+
# Now set the environment variable VIRTUAL_ENV, used by many tools to determine
|
214 |
+
# that there is an activated venv.
|
215 |
+
$env:VIRTUAL_ENV = $VenvDir
|
216 |
+
|
217 |
+
if (-not $Env:VIRTUAL_ENV_DISABLE_PROMPT) {
|
218 |
+
|
219 |
+
Write-Verbose "Setting prompt to '$Prompt'"
|
220 |
+
|
221 |
+
# Set the prompt to include the env name
|
222 |
+
# Make sure _OLD_VIRTUAL_PROMPT is global
|
223 |
+
function global:_OLD_VIRTUAL_PROMPT { "" }
|
224 |
+
Copy-Item -Path function:prompt -Destination function:_OLD_VIRTUAL_PROMPT
|
225 |
+
New-Variable -Name _PYTHON_VENV_PROMPT_PREFIX -Description "Python virtual environment prompt prefix" -Scope Global -Option ReadOnly -Visibility Public -Value $Prompt
|
226 |
+
|
227 |
+
function global:prompt {
|
228 |
+
Write-Host -NoNewline -ForegroundColor Green "($_PYTHON_VENV_PROMPT_PREFIX) "
|
229 |
+
_OLD_VIRTUAL_PROMPT
|
230 |
+
}
|
231 |
+
}
|
232 |
+
|
233 |
+
# Clear PYTHONHOME
|
234 |
+
if (Test-Path -Path Env:PYTHONHOME) {
|
235 |
+
Copy-Item -Path Env:PYTHONHOME -Destination Env:_OLD_VIRTUAL_PYTHONHOME
|
236 |
+
Remove-Item -Path Env:PYTHONHOME
|
237 |
+
}
|
238 |
+
|
239 |
+
# Add the venv to the PATH
|
240 |
+
Copy-Item -Path Env:PATH -Destination Env:_OLD_VIRTUAL_PATH
|
241 |
+
$Env:PATH = "$VenvExecDir$([System.IO.Path]::PathSeparator)$Env:PATH"
|
env/bin/__pycache__/jp.cpython-39.pyc
ADDED
Binary file (1.64 kB). View file
|
|
env/bin/activate
ADDED
@@ -0,0 +1,66 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# This file must be used with "source bin/activate" *from bash*
|
2 |
+
# you cannot run it directly
|
3 |
+
|
4 |
+
deactivate () {
|
5 |
+
# reset old environment variables
|
6 |
+
if [ -n "${_OLD_VIRTUAL_PATH:-}" ] ; then
|
7 |
+
PATH="${_OLD_VIRTUAL_PATH:-}"
|
8 |
+
export PATH
|
9 |
+
unset _OLD_VIRTUAL_PATH
|
10 |
+
fi
|
11 |
+
if [ -n "${_OLD_VIRTUAL_PYTHONHOME:-}" ] ; then
|
12 |
+
PYTHONHOME="${_OLD_VIRTUAL_PYTHONHOME:-}"
|
13 |
+
export PYTHONHOME
|
14 |
+
unset _OLD_VIRTUAL_PYTHONHOME
|
15 |
+
fi
|
16 |
+
|
17 |
+
# This should detect bash and zsh, which have a hash command that must
|
18 |
+
# be called to get it to forget past commands. Without forgetting
|
19 |
+
# past commands the $PATH changes we made may not be respected
|
20 |
+
if [ -n "${BASH:-}" -o -n "${ZSH_VERSION:-}" ] ; then
|
21 |
+
hash -r 2> /dev/null
|
22 |
+
fi
|
23 |
+
|
24 |
+
if [ -n "${_OLD_VIRTUAL_PS1:-}" ] ; then
|
25 |
+
PS1="${_OLD_VIRTUAL_PS1:-}"
|
26 |
+
export PS1
|
27 |
+
unset _OLD_VIRTUAL_PS1
|
28 |
+
fi
|
29 |
+
|
30 |
+
unset VIRTUAL_ENV
|
31 |
+
if [ ! "${1:-}" = "nondestructive" ] ; then
|
32 |
+
# Self destruct!
|
33 |
+
unset -f deactivate
|
34 |
+
fi
|
35 |
+
}
|
36 |
+
|
37 |
+
# unset irrelevant variables
|
38 |
+
deactivate nondestructive
|
39 |
+
|
40 |
+
VIRTUAL_ENV="/Users/alaahussein/Code/Winemakers-Dilemma/env"
|
41 |
+
export VIRTUAL_ENV
|
42 |
+
|
43 |
+
_OLD_VIRTUAL_PATH="$PATH"
|
44 |
+
PATH="$VIRTUAL_ENV/bin:$PATH"
|
45 |
+
export PATH
|
46 |
+
|
47 |
+
# unset PYTHONHOME if set
|
48 |
+
# this will fail if PYTHONHOME is set to the empty string (which is bad anyway)
|
49 |
+
# could use `if (set -u; : $PYTHONHOME) ;` in bash
|
50 |
+
if [ -n "${PYTHONHOME:-}" ] ; then
|
51 |
+
_OLD_VIRTUAL_PYTHONHOME="${PYTHONHOME:-}"
|
52 |
+
unset PYTHONHOME
|
53 |
+
fi
|
54 |
+
|
55 |
+
if [ -z "${VIRTUAL_ENV_DISABLE_PROMPT:-}" ] ; then
|
56 |
+
_OLD_VIRTUAL_PS1="${PS1:-}"
|
57 |
+
PS1="(env) ${PS1:-}"
|
58 |
+
export PS1
|
59 |
+
fi
|
60 |
+
|
61 |
+
# This should detect bash and zsh, which have a hash command that must
|
62 |
+
# be called to get it to forget past commands. Without forgetting
|
63 |
+
# past commands the $PATH changes we made may not be respected
|
64 |
+
if [ -n "${BASH:-}" -o -n "${ZSH_VERSION:-}" ] ; then
|
65 |
+
hash -r 2> /dev/null
|
66 |
+
fi
|
env/bin/activate.csh
ADDED
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# This file must be used with "source bin/activate.csh" *from csh*.
|
2 |
+
# You cannot run it directly.
|
3 |
+
# Created by Davide Di Blasi <davidedb@gmail.com>.
|
4 |
+
# Ported to Python 3.3 venv by Andrew Svetlov <andrew.svetlov@gmail.com>
|
5 |
+
|
6 |
+
alias deactivate 'test $?_OLD_VIRTUAL_PATH != 0 && setenv PATH "$_OLD_VIRTUAL_PATH" && unset _OLD_VIRTUAL_PATH; rehash; test $?_OLD_VIRTUAL_PROMPT != 0 && set prompt="$_OLD_VIRTUAL_PROMPT" && unset _OLD_VIRTUAL_PROMPT; unsetenv VIRTUAL_ENV; test "\!:*" != "nondestructive" && unalias deactivate'
|
7 |
+
|
8 |
+
# Unset irrelevant variables.
|
9 |
+
deactivate nondestructive
|
10 |
+
|
11 |
+
setenv VIRTUAL_ENV "/Users/alaahussein/Code/Winemakers-Dilemma/env"
|
12 |
+
|
13 |
+
set _OLD_VIRTUAL_PATH="$PATH"
|
14 |
+
setenv PATH "$VIRTUAL_ENV/bin:$PATH"
|
15 |
+
|
16 |
+
|
17 |
+
set _OLD_VIRTUAL_PROMPT="$prompt"
|
18 |
+
|
19 |
+
if (! "$?VIRTUAL_ENV_DISABLE_PROMPT") then
|
20 |
+
set prompt = "(env) $prompt"
|
21 |
+
endif
|
22 |
+
|
23 |
+
alias pydoc python -m pydoc
|
24 |
+
|
25 |
+
rehash
|
env/bin/activate.fish
ADDED
@@ -0,0 +1,64 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# This file must be used with "source <venv>/bin/activate.fish" *from fish*
|
2 |
+
# (https://fishshell.com/); you cannot run it directly.
|
3 |
+
|
4 |
+
function deactivate -d "Exit virtual environment and return to normal shell environment"
|
5 |
+
# reset old environment variables
|
6 |
+
if test -n "$_OLD_VIRTUAL_PATH"
|
7 |
+
set -gx PATH $_OLD_VIRTUAL_PATH
|
8 |
+
set -e _OLD_VIRTUAL_PATH
|
9 |
+
end
|
10 |
+
if test -n "$_OLD_VIRTUAL_PYTHONHOME"
|
11 |
+
set -gx PYTHONHOME $_OLD_VIRTUAL_PYTHONHOME
|
12 |
+
set -e _OLD_VIRTUAL_PYTHONHOME
|
13 |
+
end
|
14 |
+
|
15 |
+
if test -n "$_OLD_FISH_PROMPT_OVERRIDE"
|
16 |
+
functions -e fish_prompt
|
17 |
+
set -e _OLD_FISH_PROMPT_OVERRIDE
|
18 |
+
functions -c _old_fish_prompt fish_prompt
|
19 |
+
functions -e _old_fish_prompt
|
20 |
+
end
|
21 |
+
|
22 |
+
set -e VIRTUAL_ENV
|
23 |
+
if test "$argv[1]" != "nondestructive"
|
24 |
+
# Self-destruct!
|
25 |
+
functions -e deactivate
|
26 |
+
end
|
27 |
+
end
|
28 |
+
|
29 |
+
# Unset irrelevant variables.
|
30 |
+
deactivate nondestructive
|
31 |
+
|
32 |
+
set -gx VIRTUAL_ENV "/Users/alaahussein/Code/Winemakers-Dilemma/env"
|
33 |
+
|
34 |
+
set -gx _OLD_VIRTUAL_PATH $PATH
|
35 |
+
set -gx PATH "$VIRTUAL_ENV/bin" $PATH
|
36 |
+
|
37 |
+
# Unset PYTHONHOME if set.
|
38 |
+
if set -q PYTHONHOME
|
39 |
+
set -gx _OLD_VIRTUAL_PYTHONHOME $PYTHONHOME
|
40 |
+
set -e PYTHONHOME
|
41 |
+
end
|
42 |
+
|
43 |
+
if test -z "$VIRTUAL_ENV_DISABLE_PROMPT"
|
44 |
+
# fish uses a function instead of an env var to generate the prompt.
|
45 |
+
|
46 |
+
# Save the current fish_prompt function as the function _old_fish_prompt.
|
47 |
+
functions -c fish_prompt _old_fish_prompt
|
48 |
+
|
49 |
+
# With the original prompt function renamed, we can override with our own.
|
50 |
+
function fish_prompt
|
51 |
+
# Save the return status of the last command.
|
52 |
+
set -l old_status $status
|
53 |
+
|
54 |
+
# Output the venv prompt; color taken from the blue of the Python logo.
|
55 |
+
printf "%s%s%s" (set_color 4B8BBE) "(env) " (set_color normal)
|
56 |
+
|
57 |
+
# Restore the return status of the previous command.
|
58 |
+
echo "exit $old_status" | .
|
59 |
+
# Output the original/"old" prompt.
|
60 |
+
_old_fish_prompt
|
61 |
+
end
|
62 |
+
|
63 |
+
set -gx _OLD_FISH_PROMPT_OVERRIDE "$VIRTUAL_ENV"
|
64 |
+
end
|
env/bin/alembic
ADDED
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#!/Users/alaahussein/Code/Winemakers-Dilemma/env/bin/python3
|
2 |
+
# -*- coding: utf-8 -*-
|
3 |
+
import re
|
4 |
+
import sys
|
5 |
+
from alembic.config import main
|
6 |
+
if __name__ == '__main__':
|
7 |
+
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
|
8 |
+
sys.exit(main())
|
env/bin/celery
ADDED
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#!/Users/alaahussein/Code/Winemakers-Dilemma/env/bin/python3
|
2 |
+
# -*- coding: utf-8 -*-
|
3 |
+
import re
|
4 |
+
import sys
|
5 |
+
from celery.__main__ import main
|
6 |
+
if __name__ == '__main__':
|
7 |
+
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
|
8 |
+
sys.exit(main())
|
env/bin/cmark
ADDED
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#!/Users/alaahussein/Code/Winemakers-Dilemma/env/bin/python3
|
2 |
+
# -*- coding: utf-8 -*-
|
3 |
+
import re
|
4 |
+
import sys
|
5 |
+
from commonmark.cmark import main
|
6 |
+
if __name__ == '__main__':
|
7 |
+
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
|
8 |
+
sys.exit(main())
|
env/bin/dagshub
ADDED
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#!/Users/alaahussein/Code/Winemakers-Dilemma/env/bin/python3
|
2 |
+
# -*- coding: utf-8 -*-
|
3 |
+
import re
|
4 |
+
import sys
|
5 |
+
from dagshub.common.cli import cli
|
6 |
+
if __name__ == '__main__':
|
7 |
+
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
|
8 |
+
sys.exit(cli())
|
env/bin/distro
ADDED
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#!/Users/alaahussein/Code/Winemakers-Dilemma/env/bin/python3
|
2 |
+
# -*- coding: utf-8 -*-
|
3 |
+
import re
|
4 |
+
import sys
|
5 |
+
from distro.distro import main
|
6 |
+
if __name__ == '__main__':
|
7 |
+
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
|
8 |
+
sys.exit(main())
|
env/bin/dul-receive-pack
ADDED
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#!/Users/alaahussein/Code/Winemakers-Dilemma/env/bin/python3
|
2 |
+
# dul-receive-pack - git-receive-pack in python
|
3 |
+
# Copyright (C) 2008 John Carr <john.carr@unrouted.co.uk>
|
4 |
+
#
|
5 |
+
# Dulwich is dual-licensed under the Apache License, Version 2.0 and the GNU
|
6 |
+
# General Public License as public by the Free Software Foundation; version 2.0
|
7 |
+
# or (at your option) any later version. You can redistribute it and/or
|
8 |
+
# modify it under the terms of either of these two licenses.
|
9 |
+
#
|
10 |
+
# Unless required by applicable law or agreed to in writing, software
|
11 |
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
12 |
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13 |
+
# See the License for the specific language governing permissions and
|
14 |
+
# limitations under the License.
|
15 |
+
#
|
16 |
+
# You should have received a copy of the licenses; if not, see
|
17 |
+
# <http://www.gnu.org/licenses/> for a copy of the GNU General Public License
|
18 |
+
# and <http://www.apache.org/licenses/LICENSE-2.0> for a copy of the Apache
|
19 |
+
# License, Version 2.0.
|
20 |
+
#
|
21 |
+
|
22 |
+
import os
|
23 |
+
import sys
|
24 |
+
|
25 |
+
from dulwich.porcelain import receive_pack
|
26 |
+
|
27 |
+
if len(sys.argv) < 2:
|
28 |
+
sys.stderr.write("usage: %s <git-dir>\n" % os.path.basename(sys.argv[0]))
|
29 |
+
sys.exit(1)
|
30 |
+
|
31 |
+
sys.exit(receive_pack(sys.argv[1]))
|
env/bin/dul-upload-pack
ADDED
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#!/Users/alaahussein/Code/Winemakers-Dilemma/env/bin/python3
|
2 |
+
# dul-upload-pack - git-upload-pack in python
|
3 |
+
# Copyright (C) 2008 John Carr <john.carr@unrouted.co.uk>
|
4 |
+
#
|
5 |
+
# Dulwich is dual-licensed under the Apache License, Version 2.0 and the GNU
|
6 |
+
# General Public License as public by the Free Software Foundation; version 2.0
|
7 |
+
# or (at your option) any later version. You can redistribute it and/or
|
8 |
+
# modify it under the terms of either of these two licenses.
|
9 |
+
#
|
10 |
+
# Unless required by applicable law or agreed to in writing, software
|
11 |
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
12 |
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13 |
+
# See the License for the specific language governing permissions and
|
14 |
+
# limitations under the License.
|
15 |
+
#
|
16 |
+
# You should have received a copy of the licenses; if not, see
|
17 |
+
# <http://www.gnu.org/licenses/> for a copy of the GNU General Public License
|
18 |
+
# and <http://www.apache.org/licenses/LICENSE-2.0> for a copy of the Apache
|
19 |
+
# License, Version 2.0.
|
20 |
+
#
|
21 |
+
|
22 |
+
import os
|
23 |
+
import sys
|
24 |
+
|
25 |
+
from dulwich.porcelain import upload_pack
|
26 |
+
|
27 |
+
if len(sys.argv) < 2:
|
28 |
+
sys.stderr.write("usage: %s <git-dir>\n" % os.path.basename(sys.argv[0]))
|
29 |
+
sys.exit(1)
|
30 |
+
|
31 |
+
sys.exit(upload_pack(sys.argv[1]))
|
env/bin/dulwich
ADDED
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#!/Users/alaahussein/Code/Winemakers-Dilemma/env/bin/python3
|
2 |
+
# -*- coding: utf-8 -*-
|
3 |
+
import re
|
4 |
+
import sys
|
5 |
+
from dulwich.cli import main
|
6 |
+
if __name__ == '__main__':
|
7 |
+
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
|
8 |
+
sys.exit(main())
|
env/bin/dvc
ADDED
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#!/Users/alaahussein/Code/Winemakers-Dilemma/env/bin/python3
|
2 |
+
# -*- coding: utf-8 -*-
|
3 |
+
import re
|
4 |
+
import sys
|
5 |
+
from dvc.cli import main
|
6 |
+
if __name__ == '__main__':
|
7 |
+
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
|
8 |
+
sys.exit(main())
|
env/bin/dvc-data
ADDED
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#!/Users/alaahussein/Code/Winemakers-Dilemma/env/bin/python3
|
2 |
+
# -*- coding: utf-8 -*-
|
3 |
+
import re
|
4 |
+
import sys
|
5 |
+
from dvc_data.__main__ import main
|
6 |
+
if __name__ == '__main__':
|
7 |
+
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
|
8 |
+
sys.exit(main())
|
env/bin/f2py
ADDED
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#!/Users/alaahussein/Code/Winemakers-Dilemma/env/bin/python3
|
2 |
+
# -*- coding: utf-8 -*-
|
3 |
+
import re
|
4 |
+
import sys
|
5 |
+
from numpy.f2py.f2py2e import main
|
6 |
+
if __name__ == '__main__':
|
7 |
+
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
|
8 |
+
sys.exit(main())
|
env/bin/flask
ADDED
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#!/Users/alaahussein/Code/Winemakers-Dilemma/env/bin/python3
|
2 |
+
# -*- coding: utf-8 -*-
|
3 |
+
import re
|
4 |
+
import sys
|
5 |
+
from flask.cli import main
|
6 |
+
if __name__ == '__main__':
|
7 |
+
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
|
8 |
+
sys.exit(main())
|
env/bin/fonttools
ADDED
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#!/Users/alaahussein/Code/Winemakers-Dilemma/env/bin/python3
|
2 |
+
# -*- coding: utf-8 -*-
|
3 |
+
import re
|
4 |
+
import sys
|
5 |
+
from fontTools.__main__ import main
|
6 |
+
if __name__ == '__main__':
|
7 |
+
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
|
8 |
+
sys.exit(main())
|
env/bin/gql-cli
ADDED
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#!/Users/alaahussein/Code/Winemakers-Dilemma/env/bin/python3
|
2 |
+
# -*- coding: utf-8 -*-
|
3 |
+
import re
|
4 |
+
import sys
|
5 |
+
from gql.cli import gql_cli
|
6 |
+
if __name__ == '__main__':
|
7 |
+
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
|
8 |
+
sys.exit(gql_cli())
|
env/bin/gto
ADDED
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#!/Users/alaahussein/Code/Winemakers-Dilemma/env/bin/python3
|
2 |
+
# -*- coding: utf-8 -*-
|
3 |
+
import re
|
4 |
+
import sys
|
5 |
+
from gto.cli import app
|
6 |
+
if __name__ == '__main__':
|
7 |
+
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
|
8 |
+
sys.exit(app())
|
env/bin/gunicorn
ADDED
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#!/Users/alaahussein/Code/Winemakers-Dilemma/env/bin/python3
|
2 |
+
# -*- coding: utf-8 -*-
|
3 |
+
import re
|
4 |
+
import sys
|
5 |
+
from gunicorn.app.wsgiapp import run
|
6 |
+
if __name__ == '__main__':
|
7 |
+
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
|
8 |
+
sys.exit(run())
|
env/bin/httpx
ADDED
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#!/Users/alaahussein/Code/Winemakers-Dilemma/env/bin/python3
|
2 |
+
# -*- coding: utf-8 -*-
|
3 |
+
import re
|
4 |
+
import sys
|
5 |
+
from httpx import main
|
6 |
+
if __name__ == '__main__':
|
7 |
+
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
|
8 |
+
sys.exit(main())
|
env/bin/jp.py
ADDED
@@ -0,0 +1,54 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#!/Users/alaahussein/Code/Winemakers-Dilemma/env/bin/python3
|
2 |
+
|
3 |
+
import sys
|
4 |
+
import json
|
5 |
+
import argparse
|
6 |
+
from pprint import pformat
|
7 |
+
|
8 |
+
import jmespath
|
9 |
+
from jmespath import exceptions
|
10 |
+
|
11 |
+
|
12 |
+
def main():
|
13 |
+
parser = argparse.ArgumentParser()
|
14 |
+
parser.add_argument('expression')
|
15 |
+
parser.add_argument('-f', '--filename',
|
16 |
+
help=('The filename containing the input data. '
|
17 |
+
'If a filename is not given then data is '
|
18 |
+
'read from stdin.'))
|
19 |
+
parser.add_argument('--ast', action='store_true',
|
20 |
+
help=('Pretty print the AST, do not search the data.'))
|
21 |
+
args = parser.parse_args()
|
22 |
+
expression = args.expression
|
23 |
+
if args.ast:
|
24 |
+
# Only print the AST
|
25 |
+
expression = jmespath.compile(args.expression)
|
26 |
+
sys.stdout.write(pformat(expression.parsed))
|
27 |
+
sys.stdout.write('\n')
|
28 |
+
return 0
|
29 |
+
if args.filename:
|
30 |
+
with open(args.filename, 'r') as f:
|
31 |
+
data = json.load(f)
|
32 |
+
else:
|
33 |
+
data = sys.stdin.read()
|
34 |
+
data = json.loads(data)
|
35 |
+
try:
|
36 |
+
sys.stdout.write(json.dumps(
|
37 |
+
jmespath.search(expression, data), indent=4, ensure_ascii=False))
|
38 |
+
sys.stdout.write('\n')
|
39 |
+
except exceptions.ArityError as e:
|
40 |
+
sys.stderr.write("invalid-arity: %s\n" % e)
|
41 |
+
return 1
|
42 |
+
except exceptions.JMESPathTypeError as e:
|
43 |
+
sys.stderr.write("invalid-type: %s\n" % e)
|
44 |
+
return 1
|
45 |
+
except exceptions.UnknownFunctionError as e:
|
46 |
+
sys.stderr.write("unknown-function: %s\n" % e)
|
47 |
+
return 1
|
48 |
+
except exceptions.ParseError as e:
|
49 |
+
sys.stderr.write("syntax-error: %s\n" % e)
|
50 |
+
return 1
|
51 |
+
|
52 |
+
|
53 |
+
if __name__ == '__main__':
|
54 |
+
sys.exit(main())
|
env/bin/mako-render
ADDED
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#!/Users/alaahussein/Code/Winemakers-Dilemma/env/bin/python3
|
2 |
+
# -*- coding: utf-8 -*-
|
3 |
+
import re
|
4 |
+
import sys
|
5 |
+
from mako.cmd import cmdline
|
6 |
+
if __name__ == '__main__':
|
7 |
+
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
|
8 |
+
sys.exit(cmdline())
|
env/bin/markdown-it
ADDED
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#!/Users/alaahussein/Code/Winemakers-Dilemma/env/bin/python3
|
2 |
+
# -*- coding: utf-8 -*-
|
3 |
+
import re
|
4 |
+
import sys
|
5 |
+
from markdown_it.cli.parse import main
|
6 |
+
if __name__ == '__main__':
|
7 |
+
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
|
8 |
+
sys.exit(main())
|
env/bin/markdown_py
ADDED
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#!/Users/alaahussein/Code/Winemakers-Dilemma/env/bin/python3
|
2 |
+
# -*- coding: utf-8 -*-
|
3 |
+
import re
|
4 |
+
import sys
|
5 |
+
from markdown.__main__ import run
|
6 |
+
if __name__ == '__main__':
|
7 |
+
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
|
8 |
+
sys.exit(run())
|
env/bin/mlflow
ADDED
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#!/Users/alaahussein/Code/Winemakers-Dilemma/env/bin/python3
|
2 |
+
# -*- coding: utf-8 -*-
|
3 |
+
import re
|
4 |
+
import sys
|
5 |
+
from mlflow.cli import cli
|
6 |
+
if __name__ == '__main__':
|
7 |
+
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
|
8 |
+
sys.exit(cli())
|
env/bin/normalizer
ADDED
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#!/Users/alaahussein/Code/Winemakers-Dilemma/env/bin/python3
|
2 |
+
# -*- coding: utf-8 -*-
|
3 |
+
import re
|
4 |
+
import sys
|
5 |
+
from charset_normalizer.cli import cli_detect
|
6 |
+
if __name__ == '__main__':
|
7 |
+
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
|
8 |
+
sys.exit(cli_detect())
|
env/bin/pip
ADDED
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#!/Users/alaahussein/Code/Winemakers-Dilemma/env/bin/python3
|
2 |
+
# -*- coding: utf-8 -*-
|
3 |
+
import re
|
4 |
+
import sys
|
5 |
+
from pip._internal.cli.main import main
|
6 |
+
if __name__ == '__main__':
|
7 |
+
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
|
8 |
+
sys.exit(main())
|
env/bin/pip3
ADDED
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#!/Users/alaahussein/Code/Winemakers-Dilemma/env/bin/python3
|
2 |
+
# -*- coding: utf-8 -*-
|
3 |
+
import re
|
4 |
+
import sys
|
5 |
+
from pip._internal.cli.main import main
|
6 |
+
if __name__ == '__main__':
|
7 |
+
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
|
8 |
+
sys.exit(main())
|
env/bin/pip3.10
ADDED
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#!/Users/alaahussein/Code/Winemakers-Dilemma/env/bin/python3
|
2 |
+
# -*- coding: utf-8 -*-
|
3 |
+
import re
|
4 |
+
import sys
|
5 |
+
from pip._internal.cli.main import main
|
6 |
+
if __name__ == '__main__':
|
7 |
+
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
|
8 |
+
sys.exit(main())
|
env/bin/pip3.9
ADDED
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#!/Users/alaahussein/Code/Winemakers-Dilemma/env/bin/python3
|
2 |
+
# -*- coding: utf-8 -*-
|
3 |
+
import re
|
4 |
+
import sys
|
5 |
+
from pip._internal.cli.main import main
|
6 |
+
if __name__ == '__main__':
|
7 |
+
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
|
8 |
+
sys.exit(main())
|
env/bin/pyftmerge
ADDED
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#!/Users/alaahussein/Code/Winemakers-Dilemma/env/bin/python3
|
2 |
+
# -*- coding: utf-8 -*-
|
3 |
+
import re
|
4 |
+
import sys
|
5 |
+
from fontTools.merge import main
|
6 |
+
if __name__ == '__main__':
|
7 |
+
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
|
8 |
+
sys.exit(main())
|
env/bin/pyftsubset
ADDED
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#!/Users/alaahussein/Code/Winemakers-Dilemma/env/bin/python3
|
2 |
+
# -*- coding: utf-8 -*-
|
3 |
+
import re
|
4 |
+
import sys
|
5 |
+
from fontTools.subset import main
|
6 |
+
if __name__ == '__main__':
|
7 |
+
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
|
8 |
+
sys.exit(main())
|
env/bin/pygmentize
ADDED
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#!/Users/alaahussein/Code/Winemakers-Dilemma/env/bin/python3
|
2 |
+
# -*- coding: utf-8 -*-
|
3 |
+
import re
|
4 |
+
import sys
|
5 |
+
from pygments.cmdline import main
|
6 |
+
if __name__ == '__main__':
|
7 |
+
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
|
8 |
+
sys.exit(main())
|
env/bin/pygrun
ADDED
@@ -0,0 +1,164 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#!/Users/alaahussein/Code/Winemakers-Dilemma/env/bin/python3
|
2 |
+
__author__ = 'jszheng'
|
3 |
+
import optparse
|
4 |
+
import sys
|
5 |
+
import os
|
6 |
+
import importlib
|
7 |
+
from antlr4 import *
|
8 |
+
|
9 |
+
|
10 |
+
# this is a python version of TestRig
|
11 |
+
def beautify_lisp_string(in_string):
|
12 |
+
indent_size = 3
|
13 |
+
add_indent = ' '*indent_size
|
14 |
+
out_string = in_string[0] # no indent for 1st (
|
15 |
+
indent = ''
|
16 |
+
for i in range(1, len(in_string)):
|
17 |
+
if in_string[i] == '(' and in_string[i+1] != ' ':
|
18 |
+
indent += add_indent
|
19 |
+
out_string += "\n" + indent + '('
|
20 |
+
elif in_string[i] == ')':
|
21 |
+
out_string += ')'
|
22 |
+
if len(indent) > 0:
|
23 |
+
indent = indent.replace(add_indent, '', 1)
|
24 |
+
else:
|
25 |
+
out_string += in_string[i]
|
26 |
+
return out_string
|
27 |
+
|
28 |
+
|
29 |
+
if __name__ == '__main__':
|
30 |
+
|
31 |
+
#############################################################
|
32 |
+
# parse options
|
33 |
+
# not support -gui -encoding -ps
|
34 |
+
#############################################################
|
35 |
+
usage = "Usage: %prog [options] Grammar_Name Start_Rule"
|
36 |
+
parser = optparse.OptionParser(usage=usage)
|
37 |
+
# parser.add_option('-t', '--tree',
|
38 |
+
# dest="out_file",
|
39 |
+
# default="default.out",
|
40 |
+
# help='set output file name',
|
41 |
+
# )
|
42 |
+
parser.add_option('-t', '--tree',
|
43 |
+
default=False,
|
44 |
+
action='store_true',
|
45 |
+
help='Print AST tree'
|
46 |
+
)
|
47 |
+
parser.add_option('-k', '--tokens',
|
48 |
+
dest="token",
|
49 |
+
default=False,
|
50 |
+
action='store_true',
|
51 |
+
help='Show Tokens'
|
52 |
+
)
|
53 |
+
parser.add_option('-s', '--sll',
|
54 |
+
dest="sll",
|
55 |
+
default=False,
|
56 |
+
action='store_true',
|
57 |
+
help='Show SLL'
|
58 |
+
)
|
59 |
+
parser.add_option('-d', '--diagnostics',
|
60 |
+
dest="diagnostics",
|
61 |
+
default=False,
|
62 |
+
action='store_true',
|
63 |
+
help='Enable diagnostics error listener'
|
64 |
+
)
|
65 |
+
parser.add_option('-a', '--trace',
|
66 |
+
dest="trace",
|
67 |
+
default=False,
|
68 |
+
action='store_true',
|
69 |
+
help='Enable Trace'
|
70 |
+
)
|
71 |
+
|
72 |
+
options, remainder = parser.parse_args()
|
73 |
+
if len(remainder) < 2:
|
74 |
+
print('ERROR: You have to provide at least 2 arguments!')
|
75 |
+
parser.print_help()
|
76 |
+
exit(1)
|
77 |
+
else:
|
78 |
+
grammar = remainder.pop(0)
|
79 |
+
start_rule = remainder.pop(0)
|
80 |
+
file_list = remainder
|
81 |
+
|
82 |
+
#############################################################
|
83 |
+
# check and load antlr generated files
|
84 |
+
#############################################################
|
85 |
+
# dynamic load the module and class
|
86 |
+
lexerName = grammar + 'Lexer'
|
87 |
+
parserName = grammar + 'Parser'
|
88 |
+
# check if the generate file exist
|
89 |
+
lexer_file = lexerName + '.py'
|
90 |
+
parser_file = parserName + '.py'
|
91 |
+
if not os.path.exists(lexer_file):
|
92 |
+
print("[ERROR] Can't find lexer file {}!".format(lexer_file))
|
93 |
+
print(os.path.realpath('.'))
|
94 |
+
exit(1)
|
95 |
+
if not os.path.exists(parser_file):
|
96 |
+
print("[ERROR] Can't find parser file {}!".format(lexer_file))
|
97 |
+
print(os.path.realpath('.'))
|
98 |
+
exit(1)
|
99 |
+
|
100 |
+
# current directory is where the generated file loaded
|
101 |
+
# the script might be in different place.
|
102 |
+
sys.path.append('.')
|
103 |
+
# print(sys.path)
|
104 |
+
|
105 |
+
# print("Load Lexer {}".format(lexerName))
|
106 |
+
module_lexer = __import__(lexerName, globals(), locals(), lexerName)
|
107 |
+
class_lexer = getattr(module_lexer, lexerName)
|
108 |
+
# print(class_lexer)
|
109 |
+
|
110 |
+
# print("Load Parser {}".format(parserName))
|
111 |
+
module_parser = __import__(parserName, globals(), locals(), parserName)
|
112 |
+
class_parser = getattr(module_parser, parserName)
|
113 |
+
# print(class_parser)
|
114 |
+
|
115 |
+
#############################################################
|
116 |
+
# main process steps.
|
117 |
+
#############################################################
|
118 |
+
def process(input_stream, class_lexer, class_parser):
|
119 |
+
lexer = class_lexer(input_stream)
|
120 |
+
token_stream = CommonTokenStream(lexer)
|
121 |
+
token_stream.fill()
|
122 |
+
if options.token: # need to show token
|
123 |
+
for tok in token_stream.tokens:
|
124 |
+
print(tok)
|
125 |
+
if start_rule == 'tokens':
|
126 |
+
return
|
127 |
+
|
128 |
+
parser = class_parser(token_stream)
|
129 |
+
|
130 |
+
if options.diagnostics:
|
131 |
+
parser.addErrorListener(DiagnosticErrorListener())
|
132 |
+
parser._interp.predictionMode = PredictionMode.LL_EXACT_AMBIG_DETECTION
|
133 |
+
if options.tree:
|
134 |
+
parser.buildParseTrees = True
|
135 |
+
if options.sll:
|
136 |
+
parser._interp.predictionMode = PredictionMode.SLL
|
137 |
+
#parser.setTokenStream(token_stream)
|
138 |
+
parser.setTrace(options.trace)
|
139 |
+
if hasattr(parser, start_rule):
|
140 |
+
func_start_rule = getattr(parser, start_rule)
|
141 |
+
parser_ret = func_start_rule()
|
142 |
+
if options.tree:
|
143 |
+
lisp_tree_str = parser_ret.toStringTree(recog=parser)
|
144 |
+
print(beautify_lisp_string(lisp_tree_str))
|
145 |
+
else:
|
146 |
+
print("[ERROR] Can't find start rule '{}' in parser '{}'".format(start_rule, parserName))
|
147 |
+
|
148 |
+
#############################################################
|
149 |
+
# use stdin if not provide file as input stream
|
150 |
+
#############################################################
|
151 |
+
if len(file_list) == 0:
|
152 |
+
input_stream = InputStream(sys.stdin.read())
|
153 |
+
process(input_stream, class_lexer, class_parser)
|
154 |
+
exit(0)
|
155 |
+
|
156 |
+
#############################################################
|
157 |
+
# iterate all input file
|
158 |
+
#############################################################
|
159 |
+
for file_name in file_list:
|
160 |
+
if os.path.exists(file_name) and os.path.isfile(file_name):
|
161 |
+
input_stream = FileStream(file_name)
|
162 |
+
process(input_stream, class_lexer, class_parser)
|
163 |
+
else:
|
164 |
+
print("[ERROR] file {} not exist".format(os.path.normpath(file_name)))
|
env/bin/pysemver
ADDED
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#!/Users/alaahussein/Code/Winemakers-Dilemma/env/bin/python3
|
2 |
+
# -*- coding: utf-8 -*-
|
3 |
+
import re
|
4 |
+
import sys
|
5 |
+
from semver.cli import main
|
6 |
+
if __name__ == '__main__':
|
7 |
+
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
|
8 |
+
sys.exit(main())
|
env/bin/python
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:e65c410f698680428ce0db761751ceb4431231128fa3eaa4c5f2d97052d277c9
|
3 |
+
size 4003360
|
env/bin/python3
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:e65c410f698680428ce0db761751ceb4431231128fa3eaa4c5f2d97052d277c9
|
3 |
+
size 4003360
|
env/bin/python3.9
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:e65c410f698680428ce0db761751ceb4431231128fa3eaa4c5f2d97052d277c9
|
3 |
+
size 4003360
|
env/bin/shortuuid
ADDED
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#!/Users/alaahussein/Code/Winemakers-Dilemma/env/bin/python3
|
2 |
+
# -*- coding: utf-8 -*-
|
3 |
+
import re
|
4 |
+
import sys
|
5 |
+
from shortuuid.cli import cli
|
6 |
+
if __name__ == '__main__':
|
7 |
+
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
|
8 |
+
sys.exit(cli())
|
env/bin/shtab
ADDED
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#!/Users/alaahussein/Code/Winemakers-Dilemma/env/bin/python3
|
2 |
+
# -*- coding: utf-8 -*-
|
3 |
+
import re
|
4 |
+
import sys
|
5 |
+
from shtab.main import main
|
6 |
+
if __name__ == '__main__':
|
7 |
+
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
|
8 |
+
sys.exit(main())
|
env/bin/sqlformat
ADDED
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#!/Users/alaahussein/Code/Winemakers-Dilemma/env/bin/python3
|
2 |
+
# -*- coding: utf-8 -*-
|
3 |
+
import re
|
4 |
+
import sys
|
5 |
+
from sqlparse.__main__ import main
|
6 |
+
if __name__ == '__main__':
|
7 |
+
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
|
8 |
+
sys.exit(main())
|
env/bin/tabulate
ADDED
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#!/Users/alaahussein/Code/Winemakers-Dilemma/env/bin/python3
|
2 |
+
# -*- coding: utf-8 -*-
|
3 |
+
import re
|
4 |
+
import sys
|
5 |
+
from tabulate import _main
|
6 |
+
if __name__ == '__main__':
|
7 |
+
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
|
8 |
+
sys.exit(_main())
|
env/bin/tqdm
ADDED
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#!/Users/alaahussein/Code/Winemakers-Dilemma/env/bin/python3
|
2 |
+
# -*- coding: utf-8 -*-
|
3 |
+
import re
|
4 |
+
import sys
|
5 |
+
from tqdm.cli import main
|
6 |
+
if __name__ == '__main__':
|
7 |
+
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
|
8 |
+
sys.exit(main())
|
env/bin/ttx
ADDED
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#!/Users/alaahussein/Code/Winemakers-Dilemma/env/bin/python3
|
2 |
+
# -*- coding: utf-8 -*-
|
3 |
+
import re
|
4 |
+
import sys
|
5 |
+
from fontTools.ttx import main
|
6 |
+
if __name__ == '__main__':
|
7 |
+
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
|
8 |
+
sys.exit(main())
|