Skip to content

Commit 8991cf5

Browse files
committed
Changes to be compatible with Python 3.4.
1 parent 2ee3a0f commit 8991cf5

File tree

4 files changed

+8
-8
lines changed

4 files changed

+8
-8
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,3 +138,4 @@ dmypy.json
138138
.pytype/
139139

140140
examples/
141+
deploy*.sh

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,14 @@ way, described below:
1010

1111
## Installation
1212

13-
Python 3.2 or later is needed to run this program. The simplest form
13+
Python 3.4 or later is needed to run this program. The simplest form
1414
of installation would be copying `nginxfmt.py` to your scripts directory.
1515

1616
You can also clone the repository and symlink the executable:
1717

1818
```
1919
cd
20-
git clone https://github.com/1connect/nginx-config-formatter.git
20+
git clone https://github.com/slomkowski/nginx-config-formatter.git
2121
ln -s ~/nginx-config-formatter/nginxfmt.py ~/bin/nginxfmt.py
2222
```
2323

@@ -50,4 +50,4 @@ Be sure to add config snippets to reproduce the issue, preferably:
5050

5151
## Credits
5252

53-
Copyright 2016 Michał Słomkowski @ 1CONNECT. License: Apache 2.0.
53+
Copyright 2021 Michał Słomkowski. License: Apache 2.0.

nginxfmt.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
import argparse
1111
import codecs
1212
import contextlib
13-
import dataclasses
1413
import logging
1514
import pathlib
1615
import re
@@ -21,10 +20,9 @@
2120
__version__ = "1.2.0-SNAPSHOT"
2221

2322

24-
@dataclasses.dataclass
2523
class FormatterOptions:
2624
"""Class holds the formatting options. For now, only indentation supported."""
27-
indentation: int = 4
25+
indentation = 4
2826

2927

3028
class Formatter:
@@ -180,7 +178,7 @@ def _strip_variable_template_tags(self, line: str) -> str:
180178
line,
181179
flags=re.UNICODE)
182180

183-
def _apply_bracket_template_tags(self, lines: list[str]) -> list[str]:
181+
def _apply_bracket_template_tags(self, lines):
184182
""" Replaces bracket { and } with tags, so subsequent formatting is easier."""
185183
formatted_lines = []
186184

test_nginxfmt.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -353,7 +353,8 @@ def test_issue_9(self):
353353
)
354354

355355
def test_custom_indentation(self):
356-
fo = nginxfmt.FormatterOptions(indentation=2)
356+
fo = nginxfmt.FormatterOptions()
357+
fo.indentation = 2
357358
fmt2 = nginxfmt.Formatter(fo)
358359
self.assertMultiLineEqual("{\n"
359360
" foo bar;\n"

0 commit comments

Comments
 (0)