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
import re import typing as t import pandas as pd from sefa.utils import date_utils from sefa.utils import logger from sefa.utils.excel_utils import ( EMPTY_CELL_MARKER, cell_text, optional_cell_text, assert_sheet_names, to_float, ) from sefa.utils.rates import rbi_rates_utils from sefa.models.tran...
atulgpt/SeFA
src/sefa/parser/demat/indmoney/indmoney_us_stocks_parser.py
.py
4460ce337a156776
7.54
11
import typing as t from sefa.utils import date_utils from sefa.models.section_data import SectionDataMap class SaleOperationParser(t.Protocol): """ The surface a sale reporting parser module exposes to a run. Stated as a protocol so the modules keep a common contract, which the module type on its own doe...
atulgpt/SeFA
src/sefa/parser/demat/sale_operation_parser.py
.py
e4ba7e1920327f88
7.54
11
import csv import os import typing as t from itertools import groupby import operator from sefa.utils import date_utils, file_utils from sefa.utils.date_utils import CalendarMode from sefa.utils import share_data_utils from sefa.utils.ticker_mapping import ticker_org_info, ticker_currency_info from sefa.utils.rates im...
atulgpt/SeFA
src/sefa/parser/itr/faa3_parser.py
.py
dabae950225760ea
7.54
11
from dataclasses import dataclass import enum from itertools import groupby from operator import attrgetter import typing as t import pandas as pd # what a report prints in a cell that carries no value EMPTY_CELL_MARKER = "-" def assert_sheet_names(xl: pd.ExcelFile) -> t.List[str]: """ Name of every sheet o...
atulgpt/SeFA
src/sefa/utils/excel_utils.py
.py
9ef86c81e4811ef7
7.54
11
import os import json import csv import typing as t from collections.abc import Iterable import pandas as pd if t.TYPE_CHECKING: # `csv` re-exports this from `_csv` without naming it, so it is only reachable # from the private module, and only ever exists in the stubs from _csv import _QuotingType # A ra...
atulgpt/SeFA
src/sefa/utils/file_utils.py
.py
78fe013d7c1f0f8c
7.54
11
import typing as t import pandas as pd import pytest from sefa.aggregator import asset_aggregator from sefa.models.asset_sale import NOT_APPLICABLE, AssetSale from sefa.models.section_data import SectionDataMap, SectionDataRow from sefa.models.section_type import SectionType from sefa.models.transaction import Price,...
atulgpt/SeFA
tests/unit/aggregator/test_asset_aggregator.py
.py
141b7bb17db6f469
8.04
11
import pandas as pd from sefa.parser.demat.etrade import etrade_benefit_history_parser def test_espp_parsing_with_no_purchase( benefit_history_excel_file_with_no_purchase_espp: pd.ExcelFile, ): espp_purchase = etrade_benefit_history_parser.parse_espp( benefit_history_excel_file_with_no_purchase_espp,...
atulgpt/SeFA
tests/unit/parser/demat/etrade/test_etrade_espp_benifit_history_parser.py
.py
b79254fe4e98ab92
7.04
11
from unittest.mock import patch import pytest from sefa.parser.demat.etrade import etrade_benefit_history_parser from sefa.utils import date_utils @patch("pandas.read_excel") @pytest.mark.skip(reason="need to abstract out the ExcelFile creation for \ testing o/w it gives File not found error") def test_retur...
atulgpt/SeFA
tests/unit/parser/demat/etrade/test_etrade_history_parser.py
.py
e1ba7e1ec5b153da
7.04
11
import pathlib import shutil import subprocess import sysconfig import typing as t import pytest from openpyxl import Workbook from sefa import cli # `pythonpath` lets a test import `sefa` straight out of `src`, so the console # script only exists once the project itself has been installed. It is looked up # in the ...
atulgpt/SeFA
tests/unit/test_cli.py
.py
64c2ab2d8b7d5473
8.04
11
# Copyright (c) 2025 TheHamkerAlone # Licensed under the MIT License. # This file is part of AloneXMusic # ALONE-CODER # @ForRealAlone # @XoDrk import json from functools import wraps from pathlib import Path from pyrogram import errors from AloneX import db, logger lang_codes = { "ar": "Arabic", "de": "Ger...
TeamAloneOp/AloneX
AloneX/core/lang.py
.py
9376f08b31625a88
7.52
10
# Copyright (c) 2025 TheHamkerAlone # Licensed under the MIT License. # This file is part of AloneXMusic #ALONE-CODER from random import randint from time import time from pymongo import AsyncMongoClient from AloneX import config, logger, userbot class MongoDB: def __init__(self): """ Initializ...
TeamAloneOp/AloneX
AloneX/core/mongo.py
.py
a39f2c9fe05b45e3
7.52
10
# Copyright (c) 2025 TheHamkerAlone # Licensed under the MIT License. # This file is part of AloneXMusic from pyrogram import Client from AloneX import config, logger class Userbot(Client): def __init__(self): """ Initializes the userbot with multiple clients. This method sets up clien...
TeamAloneOp/AloneX
AloneX/core/userbot.py
.py
3b7633285352b40a
7.52
10
# Copyright (c) 2025 TheHamkerAlone # Licensed under the MIT License. # This file is part of AloneXMusic import os import ast import traceback from typing import Optional async def meval(code: str, globs: dict, **kwargs): """ Asynchronously evaluate a code string in a controlled environment. """ # C...
TeamAloneOp/AloneX
AloneX/helpers/_exec.py
.py
fd8b53a8c33e144f
7.52
10
# Copyright (c) 2025 TheHamkerAlone # Licensed under the MIT License. # This file is part of AloneXMusic from collections import defaultdict, deque from typing import Union from ._dataclass import Media, Track MediaItem = Union[Media, Track] class Queue: def __init__(self): self.queues: dict[int, dequ...
TeamAloneOp/AloneX
AloneX/helpers/_queue.py
.py
39cb52d8b92074c7
7.52
10
# Sphinx plugin that stages every notebook under examples/ into the docs tree, extracts a thumbnail # from its last image output, and emits the grid-card gallery page. Categories come from the # subdirectory a notebook sits in; see docs/source/dev/docs.rst. # Adapted from gEconpy, which adapted it from PyMC / seaborn /...
pymc-devs/pytensor-ml
docs/sphinxext/generate_gallery.py
.py
c2406da6a56ad0b2
7.48
8
from abc import ABC, abstractmethod from typing import Protocol, runtime_checkable import pytensor.tensor as pt from pytensor.compile.builders import SymbolicOp from pytensor.tensor.variable import TensorVariable def _check_input_rank(X: TensorVariable, name: str, n_spatial: int) -> None: """Reject an input who...
pymc-devs/pytensor-ml
pytensor_ml/base.py
.py
ce55147054574ec2
7.48
8
from collections.abc import Mapping, Sequence from os import fspath from pathlib import Path from typing import Any import numpy as np from pytensor.compile.sharedvalue import SharedVariable from safetensors.numpy import load_file, save_file def _index_by_name(shared_variables: Sequence[SharedVariable]) -> dict[str...
pymc-devs/pytensor-ml
pytensor_ml/checkpoint.py
.py
6be8f43e64111a2d
7.48
8
import importlib import importlib.abc import importlib.util import sys # Pytensor imports its own backend dispatches from the linker at compile time and offers no plugin hook, so # watch for a backend's dispatch package loading and register ours right after. This keeps jax/mlx off the # main import path -- they load o...
pymc-devs/pytensor-ml
pytensor_ml/dispatch/__init__.py
.py
e8424f33c1c0f3ff
7.48
8
import jax import jax.numpy as jnp from pytensor.link.jax.dispatch import jax_funcify from pytensor_ml.layers.attention import AttentionLayer @jax_funcify.register(AttentionLayer) def jax_funcify_AttentionLayer(op, node=None, **kwargs): """Dispatch the attention marker to ``jax.nn.dot_product_attention`` (XLA/c...
pymc-devs/pytensor-ml
pytensor_ml/dispatch/jax/attention.py
.py
db2b8313d9131edf
7.48
8
import jax from pytensor.link.jax.dispatch import jax_funcify from pytensor_ml.layers.conv import ConvLayer, ConvLayerGrad def _spatial_letters(n_spatial: int) -> str: """Name each spatial axis with a distinct letter, which is how jax takes a convolution's layout.""" letters = "XYZUVW" if n_spatial > le...
pymc-devs/pytensor-ml
pytensor_ml/dispatch/jax/conv.py
.py
d2e4c5fa20088dfe
7.48
8
import math from functools import partial import jax import jax.numpy as jnp from pytensor.link.jax.dispatch import jax_funcify from pytensor_ml.layers.conv import PoolLayer, PoolLayerGrad def _pooling(op): """The pooling both dispatches here run, so the gradient differentiates what the forward does.""" #...
pymc-devs/pytensor-ml
pytensor_ml/dispatch/jax/pooling.py
.py
d2a3ea26adbd8291
7.48
8
import math import mlx.core as mx from pytensor.link.mlx.dispatch import mlx_funcify from pytensor_ml.layers.attention import AttentionLayer @mlx_funcify.register(AttentionLayer) def mlx_funcify_AttentionLayer(op, node=None, **kwargs): """Dispatch the attention marker to ``mx.fast.scaled_dot_product_attention`...
pymc-devs/pytensor-ml
pytensor_ml/dispatch/mlx/attention.py
.py
b760fc1234ba1ff6
7.48
8
import mlx.core as mx from pytensor.link.mlx.dispatch import mlx_funcify from pytensor_ml.layers.conv import ConvLayer, ConvLayerGrad def _convolution(op): """The convolution both dispatches here run, so the gradient differentiates what the forward does.""" no_padding = (0,) * len(op.kernel_size) def c...
pymc-devs/pytensor-ml
pytensor_ml/dispatch/mlx/conv.py
.py
ae4ff81d9575a564
7.48
8
import mlx.core as mx import mlx.nn as mnn from pytensor.link.mlx.dispatch import mlx_funcify from pytensor_ml.layers.conv import PoolLayer, PoolLayerGrad _POOLS = { ("max", 1): mnn.MaxPool1d, ("max", 2): mnn.MaxPool2d, ("max", 3): mnn.MaxPool3d, ("mean", 1): mnn.AvgPool1d, ("mean", 2): mnn.AvgPo...
pymc-devs/pytensor-ml
pytensor_ml/dispatch/mlx/pooling.py
.py
c24c39b760e38b71
7.48
8
import torch.nn.functional as F import torch.nn.grad as G from pytensor.link.pytorch.dispatch import pytorch_funcify from pytensor_ml.layers.conv import ConvLayer, ConvLayerGrad _CONVOLUTIONS = {1: F.conv1d, 2: F.conv2d, 3: F.conv3d} _INPUT_GRADIENTS = {1: G.conv1d_input, 2: G.conv2d_input, 3: G.conv3d_input} _KERNE...
pymc-devs/pytensor-ml
pytensor_ml/dispatch/pytorch/conv.py
.py
cf1568bf01b32556
7.48
8
import torch import torch.nn.functional as F from pytensor.link.pytorch.dispatch import pytorch_funcify from pytensor_ml.layers.conv import PoolLayer, PoolLayerGrad _MAX_POOLS = {1: F.max_pool1d, 2: F.max_pool2d, 3: F.max_pool3d} _AVERAGE_POOLS = {1: F.avg_pool1d, 2: F.avg_pool2d, 3: F.avg_pool3d} def _pooling(op)...
pymc-devs/pytensor-ml
pytensor_ml/dispatch/pytorch/pooling.py
.py
ba49f977c5f59278
7.48
8
from collections.abc import Sequence from pytensor.graph.basic import Variable # Importing the package registers every op-family handler into the codec's dispatch tables. Those # handlers depend on serialize.base, never on this module, so the import runs one way. import pytensor_ml.serialize # noqa: F401 from pyten...
pymc-devs/pytensor-ml
pytensor_ml/json_serialize.py
.py
8fe19e95147daef5
7.48
8
from collections.abc import Mapping, Sequence import numpy as np from pytensor.compile import Function from pytensor.compile.sharedvalue import SharedVariable from pytensor.graph.basic import Variable from pytensor.printing import debugprint from pytensor.tensor.variable import TensorVariable from pytensor_ml import...
pymc-devs/pytensor-ml
pytensor_ml/model.py
.py
246fcef25973a33f
7.48
8
from collections.abc import Callable, Sequence from dataclasses import dataclass import pytensor.tensor as pt from pytensor.raise_op import CheckAndRaise from pytensor.tensor import TensorVariable from pytensor_ml.optim.base import ( LossGradientsOrUpdates, Parameter, Transform, Updates, reuses_s...
pymc-devs/pytensor-ml
pytensor_ml/optim/guards.py
.py
3b4c8edaa394aff9
7.48
8
from collections.abc import Sequence from pytensor.compile import Function from pytensor.compile.sharedvalue import SharedVariable from pytensor.graph.basic import Variable, equal_computations from pytensor.tensor import TensorVariable from pytensor_ml.optim.base import ( Gradients, Parameter, Steps, ...
pymc-devs/pytensor-ml
pytensor_ml/optim/train.py
.py
88ec80582784516e
7.48
8
import json from collections.abc import Sequence from enum import StrEnum from pathlib import Path from typing import Any, Literal import numpy as np import pytensor from pytensor.compile.sharedvalue import SharedVariable from pytensor.graph.basic import Variable from pytensor.tensor.random.type import RandomGenerat...
pymc-devs/pytensor-ml
pytensor_ml/pretrained.py
.py
7cfc5986b3fb917f
7.48
8
import warnings from collections.abc import Sequence import pytensor from pytensor import Mode from pytensor.compile import Function, get_mode from pytensor.tensor.variable import Variable from pytensor_ml.pytensorf.collect import ( collect_clock_updates, collect_graph_inputs, collect_non_trainable_upda...
pymc-devs/pytensor-ml
pytensor_ml/pytensorf/compile.py
.py
67bb3f600b54e5c4
7.48
8
from pytensor.graph import FunctionGraph, RewriteDatabaseQuery, rewrite_graph from pytensor.tensor.variable import Variable from pytensor_ml.rewriting.scan import optimize_db def hoist_scan_draws(outputs): """ Lift any draw written inside a scan out of the loop, across a whole set of graphs at once. Rew...
pymc-devs/pytensor-ml
pytensor_ml/pytensorf/rewrite.py
.py
a6460a072b8ce75b
7.48
8
from dataclasses import dataclass from typing import Optional from alibabacloud_credentials.client import Client from alibabacloud_credentials.models import Config from dbt.adapters.contracts.connection import Credentials from odps import ODPS from odps import options from odps.accounts import CredentialProviderAccoun...
aliyun/dbt-maxcompute
dbt/adapters/maxcompute/credentials.py
.py
e80c01457d26e30f
7.65
19
import time import functools from typing import Callable, TypeVar from dbt.adapters.events.logging import AdapterLogger from odps.errors import ODPSError, NoSuchObject from pathlib import Path # used for this adapter's version and in determining the compatible dbt-core version VERSION = Path(__file__).parent / "__ve...
aliyun/dbt-maxcompute
dbt/adapters/maxcompute/utils.py
.py
09a01645a0d1f95d
7.65
19
import pytest from dbt.artifacts.schemas.results import RunStatus from dbt.tests.adapter.incremental.test_incremental_unique_id import BaseIncrementalUniqueKey from dbt.tests.adapter.incremental.test_incremental_merge_exclude_columns import ( BaseMergeExcludeColumns, ) from dbt.tests.adapter.incremental.test_increm...
aliyun/dbt-maxcompute
tests/functional/adapter/incremental/test_incremental.py
.py
6ed7bbb2b30cdccf
7.15
19
import pytest from dbt.tests.adapter.basic.test_base import BaseSimpleMaterializations from dbt.tests.adapter.basic.test_singular_tests import BaseSingularTests from dbt.tests.adapter.basic.test_singular_tests_ephemeral import ( BaseSingularTestsEphemeral, ) from dbt.tests.adapter.basic.test_empty import BaseEmpty...
aliyun/dbt-maxcompute
tests/functional/adapter/test_basic.py
.py
a9c098346d8eae3d
7.15
19
from typing import Tuple, Optional from dbt.adapters.base import BaseRelation from dbt.tests.adapter.materialized_view.basic import MaterializedViewBasic from dbt.tests.util import ( assert_message_in_logs, run_dbt, run_dbt_and_capture, ) class TestMaterializedViewMaxCompute(MaterializedViewBasic): d...
aliyun/dbt-maxcompute
tests/functional/adapter/test_materialized_view.py
.py
db9fdc823331b63d
8.15
19
import pytest from dbt.tests.adapter.python_model.test_python_model import ( BasePythonIncrementalTests, BasePythonModelTests, basic_python, basic_sql, incremental_python, m_1, schema_yml, second_sql, ) from dbt.tests.util import run_dbt pytest.importorskip("maxframe", reason="requires ...
aliyun/dbt-maxcompute
tests/functional/adapter/test_python_model.py
.py
b11850b488b117a0
7.15
19
import matplotlib.pyplot as plt import PIL.Image # SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__)) # sys.path.append(os.path.dirname(SCRIPT_DIR)) from .Points import PointsSource from Util.Backend import backend as bd from Util.Globals import ZERO, ONE, TWO, INIT_ELLIPSE_TILT, INFINITY, FAR_DISTANCE, PRECI...
Amarthgul/ISS
src/ObjectSpace/Images.py
.py
fa8a30668e9c43c4
7.56
12
import PIL.Image import copy from Util.Backend import backend as bd """ Old version of the object space implementation. Should not be used, left here for reference purpose only and will probably be removed at some point. """ class _Image2D: def __init__(self, path = None): self.imgpath = path ...
Amarthgul/ISS
src/ObjectSpace/ObjectSpace.py
.py
d990a05f7ee47ed6
7.56
12
import PIL.Image import matplotlib.pyplot as plt import OpenEXR, Imath import numpy as np import sys import os # SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__)) # sys.path.append(os.path.dirname(SCRIPT_DIR)) from .Points import PointsSource from .Images import Image2D from Util.Backend import backend as ...
Amarthgul/ISS
src/ObjectSpace/VerifyEXR.py
.py
b5e1786b15ad3095
7.56
12
from Util.Backend import backend as bd from Util.Globals import ONE, NEAR_ZERO from Util.Misc import ArrayNormalized, Magnitude, ArrayMagnitude from Raytracing.RayBatch import RayBatch def ModifyEllipse(A, v, add=False): """ Modify an ellipse to expand or contract in the direction of vector `v`. ...
Amarthgul/ISS
src/Raytracing/Polarization.py
.py
fd5f5ff39358760c
7.56
12
from Util.Backend import backend as bd from Util.Misc import ArrayNormalized from Util.PltPlot import DrawDirection def Reflect(incident, normal): """ Calculates the reflected vectors given incident vectors and normal vectors. Note that this method is for mirror reflection. :param incident: Array of ...
Amarthgul/ISS
src/Raytracing/Reflection.py
.py
1d9e29b8140c239d
7.56
12
""" A surface that does not bend the rays, only cull them. """ from .Surface import Surface from Util.Backend import backend as bd from Util.Backend import constant, backend_name from Util.PltPlot import DrawAspherical, DrawAsphericalProfile, DrawSphericalProfile, DrawPlane from Util.Globals import ORIGIN, OBJ_FACING, ...
Amarthgul/ISS
src/Surfaces/ManualAperture.py
.py
08918896aad4b8ef
7.56
12
from .Surface import * class Mirror(Surface): """ Mirror surface. Reflects rays instead of refracting them. """ def __init__(self, r, t, sd, m, K, A): super().__init__(r, t, sd, m) # if this value is set to None Zero self.nullRadius = None # When flagged, thickn...
Amarthgul/ISS
src/Surfaces/Mirror.py
.py
820ffe818d36411c
7.06
12
from Util.Backend import backend as bd from Util.Globals import ORIGIN, OBJ_FACING, ZERO, ONE, TWO, INFINITY, Axis, SURFACE_COLOR, BOUNDARY_COLOR, DEFAULT_MAT_NAME, MIRROR from Util.PltPlot import DrawSpherical, DrawPoints, DrawDirection, DrawNormal, DrawRaybatch, DrawEllipse, DrawClearBoundary, DrawSphericalInner ...
Amarthgul/ISS
src/Surfaces/Stop.py
.py
51be2b4a2e657644
7.56
12
import pytest from selenium import webdriver as selenium_webdriver from selenium.webdriver.remote.webdriver import WebDriver from demo.pages import HelpPage, IndexPage, SearchPage # You can implement your own logic to initialize a webdriver. # An example of Chrome initialization is described below. @pytest.fixture(s...
saritasa-nest/pomcorn
demo/conftest.py
.py
7070a9c3052bc3e4
8.13
17
from __future__ import annotations from time import sleep from typing import TYPE_CHECKING from selenium.webdriver.remote.webdriver import WebDriver from pomcorn import Page, locators if TYPE_CHECKING: from demo.pages import IndexPage from demo.pages.common import Navbar class PyPIPage(Page): """Base ...
saritasa-nest/pomcorn
demo/pages/base/base_page.py
.py
3102c245279fc022
7.63
17
from __future__ import annotations from typing import TYPE_CHECKING from demo.pages import PyPIComponent from pomcorn import Element, locators if TYPE_CHECKING: from demo.pages.help_page import HelpPage # `Component` implements methods of waiting until the component becomes # visible / invisible, including in ...
saritasa-nest/pomcorn
demo/pages/common/navigation_bar.py
.py
07f7da8849f31115
7.63
17
from __future__ import annotations from typing import TYPE_CHECKING from selenium.webdriver.common.keys import Keys from demo.pages import PyPIComponent from pomcorn import locators if TYPE_CHECKING: from demo.pages.search_page import SearchPage class Search(PyPIComponent): """Component representing the s...
saritasa-nest/pomcorn
demo/pages/common/search.py
.py
15cb27f56e4d09d8
7.63
17
from __future__ import annotations from selenium.webdriver.remote.webdriver import WebDriver from demo.pages.base import PyPIPage from pomcorn import Element, locators class HelpPage(PyPIPage): """Represent the help page.""" # Define element for title title_element = Element(locators.ClassLocator("page...
saritasa-nest/pomcorn
demo/pages/help_page.py
.py
4170611167f1f655
7.63
17
from selenium.webdriver.remote.webdriver import WebDriver from demo.pages.base import PyPIPage from demo.pages.common import Search class IndexPage(PyPIPage): """Represent the index page.""" def __init__( self, webdriver: WebDriver, *, app_root: str | None = None, wai...
saritasa-nest/pomcorn
demo/pages/index_page.py
.py
46ac3e172a5de76d
7.63
17
from __future__ import annotations from selenium.webdriver.remote.webdriver import WebDriver from demo.pages.base import PyPIPage from pomcorn import locators class PackageDetailsPage(PyPIPage): """Represent the package details page.""" @property def header(self) -> str: """Get the header text....
saritasa-nest/pomcorn
demo/pages/package_details_page.py
.py
929dc775e3caa25f
7.63
17
from __future__ import annotations from typing import TYPE_CHECKING from demo.pages import PyPIComponent from pomcorn import locators if TYPE_CHECKING: from demo.pages import PackageDetailsPage class Package(PyPIComponent): """Represent the single search result (package) on `SearchPage`.""" @property ...
saritasa-nest/pomcorn
demo/pages/search_page/components/package.py
.py
3bd998d37cad4ba3
7.63
17
from __future__ import annotations from selenium.webdriver.remote.webdriver import WebDriver from demo.pages import IndexPage, PyPIPage from .components import PackageList class SearchPage(PyPIPage): """Representation of the page with search results.""" @classmethod def open( cls, webd...
saritasa-nest/pomcorn
demo/pages/search_page/search_page.py
.py
9865969677dfaa93
7.63
17
import invoke import saritasa_invocations @invoke.task def prepare(context: invoke.Context) -> None: """Prepare ci environment for check.""" saritasa_invocations.print_success("Preparing CI") @invoke.task def run_pre_commit(context: invoke.Context) -> None: """Run pre-commit hooks.""" saritasa_invoc...
saritasa-nest/pomcorn
invocations/ci.py
.py
5d25e9c2e9f3f3ad
7.13
17
import invoke import saritasa_invocations @invoke.task def build(context: invoke.Context) -> None: """Build documentation.""" saritasa_invocations.print_success("Start building of local documentation") context.run("mkdocs build") saritasa_invocations.print_success("Building completed") @invoke.task ...
saritasa-nest/pomcorn
invocations/docs.py
.py
ba8cf1f653e99183
7.63
17
import typing from inspect import isclass from typing import ( Any, Generic, Literal, TypeVar, get_args, get_origin, overload, ) from . import locators from .element import XPathElement from .page import Page from .web_view import WebView TPage = TypeVar("TPage", bound=Page) class _Empty...
saritasa-nest/pomcorn
pomcorn/component.py
.py
098cdc21dd0c5816
7.63
17
from __future__ import annotations from typing import TYPE_CHECKING, NoReturn, overload from pomcorn import locators if TYPE_CHECKING: from pomcorn import WebView, XPathElement class Element: """Descriptor for init `PomcornElement` as attribute by locator. .. code-block:: python # Example ...
saritasa-nest/pomcorn
pomcorn/descriptors/element.py
.py
8d2631114a8a7402
7.63
17
"""Module with `XPathLocator`. Provide only `XPathLocator` because a locator of this type is sufficient for all operations and it also allows to combine locators with `/` operator. It's better to use one type of locators for consistency. Example: # Search button inside base element button_element_locator = base_l...
saritasa-nest/pomcorn
pomcorn/locators/base_locators.py
.py
f3a17a64b3e725d5
7.63
17
from typing import Self from selenium.webdriver.remote.webdriver import WebDriver from .web_view import WebView class Page(WebView): """The class for representing a web page. It contains the element and components of the page and utils methods for page manipulation. """ APP_ROOT: str def...
saritasa-nest/pomcorn
pomcorn/page.py
.py
ac24bec33aaa3282
7.63
17
# Custom waits conditions import re from collections.abc import Callable from selenium.common.exceptions import ( NoSuchElementException, StaleElementReferenceException, ) from selenium.webdriver.remote.webdriver import WebDriver from selenium.webdriver.support.expected_conditions import ( WebDriverOrWebEl...
saritasa-nest/pomcorn
pomcorn/waits_conditions.py
.py
a0ea2e6ab0c03b6c
7.63
17
from typing import Generic, TypeAlias, TypeVar import pytest from pomcorn import Component, ListComponent, Page, locators TItem = TypeVar("TItem", bound=Component[Page]) TPage = TypeVar("TPage", bound=Page) class ItemClass(Component[Page]): """Common test component for represent item class.""" def test_set_i...
saritasa-nest/pomcorn
tests/list_component/test_item_class.py
.py
a76a07628dd2d97b
7.13
17
from pomcorn.locators.base_locators import XPathLocator def test_empty_string(): """Test that an empty string returned as wrapped empty string.""" assert XPathLocator._escape_quotes("") == '""' def test_no_quotes(): """Test that a string without quotes returned as wrapped passed text.""" assert XPat...
saritasa-nest/pomcorn
tests/locators/test_quote_escaper.py
.py
d342bc91063b3935
8.13
17
import pytest from pomcorn.locators.base_locators import XPathLocator TEST_QUERY = "//span[text()='Users']" @pytest.mark.parametrize( argnames=["value", "expected_query"], argvalues=[ # Getting by index [-2, f"({TEST_QUERY})[last() - 1]"], [-1, f"({TEST_QUERY})[last()]"], [0,...
saritasa-nest/pomcorn
tests/locators/test_xpath_square_brackets.py
.py
63b8c92570871c22
7.13
17
#!/usr/bin/env python3 """ Bitbucket Repository Access Checker This script reads a file containing Bitbucket clone URLs and checks if you have access to each repository using your Bitbucket API token. Supports both Bitbucket Cloud (bitbucket.org) and private/self-hosted Bitbucket instances. Usage: python bitbucke...
kospex/kospex
ideas/bitbucket_checker.py
.py
a626fd9cbf7504d5
7.5
9
#!/usr/bin/env python3 """ Repository Access Checker This script checks if you have access to a single Bitbucket repository using your Bitbucket API token from the environment. Supports both Bitbucket Cloud (bitbucket.org) and private/self-hosted Bitbucket instances. Usage: python repo_access_check.py <git_clone_...
kospex/kospex
ideas/repo_access_check.py
.py
4cefc309edc9937b
7.5
9
"""Assessment type definitions and filename generation for kospex. This module defines standardized assessment type keys and provides utilities for generating filenames and paths for assessment outputs. Assessment files follow the naming convention: {KEY}-{scope}.csv where KEY is the assessment type (e.g., OSI) and s...
kospex/kospex
src/kospex/assessment_types.py
.py
ba15fa0dfd678df0
7.5
9
"""Runtime introspection helpers for the kospex database. Replaces the hand-maintained KOSPEX_TABLES / REPO_TABLES list constants that used to live in kospex_schema.py. Reads sqlite_master and PRAGMA table_info directly, so migrations that add new tables are picked up automatically. """ _TABLE_CACHE: dict[str, set[st...
kospex/kospex
src/kospex/db/introspect.py
.py
657ddcdee435712f
8
9
"""Script-driven SQLite migration runner for kospex. Replaces the old auto-ALTER `kospex upgrade-db` flow. See changes/202605-db-migration-system.md for the design. """ from __future__ import annotations import hashlib import re import sqlite3 import sys import time from dataclasses import dataclass from datetime imp...
kospex/kospex
src/kospex/db/migrator.py
.py
36f06ab20d5b6268
7.5
9
"""Extractor for pnpm-lock.yaml lockfiles. Returns one record per resolved package (the full dependency closure), shaped to KospexDependencies.get_package_template() so ``krunner osi`` consumes the records unchanged. pnpm publishes a per-lockfileVersion spec at github.com/pnpm/spec (lockfile/{5,5.2,6.0,9.0}.md). Thre...
kospex/kospex
src/kospex/extractors/pnpm.py
.py
f1ed71523573f9f3
7.5
9
"""Registry of the dependency-bearing file types kospex recognises. Single source of truth for *which* manifest / lock / config files kospex can classify, what *kind* of dependency each declares, and whether a scanner can parse it today. Pure: no DB, no CLI, no I/O — it classifies filenames (strings), it never opens a...
kospex/kospex
src/kospex/extractors/registry.py
.py
27a315c43c093de1
7.5
9
"""Extractor for GitHub Actions workflow YAML files. Pulls every ``uses:`` reference (step actions and job-level reusable workflows) out of a workflow file and returns them as records, each enriched with a classification of the ``uses:`` string — owner, name, pin type, pinned ref value, and whether the owner is a stri...
kospex/kospex
src/kospex/extractors/workflows.py
.py
bcb35c568e3361d8
7.5
9
#!/usr/bin/env python3 """Kospex Agent - Continuous repository monitoring and synchronization tool.""" import os import time import signal import sys import logging import select import threading from datetime import datetime, timezone, timedelta import click from kospex_core import Kospex import kospex_utils as Kospex...
kospex/kospex
src/kospex_agent.py
.py
41830ec5f02071d3
7.5
9
""" High level functions for common queries on Bitbucket orgs, workspaces and users. """ import os import requests # Credential modes returned by get_env_credentials MODE_TOKEN = "token" MODE_LEGACY = "legacy" MODE_NONE = "none" MODE_CONFIG_ERROR = "config_error" # Static basic-auth username Atlassian accepts when a...
kospex/kospex
src/kospex_bitbucket.py
.py
71b3d14cb22cec28
7.5
9
#!/usr/bin/env python3 """ Email analysis module for Kospex. This module provides comprehensive email address analysis including: - Bot detection for various automation tools - Domain classification (personal, corporate, academic, etc.) - GitHub handle extraction from GitHub emails - Noreply email detection """ from ...
kospex/kospex
src/kospex_email.py
.py
7e535500e02148de
7.5
9
"""High level functions for common queries on Github orgs and users. """ import json import os from typing import Optional, List, Dict, Any import requests from kospex_utils import timer class KospexGithub: """ GitHub functions for common kospex queries. """ # This the original token name used by Kosp...
kospex/kospex
src/kospex_github.py
.py
3e541571114e566c
7.5
9
""" Centralized logging system for Kospex CLI tools. This module provides: - Per-module loggers with daily rotation - Configurable log levels and retention - Graceful fallbacks if logging setup fails - Directory validation and creation """ import os import sys import json import logging import logging.handlers from p...
kospex/kospex
src/kospex_logging.py
.py
f1f0a58c43c1692d
7.5
9
"""Core mergestat functions and queries for running the kospex CLI""" import sqlite3 import os import os.path import datetime from kospex_git import KospexGit, MissingGitDirectory import kospex_utils as KospexUtils import kospex_schema as KospexSchema # # WARNING note: This code works, but is no longer used in kospex ...
kospex/kospex
src/kospex_mergestat.py
.py
75c4d56fab3d5214
7.5
9
""" Observation dataclass for kospex A database for the observations table structure defined in kospex_schema.py """ import json from dataclasses import dataclass, asdict, field from typing import Optional from datetime import datetime, timezone import uuid @dataclass class Observation: """ Dataclass represen...
kospex/kospex
src/kospex_observation.py
.py
83273cc3eb334775
7.5
9
""" Lightweight in memory cache for DB queries and calculations For use in kweb2.py for large or long execution queries Returns the value from the cache if it exists, otherwise None if a last_updated timestamp is provided, it will be compared to the cache_time if the cache_time is older than the last_updated timestamp,...
kospex/kospex
src/kospex_request_cache.py
.py
ec725448d8a57354
7.5
9
""" Helper functions for kospex web UI """ import os import kospex_utils as KospexUtils from kospex.extractors.registry import classify # Friendly labels for the classify() kinds shown in the /osi/ commentary. _KIND_LABELS = { "package": "Package manifests", "runtime": "Runtime versions", "container": "Con...
kospex/kospex
src/kospex_web.py
.py
cd557109a5890a98
7.5
9
#!/usr/bin/env python3 """This is the kospex reaper command line tool.""" import os import os.path import click from kospex_core import Kospex import kospex_utils as KospexUtils import kospex_schema as KospexSchema from kospex.db.introspect import get_kospex_tables, get_repo_tables from kospex.db.migrator import warn_i...
kospex/kospex
src/kreaper.py
.py
d7e57c0db102fe9b
7.5
9
"""Helper functions for krunner""" import csv import json import os import re import yaml from prettytable import PrettyTable from rich.table import Table # Error types recorded by RunErrors. Stable, kospex-level names - they appear in # the end-of-scan summary and in the krunner log, so keep them meaningful. MISSIN...
kospex/kospex
src/krunner_utils.py
.py
f41ead523829fe23
7.5
9
#!/usr/bin/env python3 """Graph data service for Kospex web interface.""" from os.path import basename from kospex_query import KospexQuery import kospex_utils as KospexUtils import kospex_web as KospexWeb import kospex_email as KospexEmail class GraphService: """Service class for generating graph data for visua...
kospex/kospex
src/kweb_graph_service.py
.py
edd92f11783b532e
7.5
9
"""Shared test fixtures. Kospex resolves paths through the HabitatConfig singleton and, during construction, writes several KOSPEX_* vars straight to os.environ (not via monkeypatch). Both leak across tests: a test that constructs Kospex with a throwaway KOSPEX_HOME can leave the singleton and env pointing at a now-de...
kospex/kospex
tests/conftest.py
.py
9ee18337e0c91161
8
9
# iam_data_lib/__init__.py from .utils import load_json from .services import Services from .actions import Actions from .resources import Resources from .conditions import Conditions from datetime import datetime class IAMData: def __init__(self): self.services = Services() self.actions = Actions...
cloud-copilot/iam-data-python
iamdata/__init__.py
.py
acd7625ff4039b9e
7.5
9
from .utils import load_json class Actions: def _get_actions(self, service_key): """Load actions from a JSON file.""" return load_json("actions",f"{service_key.lower()}.json") def get_actions_for_service(self, service_key): """Returns a list of all actions for a given service key.""" ...
cloud-copilot/iam-data-python
iamdata/actions.py
.py
f7cc78d9287c495a
7.5
9
from .utils import load_json class Conditions: def _get_conditions(self, service_key): """Load conditions from a JSON file.""" return load_json("conditionKeys",f"{service_key.lower()}.json") def get_condition_keys_for_service(self, service_key): """Returns a list of all condition keys ...
cloud-copilot/iam-data-python
iamdata/conditions.py
.py
266372c36eaec744
7.5
9
# iam_data_lib/resources.py from .utils import load_json class Resources: def _get_resources(self, service_key): """Load resources from a JSON file.""" return load_json("resourceTypes",f"{service_key.lower()}.json") def get_resource_types_for_service(self, service_key): """Returns a l...
cloud-copilot/iam-data-python
iamdata/resources.py
.py
ab9e54f25ef81e78
7.5
9
from .utils import load_json class Services: def get_service_keys(self): """Returns a list of all service keys.""" return load_json('services.json') def get_service_name(self, service_key): """Get the name of a service by its key.""" data = load_json('serviceNames.json') ...
cloud-copilot/iam-data-python
iamdata/services.py
.py
b6b1186509d46ffb
7.5
9
#!/usr/bin/env python3 """ مثال عملی برای دریافت داده از بلاکچین استلار """ import os import sys import asyncio from datetime import datetime # اضافه کردن مسیر parent به sys.path current_dir = os.path.dirname(os.path.abspath(__file__)) parent_dir = os.path.dirname(current_dir) sys.path.insert(0, parent_dir) # اکنون ...
JavadTorabiKh/StellarChainAnalysis
examples/fetch_data.py
.py
06d7c7c0223da5d2
7.6
15
import json import logging from typing import Dict, List, Optional, Callable from datetime import datetime import redis.asyncio as redis from collections import defaultdict from src.core.stellar_client import StellarTransaction from src.streaming.horizon_listener import HorizonWebSocketListener logger = logging.getLo...
JavadTorabiKh/StellarChainAnalysis
src/core/stream_processor.py
.py
dace6a4547809e07
7.6
15
""" Markdown Documentation Merger Combines German markdown files (index.de.md) from a directory structure into a single document with proper heading hierarchy, then converts to DOCX. The script processes directories in sorted order (by folder numbering) and always places the index.de.md of the current directory first,...
bbvch-ai/aihub-core
docs/combine_docs.py
.py
69c0265976b4ae02
7.54
11
""" Shared LLM utilities for whitepaper generation scripts. Provides: - CLI colors for terminal output - LLM invocation via the `llm` CLI tool - Cost tracking based on Gemini API pricing """ import json import subprocess import tempfile from dataclasses import dataclass from pathlib import Path class Colors: ""...
bbvch-ai/aihub-core
docs/whitepaper/scripts/llm_utils.py
.py
592ae46879ff1e91
7.54
11
import { test as setup, expect, request } from '@playwright/test' /** * Authentication setup that logs in via Keycloak and saves the browser state. * * This runs once before all tests. It ensures a dedicated `e2e-test@swiss-ai-hub.ch` * user exists in Keycloak via the Admin REST API, then logs in and persists the ...
bbvch-ai/aihub-core
e2e/tests/auth.setup.ts
.ts
e3427cc8dd3c1248
7.04
11
"""LiteLLM pre-call hook that inlines RAG figures as base64 at the provider boundary. RAG figures reach LiteLLM as an image **URL** signed against our internal object storage. The LLM provider dereferences image URLs server-side and cannot reach that storage (managed inference fetches through its own egress proxy → 40...
bbvch-ai/aihub-core
infra/configs/litellm/custom_callbacks.py
.py
f706d7460af55613
7.54
11
""" title: AI-Hub Conversation Title description: Restores the agent-generated conversation title after the OpenWebUI first-turn title fallback. required_open_webui_version: 0.6.0 """ import logging from typing import Annotated, Any, Optional from open_webui.models.chats import Chats from pydantic import BaseModel l...
bbvch-ai/aihub-core
infra/configs/openwebui/functions/aihub_title_filter.py
.py
c937dcac77b13ff2
7.54
11
""" title: View Agent Memories description: Display all memories collected by agents during this conversation icon_url: data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAEBUlEQVR4AbSWWWxNURSGb02RmIUSksZYpYaaikgRJSU0XoS+1NAIJRpDePFAQipemhiCmqolUdIHQrRpmlCkD6UI1WoJIR76UCqkaKp6ff/J3de57blDr96b9Z219lp7r7...
bbvch-ai/aihub-core
infra/configs/openwebui/functions/memory_action.py
.py
747f8fcf8dd10bf9
7.54
11