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 |
|---|---|---|---|---|---|---|
# coding=utf-8
"""Definitions for basic report.
"""
from __future__ import absolute_import
from safe.utilities.i18n import tr
__copyright__ = "Copyright 2016, The InaSAFE Project"
__license__ = "GPL version 3"
__email__ = "info@inasafe.org"
__revision__ = '$Format:%H$'
# Meta description about component
# component... | Gustry/inasafe | safe/definitions/reports/__init__.py | Python | gpl-3.0 | 2,816 | 0 |
# 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... | nathanbjenx/cairis | cairis/controllers/ConceptReferenceController.py | Python | apache-2.0 | 3,396 | 0.00265 |
import json
import os
import shutil
import zipfile
from build import cd
def create_template(name, path, **kw):
os.makedirs(os.path.join(path, 'module'))
with open(os.path.join(path, 'module', 'manifest.json'), 'w') as manifest_file:
manifest = {
"name": name,
"version": "0.1",
"description": "My module t... | mnaughto/trigger-statusbar | .trigger/module_dynamic/module.py | Python | mit | 2,707 | 0.026967 |
"""
WSGI config for server_admin project.
This module contains the WSGI application used by Django's development server
and any production WSGI deployments. It should expose a module-level variable
named ``application``. Django's ``runserver`` and ``runfcgi`` commands discover
this application via the ``WSGI_APPLICATI... | KungFuLucky7/server_admin | server_admin/wsgi.py | Python | gpl-2.0 | 1,551 | 0.001289 |
from __future__ import absolute_import
import functools
import logging
import six
import time
from datetime import datetime, timedelta
from django.conf import settings
from django.utils.http import urlquote
from django.views.decorators.csrf import csrf_exempt
from enum import Enum
from pytz import utc
from rest_frame... | looker/sentry | src/sentry/api/base.py | Python | bsd-3-clause | 11,066 | 0.000633 |
import json
from PIL import Image
import collections
with open('../config/nodes.json') as data_file:
nodes = json.load(data_file)
# empty fucker
ordered_nodes = [None] * len(nodes)
# populate fucker
for i, pos in nodes.items():
ordered_nodes[int(i)] = [pos['x'], pos['y']]
filename = "04_rgb_vertical_lines"
i... | Ibuprofen/gizehmoviepy | gif_parsers/read_rgb.py | Python | mit | 1,281 | 0.014832 |
import os.path
from crumbs.utils.bin_utils import create_get_binary_path
from bam_crumbs.settings import get_setting
BIN_DIR = os.path.abspath(os.path.join(os.path.dirname(__file__),
'..', '..', 'bin'))
get_binary_path = create_get_binary_path(os.path.split(__file__)[0],
... | pziarsolo/bam_crumbs | bam_crumbs/utils/bin.py | Python | gpl-3.0 | 370 | 0 |
from django.contrib import admin
from .models import Line
# Register your models here.
admin.site.register(Line)
| MirzaBaig715/DjangoURLShortner | urlshortenerapp/admin.py | Python | mit | 114 | 0 |
"""
Runs peaktrough.py, which generates Cooley-Rupert figures for specified
series from FRED.
Execute peaktrough.py first, then run this program.
Written by Dave Backus under the watchful eye of Chase Coleman and Spencer Lyon
Date: July 10, 2014
"""
# import functions from peaktrough.py. * means all of them
# genera... | DaveBackus/Data_Bootcamp | Code/Lab/fred_CooleyRupert_run.py | Python | mit | 1,002 | 0.001996 |
# -*- coding: utf-8 -*-
from django.apps import AppConfig
class PostsConfig(AppConfig):
name = 'posts'
verbose_name = '图片列表'
| mittya/duoclub | duoclub/posts/apps.py | Python | mit | 144 | 0 |
#!/usr/bin/env python
#
# PyGab - Python Jabber Framework
# Copyright (c) 2008, Patrick Kennedy
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# - Redistributions of source code must r... | PatrickKennedy/pygab | common/mounts.py | Python | bsd-2-clause | 1,656 | 0.006039 |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals
from google.appengine.api.app_identity.app_identity import get_default_gcs_bucket_name
from google.appengine.ext.blobstore import blobstore
from blob_app import blob_facade
from config.template_middleware import TemplateResponse
from gaec... | renzon/appengineepython | backend/appengine/routes/updown/home.py | Python | mit | 1,716 | 0.002914 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""Tests that all containers are imported correctly."""
import unittest
from tests import test_lib
class ContainersImportTest(test_lib.ImportCheckTestCase):
"""Tests that container classes are imported correctly."""
_IGNORABLE_FILES = frozenset(['manager.py', 'int... | kiddinn/plaso | tests/containers/init_imports.py | Python | apache-2.0 | 558 | 0.007168 |
#!/usr/bin/env python3
import unittest
from gppylib.operations.test.regress.test_package import GppkgTestCase, GppkgSpec, BuildGppkg, RPMSpec, BuildRPM, run_command, run_remote_command
class SimpleGppkgTestCase(GppkgTestCase):
"""Covers simple build/install/remove/update test cases"""
def test00_simple_build... | 50wu/gpdb | gpMgmt/bin/gppylib/operations/test/regress/test_package/test_regress_simple_gppkg.py | Python | apache-2.0 | 1,745 | 0.006304 |
"""
Test basic std::vector functionality but with a declaration from
the debug info (the Foo struct) as content.
"""
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
class TestDbgInfoContentVector(TestBase):
mydir = TestBase.compute_mydir(__file__)... | apple/swift-lldb | packages/Python/lldbsuite/test/commands/expression/import-std-module/vector-dbg-info-content/TestDbgInfoContentVector.py | Python | apache-2.0 | 1,822 | 0.001098 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import sys
import inselect
REQUIREMENTS = [
# TODO How to specify OpenCV? 'cv2>=3.1.0',
'numpy>=1.11.1,<1.12',
'Pillow>=3.4.2,<3.5',
'python-dateutil>=2.6.0,<2.7',
'pytz>=2016.7',
'PyYAML>=3.12,<3.2',
'schematics>=1.1.1,<1.2',
'scikit-lea... | NaturalHistoryMuseum/inselect | setup.py | Python | bsd-3-clause | 7,651 | 0.001699 |
# -*- coding: utf-8 -*-
#
# Copyright 2012-2015 Spotify AB
#
# 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... | 17zuoye/luigi | test/parameter_test.py | Python | apache-2.0 | 25,868 | 0.002203 |
# -*- python -*-
# -*- coding: utf-8 -*-
#
# Gramps - a GTK+/GNOME based genealogy program
#
# Copyright (C) 2011-2012 Serge Noiraud
#
# 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; eithe... | pmghalvorsen/gramps_branch | gramps/plugins/lib/maps/dummylayer.py | Python | gpl-2.0 | 2,350 | 0.005106 |
import copy
import operator
from functools import wraps, update_wrapper
# You can't trivially replace this `functools.partial` because this binds to
# classes and returns bound instances, whereas functools.partial (on CPython)
# is a type and its instances don't bind.
def curry(_curried_func, *args, **kwargs):
de... | ychen820/microblog | y/google-cloud-sdk/platform/google_appengine/lib/django-1.4/django/utils/functional.py | Python | bsd-3-clause | 11,110 | 0.00144 |
# -*- coding: utf-8 -*-
## Comments and reviews for records.
## This file is part of Invenio.
## Copyright (C) 2005, 2006, 2007, 2008, 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 Softwar... | kaplun/Invenio-OpenAIRE | modules/webcomment/lib/webcomment_templates.py | Python | gpl-2.0 | 109,494 | 0.006694 |
from sopel import module
from sopel.tools import Identifier
import time
import re
TIMEOUT = 36000
@module.rule('^(</?3)\s+([a-zA-Z0-9\[\]\\`_\^\{\|\}-]{1,32})\s*$')
@module.intent('ACTION')
@module.require_chanmsg("You may only modify someone's rep in a channel.")
def heart_cmd(bot, trigger):
luv_h8(... | ridelore/sopel-modules | rep.py | Python | apache-2.0 | 4,834 | 0.008068 |
# Copyright (C) 2010 Agorabox. All Rights Reserved.
#
# 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 ... | vienin/python-ufo | ufo/notify.py | Python | gpl-2.0 | 8,320 | 0.007452 |
# Copyright The Cloud Custodian Authors.
# SPDX-License-Identifier: Apache-2.0
import base64
from datetime import datetime, timedelta
import functools
import json
import os
import time
import yaml
import jinja2
import jmespath
from dateutil import parser
from dateutil.tz import gettz, tzutc
try:
from botocore.exc... | thisisshi/cloud-custodian | tools/c7n_mailer/c7n_mailer/utils.py | Python | apache-2.0 | 16,298 | 0.000675 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.3 on 2019-11-24 03:04
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('logger', '0001_initial'),
]
operations = [
migrations.AlterField(
... | imvu/bluesteel | app/logic/logger/migrations/0002_auto_20191123_1904.py | Python | mit | 679 | 0.001473 |
#!/usr/bin/env python
############################################################################
#
# Copyright (C) 2012, 2013 PX4 Development Team. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are m... | RickHutten/paparazzi | sw/tools/px4/px_mkfw.py | Python | gpl-2.0 | 4,811 | 0.017044 |
# -*- coding: utf-8 -*-
import pytest
import turnstile.models.message as message
from turnstile.checks import CheckIgnore
from turnstile.checks.commit_msg.specification import check
def test_check():
commit_1 = message.CommitMessage('something', 'https://github.com/jmcs/turnstile/issues/42 m€sságe')
result_... | zalando/turnstile | tests/checks/test_specification_check.py | Python | apache-2.0 | 1,332 | 0.00301 |
import logging, time, commands
from autotest.client.shared import error
from virttest import utils_test, aexpect
def run_timedrift(test, params, env):
"""
Time drift test (mainly for Windows guests):
1) Log into a guest.
2) Take a time reading from the guest and host.
3) Run load on the guest and... | ehabkost/virt-test | qemu/tests/timedrift.py | Python | gpl-2.0 | 7,552 | 0.001457 |
#! /usr/bin/env python2
# -*- coding: utf-8 -*-
from __future__ import (unicode_literals, absolute_import, division)
import os as os_module
import xbmc
from lib.constants import *
userdatafolder = os_module.path.join(xbmc.translatePath("special://profile").decode("utf-8"), "addon_data", addonid, "test data")
libpath... | eirki/script.service.koalahbonordic | tests/mock_constants.py | Python | mit | 370 | 0.002703 |
from mybottle import Bottle, run, ServerAdapter, get, post, request
import KalutServer.conf as myconf
class SSLWSGIRefServer(ServerAdapter):
def run(self, handler, quiet=False):
from wsgiref.simple_server import make_server, WSGIRequestHandler
import ssl
if quiet:
class QuietHand... | TwoUnderscorez/KalutServer | KalutServer/RESTfulAPI/SSLbottle.py | Python | apache-2.0 | 772 | 0.002591 |
from django.conf.urls import patterns, url
from publicaciones import views
urlpatterns = patterns('',
url(r'^$', views.index, name='index'),
url(r'^(?P<articulo_titulo>[\W\w]+)/$', views.ver_articulo, name='ver_articulo'),
) | rickyrish/rickyblog | publicaciones/urls.py | Python | gpl-2.0 | 234 | 0.012821 |
"""
@package mi.dataset.driver.optaa_dj.cspp
@file mi-dataset/mi/dataset/driver/optaa_dj/cspp/optaa_dj_cspp_telemetered_driver.py
@author Joe Padula
@brief Telemetered driver for the optaa_dj_cspp instrument
Release notes:
Initial Release
"""
__author__ = 'jpadula'
from mi.dataset.dataset_driver import SimpleDatase... | JeffRoy/mi-dataset | mi/dataset/driver/optaa_dj/cspp/optaa_dj_cspp_telemetered_driver.py | Python | bsd-2-clause | 2,238 | 0.002681 |
#!/usr/bin/env python
#
# Copyright (c) 2014 Hamilton Kibbe <ham@hamiltonkib.be>
#
# 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 ... | hamiltonkibbe/PyAbleton | pyableton/__init__.py | Python | mit | 1,356 | 0.00885 |
from pymongo import MongoClient
import schedule
import time
##############
## This script will be deployed in bluemix with --no-route set to true
##############
con = MongoClient("mongodb://abcd:qwerty@ds111798.mlab.com:11798/have_a_seat")
db = con.have_a_seat
cursor = db.Bookings.find()
#Bookings is {customerName:... | VimanyuAgg/Have_a_seat | dbanalytics tester.py | Python | apache-2.0 | 1,275 | 0.004706 |
print 28433 * 2**7830457 + 1
| floppp/programming_challenges | project_euler/051-100/97.py | Python | mit | 29 | 0 |
from collections import Counter
def unalk_coeff(l):
'''Source: https://ww2.amstat.org/publications/jse/v15n2/kader.html'''
n = len(l)
freq = Counter(l)
freqsum = 0
for key, freq in freq.items():
p = freq / n
freqsum += p**2
unalk_coeff = 1 - freqsum
return unalk_coeff
def... | j4n7/record-q | qualitative_variation.py | Python | gpl-3.0 | 1,382 | 0.003618 |
from flask_admin.contrib.sqla.typefmt import DEFAULT_FORMATTERS as BASE_FORMATTERS
import json
from jinja2 import Markup
from wtforms.widgets import html_params
from geoalchemy2.shape import to_shape
from geoalchemy2.elements import WKBElement
from sqlalchemy import func
from flask import current_app
def geom_formatt... | hexlism/css_platform | sleepyenv/lib/python2.7/site-packages/Flask_Admin-1.2.0-py2.7.egg/flask_admin/contrib/geoa/typefmt.py | Python | apache-2.0 | 988 | 0.004049 |
__doc__="""An experimental SVG renderer for the ReportLab graphics framework.
This will create SVG code from the ReportLab Graphics API (RLG).
To read existing SVG code and convert it into ReportLab graphics
objects download the svglib module here:
http://python.net/~gherman/#svglib
"""
import math, types, sys, os... | fergalmoran/Chrome2Kindle | server/reportlab/graphics/renderSVG.py | Python | mit | 30,282 | 0.009412 |
import struct
from coinpy.lib.serialization.common.serializer import Serializer
from coinpy.lib.serialization.exceptions import MissingDataException
class VarintSerializer(Serializer):
def __init__(self, desc=""):
self.desc = desc
def serialize(self, value):
if (value < 0xfd):
... | sirk390/coinpy | coinpy-lib/src/coinpy/lib/serialization/structures/s11n_varint.py | Python | lgpl-3.0 | 1,579 | 0.005066 |
#!/usr/bin/env python
# ===================================
# Copyright (c) Microsoft Corporation. All rights reserved.
# See license.txt for license information.
# ===================================
import socket
import os
import sys
import imp
import md5
import sha
import codecs
import base64
import platform
import... | MSFTOSSMgmt/WPSDSCLinux | Providers/Scripts/2.4x-2.5x/Scripts/nxOMSAgentNPMConfig.py | Python | mit | 15,607 | 0.006023 |
# -*- coding: utf-8 -*-
"""API documentation build configuration file.
This file is :func:`execfile`\\ d with the current directory set to its
containing dir.
Note that not all possible configuration values are present in this
autogenerated file.
All configuration values have a default; values that are commented ou... | nisavid/spruce-project | doc/conf.tmpl.py | Python | lgpl-3.0 | 11,930 | 0.006287 |
import os
import sys
import string
filenames = os.listdir(os.getcwd())
for file in filenames:
if os.path.splitext(file)[1] == ".o" or os.path.splitext(file)[1] == ".elf" :
print "objdumparm.exe -D "+file
os.system("C:/WindRiver/gnu/4.1.2-vxworks-6.8/x86-win32/bin/objdumparm.exe -D "+file +" > " +file + "... | honor6-dev/android_kernel_huawei_h60 | drivers/vendor/hisi/build/scripts/obj_cmp_tools/vxworks_dassemble.py | Python | gpl-2.0 | 348 | 0.022989 |
"""
WSGI config for cloudlynt project.
This module contains the WSGI application used by Django's development server
and any production WSGI deployments. It should expose a module-level variable
named ``application``. Django's ``runserver`` and ``runfcgi`` commands discover
this application via the ``WSGI_APPLICATION`... | drunken-pypers/cloudlynt | cloudlynt/wsgi.py | Python | mit | 1,140 | 0.000877 |
# stupid 2.7.2 by peterm, patch by Smack
# http://robotgame.org/viewrobot/5715
import random
import math
import rg
def around(l):
return rg.locs_around(l)
def around2(l):
return [(l[0]+2, l[1]), (l[0]+1, l[1]+1), (l[0], l[1]+2), (l[0]-1, l[1]+1),
(l[0]-2, l[1]), (l[0]-1, l[1]-1), (l[0], l[1]-2), (l[0]+1... | andrewgailey/robogen | robogen/rgkit/backup bots/stupid272.py | Python | unlicense | 6,333 | 0.011211 |
'''
Given an XML file that describes a text file containing a header and a table, parse
the XML into it's descriptive elements.
Created on Feb 27, 2017
@author: cyoung
'''
import xml.etree.ElementTree as ElementTree
from gov.noaa.gmd.table_2_netcdf.Util import Util
class TableDataDesc:
#XML elem... | charles-g-young/Table2NetCDF | gov/noaa/gmd/table_2_netcdf/TableDataDesc.py | Python | apache-2.0 | 11,062 | 0.013741 |
"""phial's custom errors."""
class ArgumentValidationError(Exception):
"""Exception indicating argument validation has failed."""
pass
class ArgumentTypeValidationError(ArgumentValidationError):
"""Exception indicating argument type validation has failed."""
pass
| sedders123/phial | phial/errors.py | Python | mit | 286 | 0 |
# Copyright (c) 2012 OpenStack Foundation
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless ... | citrix-openstack/build-python-troveclient | troveclient/flavors.py | Python | apache-2.0 | 1,700 | 0 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
import os
import wx
import wx.lib.newevent
from threading import Thread, Lock
import signal
import logging
from argparse import ArgumentParser, SUPPRESS
from ConfigParser import ConfigParser
from subprocess import Popen
import subprocess as sb
# CoreEventHandler... | bx5974/desktop-mirror | lib/advanced.py | Python | apache-2.0 | 35,589 | 0.001264 |
"""Basic quilt-like functionality
"""
__copyright__ = """
Copyright (C) 2005, Catalin Marinas <catalin.marinas@gmail.com>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License version 2 as
published by the Free Software Foundation.
This program is d... | miracle2k/stgit | stgit/stack.py | Python | gpl-2.0 | 40,808 | 0.007131 |
# 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/training/session_manager.py | Python | apache-2.0 | 23,320 | 0.004417 |
#!/usr/bin/env python
#
# Copyright (c) 2020 by VMware, Inc. ("VMware")
# Used Copyright (c) 2018 by Network Device Education Foundation,
# Inc. ("NetDEF") in this file.
#
# Permission to use, copy, modify, and/or distribute this software
# for any purpose with or without fee is hereby granted, provided
# that the abo... | freerangerouting/frr | tests/topotests/bgp_multi_vrf_topo1/test_bgp_multi_vrf_topo1.py | Python | gpl-2.0 | 229,521 | 0.00132 |
import os
import sys
import codecs
from contextlib import contextmanager
from itertools import repeat
from functools import update_wrapper
from .types import convert_type, IntRange, BOOL
from .utils import make_str, make_default_short_help, echo
from .exceptions import ClickException, UsageError, BadParameter, Abort, ... | gameduell/duell | pylib/click/core.py | Python | bsd-2-clause | 68,206 | 0.000088 |
# Copyright (c) 2014 OpenStack Foundation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to ... | openstack/sahara | sahara/service/edp/oozie/engine.py | Python | apache-2.0 | 19,118 | 0 |
import os
from setuptools import setup, find_packages
here = os.path.abspath(os.path.dirname(__file__))
with open(os.path.join(here, 'README.md'), encoding='utf-8') as f:
README = f.read()
with open(os.path.join(here, 'CHANGES.txt'), encoding='utf-8') as f:
CHANGES = f.read()
setup(
name='sloth',
v... | Lvl4Sword/Acedia | setup.py | Python | agpl-3.0 | 1,191 | 0.005877 |
#!/usr/bin/python
import unittest
from biosignalformat import *
class TestBaseObjects(unittest.TestCase):
def test_MinimalExperiment(self):
provider = XArchiveProvider("experiment001.7z")
#provider = ZipArchiveProvider("experiment001.zip")
experiment = Experiment({
"name": "Exp!... | marcoapintoo/Biosignal-Intermediate-Format | biosignalformat/test.py | Python | apache-2.0 | 5,325 | 0.005446 |
from datetime import date, datetime
from mock import patch, MagicMock
from unittest import TestCase
from django_mock_queries import utils, constants
class TestUtils(TestCase):
def test_merge_concatenates_lists(self):
l1 = [1, 2, 3]
l2 = [4, 5, 6]
result = utils.merge(l1, l2)
for x... | szykin/django-mock-queries | tests/test_utils.py | Python | mit | 11,117 | 0.001889 |
import talkey
from gtts import gTTS
import vlc
import time
import wave
import contextlib
class Speaker:
def __init__(self):
self.engine =talkey.Talkey()
def say(self, text_to_say):
self.engine.say(text_to_say)
def google_say(self, text_to_say, fname="1.mp3"):
tts = gTTS(text=text... | codebhendi/alfred-bot | speaker.py | Python | mit | 490 | 0.004082 |
# This file is part of cloud-init. See LICENSE file for license information.
"""cloud-init Integration Test Verify Script."""
from tests.cloud_tests.testcases import base
class TestSshKeysGenerate(base.CloudTestCase):
"""Test ssh keys module."""
# TODO: Check cloud-init-output for the correct keys being gen... | larsks/cloud-init | tests/cloud_tests/testcases/modules/ssh_keys_generate.py | Python | gpl-3.0 | 1,674 | 0 |
# -*- 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 'Contributor.zipcode_short'
db.add_column(u'tx_tecreports_... | texas/tx_tecreports | tx_tecreports/migrations/0007_auto__add_field_contributor_zipcode_short.py | Python | apache-2.0 | 13,870 | 0.007354 |
# -*- coding: utf-8 -*-
##
## This file is part of Invenio.
## Copyright (C) 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) a... | lnielsen/invenio | invenio/modules/documentation/__init__.py | Python | gpl-2.0 | 834 | 0.015588 |
class StadisticRouter(object):
"""A router to control all database operations on models in
the stadistic application"""
def db_for_read(self, model, **hints):
"Point all operations on myapp models to 'other'"
if model._meta.app_label == 'stadistic':
return 'nonrel'
retur... | frhumanes/consulting | web/src/stadistic/__init__.py | Python | apache-2.0 | 1,076 | 0.001859 |
# -*- coding: utf-8 -*-
from __future__ import with_statement
import os
import sys
import traceback
# monkey patch bug in python 2.6 and lower
# http://bugs.python.org/issue6122 , http://bugs.python.org/issue1236 , http://bugs.python.org/issue1731717
if sys.version_info < (2, 7) and os.name != "nt":
import errno... | benbox69/pyload | module/plugins/hooks/ExtractArchive.py | Python | gpl-3.0 | 21,976 | 0.008282 |
# encoding: utf-8
import datetime
from south.db import db
from south.v2 import DataMigration
from django.db import models
def deslugify(text):
in_bits = text.split('-')
out_bits = list()
for bit in in_bits:
out_bit = bit[0].upper() + bit[1:]
out_bits.append(out_bit)
return ' '.join(out_... | samhoo/askbot-realworld | askbot/migrations/0031_synchronize_badge_slug_with_name.py | Python | gpl-3.0 | 26,451 | 0.008468 |
# cerbero - a multi-platform build system for Open Source software
# Copyright (C) 2012 Andoni Morales Alastruey <ylatuya@gmail.com>
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Library General Public
# License as published by the Free Software Foundation... | nicolewu/cerbero | cerbero/utils/svn.py | Python | lgpl-2.1 | 1,732 | 0.000577 |
"""Manage, delete, order compute instances."""
# :license: MIT, see LICENSE for more details.
import SoftLayer
from SoftLayer.CLI import environment
from SoftLayer.CLI import exceptions
from SoftLayer.CLI import formatting
from SoftLayer.CLI import helpers
from SoftLayer.CLI import template
from SoftLayer.CLI import v... | cloudify-cosmo/softlayer-python | SoftLayer/CLI/virt/create.py | Python | mit | 10,420 | 0 |
from icalendar import Calendar, vCalAddress, vText
import icalendar
from datetime import timedelta
from django.template import RequestContext
from django.http import HttpResponseRedirect
from django.shortcuts import render_to_response
from django.core.urlresolvers import reverse
from django.core.exceptions import Objec... | JoeJasinski/evesch | evesch/core/feed/views.py | Python | gpl-2.0 | 8,264 | 0.0144 |
"""SCons.Tool.sgiar
Tool-specific initialization for SGI ar (library archive). If CC
exists, static libraries should be built with it, so the prelinker has
a chance to resolve C++ template instantiations.
There normally shouldn't be any need to import this module directly.
It will usually be imported through the gen... | looooo/pivy | scons/scons-local-1.2.0.d20090919/SCons/Tool/sgiar.py | Python | isc | 2,570 | 0.006226 |
import unittest
from tow.dockerfile import Dockerfile
class DockerfileTest(unittest.TestCase):
def test_parse_spaced_envs(self):
d = Dockerfile("Dockerfile")
d._Dockerfile__dockerfile = ["ENV test 1"]
envs = d.envs()
self.assertEqual(envs, {"test": "1"})
def test_parse_many_e... | docker-tow/tow | tests/dockerfile_tests.py | Python | apache-2.0 | 4,097 | 0.004882 |
#!/usr/bin/env python3
# Copyright (c) 2014-2018 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test the rawtransaction RPCs.
Test the following RPCs:
- createrawtransaction
- signrawtransacti... | GlobalBoost/GlobalBoost-Y | test/functional/rpc_rawtransaction.py | Python | mit | 24,022 | 0.008659 |
from inspect import getmembers
from django.shortcuts import render
from utilities import get_wps_service_engine, list_wps_service_engines, abstract_is_link
def home(request):
"""
Home page for Tethys WPS tool. Lists all the WPS services that are linked.
"""
wps_services = list_wps_service_engines()
... | CI-WATER/django-tethys_wps | tethys_wps/views.py | Python | bsd-2-clause | 1,115 | 0.000897 |
# -*- coding: utf-8 -*-
"""QGIS Unit tests for QgsComposerEffects.
.. note:: 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.
""... | kiith-sa/QGIS | tests/src/python/test_qgscomposereffects.py | Python | gpl-2.0 | 3,073 | 0.004557 |
import traceback
class EnsureExceptionHandledGuard:
"""Helper for ensuring that Future's exceptions were handled.
This solves a nasty problem with Futures and Tasks that have an
exception set: if nobody asks for the exception, the exception is
never logged. This violates the Zen of Python: 'Errors s... | mikhtonyuk/rxpython | concurrent/futures/cooperative/ensure_exception_handled.py | Python | mit | 3,261 | 0 |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'exampleLoaderTemplate.ui'
#
# Created: Sat Dec 17 23:46:27 2011
# by: PyQt4 UI code generator 4.8.3
#
# WARNING! All changes made in this file will be lost!
from PyQt4 import QtCore, QtGui
try:
_fromUtf8 = QtCore.QString.fromUtf8
... | robertsj/poropy | pyqtgraph/examples/exampleLoaderTemplate.py | Python | mit | 2,302 | 0.002172 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.5 on 2017-03-22 11:18
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('cotacao', '0003_auto_20170312_2049'),
]
operations... | asleao/sistema-cotacao | project/cotacao/migrations/0004_auto_20170322_0818.py | Python | gpl-3.0 | 665 | 0.001504 |
'''Python sys.excepthook hook to generate apport crash dumps.'''
# Copyright (c) 2006 - 2009 Canonical Ltd.
# Authors: Robert Collins <robert@ubuntu.com>
# Martin Pitt <martin.pitt@ubuntu.com>
#
# This program is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Publ... | windflyer/apport | apport_python_hook.py | Python | gpl-2.0 | 7,544 | 0.001723 |
from fabric.api import run
from fabric.decorators import with_settings
from fabric.colors import green, yellow
from deployer.tasks.requirements import install_requirements
@with_settings(warn_only=True)
def setup_virtualenv(python_version='', app_name='', app_dir='', repo_url=''):
print(green("Setting up virtuale... | streema/deployer | deployer/tasks/virtualenv.py | Python | mit | 576 | 0.003472 |
#! usr/bin/python3
# -*- coding: utf-8 -*-
#
# Flicket - copyright Paul Bourne: evereux@gmail.com
import datetime
from flask import redirect, url_for, flash, g
from flask_babel import gettext
from flask_login import login_required
from . import flicket_bp
from application import app, db
from application.flicket.mode... | evereux/flicket | application/flicket/views/release.py | Python | mit | 2,064 | 0.002907 |
# 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 may ... | Azure/azure-sdk-for-python | sdk/peering/azure-mgmt-peering/azure/mgmt/peering/aio/_peering_management_client.py | Python | mit | 6,754 | 0.002813 |
#!python3
"""
This script downloads the favicons
Usage:
python3 update_alexa path/to/data.csv
"""
import os
import requests
favicon_path = os.path.join(os.path.dirname(__file__), "..", "icons")
def download_favicons(links):
for link in links:
netloc = link['netloc']
url = 'http://' + netloc... | engineerapart/TheRemoteFreelancer | docs/scripts/download_favicons.py | Python | unlicense | 964 | 0.001037 |
import os
import tempfile
import unittest
import logging
from pyidf import ValidationLevel
import pyidf
from pyidf.idf import IDF
from pyidf.daylighting import OutputControlIlluminanceMapStyle
log = logging.getLogger(__name__)
class TestOutputControlIlluminanceMapStyle(unittest.TestCase):
def setUp(self):
... | rbuffat/pyidf | tests/test_outputcontrolilluminancemapstyle.py | Python | apache-2.0 | 1,023 | 0.002933 |
'''
Created on 24.03.2011
@author: michi
'''
from PyQt4.QtGui import QItemDelegate
from sqlalchemy import Table
from sqlalchemy.sql import Alias,Select
from ems import qt4
class ColumnSectionMapper(object):
def __init__(self,alchemySelect=None, parent=None):
self.__columnConfigs = []
self.__colu... | mtils/ems | ems/qt4/itemmodel/columnsectionmapper.py | Python | mit | 3,948 | 0.008359 |
# Copyright (c) 2013 Mirantis Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writ... | citrix-openstack-build/sahara | sahara/tests/unit/service/edp/test_job_manager.py | Python | apache-2.0 | 20,947 | 0 |
def __load():
import imp, os, sys
ext = 'pygame/font.so'
for path in sys.path:
if not path.endswith('lib-dynload'):
continue
ext_path = os.path.join(path, ext)
if os.path.exists(ext_path):
mod = imp.load_dynamic(__name__, ext_path)
break
else:... | mokuki082/EggDrop | code/build/bdist.macosx-10.6-intel/python3.4-standalone/app/temp/pygame/font.py | Python | gpl-3.0 | 393 | 0.005089 |
import re
source = [
('assert', 0x00, False, 'vreg'),
('raise', 0x05, False, 'vreg'),
('constant', 0x10, True, 'constant'),
('list', 0x20, True, 'vreg*'),
('move', 0x30, False, 'vreg vreg'),
('call', 0x40, True, 'vreg vreg*'),
('not', 0x41, True, 'vreg'),
('con... | cheery/lever | runtime/evaluator/optable.py | Python | mit | 1,719 | 0.001163 |
from __future__ import (absolute_import, division, print_function)
import unittest
from testhelpers import WorkspaceCreationHelper
class SpectrumInfoTest(unittest.TestCase):
_ws = None
def setUp(self):
if self.__class__._ws is None:
self.__class__._ws = WorkspaceCreationHelper.create2DWo... | ScreamingUdder/mantid | Framework/PythonInterface/test/python/mantid/api/SpectrumInfoTest.py | Python | gpl-3.0 | 788 | 0.005076 |
from django.utils.translation import gettext_lazy as _
from rest_framework import serializers
from ..models import MyUser, Profile
from ..utils import perform_reputation_check
class CreateUserSerializer(serializers.ModelSerializer):
password = serializers.CharField(
style={'input_type': 'password'}
... | TheRedLady/codebook | codebook/profiles/restapi/serializers.py | Python | gpl-3.0 | 4,811 | 0.001663 |
# -*- coding: utf-8 -*-
from django.conf.urls import include, url
from django.contrib import admin
from django.contrib.auth.views import login
import notifications.urls
import notifications.tests.views
urlpatterns = [
url(r'^login/$', login, name='login'), # needed for Django 1.6 tests
url(r'^admin/', inclu... | Evidlo/django-notifications | notifications/tests/urls.py | Python | bsd-3-clause | 544 | 0 |
import random
filler_text = '''Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate vel... | davidxmoody/diary | tests/filler_text.py | Python | mit | 20,162 | 0.002579 |
from datetime import datetime, timedelta
from .interchange import WaypointType, ActivityStatisticUnit, ActivityType, LapIntensity, LapTriggerMethod
from .devices import DeviceIdentifier, DeviceIdentifierType
import struct
import sys
import pytz
class FITFileType:
Activity = 4 # The only one we care about now.
class ... | cmgrote/tapiriik | tapiriik/services/fit.py | Python | apache-2.0 | 22,972 | 0.030167 |
# 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 may ... | Azure/azure-sdk-for-python | sdk/network/azure-mgmt-network/azure/mgmt/network/v2017_10_01/operations/_virtual_network_peerings_operations.py | Python | mit | 22,805 | 0.004955 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
from PySide import QtCore
from PySide import QtGui
from PySide import QtWebKit
import sys
import re
import datetime
import os
import time
import subprocess
import threading
import atexit
import webbrowser
import functools
import operator
import Viewer
import Controller
cla... | josquindebaz/P2Qt | p2gui.py | Python | lgpl-3.0 | 106,057 | 0.009045 |
#
# Autogenerated by Thrift
#
# DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
#
from thrift.Thrift import *
from ttypes import *
from thrift.Thrift import TProcessor
from thrift.transport import TTransport
from thrift.protocol import TBinaryProtocol
try:
from thrift.protocol import fastbinary
exce... | lenn0x/Milo-Tracing-Framework | src/py/examples/helloworld/HelloWorld.py | Python | apache-2.0 | 5,966 | 0.015924 |
# -*- coding: utf-8 -*-
# Minio Python Library for Amazon S3 Compatible Cloud Storage,
# (C) 2015, 2016, 2017 Minio, 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.ap... | NitishT/minio-py | minio/error.py | Python | apache-2.0 | 23,884 | 0.003601 |
# coding: utf-8
from mongomock import MongoClient as MockMongoClient
from .base import *
# For tests, don't use KoBoCAT's DB
DATABASES = {
'default': dj_database_url.config(default='sqlite:///%s/db.sqlite3' % BASE_DIR),
}
DATABASE_ROUTERS = ['kpi.db_routers.TestingDatabaseRouter']
TESTING = True
# Decrease pro... | kobotoolbox/kpi | kobo/settings/testing.py | Python | agpl-3.0 | 664 | 0.001506 |
# -*- coding: utf-8 -*-
"""
Copyright (c) 2015, Philipp Klaus. All rights reserved.
License: GPLv3
"""
from distutils.core import setup
setup(name='netio230a',
version = '1.1.9',
description = 'Python package to control the Koukaam NETIO-230A',
long_description = 'Python software to access the Kou... | pklaus/netio230a | setup.py | Python | gpl-3.0 | 1,135 | 0.026432 |
r"""A proxy enabling multiple wiring guide instances to interact with the same
SpiNNaker boards.
A very simple protocol is used between the client and server. Clients may send
the following new-line delimited commands to the server:
* ``VERSION,[versionstring]\n`` The server will disconnect any client with an
incom... | SpiNNakerManchester/SpiNNer | spinner/proxy.py | Python | gpl-2.0 | 8,272 | 0.040015 |
from . import Renderer
from PIL import Image, ImageFont, ImageQt, ImageDraw
from PyQt5 import QtGui
'''
Renders a single line of text at a given position.
'''
class TextRenderer(Renderer):
MSFACTOR = 8
def __init__(self, gl, text, pos, size = 64):
super().__init__(gl)
self.text = te... | eeucalyptus/eeDA | app/graphics/textrenderer.py | Python | apache-2.0 | 3,090 | 0.009385 |
# 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
# d... | NeCTAR-RC/horizon | openstack_dashboard/api/_nova.py | Python | apache-2.0 | 5,498 | 0 |
import doctest
from insights.parsers import ls_var_cache_pulp
from insights.parsers.ls_var_cache_pulp import LsVarCachePulp
from insights.tests import context_wrap
LS_VAR_CACHE_PULP = """
total 0
drwxrwxr-x. 5 48 1000 216 Jan 21 12:56 .
drwxr-xr-x. 10 0 0 121 Jan 20 13:57 ..
lrwxrwxrwx. 1 0 0 19 Jan 21 12:... | RedHatInsights/insights-core | insights/parsers/tests/test_ls_var_cache_pulp.py | Python | apache-2.0 | 1,314 | 0.003805 |
import os
import unittest
from collections import namedtuple
from unittest.mock import patch
from ray.tune.function_runner import wrap_function
from ray.tune.integration.mlflow import MLflowLoggerCallback, MLflowLogger, \
mlflow_mixin, MLflowTrainableMixin
class MockTrial(
namedtuple("MockTrial",
... | pcmoritz/ray-1 | python/ray/tune/tests/test_integration_mlflow.py | Python | apache-2.0 | 11,695 | 0 |
# __main__.py is used when a package is executed as a module, i.e.: `python -m pptx_downsizer`
if __name__ == '__main__':
from .pptx_downsizer import cli
cli()
| scholer/pptx-downsizer | pptx_downsizer/__main__.py | Python | gpl-3.0 | 170 | 0.005882 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.