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 |
|---|---|---|---|---|---|---|
backend/entities/i_serializable.py | GroupLe/grouple-face-tagger | 0 | 12766051 | <filename>backend/entities/i_serializable.py
from typing import Dict
class ISerializable:
def __init__(self, *args, **kwargs):
raise NotImplemented
def to_json(self) -> Dict:
raise NotImplemented | 2.203125 | 2 |
tests/core/test_test.py | adrianvisovan/rasa | 0 | 12766052 | from pathlib import Path
import pytest
import rasa.core.test
from _pytest.capture import CaptureFixture
from rasa.core.agent import Agent
async def test_testing_warns_if_action_unknown(
capsys: CaptureFixture,
e2e_bot_agent: Agent,
e2e_bot_test_stories_with_unknown_bot_utterances: Path,
):
await rasa... | 2.328125 | 2 |
demo.py | Tilix4/cgwire-demo | 0 | 12766053 | <reponame>Tilix4/cgwire-demo
import os
import random
import gazu
gazu.set_host("http://localhost:8080/api")
gazu.log_in("<EMAIL>", "<PASSWORD>tp<PASSWORD>")
persons = [
{
"first_name": "Alicia",
"last_name": "Cooper",
"email": "<EMAIL>",
"phone": "+33 6 82 38 19 08",
... | 2.234375 | 2 |
stompy/model/delft/dfm_to_ptm.py | rustychris/stompy | 17 | 12766054 | <reponame>rustychris/stompy
"""
Augment DFM/DWAQ output so that it can be used as hydro input
for FISH-PTM.
in FISH_PTM.inp, set subgrid bathy to false.
Requirements on the run:
DFM and DWAQ output must be synchronized, with the same start/stop/interval
settings. In most cases this just means that MapInterval an... | 1.257813 | 1 |
wsabie.py | xdshang/wsabie | 19 | 12766055 | from itertools import cycle
import numpy as np
from scipy import sparse
import h5py
from evaluation import load_nuswide, normalize
rng = np.random.RandomState(1701)
transformer = []
batch_size = 100
def load():
_, label, _, label_name, _, data = load_nuswide('nuswide-decaf.npz', 'train')
data = data.toarray()
d... | 2.1875 | 2 |
release/stubs.min/System/Windows/Forms/__init___parts/ToolStripItemEventArgs.py | YKato521/ironpython-stubs | 0 | 12766056 | <filename>release/stubs.min/System/Windows/Forms/__init___parts/ToolStripItemEventArgs.py
class ToolStripItemEventArgs(EventArgs):
"""
Provides data for System.Windows.Forms.ToolStripItem events.
ToolStripItemEventArgs(item: ToolStripItem)
"""
def __getitem__(self, *args):
""" x.__geti... | 1.765625 | 2 |
xlib/avecl/_internal/info/TileInfo.py | jkennedyvz/DeepFaceLive | 3 | 12766057 | import numpy as np
from ..AShape import AShape, AShape
class TileInfo:
"""
Tile info.
arguments
shape AShape
tiles Iterable of ints
errors during the construction:
ValueError
result:
.o_shape AShape
.axes_slices list of slice() to fetch origi... | 2.609375 | 3 |
data/data_utils.py | stalhabukhari/HDC-Net | 23 | 12766058 | import random
import pickle
import numpy as np
import torch
M = 2**32 - 1
def init_fn(worker):
seed = torch.LongTensor(1).random_().item()
seed = (seed + worker) % M
np.random.seed(seed)
random.seed(seed)
def add_mask(x, mask, dim=1):
mask = mask.unsqueeze(dim)
shape = list(x.shape); shape[di... | 2.28125 | 2 |
main.py | Magicalbat/Tilemap-Editor | 0 | 12766059 | <reponame>Magicalbat/Tilemap-Editor
import pygame
pygame.init()
width = int(320 * 3)
height = int(180 * 3)
win = pygame.display.set_mode((width, height), pygame.SCALED | pygame.RESIZABLE, 8)
pygame.display.set_caption("Tilemap Editor")
clock = pygame.time.Clock()
fps = 60
import json, copy, sys, os, math
from easyg... | 2.796875 | 3 |
upbit/migrations/0016_auto_20210618_0735.py | lindychi/longbit | 0 | 12766060 | <filename>upbit/migrations/0016_auto_20210618_0735.py
# Generated by Django 3.2 on 2021-06-18 07:35
import datetime
from django.db import migrations, models
from django.utils.timezone import utc
class Migration(migrations.Migration):
dependencies = [
('upbit', '0015_auto_20210618_0725'),
]
oper... | 1.679688 | 2 |
smartshark/migrations/0006_auto_20160607_1703.py | benjaminLedel/serverSHARK | 1 | 12766061 | # -*- coding: utf-8 -*-
# Generated by Django 1.9.7 on 2016-06-07 15:03
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('smartshark', '0005_auto_20160607_1657'),
]
operatio... | 1.664063 | 2 |
iiopoll2Influx.py | wiederma/roomclimate | 0 | 12766062 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
'''
Requires python3 package for influxDB to import InfluxDBClient:
sudo apt install python3-influxdb
API documentation for python InfluxDBClient:
https://influxdb-python.readthedocs.io/en/latest/api-documentation.html#
users = db_client.get_list_users()
print (users)
... | 2.8125 | 3 |
my_app/__main__.py | fschuch/fastapi_project | 0 | 12766063 | <gh_stars>0
import uvicorn
from . import app
uvicorn.run(app) | 1.125 | 1 |
botlet/utils/queue.py | Youka/botlet | 0 | 12766064 | <reponame>Youka/botlet<filename>botlet/utils/queue.py
""" Convenience queues """
from queue import Empty, Full, Queue
from typing import Generic, Optional, TypeVar
# Any type variable for following generics
T = TypeVar('T') # pylint: disable=C0103
class SafeQueue(Generic[T]):
""" Thread-safe queue simplified... | 2.609375 | 3 |
tests/test_set_questions_file_path.py | MTelford/diary-tool | 0 | 12766065 | <filename>tests/test_set_questions_file_path.py
import unittest
import pathlib
from diary_tool_main.diary_tool import set_questions_file_path
class TestSetQuestionsFilePath(unittest.TestCase):
def test_set_questions_file_path(self):
"""
Tests that function sets file path for questions
corr... | 3.0625 | 3 |
models/mlhead_clus_server.py | caifederated/mlhead-release | 1 | 12766066 | <filename>models/mlhead_clus_server.py
# This is my code to train n model and saved them
import random
import os
import tensorflow as tf
import numpy as np
import shutil
import tempfile
from tensorflow.python import pywrap_tensorflow
from baseline_constants import BYTES_WRITTEN_KEY, BYTES_READ_KEY, LOCAL_COMPUTATION... | 2.765625 | 3 |
ml/rl/polyfill/decorators.py | sailfish009/ReAgent | 0 | 12766067 | #!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates. All rights reserved.
class ClassPropertyDescriptor:
def __init__(self, fget):
self.fget = fget
def __get__(self, obj, klass=None):
if klass is None:
klass = type(obj)
return self.fget.__get__(obj, kl... | 3.109375 | 3 |
wt-app/apps/wt_articles/management/commands/import_turk_result.py | NickRuiz/wikitrans | 1 | 12766068 | <reponame>NickRuiz/wikitrans
from django.db.transaction import commit_on_success
from django.core.management.base import BaseCommand
from django.core.management.color import no_style
from django.utils.encoding import smart_str
from wt_articles.models import SourceSentence, SourceArticle, TranslatedSentence, Translated... | 2.171875 | 2 |
example_site/example_site/urls.py | madtreat/django-address | 0 | 12766069 | <gh_stars>0
from django.contrib import admin
from django.urls import path
from person import views as person
urlpatterns = [
path('', person.home, name='home'),
path('admin/', admin.site.urls),
]
| 1.609375 | 2 |
MineAchieve.py | VanderCat/QuoteVkBot | 0 | 12766070 | <reponame>VanderCat/QuoteVkBot<gh_stars>0
#32 + txtw + 6
#bottom offset 17
from PIL import ImageFont, Image, ImageDraw, ImageFilter
import os
import random
def text_wrap(text,font,writing,max_width):
lines = [[]]
words = text.split()
for word in words:
# try putting this word in last li... | 2.65625 | 3 |
test/test_harness.py | DivyanshuLohani/doctor | 11 | 12766071 | <reponame>DivyanshuLohani/doctor<filename>test/test_harness.py
import pytest
from doctor.docs.base import BaseHarness
from doctor.resource import ResourceAnnotation
from .types import Age, Color, ItemId, Name
from .utils import add_doctor_attrs
@pytest.fixture
def annotation():
def logic(age: Age, name: Name, i... | 2.359375 | 2 |
tests/data/pipeline/test_regex.py | vikigenius/fintopics | 0 | 12766072 | # -*- coding: utf-8 -*-
import pytest
from fintopics.data.pipeline.regex import RegexExtractionPipeline
@pytest.fixture()
def regex_pipeline():
"""Creates a RegexExtractionPipeline fixture."""
return RegexExtractionPipeline()
@pytest.mark.asyncio
async def test_header_removal(datadir, regex_pipeline):
... | 2.46875 | 2 |
funnel/views/__init__.py | jace/goafunnel | 0 | 12766073 | # -*- coding: utf-8 -*-
from .index import *
from .login import *
from .space import *
from .section import *
from .usergroup import *
from .proposal import *
from .commentvote import *
from .venue import *
from .schedule import *
from .session import *
| 1.03125 | 1 |
modules/callbacks.py | jeusgao/jobot_factory_nlp_simple | 0 | 12766074 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Date : 2021-01-05 14:57:15
# @Author : <NAME> (<EMAIL>)
import os
import json
import time
from backend import keras
class TrainingCallbacks(keras.callbacks.Callback):
def __init__(self, task_path='', log_name='training'):
self.task_path = task_path
... | 2.453125 | 2 |
copulpy/clsCES.py | briqInstitute/copulpy | 1 | 12766075 | """Provide the constant elasticity of substitution function."""
import numpy as np
from copulpy.config_copulpy import IS_DEBUG
from copulpy.clsMeta import MetaCls
class CESCls(MetaCls):
"""CES class."""
def __init__(self, alpha, y_weight, discount_factor):
"""Initialize class."""
self.attr =... | 2.625 | 3 |
SimpleCV/examples/manipulation/RotationExample.py | nikhilgk/SimpleCV | 2 | 12766076 | #!/usr/bin/python
from SimpleCV import *
from numpy import linspace
from scipy.interpolate import UnivariateSpline
import sys, time, socket
#settings for the project)
srcImg = "../../sampleimages/orson_welles.jpg"
font_size = 20
sleep_for = 3 #seconds to sleep for
draw_color = Color.RED
while True:
image = Im... | 2.75 | 3 |
scoreboard_auroc.py | nialky/credef | 0 | 12766077 | <gh_stars>0
from sklearn.metrics import classification_report, accuracy_score
import matplotlib.pyplot as plt
from sklearn.metrics import roc_curve, plot_roc_curve, roc_auc_score
ax = plt.gca()
for i in classifiers:
i.fit(X_balanced, y_balanced)
plot_roc_curve(i, X_test_balanced, y_test_balanced, ax = ax)
... | 2.671875 | 3 |
pySDC/projects/FastWaveSlowWave/plot_stifflimit_specrad.py | brownbaerchen/pySDC | 20 | 12766078 | <gh_stars>10-100
import matplotlib
matplotlib.use('Agg')
import numpy as np
from matplotlib import pyplot as plt
from pylab import rcParams
from pySDC.implementations.problem_classes.FastWaveSlowWave_0D import swfw_scalar
from pySDC.implementations.sweeper_classes.imex_1st_order import imex_1st_order
from pySDC.imple... | 2.34375 | 2 |
misc/dosvfont.py | frank-deng/fun-ucdos | 16 | 12766079 | #!/usr/bin/env python3
import struct, sys, traceback;
if (len(sys.argv) < 4):
print("Usage: %s ANK16.FNT KANJI16.FNT FONT.BMP"%sys.argv[0]);
exit(1);
ank16 = None;
with open(sys.argv[1], 'rb') as f:
data = f.read();
ank16 = [data[i:i+16] for i in range(0, 256*16, 16)];
kanji16 = None;
charTable = {}... | 2.359375 | 2 |
expenseManager/app/frmPageReport.py | PacktPublishing/Python-Programming | 0 | 12766080 | from UtilGp import UtilGp
from dBase import ndb
from TranData import DbTranData
from frmPageShop import Shop
class Report:
@staticmethod
def show():
UtilGp.Login(Report.reportMenu, ndb.loadTranByItem,'Reports (Login)')
@staticmethod
def showDateRange():
UtilGp.sleep(2);UtilGp.clear();Uti... | 2.234375 | 2 |
plugins/show_source/show_source.py | likev/gauravssnl.github.io | 2 | 12766081 | import os
import logging
from six.moves.urllib.parse import urljoin
import six
from pelican import signals
from pelican.utils import pelican_open
if not six.PY3:
from codecs import open
logger = logging.getLogger(__name__)
source_files = []
PROCESS = ['articles', 'pages', 'drafts']
def link_source_files(generato... | 2.171875 | 2 |
main.py | darrenlee01/awap2021-public | 0 | 12766082 | <gh_stars>0
from game.game import Game
import time
BOARD_NAME = './board/board1.yaml'
def example_network_generator(station_locations, feedback):
network = {
0: [0, 1, 2],
1: [2, 3, 4, 2]
}
return network
if __name__ == '__main__':
# Load the board file with station locations/types
... | 3.46875 | 3 |
extras/utils.py | narutonz/analyser | 0 | 12766083 | <filename>extras/utils.py
from configparser import ConfigParser
from pymongo import MongoClient
from math import pow, sqrt
__author__ = '<NAME>'
__version__ = '1.5'
class Database(object):
def __init__(self, col_name):
self.client = MongoClient()
self.db = self.client['Tweets']
... | 2.59375 | 3 |
docs/configuration/properties.py | keotl/jivago | 12 | 12766084 | from jivago.config.properties.application_properties import ApplicationProperties
from jivago.inject.annotation import Component
from jivago.lang.annotations import Inject
@Component
class MyComponent(object):
@Inject
def __init__(self, application_properties: ApplicationProperties):
self.application... | 2.296875 | 2 |
u2pl/models/decoder.py | Haochen-Wang409/U2PL | 96 | 12766085 | import torch
import torch.nn as nn
from torch.nn import functional as F
from .base import ASPP, get_syncbn
class dec_deeplabv3(nn.Module):
def __init__(
self,
in_planes,
num_classes=19,
inner_planes=256,
sync_bn=False,
dilations=(12, 24, 36),
):
super(d... | 2.296875 | 2 |
address_parser/__init__.py | lenshin/address | 3 | 12766086 | from .parser import AddressParser | 1.132813 | 1 |
20211217/simulation_betas.py | dongxulee/lifeCycleRefine | 0 | 12766087 | <gh_stars>0
from simulation import *
import os.path
from multiprocessing import Pool
AgentType = ["poorHigh", "poorLow", "richHigh", "richLow"]
Beta_r = [0.01, 0.02, 0.03, 0.04, 0.05, 0.06, 0.07, 0.08, 0.09, 0.10]
Gamma = [3.0]
def mapOverBeta(beta_r):
for agentType in AgentType:
for gamma in Gamma:
... | 2.5 | 2 |
src/03_processing/process_reviews.py | williecostello/BetterReads | 2 | 12766088 | import argparse
import os
from process_utils import clean_reviews, make_sentences, clean_sentences
# Set script arguments
parser = argparse.ArgumentParser()
parser.add_argument('-g', '--goodreads', action='store_true', help='Set collection to GoodReads (as opposed to UCSD)')
args = parser.parse_args()
# Set whether t... | 2.921875 | 3 |
TensorRT/python/trt_run.py | xiaochus/DeepModelDeploy | 4 | 12766089 | import os
import numpy as np
import tensorrt as trt
from .utils import common, calibrator
class TRTModel:
def __init__(self, onnx_path, plan_path, mode="fp16", calibration_cache="calibration.cache",
calibration_dataset="", calibration_image_size="",
calibration_mean=[], calibra... | 2.28125 | 2 |
eclcli/network/v2/gateway_interface.py | hanasuke/eclcli | 32 | 12766090 | <filename>eclcli/network/v2/gateway_interface.py
from eclcli.common import command
from eclcli.common import utils
from ..networkclient.common import utils as to_obj
class ListGwInterface(command.Lister):
def get_parser(self, prog_name):
parser = super(ListGwInterface, self).get_parser(prog_name)
... | 2.265625 | 2 |
flask/migrations/versions/324666fdfa8a_.py | schinke/solid-fortnight-ba | 1 | 12766091 | """empty message
Revision ID: 324666fdfa8a
Revises: <PASSWORD>
Create Date: 2016-08-04 13:45:37.492317
"""
# revision identifiers, used by Alembic.
revision = '<KEY>'
down_revision = '<PASSWORD>'
from alembic import op
import sqlalchemy as sa
def upgrade():
### commands auto generated by Alembic - please adju... | 1.492188 | 1 |
webauthn/helpers/decode_credential_public_key.py | MasterKale/py_webauthn | 0 | 12766092 | from typing import Union
from attr import define
from cbor2 import decoder
from .cose import COSECRV, COSEKTY, COSEAlgorithmIdentifier, COSEKey
from .exceptions import InvalidPublicKeyStructure, UnsupportedPublicKeyType
@define
class DecodedOKPPublicKey:
kty: COSEKTY
alg: COSEAlgorithmIdentifier
crv: CO... | 2.46875 | 2 |
derivations/clustering.py | probcomp/distributions | 1 | 12766093 | <filename>derivations/clustering.py<gh_stars>1-10
# Copyright (c) 2014, Salesforce.com, Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# - Redistributions of source code must retain the a... | 1.40625 | 1 |
google-basketball-scores.py | beepboop271/python-scripts | 0 | 12766094 | # Sketchy script to pull basketball scores from the google
# thingy for the 2019 nba finals, raptors v warriors
# PYTHON 2 (old lol)
import urllib2
import re
import time
headers = {"User-Agent": "Mozilla/5.0"}
url = "https://www.google.com/search?q=raptors+game&rlz=1C1CHBF_enCA722CA722&oq=raptors+game&aqs=chrome..69i5... | 3.09375 | 3 |
vito/pyutils.py | snototter/vito | 0 | 12766095 | <filename>vito/pyutils.py
#!/usr/bin/env python
# coding=utf-8
"""Utilities for timing, logging, etc."""
import timeit
import re
import sys
import os
import datetime
import argparse
import subprocess
import traceback
# Timing code, similar to MATLAB's tic/toc
__tictoc_timers = {}
def tic(label='default'):
"""S... | 2.53125 | 3 |
softlearning/samplers/utils.py | abhishekunique/RND-ashwin | 0 | 12766096 | <gh_stars>0
from collections import defaultdict
import numpy as np
from softlearning import replay_pools
from . import (
dummy_sampler,
remote_sampler,
base_sampler,
simple_sampler,
active_sampler,
goal_sampler,
pool_sampler,
nn_sampler,
classifier_sampler)
def get_sampler_from_v... | 2.0625 | 2 |
parser/fase2/team07/Tytus_SQLPARSER_G8/Instrucciones/plpgsql/condicional_if.py | Josue-Zea/tytus | 35 | 12766097 | from Instrucciones.TablaSimbolos.Instruccion import Instruccion
from Instrucciones.TablaSimbolos.Tipo import Tipo_Dato
from Instrucciones.Excepcion import Excepcion
class If(Instruccion):
'''
Esta clase representa la instrucción if.
La instrucción if recibe como parámetro una expresión lógica y la ... | 3.203125 | 3 |
Word Embedding - Brown corpus - Kmeans - Nearest neighbour/src/create_representation.py | farzanaaswin0708/Data-Science-Projects | 0 | 12766098 | #!/usr/bin/env python
import nltk
from nltk.corpus import brown
import numpy as np
from math import log
from config import *
"""
convert word list file to a map from word to id
"""
def word2map(filename):
word2idx = {};
with open(filename) as f:
for line in f:
word2idx[line.strip('\n')] =... | 3.078125 | 3 |
LeetCode/daily/820.单词的压缩编码.py | xmmmmmovo/MyAlgorithmSolutions | 1 | 12766099 | <reponame>xmmmmmovo/MyAlgorithmSolutions
#
# @lc app=leetcode.cn id=820 lang=python3
#
# [820] 单词的压缩编码
#
from typing import List
# @lc code=start
from collections import defaultdict
from functools import reduce
class Solution:
def minimumLengthEncoding(self, words: List[str]) -> int:
"""
反转后缀排序... | 3.171875 | 3 |
src/pyai/loss/mse.py | lab-a1/pyai | 0 | 12766100 | <reponame>lab-a1/pyai
import numpy as np
from pyai.loss.base import BaseLoss
from pyai import Tensor
class MSELoss(BaseLoss):
"""
Mean-Squared Error, or L2 loss.
Equation: MSE = \frac{\sum_{i=1}^{n}(y_{true}-y_{predicted})^2}{n}
"""
def loss(self, y_true: Tensor, y_predicted: Tensor) -> Tensor:
... | 2.828125 | 3 |
tests/test_noncoap_tcp_client.py | mguc/aiocoap | 229 | 12766101 | # This file is part of the Python aiocoap library project.
#
# Copyright (c) 2012-2014 <NAME> <http://sixpinetrees.blogspot.com/>,
# 2013-2014 <NAME> <<EMAIL>>
#
# aiocoap is free software, this file is published under the MIT license as
# described in the accompanying LICENSE file.
"""Confront a CoAP ov... | 2.359375 | 2 |
settings.py | jwross24/twitoff | 0 | 12766102 | <reponame>jwross24/twitoff
"""Allow the application to see the environment variables."""
from dotenv import load_dotenv
load_dotenv()
| 1.375 | 1 |
Audio_to_Text/audio2text.py | navanil018/TemoCtor | 0 | 12766103 | #!/usr/bin/python3
# <NAME>
# audio to speech using google speech api
# 11/7/19
# Mac speech_recognition library installation
# pip3 install SpeechRecognition
# brew install portaudio
# pip3 install pyaudio
# pip3 install pydub
# Testing speech_recognization
# python3 -m speech_recognition
#Program usage
#usage: py... | 3.828125 | 4 |
server/lib/python/cartodb_services/cartodb_services/metrics/user.py | digideskio/dataservices-api | 0 | 12766104 | <gh_stars>0
from datetime import date, timedelta
from dateutil.relativedelta import relativedelta
from calendar import monthrange
def last_day_of_month(year, month):
"""last valid day of a month"""
return monthrange(year, month)[1]
def latest_valid_date(year, month, day):
"""latest date not later than t... | 2.359375 | 2 |
generateAndersonLayer.py | caf-ltar/LtarModelingAndersonClassification_ScriptConvertCdlToLvl1Anderson | 0 | 12766105 | <reponame>caf-ltar/LtarModelingAndersonClassification_ScriptConvertCdlToLvl1Anderson<gh_stars>0
import arcpy
from arcpy import env
from arcpy.sa import *
import pandas as pd
import os.path
import errno
import sys
import math
import glob
import shutil
# --- FUNCTIONS --------------------------------------------------... | 2.359375 | 2 |
alfred/alfred.py | mengfu188/alfred | 1 | 12766106 | #!/usr/bin/env python3
#
# Copyright (c) 2020 JinTian.
#
# This file is part of alfred
# (see http://jinfagang.github.io).
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding cop... | 1.421875 | 1 |
Software/dsmr.py | AvansETI/SmartMeterDIY_schematics | 0 | 12766107 | <filename>Software/dsmr.py
from __future__ import annotations
from abc import ABC, abstractmethod
import re
import json
class DSMR_Parser(object):
"""
P1 datagram parser for Dutch Smart Meter Readings
"""
def __init__(self, datagram) -> None:
self._strategy = DSMR_UNKNOWN()
self._datagr... | 3.09375 | 3 |
Sim_core_user_merged.py | thomasspiesser/MYpop | 0 | 12766108 | <reponame>thomasspiesser/MYpop
#!/usr/bin/python
# -*- coding: iso-8859-1 -*-
#Import modules
from numpy import *
# import random as rd
from scipy import integrate
import sys, re, math
import merged_eq_system
from MYpop_functions import process_condition, check_free, initiate_core_cell, find_and_replace
def Sim_core... | 1.875 | 2 |
time_utils/__init__.py | weihuchao/py2_tools | 0 | 12766109 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time : 2019-10-12 10:42
# @Author : weihuchao
import datetime
import os
import time
CHRONOS_DEFAULT_TIME_ZONE = 8
CHRONOS_DEFAULT_TIME_ZONE_NAME = "CHRONOS_DEFAULT_TIME_ZONE"
class ChronosTable(object):
def __init__(self, chronos):
self._chronos = ch... | 3.078125 | 3 |
src/server/requestHandlers/defaultHandler.py | Hiestaa/my-tornado-media-library | 1 | 12766110 | <filename>src/server/requestHandlers/defaultHandler.py
# -*- coding: utf8 -*-
from __future__ import unicode_literals
from tornado.web import RequestHandler, HTTPError
import random
import logging
from conf import Conf
class DefaultHandler(RequestHandler):
"""
Handle every request that has no request hand... | 2.859375 | 3 |
git_sentry/parsing/team_config.py | git-sentry/git-sentry | 0 | 12766111 | <reponame>git-sentry/git-sentry
from __future__ import annotations
from git_sentry.logging.printer import pad
class TeamConfig:
def __init__(self, members, admins, repos):
self._members = members
self._admins = admins
self._repos = repos
def members(self):
return self._member... | 2.40625 | 2 |
src/waldur_azure/migrations/0019_add_offer_field.py | geant-multicloud/MCMS-mastermind | 26 | 12766112 | # Generated by Django 2.2.20 on 2021-05-21 15:44
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('waldur_azure', '0018_drop_spl'),
]
operations = [
migrations.AlterModelOptions(
name='image', options={'ordering': ['publisher'... | 1.625 | 2 |
spml/trainer/misc_utils.py | hellomoto-ai/splatoon2-ml | 0 | 12766113 | import os
import csv
import collections
import numpy as np
class StatsTracker(collections.defaultdict):
"""Keep track of mean values"""
def __init__(self):
super().__init__(float)
self.step = 1
def update(self, data):
for key, val in data.items():
if key.endswith('_mi... | 3.203125 | 3 |
overwatch.py | Kami-no/xerxes | 1 | 12766114 | #!/usr/bin/env python3
"""
Daemon to watch over Zabbix
"""
from pyzabbix import ZabbixAPI
from aiohttp import web
from os import getenv
import logging
zabbix_srv = 'https://zabbix.company.ru'
zabbix_user = getenv('secret_zabbix_user')
zabbix_pass = getenv('secret_zabbix_pass')
zabbix_groups = ['Production']
def ge... | 2.359375 | 2 |
students/K33401/Tikhonova_Elena/Lr2/django_project_tikhonova/project_first_app/migrations/0005_auto_20201019_1532.py | TikhonovaElena/ITMO_ICT_WebDevelopment_2020-2021 | 0 | 12766115 | <filename>students/K33401/Tikhonova_Elena/Lr2/django_project_tikhonova/project_first_app/migrations/0005_auto_20201019_1532.py
# Generated by Django 3.1.2 on 2020-10-19 12:32
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('project_first_app', '0004_auto... | 1.679688 | 2 |
packaging/setup/plugins/ovirt-engine-common/ovirt-engine/db/config.py | UranusBlockStack/ovirt-engine | 0 | 12766116 | #
# ovirt-engine-setup -- ovirt engine setup
# Copyright (C) 2015 Red Hat, Inc.
#
# 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 r... | 1.8125 | 2 |
config.py | karan28598/sherlack | 0 | 12766117 | wolframalpha = dict(
app_id = ''
) | 1.125 | 1 |
acceptance_tests/04-xanes-scan.py | mrakitin/profile_collection-srx | 3 | 12766118 | <filename>acceptance_tests/04-xanes-scan.py
print('4. testing integrated scan functions:')
print('testing xanes')
xanes(erange = [7112-30, 7112-20, 7112+30],
estep = [2, 5],
harmonic = None,
acqtime=0.2, roinum=1, i0scale = 1e8, itscale = 1e8,samplename='test',filenam... | 1.59375 | 2 |
sga/tests/management_test.py | mitodl/sga-l | 3 | 12766119 | """
Test management commands
"""
from io import StringIO
from sga.management.commands.createmockdata import CreateMockDataCommand
from sga.tests.common import SGATestCase
class ManagementTest(SGATestCase):
"""
Class for management tests
"""
def test_create_mock_data(self):
"""
Test cr... | 2.46875 | 2 |
savvy_scheduler/check_scheduler.py | roshanxzy/system-programming | 2 | 12766120 | <gh_stars>1-10
#!/usr/bin/python3
from sys import argv
from os.path import isfile
processes = []
counter = 0
LOGFILE = "../gthread.log"
def fail():
print("Failed!")
exit(1)
def main():
if len(argv) != 2:
print("Usage: python3 check_scheduler.py <scheme>")
print("Acceptable schemes are: fcfs... | 2.703125 | 3 |
Blackjack.py | dprange/Blackjack | 0 | 12766121 | #Name: Blackjack
#Version: v.010
#Authour: dp
#Date: Aug2019
import sys
import random
import time
try:
import Tkinter as tk
except ImportError:
import tkinter as tk
try:
import ttk
py3 = False
except ImportError:
import tkinter.ttk as ttk
py3 = True
class Card(object):
def __init__(self, ... | 3.421875 | 3 |
semana-02/lista-exercicio/lista-3/exercicio_1.py | larissajusten/ufsc-object-oriented-programming | 6 | 12766122 | <reponame>larissajusten/ufsc-object-oriented-programming
"""
Exercício 1. Escreva uma função que conta a frequência de ocorrência de cada
palavra em um texto (arquivo txt) e armazena tal quantidade em um dicionário, onde a
chave é a vogal considerada.
Correção: "onde a chave é a PALAVRA considerada"
""... | 3.953125 | 4 |
jobboard/forms.py | YarinBou/SJMaster | 1 | 12766123 | from django import forms
from jobboard.models import Job
class FormControl(forms.ModelForm):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
for form_field in self.visible_fields():
form_field.field.widget.attrs['class'] = 'form-control'
class CreateNewJobForm(... | 2.3125 | 2 |
fexm/helpers/exceptions.py | fgsect/fexm | 105 | 12766124 | <filename>fexm/helpers/exceptions.py<gh_stars>100-1000
class CouldNotConfigureException(BaseException):
def __str__(self):
return "Could not configure the repository."
class NotABinaryExecutableException(BaseException):
def __str__(self):
return "The file given is not a binary executable"
cl... | 2.25 | 2 |
tests/test_1_jwt.py | levkowetz/pyjwkest | 76 | 12766125 | import pytest
from jwkest.jwt import JWT, b2s_conv
__author__ = 'roland'
def _eq(l1, l2):
return set(l1) == set(l2)
def test_pack_jwt():
_jwt = JWT(**{"alg": "none", "cty": "jwt"})
jwt = _jwt.pack(parts=[{"iss": "joe", "exp": 1300819380,
"http://example.com/is_root": True},... | 2.515625 | 3 |
example.py | Septaris/declic | 0 | 12766126 | <reponame>Septaris/declic<gh_stars>0
from declic import group, argument, command
# on_before callbacks are executed if:
# - the group itself is called
# - if any of the child of the group is called
def before_bar():
print('before bar')
def before_sub(tata):
print('before sub: %s' % tata)
# define the root co... | 2.84375 | 3 |
util.py | ahrnbom/utocs | 0 | 12766127 | """
Copyright (C) 2022 <NAME>
This work is released under the MIT License.
See the file LICENSE for details
Utility functions
"""
from math import sqrt
from typing import List
import numpy as np
import carla
import io
def loc_dist(a, b):
return sqrt((a.x - b.x)**2 + (a.y - b.y)**2 + (a.z - b.... | 3.265625 | 3 |
tensorflow_probability/python/experimental/mcmc/sequential_monte_carlo_kernel.py | brianwa84/probability | 1 | 12766128 | # Copyright 2020 The TensorFlow Probability Authors.
#
# 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 o... | 2.03125 | 2 |
ivf/batch/initial_normal.py | tody411/ImageViewerFramework | 0 | 12766129 | # -*- coding: utf-8 -*-
## @package ivf.batch.initial_normal
#
# ivf.batch.initial_normal utility package.
# @author tody
# @date 2016/02/19
import numpy as np
import cv2
import matplotlib.pyplot as plt
from ivf.batch.batch import DatasetBatch
from ivf.io_util.image import loadNormal, saveNormal
from i... | 2.1875 | 2 |
online_attacks/utils/optimizer/extragradient.py | hugobb/OnlineAttacks | 15 | 12766130 | # Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
from torch import optim
import copy
class Extragradient(optim.Optimizer):
def __init__(self, optimizer, params):
super(Extragrad... | 2.296875 | 2 |
accountsynchr/ucalgroup/group_manager.py | uw-it-aca/eventcal | 0 | 12766131 | # Copyright 2021 UW-IT, University of Washington
# SPDX-License-Identifier: Apache-2.0
"""
This class provides GWS Group related methods
"""
import logging
from uw_trumba.models import TrumbaCalendar
from accountsynchr.models import (
UwcalGroup, EDITOR, SHOWON, new_editor_group, new_showon_group)
from accountsync... | 2.28125 | 2 |
features/regnet.py | roatienza/agmax | 2 | 12766132 | <gh_stars>1-10
import torch
import torch.nn as nn
import timm
from . import extractor
class RegNetX002(extractor.BaseModule):
def __init__(self, config, name):
super(RegNetX002, self).__init__()
self.name = name
self.features = timm.create_model('regnetx_002')
self.n_featur... | 2.28125 | 2 |
Common_Questions/TextBookQuestions/PythonCrashCourse/Chapter_8/8_10.py | tegamax/ProjectCode | 0 | 12766133 | '''
8-10. Sending Messages: Start with a copy of your program from Exercise 8-9.
Write a function called send_messages() that prints each text message and moves each message to a new list called sent_messages as it’s printed.
After calling the function, print both of your lists to make sure the messages were moved co... | 4.375 | 4 |
sv_core/core/evt/models.py | ekryukov/sv_core | 0 | 12766134 | <reponame>ekryukov/sv_core
# ************************************************************
# * Events API.
# * Created by <NAME>.(<EMAIL>) at 10.05.2016
# *************************************************************
import logging
from django.conf import settings
from django.contrib.contenttypes.fields import Generi... | 1.6875 | 2 |
setup.py | gmcbretas/vaex-gql-schema | 0 | 12766135 | import os
import imp
from setuptools import setup, find_packages
dirname = os.path.dirname(__file__)
path_version = os.path.join(dirname, 'vaex_gql_schema/_version.py')
version = imp.load_source('version', path_version)
name = 'vaex-gql-schema'
author = '<NAME>'
author_email= '<EMAIL>'
license = 'MIT'... | 1.507813 | 2 |
Blender_python/objectMap.py | CaoYuchen/SSS-dataset | 3 | 12766136 | <filename>Blender_python/objectMap.py
import bpy
import mathutils
import os
#######record groundtruth of object pose#######
dir = os.path.dirname(bpy.data.filepath)
filename = os.path.join(dir, 'objectmap.txt')
file2=open(filename, "w")
# make sure objects with same class label are named with same prefix, e.g. chair... | 2.65625 | 3 |
ext/opentelemetry-ext-testutil/src/opentelemetry/ext/testutil/version.py | lzchen/opentelemetry-python | 0 | 12766137 | __version__ = "0.3dev0"
| 1.046875 | 1 |
ci/ci/asgi.py | muchu1983/CollectiveIntelligence | 0 | 12766138 | # -*- coding: utf-8 -*-
"""
Copyright © 2017, <NAME>
Contributed by <NAME> (<EMAIL>)
This file is part of BSD license
<https://opensource.org/licenses/BSD-3-Clause>
"""
import os
from channels.asgi import get_channel_layer
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "ci.settings")
channel_layer = get_channel_la... | 1.390625 | 1 |
api/handy_tools_apple_devices.py | jsugg/locate-apple-devices | 1 | 12766139 | <reponame>jsugg/locate-apple-devices
from flask import Flask, request
from flask_restful import Resource, Api
from json import dumps
from subprocess import call
import urllib
import subprocess
from pyicloud import PyiCloudService
import os
import cStringIO
import sys
user = os.environ['APPLE_DEVICES_ACCOUNT_USER']
p... | 2.484375 | 2 |
pandas_module/pandas_test3.py | kenwaldek/python | 1 | 12766140 | <filename>pandas_module/pandas_test3.py
#! /usr/bin/env python3
# -*- coding:utf-8 -*-
###############################################################
# © kenwaldek MIT-license
#
# Title: pandas 3 Version: 1.0
# Date: 01-01-2017 Language: python3
# Desc... | 3.84375 | 4 |
config/dev_config.py | LongmaoTeamTf/audio_aligner_app | 5 | 12766141 | <reponame>LongmaoTeamTf/audio_aligner_app
import os
# APP STATIC config
APP_PATH = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
APP_STATIC_DIR = os.path.join(APP_PATH, "static")
APP_LOG_PATH = os.path.join(APP_PATH, 'logs', 'app.log')
APP_STATIC_URL_PATH = '/public_resource'
# LOG config
LOG_ENABLED = ... | 1.648438 | 2 |
script_train_error.py | xiaoyanLi629/single_cell_data_analysis | 0 | 12766142 | <gh_stars>0
# Dependencies:
# pip: scikit-learn, anndata, scanpy
#
# Python starter kit for the NeurIPS 2021 Single-Cell Competition.
# Parts with `TODO` are supposed to be changed by you.
#
# More documentation:
#
# https://viash.io/docs/creating_components/python/
# ./scripts/1_unit_test.sh
# ./scripts/2_generate_su... | 2.140625 | 2 |
test_main.py | GrivIN/intern-api | 0 | 12766143 | from fastapi.testclient import TestClient
from main import *
client = TestClient(app)
def test_index():
response = client.get("/")
assert response.status_code == 200
assert response.json() == {"msg": "Hello World"}
def test_health():
response = client.get("/health")
assert response.status_code =... | 3 | 3 |
sdk/python/pulumi_aws/route53/health_check.py | dixler/pulumi-aws | 0 | 12766144 | <filename>sdk/python/pulumi_aws/route53/health_check.py
# coding=utf-8
# *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import json
import warnings
import pulumi
import pulumi.runtime
from typing imp... | 2.25 | 2 |
aram_predictor/get_matches.py | ericmarkmartin/aram_predictor | 0 | 12766145 | <filename>aram_predictor/get_matches.py
from match_crawler import cass_setup, crawl_matches
from settings import RIOT_API_KEY, SEED_SUMMONER
from itertools import islice
import cassiopeia as cass
import pandas as pd
DF_COLUMNS = ["match_id"] + [
"{}_{}".format(side, i) for side in ["blue", "red"] for i in range... | 2.71875 | 3 |
cvpl-homepage/homepage/site.py | robinsax/canvas-plugin-multirepo | 0 | 12766146 | # coding: utf-8
'''
Pages.
'''
import re
import canvas as cv
from canvas.plugins import users
@cv.alter_root_page_view
def alter_root_page_view(PageView):
class CustomPageView(PageView):
def setup(self):
self.assets = ('site.js', 'site.css', *self.assets, 'decor.js')
if self.title is None:
self.title = ... | 2.21875 | 2 |
source/control_plane/python/lambda/ttl_checker/ttl_checker.py | aneoconsulting/aws-htc-grid | 1 | 12766147 | # Copyright 2021 Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: Apache-2.0
# Licensed under the Apache License, Version 2.0 https://aws.amazon.com/apache-2-0/
import boto3
import time
import os
from botocore.exceptions import ClientError
from boto3.dynamodb.conditions import Key, ... | 1.617188 | 2 |
python/day20.py | kdrag0n/aoc2020 | 5 | 12766148 | <reponame>kdrag0n/aoc2020<gh_stars>1-10
#!/usr/bin/env python3
import sys
from collections import namedtuple
def ints(itr):
return [int(i) for i in itr]
with open(sys.argv[1], "r") as f:
lines = [l for l in f.read().split("\n\n") if l]
ilist = []
imap = {}
total = 0
result = 0
other = 0
#
# 123
# 456
# 789... | 3.0625 | 3 |
systori/lib/middleware.py | systori/systori | 12 | 12766149 | import time
from django.utils.deprecation import MiddlewareMixin
class StatsMiddleware(MiddlewareMixin):
def process_request(selfs, request):
request.start_time = time.time()
def process_response(self, request, response):
total = time.time() - request.start_time
print(f"cycle took {to... | 2.25 | 2 |
src/pages/gd_solution_page.py | kryvokhyzha/gradient-descent | 1 | 12766150 | <filename>src/pages/gd_solution_page.py
import streamlit as st
import pandas as pd
import numpy as np
import os
import time
from collections import namedtuple
from sklearn.datasets import make_regression, make_classification
import matplotlib.pyplot as plt
from utils.constants import *
from db import db_insert
from ... | 2.734375 | 3 |