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 env import lineFollower
from stable_baselines import PPO2
import imageio
import numpy as np
# Load separate environment for evaluation
env = lineFollower()
# load model
model = PPO2.load("model_final.zip")
# Store image
images = []
# Set environment and get image
obs = env.reset()
images.append(obs)
done =... | 22.777778 | 102 | 0.730081 | [
"MIT"
] | MajesticKhan/Reinforcement-Learning | Simulation/play.py | 615 | Python |
from flask import json
from authlib.common.urls import urlparse, url_decode
from authlib.oauth2.rfc6749 import grants
from authlib.oauth2.rfc7636 import (
CodeChallenge as _CodeChallenge,
create_s256_code_challenge,
)
from .models import db, User, Client
from .models import CodeGrantMixin, generate_authorizatio... | 36.697115 | 76 | 0.62256 | [
"BSD-3-Clause"
] | AngelLiang/hacking-authlib | tests/flask/test_oauth2/test_code_challenge.py | 7,633 | Python |
#!/usr/bin/env python
"""
Matplotlib provides sophisticated date plotting capabilities, standing on the
shoulders of python :mod:`datetime`, the add-on modules :mod:`pytz` and
:mod:`dateutil`. :class:`datetime` objects are converted to floating point
numbers which represent time in days since 0001-01-01 UTC, plus 1. ... | 33.547876 | 79 | 0.600397 | [
"MIT"
] | rbalda/neural_ocr | env/lib/python2.7/site-packages/matplotlib/dates.py | 52,905 | Python |
# coding=utf-8
# Copyright 2022 The Google Research Authors.
#
# 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 applicab... | 37.465567 | 88 | 0.682502 | [
"Apache-2.0"
] | AI21212019/google-research | widget_caption/widget_caption_model.py | 38,627 | Python |
from django.apps import AppConfig
class AppNameConfig(AppConfig):
name = "backend"
verbose_name = "ToDo List"
| 17.142857 | 33 | 0.725 | [
"Apache-2.0"
] | AlekseyLobanov/django-todo | backend/backend/apps.py | 120 | Python |
import models
import serializers
from rest_framework import viewsets, permissions
class apiViewSet(viewsets.ModelViewSet):
"""ViewSet for the api class"""
queryset = models.api.objects.all()
serializer_class = serializers.apiSerializer
permission_classes = [permissions.IsAuthenticated]
| 22 | 54 | 0.775974 | [
"Apache-2.0"
] | mainecivichackday/invman | api_invman/api.py | 308 | Python |
from urllib.parse import quote
from django import template
register = template.Library()
@register.simple_tag
def pie_chart(items, width=440, height=190):
return '//chart.googleapis.com/chart?cht=p3&chd=t:{0}&chs={1}x{2}&chl={3}'.format(
quote(','.join([str(item[1]) for item in items])),
width,
... | 25.0625 | 86 | 0.630923 | [
"BSD-2-Clause"
] | Django-AI/Django-Request | request/templatetags/request_admin.py | 401 | Python |
# Copyright 2016 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | 35.987032 | 80 | 0.66006 | [
"Apache-2.0"
] | AccelAI/tensorflow | tensorflow/python/util/deprecation_test.py | 24,975 | Python |
# # endpoints
import logging
from datetime import datetime
from dateutil.relativedelta import relativedelta
from django.contrib import messages
from django.contrib.auth.decorators import user_passes_test
from django.core.exceptions import PermissionDenied
from django.core.urlresolvers import reverse
from django.http i... | 38.609819 | 126 | 0.595703 | [
"BSD-3-Clause"
] | bend18/django-DefectDojo | dojo/endpoint/views.py | 14,942 | Python |
# Copyright Contributors to the Pyro project.
# SPDX-License-Identifier: Apache-2.0
import contextlib
import funsor
from funsor.adjoint import AdjointTape
from pyro.contrib.funsor import to_data, to_funsor
from pyro.contrib.funsor.handlers import enum, plate, replay, trace
from pyro.contrib.funsor.infer.elbo import ... | 44.625926 | 102 | 0.589675 | [
"Apache-2.0"
] | 1989Ryan/pyro | pyro/contrib/funsor/infer/traceenum_elbo.py | 12,049 | Python |
# -*- coding: utf-8 -*-
#
# Copyright 2020 - Swiss Data Science Center (SDSC)
# A partnership between École Polytechnique Fédérale de Lausanne (EPFL) and
# Eidgenössische Technische Hochschule Zürich (ETHZ).
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compli... | 26.932432 | 79 | 0.64275 | [
"Apache-2.0"
] | mohammad-sdsc/renku-python | tests/service/jobs/test_datasets.py | 9,970 | Python |
# specifically use concurrent.futures for threadsafety
# asyncio Futures cannot be used across threads
import asyncio
import json
import time
from functools import partial
from kubernetes_asyncio import watch
from traitlets import Any
from traitlets import Bool
from traitlets import Dict
from traitlets import Int
from... | 36.949074 | 118 | 0.581631 | [
"BSD-3-Clause"
] | choldgraf/kubespawner | kubespawner/reflector.py | 15,962 | Python |
Hello World
typing something eles
| 8.75 | 21 | 0.828571 | [
"Apache-2.0"
] | mxracer409/pynet_testx | test_hello.py | 35 | Python |
# pylint: disable=line-too-long
from allennlp.data.dataset_readers.semantic_parsing.atis import AtisDatasetReader
from allennlp.data.dataset_readers.semantic_parsing.nlvr import NlvrDatasetReader
from allennlp.data.dataset_readers.semantic_parsing.wikitables import WikiTablesDatasetReader
from allennlp.data.dataset_rea... | 66.166667 | 106 | 0.899244 | [
"Apache-2.0"
] | asiddhant/taskonomy-nlp | allennlp/data/dataset_readers/semantic_parsing/__init__.py | 397 | Python |
a, b, c = map(int, input().split())
if(a > c and a > b):
if(b > c):
print(b)
else:
print(c)
elif(b > a and b > c):
if(a > c):
print(a)
else:
print(c)
else:
if(a > b):
print(a)
else:
print(b) | 15.470588 | 35 | 0.391635 | [
"MIT"
] | rayleighko/iceamericano | baekjoon/10817/Python.py | 263 | Python |
import sqlite3
from .login import login
lg = login()
class account():
def atualizarBanco(self, email, nome, senha, cidade, aniversario, sexo, visibilidade=1):
conn = sqlite3.connect('./database/project.db', check_same_thread=False)
c = conn.cursor()
idLogado = lg.verLogado()
c.exe... | 42.066667 | 235 | 0.651347 | [
"MIT"
] | danielbandeir/MyOwn | codesForDatabase/account.py | 631 | Python |
import numpy as np
from basicsr.archs.rrdbnet_arch import RRDBNet
from realesrgan.utils import RealESRGANer
def test_realesrganer():
# initialize with default model
restorer = RealESRGANer(
scale=4,
model_path='experiments/pretrained_models/RealESRGAN_x4plus.pth',
model=None,
... | 35.102273 | 97 | 0.573648 | [
"BSD-3-Clause"
] | 2917320323/Real-ESRGAN | tests/test_utils.py | 3,089 | Python |
from golem import actions
description = 'verify_title_contains action'
def test(data):
actions.navigate(data.env.url+'elements/')
actions.verify_title_contains('Elem')
try:
actions.verify_title_contains('incorrect title')
except Exception as e:
assert "expected title to contain 'incor... | 26.615385 | 73 | 0.719653 | [
"MIT"
] | kangchenwei/keyautotest2 | projects/golem_integration/tests/actions/verify_title_contains.py | 346 | Python |
title = "Ibis"
tagline = "A template engine for people who enjoy the simpler things in life."
version = "Version 3.2.0"
| 30 | 78 | 0.725 | [
"Unlicense"
] | dmulholl/ibis | docs/config.py | 120 | Python |
import unittest
from parameterized import parameterized as p
from solns.loggerRateLimiter.loggerRateLimiter import *
class UnitTest_LoggerRateLimiter(unittest.TestCase):
@p.expand([
[]
])
def test_naive(self):
pass
| 20.416667 | 55 | 0.722449 | [
"MIT"
] | zcemycl/algoTest | py/tests/testLoggerRateLimiter/test_LoggerRateLimiter.py | 245 | Python |
# Generated by Django 3.1.5 on 2021-02-18 23:09
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('accounts', '0005_apirequestlog'),
]
operations = [
migrations.AlterModelOptions(
name='apirequestlog',
options={'verbose_nam... | 20.444444 | 63 | 0.61413 | [
"MIT"
] | MatthewTe/velkozz_web_api | velkozz_web_api/apps/accounts/migrations/0006_auto_20210218_2309.py | 368 | Python |
import geopy
# Here we just tested geopy functionality.
place = "kuusalu"
locator = geopy.Nominatim(user_agent="myGeocoder")
location = locator.geocode(place)
print(place + ":")
print("Latitude = {}, Longitude = {}".format(location.latitude, location.longitude))
| 26.5 | 84 | 0.739623 | [
"MIT"
] | screaminglordbyron/IDS-project | Koordinaator.py | 265 | Python |
#!/usr/bin/python3.6
import sys
import re
import csv
import numpy as np
import pandas as pd
import string
import nltk
from nltk.corpus import stopwords
import textcleaner as tc
def main(separator='\t'):
# input comes from STDIN (standard input)
topWords_list = ['club','baseball','league','team','game','socce... | 48.829545 | 144 | 0.518734 | [
"Apache-2.0"
] | vishalgawade/Data-Aggregation-Big-Data-Analysis-and-Visualization-of-Twitter-New-York-Times-Common-Crawl | part3/Commoncrawl/Code/mapper_latest_coocureence_cc.py | 4,477 | Python |
# coding=utf-8
import os
from flask import jsonify
from lib._logging import logger
def gpio_info():
gpio_info = ['ERROR']
try:
gpio_info = os.popen("gpio readall|grep -v '\-\-\-'| grep -v 'Physical'|tr -s ' ' 2>/dev/null").read().replace('||', '|').splitlines()
except:
logger.error('Error ... | 27.928571 | 142 | 0.507673 | [
"Apache-2.0"
] | bcarroll/PiControl | lib/gpio_utils.py | 1,564 | Python |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time : 5/15/20 4:49 PM
# @File : grover.py
# qubit number=2
# total number=9
import cirq
import cirq.google as cg
from typing import Optional
import sys
from math import log2
import numpy as np
#thatsNoCode
from cirq.contrib.svg import SVGCircuit
# Symbols for ... | 27.596774 | 77 | 0.696084 | [
"BSD-3-Clause"
] | UCLA-SEAL/QDiff | data/p2DJ/New/R2/benchmark/startCirq85.py | 1,711 | Python |
from datetime import datetime
from infrastructure.cqrs.decorators.dtoclass import dtoclass
@dtoclass
class GetDataOperationJobListDto:
Id: int = None
JobId: int = None
DataOperationId: str = None
DataOperationName: str = None
Cron: str = None
StartDate: datetime = None
EndDate: datetime = ... | 25.277778 | 60 | 0.718681 | [
"MIT"
] | PythonDataIntegrator/pythondataintegrator | src/api/domain/operation/GetDataOperationJobList/GetDataOperationJobListDto.py | 455 | Python |
# -*- coding: utf-8 -*-
"""
Created on Mon Jan 8 21:45:27 2018
@author: pilla
"""
| 10.625 | 35 | 0.552941 | [
"BSD-2-Clause"
] | psnipiv/LicenseGenerator | LicenseGenerator/accounts/tests/__init__.py | 85 | Python |
from datetime import datetime
from integration_tests.utils import populate_mock_db_blocks
from src.models import Challenge, ChallengeType, User, UserBankAccount, UserChallenge
from src.queries.get_undisbursed_challenges import get_undisbursed_challenges
from src.utils.db_session import get_db
def setup_challenges(ap... | 30.790476 | 85 | 0.462264 | [
"Apache-2.0"
] | RahulBansal123/audius-protocol | discovery-provider/integration_tests/queries/test_undisbursed_challeges.py | 6,466 | Python |
from collections import OrderedDict
from models.base_model import BaseModel
from optimizers.radam import RAdam
import random
import torch
import torch.nn as nn
import torch.nn.functional as F
from sklearn.metrics import accuracy_score
import sys
class double_conv(nn.Module):
def __init__(self, in_ch, out_ch):
... | 29.769231 | 99 | 0.600689 | [
"MIT"
] | Semere-Gr/PyTorchProjectFramework | models/segmentation_model.py | 5,805 | Python |
def findMaxSubarraySum(l):
maxSum = l[0]
tempSum = l[0]
for i in range(len(l)):
tempSum = max(l[i], tempSum + l[i])
if maxSum < tempSum:
maxSum = tempSum
return maxSum
if __name__ == "__main__":
print(findMaxSubarraySum([-2, 3, 4, 2]))
| 19 | 45 | 0.526316 | [
"MIT"
] | itsvinayak/cosmos | code/kadanes.py | 304 | Python |
import warnings
import torch
import kornia
import numpy as np
class MetricMAD:
def __call__(self, pred, true):
return (pred - true).abs_().mean() * 1e3
class MetricBgrMAD:
def __call__(self, pred, true):
bgr_mask = true == 0
return (pred[bgr_mask] - true[bgr_mask]).abs_().mean() * 1e... | 33.111111 | 121 | 0.608128 | [
"MIT"
] | ivandrej/checkmatte | evaluation/evaluation_metrics.py | 2,682 | Python |
"""Calculate the mean and standard deviation (per channel) over all images in a dataset
"""
# MIT License
#
# Copyright (c) 2017 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 Soft... | 53.125654 | 180 | 0.685129 | [
"MIT"
] | AifChain/deepface | src/generative/calculate_dataset_normalization.py | 10,147 | Python |
# -*- coding: utf-8 -*-
"""
The MIT License (MIT)
Copyright (c) 2015-2020 Rapptz
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 u... | 34.432203 | 79 | 0.630076 | [
"MIT"
] | Kenvyra/discord.py | discord/file.py | 4,063 | Python |
# Dependencies
import numpy as np
import pandas as pd
from sklearn.model_selection import train_test_split
from sklearn.preprocessing import MinMaxScaler
from sklearn.neighbors import KNeighborsClassifier
import pickle
def train_model():
# Read data set
spotify_df = pd.read_csv("spotify_data_v4.csv")
# Ex... | 34.883333 | 107 | 0.718586 | [
"MIT"
] | ealejo1/bigdata-machine-learning-challenge | model.py | 2,093 | Python |
import pdf_to_json as p2j
import json
url = "file:data/multilingual/Latn.BAN/Sans_8/udhr_Latn.BAN_Sans_8.pdf"
lConverter = p2j.pdf_to_json.pdf_to_json_converter()
lConverter.mImageHashOnly = True
lDict = lConverter.convert(url)
print(json.dumps(lDict, indent=4, ensure_ascii=False, sort_keys=True))
| 30.1 | 71 | 0.810631 | [
"BSD-3-Clause"
] | antoinecarme/pdf_to_json_tests | data/multilingual/Latn.BAN/Sans_8/pdf_to_json_test_Latn.BAN_Sans_8.py | 301 | Python |
# -*- coding: utf-8 -*-
# Copyright 2018 IBM and its contributors.
#
# 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 a... | 35.315789 | 79 | 0.665176 | [
"Apache-2.0"
] | ignaziopedone/qiskit-iqx-tutorials | utils/test/test_tutorials.py | 4,026 | Python |
# uncompyle6 version 3.2.4
# Python bytecode 2.7 (62211)
# Decompiled from: Python 2.7.15 (v2.7.15:ca079a3ea3, Apr 30 2018, 16:30:26) [MSC v.1500 64 bit (AMD64)]
# Embedded file name: lib.coginvasion.suit.SuitAttacks
from direct.directnotify.DirectNotifyGlobal import directNotify
from direct.interval.IntervalGlobal imp... | 38.614105 | 517 | 0.636905 | [
"Apache-2.0"
] | theclashingfritz/Cog-Invasion-Online-Dump | lib/coginvasion/suit/SuitAttacks.py | 48,731 | Python |
# Copyright 2013-2022 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 RaxmlNg(CMakePackage):
"""RAxML-NG is a phylogenetic tree inference tool which uses
ma... | 34.333333 | 74 | 0.703883 | [
"ECL-2.0",
"Apache-2.0",
"MIT-0",
"MIT"
] | Bambi/spack | var/spack/repos/builtin/packages/raxml-ng/package.py | 1,236 | Python |
"""
Afterglow Core: settings routes
"""
import secrets
import json
from flask import Response, request, redirect
from marshmallow.fields import Integer, String
from ...oauth2 import oauth_clients
from ... import app, json_response
from ...auth import auth_required, set_access_cookies
from ...resources.users import ... | 25.794872 | 119 | 0.739563 | [
"Apache-2.0"
] | SkynetRTN/afterglow-access-server | afterglow_core/views/ajax_api/oauth2_clients.py | 1,006 | Python |
from .base import * # noqa
from .base import env
# GENERAL
# ------------------------------------------------------------------------------
# https://docs.djangoproject.com/en/dev/ref/settings/#debug
DEBUG = True
# https://docs.djangoproject.com/en/dev/ref/settings/#secret-key
SECRET_KEY = env(
"DJANGO_SECRET_KEY... | 39.128571 | 101 | 0.58525 | [
"MIT"
] | ReddyLab/cegs-portal | config/settings/local.py | 2,739 | Python |
import threading
import time
import mpl_qtthread.backend
import matplotlib
import matplotlib.backends.backend_qt
import matplotlib.pyplot as plt
from matplotlib.backends.qt_compat import QtWidgets, QtCore
# set up the teleporter
mpl_qtthread.backend.initialize_qt_teleporter()
# tell Matplotlib to use this backend
mat... | 26.976471 | 87 | 0.66812 | [
"BSD-3-Clause"
] | tacaswell/mpl-qtthread | UAT.py | 2,295 | Python |
# -*- coding: utf-8 -*-
"""
SHT21 Sensor Plugin.
Return temperature and relative humidity from sensor readings.
Calculate and return absolute humidity and dew point.
Source for calculations:
http://www.vaisala.com/Vaisala%20Documents/Application%20notes/Humidity_Conversion_Formulas_B210973EN-F.pdf
"""
from __future_... | 26.408805 | 107 | 0.62634 | [
"MIT"
] | AmedeeBulle/collectd-python-plugins | sht21_usermode.py | 4,202 | Python |
from .models import *
from rest_framework import serializers
class THLIC_CertificateSerializer(serializers.ModelSerializer):
class Meta:
model = THLIC_Certificate
fields = '__all__'
class Teaching_portofolioSerializer(serializers.ModelSerializer):
class Meta:
model = Teachi... | 27.769231 | 66 | 0.717452 | [
"MIT"
] | iPelino/cst-research-api | teaching_activities/serializers.py | 361 | Python |
# Tests for client code in bin/test
| 18 | 35 | 0.75 | [
"Apache-2.0"
] | EHRI/resync | bin/test/__init__.py | 36 | Python |
import discord
from discord.ext import commands
class AttackStrats(commands.Cog):
def __init__(self, bot):
self.bot = bot
@commands.group()
async def strat(self, ctx):
if ctx.invoked_subcommand is None:
await ctx.send("You need to specify a townhall and strategy! Available... | 30.631579 | 696 | 0.663759 | [
"MIT"
] | Ay-355/the-buds-bot | cogs/attack_strats.py | 7,566 | Python |
# The followings are the DenseNets module, the training was actually taken place in the `run_dense_net.py` file.
# Sorry, I really like Pycharm (and to be fair, Pytorch is so much an easier language to debug)
import os
os.environ['CUDA_VISIBLE_DEVICES'] = '2'
from models import DenseNet
from data_providers.utils import... | 36.24898 | 144 | 0.660511 | [
"MIT"
] | stevenwudi/CarND-Traffic-Sign-Classifier-Project | test_single.py | 8,881 | Python |
#!/usr/bin/env python3
# Copyright (c) 2014-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.
# Exercise the listtransactions API
from test_framework.test_framework import SkyrusTestFramework
from t... | 49.839024 | 113 | 0.598708 | [
"MIT"
] | VangYangPao/skyrus | qa/rpc-tests/listtransactions.py | 10,217 | Python |
import warnings
from importlib import import_module
from django.conf import settings
from pretalx.orga.signals import nav_event, nav_event_settings, nav_global
SessionStore = import_module(settings.SESSION_ENGINE).SessionStore
def collect_signal(signal, kwargs):
result = []
for _, response in signal.send_r... | 33.706667 | 96 | 0.602848 | [
"Apache-2.0"
] | ThomasWaldmann/pretalx | src/pretalx/orga/context_processors.py | 2,528 | Python |
#! /usr/bin/env python
# coding=utf-8
#================================================================
# Copyright (C) 2018 * Ltd. All rights reserved.
#
# Editor : VIM
# File name : evaluate.py
# Author : YunYang1994
# Created date: 2018-12-20 11:58:21
# Description : compute mAP
#
#==========... | 37.219858 | 122 | 0.634527 | [
"MIT"
] | benoitLemoine/peopleCounting | detection/yolov3/src/evaluate.py | 5,248 | Python |
'''
For this exercise, you'll use what you've learned about the zip() function and combine two lists into a dictionary.
These lists are actually extracted from a bigger dataset file of world development indicators from the World Bank. For pedagogical purposes, we have pre-processed this dataset into the lists that you... | 44 | 219 | 0.795455 | [
"MIT"
] | Baidaly/datacamp-samples | 10 - python-data-science-toolbox-part-2/case_study/1 - dictionaries for data science.py | 704 | Python |
# -*- coding: utf-8 -*-
# file: data_utils.py
# author: songyouwei <youwei0314@gmail.com>
# Copyright (C) 2018. All Rights Reserved.
import os
import pickle
import numpy as np
import tqdm
from findfile import find_file
from google_drive_downloader.google_drive_downloader import GoogleDriveDownloader as gdd
from torch... | 38.661765 | 110 | 0.624572 | [
"MIT"
] | Descartes627/PyABSA | pyabsa/core/tc/classic/__bert__/dataset_utils/data_utils_for_training.py | 7,887 | Python |
from typing import Any, Dict, Optional
import lumos.numpy as lnp
from lumos.models.base import StateSpaceModel, state_space_io
from lumos.models.kinematics import TrackPosition2D
from lumos.models.vehicles.simple_vehicle import SimpleVehicle
# Combine the signals to create the names. TODO: can we make it more automa... | 34.113402 | 88 | 0.654881 | [
"MIT"
] | numagic/lumos | lumos/models/simple_vehicle_on_track.py | 3,309 | Python |
lst = [1,2,3,4,5]
prod = 1
for i in lst:
prod*= i
print("Product of digits in list is:",prod) | 14.142857 | 43 | 0.59596 | [
"MIT"
] | AnubhavMadhav/Learn-Python | 06 Control Statements/productoflist.py | 99 | Python |
from rando.core.models import JSONModel
class FeedbackCategory(JSONModel):
filepath = 'api/feedback/categories.json'
| 20.5 | 45 | 0.788618 | [
"BSD-2-Clause"
] | camillemonchicourt/Geotrek-rando | rando/feedback/models.py | 123 | Python |
# -*- coding: utf-8 -*-
import sys
import os
from sqlalchemy import Table
from yaml import load,dump
try:
from yaml import CSafeLoader as SafeLoader
except ImportError:
from yaml import SafeLoader
print("Using Python SafeLoader")
distribution={'twosome':1,'bubble':2}
effectcategory={}
def importyaml(connection,... | 51.864407 | 108 | 0.554248 | [
"MIT"
] | jayblunt/yamlloader | tableloader/tableFunctions/dogmaEffects.py | 3,060 | Python |
from django.urls import include, path
from rest_framework.routers import SimpleRouter
from grandchallenge.retina_api import views
app_name = "retina_api"
annotation_router = SimpleRouter()
annotation_router.register(
"singlepolygonannotation",
views.LegacySinglePolygonViewSet,
basename="singlepolygonanno... | 30.291262 | 126 | 0.684615 | [
"Apache-2.0"
] | MAHMOUDZAHERZORO/grand-challenge.org | app/grandchallenge/retina_api/urls.py | 3,120 | Python |
# coding: utf-8
"""
Mux Python - Copyright 2019 Mux Inc.
NOTE: This class is auto generated. Do not edit the class manually.
"""
from __future__ import absolute_import
import unittest
import mux_python
from mux_python.models.track import Track # noqa: E501
from mux_python.rest import ApiException
class TestTra... | 19.054054 | 79 | 0.676596 | [
"MIT"
] | dgiacomo/mux-python | test/test_track.py | 705 | Python |
import os
import sys
import psutil
from monk.keras_prototype import prototype
from monk.compare_prototype import compare
from monk.pip_unit_tests.keras.common import print_start
from monk.pip_unit_tests.keras.common import print_status
import tensorflow as tf
if(tf.__version__[0] == '2'):
import tensorflow.compa... | 29.16 | 80 | 0.651578 | [
"Apache-2.0"
] | Aanisha/monk_v1 | monk/pip_unit_tests/keras/test_layer_global_average_pooling2d.py | 1,458 | Python |
from typing import Any
from sqlalchemy.ext.declarative import as_declarative, declared_attr
@as_declarative()
class Base:
id: Any
__name__: str
# Generate __tablename__ automatically
@declared_attr
def __tablename__(cls) -> str:
return cls.__name__.lower()
def to_dict(self):
... | 20.454545 | 84 | 0.686667 | [
"MIT"
] | Ed-XCF/bali | bali/db/declarative.py | 450 | Python |
"""The tests for the State vacuum Mqtt platform."""
from copy import deepcopy
import json
from homeassistant.components import mqtt, vacuum
from homeassistant.components.mqtt import CONF_COMMAND_TOPIC, CONF_STATE_TOPIC
from homeassistant.components.mqtt.discovery import async_start
from homeassistant.components.mqtt.v... | 34.462541 | 88 | 0.675331 | [
"Apache-2.0"
] | FuqiangSong/home-assistant | tests/components/mqtt/test_state_vacuum.py | 21,160 | Python |
#--------------------------------------------------------------------------
#
# Copyright (c) Microsoft Corporation. All rights reserved.
#
# The MIT License (MIT)
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the ""Software""), t... | 34.639241 | 95 | 0.711858 | [
"MIT"
] | SanjayHukumRana/azure-sdk-for-python | sdk/core/azure-core/samples/test_example_sansio.py | 5,473 | Python |
#!/usr/bin/python
# -*- coding: utf-8 -*-
from __future__ import absolute_import, division, print_function
__metaclass__ = type
# Copyright (c) 2020-2021, Red Hat
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
# STARTREMOVE (downstream)
DOCUMENTATION = r'''
module: opens... | 33.052632 | 110 | 0.696717 | [
"Apache-2.0"
] | saeedya/docker-ansible | venv/lib/python3.8/site-packages/ansible_collections/community/okd/plugins/modules/openshift_process.py | 8,164 | Python |
#!/usr/bin/env python
"""continue play youtube video"""
import mac_youtube
def _cli():
mac_youtube.play()
if __name__ == "__main__":
_cli()
| 12.666667 | 33 | 0.657895 | [
"Unlicense"
] | andrewp-as-is/mac-youtube.py | mac_youtube/play.py | 152 | Python |
# -*- encoding: utf-8 -*-
import json
import importlib
import os
import builtins
from multiprocessing import Process
from importlib.util import find_spec
__all__=['run']
def run():
from utils.RedisHelper import RedisHelper
_redis=RedisHelper()
_redis.pubsub=_redis.conn.pubsub()
_redi... | 29.468354 | 111 | 0.530928 | [
"MIT"
] | Askr-ssy/r | commands/router.py | 2,424 | Python |
# MIT License
#
# Copyright (c) 2018-2019 Tskit Developers
# Copyright (c) 2015-2017 University of Oxford
#
# 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 with... | 40.776066 | 89 | 0.573297 | [
"MIT"
] | brianzhang01/tskit | python/tskit/drawing.py | 34,461 | Python |
import pytest
from shutil import copyfile
from shutil import copytree
import os
from cli.postman2robot import run as postman2robot
@pytest.fixture(scope="function")
def collection(tmpdir, request):
if request.param:
test_name = request.param
else:
test_name = request.node.name
filepath ... | 30.189873 | 92 | 0.672117 | [
"MIT"
] | xNok/postman2robotframework | test/test_cli_postman2robot.py | 2,385 | Python |
textSpeakDictionary = {
"rs" : "risos" ,
"tmb" : "também"
}
#imprime o dicionário inteiro
print( "Dicionário =" , textSpeakDictionary )
#imprime apenas o conteúdo relacionado à chave "rs"
print( "\nrs =" , textSpeakDictionary["rs"])
#texto que pede a entrada do usuário
key = input("\nO que você gostari... | 27.571429 | 53 | 0.670984 | [
"MIT"
] | daianasousa/Conversor-de-expressoes | Traduzindo_Palavras.py | 393 | Python |
from pygame import event
from albow.widgets.Control import Control
class CheckControl(Control):
def mouse_down(self, e: event):
self.value = not self.value
def get_highlighted(self):
return self.value
| 15.466667 | 41 | 0.698276 | [
"MIT"
] | hasii2011/albow-python-3 | albow/widgets/CheckControl.py | 232 | Python |
#!/usr/bin/python
# -*- coding: utf-8 -*-
import time
import vcgencmd
from gpiozero import OutputDevice
# IMPORTANT: maximum temperature is 85°C and cpu throttled at 80°C
ON_THRESHOLD = 70 # (degrees Celsius) fan starts at this temperature
OFF_THRESHOLD = 60 # (degrees Celsius) fan shuts down at this temperature
SLE... | 26.424242 | 73 | 0.673165 | [
"MIT"
] | olivierbenard/raspberrypi-fan-controller | src/fancontroller.py | 874 | Python |
"""
"""
import snowmobile
sn = snowmobile.connect(delay=True)
sn.alive # > False
type(sn.con) # > NoneType
type(sn.cfg) # > snowmobile.core.configuration.Configuration
str(sn.cfg) # > snowmobile.Configuration('snowmobile.toml')
print(sn.cfg.location) # > /path/to/your/snowmobile.toml
sn.cfg.connection.default... | 27.404762 | 86 | 0.711555 | [
"MIT"
] | GEM7318/Snowmobile | docs/snippets/configuration.py | 1,151 | Python |
import os
import sys
import numpy as np
import torch
import pickle
import logging
log = logging.getLogger(__name__)
logging.basicConfig(
format="%(asctime)s - %(levelname)s - %(name)s - %(message)s",
datefmt="%m/%d/%Y %H:%M:%S",
level=logging.INFO
)
class Graph4D():
def __init__(self, num_envs=4096... | 37.528409 | 144 | 0.543679 | [
"Apache-2.0"
] | Victorwz/Generative-Hippocampal-entorhinal-System | generate.py | 6,605 | Python |
def _zero_one_validator(x, function):
message = function + " must be a float between zero and one"
if x < 0.0 or x > 1.0:
raise ValueError(message)
return x
def _intenger_validator(x, function):
message = function + " must be positive intenger"
if isinstance(x, int) and x > 0:
ret... | 30.642857 | 132 | 0.650932 | [
"MIT"
] | arubiales/scikit-route | skroute/_validators/_validators.py | 1,716 | Python |
######################################################################################
#FSSNet: Fast Semantic Segmentation for Scene Perception
#Paper-Link: https://ieeexplore.ieee.org/stamp/stamp.jsp?tp=&arnumber=8392426
######################################################################################
import to... | 39.71 | 128 | 0.629396 | [
"MIT"
] | Abdul-Nasir11/Efficient-Segmentation-Networks | model/FSSNet.py | 11,913 | Python |
# -*- coding: utf-8 -*-
# *****************************************************************************
#
# 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/l... | 35.265306 | 107 | 0.567626 | [
"Apache-2.0"
] | altendky/jpype | setupext/build_ext.py | 12,096 | Python |
"""Policy compliance
This checks that recipes are in accordance with policy (as far as it
can be mechanically checked).
"""
import glob
import os
from . import LintCheck, ERROR, WARNING, INFO
from bioconda_utils import utils
class uses_vcs_url(LintCheck):
"""The recipe downloads source from a VCS
Please b... | 32.095238 | 86 | 0.669387 | [
"MIT"
] | JING-XINXING/bioconda-utils | bioconda_utils/lint/check_policy.py | 4,044 | Python |
import numpy as np
from gym import utils
from gym.envs.mujoco import mujoco_env
class EpisodeHopperEnv(mujoco_env.MujocoEnv, utils.EzPickle):
def __init__(self):
self.t = 0
self.r = 0
mujoco_env.MujocoEnv.__init__(self, 'hopper.xml', 4)
utils.EzPickle.__init__(self)
def step(se... | 32.735849 | 96 | 0.564841 | [
"MIT"
] | daochenzha/rapid | rapid/mujoco_envs/episode_hopper.py | 1,735 | Python |
# Copyright (c) 2012 Rackspace Hosting
# All Rights Reserved.
# Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
# Copyright 2013 Red Hat, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");... | 43.981084 | 79 | 0.608239 | [
"Apache-2.0"
] | Metaswitch/calico-nova | nova/cells/messaging.py | 86,027 | Python |
from os import getenv
from typing import Optional, Dict
from flask import Flask
TestConfig = Optional[Dict[str, bool]]
def create_app(test_config: TestConfig = None) -> Flask:
""" App factory method to initialize the application with given configuration """
app: Flask = Flask(__name__)
if test_config ... | 32.34375 | 97 | 0.672464 | [
"MIT"
] | gsjay980/data-science-IP | my_hello_world_app/web_api/router.py | 1,035 | Python |
# Copyright David Abrahams 2004. Distributed under 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)
# This regression test checks that call_method<T>(...) where T is a
# non-reference, non-pointer type that happens to be held inside the... | 30.833333 | 71 | 0.742342 | [
"BSD-3-Clause"
] | 0xDEC0DE8/mcsema | boost/libs/python/test/ben_scott1.py | 555 | Python |
from PPPForgivenessSDK.client import Client
# to run file 'delete_forgiveness_request.py', use valid token and a slug associated with a valid forgiveness request
client = Client(
access_token='{{YOUR_TOKEN_HERE}}',
vendor_key='{{YOUR_VENDOR_KEY}}',
environment='sandbox'
)
forgiveness_api = client.forgiven... | 28 | 117 | 0.732143 | [
"BSD-3-Clause"
] | UsSbaPPP/sba-python-client | examples/delete_forgiveness_request.py | 560 | Python |
from vision_backend.models import Classifier
def deploy_request_json_as_strings(job):
"""
Get a string list representing a deploy job's request JSON.
"""
request_json = job.request_json
classifier_id = request_json['classifier_id']
try:
classifier = Classifier.objects.get(pk=classifier... | 32.681818 | 79 | 0.668985 | [
"BSD-2-Clause"
] | beijbom/coralnet | project/vision_backend_api/utils.py | 719 | Python |
#!/usr/bin/env python
"""Django's command-line utility for administrative tasks."""
import os
import sys
def main():
"""Run administrative tasks."""
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'scrapmart.settings')
try:
from django.core.management import execute_from_command_line
... | 29.869565 | 74 | 0.657933 | [
"MIT"
] | vivekx01/oldscrapmart | manage.py | 687 | Python |
import os
import pickle
import argparse
import numpy as np
from numpy import array as npa
from IPython import embed
def create_argparse():
parser = argparse.ArgumentParser(description='compare')
parser.add_argument('src', type=str)
parser.add_argument('dst', type=str)
parser.add_argument('--box_fracs_... | 40.155556 | 139 | 0.586054 | [
"MIT"
] | voidrank/SaccadeNet | src/compare_tool.py | 1,807 | Python |
import requests
def hello():
response = requests.get('http://weather.livedoor.com/forecast/webservice/json/v1?city=130010')
weather = response.json()["forecasts"][0]["telop"]
return 'Hello, the weather in tokyo today is ' + weather
| 29.625 | 95 | 0.729958 | [
"MIT"
] | teramonagi/sandbox-package-python | sandbox_package_python/hello.py | 237 | Python |
#!/usr/bin/python
# -*- encoding: utf-8 -*-
from logger import setup_logger
from models.model_stages import BiSeNet
from cityscapes import CityScapes
from loss.loss import OhemCELoss
from loss.detail_loss import DetailAggregateLoss
from evaluation import MscEvalV0
from optimizer_loss import Optimizer
import torch
impo... | 32.786885 | 98 | 0.551714 | [
"MIT"
] | Toby-SZZ/STDC-Seg | train.py | 14,000 | Python |
# Copyright 2019 FairwindsOps 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 agreed to in writ... | 34.525424 | 115 | 0.71134 | [
"Apache-2.0"
] | CroudTech/reckoner | reckoner/yaml/handler.py | 2,037 | Python |
from pathlib import Path
from typing import Union
import pandas as pd
from .convention import COLUMN_NAMES
from .table_map import table_map_read
def open(table_file: str, table_map_file: str = None) -> pd.DataFrame:
"""
Opens a dynamo table file, returning a DynamoTable object
:param table_file:
:re... | 31.527132 | 103 | 0.674945 | [
"BSD-3-Clause"
] | brisvag/dynamotable | dynamotable/dynamotable.py | 4,067 | Python |
# Copyright 2019 Atalaya Tech, 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 agreed to in writing, ... | 39.243243 | 80 | 0.769284 | [
"Apache-2.0"
] | AnvithaGadagi/BentoML | bentoml/yatai/repository/__init__.py | 1,452 | Python |
#!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates.
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
from parlai.core.worlds import create_task
from parlai.agents.fixed_response.fixed_response import FixedResponseAgent
fr... | 37.138614 | 88 | 0.659557 | [
"MIT"
] | 189569400/ParlAI | parlai/tasks/convai2/worlds.py | 3,751 | Python |
#! /usr/bin/env python3
# This was forked from https://github.com/rustyrussell/lightning-payencode/tree/acc16ec13a3fa1dc16c07af6ec67c261bd8aff23
import re
import time
from hashlib import sha256
from binascii import hexlify
from decimal import Decimal
from typing import Optional, TYPE_CHECKING, Type
import random
impo... | 34.90613 | 197 | 0.590582 | [
"MIT"
] | Feathercoin-Applications/electrum-ftc | electrum/lnaddr.py | 18,221 | Python |
from time import sleep
from enos.message.downstream.tsl.MeasurepointGetReply import MeasurepointGetReply
from enos.message.downstream.tsl.MeasurepointGetCommand import MeasurepointGetCommand
from enos.message.downstream.tsl.MeasurepointSetReply import MeasurepointSetReply
from enos.core.MqttClient import MqttClient... | 43.053571 | 117 | 0.757362 | [
"MIT"
] | charleshuangcai/enos-device-sdk-python | enos/sample/CommandSample.py | 2,411 | Python |
# !/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Project: Azimuthal integration
# https://github.com/silx-kit/pyFAI
#
# Copyright (C) European Synchrotron Radiation Facility, Grenoble, France
#
# Principal author: Jérôme Kieffer (Jerome.Kieffer@ESRF.eu)
#
# Permission is hereby granted, fre... | 37.850575 | 99 | 0.6198 | [
"BSD-3-Clause"
] | michel4j/auto-process | autoprocess/utils/ellipse.py | 3,295 | Python |
"""
Slixmpp: The Slick XMPP Library
Copyright (C) 2010 Nathanael C. Fritz
This file is part of Slixmpp.
See the file LICENSE for copying permission.
"""
from slixmpp.plugins.base import register_plugin
from slixmpp.plugins.xep_0199.stanza import Ping
from slixmpp.plugins.xep_0199.ping import XEP_0199... | 21.8125 | 50 | 0.765043 | [
"BSD-3-Clause"
] | 0mp/slixmpp | slixmpp/plugins/xep_0199/__init__.py | 349 | Python |
# This code is part of Qiskit.
#
# (C) Copyright IBM 2017.
#
# This code is licensed under the Apache License, Version 2.0. You may
# obtain a copy of this license in the LICENSE.txt file in the root directory
# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0.
#
# Any modifications or derivative wo... | 31.278846 | 99 | 0.498156 | [
"Apache-2.0"
] | CatalinaAlbornoz/qiskit-terra | qiskit/circuit/library/standard_gates/rx.py | 6,665 | Python |
import random
from collections import defaultdict, deque
import logging
import operator as op
import time
from enum import unique, Flag
from functools import reduce
from BaseClasses import RegionType, Door, DoorType, Direction, Sector, CrystalBarrier
from Regions import key_only_locations
from Dungeons import hyrule_c... | 48.242465 | 168 | 0.642514 | [
"MIT"
] | oobitydoo/ALttPDoorRandomizer | DoorShuffle.py | 108,835 | Python |
""" info API method."""
from ibsng.handler.handler import Handler
class getAllGatewayNames(Handler):
""" info method class."""
def setup(self, **kwargs):
"""Setup required parameters.
:param dict kwargs: input args
:return: void
:rtype: void
"""
for key, valu... | 21.055556 | 41 | 0.583113 | [
"MIT"
] | ParspooyeshFanavar/pyibsng | ibsng/handler/online_payment/get_all_gateway_names.py | 379 | 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 ... | 43 | 133 | 0.667774 | [
"MIT"
] | Sneezry/autorest.python | test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v3/aio/operations/_operation_group_two_operations.py | 6,321 | Python |
import pytest
from app.db import model, session_ctx
from app.util import exceptions
from app.server.routes import routes
from app.server.requestutils import *
import flask
import flask.testing
def test_pubsubify_excs(fake_import: model.Import, client_with_modifiable_routes: flask.testing.FlaskClient):
client = ... | 32.30303 | 109 | 0.737336 | [
"BSD-3-Clause"
] | broadinstitute/import-service | app/tests/test_requestutils.py | 1,066 | Python |
def repl(elt, req, eq):
r = req.copy()
q = r[elt] // eq['qte']
if r[elt] % eq['qte'] != 0: q += 1
for i in eq['inp']:
if i not in r: r[i] = 0
r[i] += q * eq['inp'][i]
r[elt] -= q * eq['qte']
return r
def optimize(need, dest, eqs):
req = need.copy()
while any(req[i] > 0... | 21.344828 | 61 | 0.474152 | [
"MIT"
] | OpesMentis/AdventOfCode_2019 | day14.py | 1,238 | Python |
from django import forms
from .models import Produto
class ProdutoForm(forms.ModelForm):
class Meta:
model = Produto
fields = '__all__'
| 15.9 | 35 | 0.679245 | [
"MIT"
] | jonathan-mothe/estoque | produto/forms.py | 159 | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.