CSES access framework for Python
Project description
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
Release history Release notifications | RSS feed
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pycses-0.1.2-py3-none-any.whl.
File metadata
- Download URL: pycses-0.1.2-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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
13d6bd29a52e0bf6330de4ace3fd3e48826f6dcb96994890ed55d0ed05fea628
|
|
| MD5 |
839b3266dcb4419e8f5e83d4ac0e3f9b
|
|
| BLAKE2b-256 |
4ebe6317eb8be1a41cd75eefe0d565a211290f97e461c4eee0feeb34bc0e0414
|