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 |
|---|---|---|---|---|---|
import array
import copy
import hashlib
import logging
import os
import pickle
import zlib
from google.appengine.api import users
from google.appengine.ext import db
def DerivedProperty(func=None, *args, **kwargs):
"""Implements a 'derived' datastore property.
Derived properties are not set directly, but are ins... | zhaiduo/wancp | aetycoon/__init__.py | Python | gpl-2.0 | 23,229 |
# coding=utf-8
# coding=utf-8
# Copyright 2019 The RecSim 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 ap... | google-research/recsim | recsim/agents/tabular_q_agent_test.py | Python | apache-2.0 | 6,956 |
# Copyright 2008 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 agreed to in writing, ... | sandeva/appspot | settings.py | Python | apache-2.0 | 3,965 |
#!/usr/bin/python
#-*- coding: utf-8 -*-
import os,sys
sys.path.append(os.path.split(os.path.realpath(__file__))[0])
| maxlagerz/Tadam_bot | acrcloud/__init__.py | Python | mit | 260 |
"""This module implements the computation of the correlation matrix between
clusters."""
# -----------------------------------------------------------------------------
# Imports
# -----------------------------------------------------------------------------
from collections import Counter
import numpy as np
from st... | rossant/spiky | experimental/_correlation/correlations.py | Python | bsd-3-clause | 4,957 |
# """
# A simple Python module to obtain energy levels of superconducting qubits by sparse Hamiltonian diagonalization.
# """
#
import numpy as np
import sympy
from scipy.sparse.linalg import *
from abc import ABCMeta
from abc import abstractmethod
#
# import scqubits.core.constants as constants
# import scqubits.core.... | ooovector/qtlab_replacement | circuit.py | Python | gpl-3.0 | 37,345 |
import numpy as np
import copy
from mpi4py import MPI
from pymatgen import Lattice, Structure, Element, PeriodicSite
from pymatgen.io.vasp import Poscar, VaspInput
from pymatgen.analysis.structure_matcher import StructureMatcher, FrameworkComparator
from py_mc.mc import CanonicalMonteCarlo, grid_1D, observer_base
from... | skasamatsu/py_mc | examples/dft_latgas_spinel/spinel_catmix.py | Python | gpl-3.0 | 4,903 |
from models import Connection
from django import forms
class ConnectionForm(forms.ModelForm):
class Meta:
model = Connection
exclude = ('d_object_id',)
| CIGNo-project/CIGNo | cigno/mdtools/forms.py | Python | gpl-3.0 | 173 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# @Author: Mani
# @Date: 2017-08-28 19:20:58
# @Last Modified time: 2017-09-27 13:23:38
#
##############################################
import os, configparser
def read_config():
config_file = os.path.join(os.path.dirname(__file__), "..", "config", "config.ini"... | maninator/manimediaserver | setup/lib/mani_config.py | Python | gpl-3.0 | 9,976 |
import sys
from distutils.core import setup
if (sys.version_info.major, sys.version_info.minor) < (3, 4):
sys.exit("Python < 3.4 not supported.")
setup(
name='octopus-tools',
version='0.1',
license='LGPLv3',
url='https://github.com/octopus-platform/octopus-tools',
packages=['octopus', 'octopus... | octopus-platform/octopus-tools | setup.py | Python | lgpl-3.0 | 890 |
#!/usr/bin/env python3
# THIS FILE IS PART OF THE CYLC SUITE ENGINE.
# Copyright (C) 2008-2019 NIWA & British Crown (Met Office) & Contributors.
#
# 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... | matthewrmshin/cylc | lib/cylc/__init__.py | Python | gpl-3.0 | 2,324 |
from datetime import datetime, timedelta
from pprint import pprint
from django import forms
from utils.functions import shift_years
from .models import Account
class AccountForm(forms.ModelForm):
email = forms.CharField(
widget=forms.TextInput(attrs={"size": 40, "autofocus": "autofocus"}))
nome =... | anselmobd/fo2 | src/email_signature/forms.py | Python | mit | 869 |
# -*- coding: utf-8 -*-
# Copyright 2014-2016 OpenMarket Ltd
#
# 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... | TribeMedia/synapse | synapse/rest/__init__.py | Python | apache-2.0 | 3,211 |
import os
from os import environ as env
from voxel_globe.common_tasks import shared_task, VipTask
from celery.utils.log import get_task_logger
logger = get_task_logger(__name__)
@shared_task(base=VipTask, bind=True)
def create_height_map(self, voxel_world_id, render_height):
import shutil
import urllib
import... | ngageoint/voxel-globe | voxel_globe/height_map/tasks.py | Python | mit | 6,796 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Filename: .py
| zeroonegit/python | runoob/basic_tutorial/template.py | Python | mit | 64 |
#!/usr/bin/python
import unittest
import db
import lambda_functions
import logging
import os
class LambdaCommon(lambda_functions.LambdaCommon):
def createDb(self):
return db.DBMemory()
class TestLambdaFunctions(unittest.TestCase):
def testCommon(self):
obj = LambdaCommon()
def testPageBucket(self):
obj =... | intirix/serverless-wiki | lambda_functions_test.py | Python | apache-2.0 | 1,157 |
# Module: UnitTests.tBioNanoAssembly.py
# Version: 0.1
# Author: Aaron Sharp
# Date: 06/29/2015
#
# The purpose of this module is to provide unit tests for
# all modules in Operations.Assemble.BioNano
import unittest
import os
from collections import OrderedDict
from copy import copy
from UnitTests.Helper import Moc... | sharpa/OMWare | UnitTests/tBioNanoAssembly.py | Python | gpl-2.0 | 58,499 |
import pytest
from conda_smithy.ci_skeleton import generate
CONDA_FORGE_YML = """recipe_dir: myrecipe
skip_render:
- README.md
- LICENSE.txt
- .gitattributes
- .gitignore
- build-locally.py
- LICENSE
- .github/CONTRIBUTING.md
- .github/ISSUE_TEMPLATE.md
- .github/PULL_REQUEST_TEMPLATE.md
- .githu... | ocefpaf/conda-smithy | tests/test_ci_skeleton.py | Python | bsd-3-clause | 3,231 |
from django_webtest import WebTest
from .settings import SettingsMixin
class TestLanguageSwitcher(SettingsMixin, WebTest):
def test_switch_language(self):
response = self.app.get('/')
response.mustcontain('Open data API')
form = response.forms['language_switcher']
form['languag... | mysociety/yournextmp-popit | candidates/tests/test_language_switcher.py | Python | agpl-3.0 | 420 |
x is 1
y is None
| ratnania/pyccel | tests/errors/semantic/ex4.py | Python | mit | 17 |
# Copyright 2013 Red Hat, 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... | apporc/nova | nova/compute/rpcapi.py | Python | apache-2.0 | 45,182 |
"""Module that is responsible for parsing parameterized header values
encoded in accordance to rfc2231 (new style) or rfc1342 (old style)
"""
from collections import deque
from itertools import groupby
import regex as re
import six
from six.moves import urllib_parse
from flanker.mime.message import charsets
from flan... | mailgun/flanker | flanker/mime/message/headers/parametrized.py | Python | apache-2.0 | 8,312 |
# Copyright 2017 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... | aldian/tensorflow | tensorflow/python/eager/tensor_test.py | Python | apache-2.0 | 20,269 |
#! /usr/bin/env python
"""Sorting algorithms visualizer using Tkinter.
This module is comprised of three ``components'':
- an array visualizer with methods that implement basic sorting
operations (compare, swap) as well as methods for ``annotating'' the
sorting algorithm (e.g. to show the pivot element);
- a number... | xbmc/atv2 | xbmc/lib/libPython/Python/Demo/tkinter/guido/sortvisu.py | Python | gpl-2.0 | 19,342 |
#!/usr/bin/env python
from __future__ import print_function
import os
import os.path as osp
import sys
try:
import caffe
except ImportError:
print('Cannot import caffe. Please install it.')
quit(1)
import chainer.serializers as S
import fcn
here = osp.dirname(osp.abspath(__file__))
sys.path.insert(0... | wkentaro/fcn | examples/voc/caffe_to_chainermodel.py | Python | mit | 2,601 |
import os
import urlparse
class Config(object):
'''Default configuration object.'''
DEBUG = False
TESTING = False
PORT = int(os.environ.get('PORT', 5000))
class ProductionConfig(Config):
'''Configuration object specific to production environments.'''
REDIS_URL = os.environ.get('REDISTOGO_U... | taarifa/taarifa_backend | config.py | Python | bsd-3-clause | 1,024 |
#!/usr/bin/python
#
# Copyright 2002-2019 Barcelona Supercomputing Center (www.bsc.es)
#
# 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
... | mF2C/COMPSs | compss/programming_model/bindings/python/src/pycompss/interactive.py | Python | apache-2.0 | 22,419 |
# -*- coding: utf-8 -*-
"""
Created on Sat Aug 26 18:59:02 2017
@author: Administrator
"""
"""
Definition of ListNode
class ListNode(object):
def __init__(self, val, next=None):
self.val = val
self.next = next
"""
from heapq import heappop, heappush
class Solution:
"""
... | NanguangChou/leetcode_python | 104 合并K个排序链表.py | Python | apache-2.0 | 2,554 |
# 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... | chase-qi/workload-automation | wlauto/core/execution.py | Python | apache-2.0 | 34,418 |
# Copyright (c) 2012, GPy authors (see AUTHORS.txt).
# Licensed under the BSD 3-clause license (see LICENSE.txt)
import unittest
import numpy as np
import GPy
class MiscTests(unittest.TestCase):
def setUp(self):
self.N = 20
self.N_new = 50
self.D = 1
self.X = np.random.uniform(-3.... | ptonner/GPy | GPy/testing/model_tests.py | Python | bsd-3-clause | 25,915 |
"""
Django settings for bp_mgmt project.
Generated by 'django-admin startproject' using Django 1.8.1.
For more information on this file, see
https://docs.djangoproject.com/en/1.8/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.8/ref/settings/
"""
# Build path... | nerdoc/bp_mgmt | bp_mgmt/settings.py | Python | agpl-3.0 | 5,012 |
"""Initiazlization file for twopoppy"""
__all__ = ['const', 'model', 'args', 'wrapper', 'model_wrapper']
#
# get version
#
from pkg_resources import get_distribution, DistributionNotFound
try:
__version__ = get_distribution(__name__).version
except DistributionNotFound:
# package is not installed
pass
from... | birnstiel/two-pop-py | twopoppy/__init__.py | Python | gpl-3.0 | 436 |
import unittest
import zc.buildout.testing
class TestShellBuildout(unittest.TestCase):
def setUp(self):
zc.buildout.testing.buildoutSetup(self)
zc.buildout.install.develop('yt.recipe.shell', self)
def tearDown(self):
zc.buildout.testing.buildoutTearDown(self)
| toumorokoshi/yt.recipe.shell | yt/recipe/shell_tests.py | Python | mit | 297 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('licenses', '__first__'),
('elos', '0035_elo_description'),
]
operations = [
migrations.AddField(
model_n... | yrchen/CommonRepo | commonrepo/elos/migrations/0036_elo_license.py | Python | apache-2.0 | 480 |
"""Support for ESPHome binary sensors."""
import logging
from typing import Optional
from aioesphomeapi import BinarySensorInfo, BinarySensorState
from homeassistant.components.binary_sensor import BinarySensorDevice
from . import EsphomeEntity, platform_async_setup_entry
_LOGGER = logging.getLogger(__name__)
asy... | qedi-r/home-assistant | homeassistant/components/esphome/binary_sensor.py | Python | apache-2.0 | 1,893 |
# Copyright 2017 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 required by applicable law or a... | mlperf/training_results_v0.5 | v0.5.0/google/research_v3.32/gnmt-tpuv3-32/code/gnmt/model/staging/models/rough/nmt/attention_model.py | Python | apache-2.0 | 6,486 |
#
# 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... | clemensv/qpid-proton | tests/python/proton_tests/engine.py | Python | apache-2.0 | 75,989 |
from app import app
from app.litlink import API, page_meta
from flask import render_template, jsonify, request
'''
The site's index page.
'''
@app.route('/')
def index():
page = page_meta(title = 'Home', scripts = ['litlink.js'])
return render_template(
'index.html',
page = page
)
'''
Takes a link pro... | p810/litlink | app/routes.py | Python | gpl-2.0 | 608 |
# -*- coding: utf-8 -*-
'''
These preprocessing utils would greatly benefit
from a fast Cython rewrite.
'''
from __future__ import absolute_import
import string, sys
import numpy as np
from six.moves import range
from six.moves import zip
if sys.version_info < (3,):
maketrans = string.maketrans
else:
... | zhangxujinsh/keras | keras/preprocessing/text.py | Python | mit | 5,920 |
"""Map file definitions for postfix."""
from modoboa.core.commands.postfix_maps import registry
class RelayDomainsMap(object):
"""Map file to list all relay domains."""
filename = "sql-relaydomains.cf"
mysql = (
"SELECT name FROM postfix_relay_domains_relaydomain "
"WHERE name='%s' AND ... | disko/modoboa-admin-relaydomains | modoboa_admin_relaydomains/postfix_maps.py | Python | mit | 3,795 |
# (c) Copyright 2014 Brocade Communications Systems Inc.
# All Rights Reserved.
#
# Copyright 2014 OpenStack Foundation
#
# 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
#
# ... | Akrog/cinder | cinder/zonemanager/drivers/brocade/brcd_fabric_opts.py | Python | apache-2.0 | 2,207 |
"""
A simple file-system like interface that supports
both the regular filesystem and zipfiles
"""
__all__ = ('FileIO', 'ReadOnlyIO')
import os, time, zipfile
class FileIO (object):
"""
A simple interface that makes it possible
to write simple filesystem structures using
the interface that's exposed b... | kamitchell/py2app | py2app/simpleio.py | Python | mit | 5,394 |
# -*- coding: utf-8 -*-
# Copyright (c) Vispy Development Team. All Rights Reserved.
# Distributed under the (new) BSD License. See LICENSE.txt for more info.
"""
The event module implements the classes that make up the event system.
The Event class and its subclasses are used to represent "stuff that happens".
The Ev... | Eric89GXL/vispy | vispy/util/event.py | Python | bsd-3-clause | 29,289 |
__version__ = "0.2.6"
| grocsvs/grocsvs | src/grocsvs/__init__.py | Python | mit | 22 |
"""
Django Extensions additional model fields
"""
import re
import six
import string
import warnings
try:
import uuid
HAS_UUID = True
except ImportError:
HAS_UUID = False
try:
import shortuuid
HAS_SHORT_UUID = True
except ImportError:
HAS_SHORT_UUID = False
from django.core.exceptions import ... | devs1991/test_edx_docmode | venv/lib/python2.7/site-packages/django_extensions/db/fields/__init__.py | Python | agpl-3.0 | 20,102 |
from datetime import datetime
from django.db import models
from tagging.models import Tag, TaggedItem
class PostImageManager(models.Manager):
"""
Post Image Manager
"""
# use for related fields
use_for_related_fields = True
def get_gallery_images(self):
"""
Get gallery images
... | davisd/django-blogyall | blog/managers.py | Python | bsd-3-clause | 4,842 |
# 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... | mnuke/tf-slim-mnist | datasets/download_and_convert_mnist.py | Python | apache-2.0 | 7,628 |
from tkinter import *
from logic import *
from random import *
SIZE = 500
GRID_LEN = 4
GRID_PADDING = 10
BACKGROUND_COLOR_GAME = "#92877d"
BACKGROUND_COLOR_CELL_EMPTY = "#9e948a"
BACKGROUND_COLOR_DICT = {2: "#eee4da", 4: "#ede0c8", 8: "#f2b179", 16: "#f59563", \
32: "#f67c5f", 64: "#f65e3b", ... | memogame/tic-tac-toe | 2048_python/puzzle.py | Python | mit | 3,988 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from setuptools import setup
from distutils.core import setup
from Cython.Build import cythonize
from distutils.extension import Extension
from Cython.Distutils import build_ext
with open('README.rst') as readme_file:
readme = readme_file.read()
with open('HISTORY.r... | ukurumba/epidemic_network_modelling | setup.py | Python | mit | 2,161 |
# GridCal
# Copyright (C) 2022 Santiago Peñate Vera
#
# This program 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 pr... | SanPen/GridCal | src/GridCal/Engine/Devices/wire.py | Python | lgpl-3.0 | 2,759 |
# Copyright 2012 IBM Corp.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agree... | tanglei528/nova | nova/tests/compute/test_virtapi.py | Python | apache-2.0 | 6,743 |
#!/ur/bin/python
import numpy as np
import pandas as pd
import os
import argparse
import matplotlib.pyplot as plt
from molmod.constants import boltzmann
from molmod.io.xyz import XYZFile
from molmod.ic import bend_angle
from molmod.ic import bond_length
from scipy.optimize import curve_fit
import json
def main(file_n... | ccaratelli/insertion_deletion | angle_bond.py | Python | gpl-3.0 | 7,768 |
import datetime
from django.forms.utils import flatatt, pretty_name
from django.forms.widgets import Textarea, TextInput
from django.utils.functional import cached_property
from django.utils.html import conditional_escape, format_html, html_safe
from django.utils.safestring import mark_safe
from django.utils.translati... | georgemarshall/django | django/forms/boundfield.py | Python | bsd-3-clause | 10,103 |
# -*- coding: utf-8 -*-
# import selenium
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as ec
import time
from selenium.webdriver.support.ui import Select
"""
Usage:
pyth... | oniwan/GCI | sele_chrome.py | Python | mit | 2,504 |
from django.test import TestCase
from geotrek.infrastructure.factories import InfrastructureFactory, SignageFactory
from geotrek.maintenance.factories import InterventionFactory, ProjectFactory
from geotrek.core.factories import TopologyFactory, PathAggregationFactory
from geotrek.land.factories import (SignageManagem... | mabhub/Geotrek | geotrek/maintenance/tests/test_project.py | Python | bsd-2-clause | 5,195 |
# -*- coding: iso-8859-1 -*-
# -----------------------------------------------------------------------
# Helper modules to configure freevo using wxPython
# -----------------------------------------------------------------------
# $Id$
#
# Notes:
# Work-in-progress
# Todo:
#
# ----------------------------------------... | freevo/freevo1 | src/helpers/wxconfig.py | Python | gpl-2.0 | 6,335 |
import os
import sys
import time
import logging
import datetime
import numpy as np
from data import *
from time import clock
from parameters import *
from collections import defaultdict
spike_generators = {} # dict name_part : spikegenerator
spike_detectors = {} # dict name_part : spikedetector
multimeters = {} ... | vitaliykomarov/NEUCOGAR | nest/noradrenaline/scripts/func.py | Python | gpl-2.0 | 9,514 |
from itertools import dropwhile, takewhile, islice
import re
import subprocess
from thefuck.utils import replace_command, for_app
from thefuck.specific.sudo import sudo_support
@sudo_support
@for_app('docker')
def match(command):
return 'is not a docker command' in command.stderr
def get_docker_commands():
... | redreamality/thefuck | thefuck/rules/docker_not_command.py | Python | mit | 904 |
from __future__ import absolute_import
from django.core.urlresolvers import reverse
from .base import BaseAPITestCase
from contentcuration.models import Task
class TaskAPITestCase(BaseAPITestCase):
"""
Test that the Task API endpoints work properly. Note that since various APIs may create a task,
for th... | DXCanas/content-curation | contentcuration/contentcuration/tests/test_task_api.py | Python | mit | 3,713 |
#
# 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... | apache/incubator-airflow | tests/providers/amazon/aws/hooks/test_eks.py | Python | apache-2.0 | 56,294 |
"""Let's Encrypt user-supplied configuration."""
import copy
import os
from six.moves.urllib import parse # pylint: disable=import-error
import zope.interface
from letsencrypt import constants
from letsencrypt import errors
from letsencrypt import interfaces
from letsencrypt import le_util
class NamespaceConfig(ob... | TheBoegl/letsencrypt | letsencrypt/configuration.py | Python | apache-2.0 | 4,669 |
"""
TestCmd.py: a testing framework for commands and scripts.
The TestCmd module provides a framework for portable automated testing of
executable commands and scripts (in any language, not just Python), especially
commands and scripts that require file system interaction.
In addition to running tests and evaluating... | mxrrow/zaicoin | src/deps/boost/tools/build/v2/test/TestCmd.py | Python | mit | 23,923 |
from __future__ import absolute_import
import time
import random
from urlparse import urlparse
from redis import Redis
from . import CatalogCoordinator, LockException
################################################################################
# a slightly modified version of retools lock which depends only on ... | mindsnacks/Zinc | src/zinc/coordinators/redis.py | Python | mit | 3,000 |
from django import forms
from .models import Residence
class ResidenceForm(forms.ModelForm):
class Meta:
model = Residence
fields = ('name', 'users')
| pgergov/belmis | belmis/residences/forms.py | Python | mit | 172 |
from django.core.urlresolvers import reverse_lazy, reverse
from django.core.exceptions import ValidationError
from django import forms
from django.forms import ModelForm, inlineformset_factory, HiddenInput, Textarea
from django.utils.translation import ugettext_lazy as _
from django.contrib.auth.models import User
... | mercycorps/feedback | forms.py | Python | gpl-3.0 | 4,603 |
from flask import Flask, request, url_for, render_template, redirect
from random import randrange
app = Flask(__name__)
d = {}
@app.route("/", methods = ["POST", "GET"])
def index():
return render_template("home.html")
@app.route("/appetizer", methods = ["POST", "GET"])
def appetizer():
global d
if reque... | stuycs-softdev-fall-2013/proj3-7-cartwheels | halal/app.py | Python | bsd-3-clause | 3,626 |
#/usr/bin/env python
# AGDeviceControl
# Copyright (C) 2005 The Australian National University
#
# This file is part of AGDeviceControl.
#
# AGDeviceControl 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; eit... | pwarren/AGDeviceControl | agdevicecontrol/gui/defaultaction.py | Python | gpl-2.0 | 974 |
#!/usr/bin/env python
import unicornhat as unicorn
import getch, random, time, colorsys
import numpy as np
unicorn.rotation(90)
unicorn.brightness(0.4)
screen = [[0,0,0,0,0,0,0,0],
[0,0,0,0,0,0,0,0],
[0,0,0,0,0,0,0,0],
[0,0,0,0,0,0,0,0],
[0,0,0,0,0,0,0,0],
[0,0,0,0,0... | ukscone/unicornhat | avoid.py | Python | unlicense | 2,781 |
import random
import pickle
import unittest
"""
Function used to sort students using python's inbuilt sorting class
"""
def sort_by(_class, order):
if order == 1:
return sorted(_class)
elif order == 2:
return sorted(list(_class.items()), key=lambda student: max(student[1]), reverse=True)
... | JA-VON/python-helpers-msbm | task3.py | Python | mit | 2,648 |
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the Li... | joostvdg/jenkins-job-builder | jenkins_jobs/modules/hudson_model.py | Python | apache-2.0 | 1,248 |
import abc
import os.path
import string
import subprocess
from characteristic import Attribute, attributes
from haas.utils import abstractclassmethod
from six import add_metaclass
@add_metaclass(abc.ABCMeta)
class IAssertion(object):
@abstractclassmethod
def from_json_dict(cls, variables, data):
"""C... | cournape/nousagi | nousagi/assertions.py | Python | bsd-3-clause | 5,107 |
import httplib
import base64
import string
class RESTResource(object):
def __init__(self):
self.status = None
self.reason = None
self.raw_data = None
class RESTClient(object):
"""
Simple interface to the REST web services. Supports 'GET', 'PUT', 'POST' and 'DELETE' methods.
T... | rytis/miniREST | miniREST/client.py | Python | apache-2.0 | 2,807 |
#!/usr/bin/python2
# vim:set ts=4 sw=4 et nowrap syntax=python ff=unix:
#
# Copyright 2011-2018 Mark Crewson <mark@crewson.net>
#
# 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://... | mcrewson/squib | squib/main.py | Python | apache-2.0 | 8,690 |
import bs4
import hashlib
import auxo.agent
import auxo.report
url_uk = 'https://www.worldcubeassociation.org/competitions?region=United+Kingdom'
class CubingAgent(auxo.agent.WebAgent):
'''
An agent which checks for new Rubik's Cube competitions on the World Cubing
Association website.
'''
... | richard-taylor/auxo | auxo/cubing_agent.py | Python | gpl-3.0 | 2,939 |
from __future__ import print_function, absolute_import
from docopt import docopt
from .ext.fabric import *
from .ext.invoke import *
from .bootstrap import quickstart
from streamparse import __version__ as VERSION
# XXX: these are commands we're working on still
TODO_CMDS = """
sparse debug [-e <env>]
... | thedrow/streamparse | streamparse/cmdln.py | Python | apache-2.0 | 4,125 |
"""
----------------------------------------------------------------------------
Echo State Networks
Luis F. Simoes, 2016-07-29
----------------------------------------------------------------------------
Implemented following the specifications in:
[1] Jaeger, H. (2007). Echo state network. Scholarpedia, ... | lfsimoes/mars_express__esn | echo_state_networks.py | Python | mit | 20,376 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('scorecards', '0001_initial'),
]
operations = [
migrations.AlterField(
model_name='category',
name='c... | mysociety/pombola | pombola/scorecards/migrations/0002_datetimefield_remove_default.py | Python | agpl-3.0 | 883 |
#!/usr/bin/env python
# -*- coding:utf-8 -*-
import random
from cnfformula.transformations.expand import Expand
from ..cmdline import register_cnf_transformation_subcommand
from ..transformations import register_cnf_transformation
from ..cnf import CNF
from ..cnf import disj, xor
from ..cnf import less, greater, ... | marcvinyals/cnfgen | cnfformula/transformations/shuffle.py | Python | gpl-3.0 | 6,427 |
#
# CompleteTranscription.py
#
# by Andrea Cogliati <andrea.cogliati@rochester.edu>
# University of Rochester
#
from music21 import *
import subprocess
import operator
import math
from os import system
class MidiBeat:
def __init__(self, timestamp, level, division):
self.timestamp = timestamp
self.... | AndreaCogliati/CompleteTranscription | CompleteTranscription.py | Python | bsd-3-clause | 18,533 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
readme = open('README.rst').read()
history = open('HISTORY.rst').read().replace('.. :changelog:', '')
setup(
name='polygamy',
version='0.1.2',
description='Handle... | solarnz/polygamy | setup.py | Python | bsd-3-clause | 1,343 |
#-*- coding: utf-8 -*-
import urllib2
import re
import CommonFunctions
import base64
common = CommonFunctions
from resources.lib import utils
title=['NRJ12','Chérie 25']
img=['nrj12','cherie25']
readyForUse=True
def list_shows(channel,folder):
shows=[]
filePath=utils.downloadCatalog('http://www.nrj-pl... | spmjc/plugin.video.freplay | resources/lib/channels/nrj12.py | Python | gpl-2.0 | 3,267 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright 2011 Yesudeep Mangalapilly <yesudeep@gmail.com>
# Copyright 2012 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 ... | gorakhargosh/mom | mom/tests/test_mom_codec_json.py | Python | apache-2.0 | 1,683 |
"""
Views for PubSite app.
"""
from django.conf import settings
from django.contrib.auth.views import (
PasswordResetView,
PasswordResetDoneView,
PasswordResetConfirmView,
PasswordResetCompleteView,
)
from django.shortcuts import render
import requests
import logging
logger = logging.getLogger(__name__... | sigmapi-gammaiota/sigmapi-web | sigmapiweb/apps/PubSite/views.py | Python | mit | 4,610 |
'''
Created by auto_sdk on 2014-12-17 17:22:51
'''
from top.api.base import RestApi
class WlbItemQueryRequest(RestApi):
def __init__(self,domain='gw.api.taobao.com',port=80):
RestApi.__init__(self,domain, port)
self.is_sku = None
self.item_code = None
self.item_type = None
self.name = None
self.... | CooperLuan/devops.notes | taobao/top/api/rest/WlbItemQueryRequest.py | Python | mit | 489 |
# 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... | toddpalino/kafka-tools | kafka/tools/protocol/responses/controlled_shutdown_v0.py | Python | apache-2.0 | 1,166 |
# Copyright 2011, 2013-2015 VPAC
#
# This file is part of Karaage.
#
# Karaage 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.
#
# Kara... | Karaage-Cluster/karaage-debian | karaage/management/commands/change_username.py | Python | gpl-3.0 | 2,564 |
#!/usr/bin/env python3
from pyopencga.opencga_config import ClientConfiguration
from pyopencga.opencga_client import OpencgaClient
import argparse
import getpass
from pprint import pprint
import json
def qc(families):
print('Executing qc...')
for family in families:
if len(family['members']) > 1 and ... | opencb/opencga | opencga-app/app/misc/scripts/family_ops.py | Python | apache-2.0 | 2,902 |
"""
WSGI config for buzzit project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/1.8/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault("DJANGO_SETTIN... | jmennen/group5 | Code/buzzit/buzzit/wsgi.py | Python | bsd-2-clause | 389 |
import json
import urllib2, urllib
import logging
logging.basicConfig()
logger = logging.getLogger('pbs_bullet.notifier')
class Notifier(object):
def __init__(self, name, pb_token):
self.token = pb_token
self.name = name
self.iden = self.create_listener()
def create_listener(self):
... | greenape/pbs_bullet | pbsbullet/notify.py | Python | bsd-2-clause | 4,699 |
__author__ = 'asifj'
import logging
from kafka import KafkaConsumer
import json
import traceback
from bson.json_util import dumps
from kafka import SimpleProducer, KafkaClient
from utils import Utils
logging.basicConfig(
format='%(asctime)s.%(msecs)s:%(name)s:%(thread)d:%(levelname)s:%(process)d:%(me... | asifhj/Python_SOAP_OSSJ_SAP_Fusion_Kafka_Spark_HBase | KafkaCP.py | Python | apache-2.0 | 2,510 |
import wicked as w
from wicked import index
def test_sqopprod():
"""Test the SQOpProd class"""
w.reset_space()
w.add_space("o", "fermion", "occupied", ["i", "j"])
w.add_space("a", "fermion", "general", ["u", "v"])
w.add_space("v", "fermion", "occupied", ["a", "b", "c"])
opprod = w.sqopprod([]... | fevangelista/wicked | tests/sqopprod/test_sqopprod.py | Python | mit | 2,446 |
# -*- coding: utf-8 -*-
from code_coverage_bot import hgmo
def test_ok():
assert(hgmo)
| lundjordan/services | src/codecoverage/bot/tests/test_hgmo.py | Python | mpl-2.0 | 94 |
# -*- coding: utf-8 -*-
from chatterbot import ChatBot
from settings import GITTER
# Uncomment the following lines to enable verbose logging
# import logging
# logging.basicConfig(level=logging.INFO)
chatbot = ChatBot(
'GitterBot',
gitter_room=GITTER['ROOM'],
gitter_api_token=GITTER['API_TOKEN'],
gi... | Reinaesaya/OUIRL-ChatBot | examples/gitter_example.py | Python | bsd-3-clause | 809 |
from __future__ import absolute_import
class FileStorage(object):
def __init__(self, path=''):
self.path = path
def save(self, filename, fp, content_type=None, path=None):
raise NotImplementedError
def url_for(self, filename, expire=300):
raise NotImplementedError
def get_fi... | dropbox/changes | changes/storage/base.py | Python | apache-2.0 | 469 |
age = raw_input("How old are you? ")
height = raw_input("How tall are you? ")
weight = raw_input("How much do you weigh?")
print "So, you are %r old, %r tall and %r heavy." % (
age, height, weight)
| mshcruz/LearnPythonTheHardWay | ex12.py | Python | gpl-2.0 | 203 |
#!/usr/bin/python
# Copyright (c) 2014 Wladmir J. van der Laan
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
'''
Script to generate list of seed nodes for chainparams.cpp.
This script expects two text files in the directory that... | duality-solutions/Sequence | share/seeds/generate-seeds.py | Python | mit | 4,303 |
'''
Created on Mar 3, 2016
@author: Daniel Rivas
'''
from .base import *
IS_PRODUCTION = True
DEBUG= True
ALLOWED_HOSTS =['cogcommtl.ca', 'www.cogcommtl.ca', 'localhost:8000', 'percept.uqam.ca']
DEBUG= False
prod_only_apps = [
]
INSTALLED_APPS.extend(prod_only_apps)
# Database
# https://docs.djangoproject.co... | rivasd/djPsych | djPsych/settings/production.py | Python | gpl-3.0 | 541 |
# Microsoft Azure Linux Agent
#
# Copyright 2018 Microsoft Corporation
#
# 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 b... | hglkrijger/WALinuxAgent | azurelinuxagent/common/exception.py | Python | apache-2.0 | 3,970 |
def ShellSort(A):
sublistcount = len(A) // 2
while sublistcount > 0:
for startposition in range(sublistcount):
gapInsertionSort(A, startposition, sublistcount)
print("After increments of size", sublistcount, "The list is", A)
sublistcount = sublistcount // 2
def gapInsert... | applecool/cs430assignments | Sorting/ShellSort.py | Python | mit | 698 |
"""
analysis inspired by
http://www.nature.com/mp/journal/vaop/ncurrent/full/mp2016143a.html
"""
import sys
import pandas,numpy
import statsmodels.api as sm
sys.path.append('../timeseries')
from load_myconnectome_data import *
xvar_names=['panas.positive','panas.negative']
rnaseq_data,gene_names,rnaseq_dates,rnase... | poldrack/myconnectome | myconnectome/rnaseq/MIR181_vs_affect.py | Python | mit | 979 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.