Merge pull request #3786 from ostcar/requirements_again

support python 3.7
This commit is contained in:
Oskar Hahn 2018-08-11 12:56:56 +02:00 committed by GitHub
commit 15e4832d40
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
13 changed files with 36 additions and 29 deletions

View File

@ -1,11 +1,13 @@
language: python language: python
sudo: false dist: xenial
sudo: true
cache: cache:
pip: true pip: true
yarn: true yarn: true
python: python:
- "3.5" - "3.5"
- "3.6" - "3.6"
- "3.7"
env: env:
- TRAVIS_NODE_VERSION="10.5" - TRAVIS_NODE_VERSION="10.5"
before_install: before_install:

View File

@ -17,6 +17,7 @@ Motions:
- New table of contents with page numbers and categories in PDF [#3766]. - New table of contents with page numbers and categories in PDF [#3766].
- Updated pdfMake to 0.1.37 [#3766]. - Updated pdfMake to 0.1.37 [#3766].
- Python 3.4 is not supported anymore [#3777]. - Python 3.4 is not supported anymore [#3777].
- Support Python 3.7.
Version 2.2 (2018-06-06) Version 2.2 (2018-06-06)

View File

@ -253,10 +253,10 @@ class ConfigVariable:
the value during setup of the database if the admin uses the respective the value during setup of the database if the admin uses the respective
command line option. command line option.
""" """
def __init__(self, name: str, default_value: T, input_type: str='string', def __init__(self, name: str, default_value: T, input_type: str = 'string',
label: str=None, help_text: str=None, choices: ChoiceCallableType=None, label: str = None, help_text: str = None, choices: ChoiceCallableType = None,
hidden: bool=False, weight: int=0, group: str=None, subgroup: str=None, hidden: bool = False, weight: int = 0, group: str = None, subgroup: str = None,
validators: ValidatorsType=None, on_change: OnChangeType=None) -> None: validators: ValidatorsType = None, on_change: OnChangeType = None) -> None:
if input_type not in INPUT_TYPE_MAPPING: if input_type not in INPUT_TYPE_MAPPING:
raise ValueError(_('Invalid value for config attribute input_type.')) raise ValueError(_('Invalid value for config attribute input_type.'))
if input_type == 'choice' and choices is None: if input_type == 'choice' and choices is None:

View File

@ -42,6 +42,7 @@ def move_old_logo_settings(apps, schema_editor):
logo_pdf_L = ConfigStore.objects.get(key=new_value_key) logo_pdf_L = ConfigStore.objects.get(key=new_value_key)
except ConfigStore.DoesNotExist: except ConfigStore.DoesNotExist:
logo_pdf_L = ConfigStore(key=new_value_key) logo_pdf_L = ConfigStore(key=new_value_key)
logo_pdf_L.value = {}
# Move the path to the new configentry # Move the path to the new configentry
logo_pdf_L.value['path'] = logo_pdf.value.get('path', '') logo_pdf_L.value['path'] = logo_pdf.value.get('path', '')

View File

@ -43,7 +43,7 @@ class MotionSlide(ProjectorElement):
Keep the motion_syntax syncronized with the MotionStateAndRecommendationParser on the client. Keep the motion_syntax syncronized with the MotionStateAndRecommendationParser on the client.
""" """
# get the comments field for state and recommendation # get the comments field for state and recommendation
motion_syntax = re.compile('\[motion:(\d+)\]') motion_syntax = re.compile(r'\[motion:(\d+)\]')
fields = config['motions_comments'] fields = config['motions_comments']
state_field_id = None state_field_id = None
recommendation_field_id = None recommendation_field_id = None

View File

@ -20,7 +20,7 @@ class BaseAccessPermissions:
""" """
return False return False
def get_serializer_class(self, user: CollectionElement=None) -> Serializer: def get_serializer_class(self, user: CollectionElement = None) -> Serializer:
""" """
Returns different serializer classes according to users permissions. Returns different serializer classes according to users permissions.

View File

@ -374,7 +374,7 @@ def to_ordered_dict(d: Optional[Dict]) -> Optional[OrderedDict]:
return result return result
def inform_changed_data(instances: Union[Iterable[Model], Model], information: Dict[str, Any]=None) -> None: def inform_changed_data(instances: Union[Iterable[Model], Model], information: Dict[str, Any] = None) -> None:
""" """
Informs the autoupdate system and the caching system about the creation or Informs the autoupdate system and the caching system about the creation or
update of an element. This is done via the AutoupdateBundleMiddleware. update of an element. This is done via the AutoupdateBundleMiddleware.
@ -404,7 +404,7 @@ def inform_changed_data(instances: Union[Iterable[Model], Model], information: D
bundle[key] = collection_element bundle[key] = collection_element
def inform_deleted_data(elements: Iterable[Tuple[str, int]], information: Dict[str, Any]=None) -> None: def inform_deleted_data(elements: Iterable[Tuple[str, int]], information: Dict[str, Any] = None) -> None:
""" """
Informs the autoupdate system and the caching system about the deletion of Informs the autoupdate system and the caching system about the deletion of
elements. This is done via the AutoupdateBundleMiddleware. elements. This is done via the AutoupdateBundleMiddleware.
@ -426,7 +426,7 @@ def inform_deleted_data(elements: Iterable[Tuple[str, int]], information: Dict[s
def inform_data_collection_element_list(collection_elements: List[CollectionElement], def inform_data_collection_element_list(collection_elements: List[CollectionElement],
information: Dict[str, Any]=None) -> None: information: Dict[str, Any] = None) -> None:
""" """
Informs the autoupdate system about some collection elements. This is Informs the autoupdate system about some collection elements. This is
used just to send some data to all users. used just to send some data to all users.

View File

@ -51,8 +51,8 @@ ChannelMessageFormat = TypedDict(
class CollectionElement: class CollectionElement:
def __init__(self, instance: Model=None, deleted: bool=False, collection_string: str=None, def __init__(self, instance: Model = None, deleted: bool = False, collection_string: str = None,
id: int=None, full_data: Dict[str, Any]=None, information: Dict[str, Any]=None) -> None: id: int = None, full_data: Dict[str, Any] = None, information: Dict[str, Any] = None) -> None:
""" """
Do not use this. Use the methods from_instance() or from_values(). Do not use this. Use the methods from_instance() or from_values().
""" """
@ -86,7 +86,7 @@ class CollectionElement:
self.get_full_data() self.get_full_data()
@classmethod @classmethod
def from_instance(cls, instance: Model, deleted: bool=False, information: Dict[str, Any]=None) -> 'CollectionElement': def from_instance(cls, instance: Model, deleted: bool = False, information: Dict[str, Any] = None) -> 'CollectionElement':
""" """
Returns a collection element from a database instance. Returns a collection element from a database instance.
@ -97,8 +97,8 @@ class CollectionElement:
return cls(instance=instance, deleted=deleted, information=information) return cls(instance=instance, deleted=deleted, information=information)
@classmethod @classmethod
def from_values(cls, collection_string: str, id: int, deleted: bool=False, def from_values(cls, collection_string: str, id: int, deleted: bool = False,
full_data: Dict[str, Any]=None, information: Dict[str, Any]=None) -> 'CollectionElement': full_data: Dict[str, Any] = None, information: Dict[str, Any] = None) -> 'CollectionElement':
""" """
Returns a collection element from a collection_string and an id. Returns a collection element from a collection_string and an id.
@ -210,7 +210,7 @@ class Collection:
Represents all elements of one collection. Represents all elements of one collection.
""" """
def __init__(self, collection_string: str, full_data: List[Dict[str, Any]]=None) -> None: def __init__(self, collection_string: str, full_data: List[Dict[str, Any]] = None) -> None:
""" """
Initiates a Collection. A collection_string has to be given. If Initiates a Collection. A collection_string has to be given. If
full_data (a list of dictionaries) is not given the method full_data (a list of dictionaries) is not given the method
@ -295,7 +295,7 @@ def get_model_from_collection_string(collection_string: str) -> Type[Model]:
return model return model
def format_for_autoupdate(collection_string: str, id: int, action: str, data: Dict[str, Any]=None) -> AutoupdateFormat: def format_for_autoupdate(collection_string: str, id: int, action: str, data: Dict[str, Any] = None) -> AutoupdateFormat:
""" """
Returns a dict that can be used for autoupdate. Returns a dict that can be used for autoupdate.
""" """

View File

@ -60,7 +60,7 @@ def detect_openslides_type() -> str:
return openslides_type return openslides_type
def get_default_settings_dir(openslides_type: str=None) -> str: def get_default_settings_dir(openslides_type: str = None) -> str:
""" """
Returns the default settings path according to the OpenSlides type. Returns the default settings path according to the OpenSlides type.
@ -91,7 +91,7 @@ def get_local_settings_dir() -> str:
return os.path.join('personal_data', 'var') return os.path.join('personal_data', 'var')
def setup_django_settings_module(settings_path: str =None, local_installation: bool=False) -> None: def setup_django_settings_module(settings_path: str = None, local_installation: bool = False) -> None:
""" """
Sets the environment variable ENVIRONMENT_VARIABLE, that means Sets the environment variable ENVIRONMENT_VARIABLE, that means
'DJANGO_SETTINGS_MODULE', to the given settings. 'DJANGO_SETTINGS_MODULE', to the given settings.
@ -131,7 +131,7 @@ def setup_django_settings_module(settings_path: str =None, local_installation: b
os.environ[ENVIRONMENT_VARIABLE] = settings_module_name os.environ[ENVIRONMENT_VARIABLE] = settings_module_name
def get_default_settings_context(user_data_dir: str=None) -> Dict[str, str]: def get_default_settings_context(user_data_dir: str = None) -> Dict[str, str]:
""" """
Returns the default context values for the settings template: Returns the default context values for the settings template:
'openslides_user_data_path', 'import_function' and 'debug'. 'openslides_user_data_path', 'import_function' and 'debug'.
@ -227,7 +227,7 @@ def get_win32_portable_user_data_dir() -> str:
return os.path.join(get_win32_portable_dir(), 'openslides') return os.path.join(get_win32_portable_dir(), 'openslides')
def write_settings(settings_dir: str=None, settings_filename: str='settings.py', template: str=None, **context: str) -> str: def write_settings(settings_dir: str = None, settings_filename: str = 'settings.py', template: str = None, **context: str) -> str:
""" """
Creates the settings file at the given dir using the given values for the Creates the settings file at the given dir using the given values for the
file template. file template.

View File

@ -12,7 +12,7 @@ class MinMaxIntegerField(models.IntegerField):
IntegerField with options to set a min- and a max-value. IntegerField with options to set a min- and a max-value.
""" """
def __init__(self, min_value: int=None, max_value: int=None, *args: Any, **kwargs: Any) -> None: def __init__(self, min_value: int = None, max_value: int = None, *args: Any, **kwargs: Any) -> None:
self.min_value, self.max_value = min_value, max_value self.min_value, self.max_value = min_value, max_value
super(MinMaxIntegerField, self).__init__(*args, **kwargs) super(MinMaxIntegerField, self).__init__(*args, **kwargs)
@ -67,7 +67,7 @@ class RESTModelMixin:
""" """
return self.pk # type: ignore return self.pk # type: ignore
def save(self, skip_autoupdate: bool=False, information: Dict[str, str]=None, *args: Any, **kwargs: Any) -> Any: def save(self, skip_autoupdate: bool = False, information: Dict[str, str] = None, *args: Any, **kwargs: Any) -> Any:
""" """
Calls Django's save() method and afterwards hits the autoupdate system. Calls Django's save() method and afterwards hits the autoupdate system.
@ -88,7 +88,7 @@ class RESTModelMixin:
inform_changed_data(self.get_root_rest_element(), information=information) inform_changed_data(self.get_root_rest_element(), information=information)
return return_value return return_value
def delete(self, skip_autoupdate: bool=False, information: Dict[str, str]=None, *args: Any, **kwargs: Any) -> Any: def delete(self, skip_autoupdate: bool = False, information: Dict[str, str] = None, *args: Any, **kwargs: Any) -> Any:
""" """
Calls Django's delete() method and afterwards hits the autoupdate system. Calls Django's delete() method and afterwards hits the autoupdate system.

View File

@ -3,7 +3,9 @@
# Requirements for development and tests in alphabetical order # Requirements for development and tests in alphabetical order
coverage coverage
flake8 #flake8
# Use master of flake8 until flake8 3.6 is released that supports python3.7
git+https://gitlab.com/pycqa/flake8.git
isort==4.2.5 isort==4.2.5
mypy mypy
fakeredis fakeredis

View File

@ -2,9 +2,9 @@
bleach>=1.5.0,<2.2 bleach>=1.5.0,<2.2
channels>=1.1,<1.2 channels>=1.1,<1.2
daphne<2 daphne<2
Django>=1.10.4,<2.1 Django>=1.10.4,<2.2
djangorestframework>=3.4,<3.9 djangorestframework>=3.4,<3.9
jsonfield>=1.0,<2.1 jsonfield2>=3.0,<3.1
mypy_extensions>=0.3,<0.4 mypy_extensions>=0.3,<0.4
PyPDF2>=1.26,<1.27 PyPDF2>=1.26,<1.27
roman>=2.0,<3.1 roman>=2.0,<3.1

View File

@ -28,13 +28,14 @@ setup(
# http://pypi.python.org/pypi?%3Aaction=list_classifiers # http://pypi.python.org/pypi?%3Aaction=list_classifiers
# 'Development Status :: 3 - Alpha', # 'Development Status :: 3 - Alpha',
'Development Status :: 4 - Beta', 'Development Status :: 4 - Beta',
#'Development Status :: 5 - Production/Stable', # 'Development Status :: 5 - Production/Stable',
'Environment :: Web Environment', 'Environment :: Web Environment',
'Framework :: Django', 'Framework :: Django',
'License :: OSI Approved :: MIT License', 'License :: OSI Approved :: MIT License',
'Operating System :: OS Independent', 'Operating System :: OS Independent',
'Programming Language :: Python :: 3.5', 'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6', ], 'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7', ],
packages=find_packages(exclude=['tests', 'tests.*']), packages=find_packages(exclude=['tests', 'tests.*']),
include_package_data=True, include_package_data=True,
install_requires=install_requires, install_requires=install_requires,