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 |
|---|---|---|---|---|---|---|---|---|
#!/usr/bin/python3
"""
Summary
-------
This application simulates showers to be used in trigger rate calculations.
Arrays with one (1MST) or four telescopes (4LST) can be used, in case of \
mono or stereo trigger configurations, respectively.
Simulations are managed by the shower_simulator mod... | 34.779141 | 88 | 0.646499 | [
"BSD-3-Clause"
] | RaulRPrado/ctamclib | applications/sim_showers_for_trigger_rates.py | 5,669 | Python |
# Test various AP mode parameters
# Copyright (c) 2014, Qualcomm Atheros, Inc.
#
# This software may be distributed under the terms of the BSD license.
# See README for more details.
from remotehost import remote_compatible
import logging
logger = logging.getLogger()
import os
import struct
import subprocess
import ti... | 39.516548 | 84 | 0.62119 | [
"Unlicense"
] | AreedAhmed/fragattacks | tests/hwsim/test_ap_params.py | 33,431 | Python |
import unittest
import sys
sys.path.insert(1, '..')
import easy_gui
class GUI(easy_gui.EasyGUI):
def __init__(self, **kwargs):
self.add_widget(type='button', text='Button1', command_func=lambda e: print('Button1 working!'))
self.test_lbl = self.add_widget(type='label', text='Here\'s an awesome la... | 25.823529 | 104 | 0.650342 | [
"MIT"
] | zachbateman/easy_gui | tests/test_wm_attributes.py | 878 | Python |
# -*- coding: utf-8 -*-
#
# This file is part of BridgeDB, a Tor bridge distribution system.
#
# :authors: Isis Lovecruft 0xA3ADB67A2CDB8B35 <isis@torproject.org>
# please also see AUTHORS file
# :copyright: (c) 2013, Isis Lovecruft
# (c) 2007-2013, The Tor Project, Inc.
# (c) 2007-201... | 34.081633 | 76 | 0.678743 | [
"BSD-3-Clause-Clear"
] | gsathya/bridgedb | lib/bridgedb/test/test_persistentSaveAndLoad.py | 3,340 | Python |
'''
Implements the targetcli target related UI.
This file is part of targetcli.
Copyright (c) 2011-2013 by Datera, 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/lic... | 34.629684 | 96 | 0.575927 | [
"Apache-2.0"
] | JonnyJD/targetcli | targetcli/ui_target.py | 47,131 | Python |
"""
Django settings for the Sphinx documentation builder.
All configuration is imported from :mod:`backend.settings` except it sets :attr:`USE_I18N` to ``False`` to make sure
the documentation is not partially translated.
For more information on this file, see :doc:`topics/settings`.
For the full list of settings and ... | 38.85 | 116 | 0.773488 | [
"Apache-2.0"
] | Integreat/integreat-cms | src/backend/sphinx_settings.py | 779 | Python |
# Copyright (c) 2018 Uber Technologies, 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 ... | 35.111111 | 86 | 0.641727 | [
"Apache-2.0"
] | masrouge/vertica-python | vertica_python/tests/test_unicode.py | 4,424 | Python |
import pygame # Tested with pygame v1.9.6
from UIControls import Button
from constants import *
import numpy as np
import random
import time
import os
from nodes import bfs_node
import sys
import threading
###############################################
# Globals
###############################################
init... | 33.792049 | 93 | 0.462081 | [
"MIT"
] | James-P-D/Maze | src/MazePy/MazePy/MazePy.py | 22,100 | Python |
# Pyrogram - Telegram MTProto API Client Library for Python
# Copyright (C) 2017-2021 Dan <https://github.com/delivrance>
#
# This file is part of Pyrogram.
#
# Pyrogram is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published
# by the Free... | 29.88 | 103 | 0.621151 | [
"Apache-2.0"
] | appheap/social-media-analyzer | backend/pyrogram/raw/types/bank_card_open_url.py | 2,241 | Python |
# coding=utf-8
# *** WARNING: this file was generated by the Pulumi SDK Generator. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union
from ... import _utilities, _tables
from... | 37.074627 | 186 | 0.714171 | [
"Apache-2.0"
] | pulumi-bot/pulumi-azure-native | sdk/python/pulumi_azure_native/containerservice/v20200301/list_managed_cluster_admin_credentials.py | 2,484 | Python |
from typing import List, Tuple
from ....source_shared.base import Base
from ....utilities.byte_io_mdl import ByteIO
class StudioTrivert(Base):
def __init__(self):
self.vertex_index = 0
self.normal_index = 0
self.uv = []
def read(self, reader: ByteIO):
self.vertex_index = read... | 30.263158 | 71 | 0.624348 | [
"MIT"
] | syborg64/SourceIO | goldsrc/mdl_v6/structs/mesh.py | 1,150 | Python |
"""
===================================
Demo of OPTICS clustering algorithm
===================================
.. currentmodule:: sklearn
Finds core samples of high density and expands clusters from them.
This example uses data that is generated so that the clusters have
different densities.
The :class:`~cluster.OPT... | 35.495146 | 79 | 0.64442 | [
"BSD-3-Clause"
] | sourcery-ai-bot/scikit-learn | examples/cluster/plot_optics.py | 3,656 | Python |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
'''
Author : Heethesh Vhavle
Email : heethesh@cmu.edu
Version : 1.0.0
Date : Apr 08, 2019
'''
import random
import rospy
from delta_perception.msg import VehicleGroundTruth, VehicleGroundTruthArray
random_vehicles = ['car', 'truck', 'bus', 'motorbike', 'bicycle']
... | 32.539683 | 97 | 0.638049 | [
"BSD-3-Clause"
] | deltaautonomy/delta_perception | test/vehicle_ground_truth_publisher_test.py | 2,050 | Python |
# Test some Unicode file name semantics
# We dont test many operations on files other than
# that their names can be used with Unicode characters.
import os, glob, time, shutil
import unicodedata
import unittest
from test.support import (run_unittest, rmtree, change_cwd,
TESTFN_ENCODING, TESTFN_UNICODE, TESTFN_UNE... | 42.25 | 84 | 0.651564 | [
"ISC"
] | Et7f3/cosmopolitan | third_party/python/Lib/test/test_unicode_file.py | 5,915 | Python |
# coding: utf-8
"""
Isilon SDK
Isilon SDK - Language bindings for the OneFS API # noqa: E501
OpenAPI spec version: 9
Contact: sdk@isilon.com
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
import pprint
import re # noqa: F401
import six
class CreateFilepoolPolicyRespon... | 26.844828 | 88 | 0.556519 | [
"Unlicense"
] | Isilon/isilon_sdk_python | isi_sdk_8_2_2/isi_sdk_8_2_2/models/create_filepool_policy_response.py | 3,114 | Python |
# This is your project's main settings file that can be committed to your
# repo. If you need to override a setting locally, use settings_local.py
from funfactory.settings_base import *
# Bundles is a dictionary of two dictionaries, css and js, which list css files
# and js files that can be bundled together by the m... | 27.255435 | 79 | 0.622134 | [
"BSD-3-Clause"
] | Mozilla-GitHub-Standards/b6a5bb5c98b18d87c72c770f29c4270008fc6fc6b787d531a2afcd382dc4cbad | settings/base.py | 5,015 | Python |
import pandas as pd
import csv
import numpy as np
from tensorflow.keras import Sequential, Model
from tensorflow.keras.layers import Dense, Concatenate, Input, Conv1D, MaxPooling1D, Flatten, Dropout, GlobalAveragePooling1D
from tensorflow.keras.callbacks import EarlyStopping
from sklearn.preprocessing import StandardSc... | 47.587983 | 144 | 0.648449 | [
"Apache-2.0"
] | lmluzern/MultiOpenCrowd | src/feature_based/multiclass_opencrowd/nn_em.py | 11,088 | Python |
import pyaf.Bench.TS_datasets as tsds
import pyaf.tests.artificial.process_artificial_dataset as art
art.process_dataset(N = 128 , FREQ = 'D', seed = 0, trendtype = "MovingMedian", cycle_length = 0, transform = "Difference", sigma = 0.0, exog_count = 0, ar_order = 0); | 38.857143 | 167 | 0.735294 | [
"BSD-3-Clause"
] | jmabry/pyaf | tests/artificial/transf_Difference/trend_MovingMedian/cycle_0/ar_/test_artificial_128_Difference_MovingMedian_0__0.py | 272 | Python |
import sys
import unicodedata
from PIL import Image, ImageDraw, ImageFont
args = sys.argv
if len(args) < 2:
print("usage:", args[0], "message")
sys.exit()
text = args[1]
if len(text) < 1:
print("usage:", args[0], "message")
sys.exit()
def get_east_asian_width_count(text):
count = 0
for c in text:
if ... | 20.8 | 48 | 0.666209 | [
"Apache-2.0"
] | kitazaki/LED_Badge | message.py | 728 | Python |
from corehq.sql_db.connections import get_db_alias_or_none, ICDS_UCR_CITUS_ENGINE_ID
def get_icds_ucr_citus_db_alias():
return get_db_alias_or_none(ICDS_UCR_CITUS_ENGINE_ID)
| 30 | 84 | 0.872222 | [
"BSD-3-Clause"
] | dungeonmaster51/commcare-hq | custom/icds_reports/utils/connections.py | 180 | Python |
class ElasticEase(EasingFunctionBase,ISealable,IEasingFunction):
"""
Represents an easing function that creates an animation that resembles a spring oscillating back and forth until it comes to rest.
ElasticEase()
"""
def CloneCore(self,*args):
"""
CloneCore(self: Freezable,sourceFreezable: Freez... | 26.304498 | 215 | 0.71889 | [
"MIT"
] | BCSharp/ironpython-stubs | release/stubs.min/System/Windows/Media/Animation_parts/ElasticEase.py | 7,602 | Python |
import itertools
import logging
import re
import time
import urllib
from collections import defaultdict
from datetime import datetime, timedelta, timezone
from decimal import Decimal
from typing import Any, Callable, Dict, List, Optional, Sequence, Set, Tuple, Type, Union
from urllib.parse import urlencode
import pytz... | 33.818999 | 134 | 0.611778 | [
"Apache-2.0"
] | ArunSankarKs/zulip | analytics/views.py | 60,164 | Python |
# Postgres' `clone_schema` adapted to work with schema names containing
# capital letters or `-`
# Source: IdanDavidi, https://stackoverflow.com/a/48732283/6412017
from django.db import connection, transaction, ProgrammingError
CLONE_SCHEMA_FUNCTION = """
-- Function: clone_schema(text, text)
-- DROP FUNCTION clone_... | 29.892704 | 152 | 0.618378 | [
"MIT"
] | geekashu/django-tenants | django_tenants/clone.py | 6,965 | Python |
# coding: utf-8
"""
Titan API v1
# Introduction The Intel 471 API is organized around the principles of REST. Our API lets you gather results from our platform with anything that can send a HTTP request, including cURL and modern internet browsers. Access to this API requires an API token which is managed fro... | 46.877095 | 5,526 | 0.673877 | [
"MIT"
] | intel471/titan-client-python | titan_client/models/credential_set_schema_data.py | 16,784 | Python |
#!/bin/python3
# Copyright (C) 2020 Matheus Fernandes Bigolin <mfrdrbigolin@disroot.org>
# SPDX-License-Identifier: MIT
"""Day Thirteen, Shuttle Search."""
from sys import argv
from re import findall
from utils import open_file, arrange, usage_and_exit, product
def solve1(buses, est):
"""Get the earliest bus... | 28.277778 | 74 | 0.664047 | [
"MIT"
] | mfrdbigolin/AoC2020 | src/day13.py | 1,527 | Python |
"""Plot power curves for turbine 1 with data filters
"""
# import libraries
import pandas as pd
import numpy as np
import itertools
import matplotlib.pyplot as plt
# import data
df = pd.read_csv('data/SCADA_downtime_merged.csv', skip_blank_lines=True)
# list of turbines to plot (just 1)
list1 = [1]
# list of catego... | 32.381818 | 76 | 0.576642 | [
"MIT"
] | nmstreethran/WindTurbineClassification | scripts/plot/powercurves-filter-T1.py | 5,343 | Python |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Fri Dec 28 15:05:36 2018
@author: louismueller
"""
# import
import numpy as np
#%%
def PlotOverview(oData):
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
# Overview Plots
# Find interesting stuff: takeoff, landi... | 28.020101 | 102 | 0.601506 | [
"MIT"
] | UASLab/OpenFlightAnalysis | Core/OpenData.py | 5,576 | Python |
import sys, os
imgdir = sys.argv[1]
outfile = sys.argv[2]
flag = int(sys.argv[3])
fn = open(outfile, 'w')
fn.write("<html>\n")
fn.write("<body>\n")
namelist = os.listdir(imgdir)
namelist = sorted(namelist)
for idx, name in enumerate(namelist):
#if idx > 10:
# break
if flag:
imname = "office1_%d.j... | 26.230769 | 71 | 0.595308 | [
"Apache-2.0"
] | NicoleWang/retina_tiny | gen_view_html.py | 682 | Python |
# coding=utf-8
# Copyright 2021 The Tensor2Robot 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 ... | 30.972973 | 74 | 0.729494 | [
"Apache-2.0"
] | StanislavParovoy/tensor2robot | research/vrgripper/mse_decoder.py | 1,146 | Python |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'mods.ui'
#
# Created: Sun Oct 12 21:39:36 2014
# by: PyQt5 UI code generator 5.3.2
#
# WARNING! All changes made in this file will be lost!
from PyQt5 import QtCore, QtGui, QtWidgets
class Ui_ModsDialog(object):
def setupUi(self,... | 58.493827 | 119 | 0.748417 | [
"BSD-3-Clause"
] | cadnano/cadnano2.5 | cadnano/gui/dialogs/ui_mods.py | 4,738 | Python |
#!/usr/bin/env python
#
# ---- VGRID ----
# A Class for Incremental Gridding
#
# Val Schmidt
# Center for Coastal and Ocean Mapping
# Univeristy of New Hampshire
# Copyright, 2018-2019
# All Rights Reserved
import numpy as np
from line_profiler import LineProfiler
import sys
import scipy.spatial as spatial
from matpl... | 40.2208 | 154 | 0.559153 | [
"BSD-2-Clause"
] | valschmidt/vgrid | VGRID/vgrid.py | 25,138 | Python |
import pandas as pd
import io
import dropbox
import streamlit as st
TOKEN = st.secrets["TOKEN"]
dbx = dropbox.Dropbox(TOKEN)
def read_dbx_file(file):
print('Getting latest file')
_, f = dbx.files_download(file)
with io.BytesIO(f.content) as stream:
df = pd.read_csv(stream, index_col=0)... | 22.466667 | 46 | 0.673591 | [
"MIT"
] | greenrock21/test | dbox_aux.py | 337 | Python |
# -*- coding: utf-8 -*-
import tensorflow as tf
INPUT_NODE = 784
OUTPUT_NODE = 10
# 28 (edge) * 28
IMAGE_SIZE = 28
# 黑白
NUM_CHANNELS = 1
NUM_LABELS = 10
CONV1_DEEP = 32
# 过滤器尺寸
CONV1_SIZE = 5
CONV2_DEEP = 64
CONV2_SIZE = 5
# num of Fully connected nodes
FC_SIZE = 512
# def get_weight_variable(shape, regularizer):
... | 32.477612 | 100 | 0.610064 | [
"MIT"
] | Banyc/TensorFlow_practice | mnist/LeNet-5/mnist_inference.py | 4,570 | Python |
##
# 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, software
# distributed u... | 42.846154 | 75 | 0.746858 | [
"Apache-2.0"
] | AnthonyTruchet/cylon | python/pycylon/pycylon/common/__init__.py | 557 | Python |
from setuptools import setup
setup(name='gaedevhelper',
version='0.1.0.dev',
description='A lovely command-line helper for developing GAE applications',
url='https://github.com/devjoe/gae-dev-helper',
author='devjoe',
author_email='excusemejoe@gmail.com',
license='MIT',
packag... | 28.555556 | 105 | 0.574578 | [
"MIT"
] | devjoe/gae-dev-helper | setup.py | 771 | Python |
valor100= (mediadia-100)*taxa+(diaria*dias)
mediadia=km//dias
diaria=90
taxa=12
carro=str('você deseja alugar um carro? ').upper()
if carro=='SIM':
dias=int(input('quantos dias você deseja ficar com o carro'))
km=int(input('quantos km tem sua viagem?'))
if mediadia<=100 :
print('o valor a ser pago é... | 31.727273 | 65 | 0.670487 | [
"MIT"
] | MiguelTeixeiraUFPB/PythonM2 | algoritmos/PythonM2/locadora.py | 352 | Python |
"""Support for interface with an Samsung TV."""
import asyncio
from datetime import timedelta
import logging
import socket
import voluptuous as vol
from homeassistant.components.media_player import (
MediaPlayerDevice, PLATFORM_SCHEMA)
from homeassistant.components.media_player.const import (
MEDIA_TYPE_CHANN... | 33.079038 | 77 | 0.622689 | [
"Apache-2.0"
] | MagicalTrev89/home-assistant | homeassistant/components/samsungtv/media_player.py | 9,626 | Python |
#!/usr/bin/env python
"""Django's command-line utility for administrative tasks."""
import os
import sys
def main():
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'everpro.settings')
try:
from django.core.management import execute_from_command_line
except ImportError as exc:
raise Import... | 28.5 | 73 | 0.682616 | [
"Apache-2.0"
] | Ascensiony/EverPro-Intelligence-APIs | backend/everpro/manage.py | 627 | 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 a... | 33.056818 | 74 | 0.53111 | [
"MIT"
] | AlexBulankou/dm-logbook-sample | templates/container_vm.py | 2,909 | Python |
"""Data handling by server or instance."""
import json
import urllib3
class DataHandler(object):
"""Handle data."""
def __init__(self, server_port=None):
"""Initialize.
:param server_port: Int. local port.
"""
self.server_port = server_port
self.logged_requests = {}
... | 32.393939 | 75 | 0.518553 | [
"BSD-3-Clause"
] | danpozmanter/monitor_requests | monitor_requests/data.py | 3,207 | Python |
from django.db import models
from django.contrib.auth.models import (
BaseUserManager, AbstractBaseUser, Group
)
from phonenumber_field.modelfields import PhoneNumberField
# For the signal
from django.dispatch import receiver
from django.urls import reverse
from django.core.mail import send_mail
from dja... | 28.579832 | 91 | 0.638048 | [
"MIT"
] | PavelescuVictor/DentalApplication | dentalapp-backend/dentalapp/userauth/models.py | 3,401 | Python |
# Copyright 2015 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 a... | 37.132743 | 80 | 0.63632 | [
"Apache-2.0"
] | DougFirErickson/tensorflow | tensorflow/python/kernel_tests/matmul_op_test.py | 8,392 | Python |
#!/usr/bin/env python
# Copyright 2016 Vijayaditya Peddinti.
# 2016 Vimal Manohar
# Apache 2.0.
""" This script is similar to steps/nnet3/train_dnn.py but trains a
raw neural network instead of an acoustic model.
"""
from __future__ import print_function
from __future__ import division
import argpars... | 44.631086 | 98 | 0.593253 | [
"Apache-2.0"
] | iezhanqingran/kaldi | egs/wsj/s5/steps/nnet3/train_raw_dnn.py | 23,833 | Python |
#!/usr/bin/env python
# Script for grading performance.
# Performance is graded by comparing the student's best wall-clock time
# (not speedup) after running the code in 64, 128, and 240 thread
# configurations for bfs, kbfs, pagerank, and graph decomp against the
# reference solution.
import re
import subprocess
imp... | 27.014493 | 77 | 0.621781 | [
"MIT"
] | eric-haibin-lin/15418-asst3 | jobs/grade_performance.py | 1,864 | Python |
"""
Test module for Strava API reader base module
"""
import os
import json
import pytest
from pandas import DataFrame, Timedelta, Timestamp
from runpandas import read_strava
from runpandas import types
from stravalib.protocol import ApiV3
from stravalib.client import Client
from stravalib.model import Stream
pytestm... | 34.933649 | 90 | 0.66124 | [
"MIT"
] | bitner/runpandas | runpandas/tests/test_strava_parser.py | 7,371 | Python |
from flask import g
from app.comm.CompositeOperate import CompositeOperate
from app.comm.SqlExecute import SqlExecute
from app.module_config import table_module_map
class CommentController(CompositeOperate):
def __init__(self, module):
super(CommentController, self).__init__(module)
def after_deal_get... | 39.076923 | 102 | 0.664042 | [
"MIT"
] | szhu9903/flask-react-blog | blog_server/app/api/general/CommentController.py | 1,600 | Python |
#!/usr/bin/env python3
# Copyright (c) 2014-2016 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test RPCs related to blockchainstate.
Test the following RPCs:
- getblockchaininfo
- gettxouts... | 39.286624 | 168 | 0.657669 | [
"MIT"
] | nunumichael/xazab | test/functional/rpc_blockchain.py | 12,336 | Python |
# Copyright The PyTorch Lightning team.
#
# 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 i... | 42.773585 | 111 | 0.763564 | [
"Apache-2.0"
] | Borda/pytorch-lightning | tests/utilities/test_deepspeed_collate_checkpoint.py | 2,267 | Python |
"""meiduo URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/2.2/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: path('', views.home, name='home')
Class-based ... | 49.416667 | 95 | 0.699831 | [
"MIT"
] | physili/django_test | meiduo/meiduo/apps/users/urls.py | 1,779 | Python |
compression_methods = ['']
_blosc_methods = ['blosc-blosclz', 'blosc-lz4']
try:
import blosc
HAVE_BLOSC = True
compression_methods.extend(_blosc_methods)
except ImportError:
HAVE_BLOSC = False
def compress(data, method, *args, **kwds):
if method == '':
return data
_check_method(metho... | 25.409091 | 100 | 0.634168 | [
"BSD-3-Clause"
] | Cocococo11/pyacq | pyacq/core/stream/compression.py | 1,118 | Python |
import pygame
# TODO: make these configurable
c_UP = pygame.K_UP
c_DOWN = pygame.K_DOWN
c_LEFT = pygame.K_LEFT
c_RIGHT = pygame.K_RIGHT
c_PREV = pygame.K_LEFTBRACKET
c_NEXT = pygame.K_RIGHTBRACKET
c_START = pygame.K_RETURN
c_1 = pygame.K_1
c_2 = pygame.K_2
c_3 = pygame.K_3
c_4 = pygame.K_4
c_5 = pygame.K_5
c_6 = py... | 17.025641 | 41 | 0.740964 | [
"MIT"
] | byackley/critter | ceControl.py | 664 | Python |
import argparse
import cv2
import numpy as np
from onnxruntime.quantization import quantize_static, CalibrationDataReader, QuantType
from onnxruntime.quantization.calibrate import CalibrationMethod
from onnxruntime.quantization.quant_utils import QuantFormat
from dataset import pre_process_vgg
def parse_args():
... | 32.988095 | 130 | 0.709491 | [
"Apache-2.0"
] | ctuning/inference_results_v1.1 | closed/FuriosaAI/code/quantization/mlperf_evaluation/python/ort_quantization.py | 2,771 | Python |
# -*- coding: utf-8 -*-
import logging
from dbaas_dbmonitor.provider import DBMonitorProvider
from workflow.steps.util.base import BaseInstanceStep
LOG = logging.getLogger(__name__)
class DBMonitorStep(BaseInstanceStep):
def __init__(self, instance):
super(DBMonitorStep, self).__init__(instance)
... | 27.194444 | 75 | 0.677732 | [
"BSD-3-Clause"
] | AyushBherwani1998/database-as-a-service | dbaas/workflow/steps/util/db_monitor.py | 3,916 | Python |
import os
from dataclasses import dataclass, field
from enum import Enum
from typing import Any, Optional
from yarl import URL
@dataclass(frozen=True)
class ServerConfig:
host: str = "0.0.0.0"
port: int = 8080
name: str = "Docker Registry"
@dataclass(frozen=True)
class AuthConfig:
server_endpoint_u... | 34.096447 | 123 | 0.647611 | [
"Apache-2.0"
] | neuro-inc/platform-registry-api | platform_registry_api/config.py | 6,717 | Python |
# Copyright 1997 - 2018 by IXIA Keysight
#
# 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, p... | 32.296875 | 145 | 0.745525 | [
"MIT"
] | kakkotetsu/IxNetwork | RestPy/ixnetwork_restpy/testplatform/sessions/ixnetwork/vport/protocols/openflow/writeactionsmisslearnedinfo.py | 4,134 | Python |
# -*- coding: utf-8 -*-
''' Globals variables '''
# ##################################################################################
# MG ILLUMINATION #
# First Crazy Debroussailleur : jDepoortere #
# Author : cPO... | 27.043478 | 84 | 0.618167 | [
"MIT"
] | vincseize/MG | __InK__connect.py | 2,488 | Python |
import re
import discord
from discord.ext import commands
from discord.ext.commands import clean_content
from Util import Configuration, GearbotLogging, Permissioncheckers, Translator, Utils
INVITE_MATCHER = re.compile(r"(?:https?:\/\/)?(?:www\.)?(?:discord\.(?:gg|io|me|li)|discordapp\.com\/invite)\/([\w|\d|-]+)", f... | 41.230769 | 197 | 0.629198 | [
"MIT"
] | Gh0stlyy/GearBot | GearBot/Cogs/Censor.py | 2,144 | Python |
from .base import MixinBase
from .cool_nameable import CoolNameable
from .filterable import Filterable
from .hashable import Hashable
from .identifiable import Identifiable
from .labelable import Labelable
from .loggable import Loggable
from .pathable import Pathable
from .serialisable import Serialisable
from .taggabl... | 21.2 | 39 | 0.737736 | [
"MIT"
] | octue/octue-sdk-python | octue/mixins/__init__.py | 530 | Python |
from typing import Optional
import click
from opta.layer import Layer
@click.command(hidden=True)
@click.option("-c", "--config", default="opta.yml", help="Opta config file.")
@click.option(
"-e",
"--env",
default=None,
help="The env to use when loading the config file",
show_default=True,
)
def... | 21.578947 | 77 | 0.678049 | [
"Apache-2.0"
] | the-MuffinMan/opta | opta/commands/validate.py | 410 | Python |
#!/usr/bin/env python
"""
python list_bundles.py prod b6dc9b93-929a-45d0-beb2-5cf8e64872fe
python list_bundles.py staging 3b41f062-621c-46ca-abad-bce09427934d
"""
import argparse
import json
import logging
import sys
from ingest.api.ingestapi import IngestApi
logging.getLogger('ingest').setLevel(logging.DEBUG)
form... | 33.732143 | 101 | 0.704606 | [
"Apache-2.0"
] | HumanCellAtlas/ingest-common | list_bundles.py | 1,889 | Python |
# -*- coding: utf-8 -*-
"""
Code to take template spectra, used for RV fitting, and pass them through 4FS to resample them to 4MOST's resolution.
It then further resamples each arm onto a fixed logarithmic stride.
"""
import argparse
import hashlib
import logging
import numpy as np
import os
from os import path as os... | 45.387234 | 127 | 0.603975 | [
"MIT"
] | dcf21/4most-4gp | src/pythonModules/fourgp_rv/fourgp_rv/templates_resample.py | 10,666 | Python |
from django.shortcuts import render, HttpResponseRedirect, get_object_or_404
from cartapp.models import Cart
from mainapp.models import Product
from django.contrib.auth.decorators import login_required
@login_required
def view(request):
return render(request, 'cartapp/cart.html', context = {
'cart': Cart... | 27.3125 | 76 | 0.704805 | [
"MIT"
] | A1eksAwP/GB-Internet-Store | geekshop/cartapp/views.py | 1,311 | Python |
#!/usr/bin/env python
import sys
import os
sys.path.append(os.path.normpath(os.path.join(os.path.dirname(__file__), '../lib')))
import init
import config
import misc
from kzcashd import KZCashDaemon
from models import Superblock, Proposal, GovernanceObject, Watchdog
from models import VoteSignals, VoteOutcomes, Transie... | 33.040486 | 154 | 0.680799 | [
"MIT"
] | kzcashteam/sentinel | bin/sentinel.py | 8,161 | Python |
"""
"""
import numpy as np
from ..stellar_ages import _get_lg_age_bin_edges, _get_lgt_birth, T_BIRTH_MIN
from ..stellar_ages import _get_sfh_tables, _get_age_weights_from_tables
from ..sfh_model import DEFAULT_MAH_PARAMS, DEFAULT_MS_PARAMS, DEFAULT_Q_PARAMS
from ..utils import _jax_get_dt_array
FSPS_LG_AGES = np.aran... | 35.893617 | 86 | 0.753705 | [
"BSD-3-Clause"
] | ArgonneCPAC/dsps | dsps/tests/test_stellar_ages.py | 3,374 | Python |
# -*- coding: utf-8 -*-
"""
Created on Sun Mar 09 21:40:30 2014
@author: yyu
"""
import JBCWebAutomation as jbc
today=jbc.GetToday()
# to override the date: today='140305' in 'yymmdd' format
###################################################################
print 'Start job for date ' + today +'...'
jb... | 27.652174 | 68 | 0.599057 | [
"Apache-2.0"
] | yingweiy/jbc_task_automation | JBCMain-Chinese.py | 636 | Python |
from django.db.models.fields.json import JSONField
__all__ = ("CurrencyAmountField", "JSONField")
class CurrencyAmountField(JSONField):
pass
| 16.222222 | 50 | 0.787671 | [
"MIT"
] | dj-stripe/dj-paypal | src/djpaypal/fields.py | 146 | Python |
import numpy as np
from skmultiflow.drift_detection.base_drift_detector import BaseDriftDetector
class ADWIN(BaseDriftDetector):
""" Adaptive Windowing method for concept drift detection.
Parameters
----------
delta : float (default=0.002)
The delta parameter for the ADWIN algorithm.
No... | 31.131579 | 99 | 0.561949 | [
"BSD-3-Clause"
] | denisesato/scikit-multiflow | src/skmultiflow/drift_detection/adwin.py | 16,563 | Python |
from django.contrib import admin
from django.db import transaction
from zinc.models import Policy, PolicyMember
class PolicyMemberInline(admin.TabularInline):
readonly_fields = ('ip_enabled',)
model = PolicyMember
extra = 1
verbose_name = 'member'
verbose_name_plural = 'members'
def ip_enabl... | 36.530303 | 95 | 0.61883 | [
"Apache-2.0"
] | PressLabs/zinc | zinc/admin/policy.py | 2,411 | Python |
import os
import sys
import getopt
import re
import time
from datetime import datetime
use_cpu_utilization = True
url = "http://localhost:8086/status"
min_containers = 1
max_containers = 6
peer = "peer"
order = "order"
check_interval = 5
up_threshold = 85 if use_cpu_utilization else 20
down_threshold = 60 if use_cpu_... | 32.59375 | 109 | 0.56256 | [
"Apache-2.0"
] | wejdeneHaouari/blockbench | scripts/fabric-cpu.py | 4,172 | Python |
from django.shortcuts import render
from django.http import HttpResponse
from rango.models import Category
def index(request):
category_list = Category.objects.order_by('-likes')[:5]
context_dict = {}
context_dict['boldmessage'] = 'Crunchy, creamy, cookie, candy, cupcake!'
context_dict['categories'] =... | 34.375 | 93 | 0.715455 | [
"Apache-2.0"
] | Recol/Django-Tango | main/files/rango/views.py | 1,100 | Python |
import numpy as np
from math import cos, sin, atan2
from errors_exceptions import OpenRAVEException
from openravepy import quatFromAxisAngle, matrixFromPose, poseFromMatrix, \
axisAngleFromRotationMatrix, KinBody, GeometryType, RaveCreateRobot, \
RaveCreateKinBody, TriMesh, Environment, DOFAffine, IkParameterization, I... | 40.00369 | 142 | 0.595102 | [
"MIT"
] | Algorithmic-Alignment-Lab/OpenTAMP | opentamp/src/core/util_classes/no_openrave_body.py | 21,682 | Python |
# coding: utf-8
"""
Account API
The <b>Account API</b> gives sellers the ability to configure their eBay seller accounts, including the seller's policies (the Fulfillment Policy, Payment Policy, and Return Policy), opt in and out of eBay seller programs, configure sales tax tables, and get account information... | 33.734513 | 479 | 0.602833 | [
"MIT"
] | craiga/ebay_rest | src/ebay_rest/api/sell_account/models/rate_table_response.py | 3,812 | Python |
from setuptools import setup
import json
import glob
def readme():
with open('README.rst') as f:
return f.read()
def get_version():
with open('version.json') as json_file:
data = json.load(json_file)
if 'dev' in data:
return "{}.{}.{}-dev{}".format( data['major'], data['minor'], d... | 24.276596 | 97 | 0.595092 | [
"MIT"
] | olafsarnow/ecc | setup.py | 1,141 | Python |
import numpy as np
import sys, os, re, gzip, struct
import random
import h5py
import copy
from keras import backend as K
from keras.utils import Sequence
import keras.utils
import tensorflow as tf
import multi_utils
import mat_utils
class NbestFixedDataGenerator(Sequence):
def __init__(self, file, key_file, batch... | 46.411392 | 137 | 0.505387 | [
"Apache-2.0"
] | akio-kobayashi/lc_lstm | nbest_multi_fixed_generator.py | 7,333 | Python |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import os
import glob
import re
import sys
import urllib
import tarfile
import zipfile
import os.path as osp
from scipy.io import loadmat
import numpy as np
import h5py
from torchreid.utils.iotools import mkdi... | 40.61745 | 130 | 0.632022 | [
"MIT"
] | ArronHZG/ABD-Net | torchreid/datasets/dukemtmcvidreid.py | 6,052 | Python |
# Copyright (c) 2019 Eric Steinberger
import numpy as np
from PokerRL.rl.base_cls.workers.WorkerBase import WorkerBase
class EvaluatorMasterBase(WorkerBase):
"""
Baseclass to all Evaluators. An Evaluator is an algorithm to evaluate an agent's performance in a certain metric.
"""
def __init__(self,... | 43.873563 | 120 | 0.521352 | [
"MIT"
] | EricSteinberger/DREAM | PokerRL/eval/_/EvaluatorMasterBase.py | 7,634 | Python |
import pytest
from pytest_httpx import HTTPXMock
from coinpaprika_async import client as async_client, ResponseObject
client = async_client.Client()
@pytest.mark.asyncio
async def test_mock_async_price_conv(httpx_mock: HTTPXMock):
params = {"base_currency_id": "btc-bitcoin", "quote_currency_id": "usd-us-dollars... | 26.555556 | 103 | 0.700418 | [
"MIT"
] | DroidZed/coinpaprika-async-client | test/test_client.py | 1,195 | Python |
# setup.py file
from setuptools import find_packages, setup
with open("README.md", "r") as fh:
long_description = fh.read()
setup(
name="my-lambdata-dspt5", # the name that you will install via pip
version="1.0",
author="Devvin Kraatz",
author_email="devvnet97@gmai.com ",
description="Made... | 32.227273 | 122 | 0.700987 | [
"MIT"
] | jiobu1/DS-Unit-3-Sprint-1-Software-Engineering | module2-oop-code-style-and-reviews/lambdata_dspt5/setup.py | 709 | Python |
#! /usr/local/bin/python
# pylint: disable=invalid-name
# pylint: disable=missing-docstring
with open("table.txt", "r") as f:
print "projections = ("
lines = f.readlines()
units_list = []
for line in lines:
lineparts = line.rstrip().split("|")
epsg = lineparts[0]
wkt = linepart... | 29.481481 | 76 | 0.491834 | [
"MIT"
] | mbasanta/projective-detective | projection-scraping/parseSRS.py | 1,592 | Python |
# -*- coding: utf-8 -*-
# PLEASE DO NOT EDIT THIS FILE, IT IS GENERATED AND WILL BE OVERWRITTEN:
# https://github.com/ccxt/ccxt/blob/master/CONTRIBUTING.md#how-to-contribute-code
from ccxt.base.exchange import Exchange
# -----------------------------------------------------------------------------
try:
basestri... | 36.740061 | 126 | 0.462377 | [
"MIT"
] | 5747018167/ccxt | python/ccxt/coingi.py | 12,014 | Python |
# -*- coding: utf-8 -*-
import json
import copy
import types
import inspect
import re
import traceback
import datetime
import markdown2
import semver
import functools
import platform
###############################################################################
######################################################... | 31.305015 | 119 | 0.542243 | [
"Apache-2.0"
] | typeWorld/api | Lib/typeworld/api/__init__.py | 128,690 | Python |
import json
import datetime
import traceback
import re
from base64 import b64encode
from ast import literal_eval
from flask import Blueprint, render_template, render_template_string, make_response, url_for, current_app, request, redirect, jsonify, abort, flash, session
from flask_login import login_required, current_us... | 42.04381 | 161 | 0.543026 | [
"MIT"
] | CrazyForks/PowerDNS-Admin | powerdnsadmin/routes/admin.py | 82,532 | Python |
import torch
import numpy as np
from torch import nn
import torch.nn.functional as F
class Actor(nn.Module):
"""For advanced usage (how to customize the network), please refer to
:ref:`build_the_network`.
"""
def __init__(self, preprocess_net, action_shape, hidden_layer_size=128):
super().__i... | 33.881579 | 76 | 0.612816 | [
"MIT"
] | FightingSrain/tianshou | tianshou/utils/net/discrete.py | 2,575 | Python |
import datetime
import app
class Order:
def __init__(self, orderId, custId, orderDate, orderStatus, shipDate, creditCardNumber,
street, city, state, zipCode, emailAddress):
self.orderId = orderId
self.custId = custId
self.orderDate = orderDate
self.orderStatus = or... | 43.08 | 138 | 0.609099 | [
"Apache-2.0"
] | ShiftLeftSecurity/tarpit-python | app/model/Order.py | 1,077 | Python |
"""Fixer that changes raw_input(...) into input(...)."""
# Author: Andre Roberge
# Local imports
from .. import fixer_base
from ..fixer_util import Name
class FixRawInput(fixer_base.BaseFix):
BM_compatible = True
PATTERN = """
power< name='raw_input' trailer< '(' [any] ')' > any* >
... | 26.222222 | 70 | 0.582627 | [
"BSD-2-Clause"
] | 8bit-Dude/8bit-Unity | utils/py27/Lib/lib2to3/fixes/fix_raw_input.py | 472 | Python |
"""
This module is the commandline interface of bowl.
Created on 14 March 2014
@author: Charlie Lewis
"""
import argparse
from bowl.cli_opts import add
from bowl.cli_opts import connect
from bowl.cli_opts import delete
from bowl.cli_opts import disconnect
from bowl.cli_opts import grant
from bowl.cli_opts import host... | 52.581633 | 128 | 0.51799 | [
"Apache-2.0"
] | cglewis/bowl | bowl/cli.py | 25,765 | Python |
from flask import render_template, Blueprint, request, current_app
from flask_sqlalchemy import SQLAlchemy
# from QA_api import get_traintest_images
import QA_api
from QA_config import config
from QA_db import Image, Project, Job, Roi, get_latest_modelid, get_imagetable
html = Blueprint("html", __name__, static_folde... | 41.070175 | 135 | 0.686601 | [
"BSD-3-Clause-Clear"
] | cacof1/QuickAnnotator | QA_html.py | 7,023 | Python |
# -*- coding: utf-8 -*-
from django.core.cache import get_cache
from django.utils.functional import cached_property
from jinja2 import BytecodeCache as _BytecodeCache
class BytecodeCache(_BytecodeCache):
"""
A bytecode cache for Jinja2 that uses Django's caching framework.
"""
def __init__(self, cac... | 27.275862 | 69 | 0.680152 | [
"BSD-3-Clause"
] | centum/django-jinja | django_jinja/cache.py | 791 | Python |
from django.contrib import admin
from .transitions import TransactionLog, TransitionLog, EvaluationLog
# Register your models here.
admin.site.register(TransactionLog)
admin.site.register(TransitionLog)
admin.site.register(EvaluationLog) | 29.875 | 69 | 0.845188 | [
"MIT"
] | tira-io/tira | tira-application/src/tira/admin.py | 239 | Python |
from unittest import TestCase
from pyVHDLParser.Blocks.List import PortList
from pyVHDLParser.Blocks.List.PortList import PortListInterfaceSignalBlock
from pyVHDLParser.Token import WordToken, StartOfDocumentToken, SpaceToken, CharacterToken, EndOfDocumentToken
from... | 39.412844 | 177 | 0.51676 | [
"Apache-2.0"
] | JosephAbbey/pyVHDLParser | tests/unit/SimpleBlockSequences/PortList.py | 4,296 | Python |
# Future
from __future__ import division, print_function, unicode_literals
# Standard Library
import time
# Third Party
import pytest
import ratelimit
# DocumentCloud
from documentcloud.constants import RATE_LIMIT
from documentcloud.exceptions import APIError, CredentialsFailedError
# pylint: disable=protected-acce... | 29.377193 | 74 | 0.750672 | [
"MIT"
] | MuckRock/python-documentcloud | tests/test_client.py | 3,349 | Python |
# -*- coding: utf-8 -*-
"""
Esendex sms gateway backend. (http://www.esendex.es/)
Configuration example.
~~~~~~~~~~~~~~~~~~~~~~
Modify your settings.py::
ESENDEX_USERNAME = 'yourusername'
ESENDEX_PASSWORD = 'mysecretpassword'
ESENDEX_ACCOUNT = 'account-key-provided-by-esendex'
ESENDEX_SANDBOX = F... | 28.117647 | 83 | 0.600941 | [
"MIT"
] | codesankalp/django-sendsms | sendsms/backends/esendex.py | 3,824 | Python |
import torch
class FGM():
def __init__(self, model):
self.model = model
self.backup = {}
def attack(self, epsilon=1e-6, emb_name='embed'):
# emb_name这个参数要换成你模型中embedding的参数名
for name, param in self.model.named_parameters():
if param.requires_grad and emb_name in nam... | 36.56338 | 87 | 0.580123 | [
"Apache-2.0"
] | ksboy/adversarial_attack | modules.py | 2,716 | Python |
import unittest
import numpy as np
import numpy.testing as npt
import wisdem.drivetrainse.gearbox as gb
class TestGearbox(unittest.TestCase):
def setUp(self):
self.inputs = {}
self.outputs = {}
self.discrete_inputs = {}
self.discrete_outputs = {}
# 5MW inputs
self... | 44.893617 | 116 | 0.619076 | [
"Apache-2.0"
] | AthulKrishnaSundarrajan/WEIS | WISDEM/wisdem/test/test_drivetrainse/test_gearbox.py | 8,440 | Python |
# client-pypeln-pl.task.py
from aiohttp import ClientSession, TCPConnector
import asyncio
import sys
import pypeln as pl
limit = 1000
urls = ("http://localhost:8080/{}".format(i) for i in range(int(sys.argv[1])))
async def fetch(url, session):
async with session.get(url) as response:
return await respo... | 20.538462 | 85 | 0.702247 | [
"MIT"
] | Davidnet/pypeln | benchmarks/100_million_downloads/client-pypeln-io.py | 534 | Python |
from __future__ import annotations
import time
import disnake
from disnake.ext import commands
from PIL import Image
from main import tracked_templates
from utils.arguments_parser import MyParser
from utils.pxls.template_manager import (
Combo,
layer,
)
from utils.setup import stats
from utils.discord_utils i... | 32.549451 | 100 | 0.635719 | [
"MIT"
] | GrayTurtles/Clueless | src/cogs/pxls_template/layer.py | 2,968 | Python |
from __future__ import absolute_import
def cleanup():
from .models import MetadataType, MetadataSet
MetadataType.objects.all().delete()
MetadataSet.objects.all().delete()
| 20.666667 | 49 | 0.747312 | [
"Apache-2.0"
] | Dave360-crypto/mayan-edms | mayan/apps/metadata/cleanup.py | 186 | Python |
#!/usr/bin/env python
# encoding: utf-8
# Thomas Nagy, 2010
"cuda"
import os
from waflib import Task
from waflib.TaskGen import extension
from waflib.Tools import ccroot, c_preproc
from waflib.Configure import conf
class cuda(Task.Task):
run_str = '${NVCC} ${CUDAFLAGS} ${CXXFLAGS} ${FRAMEWORKPATH_ST:FRAMEWORKPATH} ... | 24.232143 | 162 | 0.699337 | [
"MIT"
] | eanswer/LearningToFly | Firmware/ardupilot/modules/waf/playground/cuda/cuda.py | 1,357 | Python |
#!/usr/bin/python
# -*- coding: utf-8 -*-
from django import template
from floreal import models as m
register = template.Library()
@register.filter
def price(f):
return u"%.02f€" % f
@register.filter
def price_nocurrency(f):
return u"%.02f" % f
@register.filter
def weight(w):
if w>=1: return u"%.2... | 19.555556 | 97 | 0.650568 | [
"MIT"
] | roco/circuit-court | floreal/templatetags/floreal_filters.py | 1,059 | Python |
# Copyright 2011 Justin Santa Barbara
# Copyright 2012 Hewlett-Packard Development Company, L.P.
#
# 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/lic... | 44.681208 | 78 | 0.624221 | [
"Apache-2.0"
] | jovial/ironic | ironic/tests/unit/common/test_utils.py | 26,630 | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.