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

[Tests][Scripts] Bump Python version to 3.8 and add more linting #2877

Merged
merged 16 commits into from
Aug 22, 2023

Conversation

Fuzzbawls
Copy link
Collaborator

This PR offers a bit of an overhaul to our python test suite and python standards. The high level information is that we:

  • migrate from the EOL'd Python 3.5 to a more recent version (3.8)
  • strip out some ancient workaround code that is no longer necessary
  • add new linters that will provide an early warning if new python code is not up to standards

The bulk of the changes here are via scripted-diff commits, or adapted cherry-picks from upstream.

@Fuzzbawls Fuzzbawls added this to the 6.0.0 milestone Aug 4, 2023
@Fuzzbawls Fuzzbawls self-assigned this Aug 4, 2023
@Fuzzbawls Fuzzbawls force-pushed the 2023_lint-mypy branch 2 times, most recently from fa4eb82 to 090874e Compare August 6, 2023 06:20
Copy link

@panleone panleone left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tACK 090874e,
good work just one thing: Can you also add slots to the Masternode class?

MarcoFalke and others added 16 commits August 16, 2023 23:54
Additionally, removed redundant parentheses and added PEP-8 compliant
spacing around those classes.
this is a test that we don't actually support at the moment.
-BEGIN VERIFY SCRIPT-
sed -i --regexp-extended -e 's/assert ?\((.+)\)(( )*)?(#.*)?$/assert \1\3\3\4/g' $(git grep -l --extended-regexp 'assert ?\(' test)
-END VERIFY SCRIPT-
clean both files to adhere to flake8 standards.
-BEGIN VERIFY SCRIPT-
sed -i -e "s/def bytes_to_hex_str/def b_2_x/g" $(git grep -l bytes_to_hex_str)

export RE_B_0="[^()]*"                          # match no bracket
export RE_B_1="${RE_B_0}\(${RE_B_0}\)${RE_B_0}" # match exactly one ()
export RE_B_2="${RE_B_0}\(${RE_B_1}\)${RE_B_0}" # match wrapped (())

export RE_M="(b2x|bytes_to_hex_str)\(((${RE_B_0}|${RE_B_1}|${RE_B_2})*)\)"

sed -i --regexp-extended -e "s/${RE_M}/\2.hex()/g"      $(git grep -l -E '(b2x|bytes_to_hex_str)')

sed -i --regexp-extended -e "/  +bytes_to_hex_str( as b2x)?,/d"    $(git grep -l bytes_to_hex_str)
sed -i --regexp-extended -e "s/ +bytes_to_hex_str( as b2x)?,//g"   $(git grep -l bytes_to_hex_str)
sed -i --regexp-extended -e "s/, bytes_to_hex_str( as b2x)?//g"    $(git grep -l bytes_to_hex_str)

export RE_M="(binascii\.)?hexlify\(((${RE_B_0}|${RE_B_1}|${RE_B_2})*)\).decode\(${RE_B_0}\)"

sed -i --regexp-extended -e "s/${RE_M}/\2.hex()/g" $(git grep -l hexlify -- ':(exclude)share')

sed -i --regexp-extended -e  "/from binascii import hexlify$/d" $(git grep -l hexlify -- ':(exclude)share')
sed -i --regexp-extended -e "s/(from binascii import) .*hexlify/\1 unhexlify/g" $(git grep -l hexlify -- ':(exclude)share')

sed -i -e 's/ignore-names "/ignore-names "b_2_x,/g' ./test/lint/lint-python-dead-code.sh
-END VERIFY SCRIPT-
@Fuzzbawls
Copy link
Collaborator Author

tACK 090874e, good work just one thing: Can you also add slots to the Masternode class?

Added slots to the MN class and rebased on master

Copy link
Member

@Liquid369 Liquid369 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK c340533

Copy link

@panleone panleone left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

re tACK c340533

@Fuzzbawls Fuzzbawls merged commit 4264308 into PIVX-Project:master Aug 22, 2023
21 checks passed
@Fuzzbawls Fuzzbawls modified the milestones: 6.0.0, 5.6.0 Feb 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

5 participants