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 gravity.tae.match import lev_distance
from gravity.tae import distance
from gravity.tae.match.c_lev_distance import fLevDistanceDiag
from gravity.tae.match.c_lev_distance import fLevPath
s1 = "Test Den Haag entity"
s2 = "Test Den Haag entity"
m1 = fLevDistanceDiag(2).matrix(s1, s2, 111)
print m1.toString(s1, ... | vfulco/scalpel | samples/clev_sample_2.py | Python | lgpl-3.0 | 885 |
from __future__ import print_function
import json
import os
import numpy as np
import sys
import h5py
from gensim.models import Word2Vec
from gensim.utils import simple_preprocess
from keras.engine import Input
from keras.layers import Embedding, merge
from keras.models import Model
from keras.models import Sequential
... | nishant-jain-94/Autofill | src/lstm-2-1024-512-batchsize-128-epochs-25-acc%3D1.py | Python | gpl-3.0 | 4,277 |
from django.contrib import admin
from sorl.thumbnail.admin import AdminImageMixin
from events.models import Event
class EventAdmin(AdminImageMixin, admin.ModelAdmin):
# use objects instead of the default manager
def queryset(self, request):
# use our manager, rather than the default one
qs ... | jbergantine/django-events | events/admin.py | Python | mit | 852 |
# -*- coding: utf-8 -*-
"""
Default Controllers
"""
module = "default"
# -----------------------------------------------------------------------------
def call():
"Call an XMLRPC, JSONRPC or RSS service"
# If webservices don't use sessions, avoid cluttering up the storage
#session.forget()
return... | flavour/iscram | controllers/default.py | Python | mit | 32,108 |
from logging import info, warning as warn
from servi.command import Command
from servi.exceptions import ServiError
from servi.template_mgr import TemplateManager
from servi.command import process_and_run_command_line as servi_run
"""
Logic:
* Error if
* Master is changed and template is changed (and not... | rr326/servi | servi/commands/update.py | Python | mit | 2,813 |
# Time-stamp: <2016-03-15 Tue 19:11:36 Shaikh>
# -*- coding: utf-8 -*-
import sys
import time
f = None
try:
f = open("poem.txt")
# Our usual file-reading idiom
while True:
line = f.readline()
if len(line) == 0:
break
print(line, end='', flush=True)
# sys.stdout.... | SyrakuShaikh/python | learning/a_byte_of_python/exceptions_finally.py | Python | gpl-3.0 | 650 |
import os
import sys
import shutil
if os.name == "nt":
SLASH = "\\"
else:
SLASH = "/"
CWD = os.path.dirname(os.path.realpath(__file__)) + SLASH
os.chdir(CWD)
def list_folder():
for directory in os.scandir(CWD):
if os.path.isdir(directory):
if not ".git" in str(directo... | WhosMyName/MangaFoxCatcher | cbzarchiver.py | Python | gpl-3.0 | 1,126 |
# -*- coding: utf-8 -*-
"""
Liquid is a form management tool for web frameworks.
Copyright (C) 2014, Bence Faludi (b.faludi@mito.hu)
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... | bfaludi/liquid4m | liquid4m/state.py | Python | gpl-3.0 | 5,432 |
#!/usr/bin/env python
from __future__ import print_function
from __future__ import absolute_import
from __future__ import division
import sys
from DIRAC.Core.Base import Script
from DIRAC.Core.Utilities.DIRACScript import DIRACScript
__RCSID__ = "$Id$"
@DIRACScript()
def main():
Script.parseCommandLine(ignoreErro... | yujikato/DIRAC | src/DIRAC/FrameworkSystem/scripts/dirac_monitoring_get_components_status.py | Python | gpl-3.0 | 1,633 |
# coding=utf-8
# Copyright 2022 The Google Research 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 applicab... | google-research/google-research | demogen/models/get_model.py | Python | apache-2.0 | 1,997 |
# Copyright (c) 2017 The Khronos Group 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 ... | nikoladimitroff/Zmey | Tools/BlenderPlugins/scripts/addons/io_scene_gltf2/gltf2_get.py | Python | mit | 11,682 |
# PID controller
# Author: Kannan K Puthuval, University of Illinois, kputhuva@illinois.edu
# Updated: 2014-10-03
# Description: This provides an implementation of PID control.
# Dependencies: xml
# To do
# handle scheduling
import xml.etree.ElementTree as ET
class PID:
def __init__(self,target=0,kP=0,kI=0,kD=0,ou... | kannanputhuval/fumigator | PID.py | Python | gpl-2.0 | 1,462 |
#!/usr/bin/env python3
import unittest
import seasons
class NamingSchemeTestCase(unittest.TestCase):
testep = seasons.Episode('Dragon Ball Super',
5,
'dbs.s1.e5.mp4',
extension='mp4')
def test_series_title(self):
... | t-sullivan/rename-TV | test.py | Python | mit | 1,397 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
import common
import main_viacom
SITE = "logotv"
NAME = "LogoTV"
ALIAS = ["Logo"]
DESCRIPTION = "Logo TV is an American digital cable and satellite television channel that is owned by Viacom Media Networks. The channel focuses on lifestyle programming aimed primarily at lesbia... | moneymaker365/plugin.video.ustvvod | resources/lib/stations/logotv.py | Python | gpl-2.0 | 811 |
#!/usr/bin/env python
# The Gedit XML Tools plugin provides many useful tools for XML development.
# Copyright (C) 2008 Simon Wenner, Copyright (C) 2012 Jono Finger
#
# 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
... | jonocodes/gedit-xmltools | xmltools.py | Python | gpl-3.0 | 10,152 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# bts_tools - Tools to easily manage the bitshares client
# Copyright (c) 2014 Nicolas Wack <wackou@gmail.com>
#
# 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 Softwa... | wackou/bts_tools | bts_tools/frontend.py | Python | gpl-3.0 | 3,547 |
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
import frappe
def execute():
frappe.reload_doc('manufacturing', 'doctype', 'job_card_time_log')
if (frappe.db.table_exists("Job Card")
and frappe.get_meta("Job Card").has_f... | mhbu50/erpnext | erpnext/patches/v11_1/make_job_card_time_logs.py | Python | gpl-3.0 | 1,348 |
from waldur_core.core import WaldurExtension
class AuthSocialExtension(WaldurExtension):
@staticmethod
def django_app():
return 'waldur_auth_social'
@staticmethod
def django_urls():
from .urls import urlpatterns
return urlpatterns
@staticmethod
def celery_tasks():
... | opennode/waldur-mastermind | src/waldur_auth_social/extension.py | Python | mit | 602 |
'''Simple example of using the SWIG generated TWS wrapper to request historical
data from interactive brokers.
Note:
* Communication with TWS is asynchronous; requests to TWS are made through the
EPosixClientSocket class and TWS responds at some later time via the functions
in our EWrapper subclass.
* If you're using ... | Komnomnomnom/swigibpy | examples/historicaldata.py | Python | bsd-3-clause | 3,675 |
import csv
import pandas
import django
from django.conf import settings
from django.contrib import admin
from django.http import HttpResponse, HttpResponseForbidden
from builtins import str as text
def export_as_csv(admin_model, request, queryset):
"""
Generic csv export admin action.
based on http://dj... | rochapps/django-csv-exports | django_csv_exports/admin.py | Python | bsd-2-clause | 2,837 |
import os
import webapp2
from google.appengine.ext.webapp import template
import datetime
import time
import urllib
import wsgiref.handlers
import csv
import logging
from google.appengine.ext import db
from google.appengine.api import users
from busyflow.pivotal import PivotalClient
from xml.sax.saxutils import escap... | xtopherbrandt/pivotalpdf | pivotal_pdf_input.py | Python | gpl-2.0 | 8,838 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.1 on 2016-01-12 06:45
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('contest', '0002_auto_20160112_0642'),
]
operations = [
migrations.AddField(
... | azuer88/tabulator | tabulator/contest/migrations/0003_candidate_gender.py | Python | gpl-3.0 | 541 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Pepi documentation build configuration file, created by
# sphinx-quickstart on Thu Aug 31 17:00:06 2017.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# autog... | curtiswest/pepi | docs/conf.py | Python | apache-2.0 | 5,971 |
from django.db import models
from django.contrib.auth.models import User
from django.utils.translation import ugettext_lazy as _
from random import choice
from string import ascii_uppercase, digits
# Create your models here.
def id_generator(size=8, chars=ascii_uppercase + digits):
return ''.join(choic... | apy2017/Anaconda | techbot_web/poll_editor/models.py | Python | mit | 2,362 |
# Authors:
# Rob Crittenden <rcritten@redhat.com>
#
# Copyright (C) 2011 Red Hat
# see file 'COPYING' for use and warranty information
#
# 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... | cluck/freeipa | ipalib/plugins/selinuxusermap.py | Python | gpl-3.0 | 19,617 |
"""allow bash-completion for argparse with argcomplete if installed
needs argcomplete>=0.5.6 for python 3.2/3.3 (older versions fail
to find the magic string, so _ARGCOMPLETE env. var is never set, and
this does not need special code.
argcomplete does not support python 2.5 (although the changes for that
are minor).
... | razvanc-r/godot-python | tests/bindings/lib/_pytest/_argcomplete.py | Python | mit | 3,624 |
# Copyright (C) 2008, One Laptop Per Child
# Copyright (C) 2009 Simon Schampijer
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any late... | samdroid-apps/browse | edittoolbar.py | Python | gpl-2.0 | 5,982 |
from csv import reader
import random
import time
def getRandomBloodType():
bloodTypes = ['A+', 'A-', "B+", "B-", "AB+", "AB-", "O+", "O-"]
index = random.randrange(len(bloodTypes))
return bloodTypes[index]
def strTimeProp(start, end, format, prop):
stime = time.mktime(time.strptime(start, format))
... | tburgebeckley/phlebotomy | p4/pyscript/buildPatients.py | Python | gpl-3.0 | 924 |
# Copyright 2012 Pinterest.com
# -*- coding: utf-8 -*-
#
# 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 ... | bwalks/pymemcache | pymemcache/test/test_integration.py | Python | apache-2.0 | 8,843 |
import os
import sys
from distutils.core import setup
import py2exe
origIsSystemDLL = py2exe.build_exe.isSystemDLL
def isSystemDLL(pathname):
dlls = ("libfreetype-6.dll", "libogg-0.dll", "sdl_ttf.dll")
if os.path.basename(pathname).lower() in dlls:
return 0
return origIsSystemDLL(pathna... | Yaoshicn/FlappyFrog | setup.py | Python | gpl-3.0 | 789 |
#!/usr/bin/env python3
# -*- coding: utf8; -*-
#
# Copyright (C) 2016 : Kathrin Hanauer
#
# This file is part of texpy (TexWithPython).
#
# 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... | kalyi/TexWithPython | src/texpy/latexdocument.py | Python | gpl-3.0 | 4,984 |
# -*- encoding: utf-8 -*-
from django import forms
from models import *
"""
Classes
"""
class LoginForm(forms.Form):
username = forms.CharField(
widget=forms.TextInput(attrs={
'class': 'form-control', 'placeholder': 'Usuario'})
)
password = forms.CharField(
widget=forms.Passw... | alfegupe/retro | retrospective/forms.py | Python | bsd-3-clause | 3,446 |
import pygame
from OpenGL.GL import *
from OpenGL.GLU import *
import camera
def main():
pygame.init()
display=(1280,720)
pygame.display.set_mode(display, DOUBLEBUF|OPENGL)
gluPerspective(70, (display[0]/display[1]), 0.1, 150000000)#camera distance maximum is one AU, we may change.
camera.Camera(... | baldengineers/space-engine | mainloop.py | Python | mit | 1,574 |
# Copyright (c) 2014-2016, NVIDIA CORPORATION. All rights reserved.
from __future__ import absolute_import
from collections import OrderedDict, namedtuple
import os.path
import time
import flask
import gevent
import psutil
from digits import device_query
from digits.task import Task
from digits.utils import subclas... | TimZaman/DIGITS | digits/model/tasks/train.py | Python | bsd-3-clause | 21,893 |
__author__ = 'shyue'
| materialsvirtuallab/pyhull | pyhull/tests/__init__.py | Python | mit | 21 |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals
from base import GAETestCase
from gaepermission import facade
from mock import Mock, patch
from routes.login import google, facebook
import settings
from tekton.gae.middleware.redirect import RedirectResponse
class IndexTests(GAETestCase... | renzon/tekton | backend/test/login_tests/facebook.py | Python | mit | 1,801 |
import copy
import datetime
import decimal
import math
import warnings
from itertools import tee
from django.db import connection
from django.db.models.query_utils import QueryWrapper
from django.conf import settings
from django import forms
from django.core import exceptions, validators
from django.utils.datastructur... | leereilly/django-1 | django/db/models/fields/__init__.py | Python | bsd-3-clause | 47,225 |
import threading, time
from sqlalchemy import pool, interfaces, select, event
import sqlalchemy as tsa
from sqlalchemy import testing
from sqlalchemy.testing.util import gc_collect, lazy_gc
from sqlalchemy.testing import eq_, assert_raises
from sqlalchemy.testing.engines import testing_engine
from sqlalchemy.testing im... | rclmenezes/sqlalchemy | test/engine/test_pool.py | Python | mit | 37,265 |
from __future__ import division, print_function, absolute_import
import itertools
import warnings
from numpy.testing import (assert_, assert_equal, assert_almost_equal,
assert_array_almost_equal, assert_raises, assert_array_equal,
dec, TestCase, run_module_suite, assert_allclose)
from numpy import mgr... | nvoron23/scipy | scipy/interpolate/tests/test_interpolate.py | Python | bsd-3-clause | 63,394 |
"""Routes configuration
The more specific and detailed routes should be defined first so they
may take precedent over the more generic routes. For more information
refer to the routes manual at http://routes.groovie.org/docs/
"""
from routes import Mapper
def make_map(config):
"""Create, configure and return the ... | kopf/porick | porick/config/routing.py | Python | apache-2.0 | 3,710 |
# Copyright 2008-2015 Canonical
#
# 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 Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed... | zhsso/ubunto-one | lib/config.py | Python | agpl-3.0 | 1,777 |
"""
"Alpha function" synapse of Rall. Chapter 12.2
"""
from __future__ import division
from PyDSTool import *
from PyDSTool.Toolbox.phaseplane import *
from common_lib import *
icdict = {'a1': 0, 'a2': 0}
pardict = {'tau_syn': 2, 'vthresh': -10,
'vpre': -80}
DSargs = args()
DSargs.name = 'alpha_syn'
DSar... | robclewley/compneuro | alpha_syn.py | Python | bsd-3-clause | 1,936 |
# -*- coding: utf-8 -*-
#
# vinit_example.py
#
# This file is part of NEST.
#
# Copyright (C) 2004 The NEST Initiative
#
# NEST 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, ... | kristoforcarlson/nest-simulator-fork | pynest/examples/vinit_example.py | Python | gpl-2.0 | 2,868 |
import os, scrapy, argparse
from realclearpolitics.spiders.spider import RcpSpider
from scrapy.crawler import CrawlerProcess
parser = argparse.ArgumentParser('Scrap realclearpolitics polls data')
parser.add_argument('url', action="store")
parser.add_argument('--locale', action="store", default='')
parser.add_argument('... | dpxxdp/berniemetrics | private/scrapers/realclearpolitics-scraper/scraper.py | Python | mit | 1,355 |
import re
def increment_string(strng):
if all([(not x.isdigit()) for x in strng]): return strng + '1'
return re.sub('\d+$', lambda m: increment(m.group(0)), strng)
def increment(s):
num = str(int(('1' if s.startswith('0') else '') + s)+1)
return num[1:] if s.startswith('0') else num
| Orange9000/Codewars | Solutions/5kyu/5kyu_string_incrementer.py | Python | mit | 306 |
"""
API for submitting background tasks by an instructor for a course.
Also includes methods for getting information about tasks that have
already been submitted, filtered either by running state or input
arguments.
"""
import hashlib
from celery.states import READY_STATES
from xmodule.modulestore.django import mod... | XiaodunServerGroup/ddyedx | lms/djangoapps/instructor_task/api.py | Python | agpl-3.0 | 10,240 |
# coding=utf-8
# Copyright 2022 The Google Research 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 applicab... | google-research/google-research | model_pruning/examples/cifar10/cifar10_input.py | Python | apache-2.0 | 9,542 |
import os
import argparse
import cPickle
import operator
import itertools
from Common.psteff import *
def rerank(model_file, ctx_file, rnk_file, \
score=False, no_normalize=False, fallback=False):
pst = PSTInfer()
pst.load(model_file)
output_file = open(rnk_file + "_ADJ" + (".f" if score else ".... | sordonia/hed-qs | baselines/ADJ/adj_rerank.py | Python | bsd-3-clause | 1,124 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import re
import sys
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
def get_version(*file_paths):
"""Retrieves the version from elasticsearch_flex/__init__.py"""
filename = os.path.join(os.path.dirname(__f... | prashnts/dj-elasticsearch-flex | setup.py | Python | mit | 2,493 |
"""Test mysql db upgrade"""
# pylint: disable=invalid-name,line-too-long
import pytest
import srv_msg
import misc
import srv_control
from forge_cfg import world
# 1.6.3 version is our starting point here. In 1.6.0 CB backend was introduced in mysql
# but there were no changes in schema between 1.6.0 and 1.6.3. In t... | isc-projects/forge | tests/dhcpv6/db_upgrade/test_db_mysql_upgrade.py | Python | isc | 15,807 |
from __future__ import unicode_literals
import unittest
from test_plus.test import TestCase
from ..factories import MangaFactory
from ...models import Manga
class MangaViewsTest(TestCase):
def setUp(self):
MangaFactory.reset_sequence(0)
for i in range(4):
MangaFactory()
def t... | leonardoo/lemanga | apps/manga/tests/views/test_manga.py | Python | mit | 1,152 |
"""FHIR namespaced endpoints, such as local valuesets"""
from flask import Blueprint, jsonify
from ..system_uri import NHHD_291036, TRUENTH_VALUESET_NHHD_291036
fhir_api = Blueprint('fhir_api', __name__, url_prefix='/fhir')
@fhir_api.route('/valueset/{}'.format(NHHD_291036))
def valueset_nhhd_291036():
"""Retur... | uwcirg/true_nth_usa_portal | portal/views/fhir.py | Python | bsd-3-clause | 2,386 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.6 on 2016-06-06 17:08
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('store', '0001_initial'),
]
operations = [
migrations.RenameField(
model_... | IVaN4B/maugli | maugli/store/migrations/0002_auto_20160606_2008.py | Python | gpl-3.0 | 696 |
import os
PROJECT_DIR = os.path.dirname(os.path.abspath(__file__))
SCREENSHOT_PATH = None
OPENGL = {
"version": (3, 3),
}
WINDOW = {
"class": "demosys.context.pyqt.Window",
"size": (1280, 720),
"aspect_ratio": 16 / 9,
"fullscreen": False,
"resizable": True,
"title": "Examples",
"vsync... | Contraz/demosys-py | examples/settings.py | Python | isc | 487 |
#TODO:
# -Implement Clebsch-Gordan symmetries
# -Improve simplification method
# -Implement new simpifications
"""Clebsch-Gordon Coefficients."""
from sympy import Add, expand, Eq, Expr, Function, Mul, Piecewise, Pow, sqrt, Sum, symbols, sympify, Wild
from sympy.printing.pretty.stringpict import prettyForm, stringPict... | Cuuuurzel/KiPyCalc | sympy_old/physics/quantum/cg.py | Python | mit | 17,738 |
# To run (bash):
# python DESCalSpec.py > DESCalSpec.log 2>&1 &
#
# To run (tcsh):
# python DESCalSpec.py >& DESCalSpec.log &
#
# (In both cases, be sure to edit calspecDir
# and bandsDir below to their locations on
# your machine.)
# DLT, 2017-06-06
# based in part on scripts by Jack Mueller and Jacob Robertson.
#... | DESatAPSU/DAWDs | python/DESCalSpec.py | Python | mit | 4,676 |
# Copyright (C) 2005 Johan Dahlin
#
# 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 2
# of the License, or (at your option) any later version.
#
# This program is distribut... | MartinSoto/Seamless | src/gazpacho/loader/loader.py | Python | gpl-2.0 | 27,770 |
from flask import Blueprint, jsonify, render_template, request, redirect, url_for, abort
from model import Course, Review
mod = Blueprint('courses', __name__, url_prefix='/courses')
@mod.route("/")
def index():
#print "Courses route worked"
return render_template('courses/courses.html')
@mod.route('/<string:course... | umarmiti/COMP-4350--Group-8 | cris/courses/controller.py | Python | mit | 2,440 |
#!../../../../virtualenv/bin/python3
# -*- coding: utf-8 -*-
# NB: The shebang line above assumes you've installed a python virtual environment alongside your working copy of the
# <4most-4gp-scripts> git repository. It also only works if you invoke this python script from the directory where it
# is located. If these... | dcf21/4most-4gp-scripts | src/scripts/synthesize_samples/synthesize_ges_dwarfs.py | Python | mit | 4,751 |
from south.db import db
from django.db import models
from treepages.models import *
class Migration:
def forwards(self, orm):
# Deleting field 'Page.template'
db.delete_column('treepages_page', 'template')
def backwards(self, orm):
# Adding fie... | scotu/django-treepages | treepages/migrations/0002_no_selectable_template.py | Python | mit | 4,758 |
import json
from django import forms
from django.forms import widgets
from django.template.loader import render_to_string
from django.urls import reverse
from django.utils.translation import gettext_lazy as _
from wagtail.admin.staticfiles import versioned_static
from wagtail.core.models import Page
from wagtail.util... | kaedroho/wagtail | wagtail/admin/widgets/chooser.py | Python | bsd-3-clause | 6,255 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.4 on 2017-02-16 08:13
from __future__ import unicode_literals
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
import orgsema.models
class Migration(migrations.Migration):
initial = True
dependencie... | mbranko/kartonpmv | orgsema/migrations/0001_initial.py | Python | mit | 7,463 |
#------------------------------------------------------------------------------
# Copyright (c) 2005, Enthought, Inc.
# All rights reserved.
#
# This software is provided without warranty under the terms of the BSD
# license included in enthought/LICENSE.txt and may be redistributed only
# under the conditions describe... | pankajp/pyface | pyface/ui/wx/grid/combobox_focus_handler.py | Python | bsd-3-clause | 4,285 |
"""
=========================================================================
2 samples permutation test on source data with spatio-temporal clustering
=========================================================================
Tests if the source space data are significantly different between
2 groups of subjects (simu... | teonlamont/mne-python | tutorials/plot_stats_cluster_spatio_temporal_2samp.py | Python | bsd-3-clause | 4,494 |
# -*- encoding: utf-8 -*-
#############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2012-Today Serpent Consulting Services Pvt. Ltd.
# (<http://www.serpentcs.com>)
# Copyright (C) 2004 OpenERP SA (<http://www.openerp.com>)
#
# ... | MarcosCommunity/odoo | comunity_modules/report_hotel_restaurant/__openerp__.py | Python | agpl-3.0 | 1,798 |
from __future__ import unicode_literals
from .conf import get_settings
globals().update(
get_settings(
'general.yml-example',
election_app='kenya',
tests=True,
),
)
NOSE_ARGS += ['-a', 'country=kenya']
| mysociety/yournextrepresentative | mysite/settings/tests_kenya.py | Python | agpl-3.0 | 237 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2012 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.ap... | tylertian/Openstack | openstack F/nova/nova/virt/hyperv/livemigrationops.py | Python | apache-2.0 | 6,665 |
import pandas as pd
import numpy as np
print(pd.__version__)
# 1.0.0
print(pd.DataFrame.agg is pd.DataFrame.aggregate)
# True
df = pd.DataFrame({'A': [0, 1, 2], 'B': [3, 4, 5]})
print(df)
# A B
# 0 0 3
# 1 1 4
# 2 2 5
print(df.agg(['sum', 'mean', 'min', 'max']))
# A B
# sum 3.0 12.0
# mean ... | nkmk/python-snippets | notebook/pandas_agg.py | Python | mit | 4,230 |
import astropy.io.fits
import matplotlib.pyplot as plt
import numpy as np
import os
REPO_DIR = '/Users/Jake/Research/code/m31flux'
def log10(val):
return np.where(val > 0, val, np.nan)
def plot_map(data, outfile, label, limits, stretch, cmap):
fig_dx = 6.0
ax2_dy = 0.15
data = data[::-1].T # rot... | jesaerys/m31flux | scripts/figs.py | Python | mit | 5,305 |
"""
Test for using a configuration file
"""
import os
import unittest
import tempfile
import logging
import scitokens
import scitokens.utils.config
from six.moves import configparser
class TestConfig(unittest.TestCase):
"""
Test the configuration parsing
"""
def setUp(self):
self.dir_path = ... | scitokens/scitokens | tests/test_config.py | Python | apache-2.0 | 2,589 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.6 on 2017-04-25 00:10
from __future__ import unicode_literals
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
import filer.fields.file
class Migration(migrations.Migration):
initial = True
dependen... | django-danceschool/django-danceschool | danceschool/financial/migrations/0002_auto_20170425_0010.py | Python | bsd-3-clause | 3,541 |
# Copyright 2007 Google Inc.
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the ho... | UPPMAX/nsscache | nss_cache/sources/source_factory_test.py | Python | gpl-2.0 | 2,150 |
import os
import sys
from erosionbase import ErosionBase
from grass.script.core import run_command, parse_command
class ErosionUSLE(ErosionBase):
def __init__(self, data, factors, epsg='5514', location_path=None,
computeStat=None, computeError=None):
"""USLE constructor.
Two mod... | ctu-geoforall-lab/qgis-soil-erosion-plugin | pyerosion/erosionusle.py | Python | gpl-3.0 | 6,920 |
"""Methods to handle times"""
import time
def now():
"""Current time
This method exists only to save other modules an extra import
"""
return time.time()
def time_since(number_of_seconds):
"""Convert number of seconds to English
Retain only the two most significant numbers
>>> expect... | jalanb/kd | cde/timings.py | Python | mit | 1,061 |
"""Exceptions for the monitoring app."""
class MonitoringRegistryException(Exception):
pass
| bitmazk/django-monitoring | monitoring/exceptions.py | Python | mit | 98 |
from sqlagg.columns import SimpleColumn
from corehq.apps.reports.datatables import DataTablesHeader, DataTablesColumnGroup
from corehq.apps.reports.generic import GenericTabularReport
from corehq.apps.reports.sqlreport import DatabaseColumn
from corehq.apps.reports.standard import DatespanMixin, CustomProjectReport
fro... | qedsoftware/commcare-hq | custom/up_nrhm/reports/district_functionality_report.py | Python | bsd-3-clause | 3,729 |
from django.db import models
from django.contrib.auth.models import User
class Language(models.Model):
name = models.CharField('Name', max_length=50, unique=True,
null=False, blank=False)
def __unicode__(self):
return self.name
class Tag(models.Model):
name = models.... | swones/swa | swa/web/models.py | Python | mit | 1,089 |
# -*- coding: utf-8 -*-
"""
Created on Thu Oct 27 07:38:35 2016
@author: msmanski
This script is used to create model surfaces on a 10000 x 10000 grid that
reflect medium NK ruggedness.
"""
from mpl_toolkits.mplot3d import axes3d
import matplotlib.pyplot as plt
import numpy as np
X = np.zeros([... | smanskiLab/pathway_optimization | Surface_Medium.py | Python | mit | 1,862 |
class A:
def test(self):
print "I##|nitializing A", "test"##|
attribute = "hello"
def my_method(self):
print self.attribute
a = A()
a.test()
##r Should expand to Full String "Initializing A"
# Invalid selection:
# nitializing A", "test" | aptana/Pydev | tests/org.python.pydev.refactoring.tests/src/python/visitor/selectionextension/testSelectionExtensionExprFail.py | Python | epl-1.0 | 286 |
import re
from cybox.objects.address_object import Address
from cybox.objects.uri_object import URI
from .text import StixTextTransform
class StixBroIntelTransform(StixTextTransform):
"""Generate observable details for the Bro Intelligence Framework.
This class can be used to generate a list of indicators ... | thisismyrobot/cti-toolkit | certau/transform/brointel.py | Python | bsd-3-clause | 5,192 |
#!/usr/bin/env python
import os, csv, sys, math, subprocess, psycopg2, viewshed
###
# Get the letters for an OS grid reference,
# Derived from http://www.movable-type.co.uk/scripts/latlong-gridref.html"
###
def getLetters(x, y):
"Get the letters for an OS grid reference."
# TODO: Validate coordinates!!
... | jonnyhuck/Viewshed | pgLOS.py | Python | gpl-3.0 | 7,481 |
from __future__ import unicode_literals
import json
from moto.swf.exceptions import (
SWFClientError,
SWFUnknownResourceFault,
SWFDomainAlreadyExistsFault,
SWFDomainDeprecatedFault,
SWFSerializationException,
SWFTypeAlreadyExistsFault,
SWFTypeDeprecatedFault,
SWFWorkflowExecutionAlread... | silveregg/moto | tests/test_swf/test_exceptions.py | Python | apache-2.0 | 4,812 |
# mako/codegen.py
# Copyright (C) 2006-2012 the Mako authors and contributors <see AUTHORS file>
#
# This module is part of Mako and is released under
# the MIT License: http://www.opensource.org/licenses/mit-license.php
"""provides functionality for rendering a parsetree constructing into module
source code."""
impo... | swangui/ggrid | mako/codegen.py | Python | mit | 48,628 |
import os
from snactor.loader import create_actor, load
from snactor.registry import get_registered_actors, must_get_actor
from snactor.utils import get_chan
class UnresolvedDependenciesError(Exception):
"""
UnresolvedDependenciesError is thrown when the dependencies between actors can't be automatically res... | leapp-to/snactor | snactor/loader/group.py | Python | apache-2.0 | 3,242 |
# coding=utf-8
import datetime
import decimal
import uuid
from hazelcast import HazelcastClient
from hazelcast.config import IntType
from hazelcast.core import HazelcastJsonValue
from hazelcast.serialization import MAX_BYTE, MAX_SHORT, MAX_INT, MAX_LONG
from tests.base import SingleMemberTestCase
from tests.hzrc.ttype... | hazelcast/hazelcast-python-client | tests/integration/backward_compatible/serialization/serializers_test.py | Python | apache-2.0 | 19,548 |
from bluebottle.bluebottle_drf2.serializers import PrimaryKeyGenericRelatedField, TagSerializer, FileSerializer, TaggableSerializerMixin
from bluebottle.accounts.serializers import UserPreviewSerializer
from apps.projects.serializers import ProjectPreviewSerializer
from apps.tasks.models import Task, TaskMember, TaskFi... | gannetson/sportschooldeopenlucht | apps/tasks/serializers.py | Python | bsd-3-clause | 2,995 |
import json
import os
import logging
import logging.config
"""Order 15: Use logging with generate log files.
In this sample:
Logging config: dependency/logging.json
Info logging file: dependency/logs/info.log
Error logging file: dependency/logs/error.log
"""
class LoggingSystem(object):
logging_config_file... | flyingSprite/spinelle | task_inventory/order_1_to_30/order_15_logging_system.py | Python | mit | 760 |
"""
WSGI config for metropol 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_SETT... | carborgar/metropol | metropol/wsgi.py | Python | mit | 393 |
#!/usr/bin/python
import os
import psycopg2
import sys
file = open("/home/" + os.getlogin() + "/.pgpass", "r")
pgpasses = []
for line in file:
pgpasses.append(line.rstrip("\n").split(":"))
file.close()
for pgpass in pgpasses:
#print str(pgpass)
if pgpass[0] == "54.236.235.110" and pgpass[3] == "geonode":
sr... | DOE-NEPA/geonode_2.0_to_2.4_migration | migrate_django_site.py | Python | gpl-2.0 | 1,290 |
# -*- coding: utf-8 -*-
"""Test for short_panel and panel sandwich
Created on Fri May 18 13:05:47 2012
Author: Josef Perktold
moved example from main of random_panel
"""
import numpy as np
from numpy.testing import assert_almost_equal
import numpy.testing as npt
import statsmodels.tools.eval_measures as em
from sta... | DonBeo/statsmodels | statsmodels/sandbox/panel/tests/test_random_panel.py | Python | bsd-3-clause | 5,437 |
# -*- coding: utf-8 -*-
"""Utility classes and values used for marshalling and unmarshalling objects to
and from primitive types.
.. warning::
This module is treated as private API.
Users should not need to use this module directly.
"""
from __future__ import unicode_literals
from marshmallow.utils import m... | Bachmann1234/marshmallow | marshmallow/marshalling.py | Python | mit | 11,826 |
from blinker import Namespace
namespace = Namespace()
#: Trigerred when a site's metrics job is done.
on_site_metrics_computed = namespace.signal('on-site-metrics-computed')
| etalab/udata | udata/core/metrics/signals.py | Python | agpl-3.0 | 176 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
from email.parser import Parser
from email.header import decode_header
from email.utils import parseaddr
import poplib
# 输入邮件地址, 口令和POP3服务器地址:
email = input('Email: ')
password = input('Password: ')
pop3_server = input('POP3 server: ')
def guess_charset(msg):
char... | whyDK37/py_bootstrap | samples/mail/fetch_mail.py | Python | apache-2.0 | 2,870 |
# coding: utf-8
import os
import json
from irc.client import NickMask
def on_module_loaded( self ):
if not "lewd" in self.data:
self.data[ "lewd" ] = {}
return {
"lewd": {
"description": "Give people 'lewd' points or display yours.",
"syntax": ".lewd [nick]"
}
}
def on_pubmsg( self, c, e ):
do_comm... | Spacedude/Py_SpaceBotIRC | modules/lewd.py | Python | gpl-3.0 | 1,288 |
"""
Virtualization installation functions.
Copyright 2007-2008 Red Hat, Inc.
Michael DeHaan <mdehaan@redhat.com>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or... | charles-dyfis-net/koan | koan/vmwcreate.py | Python | gpl-2.0 | 4,966 |
# -*- coding: utf-8 -*-
import math
# import warnings
import logging
import collections
from ..patch.pint import ureg
from ..math import linop
from ..math import fit1d
from ..utils import units
from ..materials import compoundfromformula
from ..materials import compoundfromname
from ..materials import multilayer
fro... | woutdenolf/spectrocrunch | spectrocrunch/detectors/diode.py | Python | mit | 76,917 |
"""
Tinman Test Application
"""
from datetime import date
import logging
from tornado import web
from tinman.handlers import SessionRequestHandler
from tinman import __version__
LOGGER = logging.getLogger(__name__)
CONFIG = {'Application': {'debug': True,
'xsrf_cookies': False},
... | lucius-feng/tinman | tinman/example.py | Python | bsd-3-clause | 2,829 |
from betamax import Betamax
from currencycloud import Client, Config
from currencycloud.resources import *
class TestTransactions:
def setup_method(self, method):
# TODO: To run against real server please delete ../fixtures/vcr_cassettes/* and replace
# login_id and api_key with valid credentials... | CurrencyCloud/currencycloud-python | tests/integration/test_transactions.py | Python | mit | 1,428 |
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "settings")
os.environ.setdefault('DJANGO_CONFIGURATION', 'Dev')
from configurations.management import execute_from_command_line
execute_from_command_line(sys.argv)
| DanielGabris/radius_restserver | src/manage.py | Python | mit | 302 |
#
# 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 us... | WindCanDie/spark | python/pyspark/streaming/kinesis.py | Python | apache-2.0 | 6,165 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.