content stringlengths 7 928k | avg_line_length float64 3.5 33.8k | max_line_length int64 6 139k | alphanum_fraction float64 0.08 0.96 | licenses list | repository_name stringlengths 7 104 | path stringlengths 4 230 | size int64 7 928k | lang stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|
from typing import Tuple
import yaml
class World:
world = None
"""
The first index is the Y coordinate, and the second index is the X coordinate
:type world: List[List[int]]
"""
width = None
"""
:type width: int
"""
height = None
"""
:type height: int
"""
d... | 21.95082 | 81 | 0.511576 | [
"MIT"
] | Sidesplitter/Informatica-Olympiade-2016-2017 | src/B2/world.py | 1,339 | Python |
import os
import sys
sys.path.append('../')
import speedify
from speedify import State, Priority, SpeedifyError, SpeedifyAPIError
import speedifysettings
import speedifyutil
import logging
import unittest
import time
logging.basicConfig(handlers=[logging.FileHandler('test.log'),logging.StreamHandler(sys.stdout)],forma... | 44.280645 | 179 | 0.678298 | [
"Apache-2.0"
] | Sarvesh-Kesharwani/speedify-py | tests/test_speedify.py | 13,727 | Python |
"""
Adds the source files to the path for files in any subdirectory
TODO: check that we have not alredy added to our path.
"""
import os
import sys
fileLocation = os.path.dirname(os.path.abspath(__file__))
sourceLocation = os.path.abspath(os.path.join(fileLocation, 'RCWA/source/'))
nkLocation = os.path.abspath(os.path... | 35.833333 | 78 | 0.765891 | [
"MIT"
] | FelixSCT/rcwa | context.py | 645 | Python |
# -*- coding: utf-8 -*-
from operator import attrgetter
from pyangbind.lib.yangtypes import RestrictedPrecisionDecimalType
from pyangbind.lib.yangtypes import RestrictedClassType
from pyangbind.lib.yangtypes import TypedListType
from pyangbind.lib.yangtypes import YANGBool
from pyangbind.lib.yangtypes import YANGListTy... | 38.756 | 338 | 0.618846 | [
"Apache-2.0"
] | ABitMoreDepth/napalm-yang | napalm_yang/models/openconfig/interfaces/interface/subinterfaces/subinterface/ipv4/unnumbered/interface_ref/config/__init__.py | 9,689 | Python |
#
# Copyright 2020 The FATE 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.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable ... | 33.423841 | 144 | 0.69467 | [
"Apache-2.0"
] | cold-code/FATE-Cloud | fate-manager/hyperion/entity/types.py | 5,047 | Python |
# testing/assertions.py
# Copyright (C) 2005-2021 the SQLAlchemy authors and contributors
# <see AUTHORS file>
#
# This module is part of SQLAlchemy and is released under
# the MIT License: http://www.opensource.org/licenses/mit-license.php
from __future__ import absolute_import
import contextlib
import re
import sys... | 30.965007 | 81 | 0.590299 | [
"MIT"
] | ai-mocap/sqlalchemy | lib/sqlalchemy/testing/assertions.py | 23,007 | Python |
import collections
import datetime
from django.utils.translation import gettext_lazy as _
from .base import * # noqa
# Override static and media URL for prefix in WSGI server.
# https://code.djangoproject.com/ticket/25598
STATIC_URL = '/2016/static/'
MEDIA_URL = '/2016/media/'
CONFERENCE_DEFAULT_SLUG = 'pycontw... | 25.192308 | 58 | 0.674809 | [
"MIT"
] | DoubleTakoMeat/pycon.tw | src/pycontw2016/settings/production/pycontw2016.py | 655 | Python |
"""llvm
Tool-specific initialization for LLVM
"""
#
# Copyright (c) 2009 VMware, Inc.
#
# 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 ... | 45.384615 | 128 | 0.598844 | [
"MIT"
] | VincentWei/mg-mesa3d | scons/llvm.py | 12,980 | Python |
#!/usr/bin/env python
# In this example we show the use of the
# vtkBandedPolyDataContourFilter. This filter creates separate,
# constant colored bands for a range of scalar values. Each band is
# bounded by two scalar values, and the cell data lying within the
# value has the same cell scalar value.
import vtk
from... | 28.546667 | 72 | 0.79262 | [
"BSD-3-Clause"
] | Armand0s/VTK | Examples/VisualizationAlgorithms/Python/BandContourTerrain.py | 4,282 | Python |
# Copyright 2017 Google LLC.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# 1. Redistributions of source code must retain the above copyright notice,
# this list of conditions and the following disclaimer.
#
#... | 43.432049 | 80 | 0.600738 | [
"BSD-3-Clause"
] | FrogEnthusiast7/deepvariant | deeptrio/variant_caller_test.py | 21,412 | Python |
#!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates.
# All rights reserved.
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.
import enum
from typing import Dict
@enum.unique
class EmbOptimType(enum.Enum):
SGD =... | 27.59 | 86 | 0.594418 | [
"BSD-3-Clause"
] | 842974287/FBGEMM | fbgemm_gpu/fbgemm_gpu/split_embedding_configs.py | 2,759 | Python |
"""
Builder for web assembly
"""
import subprocess
import sys
from SCons.Script import AlwaysBuild, Default, DefaultEnvironment
try:
subprocess.check_output(["em++", "--version"])
except FileNotFoundError:
print(
"Could not find emscripten. Maybe install it? (e.g. `brew install emscripten` on macO... | 17.512195 | 167 | 0.66156 | [
"MIT"
] | johnboiles/platformio-platform-wasm | builder/main.py | 718 | Python |
#!/usr/bin/env python
# coding=utf-8
# Copyright 2020 The HuggingFace Inc. team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LI... | 44.514925 | 119 | 0.666639 | [
"Apache-2.0"
] | MarcelWilnicki/transformers | examples/pytorch/text-classification/run_glue.py | 23,860 | Python |
import tensorflow as tf
import math as m
from rec_errors import euclidean_norm_squared
def silverman_rule_of_thumb(N: int):
return tf.pow(4/(3*N), 0.4)
def cw_1d(X, y=None):
def N0(mean, variance):
return 1.0/(tf.sqrt(2.0 * m.pi * variance)) * tf.exp((-(mean**2))/(2*variance))
N = tf.cast(tf.s... | 32.685714 | 117 | 0.558275 | [
"MIT"
] | gmum/cwae | src/cw.py | 3,432 | Python |
from tkinter import *
#Palomo, Nemuel Rico O.
class ButtonLab:
def __init__(self, window):
self.color = Button(window, text='Color', fg='red', bg='blue')
self.button = Button(window, text='<---Click to change the color of the button :)', fg='black', command=self.changeColor)
self... | 19.774194 | 130 | 0.613377 | [
"Apache-2.0"
] | nemuelpalomo/OOP--58002 | Lab (The Coders) #5.py | 613 | Python |
# BEGIN GENERATED CONTENT (do not edit below this line)
# This content is generated by ./gengl.py.
# Wrapper for /usr/include/GL/glx.h
from OpenGL import platform, constant
from ctypes import *
c_void = None
# H (/usr/include/GL/glx.h:26)
GLX_VERSION_1_1 = constant.Constant( 'GLX_VERSION_1_1', 1 )
GLX_VERSION_1_2 = ... | 43.576456 | 189 | 0.734286 | [
"BSD-2-Clause"
] | frederica07/Dragon_Programming_Process | PyOpenGL-3.0.2/OpenGL/raw/_GLX.py | 35,907 | Python |
#!/usr/bin/python3
import gameinstance
from colour import Colour
from constants import Constants
from vec2 import vec2
from misc import Fade
import sdl2
import hud
class Menu(gameinstance.GameInstance):
"""Game menu representation."""
# Variables to control menu background.
backgrounds = []
current_bg = 0
bg_o... | 31.145455 | 109 | 0.718622 | [
"MIT"
] | marax27/pyNoid | menu.py | 3,426 | Python |
from .config import *
import MySQLdb
class DBReader:
def __init__(self):
self.conn = None
self.db = None
# Initalize the connection
self.db = MySQLdb.connect(user=DB_USER, passwd=DB_PASS, db=DB_NAME, host=DB_HOST,
port=DB_PORT)
if self.db ==... | 47.508671 | 116 | 0.576956 | [
"BSD-3-Clause"
] | dmnugu4755642434/killerbee | killerbee/dblog.py | 8,219 | Python |
import asyncio
from pyrogram.types import Message
from tronx import app
from tronx.helpers import (
gen,
)
app.CMD_HELP.update(
{"spam" : (
"spam",
{
"spam [number] [text]" : "You Know The Use Of This Command.",
"dspam [delay] [count] [msg]" : "Delay spam use it to spam with a delay between spamming m... | 20.976744 | 96 | 0.636364 | [
"MIT"
] | JayPatel1314/Tron | tronx/modules/spam.py | 1,804 | Python |
from keras.preprocessing.image import img_to_array
import imutils
import cv2
from keras.models import load_model
import numpy as np
import geocoder
import streamlink
#import mysql.connector as con
#mydb = con.connect(
# host="localhost",
# user="yourusername",
# passwd="yourpassword",
# database="mydatabase"
#)
#my... | 36.405405 | 169 | 0.600346 | [
"BSD-3-Clause"
] | ActuarialIntelligence/Base | src/ActuarialIntelligence.Infrastructure.PythonScripts/StreamFootageAnalyse.py | 4,041 | Python |
from collections import namedtuple
from datetime import datetime
import pprint
import pickle
import json
import sqlite3
BUILDINGS = ['AGNEW', 'LARNA', 'AJ E', 'AJPAV', 'AQUAC', 'AA', 'ADRF', 'ARMRY', 'ART C', 'BEEF', 'BFH', 'BRNCH', 'PRC', 'BURCH', 'BUR', 'CAM', 'CARNA', 'CAM M', 'CAPRI', 'CSB', 'LIBR', 'COL', 'CMMID... | 97.848101 | 2,933 | 0.66119 | [
"MIT"
] | branw/campus-cuckoo | scraper/processor.py | 7,730 | Python |
import glob
import argparse
import os
import shutil
"""
This module helps to filter only the images
that have binary masks within a dataset
"""
if __name__ == '__main__':
# Parse command line arguments
parser = argparse.ArgumentParser(
description='Filter masked data from dataset')
parser.add... | 27.8 | 78 | 0.630396 | [
"MIT"
] | Tubaher/grapes_project | samples/uvas/utils/filter_with_mask.py | 1,112 | Python |
"""GoldenTimes URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.11/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
Clas... | 35.35 | 91 | 0.719236 | [
"BSD-3-Clause"
] | liuxue0905/GoldenTimes | GoldenTimes/urls.py | 1,414 | Python |
import sys
##print ("This is the name of the script: ", sys.argv[0])
##print ("Number of arguments: ", len(sys.argv))
##print ("The arguments are: " , str(sys.argv))
lemmas = []
lemmas_cleaned = []
nums = ['1','2','3','4','5','6','7','8','9','0']
alphabet = ['a','b','c','d','e','f','g','h','i','j','k','k','l','m','n',... | 36.142857 | 167 | 0.477132 | [
"MIT"
] | tykniess/muspilli | dictionaries/archives/dict_scrape.py | 1,785 | Python |
"""
mbed SDK
Copyright (c) 2011-2016 ARM Limited
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in wr... | 38.458333 | 101 | 0.635676 | [
"Apache-2.0"
] | SaiVK/BenchIoT | os-lib/mbed-os/tools/build_api.py | 54,457 | Python |
"""
Django settings for berlapan project.
Generated by 'django-admin startproject' using Django 3.2.7.
For more information on this file, see
https://docs.djangoproject.com/en/3.2/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/3.2/ref/settings/
"""
import os
f... | 26.839779 | 106 | 0.70914 | [
"Unlicense"
] | rafiatha09/berlapan | berlapan/settings.py | 4,858 | Python |
from random import randint
import unicornhat as unicorn
def run(params):
width,height=unicorn.get_shape()
while True:
x = randint(0, (width-1))
y = randint(0, (height-1))
r = randint(0, 255)
g = randint(0, 255)
b = randint(0, 255)
unicorn.set_pixel(x, y, r, g,... | 21.625 | 40 | 0.563584 | [
"MIT"
] | kfechter/unicorn-remote | app/programs/original/random_sparkles.py | 346 | Python |
'''Faça um programa que leia o sexo de uma pessoa, mas só aceite os valores ‘M’ ou ‘F’.Caso esteja errado, peça
a digitação novamente até ter um valor correto.'''
sexo = str(input('Informe seu sexo: [M/F] ')).strip().upper()[0]
while sexo not in 'MmFf':
sexo = str(input('Dados inválidos. Por favor, informe seu sexo... | 50 | 111 | 0.6875 | [
"MIT"
] | Roberto-Sartore/Python | exercicios/PythonExercicios/ex057.py | 415 | Python |
import typing
import sys
import numpy as np
def set_val(
a: np.array,
i: int,
x: int,
) -> typing.NoReturn:
while i < a.size:
a[i] = max(a[i], x)
i += i & -i
def get_mx(
a: np.array,
i: int,
) -> int:
mx = 0
while i > 0:
mx = max(mx, a[i])
i -= i & -i
return mx
def solve(
... | 13.7375 | 31 | 0.535032 | [
"MIT"
] | kagemeka/competitive-programming | src/atcoder/dp/q/sol_4.py | 1,099 | Python |
""" Solver classes for domain adaptation experiments
"""
__author__ = "Steffen Schneider"
__email__ = "steffen.schneider@tum.de"
import os, time
import pandas as pd
import numpy as np
from tqdm import tqdm
import torch
import torch.utils.data
import torch.nn as nn
from .. import Solver, BaseClassSolver
from ... ... | 26.602273 | 95 | 0.629645 | [
"MPL-2.0"
] | artix41/salad | salad/solver/da/base.py | 2,341 | Python |
# -------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License (MIT). See LICENSE in the repo root for license information.
# ----------------------------------------------------------------------... | 42.093023 | 113 | 0.593923 | [
"MIT"
] | Biological-Computation/station-b-libraries | PyStationB/projects/CellSignalling/slow_tests/simulation/test_cellsig_tutorials.py | 1,810 | Python |
# Solution to Problem 8
# Program outputs today's date and time in the format "Monday, January 10th 2019 at 1:15pm"
# To start we import the Python datetime module as dt.
from datetime import datetime as dt
#now equals the date and time now.
now = dt.now()
# Copied verbatim initially from stacoverflow Reference 1 bel... | 67.869565 | 276 | 0.726457 | [
"Apache-2.0"
] | LauraBrogan/pands-problem-set-2019 | solution-8.py | 1,563 | Python |
import math
import chainer
import chainer.functions as F
import chainer.links as L
import numpy as np
from .sn_convolution_2d import SNConvolution2D, SNDeconvolution2D
from .sn_linear import SNLinear
def _upsample(x):
h, w = x.shape[2:]
return F.unpooling_2d(x, 2, outsize=(h * 2, w * 2))
def _downsample(x):
... | 39.899204 | 134 | 0.582103 | [
"MIT"
] | VirtualOilCake/Deep_VoiceChanger | nets/block.py | 15,042 | Python |
estado = dict()
brasil = list()
for c in range(0,3):
estado['uf'] = str(input('Uf: '))
estado['sigla'] = str(input('Sigla: '))
brasil.append(estado.copy())
print(brasil)
for e in brasil:
for k, v in e.items():
print(f'O campo {k} tem valor {v}')
| 22.583333 | 43 | 0.571956 | [
"MIT"
] | Kauan677/Projetos-Python | Python/Dicionarios.py | 271 | Python |
#
# Copyright (c) YugaByte, 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 required by applicable law or agreed to in writing, s... | 26.299492 | 99 | 0.663192 | [
"Apache-2.0"
] | everyonce/yugabyte-db | thirdparty/build_definitions/__init__.py | 5,181 | Python |
#
# cbpro/order_book.py
# David Caseria
#
# Live order book updated from the Coinbase Websocket Feed
from sortedcontainers import SortedDict
from decimal import Decimal
import pickle
from cbpro.public_client import PublicClient
from cbpro.websocket_client import WebsocketClient
class OrderBook(WebsocketClient):
... | 32.036789 | 119 | 0.524167 | [
"MIT"
] | 1M15M3/coinbasepro-python | cbpro/order_book.py | 9,579 | Python |
import json
import boto3
import os
from helper import AwsHelper
import time
def startJob(bucketName, objectName, itemId, snsTopic, snsRole, apiName):
print("Starting job with itemId: {}, bucketName: {}, objectName: {}".format(itemId, bucketName, objectName))
response = None
client = AwsHelper().getClient... | 28.02974 | 112 | 0.516844 | [
"MIT-0"
] | aspi92/amazon-rekognition-serverless-large-scale-image-and-video-processing | rekognition-pipeline/lambda/asyncprocessor/lambda_function.py | 7,540 | Python |
# coding: utf-8
"""
Laserfiche API
Welcome to the Laserfiche API Swagger Playground. You can try out any of our API calls against your live Laserfiche Cloud account. Visit the developer center for more details: <a href=\"https://developer.laserfiche.com\">https://developer.laserfiche.com</a><p><strong>Build# ... | 36.217391 | 314 | 0.653716 | [
"BSD-2-Clause"
] | Layer8Err/laserfiche-api | laserfiche_api/models/watermark.py | 9,163 | Python |
#!/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-02-23 19:25:39
# @Email: code@oscaresteban.es
# @Last Modified by: oesteban
# @Last Modifie... | 31.078292 | 89 | 0.620749 | [
"Apache-2.0"
] | amakropoulos/structural-pipeline-measures | packages/structural_dhcp_mriqc/structural_dhcp_mriqc/qc/functional.py | 8,733 | Python |
#!/usr/bin/env python
"""Django's command-line utility for administrative tasks."""
import os
import sys
def main():
"""Run administrative tasks."""
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'tutotrial.settings')
try:
from django.core.management import execute_from_command_line
except Im... | 28.913043 | 73 | 0.679699 | [
"BSD-3-Clause"
] | aiueocode/djangorest | tutorial/manage.py | 665 | Python |
import os
from dominate import document
import dominate.tags as tags
import shlex
import subprocess as sp
from tqdm.auto import tqdm
style = (
"""
#myInput {
background-image: url('/css/searchicon.png'); /* Add a search icon to input */
background-position: 10px 12px; /* Position the search icon */
background-re... | 32.224638 | 98 | 0.54756 | [
"MIT"
] | shane-breeze/zdb-analysis | zdb/drawing/generate_html.py | 4,447 | Python |
import torch
import torch.nn.functional as F
import argparse
import cv2
import numpy as np
from glob import glob
import matplotlib.pyplot as plt
num_classes = 2
img_height, img_width = 64, 64#572, 572
out_height, out_width = 64, 64#388, 388
GPU = False
torch.manual_seed(0)
class Mynet(torch.nn.Module):
def __ini... | 30.979592 | 80 | 0.656126 | [
"MIT"
] | skn047/DeepLearningMugenKnock | Question_semaseg/my_answers/bin_loss_pytorch.py | 1,518 | Python |
# -*- coding: utf-8 -*-
"""
celery.result
~~~~~~~~~~~~~
Task results/state and groups of results.
"""
from __future__ import absolute_import
import time
import warnings
from collections import deque
from contextlib import contextmanager
from copy import copy
from kombu.utils import cached_property
from... | 30.976139 | 79 | 0.591071 | [
"MIT"
] | CharleyFarley/ovvio | venv/lib/python2.7/site-packages/celery/result.py | 28,560 | Python |
from django.views.generic import (
ListView,
DetailView,
CreateView,
UpdateView,
DeleteView,
)
from django.urls import reverse_lazy
from .models import Pokemon
class PokemonListView(ListView):
template_name = "pages/pokemon_list.html"
model = Pokemon
class PokemonDetailView(DetailView):
... | 25.545455 | 47 | 0.725979 | [
"MIT"
] | danieldills/pokemon-django | pokemon/views.py | 843 | Python |
import tensorflow as tf
from tensorflow.keras.models import Model
import pandas as pd
import matplotlib.pyplot as plt
import os
import logging
from .common import create_directories
def get_prepared_model(stage: str, no_classes: int, input_shape: list, loss: str, optimizer: str, metrics: list) -> \
Model:
... | 40.217054 | 117 | 0.680802 | [
"MIT"
] | iDataAstro/MNIST_CLASSIFICATION | src/utils/model.py | 5,188 | Python |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
**Project Name:** MakeHuman
**Product Home Page:** http://www.makehumancommunity.org/
**Github Code Home Page:** https://github.com/makehumancommunity/
**Authors:** Thomas Larsson, Jonas Hauquier
**Copyright(c):** MakeHuman Team 2001-2019
*... | 32.69967 | 127 | 0.495458 | [
"MIT"
] | Phantori/Radiian-Arts-BioSource | makehuman-master/makehuman/plugins/9_export_collada/dae_geometry.py | 9,908 | Python |
# Copyright (c) MONAI Consortium
# 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, so... | 37.202247 | 117 | 0.657807 | [
"Apache-2.0"
] | Borda/MONAI | tests/test_dataloader.py | 3,311 | Python |
# qubit number=5
# total number=45
import cirq
import qiskit
from qiskit import QuantumCircuit, QuantumRegister, ClassicalRegister
from qiskit import BasicAer, execute, transpile
from pprint import pprint
from qiskit.test.mock import FakeVigo
from math import log2,floor, sqrt, pi
import numpy as np
import networkx as ... | 30.901515 | 82 | 0.602844 | [
"BSD-3-Clause"
] | UCLA-SEAL/QDiff | benchmark/startQiskit1005.py | 4,079 | Python |
#from mq import *
import sys, time
import urllib3
#networking library
import json
try:
print("Press CTRL+C to abort.")
#mq = MQ();
while True:
http = urllib3.PoolManager()
#perc = mq.MQPercentage()
sys.stdout.write("\r")
sys.stdout.write("\033[K")
data = {
... | 25.65625 | 93 | 0.544458 | [
"Apache-2.0"
] | haziquehaikal/smartdb | hardware/testing/fusecontrol.py | 821 | Python |
import pytest
from mitmproxy.contentviews import protobuf
from . import full_eval
datadir = "mitmproxy/contentviews/test_protobuf_data/"
def test_view_protobuf_request(tdata):
v = full_eval(protobuf.ViewProtobuf())
p = tdata.path(datadir + "protobuf01")
with open(p, "rb") as f:
raw = f.read()
... | 28.483871 | 76 | 0.670442 | [
"MIT"
] | 0x7c48/mitmproxy | test/mitmproxy/contentviews/test_protobuf.py | 883 | Python |
import click
from ...runner import events
from . import default
def handle_after_execution(context: events.ExecutionContext, event: events.AfterExecution) -> None:
context.endpoints_processed += 1
default.display_execution_result(context, event)
if context.endpoints_processed == event.schema.endpoints_co... | 36.285714 | 99 | 0.748031 | [
"MIT"
] | RonnyPfannschmidt/schemathesis | src/schemathesis/cli/output/short.py | 1,016 | Python |
from ..utils import sortkey, capitalize_first
FIGURE_TEX_TEMPLATE = r'\hwgraphic{{{path}}}{{{headword}}}{{{attribution}}}'
# change to {filename} if you want to specify full paths.
FIGURE_PATH_TEMPLATE = r'figures/ill-{filename}'
class Image(object):
type = 'img'
def sk(self):
return sortkey(self.hw... | 27.8125 | 76 | 0.622472 | [
"MIT"
] | redmer/sfm2latex | sfm2latex/dictionary/Image.py | 890 | Python |
# ##### BEGIN GPL LICENSE BLOCK #####
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distrib... | 30.22043 | 82 | 0.62053 | [
"MIT"
] | calculusrobotics/RNNs-for-Bayesian-State-Estimation | Blender 2.91/2.91/scripts/addons/space_view3d_math_vis/utils.py | 5,621 | Python |
from django_unicorn.components import QuerySetType, UnicornView
from example.coffee.models import Flavor, Taste
class AddFlavorView(UnicornView):
is_adding = False
flavors = None
flavor_qty = 1
flavor_id = None
def __init__(self, *args, **kwargs):
super().__init__(**kwargs) # calling supe... | 24.853659 | 67 | 0.60157 | [
"MIT"
] | Franziskhan/django-unicorn | example/unicorn/components/add_flavor.py | 1,019 | Python |
""" Measure stent migration relative to renals
Option to visualize 2 longitudinal scans
"""
import sys, os
import visvis as vv
from stentseg.utils.datahandling import select_dir, loadvol, loadmodel, loadmesh
from stentseg.stentdirect.stentgraph import create_mesh
from stentseg.utils.visualization import show_ctvolume
f... | 40.776316 | 136 | 0.713994 | [
"BSD-3-Clause"
] | almarklein/stentseg | lspeas/analysis/stent_migration.py | 9,297 | Python |
"""
Django settings for my_site project.
Generated by 'django-admin startproject' using Django 1.11.29.
For more information on this file, see
https://docs.djangoproject.com/en/1.11/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.11/ref/settings/
"""
import o... | 25.57037 | 91 | 0.702202 | [
"MIT"
] | garylwatson/mysteamlist | my_site/settings.py | 3,452 | Python |
import py
from pypy.rlib.rsdl import RSDL
from pypy.rlib.rarithmetic import r_uint
from pypy.rpython.lltypesystem import rffi
def test_sdl_init():
assert RSDL.Init(RSDL.INIT_VIDEO) >= 0
RSDL.Quit()
def test_surface_basic():
assert RSDL.Init(RSDL.INIT_VIDEO) >= 0
surface = RSDL.CreateRGBSurface(0, 150... | 29.918919 | 55 | 0.591689 | [
"MIT"
] | benoitc/pypy | pypy/rlib/rsdl/test/test_basic.py | 1,107 | Python |
import os
import sys
cwd = os.getcwd()
sys.path.append(cwd)
import time, math
import numpy as np
from pnc.interface import Interface
from config.manipulator_config import ManipulatorConfig
from pnc.robot_system.pinocchio_robot_system import PinocchioRobotSystem
class ManipulatorInterface(Interface):
def __init_... | 32.09434 | 77 | 0.662551 | [
"MIT"
] | junhyeokahn/ASE389 | pnc/manipulator_pnc/manipulator_interface.py | 1,701 | Python |
from __future__ import print_function, absolute_import
import argparse
import os.path as osp
import random
import numpy as np
import sys
import collections
import copy
import time
from datetime import timedelta
from sklearn.cluster import DBSCAN, KMeans
from sklearn.preprocessing import normalize
import torch
from to... | 39.464945 | 120 | 0.651426 | [
"MIT"
] | ZhaoChuyang/dgreid | examples/rsc_baseline.py | 10,695 | Python |
# Copyright 2016 Google Inc. All Rights Reserved.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agre... | 33.796117 | 80 | 0.747774 | [
"Apache-2.0"
] | airdeng/openhtf | openhtf/output/callbacks/__init__.py | 3,481 | Python |
# -*- coding: utf-8 -*-
# Copyright (c) 2019, 9T9IT and contributors
# For license information, please see license.txt
from __future__ import unicode_literals
import frappe
from frappe.model.document import Document
class CustomPurchaseReceiptItem(Document):
pass
| 24.272727 | 49 | 0.790262 | [
"MIT"
] | MdAlAmin-aol/optic_store | optic_store/optic_store/doctype/custom_purchase_receipt_item/custom_purchase_receipt_item.py | 267 | Python |
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
import random
import torch
import torchvision
from torchvision.transforms import functional as F
class Compose(object):
def __init__(self, transforms):
self.transforms = transforms
def __call__(self, image, target):
for ... | 28.72807 | 83 | 0.589618 | [
"BSD-2-Clause"
] | zhoulw13/FCOS | fcos_core/data/transforms/transforms.py | 3,275 | Python |
# -*- coding:utf-8 -*-
"""
FTX Trade module.
https://docs.ftx.com/
Project: alphahunter
Author: HJQuant
Description: Asynchronous driven quantitative trading framework
"""
import time
import zlib
import json
import copy
import hmac
import base64
from urllib.parse import urljoin
from collections import defaultdict, d... | 44.262048 | 912 | 0.571873 | [
"MIT"
] | a04512/alphahunter | quant/platform/ftx.py | 45,427 | Python |
import os
import matplotlib.pyplot as plt
plt.style.use("seaborn")
import numpy as np
from lib.utils import read_csv, find_cargo_root
from lib.blocking import block
data_folder = os.path.join(find_cargo_root(), "data")
save_folder = os.path.join(os.path.dirname(find_cargo_root()), "report", "assets")
if not os.path.is... | 43.266667 | 116 | 0.724191 | [
"MIT"
] | kmaasrud/vmc | vmc/result_analysis/E_vs_MCs.py | 1,298 | Python |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.12 on 2018-04-22 11:53
from __future__ import unicode_literals
import company.models
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
... | 38.969697 | 131 | 0.61353 | [
"MIT"
] | ksanchezcld/InvenTree | InvenTree/company/migrations/0001_initial.py | 1,286 | Python |
# Configuration file for the Sphinx documentation builder.
#
# This file only contains a selection of the most common options. For a full
# list see the documentation:
# http://www.sphinx-doc.org/en/master/config
# -- Path setup --------------------------------------------------------------
# If extensions (or module... | 36 | 88 | 0.672414 | [
"MIT"
] | dpeerlab/DoubletDetection | docs/conf.py | 2,088 | Python |
from collections import namedtuple
Kit = namedtuple('Kit', 'name clip_r1_5 clip_r1_3 clip_r2_5 clip_r2_3 is_directional')
_KITS = [
Kit("truseq", 8, 8, 8, 8, False),
Kit("accelngs", 10, 10, 19, 5, True),
Kit("nebemseq", 5, 5, 11, 5, True)
]
KITS = {x.name: x for x in _KITS}
SUPPORTED_KITS = {x.name for x... | 25.461538 | 86 | 0.655589 | [
"MIT"
] | ahmedelhosseiny/bcbio-nextgen | bcbio/wgbsseq/kits.py | 331 | Python |
"""
This module lets you experience the POWER of FUNCTIONS and PARAMETERS.
Authors: David Mutchler, Vibha Alangar, Matt Boutell, Dave Fisher,
Aaron Wilkin, their colleagues, and Morgan Brown.
""" # DONE: 1. PUT YOUR NAME IN THE ABOVE LINE.
import rosegraphics as rg
def main():
"""
Calls the other ... | 38.878173 | 79 | 0.58206 | [
"MIT"
] | brownme1/02-ObjectsFunctionsAndMethods | src/m5_why_parameters_are_powerful.py | 7,659 | Python |
"""
ETNA School API Wrapper
~~~~~~~~~~~~~~~~~~~~~~~
A python wrapper to help make python3 apps/bots using the ETNA API.
:copyright: (c) 2019 Yohann MARTIN
:license: MIT, see LICENSE for more details.
"""
__title__ = 'etnapy'
__author__ = 'Yohann MARTIN'
__license__ = 'MIT'
__version__ = "1.0.0"
from .user import Us... | 20.05 | 67 | 0.698254 | [
"MIT"
] | Astropilot/etnapy | etnapy/__init__.py | 401 | Python |
import pytest
import numpy as np
import random
from cem.backend import backend, NumpyBackend
try:
from cem.backend import CuPyBackend
import cupy as cp
skip_cupy_test = False
except ImportError:
skip_cupy_test = True
def test_numpy_backend():
X = random.randint(0, 10) * 10
Y = random.randint... | 28.355932 | 68 | 0.674836 | [
"MIT"
] | dantehustg/cem | tests/test_backend.py | 1,673 | Python |
""" compatibility OpenTimelineIO 0.12.0 and older
"""
import os
import re
import sys
import json
import opentimelineio as otio
from . import utils
import clique
self = sys.modules[__name__]
self.track_types = {
"video": otio.schema.TrackKind.Video,
"audio": otio.schema.TrackKind.Audio
}
self.project_fps = Non... | 32.489231 | 78 | 0.605834 | [
"MIT"
] | dangerstudios/OpenPype | openpype/hosts/resolve/otio/davinci_export.py | 10,559 | Python |
""" generators for the neuron project """
# general imports
import sys
import os
import zipfile
# third party imports
import numpy as np
import nibabel as nib
import scipy
import keras
from keras.utils import np_utils
from keras.models import Model
# local packages
import pynd.ndutils as nd
import pytools.patchlib ... | 37.097836 | 171 | 0.587676 | [
"MIT"
] | adriaan16/brainstorm | ext/neuron/neuron/generators.py | 39,435 | Python |
import fibra
import fibra.net
import fibra.event
import cPickle as pickle
import exceptions
import json
import time
import types
import zlib
schedule = fibra.schedule()
class NULL(object): pass
class Timeout(Exception): pass
class Disconnect(Exception): pass
class Connection(fibra.event.Connection):
COMPRE... | 32.264706 | 98 | 0.573154 | [
"Unlicense"
] | simonwittber/fibra | fibra/msg.py | 4,388 | Python |
from adminsortable2.admin import SortableAdminMixin
from decimal import Decimal
from django.contrib import admin
from django.contrib.gis import admin as geo_admin
from import_export import fields
from import_export import widgets
from import_export.admin import ImportExportModelAdmin
from import_export.resources import... | 23.951049 | 78 | 0.649635 | [
"MIT"
] | ACLARKNET/aclarknet-database | aclarknet/database/admin.py | 10,275 | Python |
from django.contrib.gis.geos import Point
from data_collection.management.commands import BaseXpressDemocracyClubCsvImporter
class Command(BaseXpressDemocracyClubCsvImporter):
council_id = "E07000146"
stations_name = "parl.2019-12-12/Version 1/west-norfolk.gov.uk-1572885849000-.tsv"
addresses_name = "parl... | 36.630435 | 87 | 0.654599 | [
"BSD-3-Clause"
] | alexdutton/UK-Polling-Stations | polling_stations/apps/data_collection/management/commands/import_kings_lynn.py | 1,685 | Python |
# -*- coding: utf-8 -*-
# Django settings for basic pinax project.
import os.path
import posixpath
import pinax
PINAX_ROOT = os.path.abspath(os.path.dirname(pinax.__file__))
PROJECT_ROOT = os.path.abspath(os.path.dirname(__file__))
# tells Pinax to use the default theme
PINAX_THEME = "default"
DEBUG = True
TEMPLATE... | 29.773585 | 122 | 0.71071 | [
"MIT"
] | amarandon/pinax | pinax/projects/basic_project/settings.py | 6,312 | Python |
"""Generates faucet config for given number of switches and number of devices per switch"""
import getopt
import sys
import yaml
from forch.utils import proto_dict
from forch.proto.faucet_configuration_pb2 import Interface, StackLink, Datapath, \
Vlan, FaucetConfig, LLDPBeacon, Stack
CORP_DP_ID = 273
T1_DP_ID_STA... | 39.414063 | 96 | 0.644896 | [
"Apache-2.0"
] | henry54809/forch | testing/python_lib/build_config.py | 10,090 | Python |
import logging
import yaml
from scanapi.config_loader import load_config_file
from scanapi.errors import (
BadConfigurationError,
EmptyConfigFileError,
InvalidKeyError,
InvalidPythonCodeError,
)
from scanapi.exit_code import ExitCode
from scanapi.reporter import Reporter
from scanapi.session import se... | 30.984848 | 78 | 0.706112 | [
"MIT"
] | hebertjulio/scanapi | scanapi/scan.py | 2,045 | Python |
print("\079") | 13 | 13 | 0.615385 | [
"MIT"
] | bpbpublications/TEST-YOUR-SKILLS-IN-PYTHON-LANGUAGE | Chapter 02/ch2_17.py | 13 | Python |
# Copyright 2017 The TensorFlow 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.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | 45.346639 | 80 | 0.668937 | [
"Apache-2.0"
] | 1911590204/models | research/object_detection/metrics/coco_tools.py | 43,170 | Python |
import os
from PySide2 import QtWidgets
from mapclientplugins.filechooserstep.ui_configuredialog import Ui_ConfigureDialog
INVALID_STYLE_SHEET = 'background-color: rgba(239, 0, 0, 50)'
DEFAULT_STYLE_SHEET = ''
class ConfigureDialog(QtWidgets.QDialog):
"""
Configure dialog to present the user with the optio... | 41.569231 | 115 | 0.65544 | [
"Apache-2.0"
] | mapclient-plugins/mapclientplugins.filechooserstep | mapclientplugins/filechooserstep/configuredialog.py | 5,404 | Python |
from problem import Problem
class DistinctPowers(Problem, name="Distinct powers", expected=9183):
@Problem.solution()
def brute_force(self):
# Good ol fashion set comprehension
return len({a ** b for a in range(2, 101) for b in range(2, 101)})
| 30 | 74 | 0.677778 | [
"MIT"
] | davisschenk/Project-Euler-Rewrite | problems/p029.py | 270 | Python |
import cv2
import sys
cwd = sys.path[0]
if __name__ == '__main__':
success = True
cap = cv2.VideoCapture(cwd + '/face.avi')
i = 0
while success:
success, img = cap.read()
cv2.imwrite(cwd + '/out/frame' + str(i) + '.jpg', img)
i = i + 1
| 17.5 | 62 | 0.539286 | [
"MIT"
] | yo1995/Daily_Python_Tasks | HLWD_opencv_py/dissect-video-to-img-sequence.py | 280 | Python |
# terrascript/data/mrcrilly/awx.py
# Automatically generated by tools/makecode.py (24-Sep-2021 15:12:44 UTC)
import terrascript
class awx_credential(terrascript.Data):
pass
class awx_credential_azure_key_vault(terrascript.Data):
pass
class awx_credentials(terrascript.Data):
pass
__all__ = [
"awx... | 17.26087 | 73 | 0.753149 | [
"BSD-2-Clause"
] | mjuenema/python-terrascript | terrascript/data/mrcrilly/awx.py | 397 | Python |
#
# (C) Copyright IBM Corp. 2019
#
# 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 writi... | 38.289855 | 117 | 0.671461 | [
"Apache-2.0"
] | class-euproject/lithops | pywren_ibm_cloud/libs/ibm_cloudfunctions/iam.py | 2,642 | Python |
# -*- coding: utf-8 -*-
# Copyright (C) 2008-2015, Luis Pedro Coelho <luis@luispedro.org>
# vim: set ts=4 sts=4 sw=4 expandtab smartindent:
#
# 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... | 29.727273 | 80 | 0.666389 | [
"MIT"
] | cumeadi/milk | milk/supervised/classifier.py | 3,597 | Python |
#!/usr/bin/env python
#
# __COPYRIGHT__
#
# 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 to use, copy, modify, merge, publish,
... | 30.034483 | 74 | 0.723766 | [
"MIT"
] | Boris-de/scons | test/TEX/subdir_variantdir_include2.py | 4,355 | Python |
from dataclasses import dataclass, field
from typing import Optional
__NAMESPACE__ = "AttrDecl/name"
@dataclass
class Root:
class Meta:
name = "root"
namespace = "AttrDecl/name"
value_00: Optional[int] = field(
default=None,
metadata={
"name": "ପ00",
"... | 21.598086 | 40 | 0.421799 | [
"MIT"
] | tefra/xsdata-w3c-tests | output/models/sun_data/attr_decl/ad_name/ad_name00104m/ad_name00104m10_xsd/ad_name00104m10.py | 4,570 | Python |
#!/usr/bin/env python
"""The setup script."""
from setuptools import find_packages, setup
with open('README.md') as readme_file:
readme = readme_file.read()
with open('HISTORY.rst') as history_file:
history = history_file.read()
with open('requirements.txt') as requirements_file:
requirements = require... | 28.741935 | 74 | 0.645903 | [
"CC0-1.0"
] | scotthavens/pysnobal | setup.py | 1,782 | Python |
# Copyright (c) 2011 Sam Rushing
"""ECC secp256k1 OpenSSL wrapper.
WARNING: This module does not mlock() secrets; your private keys may end up on
disk in swap! Use with caution!
This file is modified from python-bitcoinlib.
"""
import ctypes
import ctypes.util
import hashlib
import sys
ssl = ctypes.cdll.LoadLibrary... | 36.480687 | 130 | 0.688235 | [
"MIT"
] | Alonewolf-123/AmbankCoin-Core | test/functional/test_framework/key.py | 8,500 | Python |
# -*- coding: utf-8 -*-
import errno
import os
import re
import hashlib
import tempfile
import sys
import shutil
import logging
import click
import crayons
import delegator
import parse
import requests
import six
import stat
import warnings
try:
from weakref import finalize
except ImportError:
try:
fro... | 33.712393 | 116 | 0.586711 | [
"MIT"
] | bryant1410/pipenv | pipenv/utils.py | 43,253 | Python |
from ui import *
startUI()
# # - read the input data:
# import MnistLoader
# training_data, validation_data, test_data = MnistLoader.load_data_wrapper()
# training_data = list(training_data)
# # ---------------------
... | 10.374194 | 113 | 0.631219 | [
"MIT"
] | YuriyAksenov/ImageRecognition | Test.py | 1,744 | Python |
#!/usr/bin/env python
import unittest
from math import pi # , isnan
from random import random
import gemmi
from gemmi import Position, UnitCell
class TestMath(unittest.TestCase):
def test_SMat33_transformed_by(self):
tensor = gemmi.SMat33f(random(), random(), random(),
rand... | 46.045113 | 80 | 0.601241 | [
"MPL-2.0",
"MPL-2.0-no-copyleft-exception"
] | ConorFWild/gemmi_pandda | tests/test_unitcell.py | 6,124 | Python |
# Coyright 2017-2019 Nativepython Authors
#
# 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 ... | 38.916667 | 102 | 0.774625 | [
"Apache-2.0"
] | szymonlipinski/nativepython | typed_python/__init__.py | 1,868 | Python |
# coding=utf-8
# Copyright 2020 The TensorFlow Datasets Authors.
#
# 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 appl... | 35.253247 | 105 | 0.675447 | [
"Apache-2.0"
] | Ak0303/datasets | tensorflow_datasets/text/reddit_disentanglement.py | 5,429 | Python |
"""Copyright (c) 2005-2017, University of Oxford.
All rights reserved.
University of Oxford means the Chancellor, Masters and Scholars of the
University of Oxford, having an administrative office at Wellington
Square, Oxford OX1 2JD, UK.
This file is part of Chaste.
Redistribution and use in source and binary forms,... | 49.387003 | 143 | 0.647885 | [
"Apache-2.0",
"BSD-3-Clause"
] | gonayl/Chaste | python/pycml/processors.py | 50,918 | Python |
#!/usr/bin/env python
#
# Run wasm benchmarks in various configurations and report the times.
# Run with -h for help.
#
# Note: this is a copy of wasm-bench.py adapted for d8.
#
# In the default mode which is "turbofan+liftoff", runs a single shell with
# `--no-wasm-tier-up --liftoff` and `--no-wasm-tier-up --no-liftof... | 40.00831 | 119 | 0.574742 | [
"MIT"
] | julian-seward1/embenchen | asm_v_wasm/wasm_bench-d8.py | 14,443 | Python |
from django.db.backends.postgresql.base import DatabaseWrapper as PostgresqlDatabaseWrapper
from db.backends.postgresql.creation import DatabaseCreation
from db.backends.postgresql.schema import DatabaseSchemaEditor
class DatabaseWrapper(PostgresqlDatabaseWrapper):
creation_class = DatabaseCreation
SchemaEdi... | 35.2 | 91 | 0.863636 | [
"Apache-2.0"
] | aaxelb/SHARE | db/backends/postgresql/base.py | 352 | Python |
from typing import Dict, List, Any
import numpy as np
import cv2
from vcap import (
DetectionNode,
DETECTION_NODE_TYPE,
OPTION_TYPE,
BaseStreamState,
BaseBackend,
rect_to_coords)
from vcap_utils import (
BaseOpenVINOBackend,
)
SOS_INDEX = 0
EOS_INDEX = 1
MAX_SEQ_LEN = 28
ALPHABET = ' 012... | 37 | 79 | 0.592479 | [
"BSD-3-Clause"
] | aotuai/capsule-zoo | capsules/detector_text_openvino/backend.py | 4,255 | Python |
import dlib
from termcolor import colored
from face_cropper.core import DLIB_FACE_DETECTING_MIN_SCORE
def detect(image: str, verbose: bool = False):
"""Detects faces on a given image using dlib and returns matches.
:param image: Path to access the image to be searched
:type image: [string]
:param ve... | 30.692308 | 70 | 0.691729 | [
"MIT"
] | Dave-Lopper/face_cropper | face_cropper/core/detector.py | 1,197 | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.