Commit Graph

27 Commits

Author SHA1 Message Date
Jacob Walls
cc65d01b44 Add csv.Dialect to second arg of register_dialect() (#13294) 2024-12-27 20:01:09 -08:00
Stephen Morton
17408ee538 fix the __init__ of several C-classes (#13211) 2024-12-23 10:55:51 -08:00
Stephen Morton
bb0e1e2c16 _csv.Reader and _csv.Writer (#13057) 2024-11-21 11:13:53 +01:00
Stephen Morton
56078f574f csv.Dialect doesn't actually subclass _csv.Dialect (#12808)
It does a weird wrapping thing instead:
2a5cdb2516/Lib/csv.py (L114)
2024-10-16 22:12:47 -07:00
sobolevn
d16fe74e1f Fix _csv.Dialect.__init__ (#12320) 2024-10-03 11:33:56 +02:00
Max Muoto
0df6028dc8 Use Final for Constant Literals in the stdlib (#12332)
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2024-07-15 18:07:34 +01:00
Sebastian Rittau
53a8193d64 Update typing_extensions imports in stdlib (#11244)
Co-authored-by: AlexWaygood <alex.waygood@gmail.com>
2024-01-05 08:15:19 -08:00
Nikita Sobolev
c85f7de957 Update csv stubs for Python3.12 (#10250) 2023-06-03 13:45:43 +01:00
Alex Waygood
c407a44489 Add defaults to csv stubs (#9774) 2023-02-21 11:33:38 +01:00
Avasam
a768744d51 Type and mark as final module-level dunders not meant to be overwritten in stdlib/ (#9709) 2023-02-12 16:15:20 +00:00
Alex Waygood
0ef9c3f8e8 Enable flake8-pyi's Y037 (#9686) 2023-02-06 19:01:02 -08:00
Alex Waygood
3ed7e3ba50 csv: annotate keyword arguments in various functions and methods (#7788) 2022-05-07 21:01:20 -07:00
Alex Waygood
5f557176b4 _csv.pyi: minor cleanup (#7789) 2022-05-06 11:38:19 -07:00
Alex Waygood
97a74bc1aa Import from collections.abc wherever possible (#7635) 2022-04-18 12:50:37 +02:00
Alex Waygood
740193a8fc Use TypeAlias where possible for type aliases (#7630) 2022-04-15 18:01:00 -07:00
Alex Waygood
22c3cc4d0b Add csv.__version__ (#7357) 2022-02-22 20:12:43 +02:00
Alex Waygood
a40d79a4e6 Use lowercase type everywhere (#6853) 2022-01-08 16:09:29 +01:00
Nikita Sobolev
ca7e0964c4 Use Literal types in csv (#6823) 2022-01-05 11:29:01 +01:00
Alex Waygood
8d5d2520ac Use PEP 585 syntax wherever possible (#6717) 2021-12-28 11:31:43 +01:00
Akuli
24afb531ff stubtest_stdlib: get rid of --ignore-missing-stub (#6491)
* get rid of --ignore-missing-stub

* update allowlists based on github actions logs, with script

import re

platforms = ["linux", "win32", "darwin"]
versions = ["py36", "py37", "py38", "py39", "py310"]

entries_by_pv = {}
for p in platforms:
    for v in versions:
        p_name = {"linux": "ubuntu", "darwin": "macos", "win32": "windows"}[p]
        v_name = "3." + v.replace("py3", "")
        if v_name == "3.9":
            v_name = "3.9.7"

        entries = set()
        with open(f"la/Check stdlib with stubtest ({p_name}-latest, {v_name})/6_Run stubtest.txt") as file:
            for line in file:
                m = re.search(r"error: (.*) is not present in stub$", line.strip())
                if m:
                    entries.add(m.group(1))
        entries_by_pv[p, v] = entries

def remove_intersection(sets):
    sets = list(sets)
    result = set(sets[0])
    for s in sets[1:]:
        result &= s
    for s in sets:
        for r in result:
            s.remove(r)
    return result

common_to_all = remove_intersection(entries_by_pv.values())

common_to_version = {}
for v in versions:
    common_to_version[v] = remove_intersection([
        entries
        for (p, v2), entries in entries_by_pv.items()
        if v == v2
    ])

common_to_platform = {}
for p in platforms:
    common_to_platform[p] = remove_intersection([
        entries
        for (p2, v), entries in entries_by_pv.items()
        if p == p2
    ])

def write(fname, entries):
    with open(f"tests/stubtest_allowlists/{fname}.txt", "a") as file:
        file.write("\n# Exists at runtime, but missing from stubs\n")
        for i in sorted(entries):
            file.write(i + "\n")

write("py3_common", common_to_all)
for v, entries in common_to_version.items():
    write(v, entries)
for p, entries in common_to_platform.items():
    write(p, entries)
for (p, v), entries in entries_by_pv.items():
    write(p + "-" + v, entries)

* Manually combine __main__ attributes into a single entry

* move and comment entries manually
2021-12-04 16:58:44 -08:00
Jelle Zijlstra
178b6bb8f4 csv: Make _Writer.write positional-only (#6475)
At runtime it only uses positional parameters.

I think this works fortuitously in mypy and pyright because mypy ignores parameter names in protocols and pyright has a bug that allows passing positional-only to pos-or-keyword params (microsoft/pyright#2652) and the parameter to `io.TextIO.write` happens to be `__s`.
2021-12-02 13:27:21 -08:00
Alex Waygood
e9afd22a99 Clarify why csv stub has no __version__ attribute (#6398)
Co-authored-by: Akuli <akuviljanen17@gmail.com>
2021-11-27 16:58:29 +02:00
Akuli
ce11072dbe Big diff: use lower-case list and dict (#5888) 2021-08-08 09:26:35 -07:00
Akuli
ee487304d7 Big diff: Use new "|" union syntax (#5872) 2021-08-08 11:05:21 +02:00
Sebastian Rittau
6a9c89e928 Replace 'Text' with 'str' in py3 stdlib (#5466) 2021-05-16 07:10:48 -07:00
Akuli
17dcea4a68 Akuli and srittau: Remove Python 2 branches from Python 3 stubs (#5461)
* run script and do some manual changes (Akuli)

* do the whole thing manually (srittau)

* merge changes (Akuli)

Co-authored-by: Sebastian Rittau <srittau@rittau.biz>
2021-05-15 15:33:39 +03:00
Ivan Levkivskyi
16ae4c6120 Re-organize directory structure (#4971)
See discussion in #2491

Co-authored-by: Ivan Levkivskyi <ilevkivskyi@dropbox.com>
2021-01-27 12:00:39 +00:00