Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Linting #941

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
17 changes: 13 additions & 4 deletions BSE_data/bombay.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
for j in i:
print(j, i[j])

print('\n-------------------------\n')
print("\n-------------------------\n")

tl = b.topLosers()
print("\nTOP LOSERS - Now\n")
Expand All @@ -16,9 +16,18 @@
print(f"{j}: {i[j]}")

# indices catagory parameter
category = ["market_cap/broad", "sector_and_industry", "thematics",
"strategy", "sustainability", "volatility", "composite",
"government", "corporate", "money_market"]
category = [
"market_cap/broad",
"sector_and_industry",
"thematics",
"strategy",
"sustainability",
"volatility",
"composite",
"government",
"corporate",
"money_market",
]

for i in category:
indices = b.getIndices(category=i)
Expand Down
15 changes: 7 additions & 8 deletions Detect_and_Translate_languages/detect_translate.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@

# Python program to detect and translate with the help of speech recognition

import pyttsx3
import speech_recognition as sr
from langdetect import detect
from google_trans_new import google_translator
import pyttsx3
from langdetect import detect

'''
"""
Supported Languages:
{'af': 'afrikaans', 'sq': 'albanian', 'am': 'amharic', 'ar': 'arabic',
'hy': 'armenian', 'az': 'azerbaijani', 'eu': 'basque', 'be': 'belarusian',
Expand Down Expand Up @@ -41,7 +41,7 @@
'cy': 'welsh', 'xh': 'xhosa', 'yi': 'yiddish', 'yo': 'yoruba',
'zu': 'zulu', 'fil': 'Filipino', 'he': 'Hebrew'}

'''
"""

r = sr.Recognizer()
translator = google_translator()
Expand All @@ -61,18 +61,17 @@ def trans(x, d):


print("Start speaking.....(To terminate the program say 'Stop!')")
while (1):
while 1:
try:
with sr.Microphone() as source2:
r.adjust_for_ambient_noise(source2, duration=0.2)
audio2 = r.listen(source2)
MyText = r.recognize_google(audio2)
MyText.lower()
if MyText == 'stop':
if MyText == "stop":
break
print("Did you say " + MyText)
d = input(
'Enter the language you need the text to be translated into:')
d = input("Enter the language you need the text to be translated into:")
translated = trans(MyText, d)
print(translated)
SpeakText(MyText)
Expand Down
5 changes: 3 additions & 2 deletions aes_py/aes_tool.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import base64
from Crypto.Cipher import AES

from Crypto import Random
from Crypto.Cipher import AES
from Crypto.Protocol.KDF import PBKDF2

BLOCK_SIZE = 16
Expand All @@ -13,7 +14,7 @@ def pad(s):


def unpad(s):
return s[: -ord(s[len(s) - 1:])]
return s[: -ord(s[len(s) - 1 :])]


def get_private_key(password):
Expand Down
8 changes: 5 additions & 3 deletions aes_py/main.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
import argparse
from getpass import getpass
import aes_tool

import aes_tool

parser = argparse.ArgumentParser(description="Aes \
encryption and decryption command")
parser = argparse.ArgumentParser(
description="Aes \
encryption and decryption command"
)

parser.add_argument("--text", help=argparse.SUPPRESS)
parser.add_argument(
Expand Down
9 changes: 5 additions & 4 deletions alarm_clock/AlarmClock.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
import time
import datetime
import time

import simpleaudio

t = int()


def snooze(t):
global set_time
HH_MM = set_time.split(':')
HH_MM = set_time.split(":")
HH_MM[1] = str(int(HH_MM[1]) + t)
set_time = ':'.join(HH_MM)
set_time = ":".join(HH_MM)


set_time = input("please enter the time in HH:MM format to set an alarm : ")
Expand All @@ -34,7 +35,7 @@ def alarm(set_time):
while True:
alarm(set_time)
x = input("Press y if you want the alarm to snooze: ")
if x == 'y':
if x == "y":
t = int(input("Snooze time: "))
snooze(t)
print(f"The alarm will ring again in {t} min")
Expand Down
7 changes: 4 additions & 3 deletions algebra_solver_gui/algebra.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from sympy.core.sympify import kernS
import PySimpleGUIQt as sg
import sympy as sy
from sympy.core.sympify import kernS


class AlgebraSolver:
Expand All @@ -27,8 +27,9 @@ def evaluate_linear(self, expression):
return sy.solveset(sy.Eq(sy_exp, req))

def render(self):
window = sg.Window("Algebra Solver", resizable=True,
size=(800, 100)).Layout(self.layout)
window = sg.Window("Algebra Solver", resizable=True, size=(800, 100)).Layout(
self.layout
)

while True:
event, values = window.Read()
Expand Down
79 changes: 40 additions & 39 deletions aqi_tracker/aqi-tracker.py
Original file line number Diff line number Diff line change
@@ -1,76 +1,77 @@
import requests
import sys
import getopt
import sys

import requests

def main(argv):

def main(argv):
def usage():
print('usage: %s [-c city] [-a accesstoken] [-h help] ...') \
% argv[0]
print("usage: %s [-c city] [-a accesstoken] [-h help] ...") % argv[0]
return 100

try:
(opts, args) = getopt.getopt(argv[1:], 'c:a:h')
(opts, args) = getopt.getopt(argv[1:], "c:a:h")
except getopt.GetoptError:
return usage()

def help():
print("AQI Tracker -"
"\tLets the user know the real-time air quality values"
"\t\t(usage: %s [-c city] [-a accesstoken] [-h help])"
"\ncity:\t\tname of the cit"
"\naccesstoken:\tYou need to get access token by "
"registering on http://aqicn.org/data-platform/register/"
"\n\t\t*if no accesstoken provided then demo accesstoken will"
" be used \n\t\tand with demo access token only Shanghai's"
" air quality values can be retrieved.")

city = 'shanghai'
accesstoken = 'demo'
print(
"AQI Tracker -"
"\tLets the user know the real-time air quality values"
"\t\t(usage: %s [-c city] [-a accesstoken] [-h help])"
"\ncity:\t\tname of the cit"
"\naccesstoken:\tYou need to get access token by "
"registering on http://aqicn.org/data-platform/register/"
"\n\t\t*if no accesstoken provided then demo accesstoken will"
" be used \n\t\tand with demo access token only Shanghai's"
" air quality values can be retrieved."
)

city = "shanghai"
accesstoken = "demo"

for (k, v) in opts:
if k == '-c':
if k == "-c":
city = v
elif k == '-a':
elif k == "-a":

accesstoken = v
elif k == '-h':
elif k == "-h":

return help()

url = 'http://api.waqi.info/feed/' + city + '/?token=' + accesstoken
print('URL: ', url)
url = "http://api.waqi.info/feed/" + city + "/?token=" + accesstoken
print("URL: ", url)

r = requests.get(url, auth=('user', 'pass'))
r = requests.get(url, auth=("user", "pass"))

if r.status_code == 200:
data = r.json()
value = data['data']['iaqi']['pm25']['v']
value = data["data"]["iaqi"]["pm25"]["v"]
toDisplay = str(value)

if value > 0 and value < 50:
print('Air Quality Alert ->')
print('Current Value: Healthy - ' + toDisplay)
print("Air Quality Alert ->")
print("Current Value: Healthy - " + toDisplay)
elif value > 50 and value < 100:
print('Air Quality Alert ->')
print('Current Value: Moderate - ' + toDisplay)
print("Air Quality Alert ->")
print("Current Value: Moderate - " + toDisplay)
elif value > 100 and value < 150:
print('Air Quality Alert ->')
print('Current Value: Sensitive - ' + toDisplay)
print("Air Quality Alert ->")
print("Current Value: Sensitive - " + toDisplay)
elif value > 150 and value < 200:
print('Air Quality Alert ->')
print('Current Value: UnHealhty - ' + toDisplay)
print("Air Quality Alert ->")
print("Current Value: UnHealhty - " + toDisplay)
elif value > 200 and value < 250:
print('Air Quality Alert ->')
print('Current Value: UnHealthy - ' + toDisplay)
print("Air Quality Alert ->")
print("Current Value: UnHealthy - " + toDisplay)
elif value > 250 and value > 300:
print('Air Quality Alert ->')
print('Current Value: Hazardous - ' + toDisplay)
print("Air Quality Alert ->")
print("Current Value: Hazardous - " + toDisplay)
else:

print('Error: Unable to connect to server')
print("Error: Unable to connect to server")


if __name__ == '__main__':
if __name__ == "__main__":
sys.exit(main(sys.argv))
Loading
Loading