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 |
|---|---|---|---|---|---|
"""
Unit test for the repr and pprint of parameterized objects.
"""
import param
from . import API1TestCase
class TestParameterizedRepr(API1TestCase):
def setUp(self):
super(TestParameterizedRepr, self).setUp()
# initialize a parameterized class
class A(param.Parameterized):
... | ceball/param | tests/API1/testparameterizedrepr.py | Python | bsd-3-clause | 5,541 |
# Copyright (c) 2016 Intel, Inc.
# Copyright (c) 2013 OpenStack Foundation
# 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/li... | bigswitch/nova | nova/conf/consoleauth.py | Python | apache-2.0 | 1,156 |
import unittest
import colorsys
from PySide.QtCore import SIGNAL
from PySide.QtGui import QPushButton, QApplication
class Test (QApplication) :
def __init__(self, argv) :
super(Test, self).__init__(argv)
self._called = False
def called(self):
self._called = True
cl... | M4rtinK/pyside-android | tests/QtGui/bug_307.py | Python | lgpl-2.1 | 628 |
"""
Buy and sell items on the auction house.
"""
import datetime
import logging
import time
import os
import pydarkstar.logutils
import pydarkstar.itemlist
import pydarkstar.options
import pydarkstar.common
import pydarkstar.database
import pydarkstar.auction.manager
class Options(pydarkstar.options.Options):
""... | LegionXI/pydarkstar | apps/broker.py | Python | mit | 6,408 |
# coding=utf-8
__author__ = "AstroPrint Product Team <product@astroprint.com>"
__license__ = 'GNU Affero General Public License http://www.gnu.org/licenses/agpl.html'
__copyright__ = "Copyright (C) 2016-2019 3DaGoGo, Inc - Released under terms of the AGPLv3 License"
import threading
import logging
import requests
fro... | AstroPrint/AstroBox | src/astroprint/printfiles/downloadmanager.py | Python | agpl-3.0 | 7,267 |
#!/usr/bin/env python
# -*- encoding: utf-8 -*-
#
# Copyright (c) 2015 ASMlover. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# * Redistributions of source code must retain the above copyrig... | ASMlover/study | compiler/eLisp/eLisp/expr/definition.py | Python | bsd-2-clause | 1,898 |
# Copyright 2015 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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, s... | tseaver/gcloud-python | bigquery/tests/system.py | Python | apache-2.0 | 73,535 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright (c) 2016 Dimension Data
#
# This module 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 ... | wrouesnel/ansible | lib/ansible/modules/cloud/dimensiondata/dimensiondata_vlan.py | Python | gpl-3.0 | 19,352 |
# Based on local.py (c) 2012, Michael DeHaan <michael.dehaan@gmail.com>
# Based on chroot.py (c) 2013, Maykel Moya <mmoya@speedyrails.com>
# (c) 2013, Michael Scherer <misc@zarb.org>
# (c) 2015, Toshio Kuratomi <tkuratomi@ansible.com>
# (c) 2017 Ansible Project
# GNU General Public License v3.0+ (see COPYING or https:/... | caphrim007/ansible | lib/ansible/plugins/connection/libvirt_lxc.py | Python | gpl-3.0 | 7,515 |
# RTS2 libraries
# (C) 2009-2012 Petr Kubanek <petr@kubanek.net>
# (C) 2010-2016 Petr Kubanek, Institute of Physics
#
# 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 2.1 ... | zguangyu/rts2 | python/rts2/__init__.py | Python | gpl-2.0 | 1,237 |
import logging
from great_expectations.execution_engine import PandasExecutionEngine
from great_expectations.expectations.metrics.column_aggregate_metric_provider import (
ColumnAggregateMetricProvider,
column_aggregate_value,
)
from great_expectations.expectations.metrics.util import (
_scipy_distribution... | great-expectations/great_expectations | great_expectations/expectations/metrics/column_aggregate_metrics/column_parameterized_distribution_ks_test_p_value.py | Python | apache-2.0 | 1,785 |
# Copyright 2015 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... | jendap/tensorflow | tensorflow/python/kernel_tests/split_op_test.py | Python | apache-2.0 | 14,937 |
# Copyright 2014-2017 Red Hat, Inc.
#
# 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 distributed in... | nirs/vdsm | lib/vdsm/network/tc/_wrapper.py | Python | gpl-2.0 | 1,879 |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from openerp import api, fields, models
class account_analytic_tag(models.Model):
_name = 'account.analytic.tag'
_description = 'Analytic Tags'
name = fields.Char(string='Analytic Tag', index=True, required... | Elico-Corp/odoo_OCB | addons/analytic/models/analytic.py | Python | agpl-3.0 | 5,398 |
# -*- coding: utf-8 -*-
"""
***************************************************************************
test_qgspointdisplacementrenderer.py
-----------------------------
Date : September 2016
Copyright : (C) 2016 by Nyall Dawson
Email : nyall dot dawson at... | uclaros/QGIS | tests/src/python/test_qgspointdisplacementrenderer.py | Python | gpl-2.0 | 20,496 |
# Copyright (C) 2011 Philter Phactory Ltd.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publi... | philterphactory/prosthetic-runner | jswrapper/urls.py | Python | mit | 1,676 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import random
import pygame
from pygame.locals import *
import util
class Tile:
def __init__(self, color, image = None):
self.color = color
self.image = image
class Shape(object):
SHAPE_WIDTH = 4
SHAPE_HEIGHT = 4
SHAPES = (
... | kwailamchan/programming-languages | python/pygame/tetris/lib/shape.py | Python | mit | 8,684 |
import numpy as np
from unittest import TestCase
from diffprivlib.mechanisms import Geometric
from diffprivlib.mechanisms.transforms import StringToInt
from diffprivlib.utils import global_seed
global_seed(3141592653)
class TestStringToInt(TestCase):
def test_not_none(self):
mech = StringToInt(Geometric... | IBM/differential-privacy-library | tests/mechanisms/transforms/test_StringToInt.py | Python | mit | 1,405 |
import fastlmm.inference.lmm_cov as lmm
import numpy as np
import fastlmm.util.stats.chi2mixture as c2
import fastlmm.association as association
import scipy.stats as st
import tests_util as tu
class lrt(association.varcomp_test):
__slots__ = ["lmm","lrt","forcefullrank","nullModel","altModel","G0","K0","_... | zhonghualiu/FaST-LMM | fastlmm/association/tests/LRT_up.py | Python | apache-2.0 | 9,147 |
import os
BASE_DIR = os.path.dirname(__file__)
SECRET_KEY = 'django-jinja-bootstrap-form'
TEMPLATE_DEBUG = DEBUG = False
INSTALLED_APPS = (
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.stati... | patryk4815/django-jinja-bootstrap-form | testing/settings.py | Python | bsd-3-clause | 1,389 |
#############################################################################
##
## Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
## Contact: http://www.qt-project.org/legal
##
## This file is part of Qt Creator.
##
## Commercial License Usage
## Licensees holding valid commercial Qt licenses may use this f... | colede/qtcreator | tests/system/suite_HELP/tst_HELP06/test.py | Python | lgpl-2.1 | 8,174 |
#!/usr/bin/env python
# Copyright (c) 2014 clowwindy
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, me... | gclove/shadowsocks | shadowsocks/crypto/rc4_md5.py | Python | mit | 1,815 |
"""
Copyright 2013 Steven Diamond
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... | SteveDiamond/cvxpy | cvxpy/reductions/complex2real/atom_canonicalizers/constant_canon.py | Python | gpl-3.0 | 912 |
from typing import Generator
from followthemoney.types import registry
from followthemoney.property import Property
from nomenklatura.entity import CompositeEntity
TYPE_ORDER = {
registry.name: -6,
registry.identifier: -5,
registry.date: -4,
registry.country: -3,
registry.string: -1,
registry.... | pudo/nomenklatura | nomenklatura/tui/util.py | Python | mit | 1,138 |
# sql/util.py
# Copyright (C) 2005-2012 the SQLAlchemy authors and contributors <see AUTHORS file>
#
# This module is part of SQLAlchemy and is released under
# the MIT License: http://www.opensource.org/licenses/mit-license.php
from sqlalchemy import exc, schema, util, sql, types as sqltypes
from sqlalchemy.util impo... | aurofable/medhack-server | venv/lib/python2.7/site-packages/sqlalchemy/sql/util.py | Python | mit | 27,221 |
import re
import sys
import uuid
import copy
import datetime
from six import iteritems
from . import RefinerUtils
from pandajedi.jedicore import Interaction
from pandajedi.jedicore import JediException
from pandajedi.jedicore.JediTaskSpec import JediTaskSpec
from pandajedi.jedicore.JediDatasetSpec import JediDatasetS... | PanDAWMS/panda-jedi | pandajedi/jedirefine/TaskRefinerBase.py | Python | apache-2.0 | 47,294 |
# -*- coding: utf-8 -*-
from etapi.app import create_app
from etapi.settings import ProdConfig, DevConfig
def test_production_config():
app = create_app(ProdConfig)
assert app.config['ENV'] == 'prod'
assert app.config['DEBUG'] is False
assert app.config['DEBUG_TB_ENABLED'] is False
assert app.confi... | hypebeast/etapi | tests/test_config.py | Python | bsd-3-clause | 527 |
import pyximport; pyximport.install()
import math
#from numpy import *
import numpy as np
import numpy.linalg as la
from rlscore.learner.abstract_learner import AbstractLearner
from rlscore import model
from rlscore.utilities import array_tools
from rlscore.utilities import decomposition
from rlscore.utilities imp... | max291/RLScore | rlscore/learner/two_step_rls.py | Python | mit | 10,917 |
from distutils.core import setup
setup(
name = "aswath",
packages = ['aswath'],
description = 'Aswath Damodaran DCF calculations',
author = 'Mark Carter'
)
| blippy/aswath | setup.py | Python | gpl-3.0 | 179 |
#!/usr/bin/env python3
###############################################################################
# pynoter -- message handler
#
# The message handler of the pynoter package. This class was designed to
# correctly display the messages from all clients. The problem which
# occurred during the development of this l... | l3nkz/pynoter | pynoter/server/message_handler.py | Python | gpl-3.0 | 12,613 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from distutils.core import setup
setup(
name="dotgen",
version="0.1.5",
description="Dotfiles generator",
author="Fabian Köhler",
author_email="fkoehler1024@googlemail.com",
url="https://github.com/f-koehler/dotgen",
license="MIT",
packages... | f-koehler/dotgen | setup.py | Python | mit | 425 |
# Copyright 2013 OpenStack Foundation
# Copyright 2013 Hewlett-Packard Development Company, L.P.
#
# 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/lic... | openstack/trove | trove/tests/unittests/api/test_versions.py | Python | apache-2.0 | 9,754 |
# encoding: utf-8
"""
Enable pyglet to be used interacive by setting PyOS_InputHook.
Authors
-------
* Nicolas P. Rougier
* Fernando Perez
"""
#-----------------------------------------------------------------------------
# Copyright (C) 2008-2011 The IPython Development Team
#
# Distributed under the terms of th... | cloud9ers/gurumate | environment/lib/python2.7/site-packages/IPython/lib/inputhookpyglet.py | Python | lgpl-3.0 | 3,794 |
"""
Module difflib -- helpers for computing deltas between objects.
Function get_close_matches(word, possibilities, n=3, cutoff=0.6):
Use SequenceMatcher to return list of the best "good enough" matches.
Function context_diff(a, b):
For two lists of strings, return a delta in context diff format.
Fu... | prefetchnta/questlab | bin/x64bin/python/36/Lib/difflib.py | Python | lgpl-2.1 | 86,474 |
import json
import os
import uuid
folder, fname = os.path.split(__file__)
def contents_of(f):
with open(f, 'r') as ins_file:
contents = ' '.join(ins_file.readlines())
return contents
DEBUG = bool(int(os.environ.get('SOWING_DEBUG', 1))) # True
CSRF_SECRET = 'mysecretsRsaf3' if DEBUG else uuid.uuid4().... | blakev/sowing-seasons | summer/settings.py | Python | mit | 3,040 |
#
# Copyright (c) 2012-2014 Jonathan Topf
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publis... | ckod3/mayaseed | plug-ins/mayaseed.py | Python | mit | 3,201 |
"""
Apiary is a modern data-center management tool that includes provisioning,
configuration management and inventory control.
"""
__version__ = '0.0.1'
UUID_RE= "(?P<id>[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12})"
| gmr/apiary | apiary/__init__.py | Python | bsd-3-clause | 235 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import unittest
from pathlib import Path
from onto2nx import OWLParser, parse_owl
from tests.contants import pizza_iri, test_owl_ado, test_owl_pizza, test_owl_wine
from tests.mocks import mock_parse_owl_rdf, mock_parse_owl_xml
EXPECTED_PIZZA_NODES = {
... | cthoyt/onto2nx | tests/test_owl.py | Python | gpl-3.0 | 6,315 |
from django import forms
from django.contrib.auth.models import User
from crispy_forms.helper import FormHelper
from crispy_forms.layout import *
from inventory.user.models import Experimenter, Reader, Subject
class UserForm(forms.Form):
'''Form for creating a new User.
'''
USER_TYPE_CHOICES = (
... | sloria/device-inventory | inventory/user/forms.py | Python | bsd-3-clause | 3,771 |
# Copyright 2012 Michael Still and Canonical 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
#
# ... | viggates/nova | nova/virt/configdrive.py | Python | apache-2.0 | 6,402 |
# -*- encoding: utf-8 -*-
# © 2014 Elico Corp (https://www.elico-corp.com)
# Licence AGPL-3.0 or later(http://www.gnu.org/licenses/agpl.html)
from datetime import datetime
import time
from osv import fields, osv
from tools.translate import _
from tools import ustr
#import tools
class gap_analysis_effort(osv.Model):... | Elico-Corp/openerp-7.0 | gap_analysis/gap_analysis.py | Python | agpl-3.0 | 21,590 |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (c) 2011-2012, The Linux Foundation. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# * Redistributions of source code must retain th... | cristianomatos/android_kernel_motorola_msm8226 | scripts/gcc-wrapper.py | Python | gpl-2.0 | 3,405 |
# Copyright 2001 by Tarjei Mikkelsen. All rights reserved.
# Revisions copyright 2007 by Michiel de Hoon. All rights reserved.
# This code is part of the Biopython distribution and governed by its
# license. Please see the LICENSE file that should have been included
# as part of this package.
"""Tests the basic funct... | updownlife/multipleK | dependencies/biopython-1.65/Tests/test_KEGG.py | Python | gpl-2.0 | 2,438 |
import os
from fabric import task
from django.utils.termcolors import colorize
# 1. Local: chmod 400 ~/.ssh/aws.pem
# 2. Local: ssh-add ~/.ssh/aws.pem OR ~/.ssh/config: Append to Host: IdentityFile ~/.ssh/aws.pem
# 3. Local: Edit hosts, repo_name, pythonpath (if necessary)
# 4. Remote: Copy .env to to {code_dir}/.en... | richardcornish/smsweather | fabfile.py | Python | bsd-3-clause | 2,296 |
from django.conf.urls import url, include
from database.views import work_database
from rest_framework import routers
from database import views
router = routers.DefaultRouter(trailing_slash=False)
router.register(r'member', views.MemberViewSet)
urlpatterns = [
url(r'^rest/', include(router.urls)),
url(r'^$', ... | sergey-egv/DJandExtJSTest | database/urls.py | Python | gpl-3.0 | 423 |
#!/bin/env python
"""
# Automatically translated python version of
# OpenSceneGraph example program "osganimate"
# Translated from file 'osganimate.cpp'
# OpenSceneGraph example, osganimate.
#*
#* Permission is hereby granted, free of charge, to any person obtaining a copy
#* of this software and associated docum... | JaneliaSciComp/osgpyplusplus | examples/debugging2/osganimate.py | Python | bsd-3-clause | 7,471 |
from django.conf import settings
from django.db.models import Count, ExpressionWrapper, F, FloatField, Sum
from django.db.models.functions import Cast
from django.utils.decorators import method_decorator
from django.views.decorators.cache import cache_page
from django_filters.rest_framework import DjangoFilterBackend
... | zimmerman-zimmerman/OIPA | OIPA/api/budget/views.py | Python | agpl-3.0 | 14,887 |
"""Support for Epson projector."""
from __future__ import annotations
import logging
from epson_projector.const import (
BACK,
BUSY,
CMODE,
CMODE_LIST,
CMODE_LIST_SET,
DEFAULT_SOURCES,
EPSON_CODES,
FAST,
INV_SOURCES,
MUTE,
PAUSE,
PLAY,
POWER,
SOURCE,
SOURCE_... | rohitranjan1991/home-assistant | homeassistant/components/epson/media_player.py | Python | mit | 7,843 |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
# vim:fenc=utf-8
#
# Copyright © 2019
#
# Distributed under terms of the MIT license.
from fnapy.utils import Message
from fnapy.fnapy_manager import FnapyManager
from fnapy.connection import FnapyConnection
from tests import make_requests_get_mock, fake_manager
from lxml... | alexandriagroup/fnapy | tests/offline/test_encoding.py | Python | mit | 2,864 |
class YamaleError(ValueError):
def __init__(self, results):
super(YamaleError, self).__init__('\n'.join([str(x) for x in list(filter(lambda x: not x.isValid(), results))]))
self.message = self.args[0]
self.results = results
| 23andMe/Yamale | yamale/yamale_error.py | Python | mit | 252 |
# encoding: utf-8
from __future__ import print_function
import objc, time, math, sys, os, re, traceback, copy, datetime
from Foundation import NSObject, NSString, NSArray, NSMutableArray, NSMutableDictionary, NSDictionary, NSNumber, NSConcreteValue, \
NSClassFromString, NSUserDefaults, NSURL, NSNotificationCenter, ... | schriftgestalt/GlyphsSDK | ObjectWrapper/GlyphsApp/__init__.py | Python | apache-2.0 | 268,731 |
import textwrap
# This dictionary contains the map of the school.
#
# Each entry in the dictionary is a room or other location. The key is the
# room name ("the_office"), and the value is another dictionary containing
# properties of that room, as follows:
#
# description: the text to be displayed when the player wa... | chrisglencross/python-lessons | misc/escape_from_stamford_green_v2.py | Python | mit | 10,412 |
#
# Copyright 2019 The FATE 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 appli... | FederatedAI/FATE | python/federatedml/framework/homo/procedure/paillier_cipher.py | Python | apache-2.0 | 3,245 |
from setuptools import setup
req = [
'nose==1.3.0',
'wsgiref==0.1.2',
]
setup(
name='foo',
version='0.1',
url='',
py_modules=[],
scripts=[],
author='John Doe',
description='yadda yadda',
zip_safe=False,
install_requires=req,
)
| sourcegraph/python-deps | testdata/setup_repo_hard/setup.py | Python | bsd-2-clause | 273 |
# -*- coding: utf-8 -*-
"""
werkzeug.contrib.profiler
~~~~~~~~~~~~~~~~~~~~~~~~~
This module provides a simple WSGI profiler middleware for finding
bottlenecks in web application. It uses the :mod:`profile` or
:mod:`cProfile` module to do the profiling and writes the stats to the
stream provide... | Chitrank-Dixit/werkzeug | werkzeug/contrib/profiler.py | Python | bsd-3-clause | 4,920 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2017 Google
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
# ----------------------------------------------------------------------------
#
# *** AUTO GENERATED CODE *** AUTO GENERATED CODE ***
#
... | sestrella/ansible | lib/ansible/modules/cloud/google/gcp_compute_router.py | Python | gpl-3.0 | 18,863 |
import os
# toolchains options
ARCH='arm'
CPU='cortex-m3'
CROSS_TOOL='keil'
if os.getenv('RTT_CC'):
CROSS_TOOL = os.getenv('RTT_CC')
#device options
# STM32_TYPE =
# 'STM32F10X_LD','STM32F10X_LD_VL',
# 'STM32F10X_MD','STM32F10X_MD_VL',
# 'STM32F10X_HD','STM32F10X_HD_VL',
# 'STM32F10X_XL','STM32F10X_CL'
#STM32_TYPE... | apinggithub/-rtthread2.1.0app | bsp/stm32f10x-curer/rtconfig.py | Python | gpl-2.0 | 3,635 |
from django.shortcuts import render
from django.http import HttpResponse
from datetime import timedelta
import psutil
import subprocess
import re
import time
def home(request):
return render(request, 'home/index.html')
def datetime(request):
return HttpResponse(time.strftime("%a %d %b %Y - %H:%M:%S"))
def uptime(r... | luiscarlosgph/nas | home/views.py | Python | mit | 916 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# complexity documentation build configuration file, created by
# sphinx-quickstart on Tue Jul 9 22:26:36 2013.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# ... | kracekumar/assemble | docs/conf.py | Python | bsd-3-clause | 8,429 |
from __future__ import unicode_literals
from scorched.compat import str
import itertools
import json
import requests
import scorched.compat
import scorched.dates
import scorched.exc
import scorched.response
import scorched.search
import time
import warnings
MAX_LENGTH_GET_URL = 2048
# Jetty default is 4096; Tomcat d... | lugensa/scorched | scorched/connection.py | Python | mit | 21,848 |
# encoding: utf-8
import datetime
from south.db import db
from south.v2 import DataMigration
from django.db import models
from apps.reader.models import MUserStory
class Migration(DataMigration):
def forwards(self, orm):
userstories = MUserStory.objects.all()
print "%s userstories" % userstories.c... | huihoo/reader | apps/reader/migrations/0011_story_ids_on_userstories.py | Python | mit | 9,767 |
from schematics.models import Model
from schematics.types import StringType
class License(Model):
name = StringType(required=True)
url = StringType()
| toumorokoshi/swagger-schema | swagger_schema/license.py | Python | mit | 160 |
from .maxflow import *
from .mincost import *
from .boykovkolmogorov import *
from .dinitz_alg import *
from .edmondskarp import *
from .preflowpush import *
from .shortestaugmentingpath import *
from .capacityscaling import *
from .networksimplex import *
from .utils import build_flow_dict, build_residual_network
| JamesClough/networkx | networkx/algorithms/flow/__init__.py | Python | bsd-3-clause | 316 |
from rest_framework import serializers
from .models import Book, Member, Category, Author
class AuthorSerializer(serializers.ModelSerializer):
class Meta:
model = Author
fields = '__all__'
class CategorySerializer(serializers.ModelSerializer):
class Meta:
model = Category
fi... | jbuisine/MediaLibrary-RestFullAPI | project/apps/core/serializers.py | Python | mit | 672 |
def is_anagram(token, child):
hits = 0
for t in token:
for i, c in enumerate(child):
if c == t:
child = child[:i] + child[i+1:]
hits += 1
break
return hits == len(token)
def anagram(parent, child):
count = 0
for start in range(len(parent)-len(child)):
end = start + len... | mre/the-coding-interview | problems/anagram-detection/anagram-detection3.py | Python | mit | 545 |
#!/usr/bin/env python3
# Copyright (c) 2015, Ralf Jung <post@ralfj.de>
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notic... | RalfJung/git-mirror | githook.py | Python | bsd-2-clause | 2,716 |
doctests = """
########### Tests mostly copied from test_listcomps.py ############
Test simple loop with conditional
>>> sum({i*i for i in range(100) if i&1 == 1})
166650
Test simple case
>>> {2*y + x + 1 for x in (0,) for y in (1,)}
set([3])
Test simple nesting
>>> list(sorted({(i,j) for i in... | teeple/pns_server | work/install/Python-2.7.4/Lib/test/test_setcomps.py | Python | gpl-2.0 | 3,847 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
This experiment was created using PsychoPy2 Experiment Builder (v1.90.1),
on Tue May 15 14:59:08 2018
If you publish work using this script please cite the PsychoPy publications:
Peirce, JW (2007) PsychoPy - Psychophysics software in Python.
Journal of N... | djangraw/PsychoPyParadigms | EegFmriExperiments/BostonDots3.1/BostonDots3_lastrun.py | Python | mit | 47,905 |
#
# camera.py: for collecting training data
#
import time
from picamera import PiCamera
camera = PiCamera()
while(True):
time.sleep(0.1)
filename = str(time.time()) + '.jpg'
camera.capture(filename)
print(filename)
| kazunori279/ml-misc | toilet/camera.py | Python | apache-2.0 | 226 |
#!/usr/bin/env python
"""
See the file 'LICENSE' for copying permission
"""
from core.common import retrieve_content
__url__ = "https://dataplane.org/*.txt"
__check__ = "DataPlane.org"
__info__ = "known attacker"
__reference__ = "dataplane.org"
def fetch():
retval = {}
for url in ("https://dataplane.org/dns... | stamparm/maltrail | trails/feeds/dataplane.py | Python | mit | 1,139 |
# Copyright 2020 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, ... | google/objax | objax/optimizer/lars.py | Python | apache-2.0 | 2,914 |
import unittest
from itertools import chain
from board import Board
class BoardTest(unittest.TestCase):
def test_board_width(self):
board = Board(6,5)
self.assertEqual(len(board.blocks), 5)
def test_board_height(self):
board = Board(6,5)
self.assertTrue(all(map(lambda x: len(... | velinakd/candy-crush-2048 | tests/board_test.py | Python | mit | 541 |
""" Investable Server """
from flask import Flask, render_template, redirect, flash, request, jsonify, json
from flask_debugtoolbar import DebugToolbarExtension
import jinja2
import os
import geocoder
from zillow_utilities import *
from account_utilities import *
from mortgage_calculator import *
from db_queries imp... | jttyeung/investable | server.py | Python | mit | 4,455 |
#!/usr/bin/env python
# Copyright (c) 2012 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.
"""Driver of srpcgen for ppapi_proxy sources.
This must be run after modifying, adding, or removing .srpc files.
The lists of .srp... | keishi/chromium | ppapi/native_client/src/shared/ppapi_proxy/run_srpcgen.py | Python | bsd-3-clause | 7,278 |
from django.apps import AppConfig
from django.db.models import ForeignKey
from django.utils.translation import gettext_lazy as _
from . import checks, get_image_model # NOQA
from .signal_handlers import register_signal_handlers
class WagtailImagesAppConfig(AppConfig):
name = "wagtail.images"
label = "wagtai... | wagtail/wagtail | wagtail/images/apps.py | Python | bsd-3-clause | 1,223 |
import asyncio
import logging
from notaol.p3.packet import Packet, HEADER_LENGTH, HEADER_SIZE_OFFSET
_logger = logging.getLogger(__name__)
class Stream(object):
'''Connection handler.'''
def __init__(self, host='AmericaOnline.aol.com', port='5190'):
self._host = host
self._port = port
... | chfoo/notaol | notaol/p3/stream.py | Python | gpl-3.0 | 1,932 |
#
# This source file is part of the EdgeDB open source project.
#
# Copyright 2012-present MagicStack Inc. and the EdgeDB 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... | edgedb/edgedb | edb/server/daemon/__init__.py | Python | apache-2.0 | 840 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
import os
import unittest
import requests
sys.path.append(os.path.abspath('../nematus'))
from translate import main as translate
from settings import TranslationSettings
def load_wmt16_model(src, target):
path = os.path.join('models', '{0}-{1}'.format... | Proyag/nematus | test/test_translate.py | Python | bsd-3-clause | 3,188 |
import json
from django.conf import settings
from django.contrib.messages.storage.base import BaseStorage
from django.contrib.messages.storage.cookie import (
MessageDecoder, MessageEncoder,
)
class SessionStorage(BaseStorage):
"""
Stores messages in the session (that is, django.contrib.sessions).
""... | auready/django | django/contrib/messages/storage/session.py | Python | bsd-3-clause | 1,733 |
from mongoengine import connect, fields
from mongoengine.document import Document
from wtforms import fields as form_fields, validators
from wtforms.form import Form
from flask_views.tests.functional.base import BaseTestCase
class BaseMongoTestCase(BaseTestCase):
"""
Base test-case class for MongoDB tests.
... | brocaar/flask-views | flask_views/tests/functional/db/mongoengine/base.py | Python | bsd-3-clause | 1,104 |
# -*- coding: utf-8 -*-
##############################################################################
#
# Copyright (C) 2018 Compassion CH (http://www.compassion.ch)
# @author: Nicolas Badoux <n.badoux@hotmail.com>
#
# The licence is in the file __manifest__.py
#
##############################################... | ecino/compassion-switzerland | payment_ogone_compassion/__init__.py | Python | agpl-3.0 | 401 |
from flask import request
from flask_restplus import Resource
from skf.api.security import security_headers, validate_privilege
from skf.api.kb.business import update_kb_item
from skf.api.kb.serializers import kb_update, message
from skf.api.kb.parsers import authorization
from skf.api.restplus import api
from skf.api... | blabla1337/skf-flask | skf/api/kb/endpoints/kb_item_update.py | Python | agpl-3.0 | 1,112 |
# Copyright (C) 2017 Alexander Kuvaev (alexander@kuvaev.me)
# 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.
... | Vinatorul/Codpled | src/visualizer.py | Python | gpl-3.0 | 1,296 |
from collections import OrderedDict
from os.path import join as pjoin
from . import utils
import theano
from .status import Status
from .stopping_criteria import TrainingExit
class Trainer(object):
def __init__(self, optimizer, batch_scheduler, status=None):
self.status = status if status is not None el... | ASalvail/smartlearner | smartlearner/trainer.py | Python | bsd-3-clause | 3,751 |
from airy.core.conf import settings
from mongoengine import *
connect(getattr(settings, 'database_name', 'airy'))
| letolab/airy | airy/core/db.py | Python | bsd-2-clause | 116 |
"""
This script runs sanity checks all datasets in a directory.
Usage:
python check_antmaze_datasets.py <dirname>
"""
import numpy as np
import scipy as sp
import scipy.spatial
import h5py
import os
import argparse
def check_identical_values(dset):
""" Check that values are not identical """
check_keys = ['... | rail-berkeley/d4rl | scripts/check_antmaze_datasets.py | Python | apache-2.0 | 2,930 |
""" Generic Unification algorithm for expression trees with lists of children
This implementation is a direct translation of
Artificial Intelligence: A Modern Approach by Stuart Russel and Peter Norvig
Second edition, section 9.2, page 276
It is modified in the following ways:
1. We allow associative and commutati... | ahhda/sympy | sympy/unify/core.py | Python | bsd-3-clause | 7,189 |
#!/usr/bin/env python
# Copyright 2017 Google 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... | dcadevil/vitess | test/topo_flavor/consul.py | Python | apache-2.0 | 2,965 |
"""
Grid manipulation related command line interface.
Access this with something like:
python -m stompy.grid.cli <args>
"""
# why has python gone through three iterations of argument parsing modules?
from __future__ import print_function
import sys
import argparse
import logging as log
from . import unstructured_gr... | rustychris/stompy | stompy/grid/cli.py | Python | mit | 5,508 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2010 KenTyde
# All rights reserved.
#
# This software is licensed as described in the file LICENSE,
# which you should have received as part of this distribution.
from setuptools import setup
import os
desc = open(os.path.join(os.path.dirname(__file__), ... | jvirtanen/fixlib | setup.py | Python | bsd-3-clause | 886 |
""" Tests for journals marketing views. """
from __future__ import absolute_import
import uuid
import mock
from django.conf import settings
from django.core.urlresolvers import reverse
from openedx.core.djangoapps.site_configuration.tests.mixins import SiteMixin
from openedx.core.djangolib.testing.utils import Cach... | jolyonb/edx-platform | openedx/features/journals/tests/test_marketing_views.py | Python | agpl-3.0 | 5,227 |
"""Tools for setting up printing in interactive sessions. """
from __future__ import print_function, division
import sys
from distutils.version import LooseVersion as V
from io import BytesIO
from sympy import latex as default_latex
from sympy import preview
from sympy.core.compatibility import integer_types
from sy... | maniteja123/sympy | sympy/interactive/printing.py | Python | bsd-3-clause | 16,667 |
from django.test.testcases import TestCase
from lti_auth.auth import LTIBackend
from lti_auth.lti import LTI
from lti_auth.tests.factories import BASE_LTI_PARAMS, UserFactory
class LTIBackendTest(TestCase):
def setUp(self):
self.backend = LTIBackend()
self.lti = LTI('initial', 'any')
sel... | c0cky/mediathread | lti_auth/tests/test_auth.py | Python | gpl-2.0 | 2,618 |
import os
import urllib2
import urllib
import requests
import RPi.GPIO as GPIO
import time
GPIO.setmode(GPIO.BCM)
GPIO.setwarnings(False)
GPIO.setup(17, GPIO.IN)
while True:
if (GPIO.input(17) == True):
print ('blue')
urllib.urlopen("http://queuemeleon.herokuapp.com/blue")
time.sleep(.5) | radiolarian/clover | raspi-files/send_color.py | Python | mit | 297 |
"""
The xml.py script is an import translator plugin to get a carving from an Art of Illusion xml file.
An import plugin is a script in the import_plugins folder which has the function getCarving. It is meant to be run from the
interpret tool. To ensure that the plugin works on platforms which do not handle file cap... | natetrue/ReplicatorG | skein_engines/skeinforge-0006/skeinforge_tools/import_plugins/xml.py | Python | gpl-2.0 | 37,860 |
# Time-stamp: <2016-03-14 Mon 13:19:27 Shaikh>
def reverse(text):
return text[::-1]
def is_palindrome(text):
return text == reverse(text)
def ex_alpha(text):
result = list()
for l in text:
if l.isalpha():
result.append(l)
return ''.join(result).lower()
something = input('Ent... | SyrakuShaikh/python | learning/a_byte_of_python/hw_check_palindrome.py | Python | gpl-3.0 | 455 |
#!/usr/bin/python3
# ============================================================================
# Name : des-encryption.py
# Author : Hamza Megahed
# Version : 1.0
# Copyright : Copyright 2014 Hamza Megahed
# Description : DES Encryption Algorithm
# ===========================================... | Hamza-Megahed/des-calculator | des-encryption.py | Python | gpl-3.0 | 8,650 |
#!/usr/bin/env python
# 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 program is distributed in the hope that ... | acollign/sublp | commands.py | Python | gpl-3.0 | 2,603 |
# Copyright 2016 ETH Zurich
#
# 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, sof... | dmpiergiacomo/scion | python/test/lib/crypto/hash_tree_test.py | Python | apache-2.0 | 8,740 |
#!/usr/bin/env python
##
# Learning - 5
# I'm learning with my self, so i'm sorry if my language not good.
#
# More on Strings
#
# function array in string
# function find
# function split
##
print("Learning-5") #print text "Learning -5"
print("String on Array")
strings = ['i','love','python','easy','learn','and',... | muhfaris/Learnings | Python/Python/Basic/step_5.py | Python | lgpl-3.0 | 680 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.