Skip to content

Commit 4ea5963

Browse files
authored
Add files via upload
1 parent 5cf96f8 commit 4ea5963

File tree

6 files changed

+180
-0
lines changed

6 files changed

+180
-0
lines changed

day_03/instructions/instructions.txt

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
Установить виртуальное окружение
2+
# pip3 install virtualenv
3+
4+
создать папку, в которой будет храниться окружение
5+
# mkdir virtual
6+
# cd virtual
7+
8+
#Создать виртуальное окружение
9+
python3 -m venv marlean
10+
11+
#Активировать виртуальное окружение
12+
cd marlean/bin
13+
source activate
14+
15+
Запустить код, который выводит pwd
16+
# cd ../include
17+
# python3 venv.py
18+
19+
Деактивировать и запустить код снова
20+
# deactivate
21+
# python3 venv.py
22+
23+
Что это и зачем нужно
24+
https://prognote.ru/other/creating-virtual-environments-python/

day_03/instructions/instructions1.txt

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
Termgraph - консольная утилита для рисования графиков
2+
https://xakep.ru/2018/09/14/www-termgraph/
3+
4+
Пример графика №4
5+
https://github.com/mkaz/termgraph
6+
https://pypi.org/project/termgraph/
7+
8+
9+
Установка библиотеки termgraph
10+
python3 -m pip install termgraph
11+
12+
запустить скрипт
13+
./pies_bars.sh
14+
15+
16+
17+
Обновить пип
18+
/Users/marlean/Desktop/Python_DS/Day03/ex01/virtual/marlean/bin/python3 -m pip install --upgrade pip
19+
20+
21+
22+
23+
24+
25+
26+
27+
28+
29+
30+
31+
32+
33+
34+
35+
не надо
36+
# Установка библиотеки colorama
37+
# pip install colorama

day_03/instructions/instructions2.txt

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
установить и запустить вирт.окружение
2+
3+
установить BeautifulSoup, PyTest via requirements
4+
5+
написать код, который установит библиотеки
6+
https://pythonworld.ru/moduli/modul-subprocess.html
7+
8+
https://pyneng.readthedocs.io/ru/latest/book/12_useful_modules/subprocess.html
9+
10+
https://pythonworld.ru/moduli/modul-sys.html
11+
12+
13+
ZIP
14+
tar -czf marlean.tgz marlean
15+
16+
UNZIP
17+
tar -xvf marlean.tgz

day_03/instructions/instructions3.txt

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
no - install http.client library
2+
3+
4+
5+
вернуть кортеж и распечатать его (кортеж это списки разных типов данных)
6+
https://pythonworld.ru/tipy-dannyx-v-python/kortezhi-tuple.html
7+
8+
9+
10+
Python Requests
11+
12+
python -m pip install requests
13+
https://www.digitalocean.com/community/tutorials/how-to-get-started-with-the-requests-library-in-python-ru
14+
15+
BeautifulSoup
16+
https://realpython.com/beautiful-soup-web-scraper-python/
17+
18+
19+
Cmd+Opt+I - Inspect page
20+
21+
Конструктор генератор списков
22+
https://pythonworld.ru/tipy-dannyx-v-python/spiski-list-funkcii-i-metody-spiskov.html

day_03/instructions/instructions4.txt

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
Профилирование и отладка
2+
Профилирование — сбор характеристик работы программы
3+
с целью их дальнейшей оптимизации.
4+
5+
https://habr.com/ru/company/vk/blog/201594/
6+
https://habr.com/ru/company/vk/blog/201778/
7+
https://habr.com/ru/company/vk/blog/202832/
8+
9+
cProfile рекомендуется большинству пользователей;
10+
это C расширение с разумными накладными расходами,
11+
что делает его подходящим для профилирования долго работающих программ.
12+
https://digitology.tech/docs/python_3/library/profile.html
13+
14+
15+
args
16+
'MSFT' 'Total Revenue'
17+
18+
19+
20+
#1 run this code
21+
python3 -m cProfile -s time financial.py 'MSFT' 'Total Revenue' > profiling-sleep.txt
22+
23+
#2 run this code
24+
python3 -m cProfile -s time financial.py 'MSFT' 'Total Revenue' > profiling-tottime.txt
25+
26+
#3 run this code
27+
python3 -m cProfile -s time financial_enhanced.py 'MSFT' 'Total Revenue' > profiling-http.txt
28+
29+
#4 run this code
30+
python3 -m cProfile -s ncalls financial_enhanced.py 'MSFT' 'Total Revenue' > profiling-ncalls.txt
31+
32+
#5 run this code
33+
python3 -m cProfile financial_enhanced.py 'MSFT' 'Total Revenue' > pstats-cumulative.txt

day_03/instructions/instructions5.txt

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
Unit tests
2+
3+
4+
https://habr.com/ru/post/448782/
5+
6+
7+
Установка pytest
8+
9+
$ pip3 install -U virtualenv
10+
$ python3 -m virtualenv venv
11+
$ source venv/bin/activate
12+
$ pip install pytest
13+
14+
15+
написание тестов
16+
https://habr.com/ru/post/448788/
17+
18+
19+
20+
21+
'MSFT' 'Total Revenue'
22+
23+
*** run the code ***
24+
pytest <filename>
25+
26+
ptyhon assert
27+
Assertion — это проверка, которую можно включить, а затем выключить, завершив тестирование программы.
28+
https://pythonru.com/uroki/35-instrukcija-assert-dlja-nachinajushhih
29+
30+
в инструкции написано как устанавливать pytest
31+
и далее в нашем файле мы должны прописать три функции, которые начинаются с 'test_'
32+
def test_total():
33+
result = parse_info('MSFT', 'Total Revenue')
34+
assert result[0] == 'Total Revenue'
35+
36+
def test_tuple():
37+
result = parse_info('MSFT', 'Total Revenue')
38+
assert type(result) is tuple
39+
40+
def test_exception():
41+
result = parse_info('lala', 'Total Revenue')
42+
assert result == 'Ticker is not found'
43+
44+
они подают проверочные аргументы в нашу функцию parse_info и дальше мы просто сравниваем результат с тем, что мы хотим получить
45+
46+
запускать нужно через
47+
pytest financial_test.py

0 commit comments

Comments
 (0)