forked from rc/aircox
		
	Feat: packaging (#127)
- Add configuration files for packaging - Precommit now uses ruff Co-authored-by: bkfox <thomas bkfox net> Reviewed-on: rc/aircox#127
This commit is contained in:
		@ -30,8 +30,7 @@ class Command(BaseCommand):
 | 
			
		||||
            "--age",
 | 
			
		||||
            type=int,
 | 
			
		||||
            default=settings.LOGS_ARCHIVES_AGE,
 | 
			
		||||
            help="minimal age in days of logs to archive. Default is "
 | 
			
		||||
            "settings.LOGS_ARCHIVES_AGE",
 | 
			
		||||
            help="minimal age in days of logs to archive. Default is " "settings.LOGS_ARCHIVES_AGE",
 | 
			
		||||
        )
 | 
			
		||||
        group.add_argument(
 | 
			
		||||
            "-k",
 | 
			
		||||
 | 
			
		||||
@ -55,14 +55,11 @@ class Command(BaseCommand):
 | 
			
		||||
        group.add_argument(
 | 
			
		||||
            "--next-month",
 | 
			
		||||
            action="store_true",
 | 
			
		||||
            help="set the date to the next month of given date"
 | 
			
		||||
            " (if next month from today",
 | 
			
		||||
            help="set the date to the next month of given date" " (if next month from today",
 | 
			
		||||
        )
 | 
			
		||||
 | 
			
		||||
    def handle(self, *args, **options):
 | 
			
		||||
        date = datetime.date(
 | 
			
		||||
            year=options["year"], month=options["month"], day=1
 | 
			
		||||
        )
 | 
			
		||||
        date = datetime.date(year=options["year"], month=options["month"], day=1)
 | 
			
		||||
        if options.get("next_month"):
 | 
			
		||||
            month = options.get("month")
 | 
			
		||||
            date += tz.timedelta(days=28)
 | 
			
		||||
 | 
			
		||||
@ -51,18 +51,13 @@ class Command(BaseCommand):
 | 
			
		||||
    def handle(self, path, *args, **options):
 | 
			
		||||
        # FIXME: absolute/relative path of sounds vs given path
 | 
			
		||||
        if options.get("sound"):
 | 
			
		||||
            sound = Sound.objects.filter(
 | 
			
		||||
                file__icontains=options.get("sound")
 | 
			
		||||
            ).first()
 | 
			
		||||
            sound = Sound.objects.filter(file__icontains=options.get("sound")).first()
 | 
			
		||||
        else:
 | 
			
		||||
            path_, ext = os.path.splitext(path)
 | 
			
		||||
            sound = Sound.objects.filter(path__icontains=path_).first()
 | 
			
		||||
 | 
			
		||||
        if not sound:
 | 
			
		||||
            logger.error(
 | 
			
		||||
                "no sound found in the database for the path "
 | 
			
		||||
                "{path}".format(path=path)
 | 
			
		||||
            )
 | 
			
		||||
            logger.error("no sound found in the database for the path " "{path}".format(path=path))
 | 
			
		||||
            return
 | 
			
		||||
 | 
			
		||||
        # FIXME: auto get sound.episode if any
 | 
			
		||||
 | 
			
		||||
@ -43,8 +43,7 @@ class Command(BaseCommand):
 | 
			
		||||
            "-q",
 | 
			
		||||
            "--quality_check",
 | 
			
		||||
            action="store_true",
 | 
			
		||||
            help="Enable quality check using sound_quality_check on all "
 | 
			
		||||
            "sounds marqued as not good",
 | 
			
		||||
            help="Enable quality check using sound_quality_check on all " "sounds marqued as not good",
 | 
			
		||||
        )
 | 
			
		||||
        parser.add_argument(
 | 
			
		||||
            "-s",
 | 
			
		||||
@ -57,8 +56,7 @@ class Command(BaseCommand):
 | 
			
		||||
            "-m",
 | 
			
		||||
            "--monitor",
 | 
			
		||||
            action="store_true",
 | 
			
		||||
            help="Run in monitor mode, watch for modification in the "
 | 
			
		||||
            "filesystem and react in consequence",
 | 
			
		||||
            help="Run in monitor mode, watch for modification in the " "filesystem and react in consequence",
 | 
			
		||||
        )
 | 
			
		||||
 | 
			
		||||
    def handle(self, *args, **options):
 | 
			
		||||
 | 
			
		||||
@ -28,8 +28,7 @@ class Command(BaseCommand):
 | 
			
		||||
            "--sample_length",
 | 
			
		||||
            type=int,
 | 
			
		||||
            default=120,
 | 
			
		||||
            help="size of sample to analyse in seconds. If not set (or 0), "
 | 
			
		||||
            "does not analyse by sample",
 | 
			
		||||
            help="size of sample to analyse in seconds. If not set (or 0), " "does not analyse by sample",
 | 
			
		||||
        )
 | 
			
		||||
        parser.add_argument(
 | 
			
		||||
            "-a",
 | 
			
		||||
@ -43,8 +42,7 @@ class Command(BaseCommand):
 | 
			
		||||
            "--range",
 | 
			
		||||
            type=float,
 | 
			
		||||
            nargs=2,
 | 
			
		||||
            help="range of minimal and maximal accepted value such as: "
 | 
			
		||||
            "--range min max",
 | 
			
		||||
            help="range of minimal and maximal accepted value such as: " "--range min max",
 | 
			
		||||
        )
 | 
			
		||||
        parser.add_argument(
 | 
			
		||||
            "-i",
 | 
			
		||||
@ -64,10 +62,7 @@ class Command(BaseCommand):
 | 
			
		||||
            raise CommandError("no attribute specified")
 | 
			
		||||
 | 
			
		||||
        # sound analyse and checks
 | 
			
		||||
        self.sounds = [
 | 
			
		||||
            SoundStats(path, options.get("sample_length"))
 | 
			
		||||
            for path in options.get("files")
 | 
			
		||||
        ]
 | 
			
		||||
        self.sounds = [SoundStats(path, options.get("sample_length")) for path in options.get("files")]
 | 
			
		||||
        self.bad = []
 | 
			
		||||
        self.good = []
 | 
			
		||||
        for sound in self.sounds:
 | 
			
		||||
 | 
			
		||||
		Reference in New Issue
	
	Block a user