Skip to content

Commit 4e0c625

Browse files
committed
first committe
0 parents  commit 4e0c625

5 files changed

Lines changed: 279 additions & 0 deletions

File tree

.gitignore

Lines changed: 156 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,156 @@
1+
2+
# Created by https://www.toptal.com/developers/gitignore/api/python
3+
# Edit at https://www.toptal.com/developers/gitignore?templates=python
4+
5+
.idea/
6+
### Python ###
7+
# Byte-compiled / optimized / DLL files
8+
__pycache__/
9+
*.py[cod]
10+
*$py.class
11+
12+
# C extensions
13+
*.so
14+
15+
# Distribution / packaging
16+
.Python
17+
build/
18+
develop-eggs/
19+
dist/
20+
downloads/
21+
eggs/
22+
.eggs/
23+
parts/
24+
sdist/
25+
var/
26+
wheels/
27+
pip-wheel-metadata/
28+
share/python-wheels/
29+
*.egg-info/
30+
.installed.cfg
31+
*.egg
32+
MANIFEST
33+
34+
# PyInstaller
35+
# Usually these files are written by a python script from a template
36+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
37+
*.manifest
38+
*.spec
39+
40+
# Installer logs
41+
pip-log.txt
42+
pip-delete-this-directory.txt
43+
44+
# Unit test / coverage reports
45+
htmlcov/
46+
.tox/
47+
.nox/
48+
.coverage
49+
.coverage.*
50+
.cache
51+
nosetests.xml
52+
coverage.xml
53+
*.cover
54+
*.py,cover
55+
.hypothesis/
56+
.pytest_cache/
57+
pytestdebug.log
58+
59+
# Translations
60+
*.mo
61+
*.pot
62+
63+
# Django stuff:
64+
*.log
65+
local_settings.py
66+
db.sqlite3
67+
db.sqlite3-journal
68+
69+
# Flask stuff:
70+
instance/
71+
.webassets-cache
72+
73+
# Scrapy stuff:
74+
.scrapy
75+
76+
# Sphinx documentation
77+
docs/_build/
78+
doc/_build/
79+
80+
# PyBuilder
81+
target/
82+
83+
# Jupyter Notebook
84+
.ipynb_checkpoints
85+
86+
# IPython
87+
profile_default/
88+
ipython_config.py
89+
90+
# pyenv
91+
.python-version
92+
93+
# pipenv
94+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
95+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
96+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
97+
# install all needed dependencies.
98+
#Pipfile.lock
99+
100+
# poetry
101+
#poetry.lock
102+
103+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow
104+
__pypackages__/
105+
106+
# Celery stuff
107+
celerybeat-schedule
108+
celerybeat.pid
109+
110+
# SageMath parsed files
111+
*.sage.py
112+
113+
# Environments
114+
# .env
115+
.env/
116+
.venv/
117+
env/
118+
venv/
119+
ENV/
120+
env.bak/
121+
venv.bak/
122+
pythonenv*
123+
124+
# Spyder project settings
125+
.spyderproject
126+
.spyproject
127+
128+
# Rope project settings
129+
.ropeproject
130+
131+
# mkdocs documentation
132+
/site
133+
134+
# mypy
135+
.mypy_cache/
136+
.dmypy.json
137+
dmypy.json
138+
139+
# Pyre type checker
140+
.pyre/
141+
142+
# pytype static type analyzer
143+
.pytype/
144+
145+
# operating system-related files
146+
# file properties cache/storage on macOS
147+
*.DS_Store
148+
# thumbnail cache on Windows
149+
Thumbs.db
150+
151+
# profiling data
152+
.prof
153+
154+
155+
# End of https://www.toptal.com/developers/gitignore/api/python
156+
n

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2021 Reza Mobaraki | MR.Rezoo
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

assets/thread.png

135 KB
Loading

readme.md

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
# Python-Multi-Threading
2+
3+
![python](assets/thread.png)
4+
5+
Hello this is [Mr.Rezoo](https://www.linkedin.com/in/reza-mobaraki/)
6+
7+
## Table of contents
8+
9+
* [General info](#General-info)
10+
* [Technologies](#Technologies)
11+
* [Help](#Help)
12+
* [Setup](#Setup)
13+
* [Usage](#Usage)
14+
* [Credits](#credits)
15+
* [Contributors](#Contributors)
16+
* [License](#license)
17+
18+
## General info
19+
20+
in this repository We work on threading with threading module on python
21+
22+
## Technologies
23+
24+
Project is created with:
25+
26+
* Python: 3.9
27+
* nose: 1.3.7
28+
* pytest: 6.2.4
29+
30+
## Help
31+
32+
If you are considering a particular method, more modern technology Add to my
33+
project and send merge request, I will add you in the credits and contributors
34+
section
35+
36+
## Setup
37+
38+
* first step : create virtual environment
39+
40+
```shell
41+
virtualenv -p python3 venv
42+
```
43+
44+
* second step : activate virtual environment
45+
46+
```shell
47+
source venv/bin/activate
48+
```
49+
50+
* third step : install package | library from requirements.txt
51+
52+
```shell
53+
pip install -r requirements.txt
54+
```
55+
56+
* fourth step : install package | library from requirements.txt
57+
58+
```shell
59+
pip install -r requirements.txt
60+
```
61+
62+
## Usage
63+
64+
```markdown
65+
66+
```
67+
68+
## Credits
69+
70+
* [mongard](https://www.mongard.ir/courses/threading)
71+
72+
## Contributors
73+
74+
* [MrRezoo](https://github.com/MrRezoo)
75+
76+
## License
77+
78+
Distributed under the MIT License. See [license](LICENSE) for more information.

src/show.py

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
from time import sleep, perf_counter
2+
from threading import Thread
3+
4+
start = perf_counter()
5+
6+
7+
def show(name):
8+
print(f'Starting {name} ...')
9+
sleep(3)
10+
print(f'Finishing {name} ...')
11+
12+
13+
t1 = Thread(target=show, args=('One',))
14+
t2 = Thread(target=show, args=('Two',))
15+
16+
t1.start()
17+
t2.start()
18+
19+
t1.join()
20+
t2.join()
21+
22+
23+
end = perf_counter()
24+
print(round(end - start))

0 commit comments

Comments
 (0)