Skip to content

Commit

Permalink
🎨 Restructure code
Browse files Browse the repository at this point in the history
  • Loading branch information
le-ander committed Mar 7, 2025
1 parent af4929e commit 6bb49f7
Show file tree
Hide file tree
Showing 9 changed files with 127 additions and 102 deletions.
4 changes: 2 additions & 2 deletions src/devvi/__init__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from importlib.metadata import version

from . import pl, pp, tl
from . import model

__all__ = ["pl", "pp", "tl"]
__all__ = ["model"]

__version__ = version("devVI")
1 change: 1 addition & 0 deletions src/devvi/model/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from .devvi_model import BasicClass, basic_plot
124 changes: 124 additions & 0 deletions src/devvi/model/devvi_model.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,124 @@
# import lightning as L
# import torch
# import torch.nn.functional as F
# from torch.utils.data import DataLoader

from torch import nn


def basic_plot(adata: nn.Module) -> int:
"""Generate a basic plot for an AnnData object.
Parameters
----------
adata
The AnnData object to preprocess.
Returns
-------
Some integer value.
"""
print("Import matplotlib and implement a plotting function here.")
return 0


class Encoder(nn.Module):
"""A basic class.
Parameters
----------
adata
The AnnData object to preprocess.
"""

def __init__(self):
super().__init__()
self.l1 = nn.Sequential(nn.Linear(28 * 28, 64), nn.ReLU(), nn.Linear(64, 3))

def forward(self, x):
"""Generate a basic plot for an AnnData object.
Parameters
----------
adata
The AnnData object to preprocess.
Returns
-------
Some integer value.
"""
return self.l1(x)


class Decoder(nn.Module):
"""A basic class.
Parameters
----------
adata
The AnnData object to preprocess.
"""

def __init__(self):
super().__init__()
self.l1 = nn.Sequential(nn.Linear(3, 64), nn.ReLU(), nn.Linear(64, 28 * 28))

def forward(self, x):
"""Generate a basic plot for an AnnData object.
Parameters
----------
adata
The AnnData object to preprocess.
Returns
-------
Some integer value.
"""
return self.l1(x)


class BasicClass:
"""A basic class.
Parameters
----------
adata
The AnnData object to preprocess.
"""

my_attribute: str = "Some attribute."
my_other_attribute: int = 0

def __init__(self, adata: nn.Module):
print("Implement a class here.")

def my_method(self, param: int) -> int:
"""A basic method.
Parameters
----------
param
A parameter.
Returns
-------
Some integer value.
"""
print("Implement a method here.")
return 0

def my_other_method(self, param: str) -> str:
"""Another basic method.
Parameters
----------
param
A parameter.
Returns
-------
Some integer value.
"""
print("Implement a method here.")
return ""
1 change: 0 additions & 1 deletion src/devvi/pl/__init__.py

This file was deleted.

63 changes: 0 additions & 63 deletions src/devvi/pl/basic.py

This file was deleted.

1 change: 0 additions & 1 deletion src/devvi/pp/__init__.py

This file was deleted.

17 changes: 0 additions & 17 deletions src/devvi/pp/basic.py

This file was deleted.

1 change: 0 additions & 1 deletion src/devvi/tl/__init__.py

This file was deleted.

17 changes: 0 additions & 17 deletions src/devvi/tl/basic.py

This file was deleted.

0 comments on commit 6bb49f7

Please sign in to comment.