ruff: linting stuff (some was from my conflict resolution I messed up)
parent
71d39f25ef
commit
ce1d2a0814
|
@ -1,9 +1,9 @@
|
||||||
|
import os
|
||||||
from nxc.config import process_secret
|
from nxc.config import process_secret
|
||||||
from nxc.connection import connection
|
from nxc.connection import connection
|
||||||
from nxc.helpers.logger import highlight
|
from nxc.helpers.logger import highlight
|
||||||
from nxc.logger import NXCAdapter
|
from nxc.logger import NXCAdapter
|
||||||
from ftplib import FTP
|
from ftplib import FTP, error_perm
|
||||||
|
|
||||||
|
|
||||||
class ftp(connection):
|
class ftp(connection):
|
||||||
def __init__(self, args, db, host):
|
def __init__(self, args, db, host):
|
||||||
|
@ -135,7 +135,7 @@ class ftp(connection):
|
||||||
# Check if the file exists
|
# Check if the file exists
|
||||||
self.conn.size(filename)
|
self.conn.size(filename)
|
||||||
# Attempt to download the file
|
# Attempt to download the file
|
||||||
self.conn.retrbinary(f"RETR {filename}", open(downloaded_file, "wb").write)
|
self.conn.retrbinary(f"RETR {filename}", open(downloaded_file, "wb").write) #noqa: SIM115
|
||||||
except error_perm as error_message:
|
except error_perm as error_message:
|
||||||
self.logger.fail(f"Failed to download the file. Response: ({error_message})")
|
self.logger.fail(f"Failed to download the file. Response: ({error_message})")
|
||||||
self.conn.close()
|
self.conn.close()
|
||||||
|
@ -155,7 +155,7 @@ class ftp(connection):
|
||||||
def put_file(self, local_file, remote_file):
|
def put_file(self, local_file, remote_file):
|
||||||
try:
|
try:
|
||||||
# Attempt to upload the file
|
# Attempt to upload the file
|
||||||
self.conn.storbinary(f"STOR {remote_file}", open(local_file, "rb"))
|
self.conn.storbinary(f"STOR {remote_file}", open(local_file, "rb")) #noqa: SIM115
|
||||||
except error_perm as error_message:
|
except error_perm as error_message:
|
||||||
self.logger.fail(f"Failed to upload file. Response: ({error_message})")
|
self.logger.fail(f"Failed to upload file. Response: ({error_message})")
|
||||||
return False
|
return False
|
||||||
|
|
|
@ -1,6 +1,3 @@
|
||||||
import logging
|
|
||||||
|
|
||||||
from io import StringIO
|
|
||||||
import paramiko
|
import paramiko
|
||||||
import re
|
import re
|
||||||
import uuid
|
import uuid
|
||||||
|
|
Loading…
Reference in New Issue