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 json import os import random import re from argparse import ArgumentParser from copy import deepcopy from typing import List, Optional, Tuple, Set version = '0.3.1' # Bump version for the changes # The real path to the directory containing this script __location__ = os.path.realpath(os.path.join(os.getcwd(), ...
PttCodingMan/TriangularNim
src/TriangularNim.py
.py
51f4e5cf0b1c1045
7.52
10
""" Simple on-off switch for ceiling fan, connected to the Wirenboard. """ import typing import logging from dialogs.mqtt_client import MqttClient from dialogs.protocol.device import Switch from dialogs.protocol.capability import OnOff class WbCooler(Switch): def __init__( self, mqtt_client: Mq...
torkve/sorokdva-smarthome
dialogs/devices/wirenboard/cooler.py
.py
655776e4c0e6316a
7.45
7
""" Dimmable light. It has no on-off switch, and its range depends on dim-contoller. """ import typing import logging from dialogs.mqtt_client import MqttClient from dialogs.protocol.consts import ActionError from dialogs.protocol.exceptions import ActionException from dialogs.protocol.device import Light from dialo...
torkve/sorokdva-smarthome
dialogs/devices/wirenboard/dimmable_light.py
.py
dfbdf5baaae46772
7.45
7
""" Simple on-off switch for lights, connected to the Wirenboard. """ import typing import logging from dialogs.mqtt_client import MqttClient from dialogs.protocol.device import Light from dialogs.protocol.capability import OnOff class WbLight(Light): def __init__( self, mqtt_client: MqttClient...
torkve/sorokdva-smarthome
dialogs/devices/wirenboard/light.py
.py
734035ade9ff4426
7.45
7
""" Simple on-off socket or socket group, connected to the Wirenboard. """ import typing import logging from dialogs.mqtt_client import MqttClient from dialogs.protocol.device import Socket from dialogs.protocol.capability import OnOff class WbSocket(Socket): def __init__( self, mqtt_client: Mq...
torkve/sorokdva-smarthome
dialogs/devices/wirenboard/socket.py
.py
da5e78840d74f05b
7.45
7
from typing import TYPE_CHECKING, Any, cast from urllib.parse import urlparse from xml.sax.saxutils import escape import requests from flask import Blueprint, Response, abort, current_app, redirect, request, session, url_for from flask.typing import ResponseReturnValue from flask_login import login_required, login_u...
abarto/flask-pysaml2-example
flask_pysaml2_example/auth.py
.py
467f7666c8f28bc2
7.54
11
import re from typing import Tuple from .pluralizer_rules import irregular_rules, pluralization_rules, singularization_rules, uncountable_rules IrregularSingles = dict[str, str] IrregularPlurals = dict[str, str] SingularRule = Tuple[re.Pattern[str], str] PluralRule = Tuple[re.Pattern[str], str] class Pluralizer: ...
weixu365/pluralizer-py
pluralizer/pluralizer.py
.py
3be06998e88bce8f
7.6
15
import json from urllib import request from urllib.error import HTTPError from urllib.parse import quote from telegram.ext import CallbackContext, CommandHandler from telegram.update import Update from autonomia.core import bot_handler # Source: https://github.com/NovelCOVID/API _URL = "https://corona.lmao.ninja/v2/...
PythonistasBR/bot
autonomia/features/corona.py
.py
b82c895c08af89d5
7.48
8
import json from urllib import request from telegram.ext import CallbackContext, CommandHandler from telegram.update import Update from autonomia.core import bot_handler from autonomia.settings import FIXER_IO_API_TOKEN as token FIXER_IO_API_ENDPOINT = f"http://data.fixer.io/api/latest?access_key={token}" def cmd_...
PythonistasBR/bot
autonomia/features/currency.py
.py
5f4760c1f4440f18
7.48
8
from telegram.ext import CallbackContext, CommandHandler from telegram.update import Update from autonomia.core import bot_handler FAAS_BASE_URL = "https://foaas.io/off" def cmd_faas(update: Update, context: CallbackContext): args = context.args if not args: update.message.reply_text("Use: /fuck <wh...
PythonistasBR/bot
autonomia/features/fuck_off.py
.py
42295504846fb684
7.48
8
from telegram.ext import CallbackContext, CommandHandler from telegram.update import Update from autonomia.core import bot_handler, get_routes def cmd_help(update: Update, context: CallbackContext): out = "Autonomia Bot commands:\n" for route in get_routes(): if doc := route.docs: out += ...
PythonistasBR/bot
autonomia/features/help.py
.py
11a7f481bef5912e
7.48
8
import datetime import urllib.parse from dateutil import relativedelta from telegram.ext import CallbackContext, CommandHandler from telegram.update import Update from autonomia.core import bot_handler BASE_URL = "https://www.timeanddate.com/countdown/weekend" MESSAGES = { "monday": "Ta longe ainda!", "tues...
PythonistasBR/bot
autonomia/features/sextou.py
.py
8e74c43d13edcb9e
7.48
8
import json from collections import defaultdict from telegram.ext import BasePersistence KEY_CHAT_DATA = "chat_data" KEY_BOT_DATA = "bot_data" KEY_USER_DATA = "user_data" KEY_CONVERSATION_DATA = "conversation_data" class TelegramRedisPersistence(BasePersistence): def __init__( self, redis_client...
PythonistasBR/bot
autonomia/libs/redispersistence.py
.py
b91bfda755cb4a46
7.48
8
"""Koji osbuild integration - koji client plugin This koji plugin provides a new 'osbuild-image' command for the koji command line tool. It uses the 'osbuildImage' XMLRPC endpoint, that is provided by the koji osbuild plugin for the koji hub. """ import json import optparse # pylint: disable=deprecated-module from ...
osbuild/koji-osbuild
plugins/cli/osbuild.py
.py
e274ed2de97761e1
7.56
12
# # Test Infrastructure # import importlib import os import unittest class PluginTest(unittest.TestCase): """Base class for Plugin tests Use the PluginTest.load_plugin class decorator to automatically load a plugin. If said decorator has not been specified, the `plugin` property will be set to `Non...
osbuild/koji-osbuild
test/unit/plugintest.py
.py
c84865d37585f6b3
8.06
12
# # koji hub plugin unit tests # import jsonschema import koji from flexmock import flexmock from plugintest import PluginTest @PluginTest.load_plugin("hub") class TestHubPlugin(PluginTest): @staticmethod def mock_koji_context(*, times=1, admin=False): session = flexmock() session.should_re...
osbuild/koji-osbuild
test/unit/test_hub.py
.py
ed06ff81890cc625
7.06
12
# Copyright 2025 EPAM Systems # # 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 # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writi...
reportportal/service-auto-analyzer
app/amqp/amqp.py
.py
ce0e511be7622652
7.59
14
# Copyright 2025 EPAM Systems # # 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 # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in w...
reportportal/service-auto-analyzer
app/commons/clustering.py
.py
5cdacfdc26a63103
7.59
14
# Copyright 2023 EPAM Systems # # 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 # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writi...
reportportal/service-auto-analyzer
app/commons/logging.py
.py
77c92e039c519a94
7.59
14
# Copyright 2026 EPAM Systems # # 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 # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in w...
reportportal/service-auto-analyzer
app/commons/model/db.py
.py
ce383a5f979d384f
7.59
14
# Copyright 2023 EPAM Systems # # 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 # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writi...
reportportal/service-auto-analyzer
app/commons/model/launch_objects.py
.py
6bfe4d0d2b900785
7.59
14
# Copyright 2026 EPAM Systems # # 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 # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in w...
reportportal/service-auto-analyzer
app/commons/model/log_item_index.py
.py
adb8d0ee8b819f3e
7.59
14
# Copyright 2025 EPAM Systems # # 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 # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in w...
reportportal/service-auto-analyzer
app/commons/model/test_item_index.py
.py
fc883cb5238fad13
8.09
14
# Copyright 2025 EPAM Systems # # 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 # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in w...
reportportal/service-auto-analyzer
app/commons/object_saving/blob_storage.py
.py
0dd2bfe8f49a13aa
7.59
14
# Copyright 2025 EPAM Systems # # 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 # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in w...
reportportal/service-auto-analyzer
app/commons/object_saving/boto3_client.py
.py
4b2fce1a1818aa4f
7.59
14
# Copyright 2023 EPAM Systems # # 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 # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writi...
reportportal/service-auto-analyzer
app/commons/object_saving/storage.py
.py
5ad6f4f6db4ac2eb
7.59
14
# Copyright 2025 EPAM Systems # # 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 # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in w...
reportportal/service-auto-analyzer
app/commons/processing.py
.py
9a8f0ae9d45b3a5c
7.59
14
# Copyright 2023 EPAM Systems # # 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 # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writi...
reportportal/service-auto-analyzer
app/main.py
.py
cbb0ab1bd47bf512
7.59
14
# Copyright 2023 EPAM Systems # # 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 # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writi...
reportportal/service-auto-analyzer
app/ml/models/boosting_decision_maker.py
.py
336e9d604179998d
7.59
14
# Copyright 2023 EPAM Systems # # 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 # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writi...
reportportal/service-auto-analyzer
app/ml/models/custom_boosting_decision_maker.py
.py
17d94c53af5fbc3e
7.59
14
# Copyright 2024 EPAM Systems # # 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 # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in w...
reportportal/service-auto-analyzer
app/ml/models/ml_model.py
.py
6cdb5c8a9bd0ffa2
7.59
14
# Copyright 2023 EPAM Systems # # 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 # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writi...
reportportal/service-auto-analyzer
app/ml/training/__init__.py
.py
181460c6a5c590a9
7.59
14
# Copyright 2023 EPAM Systems # # 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 # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writi...
reportportal/service-auto-analyzer
app/service/clean_index_service.py
.py
deb00178e99934fd
7.59
14
""" Reference: https://libcloud.readthedocs.io/en/stable/compute/drivers/azure_arm.html """ import logging import os from functools import cached_property from libcloud.compute.base import Node, NodeDriver from libcloud.compute.providers import get_driver from libcloud.compute.types import Provider, LibcloudError fro...
ricardobranco777/cloudview
cloudview/azure.py
.py
0339095f30ad0ad4
7.42
6
#!/usr/bin/env python3 """ Show all instances created on cloud providers """ import argparse import os import logging import sys from concurrent.futures import ThreadPoolExecutor from operator import itemgetter from typing import Any import yaml from libcloud.compute.types import Provider, LibcloudError from .ec2 im...
ricardobranco777/cloudview
cloudview/cloudview.py
.py
ce7f5b4ec919810a
7.42
6
""" Reference: https://libcloud.readthedocs.io/en/stable/compute/drivers/ec2.html """ import logging import os import concurrent.futures from libcloud.compute.base import Node, NodeDriver from libcloud.compute.providers import get_driver from libcloud.compute.types import Provider, LibcloudError, InvalidCredsError f...
ricardobranco777/cloudview
cloudview/ec2.py
.py
ebc59174e6fa76b9
7.42
6
""" Reference: https://libcloud.readthedocs.io/en/stable/compute/drivers/gce.html """ import json import logging import os import concurrent.futures from functools import cached_property from libcloud.compute.base import Node, NodeDriver from libcloud.compute.drivers.gce import GCEZone from libcloud.compute.providers...
ricardobranco777/cloudview
cloudview/gce.py
.py
5122c615c7ed7a14
7.42
6
""" Instance class """ import logging from dataclasses import dataclass from datetime import datetime from libcloud.compute.types import NodeState, LibcloudError from requests.exceptions import RequestException STATES = [str(getattr(NodeState, _)) for _ in dir(NodeState) if _.isupper()] @dataclass(kw_only=True) cl...
ricardobranco777/cloudview
cloudview/instance.py
.py
dfa55a01ce7a98ac
7.42
6
""" References: https://libcloud.readthedocs.io/en/stable/compute/drivers/openstack.html https://docs.openstack.org/python-openstackclient/latest/cli/man/openstack.html """ import logging import os from functools import cached_property from urllib.parse import urlparse import libcloud.security from libcloud.compute.b...
ricardobranco777/cloudview
cloudview/openstack.py
.py
2da803595133fd2f
7.42
6
""" Helper functions """ import os from datetime import datetime from dateutil import parser from dateutil.relativedelta import relativedelta from pytz import utc def read_file(path: str) -> str: """ Read file but raise RuntimeError if it has the wrong permissions """ with open(path, encoding="utf-8...
ricardobranco777/cloudview
cloudview/utils.py
.py
c923f68967710db4
7.42
6
from operator import itemgetter from okdata.sdk.permission.client import PermissionClient from okdata.sdk.permission.user_types import Client, Team, User from okdata.cli.command import BASE_COMMAND_OPTIONS, BaseCommand from okdata.cli.output import create_output class PermissionsCommand(BaseCommand): __doc__ = ...
oslokommune/okdata-cli
okdata/cli/commands/permissions.py
.py
78b47d2063e2e4e3
7.48
8
from django.core import signing class CSRFHIDEMiddleware(object): """ Middleware that hides the csrfmiddlewaretoken in the request. """ def __init__(self, get_response): self.get_response = get_response # One-time configuration and initialization. def __call__(self, request): ...
metemaddar/django_hide
django_hide/middleware.py
.py
120d638b706b8cbb
7.5
9
#!/usr/bin/env python """Django's command-line utility for administrative tasks.""" import os import sys def main(): """Run administrative tasks.""" os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'django_hide_test.settings') try: from django.core.management import execute_from_command_line ex...
metemaddar/django_hide
tests/manage.py
.py
8327290629c1280e
7
9
from django.test import TestCase, Client import bs4 # Create your tests here. class TestUrls(TestCase): def test_django_hide_form_view(self): response = self.client.get('/') self.assertEqual(response.status_code, 200) self.assertContains(response, 'name') def test_django_hide_form_vi...
metemaddar/django_hide
tests/testing_app/tests.py
.py
d856006906d8aab9
7
9
from django.shortcuts import render from django.forms import Form, CharField from django.http import HttpResponse # Create your views here. class TestForm(Form): name = CharField() def django_hide_form_view(request): form = TestForm(request.POST or None) if request.method == 'POST': if form.is_va...
metemaddar/django_hide
tests/testing_app/views.py
.py
a472c05188abbaad
7
9
#!/usr/bin/env python3 import angr import claripy def AND1(c): """constrain 1: printable""" return claripy.And(33 <= c, c <= 126) def AND2(c): """returns constraints s.t. c is printable""" return claripy.And(65 <= c, c <= 90) def AND3(c): """returns constraints s.t. c is printable""" retu...
nevesnunes/env
common/code/snippets/angr/tamuctf2019_cr4ckz33c0d3.py
.py
cc34034775e1ad69
7.64
18
#!/usr/bin/env python3 """ Generates the sequence for CD scrambler. Uses the shift register method, as specified in ECMA-130 Annex B. Adapted from: "CD Cracking Uncovered: Protection against Unsactioned CD Copying" By Kris Kaspersky """ def update(reg): for i in range(8): hibit = ((reg & 1) ^ ((reg & 2)...
nevesnunes/env
common/code/snippets/cdrom/scramble_ecma130.py
.py
66054fd6352b9d12
7.64
18
#!/usr/bin/env python3 """ Generates the sequence for CD scrambler. Too much boilerplate, see other approaches... """ def chunks(lst, n): """Yield successive n-sized chunks from lst.""" for i in range(0, len(lst), n): yield lst[i : i + n] def from_le(lst, n=4): """Reorder bytes by switching end...
nevesnunes/env
common/code/snippets/cdrom/scramble_naive.py
.py
549878221c17f46e
7.64
18
#!/usr/bin/env python3 import collections def make_columns(text, key_length): """ Returns columns of length = key_length for text""" blocks = [] # Divide ciphertext into blocks of length = key_length for i in xrange(0, len(text) / key_length): blocks.append(list(text[key_length * i : key_len...
nevesnunes/env
common/code/snippets/ctf/crypto/chi_squared.py
.py
f1bb10ff5d80ec3d
7.64
18
#!/usr/bin/env python3 import collections import os def countletters(myfile): """ Returns a dictionary containing a occurence frequency of each found character""" d = collections.defaultdict(int) myfile = open(myfile) for line in myfile: line = line.rstrip('\n') for c in line: ...
nevesnunes/env
common/code/snippets/ctf/crypto/frequency_analysis.py
.py
1c8bfa1f46cf9680
7.64
18
#!/usr/bin/python3 # -*- coding: utf-8 -*- from alphazero.nnet import AlphaZeroNNet from alphazero.rl import RL class AlphaZeroModule: """Dependency injection module for AlphaZero game training. Binds game implementations to their neural network adapters, with AlphaZeroNNet as the automatic default bin...
zhixiangli/alphazero-board-games
alphazero/module.py
.py
d96af147d508a42a
7.52
10
#!/usr/bin/python3 # -*- coding: utf-8 -*- import glob import logging import os import time import numpy import torch import torch.nn as nn import torch.optim as optim class NNet: def train(self, data): raise NotImplementedError() def predict(self, data): raise NotImplementedError() d...
zhixiangli/alphazero-board-games
alphazero/nnet.py
.py
64302a43f7f8ebf6
7.52
10
#!/usr/bin/python3 # -*- coding: utf-8 -*- """Tests for the abstract Game base class in alphazero/game.py.""" import unittest from alphazero.game import Game class TestGameDRAWSentinel(unittest.TestCase): def test_draw_is_string(self): self.assertIsInstance(Game.DRAW, str) def test_draw_value(sel...
zhixiangli/alphazero-board-games
alphazero/tests/game_test.py
.py
f4ea9c1c17d548bd
8.02
10
#!/usr/bin/python3 # -*- coding: utf-8 -*- import unittest import numpy from dotdict import dotdict from alphazero.game import Game from alphazero.module import AlphaZeroModule from alphazero.nnet import AlphaZeroNNet, NNet from alphazero.rl import RL from gomoku_9_9 import configure_module from gomoku_9_9.config i...
zhixiangli/alphazero-board-games
alphazero/tests/module_test.py
.py
753149b59371b942
8.02
10
#!/usr/bin/python3 # -*- coding: utf-8 -*- """Tests for alphazero/nnet.py - NNet abstract class and AlphaZeroNNet.""" import glob import os import tempfile import unittest import numpy import torch from dotdict import dotdict from alphazero.nnet import NNet, AlphaZeroNNet, _AlphaZeroModel, _ResidualBlock from gomo...
zhixiangli/alphazero-board-games
alphazero/tests/nnet_test.py
.py
b2e61e2c25274221
8.02
10
#!/usr/bin/python3 # -*- coding: utf-8 -*- """Comprehensive tests for terminal state detection and MCTS termination. Covers the critical bug categories identified in the Gomoku 6×6 pipeline: - Win detection in all 4 directions (horizontal, vertical, diagonal, anti-diagonal) - Overlines (5+ in a row when n_in_row=4) ...
zhixiangli/alphazero-board-games
alphazero/tests/terminal_state_test.py
.py
a35faec60db304de
7.02
10
#!/usr/bin/python3 # -*- coding: utf-8 -*- import argparse import logging import unittest from dataclasses import fields from unittest.mock import patch, MagicMock from alphazero.trainer import ( add_config_args, build_config_from_args, run_training, setup_logging, ) from gomoku_9_9.config import Gom...
zhixiangli/alphazero-board-games
alphazero/tests/trainer_test.py
.py
a5bfa9ac457ddcad
8.02
10
#!/usr/bin/python3 # -*- coding: utf-8 -*- """Common training utilities for AlphaZero game training. Provides reusable helpers for logging setup, CLI argument parsing, and training orchestration. Game-specific trainers (e.g. ``gomoku_9_9/trainer.py``) add their own arguments, build the game config, and call :func:`...
zhixiangli/alphazero-board-games
alphazero/trainer.py
.py
14919df9e3cb781a
7.52
10
"""Shared pytest fixtures for deterministic and reusable test setup.""" from __future__ import annotations import random from typing import Callable import numpy import pytest from dotdict import dotdict @pytest.fixture(autouse=True) def deterministic_seed() -> None: """Keep stochastic tests reproducible and o...
zhixiangli/alphazero-board-games
conftest.py
.py
5e532154c4157e8b
8.02
10
#!/usr/bin/python3 # -*- coding: utf-8 -*- """Play Connect4 against a trained AlphaZero model via stdio.""" from alphazero.stdio_play import run_stdio_game from connect4.config import Connect4Config from connect4.game import ChessType, Connect4Game def _format_action(game, action): return str(action % game.args...
zhixiangli/alphazero-board-games
connect4/stdio_play.py
.py
3cd85c7762a46e22
7.52
10
#!/usr/bin/python3 # -*- coding: utf-8 -*- import unittest from connect4.stdio_play import ( _parse_move as _parse_connect4_move, _resolve_action as _resolve_connect4_action, ) class TestConnect4StdioMoveParsing(unittest.TestCase): def test_parse_column_number(self): self.assertEqual(_parse_conn...
zhixiangli/alphazero-board-games
connect4/tests/stdio_play_test.py
.py
7e51ab06ade8a772
7.02
10
#!/usr/bin/python3 # -*- coding: utf-8 -*- import unittest from gomoku_15_15.stdio_play import _parse_move class TestStdioMoveParsing(unittest.TestCase): def test_parse_compact_coordinate(self): self.assertEqual(_parse_move("E5", rows=9, columns=9), 4 * 9 + 4) def test_parse_spaced_coordinate(self)...
zhixiangli/alphazero-board-games
gomoku_15_15/tests/stdio_play_test.py
.py
8a73c904059efd6a
7.02
10
#!/usr/bin/python3 # -*- coding: utf-8 -*- import logging import numpy from alphazero.game import Game class ChessType: BLACK = "B" WHITE = "W" EMPTY = "." class GomokuGame(Game): def __init__(self, args): self.args = args self.semicolon = ";" self.directions = ((1, 1), (...
zhixiangli/alphazero-board-games
gomoku_9_9/game.py
.py
b6667dc49defa231
7.52
10
import re def fix_doc(doc): """ Convert link in svg from something like: https://www.google.com/url?q=https://docs.pjsip.org/en/latest/api/pjsip.html&amp;sa=D&amp;source=editors&amp;ust=1659062031097535&amp;usg=AOvVaw2CjhVRBxeOR9yQX-LyohQ_" https://www.google.com/url?q=https://docs.pjsip.org/en/latest...
pjsip/pjproject_docs
docs/source/overview/fix_svg_link.py
.py
ac18468ef0b495d8
7.54
11
#!/usr/bin/env python # -*- coding: utf-8 -*- # Modified from: # https://github.com/tracboat/tracboat/blob/master/src/tracboat/trac2down.py ''' Copyright © 2013 Eric van der Vlist <vdv@dyomedea.com> Shigeru KANEMOTO <support@switch-science.com> Copyright © 2017-2018 Elan Ruusamäe <glen@pld-linux.org> See ...
pjsip/pjproject_docs
trac2down.py
.py
c3040e7a7457ae03
7.54
11
""" Module providing various decorators This module provides common decorators used within the library. Currently, authentication-related decorators are implemented. """ from collections.abc import Callable from functools import wraps from typing import Any, ParamSpec, TypeVar P = ParamSpec("P") T = TypeVar("T") d...
ukwhatn/wikidot.py
src/wikidot/common/decorators.py
.py
f15e6faf761ec7dc
7.6
15
""" Module providing logging functionality This module configures and provides loggers used throughout the library. It uses NullHandler to enable log control on the application side. """ import logging def get_logger(name: str = "wikidot") -> logging.Logger: """ Get the library logger Parameters --...
ukwhatn/wikidot.py
src/wikidot/common/logger.py
.py
54128bdfd27515fc
7.6
15
import contextlib from typing import TYPE_CHECKING import httpx from ..common.exceptions import SessionCreateException from ..util.http import sync_post_with_retry if TYPE_CHECKING: from .client import Client # Login retry limit (reduced to prevent account lockout) LOGIN_RETRY_LIMIT = 3 class HTTPAuthenticati...
ukwhatn/wikidot.py
src/wikidot/module/auth.py
.py
7686d25768eecf33
7.6
15
""" Module for handling Wikidot forum categories This module provides classes and functionality related to Wikidot forum categories. It enables operations such as retrieving category information and thread lists. """ import re from collections.abc import Iterator from dataclasses import dataclass from typing import T...
ukwhatn/wikidot.py
src/wikidot/module/forum_category.py
.py
83b0e992420d1c13
7.6
15
""" Module for handling Wikidot forum post revisions (edit history) This module provides classes and functions related to Wikidot forum post revisions. It enables operations such as retrieving revision history and accessing historical content. """ import re from collections.abc import Iterator from dataclasses import...
ukwhatn/wikidot.py
src/wikidot/module/forum_post_revision.py
.py
607297d40a9bc7de
7.6
15
""" Module for handling Wikidot page edit history (revisions) This module provides classes and functions related to Wikidot page edit history (revisions). It enables operations such as retrieving revisions, getting source code, and displaying HTML. """ import json from collections.abc import Callable, Iterator from d...
ukwhatn/wikidot.py
src/wikidot/module/page_revision.py
.py
660c99870455d3c9
7.6
15
""" Module for handling Wikidot page votes (ratings) This module provides classes and functions related to Wikidot page votes (ratings). It enables operations such as retrieving and displaying vote information for pages. """ from collections.abc import Iterator from dataclasses import dataclass from typing import TYP...
ukwhatn/wikidot.py
src/wikidot/module/page_votes.py
.py
81dc4a4256cc07b7
7.6
15
""" Module for handling site join applications on Wikidot This module provides classes and functionality related to site join applications on Wikidot. It enables operations such as retrieving, accepting, and declining applications. """ from dataclasses import dataclass from typing import TYPE_CHECKING from bs4 impor...
ukwhatn/wikidot.py
src/wikidot/module/site_application.py
.py
cfbbd186fef70675
7.6
15
""" Module for parsing Wikidot site user/IP block listings `managesite/blocks/{ManageSiteUserBlocksModule,ManageSiteIpBlocksModule}` render these lists; there is no pagination parameter for either (unlike the member lists in site_member_admin.py) per this project's JS research (`managesite_blocks_ManageSiteUserBlocksM...
ukwhatn/wikidot.py
src/wikidot/module/site_block.py
.py
c64b2b9cbaace73c
7.6
15
""" Module for handling Wikidot's per-site "category" objects `categories` is the shared read-modify-write data structure behind seven Manage Site areas (Permissions / License / Navigation / Templates / PageRate / PerPageDiscussion / Appearance): each renders the *entire* category array alongside its HTML body, and ea...
ukwhatn/wikidot.py
src/wikidot/module/site_category.py
.py
1f14a2d291fa9df6
7.6
15
""" Encoders/decoders for Wikidot's compact permission and rating strings Manage Site's category objects hold permissions as a single semicolon- separated string (e.g. ``v:armo;c:m;...``), forum permissions in a similar but distinct format, and rating configuration as a fixed 4-character code (e.g. ``drvM``). These ar...
ukwhatn/wikidot.py
src/wikidot/module/site_permissions.py
.py
4496faec437b3e9d
7.6
15
""" Module for site-wide tooling views: Site Tools, Wanted Pages, Orphaned Pages, Drafts, the category-driven page list (manage:listpages), and a filtered recent-changes feed. Access through `Site.tools`. """ from __future__ import annotations import json import re from typing import TYPE_CHECKING, Any, Literal fro...
ukwhatn/wikidot.py
src/wikidot/module/site_tools.py
.py
700be2b44d1435ae
7.6
15
"""Async execution helper module Provides utilities for safely executing async operations even in existing event loop environments. Works in environments where an event loop is already running, such as Jupyter Notebook or FastAPI. """ import asyncio import concurrent.futures from collections.abc import Coroutine from...
ukwhatn/wikidot.py
src/wikidot/util/async_helper.py
.py
3a4710acf575411c
7.6
15
import re from .table import char_table class StringUtil: @staticmethod def to_unix(target_str: str) -> str: """Convert a string to Unix format Parameters ---------- target_str: str String to convert Returns ------- str Convert...
ukwhatn/wikidot.py
src/wikidot/util/stringutil.py
.py
c8aacfc7b9827bda
7.6
15
#!/usr/bin/env python """Watch a DynamoDB stream for creations, updates, and deletions. By default only prints the primary key. """ import argparse from typing import Callable import boto3 from xoto3.dynamodb.streams.consume import ItemImages, make_dynamodb_stream_images_multicast from xoto3.dynamodb.utils.index imp...
xoeye/xoto3
dev-utils/watch_ddb_stream.py
.py
e8fbe88d0ef5fe3c
7.64
18
# type: ignore """Common code use by unit tests in different vision-nx projects""" import importlib from os.path import basename, isfile, join, isdir, dirname import glob def import_all(file: str, module: str): """Test all files in the module are importable""" _import_dir(join(dirname(dirname(file)), module)...
xoeye/xoto3
tests/test_imports.py
.py
7d31115165165e3b
8.14
18
from decimal import Decimal import pytest from boto3.dynamodb.types import Binary from xoto3.dynamodb.prewrite import dynamodb_prewrite from xoto3.dynamodb.utils.serde import deserialize_item, serialize_item def test_dynamodb_prewrite_still_have_empty_strings_in_lists(): d = dict(f=["peter", "gaultney", "", Non...
xoeye/xoto3
tests/xoto3/dynamodb/prewrite_test.py
.py
72c9fbad362c923b
8.14
18
"""Imagine you had the following business logic and you wanted to test it. Here's how you might go about that, using the xoto3.dynamodb.write_versioned API itself to set everything up and prove that it worked. The example here is the same as the code we have in the README. """ import pytest import xoto3.dynamodb.writ...
xoeye/xoto3
tests/xoto3/dynamodb/write_versioned/example_unit_test.py
.py
d4e4ec27217ea323
8.14
18
from xoto3.dynamodb.write_versioned import ( ItemTable, VersionedTransaction, versioned_transact_write_items, ) def test_batch_get_lazy_load(): """Tests that multiple serial `get`s perform only a single actual call to batch_get""" t = VersionedTransaction(dict()) table_a = ItemTable("a") ...
xoeye/xoto3
tests/xoto3/dynamodb/write_versioned/lazy_batch_gets_test.py
.py
f4252673e9ab58f2
8.14
18
#!/usr/bin/env python3 # ruff: noqa: T201 """tymely fetches HTTP-date over HTTPS and sets the system time.""" import argparse import asyncio import datetime import secrets import shutil import ssl import subprocess # nosec B404,S404 import sys from pathlib import Path from typing import Any import aiohttp import cer...
konstruktoid/tymely
tymely/tymely.py
.py
b16a5e47b3cf448a
7.48
8
# Copyright 2019 AT&T Intellectual Property. All other rights reserved. # # 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...
airshipit/pegleg
pegleg/cli/utils.py
.py
ecb3719141b9884c
7.52
10
# Copyright 2018 AT&T Intellectual Property. All other rights reserved. # # 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...
airshipit/pegleg
pegleg/config.py
.py
7042baf7732c495d
7.52
10
# Copyright 2018 AT&T Intellectual Property. All other rights reserved. # # 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...
airshipit/pegleg
pegleg/engine/__init__.py
.py
67b8bc1ad24de2ee
7.52
10
# Copyright 2018 AT&T Intellectual Property. All other rights reserved. # # 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...
airshipit/pegleg
pegleg/engine/catalogs/base_catalog.py
.py
50958fe0a553757e
7.52
10
# Copyright 2018 AT&T Intellectual Property. All other rights reserved. # # 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...
airshipit/pegleg
pegleg/engine/common/managed_document.py
.py
362ea3cac39cd61e
7.52
10
# Copyright 2018 AT&T Intellectual Property. All other rights reserved. # # 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...
airshipit/pegleg
pegleg/engine/generators/base_generator.py
.py
683c30e2b08e6d8c
7.52
10
# Copyright 2018 AT&T Intellectual Property. All other rights reserved. # # 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...
airshipit/pegleg
pegleg/engine/generators/passphrase_generator.py
.py
41c8d9f44916e793
7.52
10
# Copyright 2018 AT&T Intellectual Property. All other rights reserved. # # 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...
airshipit/pegleg
pegleg/engine/repository.py
.py
0585ffcf9dbeca7d
7.52
10
# Copyright 2018 AT&T Intellectual Property. All other rights reserved. # # 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...
airshipit/pegleg
pegleg/engine/util/catalog.py
.py
7b66c5e1d07dac21
7.52
10
# Copyright 2018 AT&T Intellectual Property. All other rights reserved. # # 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...
airshipit/pegleg
pegleg/engine/util/cryptostring.py
.py
5df7483a706ff7ac
7.52
10
# Copyright 2018 AT&T Intellectual Property. All other rights reserved. # # 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...
airshipit/pegleg
pegleg/engine/util/deckhand.py
.py
4dcf5efd983adff8
7.52
10
# Copyright 2018 AT&T Intellectual Property. All other rights reserved. # # 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...
airshipit/pegleg
pegleg/engine/util/definition.py
.py
6c6e9cb8e6a1f398
7.52
10
# Copyright 2018 AT&T Intellectual Property. All other rights reserved. # # 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...
airshipit/pegleg
pegleg/engine/util/encryption.py
.py
18e65afa9f5e9d67
7.52
10
# Copyright 2018 AT&T Intellectual Property. All other rights reserved. # # 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...
airshipit/pegleg
pegleg/engine/util/files.py
.py
20946aec5ccc5926
7.52
10
# Copyright 2018 AT&T Intellectual Property. All other rights reserved. # # 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...
airshipit/pegleg
pegleg/engine/util/git.py
.py
1339f26821979e03
7.52
10