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 |
|---|---|---|---|---|---|---|
coremltools/converters/tensorflow/test/test_tf_keras_layers.py | Gerzer/coremltools | 65 | 45600 | import unittest
import tempfile
import numpy as np
import coremltools
import os
import shutil
import tensorflow as tf
from tensorflow.keras import backend as _keras
from tensorflow.keras import layers
from coremltools._deps import HAS_TF_2
from test_utils import generate_data, tf_transpose
class TensorFlowKerasTests... | 2.390625 | 2 |
dl-pose-hrn/predict/p.py | vangj/docker-containers | 22 | 45601 | <filename>dl-pose-hrn/predict/p.py
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import argparse
import os
import pprint
import sys
import torch
import torch.nn.parallel
import torch.backends.cudnn as cudnn
import torch.optim
import torch.utils.data
impor... | 1.875 | 2 |
template/src/handlers/common.py | zhkzyth/storm_maker | 0 | 45602 | <gh_stars>0
#!/usr/bin/env python
# encoding: utf-8
from base import BaseHandler
class Better404Handler(BaseHandler):
def _write_404(self):
self.send_response(
None,
error_code=-1,
error_msg='The api does not exist.'
)
def get(self):
self._write_40... | 2.1875 | 2 |
model/detection_model/TextSnake_pytorch/dataset/ratio_analysis.py | JinGyeSetBirdsFree/FudanOCR | 25 | 45603 | <reponame>JinGyeSetBirdsFree/FudanOCR
import cv2
import os
import numpy as np
from model.detection_model.TextSnake_pytorch.dataset.read_json import read_json, read_dict
def recorder(record, ratio):
ranges = [key.split('~') for key in record.keys()]
for range in ranges:
if int(range[0]) <= ratio < int(... | 1.90625 | 2 |
pepper/urls.py | GeekyShacklebolt/pepper | 0 | 45604 | # Third party imports
from django.conf.urls import url, include
from rest_framework import routers
from django.contrib import admin
# Pepper imports
from pepper.facebook.api import UserViewSet, GroupViewSet
# Relative imports
from . import api_urls
# Default user and group routers
router = routers.DefaultRouter()
ro... | 1.851563 | 2 |
hackathon/column1/test_12_5.py | abdurahmanadilovic/elements-of-programming-interviews | 0 | 45605 | from unittest import TestCase
from .problem_12_5_closes_squared_number import solution
class TestSolution(TestCase):
def testGivenCases(self):
self.assertEqual(4, solution(16))
def testGivenCases2(self):
self.assertEqual(17, solution(300))
def testZero(self):
self.assertEqual(0, ... | 2.84375 | 3 |
src/app/services/users/exceptions.py | dieisabel/cypherman | 0 | 45606 | """Module for user service exceptions"""
__all__ = [
'UserNotFoundException',
'UserIsExistsException',
]
class UserNotFoundException(Exception):
"""Indicates that user not found
Args:
message: Detailed message
"""
def __init__(self, message: str) -> None:
self.message = mess... | 3.359375 | 3 |
my_library/predictor/__init__.py | ShalyginaA/allennlp-language-predictor | 0 | 45607 | from my_library.predictor.predictor import LanguagePredictor
| 1.070313 | 1 |
generator.py | yakninja/veda-programming | 2 | 45608 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
import markovify
import glob
# use 3 or even 2 to add more nonsense. using 5 will eliminate cross-corpora sentences. so 4 is optimal
STATE_SIZE = 4
SENTENCES = 1000
models = []
for filename in glob.glob("corpus-programming/*.txt"):
print('Loading file:', filename)
... | 2.84375 | 3 |
qas/graph.py | kusha/qas | 9 | 45609 | """
Graph exploration module.
"""
import itertools
import time
from qas.wikidata import Wikidata, NoSPARQLResponse
MAX_PATH_LENGTH = 5
DISABLE_PARALLEL = True
RETRY_PARALLEL_SPARQL = False
class Path(object):
def __init__(self, path, config, item_from, item_to):
self.length = len(path) // 2 + 1
... | 2.953125 | 3 |
python/tsv_to_sbml.py | JakeHattwell/playground | 0 | 45610 | from copy import deepcopy
import os
import uuid
import pyparsing
from lxml import etree
from resources.sbtabpy import modelSystem
OUTPUT_NAME = "test_model.xml"
######################
######################
##
## Utility Functions
##
######################
######################
def genID():
... | 2.375 | 2 |
python/neuroglancer/url_state_test.py | fcollman/neuroglancer | 0 | 45611 | <reponame>fcollman/neuroglancer<gh_stars>0
# @license
# Copyright 2017 Google 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... | 2.359375 | 2 |
urlSigner/signer.py | deanle17/urlSigner | 0 | 45612 | <gh_stars>0
from urllib.parse import urlsplit, parse_qs, parse_qsl, urlencode, urlunsplit
import hashlib
import os
INPUT_SECRET = "INPUT_SECRET"
OUTPUT_SECRET = "OUTPUT_SECRET"
B02K_MAC = "B02K_MAC"
def _validate_signature(queryObj):
queriesConcat = ""
for key, value in queryObj.items():
if key != B0... | 2.71875 | 3 |
source/streaming/geh_stream/integrationevents_ingestion/event_ingestor.py | Energinet-DataHub/geh-timeseries | 5 | 45613 | <gh_stars>1-10
# Copyright 2020 Energinet DataHub A/S
#
# Licensed under the Apache License, Version 2.0 (the "License2");
# 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... | 1.960938 | 2 |
src/main/app-resources/data_download_publish/hist_skip_no_zero.py | geohazards-tep/dcs-rss-fullres-mm-data-browser | 0 | 45614 | import numpy as np
import gdal, gdalconst
import os
# See http://www.gdal.org/classVRTRasterBand.html#a155a54960c422941d3d5c2853c6c7cef
def hist_skip(inFname, bandIndex, percentileMin, percentileMax, outFname, nbuckets=1000):
"""
Given a filename, finds approximate percentile values and provides the
gdal_transla... | 3 | 3 |
home/views.py | chiragkhandhar/ODAS | 0 | 45615 | <reponame>chiragkhandhar/ODAS
from django.http import HttpResponse
from django.shortcuts import render
def index0(request):
return render(request,'home/homepage.html')
| 1.726563 | 2 |
store.py | yinziyan1206/nado-db | 1 | 45616 | __author__ = 'ziyan.yin'
from threading import local
class Store(local):
"""
Thread local storage.
>>> d = Store()
>>> d.x = 1
>>> d.x
1
>>> import threading
>>> def f(): d.x = 2
...
>>> t = threading.Thread(target=f)
>>> t.start()
... | 3.171875 | 3 |
bot.py | finlaysawyer/discord-alerts | 0 | 45617 | import asyncio
import logging
import sys
import discord
import yaml
from discord.ext import commands
from twilio.rest import Client
config = yaml.safe_load(open("config.yml"))
bot = commands.Bot(command_prefix=config["prefix"], intents=discord.Intents.default())
logging.basicConfig(
format="%(levelname)s | %(asct... | 2.796875 | 3 |
test/test_skunit.py | Hsuxu/vnet_attention | 45 | 45618 | <filename>test/test_skunit.py
import torch
import torch.nn as nn
from magic_vnet.blocks.skunit.skunit import SKConv3d, SK_Block
if __name__ == '__main__':
down = torch.rand((1, 64, 32, 32, 32))
# up = torch.rand((1, 16, 64, 64, 64))
model = SK_Block(64, 64)
out = model(down)
print(out.shape)
| 2.453125 | 2 |
apps/scraper/bing_api.py | suenklerhaw/seoeffekt | 1 | 45619 | <filename>apps/scraper/bing_api.py
#script to scraper bing api
#include libs
import sys
sys.path.insert(0, '..')
from include import *
def generate_scraping_job(query, scraper):
query_string = query[1]
query_id = query[4]
study_id = query[0]
search_engine = scraper
result_pages = 20
number_m... | 2.875 | 3 |
src/ssp/spark/udf/textblob_sentiment_udf.py | gyan42/spark-streaming-playground | 10 | 45620 | <gh_stars>1-10
from textblob import TextBlob
from pyspark.sql.functions import udf
def analyze_sentiment(text):
testimonial = TextBlob(text)
sent = testimonial.sentiment.polarity
neutral_threshold = 0.05
if sent >= neutral_threshold: # positive
return 1
elif sent > -neutral_threshold... | 2.953125 | 3 |
python/problem17b.py | jreese/euler | 1 | 45621 | <reponame>jreese/euler
onetonine = len("onetwothreefourfivesixseveneightnine")
onetoten = onetonine + len("ten")
eleventotwenty = len("eleventwelvethirteenfourteenfifteensixteenseventeeneighteennineteen")
twenties = len("twenty")*10 + onetonine
thirties = len("thirty")*10 + onetonine
forties = len("forty")*10 + oneton... | 3.265625 | 3 |
homeassistant/components/eight_sleep/__init__.py | andersop91/core | 1 | 45622 | <filename>homeassistant/components/eight_sleep/__init__.py<gh_stars>1-10
"""Support for Eight smart mattress covers and mattresses."""
from __future__ import annotations
from datetime import timedelta
import logging
from pyeight.eight import EightSleep
from pyeight.user import EightUser
import voluptuous as vol
from... | 2.125 | 2 |
web_applications/social_network/blog/signals.py | Had96dad/Python | 0 | 45623 | from django.dispatch import receiver
from django.utils.text import slugify
from django.db.models.signals import post_delete, pre_save
from blog.models import *
def category_create(sender, instance, **kwargs):
instance.name = instance.name.lower()
pre_save.connect(category_create, sender=Category)
# Create Sl... | 2.328125 | 2 |
fidder/predict.py | alisterburt/fidder | 0 | 45624 | <gh_stars>0
from pathlib import Path
import numpy as np
import torch
import typer
from rich.console import Console
from tiler import Tiler, Merger
import einops
import mrcfile
from .unet.model import UNet
import torch.nn.functional as F
import torchvision.transforms.functional as TF
from .dataset import NETWORK_IMAGE... | 2.0625 | 2 |
django_sql_reporter/management/commands/run_sql.py | kemsakurai/django-sql-reporter | 0 | 45625 | <reponame>kemsakurai/django-sql-reporter
from django.core.management.base import BaseCommand
from django.db import connections
from django_sql_reporter.models import SQLResultReport
from django.core.mail import send_mail
from pathlib import Path
import glob
import yaml
import sys
from tests.testapp.settings import BAS... | 2.1875 | 2 |
mriqc/reports/individual.py | effigies/mriqc | 0 | 45626 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
# vi: set ft=python sts=4 ts=4 sw=4 et:
# pylint: disable=no-member
#
# @Author: oesteban
# @Date: 2016-01-05 11:33:39
# @Email: <EMAIL>
# @Last modified by: oesteban
""" Encapsulates report gene... | 1.859375 | 2 |
floris/simulation/turbine.py | ElieKadoche/floris | 0 | 45627 | <gh_stars>0
# Copyright 2021 NREL
# 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 in writing, softw... | 2.8125 | 3 |
src/datafinder/gui/user/controller/repository/toolbar.py | schlauch/DataFinder | 9 | 45628 | <filename>src/datafinder/gui/user/controller/repository/toolbar.py<gh_stars>1-10
# $Filename$
# $Authors$
# Last Changed: $Date$ $Committer$ $Revision-Id$
# Copyright (c) 2003-2011, German Aerospace Center (DLR)
#
# All rights reserved.
#
#
#Redistribution and use in source and binary forms, with or without
#... | 1.578125 | 2 |
app/main/models/products.py | tmeftah/e-invoice | 2 | 45629 | <reponame>tmeftah/e-invoice
from sqlalchemy import asc, desc, or_
from app.main.extensions import db
from app.main.models.utils import UserMixin
class ProductModel(UserMixin, db.Model):
""" Product Model for storing product details """
__tablename__ = 'products'
name = db.Column(db.String(120), uniqu... | 2.453125 | 2 |
dotnet/private/copy_files.bzl | TamsilAmani/selenium | 25,151 | 45630 | <filename>dotnet/private/copy_files.bzl
def _copy_cmd(ctx, file_list, target_dir):
dest_list = []
if file_list == None or len(file_list) == 0:
return dest_list
shell_content = ""
batch_file_name = "%s-copy-files.bat" % (ctx.label.name)
bat = ctx.actions.declare_file(batch_file_name)
sr... | 2.3125 | 2 |
restic/test/test_backup.py | jstzwj/PyRestic | 2 | 45631 |
import restic
import unittest
import shutil
class TestBackup(unittest.TestCase):
def test_backup_file(self):
repo = restic.Repo.init('repos_test/test_repo', '12345678')
try:
repo.backup('setup.py')
snapshots = repo.snapshots()
self.assertEqual(len(snapshots), 1)... | 2.578125 | 3 |
Trakttv.bundle/Contents/Libraries/Shared/trakt_sync/cache/enums.py | disrupted/Trakttv.bundle | 1,346 | 45632 | class Enum(object):
@classmethod
def parse(cls, value):
options = cls.options()
result = []
for k, v in options.items():
if type(v) is not int or v == 0:
continue
if value == 0 or (value & v) == v:
result.append(v)
retur... | 2.796875 | 3 |
tests/handlers/test_ini.py | stephen-bunn/file-config | 7 | 45633 | # Copyright (c) 2019 <NAME> <<EMAIL>>
# ISC License <https://opensource.org/licenses/isc>
import typing
from textwrap import dedent
import pytest
import file_config
from hypothesis import given
from hypothesis.strategies import from_regex
@file_config.config
class A:
@file_config.config
class B:
bar... | 2.25 | 2 |
urllib2demo/test17_HTTPError_URLError.py | liang1024/CrawlerDemo | 0 | 45634 | <reponame>liang1024/CrawlerDemo
# coding=utf-8
'''
在我们用urlopen或opener.open方法发出一个请求时,
如果urlopen或opener.open不能处理这个response,就产生错误。
主要是URLError和HTTPError,以及对它们的错误处理。
URLError 产生的原因主要有:
没有网络连接
服务器连接失败
找不到指定的服务器
'''
import urllib2
requset = urllib2.Request('http://blog.baidu.com/blog')
try:
urllib2.urlopen(requset)
e... | 3.1875 | 3 |
workon/templatetags/workon_chart.py | dalou/django-workon | 0 | 45635 | <filename>workon/templatetags/workon_chart.py
from ..contrib.chart.templatetags import * | 1.085938 | 1 |
lisn/test_match.py | Algy/tempy | 0 | 45636 | #!/usr/bin/env ipython
import unittest
from clisn import loads
from match import LISNPattern
from pprint import pprint
class PatternTest(unittest.TestCase):
def test_very_basic_pattern(self):
@LISNPattern
def pat_vb(case, default):
@case
def A(res):
'''
... | 2.65625 | 3 |
object.py | Lawrence-JD/Journey-To-Vauss | 0 | 45637 | <reponame>Lawrence-JD/Journey-To-Vauss<gh_stars>0
import math
import vector
import pygame
def collides(a, b):
if not isinstance(a, Shape) or not isinstance(b, Shape):
raise ValueError("Both objects must be derived from Shape class")
test_axes = []
test_origins = []
a_axes = a.getProjectionAx... | 2.984375 | 3 |
kquant_data/stock/dzh.py | jiangtiantu/kquant_data | 23 | 45638 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
大智慧数据的处理
"""
import urllib
import urllib.request
import numpy as np
from struct import *
from ..xio.h5 import write_dataframe_set_struct_keep_head
dzh_h5_type = np.dtype([
('time', np.uint64),
('pre_day', np.float64),
('pre_close', np.float64),
('split... | 2.28125 | 2 |
apps/auth/models.py | dlooto/driver-vision | 2 | 45639 | <filename>apps/auth/models.py
#coding=utf-8
#
# Copyright (C) 2014 NianNian TECH Co., Ltd. All rights reserved.
# Created on Oct 19, 2015, by Junn
# | 0.871094 | 1 |
setup.py | alvfig/b3futurecontracts | 1 | 45640 | <filename>setup.py
import setuptools
with open("README.md", "r") as fh:
long_description = fh.read()
setuptools.setup(
name="b3futurecontracts",
version="0.0.7",
author="<NAME>",
author_email="<EMAIL>",
description="Rollover date of future contracts from the B3 exchange",
long_description=... | 1.554688 | 2 |
tests/contrib/rediscluster/test.py | tophatmonocle/dd-trace-py | 0 | 45641 | <reponame>tophatmonocle/dd-trace-py
# -*- coding: utf-8 -*-
import rediscluster
from nose.tools import eq_
from ddtrace import Pin
from ddtrace.contrib.rediscluster.patch import patch, unpatch
from ..config import REDISCLUSTER_CONFIG
from ...test_tracer import get_dummy_tracer
class TestRedisPatch(object):
TEST... | 2.09375 | 2 |
owmeta_core/bundle/__init__.py | mwatts15/owmeta-core | 2 | 45642 | from collections import namedtuple
from itertools import chain
from os import makedirs, rename, scandir, listdir
from os.path import (join as p, exists, relpath, isdir, isfile,
expanduser, expandvars, realpath)
from struct import pack
import errno
import hashlib
import json
import logging
import re
import shuti... | 1.570313 | 2 |
IntersectionDetect/dynamic_window.py | BenMSK/odds_and_ends | 0 | 45643 | <reponame>BenMSK/odds_and_ends
import sys
import math
import numpy as np
import cv2
# sys.path.remove('/opt/ros/kinetic/lib/python2.7/dist-packages')
DEG2RAD = math.pi / 180.0
def ObjectiveFunction(free_rate, velocity_rate, heading_rate, only_free_space):
# 1) free space rate, 2) velocity 3) heading to goal
c_... | 2.203125 | 2 |
src/data/load_data.py | FollowTheProcess/eu_energy_analysis | 0 | 45644 | """
Simple class based thing to make loading the datasets nice and easy.
Author: <NAME>
Created: 13/12/2020
"""
import pandas as pd
from sqlalchemy import MetaData, create_engine
from src.config import RAW_DATA
class Data:
def __init__(self, dataset: str) -> None:
"""
Simple class to act as an ... | 3.578125 | 4 |
AbideData.py | nimazaghari/CS249_GNN | 0 | 45645 | import torch
from torch_geometric.data import InMemoryDataset,Data
from os.path import join, isfile
from os import listdir
import numpy as np
import os.path as osp
from utils.construct_graph import read_data
class AbideDataset(InMemoryDataset):
def __init__(self, root, name, transform=None, pre_transform=None):
... | 2.46875 | 2 |
datahub/interaction/migrations/0075_add_trade_agreement_fields.py | Staberinde/data-hub-api | 6 | 45646 | <reponame>Staberinde/data-hub-api<filename>datahub/interaction/migrations/0075_add_trade_agreement_fields.py
# Generated by Django 3.1.7 on 2021-04-12 12:52
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('metadata', '0009_tradeagreement'),
('int... | 1.515625 | 2 |
pos_api/make_db.py | kurei159/pos | 0 | 45647 | """
Author: <NAME> (Vincent)
Description: Connect/create an SQLite3 database and check/create the necessary tables.
"""
import sqlite3
from sqlite3 import Error
import os
def make_dir(filename):
current_dir = os.path.dirname(os.path.abspath(__file__))
dest_dir = os.path.join(current_dir, "db")
try:
... | 3.59375 | 4 |
src/bugle/bugle_site/views.py | maxwu/bugle | 0 | 45648 | # -*- coding: utf-8 -*-
# !/usr/bin/env python
__author__ = 'maxwu'
from random import randint
from django.views.generic import TemplateView
from chartjs.views.lines import BaseLineChartView
class LineChartJSONView(BaseLineChartView):
def get_labels(self):
"""Return 7 labels."""
#return ["Januar... | 2.453125 | 2 |
src/command_manager.py | thomaspenin/orchid-font-tool | 0 | 45649 |
from src.commands.help import HelpCommand
from src.commands.version import VersionCommand
class CommandManager(object):
"""docstring for CommandManager."""
def __init__(self):
super(CommandManager, self).__init__()
self.command_list = self._build_command_list()
def _build_command_list(sel... | 2.96875 | 3 |
Tools/resourceCompiler/mayaExporter/workers/skinclusterExporter.py | giordi91/SirEngineThe3rd | 114 | 45650 | import sys
sys.path.append( "E:\\WORK_IN_PROGRESS\\C\\platfoorm\\engine\\misc\\exporters")
from maya import cmds
from maya import OpenMaya
from maya import OpenMayaAnim
import skeletonExporter
reload(skeletonExporter)
import json
MAX_INFLUENCE = 6;
def map_shadow_to_skeleton(root):
data,joints = skeletonExport... | 1.992188 | 2 |
goodguy/order/user_contest_record_parser.py | ConanYu/GoodGuy | 7 | 45651 | <gh_stars>1-10
import datetime
import os
import random
import time
from threading import Lock
from typing import Dict
import matplotlib.pyplot as plt
from goodguy.feishu.upload_image import upload_image
from goodguy.pb import crawl_service_pb2
from goodguy.util.const import ROOT, COLORS
def user_contest_record_pars... | 2.34375 | 2 |
venv/Lib/site-packages/pyo/examples/synthesis/03_cos_waveshaping.py | mintzer/pupillometry-rf-back | 0 | 45652 | """
Cos waveshaping synthesis.
"""
from pyo import *
import math
s = Server(sr=44100, nchnls=2, duplex=0).boot()
### Controls ###
drv = Sig(0)
drv.ctrl(title="Drive")
phi = Sig(0, mul=math.pi / 2)
phi.ctrl(title="Odd harmonics <----> Even harmonics")
frs = Sig([40.04, 39.41, 41.09, 38.7])
frs.ctrl([SLMap(10.0, 1000.... | 2.34375 | 2 |
tutorials/basics/g_code_listing_01.py | nunoedgarhubsoftphotoflow/py-fmas | 4 | 45653 | <filename>tutorials/basics/g_code_listing_01.py
r"""
Basic workflow
==============
This examples demonstrates a basic workflow using the `py-fmas` library code.
.. codeauthor:: <NAME> <<EMAIL>>
"""
###############################################################################
# We start by simply importing the requ... | 3.546875 | 4 |
backend/tests/factories/__init__.py | willrp/willbuyer | 4 | 45654 | <gh_stars>1-10
from .oauth_factory import OAuthFactory
from .user_factory import UserFactory
| 1.085938 | 1 |
src/player_object.py | kauppim/python-mazegame | 0 | 45655 | '''
Player Object
'''
from pyramid_object import PyramidObject
'''
Let's define some directions
'''
NORTH = ( 0, -1, 0)
SOUTH = ( 0, 1, 0)
EAST = ( 1, 0, 0)
WEST = ( -1, 0, 0)
UP = ( 0, 0, 1)
DOWN = ( 0, 0, -1)
class PlayerObject(object):
def __init__(self, name = "Seppo", pyramid = "None"):
self.na... | 3.5625 | 4 |
egs/MetricGAN/discriminator.py | JorisCos/asteroid_gan_exps | 3 | 45656 | import torch
import torch.nn as nn
from asteroid.engine.optimizers import make_optimizer
from torch.nn.modules.loss import _Loss
from asteroid.filterbanks import make_enc_dec
from asteroid.filterbanks.transforms import take_mag
from pystoi import stoi
from pb_bss_eval.evaluation.module_pesq import pesq
class Discrimi... | 2.203125 | 2 |
apps/result/views.py | 19521242bao/SE104 | 0 | 45657 | from collections import Counter
from django.contrib.auth.decorators import login_required
from django.contrib import messages
from django.shortcuts import render, HttpResponseRedirect, redirect
from django.views.generic import ListView
from apps.corecode.models import AcademicSession, AcademicTerm,StudentClass
from a... | 2.109375 | 2 |
lcopt/bin/lcopt_bw2_setup.py | pjamesjoyce/lcopt_geo | 17 | 45658 | <reponame>pjamesjoyce/lcopt_geo<filename>lcopt/bin/lcopt_bw2_setup.py
from sys import argv
from lcopt.utils import lcopt_bw2_setup
def main():
ecospold_path = argv[1]
lcopt_bw2_setup(ecospold_path)
if __name__ == "__main__":
main()
| 1.429688 | 1 |
venv/lib/python3.8/site-packages/openapi_client/models/first_last_name_us_race_ethnicity_out.py | akshitgoyal/csc398nlp | 1 | 45659 | # coding: utf-8
"""
NamSor API v2
NamSor API v2 : enpoints to process personal names (gender, cultural origin or ethnicity) in all alphabets or languages. Use GET methods for small tests, but prefer POST methods for higher throughput (batch processing of up to 100 names at a time). Need something you can't fi... | 2.171875 | 2 |
app/views/__init__.py | mrakzero/FlaskCMS | 1 | 45660 | #! /usr/bin/env python
# -*- coding: utf-8 -*-
# File: __init__.py.py
# Version: v1.0.0
# Description:
# Author: <NAME>
# Date: 2021/8/9 21:38
| 1.125 | 1 |
gluon/gluoncv2/models/res2net.py | naviocean/imgclsmob | 2,649 | 45661 | """
Res2Net for ImageNet-1K, implemented in Gluon.
Original paper: 'Res2Net: A New Multi-scale Backbone Architecture,' https://arxiv.org/abs/1904.01169.
"""
__all__ = ['Res2Net', 'res2net50_w14_s8', 'res2net50_w26_s8']
import os
from mxnet import cpu
from mxnet.gluon import nn, HybridBlock
from mxnet.gluon.co... | 2.546875 | 3 |
road-and-rail-stats/calculate_rail_emissions_and_energy.py | Rebeccacachia/projects | 0 | 45662 | # ---
# jupyter:
# jupytext:
# text_representation:
# extension: .py
# format_name: light
# format_version: '1.5'
# jupytext_version: 1.11.4
# kernelspec:
# display_name: Python 3
# name: python3
# ---
# +
from pathlib import Path
import geopandas as gpd
import pandas as pd
fro... | 2.546875 | 3 |
tests/test_aserver.py | thomas-hermann/pya | 23 | 45663 | from unittest import TestCase, skipUnless, mock
from pya import *
import numpy as np
import time
class TestAserver(TestCase):
def setUp(self) -> None:
self.backend = DummyBackend()
self.sig = np.sin(2 * np.pi * 440 * np.linspace(0, 1, 44100))
self.asine = Asig(self.sig, sr=44100, label="t... | 2.25 | 2 |
core/view/verbose.py | kisonho/torchmanager | 0 | 45664 | <gh_stars>0
from typing import Protocol, runtime_checkable
from enum import Enum
import abc
@runtime_checkable
class _VerboseControllable(Protocol):
"""The learning rate scheduler protocol"""
@property
@abc.abstractmethod
def verbose(self) -> bool:
raise NotImplementedError
@verbose.sette... | 3 | 3 |
dev.py | drequena/repo-luz | 0 | 45665 | <filename>dev.py
print("Dev")
| 0.988281 | 1 |
PythonUtils/live_info/live_rail.py | tiy1807/PythonUtils | 0 | 45666 | import sys
from zeep import Client
from PythonUtils.text_input import TextInput
from PythonUtils.live_info.display_item import DisplayItem
from PythonUtils.user_input import UserInput
import json
from pathlib import Path
# WSDL location of the LDBWS rail information. The most up to date version is
# detailed here: htt... | 2.421875 | 2 |
metrics.py | google-research/fitvid | 51 | 45667 | <filename>metrics.py
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... | 2.03125 | 2 |
src/analysis/duration/d_prime.py | EstevaoVieira/spikelearn | 0 | 45668 | <filename>src/analysis/duration/d_prime.py
import pandas as pd
import numpy as np
import scipy.stats as st
import sys
sys.path.append('.')
import os
from spikelearn.data import io, to_feature_array, select, SHORTCUTS
# Directory
savedir = 'data/results/duration/d_prime2'
if not os.path.exists(savedir):
os.makedi... | 2.59375 | 3 |
features/steps/day5.py | erikedin/aoc2016 | 0 | 45669 | <reponame>erikedin/aoc2016
from behave import *
import aoc2016.securitydoor as securitydoor
import aoc2016.day5 as day5
@given(u'a door with door id "{door_id}"')
def step_impl(context, door_id):
context.door_breaker = securitydoor.DoorBreaker(door_id)
@given(u'a second door with door id "{door_id}"')
def step_im... | 2.578125 | 3 |
scripts/threshold_algorithm_randomized.py | NSSAC/active_queries_threshold_gds_published_code | 0 | 45670 | #!/usr/bin/env python
# tags: code python thresholdAlgorithm threshold class
#
import argparse
import networkx as nx
from random import randint
from random import random
from random import seed
import os
import sys
import argparse
import pdb
import logging
import time
DESC="""This code implements the algorithm for di... | 3.5 | 4 |
adapters-stk/example/MixedPoissonExample/analyze_performance.py | hillyuan/Panzer | 1 | 45671 | <reponame>hillyuan/Panzer
#! /usr/bin/env python
"""
Script for analyzing Panzer kernel performance on next-generation
architectures. Runs hierarchic parallelism and generates plots from
data.
"""
__version__ = "1.0"
__author__ = "<NAME>"
__date__ = "Dec 2018"
# Import python modules for command-line options, t... | 2.734375 | 3 |
Othello.py | ojasonbernal/PythonOthelloGame | 0 | 45672 | # Importing modules
import pygame
import numpy as np
import random
# Initializing the Pygame module
pygame.init()
def console_screen():
"""This function is meant for the user to enter specifications for the game as the player plays. """
print('Note: Enter nicknames to name the players in the game'... | 3.671875 | 4 |
50_mymagic.py | euribates/Jupyter | 0 | 45673 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from IPython.core.magic import (
register_line_magic,
register_cell_magic,
register_line_cell_magic,
)
from IPython.display import HTML, Image
from pygments import highlight
from pygments.lexers import PythonLexer, get_lexer_by_name
from pygments.formatte... | 2.625 | 3 |
exp-visual7w/exp_test_visual7w_baseline.py | ronghanghu/cmn | 72 | 45674 | <filename>exp-visual7w/exp_test_visual7w_baseline.py
from __future__ import absolute_import, division, print_function
import sys
import os; os.environ['CUDA_VISIBLE_DEVICES'] = '0' # using GPU 0
import tensorflow as tf
import numpy as np
import skimage.io
import skimage.transform
from models import visual7w_baselin... | 1.578125 | 2 |
tests/models_example.py | BigFishMaster/tnt | 3 | 45675 |
class Model:
def __init__(self):
pass
class Optimizer:
def __init__(self):
pass
| 1.570313 | 2 |
Classic Challenges (Feb 2020)/CurrencyConverter.py | DGrifferty/Python | 0 | 45676 | <reponame>DGrifferty/Python
currency = {
'GDP' : 1.3,
'EUR' : 1.08,
'USD' : 1.0,
'AUD' : 0.66,
'JPY' : 0.0090
}
while True:
intialcur = str(input('Please Enter the currency you want to convert from\n: ')).upper()
while True:
if intialcur in currency:
break
else:
... | 4.09375 | 4 |
src/predict_client.py | tramper2/sdsandboxCAR | 1 | 45677 | <reponame>tramper2/sdsandboxCAR
'''
An example of a client that connects to a predict_server
It feeds the server with image data a recieves
'''
from __future__ import print_function
import socket
import argparse
import sys
import numpy as np
import h5py
import json
import time
import config
# ***** main loop *****
if... | 2.65625 | 3 |
tests/ServoTest.py | murrayireland/Rover-Code | 0 | 45678 | <reponame>murrayireland/Rover-Code
# Test of writing servo position via Raspberry Pi GPIO pins
# <NAME>
# 22/12/2016
__author__ = '<NAME>'
# Packages
import RPi.GPIO as GPIO
import time
# Set pin numbering scheme
GPIO.setmode(GPIO.BOARD)
# Set output pin to physical pin 11
GPIO.setup(11, GPIO.OUT)
# Set PWM sequen... | 3.21875 | 3 |
rook/dashboard/tables/messages.py | roocs/roocs-wps-demo | 0 | 45679 | <filename>rook/dashboard/tables/messages.py
import pandas as pd
from bokeh.models import ColumnDataSource
from bokeh.models import TableColumn, DataTable, DateFormatter
from .base import TableView
class MessageTable(TableView):
def data(self):
edf = self.df.loc[self.df["status"] == 5]
gdf = edf.g... | 2.484375 | 2 |
app/controllers/settings.py | williamflynt/MailgunMailer | 0 | 45680 | # -*- coding: utf-8 -*-
from flask import render_template, session, request
from app import app
from app.log import get_logger
from app.models.Login import login_required
from app.models.SQL_DB import User
logger = get_logger(__name__)
@app.route("/settings/profile", methods=["GET", "POST"])
@login_required
def set... | 2.28125 | 2 |
Scraping/Scraping_Instagram/insta_crawler/Image.py | ghassen1302/Interview_Code_Demonstration | 0 | 45681 | <gh_stars>0
import os
import json
import time
from selenium import webdriver
# from .crawler.media import login
from .crawler.media import getimages
# from .crawler.media import getcomments
# from .crawler.crawler.spiders.profil import launch
# from webdriver_manager.chrome import ChromeDriverManager
username = 'jaw... | 2.625 | 3 |
LeetCode/weekly/241/1.py | Muzque/Leetcode | 1 | 45682 | <gh_stars>1-10
"""
1863. Sum of All Subset XOR Totals
"""
"""
The XOR total of an array is defined as the bitwise XOR of all its elements,
or 0 if the array is empty.
For example, the XOR total of the array [2,5,6] is 2 XOR 5 XOR 6 = 1.
Given an array nums, return the sum of all XOR totals for every subset of nums.
... | 3.84375 | 4 |
src/net_sniff.py | Ra7mo0on/3agL3 | 1 | 45683 | <filename>src/net_sniff.py
"""
Real-time network traffic capturing using scapy.all.sniff
"""
from datetime import datetime
from colored import fg, attr
from scapy.all import *
class NetSniff:
def __init__(self, interf, berkeley_filter, count, promiscuous):
"""
Args:
interf (str): the infertace to capture pack... | 2.71875 | 3 |
betdaq/resources/bettingresources.py | ScoreX/betdaq | 13 | 45684 |
from betdaq.utils import make_tz_naive, floatify
from betdaq.enums import OrderActionType, OrderStatus, OrderKillType, Polarity, MarketStatus
def parse_suspended_order(suspend):
return {
'order_id': suspend.get('OrderId'),
'size_suspended': floatify(suspend.get('SuspendedForSideStake')),
... | 2.109375 | 2 |
sedastrela_is/urls.py | ondrejsika/sedastrela-is | 0 | 45685 | from django.conf.urls import include, url
from django.views.generic.base import RedirectView
urlpatterns = [
url(r'^event/', include('sedastrela_is.event.urls', namespace='event')),
url(r'^$', RedirectView.as_view(url='/admin/')),
]
| 1.578125 | 2 |
test/test_synthetic_xdisp.py | sean-mackenzie/gdpyt-analysis | 0 | 45686 | # test synthetic particles with x-displacement
from os.path import join
import matplotlib.pyplot as plt
# imports
import numpy as np
import pandas as pd
import filter
import analyze
from correction import correct
from utils import io, plotting, modify, details
# setup file paths
base_dir = '/Users/mackenzie/Desktop... | 2.046875 | 2 |
app.py | vblazhnov/stats | 0 | 45687 | #!flask/bin/python
# Copyright 2015 vblazhnov
#
# 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 t... | 2.40625 | 2 |
diagan-pkg/diagan/trainer/scheduler.py | lee-jinhee/self-diagnosing-gan | 16 | 45688 | """
Implementation of a specific learning rate scheduler for GANs.
"""
class DRS_LRScheduler:
"""
Learning rate scheduler for training GANs. Supports GAN specific LR scheduling
policies, such as the linear decay policy using in SN-GAN paper as based on the
original chainer implementation. However, one... | 2.765625 | 3 |
paraview_scripts/export_slice_to_csv.py | ric-95/azimuthal-average | 0 | 45689 | <gh_stars>0
# trace generated using paraview version 5.9.0-RC2
#### import the simple module from the paraview
from paraview.simple import *
#### disable automatic camera reset on 'Show'
def export_slice_to_csv(render_view, output_file="slice.csv"):
paraview.simple._DisableFirstRenderCameraReset()
# get act... | 1.765625 | 2 |
NewDeclarationInQueue/preprocess/document_location.py | it-pebune/ani-research-data-extraction | 0 | 45690 | <gh_stars>0
from NewDeclarationInQueue.preprocess.models import DocumentType
class DocumentLocation:
"""Class for all the parameters necessary for processing a file
"""
type = DocumentType.DOC_WEALTH
storage = 'azure'
path = ''
filename = ''
out_path = ''
page_image_filename = ''
o... | 2.703125 | 3 |
python/pyside/pyside6/drag_and_drop_firefox_tabs.py | jeremiedecock/snippets | 23 | 45691 | <reponame>jeremiedecock/snippets<filename>python/pyside/pyside6/drag_and_drop_firefox_tabs.py
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# https://doc.qt.io/qtforpython/overviews/dnd.html
import sys
from PySide6 import QtCore, QtWidgets
class Windows(QtWidgets.QWidget):
def __init__(self):
super().__... | 2.28125 | 2 |
examples/simple_rnn_comparison/without_treeano.py | diogo149/treeano | 45 | 45692 | <gh_stars>10-100
import numpy as np
import theano
import theano.tensor as T
fX = theano.config.floatX
LAG = 20
LENGTH = 50
N_TRAIN = 5000
HIDDEN_STATE_SIZE = 10
def binary_toy_data(lag=1, length=20):
inputs = np.random.randint(0, 2, length).astype(fX)
outputs = np.array(lag * [0] + list(inputs), dtype=fX)[:... | 2.125 | 2 |
marltoolbox/utils/restore.py | longtermrisk/marltoolbox | 17 | 45693 | <gh_stars>10-100
import logging
import os
import pickle
logger = logging.getLogger(__name__)
LOAD_FROM_CONFIG_KEY = "checkpoint_to_load_from"
def after_init_load_policy_checkpoint(
policy, observation_space=None, action_space=None, trainer_config=None
):
"""
This function is to be given to a policy temp... | 2.8125 | 3 |
assistant/forms.py | RiadSaidur/django-hospitals | 1 | 45694 | <reponame>RiadSaidur/django-hospitals
from django import forms
# model
from patient.models import Request
class RequestApproveForm(forms.ModelForm):
class Meta:
model = Request
fields = ["confirmed"]
# fields = "__all__"
| 1.492188 | 1 |
rls/common/decorator.py | StepNeverStop/RLs | 371 | 45695 | <reponame>StepNeverStop/RLs
#!/usr/bin/env python3
# encoding: utf-8
import functools
import torch as th
from rls.utils.converter import to_numpy, to_tensor
def lazy_property(func):
attribute = '_lazy_' + func.__name__
@property
# 将原函数对象(func)的指定属性复制给包装函数对象(wrapper), 默认有 module、name、doc,或者通过参数选择
@... | 2.125 | 2 |
ABC_B/ABC083_B.py | ryosuke0825/atcoder_python | 0 | 45696 | <reponame>ryosuke0825/atcoder_python
n, a, b = map(int, input().split())
ans = 0
for i in range(1, n+1):
str_i = str(i)
sum = 0
for j in range(len(str_i)):
sum += int(str_i[j])
if a <= sum <= b:
ans +=i
print(ans)
| 2.921875 | 3 |
memcheck/UIdesign/main.py | XDZhelheim/cs302-process-memory-tracker | 0 | 45697 | <filename>memcheck/UIdesign/main.py
#!/usr/bin/python3
import os
import sys
from PyQt5.QtWidgets import QApplication, QMainWindow, QFileDialog, QDialog
import test1
import dialog1
path = ''
prgm_in = ' < testin.txt'
log = ''
memory = ''
file_handler = ''
def click_success():
input_text = ui.textEdit.toPlainTex... | 2.125 | 2 |
addons/sale_project/models/project.py | SHIVJITH/Odoo_Machine_Test | 0 | 45698 | # -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from ast import literal_eval
from odoo import api, fields, models, _
from odoo.exceptions import ValidationError
class Project(models.Model):
_inherit = 'project.project'
sale_line_id = fields.Many2one(
... | 2.109375 | 2 |
AnnotationTool/backend/server.py | xjtu-intsoft/chase-page | 34 | 45699 | # coding=utf8
import os
import json
import copy
import pathlib
import tempfile
from typing import Dict, List, Union
from pprint import pprint
from datetime import datetime
from overrides import overrides
from flask import Flask, Response, request, render_template, redirect, url_for, send_file
from flask_login import L... | 1.9375 | 2 |