use class PA / inheritance on dup classes

This commit is contained in:
2021-08-30 18:24:31 +10:00
parent 8f7d6bd77c
commit 5ca8424e58

15
dups.py
View File

@@ -22,14 +22,14 @@ import re
################################################################################
from job import Job, JobExtra, Joblog, NewJob
from settings import Settings
from shared import SymlinkName
from shared import SymlinkName, PA
from path import PathType
################################################################################
# DupRow class is a simple 'struct' to keep data per duplicate file / just to
# avoid using python list/dicts intermixed, and be able to consistently use
# dot-notation of fields
class DupRow:
class DupRow(PA):
def __init__(self, hash, file, dir, did, fid):
### DupRow Attributes -- note, simple class, no methods ###
self.h=hash
@@ -39,14 +39,11 @@ class DupRow:
self.id=fid
return
def __repr__(self):
return f"DupRow( id: {self.id}, did: {self.did} )"
################################################################################
# DupPathRow class is a simple 'struct' to keep data per files in duplicate paths
# just to avoid using python list/dicts intermixed, and be able to consistently use
# dot-notation of fields
class DupPathRow:
class DupPathRow(PA):
def __init__(self, count, d1, d2, did1, did2, hashes ):
self.count=count
self.d1=d1
@@ -54,9 +51,7 @@ class DupPathRow:
self.did1=did1
self.did2=did2
self.hashes=hashes
def __repr__(self):
return f"DupPathRow( did1: {self.did1}, did2: {self.did2} )"
return
################################################################################
# Duplicates class is used with one instance/object to process all the
@@ -82,7 +77,7 @@ class DupPathRow:
# 2) auto delete any in the storage path that are in a set where 1 of them match the 'YYYY/YYYYMMDD' format, the rest are deleted
# 3) a set of directories where there are only 2 duplicate files (with the same file name), just in a different dir - allow user to choose the dir to keep
# 4) a set of individual files where I want the user to make a decision (3 or more copies, those with different filenames, or in the same dir) - allow user to choose file to keep
class Duplicates:
class Duplicates(PA):
def __init__(self):
### Duplicates Attributes ###
self.ip_to_sp_dups_keep={}