semvec/pypi-packages huggingface dataset:
solc-json-parser 0.1.9
AST parser from solc json file
License: MIT

# An AST parser for solc json outputs

Parsing AST with solidity source code and get contract information.

## Quickstart

### Installation

Clone this repository and install it with pip:

``` bash
git clone https://github.com/sbip-sg/solc-json-parser.git
cd solc-json-parser
pip install .
```

### Usage

Example usage using [standard json](https://docs.soliditylang.org/en/v0.8.17/using-the-compiler.html#compiler-input-and-output-json-description):

``` python
import json
from solc_json_parser.standard_json_parser import StandardJsonParser
with open('contracts/standard_json/75b8.standard-input.json') as f:
    input_json = json.load(f)

version = '0.8.4'
parser = StandardJsonParser(input_json, version)

# Get all contract names
parser.all_contract_names
# ['IERC1271',
#  ...
#  'ContractKeys',
#  'NFTfiSigningUtils',
#  'NftReceiver',
#  'Ownable']

# Get source code by PC
source = parser.source_by_pc('DirectLoanFixedOffer', 13232)
source
# {'pc': 13232,
#  'linenums': [921, 924],
#  'fragment': 'LoanChecksAndCalculations.computeRevenueShare(\n            adminFee,\n            loanExtras.revenueShareInBasisPoints\n        )',
#  'fid': 'contracts/loans/direct/loanTypes/DirectLoanBaseMinimal.sol',
#  'begin': 45007,
#  'end': 45134,
#  'source_idx': 26,
#  'source_path': 'contracts/loans/direct/loanTypes/DirectLoanBaseMinimal.sol'}

# Get function AST unit by PC
func = parser.function_unit_by_pc('DirectLoanFixedOffer', 13232)
# Parameter names of this function
[n.get('name') for n in func.get('parameters').get('parameters')]
# ['_loanId', '_borrower', '_lender', '_loan']
# Function selector, available only for external or public functions
func.get('functionSelector')

# Get the innermost AST unit by PC
parser.ast_unit_by_pc('DirectLoanFixedOffer', 13232)
```

## Command line tools

``` bash
solc-json-parser --help
```

Decode binary to opcodes:

``` bash
❯ solc-json-parser dp 0x60806040525f80fdfea26469706673582212200466fd4ed0d73499199c39545f7019da158defa354cc0051afe02754ec8e32b464736f6c63430008180033
PUSH1 0x80
PUSH1 0x40
MSTORE
PUSH0 0x
DUP1
REVERT
INVALID
LOG2
PUSH5 0x6970667358
0X22
SLT
SHA3
DIV
PUSH7 0xfd4ed0d7349919
SWAP13
...
```



## Note

- This library only supports detecting Solidity version newer than or equal to
  `v0.4.11`. This is due to the limitation of the base library [py-solc-x](https://solcx.readthedocs.io/en/latest/).
pykafka-util 1.0.1
kafka封装
License: MIT
Requires Python: >=3.6

<h1 align="center">pykafka_util</h1>

- pykafka_util.py

```python
from pykafka_util.pykafka_util import KafkaManager
kafka_host = f'127.0.0.1:9094'
topic = 'py_kafka'
consumer = 'test'
message = {
    "send_type": "sync_send",
    "name": "lady_killer",
    "age": 18
}

manager = KafkaManager(kafka_host)

v = bytes('{}'.format(json.dumps(message)), 'utf-8')

# 生产消息
manager.produce(topic=topic, value=v)

# 消费消息
    consumed_messages = manager.consume(topic=topic, group_id=consumer, num_messages=10)
    for data in consumed_messages:
        logging.info(f"消费数据：{data}")
```
scripy-utils 0.0.3
Short description
License: MIT
Requires Python: ~=3.3
Keywords: basic_type, python

MIT License

Copyright (c) [year] [fullname]

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
documentation files (the "Software"), to deal in the Software without restriction, including without limitation the
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit
persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the
Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

# 模块介绍

## 分词统计

1,导入模块

```python
from scripy_utils.word_ans_util import WordCloudUtil
```

2,中文词云

```python
characters = """对素食者和肠胃疾病患者来说，藜麦的发现是一个奇迹。藜麦不含麸质，富含镁和铁，比其他种子含有更多的蛋白质，包括人体无法独自生成的必需的氨基酸。美国宇航局宣布，藜麦是地球上营养最均衡的食物之一，是宇航员的理想之选。产于安第斯山的藜麦有一个令西方消费者神往的传说：印加人非常重视藜麦，认为它是神圣的，并且称之为“万谷之母”。不过，藜麦的爱好者却通过媒体发现了一个令人不安的事实。从2006年到2013年，玻利维亚和秘鲁的藜麦价格上涨了两倍。2011年，《独立报》称，玻利维亚的藜麦消费量“5年间下降了34％，当地家庭已经吃不起这种主食了，它已经变成了奢侈品”。《纽约时报》援引研究报告称，藜麦种植区的儿童营养不良率正在上升。2013年，《卫报》用煽动性标题提升了人们对这个问题的关注度：“素食者的肚子能装下藜麦令人反胃的事实吗？”该报称，贫穷的玻利维亚人和秘鲁人正在食用更加便宜的“进口垃圾食品”。《独立报》2013年一篇报道的标题是“藜麦：对你有利--对玻利维亚人有害”。这些消息传遍了全球，在健康饮食者之中引发了一场良心危机。在社交媒体、素食博客和健康饮食论坛上，人们开始询问食用藜麦是否合适。"""
```

```python
# 找适配中文的字体
font_path = fr"G:\ContentPro\PythonPro\PiPyPro\static\ttf\simhei.ttf"
# 词云的背景图片
mask_img_path = fr"G:\ContentPro\PythonPro\PiPyPro\爬虫使用\scripy_utils\media\wordcloud_imgs\2.jpg"
# 生成词云的存储位置
cloud_output_path = "img.jpg"
word_cloud = WordCloudUtil(characters, font_path=font_path, cloud_output_path=cloud_output_path,
                           mask_img_path=mask_img_path)
word_cloud.create_wordcloud()


```

![](https://mmbiz.qpic.cn/sz_mmbiz_png/BvGyVvvMmy0r3aXPwt6o7xk7VhHYEI4X9UDVrKib74r3ec23Xcra2no08HXJG3vGXX9k58FEHC2jiaDQrhlf7XXw/640?wx_fmt=png)
更多方法请看模块，或者联系作者一起探讨。