text stringlengths 6 947k | repo_name stringlengths 5 100 | path stringlengths 4 231 | language stringclasses 1
value | license stringclasses 15
values | size int64 6 947k | score float64 0 0.34 |
|---|---|---|---|---|---|---|
from django.contrib.gis import admin
from .models import Line, Point, Polygon, Roads
@admin.register(Line, Point, Polygon, Roads)
class OSMAdmin(admin.OSMGeoAdmin):
fields = ('way', 'osm_id', 'ref', 'name') | quecolectivo/server | djangoserver/quecolectivo/api/admin.py | Python | gpl-3.0 | 211 | 0.009479 |
import asjson
from flask.views import MethodView
from functools import wraps
from flask.ext.mongoengine.wtf import model_form
from flask import request, render_template, Blueprint, redirect, abort, session, make_response
from .models import User, SessionStorage
from mongoengine import DoesNotExist
auth = Blueprint('au... | VeeSot/blog | auth/views.py | Python | gpl-2.0 | 2,792 | 0.0015 |
"""
Dashboard page for Studio
"""
from edxapp_acceptance.pages.studio.index import DashboardPage
from bok_choy.promise import BrokenPromise
from regression.pages.studio import BASE_URL
from regression.pages.lms import BASE_URL_LMS
class DashboardPageExtended(DashboardPage):
"""
This class is an extended class... | raeeschachar/edx-e2e-mirror | regression/pages/studio/studio_home.py | Python | agpl-3.0 | 2,009 | 0 |
# -*- encoding: utf-8 -*-
##############################################################################
#
# Copyright (c) 2008-2012 Alistek Ltd (http://www.alistek.com) All Rights Reserved.
# General contacts <info@alistek.com>
#
# WARNING: This program as such is intended to be used by professional... | dhp-denero/LibrERP | report_aeroo_ooo/installer.py | Python | agpl-3.0 | 6,702 | 0.008207 |
#Attribute set in both superclass and subclass
class C(object):
def __init__(self):
self.var = 0
class D(C):
def __init__(self):
self.var = 1 # self.var will be overwritten
C.__init__(self)
#Attribute set in both superclass and subclass
class E(object):
def __init__(self):
... | github/codeql | python/ql/test/query-tests/Classes/overwriting-attribute/overwriting_attribute.py | Python | mit | 451 | 0.015521 |
import feedparser
def getLatest():
feed = feedparser.parse("http://rss.thepiratebay.se/0")
title = feed['entries'][0]['title']
link = feed['entries'][0]['comments'].replace('http://', 'https://')
return "%s - %s" % (title, link)
| b0nk/botxxy | src/tpb.py | Python | gpl-2.0 | 241 | 0.016598 |
#!/usr/bin/python
#-*- coding: utf-8 -*-
from xlrd import open_workbook
x_data1=[]
y_data1=[]
wb = open_workbook('phase_detector.xlsx')
for s in wb.sheets():
print 'Sheet:',s.name
for row in range(s.nrows):
print 'the row is:',row+1
values = []
for col in range(s.ncols):
valu... | MiracleWong/PythonBasic | PythonExcel/testExcel.py | Python | mit | 471 | 0.012739 |
#!/usr/bin/python3
import sys
import os
def printUsage():
sys.exit('Usage: %s server|client' % sys.argv[0])
if ((len(sys.argv)!=2) or (sys.argv[1] != 'client') and (sys.argv[1] != 'server')):
printUsage()
print("Generating daemon script\n")
fileContents = open('dyndns.sh').read( os.path.getsize('dyndns.sh') )
fi... | MilkyWeb/dyndns | install.py | Python | mit | 881 | 0.010216 |
from django.http import Http404
from django.shortcuts import get_object_or_404
from django.urls.base import reverse_lazy as reverse
from django.utils.translation import ugettext_lazy as _
from ..forms.journals import JournalEntryForm, JournalForm, JournalLeaderEntryForm
from ..models.journals import Journal, JournalEn... | leprikon-cz/leprikon | leprikon/views/journals.py | Python | bsd-3-clause | 5,762 | 0.001736 |
import json
from sets import Set
from sys import maxint
import math
# tmp hacky functions for vec3
def norm2 (a):
return dot(a, a)
def dot ( a, b ):
return a[0] * b[0] + a[1] * b[1] + a[2] * b[2]
def area (a, b, c):
u = [ b[0] - a[0], b[1] - a[1], b[2] - a[2] ]
v = [ c[0] - a[0], c[1] - a[1], c[2] -... | shrekshao/Polyhedron3D | assets/models/test/txt2json_parser.py | Python | mit | 8,122 | 0.006156 |
#! /usr/bin/env python
import sys, pgq.setadmin
if __name__ == '__main__':
script = pgq.setadmin.SetAdmin('set_admin', sys.argv[1:])
script.start()
| ssinger/skytools-cvs | python/setadm.py | Python | isc | 159 | 0.012579 |
# -*- coding: utf-8 -*-
#
# 2015-11-03 Cornelius Kölbel <cornelius@privacyidea.org>
# Add check if an admin user exists
# 2014-12-15 Cornelius Kölbel, info@privacyidea.org
# Initial creation
#
# (c) Cornelius Kölbel
# Info: http://www.privacyidea.org
#
# This code is free software; you can redistr... | wheldom01/privacyidea | privacyidea/lib/auth.py | Python | agpl-3.0 | 4,375 | 0 |
# Copyright (c) 2014, The MITRE Corporation. All rights reserved.
# For license information, see the LICENSE.txt file
from __future__ import absolute_import
from django.conf import settings
from django.test import Client, TestCase
class TETestObj(object):
def __init__(self, target, expected_stubs, expected_oper... | TAXIIProject/django-taxii-services | tests/test_query_handler.py | Python | bsd-3-clause | 3,576 | 0.003356 |
# -*- coding: utf-8 -*-
# vim: tabstop=4 shiftwidth=4 softtabstop=4
#
# Copyright (C) 2012-2016 GEM Foundation
#
# OpenQuake 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 Free Software Foundation, either version 3 of the Licen... | rcgee/oq-hazardlib | openquake/hazardlib/gsim/akkar_bommer_2010.py | Python | agpl-3.0 | 21,696 | 0.003134 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('players', '0001_initial'),
]
operations = [
migrations.AddField(
model_name='player',
name='last_upd... | robrocker7/h1z1map | server/players/migrations/0002_player_last_updated.py | Python | apache-2.0 | 442 | 0 |
# Copyright 2012 OpenStack Foundation
# All Rights Reserved
# Copyright (c) 2012 NEC 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/lic... | Snergster/virl-salt | openstack/nova/files/mitaka/nova+network+neutronv2+api.py | Python | gpl-2.0 | 90,885 | 0.000275 |
from .activations import ActivationsPanel
from .experiments import ExperimentsPanel
from .occlusion import OcclusionPanel
| JarnoRFB/qtpyvis | qtgui/panels/__init__.py | Python | mit | 122 | 0 |
#-*- coding: utf-8 -*-
'''
python-libtorrent for Kodi (script.module.libtorrent)
Copyright (C) 2015-2016 DiMartino, srg70, RussakHH, aisman
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 t... | chimkentec/KodiMODo_rep | script.module.libtorrent/python_libtorrent/python_libtorrent/functions.py | Python | gpl-3.0 | 5,308 | 0.008855 |
import matplotlib.pyplot as plt
import numpy as np
import sys
import time
import scipy.signal as sig
infile = sys.argv[1]
indata = np.load(infile)
spec = indata[0]
samp_rate = indata[1]
fftsize = indata[2]
center_freq = indata[3] # MHz
halffft = int(0.5*fftsize)
freqs = 0.5*samp_rate*np.array(range(-halffft,halffft)... | varenius/salsa | USRP/usrp_gnuradio_dev/plot_array_file.py | Python | mit | 2,472 | 0.016181 |
from direct.distributed.MsgTypes import *
OTP_DO_ID_SERVER_ROOT = 4007
OTP_DO_ID_FRIEND_MANAGER = 4501
OTP_DO_ID_LEADERBOARD_MANAGER = 4502
OTP_DO_ID_SERVER = 4600
OTP_DO_ID_UBER_DOG = 4601
OTP_CHANNEL_AI_AND_UD_BROADCAST = 4602
OTP_CHANNEL_UD_BROADCAST = 4603
OTP_CHANNEL_AI_BROADCAST = 4604
OTP_NET_MSGR_CHANNEL_ID_ALL... | Spiderlover/Toontown | otp/distributed/OtpDoGlobals.py | Python | mit | 3,475 | 0.000288 |
# ################ A simple graphical interface which communicates with the server #####################################
# While client_gui only allows to set the facelets with the mouse, this file (client_gui2) also takes input from the
# webcam and includes sliders for some opencv parameters.
from tkinter import *
... | hkociemba/RubiksCube-TwophaseSolver | package_src/twophase/client_gui2.py | Python | gpl-3.0 | 12,351 | 0.00421 |
def extractDreamstlTumblrCom(item):
'''
Parser for 'dreamstl.tumblr.com'
'''
vol, chp, frag, postfix = extractVolChapterFragmentPostfix(item['title'])
if not (chp or vol) or "preview" in item['title'].lower():
return None
tagmap = [
('the s ranks that i raised', 'The S-Ranks that I Raised', ... | fake-name/ReadableWebProxy | WebMirror/management/rss_parser_funcs/feed_parse_extractDreamstlTumblrCom.py | Python | bsd-3-clause | 761 | 0.027595 |
# -*- coding: utf-8 -*-
from django.contrib import admin
from .catalogadmin import CatalogAdmin
from .publicationadmin import PublicationAdmin
from .typeadmin import TypeAdmin
from ..models import Type, Catalog, Publication
admin.site.register(Type, TypeAdmin)
admin.site.register(Catalog, CatalogAdmin)
admin.site.re... | mbourqui/django-publications-bootstrap | publications_bootstrap/admin/__init__.py | Python | mit | 358 | 0 |
__author__ = 'Dominic Miglar <dominic.miglar@bitmovin.net>'
import unittest
from bitcodin import get_input
from bitcodin.exceptions import BitcodinNotFoundError
from bitcodin.test.bitcodin_test_case import BitcodinTestCase
class GetNonExistentInputTestCase(BitcodinTestCase):
def setUp(self):
super(GetNon... | bitmovin/bitcodin-python | bitcodin/test/input/testcase_get_non_existent_input.py | Python | unlicense | 614 | 0 |
import olymap.item
def test_get_animal():
tests = (
({}, None),
({'IT': {'an': ['1']}}, True),
({'IT': {'an': ['0']}}, None),
({'IT': {'de': ['1']}}, None),
({'IM': {'an': ['1']}}, None),
)
for box, answer in tests:
assert olymap.item.get_animal(box) == answe... | olympiag3/olypy | tests/unit/test_olymap_item.py | Python | apache-2.0 | 5,307 | 0.000942 |
# Copyright 2013 University of Chicago
class EEAgentParameterException(Exception):
def __init__(self, message):
Exception.__init__(self, message)
class EEAgentUnauthorizedException(Exception):
pass
class EEAgentSupDException(Exception):
def __init__(self, message):
Exception.__init_... | ooici/eeagent | eeagent/eeagent_exceptions.py | Python | apache-2.0 | 337 | 0.002967 |
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
from __future__ import unicode_literals
import frappe, json, sys
from frappe import _
from frappe.utils import cint, flt, now, cstr, strip_html
from frappe.model import default_fields
from frappe.model.naming import set... | gangadhar-kadam/verve_live_frappe | frappe/model/base_document.py | Python | mit | 15,292 | 0.029362 |
# **********************************************************************
#
# Copyright (c) 2003-2017 ZeroC, Inc. All rights reserved.
#
# This copy of Ice is licensed to you under the terms described in the
# ICE_LICENSE file included in this distribution.
#
# ***********************************************************... | ljx0305/ice | python/test/Ice/facets/TestI.py | Python | gpl-2.0 | 1,190 | 0.006723 |
# -*- coding: utf-8 -*-
from rest_framework import status as http_status
import itertools
from flask import request
from framework import status
from framework.exceptions import HTTPError
from framework.flask import redirect # VOL-aware redirect
from framework.auth.decorators import must_be_signed
from website.arc... | mfraezz/osf.io | website/project/views/register.py | Python | apache-2.0 | 10,365 | 0.002605 |
import LingerActions.LingerBaseAction as lingerActions
class StopProcessAndChildrenAction(lingerActions.LingerBaseAction):
"""Logging that there was a change in a file"""
def __init__(self, configuration):
super(StopProcessAndChildrenAction, self).__init__(configuration)
# Fields
... | GreenBlast/Linger | LingerActions/StopProcessAndChildrenAction.py | Python | mit | 1,242 | 0.005636 |
#
# 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 ... | protochron/aurora | src/main/python/apache/thermos/cli/commands/status.py | Python | apache-2.0 | 4,163 | 0.010569 |
# Licensed to the .NET Foundation under one or more agreements.
# The .NET Foundation licenses this file to you under the Apache 2.0 License.
# See the LICENSE file in the project root for more information.
from common import *
import testdata
class oldstyle:
def __init__(self, value): self.value = valu... | IronLanguages/ironpython3 | Tests/compat/sbs_simple_ops.py | Python | apache-2.0 | 17,059 | 0.013424 |
#!/usr/bin/env python
''' Debug & Test support for matplot to python conversion.
'''
import os
import numpy as np
from scipy.io import loadmat
def dmpdat(s, e):
""" Dump a data structure with its name & shape.
Params:
-------
s: str. The name of the structure
e: expression. An expression to dump. ... | tooringanalytics/pyambiguity | m2py.py | Python | mit | 1,433 | 0.001396 |
import tests.model_control.test_ozone_custom_models_enabled as testmod
testmod.build_model( ['RelativeDifference'] , ['PolyTrend'] , ['Seasonal_Minute'] , ['ARX'] ); | antoinecarme/pyaf | tests/model_control/detailed/transf_RelativeDifference/model_control_one_enabled_RelativeDifference_PolyTrend_Seasonal_Minute_ARX.py | Python | bsd-3-clause | 167 | 0.047904 |
from django import forms
from django.contrib.admin.widgets import AutocompleteSelect
from django.forms import ModelChoiceField
from django.test import TestCase, override_settings
from django.utils import translation
from .models import Album, Band
class AlbumForm(forms.ModelForm):
class Meta:
model = Alb... | edmorley/django | tests/admin_widgets/test_autocomplete_widget.py | Python | bsd-3-clause | 5,005 | 0.000999 |
"""HTTP related handlers.
Note that some other HTTP handlers live in more specific modules: _auth.py,
_gzip.py, etc.
Copyright 2002-2006 John J Lee <jjl@pobox.com>
This code is free software; you can redistribute it and/or modify it
under the terms of the BSD or ZPL 2.1 licenses (see the file
COPYING.txt included w... | Andrew-Dickinson/FantasyFRC | customMechanize/_googleappengine.py | Python | gpl-2.0 | 26,831 | 0.001565 |
BADGES = [
{
'badge_id': 'tech',
'img_path': '/static/img/badges/wrench.svg',
'name': 'Junction Technical Staff',
'description': 'Actively serves on Junction staff',
'priority': 2000
},
{
'badge_id': 'staff',
'img_path': '/static/img/badges/award_fill.... | JunctionAt/JunctionWWW | config/badges.py | Python | agpl-3.0 | 862 | 0 |
# Licensed under a 3-clause BSD style license - see LICENSE.rst
from __future__ import (absolute_import, division, print_function,
unicode_literals)
from ..extern.six.moves.urllib.parse import parse_qs
from ..extern.six.moves.urllib.request import urlopen
from ..extern.six.moves import input
f... | AustereCuriosity/astropy | astropy/samp/web_profile.py | Python | bsd-3-clause | 5,804 | 0.000689 |
# -*- coding: utf-8 -*-
##############################################################################
#
# Copyright (c) 2009, Gustavo Narea <me@gustavonarea.net>.
# All Rights Reserved.
#
# This software is subject to the provisions of the BSD-like license at
# http://www.repoze.org/LICENSE.txt. A copy of the license... | jokajak/itweb | data/env/lib/python2.6/site-packages/repoze.who_testutil-1.0.1-py2.6.egg/tests/fixture/__init__.py | Python | gpl-3.0 | 729 | 0.001372 |
import os, sys
PATH = os.path.join(os.path.dirname(__file__), '..')
sys.path += [
os.path.join(PATH, 'project/apps'),
os.path.join(PATH, 'project'),
os.path.join(PATH, '..'),
PATH]
os.environ['DJANGO_SETTINGS_MODULE'] = 'project.settings.production'
import django.core.handlers.wsgi
application = django.core.hand... | claudiob/pypeton | pypeton/files/django/deploy/django_wsgi_production.py | Python | mit | 344 | 0.026163 |
#!/usr/bin/env python3
from framework import do_exit, get_globals, main
def do_work():
global g_test_import
global globals1
print("do_work")
globals1 = get_globals()
g_test_import = globals1["g_test_import"]
print("do_work: g_test_import = %s" % str(g_test_import))
main(do_work)
| jtraver/dev | python3/globals/test1.py | Python | mit | 308 | 0.003247 |
from __future__ import print_function
from numpy import int16
import time
def connect(route,**args):
'''
route can either be I.I2C , or a radioLink instance
'''
return SHT21(route,**args)
class SHT21():
RESET = 0xFE
TEMP_ADDRESS = 0xF3
HUMIDITY_ADDRESS = 0xF5
selected=0xF3
NUMPLOTS=1
PLOTNAMES = ['Data']
... | jithinbp/SEELablet | SEEL/SENSORS/SHT21.py | Python | gpl-3.0 | 2,349 | 0.063857 |
# dialog_add.py.in - dialog to add a new repository
#
# Copyright (c) 2004-2005 Canonical
# 2005 Michiel Sikkes
#
# Authors:
# Michael Vogt <mvo@debian.org>
# Michiel Sikkes <michiels@gnome.org>
# Sebastian Heinlein <glatzor@ubuntu.com>
#
# This program is free softw... | ruibarreira/linuxtrail | usr/lib/python3/dist-packages/softwareproperties/gtk/DialogAdd.py | Python | gpl-3.0 | 3,128 | 0.005754 |
# proxy module
from codetools.util.equivalence import *
| enthought/etsproxy | enthought/util/equivalence.py | Python | bsd-3-clause | 56 | 0 |
def test_default_log(creplay, testlog):
ret = creplay('echo', 'foo', creplay_args=[], cwd=testlog.dirname)
assert ret.success
assert ret.stdout == 'foo\n'
assert ret.stderr == ''
def test_echo_n(creplay, logfile):
ret = creplay('echo', '-n', 'foo')
assert ret.success
assert ret.stdout == '... | kvas-it/cli-mock | tests/test_creplay.py | Python | mit | 1,051 | 0 |
import os, json
iflnm = os.path.join('..','psiturk-rg-cont','trialdata.csv')
oflnm = "rawdata.csv"
with open(iflnm, 'rU') as ifl, open(oflnm, 'w') as ofl:
ofl.write('WID,Condition,Trial,TrialBase,Class,ContainmentType,ContainmentLevel,TrialNum,MotionDirection,Response,RT,Goal,Switched,RawResponse,WasBad\n')
f... | kasmith/cbmm-project-christmas | ContainmentAnalysis/parseData.py | Python | mit | 2,805 | 0.003565 |
"""
stubo
~~~~~
Stub-O-Matic - Enable automated testing by mastering system dependencies.
Use when reality is simply not good enough.
:copyright: (c) 2015 by OpenCredo.
:license: GPLv3, see LICENSE for more details.
"""
import os
import sys
version = "0.8.3"
version_info = tuple(ver... | rusenask/mirage | stubo/__init__.py | Python | gpl-3.0 | 585 | 0.005128 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Pyle makes it easy to use Python as a replacement for command line tools such as `sed` or `perl`.
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
from future impor... | aljungberg/pyle | pyle.py | Python | bsd-3-clause | 5,025 | 0.004776 |
from operator import itemgetter
from lxml import html
from fuzzywuzzy import fuzz
from helpers.utils import cached_request, thread_pool, replace_all
class StreamsApi:
def __init__(self, data, cache):
self.data = data
self.cache = cache
def get(self, url='', ttl=3600):
base_url = 'livefootballol.me'... | jonian/kickoff-player | apis/streams.py | Python | gpl-3.0 | 6,137 | 0.017598 |
"""
WSGI config for mymenu 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... | quangnguyen-asnet/python-django | mymenu/mymenu/wsgi.py | Python | mit | 389 | 0 |
"""Views for items (modules)."""
from __future__ import absolute_import
import hashlib
import logging
from uuid import uuid4
from datetime import datetime
from pytz import UTC
import json
from collections import OrderedDict
from functools import partial
from static_replace import replace_static_urls
from xmodule_modi... | jazkarta/edx-platform-for-isc | cms/djangoapps/contentstore/views/item.py | Python | agpl-3.0 | 49,511 | 0.003716 |
from __future__ import absolute_import
# Copyright (c) 2010-2016 openpyxl
from openpyxl.compat import basestring, unicode
from openpyxl.descriptors.serialisable import Serialisable
from openpyxl.descriptors import (
Alias,
Typed,
Integer,
Set,
MinMax,
)
from openpyxl.descriptors.excel import Perce... | aragos/tichu-tournament | python/openpyxl/drawing/colors.py | Python | mit | 11,201 | 0.002053 |
import collections
import re
import urlparse
class DSN(collections.MutableMapping):
''' Hold the results of a parsed dsn.
This is very similar to urlparse.ParseResult tuple.
http://docs.python.org/2/library/urlparse.html#results-of-urlparse-and-urlsplit
It exposes the following attributes:
... | mylokin/servy | servy/utils/dsntool.py | Python | mit | 4,496 | 0.001779 |
import virtualenv
import textwrap
output = virtualenv.create_bootstrap_script(textwrap.dedent("""
import os, subprocess
def after_install(options, home_dir):
subprocess.call([join(home_dir, 'bin', 'pip'),
'install', 'ipython', 'django', 'psycopg2'])
"""))
f = open('bootstrap.py', 'w').write(o... | Yellowen/Sharamaan | bin/bootstrap_creator.py | Python | gpl-2.0 | 327 | 0 |
import pytest
from named_dates.named_dates import\
day_of_nth_weekday, NoNthWeekdayError
# For reference throughout these tests, October 1, 2015 is
# a Thursday (weekday = 3).
def test_weekday_equals_first_of_month():
# Tests that day_of_nth_weekday works when the requested weekday is the
# first weekday... | pschoenfelder/named-dates | tests/test_day_of_nth_weekday.py | Python | mit | 2,862 | 0 |
from crispy_forms.helper import FormHelper
from crispy_forms.layout import Fieldset, Layout
from django import forms
from django.contrib.auth.forms import AuthenticationForm
from django.contrib.auth.models import User
from django.contrib.auth.password_validation import validate_password
from django.core.exceptions impo... | eduardoedson/scp | usuarios/forms.py | Python | mit | 8,823 | 0 |
from django.db import models
# Create your models here.
class Server(models.Model):
# Server
title = models.CharField(max_length=1000, help_text="Server Title", blank=False)
abstract = models.CharField(max_length=2000, help_text="Server Abstract", blank=True)
keywords = models.CharField(max_length=... | asascience-open/chisp1_wps | wps/models.py | Python | gpl-3.0 | 3,153 | 0.012369 |
from django.forms import ModelForm
from django import forms
from crispy_forms import layout
from crispy_forms.layout import Layout, HTML
from hs_core.forms import BaseFormHelper, Helper
from hs_core.hydroshare import users
from hs_modelinstance.models import ModelOutput, ExecutedBy
from hs_modflow_modelinsta... | ResearchSoftwareInstitute/MyHPOM | hs_modflow_modelinstance/forms.py | Python | bsd-3-clause | 27,274 | 0.003886 |
'''
run with ex: mpiexec -n 10 python article_simulated_estimate_mpi.py
Created on Jul 11, 2014
@author: jonaswallin
'''
from __future__ import division
import time
import scipy.spatial as ss
import article_simulatedata
from mpi4py import MPI
import numpy as np
import BayesFlow as bm
import matplotlib
import matplotl... | JonasWallin/BayesFlow | examples/article1/article_simulated_estimate_mpi.py | Python | gpl-2.0 | 8,046 | 0.048223 |
#!/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 ... | tst-ahernandez/earthenterprise | earth_enterprise/src/fusion/portableglobe/cutter/cgi-bin/common/utils.py | Python | apache-2.0 | 12,945 | 0.01151 |
##############################################################################
# Copyright (c) 2013-2018, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
#
# This file is part of Spack.
# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
# LLNL-CODE-64... | EmreAtes/spack | var/spack/repos/builtin/packages/editres/package.py | Python | lgpl-2.1 | 1,739 | 0.000575 |
import unittest
from pecan_swagger import utils
class TestUtils(unittest.TestCase):
def test_swagger_build(self):
from .resources import example_app
expected = {
"swagger": "2.0",
"info": {
"version": "1.0",
"title": "example_app"
... | shu-mutou/pecan-swagger | tests/test_utils.py | Python | bsd-3-clause | 10,382 | 0.000096 |
import unittest
from flask import current_app
from app import create_app, db
class BasicsTestCase(unittest.TestCase):
# Runs before each test
def setUp(self):
self.app = create_app('testing')
self.app_context = self.app.app_context()
self.app_context.push()
db.create_all()
... | bitmotive/flask-boilerplate | tests/test_basics.py | Python | mit | 705 | 0 |
# -*- coding: utf-8 -*-
##############################################################################
#
# Law Follow Up
# Copyright (C) 2013 Sistemas ADHOC
# No email
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as... | ingadhoc/odoo-law-tracking | law_tracking_x/commission_treatment.py | Python | agpl-3.0 | 4,111 | 0.006568 |
"""
This config file runs the simplest dev environment using sqlite, and db-based
sessions. Assumes structure:
/envroot/
/db # This is where it'll write the database file
/edx-platform # The location of this repo
/log # Where we're going to write log files
"""
# We intentionally define lot... | c0710204/edx-platform | lms/envs/test.py | Python | agpl-3.0 | 12,700 | 0.002756 |
from django.contrib import admin
from django.contrib.contenttypes import generic
from models import Attribute, BaseModel
from django.utils.translation import ugettext_lazy as _
class MetaInline(generic.GenericTabularInline):
model = Attribute
extra = 0
class BaseAdmin(admin.ModelAdmin):
"""
def get_re... | Mercy-Nekesa/sokoapp | sokoapp/utils/admin.py | Python | mit | 1,954 | 0.006141 |
import os
import warnings
from django.conf import settings, global_settings
from django.core.exceptions import ImproperlyConfigured
from django.http import HttpRequest
from django.test import SimpleTestCase, TransactionTestCase, TestCase, signals
from django.test.utils import override_settings
from django.utils import... | waseem18/oh-mainline | vendor/packages/Django/tests/regressiontests/settings_tests/tests.py | Python | agpl-3.0 | 12,386 | 0.00113 |
# This file is part of the Shapy Project.
# Licensing information can be found in the LICENSE file.
# (C) 2015 The Shapy Team. All rights reserved.
import StringIO
from pyrr.objects import Quaternion, Matrix44, Vector3, Vector4
class Scene(object):
"""Class representing a whole scene."""
class Object(object):
... | ICShapy/shapy | shapy/scene.py | Python | mit | 5,133 | 0.011884 |
__author__ = 'Cosmin Popescu'
| vim-scripts/Vim-SQL-Workbench | resources/py/lib/__init__.py | Python | gpl-3.0 | 30 | 0 |
# Opus/UrbanSim urban simulation software.
# Copyright (C) 2005-2009 University of Washington
# See opus_core/LICENSE
from urbansim.configs.hlcm_estimation_config import HLCMEstimationConfig
from psrc_parcel.configs.baseline_estimation import BaselineEstimation
from opus_core.session_configuration import Sessio... | christianurich/VIBe2UrbanSim | 3rdparty/opus/src/inprocess/bhylee/hlcm_parcel_estimation.py | Python | gpl-2.0 | 6,635 | 0.008742 |
"""
**GitHubAccount**
Represents an account at GitHub.
- Matches a link that looks like it goes to a GitHub profile page.
- Returns the "your site" URL from the user's GitHub profile.
- Use on the command line: ``github:username``.
"""
from __future__ import print_function, division
import re
import requests
from l... | brenns10/social | social/accounts/github.py | Python | bsd-3-clause | 2,234 | 0.000895 |
# -*- coding: UTF-8 -*-
import pytest
from mcm.comparators import UniqueKeyComparator, SingleElementComparator, OrderedComparator
from mcm.datastructures import CmdPathRow
@pytest.fixture
def compare_data(request):
single = {
'wanted':CmdPathRow({"primary-ntp":"1.1.1.1"}),
'present':CmdPathRow({... | luqasz/mcm | tests/integration/test_compare.py | Python | gpl-2.0 | 4,109 | 0.010465 |
"""
Module that handles the loading of parsers
written by Glenn De Backer < glenn at simplicity dot be>
License: GPLv2
"""
import glob
import os
class LoaderParsers(object):
""" Parsers loader class """
def __init__(self):
""" Default constructor """
self.available_parsers = {}
... | simplicitylab/doc2source | modules/loader_parsers.py | Python | gpl-2.0 | 2,064 | 0.001453 |
#!/usr/bin/env python3
#
# Copyright 2020 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 l... | openstack-infra/project-config | roles/copy-wheels/files/wheel-indexer.py | Python | apache-2.0 | 4,718 | 0 |
import py
html = py.xml.html
class my(html):
"a custom style"
class body(html.body):
style = html.Style(font_size = "120%")
class h2(html.h2):
style = html.Style(background = "grey")
class p(html.p):
style = html.Style(font_weight="bold")
doc = my.html(
my.head(),
my.... | youtube/cobalt | third_party/web_platform_tests/tools/py/doc/example/genhtmlcss.py | Python | bsd-3-clause | 426 | 0.014085 |
# -*- coding: UTF-8 -*-
logger.info("Loading 15 objects to table cal_recurrentevent...")
# fields: id, start_date, start_time, end_date, end_time, name, user, every_unit, every, monday, tuesday, wednesday, thursday, friday, saturday, sunday, max_events, event_type, description
loader.save(create_cal_recurrentevent(1,da... | lino-framework/welfare | lino_welfare/projects/gerd/tests/dumps/18.8.0/cal_recurrentevent.py | Python | agpl-3.0 | 3,162 | 0.099937 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.5 on 2017-06-16 19:25
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('silo', '0013_deletedsilos'),
]
operations = [
... | mercycorps/TolaTables | silo/migrations/0014_formulacolumnmapping.py | Python | gpl-2.0 | 815 | 0.002454 |
from django.conf import settings
from django.conf.urls import url
from .views import get_summoner_v3, live_match, test_something, live_match_detail, FrontendAppView, ApiLiveMatch, ChampionInfoView
urlpatterns = [
url(r'^summoner/', get_summoner_v3, name='summoner_lookup'),
url(r'^live/$', live_match, name='liv... | belleandindygames/league | league/champ_chooser/urls.py | Python | mit | 756 | 0.006614 |
import pygame, sys, os, random
from classes import *
from pygame.locals import *
blocksFile = "blocks.txt"
thisBlock = ""
allBlocks = []
boardWidth = 15
boardHeight = 20
gameOver = False
# Make all the blocks which are in file "blocks.txt"
file = open(blocksFile, "r")
while file:
line = file.readline()
if l... | MadMac/PyTetris | src/main/main.py | Python | mit | 1,650 | 0.004848 |
"""Resets the password for virtual machine. The virtual machine must be in a "Stopped" state and the template must already support this feature for this command to take effect. [async]"""
from baseCmd import *
from baseResponse import *
class resetPasswordForVirtualMachineCmd (baseCmd):
typeInfo = {}
def __i... | MissionCriticalCloud/marvin | marvin/cloudstackAPI/resetPasswordForVirtualMachine.py | Python | apache-2.0 | 24,253 | 0.00099 |
"""
Java
====
Installs Java, currently restricted to version 7.
**Fabric environment:**
.. code-block:: yaml
blueprints:
- blues.java
"""
from fabric.decorators import task
from refabric.api import run, info
from refabric.context_managers import sudo
from . import debian
__all__ = ['setup']
@task
de... | 5monkeys/blues | blues/java.py | Python | mit | 1,149 | 0.001741 |
# 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 (t... | apache/allura | Allura/allura/tests/test_tasks.py | Python | apache-2.0 | 28,836 | 0.001149 |
00000 0 output/setDirected.py.err
13678 1 output/setDirected.py.out
| Conedy/Conedy | testing/network/expected/sum_setDirected.py | Python | gpl-2.0 | 76 | 0 |
"""
Decorators
"""
from __future__ import unicode_literals
from functools import wraps
from django.http import HttpResponseBadRequest
from django.utils.decorators import available_attrs
from django_ajax.shortcuts import render_to_json
def ajax(function=None, mandatory=True, **ajax_kwargs):
"""
Decorator wh... | furious-luke/django-ajax | django_ajax/decorators.py | Python | mit | 2,485 | 0.000805 |
# -*- 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-dialogflow | samples/generated_samples/dialogflow_v2beta1_generated_entity_types_delete_entity_type_sync.py | Python | apache-2.0 | 1,440 | 0.000694 |
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
from __future__ import unicode_literals
import frappe
import HTMLParser
import smtplib, quopri
from frappe import msgprint, throw, _
from frappe.email.smtp import SMTPServer, get_outgoing_email_account
from frappe.email... | rohitwaghchaure/frappe | frappe/email/queue.py | Python | mit | 16,756 | 0.028408 |
#!/usr/bin/env python
'''
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")... | arenadata/ambari | ambari-server/src/main/resources/scripts/configs.py | Python | apache-2.0 | 13,921 | 0.014726 |
""" Profile module
"""
from operator import itemgetter
from cProfile import Profile
from SpeedIT.ProjectErr import Err
from SpeedIT.Utils import (
format_time,
get_table_rst_formatted_lines
)
def _profile_it(func, func_positional_arguments, func_keyword_arguments, name, profileit__max_slashes_fileinfo, profile... | peter1000/SpeedIT | SpeedIT/ProfileIT.py | Python | bsd-3-clause | 7,430 | 0.012115 |
##########################################################################
#
# Copyright (c) 2013, Image Engine Design Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistrib... | goddardl/gaffer | python/GafferSceneUI/SceneSwitchUI.py | Python | bsd-3-clause | 2,393 | 0.009611 |
########
# Copyright (c) 2014 GigaSpaces Technologies Ltd. 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... | cloudify-cosmo/cloudify-plugins-common | cloudify/tests/test_context.py | Python | apache-2.0 | 26,770 | 0 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# vim: ai ts=4 sts=4 et sw=4 nu
from __future__ import (unicode_literals, absolute_import,
division, print_function)
import logging
from django.core.management.base import BaseCommand
from optparse import make_option
from py3compat import PY2
from... | yeleman/snisi | snisi_maint/management/commands/entities_to_cascades.py | Python | mit | 2,414 | 0 |
#!/usr/bin/env python
# Copyright 2015 Jason Edelman <jason@networktocode.com>
# Network to Code, 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/LI... | joergullrich/virl-lab | library/ntc_reboot.py | Python | gpl-3.0 | 6,997 | 0.001572 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import django.utils.timezone
import jsonfield.fields
from django.conf import settings
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL)... | peterbe/headsupper | headsupper/base/migrations/0001_initial.py | Python | mpl-2.0 | 2,093 | 0.002389 |
from flask_sqlalchemy import SQLAlchemy
from sqlalchemy import Table, Column, Integer, ForeignKey
from sqlalchemy.orm import relationship
from models.base import Base, get_or_create
db = SQLAlchemy()
class Group(Base):
__tablename__ = 'group'
id = db.Column(db.String(50), unique=True, primary_key=True)
subscr... | blackmad/snippets | models/group.py | Python | apache-2.0 | 556 | 0.017986 |
# wikirandom.py: Functions for downloading random articles from Wikipedia
#
# Copyright (C) 2010 Matthew D. Hoffman
#
# 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 Lic... | ygenc/onlineLDA | wikirandom.py | Python | gpl-3.0 | 5,021 | 0.00478 |
# Copyright 2017 Cloudbase Solutions Srl
# 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 r... | openstack/compute-hyperv | compute_hyperv/nova/conf.py | Python | apache-2.0 | 3,933 | 0 |
import unittest
import os
from bubi.mapper import DefaultMapper
class DefaultMapperTestCase(unittest.TestCase):
def setUp(self):
self.mapper = DefaultMapper(colorize=False)
self.color_mapper = DefaultMapper(colorize=True)
# test the map method without color
def test_mapping(self):
... | be-ndee/bubi-lang | tests/test_default_mapper.py | Python | mit | 1,127 | 0 |
# Copyright 2009-2015 Eucalyptus Systems, Inc.
#
# Redistribution and use of this software 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 copyright notice,
# this list of conditions ... | vasiliykochergin/euca2ools | euca2ools/commands/iam/listaccountpolicies.py | Python | bsd-2-clause | 3,688 | 0 |
'''Base module to handle the collection and the output of statistical data.'''
import logging
import time
import multiprocessing as mp
import queue
from collections import Counter
log = logging.getLogger(__name__)
current_milli_time = lambda: int(round(time.time() * 1000))
def is_number(val):
'''Function to ch... | vrde/logstats | logstats/base.py | Python | mit | 3,761 | 0.000532 |
# Message Analyzer
# Demonstrates the len() function and the in operator
message = input("Enter a message: ")
print("\nThe length of your message is:", len(message))
print("\nThe most common letter in the English language, 'e',")
if "e" in message:
print("is in your message.")
else:
print("is not in your message."... | rob-nn/python | first_book/message_analyzer.py | Python | gpl-2.0 | 365 | 0.005479 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.