1
0
mirror of https://github.com/etesync/server synced 2024-11-22 08:48:07 +00:00

pylint: fix more warnings.

This commit is contained in:
Tom Hacohen 2020-02-26 14:32:25 +02:00
parent 0beaaf5bf9
commit 727cd3e5fa
2 changed files with 5 additions and 8 deletions

View File

@ -12,8 +12,6 @@
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
import sys # noqa
class AppSettings: class AppSettings:
def __init__(self, prefix): def __init__(self, prefix):
@ -22,17 +20,17 @@ class AppSettings:
def import_from_str(self, name): def import_from_str(self, name):
from importlib import import_module from importlib import import_module
p, m = name.rsplit('.', 1) path, prop = name.rsplit('.', 1)
mod = import_module(p) mod = import_module(path)
return getattr(mod, m) return getattr(mod, prop)
def _setting(self, name, dflt): def _setting(self, name, dflt):
from django.conf import settings from django.conf import settings
return getattr(settings, self.prefix + name, dflt) return getattr(settings, self.prefix + name, dflt)
@property @property
def API_PERMISSIONS(self): def API_PERMISSIONS(self): # pylint: disable=invalid-name
perms = self._setting("API_PERMISSIONS", ('rest_framework.permissions.IsAuthenticated', )) perms = self._setting("API_PERMISSIONS", ('rest_framework.permissions.IsAuthenticated', ))
ret = [] ret = []
for perm in perms: for perm in perms:
@ -40,7 +38,7 @@ class AppSettings:
return ret return ret
@property @property
def API_AUTHENTICATORS(self): def API_AUTHENTICATORS(self): # pylint: disable=invalid-name
perms = self._setting("API_AUTHENTICATORS", ('rest_framework.authentication.TokenAuthentication', perms = self._setting("API_AUTHENTICATORS", ('rest_framework.authentication.TokenAuthentication',
'rest_framework.authentication.SessionAuthentication')) 'rest_framework.authentication.SessionAuthentication'))
ret = [] ret = []

View File

@ -36,7 +36,6 @@ class Collection(models.Model):
return self.uid return self.uid
class CollectionItem(models.Model): class CollectionItem(models.Model):
uid = models.CharField(db_index=True, blank=False, null=False, uid = models.CharField(db_index=True, blank=False, null=False,
max_length=44, validators=[UidValidator]) max_length=44, validators=[UidValidator])