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 List
import argparse
import chart_studio.plotly as py
import plotly.express as px
import pandas as pd
class TokyoCovid19Stat:
"""Holds Tokyo Covid-19 stat data."""
def __init__(self, csv_file_path: str = None):
self.csv_file_path = csv_file_path
self._df = None
self.... | 28.628866 | 82 | 0.593806 | [
"MIT"
] | kazush/tokyo_covid19_stat | stat_by_area.py | 2,777 | Python |
import os
import librosa.display as lbd
import matplotlib.pyplot as plt
import sounddevice
import soundfile
import torch
from InferenceInterfaces.InferenceArchitectures.InferenceHiFiGAN import HiFiGANGenerator
from InferenceInterfaces.InferenceArchitectures.InferenceTacotron2 import Tacotron2
from Preprocessing.TextF... | 44.793103 | 135 | 0.622274 | [
"Apache-2.0"
] | DigitalPhonetics/IMS-Toucan | InferenceInterfaces/Nancy_Tacotron2.py | 3,897 | Python |
# -*- coding: UTF-8 -*-
# Copyright 2002-2019 Rumma & Ko Ltd
# License: BSD (see file COPYING for details)
"""
See :ref:`lino` for non-technical documentation.
The :mod:`lino` package itself is the first plugin for all Lino
applications, added automatically to your :setting:`INSTALLED_APPS`. It defines
no models, but... | 25.670886 | 98 | 0.66716 | [
"BSD-2-Clause"
] | NewRGB/lino | lino/__init__.py | 4,056 | Python |
import decimal
from threading import local
from django.db import DEFAULT_DB_ALIAS
from django.db.backends import util
from django.utils import datetime_safe
from django.utils.importlib import import_module
class BaseDatabaseWrapper(local):
"""
Represents a database connection.
"""
ops = None
def ... | 35.82069 | 102 | 0.639632 | [
"BSD-3-Clause"
] | t11e/django | django/db/backends/__init__.py | 20,776 | Python |
import os
import subprocess
import requests
import re
import sys
esports_dir = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
sys.path.insert(0, esports_dir)
from utils import key, check_exists_other, analyze_subtitles
root_dir = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))... | 46.392857 | 163 | 0.537336 | [
"CC0-1.0"
] | mmcauliffe/corpus-creation-scripts | esports/valorant/scrape_game_changers.py | 3,897 | Python |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes ... | 39.074766 | 87 | 0.604162 | [
"MIT"
] | AlexanderYukhanov/azure-sdk-for-python | azure-cognitiveservices-search-visualsearch/azure/cognitiveservices/search/visualsearch/models/creative_work_py3.py | 4,181 | Python |
from fastapi import FastAPI, Request
from fastapi.responses import JSONResponse
class UnicornException(Exception):
def __init__(self, name: str):
self.name = name
app = FastAPI()
@app.exception_handler(UnicornException)
async def unicorn_exception_handler(request: Request, exc: UnicornException):
... | 24.076923 | 88 | 0.699681 | [
"MIT"
] | 0417taehyun/fastapi | docs_src/handling_errors/tutorial003.py | 626 | Python |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# This is very different to AboutModules in Ruby Koans
# Our AboutMultipleInheritance class is a little more comparable
#
from runner.koan import *
#
# Package hierarchy of Python Koans project:
#
# contemplate_koans.py
# koans/
# __init__.py
# about_asserts.py... | 31.942029 | 81 | 0.687387 | [
"MIT"
] | nitinnain/python_koans | python2/koans/about_packages.py | 2,204 | Python |
""" python site scraping tool """
import xml.etree.ElementTree as ET
from StringIO import StringIO
import unicodedata
import re
import requests
from BuildItParser import BuildItParser
def http_get(url):
""" simple wrapper around http get """
try:
request = requests.get(url)
# not concerned wi... | 35.532847 | 73 | 0.588537 | [
"MIT"
] | PhilipHarries/bi_scraper | scraper.py | 4,868 | Python |
from django.contrib.auth.decorators import permission_required
from django.conf import settings
from django.http import HttpResponse, HttpResponseRedirect, JsonResponse
from catalog import models as cmod
from django_mako_plus import view_function, jscontext
import requests
import json
# @permission_required('manager')
... | 33.108108 | 72 | 0.665306 | [
"Apache-2.0"
] | whitneyann/INTEX2 | catalog/views/search.py | 1,225 | Python |
import os
import scipy.misc as misc
import shutil
import cv2
import Constants
import numpy as np
from skimage import morphology
def extract_each_layer(image, threshold):
"""
This image processing funtion is designed for the OCT image post processing.
It can remove the small regions and find the OCT layer... | 34.22807 | 98 | 0.618145 | [
"Apache-2.0"
] | TobyLing/Comparative-Study-of-Deep-Learning-Models-for-Segmentation-of-Corpus-Callosum | image_utils.py | 1,951 | Python |
class ModelNotFoundException(Exception):
pass
class UnknownFunctionException(Exception):
pass
| 14.857143 | 42 | 0.788462 | [
"MIT"
] | paul-wolf/djaq | djaq/exceptions.py | 104 | Python |
# qubit number=3
# total number=31
import numpy as np
from qiskit import QuantumCircuit, execute, Aer, QuantumRegister, ClassicalRegister, transpile, BasicAer, IBMQ
from qiskit.visualization import plot_histogram
from typing import *
from pprint import pprint
from math import log2
from collections import Counter
from... | 29.99 | 140 | 0.631044 | [
"BSD-3-Clause"
] | UCLA-SEAL/QDiff | data/p3BR/R2/benchmark/startQiskit166.py | 5,998 | Python |
# -*- coding: utf-8 -*-
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
import json
import os
from urlparse import parse_qsl, urlparse
from django.conf import settings... | 41.935583 | 101 | 0.635238 | [
"MPL-2.0",
"MPL-2.0-no-copyleft-exception"
] | MozFux/bedrock | bedrock/firefox/tests/test_base.py | 41,020 | Python |
from tkinter import *
# import math
# https://www.youtube.com/watch?v=r5EQCSW_rLQ pyramid math formulas TIME=3:55
class Pyramid:
# contants
BLOCK_HEIGHT = 1.5 # meters
BLOCK_WIDTH = 2 # meters
BLOCK_LENGTH = 2.5 # meters
BLOCK_WEIGHT = 15000 # kg
# __init__ is Python's constructor method
... | 35.809322 | 123 | 0.681694 | [
"MIT"
] | justinclark-dev/CSC110 | assignments/assignment-2-pyramid-builder-gui.py | 8,472 | Python |
# This file is dual licensed under the terms of the Apache License, Version
# 2.0, and the BSD License. See the LICENSE file in the root of this repository
# for complete details.
import typing
from cryptography import x509
from cryptography.hazmat.primitives import serialization
from cryptography.hazmat.primitives.a... | 29.459091 | 79 | 0.632773 | [
"MIT"
] | ianmota/WebScrappingBimCollab | venv/Lib/site-packages/cryptography/hazmat/primitives/serialization/pkcs12.py | 6,481 | Python |
"""Classification Report"""
# Authors: Jeffrey Wang
# License: BSD 3 clause
import numpy as np
from sleepens.analysis import multiconfusion_matrix
def calculate_statistics(Y_hat, Y, beta=1, average=None):
"""
Calculate the precisions, recalls, F-beta scores, and
supports for each class in `targets`.
... | 32.051613 | 84 | 0.652979 | [
"BSD-3-Clause"
] | paradoxysm/sleepens | sleepens/analysis/_report.py | 4,968 | Python |
import numpy as np
try:
from cs231n.im2col_cython import col2im_cython, im2col_cython
from cs231n.im2col_cython import col2im_6d_cython
except ImportError:
print ('run the following from the cs231n directory and try again:')
print ('python setup.py build_ext --inplace')
print ('You may also need to restart yo... | 34.295203 | 83 | 0.689585 | [
"MIT"
] | anandsaha/cs231n.assignments | 2016winter/assignment2/cs231n/fast_layers.py | 9,294 | Python |
#-----------------------------------------------------------------------------
# Copyright (c) 2014, Ryan Volz
# All rights reserved.
#
# Distributed under the terms of the BSD 3-Clause ("BSD New") license.
#
# The full license is in the LICENSE file, distributed with this software.
#-----------------------------------... | 37.712446 | 96 | 0.589393 | [
"BSD-3-Clause"
] | ryanvolz/echolect | echolect/jicamarca/read_raw.py | 8,787 | Python |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon Mar 23 18:18:48 2020
@author: tsuyogbasnet
"""
import os
import sys
import pickle
from tqdm import tqdm
from scipy.io import wavfile
from python_speech_features import mfcc
from keras.models import load_model
import pandas as pd
from sklearn.metrics im... | 28.451613 | 97 | 0.597884 | [
"MIT"
] | pvsnp9/audio_classification_using_deep_learning | predict.py | 2,646 | Python |
# Copyright (c) 2009-2018 Stefan Marr <http://www.stefan-marr.de/>
#
# 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, cop... | 43.380165 | 88 | 0.658602 | [
"MIT"
] | Joshaa1999/ReBench | rebench/model/experiment.py | 5,249 | Python |
#!/usr/bin/env python3
"""
Copyright 2020 The Magma Authors.
This source code is licensed under the BSD-style license found in the
LICENSE file in the root directory of this source tree.
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BAS... | 31.852041 | 80 | 0.645363 | [
"BSD-3-Clause"
] | Rajpratik71/magma | lte/gateway/python/scripts/state_cli.py | 6,243 | Python |
'''
Created on May 11, 2017
@author: optas
'''
import numpy as np
import tensorflow as tf
from tflearn.layers.normalization import batch_normalization
from tflearn.layers.core import fully_connected, dropout
from . encoders_decoders import encoder_with_convs_and_symmetry, decoder_with_fc_only
from . tf_utils import ... | 40 | 150 | 0.717067 | [
"MIT"
] | 15034458181/latent_3d_points | src/generators_discriminators.py | 4,160 | Python |
s = "Ellis"
vowel_count = 0
i = 0
while i < len(s):
if s[i]in ('a', 'e', 'i', 'o', 'u')
vowel_count += 1
i += 1
print(vowel_count) | 11.5 | 36 | 0.514493 | [
"Unlicense"
] | EllisBarnes00/COP-1000 | Chapter 08 - More About Strings/MPL Extra Loops and Strings/51005.py | 138 | Python |
'''
07 - March 29, throughout a decade
Daylight Saving rules are complicated: they're different in different
places, they change over time, and they usually start on a Sunday (and
so they move around the calendar).
For example, in the United Kingdom, as of the time this lesson was written,
Daylight Saving begins o... | 31.666667 | 79 | 0.719079 | [
"MIT"
] | mohd-faizy/CAREER-TRACK-Data-Scientist-with-Python | 18_Working with Dates and Times in Python/03_Time Zones and Daylight Saving/07_March 29, throughout a decade.py | 1,520 | Python |
# Definition for a binary tree node.
class TreeNode:
def __init__(self, val=0, left=None, right=None):
self.val = val
self.left = left
self.right = right
class Solution:
def maxDepth(self, root: TreeNode) -> int:
if root is None:
return 0
return 1 + max(self... | 26.357143 | 75 | 0.612466 | [
"MIT"
] | anishLearnsToCode/leetcode-algorithms | python/maximum_depth_of_binary_tree.py | 369 | Python |
"""Add genres back
Revision ID: 1d393bb338a4
Revises: 126ecfb9a15e
Create Date: 2020-08-23 12:21:59.354200
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '1d393bb338a4'
down_revision = '126ecfb9a15e'
branch_labels = None
depends_on = None
def upgrade():
... | 23.241379 | 96 | 0.692878 | [
"MIT"
] | pavponn/fyyur | migrations/versions/1d393bb338a4_add_genres_back.py | 674 | Python |
import decimal
from graphene.types import Scalar
from graphql.language import ast
# See: https://github.com/graphql-python/graphene-django/issues/91#issuecomment-305542169
class Decimal(Scalar):
"""
The `Decimal` scalar type represents a python Decimal.
"""
@staticmethod
def serialize(dec):
... | 26.846154 | 89 | 0.669054 | [
"MIT"
] | abdulwahed-dev/travel-expense-manager | backend/backend/core/graphql/scalars.py | 698 | Python |
# Generated by Django 2.0.2 on 2018-02-24 04:48
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Food',
fields=[
('ndb_no', models.CharField... | 43.7 | 95 | 0.565217 | [
"MIT"
] | lukebiggerstaff/usda-food-viz | foodviz/search/migrations/0001_initial.py | 1,748 | Python |
class Solution:
def maxNumber(self, nums1, nums2, k):
"""
:type nums1: List[int]
:type nums2: List[int]
:type k: int
:rtype: List[int]
"""
def prep(nums, k):
dr = len(nums) - k # 要删除的数目
stay = [] # 保留的list
for num in ... | 24.931818 | 69 | 0.403829 | [
"MIT"
] | wisesky/LeetCode-Practice | src/321. Create Maximum Number.py | 1,191 | Python |
"""Misc. regolith tools.
"""
import email.utils
import os
import platform
import re
import sys
import time
from copy import deepcopy
from calendar import monthrange
from datetime import datetime, date, timedelta
from regolith.dates import month_to_int, date_to_float, get_dates
from regolith.sorters import doc_date_ke... | 29.21317 | 112 | 0.570162 | [
"CC0-1.0"
] | jc-umana/regolith | regolith/tools.py | 26,175 | Python |
"""
This module is for performance testing of EDA module in github action.
"""
from functools import partial
import pandas as pd
from typing import Any
from ...datasets import load_dataset
from ...eda import create_report
def report_func(df: pd.DataFrame, **kwargs: Any) -> None:
"""
Create report function, us... | 24.375 | 70 | 0.705983 | [
"MIT"
] | Bowen0729/dataprep | dataprep/tests/benchmarks/eda.py | 585 | Python |
async def donut_handler(args):
print('This is where we would configure things to properly handle a .donut file request.')
return '', ''
| 36 | 94 | 0.708333 | [
"Apache-2.0"
] | zaphodef/stockpile | app/donut.py | 144 | Python |
import time
import tensorflow as tf
physical_devices = tf.config.experimental.list_physical_devices('GPU')
if len(physical_devices) > 0:
tf.config.experimental.set_memory_growth(physical_devices[0], True)
from absl import app, flags, logging
from absl.flags import FLAGS
import core.utils as utils
from core.yolov4 i... | 42.449612 | 116 | 0.646092 | [
"MIT"
] | gaowei0518/tensorflow-yolov4-tflite | detectvideo.py | 5,476 | Python |
# Copyright 2019-2021 ETH Zurich and the DaCe authors. All rights reserved.
import math
import dace
import polybench
N = dace.symbol('N')
#datatypes = [dace.float64, dace.int32, dace.float32]
datatype = dace.float64
# Dataset sizes
sizes = [{N: 30}, {N: 90}, {N: 250}, {N: 1300}, {N: 2800}]
args = [([N, N], datatype... | 25.137931 | 115 | 0.508916 | [
"BSD-3-Clause"
] | Berke-Ates/dace | samples/polybench/gesummv.py | 1,458 | Python |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
# vim:fenc=utf-8
#
# Copyright © 2017 unga <giulioungaretti@me.com>
#
# Distributed under terms of the MIT license.
"""
Monitor a set of parameters in a background thread
stream output over websocket
To start monitor, run this file, or if qcodes is installed as a module:
... | 33.967509 | 89 | 0.610054 | [
"MIT"
] | Akshita07/Qcodes | qcodes/monitor/monitor.py | 9,410 | Python |
#!/usr/bin/env python3
# Copyright (c) 2019 The TradePlus_Coin developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
# -*- coding: utf-8 -*-
from io import BytesIO
from struct import pack
from random import randint, choice
im... | 46.678899 | 138 | 0.602201 | [
"MIT"
] | tdpsdevextreme/TradePlusCoin | test/functional/fake_stake/base_test.py | 20,352 | Python |
import asyncio
import sys
import pytest
from aws_lambda_powertools.event_handler import AppSyncResolver
from aws_lambda_powertools.event_handler.appsync import Router
from aws_lambda_powertools.utilities.data_classes import AppSyncResolverEvent
from aws_lambda_powertools.utilities.typing import LambdaContext
from tes... | 28.314136 | 106 | 0.67659 | [
"Apache-2.0",
"MIT-0"
] | BVMiko/aws-lambda-powertools-python | tests/functional/event_handler/test_appsync.py | 5,408 | Python |
#-*- coding: utf-8 -*-
# Import the extension
import isce3.extensions.isceextension as isceextension
# Import the wrappers
def crossmul(**kwds):
"""A factory for Crossmul"""
from .Crossmul import Crossmul
return Crossmul(**kwds)
# end of file
| 18.5 | 54 | 0.698842 | [
"Apache-2.0"
] | piyushrpt/isce3 | python/packages/isce3/signal/__init__.py | 259 | Python |
from IPython.display import display, Latex
display(Latex('$ d[mRNA_{nuc}]/dt = k_t - k_{exp} * [mRNA_{nuc}]$'))
print("and")
display(Latex('$ d[mRNA_{cyt}]/dt = k_{exp} * [mRNA_{nuc}] - k_{deg} * [mRNA_{cyt}]$'))
print("No. This is because mRNAs are continuously produced (and degraded) at independent rates in the... | 50.75 | 182 | 0.682266 | [
"MIT"
] | oercompbiomed/CBM101 | K_Mathematical_Modeling/Section 2/solutionODEsExercise3.py | 406 | Python |
import can
from threading import Thread
import asyncio
import settings
class ThreadModuleAbstract:
thread = None
bus: can.ThreadSafeBus = None
loop: asyncio.AbstractEventLoop = None
_can_filters: [] = None
def __init__(self):
self.bus = self._can = can.ThreadSafeBus(
channel=s... | 23.918919 | 49 | 0.630508 | [
"MIT"
] | Exus1/alfa-blue-me | module/ThreadModuleAbstract.py | 885 | Python |
name = 'codebench'
| 9.5 | 18 | 0.684211 | [
"MIT"
] | li-boxuan/codebench | codebench/__init__.py | 19 | Python |
import pytest
from aiohttp import web
from app import pochta
@pytest.fixture
def app(aiohttp_client):
app = web.Application()
app.router.add_get('/pochta', pochta)
return aiohttp_client(app)
async def test_work(aiohttp_client, loop, app):
client = app()
resp = await client.get('/pochta?from_ci... | 25.862069 | 111 | 0.698667 | [
"MIT"
] | postman17/lks-delivery | test-aiohttp.py | 800 | Python |
import random
import pytest
import numpy as np
from eight_mile.utils import calc_nfeats
def test_use_nfeats():
filtsz = [random.randint(1, 10) for _ in range(random.randint(2, 6))]
input_nfeat = random.randint(1, 100)
gold_nfeats = [input_nfeat] * len(filtsz)
_, nfeat = calc_nfeats(filtsz, None, None,... | 34.597403 | 102 | 0.703829 | [
"Apache-2.0"
] | blester125/baseline | tests/test_calc_feats.py | 2,664 | Python |
from typing import List, Tuple
import pytest
from returns.io import IOFailure, IOResult, IOSuccess
from returns.pipeline import managed
from returns.result import Failure, Result, Success
_acquire_success = IOSuccess('acquire success')
_acquire_failure = IOFailure('acquire failure')
def _use_success(inner_value: s... | 24.217054 | 80 | 0.601472 | [
"BSD-2-Clause"
] | CucumisSativus/returns | tests/test_pipeline/test_managed/test_managed_ioresult.py | 3,124 | Python |
# -*- coding: utf-8 -*- #
"""*********************************************************************************************"""
# FileName [ split_long_utter_to_short.py ]
# Synopsis [ preprocess long audio / speech to shorter versions ]
# Author [ Andy T. Liu (Andi611) ]
# Copyright [ Copyleft(c... | 38.354331 | 157 | 0.607678 | [
"MIT"
] | Ethan07902050/s3prl | s3prl/preprocess/split_long_utter_to_short.py | 4,871 | 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 the RPC HTTP basics."""
from test_framework.test_framework import BitcoinTestFramework
from test_... | 43.862385 | 104 | 0.632922 | [
"MIT"
] | mytitanium/Titanium-Core-1.0 | test/functional/interface_http.py | 4,781 | Python |
import time, sys, os
from database_check import database_check
from link_processor import get_link
from link_generator import alphabets_generator, random_address_generator, linear_address_generator, last_link_read_linear_address, mutation_address_generator
def program_exit(link, work_mode):
if work_mode == '1': ... | 38.468085 | 157 | 0.600111 | [
"Apache-2.0"
] | flexagoon/telegram_parser | telegram_parser_console/main.py | 3,616 | Python |
# Copyright (c) Twisted Matrix Laboratories.
# See LICENSE for details.
"""
Test cases for the L{twisted.python.failure} module.
"""
from __future__ import division, absolute_import
import re
import sys
import traceback
import pdb
import linecache
from twisted.python.compat import _PY3, NativeStringIO
from twisted.... | 31.460697 | 110 | 0.607281 | [
"Apache-2.0"
] | XZH950926/meizitu | fang/Twisted-18.4.0/src/twisted/test/test_failure.py | 31,618 | Python |
from sendbee_api.models import Model
from sendbee_api.fields import TextField, BooleanField
class RateLimitError(Model):
"""Data model for rate limit error"""
_detail = TextField(index='detail', desc='Message detail')
_error = BooleanField(index='error', desc='Error or not')
_type = TextField(index='... | 31.636364 | 62 | 0.729885 | [
"MIT"
] | sendbee/sendbee-python-client | sendbee_api/rate_limit/models.py | 348 | Python |
# Generated by Django 3.1 on 2020-10-07 00:22
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('resources', '0016_job_auth_token'),
]
operations = [
migrations.AlterField(
model_name='report',
name='logs',
... | 20.157895 | 53 | 0.597911 | [
"MIT"
] | Quving/jobby | api/resources/migrations/0017_auto_20201007_0022.py | 383 | Python |
"""Module to handle all events within AppDaemon."""
import uuid
from copy import deepcopy
import traceback
import datetime
from appdaemon.appdaemon import AppDaemon
import appdaemon.utils as utils
class Events:
"""Encapsulate event handling."""
def __init__(self, ad: AppDaemon):
"""Constructor.
... | 39.029973 | 120 | 0.507121 | [
"Apache-2.0"
] | DTTerastar/appdaemon | appdaemon/events.py | 14,324 | Python |
"""
Test lldb breakpoint setting by source regular expression.
This test just tests the source file & function restrictions.
"""
from __future__ import print_function
import os
import time
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
c... | 35.588785 | 83 | 0.645221 | [
"Apache-2.0"
] | Polidea/SiriusObfuscator | SymbolExtractorAndRenamer/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/source_regexp/TestSourceRegexBreakpoints.py | 3,808 | Python |
import queue
from ..workers import Worker
from ..codes import WORKER_PROPERTIES
class Singleton(type):
_instances = {}
def __call__(cls, *args, **kwargs):
if cls not in cls._instances:
cls._instances[cls] = super(Singleton, cls).__call__(*args, **kwargs)
return cls._instances[cls... | 34.666667 | 116 | 0.620192 | [
"Apache-2.0"
] | kuronosec/PyGridNetwork | gridnetwork/events/socket_handler.py | 3,120 | Python |
from polyphony import testbench
def fib(n):
if n <= 0: return 0
if n == 1: return 1
r0 = 0
r1 = 1
for i in range(n-1):
prev_r1 = r1
r1 = r0 + r1
r0 = prev_r1
return r1
@testbench
def test():
expect = [0,1,1,2,3,5,8,13,21,34,55,89,144,233,377,610]
for i in range(... | 18.782609 | 59 | 0.518519 | [
"MIT"
] | ryos36/polyphony-tutorial | Tutorial_2/fib.py | 432 | Python |
# <pep8-80 compliant>
# ##### 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.
#
# ... | 29.702602 | 78 | 0.584293 | [
"Unlicense"
] | byteinc/Phasor | engine/2.80/scripts/addons/magic_uv/op/texture_lock.py | 15,980 | Python |
from LAMARCK_ML.models.interface import ModellUtil
class DataSaverInterface(ModellUtil):
def __init__(self, **kwargs):
super(DataSaverInterface, self).__init__(**kwargs)
def get_individual_by_name(self, name):
raise NotImplementedError()
def get_ancestry_for_ind(self, ind_name):
raise NotImplement... | 25.388889 | 54 | 0.770241 | [
"Apache-2.0",
"BSD-3-Clause"
] | JonasDHomburg/LAMARCK | LAMARCK_ML/utils/dataSaver/interface.py | 457 | Python |
# Original code from https://github.com/araffin/robotics-rl-srl
# Authors: Antonin Raffin, René Traoré, Ashley Hill
import argparse
import cv2 # pytype: disable=import-error
import numpy as np
from ae.autoencoder import Autoencoder
def create_figure_and_sliders(name, state_dim):
"""
Creating a window for t... | 31.6 | 112 | 0.656962 | [
"MIT"
] | araffin/aae-train-donkeycar | ae/enjoy_latent.py | 2,372 | Python |
# Copyright (c) 2020 PaddlePaddle 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 appli... | 39.44958 | 94 | 0.582242 | [
"Apache-2.0"
] | gbstack/PaddleDetection | ppdet/modeling/post_process.py | 28,167 | Python |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes ... | 36.363636 | 82 | 0.618333 | [
"MIT"
] | MyronFanQiu/azure-cli-extensions | src/codespaces/azext_codespaces/vendored_sdks/vsonline/models/resource_provider_operation_definition.py | 1,200 | Python |
JONG_COMP = {
'ㄱ': {
'ㄱ': 'ㄲ',
'ㅅ': 'ㄳ',
},
'ㄴ': {
'ㅈ': 'ㄵ',
'ㅎ': 'ㄶ',
},
'ㄹ': {
'ㄱ': 'ㄺ',
'ㅁ': 'ㄻ',
'ㅂ': 'ㄼ',
'ㅅ': 'ㄽ',
'ㅌ': 'ㄾ',
'ㅍ': 'ㄿ',
'ㅎ': 'ㅀ',
}
}
DEFAULT_COMPOSE_SEPARATOR = u'ᴥ'
#################... | 24.294118 | 86 | 0.439294 | [
"Apache-2.0"
] | CodePsy-2001/hanshift | hanshift/text.py | 2,957 | Python |
import curses
import time # only for debugging
stdscr = curses.initscr()
class Listdisplay:
def __init__(self, lst, start_x, start_y, height, width, headers=None) -> None:
"""Lst is 2-d. i th list in lst is content of i+1 tab
Each string in lst should not be of more length than width
sc... | 25.680412 | 83 | 0.570454 | [
"MIT"
] | Tubular-Terriers/code-jam | src/client/ui/widget/displaylist.py | 2,491 | Python |
from django.conf.urls import url
from django.contrib.auth import login
from django.contrib.auth.models import User
from django.http import HttpResponse
from django.views.decorators.cache import cache_page
from django.urls import include, path, re_path
from .. import views
def repath_view(request):
return HttpRes... | 36.68 | 100 | 0.694656 | [
"Apache-2.0",
"BSD-3-Clause"
] | AlexandreYang/dd-trace-py | tests/contrib/django/django_app/urls.py | 1,834 | Python |
import requests
import csv
import sys
import os
import json
from time_converter import date_weather_format, current_day_weather
def get_all_json_keys(keys_array, json):
for key in json.keys():
if not isinstance(json[key], str):
_ = get_all_json_keys(keys_array, json[key][0])
else:
... | 31.657658 | 79 | 0.63432 | [
"Apache-2.0"
] | lucio-lpf/SEPA | data/weather_data.py | 3,514 | Python |
# coding=utf-8
# Copyright 2018 The OpenAI Team Authors and HuggingFace Inc. team.
# Copyright (c) 2018, NVIDIA CORPORATION. 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... | 50.586265 | 193 | 0.668675 | [
"MIT"
] | richardbaihe/semantic_unwritten | transformers/modeling_tf_openai.py | 30,200 | Python |
from singlecellmultiomics.bamProcessing.pileup import pileup_truncated
def get_pileup_vect(alignments, contig, pos, ref, alt):
"""Create feature vector for selected variant
Args:
alignments(pysam.AlignmentFile) : Handle to alignmentfile
contig(str) : contig to perform pileup
pos(int) ... | 37.192982 | 86 | 0.659434 | [
"MIT"
] | BuysDB/SingleCellMultiOmics | singlecellmultiomics/bamProcessing/bamFeatures.py | 2,120 | Python |
#=============================================================================
# Copyright 2017 FLIR Integrated Imaging Solutions, Inc. All Rights Reserved.
#
# This software is the confidential and proprietary information of FLIR
# Integrated Imaging Solutions, Inc. ('Confidential Information'). You
# shall not d... | 36.897959 | 106 | 0.663717 | [
"MIT"
] | sjtu-automatic-maritime-system/PengZhenghao | PyCapture2-2.13.31/examples/python3/FlyCapture2Test.py | 3,616 | Python |
import json
def process_data(data):
member_dict = {}
def process_post(post):
if 'comments' in post:
for comment in post['comments']['data']:
commenter_id = comment['from']['id']
if commenter_id not in member_dict:
member_dict[commenter_id] = comment['from']
member_dic... | 30.171875 | 128 | 0.662351 | [
"MIT"
] | yangshun/nuswhispers-leaderboard | process-whispers.py | 1,931 | Python |
# Generated by Django 2.2.7 on 2019-11-21 01:20
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('user', '0004_remove_user_register_time'),
]
operations = [
migrations.AlterField(
model_name='user',
name='username'... | 22.421053 | 86 | 0.622066 | [
"MIT"
] | darkliang/JudeeBE | user/migrations/0005_auto_20191121_0120.py | 426 | Python |
# Copyright (c) 2022 RWTH Aachen - Werkzeugmaschinenlabor (WZL)
# Contact: Simon Cramer, s.cramer@wzl-mq.rwth-aachen.de
from sherpa import Client
from sherpa.schedulers import Scheduler, _JobStatus
import requests
import json
import logging as logg
import numpy as np
import socket
from time import sleep
import os
from... | 53.767528 | 209 | 0.620891 | [
"MIT"
] | predictive-quality/ml-pipeline-blocks-hpo-sherpa | argo_scheduler.py | 14,571 | Python |
# Generated by Django 2.2.7 on 2020-01-10 19:23
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('chatapp', '0001_initial'),
]
operations = [
migrations.RemoveField(
... | 32.057143 | 148 | 0.63369 | [
"MIT"
] | milad-r/django_project | ChatProject/chatapp/migrations/0002_auto_20200110_2253.py | 1,122 | 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... | 40.416667 | 107 | 0.765206 | [
"Apache-2.0"
] | Queuecumber/pytorch-lightning | pytorch_lightning/utilities/imports.py | 3,880 | Python |
from ._ffmpeg_normalize import FFmpegNormalize
from ._media_file import MediaFile
from ._version import __version__
| 23.4 | 46 | 0.863248 | [
"MIT"
] | MCeddy/ffmpeg-normalize | ffmpeg_normalize/__init__.py | 117 | Python |
#!/usr/bin/env python
from setuptools import setup
with open("README.md", "r") as fh:
long_description = fh.read()
setup(
name="Taerbit",
version="0.0.1",
author="Finn Torbet",
author_email="finnt26@gmail.com",
description="Package to process images through interpretability methods and then m... | 34.875 | 134 | 0.669056 | [
"MIT"
] | Taerbit/EXP | setup.py | 837 | Python |
import _plotly_utils.basevalidators
class RangeValidator(_plotly_utils.basevalidators.InfoArrayValidator):
def __init__(self, plotly_name="range", parent_name="layout.xaxis", **kwargs):
super(RangeValidator, self).__init__(
plotly_name=plotly_name,
parent_name=parent_name,
... | 35.419355 | 82 | 0.435337 | [
"MIT"
] | AWS-BugBust-054/plotly.py | packages/python/plotly/plotly/validators/layout/xaxis/_range.py | 1,098 | Python |
"""
Copyright (C) 2018-2020 Intel Corporation
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... | 33.805556 | 118 | 0.727198 | [
"Apache-2.0"
] | IvanNovoselov/openvino_contrib | modules/mo_pytorch/mo_extensions/front/pytorch/linear.py | 1,217 | Python |
#@+leo-ver=5-thin
#@+node:ekr.20160928073518.1: * @file ../plugins/pyplot_backend.py
'''
A helper for the viewrendered plugin.
This is *NOT* a real plugin.
'''
#@+<< pyplot_backend imports >>
#@+node:ekr.20160928074801.1: ** << pyplot_backend imports >>
from leo.core import leoGlobals as g
from leo.plugins impo... | 35.139706 | 97 | 0.663109 | [
"MIT"
] | ATikhonov2/leo-editor | leo/plugins/pyplot_backend.py | 4,779 | Python |
import sys
import os
import errno
import time
import json
import glob
from base64 import b64decode
from watchdog.observers import Observer
from watchdog.events import FileSystemEventHandler
class Handler(FileSystemEventHandler):
def __init__(self, provider):
self.provider = provider
def on_created(sel... | 33.934211 | 106 | 0.551764 | [
"MIT"
] | GuyKh/traefik-certificate-extractor | extractor.py | 5,158 | Python |
#! /usr/bin/env python3
"""camera.py - Adding a camera for bigger levels."""
import collections
import time
import arcade
from arcade import key
# Constraints
SCREEN_WIDTH = 1000
SCREEN_HEIGHT = 650
SCREEN_TITLE = "Platformer"
# Scale sprites from original size. 1 is original.
CHARACTER_SCALING = 1
TILE_SCALING = 0... | 32.008174 | 87 | 0.616583 | [
"MIT"
] | casadina/py_arcade | multiple_levels.py | 11,747 | Python |
# -*- coding: utf-8 -*-
"""
werkzeug.formparser
~~~~~~~~~~~~~~~~~~~
This module implements the form parsing. It supports url-encoded forms
as well as non-nested multipart uploads.
:copyright: (c) 2011 by the Werkzeug Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more deta... | 41.224 | 81 | 0.598389 | [
"BSD-3-Clause"
] | Chitrank-Dixit/werkzeug | werkzeug/formparser.py | 20,612 | Python |
#!/usr/bin/env python
# coding: utf-8
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
sns.set_style('whitegrid')
import sys
import os
import pandas as pd
from scipy import stats
HEADERS = ['device', 'layout', 'enc_type', 'n_states', 'sim_type', 'shots', 'optimizer', 'energy', 'meas_mit']
... | 27.111842 | 168 | 0.568794 | [
"MIT"
] | aemccoy/GrayCode-QubitEncoding | paper-data/noise/8state_layout_comparison.py | 4,121 | Python |
"""
The file preprocesses the files/train.txt and files/test.txt files.
I requires the dependency based embeddings by Levy et al.. Download them from his website and change
the embeddingsPath variable in the script to point to the unzipped deps.words file.
"""
from __future__ import print_function
import numpy as np
... | 32.179104 | 165 | 0.621212 | [
"Apache-2.0"
] | BhuvaneshwaranK/deeplearning4nlp-tutorial | 2017-07_Seminar/Session 3 - Relation CNN/code/preprocess.py | 6,468 | Python |
import os
RESOURCE_DIR = os.path.join(os.path.dirname(__file__), 'resources')
FONT_FILE_PATH = os.path.join(RESOURCE_DIR, 'DejaVuSans.ttf')
| 23.666667 | 67 | 0.767606 | [
"MIT"
] | alok1974/minescrubber | src/minescrubber/conf.py | 142 | Python |
# vim:ts=4:sw=4:sts=4:et
# -*- coding: utf-8 -*-
"""Classes related to graph clustering.
@undocumented: _handle_mark_groups_arg_for_clustering, _prepare_community_comparison"""
__license__ = u"""
Copyright (C) 2006-2012 Tamás Nepusz <ntamas@gmail.com>
Pázmány Péter sétány 1/a, 1117 Budapest, Hungary
This program is... | 39.722623 | 95 | 0.622215 | [
"MIT"
] | tuandnvn/ecat_learning | igraph/clustering.py | 66,025 | Python |
# Copyright 2018 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.
#
#... | 38.746032 | 78 | 0.781237 | [
"BSD-3-Clause"
] | Abzollo/deepvariant | third_party/nucleus/io/python/hts_verbose_test.py | 2,441 | Python |
"""Tests for the sensor drivers."""
import pytest
import mock
from pytest_lazyfixture import lazy_fixture # type: ignore[import]
from unittest.mock import patch
from mock.mock import AsyncMock
from tests.conftest import MockCanMessageNotifier
from opentrons_hardware.sensors import fdc1004, hdc2080, mmr920C04, senso... | 35.263757 | 88 | 0.619727 | [
"Apache-2.0"
] | Opentrons/protocol_framework | hardware/tests/opentrons_hardware/sensors/test_sensor_drivers.py | 18,584 | Python |
import pytest
def test_load_module():
__import__("modules.core.disk")
| 12.666667 | 35 | 0.736842 | [
"MIT"
] | Aliuakbar/bumblebee-status | tests/modules/core/test_disk.py | 76 | Python |
"""
Common functions for tests
"""
__author__ = "Dan Gunter <dkgunter@lbl.gov>"
__date__ = "10/29/13"
# Stdlib
import json
import logging
import os
import subprocess
import sys
import tempfile
import traceback
import unittest
# Third-party
from mongomock import MongoClient
import pymongo
# Package
from pymatgen.db.q... | 27.690217 | 95 | 0.556232 | [
"MIT"
] | chc273/pymatgen-db | pymatgen/db/tests/common.py | 5,095 | Python |
# -------------------------------------------------------------------------
# Copyright (c) Microsoft. 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.ap... | 35.038874 | 149 | 0.655457 | [
"Apache-2.0"
] | RobertoPrevato/azure-storage-python | azure/storage/blob/models.py | 26,141 | Python |
import numpy
import matplotlib.pyplot as plt
import threading
import multiprocessing
from scipy import stats
class TestHist:
def hist(self, parameter_list):
x = numpy.random.uniform(0.0, 5.0, 100000)
plt.hist(x, 100)
plt.show()
y = numpy.random.normal(0.0, 5.0, 100000)
pl... | 22.444444 | 74 | 0.584777 | [
"MIT"
] | badpaybad/mypython | helloword/ml.py | 1,616 | Python |
from rest_framework import permissions
from django_otp import user_has_device
from .utils import otp_is_verified
class IsOtpVerified(permissions.BasePermission):
"""
If user has verified TOTP device, require TOTP OTP.
"""
message = "You do not have permission to perform this action until you verify yo... | 32.058824 | 99 | 0.726606 | [
"MIT"
] | frankfern/django_rest_totp | accounts/permissions.py | 545 | Python |
class HsvFilter:
def __init__(self, hMin=None, sMin=None, vMin=None, hMax=None, sMax=None, vMax=None,
sAdd=None, sSub=None, vAdd=None, vSub=None):
self.hMin = hMin
self.sMin = sMin
self.vMin = vMin
self.hMax = hMax
self.sMax = sMax
self.vMax = vM... | 26.4375 | 88 | 0.541371 | [
"MIT"
] | gulyhan/CryptOfTheNecroDancerBot | computer_vision/hsv_filter.py | 423 | Python |
class Solution:
def solve(self, a, b, lower, upper):
a = [x**2 for x in a]
a.sort()
b = [x**2 for x in b]
b.sort()
ans = 0
for i in range(len(a)):
l,r = 0,len(b)-1
ans1 = -1
while l<=r:
mid = (l+r)//2
... | 21.684211 | 42 | 0.300971 | [
"MIT"
] | MdAbedin/binarysearch | 0981 Bounded Square Sums.py | 824 | Python |
# a simple python AES decrypter. Do not remember why I needed this, but nice to have. :)
pw = [255,155,28,115,214,107,206,49,172,65,62,174,19,27,70,79,88,47,108,226,209,225,243,218,126,141,55,107,38,57,78,91]
pw1 = b''
for i in pw:
pw1 += i.to_bytes(1, 'little')
import sys, hexdump, binascii
from Crypto.Cipher im... | 27.857143 | 119 | 0.703846 | [
"MIT"
] | fjank/htb | htb/remote/decoder.py | 780 | Python |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may ... | 50.043182 | 212 | 0.671193 | [
"MIT"
] | Darkstar1t/azure-sdk-for-python | sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_03_01/aio/operations/_gallery_images_operations.py | 22,019 | Python |
# Protocol Buffers - Google's data interchange format
# Copyright 2008 Google Inc. All rights reserved.
# https://developers.google.com/protocol-buffers/
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# ... | 35.246445 | 84 | 0.699543 | [
"MIT"
] | JustinACoder/H22-GR3-UnrealAI | Plugins/UnrealEnginePython/Binaries/Win64/Lib/site-packages/google/protobuf/message.py | 14,874 | Python |
# coding: utf-8
# flake8: noqa
"""
Design feeds APIs
Various design feeds.<BR />[Endpoint] https://api.apitore.com/api/32 # noqa: E501
OpenAPI spec version: 0.0.1
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
# import models into ... | 23.8 | 86 | 0.756303 | [
"Apache-2.0"
] | apitore/apitore-sdk-python | 32/swagger_client/models/__init__.py | 476 | Python |
"""Build Environment used for isolation during sdist building
"""
import os
from distutils.sysconfig import get_python_lib
from sysconfig import get_paths
from pip._internal.utils.temp_dir import TempDirectory
class BuildEnvironment(object):
"""Creates and manages an isolated environment to install build deps
... | 28.827957 | 72 | 0.624767 | [
"MIT"
] | 0915318/PietonFunktie | inter/Lib/site-packages/pip-10.0.1-py3.7.egg/pip/_internal/build_env.py | 2,681 | Python |
# Copyright 2022 Aleksandr Soloshenko
#
# 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 ... | 34.178571 | 74 | 0.772205 | [
"Apache-2.0"
] | capcom6/django-bread | recipes/storage.py | 957 | Python |
from flask import render_template
from. import main
@main.app_errorhandler(404)
def four_ow_four(error):
return render_template('404.html')
| 21.285714 | 42 | 0.771812 | [
"Unlicense"
] | suad7/News-highlight | app/main/errors.py | 149 | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.