Commit Graph

47 Commits

Author SHA1 Message Date
Florence Blanc-Renaud
8d7bd6c6ab pylint: fix errors
Fix the following errors:
I0021(useless-suppression)
R1710(inconsistent-return-statements)
E1101(no-member)

Ignore the following errors:
E0601(used-before-assignment)
The variable is imported when the code is run in_server.

Signed-off-by: Florence Blanc-Renaud <flo@redhat.com>
Reviewed-By: Alexander Bokovoy <abokovoy@redhat.com>
Reviewed-By: Rob Crittenden <rcritten@redhat.com>
2024-01-09 08:40:47 +01:00
Florence Blanc-Renaud
372a5dc6b8 pylint: disable invalid-sequence-index
Related: https://pagure.io/freeipa/issue/9278

Signed-off-by: Florence Blanc-Renaud <flo@redhat.com>
Reviewed-By: Stanislav Levin <slev@altlinux.org>
2023-01-10 08:30:58 +01:00
Florence Blanc-Renaud
12067297d8 pylint: remove useless suppression
The newer version of pylint has fixed false positives and
does not need anymore these suppressions:
- global-variable-not-assigned
- invalid-sequence-index
- no-name-in-module
- not-callable
- unsupported-assignment-operation

Related: https://pagure.io/freeipa/issue/9278
Signed-off-by: Florence Blanc-Renaud <flo@redhat.com>
Reviewed-By: Stanislav Levin <slev@altlinux.org>
2023-01-10 08:30:58 +01:00
Stanislav Levin
bcc6361c48 pylint: Skip false-positive invalid-sequence-index
Pylint doesn't handle flow control and thus, doesn't understand
that a key of type `str` is not reachable at this point:

> ipalib/base.py:472: [E1126(invalid-sequence-index),
  NameSpace.__getitem__] Sequence index is not an int, slice, or instance
  with __index__)

Note: I faced this error on Python3.9 and didn't see it using
Python3.10.

Fixes: https://pagure.io/freeipa/issue/9117
Signed-off-by: Stanislav Levin <slev@altlinux.org>
Reviewed-By: Rob Crittenden <rcritten@redhat.com>
2022-03-11 13:37:08 -05:00
Christian Heimes
964a9bdcec Py3: Replace six.string_types with str
In Python 3, six.string_types is just an alias for str.

See: https://pagure.io/freeipa/issue/7715
Signed-off-by: Christian Heimes <cheimes@redhat.com>
Reviewed-By: Florence Blanc-Renaud <frenaud@redhat.com>
2018-09-27 16:11:18 +02:00
Christian Heimes
b431e9b684 Py3: Remove subclassing from object
Python 2 had old style and new style classes. Python 3 has only new
style classes. There is no point to subclass from object any more.

See: https://pagure.io/freeipa/issue/7715
Signed-off-by: Christian Heimes <cheimes@redhat.com>
Reviewed-By: Florence Blanc-Renaud <frenaud@redhat.com>
2018-09-27 11:49:04 +02:00
Petr Viktorin
5178e9a597 Modernize use of range()
In Python 3, range() behaves like the old xrange().
The difference between range() and xrange() is usually not significant,
especially if the whole result is iterated over.

Convert xrange() usage to range() for small ranges.
Use modern idioms in a few other uses of range().

Reviewed-By: Christian Heimes <cheimes@redhat.com>
Reviewed-By: Jan Cholasta <jcholast@redhat.com>
2015-09-01 11:42:01 +02:00
Petr Viktorin
dd16cc98b0 Use six.string_types instead of "basestring"
Reviewed-By: Christian Heimes <cheimes@redhat.com>
Reviewed-By: Jan Cholasta <jcholast@redhat.com>
2015-09-01 11:42:01 +02:00
Petr Viktorin
5435a8a32a Use absolute imports
In Python 3, implicit relative imports will not be supported.
Use fully-qualified imports everywhere.

Reviewed-By: Tomas Babej <tbabej@redhat.com>
2015-08-12 18:17:23 +02:00
Petr Viktorin
4f302f6500 Allow indexing API object types by class
This allows code like:
    from ipalib.plugins.dns import dnszone_mod

    api.Command[dnszone_mod]

This form should be preferred when getting specific objects
because it ensures that the appropriate plugin is imported.

https://fedorahosted.org/freeipa/ticket/4185

Reviewed-By: Martin Kosek <mkosek@redhat.com>
2014-03-25 14:18:12 +01:00
Jakub Hrozek
7493d781df Change FreeIPA license to GPLv3+
The changes include:
 * Change license blobs in source files to mention GPLv3+ not GPLv2 only
 * Add GPLv3+ license text
 * Package COPYING not LICENSE as the license blobs (even the old ones)
   mention COPYING specifically, it is also more common, I think

 https://fedorahosted.org/freeipa/ticket/239
2010-12-20 17:19:53 -05:00
Rob Crittenden
338578d10a Allow one-character Param names
This is done explicitly to support the l/localityname attribute.
2010-02-12 13:14:29 -07:00
Jason Gerard DeRose
c0f558d98b Removed PluginProxy and all its uses 2009-08-05 12:18:51 -04:00
Jason Gerard DeRose
24b6cb89d4 Further migration toward new xmlrcp code; fixed problem with unicode Fault.faultString; fixed problem where ServerProxy method was not called correctly 2009-02-03 15:29:01 -05:00
Jason Gerard DeRose
2462135da0 Added a few missing things to base.ReadOnly docstrings 2009-01-05 12:41:02 -07:00
Jason Gerard DeRose
ea7f9594df A few docstring edits in base.NameSpace 2009-01-02 00:35:42 -07:00
Jason Gerard DeRose
b3063dbb8a A few base.NameSpace docstring tweaks 2008-12-31 15:47:28 -07:00
Jason Gerard DeRose
86325bf4eb Copied plugable.NameSpace to base.NameSpace and made many docstring and unit test improvements 2008-12-31 02:28:49 -07:00
Jason Gerard DeRose
57dae28d9c Added base.lock() and base.islocked() functions; added corresponding unit tests 2008-12-30 21:14:51 -07:00
Jason Gerard DeRose
03c9114958 More docstring cleanup in ipalib.config 2008-12-30 13:52:36 -07:00
Jason Gerard DeRose
7012bed299 Small changes to base.ReadOnly docstring 2008-12-30 01:08:04 -07:00
Jason Gerard DeRose
8decf4d8c3 Decided against indenting the example code in the base.ReadOnly docstring 2008-12-30 00:57:56 -07:00
Jason Gerard DeRose
447c88a2bb Started moving some core classes and functions from plugable.py to new base.py module 2008-12-30 00:45:48 -07:00
Jason Gerard DeRose
293b31ac75 60: Remeved depreciated base.py, crud.py; remeved corresponding test_base.py, test_crud.py 2008-08-06 14:30:21 +00:00
Jason Gerard DeRose
d7569a84b9 31: Renamed exceptions.py to errors.py 2008-07-31 18:57:10 +00:00
Jason Gerard DeRose
8b64314359 29: Some experimentation to make the Registar more generalized 2008-07-25 03:17:24 +00:00
Jason Gerard DeRose
fc33f5d359 28: Added new base.Register class that is a more generic way of doing the plugin registration and doesn't itself instatiate any plugins; added corresponding unit tests 2008-07-22 06:41:33 +00:00
Jason Gerard DeRose
0c574d8300 27: Added quick hack for replace('-', '_') problem I'm having 2008-07-21 01:58:22 +00:00
Jason Gerard DeRose
7273d48169 26: Added AbstractCommand.get_doc() method to return the gettext translated summary of command; added get_doc() method to all example 2008-07-21 01:44:59 +00:00
Jason Gerard DeRose
15c419de12 24: Ported Registar to changes around Attribute; updated unit tests 2008-07-20 23:09:29 +00:00
Jason Gerard DeRose
6f58880dcd 23: Added base.Attribute class that determins the object association via class naming convention instead of through the _obj attribute 2008-07-20 21:42:35 +00:00
Jason Gerard DeRose
f3faaf2d29 22: Named.name property now calls _get_name() at first evaluation to make changing the behaviour in subclasses easier 2008-07-20 18:55:53 +00:00
Jason Gerard DeRose
14339cfae0 20: Updated example plugins, added '_api_' command to ipa script with prints the api 2008-07-20 18:36:02 +00:00
Jason Gerard DeRose
9b3e2f5cec 18: Moved base2 stuff into base 2008-07-20 18:10:08 +00:00
Jason Gerard DeRose
c2df391569 14: Added Named.cli property that returns name.replace('_', '-'); Named.doc property now does a strip() to make it more user-friendly; added test_Named unit tests which somehow got dropped, uppdated with new Named properties 2008-07-20 03:48:36 +00:00
Jason Gerard DeRose
370282819d 13: Starting playing around with 'ipa' cli script 2008-07-20 03:32:22 +00:00
Jason Gerard DeRose
700d58ac1e 11: Added submodules needed to triger the plugin loading, etc., so I can start work on the cli demo 2008-07-20 02:03:15 +00:00
Jason Gerard DeRose
7acf12e988 10: Updated base.API to reflect the fact that base.Object is now the new unit of plugin functionality; updated corresponding unit tests 2008-07-20 01:29:59 +00:00
Jason Gerard DeRose
ccd8eb3373 9: Reorganized new work and unit tests based around base.Object being the plugin definining unit 2008-07-19 23:40:23 +00:00
Jason Gerard DeRose
e76160b01d 8: Experimental work on more OO definition of what gets pluged into API.commands 2008-07-19 21:51:07 +00:00
Jason Gerard DeRose
26c9f4c881 7: Roughed out API.finalize(); added corresponding unit tests 2008-07-19 08:31:46 +00:00
Jason Gerard DeRose
91adc9c2d0 6: Fleshed out API.register_command, made correpsonding unit tests much more rigorous 2008-07-19 07:43:48 +00:00
Jason Gerard DeRose
e8257ad531 5: Fleshed out base.Named, added corresponding unit tests 2008-07-19 06:03:34 +00:00
Jason Gerard DeRose
ef7594ffe1 4: Got basics of API.register_command() working; added corresponding unit tests 2008-07-19 04:28:03 +00:00
Jason Gerard DeRose
5470a0d29a 3: Finished NameSpace and cerresponding unit tests 2008-07-19 00:56:09 +00:00
Jason Gerard DeRose
00f4da79a9 2: Got basics of NameSpace working, added corresponding unit tests 2008-07-18 20:31:12 +00:00
Jason Gerard DeRose
556abfaf0b 1: Started roughing out ipalib package 2008-07-18 17:51:34 +00:00