Skip to content

Commit

Permalink
Implement Writerside docs
Browse files Browse the repository at this point in the history
  • Loading branch information
Eve-ning committed Oct 21, 2023
1 parent de30edd commit f546382
Show file tree
Hide file tree
Showing 192 changed files with 46,494 additions and 14,993 deletions.
6 changes: 6 additions & 0 deletions Writerside/c.list
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE categories
SYSTEM "https://resources.jetbrains.com/writerside/1.0/categories.dtd">
<categories>
<category id="wrs" name="Writerside documentation" order="1"/>
</categories>
12 changes: 12 additions & 0 deletions Writerside/cfg/buildprofiles.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<buildprofiles xsi:noNamespaceSchemaLocation="https://resources.jetbrains.com/writerside/1.0/build-profiles.xsd"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

<variables></variables>
<build-profile instance="in">
<variables>
<noindex-content>true</noindex-content>
</variables>
</build-profile>

</buildprofiles>
File renamed without changes
55 changes: 55 additions & 0 deletions Writerside/in.tree
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE instance-profile
SYSTEM "https://resources.jetbrains.com/writerside/1.0/product-profile.dtd">

<instance-profile id="in"
name="reamberPy" start-page="index.md">

<toc-element topic="index.md"/>
<toc-element toc-title="About">
<toc-element topic="GettingStarted.md"/>
<toc-element topic="Conventions.md"/>
<toc-element topic="ChangeLog.md"/>
<toc-element topic="About.md"/>
</toc-element>
<toc-element toc-title="Learn">
<toc-element topic="WorkingWithMaps.md"/>
<toc-element topic="Stacking.md"/>
<toc-element topic="BuildingBlocks.md"/>
<toc-element topic="Basics.md"/>
</toc-element>
<toc-element toc-title="Objects">
<toc-element topic="SM.md"/>
<toc-element topic="Quaver.md"/>
<toc-element topic="Osu.md"/>
<toc-element topic="O2Jam.md"/>
<toc-element topic="BMS.md"/>
<toc-element toc-title="Algorithms">
<toc-element topic="SvNormalize.md"/>
<toc-element topic="ScrollSpeed.md"/>
<toc-element topic="PlayFieldPattern.md"/>
<toc-element topic="PlayField.md"/>
<toc-element topic="Pattern.md"/>
<toc-element topic="FullLN.md"/>
<toc-element topic="DominantBpm.md"/>
<toc-element topic="Conversions.md"/>
<toc-element toc-title="osu">
<toc-element topic="ParseReplay.md"/>
<toc-element topic="HitsoundCopy.md"/>
</toc-element>
</toc-element>
<toc-element toc-title="Base Objects">
<toc-element topic="MapSet.md"/>
<toc-element topic="Map.md"/>
<toc-element topic="BpmHitHold.md" accepts-web-file-names-ref="757dd3ba"/>
</toc-element>
<toc-element toc-title="BMS">
<toc-element topic="Channel.md"/>
</toc-element>
</toc-element>
<toc-element toc-title="Dev Info">
<toc-element topic="TypeHinting.md"/>
<toc-element topic="Props.md"/>
<toc-element topic="DevInfo.md"/>
</toc-element>
</instance-profile>
34 changes: 34 additions & 0 deletions Writerside/redirection-rules.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE rules SYSTEM "https://resources.jetbrains.com/writerside/1.0/redirection-rules.dtd">
<rules>
<!-- format is as follows
<rule id="<unique id>">
<accepts>page.html</accepts>
</rule>
-->
<rule id="472f6315">
<description>
<![CDATA[Created after removal of "<Hold.md>" from reamberPy]]></description>
<accepts>Hold.html</accepts>
</rule>
<rule id="757dd3ba">
<description>
<![CDATA[Created after removal of "<Hit.md>" from reamberPy]]></description>
<accepts>Hit.html</accepts>
</rule>
<rule id="39ac902d">
<description>Created after removal of "Base Lists" from reamberPy
</description>
<accepts>lists.html</accepts>
</rule>
<rule id="717e67d0">
<description>Created after removal of "Base" from reamberPy
</description>
<accepts>Base.html</accepts>
</rule>
<rule id="2f547111">
<description>Created after removal of "Algorithms" from reamberPy
</description>
<accepts>Algorithms.html</accepts>
</rule>
</rules>
88 changes: 88 additions & 0 deletions Writerside/topics/devInfo/DevInfo.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
# Development Info

## Base

See also [Building Blocks](BuildingBlocks.md)

Base contains a few **item** classes

- `Timed`
- `Bpm`
- `Note`
- `Hit`
- `Hold`

These are different from the **item list** classes

- `TimedList`
- `BpmList`
- `NoteList`
- `HitList`
- `HoldList`

The reason for separating them is so that we can custom implement list methods that Python `list` class does not
provide.

**Each Item** uses a `pd.Series`. **Each List** uses a `pd.DataFrame`.

`Item.data` will yield a `pd.Series`.

`ItemList.df` will yield a `pd.DataFrame`.

We use `pd` because it helps in optimization and provides abundant functionalities to extend from.

## Item Structure

**Bolded** elements are new properties introduced in the child class.

### Timed

Props: **offset**

### Note(Timed)

Props: **column**, offset

### Hit(Note)

Props: column, offset

### Hold(Note)

Props: **length**, column, offset

### Bpm(Timed)

Props: **bpm**, **metronome**, offset

## Item List Structure

For each corresponding **Item**, there is its list part, which provides additional functionality

- `TimedList`
- `NoteList(TimedList)`
- `HitList(NoteList)`
- `HoldList(NoteList)`
- `BpmList(TimedList)`

## Map Structure

Every map is a `@dataclass`.

For each map, it has an `objs` dictionary of `TimedList` children. This is the default.

```python
from reamber.base.lists.notes.HitList import HitList
from reamber.base.lists.notes.HoldList import HoldList
from reamber.base.lists.BpmList import BpmList

objs = dict(hits=HitList([]), holds=HoldList([]), bpms=BpmList([]))
```

In other words, it always initializes with these classes, but inheriting classes can override `objs`.

Overriding updates the classes, where it should opt for `OsuHoldList` instead of `HoldList`.

## MapSet Structure

A `MapSet` is simply a list of `Map` s.
104 changes: 104 additions & 0 deletions Writerside/topics/devInfo/Props.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
# Generating Properties on the Fly

reamberPy uses decorators that create "properties".

As outlined in the [Type Hinting](TypeHinting.md)`, most objects use `
pd.Series` or
`pd.DataFrame` data classes. One trick with these is that they can be indexed
with `[]` or `.`.

```python
import pandas as pd

srs: pd.Series
assert srs.offset == srs['offset']

df: pd.DataFrame
assert df.offset == df['offset']
```

<deflist collapsible="true" default-state="collapsed">
<def title="Why Pandas?">
Pandas is an extension of NumPy with useful column-based operations, suitable
for this. While I could've customized my
own library, it'll be too much of a liability of maintenance.

It provides excellent functions, on top of its indexing, with good performance
on correct usage.
</def>
</deflist>

## Item Prop Decorators

The custom `Property` decorators grabs the class' attribute `_props` and
generates the functions.

For example, `@item_props()` uses `_props` and generates the following
functions.

<tabs>
<tab title="Pre-Decorated">
<code-block lang="python">
from reamber.base import item_props
from reamber.osu import OsuTimingPointMeta
from reamber.base.Timed import Timed
@item_props()
class OsuSv(OsuTimingPointMeta, Timed):
_props = dict(multiplier=['float', 1.0])
</code-block>
</tab>
<tab title="Post-Decorated">
<code-block lang="python">
from reamber.osu import OsuTimingPointMeta
from reamber.base.Timed import Timed
import pandas as pd
class OsuSv(OsuTimingPointMeta, Timed):
@property
def multiplier(self) -&gt; pd.Series:
return self.data['multiplier']
@multiplier.setter
def multiplier(self, val) -&gt; None:
self.data['multiplier'] = val
</code-block>
</tab>
</tabs>

As shown, the dictionary automatically creates the property functions.

## List Prop Decorators

Similar to Item Prop Decorators, this affects lists

<tabs>
<tab title="Pre-Decorated">
<code-block lang="python">
from reamber.base.Property import list_props
from reamber.osu.OsuSv import OsuSv
from reamber.base.lists.TimedList import TimedList
@list_props(OsuSv)
class OsuSvList(TimedList[OsuSv]):
...
</code-block>
</tab>
<tab title="Post-Decorated">
<code-block lang="python">
from reamber.base.lists.TimedList import TimedList
from reamber.osu.OsuSv import OsuSv
import pandas as pd
class OsuSvList(TimedList[OsuSv]):
@property
def multiplier(self) -&gt; pd.Series:
return self.df['multiplier']
@multiplier.setter
def multiplier(self, val) -&gt; None:
self.df['multiplier'] = val
</code-block>
</tab>
</tabs>

As shown, it uses the `OsuSv` class' dictionary to generate the property
functions.

> Without meta-programming decorators, this would have caused many consistency
> issues.
{style='note'}
Loading

0 comments on commit f546382

Please sign in to comment.