Mike Auty
9824538bd9
Numerous pycharm warnings resolved
...
This includes:
* Better ways of checking empty lists
* Not shadowing builtin functions like filter
* Preventing invalid slash warnings by marking strings as regexps
* Removing unnecessary brackets
* Lowercase variable names
* Adding/updating parameters in docstrings
* Removing unused code (lines not chunks)
* Change in not a member tests
* Changing some methods to static
* Shorting range membership checks
* Missing parameters
* Make some exception handlers more specific
* Don't define a lambda to a variable
* A few more instance checks to help type checkers
2018-12-16 13:21:06 +00:00
Mike Auty
29d41470a4
Mass reformat of typing imports
...
Relented on the strict import of direct objects/classes for the typing
module only. Typing module components can be directly imported because
it makes the code really painful to read and write otherwise.
This is still in-line with the python style guide adopted from Google at
http://google.github.io/styleguide/pyguide.html section 2.2.
2018-12-16 13:04:22 +00:00
Mike Auty
f41e3e0453
Completely rework the primitive data format system.
2018-12-13 18:33:42 +00:00
Mike Auty
9949809198
Fix a minor typo.
2018-12-13 18:33:42 +00:00
Mike Auty
b533d19f83
Refactor the data extraction for primitive types.
2018-12-13 18:33:42 +00:00
Mike Auty
a78452e361
Fix up ugly int128 hack with a slightly nicer hack.
2018-12-13 15:56:24 +00:00
Mike Auty
90c964905a
Fix up a circular import issue.
2018-11-08 00:25:26 +00:00
Mike Auty
db7320e426
Bulk lint and a couple of typos fixed.
2018-11-08 00:19:17 +00:00
Mike Auty
001d53e768
Rework some code to help with typing.
2018-11-01 11:17:15 +00:00
Mike Auty
9c101aee91
Ensure pointers are masked based on their native_layer not their instantiated layer.
2018-10-04 02:44:26 +01:00
Mike Auty
fa552aa3b0
Add in the native_layer_name concept to ObjectInformation.
2018-09-12 22:45:34 +01:00
Mike Auty
3a6b4ad35c
Add in the has_member method for objects and templates.
2018-08-29 22:54:56 +01:00
Mike Auty
d08c29ffab
Improve style to use default iterators rather than explicit ones.
2018-08-05 16:18:53 +01:00
Mike Auty
b1d46f843b
Convert documentation to napoleon/Google format docstrings.
2018-08-05 15:52:12 +01:00
Mike Auty
7fc19ef110
Updating typing information.
2018-08-05 15:02:11 +01:00
Mike Auty
bca972f28a
Remove the python implementation of __getattribute__ for speed.
...
The __getattribute__ method is called for *all* attribute lookups, and
the python implementation is likely slow. The only function the python
implementation provided was to check that properties started with
helper_. Since this only provided a log message, we could add it back
in only if the log level is high enough? Either way, it's not
significant enough to warrant costing extra time in every attribute
lookup on every object.
2018-07-30 23:58:02 +01:00
Mike Auty
d9ed86bcc5
Ensure we return the correct values for dir().
2018-06-16 14:29:51 +01:00
Mike Auty
7a52ac9deb
Fix a large number of typing issues.
...
There are several instances where mypy didn't detect
if blah is not None:
blah = thing
and so were rewritten as:
blah = blah or thing
2018-06-04 01:25:02 +01:00
Mike Auty
6fdf577058
Fix up another typing warning.
2018-04-12 14:57:10 +01:00
Mike Auty
66af2f16de
Fix more typing issues.
2018-04-12 14:09:11 +01:00
Mike Auty
c758c249d0
Fix classing issue introduced by recent pickling work.
2018-04-11 20:54:48 +01:00
Mike Auty
1f733e7dc4
Make sure we don't get in a getattr loop.
...
This appears to get in a loop when it's been unpickled by
multiprocessing. My guess is that it's trying to set _concrete_members
without it being done in __init__ and there gets in a loop.
We ensure then when doing a look-up inside __getattr__, it happens using
__getattribute__.
2018-04-08 23:28:14 +01:00
Mike Auty
d8f497eb71
Allow unpickling of PrimitiveObjects.
2018-04-08 22:25:46 +01:00
Mike Auty
d8cdd79843
Add in pointer is_readable method to check if the pointer would translate properly.
2018-03-24 11:00:22 +00:00
Mike Auty
efada8a15f
Bring relative_child_offset typing in line with practice.
2018-03-23 16:04:03 +00:00
Mike Auty
bc8429a2b0
Convert all helper_ properties to get_ methods.
2018-03-09 00:47:00 +00:00
Mike Auty
69ec16ded3
Fix up the signatures for the overloaded __getitem__ method.
2017-12-13 23:21:31 +00:00
Mike Auty
f50a0b715d
Add in object type-annotations.
2017-12-13 20:48:52 +00:00
Mike Auty
f40fae197d
Convert to python3.5 syntax (no local type-annotations).
2017-12-13 20:48:52 +00:00
Mike Auty
d7d13eb19c
Add type annotations to most of the automagic files.
2017-12-13 20:48:52 +00:00
Mike Auty
be1ebf03b0
Don't forget the constants import.
2017-11-09 23:16:46 +00:00
Mike Auty
18b84e31a5
Don't forget the constants import.
2017-11-09 23:16:30 +00:00
Mike Auty
042ff5ca25
Use .vol.count for consistency.
2017-10-09 00:19:05 +01:00
Mike Auty
8dc6401ad8
Add in gentle deprecation warnings about non-helper properties to prevent member confusion.
2017-10-08 23:02:13 +01:00
Mike Auty
71cfec18a6
Add commentary around a potential conflict of method with property.
2017-09-20 09:38:28 +01:00
Mike Auty
5261da780b
Allow the size of array to be changed (may override an existing count member).
2017-09-18 23:23:23 +01:00
Mike Auty
255228ecb0
Convert to abc (post python-3.3).
2017-09-18 23:22:08 +01:00
Mike Auty
c336a39695
Fix up the Char type (struct.unpack returns a bytes, not a string).
2017-08-10 20:44:21 +01:00
Mike Auty
d79d428edc
Ensure we use the native dictionary for more recent IFF versions (and correct issues with pointers and chars).
2017-06-23 15:44:58 +01:00
Mike Auty
5e15d522bd
Remove automatic IDE-inserted attributions.
...
They weren't consistent and they show just remind me how slowly
I've been getting vol 3 written! 5:S
There's git commits to track all of that stuff if we need it.
2017-05-14 11:40:49 +01:00
Mike Auty
6603e503c5
Rework enumeration access in symbol tables.
2017-02-04 14:46:46 +00:00
Mike Auty
547a3d94bb
Fix up the documentation and leave a note about cast accepting short type names.
2017-01-04 22:10:27 +00:00
Mike Auty
7a1fcec1b5
Change subtype to base_type to match the __init__ parameter name.
2016-12-20 08:31:01 +00:00
Mike Auty
1e6911b753
Create appropriate VolTemplateProxy classes for BitField and Enumeration.
2016-12-20 08:29:41 +00:00
Mike Auty
a7d3a95ad0
Fix BitFields (and Enumerations) to accept only Integer basetypes and derive from them properly.
2016-12-20 08:25:55 +00:00
Mike Auty
0f548e864c
Add in comment in case of mutability trouble in the Struct TemplateProxy.
2016-12-18 20:52:38 +00:00
Mike Auty
be075939d2
Remove flags as a fully-fledged object until it's been discussed
2016-12-18 19:38:05 +00:00
Mike Auty
190bcd7bf1
Include an initial flags object.
...
This might get removed, given it could be achieve with a wrapper rather
than a fully defined Object.
2016-12-18 16:29:19 +00:00
Mike Auty
54678823f8
Refactor BitField subtype to base_type to match enums (and fix a minor enum typo too).
2016-12-18 16:12:08 +00:00
Mike Auty
45d37bb961
Remove misleading TODO.
2016-12-18 15:52:03 +00:00