Skip to content

Commit

Permalink
sagemathgh-39339: fixing most of ruff-minimal outside of src/sage
Browse files Browse the repository at this point in the history
    
This is fixing a few minor warnings (activated in our ruff-minimal)
outside of `src/sage`

### 📝 Checklist

- [ ] The title is concise and informative.
- [ ] The description explains in detail what this PR is about.
    
URL: sagemath#39339
Reported by: Frédéric Chapoton
Reviewer(s): Kwankyu Lee
  • Loading branch information
Release Manager committed Jan 22, 2025
2 parents d72d457 + a30ceba commit c3721d7
Show file tree
Hide file tree
Showing 10 changed files with 17 additions and 16 deletions.
3 changes: 2 additions & 1 deletion build/sage_bootstrap/download/mirror_list.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,8 @@ def _rank_mirrors(self):
This method is used by the YUM fastestmirror plugin
"""
timed_mirrors = []
import time, socket
import time
import socket
log.info('Searching fastest mirror')
timeout = 1
for mirror in self.mirrors:
Expand Down
4 changes: 2 additions & 2 deletions pkgs/sage-conf_conda/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def run(self):
print("Warning: A configuration has been written, but the configure script has exited with an error. "
"Carefully check any messages above before continuing.")
else:
print(f"Error: The configure script has failed; this may be caused by missing build prerequisites.")
print("Error: The configure script has failed; this may be caused by missing build prerequisites.")
sys.stdout.flush()
PREREQ_SPKG = "_prereq bzip2 xz libffi" # includes python3 SPKG_DEPCHECK packages
os.system(f'cd {SAGE_ROOT} && export PACKAGES="$(build/bin/sage-get-system-packages conda {PREREQ_SPKG})" && [ -n "$PACKAGES" ] && echo "You can install the required build prerequisites using the following shell command" && echo "" && build/bin/sage-print-system-package-command conda --verbose --sudo install $PACKAGES && echo ""')
Expand Down Expand Up @@ -73,7 +73,7 @@ def _create_writable_sage_root(self):

def ignore(path, names):
# exclude all embedded src trees
if fnmatch.fnmatch(path, f'*/build/pkgs/*'):
if fnmatch.fnmatch(path, '*/build/pkgs/*'):
return ['src']
### ignore more stuff --- .tox etc.
return [name for name in names
Expand Down
4 changes: 2 additions & 2 deletions pkgs/sage-conf_pypi/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ def run(self):
print(f"Running {cmd}")
sys.stdout.flush()
if os.system(cmd) != 0:
print(f"configure failed; this may be caused by missing build prerequisites.")
print("configure failed; this may be caused by missing build prerequisites.")
sys.stdout.flush()
PREREQ_SPKG = "_prereq bzip2 xz libffi" # includes python3 SPKG_DEPCHECK packages
os.system(f'cd {SAGE_ROOT} && export SYSTEM=$(build/bin/sage-guess-package-system 2>/dev/null) && export PACKAGES="$(build/bin/sage-get-system-packages $SYSTEM {PREREQ_SPKG})" && [ -n "$PACKAGES" ] && echo "You can install the required build prerequisites using the following shell command" && echo "" && build/bin/sage-print-system-package-command $SYSTEM --verbose --sudo install $PACKAGES && echo ""')
Expand Down Expand Up @@ -95,7 +95,7 @@ def _create_writable_sage_root(self):

def ignore(path, names):
# exclude all embedded src trees
if fnmatch.fnmatch(path, f'*/build/pkgs/*'):
if fnmatch.fnmatch(path, '*/build/pkgs/*'):
return ['src']
### ignore more stuff --- .tox etc.
return [name for name in names
Expand Down
3 changes: 2 additions & 1 deletion pkgs/sage-sws2rst/sage_sws2rst/worksheet2rst.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,8 @@ def code_parser(text):
lines = ['::', '']
for s in text.splitlines():
l = s[6:] if s.startswith('sage: ') else s
if not l: continue
if not l:
continue
prefix = ' ....: ' if l[0] == ' ' else ' sage: '
lines.append(prefix + l)
return '\n'.join(lines)
Expand Down
4 changes: 2 additions & 2 deletions src/doc/el/a_tour_of_sage/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@

# Add small view/edit buttons.
html_theme_options.update({
'source_view_link': os.path.join(source_repository, f'blob/develop/src/doc/el/a_tour_of_sage', '{filename}'),
'source_edit_link': os.path.join(source_repository, f'edit/develop/src/doc/el/a_tour_of_sage', '{filename}'),
'source_view_link': os.path.join(source_repository, 'blob/develop/src/doc/el/a_tour_of_sage', '{filename}'),
'source_edit_link': os.path.join(source_repository, 'edit/develop/src/doc/el/a_tour_of_sage', '{filename}'),
})

# General information about the project.
Expand Down
4 changes: 2 additions & 2 deletions src/doc/en/a_tour_of_sage/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@

# Add small view/edit buttons.
html_theme_options.update({
'source_view_link': os.path.join(source_repository, f'blob/develop/src/doc/en/a_tour_of_sage', '{filename}'),
'source_edit_link': os.path.join(source_repository, f'edit/develop/src/doc/en/a_tour_of_sage', '{filename}'),
'source_view_link': os.path.join(source_repository, 'blob/develop/src/doc/en/a_tour_of_sage', '{filename}'),
'source_edit_link': os.path.join(source_repository, 'edit/develop/src/doc/en/a_tour_of_sage', '{filename}'),
})

# General information about the project.
Expand Down
4 changes: 2 additions & 2 deletions src/doc/tr/a_tour_of_sage/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@

# Add small view/edit buttons.
html_theme_options.update({
'source_view_link': os.path.join(source_repository, f'blob/develop/src/doc/tr/a_tour_of_sage', '{filename}'),
'source_edit_link': os.path.join(source_repository, f'edit/develop/src/doc/tr/a_tour_of_sage', '{filename}'),
'source_view_link': os.path.join(source_repository, 'blob/develop/src/doc/tr/a_tour_of_sage', '{filename}'),
'source_edit_link': os.path.join(source_repository, 'edit/develop/src/doc/tr/a_tour_of_sage', '{filename}'),
})

# General information about the project.
Expand Down
4 changes: 2 additions & 2 deletions src/sage_docbuild/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -712,8 +712,8 @@ def add_page_context(app, pagename, templatename, context, doctree):
# source files are generated.
suffix = '.py' if importlib.import_module(pagename.replace('/','.')).__file__.endswith('.py') else '.pyx'
context['page_source_suffix'] = suffix
context['theme_source_view_link'] = os.path.join(source_repository, f'blob/develop/src', '{filename}')
context['theme_source_edit_link'] = os.path.join(source_repository, f'edit/develop/src', '{filename}')
context['theme_source_view_link'] = os.path.join(source_repository, 'blob/develop/src', '{filename}')
context['theme_source_edit_link'] = os.path.join(source_repository, 'edit/develop/src', '{filename}')


dangling_debug = False
Expand Down
1 change: 0 additions & 1 deletion src/sage_setup/autogen/giacpy-mkkeywords.py

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@
python_packages = find_namespace_packages(where=SAGE_SRC, include=['sage', 'sage.*'])
log.debug(f"python_packages = {python_packages}")

log.info(f"Discovering Python/Cython source code... done")
log.info("Discovering Python/Cython source code... done")

# from sage_build_cython:
import Cython.Compiler.Options
Expand Down

0 comments on commit c3721d7

Please sign in to comment.