Skip to content

Commit 9717020

Browse files
committed
Merging two repos
1 parent 1b7c4ee commit 9717020

File tree

6 files changed

+267
-8
lines changed

6 files changed

+267
-8
lines changed

.gitignore

+162-8
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,167 @@
1-
# Local History for Visual Studio Code
2-
.history/
1+
# Byte-compiled / optimized / DLL files
2+
__pycache__/
3+
*.py[cod]
4+
*$py.class
35

4-
# Built Visual Studio Code Extensions
5-
*.vsix
6+
# C extensions
7+
*.so
8+
9+
# Distribution / packaging
10+
.Python
11+
build/
12+
develop-eggs/
13+
dist/
14+
downloads/
15+
eggs/
16+
.eggs/
17+
lib/
18+
lib64/
19+
parts/
20+
sdist/
21+
var/
22+
wheels/
23+
share/python-wheels/
24+
*.egg-info/
25+
.installed.cfg
26+
*.egg
27+
MANIFEST
28+
29+
# PyInstaller
30+
# Usually these files are written by a python script from a template
31+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
32+
*.manifest
33+
*.spec
34+
35+
# Installer logs
36+
pip-log.txt
37+
pip-delete-this-directory.txt
38+
39+
# Unit test / coverage reports
40+
htmlcov/
41+
.tox/
42+
.nox/
43+
.coverage
44+
.coverage.*
45+
.cache
46+
nosetests.xml
47+
coverage.xml
48+
*.cover
49+
.hypothesis/
50+
.pytest_cache/
51+
cover/
52+
53+
# Translations
54+
*.mo
55+
*.pot
56+
57+
# Django stuff:
58+
*.log
59+
local_settings.py
60+
db.sqlite3
61+
db.sqlite3-journal
62+
63+
# Flask stuff:
64+
instance/
65+
.webassets-cache
66+
67+
# Scrapy stuff:
68+
.scrapy
69+
70+
# Sphinx documentation
71+
docs/_build/
72+
73+
# PyBuilder
74+
.pybuilder/
75+
target/
76+
77+
# Jupyter Notebook
78+
.ipynb_checkpoints
79+
80+
# IPython
81+
profile_default/
82+
ipython_config.py
83+
84+
# pyenv
85+
# For a library or package, you might want to ignore these files since the code is
86+
# intended to run in multiple environments; otherwise, check them in:
87+
# .python-version
88+
89+
# pipenv
90+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
91+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
92+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
93+
# install all needed dependencies.
94+
#Pipfile.lock
695

7-
# VSCode
96+
# poetry
97+
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
98+
# This is especially recommended for binary packages to ensure reproducibility, and is more
99+
# commonly ignored for libraries.
100+
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
101+
#poetry.lock
102+
103+
# pdm
104+
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
105+
#pdm.lock
106+
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
107+
# in version control.
108+
# https://pdm.fming.dev/#use-with-ide
109+
.pdm.toml
110+
111+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
112+
__pypackages__/
113+
114+
# Celery stuff
115+
celerybeat-schedule
116+
celerybeat.pid
117+
118+
# SageMath parsed files
119+
*.sage.py
120+
121+
# Environments
122+
.env
123+
.venv
124+
env/
125+
venv/
126+
ENV/
127+
env.bak/
128+
venv.bak/
129+
130+
# Spyder project settings
131+
.spyderproject
132+
.spyproject
133+
134+
# Rope project settings
135+
.ropeproject
136+
137+
# mkdocs documentation
138+
/site
139+
140+
# mypy
141+
.mypy_cache/
142+
.dmypy.json
143+
dmypy.json
144+
145+
# Pyre type checker
146+
.pyre/
147+
148+
# pytype static type analyzer
149+
.pytype/
150+
151+
# Cython debug symbols
152+
cython_debug/
153+
154+
# PyCharm
155+
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
156+
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
157+
# and can be added to the global gitignore or merged into this file. For a more nuclear
158+
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
159+
#.idea/
8160
**/.vscode/
9161
.vscode/*
10162

11-
# Byte-compiled / optimized / DLL files
12-
__pycache__/
13-
*.py[cod]
163+
# Local History for Visual Studio Code
164+
.history/
165+
166+
# Built Visual Studio Code Extensions
167+
*.vsix

README.md

+53
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,59 @@ Additionally, consider sharing it with the community using the badges below.
6969
| 📅 | Automate the update process. | `scheduled` | 📅 03/02/2024 |
7070
| 🚧 | Fix the Share Buttons | `in progress` | 📅 14/01/2024 |
7171

72+
## Updates
73+
74+
### Potential
75+
76+
- [ ] Create a database for Challenges.
77+
- [ ] Minimize requests to only new challenges.
78+
79+
### Add.py
80+
81+
#### Input
82+
83+
- [ ] Set a new argument -s for "submit --yes" if the want the contents of wars.py to be submitted as their solution.
84+
- [ ] Set a new argument -n for "notes" if they want the contents of notes.txt to be sumbitted as their notes for the challenge.
85+
86+
#### Validation
87+
88+
- [ ] Check valid username
89+
- [ ] Check Template.md file exists.
90+
- [ ] Check Template.md file valid.
91+
- [ ] Determine Challenge Path
92+
93+
#### Improvements
94+
95+
- [ ] What to do when API request fails?
96+
- [ ] Query database
97+
98+
<br>
99+
100+
### Functions.py
101+
102+
- [ ]
103+
104+
<br>
105+
106+
### Update.py
107+
108+
#### Validation
109+
110+
- [ ] Create input Validation methods
111+
112+
#### Logic
113+
114+
#### Improvements
115+
116+
- [ ] Update.md must print "Acquired {number} new challenges. Updating the database..."
117+
118+
<br>
119+
120+
### Completed ✓
121+
122+
- [x] Configure [YAPF](https://github.com/google/yapf).
123+
- [x] Set up a usage guide for the [add.py](https://github.com/gzachariadis/Python.Challenges/blob/main/add.py) client.
124+
72125
## Coding Style
73126

74127
<p align="justify">Almost every problem has a long, verbose and short, concise solution. IMHO, a long descriptive solution is almost always preferred over a cryptic one-liner. The exception being, a shared understanding of the code by the entire development team.</p>

Wars.py

Whitespace-only changes.

notes.txt

Whitespace-only changes.

requirements.txt

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
watchdog==3.0.0

watch.py

+51
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
#!/usr/bin/python
2+
3+
import datetime
4+
import os
5+
import subprocess
6+
import time
7+
8+
from watchdog.events import FileSystemEventHandler
9+
from watchdog.observers import Observer
10+
11+
def is_non_zero_file(fpath):
12+
return os.path.isfile(fpath) and os.path.getsize(fpath) > 0
13+
14+
class Handler(FileSystemEventHandler):
15+
16+
def __init__(self, time = datetime.datetime.now()):
17+
self.time = time
18+
19+
def on_modified(self, event):
20+
time.sleep(1)
21+
os.system("cls")
22+
print(event.src_path)
23+
if event.src_path == r'.\Wars.py':
24+
print("called")
25+
if is_non_zero_file(os.path.join(os.path.realpath(os.path.join(os.getcwd(), os.path.dirname(__file__))),
26+
"wars.py",
27+
)):
28+
print("\n")
29+
print("Output: ")
30+
print("\n")
31+
subprocess.run(["python", event.src_path])
32+
else:
33+
open(
34+
os.path.join(os.path.realpath(os.path.join(os.getcwd(), os.path.dirname(__file__))), "notes.txt",
35+
),
36+
"w",
37+
).close()
38+
os.system("cls")
39+
40+
if __name__ == "__main__":
41+
event_handler = Handler()
42+
observer = Observer()
43+
observer.schedule(event_handler, path = ".", recursive = False)
44+
observer.start()
45+
46+
try:
47+
while True:
48+
time.sleep(5)
49+
except KeyboardInterrupt:
50+
observer.stop()
51+
observer.join()

0 commit comments

Comments
 (0)