Skip to main content

CSES access framework for Python

Project description

PyCSES

CSES Access Framework for Python

Main Repo

Introduction

PyCSES is a Python library that provides access to the CSES format. It is designed to be simple and easy to use.

Functions

import cses

# Read a CSES file
parser = cses.CSESParser("path/to/file.cses.yaml")

# Check if the file is valid
if not cses.CSESParser.is_cses_file("path/to/file.cses.yaml"):
    print("Not a valid CSES file")

# Get subjects
for subject in parser.get_subjects():
    print("Name:", subject["name"])
    print("Simplified Name:", subject["simplified_name"])
    print("Teacher:", subject["teacher"])
    print("Room:", subject["room"])
    print("")

# Get schedules
for schedule in parser.get_schedules():
    print("Name:", schedule["name"])
    print("Enable Day:", schedule["enable_day"])
    print("Weeks:", schedule["weeks"])
    print("Classes:")
    for class_ in schedule["classes"]:
        print("  Subject:", class_["subject"])
        print("  Start Time:", class_["start_time"])
        print("  End Time:", class_["end_time"])
    print("")


# Generate a CSES file
generator = cses.CSESGenerator(version=1)

# Add a subject
generator.add_subject(name="Math", simplified_name="M", teacher="Mr. Wang", room="101")

# Add a schedule
generator.add_schedule(name="Monday", enable_day="mon", weeks="all", classes=[
    {
        "subject": "Math",
        "start_time": "08:00",
        "end_time": "09:00"
    },
    {
        "subject": "Biology",
        "start_time": "09:00",
        "end_time": "10:00"
    }
])

# Save the file
generator.save_to_file("path/to/file.cses.yaml")

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pycses-0.1.3-py3-none-any.whl (7.7 kB view details)

Uploaded Python 3

File details

Details for the file pycses-0.1.3-py3-none-any.whl.

File metadata

  • Download URL: pycses-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 7.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.11

File hashes

Hashes for pycses-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 eb95d4b2ac6d31ef43c9d070db406639aaeeca55c23758ea6ba6b5728ff61736
MD5 b1f921a94c0e1c7b6c6b8f2fd0ffd1ca
BLAKE2b-256 9427f40af59857992921c519a425d7b06042220343ac854e0859b4d2fd5688d9

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page