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 |
|---|---|---|---|---|---|---|---|---|
'''
Source code developed by DI2AG.
Thayer School of Engineering at Dartmouth College
Authors: Dr. Eugene Santos, Jr
Mr. Chase Yakaboski,
Mr. Gregory Hyde,
Dr. Keum Joo Kim
'''
import json
import argparse
import os
import sys
import pickle
import subprocess
from chp.query impor... | 32.290909 | 93 | 0.670045 | [
"Apache-2.0"
] | NCATSTranslator/chp | chp/babel/bkb-service.py | 3,552 | Python |
# Proximal
import sys
sys.path.append('../../')
from proximal.utils.utils import *
from proximal.halide.halide import *
from proximal.lin_ops import *
import numpy as np
from scipy import signal
from scipy import ndimage
import matplotlib.pyplot as plt
############################################################
#... | 29.348837 | 99 | 0.647781 | [
"MIT"
] | antonysigma/ProxImaL | proximal/examples/test_conv.py | 2,524 | Python |
# coding: UTF-8
import os
os.environ['TF_CPP_MIN_LOG_LEVEL']='2'
import warnings
warnings.filterwarnings("ignore")
import argparse
import numpy as np
import shutil
import PIL
import time
from imageio import imread, imsave
from googletrans import Translator
import torch
import torchvision
import torch.nn.functional as ... | 49.329759 | 170 | 0.598804 | [
"MIT"
] | ksburaya/aphantasia | illustrip.py | 18,400 | Python |
# coding=utf-8
# *** WARNING: this file was generated by the Pulumi SDK Generator. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union
from ... import _utilities, _tables
from... | 47.985577 | 794 | 0.660655 | [
"Apache-2.0"
] | pulumi/pulumi-azure-nextgen | sdk/python/pulumi_azure_nextgen/apimanagement/v20200601preview/api_operation.py | 9,981 | Python |
#!/usr/bin/env python3
# -*- coding: UTF-8 -*-
"""
平安行动自动打卡
请事先安装好 lxml 和 requests 模块
pip install lxml requests
然后修改 27-31 行为自己的数据,未使用的变量保持原样即可
如有需要请自行配置 149-171 行的 SMTP 发信或 174-177 行的 Server 酱微信提醒
Created on 2020-04-13 20:20
@author: ZhangJiawei & Liu Chongpeng & Liu Lu
"""
import requests
import lxml.html
i... | 41.524862 | 149 | 0.562932 | [
"MIT"
] | Hydrcat/HEU-Checkin-COVID-19 | Server/checkin.py | 8,098 | Python |
# coding: utf-8
# Copyright (c) 2016, 2022, Oracle and/or its affiliates. All rights reserved.
# This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may c... | 34.465267 | 245 | 0.662089 | [
"Apache-2.0",
"BSD-3-Clause"
] | LaudateCorpus1/oci-python-sdk | src/oci/jms/models/jre_usage.py | 21,334 | Python |
# Copyright 2018 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | 45.622476 | 131 | 0.64307 | [
"ECL-2.0",
"Apache-2.0"
] | vballoli/jax | tests/lax_numpy_test.py | 140,061 | Python |
# -*- coding: utf-8 -*-
from .. import OratorTestCase
from lorator.support.collection import Collection
class CollectionTestCase(OratorTestCase):
def test_first_returns_first_item_in_collection(self):
c = Collection(["foo", "bar"])
self.assertEqual("foo", c.first())
def test_last_returns_la... | 31.030888 | 86 | 0.520343 | [
"MIT"
] | fenestron/lorator | tests/support/test_collection.py | 8,037 | Python |
#!/usr/bin/env python
#
# Copyright (c) 2018 SAP SE
# 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
#
# ... | 48.716846 | 214 | 0.739038 | [
"Apache-2.0"
] | DEiselt/openstack-nannies | scripts/cinder-consistency.py | 27,184 | Python |
"""
Evrything Docs
https://dashboard.evrythng.com/documentation/api/actiontypes
"""
from evrythng import assertions, utils
field_specs = {
'datatypes': {
'name': 'str',
'customFields': 'dict',
'tags': 'dict_of_str',
'scopes': 'dict',
},
'required': ('name',),
'readonly'... | 32.490909 | 82 | 0.632904 | [
"MIT"
] | jwpthng/evrythng-python-sdk | src/evrythng/entities/action_types.py | 1,787 | Python |
import json
# try:
# redis_connection = redis.Redis(host='dorresteinappshub.ucsd.edu', port=6378, db=0)
# except:
# redis_connection = None
redis_connection = None
def acquire_motifdb(db_list):
db_list_key = json.dumps(db_list)
if redis_connection is not None:
if redis_connection.exists(db_li... | 32 | 120 | 0.708984 | [
"MIT"
] | glasgowcompbio/ms2ldaviz | lda/offline_analysis/ms2lda_runfull_test.py | 2,048 | Python |
"""
Mapping from iana timezones to windows timezones and vice versa
"""
from datetime import tzinfo
import pytz
# noinspection SpellCheckingInspection
IANA_TO_WIN = {
"Africa/Abidjan": "Greenwich Standard Time",
"Africa/Accra": "Greenwich Standard Time",
"Africa/Addis_Ababa": "E. Africa Standard Time",
... | 46.488372 | 97 | 0.675971 | [
"Apache-2.0"
] | Feelixe-tin/python-o365 | O365/utils/windows_tz.py | 29,985 | Python |
# pip install freegames
# Click on screen to control ball
# import modules
from random import *
import turtle as t
from freegames import vector
# Set window title, color and icon
t.title("Flappy Ball")
root = t.Screen()._root
root.iconbitmap("logo-ico.ico")
t.bgcolor('#80ffd4')
bird = vector(0, 0)
balls = []
... | 16.630952 | 56 | 0.583393 | [
"MIT"
] | jayamithun/py-box | games/Flappy.py | 1,397 | Python |
"""Base test cases for RBTools unit tests."""
from __future__ import unicode_literals
import os
import re
import shutil
import sys
import tempfile
import unittest
from contextlib import contextmanager
import six
from rbtools.utils.filesystem import cleanup_tempfiles, make_tempdir
import kgb
from rbtools.utils.file... | 28.655303 | 79 | 0.59458 | [
"MIT"
] | jmcrawford45/rbtools | rbtools/testing/testcase.py | 7,565 | Python |
#!/usr/bin/env python
'''
Pull random words from http://world.std.com/~reinhold/diceware.wordlist.asc
Written 2013 Hal Canary.
Dedicated to the public domain.
'''
import random,math,sys,os
useDevRandom = True
dicewareWordlist = '~/Downloads/diceware.wordlist.asc'
with open(os.path.expanduser(dicewareWordlist)) as f:
... | 28.888889 | 75 | 0.723077 | [
"Apache-2.0"
] | Makemeproud/BitcoinGenerator | RandomWords.py | 780 | Python |
from django.conf.urls import url
from . import views
urlpatterns = [
# 商品列表页
url(r'^list/(?P<category_id>\d+)/(?P<page_num>\d+)/$', views.ListView.as_view(), name='list'),
# 热销排行数据
url(r'^hot/(?P<category_id>\d+)/$', views.HotGoodsView.as_view()),
# 商品详情页
url(r'^detail/(?P<sku_id>\d+)/$', view... | 31.764706 | 98 | 0.627778 | [
"MIT"
] | ambushonallsides1/E_business_project | E_business_project/apps/goods/urls.py | 598 | Python |
import asyncio
import discord
from discord.ext import commands
from discord.commands import slash_command, Option
import wavelink
import json
from dotenv import load_dotenv
import os
load_dotenv()
# Initiate json
file = open("config.json")
data = json.load(file)
# Public variables
guildID = data["guildID"][0]
clas... | 30.15942 | 98 | 0.623258 | [
"MIT"
] | Aggis15/T4NK0R | Music/play.py | 2,081 | Python |
import timeit
mapx = 512
mapy = 512
# Good seeds:
# 772855 Spaced out continents
# 15213 Tight continents
# 1238 What I've been working with, for the most part
# 374539 Sparse continents
# 99999
seed = 773202
sea_level = 0.6
DEBUG = 0
GFXDEBUG = 0
setup_time = timeit.default_timer()
tiles = [[None] * mapx for _ in ... | 18.184211 | 53 | 0.677279 | [
"MIT"
] | ghlmtz/airline-sim | ginit.py | 691 | Python |
import sympy
import antlr4
from antlr4.error.ErrorListener import ErrorListener
from sympy.core.operations import AssocOp
try:
from gen.PSParser import PSParser
from gen.PSLexer import PSLexer
from gen.PSListener import PSListener
except Exception:
from .gen.PSParser import PSParser
from .gen.PSLex... | 33.15127 | 99 | 0.571633 | [
"MIT"
] | ConsoleBit/latex2sympy | latex2sympy.py | 28,709 | 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 ... | 46.309524 | 153 | 0.65587 | [
"MIT"
] | AlexGhiondea/azure-sdk-for-python | sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_resource_skus_operations.py | 5,835 | Python |
import os
import signal
import sys
from builtins import id as identifier
from toga.command import CommandSet
from toga.handlers import wrapped_handler
from toga.icons import Icon
from toga.platform import get_platform_factory
from toga.window import Window
class MainWindow(Window):
_WINDOW_CLASS = 'MainWindow'
... | 31.457143 | 108 | 0.631374 | [
"BSD-3-Clause"
] | UncleGoogle/toga | src/core/toga/app.py | 7,707 | Python |
# this file is deprecated and will soon be folded into all.py
from collections import namedtuple
from pycoin.serialize import h2b
NetworkValues = namedtuple('NetworkValues',
('network_name', 'subnet_name', 'code', 'wif', 'address',
'pay_to_script', 'prv32', 'pu... | 42.325581 | 120 | 0.58956 | [
"MIT"
] | Kexkey/pycoin | pycoin/networks/legacy_networks.py | 3,640 | Python |
# -*- coding: utf-8 -*-
__title__ = "Universal Notifications"
__version__ = "1.5.0"
__author__ = "Pawel Krzyzaniak"
__license__ = "MIT"
__copyright__ = "Copyright 2017-2018 Arabella; 2018+ Ro"
# Version synonym
VERSION = __version__
| 23.4 | 56 | 0.726496 | [
"MIT"
] | ArabellaTech/universal_notifications | universal_notifications/__init__.py | 234 | Python |
#
# The OpenDiamond Platform for Interactive Search
#
# Copyright (c) 2009-2019 Carnegie Mellon University
# All rights reserved.
#
# This software is distributed under the terms of the Eclipse Public
# License, Version 1.0 which can be found in the file named LICENSE.
# ANY USE, REPRODUCTION OR DISTRIBUTION OF T... | 26.3 | 69 | 0.741445 | [
"EPL-1.0"
] | cmusatyalab/opendiamond | opendiamond/scopeserver/mirage/urls.py | 526 | Python |
#!/usr/bin/env python3
# Copyright (c) 2016-2019 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 compact blocks (BIP 152).
Version 1 compact blocks are pre-segwit (txids)
Version 2 compact block... | 46.568421 | 500 | 0.672092 | [
"MIT"
] | 0mfq/0mfq | test/functional/p2p_compactblocks.py | 39,816 | Python |
#!/usr/bin/python
import requests, time
from flask import Flask, Response, stream_with_context
app = Flask(__name__)
START = time.time()
def elapsed():
running = time.time() - START
minutes, seconds = divmod(running, 60)
hours, minutes = divmod(minutes, 60)
return "%d:%02d:%02d" % (hours, minutes, se... | 27.090909 | 104 | 0.674497 | [
"Apache-2.0"
] | datawire/hello-forge-network | edge/app.py | 596 | Python |
"""Training a face recognizer with TensorFlow using softmax cross entropy loss
"""
# MIT License
#
# Copyright (c) 2016 David Sandberg
#
# 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 with... | 55.692699 | 209 | 0.698137 | [
"MIT"
] | govindjeevan/facenet | src/train_softmax.py | 32,803 | Python |
from django.utils.translation import gettext_lazy as _
from generic_chooser.widgets import AdminChooser, LinkedFieldMixin
from areas.models import CongressionalDistrict
class CongressionalDistrictChooser(LinkedFieldMixin, AdminChooser):
#icon = 'user'
model = CongressionalDistrict
page_title = _("Choose ... | 36.363636 | 67 | 0.8175 | [
"MIT"
] | polrev-github/polrev-django | polrev/areas/widgets/congressional_district_widgets.py | 400 | Python |
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT license.
"""
Constant values used by this library.
"""
from enum import Enum
class DataCategory(Enum):
"""
Enumeration of data categories in compliant machine learning.
Values:
- PRIVATE: data which is private. Researchers may not view... | 19.5 | 68 | 0.687646 | [
"MIT"
] | Anbang-Hu/shrike | shrike/compliant_logging/constants.py | 429 | Python |
#VERSION: 2.3
#AUTHORS: Vikas Yadav (https://github.com/v1k45 | http://v1k45.com)
#CONTRIBUTORS: Diego de las Heras (ngosang@hotmail.es)
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source ... | 41.654545 | 94 | 0.60614 | [
"MIT"
] | Kira9204/Wireguard-qBittorrent | container_data/.config/qBittorrent/plugins/nova3/engines/leetx.py | 6,873 | Python |
import random
import string
from django.conf import settings
from nacl.signing import SigningKey
from nacl.encoding import Base64Encoder
import segno
import io
import cairosvg
from django.template.loader import render_to_string
import base64
import PyPDF2
import os
# Will generate a random alphanumeric string with 62... | 25.821918 | 88 | 0.687268 | [
"MIT"
] | cds-snc/covid-alert-portal | register/utils.py | 3,770 | Python |
from pfrl.wrappers.cast_observation import CastObservation # NOQA
from pfrl.wrappers.cast_observation import CastObservationToFloat32 # NOQA
from pfrl.wrappers.continuing_time_limit import ContinuingTimeLimit # NOQA
from pfrl.wrappers.monitor import Monitor # NOQA
from pfrl.wrappers.normalize_action_space import... | 35.176471 | 77 | 0.837793 | [
"MIT"
] | TMats/pfrl | pfrl/wrappers/__init__.py | 598 | Python |
"""
Test functions for models.formula
"""
import string
import numpy as np
import numpy.random as R
import numpy.linalg as L
from numpy.testing import assert_almost_equal, assert_equal, assert_, \
assert_raises
from statsmodels.sandbox import formula #, contrast #, utils
from statsmodels.sandbox import contrast_... | 31.639241 | 145 | 0.534407 | [
"BSD-3-Clause"
] | jarvmiller/statsmodels | statsmodels/sandbox/tests/test_formula.py | 9,998 | Python |
#!/usr/bin/env python
# Copyright 2013 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import unittest
from extensions_paths import EXAMPLES, PUBLIC_TEMPLATES, STATIC_DOCS
from local_file_system import LocalFileSystem
fro... | 38.198347 | 79 | 0.706621 | [
"BSD-3-Clause"
] | AOSPA/android_external_chromium_org | chrome/common/extensions/docs/server2/render_servlet_test.py | 4,622 | Python |
import logging
from pyvisdk.exceptions import InvalidArgumentError
########################################
# Automatically generated, do not edit.
########################################
log = logging.getLogger(__name__)
def LicenseServerSource(vim, *args, **kwargs):
'''Specify a license server reachable via ... | 30.515152 | 124 | 0.60576 | [
"MIT"
] | Infinidat/pyvisdk | pyvisdk/do/license_server_source.py | 1,007 | Python |
from neuwon.database import Database
import numpy as np
import numba
class GameOfLife:
class _CellBaseClass:
__slots__ = ()
@classmethod
def _add_to_database(cls, database):
cell_data = database.add_class("Cell", cls)
cell_data.add_attribute("coordinates", shape=(2,... | 35.720588 | 78 | 0.516674 | [
"MIT"
] | ctrl-z-9000-times/NEUWON | neuwon/database/examples/life/model.py | 2,429 | Python |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import vtk
import vtk.test.Testing
from vtk.util.misc import vtkGetDataRoot
VTK_DATA_ROOT = vtkGetDataRoot()
# ------------------------------------------------------------
# Purpose: Test the parametric functions.
# --------------------------------------------------------... | 46.221831 | 119 | 0.634418 | [
"BSD-3-Clause"
] | Starlink/vtk | Common/ComputationalGeometry/Testing/Python/TestParametricFunctions.py | 26,254 | Python |
# Copyright (c) 2015 The Johns Hopkins University/Applied Physics Laboratory
# 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/LICEN... | 42.36669 | 79 | 0.585278 | [
"Apache-2.0"
] | eniltonj/PyKMIP | kmip/pie/client.py | 59,271 | Python |
FRANCHISES = """
select t1.aliases, overall, firsts, seconds, third, y1,y2, unique_a, unique_1, unique_12
from
(select Count(A."PlayerID") as overall,T."Aliases" as aliases, MAX(A."year") as y1, MIN(A."year") as y2, Count (distinct A."PlayerID") as unique_a
from public."all-nba-teams_list" A, public.teams T
where A... | 34.904762 | 147 | 0.697817 | [
"MIT"
] | Voldy87/all-nba-team | all_nba_team/api/hardcoded_queries.py | 1,466 | Python |
# terrascript/kind/r.py
# Automatically generated by tools/makecode.py ()
import warnings
warnings.warn(
"using the 'legacy layout' is deprecated", DeprecationWarning, stacklevel=2
)
import terrascript
class kind_cluster(terrascript.Resource):
pass
| 18.642857 | 79 | 0.770115 | [
"BSD-2-Clause"
] | mjuenema/python-terrascript | terrascript/kind/r.py | 261 | Python |
from __future__ import absolute_import
import json
import datetime
import os
import os.path
import sys
import traceback
from distutils import log
from .base import BaseBuildCommand
class BuildAssetsCommand(BaseBuildCommand):
user_options = BaseBuildCommand.user_options + [
(
"asset-json-pat... | 32.445946 | 96 | 0.591628 | [
"BSD-3-Clause"
] | CSP197/sentry | src/sentry/utils/distutils/commands/build_assets.py | 4,802 | Python |
# Generated by Django 3.1.3 on 2021-02-16 11:31
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
("imagedeck", "0009_auto_20201122_2300"),
("dcodex", "0034_auto_20201215_0315"),
]
operations = [
mig... | 24.703704 | 64 | 0.562219 | [
"Apache-2.0"
] | rbturnbull/dcodex | dcodex/migrations/0035_auto_20210216_0331.py | 667 | Python |
#!/usr/bin/env python3 -u
import sys
for value in sys.stdin:
sys.stderr.write(f"consumed {value}\n")
| 13.5 | 43 | 0.675926 | [
"BSD-3-Clause"
] | Betta-Lyon-Delsordo/missing-course | topics/05-data-wrangling/consume.py | 108 | Python |
from __future__ import absolute_import, division, print_function
__metaclass__ = type
from ansible.errors import AnsibleFilterError
from ansible.module_utils.six import iteritems, string_types
from numbers import Number
def config(parameters, exclude=None):
exclude = exclude or []
if not isinstance(paramete... | 33.569231 | 120 | 0.660862 | [
"MIT"
] | manala/ansible-roles | plugins/filter/php_config.py | 2,182 | Python |
import pytest
from contoso import get_company_name, get_company_address
def test_get_company_name():
assert get_company_name() == "Contoso"
def test_get_company_address():
assert get_company_address() == "Contosostrasse 1, Zurich, Switzerland" | 28.222222 | 75 | 0.791339 | [
"MIT"
] | fbeltrao/az-func-gh-deployment | src/packages/tests/test_company_details.py | 254 | Python |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
###############################################################################
# #
# RMG - Reaction Mechanism Generator #
# ... | 48.782051 | 118 | 0.574376 | [
"MIT"
] | MingyuWAN/RMG-Py | rmgpy/molecule/converterTest.py | 7,610 | Python |
"""
Lowest level connection
"""
from __future__ import division
import logging
import math
import random
import time
import uuid
import warnings
from base64 import b64decode
from threading import local
import six
from botocore.client import ClientError
from botocore.exceptions import BotoCoreError
from botocore.sessi... | 45.698201 | 121 | 0.627469 | [
"MIT"
] | dwelch91/PynamoDB | pynamodb/connection/base.py | 68,593 | Python |
#!/usr/bin/python
# Copyright (c) 2017, 2021 Oracle and/or its affiliates.
# This software is made available to you under the terms of the GPL 3.0 license or the Apache 2.0 license.
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
# Apache License v2.0
# See LICENSE.TXT for d... | 37.224652 | 159 | 0.553354 | [
"Apache-2.0"
] | hanielburton/oci-ansible-collection | plugins/modules/oci_waas_certificate_facts.py | 18,724 | Python |
import os
from dotenv import load_dotenv
# The prefix the bot responds to for commands
PREFIX = '!'
# Emojis the bot should use for certain events
EMOJIS = {
'DISCORD': '🗨️', # When a message is sent from Discord
'HYPIXEL': '🎮', # When a message is sent from Hypixel
'JOIN': '📥', # When a member joins... | 31.565217 | 61 | 0.717631 | [
"MIT"
] | hqsss/hypixel-guild-chat-python | constants.py | 740 | Python |
# Copyright 2013 Mirantis, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agr... | 33.442238 | 78 | 0.601231 | [
"Apache-2.0"
] | bdrich/neutron-lbaas | .tox/scenario/lib/python2.7/site-packages/oslo_config/tests/test_types.py | 18,527 | Python |
# Copyright 2018 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file or at
# https://developers.google.com/open-source/licenses/bsd
"""A service for querying data for charts.
Functions for querying the IssueSnapshot table and ... | 37.10705 | 79 | 0.675837 | [
"BSD-3-Clause"
] | xinghun61/infra | appengine/monorail/services/chart_svc.py | 14,212 | 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... | 33.551724 | 79 | 0.661871 | [
"Apache-2.0"
] | saltstack/rend | docs/conf.py | 1,946 | Python |
import time
import neopixel
from resetMachine import *
@pytest.fixture()
def tenPixelStrand():
pin = machine.Pin(5)
return neopixel.NeoPixel(pin, n=10)
black = (0, 0, 0)
red = (255, 0, 0)
green = (0, 255, 0)
class TestNeoPixel:
pin = machine.Pin(5)
def test_canSetPixelColor(self, resetMachine, t... | 29.827957 | 78 | 0.658616 | [
"MIT"
] | fovallesp/esp32-python | test/test_neopixel.py | 2,774 | Python |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2019-2020 CERN.
#
# invenio-app-ils is free software; you can redistribute it and/or modify it
# under the terms of the MIT License; see LICENSE file for more details.
"""Circulation Loan resolvers."""
from invenio_circulation.proxies import current_circulation
from invenio_p... | 28.190476 | 76 | 0.668074 | [
"MIT"
] | equadon/invenio-app-ils | invenio_app_ils/circulation/jsonresolvers/loan.py | 2,368 | Python |
"""Tests for functions defined in the floodsystem/geo module
"""
from floodsystem import geo
from floodsystem.station import MonitoringStation
from floodsystem.stationdata import build_station_list
stations = build_station_list()
# define arbitrary stations for the tests
station_id1 = "test station id 1"
measure_id... | 34.943662 | 128 | 0.742846 | [
"MIT"
] | negsrahimi/lahsheesh | test_geo.py | 2,481 | Python |
import pyopencl as cl
class DeviceInfo(object):
def __init__(self, device):
self.compute_units = device.get_info(cl.device_info.MAX_COMPUTE_UNITS)
self.maxShared = device.get_info(cl.device_info.LOCAL_MEM_SIZE) // 1024
self.compute_capability = (
device.get_info(cl.device_info.... | 45.9375 | 105 | 0.666667 | [
"BSD-2-Clause"
] | hughperkins/gpu-experiments | gpuexperiments/deviceinfo.py | 1,470 | Python |
import inspect
import os
import re
import subprocess
from collections import Counter
from io import StringIO
import pandas as pd
from numpy import unique
file_sep = os.path.sep
def imports_in_module(module):
"""
Get a list of strings showing what is imported in a module.
:param module: An actual module... | 38.638889 | 117 | 0.659358 | [
"Apache-2.0"
] | thorwhalen/tec | tec/snake_food_import_counting.py | 8,346 | Python |
import os
from yacs.config import CfgNode as CN
# -----------------------------------------------------------------------------
# Config definition
# -----------------------------------------------------------------------------
_C = CN()
# -----------------------------------------------------------------------------
... | 25.639241 | 86 | 0.619477 | [
"MIT"
] | divyam-goel/pytorch_connectomics | connectomics/config/config.py | 8,102 | Python |
"""Computational algebraic field theory."""
import functools
import math
import mpmath
from ..config import query
from ..core import (Add, Dummy, E, GoldenRatio, I, Integer, Mul, Rational,
cacheit, pi)
from ..core.exprtools import Factors
from ..core.function import _mexpand, count_ops
from ..cor... | 30.618005 | 88 | 0.54458 | [
"BSD-3-Clause"
] | diofant/diofant | diofant/polys/numberfields.py | 25,170 | Python |
print('\033[1;33m--' * 10)
print('\033[1;32m EXERCÍCIO 002')
print('\033[1;33m--\033[m' * 10)
nome = input('\033[1;34mDigite seu nome: ')
print(f'É um prazer te conhecer, \033[1;33m{nome}!')
| 31.833333 | 52 | 0.633508 | [
"MIT"
] | Dobravoski/Exercicios-Python | Exercicios/ex002.py | 193 | Python |
from django.contrib.auth import get_user_model
from django.urls import reverse
from django.test import TestCase
from rest_framework import status
from rest_framework.test import APIClient
from core.models import Tag,Recipe
from recipe.serializers import TagSerializer
TAGS_URL = reverse('recipe:tag-list')
class P... | 31.555556 | 71 | 0.629527 | [
"MIT"
] | deborahoni/recipe-app-api | app/recipe/tests/test_tags_api.py | 3,976 | Python |
from pipeline import app
if __name__ == "__main__":
app.run(debug=True)
| 15.4 | 26 | 0.701299 | [
"Apache-2.0"
] | HeqetLabs/pipeline | debug.py | 77 | Python |
from pyxform.tests_v1.pyxform_test_case import PyxformTestCase
class InvalidSurveyColumnsTests(PyxformTestCase):
def test_missing_name(self):
"""
every question needs a name (or alias of name)
"""
self.assertPyxformXform(
name='invalidcols',
ss_structure={'s... | 35.367089 | 75 | 0.411059 | [
"BSD-2-Clause"
] | medic/pyxform | pyxform/tests_v1/test_sheet_columns.py | 5,588 | Python |
from mayan.apps.documents.tests.base import GenericDocumentViewTestCase
from mayan.apps.testing.tests.base import GenericViewTestCase
from ..events import event_workflow_template_edited
from ..models import WorkflowTransition
from ..permissions import (
permission_workflow_template_edit, permission_workflow_... | 38.21327 | 105 | 0.708483 | [
"Apache-2.0"
] | CMU-313/fall-2021-hw2-451-unavailable-for-legal-reasons | mayan/apps/document_states/tests/test_workflow_transition_views.py | 16,126 | Python |
from flask import Flask
from flask_restful import Api
from flask_cors import CORS
from flask_migrate import Migrate, MigrateCommand
from flask_script import Manager
from {{cookiecutter.app_name}}.config import app_config
from {{cookiecutter.app_name}}.models import db, bcrypt
from {{cookiecutter.app_name}}.resources i... | 22.930233 | 63 | 0.704868 | [
"MIT"
] | opatua/cookiecutter-flask-api | {{cookiecutter.app_name}}/{{cookiecutter.app_name}}/app.py | 986 | Python |
#!/usr/bin/env python3 -u
# 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.
"""
Evaluate the perplexity of a trained language model.
"""
import logging
import math
import os
import torch
fr... | 34.119403 | 112 | 0.585302 | [
"MIT"
] | liangan1/fairseq | fairseq_cli/eval_lm.py | 9,144 | Python |
BACKSLASH = '\\'
class MiniString(object):
"""
Create a representation of a string object
:param str string: The string to minify
"""
def __init__(self, string, quote="'"):
self._s = string
self.safe_mode = False
self.quote = quote
def __str__(self):
"""
... | 24.017045 | 75 | 0.399574 | [
"MIT"
] | clbarnes/python-minifier | src/python_minifier/ministring.py | 4,227 | Python |
from django.test import TestCase
from django.urls import reverse
from accounts.factories import UserFactory
from transmittals.factories import create_transmittal
ack_button = '<a id="action-ack-transmittal"'
class TransmittalActionTests(TestCase):
def setUp(self):
self.trs = create_transmittal()
... | 30.411765 | 83 | 0.661509 | [
"MIT"
] | PhaseDMS/phase | src/transmittals/tests/test_templates.py | 1,551 | Python |
def path_hack():
import os, sys, inspect
currentdir = os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe())))
parentdir = os.path.dirname(currentdir)
sys.path.insert(0,parentdir)
# print('path added:', sys.path[0])
path_hack()
import traceback
import sys
import urllib.request
fr... | 30.289474 | 92 | 0.667246 | [
"MIT"
] | n-ryan/spotify-genius | apis/authentication.py | 1,151 | Python |
"""QuizSubmissionFiles API Tests for Version 1.0.
This is a testing template for the generated QuizSubmissionFilesAPI Class.
"""
import unittest
import requests
import secrets
from py3canvas.apis.quiz_submission_files import QuizSubmissionFilesAPI
class TestQuizSubmissionFilesAPI(unittest.TestCase):
"""Tests for... | 32.347826 | 126 | 0.752688 | [
"MIT"
] | tylerclair/py3canvas | py3canvas/tests/quiz_submission_files.py | 744 | Python |
from __future__ import absolute_import
import pickle
from kombu.utils.functional import lazy
from celery.five import THREAD_TIMEOUT_MAX, items, range, nextfun
from celery.utils.functional import (
LRUCache,
firstmethod,
first,
mlazy,
padlist,
maybe_list,
)
from celery.tests.case import Case
... | 27.082873 | 71 | 0.5459 | [
"Apache-2.0"
] | suntao789/Aclsm | site-packages/celery/tests/utils/test_functional.py | 4,902 | Python |
import pytest
import responses
def test_url(client):
assert client.url == "http://0.0.0.0:8580/jsonrpc"
@pytest.mark.parametrize('method', ['status', 'poll', 'kill', 'cli_args'])
def test_default_request(client, method):
expected = {
"jsonrpc": client.jsonrpc_version,
"method": method,
... | 32.607595 | 86 | 0.527562 | [
"MIT"
] | goodeggs/dbt-rpc-client | tests/test_client.py | 2,576 | Python |
from config.configure import Configure
conf = Configure()
conf.model_name = 'vgg16.h5'
conf.classes = ['no_breads', 'breads']
conf.no_breads_path = './dataset/data/pool/no_breads/*'
conf.breads_path = './dataset/data/pool/breads/*'
# conf.baked_breads_path = './dataset/data/pool/breads/*'
conf.lr = 1e-4
conf.momentu... | 24.25 | 57 | 0.726804 | [
"MIT"
] | jphacks/FK_1908 | server/recognition/config/__init__.py | 388 | Python |
import copy
import json
from abc import ABC
from datetime import datetime
from typing import Any
from cyber_sdk.util.converter import to_isoformat
def to_data(x: Any) -> Any:
if "to_data" in dir(x):
return x.to_data()
if isinstance(x, list):
return [to_data(g) for g in x]
if isinstance(x,... | 26.436364 | 91 | 0.644429 | [
"MIT"
] | SaveTheAles/cyber.py | cyber_sdk/util/json.py | 1,454 | Python |
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.animation as animation
lines = open("for_james.csv").read().splitlines()
data = [[float(x) for x in lines[i].split(", ")] for i in range(len(lines))]
# each item in data is a list of floats that can be passed to plt.hist
for i in range(9):
plt.... | 40.1875 | 103 | 0.682737 | [
"MIT"
] | ethantsai/nlwhistlers | dataPlotter.py | 643 | Python |
#! /usr/bin/python
#
# This is the answer code for the course "Learning from Data" on edX.org
# https://www.edx.org/course/caltechx/cs1156x/learning-data/1120
#
# The software is intended for course usage, no guarantee whatsoever.
# Date: 10/4/2013
# Created by: kirbs
# See notes at bottom for further details.
... | 41.173469 | 129 | 0.584634 | [
"Apache-2.0"
] | freeernest/edX-Learning-From-Data-Solutions | Homework_1/Python/homework_1_by_kirbs.py | 8,070 | Python |
# -*- coding: utf-8 -*-
import sys
from contextlib import contextmanager
from shutil import rmtree as _rmtree
from tempfile import template, mkdtemp, _exists
from cms.apphook_pool import apphook_pool
from django.contrib.auth import get_user_model
from django.utils.six.moves import StringIO
from django.utils.translatio... | 26.32 | 106 | 0.640035 | [
"BSD-3-Clause"
] | CamelotVG/django-cms | cms/test_utils/util/context_managers.py | 4,606 | Python |
# Copyright 2016-2021 The Van Valen Lab at the California Institute of
# Technology (Caltech), with support from the Paul Allen Family Foundation,
# Google, & National Institutes of Health (NIH) under Grant U24CA224309-01.
# All rights reserved.
#
# Licensed under a modified Apache License, Version 2.0 (the "License");... | 42.861111 | 80 | 0.747894 | [
"Apache-2.0"
] | GuillaumeMougeot/deepcell-tf | deepcell/applications/multiplex_segmentation.py | 1,543 | Python |
#ERIMX Made By Paradox4280 aka c2FI, x2Fi, RG9t
import discord, base64, codecs, requests, urllib.parse, datetime, asyncio, sys, praw
import random, aiohttp, io, json, os, string, platform, time, bs4, colorama
from discord.ext import (
commands
)
from discord.voice_client import VoiceClient
# from discord... | 33.76 | 144 | 0.669431 | [
"MIT"
] | paradox4280/Erimx | src/bot.py | 2,532 | Python |
# Copyright 2019 Google LLC. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... | 37.607973 | 79 | 0.716343 | [
"Apache-2.0"
] | SunitRoy2703/tfx | tfx/dsl/components/common/importer.py | 11,320 | Python |
from datetime import timedelta
from os import path
from re import sub as regex_sub
from shutil import rmtree
import uuid
from django.conf import settings
from django.core.exceptions import ValidationError
from django.core.validators import MinValueValidator, MaxValueValidator
from django.db import models
from django.d... | 40.018349 | 118 | 0.673315 | [
"MIT"
] | awst-austria/qa4sm | validator/models/validation_run.py | 8,724 | Python |
# Refaça o exercicio009, mostrando a tabuada de um número que um usuário escolher utilizando FOR.
print('=-='*3)
print('TABUADA')
print('=-='*3)
m = 0
n = int(input('Digite o número que deseja saber a tabuada: '))
for c in range(1, 11):
m = n * c
print('{} x {} = {}.'.format(n, c, m))
| 24.666667 | 97 | 0.611486 | [
"MIT"
] | PedroMunizdeMatos/Estudos-e-Projetos | Python 3 - Curso completo/exercicio049.py | 300 | Python |
from functools import lru_cache
import sqlalchemy
class lru_cache_in_transaction: # noqa: N801
"""
Decorator to wrap a function with a memoizing callable that saves up to
the `maxsize` most recent calls. The underlying cache is automatically
cleared at the end of the database transaction.
Since... | 31.135135 | 90 | 0.676215 | [
"BSD-2-Clause"
] | Brahim109/h | h/util/db.py | 2,304 | Python |
"""
django:
https://docs.djangoproject.com/en/3.0/topics/http/middleware/
https://docs.djangoproject.com/en/3.0/ref/settings/#middleware
"""
MIDDLEWARE = (
"django_prometheus.middleware.PrometheusBeforeMiddleware",
"django.middleware.security.SecurityMiddleware",
"django.contrib.sessions.middleware... | 38.222222 | 66 | 0.77907 | [
"MIT"
] | fabiommendes/capacidade_hospitalar | hcap/settings/general/middleware.py | 688 | Python |
# Copyright (C) 2020-2022 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
import os
import pytest
from openvino.tools.pot.configs.config import Config
from .utils.path import TOOL_CONFIG_PATH
ALGORITHM_SETTINGS = {
'wrong_preset': (
{
'name': 'MinMaxQuantization',
'params'... | 32.26875 | 103 | 0.427077 | [
"Apache-2.0"
] | 3Demonica/openvino | tools/pot/tests/test_wrong_config.py | 5,163 | Python |
stevilo = int(input("Select a number between 1 and 100:"))
x = 1
if stevilo >= 1 and stevilo <= 100:
while x <= stevilo:
ostanek_1 = x % 3
ostanek_2 = x % 5
if x % 3 == 0 and x % 5 == 0:
print('fizzbuzz')
elif ostanek_1 == 0:
print ("fizz")
... | 24.882353 | 59 | 0.434988 | [
"MIT"
] | anzpia/FizzBuzz | fizzbuzz.py | 423 | Python |
from backports import tempfile
import numpy as np
import os
import dill
import tensorflow as tf
import zipfile
import baselines.common.tf_util as U
from build_graph import build_act, build_train
from baselines import logger
from baselines.common.schedules import LinearSchedule
from baselines.deepq.replay_buffer impor... | 39.182836 | 100 | 0.622322 | [
"MIT"
] | hyperdo/python2-baselines | baselines/deepq/simple.py | 10,501 | Python |
import io
import os.path
_DUMPS = os.path.join(os.path.dirname(__file__), 'dumps')
def load_dump(fname):
with open(os.path.join(_DUMPS, fname), 'rb') as f:
return io.BytesIO(f.read())
| 18.181818 | 57 | 0.665 | [
"MIT"
] | popravich/rdbtools3 | tests/util.py | 200 | Python |
import pytest
from exchange_calendars.exchange_calendar_xshg import XSHGExchangeCalendar
from .test_exchange_calendar import ExchangeCalendarTestBase
from .test_utils import T
class TestXSHGCalendar(ExchangeCalendarTestBase):
@pytest.fixture(scope="class")
def calendar_cls(self):
yield XSHGExchangeCa... | 23.62 | 74 | 0.538527 | [
"Apache-2.0"
] | gerrymanoim/trading_calendars | tests/test_xshg_calendar.py | 1,181 | Python |
# Generated by Django 4.0.3 on 2022-04-06 17:40
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('records', '0006_alter_records_phasesday'),
]
operations = [
migrations.RenameField(
model_name='records',
old_name='date',
... | 19.631579 | 52 | 0.595174 | [
"MIT"
] | Glucemy/Glucemy-back | records/migrations/0007_rename_date_records_created_date.py | 373 | Python |
import datetime
from typing import Dict, Tuple, Any
import boto3
from botocore.stub import Stubber
from dateutil.tz import tzutc
from dassana.common.aws_client import LambdaTestContext
from json import dumps
import pytest
@pytest.fixture()
def input_s3_with_website(s3_public_bucket_with_website, region):
return... | 37.358621 | 118 | 0.603101 | [
"Apache-2.0"
] | XxxSetItOffxxX/dassana | content/actions/what-is-ec2-role/test_ec2_role_handler.py | 5,417 | Python |
# Unit PYG02: Pygame Wall Ball Game version 3 操控型
import pygame,sys
pygame.init()
vINFO=pygame.display.Info()
print(vINFO)
size = width, height = vINFO.current_w,vINFO.current_h
speed = [1,1]
BLACK = 0, 0, 0
screen = pygame.display.set_mode(size,pygame.FULLSCREEN)
icon=pygame.image.load("1.png")
pygame.display.set... | 32.096154 | 105 | 0.59257 | [
"MIT"
] | LZY2006/pygame-small-games | 壁球/壁球游戏2.0/main.py | 1,679 | Python |
import asyncio
import os
from pstats import Stats
from tempfile import NamedTemporaryFile
from aiomisc.service.profiler import Profiler
async def test_profiler_start_stop():
profiler = Profiler(interval=0.1, top_results=10)
try:
await profiler.start()
await asyncio.sleep(0.5)
finally:
... | 23.038462 | 53 | 0.6202 | [
"MIT"
] | MrPainter/aiomisc | tests/test_profiler.py | 1,198 | Python |
# Use legacy numpy printing. This fix is made to keep doctests functional.
# For more info, see https://github.com/scikit-image/scikit-image/pull/2935 .
# TODO: remove this workaround once minimal required numpy is set to 1.14.0
from distutils.version import LooseVersion as Version
import numpy as np
if Version(np.__v... | 35.5625 | 77 | 0.760984 | [
"MIT"
] | 997Yi/Flask-web | venv/Lib/site-packages/skimage/conftest.py | 569 | Python |
import streamlit as st
def render():
st.write("You are in Search a song page")
| 16.8 | 45 | 0.690476 | [
"MIT"
] | AlexCaranha/QueryByHumming | src/search_a_song_page.py | 84 | Python |
from model.contact import Contact
from model.group import Group
import random
def test_add_contact_in_group(app, db):
if app.contact.count() == 0:
app.contact.create_new(Contact(firstname="Contact for deletion", middlename="some middlename", lastname="some last name"))
if len(app.group.get_group_list(... | 36.848485 | 130 | 0.697368 | [
"Apache-2.0"
] | vatanov/python_training | test/test_del_contact_from_group.py | 1,216 | Python |
from .config import AppConfig
from .registry import apps
__all__ = ['AppConfig', 'apps']
| 18 | 31 | 0.744444 | [
"MIT"
] | 0724654276/Awwards | venv/lib/python3.8/site-packages/django/apps/__init__.py | 90 | Python |
from asyncio.log import logger
from django.apps import AppConfig
class NamesConfig(AppConfig):
default_auto_field = "django.db.models.BigAutoField"
name = "derbot.names"
def ready(self):
import derbot.names.signals
logger.info(f"Signals loaded: {derbot.names.signals}")
| 21.642857 | 62 | 0.716172 | [
"MIT"
] | bdunnette/derbot-docker | derbot/names/apps.py | 303 | Python |
# coding: utf-8
from __future__ import unicode_literals
import unittest
import os
import shutil
import numpy as np
from monty.json import MontyDecoder
from pymatgen.io.vasp.sets import MITVaspInputSet, MITHSEVaspInputSet, \
MPVaspInputSet, MITGGAVaspInputSet, MITNEBVaspInputSet,\
MPStaticVaspInputSet, MPNon... | 39.940048 | 91 | 0.616331 | [
"MIT"
] | rousseab/pymatgen | pymatgen/io/vasp/tests/test_sets.py | 16,655 | Python |
import logging
import configparser
import os
from utils import bool_query
class BreakRule(object):
def __init__(self, settings):
self.settings = settings
self.rules_record = configparser.ConfigParser()
self.rules_record.read("{}/tms/breakrules.ini".format(os.getcwd()))
self.rules... | 37.57377 | 108 | 0.616492 | [
"MIT"
] | marmstr93ng/TimeManagementSystem | tms/breakrule.py | 2,292 | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.