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 |
|---|---|---|---|---|---|
from django.contrib.auth.models import User
from django.shortcuts import render
from .models import Request, Container
from .utils import *
from django.contrib import messages
from userroles.views import base_context
# Create your views here.
'''
Короче, сюда лезть только готовыми к дикой боли и дебаггингу))... | Roomanidzee/DistribSystem | distrib_system/choose_distrib/views.py | Python | mit | 5,250 |
import eventlet
from .base import BaseTransport
from .. import constants
class MockTransport(BaseTransport):
"""
Usage:
transport = MockTransport()
process, stdout, stderr = transport.run_cmd('ls -al')
"""
def __init__(self, **kwargs):
super(MockTransport, self).__init__(**kwargs)
... | greyside/errand-boy | errand_boy/transports/mock.py | Python | bsd-3-clause | 1,471 |
import pygame
from pygame.locals import *
from Colors import *
class Racquet:
def __init__(self, surface, color, position):
self.layer = surface
self.color = color
self.x1 = position[0]
self.y1 = position[1]
self.width = position[2]
self.length = position[3]
self.change_Y = 5
''' CREATING RACQUET ''... | Shadeslayer345/PyPong | Main/Game/Racquet.py | Python | mit | 861 |
# 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.
'''Base class and interface for tools.
'''
from __future__ import print_function
class Tool(object):
'''Base class for all tools. Tools should use t... | endlessm/chromium-browser | tools/grit/grit/tool/interface.py | Python | bsd-3-clause | 1,507 |
# Copyright 2015 University of Edinburgh
# Licensed under GPLv3 - see README.md for information
import sys
import click
from random import shuffle
from ..config import DeviceConfig as Config
from ..concurrency import WorkQueue
from ..helpers import set_exception_handler
pass_config = click.make_pass_decorator(Confi... | lewiseason/read-device | read_device/commands/device.py | Python | gpl-3.0 | 3,033 |
# -*- coding: utf-8 -*-
"""
Created on Wed Jul 08 14:20:27 2015
@author: Wasit
"""
import time
import numpy as np
from bokeh.plotting import *
import serial
import re
import datetime
#ser = serial.Serial('/dev/tty.usbserial', 9600)
#ser = serial.Serial('COM7', 9600)
#ser = serial.Serial(0) # open first serial po... | wasit7/tutorials | arduino_python/02_python_serial/plot_bokeh.py | Python | mit | 1,503 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#===============================================================================
# Copyright (c) 2012 - 2014, GPy authors (see AUTHORS.txt).
# Copyright (c) 2014, James Hensman, Max Zwiessele
# Copyright (c) 2015, Max Zwiessele
#
# All rights reserved.
#
# Redistribution a... | SheffieldML/GPy | setup.py | Python | bsd-3-clause | 10,080 |
from heapq import heappop, heappush
from math import sqrt
class MaxHeap:
@staticmethod
def construct_init_heap_from_input():
heap = MaxHeap()
for v,init_cost in enumerate(map(int,input().split())):
if init_cost != -1:
heap.push(v, init_cost)
return heap
... | JonSteinn/Kattis-Solutions | src/Mravi/Python 3/main.py | Python | gpl-3.0 | 1,996 |
# Download the Python helper library from twilio.com/docs/python/install
import os
from twilio.rest import Client
# Your Account Sid and Auth Token from twilio.com/user/account
# To set up environmental variables, see http://twil.io/secure
account_sid = os.environ['TWILIO_ACCOUNT_SID']
auth_token = os.environ['TWILIO_... | TwilioDevEd/api-snippets | rest/available-phone-numbers/mobile-example/mobile-get-example-1.7.x.py | Python | mit | 596 |
'''Train a simple deep NN on the MNIST dataset.
Get to 98.40% test accuracy after 20 epochs
(there is *a lot* of margin for parameter tuning).
2 seconds per epoch on a K520 GPU.
'''
from __future__ import print_function
import numpy as np
np.random.seed(1337) # for reproducibility
from keras.datasets import mnist
f... | daviddiazvico/keras | examples/mnist_mlp.py | Python | mit | 1,721 |
from flir_ptu.ptu import PTU
import logging
logger = logging.getLogger()
handler = logging.StreamHandler()
formatter = logging.Formatter('%(levelname)s:%(name)s:- %(message)s')
handler.setFormatter(formatter)
logger.addHandler(handler)
logger.setLevel(logging.DEBUG)
x = PTU("129.219.136.149", 4000)
x.connect()
val... | nikhilkalige/flir | main.py | Python | bsd-3-clause | 514 |
from django.template.response import TemplateResponse
from pyconcz_2016.speakers.models import Speaker
def homepage(request):
keynoters = Speaker.objects.filter(keynote=True)
return TemplateResponse(
request, 'pages/homepage.html', {'keynoters': keynoters})
| pyvec/cz.pycon.org-2016 | pyconcz_2016/common/views.py | Python | mit | 278 |
# -*- coding: utf-8 -*-
from south.utils import datetime_utils as datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding field 'TestRun.has_crashed'
db.add_column(u'threedi_verification... | nens/threedi-verification | threedi_verification/migrations/0007_auto__add_field_testrun_has_crashed__add_field_testrun_result.py | Python | gpl-3.0 | 2,975 |
# TestSwiftReturns.py
#
# This source file is part of the Swift.org open source project
#
# Copyright (c) 2014 - 2016 Apple Inc. and the Swift project authors
# Licensed under Apache License v2.0 with Runtime Library Exception
#
# See https://swift.org/LICENSE.txt for license information
# See https://swift.org/CONTRIB... | apple/swift-lldb | packages/Python/lldbsuite/test/lang/swift/return/TestSwiftReturns.py | Python | apache-2.0 | 9,303 |
from django import forms
from models import FavoriteTrip
class FavoriteTripForm (forms.ModelForm):
class Meta:
model = FavoriteTrip
fields = ('departure_place','arrival_place','departure_time')
| HumbertValles/BlaBlaPro | blablaPro/forms.py | Python | gpl-3.0 | 215 |
# coding: utf-8
"""
Copyright 2016 SmartBear Software
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... | massimo-zaniboni/netrobots | server/rest_api/models/event_create_robot.py | Python | gpl-3.0 | 5,848 |
"""
Copyright (C) 2014, Web Bender Consulting, LLC. - All Rights Reserved
Unauthorized copying of this file, via any medium is strictly prohibited
Proprietary and confidential
Written by Elijah Ethun <elijahe@gmail.com>
"""
import time
from datetime import *
from Sven.Module.System.Base import Base
from Sven.Conditio... | yarhajile/sven-daemon | Sven/Module/System/JunkDrawer.py | Python | gpl-2.0 | 4,756 |
# -*- coding: utf-8 -*-
import struct
from pysnmp.proto import rfc1902
import ipaddress
from port import Port
class VLAN(object):
"""
Represents a 802.1Q VLAN.
"""
def __init__(self, switch, vid):
"""
Constructs a new VLAN with the given VLAN ID `vid` on the given `switch`.
"... | thechristschn/hpswitch | hpswitch/vlan.py | Python | mit | 15,086 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import django.utils.timezone
from django.conf import settings
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('ct', '0014_f... | derdmitry/socraticqs2 | mysite/lti/migrations/0003_auto_20150625_0517.py | Python | apache-2.0 | 1,687 |
#!/usr/bin/env python
# vim:fileencoding=UTF-8:ts=4:sw=4:sta:et:sts=4:fdm=marker:ai
from __future__ import (unicode_literals, division, absolute_import,
print_function)
__license__ = 'GPL v3'
__copyright__ = '2012, Kovid Goyal <kovid at kovidgoyal.net>'
__docformat__ = 'restructuredtext en'
... | insomnia-lab/calibre | src/calibre/utils/fonts/scanner.py | Python | gpl-3.0 | 13,377 |
# -*- coding: utf-8 -*-
from django.shortcuts import render, redirect
from django.contrib.auth import authenticate, login
from django.contrib.auth.forms import AuthenticationForm
from django.utils import translation
from django.utils.translation import ugettext as _
def user_login(request, next=None):
"""
Disp... | moiseshiraldo/inviMarket | inviMarket/views/user_login.py | Python | agpl-3.0 | 1,914 |
#!/usr/bin/env python2.6
import socket
import os,sys
from time import sleep
tcp_host = ''
tcp_port = -1
infile = ''
delay=-1
if len(sys.argv) < 4:
print " ".join(["Usage:", os.path.basename(sys.argv[0]), \
"-infile=<file_to_send>","-tcphost=<server address>", \
"-tcpport=<server port>","-delay=<d... | computational-neuroimaging-lab/mindrun | tcp_send_1d.py | Python | mit | 2,565 |
from datetime import datetime
from flask import Flask, url_for, render_template
from pytwall.twitterwall import TwitterWall
app = Flask(__name__)
@app.route('/')
@app.route('/<hashtag>/')
def twall(hashtag='python'):
ptw = TwitterWall('auth.cfg')
query = '#' + hashtag
tweets = ptw.get_statuses(q=query, ... | tomesm/pytwall | pytwall/web.py | Python | mit | 624 |
###################################################################################################
# Demonstrate adding attributs to scan groups and datasets.
###################################################################################################
#Execute the scan: 200 steps, a1 from 0 to 40
a= lscan(ao... | paulscherrerinstitute/pshell | src/main/assembly/help/Tutorial_py/2_ScanFeatures/23_Metadata.py | Python | gpl-3.0 | 826 |
#
# Copyright 2010-2011 Free Software Foundation, 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 3 of the License, or
# (at your option) any later version.
#
# This progra... | tta/gnuradio-tta | volk/gen/make_machines_c.py | Python | gpl-3.0 | 1,344 |
#
# Gramps - a GTK+/GNOME based genealogy program
#
# Copyright (C) 2006-2007 Donald N. Allingham
# Copyright (C) 2010 Michiel D. Nauta
# Copyright (C) 2011 Tim G L Lyons
# Copyright (C) 2013 Doug Blank <doug.blank@gmail.com>
# Copyright (C) 2017 Nick Hall
#
# This program is free software; you... | ennoborg/gramps | gramps/gen/lib/personref.py | Python | gpl-2.0 | 6,561 |
# -*- coding: utf-8 -*-
#
# TimeVis documentation build configuration file, created by
# sphinx-quickstart on Sun May 3 20:59:14 2015.
#
# 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
# autogenerated file.
#
# A... | gaoce/TimeVis | docs/conf.py | Python | mit | 9,201 |
# -*- coding: utf-8 -*-
#
# This file is part of Invenio.
# Copyright (C) 2009, 2010, 2011 CERN.
#
# Invenio 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 optio... | CERNDocumentServer/invenio | modules/bibsched/lib/tasklets/bst_fibonacci.py | Python | gpl-2.0 | 2,170 |
from setuptools import find_packages
from setuptools import setup
setup(
name='svs',
version='1.0.0',
description='The InAcademia Simple validation Service allows for the easy validation of affiliation (Student,'
'Faculty, Staff) of a user in Academia',
license='Apache 2.0',
classif... | its-dirg/svs | setup.py | Python | apache-2.0 | 1,148 |
# -*- coding: utf-8 -*-
"""
InaSAFE Disaster risk assessment tool developed by AusAid and World Bank
- **Shake Event Test Cases.**
Contact : ole.moller.nielsen@gmail.com
.. note:: This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as publishe... | opengeogroep/inasafe | realtime/test/test_shake_event.py | Python | gpl-3.0 | 23,760 |
from kombu import Queue, Exchange
CELERY_TASK_SERIALIZER = 'json'
CELERY_QUEUES = (
Queue('streaming', Exchange('streaming'), routing_key='streaming'),
)
CELERY_ROUTES = {
'twitter.tasks.bulk_parsing': {'queue': 'streaming', 'routing_key': 'streaming'},
} | romaintha/twitter | twitter/celeryconfig.py | Python | mit | 267 |
#!/usr/bin/env python
# Copyright (c) Twisted Matrix Laboratories.
# See LICENSE for details.
"""
Simple IMAP4 client which connects to our custome
IMAP4 server: imapserver.py.
"""
import sys
from twisted.internet import protocol
from twisted.internet import defer
from twisted.internet import stdio
from twisted.ma... | leapcode/bitmask-dev | tests/integration/mail/imap/imapclient.py | Python | gpl-3.0 | 5,719 |
from collections import namedtuple
Error = namedtuple("Error", ["message", "id", "code"])
class Result(object):
def __init__(self, response):
self.ok = response.ok
self.message = ""
self.error = None
if not self.ok:
_e = response.json()
self.error = Error... | icoxfog417/pykintone | pykintone/result.py | Python | apache-2.0 | 461 |
from slave.quantum_design.ppms import PPMS
| p3trus/slave | slave/quantum_design/__init__.py | Python | gpl-3.0 | 43 |
'''
Created on 21 oct. 2015
@author: Remi Cattiau
'''
from engine.workers import PollWorker
from copy import deepcopy
from nxdrive.logging_config import get_logger
from nxdrive.engine.workers import ThreadInterrupt
from PyQt4 import QtCore
log = get_logger(__name__)
class ProcessAutoLockerWorker(PollWorker):
or... | arameshkumar/nuxeo-drive | nuxeo-drive-client/nxdrive/autolocker.py | Python | lgpl-2.1 | 4,364 |
"""
Tests for class dashboard (Metrics tab in instructor dashboard)
"""
import json
from django.core.urlresolvers import reverse
from django.test.client import RequestFactory
from mock import patch
from nose.plugins.attrib import attr
from capa.tests.response_xml_factory import StringResponseXMLFactory
from class_da... | miptliot/edx-platform | lms/djangoapps/class_dashboard/tests/test_dashboard_data.py | Python | agpl-3.0 | 13,688 |
import time
def busy_sleep(seconds):
max_time = time.time() + int(seconds)
while time.time() < max_time:
pass
def swallow_exception(timeout=3):
try:
busy_sleep(timeout)
except:
pass
else:
raise AssertionError('No exception')
| yahman72/robotframework | atest/testdata/running/stopping_with_signal/Library.py | Python | apache-2.0 | 280 |
# Copyright [2013] [M. David Allen]
#
# 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 agr... | plus-provenance/dataidentity | nsrl/OS.py | Python | apache-2.0 | 1,450 |
import os
from setuptools import setup
with open(os.path.join(os.path.dirname(__file__), 'README.md')) as readme:
README = readme.read()
# allow setup.py to be run from any path
os.chdir(os.path.normpath(os.path.join(os.path.abspath(__file__), os.pardir)))
setup(
name='django-quickbooks-web-connector',
v... | codedbyjay/django-quickbooks-web-connector | setup.py | Python | gpl-2.0 | 1,176 |
#!/usr/bin/env python
#
# By Reynaldo R. Martinez P.
# Sept 21, 2016
# TigerLinux AT Gmail DOT Com
# __getattr__ and __setattr__ in classes
#
#
print ("")
# the __getattr__ and __setattr__ are overloading methods used
# in classes for attributes not defined into the class
# Let's define a class using those methods:
... | tigerlinux/tigerlinux-extra-recipes | recipes/misc/python-learning/CORE/0062-Get-Set-Attributes/getsetattr.py | Python | gpl-3.0 | 4,459 |
# -*- coding: utf-8 -*-
from django.contrib.contenttypes import generic
from django.contrib.contenttypes.models import ContentType
from django.core.exceptions import ValidationError
from django.core.validators import RegexValidator
from django.db import models
from django.utils.translation import ugettext_lazy as _
fro... | DeppSRL/depp-tracking | project/tracking/behaviors.py | Python | bsd-3-clause | 3,346 |
# This little piece of script produces nice cryptic sounds from the old computer days. Enjoy
import winsound
from random import random
from time import sleep
freq=int((random()*10000)%5000)
dur=int(random()*100)
while True:
try:
winsound.Beep(freq,dur)
except ValueError:
freq+=1000
freq=int(... | creativcoder/AlgorithmicProblems | Python/crypticsound.py | Python | mit | 385 |
import re, hashlib, random, json, csv, sys
from datetime import datetime, timedelta, tzinfo
from django.contrib.auth import authenticate, login, logout
from django.contrib.auth.decorators import login_required
from django.contrib.auth.models import User
from django.core.cache import caches
from django.core.exceptions i... | vguillermo-developer/bbpolls | polls/views.py | Python | apache-2.0 | 46,950 |
'''
Created on Apr 6, 2016
@author: Alex Ip, Geoscience Australia
'''
import sys
import netCDF4
import subprocess
import re
from geophys2netcdf import ERS2NetCDF
def main():
assert len(sys.argv) in [
4, 5], 'Usage: %s <root_dir> <file_template> <new_variable_name> [<long_variable_name>]' % sys.argv[0]
... | alex-ip/geophys2netcdf | utils/rename_variable.py | Python | apache-2.0 | 2,231 |
#!/usr/bin/python
# -*- coding: UTF-8 -*-
#Copyright (C) 2007 Adam Spencer - Free Veterinary Management Suite
#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 Lice... | cyncyncyn/evette | languagefiles/language_blank_1.3.2.py | Python | gpl-2.0 | 65,018 |
# -*- coding: utf-8 -*-
from __future__ import division
from sympy.physics.unitsystems.units import Unit
from sympy.physics.unitsystems.systems.mks import length, time
from sympy.physics.unitsystems.prefixes import PREFIXES
from sympy.utilities.pytest import raises
k = PREFIXES['k']
def test_definition():
u = ... | wxgeo/geophar | wxgeometrie/sympy/physics/unitsystems/tests/test_units.py | Python | gpl-2.0 | 3,071 |
#!/usr/bin/env python
# -*- coding: utf8 -*-
'''
CRISPResso - Luca Pinello 2015
Software pipeline for the analysis of CRISPR-Cas9 genome editing outcomes from deep sequencing data
https://github.com/lucapinello/CRISPResso
'''
__version__ = "1.0.13"
import sys
import errno
import os
import subprocess as sb
import ar... | lucapinello/CRISPResso | CRISPResso/CRISPRessoCORE.py | Python | agpl-3.0 | 127,566 |
# -*- coding: utf-8 -*-
# Copyright 2022 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... | googleapis/python-vision | google/cloud/vision_v1p4beta1/services/product_search/async_client.py | Python | apache-2.0 | 99,110 |
from django.contrib.gis.gdal import OGRGeomType
from django.db.backends.sqlite3.introspection import DatabaseIntrospection, FlexibleFieldLookupDict
from django.utils import six
class GeoFlexibleFieldLookupDict(FlexibleFieldLookupDict):
"""
Sublcass that includes updates the `base_data_types_reverse` dict
f... | ZhaoCJ/django | django/contrib/gis/db/backends/spatialite/introspection.py | Python | bsd-3-clause | 2,248 |
# Copyright (C) 2014,2015 Nippon Telegraph and Telephone 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 by ... | ishidawataru/gobgp | tools/pyang_plugins/bgpyang2golang.py | Python | apache-2.0 | 24,971 |
# -*- coding: utf-8 -*-
#
# This file is part of Invenio.
# Copyright (C) 2012, 2014 CERN.
#
# Invenio 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... | zenodo/invenio | invenio/modules/redirector/redirect_methods/goto_plugin_cern_hr_documents.py | Python | gpl-2.0 | 8,683 |
"""
Test settings for memex project.
"""
import warnings
import exceptions
import os
# Use default settings, overriding only those deemed necessary
from .settings import *
MEDIA_ROOT = os.path.join(BASE_DIR, 'test_resources')
MEDIA_URL = '/test_resources/'
DEPLOYMENT = False
TEST_CRAWL_DATA = os.path.join(MEDIA_R... | YongchaoShang/memex-explorer | source/memex/test_settings.py | Python | bsd-2-clause | 1,232 |
#!/usr/bin/env python3
#
# Copyright 2017 F5 Networks
#
# 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 ... | michaeldayreads/marathon-bigip-ctlr | common.py | Python | apache-2.0 | 6,679 |
import os
import ray
from ray.tune import CLIReporter
from ray.tune.integration.wandb import wandb_mixin # noqa: F401
from ray.tune.schedulers import PopulationBasedTraining
from ray import tune
from ray.tune.examples.pbt_transformers.utils import \
build_compute_metrics_fn, download_data
from ray.tune.examples.... | robertnishihara/ray | python/ray/tune/examples/pbt_transformers/pbt_transformers.py | Python | apache-2.0 | 8,328 |
from django.forms import BooleanField, CharField, Form
class ConsentForm(Form):
"""
A subclass of django-user-account's SignupForm with a `terms` field to add
validation for the Terms of Use checkbox.
"""
check_uncertainty = BooleanField(
label=(
"I understand the uncertainty ... | PersonalGenomesOrg/open-humans | public_data/forms.py | Python | mit | 1,450 |
###############################################################################
#
# Copyright (C) 2001-2014 Micronaet SRL (<http://www.micronaet.it>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published
# by the ... | Micronaet/micronaet-mx | mx_sale_unlocked/__openerp__.py | Python | agpl-3.0 | 1,487 |
# -*- coding: utf-8 -*-
##
## This file is part of Invenio.
## Copyright (C) 2012 CERN.
##
## Invenio 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) a... | EUDAT-B2SHARE/invenio-old | modules/websearch/lib/record_blueprint.py | Python | gpl-2.0 | 8,707 |
#
# CompoundMixin.py -- enable compound capabilities.
#
# Eric Jeschke (eric@naoj.org)
#
# Copyright (c) Eric R. Jeschke. All rights reserved.
# This is open-source software licensed under a BSD license.
# Please see the file LICENSE.txt for details.
#
import sys, traceback
import numpy
from ginga.util.six.moves impo... | sosey/ginga | ginga/canvas/CompoundMixin.py | Python | bsd-3-clause | 7,594 |
#! /usr/bin/env python
"""
The MIT License (MIT)
Copyright (c) 2015 creon (creon.nu@gmail.com)
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... | Lamz0rNewb/alp-collection | python/exchanges.py | Python | mit | 44,525 |
from chimera.core.chimeraobject import ChimeraObject
from chimera.core.manager import Manager
from chimera.core.exceptions import ChimeraException
from nose.tools import assert_raises
import chimera.core.log
import logging
log = logging.getLogger("chimera.test_log")
class TestLog (object):
def test_l... | wschoenell/chimera_imported_googlecode | src/chimera/core/tests/test_log.py | Python | gpl-2.0 | 1,086 |
#!/usr/bin/env python
# test_module.py - unit test for the module interface
#
# Copyright (C) 2011 Daniele Varrazzo <daniele.varrazzo@gmail.com>
#
# psycopg2 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 Foundat... | alanjw/GreenOpenERP-Win-X86 | python/Lib/site-packages/psycopg2/tests/test_module.py | Python | agpl-3.0 | 6,251 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from geopy.geocoders import GoogleV3
###############
# GEOcode
###############
def geocode(_address):
geolocator = GoogleV3()
print _address
geocodes = geolocator.geocode(_address,exactly_one=True)
# for g in geocodes:
# print g
return geocod... | clemsos/mitras | lib/geo.py | Python | mit | 322 |
NUMBER_OF_VERTICES = 8
_Z_OFFSET = 1.5
_COLOR = {"GREEN" : [0.0,1.0,0.0,1.0],
"BLUE" : [0.0,0.0,1.0,1.0],
"RED" : [1.0,0.0,0.0,1.0]}
_POSITIONS = [#Front face positions
-400.0, 400.0,0.0,
400.0, 400.0,0.0,
400.0,-400.0,0.0,
-400.0,-400.... | Mekire/gltut-pygame | 05_objects_in_depth/data/fighting_data.py | Python | mit | 716 |
from redis import Redis
db = Redis()
chats = db.keys('chat.*.sessions')
print str(len(chats))+' chats.'
counters_generated = 0
for chat in chats:
chat_sessions = db.hgetall(chat)
for session in chat_sessions.keys():
db.rpush(chat[:-9]+'.counter', session)
counters_generated = counters_generated... | MSPARP/MSPARP | extras/generate_counters.py | Python | mit | 422 |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
{
'name': 'Indian - Schedule VI Accounting',
'version': '2.0',
'description': """
Indian Accounting: Chart of Account.
====================================
Indian accounting chart and localization.
Schedule... | maxive/erp | addons/l10n_in_schedule6/__manifest__.py | Python | agpl-3.0 | 968 |
# Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# 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 ... | mgagne/nova | nova/api/metadata/base.py | Python | apache-2.0 | 19,285 |
#!/usr/bin/python3
# -*- coding: utf-8 -*-
# Copyright (c) 2017-2020 Rhilip <rhilipruan@gmail.com>
from flask import Blueprint, request, jsonify
from modules.geo.utils import IpQuery
geo_blueprint = Blueprint('geo', __name__)
no_args_waring = """
<h1>IP转地址</h1>
根据IP地址查询所在的地理位置<br>
使用方法:/geo?ip={ip},返回js... | Rhilip/PT-help-server | modules/geo/__init__.py | Python | mit | 789 |
# Improved version of the code from chapter 03
# created in chapter 11 to accelerate execution
import random
XMAX, YMAX = 19, 16
def create_grid_string(dots, xsize, ysize):
"""
Creates a grid of size (xx, yy)
with the given positions of dots.
"""
grid = ""
for y in range(ysize):
f... | krother/maze_run | 11_testing_best_practices/generate_maze_faster.py | Python | mit | 1,781 |
#!/bin/env python
# -*- coding: utf-8 -*-
"""
This file is part of the web2py Web Framework
Copyrighted by Massimo Di Pierro <mdipierro@cs.depaul.edu>
License: LGPLv3 (http://www.gnu.org/licenses/lgpl.html)
Thanks to ga2arch for help with IS_IN_DB and IS_NOT_IN_DB on GAE
"""
import os
import re
import datetime
impor... | jefftc/changlab | web2py/gluon/validators.py | Python | mit | 108,546 |
from __future__ import absolute_import
import copy
import datetime
import pytest
import numpy as np
from astropy.units.quantity import Quantity
from astropy.tests.helper import assert_quantity_allclose
from numpy.testing import assert_array_equal, assert_almost_equal
from pandas.util.testing import assert_frame_equal... | Alex-Ian-Hamilton/sunpy | sunpy/instr/tests/test_goes.py | Python | bsd-2-clause | 23,919 |
import time
import common
class EmailLoopback(object):
def __init__(self, db):
self.db = db
self.table = "EmailLoopback"
def delete(self, user_id):
qvars = {
'uid': user_id
}
num_deleted = self.db.delete(self.table, where='user_id=$uid', vars=qvars)
... | riolet/rioauth | provider/models/email_loopback.py | Python | gpl-3.0 | 1,142 |
# -*- coding: utf-8 -*-
# This code is part of Ansible, but is an independent component
# This particular file snippet, and this file snippet only, is BSD licensed.
# Modules you write using this snippet, which is embedded dynamically by Ansible
# still belong to the author of the module, and may assign their own lic... | noroutine/ansible | lib/ansible/module_utils/network/aci/aci.py | Python | gpl-3.0 | 35,656 |
#!/usr/bin/env python
import matplotlib.pyplot as plt
import numpy as np
from matplotlib.backends.backend_pdf import PdfPages
# import sys
nFiles=3
files=[]
label=[]
# files.append('ann/vlogs/vtagBestLargeData1HiddenROC.log')
# label.append('1 hidden layer NN, 1/Z=0.0163')
# files.append('ann/vlogs/vtagBestLargeData2... | sidnarayanan/RelativisticML | old/roc.py | Python | mit | 1,766 |
#-*- coding: utf-8 -*-
import sys
def print_(sss):
sys.stdout.write(sss)
uzunluk = 17
_uzunluk = 0
yukseklik = 5
girdi = raw_input("Kare içine almak istediğiniz metini yazın: ")
char = "*"
bosluk = ((uzunluk-len(girdi))/2) - 1
_bosluk = 0
sag_1 = False
if len(girdi) % 2:
sag_1 = False
else:
sag_1 = Tr... | fatihmert/ProgragramlamaUygulamaSorular- | soru7.py | Python | gpl-2.0 | 1,530 |
from django.conf import settings
from django.db import models
class SavedCitation(models.Model):
user = models.ForeignKey(
settings.AUTH_USER_MODEL, related_name="saved_citations", on_delete=models.CASCADE
)
solr_id = models.CharField(max_length=100)
class Meta:
unique_together = [("u... | erudit/eruditorg | eruditorg/core/citations/models.py | Python | gpl-3.0 | 338 |
# -*- coding: utf-8 -*-
"""
The MIT License (MIT)
Copyright (c) 2015-2017 Rapptz
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software"),
to deal in the Software without restriction, including without limitation
the rights to u... | variablehair/Eggplantato | discord/state.py | Python | mit | 30,308 |
"""
POST-PROCESSORS
=============================================================================
Markdown also allows post-processors, which are similar to preprocessors in
that they need to implement a "run" method. However, they are run after core
processing.
"""
from __future__ import absolute_import
from __futu... | andela-bojengwa/talk | venv/lib/python2.7/site-packages/markdown/postprocessors.py | Python | mit | 3,398 |
#!/usr/bin/env python
# ---------------------------------------------------------------------------
# Licensing Information: You are free to use or extend these projects for
# education or reserach purposes provided that (1) you retain this notice
# and (2) you provide clear attribution to UC Berkeley, including a lin... | BARCproject/barc | workspace/src/labs/src/lab8/pid.py | Python | mit | 2,854 |
# 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.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use thi... | kgiusti/pyngus | pyngus/container.py | Python | apache-2.0 | 2,898 |
from mpf.tests.MpfGameTestCase import MpfGameTestCase
class TestPlayerVars(MpfGameTestCase):
def get_config_file(self):
return 'player_vars.yaml'
def get_machine_path(self):
return 'tests/machine_files/player_vars/'
def test_initial_values(self):
self.fill_troughs()
self... | missionpinball/mpf | mpf/tests/test_PlayerVars.py | Python | mit | 2,380 |
from flask import Flask, jsonify, make_response, request, render_template, redirect, url_for
from classifier import train_svm, test_svm
app = Flask(__name__)
#Declare some properties
default_train_dir_path = "D:\kaam\AdditionalParsed"
default_test_dir_path = r"D:\kaam\AdditionalParsedTest"
##DEPRECATED
default_trai... | Aman-1412/rest-api-doc-classifier | rest-1.py | Python | apache-2.0 | 2,778 |
# -*- coding: utf-8 -*-
from setuptools import setup, find_packages
# Dynamically calculate the version based on adworks.VERSION.
VERSION = (0, 1, 0, 'final', 0)
def get_version(version=None):
"""Derives a PEP386-compliant version number from VERSION."""
if version is None:
version = VERSION
asser... | ozgurgunes/django-adworks | setup.py | Python | mit | 2,013 |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes ... | Azure/azure-sdk-for-python | sdk/edgegateway/azure-mgmt-edgegateway/azure/mgmt/edgegateway/models/operation_py3.py | Python | mit | 1,589 |
import os
import unittest
from tests.baseclass import *
from meh.handler import *
from meh.dump import *
class Example:
def __init__(self):
self.rootPassword = "blahblah"
self.dontSkipMe = 12345
class AttrSkipList_TestCase(BaseTestCase):
def runTest(self):
example = Example()
... | vojtechtrefny/python-meh | tests/attrSkipList.py | Python | gpl-2.0 | 650 |
#!/usr/bin/env python
from keras.models import Sequential
from keras.layers import Dense, Dropout, Activation
from keras.optimizers import SGD
from keras.utils import np_utils
from sklearn.cross_validation import train_test_split
import sklearn as sk
import sklearn.cross_validation
import numpy as np
import cleartk_io... | tmills/neural-assertion | scripts/keras/singletask/assertion_optimize.py | Python | apache-2.0 | 2,684 |
'''
Created on 20/set/2011
@author: norby
'''
from core.module import Module, ModuleException
from core.vector import VectorList, Vector as V
from core.parameters import ParametersList, Parameter as P
import re
from external.ipaddr import IPNetwork
classname = 'Ifaces'
class Ifaces(Module):
params = Para... | h3rucutu/weevely-old | modules/net/ifaces.py | Python | gpl-3.0 | 1,886 |
# 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... | tensorflow/tensorflow | tensorflow/python/keras/models.py | Python | apache-2.0 | 31,810 |
from asgiref.sync import async_to_sync
from channels.generic.websocket import JsonWebsocketConsumer
from django.conf import settings
from django.utils import timezone
from .models import Route
class BusConsumer(JsonWebsocketConsumer):
groups = ["bus"]
def connect(self):
self.user = self.scope["user... | tjcsl/ion | intranet/apps/bus/consumers.py | Python | gpl-2.0 | 3,019 |
import sqlite3
class BurneyDB(object):
class MissingLinkedIDs(Exception):
pass
def __init__(self, dbfile = "burney.db", json_archive = "/datastore/burneyjson", areas_archive = "/datastore/burneyareas"):
self._conn = sqlite3.connect(dbfile)
# Dict responses:
self._conn.row_factory = sqlite... | BL-Labs/poetryhunt | burney_data.py | Python | mit | 12,611 |
# Authors:
# Petr Viktorin <pviktori@redhat.com>
#
# Copyright (C) 2012 Red Hat
# see file 'COPYING' for use and warranty inmsgion
#
# 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 ver... | msimacek/freeipa | ipalib/messages.py | Python | gpl-3.0 | 8,242 |
#: SanityCheck.py
import string, glob, os
# Do not include the following in the automatic
# tests:
exclude = ("SanityCheck.py", "BoxObserver.py",)
def visitor(arg, dirname, names):
dir = os.getcwd()
os.chdir(dirname)
try:
pyprogs = [p for p in glob.glob('*.py')
if p not in exclude ]
if no... | tapomayukh/projects_in_python | sandbox_tapo/src/refs/TIPython/code/SanityCheck.py | Python | mit | 954 |
"""
Django accounts management made easy.
"""
VERSION = (1, 1, 2)
__version__ = '.'.join((str(each) for each in VERSION[:4]))
def get_version():
"""
Returns string with digit parts only as version.
"""
return '.'.join((str(each) for each in VERSION[:3]))
| pjdelport/django-userena | userena/__init__.py | Python | bsd-3-clause | 275 |
from model.group import Group
testdata = [
Group(name='name1', header='header1', footer='footer1'),
Group(name='name2', header='header2', footer='footer2')
]
| natgry/python_training | data/groups.py | Python | apache-2.0 | 170 |
from base_model import BaseModel
import sqlalchemy as db
class User(BaseModel):
#table mapping
__tablename__ = "users"
##region column mapping
id = db.Column(db.Integer, primary_key=True)
user_name = db.Column(db.Text)
primary_email_id = db.Column(db.Integer, db.ForeignKey('user_emails.id') )
#Use mod... | namgivu/shared-model-FlaskSqlAlchemy-vs-SQLAlchemy | python-app/model/user.py | Python | gpl-3.0 | 1,292 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
from tarrasque import *
import sys
from ..config.api import get_match_details
from ..config.db import db
from inspect_props import dict_to_csv
from utils import HeroNameDict, unitIdx
from parser import Parser, run_single_parser
from preparsers import GameStartTime, PlayerHeroM... | grschafer/alacrity | alacrity/parsers/buyback.py | Python | mit | 2,081 |
#
# File: courseware/capa/responsetypes.py
#
"""
Problem response evaluation. Handles checking of student responses,
of a variety of types.
Used by capa_problem.py
"""
# standard library imports
import abc
import cgi
import inspect
import json
import logging
import html5lib
import numbers
import numpy
import os
fr... | olexiim/edx-platform | common/lib/capa/capa/responsetypes.py | Python | agpl-3.0 | 128,570 |
#!/usr/bin/env python
#
# Copyright 2007 Doug Hellmann.
#
#
# All Rights Reserved
#
# Permission to use, copy, modify, and distribute this software and
# its documentation for any purpose and without fee is hereby
# granted, provided that the above copyright notice appear in all
# copies and tha... | qilicun/python | python2/PyMOTW-1.132/PyMOTW/unittest/unittest_simple.py | Python | gpl-3.0 | 1,268 |
'''
You need to help them find out their common interest with the least list index sum. If there is a choice tie between answers, output all of them with no order requirement. You could assume there always exists an answer.
Example 1:
Input:
["Shogun", "Tapioca Express", "Burger King", "KFC"]
["Piatti", "The ... | Vaibhav/InterviewPrep | LeetCode/Easy/599-Min-Index-Sum.py | Python | mit | 1,397 |
import falcon
import json
from whoosh import index
from whoosh.qparser import QueryParser
class SearchResource(object):
def __init__(self):
self.types = json.load(open('types.json'))
self.ix = index.open_dir('types.idx')
self.query_parser = QueryParser('name', self.ix.schema)
def on... | EVE-Tools/search43 | main.py | Python | bsd-3-clause | 1,365 |
#
# Gramps - a GTK+/GNOME based genealogy program
#
# Copyright (C) 2002-2006 Donald N. Allingham
# Copyright (C) 2010 Nick Hall
#
# 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 v... | jralls/gramps | gramps/gui/filters/sidebar/_sidebarfilter.py | Python | gpl-2.0 | 9,525 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.