max_stars_repo_path stringlengths 3 269 | max_stars_repo_name stringlengths 4 119 | max_stars_count int64 0 191k | id stringlengths 1 7 | content stringlengths 6 1.05M | score float64 0.23 5.13 | int_score int64 0 5 |
|---|---|---|---|---|---|---|
mountains/file/__init__.py | restran/mountains | 5 | 46800 | <gh_stars>1-10
# -*- coding: utf-8 -*-
# Created by restran on 2017/8/23
from __future__ import unicode_literals, absolute_import
import os
import shutil
from collections import deque
from .. import json
from ..datetime.converter import timestamp2datetime
from ..encoding import force_text, force_bytes
def read_dict... | 2.734375 | 3 |
dialogue/pytorch/modules.py | ishine/nlp-dialogue | 59 | 46801 | # Copyright 2021 DengBoCong. All 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 by applicable law or a... | 2.03125 | 2 |
pytorch_intermediate_layers/intermediate_feature_module.py | janfreyberg/pytorch-intermediate-layers | 0 | 46802 | <gh_stars>0
from typing import Union, Tuple, List, Dict
from typing_extensions import Literal
from collections import OrderedDict
import torch
from .recursive_getattr import _recursive_getattr
ReturnContainerTypes = Union[
Literal["dict"], Literal["list"], Literal["tensor"]
]
class IntermediateFeatureModule(... | 2.703125 | 3 |
succolib/visualisation/hist2d_tools.py | mattiasoldani/succolib | 0 | 46803 | <reponame>mattiasoldani/succolib
import numpy as np
import matplotlib.pyplot as plt
########################################################################################################################
def hist2dRatio(
xNum, yNum,
xDen, yDen,
bins=None,
range=None,
bPlot=Tru... | 3.15625 | 3 |
engine.py | allexlima/AutomataTranslator | 1 | 46804 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# Importa as bibliotecas básicas para o funcionamento da tradução
import json
import xml
import xmltodict
import jsonschema
# Classe Model é responsável por validar o Input/Output, i.e., a estrutura do autômato
class Model(object):
def __init__(self):
self.m... | 3.125 | 3 |
json_t.py | aaparikh/Intermediate-Python-Practice | 1 | 46805 | <filename>json_t.py
from inspect import ClassFoundException
import json
#read json file to dictionary
person = json.load(open('./sample.json'))
print(type(person))
#convert dict to json str with pretty formatting (provided by indentation)
#sort_keys prints the keys in alphabetical order
wperson = json.dumps(person,in... | 3.3125 | 3 |
src/utils/download_test_assets.py | roozhou/botty | 0 | 46806 | <filename>src/utils/download_test_assets.py
import urllib.request
import zipfile
import os
import shutil
url = "https://github.com/mgleed/botty-test-assets/archive/refs/heads/main.zip"
extract_dir = "tmp"
asset_dir = "test/assets"
if not os.path.exists(asset_dir):
print(f"Downloading test assets...")
try:
... | 2.96875 | 3 |
examples/tutorial.py | alulujasmine/mc3 | 6 | 46807 | import sys
import numpy as np
import mc3
def quad(p, x):
"""
Quadratic polynomial function.
Parameters
p: Polynomial constant, linear, and quadratic coefficients.
x: Array of dependent variables where to evaluate the polynomial.
Returns
y: Polinomial evaluated at x: y(x) = p0... | 3.390625 | 3 |
model/run_GRU.py | Liang-Qiu/GRU_Android | 11 | 46808 | <reponame>Liang-Qiu/GRU_Android
#copyright 2016 LiangKlausQiu. All 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
#
# Unle... | 1.859375 | 2 |
lib/tagger/exceptions.py | shunf4/pys60v1-pymusic | 3 | 46809 | """ Custom Exceptions """
__author__ = "<NAME> <<EMAIL>>"
__license__ = "BSD"
__copyright__ = "Copyright (c) 2004, Alastair Tse"
__revision__ = "$Id: exceptions.py,v 1.2 2004/05/04 12:18:21 acnt2 Exp $"
class ID3Exception(Exception):
"""General ID3Exception"""
pass
class ID3EncodingException(ID3Exception):
"""E... | 1.953125 | 2 |
pydish/http_server.py | failsafe89/pydish | 1 | 46810 | #!/usr/bin/env python3
# Copyright 2020 <NAME>
# 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... | 2.3125 | 2 |
api/routers.py | yellowjaguar5/lnldb | 5 | 46811 | <filename>api/routers.py
from rest_framework.routers import Route, DynamicRoute, SimpleRouter
class ReadOnlyRouter(SimpleRouter):
routes = [
Route(
url=r'^{prefix}$',
mapping={'get': 'list'},
name='{basename}-list',
detail=False,
initkwargs={'suf... | 2.53125 | 3 |
level/routes.py | Mineorbit/DungeonsAndDungeonsLevelServer | 0 | 46812 | from typing import List
from fastapi import APIRouter, UploadFile, File, Depends
import file.controllers as file_controller
import level.controllers as level_controller
from decorators import proto_resp
from level.models import Level
from file.models import File as FileT
from level.views import LevelMetaDataOut, Leve... | 2.203125 | 2 |
34_NextWordPrediction.py | bjascob/SmartLMVocabs | 10 | 46813 | #!/usr/bin/python3
# Copyright 2018 <NAME>
#
# 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... | 2.234375 | 2 |
python/marvin/contrib/vacs/hi.py | elicharlese/marvin | 49 | 46814 | # !usr/bin/env python
# -*- coding: utf-8 -*-
#
# Licensed under a 3-clause BSD license.
#
# @Author: <NAME>
# @Date: 2018-10-11 17:51:43
# @Last modified by: <NAME>
# @Last Modified time: 2018-11-29 17:23:15
from __future__ import print_function, division, absolute_import
import numpy as np
import astropy
import... | 2.390625 | 2 |
circleguard/config.py | wmpmiles/circleguard | 0 | 46815 | import pathlib
from secret import API_KEY
PATH_ROOT = pathlib.Path(__file__).parent
PATH_REPLAYS_STUB = PATH_ROOT / "replays"
API_BASE = "https://osu.ppy.sh/api/"
API_REPLAY = API_BASE + "get_replay?k=" + API_KEY + "&m=0&b={}&u={}"
API_SCORES_ALL = API_BASE + "get_scores?k=" + API_KEY + "&m=0&b={}&limit={}"
API_SCOR... | 1.820313 | 2 |
pyslab/core/locations.py | benhorsburgh/pyslab | 0 | 46816 | from typing import List
from .types import Cell
def box_id(cell: Cell) -> int:
return (cell.row // 3) * 3 + (cell.column // 3)
def row_house_ids() -> List[int]:
return list(range(9))
def column_house_ids() -> List[int]:
return list(range(10, 18))
def box_house_ids() -> List[int]:
return list(ra... | 2.984375 | 3 |
recommendation/api/types/translation/recommendation.py | wikimedia/research-recommendation-api | 3 | 46817 | <gh_stars>1-10
class Recommendation:
def __init__(self, title):
self.title = title
self.wikidata_id = None
self.rank = None
self.pageviews = None
self.url = None
self.sitelink_count = None
def __dict__(self):
return dict(title=self.title,
... | 2.484375 | 2 |
tiles.py | SouthFACT/southfact_tiles | 0 | 46818 | <filename>tiles.py
import sys, os, glob, time, uuid, csv, warnings, itertools, processing, numpy, boto3
start_time = time.time()
S3 = boto3.client('s3')
from processing.core.Processing import Processing
from osgeo import gdal
from osgeo import osr
from qgis.utils import *
from qgis.core import (
QgsApplication,... | 2.046875 | 2 |
quokka/utils/__init__.py | mutita/FlaskPyCMS | 1 | 46819 | # -*- coding: utf-8 -*-
import logging
from speaklater import make_lazy_string
from quokka.modules.accounts.models import User
logger = logging.getLogger()
def lazy_str_setting(key, default=None):
from flask import current_app
return make_lazy_string(
lambda: current_app.config.get(key, default)
... | 2.078125 | 2 |
easy/leetcode2.py | ayang818/LeetCode | 1 | 46820 | <reponame>ayang818/LeetCode
class Solution:
def reverse(self, x: int) -> int:
b = 0
if x < 0:
b, x = 1, abs(x)
mod, res = 0, 0
while x:
#下面两行分离出每一个位,从而完成逆序
x, mod = x // 10, x % 10
res = res * 10 + mod
if res > 2147483648:
... | 3.265625 | 3 |
parla/parray/core.py | UTexas-PSAAP/Parla.py | 0 | 46821 | from __future__ import annotations
from parla.cpu_impl import cpu
from parla.task_runtime import get_current_devices, get_scheduler_context
from parla.device import Device
from .coherence import MemoryOperation, Coherence, CPU_INDEX
import threading
import numpy
try: # if the system has no GPU
import cupy
n... | 2.40625 | 2 |
Stage 3 Transfer Learning with Keras Application /output_plot/train_50_epoch_keras.py | imxiaow/Deep-Learning-Based-Analysis-on-Histopathology-Images-of-Lung-Cancer | 1 | 46822 | import numpy as np
import tensorflow as tf
from tensorflow import keras
from tensorflow.keras.applications.inception_resnet_v2 import InceptionResNetV2
from tensorflow.keras.applications.inception_resnet_v2 import preprocess_input
from tensorflow.keras.optimizers import Adam
import matplotlib
matplotlib.use('agg')
impo... | 3.09375 | 3 |
tests/regressions/issue_61/test_issue_61.py | bitranox/Arpeggio | 0 | 46823 | <reponame>bitranox/Arpeggio
# stdlib
import pytest # type: ignore
# proj
from arpeggio import *
def test_ordered_choice_skipws_ws() -> None:
# Both rules will skip white-spaces
def sentence():
return Sequence(ZeroOrMore(word), skipws=True), EOF
def word():
return OrderedChoice([(id, '... | 2.40625 | 2 |
dataReader/dataset.py | chupengrocky/HackthonClimate | 0 | 46824 | <gh_stars>0
from torch.utils.data import Dataset
import torch
import numpy as np
from sklearn.preprocessing import StandardScaler, MinMaxScaler, OneHotEncoder
import pandas as pd
np.random.seed(0)
class dataset(Dataset):
def __init__(self ,data_frame, model_indx, mode='train'):
self.x = None
self.y_cls = No... | 2.65625 | 3 |
client_onedrive/src/setup.py | DataONEorg/d1_python | 15 | 46825 | <reponame>DataONEorg/d1_python
#!/usr/bin/env python
# This work was created by participants in the DataONE project, and is
# jointly copyrighted by participating institutions in DataONE. For
# more information on DataONE, see our web site at http://dataone.org.
#
# Copyright 2013 DataONE
#
# Licensed under the Apac... | 1.554688 | 2 |
src/dataloader/bsd_patches.py | nrupatunga/pytorch-deaf | 8 | 46826 | """
File: bsd_patches.py
Author: Nrupatunga
Email: <EMAIL>
Github: https://github.com/nrupatunga
Description: BSDS500 patches
"""
import time
from pathlib import Path
import h5py
import numpy as np
from tqdm import tqdm
mode = 'train'
mat_root_dir = f'/media/nthere/datasets/DIV_superres/patches/train/'
out_root_dir =... | 2.34375 | 2 |
BI_eyes_django/eyes/oracle.py | KameniAlexNea/ETL-Python | 0 | 46827 | <reponame>KameniAlexNea/ETL-Python<gh_stars>0
import pandas_oracle.tools as pt
def read_oracle_example():
"""
Lire les données d'une bd oracle
"""
query1 = "select id, name from students where name like '%Oscar%'"
query2 = "select class, avg(age) from students group by class"
## opening co... | 3.421875 | 3 |
src/adventofcode2021/solutions/day03.py | RoelAdriaans/adventofcode2021 | 0 | 46828 | <gh_stars>0
from collections import Counter
from adventofcode2021.utils.abstract import FileReaderSolution
class Day03:
pass
class Day03PartA(Day03, FileReaderSolution):
def solve(self, input_data: str) -> int:
lines = [line for line in input_data.split("\n") if line]
new_line = ""
... | 3.40625 | 3 |
utils/mysqlTools.py | kalenforn/MMVA | 4 | 46829 | <filename>utils/mysqlTools.py
import pymysql
class MySqlHold:
def __init__(self, host: str, user: str, password: str, database: str, port=3306):
self.db = pymysql.connect(host=host, user=user, port=port, database=database, password=password)
self.cursor = self.db.cursor()
def execute_command... | 2.9375 | 3 |
plur/stage_1/dummy_dataset.py | VHellendoorn/plur | 52 | 46830 | <reponame>VHellendoorn/plur
# Copyright 2021 Google LLC
#
# 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 l... | 2.265625 | 2 |
Tests/get_url_test.py | by09115/Flask-URLshortener | 1 | 46831 | <reponame>by09115/Flask-URLshortener<filename>Tests/get_url_test.py
from Tests import TestCaseBase, check_status_code
class GetUrlTest(TestCaseBase):
def setUp(self):
super(GetUrlTest, self).setUp()
self.short_url = self.save_url_request()
@check_status_code(302)
def test_success_get_url... | 2.890625 | 3 |
experiments_track/ab_bayes/src/implem/plots.py | elisarchodorov/ML-Recipes | 0 | 46832 | <reponame>elisarchodorov/ML-Recipes<gh_stars>0
import numpy as np
import plotly.graph_objects as go
from scipy import stats
from tqdm import tqdm
from src.implem.data import DataTransformers
from src.implem.orchester import AdmissionGroup
PLOT_LEGEND_LAYOUT = { "height":800,
"width":150... | 2.359375 | 2 |
tests/test_testing.py | LaudateCorpus1/windlass | 4 | 46833 | #
# (c) Copyright 2018 Hewlett Packard Enterprise Development LP
#
# 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 applicab... | 1.851563 | 2 |
ir_axioms/axiom/cache.py | webis-de/ir_axioms | 11 | 46834 | <filename>ir_axioms/axiom/cache.py
from dataclasses import dataclass
from diskcache import Cache
from ir_axioms.axiom.base import Axiom
from ir_axioms.model import RankedDocument, Query, IndexContext
@dataclass(frozen=True)
class CachedAxiom(Axiom):
axiom: Axiom
disk: bool = False
def _key(
... | 2.375 | 2 |
addons/loop.py | noirscape/Kurisu | 0 | 46835 | import asyncio
import copy
import discord
import feedparser
import sys
import time
import datetime
import traceback
import os
import json
from discord.ext import commands
from urllib.parse import urlparse, parse_qs
class Loop:
"""
Loop events.
"""
def __init__(self, bot):
self.bot = bot
... | 2.4375 | 2 |
lilac/__init__.py | mba811/lilac | 1 | 46836 | <filename>lilac/__init__.py
# coding=utf8
#
# OOO$QHHHQ$$$$$$$$$QQQHHHHNHHHNNNNNNNNNNN
# OO$$QHHNHQ$$$$$O$$$QQQHHHNNHHHNNNNNNMNNN
# $$$QQHHHH$$$OOO$$$$QQQQHHHHHHHNHNNNMNNNN
# HHQQQHHH--:!OOO$$$QQQQQQQHHHHHNNNNNNNNNN
# NNNHQHQ-;-:-:O$$$$$QQQ$QQQQHHHHNNNNNNNNN
# NMNHHQ;-;----:$$$$$$$:::OQHHHHHNNNNHHNNN
# NNNHH;;;-----:C$... | 1.492188 | 1 |
tests/unit/metadata/test_table.py | bjg290/SDV | 0 | 46837 | from unittest.mock import Mock, patch
import pandas as pd
import pytest
from faker import Faker
from faker.config import DEFAULT_LOCALE
from rdt.transformers.numerical import NumericalTransformer
from sdv.constraints.base import Constraint
from sdv.constraints.errors import MissingConstraintColumnError
from sdv.error... | 2.375 | 2 |
kensu/client/models/field_def.py | vidma/kensu-py | 16 | 46838 | <reponame>vidma/kensu-py
# coding: utf-8
"""
No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
OpenAPI spec version: beta
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from pprint import pformat
from six import iterit... | 2.046875 | 2 |
computing/ch03-budget-app/budget.py | chaudha4/python-projects | 0 | 46839 | <filename>computing/ch03-budget-app/budget.py
class Category:
def __init__(self, category):
self.name = category
self.ledger = [] # Each entry is a dictionary
self.ledger1 = [] # Each entry is an array
self.balance = 0
self.withdrawals = 0
def deposit(self, amt, desc=... | 3.609375 | 4 |
client/console/task_cs.py | eonuallain/dcomp | 0 | 46840 | from task_base import TaskBase
class TaskCS(TaskBase):
def run(self):
print(self)
| 1.679688 | 2 |
mielelogic/__init__.py | PTST/MieleLogic | 0 | 46841 | from .miele import *
| 1.140625 | 1 |
chemical_formula_to_reading_periodic_table.py | tomo835g/Deep-Learning-to-find-Superconductors | 4 | 46842 | import torch
import numpy as np
import torch.nn as nn
import torch.nn.functional as F
import os
from pymatgen import Composition
class TransformReadingPeriodicTable():
def __init__(self, formula=None, rel_cif_file_path='write cif file path', data_dir='../data'):
self.formula = formula
self.allowed... | 2.296875 | 2 |
spotpy/database/sql.py | cheginit/spotpy | 182 | 46843 | <filename>spotpy/database/sql.py
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import numpy as np
import sqlite3
import sys
from .base import database
if sys.version_info[0] >= 3:
unicode = str
class Pickalable... | 2.515625 | 3 |
nominations/migrations/0001_initial.py | ewjoachim/pythondotorg | 911 | 46844 | <gh_stars>100-1000
# Generated by Django 2.0.9 on 2019-03-18 20:21
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
import markupfield.fields
class Migration(migrations.Migration):
initial = True
dependencies = [migrations.swappable_dependency(setti... | 1.710938 | 2 |
Lib/Scripts/font/layers/import.py | gferreira/hTools2 | 11 | 46845 | # [h] import ufo into layer
import hTools2.dialogs.font.layer_import
reload(hTools2.dialogs.font.layer_import)
from hTools2.dialogs.font.layer_import import importUFOIntoLayerDialog
importUFOIntoLayerDialog()
| 1.101563 | 1 |
neighbor/migrations/0002_auto_20210412_2210.py | LewisNjagi/neighborhood | 0 | 46846 | <gh_stars>0
# Generated by Django 3.2 on 2021-04-12 22:10
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('neighbor', '0001_initial'),
]
operations = [
migrations.AlterField(
model_name='busin... | 1.664063 | 2 |
home_application/biz_utils.py | kevinwen24/examPorject | 0 | 46847 | # -*- coding: utf-8 -*-
import json
import requests
from django.utils.translation import ugettext as _
from django.utils import translation
from django.core.cache import cache
from common.log import logger
from conf.default import APP_ID, APP_TOKEN, BK_PAAS_HOST
from constants import (HEADERS)
def get_data_by_api(... | 2 | 2 |
pylps/core.py | astraldawn/pylps | 1 | 46848 | <filename>pylps/core.py
from pylps.constants import *
from pylps.config import CONFIG
from pylps.kb import KB
from pylps.engine import ENGINE
from pylps.lps_objects import GoalClause, Observation, ReactiveRule
import pylps.creator as creator
''' Declarations '''
def create_actions(*args, return_obj=False):
re... | 2.03125 | 2 |
livia/input/FrameInputDecorator.py | sing-group/livia-core | 0 | 46849 | from abc import ABC, abstractmethod
from typing import Tuple, Optional
from numpy import ndarray
from livia.input.FrameInput import FrameInput
class FrameInputDecorator(FrameInput, ABC):
def __init__(self, decorated_input: FrameInput):
super().__init__()
self._decorated_input: FrameInput = deco... | 2.671875 | 3 |
pyuwb/client_id_utils.py | Jiangshan00001/pyuwb | 1 | 46850 | __author__ = "songjiangshan"
__copyright__ = "Copyright (C) 2021 songjiangshan \n All Rights Reserved."
__license__ = ""
__version__ = "1.0"
DEVICE_TYPE_TAG=0 #OLD3
DEVICE_TYPE_ANCHOR=1 #OLD2
DEVICE_TYPE_ANCHORZ=2 #OLD1
def client_id_remove_group(client_id):
return str(client_id_get_type(client_id)) + '-' + str(... | 2.65625 | 3 |
minesweep_python3.py | andonis1616/python_minesweep | 0 | 46851 | <gh_stars>0
import random
from os import system, name
dx = [-1,-1,-1,0,0,1,1,1]
dy = [-1,0,1,-1,1,-1,0,1]
def user_input(text):
if text != "":
while True:
try:
val = int(input(text))
return val
except ValueError:
print("You must enter a number!")
else:
while True:
try:
val = int... | 3.625 | 4 |
tests/test_k2.py | LanzLagman/chronos | 0 | 46852 | <filename>tests/test_k2.py
# -*- coding: utf-8 -*-
import pandas as pd
import lightkurve as lk
from chronos.k2 import K2, Everest, K2sff
EPICID = 211916756 # k2-95
CAMPAIGN = 5 # or 18
def test_k2_attributes():
"""
"""
# test inherited attributes
s = K2(epicid=EPICID, campaign=CAMPAIGN)
assert ... | 2.234375 | 2 |
ch22-直方图/22.3.4.hsv_hist-绘制2D直方图.py | makelove/OpenCV-Python-Tutorial | 2,875 | 46853 | <filename>ch22-直方图/22.3.4.hsv_hist-绘制2D直方图.py
# -*-coding:utf8-*-#
__author__ = 'play4fun'
"""
create time:15-11-8 下午4:44
绘制2D直方图
"""
import cv2
import numpy as np
from matplotlib import pyplot as plt
img = cv2.imread('../data/home.jpg')
# cv2.imshow("src", img)
hsv = cv2.cvtColor(img, cv2.COLOR_BGR2HSV)
hist = cv2.... | 2.765625 | 3 |
joinnector/service/lead_service.py | joinnector/rewardpythonsdk | 0 | 46854 | <reponame>joinnector/rewardpythonsdk
# pylint: disable=useless-super-delegation
from joinnector.service.base_sdk_service import BaseSDKService
class LeadService(BaseSDKService):
def __init__(self, name):
super().__init__(name)
def get_by_customer_id(self, customer_id, swap_id=None):
return s... | 1.914063 | 2 |
sylver/backend/postgres.py | jdclarke5/sylver | 0 | 46855 | <reponame>jdclarke5/sylver
"""PostgreSQL backend."""
from .backend import BaseBackend
import psycopg2
from psycopg2 import sql
class PostgresBackend(BaseBackend):
def __init__(self, connection_string):
"""Initialise PostgreSQL connection with a valid libpq connection
string. Create the `positio... | 2.890625 | 3 |
apitest/api_test/migrations/0012_auto_20200219_1756.py | willhuang1206/apitest | 0 | 46856 | <filename>apitest/api_test/migrations/0012_auto_20200219_1756.py
# Generated by Django 2.0.2 on 2020-02-19 17:56
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('api_test', '0011_apiautomationcoverage_num'),
]
op... | 1.625 | 2 |
submission/counter_reactionary.py | leomaurodesenv/rock-paper-scissors-kaggle | 0 | 46857 |
import random
from kaggle_environments.envs.rps.utils import get_score
last_counter_action = None
def counter_reactionary(observation, configuration):
global last_counter_action
if observation.step == 0:
last_counter_action = random.randrange(0, configuration.signs)
elif get_score(last_counter_a... | 2.546875 | 3 |
molesq/transform.py | clbarnes/molesq | 4 | 46858 | <filename>molesq/transform.py
import sys
import numpy as np
from scipy.spatial.distance import cdist
from typing import Optional
from numpy.typing import ArrayLike
# try:
# from enum import StrEnum
# except ImportError:
# from backports.strenum import StrEnum
# class Strategy(StrEnum):
# AFFINE = "aff... | 2.640625 | 3 |
tests/test_moleculerize.py | rcbops/moleculerize | 3 | 46859 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# ======================================================================================================================
# Imports
# ======================================================================================================================
import json
import ya... | 1.5 | 2 |
python3-simple-http-server/simple_http_server/protocols.py | t2y/simple-http-server | 9 | 46860 | <reponame>t2y/simple-http-server
import argparse
import logging
import os.path
from asyncio.streams import StreamReader, StreamWriter
from typing import Awaitable, Callable, Optional
from .handler import handle_request
from .parser import parse_http
log = logging.getLogger('simple-http-server')
def http(
ar... | 2.859375 | 3 |
PyFlowPackages/PyFlowFreeCAD/Nodes/FreeCAD_Object.py | awgrover/NodeEditor | 53 | 46861 | <reponame>awgrover/NodeEditor
'''
all still not categorized nodes
'''
from PyFlow.Packages.PyFlowFreeCAD.Nodes import *
from PyFlow.Packages.PyFlowFreeCAD.Nodes.FreeCAD_Base import timer, FreeCadNodeBase, FreeCadNodeBase2
class FreeCAD_Tube(FreeCadNodeBase2):
'''
calculate the points for a parametric tube al... | 2.078125 | 2 |
WebMirror/management/rss_parser_funcs/feed_parse_extractExpandablefemaleBlogspotCom.py | fake-name/ReadableWebProxy | 193 | 46862 | def extractExpandablefemaleBlogspotCom(item):
'''
DISABLED
Parser for 'expandablefemale.blogspot.com'
'''
return None | 1.367188 | 1 |
django_cradmin/demo/project/test/settings.py | appressoas/django_cradmin | 11 | 46863 | <reponame>appressoas/django_cradmin<filename>django_cradmin/demo/project/test/settings.py
"""
Django settings for running the django_cradmin tests.
"""
from django_dbdev.backends.sqlite import DBSETTINGS
# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = '<KEY>'
# SECURITY WARNING: don't ... | 1.632813 | 2 |
archive/tournament.py | maxwilliams94/ultimatePy | 1 | 46864 | from archive.groups import Group
from archive.teams import Team
from logging import Logging
from itertools import cycle
import datetime
from copy import deepcopy
from sys import exit
import collections
from os import path, getcwd
class Tournament:
"""
Store (and initialise) dictionary and storage structures
... | 2.6875 | 3 |
demo/demo/tagging_data_view.py | RayL0707/Finance_KG | 0 | 46865 | <filename>demo/demo/tagging_data_view.py<gh_stars>0
# -*- coding: utf-8 -*-
from django.shortcuts import render
from django.views.decorators import csrf
import thulac
import sys
sys.path.append("..")
from toolkit.pre_load import neo_con
# 数据标注页面的view
# 接收GET请求数据
def showtagging_data(request):
ctx = {}
if 'title' in... | 2.296875 | 2 |
blog/migrations/0002_auto_20190719_0620.py | Sedherthe/Dj-Blog | 0 | 46866 | # Generated by Django 2.1.4 on 2019-07-19 00:50
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('blog', '0001_initial'),
]
operations = [
migrations.RenameField(
model_name='post',
old_name='data_published',
n... | 1.710938 | 2 |
mnist/configs/resnet18.py | anisayari/pipeline | 1 | 46867 | from .base import ConfigMNISTBase
from pipeline.models.classification import ClassificationModuleLinear
from pipeline.models.image_classification import Resnet18Model
import torch.nn as nn
class Config(ConfigMNISTBase):
def __init__(self):
model = nn.Sequential(
Resnet18Model(),
... | 2.28125 | 2 |
src/multimodal/models/train_model.py | markrofail/multi-modal-deep-learning-for-vehicle-sensor-data-abstraction-and-attack-detection | 0 | 46868 | <gh_stars>0
import os
import pickle
import click
import numpy as np
from tensorflow.python import keras
from tensorflow.python.keras import backend as K
from tensorflow.python.keras import callbacks
import src.helpers.keras as kh
from src.helpers import paths, timeit
from src.helpers.keras import early_stopping
from ... | 2.09375 | 2 |
lav/train_bev.py | Kin-Zhang/LAV | 122 | 46869 | import tqdm
import torch
from lav.lav_privileged import LAV
from lav.utils.datasets import get_data_loader
from lav.utils.logger import Logger
def main(args):
dmd = LAV(args)
data_loader = get_data_loader('bev', args)
logger = Logger('lav_bev', args)
save_dir = logger.save_dir
torch.manual_seed(a... | 2.046875 | 2 |
timm/models/factory.py | Annonymous-code-release/HardCore-NAS | 30 | 46870 | import torch.utils.model_zoo as model_zoo
from .registry import is_model, is_model_in_modules, model_entrypoint
from .helpers import load_checkpoint
from .layers import set_layer_config
def create_model(
model_name,
pretrained=False,
num_classes=1000,
in_chans=3,
checkpoint_path='',
scriptable... | 2.21875 | 2 |
sample-asyncio/async_requests.py | IvanDemin3467/sample-asyncio | 0 | 46871 | #!/usr/bin/env python3
# async_requests.py
"""Asynchronously get links embedded in multiple pages' HTML."""
import asyncio
import logging
import re
import sys
# from typing import IO # Use pathlib instead
import urllib.error
import urllib.parse
import aiofiles
import aiohttp
from aiohttp import ClientSession
impor... | 3 | 3 |
python/magic-8-ball.py | CindyMullins/intro-to-open-source | 16 | 46872 | <reponame>CindyMullins/intro-to-open-source
import random
import time
responses = ["Not so sure", "Shitty", "Great", "Absolutely not", "Outlook is good", "I see good things happening", "Never", "Negative", "Could be", "Unclear, ask again", "Yes definitely", "No, Idon't think so"]
## Following function asks user questi... | 3.796875 | 4 |
DJangoHotel/viewspackage/roomInfoView.py | chuangkee/mygithub | 0 | 46873 | # -*- coding: utf-8 -*-
from django.shortcuts import render
from qiniuyun.backend import QiniuPush
from qiniuyun.models import ImageAtQiniu
from .indexView import ImgList
from DJangoHotel.models import RoomInfo
def roomInfo(request):
rooms=RoomInfo.objects.all()
imgObjs=ImageAtQiniu.objects.all()
imgUrls=... | 2.25 | 2 |
01-face-detection.py | ShawnHymel/face-tracking-camera-openmv | 0 | 46874 | import pyb
import sensor
import image
import time
# Status LED
led = pyb.LED(3)
# Configure camera
sensor.reset()
sensor.set_contrast(3)
sensor.set_gainceiling(16)
sensor.set_framesize(sensor.QVGA)
sensor.set_pixformat(sensor.GRAYSCALE)
# Get center x, y of camera image
WIDTH = sensor.width()
HEIGHT = sensor.height(... | 2.796875 | 3 |
src/app/user/models.py | jamshidyerzakov/fastapi-blog | 0 | 46875 | from tortoise import fields, models
class User(models.Model):
""" Model user """
username = fields.CharField(max_length=100, unique=True)
password = fields.CharField(max_length=100)
email = fields.CharField(max_length=100, unique=True)
first_name = fields.CharField(max_length=100)
last_name = ... | 2.59375 | 3 |
models/impact.py | ptressel/sahana-eden-madpub | 1 | 46876 | # -*- coding: utf-8 -*-
"""
Impact
@author: <NAME> (<EMAIL>)
@date-created: 2010-10-12
Impact resources used by I(ncident)RS and Assessment
"""
module = "impact"
if deployment_settings.has_module("irs") or deployment_settings.has_module("assess"):
# --------------------------------... | 1.757813 | 2 |
punica/cli/box_cmd.py | PunicaSuite/punica-python | 6 | 46877 | import webbrowser
from ontology.exception.exception import SDKException
from click import (
argument,
pass_context
)
from .main import main
from punica.box.repo_box import Box
from punica.utils.output import echo_cli_exception
from punica.exception.punica_exception import PunicaException
@main.command('unb... | 2.28125 | 2 |
Module 1/task1_5.py | bondss/python_scripts | 0 | 46878 | <filename>Module 1/task1_5.py<gh_stars>0
# TASK:
# Вхідні дані: ціле невід'ємне число n. Передається в програму як аргумент командного
# рядка.
# Результат роботи: значення n-го числа послідовності Фібоначчі. Не використовувати рекурсію
# SOLUTION:
# Importing modules to work with embedded functions
import sys
n = in... | 3.75 | 4 |
mawiparse/download.py | zouchengyao/MAWI_trace | 0 | 46879 | import sys
from datetime import date, timedelta
import requests
def date_gen(d1, d2):
# d1 = date(2020, 5, 1)
# d2 = date(2020, 5, 31)
delta = d2 - d1
return [(d1 + timedelta(days=i)).strftime('%Y%m%d') for i in range(delta.days + 1)]
def download_by_dates(date_list):
for date_to_download in da... | 3.296875 | 3 |
moceansdk/modules/command/content_builder/wa_photo_content_builder.py | d3no/mocean-sdk-python | 0 | 46880 | <gh_stars>0
from moceansdk.modules.command.content_builder.wa_rich_media_content_builder_basic import WaRichMediaContentBuilderBasic
class WaPhotoContentBuilder(WaRichMediaContentBuilderBasic):
def type(self):
return 'photo' | 1.90625 | 2 |
project4/route_planner/shortest_path.py | jurayev/algorithms-datastructures-udacity | 1 | 46881 | from heapq import heapify, heappush, heappop
from collections import defaultdict
import math
def shortest_path(M, start, goal):
frontier = {start}
explored = set()
came_from = dict()
f_costs = get_initial_f_costs(M, start, goal) # heapq type
g_costs = get_initial_g_costs(start) # defaultdict typ... | 3.8125 | 4 |
tests/functional/test_tools.py | luciddg/auth-tool | 8 | 46882 | # -*- coding: utf-8 -*-
import cherrypy
from jinja2 import Template
import mock
from tests.utils import BaseToolsTest
from lib.tool.allowed_methods import AllowedMethodsTool
from lib.tool.cpemail import EmailTool
from lib.tool.template import Jinja2Tool
class TestAllowedMethods(BaseToolsTest):
_cp_config = {
... | 2.109375 | 2 |
instanotifier/taskapp/celery.py | chaudbak/instanotifier | 0 | 46883 | import os
import logging
import stackprinter
from celery import Celery, Task
from celery.schedules import crontab
from django.apps import apps, AppConfig
from django.conf import settings
if not settings.configured:
# set the default Django settings module for the 'celery' program.
os.environ.setdefault(
... | 2.03125 | 2 |
src/encoded/audit/reference_epigenome.py | KCL-ORG/encoded | 4 | 46884 | from snovault import (
AuditFailure,
audit_checker,
)
@audit_checker('ReferenceEpigenome', frame=['related_datasets',
'related_datasets.replicates',
'related_datasets.replicates.library',
... | 2.15625 | 2 |
geolang/__init__.py | Lh4cKg/simple-geolang-toolkit | 6 | 46885 | <reponame>Lh4cKg/simple-geolang-toolkit<gh_stars>1-10
# -*- coding: utf-8 -*
"""
Georgian Language Toolkit for Python 3
Source: <https://github.com/Lh4cKg/simple-geolang-toolkit>
"""
import re
from typing import Dict, Any, Iterable, Union, List, Tuple
from functools import lru_cache, partial
from unicodedata import ... | 2.859375 | 3 |
advent-of-code/aoc-2020/helpers.py | ikumen/problems-solvers | 0 | 46886 | <reponame>ikumen/problems-solvers
import os
def get_data_file_path(filepath):
return os.path.join(
os.path.dirname(filepath),
f"{os.path.splitext(os.path.basename(filepath))[0]}.txt")
| 2.25 | 2 |
extract_t_production_map.py | RemDelaporteMathurin/T_transport_LIBRA | 0 | 46887 | import openmc
from scipy import interpolate
import matplotlib.pyplot as plt
from matplotlib.colors import LogNorm
from matplotlib import ticker
import matplotx
import numpy as np
import scipy.ndimage as ndimage
def reshape_values_to_mesh_shape(tally, values):
mesh_filter = tally.find_filter(filter_type=openmc.Mes... | 2.3125 | 2 |
python/project_kine/kine.py | OthmanEmpire/misc_code | 0 | 46888 | <reponame>OthmanEmpire/misc_code<filename>python/project_kine/kine.py
################################################################################
# Author: <NAME> #
# Year Initiated: 2012 #
# ... | 2.640625 | 3 |
cucm_cdr_email_alerts.py | nithinmulley/CUCM_CDR_Email_Alert | 2 | 46889 | <gh_stars>1-10
#!/usr/bin/python3
###############################################################################
# This Script searches for 911 calls in the CDR Dump and sends an email alert #
# with the required details. It can also check GW names and send alert only #
# to the site specific personnel. CUCM AXL... | 2.171875 | 2 |
homebrain/agents/devicemanager/devicemanager.py | ErikBjare/Homebrain | 1 | 46890 | <reponame>ErikBjare/Homebrain
from homebrain import Agent, Dispatcher, AgentManager
from homebrain.core.decorators import stop_on_shutdown_event
from lamphandler import LampHandler
from ttshandler import TTSHandler
from idfilter import IDFilter
import logging
class DeviceManager(Agent):
autostart = True
de... | 2.1875 | 2 |
core/logger.py | nragon/keeper | 28 | 46891 | # -*- coding: utf-8 -*-
"""
Provides base logging functions
:copyright: © 2018 by <NAME>
:license: MIT, see LICENSE for more details.
"""
from logging import getLevelName, INFO, WARN, ERROR, DEBUG
from multiprocessing import current_process
from time import strftime
from core.common import load_config
from... | 2.875 | 3 |
terms_finder/__init__.py | elderdk/pyxliff | 2 | 46892 | <reponame>elderdk/pyxliff
# -*- coding: utf-8 -*-
# pyxliff/__init__.py
"""Provides useful functions for SDLXliff terms verification and discovery."""
__version__ = "0.1.0"
| 0.804688 | 1 |
selene_sdk/targets/tests/test_genomic_features.py | msindeeva/selene | 307 | 46893 | <gh_stars>100-1000
import os
import unittest
import numpy as np
from selene_sdk.targets import GenomicFeatures
from selene_sdk.targets.genomic_features import _any_positive_rows, \
_is_positive_row, _get_feature_data
class TestGenomicFeatures(unittest.TestCase):
def setUp(self):
self.features = [
... | 2.3125 | 2 |
BotAPI/apps.py | hanihusam/kitabisa-faqBot-api | 0 | 46894 | <filename>BotAPI/apps.py
from django.apps import AppConfig
class BotapiConfig(AppConfig):
name = 'BotAPI'
| 1.414063 | 1 |
codewar/4 By 4 Skyscrapers -2k/4 By 4 Skyscrapers.py | z7211979/practise-Python | 1 | 46895 | <gh_stars>1-10
#!/usr/bin/python3
# -*- coding: utf-8 -*-
'''
not worked
'''
import sys
sys.path.append('../')
import cw as test
import time
N=4
def rotate(matrix):
"""
:contrarotate matrix.
"""
return list(map(list,zip(*matrix[::])))[::-1]
def visible_onerow(array):
"""
:return vis... | 3.3125 | 3 |
setup.py | madhav-datt/seeyourmail | 1 | 46896 | <filename>setup.py
from distutils.core import setup
setup(
name='seeyourmail',
packages=['seeyourmail'],
version='1.0',
description='seeyourmail makes retrieving and checking your email in programs as simple as can be',
author='<NAME>',
author_email='<EMAIL>',
url='https://github.com/madha... | 1.328125 | 1 |
setup.py | vinmorel/MapleWrapper | 16 | 46897 | <reponame>vinmorel/MapleWrapper<filename>setup.py
from setuptools import setup
description = """MapleWrapper allows real-time game data extraction for MapleStory v.92 and below
clients. It is primarily intended to facilitate the production of reinforcement learning environments
for game agents.
For more information... | 1.414063 | 1 |
nanoblocks/base/nanoblocks_class.py | ipazc/nanoblocks | 3 | 46898 | <gh_stars>1-10
class NanoblocksClass:
"""
Global class that should be inherited by any Nanoblocks class that requires access to the network.
"""
def __init__(self, nano_network):
self._nano_network = nano_network
@property
def network(self):
return self._nano_network
@pro... | 2.734375 | 3 |
service/watch_tower.py | sroy96/Stock_Price_Notification | 2 | 46899 | from interfaces.interface import Publisher, stock_list
from utils.notifier import NotificationUtils
from service.loader import LoadStock
from utils import cache_util, common_constants
class WatchTower(Publisher):
state = 0
observser_list = list()
def __init__(self, stock_val):
self.stock_val = st... | 2.53125 | 3 |