Skip to content

Commit

Permalink
[Global] Cleaned code
Browse files Browse the repository at this point in the history
  • Loading branch information
YanSte committed Aug 8, 2023
1 parent fc5cd6a commit b524e76
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 58 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
Changelog
=========

Version 0.1
Version 0.1.4
===========

- Feature A added
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ SKit is an innovative Python library that simplifies the deployment process of M
You can install SKit using pip:

```
pip install SKit
pip install git+https://github.com/YanSteph/SKit.git
```

## Usage
Expand All @@ -34,7 +34,7 @@ The complete documentation for SKit will come soon.

## Contributing

Contributions are always welcome!
Contributions are always welcome!

## License

Expand Down
12 changes: 8 additions & 4 deletions src/skit/dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -225,12 +225,16 @@ def tf_shuffle_dataset(dataset, batch_size, seed):
Shuffles a TensorFlow dataset memory-preservingly using a batch-based method and also shuffles the batches themselves.
Args:
- dataset (tf.data.Dataset): The input dataset to shuffle.
- batch_size (int): Size of each batch.
- seed (int, optional): Seed for shuffle reproducibility.
- dataset :tf.data.Dataset
The input dataset to shuffle.
- batch_size : int
Size of each batch.
- seed : int, optional
Seed for shuffle reproducibility.
Returns:
- tf.data.Dataset: Shuffled dataset.
- tf.data.Dataset:
Shuffled dataset.
Example:
--------
Expand Down
52 changes: 1 addition & 51 deletions src/skit/main.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,8 @@



# ---- Gobal import ----

import skit.config as config
from skit.ModelMetrics import ModelMetrics

# TODO
import argparse
import logging
import sys
Expand All @@ -19,53 +15,19 @@

_logger = logging.getLogger(__name__)


# ---- Python API ----
# The functions defined in this section can be imported by users in their
# Python scripts/interactive interpreter, e.g. via
# `from skit.skeleton import fib`,
# when using this Python module as a library.


def fib(n):
"""Fibonacci example function
Args:
n (int): integer
Returns:
int: n-th Fibonacci number
"""
assert n > 0
a, b = 1, 1
for _i in range(n - 1):
a, b = b, a + b
return a


# ---- CLI ----
# The functions defined in this section are wrappers around the main Python
# API allowing them to be called directly from the terminal as a CLI
# executable/script.


def parse_args(args):
"""Parse command line parameters
Args:
args (List[str]): command line parameters as list of strings
(for example ``["--help"]``).
Returns:
:obj:`argparse.Namespace`: command line parameters namespace
"""
parser = argparse.ArgumentParser(description="Just a Fibonacci demonstration")
parser = argparse.ArgumentParser(description="This step is in progress")
parser.add_argument(
"--version",
action="version",
version=f"skit {__version__}",
)
parser.add_argument(dest="n", help="n-th Fibonacci number", type=int, metavar="INT")
parser.add_argument(
"-v",
"--verbose",
Expand Down Expand Up @@ -98,20 +60,8 @@ def setup_logging(loglevel):


def main(args):
"""Wrapper allowing :func:`fib` to be called with string arguments in a CLI fashion
Instead of returning the value from :func:`fib`, it prints the result to the
``stdout`` in a nicely formatted message.
Args:
args (List[str]): command line parameters as list of strings
(for example ``["--verbose", "42"]``).
"""
args = parse_args(args)
setup_logging(args.loglevel)
_logger.debug("Starting crazy calculations...")
print(f"The {args.n}-th Fibonacci number is {fib(args.n)}")
_logger.info("Script ends here")


def run():
Expand Down

0 comments on commit b524e76

Please sign in to comment.