From ef6404df0f5e924ca1d44e6812cb16e176aa3226 Mon Sep 17 00:00:00 2001 From: deepsourcebot Date: Thu, 15 Jun 2023 10:42:29 +0000 Subject: [PATCH 1/3] format code with Black and ISort This commit fixes the style issues introduced in 15909c6 according to the output from Black and ISort. Details: --- assignment.py | 6 +++--- demo_code.py | 14 +++++++------- foo.py | 44 ++++++++++++++++++++++++++------------------ miscellaneous.py | 2 +- security.py | 1 + tests/test_code.py | 1 + 6 files changed, 39 insertions(+), 29 deletions(-) diff --git a/assignment.py b/assignment.py index b9fdc93b2..e1229041e 100644 --- a/assignment.py +++ b/assignment.py @@ -1,3 +1,3 @@ -(*FIRST, ) = [1, 2, 3] -(*FIRST, ) = [1, 2, 3] -*FIRST, a, b = [1, 2, 3] +(*FIRST,) = [1, 2, 3] +(*FIRST,) = [1, 2, 3] +*FIRST, a, b = [1, 2, 3] diff --git a/demo_code.py b/demo_code.py index aba08a363..6a5c5e9e0 100644 --- a/demo_code.py +++ b/demo_code.py @@ -1,10 +1,10 @@ -import random -import sys as sys +import collections import os -import subprocess -import ssl import pprint -import collections +import random +import ssl +import subprocess +import sys as sys import this @@ -17,10 +17,10 @@ class BaseNumberGenerator: """Declare a method -- `get_number`.""" def __init__(self): - self.limits = (1, 10) + self.limits = (1, 10) def get_number(self, min_max): - raise NotImplementedError + raise NotImplementedError def smethod(): """static method-to-be""" diff --git a/foo.py b/foo.py index 40df53dbf..12c42d83a 100644 --- a/foo.py +++ b/foo.py @@ -1,6 +1,7 @@ -import os import logging -nums = [ i for i in range(10)] +import os + +nums = [i for i in range(10)] a = 1 b = 2 @@ -9,35 +10,42 @@ breakpoint() print(b, nums) + def baz(a=[]): - return 0 + return 0 + def aaa(a=[]): - return 1 + return 1 def foo(b=[]): - return 1 + return 1 + def bar(a): - return 1 + return 1 + import os + filename = os.tmpnam() -with open(filename, 'w') as f: - pass +with open(filename, "w") as f: + pass + def boom(a=[]): - breakpoint() - filename = os.tmpnam() - breakpoint() - return filename + breakpoint() + filename = os.tmpnam() + breakpoint() + return filename + def another_test_method(): - f = open("/tmp/.deepsource.toml", "r") - f.write("config file.") - f.close() - print('abc') - -filename = os.tmpnam() + f = open("/tmp/.deepsource.toml", "r") + f.write("config file.") + f.close() + print("abc") + +filename = os.tmpnam() diff --git a/miscellaneous.py b/miscellaneous.py index 1e8f1564b..7c82c2a27 100644 --- a/miscellaneous.py +++ b/miscellaneous.py @@ -1,4 +1,4 @@ -from utils import get_next, render_to_frontend, render_bg +from utils import get_next, render_bg, render_to_frontend class Orange: diff --git a/security.py b/security.py index b8b179b51..0030bdf9e 100644 --- a/security.py +++ b/security.py @@ -1,4 +1,5 @@ import sqlite3 + import requests diff --git a/tests/test_code.py b/tests/test_code.py index ee6cfbf13..c78b30768 100644 --- a/tests/test_code.py +++ b/tests/test_code.py @@ -1,4 +1,5 @@ import unittest + from demo_code import RandomNumberGenerator From 7f74ac52531148d192c44028fae978f61ab2e14d Mon Sep 17 00:00:00 2001 From: deepsourcebot Date: Thu, 15 Jun 2023 10:44:42 +0000 Subject: [PATCH 2/3] refactor: autofix issues in 2 files Resolved issues in the following files with DeepSource Autofix: 1. demo_code.py 2. foo.py --- demo_code.py | 2 +- foo.py | 7 +------ 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/demo_code.py b/demo_code.py index 6a5c5e9e0..c6bb027a2 100644 --- a/demo_code.py +++ b/demo_code.py @@ -4,7 +4,7 @@ import random import ssl import subprocess -import sys as sys +import sys import this diff --git a/foo.py b/foo.py index 12c42d83a..ca9448c48 100644 --- a/foo.py +++ b/foo.py @@ -1,7 +1,7 @@ import logging import os -nums = [i for i in range(10)] +nums = list(range(10)) a = 1 b = 2 @@ -26,18 +26,13 @@ def foo(b=[]): def bar(a): return 1 - -import os - filename = os.tmpnam() with open(filename, "w") as f: pass def boom(a=[]): - breakpoint() filename = os.tmpnam() - breakpoint() return filename From bd04eacf965036691e5c282aad1ae69772d8f217 Mon Sep 17 00:00:00 2001 From: deepsourcebot Date: Thu, 15 Jun 2023 10:44:51 +0000 Subject: [PATCH 3/3] format code with Black and ISort This commit fixes the style issues introduced in 7f74ac5 according to the output from Black and ISort. Details: --- foo.py | 1 + 1 file changed, 1 insertion(+) diff --git a/foo.py b/foo.py index ca9448c48..1a31c044e 100644 --- a/foo.py +++ b/foo.py @@ -26,6 +26,7 @@ def foo(b=[]): def bar(a): return 1 + filename = os.tmpnam() with open(filename, "w") as f: pass