diff --git a/.gitignore b/.gitignore index 66416c6..e388ea0 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,3 @@ -<<<<<<< HEAD - # Created by https://www.toptal.com/developers/gitignore/api/python # Edit at https://www.toptal.com/developers/gitignore?templates=python @@ -143,4 +141,3 @@ dmypy.json ======= #Ignore enviroment files /env ->>>>>>> 3c73d451606203216ef00f7bfb7a176bce5a8c43 diff --git a/alliterations/alliterationInFile.py b/alliterations/alliterationInFile.py index 4a549d5..8db5b7f 100644 --- a/alliterations/alliterationInFile.py +++ b/alliterations/alliterationInFile.py @@ -13,7 +13,6 @@ def main(): # Check if sys.argv[1] is given argumentOne = "" try: -<<<<<<< HEAD argumentOne = sys.argv[1] except IndexError: exit("No second argument given. " @@ -53,28 +52,3 @@ def main(): if __name__ == "__main__": main() -======= - openedFile = open(argumentOne, "r",encoding='ascii',errors='ignore') - openedContent = openedFile.read() - except OSError: - exit("Could not open file") -else: - exit("Given file does not exist: " + argumentOne) - -# Create alliteration regex. -alliRegex = re.compile(r"((\s)(\w)\w*\s\3\w*((\s\3\w*)?)*)", re.IGNORECASE) - -matches = [] -for groups in alliRegex.findall(openedContent): - alliterations = groups[0][1:] - matches.append(alliterations) - -openedFile.close() - -if len(matches) > 0: - pyperclip.copy(' -+- '.join(matches)) - print("Alliteration(s) found:") - print('\n'.join(matches)) -else: - print('No alliteration found.') ->>>>>>> 3c73d451606203216ef00f7bfb7a176bce5a8c43 diff --git a/emailAdresses/emailInFile.py b/emailAdresses/emailInFile.py index c5f49b3..6eebd25 100644 --- a/emailAdresses/emailInFile.py +++ b/emailAdresses/emailInFile.py @@ -13,7 +13,6 @@ def main(): # Check if sys.argv[1] is given argumentOne = "" try: -<<<<<<< HEAD argumentOne = sys.argv[1] except IndexError: exit("No second argument given. " @@ -53,33 +52,3 @@ def main(): if __name__ == "__main__": main() -======= - openedFile = open(argumentOne, "r",encoding='ascii',errors='ignore') - openedContent = openedFile.read() - except OSError: - exit("Could not open file") -else: - exit("Given file does not exist: " + argumentOne) - -# Create email regex. -emailRegex = re.compile(r'''( - [a-zA-Z0-9._%+-]+ # username - @ # @ symbol - [a-zA-Z0-9.-]+ # domain name - (\.[a-zA-Z]{2,4}) # dot-something - )''', re.VERBOSE) - -matches = [] -for groups in emailRegex.findall(openedContent): - emails = groups[0] - matches.append(emails) - -openedFile.close() - -if len(matches) > 0: - pyperclip.copy(' -+- '.join(matches)) - print("Email address(es) found:") - print('\n'.join(matches)) -else: - print('No email address found.') ->>>>>>> 3c73d451606203216ef00f7bfb7a176bce5a8c43 diff --git a/phoneNumbers/numberInFile.py b/phoneNumbers/numberInFile.py index 682c9a0..0c9a903 100644 --- a/phoneNumbers/numberInFile.py +++ b/phoneNumbers/numberInFile.py @@ -10,7 +10,6 @@ >>> numberInFile.py germany C:\\Users\\ExampleUser\\Documents\\phoneNumbers.txt """ -<<<<<<< HEAD from countries import countryDict import pyperclip import re @@ -26,30 +25,6 @@ def main(): except IndexError: exit("No argument given." " Try again with a country as an argument") -======= -#Create phone regex for country specific number format and add it to countryDict -germany = r'''( - (\d{3}|\(\d{3}\))? # area code (optional) - (\s|-|\.|/)? # separator (optional) - (\d{7,9}) # 7 to 9 digits - )''' -spain = r"(^[98](\d{8}))" - -countryDict["germany"] = germany -countryDict["spain"] = spain -# Check if sys.argv[1] is given and in countryDict -argumentOne = "" -try: - argumentOne = sys.argv[1] -except IndexError: - exit("No argument given. Try again with a country as an argument") - -if(argumentOne in countryDict): - #Create regex object - regexCompile = re.compile(countryDict[argumentOne], re.VERBOSE|re.MULTILINE) -else: - exit("No number format for that country found") ->>>>>>> 3c73d451606203216ef00f7bfb7a176bce5a8c43 if(argumentOne in countryDict): # Create regex object @@ -71,7 +46,6 @@ def main(): openedContent = "" -<<<<<<< HEAD # Check if argumentTwo is a valid path and file if(os.path.exists(argumentTwo) and os.path.isfile(argumentTwo)): # Try to open and read file @@ -90,18 +64,6 @@ def main(): matches.append(phoneNumber) openedFile.close() -======= -# Check if argumentTwo is a valid path and file -if(os.path.exists(argumentTwo) and os.path.isfile(argumentTwo)): - # Try to open and read file - try: - openedFile = open(argumentTwo, "r",encoding='ascii',errors='ignore') - openedContent = openedFile.read() - except OSError: - exit("Could not open file") -else: - exit("Given file does not exist: " + argumentTwo) ->>>>>>> 3c73d451606203216ef00f7bfb7a176bce5a8c43 if len(matches) > 0: pyperclip.copy(' -+- '.join(matches)) @@ -111,14 +73,5 @@ def main(): print('No phone numbers or email addresses found.') -<<<<<<< HEAD if __name__ == "__main__": main() -======= -if len(matches) > 0: - pyperclip.copy(' -+- '.join(matches)) - print("Phone number(s) found:") - print('\n'.join(matches)) -else: - print('No phone numbers or email addresses found.') ->>>>>>> 3c73d451606203216ef00f7bfb7a176bce5a8c43 diff --git a/requirements.txt b/requirements.txt index e94f72b..31df57d 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,5 +1 @@ -<<<<<<< HEAD pyperclip == 1.8.0 -======= -pyperclip==1.8.0 ->>>>>>> 3c73d451606203216ef00f7bfb7a176bce5a8c43