semvec/pypi-packages huggingface dataset:
bitcoind-mock 0.0.5
A tiny and non-exhaustive mock for bitcoind
Requires Python: >=3.6

# bitcoind mock

[![tippin.me](https://badgen.net/badge/%E2%9A%A1%EF%B8%8Ftippin.me/@sr_gi/F0918E)](https://tippin.me/@sr_gi)

bitcoind mock is an approach to simulate bitcoind for unit testing. It is specially useful for `Continuous integration 
(CI)` tools. 

The mock provides a `JSON-RPC` interface with some of the RPC commands available in `bitcoind` along with a `zmq` 
interface for transaction and block notification. The mock also provides additional endpoints to generate blocks on 
demand (`/generate`) and to create forks (`/fork`).

The mock can be run either by `time`, where blocks will be generated in fix time intervals, or by `events` where a block
will be generated each time `/generate` is called.

This are the current partially covered commands:

```
decoderawtransaction:   querying for the decoding of a raw transaction will return a dictionary with a single
                        field: "txid".

sendrawtransaction:     sending a rawtransaction will notify our mining simulator to include such transaction in
                        a subsequent block (add it to mempool).

getrawtransaction:      requesting a rawtransaction from a txid will return a dictionary containing a single
                        field: "confirmations", since rawtransactions are only queried to check whether a
                        transaction has made it to a block or not.

getblockcount:          the block count represents the length of the longest chain.

getblock:               querying for a block will return a dictionary with three fields: "tx" representing a
                        list of transactions, "height" representing the block height and "hash" representing the
                        block hash.

getblockhash:           returns the hash of a block given its height.

getbestblockhash:       returns the hash of the block in the tip of the chain.

help:                   help is only used as a sample command to test if bitcoind is running when bootstrapping.
                        It will return a 200/OK with no data.
```

## Known limitations

- The implemented commands do not return every single field that `bitcoind` would, only the most important ones (or the 
ones that I've required so for my own unit tests).

- The mock works well when interacting with via `python` but not if queried directly by `bitcoin-cli` (check [#1](https://github.com/sr-gi/bitcoind_mock/issues/1)).

- `zmq` only notifies about blocks being mined, but not about transactions.

- Requesting a fork while running the mock by `time` will not reset the timer for the block that will be mined on top of
the forked one.

### Dependencies

Refer to [DEPENCENCIES.md](DEPENDENCIES.md).

### Installation

You can get the package from PyPi:

`pip install bitcoind-mock`

Or install it manually (refer to [INSTALL.md](INSTALL.md)).

### Contributing

If you'd like to add / extend any command, feel free to send a PR. We can make this as complete as we'd like by joining 
efforts :smile:

Refer to [CONTRIBUTING.md](CONTRIBUTING.md) for the style guidelines to follow.
basic-card-hannu-hell 0.0.1
Basic card game functions
Requires Python: >=3.6

BASIC_CARD


This module is for anyone who is interested in creating their own card game. The functions included are self explanatory and allow to perform basic fucntions on an indidual card, deck of cards or individual hands. It uses the external pygame module to display the cards visually hence this can be used along with pygame module. It also uses the python in-built random module.


METHODS INCLUDED

- compare_cards(c1, c2) : Takes two arguments of which both are instances of the Card object. Returns the highest value of the card. 'A', 'K', 'Q' and so on are deemed highest in that order. Feel free to modify according to your needs.

- match_card(i, x, y): Takes three arguments. 'i' refers to the instance of the Card object. 'x' refers to the x coordinate and 'y' refers to the y coordinate the card should be blitted on the screen. x and y starts from the top left corner of the screen.

- have_suits(hand, s): Takes two arguments where 'hand' refers to a hand which is a list object with instances of the Card object. 's' refers to the suit which is a string ('hearts', 'clubs', 'spades', 'diamonds'). Returns a boolean of either True if have and False if not.

- least_high_card(c, hand): Takes two argumensts where 'c' refers to an instance of Card object. 'hand' refers to a list object containing instances of the Card object. Returns the highest card in the hand but lower than 'c'

- lowest_valuCard_of_suit(hand, s): Takes two arguements where 'hand' refers to a list object containing instances of the Card object. 's' refers to the suit which is a string ('hearts', 'clubs', 'spades', 'diamonds'). Returns the lowest value of the card from the suit 's'.

- lowest_valueCard(hand): Takes one argument where 'hand' refers to a list object with instances of the Card object. Returns the lowest value of a card in the 'hand'.

- highest_valueCard_of_suit(hand, s): Takes two arguements where 'hand' refers to a list object containing instances of the Card object. 's' refers to the suit which is a string ('hearts', 'clubs', 'spades', 'diamonds'). Returns the highest value of the card from the suit 's'.

- highest_valueCard(hand): Takes one argument where 'hand' refers to a list object with instances of the Card object. Returns the highest value of a card in the 'hand'.

Credit for the png images of the card pack goes to: Andrew Tidey http://creativecommons.org/publicdomain/zero/1.0/
Licensed under MIT License Thanks

Change Log
==========

0.0.1 (26/07/2020)
------------------
- First Release