Skip to content

Improved Code and removed Warnings#483

Merged
ParthS007 merged 1 commit into
TheAlgorithms:masterfrom
ParthS007:patch1
Oct 19, 2018
Merged

Improved Code and removed Warnings#483
ParthS007 merged 1 commit into
TheAlgorithms:masterfrom
ParthS007:patch1

Conversation

@ParthS007

Copy link
Copy Markdown
Member

No description provided.

@ParthS007

Copy link
Copy Markdown
Member Author

This pull request fixes 63 alerts when merging 8b4ca1e into 07451a6 - view on LGTM.com

fixed alerts:

  • 63 for 'input' function used

Comment posted by LGTM.com

@ParthS007 ParthS007 merged commit 5d1f726 into TheAlgorithms:master Oct 19, 2018
@ParthS007 ParthS007 deleted the patch1 branch October 19, 2018 08:30
@cclauss

cclauss commented Oct 19, 2018

Copy link
Copy Markdown
Member

This PR should be undone!

raw_input() was removed in Python 3 in favor of input().

Travis CI would have flagged these changes IF IT WAS ACTUALLY ENABLED.

It has broken compatibility with Python in favor of legacy Python which reaches its End of Life in < 440 days...

flake8 testing of https://github.com/TheAlgorithms/Python on Python 3.7.0

$ flake8 . --count --select=E901,E999,F821,F822,F823 --show-source --statistics

./Maths/SieveOfEratosthenes.py:2:9: F821 undefined name 'raw_input'
n = int(raw_input("Enter n: "))
        ^
./Neural_Network/perceptron.py:123:32: F821 undefined name 'raw_input'
        sample.insert(i, float(raw_input('value: ')))
                               ^
./ciphers/brute-force_caesar_cipher.py:47:15: F821 undefined name 'raw_input'
    message = raw_input("Encrypted message: ")
              ^
./ciphers/transposition_cipher_encrypt-decrypt_file.py:8:15: F821 undefined name 'raw_input'
    key = int(raw_input('Enter key: '))
              ^
./ciphers/transposition_cipher_encrypt-decrypt_file.py:9:12: F821 undefined name 'raw_input'
    mode = raw_input('Encrypt/Decrypt [e/d]: ')
           ^
./ciphers/transposition_cipher_encrypt-decrypt_file.py:16:20: F821 undefined name 'raw_input'
        response = raw_input('> ')
                   ^
./ciphers/rsa_cipher.py:9:16: F821 undefined name 'raw_input'
    response = raw_input('Encrypte\Decrypt [e\d]: ')
               ^
./ciphers/vigenere_cipher.py:5:15: F821 undefined name 'raw_input'
    message = raw_input('Enter message: ')
              ^
./ciphers/vigenere_cipher.py:6:11: F821 undefined name 'raw_input'
    key = raw_input('Enter key [alphanumeric]: ')
          ^
./ciphers/vigenere_cipher.py:7:12: F821 undefined name 'raw_input'
    mode = raw_input('Encrypt/Decrypt [e/d]: ')
           ^
./ciphers/simple_substitution_cipher.py:7:15: F821 undefined name 'raw_input'
    message = raw_input('Enter message: ')
              ^
./ciphers/simple_substitution_cipher.py:9:12: F821 undefined name 'raw_input'
    resp = raw_input('Encrypt/Decrypt [e/d]: ')
           ^
./ciphers/caesar_cipher.py:43:18: F821 undefined name 'raw_input'
        choice = raw_input("What would you like to do?: ")
                 ^
./ciphers/caesar_cipher.py:47:21: F821 undefined name 'raw_input'
            strng = raw_input("Please enter the string to be ecrypted: ")
                    ^
./ciphers/caesar_cipher.py:54:21: F821 undefined name 'raw_input'
            strng = raw_input("Please enter the string to be decrypted: ")
                    ^
./ciphers/caesar_cipher.py:56:23: F821 undefined name 'raw_int'
                key = raw_int(input("Please enter off-set between 1-94: "))
                      ^
./ciphers/caesar_cipher.py:61:21: F821 undefined name 'raw_input'
            strng = raw_input("Please enter the string to be decrypted: ")
                    ^
./ciphers/transposition_cipher.py:5:15: F821 undefined name 'raw_input'
    message = raw_input('Enter message: ')
              ^
./ciphers/transposition_cipher.py:6:15: F821 undefined name 'raw_input'
    key = int(raw_input('Enter key [2-%s]: ' % (len(message) - 1)))
              ^
./ciphers/transposition_cipher.py:7:12: F821 undefined name 'raw_input'
    mode = raw_input('Encryption/Decryption [e/d]: ')
           ^
./ciphers/affine_cipher.py:7:15: F821 undefined name 'raw_input'
    message = raw_input('Enter message: ')
              ^
./ciphers/affine_cipher.py:8:15: F821 undefined name 'raw_input'
    key = int(raw_input('Enter key [2000 - 9000]: '))
              ^
./ciphers/affine_cipher.py:9:12: F821 undefined name 'raw_input'
    mode = raw_input('Encrypt/Decrypt [E/D]: ')
           ^
./Graphs/scc_kosaraju.py:3:21: F821 undefined name 'raw_input'
n, m = list(map(int,raw_input().split()))
                    ^
./Graphs/scc_kosaraju.py:9:25: F821 undefined name 'raw_input'
    u, v = list(map(int,raw_input().split()))
                        ^
./Graphs/MinimumSpanningTree_Prims.py:104:9: F821 undefined name 'raw_input'
n = int(raw_input("Enter number of vertices: "))
        ^
./Graphs/MinimumSpanningTree_Prims.py:105:9: F821 undefined name 'raw_input'
e = int(raw_input("Enter number of edges: "))
        ^
./Graphs/minimum_spanning_tree_kruskal.py:2:37: F821 undefined name 'raw_input'
num_nodes, num_edges = list(map(int,raw_input().split()))
                                    ^
./Graphs/minimum_spanning_tree_kruskal.py:7:36: F821 undefined name 'raw_input'
	node1, node2, cost = list(map(int,raw_input().split()))
                                   ^
./boolean_algebra/Quine_McCluskey/QuineMcCluskey.py:102:23: F821 undefined name 'raw_input'
	no_of_variable = int(raw_input("Enter the no. of variables\n"))
                      ^
./boolean_algebra/Quine_McCluskey/QuineMcCluskey.py:103:30: F821 undefined name 'raw_input'
	minterms = [int(x) for x in raw_input("Enter the decimal representation of Minterms 'Spaces Seprated'\n").split()]
                             ^
./data_structures/Graph/FloydWarshall.py:33:9: F821 undefined name 'raw_input'
V = int(raw_input("Enter number of vertices: "))
        ^
./data_structures/Graph/FloydWarshall.py:34:9: F821 undefined name 'raw_input'
E = int(raw_input("Enter number of edges: "))
        ^
./data_structures/Graph/FloydWarshall.py:43:12: F821 undefined name 'raw_input'
	src = int(raw_input("Enter source:"))
           ^
./data_structures/Graph/FloydWarshall.py:44:12: F821 undefined name 'raw_input'
	dst = int(raw_input("Enter destination:"))
           ^
./data_structures/Graph/FloydWarshall.py:45:17: F821 undefined name 'raw_input'
	weight = float(raw_input("Enter weight:"))
                ^
./data_structures/Graph/Dijkstra.py:41:9: F821 undefined name 'raw_input'
V = int(raw_input("Enter number of vertices: "))
        ^
./data_structures/Graph/Dijkstra.py:42:9: F821 undefined name 'raw_input'
E = int(raw_input("Enter number of edges: "))
        ^
./data_structures/Graph/Dijkstra.py:51:12: F821 undefined name 'raw_input'
	src = int(raw_input("Enter source:"))
           ^
./data_structures/Graph/Dijkstra.py:52:12: F821 undefined name 'raw_input'
	dst = int(raw_input("Enter destination:"))
           ^
./data_structures/Graph/Dijkstra.py:53:17: F821 undefined name 'raw_input'
	weight = float(raw_input("Enter weight:"))
                ^
./data_structures/Graph/Dijkstra.py:56:12: F821 undefined name 'raw_input'
gsrc = int(raw_input("\nEnter shortest path source:"))
           ^
./data_structures/Graph/BellmanFord.py:38:9: F821 undefined name 'raw_input'
V = int(raw_input("Enter number of vertices: "))
        ^
./data_structures/Graph/BellmanFord.py:39:9: F821 undefined name 'raw_input'
E = int(raw_input("Enter number of edges: "))
        ^
./data_structures/Graph/BellmanFord.py:48:12: F821 undefined name 'raw_input'
	src = int(raw_input("Enter source:"))
           ^
./data_structures/Graph/BellmanFord.py:49:12: F821 undefined name 'raw_input'
	dst = int(raw_input("Enter destination:"))
           ^
./data_structures/Graph/BellmanFord.py:50:17: F821 undefined name 'raw_input'
	weight = float(raw_input("Enter weight:"))
                ^
./data_structures/Graph/BellmanFord.py:53:12: F821 undefined name 'raw_input'
gsrc = int(raw_input("\nEnter shortest path source:"))
           ^
./Project Euler/Problem 07/sol2.py:7:9: F821 undefined name 'raw_input'
n = int(raw_input('Enter The N\'th Prime Number You Want To Get: ')) # Ask For The N'th Prime Number Wanted
        ^
./Project Euler/Problem 07/sol1.py:19:9: F821 undefined name 'raw_input'
n = int(raw_input())
        ^
./Project Euler/Problem 04/sol2.py:15:7: F821 undefined name 'raw_input'
n=int(raw_input())
      ^
./Project Euler/Problem 04/sol1.py:7:13: F821 undefined name 'raw_input'
limit = int(raw_input("limit? "))
            ^
./Project Euler/Problem 06/sol2.py:12:9: F821 undefined name 'raw_input'
n = int(raw_input())
        ^
./Project Euler/Problem 06/sol1.py:15:9: F821 undefined name 'raw_input'
n = int(raw_input())
        ^
./Project Euler/Problem 16/sol1.py:1:13: F821 undefined name 'raw_input'
power = int(raw_input("Enter the power of 2: "))
            ^
./Project Euler/Problem 20/sol1.py:18:14: F821 undefined name 'raw_input'
number = int(raw_input("Enter the Number: "))
             ^
./Project Euler/Problem 02/sol3.py:10:9: F821 undefined name 'raw_input'
n = int(raw_input())
        ^
./Project Euler/Problem 03/sol2.py:7:7: F821 undefined name 'raw_input'
n=int(raw_input())
      ^
./Project Euler/Problem 03/sol1.py:22:7: F821 undefined name 'raw_input'
n=int(raw_input())
      ^
./Project Euler/Problem 09/sol2.py:9:9: F821 undefined name 'raw_input'
N = int(raw_input())
        ^
./Project Euler/Problem 08/sol1.py:4:12: F821 undefined name 'raw_input'
    number=raw_input().strip()
           ^
./Project Euler/Problem 05/sol2.py:16:9: F821 undefined name 'raw_input'
n = int(raw_input())
        ^
./Project Euler/Problem 05/sol1.py:8:9: F821 undefined name 'raw_input'
n = int(raw_input())
        ^
./Project Euler/Problem 13/sol1.py:7:9: F821 undefined name 'raw_input'
n = int(raw_input().strip())
        ^
./Project Euler/Problem 13/sol1.py:11:22: F821 undefined name 'raw_input'
    array.append(int(raw_input().strip()))
                     ^
./other/nested_brackets.py:40:9: F821 undefined name 'raw_input'
    S = raw_input("Enter sequence of brackets: ")
        ^
./other/tower_of_hanoi.py:22:18: F821 undefined name 'raw_input'
    height = int(raw_input('Height of hanoi: '))
                 ^
./machine_learning/perceptron.py:123:32: F821 undefined name 'raw_input'
        sample.insert(i, float(raw_input('value: ')))
                               ^
./machine_learning/logistic_regression.py:19:1: F821 undefined name 'get_ipython'
get_ipython().run_line_magic('matplotlib', 'inline')
^
69    F821 undefined name 'raw_input'
69

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants