Directory: rbardaji/mooda/mooda
It contains the code of the package.
The mooda/mooda directory structure is as follows:
- input: A directory that contains function codes that allow you to read data files to access data APIs and get WaterFrame objects.
- util: A directory that contains function codes that are not directly related to a WaterFrame object or are not the WaterFrame methods. For example, the code for making the Jupyter Notebook Widgets or the functionalities that need one or more WaterFrame objects as an input variable is here.
- waterframe: Contains the code generated by the WaterFrame object and its methods.
- init.py: File required to create the mooda package from the mooda/mooda directory. Contains the necessary imports to be able to access all files with code.
The methods of the mooda classes are written in separate files. In this way, adding new methods to a class is simple and does not jeopardize the operation of other methods already written.
The following is an example of how classes have been created in mooda. The example creates the Foo class, using the ‘bar’ and ‘other’ methods. The script main.py imports the Foo class and calls the Foo methods.
File structure:
main.py (file)
foo (directory)
|- __init__.py
|- bar.py
|- other.py
__init__.py:
This file defines the class and imports the methods that are in the bar.py and other.py.
class Foo:
from .bar import bar
from .other import other
def __init__(self, a, b):
self.a = a
self.b = b
bar.py:
def bar(self, a):
return f'a is {a}'
other.py:
def other(self, b):
return f'b is {b}'
main.py:
from foo import Foo
a = 1
b = 2
foo_main = Foo(a, b)
print('Return of Foo.bar():', foo_main.bar())
print('Return of Foo.other():', foo_main.other())
Output:
Return of Foo.bar(): a is 1
Return of Foo.other(): b is 2
Return to the documentation of the rbardaji/mooda folder.