-
Notifications
You must be signed in to change notification settings - Fork 1
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
Output class does work now (Sourcery refactored) #11
Open
sourcery-ai
wants to merge
5
commits into
master
Choose a base branch
from
sourcery/pull-10
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,7 @@ | ||
# ignore the demos directory | ||
demo/ | ||
/venv | ||
.idea | ||
|
||
# ignore the whitesource tool | ||
.whitesource |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,8 +15,8 @@ | |
|
||
def init_lcd(): | ||
''' | ||
Params: lcd_columns - number of culumns the LCD Screen has (int) | ||
lcd_rows - number of rwos the LCD Screen has (int) | ||
Params: lcd_columns - number of columns the LCD Screen has (int) | ||
lcd_rows - number of rows the LCD Screen has (int) | ||
i2c - calling i2c program | ||
lcd - setting lcd screen | ||
|
||
|
@@ -26,9 +26,7 @@ def init_lcd(): | |
lcd_columns = 16 | ||
lcd_rows = 2 | ||
i2c = busio.I2C(board.SCL, board.SDA) | ||
lcd = character_lcd.Character_LCD_RGB_I2C(i2c, lcd_columns, lcd_rows) | ||
|
||
return lcd | ||
return character_lcd.Character_LCD_RGB_I2C(i2c, lcd_columns, lcd_rows) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This actually has to return |
||
|
||
|
||
def get_configparser(): | ||
|
@@ -77,7 +75,7 @@ def check_usb(): | |
connected_usb = usb.core.find(find_all=True) | ||
|
||
#Check if no devices are connected | ||
if connected_usb == None: | ||
if connected_usb is None: | ||
lcd.clear() | ||
lcd.message = "No devices found" | ||
raise ValueError('No Devices Found.') | ||
|
@@ -91,15 +89,15 @@ def check_usb(): | |
usb_device_vendorID = hex(device.idVendor) | ||
usb_device_productID = hex(device.idProduct) | ||
device_list[usb_device] = usb_device_vendorID, usb_device_productID | ||
|
||
lcd.clear() | ||
lcd.message = "Devices found" | ||
time.sleep(0.5) | ||
|
||
return device_list | ||
|
||
def verify_usb(usb_device_list, backup_device, input_device): | ||
''' | ||
""" | ||
Params: usb_device_list - list of usb devices and their attributes (list) | ||
backup_device - backup device (str) | ||
input_device - input device (str) | ||
|
@@ -109,7 +107,7 @@ def verify_usb(usb_device_list, backup_device, input_device): | |
input_usb_device_product - product id for input device (str) | ||
|
||
Returns: backup_usb_device_vendor, input_usb_device_vendor, backup_usb_device_product, input_usb_device_product | ||
''' | ||
""" | ||
|
||
backup_device = backup_device.lower() | ||
input_device = input_device.lower() | ||
|
@@ -147,14 +145,12 @@ def mount_usb(dbl, dil, mbl, mil, backup_name, input_name): | |
|
||
check_path_backup = (mbl + 'backup') | ||
check_path_input = (mil + 'source') | ||
|
||
lcd.clear() | ||
lcd.message = "Mounting Devices" | ||
time.sleep(0.5) | ||
|
||
if os.path.exists(check_path_backup): | ||
pass | ||
else: | ||
if not os.path.exists(check_path_backup): | ||
#make dir for mount point | ||
makedir_backup = ('mkdir ' + mbl + 'backup') | ||
os.system(makedir_backup) | ||
|
@@ -168,9 +164,7 @@ def mount_usb(dbl, dil, mbl, mil, backup_name, input_name): | |
lcd.message = "Backup Mounted" | ||
time.sleep(0.5) | ||
|
||
if os.path.exists(check_path_input): | ||
pass | ||
else: | ||
if not os.path.exists(check_path_input): | ||
#make dir for mount point | ||
makedir_input = ('mkdir ' + mil + 'source') | ||
os.system(makedir_input) | ||
|
@@ -179,7 +173,7 @@ def mount_usb(dbl, dil, mbl, mil, backup_name, input_name): | |
#make mount point for input usb | ||
input_command = ('sudo mount -t auto ' + dil + ' ' + mil + 'source') | ||
os.system(input_command) | ||
|
||
lcd.clear() | ||
lcd.message = "Source Mounted" | ||
time.sleep(0.5) | ||
|
@@ -276,49 +270,53 @@ def restart(): | |
while True: | ||
lcd.clear() | ||
lcd.message = "Insert USB's\nPress Select" | ||
|
||
device_add = True | ||
while device_add == True: | ||
while device_add: | ||
#shutdown RPI | ||
if lcd.down_button: | ||
lcd.clear() | ||
shutdown() | ||
|
||
#reboot RPI | ||
if lcd.up_button: | ||
lcd.clear() | ||
restart() | ||
|
||
#perform USB check | ||
if lcd.select_button: | ||
#get connected usb devices | ||
usb_device = check_usb() | ||
|
||
#validate if backup and input devices are connected | ||
backup_usb_device_vendor, input_usb_device_vendor, backup_usb_device_product, input_usb_device_product = verify_usb(usb_device, backup_device, input_device) | ||
|
||
#mount USB | ||
mount_usb(dev_backup_loc, dev_input_loc, mnt_backup_loc, mnt_input_loc, backup_device, input_device) | ||
|
||
lcd.clear() | ||
lcd.message = "Press RB to\nbegin backup" | ||
|
||
if lcd.right_button: | ||
#check if /mnt/backup and /mnt/source exist | ||
verify_backup_loc = mnt_backup_loc + 'backup' | ||
verify_source_loc = mnt_input_loc + 'source' | ||
|
||
if os.path.exists(verify_backup_loc) and os.path.exists(verify_source_loc): | ||
#rsync backup -> right_button | ||
run_autobackup(dev_backup_loc, dev_input_loc, mnt_backup_loc, mnt_input_loc, backup_device, input_device) | ||
|
||
#unmount devices | ||
unmount_drives() | ||
|
||
device_add = False | ||
else: | ||
lcd.clear() | ||
lcd.message = "Press Select to\nMount USBs" | ||
time.sleep(0.5) | ||
|
||
|
||
lcd.message = "Press LB to\ncancel" | ||
|
||
while device_add: | ||
if lcd.right_button: | ||
#check if /mnt/backup and /mnt/source exist | ||
verify_backup_loc = mnt_backup_loc + 'backup' | ||
verify_source_loc = mnt_input_loc + 'source' | ||
|
||
if os.path.exists(verify_backup_loc) and os.path.exists(verify_source_loc): | ||
#rsync backup -> right_button | ||
run_autobackup(dev_backup_loc, dev_input_loc, mnt_backup_loc, mnt_input_loc, backup_device, input_device) | ||
|
||
#unmount devices | ||
unmount_drives() | ||
|
||
device_add = False | ||
else: | ||
lcd.clear() | ||
lcd.message = "Press Select to\nMount USBs" | ||
time.sleep(0.5) | ||
|
||
if lcd.left_button: | ||
break | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We are going to remove this functionality. We don't have to make any changes, in fact we should probably just remove these no_lcd. files.