Skip to content

Commit f546382

Browse files
committed
Implement Writerside docs
1 parent de30edd commit f546382

File tree

192 files changed

+46494
-14993
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

192 files changed

+46494
-14993
lines changed

Diff for: Writerside/c.list

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE categories
3+
SYSTEM "https://resources.jetbrains.com/writerside/1.0/categories.dtd">
4+
<categories>
5+
<category id="wrs" name="Writerside documentation" order="1"/>
6+
</categories>

Diff for: Writerside/cfg/buildprofiles.xml

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<buildprofiles xsi:noNamespaceSchemaLocation="https://resources.jetbrains.com/writerside/1.0/build-profiles.xsd"
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
4+
5+
<variables></variables>
6+
<build-profile instance="in">
7+
<variables>
8+
<noindex-content>true</noindex-content>
9+
</variables>
10+
</build-profile>
11+
12+
</buildprofiles>

Diff for: Writerside/in.tree

+55
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE instance-profile
3+
SYSTEM "https://resources.jetbrains.com/writerside/1.0/product-profile.dtd">
4+
5+
<instance-profile id="in"
6+
name="reamberPy" start-page="index.md">
7+
8+
<toc-element topic="index.md"/>
9+
<toc-element toc-title="About">
10+
<toc-element topic="GettingStarted.md"/>
11+
<toc-element topic="Conventions.md"/>
12+
<toc-element topic="ChangeLog.md"/>
13+
<toc-element topic="About.md"/>
14+
</toc-element>
15+
<toc-element toc-title="Learn">
16+
<toc-element topic="WorkingWithMaps.md"/>
17+
<toc-element topic="Stacking.md"/>
18+
<toc-element topic="BuildingBlocks.md"/>
19+
<toc-element topic="Basics.md"/>
20+
</toc-element>
21+
<toc-element toc-title="Objects">
22+
<toc-element topic="SM.md"/>
23+
<toc-element topic="Quaver.md"/>
24+
<toc-element topic="Osu.md"/>
25+
<toc-element topic="O2Jam.md"/>
26+
<toc-element topic="BMS.md"/>
27+
<toc-element toc-title="Algorithms">
28+
<toc-element topic="SvNormalize.md"/>
29+
<toc-element topic="ScrollSpeed.md"/>
30+
<toc-element topic="PlayFieldPattern.md"/>
31+
<toc-element topic="PlayField.md"/>
32+
<toc-element topic="Pattern.md"/>
33+
<toc-element topic="FullLN.md"/>
34+
<toc-element topic="DominantBpm.md"/>
35+
<toc-element topic="Conversions.md"/>
36+
<toc-element toc-title="osu">
37+
<toc-element topic="ParseReplay.md"/>
38+
<toc-element topic="HitsoundCopy.md"/>
39+
</toc-element>
40+
</toc-element>
41+
<toc-element toc-title="Base Objects">
42+
<toc-element topic="MapSet.md"/>
43+
<toc-element topic="Map.md"/>
44+
<toc-element topic="BpmHitHold.md" accepts-web-file-names-ref="757dd3ba"/>
45+
</toc-element>
46+
<toc-element toc-title="BMS">
47+
<toc-element topic="Channel.md"/>
48+
</toc-element>
49+
</toc-element>
50+
<toc-element toc-title="Dev Info">
51+
<toc-element topic="TypeHinting.md"/>
52+
<toc-element topic="Props.md"/>
53+
<toc-element topic="DevInfo.md"/>
54+
</toc-element>
55+
</instance-profile>

Diff for: Writerside/redirection-rules.xml

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE rules SYSTEM "https://resources.jetbrains.com/writerside/1.0/redirection-rules.dtd">
3+
<rules>
4+
<!-- format is as follows
5+
<rule id="<unique id>">
6+
<accepts>page.html</accepts>
7+
</rule>
8+
-->
9+
<rule id="472f6315">
10+
<description>
11+
<![CDATA[Created after removal of "<Hold.md>" from reamberPy]]></description>
12+
<accepts>Hold.html</accepts>
13+
</rule>
14+
<rule id="757dd3ba">
15+
<description>
16+
<![CDATA[Created after removal of "<Hit.md>" from reamberPy]]></description>
17+
<accepts>Hit.html</accepts>
18+
</rule>
19+
<rule id="39ac902d">
20+
<description>Created after removal of "Base Lists" from reamberPy
21+
</description>
22+
<accepts>lists.html</accepts>
23+
</rule>
24+
<rule id="717e67d0">
25+
<description>Created after removal of "Base" from reamberPy
26+
</description>
27+
<accepts>Base.html</accepts>
28+
</rule>
29+
<rule id="2f547111">
30+
<description>Created after removal of "Algorithms" from reamberPy
31+
</description>
32+
<accepts>Algorithms.html</accepts>
33+
</rule>
34+
</rules>

Diff for: Writerside/topics/devInfo/DevInfo.md

+88
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
# Development Info
2+
3+
## Base
4+
5+
See also [Building Blocks](BuildingBlocks.md)
6+
7+
Base contains a few **item** classes
8+
9+
- `Timed`
10+
- `Bpm`
11+
- `Note`
12+
- `Hit`
13+
- `Hold`
14+
15+
These are different from the **item list** classes
16+
17+
- `TimedList`
18+
- `BpmList`
19+
- `NoteList`
20+
- `HitList`
21+
- `HoldList`
22+
23+
The reason for separating them is so that we can custom implement list methods that Python `list` class does not
24+
provide.
25+
26+
**Each Item** uses a `pd.Series`. **Each List** uses a `pd.DataFrame`.
27+
28+
`Item.data` will yield a `pd.Series`.
29+
30+
`ItemList.df` will yield a `pd.DataFrame`.
31+
32+
We use `pd` because it helps in optimization and provides abundant functionalities to extend from.
33+
34+
## Item Structure
35+
36+
**Bolded** elements are new properties introduced in the child class.
37+
38+
### Timed
39+
40+
Props: **offset**
41+
42+
### Note(Timed)
43+
44+
Props: **column**, offset
45+
46+
### Hit(Note)
47+
48+
Props: column, offset
49+
50+
### Hold(Note)
51+
52+
Props: **length**, column, offset
53+
54+
### Bpm(Timed)
55+
56+
Props: **bpm**, **metronome**, offset
57+
58+
## Item List Structure
59+
60+
For each corresponding **Item**, there is its list part, which provides additional functionality
61+
62+
- `TimedList`
63+
- `NoteList(TimedList)`
64+
- `HitList(NoteList)`
65+
- `HoldList(NoteList)`
66+
- `BpmList(TimedList)`
67+
68+
## Map Structure
69+
70+
Every map is a `@dataclass`.
71+
72+
For each map, it has an `objs` dictionary of `TimedList` children. This is the default.
73+
74+
```python
75+
from reamber.base.lists.notes.HitList import HitList
76+
from reamber.base.lists.notes.HoldList import HoldList
77+
from reamber.base.lists.BpmList import BpmList
78+
79+
objs = dict(hits=HitList([]), holds=HoldList([]), bpms=BpmList([]))
80+
```
81+
82+
In other words, it always initializes with these classes, but inheriting classes can override `objs`.
83+
84+
Overriding updates the classes, where it should opt for `OsuHoldList` instead of `HoldList`.
85+
86+
## MapSet Structure
87+
88+
A `MapSet` is simply a list of `Map` s.

Diff for: Writerside/topics/devInfo/Props.md

+104
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
# Generating Properties on the Fly
2+
3+
reamberPy uses decorators that create "properties".
4+
5+
As outlined in the [Type Hinting](TypeHinting.md)`, most objects use `
6+
pd.Series` or
7+
`pd.DataFrame` data classes. One trick with these is that they can be indexed
8+
with `[]` or `.`.
9+
10+
```python
11+
import pandas as pd
12+
13+
srs: pd.Series
14+
assert srs.offset == srs['offset']
15+
16+
df: pd.DataFrame
17+
assert df.offset == df['offset']
18+
```
19+
20+
<deflist collapsible="true" default-state="collapsed">
21+
<def title="Why Pandas?">
22+
Pandas is an extension of NumPy with useful column-based operations, suitable
23+
for this. While I could've customized my
24+
own library, it'll be too much of a liability of maintenance.
25+
26+
It provides excellent functions, on top of its indexing, with good performance
27+
on correct usage.
28+
</def>
29+
</deflist>
30+
31+
## Item Prop Decorators
32+
33+
The custom `Property` decorators grabs the class' attribute `_props` and
34+
generates the functions.
35+
36+
For example, `@item_props()` uses `_props` and generates the following
37+
functions.
38+
39+
<tabs>
40+
<tab title="Pre-Decorated">
41+
<code-block lang="python">
42+
from reamber.base import item_props
43+
from reamber.osu import OsuTimingPointMeta
44+
from reamber.base.Timed import Timed
45+
@item_props()
46+
class OsuSv(OsuTimingPointMeta, Timed):
47+
_props = dict(multiplier=['float', 1.0])
48+
</code-block>
49+
</tab>
50+
<tab title="Post-Decorated">
51+
<code-block lang="python">
52+
from reamber.osu import OsuTimingPointMeta
53+
from reamber.base.Timed import Timed
54+
import pandas as pd
55+
class OsuSv(OsuTimingPointMeta, Timed):
56+
@property
57+
def multiplier(self) -&gt; pd.Series:
58+
return self.data['multiplier']
59+
@multiplier.setter
60+
def multiplier(self, val) -&gt; None:
61+
self.data['multiplier'] = val
62+
</code-block>
63+
</tab>
64+
</tabs>
65+
66+
As shown, the dictionary automatically creates the property functions.
67+
68+
## List Prop Decorators
69+
70+
Similar to Item Prop Decorators, this affects lists
71+
72+
<tabs>
73+
<tab title="Pre-Decorated">
74+
<code-block lang="python">
75+
from reamber.base.Property import list_props
76+
from reamber.osu.OsuSv import OsuSv
77+
from reamber.base.lists.TimedList import TimedList
78+
@list_props(OsuSv)
79+
class OsuSvList(TimedList[OsuSv]):
80+
...
81+
</code-block>
82+
</tab>
83+
<tab title="Post-Decorated">
84+
<code-block lang="python">
85+
from reamber.base.lists.TimedList import TimedList
86+
from reamber.osu.OsuSv import OsuSv
87+
import pandas as pd
88+
class OsuSvList(TimedList[OsuSv]):
89+
@property
90+
def multiplier(self) -&gt; pd.Series:
91+
return self.df['multiplier']
92+
@multiplier.setter
93+
def multiplier(self, val) -&gt; None:
94+
self.df['multiplier'] = val
95+
</code-block>
96+
</tab>
97+
</tabs>
98+
99+
As shown, it uses the `OsuSv` class' dictionary to generate the property
100+
functions.
101+
102+
> Without meta-programming decorators, this would have caused many consistency
103+
> issues.
104+
{style='note'}

0 commit comments

Comments
 (0)