text
stringlengths
185
73.3k
repo
stringlengths
7
100
path
stringlengths
4
146
language
stringclasses
7 values
hash
stringlengths
16
16
score
float64
7
8.5
stars
int64
0
237k
# -*- coding: utf8 -*- ''' Автор ArtyLa ''' import browsercontroller, store icon = '789c8d90dd4b53611cc75db36ded2d9b83d80b7412f71211dec4bca828b2a288a0022b2970b5c9e8562abaf33fe8aadca82eca20c2a13799292d7676f6727674b51d75ad2ccb98b3bb9aa35969876fcfd956196ccb2f7c38cf737ecfe79cdfef3978c2d1d8508a8360273455903450e502a947b...
artyl/mbplugin
plugin/chailand.py
.py
c5635bc0e598f6da
7.59
14
#!/usr/bin/python3 # -*- coding: utf8 -*- import collections, hashlib, json, pathlib import bs4 import browsercontroller, store, settings, logging State = collections.namedtuple('State', 'url, active, selection', defaults=('', '', '')) class browserengine(browsercontroller.BrowserController): def active_...
artyl/mbplugin
plugin/discovery.py
.py
3afd0f73d5faaab8
7.59
14
# -*- coding: utf8 -*- ''' Автор ArtyLa ''' import browsercontroller, store icon = '789c73f235636100033320d600620128666450804800e58ff041300cfcffff1f37dee5f59f20a6a77e5c62c35d3fb9614b2ca6461ce21327643e3e75a4e81fcaf653224f41fc02005a870287' login_url = 'https://debet.east.ru/lk' user_selectors = { 'chk_lk_pa...
artyl/mbplugin
plugin/east.py
.py
d4230d66345344c5
7.59
14
# -*- coding: utf8 -*- ''' Автор ArtyLa ''' import browsercontroller, store icon = '789c75937754080a14c67f3cebf178de160d9236ca28698a4a91346c52561a08111a4856cba834282a24499194d1521ab29a48284aa5b4131a3cbcd3393acf77ce77eefdcebde7bbf7fe7135f515faf2150a7d40f2df38f43ff662c0b7422f481ff28d5ff22ff415ed8d9f783ffc24fae32f3d9...
artyl/mbplugin
plugin/lifeby.py
.py
26acf84f91c9a3d5
7.59
14
# -*- coding: utf8 -*- ''' Автор ArtyLa ''' import browsercontroller, store icon = '789c73f235636100033320d600620128666450804800e58ff041302940c0e17982a0c3d30f020e4f0c48d309d2fb3440d0e1d97f08c66f06480ea8ee00b21aa0dd0a40b10708339e5dc0adf7e907a89a07020ef705d0cc85e9ff2fe4f0b481807e909a05c8f2203d48663cc0ee86e70ec8f6a0b...
artyl/mbplugin
plugin/lovit.py
.py
e15f8582cc86c178
7.59
14
# -*- coding: utf8 -*- ''' Автор Pasha ''' ''' проверка баланса Mango Office https://www.mango-office.ru/ ''' import browsercontroller, store icon = '789c5d936f4c5b551c866b629aeccb62624c8c31c644330daddb22d2f53fbdbddcdb7b439c7106bf384d16659aa9fb1337956846e234e86414904e706e336c1dc3125a281436a8c028d5398b7143e868279b71c49...
artyl/mbplugin
plugin/mangooffice.py
.py
1c63532a1f7b68ad
7.59
14
# -*- coding: utf8 -*- ''' Автор ArtyLa ''' import os, sys, io, re, logging, collections import requests import store, settings, browsercontroller interUnit = 'GB' icon = '789C73F235636100033320D600620128666450804840E591C1FFFFFFB1E237DF1F32CCBF91C7B0F66E13C3D3AFD771AA43C63FFE7C6688D8C5CC10B69381E1FCEB6D601A1917...
artyl/mbplugin
plugin/megafon.py
.py
003ec2a6c80a8b68
7.59
14
# -*- coding: utf8 -*- ''' Автор ArtyLa ''' import browsercontroller, store icon = '789C73F235636100033320D600620128666450804840E591C1FFFFFFB1E237DF1F32CCBF91C7B0F66E13C3D3AFD771AA43C63FFE7C6688D8C5CC10B69381E1FCEB6D601A19171ED1C0A9F7CCAB4D286AB1E987E15B1F8EA1E9FF87A1069F7E10FEF7FF2F5C7FDC5E1E9CFA41F265C7F4C1EA57D...
artyl/mbplugin
plugin/megafonb2b.py
.py
06663a384ba755ad
7.59
14
# -*- coding: utf8 -*- ''' Автор ArtyLa ''' import logging import browsercontroller, store icon = '789c73f235636100033320d600620128666450804800e58ff041300c9c6c669801c49f80f8d7a956d6ff08ccf2ff540b330483d8487220b5503dd380f80b10ff47c72075677b84c018a41f9b1aec7a19ff5f5b64fffff5a545ffbf3c3b03c4a7ffbfbeb8f0ffb5857660391...
artyl/mbplugin
plugin/mgts.py
.py
0351c4226aa70bdb
7.59
14
#!/usr/bin/python3 # -*- coding: utf8 -*- import urllib, logging, os, sys import browsercontroller, store icon = '789c6d935d48935118c79f77f3462a596ab3ec26e8a68b8292284aadb02231a328d7726bdfefb677ab0d9766769176d177506441901559596494269446a5175a89b577aee92ad30b97d39272098184d0bff3ee9df4e5811fe71ccef33bdf4fde96154914...
artyl/mbplugin
plugin/mosenergosbyt.py
.py
5a7a676a9b244d46
7.59
14
# -*- coding: utf8 -*- ''' Автор d1mas проверка задолженности по услугам ЖКХ РКЦ Наш Дом https://rkc-m.ru''' import browsercontroller, store, settings login_url = 'https://lk.rkc-m.ru/#/login' user_selectors = {'chk_lk_page_js': "document.querySelector('.menu__link')!=null", 'chk_login_page_js': "do...
artyl/mbplugin
plugin/nashdom.py
.py
ecb1ee99c10ccf03
7.59
14
# -*- coding: utf8 -*- ''' Автор ArtyLa ''' import re, logging import store icon = '789cd594fb5bcf6718c75fdfe6344b63b6396cb699310bdfc6b6b6b699b1759212e94c22a950115272e8208452513a53a193ce27253914954a6725158544947248e9b04f65bbf813f6beaef7f37e5ed77d3f3fdc3f3cf70255d9a10c4876084c1772f41b8b1831581041b6d4a0fbef0316a41c...
artyl/mbplugin
plugin/ntvplus.py
.py
500a34563a55025a
7.59
14
# -*- coding: utf8 -*- ''' Автор ArtyLa, исправил Dimas ''' import browsercontroller, store icon = '789C73F235636100033320D600620128666450804840E5A905989999F1CAB359A833B0DBEB90AC9F595A88817F423283D895490C5C31F644EB67E46065E0CEF264103DD3CB20B2AF9924FDEC2EFA0CC23B1B1844CFF531F0E4FB3230097013AD9F7F6A1A582DFF943406663...
artyl/mbplugin
plugin/onlime.py
.py
979934f41eb6c06f
7.59
14
# -*- coding: utf8 -*- 'Оплата парковки parking.mos.ru' '(Вход через логин/пароль на login.mos.ru)' ''' Автор ArtyLa ''' import browsercontroller, store icon = '789C9D53DB2B836118FF297F803FC1A5D2CCA1E44E960BA55D897B17AE28CA36931212CB056EA8D11C4A920B16FAB6B183651726DA2C5BB12D87D5AC1DB2B23944CDFBBCD6D2FA3E93B77EF5...
artyl/mbplugin
plugin/parking_mos.py
.py
a6a7b593f853413c
7.59
14
#!/usr/bin/python3 # -*- coding: utf8 -*- import logging import browsercontroller, store icon = '789CA5D4B171DB401484E1A719050E5D024257A078C7B97BB852B614041ED7B1B16A708012942BA0FF7BA065DAA2259222780310CB77B8EFEEC8AFDF1E3E55BF1EEEABBE70FE7C6C77B5ECC17DFD79DD9D5C97FB5DF67E9A0717492A3F534F8F3FAA16D1068D605969A16D55D...
artyl/mbplugin
plugin/rostelecom.py
.py
f77c73915464d289
7.59
14
#!/usr/bin/python3 # -*- coding: utf8 -*- import os, sys, re, time, logging, collections import browsercontroller, store icon = '789c85533d685441103ec140849c6f673d0b45482ab5b230106bc54e520411244840fc4525625a8b07c9db9dddf7ee475021d7893ff8d388a6b04861fc0563633a3b5110150d09686202f15ebe79897017ee928561879df966bef9d94...
artyl/mbplugin
plugin/rucaptcha.py
.py
85c0530db50d56a9
7.59
14
# -*- coding: utf8 -*- ''' Автор ArtyLa ''' import os, sys, re, logging import requests import store icon = '789C65535B485451145D338E14D9400FEDF5950465D857A51F2104817D14D64720FE0AE547914124D94BA33E82088AE885501452849295669123939A44666ABE98291F33EAD88CD3CC75C6B9CF73EFDCDBBDE7CE1D9C3AB0388F7DCE5E7BAFBDCF81B26207E8...
artyl/mbplugin
plugin/smile-net.py
.py
5be9aa60504747cc
7.59
14
# -*- coding: utf8 -*- ''' Сумма по всем стокам Стоки прописаны в mbplugin.ini в виде: [stocks_broker_ru] stock1 = AAPL, 1, Y stock2 = TATNP, 16, M stock3 = FXIT, 1, F remain1 = USD, 5 remain2 = RUB, 536 currenc = USD имя набора берется из login - название секции [stocks_<логин>] строки stockNN=код сто...
artyl/mbplugin
plugin/stock.py
.py
92bcb2a74f0ead2a
7.59
14
# -*- coding: utf8 -*- ''' Автор ArtyLa ''' import os, sys, re, logging import store, settings icon = '789C73F235636100033320D600620128666450804840E591C1FFFFFFA98E3FBC7ECA706CCB6C86E53D290CCBBB9319564FCC6638BF7F25C3AF9FDF09EA3DB2713A43758008434F9A31C3A619650C7B977732ACEC4D67688BD760688E5262B87E6A274EBDDBE6D531344...
artyl/mbplugin
plugin/strelka.py
.py
aa449b59774b1afd
7.59
14
# -*- coding: utf8 -*- ''' Автор ArtyLa ''' import collections, datetime, logging, os, re, sys, time import browsercontroller, settings, store icon = '789CAD532DA8C250143E0F5E31080B83D581618F056141EBE00583F0C06235D9865530894D64C13010C12C68B50D8345C3FA82C16A90051141C7E6DF39CF5DAE6F4E1EBCF7C11776EE77CE3DDF39BB9F5FF...
artyl/mbplugin
plugin/tele2.py
.py
85c241021bd5b6f7
7.59
14
# -*- coding: utf8 -*- ''' Автор ArtyLa ''' import os, sys, re, logging, random, time import requests import store def get_balance(login, password, storename=None, wait=True, **kwargs): ''' На вход логин и пароль, на выходе словарь с результатами ''' store.update_settings(kwargs) store.turn_loggin...
artyl/mbplugin
plugin/test1.py
.py
d84bb06f8e9d0b41
7.09
14
# -*- coding: utf8 -*- ''' Автор ArtyLa ''' import os, sys, re, io, logging from PIL import Image, ImageTk import tkinter.tix as Tix import urllib.parse as urlparse import bs4 import store def get_human_captcha(buffer): get_human_captcha.res = '' def callback(ev): get_human_captcha.res = ...
artyl/mbplugin
plugin/test2.py
.py
a709e95ff128cb21
8.09
14
#!/usr/bin/python3 # -*- coding: utf8 -*- import browsercontroller, store, settings login_url = 'https://lk.saures.ru/dashboard' user_selectors = {'chk_lk_page_js': "document.querySelector('form input[type=password]') == null", 'chk_login_page_js': "document.querySelector('form input[type=passw...
artyl/mbplugin
plugin/test3.py
.py
0f37cd4a63c61191
8.09
14
#!/usr/bin/python3 # -*- coding: utf8 -*- ''' пример плагина почти на чистом playwright без упрощенной логики ''' import time, re, json, logging, os import browsercontroller, store class browserengine(browsercontroller.BrowserController): def data_collector(self): # Нажмите кнопку "Демо-доступ" или...
artyl/mbplugin
plugin/test4.py
.py
38f95c868e755dd6
8.09
14
# -*- coding: utf8 -*- ''' Автор ArtyLa ''' import sys import playwright.sync_api import store icon = '789C9593CB2B44511CC7BF1E49918429C98285A2C9D6C64E91CD142B0B0BB3B555FC0962E71FC0828D479E83A99944C32499143316081393CC9DFB987BE7DE3BF7EDB81E79D4BDD7AF3E9BF3EB7BCEF77C7FE7F404BACA615717A19D50FB41095ADE1B1FFDEF6559D6...
artyl/mbplugin
plugin/test5_yota2.py
.py
3a731aacadcd6576
8.09
14
# -*- coding: utf8 -*- ''' Автор ArtyLa ''' import browsercontroller, store icon = '789c73f235636100033320d600620128666450804800e58ff041300cfcffff1fce6e56ce5205e249407c0d887f02f17f20fe01c45780b80f881591f5c130546f3454ed7f3cf81b1087a2eb078a1900f12f34b54f81f802103f441307a9d342d3bf08491ee4067f062400e43b43ed86a9998fa6f...
artyl/mbplugin
plugin/ucelluz.py
.py
f1bc50b96c4c6481
7.59
14
#!/usr/bin/python3 # -*- coding: utf8 -*- import browsercontroller, store icon = '789c3d93fb4fdb6514c667e2cfc63fc11f75f44a4be9a037ca147023c1658325fbc10bd36ccb748be22d243361730c286d29145a5a2e5bc476dd040b4c371c17875b608a90ccc82463863b01b98ce924baf6e36901dfe4c9fb3de7bccf39e77bdee7b5e71b9edd955c06c18b82e7b7f1ccae17b60...
artyl/mbplugin
plugin/uminet.py
.py
aea54f4b53c150ca
7.59
14
# -*- coding: utf-8 -*- """ Plot the validation with altimetry derived tidal constant. Using the previously written pre_interp_amp_phase.py classes. @author: khan @email: jamal.khan@legos.obs-mip.fr """ import numpy as np import matplotlib.pyplot as plt from netCDF4 import Dataset import os class Point(object): '...
jamal919/pycaz
examples/scripts/post_altimetry_validation.py
.py
154921e15c3b5498
7.42
6
# -*- coding: utf-8 -*- """ Plot the validation with altimetry derived tidal constant. Using the previously written pre_interp_amp_phase.py classes. @author: khan @email: jamal.khan@legos.obs-mip.fr """ import numpy as np import matplotlib.pyplot as plt import matplotlib.tri as mtri from netCDF4 import Dataset import ...
jamal919/pycaz
examples/scripts/post_altimetry_validation_ugrid.py
.py
496e68e86cb3a69d
7.42
6
#!/usr/bin/env python # -*- coding: utf-8 -*- """ Combines the maxelev.gr3 files into a single netcdf with corresponding experiment information. It produces a netCDF file, similar to the structure of SHCISM output. The mesh structure is derived from the input hgrid.gr3 file. Author: Jamal Uddin Khan Email: jamal.kh...
jamal919/pycaz
examples/scripts/post_maxelev2nc.py
.py
c933e82d86e27b29
7.42
6
#!/usr/bin/env python # -*- coding: utf-8 -*- """ Merge the gr3 formatted maximum elev and maximum velocity outputs. This script is a standalone script to merge the output variable containing maximum values. It is developed as a part of the schism toolbox module and intended to be included in the toolbox itself. T...
jamal919/pycaz
examples/scripts/post_mergegr3.py
.py
08f78182b8f611df
7.42
6
# -*- coding: utf-8 -*- """ Merge the netCDF output from SCHISM model. This is a standalone script to merge the netcdf output from SCHISM model for elevation only. It is faster than the fortran script provided with the source code. However, it can only combine water level (elev) in a comodo compatible format, which a...
jamal919/pycaz
examples/scripts/post_mergenc_comodo.py
.py
fc16670fc4183a9f
7.42
6
# -*- coding: utf-8 -*- """ Merge the netCDF output from SCHISM model. This is a standalone script to merge the netcdf output from SCHISM model for elevation only. This version of mergenc uses a timeslice wise chunking approach and a much slower than the original mergenc script. However, it allows to access the data...
jamal919/pycaz
examples/scripts/post_mergenc_v2.py
.py
7d9bd9f5cfd2443f
7.42
6
#!/usr/bin/env python # -*- coding: utf-8 -*- """ Sorting gr3 output from SCHISM in pythonic way. The script is intended to sort a lot of max elevation results and sorting them at node based on the inundation value. This script was developed to tackle the problem of sorting the storm track developed in Kerry Hydro sim...
jamal919/pycaz
examples/scripts/post_sorting_gr3.py
.py
7b0ff523a134580e
7.42
6
#!/usr/bin/env python # -*- coding: utf-8 -*- """ Sorting gr3 output from SCHISM in pythonic way. The script is intended to sort a lot of max elevation results and sorting them at node based on the inundation value. This script was developed to tackle the problem of sorting the storm track developed in Kerry Hydro sim...
jamal919/pycaz
examples/scripts/post_sorting_gr3_mpi.py
.py
124490a154213bc4
7.42
6
#!/usr/bin/env python # -*- coding: utf-8 -*- """ Interpolation of Amplitude and Phase using the interpolant derived by Zhigang Xu. For details see - https://doi.org/10.1007/s10236-017-1122-8 This new update to algorithm tries to minimize the time of interpolation from a large grid. The previous approach was to build...
jamal919/pycaz
examples/scripts/pre_interp_amp_phase.py
.py
21f3c7f16888c101
7.42
6
#!/usr/bin/env python # -*- coding: utf-8 -*- """ This script is a standalone script to set nodal values using shape or tiff files. It is also possible to set rule based values, but it is probably simpler to approach this with generic mesh class itself. @license: GPL3 @author: khan @email: jamal.khan@legos.obs-mip.f...
jamal919/pycaz
examples/scripts/pre_set_node_values.py
.py
e66796b84ebb33f1
7.42
6
#!/usr/bin/env python import logging import numpy as np from utide._time_conversion import _normalize_time as date2num from utide._ut_constants import ut_constants, constit_index_dict from utide.harmonics import FUV from pycaz.typing import ArrayLike logging.getLogger(__name__) # required information from utide pa...
jamal919/pycaz
examples/scripts/utide_fuv.py
.py
5556b93c36639ae2
7.42
6
# -*- encoding: utf-8 -*- import logging import numpy as np import pandas as pd import rioxarray import xarray as xr from scipy.ndimage import center_of_mass from shapely import Point from .track import Record, Track def normalize_minmax(arr: np.ndarray|xr.DataArray) -> np.ndarray|xr.DataArray: """Normalize an ...
jamal919/pycaz
pycaz/cyclone/extract.py
.py
3b0814a3eebe6728
7.42
6
# pytest_plugins must live in the root conftest.py (non-top-level not supported). # # Fixtures here boot a *real* hivemind-core master in-process via hivescope's # loopback WebSocket transport and connect the *real* HiveMind-cli terminal # client to it over a real HiveMessageBusClient handshake. Only the terminal's # s...
JarbasHiveMind/HiveMind-cli
tests/e2e/conftest.py
.py
e6ae143196e6882b
7.95
7
"""ACL policy-admission e2e tests for HiveMind-cli. Three enforcement paths from the new PolicyChain model (MessageTypeACLPolicy + OVOSAgentPolicy): 1. allowed_types denial — client whose allowed_types excludes recognizer_loop:utterance has its utterance blocked with ACL_DISALLOWED_TYPE; the message never reach...
JarbasHiveMind/HiveMind-cli
tests/e2e/test_acl.py
.py
8bee140178540630
7.95
7
"""A python wrapper around the avanza api.""" import json import logging import urllib.error import urllib.request from enum import Enum from typing import Any import aiohttp LOGGER = logging.getLogger(__name__) AVANZA_API_ENDPOINT = "https://www.avanza.se/_api" AVANZA_API_STOCK_URL = AVANZA_API_ENDPOINT + "/market...
claha/pyavanza
pyavanza/__init__.py
.py
7fcdb780df30219a
7.42
6
"""Test the api.""" import urllib.error import aiohttp import pytest from aiohttp.test_utils import make_mocked_coro import pyavanza ORDERBOOK_ID_AVANZA_BANK_HOLDING = 5361 ORDERBOOK_ID_XACT_BEAR = 12251 ORDERBOOK_ID_XACT_BULL = 12252 ORDERBOOK_ID_OMX_STOCKHOLM_30 = 19002 ORDERBOOK_ID_USD_SEK = 19000 ORDERBOOK_IDS...
claha/pyavanza
tests/test_api.py
.py
e182b919ee157bcd
7.92
6
import json import time from typing import Any, Callable, Dict, List, Optional, Tuple, cast # NOQA: F401 import requests from catalogsources.adapters.base_adapter import BaseAdapter from catalogsources.adapters.helpers import check_rate_limit, games_json_fetch_to_file, platforms_json_fetch_to_file from catalogsources...
Kartones/finished-games
finishedgames/catalogsources/adapters/giant_bomb_adapter.py
.py
f8e6edc02a655dd4
7.45
7
import json from time import time from typing import Any, Dict, Tuple def check_rate_limit( max_tokens: int, time_window: int, token_bucket: float, last_check_timestamp: float, time: Any = time ) -> Tuple[float, float, bool]: """ Token bucket algorithm implementation as rate limit. Allows up to `max_...
Kartones/finished-games
finishedgames/catalogsources/adapters/helpers.py
.py
903b0a15c583707b
7.45
7
#!/usr/bin/env python3 """ Docker PS 聚类显示工具 将同一服务的多个副本聚合显示 """ import subprocess import re from collections import defaultdict def get_containers(): """获取所有运行中的容器""" result = subprocess.run( ["docker", "ps", "--format", "{{.Names}}|{{.Status}}"], capture_output=True, text=True ) ...
Kaoruha/GinkGO
.conf/dps.py
.py
11102f563645dc4a
7.6
15
""" file_type 参数解析工具 无模块级副作用(无 FastAPI/core 依赖),可安全在测试中导入。 """ def _resolve_file_type(raw): """解析 file_type 参数:支持整数、数字字符串、枚举名、别名、snake_case (#5774 #5578)""" from ginkgo.enums import FILE_TYPES if isinstance(raw, int): result = FILE_TYPES.from_int(raw) if result is None: raise...
Kaoruha/GinkGO
api/api/_file_type.py
.py
38a320017055babf
7.6
15
""" Live Account 相关API路由 实盘账号管理接口,对应前端 web-ui/src/api/modules/live.ts """ from fastapi import APIRouter, Query, Request, status, HTTPException from typing import Optional import asyncio from core.logging import logger from core.response import ok from core.exceptions import NotFoundError, ValidationError, BusinessErr...
Kaoruha/GinkGO
api/api/accounts.py
.py
f81df2a6a81ebacf
7.6
15
""" 竞技场相关API路由 """ from typing import List, Optional from fastapi import APIRouter, HTTPException, status from pydantic import BaseModel, Field from core.response import ok router = APIRouter() class ArenaComparisonRequest(BaseModel): """Arena 对比请求体(#5400) task_ids 为回测任务ID列表,端点按此读取各任务的 net_value 分析器记录, ...
Kaoruha/GinkGO
api/api/arena.py
.py
9330325d3896ab9e
7.6
15
""" 认证相关API路由 """ from fastapi import APIRouter, HTTPException, status, Request, Header from pydantic import BaseModel, ConfigDict from datetime import datetime, timedelta from typing import Optional import bcrypt from middleware.auth import create_access_token, token_blacklist from jose import JWTError, jwt from cor...
Kaoruha/GinkGO
api/api/auth.py
.py
f1c07ae09da85fb7
7.6
15
""" 仪表盘相关API路由 """ from fastapi import APIRouter, Request from core.config import settings from core.logging import logger from core.response import ok from models.dashboard import DashboardStats, SystemHealthItem import sys from pathlib import Path # 添加 Ginkgo 源码路径 ginkgo_path = Path(__file__).parent.parent.parent /...
Kaoruha/GinkGO
api/api/dashboard.py
.py
865e6ff0253ec0c6
7.6
15
"""文件管理 flat 适配路由 (#5659) 前端 web-ui/src/api/modules/file.ts 调用的 /api/v1/file_list、/api/v1/file、 /api/v1/update_file、/api/v1/file/{id} 等 flat 端点在后端无对应路由(全 404)。 FileService 能力完整,但只通过 /components(组件视角)、 /node-graphs/{uuid}/files(portfolio 绑定视角)暴露。本 router 提供面向 "全局文件管理"语义的 flat 适配端点,薄委托 FileService 既有方法,不改 service 核心。 ""...
Kaoruha/GinkGO
api/api/file.py
.py
ee5aeade22aafc63
7.6
15
""" Signal Execution Report API (#6150 半手动实盘核心). 用户收到交易信号通知 → 手动执行 → 通过本端点回报实际成交价/量。 端点职责仅限:翻译请求 → 调 signal_tracking_service.set_confirmed → 翻译响应 (API→Service 单向,端点零业务逻辑)。actual_* 写入与时间偏差由 service 层完成。 """ import sys from pathlib import Path from datetime import datetime from typing import Optional from fastapi impor...
Kaoruha/GinkGO
api/api/signals.py
.py
dbe288a679835e9d
7.6
15
""" 系统状态和Worker管理API路由 """ from fastapi import APIRouter, HTTPException, Request from typing import Dict, Any from core.config import settings from core.response import ok from core.logging import logger from api.settings import _require_admin # #6175: 单一权威 admin 权限源,不在本模块重写 router = APIRouter() # #5878 Worker Man...
Kaoruha/GinkGO
api/api/system.py
.py
9bc50b90d2b562cf
7.6
15
# Upstream: Web UI (定时任务管理页面) # Downstream: TaskTimerExecutionService (执行记录服务), system_service (任务状态) """ TaskTimer API 定时任务管理 API,提供执行历史查询和任务状态查看。 """ from typing import Optional from fastapi import APIRouter, Query from datetime import datetime from core.response import ok, paginated from core.logging import logg...
Kaoruha/GinkGO
api/api/task_timer.py
.py
fd6ade355e66c390
7.6
15
""" API Server 配置管理 只包含 API Server 特定的配置(端口、JWT、CORS等) 数据库和其他配置直接从 Ginkgo GCONF 读取 """ import sys from pathlib import Path from typing import List from pydantic_settings import BaseSettings from pydantic import Field, model_validator # 添加 Ginkgo 源码路径 ginkgo_path = Path(__file__).parent.parent.parent / "src" sys.path...
Kaoruha/GinkGO
api/core/config.py
.py
b86f894a993975f3
7.6
15
""" API Server日志配置 集成Ginkgo的GLOG和Rich格式化 """ import logging import sys from pythonjsonlogger import jsonlogger # 尝试导入Ginkgo的GLOG try: from ginkgo.libs import GLOG GINKGO_GLOG_AVAILABLE = True except ImportError: GINKGO_GLOG_AVAILABLE = False class TraceIdFilter(logging.Filter): """从 GLOG _trace_id_c...
Kaoruha/GinkGO
api/core/logging.py
.py
7878ba0d9290ccbf
7.6
15
""" Redis client utilities for API Server """ from typing import Optional, Any import asyncio import redis.asyncio as aioredis from core.logging import logger # 数据库/Redis 配置从 GCONF 读取(与 get_db_config() 保持一致) def _get_redis_config(): from ginkgo.libs import GCONF return {"host": GCONF.REDISHOST, "port": GCON...
Kaoruha/GinkGO
api/core/redis_client.py
.py
bcccacaf71462ea7
7.6
15
""" API 版本配置 提供统一的API版本控制和路径前缀管理 """ from typing import Set # API 版本号 API_VERSION = "v1" # API 路径前缀 API_PREFIX = f"/api/{API_VERSION}" # 不需要版本控制的端点 NO_VERSION_ENDPOINTS: Set[str] = { "/health", "/api/health", "/docs", "/redoc", "/openapi.json", "/ws", } # 路由标签映射 API_TAGS = { "auth": "认证...
Kaoruha/GinkGO
api/core/version.py
.py
36e47a763d05c844
7.6
15
""" API 请求统计中间件(内存聚合,开发环境) 记录每个请求的状态码与响应时间,按日/月窗口聚合供 /api-stats 端点读取。 进程内计数,不落库(与 rate_limit.py 同属「开发环境」内存模式),重启归零。 """ import time from datetime import datetime, timezone from starlette.middleware.base import BaseHTTPMiddleware class ApiStatsCollector: """进程内 API 请求统计聚合器(按当日/当月窗口)。""" def __init__(self): ...
Kaoruha/GinkGO
api/middleware/api_stats.py
.py
6c93ebb97cabdcfa
7.6
15
""" JWT认证中间件 统一处理所有请求的 token 校验: 1. 检查 Authorization header (Bearer token) 2. 如果 header 没有,检查 URL query param (token=xxx) 3. 无 token 或 token 无效/过期 → 401 4. WebSocket 由 handler 调用 verify_token() 自行校验(BaseHTTPMiddleware 不支持 WebSocket) 5. Token 黑名单:logout/改密码后 token 立即失效(#5802, #5582, #5448) """ import uuid as _uuid from...
Kaoruha/GinkGO
api/middleware/auth.py
.py
3609fa01061541a3
7.6
15
""" 全局错误处理中间件 将所有异常转换为统一的响应格式。 """ import contextlib import uuid from fastapi import Request, HTTPException, status from fastapi.responses import JSONResponse from core.logging import logger from core.exceptions import APIError from middleware.trace_id import TRACE_ID_HEADER try: from ginkgo.libs import GLOG ...
Kaoruha/GinkGO
api/middleware/error_handler.py
.py
a97d30990a617df9
7.6
15
""" 请求限流中间件 """ from fastapi import Request, HTTPException, status from starlette.middleware.base import BaseHTTPMiddleware from typing import Dict, Optional import os import time import uuid from core.logging import logger from core.redis_client import get_redis # Issue #3847: 防止 IP 记录无限累积 _MAX_IPS = 10000 _FULL_CL...
Kaoruha/GinkGO
api/middleware/rate_limit.py
.py
087c1b45c861a1e2
7.6
15
""" Trace ID 中间件(全量注入) 每个请求注入一个 trace_id 到 GLOG contextvars,贯穿该请求在 API 进程内的全部日志: - src 层(service/crud/engine)走 GLOG structlog,ecs_processor 读 _trace_id_ctx 输出 trace.id - api 层(router/middleware)走 core.logging 标准 logging,TraceIdFilter 同源读 _trace_id_ctx 两层共享同一 _trace_id_ctx 源头,单 trace_id 即可聚合一个请求全链路日志。 透传客户端 X-Trace-Id...
Kaoruha/GinkGO
api/middleware/trace_id.py
.py
36f38452f35e351b
7.6
15
""" Live Account 相关数据模型 与前端 web-ui/src/api/modules/live.ts 中的类型定义对应 """ from pydantic import BaseModel, Field, field_validator, AliasChoices from typing import Optional, List, Dict, Any from enum import Enum from datetime import datetime class ExchangeType(str, Enum): """交易所类型""" OKX = "okx" BINANCE = "...
Kaoruha/GinkGO
api/models/accounts.py
.py
f1e5f4fb87d1672d
7.6
15
""" Dashboard相关数据模型 """ from pydantic import BaseModel from typing import Literal, Optional class SystemHealthItem(BaseModel): """系统健康检查项""" name: str status: Literal["ONLINE", "OFFLINE", "WARNING"] detail: Optional[str] = None class DashboardStats(BaseModel): """仪表盘统计数据""" total_asset: flo...
Kaoruha/GinkGO
api/models/dashboard.py
.py
3036ab2f2ac89d7d
7.6
15
""" Portfolio相关数据模型 """ from pydantic import BaseModel, Field from typing import Optional, List, Dict, Any from datetime import datetime from enum import Enum class PortfolioMode(str, Enum): """Portfolio运行模式""" BACKTEST = "BACKTEST" PAPER = "PAPER" LIVE = "LIVE" class PortfolioState(str, Enum): ...
Kaoruha/GinkGO
api/models/portfolio.py
.py
7f25d5f5df6d15ff
7.6
15
""" 事务状态记录模型 """ from typing import Optional, List, Dict, Any from datetime import datetime from pydantic import BaseModel, Field class TransactionStep(BaseModel): """事务步骤记录""" name: str status: str = Field(..., description="步骤状态: pending, executing, completed, failed, compensated") result: Optional[D...
Kaoruha/GinkGO
api/models/transaction.py
.py
fd7f80d701a9217c
7.6
15
"""#5565: API 请求 Pydantic 模型 为原本接受 ``data: dict`` 的端点提供字段白名单 + 类型校验,防止 mass assignment(任意 key 流入 service/saga)。 约定:全部 ``extra='forbid'``(与 ``RegisterRequest`` #5458 一致)。 本模块顶层只依赖 pydantic,不触发 ginkgo container 初始化, 便于单元测试直接导入。 注:``create_api_key`` / ``update_portfolio`` 的请求 schema 由 master 内联定义于 ``api/api/settings.py...
Kaoruha/GinkGO
api/request_models.py
.py
85ea405aefd24082
7.6
15
""" 节点图配置 Pydantic Schemas """ from pydantic import BaseModel, Field from typing import Optional, List, Dict, Any from datetime import datetime class NodePort(BaseModel): """节点端口定义""" name: str type: str # 'input' or 'output' data_type: str required: bool = False label: Optional[str] = None ...
Kaoruha/GinkGO
api/schemas/node_graph.py
.py
a24c37053cbf5eb1
7.6
15
"""Portfolio analytics & event timeline schemas.""" from typing import Any, Dict, List, Optional from pydantic import BaseModel, Field class PortfolioMetrics(BaseModel): """All available performance metrics for a portfolio.""" net_value: Optional[float] = None annual_return: Optional[float] = None max...
Kaoruha/GinkGO
api/schemas/portfolio.py
.py
cce30f0bef7bc900
7.6
15
from django.db import connection, models from django.test import TransactionTestCase from view_table.models import ViewTable class Author(models.Model): name = models.CharField(max_length=100) class Meta: app_label = "tests" db_table = "tests_join_author" class Publisher(models.Model): ...
pyohei/django-view-table
tests/test_raw_sql_join.py
.py
8db849b08c6fae90
8.12
16
import hypothesis.strategies as st from hypothesis import assume from tensora import Tensor from tensora.expression import ( InconsistentDimensionsError, MutatingAssignmentError, NameConflictError, ast, ) from tensora.format import Format, Mode from tensora.problem import Problem names = st.from_regex...
drhagen/tensora
fuzz_tests/strategies.py
.py
21bab0f145e7f4b7
7.06
12
__all__ = [ "allocate_taco_structure", "taco_structure_to_cffi", "taco_type_header", "take_ownership_of_arrays", "take_ownership_of_tensor", "take_ownership_of_tensor_members", "tensor_cdefs", ] import platform from itertools import pairwise from weakref import WeakKeyDictionary from cffi ...
drhagen/tensora
src/tensora/compile/_cffi_ownership.py
.py
21d407a70bae9dc6
7.56
12
__all__ = [ "BackendCompiler", "BroadcastTargetIndexError", "TensorMethod", ] from dataclasses import dataclass from enum import Enum from inspect import Parameter, Signature from returns.result import Failure, Success from ..expression.ast import Assignment from ..generate import Language, generate_code...
drhagen/tensora
src/tensora/compile/_tensor_method.py
.py
3ed951c59c658bd9
7.56
12
__all__ = ["to_iteration_graphs"] from collections import defaultdict from collections.abc import Iterator from dataclasses import replace from functools import reduce, singledispatch from itertools import chain, count, permutations, product from ..format import Format, Mode from ..iteration_graph import iteration_gr...
drhagen/tensora
src/tensora/desugar/_to_iteration_graphs.py
.py
11b0c9f89197f216
7.56
12
__all__ = ["Language", "generate_code"] from enum import Enum from returns.result import Failure, Result, Success from ..codegen import ir_to_c, ir_to_llvm from ..kernel_type import KernelType from ..problem import Problem from ._tensora import generate_module_tensora class Language(str, Enum): """The language...
drhagen/tensora
src/tensora/generate/_base.py
.py
668c224c35a9f781
7.56
12
"""Peephole optimizations. Current optimization implemented: * add_zero: 0 + expr or expr + 0 => expr * minus_zero: expr - 0 => expr * multiply_zero: 0 * expr or expr * 0 => 0 * multiply_one: 1 * expr or expr * 1 => expr * equal_same: a == a or a <= a or a >= a => true * not_equal_same: a != a or a < a or a > a => fal...
drhagen/tensora
src/tensora/ir/_peephole.py
.py
5c092e4b4ec503ef
7.56
12
# Copyright 2020-present MongoDB, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in wri...
mongodb/pymongo-auth-aws
pymongo_auth_aws/auth.py
.py
7c31d7fb3a2d0ab1
7.54
11
# Copyright 2020-present MongoDB, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in wri...
mongodb/pymongo-auth-aws
test/test_pymongo_auth_aws.py
.py
eb19bc048acef9e3
7.04
11
import re import sys from pathlib import Path # Make pelutils importable for autodoc sys.path.insert(0, str(Path(__file__).resolve().parents[2])) from docutils import nodes from sphinx.transforms import SphinxTransform from pelutils import __version__ as release version = ".".join(release.split(".")[:2]) project = ...
peleiden/pelutils
docs/source/conf.py
.py
722328acad3336c7
7.45
7
"""Utilities for pelutils C api, including a helpful way of passing numpy arrays and torch tensors to C.""" from __future__ import annotations import numpy as np import numpy.typing as npt from pelutils.misc._conditional_import import import_torch from pelutils.types import AnyArray as AnyArray torch = import_torch...
peleiden/pelutils
pelutils/_c/__init__.py
.py
aee8a6b8e6bb3a15
7.45
7
from __future__ import annotations import _pelutils_c as _c import numpy as np import pelutils._c as c_utils from pelutils.types import BoolArray, IntArray class SparseGridBlobDetection: """Detect blobs (continuous regions) in a sparse grid, implemented in C for high performance. The grids can have an arbi...
peleiden/pelutils
pelutils/array/_blob.py
.py
d1f954c2896c0948
7.45
7
import ctypes import numpy as np import numpy.typing as npt from pelutils.misc._conditional_import import import_torch torch = import_torch() def array_ptr(arr: npt.ArrayLike) -> ctypes.c_void_p: """Return a pointer to a numpy array or torch tensor which can be used to interact with it in low-level languages l...
peleiden/pelutils
pelutils/array/_utils.py
.py
44d1b8e82f81702c
7.45
7
import re from abc import ABC from argparse import Namespace from collections.abc import Callable from pathlib import Path from pprint import pformat from typing import Any, TypeVar from typing_extensions import override _T = TypeVar("_T") _type = type # Save `type` under different name to prevent name collisions #...
peleiden/pelutils
pelutils/job_parser/_structs.py
.py
1c31652bac3b5aeb
7.45
7
from __future__ import annotations import os import pickle from pathlib import Path from typing import Self try: import rapidjson # pyright: ignore[reportMissingImports] except ModuleNotFoundError: import json as rapidjson class DataStorage: """The DataStorage class is an augmentation of the dataclass ...
peleiden/pelutils
pelutils/legacy/v3/_datastorage.py
.py
ea9a45de38c6ea35
7.45
7
import traceback as tb from collections.abc import Generator, Iterable from contextlib import contextmanager from datetime import datetime from enum import IntEnum from pathlib import Path from typing import Any from typing_extensions import override from pelutils.misc import OS, UnsupportedOS, git_repo_info from ._...
peleiden/pelutils
pelutils/logging/_logger.py
.py
0cea4edaf7422240
7.45
7
import re from rich.color import ANSI_COLOR_NAMES from rich.console import Console from typing_extensions import override _stdout_console = Console(highlight=False) _stderr_console = Console(highlight=False, stderr=True) class RichString: """Class used for combining normal strings and rich strings. This al...
peleiden/pelutils
pelutils/logging/_rich_string.py
.py
e3f9d0e691f5c0b6
7.45
7
"""Functions for attempting imports which may or may not be available at runtime.""" def import_torch(): """Attempt a import of torch. If found, torch is returned, otherwise None is returned.""" try: import torch # noqa: PLC0415 return torch except ModuleNotFoundError: return Non...
peleiden/pelutils
pelutils/misc/_conditional_import.py
.py
4954ffe163acd891
7.45
7
"""File and file system related functionality.""" import os from collections.abc import Generator from io import DEFAULT_BUFFER_SIZE from typing import TextIO from pelutils.misc._platform import OS, UnsupportedOS def _read_file_chunk(file: TextIO, chunksize: int) -> str: """Read a chunk starting from `chunksize...
peleiden/pelutils
pelutils/misc/_files.py
.py
937ece064052b7af
7.45
7
"""Code relating to the platform on which the code is running.""" import os import subprocess import sys from functools import cached_property import cpuinfo import psutil from typing_extensions import override from pelutils.misc._conditional_import import import_torch torch = import_torch() class UnsupportedOS(E...
peleiden/pelutils
pelutils/misc/_platform.py
.py
25313484a62003d3
7.45
7
import re from collections.abc import Sequence from typing import Any from typing_extensions import override class Table: """Build aligned, human-readable text tables that can also be exported to LaTeX. Add an optional header, then rows, and render with ``str(table)``; column widths are computed automat...
peleiden/pelutils
pelutils/misc/_table.py
.py
ada2b75662eea6be
7.45
7
from pathlib import Path from types import TracebackType from typing import Any import matplotlib.pyplot as plt class Figure: """Context manager that applies plotting defaults and saves the figure on exit. On entering the ``with`` block the given ``rcParams`` are applied within a scoped context; on exit...
peleiden/pelutils
pelutils/plots/_figure.py
.py
08a6f601bdfc1115
7.45
7
from __future__ import annotations from collections.abc import Callable import numpy as np import numpy.typing as npt from scipy import stats from pelutils.types import FloatArray, IntArray def linear_binning(x: npt.ArrayLike, bins: int) -> FloatArray: """Calculate linear binning for an array.""" x = np.as...
peleiden/pelutils
pelutils/plots/_histogram.py
.py
0e6e369db46202e2
7.45
7
"""Utility methods for the .jsonl file format. .jsonl are files in which each line is a valid json string.""" import json from collections.abc import Iterable, Iterator from typing import Any, TextIO def jsonl_load(f: TextIO) -> Iterator[Any]: # pyright: ignore[reportExplicitAny] """Return a generator of parsed...
peleiden/pelutils
pelutils/serialization/_jsonl.py
.py
c85746af238de90b
7.45
7
"""Compact-but-readable JSON formatter with pickle fallback for non-serialisable values.""" # A copious amount of Any is used in this file on purpose, so reportExplicitAny is ignored for the whole file # pyright: reportExplicitAny=false import base64 import json import pickle from typing import Any from pelutils.misc...
peleiden/pelutils
pelutils/serialization/_pretty_json.py
.py
5430733fb8d9f391
7.45
7
import json from pathlib import Path from typing import Any, Self from pydantic import BaseModel, ConfigDict from pelutils.serialization._pretty_json import ( from_safe_json, pickle_encode, universal_pretty_json, ) class UniversalJsonModel(BaseModel): """Pydantic BaseModel with JSON persistence for ...
peleiden/pelutils
pelutils/serialization/_universal_json_model.py
.py
2cfd929e076eb270
7.45
7
"""Functions returning scipy.stats distribution objects reparameterized to Jim Pitman's "Probability".""" import numpy as np from scipy import stats # Continuous distributions def norm(mu: float, sigma2: float): """Return a normal distribution from mean and variance.""" assert sigma2 > 0 return stats.nor...
peleiden/pelutils
pelutils/stats/_distributions.py
.py
1bf2649d03158d00
7.45
7
import os import sys import tempfile from collections.abc import Callable from functools import wraps from pathlib import Path from shutil import rmtree from typing import TypeVar from pelutils.misc import OS __all__ = ("UnitTestCollection", "restore_argv") _C = TypeVar("_C", bound=Callable) # pyright: ignore[repor...
peleiden/pelutils
pelutils/tests/_tests.py
.py
c3150dbf3486c465
7.95
7
import warnings from collections.abc import Hashable, Iterable, Iterator, Sequence from contextlib import contextmanager from copy import deepcopy from threading import current_thread from time import perf_counter from typing import TypeAlias, TypeVar, cast from typing_extensions import override from pelutils.misc im...
peleiden/pelutils
pelutils/ticktock/_ticktock.py
.py
6a8171c4f702323c
7.45
7