-
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
JPEG and PNG exif #24
Conversation
Dependency Review✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.OpenSSF Scorecard
Scanned Files |
"With": '{"Some": "useful", "although": "also"}', | ||
"Only": '{"The": "best", "Algorithm": "Will", "Successfully": "Match"}', | ||
} | ||
assert ( |
Check notice
Code scanning / Bandit (reported by Codacy)
Use of assert detected. The enclosed code will be removed when compiling to optimised byte code. Note test
# expected_gen_data = "" | ||
# assert result["Generation_Data"] == expected_gen_data | ||
assert mock_delineate_by_esc_codes.call_count == 1 | ||
assert ( |
Check notice
Code scanning / Bandit (reported by Codacy)
Use of assert detected. The enclosed code will be removed when compiling to optimised byte code. Note test
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.
Pylintpython3 (reported by Codacy) found more than 20 potential problems in the proposed changes. Check the Files changed tab for more details.
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.
Pylint (reported by Codacy) found more than 20 potential problems in the proposed changes. Check the Files changed tab for more details.
exif = {TAGS.get(key, val): val for key, val in img.info.items() if key in TAGS} | ||
exif = { | ||
ExifTags.TAGS[label]: content | ||
for label, content in img._getexif().items() |
Check warning
Code scanning / Prospector (reported by Codacy)
Access to a protected member _getexif of a client class (protected-access) Warning
@@ -49,9 +57,15 @@ | |||
img = Image.open(file_path_named) | |||
if img is None: # We dont need to load completely unless totally necessary | |||
img.load() # This is the case when we have no choice but to load (slower) | |||
logger.debug(f"Metadata from png: {file_path_named}: {img.info}") |
Check warning
Code scanning / Prospector (reported by Codacy)
Use lazy % formatting in logging functions (logging-fstring-interpolation) Warning
|
||
from pydantic_core import ValidationError | ||
# from pydantic_core import ValidationError | ||
from pydantic import TypeAdapter, BaseModel, Field, AfterValidator, field_validator, ValidationError |
Check warning
Code scanning / Prospector (reported by Codacy)
Import "from pydantic import TypeAdapter, BaseModel, Field, AfterValidator, field_validator, ValidationError" should be placed at the top of the module (wrong-import-position) Warning
return extracted_data | ||
|
||
|
||
def arrange_nodeui_metadata(header_data: dict) -> dict: |
Check warning
Code scanning / Prospector (reported by Codacy)
Either all return statements in a function should return an expression, or none of them should. (inconsistent-return-statements) Warning
self.display_metadata(metadata, file_path) | ||
|
||
def load_metadata(self, file_path: str) -> dict: | ||
def load_metadata(self, file_path: str, extension: str = '.png') -> dict: |
Check warning
Code scanning / Prospector (reported by Codacy)
Unused argument 'extension' (unused-argument) Warning
formatted_chunk = delineate_escape_codes(mock_header_data) | ||
self.actual_a1111_metadata = [ | ||
"PonyXLV6_Scores GrungeOutfiPDXL_ GlamorShots_PDXL PDXL_FLWRBOY", | ||
'Steps: 30, Sampler: Euler a, Schedule type: Automatic, CFG scale: 7, Hires upscaler: 4x_foolhardy_Remacri, TI hashes: "PonyXLV6_Scores: 4b8555f2fb80, GrungeOutfiPDXL_: b6af61969ec4, GlamorShots_PDXL: 4b8ee3d1bd12, PDXL_FLWRBOY: af38cbdc40f6", Version: v1.10.0', |
Check warning
Code scanning / Prospector (reported by Codacy)
line too long (276 > 159 characters) (E501) Warning test
if __name__ == "__main__": | ||
unittest.main() | ||
|
||
# ['PonyXLV6_Scoresmetadata_parser.py:34 GrungeOutfiPDXL_ GlamorShots_PDXL PDXL_FLWRBOY', 'Steps: 30, Sampler: Euler a, Schedule type: Automatic, CFG scale: 7, Seed: 444906227, Size: 832x1216, Model hash: 5a7e5d791e, Model: PoltergeistCOMIX-PDXL.fp16, Denoising strength: 0.2, Clip skip: 2, ADetailer model: face_yolov8n.pt, ADetailer confidence: 0.3, ADetailer dilate erode: 4, ADetailer mask blur: 4, ADetailer denoising strength: 0.4, ADetailer inpaint only masked: True, ADetailer inpaint padding: 32, ADetailer model 2nd: Anzhc Head+Hair seg medium no dill.pt, ADetailer confidence 2nd: 0.3, ADetailer dilate erode 2nd: 4, ADetailer mask blur 2nd: 4, ADetailer denoising strength 2nd: 0.4, ADetailer inpaint only masked 2nd: True, ADetailer inpaint padding 2nd: 32, ADetailer version: 24.11.1, Hires upscale: 2, Hires steps: 30, Hires upscaler: 4x_foolhardy_Remacri, TI hashes: "PonyXLV6_Scores: 4b8555f2fb80, GrungeOutfiPDXL_: b6af61969ec4, GlamorShots_PDXL: 4b8ee3d1bd12, PDXL_FLWRBOY: af38cbdc40f6, PonyXLV6_Scores: 4b8555f2fb80, GrungeOutfiPDXL_: b6af61969ec4, GlamorShots_PDXL: 4b8ee3d1bd12, PDXL_FLWRBOY: af38cbdc40f6", Version: v1.10.0'] |
Check warning
Code scanning / Prospector (reported by Codacy)
line too long (1157 > 159 characters) (E501) Warning test
Comments (from previous pr) :
Only use
f’ ‘
strings when there’s a variable inside, or the linter tools cryTry
/Except
catches should only encapsulate the risky code, or else it hides errors in other code, making the code difficult to debug. ASK ME WHY I KNOW LOOLIn
try
/except
catches, force the code to fail in the way you predict, then write that exception down instead of using genericas Exception
,This way we know it is expected it to fail in a certain way, and no other errors are hidden that may need to be addressed differently
In general it’s better to use the packages included with python, and as few third-party dependencies as possible. For this reason,
pillow
andpiexif
might be redundant, but I’m not yet sureI check it was working, and added a new test specific for the data you were sharing, but the real test is to open the file you were struggling with before. Send it to me, or try it yourself, w/e. In any case, your code looked pretty good on the whole, nice job! I would encourage you to continue to work on the jpeg aspect. Gonna close this branch and rename mine to kn/x after this merge :3
UPDATE: initial JPEG support added. Removed pixexf, because its outdated AF. Pillow does it all. Test and lmk whats up