semvec/pypi-packages huggingface dataset:
magnet 1.1.1
Hierarchical YAML config reader that reads from multiple files and an environment variable

# magnet

A library that makes it easy to load YAML config files in a hierarchical
manner. Also loads YAML content from `CONFIG` environment variable.

**Minimal Python version is Python 3.5.**

# Installation

```bash
pip install magnet
```

# Usage

Consider the following yaml file `config/default.yml`:

```yaml
app:
  url: https://www.example.com/app
  certs:
    pem: /path/to/cert.pem
    key: /path/to/cert.key
  clients:
    - a
    - b
```

And the following `config/local.yml` file:

```yaml
app:
  url: https://app.example.com/
```

```python
from magnet import Config

config = Config().read_all()

config['app.url']           # ==> "https://app.example.com"
config['app.certs.pem']     # ==> "/path/to/cert.pem"
config['non.existing.key']  # ==> raises KeyError
```

## Additional options:

```python
from magnet import Config

# Listed below are the default parameters 
config = Config(
    config={
        # set default configuration here
    },
    filenames=(
       'config/default.yml',
       'config/local.yml',
    ),
    env_variable='CONFIG',
    separator='.',
)

config.read_all(
  filename=None,  # string, can be set to load an additional file
)
```

This will load the configuration in the following order:

1. `./config/default.yml` - can be committed to the repository
2. `./config/local.yml` - should not be committed to allow custom config for devs
3. An additional YAML config file (if `filename` argument is defined)
4. YAML contents from the `CONFIG` environment variable (if `env_variable` is defined)

All of these files are optional, but the key lookups will result with
`KeyError` if a key is missing. If `filename` is defined, but the file is not
found, it will raise a `FileNotFoundError`.

# Development

```
make ci            - Run the CI pipeline (deps, lint, test-coverage)
make lint          - Lint all project files
make test          - Run all tests
make test-watch    - Run all tests and re-run on file changes
make test-coverage - Run all tests and calculate test coverage
make deps          - Create a virtual environment and install dependencies
make freeze        - Freeze the requirements
make env           - Create a virtual environment
```
torchure 0.0.14
A collection of small functions that supplements torch functionality

# TorchFun (originally Torchure)

##for those who expect more convenient features from torch
<!-- ### -- for those who suffer from torch -->

### Functionality

* flatten(tensor)
* imshow(tensor_batch)
* load

## Install TorchFun

```bash
pip install torchfun
```

## API

### Flatten (Module)
used to reshape outputs

Usage:

    flat = Flatten()
    out = flat(x)


### flatten (function)

Usage:

    out = flatten(x)


### imshow (function)

only deal with torch channel-first image batch,

Arguements:

* x: input data cube, torch tensor or numpy array.
* title: add title to plot. (Default None)
    * title can be string, or any string-able object.
* auto_close: (default True) 
    * Close the pyplot session afterwards. 
    * Clean the environment just like you had never used matplotlib here.
    * if set to False, the plot will remain in the memory for further drawings.

Usage:

imshow(batch)
imshow(batch,title=[a,b,c])
imshow(batch,title='title')
imshow(batch,auto_close=False) 

### load (function)
Arguements:
* arbitrary arguemnts named : `a` and `b`
Load weight `a` into model `b`, or load model `b` using weight `a`
The order of the arguments doesn't matter.
Example:

    >load('weights.pts',model)

or

    >load(model,'weights.pts')

or

    >f = open('weight.pts')
    >load(f,model)

or

    >load(model,f)

Return value:
* None