master
Dawid J. Kubis 4 years ago
parent 1739831c8c
commit f0ff9238e6

@ -1,11 +0,0 @@
all: code site
site:
python3 site_gen.py
code:
python3 code_gen.py
.PHONY: site code

@ -1,4 +0,0 @@
# python-gjk
Učí profesor Kubis a docent Veškrna.

@ -1,88 +1 @@
# python-gjk
Učí profesor Kubis a docent Veškrna.
## 01
+ [bool_vyrazy](01/bool_vyrazy)
+ [datove_typy](01/datove_typy)
+ [if](01/if)
+ [interpretace](01/interpretace)
+ [komentare](01/komentare)
+ [kricici_lukas](01/kricici_lukas)
+ [operace](01/operace)
+ [promenne](01/promenne)
+ [python_interpreter](01/python_interpreter)
+ [sude_nebo_liche](01/sude_nebo_liche)
+ [zakladni_funkce](01/zakladni_funkce)
## 02
+ [umocnovani](02/umocnovani)
+ [while](02/while)
## 03
+ [fizzbuzz](03/fizzbuzz)
+ [for](03/for)
+ [funkce](03/funkce)
+ [range](03/range)
+ [seznam](03/seznam)
## 04
+ [bigdick_sito](04/bigdick_sito)
+ [erastotenovo_sito](04/erastotenovo_sito)
+ [nejbigdick](04/nejbigdick)
+ [vic_bigdick_sito](04/vic_bigdick_sito)
## [05](05)
## [06](06)
## [07](07)
## 08
+ [dict](08/dict)
+ [importy](08/importy)
+ [list_comprehensions](08/list_comprehensions)
+ [requests_and_http](08/requests_and_http)
+ [tenary_operator](08/tenary_operator)
## [09](09)
## [10](10)
## 11
+ [faktorial_rekurze](11/faktorial_rekurze)
+ [fibonacci](11/fibonacci)
+ [fibonacci_rekurze](11/fibonacci_rekurze)
+ [rekurze](11/rekurze)
## 12
+ [priklad](12/priklad)
+ [tridy_a_objekty](12/tridy_a_objekty)
## 13
+ [fraction](13/fraction)
## 14
+ [animal](14/animal)
+ [dedicnost](14/dedicnost)
##
+ [code_gen](code_gen)
+ [site_gen](site_gen)
## fotky
+ [kubis1](fotky/kubis1)
+ [kubis2](fotky/kubis2)
## projekty/star_wars
+ [matej](projekty/star_wars/matej)
+ [petr](projekty/star_wars/petr)
## projekty/tic_tac_toe
+ [katka](projekty/tic_tac_toe/katka)
+ [matej](projekty/tic_tac_toe/matej)
+ [ondra](projekty/tic_tac_toe/ondra)
+ [petr](projekty/tic_tac_toe/petr)
+ [tobias](projekty/tic_tac_toe/tobias)
+ [vlasta](projekty/tic_tac_toe/vlasta)
# Python

@ -1,23 +0,0 @@
# code_gen.py
```python
#!/usr/bin/python3
from site_gen import get_ext
import os
def mkformat(name, lines):
result = []
result.append(f'# {name}\n')
result.append('```python\n')
result += lines
result.append('```')
return result
if __name__=='__main__':
files = [(i + '.py', i + '.md') for i in get_ext('.', '.py')]
for py, md in files:
with open(py) as p:
with open(md, 'w') as m:
m.writelines(mkformat(os.path.split(p.name)[1], p.readlines()))
```

@ -1,20 +0,0 @@
#!/usr/bin/python3
from site_gen import get_ext
import os
def mkformat(name, lines):
result = []
result.append(f'# {name}\n')
result.append('```python\n')
result += lines
result.append('```')
return result
if __name__=='__main__':
files = [(i + '.py', i + '.md') for i in get_ext('.', '.py')]
for py, md in files:
with open(py) as p:
with open(md, 'w') as m:
m.writelines(mkformat(os.path.split(p.name)[1], p.readlines()))

@ -1 +0,0 @@
![kubis1](kubis1.jpg)

@ -1 +0,0 @@
![kubis2](kubis2.jpg)

@ -1,59 +0,0 @@
# site_gen.py
```python
#!/usr/bin/python3
import os
from functools import reduce
def get_ext(path, ext):
results = []
for i in os.listdir(path):
if i[0] == '.':
continue
if os.path.isdir(os.path.join(path, i)):
results = results + get_ext(os.path.join(path, i), ext)
else:
name, extension = os.path.splitext(i)
if extension == ext:
results.append(os.path.join(path, name))
return results
def mkformat(files):
result = []
files = [list(os.path.split(i)) for i in files]
files = path_dict(files)
for key in files:
if 'README' in files[key]:
result.append(f'## [{key}]({key})')
else:
result.append(f'## {key}')
for name in [i for i in sorted(files[key]) if i != 'README']:
result.append(f'+ [{name}]({os.path.join(key, name)})')
result.append('')
return result
def path_dict(files):
di = dict()
for x, y in files:
if not di.get(x):
di[x] = []
di[x].append(y)
return di
if __name__=='__main__':
prefix = []
if os.path.exists('PREFIX.md'):
with open('PREFIX.md') as p:
prefix = p.readlines()
files = sorted([i[2:] for i in get_ext('.', '.md') if i != './README' and i != './PREFIX'])
with open('README.md', 'w') as f:
to_write = mkformat(files)
to_write = [i + '\n' for i in to_write]
to_write = prefix + to_write
f.writelines(to_write)
```

@ -1,56 +0,0 @@
#!/usr/bin/python3
import os
from functools import reduce
def get_ext(path, ext):
results = []
for i in os.listdir(path):
if i[0] == '.':
continue
if os.path.isdir(os.path.join(path, i)):
results = results + get_ext(os.path.join(path, i), ext)
else:
name, extension = os.path.splitext(i)
if extension == ext:
results.append(os.path.join(path, name))
return results
def mkformat(files):
result = []
files = [list(os.path.split(i)) for i in files]
files = path_dict(files)
for key in files:
if 'README' in files[key]:
result.append(f'## [{key}]({key})')
else:
result.append(f'## {key}')
for name in [i for i in sorted(files[key]) if i != 'README']:
result.append(f'+ [{name}]({os.path.join(key, name)})')
result.append('')
return result
def path_dict(files):
di = dict()
for x, y in files:
if not di.get(x):
di[x] = []
di[x].append(y)
return di
if __name__=='__main__':
prefix = []
if os.path.exists('PREFIX.md'):
with open('PREFIX.md') as p:
prefix = p.readlines()
files = sorted([i[2:] for i in get_ext('.', '.md') if i != './README' and i != './PREFIX'])
with open('README.md', 'w') as f:
to_write = mkformat(files)
to_write = [i + '\n' for i in to_write]
to_write = prefix + to_write
f.writelines(to_write)
Loading…
Cancel
Save