mirror of
				https://github.com/SectorLabs/django-localized-fields.git
				synced 2025-10-26 00:48:57 +03:00 
			
		
		
		
	Fix some flake8/pycodestyle issues
This commit is contained in:
		| @@ -55,7 +55,7 @@ class LocalizedFieldForm(forms.MultiValueField): | ||||
|         for field, widget in zip(self.fields, self.widget.widgets): | ||||
|             widget.is_required = field.required | ||||
|  | ||||
|     def compress(self, value: List[str]) -> value_class: | ||||
|     def compress(self, value: List[str]) -> LocalizedValue: | ||||
|         """Compresses the values from individual fields into a single | ||||
|         :see:LocalizedValue instance. | ||||
|  | ||||
| @@ -123,13 +123,8 @@ class LocalizedFileFieldForm(LocalizedFieldForm, forms.FileField): | ||||
|         clean_data = [] | ||||
|         errors = [] | ||||
|         if not value or isinstance(value, (list, tuple)): | ||||
|             if ( | ||||
|                 not value | ||||
|                 or not [v for v in value if v not in self.empty_values] | ||||
|             ) and ( | ||||
|                 not initial | ||||
|                 or not [v for v in initial if v not in self.empty_values] | ||||
|             ): | ||||
|             is_empty = [v for v in value if v not in self.empty_values] | ||||
|             if (not value or not is_empty) and (not initial or not is_empty): | ||||
|                 if self.required: | ||||
|                     raise ValidationError( | ||||
|                         self.error_messages["required"], code="required" | ||||
| @@ -143,6 +138,7 @@ class LocalizedFileFieldForm(LocalizedFieldForm, forms.FileField): | ||||
|                 field_value = value[i] | ||||
|             except IndexError: | ||||
|                 field_value = None | ||||
|  | ||||
|             try: | ||||
|                 field_initial = initial[i] | ||||
|             except IndexError: | ||||
|   | ||||
| @@ -3,7 +3,6 @@ | ||||
| # Analysis | ||||
| black==19.3b0 | ||||
| flake8==3.7.7 | ||||
| pycodestyle==2.5.0 | ||||
| autoflake==1.3 | ||||
| autopep8==1.4.4 | ||||
| isort==4.3.20 | ||||
|   | ||||
| @@ -1,11 +1,7 @@ | ||||
| [flake8] | ||||
| ignore = E252,E501 | ||||
| ignore = E252,E501,W503 | ||||
| exclude = env,.tox,.git,config/settings,*/migrations/*,*/static/CACHE/*,docs,node_modules | ||||
|  | ||||
| [pycodestyle] | ||||
| ignore = E501 | ||||
| exclude=env,.tox,.git,*/migrations/*,*/static/CACHE/*,docs,node_modules | ||||
|  | ||||
| [isort] | ||||
| line_length=80 | ||||
| multi_line_output=3 | ||||
|   | ||||
							
								
								
									
										7
									
								
								setup.py
									
									
									
									
									
								
							
							
						
						
									
										7
									
								
								setup.py
									
									
									
									
									
								
							| @@ -62,10 +62,7 @@ setup( | ||||
|     cmdclass={ | ||||
|         "lint": create_command( | ||||
|             "Lints the code", | ||||
|             [ | ||||
|                 ["flake8", "setup.py", "localized_fields", "tests"], | ||||
|                 ["pycodestyle", "setup.py", "localized_fields", "tests"], | ||||
|             ], | ||||
|             [["flake8", "setup.py", "localized_fields", "tests"]], | ||||
|         ), | ||||
|         "lint_fix": create_command( | ||||
|             "Lints the code", | ||||
| @@ -131,13 +128,11 @@ setup( | ||||
|         ), | ||||
|         "verify": create_command( | ||||
|             "Verifies whether the code is auto-formatted and has no linting errors", | ||||
|             [ | ||||
|             [ | ||||
|                 ["python", "setup.py", "format_verify"], | ||||
|                 ["python", "setup.py", "format_docstrings_verify"], | ||||
|                 ["python", "setup.py", "sort_imports_verify"], | ||||
|                 ["python", "setup.py", "lint"], | ||||
|                 ] | ||||
|             ], | ||||
|         ), | ||||
|         "test": create_command( | ||||
|   | ||||
| @@ -82,4 +82,4 @@ class LocalizedFieldWidgetTestCase(TestCase): | ||||
|  | ||||
|         widget = LocalizedFieldWidget() | ||||
|         output = widget.render(name="title", value=None) | ||||
|         assert bool(re.search("<label (.|\n|\t)*>\w+<\/label>", output)) | ||||
|         assert bool(re.search(r"<label (.|\n|\t)*>\w+<\/label>", output)) | ||||
|   | ||||
		Reference in New Issue
	
	Block a user