or run

npx @tessl/cli init
Log in

Version

Tile

Overview

Evals

Files

docs

builtins.mdconcurrency.mddata-processing.mddevelopment.mdessential-stdlib.mdindex.mdnetworking.mdsecurity.mdsystem-os.md
tile.json

data-processing.mddocs/

Data Processing and Formats

Modules for handling various data formats, serialization, compression, and data manipulation tasks commonly needed in Python applications.

Capabilities

JSON Processing

Built-in JSON encoder and decoder for working with JSON data.

import json

# Encoding functions
def dumps(obj, skipkeys: bool = False, ensure_ascii: bool = True, 
          check_circular: bool = True, allow_nan: bool = True, 
          cls=None, indent=None, separators=None, default=None, 
          sort_keys: bool = False) -> str: ...

def dump(obj, fp, skipkeys: bool = False, ensure_ascii: bool = True, 
         check_circular: bool = True, allow_nan: bool = True, 
         cls=None, indent=None, separators=None, default=None, 
         sort_keys: bool = False) -> None: ...

# Decoding functions
def loads(s: str, cls=None, object_hook=None, parse_float=None, 
          parse_int=None, parse_constant=None, object_pairs_hook=None, 
          strict: bool = True) -> object: ...

def load(fp, cls=None, object_hook=None, parse_float=None, 
         parse_int=None, parse_constant=None, object_pairs_hook=None, 
         strict: bool = True) -> object: ...

# Encoder/Decoder classes
class JSONEncoder:
    def __init__(self, skipkeys: bool = False, ensure_ascii: bool = True, 
                 check_circular: bool = True, allow_nan: bool = True, 
                 sort_keys: bool = False, indent=None, separators=None, 
                 default=None) -> None: ...
    def encode(self, o) -> str: ...
    def iterencode(self, o, _one_shot: bool = False): ...
    def default(self, o): ...

class JSONDecoder:
    def __init__(self, object_hook=None, parse_float=None, parse_int=None, 
                 parse_constant=None, strict: bool = True, 
                 object_pairs_hook=None) -> None: ...
    def decode(self, s: str) -> object: ...
    def raw_decode(self, s: str, idx: int = 0) -> tuple: ...

# Exceptions
class JSONDecodeError(ValueError):
    def __init__(self, msg: str, doc: str, pos: int) -> None: ...
    @property
    def msg(self) -> str: ...
    @property
    def doc(self) -> str: ...
    @property
    def pos(self) -> int: ...
    @property
    def lineno(self) -> int: ...
    @property
    def colno(self) -> int: ...

CSV Processing

Reading and writing CSV (Comma Separated Values) files.

import csv

# Reader functions
def reader(csvfile, dialect: str = 'excel', **fmtparams): ...
def DictReader(csvfile, fieldnames=None, restkey=None, restval=None, 
               dialect: str = 'excel', **fmtparams): ...

# Writer functions  
def writer(csvfile, dialect: str = 'excel', **fmtparams): ...
def DictWriter(csvfile, fieldnames, restval: str = '', extrasaction: str = 'raise', 
               dialect: str = 'excel', **fmtparams): ...

# Utility functions
def register_dialect(name: str, dialect_class=None, **fmtparams) -> None: ...
def unregister_dialect(name: str) -> None: ...
def get_dialect(name: str): ...
def list_dialects() -> list: ...
def field_size_limit(new_limit: int = None) -> int: ...

class Dialect:
    """Base class for CSV dialects."""
    delimiter: str = ','
    quotechar: str = '"'
    escapechar: str = None
    doublequote: bool = True
    skipinitialspace: bool = False
    lineterminator: str = '\r\n'
    quoting: int = QUOTE_MINIMAL

# Quoting constants
QUOTE_ALL: int        # Quote all fields
QUOTE_MINIMAL: int    # Quote fields with special characters
QUOTE_NONNUMERIC: int # Quote non-numeric fields
QUOTE_NONE: int       # Never quote fields

# Standard dialects
class excel(Dialect): ...
class excel_tab(Dialect): ...
class unix_dialect(Dialect): ...

# Exception
class Error(Exception): ...

Object Serialization (Pickle)

Python object serialization for storing and retrieving Python objects.

import pickle

# Serialization functions
def dump(obj, file, protocol: int = None, fix_imports: bool = True, 
         buffer_callback=None) -> None: ...
def dumps(obj, protocol: int = None, fix_imports: bool = True, 
          buffer_callback=None) -> bytes: ...

# Deserialization functions
def load(file, fix_imports: bool = True, encoding: str = 'ASCII', 
         errors: str = 'strict', buffers=None) -> object: ...
def loads(data: bytes, fix_imports: bool = True, encoding: str = 'ASCII', 
          errors: str = 'strict', buffers=None) -> object: ...

# Pickler/Unpickler classes
class Pickler:
    def __init__(self, file, protocol: int = None, fix_imports: bool = True, 
                 buffer_callback=None) -> None: ...
    def dump(self, obj) -> None: ...
    def persistent_id(self, obj): ...

class Unpickler:
    def __init__(self, file, fix_imports: bool = True, encoding: str = 'ASCII', 
                 errors: str = 'strict', buffers=None) -> None: ...
    def load(self) -> object: ...
    def persistent_load(self, pid): ...

# Protocol versions
HIGHEST_PROTOCOL: int  # Highest protocol version
DEFAULT_PROTOCOL: int  # Default protocol version

# Exceptions
class PickleError(Exception): ...
class PicklingError(PickleError): ...
class UnpicklingError(PickleError): ...

Date and Time Handling

Comprehensive date and time manipulation capabilities.

import datetime
import calendar

# Main classes
class date:
    def __init__(self, year: int, month: int, day: int) -> None: ...
    
    # Class methods
    @classmethod
    def today(cls) -> date: ...
    @classmethod
    def fromordinal(cls, ordinal: int) -> date: ...
    @classmethod
    def fromisoformat(cls, date_string: str) -> date: ...
    @classmethod
    def fromtimestamp(cls, timestamp: float) -> date: ...
    
    # Instance methods
    def replace(self, year: int = None, month: int = None, day: int = None) -> date: ...
    def timetuple(self) -> time.struct_time: ...
    def toordinal(self) -> int: ...
    def weekday(self) -> int: ...  # Monday is 0
    def isoweekday(self) -> int: ...  # Monday is 1
    def isocalendar(self) -> tuple: ...
    def isoformat(self) -> str: ...
    def strftime(self, format: str) -> str: ...
    
    # Properties
    @property
    def year(self) -> int: ...
    @property
    def month(self) -> int: ...
    @property
    def day(self) -> int: ...
    
    # Class attributes
    min: date
    max: date
    resolution: timedelta

class time:
    def __init__(self, hour: int = 0, minute: int = 0, second: int = 0, 
                 microsecond: int = 0, tzinfo=None, fold: int = 0) -> None: ...
    
    # Class methods
    @classmethod
    def fromisoformat(cls, time_string: str) -> time: ...
    
    # Instance methods
    def replace(self, hour: int = None, minute: int = None, second: int = None, 
                microsecond: int = None, tzinfo=None, fold: int = None) -> time: ...
    def isoformat(self, timespec: str = 'auto') -> str: ...
    def strftime(self, format: str) -> str: ...
    
    # Properties
    @property
    def hour(self) -> int: ...
    @property
    def minute(self) -> int: ...
    @property
    def second(self) -> int: ...
    @property
    def microsecond(self) -> int: ...
    @property
    def tzinfo(self): ...
    @property
    def fold(self) -> int: ...

class datetime(date):
    def __init__(self, year: int, month: int, day: int, hour: int = 0, 
                 minute: int = 0, second: int = 0, microsecond: int = 0, 
                 tzinfo=None, fold: int = 0) -> None: ...
    
    # Class methods
    @classmethod
    def now(cls, tz=None) -> datetime: ...
    @classmethod
    def utcnow(cls) -> datetime: ...
    @classmethod
    def fromtimestamp(cls, timestamp: float, tz=None) -> datetime: ...
    @classmethod
    def utcfromtimestamp(cls, timestamp: float) -> datetime: ...
    @classmethod
    def fromisoformat(cls, date_string: str) -> datetime: ...
    @classmethod
    def strptime(cls, date_string: str, format: str) -> datetime: ...
    @classmethod
    def combine(cls, date: date, time: time, tzinfo=None) -> datetime: ...
    
    # Instance methods
    def date(self) -> date: ...
    def time(self) -> time: ...
    def timetz(self) -> time: ...
    def replace(self, year: int = None, month: int = None, day: int = None, 
                hour: int = None, minute: int = None, second: int = None, 
                microsecond: int = None, tzinfo=None, fold: int = None) -> datetime: ...
    def astimezone(self, tz=None) -> datetime: ...
    def utctimetuple(self) -> time.struct_time: ...
    def timestamp(self) -> float: ...
    
    # Properties (inherits from date)
    @property
    def hour(self) -> int: ...
    @property
    def minute(self) -> int: ...
    @property
    def second(self) -> int: ...
    @property
    def microsecond(self) -> int: ...
    @property
    def tzinfo(self): ...
    @property
    def fold(self) -> int: ...

class timedelta:
    def __init__(self, days: int = 0, seconds: int = 0, microseconds: int = 0, 
                 milliseconds: int = 0, minutes: int = 0, hours: int = 0, 
                 weeks: int = 0) -> None: ...
    
    # Properties
    @property
    def days(self) -> int: ...
    @property
    def seconds(self) -> int: ...
    @property
    def microseconds(self) -> int: ...
    
    # Methods
    def total_seconds(self) -> float: ...
    
    # Class attributes
    min: timedelta
    max: timedelta
    resolution: timedelta

# Timezone support
class timezone:
    def __init__(self, offset: timedelta, name: str = None) -> None: ...
    @classmethod
    def utc(cls) -> timezone: ...
    
    def utcoffset(self, dt: datetime) -> timedelta: ...
    def tzname(self, dt: datetime) -> str: ...
    def dst(self, dt: datetime) -> timedelta: ...

# Calendar functions
def monthrange(year: int, month: int) -> tuple: ...
def monthcalendar(year: int, month: int) -> list: ...
def calendar(year: int, w: int = 2, l: int = 1, c: int = 6, m: int = 3) -> str: ...
def month(year: int, month: int, w: int = 0, l: int = 0) -> str: ...
def isleap(year: int) -> bool: ...
def leapdays(y1: int, y2: int) -> int: ...
def weekday(year: int, month: int, day: int) -> int: ...

Compression and Archives

Support for various compression formats and archive files.

import gzip
import bz2
import zipfile
import tarfile

# Gzip compression
def open(filename, mode: str = 'rb', compresslevel: int = 9, 
         encoding=None, errors=None, newline=None): ...

class GzipFile:
    def __init__(self, filename=None, mode=None, compresslevel: int = 9, 
                 fileobj=None, mtime=None) -> None: ...
    def read(self, size: int = -1) -> bytes: ...
    def write(self, data: bytes) -> int: ...
    def close() -> None: ...

def compress(data: bytes, compresslevel: int = 9) -> bytes: ...
def decompress(data: bytes) -> bytes: ...

# Bzip2 compression  
class BZ2File:
    def __init__(self, filename, mode: str = 'r', buffering=None, 
                 compresslevel: int = 9) -> None: ...
    def read(self, size: int = -1) -> bytes: ...
    def write(self, data) -> int: ...
    def close() -> None: ...

def compress(data: bytes, compresslevel: int = 9) -> bytes: ...
def decompress(data: bytes) -> bytes: ...

# ZIP archives
class ZipFile:
    def __init__(self, file, mode: str = 'r', compression: int = ZIP_STORED, 
                 allowZip64: bool = True, compresslevel=None, 
                 strict_timestamps: bool = True) -> None: ...
    
    def __enter__(self) -> ZipFile: ...
    def __exit__(self, type, value, traceback) -> None: ...
    
    def close() -> None: ...
    def getinfo(self, name: str) -> ZipInfo: ...
    def infolist() -> list: ...
    def namelist() -> list: ...
    def open(self, name, mode: str = 'r', pwd: bytes = None, 
             force_zip64: bool = False) -> IO: ...
    def extract(self, member, path=None, pwd: bytes = None) -> str: ...
    def extractall(self, path=None, members=None, pwd: bytes = None) -> None: ...
    def printdir(self, file=None) -> None: ...
    def setpassword(self, pwd: bytes) -> None: ...
    def read(self, name, pwd: bytes = None) -> bytes: ...
    def testzip() -> str: ...
    def write(self, filename, arcname=None, compress_type=None, 
              compresslevel=None) -> None: ...
    def writestr(self, zinfo_or_arcname, data, compress_type=None, 
                 compresslevel=None) -> None: ...

class ZipInfo:
    def __init__(self, filename: str = 'NoName', date_time=(1980, 1, 1, 0, 0, 0)) -> None: ...
    @property
    def filename(self) -> str: ...
    @property
    def date_time(self) -> tuple: ...
    @property
    def compress_type(self) -> int: ...
    @property
    def file_size(self) -> int: ...
    @property
    def compress_size(self) -> int: ...

# Compression constants
ZIP_STORED: int     # No compression
ZIP_DEFLATED: int   # Deflate compression
ZIP_BZIP2: int      # Bzip2 compression
ZIP_LZMA: int       # LZMA compression

# TAR archives
class TarFile:
    def __init__(self, name=None, mode: str = 'r', fileobj=None, 
                 format=None, tarinfo=None, dereference=None, 
                 ignore_zeros=None, encoding=None, errors: str = 'surrogateescape', 
                 pax_headers=None, debug=None, errorlevel=None, 
                 copybufsize=None) -> None: ...
    
    @classmethod
    def open(cls, name=None, mode: str = 'r', fileobj=None, 
             bufsize=10240, **kwargs) -> TarFile: ...
    
    def __enter__(self) -> TarFile: ...
    def __exit__(self, type, value, traceback) -> None: ...
    
    def close() -> None: ...
    def getmember(self, name: str) -> TarInfo: ...
    def getmembers() -> list: ...
    def getnames() -> list: ...
    def list(self, verbose: bool = True, members=None) -> None: ...
    def next() -> TarInfo: ...
    def extractall(self, path: str = '.', members=None, numeric_owner: bool = False) -> None: ...
    def extract(self, member, path: str = '', set_attrs: bool = True, 
                numeric_owner: bool = False) -> None: ...
    def extractfile(self, member) -> IO: ...
    def add(self, name: str, arcname=None, recursive: bool = True, 
            exclude=None, filter=None) -> None: ...
    def addfile(self, tarinfo: TarInfo, fileobj=None) -> None: ...
    def gettarinfo(self, name=None, arcname=None, fileobj=None) -> TarInfo: ...

class TarInfo:
    def __init__(self, name: str = '') -> None: ...
    @property
    def name(self) -> str: ...
    @property
    def size(self) -> int: ...
    @property
    def mtime(self) -> float: ...
    @property
    def mode(self) -> int: ...
    @property
    def type(self) -> bytes: ...
    def isfile(self) -> bool: ...
    def isreg(self) -> bool: ...
    def isdir(self) -> bool: ...
    def issym(self) -> bool: ...
    def islnk(self) -> bool: ...

Configuration File Parsing

Reading and writing configuration files in various formats.

import configparser
import tomllib  # TOML parsing (read-only)

# TOML parsing functions
def load(fp) -> dict: ...  # Load TOML from file-like object
def loads(s: str) -> dict: ...  # Load TOML from string

class ConfigParser:
    def __init__(self, defaults=None, dict_type=dict, allow_no_value: bool = False, 
                 delimiters=('=', ':'), comment_prefixes=('#', ';'), 
                 inline_comment_prefixes=None, strict: bool = True, 
                 empty_lines_in_values: bool = True, default_section: str = 'DEFAULT', 
                 interpolation=BasicInterpolation(), converters=None) -> None: ...
    
    # Reading configuration
    def read(self, filenames, encoding=None) -> list: ...
    def read_file(self, fp, source=None) -> None: ...
    def read_string(self, string: str, source: str = '<string>') -> None: ...
    def read_dict(self, dictionary: dict, source: str = '<dict>') -> None: ...
    
    # Writing configuration
    def write(self, fp, space_around_delimiters: bool = True) -> None: ...
    
    # Accessing sections and options
    def sections(self) -> list: ...
    def add_section(self, section: str) -> None: ...
    def has_section(self, section: str) -> bool: ...
    def options(self, section: str) -> list: ...
    def has_option(self, section: str, option: str) -> bool: ...
    def remove_section(self, section: str) -> bool: ...
    def remove_option(self, section: str, option: str) -> bool: ...
    
    # Getting values
    def get(self, section: str, option: str, raw: bool = False, vars=None, 
            fallback=None) -> str: ...
    def getint(self, section: str, option: str, raw: bool = False, vars=None, 
               fallback=None) -> int: ...
    def getfloat(self, section: str, option: str, raw: bool = False, vars=None, 
                 fallback=None) -> float: ...
    def getboolean(self, section: str, option: str, raw: bool = False, vars=None, 
                   fallback=None) -> bool: ...
    
    # Setting values
    def set(self, section: str, option: str, value: str) -> None: ...
    
    # Interpolation support
    def __getitem__(self, section: str): ...
    def __setitem__(self, section: str, value) -> None: ...
    def __contains__(self, section: str) -> bool: ...

class RawConfigParser(ConfigParser): ...
class SafeConfigParser(ConfigParser): ...  # Deprecated

# Interpolation classes
class BasicInterpolation: ...
class ExtendedInterpolation: ...

# Exceptions
class Error(Exception): ...
class NoSectionError(Error): ...
class DuplicateSectionError(Error): ...
class DuplicateOptionError(Error): ...
class NoOptionError(Error): ...
class InterpolationError(Error): ...
class InterpolationDepthError(InterpolationError): ...
class InterpolationMissingOptionError(InterpolationError): ...
class InterpolationSyntaxError(InterpolationError): ...
class MissingSectionHeaderError(Error): ...
class ParsingError(Error): ...

Graph Algorithms

Topological sorting and graph processing utilities.

import graphlib

class TopologicalSorter:
    def __init__(self, graph=None) -> None: ...
    def add(self, node, *predecessors) -> None: ...
    def prepare(self) -> None: ...
    def is_active(self) -> bool: ...
    def get_ready(self) -> tuple: ...
    def done(self, *nodes) -> None: ...
    def static_order(self) -> iterator: ...

class CycleError(ValueError):
    """Exception raised when a cycle is detected in a graph."""

Types

JSON Types

# JSON serializable types
JSONType = str | int | float | bool | None | dict | list

DateTime Types

# Time tuple structure
class struct_time:
    tm_year: int     # Year
    tm_mon: int      # Month (1-12)
    tm_mday: int     # Day of month (1-31)
    tm_hour: int     # Hour (0-23)
    tm_min: int      # Minute (0-59)  
    tm_sec: int      # Second (0-61)
    tm_wday: int     # Day of week (0-6, Monday is 0)
    tm_yday: int     # Day of year (1-366)
    tm_isdst: int    # Daylight saving time flag

# ISO calendar tuple
IsoCalendarDate = tuple[int, int, int]  # (year, week, weekday)

Archive Types

# File modes for various archive formats
class FileMode:
    """Common file mode patterns."""
    READ_TEXT = 'r'
    READ_BINARY = 'rb' 
    WRITE_TEXT = 'w'
    WRITE_BINARY = 'wb'
    APPEND_TEXT = 'a'
    APPEND_BINARY = 'ab'