Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Code Syntax Refactoring Try #2 #195

Merged
merged 11 commits into from Jul 24, 2018
Merged

Code Syntax Refactoring Try #2 #195

merged 11 commits into from Jul 24, 2018

Conversation

@xNinjaKittyx
Copy link
Contributor

@xNinjaKittyx xNinjaKittyx commented Jul 23, 2018

This is the same as PR#192, except it reverts almost all ==True ==False changes.

All changes should be purely aesthetic except for the following:

  • not key in dict is changed to key not in dict. These are the same, but the latter is standard.
  • x == None is changed to x is None and x != None is changed to x is None. Unless the object x overrides its __eq__ method to handle it, it should behave exactly the same. Let me know if this is an okay change to make.
  • Under mpv.py I changed _fileIsLoaded() to much simpler logic. Both logic is binary, so it should not affect any functionality.
  • Under ConfigurationGetter.py I have changed if str(varToTest).isdigit() == False: to if not str(varToTest).isdigit() since this is a python built-in.

Additional Personal Notes:

  • x == True ideally in the future should be changed. This syntax forces a check to strict True values such as True or 1, but it makes it so all "truthy" values are False. e.g. 2 == True is False,
  • x == False ideally should be changed to not x and not None because this allows all 'Falsey' values to evaluate how they're expected to. e.g. if '' == False will evaluate as False but if not '' evaluates True. We add a and not None to handle the special None case.
def formatSize (bytes, precise=False):
if bytes == 0: # E.g. when file size privacy is enabled

def formatSize(num_of_bytes, precise=False):

This comment has been minimized.

@Et0h

Et0h Jul 24, 2018
Contributor

You rename bytes 'num_of_bytes' at the top of the def but not in the subsequent code. This results in all sizes being incorrectly reported as '???'.

This comment has been minimized.

@xNinjaKittyx

xNinjaKittyx Jul 24, 2018
Author Contributor

Thanks for catching that. I forgot I had made this change. It's to avoid shadowing the bytes keyword.

@Et0h
Et0h approved these changes Jul 24, 2018
@Et0h Et0h merged commit 1dac753 into Syncplay:master Jul 24, 2018
2 checks passed
2 checks passed
continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
albertosottile added a commit to albertosottile/syncplay that referenced this pull request Jul 25, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

2 participants
You can’t perform that action at this time.