semvec/pypi-packages huggingface dataset:
bitbucket-hook-diffstat 0.5.2
Bitbucket push webhook handler to generate a list of files changed on a push
Requires Python: >=3.8,<4.0

# Bitbucket hook diffstat

## Overview

Bitbucket push webhook handler to generate a list of files changed on a push.

It processes branch updates/branch creates events and extracts the file paths of the files whose content was changed in that event, including the removal or creation of the file itself.
In the case of a branch update event, it gets the changeset between the current HEAD of the branch and the previous HEAD of that branch.
In case the branch is created, it gets the changeset between the current HEAD of the branch and the HEAD of the main branch of the repository.
It uses Bitbucket `diffstat`,  `repositories`, and `branches` APIs. It handles some basic retries on retyable HTTP response codes from BitBucket.
It aslo perform a basic validation by comparing the expected owner and repo details with the details recieved in the push event, but in addition one should take care of whitelisting Bitbucket public IPs on the server side to make that check efficient.
## Usage
```python
from bitbucket_hook_diffstat import process_bitbucket_push_events

result = process_bitbucket_push_events(
    push_payload, repo_owner, repo_name, bitbucket_user, bitbucket_password
) # it might raise an Exception, please check `bitbucket_hook_diffstat/exceptions.py`

result # Is a dict of a zero or more branch names - strings to the set of one or many file pathnames - strings.
{'master': {'.gitignore'}}
```

`push_payload` is a Bitbucket repository [push event](https://support.atlassian.com/bitbucket-cloud/docs/event-payloads/#Push)

`repo_owner` and `repo_name` one can retrieve from the repository URL `https://bitbucket.org/repo_owner/repo_name` 

`bitbucket_password` is an "app password" and `bitbucket_user` is available as "Username" in Bitbucket profile settings. This user should be authorized to do Repositories Read.
witertools 1.0.1
Witertools - Tools to wrap iterator functions, to consume the whole iterator and return a list.  Avoid sprinklist list(...)
Requires Python: >=3.0
Keywords: itertools,iterator,iteration,filter,peek,peekable,list,more-itertools

# witertools.

witertools provides:
- functions that take a function that returns and iterator, and return a function that returns list.  
- wrappers around built in functions that return iterators (filter, map, and zip)
- wrappers around the functions in itertools except count, cycle, and repeat
- wrappers around the functions in more_itertools 

The motivation as that itertools and more-itertools in particular have functions that return iterators, but very frequently 
the desired result is a list. Over and over in code you will see repeated code of calling list on the result of a function
that produces an interator.  You will even see it in most examples in the [more-itertools api](https://more-itertools.readthedocs.io/en/stable/api.html).  



## Wrappers Around Functions that Return Iterators
In witertools:
iterator_to_list_function will take a function that returns an iterable, and return a function that returns a list.

```
>>> from witertools import *
>>> f=iterator_to_list_function(filter)
>>> w.filter(lambda s: True, [3,4,5])     
[3, 4, 5]
```

iterator_name_to_list_function will take a module object and a function name, and return a function that returns a list.
```
>> g=iterator_name_to_list_function(__builtins__,"filter") 
>>> g(lambda s : True , [1,2]) 
[1, 2]
```

## Wrappers Around Built in Functions
To use a wrapper around a built in function, just use a function from the same name from the 
witertools package.
```
>>> import witertools as w 
>>> w.filter(lambda s: True, [3,4,5])
[3, 4, 5]
```

which replaces

```>>> list(filter(lambda s: True, [3,4,5]))
[3, 4, 5]
```

## Wrappers Around itertools 

Use a function from the witertools.itertools namespace, with the same name as the function in the itertools namespace.

```>>> import witertools.itertools as i      
>>> i.chain([1,3],[4,5])
[1, 3, 4, 5]
```

## Wrappers Around more-itertools

 Use a function from the witertools.more_itertools namespace, with the same name as the function in the more-itertools namespace.  You will need to install more-itertools to use these functions, as more-itertools as not a prequisite of witertools.

```
>>> from witertools.more_itertools import chunked
>>> chunked([1, 2, 3, 4, 5, 6], 3)
[[1, 2, 3], [4, 5, 6]]
```

There are a few functions in more_itertools that do not return iterables.  For example, nth_or_last.
These functions are still wrapped in witertools.more_itertools but will result in a traceback.

```
>>> from witertools.more_itertools import  nth_or_last
>>> nth_or_last([0, 1, 2, 3], 2)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Program Files (x86)\Python39-32\lib\site-packages\witertools\iterator_to_list.py", line 7, in as_list
    return list(iterator_function(*args,**kwargs))
TypeError: 'int' object is not iterable
```