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 python3
# Copyright (c) 2014-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.
"""Test mempool persistence.
By default, bwscoind will dump mempool on shutdown and
then reload it on sta... | 44.558559 | 127 | 0.694703 | [
"MIT"
] | bwsnetwork/bwscoin | test/functional/mempool_persist.py | 4,946 | Python |
# Copyright (c) 2015 Nicolas JOUANIN
#
# See the file license.txt for copying permission.
import logging
from functools import partial
class EventLoggerPlugin:
def __init__(self, context):
self.context = context
async def log_event(self, *args, **kwargs):
self.context.logger.info("### '%s' ... | 32.325581 | 101 | 0.615827 | [
"MIT"
] | norwood867/distmqtt | distmqtt/plugins/logging.py | 1,390 | Python |
"""
WSGI config for share_all project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/1.11/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault("DJANGO_SE... | 23.294118 | 78 | 0.787879 | [
"MIT"
] | yingshaoxo/Share_All | share_all/wsgi.py | 396 | Python |
RAW_DATA_PATH = 'data/raw'
PROCESSED_DATA_PATH = 'data/processed'
OUTPUT_DATA_PATH = 'data/output'
MODELS_PATH = 'models'
REPORTS_PATH = 'reports'
continuous = ['temp', 'atemp','hum', 'windspeed', 'registered', 'cnt', 'casual', 'yr']
cyclic = ['season', 'mnth', 'hr', 'weekday']
categorical = ['holiday', 'workingday',... | 32 | 86 | 0.685096 | [
"MIT"
] | carlomazzaferro/scikit-hts-examples | src/settings.py | 416 | Python |
# Copyright (C) 2019-2020 Intel Corporation
#
# SPDX-License-Identifier: MIT
import attr
from contextlib import ExitStack
from distutils.util import strtobool as str_to_bool # pylint: disable=unused-import
from functools import partial, wraps
from itertools import islice
from typing import Iterable, Tuple
NOTSET = ... | 28.444444 | 83 | 0.564708 | [
"MIT"
] | AdaptiveCity/datumaro | datumaro/util/__init__.py | 5,888 | Python |
from django import forms
from django.contrib.auth.forms import UserCreationForm
from django.contrib.auth.models import User
from django.forms.models import ModelForm
from .models import Image,Comment,Profile
class RegisterUserForm(UserCreationForm):
email = forms.EmailField()
first_name = forms.CharField(max_... | 25.475 | 86 | 0.624141 | [
"MIT"
] | kipsang01/bonga-app | bongaapp/forms.py | 1,019 | Python |
# -*- coding: utf-8 -*-
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: tensorflow/core/protobuf/saver.proto
"""Generated protocol buffer code."""
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from google.protobuf import reflection as _reflect... | 44.482993 | 727 | 0.768466 | [
"Apache-2.0"
] | alexeygrigorev/tensorflow-protobuf | tensorflow/core/protobuf/saver_pb2.py | 6,539 | Python |
import urllib.request, urllib.parse, urllib.error
import json
url = input('Web page: ')
print('Retrieving', url)
uh = urllib.request.urlopen(url)
data = uh.read().decode()
info = json.loads(data)
# info é um dict do tipo:
# {'note': 'This file contains the sample data for testing', 'comments': [{'name': '... | 23.7 | 102 | 0.632911 | [
"MIT"
] | Felipe-Tommaselli/Python4everbody_Michigan | book3/s6_ex3.py | 715 | Python |
#Embedded file name: ACEStream\Player\BaseApp.pyo
import os
import sys
import time
import shutil
import urllib
import hashlib
import binascii
import random
import subprocess
import struct
import pickle
import cookielib
from operator import itemgetter
from base64 import b64encode, encodestring
from types import DictType... | 48.625198 | 520 | 0.598059 | [
"Apache-2.0"
] | C6SUMMER/allinclusive-kodi-pi | .kodi/userdata/addon_data/plugin.video.p2p-streams/acestream/ace/ACEStream/Player/BaseApp.py | 153,607 | Python |
"""
Support for Homekit number ranges.
These are mostly used where a HomeKit accessory exposes additional non-standard
characteristics that don't map to a Home Assistant feature.
"""
from aiohomekit.model.characteristics import Characteristic, CharacteristicsTypes
from homeassistant.components.number import NumberEnt... | 27.653846 | 81 | 0.644645 | [
"Apache-2.0"
] | 0xFEEDC0DE64/homeassistant-core | homeassistant/components/homekit_controller/number.py | 2,876 | Python |
# -*- coding: utf-8 -*-
from django.conf.urls import url
from django.views.generic import TemplateView
from . import views
app_name = 'services_communicator'
urlpatterns = [
url(
regex="^ServiceList/~create/$",
view=views.ServiceListCreateView.as_view(),
name='ServiceList_create',
),
... | 25.305556 | 51 | 0.601537 | [
"MIT"
] | eshafik/services_communicator | services_communicator/urls.py | 911 | Python |
#
# Copyright 2018 EveryUP Srl
#
# 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 t... | 35.138462 | 115 | 0.669002 | [
"Apache-2.0"
] | 5g-media/OIDC_ON_OSMr5 | LW-UI/authosm/models.py | 4,568 | 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... | 33.946429 | 81 | 0.652814 | [
"Apache-2.0"
] | mindspore-ai/mindscience | MindElec/examples/physics_driven/frequency_domain_maxwell/src/model.py | 1,901 | Python |
# !/usr/bin/python3
# coding: utf_8
""" Config your app """
import os
from hal.files.parsers import JSONParser
from hal.files.save_as import write_dicts_to_json
from .config import APP_FOLDER, API_FOLDER, DATA_FOLDER
from .data.coins import CryptoCoin, CRYPTO_COINS
class ConfigManager:
""" Manages config fil... | 22.163265 | 77 | 0.575967 | [
"MIT"
] | sirfoga/pyhodl | pyhodl/app.py | 2,172 | Python |
"""is_sqllab_view
Revision ID: 130915240929
Revises: f231d82b9b26
Create Date: 2018-04-03 08:19:34.098789
"""
import sqlalchemy as sa
from alembic import op
from sqlalchemy.ext.declarative import declarative_base
from rabbitai import db
# revision identifiers, used by Alembic.
revision = "130915240929"
down_revisio... | 20.785714 | 58 | 0.648625 | [
"Apache-2.0"
] | psbsgic/rabbitai | rabbitai/migrations/versions/130915240929_is_sqllab_viz_flow.py | 1,164 | Python |
from collections import OrderedDict
from . import util
from ..errors import ModelInfoLookupError
class ModelInfo:
def __init__(self, pairs=[], default_fields=None):
"""
Constructs a mapping of information about a model.
:class:`~revscoring.scoring.ModelInfo` objects are usually nested
... | 33.335329 | 79 | 0.553979 | [
"MIT"
] | leojoubert/revscoring | revscoring/scoring/model_info.py | 5,567 | Python |
# -*- coding: utf-8 -*-
import cv2
import numpy as np
import matplotlib.image as mpimg
import matplotlib.pyplot as plt
# Define a class to receive the characteristics of each line detection
class Lane():
def __init__(self):
# 当前的图像
self.current_warped_binary = None
# 当前图片的尺寸
self.c... | 36.617391 | 127 | 0.592654 | [
"MIT"
] | jo-ny/CarND-Advanced-Lane-Lines | lane/Lane.py | 13,189 | Python |
import ctypes as C
import numpy as np
from math import log,e
import hankelmatrixcreator
import sys
import time
import iohelpers
import math
import modelconversion
from scipy.sparse.linalg import lsqr
from scipy import sparse
import copy
DEBUG = False
VERBOSE = True
FAILURE_CONST = -100000.0
class TensorWFA:
def... | 33.281496 | 237 | 0.597741 | [
"Apache-2.0"
] | ICML14MoMCompare/MoMs-for-StochasticLanguages | code/tensor/wfatensorlearn.py | 16,907 | Python |
from django.contrib.auth import get_user_model
from django.contrib.auth.hashers import make_password
from django.db import transaction
from rest_framework import exceptions, serializers
from care.facility.models import Facility, FacilityUser, READ_ONLY_USER_TYPES
from care.users.api.serializers.lsg import DistrictSeri... | 36.316176 | 121 | 0.604778 | [
"MIT"
] | CoronaSafeUP/care | care/users/api/serializers/user.py | 9,878 | Python |
talks = [
"https://www.churchofjesuschrist.org/study/general-conference/2022/04/11nelson",
"https://www.churchofjesuschrist.org/study/general-conference/2022/04/12ballard",
"https://www.churchofjesuschrist.org/study/general-conference/2022/04/13aburto",
"https://www.churchofjesuschrist.org/study/general... | 102.074423 | 159 | 0.779159 | [
"MIT"
] | thetaylors/pyConferenceTalkRandomizer | playground.py | 389,516 | Python |
"""\
Perl code generator
@copyright: 2002-2004 D.H. aka crazyinsomniac on sourceforge.net
@copyright: 2012-2016 Carsten Grohmann
@copyright: 2017-2020 Dietmar Schwertberger
@license: MIT (see LICENSE.txt) - THIS PROGRAM COMES WITH NO WARRANTY
"""
import os, os.path, re
from codegen import BaseLangCodeWriter, BaseSour... | 41.484288 | 124 | 0.524841 | [
"MIT"
] | ardovm/wxGlade | codegen/perl_codegen.py | 22,443 | Python |
test = {
'name': 'rle',
'points': 1,
'suites': [
{
'cases': [
{
'code': r"""
scm> (rle '())
()
scm> (stream-to-list (rle (list-to-stream '(1 2 3))))
((1 1) (2 1) (3 1))
scm> (stream-to-list (rle (list-to-stream '(1 1 2 2 3 3))))
... | 22.151515 | 77 | 0.352941 | [
"MIT"
] | MassimoWu88/MassimoWu88 | labs/lab13/tests/rle.py | 731 | Python |
# Auto generated from meta.yaml by namespacegen.py version: 0.4.0
# Generation date: 2020-08-25 16:45
# Schema: metamodel
#
# id: https://w3id.org/biolink/biolinkml/meta
# description: A metamodel for defining biolink related schemas
# license: https://creativecommons.org/publicdomain/zero/1.0/
from collections import... | 34.836257 | 110 | 0.642605 | [
"CC0-1.0"
] | hsolbrig/biolinkml | tests/test_scripts/output/gennamespace/meta_namespaces.py | 5,957 | Python |
from typing import Sequence, Dict, List, Optional
from abc import ABC, abstractmethod
# from nltk.corpus import wordnet
from pymagnitude import Magnitude
from .utils import (
UPPERCASE_RE,
LOWERCASE_RE,
DIGIT_RE,
PUNC_REPEAT_RE,
)
class FeatureExtractor(ABC):
@abstractmethod
def extract(
... | 30.137255 | 89 | 0.554066 | [
"MIT"
] | YifanLeng/Esports_NER | CRF/feature_extractors.py | 7,685 | Python |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import multiprocessing
from functools import partial
import tensorflow as tf
import tensorflow.contrib.eager as tfe
from general.utilTF1.utils import session
from general.kneeOsteoarthritisDataset.KneeOsteoart... | 30.489583 | 125 | 0.65562 | [
"BSD-3-Clause"
] | duennbart/masterthesis_VAE | general/utilTF1/dataset.py | 5,854 | Python |
#!/usr/bin/env python
from django.contrib.auth import get_user_model
import django
import configparser
import sys
import os
django_project_name = os.environ.get('DJANGO_PROJECT_NAME')
sys.path.append('/app')
os.environ.setdefault("DJANGO_SETTINGS_MODULE", django_project_name+'.settings')
django.setup()
def django_s... | 27.151515 | 80 | 0.736607 | [
"MIT"
] | narendra-cs/DjangoApp | scripts/create_django_superuser.py | 896 | Python |
#!/usr/bin/env python3
# -*- coding:utf-8 -*-
from flask import Flask
from flask import request
from flask import jsonify
from line_sdk import Linebot
LINE_ACCESS_TOKEN = ""
LINE_CHANNEL_SECRET = ""
app = Flask(__name__)
@app.route("/", methods=["GET", "POST"])
def webhook():
# GET
if request.method == "G... | 28.132075 | 77 | 0.560027 | [
"MIT"
] | RobinJLin/LokiHub | Heroku/Heroku-Linebot-Github/line_app.py | 1,569 | Python |
# All paths are relative to train_val.py file
config = {
'images_path': 'train_val_data/Flicker8k_Dataset/', #Make sure you put that last slash(/)
'train_data_path': 'train_val_data/Flickr8k_text/Flickr_8k.trainImages.txt',
'val_data_path': 'train_val_data/Flickr8k_text/Flickr_8k.devImages.txt',
'captions_path... | 71.466667 | 378 | 0.772854 | [
"MIT"
] | saharshxyz/altML | ml/config.py | 2,144 | Python |
"""
---
title: Train Feedback Transformer
summary: This is training code with notes for a feedback transformer.
---
# Train Feedback Transformer
This trains a [feedback transformer](index.html) model for auto-regression.
You can pick the original feedback transformer or the new version
where the keys and values are p... | 34.216783 | 188 | 0.628858 | [
"MIT"
] | drpraneshkrishnan/nn | labml_nn/transformers/feedback/experiment.py | 4,893 | Python |
# Configuration file for the Sphinx documentation builder.
#
# This file only contains a selection of the most common options. For a full
# list see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html
# -- Path setup --------------------------------------------------------------
# If ex... | 31.27551 | 79 | 0.6969 | [
"MIT"
] | Sanjana12111994/dataprep | docs/source/conf.py | 3,065 | Python |
import os
from os import path
import stat
import mmap
import directio
from setting import (
LONGHORN_SOCKET_DIR, LONGHORN_DEV_DIR, PAGE_SIZE,
)
def readat_direct(dev, offset, length):
pg = offset / PAGE_SIZE
in_page_offset = offset % PAGE_SIZE
# either read less than a page, or whole pages
if in_... | 25.525 | 73 | 0.617042 | [
"Apache-2.0"
] | MalibuKoKo/longhorn-engine | integration/data/frontend.py | 2,042 | Python |
import datetime
import string
from collections import namedtuple
from distutils.version import LooseVersion
from random import choices
from typing import Optional, Type
import numpy as np
import pandas as pd
import pyarrow as pa
import pytest
from pandas.tests.extension.base import (
BaseArithmeticOpsTests,
Ba... | 36.478357 | 106 | 0.664953 | [
"MIT"
] | artemru/fletcher | tests/test_pandas_extension.py | 32,872 | Python |
# -*- coding: utf-8 -*-
# Generated by Django 1.11 on 2017-06-09 13:02
from __future__ import unicode_literals
from django.db import migrations
def load_continents(apps, schema_editor):
continent = apps.get_model("country_name_tool", "Continent")
newcontinents = [['NA', 'North America'], ['AS', 'Asia'], ['AF... | 29.96 | 163 | 0.658211 | [
"MIT"
] | owid/owid-importer | country_name_tool/migrations/0003_auto_20170609_1302.py | 749 | Python |
import os,sys,json,cv2
from nima.inference.inference_model import InferenceModel
import opt4 as opt
from PIL import Image
# write to result file
def write_json(args,score):
try:
outfile =open(args[3],'w')
#print('saving test json at '+args[3])
except IndexError:
print('output_location ... | 28.025641 | 161 | 0.539341 | [
"MIT"
] | jjmao-cs/nima.pytorch | nima/nima_new.py | 4,372 | Python |
# Copyright (c) Facebook, Inc. and its affiliates.
# All rights reserved.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.
from functorch import grad, nnc_jit, make_fx, make_nnc
import torch
import time
def f(x):
return torch.sin(... | 22.694444 | 71 | 0.682987 | [
"BSD-3-Clause"
] | ConnollyLeon/functorch | examples/compilation/simple_function.py | 817 | Python |
#!/usr/bin/env python3
#
# This file is part of LiteX-Boards.
#
# Copyright (c) 2021 Florent Kermarrec <florent@enjoy-digital.fr>
# Copyright (c) 2021 Greg Davill <greg.davill@gmail.com>
# SPDX-License-Identifier: BSD-2-Clause
# Build/Use:
# ./gsd_butterstick.py --uart-name=crossover --with-etherbone --csr-csv=csr.cs... | 43.916256 | 144 | 0.573864 | [
"BSD-2-Clause"
] | Logicwax/litex-boards | litex_boards/targets/gsd_butterstick.py | 8,915 | Python |
#!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates.
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
"""
Provides standard metric evaluations for dialog.
Uses locking and shared memory when ``numthreads`` is set to >1 to ... | 31.426634 | 88 | 0.59395 | [
"MIT"
] | Totoola-Kehinde/ParlAI | parlai/core/metrics.py | 25,487 | Python |
from abcunits import ConversionUnit
KFACTOR = 273.15 #Difference Kelvin, C (how precise is this known?)
class TempUnit(ConversionUnit):
""" Temperature units. ALl conversions go through Kelvin. """
#http://www.metric-conversions.org/temperature/fahrenheit-to-kelvin.htm
class Kelvin(TempUnit):
short = 'K'... | 22.137931 | 71 | 0.610592 | [
"BSD-3-Clause"
] | hugadams/scikit-spectra | skspec/units/tempunits.py | 1,284 | Python |
##
##
# File auto-generated against equivalent DynamicSerialize Java class
class DeleteRequest(object):
def __init__(self):
self.datasets = None
self.groups = None
self.filename = None
def getDatasets(self):
return self.datasets
def setDatasets(self, datasets):
s... | 19 | 68 | 0.641766 | [
"BSD-3-Clause"
] | mjames-upc/python-awips | dynamicserialize/dstypes/com/raytheon/uf/common/pypies/request/DeleteRequest.py | 589 | Python |
# -*- coding: utf-8 -*-
{
"name": """Preview Media Files""",
"summary": """Open attached images in popup""",
"category": "Web",
"images": ["images/screenshot-1.png"],
"vesion": "10.0.1.0.0",
"application": False,
"author": "IT-Projects LLC, Dinar Gabbasov",
"support": "apps@itpp.dev",
... | 30.269231 | 58 | 0.579416 | [
"MIT"
] | ShaheenHossain/itpp-labs-misc-addons13 | web_preview/__manifest__.py | 787 | Python |
"""Conftests
"""
| 5.666667 | 12 | 0.529412 | [
"MIT"
] | Azure-Samples/azure-intelligent-edge-patterns | factory-ai-vision/EdgeSolution/modules/WebModule/backend/vision_on_edge/streams/tests/conftest.py | 17 | Python |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# convert / import osm xml .osm file into a Shapefile
import subprocess
import os
import shutil
# specify output format
output_format = "ESRI Shapefile"
# complete path to input OSM xml file .osm
input_osm = '../geodata/OSM_san_francisco_westbluff.osm'
# Windows users c... | 30.45098 | 73 | 0.676111 | [
"MIT"
] | MatthiasWunsch/python-geospatial-analysis-cookbook | ch03/code/ch03-04_osm2shp.py | 1,553 | Python |
from flask_wtf import FlaskForm
from flask_wtf.file import FileRequired
from wtforms import (
StringField,
SubmitField,
PasswordField,
FileField,
SelectField,
TextAreaField,
BooleanField,
)
from wtforms.validators import DataRequired, Length, ValidationError
from models import RoomBGMTypes
... | 36.213793 | 93 | 0.708246 | [
"MPL-2.0",
"MPL-2.0-no-copyleft-exception"
] | dhtdht020/room-server | theunderground/forms.py | 5,251 | Python |
#!/usr/bin/env python3
# Copyright (c) 2010 ArtForz -- public domain half-a-node
# Copyright (c) 2012 Jeff Garzik
# Copyright (c) 2010-2020 The UFO Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""UFO test framewo... | 28.754199 | 262 | 0.604537 | [
"MIT"
] | UFO-ETL/ufo | test/functional/test_framework/messages.py | 51,355 | Python |
def main():
def Problem1():
def Problem2():
def Problem3():
def Problem4():
def Problem1():
def countFunction
for .count(0 <= NUMBER)
def Problem2():
userInput = ""
while(userInput != 'q'):
userInput = input("Enter something")
def Problem3():
def addFunction
def subtractFunction
def multiplyFunct... | 20.171429 | 88 | 0.719547 | [
"Apache-2.0"
] | cs-fullstack-2019-spring/python-functions-cw-rdunavant | CW.py | 706 | Python |
# -*- coding: utf-8 -*-
#
# Configuration file for the Sphinx documentation builder.
#
# This file does only contain a selection of the most common options. For a
# full list see the documentation:
# http://www.sphinx-doc.org/en/master/config
# -- Path setup ------------------------------------------------------------... | 29.809249 | 79 | 0.653481 | [
"MIT"
] | Ipv6Python/messages | docs/conf.py | 5,157 | Python |
from unittest import TestCase, mock
from bulksms.sms import send_single, send_bulk
class BulkSMSTestCase(TestCase):
def test_send_single_sms(self):
# Mock send single sms function.
mock_send_single = mock.create_autospec(send_single, return_value='results')
mock_send_single('0831234567', ... | 38.4 | 84 | 0.729167 | [
"MIT"
] | tsotetsi/django-bulksms | tests/unit/test_bulksms.py | 768 | Python |
import os
from options.train_options import TrainOptions
from models import create_model
from util.visualizer import save_images
from util import html
from PIL import Image
import string
import torch
import torchvision
import torchvision.transforms as transforms
import coremltools as ct
from util import util
import ... | 29.222222 | 79 | 0.65253 | [
"MIT"
] | zengxinzhy/colorization-pytorch | imtest.py | 3,419 | Python |
from __future__ import division
from itertools import combinations_with_replacement
import numpy as np
import math
import sys
def shuffle_data(X, y, seed=None):
if seed:
np.random.seed(seed)
n_samples = X.shape[0]
idx = np.arange(n_samples)
np.random.shuffle(idx)
X = X[idx]
y = y[idx]
... | 29.125 | 99 | 0.626405 | [
"MIT"
] | MachineLearningCommunity/ML-From-Scratch | mlfromscratch/utils/data_manipulation.py | 4,893 | Python |
'''
This file is a part of Test Mile Arjuna
Copyright 2018 Test Mile Software Testing Pvt Ltd
Website: www.TestMile.com
Email: support [at] testmile.com
Creator: Rahul Verma
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 ... | 27.485714 | 114 | 0.688496 | [
"Apache-2.0"
] | test-mile/arjuna | arjuna/engine/unitee/exceptions.py | 2,886 | 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... | 33.169014 | 115 | 0.780042 | [
"Apache-2.0"
] | jerome-habana/pytorch-lightning | pytorch_lightning/utilities/__init__.py | 2,355 | Python |
"""
WSGI config for poker project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/2.2/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault('DJANGO_SETTING... | 22.764706 | 78 | 0.782946 | [
"MIT"
] | yuriymironov96/python-poker | poker/wsgi.py | 387 | Python |
#!/usr/bin/env python
# Import required modules
from __future__ import print_function
from future import standard_library
standard_library.install_aliases()
from builtins import str
import os
import argparse
import subprocess
import ICA_AROMA_functions as aromafunc
import shutil
import classification_plots
# Change t... | 35.521472 | 267 | 0.629102 | [
"MIT"
] | spunt/bspm | thirdparty/ICA_AROMA_79x95x69/ICA_AROMA.py | 11,580 | Python |
#!/usr/bin/env python
from markovLatex.markov import TextGenerator
import argparse, sys
def main(args):
parser = argparse.ArgumentParser(description="Generate pseudorandom text from input text files.")
parser.add_argument('files', type=str, nargs='+', help='one or more input text files')
parser.add_argum... | 27.617647 | 117 | 0.614483 | [
"MIT"
] | SeanMcGrath/MarkovLatex | markovgen.py | 939 | Python |
# -*- coding: utf-8 -*-
# Copyright Hannah von Reth <vonreth@kde.org>
#
# 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 condi... | 43.448649 | 175 | 0.635357 | [
"BSD-2-Clause"
] | C-EO/craft | bin/Utils/GetFiles.py | 8,038 | Python |
#!/usr/bin/env python
import unittest
import Cheetah
import Cheetah.Parser
import Cheetah.Template
class Chep_2_Conditionalized_Import_Behavior(unittest.TestCase):
def test_ModuleLevelImport(self):
''' Verify module level (traditional) import behavior '''
pass
def test_InlineImport(self):
... | 26.95 | 66 | 0.565863 | [
"MIT"
] | analurandis/Tur | backend/venv/Lib/site-packages/Cheetah/Tests/Cheps.py | 1,078 | Python |
import requests
from requests.auth import HTTPBasicAuth
r = requests.get('http://localhost:5000', auth=HTTPBasicAuth('username', 'password'))
print(r.status_code) | 32.6 | 85 | 0.785276 | [
"Apache-2.0"
] | silianpan/seal-spider-demo | requests/demo27.py | 163 | Python |
#!/usr/bin/env python
"""Django's command-line utility for administrative tasks."""
import os
import sys
def main():
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'zhekudblog.settings')
try:
from django.core.management import execute_from_command_line
except ImportError as exc:
raise Imp... | 28.636364 | 74 | 0.684127 | [
"MIT"
] | ZhekuD/ZhekuDBlog | src/zhekudblog/manage.py | 630 | Python |
import discord
from discord.ext import commands
from core import checks
from core.models import PermissionLevel
class Suggest(commands.Cog):
"""
Let's you send a suggestion to a designated channel.
"""
def __init__(self, bot):
self.bot = bot
self.coll = bot.plugin_db.get_partition(self)... | 38.836364 | 103 | 0.617041 | [
"MIT"
] | AlertShamrock/modmail-plugins-2 | suggest/suggest.py | 2,142 | Python |
import numpy as np
import tempfile
import os
import pytest
import torch
from anndata import AnnData
from scvi.dataset import (
AnnDatasetFromAnnData,
CortexDataset,
SyntheticDataset,
GeneExpressionDataset,
Dataset10X,
)
from scvi.inference import (
JointSemiSupervisedTrainer,
AlternateSemi... | 35.495974 | 88 | 0.70857 | [
"MIT"
] | shaoxin0801/scVI | tests/test_scvi.py | 22,043 | Python |
# -*- coding: utf-8 -*-
# Define here the models for your spider middleware
#
# See documentation in:
# https://doc.scrapy.org/en/latest/topics/spider-middleware.html
from scrapy import signals
class JianshuSpiderSpiderMiddleware(object):
# Not all methods need to be defined. If a method is not defined,
# s... | 34.701923 | 78 | 0.667221 | [
"Apache-2.0"
] | 2904574716qq/spider_python | scrapy/jianshu_spider/jianshu_spider/middlewares.py | 3,611 | Python |
#!/usr/bin/env python
# Copyright 2016 Medical Research Council Harwell.
#
# 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... | 29.617647 | 74 | 0.735849 | [
"Apache-2.0"
] | Dorky-Lever/vpv | setup.py | 1,007 | Python |
# This file is part of Scapy
# See http://www.secdev.org/projects/scapy for more information
# Copyright (C) Philippe Biondi <phil@secdev.org>
# This program is published under a GPLv2 license
#############################################################################
# ... | 41.844444 | 130 | 0.545672 | [
"MIT"
] | 4shadoww/hakkuframework | lib/scapy/layers/hsrp.py | 3,766 | Python |
# model settings
model = dict(
type='FasterRCNN',
pretrained='open-mmlab://resnet50_caffe',
backbone=dict(
type='ResNet',
depth=50,
num_stages=4,
out_indices=(0, 1, 2, 3),
frozen_stages=1,
norm_cfg=dict(type='BN', requires_grad=False),
norm_eval=True,
... | 30.665 | 76 | 0.581608 | [
"Apache-2.0"
] | 1243France/SCB_Loss | configs/guided_anchoring/ga_faster_r50_caffe_fpn_1x.py | 6,133 | Python |
# -*- coding: utf-8 -*-
###
# (C) Copyright (2012-2017) Hewlett Packard Enterprise Development LP
#
# 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 limi... | 42.325581 | 152 | 0.758608 | [
"MIT"
] | HewlettPackard/python-hpOneView | examples/server_profiles.py | 10,920 | Python |
import sqlite3
import pandas as pd
import numpy as np
import csv
import gzip
from collections import defaultdict
if __name__ == '__main__':
conn = sqlite3.connect('data/instacart.db')
c = conn.cursor()
# Get the orders properly sorted, so we can directly
# group by user_id, order_id and th... | 37.68 | 118 | 0.662951 | [
"MIT"
] | Keesiu/meta-kaggle | data/external/repositories_2to3/164369/kaggle-public-master/instacart/compute_weights_2.py | 1,884 | Python |
from rolepermissions.roles import AbstractUserRole
class Admin(AbstractUserRole):
available_permissions = {
'deactivate_user': True,
'activate_user': True,
'change_user_permissions': True,
'create_client_record': True,
'delete_client_recods': True,
'update_client_re... | 24.952381 | 50 | 0.666031 | [
"MIT"
] | lunyamwis/appraisal-system | app/api/roles/roles.py | 524 | Python |
import cv2
import numpy as np
import math
from vcam import vcam,meshGen
def nothing(x):
pass
WINDOW_NAME = "output"
cv2.namedWindow(WINDOW_NAME,cv2.WINDOW_NORMAL)
cv2.resizeWindow(WINDOW_NAME,700,700)
# Creating the tracker bar for all the features
cv2.createTrackbar("X",WINDOW_NAME,500,1000,nothing)
cv2.createT... | 30.826667 | 67 | 0.728374 | [
"MIT"
] | kaustubh-sadekar/VirtualCam | GUI.py | 2,312 | Python |
from minpiler.std import M
i = 0
M.label .loop
M.print(i)
i += 1
if i < 10:
M.jump .loop
| 10.444444 | 26 | 0.606383 | [
"MIT"
] | 3e45/minpiler | samples/std/jump.py | 94 | Python |
from django.core.management.base import NoArgsCommand
from ella.core.management import regenerate_listing_handlers
class Command(NoArgsCommand):
def handle_noargs(self, **options):
regenerate_listing_handlers()
| 28.125 | 60 | 0.804444 | [
"BSD-3-Clause"
] | chr1043086360/ella | ella/core/management/commands/regenerate_listing_handlers.py | 225 | Python |
import _plotly_utils.basevalidators
class ExponentformatValidator(
_plotly_utils.basevalidators.EnumeratedValidator
):
def __init__(
self,
plotly_name='exponentformat',
parent_name='scatterpolar.marker.colorbar',
**kwargs
):
super(ExponentformatValidator, self).__i... | 25.090909 | 58 | 0.592391 | [
"MIT"
] | Elpiro/plotly.py | plotly/validators/scatterpolar/marker/colorbar/_exponentformat.py | 552 | Python |
#!/usr/bin/python
'''
Gapfilling function that utilizes pFBA and flux sampling to find most
parsimonious additional reactions to achieve minimum flux through the objective
Author: Matthew Jenior
'''
import pandas
import math
import copy
import time
import random
# Using Cobrapy 0.13.0
import cobra
import cobra.test
fr... | 37.40566 | 103 | 0.640858 | [
"MIT"
] | csbl/CSBL-code-repo | pfba_gapfiller.py | 7,930 | Python |
import torch
import time
from audio_zen.acoustics.feature import mag_phase
from audio_zen.acoustics.mask import decompress_cIRM
from audio_zen.inferencer.base_inferencer import BaseInferencer
# for log
from utils.logger import log
print=log
def cumulative_norm(input):
eps = 1e-10
device = input.device
da... | 39.364929 | 116 | 0.624007 | [
"Apache-2.0"
] | hit-thusz-RookieCJ/FullSubNet-plus | speech_enhance/fullsubnet/inferencer/inferencer.py | 8,392 | Python |
# test_codecs.py from CPython 2.7, modified for Jython
from test import test_support
import unittest
import codecs
import locale
import sys, StringIO
if not test_support.is_jython:
import _testcapi
class Queue(object):
"""
queue: write bytes at one end, read bytes from the other end
"""
def __init_... | 35.96849 | 115 | 0.557084 | [
"EPL-1.0"
] | Gumtree/gumtree | framework/extensions/org.python.jython/Lib/test/test_codecs.py | 60,499 | Python |
import sys
import pyodbc
from django.db import connections
from request.utils import retrieve_server_name_tcp_port
def validate_database_name(server_name,database_name):
try:
server_name = retrieve_server_name_tcp_port(server_name)
print(server_name)
cnxn = pyodbc.connect(r"Drive... | 37.548387 | 186 | 0.611684 | [
"MIT"
] | marcosfreccia/SQLDashboard | request/create_database.py | 1,164 | Python |
# Copyright 2018 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | 43.27307 | 113 | 0.618766 | [
"Apache-2.0"
] | 5seunghoon/tensorflow | tensorflow/python/keras/optimizer_v2/adam_test.py | 22,978 | 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.033019 | 209 | 0.674484 | [
"MIT"
] | Codejune/azure-sdk-for-python | sdk/containerinstance/azure-mgmt-containerinstance/azure/mgmt/containerinstance/aio/operations/_container_groups_operations.py | 42,428 | Python |
from workerInfra.enum import SchedulerTriggerEnum, EnvEnum
from workerInfra.domain import LoggerInterface
from workerInfra.models import SchedulerJobModel
from workerService.envReaderService import EnvReaderService
from workerService.scheduler import SchedulerService
from workerService.logger import BasicLoggerService
... | 41.527273 | 139 | 0.71563 | [
"MIT"
] | jtom38/newsbot.worker | workerApi/apiEventsService.py | 4,568 | Python |
class Debt:
def __init__(self, id_nbr, principal, rate, minimum, frequency=12):
self.id = id_nbr
self.principal = principal
self.rate = rate
self.minimum = minimum
self.frequency = frequency
def calculate_compound(self, periods):
new_principal = self.principal * ... | 37.611111 | 95 | 0.66839 | [
"MIT"
] | Luigi-PastorePica/FreeD | src/freed/debt_class.py | 1,354 | Python |
from typing import Union
import Geometry
from Geometry import Line
from Geometry import Point
import cmath
class Circle:
def __init__(self, center: Union[Point, tuple, list], radius: float):
if isinstance(center, tuple) or isinstance(center, list):
assert len(center) == 2, "Center must be... | 31.28169 | 106 | 0.55493 | [
"MIT"
] | Lakshmikanth2001/ElectricPy | Geometry/circle.py | 4,442 | Python |
from collections import OrderedDict
from PyQt5 import QtCore
from PyQt5 import QtWidgets
from easygraphics.dialog._indexed_order_list import IndexedOrderedDict
__all__ = ['MultipleFieldsDialog']
class MultipleFieldsDialog(QtWidgets.QDialog):
"""Dialog with multiple fields stored in a dict, with the label
... | 34.736111 | 83 | 0.62375 | [
"BSD-3-Clause"
] | royqh1979/PyEasyGraphics | easygraphics/dialog/multifields.py | 2,501 | Python |
from musicautobot.numpy_encode import *
from musicautobot.config import *
from musicautobot.music_transformer import *
from musicautobot.utils.midifile import *
from musicautobot.utils.file_processing import process_all
from musicautobot.numpy_encode import *
from musicautobot.config import *
from musicautobot.music_t... | 36.055046 | 148 | 0.724173 | [
"MIT"
] | adam1214/musicautobot | transformer code/train.py | 3,930 | Python |
import logging
from typing import Dict, List, Tuple
import aiosqlite
from btcgreen.server.address_manager import (
BUCKET_SIZE,
NEW_BUCKET_COUNT,
NEW_BUCKETS_PER_ADDRESS,
AddressManager,
ExtendedPeerInfo,
)
log = logging.getLogger(__name__)
class AddressManagerStore:
"""
Metadata table:... | 39.941176 | 117 | 0.627516 | [
"Apache-2.0"
] | BTCgreen-Network/btcgreen-blockchain | btcgreen/server/address_manager_store.py | 8,148 | Python |
# Generated by Django 3.0.5 on 2020-05-13 09:46
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('project_core', '0118_calls_need_to_be_part_of_a_funding_instrument'),
('grant_management', '0041_allows_media_to_not... | 41.814815 | 165 | 0.61116 | [
"MIT"
] | Swiss-Polar-Institute/project-application | ProjectApplication/grant_management/migrations/0042_improves_project_data_publications_social_media_types.py | 3,387 | Python |
import contextlib
import os.path
import subprocess
import pytest
from pre_commit import parse_shebang
from pre_commit.util import CalledProcessError
from pre_commit.util import cmd_output
from pre_commit.util import cmd_output_b
from testing.auto_namedtuple import auto_namedtuple
TESTING_DIR = os.path.abspath(os.pa... | 28.4 | 78 | 0.659624 | [
"MIT"
] | DjKuj/reformat | testing/util.py | 3,408 | Python |
"""Database exceptions."""
class BaseError(Exception):
"""The base exception."""
class NotFoundError(BaseError):
"""When an item was not found in the database."""
| 17.5 | 53 | 0.674286 | [
"Apache-2.0"
] | jdkandersson/OpenAlchemyPackage | database/open_alchemy/package_database/exceptions.py | 175 | Python |
from spytest import st
def init(dut):
st.create_init_config_db(dut)
def extend(dut):
st.log("Extend base config if needed", dut=dut)
st.config(dut, "config feature state nat enabled")
st.config(dut, "config feature state sflow enabled")
| 23.272727 | 56 | 0.710938 | [
"Apache-2.0"
] | akokhan/sonic-mgmt | spytest/apis/common/base_config.py | 256 | Python |
import sys
import os
import re
import importlib
import warnings
is_pypy = '__pypy__' in sys.builtin_module_names
warnings.filterwarnings('ignore',
r'.+ distutils\b.+ deprecated',
DeprecationWarning)
def warn_distutils_present():
if 'distutils' no... | 29.581395 | 120 | 0.635482 | [
"MIT"
] | JE-Chen/je_old_repo | DatabaseControlWrapper_JE/venv/Lib/site-packages/_distutils_hack/__init__.py | 3,816 | Python |
## Start of header boilerplate #################################################
from aocbase import readInput
import re
import collections
def lineParse(s, f, fp):
m = fp.match(s)
if m==None:
raise s
return tuple(map(f, m.groups()))
def fileParse(inp):
return list(inp.splitlines())
## End of... | 33.074074 | 113 | 0.439418 | [
"Apache-2.0"
] | Dyr-El/advent_of_code_2019 | Dyr-El-python/day20.py | 4,465 | Python |
import inspect
import warnings
from abc import ABCMeta, abstractmethod
from mmcv_custom.fileio.zipreader import ZipReader
class BaseStorageBackend(metaclass=ABCMeta):
"""Abstract class of storage backends.
All backends need to implement two apis: `get()` and `get_text()`.
`get()` reads the file as a byte ... | 31.582996 | 79 | 0.613511 | [
"Apache-2.0"
] | MendelXu/mmdetection-1 | mmcv_custom/fileio/file_client.py | 7,801 | Python |
r"""
This app is used to invert the styleGAN series synthesis network. We find
the matching latent vector w for given images so that we can manipulate
images in the latent feature space.
Ref: https://github.com/rosinality/stylegan2-pytorch/blob/master/projector.py # noqa
"""
import argparse
import os
im... | 32.313589 | 88 | 0.610524 | [
"Apache-2.0"
] | DequanWang/actnn-mmgen | apps/stylegan_projector.py | 9,274 | Python |
def main(x):
matrix = []
exit_path = []
for i in range(0, x):
j = list(input())
if 'e' in j:
y = j.index("e")
exit_path.append(i)
exit_path.append(y)
j[y] = "-"
matrix.append(j)
row, col = 0, 0
matrix[row][col] = "S"
path =... | 25.877193 | 70 | 0.460339 | [
"MIT"
] | borislavstoychev/Algorithms | Recursion/labyrinth.py | 1,475 | Python |
from rabbitmq_utils import read_messages
def solve_arithmetic_phrase(channel, method, properties, body):
with open('output.txt', 'a') as file:
try:
body_str = eval(body)
result = eval(body_str)
file.write(f'{body_str} = {result}\n')
return result
exc... | 28.125 | 68 | 0.624444 | [
"MIT"
] | ShaharGotshtat/parse-and-calculate-with-rabbitmq | calculator/calculator.py | 450 | Python |
from scrapy.utils.project import get_project_settings
from sqlalchemy import Column
from sqlalchemy import Integer
from sqlalchemy import String
from sqlalchemy import create_engine
from sqlalchemy.ext.declarative import declarative_base
Base = declarative_base()
def db_connect():
"""
Performs database conne... | 30.609756 | 74 | 0.723506 | [
"MIT"
] | Georgitanev/python38_proj_adata | src/parliamentbg/parliamentbg/models.py | 1,255 | Python |
import usocket as socket
import ustruct as struct
from ubinascii import hexlify
class MQTTException(Exception):
pass
class MQTTClient:
def __init__(
self,
client_id,
server,
port=0,
user=None,
password=None,
keepalive=0,
ssl=False,
ssl_... | 29.99537 | 79 | 0.491897 | [
"Apache-2.0"
] | 299Soul/AliOS-Things | components/py_engine/micropython-lib/micropython/umqtt.simple/umqtt/simple.py | 6,479 | Python |
from .player import Player
class Cell:
EMPTY = ' '
def __init__(self, value = EMPTY):
self.value = value
def __eq__(self, other):
return other is not None and self.value == other.value
def __str__(self) -> str:
return str(self.value)
def assign(self, player: Player):
... | 21.9375 | 62 | 0.615385 | [
"MIT"
] | michelAlexis/tik-tak-toe | tiktaktoe/models/cell.py | 351 | Python |
from bcipy.feedback.visual.visual_feedback import VisualFeedback
from psychopy import core
from bcipy.helpers.load import load_json_parameters
from bcipy.display.display_main import init_display_window
# Load a parameters file
parameters = load_json_parameters(
'bcipy/parameters/parameters.json', value_cast=True)... | 31.208333 | 64 | 0.809079 | [
"MIT"
] | CAMBI-tech/BciPy | bcipy/feedback/demo/demo_visual_feedback.py | 749 | Python |
class RevitLinkOperations(object,IDisposable):
"""
This class is used to extend the IExternalResourceServer interface with methods to support operations
specifically related to Revit links.
"""
def Dispose(self):
""" Dispose(self: RevitLinkOperations) """
pass
def ReleaseUnmanagedResources(self,*... | 29.641975 | 215 | 0.735943 | [
"MIT"
] | BCSharp/ironpython-stubs | release/stubs.min/Autodesk/Revit/DB/__init___parts/RevitLinkOperations.py | 2,401 | Python |
##########################################################################
#
# Copyright (c) 2013, Image Engine Design Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistrib... | 33.704225 | 85 | 0.687004 | [
"BSD-3-Clause"
] | goddardl/gaffer | python/GafferSceneUI/SceneSwitchUI.py | 2,393 | Python |
import numpy as np
mdf = np.loadtxt('raleighDemandClassesFractions.csv', delimiter=',')
mucwp = np.loadtxt('raleighUserClassesWaterPrices.csv', delimiter=',')
mstp = np.loadtxt('raleighSewageTreatmentPrice.csv', delimiter=',')
print mdf.shape
print mucwp.shape
print mstp.shape
ave_prices_per_tier = mdf * mucwp
print... | 25.411765 | 70 | 0.787037 | [
"Apache-2.0"
] | SUEZNorthAmerica/WaterPaths | TestFiles/calculate_water_prices.py | 432 | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.