Comments (14)
@demberto the only place Parser
is instantiated is in conftest.py.
Refactoring from static class methods to module methods with satisfy the ticket.
https://stackoverflow.com/questions/31875/is-there-a-simple-elegant-way-to-define-singletons
from pyflp.
@ryanlong1004 What about static class counts? _FLObject._count
? _FLObject._ppq
? How would you manage two sets of static variables, for example at the same time?
from pyflp.
I don't think those are necessary.
- Mostly,
self
is being used to call other class methods. - You should never have to 'reset' static variables. They should either be class methods to count instances or don't need to exist.
- All of the __private methods indicate (IMHO) they should be module methods that can, if needed, be called via an exposed class method.
- All of the self.__parse_xyz(ev), those should be props and ev should be a prop of that class.
EDIT: I know saying things like "never" are hyperbole, but they are code smells.
from pyflp.
"""Reset static variables. This allows multiple instances of
Parser
in a single instance of the interpreter. HOWEVER THIS DOESN'T WORK FOR
USING MULTIPLE INSTANCES AT THE SAME TIME."""
Use instances if you need to.
from pyflp.
For a long amount of time I always thought of how I should structure the parser. I feel count is useless anyways. Your __parse_xyz idea is good but how do I implement it?
from pyflp.
Can I do a little refactoring and submit a PR for you to look at?
from pyflp.
Sure, sure π€
from pyflp.
@ryanlong1004 any updates?
from pyflp.
@demberto I did some work a week or so back. Let me see if I can get a PR over.
from pyflp.
I'm bowing out. π
from pyflp.
Bruh.
from pyflp.
@staticmethod
def __reset_static_vars() -> None:
#TODO Get rid of
"""Reset static variables. This allows multiple instances of `Parser`
in a single instance of the interpreter. HOWEVER THIS DOESN'T WORK FOR
USING MULTIPLE INSTANCES AT THE SAME TIME."""
_FLObject._count = 0 #TODO get rid of eventually
_Event._count = 0 #TODO get rid of eventually
for subclass in _FLObject.__subclasses__():
subclass._count = 0
Parser manipulates Events and the FLV(?) by directly changing each's class attributes to keep track. Then there's a reset
method that also acts directly on those class attributes as well, then acts on all it's sub-classes class attributes as well but dynamically.
Sorry, but after looking into it a bit more, I don't have enough time to be the guy that breaks it.
from pyflp.
@ryanlong1004 It just resets the _count
variable for all _Event
and _FLObject
subclasses. There is no reset
method. Also what is "FLV"? Thanks anyways.
from pyflp.
Fixed in 1.1.0
from pyflp.
Related Issues (20)
- π Custom enums broken in construct-typing 0.5.4 HOT 2
- π `VSTPlugin.plugin_path` setter fails HOT 1
- π `RuntimeWarning: VSTPluginEvent: Unknown marker 6 detected` HOT 3
- π Unlocking trial project fails on FL's latest version HOT 2
- π`Arrangements.loop_pos` doesn't work
- π Unlocking FLP does not work. HOT 6
- π `ChannelID.Parameters["fx.start"]` not always a `LogNormal` HOT 5
- π `VSTPlugin.name` encoded in UTF8 HOT 2
- πCan't unlock Sytrus HOT 3
- β¨ Comprehensive bounds checking for event values
- β¨ Stream and buffer support for `parse` and `save`
- β¨ Fruity Parametric EQ 2 parser HOT 1
- π UserWarning: Cannot parse event ArrangementID.Playlist HOT 1
- the worst doc i seeπ HOT 1
- π Python 3.12 Enum issue HOT 5
- β¨ Additional research into unknown fields HOT 2
- π FL 12 `fx.start` - `LogNormal` (duplicate) HOT 3
- π Example Code of "Implementing a plugin data parser" doesn't work
- π FLPEdit should be updated to an SDK-Project HOT 1
- β¨ MixerParamsEvent channel_data "type" field or similar
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pyflp.