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 |
|---|---|---|---|---|---|---|
"""The demo map and the lifecycle of the layers drawn on it."""
import solara
from component.parameter import AOI_LAYER_IDS
from pysepal import mapping as sm
def use_sepal_map(gee_interface, theme_state) -> sm.SepalMap:
"""Return the map, rebuilt only when the session's GEE interface changes."""
def build_... | openforis/pysepal | demo_apps/solara_map_app/component/widget/map.py | .py | 43791dcf7232b7c2 | 7.57 | 13 |
"""Local raster rendering: continuous ramps, categorical class colors, big files.
Three buttons, one per path through :meth:`~pysepal.mapping.SepalMap.add_raster`:
a continuous colormap, exact per-class colors, and a raster large enough that
preparing it has to happen off the event loop.
Set ``PYSEPAL_DEMO_RASTER_DIR... | openforis/pysepal | demo_apps/solara_raster_app/app.py | .py | deef1d2baeb3bfa4 | 7.57 | 13 |
"""Vector tiles from a local file: convert once, then style the archive.
Two buttons over one PMTiles archive built by ``vectortileserver``: a single
symbol, and one deterministic color per attribute value. The conversion runs
once and is cached by the workspace, so the second button restyles the same
archive rather t... | openforis/pysepal | demo_apps/solara_vector_app/app.py | .py | 8eb4b4c9d4d43f81 | 7.57 | 13 |
"""Rest directive to create line breaks."""
from docutils import nodes
from docutils.parsers.rst import Directive, directives
class LineBreak(Directive):
"""ReST directive for creating line break in your documentation when needed.
The directive does note require any argument.
Example:
.. line-brea... | openforis/pysepal | docs/source/_extentions/line_break.py | .py | e20736065f173208 | 7.57 | 13 |
import os
import sys
from docutils import ApplicationError
def process_file(file_path):
"""Process a single .rst file, checking for validity and fixing whitespace."""
try:
with open(file_path, "r") as f:
content = f.read()
# publish_string(source=content, writer_name="null") ... | openforis/pysepal | docs/source/_script/lint_trailing.py | .py | 5395db534cb10fe5 | 7.57 | 13 |
"""All the process that can be run using nox.
The nox run are build in isolated environment that will be stored in .nox. to force the venv update, remove the .nox/xxx folder.
"""
import nox
nox.options.sessions = ["lint", "test", "docs"]
@nox.session(reuse_venv=True)
def lint(session):
"""Apply the pre-commits... | openforis/pysepal | noxfile.py | .py | f1cb4de092b94153 | 7.57 | 13 |
"""sepal-ui ``Tile`` object tuned for AOI selection."""
from pathlib import Path
from typing import List, Optional, Union
import ipyvuetify as v
from eeclient.client import EESession
from pysepal import mapping as sm
from pysepal import sepalwidgets as sw
from pysepal.aoi.aoi_view import AoiView
from pysepal.message... | openforis/pysepal | pysepal/aoi/aoi_tile.py | .py | 970dd396565c4640 | 7.57 | 13 |
#!/usr/bin/python3
"""Script to create an automatic overwrite of all the object in ipyvuetify.
We want to add SepalWidgets to the list of parent class.
This script should be run only by maintainer when changes are made to ipyvuetify itself. Please report to the issue tracker if any class is not available.
"""
import... | openforis/pysepal | pysepal/bin/sepal_ipyvuetify.py | .py | d803ece71a4eb67e | 7.57 | 13 |
"""ResizeTrigger is an essential object of sepal-ui.
It guarantees that the maps displayed in the application are always resized when you change the view. Without it moving from one panel to another would make some of the map tile invisible.
"""
from pathlib import Path
import ipyvuetify as v
from IPython.display im... | openforis/pysepal | pysepal/frontend/resize_trigger.py | .py | 5f9289b9878e40f2 | 7.57 | 13 |
"""Widget control providing zoom options for the end user."""
from typing import Optional, Union
import ee
import ipyvuetify as v
from ipyleaflet import Map
from shapely import geometry as sg
from pysepal import sepalwidgets as sw
from pysepal.mapping.menu_control import MenuControl
from pysepal.scripts import decor... | openforis/pysepal | pysepal/mapping/aoi_control.py | .py | eb61a5985337b387 | 7.57 | 13 |
"""Module to load basemaps from different providers."""
from typing import Optional
from box import Box
from ipyleaflet import TileLayer
from xyzservices import TileProvider
from xyzservices import providers as xyz
xyz_tiles: dict = {
"OpenStreetMap": {
"url": "https://{s}.tile.openstreetmap.org/{z}/{x}/... | openforis/pysepal | pysepal/mapping/basemaps.py | .py | a4975b2f18da77ce | 7.57 | 13 |
"""Auxiliary functions for computing map bounds and zoom levels."""
import math
from pyproj import Transformer
def compute_center(bounds):
"""Given [[south, west], [north, east]], return (lat, lon) center."""
(south, west), (north, east) = bounds
return ((south + north) / 2, (west + east) / 2)
_MERCAT... | openforis/pysepal | pysepal/mapping/bounds.py | .py | ae9af714a9f9d8b0 | 7.57 | 13 |
# -*- coding: utf-8 -*-
# Copyright 2023, CS GROUP - France, https://www.csgroup.eu/
#
# This file is part of EODAG project
# https://www.github.com/CS-SI/EODAG
#
# 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 c... | CS-SI/eodag-cube | eodag_cube/api/product/_assets.py | .py | 479481ebf10c16d5 | 7.63 | 17 |
# -*- coding: utf-8 -*-
# Copyright 2024, CS GROUP - France, http://www.c-s.fr
#
# This file is part of EODAG project
# https://www.github.com/CS-SI/EODAG
#
# 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... | CS-SI/eodag-cube | eodag_cube/types/__init__.py | .py | bf721ad2863fc0cb | 7.63 | 17 |
# -*- coding: utf-8 -*-
# Copyright 2021, CS GROUP - France, http://www.c-s.fr
#
# This file is part of EODAG project
# https://www.github.com/CS-SI/EODAG
#
# 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... | CS-SI/eodag-cube | eodag_cube/utils/__init__.py | .py | 718f2a85292932c0 | 7.63 | 17 |
# -*- coding: utf-8 -*-
# Copyright 2026, CS GROUP - France, http://www.c-s.fr
#
# This file is part of EODAG project
# https://www.github.com/CS-SI/EODAG
#
# 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... | CS-SI/eodag-cube | eodag_cube/utils/metadata.py | .py | cecb94f9750fd1c0 | 7.63 | 17 |
# -*- coding: utf-8 -*-
# Copyright 2024, CS GROUP - France, http://www.c-s.fr
#
# This file is part of EODAG project
# https://www.github.com/CS-SI/EODAG
#
# 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... | CS-SI/eodag-cube | eodag_cube/utils/xarray.py | .py | 6fbad830d9e78c21 | 7.63 | 17 |
# -*- coding: utf-8 -*-
# Copyright 2021, CS GROUP - France, http://www.c-s.fr
#
# This file is part of EODAG project
# https://www.github.com/CS-SI/EODAG
#
# 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... | CS-SI/eodag-cube | tests/__init__.py | .py | e1a98a58065dae26 | 8.13 | 17 |
from unittest import mock
import numpy as np
import xarray as xr
from eodag_cube.types import XarrayDict
from tests import EODagTestCase
from tests.context import EOProduct
class TestEOProductAugmentFromXarray(EODagTestCase):
def _make_dataset(self, with_band_data=True):
data_vars = {
"latit... | CS-SI/eodag-cube | tests/integration/test_eoproduct_augment_from_xarray.py | .py | c8853b18c4f82f57 | 8.13 | 17 |
# -*- coding: utf-8 -*-
# Copyright 2024, CS GROUP - France, http://www.c-s.fr
#
# This file is part of EODAG project
# https://www.github.com/CS-SI/EODAG
#
# 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... | CS-SI/eodag-cube | tests/integration/test_eoproduct_xarray.py | .py | 925ebf0ae1de2ed2 | 8.13 | 17 |
# -*- coding: utf-8 -*-
# Copyright 2026, CS GROUP - France, https://www.csgroup.eu/
#
# This file is part of EODAG project
# https://www.github.com/CS-SI/EODAG
#
# 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 c... | CS-SI/eodag-cube | tests/test_benchmark.py | .py | 680395384c78186f | 8.13 | 17 |
# -*- coding: utf-8 -*-
# Copyright 2021, CS GROUP - France, http://www.c-s.fr
#
# This file is part of EODAG project
# https://www.github.com/CS-SI/EODAG
#
# 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... | CS-SI/eodag-cube | tests/units/test_eoproduct.py | .py | f902fd21fd4ee3f0 | 8.13 | 17 |
# -*- coding: utf-8 -*-
# Copyright 2021, CS GROUP - France, http://www.c-s.fr
#
# This file is part of EODAG project
# https://www.github.com/CS-SI/EODAG
#
# 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... | CS-SI/eodag-cube | tests/utils.py | .py | d10eaf0fe9b43552 | 8.13 | 17 |
# -*- coding: utf8 -*-
from elasticsearch import Elasticsearch
from django.forms.models import model_to_dict
import json
from datetime import timedelta
class ElasticsearchLongQuery:
"""应对需要大量数据导出处理
使用参考:
taskSetting = PlTaskSetting.objects.get(id=9)
fakeRequestTaskSetting = FakeRequest(taskSet... | az13js/pl-log-notic | pladmin/pltplconf/management/commands/Collectors/ElasticsearchLongQuery.py | .py | e10275f2901f3e5b | 7.48 | 8 |
# -*- coding: utf8 -*-
from elasticsearch import Elasticsearch
import json
import datetime
from string import Template
from django.conf import settings
import logging
logger = logging.getLogger(__name__)
class MLSystemAnalysis():
def findErrorLogs(self, queryCommand, querySize = 1):
"""find方法返回字符串,字符串内容... | az13js/pl-log-notic | pladmin/pltplconf/management/commands/Collectors/MLSystemAnalysis.py | .py | dfb9fd8f00288c48 | 7.48 | 8 |
# -*- coding: utf8 -*-
"""示例用
在Linux系统中命令行方式使用代理服务,方式是设置环境变量:
http_poxy="http://user:password@www.example.cn:1000"
https_poxy="http://user:password@www.example.cn:1000"
"""
from elasticsearch import Elasticsearch
import json
import time
from string import Template
from django.conf import settings
import logging
logge... | az13js/pl-log-notic | pladmin/pltplconf/management/commands/Collectors/OrderSystemCommonAnalysis.py | .py | 97b9c8599bfa0242 | 7.48 | 8 |
# -*- coding: utf8 -*-
from elasticsearch import Elasticsearch
import json
import time
from string import Template
from django.conf import settings
import logging
logger = logging.getLogger(__name__)
class OrderSystemErrorAnalysis():
def findErrorLogs(self, job):
"""find方法返回字符串,字符串内容是查询的消息文本"""
... | az13js/pl-log-notic | pladmin/pltplconf/management/commands/Collectors/OrderSystemErrorAnalysis.py | .py | 6862d70c556bf592 | 7.48 | 8 |
# -*- coding: utf8 -*-
"""示例用
在Linux系统中命令行方式使用代理服务,方式是设置环境变量:
http_poxy="http://user:password@www.example.cn:1000"
https_poxy="http://user:password@www.example.cn:1000"
"""
import json
import time
import logging
from datetime import timedelta, datetime, timezone
from pltplconf import api
from django.forms.models impor... | az13js/pl-log-notic | pladmin/pltplconf/management/commands/Collectors/TaskAnalysis.py | .py | a76d146605df4612 | 7.48 | 8 |
# -*- coding: utf8 -*-
from elasticsearch import Elasticsearch
import json
import time
from string import Template
from django.conf import settings
import logging
logger = logging.getLogger(__name__)
class XLogSystemQuery():
def findLogs(self, queryCommand, querySize = 1):
"""find方法返回字符串,字符串内容是查询的消息文本""... | az13js/pl-log-notic | pladmin/pltplconf/management/commands/Collectors/XLogSystemQuery.py | .py | 8050277b6cbad9a0 | 7.48 | 8 |
# -*- coding: utf8 -*-
"""示例用
"""
import logging
import requests
from django.conf import settings
import json
logger = logging.getLogger(__name__)
class MLBot():
def send(self, job, params):
logger.debug("MLBot 向企业微信群发送消息")
messageText = "【" + params["job_name"] + "】\nHi,查询到 " + str(params["total... | az13js/pl-log-notic | pladmin/pltplconf/management/commands/Messagers/MLBot.py | .py | 1bffee79f3990469 | 7.48 | 8 |
# -*- coding: utf8 -*-
"""示例用
"""
import logging
import requests
from django.utils import timezone
from datetime import timedelta
from pltplconf.models import PlPushLog
logger = logging.getLogger(__name__)
class WXBot():
def send(self, job, message):
taskSetting = job.task_setting
# 没达到推送频率限制的可以推... | az13js/pl-log-notic | pladmin/pltplconf/management/commands/Messagers/WXBot.py | .py | af4447b7a9a23ae1 | 7.48 | 8 |
# -*- coding: utf8 -*-
"""示例用
"""
import logging
import requests
from django.conf import settings
import json
logger = logging.getLogger(__name__)
class WxTeam():
def send(self, job, params):
logger.debug("向企业微信群发送消息")
if 0 == params["fail"]:
messageText = "【" + params["job_name"] + "... | az13js/pl-log-notic | pladmin/pltplconf/management/commands/Messagers/WxTeam.py | .py | 9e21e3585c37590b | 7.48 | 8 |
# -*- coding: utf8 -*-
"""示例用
"""
import logging
import requests
from django.conf import settings
import json
logger = logging.getLogger(__name__)
class WxTeamErrorLog():
def send(self, job, params):
logger.debug("WxTeamErrorLog向企业微信群发送消息")
messageText = "【" + params["job_name"] + "】\nHi,查询到 " + ... | az13js/pl-log-notic | pladmin/pltplconf/management/commands/Messagers/WxTeamErrorLog.py | .py | cb3fb64b20e67c81 | 7.48 | 8 |
# -*- coding: utf8 -*-
"""示例用
"""
import logging
import requests
from django.conf import settings
import json
from string import Template
logger = logging.getLogger(__name__)
class WxTeamTime():
def send(self, job, params):
logger.debug("向企业微信群发送消息")
messageText = """
【${job_name}】
Hi,请求时间统计信息如下:... | az13js/pl-log-notic | pladmin/pltplconf/management/commands/Messagers/WxTeamTime.py | .py | 92275f788d1d82f1 | 7.48 | 8 |
# -*- coding: utf8 -*-
"""示例用
"""
import logging
import requests
from django.conf import settings
import json
logger = logging.getLogger(__name__)
class WxTeamXLog():
def send(self, job, params):
logger.debug("WxTeamXLog向企业微信群发送消息")
messageText = "【" + params["job_name"] + "】\nHi,查询到 " + str(para... | az13js/pl-log-notic | pladmin/pltplconf/management/commands/Messagers/WxTeamXLog.py | .py | 2e74a7639af33123 | 7.48 | 8 |
# -*- coding: utf8 -*-
import json
import logging
logger = logging.getLogger(__name__)
class ErrorFormate():
# 分析规则
rules = [
{"start": "[msg] => ","end": "\n"}
]
def parse(self, contents):
"""分析ES搜索到的记录,返回所需的信息"""
results = json.loads(contents)
errorMessages = []
... | az13js/pl-log-notic | pladmin/pltplconf/management/commands/Parsers/ErrorFormate.py | .py | ecf99b37bea29723 | 7.48 | 8 |
# -*- coding: utf8 -*-
import json
import logging
logger = logging.getLogger(__name__)
class MLFormate():
# 分析规则
rules = [
{"start": "[msg] => ","end": "\n"}
]
def parse(self, contents):
"""分析ES搜索到的记录,返回所需的信息"""
results = json.loads(contents)
errorMessages = []
... | az13js/pl-log-notic | pladmin/pltplconf/management/commands/Parsers/MLFormate.py | .py | 5dbf4dd38c1fb87c | 7.48 | 8 |
# -*- coding: utf8 -*-
import json
import logging
logger = logging.getLogger(__name__)
class XLogFormate():
# 分析规则
rules = [
{"end": "\n"}
]
def parse(self, contents):
"""分析ES搜索到的记录,返回所需的信息"""
results = json.loads(contents)
errorMessages = []
total = 0
... | az13js/pl-log-notic | pladmin/pltplconf/management/commands/Parsers/XLogFormate.py | .py | 810aa4e07edc9f13 | 7.48 | 8 |
# -*- coding: utf8 -*-
import os
import time
import uuid
import json
import shutil
import random
import logging
import requests
import subprocess
from datetime import datetime
from django.conf import settings
from elasticsearch.exceptions import NotFoundError
from django.core.management.base import BaseCommand
from pl... | az13js/pl-log-notic | pladmin/pltplconf/management/commands/export_worker.py | .py | e4d5521d2aa2610c | 7.48 | 8 |
# -*- coding: utf8 -*-
import redis
from django.core.management.base import BaseCommand, CommandError
from django.db.utils import OperationalError, InterfaceError
from pltplconf.models import Pljob
from django.utils import timezone
from datetime import timedelta
import time
from django.conf import settings
import impo... | az13js/pl-log-notic | pladmin/pltplconf/management/commands/scheduler.py | .py | 4470c228f5928f5f | 7.48 | 8 |
#!/usr/bin/env python3
"""
Check that preprocessing output files exist (and are non-empty) for every
sample subfolder in a run folder.
Expected output files per sample <SAMPLE>/ subfolder:
<SAMPLE>_R1.fastq.bz2
<SAMPLE>_R2.fastq.bz2
<SAMPLE>_UN.fastq.bz2
<SAMPLE>_summary.stats
A sample is marked as F... | SegataLab/preprocessing | preprocessing/check_preproc.py | .py | efb3bb64b9a968ad | 7.6 | 15 |
#!/usr/bin/env python3
"""
circleci_pack.py
~~~~~~~~~~~~~~~~
A *pre-commit* hook that runs `circleci config pack` on a source directory
to pack modular CircleCI configuration files.
Exit code:
* 0 - pack successful
* 1 - pack failed
"""
from __future__ import annotations
import argparse
import os
import shuti... | zahorniak/pre-commit-circleci | circleci_pack.py | .py | 26d700cf01269698 | 7.5 | 9 |
#!/usr/bin/env python3
"""
circleci_pack_validate.py
~~~~~~~~~~~~~~~~~~~~~~~~~
A *pre-commit* hook that packs and validates CircleCI dynamic configuration.
Handles projects using continuation orb with modular src/ directory.
Exit code:
* 0 - all validations passed
* 1 - at least one validation failed
"""
from ... | zahorniak/pre-commit-circleci | circleci_pack_validate.py | .py | bd10306af39a85db | 7.5 | 9 |
#!/usr/bin/env python3
"""
circleci_process.py
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
A *pre-commit* hook that runs `circleci config process` on one or more
CircleCI configuration files.
Exit code:
* 0 - all configs processed successfully
* 1+ - at least one config failed
"""
from __future__ import annotations
import ar... | zahorniak/pre-commit-circleci | circleci_process.py | .py | 701f58dd77d70e62 | 7.5 | 9 |
"""Shared pytest fixtures for pre-commit-circleci tests."""
from __future__ import annotations
import os
from pathlib import Path
from typing import Generator
from unittest.mock import MagicMock, patch
import pytest
@pytest.fixture
def fixtures_dir() -> Path:
"""Return path to test fixtures directory."""
r... | zahorniak/pre-commit-circleci | tests/conftest.py | .py | 20c8834b092c9c1a | 7 | 9 |
"""Tests for circleci_pack.py hook."""
from __future__ import annotations
import tempfile
from pathlib import Path
from unittest.mock import MagicMock, patch
import pytest
import circleci_pack
class TestParseArgs:
"""Tests for the parse_args() function."""
def test_requires_src_dir(self) -> None:
... | zahorniak/pre-commit-circleci | tests/test_pack.py | .py | e5c15b705bf43ba9 | 7 | 9 |
"""Tests for circleci_pack_validate.py hook."""
from __future__ import annotations
import os
from pathlib import Path
from unittest.mock import MagicMock, patch
import pytest
import circleci_pack_validate
class TestValidateConfig:
"""Tests for the validate_config() function."""
def test_runs_validate_com... | zahorniak/pre-commit-circleci | tests/test_pack_validate.py | .py | 6cbafe96ed7dfe8b | 7 | 9 |
"""Tests for circleci_process.py hook."""
from __future__ import annotations
from pathlib import Path
from unittest.mock import MagicMock, patch
import pytest
import circleci_process
class TestRunProcess:
"""Tests for the run_process() function."""
def test_runs_process_command(
self,
moc... | zahorniak/pre-commit-circleci | tests/test_process.py | .py | 03481f20f65f7c3d | 7 | 9 |
"""Tests for circleci_validate.py hook."""
from __future__ import annotations
import subprocess
from pathlib import Path
from unittest.mock import MagicMock, patch
import pytest
import circleci_validate
class TestMain:
"""Tests for the main() function."""
def test_skips_in_circleci_environment(
s... | zahorniak/pre-commit-circleci | tests/test_validate.py | .py | 8b608f9f2542da60 | 7 | 9 |
# -*- coding: utf-8 -*-
"""Utility functions for project operations"""
import csv
from typing import Dict, List, Any
from urllib.parse import urlparse
from ..constants import PARAM_SPLITTER
def load_file_list(filename: str, encoding: str = "utf8") -> List[str]:
"""Reads file and returns list of strings as list""... | ruarxive/apibackuper | apibackuper/cmds/utils.py | .py | b385dced148d1744 | 7.63 | 17 |
from zipfile import ZipFile, ZIP_DEFLATED
import os
from .backends import (
StorageBackend,
ZipStorageBackend,
SqliteStorageBackend,
build_storage_backend,
)
class FileStorage:
"""Base file storage class"""
def __init__(self):
"""Initialize base file storage"""
def exists(self, ... | ruarxive/apibackuper | apibackuper/storage/__init__.py | .py | 0aeb26127ea2074d | 7.63 | 17 |
"""Shared fixtures and test utilities"""
import os
import tempfile
import shutil
from typing import Generator
import pytest
import configparser
from unittest.mock import Mock, MagicMock
@pytest.fixture
def temp_dir() -> Generator[str, None, None]:
"""Create a temporary directory for tests"""
temp_path = tempf... | ruarxive/apibackuper | tests/conftest.py | .py | 5be1aea748855083 | 8.13 | 17 |
"""Tests for authentication handler"""
import os
import base64
import tempfile
import pytest
import configparser
from unittest.mock import Mock, patch
from apibackuper.auth import AuthHandler
class TestAuthHandler:
"""Tests for AuthHandler class"""
def test_init_no_auth_section(self):
"""Test ini... | ruarxive/apibackuper | tests/test_auth.py | .py | b1b5e3874bdc484f | 7.13 | 17 |
"""Tests for common utility functions"""
import pytest
import lxml.etree as etree
from apibackuper.common import (
etree_to_dict,
get_dict_value,
set_dict_value,
update_dict_values
)
class TestEtreeToDict:
"""Tests for etree_to_dict function"""
def test_simple_xml(self):
"""Test c... | ruarxive/apibackuper | tests/test_common.py | .py | aeb1c59579412a5c | 8.13 | 17 |
"""Tests for config loader"""
import os
import json
import pytest
import configparser
from unittest.mock import patch, mock_open
from apibackuper.cmds.config_loader import (
load_json_file,
load_schema,
validate_yaml_config,
YAMLConfigParser
)
class TestLoadJsonFile:
"""Tests for load_json_file fu... | ruarxive/apibackuper | tests/test_config_loader.py | .py | a75e9513a5de140b | 7.13 | 17 |
"""Tests for core CLI commands"""
import os
import json
import pytest
from unittest.mock import Mock, patch, MagicMock
import typer.testing
from apibackuper.core import app, enable_verbose
class TestCLICommands:
"""Tests for CLI commands"""
def test_enable_verbose(self):
"""Test enabling verbose ... | ruarxive/apibackuper | tests/test_core.py | .py | 045b8b3394b11c87 | 7.13 | 17 |
"""Tests for ProjectBuilder"""
import os
import pytest
from unittest.mock import Mock, patch, MagicMock
from apibackuper.cmds.project import ProjectBuilder
class TestProjectBuilder:
"""Tests for ProjectBuilder class"""
def test_init_with_ini_config(self, sample_config_ini):
"""Test initializing w... | ruarxive/apibackuper | tests/test_project.py | .py | 400559d64d0e313e | 7.13 | 17 |
"""Tests for rate limiter"""
import time
import pytest
from unittest.mock import patch
from apibackuper.rate_limiter import RateLimiter
class TestRateLimiter:
"""Tests for RateLimiter class"""
def test_init_no_limits(self):
"""Test initializing without limits"""
limiter = RateLimiter()
... | ruarxive/apibackuper | tests/test_rate_limiter.py | .py | 380b6ae6b1ce7193 | 7.13 | 17 |
"""Tests for storage classes"""
import os
import tempfile
import zipfile
import pytest
from apibackuper.storage import (
FileStorage,
ZipFileStorage,
FilesystemStorage,
ZipStorageBackend,
SqliteStorageBackend,
build_storage_backend,
)
class TestFileStorage:
"""Tests for base FileStorage cl... | ruarxive/apibackuper | tests/test_storage.py | .py | 8a4247aa2b7f1f48 | 7.13 | 17 |
"""Tests for utility functions"""
import os
import pytest
from apibackuper.cmds.utils import load_file_list, load_csv_data, _url_replacer
class TestLoadFileList:
"""Tests for load_file_list function"""
def test_load_file_list(self, temp_dir):
"""Test loading file as list of lines"""
file_... | ruarxive/apibackuper | tests/test_utils.py | .py | 8c089cd47ea0ca27 | 7.13 | 17 |
from core_lib.connection.connection import Connection
from elasticsearch import Elasticsearch
class ElasticSearchConnection(Connection):
def __init__(self, elastic_search_client: Elasticsearch):
self.elastic_search_client = elastic_search_client
def __enter__(self) -> Elasticsearch:
... | shay-te/core-lib | core_lib/connection/elasticsearch_connection.py | .py | a3ce80c7c712bce9 | 7.45 | 7 |
#!/usr/bin/env python3
# Copyright 2016, 2017 IBM Corp.
#
# 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... | tessia-project/tessia | cli/setup.py | .py | ce13c3fe5fd4f65f | 7.42 | 6 |
# Copyright 2016, 2017 IBM Corp.
#
# 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 writin... | tessia-project/tessia | cli/tessia/cli/client.py | .py | 10b185d6759df1ac | 7.42 | 6 |
# Copyright 2016, 2017 IBM Corp.
#
# 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 writin... | tessia-project/tessia | cli/tessia/cli/cmds/__init__.py | .py | a8d0098caab60a33 | 7.42 | 6 |
# Copyright 2017 IBM Corp.
#
# 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 writing, sof... | tessia-project/tessia | cli/tessia/cli/cmds/autotemplate.py | .py | 771e0d1621903288 | 7.42 | 6 |
# Copyright 2016, 2017 IBM Corp.
#
# 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 writin... | tessia-project/tessia | cli/tessia/cli/cmds/conf.py | .py | 7c7845a73524e580 | 7.42 | 6 |
# Copyright 2017 IBM Corp.
#
# 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 writing, sof... | tessia-project/tessia | cli/tessia/cli/cmds/job/job.py | .py | abb655047323454e | 7.42 | 6 |
# Copyright 2021 IBM Corp.
#
# 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 writing, sof... | tessia-project/tessia | cli/tessia/cli/cmds/monitoring/hmc.py | .py | 88b10d9e4bb2a524 | 7.42 | 6 |
# Copyright 2016, 2017 IBM Corp.
#
# 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 writin... | tessia-project/tessia | cli/tessia/cli/cmds/net/ip.py | .py | 53e2d38da225aa7d | 7.42 | 6 |
# Copyright 2016, 2017, 2018 IBM Corp.
#
# 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 ... | tessia-project/tessia | cli/tessia/cli/cmds/net/subnet.py | .py | 31e63e65c8feddb0 | 7.42 | 6 |
# Copyright 2016, 2017 IBM Corp.
#
# 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 writin... | tessia-project/tessia | cli/tessia/cli/cmds/net/zone.py | .py | be046b3a38814194 | 7.42 | 6 |
# Copyright 2018 IBM Corp.
#
# 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 writing, sof... | tessia-project/tessia | cli/tessia/cli/cmds/os.py | .py | 46a618b18725c81f | 7.42 | 6 |
# Copyright 2017 IBM Corp.
#
# 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 writing, sof... | tessia-project/tessia | cli/tessia/cli/cmds/perm/project.py | .py | a601d113810c7d1d | 7.42 | 6 |
# Copyright 2017 IBM Corp.
#
# 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 writing, sof... | tessia-project/tessia | cli/tessia/cli/cmds/perm/role.py | .py | cc14b5e5274aca54 | 7.42 | 6 |
# Copyright 2016, 2017 IBM Corp.
#
# 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 writin... | tessia-project/tessia | cli/tessia/cli/cmds/perm/user.py | .py | af6cb82687145910 | 7.42 | 6 |
# Copyright 2017 IBM Corp.
#
# 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 writing, sof... | tessia-project/tessia | cli/tessia/cli/cmds/repo.py | .py | f5f40c88cbf07eaa | 7.42 | 6 |
# Copyright 2016, 2017 IBM Corp.
#
# 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 writin... | tessia-project/tessia | cli/tessia/cli/cmds/storage/server.py | .py | b19eaa1b876ba8dc | 7.42 | 6 |
# Copyright 2016, 2017 IBM Corp.
#
# 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 writin... | tessia-project/tessia | cli/tessia/cli/cmds/system/model.py | .py | 1986fe3f18e48d4b | 7.42 | 6 |
# Copyright 2016, 2017 IBM Corp.
#
# 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 writin... | tessia-project/tessia | cli/tessia/cli/cmds/system/vol.py | .py | 2b0b6c6c255858fc | 7.42 | 6 |
# Copyright 2016, 2017 IBM Corp.
#
# 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 writin... | tessia-project/tessia | cli/tessia/cli/output.py | .py | ce1b95322716f491 | 7.42 | 6 |
# Copyright 2018 IBM Corp.
#
# 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 writing, sof... | tessia-project/tessia | cli/tessia/cli/secutils.py | .py | fd51243a7a8d7080 | 7.42 | 6 |
# Copyright 2016, 2017 IBM Corp.
#
# 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 writin... | tessia-project/tessia | cli/tessia/cli/utils.py | .py | b1b43481a81aa083 | 7.42 | 6 |
# Copyright 2021 IBM Corp.
#
# 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 writing, sof... | tessia-project/tessia | mesh_components/task_runner/api/flask_app.py | .py | fc29096310a24ba4 | 7.42 | 6 |
"""
SCRIPT TO WRITE DESMOND CMS FILES
FROM BOSS ZMATRIX
Created on Mon Nov 26 15:40:05 2017
@author: Leela S. Dodda leela.dodda@yale.edu
@author: William L. Jorgensen Lab
Usage: python OPM_Routines.py -z phenol.z -r PHN
REQUIREMENTS:
BOSS (need to set BOSSdir in bashrc and cshrc)
Preferably Anaconda python with foll... | leelasd/LigParGen_2.3 | LigParGen/BOSS2DESMOND.py | .py | c540e640cd12e6de | 7.59 | 14 |
"""
SCRIPT TO WRITE DESMOND CMS FILES
FROM BOSS ZMATRIX
Created on Mon Nov 26 15:40:05 2017
@author: Leela S. Dodda leela.dodda@yale.edu
@author: William L. Jorgensen Lab
Usage: python OPM_Routines.py -z phenol.z -r PHN
REQUIREMENTS:
BOSS (need to set BOSSdir in bashrc and cshrc)
Preferably Anaconda python with foll... | leelasd/LigParGen_2.3 | LigParGen/LocalVersion/BOSS2DESMOND.py | .py | 8ab65c5333719549 | 7.59 | 14 |
import math
import numpy as np
def bossElement2Num(elem):
symb2mass = {
'H': 1,
'B': 5,
'C': 6,
'N': 7,
'O': 8,
'F': 9,
'Si': 14,
'P': 15,
'S': 16,
'Cl': 17,
'Br': 35,
'I': 53,
}
try:
res = symb2m... | leelasd/LigParGen_2.3 | LigParGen/LocalVersion/Vector_algebra.py | .py | 0232f37daa53bb01 | 7.59 | 14 |
"""
Shared, bug-fixed helpers used by every BOSS2*.py converter.
This module exists to de-duplicate two pieces of logic that used to be
copy-pasted, with subtly diverging bugs, into each of the 8 BOSS2*.py
converters (BOSS2OPENMM, BOSS2GMX, BOSS2CHARMM, BOSS2LAMMPS, BOSS2TINKER,
BOSS2XPLOR, BOSS2Q, BOSS2DESMOND):
1. ... | leelasd/LigParGen_2.3 | LigParGen/boss_common.py | .py | b00a56a3c6f76181 | 7.59 | 14 |
# THIS IS THE HEART OF BCC CORRECTION METHODOLOGY
# THIS MODULE DOES THE BCC ASSIGNMENT BY COLLECTING
# BONDING INFO AND ASSIGNING BCC CORRECTIONS FOR ATOMS
import numpy as np
import pandas as pd
import openbabel
from rdkit import Chem
from rdkit.Chem import AllChem
def convert_pdb2mol(pdbfile):
print('Converting ... | leelasd/LigParGen_2.3 | LigParGen/mol_boss.py | .py | d7d7f2b4e496c8ba | 7.59 | 14 |
"""Shared fixture-loading helpers for the BOSSReader parsing-method test
layer (issue #23, parent map #19).
The whole point of this test layer is that it needs no Docker/BOSS/license
to run: every fixture under tests/fixtures/<name>/boss/{out,sum} is BOSS's
own captured, real output text, checked into the repo, and
BO... | leelasd/LigParGen_2.3 | tests/conftest.py | .py | afeb5260a16bc597 | 8.09 | 14 |
"""Basic chapter class"""
class Chapter:
"""Chapter class"""
def __init__(self, title, url) -> None:
self.title = title
self.url = url
def __repr__(self) -> str:
return repr((self.url, self.title))
def __eq__(self, other) -> bool:
if isinstance(other, Chapter):
... | nonjosh/acgn-bot | helpers/chapter.py | .py | e838b2bf5276b818 | 7.42 | 6 |
"""Checker for asurascans.com comic pages."""
from typing import List
from urllib.parse import urljoin
from helpers.chapter import Chapter
from helpers.checkers.base import AbstractChapterChecker
class AsurascansChecker(AbstractChapterChecker):
"""Asurascans checker
Expects a comic page URL like:
h... | nonjosh/acgn-bot | helpers/checkers/asurascans.py | .py | 6ea86aabbceed037 | 7.42 | 6 |
from typing import List
from urllib.parse import urlparse, urlunparse
from bs4.element import Tag
from chinese_converter import to_simplified
from helpers.chapter import Chapter
from helpers.checkers.base import AbstractChapterChecker
class BaozimhChecker(AbstractChapterChecker):
"""Baozimh checker"""
URL_... | nonjosh/acgn-bot | helpers/checkers/baozimh.py | .py | aa6fb64fdf5150ae | 7.42 | 6 |
import time
from typing import List
from chinese_converter import to_traditional
from helpers.chapter import Chapter
from helpers.checkers.base import AbstractChapterChecker
class Baozimh2Checker(AbstractChapterChecker):
"""baozimh.org checker
sample API: https://api-get-v3.mgsearcher.com/api/manga/get?mid=... | nonjosh/acgn-bot | helpers/checkers/baozimh2.py | .py | 241bb9d106c87b56 | 7.42 | 6 |
import json
import time
from abc import ABC, abstractmethod
from typing import List
import backoff
import requests
from bs4 import BeautifulSoup
from helpers.chapter import Chapter
from helpers.utils import (
DEFAULT_HEADERS,
DEFAULT_REQUEST_TIMEOUT,
get_chapter_list_diff,
get_logger,
)
logger = get_... | nonjosh/acgn-bot | helpers/checkers/base.py | .py | 820d0357b96edef0 | 7.42 | 6 |
"""Checker for Bilibili readlist (专栏文集) pages.
Example readlist URL:
https://www.bilibili.com/read/readlist/rl812409
API used:
https://api.bilibili.com/x/article/list/web/articles?id=812409
Chapter URL is constructed from `dyn_id_str`:
https://www.bilibili.com/opus/<dyn_id_str>
"""
import re
from typing... | nonjosh/acgn-bot | helpers/checkers/bilibili_articles.py | .py | 27513750af8d43f5 | 7.42 | 6 |
from typing import List
from urllib.parse import urlparse, urlunparse
from chinese_converter import to_traditional
from helpers.chapter import Chapter
from helpers.checkers.base import AbstractChapterChecker
class BiquChecker(AbstractChapterChecker):
"""Biqu checker"""
URL_SUBSTRING = "m.biqu520.net"
... | nonjosh/acgn-bot | helpers/checkers/biqu.py | .py | 41c997d50d866bad | 7.42 | 6 |
from typing import List
from bs4.element import Tag
from helpers.chapter import Chapter
from helpers.checkers.base import AbstractChapterChecker
class DashumanhuaChecker(AbstractChapterChecker):
"""Dashumanhua checker"""
URL_SUBSTRING = "dashumanhua"
def get_latest_chapter_list(self) -> List[Chapter]:... | nonjosh/acgn-bot | helpers/checkers/dashuhuwai.py | .py | ac127c32a251a480 | 7.42 | 6 |
from typing import List
from bs4.element import ResultSet, Tag
from helpers.chapter import Chapter
from helpers.checkers.base import AbstractChapterChecker
class JmangaChecker(AbstractChapterChecker):
"""Kunmanga checker"""
URL_SUBSTRING = "jmanga"
def get_latest_chapter_list(self) -> List[Chapter]:
... | nonjosh/acgn-bot | helpers/checkers/jmanga.py | .py | 4bca77a75ea1d931 | 7.42 | 6 |
from typing import List, Optional
from urllib.parse import urlparse, urlunparse
from bs4 import BeautifulSoup
from bs4.element import Tag
from helpers.chapter import Chapter
from helpers.checkers.base import AbstractChapterChecker
class KakuyomuChecker(AbstractChapterChecker):
"""Kakuyomu checker.
Supports... | nonjosh/acgn-bot | helpers/checkers/kakuyomu.py | .py | 1725aa8a7c8c8bee | 7.42 | 6 |
from typing import List
from urllib.parse import urlparse, urlunparse
from bs4.element import Tag
from helpers.chapter import Chapter
from helpers.checkers.base import AbstractChapterChecker
class KlmanagaChecker(AbstractChapterChecker):
"""Klmanaga checker"""
URL_SUBSTRING = "mangakl"
def get_latest_... | nonjosh/acgn-bot | helpers/checkers/klmanaga.py | .py | 0536e3f49366c499 | 7.42 | 6 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.