drivers/comedi/drivers/ni_routing/tools/csv_collection.py
Source file repositories/reference/linux-study-clean/drivers/comedi/drivers/ni_routing/tools/csv_collection.py
File Facts
- System
- Linux kernel
- Corpus path
drivers/comedi/drivers/ni_routing/tools/csv_collection.py- Extension
.py- Size
- 1239 bytes
- Lines
- 40
- Domain
- Driver Families
- Bucket
- drivers/comedi
- Inferred role
- Driver Families: drivers/comedi
- Status
- atlas-only
Why This File Exists
Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
Dependency Surface
- No C-style include directives detected by the generator.
Detected Declarations
- No top-level syscall, struct, function, initcall, or export declaration detected by the generator.
Annotated Snippet
# SPDX-License-Identifier: GPL-2.0+
import os, csv, glob
class CSVCollection(dict):
delimiter=';'
quotechar='"'
source_column_name = 'Sources / Destinations'
"""
This class is a dictionary representation of the collection of sheets that
exist in a given .ODS file.
"""
def __init__(self, pattern, skip_commented_lines=True, strip_lines=True):
super(CSVCollection, self).__init__()
self.pattern = pattern
C = '#' if skip_commented_lines else 'blahblahblah'
if strip_lines:
strip = lambda s:s.strip()
else:
strip = lambda s:s
# load all CSV files
key = self.source_column_name
for fname in glob.glob(pattern):
with open(fname) as F:
dR = csv.DictReader(F, delimiter=self.delimiter,
quotechar=self.quotechar)
name = os.path.basename(fname).partition('.')[0]
D = {
r[key]:{f:strip(c) for f,c in r.items()
if f != key and f[:1] not in ['', C] and
strip(c)[:1] not in ['', C]}
for r in dR if r[key][:1] not in ['', C]
}
# now, go back through and eliminate all empty dictionaries
D = {k:v for k,v in D.items() if v}
self[name] = D
Annotation
- Atlas domain: Driver Families / drivers/comedi.
- Implementation status: atlas-only.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.