Enable ruff RUF002 rule (#11377)

* Enable ruff RUF002 rule

* Fix

---------

Co-authored-by: Christian Clauss <cclauss@me.com>
This commit is contained in:
Maxim Smolskiy
2024-04-22 22:51:47 +03:00
committed by GitHub
parent 79dc7c97ac
commit 4700297b3e
69 changed files with 132 additions and 131 deletions

View File

@ -8,8 +8,8 @@ def set_bit(number: int, position: int) -> int:
Set the bit at position to 1.
Details: perform bitwise or for given number and X.
Where X is a number with all the bits zeroes and bit on given
position one.
Where X is a number with all the bits - zeroes and bit on given
position - one.
>>> set_bit(0b1101, 1) # 0b1111
15
@ -26,8 +26,8 @@ def clear_bit(number: int, position: int) -> int:
Set the bit at position to 0.
Details: perform bitwise and for given number and X.
Where X is a number with all the bits ones and bit on given
position zero.
Where X is a number with all the bits - ones and bit on given
position - zero.
>>> clear_bit(0b10010, 1) # 0b10000
16
@ -42,8 +42,8 @@ def flip_bit(number: int, position: int) -> int:
Flip the bit at position.
Details: perform bitwise xor for given number and X.
Where X is a number with all the bits zeroes and bit on given
position one.
Where X is a number with all the bits - zeroes and bit on given
position - one.
>>> flip_bit(0b101, 1) # 0b111
7
@ -79,7 +79,7 @@ def get_bit(number: int, position: int) -> int:
Get the bit at the given position
Details: perform bitwise and for the given number and X,
Where X is a number with all the bits zeroes and bit on given position one.
Where X is a number with all the bits - zeroes and bit on given position - one.
If the result is not equal to 0, then the bit on the given position is 1, else 0.
>>> get_bit(0b1010, 0)