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 |
|---|---|---|---|---|---|---|
bgSim/combatEvents.py | philhteoma/hsBattlegroundsSimulator | 0 | 48000 | <filename>bgSim/combatEvents.py
import random
class CombatEvent:
pass
class ChooseAttackTarget(CombatEvent):
name = "choose_attack_target"
def run(self, manager):
manager.attackingMinion = manager.get_active_board().get_leftmost_minion()
attackableTargets = manager.get_inactive_board... | 2.734375 | 3 |
delfin/drivers/hitachi/hus_110/constants.py | guankecheng/netapp | 0 | 48001 | <filename>delfin/drivers/hitachi/hus_110/constants.py
# Copyright 2020 The SODA Authors.
# 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... | 1.601563 | 2 |
html2md/mobilizers/instapaper.py | semond/html2md | 0 | 48002 | """
:copyright: © 2019, <NAME>
:license: Apache License 2.0
"""
from urllib.parse import quote_plus
import requests
from pyquery import PyQuery as pq
from .mobilizer import Mobilizer
class InstapaperMobilizer(Mobilizer):
"""From a URL, get an Instapaper mobilizered HTML"""
mobilizer_url = "http://www.in... | 2.9375 | 3 |
rsvis/tools/canvas/imgcv.py | Tom-Hirschberger/DataVisualization | 0 | 48003 | # ===========================================================================
# imgcv.py ----------------------------------------------------------------
# ===========================================================================
# import ------------------------------------------------------------------
# -----... | 1.789063 | 2 |
django_discord_connector/admin.py | DubClub-win/django-discord-connector | 2 | 48004 | <gh_stars>1-10
from django.contrib import admin
from django_discord_connector.models import DiscordClient, DiscordToken, DiscordGroup, DiscordChannel, DiscordUser
from django_discord_connector.tasks import sync_discord_groups
from django.apps import apps
def update_discord_groups(modeladmin, request, queryset):
sy... | 1.953125 | 2 |
tests/integration/test_wallet_mqtt.py | mantaprotocol/manta-python | 14 | 48005 | <reponame>mantaprotocol/manta-python<filename>tests/integration/test_wallet_mqtt.py
# Manta Python
# Manta Protocol Implementation for Python
# Copyright (C) 2018-2019 <NAME>
import asyncio
from dataclasses import dataclass
from decimal import Decimal
import logging
import pytest
from manta.messages import PaymentRe... | 2.359375 | 2 |
implementations/warris2018/pyPaSWAS/Core/Formatters.py | r-barnes/sw_comparison | 24 | 48006 | <filename>implementations/warris2018/pyPaSWAS/Core/Formatters.py
'''This module contains the output formatters for pyPaSWAS'''
class DefaultFormatter(object):
'''This is the default formatter for pyPasWas.
All available formatters inherit from this formatter.
The results are parsed into a temporary... | 2.765625 | 3 |
tests/_utils.py | kura/blackhole | 43 | 48007 | # -*- coding: utf-8 -*-
# (The MIT License)
#
# Copyright (c) 2013-2021 Kura
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the 'Software'), to deal
# in the Software without restriction, including without limitation the rights
# ... | 1.796875 | 2 |
observables/integer.py | North-Guard/observable_primitives | 1 | 48008 | from typing import Callable, SupportsInt, SupportsFloat, SupportsRound, SupportsComplex, SupportsAbs, SupportsBytes
from observable_primitives.observables.numeric_base import ObservableNumeric
class ObservableInteger(ObservableNumeric, SupportsInt, SupportsFloat, SupportsRound, SupportsComplex, SupportsAbs,
... | 2.84375 | 3 |
tests/python/contrib/test_ethosu/test_remove_concatenates.py | jwfromm/relax | 2,084 | 48009 | # 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 License, Version 2.0 (the
# "License"); you may not u... | 1.65625 | 2 |
kk_tf/kk_tf.py | hakyimlab/multixcan-paper | 0 | 48010 | <gh_stars>0
#!/usr/bin/env python
__author__ = "<NAME>"
import numpy
import pandas
import tensorflow as tf
from tensorflow import keras
from sklearn.model_selection import train_test_split
def _n(x):
return (x - numpy.mean(x))/numpy.std(x)
d = pandas.read_table("../results/smultixcan_wrong.txt")
d_ = d.loc[d.n>1... | 2.25 | 2 |
doclabel/core/models.py | sondh0127/doclabel | 0 | 48011 | <gh_stars>0
import string
import os
from django.conf import settings
from django.dispatch import receiver
from django.db.models.signals import post_save, pre_delete, post_delete
from django.db import models
from django.urls import reverse
from django.contrib.auth import get_user_model
from django.contrib.postgres.fiel... | 2.078125 | 2 |
kafcrapy/spider.py | JoeyRead/kafcrapy | 0 | 48012 | <reponame>JoeyRead/kafcrapy<filename>kafcrapy/spider.py
from scrapy import signals
from scrapy.exceptions import DontCloseSpider
from scrapy.spiders import Spider
from . import connection
class KafkaSpiderMixin(object):
def __init__(self):
self.consumer = None
@classmethod
def process_message(cl... | 2.90625 | 3 |
unipipeline/utils/sig.py | aliaksandr-master/unipipeline | 0 | 48013 | <reponame>aliaksandr-master/unipipeline<gh_stars>0
import signal
from types import FrameType
from typing import Callable, Tuple, Any, Optional, Union
class soft_interruption: # noqa
def __init__(self, on_interrupt_once: Callable[[], None], on_force_interruption: Optional[Callable[[], None]] = None, on_error: Opt... | 2.296875 | 2 |
HuberyBlog/apps/blog/views.py | SomnambulistOfChina/ChineseSomnambulist | 0 | 48014 | # from django.core.cache import cache
from django.db.models import Sum
from django.http import JsonResponse, Http404, HttpResponse
from django.shortcuts import render, redirect
from django.core.cache import cache
# from django.urls import reverse
# from django.views.decorators.csrf import csrf_exempt
from blog.models... | 2.0625 | 2 |
ginga/examples/gw/plot_time_series.py | kyraikeda/ginga | 76 | 48015 | #! /usr/bin/env python3
#
"""
Plot time series data in an interactive plot viewer.
Usage
=====
$ python3 plot_time_series.py --loglevel=20 --stderr
Plots add new data every second, and update on screen every 5 sec.
24 hours of data is kept. Each plot starts out in "autoaxis X PAN"
and "autoaxis Y VIS".
Things you c... | 3.375 | 3 |
todo/[Keras]DeepFakes_FaceSwap/faceswap-master/scripts/extract.py | tonyhuang84/notebook_dnn | 0 | 48016 | <filename>todo/[Keras]DeepFakes_FaceSwap/faceswap-master/scripts/extract.py<gh_stars>0
import cv2
from pathlib import Path
from lib.cli import DirectoryProcessor
from lib.faces_detect import detect_faces
from plugins.PluginLoader import PluginLoader
class ExtractTrainingData(DirectoryProcessor):
def create_parser... | 2.75 | 3 |
machine-learning-gists/1a41cc3b5ef28bb7d99a43b64453bfc9c81d53cd/snippet.py | qwbjtu2015/dockerizeme | 0 | 48017 | <reponame>qwbjtu2015/dockerizeme
'''
This script is based on the original work of <NAME> (randalolson.com) for the Traveling Salesman Portrait project.
http://www.randalolson.com/2018/04/11/traveling-salesman-portrait-in-python/
Please check out the original project repository for information:
https://github.com/rhie... | 1.75 | 2 |
anno2070/list_of_buildings.py | Aprillion/aprillion.github.io | 0 | 48018 | '''
Created on 13.12.2011
@author: <EMAIL>
'''
from __future__ import division
import json, re #, sys
from xml.etree import ElementTree as ET
__version__ = "0.3"
# global settings
# txt files must be changed encoding from UCS-2 to ANSI :(( xml files are ok )
folder = "C:\\Users\\Peter\\Documents\\ANNO 2070\\"
asset... | 1.96875 | 2 |
credentials.py | BAHETIHARSH/automate-linkedin | 0 | 48019 | loginid = "your login id"
password = "<PASSWORD>" | 0.957031 | 1 |
preprocess_data/pathway/util.py | rocke2020/AutoNER | 0 | 48020 | <reponame>rocke2020/AutoNER
import logging, os
_nameToLevel = {
# 'CRITICAL': logging.CRITICAL,
# 'FATAL': logging.FATAL, # FATAL = CRITICAL
# 'ERROR': logging.ERROR,
# 'WARN': logging.WARNING,
'INFO': logging.INFO,
'DEBUG': logging.DEBUG,
}
def get_logger(name=__name__, log_file=None, log_level=... | 2.4375 | 2 |
examples/simultaneous_translation/utils/monotonic_attention.py | Shiguang-Guo/fairseq | 16,259 | 48021 | <gh_stars>1000+
from typing import Optional
import torch
from torch import Tensor
from examples.simultaneous_translation.utils.functions import (
exclusive_cumprod,
prob_check,
moving_sum,
)
def expected_alignment_from_p_choose(
p_choose: Tensor,
padding_mask: Optional[Tensor] = None,
eps: fl... | 2.15625 | 2 |
memcache/test_naive.py | oldhill/halloween | 0 | 48022 | <reponame>oldhill/halloween
import time
import unittest
import naive
class TestNaiveMemcache(unittest.TestCase):
def test_get_set(self):
m = naive.Memcache()
m.set('hi', 'there')
self.assertEqual('there', m.get('hi')['value'])
def test_lru_eviction(self):
m = naive.Memcache(size=5)
m.set('h... | 2.796875 | 3 |
environments/transfer_env/reacher_env.py | WilsonWangTHU/neural_graph_evolution | 33 | 48023 | <reponame>WilsonWangTHU/neural_graph_evolution
#!/usr/bin/env python2
# -----------------------------------------------------------------------------
# @brief:
# The reacher task
# @author:
# Tingwu (Wilson) Wang, July 22nd, 2017
# ------------------------------------------------------------------------... | 2.46875 | 2 |
chocopy-rs/test/original/pa2/expr_var_assign.py | wwylele/chocopy-wwylele | 7 | 48024 | x:int = 1
o:object = None
x = o = 42
| 1.820313 | 2 |
test/test_constraints.py | maffettone/constrained_sampler | 0 | 48025 | <gh_stars>0
import unittest
import os
from constrained_sampler.constraints import Constraint
class ConstraintTestCase(unittest.TestCase):
def setUp(self):
self.constraint = Constraint(os.path.join(os.path.dirname(__file__), '../examples/mixture.txt'))
def test_example(self):
self.assertListEq... | 2.671875 | 3 |
doc/week1/w1d3/fasta.py | VinceSD/mebioda | 0 | 48026 | <gh_stars>0
from Bio import SeqIO # sudo pip install biopython
with open("Danaus.fas", "rU") as handle:
# Example: retain COI
for record in SeqIO.parse(handle, "fasta"):
fields = record.description.split('|')
if fields[2] == 'COI-5P':
print '>' + record.description
print r... | 2.46875 | 2 |
2 semester/PW/Coursera/Python/1 Week/11.py | kurpenok/Labs | 1 | 48027 | m = int(input())
m = m % 1440
a = m // 60
b = m % 60
print(a, b)
| 3.125 | 3 |
polls_service/polls/tests/test_services.py | KirovVerst/django-polls-site | 1 | 48028 | <gh_stars>1-10
from django.contrib.auth.models import User
from django.test import TestCase
from django.utils import timezone
from polls.models import Choice
from polls.models import Question
from polls.services import VoteService
class VoteServiceTest(TestCase):
@classmethod
def setUpTestData(cls):
c... | 2.421875 | 2 |
contak/apps.py | dasfrosty/contak-service | 0 | 48029 | <reponame>dasfrosty/contak-service
from django.apps import AppConfig
class ContakAppConfig(AppConfig):
name = "contak"
| 1.390625 | 1 |
Script_Backup.py | Fanliaa/Projet6_OpenClassRooms | 0 | 48030 | <gh_stars>0
#!/bin/bash/python
#
# Importation des librairies utiles
import json
import os
import pipes
import time
import datetime
import sys
import zipfile
from os.path import basename
import paramiko
import logging
import boto3
from botocore.exceptions import ClientError
# Declaration des variables
DATETIME = time... | 2.109375 | 2 |
lab/refactoring/remove_control_flag2.py | JericHunter/SPD-2.31-Testing-and-Architecture | 0 | 48031 | # by <NAME>
# Remove control flag
# Reference: https://stackoverflow.com/a/10140333/81306
# This code snippet reads up to the end of the file
n = 16
file = 'foobar.file'
def readfile(file, n):
with open(file, 'rb') as fp:
chunk = fp.read(n)
if chunk == '': # end of file, stop running.
... | 3.6875 | 4 |
src/examples/minimal.py | apatrushev/aioflows | 2 | 48032 | import asyncio
from aioflows.simple import Printer, Ticker
async def start():
await (Ticker() >> Printer()).start()
asyncio.run(start())
| 2.421875 | 2 |
config/HttpdParser.py | automicus/OpenAlarm | 1 | 48033 | from HTMLParser import HTMLParser
class HttpdParser(HTMLParser):
def __init_var__(self):
# create status variables
self._inHttpd = None
self._inKey = None
self.httpd = None
def read(self, fname):
self.__init_var__()
cache = open(fname).read()
self.feed... | 3.140625 | 3 |
cnnlstm/forecast.py | mingjiewong/Kaggle-M5-Forecasting-Accuracy-2020 | 0 | 48034 | <gh_stars>0
import tensorflow as tf
import pandas as pd
import numpy as np
from sklearn.preprocessing import MinMaxScaler
from data_processing.helpers import Config
tf.random.set_seed(51)
np.random.seed(51)
class OptimizerConfig(object):
def __init__(self):
"""
Load optimizer parameters.
... | 2.546875 | 3 |
src/graia/amnesia/transport/common/websocket/shortcut.py | GraiaProject/Amnesia | 2 | 48035 | from functools import wraps
from typing import TYPE_CHECKING, Any, AnyStr, Callable, Type, TypeVar
from graia.amnesia.json import TJson
from graia.amnesia.json.frontend import Json
if TYPE_CHECKING:
from graia.amnesia.transport.common.websocket.io import AbstractWebsocketIO
_S = TypeVar("_S")
_R = TypeVar("_R")... | 2.171875 | 2 |
src/zeit/ldap/generation/__init__.py | ZeitOnline/zeit.ldap | 0 | 48036 | import zope.generations.generations
minimum_generation = 3
generation = 3
manager = zope.generations.generations.SchemaManager(
minimum_generation, generation, "zeit.ldap.generation")
| 1.46875 | 1 |
futaba/download.py | Hoffs/futaba | 23 | 48037 | #
# download.py
#
# futaba - A Discord Mod bot for the Programming server
# Copyright (c) 2017-2020 <NAME>, <NAME>, jackylam5
#
# futaba is available free of charge under the terms of the MIT
# License. You are free to redistribute and/or modify it under those
# terms. It is distributed in the hopes that it will be use... | 2.65625 | 3 |
Tuchart3.0 -beta/main.py | Seedarchangel/TuChart | 801 | 48038 | #-*- coding:utf-8 -*-
from __future__ import print_function
import os,sys,sip,time
from datetime import datetime,timedelta
from qtpy.QtWidgets import QTreeWidgetItem,QMenu,QApplication,QAction,QMainWindow
from qtpy import QtGui,QtWidgets
from qtpy.QtCore import Qt,QUrl,QDate
from Graph import graphpage
from layout impo... | 2.703125 | 3 |
setup.py | EncoreTechnologies/py-menandmice | 1 | 48039 | # Licensed to the Encore Technologies ("Encore") 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 License, Version 2.0 (the
# "License"); you may not use... | 1.726563 | 2 |
mmpose/models/necks/__init__.py | jlgzb/mmpose | 367 | 48040 | <filename>mmpose/models/necks/__init__.py
from .gap_neck import GlobalAveragePooling
__all__ = ['GlobalAveragePooling']
| 1.226563 | 1 |
Script_Kali_Machine/DownloadTools_Old.py | manesec/tools4me | 0 | 48041 | <filename>Script_Kali_Machine/DownloadTools_Old.py
# List slow update ..
Optional_Installation = {
# Update ExploitDB
"EXPLOITDB" : True,
# Install ZAP
# It have some bug in old kali linux, if you are running old kali linux please disable it.
"ZAP" : False,
# Install DBeaver
"DBEAVER" : Tr... | 1.617188 | 2 |
metrics/recall/recall.py | leondz/datasets | 3,395 | 48042 | # Copyright 2020 The HuggingFace Datasets Authors and the current dataset script contributor.
#
# 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.... | 2.203125 | 2 |
Easy/Delete_Columns_to_Make_Sorted/Delete_Columns_to_Make_Sorted.py | nitin3685/LeetCode_Solutions | 0 | 48043 | class Solution:
def minDeletionSize(self, A: List[str]) -> int:
res = 0
for col_str in zip(*A):
if list(col_str) != sorted(col_str):
res += 1
return res
| 3.09375 | 3 |
KonaChan-Download/PicDownload.py | TsumugiWenders/Archives | 0 | 48044 | <gh_stars>0
import traceback
import urllib
from time import sleep
import requests
from bs4 import BeautifulSoup
import os
def urllibdownload(url, filename):
if os.path.exists(filename):
print('file exists!')
return
try:
urllib.request.urlretrieve(url,filename)
retur... | 3.03125 | 3 |
formal_modelling/ela_balance_sheet_effects.py | christophergandrud/ela_fiscal_costs | 2 | 48045 | # Find simplified formula for bank balance sheet change as a result of
# ELA collateral seizure
# <NAME>
# MIT License
################################################################################
# Import SymPy
import sympy as sp
from sympy.abc import eta, gamma
# Define symbols (eta and gamma imported)
A, AD = s... | 2.828125 | 3 |
beam.py | numediart/multi-rnn-wordlevel | 0 | 48046 | <gh_stars>0
# The MIT License (MIT)
#
# Copyright (c) 2015 <NAME>, 2018 UMONS
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
... | 1.828125 | 2 |
slug/win.py | xonsh/slug | 17 | 48047 | """
Versions of the base functionality optimized for the NT kernel.
The 9x kernel is just unsupported.
"""
import ctypes
import _winapi
import signal
from . import base
__all__ = ('Process', 'ProcessGroup')
# {{{ win32 API calls
def _falsey_errcheck(result, func, arguments):
if not result:
raise ctypes... | 1.835938 | 2 |
util.py | davidar/polya | 6 | 48048 | <gh_stars>1-10
import operator
def prod(xs):
return reduce(operator.mul, xs, 1)
class DynEnum(object):
def __init__(self):
self.ident = {} # str -> int
self.names = [] # int -> str
def __call__(self, name):
if name in self.ident:
return self.ident[name]
else:
... | 2.796875 | 3 |
commandable/command_loader.py | cedriclv/nci-python-commands | 1 | 48049 | <filename>commandable/command_loader.py
# Copyright 2017 NEWCRAFT GROUP B.V.
#
# 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
#
# U... | 2.8125 | 3 |
src/2020/binary_boarding.py | lazycoco-net/advent-of-code | 1 | 48050 | <filename>src/2020/binary_boarding.py<gh_stars>1-10
import math
import re
import time
from typing import Dict
def binary_to_decimal(number_str: str, zero_char: str, one_char: str) -> int:
return int(number_str.replace(zero_char, '0').replace(one_char, '1'), 2)
def is_my_seat(seats_taken: Dict[int, bool], seat_i... | 3.265625 | 3 |
toastbot/__main__.py | mdegreg/discord-toastlogger | 0 | 48051 | import collections
import logging
import asyncio
import importlib
import pip
import toastbot.toast as toast
try:
import discord
import discord.ext.commands as commands
except ImportError:
print('Installing discord package...')
pip.main(['install', 'discord'])
import discord
import discord.ext... | 2.46875 | 2 |
2019/day19/beam.py | ivobatkovic/advent-of-code | 3 | 48052 | <gh_stars>1-10
from os.path import dirname
from os.path import realpath
from os.path import join
import sys
sys.path.append(join(dirname(realpath(__file__)), *[".."]))
from day5.intcode import Intcode
class Beam:
"""Tractor beam class"""
def __init__(self, fileName):
"""Initialize Beam with the intc... | 2.703125 | 3 |
backend/infs3202/settings/base.py | eivrei/INFS3202 | 0 | 48053 | <filename>backend/infs3202/settings/base.py
"""
Django settings for infs3202 project.
Generated by 'django-admin startproject' using Django 2.2.
For more information on this file, see
https://docs.djangoproject.com/en/2.2/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject... | 1.992188 | 2 |
nilmtk_converter/generate_metadata.py | klemenjak/antgen | 0 | 48054 | <gh_stars>0
#!/usr/bin/env python3
# ANTgen nilmtk_converter -- NILMTK output for the AMBAL-based NILM Trace generator
#
# Copyright (c) 2019-2020 <NAME> <<EMAIL>>, <NAME>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (th... | 2.109375 | 2 |
utils/single_scripts/get_fundamentals.py | GrovesD2/ma_crossover | 0 | 48055 | import time
from alpha_vantage.fundamentaldata import FundamentalData
def fundamental_download_case(case: int,
ticker: str,
fd):
'''
Due to the API limit of 5 calls per minute, this function was desinged so
that every 5th download can impose a sl... | 2.765625 | 3 |
miconvolucion.py | A01377098/pruebaSemanaTEC-A01377098 | 0 | 48056 | #Función que calcula la matriz resultante "C" después de aplicar la operación convolución de A*B=
# EJERCICIO 28 DE OCTUBRE
# <NAME> A01377098
import numpy as np
def convolucion (A, B):
contaFil = 0
contaCol = 0
limiteFil = len(A)
limiteCol = len(A)
longitudB = len(B)
for x in range (len(C))... | 3.28125 | 3 |
blog/home/migrations/0001_initial.py | iflyBird/blog | 0 | 48057 | # Generated by Django 2.1.8 on 2020-05-27 15:24
import datetime
from django.db import migrations, models
from django.utils.timezone import utc
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='ArticleCategory',... | 1.921875 | 2 |
Ulanowicz_Chris/Assignments/ninja_gold/server.py | webguru001/Python-Django-Web | 5 | 48058 | from flask import Flask, render_template, redirect, session, request
import random
import datetime
app = Flask(__name__)
app.secret_key = "<KEY>"
@app.route('/')
def index():
if not 'gold' in session:
session['gold'] = 0
if not 'log' in session:
session['log'] = ["Thanks for joining the game!"]
return render_t... | 2.953125 | 3 |
src/compas_ghpython/artists/polylineartist.py | Sam-Bouten/compas | 0 | 48059 | <filename>src/compas_ghpython/artists/polylineartist.py
from __future__ import print_function
from __future__ import absolute_import
from __future__ import division
import compas_ghpython
from compas.artists import PrimitiveArtist
from .artist import GHArtist
class PolylineArtist(GHArtist, PrimitiveArtist):
"""A... | 2.390625 | 2 |
stade/core/views.py | ImageMarkup/stade | 4 | 48060 | <reponame>ImageMarkup/stade
from datetime import timedelta
import logging
from django.conf import settings
from django.contrib import messages
from django.contrib.auth.decorators import login_required, user_passes_test
from django.contrib.auth.models import User
from django.db.models import Count, Exists, OuterRef, Pr... | 1.90625 | 2 |
auctions/utils.py | zebadiahtaylor/cs50-Commerce | 0 | 48061 | <reponame>zebadiahtaylor/cs50-Commerce<filename>auctions/utils.py
from .models import Auction, Bid, Comment, User
from django.db.models import Max
def has_bids(auction):
"""
Returns True if others have bid on the item.
TODO: Throws TypeError if user not logged in
"""
# auction = Auction.objects.g... | 2.796875 | 3 |
demo_broadcast.py | Monster880/pytorch_py | 0 | 48062 | <filename>demo_broadcast.py
import torch
a = torch.rand(2,4,1,3)
b = torch.rand(4,2,3)
c = a + b
# 2*4*2*3
print(a)
print(b)
print(c)
print(c.shape)
| 2.46875 | 2 |
src/test.py | D038806/face_classification | 0 | 48063 | import cv2 as cv
import matplotlib.pyplot as plt
import random as rd
import pandas as pd
from emotion_icon import load_emotion_icon
angry_man = None
all_image = load_emotion_icon()
# images = pd.DataFrame(all_image)
# print(all_image['angry_man'])
# load
# angry_man = cv.imread("./img/angry_man.jpg... | 2.84375 | 3 |
tests/test_urls.py | kverdecia/dj-mypypi2 | 1 | 48064 | <gh_stars>1-10
import cuid
from django.urls import reverse, resolve
from django.test import TestCase
from djmypypi2 import models
from djmypypi2 import factories
class TestUrls(TestCase):
def test_package_list_reverse(self):
url = reverse('djmypypi2:package-list')
self.assertEqual(url, '/mypypi2... | 2.421875 | 2 |
deepst/utils/evalMultiStepAhead.py | amirkhango/DeepST | 29 | 48065 | <filename>deepst/utils/evalMultiStepAhead.py
from __future__ import print_function
import sys
from deepst_flow.models.gan import generator_model
from deepst_flow.datasets import load_stdata
from deepst_flow.preprocessing import MinMaxNormalization
from deepst_flow.preprocessing import remove_incomplete_days
# imp... | 2.1875 | 2 |
google-datacatalog-tableau-connector/src/google/datacatalog_connectors/tableau/scrape/rest_api_helper.py | Parkman328/datacatalog-connectors-bi | 27 | 48066 | <filename>google-datacatalog-tableau-connector/src/google/datacatalog_connectors/tableau/scrape/rest_api_helper.py<gh_stars>10-100
#!/usr/bin/python
#
# 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 ... | 2.296875 | 2 |
app.py | tiesjan/htmx-flask-experiment | 1 | 48067 | <gh_stars>1-10
import functools
import random
import secrets
import string
import time
from flask import Flask, abort, g, render_template, redirect, request, url_for
from flask_wtf.csrf import CSRFProtect
from werkzeug.exceptions import HTTPException
from .db import (
create_contact, delete_contact, get_contact_o... | 2.34375 | 2 |
use/python/pkg_project/mugglefoo/tests/test_foo.py | MuggleWei/Hakuna_Matata | 0 | 48068 | <reponame>MuggleWei/Hakuna_Matata
import unittest
from src.mugglefoo.foo import Foo
class TestFoo(unittest.TestCase):
def setUp(self):
self._foo = Foo("unknown")
def test_name(self):
self.assertEqual(self._foo.name, "unknown")
self._foo.name = "foo"
self.assertEqual(self._foo... | 3.34375 | 3 |
mpl_gui/__init__.py | matplotlib/mpl-gui | 0 | 48069 | <gh_stars>0
"""
Prototype project for new Matplotlib GUI management.
The pyplot module current serves two critical, but unrelated functions:
1. provide a state-full implicit API that rhymes / was inspired by MATLAB
2. provide the management of interaction between Matplotlib and the GUI event
loop
This project is ... | 2.15625 | 2 |
tests/integration/test_application_variables.py | qateam123/eq | 0 | 48070 | <gh_stars>0
from app import settings
from tests.integration.create_token import create_token
from tests.integration.integration_test_case import IntegrationTestCase
class TestApplicationVariables(IntegrationTestCase):
def setUp(self):
settings.EQ_ENABLE_FLASK_DEBUG_TOOLBAR = True
settings.EQ_UA_I... | 2.1875 | 2 |
configs/selfsup/simmim/simmim_swin-base_16xb128-coslr-100e_in1k-192.py | mitming/mmselfsup | 355 | 48071 | _base_ = [
'../_base_/models/simmim_swin-base.py',
'../_base_/datasets/imagenet_simmim.py',
'../_base_/schedules/adamw_coslr-200e_in1k.py',
'../_base_/default_runtime.py',
]
# data
data = dict(samples_per_gpu=128)
# optimizer
optimizer = dict(
lr=2e-4 * 2048 / 512,
betas=(0.9, 0.999),
eps=... | 1.398438 | 1 |
ktpdriver/__init__.py | kevinmooreiii/moldriver | 0 | 48072 | <gh_stars>0
from ktpdriver import driver
__all__ = [
'driver',
]
| 1.117188 | 1 |
rl_env/Trackers/ScalarTracker.py | Florian-BACHO/RL-ENV | 0 | 48073 | <filename>rl_env/Trackers/ScalarTracker.py
import tensorflow as tf
class ScalarTracker:
def __init__(self, name, dump=True, writer=None):
self.name = name
self.dump = dump
self.placeholder = tf.placeholder(tf.float32, [])
self.summary = tf.summary.scalar(name, self.placeholder)
... | 2.53125 | 3 |
dnac_pnp/api_endpoint_handler.py | nttde/dnac_pnp | 5 | 48074 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""This module handles API endpoints"""
# Import builtin python libraries
import json
import logging
import os
import sys
# Import external python libraries
import click
# Import custom (local) python packages
from . import dnac_handler as dnac
# Source code meta data... | 2.21875 | 2 |
Django_ResumeParser/views.py | Aarif1430/Django_Crispy_Forms | 4 | 48075 | from django.shortcuts import redirect
def home(request):
return redirect('/ResumeParser') | 1.296875 | 1 |
SC101_Assignment4/babygraphics.py | kevinfang418/sc-projects | 0 | 48076 | <filename>SC101_Assignment4/babygraphics.py
"""
SC101 Baby Names Project
Adapted from <NAME>'s Baby Names assignment by
<NAME>.
YOUR DESCRIPTION HERE
"""
import tkinter
import babynames
import babygraphicsgui as gui
FILENAMES = [
'data/full/baby-1900.txt', 'data/full/baby-1910.txt',
'data/full/baby-1920.txt'... | 3.546875 | 4 |
model/vgg_16_minggu_malam.py | ferdyandannes/Monocular-3D-Object-Detection | 4 | 48077 | <reponame>ferdyandannes/Monocular-3D-Object-Detection
'''
Refs:
Very Deep Convolutional Networks for Large-Scale Image Recognition -- https://arxiv.org/abs/1409.1556
'''
import tensorflow as tf
layers = tf.keras.layers
reg = tf.keras.regularizers
from config import config as cfg
##
from keras.models import Seque... | 2.859375 | 3 |
Space_Dodge/Main.py | Mctowell/Space-Dodge | 0 | 48078 | <gh_stars>0
import time
import pygame, random
pygame.mixer.pre_init(44100, -16, 2, 512)
pygame.init()
win=pygame.display.set_mode((700, 700))
pygame.display.set_caption('Space Dodge')
game=True
menu=True
run=False
plyr=pygame.image.load('Assets/Spaceship.png')
plyr=pygame.transform.scale(plyr, (100, 100))
asteroid1=... | 2.40625 | 2 |
src/greenbudget/conf/__init__.py | nickmflorin/django-proper-architecture-testing | 0 | 48079 | <reponame>nickmflorin/django-proper-architecture-testing
import os
import csv
from dotenv import load_dotenv
import logging
import pathlib
import sys
logger = logging.getLogger('greenbudget')
class Environments:
PROD = "Production"
DEV = "Development"
TEST = "Test"
LOCAL = "Local"
def get_environm... | 2.65625 | 3 |
enStego.py | q1jun/EncodeBase64 | 0 | 48080 | import base64
import sys
def enStego(sourceFile,setgoFile,message):
b64table = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"
with open(sourceFile,'r') as sourceText, open(setgoFile,'w') as setgoText:
print(message)
message = "".join([bin(ord(i))[2:].zfill(8) for i in message... | 2.765625 | 3 |
Extra/rdkit_fingerprint.py | TBomberman/DeepCOP-1 | 4 | 48081 | <gh_stars>1-10
import numpy as np
from rdkit.Chem import AllChem, DataStructs
from rdkit import Chem
import csv
def load_csv(file):
# load data
expression = []
with open(file, "r") as csv_file:
reader = csv.reader(csv_file, dialect='excel')
for row in reader:
expression.append(r... | 2.796875 | 3 |
conjur/argument_parser/_screen_options_parser.py | mbjahnoon/conjur-api-python3 | 0 | 48082 | """
Module For the ScreenOptionsParser
"""
from conjur.version import __version__
from conjur.argument_parser.parser_utils import conjur_copyright
# pylint: disable=too-few-public-methods
class ScreenOptionsParser:
"""Partial class of the ArgParseBuilder.
This class add the ScreenOptions subparser to the ArgP... | 2.546875 | 3 |
corpora/caito.py | ishine/neural-lexicon-reader | 4 | 48083 | <reponame>ishine/neural-lexicon-reader
# Available at https://www.caito.de/2019/01/the-m-ailabs-speech-dataset/
from corpora import dataset_path, transformed_path
import os, glob, shutil
import librosa
import tqdm
from collections import defaultdict
subcorpora = ['en_US', 'en_UK', 'de_DE', 'es_ES', 'it_IT', 'uk_UK', '... | 2.15625 | 2 |
libotp/__init__.py | SuperM0use24/TT-CL-Edition | 0 | 48084 | from movement.CImpulse import CImpulse
from movement.CMover import CMover
from nametag import NametagGlobals
from nametag.ChatBalloon import ChatBalloon
from nametag.ClickablePopup import ClickablePopup
from nametag.MarginManager import MarginManager
from nametag.MarginPopup import MarginPopup
from nametag.Nametag impo... | 0.984375 | 1 |
SoloLearnPython3/Part_2/sketch_4b.py | mahmoudmheisen91/Python_EDU | 0 | 48085 | <filename>SoloLearnPython3/Part_2/sketch_4b.py
# Files:
import os
try:
f = open(os.getcwd()+"\\text_file_1.txt", "r+")
#print(f.read())
#print(f.read(16))
#print(f.readlines())
#for line in f:
# print(line)
a = f.write("testing...")
print(a)
#print(f.read())
finally:
f.close()
# With - auto close:
with ope... | 2.734375 | 3 |
src/minerva_db/sql/serializers/fileset.py | labsyspharm/minerva-db | 0 | 48086 | <reponame>labsyspharm/minerva-db
from marshmallow_sqlalchemy import ModelSchema
from ..models import Fileset
class FilesetSchema(ModelSchema):
class Meta:
model = Fileset
include_fk = True
exclude = tuple(prop.key
for prop in Fileset.__mapper__.iterate_properties
... | 2.109375 | 2 |
jina/executors/indexers/cache.py | sdsd0101/jina | 0 | 48087 | <reponame>sdsd0101/jina<filename>jina/executors/indexers/cache.py
from typing import Optional
import numpy as np
from . import BaseKVIndexer
from ...proto import uid
class DocIDCache(BaseKVIndexer):
"""Store doc ids in a int64 set and persistent it to a numpy array """
def __init__(self, *args, **kwargs):
... | 2.15625 | 2 |
setup.py | PracticalCleanArchitecture/fledgling | 0 | 48088 | # -*- coding: utf8 -*-
import setuptools
with open("README.md", "r", encoding="utf-8") as fh:
long_description = fh.read()
setuptools.setup(
name="fledgling",
version="0.0.1",
author="Liutos",
author_email="<EMAIL>",
description="Client of nest",
long_description=long_description,
long... | 1.53125 | 2 |
Symbol Patterns/symbolpattern143.py | vaidehisinha1/Python-PatternHouse | 0 | 48089 | height = int(input())
for i in range(1,height+1):
for j in range(1, height+1):
if(i == height//2 or i == height or j == 1 or j == height and i >= height//2 or (j%2==1 and i<= height//2)):
print("*",end=" ")
else:
print(end=" ")
print()
# Sample Input :- 7
#... | 3.90625 | 4 |
auto_script.py | UrWorstNytmare/SEVA---Sparrow-an-Essential-Voice-Assistant | 0 | 48090 | import pyautogui
import time
def increase_volume():
i = 0
while i < 5:
pyautogui.press("volumeup")
i = i + 1
def decrease_volume():
i = 0
while i < 5:
pyautogui.press("volumedown")
i = i + 1
def switch_window():
pyautogui.keyDown('alt')
pyautog... | 2.875 | 3 |
python/test/datetime/test_sec2str.py | takashiharano/util | 0 | 48091 | <gh_stars>0
#!python
import os
import sys
sys.path.append(os.path.join(os.path.dirname(__file__), '../..'))
import util
def main():
print(util.sec2str(0))
print(util.sec2str(0.000001))
print(util.sec2str(0.00001))
print(util.sec2str(0.1))
print(util.sec2str(0.123456))
print(util.sec2str(0.1234567))
pri... | 2.640625 | 3 |
ejercicios/alarma.py | proto-tools-docs/Soluciones | 0 | 48092 | <reponame>proto-tools-docs/Soluciones<gh_stars>0
"""AyudaEnPython: https://www.facebook.com/groups/ayudapython
Crear una aplicación de consola que permita al usuario programar alarmas
de tiempo. Para realizar esta aplicación deberá presentarle al usuario
las siguientes opciones: ver alarmas activas, agregar nueva alar... | 2.625 | 3 |
01-Apprenez/4.06b.py | gruiick/openclassrooms-py | 0 | 48093 | <filename>01-Apprenez/4.06b.py
#!/usr/bin/env python3
# coding: utf-8
# $Id: 4.06b.py 1.2 $
# SPDX-License-Identifier: BSD-2-Clause
""" Réseau (TCP) """
import socket
import select
hote = ''
port = 12800
connexion_principale = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
connexion_principale.bind((hote, port... | 2.6875 | 3 |
mechlib/amech_io/writer/mess.py | kevinmooreiii/mechdriver | 1 | 48094 | """
Run MESS calculations
"""
import os
import mess_io
from mechlib.amech_io import printer as ioprinter
def output(formulastr, final_pf, mess_path, filename='pf.dat'):
""" Write a mess output file for a pf file
"""
mess_out_str = mess_io.writer.pf_output(formulastr, *final_pf)
ioprinter.messpf... | 3.03125 | 3 |
wgpu/backends/vk.py | Correct-Syntax/wgpu-py | 74 | 48095 | """
We *could* implement our own Vulkan backend, so we would not need the wgpu lib.
It would be a lot of work to build and maintain though, so unless the
Rust wgpu project is abandoned or something, this is probably a bad idea.
"""
raise NotImplementedError()
| 1.03125 | 1 |
test_implicit.py | laincloud/sso | 27 | 48096 | <filename>test_implicit.py
#!/usr/bin/env python
import json
import codecs
from subprocess import Popen, PIPE
from urllib.parse import urlparse, urlencode, parse_qs
from urllib.request import urlopen, Request
serveraddr = 'localhost:8011'
authorization_endpoint = 'http://'+serveraddr+'/oauth2/auth'
token_endpoint = ... | 2.484375 | 2 |
climops/calculate_statistics.py | YakelynRJ/climops | 0 | 48097 | """
This module is used to generate correlation (R) and regression (b)
coefficients for relationships between the 2015 Census,
2018 Yale Climate Opinion Maps (YCOM) and land area datasets,
as well as p values for these relationships.
"""
import numpy as np
import pandas as pd
from scipy.stats import linregress
def ca... | 2.984375 | 3 |
vFXT/version.py | ekpgh/AvereSDK-1 | 0 | 48098 | # Copyright (c) 2015-2020 Avere Systems, Inc. All Rights Reserved.
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See LICENSE in the project root for license information.
__version__ = "0.5.4.3"
__version_info__ = (0, 5, 4, 3)
| 1.109375 | 1 |
src/python/dart/auth/rmn_required_roles_impl.py | RetailMeNotSandbox/dart | 18 | 48099 | <reponame>RetailMeNotSandbox/dart<filename>src/python/dart/auth/rmn_required_roles_impl.py
""" The decorator to decide if an dart api can be executed by user.
Assumptions: Roles are either of type Member_of (e.g. datascience or ba)
or action role (e.g. create, edit, run, delete)
and such roles... | 2.34375 | 2 |