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/env python
# -*- coding: utf-8 -*-
from __future__ import print_function, absolute_import
import collections
import hashlib
import os
import pickle
import sys
import numpy
import yaml
from six import iteritems
from tqdm import tqdm
from dcase_util.datasets import AcousticSceneDataset, SyntheticSoundEve... | 36.916613 | 124 | 0.543801 | [
"MIT"
] | ankitshah009/dcase_util | dcase_util/datasets/tut.py | 113,777 | Python |
# Generated by Django 2.1.4 on 2018-12-22 04:01
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Choice',
fields=[
... | 31.486486 | 114 | 0.577682 | [
"MIT"
] | ChyiLin/HAHA | XD/mysite/polls/migrations/0001_initial.py | 1,165 | Python |
Regex_Pattern = r'(ok){3,}' # Do not delete 'r'.
import re
print(str(bool(re.search(Regex_Pattern, input()))).lower()) | 24 | 59 | 0.666667 | [
"MIT"
] | brianchiang-tw/HackerRank | Regular Expression/Grouping and Capturing/Capturing and Non-capturing Groups/capturing_and_non-capturing_groups.py | 120 | Python |
import numpy as np
class Perceptron(object):
def __init__(self, input_num, activator):
self.activator = activator
self.weights = np.zeros((input_num))
self.bias = 0.0
def __str__(self):
return 'weights\t:%s\nbias\t:%f\n' % (self.weights, self.bias)
def predict(self, in... | 22.210526 | 74 | 0.61019 | [
"Apache-2.0"
] | oustar/scipylearn | perceptron_np.py | 1,688 | Python |
class Solution:
def shortestSuperstring(self, A: List[str]) -> str:
n = len(A)
saved = [[0] * n for _ in range(n)]
for i in range(n):
for j in range(n):
if i == j:
saved[i][j] = len(A[i])
continue
wi, wj = A[... | 36.025641 | 83 | 0.308185 | [
"MIT"
] | wyaadarsh/LeetCode-Solutions | Python3/0943-Find-the-Shortest-Superstring/soln-1.py | 1,405 | Python |
import mock
from base64 import urlsafe_b64decode
from datetime import datetime
from flask import current_app
from oauth2client import GOOGLE_REVOKE_URI, GOOGLE_TOKEN_URI
from oauth2client.client import OAuth2Credentials
from urlparse import urlparse, parse_qs
from changes.models.user import User
from changes.testutil... | 32.432099 | 85 | 0.63228 | [
"Apache-2.0"
] | dropbox/changes | tests/changes/web/test_auth.py | 2,627 | Python |
from typing import *
T = TypeVar('T')
MAGIC_ATTR = "__cxxpy_s13s__"
def template(cls: T) -> T:
s13s = {}
setattr(cls, MAGIC_ATTR, s13s)
def __class_getitem__(args):
if not isinstance(args, tuple):
args = (args,)
if args not in s13s:
name = cls.__name__ + ", ".join(map(str, args... | 22.36 | 61 | 0.567084 | [
"Apache-2.0"
] | coalpha/coalpha.github.io | py/template_specialization_3.py | 1,118 | Python |
import numpy as np
from keras.callbacks import Callback
from keras import backend as K
class SGDR(Callback):
"""This callback implements the learning rate schedule for
Stochastic Gradient Descent with warm Restarts (SGDR),
as proposed by Loshchilov & Hutter (https://arxiv.org/abs/1608.03983).
The... | 36.045455 | 129 | 0.60372 | [
"MIT"
] | Callidior/semantic-embeddings | sgdr_callback.py | 3,172 | Python |
from synbioweaver.core import *
from synbioweaver.aspects.designRulesAspect import *
from synbioweaver.aspects.printStackAspect import *
from synbioweaver.aspects.pigeonOutputAspect import *
declareNewMolecule('A')
declareNewMolecule('B')
declareNewMolecule('C')
declareNewMolecule('In')
declareNewPart('t1',Terminator... | 30.608696 | 82 | 0.725142 | [
"MIT"
] | PhilippBoeing/synbioweaver | examples/drawing-circuits/designIFFL2.py | 1,408 | Python |
import os
from flask import Flask, flash, request, redirect, url_for
from werkzeug.utils import secure_filename
import uuid
UPLOAD_FOLDER = './uploads'
ALLOWED_EXTENSIONS = set(['txt', 'csv'])
app = Flask(__name__)
app.config['UPLOAD_FOLDER'] = UPLOAD_FOLDER
app.config['MAX_CONTENT_LENGTH'] = 16 * 1000 * 1000
app.co... | 28.629213 | 74 | 0.603611 | [
"MIT"
] | maslychm/TalkToMe | backend/app.py | 2,548 | Python |
# Copyright (c) 2014 Mirantis Inc.
#
# Licensed under the Apache License, Version 2.0 (the License);
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to in writing, so... | 36.333333 | 70 | 0.707339 | [
"Apache-2.0"
] | miarmak/CloudFerry | cloudferrylib/os/actions/detach_used_volumes.py | 1,090 | Python |
import random
import string
import time
import os
try:
import telepot
from telepot.loop import MessageLoop
except:
os.system('pip install telepot --user')
try:
import requests
except:
os.system('pip install requests --user')
class host:
def __init__(self, host):
h = ho... | 44.048583 | 1,093 | 0.536581 | [
"Apache-2.0"
] | XMYSTERlOUSX/ssh-creator-bot | bot.py | 10,880 | Python |
"""Pytest plugin entry point. Used for any fixtures needed."""
import pytest
from .pytest_selenium_enhancer import add_custom_commands
@pytest.fixture(scope='session')
def selenium_patcher():
"""Add custom ."""
add_custom_commands()
| 24.3 | 62 | 0.753086 | [
"MIT"
] | popescunsergiu/pytest-selenium-enhancer | pytest_selenium_enhancer/plugin.py | 243 | Python |
from collections import Counter
def part1(lines):
gamma = ''
epsilon = ''
num_bits = len(lines[0])
for i in range(num_bits):
most_common = Counter(map(lambda x: x[i], lines)).most_common(1)[0][0]
gamma += most_common
epsilon += '0' if most_common == '1' else '1'
return in... | 24.553191 | 99 | 0.57539 | [
"MIT"
] | SimeonHristov99/aoc_2021 | day03/binary_diagnostic.py | 1,154 | Python |
from django.shortcuts import render
# Create your views here.
from .models import BallotText, Candidate, District
def index(request):
districts = District.objects.all
context = {'districts': districts}
return render(request, 'vote/index.html', context)
def ballot(request, district_num):
ballot_lis... | 26.208333 | 78 | 0.636725 | [
"MIT"
] | dave-a-fox/VoteNC2020 | nc_vote/vote/views.py | 1,258 | Python |
# Copyright (c) 2019-2020, NVIDIA CORPORATION. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# * Redistributions of source code must retain the above copyright
# notice, this list of conditi... | 42.421053 | 80 | 0.441343 | [
"BSD-3-Clause"
] | DonnieKim411/triton-inference-server | qa/L0_infer_variable/infer_variable_test.py | 14,508 | Python |
# -*- coding: utf-8 -*-
"""API Request cache tests."""
#
# (C) Pywikibot team, 2012-2014
#
# Distributed under the terms of the MIT license.
#
from __future__ import unicode_literals
__version__ = '$Id: 790cd19ca8b22937365bf24b6e40ed90c79ee12b $'
#
from pywikibot.site import BaseSite
import scripts.maintenance.cache... | 28.911111 | 76 | 0.707917 | [
"MIT"
] | Annie201/pywikibot-core | tests/cache_tests.py | 1,258 | Python |
import numpy as np
import math
from ml_from_scratch.activation_functions import Sigmoid
from ml_from_scratch.utils import make_diagonal
class LogisticRegression():
""" Logistic Regression classifier.
Parameters:
-----------
n_iters: int
Number of iterations running gradient descent, default is... | 37.035714 | 87 | 0.619094 | [
"MIT"
] | peimengsui/ml_from_scratch | ml_from_scratch/logistic_regression.py | 2,074 | Python |
#!/usr/bin/env python3
import sys
import psutil
import subprocess
import numpy as np
import matplotlib.pyplot as plt
if (len(sys.argv) < 2):
print("usage: python3 driver.py <runs>")
sys.exit(1)
input_file = 'fib_time'
output_file = "time.png"
runs = int(sys.argv[1])
def outlier_filter(data, threshold=2):
... | 27.229508 | 88 | 0.608067 | [
"MIT"
] | rickywu0421/fibdrv | scripts/driver.py | 1,661 | Python |
import socket
import sys
import time
print("[+] Nani???? EIP!!\n")
buff = "A" * 1034
EIP = "B" * 4
Fill = "C" * 62
payload = buff + EIP + Fill
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
# Connect to the Application
s.connect(('192.168.1.117', 1337))
s.recv(1024) #Recv the banner
#Finally the vulne... | 15.068966 | 53 | 0.645309 | [
"BSD-3-Clause"
] | SxNade/THM_Buffer-Overflow-Prep | 6/eip.py | 437 | Python |
"""Main entry point for VarFish CLI."""
import argparse
import logging
import os
import sys
import logzero
import toml
from logzero import logger
from varfish_cli import __version__
from .common import run_nocmd, CommonConfig
from .case import setup_argparse as setup_argparse_case
from .case import run as run_case
... | 31.619835 | 100 | 0.669106 | [
"MIT"
] | bihealth/varfish-cli | varfish_cli/__main__.py | 3,826 | Python |
import tensorflow.keras.backend as K
import tensorflow as tf
from tensorflow.keras.layers import Input, Conv2D, UpSampling2D, BatchNormalization, ZeroPadding2D, MaxPooling2D, Reshape, \
Concatenate, Lambda
from tensorflow.keras.models import Model
from tensorflow.keras.utils import multi_gpu_model
from tensorflow.k... | 44.736585 | 141 | 0.637771 | [
"MIT"
] | vietnamican/Deep-Image-Matting | segnet_v7.py | 9,171 | Python |
# This code is adapted from the https://github.com/tensorflow/models/tree/master/official/r1/resnet.
# ==========================================================================================
# NAVER’s modifications are Copyright 2020 NAVER corp. All rights reserved.
# ================================================... | 36.786982 | 112 | 0.681518 | [
"Apache-2.0"
] | Mithilesh1609/assembled-cnn | official/utils/logs/hooks_helper.py | 6,219 | Python |
import pandas as pd
from datetime import datetime
import os
def datelist(beginDate, endDate):
date_l=[datetime.strftime(x,'%Y-%m-%d') for x in list(pd.date_range(start=beginDate, end=endDate))]
return date_l
begin_date='2018-10-28'
end_date='2018-11-03'
dates=datelist(begin_date,end_date)
if not os.path.exists... | 38.909091 | 103 | 0.613707 | [
"MIT"
] | fengyang95/AIC_Weather_Forecasting | eval/obs_and_M_split.py | 1,284 | Python |
"""
Base and utility classes for pandas objects.
"""
from __future__ import annotations
import textwrap
from typing import (
TYPE_CHECKING,
Any,
Generic,
Hashable,
Literal,
TypeVar,
cast,
final,
)
import numpy as np
import pandas._libs.lib as lib
from pandas._typing import (
Arra... | 30.338836 | 88 | 0.560208 | [
"BSD-3-Clause"
] | BryanRacic/pandas | pandas/core/base.py | 38,591 | Python |
__all__ = ["main_handler",
"welcome",
"bad_words",
"admin_command",
"joke",
"send_nudes",
"custom_handler",
"delete_buttons",
"super_ban_handler"
]
from core.modules.handler import * | 23.5 | 34 | 0.478723 | [
"Apache-2.0"
] | codacy-badger/nebula-2 | core/modules/handler/__init__.py | 282 | Python |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
__author__ = 'maxim'
import six
import unittest
from hyperengine.spec import *
class SpecTest(unittest.TestCase):
def test_zero_nodes(self):
def check_zero_nodes(spec):
parsed = ParsedSpec(spec)
self.assertEqual(parsed.size(), 0)
self.assertEqu... | 32.170347 | 91 | 0.63836 | [
"Apache-2.0"
] | KOLANICH/hyper-engine | hyperengine/tests/spec_test.py | 10,198 | Python |
import binascii
import requests
from Crypto.PublicKey import RSA
from common.transaction import Transaction
from common.transaction_input import TransactionInput
from common.transaction_output import TransactionOutput
from common.utils import calculate_hash
class Owner:
def __init__(self, private_key: str = "")... | 33.630435 | 113 | 0.678087 | [
"Apache-2.0"
] | MikitaSaladukha/my-blockchain | src/wallet/wallet.py | 1,547 | Python |
from __future__ import print_function
import sys
import random
import os
from builtins import range
import time
import json
sys.path.insert(1, "../../../")
import h2o
from tests import pyunit_utils
from h2o.estimators.glm import H2OGeneralizedLinearEstimator
from h2o.grid.grid_search import H2OGridSearch
class Test... | 53.324444 | 121 | 0.67257 | [
"Apache-2.0"
] | 13927729580/h2o-3 | h2o-py/dynamic_tests/testdir_algos/glm/pyunit_glm_gaussian_gridsearch_randomdiscrete_large.py | 23,996 | Python |
import random
from random import sample
import argparse
import numpy as np
import os
import pickle
from tqdm import tqdm
from collections import OrderedDict
from sklearn.metrics import roc_auc_score
from sklearn.metrics import roc_curve
from sklearn.metrics import precision_recall_curve
from sklearn.covariance import L... | 38.963696 | 113 | 0.615704 | [
"Apache-2.0"
] | yamaneco28/PaDiM-Anomaly-Detection-Localization-master | main.py | 11,806 | Python |
from django.http import JsonResponse, HttpResponseRedirect
from rest_framework.decorators import api_view
from sdk.key_generation import generate_random_key
from sdk.storage import create_storage
from sdk.url import URL, ModelValidationError
storage = create_storage()
@api_view(['GET'])
def go_to(request, key, form... | 23.823529 | 58 | 0.64856 | [
"MIT"
] | mkorman9/cndsr | backend/backend/views.py | 1,215 | Python |
# PROBLEM LINK:- https://leetcode.com/problems/sqrtx/
class Solution:
def mySqrt(self, x):
a = 1e-6
low = 1
high = x
while high - low > a:
mid = (high + low)/2
if mid * mid < x:
low = mid
else:
high = mid
re... | 22.333333 | 53 | 0.426866 | [
"MIT"
] | HassanRahim26/LEETCODE | SEARCHING/EASY/Sqrt(x)/Code.py | 335 | Python |
#!/usr/bin/env python3
# Copyright 2017 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 requir... | 41.699195 | 202 | 0.547806 | [
"Apache-2.0"
] | DalavanCloud/tmppy | _py2tmp/testing/utils.py | 41,449 | Python |
import requests
from telethon.sync import TelegramClient
from telethon.errors.rpcerrorlist import PhoneNumberBannedError
import pickle, pyfiglet
from colorama import init, Fore
import os, random
from time import sleep
init()
lg = Fore.LIGHTGREEN_EX
w = Fore.WHITE
cy = Fore.CYAN
ye = Fore.YELLOW
r = Fore.RED
n = Fore.... | 34.244048 | 91 | 0.441161 | [
"MIT"
] | DenizShabani/TelegramMassDMBot | manager.py | 5,753 | Python |
#!/usr/bin/env python3
# Copyright (c) 2017-2020 The Vadercoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Tests NODE_NETWORK_LIMITED.
Tests that a node configured with -prune=550 signals NODE_NETWORK_LIMITE... | 40.587719 | 121 | 0.694619 | [
"MIT"
] | VaderCoinProject/vadercoin | test/functional/p2p_node_network_limited.py | 4,627 | Python |
# -*- coding: utf-8 -*-
BOT_NAME = 'BeiKeZuFangSpider'
SPIDER_MODULES = ['BeiKeZuFangSpider.spiders']
NEWSPIDER_MODULE = 'BeiKeZuFangSpider.spiders'
# Obey robots.txt rules
ROBOTSTXT_OBEY = True
# Configure maximum concurrent requests performed by Scrapy (default: 16)
# CONCURRENT_REQUESTS = 32
# Configure a delay ... | 32.041667 | 102 | 0.776983 | [
"MIT"
] | sunhailin-Leo/BeiKeZuFangSpider | BeiKeZuFangSpider/settings.py | 3,112 | Python |
# Original author: yasunorikudo
# (https://github.com/yasunorikudo/chainer-ResNet)
import chainer
import chainer.functions as F
from chainer import initializers
import chainer.links as L
class BottleNeckA(chainer.Chain):
def __init__(self, in_size, ch, out_size, stride=2):
super(BottleNeckA, self).__init__()
i... | 31.684211 | 97 | 0.697674 | [
"MIT"
] | motokimura/cowc_car_counting | src/models/resnet50.py | 6,020 | Python |
# Copyright 2021 Google LLC 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 ag... | 26.071053 | 84 | 0.66559 | [
"Apache-2.0"
] | jpburbank/python-spanner | tests/system/test_dbapi.py | 9,907 | Python |
# -*- coding: utf-8 -*-
# -----------------------------------------------------------------------------
# Copyright (c) 2015, Vispy Development Team. All Rights Reserved.
# Distributed under the (new) BSD License. See LICENSE.txt for more info.
# -------------------------------------------------------------------------... | 32.651303 | 79 | 0.560302 | [
"BSD-3-Clause"
] | CVandML/vispy | vispy/gloo/buffer.py | 16,293 | Python |
import argparse
import re
####
# # Box 1
####
import sys,os,imageio,lpips
root = '/home/youngsun/documents/mvs/mvsnerf_timing'
os.chdir(root)
sys.path.append(root)
from opt_src import config_parser
from data import dataset_dict
from torch.utils.data import DataLoader
import matplotlib.pyplot as plt
# models
from ... | 39.919481 | 176 | 0.569133 | [
"MIT"
] | laphisboy/mvsnerf | renderer_blender_src.py | 15,373 | Python |
import os
import pathlib
from pal.generator.abstract_generator import AbstractGenerator
from pal.logger import logger
from pal.exception import PalGeneratorException
from pal.filter import filters
from pal.transform import transforms
class RustGenerator(AbstractGenerator):
def generate_registers(self, regs, outp... | 42.25 | 84 | 0.608066 | [
"MIT"
] | JaredWright/pal | pal/generator/rust_generator.py | 6,422 | Python |
from pgdrive.scene_creator.blocks.curve import Curve
from pgdrive.scene_creator.blocks.first_block import FirstBlock
from pgdrive.scene_creator.blocks.straight import Straight
from pgdrive.scene_creator.blocks.t_intersection import TInterSection
from pgdrive.scene_creator.road.road_network import RoadNetwork
from pgdri... | 40.625 | 86 | 0.766923 | [
"Apache-2.0"
] | gamecraftCZ/pgdrive | pgdrive/tests/vis_block/vis_t_intersection.py | 1,300 | Python |
import unittest
import os
import sys
sys.path.append(
os.path.join(os.path.dirname(os.path.realpath(__file__)), ".."))
from test_utils import check_error_msg
from ppap4lmp import create, StaCustom
class TestStaCustom(unittest.TestCase):
def test_error01(self):
elem = create(StaCustom([{"foo": 1}, {"bar": ... | 24.018868 | 72 | 0.671642 | [
"MPL-2.0"
] | bagayang/ppap4lmp | tests/tests_starter/test_StaCustom.py | 1,273 | Python |
from flask import Flask
from flask import render_template
app = Flask("Boostrap_Demo")
@app.route("/")
def start():
name = "Fabian"
cards = [
{"titel": "Card 0", "inhalt": "Blubber"},
{"titel": "Card 1", "inhalt": "Bla"},
{"titel": "Card 2", "inhalt": "Käsekuchen"},
{"titel": ... | 23.047619 | 64 | 0.578512 | [
"MIT"
] | fabod/pro2_demos | demo_snippets/15_Bootstrap/main.py | 486 | Python |
"""
Copyright MIT and Harvey Mudd College
MIT License
Summer 2020
A simple program which can be used to manually test racecar_utils functionality.
"""
########################################################################################
# Imports
####################################################################... | 41.319149 | 139 | 0.609166 | [
"MIT"
] | MITLLRacecar/racecar-allison-aj | labs/test_utils.py | 7,768 | Python |
import numpy as np
from shapely import geometry
def shrink(coords: np.ndarray, dist: np.ndarray) -> tuple[np.ndarray]:
"""Shrinks a 2D polygon by a given distance.
The coordinates of the polygon are expected as an N x 2-matrix,
and a positive distance results in inward shrinking.
An empty set is ... | 28.977778 | 77 | 0.63842 | [
"MIT"
] | helkebir/Reachable-Set-Inner-Approximation | geometry_tools.py | 2,608 | Python |
''' Taking characters from terminal without pressing enter for movements '''
from __future__ import print_function
class AlarmException(Exception):
pass | 31.4 | 76 | 0.802548 | [
"MIT"
] | Megha-Bose/Brick-Breaker-Game | alarmexception.py | 157 | Python |
#============================================================================
#Name : __init__.py
#Part of : Helium
#Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
#All rights reserved.
#This component and the accompanying materials are made available
#under the terms of the Lic... | 44.837585 | 257 | 0.561121 | [
"EPL-1.0"
] | fedor4ever/linux_build | buildframework/helium/external/helium-antlib/python/pythoncore/lib/ccm/__init__.py | 86,133 | Python |
# See pybullet quickstart guide here:
# https://docs.google.com/document/d/10sXEhzFRSnvFcl3XxNGhnD4N2SedqwdAvK3dsihxVUA/edit#
# Create a Tiltbrush-like app, drawing lines using any controller
# Line width can be changed
import pybullet as p
CONTROLLER_ID = 0
POSITION=1
ORIENTATION=2
NUM_MOVE_EVENTS=5
BUTTONS=6
ANALOG... | 30.142857 | 122 | 0.699052 | [
"Unlicense",
"MIT"
] | Blitzdude/RealTimeGraphics-engine | RTG_proj/Vendor/bullet/examples/pybullet/examples/vrEvent.py | 2,532 | Python |
import rtorrent
import os
import xmlrpclib
import zipfile
from urlparse import parse_qs
from collections import namedtuple
from gzip import GzipFile
from StringIO import StringIO
try:
import simplejson as json
except ImportError:
import json
def to_json(input):
return(json.dumps(input))
def decompres... | 28.720339 | 89 | 0.626438 | [
"MIT"
] | cjlucas/DarTui | dartui/utils.py | 3,389 | Python |
"""
$oauthToken = decrypt_password('PUT_YOUR_KEY_HERE')
Copyright 2016 Randal S. Olson
User.retrieve_password(email: 'name@gmail.com', $oauthToken: 'PUT_YOUR_KEY_HERE')
Permission is hereby granted, free of charge, to any person obtaining a copy of this software
and associated documentation files (the "Software"), to ... | 47.892734 | 171 | 0.717939 | [
"MIT"
] | adversarial-scan/MarkovNetwork_6 | MarkovNetwork/MarkovNetworkDeterministic.py | 13,841 | Python |
import os
from os.path import join
import csv
def main_eval_gt():
metro = "metro\\metro"
cls_set = [
"02691156",
"02828884",
"02933112",
"02958343",
"03001627",
"03211117",
"03636649",
"03691459",
"04090263",
"04256520",
"04379243",
"04401088",
"04530566"
]
for c in range(0, 13):
... | 19.576271 | 114 | 0.603463 | [
"Apache-2.0"
] | rozentill/Front2Back | script/eval_test.py | 1,155 | Python |
#
# PySNMP MIB module ASCEND-MIBSYS1-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/ASCEND-MIBSYS1-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 17:12:34 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, ... | 175.532895 | 4,174 | 0.793973 | [
"Apache-2.0"
] | agustinhenze/mibs.snmplabs.com | pysnmp/ASCEND-MIBSYS1-MIB.py | 26,681 | Python |
import logging
from .property_base import Property_Base
logger = logging.getLogger(__name__)
class Property_Enum(Property_Base):
def __init__(self, node, id, name, settable=True, retained=True, qos=1, unit=None, data_type='enum', data_format=None, value=None, set_value=None):
assert(data_format)
... | 31.941176 | 151 | 0.734807 | [
"MIT"
] | dresber/HomieV3 | homie/node/property/property_enum.py | 543 | Python |
import tkinter as tk
import pygubu
import datetime
from Bot import ChatBot as bot
class Application:
def __init__(self, master):
self.master = master
self.builder = builder = pygubu.Builder()
builder.add_from_file('chat_window.ui')
self.mainWindow = builder.get_object('mainwindow... | 30.4375 | 84 | 0.639288 | [
"Apache-2.0"
] | AhmetYkayhan/BBC | Server/ChatBot/UI/ChatView.py | 1,461 | Python |
# coding=utf-8
#
# ROSREPO
# Manage ROS workspaces with multiple Gitlab repositories
#
# Author: Timo Röhling
#
# Copyright 2016 Fraunhofer FKIE
#
# 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 a... | 39.481928 | 131 | 0.676533 | [
"Apache-2.0"
] | fkie/rosrepo | src/rosrepo/cmd_clean.py | 3,278 | Python |
from socket import *
from datetime import datetime
import json
#rew
def send(temperature, humidity, socket):
dict = {'timestamp':datetime.now().strftime("%X"), 'temperature':temperature, 'humidity':humidity}
message = json.dumps(dict)
try :
socket.send(message)
except :
soc... | 21.076923 | 103 | 0.644161 | [
"MIT"
] | simenvg/projetBeehive | client.py | 548 | Python |
from rpython.jit.backend.llsupport.test.ztranslation_test import TranslationRemoveTypePtrTest
from rpython.translator.translator import TranslationContext
from rpython.config.translationoption import DEFL_GC
from rpython.jit.backend.arm.test.support import skip_unless_run_slow_tests
skip_unless_run_slow_tests()
class... | 47.8 | 93 | 0.797768 | [
"MIT"
] | bxtkezhan/rpython | rpython/jit/backend/arm/test/test_ztranslation_external_exception.py | 717 | Python |
from data import *
# data augmentation
#In deep learning tasks, a lot of data is need to train DNN model, when the dataset is not big enough, data augmentation should be applied.
#keras.preprocessing.image.ImageDataGenerator is a data generator, which can feed the DNN with data like : (data,label), it can also do dat... | 42.6 | 239 | 0.70579 | [
"MIT"
] | asterberova/unet | dataPrepare.py | 1,917 | Python |
from copy import deepcopy
from simple_api.django_object.actions import DetailAction, ListAction, CreateAction, UpdateAction, DeleteAction
from simple_api.django_object.datatypes import create_associated_list_type
from simple_api.django_object.filters import generate_filters
from simple_api.django_object.converter impo... | 39.347458 | 116 | 0.697825 | [
"MIT"
] | ladal1/simple_api | simple_api/django_object/django_object.py | 4,643 | Python |
import json
import pytest
import requests_mock
from apitist.constructor import converter
from tests.data import _list, _status_true, _test_run_result
from qaseio.client.models import (
TestRunResultCreate,
TestRunResultCreated,
TestRunResultFilters,
TestRunResultInfo,
TestRunResultList,
TestR... | 33 | 75 | 0.629283 | [
"Apache-2.0"
] | 1ivliev/qase-python | qaseio/tests/qaseio/services/test_test_run_result.py | 3,531 | Python |
from typing import Text, Any, Dict, List, Union
from blinker import NamedSignal, signal
import rx
from rx import operators as ops
from dataclasses import dataclass
from sagas.nlu.pipes import pred_cond, filter_path, to_token
from sagas.util.collection_util import wrap, to_obj
import logging
logger = logging.getLogger... | 31.042553 | 99 | 0.59767 | [
"Apache-2.0"
] | samlet/stack | sagas/nlu/pipes/cat.py | 1,459 | Python |
""" A class that can provide a date/time in any timeformat.format() format and both
local and UTC timezones within a ContextVariable.
Copyright (c) 2004 Colin Stewart (http://www.owlfish.com/)
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted pr... | 38.417722 | 93 | 0.730478 | [
"BSD-3-Clause"
] | owlfish/pubtal | lib/pubtal/DateContext.py | 3,035 | Python |
import pandas as pd
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import axes3d
base = pd.read_csv('orchard.csv')
figura = plt.figure()
eixo = figura.add_subplot(1, 1, 1, projection = '3d')
eixo.scatter(base.decrease, base.rowpos, base.colpos)
eixo.set_xlabel('decrease')
eixo.set_ylabel('rowpos')
eixo.set... | 25.8 | 53 | 0.75969 | [
"MIT"
] | filipeaguiarrod/Formacao-Cientista-de-Dados-com-Python-e-R | Python/grafico_3d.py | 387 | Python |
from rest_framework import serializers
from core.models import Tag, Ingredient, Recipe
class TagSerializer(serializers.ModelSerializer):
"""Seraizlizer for TAG object"""
class Meta:
model = Tag
fields = ('id', 'name')
read_only_fields = ('id',)
class IngredientSeriali... | 26.690909 | 66 | 0.623297 | [
"MIT"
] | mgx259/mgx_recipe | app/recipe/serializers.py | 1,468 | Python |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from alipay.aop.api.FileItem import FileItem
from alipay.aop.api.constant.ParamConstants import *
from alipay.aop.api.domain.AlipayEbppInvoiceApplyStatusNotifyModel import AlipayEbppInvoiceApplyStatusNotifyModel
class AlipayEbppInvoiceApplyStatusNotifyReque... | 27.613793 | 148 | 0.647353 | [
"Apache-2.0"
] | Anning01/alipay-sdk-python-all | alipay/aop/api/request/AlipayEbppInvoiceApplyStatusNotifyRequest.py | 4,004 | Python |
from re import search
from base64 import b64decode
from email.message import Message
class mimetest:
def __init__(self, mime):
self.mime = mime
assert not mime.defects
def __getitem__(self, header):
return self.mime[header]
@property
def transfer_encoding(self):
retur... | 22.790698 | 74 | 0.642857 | [
"MIT"
] | eugene-eeo/mailthon | tests/mimetest.py | 980 | Python |
# -*- coding: utf-8 -*-
import unittest
import os
# prepare for test
os.environ['ANIMA_TEST_SETUP'] = ""
from anima.env import mayaEnv # to setup maya extensions
import pymel.core
from anima.edit import Sequence, Media, Video, Track, Clip, File
class SequenceManagerTestCase(unittest.TestCase):
"""tests the Se... | 36.594724 | 111 | 0.639122 | [
"MIT"
] | Khosiyat/anima | tests/previs/test_sequence_manager_extension.py | 30,520 | Python |
##~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~##
##python3 script created by tBarford on 20220205
##
##
##File Description: This is the streamlit webapp MVP for BG Golf EI Profile Database Demo
## run in term w/ : streamlit run streamlit_app.py
##~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~##
import streamlit a... | 42.767857 | 152 | 0.612944 | [
"Apache-2.0"
] | tbarford/bg_streamlit_demo | streamlit_app.py | 2,395 | Python |
import copy
from argparse import Namespace
from typing import Dict, Union, List, Optional, Tuple
from jina import __default_executor__
from jina.enums import PodRoleType
from jina.excepts import NoContainerizedError
from jina.orchestrate.deployments.config.k8slib import kubernetes_deployment
from jina.orchestrate.depl... | 40.485014 | 158 | 0.573428 | [
"Apache-2.0"
] | ethan-jiang-1/jina | jina/orchestrate/deployments/config/k8s.py | 14,858 | Python |
#!/usr/bin/env python
# Copyright (c) 2014, Norwegian University of Science and Technology
# All rights reserved.
#
# 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 ab... | 43.242754 | 130 | 0.600335 | [
"BSD-3-Clause"
] | adamleon/kuka | kuka_driver/src/kuka_driver/kuka_rsi_router.py | 11,935 | Python |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2021 Northwestern University.
#
# Invenio-Vocabularies is free software; you can redistribute it and/or
# modify it under the terms of the MIT License; see LICENSE file for more
# details.
"""Subjects services."""
class SubjectsLabels:
"""Fetching of subjects labels for ... | 28.958333 | 75 | 0.661871 | [
"MIT"
] | alejandromumo/invenio-vocabularies | invenio_vocabularies/contrib/subjects/facets.py | 695 | Python |
"""
Django settings for CoffeeAPI project.
Generated by 'django-admin startproject' using Django 3.0.2.
For more information on this file, see
https://docs.djangoproject.com/en/3.0/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/3.0/ref/settings/
"""
import os
i... | 26.367647 | 126 | 0.678751 | [
"MIT"
] | Mohammed-abdelawal/coffee_api | CoffeeAPI/CoffeeAPI/settings.py | 3,586 | Python |
#### NOTICE: THIS FILE IS AUTOGENERATED
#### MODIFICATIONS MAY BE LOST IF DONE IMPROPERLY
#### PLEASE SEE THE ONLINE DOCUMENTATION FOR EXAMPLES
from swgpy.object import *
def create(kernel):
result = Tangible()
result.template = "object/tangible/loot/quest/shared_nym_droid_memory_chip.iff"
result.attribute_templ... | 26.941176 | 80 | 0.731441 | [
"MIT"
] | SWGANHServices/GameServer_Legacy | data/scripts/templates/object/tangible/loot/quest/shared_nym_droid_memory_chip.py | 458 | Python |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from runner.koan import *
import random
class DiceSet:
def __init__(self):
self._values = None
@property
def values(self):
return self._values
def roll(self, n):
# Needs implementing!
# Tip: random.randint(min, max) can ... | 28.041096 | 78 | 0.618955 | [
"MIT"
] | benrki/python_koans | python3/koans/about_dice_project.py | 2,047 | Python |
#This file was originally generated by PyScripter's unitest wizard
import unittest
from coord import Coord
from cell import Cell
from field import Field
def dummy():
""" Dummy function for comparison of the return values """
return
class CoordTest(unittest.TestCase):
def setUp(self):
... | 27.416667 | 124 | 0.616413 | [
"Apache-2.0"
] | hemmerling/codingdojo | src/game_of_life/python_coderetreat_socramob/cr_socramob08/coord_test.py | 1,645 | Python |
# Copyright 2018 HTCondor Team, Computer Sciences Department,
# University of Wisconsin-Madison, WI.
#
# 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/LICE... | 23.941606 | 84 | 0.721341 | [
"Apache-2.0"
] | elin1231/htmap | tests/conftest.py | 3,280 | Python |
# qubit number=5
# total number=40
import cirq
import qiskit
from qiskit import QuantumCircuit, QuantumRegister, ClassicalRegister
from qiskit import BasicAer, execute, transpile
from pprint import pprint
from qiskit.test.mock import FakeVigo
from math import log2,floor, sqrt, pi
import numpy as np
import networkx as ... | 30.434109 | 82 | 0.610036 | [
"BSD-3-Clause"
] | UCLA-SEAL/QDiff | benchmark/startQiskit843.py | 3,926 | Python |
default_app_config = 'eleprofile.apps.EleprofileConfig' | 55 | 55 | 0.872727 | [
"MPL-2.0"
] | dmiolo/g3w-admin-elevation-profile | __init__.py | 55 | Python |
# Copyright 2011 OpenStack Foundation
# Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance wi... | 37.619926 | 78 | 0.638254 | [
"Apache-2.0"
] | casbin/openstack-patron | patron/context.py | 10,195 | Python |
import os
import matplotlib.pyplot as plt
import numpy as np
from PIL import Image
def make_trainable(net, val):
net.trainable = val
for layer in net.layers:
layer.trainable = val
def plot_loss(losses):
plt.figure(figsize=(10, 8))
plt.plot(losses['g'], label='generative loss')
plt.plot(... | 25.513889 | 79 | 0.623299 | [
"MIT"
] | lukamaletin/multi-gan | src/util.py | 1,837 | Python |
# Generated by Django 3.2.5 on 2021-11-29 19:04
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("organisations", "0004_auto_20210718_1147"),
("schools", "0005_alter_school_courses_offered"),
]
operations = [
migrations.AlterField... | 25.461538 | 57 | 0.563444 | [
"MIT"
] | JobDoesburg/PUC-admin | pucadmin/schools/migrations/0006_alter_school_courses_offered.py | 662 | Python |
from django.conf.urls import patterns, url
urlpatterns = patterns('wouso.interface.apps.files.cpanel_views',
url(r'^$', 'files', name='files'),
url(r'^add_file/$', 'add_file', name='add_file'),
url(r'^edit_file/(?P<pk>\d+)/$', 'edit_file', name='edit_file'),
url(r'^delete_file/(?P<pk>\d+)/$', 'delete_f... | 52.615385 | 91 | 0.663743 | [
"Apache-2.0"
] | AlexandruGhergut/wouso | wouso/interface/apps/files/cpanel_urls.py | 684 | Python |
# Generated by Django 3.0 on 2020-10-19 06:30
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('accounts', '0003_auto_20200922_1738'),
]
operations = [
migrations.AlterField(
model_name='userprofile',
name='id',
... | 23.368421 | 108 | 0.628378 | [
"MIT"
] | Dev-Mehta/AskaDev | accounts/migrations/0004_auto_20201019_1200.py | 444 | Python |
import torch
from torch import nn
from torch.nn import init
import torch.nn.functional as F
class SCNN(nn.Module):
def __init__(self, in_channels, n_classes):
super(SCNN, self).__init__()
self.conv1 = nn.Sequential(
nn.Conv2d(in_channels, out_channels=16, kernel_size=3),
nn... | 30.153846 | 67 | 0.519983 | [
"MIT"
] | haifangong/TNSC-classification-baseline | model/classifier.py | 2,352 | Python |
#
# Copyright 2021 XEBIALABS
#
# Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, subli... | 48.362319 | 462 | 0.69104 | [
"MIT"
] | xebialabs-community/xlr-essential-app-protection-plugin | build/resources/main/arxan/UploadApplication.py | 3,337 | Python |
# Copyright 2015 gRPC 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 or agreed to in writing... | 35.057971 | 98 | 0.678379 | [
"BSD-3-Clause"
] | DMCDavi/grpc-stateful-less | examples/python/helloworld/greeter_client.py | 2,421 | Python |
__author__ = 'Randall'
from demos.setup import np, plt, demo
from compecon import DDPmodel
# DEMDDP04 Binomial American put option model
# Model Parameters
T = 0.5 # years to expiration
sigma = 0.2 # annual volatility
r = 0.05 # annual interest rate
strike = 2.1 ... | 29.017241 | 86 | 0.59893 | [
"MIT"
] | daniel-schaefer/CompEcon-python | compecon/demos/demddp04.py | 1,683 | Python |
#!/usr/bin/env python
# Helpful little script that spits out a comma-separated list of
# language codes for Qt icons that should be included
# in binary Astercoin Core distributions
import glob
import os
import re
import sys
if len(sys.argv) != 3:
sys.exit("Usage: %s $QTDIR/translations $BITCOINDIR/src/qt/locale"%... | 27.26087 | 112 | 0.685805 | [
"MIT"
] | PsyTeck/astercoin | contrib/qt_translations.py | 627 | Python |
# -*- coding: utf-8 -*-
import os
import sys
import json
import time
import math
import types
import logging
import traceback
import operator
import collections
from functools import wraps
from maya import cmds
from maya.api import OpenMaya as om, OpenMayaAnim as oma, OpenMayaUI as omui
from maya import OpenMaya as o... | 27.488901 | 84 | 0.553472 | [
"BSD-2-Clause"
] | fvbehr/cmdx | cmdx.py | 154,791 | Python |
""" Global and local Scopes
Scopes and Namespaces
When an object is assigned to a variable # a = 10
that variable points to some object
and we say that the variable (name) is bound to that object
That object can be accessed using that name in various parts of our code... | 29.707692 | 102 | 0.626618 | [
"Unlicense"
] | minefarmer/deep-Dive-1 | .history/my_classes/ScopesClosuresAndDecorators/GlobalLocalScopes_20210709212514.py | 1,931 | Python |
"""
=============================================================================
Various Agglomerative Clustering on a 2D embedding of digits
=============================================================================
An illustration of various linkage option for agglomerative clustering on
a 2D embedding of the di... | 33.608696 | 77 | 0.614166 | [
"BSD-3-Clause"
] | 09sachin/scikit-learn | examples/cluster/plot_digits_linkage.py | 3,092 | Python |
from pypy.objspace.std.stdtypedef import *
from pypy.objspace.std.basestringtype import basestring_typedef
from sys import maxint
from pypy.rlib.objectmodel import specialize
def wrapstr(space, s):
from pypy.objspace.std.stringobject import W_StringObject
from pypy.objspace.std.ropeobject import rope, W_RopeO... | 55.287009 | 87 | 0.549727 | [
"MIT"
] | woodrow/pyoac | pypy/objspace/std/stringtype.py | 18,300 | Python |
from __future__ import absolute_import
from types import ModuleType
class MethodDispatcher(dict):
u"""Dict with 2 special properties:
On initiation, keys that are lists, sets or tuples are converted to
multiple keys so accessing any one of the items in the original
list-like object returns the matchi... | 31.650602 | 78 | 0.633422 | [
"MIT"
] | gsnedders/html5lib | python/html5lib/utils.py | 2,627 | Python |
import os
__author__ = "Aaron Koeppel"
__version__ = 1.0
def xmlMarkup(games, team_ab, team_name, team_record):
'''Markup the RSS feed using the data obtained.
:param games: list of games that the team played this season
:type games: list of GameData
:param team_ab: the team's abbreviated name
:type ... | 32.521739 | 79 | 0.625 | [
"MIT"
] | ak212/python-hockey-rss | markup.py | 1,496 | Python |
#!/usr/bin/env python
"""Client utilities."""
import logging
import sys
from grr_response_core.lib import utils
from grr_response_core.lib.rdfvalues import client_fs as rdf_client_fs
from grr_response_core.lib.rdfvalues import paths as rdf_paths
# pylint: disable=g-import-not-at-top
if sys.platform == "win32":
fro... | 29.078261 | 79 | 0.746112 | [
"Apache-2.0"
] | billstackpole/grr | grr/client/grr_response_client/client_utils.py | 3,344 | Python |
# Copyright 2020 Google LLC
#
# 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | 38.809375 | 133 | 0.704374 | [
"ECL-2.0",
"Apache-2.0"
] | ho-oto/jax | jax/experimental/jax2tf/jax2tf.py | 99,352 | Python |
from django.contrib.auth.decorators import login_required
from django.shortcuts import render, get_object_or_404, redirect
from django.template import loader
from django.http import HttpResponse
from django import template
from mainsite.forms import NewsCreate
from mainsite.models import News, ContactForm, Issue
@lo... | 31.61194 | 106 | 0.684372 | [
"MIT"
] | Bekarysalashybayev/Nomad | app/views.py | 4,252 | Python |
# Generated by Django 2.2.3 on 2019-08-07 13:29
from django.db import migrations, models
import django.db.models.deletion
import wagtail.core.blocks
import wagtail.core.fields
class Migration(migrations.Migration):
dependencies = [
("wagtailimages", "0001_squashed_0021"),
("wagtailcore", "0041_g... | 34.732877 | 93 | 0.374088 | [
"BSD-3-Clause"
] | kimdhamilton/mitxpro | cms/migrations/0041_certificatepage_signatoryindexpage_signatorypage.py | 5,071 | Python |
#!python3.6
#coding:utf-8
#regex.finditer(string[, pos[, endpos]])
import re
regex = re.compile(r'^ab')
print(regex)
for target in ['abcdefg', 'cdefg', 'abcdabcd', 'cdabAB', 'ABcd']:
print(target, regex.finditer(target))
print()
regex = re.compile(r'^ab', re.IGNORECASE)
print(regex)
for target in ['abcdefg', 'cdef... | 34.142857 | 110 | 0.62642 | [
"CC0-1.0"
] | pylangstudy/201708 | 13/00/finditer.py | 1,673 | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.