Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ cython_debug/
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
# and can be added to the global gitignore or merged into this file. For a more nuclear
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
#.idea/
.idea/

# PyPI configuration file
.pypirc
26 changes: 26 additions & 0 deletions .readthedocs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Read the Docs configuration file
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details

# Required
version: 2

# Set the OS, Python version, and other tools you might need
build:
os: ubuntu-24.04
tools:
python: "3.13"

python:
install:
- requirements: ./requirements.txt

# Build documentation in the "docs/" directory with Sphinx
sphinx:
configuration: docs/source/conf.py

# Optionally, but recommended,
# declare the Python requirements required to build your documentation
# See https://docs.readthedocs.io/en/stable/guides/reproducible-builds.html
# python:
# install:
# - requirements: docs/requirements.txt
Binary file added Logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
77 changes: 8 additions & 69 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,74 +1,13 @@
<div align="center">
<a href="https://github.com/MacroMeng/cseslib4py"> <img align="left" alt="logo" height="72" src="https://github.com/MacroMeng/cseslib4py/blob/main/Logo.png?raw=true" width="72"/> </a>

<image src="https://static.smart-teach.cn/logos/full.jpg" height="64"/>
# cseslib4py

# PyCSES
适用于 Python 的 CSES API

CSES Access Framework for Python

#### [Main Repo](https://github.com/SmartTeachCN/pycses)

</div>

## Introduction

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

## Functions

```python
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")
```
## 简介

**cseslib4py** 是一个 Python 库,提供对 [CSES](https://github.com/SmartTeachCN/CSES) 格式的访问,同时具有简单易用的设计。<br/>
此外,它由 [MacrosMeng](https://github.com/MacroMeng) 重构,以提供比已经停更的 [pycses](https://github.com/SmartTeachCN/pycses) **更好**和**具有更高易读性**的访问。

## 许可证
**cseslib4py** 采用 **MIT** 许可证。您可以在遵守许可证条款的前提下自由使用、修改和分发该库。
79 changes: 0 additions & 79 deletions README.rst

This file was deleted.

Loading