Skip to content

Sourcery refactored main branch - #1

Open
sourcery-ai[bot] wants to merge 1 commit into
mainfrom
sourcery/main
Open

Sourcery refactored main branch#1
sourcery-ai[bot] wants to merge 1 commit into
mainfrom
sourcery/main

Conversation

@sourcery-ai

@sourcery-ai sourcery-ai Bot commented Feb 15, 2023

Copy link
Copy Markdown

Branch main refactored by Sourcery.

If you're happy with these changes, merge this Pull Request using the Squash and merge strategy.

See our documentation here.

Run Sourcery locally

Reduce the feedback loop during development by using the Sourcery editor plugin:

Review changes via command line

To manually merge these changes, make sure you're on the main branch, then run:

git fetch origin sourcery/main
git merge --ff-only FETCH_HEAD
git reset HEAD^

Help us improve this pull request!

@sourcery-ai
sourcery-ai Bot requested a review from readcoil February 15, 2023 03:17
Comment thread config_lora.py
Comment on lines -8 to +9
mac = mac[0:6] + 'fffe' + mac[6:]
return hex(int(mac[0:2], 16) ^ 2)[2:] + mac[2:]
mac = f'{mac[:6]}fffe{mac[6:]}'
return hex(int(mac[:2], 16) ^ 2)[2:] + mac[2:]

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Function mac2eui refactored with the following changes:

Comment thread config_lora.py
def get_millis():
millisecond = time.ticks_ms()
return millisecond
return time.ticks_ms()

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Function get_millis refactored with the following changes:

Comment thread config_lora.py
Comment on lines -17 to +16
node_name = "ESP_" + uuid
return node_name
return f"ESP_{uuid}"

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Function get_nodename refactored with the following changes:

Comment thread main.py
Comment on lines -22 to +26
if example == 'sender':
LoRaSender.send(lora)
if example == 'receiver':
LoRaReceiver.receive(lora) No newline at end of file
LoRaReceiver.receive(lora)
elif example == 'sender':
LoRaSender.send(lora) No newline at end of file

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Lines 23-26 refactored with the following changes:

  • Simplify conditional into switch-like form (switch)

Comment thread oled.py
oled.fill(0)
for row, text in enumerate(screen):
print("{} - {}".format(row, text))
print(f"{row} - {text}")

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Function write_screen refactored with the following changes:

Comment thread sx127x.py
Comment on lines -271 to +277
bins = (7.8E3, 10.4E3, 15.6E3, 20.8E3, 31.25E3, 41.7E3, 62.5E3, 125E3, 250E3)

bw = 9

if sbw < 10:
bw = sbw
else:
bins = (7.8E3, 10.4E3, 15.6E3, 20.8E3, 31.25E3, 41.7E3, 62.5E3, 125E3, 250E3)

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Function SX127x.set_signal_bandwidth refactored with the following changes:

Comment thread sx127x.py

payload = bytearray()
for i in range(packet_length):
for _ in range(packet_length):

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Function SX127x.read_payload refactored with the following changes:

Comment thread sx127x.py

def blink_led(self, times = 1, on_seconds = 0.1, off_seconds = 0.1):
for i in range(times):
for _ in range(times):

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Function SX127x.blink_led refactored with the following changes:

Comment thread sx127x.py
gc.collect()
if __DEBUG__:
print('[Memory - free: {} allocated: {}]'.format(gc.mem_free(), gc.mem_alloc()))
print(f'[Memory - free: {gc.mem_free()} allocated: {gc.mem_alloc()}]')

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Function SX127x.collect_garbage refactored with the following changes:

Comment thread examples/LoRaReceiver.py
payload = lora.read_payload()
print(payload)
screen[0] = "pkt: {}".format(payload)
screen[0] = f"pkt: {payload}"

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Function receive refactored with the following changes:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants