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 |
|---|---|---|---|---|---|---|---|---|
# 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, ... | 33.255787 | 110 | 0.604788 | [
"ECL-2.0",
"Apache-2.0"
] | cdfreeman-google/jax | tests/lax_control_flow_test.py | 87,629 | Python |
import bpy
from bpy.props import BoolProperty, StringProperty
import os
from ..preferences import get_pref
class RSN_OT_CreatCompositorNode(bpy.types.Operator):
bl_idname = "rsn.creat_compositor_node"
bl_label = "Separate Passes"
use_passes: BoolProperty(default=False)
view_layer: StringProperty(def... | 35.047619 | 101 | 0.647758 | [
"Apache-2.0"
] | MarcoHoo/RenderStackNode | operators/compositor_nodetree.py | 2,944 | Python |
from tests import create_rand
def prepare_database_with_table(name: str, rows: list):
from peewee import IntegerField, Proxy, CharField, Model
from playhouse.sqlite_ext import CSqliteExtDatabase
db = Proxy()
db.initialize(CSqliteExtDatabase(':memory:', bloomfilter=True))
NameModel = type(name, (M... | 33.133333 | 78 | 0.652582 | [
"MIT"
] | kororo/rand | tests/test_ds.py | 1,491 | Python |
# from flask import Flask, Blueprint
# from flask_sqlalchemy import SQLAlchemy
# from flask_login import LoginManager
# import os
from flask import Flask, jsonify, request, make_response, redirect, url_for
import jwt
import datetime
import os
from functools import wraps
from flask_sqlalchemy import SQLAlchemy
import u... | 33.831967 | 235 | 0.656208 | [
"MIT"
] | UNIZAR-30226-2022-09/back-end | .vscode-server/data/User/History/-1f47d17c/IWlp.py | 16,514 | Python |
"""A setuptools based setup module.
"""
# Always prefer setuptools over distutils
from setuptools import setup
setup(
name='ooinstall',
# Versions should comply with PEP440. For a discussion on single-sourcing
# the version across setup.py and the project code, see
# https://packaging.python.org/en... | 32.790123 | 86 | 0.670557 | [
"Apache-2.0"
] | DennisPeriquet/origin-ci-tool | oct/ansible/openshift-ansible/utils/setup.py | 2,656 | Python |
import pytest
from . import specparser
def test_load() -> None:
spec = specparser.Spec.loads(
"""
[meta]
version = 0
[enum]
user_level = ["beginner", "intermediate", "advanced"]
[directive._parent]
content_type = "block"
options.foo = ["path", "uri"]
[directive.child]
... | 21.721854 | 97 | 0.57561 | [
"MIT"
] | will-riddy/Covid-Dashboard | .myenv/Lib/site-packages/snooty/test_specparser.py | 3,280 | Python |
# dagutil.py - dag utilities for mercurial
#
# Copyright 2010 Benoit Boissinot <bboissin@gmail.com>
# and Peter Arrenbrecht <peter@arrenbrecht.ch>
#
# This software may be used and distributed according to the terms of the
# GNU General Public License version 2 or any later version.
from node import nullrev
from i18n ... | 29.672662 | 79 | 0.564432 | [
"BSD-3-Clause"
] | l2dy/machg | LocalMercurial/mercurial/dagutil.py | 8,249 | Python |
import requests
import argparse
import asyncio
import json
import logging
import websockets
import os.path
from collections import namedtuple
from game import Game
logging.basicConfig(level=logging.DEBUG, format='%(asctime)s - %(name)s - %(levelname)s - %(message)s')
wslogger = logging.getLogger('websockets')
wslogger... | 42.018018 | 109 | 0.595197 | [
"MIT"
] | catarinaacsilva/pacman | server.py | 4,664 | Python |
import bs4
from selenium import webdriver
import sys
import time
import os
def getWFSlot(productUrl):
driver = webdriver.Firefox()
driver.get(productUrl)
html = driver.page_source
soup = bs4.BeautifulSoup(html)
time.sleep(60)
no_open_slots = True
while no_open_slots:
driver.re... | 30.737705 | 104 | 0.6256 | [
"Apache-2.0"
] | NizZ8/Whole-Foods-Delivery-Slot | whole_foods_delivery_slot_firefox.py | 1,875 | Python |
class OrderedList:
def __init__(self, unique=False):
self.list = []
self.__unique = unique
def add(self, value):
i = 0
while (i < len(self.list)) and (self.list[i] < value):
i += 1
if self.__unique:
if len(self.list) == i or self.list[i] != va... | 25.081081 | 62 | 0.501078 | [
"MIT"
] | epmcj/nextflix | src/client_py/olist.py | 928 | 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 Ingredient
from recipe_app.serializers import IngredientSerializer
INGREDIENTS_URL = reverse('recipe_app... | 29.428571 | 76 | 0.667961 | [
"MIT"
] | oyekanmiayo/recipe-app-api | app/recipe_app/tests/test_ingredients_api.py | 3,090 | Python |
#
# Copyright (c) 2008-2015 Citrix Systems, 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 l... | 33.182039 | 308 | 0.58657 | [
"Apache-2.0"
] | HanseMerkur/nitro-python | nitro/resource/config/lb/lbvserver_appfwpolicy_binding.py | 13,671 | Python |
#
# Autogenerated by Frugal Compiler (3.4.2)
#
# DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
#
import asyncio
from datetime import timedelta
import inspect
from frugal.aio.processor import FBaseProcessor
from frugal.aio.processor import FProcessorFunction
from frugal.exceptions import TApplicat... | 31.599119 | 147 | 0.626516 | [
"Apache-2.0"
] | trevorackerman-wk/frugal | test/expected/python.asyncio/service_extension_same_file/f_Pinger.py | 7,173 | Python |
from __future__ import annotations
import argparse
import atexit
import itertools
import shlex
import shutil
import signal
import subprocess
import sys
import traceback
from pathlib import Path
from typing import Dict, List, Optional, Tuple
from pyoomph import ast, ast2ir, ast_transformer, c_output, ir, parser
pytho... | 35.088983 | 88 | 0.643521 | [
"MIT"
] | Akuli/oomph | pyoomph/__main__.py | 8,281 | Python |
import logging
from typing import List, Union
from cactus.consensus.block_record import BlockRecord
from cactus.consensus.blockchain_interface import BlockchainInterface
from cactus.consensus.constants import ConsensusConstants
from cactus.types.blockchain_format.sized_bytes import bytes32
from cactus.types.full_block... | 46.543689 | 120 | 0.695244 | [
"Apache-2.0"
] | Cactus-Network/cactus-blockchain | cactus/consensus/get_block_challenge.py | 4,794 | Python |
# -*- coding: utf-8 -*-
from functools import lru_cache
import requests
from requests.packages.urllib3.util.retry import Retry
# https://urllib3.readthedocs.io/en/latest/reference/urllib3.util.html#module-urllib3.util.retry
DEFAULT_RETRIES = 5
DEFAULT_BACKOFF_FACTOR = 0.1
DEFAULT_STATUS_FORCELIST = [500, 502, 503, 50... | 31.242424 | 96 | 0.743938 | [
"MPL-2.0"
] | klahnakoski/pyLibrary | mozci/util/req.py | 1,031 | Python |
from werkzeug.wrappers import Request
from flask import Flask, redirect, url_for, request, flash
from flask_sqlalchemy import SQLAlchemy
import os
import requests
import random
from contact_form import ContactForm
from flask_dance.contrib.github import make_github_blueprint, github
from flask_dance.contrib.gitl... | 35.908257 | 161 | 0.624681 | [
"MIT"
] | N1ght-Owls/hackathon | app.py | 7,828 | Python |
from pytest_bdd import given, when, then
from model.contact import Contact
import random
@given('a contact list')
def contact_list(db):
return db.get_contact_list()
@given('a contact with <firstname> and <lastname>')
def new_contact(firstname, lastname):
return Contact(firstname=firstname, lastname=lastname... | 39.134328 | 123 | 0.764302 | [
"Apache-2.0"
] | kasiazubielik/python_training | bdd/contact_steps.py | 2,622 | Python |
#!/usr/bin/env python
"""Django's command-line utility for administrative tasks."""
import os
import sys
def main():
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'secure_auth_rest.settings')
try:
from django.core.management import execute_from_command_line
except ImportError as exc:
rai... | 28.909091 | 80 | 0.687107 | [
"MIT"
] | justindjeumenet/secure_auth_rest | manage.py | 636 | Python |
ownerclass = 'AppDelegate'
ownerimport = 'AppDelegate.h'
# Init
result = Window(330, 110, "Tell me your name!")
nameLabel = Label(result, text="Name:")
nameLabel.width = 45
nameField = TextField(result, text="")
helloLabel = Label(result, text="")
button = Button(result, title="Say Hello", action=Action(owner, 'sayHel... | 30.37037 | 76 | 0.776829 | [
"BSD-3-Clause"
] | hsoft/xibless | demos/localized/MainWindow.py | 820 | Python |
from plotly.basedatatypes import BaseTraceHierarchyType as _BaseTraceHierarchyType
import copy as _copy
class Tickfont(_BaseTraceHierarchyType):
# class properties
# --------------------
_parent_path_str = "scatterternary.marker.colorbar"
_path_str = "scatterternary.marker.colorbar.tickfont"
_val... | 37.469298 | 84 | 0.569004 | [
"MIT"
] | 1abner1/plotly.py | packages/python/plotly/plotly/graph_objs/scatterternary/marker/colorbar/_tickfont.py | 8,543 | 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
# "L... | 40.200747 | 523 | 0.68373 | [
"Apache-2.0"
] | JamiesZhang/Storm | bin/storm.py | 43,055 | Python |
"""
The pyinspirehep is A python wrapper for Inspirehep API.
"""
from pyinspirehep.client import Client | 20.8 | 56 | 0.778846 | [
"MIT"
] | javadebadi/pyinspirehep | pyinspirehep/__init__.py | 104 | Python |
from envparse import env
env.read_envfile(".env")
BOT_TOKEN = env.str("BOT_TOKEN") | 14.166667 | 32 | 0.741176 | [
"MIT"
] | exthrempty/vkbottle-bot-template | src/config.py | 85 | Python |
# twitter_app/iris_classifier.py
import os
import pickle
from sklearn.datasets import load_iris
from sklearn.linear_model import LogisticRegression
MODEL_FILEPATH = os.path.join(os.path.dirname(__file__), "..", "models", "latest_model.pkl")
def train_and_save_model():
print("TRAINING THE MODEL...")
X, y = ... | 27.697674 | 92 | 0.677582 | [
"MIT"
] | Struth-Rourke/twitter_flask_app | twitter_app/iris_classifier.py | 1,191 | Python |
"""BOM data 'collector' that downloads the observation data."""
import asyncio
import datetime
import aiohttp
import logging
from homeassistant.util import Throttle
_LOGGER = logging.getLogger(__name__)
MIN_TIME_BETWEEN_UPDATES = datetime.timedelta(minutes=10)
BASE_URL = "https://api.weather.bom.gov.au"
DAILY_FORECA... | 36.648936 | 80 | 0.594194 | [
"Unlicense"
] | QziP22/HomeAssistantConfig | custom_components/bureau_of_meteorology/PyBoM/collector.py | 6,890 | Python |
def autonomous_setup():
pass
def autonomous_main():
pass
def teleop_setup():
pass
def teleop_main():
pass
| 10.416667 | 23 | 0.656 | [
"Apache-2.0"
] | DanielMolina24/website | assets/student-resources/blank_template.py | 125 | Python |
from unittest import TestCase
from webtest import TestApp
from ironic_inventory.tests import FunctionalTest
class TestRootController(FunctionalTest):
def test_get(self):
response = self.app.get('/')
assert response.status_int == 200
def test_search(self):
response = self.app.post('/'... | 30.304348 | 69 | 0.657102 | [
"Apache-2.0"
] | softlayer/ironic-inventory-integrator | ironic_inventory/tests/test_functional.py | 697 | Python |
class Solution:
def ladderLength(self, beginWord: str, endWord: str, wordList: List[str]) -> int:
if endWord not in wordList:
return 0
result = 0
l = len(beginWord)
beginSet = {beginWord}
endSet = {endWord}
wordList = set(wordList)
... | 32.027027 | 85 | 0.389873 | [
"MIT"
] | udcymen/leetcode | Python/questions/WordLadder/word-ladder.py | 1,185 | Python |
# SPDX-License-Identifier: MIT
# Copyright (c) 2018-2022 Amano Team
import os
import shutil
import tempfile
from PIL import Image
from pyrogram import Client, filters
from pyrogram.enums import MessageEntityType
from pyrogram.errors import PeerIdInvalid, StickersetInvalid
from pyrogram.raw.functions.messages import G... | 37.821429 | 87 | 0.533428 | [
"MIT"
] | MikeOwino/EduuRobot | eduu/plugins/stickers.py | 10,593 | Python |
# coding: utf-8
import arrow
from flask import current_app, request, g
from itsdangerous import TimedJSONWebSignatureSerializer as JWT
from actor_libs.errors import AuthFailed
from app.models import Application, User
__all__ = ['basic_auth', 'token_auth']
def basic_auth(username, password) -> bool:
""" HTTP b... | 32.070423 | 82 | 0.635485 | [
"Apache-2.0"
] | Mateus-dang/ActorCloud | server/actor_libs/auth/base.py | 2,277 | Python |
# *****************************************************************************
# Copyright (c) 2019 IBM Corporation and other Contributors.
#
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Eclipse Public License v1.0
# which accompanies this distribution,... | 41.56 | 79 | 0.480269 | [
"EPL-1.0"
] | cesariojr/iot-python | test/test_api_status.py | 1,039 | 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.983607 | 79 | 0.662808 | [
"MIT"
] | jeanphilippemercier/uquake-useis | docs/source/conf.py | 2,073 | Python |
"""Amazon Neptune Module."""
import logging
import re
from typing import Any
import pandas as pd
from gremlin_python.process.graph_traversal import GraphTraversalSource, __
from gremlin_python.process.translator import Translator
from gremlin_python.process.traversal import Cardinality, T
from gremlin_python.structur... | 34.640288 | 116 | 0.638975 | [
"Apache-2.0"
] | minwook-shin/aws-data-wrangler | awswrangler/neptune/neptune.py | 14,445 | Python |
# The MIT License (MIT)
#
# Copyright (c) 2019 Paul Sajna for Adafruit Industries LLC
#
# 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 r... | 39.747368 | 105 | 0.552039 | [
"MIT"
] | sajattack/Adafruit_CircuitPython_ImageLoad | adafruit_imageload/gif/__init__.py | 7,552 | Python |
import math
import ctypes
import pyglet
pyglet.options["shadow_window"] = False
pyglet.options["debug_gl"] = False
import pyglet.gl as gl
import matrix
import shader
import camera
import block_type
import texture_manager
class Window(pyglet.window.Window):
def __init__(self, **args):
super().__init__(**args)
... | 30.126263 | 133 | 0.718692 | [
"MIT"
] | StartForKillerMC/python-minecraft-clone | episode-7/main.py | 5,965 | Python |
from __future__ import print_function
from exodus import BaseMigration
class Migration(BaseMigration):
version = '2015_10_10'
def can_migrate_database(self, adapter):
return self.version > adapter.db.get('version', None)
def migrate_database(self, adapter):
# migrate the keys
ada... | 26.5 | 61 | 0.67217 | [
"BSD-2-Clause"
] | adamlwgriffiths/exodus | tests/jaweson_migrations/2015_10_10_move_keys.py | 424 | Python |
from flask import Flask, request, jsonify, send_from_directory
import engine
app = Flask(__name__)
@app.route('/api/texts')
def texts():
return send_from_directory('i18n', 'ui.de.json');
@app.route('/api/codenames')
def codenames():
return jsonify(engine.codenames())
@app.route('/api/ready')
def ready():
... | 24.918919 | 62 | 0.649675 | [
"MIT"
] | alimfeld/codenames | server/server.py | 922 | Python |
import os
import re
def gen_sitemap(main_site, md_file):
pattern = re.compile(r': (.*?).md', re.S)
res = []
with open(md_file) as md:
for line in md.readlines():
line = str(line)
cur_urls = re.findall(pattern, line)
if len(cur_urls) > 0:
if cur_u... | 27.424242 | 109 | 0.550276 | [
"MIT"
] | RustFisher/python-playground | genmenu/gen_wiki_sitemap.py | 913 | Python |
from django.contrib.auth import get_user_model
User = get_user_model()
superuser_username = 'admin'
superuser_email = 'superuser@admin.test'
superuser_password = 'admin_test'
try:
User.objects.get(username=superuser_username)
except User.DoesNotExist:
User.objects.create_superuser(
superuser_username... | 24.266667 | 63 | 0.785714 | [
"MIT"
] | NeZanyat/django-project-starter | service/scripts/create_superuser.py | 364 | Python |
from django.db import models
from django.conf import settings
from django_extensions.db.models import TimeStampedModel
from djcommerce.utils import get_address_model
Address = get_address_model()
class Profile(TimeStampedModel):
user = models.ForeignKey(
settings.AUTH_USER_MODEL,
on_delete = mod... | 23.904762 | 56 | 0.723108 | [
"MIT"
] | tdsprogramming/djcommerce | djcommerce/models/profile.py | 502 | Python |
# Copyright (c) MONAI Consortium
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to in writing, so... | 34.3625 | 115 | 0.684613 | [
"Apache-2.0"
] | Borda/MONAI | tests/test_integration_workflows_gan.py | 5,498 | Python |
import logging
import urllib.request
from datetime import datetime
from multiprocessing import Manager, Value
from multiprocessing.pool import ThreadPool
class EntryPoint:
Log = logging.getLogger(__name__)
def __init__(self):
self.__total_size = Value('i', 0)
self.__sizes_by_file ... | 35.383838 | 111 | 0.591493 | [
"MIT"
] | russcollier/SamplesAndNuggets | python/threadpool_example.py | 3,503 | Python |
from typing import List, Tuple, Union
import numpy as np
import torch
import pytorch_lightning as pl
def calc_area(bbox: np.ndarray):
return (bbox[2] - bbox[0]) * (bbox[3] - bbox[1])
def calc_bbox_overlap_union_iou(pred: np.ndarray or None, teacher: np.ndarray) -> Tuple[float, float, float]:
"""
:para... | 47.589928 | 115 | 0.621391 | [
"MIT"
] | pei223/deepext-with-lightning | deepext_with_lightning/metrics/object_detection.py | 13,400 | Python |
# coding: utf-8
import math
import random
import time
import asyncclick as click
@click.group()
def cli():
"""This script showcases different terminal UI helpers in Click."""
pass
@cli.command()
def colordemo():
"""Demonstrates ANSI color support."""
for color in "red", "green", "blue":
cli... | 24.695906 | 85 | 0.550556 | [
"BSD-3-Clause"
] | D4N/asyncclick | examples/termui/termui.py | 4,227 | Python |
########################## FWMAV Simulation #########################
# Version 0.3
# Fan Fei Feb 2019
# Direct motor driven flapping wing MAV simulation
#######################################################################
import gym
import flappy
from stable_baselines.common.policies import MlpPolicy
from stab... | 31.612245 | 145 | 0.714009 | [
"MIT"
] | ArbalestV/flappy | test.py | 3,098 | Python |
ano = input('Digite o ano: ')
mes = input('Digite o mes: ')
dia = input('Digite o dia')
print('{}/{}/{}'.format(dia, mes, ano))
print(dia, mes, ano, sep='/')
print(type(ano))
eval(ano)
print(type(eval(ano)))
| 23.111111 | 39 | 0.605769 | [
"MIT"
] | joaorobsonR/algoritmo1 | UNIVESPalgortimo_1/s4aula2.py | 208 | Python |
import os
import sys
__all__ = [
'lexsort','sort', 'argsort','argmin', 'argmax', 'searchsorted']
from pnumpy._pnumpy import getitem, lexsort32, lexsort64
import numpy as np
from numpy import asarray, array, asanyarray
from numpy import concatenate
#array_function_dispatch = functools.partial(
# overrides.arr... | 33.043887 | 94 | 0.591737 | [
"MIT"
] | Quansight/numpy-threading-extensions | src/pnumpy/sort.py | 21,082 | Python |
#!/usr/bin/env python
"""html2text: Turn HTML into equivalent Markdown-structured text."""
__version__ = "3.200.3"
__author__ = "Aaron Swartz (me@aaronsw.com)"
__copyright__ = "(C) 2004-2008 Aaron Swartz. GNU GPL 3."
__contributors__ = ["Martin 'Joey' Schulze", "Ricardo Reyes", "Kevin Jay North"]
# TODO:
# Support d... | 35.096175 | 129 | 0.53128 | [
"Apache-2.0"
] | awenz-uw/arlo | dev/html2text.py | 32,113 | Python |
import setuptools
with open("README.md", "r", encoding="utf-8") as fh:
long_description = fh.read()
setuptools.setup(
name="pyk3x",
author="Roming22",
author_email="roming22@gmail.com",
description="API to simplify k3d deployments",
keywords="kuberbetes, k3s, k3d, k3x, cluster",
long_descr... | 35.410256 | 66 | 0.6126 | [
"MIT"
] | Roming22/pyk3x | setup.py | 1,381 | Python |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import numpy as np
import os
import os.path
import math
import tensorflow as tf
from sklearn.model_selection import KFold
import matplotlib.pyplot as plt
from sklearn.metrics import mean_absolute_error
LOGDIR... | 46.062954 | 199 | 0.568545 | [
"MIT"
] | Graveheart/ProteinSSPrediction | cnn_phi_psi.py | 19,024 | Python |
"""desafio URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/3.2/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... | 33.166667 | 77 | 0.701005 | [
"MIT"
] | NathanMilhomen/vagas | desafio/urls.py | 796 | Python |
from django.urls import path
from . import views
urlpatterns = [
path('', views.IndexView.as_view()),
path('non-release/', views.NonRelease.as_view()),
]
| 20.375 | 53 | 0.680982 | [
"MIT"
] | chen1i6c04/Benga | frontend/urls.py | 163 | Python |
from punc_tokenizer import PuncTokenizer
| 20.5 | 40 | 0.902439 | [
"MIT"
] | liuxiaoan8008/sklearn-plus | sklearn_plus/preprocessing/text/en/__init__.py | 41 | Python |
import os
import random
import threading
from time import sleep
from unittest import TestCase
import asn1tools
import wx
import asn1editor
from asn1editor.wxPython.ViewSelect import ViewType
from tests import testHelper
def actions(main_window: asn1editor.wxPython.MainWindow):
def get_children(window: wx.Window... | 28.846154 | 134 | 0.654933 | [
"MIT"
] | Groops78/asn1editor | tests/test_MonkeyTest.py | 1,875 | Python |
from conans import ConanFile, CMake, tools
from conans.errors import ConanInvalidConfiguration
import os
required_conan_version = ">=1.33.0"
class SDL2Conan(ConanFile):
# TODO: When porting to CCI rename this package to SDL (without 2)
name = "sdl2"
description = "Access to audio, keyboard, mouse, joysti... | 46.505618 | 174 | 0.59181 | [
"MIT"
] | Rapatas/community | recipes/sdl2/all/conanfile.py | 16,556 | Python |
# This file is part of Indico.
# Copyright (C) 2002 - 2021 CERN
#
# Indico is free software; you can redistribute it and/or
# modify it under the terms of the MIT License; see the
# LICENSE file for more details.
from __future__ import unicode_literals
from sqlalchemy.ext.declarative import declared_attr
from indico... | 29.826923 | 96 | 0.727917 | [
"MIT"
] | UNOG-Indico/UNOG-Indico-v2 | indico/core/settings/models/settings.py | 1,551 | Python |
import unittest
from collections import namedtuple
import m
sample = """\
ab
ac
b
b\
"""
TestCase = namedtuple("TestCase", ["text", "output"])
class TestDec6(unittest.TestCase):
def test_get_groups(self):
cases = [
TestCase(sample, [['ab', 'ac'], ['b', 'b']]),
]
for c in c... | 22.074074 | 57 | 0.519295 | [
"MIT"
] | einarssons/adventofcode2020 | dec06/test.py | 1,192 | Python |
decrescente = True
anterior = int(input("Digite o primeiro número da sequência: "))
valor = 1
while valor != 0 and decrescente:
valor = int(input("Digite o próximo número da sequência: "))
if valor > anterior:
decrescente = False
anterior = valor
if decrescente:
print("A sequência está em o... | 25.625 | 65 | 0.673171 | [
"MIT"
] | renarfreitas/Coursera | indicadordepassagem.py | 420 | Python |
import torch
import torch.nn as nn
from torch import optim
import torch.nn.functional as F
from torch.autograd import Variable
import numpy as np
import matplotlib.pyplot as plt
train_data = np.load("E:\\quant_research\\train the rank of ten points\\RNN_point\\data\\train_data_10num.npy")
train_aim = np.loa... | 37.589623 | 146 | 0.648638 | [
"Apache-2.0"
] | 00wuweimin/jubilant-dollop | pointer_network.py | 7,979 | Python |
from projections import *
from urllib2 import urlopen
from httplib import HTTPConnection
from threading import Thread
from kivy.logger import Logger
from kivy.loader import Loader
from os.path import join, dirname
import time, os
import hashlib
GMLNS = "http://www.opengis.net/gml"
try:
from pyproj import Proj
... | 33.308824 | 123 | 0.583959 | [
"MIT"
] | relet/kivyMaps | WFSOverlayServer.py | 6,795 | Python |
'''
Created on 2012/09/03
@author: amake
'''
from __future__ import print_function
import os
import sys
import urllib
import codecs
from datetime import datetime
from xml.etree import ElementTree
import putio
CACHE_FILE = "cache.txt"
FEEDS_FILE = "feeds.txt"
DEBUG = True
PUTIOAPI = None
# Stupid CloudFlare decid... | 22.52381 | 77 | 0.578677 | [
"MIT"
] | amake/puttools-py | feedputter.py | 3,311 | Python |
# -*- coding: utf-8 -*-
from cms.plugin_pool import plugin_pool
from cms.plugin_base import CMSPluginBase
from .models import OembedVideoPlugin, OembedRichPlugin
from django.utils.translation import ugettext_lazy as _
from django.conf import settings
class CMSOembedVideoPlugin(CMSPluginBase):
name = _('Video (emb... | 35.209302 | 102 | 0.678996 | [
"BSD-3-Clause"
] | MatthewWilkes/djangocms-oembed | djangocms_oembed/cms_plugins.py | 1,514 | Python |
from typing import List
import json
import hashlib
from time import time
from base64 import b64decode, b64encode
import ecdsa
from config import ECDSA_CURVE
from .constants import BLOCK_COUNT_FREEZE_WALLET_LOTTERY_AFTER_WIN, DEVELOPER_KEY
from .transaction import Transaction
from .exceptions import (
ValidationEr... | 35.10989 | 103 | 0.637715 | [
"MIT"
] | thewh1teagle/yoyocoin | src/blockchain/block.py | 6,390 | Python |
conf_linuxbridge_agent_ini = """[DEFAULT]
#
# From oslo.log
#
# If set to true, the logging level will be set to DEBUG instead of the default
# INFO level. (boolean value)
#debug = false
# If set to false, the logging level will be set to WARNING instead of the
# default INFO level. (boolean value)
# This option is ... | 42.703704 | 414 | 0.775513 | [
"MIT"
] | jiasir/playback | playback/templates/linuxbridge_agent_ini.py | 6,918 | Python |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('focus', '0006_auto_20160209_1200'),
]
operations = [
migrations.AlterField(
model_name='remedial',
na... | 24.947368 | 120 | 0.635021 | [
"MPL-2.0",
"MPL-2.0-no-copyleft-exception"
] | openshiksha/openshiksha | focus/migrations/0007_auto_20160209_1201.py | 474 | Python |
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU... | 42.133333 | 79 | 0.624209 | [
"BSD-2-Clause"
] | aroodooteam/aro_hr | models/hr_job_task.py | 1,264 | Python |
import numpy as np
from sklearn import preprocessing
class DataTransformation:
"""
A generic class for the transformation of data
"""
def __init__(self):
pass
def transform_X(self, X):
"""
transforms X
:param
X: Input X
:return
transform... | 21.63 | 103 | 0.596163 | [
"Apache-2.0"
] | VirgiAgl/V_savigp | GP/data_transformation.py | 4,326 | Python |
# encoding: utf-8
from functools import partial
from collections import OrderedDict
import torch
import torch.nn as nn
import torch.nn.functional as F
from config import config
from base_model import resnet50
from seg_opr.seg_oprs import ConvBnRelu
class CPNet(nn.Module):
def __init__(self, out_planes, criterio... | 41.556962 | 80 | 0.581937 | [
"MIT"
] | akinoriosamura/TorchSeg-mirror | model/cpn/ade.cpn.R50_v1c.v7/network.py | 6,566 | Python |
consumer_key = 'YOUR CONSUMER KEY'
consumer_secret = 'YOUR CONSUMER SECRET'
access_token = 'YOUR ACCESS TOKEN'
access_token_secret = 'YOUR ACCESS TOKEN SECRET'
| 32 | 48 | 0.79375 | [
"MIT"
] | joshsisto/bitcoin_tweeter | bitcoin_tweeter/credentials.py | 160 | Python |
#!/usr/bin/env python3
# Copyright 2019 The University of Manchester UK
# Copyright 2019 RO-Crate contributors <https://github.com/ResearchObject/ro-crate/graphs/contributors>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
... | 40.511364 | 151 | 0.638289 | [
"Apache-2.0"
] | bedroesb/ro-crate | scripts/schema-context.py | 7,130 | Python |
import struct
import socket
import ipaddress
from .utils import calculate_checksum
IPV4_HEAD_FMT="!BBHHHBBHII" #H is unsigned short (2 bytes) ! is for network (big-endian)
class IPV4Datagram:
"""
This class contains 20 bytes IPV4 Datagram
https://en.wikipedia.org/wiki/IPv4
|0|1|2|3|4|5|6|7|8|9|10|11|1... | 48.554217 | 135 | 0.531762 | [
"MIT"
] | UsamaMehboob/RawSocketsPython | Raw_Socket_Protos/rawIPV4.py | 4,030 | Python |
# -*- coding:utf-8 -*-
"""
Copyright (c) 2013-2016 SYPH, All Rights Reserved.
-----------------------------------------------------------
Author: S.JunPeng
Date: 2016/12/22
Change Activity:
"""
import logging
import json
from vendor.utils.encrypt import Cryption
from apps.common.models import Clie... | 39.814815 | 117 | 0.596093 | [
"MIT"
] | diudiu/featurefactory | procuratorate/dataocean_judger.py | 5,375 | Python |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import pytest
import os
import numpy as np
import glob
from psrsigsim.signal.fb_signal import FilterBankSignal
from psrsigsim.pulsar.pulsar import Pulsar
from psrsigsim.pulsar.portraits import DataPortrait
from psrsigsim.pulsar.profiles import DataProfile
from psrsigsim.... | 30.229437 | 76 | 0.597594 | [
"MIT"
] | bshapiroalbert/PsrSigSim | tests/test_simulate.py | 6,983 | Python |
# -*- coding: utf-8 -*-
"""
Created on Sun Mar 10 22:59:51 2019
@author: Sravan
"""
# -*- coding: utf-8 -*-
"""
Created on Thu Feb 14 22:36:21 2019
@author: Sravan
"""
import csv
import numpy as np
from scipy.spatial.distance import pdist, squareform, euclidean, cdist
import matplotlib.pyplot as plt
import mpl_tool... | 37.127907 | 116 | 0.432509 | [
"MIT"
] | SVJayanthi/DroneSimulation | drone_2.py | 12,781 | Python |
__author__ = 'hofmann'
__version__ = '0.0.2.1'
import os
from scripts.MetaDataTable.metadatatable import MetadataTable
from scripts.NcbiTaxonomy.ncbitaxonomy import NcbiTaxonomy
from scripts.Validator.validator import Validator
class TaxonomicProfile(Validator):
"""
Constructing taxonomic profiles from files... | 49.359848 | 130 | 0.659197 | [
"Apache-2.0"
] | alienzj/CAMISIM | scripts/ComunityDesign/taxonomicprofile.py | 13,031 | Python |
"""
Support for interface with a Bose Soundtouch.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/media_player.soundtouch/
"""
import logging
import re
import voluptuous as vol
import homeassistant.helpers.config_validation as cv
from homeassistant.comp... | 33.035616 | 79 | 0.625643 | [
"Apache-2.0"
] | Anthonymcqueen21/home-assistant | homeassistant/components/media_player/soundtouch.py | 12,058 | Python |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, division, print_function, unicode_literals
# The MIT License
# Copyright (c) 2017 - 2021 Tammo Ippen, tammo.ippen@posteo.de
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation fi... | 37.152174 | 82 | 0.716793 | [
"MIT"
] | ntezak/plotille | examples/house_example.py | 1,709 | Python |
#!/usr/bin/env python
import random
import unittest
from kaldi.base.io import istringstream, ostringstream
from kaldi.cudamatrix import cuda_available, approx_equal_cu_matrix, CuMatrix
from kaldi.matrix import Matrix, Vector
from kaldi.matrix.functions import approx_equal
from kaldi.nnet3 import *
class TestNnetComp... | 40.375758 | 82 | 0.624287 | [
"Apache-2.0"
] | Alienmaster/pykaldi | tests/nnet3/nnet-compute-test.py | 6,662 | Python |
# this is here to avoid a circular import
from collections import namedtuple
class Point(namedtuple("Point", ["x", "y", "group", "fid"])):
@property
def __geo_interface__(self):
return {"type": "Point", "coordinates": (self.x, self.y)}
def as_feature(self):
geometry = self.__geo_interface... | 33.285714 | 82 | 0.641631 | [
"Apache-2.0"
] | eyeseast/dorchester | dorchester/point.py | 466 | Python |
"""
CryptoAPIs
Crypto APIs 2.0 is a complex and innovative infrastructure layer that radically simplifies the development of any Blockchain and Crypto related applications. Organized around REST, Crypto APIs 2.0 can assist both novice Bitcoin/Ethereum enthusiasts and crypto experts with the development of thei... | 43.085561 | 484 | 0.60767 | [
"MIT"
] | dkremer-ledger/Crypto_APIs_2.0_SDK_Python | cryptoapis/model/address_tokens_transaction_unconfirmed_omnilayertoken.py | 8,057 | Python |
from typing import Union, List, Optional
from pyspark.sql.types import StructType, StructField, StringType, ArrayType, DataType
# This file is auto-generated by generate_schema so do not edit manually
# noinspection PyPep8Naming
class TestReport_TeardownSchema:
"""
A summary of information based on the resul... | 42.642276 | 96 | 0.563203 | [
"Apache-2.0"
] | icanbwell/SparkFhirSchemas | spark_fhir_schemas/stu3/complex_types/testreport_teardown.py | 5,245 | Python |
from tracking.harvest import save_dfes_avl
from django.core.management.base import BaseCommand
import logging
LOGGER = logging.getLogger('tracking_points')
class Command(BaseCommand):
help = "Runs harvest_tracking_email to harvest points"
def handle(self, *args, **options):
LOGGER.info('Harvesting ... | 32.05 | 140 | 0.673947 | [
"BSD-3-Clause"
] | fahmidaward/resource_tracking | tracking/management/commands/harvest_dfes_feed.py | 641 | Python |
#!/usr/bin/env python
# -*- encoding: utf-8 -*-
from .amp_type import AMP_TYPE
from colossalai.context import Config
import torch.nn as nn
from torch.optim import Optimizer
from torch.nn.modules.loss import _Loss
from .torch_amp import convert_to_torch_amp
from .apex_amp import convert_to_apex_amp
from .naive_amp impo... | 43.098039 | 128 | 0.708826 | [
"Apache-2.0"
] | Cautiousss/ColossalAI | colossalai/amp/__init__.py | 2,198 | Python |
from collections import defaultdict
import pandas as pd
import pickle
from sqlalchemy import create_engine, inspect, Table, Column
from sqlalchemy.engine.url import make_url
from sys import exit
class DatabaseClient:
""" Takes care of the database pass opening to find the url and can query
the respected ... | 33.666667 | 90 | 0.540594 | [
"MIT"
] | MCSZ/pyontutils | ilxutils/ilxutils/database_client.py | 2,525 | Python |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may ... | 50.490798 | 200 | 0.685541 | [
"MIT"
] | AriZavala2/azure-sdk-for-python | sdk/network/azure-mgmt-network/azure/mgmt/network/v2020_06_01/aio/operations/_vpn_sites_configuration_operations.py | 8,230 | Python |
def testaArq(arq):
"""
-> Verifica se existe o arquivo arq
:arq: Nome do arquivo a ser testado.
:return: retorna True se o arquivo for encontrado,
caso contrário False
"""
try:
a = open(arq)
except FileNotFoundError: # O arquivo não foi encontrado
print('Arquivo não enco... | 21.333333 | 61 | 0.560662 | [
"MIT"
] | EduardoPessanha/Python | bibli/arquivo/__init__.py | 1,093 | Python |
# -*- coding: utf-8 -*-
__author__ = 'abbot'
from selenium import webdriver
from selenium.webdriver import ActionChains
driver = webdriver.PhantomJS(executable_path='/Users/wangbo/Downloads/phantomjs-2.1.1-macosx/bin/phantomjs')
ac = driver.find_element_by_xpath('element')
ActionChains(driver).move_to_element(ac).p... | 26.133333 | 108 | 0.783163 | [
"MIT"
] | fuandenghuo/100-days-of-python | selenium_test/action.py | 392 | Python |
a = input('Digite algo: ')
print(type(a))
print(a.isnumeric())
print(a.capitalize())
print(a.isalnum())
print(a.isdecimal())
print(a.islower())
print(a.upper()) | 20 | 26 | 0.68125 | [
"MIT"
] | legna7/Python | Mundo 1/Ex04.py | 160 | Python |
# Copyright 2021 DeepMind Technologies Limited
#
# 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 agree... | 34.381679 | 80 | 0.75222 | [
"Apache-2.0"
] | deepmind/brave | brave/evaluate_video_embeddings.py | 4,504 | Python |
"""API v2 tests."""
from django.urls import reverse
from modoboa.lib.tests import ModoAPITestCase
class TransportViewSetTestCase(ModoAPITestCase):
def test_list(self):
url = reverse("v2:transport-list")
resp = self.client.get(url)
self.assertEqual(resp.status_code, 200)
backends... | 25.470588 | 54 | 0.672055 | [
"ISC"
] | suryatmodulus/modoboa | modoboa/transport/api/v2/tests.py | 433 | Python |
import logging
import player
import telnet
logger = logging.getLogger(__name__)
########################################################################
class TrainingHandler(telnet.MudTelnetHandler):
####################################################################
def __init__(self, protocol, player):
... | 43.527027 | 102 | 0.473455 | [
"MIT"
] | tobynance/simple_mud | src/training_handler.py | 3,221 | Python |
class DataGridViewAutoSizeColumnMode(Enum,IComparable,IFormattable,IConvertible):
"""
Defines values for specifying how the width of a column is adjusted.
enum DataGridViewAutoSizeColumnMode,values: AllCells (6),AllCellsExceptHeader (4),ColumnHeader (2),DisplayedCells (10),DisplayedCellsExceptHeader (8),Fill... | 31.227273 | 215 | 0.703057 | [
"MIT"
] | tranconbv/ironpython-stubs | release/stubs.min/System/Windows/Forms/__init___parts/DataGridViewAutoSizeColumnMode.py | 1,374 | Python |
import pytest
from importtime_output_wrapper import Import
from importtime_output_wrapper import parse_import_time
from importtime_output_wrapper import InvalidInput
imp_a0 = Import(name="a0", t_self=4, t_cumu=5, depth=2, childs=[])
imp_a1 = Import(name="a1", t_self=3, t_cumu=4, depth=2, childs=[])
imp_b0 = Import(n... | 34.580645 | 88 | 0.731343 | [
"MIT"
] | Victor333Huesca/importtime-output-wrapper | tests/test_parse_import_time.py | 1,072 | Python |
import contextlib
import os
import sys
import tracemalloc
import unittest
from unittest.mock import patch
from test.support.script_helper import (assert_python_ok, assert_python_failure,
interpreter_requires_environment)
from test import support
try:
import threading
except I... | 36.408451 | 104 | 0.593645 | [
"MIT"
] | BrainSpawnInfosphere/raspbian_pkgs | python3/Python-3.6.1/Lib/test/test_tracemalloc.py | 36,190 | Python |
# Copyright 2020 Division of Medical Image Computing, German Cancer Research Center (DKFZ), Heidelberg, Germany
#
# 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://w... | 59.735849 | 134 | 0.609128 | [
"Apache-2.0"
] | ADVasculatureProject/nnUNet | nnunet/training/network_training/nnUNet_variants/architectural_variants/nnUNetTrainerV2_ResencUNet.py | 6,332 | Python |
# Add comments to explain what the output from this program will be and how you know.
def math1():
num1 = 50
num2 = 5
return num1 + num2
def math2():
num1 = 50
num2 = 5
return num1 - num2
def math3():
num1 = 50
num2 = 5
return num1 * num2
output_num = math2()
print(output_num)
'''
Add pr... | 15.461538 | 85 | 0.639303 | [
"Apache-2.0"
] | Athenian-ComputerScience-Fall2020/functions-practice-21lsparks | return_practice.py | 402 | Python |
#!/usr/bin/python
#
# A library for finding the optimal dirichlet prior from counts
# By: Max Sklar
# @maxsklar
# https://github.com/maxsklar
# Copyright 2013 Max Sklar
import math
import logging
import random
import scipy.special as mathExtra
import scipy
import numpy as np
def digamma(x): return mathExtra.psi(x)
d... | 30.164021 | 107 | 0.695141 | [
"BSD-3-Clause"
] | davesean/modular_semantic_segmentation | xview/models/dirichletEstimation.py | 5,701 | Python |
#!/usr/bin/env python3
import unittest
import networkit as nk
class TestReachability(unittest.TestCase):
def testReachableNodes(self):
for directed in [False, True]:
for exact in [False, True]:
g = nk.generators.ErdosRenyiGenerator(100, 0.01, directed).generate()
rn = nk.reachability.ReachableNodes(g, ... | 30.833333 | 75 | 0.709459 | [
"MIT"
] | CxVercility/networkit | networkit/test/test_reachability.py | 740 | Python |
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed unde... | 38.07906 | 79 | 0.537287 | [
"Apache-2.0"
] | BoTranVan/senlin | senlin/tests/unit/profiles/test_nova_server_validate.py | 35,642 | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.