5ce4f416a94dc27834d4866ca924d86e002d506c,check_file.py,,main,#,21

Before Change


      exit(0)
  else:
    print ("[-] Usage: " + str(sys.argv[0]) + " <filename>") // Print usage if not all parameters passed/Checked
    exit(0)
  print ("[+] Reading from : " + filename)	// Display Message and read the file contents
  readfile(filename)
  

After Change



def main():
  if len(sys.argv) >= 2:		// Check the arguments passed to the script
      filenames = sys.argv[1:]
      for filename in filenames: 				// Iterate for each filename passed in command line argument
          if not os.path.isfile(filename):			// Check the File exists
              print ("[-] " + filename + " does not exist.")    
              filenames.remove(filename)			//remove non existing files from filenames list
              continue
              
          if not os.access(filename, os.R_OK):	// Check you can read the file
              print ("[-] " + filename + " access denied")
              filenames.remove(filename)			// remove non readable filenames
              continue
  else:
    usage() // Print usage if not all parameters passed/Checked
    
    // Read the content of each file
  for file in filenames:
      print ("[+] Reading from : " + file)	// Display Message and read the file contents
      readfile(file)
  
if __name__ == "__main__":
    main()
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 4

Non-data size: 4

Instances


Project Name: geekcomputers/Python
Commit Name: 5ce4f416a94dc27834d4866ca924d86e002d506c
Time: 2016-08-26
Author: 14bcs010@smvdu.ac.in
File Name: check_file.py
Class Name:
Method Name: main


Project Name: mittagessen/kraken
Commit Name: d1e6f8655410239f50cdda35f31377839cf630fb
Time: 2017-07-11
Author: andreas.buettner@uni-wuerzburg.de
File Name: kraken/ketos.py
Class Name:
Method Name: train


Project Name: keras-team/keras
Commit Name: da24be79ab5d06e7be16d9eb0a35f47b7b91939b
Time: 2015-08-31
Author: amit.beka@gmail.com
File Name: tests/manual/check_callbacks.py
Class Name:
Method Name:


Project Name: AlexsLemonade/refinebio
Commit Name: 6f7a938b19f6089707fe03754eb7c823c036b728
Time: 2019-01-18
Author: miserlou@gmail.com
File Name: workers/data_refinery_workers/processors/management/commands/create_qn_target.py
Class Name: Command
Method Name: handle