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 |
|---|---|---|---|---|---|---|
utils/ErrorMetrics.py | caozidong/Depth-Completion | 5 | 37600 | import torch
import torch.nn as nn
import torch.nn.functional as F
import numpy as np
class MAE(nn.Module):
def __init__(self):
super(MAE, self).__init__()
def forward(self, outputs, target, *args):
val_pixels = (target > 0).float().cuda()
err = torch.abs(target * val_pixels - outputs ... | 2.84375 | 3 |
main.py | jagadeesh-vinnakota/iiot_health | 0 | 37601 | import dash
import dash_core_components as dcc
import dash_html_components as html
from data_gather import plot_line_graph
from run_save_model import predict_line_graph, train_save_load
from generating_data import generate_sensors_data
# generating sensors data
generate_sensors_data()
train_save_load()
external_style... | 2.4375 | 2 |
what_is_code.py | ccostino/what-is-code | 1 | 37602 | <gh_stars>1-10
#!/usr/bin/env python
"""
WhatIsCode
This extremely simple script was an inspiration driven by a combination of
<NAME>'s article on Bloomberg Business Week, "What is Code?"[1] and
Haddaway's song, "What is Love"[2]. It is probably best enjoyed while
watching an 8-bit demake of the song[3], or 16-bit i... | 3.4375 | 3 |
frcnn/lib/datasets/cocoatts.py | visinf/style-seqcvae | 0 | 37603 | <reponame>visinf/style-seqcvae<gh_stars>0
import os
import pickle
import numpy as np
from datasets.config_attrib_selection import attrib_selection
def save_obj(obj, path):
with open(path, 'wb') as f:
pickle.dump(obj, f, pickle.HIGHEST_PROTOCOL)
def load_obj(path):
with open(path, 'rb') as f... | 2.21875 | 2 |
easy/count-as-i-count/main.py | khanh-alice/codingame-python | 0 | 37604 | initialScore = int(input())
def count_solutions(score, turn):
if score > 50 or turn > 4:
return 0
if score == 50:
return 1
result = count_solutions(score + 1, turn + 1)
for i in range(2, 13):
result += 2 * count_solutions(score + i, turn + 1)
return result
print(count... | 3.21875 | 3 |
python/udp_socket_emit.py | draconicfae/godot_daydream_controller | 0 | 37605 | import socket
import json
class udp_emit:
def __init__(self, host, port):
self.sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
self.sock.connect((host, port))
def emit(self, datadict):
try:
self.sock.sendall(json.dumps(datadict).encode())
... | 2.796875 | 3 |
recuEuclid.py | azyxb/info | 2 | 37606 | <reponame>azyxb/info<gh_stars>1-10
#!/usr/bin/env python3
def gcd(a, b):
if a == 0 :
return b
return gcd(b%a, a)
a = 12000
b = 8642
print(gcd(a, b))
| 2.609375 | 3 |
distributed.py | SagaFav/etlpy | 448 | 37607 | import sys;
from queue import Queue
from multiprocessing.managers import BaseManager
import etl;
import json
import extends;
import time;
authkey= "etlpy".encode('utf-8')
timeout=1;
rpc_port=8888
class ETLJob:
def __init__(self,project,jobname,config,id):
self.project= project;
self.jobname=jobnam... | 2.6875 | 3 |
je_auto_control/utils/exception/__init__.py | JE-Chen/Python_JEAutoControl | 9 | 37608 | <gh_stars>1-10
from je_auto_control.utils.exception import *
| 1.15625 | 1 |
kafka_streamer/topic/datatype/base.py | sam-mosleh/kafka-streamer | 1 | 37609 | <reponame>sam-mosleh/kafka-streamer<filename>kafka_streamer/topic/datatype/base.py
from abc import ABC, abstractmethod
from typing import Type, Union
from kafka_streamer.models import SchematicRecord, Serializable
class KafkaDataType(ABC):
_MAGIC_BYTE = 0
@abstractmethod
def deserialize(self, data: byte... | 2.125 | 2 |
Searching and Sorting/playlist.py | mishrakeshav/CSES-Problem-Set | 0 | 37610 |
def solve():
n = int(input())
k = list(map(int,input().split()))
hashmap = dict()
j = 0
ans = 0
c = 0
for i in range(n):
if k[i] in hashmap and hashmap[k[i]] > 0:
while i > j and k[i] in hashmap and hashmap[k[i]] > 0:
hashmap[k[j]] -= 1
... | 2.859375 | 3 |
tools/extract-qa-from-squad.py | xuqingyang/qa-robot | 0 | 37611 | import json
import argparse
import pprint
import csv
parser = argparse.ArgumentParser(description="parse squad qa into scv")
parser.add_argument("--input", type=str)
parser.add_argument("--output", type=str)
args = parser.parse_args()
input_file = args.input
output_file = args.output
with open(input_file, 'r') as f:
... | 3.203125 | 3 |
boardinghouse/middleware.py | luzfcb/django-boardinghouse | 0 | 37612 | from __future__ import unicode_literals
import logging
import re
from django.contrib import messages
from django.db import ProgrammingError
from django.http import HttpResponse, HttpResponseForbidden, HttpResponseRedirect
from django.shortcuts import redirect
from django.utils.translation import ugettext_lazy as _
fr... | 2.03125 | 2 |
meta-nml/model.py | kevintli/mural | 5 | 37613 | import torch.nn as nn
import numpy as np
from collections import OrderedDict
from torchmeta.modules import (MetaModule, MetaConv2d, MetaBatchNorm2d,
MetaSequential, MetaLinear)
import torch
def conv_block(in_channels, out_channels, **kwargs):
return MetaSequential(OrderedDict([
... | 2.59375 | 3 |
debug.py | davenewham/BlackBoard-Course-Downloader | 57 | 37614 | from blackboard import BlackBoardContent, BlackBoardClient, BlackBoardAttachment, BlackBoardEndPoints, \
BlackBoardCourse, BlackBoardInstitute
import os
import re
import requests
import datetime
import xmltodict
import argparse
import sys
import json
import getpass
import main
def test():
args = main.handle_ar... | 2.359375 | 2 |
easycron/easycron/plist.py | skeptycal/.dotfiles | 5 | 37615 | #!/usr/bin/env python3
import datetime
import plistlib
import tempfile
import time
from os import PathLike
from typing import Dict, Union
pl = dict(
aString="Doodah",
aList=["A", "B", 12, 32.1, [1, 2, 3]],
aFloat=0.1,
anInt=728,
aDict=dict(
anotherString="<hello & hi there!>",
aThir... | 2.640625 | 3 |
symposion/schedule/migrations/0003_remove_presentation_additional_speakers.py | pyohio/symposion | 0 | 37616 | <gh_stars>0
# -*- coding: utf-8 -*-
# Generated by Django 1.11.9 on 2018-06-23 06:06
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('symposion_schedule', '0002_slot_name'),
]
operations = [
migrations.Rem... | 1.351563 | 1 |
setup.py | 3kwa/datoms | 4 | 37617 | from setuptools import setup
setup(
name = 'datoms',
version = '0.1.0',
description = 'A simplistic, Datomic inspired, SQLite backed, REST influenced, schemaless auditable facts storage.',
py_modules = ['datoms'],
license = 'unlicense',
author = '<NAME>',
author_email = '<EMAIL>',
url ... | 0.96875 | 1 |
cocoa_folder/scripts/bot_bot_chat.py | s-akanksha/DialoGraph_ICLR21 | 12 | 37618 | <gh_stars>10-100
'''
Takes two agent implementations and generates the dialogues.
'''
import argparse
import random
import json
import numpy as np
from cocoa.core.util import read_json
from cocoa.core.schema import Schema
from cocoa.core.scenario_db import ScenarioDB, add_scenario_arguments
from cocoa.core.dataset im... | 2.5 | 2 |
app/handlers/admins/moderation.py | vitaliy-ukiru/math-bot | 1 | 37619 | <reponame>vitaliy-ukiru/math-bot<gh_stars>1-10
# Source: https://github.com/aiogram/bot/blob/master/aiogram_bot/handlers/simple_admin.py
import logging
from aiogram import types
from aiogram.utils import exceptions
from babel.dates import format_timedelta
from app.loader import dp
from app.utils.timedelta import par... | 2.109375 | 2 |
serial_scripts/system_test/flow_tests/ReleaseToFlowSetupRateMapping.py | atsgen/tf-test | 5 | 37620 | <reponame>atsgen/tf-test<gh_stars>1-10
# Here the rate is set for Policy flows, local to a compute, which is
# lesser than policy flows across computes
expected_flow_setup_rate = {}
expected_flow_setup_rate['policy'] = {
'1.04': 6000, '1.05': 9000, '1.06': 10000, '1.10': 10000, '2.10': 13000}
expected_flow_setup_ra... | 1.757813 | 2 |
DP_MCP.py | man-o-war/DS-Algorithms | 0 | 37621 | # Dynamic Programming Python implementation of Min Cost Path
# problem
R = 3
C = 3
def minCost(cost, m, n):
# Instead of following line, we can use int tc[m+1][n+1] or
# dynamically allocate memoery to save space. The following
# line is used to keep te program simple and make it working
#... | 4.15625 | 4 |
Views/Affichage/transitionView.py | yvesjordan06/automata-brains | 3 | 37622 | <gh_stars>1-10
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'UI/transitionView.ui'
#
# Created by: PyQt5 UI code generator 5.14.1
#
# WARNING! All changes made in this file will be lost!
from PyQt5 import QtCore, QtGui, QtWidgets
from PyQt5.QtGui import QIcon
from Models.Automate imp... | 1.710938 | 2 |
gellifinsta/migrations/0004_rename_local_fname_gellifinsta_file_path.py | vallka/djellifique | 0 | 37623 | <filename>gellifinsta/migrations/0004_rename_local_fname_gellifinsta_file_path.py
# Generated by Django 3.2.4 on 2021-06-23 14:52
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('gellifinsta', '0003_auto_20210622_1928'),
]
operations = [
migrati... | 1.617188 | 2 |
python/etc/extract_final_branch_weights.py | AdamByerly/MMLCNNwHFCs | 38 | 37624 | # Copyright 2021 <NAME>. 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 agreed to... | 2.109375 | 2 |
pykSpider/kSpider2/ks_clustering.py | mr-eyes/kSpider2 | 0 | 37625 | from __future__ import division
from collections import defaultdict
import itertools
import sys
import os
import sqlite3
import click
from kSpider2.click_context import cli
import glob
class kClusters:
source = []
target = []
source2 = []
target2 = []
seq_to_kmers = dict()
names_map = dict()
... | 2.21875 | 2 |
workflow/scripts/build_primer_regions.py | kokyriakidis/dna-seq-varlociraptor | 0 | 37626 | import pandas as pd
def parse_bed(log_file, out):
print("chrom\tleft_start\tleft_end\tright_start\tright_end", file=out)
for data_primers in pd.read_csv(
snakemake.input[0],
sep="\t",
header=None,
chunksize=chunksize,
usecols=[0, 1, 2, 5],
):
for row in data... | 2.953125 | 3 |
utils/visualMap.py | TwelveYC/network-vi | 14 | 37627 | import numpy as np
import matplotlib.pyplot as plt
import matplotlib.colors as colors
class MapColorControl():
def __init__(self, colour_scheme, map_normalization,data):
self.colors = plt.get_cmap(colour_scheme)(range(256))[:,:3]
self.data = data
if self.data.min() <= 0:
self.d... | 3.125 | 3 |
data/train/python/459249d4734814fb5305d256f82cc0dc0641dd16urls.py | harshp8l/deep-learning-lang-detection | 84 | 37628 | from django.conf.urls import patterns, url
from lattice.views import (lattices)
from lattice.views import (saveLatticeInfo, saveLattice)
from lattice.views import (saveModel)
from lattice.views import (lattice_home, lattice_content_home, lattice_content_search, lattice_content_list, lattice_content_model_list, lattice... | 2.078125 | 2 |
src/core/sessions/buffers/gui/configuration/twitter/__init__.py | Oire/TheQube | 21 | 37629 | from main import BufferConfigDialog
import panels
| 0.996094 | 1 |
fluid/PaddleRec/ctr/network_conf.py | KaiyuYue/models | 1 | 37630 | <reponame>KaiyuYue/models<gh_stars>1-10
import paddle.fluid as fluid
import math
dense_feature_dim = 13
def ctr_dnn_model(embedding_size, sparse_feature_dim):
dense_input = fluid.layers.data(
name="dense_input", shape=[dense_feature_dim], dtype='float32')
sparse_input_ids = [
fluid.layers.data... | 2.515625 | 3 |
hangman_game.py | praneethmolleti/utopia | 0 | 37631 | <filename>hangman_game.py
import time
name=input("Enter your name:")
print("hello",name,"time to play Hangman!")
time.sleep(1)
print("start guessing")
time.sleep(0.5)
word="secret"
guesses=""
turns=10
while turns>0:
failed=0
for i in word:
if i in guesses:
print(i)
else... | 3.984375 | 4 |
datawinners/submission/request_processor.py | ICT4H/dcs-web | 1 | 37632 | <filename>datawinners/submission/request_processor.py
import json
import logging
from django.conf import settings
from datawinners.feeds.database import get_feeds_db_for_org
from mangrove.transport import TransportInfo
from datawinners.accountmanagement.models import TEST_REPORTER_MOBILE_NUMBER, OrganizationSetting
fro... | 1.9375 | 2 |
tests/test_losses.py | p768lwy3/torecsys | 92 | 37633 | import unittest
import torch
from parameterized import parameterized
from torecsys.losses import *
device = 'cuda:0' if torch.cuda.is_available() else 'cpu'
class AdaptiveHingeLossTestCase(unittest.TestCase):
@parameterized.expand([
(4, 32,),
(16, 16,),
(32, 4,),
])
def test_for... | 2.453125 | 2 |
src/jrtts/GlowTTS/Networks/build_model.py | tosaka-m/japanese_realtime_tts | 5 | 37634 | <reponame>tosaka-m/japanese_realtime_tts
#coding:utf-8
import torch
from torch import nn
from .models import FlowGenerator
def build_model(model_params={}):
model = FlowGenerator(**model_params)
initialize(model)
return model
def initialize(model):
initrange = 0.1
bias_initrange = 0.001
parame... | 2.46875 | 2 |
layers.py | xiangsheng1325/fastgae_pytorch | 8 | 37635 | import torch, math, copy
import scipy.sparse as sp
import numpy as np
from torch.nn.modules.module import Module
import torch.nn as nn
from torch.nn.parameter import Parameter
def normalize(adj, device='cpu'):
if isinstance(adj, torch.Tensor):
adj_ = adj.to(device)
elif isinstance(adj, sp.c... | 2.203125 | 2 |
common/db.py | levinster82/GaragePi | 34 | 37636 | import os
from sqlite3 import dbapi2 as sqlite3
class GarageDb:
def __init__(self, instance_path, resource_path):
self.db_file = os.path.join(instance_path, 'history.db')
self.init_file = os.path.join(resource_path, 'schema.sql')
# Run init script to ensure database structure
conn ... | 2.671875 | 3 |
environments/migrations/0003_auto_20201228_1616.py | Teosidonio/Data_Solution | 0 | 37637 | <reponame>Teosidonio/Data_Solution<gh_stars>0
# Generated by Django 3.1 on 2020-12-28 14:16
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('environments', '0002_auto_20201228_1548'),
]
operations = [
migrations.AlterModelOptions(
na... | 1.78125 | 2 |
code_all/day17/homework/exercise02.py | testcg/python | 0 | 37638 | """
迭代器 --> yield
"""
class CommodityController:
def __init__(self):
self.__commoditys = []
def add_commodity(self, cmd):
self.__commoditys.append(cmd)
def __iter__(self):
index = 0
yield self.__commoditys[index]
index += 1
yield self.__commoditys[in... | 3.8125 | 4 |
src/reporter/reporter/reports/estimate.py | tomasfarias/pipeline | 1 | 37639 | <reponame>tomasfarias/pipeline
import pandas as pd
from reporter.report import Report
class Estimate(Report):
def run(self):
query = (
"select * from orders where status = 'CANCELLED' and "
f"updated_ts between '{self.start: %Y-%m-%d %H:%M:%S}'::timestamp and "
f"'{se... | 2.734375 | 3 |
icls/models/resnet/resnet_test.py | TaikiInoue/iClassification | 0 | 37640 | <gh_stars>0
from torchvision.models import resnet50
model = resnet50(pretrained=True)
| 1.359375 | 1 |
core/templatetags/core_menu.py | baxtea/pipeline | 18 | 37641 | <filename>core/templatetags/core_menu.py
from django import template
from core.models import (
ArticlesIndexPage,
ArticlePage,
StaffPage,
CandidatePage,
ElectionIndexPage,
)
from home.models import HomePage
register = template.Library()
@register.simple_tag(takes_context=True)
def get_site_root(... | 2.21875 | 2 |
onmt/modules/UniversalTransformer/Layers.py | esalesky/NMTGMinor | 5 | 37642 | <filename>onmt/modules/UniversalTransformer/Layers.py<gh_stars>1-10
import math
import torch
import torch.nn as nn
from torch.autograd import Variable
import torch.nn.init as init
import torch.nn.utils.weight_norm as WeightNorm
import onmt
import torch.nn.functional as F
from onmt.modules.Bottle import Bottle
from on... | 2.34375 | 2 |
upload_folder_to_root.py | cbhramar/Google-Drive-APIs-in-Python | 0 | 37643 | <reponame>cbhramar/Google-Drive-APIs-in-Python<filename>upload_folder_to_root.py
from pydrive.auth import GoogleAuth
from pydrive.drive import GoogleDrive
from oauth2client.client import OAuth2Credentials
import json
import sys
import os
LOCAL_FOLDER_NAME='h5downloads'
def load_saved_credentials():
with open('tok... | 3.328125 | 3 |
Server/app.py | AkashSasank/Covid-19-X-ray-scanner | 1 | 37644 | <filename>Server/app.py
import os
from flask import Flask, render_template, request, redirect, url_for, \
make_response # These are all we need for our purposes
from flask_cors import CORS
import tensorflow as tf
from keras.preprocessing.image import load_img, img_to_array
from werkzeug.utils import secure_filen... | 2.40625 | 2 |
_fred-v1/fred/endpoints/shutdown.py | elviva404/frontend-regression-validator | 70 | 37645 | from flask_restful import Resource
from flask import request
class Shutdown(Resource):
def get(self):
shutdown = request.environ.get('werkzeug.server.shutdown')
if shutdown is None:
raise RuntimeError('Not running with the Werkzeug Server')
shutdown()
return 'Server shu... | 2.53125 | 3 |
module/object/sql.py | arvin-chou/mc | 0 | 37646 | <reponame>arvin-chou/mc
# -*- coding: utf-8 -*-
from sqlalchemy import Table, Column, Integer, String, MetaData, \
ForeignKey, DateTime, UniqueConstraint
from config.config import _logging, metadata
from .model import ObjectsIpaddrs, ObjectsIpgroups
from .__init__ import __objects_ipaddrs_ipgroups_tablename__... | 1.851563 | 2 |
instaclient/instagram/postmedia.py | pthalin/instaclient | 0 | 37647 | from typing import Optional, List, TYPE_CHECKING
if TYPE_CHECKING:
from instaclient.client.instaclient import InstaClient
from instaclient.instagram.instaobject import InstaBaseObject
class PostMedia(InstaBaseObject):
def __init__(self,
client:'InstaClient',
id:int,
type:str,
viewer:str,
s... | 2.421875 | 2 |
source/server/annotation/migrations/0002_auto_20200622_0656.py | shizacat/shanno | 1 | 37648 | <reponame>shizacat/shanno
# Generated by Django 3.0.7 on 2020-06-22 06:56
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('annotation', '0001_initial'),
]
operations = [
migrations.AlterField(
... | 1.726563 | 2 |
setup.py | GiorgioBalestrieri/renewables-ninja-client | 1 | 37649 | from setuptools import setup, find_packages
setup(
name = "renewables_ninja_client",
version = "0.1.0",
description = ("Client for Renewables Ninja API."),
author = ["<NAME>"],
packages = find_packages(exclude=[
"docs", "tests", "examples",
"sandbox", "scripts"]),
install_requi... | 1.359375 | 1 |
pysigep/correios/__init__.py | primeschool-it/trustcode-pysigep | 0 | 37650 | # -*- coding: utf-8 -*-
# © 2016 <NAME>, Trustcode
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
# #############################################################################
#
# <NAME> Sigep WEB
# Copyright (C) 2015 KMEE (http://www.kmee.com.br)
# @author: <NAME> <<EMAIL>>
# @auth... | 1.5 | 2 |
urls.py | enisimsar/watchtower-news | 2 | 37651 | """
Endpoints
"""
from handlers.auth import UserHandler, AuthHandler
from handlers.base import StaticHandler
from handlers.invitations import InvitationHandler, InvitationsHandler, InvitationPostHandler
from handlers.logs import LogHandler, LogsHandler
from handlers.swagger import SwaggerHandler
from handlers.topics im... | 1.9375 | 2 |
src/compose.py | vimc/montagu | 0 | 37652 | <reponame>vimc/montagu
from subprocess import Popen
from docker_helpers import montagu_registry
import shutil
import versions
def start(settings):
run("up -d", settings)
def stop(settings):
run("stop", settings)
run("rm -f", settings)
def pull(settings):
run("pull", settings)
def run(args, set... | 2.296875 | 2 |
bread/layout/components/notification.py | tpokorra/bread | 0 | 37653 | <gh_stars>0
import datetime
import htmlgenerator
from django.utils.translation import gettext as _
from .button import Button
from .icon import Icon
KIND_ICON_MAPPING = {
"error": "error--filled",
"info": "information--filled",
"info-square": "information--square--filled",
"success": "checkmark--fill... | 2.375 | 2 |
Desafio53.py | VictorCastao/Curso-em-Video-Python | 0 | 37654 | <filename>Desafio53.py
print('=' * 12 + 'Desafio 53' + '=' * 12)
frase = input('Digite sua frase: ')
frase = frase.strip().replace(" ","").upper()
tamanho = len(frase)
contador = 0
igual = 0
for i in range(tamanho - 1, -1, -1):
if frase[contador] == frase[i]:
igual += 1
contador += 1
if contador == tama... | 3.703125 | 4 |
example/pytorch/run.py | alibaba/sionnx | 34 | 37655 | #*
#* Copyright (C) 2017-2019 Alibaba Group Holding Limited
#*
#* 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 ... | 2.03125 | 2 |
scripts/ipu/callbacks.py | BastienArcelin/IPU-GPU | 0 | 37656 | import sys, os
import numpy as np
import matplotlib.pyplot as plt
from tensorflow.keras.callbacks import Callback, ReduceLROnPlateau, TerminateOnNaN, ModelCheckpoint
import tensorflow.keras.backend as K
import tensorflow as tf
import time
###### Callbacks
# Create a callback to compute time spent between 10th and 110t... | 2.71875 | 3 |
ag/tests/test_metrics.py | justyre/jus | 0 | 37657 | """Unit tests for the metrics module."""
import pytest
from forest import metrics
def test_counter():
"""Test counter."""
counter = metrics.Counter()
counter.increase()
assert counter.count == 1
counter.increase(10)
assert counter.count == 11
counter.decrease()
assert c... | 2.84375 | 3 |
appmap/test/conftest.py | calvinsomething/appmap-python | 0 | 37658 | import importlib
import pytest
import yaml
import appmap._implementation
from appmap._implementation.env import Env
from appmap._implementation.recording import Recorder
def _data_dir(pytestconfig):
return pytestconfig.rootpath / 'appmap' / 'test' / 'data'
@pytest.fixture(name='data_dir')
def fixture_data_dir(py... | 1.945313 | 2 |
occ_sim/animation.py | refmitchell/dcidb-supplemental-repository | 0 | 37659 | """
animation.py
This script is used to procduce animations of population behaviour
over a range of changing conditions. For example, if we wanted to
see how a population would change as light was elevated and wind
kept constant, we could produce the animation and watch the
general trend. This was mostly useful for vi... | 3.65625 | 4 |
Day18/turtle_dashed_line.py | CodePuzzler/100-Days-Of-Code-Python | 0 | 37660 | <reponame>CodePuzzler/100-Days-Of-Code-Python<filename>Day18/turtle_dashed_line.py
# Day18 of my 100DaysOfCode Challenge
# Draw a dashed line using Turtle Graphics
from turtle import Turtle, Screen
groot = Turtle()
for _ in range(15):
groot.forward(10)
groot.penup()
groot.forward(10)
groot.pendown()
... | 3.796875 | 4 |
src/rxn_network/reactions/open.py | GENESIS-EFRC/reaction-network | 29 | 37661 | <filename>src/rxn_network/reactions/open.py
"""
A reaction class that builds reactions based on ComputedEntry objects under the
presence of an open entry (e.g. O2), and provides information about reaction
thermodynamics computed as changes in grand potential.
"""
from typing import Dict, List, Optional, Union
import ... | 2.953125 | 3 |
image_classifier_flowers/ImageClassifier/data_management.py | ChrisEdel/AI-Programming-with-Python-Nanodegree | 0 | 37662 | <filename>image_classifier_flowers/ImageClassifier/data_management.py
import torch
from torchvision import datasets, transforms, models
from PIL import Image
def load_data(path):
print("Loading and preprocessing data from {} ...".format(path))
train_dir = path + '/train'
valid_dir = path + '/valid'
... | 2.9375 | 3 |
map_the_data.py | andrewnash/Thar-She-Blows | 1 | 37663 | <reponame>andrewnash/Thar-She-Blows<gh_stars>1-10
def create_box(input_corners):
x = (float(input_corners[0][0]), float(input_corners[1][0]))
y = (float(input_corners[0][1]), float(input_corners[1][1]))
windmill_lats, windmill_lons = zip(*[
(max(x), max(y)),
(min(x), max(y)),
(m... | 2.515625 | 3 |
sdk/python/pulumi_oci/dns/get_resolver_endpoint.py | EladGabay/pulumi-oci | 5 | 37664 | # 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 warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union, overload
from .. import... | 1.796875 | 2 |
tests/__init__.py | ExterraGroup/pyrsi | 8 | 37665 | <filename>tests/__init__.py<gh_stars>1-10
# -*- coding: utf-8 -*-
"""Unit test package for pyrsi."""
| 1.015625 | 1 |
src/morphforge/traces/methods/trace_methods_std_filters.py | mikehulluk/morphforge | 1 | 37666 | <gh_stars>1-10
#!/usr/bin/python
# -*- coding: utf-8 -*-
# ---------------------------------------------------------------------
# Copyright (c) 2012 <NAME>.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following condition... | 1.226563 | 1 |
snek/exts/syncer/__init__.py | Snek-Network/snek | 0 | 37667 | <reponame>Snek-Network/snek<gh_stars>0
from snek.bot import Snek
from snek.exts.syncer.cog import Syncer
def setup(bot: Snek) -> None:
"""Load the `Syncer` cog."""
bot.add_cog(Syncer(bot))
| 1.640625 | 2 |
Python/Testing/NoiseRemove.py | mishranilesh012/Natural_Language_Processing_Techniques | 1 | 37668 | import struct
import scipy.io.wavfile as wf
import numpy
import pydub
# for i in range(wave_file.getnframes()):
# # read a single frame and advance to next frame
# current_frame = wave_file.readframes(1)
#
# # check for silence
# silent = True
# # wave frame samples are stored in little endian**... | 2.828125 | 3 |
merchant-server/constants.py | googleinterns/product-catalog-builder-for-smbs | 2 | 37669 | NEW_ORDER = "NEW_ORDER"
ONGOING = "ONGOING"
PRODUCTS_PER_PAGE = 10
| 0.804688 | 1 |
Keras_2_trainOnBatch/train.py | sunshower76/Polyp-Segmentation | 2 | 37670 | import os
"""
# If you have multi-gpu, designate the number of GPU to use.
os.environ["CUDA_DEVICE_ORDER"]="PCI_BUS_ID"
os.environ["CUDA_VISIBLE_DEVICES"] = "6"
"""
import argparse
import logging
from tqdm import tqdm # progress bar
import numpy as np
import matplotlib.pyplot as plt
from keras import optimizers
from... | 2.265625 | 2 |
app/api/auth/api_v1/scheme.py | renovate-tests/pol | 5 | 37671 | from fastapi.security.api_key import APIKeyCookie, APIKeyHeader
API_KEY_NAME = "api_key"
cookie_scheme = APIKeyCookie(name="bgm-tv-auto-tracker", auto_error=False)
API_KEY_HEADER = APIKeyHeader(name="api-key", auto_error=False)
API_KEY_COOKIES = APIKeyCookie(name="api-key", auto_error=False)
| 1.789063 | 2 |
py_code/concise-tensorflow/cnn_model.py | xiangnan-fan/proj01 | 0 | 37672 | <reponame>xiangnan-fan/proj01<gh_stars>0
#!/bin/python3
# encoding: utf-8
import tensorflow as tf
tf.enable_eager_execution()
class CNN(tf.keras.Model):
def __init__(self):
super().__init__()
self.conv1 = tf.keras.layers.Conv2D(
filters=32,
kernel_size=[5, 5],
... | 2.96875 | 3 |
app/test/test_DQI.py | qianjing2020/lambda_lab | 0 | 37673 | <gh_stars>0
import context
from modules.data_preprocess import DataCleaning, DataQualityCheck
from modules.db_connect import dbConnect
from test_sequence import sale
qc = DataQualityCheck()
result = qc.generate_QC(sale)
print(result) | 1.398438 | 1 |
traceml/traceml/vendor/matplotlylib/__init__.py | jinheeson1008/tensorflow-lstm-regression | 4 | 37674 | """
matplotlylib
============
This module converts matplotlib figure objects into JSON structures which can
be understood and visualized by Plotly.
Most of the functionality should be accessed through the parent directory's
'tools' module or 'plotly' package.
"""
from __future__ import absolute_import
from .rendere... | 1.59375 | 2 |
tests/r/test_labour.py | hajime9652/observations | 199 | 37675 | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import shutil
import sys
import tempfile
from observations.r.labour import labour
def test_labour():
"""Test module labour.py by downloading
labour.csv and testing shape of
extracted data has 569 row... | 2.359375 | 2 |
tests/app_test/test_undelete.py | yucealiosman/soft-delete | 0 | 37676 | <filename>tests/app_test/test_undelete.py
from django.test import TestCase
from .factories import *
from .models import DEFAULT_EMPLOYEE_PK
class UndeleteTest(TestCase):
def setUp(self):
self.default_employee = EmployeeFactory(pk=DEFAULT_EMPLOYEE_PK)
self.employee = EmployeeFactory()
self... | 2.40625 | 2 |
bin/query_config.py | ubccr/pavilion2 | 1 | 37677 | <reponame>ubccr/pavilion2
from pavilion import config
import argparse
import sys
parser = argparse.ArgumentParser(
description="Finds the pavilion configuration, and prints the asked for "
"config value.")
parser.add_argument('key', nargs=1, action="store",
help="The config key... | 3.0625 | 3 |
examples/assessing_frontier/zt_loader.py | OscarDeGar/py_grama | 13 | 37678 | ## Data Loader: TE-CCA zT Dataset
# <NAME> (<EMAIL>) 2021-03-12
#
from citrination_client import CitrinationClient, PifSystemReturningQuery
from citrination_client import DataQuery, DatasetQuery, Filter
from matminer.featurizers.base import MultipleFeaturizer
from matminer.featurizers import composition as cf
from pyma... | 2.328125 | 2 |
server/requests_test.py | vikram628/postive.ly | 1 | 37679 | import requests
import json
from datetime import datetime
headers = {"Content-type": "application/json", "Accept": "text/plain"}
def addUser():
url = "http://10.194.223.134:5000/add_user"
data = {"username": "test_user"}
requests.post(url, data=json.dumps(data), headers=headers)
def addMessage():
url... | 2.953125 | 3 |
virtualisation/triplestore/triplestoreadapter.py | CityPulse/CP_Resourcemanagement | 2 | 37680 | from abc import abstractmethod
from abc import ABCMeta
__author__ = '<NAME> (<EMAIL>)'
class TripleStoreAdapter:
__metaclass__ = ABCMeta
@abstractmethod
def graphExists(self, graphName):
pass
@abstractmethod
def createGraph(self, graphName):
pass
@abstractmethod
def sav... | 3.171875 | 3 |
tests/test_lists.py | al3xandru/html2md | 8 | 37681 | import unittest
from context import html2md
from assertions import assertEq
__author__ = 'alex'
class SpecialListsTest(unittest.TestCase):
def test_text_and_paragraph(self):
in_html = '''<ul>
<li>item 1</li>
<li>item 2
<p>item 2 paragraph</p>
<p>item 2 item 2</p>
</li>
<li>item 3</li>
</ul>'''
... | 3.125 | 3 |
repo2apptainer/app.py | andersy005/repo2apptainer | 1 | 37682 | <reponame>andersy005/repo2apptainer
from __future__ import annotations
import pathlib
import subprocess
import pydantic
from repo2docker.app import Repo2Docker
from .config import config as _config
from .console import console
from .helpers import generate_image_name
@pydantic.dataclasses.dataclass
class Repo2Appt... | 2.328125 | 2 |
letsencrypt/plugins/standalone/tests/authenticator_test.py | stewnorriss/letsencrypt | 1 | 37683 | <reponame>stewnorriss/letsencrypt
"""Tests for letsencrypt.plugins.standalone.authenticator."""
import os
import pkg_resources
import psutil
import signal
import socket
import unittest
from cryptography.hazmat.backends import default_backend
from cryptography.hazmat.primitives import serialization
import mock
import O... | 2.375 | 2 |
pymoo/algorithms/genetic_algorithm.py | Electr0phile/pymoo | 1 | 37684 | import math
import numpy as np
from pymoo.model.algorithm import Algorithm
from pymoo.model.duplicate import DefaultDuplicateElimination
from pymoo.model.individual import Individual
from pymoo.model.population import Population
class GeneticAlgorithm(Algorithm):
def __init__(self,
pop_size,
... | 3.234375 | 3 |
frag_permute.py | bluhm/frag-regress | 2 | 37685 | #!/usr/local/bin/python3
print("send 3 non-overlapping ping fragments in all possible orders")
# |----|
# |----|
# |----|
import os
from addr import *
from scapy.all import *
permute=[]
permute.append([0,1,2])
permute.append([0,2,1])
permute.append([1,0,2])
permute.append([2,0,1])
permute.append([1,2... | 2.421875 | 2 |
tests/lineblocks_test.py | srackham/rimu-py | 0 | 37686 | from rimu import lineblocks, io, api
from typing import Dict
def test_render():
tests: Dict[str, str] = {
r'# foo': r'<h1>foo</h1>',
r'// foo': r'',
r'<image:foo|bar>': r'<img src="foo" alt="bar">',
r'<<#foo>>': r'<div id="foo"></div>',
r'.class #id "css"': r'',
r".... | 2.453125 | 2 |
outlierDetection/DataGenerator.py | mohazahran/Detecting-anomalies-in-user-trajectories | 7 | 37687 | <gh_stars>1-10
'''
Created on Nov 30, 2016
@author: zahran
'''
import pandas as pd
import numpy as np
import random
class DataGenerator(object):
def __init__(self, MODEL_PATH, DATA_GEN, perUserSequences):
self.MODEL_PATH = MODEL_PATH
self.DATA_GEN = DATA_GEN
self.perUserSe... | 2.171875 | 2 |
runtests.py | mattijevi/django-sendgrid | 7 | 37688 | <filename>runtests.py<gh_stars>1-10
#!/usr/bin/env python
import sys
import os
import django
from django.conf import settings
if not settings.configured:
# Choose database for settings
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': ':memory:'
... | 2.015625 | 2 |
jp.atcoder/abc085/abc085_c/8338197.py | kagemeka/atcoder-submissions | 1 | 37689 | <filename>jp.atcoder/abc085/abc085_c/8338197.py<gh_stars>1-10
# author: kagemeka
# created: 2019-11-08 23:31:18(JST)
### modules
## from standard library
import sys
# import collections
# import math
# import string
# import bisect
# import re
# import iterto... | 2.421875 | 2 |
tests/__init__.py | obytes/tap-python | 3 | 37690 | import vcr
tap_vcr = vcr.VCR(
serializer='yaml',
cassette_library_dir='tests/fixtures/vcr_cassettes',
record_mode='new_episodes',
match_on=['uri', 'method'],
)
| 1.5625 | 2 |
Examples/graphing/swarmGraph.py | juartinv/pulpy | 0 | 37691 | import matplotlib.pyplot as plt
import numpy as np
import sys
sys.path.append("./../")
from swarm import Bird
class GraphMaker():
"""
"""
def __init__(self, env , birds, FIELD_SIZE ):
self.env= env
fig, ax = plt.subplots()
self.fig=fig
self.ax=ax
self.birds=birds
... | 2.765625 | 3 |
faostat.py | OCHA-DAP/hdxscraper-faostat | 1 | 37692 | #!/usr/bin/python
"""
FAOSTAT:
-------
Reads FAOSTAT JSON and creates datasets.
"""
import logging
from datetime import datetime, timedelta
from os import remove, rename
from os.path import basename, exists, getctime, join
from urllib.parse import urlsplit
from zipfile import ZipFile
from hdx.data.dataset import Da... | 2.765625 | 3 |
scripts/collapse_subtypes.py | edawson/rkmh | 43 | 37693 | <filename>scripts/collapse_subtypes.py<gh_stars>10-100
import sys
from collections import Counter
## 5 |strains A1:23146 C:377 B1:546 unclassified:211701 A3:133 A2:212 A4:2230 B2:1052 D2:551 D3:3685 D1:30293 |sketch sketchSize=1000 kmer=16
if __name__ == "__main__":
for line in sys.stdin:
x_d = Counter()
... | 2.390625 | 2 |
django_blog/blog/models.py | lidysun/test1 | 0 | 37694 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from time import timezone
from django.db import models
# Create your models here.
class UserInfo(models.Model):
user= models.CharField(max_length = 30)
pwd = models.CharField(max_length = 30)
# class Publisher(models.Model):
# name = models... | 2.4375 | 2 |
collegedatascraper/extractors.py | vertuli/collegedatascraper | 0 | 37695 | <filename>collegedatascraper/extractors.py
import pandas as pd
def extract_series(df):
"""Returns a pandas Series of all info extracted from a DataFrame."""
# Remove index, value pairs from DataFrame if index is NaN.
missing = df.index.isna()
missing_idx = df[missing].index
df.drop(missing_idx, i... | 3.796875 | 4 |
cbmcfs3_runner/scenarios/static_demand.py | xapple/cbm_runner | 2 | 37696 | <filename>cbmcfs3_runner/scenarios/static_demand.py
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Written by <NAME> and <NAME>.
JRC biomass Project.
Unit D1 Bioeconomy.
"""
# Built-in modules #
# First party modules #
from plumbing.cache import property_cached
# Internal modules #
from cbmcfs3_runner.scenario... | 2.09375 | 2 |
personalization/shared/utils.py | alshedivat/federated | 0 | 37697 | <filename>personalization/shared/utils.py<gh_stars>0
# Copyright 2021, <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 r... | 1.820313 | 2 |
vars/Staging_security_port_scanning.py | rlennon/Doodle | 5 | 37698 | <gh_stars>1-10
import sys, os, socket
class Ssh_Util:
def port_scan(self, remote_host_ip):
def print_box(print_line):
print("-" * 78)
print(print_line)
print("-" * 78)
# Validate the IP of the remote host
# remote_host_ip = "172.28.25.122"
# U... | 3.46875 | 3 |
src/controllers/main_ctrl.py | donglinwu6066/2022-NYCU-EVA-lab-project-demo-app | 0 | 37699 | from PyQt5.QtCore import QObject, pyqtSlot
class MainController(QObject):
def __init__(self, model):
super().__init__()
self._model = model
| 2.296875 | 2 |