Skip to content
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

Tidy up of language, deprecated modules, imports #1510

Open
wants to merge 11 commits into
base: master
Choose a base branch
from

Conversation

marksmayo
Copy link

Second attempt, kept to minor items, and separated all commits below by type of fix.

using isort to tidy up imports, removing unncessary ones and cleaning order and spacings.
Trailing spaces, newlines, alignments
eg for assert, del, some ifs
and clean up lines for if/else statements
@az0
Copy link
Member

az0 commented Aug 6, 2023

Build error

https://ci.appveyor.com/project/az0/bleachbit/builds/47557436#L516

copying bleachbit\markovify\__init__.py -> build\lib\bleachbit\markovify
Falling back to loader to get code for module pywintypes
2023-07-16 04:42:02 - ERROR - Traceback (most recent call last):
  File "C:\Python34\lib\site-packages\py2exe\mf3.py", line 696, in __code__
    source = self.__source__
  File "C:\Python34\lib\site-packages\py2exe\mf3.py", line 723, in __source__
    return self.__loader__.get_source(self.__name__)
AttributeError: 'ModuleSpec' object has no attribute 'get_source'
Traceback (most recent call last):
  File "C:\Python34\lib\site-packages\py2exe\mf3.py", line 699, in __code__
    raise RuntimeError("loading %r" % self) from None
RuntimeError: loading Module(pywintypes)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
  File "setup.py", line 282, in <module>
    run_setup()
  File "setup.py", line 275, in run_setup
    **args)
  File "C:\Python34\lib\distutils\core.py", line 148, in setup
    dist.run_commands()
  File "C:\Python34\lib\distutils\dist.py", line 955, in run_commands
    self.run_command(cmd)
  File "C:\Python34\lib\distutils\dist.py", line 974, in run_command
    cmd_obj.run()
  File "C:\Python34\lib\site-packages\py2exe\distutils_buildexe.py", line 192, in run
    self._run()
  File "C:\Python34\lib\site-packages\py2exe\distutils_buildexe.py", line 272, in _run
    builder.analyze()
  File "C:\Python34\lib\site-packages\py2exe\runtime.py", line 172, in analyze
    mf.import_package(modname)
  File "C:\Python34\lib\site-packages\py2exe\mf3.py", line 102, in import_package
    self.import_package("%s.%s" % (name, modname))
  File "C:\Python34\lib\site-packages\py2exe\mf3.py", line 102, in import_package
    self.import_package("%s.%s" % (name, modname))
  File "C:\Python34\lib\site-packages\py2exe\mf3.py", line 100, in import_package
    self.safe_import_hook("%s.%s" % (name, modname))
  File "C:\Python34\lib\site-packages\py2exe\mf3.py", line 140, in safe_import_hook
    self.import_hook(name, caller, fromlist, level)
  File "C:\Python34\lib\site-packages\py2exe\mf3.py", line 122, in import_hook
    module = self._gcd_import(name)
  File "C:\Python34\lib\site-packages\py2exe\mf3.py", line 276, in _gcd_import
    return self._find_and_load(name)
  File "C:\Python34\lib\site-packages\py2exe\mf3.py", line 393, in _find_and_load
    self._scan_code(module.__code__, module)
  File "C:\Python34\lib\site-packages\py2exe\mf3.py", line 430, in _scan_code
    self.safe_import_hook(name, mod, fromlist, level)
  File "C:\Python34\lib\site-packages\py2exe\mf3.py", line 140, in safe_import_hook
    self.import_hook(name, caller, fromlist, level)
  File "C:\Python34\lib\site-packages\py2exe\mf3.py", line 122, in import_hook
    module = self._gcd_import(name)
  File "C:\Python34\lib\site-packages\py2exe\mf3.py", line 276, in _gcd_import
    return self._find_and_load(name)
  File "C:\Python34\lib\site-packages\py2exe\mf3.py", line 290, in _find_and_load
    self._gcd_import(parent)
  File "C:\Python34\lib\site-packages\py2exe\mf3.py", line 276, in _gcd_import
    return self._find_and_load(name)
  File "C:\Python34\lib\site-packages\py2exe\mf3.py", line 290, in _find_and_load
    self._gcd_import(parent)
  File "C:\Python34\lib\site-packages\py2exe\mf3.py", line 276, in _gcd_import
    return self._find_and_load(name)
  File "C:\Python34\lib\site-packages\py2exe\mf3.py", line 377, in _find_and_load
    self._load_module(loader, name)
  File "C:\Python34\lib\site-packages\py2exe\mf3.py", line 408, in _load_module
    self._add_module(name, mod)
  File "C:\Python34\lib\site-packages\py2exe\dllfinder.py", line 233, in _add_module
    self.hook(mod)
  File "C:\Python34\lib\site-packages\py2exe\dllfinder.py", line 230, in hook
    mth(self, mod)
  File "C:\Python34\lib\site-packages\py2exe\hooks.py", line 269, in hook_win32com
    finder.import_hook("pywintypes")
  File "C:\Python34\lib\site-packages\py2exe\mf3.py", line 122, in import_hook
    module = self._gcd_import(name)
  File "C:\Python34\lib\site-packages\py2exe\mf3.py", line 276, in _gcd_import
    return self._find_and_load(name)
  File "C:\Python34\lib\site-packages\py2exe\mf3.py", line 392, in _find_and_load
    if module.__code__:
  File "C:\Python34\lib\site-packages\py2exe\mf3.py", line 717, in __code__
    self.__code_object__ = self.__loader__.get_code(self.__name__)
AttributeError: 'ModuleSpec' object has no attribute 'get_code'
2023-07-16 04:42:02 - ERROR - dist\bleachbit.exe not found

@az0
Copy link
Member

az0 commented Aug 6, 2023

This looks okay except the build error. Thank you

Please note that this commit by autopep8 caused a crash, which was fixed in another commit.

@az0 az0 self-assigned this Aug 6, 2023
@az0 az0 self-requested a review August 6, 2023 17:02
@az0
Copy link
Member

az0 commented Aug 25, 2023

AppVeyor errors are below. Maybe you want to split this up further to make it easier to merge?

======================================================================
ERROR: test_shred (tests.TestDeepScan.DeepScanTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "C:\projects\bleachbit\tests\TestDeepScan.py", line 143, in test_shred
    self._test_delete('shred')
  File "C:\projects\bleachbit\tests\TestDeepScan.py", line 94, in _test_delete
    os.mkdir(subdir)
FileExistsError: [WinError 183] Cannot create a file when that file already exists: 'C:\\Users\\appveyor\\AppData\\Local\\Temp\\1\\DeepScanTestCasegsfjsgsp\\sub'
======================================================================
FAIL: test_get_commands (tests.TestCleaner.CleanerTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "C:\projects\bleachbit\tests\TestCleaner.py", line 155, in test_get_commands
    common.validate_result(self, result)
  File "C:\projects\bleachbit\tests\common.py", line 218, in validate_result
    self.assertIsString(result['label'])
  File "C:\projects\bleachbit\tests\common.py", line 93, in assertIsString
    self.assertIsInstance(obj, str, msg)
AssertionError: None is not an instance of <class 'str'> : 
======================================================================
FAIL: test_no_files_exist (tests.TestCleaner.CleanerTestCase)
Verify only existing files are returned
----------------------------------------------------------------------
Traceback (most recent call last):
  File "C:\projects\bleachbit\tests\TestCleaner.py", line 191, in test_no_files_exist
    self.assertNotIsInstance(cmd, Command.Delete, msg)
AssertionError: <bleachbit.Command.Delete object at 0x03A74B50> is an instance of <class 'bleachbit.Command.Delete'> : Expected no files to be deleted but got '{'size': 11, 'n_deleted': 1, 'label': 'Delete', 'n_special': 0, 'path': 'C:\\Users\\appveyor\\AppData\\Local\\Temp\\1\\gen_py\\3.4\\dicts.dat'}'
======================================================================
FAIL: test_delete (tests.TestDeepScan.DeepScanTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "C:\projects\bleachbit\tests\TestDeepScan.py", line 140, in test_delete
    self._test_delete('delete')
  File "C:\projects\bleachbit\tests\TestDeepScan.py", line 122, in _test_delete
    self.assertFalse(os.path.exists(f_del2))
AssertionError: True is not false
======================================================================
FAIL: test_encoding (tests.TestDeepScan.DeepScanTestCase)
Test encoding
----------------------------------------------------------------------
Traceback (most recent call last):
  File "C:\projects\bleachbit\tests\TestDeepScan.py", line 72, in test_encoding
    self._test_encoding(test)
  File "C:\projects\bleachbit\tests\TestDeepScan.py", line 61, in _test_encoding
    self.assertTrue(found, "Did not find '%s'" % fullpath)
AssertionError: False is not true : Did not find 'C:\Users\appveyor\AppData\Local\Temp\1\DeepScanTestCasegsfjsgsp\ascii.bak'
----------------------------------------------------------------------
Ran 217 tests in 127.742s
FAILED (failures=4, errors=1, skipped=36)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants