Bläddra i källkod

[pylint] enable pylint and remove tools/ace-editor changes done in pytest PR (#3698)

Co-authored-by: agl29 <ayush.goyal@ayushlocal>
Ayush Goyal 1 år sedan
förälder
incheckning
658faba0ed

+ 1 - 1
.circleci/config.yml

@@ -55,7 +55,7 @@ commands:
           name: run python lints
           command: |
             ./build/env/bin/pip install pylint==2.5.3 pylint-django==2.3.0 configparser==5.3.0
-            # ./tools/ci/check_for_python_lint.sh
+            ./tools/ci/check_for_python_lint.sh
 
       - run:
           name: run tests

+ 1 - 1
.github/workflows/commitflow-py3.yml

@@ -61,7 +61,7 @@ jobs:
     - name: run python lints
       run: |
         ./build/env/bin/pip install pylint==2.5.3 pylint-django==2.3.0 configparser==5.3.0
-        # ./tools/ci/check_for_python_lint.sh
+        ./tools/ci/check_for_python_lint.sh
 
     - name: run documentation lints
       run: |

+ 7 - 7
desktop/libs/azure/src/azure/abfs/__init__.py

@@ -69,15 +69,15 @@ def is_root(uri):
 
 def strip_scheme(path):
   """
-  returns the path without abfss:// or abfs://
+  Returns the path without abfss:// or abfs://
   """
   try:
     filesystem, file_path = parse_uri(path)[:2]
+    if filesystem == '':
+      raise ValueError('File System must be Specified')
+    path = filesystem + '/' + file_path
   except:
     return path
-  #@Todo@ to check the use of assert here
-  assert filesystem != '', 'File System must be Specified'
-  path = filesystem + '/' + file_path
   return path
 
 def strip_path(path):
@@ -193,7 +193,7 @@ def get_home_dir_for_abfs(user=None):
 def abfsdatetime_to_timestamp(datetime):
   """
   Returns timestamp (seconds) by datetime string from ABFS API responses.
-  ABFS REST API returns one types of datetime strings:
+  ABFS REST API returns one type of datetime strings:
   * `Thu, 26 Feb 2015 20:42:07 GMT` for Object HEAD requests
     (see http://docs.aws.amazon.com/AmazonS3/latest/API/RESTObjectHEAD.html);
   """
@@ -201,6 +201,6 @@ def abfsdatetime_to_timestamp(datetime):
   # `'z' is a bad directive in format ...` error (see https://bugs.python.org/issue6641),
   #LOG.debug("%s" %datetime)
   stripped = time.strptime(datetime[:-4], '%a, %d %b %Y %H:%M:%S')
-  #@Todo@ to check the use of assert here
-  assert datetime[-4:] == ' GMT', 'Time [%s] is not in GMT.' % datetime
+  if datetime[-4:] != ' GMT':
+    raise ValueError('Time [%s] is not in GMT.' % datetime)
   return int(calendar.timegm(stripped))

+ 4 - 4
tools/ace-editor/demo/kitchen-sink/docs/python.py

@@ -4,8 +4,8 @@ import string, sys
 
 # If no arguments were given, print a helpful message
 if len(sys.argv)==1:
-    print ('''Usage:
-celsius temp1 temp2 ...''')
+    print '''Usage:
+celsius temp1 temp2 ...'''
     sys.exit(0)
 
 # Loop over the arguments
@@ -13,7 +13,7 @@ for i in sys.argv[1:]:
     try:
         fahrenheit=float(string.atoi(i))
     except string.atoi_error:
-        print (repr(i), "not a numeric value")
+        print repr(i), "not a numeric value"
     else:
         celsius=(fahrenheit-32)*5.0/9.0
-        print ('%i\260F = %i\260C') % (int(fahrenheit), int(celsius+.5))
+        print '%i\260F = %i\260C' % (int(fahrenheit), int(celsius+.5))

+ 5 - 5
tools/ace-editor/static.py

@@ -122,7 +122,7 @@ class Cling(object):
                         with open(full_path, "wb") as f: f.write(data)
                         return self.success_no_content(environ, start_response)
                     except:
-                        print (sys.exc_info()[1])
+                        print sys.exc_info()[1]
                         return self.server_error(environ, start_response)
         if environ['REQUEST_METHOD'] not in ('GET', 'HEAD'):
             headers = [('Allow', 'GET, HEAD')]
@@ -148,7 +148,7 @@ class Cling(object):
             else:
                 return ['']
         except (IOError, OSError), e:
-            print (e)
+            print e
             return self.not_found(environ, start_response)
 
     def _full_path(self, path_info):
@@ -280,15 +280,15 @@ def command():
         app = validator(app)
 
     try:
-        print ("Serving %s to http://%s:%d") % (options.rootdir, host, port)
+        print "Serving %s to http://%s:%d" % (options.rootdir, host, port)
         if puttable:
             print("The following paths (relative to server root) may be "+
                   "OVERWRITTEN via HTTP PUT.")
             for p in puttable:
-                print (p)
+                print p
         make_server(host, port, app).serve_forever()
     except KeyboardInterrupt, ki:
-        print ("Ciao, baby!")
+        print "Ciao, baby!"
     except:
         sys.exit("Problem initializing server: %s" % sys.exc_info()[1])