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 2020 Efabless Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | 33.3625 | 125 | 0.665043 | [
"Apache-2.0"
] | donns-sandbox/openlane | scripts/add_def_obstructions.py | 2,669 | Python |
# -*- coding: utf-8 -*-
# Copyright 2022 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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... | 27.12 | 74 | 0.676254 | [
"Apache-2.0"
] | TheMichaelHu/python-aiplatform | google/cloud/aiplatform/v1/schema/predict/instance_v1/types/text_sentiment.py | 1,356 | Python |
# Copyright 2016 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... | 34.512329 | 80 | 0.629237 | [
"Apache-2.0"
] | Caesar-github/tensorflow | tensorflow/python/keras/engine/training_eager_test.py | 25,194 | Python |
import unittest
class SampleTest(unittest.TestCase):
def setUp(self):
return
def tearDown(self):
return
def test_non_unique_name(self):
pass
def test_asdf2(self):
pass
def test_i_am_a_unique_test_name(self):
pass
if __name__ == '__main__':
unittest... | 14.26087 | 43 | 0.625 | [
"Apache-2.0"
] | mrknow/filmkodi | plugin.video.mrknow/mylib/tests_pydevd_runfiles/samples/nested_dir/nested2/deep_nest_test.py | 328 | Python |
### Package Import ###
from bson import ObjectId
from pydantic import BaseModel
from pydantic import fields
from pydantic.fields import Field
from typing import Optional
### AppCode Import ###
from Server.Model.POID import PyObjectId
###############################################################################
clas... | 35.854839 | 79 | 0.530364 | [
"MIT"
] | CorneliusTantius/TCON-API-V2 | Server/Model/ModelUser.py | 2,223 | Python |
import numpy as np
import pyarrow as pa
import pyarrow.parquet as pq
import pyarrow.compute as pc
import matplotlib.pyplot as plt
import seaborn as sns
from pr3d.nonbayesian import ConditionalGammaEVM
# load dataset first
file_addresses = ['dataset_onehop_processed.parquet']
table = pa.concat_tables(
pq.read_tabl... | 31.049383 | 99 | 0.662425 | [
"MIT"
] | samiemostafavi/conditional-latency-probability-prediction | plot_conditionals_with_tis.py | 2,515 | Python |
import glob
import os
import shutil
from tests import get_device_id, get_tests_output_path, run_cli
from TTS.config.shared_configs import BaseAudioConfig
from TTS.speaker_encoder.speaker_encoder_config import SpeakerEncoderConfig
def run_test_train():
command = (
f"CUDA_VISIBLE_DEVICES='{get_device_id()}... | 28.941176 | 112 | 0.762195 | [
"MPL-2.0"
] | AI-Unicamp/TTS | tests/aux_tests/test_speaker_encoder_train.py | 2,460 | Python |
# Copyright 2021 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... | 45.275498 | 85 | 0.674029 | [
"Apache-2.0"
] | 915067906/models | official/vision/beta/modeling/layers/detection_generator.py | 38,620 | Python |
class Script(object):
START_MSG = """<b>Hello {} How are you🌹,
I'm an advanced filter bot with many capabilities!
Edit By @Yash_607
See <i>/help</i> for commands and more details.</b>
"""
HELP_MSG = """
<i>Add me as admin in your group and start filtering :)</i>
<b>Basic Commands;</b>
/start - Check if... | 21.53125 | 120 | 0.650943 | [
"MIT"
] | Apnamovi/Unlimited-filter-bot-RJ | script.py | 1,398 | Python |
from django.contrib import admin
from .models import Car, CarShop, RepairStation, RepairWork, Reapir, Person, Component
# Register your models here.
admin.site.register(Car)
admin.site.register(CarShop)
admin.site.register(Reapir)
admin.site.register(RepairWork)
admin.site.register(RepairStation)
admin.site.register(P... | 29.833333 | 86 | 0.818436 | [
"MIT"
] | mav10/dataVisualization | term_project/backend/api/admin.py | 358 | Python |
# -*- coding: utf-8 -*-
"""Launchd plist plugin."""
from __future__ import unicode_literals
from dfdatetime import semantic_time as dfdatetime_semantic_time
from plaso.containers import plist_event
from plaso.containers import time_events
from plaso.lib import definitions
from plaso.parsers import plist
from plaso.p... | 33.777778 | 78 | 0.704246 | [
"Apache-2.0"
] | ddm1004/plaso | plaso/parsers/plist_plugins/launchd.py | 3,344 | Python |
import atexit
from .MecanumRover_MotorDriver import MecanumRover_MotorDriver
import traitlets
from traitlets.config.configurable import Configurable
class Motor(Configurable):
value = traitlets.Float()
# config
alpha = traitlets.Float(default_value=1.0).tag(config=True)
beta = traitlets.Float(defaul... | 29.7 | 77 | 0.655724 | [
"MIT"
] | vstoneofficial/jetbot-mecanum | jetbot/motor.py | 1,248 | Python |
from krgram.tl.core_types.native import TL_string
from krgram.tl.base import *
class getConfig(TLFunction):
ID = 0xc4f9186b
TLRegister.register(getConfig)
class getNearestDc(TLFunction):
ID = 0x1fb33026
TLRegister.register(getNearestDc)
class getAppUpdate(TLFunction):
ID = 0xc812ac7e
def get_structure(se... | 15.945455 | 74 | 0.749145 | [
"MIT"
] | krow89/krgram | krgram/tl/api/functions/help.py | 877 | Python |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
函数
在python中函数默认的返回对象是None
"""
# 默认返回值为None
def hello():
print("Hello World!")
print(type(hello()))
# 可以返回多个对象,默认是元组
def foo():
return ['xyz', 1000, -98.6]
x, y, z = foo()
print(x, y, z)
# 关键字参数
def foo1(x):
print(x)
foo1(x='abc')
"""
创建函数
def fu... | 10.896552 | 45 | 0.613924 | [
"Apache-2.0"
] | technonac/studycode | python/python_function/func.py | 1,216 | Python |
# -*- coding: utf-8 -*-
"""
Disaster Victim Identification, Controllers
@author: nursix
"""
module = request.controller
resourcename = request.function
if not settings.has_module(module):
raise HTTP(404, body="Module disabled: %s" % module)
# ------------------------------------------------------------... | 32.571429 | 80 | 0.487573 | [
"MIT"
] | andygimma/eden | controllers/dvi.py | 9,576 | Python |
# -*- coding: utf-8 -*-
# Authors: Mainak Jas <mainak@neuro.hut.fi>
# Teon Brooks <teon.brooks@gmail.com>
#
# License: BSD (3-clause)
import copy
import glob
import os
import os.path as op
import shutil
import numpy as np
from numpy.testing import assert_equal
import pytest
from matplotlib import pyplot as p... | 39.116998 | 79 | 0.66772 | [
"BSD-3-Clause"
] | NataKozh/mne-python | mne/tests/test_report.py | 17,721 | Python |
from django.apps import AppConfig
class UbfCoreConfig(AppConfig):
name = 'ubfcore'
| 14.833333 | 33 | 0.752809 | [
"MIT"
] | himasnhu1/example | ubfcore/apps.py | 89 | Python |
# This file was automatically generated by SWIG (http://www.swig.org).
# Version 1.3.31
#
# Don't modify this file, modify the SWIG interface instead.
# This file is compatible with both classic and new-style classes.
import _sequencer_osx
import new
new_instancemethod = new.instancemethod
try:
_swig_property = p... | 26.025641 | 70 | 0.698522 | [
"MIT"
] | NFJones/python-midi | src/sequencer_osx/sequencer_osx.py | 2,030 | Python |
import argparse
import binascii
import os
from enum import Enum
from stor.plotters.bladebit import get_bladebit_install_info, plot_bladebit
from stor.plotters.chiapos import get_chiapos_install_info, plot_stor
from stor.plotters.madmax import get_madmax_install_info, plot_madmax
from stor.plotters.install_plotter impor... | 31.075676 | 114 | 0.529483 | [
"Apache-2.0"
] | Stor-Network/stor-blockchain | stor/plotters/plotters.py | 11,498 | Python |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
readme = open('README.rst').read()
requirements = [
'tweepy>=2.1',
'pymongo>=2.8.0',
'tendo>=0.0.18',
'boto>=0.0.1',
'nltk>=0.0.1',
'zc.lockfile>=0.0.... | 23.694915 | 49 | 0.584406 | [
"MIT"
] | Chattersum/tweetProcessor | setup.py | 1,398 | Python |
# coding: utf-8
"""
Kubernetes
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) # noqa: E501
The version of the OpenAPI document: v1.20.7
Generated by: https://openapi-generator.tech
"""
import pprint
import re # noqa: F401
import six
fr... | 33.57047 | 157 | 0.645942 | [
"Apache-2.0"
] | mariusgheorghies/python | kubernetes/client/models/io_xk8s_cluster_v1alpha4_machine_spec_bootstrap.py | 5,002 | Python |
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
from __future__ import division
from __future__ import print_function
import os
import abc
import six
import time
import queue
import bisect
import logging
import importlib
import traceback
import numpy as np
import pandas as pd
from multiproce... | 34.017102 | 362 | 0.594872 | [
"MIT"
] | Tirbo06/qlib | qlib/data/data.py | 37,793 | Python |
from flask_unchained.bundles.sqlalchemy import SessionManager, SQLAlchemyUnchained
def setup(db: SQLAlchemyUnchained):
session_manager = SessionManager(db)
class Foo(db.Model):
class Meta:
lazy_mapped = False
name = db.Column(db.String)
db.create_all()
return Foo, sessio... | 28.970588 | 82 | 0.613198 | [
"MIT"
] | achiang/flask-unchained | tests/bundles/sqlalchemy/services/test_session_manager.py | 1,970 | Python |
#corresponde ao video 6 do curso
# Primeiros passos
n = input('Digite algo: ')
print(n.isnumeric()) # se é numerico
print(n.isalpha()) # se é letra
print(n.isalnum()) # se é alpha numerico
print(n.isupper()) # ta em letra maiuscula | 29 | 42 | 0.706897 | [
"MIT"
] | Carlosouzavalle/Python | Aula 1/aula2.py | 235 | Python |
from service import Service
class ICQ(Service):
async def run(self):
await self.client.post('https://www.icq.com/smsreg/requestPhoneValidation.php',
data={'msisdn': self.formatted_phone, "locale": 'en', 'countryCode': 'ru',
'versio... | 41.111111 | 106 | 0.537838 | [
"MPL-2.0",
"MPL-2.0-no-copyleft-exception"
] | spam-sms/b0mb3r-beta | b0mb3r/services/icq.py | 370 | Python |
#!/usr/bin/env python3
import numpy as np
import qiskit
num_params = 2 # make sure you set this correctly to the number of parameters used by the ansatz
## Previously used for Helium VQE in Rigetti implementation
#
def tiny_ansatz_2(current_params):
q = qiskit.QuantumRegister(2, "q")
qc = qiskit.Quantum... | 22.90625 | 101 | 0.581173 | [
"BSD-3-Clause"
] | ctuning/ck-qisk | soft/template.qiskit.ansatz/python_code/tiny2/custom_ansatz.py | 733 | Python |
import os
import time
import traceback
from conans.client.tools.files import human_size
from conans.errors import AuthenticationException, ConanConnectionError, ConanException, \
NotFoundException
from conans.util.files import mkdir, save_append, sha1sum, to_file_bytes
from conans.util.log import logger
from conan... | 38.655303 | 106 | 0.590691 | [
"MIT"
] | AKhranovskiy/conan | conans/client/rest/uploader_downloader.py | 10,205 | Python |
"""example URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/3.0/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: path('', views.home, name='home')
Class-based... | 34.826087 | 77 | 0.702871 | [
"MIT"
] | lambdalisue/django-codemirror-widget | example/example/urls.py | 801 | Python |
#!/usr/bin/env python3
# Copyright (c) 2015-2016 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test privcyd with different proxy configuration.
Test plan:
- Start privcyd's with different proxy con... | 41.282178 | 120 | 0.624535 | [
"MIT"
] | Bob-bit-PRIV/PRiVCY | test/functional/proxy_test.py | 8,339 | Python |
# -*- coding: utf-8 -*-
from django.contrib import admin
from django.contrib.auth.admin import UserAdmin as OriginalUserAdmin
from django.contrib.auth.models import User as OriginalUser
from cms.utils.compat.dj import get_user_model
if getattr(OriginalUser._meta, 'swapped', False):
class UserAdmin(OriginalUserAdm... | 35.714286 | 73 | 0.74 | [
"BSD-3-Clause"
] | MagicSolutions/django-cms | cms/test_utils/project/customuserapp/admin.py | 500 | Python |
"""Author: Brandon Trabucco
Calculate the part of speech tagger using the brown corpus.
"""
import glove.configuration
import glove.tagger
config = glove.configuration.TaggerConfiguration(
tagger_dir="./")
glove.tagger.dump(config)
| 15.1875 | 59 | 0.761317 | [
"MIT"
] | brandontrabucco/glove | tagger/calculate_tagger.py | 243 | Python |
import torch
from transformers import *
import pdb
import operator
from collections import OrderedDict
import sys
# OPTIONAL: if you want to have more information on what's happening, activate the logger as follows
import logging
logging.basicConfig(level=logging.INFO)
PATH='bert-base-cased'
# Load pre-trained model... | 30.147059 | 100 | 0.59935 | [
"MIT"
] | ajitrajasekharan/bert_mask | examine_vectors.py | 3,075 | Python |
# -*- coding: utf-8 -*-
"""
slicr.resources.links
~~~~~~~~~~~~~~~~~~~~~
Slicr link resource.
:copyright: © 2018
"""
from flask import current_app
from flask_restful import Resource
from webargs import fields
from webargs.flaskparser import use_args
from slicr.models import Link, LinkSchema
from slicr.utils import c... | 24.732919 | 69 | 0.506781 | [
"MIT"
] | travisbyrum/slicr | slicr/resources/links.py | 3,983 | Python |
import requests
import json
from .config import auth_token, base_url
from .recommendation_client import RecommendationClient
from .json_parser import json_parser
class ExperimentClient(object):
"""Experiment Client Class
This object defines a Thor experiment within the Python environment. In
particular, ... | 44.912195 | 80 | 0.641686 | [
"MIT"
] | JamesBrofos/Thor-Python-Client | thor_client/experiment_client.py | 9,207 | Python |
# -*- coding: utf-8 -*-
"""
pygments.lexers.math
~~~~~~~~~~~~~~~~~~~~
Lexers for math languages.
:copyright: Copyright 2006-2010 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
import re
try:
set
except NameError:
from sets import Set as set
from pygments.l... | 40.07381 | 86 | 0.503297 | [
"Apache-2.0"
] | TheDleo/backplanejs | tools/yuidoc/bin/pygments/lexers/math.py | 16,831 | Python |
def get_strings(city):
| 12 | 22 | 0.75 | [
"Apache-2.0"
] | vijaykumawat256/Prompt-Summarization | data/studio21_generated/introductory/3210/starter_code.py | 24 | Python |
# -*- coding: utf-8 -*-
"""
Indices library
===============
This module describes climate indicator functions. Functions are listed in alphabetical order and describe the raw
computation performed over xarray.DataArrays. DataArrays should carry unit information to allow for any needed
unit conversions. The output's a... | 35.088608 | 117 | 0.712843 | [
"Apache-2.0"
] | gacou54/xclim | xclim/indices/__init__.py | 2,772 | Python |
import asyncio
import logging
from typing import List, Optional, Set, Tuple
import aiosqlite
from blspy import G1Element
from chia.types.blockchain_format.sized_bytes import bytes32
from chia.util.db_wrapper import DBWrapper
from chia.util.ints import uint32
from chia.wallet.derivation_record import DerivationRecord
... | 32.74269 | 117 | 0.59841 | [
"Apache-2.0"
] | 1SecureANDROID/chia-blockchain | chia/wallet/wallet_puzzle_store.py | 11,198 | Python |
solution = 132Pattern()
assert X == solution.find132pattern( ) | 31 | 38 | 0.758065 | [
"Apache-2.0"
] | spencercjh/sync-leetcode-today-problem-python3-example | test/test_132_pattern.py | 62 | Python |
# Copyright (C) 2019 by Landmark Acoustics LLC
r"""A class to write a WAV-formatted file."""
import wave
class WaveFile:
'''A wrapper for `Wave_write` from Python STL's `wave` module.
Parameters
----------
name : str
The name to save the file as. It should include path and extension.
sa... | 25.932039 | 77 | 0.592662 | [
"MIT"
] | landmarkacoustics/lac-audio-files | lacaudiofiles/wave/wavefile.py | 2,671 | Python |
#Nota Média do aluno
n1 = float(input('Primeira nota do aluno: '))
n2 = float(input('Segundo nota do aluno: '))
média = (n1 + n2) / 2
print('A média entre {:.1f} e {:.1f} é igual a {:.1f}'.format(n1, n2, média))
| 36.166667 | 78 | 0.608295 | [
"MIT"
] | ErosMLima/python-server-connection | ex007.1.py | 222 | Python |
# Generated by Django 3.1.2 on 2020-10-08 05:13
from django.conf import settings
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('notes', '0003_auto_20201006_0607'),
]
operations = [
... | 22.95 | 66 | 0.649237 | [
"MIT"
] | Namnetsy/simple-notes-django-app | simple_notes/notes/migrations/0004_auto_20201008_0513.py | 459 | Python |
"""
Deployment helpers
==================
"""
import os
import logging
from ..definitions import ROOT_DIR
from .docker import Docker
from .ecr import ECR
from .s3 import S3
from .sagemaker import Sagemaker
logger = logging.getLogger(__name__)
def build(run, project, model_type):
docker = Docker()
docker_pat... | 31.462687 | 108 | 0.70778 | [
"MIT"
] | crowdbreaks/text-classification | txcl/utils/deploy_helpers.py | 2,108 | Python |
#!/usr/bin/env python
"""Django's command-line utility for administrative tasks."""
import os
import sys
def main():
"""Run administrative tasks."""
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'goodshare.settings')
try:
from django.core.management import execute_from_command_line
except Im... | 28.913043 | 73 | 0.679699 | [
"MIT"
] | nikhilchaudhary0126/goodshare | manage.py | 665 | Python |
import json
import os
import httpx
import time
def get_cities(cfg):
return cfg['cities'].keys()
def get_usable_bounding_boxes(nominal_boxes, cfg):
FLICKR_PUBLIC = get_secret('flickr_api_key')
FLICKR_SECRET = get_secret('flickr_api_secret')
flickr = FlickrAPI(FLICKR_PUBLIC, FLICKR_SECRET, format='parsed-j... | 37.168142 | 97 | 0.542143 | [
"Apache-2.0"
] | IQTLabs/WITW | tools/download/flickr/src/metadata.py | 8,400 | Python |
# -*- coding: utf-8 -*-
#
# ColorHandPose3DNetwork - Network for estimating 3D Hand Pose from a single RGB Image
# Copyright (C) 2017 Christian Zimmermann
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free So... | 40.05668 | 148 | 0.552018 | [
"MIT"
] | vivekkhurana/handsign | utils/general.py | 29,686 | Python |
# -*- coding: utf-8 -*-
from sklearn.linear_model import LogisticRegression
from sklearn.metrics import accuracy_score, average_precision_score, precision_score, recall_score, f1_score, roc_auc_score, matthews_corrcoef
from sklearn.multiclass import OneVsRestClassifier
from sklearn.preprocessing import MultiLabelBinar... | 39.15625 | 204 | 0.67937 | [
"MIT"
] | bhevencious/BioNEV | src/bionev/evaluation.py | 5,012 | Python |
'''
A command library help user upload their results to dashboard.
'''
#!/usr/bin/env python
import json
import argparse
from .._utils import file_utils
from . import main
def import_local_resources(args):
'''Entrance of importing local resources'''
parser = argparse.ArgumentParser(prog="cotk import", \
... | 34.3 | 82 | 0.749271 | [
"Apache-2.0"
] | JianGuanTHU/cotk | cotk/scripts/import_local_resources.py | 686 | Python |
# coding: utf-8
import numpy as np
from frequent_direction import FrequentDirection
from sklearn.preprocessing import normalize
from sklearn.metrics.pairwise import pairwise_kernels
def laplacian_sketch(X,ell,k,do_normalize_feature,normed,callback,**args):
fd = FrequentDirection(ell,k)
D = np.array([np.sum(... | 30.482353 | 88 | 0.618294 | [
"BSD-2-Clause"
] | AtsushiHashimoto/SpectralClusteringFD | spectral_clustering_fd/laplacian_sketch.py | 2,591 | Python |
#!/usr/bin/env python
import os
import xmltodict # sudo easy_install xmltodict
import subprocess
import zipfile
class PackAndroid(object):
def __init__(self, root, project_folder, project, input_apk, destination, keystore, keystore_alias, apk_name=None, zipalign=None, jarsigner=None, configuration='Release', k... | 38.443038 | 199 | 0.609044 | [
"MIT"
] | skela/r | packandroid.py | 9,111 | Python |
import pytest
from MidiCompose.logic.rhythm.beat import Beat
from MidiCompose.logic.rhythm.measure import Measure
from MidiCompose.logic.rhythm.part import Part
@pytest.fixture
def part_1():
m1 = Measure([Beat([1,2,1,2]),
Beat([1,0,0,1])])
m2 = Measure([Beat([2,2,1,1]),
... | 19.25 | 53 | 0.590188 | [
"MIT"
] | aParthemer/MidiCompose | tests/test_logic/test_rhythm/test_Part.py | 693 | Python |
from abaqusConstants import *
from .AnalysisStep import AnalysisStep
from ..Adaptivity.AdaptiveMeshConstraintState import AdaptiveMeshConstraintState
from ..Adaptivity.AdaptiveMeshDomain import AdaptiveMeshDomain
from ..BoundaryCondition.BoundaryConditionState import BoundaryConditionState
from ..Load.LoadCase import L... | 39.066421 | 119 | 0.694248 | [
"MIT"
] | Haiiliin/PyAbaqus | src/abaqus/Step/AnnealStep.py | 10,587 | Python |
import numpy as np
import pickle as pkl
import networkx as nx
import scipy.sparse as sp
from scipy.sparse.linalg.eigen.arpack import eigsh
def sample_mask(idx, l):
"""Create mask."""
mask = np.zeros(l)
mask[idx] = 1
return np.array(mask, dtype=np.bool)
def load_data(cell_line, cross_cell_line, label... | 36.144444 | 114 | 0.67553 | [
"MIT"
] | smtnkc/gcn4epi | utils.py | 6,506 | Python |
class FittingAngleUsage(Enum, IComparable, IFormattable, IConvertible):
"""
An enumerated type representing the options for how to limit the angle values applicable to fitting content.
enum FittingAngleUsage,values: UseAnAngleIncrement (1),UseAnyAngle (0),UseSpecificAngles (2)
"""
def __eq__(se... | 26.808511 | 221 | 0.600794 | [
"MIT"
] | YKato521/ironpython-stubs | release/stubs.min/Autodesk/Revit/DB/__init___parts/FittingAngleUsage.py | 1,260 | Python |
# Copyright 2013-2018 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class PerlFileListing(PerlPackage):
"""Parse directory listing"""
homepage = "http://search... | 32.222222 | 90 | 0.715517 | [
"ECL-2.0",
"Apache-2.0",
"MIT"
] | HaochengLIU/spack | var/spack/repos/builtin/packages/perl-file-listing/package.py | 580 | Python |
"""
This plugin is for recording test results in the Testcase Database.
"""
import getpass
import time
import uuid
from nose.plugins import Plugin
from nose.exc import SkipTest
from seleniumbase.core.application_manager import ApplicationManager
from seleniumbase.core.testcase_manager import ExecutionQueryPayload
from... | 37.382514 | 79 | 0.612045 | [
"MIT"
] | Mu-L/SeleniumBase | seleniumbase/plugins/db_reporting_plugin.py | 6,841 | Python |
# -*- encoding: utf-8 -*-
from django.utils.translation import ugettext_lazy as _
from grappelli.dashboard import modules, Dashboard
from grappelli.dashboard.utils import get_admin_site_name
class DjangoPagesDashboard(Dashboard):
"""
Custom index dashboard for Django-pages
"""
def init_with_context... | 26.621053 | 59 | 0.451562 | [
"BSD-3-Clause"
] | lunemec/django-pages | django_pages/dashboard.py | 2,529 | Python |
import h5py
import numpy as np
import os
from plyfile import PlyData, PlyElement
HDF5_DATA = 'hdf5_data'
print('Generating .h5 files...', '\n')
if not os.path.exists(HDF5_DATA):
os.mkdir(HDF5_DATA)
filenames_training = [line.rstrip() for line in open("filelist_training.txt", 'r')]
filenames_testing = [line.rstr... | 41.759494 | 113 | 0.631403 | [
"MIT"
] | pisalore/pointnet_shrec17-classificator | data/make_hdf5_files.py | 3,299 | Python |
#!/usr/bin/env python
"""
Object-oriented implementation of backup reporting code.
Defines a class called 'Backup' that records all backups of a device
"""
import os, sys, argparse
import glob
from configparser import ConfigParser
from atlassian import Confluence
class Backup:
def __init__(sel... | 32.630137 | 82 | 0.585642 | [
"CC0-1.0"
] | oldD0g/code-snippets | python/atlassian/config-report.py | 2,382 | Python |
# Copyright 2013-2018 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class RMatrixstats(RPackage):
"""High-performing functions operating on rows and columns of matr... | 42.909091 | 79 | 0.720339 | [
"ECL-2.0",
"Apache-2.0",
"MIT"
] | HaochengLIU/spack | var/spack/repos/builtin/packages/r-matrixstats/package.py | 944 | Python |
import pandas as pd
import re
import nltk
from nltk.corpus import stopwords
from nltk.stem.wordnet import WordNetLemmatizer
from nltk.tokenize import word_tokenize
from sklearn.feature_extraction.text import TfidfVectorizer
from sklearn.metrics.pairwise import cosine_similarity
from sklearn.metrics.pairwise import line... | 37.400585 | 135 | 0.642718 | [
"MIT"
] | dalpengholic/Udacity_Recommendations_with_IBM | model/recommendation_functions.py | 12,791 | Python |
#!/usr/bin/env python
import rospy
import math
from std_msgs.msg import Float64
from geometry_msgs.msg import Twist
class SimpleRoverController:
def __init__(self):
self.namespace = rospy.get_param("name_space", "scout_1")
self.w_s = rospy.get_param("wheel_separation", 1.7680) #... | 43.822917 | 131 | 0.651058 | [
"MIT"
] | BhargavRE25/Rover-Machine-Learning | src/csi_rover_controls/deprecated/simple_rover_controller.py | 4,207 | Python |
"""
Copyright (c) 2018 Intel Corporation
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in wri... | 33.488889 | 83 | 0.68215 | [
"Apache-2.0"
] | ArutyunovG/dldt | model-optimizer/extensions/middle/UselessMerge.py | 1,507 | Python |
#!/usr/bin/python
# -*- coding: utf-8 -*-
import sys
sys.dont_write_bytecode=True
from distutils.core import setup
from pyxsltp import __version__
setup(
name = "pyxsltp",
version = __version__,
py_modules = ['pyxsltp'],
scripts = ['pyxsltp'],
)
| 16.5625 | 32 | 0.671698 | [
"MIT"
] | hisashim/pyxsltp | setup.py | 265 | Python |
# Generated by Django 2.0.6 on 2018-07-05 16:13
from django.db import migrations, models
import posts.models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Post',
fields=[
('id', ... | 35.090909 | 164 | 0.578584 | [
"MIT"
] | AmrMKayid/django-blog | posts/migrations/0001_initial.py | 1,158 | Python |
# (C) Datadog, Inc. 2019-present
# All rights reserved
# Licensed under a 3-clause BSD style license (see LICENSE)
__version__ = '2.3.0'
| 27.4 | 59 | 0.722628 | [
"BSD-3-Clause"
] | Barbayar/integrations-core | presto/datadog_checks/presto/__about__.py | 137 | Python |
from enum import IntEnum
from typing import Dict, Union, Callable, List, Optional
from cereal import log, car
import cereal.messaging as messaging
from common.realtime import DT_CTRL
from selfdrive.config import Conversions as CV
from selfdrive.locationd.calibrationd import MIN_SPEED_FILTER
AlertSize = log.ControlsSt... | 34.815668 | 152 | 0.691264 | [
"MIT"
] | fallen8angel/forNEXO | selfdrive/controls/lib/events.py | 30,954 | Python |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import simplejson as json
from alipay.aop.api.response.AlipayResponse import AlipayResponse
class SsdataDataserviceDtevalIdentitycheckQueryResponse(AlipayResponse):
def __init__(self):
super(SsdataDataserviceDtevalIdentitycheckQueryResponse, self).__init__()... | 31.712121 | 122 | 0.697086 | [
"Apache-2.0"
] | articuly/alipay-sdk-python-all | alipay/aop/api/response/SsdataDataserviceDtevalIdentitycheckQueryResponse.py | 2,093 | Python |
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# -----------------------------------------------------------------... | 48.058824 | 101 | 0.585679 | [
"Unlicense",
"MIT"
] | amcclead7336/Enterprise_Data_Science_Final | venv/lib/python3.8/site-packages/vsts/build/v4_1/models/source_provider_attributes.py | 1,634 | Python |
""" Tests the creation of tables, and the methods of the sql class
"""
from pyrate.repositories.sql import Table
from utilities import setup_database
class TestSql:
""" Tests the Sql class
"""
def test_get_list_of_columns(self, setup_database):
db = setup_database
rows = [{'unit': 'days',
... | 33.959184 | 71 | 0.558293 | [
"MIT"
] | UCL-ShippingGroup/pyrate | tests/test_sql.py | 1,664 | Python |
# --------------------------------------------------------
# Fast R-CNN
# Copyright (c) 2015 Microsoft
# Licensed under The MIT License [see LICENSE for details]
# Written by Ross Girshick
# --------------------------------------------------------
# pylint: disable-all
# flake8: noqa
"""Factory method for easily getti... | 36 | 124 | 0.638889 | [
"MIT"
] | hinthornw/faster_rcnn_symbols | lib/datasets/factory.py | 2,880 | Python |
import math
def is_prime(num):
if num < 2:
return False
for i in range(num):
if i < 2:
continue
if num % i == 0:
return False
return True
def get_nth_prime(n):
cnt = 0
i = 0
while cnt < n:
i += 1
if is_prime(i):
cnt += 1
return i
if __name__ == '__main__':
#pr... | 13.740741 | 28 | 0.568733 | [
"MIT"
] | birdchan/project_euler | problems/007/run.v1.py | 371 | Python |
# coding: utf-8
import pprint
import re
import six
from huaweicloudsdkcore.sdk_response import SdkResponse
class CreateConfigurationResponse(SdkResponse):
"""
Attributes:
openapi_types (dict): The key is attribute name
and the value is attribute type.
attribute_ma... | 28.247706 | 84 | 0.583956 | [
"Apache-2.0"
] | JeffreyDin/huaweicloud-sdk-python-v3 | huaweicloud-sdk-rds/huaweicloudsdkrds/v3/model/create_configuration_response.py | 3,079 | Python |
from tkinter import *
from tkinter import ttk
import time
import time
window = Tk()
mygreen = "lightblue"
myred = "blue"
style = ttk.Style()
style.theme_create( "dedoff", parent="alt", settings={
"TNotebook": {"configure": {"tabmargins": [2, 5, 2, 0] } },
"TNotebook.Tab": {
"configure": ... | 51.31405 | 251 | 0.628872 | [
"Unlicense"
] | Clonexy700/edu54book | edu54book/edu54bookSizeAuto.py | 22,153 | Python |
from onconet.models.factory import load_model, RegisterModel, get_model_by_name
import math
import torch
import torch.nn as nn
import pdb
import numpy as np
@RegisterModel("mirai_full")
class MiraiFull(nn.Module):
def __init__(self, args):
super(MiraiFull, self).__init__()
self.args = args
... | 47.15 | 233 | 0.68929 | [
"MIT"
] | NkwamPhilip/Mirai | onconet/models/mirai_full.py | 1,886 | Python |
import unittest
from facial_recog.app import *
from .test_config import test_run_count, seed, success_perc
from .test_util import *
class TestFR(unittest.TestCase):
subject_names = dict()
subject_classes = dict()
def setUp(self):
random.seed(seed)
create_app_dirs()
setup_logger(... | 30.864407 | 116 | 0.645799 | [
"MIT"
] | MePsyDuck/amfr | facial_recog/tests/test_app.py | 1,821 | Python |
version_info = (1, 5, 0, 'dev0')
__version__ = '.'.join(map(str, version_info))
| 26.666667 | 46 | 0.65 | [
"MIT"
] | hwansysgit/qtpy | qtpy/_version.py | 80 | Python |
# Copyright 2003-2008 by Leighton Pritchard. All rights reserved.
# Revisions copyright 2008-2009 by Peter Cock.
# This code is part of the Biopython distribution and governed by its
# license. Please see the LICENSE file that should have been included
# as part of this package.
#
# Contact: Leighton Pritchard,... | 44.79615 | 112 | 0.547479 | [
"BSD-2-Clause"
] | LyonsLab/coge | bin/last_wrapper/Bio/Graphics/GenomeDiagram/_CircularDrawer.py | 51,202 | Python |
import plotly.graph_objects as go
import pandas as pd
from .Colors import COLOR_DISCRETE_MAP
from Classification import CATEGORIES
def all_categories_grouping(row: pd.Series) -> str:
"""
Merge Category, Fuel and segment to a single string for unique categorization
"""
if row['Fuel'] == 'Battery Elect... | 44.882979 | 120 | 0.605357 | [
"MIT"
] | actuatech/fuel-tourism | Graphing/MeanActivityHorizontalBarChart.py | 4,224 | Python |
# JadenCase 문자열 만들기
def solution(s):
s = s.lower()
changed_words = []
print(s.split(" "))
for word in s.split(" "):
if len(word) == 0:
changed_words.append(word)
continue
elif len(word) == 1:
word = word[0].upper()
else:
word = wor... | 22.837209 | 45 | 0.546843 | [
"MIT"
] | StudyForCoding/ProgrammersLevel | Level2/Lessons12951/gamjapark2.py | 1,232 | Python |
class Pessoa:
def __init__(self,nome,idade,cpf,salario):
self.nome = nome
self.idade = idade
self.cpf = cpf
self.salario = salario
def Aumento(self):
return self.salario *0.05
class Gerente(Pessoa):
def __init__(self,nome,idade,cpf,salario,senha):
... | 20.949153 | 63 | 0.61165 | [
"Apache-2.0"
] | Madara701/Pythob_OO | Python_OO/Exercicio.py | 1,236 | Python |
import os
import re
import wx
import wx.grid
from . import dialog_base
def pop_error(msg):
wx.MessageBox(msg, 'Error', wx.OK | wx.ICON_ERROR)
class SettingsDialog(dialog_base.SettingsDialogBase):
def __init__(self, extra_data_func, extra_data_wildcard, config_save_func,
file_name_format_h... | 41.957386 | 79 | 0.644458 | [
"MIT"
] | INTI-CMNB/InteractiveHtmlBom | InteractiveHtmlBom/dialog/settings_dialog.py | 14,769 | Python |
from __future__ import unicode_literals, print_function
from libraries.lambda_handlers.register_module_handler import RegisterModuleHandler
def handle(event, context):
"""
Called by a module when it is deployed to register it
:param dict event:
:param context:
:return dict:
"""
return Regi... | 27.923077 | 83 | 0.752066 | [
"MIT"
] | WycliffeAssociates/tx-manager | functions/register_module/main.py | 363 | Python |
"""
Problem Statement:
Let the function f(s) be the frequency of the lexicographically smallest character in a non-empty string s. For example, if s = "dcce" then f(s) = 2 because the lexicographically smallest character is 'c', which has a frequency of 2.
You are given an array of strings words and another array of q... | 36.677966 | 233 | 0.66451 | [
"MIT"
] | Ayonijakaushik19/DSA-guide | Arrays/python/compareStringByFrequencyOfSmallestCharacter.py | 2,164 | Python |
class MetricHandler:
"""
Object meant to be used in the training loop to handle metrics logs
"""
def __init__(self):
pass
def add(self, outputs, targets):
"""
Adding metric for each batch
:param outputs: outputs of the model
:param targets: targets of the m... | 27.356436 | 99 | 0.565328 | [
"MIT"
] | gregunz/FacadeParsing | facade_project/utils/ml_utils.py | 2,763 | Python |
from __future__ import absolute_import
import pytest
import logging
import mock
from sentry.logging.handlers import StructLogHandler
@pytest.fixture
def handler():
return StructLogHandler()
@pytest.fixture
def logger():
return mock.MagicMock()
def make_logrecord(**extra):
kwargs = dict(
name... | 24.016393 | 92 | 0.640273 | [
"BSD-3-Clause"
] | Ali-Tahir/sentry | tests/sentry/logging/test_handler.py | 1,465 | Python |
"""
Optimizers
----------
.. autosummary::
:template: template.rst
:toctree:
Solver
ScipySolver
CandidateSolver
GridSolver
"""
from .solver import Solver
from .scipy import ScipySolver
from .candidate import CandidateSolver, GridSolver, FiniteDomainSolver
| 13.95 | 70 | 0.713262 | [
"MIT"
] | eric-vader/HD-BO-Additive-Models | hdbo/febo/solvers/__init__.py | 279 | Python |
import turtle
tortuguita= turtle.Turtle()
tortuguita.speed(100)
tortuguita.dot(30,"black")
tortuguita.forward(15)
tortuguita.left(90)
tortuguita.circle(50)
tortuguita.circle(70)
tortuguita.circle(90)
tortuguita.right(90)
tortuguita.up()
tortuguita.forward(15)
tortuguita.down()
tortuguita.dot(30,"black")
turtle.done... | 16.947368 | 27 | 0.785714 | [
"MIT"
] | Aleff13/poo-ufsc | exercicios-turtle/.history/clown_20210623230605.py | 322 | Python |
import grpc
from functools import wraps
class WalletEncryptedError(Exception):
def __init__(self, message=None):
message = message or 'Wallet is encrypted. Please unlock or set ' \
'password if this is the first time starting lnd. '
super().__init__(message)
def han... | 38.303571 | 129 | 0.558042 | [
"MIT"
] | ibz/lnd-grpc-client | lndgrpc/errors.py | 2,145 | Python |
# Copyright (c) OpenMMLab. All rights reserved.
import copy
import torch
import torch.nn as nn
from mmcls.models.builder import BACKBONES
from mmcv.cnn import build_activation_layer, build_norm_layer
from ...utils import Placeholder
class FactorizedReduce(nn.Module):
"""Reduce feature map size by factorized poi... | 34.028269 | 79 | 0.538733 | [
"Apache-2.0"
] | David-19940718/mmclassification | mmcls/models/architectures/components/backbones/darts_backbone.py | 9,630 | Python |
from random import randint
from time import sleep
def sorteio(lista):
print('-=' * 30)
print('Sorteando 5 valores da lista: ', end='')
for i in range(0, 5):
lista.append(randint(1, 10))
print(f'{lista[i]} ', end='', flush=True)
sleep(0.3)
print('PRONTO!')
def somaPar(lista):
... | 22.153846 | 64 | 0.574653 | [
"MIT"
] | juniorpedroso/Exercicios-CEV-Python | ex100.py | 576 | Python |
"""Project signals"""
import logging
import django.dispatch
from django.contrib import messages
from django.dispatch import receiver
from django.utils.translation import ugettext_lazy as _
from readthedocs.oauth.services import registry
before_vcs = django.dispatch.Signal(providing_args=["version"])
after_vcs = dj... | 30.410256 | 78 | 0.716695 | [
"MIT"
] | ank-forked/readthedocs.org | readthedocs/projects/signals.py | 1,186 | Python |
#Author: Sepehr Roudini.
#Date: 02/05/2018.
#University of Iowa.
#Department of Chemical Engineering.
#Purpose: Calculating mean and Std
#--------------------------------------------------------------------------------------------#
#Defining function and importing necessary libraries.
#----------------------... | 48.513514 | 95 | 0.262953 | [
"MIT"
] | SkyRd1/Statistical_Functions | Mean_Std_Calculation.py | 1,795 | Python |
import pandas as pd
import sys
from os import path
import numpy
from sys import exit
def main():
if len(sys.argv)!=5:
print("Incorrect no. of parameters passed.")
exit(0)
i=sys.argv[1]
w=sys.argv[2]
im=sys.argv[3]
result=sys.argv[4]
if not i.endswith('.csv... | 30.281553 | 99 | 0.435075 | [
"MIT"
] | diptikaushal/TOPSIS-Dipti-101803601 | topsis.py | 3,119 | Python |
"""Users serializers"""
# Django
from django.conf import settings
from django.contrib.auth import password_validation, authenticate
from django.core.validators import RegexValidator
# Serializers
from cride.users.serializers.profiles import ProfileModelSerializer
# Django REST Framework
from rest_framework import se... | 30.566434 | 98 | 0.672615 | [
"MIT"
] | eocode/Rider-App | cride/users/serializers/users.py | 4,371 | Python |
import pyomo.environ as pe
import romodel as ro
feeds = range(5)
products = range(4)
pools = range(2)
qualities = range(4)
con_feed_pool = [(0, 0), (1, 0), (2, 0), (3, 1), (4, 1)]
con_pool_prod = [(0, 0), (0, 1), (0, 2), (0, 3), (1, 0), (1, 1), (1, 2), (1, 3)]
con_feed_prod = []
price_product = [16, 25, 15, 10]
pric... | 29.601399 | 81 | 0.566501 | [
"MIT"
] | tsaycal/romodel | examples/pooling.py | 4,233 | Python |
from sqlalchemy.orm import Session
from .base import CRUDBase
from app.models import Group
from app.schemas import GroupCreate, GroupUpdate
class CRUDGroup(CRUDBase[Group, GroupCreate, GroupUpdate]):
def count(self, db: Session) -> int:
return db.query(Group).count()
group = CRUDGroup(Group)
| 22.142857 | 59 | 0.751613 | [
"MIT"
] | LukasPatzke/ambientHUE | api/app/crud/crud_group.py | 310 | Python |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from . import __version__ as app_version
app_name = "custom_scripts"
app_title = "Custom Scripts"
app_publisher = "C.R.I.O"
app_description = "For custom scripts"
app_icon = "octicon octicon-file-directory"
app_color = "grey"
app_email = "criogroups@gmail... | 24.635294 | 107 | 0.685769 | [
"MIT"
] | VPS-Consultancy/custom_scripts | custom_scripts/hooks.py | 4,188 | Python |
from django.urls import path
from .views import DetailView
app_name = 'comments'
urlpatterns = [
path('<slug:model>/<slug:slug>', DetailView.as_view(), name='detail')
]
| 17.6 | 73 | 0.704545 | [
"MIT"
] | Aabhusan/Koora | src/comments/urls.py | 176 | Python |
# Copyright 2017 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... | 36.743326 | 88 | 0.555941 | [
"MIT"
] | sethusaim/Automatic-Number-Plate-Recognition | base2designs/utils/np_box_list_ops_test.py | 17,894 | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.