code stringlengths 3 1.05M | repo_name stringlengths 5 104 | path stringlengths 4 251 | language stringclasses 1
value | license stringclasses 15
values | size int64 3 1.05M |
|---|---|---|---|---|---|
"""Utilities to load and cache data."""
import os
from typing import Callable, Dict
import numpy as np
from transformers import EvalPrediction
from transformers import glue_compute_metrics, glue_output_modes
def build_compute_metrics_fn(
task_name: str) -> Callable[[EvalPrediction], Dict]:
"""Function fr... | pcmoritz/ray-1 | python/ray/tune/examples/pbt_transformers/utils.py | Python | apache-2.0 | 1,565 |
# -*- coding: utf-8 -*-
"""
Copyright 2006-2011 SpringSource (http://springsource.com), 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/... | ktan2020/legacy-automation | win/Lib/site-packages/springpython-1.3.0.RC1-py2.7.egg/springpython/remoting/http.py | Python | mit | 2,600 |
# -*- coding: utf-8 -*-
#
# Kate/Pâté color plugins
# Copyright 2013 by Alex Turbov <i.zaufi@gmail.com>
# Copyright 2013 by Phil Schaf
#
#
# This software is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation,... | DickJ/kate | addons/pate/src/plugins/color_tools.py | Python | lgpl-2.1 | 18,856 |
# -*- coding: utf-8 -*-
import os
import MySQLdb
from lib import easysql
from lib import tunnelCore
import httplib
import urllib
import pprint
import json
import datetime
import types
import os.path
import logging
import threading
import multiprocessing
#1.get server basic info from sys_server_basic
#2.https call fr... | hackshel/metaCollecter | src/metaTunnelCenter/branch/patch2.py | Python | bsd-3-clause | 20,295 |
# -*- coding: utf-8 -*-
import ecdsa
from .models import User, Exp, Device, Profile, Result
from .helpers import APITestCase, sha256hex, iso8601
# TODO: add CORS test
# TODO: test auth profile
class ResultsTestCase(APITestCase):
def setUp(self):
super(ResultsTestCase, self).setUp()
# Some us... | science-en-poche/yelandur | yelandur/test_results.py | Python | gpl-3.0 | 48,899 |
import os
import stat
import unittest
from django.core.management import call_command, CommandError
from django.core.management.utils import find_command
from django.test import SimpleTestCase
from django.test import override_settings
from django.utils import translation
from django.utils._os import upath
from django.... | liavkoren/djangoDev | tests/i18n/test_compilation.py | Python | bsd-3-clause | 4,924 |
"""
SALTS XBMC Addon
Copyright (C) 2014 tknorris
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
T... | JamesLinEngineer/RKMC | addons/plugin.video.salts/scrapers/mintmovies_scraper.py | Python | gpl-2.0 | 5,440 |
"""
Asciimatics is a package to help people create full-screen text UIs (from interactive forms to
ASCII animations) on any platform. It is licensed under the Apache Software Foundation License 2.0.
"""
__author__ = 'Peter Brittain'
try:
from .version import version
except ImportError:
# Someone is running st... | peterbrittain/asciimatics | asciimatics/__init__.py | Python | apache-2.0 | 414 |
"""Routine for decoding the CIFAR-10 binary file format."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import tensorflow.python.platform
import tensorflow as tf
def read_cifar10(filename_queue):
"""Reads and parses examples from CIFAR10 data file... | dnlcrl/TensorFlow-Playground | 1.tutorials/4.Convolutional Neural Networks/cifar10_input.py | Python | mit | 2,752 |
"""Support for HERE travel time sensors."""
from datetime import datetime, timedelta
import logging
from typing import Callable, Dict, Optional, Union
import herepy
import voluptuous as vol
from homeassistant.components.sensor import PLATFORM_SCHEMA
from homeassistant.const import (
ATTR_ATTRIBUTION,
ATTR_LAT... | turbokongen/home-assistant | homeassistant/components/here_travel_time/sensor.py | Python | apache-2.0 | 18,064 |
from django.db import models
from django.utils import timezone
class WikithonQuerySet(models.QuerySet):
def announced(self):
now = timezone.now()
return self.filter(announcement_date__lte=now) | \
self.filter(announcement_date__isnull=True)
| osamak/wikiproject-med | wikithons/managers.py | Python | agpl-3.0 | 277 |
import uuid
import yaml
from ..core.Processor import Processor
from ..core.InputPort import InputPort
from ..core.Funnel import Funnel
class Minifi_flow_yaml_serializer:
def serialize(self, start_nodes):
res = None
visited = None
for node in start_nodes:
res, visited = self.s... | dtrodrigues/nifi-minifi-cpp | docker/test/integration/minifi/flow_serialization/Minifi_flow_yaml_serializer.py | Python | apache-2.0 | 4,908 |
#
# Implementation of elliptic curves, for cryptographic applications.
#
# This module doesn't provide any way to choose a random elliptic
# curve, nor to verify that an elliptic curve was chosen randomly,
# because one can simply use NIST's standard curves.
#
# Notes from X9.62-1998 (draft):
# Nomenclature:
# -... | stafur/pyTRUST | pycoin/pycoin/ecdsa/ellipticcurve.py | Python | apache-2.0 | 8,528 |
"""Sensor for Last.fm account status."""
import logging
import re
import voluptuous as vol
from homeassistant.components.sensor import PLATFORM_SCHEMA
from homeassistant.const import CONF_API_KEY, ATTR_ATTRIBUTION
import homeassistant.helpers.config_validation as cv
from homeassistant.helpers.entity import Entity
_L... | Cinntax/home-assistant | homeassistant/components/lastfm/sensor.py | Python | apache-2.0 | 3,318 |
#! PsiAPI pubchem access
import psi4
hartree2ev = psi4.constants.hartree2ev
psi4.set_output_file("output.dat", False)
benz = psi4.geometry("""
pubchem:benzene
""")
psi4.set_options({"REFERENCE" : "RHF",
"MAX_ENERGY_G_CONVERGENCE" : 8,
"BASIS" ... | CDSherrill/psi4 | tests/python/pubchem/input.py | Python | lgpl-3.0 | 1,449 |
# -*- coding: utf-8 -*-
from __future__ import (absolute_import, division, print_function)
from sympy import log, exp, Symbol, Pow, sin
from sympy.printing.ccode import ccode
from sympy.codegen.cfunctions import log2, exp2, expm1, log1p
from sympy.codegen.rewriting import (
optimize, log2_opt, exp2_opt, expm1_opt,... | wxgeo/geophar | wxgeometrie/sympy/codegen/tests/test_rewriting.py | Python | gpl-2.0 | 4,843 |
# coding=utf-8
from tests.data import add_fixtures, aircraft_models
def test_list_empty(db_session, client):
res = client.get('/aircraft-models')
assert res.status_code == 200
assert res.json == {
'models': [],
}
def test_list(db_session, client):
nimeta = aircraft_models.nimeta()
as... | Turbo87/skylines | tests/api/views/aircraft_models/list_test.py | Python | agpl-3.0 | 1,487 |
"""
Test for assets cleanup of courses for Mac OS metadata files (with filename ".DS_Store"
or with filename which starts with "._")
"""
from django.core.management import call_command
from opaque_keys.edx.locations import SlashSeparatedCourseKey
from xmodule.contentstore.content import XASSET_LOCATION_TAG
from xmodul... | mtlchun/edx | cms/djangoapps/contentstore/management/commands/tests/test_cleanup_assets.py | Python | agpl-3.0 | 3,407 |
# -*- coding: utf-8 -*- vim:fileencoding=utf-8:
# vim: tabstop=4:shiftwidth=4:softtabstop=4:expandtab
# Copyright © 2010-2012 Greek Research and Technology Network (GRNET S.A.)
#
# Permission to use, copy, modify, and/or distribute this software for any
# purpose with or without fee is hereby granted, provided that th... | apoikos/servermon | hwdoc/management/commands/hwdoc_add_user.py | Python | isc | 2,259 |
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | zhouyao1994/incubator-superset | superset/migrations/versions/c2acd2cf3df2_alter_type_of_dbs_encrypted_extra.py | Python | apache-2.0 | 2,049 |
# Copyright (c) Twisted Matrix Laboratories.
# See LICENSE for details.
"""
Copyright information for Twisted.
"""
from __future__ import division, absolute_import
__all__ = ['copyright', 'disclaimer', 'longversion' ,'version']
from twisted import __version__ as version, version as longversion
longversion = str(lo... | bdh1011/wau | venv/lib/python2.7/site-packages/twisted/copyright.py | Python | mit | 1,531 |
import re
class EffectGroup:
INDEX_EFFECT_NUMBER = 0
INDEX_EFFECT_DATA = 1
def __init__(self,totalLeds,time):
self.m_time = time
self.m_effects = {}
for i in range (0,totalLeds):
self.setLedEffect(i,-1,None)
#set time in text format, ex 00:01 010ms
def setTime(self,time):
self.m_time = time
def set... | xerond/lucia | ledEditor/effectgroup.py | Python | mit | 912 |
#!/usr/bin/env python
#
# A library that provides a Python interface to the Telegram Bot API
# Copyright (C) 2015-2017
# Leandro Toledo de Souza <devs@python-telegram-bot.org>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser Public License as published by
#... | thonkify/thonkify | src/lib/telegram/forcereply.py | Python | mit | 1,682 |
from collections import namedtuple
from corehq.apps.change_feed.consumer.feed import KafkaChangeFeed
from corehq.apps.change_feed.document_types import GROUP
from corehq.apps.groups.models import Group
from corehq.elastic import stream_es_query, get_es_new, ES_META
from corehq.pillows.mappings.user_mapping import USER_... | qedsoftware/commcare-hq | corehq/pillows/groups_to_user.py | Python | bsd-3-clause | 4,115 |
import os
from mock import patch
from unittest import TestCase
from typing import Any, Dict, List
from tools.linter_lib.custom_check import build_custom_checkers
from tools.linter_lib.custom_check import custom_check_file
ROOT_DIR = os.path.abspath(os.path.join(__file__, '..', '..', '..'))
CHECK_MESSAGE = "Fix the ... | mahim97/zulip | tools/tests/test_linter_custom_check.py | Python | apache-2.0 | 3,596 |
# Copyright 2013-2015 ARM 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 agreed to in w... | ARM-software/workload-automation | wa/workloads/glbenchmark/__init__.py | Python | apache-2.0 | 6,038 |
#!/usr/bin/env python3
# 556A_zeroes.py - Codeforces.com/problemset/problem/556/A Zeroes quiz by Sergey 2015
# Standard modules
import unittest
import sys
import re
# Additional modules
###############################################################################
# Zeroes Class
###################################... | snsokolov/contests | codeforces/556A_zeroes.py | Python | unlicense | 2,674 |
# -*- Mode:Python -*-
##########################################################################
# #
# This file is part of AVANGO. #
# ... | jakobharlan/avango | avango-utils/python/__init__.py | Python | lgpl-3.0 | 2,505 |
# Implementation of classic arcade game Pong
import simplegui
import random
# initialize globals - pos and vel encode vertical info for paddles
WIDTH = 600
HEIGHT = 400
BALL_RADIUS = 20
PAD_WIDTH = 8
PAD_HEIGHT = 80
HALF_PAD_WIDTH = PAD_WIDTH / 2
HALF_PAD_HEIGHT = PAD_HEIGHT / 2
player1_score = 0
... | pouletalunizado/python | pingpongmia.py | Python | gpl-3.0 | 5,222 |
def flatten(dictionary):
stack = [((), dictionary)]
result = {}
while stack:
path, current = stack.pop()
for k, v in current.items():
if isinstance(v, dict):
if len(v) == 0:
v[""] = ""
stack.append((path + (k,), v))
... | Oscarbralo/TopBlogCoder | Checkio/TheFlatDictionary.py | Python | mit | 788 |
import sys
from xml.sax import make_parser, handler
class categoryHandler(handler.ContentHandler):
def __init__(self):
self.document = None
self.in_importants = False
def startElement(self, name, attrs):
if name=="document":
self.document = Document(attrs)
if name==... | DavidGuben/rcbplayspokemon | app/pywin32-220/AutoDuck/document_object.py | Python | mit | 2,340 |
#
# @BEGIN LICENSE
#
# QCDB: quantum chemistry common driver and databases
#
# Copyright (c) 2011-2017 The QCDB Developers.
#
# The copyrights for code used from other parties are included in
# the corresponding files.
#
# This file is part of QCDB.
#
# QCDB is free software; you can redistribute it and/or modify
# it ... | loriab/qcdb | qcdb/libmintsmolecule.py | Python | lgpl-3.0 | 127,084 |
import os
mypath = os.path.abspath(os.path.dirname(__file__))
#print('hi from module titanic @ {:s}'.format(mypath))
#from .integral import *
| billzorn/fpunreal | titanfp/titanic/__init__.py | Python | mit | 144 |
import dj_database_url
import os
from .base import *
if os.getenv('HEROKU'):
DEBUG = False
DATABASES = {
'default': dj_database_url.config()
}
elif 'TRAVIS' in os.environ:
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql_psycopg2',
'NAME': 'tr... | andela-landia/adventures | adventures/adventures/settings/__init__.py | Python | mit | 738 |
# coding=utf-8
from django.conf import settings as gSettings #全局设置
#工具栏样式,可以添加任意多的模式
TOOLBARS_SETTINGS= {
"normal": ['title', 'bold', 'italic', 'underline', 'strikethrough', '|', 'ol', 'ul', 'blockquote', 'code', 'table', '|', 'link', 'image', 'hr', '|', 'indent', 'outdent'],
}
#允许上传的图片类型
UPLOAD_IMAGES_SETTINGS={... | Wizmann/DjangoSimditor | DjangoSimditor/settings.py | Python | mit | 1,596 |
if __name__ == '__main__':
s = input()
is_list = list(zip(*[[c.isalnum(), c.isalpha(), c.isdigit(), c.islower(), c.isupper()] for c in s]))
print_list = [True if True in is_result else False for is_result in is_list]
for result in print_list:
print(result)
| nifannn/HackerRank | Practice/Python/Strings/string_validators.py | Python | mit | 281 |
import Pyro4
import threading
import serpent
from node import Node
from resourcemanager import ResourceManager
from constant import Constant
import utils
import time
import signal
import sys
from operator import attrgetter
import random
stop = True
class GridScheduler(Node):
# list of jobs that waiting
job_q... | ardhipoetra/vgridscheduler-python | gridscheduler.py | Python | gpl-2.0 | 11,116 |
"""
Demonstrates how to use the blocking scheduler to schedule a job that executes on 3 second intervals.
"""
from datetime import datetime
import os
from apscheduler.schedulers.blocking import BlockingScheduler
def tick():
print('Tick! The time is: %s' % datetime.now())
if __name__ == '__main__':
schedul... | cychenyin/windmill | examples/schedulers/blocking.py | Python | mit | 569 |
# -*- coding: utf-8 -*-
##############################################################################
#
# Author: Nicolas Bessi
# Copyright 2013 Camptocamp SA
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# publi... | charbeljc/account-financial-tools | __unported__/async_move_line_importer/__openerp__.py | Python | agpl-3.0 | 2,453 |
from base import BaseDevice
from storages import HeatStorage, PowerMeter
class ThermalConsumer(BaseDevice):
"""This class represents the thermal consume of the house.
The demand is calculated by the necessary heating power and the required warm water.
The house parameters are read from the database and ca... | SEC-i/ecoControl | server/devices/consumers.py | Python | mit | 4,251 |
#!/usr/bin/env python
# Test whether a PUBLISH to a topic with QoS 2 results in the correct packet flow.
import subprocess
import socket
import time
import inspect, os, sys
# From http://stackoverflow.com/questions/279237/python-import-a-module-from-a-folder
cmd_subfolder = os.path.realpath(os.path.abspath(os.path.j... | jbreitbart/fast-lib | vendor/mosquitto-1.3.5/test/broker/03-publish-qos2.py | Python | lgpl-3.0 | 1,415 |
from django.http import QueryDict
from .utils import RequestTestCase
from ..templatetags import querystrings
class TestQuerystringUpdate(RequestTestCase):
def setUp(self):
"""Create a request and put some GET args in it."""
self.request = self.create_request()
self.request.GET = QueryDict... | incuna/incuna-pagination | pagination/tests/test_querystrings.py | Python | bsd-2-clause | 1,418 |
# Create your views here.
from django.http import HttpResponse, HttpResponseRedirect, HttpResponseForbidden
from django.template import RequestContext
from django.shortcuts import render_to_response, get_object_or_404
from django.contrib.auth import authenticate, login, logout
from forms import UserForm, TeamForm, Rati... | sleonr0792/twd | made_with_twd_project/showcase/views.py | Python | mit | 11,896 |
from flask_wtf import Form
from wtforms import PasswordField, StringField
from wtforms.validators import DataRequired, Email, EqualTo, Length
from .models import User
class RegisterForm(Form):
"""
Registration Form for new users.
"""
username = StringField('Username',
valid... | michaelrice/vBurgundy | vBurgundy/user/forms.py | Python | apache-2.0 | 1,679 |
"""taskorganizer URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.11/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
Cl... | andrewtcrooks/taskorganizer | config/urls.py | Python | mit | 876 |
# -*- coding: UTF-8 -*-
"""
``Trinotate``
-----------------------------------------------------------------
:Authors: Menachem Sklarz
:Affiliation: Bioinformatics core facility
:Organization: National Institute of Biotechnology in the Negev, Ben Gurion University.
A class that defines a module for RNA_seq assembly a... | bioinfo-core-BGU/neatseq-flow_modules | neatseq_flow_modules/RNA_seq/Trinotate_modules/Trinotate.py | Python | gpl-3.0 | 15,486 |
# -*- encoding: utf-8 -*-
"""
libpydhcpserver module: type_ipv4
Purpose
=======
Defines the libpydhcpserver-specific ipv4 type.
Legal
=====
This file is part of libpydhcpserver.
libpydhcpserver is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as publish... | nzjrs/staticdhcpd | src/libpydhcpserver/type_ipv4.py | Python | gpl-3.0 | 5,457 |
#!/usr/bin/env python
# Copyright 2017 ARC Centre of Excellence for Climate Systems Science
# author: Scott Wales <scott.wales@unimelb.edu.au>
#
# 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... | ScottWales/dmpr | test/test_dmpr.py | Python | apache-2.0 | 776 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('lexicon', '0037_auto_20160420_1501'),
]
operations = [
migrations.CreateModel(
name='SndComp',
field... | lingdb/CoBL-public | ielex/lexicon/migrations/0038_sndcomp.py | Python | bsd-2-clause | 1,114 |
from p2pool.bitcoin import networks
PARENT = networks.nets['asiccoin']
SHARE_PERIOD = 30 # seconds
CHAIN_LENGTH = 24*60*60//10 # shares
REAL_CHAIN_LENGTH = 24*60*60//10 # shares
TARGET_LOOKBEHIND = 200 # shares
SPREAD = 3 # blocks
IDENTIFIER = '2c80035c7a81bc6f'.decode('hex')
PREFIX = '2472ef181efcd37c'.decode('hex')
... | wojenny/THash | p2pool/networks/asiccoin.py | Python | gpl-3.0 | 682 |
try:
from django.conf.urls import *
except ImportError: # django < 1.4
from django.conf.urls.defaults import *
urlpatterns = patterns('authority.views',
url(r'^permission/add/(?P<app_label>[\w\-]+)/(?P<module_name>[\w\-]+)/(?P<pk>\d+)/$',
view='add_permission',
name="authority-add-permissi... | tloiret/django-authority | authority/urls.py | Python | bsd-3-clause | 1,089 |
from tkinter import messagebox, filedialog, colorchooser
from tkinter.simpledialog import askstring
from . import utilities as utils
import os.path
def warn(title, text, master=None):
"""
Display a warning message box.
:param string title:
The title to be displayed on the box.
:param string te... | lawsie/guizero | guizero/dialog.py | Python | bsd-3-clause | 5,714 |
#!/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.
from test_framework.test_framework import BitcoinTestFramework
from test_framework.util import (start_nod... | DigiByte-Team/digibyte | qa/rpc-tests/import-rescan.py | Python | mit | 7,009 |
from django.shortcuts import render
from django.contrib.auth.mixins import LoginRequiredMixin
from django.views.generic import ListView
from .models import Team
class TeamListView(LoginRequiredMixin, ListView):
"""
View for displaying `Team`s where logged-in user is a member.
"""
model = Team
d... | patpatpatpatpat/digestus | updates/views.py | Python | bsd-3-clause | 388 |
"""
Base classes for writing management commands (named commands which can
be executed through ``django-admin.py`` or ``manage.py``).
"""
import os
import sys
from optparse import make_option, OptionParser
import traceback
import django
from django.core.exceptions import ImproperlyConfigured
from django.core.managem... | mammique/django | django/core/management/base.py | Python | bsd-3-clause | 15,801 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.1 on 2017-08-18 00:09
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
import django.views.generic.dates
import markdownx.models
import sorl.thumbnail.fields
class Migration(migrations.Migration):
... | cts-admin/cts | cts/members/migrations/0001_initial.py | Python | gpl-3.0 | 3,872 |
# vim: ft=python fileencoding=utf-8 sts=4 sw=4 et:
# Copyright 2016 Ryan Roden-Corrent (rcorre) <ryan@rcorre.net>
#
# This file is part of qutebrowser.
#
# qutebrowser is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foun... | shaggytwodope/qutebrowser | qutebrowser/misc/keyhintwidget.py | Python | gpl-3.0 | 4,348 |
from setuptools import setup
from catkin_pkg.python_setup import generate_distutils_setup
d = generate_distutils_setup(
packages=['scrimmage_ros'],
package_dir={'': 'src'}
)
setup(**d)
| SyllogismRXS/scrimmage_ros | setup.py | Python | lgpl-3.0 | 195 |
from math import radians
from rominet.commands import MoveStraight
from rominet.situation import Situation
def test_move_simple():
command = MoveStraight(1, 1, 0, 0)
s = Situation(0, 0, 0, 0, 0, 0, 0, 0, 0)
left, right = command.get_motor_speeds(s)
assert left == right
assert left > 0
def test_m... | gregleno/romi | tests/test_command_move_straight.py | Python | gpl-3.0 | 1,821 |
from tests.unit.dataactcore.factories.domain import OfficeFactory
from tests.unit.dataactcore.factories.staging import DetachedAwardFinancialAssistanceFactory
from tests.unit.dataactvalidator.utils import number_of_errors, query_columns
_FILE = 'fabs38_detached_award_financial_assistance_2_1'
def test_column_headers... | fedspendingtransparency/data-act-broker-backend | tests/unit/dataactvalidator/test_fabs38_detached_award_financial_assistance_2_1.py | Python | cc0-1.0 | 3,202 |
import os
import json
import time
import listenbrainz.webserver
from datetime import datetime, timezone
import listenbrainz.db.user as db_user
from listenbrainz.domain.spotify import Spotify, SpotifyAPIError, SpotifyInvalidGrantError
from listenbrainz.spotify_updater import spotify_read_listens
from listenbrainz.webs... | Freso/listenbrainz-server | listenbrainz/spotify_updater/tests/test_spotify_read_listens.py | Python | gpl-2.0 | 8,541 |
#!/usr/bin/env python
#
# Copyright 2001 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless require... | automeka/ninja | configure.py | Python | apache-2.0 | 22,610 |
#
# Copyright (c) 2013, Marc Tardif <marc@interunion.ca>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This prog... | cr3/jiraban | jiraban/testing/unique.py | Python | gpl-3.0 | 3,085 |
# This file is part of the Frescobaldi project, http://www.frescobaldi.org/
#
# Copyright (c) 2008 - 2014 by Wilbert Berendsen
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
... | anthonyfok/frescobaldi | frescobaldi_app/userguide/browser.py | Python | gpl-2.0 | 5,294 |
from django import forms
from django.core.urlresolvers import reverse
from django.forms.widgets import RadioFieldRenderer
from django.utils.encoding import force_text
from django.utils.html import format_html
from django.utils.safestring import mark_safe
class BootstrapChoiceFieldRenderer(RadioFieldRenderer):
"""... | alirizakeles/tendenci | tendenci/apps/events/widgets.py | Python | gpl-3.0 | 4,968 |
from matrix import MatrixFactory
import sys
def test(n=10):
""" Demo multiplication of two square matrices of given dimension 'n' """
print('Making two random square matrices of dimension',n,'...')
m1 = MatrixFactory.makeRandom(n, n)
m2 = MatrixFactory.makeRandom(n, n)
m3 = m1*m2
print(m3)
i... | pythonhacker/pyconindia2017concurrency | matrix/multiply.py | Python | mit | 415 |
import tensorflow as tf
import numpy as np
import gym
import random
from collections import deque
EPISDOE = 10000
STEP = 10000
ENV_NAME = 'MountainCar-v0'
BATCH_SIZE = 32
INIT_EPSILON = 1.0
FINAL_EPSILON = 0.1
REPLAY_SIZE = 50000
TRAIN_START_SIZE = 200
GAMMA = 0.9
def get_weights(shape):
weights = tf.truncated_nor... | wangyarui/deep-learning | Q-Learning/RLtest.py | Python | unlicense | 4,294 |
#! /usr/bin/env python
# encoding: utf-8
import os,shlex,sys,time
try:import cPickle
except ImportError:import pickle as cPickle
import Environment,Utils,Options,Logs
from Logs import warn
from Constants import*
try:
from urllib import request
except:
from urllib import urlopen
else:
urlopen=request.urlopen
conf_te... | landonb/hamster-applet | wafadmin/Configure.py | Python | gpl-3.0 | 8,914 |
# FIND LOSS INCREASES PY
# Brettin email 2019-12-18:
# Analysis 2: a list of validation samples,
# that when added to the training samples,
# cause the performance of the node/model to decrease.
import argparse, os, pickle, sys
from Node import Node
from utils import append, avg, fail
STAGE_ANY = 0
parser = argpa... | ECP-CANDLE/Supervisor | workflows/cp-leaveout/scripts/find-loss-increases.py | Python | mit | 3,688 |
# This library is free software; you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as
# published by the Free Software Foundation; either version 3 of the
# License, or (at your option) any later version.
#
# This library is distributed in the hope that it will be usefu... | obriencj/python-javatools | tests/distinfo.py | Python | lgpl-3.0 | 1,430 |
"""Define random number Type (`RandomStateType`) and Op (`RandomFunction`)."""
from __future__ import print_function
import sys
from copy import copy
import numpy
from six import string_types
from six.moves import reduce, xrange
# local imports
import theano
from theano import tensor
from theano.tensor import opt
fr... | marcsans/cnn-physics-perception | phy/lib/python2.7/site-packages/theano/tensor/raw_random.py | Python | mit | 39,010 |
import numpy
import matplotlib
from matplotlib import pylab, mlab, pyplot
from pylab import *
from numpy import *
from numpy.linalg import *
import scipy.linalg as sl # we need a generailzed eigen solver
class lead1D:
'A class for simple 1D leads'
def __init__(self,eps0=0,gamma=-1,**kwargs):
'We assum... | oroszl/mezo | mezo.py | Python | gpl-3.0 | 7,020 |
import datetime
import unittest
class Test_Assertions(unittest.TestCase):
def test_AlmostEqual(self):
self.assertAlmostEqual(1.00000001, 1.0)
self.assertNotAlmostEqual(1.0000001, 1.0)
self.assertRaises(self.failureException,
self.assertAlmostEqual, 1.0000001, 1.0... | MalloyPower/parsing-python | front-end/testsuite-python-lib/Python-2.7/Lib/unittest/test/test_assertions.py | Python | mit | 12,035 |
from .base import FunctionalTest
class LayoutAndStylingTest(FunctionalTest):
def test_layout_and_styling(self):
# Edith goes to the home page
self.browser.get(self.server_url)
self.browser.set_window_size(1024, 768)
# She notices the input box is nicely centered
inputbox =... | freddyiniguez/cimat_scrum_developer | superlists/functional_tests/test_layout_and_styling.py | Python | gpl-2.0 | 852 |
import os
from collections import OrderedDict
import six
from awscfncli2.config import CANNED_STACK_POLICIES, ConfigError
def normalize_value(v):
if isinstance(v, bool):
return 'true' if v else 'false'
elif isinstance(v, int):
return str(v)
else:
return v
def make_boto3_paramet... | Kotaimen/awscfncli | awscfncli2/runner/runbook/boto3_params.py | Python | mit | 3,506 |
from novaclient.v1_1.flavors import *
from novaclient.base import Manager
"""novaclient/v1_1/flavors/FlavorManager"""
class CustomeFlavorManager(FlavorManager):
def _data(self, url, response_key, obj_class=None, body=None):
if body:
_resp, body = self.api.client.post(url, body=body)
else:
_resp, body ... | khandavally/devstack | EPAQA/flavor_manager_patch.py | Python | apache-2.0 | 1,704 |
#-------------------------------------------------------------------------
# Copyright (c) Microsoft. 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.apa... | lmazuel/azure-sdk-for-python | azure-servicebus/azure/servicebus/_common_serialization.py | Python | mit | 18,799 |
# coding=utf-8
from slideatlas import models, security
from ..base import APIResource, ListAPIResource, ItemAPIResource
from ..blueprint import api
from ..common import abort
################################################################################
__all__ = ('ImageStoreListAPI',
'ImageStoreListImpo... | SlideAtlas/SlideAtlas-Server | slideatlas/api/v2/resources/image_store.py | Python | apache-2.0 | 3,921 |
import os
import requests
import simplejson as json
import settings as s
from boxviewerror import raise_for_view_error
DOCUMENTS_RESOURCE = '/documents'
SESSIONS_RESOURCE = '/sessions'
VIEW_RESOURCE = '/view'
PROCESSING = 'processing'
DONE = 'done'
def _set_token_from_env():
box_view_token = os.environ.get('BO... | seanrose/python-box-view | boxview.py | Python | apache-2.0 | 3,283 |
class SynthRule:
@property
def dna_size(self):
raise NotImplementedError()
@property
def result_size(self):
raise NotImplementedError()
def make_new_state(self):
return None
def encode(self, state, values, values_pos, body_part, rnd_strength):
raise NotImplemen... | unbornchikken/genevo-python | genevo/optimizers/synthesizer/synthrule.py | Python | apache-2.0 | 510 |
# ##### BEGIN GPL LICENSE BLOCK #####
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distrib... | cschenck/blender_sim | fluid_sim_deps/blender-2.69/2.69/scripts/startup/bl_ui/properties_freestyle.py | Python | gpl-3.0 | 26,955 |
# -*- coding: iso-8859-1 -*-
#------------------------------------------------------------
# seriesly - XBMC Plugin
# Conector para linkbucks
# http://blog.tvalacarta.info/plugin-xbmc/seriesly/
#------------------------------------------------------------
import re, sys
import urlparse, urllib, urllib2
from core impo... | conejoninja/xbmc-seriesly | servers/linkbucks.py | Python | gpl-3.0 | 2,043 |
"""
Kodi urlresolver plugin
Copyright (C) 2014 smokdpi
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.... | igor-rangel7l/igorrangelteste.repository | script.module.urlresolver/lib/urlresolver/plugins/googlevideo.py | Python | gpl-2.0 | 5,041 |
#!/usr/bin/env python
# Copyright 2017, LabN Consulting, L.L.C.
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# T... | freerangerouting/frr | tests/topotests/lib/lutil.py | Python | gpl-2.0 | 13,405 |
from Queue import Queue
from threading import Thread, Event
from multiprocessing import Process
from PyGLEngine.api import synthesize, getSortedByAttr, getClassName, BitTracker
from PyGLEngine.core import Base, BaseManager
#------------------------------------------------------------
#--------------------------------... | rocktavious/PyGLEngine | PyGLEngine/core/managers/systemmanager.py | Python | mit | 3,968 |
def rec_print(alist):
"""Print HackerShip or its parts if any number is %5 or %3"""
ln = len(alist)
mid = ln/2
if ln > 1:
left, right = alist[:mid], alist[mid:]
rec_print(left)
rec_print(right)
elif ln == 1:
#print alist
num5, num3 = alist[0]%5, alist[0]%3
if... | codecakes/random_games | recursive_print_numlist.py | Python | mit | 549 |
import numpy as np
import plotly.graph_objs as go
from plotly.offline import plot
from cea.plots.variable_naming import NAMING, LOGO, COLOR
import cea.plots.demand
__author__ = "Jimeno A. Fonseca"
__copyright__ = "Copyright 2018, Architecture and Building Systems - ETH Zurich"
__credits__ = ["Jimeno A. Fonseca"]
... | architecture-building-systems/CEAforArcGIS | cea/plots/demand/heating_reset_schedule.py | Python | mit | 3,180 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# chat documentation build configuration file, created by
# sphinx-quickstart on Wed Jan 4 12:24:08 2017.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in thi... | Decalogue/chat | docs/source/conf.py | Python | mit | 10,557 |
def func():
global b # TS9521 global to missing var
print(b)
| Microsoft/pxt | tests/errors-test/cases/parse-errors.py | Python | mit | 71 |
#!/usr/bin/env arch -i386 python
import wx
app = wx.App(False) # Create a new app, don't redirect stdout/stderr to a window.
frame = wx.Frame(None, wx.ID_ANY, "Hello World") # A Frame is a top-level window.
frame.Show(True) # Show the frame.
app.MainLoop()
| evandrix/Splat | doc/comparison_gui_toolkits/wxPython_hello_world.py | Python | mit | 263 |
import glob
import os
import shutil
import sys
import unittest
from test.support import (run_unittest, TESTFN, skip_unless_symlink,
can_symlink, create_empty_file)
class GlobTests(unittest.TestCase):
def norm(self, *parts):
return os.path.normpath(os.path.join(self.tempdir, *pa... | firmlyjin/brython | www/tests/unittests/test/test_glob.py | Python | bsd-3-clause | 6,848 |
from .modules.buckle_embedding import *
from .modules.gather import *
| mlperf/training_results_v0.7 | Inspur/benchmarks/dlrm/implementations/implementation_closed/dlrm/nn/__init__.py | Python | apache-2.0 | 70 |
# Copyright 2014 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.
from telemetry import decorators
from telemetry.page import page as page_module
from telemetry.unittest_util import options_for_unittests
from telemetry.unit... | SaschaMester/delicium | tools/perf/measurements/repaint_unittest.py | Python | bsd-3-clause | 2,526 |
'''Print known fields to stdout, somewhat like ``tshark -G fields``'''
import wirepy.lib.epan
wirepy.lib.epan.epan_init()
for field in wirepy.lib.epan.iter_fields():
print('%s\t%s\t%s' % (field.name, field.abbrev, field.blurb))
| lukaslueg/wirepy | examples/show_fields.py | Python | gpl-3.0 | 234 |
# -*- coding: utf-8 -*-
"""
ulmo.cdec.historical.core
~~~~~~~~~~~~~~~~~~~~~~~~~~
This module provides access to data provided by the `California Department
of Water Resources`_ `California Data Exchange Center`_ web site.
.. _California Department of Water Resources: http://www.water.ca.gov/
.... | timcera/tsgettoolbox | src/tsgettoolbox/ulmo/cdec/historical/core.py | Python | bsd-3-clause | 9,016 |
# -*- coding: utf-8 -*-
from operator import attrgetter
from pyangbind.lib.yangtypes import RestrictedPrecisionDecimalType
from pyangbind.lib.yangtypes import RestrictedClassType
from pyangbind.lib.yangtypes import TypedListType
from pyangbind.lib.yangtypes import YANGBool
from pyangbind.lib.yangtypes import YANGListTy... | napalm-automation/napalm-yang | napalm_yang/models/openconfig/network_instances/network_instance/protocols/protocol/isis/levels/level/link_state_database/lsp/tlvs/tlv/area_address/__init__.py | Python | apache-2.0 | 11,696 |
import time
from django.core.management.base import BaseCommand, CommandError
from django.conf import settings
from mnm.bot import bot
class Command(BaseCommand):
help = 'Start the stats bot'
def handle(self, *args, **options):
b = bot.Bot()
while True:
print('Initiating connecti... | EliotBerriot/mnm | mnm/bot/management/commands/start_bot.py | Python | mit | 521 |
from openslides.utils.access_permissions import BaseAccessPermissions
from openslides.utils.auth import has_perm
class VoteCollectorAccessPermissions(BaseAccessPermissions):
"""
Access permissions container for VoteCollector.
"""
def check_permissions(self, user):
"""
Returns True if t... | emanuelschuetze/openslides-votecollector | openslides_votecollector/access_permissions.py | Python | mit | 2,908 |
from uuid import uuid4
from builtins import int
__test_missile = """\
POST /example/search/hello/help/us?param1=50¶m2=0¶m3=hello HTTP/1.1\r
Connection: close\r
Host: example.org\r
Content-length: 32\r
\r
param1=50¶m2=0¶m3=hello
"""
def __mark_by_uri(missile):
return '_'.join(
missile.spli... | f2nd/yandex-tank | yandextank/stepper/mark.py | Python | lgpl-2.1 | 2,319 |
# Generated by Django 2.2.13 on 2021-02-03 21:42
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('geopackages', '0004_auto_20210121_0227'),
]
operations = [
migrations.Alt... | qgis/QGIS-Django | qgis-app/geopackages/migrations/0005_auto_20210203_2142.py | Python | gpl-2.0 | 645 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.