Closed vladdoster closed 1 year ago
Mhm.... not quite sure what I am missing here.
@vladdoster it's usually a mismatch in the version of black - you can check the message in the CI to see what version is installed.
These are great changes! I will try to make some time to review them soon.
Oh and don't worry too much about black - when we're finished up review I'd be happy to pull, run the matching version, and update the PR.
Taking a look again! @vladdoster for future reviews could you wait until the end to rebase? it makes it hard to see what you changed (and I'll need to review the entire thing again instead of just changes).
okay I still see a lot of the static methods applied - let me know when this is ready again for review!
refactor unnecessary
else
/elif
whenif
block has acontinue
statementrefactor unnecessary
else
/elif
whenif
block has araise
statementrefactor unnecessary
else
/elif
whenif
block has areturn
statementremove duplicate dictionary key(s)
remove unnecessary return statement
remove unnecessary use of comprehension
use
_
to denote var is unusedchange methods not using its bound instance to staticmethods
The method doesn't use its bound instance. Decorate this method with @staticmethod decorator, so that Python does not have to instantiate a bound method for every instance of this class thereby saving memory and computation.
remove implicit
object
from the base classThe class is inheriting from object, which is implicit under Python 3 , hence can be safely removed from bases.
use literal syntax instead of function calls to create data structure
This is because here, the name dict must be looked up in the global scope in case it has been rebound. The same goes for the other two types list() and tuple().
fix membership test
tests for membership should use the form
x not in the_list
rather thannot x in the_list
. the former example is simply more readable.use set comprehension
although there is nothing syntactically wrong with this code, it is hard to read and can be simplified to a set comprehension. using set comprehension is more performant since there is no need to create another transient list.
update singleton comparison
comparisons to the singleton objects, like true, false, and none, should be done with identity, not equality. use “is” or “is not”. identity checks are faster than equality checks.
Signed-off-by: Vladislav Doster mvdoster@gmail.com