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 |
|---|---|---|---|---|---|---|
changes/buildsteps/lxc.py | bowlofstew/changes | 0 | 7000 | from __future__ import absolute_import
from changes.buildsteps.default import DefaultBuildStep
class LXCBuildStep(DefaultBuildStep):
"""
Similar to the default build step, except that it runs the client using
the LXC adapter.
"""
def can_snapshot(self):
return True
def get_label(self... | 2.359375 | 2 |
swapidemo1.py | anvytran-dev/mycode | 0 | 7001 | <gh_stars>0
#!/usr/bin/env python3
"""Star Wars API HTTP response parsing"""
# requests is used to send HTTP requests (get it?)
import requests
URL= "https://swapi.dev/api/people/1"
def main():
"""sending GET request, checking response"""
# SWAPI response is stored in "resp" object
resp= requests.get(UR... | 3.640625 | 4 |
src/biota_models/vegetation/model/constants_json_create.py | Deltares/NBSDynamics | 2 | 7002 | <reponame>Deltares/NBSDynamics
import json
schema = {
"Spartina": {
"ColStart": "2000-04-01",
"ColEnd": "2000-05-31",
"random": 7,
"mud_colonization": [0.0, 0.0],
"fl_dr": 0.005,
"Maximum age": 20,
"Number LifeStages": 2,
"initial root length": 0.05,
... | 1.78125 | 2 |
format/format.bzl | harshad-deo/TorchVI | 0 | 7003 | def _replace_formatted(ctx, manifest, files):
out = ctx.actions.declare_file(ctx.label.name)
# this makes it easier to add variables
file_lines = [
"""#!/bin/bash -e
WORKSPACE_ROOT="${1:-$BUILD_WORKSPACE_DIRECTORY}" """,
"""RUNPATH="${TEST_SRCDIR-$0.runfiles}"/""" + ctx.workspace_name,
... | 2.359375 | 2 |
Stream-3/Full-Stack-Development/10.Custom-User-And-Email-Authentication/2.Custom-User-Model/auth_demo/accounts/models.py | GunnerJnr/_CodeInstitute | 4 | 7004 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.contrib.auth.models import AbstractUser, UserManager
from django.db import models
from django.utils import timezone
# Create your models here.
# Create our new user class
class AccountUserManager(UserManager):
def _create_user(self, usern... | 2.984375 | 3 |
histoGAN.py | mahmoudnafifi/HistoGAN | 169 | 7005 | <filename>histoGAN.py
"""
If you find this code useful, please cite our paper:
<NAME>, <NAME>, and <NAME>. "HistoGAN:
Controlling Colors of GAN-Generated and Real Images via Color Histograms."
In CVPR, 2021.
@inproceedings{afifi2021histogan,
title={Histo{GAN}: Controlling Colors of {GAN}-Generated and Real Ima... | 2.03125 | 2 |
apps/careeropportunity/migrations/0003_careeropportunity_deadline.py | Kpaubert/onlineweb4 | 32 | 7006 | # -*- coding: utf-8 -*-
# Generated by Django 1.9.10 on 2016-10-05 18:52
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [("careeropportunity", "0002_careeropportunity_job_type")]
operations = [
migrations.AddFie... | 1.515625 | 2 |
benchmark/python/ffi/benchmark_ffi.py | grygielski/incubator-mxnet | 211 | 7007 | <filename>benchmark/python/ffi/benchmark_ffi.py
# 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 copyright ownership. The ASF licenses this file
# to you under the Apache Licen... | 2.0625 | 2 |
first-floor.py | levabd/smart-climat-daemon | 0 | 7008 | #!/usr/bin/env python3
import json
import argparse
import re
import datetime
import paramiko
import requests
# cmd ['ssh', 'smart',
# 'mkdir -p /home/levabd/smart-home-temp-humidity-monitor;
# cat - > /home/levabd/smart-home-temp-humidity-monitor/lr.json']
from miio import chuangmi_plug
from btlewrap import availabl... | 2.296875 | 2 |
reservior_classification.py | Optimist-Prime/QML-for-MNIST-classification | 1 | 7009 | <reponame>Optimist-Prime/QML-for-MNIST-classification
import pickle
from sklearn.neural_network import MLPClassifier
train = pickle.load(open('train_pca_reservoir_output_200samples.pickle','rb'))
test = pickle.load(open('test_pca_reservoir_output_50samples.pickle','rb'))
train_num = 200
test_num = 50
mlp = MLPClassi... | 2.765625 | 3 |
util.py | delmarrerikaine/LPG-PCA | 1 | 7010 | <filename>util.py
import numpy as np
import pandas as pd
from skimage import io
import skimage.measure as measure
import os
from lpg_pca_impl import denoise
def getNoisedImage(originalImage, variance):
# return random_noise(originalImage, mode='gaussian', var=variance)
np.random.seed(42)
noise = np.random... | 2.5 | 2 |
ui/ui.py | kringen/wingnut | 0 | 7011 | <filename>ui/ui.py
import redis
from rq import Queue, Connection
from flask import Flask, render_template, Blueprint, jsonify, request
import tasks
import rq_dashboard
from wingnut import Wingnut
app = Flask(
__name__,
template_folder="./templates",
static_folder="./static",
)
app.config.f... | 2.359375 | 2 |
pytaboola/__init__.py | Openmail/pytaboola | 0 | 7012 | <reponame>Openmail/pytaboola<filename>pytaboola/__init__.py<gh_stars>0
from pytaboola.client import TaboolaClient | 1.09375 | 1 |
omkar/code.py | omi28/ga-learner-dst-repo | 0 | 7013 | # --------------
# Importing header files
import numpy as np
import warnings
warnings.filterwarnings('ignore')
new_record=[[50, 9, 4, 1, 0, 0, 40, 0]]
#New record
#Reading file
data = np.genfromtxt(path, delimiter=",", skip_header=1)
data.shape
cenus=np.concatenate((new_record,data),axis=0)
cenus.... | 2.828125 | 3 |
test/present.py | jchampio/apache-websocket | 8 | 7014 | <reponame>jchampio/apache-websocket<filename>test/present.py
#! /usr/bin/env python
#
# Presents the results of an Autobahn TestSuite run in TAP format.
#
# Copyright 2015 <NAME>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You ... | 2.296875 | 2 |
softwarecollections/scls/migrations/0004_other_repos_default_values.py | WEBZCC/softwarecollections | 39 | 7015 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('scls', '0003_other_repos'),
]
operations = [
migrations.AlterField(
model_name='otherrepo',
name='ar... | 1.539063 | 2 |
python/Excel/enumerateCells.py | davidgjy/arch-lib | 0 | 7016 | <filename>python/Excel/enumerateCells.py<gh_stars>0
import openpyxl
wb = openpyxl.load_workbook('example.xlsx')
sheet = wb.get_sheet_by_name('Sheet1')
rows = sheet.get_highest_row()
cols = sheet.get_highest_column()
for i in range(1, rows + 1):
for j in range(1, cols + 1):
print('%s: %s' % (sheet.cell(row=i... | 3.34375 | 3 |
plugins/polio/migrations/0029_campaign_country.py | BLSQ/iaso-copy | 29 | 7017 | <filename>plugins/polio/migrations/0029_campaign_country.py
# Generated by Django 3.1.13 on 2021-10-04 11:44
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
("iaso", "0107_auto_20211001_1845"),
("polio", "0028_remo... | 1.617188 | 2 |
CurrencyExchange.py | aarana14/CurrencyExchange | 0 | 7018 | #import external libraries used in code
import requests, json
import pycountry
print('Currency Exchange')
currencies = []
def findCurrency():
#Finds all avaliable currencies
allCurrency = (list(pycountry.currencies))
for x in allCurrency:
y = str(x)
y = y[18:21]
#Adds th... | 3.828125 | 4 |
atcoder/corp/codethxfes2014a_e.py | knuu/competitive-programming | 1 | 7019 | <gh_stars>1-10
r, c, m = map(int, input().split())
n = int(input())
op = [list(map(lambda x: int(x) - 1, input().split())) for _ in range(n)]
board = [[0 for _ in range(c)] for _ in range(r)]
for ra, rb, ca, cb in op:
for j in range(ra, rb + 1):
for k in range(ca, cb + 1):
board[j][k] += 1
cnt ... | 2.59375 | 3 |
scripts/analyse_bse.py | QU-XIAO/yambopy | 21 | 7020 | # Copyright (C) 2018 <NAME>, <NAME>
# All rights reserved.
#
# This file is part of yambopy
#
from __future__ import print_function
from builtins import range
from yambopy import *
from qepy import *
import json
import matplotlib.pyplot as plt
import numpy as np
import sys
import argparse
import operator
def analyse_b... | 2.859375 | 3 |
halmodule.py | richteer/pyfatafl | 0 | 7021 | <reponame>richteer/pyfatafl<gh_stars>0
from module import XMPPModule
import halutils
import pyfatafl
class Game():
self.players = []
self.xmpp = None
self.b = None
self.turn = ""
self.mod = None
def __init__(self, mod, p1, p2):
self.players = [p1, p2]
self.mod = mod
self.xmpp = mod.xmpp
self.xmpp.sendMs... | 2.71875 | 3 |
tools/acetz.py | arkhipenko/AceTime | 1 | 7022 | <gh_stars>1-10
from typing import cast, Optional
from datetime import datetime, tzinfo, timedelta
from zonedbpy import zone_infos
from zone_processor.zone_specifier import ZoneSpecifier
from zone_processor.inline_zone_info import ZoneInfo
__version__ = '1.1'
class acetz(tzinfo):
"""An implementation of datetime.... | 2.796875 | 3 |
z2/part2/interactive/jm/random_fuzzy_arrows_1/554539540.py | kozakusek/ipp-2020-testy | 1 | 7023 | from part1 import (
gamma_board,
gamma_busy_fields,
gamma_delete,
gamma_free_fields,
gamma_golden_move,
gamma_golden_possible,
gamma_move,
gamma_new,
)
"""
scenario: test_random_actions
uuid: 554539540
"""
"""
random actions, total chaos
"""
board = gamma_new(6, 8, 3, 17)
assert board i... | 2.234375 | 2 |
examples/run_chemistry_parser.py | ZhuoyuWei/transformers | 0 | 7024 | <filename>examples/run_chemistry_parser.py<gh_stars>0
# coding=utf-8
# Copyright 2019 The HuggingFace Inc. team.
# Copyright (c) 2019 The HuggingFace Inc. 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 ma... | 2.109375 | 2 |
envergo/geodata/management/commands/import_shapefiles.py | MTES-MCT/envergo | 0 | 7025 | from django.contrib.gis.gdal import DataSource
from django.contrib.gis.utils import LayerMapping
from django.core.management.base import BaseCommand
from envergo.geodata.models import Zone
class Command(BaseCommand):
help = "Importe des zones à partir de shapefiles."
def add_arguments(self, parser):
... | 2.09375 | 2 |
vimfiles/bundle/ultisnips/test/test_AnonymousExpansion.py | duanqiaobb/vim-for-java | 0 | 7026 | from test.vim_test_case import VimTestCase as _VimTest
from test.constant import *
# Anonymous Expansion {{{#
class _AnonBase(_VimTest):
args = ''
def _extra_options_pre_init(self, vim_config):
vim_config.append('inoremap <silent> %s <C-R>=UltiSnips#Anon(%s)<cr>'
% (EA, se... | 2.078125 | 2 |
data_converter/data_converter.py | jkchen2/JshBot-plugins | 1 | 7027 | import discord
from jshbot import utilities, data, configurations, plugins, logger
from jshbot.exceptions import BotException, ConfiguredBotException
from jshbot.commands import (
Command, SubCommand, Shortcut, ArgTypes, Attachment, Arg, Opt, MessageTypes, Response)
__version__ = '0.1.0'
CBException = ConfiguredB... | 2.171875 | 2 |
tut2.py | ankit98040/TKINTER-JIS | 0 | 7028 | from tkinter import *
from PIL import Image, ImageTk
#python image library
#imagetk supports jpg image
a1 = Tk()
a1.geometry("455x244")
#for png image
#photo = PhotoImage(file="filename.png")
#a2 = Label(image = photo)
#a2.pack()
image = Image.open("PJXlVd.jpg")
photo = ImageTk.PhotoImage(image)
... | 3.34375 | 3 |
dataset.py | mintanwei/IPCLs-Net | 0 | 7029 | import os
import torch
from PIL import Image
from read_csv import csv_to_label_and_bbx
import numpy as np
from torch.utils.data import Subset, random_split, ConcatDataset
class NBIDataset(object):
def __init__(self, root, transforms, nob3=False):
self.root = root
self.transforms = transforms
... | 2.625 | 3 |
design_patterns/chapter5/mymath.py | FeliciaMJ/PythonLearningJourney | 0 | 7030 | # coding: utf-8
import functools
def memoize(fn):
known = dict()
@functools.wraps(fn)
def memoizer(*args):
if args not in known:
known[args] = fn(*args)
return known[args]
return memoizer
@memoize
def nsum(n):
'''返回前n个数字的和'''
assert(n >= 0), 'n must be >= 0'
... | 2.796875 | 3 |
transforms/__init__.py | yangyuke001/emotion-expression.shufflenetv2 | 3 | 7031 | <reponame>yangyuke001/emotion-expression.shufflenetv2
from .transforms import *
| 0.867188 | 1 |
codes/elastoplasticity_spectralAnalysis/planeStress/slowWavePlaneStressSigDriven.py | adRenaud/research | 1 | 7032 | <filename>codes/elastoplasticity_spectralAnalysis/planeStress/slowWavePlaneStressSigDriven.py
# !\usr\bin\python
import numpy as np
from mpl_toolkits import mplot3d
import matplotlib.pyplot as plt
import scipy.optimize
from matplotlib import animation
from scipy.integrate import ode
import pdb
# Material parameters
rh... | 1.992188 | 2 |
pyhsms/core/connectionstate.py | cherish-web/pyhsms | 2 | 7033 | <reponame>cherish-web/pyhsms
# _*_ coding: utf-8 _*_
#@Time : 2020/7/29 上午 09:49
#@Author : cherish_peng
#@Email : <EMAIL>
#@File : connectionstate.py
#@Software : PyCharm
from enum import Enum
class ConnectionState(Enum):
'''
ConnectionState enum
'''
DisConnected = 0
Connecting=1
... | 1.757813 | 2 |
lifelines/fitters/coxph_fitter.py | msanpe/lifelines | 0 | 7034 | # -*- coding: utf-8 -*-
import time
from datetime import datetime
import warnings
from textwrap import dedent, fill
import numpy as np
import pandas as pd
from numpy.linalg import norm, inv
from scipy.linalg import solve as spsolve, LinAlgError
from scipy.integrate import trapz
from scipy import stats
from lifelines.... | 1.726563 | 2 |
nlp_server/config/test/test_config.py | asevans48/NLPServer | 0 | 7035 | """
Test configuration loading
@author aevans
"""
import os
from nlp_server.config import load_config
def test_load_config():
"""
Test loading a configuration
"""
current_dir = os.path.curdir
test_path = os.path.sep.join([current_dir, 'data', 'test_config.json'])
cfg = load_config.load_conf... | 2.484375 | 2 |
frappe/utils/safe_exec.py | ektai/frappe3 | 0 | 7036 |
import os, json, inspect
import mimetypes
from html2text import html2text
from RestrictedPython import compile_restricted, safe_globals
import RestrictedPython.Guards
import frappe
import frappe.utils
import frappe.utils.data
from frappe.website.utils import (get_shade, get_toc, get_next_link)
from frappe.modules impo... | 2.09375 | 2 |
simplejson/ordered_dict.py | BarracudaPff/code-golf-data-pythpn | 0 | 7037 | <gh_stars>0
"""Drop-in replacement for collections.OrderedDict by <NAME>
http://code.activestate.com/recipes/576693/
"""
try:
all
except NameError:
def all(seq):
for elem in seq:
if not elem:
return False
return True
class OrderedDict(dict, DictMixin):
def __init__(self, *args, **kwds):
if len(args) > 1... | 2.59375 | 3 |
Water.py | KRHS-GameProgramming-2015/Adlez | 0 | 7038 | <reponame>KRHS-GameProgramming-2015/Adlez
from HardBlock import *
class Water(HardBlock):
def __init__(self, pos=[0,0], blockSize = 25):
image = "Block/Block Images/water.png"
HardBlock.__init__(self, image, pos, blockSize)
def update(*args):
pass
... | 2.40625 | 2 |
baselines/bc.py | bgalbraith/minerl-haiku-baselines | 2 | 7039 | <filename>baselines/bc.py<gh_stars>1-10
import dill
import haiku as hk
import jax
from jax.experimental import optix
import jax.numpy as jnp
from dataset import load_data
MINERL_ENV = 'MineRLTreechopVectorObf-v0'
PARAMS_FILENAME = 'bc_params_treechop.pkl'
class PovStack(hk.Module):
""" PovStack is a module for... | 2.5 | 2 |
qiskit/circuit/library/templates/__init__.py | ajavadia/qiskit-sdk-py | 15 | 7040 | <reponame>ajavadia/qiskit-sdk-py
# This code is part of Qiskit.
#
# (C) Copyright IBM 2020.
#
# This code is licensed under the Apache License, Version 2.0. You may
# obtain a copy of this license in the LICENSE.txt file in the root directory
# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0.
#
# A... | 1.570313 | 2 |
Tests/test_ironmath.py | btddg28/ironpython | 0 | 7041 | #####################################################################################
#
# Copyright (c) Microsoft Corporation. All rights reserved.
#
# This source code is subject to terms and conditions of the Apache License, Version 2.0. A
# copy of the license can be found in the License.html file at the root of th... | 2 | 2 |
python/lib/viewer/gener_q_vs_w_for_df.py | timtyree/bgmc | 0 | 7042 | <reponame>timtyree/bgmc
import matplotlib.pyplot as plt, numpy as np, pandas as pd,os
from ..model import recall_powerlaw_fits_to_full_models
from .. import compute_power_rmse
from .bluf import *
from ..measure.powerlaw import *
from .gener_q_vs_w_for_result_folder import *
def q_vs_w_plotter_function_from_df(ax,df):
... | 2.046875 | 2 |
decatt/model.py | achyudh/castor | 132 | 7043 | import sys
import math
import numpy as np
from datetime import datetime
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.autograd import Variable
class DecAtt(nn.Module):
def __init__(self, num_units, num_classes, embedding_size, dropout, device=0,
training=True, p... | 3.03125 | 3 |
basic_code/networks.py | J-asy/Emotion-FAN | 275 | 7044 | import torch.nn as nn
import math
import torch.utils.model_zoo as model_zoo
import torch.nn.functional as F
import torch
import numpy as np
import cv2
import pdb
def sigmoid(x):
return 1 / (1 + math.exp(-x))
def norm_angle(angle):
norm_angle = sigmoid(10 * (abs(angle) / 0.7853975 - 1))
return norm_angle
... | 2.828125 | 3 |
ndscheduler/server/handlers/index.py | symphonyrm/ndscheduler | 0 | 7045 | """Serves the single page app web ui."""
import json
import tornado.gen
from ndscheduler import settings
from ndscheduler import utils
from ndscheduler.server.handlers import base
class Handler(base.BaseHandler):
"""Index page request handler."""
@tornado.gen.coroutine
def get(self):
"""Serve u... | 2.125 | 2 |
Scripts/xbbtools/xbb_io.py | eoc21/biopython | 3 | 7046 | #!/usr/bin/env python
# Created: Wed Jun 21 13:46:35 2000
# Last changed: Time-stamp: <00/12/02 14:18:23 thomas>
# <EMAIL>, http://evolution.bmc.uu.se/~thomas
# File: xbb_io.py
import os, sys # os.system, sys.argv
sys.path.insert(0, '.')
sys.path.insert(0, os.path.expanduser('~thomas/cbs/python/biopython'))
from Bio... | 2.578125 | 3 |
HW6/Andrii_Haponov/cw_4.py | kolyasalubov/Lv-677.PythonCore | 0 | 7047 | <reponame>kolyasalubov/Lv-677.PythonCore
# Convert a Number to a String!
# We need a function that can transform a number into a string.
# What ways of achieving this do you know?
def number_to_string(num: int) -> str:
str_num = str(num)
return str_num
print(number_to_string(123))
print(type(number_to_stri... | 4.03125 | 4 |
project/scripts/clausecat/evaluate_clausecat.py | explosion/healthsea | 60 | 7048 | import spacy
from spacy.scorer import PRFScore
import typer
from pathlib import Path
from wasabi import Printer, table
import operator
import benepar
import clausecat_component
import clausecat_model
import clausecat_reader
import clause_segmentation
import clause_aggregation
msg = Printer()
def main(model_path: Pa... | 2.609375 | 3 |
utils/test.py | david-waugh/network-automation | 0 | 7049 | import pathlib
print(pathlib.Path(__file__).parent.resolve())
while True:
next_cmd = input("> ")
print(eval(next_cmd))
| 2.3125 | 2 |
nlp_annotator_api/server/app.py | IBM/deepsearch-nlp-annotator-api-example | 3 | 7050 | import logging
import os
import aiohttp.web
from connexion import AioHttpApp
from nlp_annotator_api.config.config import conf
from nlp_annotator_api.config.logging import setup_logging
from nlp_annotator_api.server.middleware.statsd_middleware import StatsdMiddleware
from nlp_annotator_api.server.signals.statsd_clien... | 2.03125 | 2 |
keras_cv_attention_models/resnest/resnest.py | dcleres/keras_cv_attention_models | 140 | 7051 | <reponame>dcleres/keras_cv_attention_models
import tensorflow as tf
from tensorflow import keras
from tensorflow.keras import backend as K
from keras_cv_attention_models.aotnet import AotNet
from keras_cv_attention_models.download_and_load import reload_model_weights
from keras_cv_attention_models.attention_layers impo... | 2.53125 | 3 |
dataactcore/migrations/versions/8692ab1298e1_replace_filerequest_with_filegeneration.py | brianherman/data-act-broker-backend | 1 | 7052 | <reponame>brianherman/data-act-broker-backend
"""replace FileRequest with FileGeneration
Revision ID: 8692ab1298e1
Revises: <KEY>
Create Date: 2018-10-24 14:54:39.278159
"""
# revision identifiers, used by Alembic.
revision = '8692ab1298e1'
down_revision = '<KEY>'
branch_labels = None
depends_on = None
from alembic... | 1.445313 | 1 |
cluster.py | Birfy/Endlinking | 1 | 7053 | import numpy as np
import random
import sys
chainlength = int(sys.argv[1])
dfname = sys.argv[2]
outfl = 'result.data'
cluster_size = int(sys.argv[3])
def readsize(dfname):
with open(dfname, 'r') as df:
lines = df.readlines()
for line in lines:
content = line.split()
if content and cont... | 2.640625 | 3 |
ituro/accounts/tests.py | kayduemre/ituro | 9 | 7054 | from django.test import TestCase
from django.utils import timezone
from accounts.models import CustomUser, CustomUserManager
class UserCreateTestCase(TestCase):
def test_create_user_correctly(self):
"Creating users correctly"
new_user = CustomUser.objects.create(
email="<EMAIL>",
... | 2.890625 | 3 |
continuum/datasets/dtd.py | oleksost/continuum | 282 | 7055 | <filename>continuum/datasets/dtd.py
import os
from typing import List
import numpy as np
from torchvision import datasets as torchdata
from continuum.datasets import ImageFolderDataset
from continuum import download
from continuum.tasks import TaskType
class DTD(ImageFolderDataset):
"""Describable Textures Data... | 2.5625 | 3 |
src/tests/testdata.py | Doometnick/MaxiMin-2048 | 0 | 7056 | <filename>src/tests/testdata.py<gh_stars>0
from board import Direction
# Tuples of input, action, expected output.
moving_tests = [
(
[[0,0,0,0],
[4,0,0,0],
[0,0,0,0],
[4,0,2,0]],
Direction.UP,
[[8,0,2,0],
[0,0,0,0],
[0,0,0,0],
[0,0,0,0... | 2.5625 | 3 |
test/utils/test_value.py | HansBug/pji | 0 | 7057 | import pytest
from pji.utils import ValueProxy
@pytest.mark.unittest
class TestUtilsValue:
def test_value_proxy_init(self):
value = ValueProxy()
assert value.value is None
value = ValueProxy(233)
assert value.value == 233
def test_value_proxy_set(self):
value = Value... | 2.453125 | 2 |
intro.py | Ebenazer-2002/library-management | 0 | 7058 | #Intro Page
from tkinter import *
from PIL import Image, ImageTk
import cv2
#----------------------------Start Function--------------------------#
def start(event):
label1.destroy()
import log
win.destroy()
log.main()
#------------------------Main Window---------------------------------#li
def main_... | 3.15625 | 3 |
notebooks/week4_help.py | hugh9876/04-multivariate-analysis | 0 | 7059 | """
This module provides helper functions to support exercises during AM1
with outliers, robust regression and template regression in the CORE
data analytics workshop series, week 4.
"""
import numpy as np
import pandas as pd
import math
from collections import namedtuple
def recovery_sulphur_dataframe_wit... | 3.015625 | 3 |
tests/actions/test_mutable_token_action.py | 0xOmarA/RadixLib | 32 | 7060 | <filename>tests/actions/test_mutable_token_action.py
from radixlib.actions import CreateTokenDefinition
from typing import Dict, Any
import unittest
class TestMutableTokenAction(unittest.TestCase):
""" Unit tests for the CreateTokenDefinition action of mutable tokens """
ActionDict: Dict[str, Any] = {
... | 2.71875 | 3 |
src/tests/testModules/loadCfg_typeCasting/allowsCastFailKeeping/primativeTypes.py | Trimatix/carica | 5 | 7061 | floatVar = 1.0
listVar = [3, "hello"]
dictVar = {
"myField": "value"
}
aotVar = [dictVar, dictVar]
intVar = 1 | 2.203125 | 2 |
quacc/recipes/xtb/__init__.py | arosen93/HT-ASE | 9 | 7062 | <filename>quacc/recipes/xtb/__init__.py
"""Recipes for xTB"""
| 0.910156 | 1 |
src/python/pants/backend/native/subsystems/xcode_cli_tools.py | StephanErb/pants | 0 | 7063 | <filename>src/python/pants/backend/native/subsystems/xcode_cli_tools.py
# coding=utf-8
# Copyright 2018 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import absolute_import, division, print_function, unicode_literals
import os
from p... | 1.765625 | 2 |
improver_tests/regrid/test_RegridWithLandSeaMask.py | yzhaobom/improver | 77 | 7064 | <gh_stars>10-100
# -*- coding: utf-8 -*-
# -----------------------------------------------------------------------------
# (C) British Crown Copyright 2017-2021 Met Office.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the follo... | 1.320313 | 1 |
setup.py | garnaat/details | 27 | 7065 | <reponame>garnaat/details<filename>setup.py
#!/usr/bin/env python
from setuptools import setup, find_packages
import os
requires = [
]
setup(
name='details',
version=open(os.path.join('details', '_version')).read(),
description='Tools for processing AWS detailed billing reports',
long_description=o... | 1.351563 | 1 |
beam_telescope_analysis/testing/test_kalman.py | YannickDieter/beam_telescope_analysis | 3 | 7066 | <filename>beam_telescope_analysis/testing/test_kalman.py
''' Script to check the correctness of the analysis. The analysis is done on raw data and all results are compared to a recorded analysis.
'''
import os
import unittest
import numpy as np
from beam_telescope_analysis import track_analysis
from beam_telescope_a... | 2.53125 | 3 |
test/test_workflow.py | asnramos/asv | 0 | 7067 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
import glob
import os
import sys
import json
from os.path import join, isfile
import pytest
from asv import util
from . import tools
def test_run_publish(capfd, basic_conf_2):
tmpdir, local, conf, machine_file = basic_conf_2
tmpdir = util.lon... | 1.921875 | 2 |
trainer.py | Metro1998/P-DQN | 5 | 7068 | # @author Metro
# @time 2021/11/24
import os.path
import gym
from agents.pdqn import P_DQN
from utilities.memory import ReplayBuffer
from utilities.utilities import *
from utilities.route_generator import generate_routefile
class Train_and_Evaluate(object):
def __init__(self, config):
# Environment
... | 2.1875 | 2 |
server/splunkdj/views.py | splunk/splunk-webframework | 31 | 7069 | import sys
import pprint
import json
import datetime
import uuid
import urllib
import types
import traceback
from django.core.urlresolvers import reverse, resolve
from django.http import HttpResponseRedirect, Http404, HttpResponseServerError, HttpResponseNotFound
from django.conf import settings
from django.contrib.aut... | 1.96875 | 2 |
wbia/plottool/interact_keypoints.py | mmulich/wildbook-ia | 0 | 7070 | <filename>wbia/plottool/interact_keypoints.py
# -*- coding: utf-8 -*-
import logging
import utool as ut
import six
from . import draw_func2 as df2
from wbia.plottool import plot_helpers as ph
from wbia.plottool import interact_helpers as ih
from wbia.plottool.viz_featrow import draw_feat_row
from wbia.plottool.viz_keyp... | 2.234375 | 2 |
tb/storage/__init__.py | DronMDF/manabot | 1 | 7071 | from .database import StDatabase
from .telegram import StTelegram
from .tinydb import TinyDataBase, TinySelect
from .utility import StDispatch
| 1.09375 | 1 |
algorithms/maths/chinese_remainder_theorem.py | hbqdev/algorithms | 22,426 | 7072 | <reponame>hbqdev/algorithms<filename>algorithms/maths/chinese_remainder_theorem.py
from algorithms.maths.gcd import gcd
from typing import List
def solve_chinese_remainder(num : List[int], rem : List[int]):
"""
Computes the smallest x that satisfies the chinese remainder theorem
for a system of equations.
... | 3.84375 | 4 |
exercises/ja/exc_03_16_01.py | Jette16/spacy-course | 2,085 | 7073 | <reponame>Jette16/spacy-course<gh_stars>1000+
import spacy
nlp = spacy.load("ja_core_news_sm")
text = (
"チックフィレイはジョージア州カレッジパークに本社を置く、"
"チキンサンドを専門とするアメリカのファストフードレストランチェーンです。"
)
# トークナイズのみ行う
doc = nlp(text)
print([token.text for token in doc])
| 2.71875 | 3 |
apphelper/image.py | caiyueliang/chineseocr | 0 | 7074 | <filename>apphelper/image.py
# -*- coding: utf-8 -*-
"""
##图像相关函数
@author: lywen
"""
import sys
import six
import os
import base64
import requests
import numpy as np
import cv2
from PIL import Image
import traceback
import uuid
from glob import glob
from bs4 import BeautifulSoup
def sort_box_(box):
x1,y1,x2,y2,x3... | 2.640625 | 3 |
opendatatools/common/ui_util.py | harveywwu/OpenData | 0 | 7075 | # -*- coding: UTF-8 -*-
import sys, time
class ShowProcess():
"""
显示处理进度的类
调用该类相关函数即可实现处理进度的显示
"""
i = 0 # 当前的处理进度
max_steps = 0 # 总共需要处理的次数
max_arrow = 50 #进度条的长度
infoDone = 'done'
# 初始化函数,需要知道总共的处理次数
def __init__(self, max_steps, infoDone = 'Done'):
self.max_steps = ... | 3.484375 | 3 |
data_structure/stack_and_queue/494. Target Sum_ Medium.py | JunzhongLin/leetcode_practice | 0 | 7076 | <filename>data_structure/stack_and_queue/494. Target Sum_ Medium.py
'''
You are given an integer array nums and an integer target.
You want to build an expression out of nums by adding one of the symbols '+' and '-' before each integer in nums and then concatenate all the integers.
For example, if nums = [2, 1], you ... | 3.703125 | 4 |
fixtrack/frontend/pickable_markers.py | os-gabe/fixtrack | 0 | 7077 | import numpy as np
from fixtrack.frontend.pickable_base import PickableBase
from vispy import scene
class PickableMarkers(PickableBase):
"""
Markers that can highlight on hover and be selected
"""
class State(PickableBase.State):
def __init__(self, **kwargs):
super(PickableMarker... | 2.390625 | 2 |
examples/blocking_subscribe.py | FFY00/jeepney | 0 | 7078 | <reponame>FFY00/jeepney
"""
Example of subscribing to a D-Bus signal using blocking I/O.
This subscribes to the signal for a desktop notification being closed.
To try it, start this script, then trigger a desktop notification, and close it
somehow to trigger the signal. Use Ctrl-C to stop the script.
This example rel... | 2.609375 | 3 |
test.py | league3236/shholiday | 0 | 7079 | <reponame>league3236/shholiday<gh_stars>0
from shholiday import holiday2020 as hd
daytuple = (1,1)
nowholiday = hd.holiday2020()
print(nowholiday.is_holiday(daytuple)) | 2.390625 | 2 |
blog/migrations/0005_title_null.py | encukou/Zpetnovazebnik | 1 | 7080 | # Generated by Django 2.1.7 on 2019-02-27 14:23
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('blog', '0004_longer_password'),
]
operations = [
migrations.AlterField(
model_name='session',
name='title',
... | 1.5625 | 2 |
setup.py | Kuba77/Xian-DB | 1 | 7081 | from setuptools import setup
from codecs import open
from os import path
here = path.abspath(path.dirname(__file__))
with open(path.join(here, 'README.rst'), encoding='utf-8') as f:
long_description = f.read()
setup(
name='xiandb',
version='0.2.0',
description='A database model for Xian',
long_d... | 1.359375 | 1 |
yolo3/focal_loss.py | ashishpatel26/tf2-yolo3 | 43 | 7082 | from functools import partial
import tensorflow as tf
_EPSILON = tf.keras.backend.epsilon()
def register_keras_custom_object(cls):
tf.keras.utils.get_custom_objects()[cls.__name__] = cls
return cls
def binary_focal_loss(y_true, y_pred, gamma, *, pos_weight=None, from_logits=False, label_smoothing=None):
... | 2.21875 | 2 |
characters/models/characters.py | Sult/evetool | 0 | 7083 | import time
from collections import OrderedDict
from datetime import datetime, timedelta
from django.db import models
from django.conf import settings
from django.utils.timezone import utc
from .skills import Skill, SkillGroup
from metrics.models import Corporation
from tasks.models import EveApiCache, Task
from evet... | 2.03125 | 2 |
webex_assistant_sdk/templates/mindmeld_template/{{cookiecutter.skill_name}}/{{cookiecutter.skill_name}}/__init__.py | sachanacar/webex-assistant-sdk | 0 | 7084 | # -*- coding: utf-8 -*-
from {{cookiecutter.skill_name}}.root import app
__all__ = ['app']
| 1.007813 | 1 |
backend/api/v1/dialogs/urls.py | donicrazy/ChatApp | 0 | 7085 | from django.urls import path
from backend.api.v1.dialogs.views import (
DialogListCreateView,
DialogRetrieveUpdateDestroyAPIView,
DialogMembershipListCreateView,
DialogMessageListCreateView,
DialogMessageRetrieveUpdateDestroyAPIView,
)
urlpatterns = [
path('', DialogListCreateView.as_view()),
... | 1.804688 | 2 |
biomaj2galaxy/commands/init.py | genouest/biomaj2galaxy | 1 | 7086 | <filename>biomaj2galaxy/commands/init.py
# coding: utf-8
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import os
from bioblend import galaxy
from biomaj2galaxy import config, pass_context
from biomaj2galaxy.io import info, warn
import click
CONFIG_TEM... | 2.4375 | 2 |
datamart/tests/test_Dimension.py | josemrsantos/zoopla_datamart | 1 | 7087 | <filename>datamart/tests/test_Dimension.py
from ..datamart import *
def test_create_dimension():
dimension = Dimension("test_dimension")
assert dimension.is_degenerate == False
def test_create_dimension_insert_2_identical_lines():
''' with 2 identical lines, only one gets stored
'''
dimension = Di... | 2.484375 | 2 |
preprocessing/convert_formats/msmarco_doc_create_train_input.py | PranjaliJain/matchmaker | 97 | 7088 | #
# msmarco doc: create the train.tsv triples
# -------------------------------
import random
random.seed(42)
import argparse
import os
import sys
from tqdm import tqdm
sys.path.append(os.getcwd())
from matchmaker.evaluation.msmarco_eval import *
from collections import defaultdict
from matchmaker.dataloaders.blin... | 1.773438 | 2 |
tests/communities/test_reply.py | powerblossom/workcloud | 1 | 7089 | <reponame>powerblossom/workcloud
from core.response import Response
from communities.tests import TestCase
class ReplyPermissionTest(TestCase):
def setUp(self):
self.create_user(is_staff=True)
def test_permission_reply_all(self):
self.create_forum()
self.create_thread()
thread... | 2.28125 | 2 |
examples/Word2Vec_AverageVectorsTuto.py | noiseux1523/Deep-Belief-Network | 1 | 7090 | <reponame>noiseux1523/Deep-Belief-Network
# Author: <NAME>
# Date: 8/6/2014
#
# This file contains code to accompany the Kaggle tutorial
# "Deep learning goes to the movies". The code in this file
# is for Parts 2 and 3 of the tutorial, which cover how to
# train a model using Word2Vec.
#
# *********************... | 3.5 | 4 |
src/phl_budget_data/etl/qcmr/positions/__init__.py | PhiladelphiaController/phl-budget-data | 0 | 7091 | from .core import FullTimePositions
| 0.972656 | 1 |
sdk/loganalytics/azure-mgmt-loganalytics/azure/mgmt/loganalytics/models/search_get_schema_response.py | tzhanl/azure-sdk-for-python | 1 | 7092 | # coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes ... | 1.992188 | 2 |
python/ds/spiralprint.py | unhingedporter/DataStructureMustKnow | 3 | 7093 | # Python3 program to print
# given matrix in spiral form
def spiralPrint(m, n, a):
start_row_index = 0
start_col_index = 0
l = 0
''' start_row_index - starting row index
m - ending row index
start_col_index - starting column index
n - ending column index
i - iterator '''
while (start... | 4.59375 | 5 |
rest-api/routers/authorization.py | marintrace/backend | 2 | 7094 | <gh_stars>1-10
"""
Authorization Utilities
"""
from shared.models.user_entities import User
from shared.service.jwt_auth_wrapper import JWTAuthManager
manager = JWTAuthManager(oidc_vault_secret="oidc/rest",
object_creator=lambda claims, assumed_role, user_roles: User(
... | 1.882813 | 2 |
photonpy/tests/psf_g2d_sigma.py | qnano/photonpy | 5 | 7095 | import matplotlib.pyplot as plt
import numpy as np
from photonpy.cpp.context import Context
import photonpy.cpp.gaussian as gaussian
from photonpy.smlm.util import imshow_hstack
from photonpy.cpp.estimator import Estimator
def CheckDeriv(psf:Estimator, theta):
nderiv,ev=psf.NumDeriv(theta,eps=1e-6)
deriv,ev=p... | 2.1875 | 2 |
tests/tools_tests/helpers_tests.py | Gautierhyp/tespy | 0 | 7096 | # -*- coding: utf-8
"""Module for testing helper functions.
This file is part of project TESPy (github.com/oemof/tespy). It's copyrighted
by the contributors recorded in the version control history of the file,
available from its original location
tests/tools_tests/helpers_tests.py
SPDX-License-Identifier: MIT
"""
... | 2.84375 | 3 |
theory/model/form.py | ralfonso/theory | 4 | 7097 | import formencode
import pylons
from pylons import app_globals as g
class OutputSchema(formencode.Schema):
allow_extra_fields = False
enabled = formencode.validators.Int()
class ConfigForm(formencode.Schema):
allow_extra_fields = True
filter_extra_fields = True
#pre_validators = [formencode.Nest... | 2.25 | 2 |
utils/dynamo.py | OnRails-IN/backend | 0 | 7098 | """
Dynamo Utils
============
All utility functions for interactions with DynamoDB
Functions
- ensure_json
- create_user_table
- create_or_update_record
- list_tables
- list_records
- get_record
- delete_table
- delete_record
- check_active
"""
import boto3
from decimal import Deci... | 2.6875 | 3 |
cloudcms/branch/__init__.py | gitana/cloudcms-python-driver | 0 | 7099 | from .branch import Branch | 1.03125 | 1 |