Compare commits

...

5 Commits

Author SHA1 Message Date
dependabot[bot]
73e13f5799 Bump github/codeql-action from 4.31.4 to 4.31.7
Bumps [github/codeql-action](https://github.com/github/codeql-action) from 4.31.4 to 4.31.7.
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](e12f017898...cf1bb45a27)

---
updated-dependencies:
- dependency-name: github/codeql-action
  dependency-version: 4.31.7
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-12-08 08:06:30 +00:00
Copybara-Service
5fa73e23be Merge pull request #1392 from cclauss:comprehensions
PiperOrigin-RevId: 836153778
2025-11-24 03:36:29 -08:00
Eugene Kliuchnikov
5db7aca571 Merge branch 'master' into comprehensions 2025-11-24 12:17:20 +01:00
Eugene Kliuchnikov
688d661f40 Merge branch 'master' into comprehensions 2025-11-24 11:55:20 +01:00
Christian Clauss
7ff6d1d286 Add ruff rule PERF for performance 2025-11-20 10:38:31 +01:00
6 changed files with 23 additions and 31 deletions

View File

@@ -44,7 +44,7 @@ jobs:
# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@e12f0178983d466f2f6028f5cc7a6d786fd97f4b # v3.29.5
uses: github/codeql-action/init@cf1bb45a277cb3c205638b2cd5c984db1c46a412 # v3.29.5
with:
languages: ${{ matrix.language }}
# CodeQL is currently crashing on files with large lists:
@@ -56,7 +56,7 @@ jobs:
- if: matrix.language == 'cpp'
name: Build CPP
uses: github/codeql-action/autobuild@e12f0178983d466f2f6028f5cc7a6d786fd97f4b # v3.29.5
uses: github/codeql-action/autobuild@cf1bb45a277cb3c205638b2cd5c984db1c46a412 # v3.29.5
- if: matrix.language == 'cpp' || matrix.language == 'java'
name: Build Java
@@ -66,7 +66,7 @@ jobs:
- if: matrix.language == 'javascript'
name: Build JS
uses: github/codeql-action/autobuild@e12f0178983d466f2f6028f5cc7a6d786fd97f4b # v3.29.5
uses: github/codeql-action/autobuild@cf1bb45a277cb3c205638b2cd5c984db1c46a412 # v3.29.5
- if: matrix.language == 'cpp' || matrix.language == 'python'
name: Build Python
@@ -74,7 +74,7 @@ jobs:
python setup.py build_ext
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@e12f0178983d466f2f6028f5cc7a6d786fd97f4b # v3.29.5
uses: github/codeql-action/analyze@cf1bb45a277cb3c205638b2cd5c984db1c46a412 # v3.29.5
with:
category: "/language:${{matrix.language}}"
ref: "${{ github.ref != 'master' && github.ref || '/refs/heads/master' }}"

View File

@@ -50,6 +50,6 @@ jobs:
- name: Lint Python code
run: |
eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"
ruff check
ruff check --extend-select=C4,C90,PERF,RET,SIM,W
# TODO(eustas): run buildifier

View File

@@ -77,6 +77,6 @@ jobs:
# Upload the results to GitHub's code scanning dashboard.
- name: "Upload to code-scanning"
uses: github/codeql-action/upload-sarif@e12f0178983d466f2f6028f5cc7a6d786fd97f4b # v2.23.3
uses: github/codeql-action/upload-sarif@cf1bb45a277cb3c205638b2cd5c984db1c46a412 # v2.23.3
with:
sarif_file: results.sarif

View File

@@ -18,13 +18,11 @@ for line in lines:
if appendix_a_found:
if re_data_line.match(line) is not None:
data = line.strip()
for i in range(32):
dictionary.append(int(data[2 * i:2 * i + 2], 16))
dictionary.extend(int(data[2 * i:2 * i + 2], 16) for i in range(32))
if len(dictionary) == 122784:
break
else:
if line.startswith("Appendix A."):
appendix_a_found = True
elif line.startswith("Appendix A."):
appendix_a_found = True
bin_path = "dictionary.bin"

View File

@@ -40,13 +40,12 @@ for b in data:
is_skip = False
hi.append(unichr(cntr))
cntr = skip_flip_offset + 1
elif value >= 0x80:
cntr += 1
else:
if value >= 0x80:
cntr += 1
else:
is_skip = True
hi.append(unichr(cntr))
cntr = skip_flip_offset + 1
is_skip = True
hi.append(unichr(cntr))
cntr = skip_flip_offset + 1
hi.append(unichr(cntr))
low0 = low[0:len(low) // 2]
@@ -56,15 +55,15 @@ low1 = low[len(low) // 2:len(low)]
def escape(chars):
result = []
for c in chars:
if "\r" == c:
if c == "\r":
result.append("\\r")
elif "\n" == c:
elif c == "\n":
result.append("\\n")
elif "\t" == c:
elif c == "\t":
result.append("\\t")
elif "\"" == c:
elif c == "\"":
result.append("\\\"")
elif "\\" == c:
elif c == "\\":
result.append("\\\\")
elif ord(c) < 32 or ord(c) >= 127:
result.append("\\u%04X" % ord(c))

View File

@@ -53,8 +53,7 @@ def get_version():
def get_test_suite():
test_loader = unittest.TestLoader()
test_suite = test_loader.discover("python", pattern="*_test.py")
return test_suite
return test_loader.discover("python", pattern="*_test.py")
class BuildExt(build_ext):
@@ -77,13 +76,9 @@ class BuildExt(build_ext):
if not (self.force or dep_util.newer_group(depends, ext_path, "newer")):
log.debug("skipping '%s' extension (up-to-date)", ext.name)
return
else:
log.info("building '%s' extension", ext.name)
log.info("building '%s' extension", ext.name)
c_sources = []
for source in ext.sources:
if source.endswith(".c"):
c_sources.append(source)
c_sources = [source for source in ext.sources if source.endswith(".c")]
extra_args = ext.extra_compile_args or []
objects = []
@@ -184,7 +179,7 @@ USE_SYSTEM_BROTLI = bool_from_environ("USE_SYSTEM_BROTLI")
if USE_SYSTEM_BROTLI:
import pkgconfig
REQUIRED_BROTLI_SYSTEM_LIBRARIES = ["libbrotlicommon", "libbrotlienc", "libbrotlidec"]
define_macros = []