content stringlengths 7 928k | avg_line_length float64 3.5 33.8k | max_line_length int64 6 139k | alphanum_fraction float64 0.08 0.96 | licenses list | repository_name stringlengths 7 104 | path stringlengths 4 230 | size int64 7 928k | lang stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|
from unittest import TestCase
from unittest.mock import patch
from xmlschema import XMLSchemaException
from xml.dom.minidom import Element, Document, parse
class TestXmlParserInstructionspath(TestCase):
@patch('businesslogic.placeholders.Placeholder._initialize_global_placeholders')
@patch('instructionparsers... | 45.753906 | 115 | 0.712029 | [
"CC0-1.0"
] | 3Peso/mosk | tests/test_xmlparser.py | 11,713 | Python |
# -*- coding: utf-8 -*-
"""
Microsoft-Windows-ShellCommon-StartLayoutPopulation
GUID : 97ca8142-10b1-4baa-9fbb-70a7d11231c3
"""
from construct import Int8sl, Int8ul, Int16ul, Int16sl, Int32sl, Int32ul, Int64sl, Int64ul, Bytes, Double, Float32l, Struct
from etl.utils import WString, CString, SystemTime, Guid
from etl.dt... | 30.899576 | 123 | 0.72178 | [
"Apache-2.0"
] | IMULMUL/etl-parser | etl/parsers/etw/Microsoft_Windows_ShellCommon_StartLayoutPopulation.py | 21,846 | Python |
#!/usr/bin/env python
from setuptools import setup, find_packages
# Parse version number from pyglet/__init__.py:
with open('pyglet/__init__.py') as f:
info = {}
for line in f:
if line.startswith('version'):
exec(line, info)
break
setup_info = dict(
name='pyglet',
ver... | 33.775862 | 79 | 0.616641 | [
"BSD-3-Clause"
] | Ball-Man/pyglet | setup.py | 1,959 | Python |
# SPDX-License-Identifier: Apache-2.0
# automatically generated by the FlatBuffers compiler, do not modify
# namespace: tflite
import flatbuffers
from flatbuffers.compat import import_numpy
np = import_numpy()
class LessOptions(object):
__slots__ = ['_tab']
@classmethod
def GetRootAs(cls, buf, offset=0... | 32.125 | 114 | 0.705837 | [
"Apache-2.0"
] | LoicDagnas/tensorflow-onnx | tf2onnx/tflite/LessOptions.py | 1,285 | Python |
import os.path
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
def read(filename):
return open(os.path.join(os.path.dirname(__file__), filename)).read()
setup(
name='copydoc',
version='1.0.9',
author='NPR Visuals',
author_email='nprapps@npr.org',
... | 27.416667 | 73 | 0.584347 | [
"MIT"
] | nprapps/copydoc | setup.py | 1,316 | Python |
from __future__ import print_function
import sys
import os
sys.path.append(os.path.abspath(".."))
from termux2d import Canvas, Palette, line, animate, COLOR_RED, COLOR_WHITE
import math
def __main__():
i = 0
height = 40
while True:
frame = []
frame.extend([(coords[0],coords[1],COLOR_WHIT... | 23.151515 | 87 | 0.53534 | [
"MIT"
] | ericmux/termux2d | examples/sine_tracking.py | 764 | Python |
import os
basedir = os.path.abspath(os.path.dirname(__file__))
class Config(object):
#SESSION_COOKIE_SECURE = True
SECRET_KEY = os.environ.get('SECRET_KEY') or 'you-will-never-guess'
| 26.571429 | 68 | 0.763441 | [
"MIT"
] | matale14/api-blueprint | config.py | 186 | Python |
"""
DIRBS module for utility classes and functions.
Copyright (c) 2018 Qualcomm Technologies, Inc.
All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted (subject to the
limitations in the disclaimer below) provided that the following conditions are m... | 46.044628 | 119 | 0.651219 | [
"BSD-3-Clause-Clear"
] | nealmadhu/DIRBS-Core | src/dirbs/utils.py | 27,857 | Python |
import config
import pandas as pd
import pickle
import numpy as np
from keras.preprocessing.text import Tokenizer
from keras.preprocessing.sequence import pad_sequences
from sklearn.model_selection import StratifiedKFold
from sklearn.metrics import classification_report
import tensorflow as tf
from keras import Sequ... | 39.314079 | 126 | 0.697062 | [
"MIT"
] | WayneGame/InformationExtraction | classification/src/train.py | 10,962 | Python |
"""Returns full pathname of backup directory."""
import os
import pytest
from pathlib import Path
from mklists.constants import CONFIGFILE_NAME
from mklists.returns import get_backupdir_path
def test_get_backupdir_path(tmp_path):
"""Returns backups Path named for default working directory."""
os.chdir(tmp_pa... | 38.898305 | 87 | 0.747277 | [
"MIT"
] | tombaker/mklists_old | tests/returns/test_get_backupdir_path.py | 2,295 | Python |
# Copyright 2015 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 required by applicable law or a... | 36.673713 | 170 | 0.524774 | [
"Apache-2.0"
] | stevengoossensB/timesketch | timesketch/lib/datastores/elastic.py | 39,901 | 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.
from .mininode import *
from .blockstore import BlockStore, TxStore
from .util import p2p_port
'''
This ... | 45.184019 | 149 | 0.600825 | [
"MIT"
] | 86b/Abosom | qa/rpc-tests/test_framework/comptool.py | 18,661 | Python |
# exported from PySB model 'model'
from pysb import Model, Monomer, Parameter, Expression, Compartment, Rule, Observable, Initial, MatchOnce, Annotation, ANY, WILD
Model()
Monomer('Ligand', ['Receptor'])
Monomer('ParpU', ['C3A'])
Monomer('C8A', ['BidU', 'C3pro'])
Monomer('SmacM', ['BaxA'])
Monomer('BaxM', ['BidM', '... | 91.349515 | 710 | 0.806515 | [
"MIT"
] | LoLab-VU/Bayesian_Inference_of_Network_Dynamics | log_complete/model_160.py | 18,818 | Python |
# Copyright 2014 Eucalyptus Systems, Inc.
#
# Redistribution and use of this software 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 conditions and t... | 46.175 | 76 | 0.769356 | [
"BSD-2-Clause"
] | Juniper/euca2ools | euca2ools/commands/cloudformation/liststackresources.py | 1,847 | Python |
# encoding: utf-8
# ## Imports
from threading import local as __local
# Expose these as importable from the top-level `web.core` namespace.
from .application import Application
from .util import lazy
# ## Module Globals
__all__ = ['local', 'Application', 'lazy'] # Symbols exported by this package.
# This is to... | 21.2 | 96 | 0.735849 | [
"MIT"
] | marrow/WebCore | web/core/__init__.py | 424 | Python |
import sys, os, json
version = (3,7)
assert sys.version_info >= version, "This script requires at least Python {0}.{1}".format(version[0],version[1])
# Game loop functions
def render(game,current):
''' Displays the current room '''
print('You are in the ' + game['rooms'][current]['name'])
print(game['... | 21 | 112 | 0.61039 | [
"MIT"
] | BraffordHunter/03-Text-Adventure-2 | main.py | 1,155 | Python |
import tensorflow as tf
from tensorflow import keras
import numpy as np
import matplotlib.pyplot as plt
#print(tf.__version__)
def plot_image(i, predictions_array, true_label, img):
predictions_array, true_label, img = predictions_array[i], true_label[i], img[i]
plt.grid(False)
plt.xticks([])
plt.yticks([])
... | 26.292929 | 84 | 0.684211 | [
"MIT"
] | VitorGDellino/Neural-Network | MNIST/mnist.py | 2,603 | Python |
"""Test all API endpoints.
This test class exercises all client facing APIs. It is also usesful as a tool for
demonstrating how to interact with the various APIs.
"""
import json
import pytest
from expects import (be, be_above, be_above_or_equal, contain, equal, expect,
raise_error)
from flask ... | 34.031034 | 118 | 0.580201 | [
"MIT"
] | brighthive/authserver | tests/api/test_all_apis.py | 9,869 | Python |
from typing import List
def twoSum(nums: List[int], target: int) -> List[int]:
length = len(nums)
for i,v1 in enumerate(nums):
sliced = nums[i + 1: length]
for j,v2 in enumerate(sliced):
result = v1 + v2
if result == target:
return [i, i+j+1]
return [... | 2,822.6 | 70,040 | 0.817941 | [
"MIT"
] | leocody/Leet-code | twosum.py | 70,565 | 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... | 30.131868 | 95 | 0.707877 | [
"Apache-2.0"
] | Darktex/lightning-flash | flash/image/embedding/vissl/transforms/utilities.py | 2,742 | Python |
"""Abstract Base Class for posteriors over states after applying filtering/smoothing"""
from abc import ABC, abstractmethod
class FiltSmoothPosterior(ABC):
"""Posterior Distribution over States after Filtering/Smoothing"""
@abstractmethod
def __call__(self, location):
"""Evaluate the time-continu... | 33.793651 | 90 | 0.620479 | [
"MIT"
] | admdev8/probnum | src/probnum/filtsmooth/filtsmoothposterior.py | 2,129 | Python |
# -*- coding: utf-8 -*-
import time, threading, uuid, sys
import tushare as ts
from PyQt4 import QtCore, QtGui
import utils
class ProfitStrategy(QtCore.QObject):
def init(self, b):
pass
def update_target(self, dp, p, t1, t2):
pass
def reset_target(self, b, p, t1, t2):
pass
class Pr... | 36.927835 | 137 | 0.543691 | [
"MIT"
] | dayuanyuan1989/SaveProfits | src/profit.py | 7,258 | Python |
import logging
from typing import (
Iterable,
List,
)
from lxml import etree
from sciencebeam_parser.document.semantic_document import (
SemanticContentWrapper,
SemanticFigure,
SemanticHeading,
SemanticLabel,
SemanticParagraph,
SemanticRawEquation,
SemanticSection,
SemanticSect... | 38.122137 | 97 | 0.696235 | [
"MIT"
] | elifesciences/sciencebeam-parser | sciencebeam_parser/document/tei/section.py | 4,994 | Python |
import logging
import sys
from pathlib import Path
from dotenv import load_dotenv
from flask import Flask
from code_runner.extensions import db, limiter
from . import code
def create_app(config_object='code_runner.settings'):
"""Creates and returns flask app instance as well as register all the extensions and b... | 28.508772 | 102 | 0.721231 | [
"MIT"
] | thephilomaths/code-runner-as-a-service | code_runner/app.py | 1,625 | Python |
#!/usr/bin/env python3
print( 'hello world' )
| 11.75 | 22 | 0.659574 | [
"MIT"
] | jzfarmer/learning_python | hello_world.py | 47 | Python |
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
Created on Thu Aug 23 20:32:12 2018
Functions to correctly fold and bin a light curve.
Calculate the lpp metric: transform to lower dimensions, knn
Depends on class from reading in a previously created LPP metric Map
Depends on reading in the light curve to data stru... | 28.627986 | 92 | 0.66762 | [
"MIT"
] | barentsen/dave | lpp/newlpp/lppTransform.py | 8,388 | Python |
from auth import get_token
"""
This function will take a lot of the tedious work out of generating alert messages!
Simply follow the onscreen input prompts, at the end a string with everything you need
will be output, allowing you to copy and paste into tradingview!
"""
def generate_alert_message():
print('Enter... | 26.90625 | 105 | 0.630662 | [
"MIT"
] | ramakrishnamekala129/tradingviewwebhooksbotByRK | examples/generate_alert_message.py | 861 | Python |
import pytest
from localstack.utils.objects import SubtypesInstanceManager
def test_subtypes_instance_manager():
class BaseClass(SubtypesInstanceManager):
def foo(self):
pass
class C1(BaseClass):
@staticmethod
def impl_name() -> str:
return "c1"
def f... | 22.513514 | 60 | 0.596639 | [
"Apache-2.0"
] | GroovySmoothie/localstack | tests/unit/utils/test_objects.py | 833 | Python |
# -*- coding: utf-8 -*-
# Generated by Django 1.9 on 2016-07-17 06:14
from __future__ import unicode_literals
import datetime
from django.db import migrations, models
from django.utils.timezone import utc
class Migration(migrations.Migration):
dependencies = [
('iiits', '0059_auto_20160717_0609'),
]... | 25.714286 | 110 | 0.620833 | [
"MIT"
] | IIITS/iiits.ac.in | iiits/migrations/0060_auto_20160717_0614.py | 720 | Python |
import requests
url = "https://apidojo-yahoo-finance-v1.p.rapidapi.com/market/get-trending-tickers"
querystring = {"region":"US"}
headers = {
'x-rapidapi-host': "apidojo-yahoo-finance-v1.p.rapidapi.com",
'x-rapidapi-key': "86bb0847c2msh62ec4f10fcc7ed9p17aea2jsn6b82733f81a1"
}
response = reque... | 28.857143 | 84 | 0.717822 | [
"MIT"
] | pikamegan/GMS-hackathon | yfinance_trending.py | 404 | Python |
""""
defines a class that maps to the JSON input format and can be used with pydantic.
"""
import json
import os
import pickle
from hashlib import md5
from typing import List, Optional
from pydantic import BaseModel
from mldc.util import NLGEvalOutput
class MetaDlgDataDialog(BaseModel):
id: Optional[str]
domain:... | 31.92126 | 94 | 0.695856 | [
"MIT"
] | Bhaskers-Blu-Org2/dstc8-meta-dialog | mldc/data/schema.py | 4,054 | Python |
from seatable_api import Base, context
import requests
import time
import os
"""
该脚本用于从图片链接下载图片到图片列。你可以在一个文本列中记录图片的地址,然后用这个
脚本自动下载图片并上传到图片列中。
"""
###################---基本信息配置---###################
SERVER_URL = context.server_url or 'https://cloud.seatable.cn/'
API_TOKEN = context.api_token or 'cacc4249788... | 34.182796 | 134 | 0.538534 | [
"Apache-2.0"
] | seatable/seatable-scripts-cn | examples/python/image_transfer.py | 3,759 | Python |
from django.urls import include, path, re_path
from .models import *
from .views import *
urlpatterns = [
path('imagenes/', lista_galerias_img, name='lista-galerias-img'),
path('imagenes/<tema>', filtro_temas_img, name='filtro_temas_img'),
path('imagenes/<id>/', detalle_galerias_img, name='detalle-galerias-img'),
... | 41.636364 | 75 | 0.746725 | [
"MIT"
] | ErickMurillo/interteam | galerias/urls.py | 458 | Python |
import re
from typing import Dict
from opentrons.hardware_control.g_code_parsing.g_code_functionality_defs.g_code_functionality_def_base import ( # noqa: E501
GCodeFunctionalityDefBase,
)
class GetTempGCodeFunctionalityDef(GCodeFunctionalityDefBase):
RESPONSE_RE = re.compile(r"T:(?P<set_temp>.*?)C:(?P<curren... | 34.852941 | 125 | 0.605063 | [
"Apache-2.0"
] | knownmed/opentrons | api/src/opentrons/hardware_control/g_code_parsing/g_code_functionality_defs/tempdeck/get_temp_g_code_functionality_def.py | 1,185 | Python |
import os as _os
from glob import glob as _glob
import functools as _functools
from concurrent.futures import ProcessPoolExecutor as _Executor
import tempfile as _tempfile
from six import string_types as _string_types
import tqdm as _tqdm
# expose these two exceptions as part of the API. Everything else should feed ... | 40.508876 | 99 | 0.631171 | [
"BSD-3-Clause"
] | katietz/conda-package-handling | src/conda_package_handling/api.py | 6,846 | Python |
# -*- coding: utf-8 -*-
"""
Created on Thu Oct 4 16:39:50 2013
@author: Xiaoxuan Jia
"""
import json
import csv
import re
import scipy.io
import scipy.stats
import random
import numpy as np
import os
import itertools
import cPickle as pk
import pymongo
import scipy
from scipy.stats import norm
import matplotlib.pyplo... | 42.728659 | 206 | 0.506136 | [
"MIT"
] | jiaxx/temporal_learning_paper | code/learningutil.py | 28,030 | Python |
# -*- coding: utf-8 -*-
# IFD.A-8 :: Версия: 1 :: Проверка ввода невалидного значения в поле "код IATA" для выбора аэропорта
# Шаг 1
def test_check_invalid_value_IATA_to_select_airport(app):
app.session.enter_login(username="test")
app.session.enter_password(password="1245")
app.airport.open_form_add_airpo... | 41.416667 | 100 | 0.751509 | [
"Apache-2.0"
] | Sergei-Soldatov/IFD.A | test/test_check_invalid_value_IATA_code.py | 1,130 | Python |
from direct.task.Task import Task
from panda3d.core import *
from DistributedNPCToonBaseAI import *
from toontown.quest import Quests
class DistributedNPCSpecialQuestGiverAI(DistributedNPCToonBaseAI):
def __init__(self, air, npcId, questCallback=None, hq=0):
DistributedNPCToonBaseAI.__init__(self, air, np... | 38.336323 | 123 | 0.628729 | [
"MIT"
] | TTOFFLINE-LEAK/ttoffline | v2.5.7/toontown/toon/DistributedNPCSpecialQuestGiverAI.py | 8,549 | Python |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
import argparse
import logging
import multiprocessing as mp
import numpy as np
import os
import torch
from detectron2.config import get_cfg
from detectron2.data import MetadataCatalog
from detectron2.da... | 34.95671 | 100 | 0.593065 | [
"BSD-3-Clause"
] | ishanic/MeshRCNN-keypoints | demo/demo.py | 8,075 | Python |
#coding=utf-8
#author@alingse
#2016.06.21
hdfs_schema = 'hdfs://'
file_schema = 'file://'
class hdfsCluster(object):
""" 一个hdfs 资源 hdfs uri,path,账户密码认证
"""
def __init__(self,host,port=9000,schema=hdfs_schema):
""" 目前只需要host和port """
self.host = host
self.port = port
self.... | 20.852459 | 77 | 0.552673 | [
"Apache-2.0"
] | alingse/hdfshell | hdfshell/cluster.py | 1,322 | Python |
#!/usr/bin/env python
import click
from ..log import get_logger, verbosity_option
from . import bdt
logger = get_logger(__name__)
@click.command(
epilog="""\b
Examples:
bdt gitlab update-bob -vv
bdt gitlab update-bob -vv --stable
"""
)
@click.option(
"--stable/--beta",
help="To use the stable ... | 27.427273 | 75 | 0.603911 | [
"BSD-3-Clause"
] | bioidiap/bob.devtools | bob/devtools/scripts/update_bob.py | 3,017 | Python |
# -*- coding: utf-8 -*-
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
#... | 36.409836 | 85 | 0.701036 | [
"Apache-2.0"
] | 4406arthur/airflow | airflow/contrib/sensors/emr_base_sensor.py | 2,221 | Python |
from DejaVu.IndexedPolygons import IndexedPolygons
from Volume.Grid3D import Grid3D
class ClipMeshWithMask:
"""Clip method of this class takes a mesh i.e. IndexedPolgons and
selects all vertices which fall onto voxel witha true value in a mask grid.
It returns a new IndexedPolygons geometry with the triangles for... | 33.435484 | 77 | 0.549445 | [
"MIT"
] | J-E-J-S/aaRS-Pipeline | resources/mgltools_x86_64Linux2_1.5.6/MGLToolsPckgs/Volume/Operators/clip.py | 2,073 | Python |
import pytest
import os
from turf.boolean_within import boolean_within
from turf.utils.test_setup import get_fixtures
current_path = os.path.dirname(os.path.realpath(__file__))
fixtures = get_fixtures(
current_path,
keys=["true", "false"],
)
class TestBooleanPointOnLine:
@pytest.mark.parametrize(
... | 23.65 | 58 | 0.639535 | [
"MIT"
] | diogomatoschaves/pyturf | turf/boolean_within/tests/test_boolean_within.py | 946 | Python |
################################################################################
# CSE 151B: Programming Assignment 4
# Code snippet by Ajit Kumar, Savyasachi
# Updated by Rohin
# Winter 2022
################################################################################
from experiment import Experiment
import sys
... | 30.826087 | 106 | 0.545839 | [
"MIT"
] | angli66/Image-Captioning | main.py | 709 | Python |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.18 on 2019-02-12 11:43
from __future__ import unicode_literals
import core.models
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('wagtailcore', '0040_page_draft_title'),... | 38.6 | 285 | 0.645941 | [
"MIT"
] | ababic/directory-cms | great_international/migrations/0005_internationalukhqpages.py | 1,158 | Python |
"""
Test what happens if Python was built without SSL
* Everything that does not involve HTTPS should still work
* HTTPS requests must fail with an error that points at the ssl module
"""
import sys
import unittest
class ImportBlocker(object):
"""
Block Imports
To be placed on ``sys.meta_path``. This e... | 26.322222 | 79 | 0.653018 | [
"Apache-2.0"
] | aexleader/aliyun-tablestore-tutorials | search_on_tablestore_and_elasticsearch/web/flask/ots/python/pymodules/urllib3-1.11/test/test_no_ssl.py | 2,369 | Python |
# -*- coding: utf-8 -*-
import os
import io
import json
import shutil
import six
import zipfile
from .. import base
from girder.constants import AccessType
from girder.models.assetstore import Assetstore
from girder.models.folder import Folder
from girder.models.item import Item
from girder.models.token import Token
... | 42.053232 | 98 | 0.555787 | [
"Apache-2.0"
] | RemiCecchinato/girder | tests/cases/item_test.py | 33,180 | Python |
## -------------------------------------------------------- ##
# Trab 2 IA 2019-2
#
# Rafael Belmock Pedruzzi
#
# probOneR.py: implementation of the probabilistic OneR classifier.
#
# Python version: 3.7.4
## -------------------------------------------------------- ##
import numpy as np
from sklearn.base impor... | 30.521277 | 107 | 0.606832 | [
"MIT"
] | RafaelPedruzzi/IA-2019-1 | trab2/probOneR.py | 2,869 | Python |
#!/usr/bin/env python
"""
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License");... | 28.089286 | 77 | 0.779402 | [
"Apache-2.0"
] | nexr/ambari | ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/hcat_client.py | 1,573 | Python |
# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by app... | 42.009009 | 130 | 0.650011 | [
"MIT"
] | lerry-lee/similarity-model | ernie/classification/service/client.py | 4,663 | Python |
"""
Functions computing the signal shapes
"""
import numpy as np
from time import time
import src.constants as const
def subtract_signal(t, signal, fit_params=3):
"""
Returns the subtracted signal
"""
# fit dphi(t) to polynomials and subtract the contribution from n=0, 1 and 2
coef = np.p... | 27.522523 | 124 | 0.529078 | [
"MIT"
] | delos/dm-pta-mc | src/signals.py | 9,165 | Python |
"""Archive Tests
Copyright 2015 Archive Analytics Solutions - University of Liverpool
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... | 32.047619 | 72 | 0.793462 | [
"Apache-2.0"
] | pericles-project/ERMR | indigo-web/archive/tests.py | 673 | Python |
from pathlib import Path
from .utils import hrule, fmt
class SourceFile:
def __init__(self, name='', contents=[], includes=[]):
self.contents = []
self.includes = []
self.name = name
self.add_contents(contents)
self.add_includes(includes)
def add_includes(self, include... | 25.821429 | 73 | 0.514523 | [
"MIT"
] | DaelonSuzuka/Easy-XC8 | cogscripts/codegen/source.py | 1,446 | Python |
from ... import exc
from ... import util
from ...sql.base import _exclusive_against
from ...sql.base import _generative
from ...sql.base import ColumnCollection
from ...sql.dml import Insert as StandardInsert
from ...sql.elements import ClauseElement
from ...sql.expression import alias
from ...util.langhelpers import p... | 35.474286 | 84 | 0.632893 | [
"MIT"
] | Ag-nes/Blog | virtual/lib/python3.8/site-packages/sqlalchemy/dialects/mysql/dml.py | 6,208 | Python |
import json
import unittest
from bitmovin import Bitmovin, Response, TextFilter, Font
from bitmovin.errors import BitmovinApiError
from tests.bitmovin import BitmovinTestCase
class TextFilterTests(BitmovinTestCase):
@classmethod
def setUpClass(cls):
super().setUpClass()
@classmethod
def tea... | 44.590909 | 108 | 0.722732 | [
"Unlicense"
] | bitmovin/bitmovin-python | tests/bitmovin/services/filters/text_filter_tests.py | 6,867 | Python |
# -*- coding: utf-8 -*-
# noqa: B950
import logging
from collections import Counter
import tqdm
from detectron2.checkpoint import DetectionCheckpointer
from detectron2.config import get_cfg
from detectron2.data import build_detection_test_loader
from detectron2.engine import default_argument_parser
from detectron2.mo... | 27.965217 | 97 | 0.679415 | [
"Apache-2.0"
] | ArtificialNotImbecile/detectron2 | tools/analyze_model.py | 3,216 | Python |
def leiaint(msg):
while True:
try:
n = int(input(msg))
except(ValueError, TypeError):
print("\033[31mERRO: Por favor, digite um numero inteiro valido.\033[m")
except KeyboardInterrupt:
print("\n\033[31mO usuario preferiu não digitar esse numero.")
... | 31.206897 | 84 | 0.583425 | [
"MIT"
] | kesia-barros/exercicios-python | ex001 a ex114/ex113.py | 908 | Python |
# Copyright Bruno da Silva de Oliveira 2003. Use, modification and
# distribution is subject to the Boost Software License, Version 1.0.
# (See accompanying file LICENSE_1_0.txt or copy at
# http://www.boost.org/LICENSE_1_0.txt)
| 34.142857 | 70 | 0.74477 | [
"MIT"
] | DD-L/deel.boost.python | origin/libs/python/pyste/src/Pyste/__init__.py | 239 | Python |
#!/usr/bin/env python
# Demonstration GET users/search
# See https://dev.twitter.com/rest/reference/get/users/search
from secret import twitter_instance
tw = twitter_instance()
response = tw.users.search(
q='bot',
page=0,
count=20,
include_entities=False)
for i in response:
print('''
{screen_na... | 16.321429 | 61 | 0.706783 | [
"MIT"
] | showa-yojyo/note | source/_sample/ptt/users-search.py | 489 | Python |
# AUTOGENERATED! DO NOT EDIT! File to edit: nbs/01_tabular.pd.ipynb (unless otherwise specified).
__all__ = ['PartDep']
# Cell
from fastai.tabular.all import *
from .core import *
# Cell
from plotnine import *
# Cell
from IPython.display import clear_output
# Cell
class PartDep(Interpret):
"""
Calculate Pa... | 41.449649 | 117 | 0.598339 | [
"Apache-2.0"
] | floleuerer/fastinference | fastinference/tabular/pd.py | 17,699 | Python |
# -*- coding: utf-8 -*-
from django.shortcuts import render
from django_filters.rest_framework import DjangoFilterBackend
from rest_framework.throttling import ScopedRateThrottle
from rest_framework.views import APIView
from rest_framework.status import HTTP_200_OK, HTTP_400_BAD_REQUEST
from rest_framework.response imp... | 40.244755 | 197 | 0.692441 | [
"MIT"
] | RAyymask/LPOJ | Backend/judgestatus/views.py | 5,871 | Python |
#Neural Networks
#MLP classifier is optimal algorithm for classifications
from sklearn.neural_network import MLPClassifier
clf = MLPClassifier(solver='lbfgs', alpha=1e-5, hidden_layer_sizes=(5, 2), random_state=1)
clf.fit(X_train_clean, y_train)
clf.predict(X_test_clean)
scoreN = clf.score(X_test_clean, y_test)
prin... | 29.909091 | 90 | 0.808511 | [
"Apache-2.0"
] | daniloorozco/ufc-predictions | models/model_NN.py | 329 | Python |
#!/usr/bin/env python
import unittest
from piprot.piprot import main
class TestRequirementsParser(unittest.TestCase):
def setUp(self):
pass
def test_requirement_exact(self):
with self.assertRaises(SystemExit):
main([open('piprot/test/files/pytz_req.txt')])
if __name__ == '__mai... | 19.222222 | 58 | 0.684971 | [
"MIT"
] | 00willo/piprot | piprot/test/test_piprot.py | 346 | Python |
"""common logic for all queries"""
import json
from functools import partial, singledispatch
from operator import itemgetter
import snug
from gentools import (compose, map_yield, map_send, oneyield, reusable,
map_return)
from .load import registry
API_URL = 'https://slack.com/api/'
class ApiE... | 26.987179 | 71 | 0.663183 | [
"MIT"
] | ariebovenberg/snug | examples/slack/query.py | 2,105 | Python |
#!/usr/bin/env python3
# Data schema:
# (start) (12b junk) artist (5* byte) (1b junk) title (col) (1b junk) date and time (col) (1b junk) url (urldur) duration (col) (1b junk) thumbnail url (end)
keybytes = {
"row_start": "80 09 80 00 80", # row start
"col": "5F 10", # column delimeter
"urldur": "58", # u... | 37.970588 | 157 | 0.543765 | [
"MIT"
] | MikeWent/applepd_bot | playlist_parser.py | 1,291 | Python |
# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve.
#
# 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 applic... | 44.869744 | 224 | 0.610142 | [
"Apache-2.0"
] | 92lqllearning/Paddle | python/paddle/fluid/layers/detection.py | 174,992 | Python |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Charts about the national vaccines data.
@author: riccardomaldini
"""
import matplotlib.pyplot as plt
import matplotlib.ticker as mtick
from data_extractors.vaccines_regions import benchmark_dict, marche_df
from data_extractors.vaccines_italy import italy_df
from data... | 38.165414 | 125 | 0.718676 | [
"MIT"
] | maldins46/CovidAnalysis | chart-generation/charts/vaccines.py | 5,076 | Python |
#!/usr/bin/env python
"""Create two randomly generated matrices, of the specified sizes and write them
to JSON files.
"""
import json
import numpy as np
def read(path):
with open(path, 'rb') as f:
matrix = np.fromfile(f, dtype=np.float32)
return matrix
def write(path, matrix):
with open(path, 'wb') as f:
... | 16.608696 | 80 | 0.704188 | [
"MIT"
] | Zeta36/mushroom-detector-kerasjs | android/platforms/android/assets/www/web/node_modules/weblas/test/data/binary_matrix.py | 382 | Python |
# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by app... | 26.898649 | 74 | 0.621954 | [
"Apache-2.0"
] | GOnion/PARL | parl/remote/tests/cluster_test.py | 3,981 | Python |
'''
lanhuage: python
Descripttion:
version: beta
Author: xiaoshuyui
Date: 2020-07-10 10:33:39
LastEditors: xiaoshuyui
LastEditTime: 2021-01-05 10:21:49
'''
import glob
import os
from tqdm import tqdm
from convertmask.utils.methods import getMultiShapes
from convertmask.utils.methods.logger import logger
def getJs... | 31.694444 | 82 | 0.620508 | [
"Apache-2.0"
] | guchengxi1994/mask2json | convertmask/utils/mask2json_script.py | 2,282 | Python |
from collections import namedtuple
Vote = namedtuple('Vote', 'user post vote')
def create_vote(vote_dict, cutoff):
"""
changes the vote to the [-1, 1] range
"""
modified_vote = 1 if float(vote_dict['vote']) > cutoff else -1
return Vote(
user=str(vote_dict['user']),
post=str(vote_d... | 22.9375 | 66 | 0.621253 | [
"MIT"
] | bubblegumsoldier/kiwi | kiwi-content/kiwi/TransferTypes.py | 367 | Python |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, division, print_function, unicode_literals
import unittest
from nose.plugins.attrib import attr
import hgvs.dataproviders.uta
import hgvs.location
import hgvs.parser
from hgvs.exceptions import HGVSError
from hgvs.transcriptmapper import TranscriptMapp... | 68.365714 | 159 | 0.546974 | [
"Apache-2.0"
] | jmuhlich/hgvs | tests/test_hgvs_transcriptmapper.py | 23,928 | Python |
import trollius
from trollius import From
from pprint import pprint
import pygazebo.msg.raysensor_pb2
@trollius.coroutine
def publish_loop():
manager = yield From(pygazebo.connect())
def callback(data):
ray = pygazebo.msg.raysensor_pb2.RaySensor()
msg = ray.FromString(data)
subscriber =... | 23.571429 | 52 | 0.69697 | [
"Apache-2.0"
] | masayoshi-nakamura/CognitiveArchitectureLecture | examples/pygazebo_sample/ray_sensor.py | 660 | Python |
from django.test import TestCase
from django.contrib.sites.models import Site
from django.utils import unittest
from django.conf import settings
from .factories import GalleryFactory, PhotoFactory
class SitesTest(TestCase):
urls = 'photologue.tests.test_urls'
def setUp(self):
"""
Create two... | 41.071429 | 103 | 0.630261 | [
"BSD-3-Clause"
] | elena/django-photologue | photologue/tests/test_sites.py | 5,750 | Python |
# -*- coding: utf-8 -*-
# Copyright 2018, IBM.
#
# This source code is licensed under the Apache License, Version 2.0 found in
# the LICENSE.txt file in the root directory of this source tree.
"""Test the decompose pass"""
from sympy import pi
from qiskit import QuantumRegister, ClassicalRegister, QuantumCircuit
fr... | 32.452381 | 77 | 0.624725 | [
"Apache-2.0"
] | dominik-steenken/qiskit-terra | test/python/transpiler/test_decompose.py | 2,726 | Python |
"""
ASGI config for animeDjangoApp project.
It exposes the ASGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/3.2/howto/deployment/asgi/
"""
import os
from django.core.asgi import get_asgi_application
os.environ.setdefault('DJANG... | 23.823529 | 78 | 0.792593 | [
"MIT"
] | peteryouu/animeDjango | animeDjangoApp/asgi.py | 405 | Python |
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: service_method_same_name.proto
import sys
_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from google.protobuf import ref... | 23.602273 | 196 | 0.755416 | [
"ECL-2.0",
"Apache-2.0"
] | guide-century/twirp | internal/twirptest/service_method_same_name/service_method_same_name_pb2.py | 2,077 | Python |
"""
Django settings for backend project.
Generated by 'django-admin startproject' using Django 3.1.3.
For more information on this file, see
https://docs.djangoproject.com/en/3.1/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/3.1/ref/settings/
"""
from pathlib... | 27.1 | 100 | 0.707433 | [
"MIT"
] | jesusmaherrera/django-nuxtjs | backend/settings.py | 3,794 | Python |
import os
import wget
import tarfile
import argparse
import subprocess
from utils import create_manifest
from tqdm import tqdm
import shutil
parser = argparse.ArgumentParser(description='Processes and downloads LibriSpeech dataset.')
parser.add_argument("--target-dir", default='LibriSpeech_dataset/', type=str, help="D... | 49.236842 | 117 | 0.623018 | [
"MIT"
] | vadimkantorov/deepspeech.pytorch | data/librispeech.py | 5,613 | Python |
#!/usr/bin/python3
import datetime
import inquirer
import requests
import re
import csv
import os
import json
repositories = [
"beagle",
"beagle-web-react",
"beagle-web-core",
"beagle-web-angular",
"charlescd",
"charlescd-docs",
"horusec",
"horusec-engine-docs",
"ritchie-cli",
"... | 26.43662 | 177 | 0.546883 | [
"Apache-2.0"
] | GuillaumeFalourd/formulas-insights | github/get/zup-insights/src/formula/formula.py | 3,759 | Python |
##########################################################################
#
# pgAdmin 4 - PostgreSQL Tools
#
# Copyright (C) 2013 - 2017, The pgAdmin Development Team
# This software is released under the PostgreSQL Licence
#
##########################################################################
"""Implements the... | 30.934569 | 92 | 0.501251 | [
"MIT"
] | jhkuang11/UniTrade | code/venv/lib/python3.6/site-packages/pgadmin4/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/check_constraint/__init__.py | 28,367 | Python |
import json
import subprocess
import ipaddress
import pytest
@pytest.fixture
def add_host():
def _inner(hostname, rack, rank, appliance):
cmd = f'stack add host {hostname} rack={rack} rank={rank} appliance={appliance}'
result = subprocess.run(cmd.split())
if result.returncode != 0:
pytest.fail('unable to ad... | 33.694158 | 137 | 0.715553 | [
"BSD-3-Clause"
] | anooprajendra/stacki | test-framework/test-suites/integration/tests/fixtures/add_data.py | 9,805 | Python |
from setuptools import setup, find_packages
from os import path
here = path.abspath(path.dirname(__file__))
setup(
name='nameko-couchbase',
version='0.1.5',
description='Nameko dependency for Couchbase',
url='https://github.com/geoffjukes/nameko-couchbase',
author='Geoff Jukes',
license="Apach... | 33.814815 | 71 | 0.638554 | [
"Apache-2.0"
] | geoffjukes/nameko-couchbase | setup.py | 913 | Python |
import pytest
def test_terms():
from pycldf.terms import TERMS
assert 'alignment' in TERMS.properties
with pytest.raises(ValueError):
TERMS.is_cldf_uri('http://cldf.clld.org/404')
assert not TERMS.is_cldf_uri('http://example.org')
assert TERMS.is_cldf_uri('http://cldf.clld.org/v1.0/term... | 29.285714 | 75 | 0.710569 | [
"Apache-2.0"
] | SimonGreenhill/pycldf | tests/test_terms.py | 615 | Python |
#!/usr/bin/python
# Copyright (c) 2018-2019 Intel Corporation
#
# 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, m... | 34.383871 | 82 | 0.638334 | [
"Apache-2.0"
] | marcelarosalesj/daos | src/rdb/tests/rdb_test_runner.py | 10,659 | Python |
"""
Self-supervised learning samplers.
"""
# Authors: Hubert Banville <hubert.jbanville@gmail.com>
#
# License: BSD (3-clause)
import numpy as np
from . import RecordingSampler
class RelativePositioningSampler(RecordingSampler):
"""Sample examples for the relative positioning task from [Banville2020]_.
Sa... | 35.97479 | 79 | 0.605466 | [
"BSD-3-Clause"
] | Div12345/braindecode | braindecode/samplers/ssl.py | 4,282 | Python |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# (C)Eduardo Ribeiro - 1600820
class Contract:
id = 0
school_code = 0
school_name = ""
n_contract = 0
n_hours_per_week = 0
contract_end_date = ""
application_deadline = ""
recruitment_group = ""
county = ""
district = ""
clas... | 24.125 | 56 | 0.611399 | [
"MIT"
] | ejgr-mtsiw/pw-html-parser | sigrhe_contract.py | 1,158 | Python |
"""
Django settings for profiles_project project.
Generated by 'django-admin startproject' using Django 3.1.5.
For more information on this file, see
https://docs.djangoproject.com/en/3.1/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/3.1/ref/settings/
"""
impo... | 25.761538 | 91 | 0.697522 | [
"MIT"
] | achrefabdennebi/profiles-rest-api | profiles_project/settings.py | 3,349 | Python |
# Copyright 2013-2019 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 CbtfArgonavis(CMakePackage):
"""CBTF Argo Navis project contains the CUDA collector and su... | 41.280992 | 110 | 0.603003 | [
"ECL-2.0",
"Apache-2.0",
"MIT"
] | CreRecombinase/spack | var/spack/repos/builtin/packages/cbtf-argonavis/package.py | 4,995 | Python |
"""SentencePiece based word tokenizer module"""
from pathlib import Path
from typing import List
import sentencepiece as spm
from urduhack.stop_words import STOP_WORDS
def _is_token(pieces: list, special_symbol: str = "▁") -> List[str]:
"""
Check for stopwords and actual words in word pieces
Args:
... | 28.290323 | 102 | 0.641391 | [
"MIT"
] | cinfotech94/urduhackk | urduhack/tokenization/wtk.py | 1,756 | Python |
"""command line interface for mutation_origin"""
import os
import time
import pickle
from collections import defaultdict
import click
from tqdm import tqdm
import pandas
from numpy import log
from numpy.random import seed as np_seed
from scitrack import CachingLogger
from sklearn.model_selection import train_test_split... | 35.40177 | 108 | 0.606739 | [
"BSD-3-Clause"
] | HuttleyLab/mutationorigin | mutation_origin/cli.py | 20,002 | Python |
"""
My first application
"""
import toga
from toga.style import Pack
from toga.style.pack import COLUMN, ROW
class HelloWorld(toga.App):
def startup(self):
"""
Construct and show the Toga application.
Usually, you would add your application to a main content box.
We then create a... | 24.603448 | 72 | 0.580238 | [
"BSD-3-Clause"
] | The-Heyman/helloworld | src/helloworld/app.py | 1,427 | Python |
import os
turno = input('Qual turno você estuda? ')
if turno[0] == 'm' or turno[0] == 'M':
print('Bom Dia!')
elif turno[0] == 'v' or turno[0] == 'V':
print('Boa Tarde')
elif turno[0] == 'n' or turno[0] == 'N':
print('Boa Noite')
else:
print('Valor Inválido!')
os.system("pause")
| 20.8 | 42 | 0.535256 | [
"MIT"
] | WilliamSampaio/ExerciciosPython | exerc27/27.py | 314 | Python |
import ray
from copy import deepcopy
from leaderboard.leaderboard_evaluator import LeaderboardEvaluator
from leaderboard.utils.statistics_manager import StatisticsManager
@ray.remote(num_cpus=1./8, num_gpus=1./4, max_restarts=100, max_task_retries=-1)
class ScenarioRunner():
def __init__(self, args, scenario_class... | 34.296296 | 149 | 0.695464 | [
"MIT"
] | anthonyhu/WorldOnRails | runners/scenario_runner.py | 926 | Python |
from django.apps import AppConfig
class YtvideoConfig(AppConfig):
name = 'ytvideo'
| 14.833333 | 33 | 0.752809 | [
"MIT"
] | LSM2016/Bilibili- | ytvideo/apps.py | 89 | Python |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (C) 2015 by Gaik Tamazian
# gaik (dot) tamazian (at) gmail (dot) com
class Error(Exception):
"""
The class describes a basic error that may occur in any of the
Chromosomer-related routines.
"""
pass
class MapError(Error):
"""
The... | 19.6 | 68 | 0.653061 | [
"MIT"
] | gtamazian/Chromosomer | chromosomer/exception.py | 588 | Python |
# coding: utf-8
import os
import numpy as np
import copy
from PyQt5.QtWidgets import (QPushButton, QScrollArea)
from PyQt5.QtCore import QThread, pyqtSignal
from multiprocessing import Process, Manager
from ..malss import MALSS
from .waiting_animation import WaitingAnimation
from .rfpimp import oob_importanc... | 34.847953 | 107 | 0.5756 | [
"MIT"
] | canard0328/malss | malss/app/learning_curve.py | 6,063 | Python |
# GENERATED BY KOMAND SDK - DO NOT EDIT
import komand
import json
class Input:
_REF = "_ref"
class Output:
_REF = "_ref"
class DeleteHostInput(komand.Input):
schema = json.loads("""
{
"type": "object",
"title": "Variables",
"properties": {
"_ref": {
"type": "string",
"... | 16.568966 | 62 | 0.546306 | [
"MIT"
] | TonyHamil/insightconnect-plugins | infoblox/komand_infoblox/actions/delete_host/schema.py | 961 | Python |
# coding: utf-8
from __future__ import unicode_literals
import os
import re
import sys
from .common import InfoExtractor
from .youtube import YoutubeIE
from ..compat import (
compat_etree_fromstring,
compat_str,
compat_urllib_parse_unquote,
compat_urlparse,
compat_xml_parse_error,
)
from ..utils ... | 40.959868 | 432 | 0.519898 | [
"Unlicense"
] | king-millez/yt-dlp | yt_dlp/extractor/generic.py | 149,939 | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.