semvec/pypi-packages huggingface dataset:
tcs-pythonwhat 2.24.21
Submission correctness tests for Python

# pythonwhat

[![Build Status](https://travis-ci.org/datacamp/pythonwhat.svg?branch=master)](https://travis-ci.org/datacamp/pythonwhat)
[![PyPI version](https://badge.fury.io/py/pythonwhat.svg)](https://badge.fury.io/py/pythonwhat)
[![Documentation Status](https://readthedocs.org/projects/pythonwhat/badge/?version=stable)](http://pythonwhat.readthedocs.io/en/stable/?badge=stable)
[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fdatacamp%2Fpythonwhat.svg?type=shield)](https://app.fossa.io/projects/git%2Bgithub.com%2Fdatacamp%2Fpythonwhat?ref=badge_shield)

Verify Python code submissions and auto-generate meaningful feedback messages. Originally developed for Python exercises on DataCamp for so-called Submission Correctness Tests, but can also be used independently.

- New to teaching on DataCamp? Check out https://instructor-support.datacamp.com
- To learn what SCTs are and how they work, visit [this article](https://instructor-support.datacamp.com/courses/course-development/submission-correctness-tests) specifically.
- For a complete overview of all functionality inside pythonwhat and articles about what to use when, consult https://pythonwhat.readthedocs.io.

## Installation

```bash
# latest stable version from PyPi
pip install pythonwhat

# latest development version from GitHub
pip install git+https://github.com/datacamp/pythonwhat
```

## Demo

To experiment locally, you can use `setup_state()` and write SCTs interactively.
The code throws an error when the underlying checks fail.

```python
# make all checking functions available
from pythonwhat.test_exercise import prep_context
_, ctxt = prep_context()
globals().update(ctxt)

# initialize state with student and solution submission
from pythonwhat.test_exercise import setup_state
setup_state(stu_code = "x = 5", sol_code = "x = 4")

Ex().check_object('x')
# No error: x is defined in both student and solution process

Ex().check_object('x').has_equal_value()
# TestFail: Did you correctly define the variable `x`? Expected `4`, but got `5`.

# Debugging state
Ex()._state               # access state object
dir(Ex()._state)          # list all elements available in the state object
Ex()._state.student_code  # access student_code of state object
```

To learn how to include an SCT in a DataCamp course, visit https://instructor-support.datacamp.com.

## Run tests

```bash
pyenv local 3.9.6
pip3.9 install -r requirements.txt
pip3.9 install -e .
pytest
```

## Contributing

Bugs? Questions? Suggestions? [Create an issue](https://github.com/datacamp/pythonwhat/issues/new), or [contact us](mailto:content-engineering@datacamp.com)!


## License

[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fdatacamp%2Fpythonwhat.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2Fdatacamp%2Fpythonwhat?ref=badge_large)
tcs-protowhat 2.1.4
Prototype package for submission correctness testing

# protowhat

[![Build Status](https://travis-ci.org/datacamp/protowhat.svg?branch=master)](https://travis-ci.org/datacamp/protowhat)
[![codecov](https://codecov.io/gh/datacamp/protowhat/branch/master/graph/badge.svg)](https://codecov.io/gh/datacamp/protowhat)
[![PyPI version](https://badge.fury.io/py/protowhat.svg)](https://badge.fury.io/py/protowhat)
[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fdatacamp%2Fprotowhat.svg?type=shield)](https://app.fossa.io/projects/git%2Bgithub.com%2Fdatacamp%2Fprotowhat?ref=badge_shield)

`protowhat` is a utility package required by `shellwhat` and `sqlwhat` packages, used for writing Submission Correctness Tests SCTs for interactive Shell and SQL exercises on DataCamp. It contains shared functionality related to SCT syntax, selectors and state manipulation.

- If you are new to teaching on DataCamp, check out https://instructor-support.datacamp.com.
- If you want to learn what SCTs are and how they work, visit [this article](https://instructor-support.datacamp.com/courses/course-development/submission-correctness-tests) specifically.
- For a deep dive in `protowhat`, consult https://protowhat.readthedocs.io.

## Installation

```
pyenv local 3.9.0
pip3.9 install protowhat   # install from pypi
make install            # install from source
```

## Testing

```
pip3.9 install -e .
pytest
```


## License
[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fdatacamp%2Fprotowhat.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2Fdatacamp%2Fprotowhat?ref=badge_large)
beatit 2022.3.1
A simple backend agnostic heartbeating convention

# beatit

A simple backend agnostic heartbeating convention.

```Python
>>> class Printer:
...     @staticmethod
...     def publish(*, subject: bytes, payload: bytes):
...         print(f"{payload} -> {subject}")
>>> from beatit import Heart
>>> heart = Heart(process="my.process.identifier", publisher=Printer)
>>> heart.start(warmup=60)
b'start/60' -> b'heartbeat.my.process.identifier'
>>> heart.beat(period=5)
b'beat/5' -> b'heartbeat.my.process.identifier'
>>> heart.beat(period=5)
>>> heart.degraded(period=5)
b'degraded/5' -> b'heartbeat.my.process.identifier'
>>> heart.degraded(period=5)
>>> heart.stop()
b'stop' -> b'heartbeat.my.process.identifier'

```

All you need is a publisher with a `publish` method accepting two named arguments `subject` and `payload`.

Instantiate a `Heart` instance with a `process` name and a `publisher`. *beats* will be published on the subject `heartbeat.<process>`.

What are the *beats*?

`start` with a `warmup` period (after which a `beat` or a `degraded` is expected)

`beat` with a `period` (when to expect the next `beat`).

`degraded` with a `period` (when to expect a `beat` or a `degraded` next).

`stop` when the process stops gracefully.

sync or not ...
---------------

If you favour async (what is wrong with you?) Heart recognizes an async publisher automagically and all you have to do is await all the things.

```Python
>>> import asyncio
>>> class AsyncPrinter:
...     @staticmethod
...     async def publish(*, subject: bytes, payload: bytes):
...         print(f"{payload} -> {subject}")
>>> from beatit import Heart
>>> heart = Heart(process="my.process.identifier", publisher=AsyncPrinter)
>>> asyncio.run(heart.start(warmup=60))
b'start/60' -> b'heartbeat.my.process.identifier'
>>> asyncio.run(heart.beat(period=5))
b'beat/5' -> b'heartbeat.my.process.identifier'
>>> asyncio.run(heart.beat(period=5))
>>> asyncio.run(heart.degraded(period=5))
b'degraded/5' -> b'heartbeat.my.process.identifier'
>>> asyncio.run(heart.degraded(period=5))
>>> asyncio.run(heart.stop())
b'stop' -> b'heartbeat.my.process.identifier'

```

`subject_as_string`
-------------------

`beatit` calls `publish` with `bytes` subject and payload. Seemed consistent but common publishers favour `str` for subject.

Fear not, here is a @limx0 approved solution!

```Python
>>> class StrBytes:
...     @staticmethod
...     def publish(*, subject: str, payload: bytes):
...         print(f"{payload} -> {subject}")
>>> from beatit import Heart
>>> heart = Heart(process="my.process.identifier", publisher=StrBytes, subject_as_string=True)
>>> heart.start(warmup=30)
b'start/30' -> heartbeat.my.process.identifier

```
Json-X-Converter 0.0.4
Convert Api responst to CSV, XML, PDF or HTML file
Keywords: python


# Json_X_Converter

Under construction! Not ready for use yet! Currently experimenting and planning!

Developed by Snehal Borkar (c) 2022

## Examples of How To Use (Buggy Alpha Version)

Import classes

```python 
from Json_X_Converter.api_resp_flat  import ApiCallFlat
from Json_X_Converter.x_converter import XConverter

 
data=ApiCallFlat.api_call(url)
print(data)
df =ApiCallFlat.flatten_json(data)
print(df)

XConverter(df,"test.csv").df_csv()
```

Methods available in api_resp_flat module - ApiCallFlat class
api_call(url)-Call Api and returns json data
```python
ApiCallFlat.api_call(url)
```

flatten_json(data)- Take data of type <class: dict> as parameter flatten it and  converts to pandas dataframe
```python
ApiCallFlat.flatten_json(data)
```

api_callflat(url)- Take url  of type <class: str> make HTTP request, flatten response and convert to pandas dataframe
```python
ApiCallFlat.flatten_json(data)
```



Methods available in x_converter module - XConverter class

obj = XConverter(df,file_name)

obj.df_csv() 
obj.df_xml()
obj.df_html()
obj.df_pdf(html_filename)
Museum-API-conversions 0.0.6
Museum_API objects which converts in json form and then json to pdf,html,xml,csv formats
Requires Python: >=3.7
Keywords: API conversion,python API conversions,Museum_API_conversions


# Museum_API_conversions

Converts Museum_API objectIDs into pdf, html, csv and xml files.

## usage

Make sure you have python installed in your system

Run following command in command prompt

pip install Museum_API_conversions 

## Example

import Museum_API_conversions

api = Museum_API_conversions.MuseumAPI(Museum_API_url)

df = api.api_to_dataframe(1, 5)

The above step is must in order to convert dataframe into html, csv and xml

csv_file = 'Museum_API_5to8.csv'

html_file = 'Museum_API_5to8.html'

xml_file = 'Museum_API_5to8.xml'

pdf_file = 'Museum_API_5to8.pdf'

api.dataframe_to_csv(df, csv_file)


api.dataframe_to_html(df, html_file)


api.html_to_pdf(html_file, pdf_file)


api.dataframe_to_xml(df, xml_file)

## parameters

Museum_API(url=Museum_API_url)

url contains the url of Museum_API objectIDs

api.api_to_dataframe(st=None, sp=None)

default st and sp will be 0 to 50

if st parameter is None then by default it will be 0

if sp parameter is None then by default it will be st+50

## Note

objectIDs are between 0 and 830985
midastest 0.0.1
Gold testing toolkit
Requires Python: >=3.6
Keywords: gold snapshot test testing regression

# Midas - Python Gold Testing Toolkit

If you're tired of writing assertions like `assert my_func('input') == 'output'`, just tell `midas` your inputs and it will automate all the rest!

## Installation

```
pip install midastest
```

## Usage

Write a test using your favorite testing framework. You can use any framework as long as it's `pytest`:

```
import midas

@midas.test(format='lines')
def test_length(line):
    return str(len(line))
```

Create a file `test_length.in` with a few examples:

```
Hello
Foo

What a wonderful world
```

Run your testing tool:

```
pytest
# TODO: show complaining output
```

After inspecting the output, move it to a file called `test_length.gold`:

```
mv test_length.actual test_length.gold
```

Run your testing tool again:

```
pytest
```

It succeeds!

What happened is that `test_length.gold` contains the expected inputs and outputs of the tests, and running the tests compares actual outputs with expected outputs:

```
cat test_length.gold
{
  "Hello": "'5'",
  "Foo": "'3'",
  "": "'0'",
  "What a wonderful world": "'22'"
}
```

Try changing the code:

```
import pytest

@midas.test(format='lines')
def test_length(line):
    return str(len(line) * 2)
```

Run `pytest` again and watch your tests fail:

```
==================================================================== test session starts =====================================================================
platform darwin -- Python 3.8.9, pytest-7.0.1, pluggy-1.0.0
rootdir: /Users/aursaraf/dev/dojo/midas
collected 4 items                                                                                                                                            

tests/test_api.py FF.F                                                                                                                                 [100%]

[..]
__________________________________________________________ test_length[What a wonderful world-'22'] __________________________________________________________

[..]
expected = "'22'", actual = "'44'"

    def midas_assert(expected, actual):
>       assert expected == actual
E       AssertionError

midas/__init__.py:12: AssertionError
================================================================== short test summary info ===================================================================
FAILED tests/test_api.py::test_length[Hello-'5'] - AssertionError
FAILED tests/test_api.py::test_length[Foo-'3'] - AssertionError
FAILED tests/test_api.py::test_length[What a wonderful world-'22'] - AssertionError
================================================================ 3 failed, 1 passed in 0.03s =================================================================
```

## License

`midas` is distributed under the MIT license.
Sudoku-DCHEQUER 0.0.5
An Object Oriented Sudoku Game Generator
Requires Python: >=3.6

# Beginner Object Oriented Sudoku Board Generator

## Matrix Class
This class keeps track of the board with an instance variable called self.board
It is responsible for checking the rules of sudoku in order to make a move, it check to see which numbers to exclude from a cell's row, column and 3x3 square

The variable self.cellStack is a list of the last 5 cells that were changed in order to backtrack in case of the algorithm cornering itself

Finally, self.cells is just a flattened version of self.board for easy traversing.

## Cell Class
Each Cell gets initialized with 4 instance variables:
* self.row and self.col keep track of cell's position in the board
* self.options contains all the possible numbers that the cell could be
* self.num is the actual number it contains


## Main
The main function of the program is an example of how to create a board
* Create a Matrix Object
* Set the center cell (located at 4,4) to a random number utilizing `Matrix.changeBoard(self, cell:Cell)`  
  * Parameter cell is retrieved from using `Matrix.self.board[4][4]`
* Start a while loop that runs if `Matrix.cells` contains anything
* Get least number of choices of cell closest to being solved
  * Important to mention that each time `Matrix.changeBoard()` is called, it sorts `self.cells` to have the cells closest to being done in front
* Create a list of all cells that have *least number* amount of choices
* Randomly choose one cell from this list
* Call `Matrix.changeBoard()` with the random cell as the argument

## End
To use this module all you have to do is set `var_name = sudoku-oop.generateBoard()` and it will return a Matrix Object with your board