Skip to content

Commit 74e71c9

Browse files
Merge pull request #44 from Moduland/main_script
Main script
2 parents 56cd51d + 20a55a5 commit 74e71c9

File tree

13 files changed

+125
-15
lines changed

13 files changed

+125
-15
lines changed

.github/CODE_OF_CONDUCT.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ further defined and clarified by project maintainers.
5555
## Enforcement
5656

5757
Instances of abusive, harassing, or otherwise unacceptable behavior may be
58-
reported by contacting the project team at info@moduland.ir. All
58+
reported by contacting the project team at info@orangetool.ir. All
5959
complaints will be reviewed and investigated and will result in a response that
6060
is deemed necessary and appropriate to the circumstances. The project team is
6161
obligated to maintain confidentiality with regard to the reporter of an incident.

.github/FUNDING.yml

Lines changed: 0 additions & 1 deletion
This file was deleted.

.gitignore

Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
# Created by .ignore support plugin (hsz.mobi)
2+
### Python template
3+
# Byte-compiled / optimized / DLL files
4+
__pycache__/
5+
*.py[cod]
6+
*$py.class
7+
8+
# C extensions
9+
*.so
10+
11+
# Distribution / packaging
12+
.Python
13+
env/
14+
build/
15+
develop-eggs/
16+
dist/
17+
downloads/
18+
eggs/
19+
.eggs/
20+
lib/
21+
lib64/
22+
parts/
23+
sdist/
24+
var/
25+
*.egg-info/
26+
.installed.cfg
27+
*.egg
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+
.coverage
43+
.coverage.*
44+
.cache
45+
nosetests.xml
46+
coverage.xml
47+
*,cover
48+
.hypothesis/
49+
50+
# Translations
51+
*.mo
52+
*.pot
53+
54+
# Django stuff:
55+
*.log
56+
local_settings.py
57+
58+
# Flask stuff:
59+
instance/
60+
.webassets-cache
61+
62+
# Scrapy stuff:
63+
.scrapy
64+
65+
# Sphinx documentation
66+
docs/_build/
67+
68+
# PyBuilder
69+
target/
70+
71+
# Jupyter Notebook
72+
.ipynb_checkpoints
73+
74+
# pyenv
75+
.python-version
76+
77+
# celery beat schedule file
78+
celerybeat-schedule
79+
80+
# dotenv
81+
.env
82+
83+
# virtualenv
84+
.venv/
85+
venv/
86+
ENV/
87+
88+
# Spyder project settings
89+
.spyderproject
90+
91+
# Rope project settings
92+
.ropeproject
93+
### Example user template template
94+
### Example user template
95+
96+
# IntelliJ project files
97+
.idea
98+
*.iml
99+
out
100+
gen

.travis.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ matrix:
3030
install:
3131
- pip install -r requirements.txt
3232
- python setup.py install
33+
- python -m orangetool
3334
before_script:
3435
- pip install --upgrade --upgrade-strategy=only-if-needed -r dev-requirements.txt
3536
- chmod +x test.sh

CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
66

77
## [Unreleased]
88
### Added
9-
- `FUNDING.yml`
9+
- `__main__.py`
1010
- `__version__` variable
1111
- `hibernate` function
1212
- `usb_control`, `usb_on` and `usb_off` functions
@@ -20,6 +20,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
2020
- `Zone` parameter renamed to `zone`
2121
- `uptime` and `idletime` functions updated
2222
- Docstrings updated
23+
- `README.md` modified
2324
## [0.35] - 2019-06-01
2425
### Added
2526
- `version_check.py`

README.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,8 @@ Tested on [Lubuntu](http://lubuntu.me/)
7171
<table>
7272
<tr>
7373
<td align="center">Code Quality</td>
74-
<td align="center"><a href="https://www.codacy.com/app/sepand-haghighi/Orangetool?utm_source=github.com&amp;utm_medium=referral&amp;utm_content=Moduland/Orangetool&amp;utm_campaign=Badge_Grade"><img src="https://api.codacy.com/project/badge/Grade/ad9374e6e7b24a63b34d6a4f419497ac"/></a></td>
74+
<td align="center"><a href="https://www.codacy.com/app/sepand-haghighi/Orangetool?utm_source=github.com&amp;utm_medium=referral&amp;utm_content=Moduland/Orangetool&amp;utm_campaign=Badge_Grade"><img src="https://api.codacy.com/project/badge/Grade/ad9374e6e7b24a63b34d6a4f419497ac"/></a></td>
75+
<td align="center"><a href="https://codebeat.co/projects/github-com-moduland-orangetool-dev"><img alt="codebeat badge" src="https://codebeat.co/badges/78f987a9-d504-4d29-b98d-21dd1f2d319e" /></a></td>
7576
<td align="center"><a href="https://www.codefactor.io/repository/github/moduland/orangetool"><img src="https://www.codefactor.io/repository/github/moduland/orangetool/badge" alt="CodeFactor" /></a></td>
7677
</tr>
7778
</table>
@@ -128,7 +129,7 @@ ip_status=orangetool.ping(ip_address) #this function check ip and return True if
128129

129130
#5- set_ip
130131

131-
set_ip("192.168.1.46","eth0") #this function set static ip for system
132+
orangetool.set_ip("192.168.1.46","eth0") #this function set static ip for system
132133

133134
#6- mac
134135

@@ -275,7 +276,7 @@ orangetool.check_update() # Return True if new version is available
275276
## Issues & Bug Reports
276277

277278
Just fill an issue and describe it. We'll check it ASAP!
278-
or send an email to [info@moduland.ir](mailto:info@moduland.ir "info@moduland.ir").
279+
or send an email to [info@orangetool.ir](mailto:info@orangetool.ir "info@orangetool.ir").
279280

280281
## Dependencies
281282

orangetool/__main__.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# -*- coding: utf-8 -*-
2+
"""Orangetool main."""
3+
4+
from .orangetool_system import version
5+
6+
if __name__ == "__main__":
7+
version()

orangetool/orangetool_ip.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ def local_ip(debug=False):
4747
ip = socket.gethostbyname(socket.gethostname())
4848
if ip != "127.0.0.1":
4949
return ip
50-
elif platform.system() != "Windows":
50+
if platform.system() != "Windows":
5151
command = sub.Popen(["hostname",
5252
"-I"],
5353
stdout=sub.PIPE,
@@ -110,7 +110,7 @@ def set_ip(ip, restart=False, device="eth0", debug=False):
110110
dns-nameservers 8.8.8.8 8.8.4.4
111111
'''
112112
try:
113-
if bool(re.match(IP_PATTERN, ip)) == False or ip.find(
113+
if not bool(re.match(IP_PATTERN, ip)) or ip.find(
114114
"192.168.") == -1 or device not in mac().keys():
115115
raise Exception("IP Formation Error")
116116
static_string = static_string.replace("ip", ip)
@@ -142,7 +142,7 @@ def ping(ip, packet_number=3, debug=False):
142142
:return: a boolean value (True if ip is available and False otherwise)
143143
"""
144144
try:
145-
if re.match(IP_PATTERN, ip) == False:
145+
if not re.match(IP_PATTERN, ip):
146146
raise Exception("IP Formation Error")
147147
output = str(list(sub.Popen(["ping",
148148
ip,

orangetool/orangetool_storage.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,7 @@ def mount_status(device_name, debug=False):
2727
memory_list.append(temp[1])
2828
if len(memory_list) == 0:
2929
return "u"
30-
else:
31-
return memory_list
30+
return memory_list
3231
except Exception as e:
3332
if debug:
3433
print(str(e))

orangetool/orangetool_test.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# -*- coding: utf-8 -*-
22
"""Orangetool test."""
3-
from orangetool import *
3+
from orangetool import version, check_update
44

55
if __name__ == "__main__":
6-
version()
6+
version()
7+
check_update()

0 commit comments

Comments
 (0)