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.connection import connection
|
||||
from nxc.helpers.logger import highlight
|
||||
from nxc.logger import NXCAdapter
|
||||
from ftplib import FTP
|
||||
|
||||
from ftplib import FTP, error_perm
|
||||
|
||||
class ftp(connection):
|
||||
def __init__(self, args, db, host):
|
||||
|
@ -126,7 +126,7 @@ class ftp(connection):
|
|||
|
||||
def get_file(self, filename):
|
||||
# Extract the filename from the path
|
||||
downloaded_file = filename.split("/")[-1]
|
||||
downloaded_file = filename.split("/")[-1]
|
||||
try:
|
||||
# Check if the current connection is ASCII (ASCII does not support .size())
|
||||
if self.conn.encoding == "utf-8":
|
||||
|
@ -135,7 +135,7 @@ class ftp(connection):
|
|||
# Check if the file exists
|
||||
self.conn.size(filename)
|
||||
# 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:
|
||||
self.logger.fail(f"Failed to download the file. Response: ({error_message})")
|
||||
self.conn.close()
|
||||
|
@ -155,7 +155,7 @@ class ftp(connection):
|
|||
def put_file(self, local_file, remote_file):
|
||||
try:
|
||||
# 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:
|
||||
self.logger.fail(f"Failed to upload file. Response: ({error_message})")
|
||||
return False
|
||||
|
|
|
@ -1,6 +1,3 @@
|
|||
import logging
|
||||
|
||||
from io import StringIO
|
||||
import paramiko
|
||||
import re
|
||||
import uuid
|
||||
|
|
Loading…
Reference in New Issue