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 |
|---|---|---|---|---|---|---|
toontown/fishing/FishCollection.py | TheFamiliarScoot/open-toontown | 99 | 9200 | from . import FishBase
from . import FishGlobals
class FishCollection:
def __init__(self):
self.fishList = []
def __len__(self):
return len(self.fishList)
def getFish(self):
return self.fishList
def makeFromNetLists(self, genusList, speciesList, weightList):
self.fis... | 3.203125 | 3 |
lead/strategies/strategy_base.py | M4gicT0/Distribute | 0 | 9201 | #! /usr/bin/env python
# -*- coding: utf-8 -*-
# vim:fenc=utf-8
#
#
# Distributed under terms of the MIT license.
"""
Strategy base class
"""
from abc import ABCMeta, abstractmethod
from tinydb import TinyDB, Query
from node import Node
import json
class Strategy(object):
def __init__(self, this_controller, thi... | 2.6875 | 3 |
project_euler/problem_01/sol6.py | mudit-chopra/Python | 0 | 9202 | <gh_stars>0
'''
Problem Statement:
If we list all the natural numbers below 10 that are multiples of 3 or 5,
we get 3,5,6 and 9. The sum of these multiples is 23.
Find the sum of all the multiples of 3 or 5 below N.
'''
from __future__ import print_function
try:
raw_input # Python 2
except NameError:
r... | 4.25 | 4 |
jsonfallback/functions.py | laymonage/django-jsonfallback | 0 | 9203 | <reponame>laymonage/django-jsonfallback
import copy
from django.db import NotSupportedError
from django.db.models import Expression
from .fields import mysql_compile_json_path, postgres_compile_json_path, FallbackJSONField
class JSONExtract(Expression):
def __init__(self, expression, *path, output_field=Fallback... | 2.09375 | 2 |
excelify/tests.py | pmbaumgartner/excelify | 11 | 9204 | <reponame>pmbaumgartner/excelify
import unittest
import tempfile
import pathlib
import datetime
import warnings
from IPython.testing.globalipapp import start_ipython, get_ipython
import pandas.util.testing as tm
from pandas.core.frame import DataFrame
from pandas.core.series import Series
from pandas import read_exce... | 2.203125 | 2 |
Easy/233/233.py | lw7360/dailyprogrammer | 0 | 9205 | # https://www.reddit.com/r/dailyprogrammer/comments/3ltee2/20150921_challenge_233_easy_the_house_that_ascii/
import random
import sys
def main():
data = open(sys.argv[1]).read().splitlines()[1::]
door = random.randrange(len(data[-1]))
wideData = []
for row in data:
curStr = ''
for... | 3.40625 | 3 |
usr/callbacks/action/tools.py | uwitec/LEHome | 151 | 9206 | #!/usr/bin/env python
# encoding: utf-8
from __future__ import division
from decimal import Decimal
import subprocess
import threading
import urllib2
import urllib
import httplib
import json
import re
import hashlib
import base64
# import zlib
from lib.command.runtime import UserInput
from lib.helper.CameraHelper ... | 2.109375 | 2 |
src/fix_code_1.py | Athenian-Computer-Science/numeric-operations-1-practice-template | 0 | 9207 | <gh_stars>0
#############################
# Collaborators: (enter people or resources who/that helped you)
# If none, write none
#
#
#############################
base = input('Enter the base: ")
height =
area = # Calculate the area of the triangle
print("The area of the triangle is (area).") | 4 | 4 |
gputools/core/oclmultireduction.py | gmazzamuto/gputools | 89 | 9208 | <reponame>gmazzamuto/gputools
"""
an adaptation of pyopencl's reduction kernel for weighted avarages
like sum(a*b)
<EMAIL>
"""
from __future__ import print_function, unicode_literals, absolute_import, division
from six.moves import zip
import pyopencl as cl
from pyopencl.tools import (
context_dependent_memoize... | 2.078125 | 2 |
mineshaft.py | DidymusRex/PiCraft | 0 | 9209 | #! /usr/bin/env python
import mcpi.minecraft as minecraft
import mcpi.block as block
import random
import time
mc = minecraft.Minecraft.create()
# ----------------------------------------------------------------------
# S E T U P
# ----------------------------------------------------------------------
# Where Am ... | 2.578125 | 3 |
example/example01.py | ChenglongChen/TextRank4ZH | 2 | 9210 | #-*- encoding:utf-8 -*-
from __future__ import print_function
import sys
try:
reload(sys)
sys.setdefaultencoding('utf-8')
except:
pass
import codecs
from textrank4zh import TextRank4Keyword, TextRank4Sentence
text = codecs.open('../test/doc/01.txt', 'r', 'utf-8').read()
tr4w = TextRank4Keyword()
tr4w.an... | 3.03125 | 3 |
scripts/anonymize_dumpdata.py | suutari-ai/respa | 1 | 9211 | import random
import uuid
import sys
import json
from faker import Factory
from faker.providers.person.fi_FI import Provider as PersonProvider
fake = Factory.create('fi_FI')
email_by_user = {}
users_by_id = {}
def anonymize_users(users):
usernames = set()
emails = set()
for data in users:
if data... | 2.46875 | 2 |
torch_geometric/utils/negative_sampling.py | NucciTheBoss/pytorch_geometric | 2,350 | 9212 | import random
from typing import Optional, Tuple, Union
import numpy as np
import torch
from torch import Tensor
from torch_geometric.utils import coalesce, degree, remove_self_loops
from .num_nodes import maybe_num_nodes
def negative_sampling(edge_index: Tensor,
num_nodes: Optional[Union[int... | 2.703125 | 3 |
venv/Lib/site-packages/pafy/g.py | DavidJohnKelly/YoutubeDownloader | 2 | 9213 | import sys
if sys.version_info[:2] >= (3, 0):
# pylint: disable=E0611,F0401,I0011
from urllib.request import build_opener
else:
from urllib2 import build_opener
from . import __version__
urls = {
'gdata': "https://www.googleapis.com/youtube/v3/",
'watchv': "http://www.youtube.com/watch?v=%s",
... | 2.265625 | 2 |
src/cowrie/telnet/userauth.py | uwacyber/cowrie | 2,316 | 9214 | <gh_stars>1000+
# Copyright (C) 2015, 2016 GoSecure Inc.
"""
Telnet Transport and Authentication for the Honeypot
@author: <NAME> <<EMAIL>>
"""
from __future__ import annotations
import struct
from twisted.conch.telnet import (
ECHO,
LINEMODE,
NAWS,
SGA,
AuthenticatingTelnetProtocol,
ITelnet... | 1.914063 | 2 |
authcheck/app/model/exception.py | flyr4nk/secscan-authcheck | 572 | 9215 | class WebException(Exception):
pass
class ParserException(Exception):
"""
解析异常
"""
pass
class ApiException(Exception):
"""
api异常
"""
pass
class WsException(Exception):
"""
轮询异常
"""
pass
class SsoException(Exception):
"""
sso异... | 1.960938 | 2 |
p_io.py | JeremyBuchanan/psf-photometry-pipeline | 0 | 9216 | <filename>p_io.py<gh_stars>0
import astropy.io.fits as fits
import matplotlib
import matplotlib.pyplot as plt
import numpy as np
import obj_data as od
import saphires as saph
from astropy.time import Time
from astropy.visualization import ZScaleInterval, SqrtStretch, ImageNormalize
from matplotlib.backends.backend_pdf ... | 2.453125 | 2 |
sympy/polys/tests/test_monomialtools.py | ichuang/sympy | 1 | 9217 | <gh_stars>1-10
"""Tests for tools and arithmetics for monomials of distributed polynomials. """
from sympy.polys.monomialtools import (
monomials, monomial_count,
monomial_key, lex, grlex, grevlex,
monomial_mul, monomial_div,
monomial_gcd, monomial_lcm,
monomial_max, monomial_min,
monomial_divi... | 2.5 | 2 |
Solutions/TenableIO/Data Connectors/azure_sentinel.py | johnbilliris/Azure-Sentinel | 2,227 | 9218 | <reponame>johnbilliris/Azure-Sentinel
import re
import base64
import hmac
import hashlib
import logging
import requests
from datetime import datetime
class AzureSentinel:
def __init__(self, workspace_id, workspace_key, log_type, log_analytics_url=''):
self._workspace_id = workspace_id
self._works... | 2.4375 | 2 |
MiniProject.py | siddharths067/CNN-Based-Agent-Modelling-for-Humanlike-Driving-Simulaion | 0 | 9219 | from tkinter import *
from PIL import ImageGrab
import numpy as np
import cv2
import time
import pyautogui as pg
import DirectInputRoutines as DIR
from LogKey import key_check
last_time = time.time()
one_hot = [0, 0, 0, 0, 0, 0]
hash_dict = {'w':0, 's':1, 'a':2, 'd':3, 'c':4, 'v':5}
X = []
y = []
def a... | 2.578125 | 3 |
src/code/djangotest/migrations/0001_initial.py | jielyu/notebook | 2 | 9220 | # Generated by Django 2.2.5 on 2019-10-05 23:22
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Password',
fields=[
('id', models.IntegerFi... | 1.882813 | 2 |
filer/tests/utils/__init__.py | pbs/django-filer | 1 | 9221 | <reponame>pbs/django-filer<filename>filer/tests/utils/__init__.py
from django.template.loaders.base import Loader as BaseLoader
from django.template.base import TemplateDoesNotExist
class Mock():
pass
class MockLoader(BaseLoader):
is_usable = True
def load_template_source(self, template_name, template... | 2.296875 | 2 |
utils/arrival_overlaps.py | davmre/sigvisa | 0 | 9222 | <gh_stars>0
import sigvisa.database.db
from sigvisa.database.dataset import *
import sigvisa.utils.geog
cursor = database.db.connect().cursor()
detections, arid2num = read_detections(cursor, 1237680000, 1237680000 + 168 * 3600, arrival_table="leb_arrival", noarrays=False)
last_det = dict()
overlaps = 0
for det in de... | 2.46875 | 2 |
tests/transformation/streamline/test_move_identical_op_past_join_op.py | mmrahorovic/finn | 109 | 9223 | import pytest
from onnx import TensorProto
from onnx import helper as oh
import finn.core.onnx_exec as oxe
from finn.core.modelwrapper import ModelWrapper
from finn.transformation.streamline.reorder import MoveTransposePastJoinAdd
from finn.util.basic import gen_finn_dt_tensor
def create_model(perm):
if perm ==... | 2.125 | 2 |
app/lib/ncr_util.py | jchrisfarris/antiope-scorecards | 1 | 9224 | <filename>app/lib/ncr_util.py<gh_stars>1-10
import json
from lib import authz
from lib.logger import logger
from lib.exclusions import exclusions, state_machine
def get_allowed_actions(user, account_id, requirement, exclusion):
allowed_actions = {
'remediate': False,
'requestExclusion': False,
... | 2.265625 | 2 |
ambari-server/src/test/python/stacks/2.6/SPARK2/test_spark_livy2.py | Syndra/Ambari-source | 1 | 9225 | #!/usr/bin/env python
'''
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")... | 1.640625 | 2 |
SentDex/Chapter05.py | harimaruthachalam/SentDexChapters | 0 | 9226 | import quandl
import math
import numpy as np
from sklearn import preprocessing, cross_validation, svm
from sklearn.linear_model import LinearRegression
import pickle
import datetime
from matplotlib import style
import matplotlib.pyplot as plot
# Config
isLoadFromLocal = True
quandl.ApiConfig.api_key = '<KEY>'
style.us... | 2.5 | 2 |
tifinity/actions/icc_parser.py | pmay/tifinity | 1 | 9227 | <reponame>pmay/tifinity
class IccProfile():
"""Parses an ICC Colour Profile.
According to spec: all Profile data shall be encoded as big-endian"""
def __init__(self, bytes):
self.header = {}
self.parse_icc(bytes)
def get_colour_space(self):
"""Returns the data colour space t... | 2.640625 | 3 |
challenges/binary_search/test_binary_search.py | asakatida/data-structures-and-algorithms.py | 0 | 9228 | from .binary_search import binary_search
def test_binary_search_empty_array():
assert binary_search([], 0) == -1
def test_binary_search_find_single_array():
assert binary_search([3], 3) == 0
def test_binary_search_not_found_single_array():
assert binary_search([1], 0) == -1
def test_binary_search_no... | 3.578125 | 4 |
Module2.py | Cipalex/session3 | 0 | 9229 | def f():
print('f from module 2')
if __name__ == '__main__':
print('Module 2') | 1.757813 | 2 |
analisis_de_variables.py | scmarquez/Hause-Price-Kaggle-Competition | 0 | 9230 | <filename>analisis_de_variables.py
# -*- coding: utf-8 -*-
"""
Created on Fri Dec 29 16:40:53 2017
@author: Sergio
"""
#Analisis de variables
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
from sklearn import ensemble, tree, linear_model
from sklearn.model_se... | 3 | 3 |
query-gen.py | mdatsev/prostgres | 0 | 9231 | import random
import sys
ntables = 100
ncols = 100
nrows = 10000
def printstderr(s):
sys.stderr.write(s + '\n')
sys.stderr.flush()
def get_value():
return random.randint(-99999999, 99999999)
for t in range(ntables):
printstderr(f'{t}/{ntables}')
print(f"create table x ({','.join(['x int'] * ncols)});")
... | 2.65625 | 3 |
molecule/default/tests/test_default.py | joshbenner/sensu-ansible-role | 0 | 9232 | import os
import testinfra.utils.ansible_runner
testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner(
os.environ['MOLECULE_INVENTORY_FILE']).get_hosts('all')
def test_packages(host):
package = host.package('sensu')
assert package.is_installed
assert '1.7.0' in package.version
def test_di... | 1.992188 | 2 |
wgskex/worker/netlink.py | moepman/wgskex | 2 | 9233 | <filename>wgskex/worker/netlink.py
import hashlib
import logging
import re
from dataclasses import dataclass
from datetime import datetime, timedelta
from textwrap import wrap
from typing import Dict, List
from pyroute2 import IPRoute, NDB, WireGuard
from wgskex.common.utils import mac2eui64
logger = logging.getLogg... | 2.234375 | 2 |
api/main.py | Ju99ernaut/super-fastapi | 0 | 9234 | import uvicorn
from fastapi import FastAPI
from fastapi.middleware.cors import CORSMiddleware
from routes import items
import config
from constants import *
config.parse_args()
app = FastAPI(
title="API",
description="API boilerplate",
version="1.0.0",
openapi_tags=API_TAGS_METADATA,
)
app.add_midd... | 2.359375 | 2 |
gellifinsta/models.py | vallka/djellifique | 0 | 9235 | from django.db import models
from django.utils.translation import ugettext_lazy as _
from django.utils.html import mark_safe
# Create your models here.
class Gellifinsta(models.Model):
class Meta:
ordering = ['-taken_at_datetime']
shortcode = models.CharField(_("Shortcode"), max_length=20)
taken_... | 2.140625 | 2 |
scanBase/migrations/0003_ipsection.py | wsqy/sacn_server | 0 | 9236 | # -*- coding: utf-8 -*-
# Generated by Django 1.11 on 2018-01-16 13:35
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('scanBase', '0002_auto_20180116_1321'),
]
operations ... | 1.640625 | 2 |
sts/train.py | LostCow/KLUE | 18 | 9237 | <filename>sts/train.py
import argparse
import numpy as np
import os
import torch
from transformers import AutoTokenizer, AutoConfig, Trainer, TrainingArguments
from model import RobertaForStsRegression
from dataset import KlueStsWithSentenceMaskDataset
from utils import read_json, seed_everything
from metric import c... | 2.140625 | 2 |
test/test_base_client.py | walkr/nanoservice | 28 | 9238 | import unittest
from nanoservice import Responder
from nanoservice import Requester
class BaseTestCase(unittest.TestCase):
def setUp(self):
addr = 'inproc://test'
self.client = Requester(addr)
self.service = Responder(addr)
self.service.register('divide', lambda x, y: x / y)
... | 2.78125 | 3 |
airtech_api/flight/models.py | chidioguejiofor/airtech-api | 1 | 9239 | <reponame>chidioguejiofor/airtech-api<filename>airtech_api/flight/models.py<gh_stars>1-10
from airtech_api.utils.auditable_model import AuditableBaseModel
from django.db import models
# Create your models here.
class Flight(AuditableBaseModel):
class Meta:
db_table = 'Flight'
capacity = models.Intege... | 2.265625 | 2 |
Sensor Fusion and Tracking/Kalman Filters/Gaussian/gaussian.py | kaka-lin/autonomous-driving-notes | 0 | 9240 | <reponame>kaka-lin/autonomous-driving-notes
import numpy as np
import matplotlib.pyplot as plt
def gaussian(x, mean, std):
std2 = np.power(std, 2)
return (1 / np.sqrt(2* np.pi * std2)) * np.exp(-.5 * (x - mean)**2 / std2)
if __name__ == "__main__":
gauss_1 = gaussian(10, 8, 2) # 0.12098536225957168
... | 3.890625 | 4 |
part19/test_interpreter.py | fazillatheef/lsbasi | 1,682 | 9241 | import unittest
class LexerTestCase(unittest.TestCase):
def makeLexer(self, text):
from spi import Lexer
lexer = Lexer(text)
return lexer
def test_tokens(self):
from spi import TokenType
records = (
('234', TokenType.INTEGER_CONST, 234),
('3.14'... | 2.796875 | 3 |
bot_components/configurator.py | Ferlern/Arctic-Tundra | 3 | 9242 | <reponame>Ferlern/Arctic-Tundra
import json
from typing import TypedDict
from .bot_emoji import AdditionalEmoji
class Warn(TypedDict):
text: str
mute_time: int
ban: bool
class PersonalVoice(TypedDict):
categoty: int
price: int
slot_price: int
bitrate_price: int
class System(TypedDict):... | 2.265625 | 2 |
recnn/utils/plot.py | ihash5/reinforcement-learning | 1 | 9243 | <filename>recnn/utils/plot.py
from scipy.spatial import distance
from scipy import ndimage
import matplotlib.pyplot as plt
import torch
from scipy import stats
import numpy as np
def pairwise_distances_fig(embs):
embs = embs.detach().cpu().numpy()
similarity_matrix_cos = distance.cdist(embs, embs, 'cosine')
... | 2.359375 | 2 |
tests/integration/insights/v1/call/test_metric.py | pazzy-stack/twilio | 0 | 9244 | <gh_stars>0
# coding=utf-8
r"""
This code was generated by
\ / _ _ _| _ _
| (_)\/(_)(_|\/| |(/_ v1.0.0
/ /
"""
from tests import IntegrationTestCase
from tests.holodeck import Request
from twilio.base.exceptions import TwilioException
from twilio.http.response import Response
class MetricTestCas... | 2.1875 | 2 |
2017-2018/lecture-notes/python/02-algorithms_listing_8_contains_word.py | essepuntato/comp-think | 19 | 9245 | def contains_word(first_word, second_word, bibliographic_entry):
contains_first_word = first_word in bibliographic_entry
contains_second_word = second_word in bibliographic_entry
if contains_first_word and contains_second_word:
return 2
elif contains_first_word or contains_second_word:
... | 4.125 | 4 |
backend/user/scripter.py | ivaivalous/ivodb | 0 | 9246 | <filename>backend/user/scripter.py<gh_stars>0
#!/usr/bin/env python
import responses
from selenium import webdriver
# This file contains/references the default JS
# used to provide functions dealing with input/output
SCRIPT_RUNNER = "runner.html"
ENCODING = 'utf-8'
PAGE_LOAD_TIMEOUT = 5
PAGE_LOAD_TIMEOUT_MS = PAGE_L... | 2.671875 | 3 |
bwtougu/api/names.py | luhouxiang/byrobot | 0 | 9247 | <reponame>luhouxiang/byrobot
#!/usr/bin/env python
# -*- coding: utf-8 -*-
VALID_HISTORY_FIELDS = [
'datetime', 'open', 'close', 'high', 'low', 'total_turnover', 'volume',
'acc_net_value', 'discount_rate', 'unit_net_value',
'limit_up', 'limit_down', 'open_interest', 'basis_spread', 'settlement', 'prev_sett... | 1.125 | 1 |
src/PeerRead/data_cleaning/process_PeerRead_abstracts.py | dveni/causal-text-embeddings | 114 | 9248 | <filename>src/PeerRead/data_cleaning/process_PeerRead_abstracts.py
"""
Simple pre-processing for PeerRead papers.
Takes in JSON formatted data from ScienceParse and outputs a tfrecord
Reference example:
https://github.com/tensorlayer/tensorlayer/blob/9528da50dfcaf9f0f81fba9453e488a1e6c8ee8f/examples/data_process/tuto... | 2.828125 | 3 |
app/packageB/__init__.py | An7ar35/python-app-skeleton-structure | 0 | 9249 | <reponame>An7ar35/python-app-skeleton-structure<gh_stars>0
__all__=['module1'] | 0.960938 | 1 |
lib/shop.py | ZakDoesGaming/OregonTrail | 6 | 9250 | from pygame import Surface, font
from copy import copy
from random import randint, choice
import string
from lib.transactionButton import TransactionButton
SHOP_PREFIX = ["archer", "baker", "fisher", "miller", "rancher", "robber"]
SHOP_SUFFIX = ["cave", "creek", "desert", "farm", "field", "forest", "hill", "lake", "m... | 3.125 | 3 |
core/dataflow/test/test_runners.py | ajmal017/amp | 0 | 9251 | <gh_stars>0
import logging
import numpy as np
import core.dataflow as dtf
import helpers.unit_test as hut
_LOG = logging.getLogger(__name__)
class TestRollingFitPredictDagRunner(hut.TestCase):
def test1(self) -> None:
"""
Test the DagRunner using `ArmaReturnsBuilder`
"""
dag_bu... | 2.0625 | 2 |
Main Project/Main_Program.py | hmnk-1967/OCR-Python-Project-CS-BUIC | 0 | 9252 | import tkinter.messagebox
from tkinter import *
import tkinter as tk
from tkinter import filedialog
import numpy
import pytesseract #Python wrapper for Google-owned OCR engine known by the name of Tesseract.
import cv2
from PIL import Image, ImageTk
import os
root = tk.Tk()
root.title("Object Character Recognizer")
ro... | 3.078125 | 3 |
third_party/nasm/workspace.bzl | wainshine/tensorflow | 54 | 9253 | """loads the nasm library, used by TF."""
load("//third_party:repo.bzl", "tf_http_archive")
def repo():
tf_http_archive(
name = "nasm",
urls = [
"https://storage.googleapis.com/mirror.tensorflow.org/www.nasm.us/pub/nasm/releasebuilds/2.13.03/nasm-2.13.03.tar.bz2",
"http://p... | 1.539063 | 2 |
python/tests/test-1-vector.py | wence-/libCEED | 0 | 9254 | # Copyright (c) 2017, Lawrence Livermore National Security, LLC. Produced at
# the Lawrence Livermore National Laboratory. LLNL-CODE-734707. All Rights
# reserved. See files LICENSE and NOTICE for details.
#
# This file is part of CEED, a collection of benchmarks, miniapps, software
# libraries and APIs for efficient h... | 1.75 | 2 |
esmvalcore/cmor/_fixes/cmip6/cesm2.py | aperezpredictia/ESMValCore | 1 | 9255 | <gh_stars>1-10
"""Fixes for CESM2 model."""
from ..fix import Fix
from ..shared import (add_scalar_depth_coord, add_scalar_height_coord,
add_scalar_typeland_coord, add_scalar_typesea_coord)
class Fgco2(Fix):
"""Fixes for fgco2."""
def fix_metadata(self, cubes):
"""Add depth (0m) ... | 1.984375 | 2 |
examples/GenerateSubset.py | vitay/YouTubeFacesDB | 11 | 9256 | from YouTubeFacesDB import generate_ytf_database
###############################################################################
# Create the dataset
###############################################################################
generate_ytf_database(
directory= '../data',#'/scratch/vitay/Datasets/YouTubeFaces'... | 2.484375 | 2 |
src/waldur_mastermind/billing/tests/test_price_current.py | opennode/nodeconductor-assembly-waldur | 2 | 9257 | from freezegun import freeze_time
from rest_framework import test
from waldur_mastermind.billing.tests.utils import get_financial_report_url
from waldur_mastermind.invoices import models as invoice_models
from waldur_mastermind.invoices.tests import factories as invoice_factories
from waldur_mastermind.invoices.tests ... | 2.140625 | 2 |
tests/test_cli/test_utils/test_utils.py | ejfitzgerald/agents-aea | 0 | 9258 | # -*- coding: utf-8 -*-
# ------------------------------------------------------------------------------
#
# Copyright 2018-2019 Fetch.AI 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 ... | 1.578125 | 2 |
api/flat/urls.py | SanjarbekSaminjonov/musofirlar.backend | 1 | 9259 | from django.urls import path
from . import views
urlpatterns = [
path('', views.FlatListAPIView.as_view()),
path('create/', views.FlatCreateAPIView.as_view()),
path('<int:pk>/', views.FlatDetailAPIView.as_view()),
path('<int:pk>/update/', views.FlatUpdateAPIView.as_view()),
path('<int:pk>/delete/'... | 1.625 | 2 |
hyssop_aiohttp/component/__init__.py | hsky77/hyssop | 0 | 9260 | # Copyright (C) 2020-Present the hyssop authors and contributors.
#
# This module is part of hyssop and is released under
# the MIT License: http://www.opensource.org/licenses/mit-license.php
'''
File created: January 1st 2021
Modified By: hsky77
Last Updated: January 7th 2021 15:30:08 pm
'''
from hyssop.project.com... | 1.8125 | 2 |
run_clone.py | tGhattas/IMP-seamless-cloning | 0 | 9261 | <reponame>tGhattas/IMP-seamless-cloning
import cv2
import getopt
import sys
from gui import MaskPainter, MaskMover
from clone import seamless_cloning, shepards_seamless_cloning
from utils import read_image, plt
from os import path
def usage():
print(
"Usage: python run_clone.py [options] \n\n\
Opt... | 2.25 | 2 |
punkweb_boards/rest/serializers.py | Punkweb/punkweb-boards | 20 | 9262 | from rest_framework import serializers
from punkweb_boards.conf.settings import SHOUTBOX_DISABLED_TAGS
from punkweb_boards.models import (
BoardProfile,
Category,
Subcategory,
Thread,
Post,
Conversation,
Message,
Report,
Shout,
)
class BoardProfileSerializer(serializers.ModelSerial... | 2 | 2 |
runtime/components/Statistic/moving_minimum_time.py | ulise/hetida-designer | 41 | 9263 | <reponame>ulise/hetida-designer<gh_stars>10-100
from hetdesrun.component.registration import register
from hetdesrun.datatypes import DataType
import pandas as pd
import numpy as np
# ***** DO NOT EDIT LINES BELOW *****
# These lines may be overwritten if input/output changes.
@register(
inputs={"data": DataType.... | 2.5 | 2 |
painter.py | MikhailNakhatovich/rooms_painting | 0 | 9264 | import cv2
import ezdxf
import numpy as np
def draw_hatch(img, entity, color, mask):
for poly_path in entity.paths.paths:
# print(poly_path.path_type_flags)
polygon = np.array([vertex[:-1] for vertex in poly_path.vertices]).astype(int)
if poly_path.path_type_flags & 1 == 1:
cv2... | 2.640625 | 3 |
misago/misago/users/serializers/auth.py | vascoalramos/misago-deployment | 2 | 9265 | <reponame>vascoalramos/misago-deployment
from django.contrib.auth import get_user_model
from django.urls import reverse
from rest_framework import serializers
from ...acl.useracl import serialize_user_acl
from .user import UserSerializer
User = get_user_model()
__all__ = ["AuthenticatedUserSerializer", "AnonymousUse... | 2.140625 | 2 |
shop/models.py | mohammadanarul/Ecommerce-Django-YT | 0 | 9266 | <reponame>mohammadanarul/Ecommerce-Django-YT<gh_stars>0
from ctypes.wintypes import CHAR
from distutils.command.upload import upload
from random import choice
from telnetlib import STATUS
from unicodedata import category
from django.db import models
from ckeditor.fields import RichTextField
from taggit.managers import ... | 2.265625 | 2 |
supriya/patterns/NoteEvent.py | deeuu/supriya | 0 | 9267 | <gh_stars>0
import uuid
import supriya.commands
import supriya.realtime
from supriya.patterns.Event import Event
class NoteEvent(Event):
### CLASS VARIABLES ###
__slots__ = ()
### INITIALIZER ###
def __init__(
self,
add_action=None,
delta=None,
duration=None,
... | 2.234375 | 2 |
emoji_utils.py | ApacheAA/LastSeen | 0 | 9268 | <filename>emoji_utils.py
# unicode digit emojis
# digits from '0' to '9'
zero_digit_code = zd = 48
# excluded digits
excl_digits = [2, 4, 5, 7]
# unicode digit keycap
udkc = '\U0000fe0f\U000020e3'
hours_0_9 = [chr(i) + udkc for i in range(zd, zd + 10)
if i - zd not in excl_digits]
# number '10' emoji
hours_0_9... | 2.828125 | 3 |
TFBertForMaskedLM/main.py | Sniper970119/ExampleForTransformers | 3 | 9269 | <filename>TFBertForMaskedLM/main.py
# -*- coding:utf-8 -*-
"""
┏┛ ┻━━━━━┛ ┻┓
┃ ┃
┃ ━ ┃
┃ ┳┛ ┗┳ ┃
┃ ┃
┃ ┻ ┃
┃ ┃
┗━┓ ┏━━━┛
┃ ┃ 神兽保佑
┃ ┃ 代码无BUG!
┃ ┗━━━━━━━━━┓
┃CREATE BY SNIPER┣┓
┃ ┏... | 2.65625 | 3 |
mirari/TCS/migrations/0042_auto_20190726_0145.py | gcastellan0s/mirariapp | 0 | 9270 | # Generated by Django 2.0.5 on 2019-07-26 06:45
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('TCS', '0041_auto_20190726_0030'),
]
operations = [
migrations.AlterModelOptions(
name='modelo',
options={'default_permission... | 1.59375 | 2 |
kornia/geometry/calibration/undistort.py | belltailjp/kornia | 1 | 9271 | import torch
from kornia.geometry.linalg import transform_points
from kornia.geometry.transform import remap
from kornia.utils import create_meshgrid
from .distort import distort_points, tilt_projection
# Based on https://github.com/opencv/opencv/blob/master/modules/calib3d/src/undistort.dispatch.cpp#L384
def undis... | 2.5 | 2 |
Tests/Aula_7a.py | o-Ian/Practice-Python | 4 | 9272 | n1 = int(input('Digite um valor: '))
n2 = int(input('Digite outro valor: '))
print('A soma é: {}!' .format(n1+n2))
print('A subtração entre {} e {} é {}!' .format(n1, n2, n1-n2))
print('A multiplicação desses valores é {}!' .format(n1 * n2))
print('A divisão entre {} e {} é {:.3}' .format(n1, n2, n1/n2))
print('A divis... | 4.09375 | 4 |
manubot/cite/tests/test_citekey_api.py | shuvro-zz/manubot | 1 | 9273 | <filename>manubot/cite/tests/test_citekey_api.py
"""Tests API-level functions in manubot.cite. Both functions are found in citekey.py"""
import pytest
from manubot.cite import citekey_to_csl_item, standardize_citekey
@pytest.mark.parametrize(
"citekey,expected",
[
("doi:10.5061/DRYAD.q447c/1", "doi:... | 2.25 | 2 |
vispy/io/datasets.py | hmaarrfk/vispy | 2,617 | 9274 | # -*- coding: utf-8 -*-
# Copyright (c) Vispy Development Team. All Rights Reserved.
# Distributed under the (new) BSD License. See LICENSE.txt for more info.
import numpy as np
from os import path as op
from ..util import load_data_file
# This is the package data dir, not the dir for config, etc.
DATA_DIR = op.join... | 2.25 | 2 |
universal_portfolio/knapsack.py | jehung/universal_portfolio | 14 | 9275 | <reponame>jehung/universal_portfolio
# -*- coding: utf-8 -*-
from __future__ import print_function
import numpy as np
np.random.seed(1335) # for reproducibility
np.set_printoptions(precision=5, suppress=True, linewidth=150)
import os
import pandas as pd
import backtest as twp
from matplotlib import pyplot as plt
from... | 2.375 | 2 |
experiments/experiment_01.py | bask0/q10hybrid | 2 | 9276 | <reponame>bask0/q10hybrid
import pytorch_lightning as pl
import optuna
import xarray as xr
from pytorch_lightning.callbacks.early_stopping import EarlyStopping
from pytorch_lightning.callbacks.model_checkpoint import ModelCheckpoint
import os
import shutil
from argparse import ArgumentParser
from datetime import dat... | 2.0625 | 2 |
main.py | warifp/InstagramPostAndDelete | 4 | 9277 | #! @@Author : <NAME>
#! @@Create : 18 Januari 2019
#! @@Modify : 19 Januari 2019
#! Gambar dari reddit.
#! Gunakan VPN karena DNS situs reddit sudah di blokir dari negara Indonesia.
import os
import json
import requests
import progressbar
from PIL import Image
from lxml import html
from time import sleep
from ImageDel... | 3.109375 | 3 |
pyspectator/collection.py | maximilionus/pyspectator-x | 39 | 9278 | from collections import MutableMapping, Container
from datetime import datetime, timedelta
from pyvalid import accepts
class LimitedTimeTable(MutableMapping, Container):
def __init__(self, time_span):
self.__storage = dict()
self.__time_span = None
self.time_span = time_span
@propert... | 2.5 | 2 |
keyboardrow.py | AndySamoil/Elite_Code | 0 | 9279 | def findWords(self, words: List[str]) -> List[str]:
''' sets and iterate through sets
'''
every = [set("qwertyuiop"), set("asdfghjkl"), set("zxcvbnm")]
ans = []
for word in words:
l = len(word)
for sett in every:
... | 3.734375 | 4 |
DFS_Backtracking/31. Next Permutation.py | xli1110/LC | 2 | 9280 | <gh_stars>1-10
class Solution:
def __init__(self):
self.res = []
self.path = []
def arr_to_num(self, arr):
s = ""
for x in arr:
s += str(x)
return int(s)
def find_position(self, nums):
for i in range(len(self.res)):
if self.res[i] == ... | 3.78125 | 4 |
plugin/DataExport/extend.py | konradotto/TS | 125 | 9281 | #!/usr/bin/python
# Copyright (C) 2015 Ion Torrent Systems, Inc. All Rights Reserved
import subprocess
import re
pluginName = 'DataExport'
pluginDir = ""
networkFS = ["nfs", "cifs"]
localFS = ["ext4", "ext3", "xfs", "ntfs", "exfat", "vboxsf"]
supportedFS = ",".join(localFS + networkFS)
def test(bucket):
return... | 2.0625 | 2 |
boids/biods_object.py | PaulAustin/sb7-pgz | 1 | 9282 | # Ported from JavaSript version to Python and Pygame Zero
# Designed to work well with mu-editor environment.
#
# The original Javascript version wasdonw by <NAME>
# at https://github.com/beneater/boids (MIT License)
# No endorsement implied.
#
# Complex numbers are are used as vectors to integrate x and y positions an... | 2.78125 | 3 |
upoutdf/types/recurring/yearly.py | UpOut/UpOutDF | 0 | 9283 | <filename>upoutdf/types/recurring/yearly.py<gh_stars>0
# coding: utf-8
import pytz
from dateutil.relativedelta import relativedelta
from .base import BaseRecurring
from upoutdf.occurences import OccurenceBlock, OccurenceGroup
from upoutdf.constants import YEARLY_TYPE
class YearlyType(BaseRecurring):
year_day = ... | 2.421875 | 2 |
project/urls.py | dbinetti/captable | 18 | 9284 | <reponame>dbinetti/captable
from django.conf.urls import patterns, include, url
from django.contrib import admin
admin.autodiscover()
from django.contrib.staticfiles.urls import staticfiles_urlpatterns
from django.views.generic import TemplateView
urlpatterns = patterns(
'',
url(r'^$', TemplateView.as_view(... | 1.914063 | 2 |
common/evaluators/bert_emotion_evaluator.py | marjanhs/procon20 | 5 | 9285 | import warnings
import numpy as np
import torch
import torch.nn.functional as F
from sklearn import metrics
from torch.utils.data import DataLoader, SequentialSampler, TensorDataset
from tqdm import tqdm
from datasets.bert_processors.abstract_processor import convert_examples_to_features_with_emotion, \
... | 2.21875 | 2 |
model/mlp1.py | andrearosasco/DistilledReplay | 7 | 9286 | import torch.nn as nn
import torch.nn.functional as F
class Model(nn.Module):
def __init__(self, config):
super(Model, self).__init__()
self.drop = nn.Dropout(config['dropout'])
self.fc1 = nn.Linear(784, 2000)
self.fc2 = nn.Linear(2000, 2000)
self.fc3 = nn.Linea... | 2.859375 | 3 |
netbox/ipam/managers.py | aslafy-z/netbox | 1 | 9287 | <filename>netbox/ipam/managers.py
from django.db import models
from ipam.lookups import Host, Inet
class IPAddressManager(models.Manager):
def get_queryset(self):
"""
By default, PostgreSQL will order INETs with shorter (larger) prefix lengths ahead of those with longer
(smaller) masks. ... | 2.46875 | 2 |
train.py | VArdulov/learning-kis | 0 | 9288 | #!/usr/bin/env python
# coding: utf-8
""" Learning Koopman Invariant Subspace
(c) <NAME>, 2017.
<EMAIL>
"""
import numpy as np
np.random.seed(1234567890)
from argparse import ArgumentParser
from os import path
import time
from lkis import TimeSeriesBatchMaker, KoopmanInvariantSubspaceLearner
from losses import co... | 2.5 | 2 |
Algorithms/Easy/1200. Minimum Absolute Difference/answer.py | KenWoo/Algorithm | 0 | 9289 | <reponame>KenWoo/Algorithm<gh_stars>0
from typing import List
class Solution:
def minimumAbsDifference(self, arr: List[int]) -> List[List[int]]:
arr.sort()
res = []
min_diff = arr[1] - arr[0]
res.append([arr[0], arr[1]])
for i in range(1, len(arr)-1):
diff = arr... | 3.375 | 3 |
resources/physequations.py | VijayStroup/Physics_Problem_Solver_Basic | 0 | 9290 | <filename>resources/physequations.py
import math
def close(expected, actual, maxerror):
'''checks to see if the actual number is within expected +- maxerror.'''
low = expected - maxerror
high = expected + maxerror
if actual >= low and actual <= high:
return True
else:
return False
def grav_potential_energy(m... | 3.703125 | 4 |
mvpa2/tests/test_erdataset.py | andycon/PyMVPA | 0 | 9291 | <reponame>andycon/PyMVPA
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
# vi: set ft=python sts=4 ts=4 sw=4 et:
### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ##
#
# See COPYING file distributed along with the PyMVPA package for the
# copyright and license ter... | 1.992188 | 2 |
userbot/plugins/delfp.py | aksr-aashish/FIREXUSERBOT | 0 | 9292 | from telethon.tl.functions.photos import DeletePhotosRequest, GetUserPhotosRequest
from telethon.tl.types import InputPhoto
from userbot.cmdhelp import CmdHelp
from userbot.utils import admin_cmd, edit_or_reply, sudo_cmd
CmdHelp("delfp").add_command("delpfp", None, "delete ur currnt profile picture").add()
@borg.on... | 2.515625 | 3 |
amlb/benchmarks/file.py | pplonski/automlbenchmark | 282 | 9293 | <filename>amlb/benchmarks/file.py<gh_stars>100-1000
import logging
import os
from typing import List, Tuple, Optional
from amlb.utils import config_load, Namespace
log = logging.getLogger(__name__)
def _find_local_benchmark_definition(name: str, benchmark_definition_dirs: List[str]) -> str:
# 'name' should be e... | 2.390625 | 2 |
pybuspro/devices/control.py | eyesoft/pybuspro | 2 | 9294 | from ..core.telegram import Telegram
from ..helpers.enums import OperateCode
class _Control:
def __init__(self, buspro):
self._buspro = buspro
self.subnet_id = None
self.device_id = None
@staticmethod
def build_telegram_from_control(control):
if control is None:
... | 2.3125 | 2 |
appengine/chrome_infra_console_loadtest/main.py | eunchong/infra | 0 | 9295 | <filename>appengine/chrome_infra_console_loadtest/main.py
# Copyright 2015 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import logging
import endpoints
import random
import webapp2
from apiclient import discovery
from ... | 2.203125 | 2 |
src/mitre/securingai/restapi/task_plugin/controller.py | usnistgov/dioptra | 14 | 9296 | <reponame>usnistgov/dioptra
# This Software (Dioptra) is being made available as a public service by the
# National Institute of Standards and Technology (NIST), an Agency of the United
# States Department of Commerce. This software was developed in part by employees of
# NIST and in part by NIST contractors. Copyright... | 1.328125 | 1 |
dulwich/tests/test_lru_cache.py | mjmaenpaa/dulwich | 0 | 9297 | # Copyright (C) 2006, 2008 Canonical Ltd
#
# Dulwich is dual-licensed under the Apache License, Version 2.0 and the GNU
# General Public License as public by the Free Software Foundation; version 2.0
# or (at your option) any later version. You can redistribute it and/or
# modify it under the terms of either of these t... | 2.140625 | 2 |
py/2016/5B.py | pedrotari7/advent_of_code | 0 | 9298 | import md5
(i,count) = (0,0)
password = ['']*8
while 1:
key = 'reyedfim' + str(i)
md = md5.new(key).hexdigest()
if md[:5] == '00000':
index = int(md[5],16)
if index < len(password) and password[index]=='':
password[index] = md[6]
count += 1
if count ... | 3.0625 | 3 |
release/scripts/mgear/shifter_epic_components/EPIC_foot_01/__init__.py | lsica-scopely/mgear4 | 0 | 9299 | <filename>release/scripts/mgear/shifter_epic_components/EPIC_foot_01/__init__.py<gh_stars>0
import pymel.core as pm
import ast
from pymel.core import datatypes
from mgear.shifter import component
from mgear.core import node, applyop, vector
from mgear.core import attribute, transform, primitive
class Component(comp... | 2.1875 | 2 |