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 |
|---|---|---|---|---|---|---|
from collections import deque
from django.db.models import BooleanField, Case, Exists, OuterRef, Q, Value, When
from subekashi.constants.constants import ALL_MEDIAS
from subekashi.lib.url import clean_url
from subekashi.models import Author, AuthorAlias, SongLink
from subekashi.models.author import NON_BRIDGING_ALIAS_T... | izumin2000/subekashi | subekashi/lib/query_filters.py | .py | 713dd0864e706117 | 7.65 | 19 |
import django_filters
from django.core.exceptions import ValidationError
from django.db.models import Subquery
from subekashi.models import Song
from subekashi.lib.query_filters import (
filter_by_keyword,
filter_by_imitate,
filter_by_imitated,
filter_by_guesser,
filter_by_mediatypes,
filter_by_... | izumin2000/subekashi | subekashi/lib/song_filterset.py | .py | c0998b8df96f9e69 | 7.65 | 19 |
from django.utils import timezone
from django.db import transaction
from config.settings import ROOT_URL
from subekashi.models import Song, SongLink, SongFields
from subekashi.lib.url import get_all_media
def check_reject_list(authors):
"""掲載拒否リストをチェック。NGならエラーメッセージを返す。問題なければNone。"""
try:
from subekash... | izumin2000/subekashi | subekashi/lib/song_service.py | .py | 6808c65fbd290df7 | 7.65 | 19 |
"""Custom integration to integrate OpenEI with Home Assistant."""
import logging
from datetime import timedelta
import openeihttp
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import STATE_UNAVAILABLE, STATE_UNKNOWN
from homeassistant.core import HomeAssistant
from homeassistant.except... | firstof9/ha-openei | custom_components/openei/__init__.py | .py | 12a0864d16089b49 | 7.63 | 17 |
"""Binary sensor platform for OpenEI."""
from homeassistant.components.binary_sensor import (
BinarySensorEntity,
BinarySensorEntityDescription,
)
from homeassistant.config_entries import ConfigEntry
from homeassistant.core import HomeAssistant
from homeassistant.helpers.device_registry import DeviceEntryType,... | firstof9/ha-openei | custom_components/openei/binary_sensor.py | .py | 91513fa0ed7870a1 | 7.63 | 17 |
"""Sensor platform for OpenEI."""
from typing import Any
from homeassistant.components.sensor import SensorEntity, SensorEntityDescription
from homeassistant.config_entries import ConfigEntry
from homeassistant.core import HomeAssistant
from homeassistant.helpers.device_registry import DeviceEntryType, DeviceInfo
fro... | firstof9/ha-openei | custom_components/openei/sensor.py | .py | 5bd13f702d55b3b0 | 7.63 | 17 |
"""Test configurations."""
import re
from unittest.mock import patch
import openeihttp
import pytest
from .common import load_fixture
pytest_plugins = "pytest_homeassistant_custom_component"
TEST_PATTERN = r"^https://api\.openei\.org/utility_rates\?.*$"
# This fixture enables loading custom integrations in all t... | firstof9/ha-openei | tests/conftest.py | .py | c444b2a9c2a31011 | 8.13 | 17 |
"""Test OpenEI config flow."""
import re
from unittest.mock import patch
import pytest
from homeassistant import config_entries, setup
from homeassistant.data_entry_flow import FlowResultType
from pytest_homeassistant_custom_component.common import MockConfigEntry
from custom_components.openei.const import DOMAIN
fr... | firstof9/ha-openei | tests/test_config_flow.py | .py | 69e88f0b2fba8ba5 | 7.13 | 17 |
"""github_rate_limits exporter test fixtures"""
import argparse
import base64
import datetime
import json
import os
import queue
from unittest.mock import Mock, PropertyMock
import dotmap
import pytest
from github.InstallationAuthorization import InstallationAuthorization
from github_rate_limits_exporter import cli,... | theodore86/github-rate-limits-exporter | tests/conftest.py | .py | 60ba22d8f8bb9037 | 8.1 | 15 |
"""The `config-parser` module provides utilities to format .ini and .cfg files."""
from typing import Tuple
import configupdater
import configupdater.builder
import configupdater.container
import configupdater.parser
__version__ = "1.2.0"
__all__ = ["ConfigFormatter"]
class ConfigFormatter:
"""A class used to r... | Delgan/config-formatter | config_formatter.py | .py | c63037fad1a16201 | 7.6 | 15 |
"""Python wrapper for NextDNS API."""
import asyncio
import logging
from http import HTTPStatus
from typing import Any, Self, cast
from aiohttp import ClientConnectorError, ClientSession
from tenacity import (
after_log,
retry,
retry_if_exception_type,
stop_after_attempt,
wait_incrementing,
)
fro... | bieniu/nextdns | nextdns/__init__.py | .py | 0be0b690072f3d29 | 7.54 | 11 |
"""Type definitions for NextDNS."""
from dataclasses import dataclass
from enum import StrEnum
from typing import Any
def _ratio(queries: int, total: int) -> float:
"""Compute percentage ratio, returning 0 when total is zero."""
return 0.0 if not total else round(queries / total * 100, 1)
@dataclass
class ... | bieniu/nextdns | nextdns/model.py | .py | 2c95f3786b114141 | 7.54 | 11 |
"""Set up some common test helper things."""
import json
from collections.abc import AsyncGenerator
from pathlib import Path
from typing import Any
import aiohttp
import pytest
import pytest_asyncio
from aiointercept import aiointercept
from syrupy.assertion import SnapshotAssertion
from syrupy.extensions.amber impor... | bieniu/nextdns | tests/conftest.py | .py | 942c6d3552ea40db | 8.04 | 11 |
import pydantic
class BasicConfig(pydantic.BaseModel):
config_class: type['BasicConfig'] = None # type: ignore
class Config:
arbitrary_types_allowed = True
class ConfigMeta(type):
"""Metaclass for plugins used to initialize config variables"""
def __new__(cls, name, bases, attrs):
con... | timraay/HLLLogUtilities | lib/config.py | .py | 70b41761808ee64b | 7.62 | 16 |
import asyncio
from datetime import datetime, timedelta, timezone
from inspect import isfunction, iscoroutinefunction, isclass
from lib.rcon.models import EventModel, EventTypes
from utils import to_timedelta
from typing import Union, List, Tuple, Any, Callable, Sequence
class ListenerCooldown:
def __init__(
... | timraay/HLLLogUtilities | lib/events.py | .py | b66adca66e50c353 | 7.62 | 16 |
from typing import TYPE_CHECKING, Dict, List
from lib.rcon.models import EventModel, EventTypes
from lib.events import EventListener
from lib.config import Configurable, BasicConfig, skip_config_init
if TYPE_CHECKING:
from lib.session import HLLCaptureSession
class ModifierConfig(BasicConfig):
id: str
""... | timraay/HLLLogUtilities | lib/modifiers/base.py | .py | 98d72b4ce7e2d04f | 7.62 | 16 |
import typing as t
from dataclasses import dataclass
@dataclass
class RequestTimeout:
"""
Request timeout configuration.
Arguments:
timeout: Timeout on all operations eg, read, write, connect.
Examples:
RequestTimeout(None) # No timeouts.
RequestTimeout(5.0) ... | healthjoy/async-customerio | async_customerio/_config.py | .py | 11b6a9822e40af54 | 7.42 | 6 |
"""
Implements the client that interacts with Customer.io's App API using app keys.
"""
from typing import Any, Dict, Optional, Protocol
from async_customerio._config import DEFAULT_REQUEST_LIMITS, DEFAULT_REQUEST_TIMEOUT, RequestLimits, RequestTimeout
from async_customerio.client_base import AsyncClientBase
from asy... | healthjoy/async-customerio | async_customerio/api/_client.py | .py | d73260df3387cade | 7.42 | 6 |
"""
Segment endpoints for the Customer.io App API.
Provides methods to list, create, get, delete segments, and look up
segment membership, customer count, and dependencies.
"""
from __future__ import annotations
import typing as t
if t.TYPE_CHECKING:
from async_customerio.api._client import AsyncAPIClient
cl... | healthjoy/async-customerio | async_customerio/api/segments.py | .py | e257ca5e2b074a41 | 7.42 | 6 |
from __future__ import annotations
from collections.abc import Sequence
from typing import Literal
import pytorch_lightning as pl
from torch_geometric.data import Batch, Data
from torch_geometric.loader import DataListLoader, NeighborLoader
from torch_geometric.transforms import RandomNodeSplit
VALID_STAGE = {"fit",... | theislab/geome | docs/notebooks/utils/datamodule.py | .py | 2392a6a2fbb225ce | 7.63 | 17 |
"""
Graph VAE module
g(A,X) from the paper
"""
import torch
from geome.models.modules.graph_ae import GraphAE
# from models.modules.graph_ae import GraphAE
import pytorch_lightning as pl
from torch_geometric.data import Batch
class GraphEmbedding(pl.LightningModule):
def __init__(self, num_features: int = 36, la... | theislab/geome | docs/notebooks/utils/models/graph_embedding.py | .py | 64cac080539d5cfd | 7.63 | 17 |
"""
LinearNCEM module
"""
import torch
import torch.nn as nn
import pytorch_lightning as pl
import torch.optim as optim
from sklearn.metrics import r2_score
import numpy as np
class LinearNCEM(pl.LightningModule):
def __init__(self, use_node_scale=False, **model_kwargs):
super().__init__()
# Savin... | theislab/geome | docs/notebooks/utils/models/linear_ncem.py | .py | 0244bed73225e8f6 | 7.63 | 17 |
"""
GNN module
contains consecutive layers
"""
import torch.nn as nn
import torch_geometric.nn as geom_nn
class GNNModel(nn.Module):
def __init__(self, in_channels=11, hidden_dims=None, out_channels=34, **kwargs):
"""
Inputs:
in_channels - Dimension of input features
out_ch... | theislab/geome | docs/notebooks/utils/models/modules/gnn_model.py | .py | 47679d5bad81b17d | 7.63 | 17 |
"""
Graph VAE module
g(A,X) from the paper
"""
import torch
from torch_geometric.nn import SAGEConv
# taken from https://colab.research.google.com/github/AntonioLonga/PytorchGeometricTutorial/blob/main/Tutorial6/Tutorial6.ipynb
class GraphAE(torch.nn.Module):
def __init__(self, in_channels, out_channels, latent_d... | theislab/geome | docs/notebooks/utils/models/modules/graph_ae.py | .py | 947d98fe6c6b055a | 7.63 | 17 |
"""
MLPModel module
Vanilla module for consecutive dense layers.
"""
import torch.nn as nn
class MLPModel(nn.Module):
def __init__(self, in_channels=34, hidden_dims=None, out_channels=34, dp_rate=0.1):
"""
Inputs:
in_channels - Dimension of input features
out_channels - Dim... | theislab/geome | docs/notebooks/utils/models/modules/mlp_model.py | .py | ca5749254cae511f | 7.63 | 17 |
from __future__ import annotations
from abc import ABC, abstractmethod
from collections.abc import Iterable
from typing import Any, Callable
import torch
from anndata import AnnData
from torch_geometric.data import Data
class Ann2DataAbstract(ABC):
"""Abstract class that transforms an iterable of AnnData to Pyt... | theislab/geome | src/geome/ann2data/base/abstract.py | .py | 92a5b4a280b9956e | 7.63 | 17 |
from __future__ import annotations
from typing import Callable
from anndata import AnnData
from geome.iterables import ToCategoryIterator
from .basic import Ann2DataBasic
class Ann2DataByCategory(Ann2DataBasic):
"""Convert anndata object into a dictionary of torch.tensors then create pyg.Data from them."""
... | theislab/geome | src/geome/ann2data/by_category.py | .py | cae684ee682aad37 | 7.63 | 17 |
from __future__ import annotations
from abc import ABC, abstractmethod
from collections.abc import Iterable
from anndata import AnnData
class ToIterable(ABC):
"""Abstract class for creating an iterable of AnnData objects."""
@abstractmethod
def __call__(self, adata: AnnData) -> Iterable[AnnData]:
... | theislab/geome | src/geome/iterables/base/to_iterable.py | .py | 1399c232af5a3784 | 7.13 | 17 |
from __future__ import annotations
from dataclasses import dataclass, field
import squidpy as sq
from anndata import AnnData
from .base.transform import Transform
@dataclass
class AddAdjMatrix(Transform):
"""Add the adjacency matrix to the AnnData object.
Args:
----
spatial_key (str): Key in annda... | theislab/geome | src/geome/transforms/add_adj_matrix.py | .py | 30a7d0f551639b7c | 7.63 | 17 |
from __future__ import annotations
from dataclasses import dataclass
import numpy as np
import pandas as pd
from anndata import AnnData
from geome.transforms.utils import check_adj_matrix_loc
from geome.utils import check_loc, get_from_loc, set_to_loc
from .base.transform import Transform
def design_matrix(A: np.... | theislab/geome | src/geome/transforms/add_design_matrix.py | .py | 506795667da48156 | 7.63 | 17 |
from __future__ import annotations
from dataclasses import dataclass
import scipy.sparse as sp
import torch
from anndata import AnnData
from torch_geometric.utils import from_scipy_sparse_matrix
from geome.transforms.utils import check_adj_matrix_loc
from geome.utils import get_from_loc, set_to_loc
from .add_adj_ma... | theislab/geome | src/geome/transforms/add_edge_index.py | .py | 3a125997b2018e18 | 7.63 | 17 |
from abc import ABC, abstractmethod
from anndata import AnnData
class Transform(ABC):
"""Abstract class for Transform.
A Transform is a callable that takes an AnnData object and returns a transformed AnnData object.
"""
@abstractmethod
def __call__(self, adata: AnnData) -> AnnData:
"""A... | theislab/geome | src/geome/transforms/base/transform.py | .py | 92926e3d985f621e | 7.13 | 17 |
from __future__ import annotations
from dataclasses import dataclass
from typing import Literal
from anndata import AnnData
from .base.transform import Transform
@dataclass
class Categorize(Transform):
"""Converts the given list of observation columns in the AnnData object to categorical.
Args:
----
... | theislab/geome | src/geome/transforms/categorize.py | .py | 6a40ddcaa9b8b5eb | 7.63 | 17 |
from __future__ import annotations
from typing import Callable
from anndata import AnnData
from .base.transform import Transform
class Compose(Transform):
"""Composes several transforms together as a single transform."""
def __init__(self, transforms: list[Callable[[AnnData], AnnData]]):
self.tran... | theislab/geome | src/geome/transforms/compose.py | .py | 2cb1b13a33631ab5 | 7.63 | 17 |
from __future__ import annotations
from dataclasses import dataclass
from typing import Literal
import pandas as pd
from anndata import AnnData
from .base.transform import Transform
@dataclass
class SaveOneHotEncodeLabels(Transform):
"""One-hot encode specified columns in an AnnData object and store them in th... | theislab/geome | src/geome/transforms/one_hot_encode.py | .py | 7f51c56bcf659cb7 | 7.63 | 17 |
from __future__ import annotations
from typing import Literal
import numpy as np
from anndata import AnnData
from .base.transform import Transform
class Subset(Transform):
"""
Create a subset of an AnnData object based on specified observation or feature values.
Parameters
----------
key_value... | theislab/geome | src/geome/transforms/subset.py | .py | 7ab0d48fca08beb8 | 7.63 | 17 |
from typing import Any
from anndata import AnnData
def get_from_loc(adata: AnnData, location: str) -> Any:
"""Get a value from a specified location in the AnnData object.
Args:
----
adata (AnnData): The AnnData object.
location (str): The location in the AnnData object. Format should be 'attribu... | theislab/geome | src/geome/utils.py | .py | 15ee827f6d7b30a8 | 7.63 | 17 |
import anndata as ad
import numpy as np
import scipy.sparse as sp
import squidpy as sq
import torch
from geome import transforms
def test_add_edge_index_from_adj():
# Define the adjacency matrix
adjacency_matrix = np.array([[0, 2, 0, 0], [2, 0, 3, 0], [0, 3, 0, 1], [0, 0, 1, 0]])
# Create the edge index... | theislab/geome | tests/transforms/test_add_edge_index.py | .py | 49aad42466f1451f | 7.13 | 17 |
import anndata as ad
import numpy as np
from geome import transforms
def test_categorize():
adata = ad.AnnData(np.random.rand(50, 2), obs={"cell_type": ["a"] * 25 + ["b"] * 25})
# has dtype('O')
assert adata.obs["cell_type"].dtype == "object"
adata = transforms.Categorize(keys="cell_type")(adata)
... | theislab/geome | tests/transforms/test_categorize.py | .py | 7861823afecf4f64 | 7.13 | 17 |
import anndata as ad
import numpy as np
import pytest
from geome.transforms import Subset
# copy value true or false as a fixture
@pytest.fixture(params=[True, False])
def copy(request):
return request.param
@pytest.fixture
def adata():
# Create test data for obs and var
obs_data = {
"cell_type... | theislab/geome | tests/transforms/test_subset.py | .py | 25786735adc6c574 | 7.13 | 17 |
"""API connector for the ONYX integration."""
import logging
import asyncio
from datetime import timedelta
from random import uniform
from homeassistant.helpers.update_coordinator import DataUpdateCoordinator
from homeassistant.helpers.debounce import Debouncer
from homeassistant.helpers.aiohttp_client import async_... | muhlba91/onyx-homeassistant-integration | custom_components/hella_onyx/api_connector.py | .py | 05114ae0e5ae7639 | 7.56 | 12 |
"""API connector for the ONYX integration."""
class Configuration:
"""Configuration for the ONYX integration."""
def __init__(
self,
scan_interval,
min_dim_duration,
max_dim_duration,
additional_delay,
interpolation_frequency,
force_update,
fing... | muhlba91/onyx-homeassistant-integration | custom_components/hella_onyx/configuration.py | .py | fa366185cd2f4618 | 7.56 | 12 |
"""The ONYX device type sensor."""
from typing import Optional
from homeassistant.components.sensor import SensorEntity
from ..sensors.onyx_entity import OnyxEntity
class OnyxSensorDeviceType(OnyxEntity, SensorEntity):
"""ONYX Device Type Sensor."""
@property
def name(self) -> str:
"""Return t... | muhlba91/onyx-homeassistant-integration | custom_components/hella_onyx/sensors/device_type.py | .py | dcce83b2c99077ca | 7.56 | 12 |
"""The ONYX light entity."""
import logging
import time
from datetime import timedelta
from math import ceil
from typing import Any
from homeassistant.core import callback
from homeassistant.components.light import (
LightEntity,
ColorMode,
LightEntityFeature,
ATTR_BRIGHTNESS,
)
from homeassistant.he... | muhlba91/onyx-homeassistant-integration | custom_components/hella_onyx/sensors/light.py | .py | f808cd6624995f8f | 7.56 | 12 |
"""The ONYX entity."""
import logging
from homeassistant.core import callback
from homeassistant.helpers.device_registry import DeviceInfo
from homeassistant.helpers.update_coordinator import CoordinatorEntity
from onyx_client.enum.device_type import DeviceType
from ..api_connector import APIConnector, UnknownState... | muhlba91/onyx-homeassistant-integration | custom_components/hella_onyx/sensors/onyx_entity.py | .py | 55dd53e543fb689c | 7.56 | 12 |
"""The ONYX shutter entity."""
import logging
import time
from datetime import timedelta
from functools import reduce
from operator import add
from math import ceil
from typing import Any, Optional
from homeassistant.core import callback
from homeassistant.components.cover import (
ATTR_POSITION,
ATTR_TILT_P... | muhlba91/onyx-homeassistant-integration | custom_components/hella_onyx/sensors/shutter.py | .py | 8986103132b654c3 | 7.56 | 12 |
"""Test for the ONYX Interpolation util."""
from custom_components.hella_onyx.util.interpolation import interpolate
class TestInterpolation:
def test_interpolate(self):
assert interpolate(0, 50, 20000, 10000, 0) == 25
def test_interpolate_decreasing(self):
assert interpolate(50, 0, 20000, 10... | muhlba91/onyx-homeassistant-integration | tests/util/test_interpolation.py | .py | 9957a5850a158ba5 | 8.06 | 12 |
"""Java Use Cast / Java Useby Castby: the type named in a cast expression.
(JSONObject) o -> Use Cast on org.json.JSONObject
(T) array[i] -> Use Cast on Sorts.HeapSort.sort.T
(int) x -> nothing
A cast names a type, and a reference needs an entity to point at. A primitive
h... | m-zakeri/OpenUnderstand | openunderstand/analysis_passes/cast_castby.py | .py | 6aa19ca4d4d27d40 | 7.59 | 14 |
"""
The helper module for couple_coupleby.py, create_createby.py, declare_declareby.py modules
Todo: Must be document well
"""
__author__ = "Shaghayegh Mobasher , Setayesh kouloubandi ,Parisa Alaie, Zakeri"
__version__ = "0.1.1"
from openunderstand.gen.javaLabeled.JavaParserLabeled import JavaParserLabeled
from ope... | m-zakeri/OpenUnderstand | openunderstand/analysis_passes/class_properties.py | .py | 24f4c1368b5e03d8 | 7.59 | 14 |
# expression -> NEW creator
"""
## Description
This module find all OpenUnderstand call and callby references in a Java project
## References
"""
__author__ = "zahra habibolah, G4"
# __version__ = "0.1.0"
# Omitted imports and other code for brevity
from openunderstand.gen.javaLabeled.JavaParserLabeledListener ... | m-zakeri/OpenUnderstand | openunderstand/analysis_passes/create_createby.py | .py | 9274bbd429a7ed39 | 7.59 | 14 |
"""Declared type of every name a subtree brings into scope.
Several passes need to know what `x` is before they can say what `x.foo()`
calls or what `x.p = v` sets, and the database cannot answer it: all 1206
parameters and 2552 of 4634 variables on the TheAlgorithms benchmark have a
null `_type`. Reading it off the p... | m-zakeri/OpenUnderstand | openunderstand/analysis_passes/declared_types.py | .py | 81a977a91e8a2393 | 7.59 | 14 |
from openunderstand.gen.javaLabeled.JavaParserLabeledListener import (
JavaParserLabeledListener,
)
from openunderstand.gen.javaLabeled.JavaParserLabeled import JavaParserLabeled
import openunderstand.analysis_passes.class_properties as class_properties
class DotRef_DotRefBy(JavaParserLabeledListener):
"""Col... | m-zakeri/OpenUnderstand | openunderstand/analysis_passes/dotref_dotrefby.py | .py | 9da8eaf868fd00eb | 7.59 | 14 |
"""This module is for create, Read of entities of different kinds in project,
in this module there are many classes for each individual entity as follows:
1. File
2. Package
3. Parent Entities:
Class
Method
Interface
"""
__author__ = "Navid Mousavizadeh, Amir Mohammad Sohrabi, Sara ... | m-zakeri/OpenUnderstand | openunderstand/analysis_passes/entity_manager.py | .py | bacbb899a9c0b7c1 | 7.59 | 14 |
# expression -> NEW creator
"""
## Description
This module find all OpenUnderstand create and createby references in a Java project
## References
"""
__author__ = (
"Parmida Majmasanaye , Zahra Momeninezhad , Bayan Divaani-Azar , Bavan Divaani-Azar"
)
__version__ = "0.1.0"
from openunderstand.gen.javaLabele... | m-zakeri/OpenUnderstand | openunderstand/analysis_passes/extend_listener.py | .py | 90a708a2730b9319 | 7.59 | 14 |
"""
## Description
This module find all OpenUnderstand call and callby references in a Java project
## References
"""
__author__ = "Shaghayegh Mobasher , Setayesh kouloubandi ,Parisa Alaie"
__version__ = "0.1.0"
from openunderstand.gen.javaLabeled.JavaParserLabeledListener import (
JavaParserLabeledListener,
... | m-zakeri/OpenUnderstand | openunderstand/analysis_passes/extendcouple_extendcoupleby.py | .py | 667211c3be4951f2 | 7.59 | 14 |
"""Java Use / Java Useby on the member of a field access.
System.out.println(x) Use on java.lang.System.out
currentElement.content Use on DataStructures.Bags.Bag.Node.content
this.cursor Use on ...DynamicArrayIterator.cursor
`a.b` records two separate facts and only one of them was... | m-zakeri/OpenUnderstand | openunderstand/analysis_passes/field_uses.py | .py | e532c06d578797e4 | 7.59 | 14 |
"""Java Use Ptr / Java Useby Ptr: a lambda expression.
Comparator.comparingInt(a -> a.getDistance())
^ Use Ptr, scope=A_Star.A_Star.aStar
ent=A_Star.A_Star.aStar.(lambda_expr_1)
Understand gives every lambda an entity of its own -- kind `Java Method
Lambda... | m-zakeri/OpenUnderstand | openunderstand/analysis_passes/lambdas.py | .py | 78d0fb8e299ca31c | 7.59 | 14 |
"""Record every method-call site, resolved or not.
The existing call pass resolves a call against the classes it can see in the
one file being parsed, so on the JSON benchmark it found 172 of the 1722 calls
Understand reports. Most calls in a project cross files, and `process_file`
never sees more than one.
Rather th... | m-zakeri/OpenUnderstand | openunderstand/analysis_passes/method_calls.py | .py | db17f6d15125f07c | 7.59 | 14 |
"""This module is for create, Read of entities of type package."""
__author__ = "Navid Mousavizadeh, Amir Mohammad Sohrabi, Sara Younesi, Deniz Ahmadi"
__copyright__ = "Copyright 2022, The OpenUnderstand Project, Iran University of Science and technology"
__credits__ = [
"Dr.Parsa",
"Dr.Zakeri",
"Mehdi Raz... | m-zakeri/OpenUnderstand | openunderstand/analysis_passes/package_entity_listener.py | .py | 59819b681fba93b0 | 7.59 | 14 |
from openunderstand.gen.javaLabeled.JavaParserLabeled import JavaParserLabeled
from openunderstand.gen.javaLabeled.JavaParserLabeledListener import (
JavaParserLabeledListener,
)
from openunderstand.analysis_passes import class_properties
from os.path import basename
class SetPartialAndSetByPartialListener(JavaPa... | m-zakeri/OpenUnderstand | openunderstand/analysis_passes/setpartial_setpartialby.py | .py | 26fadc302854896a | 7.59 | 14 |
"""Java Importby / Java Importby Demand: what a file pulls in by static import.
import static Sorts.SortUtils.less; -> Importby scope=Sorts.SortUtils.less
import static Sorts.SortUtils.*; -> Importby Demand scope=Sorts.SortUtils
The reference is recorded against the *imported* thing, with th... | m-zakeri/OpenUnderstand | openunderstand/analysis_passes/static_imports.py | .py | b51ab198350648fe | 7.59 | 14 |
from openunderstand.gen.javaLabeled.JavaParserLabeled import JavaParserLabeled
from openunderstand.gen.javaLabeled.JavaParserLabeledListener import (
JavaParserLabeledListener,
)
from openunderstand.analysis_passes import class_properties
class UseAndUseByListener(JavaParserLabeledListener):
"""Collect every ... | m-zakeri/OpenUnderstand | openunderstand/analysis_passes/use_useby.py | .py | 8f5edaeef97fd205 | 7.59 | 14 |
"""
## Description
This module find all OpenUnderstand Usemodule and Usemoduleby references in a Java project
## References
"""
__author__ = "Navid Mousavizade, Amir Mohammad Sohrabi, Sara Younesi, Deniz Ahmadi"
__version__ = "0.1.0"
from openunderstand.gen.javaLabeled.JavaParserLabeledListener import (
JavaPar... | m-zakeri/OpenUnderstand | openunderstand/analysis_passes/usemodule_usemoduleby.py | .py | f78f0636282403c5 | 7.59 | 14 |
"""This module is for create, Read of entities of type package."""
__author__ = "Navid Mousavizadeh, Amir Mohammad Sohrabi, Sara Younesi, Deniz Ahmadi"
__copyright__ = "Copyright 2022, The OpenUnderstand Project, Iran University of Science and technology"
__credits__ = [
"Dr.Parsa",
"Dr.Zakeri",
"Mehdi Raz... | m-zakeri/OpenUnderstand | openunderstand/analysis_passes/variable_listener.py | .py | a05e8fc059ee0391 | 7.59 | 14 |
#!/usr/bin/env python3
"""Build the speedy-antlr C++ parse accelerator.
Everything here is derived from ``grammars/*.g4``. Nothing generated is kept in
version control -- not the C++ sources, not the ANTLR runtime, not the compiled
extension. Run this script and you get all of it; delete the build directory
and you ar... | m-zakeri/OpenUnderstand | openunderstand/gen/java8speedy/build.py | .py | 8694cf81ddb74147 | 7.59 | 14 |
"""
Implements the BenQProjector examine class.
Created on 23 Jan 2025
@author: Rogier van Staveren
"""
import asyncio
import logging
from .benqclasses import BenQCommand
from .benqprojector import (
BenQBlockedItemError,
BenQProjector,
BenQProjectorError,
BenQResponseTimeoutError,
)
logger = loggi... | rrooggiieerr/benqprojector.py | benqprojector/benqexamine.py | .py | aa56a88082eafdf7 | 7.64 | 18 |
# pylint: disable=R0801
# pylint: disable=invalid-name
# pylint: disable=missing-class-docstring
# pylint: disable=missing-function-docstring
"""
Created on 16 Jan 2023
@author: Rogier van Staveren
"""
import logging
import unittest
from benqprojector import BenQProjectorSerial
from benqprojector.benqexamine import ... | rrooggiieerr/benqprojector.py | tests/testBenQProjectorDetectCommands.py | .py | ff8d692e1cef760d | 8.14 | 18 |
# pylint: disable=R0801
# pylint: disable=invalid-name
# pylint: disable=missing-class-docstring
# pylint: disable=missing-function-docstring
"""
Created on 16 Jan 2023
@author: Rogier van Staveren
"""
import logging
import unittest
from benqprojector import BenQProjector
from benqprojector.benqexamine import BenQPr... | rrooggiieerr/benqprojector.py | tests/testBenQProjectorDetectModes.py | .py | c3d9fb794b254d56 | 8.14 | 18 |
# pylint: disable=R0801
# pylint: disable=invalid-name
# pylint: disable=missing-class-docstring
# pylint: disable=missing-function-docstring
"""
Created on 5 Dec 2022
@author: rogier
"""
import unittest
from benqprojector.benqprojector import (
BenQBlockedItemError,
BenQEmptyResponseError,
BenQIllegalFo... | rrooggiieerr/benqprojector.py | tests/testBenQProjectorErrors.py | .py | 5f5e8dd49e8cb845 | 8.14 | 18 |
# pylint: disable=R0801
# pylint: disable=invalid-name
# pylint: disable=missing-class-docstring
# pylint: disable=missing-function-docstring
"""
Created on 27 Nov 2022
@author: Rogier van Staveren
"""
import logging
import time
import unittest
from benqprojector import BenQProjectorSerial
logger = logging.getLogge... | rrooggiieerr/benqprojector.py | tests/testBenQProjectorMenu.py | .py | 12761e3e041b6cd5 | 7.14 | 18 |
# pylint: disable=R0801
# pylint: disable=invalid-name
# pylint: disable=missing-class-docstring
# pylint: disable=missing-function-docstring
# pylint: disable=protected-access
"""
Created on 27 Nov 2022
@author: Rogier van Staveren
"""
import logging
import unittest
from benqprojector.benqprojector import (
Ben... | rrooggiieerr/benqprojector.py | tests/testBenQProjectorParseResponses.py | .py | 9edf48185bc46655 | 8.14 | 18 |
# pylint: disable=R0801
# pylint: disable=invalid-name
# pylint: disable=missing-class-docstring
# pylint: disable=missing-function-docstring
# pylint: disable=protected-access
"""
Created on 27 Nov 2022
@author: Rogier van Staveren
"""
import logging
import unittest
from benqprojector.benqprojector import BenQComma... | rrooggiieerr/benqprojector.py | tests/testBenQProjectorSerial.py | .py | 7589d7c7a405de7e | 8.14 | 18 |
# pylint: disable=R0801
# pylint: disable=invalid-name
# pylint: disable=missing-class-docstring
# pylint: disable=missing-function-docstring
# pylint: disable=protected-access
"""
Created on 27 Nov 2022
@author: Rogier van Staveren
"""
import logging
import unittest
from benqprojector.benqprojector import BenQComma... | rrooggiieerr/benqprojector.py | tests/testBenQProjectorTelnet.py | .py | 1074fe77f6452b85 | 8.14 | 18 |
# pylint: disable=R0801
# pylint: disable=invalid-name
# pylint: disable=missing-class-docstring
# pylint: disable=missing-function-docstring
"""
Created on 27 Nov 2022
@author: Rogier van Staveren
"""
import logging
import unittest
from benqprojector import BenQProjectorSerial
logger = logging.getLogger(__name__)
... | rrooggiieerr/benqprojector.py | tests/testBenQProjectorVolume.py | .py | f25070e5b8a0f5e8 | 8.14 | 18 |
# pylint: disable=R0801
# pylint: disable=invalid-name
# pylint: disable=missing-class-docstring
# pylint: disable=missing-function-docstring
# pylint: disable=protected-access
"""
Created on 27 Nov 2022
@author: Rogier van Staveren
"""
import logging
import unittest
from benqprojector.benqconnection import BenQSeri... | rrooggiieerr/benqprojector.py | tests/testBenQSerialConnection.py | .py | 6a255d82f2f1ed95 | 8.14 | 18 |
# pylint: disable=invalid-name
# pylint: disable=missing-class-docstring
# pylint: disable=missing-function-docstring
import unittest
from unittest.mock import AsyncMock, Mock, patch
import serialx
from benqprojector.benqconnection import BenQSerialConnection
BAUD_RATE = 115200
class Test(unittest.IsolatedAsyncioT... | rrooggiieerr/benqprojector.py | tests/testBenQSerialConnectionMock.py | .py | 1e1f7a89e7976914 | 7.14 | 18 |
# pylint: disable=R0801
# pylint: disable=invalid-name
# pylint: disable=missing-class-docstring
# pylint: disable=missing-function-docstring
# pylint: disable=protected-access
"""
Created on 27 Nov 2022
@author: Rogier van Staveren
"""
import logging
import unittest
from benqprojector.benqconnection import BenQTeln... | rrooggiieerr/benqprojector.py | tests/testBenQTelnetConnection.py | .py | b7e7b24106491336 | 8.14 | 18 |
# Copyright 2021-2026 Mathieu Tarral
# SPDX-License-Identifier: Apache-2.0
"""Pure state + rendering helpers for the ``neogit commit --gui`` folder pane.
The pane shows the directory whose files are currently being hashed and the
files merkelized in it so far. ``FolderState`` keeps that state **bounded** —
only the m... | OSWatcher/neogit | neogit/console/folder_tree.py | .py | c2a272e3193d645d | 7.42 | 6 |
# Copyright 2021-2026 Mathieu Tarral
# SPDX-License-Identifier: Apache-2.0
import os
from pathlib import Path
from threading import Lock
from typing import Dict, Optional
from rich.layout import Layout
from rich.live import Live
from rich.panel import Panel
from rich.progress import (
BarColumn,
FileSizeColum... | OSWatcher/neogit | neogit/console/rich.py | .py | d041846c7a734fca | 7.42 | 6 |
# Copyright 2021-2026 Mathieu Tarral
# SPDX-License-Identifier: Apache-2.0
# need to import hashlib._Hash
from __future__ import annotations
import hashlib
import logging
import os
from attrs import define
from ..model import FSDirectoryNode, FSFileNode, MerkleLabel, MerkleNode
from ..visitor import VisitedNode
fro... | OSWatcher/neogit | neogit/core/merkle/filesystem.py | .py | d0df8a1b66297bba | 7.42 | 6 |
# Copyright 2021-2026 Mathieu Tarral
# SPDX-License-Identifier: Apache-2.0
import hashlib
import re
from enum import Enum, auto
from functools import lru_cache
from typing import Dict, List
from attrs import define, field, validators
# avoid circular dependency
from .node import Node
class MerkleLabel(Enum):
#... | OSWatcher/neogit | neogit/core/model/merkle.py | .py | 3bebf6974fba2bb5 | 7.42 | 6 |
# Copyright 2021-2026 Mathieu Tarral
# SPDX-License-Identifier: Apache-2.0
"""
Domain model objects
"""
import typing
from abc import ABC
from typing import Iterator
from attrs import define
if typing.TYPE_CHECKING:
from neogit.core.visitor import NodeVisitor
@define(auto_attribs=True)
class Node(ABC):
"""... | OSWatcher/neogit | neogit/core/model/node.py | .py | f467789ca265df6f | 7.42 | 6 |
# Copyright 2021-2026 Mathieu Tarral
# SPDX-License-Identifier: Apache-2.0
"""
Visitor design pattern
Taken from https://github.com/nodejs/node/blob/master/tools/inspector_protocol/jinja2/visitor.py (NodeJS)
"""
import logging
from concurrent.futures import Future, ThreadPoolExecutor
from queue import Queue
from typ... | OSWatcher/neogit | neogit/core/visitor/node.py | .py | b23851e5407a2468 | 7.42 | 6 |
# Copyright 2021-2026 Mathieu Tarral
# SPDX-License-Identifier: Apache-2.0
import logging
from concurrent.futures import Future, ThreadPoolExecutor
from threading import current_thread
from typing import Optional
from neogit.core.model import Node
from neogit.core.visitor import NodeVisitor
class NodeVisitorThread:... | OSWatcher/neogit | neogit/core/visitor/thread.py | .py | 1ce3f237b59f24fc | 7.42 | 6 |
# Copyright 2021-2026 Mathieu Tarral
# SPDX-License-Identifier: Apache-2.0
from pathlib import Path
from typing import Iterator, List, Union
from neo4j import Record, Result, Session, Transaction
from neogit.model import DiffStatus, FSDiffObject
from neogit.utils import cypher_unescape
ROOT_PATH = Path("/")
# Sing... | OSWatcher/neogit | neogit/diff/differ.py | .py | 9aabd34ba9e0be62 | 7.42 | 6 |
# Copyright 2021-2026 Mathieu Tarral
# SPDX-License-Identifier: Apache-2.0
"""Human-friendly rendering of a single FSDiffObject for the CLI.
Output is git ``--name-status`` style: a status letter, two spaces, then the
path. The returned string is Rich markup, so a ``rich.console.Console`` shows
color on a TTY and pri... | OSWatcher/neogit | neogit/diff/render.py | .py | 13eff56d893937df | 7.42 | 6 |
# Copyright 2021-2026 Mathieu Tarral
# SPDX-License-Identifier: Apache-2.0
"""Neogit
Usage:
neogit [options] init
neogit [options] commit <name> [branch <branch>] [--unique] [--before=<commit>]
neogit [options] branch <name> <commit>
neogit [options] diff <ref1> <ref2>
neogit [options] log [<branch>]
Optio... | OSWatcher/neogit | neogit/entrypoint/cmdline.py | .py | 593df3a0ac072229 | 7.42 | 6 |
# Copyright 2021-2026 Mathieu Tarral
# SPDX-License-Identifier: Apache-2.0
"""Human-friendly summary of `neogit init` for the CLI.
`init` is otherwise silent. After creating the graph constraints and the object
container, the service returns an :class:`InitSummary` describing the backends it
used; the CLI renders it ... | OSWatcher/neogit | neogit/init/render.py | .py | 0a8f633e2b80660c | 7.42 | 6 |
# Copyright 2021-2026 Mathieu Tarral
# SPDX-License-Identifier: Apache-2.0
import hashlib
from typing import Union
COMMIT_STRING = """
{name}{date}{tree_sha1}
"""
class Hasher:
"""Produces a hash sum"""
def __init__(self):
self._hash = hashlib.sha1()
def from_io(self, io):
buffer = byt... | OSWatcher/neogit | neogit/merkle/hasher.py | .py | 5f82bc4a8c72e777 | 7.42 | 6 |
# Copyright 2021-2026 Mathieu Tarral
# SPDX-License-Identifier: Apache-2.0
"""This module takes care of uploading objects to the object storage"""
import logging
from concurrent.futures import Future, ThreadPoolExecutor
from pathlib import Path
from threading import Lock, get_ident, local
from typing import Dict, Iter... | OSWatcher/neogit | neogit/merkle/uploader.py | .py | 4157e5770e07a46f | 7.42 | 6 |
# Copyright 2021-2026 Mathieu Tarral
# SPDX-License-Identifier: Apache-2.0
"""IO utilities used while building a MerkleTree"""
import os
from contextlib import contextmanager
from functools import partial
from io import BytesIO
from pathlib import Path
from typing import BinaryIO, Iterator
BUFFER_SIZE = 65535
@con... | OSWatcher/neogit | neogit/merkle/utils.py | .py | eca528faefca360f | 7.42 | 6 |
# Copyright 2021-2026 Mathieu Tarral
# SPDX-License-Identifier: Apache-2.0
"""Implements a Visitor which handles Neo4j transaction upload and the Object Storage upload"""
from queue import Queue
from typing import Union
from attrs import define, field
from neo4j import Session, Transaction
from neogit.console import... | OSWatcher/neogit | neogit/merkle/visitor.py | .py | 5d3699313ffab92b | 7.42 | 6 |
# Copyright 2021-2026 Mathieu Tarral
# SPDX-License-Identifier: Apache-2.0
from functools import lru_cache
from pathlib import PurePath
from typing import Dict, Generator, Tuple, Union
from neo4j import Session, Transaction
from neomodel import DoesNotExist, RelationshipTo, StringProperty, StructuredNode, StructuredR... | OSWatcher/neogit | neogit/model/merkle.py | .py | 7f94ee1ad52d25dc | 7.42 | 6 |
# Copyright 2021-2026 Mathieu Tarral
# SPDX-License-Identifier: Apache-2.0
from datetime import datetime, timezone
from enum import Enum, auto
from typing import Iterator, Optional, Set
from neomodel import DateTimeNeo4jFormatProperty, RelationshipTo, StringProperty, StructuredNode, db
from neogit.merkle.hasher impo... | OSWatcher/neogit | neogit/model/neo.py | .py | d0f4ea6069e67a8d | 7.42 | 6 |
# Copyright 2021-2026 Mathieu Tarral
# SPDX-License-Identifier: Apache-2.0
"""In-memory object storage adapter for testing"""
import os
from functools import reduce
from typing import Dict, Iterator, Optional, Tuple
from .abstract import (
AbstractObjectStorage,
Container,
ContainerAlreadyExists,
Con... | OSWatcher/neogit | neogit/object_storage/fake.py | .py | 153aaeae948c5c24 | 7.42 | 6 |
# Copyright 2021-2026 Mathieu Tarral
# SPDX-License-Identifier: Apache-2.0
from dataclasses import asdict
from functools import wraps
from pathlib import Path
from typing import Iterator, Optional
from libcloud.common.types import LibcloudError
from libcloud.storage.base import Container as LibCloudContainer
from lib... | OSWatcher/neogit | neogit/object_storage/lib_cloud.py | .py | 0c8da222d6067c6b | 7.42 | 6 |
# Copyright 2021-2026 Mathieu Tarral
# SPDX-License-Identifier: Apache-2.0
import threading
from typing import Dict, Optional
from neogit.config import ObjectConfig
from neogit.object_storage.abstract import AbstractObjectStorage
class TSObjectStorage:
"""Thread safe provider for object storage.
Return a p... | OSWatcher/neogit | neogit/object_storage/thread_safe.py | .py | 2a48881254082ce2 | 7.42 | 6 |
# Copyright 2021-2026 Mathieu Tarral
# SPDX-License-Identifier: Apache-2.0
"""Contains main Neogit class"""
import logging
import time
from datetime import datetime
from functools import wraps
from pathlib import Path
from typing import Any, Dict, Iterator, List, Optional
from neo4j import GraphDatabase, Transaction,... | OSWatcher/neogit | neogit/service/neogit.py | .py | d2614e45541a1ecd | 7.42 | 6 |
"""A skeleton of a command line interface to be deployed as an entry point script.
It takes two numbers and does something to them, printing out the result.
"""
import argparse
import logging
import sys
from cheshire.dummy import do_something
# This is the module-level logger, for any logs
logger = logging.getLogg... | catalyst-cooperative/cheshire | src/cheshire/cli.py | .py | 84a9fffdf7f992e7 | 7.42 | 6 |
"""PyTest configuration module. Defines useful fixtures, command line args."""
import logging
from pathlib import Path
import pytest
logger = logging.getLogger(__name__)
def pytest_addoption(parser: pytest.Parser) -> None:
"""Add package-specific command line options to pytest.
This is slightly magical --... | catalyst-cooperative/cheshire | tests/conftest.py | .py | 57bf4b25a563c5e3 | 7.92 | 6 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.