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 |
|---|---|---|---|---|---|---|---|---|
# -*- coding: utf-8 -*-
import os
import random
import functools
import six
import numpy as np
import torch
from torch import nn
from torch.utils.data.distributed import DistributedSampler
from aw_nas import utils
from aw_nas.final.base import FinalTrainer
from aw_nas.final.bnn_model import BNNGenotypeModel
from aw_... | 42.495851 | 103 | 0.583362 | [
"MIT"
] | Harald-R/aw_nas | aw_nas/final/cnn_trainer.py | 20,483 | Python |
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import asyncio
import dataclasses
import enum
import json
import logging
import os
import subprocess
import tempfile
import traceback
from p... | 37.465507 | 88 | 0.62575 | [
"MIT"
] | dmitryvinn/pyre-check-1 | client/commands/persistent.py | 64,628 | Python |
# -*- coding: utf-8 -*-
'''
==============
scrim.commands
==============
Implements functionality available across multiple shell scripting languages.
'''
from __future__ import absolute_import
import abc
from collections import namedtuple
from fstrings import f
import ntpath
import posixpath
ABC = abc.ABCMeta('ABC', ... | 26.547414 | 79 | 0.643124 | [
"MIT"
] | danbradham/scrim | scrim/commands.py | 6,159 | Python |
# MIT LICENSE
#
# Copyright 1997 - 2020 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,... | 43.201342 | 193 | 0.6524 | [
"MIT"
] | OpenIxia/ixnetwork_restpy | uhd_restpy/testplatform/sessions/ixnetwork/topology/isistrillpseudonode_173e4463dccc2001457569c77f3570e0.py | 12,874 | Python |
from .customer_service import *
from .transaction_service import *
from .webhook_service import *
| 24.5 | 34 | 0.816327 | [
"MIT"
] | Nyior/django-rest-paystack | paystack/services/__init__.py | 98 | Python |
#
# Copyright SAS Institute
#
# 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... | 38.832838 | 161 | 0.499244 | [
"Apache-2.0"
] | kjnh10/saspy | saspy/sasdata.py | 52,269 | Python |
import re
from model.contact import Contact
def test_firstname_on_home_page(app, check_ui):
contact_from_home_page = app.contact.get_contact_list()[0]
contact_from_edit_page = app.contact.get_contact_info_from_edit_page(0)
assert contact_from_home_page.firstname == merge_firstname_like_on_home_page(contac... | 45.318182 | 170 | 0.792377 | [
"Apache-2.0"
] | 200312/python_training | test/test_name.py | 997 | Python |
from flask import jsonify
from flask_restful import Resource
class SKU(Resource):
def get(self):
return jsonify(
{}
)
| 13.909091 | 34 | 0.601307 | [
"MIT"
] | VadymHutei/ukubuka-back | app/resources/sku.py | 153 | Python |
# Given a binary tree, check whether it is a mirror of itself (ie, symmetric around its center).
# For example, this binary tree is symmetric:
1
/ \
2 2
/ \ / \
3 4 4 3
But the following is not:
1
/ \
2 2
\ \
3 3
class Solution(object):
def help(self, el, r):
if el ==... | 21.793103 | 96 | 0.550633 | [
"MIT"
] | SakiFu/leetcode | python/symmetric_tree.py | 632 | Python |
"""SqlAlchemy models."""
import datetime
from blog.extensions import db
from blog.category.models import Category
TITLE_LEN = 255
URL_LEN = 255
POST_STATUSES = {
0: 'Draft',
1: 'Page',
2: 'Archive',
3: 'Special',
4: 'Published',
}
class Post(db.Model):
"""orm model for blog post."""
__... | 28.162162 | 72 | 0.675624 | [
"MIT"
] | gunlinux/gunlinux.org | blog/post/models.py | 1,042 | Python |
# -*- coding: utf-8 -*-
"""
Module entry point.
------------------------------------------------------------------------------
This file is part of grepros - grep for ROS bag files and live topics.
Released under the BSD License.
@author Erki Suurjaak
@created 24.10.2021
@modified 02.11.2021
-------------... | 25.111111 | 78 | 0.429204 | [
"BSD-3-Clause"
] | suurjaak/grepros | src/grepros/__main__.py | 452 | Python |
"""
This module contains functions to:
- solve a single equation for a single variable, in any domain either real or complex.
- solve a system of linear equations with N variables and M equations.
- solve a system of Non Linear Equations with N variables and M equations
"""
from __future__ import print_f... | 36.265478 | 93 | 0.568121 | [
"BSD-3-Clause"
] | aktech/sympy | sympy/solvers/solveset.py | 77,318 | Python |
import tensorflow.compat.v1 as tf
import numpy as np
m = 1740
x_batch = np.random.rand(m)
y_batch = np.random.rand(1)
weights = np.random.rand(m)
biases = np.random.rand(m)
with tf.Session() as sess:
x = tf.placeholder(tf.float32, shape=(m, ), name='x')
y = tf.placeholder(tf.float32, shape=(1, ), name='y'... | 30.2 | 124 | 0.646063 | [
"Apache-2.0"
] | VeriGOOD-ML/public | tabla/tabla/benchmarks/onnx/svm_tf.py | 1,359 | Python |
# Copyright 2021 Huawei Technologies Co., Ltd
#
# 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... | 40.92 | 107 | 0.721041 | [
"Apache-2.0"
] | 233-puchi/mindspore | tests/st/ops/cpu/test_layer_norm_op.py | 8,184 | Python |
from rdflib import URIRef, Namespace
from definednamespace import DefinedNamespace
class RDF(DefinedNamespace):
# http://www.w3.org/1999/02/22-rdf-syntax-ns#Property
direction: URIRef # The base direction component of a CompoundLiteral.
first: URIRef # The first item in the sub... | 56.514286 | 109 | 0.63094 | [
"CC0-1.0"
] | hsolbrig/definednamespace | tests/data/RDF.py | 1,978 | Python |
# 927030030
seals = [
[600, -510],
[-600, -510],
[150, -720],
[-150, -720],
[0, -280],
]
sm.lockInGameUI(True, False)
sm.hideUser(False)
sm.forcedInput(0)
sm.sendDelay(1000)
for seal in seals:
sm.playSound("eunwolTuto/seal", 100)
sm.avatarOriented("Effect/Direction15.img/effect/tuto/seal/front")
sm.avatar... | 25.393939 | 108 | 0.658711 | [
"MIT"
] | Bia10/MapleEllinel-v203.4 | scripts/field/eunwol_tuto_3_5.py | 838 | Python |
from data import *
from model import *
from utils import *
import torch
from torch.autograd import Variable
import torch.nn as nn
from torch import optim
import torch.nn.functional as F
#import matplotlib.pyplot as plt
#import matplotlib.ticker as ticker
#import numpy as np
#import io
#import torchvision
#from PIL ... | 31.59854 | 106 | 0.68122 | [
"MIT"
] | iclementine/practical-pytorch | seq2seq-translation-batched/evaluate.py | 4,337 | Python |
import gzip
from codecs import getreader, open
def get_file_handle(file_path):
"""Return a opened file"""
if file_path.endswith(".gz"):
file_handle = getreader("utf-8")(gzip.open(file_path, "r"), errors="replace")
else:
file_handle = open(file_path, "r", encoding="utf-8")
return file... | 23.428571 | 85 | 0.661585 | [
"BSD-3-Clause"
] | Clinical-Genomics/scout | scout/utils/handle.py | 328 | Python |
#!/usr/bin/python
Liste1 = ["1,1 + 1.1"]
Liste2 = ["python", "ist", "nice"]
Liste3 = ["1,4,2,3,5,8,7,9,6,0"]
Liste3.sort
Listen ={Liste1 , Liste2 , Liste3}
print(Listen)
| 19 | 34 | 0.596491 | [
"MIT"
] | matthis-werkstatt/python-3 | kapitel-3 Erste_Schritte_im_interaktiven_modus/main.py | 171 | Python |
# Generated by Django 3.0.3 on 2020-02-13 07:58
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('locations', '0002_department'),
]
operations = [
migrations.AlterField(
model_name='department',
name='department_co... | 20.684211 | 50 | 0.605598 | [
"MIT"
] | manuel103/pitchant-v1.0- | pitchant/locations/migrations/0003_auto_20200213_0758.py | 393 | Python |
from common.database import db
from flask_restful import fields
from sqlalchemy.ext.orderinglist import ordering_list
from sqlalchemy.sql import func
contato_campos = {
'id': fields.Integer(attribute='id'),
'nome': fields.String(attribute='nome'),
'email': fields.String(attribute='email'),
'telefone':... | 30.075 | 74 | 0.679967 | [
"Apache-2.0"
] | LADOSSIFPB/LaNoCentro | ServicoApp/models/contato.py | 1,203 | Python |
# coding: utf-8
import urllib
import re
from google.appengine.ext import blobstore
import flask
import flask_wtf
import wtforms
import auth
import config
import model
import util
from main import app
# ###############################################################################
# # List Filters
# #############... | 34.06087 | 105 | 0.594077 | [
"MIT"
] | manshar/birwaz | main/control/filter.py | 3,987 | Python |
import datetime
import warnings
import pendulum
from dagster import check
from dagster.core.definitions.partition import PartitionSetDefinition
from dagster.core.errors import DagsterInvalidDefinitionError
from dagster.utils.partitions import (
DEFAULT_DATE_FORMAT,
DEFAULT_HOURLY_FORMAT_WITHOUT_TIMEZONE,
D... | 43.548644 | 102 | 0.688042 | [
"Apache-2.0"
] | alex-treebeard/dagster | python_modules/dagster/dagster/core/definitions/decorators/schedule.py | 27,305 | Python |
#!/usr/bin/python
#
# linearize-hashes.py: List blocks in a linear, no-fork version of the chain.
#
# Copyright (c) 2013 The Bitcoin developers
# Distributed under the MIT/X11 software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
#
import json
import struct
impor... | 25.803738 | 78 | 0.673669 | [
"MIT"
] | ShastaFarEye/mazacoin-new | contrib/linearize/linearize-hashes.py | 2,761 | Python |
import pygame
import sys
import os
sys.path.insert(1, os.path.join(sys.path[0], '..'))
import scene.scene
import scene.shape
pygame.init()
pygame.display.set_caption('draw alpha')
screen = pygame.display.set_mode((1280, 768))
running = True
s1 = scene.scene.Scene(1280, 768, 0, 0, 1280, 768)
c1 = scene.shape.Ci... | 21.612245 | 59 | 0.644004 | [
"MIT"
] | nolmegamelab/PlaySimulator | test/test_scene.py | 1,059 | Python |
"""Checks the repository for updates."""
import os
import sys
import urllib
import imp
from hashlib import md5
from inspect import getsourcelines
from threading import Thread
from retriever import REPOSITORY, VERSION, MASTER_BRANCH, REPO_URL, SCRIPT_WRITE_PATH
from retriever.lib.models import file_exists
global abor... | 38.280423 | 113 | 0.482377 | [
"MIT"
] | brymz/retriever | lib/repository.py | 7,235 | Python |
# -*- coding: utf-8 -*-
"""
Store data in the Sqlite3 Database
Table1
"""
import os
import sys
import codecs
import sqlite3
from common import log
from store.model import Question, Answer, Person, Topic
DB_PATH = 'spiderman.db'
logger = log.Logger(name='store')
def init_all_dbs():
"""
call it when cr... | 26.156566 | 132 | 0.564202 | [
"MIT"
] | mengfanShi/SpiderMan | store/store.py | 5,567 | Python |
# MIT LICENSE
#
# Copyright 1997 - 2020 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, ... | 45.707617 | 2,945 | 0.651716 | [
"MIT"
] | rfrye-github/ixnetwork_restpy | uhd_restpy/testplatform/sessions/ixnetwork/topology/bgpipv6peer_d4ac277d9da759fd5a152b8e6eb0ab20.py | 159,611 | Python |
# old functions (slightly more time efficient) which store forward and reverse frames in memory and don't use
# any multiprocessing.
def seqToProtein(dnaSeq, minLen):
newSeq = dnaSeq.upper().replace('N', '')
start = time.time()
forwFrames, revFrames = seqToFrames(newSeq)
peptides = []
for frame ... | 29.06 | 109 | 0.621817 | [
"Apache-2.0"
] | nhcha6/SixFrameTranslationNew | DNAtoPep/OldSixFrameFunctions.py | 2,906 | Python |
# -*- coding: utf-8 -*-
# Copyright 2011 Takeshi KOMIYA
#
# 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... | 27.920266 | 76 | 0.563422 | [
"Apache-2.0"
] | kizhakkd/seqdiag | src/seqdiag/elements.py | 8,404 | Python |
from .factory import ImageClassificationModel # noqa: F401
| 30 | 59 | 0.816667 | [
"MIT"
] | jexio/fulmo | fulmo/models/cv/__init__.py | 60 | Python |
"""Init to import all the routing protocols implemented."""
from .min_hop import MinHopRouting, MinHopRoutingSink
from .etx import ETX, ETXSink
from .dap import DAPRouting, DAPRoutingSink
from .base_routing_protocol import RoutingProtocol
| 34.285714 | 59 | 0.825 | [
"MIT"
] | mesepulveda/wsn-simulator | wsnsim/routing/__init__.py | 240 | Python |
import os
from retriever.lib.defaults import DATA_DIR
from retriever.lib.dummy import DummyConnection
from retriever.lib.models import Engine
from retriever.lib.tools import open_fr, open_fw
from retriever.lib.engine_tools import sort_csv, xml2csv_test
class engine(Engine):
"""Engine instance for writing data to... | 36.724832 | 90 | 0.58973 | [
"MIT"
] | Aakash3101/retriever | retriever/engines/xmlengine.py | 5,472 | Python |
from subprocess import STDOUT, run, PIPE
def align(x, al):
""" return <x> aligned to <al> """
return ((x+(al-1))//al)*al
class CompilationError(Exception):
def __init__(self, code, output) -> None:
super().__init__(f'compilation failed')
self.code = code
self.output = output
... | 25.946429 | 68 | 0.598073 | [
"MIT"
] | nnnewb/learning-packer | packer4/utils.py | 1,453 | Python |
from flask_appbuilder import BaseView, expose
from config import APP_ICON, APP_NAME
from flask import g
def get_user():
return g.user
def custom_template():
app_name = "GEA"
app_version = "1.2"
return app_name, app_version
class someView(BaseView):
"""
A simple view that implemen... | 25.803922 | 63 | 0.545593 | [
"MIT"
] | mcnigno/gea | app/index.py | 1,316 | Python |
# Copyright 2019-2020 Jan Feitsma (Falcons)
# SPDX-License-Identifier: Apache-2.0
#!/usr/bin/env python3
#
import sys, copy
import argparse
import yaml
import falconspy
from rdlLib import RDLFile
AGENTS_IGNORE = [1] # the ones which do not have ballHandlers
def loadYAMLcalibration(yamlfile):
f = open(yamlfile... | 38.216667 | 141 | 0.602268 | [
"Apache-2.0"
] | Falcons-Robocup/code | packages/ballHandling/py/checkBhCalibration.py | 6,879 | Python |
_base_ = [
'../../_base_/models/resnet50_cifar.py', '../../_base_/datasets/cifar100_bs128.py',
'../../_base_/schedules/cifar10_bs128.py', '../../_base_/default_runtime.py'
]
norm_cfg = dict(type="SyncBN", requires_grad=True)
model = dict(
type='ImageClassifierAD',
backbone=dict(
nor... | 33.1 | 100 | 0.583082 | [
"MIT"
] | wyze-AI/AdaptiveDistillation | configs/kd/cifar100/resnet18_b128_cifar100.py | 662 | Python |
#!/usr/bin/env python
from distutils.core import setup
DISTNAME = 'tract_querier'
DESCRIPTION = \
'WMQL: Query language for automatic tract extraction from '\
'full-brain tractographies with '\
'a registered template on top of them'
LONG_DESCRIPTION = open('README.md').read()
MAINTAINER = 'Demian Wasserman... | 30.448276 | 64 | 0.625708 | [
"BSD-3-Clause"
] | gagdiez/WPI_WMQL_t | setup.py | 1,766 | Python |
from django.conf.urls import url
from visitorcounter import views
urlpatterns = [
url(r'^$', views.index),
]
| 16.285714 | 32 | 0.710526 | [
"Unlicense"
] | benjaminbrinkman/itchallenge | visitorcounter/urls.py | 114 | Python |
import os
import pandas
import numpy as np
from numpy.random import default_rng
import cv2
from time import time_ns
from datetime import datetime, timedelta
from PIL import Image
class Imagebot:
def __init__(self, queue="./queue", sourcedir="./source", index="index.csv",
min_queue_length=240, im... | 38.373016 | 104 | 0.611169 | [
"MIT"
] | mattrogers1124/imagebot | imagebot/imagebot.py | 4,835 | Python |
# -*- coding:utf-8 -*-
class TabSetup(object):
def __init__(self, url_name='', click_css_selector='', pause_time=1, x_offset=8, y_offset=8, try_times=20):
"""
爬虫标签页设置
:param url_name:
:param click_css_selector:
:param pause_time:暂停时间
:param x_offset:x轴方向页面偏移
... | 34.35 | 117 | 0.598253 | [
"Apache-2.0"
] | mannuan/dspider | spider/driver/base/tabsetup.py | 1,452 | 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.
# --------------------------------------------------------------------... | 47.494737 | 134 | 0.605053 | [
"MIT"
] | 4thel00z/microsoft-crap-that-doesnt-work | sdk/formrecognizer/azure-ai-formrecognizer/samples/sample_recognize_receipts.py | 4,512 | Python |
from typing import List, Tuple
import aiosqlite
from venidium.types.blockchain_format.sized_bytes import bytes32
from venidium.util.db_wrapper import DBWrapper
import logging
log = logging.getLogger(__name__)
class HintStore:
coin_record_db: aiosqlite.Connection
db_wrapper: DBWrapper
@classmethod
as... | 34.560976 | 110 | 0.666196 | [
"Apache-2.0"
] | Venidium-Network/venidium-blockchain | venidium/full_node/hint_store.py | 1,417 | 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.323899 | 235 | 0.670312 | [
"MIT"
] | AFengKK/azure-sdk-for-python | sdk/loganalytics/azure-mgmt-loganalytics/azure/mgmt/loganalytics/operations/_storage_insight_configs_operations.py | 16,003 | Python |
from django import forms
from django.conf import settings
from django.http import HttpResponse, HttpResponseRedirect, Http404
from Manager import models as m
from . import templater
def process_request(request):
group = request.urlparams[0]
try:
members = m.Membership.objects.filter(group = group)
print(membe... | 24.675676 | 73 | 0.71851 | [
"Apache-2.0"
] | bmackley/ancientassyrian | member/views/groupMembers.py | 913 | Python |
# Run the person detection model
# This version reads the images from the ov2640 camera on the esp32-cam board
# with minor changes this also works for the m5 timer camera
import sys
import microlite
import camera
from machine import Pin,PWM
# initialize the camera to read 96x96 pixel gray scale images
try:
# unco... | 29.2875 | 96 | 0.745198 | [
"MIT"
] | TGiles1998/tensorflow-micropython-examples | examples/person_detection/esp32-cam/person_detection_cam.py | 2,343 | Python |
import torch
import torch.nn as nn
import torch.nn.functional as F
from .base_model import BaseModel
# F.max_pool2d needs kernel_size and stride. If only one argument is passed,
# then kernel_size = stride
from .audio import MelspectrogramStretch
from torchparse import parse_cfg
# Architecture inspiration from: htt... | 32.992806 | 91 | 0.551025 | [
"MIT"
] | Moon-sung-woo/Audio_classification_CRNN | net/model.py | 4,586 | Python |
"""
Ballastsolver
"""
"""
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/.
Ruben de Bruin - 2019
"""
from DAVE.gui.dockwidget import *
from PySide2 import QtGui, QtC... | 35.330097 | 162 | 0.684804 | [
"MPL-2.0",
"MPL-2.0-no-copyleft-exception"
] | HESChristof/DAVE | src/DAVE/gui/widget_ballastsolver.py | 3,639 | Python |
# Copyright (c) 2016 Shunta Saito
import os
import chainer.functions as F
import chainer.links as L
from chainer import Chain
from chainer import Variable
from chainer import cuda
from chainer import initializers
from chainer import reporter
from models.bbox_transform import bbox_transform_inv
from models.bbox_transf... | 38.899441 | 79 | 0.590694 | [
"MIT"
] | Walter1218/Self_Driving_Car_ND | faster_rcnn_explorer/models/faster_rcnn.py | 6,963 | Python |
import tensorflow as tf
if tf.__version__ > '2':
import tensorflow.compat.v1 as tf
import model
def top_k_logits(logits, k):
if k == 0:
# no truncation
return logits
def _top_k():
values, _ = tf.nn.top_k(logits, k=k)
min_values = values[:, -1, tf.newaxis]
return tf... | 32.94898 | 122 | 0.578198 | [
"MIT"
] | gkswjdzz/gpt-2-model-generator | src/sample.py | 3,229 | Python |
# backend/server/apps/endpoints/serializers.py file
from rest_framework import serializers
from apps.endpoints.models import Endpoint
from apps.endpoints.models import MLAlgorithm
from apps.endpoints.models import MLAlgorithmStatus
from apps.endpoints.models import MLRequest
class EndpointSerializer(serializers.ModelS... | 33.740741 | 107 | 0.622393 | [
"MIT"
] | netoferraz/tutorial_deploy_ml_service | backend/server/apps/endpoints/serializers.py | 1,822 | Python |
"""Utilities for generating synthetic segmentation datasets."""
import os
from typing import Tuple
from pathlib import Path
import numpy as np
from skimage.draw import random_shapes
from skimage.transform import rotate
from skimage.io import imsave
def gen_shape_image(im_size: Tuple[int, int], max_shapes: int=10, o... | 39.847458 | 109 | 0.6661 | [
"MIT"
] | dylanv/unet | unet/data/synthetic_data.py | 2,351 | Python |
from .predict_binary_class import predict_binary_class
from .predict_multi_class import predict_multi_class
| 36 | 54 | 0.907407 | [
"MIT"
] | dvats/bnn_mcmc_examples | bnn_mcmc_examples/inference/__init__.py | 108 | Python |
#!/usr/bin/env python
import sys, json, yaml, requests, random, io
import pkg_resources
from termcolor import colored
from urllib import parse
# This line is for pyinstaller and the binary release
##VERSION_PARSE##
if 'version' not in vars():
version = pkg_resources.require("majime")[0].version
def getopts(argv)... | 32.750877 | 167 | 0.52357 | [
"MIT"
] | u1i/majime | majime/__main__.py | 9,334 | Python |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.8 on 2017-11-21 09:22
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('cms', '0058_auto_20171110_1230'),
]
operations = [
migrations.AlterModelOpt... | 31.966667 | 257 | 0.591241 | [
"BSD-3-Clause"
] | jayvdb/bluebottle | bluebottle/cms/migrations/0059_auto_20171121_1022.py | 959 | Python |
import pyb
led = pyb.LED(4)
brightness = 0
fade_amount = 5
while True:
led.intensity(brightness)
brightness += fade_amount
pyb.delay(30)
if brightness > 255 or brightness < 0:
fade_amount *= -1
| 15 | 41 | 0.685714 | [
"MIT"
] | Anthlis/MicroPython-Quickstart-Scripts | 01.LEDs/fade.py | 210 | Python |
import discord
from redbot.core import commands
import datetime
import aiohttp
import asyncio
import json
import re
from typing import Optional
class Conversions(getattr(commands, "Cog", object)):
"""
Gather information about various crypto currencies,
rare metals, stocks, and converts to differen... | 45.423174 | 107 | 0.580769 | [
"MIT"
] | Jintaku/Trusty-cogs | conversions/conversions.py | 18,051 | Python |
from pythonosc.udp_client import SimpleUDPClient
ip = "127.0.0.1"
port = 53000
client = SimpleUDPClient(ip, port)
client.send_message("/new", "text")
client.send_message("/cue/selected/text/format/color", [1, 1, 0, 1])
| 20.272727 | 68 | 0.721973 | [
"MIT"
] | bozi6/hello-world | osctests/testingosc.py | 223 | Python |
from django.db import models
from django.utils.translation import ugettext_lazy as _
from wagtail.core.models import Page
from wagtail.admin.edit_handlers import FieldPanel
from wagtailtextanalysis.text_analysis import (
TextAnalysis,
KeyPhrasesField,
SentimentField,
)
class ArticlePage(Page, TextAnalysi... | 29.837838 | 81 | 0.735507 | [
"MIT"
] | marteinn/wagtail-text-analysis | wagtailtextanalysis/tests/demosite/models.py | 1,104 | Python |
"""Analysis of a repository for needed Python updates."""
from __future__ import annotations
import logging
import subprocess
from typing import TYPE_CHECKING
from git import Repo
from neophile.analysis.base import BaseAnalyzer
from neophile.exceptions import UncommittedChangesError
from neophile.update.python impo... | 30.009174 | 78 | 0.578722 | [
"MIT"
] | lsst-sqre/neophile | src/neophile/analysis/python.py | 3,271 | Python |
if 0:
for i in range(1,11):
print(i) | 16.666667 | 26 | 0.46 | [
"MIT"
] | ZhouBo20171229/- | test.py | 50 | Python |
import unittest
import zserio
from testutils import getZserioApi
class UnionConstraintsTest(unittest.TestCase):
@classmethod
def setUpClass(cls):
cls.api = getZserioApi(__file__, "constraints.zs").union_constraints
def testReadCorrectConstraints(self):
value8 = self.VALUE8_CORRECT_CONSTRA... | 38.465116 | 100 | 0.726421 | [
"BSD-3-Clause"
] | chenpeihua/zserio | test/language/constraints/python/UnionConstraintsTest.py | 3,308 | Python |
import numpy as np
import sys
path = sys.argv[1]
points = []
curves = []
polygons = []
with open(path, 'r') as f:
line = f.readline()
while line:
line = line.strip()
if len(line) <= 0:
line = f.readline()
continue
tokens = line.split(' ')
if tokens[0] =... | 28.662162 | 102 | 0.466289 | [
"MPL-2.0",
"MPL-2.0-no-copyleft-exception"
] | Yixin-Hu/TriWild | python/toeps.py | 2,121 | Python |
import re
from streamlink.plugin import Plugin
from streamlink.plugin.api import http, validate
from streamlink.stream import HTTPStream, HDSStream, RTMPStream
MEDIA_URL = "http://www.ardmediathek.de/play/media/{0}"
SWF_URL = "http://www.ardmediathek.de/ard/static/player/base/flash/PluginFlash.swf"
HDCORE_PARAMETER =... | 32.893939 | 83 | 0.546983 | [
"BSD-2-Clause"
] | nxkbd/streamlink | src/streamlink/plugins/ard_mediathek.py | 4,342 | Python |
label = 'spss'
def add_steps(steps: list, pipeline_id: str, config: dict) -> list:
steps.append(('spss.add_spss', {
'source': config['url']
}))
return steps
| 18 | 67 | 0.594444 | [
"MIT"
] | frictionlessdata/pilot-ukds | datapackage_pipelines_ukds/pipeline_steps/spss.py | 180 | Python |
import warnings
import numpy as np
from scipy import signal
from scipy import stats
import matplotlib.pylab as plt
class SpikeCalcsGeneric(object):
"""
Deals with the processing and analysis of spike data.
Parameters
----------
spike_times : array_like
The times of 'spikes' in the trial
... | 36.713198 | 98 | 0.560733 | [
"MIT"
] | rhayman/ephysiopy | ephysiopy/common/spikecalcs.py | 28,930 | Python |
from .sql import SQL
from .sac import SAC
from .drsac import DRSAC
| 16.75 | 24 | 0.776119 | [
"MIT"
] | bandofstraycats/dr-sac | softlearning/algorithms/__init__.py | 67 | Python |
#!/Users/akshayiyer/Dev/GitHub/udacity-dend/udacity-dend-capstone-etl/bin/python3.7
# $Id: rst2odt.py 5839 2009-01-07 19:09:28Z dkuhlman $
# Author: Dave Kuhlman <dkuhlman@rexx.com>
# Copyright: This module has been placed in the public domain.
"""
A front end to the Docutils Publisher, producing OpenOffice documents... | 26.741935 | 83 | 0.757539 | [
"MIT"
] | aiyer16/udacity-dend-capstone-etl | bin/rst2odt.py | 829 | Python |
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not... | 40.839695 | 109 | 0.67028 | [
"Apache-2.0",
"BSD-2-Clause",
"MIT",
"ECL-2.0",
"BSD-3-Clause"
] | alphasights/airflow | airflow/providers/amazon/aws/transfers/mysql_to_s3.py | 5,350 | Python |
class Vec2:
def __init__(self, x, y):
self.x = x
self.y = y
@property
def xy(self):
return self.x, self.y
| 15.888889 | 29 | 0.496503 | [
"MIT"
] | GitRenhl/PyxelControllerTest | src/vector2.py | 143 | Python |
# Copyright 2020 The TensorFlow Probability 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 o... | 33.726027 | 78 | 0.680747 | [
"Apache-2.0"
] | 8bitmp3/probability | spinoffs/oryx/oryx/util/summary_test.py | 2,462 | Python |
# -*- coding: utf-8 -*-
# Copyright (c) 2014, Vispy Development Team.
# Distributed under the (new) BSD License. See LICENSE.txt for more info.
import numpy as np
from numpy.testing import assert_allclose
from vispy.util.transforms import (translate, scale, rotate, ortho, frustum,
pe... | 34.813953 | 76 | 0.637275 | [
"BSD-3-Clause"
] | izaid/vispy | vispy/util/tests/test_transforms.py | 1,497 | Python |
###############################################################################
#
# Tests for libxlsxwriter.
#
# Copyright 2014-2019, John McNamara, jmcnamara@cpan.org
#
import base_test_class
class TestCompareXLSXFiles(base_test_class.XLSXBaseTest):
"""
Test file created with libxlsxwriter against a file cre... | 25.619048 | 79 | 0.637546 | [
"BSD-3-Clause"
] | White-116/xlsxd | libxlsxwriter/test/functional/test_chart_up_down_bars.py | 538 | Python |
import importlib.util
import sys
class VendorImporter:
"""
A PEP 302 meta path importer for finding optionally-vendored
or otherwise naturally-installed packages from root_name.
"""
def __init__(self, root_name, vendored_names=(), vendor_pkg=None):
self.root_name = root_name
self.... | 32.649351 | 84 | 0.604614 | [
"Unlicense"
] | MARTIN-OMOLLO/PITCH | virtual/lib/python3.8/site-packages/setuptools/extern/__init__.py | 2,514 | Python |
from django.db import models
from django.contrib.auth import models as authmodels
from django.conf import settings
import os.path
# Models for file attachments uploaded to the site
# basically just a simple container for files
# but allowing for replacement of previously uploaded files
class Attachment(models.Model):... | 26.185185 | 67 | 0.751061 | [
"BSD-3-Clause"
] | Signbank/Global-signbank | signbank/attachments/models.py | 707 | Python |
import pandas as pd
import numpy as np
import math
from pandasql import sqldf
def add_expression_column(table, new_cols, formulas, expr_type='sqlite'):
_table = table.copy()
print(locals())
for nc, f in zip(new_cols, formulas):
if expr_type == 'sqlite':
_table[nc] = sqldf('select ... | 38.5 | 171 | 0.614342 | [
"Apache-2.0"
] | GSByeon/studio | function/python/brightics/function/extraction/add_expression_column.py | 1,771 | Python |
import os
from WMCore.Configuration import Configuration
from CRABClient.UserUtilities import config, getUsernameFromCRIC
config = Configuration()
config.section_("General")
config.General.requestName = '2017_tt_SL-HDAMPdown'
config.General.transferOutputs = True
config.General.transferLogs = True
config.section_("Jo... | 42.5 | 186 | 0.778824 | [
"Apache-2.0"
] | NJManganelli/FourTopNAOD | Kai/crab/NANOv7_NoveCampaign/2017/crab_cfg_2017_tt_SL-HDAMPdown.py | 1,700 | Python |
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""Test tools package alone which don't fit into other tests."""
#
# (C) Pywikibot team, 2016-2017
#
# Distributed under the terms of the MIT license.
from __future__ import absolute_import, unicode_literals
import collections
import decimal
import inspect
import os.path
impor... | 35.620164 | 93 | 0.611671 | [
"MIT"
] | nasqueron/pywikibot | tests/tools_tests.py | 30,396 | Python |
import logging
logging.basicConfig(filename='mywarninglog.txt',level=logging.WARNING)
print("Displaying Warning level demo: ")
logging.debug('Debug message')
logging.info('Info message')
logging.warning('Warning message')
logging.error('Error message')
logging.critical('Critical message')
| 30 | 71 | 0.773333 | [
"MIT"
] | bpbpublications/Programming-Techniques-using-Python | Chapter 05/Chap05_Example5.11.py | 300 | Python |
import os
import posixpath
import re
from poetry.packages.constraints.constraint import Constraint
from poetry.packages.constraints.multi_constraint import MultiConstraint
from poetry.packages.constraints.union_constraint import UnionConstraint
from poetry.semver import Version
from poetry.semver import VersionUnion
f... | 25.947137 | 86 | 0.582343 | [
"MIT"
] | jancespivo/poetry | poetry/packages/utils/utils.py | 5,890 | Python |
'''
Using aws fargate to run a fmriprep. Uses our own docker image, which contains a wrapper to download the data from S3 and push it back again.
Rhodri Cusack TCIN 2021-06, cusackrh@tcd.ie
'''
from ecs_control import register_task, run_task, wait_for_completion
import boto3
import msgpack
import msgpack_numpy as m
f... | 36.606061 | 150 | 0.70447 | [
"MIT"
] | rhodricusack/docker-foundcog-adult-pilot | fmriprep-cusacklab-queue-subjects.py | 1,208 | Python |
from scipy.sparse.linalg import LinearOperator,onenormest,aslinearoperator
from .expm_multiply_parallel_wrapper import (_wrapper_expm_multiply,
_wrapper_csr_trace,_wrapper_csr_1_norm)
from scipy.sparse.construct import eye
from scipy.sparse.linalg._expm_multiply import _fragment_3_1,_exact_1_norm
import scipy.sparse a... | 35.486577 | 247 | 0.60104 | [
"BSD-3-Clause"
] | markusschmitt/QuSpin | quspin/tools/expm_multiply_parallel_core/expm_multiply_parallel_core.py | 10,575 | Python |
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not us... | 36.066055 | 100 | 0.519576 | [
"Apache-2.0"
] | Flyangz/spark | python/pyspark/pandas/frame.py | 460,380 | Python |
# -*- coding: utf-8 -*-
class C:
a = 'abc'
def __getattribute__(self, args):
print('__getattribute_ is called')
#import pdb; pdb.set_trace()
#return object.__getattribute__(self, args)
return super().__getattribute__(args)
def __getattr__(self, name):
print('__getattr()__ is called')
return name+ 'from ... | 26.72 | 58 | 0.670659 | [
"MIT"
] | asuraswrath/pysample | app/getattrtest.py | 668 | Python |
# -------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
# --------------------------------------------------------------------------
"""Module ... | 34.958531 | 87 | 0.616065 | [
"MIT"
] | Dqirvin/msticpy | msticpy/nbtools/timeline.py | 29,505 | Python |
img_size = 84
img_norm_cfg = dict(
mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375], to_rgb=True)
test_pipeline = [
dict(type='LoadImageFromBytes'),
dict(type='Resize', size=(int(img_size * 1.15), -1)),
dict(type='CenterCrop', crop_size=img_size),
dict(type='Normalize', **img_norm_cfg),
... | 36.484375 | 79 | 0.627409 | [
"Apache-2.0"
] | BIGWangYuDong/mmfewshot | configs/classification/_base_/meta_test/tiered-imagenet_meta-test_5way-1shot.py | 2,335 | Python |
import logging
import os
import platform
import subprocess
from xml.dom import minidom
from xml.etree import ElementTree
_RESOURCE_DIR = '../resources'
_INKSCAPE = None
_FFMPEG = None
_BASENAME = 'napkin'
_NAMESPACE = 'nap::qt'
def findAppInWindows(appexe):
try:
import winreg
except ImportError:
... | 25.292929 | 104 | 0.55611 | [
"MPL-2.0",
"MPL-2.0-no-copyleft-exception"
] | AartOdding/nap | tools/napkin/tools/prepareresources.py | 5,008 | Python |
#!/usr/bin/env python3
# Copyright (c) 2012-2021 The PIVX developers
# Copyright (c) 2020-2021 The PENGOLINCOIN developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Simple test checking chain movement after v5 enforcement.... | 39.933333 | 101 | 0.717863 | [
"MIT"
] | pengolincoin/PengolinCoin-Core | test/functional/mining_v5_upgrade.py | 1,198 | Python |
import uuid
from django.db import models
from django.utils.translation import gettext_lazy
from modelcluster.fields import ParentalKey
from wagtail.admin.edit_handlers import (
FieldPanel,
InlinePanel,
ObjectList,
PageChooserPanel,
StreamFieldPanel,
TabbedInterface,
)
from wagtail.core import b... | 33.007937 | 88 | 0.726136 | [
"BSD-3-Clause"
] | dinoperovic/wagtail-localize | wagtail_localize/test/models.py | 16,636 | Python |
#!/usr/bin/env python3
# Copyright (c) 2013-2017 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
#
# Generate seeds.txt from Pieter's DNS seeder
#
NSEEDS=512
MAX_SEEDS_PER_ASN=2
MIN_BLOCKS = 615801
#... | 32.075581 | 186 | 0.567156 | [
"MIT"
] | BitHostCoin/BitHost | contrib/seeds/makeseeds.py | 5,517 | Python |
import fakeredis
import json
import mock
from app import bev
from app.cards import CARDS
class TestStartGame:
def test_start_with_two_players(self, two_player_game_unstarted):
fake_redis = fakeredis.FakeRedis()
fake_redis.set('cheers', json.dumps(two_player_game_unstarted))
bev.cache = f... | 35.030552 | 124 | 0.475429 | [
"MIT"
] | zachcalvert/card-games | cribbage/app/tests/test_bev.py | 29,811 | Python |
"""
Base and utility classes for tseries type pandas objects.
"""
from __future__ import annotations
from datetime import datetime
from typing import (
TYPE_CHECKING,
Any,
Callable,
Sequence,
TypeVar,
cast,
final,
)
import warnings
import numpy as np
from pandas._libs import (
NaT,
... | 33.65309 | 87 | 0.580151 | [
"BSD-3-Clause"
] | DiligentDolphin/pandas | pandas/core/indexes/datetimelike.py | 23,961 | Python |
# -*- coding: utf-8 -*-
"""
__author__ = "Jani Yli-Kantola"
__copyright__ = ""
__credits__ = ["Harri Hirvonsalo", "Aleksi Palomäki"]
__license__ = "MIT"
__version__ = "1.3.0"
__maintainer__ = "Jani Yli-Kantola"
__contact__ = "https://github.com/HIIT/mydata-stack"
__status__ = "Development"
"""
from app.helpers import... | 24.357895 | 71 | 0.637424 | [
"MIT"
] | TamSzaGot/mydata-sdk | Account/app/mod_system/controller.py | 2,315 | Python |
import http
import json
from openbrokerapi import errors
from openbrokerapi.catalog import ServicePlan
from openbrokerapi.service_broker import Binding, BindDetails, BindResource, VolumeMount, SharedDevice, BindState, \
Service
from tests import BrokerTestCase
expected_credentials = {"uri": "mysql://mysqluser:pas... | 38.561254 | 119 | 0.572442 | [
"MIT"
] | eruvanos/openbrokerapi | tests/test_bind.py | 13,535 | Python |
# -*- coding: utf-8 -*-
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: gym.proto
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from google.protobuf import reflection as _reflection
from google.protobuf import symbol_database as _symbol_datab... | 40.885233 | 8,284 | 0.743127 | [
"Apache-2.0"
] | raphaelvrosa/gym | gym/common/protobuf/gym_pb2.py | 106,874 | Python |
# led_hello.py - blink external LED to test GPIO pins
# (c) BotBook.com - Karvinen, Karvinen, Valtokari
"led_hello.py - light a LED using Raspberry Pi GPIO"
# Copyright 2013 http://Botbook.com */
import time # <1>
import os # <2>
def writeFile(filename, contents): # <3>
with open(filename, 'w') as f: # <4>
f.wri... | 25.392857 | 64 | 0.655415 | [
"MIT"
] | AlexRogalskiy/Duino | getting-started-code-101/raspberrypi/led_hello/led_hello.py | 711 | Python |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from Nets.UNetBatchNorm import UNetBatchNorm
import tensorflow as tf
import numpy as np
from sklearn.metrics import mean_squared_error
from datetime import datetime
from optparse import OptionParser
from Data.ImageTransform import ListTransform
from Data.DataGenClass impor... | 41.148746 | 123 | 0.592483 | [
"MIT"
] | PeterJackNaylor/DRFNS | src_DummyDataSet/UNet_UNNormalized.py | 22,961 | Python |
import pytest
from plenum.common.constants import AUDIT_LEDGER_ID, AUDIT_TXN_VIEW_NO, AUDIT_TXN_PP_SEQ_NO, AUDIT_TXN_PRIMARIES
from plenum.common.messages.node_messages import Checkpoint, CheckpointState
from plenum.test.checkpoints.helper import cp_digest
from plenum.test.test_node import getNonPrimaryReplicas, getAl... | 43.97076 | 112 | 0.590637 | [
"Apache-2.0"
] | Toktar/indy-plenum | plenum/test/checkpoints/test_checkpoints_removal_after_catchup_during_view_change.py | 7,519 | Python |
import urllib3
import random
import string
from util.conf import CROWD_SETTINGS
from util.api.crowd_clients import CrowdRestClient
from util.project_paths import CROWD_USERS
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
USERS = "users"
DEFAULT_USER_PASSWORD = 'password'
DEFAULT_USER_PREFIX = ... | 25.824324 | 95 | 0.720565 | [
"Apache-2.0"
] | 213hans/dc-app-performance-toolkit | app/util/data_preparation/crowd_prepare_data.py | 1,911 | Python |
"""Tests for classes defining properties of ground domains, e.g. ZZ, QQ, ZZ[x] ... """
from sympy import S, sqrt, sin, oo, nan, Poly, Integer, Rational
from sympy.abc import x, y, z
from sympy.polys.domains import (ZZ, QQ, RR, CC, FF, GF,
PolynomialRing, FractionField, EX)
from sympy.polys.rings import ring
from... | 35.662602 | 122 | 0.605228 | [
"MIT"
] | 18padx08/PPTex | PPTexEnv_x86_64/lib/python2.7/site-packages/sympy/polys/domains/tests/test_domains.py | 26,319 | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.