forked from avinashkranjan/Amazing-Python-Scripts
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This commit fixes the style issues introduced in 5bfb399 according to the output from autopep8. Details: https://deepsource.io/gh/avinashkranjan/Amazing-Python-Scripts/transform/cde918ce-12ee-455a-a397-6e343a1a9f1b/
- Loading branch information
1 parent
5bfb399
commit 63b7450
Showing
144 changed files
with
5,576 additions
and
4,865 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 18 additions & 14 deletions
32
Applying Bitwise Operations/Applying Bitwise operations.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,26 @@ | ||
import cv2 | ||
|
||
src1= input("Enter the path of the image 1\n") #getting the path for first image | ||
src1 = cv2.imread(src1) | ||
#src1 = cv2.resize(src1,(540,540)) #resizing the image | ||
src2 = input("Enter the path of the image 2\n") #getting the path for second image | ||
# getting the path for first image | ||
src1 = input("Enter the path of the image 1\n") | ||
src1 = cv2.imread(src1) | ||
# src1 = cv2.resize(src1,(540,540)) #resizing the image | ||
# getting the path for second image | ||
src2 = input("Enter the path of the image 2\n") | ||
src2 = cv2.imread(src2) | ||
|
||
src2 = cv2.resize(src2, src1.shape[1::-1]) #Resizing the image so that both images have same dimensions | ||
andop= cv2.bitwise_and(src1, src2,mask=None) #Applying Bitwise AND operation | ||
andop=cv2.resize(andop,(640,640)) | ||
cv2.imshow('Bitwise AND',andop) | ||
# Resizing the image so that both images have same dimensions | ||
src2 = cv2.resize(src2, src1.shape[1::-1]) | ||
# Applying Bitwise AND operation | ||
andop = cv2.bitwise_and(src1, src2, mask=None) | ||
andop = cv2.resize(andop, (640, 640)) | ||
cv2.imshow('Bitwise AND', andop) | ||
|
||
orop= cv2.bitwise_or(src1, src2,mask=None) #Applying Bitwise OR operation | ||
orop=cv2.resize(orop,(640,640)) | ||
cv2.imshow('Bitwise OR',orop) | ||
orop = cv2.bitwise_or(src1, src2, mask=None) # Applying Bitwise OR operation | ||
orop = cv2.resize(orop, (640, 640)) | ||
cv2.imshow('Bitwise OR', orop) | ||
|
||
xorop = cv2.bitwise_xor(src1,src2,mask=None) #Applying Bitwise OR operation | ||
xorop=cv2.resize(xorop,(640,640)) | ||
cv2.imshow('Bitwise XOR',xorop) | ||
xorop = cv2.bitwise_xor(src1, src2, mask=None) # Applying Bitwise OR operation | ||
xorop = cv2.resize(xorop, (640, 640)) | ||
cv2.imshow('Bitwise XOR', xorop) | ||
cv2.waitKey(0) | ||
cv2.destroyAllWindows() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,44 +1,48 @@ | ||
import ezgmail | ||
|
||
|
||
def attachmentdownload(resulthreads): | ||
# Two Objects used in code are GmailThread and GmailMessage | ||
# 1. GmailThread - Represents conversation threads | ||
# 2. GmailMessage - Represents individual emails within Threads | ||
countofresults = len(resulthreads) | ||
try: | ||
for i in range(countofresults): | ||
if len(resulthreads[i].messages) > 1: # checks whether the count of messages in threads is greater than 1 | ||
# checks whether the count of messages in threads is greater than 1 | ||
if len(resulthreads[i].messages) > 1: | ||
for j in range(len(resulthreads[i].messages)): | ||
resulthreads[i].messages[ | ||
j].downloadAllAttachments() # downloads attachment(s) for individual messages | ||
else: | ||
resulthreads[i].messages[0].downloadAllAttachments() # downloads attachment(s) for single message | ||
# downloads attachment(s) for single message | ||
resulthreads[i].messages[0].downloadAllAttachments() | ||
print("Download compelete. Please check your root directory.") | ||
except: | ||
raise Exception("Error occured while downloading attachment(s).") | ||
|
||
|
||
if __name__ == '__main__': | ||
query = input("Enter search query: ") | ||
newquery = query + " + has:attachment" # appending to make sure the result threads always has an attachment | ||
resulthreads = ezgmail.search(newquery) # search functions accepts all the operators described at https://support.google.com/mail/answer/7190?hl=en | ||
# appending to make sure the result threads always has an attachment | ||
newquery = query + " + has:attachment" | ||
# search functions accepts all the operators described at https://support.google.com/mail/answer/7190?hl=en | ||
resulthreads = ezgmail.search(newquery) | ||
|
||
if len(resulthreads) == 0: | ||
print("Result has no attachments:") # Executed if results don't have attachment | ||
# Executed if results don't have attachment | ||
print("Result has no attachments:") | ||
else: | ||
print("Result(s) with attachments:") | ||
for threads in resulthreads: | ||
print(f"Email Subject: {threads.messages[0].subject}") # prints the subject line of email thread in results | ||
# prints the subject line of email thread in results | ||
print(f"Email Subject: {threads.messages[0].subject}") | ||
try: | ||
ask = input( | ||
"Do you want to download attachment(s) in result(s) (Yes/No)? ") # Allows user to decide whether they want to download attachment(s) or not | ||
if ask == "Yes": | ||
attachmentdownload(resulthreads) # calls the function that downloads attachment(s) | ||
# calls the function that downloads attachment(s) | ||
attachmentdownload(resulthreads) | ||
else: | ||
print("Program exited") | ||
except: | ||
print("Something went wrong") | ||
|
||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.