semvec/pypi-packages huggingface dataset:
insightfacewrapper 0.0.4
Wrapper over insightface for a more convenient inference.
License: MIT

# insightfaceWrapper
Wrapper for easier inference for insightface

## Install
```
pip install -U insightfacewrapper
```

## Models

* `ms1mv3_arcface_r18`
* `ms1mv3_arcface_r34`
* `ms1mv3_arcface_r50`
* `ms1mv3_arcface_r100`
* `glint360k_cosface_r18`
* `glint360k_cosface_r34`
* `glint360k_cosface_r50`
* `glint360k_cosface_r100`


```python
from insightfacewrapper.get_model import get_model
model = get_model(<model_name>)
model.eval()
```

### Inference

Based on the original
[inference script](https://github.com/deepinsight/insightface/blob/master/recognition/arcface_torch/inference.py),
image should be resized to `(112, 112)`.

```python
def normalize(image: np.ndarray) -> np.ndarray:
    image /= 255
    image -= 0.5
    image /= 0.5
    return image

def image2input(image: np.ndarray) -> np.ndarray:
    transposed = np.transpose(image, (2, 0, 1)).astype(np.float32)
    return normalize(np.expand_dims(np.ascontiguousarray(transposed), 0))

torch_input = image2input(image)

with torch.inference_engine():
    result = model(torch_input)[0].cpu().numpy()
```
regex-spm 1.0.0
Enable Structural Pattern Matching for Python regular expressions
License: MIT
Requires Python: >=3.10

# regex_spm

Enable Structural Pattern Matching ([PEP-634](https://peps.python.org/pep-0634/)) for Python 
regular expressions

The string goes in the place of the subject, wrapped by a `regex_spm` function.<br>
The various possible regex patterns go after the `case`s.

### Simple example

```python
import regex_spm

match regex_spm.fullmatch_in("abracadabra"):
  case r"\d+": print("It's all digits")
  case r"\D+": print("There are no digits in the search string")
  case _: print("It's something else")
```

`regex_spm` provides 3 functions, which correspond to `re` search functions:
- `re.search` → `regex_spm.search_in`
- `re.match` → `regex_spm.match_in`
- `re.fullmatch` → `regex_spm.fullmatch_in`

### Accessing the match object
To access the matched groups or the entire `re.Match` object, simply capture the pattern:
```python
match regex_spm.fullmatch_in("123,45"):
  case r"(\d+),(?P<second>\d+)" as m:
    print("Notice the `as m` at the end of the line above")
    print(f"The first group is {m[1]}")
    print(f"The second group is {m['second']}")
    print(f"The full `re.Match` object is available as {m.match}")
```

### Pattern caveats (workaround below)

**#1:** Due to the mechanics of Python SPM, it is not possible to use case blocks like `case 
re.compile(r"my-regex"): ...`. Python would try to use `re.compile` as a class name, which does not
exist.

**#2:** It is also not possible to save patterns to simple local variables like:
```python
pattern1 = r"my-first-pattern"
pattern2 = re.compile(r"my-second-pattern")
match regex_spm.search_in(my_string):
  case pattern1: print("This does not work, it matches any string. Python interprets `pattern1` "
                       "as simply a new capture variable name, hiding its previous value.")
  case pattern2: print("This does not work either")
```

### Using patterns from variables (caveat workaround)
Python requires "value patterns" to use a "dotted name", i.e. there must be a `.` in tha name used 
to reach the stored pattern. 

Putting stored patterns in a class like below is sufficient.

```python
class PageRegexes:
  index = re.compile(r"example\.com/index.html")
  shopping_cart = r"example\.com/shopping_cart.html"

match regex_spm.search_in(my_url):
  case PageRegexes.index: print("It's the index page")
  case PageRegexes.shopping_cart: print("It's the shopping cart page")
  case r"example\.com/about.html": print("You can even mix and match")
```

## Install
Requires Python 3.10+ of course
```bash
pip install regex_spm
```
staircase-test 0.0.5
Simple step-based testing framework.
License: MIT
Requires Python: >=3.10
Keywords: testing framework test-framework step-testing

## staircase

A simple, step-based testing framework.

Useful for tests with complex setups, teardowns, and dependencies between the tests.

### Getting Started

#### Defining A Test

Tests are defined in staircase via classes that inherit from the base test class.

```python
from staircase import StaircaseTest


class MyTest(StaircaseTest):
    pass
```

#### Adding Steps

Steps in staircase are broken up into 3 main "flights" (groups of steps):

1) Setup
2) Main (consists of `Task` and `Test` steps)
3) Teardown

All qualifying `Setup` steps are run before any main steps (`Task` and `Test`), and those steps are run before any
qualifying `Teardown` steps.

Steps are defined as methods on the class and wrapped in decorators that designate their type.

Steps return a tuple or a pass/fail bool:

- `return pass/fail bool, return value`
- `return pass/fail bool` (None return value)

```python
from staircase import StaircaseTest, Setup, Task, Test, Teardown


class MyTest(StaircaseTest):
    @Setup
    def my_setup_step(self):
        return True, 'Successfully setup.'

    @Task
    def prime_the_file(self):
        return True

    @Test
    def file_has_correct_contents(self):
        return True

    @Teardown
    def delete_artifacts(self):
        try:
            self._delete('...')
            return True
        except:
            return False, 'Exception occurred'
```

Dependencies can also be added between the steps. They will only run if their dependency
passes or fails, depending on the specified condition. Steps without dependencies will be run in an
arbitrary order (within their respective flights).

```python
from staircase import StaircaseTest, Setup, Task, Test, Teardown


class MyTest(StaircaseTest):
    @Setup
    def my_setup_step(self):
        return True, 'Successfully setup.'

    @Task(on_pass='my_setup_step')
    def prime_the_file(self):
        return True

    @Test
    def file_has_correct_contents(self):
        return True

    @Teardown(desc='Delete unprimed file', on_fail='prime_the_file')
    def delete_artifacts(self):
        try:
            self._delete('...')
            return True
        except:
            return False, 'Exception occurred'
```

### Running Tests
Tests can be run by instantiating the class and calling the `run` method.

```python
test = MyTest()
test.run()
```
barb 0.2.5
Hassle free git hooks for python projects.
License: MIT
Requires Python: >=3.5
Keywords: hooks git githooks automation git-hooks git-hook

# barb
Hassle-free, cross-platform git hooks for python projects

![PyPi Download](https://img.shields.io/pypi/v/barb)
![PyPi Download](https://img.shields.io/pypi/l/barb)

[//]: # (![PyPi Download]&#40;https://img.shields.io/pypi/pyversions/barb&#41;)

## Installation
`pip install barb`

## Initializing a new project
`barb init`

Running this command both initializes the `.barb` directory as well as runs the `barb install` command.

## Installing barb
To register the hooks under the `.barb` directory with git, run `barb install`

## Creating a hook
Create a script under the `.barb` directory with the same name as the git hook you are attempting to create.

You can create two types of scripts to work as hooks:
- The standard shell script, which will be executed by the operating system's default cli.  
ex.
```shell
./.barb/pre-commit
---
#!/bin/sh
echo "Hello, World!"
```
- A python script. The script will enter at the `hook()` function. Not all hooks pass arguments, but those that provide
them do so via the args parameter.
```shell
./.barb/pre-push.py
---
def hook(*args):
  print('Hello, World!')
```
_Exceptions and False return values from this function will be considered hook failures._

Hooks can be organized in one of two ways. Top level files will be run on each os, without consideration:
```
.barb
â”œâ”€â”€ pre-commit
â””â”€â”€ post-rewrite.py
```

Alternatively, when organized in folders, different scripts can be set to run depending on the operating system:
```
.barb
â””â”€â”€ post-rewrite
    â”œâ”€â”€ linux.py
    â”œâ”€â”€ darwin
    â””â”€â”€ windows.ps1
```

## .barbrc.toml
A configuration file is automatically created when the command `barb init` is run. The following are valid configurations
- `os-lock`
  - If enabled, git hooks will only attempt to execute on the specified operating system. Otherwise, they will be skipped.
  - ex. `os-lock = windows`
- `[os.$OS$.$FILE_EXT$]`
  - `interpreter`
    - The name (or path) of the interpreter to use for the file extension.
  - `args`
    - A list of arguments for the interpreter.
    - Note: the arguments are placed before the git hook path.
  - ```shell
    # Special Case: default interpreter for file ext with no interpreter specified
    [os.linux.default] 
    interpreter = 'bash'
  - ```shell
    # executes ps1 files as "powershell -ExecutionPolicy Unrestricted -File ./.barb/git-hook-name.ps1"
    [os.windows.ps1]
    interpreter = 'powershell'
    args = ['-ExecutionPolicy', 'Unrestricted', '-File']

### TODO:
- line endings, `barb sanitize` to sanitize the hooks?
ZTTT 0.0.4
A Tic Tac Toe Library with a near perfect engine
License: MIT
Requires Python: >=3.6

# ZTTT

## Installation
``pip install ZTTT``

## Project Structure

```txt
ZTicTacToe
├── examples
│   └── __init__.py
│
├── src
│   └── ZTTT
│       ├── ZTBase
│       │   ├── __init__.py
│       │   ├── ZTBaseBoard.py
│       │   └── ZTBaseEngine.py
│       ├── ZTEngines
│       │   ├── __init__.py
│       │   ├── ZTEngineFirst.py
│       │   └── ZTPlayerFirst.py
│       ├── ZTErrors
│       │   ├── __init__.py
│       │   └── ZTErrors.py
│       ├── __init__.py
│       ├── PvC.py
│       └── PvP.py
│
├── tests
│   ├── __init__.py
│   └── test.py
│
├── .gitignore
├── LICENSE.txt
├── README.md
└── setup.py
```

## Usage
Examples will be eventually uploaded
```python
from ZTTT import PvP, PvC

b = PvP()

if b.status:
    b.play(0)  # Player 1 plays in the top Right
    
if b.status:
    b.play(1)  # Player 2 plays in the top Middle
```
npmpy 0.1.0
Curate Neurophotometrics data for pMat
License: MIT
Requires Python: >=3.9,<4.0

# Python code for curating Neurophotometrics data

This code was written to curate [Neurophotometrics (NPM)](https://neurophotometrics.com/) data for analysis in [pMat](https://github.com/djamesbarker/pMAT). In short, the NPM data is saved into two files: one containing the 415 control signals for every region recorded and the other the 470 gcamp signals for all regions recorded. However, pMat (currently) requires the opposite: one .csv files for each region that contains both the 415 and 470 signal. This requires quite a lot of copy and pasting which is tedious and prone to errors. This code was developed to automate this process.

## How to use this code?

A specific file structure is necessary for using the NPM python module for curating Neurophotometric data. The below example is a minimum necessary structure for the code to work. In short, you must input a directory that contains subdirectoriesfor each subject that contain the raw NPM data files (which also need to be renamed to .NPM.csv in order to be detected).

```
Data/      <---- This is the directory (path) that should be input to the curate_NPM() function. 
|-- Rat1/
|   |-- Rat1_415_data.npm.csv
|   |-- Rat1_470_data.npm.csv
|-- Rat2/
|   |-- Rat2_415_data.npm.csv
|   |-- Rat2_470_data.npm.csv
| ...
|-- RatN/
|   |-- RatN_415_data.npm.csv
|   |-- RatN_470_data.npm.csv
```


For a more general project file tree, I highly recommend something like the following to keep all of the experimental days and freezing data organized.

```
Data/
|-- Day1/          <---- This is the directory (path) that should be input to the "curated_NPM()" function. 
|   | -- Rat1/
|   |   |-- Rat1_415_data.npm.csv
|   |   |-- Rat1_470_data.npm.csv
|   |   |-- Freezing data/
|   |   |   |-- freezing_files       <---- Notice that freezing files are kept in their own folder
|
|-- Day2/           <---- This is the directory (path) that should be input to the "curated_NPM()" function. 
|   | -- Rat1/
|   |   |-- Rat1_415_data.npm.csv
|   |   |-- Rat1_470_data.npm.csv
|   |   |-- Freezing data/
|   |   |   |-- freezing_files
```

### General work flow

1. Organize the data into the above file structure
2. Rename all NPM data to have ".NPM.csv" at the end
3. Open your desired IDE (jupyter, spyder, etc)
4. Import this module 
    
    ``` import NPMpy as NPM```
    
5. Run curate_NPM(path_to_your_data)
6. Done!