The following issues were found
Lib/xml/dom/domreg.py
11 issues
Line: 75
Column: 16
for creator in well_known_implementations.keys():
try:
dom = getDOMImplementation(name = creator)
except Exception: # typically ImportError, or AttributeError
continue
if _good_enough(dom, features):
return dom
raise ImportError("no suitable DOM implementation found")
Reported by Pylint.
Line: 21
Column: 1
registered = {}
def registerDOMImplementation(name, factory):
"""registerDOMImplementation(name, factory)
Register the factory function with the name. The factory function
should return an object which implements the DOMImplementation
interface. The factory function can either return the same object,
Reported by Pylint.
Line: 34
Column: 9
def _good_enough(dom, features):
"_good_enough(dom, features) -> Return 1 if the dom offers the features"
for f,v in features:
if not dom.hasFeature(f,v):
return 0
return 1
def getDOMImplementation(name=None, features=()):
Reported by Pylint.
Line: 34
Column: 11
def _good_enough(dom, features):
"_good_enough(dom, features) -> Return 1 if the dom offers the features"
for f,v in features:
if not dom.hasFeature(f,v):
return 0
return 1
def getDOMImplementation(name=None, features=()):
Reported by Pylint.
Line: 39
Column: 1
return 0
return 1
def getDOMImplementation(name=None, features=()):
"""getDOMImplementation(name = None, features = ()) -> DOM implementation.
Return a suitable DOM implementation. The name is either
well-known, the module name of a DOM implementation, or None. If
it is not None, imports the corresponding module and returns
Reported by Pylint.
Line: 52
Column: 5
be found, raise an ImportError. The features list must be a sequence
of (feature, version) pairs which are passed to hasFeature."""
import os
creator = None
mod = well_known_implementations.get(name)
if mod:
mod = __import__(mod, {}, {}, ['getDOMImplementation'])
return mod.getDOMImplementation()
Reported by Pylint.
Line: 55
Column: 5
import os
creator = None
mod = well_known_implementations.get(name)
if mod:
mod = __import__(mod, {}, {}, ['getDOMImplementation'])
return mod.getDOMImplementation()
elif name:
return registered[name]()
elif not sys.flags.ignore_environment and "PYTHON_DOM" in os.environ:
Reported by Pylint.
Line: 72
Column: 20
if _good_enough(dom, features):
return dom
for creator in well_known_implementations.keys():
try:
dom = getDOMImplementation(name = creator)
except Exception: # typically ImportError, or AttributeError
continue
if _good_enough(dom, features):
Reported by Pylint.
Line: 75
Suggestion:
https://bandit.readthedocs.io/en/latest/plugins/b112_try_except_continue.html
for creator in well_known_implementations.keys():
try:
dom = getDOMImplementation(name = creator)
except Exception: # typically ImportError, or AttributeError
continue
if _good_enough(dom, features):
return dom
raise ImportError("no suitable DOM implementation found")
Reported by Bandit.
Line: 82
Column: 1
raise ImportError("no suitable DOM implementation found")
def _parse_feature_string(s):
features = []
parts = s.split()
i = 0
length = len(parts)
while i < length:
Reported by Pylint.
Modules/ossaudiodev.c
11 issues
Line: 112
Column: 21
CWE codes:
807
20
Suggestion:
Check environment variables carefully before using them
/* Open the correct device: either the 'device' argument,
or the AUDIODEV environment variable, or "/dev/dsp". */
if (devicename == NULL) { /* called with one arg */
devicename = getenv("AUDIODEV");
if (devicename == NULL) /* $AUDIODEV not set */
devicename = "/dev/dsp";
}
/* Open with O_NONBLOCK to avoid hanging on devices that only allow
Reported by FlawFinder.
Line: 177
Column: 22
CWE codes:
807
20
Suggestion:
Check environment variables carefully before using them
}
if (devicename == NULL) {
devicename = getenv("MIXERDEV");
if (devicename == NULL) /* MIXERDEV not set */
devicename = "/dev/mixer";
}
fd = _Py_open(devicename, O_RDWR);
Reported by FlawFinder.
Line: 245
Column: 5
CWE codes:
119
120
Suggestion:
Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length
static PyObject *
_do_ioctl_1(int fd, PyObject *args, char *fname, unsigned long cmd)
{
char argfmt[33] = "i:";
int arg;
assert(strlen(fname) <= 30);
strncat(argfmt, fname, 30);
if (!PyArg_ParseTuple(args, argfmt, &arg))
Reported by FlawFinder.
Line: 270
Column: 5
CWE codes:
119
120
Suggestion:
Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length
static PyObject *
_do_ioctl_1_internal(int fd, PyObject *args, char *fname, unsigned long cmd)
{
char argfmt[32] = ":";
int arg = 0;
assert(strlen(fname) <= 30);
strncat(argfmt, fname, 30);
if (!PyArg_ParseTuple(args, argfmt, &arg))
Reported by FlawFinder.
Line: 290
Column: 5
CWE codes:
119
120
Suggestion:
Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length
static PyObject *
_do_ioctl_0(int fd, PyObject *args, char *fname, unsigned long cmd)
{
char argfmt[32] = ":";
int rv;
assert(strlen(fname) <= 30);
strncat(argfmt, fname, 30);
if (!PyArg_ParseTuple(args, argfmt))
Reported by FlawFinder.
Line: 248
Column: 12
CWE codes:
126
char argfmt[33] = "i:";
int arg;
assert(strlen(fname) <= 30);
strncat(argfmt, fname, 30);
if (!PyArg_ParseTuple(args, argfmt, &arg))
return NULL;
if (ioctl(fd, cmd, &arg) == -1)
Reported by FlawFinder.
Line: 249
Column: 5
CWE codes:
120
Suggestion:
Consider strcat_s, strlcat, snprintf, or automatically resizing strings
int arg;
assert(strlen(fname) <= 30);
strncat(argfmt, fname, 30);
if (!PyArg_ParseTuple(args, argfmt, &arg))
return NULL;
if (ioctl(fd, cmd, &arg) == -1)
return PyErr_SetFromErrno(PyExc_OSError);
Reported by FlawFinder.
Line: 273
Column: 12
CWE codes:
126
char argfmt[32] = ":";
int arg = 0;
assert(strlen(fname) <= 30);
strncat(argfmt, fname, 30);
if (!PyArg_ParseTuple(args, argfmt, &arg))
return NULL;
if (ioctl(fd, cmd, &arg) == -1)
Reported by FlawFinder.
Line: 274
Column: 5
CWE codes:
120
Suggestion:
Consider strcat_s, strlcat, snprintf, or automatically resizing strings
int arg = 0;
assert(strlen(fname) <= 30);
strncat(argfmt, fname, 30);
if (!PyArg_ParseTuple(args, argfmt, &arg))
return NULL;
if (ioctl(fd, cmd, &arg) == -1)
return PyErr_SetFromErrno(PyExc_OSError);
Reported by FlawFinder.
Line: 293
Column: 12
CWE codes:
126
char argfmt[32] = ":";
int rv;
assert(strlen(fname) <= 30);
strncat(argfmt, fname, 30);
if (!PyArg_ParseTuple(args, argfmt))
return NULL;
/* According to hannu@opensound.com, all three of the ioctls that
Reported by FlawFinder.
Tools/scripts/gprof2html.py
11 issues
Line: 31
Column: 16
for line in fp:
yield html.escape(line)
def gprof2html(input, output, filename):
output.write(header % filename)
for line in input:
output.write(line)
if line.startswith(" time"):
break
Reported by Pylint.
Line: 81
Column: 5
if sys.argv[1:]:
filename = sys.argv[1]
outputfilename = filename + ".html"
input = add_escapes(filename)
with open(outputfilename, "w") as output:
gprof2html(input, output, filename)
webbrowser.open("file:" + os.path.abspath(outputfilename))
if __name__ == '__main__':
Reported by Pylint.
Line: 11
Column: 1
import sys
import webbrowser
header = """\
<html>
<head>
<title>gprof output (%s)</title>
</head>
<body>
Reported by Pylint.
Line: 20
Column: 1
<pre>
"""
trailer = """\
</pre>
</body>
</html>
"""
Reported by Pylint.
Line: 26
Column: 1
</html>
"""
def add_escapes(filename):
with open(filename) as fp:
for line in fp:
yield html.escape(line)
def gprof2html(input, output, filename):
Reported by Pylint.
Line: 27
Column: 28
"""
def add_escapes(filename):
with open(filename) as fp:
for line in fp:
yield html.escape(line)
def gprof2html(input, output, filename):
output.write(header % filename)
Reported by Pylint.
Line: 31
Column: 1
for line in fp:
yield html.escape(line)
def gprof2html(input, output, filename):
output.write(header % filename)
for line in input:
output.write(line)
if line.startswith(" time"):
break
Reported by Pylint.
Line: 31
Column: 1
for line in fp:
yield html.escape(line)
def gprof2html(input, output, filename):
output.write(header % filename)
for line in input:
output.write(line)
if line.startswith(" time"):
break
Reported by Pylint.
Line: 39
Column: 9
break
labels = {}
for line in input:
m = re.match(r"(.* )(\w+)\n", line)
if not m:
output.write(line)
break
stuff, fname = m.group(1, 2)
labels[fname] = fname
Reported by Pylint.
Line: 52
Column: 9
if line.startswith("index % time"):
break
for line in input:
m = re.match(r"(.* )(\w+)(( <cycle.*>)? \[\d+\])\n", line)
if not m:
output.write(line)
if line.startswith("Index by function name"):
break
continue
Reported by Pylint.
Tools/scripts/analyze_dxp.py
11 issues
Line: 35
Column: 23
_profile_lock = threading.RLock()
_cumulative_profile = sys.getdxp()
# If Python was built with -DDXPAIRS, sys.getdxp() returns a list of
# lists of ints. Otherwise it returns just a list of ints.
def has_pairs(profile):
"""Returns True if the Python that produced the argument profile
Reported by Pylint.
Line: 49
Column: 9
def reset_profile():
"""Forgets any execution profile that has been gathered so far."""
with _profile_lock:
sys.getdxp() # Resets the internal profile
global _cumulative_profile
_cumulative_profile = sys.getdxp() # 0s out our copy.
def merge_profile():
Reported by Pylint.
Line: 51
Column: 31
with _profile_lock:
sys.getdxp() # Resets the internal profile
global _cumulative_profile
_cumulative_profile = sys.getdxp() # 0s out our copy.
def merge_profile():
"""Reads sys.getdxp() and merges it into this module's cached copy.
Reported by Pylint.
Line: 60
Column: 23
We need this because sys.getdxp() 0s itself every time it's called."""
with _profile_lock:
new_profile = sys.getdxp()
if has_pairs(new_profile):
for first_inst in range(len(_cumulative_profile)):
for second_inst in range(len(_cumulative_profile[first_inst])):
_cumulative_profile[first_inst][second_inst] += (
new_profile[first_inst][second_inst])
Reported by Pylint.
Line: 50
Column: 9
"""Forgets any execution profile that has been gathered so far."""
with _profile_lock:
sys.getdxp() # Resets the internal profile
global _cumulative_profile
_cumulative_profile = sys.getdxp() # 0s out our copy.
def merge_profile():
"""Reads sys.getdxp() and merges it into this module's cached copy.
Reported by Pylint.
Line: 25
Column: 1
import copy
import opcode
import operator
import sys
import threading
if not hasattr(sys, "getdxp"):
raise RuntimeError("Can't import analyze_dxp: Python built without"
Reported by Pylint.
Line: 26
Column: 1
import copy
import opcode
import operator
import sys
import threading
if not hasattr(sys, "getdxp"):
raise RuntimeError("Can't import analyze_dxp: Python built without"
" -DDYNAMIC_EXECUTION_PROFILE.")
Reported by Pylint.
Line: 27
Column: 1
import opcode
import operator
import sys
import threading
if not hasattr(sys, "getdxp"):
raise RuntimeError("Can't import analyze_dxp: Python built without"
" -DDYNAMIC_EXECUTION_PROFILE.")
Reported by Pylint.
Line: 50
Column: 9
"""Forgets any execution profile that has been gathered so far."""
with _profile_lock:
sys.getdxp() # Resets the internal profile
global _cumulative_profile
_cumulative_profile = sys.getdxp() # 0s out our copy.
def merge_profile():
"""Reads sys.getdxp() and merges it into this module's cached copy.
Reported by Pylint.
Line: 62
Column: 13
with _profile_lock:
new_profile = sys.getdxp()
if has_pairs(new_profile):
for first_inst in range(len(_cumulative_profile)):
for second_inst in range(len(_cumulative_profile[first_inst])):
_cumulative_profile[first_inst][second_inst] += (
new_profile[first_inst][second_inst])
else:
for inst in range(len(_cumulative_profile)):
Reported by Pylint.
Tools/scripts/linktree.py
11 issues
Line: 68
Column: 17
try:
os.mkdir(newname, 0o777)
ok = 1
except:
print(newname + \
': warning: cannot mkdir:', msg)
ok = 0
if ok:
linkname = os.path.join(os.pardir,
Reported by Pylint.
Line: 1
Column: 1
#! /usr/bin/env python3
# linktree
#
# Make a copy of a directory tree with symbolic links to all files in the
# original tree.
# All symbolic links go to a special symbolic link at the top, so you
# can easily fix things if the original source tree moves.
# See also "mkreal".
Reported by Pylint.
Line: 13
Column: 1
#
# usage: mklinks oldtree newtree
import sys, os
LINK = '.LINK' # Name of special symlink at the top.
debug = 0
Reported by Pylint.
Line: 17
Column: 1
LINK = '.LINK' # Name of special symlink at the top.
debug = 0
def main():
if not 3 <= len(sys.argv) <= 4:
print('usage:', sys.argv[0], 'oldtree newtree [linkto]')
return 2
Reported by Pylint.
Line: 19
Column: 1
debug = 0
def main():
if not 3 <= len(sys.argv) <= 4:
print('usage:', sys.argv[0], 'oldtree newtree [linkto]')
return 2
oldtree, newtree = sys.argv[1], sys.argv[2]
if len(sys.argv) > 3:
Reported by Pylint.
Line: 42
Column: 9
try:
os.symlink(os.path.join(os.pardir, oldtree), linkname)
except OSError as msg:
if not link_may_fail:
print(linkname + ': cannot symlink:', msg)
return 1
else:
print(linkname + ': warning: cannot symlink:', msg)
linknames(oldtree, newtree, link)
Reported by Pylint.
Line: 50
Column: 1
linknames(oldtree, newtree, link)
return 0
def linknames(old, new, link):
if debug: print('linknames', (old, new, link))
try:
names = os.listdir(old)
except OSError as msg:
print(old + ': warning: cannot listdir:', msg)
Reported by Pylint.
Line: 51
Column: 15
return 0
def linknames(old, new, link):
if debug: print('linknames', (old, new, link))
try:
names = os.listdir(old)
except OSError as msg:
print(old + ': warning: cannot listdir:', msg)
return
Reported by Pylint.
Line: 62
Column: 27
oldname = os.path.join(old, name)
linkname = os.path.join(link, name)
newname = os.path.join(new, name)
if debug > 1: print(oldname, newname, linkname)
if os.path.isdir(oldname) and \
not os.path.islink(oldname):
try:
os.mkdir(newname, 0o777)
ok = 1
Reported by Pylint.
Line: 67
Column: 21
not os.path.islink(oldname):
try:
os.mkdir(newname, 0o777)
ok = 1
except:
print(newname + \
': warning: cannot mkdir:', msg)
ok = 0
if ok:
Reported by Pylint.
Tools/peg_generator/scripts/benchmark.py
11 issues
Line: 10
Column: 5
from time import time
try:
import memory_profiler
except ModuleNotFoundError:
print(
"Please run `make venv` to create a virtual environment and install"
" all the dependencies, before running this script."
)
Reported by Pylint.
Line: 76
Column: 9
def run_benchmark_stdlib(subcommand):
modes = {"compile": 2, "parse": 1}
for _ in range(3):
parse_directory(
"../../Lib",
verbose=False,
excluded_files=[
"*/bad*",
"*/lib2to3/tests/data/*",
Reported by Pylint.
Line: 1
Column: 1
#!/usr/bin/env python3
import argparse
import ast
import sys
import os
from time import time
try:
Reported by Pylint.
Line: 19
Column: 1
sys.exit(1)
sys.path.insert(0, os.getcwd())
from scripts.test_parse_directory import parse_directory
argparser = argparse.ArgumentParser(
prog="benchmark", description="Reproduce the various pegen benchmarks"
)
argparser.add_argument(
Reported by Pylint.
Line: 39
Column: 1
command_parse = subcommands.add_parser("parse", help="Benchmark parsing and generating an ast.AST")
def benchmark(func):
def wrapper(*args):
times = list()
for _ in range(3):
start = time()
result = func(*args)
Reported by Pylint.
Line: 57
Column: 1
@benchmark
def time_compile(source):
return compile(source, "<string>", "exec")
@benchmark
def time_parse(source):
Reported by Pylint.
Line: 62
Column: 1
@benchmark
def time_parse(source):
return ast.parse(source)
def run_benchmark_xxl(subcommand, source):
if subcommand == "compile":
Reported by Pylint.
Line: 66
Column: 1
return ast.parse(source)
def run_benchmark_xxl(subcommand, source):
if subcommand == "compile":
time_compile(source)
elif subcommand == "parse":
time_parse(source)
Reported by Pylint.
Line: 73
Column: 1
time_parse(source)
def run_benchmark_stdlib(subcommand):
modes = {"compile": 2, "parse": 1}
for _ in range(3):
parse_directory(
"../../Lib",
verbose=False,
Reported by Pylint.
Line: 88
Column: 1
)
def main():
args = argparser.parse_args()
subcommand = args.subcommand
target = args.target
if subcommand is None:
Reported by Pylint.
Tools/peg_generator/scripts/download_pypi_packages.py
11 issues
Line: 35
Suggestion:
https://bandit.readthedocs.io/en/latest/blacklists/blacklist_calls.html#b310-urllib-urlopen
def download_package_json(package_name: str) -> None:
url = f"https://pypi.org/pypi/{package_name}/json"
urlretrieve(url, os.path.join("data", f"{package_name}.json"))
def download_package_code(name: str, package_json: Dict[Any, Any]) -> None:
source_index = -1
for idx, url_info in enumerate(package_json["urls"]):
Reported by Bandit.
Line: 38
Column: 27
urlretrieve(url, os.path.join("data", f"{package_name}.json"))
def download_package_code(name: str, package_json: Dict[Any, Any]) -> None:
source_index = -1
for idx, url_info in enumerate(package_json["urls"]):
if url_info["python_version"] == "source":
source_index = idx
break
Reported by Pylint.
Line: 46
Suggestion:
https://bandit.readthedocs.io/en/latest/blacklists/blacklist_calls.html#b310-urllib-urlopen
break
filename = package_json["urls"][source_index]["filename"]
url = package_json["urls"][source_index]["url"]
urlretrieve(url, os.path.join("data", "pypi", filename))
def main() -> None:
args = argparser.parse_args()
number_packages = args.number
Reported by Bandit.
Line: 1
Column: 1
#!/usr/bin/env python3.8
import argparse
import os
import json
from typing import Dict, Any
from urllib.request import urlretrieve
Reported by Pylint.
Line: 22
Column: 1
)
def load_json(filename: str) -> Dict[Any, Any]:
with open(os.path.join("data", f"{filename}.json"), "r") as f:
j = json.loads(f.read())
return j
Reported by Pylint.
Line: 23
Column: 65
def load_json(filename: str) -> Dict[Any, Any]:
with open(os.path.join("data", f"{filename}.json"), "r") as f:
j = json.loads(f.read())
return j
def remove_json(filename: str) -> None:
Reported by Pylint.
Line: 28
Column: 1
return j
def remove_json(filename: str) -> None:
path = os.path.join("data", f"{filename}.json")
os.remove(path)
def download_package_json(package_name: str) -> None:
Reported by Pylint.
Line: 33
Column: 1
os.remove(path)
def download_package_json(package_name: str) -> None:
url = f"https://pypi.org/pypi/{package_name}/json"
urlretrieve(url, os.path.join("data", f"{package_name}.json"))
def download_package_code(name: str, package_json: Dict[Any, Any]) -> None:
Reported by Pylint.
Line: 38
Column: 1
urlretrieve(url, os.path.join("data", f"{package_name}.json"))
def download_package_code(name: str, package_json: Dict[Any, Any]) -> None:
source_index = -1
for idx, url_info in enumerate(package_json["urls"]):
if url_info["python_version"] == "source":
source_index = idx
break
Reported by Pylint.
Line: 49
Column: 1
urlretrieve(url, os.path.join("data", "pypi", filename))
def main() -> None:
args = argparser.parse_args()
number_packages = args.number
all_packages = args.all
top_pypi_packages = load_json("top-pypi-packages-365-days")
Reported by Pylint.
Lib/test/test_json/test_default.py
11 issues
Line: 6
Column: 9
class TestDefault:
def test_default(self):
self.assertEqual(
self.dumps(type, default=repr),
self.dumps(repr(type)))
class TestPyDefault(TestDefault, PyTest): pass
Reported by Pylint.
Line: 7
Column: 13
class TestDefault:
def test_default(self):
self.assertEqual(
self.dumps(type, default=repr),
self.dumps(repr(type)))
class TestPyDefault(TestDefault, PyTest): pass
class TestCDefault(TestDefault, CTest): pass
Reported by Pylint.
Line: 8
Column: 13
def test_default(self):
self.assertEqual(
self.dumps(type, default=repr),
self.dumps(repr(type)))
class TestPyDefault(TestDefault, PyTest): pass
class TestCDefault(TestDefault, CTest): pass
Reported by Pylint.
Line: 1
Column: 1
from test.test_json import PyTest, CTest
class TestDefault:
def test_default(self):
self.assertEqual(
self.dumps(type, default=repr),
self.dumps(repr(type)))
Reported by Pylint.
Line: 4
Column: 1
from test.test_json import PyTest, CTest
class TestDefault:
def test_default(self):
self.assertEqual(
self.dumps(type, default=repr),
self.dumps(repr(type)))
Reported by Pylint.
Line: 4
Column: 1
from test.test_json import PyTest, CTest
class TestDefault:
def test_default(self):
self.assertEqual(
self.dumps(type, default=repr),
self.dumps(repr(type)))
Reported by Pylint.
Line: 5
Column: 5
class TestDefault:
def test_default(self):
self.assertEqual(
self.dumps(type, default=repr),
self.dumps(repr(type)))
Reported by Pylint.
Line: 11
Column: 1
self.dumps(repr(type)))
class TestPyDefault(TestDefault, PyTest): pass
class TestCDefault(TestDefault, CTest): pass
Reported by Pylint.
Line: 11
Column: 43
self.dumps(repr(type)))
class TestPyDefault(TestDefault, PyTest): pass
class TestCDefault(TestDefault, CTest): pass
Reported by Pylint.
Line: 12
Column: 1
class TestPyDefault(TestDefault, PyTest): pass
class TestCDefault(TestDefault, CTest): pass
Reported by Pylint.
Lib/lzma.py
11 issues
Line: 27
Column: 1
import builtins
import io
import os
from _lzma import *
from _lzma import _encode_filter_properties, _decode_filter_properties
import _compression
_MODE_CLOSED = 0
Reported by Pylint.
Line: 28
Column: 1
import io
import os
from _lzma import *
from _lzma import _encode_filter_properties, _decode_filter_properties
import _compression
_MODE_CLOSED = 0
_MODE_READ = 1
Reported by Pylint.
Line: 28
Column: 1
import io
import os
from _lzma import *
from _lzma import _encode_filter_properties, _decode_filter_properties
import _compression
_MODE_CLOSED = 0
_MODE_READ = 1
Reported by Pylint.
Line: 49
Column: 5
is returned as bytes, and data to be written must be given as bytes.
"""
def __init__(self, filename=None, mode="r", *,
format=None, check=-1, preset=None, filters=None):
"""Open an LZMA-compressed file in binary mode.
filename can be either an actual file name (given as a str,
bytes, or PathLike object), in which case the named file is
Reported by Pylint.
Line: 50
Column: 18
"""
def __init__(self, filename=None, mode="r", *,
format=None, check=-1, preset=None, filters=None):
"""Open an LZMA-compressed file in binary mode.
filename can be either an actual file name (given as a str,
bytes, or PathLike object), in which case the named file is
opened, or it can be an existing file object to read from or
Reported by Pylint.
Line: 275
Column: 1
return self._pos
def open(filename, mode="rb", *,
format=None, check=-1, preset=None, filters=None,
encoding=None, errors=None, newline=None):
"""Open an LZMA-compressed file in binary or text mode.
filename can be either an actual file name (given as a str, bytes,
Reported by Pylint.
Line: 276
Column: 10
def open(filename, mode="rb", *,
format=None, check=-1, preset=None, filters=None,
encoding=None, errors=None, newline=None):
"""Open an LZMA-compressed file in binary or text mode.
filename can be either an actual file name (given as a str, bytes,
or PathLike object), in which case the named file is opened, or it
Reported by Pylint.
Line: 323
Column: 20
return binary_file
def compress(data, format=FORMAT_XZ, check=-1, preset=None, filters=None):
"""Compress a block of data.
Refer to LZMACompressor's docstring for a description of the
optional arguments *format*, *check*, *preset* and *filters*.
Reported by Pylint.
Line: 335
Column: 22
return comp.compress(data) + comp.flush()
def decompress(data, format=FORMAT_AUTO, memlimit=None, filters=None):
"""Decompress a block of data.
Refer to LZMADecompressor's docstring for a description of the
optional arguments *format*, *check* and *filters*.
Reported by Pylint.
Line: 316
Column: 5
binary_file = LZMAFile(filename, lz_mode, format=format, check=check,
preset=preset, filters=filters)
if "t" in mode:
encoding = io.text_encoding(encoding)
return io.TextIOWrapper(binary_file, encoding, errors, newline)
else:
return binary_file
Reported by Pylint.
Lib/test/badsyntax_future5.py
11 issues
Line: 3
Column: 1
"""This is a test"""
from __future__ import nested_scopes
import foo
from __future__ import nested_scopes
def f(x):
def g(y):
return x + y
Reported by Pylint.
Line: 3
Column: 1
"""This is a test"""
from __future__ import nested_scopes
import foo
from __future__ import nested_scopes
def f(x):
def g(y):
return x + y
Reported by Pylint.
Line: 4
Column: 1
"""This is a test"""
from __future__ import nested_scopes
import foo
from __future__ import nested_scopes
def f(x):
def g(y):
return x + y
Reported by Pylint.
Line: 4
Column: 1
"""This is a test"""
from __future__ import nested_scopes
import foo
from __future__ import nested_scopes
def f(x):
def g(y):
return x + y
Reported by Pylint.
Line: 4
Column: 1
"""This is a test"""
from __future__ import nested_scopes
import foo
from __future__ import nested_scopes
def f(x):
def g(y):
return x + y
Reported by Pylint.
Line: 7
Column: 1
from __future__ import nested_scopes
def f(x):
def g(y):
return x + y
return g
result = f(2)(4)
Reported by Pylint.
Line: 7
Column: 1
from __future__ import nested_scopes
def f(x):
def g(y):
return x + y
return g
result = f(2)(4)
Reported by Pylint.
Line: 7
Column: 1
from __future__ import nested_scopes
def f(x):
def g(y):
return x + y
return g
result = f(2)(4)
Reported by Pylint.
Line: 8
Column: 5
def f(x):
def g(y):
return x + y
return g
result = f(2)(4)
Reported by Pylint.
Line: 8
Column: 5
def f(x):
def g(y):
return x + y
return g
result = f(2)(4)
Reported by Pylint.