Skip to content

Commit 89fc389

Browse files
committed
darker
1 parent 308c60e commit 89fc389

File tree

7 files changed

+78
-62
lines changed

7 files changed

+78
-62
lines changed

readthedocs/api/v2/serializers.py

+21-21
Original file line numberDiff line numberDiff line change
@@ -73,27 +73,27 @@ def get_skip(self, obj):
7373

7474
class Meta(ProjectSerializer.Meta):
7575
fields = ProjectSerializer.Meta.fields + (
76-
'enable_epub_build',
77-
'enable_pdf_build',
78-
'conf_py_file',
79-
'analytics_code',
80-
'analytics_disabled',
81-
'cdn_enabled',
82-
'container_image',
83-
'container_mem_limit',
84-
'container_time_limit',
85-
'install_project',
86-
'use_system_packages',
87-
'skip',
88-
'requirements_file',
89-
'python_interpreter',
90-
'features',
91-
'has_valid_clone',
92-
'has_valid_webhook',
93-
'show_advertising',
94-
'environment_variables',
95-
'max_concurrent_builds',
96-
'rtd_conf_file',
76+
"enable_epub_build",
77+
"enable_pdf_build",
78+
"conf_py_file",
79+
"analytics_code",
80+
"analytics_disabled",
81+
"cdn_enabled",
82+
"container_image",
83+
"container_mem_limit",
84+
"container_time_limit",
85+
"install_project",
86+
"use_system_packages",
87+
"skip",
88+
"requirements_file",
89+
"python_interpreter",
90+
"features",
91+
"has_valid_clone",
92+
"has_valid_webhook",
93+
"show_advertising",
94+
"environment_variables",
95+
"max_concurrent_builds",
96+
"rtd_conf_file",
9797
)
9898

9999

readthedocs/config/config.py

+4-2
Original file line numberDiff line numberDiff line change
@@ -1377,12 +1377,14 @@ def load(path, env_config, config_file=None):
13771377
the version of the configuration a build object would be load and validated,
13781378
``BuildConfigV1`` is the default.
13791379
"""
1380-
if config_file is None or config_file == '':
1380+
if config_file is None or config_file == "":
13811381
filename = find_one(path, CONFIG_FILENAME_REGEX)
13821382
else:
13831383
filename = os.path.join(path, config_file)
13841384
if not os.path.exists(filename):
1385-
raise ConfigError(f".readthedocs.yml not found at {config_file}", CONFIG_FILE_REQUIRED)
1385+
raise ConfigError(
1386+
f".readthedocs.yml not found at {config_file}", CONFIG_FILE_REQUIRED
1387+
)
13861388

13871389
if not filename:
13881390
raise ConfigFileNotFound(path)

readthedocs/projects/forms.py

+14-14
Original file line numberDiff line numberDiff line change
@@ -198,16 +198,16 @@ class ProjectAdvancedForm(ProjectTriggerBuildMixin, ProjectForm):
198198
class Meta:
199199
model = Project
200200
per_project_settings = (
201-
'default_version',
202-
'default_branch',
203-
'privacy_level',
204-
'analytics_code',
205-
'analytics_disabled',
206-
'show_version_warning',
207-
'single_version',
208-
'external_builds_enabled',
209-
'external_builds_privacy_level',
210-
'rtd_conf_file',
201+
"default_version",
202+
"default_branch",
203+
"privacy_level",
204+
"analytics_code",
205+
"analytics_disabled",
206+
"show_version_warning",
207+
"single_version",
208+
"external_builds_enabled",
209+
"external_builds_privacy_level",
210+
"rtd_conf_file",
211211
)
212212
# These that can be set per-version using a config file.
213213
per_version_settings = (
@@ -359,12 +359,12 @@ def clean_conf_py_file(self):
359359
return filename
360360

361361
def clean_rtd_conf_file(self):
362-
filename = self.cleaned_data.get('rtd_conf_file', '').strip()
363-
if filename and '.readthedocs.yml' not in filename:
362+
filename = self.cleaned_data.get("rtd_conf_file", "").strip()
363+
if filename and ".readthedocs.yml" not in filename:
364364
raise forms.ValidationError(
365365
_(
366-
'Your configuration file is invalid, make sure it contains '
367-
'.readthedocs.yml in it.',
366+
"Your configuration file is invalid, make sure it contains "
367+
".readthedocs.yml in it.",
368368
),
369369
) # yapf: disable
370370
return filename

readthedocs/projects/migrations/0096_auto_20230207_1642.py

+19-7
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,30 @@
66
class Migration(migrations.Migration):
77

88
dependencies = [
9-
('projects', '0095_default_branch_helptext'),
9+
("projects", "0095_default_branch_helptext"),
1010
]
1111

1212
operations = [
1313
migrations.AddField(
14-
model_name='historicalproject',
15-
name='rtd_conf_file',
16-
field=models.CharField(blank=True, default='', help_text='Path from project root to <code>.readthedocs.yml</code> file (ex. <code>docs/.readthedocs.yml</code>). Leave blank if you want us to find it for you.', max_length=255, verbose_name='.readthedocs.yml configuration file'),
14+
model_name="historicalproject",
15+
name="rtd_conf_file",
16+
field=models.CharField(
17+
blank=True,
18+
default="",
19+
help_text="Path from project root to <code>.readthedocs.yml</code> file (ex. <code>docs/.readthedocs.yml</code>). Leave blank if you want us to find it for you.",
20+
max_length=255,
21+
verbose_name=".readthedocs.yml configuration file",
22+
),
1723
),
1824
migrations.AddField(
19-
model_name='project',
20-
name='rtd_conf_file',
21-
field=models.CharField(blank=True, default='', help_text='Path from project root to <code>.readthedocs.yml</code> file (ex. <code>docs/.readthedocs.yml</code>). Leave blank if you want us to find it for you.', max_length=255, verbose_name='.readthedocs.yml configuration file'),
25+
model_name="project",
26+
name="rtd_conf_file",
27+
field=models.CharField(
28+
blank=True,
29+
default="",
30+
help_text="Path from project root to <code>.readthedocs.yml</code> file (ex. <code>docs/.readthedocs.yml</code>). Leave blank if you want us to find it for you.",
31+
max_length=255,
32+
verbose_name=".readthedocs.yml configuration file",
33+
),
2234
),
2335
]

readthedocs/projects/models.py

+8-8
Original file line numberDiff line numberDiff line change
@@ -352,20 +352,20 @@ class Project(models.Model):
352352
default='',
353353
blank=True,
354354
help_text=_(
355-
'Path from project root to <code>conf.py</code> file '
356-
'(ex. <code>docs/conf.py</code>). '
357-
'Leave blank if you want us to find it for you.',
355+
"Path from project root to <code>conf.py</code> file "
356+
"(ex. <code>docs/conf.py</code>). "
357+
"Leave blank if you want us to find it for you.",
358358
),
359359
)
360360
rtd_conf_file = models.CharField(
361-
_('.readthedocs.yml configuration file'),
361+
_(".readthedocs.yml configuration file"),
362362
max_length=255,
363-
default='',
363+
default="",
364364
blank=True,
365365
help_text=_(
366-
'Path from project root to <code>.readthedocs.yml</code> file '
367-
'(ex. <code>docs/.readthedocs.yml</code>). '
368-
'Leave blank if you want us to find it for you.',
366+
"Path from project root to <code>.readthedocs.yml</code> file "
367+
"(ex. <code>docs/.readthedocs.yml</code>). "
368+
"Leave blank if you want us to find it for you.",
369369
),
370370
)
371371

readthedocs/rtd_tests/tests/test_api.py

+9-7
Original file line numberDiff line numberDiff line change
@@ -686,22 +686,24 @@ class APITests(TestCase):
686686
def test_user_doesnt_get_full_api_return(self):
687687
user_normal = get(User, is_staff=False)
688688
user_admin = get(User, is_staff=True)
689-
project = get(Project, main_language_project=None, conf_py_file='foo', rtd_conf_file='bar')
689+
project = get(
690+
Project, main_language_project=None, conf_py_file="foo", rtd_conf_file="bar"
691+
)
690692
client = APIClient()
691693

692694
client.force_authenticate(user=user_normal)
693695
resp = client.get('/api/v2/project/%s/' % (project.pk))
694696
self.assertEqual(resp.status_code, 200)
695-
self.assertNotIn('conf_py_file', resp.data)
696-
self.assertNotIn('rtd_conf_file', resp.data)
697+
self.assertNotIn("conf_py_file", resp.data)
698+
self.assertNotIn("rtd_conf_file", resp.data)
697699

698700
client.force_authenticate(user=user_admin)
699701
resp = client.get('/api/v2/project/%s/' % (project.pk))
700702
self.assertEqual(resp.status_code, 200)
701-
self.assertIn('conf_py_file', resp.data)
702-
self.assertEqual(resp.data['conf_py_file'], 'foo')
703-
self.assertIn('rtd_conf_file', resp.data)
704-
self.assertEqual(resp.data['rtd_conf_file'], 'bar')
703+
self.assertIn("conf_py_file", resp.data)
704+
self.assertEqual(resp.data["conf_py_file"], "foo")
705+
self.assertIn("rtd_conf_file", resp.data)
706+
self.assertEqual(resp.data["rtd_conf_file"], "bar")
705707

706708
def test_project_features(self):
707709
user = get(User, is_staff=True)

readthedocs/rtd_tests/tests/test_config_integration.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -97,9 +97,9 @@ def test_python_supported_versions_default_image_1_0(self, load_config):
9797
expected_env_config.update(img_settings)
9898

9999
load_config.assert_called_once_with(
100-
path=mock.ANY,
101-
env_config=expected_env_config,
102-
config_file='',
100+
path=mock.ANY,
101+
env_config=expected_env_config,
102+
config_file="",
103103
)
104104
self.assertEqual(config.python.version, '3')
105105

0 commit comments

Comments
 (0)