id int64 0 458k | file_name stringlengths 4 119 | file_path stringlengths 14 227 | content stringlengths 24 9.96M | size int64 24 9.96M | language stringclasses 1
value | extension stringclasses 14
values | total_lines int64 1 219k | avg_line_length float64 2.52 4.63M | max_line_length int64 5 9.91M | alphanum_fraction float64 0 1 | repo_name stringlengths 7 101 | repo_stars int64 100 139k | repo_forks int64 0 26.4k | repo_open_issues int64 0 2.27k | repo_license stringclasses 12
values | repo_extraction_date stringclasses 433
values |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
2,287,100 | databricks-sql-warehouse-unload.py | zhiweio_data-engineer-scripts/src/databricks-sql-warehouse-unload/databricks-sql-warehouse-unload.py | import concurrent
import functools
import itertools
import os
import shlex
import subprocess
import tempfile
import time
from collections import deque
from concurrent.futures import (
ThreadPoolExecutor,
ProcessPoolExecutor,
FIRST_COMPLETED,
wait,
)
from datetime import datetime
from enum import Enum
fr... | 14,835 | Python | .py | 417 | 27.508393 | 122 | 0.626923 | zhiweio/data-engineer-scripts | 8 | 0 | 0 | GPL-3.0 | 9/5/2024, 10:48:09 PM (Europe/Amsterdam) |
2,287,101 | strbuild.py | swfeiyu_NUC-AFLtool/strbuild.py | """
:file: strbuild.py
:brief: To build the strings which need to draw
:version: 2.0
:author: SWfeiyu
:date: 2024.4.18
"""
from typing import Dict
"""
:name: BuildStr
:brief: To build the strings which need to draw
:param: Value -> Dict ={
"Name",
"... | 4,267 | Python | .py | 101 | 25.80198 | 99 | 0.404154 | swfeiyu/NUC-AFLtool | 8 | 2 | 0 | GPL-2.0 | 9/5/2024, 10:48:09 PM (Europe/Amsterdam) |
2,287,102 | getdata.py | swfeiyu_NUC-AFLtool/getdata.py | """
:file: getdata.py
:brief: To get values of user from conf.ini and processed these values
:version: 2.0
:author:SWfeiyu
:date: 2024.4.18
"""
from configparser import ConfigParser
from cal import *
"""
:name: GetData
:brief: To get values of user from conf.ini and processed these values
:return: Value -> Dict ={
... | 3,319 | Python | .py | 78 | 32.730769 | 82 | 0.564182 | swfeiyu/NUC-AFLtool | 8 | 2 | 0 | GPL-2.0 | 9/5/2024, 10:48:09 PM (Europe/Amsterdam) |
2,287,103 | draw.py | swfeiyu_NUC-AFLtool/draw.py | """
:file: draw.py
:brief: To draw the strings in the base.jpg and get the photos
:version: 2.0
:author: SWfeiyu
:date: 2024.4.18
"""
from typing import Dict
from PIL import Image, ImageDraw, ImageFont
"""
:name: Draw
:brief: To draw the strings in the base.jpg and save the photos into the output folder
... | 2,414 | Python | .py | 49 | 36.408163 | 117 | 0.526964 | swfeiyu/NUC-AFLtool | 8 | 2 | 0 | GPL-2.0 | 9/5/2024, 10:48:09 PM (Europe/Amsterdam) |
2,287,104 | cal.py | swfeiyu_NUC-AFLtool/cal.py | """
:file: cal.py
:brief: For calculating some values used by application
:version: 2.0
:author: SWfeiyu
:date: 2024.4.18
"""
import random
import time
from typing import Dict
"""
:name: CalAcademicYear
:brief: According to current month to calculate the academic year
:return: AcademicYear -> int
"""
... | 15,368 | Python | .py | 343 | 35.48688 | 120 | 0.558437 | swfeiyu/NUC-AFLtool | 8 | 2 | 0 | GPL-2.0 | 9/5/2024, 10:48:09 PM (Europe/Amsterdam) |
2,287,105 | main.py | swfeiyu_NUC-AFLtool/main.py | """
:file: main.py
:brief: To write the main logic of this tool
:version: 2.0
:author: SWfeiyu
:date: 2024.4.18
"""
from getdata import *
from strbuild import *
from draw import *
if __name__ == '__main__':
Draw(BuildStr(GetData()))
| 255 | Python | .py | 12 | 18.416667 | 45 | 0.654008 | swfeiyu/NUC-AFLtool | 8 | 2 | 0 | GPL-2.0 | 9/5/2024, 10:48:09 PM (Europe/Amsterdam) |
2,287,106 | bot.py | erotixe_FileShareBot2/bot.py | #(©)AnimeXyz
from aiohttp import web
from plugins import web_server
import pyromod.listen
from pyrogram import Client
from pyrogram.enums import ParseMode
import sys
from datetime import datetime
from config import API_HASH, APP_ID, LOGGER, TG_BOT_TOKEN, TG_BOT_WORKERS, FORCE_SUB_CHANNEL, FORCE_SUB_CHANNEL2, CHANNEL... | 4,852 | Python | .py | 87 | 38.172414 | 229 | 0.519039 | erotixe/FileShareBot2 | 8 | 6 | 0 | GPL-3.0 | 9/5/2024, 10:48:09 PM (Europe/Amsterdam) |
2,287,107 | config.py | erotixe_FileShareBot2/config.py | #(©)t.me/Team_Netflix
import os
import logging
from logging.handlers import RotatingFileHandler
#Bot token @Botfather
TG_BOT_TOKEN = os.environ.get("TG_BOT_TOKEN", "")
#Your API ID from my.telegram.org
APP_ID = int(os.environ.get("APP_ID", ""))
#Your API Hash from my.telegram.org
API_HASH = os.environ.get("AP... | 2,955 | Python | .py | 62 | 44.403226 | 298 | 0.696017 | erotixe/FileShareBot2 | 8 | 6 | 0 | GPL-3.0 | 9/5/2024, 10:48:09 PM (Europe/Amsterdam) |
2,287,108 | helper_func.py | erotixe_FileShareBot2/helper_func.py | #(©)AnimeXyz
import base64
import re
import asyncio
from pyrogram import filters
from pyrogram.enums import ChatMemberStatus
from config import FORCE_SUB_CHANNEL, FORCE_SUB_CHANNEL2, ADMINS
from pyrogram.errors.exceptions.bad_request_400 import UserNotParticipant
from pyrogram.errors import FloodWait
async def is_su... | 4,808 | Python | .py | 133 | 28.834586 | 150 | 0.647071 | erotixe/FileShareBot2 | 8 | 6 | 0 | GPL-3.0 | 9/5/2024, 10:48:09 PM (Europe/Amsterdam) |
2,287,109 | database.py | erotixe_FileShareBot2/database/database.py | #(©)CodeXBotz
import pymongo, os
from config import DB_URI, DB_NAME
dbclient = pymongo.MongoClient(DB_URI)
database = dbclient[DB_NAME]
user_data = database['users']
async def present_user(user_id : int):
found = user_data.find_one({'_id': user_id})
return bool(found)
async def add_user(user_id: in... | 637 | Python | .py | 21 | 25.952381 | 48 | 0.676223 | erotixe/FileShareBot2 | 8 | 6 | 0 | GPL-3.0 | 9/5/2024, 10:48:09 PM (Europe/Amsterdam) |
2,287,110 | link_generator.py | erotixe_FileShareBot2/plugins/link_generator.py | from pyrogram import Client, filters
from pyrogram.types import InlineKeyboardButton, InlineKeyboardMarkup, Message
from bot import Bot
from config import ADMINS
from helper_func import encode, get_message_id
@Bot.on_message(filters.private & filters.user(ADMINS) & filters.command("batch"))
async def batch(client: C... | 3,936 | Python | .py | 96 | 30.833333 | 156 | 0.560021 | erotixe/FileShareBot2 | 8 | 6 | 0 | GPL-3.0 | 9/5/2024, 10:48:09 PM (Europe/Amsterdam) |
2,287,111 | start.py | erotixe_FileShareBot2/plugins/start.py | #(©)Codeflix_Bots
import os
import asyncio
from pyrogram import Client, filters, __version__
from pyrogram.enums import ParseMode
from pyrogram.types import Message, InlineKeyboardMarkup, InlineKeyboardButton, CallbackQuery
from pyrogram.errors import FloodWait, UserIsBlocked, InputUserDeactivated
from bot import... | 8,250 | Python | .py | 193 | 31.393782 | 258 | 0.539279 | erotixe/FileShareBot2 | 8 | 6 | 0 | GPL-3.0 | 9/5/2024, 10:48:09 PM (Europe/Amsterdam) |
2,287,112 | useless.py | erotixe_FileShareBot2/plugins/useless.py | from bot import Bot
from pyrogram.types import Message
from pyrogram import filters
from config import ADMINS, BOT_STATS_TEXT, USER_REPLY_TEXT
from datetime import datetime
from helper_func import get_readable_time
@Bot.on_message(filters.command('stats') & filters.user(ADMINS))
async def stats(bot: Bot, message: Mess... | 627 | Python | .py | 16 | 36.25 | 64 | 0.768092 | erotixe/FileShareBot2 | 8 | 6 | 0 | GPL-3.0 | 9/5/2024, 10:48:09 PM (Europe/Amsterdam) |
2,287,113 | cbb.py | erotixe_FileShareBot2/plugins/cbb.py | #(©)Codexbotz
from pyrogram import __version__
from bot import Bot
from config import OWNER_ID
from pyrogram.types import Message, InlineKeyboardMarkup, InlineKeyboardButton, CallbackQuery
@Bot.on_callback_query()
async def cb_handler(client: Bot, query: CallbackQuery):
data = query.data
if data == "about":
... | 1,124 | Python | .py | 26 | 33.692308 | 315 | 0.572993 | erotixe/FileShareBot2 | 8 | 6 | 0 | GPL-3.0 | 9/5/2024, 10:48:09 PM (Europe/Amsterdam) |
2,287,114 | __init__.py | erotixe_FileShareBot2/plugins/__init__.py | #(©)Codexbotz
#@iryme
from aiohttp import web
from .route import routes
async def web_server():
web_app = web.Application(client_max_size=30000000)
web_app.add_routes(routes)
return web_app
| 210 | Python | .py | 8 | 22.875 | 55 | 0.753846 | erotixe/FileShareBot2 | 8 | 6 | 0 | GPL-3.0 | 9/5/2024, 10:48:09 PM (Europe/Amsterdam) |
2,287,115 | channel_post.py | erotixe_FileShareBot2/plugins/channel_post.py | #(©)Codexbotz
import asyncio
from pyrogram import filters, Client
from pyrogram.types import Message, InlineKeyboardMarkup, InlineKeyboardButton
from pyrogram.errors import FloodWait
from bot import Bot
from config import ADMINS, CHANNEL_ID, DISABLE_CHANNEL_BUTTON
from helper_func import encode
@Bot.on_message(filt... | 2,154 | Python | .py | 42 | 46.166667 | 132 | 0.718022 | erotixe/FileShareBot2 | 8 | 6 | 0 | GPL-3.0 | 9/5/2024, 10:48:09 PM (Europe/Amsterdam) |
2,287,116 | route.py | erotixe_FileShareBot2/plugins/route.py | #(©)Codexbotz
#rymme
from aiohttp import web
routes = web.RouteTableDef()
@routes.get("/", allow_head=True)
async def root_route_handler(request):
return web.json_response("ᴘᴏᴡᴇʀᴇᴅ ʙʏ : ᴛᴇᴀᴍ ɴᴇᴛғʟɪx")
| 244 | Python | .py | 7 | 27.714286 | 57 | 0.757576 | erotixe/FileShareBot2 | 8 | 6 | 0 | GPL-3.0 | 9/5/2024, 10:48:09 PM (Europe/Amsterdam) |
2,287,117 | builddebateteam.py | tevslin_debate_team/builddebateteam.py | # -*- coding: utf-8 -*-
"""
Created on Mon Jan 29 15:31:00 2024
@author: tevslin
Uses AgentBukder in autogen to build a debate team.
Modify building_task below to change how the team is built.
"""
from dotenv import load_dotenv
import os
import json
load_dotenv()
llm="gpt-4-1106-preview"
tdic... | 3,118 | Python | .py | 60 | 47.666667 | 192 | 0.747028 | tevslin/debate_team | 8 | 2 | 0 | GPL-3.0 | 9/5/2024, 10:48:09 PM (Europe/Amsterdam) |
2,287,118 | debatemanager.py | tevslin_debate_team/debatemanager.py | # -*- coding: utf-8 -*-
"""
Created on Thu Feb 1 17:38:40 2024
@author: tevslin
debate management modules
"""
class debate:
def __init__(self,api_key,llm="gpt-4-1106-preview",
saved_team=r'https://raw.githubusercontent.com/tevslin/debate_team/main/debateteam.json'):
import o... | 2,889 | Python | .py | 59 | 37.135593 | 123 | 0.625457 | tevslin/debate_team | 8 | 2 | 0 | GPL-3.0 | 9/5/2024, 10:48:09 PM (Europe/Amsterdam) |
2,287,119 | ststreamer.py | tevslin_debate_team/ststreamer.py | # -*- coding: utf-8 -*-
"""
Created on Sun Feb 4 16:01:01 2024
@author: tevsl
"""
from io import StringIO
import streamlit as st
class ObservableStringIO(StringIO):
def __init__(self,*args, **kwargs):
super().__init__(*args, **kwargs)
self.change_callback = None
self.containe... | 618 | Python | .py | 22 | 20.818182 | 42 | 0.573604 | tevslin/debate_team | 8 | 2 | 0 | GPL-3.0 | 9/5/2024, 10:48:09 PM (Europe/Amsterdam) |
2,287,120 | streamlit_app.py | tevslin_debate_team/streamlit_app.py | # filename: debate_app.py
import streamlit as st
import debatemanager
import ststreamer
from contextlib import redirect_stdout
# Function to create and load the debate team
def create_debate_team(api_key):
dm = debatemanager.debate(api_key)
dm.load_team()
return dm
# Function to capture th... | 2,261 | Python | .py | 47 | 42.319149 | 114 | 0.69863 | tevslin/debate_team | 8 | 2 | 0 | GPL-3.0 | 9/5/2024, 10:48:09 PM (Europe/Amsterdam) |
2,287,121 | rengine-tool.py | glownd_rengine-tool/rengine-tool.py | import requests
from urllib3.exceptions import InsecureRequestWarning
import argparse
from getpass import getpass
#Import custom classes
from Classes.re_authorize import REAuthorize
from Classes.re_target import RETarget
from Classes.re_scan import REScan
from Classes.re_engine import REEngine
from Classes.re_organiza... | 11,169 | Python | .py | 161 | 67.515528 | 148 | 0.757962 | glownd/rengine-tool | 8 | 1 | 0 | GPL-3.0 | 9/5/2024, 10:48:09 PM (Europe/Amsterdam) |
2,287,122 | re_target.py | glownd_rengine-tool/Classes/re_target.py | import argparse
import requests
from urllib3.exceptions import InsecureRequestWarning
import json
from tabulate import tabulate
class RETarget():
def __init__(self, args:argparse.Namespace, s:requests.Session):
if(args.target_action_command):
match args.target_action_command.lower():
... | 8,796 | Python | .py | 200 | 31.94 | 123 | 0.542448 | glownd/rengine-tool | 8 | 1 | 0 | GPL-3.0 | 9/5/2024, 10:48:09 PM (Europe/Amsterdam) |
2,287,123 | re_project.py | glownd_rengine-tool/Classes/re_project.py | import argparse
import requests
from urllib3.exceptions import InsecureRequestWarning
import json
from tabulate import tabulate
class REProject():
def __init__(self, args:argparse.Namespace, s:requests.Session):
if(args.project_action_command):
match args.project_action_command.lower()... | 613 | Python | .py | 18 | 25.166667 | 68 | 0.630769 | glownd/rengine-tool | 8 | 1 | 0 | GPL-3.0 | 9/5/2024, 10:48:09 PM (Europe/Amsterdam) |
2,287,124 | re_authorize.py | glownd_rengine-tool/Classes/re_authorize.py | import argparse
import pathlib
import requests
from urllib3.exceptions import InsecureRequestWarning
from getpass import getpass
import pickle
class StrToBytes:
def __init__(self, fileobj):
self.fileobj = fileobj
def read(self, size):
return self.fileobj.read(size).encode()
def readline(self... | 2,947 | Python | .py | 73 | 29.945205 | 167 | 0.608881 | glownd/rengine-tool | 8 | 1 | 0 | GPL-3.0 | 9/5/2024, 10:48:09 PM (Europe/Amsterdam) |
2,287,125 | re_organization.py | glownd_rengine-tool/Classes/re_organization.py | import argparse
import requests
from urllib3.exceptions import InsecureRequestWarning
import json
from tabulate import tabulate
class REOrganization():
def __init__(self, args:argparse.Namespace, s:requests.Session):
if(args.organization_action_command):
match args.organization_action_... | 4,413 | Python | .py | 99 | 32.919192 | 128 | 0.574218 | glownd/rengine-tool | 8 | 1 | 0 | GPL-3.0 | 9/5/2024, 10:48:09 PM (Europe/Amsterdam) |
2,287,126 | re_user.py | glownd_rengine-tool/Classes/re_user.py | import argparse
import requests
from urllib3.exceptions import InsecureRequestWarning
from getpass import getpass
from tabulate import tabulate
class REUser():
def __init__(self, args:argparse.Namespace, s:requests.Session):
if(args.user_action_command):
match args.user_action_command.... | 1,592 | Python | .py | 41 | 29.170732 | 103 | 0.6125 | glownd/rengine-tool | 8 | 1 | 0 | GPL-3.0 | 9/5/2024, 10:48:09 PM (Europe/Amsterdam) |
2,287,127 | re_scan.py | glownd_rengine-tool/Classes/re_scan.py | import argparse
import requests
from urllib3.exceptions import InsecureRequestWarning
import json
from tabulate import tabulate
import datetime
class REScan():
def __init__(self, args:argparse.Namespace, s:requests.Session):
if(args.scan_action_command):
match args.scan_action_command.... | 13,772 | Python | .py | 297 | 34.313131 | 178 | 0.548392 | glownd/rengine-tool | 8 | 1 | 0 | GPL-3.0 | 9/5/2024, 10:48:09 PM (Europe/Amsterdam) |
2,287,128 | re_engine.py | glownd_rengine-tool/Classes/re_engine.py | import argparse
import requests
from urllib3.exceptions import InsecureRequestWarning
import json
from tabulate import tabulate
class REEngine():
def __init__(self, args:argparse.Namespace, s:requests.Session):
if(args.engine_action_command):
match args.engine_action_command.lower():
... | 1,366 | Python | .py | 35 | 28.457143 | 107 | 0.573933 | glownd/rengine-tool | 8 | 1 | 0 | GPL-3.0 | 9/5/2024, 10:48:09 PM (Europe/Amsterdam) |
2,287,129 | sensor.py | markgdev_home-assistant_renogy/custom_components/renogy/sensor.py | """Platform for sensor integration."""
from __future__ import annotations
from homeassistant.components.sensor import (
SensorDeviceClass,
SensorEntity,
SensorEntityDescription,
SensorStateClass,
)
from homeassistant.const import UnitOfTemperature
from homeassistant.core import HomeAssistant
from homea... | 9,088 | Python | .py | 248 | 28.620968 | 85 | 0.645479 | markgdev/home-assistant_renogy | 8 | 0 | 2 | GPL-3.0 | 9/5/2024, 10:48:09 PM (Europe/Amsterdam) |
2,287,130 | config_flow.py | markgdev_home-assistant_renogy/custom_components/renogy/config_flow.py | """Config flow for renogy integration."""
from __future__ import annotations
import logging
from typing import Any
import voluptuous as vol
from homeassistant import config_entries
# from homeassistant.const import CONF_HOST
from homeassistant.core import HomeAssistant
from homeassistant.data_entry_flow import Flow... | 3,678 | Python | .py | 89 | 34.685393 | 86 | 0.664513 | markgdev/home-assistant_renogy | 8 | 0 | 2 | GPL-3.0 | 9/5/2024, 10:48:09 PM (Europe/Amsterdam) |
2,287,131 | const.py | markgdev_home-assistant_renogy/custom_components/renogy/const.py | """Constants for the renogy integration."""
DOMAIN = "renogy"
DEFAULT_SCAN_INTERVAL = 30
# CONF_MAC = None
# CONF_BATTERIES = None
# CONF_CONTROLLERS = None
| 160 | Python | .py | 6 | 25.166667 | 43 | 0.741722 | markgdev/home-assistant_renogy | 8 | 0 | 2 | GPL-3.0 | 9/5/2024, 10:48:09 PM (Europe/Amsterdam) |
2,287,132 | __init__.py | markgdev_home-assistant_renogy/custom_components/renogy/__init__.py | """The renogy integration."""
from __future__ import annotations
from bleak import BleakClient, BleakError
from bleak.backends.device import BLEDevice
from bleak_retry_connector import (
close_stale_connections_by_address,
establish_connection,
)
from homeassistant.components import bluetooth
from homeassist... | 3,470 | Python | .py | 84 | 36.071429 | 90 | 0.723081 | markgdev/home-assistant_renogy | 8 | 0 | 2 | GPL-3.0 | 9/5/2024, 10:48:09 PM (Europe/Amsterdam) |
2,287,133 | device.py | markgdev_home-assistant_renogy/custom_components/renogy/renogy/device.py | import asyncio
from bleak import BleakClient, BleakError, BleakGATTCharacteristic
from bleak.backends.device import BLEDevice
from bleak_retry_connector import establish_connection
import time
from .Utils import bytes_to_int, int_to_bytes, crc16_modbus
import binascii
WRITE_SERVICE_UUID = "0000ffd1-0000-1000-8000-0080... | 7,694 | Python | .py | 240 | 24.5375 | 108 | 0.581283 | markgdev/home-assistant_renogy | 8 | 0 | 2 | GPL-3.0 | 9/5/2024, 10:48:09 PM (Europe/Amsterdam) |
2,287,134 | Utils.py | markgdev_home-assistant_renogy/custom_components/renogy/renogy/Utils.py | # Reads data from a list of bytes, and converts to an int
def bytes_to_int(bs, offset, length, signed=False, scale=1):
ret = 0
if len(bs) < (offset + length):
return ret
if length > 0:
byteorder = "big"
start = offset
end = offset + length
else:
byteorder = "littl... | 6,787 | Python | .py | 562 | 7.042705 | 84 | 0.489855 | markgdev/home-assistant_renogy | 8 | 0 | 2 | GPL-3.0 | 9/5/2024, 10:48:09 PM (Europe/Amsterdam) |
2,287,135 | ChatGPT.py | Adexxxx_ChatGpt-telegram-bot/with context/ChatGPT.py | from openai import OpenAI
import sqlite3
import re
import requests
TOKEN = 'YOUR_BOT_API_KEY' # Вставляем свои токены от бота и от чат гпт
client = OpenAI(api_key='YOUR_OPENAI_API_KEY')
def gpt(text: str, id: int, m_id: int):
try:
url = f"https://api.telegram.org/bot{T... | 4,991 | Python | .py | 56 | 60.053571 | 189 | 0.608386 | Adexxxx/ChatGpt-telegram-bot | 8 | 5 | 0 | GPL-3.0 | 9/5/2024, 10:48:09 PM (Europe/Amsterdam) |
2,287,136 | main.py | Adexxxx_ChatGpt-telegram-bot/with context/main.py | from aiogram import Bot, Dispatcher, executor, types
from aiogram.types import Message
from ChatGPT import gpt
import sqlite3
import threading
TOKEN = 'YOUR_API_KEY'
bot = Bot(TOKEN)
dp = Dispatcher(bot)
def create_table(): # –°–æ–∑–¥–∞—ë–º –±–¥, –µ—Å–ª–∏ –µ—ë –µ—â—ë... | 2,570 | Python | .py | 51 | 40.823529 | 181 | 0.508779 | Adexxxx/ChatGpt-telegram-bot | 8 | 5 | 0 | GPL-3.0 | 9/5/2024, 10:48:09 PM (Europe/Amsterdam) |
2,287,137 | ChatGPT.py | Adexxxx_ChatGpt-telegram-bot/wihout context/ChatGPT.py | from openai import OpenAI
client = OpenAI(api_key='YOUR_API_KEY')
def gpt(text):
completion = client.chat.completions.create(
model = 'gpt-3.5-turbo', #Модель можно выбрать на свой вкус
messages = [
{"role": "system", "content" : "You are a bot assistant imitatin... | 1,046 | Python | .py | 13 | 56.307692 | 191 | 0.622166 | Adexxxx/ChatGpt-telegram-bot | 8 | 5 | 0 | GPL-3.0 | 9/5/2024, 10:48:09 PM (Europe/Amsterdam) |
2,287,138 | main.py | Adexxxx_ChatGpt-telegram-bot/wihout context/main.py | from aiogram import Bot, Dispatcher, executor, types
from aiogram.types import Message
from ChatGPT import gpt
TOKEN = 'YOUR_TOKEN' #–¢–æ–∫–µ–Ω —Ç–µ–ª–µ–≥—Ä–∞–º –±–æ—Ç–∞
bot = Bot(TOKEN)
dp = Dispatcher(bot)
@dp.message_handler(commands='start') #–û–±—Ä–∞–±–æ—Ç–∫–∞ –∫–æ–º–∞–Ω–¥—ã /... | 1,340 | Python | .py | 16 | 78.875 | 182 | 0.503846 | Adexxxx/ChatGpt-telegram-bot | 8 | 5 | 0 | GPL-3.0 | 9/5/2024, 10:48:09 PM (Europe/Amsterdam) |
2,287,139 | conftest.py | pantos-io_common/tests/conftest.py | import pytest
from pantos.common.protocol import get_supported_protocol_versions
@pytest.fixture(scope='session', params=get_supported_protocol_versions())
def protocol_version(request):
return request.param
| 215 | Python | .py | 5 | 40.6 | 74 | 0.830918 | pantos-io/common | 8 | 4 | 0 | GPL-3.0 | 9/5/2024, 10:48:09 PM (Europe/Amsterdam) |
2,287,140 | test_signer.py | pantos-io_common/tests/test_signer.py | from unittest.mock import MagicMock
from unittest.mock import patch
import pytest
from pantos.common.blockchains.enums import Blockchain
from pantos.common.signer import SignerError
from pantos.common.signer import get_signer
def test_signer_init_unable_to_load_key():
with pytest.raises(SignerError):
ge... | 2,839 | Python | .py | 64 | 40.59375 | 79 | 0.747994 | pantos-io/common | 8 | 4 | 0 | GPL-3.0 | 9/5/2024, 10:48:09 PM (Europe/Amsterdam) |
2,287,141 | test_servicenodes.py | pantos-io_common/tests/test_servicenodes.py | import unittest.mock
import uuid
import pytest
import requests
from pantos.common.blockchains.enums import Blockchain
from pantos.common.entities import ServiceNodeBid
from pantos.common.servicenodes import ServiceNodeClient
from pantos.common.servicenodes import ServiceNodeClientError
from pantos.common.types import... | 13,175 | Python | .py | 255 | 43.972549 | 79 | 0.702488 | pantos-io/common | 8 | 4 | 0 | GPL-3.0 | 9/5/2024, 10:48:09 PM (Europe/Amsterdam) |
2,287,142 | test_health.py | pantos-io_common/tests/test_health.py | import unittest.mock
import pytest
from pantos.common.blockchains.base import GENERAL_RPC_ERROR_MESSAGE
from pantos.common.blockchains.enums import Blockchain
from pantos.common.exceptions import NotInitializedError
from pantos.common.health import NodesHealth
from pantos.common.health import check_blockchain_nodes_h... | 1,480 | Python | .py | 31 | 42.290323 | 77 | 0.743056 | pantos-io/common | 8 | 4 | 0 | GPL-3.0 | 9/5/2024, 10:48:09 PM (Europe/Amsterdam) |
2,287,143 | test_exceptions.py | pantos-io_common/tests/test_exceptions.py | import itertools
import pytest
from pantos.common.exceptions import BaseError
from pantos.common.exceptions import ErrorCreator
class _SuperclassError(BaseError):
pass
class _SubclassError(_SuperclassError):
pass
class _SpecializedErrorWithMessage(_SuperclassError):
_message = 'specialized error mes... | 2,333 | Python | .py | 55 | 35.2 | 75 | 0.69571 | pantos-io/common | 8 | 4 | 0 | GPL-3.0 | 9/5/2024, 10:48:09 PM (Europe/Amsterdam) |
2,287,144 | test_protocol.py | pantos-io_common/tests/test_protocol.py | import unittest.mock
import pytest
import semantic_version # type: ignore
from pantos.common.protocol import get_latest_protocol_version
from pantos.common.protocol import get_supported_protocol_versions
from pantos.common.protocol import is_supported_protocol_version
def _to_semantic_version(version):
return ... | 2,975 | Python | .py | 54 | 48.203704 | 79 | 0.713301 | pantos-io/common | 8 | 4 | 0 | GPL-3.0 | 9/5/2024, 10:48:09 PM (Europe/Amsterdam) |
2,287,145 | test_logging.py | pantos-io_common/tests/test_logging.py | import enum
import json
import logging
import logging.handlers
import pathlib
import sys
import tempfile
import unittest.mock
import json_log_formatter # type: ignore
import pytest
from pantos.common.blockchains.enums import Blockchain
from pantos.common.logging import _HUMAN_READABLE_LOG_FORMAT
from pantos.common.l... | 8,980 | Python | .py | 203 | 37.270936 | 78 | 0.680695 | pantos-io/common | 8 | 4 | 0 | GPL-3.0 | 9/5/2024, 10:48:09 PM (Europe/Amsterdam) |
2,287,146 | test_configuration.py | pantos-io_common/tests/test_configuration.py | import pathlib
from unittest.mock import mock_open
from unittest.mock import patch
import pytest
from pantos.common.configuration import Config
from pantos.common.configuration import ConfigError
def test_validate_one_not_present():
# Test with valid data
validation_schema = {
'private_key_path': {
... | 3,875 | Python | .py | 99 | 32.909091 | 73 | 0.643124 | pantos-io/common | 8 | 4 | 0 | GPL-3.0 | 9/5/2024, 10:48:09 PM (Europe/Amsterdam) |
2,287,147 | test_entities.py | pantos-io_common/tests/test_entities.py | import pytest
from pantos.common.entities import ServiceNodeTransferStatus
@pytest.mark.parametrize('name, status',
[('accepted', ServiceNodeTransferStatus.ACCEPTED),
('failed', ServiceNodeTransferStatus.FAILED),
('submitted', ServiceNodeTr... | 793 | Python | .py | 13 | 48.461538 | 78 | 0.68129 | pantos-io/common | 8 | 4 | 0 | GPL-3.0 | 9/5/2024, 10:48:09 PM (Europe/Amsterdam) |
2,287,148 | test_restapi.py | pantos-io_common/tests/test_restapi.py | import json
import unittest.mock
import pytest
import werkzeug.exceptions
from pantos.common.blockchains.base import GENERAL_RPC_ERROR_MESSAGE
from pantos.common.blockchains.base import UnhealthyNode
from pantos.common.blockchains.enums import Blockchain
from pantos.common.exceptions import NotInitializedError
from p... | 7,295 | Python | .py | 151 | 42.072848 | 79 | 0.739382 | pantos-io/common | 8 | 4 | 0 | GPL-3.0 | 9/5/2024, 10:48:09 PM (Europe/Amsterdam) |
2,287,149 | conftest.py | pantos-io_common/tests/blockchains/conftest.py | import atexit
import dataclasses
import pathlib
import tempfile
import uuid
import pytest
from pantos.common.blockchains.base import BlockchainUtilities
from pantos.common.blockchains.base import VersionedContractAbi
from pantos.common.blockchains.enums import Blockchain
from pantos.common.blockchains.enums import Co... | 8,292 | Python | .py | 180 | 40.255556 | 78 | 0.756383 | pantos-io/common | 8 | 4 | 0 | GPL-3.0 | 9/5/2024, 10:48:09 PM (Europe/Amsterdam) |
2,287,150 | test_celo.py | pantos-io_common/tests/blockchains/test_celo.py | import pytest
from pantos.common.blockchains.celo import CeloUtilities
from pantos.common.blockchains.celo import CeloUtilitiesError
from pantos.common.blockchains.enums import Blockchain
@pytest.fixture(scope='module')
def celo_utilities(blockchain_node_urls, fallback_blockchain_node_urls,
averag... | 1,004 | Python | .py | 18 | 47 | 77 | 0.743616 | pantos-io/common | 8 | 4 | 0 | GPL-3.0 | 9/5/2024, 10:48:09 PM (Europe/Amsterdam) |
2,287,151 | test_factory.py | pantos-io_common/tests/blockchains/test_factory.py | import unittest.mock
import pytest
from pantos.common.blockchains.avalanche import AvalancheUtilities
from pantos.common.blockchains.base import BlockchainUtilities
from pantos.common.blockchains.bnbchain import BnbChainUtilities
from pantos.common.blockchains.celo import CeloUtilities
from pantos.common.blockchains.... | 3,053 | Python | .py | 59 | 43.355932 | 77 | 0.750335 | pantos-io/common | 8 | 4 | 0 | GPL-3.0 | 9/5/2024, 10:48:09 PM (Europe/Amsterdam) |
2,287,152 | test_tasks.py | pantos-io_common/tests/blockchains/test_tasks.py | import unittest.mock
import uuid
import pytest
from pantos.common.blockchains.base import BlockchainUtilitiesError
from pantos.common.blockchains.base import MaxTotalFeePerGasExceededError
from pantos.common.blockchains.factory import initialize_blockchain_utilities
from pantos.common.blockchains.tasks import _transa... | 6,211 | Python | .py | 117 | 43.452991 | 79 | 0.70895 | pantos-io/common | 8 | 4 | 0 | GPL-3.0 | 9/5/2024, 10:48:09 PM (Europe/Amsterdam) |
2,287,153 | test_enums.py | pantos-io_common/tests/blockchains/test_enums.py | import pytest
from pantos.common.blockchains.enums import Blockchain
from pantos.common.blockchains.enums import ContractAbi
@pytest.mark.parametrize(('blockchain', 'name_in_pascal_case'),
[(Blockchain.ETHEREUM, 'Ethereum'),
(Blockchain.BNB_CHAIN, 'BnbChain'),
... | 1,624 | Python | .py | 30 | 44.066667 | 78 | 0.674448 | pantos-io/common | 8 | 4 | 0 | GPL-3.0 | 9/5/2024, 10:48:09 PM (Europe/Amsterdam) |
2,287,154 | test_ethereum.py | pantos-io_common/tests/blockchains/test_ethereum.py | import importlib.resources
import unittest.mock
import hexbytes
import pytest
import web3
import web3.exceptions
from pantos.common.blockchains.base import GENERAL_RPC_ERROR_MESSAGE
from pantos.common.blockchains.base import NodeConnections
from pantos.common.blockchains.base import ResultsNotMatchingError
from panto... | 27,522 | Python | .py | 510 | 43.037255 | 79 | 0.676558 | pantos-io/common | 8 | 4 | 0 | GPL-3.0 | 9/5/2024, 10:48:09 PM (Europe/Amsterdam) |
2,287,155 | test_bnbchain.py | pantos-io_common/tests/blockchains/test_bnbchain.py | import pytest
from pantos.common.blockchains.bnbchain import BnbChainUtilities
from pantos.common.blockchains.bnbchain import BnbChainUtilitiesError
from pantos.common.blockchains.enums import Blockchain
@pytest.fixture(scope='module')
def bnb_chain_utilities(blockchain_node_urls, fallback_blockchain_node_urls,
... | 1,097 | Python | .py | 18 | 50.944444 | 79 | 0.738806 | pantos-io/common | 8 | 4 | 0 | GPL-3.0 | 9/5/2024, 10:48:09 PM (Europe/Amsterdam) |
2,287,156 | test_sonic.py | pantos-io_common/tests/blockchains/test_sonic.py | import pytest
from pantos.common.blockchains.enums import Blockchain
from pantos.common.blockchains.sonic import SonicUtilities
from pantos.common.blockchains.sonic import SonicUtilitiesError
@pytest.fixture(scope='module')
def sonic_utilities(blockchain_node_urls, fallback_blockchain_node_urls,
... | 1,025 | Python | .py | 18 | 47.888889 | 78 | 0.744 | pantos-io/common | 8 | 4 | 0 | GPL-3.0 | 9/5/2024, 10:48:09 PM (Europe/Amsterdam) |
2,287,157 | test_solana.py | pantos-io_common/tests/blockchains/test_solana.py | import pytest
from pantos.common.blockchains.enums import Blockchain
from pantos.common.blockchains.solana import SolanaUtilities
from pantos.common.blockchains.solana import SolanaUtilitiesError
@pytest.fixture(scope='module')
def solana_utilities(blockchain_node_urls, fallback_blockchain_node_urls,
... | 1,226 | Python | .py | 21 | 49.571429 | 79 | 0.747492 | pantos-io/common | 8 | 4 | 0 | GPL-3.0 | 9/5/2024, 10:48:09 PM (Europe/Amsterdam) |
2,287,158 | test_base.py | pantos-io_common/tests/blockchains/test_base.py | import dataclasses
import importlib
import json
import pathlib
import unittest.mock
import uuid
import pytest
from pantos.common.blockchains.base import _BASE_CONTRACT_ABI_PACKAGE
from pantos.common.blockchains.base import BlockchainUtilities
from pantos.common.blockchains.base import BlockchainUtilitiesError
from pa... | 22,904 | Python | .py | 436 | 43.665138 | 79 | 0.710897 | pantos-io/common | 8 | 4 | 0 | GPL-3.0 | 9/5/2024, 10:48:09 PM (Europe/Amsterdam) |
2,287,159 | test_avalanche.py | pantos-io_common/tests/blockchains/test_avalanche.py | import pytest
from pantos.common.blockchains.avalanche import AvalancheUtilities
from pantos.common.blockchains.avalanche import AvalancheUtilitiesError
from pantos.common.blockchains.enums import Blockchain
@pytest.fixture(scope='module')
def avalanche_utilities(blockchain_node_urls, fallback_blockchain_node_urls,
... | 1,139 | Python | .py | 19 | 48.684211 | 79 | 0.725966 | pantos-io/common | 8 | 4 | 0 | GPL-3.0 | 9/5/2024, 10:48:09 PM (Europe/Amsterdam) |
2,287,160 | test_cronos.py | pantos-io_common/tests/blockchains/test_cronos.py | import pytest
from pantos.common.blockchains.cronos import CronosUtilities
from pantos.common.blockchains.cronos import CronosUtilitiesError
from pantos.common.blockchains.enums import Blockchain
@pytest.fixture(scope='module')
def cronos_utilities(blockchain_node_urls, fallback_blockchain_node_urls,
... | 1,046 | Python | .py | 18 | 48.777778 | 79 | 0.744368 | pantos-io/common | 8 | 4 | 0 | GPL-3.0 | 9/5/2024, 10:48:09 PM (Europe/Amsterdam) |
2,287,161 | test_polygon.py | pantos-io_common/tests/blockchains/test_polygon.py | import pytest
from pantos.common.blockchains.enums import Blockchain
from pantos.common.blockchains.polygon import PolygonUtilities
from pantos.common.blockchains.polygon import PolygonUtilitiesError
@pytest.fixture(scope='module')
def polygon_utilities(blockchain_node_urls, fallback_blockchain_node_urls,
... | 1,067 | Python | .py | 18 | 49.666667 | 78 | 0.744722 | pantos-io/common | 8 | 4 | 0 | GPL-3.0 | 9/5/2024, 10:48:09 PM (Europe/Amsterdam) |
2,287,162 | configuration.py | pantos-io_common/pantos/common/configuration.py | """Module for loading and parsing a configuration file.
"""
import errno
import importlib.resources
import logging
import os
import pathlib
import typing
import cerberus # type: ignore
import dotenv
import pyaml_env # type: ignore
import yaml
from pantos.common.exceptions import BaseError
_logger = logging.getLog... | 8,269 | Python | .py | 198 | 31.141414 | 79 | 0.594524 | pantos-io/common | 8 | 4 | 0 | GPL-3.0 | 9/5/2024, 10:48:09 PM (Europe/Amsterdam) |
2,287,163 | protocol.py | pantos-io_common/pantos/common/protocol.py | """Module for keeping track of supported Pantos protocol versions.
"""
import typing
import semantic_version # type: ignore
_SUPPORTED_PROTOCOL_VERSIONS: typing.Final[set[semantic_version.Version]] = {
semantic_version.Version('0.1.0')
}
def get_latest_protocol_version() -> semantic_version.Version:
"""Ge... | 1,179 | Python | .py | 35 | 28.8 | 77 | 0.70656 | pantos-io/common | 8 | 4 | 0 | GPL-3.0 | 9/5/2024, 10:48:09 PM (Europe/Amsterdam) |
2,287,164 | logging.py | pantos-io_common/pantos/common/logging.py | """Module for initializing console and file logging.
"""
import dataclasses
import datetime
import enum
import logging
import logging.handlers
import pathlib
import sys
import typing
import json_log_formatter # type: ignore
from pantos.common.blockchains.enums import Blockchain
_HUMAN_READABLE_LOG_FORMAT: typing.F... | 6,703 | Python | .py | 171 | 30.549708 | 78 | 0.624923 | pantos-io/common | 8 | 4 | 0 | GPL-3.0 | 9/5/2024, 10:48:09 PM (Europe/Amsterdam) |
2,287,165 | servicenodes.py | pantos-io_common/pantos/common/servicenodes.py | """Module for communicating with Pantos service nodes.
"""
import dataclasses
import typing
import uuid
import requests
from pantos.common.blockchains.enums import Blockchain
from pantos.common.entities import ServiceNodeBid
from pantos.common.entities import ServiceNodeTransferStatus
from pantos.common.exceptions i... | 12,286 | Python | .py | 277 | 32.819495 | 78 | 0.619207 | pantos-io/common | 8 | 4 | 0 | GPL-3.0 | 9/5/2024, 10:48:09 PM (Europe/Amsterdam) |
2,287,166 | health.py | pantos-io_common/pantos/common/health.py | """Module for analyzing the health of the system.
"""
import concurrent.futures
import dataclasses
from pantos.common.blockchains.base import UnhealthyNode
from pantos.common.blockchains.enums import Blockchain
from pantos.common.blockchains.factory import get_blockchain_utilities
from pantos.common.exceptions import... | 2,785 | Python | .py | 69 | 32.463768 | 81 | 0.666543 | pantos-io/common | 8 | 4 | 0 | GPL-3.0 | 9/5/2024, 10:48:09 PM (Europe/Amsterdam) |
2,287,167 | exceptions.py | pantos-io_common/pantos/common/exceptions.py | """Common generic exceptions and related classes for Pantos.
"""
import abc
import typing
from pantos.common.blockchains.enums import Blockchain
E = typing.TypeVar('E', bound='BaseError')
class ErrorCreator(abc.ABC, typing.Generic[E]):
"""Base class that helps to properly create Pantos errors for a
hierach... | 3,311 | Python | .py | 86 | 29.616279 | 79 | 0.600125 | pantos-io/common | 8 | 4 | 0 | GPL-3.0 | 9/5/2024, 10:48:09 PM (Europe/Amsterdam) |
2,287,168 | restapi.py | pantos-io_common/pantos/common/restapi.py | """Common REST API resources.
"""
import dataclasses
import json
import logging
import flask # type: ignore
import flask_restful # type: ignore
from pantos.common.exceptions import NotInitializedError
from pantos.common.health import check_blockchain_nodes_health
_logger = logging.getLogger(__name__)
"""Logger fo... | 4,393 | Python | .py | 136 | 25.639706 | 76 | 0.648835 | pantos-io/common | 8 | 4 | 0 | GPL-3.0 | 9/5/2024, 10:48:09 PM (Europe/Amsterdam) |
2,287,169 | entities.py | pantos-io_common/pantos/common/entities.py | """Module that defines Pantos entities.
"""
import dataclasses
import enum
import typing
from pantos.common.blockchains.enums import Blockchain
from pantos.common.types import Amount
from pantos.common.types import BlockchainAddress
@dataclasses.dataclass
class ServiceNodeBid:
"""Entity that represents a Pantos... | 4,739 | Python | .py | 146 | 25.883562 | 76 | 0.676001 | pantos-io/common | 8 | 4 | 0 | GPL-3.0 | 9/5/2024, 10:48:09 PM (Europe/Amsterdam) |
2,287,170 | signer.py | pantos-io_common/pantos/common/signer.py | import getpass
import typing
import Crypto.PublicKey.ECC
import Crypto.Signature.eddsa
class SignerError(Exception):
"""Exception class for signer errors.
"""
def __init__(self, message: str, name: str = 'signer error',
**kwargs: typing.Any):
"""Construct a signer error.
... | 5,043 | Python | .py | 156 | 22.333333 | 77 | 0.548979 | pantos-io/common | 8 | 4 | 0 | GPL-3.0 | 9/5/2024, 10:48:09 PM (Europe/Amsterdam) |
2,287,171 | types.py | pantos-io_common/pantos/common/types.py | """Module that defines value object types.
"""
import collections.abc
import decimal
import typing
class BlockchainAddress(str):
pass
class PrivateKey(str):
pass
class TokenSymbol(str):
pass
AccountId = typing.Union[BlockchainAddress, PrivateKey]
Amount = typing.Union[int, decimal.Decimal]
Contra... | 509 | Python | .py | 16 | 29.0625 | 76 | 0.800416 | pantos-io/common | 8 | 4 | 0 | GPL-3.0 | 9/5/2024, 10:48:09 PM (Europe/Amsterdam) |
2,287,172 | enums.py | pantos-io_common/pantos/common/blockchains/enums.py | """Module that defines blockchain-specific enumerations.
"""
import enum
class Blockchain(enum.IntEnum):
"""Enumeration of supported blockchain networks.
"""
ETHEREUM = 0
BNB_CHAIN = 1
# Decommissioned: BITCOIN_RSK = 2
AVALANCHE = 3
SOLANA = 4
POLYGON = 5
CRONOS = 6
# Renamed... | 1,777 | Python | .py | 59 | 22.728814 | 74 | 0.592005 | pantos-io/common | 8 | 4 | 0 | GPL-3.0 | 9/5/2024, 10:48:09 PM (Europe/Amsterdam) |
2,287,173 | factory.py | pantos-io_common/pantos/common/blockchains/factory.py | """Factory for Pantos blockchain utilities.
"""
import typing
from pantos.common.blockchains.base import BlockchainUtilities
from pantos.common.blockchains.enums import Blockchain
from pantos.common.exceptions import NotInitializedError
_blockchain_utilities: dict[Blockchain, BlockchainUtilities] = {}
"""Blockchain-... | 3,642 | Python | .py | 80 | 38.9875 | 76 | 0.727375 | pantos-io/common | 8 | 4 | 0 | GPL-3.0 | 9/5/2024, 10:48:09 PM (Europe/Amsterdam) |
2,287,174 | solana.py | pantos-io_common/pantos/common/blockchains/solana.py | """Module for Solana-specific utilities and errors.
"""
import typing
from pantos.common.blockchains.base import BlockchainUtilities
from pantos.common.blockchains.base import BlockchainUtilitiesError
from pantos.common.blockchains.base import NodeConnections
from pantos.common.blockchains.base import UnhealthyNode
f... | 3,908 | Python | .py | 83 | 37.012048 | 78 | 0.660447 | pantos-io/common | 8 | 4 | 0 | GPL-3.0 | 9/5/2024, 10:48:09 PM (Europe/Amsterdam) |
2,287,175 | cronos.py | pantos-io_common/pantos/common/blockchains/cronos.py | """Module for Cronos-specific utilities and errors. Since Cronos is
Ethereum-compatible, the utilities implementation inherits from the
pantos.common.blockchains.ethereum module.
"""
from pantos.common.blockchains.base import BlockchainUtilitiesError
from pantos.common.blockchains.enums import Blockchain
from pantos.c... | 938 | Python | .py | 23 | 36.478261 | 69 | 0.796031 | pantos-io/common | 8 | 4 | 0 | GPL-3.0 | 9/5/2024, 10:48:09 PM (Europe/Amsterdam) |
2,287,176 | polygon.py | pantos-io_common/pantos/common/blockchains/polygon.py | """Module for Polygon-specific utilities and errors. Since Polygon is
Ethereum-compatible, the utilities implementation inherits from the
pantos.common.blockchains.ethereum module.
"""
from pantos.common.blockchains.base import BlockchainUtilitiesError
from pantos.common.blockchains.enums import Blockchain
from pantos... | 946 | Python | .py | 23 | 36.826087 | 69 | 0.797814 | pantos-io/common | 8 | 4 | 0 | GPL-3.0 | 9/5/2024, 10:48:09 PM (Europe/Amsterdam) |
2,287,177 | celo.py | pantos-io_common/pantos/common/blockchains/celo.py | """Module for Celo-specific utilities and errors. Since Celo is
Ethereum-compatible, the utilities implementation inherits from the
pantos.common.blockchains.ethereum module.
"""
from pantos.common.blockchains.base import BlockchainUtilitiesError
from pantos.common.blockchains.enums import Blockchain
from pantos.commo... | 922 | Python | .py | 23 | 35.782609 | 69 | 0.792368 | pantos-io/common | 8 | 4 | 0 | GPL-3.0 | 9/5/2024, 10:48:09 PM (Europe/Amsterdam) |
2,287,178 | ethereum.py | pantos-io_common/pantos/common/blockchains/ethereum.py | """Module for Ethereum-specific utilities and errors.
"""
import logging
import typing
import urllib.parse
import web3
import web3.contract.contract
import web3.exceptions
import web3.middleware
import web3.types
from pantos.common.blockchains.base import GENERAL_RPC_ERROR_MESSAGE
from pantos.common.blockchains.base... | 20,973 | Python | .py | 439 | 34.954442 | 79 | 0.60773 | pantos-io/common | 8 | 4 | 0 | GPL-3.0 | 9/5/2024, 10:48:09 PM (Europe/Amsterdam) |
2,287,179 | tasks.py | pantos-io_common/pantos/common/blockchains/tasks.py | import dataclasses
import logging
import typing
import uuid
import celery # type: ignore
import celery.result # type: ignore
from pantos.common.blockchains.base import BlockchainUtilities
from pantos.common.blockchains.base import MaxTotalFeePerGasExceededError
from pantos.common.blockchains.enums import Blockchain... | 6,505 | Python | .py | 143 | 37.811189 | 79 | 0.712461 | pantos-io/common | 8 | 4 | 0 | GPL-3.0 | 9/5/2024, 10:48:09 PM (Europe/Amsterdam) |
2,287,180 | avalanche.py | pantos-io_common/pantos/common/blockchains/avalanche.py | """Module for Avalanche-specific utilities and errors. Since the
Avalanche C-Chain is Ethereum-compatible, the utilities implementation
inherits from the pantos.common.blockchains.ethereum module.
"""
from pantos.common.blockchains.base import BlockchainUtilitiesError
from pantos.common.blockchains.enums import Blockc... | 974 | Python | .py | 23 | 38.043478 | 70 | 0.800636 | pantos-io/common | 8 | 4 | 0 | GPL-3.0 | 9/5/2024, 10:48:09 PM (Europe/Amsterdam) |
2,287,181 | sonic.py | pantos-io_common/pantos/common/blockchains/sonic.py | """Module for Sonic-specific utilities and errors. Since Sonic is
Ethereum-compatible, the utilities implementation inherits from the
pantos.common.blockchains.ethereum module.
Note that Pantos used to support Sonic's predecessor Fantom. This module
was renamed accordingly on 2024-10-17.
"""
from pantos.common.blockc... | 1,043 | Python | .py | 25 | 37.64 | 72 | 0.79782 | pantos-io/common | 8 | 4 | 0 | GPL-3.0 | 9/5/2024, 10:48:09 PM (Europe/Amsterdam) |
2,287,182 | base.py | pantos-io_common/pantos/common/blockchains/base.py | """Base module that defines the common class and error interfaces for
all blockchain utilities modules.
"""
import abc
import collections
import copy
import dataclasses
import importlib
import importlib.resources
import inspect
import json
import logging
import math
import pathlib
import pkgutil
import random
import t... | 43,742 | Python | .py | 1,037 | 31.219865 | 79 | 0.612174 | pantos-io/common | 8 | 4 | 0 | GPL-3.0 | 9/5/2024, 10:48:09 PM (Europe/Amsterdam) |
2,287,183 | bnbchain.py | pantos-io_common/pantos/common/blockchains/bnbchain.py | """Module for BNB-Chain-specific utilities and errors. Since the BNB
Smart Chain is Ethereum-compatible, the utilities implementation
inherits from the pantos.common.blockchains.ethereum module.
"""
from pantos.common.blockchains.base import BlockchainUtilitiesError
from pantos.common.blockchains.enums import Blockcha... | 969 | Python | .py | 23 | 37.826087 | 69 | 0.795309 | pantos-io/common | 8 | 4 | 0 | GPL-3.0 | 9/5/2024, 10:48:09 PM (Europe/Amsterdam) |
2,287,184 | generate-signer-key.py | pantos-io_common/scripts/generate-signer-key.py | #! /usr/bin/env python3
"""Generate a private key to be used with the pantos.common.signer
module.
"""
import getpass
import random
import string
import Crypto.PublicKey.ECC
passphrase = getpass.getpass('Passphrase: ')
random_string = ''.join(
random.choices(string.ascii_lowercase + string.digits, k=8))
key_file... | 658 | Python | .py | 18 | 33.111111 | 70 | 0.732283 | pantos-io/common | 8 | 4 | 0 | GPL-3.0 | 9/5/2024, 10:48:09 PM (Europe/Amsterdam) |
2,287,185 | G2G_cal.py | dptech-corp_NAG2G/NAG2G/G2G_cal.py | from utils.G2G_cal import *
if __name__ == "__main__":
if len(sys.argv) < 2:
raise "ERROR"
if ".txt" in sys.argv[1]:
smi_path = sys.argv[1]
N_beam_search = 10
if len(sys.argv) >= 3:
N_beam_search = int(sys.argv[2])
if "--if_full" in sys.argv:
if_f... | 1,330 | Python | .py | 36 | 26.611111 | 93 | 0.493818 | dptech-corp/NAG2G | 8 | 4 | 2 | GPL-3.0 | 9/5/2024, 10:48:09 PM (Europe/Amsterdam) |
2,287,186 | infer.py | dptech-corp_NAG2G/NAG2G/infer.py | #!/usr/bin/env python3 -u
# Copyright (c) DP Techonology, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import ast
import logging
import json
import os
import sys
import numpy as np
from argparse import Namespace
f... | 8,355 | Python | .py | 200 | 35.055 | 230 | 0.595962 | dptech-corp/NAG2G | 8 | 4 | 2 | GPL-3.0 | 9/5/2024, 10:48:09 PM (Europe/Amsterdam) |
2,287,187 | __init__.py | dptech-corp_NAG2G/NAG2G/__init__.py | import importlib
import NAG2G.tasks
import NAG2G.data
import NAG2G.models
import NAG2G.losses
import NAG2G.utils
import NAG2G.optim.lr_scheduler
import NAG2G.modules
import NAG2G.search_strategies
import NAG2G.decoder | 218 | Python | .py | 10 | 20.8 | 31 | 0.894231 | dptech-corp/NAG2G | 8 | 4 | 2 | GPL-3.0 | 9/5/2024, 10:48:09 PM (Europe/Amsterdam) |
2,287,188 | validate.py | dptech-corp_NAG2G/NAG2G/validate.py | #!/usr/bin/env python3 -u
# Copyright (c) DP Techonology, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import ast
import logging
import json
import os
import sys
import numpy as np
from argparse import Namespace
f... | 9,986 | Python | .py | 244 | 28.840164 | 83 | 0.560395 | dptech-corp/NAG2G | 8 | 4 | 2 | GPL-3.0 | 9/5/2024, 10:48:09 PM (Europe/Amsterdam) |
2,287,189 | data_utils.py | dptech-corp_NAG2G/NAG2G/data/data_utils.py | try:
from collections.abc import Iterable
except ImportError:
from collections import Iterable
import logging
import numpy as np
logger = logging.getLogger(__name__)
def collate_cross_2d(
values,
pad_idx,
left_pad=False,
pad_to_length=None,
pad_to_multiple=1,
):
"""Convert a list of 2... | 11,227 | Python | .py | 283 | 31.045936 | 100 | 0.604463 | dptech-corp/NAG2G | 8 | 4 | 2 | GPL-3.0 | 9/5/2024, 10:48:09 PM (Europe/Amsterdam) |
2,287,190 | pad_dataset_3d.py | dptech-corp_NAG2G/NAG2G/data/pad_dataset_3d.py | from unicore.data import BaseWrapperDataset
def collate_tokens_3d(
values,
pad_idx,
left_pad=False,
pad_to_length=None,
pad_to_multiple=1,
):
"""Convert a list of 1d tensors into a padded 2d tensor."""
size = max(v.size(0) for v in values)
size = size if pad_to_length is None else max(... | 1,236 | Python | .py | 34 | 29.264706 | 83 | 0.594979 | dptech-corp/NAG2G | 8 | 4 | 2 | GPL-3.0 | 9/5/2024, 10:48:09 PM (Europe/Amsterdam) |
2,287,191 | random_smiles_dataset.py | dptech-corp_NAG2G/NAG2G/data/random_smiles_dataset.py | # Copyright (c) DP Techonology, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
from unittest.mock import NonCallableMagicMock
from functools import lru_cache
from unicore.data import BaseWrapperDataset
from rdkit im... | 2,984 | Python | .py | 72 | 33.652778 | 83 | 0.639724 | dptech-corp/NAG2G | 8 | 4 | 2 | GPL-3.0 | 9/5/2024, 10:48:09 PM (Europe/Amsterdam) |
2,287,192 | collator.py | dptech-corp_NAG2G/NAG2G/data/collator.py | # Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
import torch
def pad_1d_unsqueeze(x, padlen):
x = x + 1 # pad id = 0
xlen = x.size(0)
if xlen < padlen:
new_x = x.new_zeros([padlen], dtype=x.dtype)
new_x[:xlen] = x
x = new_x
return x.unsqueeze(0)
def... | 1,861 | Python | .py | 57 | 26.561404 | 81 | 0.573743 | dptech-corp/NAG2G | 8 | 4 | 2 | GPL-3.0 | 9/5/2024, 10:48:09 PM (Europe/Amsterdam) |
2,287,193 | pad_dataset.py | dptech-corp_NAG2G/NAG2G/data/pad_dataset.py | # Copyright (c) DP Techonology, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
from . import data_utils
from unicore.data import BaseWrapperDataset
class RightPadDatasetCoord(BaseWrapperDataset):
def __init__... | 959 | Python | .py | 20 | 42.55 | 113 | 0.711063 | dptech-corp/NAG2G | 8 | 4 | 2 | GPL-3.0 | 9/5/2024, 10:48:09 PM (Europe/Amsterdam) |
2,287,194 | coord_noise_dataset.py | dptech-corp_NAG2G/NAG2G/data/coord_noise_dataset.py |
from functools import lru_cache
import numpy as np
import torch
from unicore.data import Dictionary
from unicore.data import BaseWrapperDataset
from . import data_utils
def kabsch_rotation(P, Q):
C = P.transpose(-1, -2) @ Q
V, _, W = np.linalg.svd(C)
d = (np.linalg.det(V) * np.linalg.det(W)) < 0.0... | 2,363 | Python | .py | 63 | 29.539683 | 77 | 0.599034 | dptech-corp/NAG2G | 8 | 4 | 2 | GPL-3.0 | 9/5/2024, 10:48:09 PM (Europe/Amsterdam) |
2,287,195 | customized_unicore_dataset.py | dptech-corp_NAG2G/NAG2G/data/customized_unicore_dataset.py | from unicore.data import UnicoreDataset
from . import data_utils
import numpy as np
class CustomizedUnicoreDataset(UnicoreDataset):
@staticmethod
def get_batch_shapes(self):
"""
Return a list of valid batch shapes, for example::
[(8, 512), (16, 256), (32, 128)]
The first d... | 4,176 | Python | .py | 101 | 29.356436 | 79 | 0.568512 | dptech-corp/NAG2G | 8 | 4 | 2 | GPL-3.0 | 9/5/2024, 10:48:09 PM (Europe/Amsterdam) |
2,287,196 | bart_token_dataset.py | dptech-corp_NAG2G/NAG2G/data/bart_token_dataset.py | # Copyright (c) DP Techonology, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import torch
from functools import lru_cache
from unicore.data import BaseWrapperDataset
from transformers import BartTokenizerFast
imp... | 928 | Python | .py | 23 | 35.608696 | 69 | 0.717464 | dptech-corp/NAG2G | 8 | 4 | 2 | GPL-3.0 | 9/5/2024, 10:48:09 PM (Europe/Amsterdam) |
2,287,197 | mask_points_dataset.py | dptech-corp_NAG2G/NAG2G/data/mask_points_dataset.py | from functools import lru_cache
import numpy as np
import torch
from unicore.data import Dictionary, data_utils
from scipy.spatial import distance_matrix
from unicore.data import LRUCacheDataset, BaseWrapperDataset
class MaskPointsDataset(BaseWrapperDataset):
def __init__(
self,
dataset: torch.... | 10,124 | Python | .py | 237 | 30.278481 | 87 | 0.539164 | dptech-corp/NAG2G | 8 | 4 | 2 | GPL-3.0 | 9/5/2024, 10:48:09 PM (Europe/Amsterdam) |
2,287,198 | bpe_tokenize_dataset.py | dptech-corp_NAG2G/NAG2G/data/bpe_tokenize_dataset.py | import os
import torch
from functools import lru_cache
from unicore.data import BaseWrapperDataset
from tokenizers import Tokenizer
from tokenizers.models import BPE
import logging
logger = logging.getLogger(__name__)
def tostring(tmp, shift=30000):
tmp = tmp.detach().cpu().numpy().tolist()
return "".join([... | 2,329 | Python | .py | 60 | 31.066667 | 86 | 0.628989 | dptech-corp/NAG2G | 8 | 4 | 2 | GPL-3.0 | 9/5/2024, 10:48:09 PM (Europe/Amsterdam) |
2,287,199 | graphormer_dataset.py | dptech-corp_NAG2G/NAG2G/data/graphormer_dataset.py | import random
import pandas as pd
from NAG2G.utils.graph_process import (
process_one,
shuffle_graph_process,
graph2seq_process,
)
from unicore.data import UnicoreDataset, BaseWrapperDataset
from functools import lru_cache
import numpy as np
class CsvGraphormerDataset(UnicoreDataset):
def __init__(se... | 7,755 | Python | .py | 207 | 28.806763 | 88 | 0.605512 | dptech-corp/NAG2G | 8 | 4 | 2 | GPL-3.0 | 9/5/2024, 10:48:09 PM (Europe/Amsterdam) |