code stringlengths 2 1.05M | repo_name stringlengths 5 104 | path stringlengths 4 251 | language stringclasses 1
value | license stringclasses 15
values | size int32 2 1.05M |
|---|---|---|---|---|---|
# Generated by Django 2.2.25 on 2022-02-09 20:16
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('users', '0041_migrate_reprs'),
]
operations = [
migrations.CreateModel(
name='DeactivateMobileWorkerTrigger',
field... | dimagi/commcare-hq | corehq/apps/users/migrations/0042_deactivatemobileworkertrigger.py | Python | bsd-3-clause | 654 |
#!/usr/bin/python
# $Id:$
import ctypes
import queue
import pyglet
from pyglet.window.win32 import kernel32, user32, constants, types
class MTWin32EventLoop(pyglet.app.win32.Win32EventLoop):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
# Force immediate creation of an... | bitcraft/pyglet | contrib/experimental/mt_media/mt_app_win32.py | Python | bsd-3-clause | 2,590 |
from typing import Any, Dict, List, Union
from ..annotations import TypedDict
SecurityDict = Dict[str, List[str]]
class ValidateEmailKwargsDict(TypedDict, total=False):
allow_smtputf8: bool
allow_empty_local: bool
check_deliverability: bool
timeout: Union[int, float]
dns_resolver: Any
| playpauseandstop/rororo | src/rororo/openapi/annotations.py | Python | bsd-3-clause | 311 |
import json
class APIResponse:
"""
Container for a boolean success flag, an exception,
and a response object that could be just about anything.
Has the power of translating itself into json.
"""
def __init__(self, response=None, success=True, exception=None):
self._response = response... | yukaritan/glomp | apiresponse.py | Python | bsd-3-clause | 1,301 |
"""Inspired by
http://trac.edgewall.org/attachment/ticket/6353/babel-l10n-js.diff#L590 """
import os
import glob
import distutils
import json
from babel._compat import StringIO
from babel._compat import string_types
from babel.messages import frontend as babel
from babel.messages.pofile import read_po
import gettext
... | minddistrict/doublespeak | src/doublespeak/message.py | Python | bsd-3-clause | 6,920 |
import sys
from django.conf import settings
import requests
import waffle
from nameparser import HumanName
def absolutify(url):
"""Takes a URL and prepends the SITE_URL"""
site_url = getattr(settings, 'SITE_URL', False)
# If we don't define it explicitly
if not site_url:
protocol = settings... | johngian/mozillians | mozillians/common/utils.py | Python | bsd-3-clause | 3,547 |
"""
Forum attachments models
========================
This module defines models provided by the ``forum_attachments`` application.
"""
from machina.apps.forum_conversation.forum_attachments.abstract_models import AbstractAttachment
from machina.core.db.models import model_factory
Attachment = model_fa... | ellmetha/django-machina | machina/apps/forum_conversation/forum_attachments/models.py | Python | bsd-3-clause | 346 |
"""Some utility functions"""
# Authors: Eric Larson <larsoner@uw.edu>
#
# License: BSD (3-clause)
import warnings
import operator
from copy import deepcopy
import subprocess
import importlib
import os
import os.path as op
import inspect
import sys
import time
import tempfile
import traceback
import ssl
from shutil im... | drammock/expyfun | expyfun/_utils.py | Python | bsd-3-clause | 30,243 |
# -*- coding: utf-8 -*-
from django.db import models
"""
Representa las opciones de estados que tiene cada normativa
"""
class EstadoNormativaPostitulo(models.Model):
NO_VIGENTE = u'No vigente'
VIGENTE = u'Vigente'
nombre = models.CharField(max_length = 50, unique = True)
class Meta:
app_lab... | MERegistro/meregistro | meregistro/apps/postitulos/models/EstadoNormativaPostitulo.py | Python | bsd-3-clause | 482 |
# -*- coding: utf8 -*-
"""
Compound filters
"""
from __future__ import absolute_import, division, print_function
from .mole_filter import mole_filter
from .mole_filter import simple_mole_filter
| w495/python-video-shot-detector | shot_detector/filters/compound/__init__.py | Python | bsd-3-clause | 201 |
import sys
import traceback
import json
import os
import logging
import time
from hashlib import md5
from django.utils import timezone
from django.db import models
from django.http import HttpResponse
from django.utils.encoding import smart_str
from djangae.db.transaction import atomic, TransactionFailedError
from .... | potatolondon/centaur | models.py | Python | bsd-3-clause | 5,647 |
from SimpleCV.Tracking.TrackClass import Track, CAMShiftTrack, SURFTrack, LKTrack, MFTrack
from SimpleCV.Tracking.CAMShiftTracker import camshiftTracker
from SimpleCV.Tracking.LKTracker import lkTracker
from SimpleCV.Tracking.SURFTracker import surfTracker
from SimpleCV.Tracking.MFTracker import mfTracker
from SimpleCV... | tpltnt/SimpleCV | SimpleCV/Tracking/__init__.py | Python | bsd-3-clause | 355 |
"""
Tests for OEShape color utilities.
"""
import numpy as np
import unittest
from openeye.oechem import *
from openeye.oeshape import *
from ..color import ColorForceField
class TestColorForceField(unittest.TestCase):
"""
Tests for ColorForceField.
"""
def setUp(self):
"""
Set up te... | skearnes/color-features | oe_utils/shape/tests/test_color.py | Python | bsd-3-clause | 1,693 |
__author__ = 'Viktor Kerkez <alefnula@gmail.com>'
__date__ = '19 January 2013'
__copyright__ = 'Copyright (c) 2013 Viktor Kerkez'
from .token import *
from .style import *
from .lexer import *
from .formatter import *
__all__ = ['Token', 'Lexer', 'RegexLexer', 'Formatter', 'ConsoleFormatter',
'Style', 'Sty... | alefnula/samovar | src/samovar/parsing/__init__.py | Python | bsd-3-clause | 355 |
#!/usr/bin/python3
import json
import os
import re
import shutil
import subprocess
import sys
import urllib.parse
import urllib.request
APP_NAME = 'Text'
IS_APP = True
BASE_DIR = os.path.dirname(sys.argv[0])
SOURCE_DIR = BASE_DIR
BUILD_DIR = os.path.join(BASE_DIR, 'build')
FILES = [
'index.html... | webpadonline/webpadonline.github.io | build.py | Python | bsd-3-clause | 7,419 |
import numpy as np
from rampwf.score_types.soft_accuracy import SoftAccuracy
score_matrix_1 = np.array([
[1, 0, 0],
[0, 1, 0],
[0, 0, 1],
])
score_matrix_2 = np.array([
[1, 0.5, 0],
[0.3, 1, 0.3],
[0, 0.5, 1],
])
y_true_proba_1 = np.array([1, 0, 0])
y_true_proba_2 = np.array([0, 1, 0])
y_tr... | paris-saclay-cds/ramp-workflow | rampwf/score_types/tests/test_soft_accuracy.py | Python | bsd-3-clause | 3,379 |
# Generated by Django 2.2.17 on 2021-01-28 01:52
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('discounts', '0010_merge_20191028_1925'),
]
operations = [
migrations.AddField(
model_name='registrationdiscount',
n... | django-danceschool/django-danceschool | danceschool/discounts/migrations/0011_auto_20210127_2052.py | Python | bsd-3-clause | 525 |
"""
mpiece.renderer
~~~~~~~~~~~~~~~~~~~~~~~~~
Renderer Classes.
:license: BSD, see LICENSE for details.
:author: David Casado Martinez <dcasadomartinez@gmail.com>
"""
class Renderer(object):
"""
Base renderer class.
All renderer classes should be subclasses of this class.
This class and their subclass ... | davidnotplay/mpiece | mpiece/renderer.py | Python | bsd-3-clause | 5,413 |
from ipywidgets.widgets import (
Button,
Widget,
widget_serialization,
)
from traitlets import (
Unicode,
Instance,
)
class ES6Example(Button):
"""
An example widget that highlights issues in implementing Backbone
classes in ES6.
"""
_model_name = Unicode('ES6ExampleModel', syn... | bollwyvl/es6-widget-example | es6widgetexample/es6examplewidget.py | Python | bsd-3-clause | 673 |
# -*- coding: utf-8 -*-
#
# pytest-django documentation build configuration file, created by
# sphinx-quickstart on Tue May 1 10:12:50 2012.
#
# This file is execfile()d with the current directory set to its containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#... | jantman/pytest_django | docs/conf.py | Python | bsd-3-clause | 7,985 |
# -*- coding: utf-8 -*-
"""some measures for evaluation of prediction, tests and model selection
Created on Tue Nov 08 15:23:20 2011
Author: Josef Perktold
License: BSD-3
"""
import numpy as np
def mse(x1, x2, axis=0):
'''mean squared error
'''
return np.mean((x1-x2)**2, axis=axis)
def rmse(x1, x2, a... | pprett/statsmodels | statsmodels/tools/eval_measures.py | Python | bsd-3-clause | 8,338 |
from django.http import HttpResponse, HttpResponseRedirect, Http404
from django.shortcuts import render_to_response, get_object_or_404
from django.template import RequestContext
from ccgallery.models import Category, get_model
def category(request, slug):
try:
category = Category.objects.visible().get(sl... | designcc/django-ccgallery | ccgallery/views.py | Python | bsd-3-clause | 1,538 |
#!/usr/bin/env python
"""
Match input spectrum to ID lines
"""
from __future__ import (print_function, absolute_import, division, unicode_literals)
import pdb
try: # Python 3
ustr = unicode
except NameError:
ustr = str
def parser(options=None):
import argparse
# Parse
parser = argparse.ArgumentP... | PYPIT/arclines | arclines/scripts/match.py | Python | bsd-3-clause | 3,106 |
"""Layout for flex containers and flex-items."""
import sys
from math import inf, log10
from ..css.properties import Dimension
from ..formatting_structure import boxes
from .percent import resolve_one_percentage, resolve_percentages
from .preferred import max_content_width, min_content_width
from .table import find_i... | Kozea/WeasyPrint | weasyprint/layout/flex.py | Python | bsd-3-clause | 38,587 |
import pyaf.Bench.TS_datasets as tsds
import tests.artificial.process_artificial_dataset as art
art.process_dataset(N = 128 , FREQ = 'D', seed = 0, trendtype = "Lag1Trend", cycle_length = 7, transform = "None", sigma = 0.0, exog_count = 20, ar_order = 0); | antoinecarme/pyaf | tests/artificial/transf_None/trend_Lag1Trend/cycle_7/ar_/test_artificial_128_None_Lag1Trend_7__20.py | Python | bsd-3-clause | 259 |
'''
BSD 3-Clause License
Copyright (c) 2019, Donald N. Bockoven III
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 retain the above copyright notice, this
l... | buddyd16/Structural-Engineering | Steel/bolt_group_istantaneous_center.py | Python | bsd-3-clause | 8,880 |
from setuptools import setup
import versioneer
setup(
name='conda-build-all',
version=versioneer.get_version(),
cmdclass=versioneer.get_cmdclass(),
description='Build all conda recipes within a directory/repository.',
author='Phil Elson',
author_email='pelson.pub@gmail.com',
... | pelson/conda-build-all | setup.py | Python | bsd-3-clause | 752 |
from __future__ import absolute_import, division, print_function
import toolz
from toolz import first
import datashape
from datashape import Record, dshape, DataShape
from datashape import coretypes as ct
from datashape.predicates import isscalar, iscollection
from .core import common_subexpression
from .expressions ... | vitan/blaze | blaze/expr/reductions.py | Python | bsd-3-clause | 6,478 |
#!/usr/bin/env python
from oled.device import ssd1306, sh1106
from oled.render import canvas
from PIL import ImageDraw, ImageFont, Image
import urllib2
import json
import time
font2 = ImageFont.truetype('/root/stratux/test/screen/CnC_Red_Alert.ttf', 12)
oled = ssd1306(port=1, address=0x3C)
with canvas(oled) as dra... | egid/stratux | test/screen/screen.py | Python | bsd-3-clause | 3,003 |
from django.http import HttpResponse
class rc_factory(object):
"""
Status codes.
"""
CODES = dict(ALL_OK = ('OK', 200),
CREATED = ('Created', 201),
DELETED = ('', 204), # 204 says "Don't send a body!"
BAD_REQUEST = ('Bad Request', 400),
... | j2a/django-simprest | simprest/utils.py | Python | bsd-3-clause | 1,001 |
from django.contrib.auth.signals import user_logged_in, user_logged_out
from django.dispatch import receiver
from hs_core.signals import pre_download_file, post_delete_resource, post_create_resource
from .models import Session
from .models import Variable
from .utils import get_client_ip, get_user_type, get_user_emai... | FescueFungiShare/hydroshare | hs_tracking/signals.py | Python | bsd-3-clause | 4,029 |
import os
import mimetypes
from gzip import GzipFile
import datetime
try:
from cStringIO import StringIO
except ImportError:
from StringIO import StringIO # noqa
from django.core.files.base import File
from django.core.files.storage import Storage
from django.core.exceptions import ImproperlyConfigured, Susp... | bendavis78/django-storages | storages/backends/s3boto.py | Python | bsd-3-clause | 18,318 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Generated from FHIR 3.0.0.11832 on 2017-03-22.
# 2017, SMART Health IT.
import io
import json
import os
import unittest
from . import graphdefinition
from .fhirdate import FHIRDate
class GraphDefinitionTests(unittest.TestCase):
def instantiate_from(self, file... | all-of-us/raw-data-repository | rdr_service/lib_fhir/fhirclient_3_0_0/models/graphdefinition_tests.py | Python | bsd-3-clause | 2,760 |
from django.db import models
from taggit.managers import TaggableManager
class BaseModel(models.Model):
name = models.CharField(max_length=50, unique=True)
tags = TaggableManager()
def __unicode__(self):
return self.name
class Meta(object):
abstract = True
class AlphaModel(... | feuervogel/django-taggit-templatetags | taggit_templatetags/tests/models.py | Python | bsd-3-clause | 379 |
# BSD 3-Clause License
#
# Copyright (c) 2016-21, University of Liverpool
# 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 retain the above copyright notic... | rigdenlab/conkit | conkit/io/fasta.py | Python | bsd-3-clause | 4,455 |
# -*- coding: utf-8 -*-
"""
basemodels.py
~~~~~~~~~~~
"""
from flask.ext.login import UserMixin
from sqlalchemy.ext.declarative import declared_attr
from werkzeug.security import generate_password_hash, check_password_hash
from ext import db
class BaseMixin(object):
__table_args__ = {'extend_existing': T... | jstacoder/flask-manage | flask_mrbob/templates/project/+project.name+/basemodels.py | Python | bsd-3-clause | 1,359 |
#!/usr/bin/env vpython
# Copyright 2017 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import errno
import logging
import os
import shutil
import sys
sys.path.append(os.path.join(os.path.dirname(__file__), '..', '..'))
i... | youtube/cobalt | build/android/pylib/utils/maven_downloader.py | Python | bsd-3-clause | 4,864 |
#!/usr/bin/python
#
# Copyright (c) 2016, Nest Labs, 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:
# 1. Redistributions of source code must retain the above copyright
# notice, thi... | JiahuiZHONG/Internship_Thread | tests/scripts/thread-cert/Cert_6_4_01_LinkLocal.py | Python | bsd-3-clause | 2,986 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import random
from datetime import datetime
from werkzeug import cached_property
from flask import url_for, Markup
from flask.ext.sqlalchemy import BaseQuery
from flask.ext.principal import Permission, UserNeed, Denial
from newsmeme.extensions import db
from newsmeme.h... | sixu05202004/newsmeme | newsmeme/newsmeme/models/posts.py | Python | bsd-3-clause | 10,746 |
from __future__ import absolute_import
import re
from django import forms
from django.contrib import messages
from django.core.urlresolvers import reverse
from django.http import HttpResponseRedirect
from django.utils.safestring import mark_safe
from django.utils.translation import ugettext_lazy as _
from uuid import... | jean/sentry | src/sentry/web/frontend/project_settings.py | Python | bsd-3-clause | 12,517 |
import datetime
import time
#
# From the django project
# https://github.com/django/django/blob/4a103086d5c67fa4fcc53c106c9fdf644c742dd8/django/utils/timesince.py
# Copyright (c) Django Software Foundation and individual contributors.
# All rights reserved.
def ungettext(a,b,count):
if count:
return b
... | Ramblurr/ephemvpn | ephemvpn/timehelpers.py | Python | bsd-3-clause | 2,759 |
# -*- coding: utf-8 -*-
import 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 'Product.type'
db.add_column('product_product', 'type',
self.gf('django... | elin-moco/ffclub | ffclub/product/migrations/0005_auto__add_field_product_type.py | Python | bsd-3-clause | 13,115 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
import os
import sys
import numpy as np
import argparse
from google.protobuf import text_format
#https://github.com/BVLC/caffe/issues/861#issuecomment-70124809
import matplotlib
matplotlib.use('Agg')
BASE_DIR = os.path.dirname(os.path.abspath(__file__))
sys.path.append(os.p... | ShapeNet/JointEmbedding | src/image_embedding_testing/extract_image_embedding.py | Python | bsd-3-clause | 1,866 |
# -*- coding: utf-8 -*-
"""
***************************************************************************
diff.py
---------------------
Date : November 2013
Copyright : (C) 2013-2016 Boundless, http://boundlessgeo.com
************************************************************... | boundlessgeo/geogig-py | src/geogigpy/diff.py | Python | bsd-3-clause | 2,681 |
import tempfile
import csv
import gzip
import io
import json
import os
from io import StringIO, BytesIO
from unittest import mock
from tempfile import TemporaryDirectory
import zipfile
import pytest
import requests
import vcr
try:
import pandas as pd
has_pandas = True
except ImportError:
has_pandas = Fals... | civisanalytics/civis-python | civis/tests/test_io.py | Python | bsd-3-clause | 61,250 |
import unittest
from kraken.core.objects.transform import Transform
class TestTransform(unittest.TestCase):
def testInstance(self):
transform = Transform('test')
self.assertIsNotNone(transform)
def suite():
return unittest.TestLoader().loadTestsFromTestCase(TestTransform)
if __name__ =... | oculusstorystudio/kraken | unittests/core/objects/test_transform.py | Python | bsd-3-clause | 365 |
import utils
primes = utils.primes(1000000)
def truncatable(n):
sn = str(n)
if len(sn) < 2:
return False
for i in range(1, len(sn)):
if int(sn[0:i]) not in primes or int(sn[-i:]) not in primes:
return False
return True
tprimes = filter(truncatable, primes)
print tprimes... | ericdahl/project-euler | python/p037.py | Python | bsd-3-clause | 359 |
import os
import genapi
from genapi import TypeApi, GlobalVarApi, FunctionApi, BoolValuesApi
import numpy_api
h_template = r"""
#ifdef _MULTIARRAYMODULE
typedef struct {
PyObject_HEAD
npy_bool obval;
} PyBoolScalarObject;
extern NPY_NO_EXPORT PyTypeObject PyArrayNeighborhoodIter_Type;
extern NPY_NO... | teoliphant/numpy-refactor | numpy/core/code_generators/generate_numpy_api.py | Python | bsd-3-clause | 7,203 |
import datetime
from django.db import models
from django.utils.translation import ugettext, ugettext_lazy as _
from django.contrib.auth.models import User
from django.contrib import admin
from schedule.models import Occurrence
from django_attendance.conf import settings as attendance_settings
class EventAttendance(... | winhamwr/django-attendance | django_attendance/models.py | Python | bsd-3-clause | 1,202 |
import inspect
import sys
import pytest
from numpy.core import arange
from numpy.testing import assert_, assert_equal, assert_raises_regex
from numpy.lib import deprecate
import numpy.lib.utils as utils
from io import StringIO
@pytest.mark.skipif(sys.flags.optimize == 2, reason="Python running -OO")
def test_lookfo... | abalkin/numpy | numpy/lib/tests/test_utils.py | Python | bsd-3-clause | 3,769 |
INSTALLED_APPS += (
'gooddata',
)
GOODDATA_PROJECT = ''
GOODDATA_GOOGLE_ANALYTICS_PROJECT = ''
GOODDATA_USERNAME = ''
GOODDATA_PASSWORD = '' | comoga/django-gooddata | examples/settings.py | Python | bsd-3-clause | 150 |
import unittest
import numpy
from chainer.backends import cuda
from chainer import functions
from chainer import gradient_check
from chainer import testing
from chainer.testing import attr
@testing.parameterize(*testing.product({
'in_shape': [(2, 3, 8, 6), (2, 1, 4, 6)],
}))
@testing.inject_backend_tests(
N... | tkerola/chainer | tests/chainer_tests/functions_tests/array_tests/test_resize_images.py | Python | mit | 6,159 |
import unittest
from nose.tools import eq_
from django.contrib.auth import get_user_model
from amon.apps.alerts.models import AlertsModel
from amon.apps.processes.models import process_model
from amon.apps.plugins.models import plugin_model
from amon.apps.servers.models import server_model
from amon.apps.devices.mode... | martinrusev/amonone | amon/apps/alerts/models/tests/alerts_model_test.py | Python | mit | 13,755 |
from distutils.core import setup, Command
import unittest
import doctest
from unittest import defaultTestLoader, TextTestRunner
import sys
# BUG. At least we should support 3.0, which means getting
# rid of a bunch of stupid byte-as-string stuff, which is kind
# of awesome.
(major_version, minor_version) = sys.versi... | lukemn/python-lzw | setup.py | Python | mit | 2,823 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import sys
import platform
import random
import string
#Parameters
import optparse
import configparser
import OmniDB.custom_settings
OmniDB.custom_settings.DEV_MODE = False
OmniDB.custom_settings.DESKTOP_MODE = False
parser = optparse.OptionParser(version=OmniD... | rafaelthca/OmniDB | OmniDB/omnidb-server.py | Python | mit | 12,308 |
import asposepdfcloud
from asposepdfcloud.PdfApi import PdfApi
from asposepdfcloud.PdfApi import ApiException
import asposestoragecloud
from asposestoragecloud.StorageApi import StorageApi
from asposestoragecloud.StorageApi import ResponseMessage
apiKey = "XXXXX" #sepcify App Key
appSid = "XXXXX" #sepcify App SID
api... | asposepdf/Aspose_Pdf_Cloud | Examples/Python/Examples/GetTextFormatOfPDFSegment.py | Python | mit | 1,391 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright 2014-2015 Canonical Limited.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unl... | konono/equlipse | openstack-install/charm/trusty/charm-keystone/tests/charmhelpers/core/strutils.py | Python | mit | 3,680 |
import json
import logging
from functools import wraps
logger = logging.getLogger(__name__)
class PandaError(Exception):
pass
def error_check(func):
@wraps(func)
def check(*args, **kwargs):
try:
res = func(*args, **kwargs)
if "error" in res:
logger.error(re... | pandastream/panda_client_python | panda/models.py | Python | mit | 5,728 |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
# Author: Vera Mazhuga http://vero4ka.info
from django.conf.urls import include, url
from django.views.generic import TemplateView
from django.contrib import admin
urlpatterns = [
url(r'^$', TemplateView.as_view(template_name='home.html'), name='home'),
url(r'^ac... | vero4karu/burger_shop | app/urls.py | Python | mit | 549 |
from .stats import * # noqa
| sendgrid/sendgrid-python | sendgrid/helpers/stats/__init__.py | Python | mit | 29 |
"""
REST server API.
.. moduleauthor:: Martijn Vermaat <martijn@vermaat.name>
.. Licensed under the MIT license, see the LICENSE file.
"""
from .views import api
| sndrtj/varda | varda/api/__init__.py | Python | mit | 166 |
import os, sys
from google.appengine.api.labs import taskqueue
from google.appengine.ext import webapp
from google.appengine.ext.webapp.util import run_wsgi_app
from google.appengine.ext.webapp import template
from google.appengine.ext import db
from google.appengine.api import images
from google.appengine.api import u... | glenmurphy/dropmocks | main.py | Python | mit | 16,653 |
from hydrachain.consensus.simulation import Network, assert_heightdistance
from hydrachain.consensus.simulation import assert_maxrounds, assert_blocktime, log
from hydrachain.consensus.manager import ConsensusManager
from ethereum.transactions import Transaction
import gevent
def test_basic_gevent():
network = Ne... | HydraChain/hydrachain | hydrachain/tests/test_sim_basics.py | Python | mit | 3,515 |
import asposecellscloud
from asposecellscloud.CellsApi import CellsApi
from asposecellscloud.CellsApi import ApiException
from asposecellscloud.CellsApi import AutoShapesResponse
import asposestoragecloud
from asposestoragecloud.StorageApi import StorageApi
apiKey = "XXXXX" #sepcify App Key
appSid = "XXXXX" #sepcify ... | aspose-cells/Aspose.Cells-for-Cloud | Examples/Python/Examples/GetAutoshapeFromWorksheet.py | Python | mit | 1,342 |
import json
import unittest2
from google.appengine.ext import testbed
from consts.media_type import MediaType
from helpers.media_helper import MediaParser
from helpers.webcast_helper import WebcastParser
class TestMediaUrlParser(unittest2.TestCase):
def setUp(cls):
cls.testbed = testbed.Testbed()
... | jaredhasenklein/the-blue-alliance | tests/suggestions/test_media_url_parse.py | Python | mit | 9,927 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# thumbor imaging service
# https://github.com/thumbor/thumbor/wiki
# Licensed under the MIT license:
# http://www.opensource.org/licenses/mit-license
# Copyright (c) 2011 globo.com thumbor@googlegroups.com
from unittest import TestCase
import mock
from preggy import expect... | gi11es/thumbor | tests/test_server.py | Python | mit | 9,543 |
import fabric.api
import fabric.tasks
import fabric.colors
import os
class PipFreeze(fabric.tasks.Task):
name = 'pip_freeze'
def run(self, commit=True):
fabric.api.local("pip freeze > requirements.txt")
if commit:
fabric.api.local("git add requirements.txt")
with fabric.api.settings(warn_only=T... | matiboy/generator-django | app/templates/tasks/local/pip.py | Python | mit | 1,694 |
#!/usr/bin/env python3
# Copyright (c) 2014-2016 The Bitsend Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
#
# Test proper accounting with a double-spend conflict
#
from test_framework.test_framework import Bits... | madzebra/BitSend | qa/rpc-tests/txn_doublespend.py | Python | mit | 6,649 |
# encoding: utf-8
"""
lxml custom element classes for shape-related XML elements.
"""
from __future__ import absolute_import
from .. import parse_xml
from ...enum.shapes import MSO_AUTO_SHAPE_TYPE, PP_PLACEHOLDER
from ..ns import nsdecls
from .shared import BaseShapeElement
from ..simpletypes import XsdBoolean, XsdS... | cchanrhiza/python-pptx | pptx/oxml/shapes/autoshape.py | Python | mit | 10,416 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Copyright (c) 2016,2017,2018 Jérémie DECOCK (http://www.jdhp.org)
# This script is provided under the terms and conditions of the MIT license:
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation... | jdhp-sap/sap-cta-data-pipeline | datapipe/benchmark/assess.py | Python | mit | 37,422 |
#! /usr/bin/python
# Author: Ryan Dellana
# Date Created: Feb. 16, 2014
# Updated: December 20, 2016
# Note: This version was created for Daniel Tobias
"""
Dependencies:
sudo apt-get install python-pygame
sudo apt-get install festlex-cmu
sudo apt-get install ubuntu-restricted-extras
sudo dpkg-reconfigure libdvd-pkg
#... | DJTobias/CAR | car/scripts/SoundServer.py | Python | mit | 15,311 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""
With this tool you can add the template {{commonscat}} to categories.
The tool works by following the interwiki links. If the template is present on
another language page, the bot will use it.
You could probably use it at articles as well, but this isn't tested.
This bo... | trishnaguha/pywikibot-core | scripts/commonscat.py | Python | mit | 23,969 |
# Place within a proposal life cycle
LIFE_ORIGIN = 1
LIFE_PLANNING = 2
LIFE_CLASS = 3
LIFE_FINISHED = 4
IS_COLLECTION = 100
# Source of a proposal
SOURCE_UNKNOWN = 0
SOURCE_WEBSITE = 1
SOURCE_API = 2
SOURCE_OFFLINE = 3 | codeforanchorage/collective-development | app/mod_proposal/constants.py | Python | mit | 219 |
import argparse
import collections
import csv
import glob
import os
import xml.etree.ElementTree
def generate_build_data(balance_data_path):
abilities = {}
units = {}
ability_lookup = {}
for xml_file_path in glob.glob(os.path.join(balance_data_path, "*.xml")):
tree = xml.etree.ElementTree.pa... | ggtracker/sc2reader | generate_build_data.py | Python | mit | 12,767 |
"""
utils.py.
MiniCPS use a shared logger called mcps_logger.
It contains testing data objects.
TEST_LOG_LEVEL affects all the tests,
output, info and debug are in increasing order of verbosity.
It contains all the others data objects.
"""
import logging
import logging.handlers
import time
import os
from mininet.u... | remmihsorp/minicps | minicps/utils.py | Python | mit | 3,381 |
from flask import Blueprint, request, session, redirect, render_template
from models import User
from utilities import hash_password
sessions = Blueprint('sessions', __name__, template_folder='templates')
def check_login():
try:
if session['UserName']:
return True
except:
return False
@sessions.route... | Bit-Monkeys/openfaqs | sessions.py | Python | mit | 1,115 |
# Test for behaviour of combined standard and extended block device
try:
import uos
uos.VfsFat
uos.VfsLfs2
except (ImportError, AttributeError):
print("SKIP")
raise SystemExit
class RAMBlockDevice:
ERASE_BLOCK_SIZE = 512
def __init__(self, blocks):
self.data = bytearray(blocks * s... | trezor/micropython | tests/extmod/vfs_blockdev.py | Python | mit | 1,588 |
from commentjson import dump
from commentjson import dumps
from commentjson import JSONLibraryException
from commentjson import load
from commentjson import loads
| ethifus/commentjson | commentjson/__init__.py | Python | mit | 163 |
# oxAuth is available under the MIT License (2008). See http://opensource.org/licenses/MIT for full text.
# Copyright (c) 2016, Gluu
#
# Author: Yuriy Movchan
#
from org.gluu.service.cdi.util import CdiUtil
from org.gluu.oxauth.security import Identity
from org.gluu.model.custom.script.type.auth import PersonAuthentic... | GluuFederation/community-edition-setup | static/extension/person_authentication/DuoExternalAuthenticator.py | Python | mit | 9,408 |
#### NOTICE: THIS FILE IS AUTOGENERATED
#### MODIFICATIONS MAY BE LOST IF DONE IMPROPERLY
#### PLEASE SEE THE ONLINE DOCUMENTATION FOR EXAMPLES
from swgpy.object import *
def create(kernel):
result = Building()
result.template = "object/building/poi/shared_corellia_smashball_small1.iff"
result.attribute_template... | anhstudios/swganh | data/scripts/templates/object/building/poi/shared_corellia_smashball_small1.py | Python | mit | 456 |
class Namespace(object):
SCOPE_OPERATOR = '::'
def __init__(self, string = '', splitted = []):
if string and not splitted:
self._string = string
self._splitted = string.split(Namespace.SCOPE_OPERATOR)
else:
self._splitted = splitted
self._string ... | Manu343726/siplasplas | src/reflection/parser/utility/namespace.py | Python | mit | 752 |
#!/usr/bin/env python
import click
@click.command()
def hello():
click.echo('Hello alpine-python!')
if __name__ == '__main__':
hello()
| hypebeast/docker-alpine-python | examples/simple-mount-app/app.py | Python | mit | 146 |
# 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/storage/azure-mgmt-storagecache/azure/mgmt/storagecache/operations/__init__.py | Python | mit | 1,054 |
from __future__ import print_function
import itertools
import os
import socket
import time
from Queue import Empty
from datetime import timedelta
from haydi.base.exception import HaydiException, TimeoutException
try:
from distributed import Client, LocalCluster
from .strategy import StepStrategy, Precompute... | Kobzol/haydi | src/haydi/base/runtime/distributedcontext.py | Python | mit | 7,090 |
#### NOTICE: THIS FILE IS AUTOGENERATED
#### MODIFICATIONS MAY BE LOST IF DONE IMPROPERLY
#### PLEASE SEE THE ONLINE DOCUMENTATION FOR EXAMPLES
from swgpy.object import *
def create(kernel):
result = Tangible()
result.template = "object/tangible/lair/base/shared_poi_all_lair_mound_large_evil_fire_green.iff"
resu... | anhstudios/swganh | data/scripts/templates/object/tangible/lair/base/shared_poi_all_lair_mound_large_evil_fire_green.py | Python | mit | 466 |
def bs(data, target, low, high):
if low > high:
return False
else:
mid = (low + high)//2
if target == data[mid]:
return True
elif target < data[mid]:
return bs(data, target, low, mid - 1)
else:
return bs(data, target, mid + 1, high)
if... | xiao0720/leetcode | binary_search.py | Python | mit | 415 |
from utils import *
import sys
def clean_rec(d):
kwhs, kwhs_oriflag = d["kwhs"]
temps, temps_oriflag = d["temps"]
for i in range(len(temps_oriflag)):
t = temps[i]
if t < -60:
temps_oriflag[i] = False #Ain't no way that reading's real
temps[i] = 0
for i in range... | dssg/energywise | Code/clean_brecs.py | Python | mit | 947 |
# -*- coding: utf-8 -*-
#
# This class was auto-generated from the API references found at
# https://epayments-api.developer-ingenico.com/s2sapi/v1/
#
from ingenico.connect.sdk.data_object import DataObject
from ingenico.connect.sdk.domain.payment.definitions.redirection_data import RedirectionData
class GPayThreeDSe... | Ingenico-ePayments/connect-sdk-python2 | ingenico/connect/sdk/domain/payment/definitions/g_pay_three_d_secure.py | Python | mit | 6,073 |
"""
http://docs.bitfinex.com/
"""
# Import Built-Ins
import logging
# Import Third-Party
# Import Homebrew
from bitex.api.REST import BitfinexREST
from bitex.api.WSS.bitfinex import BitfinexWSS
from bitex.utils import return_api_response
from bitex.formatters.bitfinex import BtfxFormatter as fmt
# Init Logging Facil... | nlsdfnbch/bitex | bitex/interfaces/bitfinex.py | Python | mit | 5,442 |
from plotly.graph_objs import Heatmapgl
| plotly/python-api | packages/python/plotly/plotly/graph_objs/layout/template/data/_heatmapgl.py | Python | mit | 40 |
""" support for skip/xfail functions and markers. """
from _pytest.config import hookimpl
from _pytest.mark.evaluate import MarkEvaluator
from _pytest.outcomes import fail
from _pytest.outcomes import skip
from _pytest.outcomes import xfail
from _pytest.store import StoreKey
skipped_by_mark_key = StoreKey[bool]()
eva... | alfredodeza/pytest | src/_pytest/skipping.py | Python | mit | 6,499 |
from SpaceDock.config import _cfg
from SpaceDock.objects import *
import json
import os
# TODO: anything of use
| EIREXE/SpaceDock | import-ckan.py | Python | mit | 119 |
# -*- coding: utf-8 -*-
"""
Test pelican-gist
=================
Test stuff in pelican_gist.
"""
from __future__ import unicode_literals
import os
from pelican_gist import plugin as gistplugin
from mock import patch
import requests.models
def test_gist_url():
gist_id = str(3254906)
filename = 'brew-update-n... | kura/kura.io | plugins/pelican_gist/test_plugin.py | Python | mit | 2,786 |
from django.db import models
class PlaceType(models.Model):
name = models.CharField(
max_length=100,
unique=True,
)
class Place(models.Model):
type = models.ForeignField(
PlaceType,
related_name='places',
)
name = models.CharField(
max_length=100,
)
... | dogukantufekci/workplace_saas | workplace_saas/_apps/places/models.py | Python | mit | 1,622 |
# 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 ... | SUSE/azure-sdk-for-python | azure-mgmt-sql/azure/mgmt/sql/models/encryption_protector_paged.py | Python | mit | 918 |
# 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 ... | SUSE/azure-sdk-for-python | azure-mgmt-network/azure/mgmt/network/v2017_03_01/operations/virtual_network_gateways_operations.py | Python | mit | 36,131 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
'''
Created on 15 Apr 2016
@author: Kimon Tsitsikas
Copyright © 2016 Kimon Tsitsikas, Delmic
This file is part of Odemis.
Odemis 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 F... | gstiebler/odemis | src/odemis/dataio/test/csv_test.py | Python | gpl-2.0 | 4,917 |
# Opus/UrbanSim urban simulation software.
# Copyright (C) 2005-2009 University of Washington
# See opus_core/LICENSE
# This is a simple test variable for the interaction of gridcells and households.
from opus_core.variables.variable import Variable
from urbansim.functions import attribute_label
class hhnp... | christianurich/VIBe2UrbanSim | 3rdparty/opus/src/paris/household_x_neighborhood/hhnper2_nbnper2.py | Python | gpl-2.0 | 1,879 |
import pytest
class TestTail:
@pytest.mark.complete("tail --", require_longopt=True)
def test_1(self, completion):
assert completion
| algorythmic/bash-completion | test/t/test_tail.py | Python | gpl-2.0 | 151 |
#
# Copyright (c) 2008--2011 Red Hat, Inc.
#
# This software is licensed to you under the GNU General Public License,
# version 2 (GPLv2). There is NO WARRANTY for this software, express or
# implied, including the implied warranties of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. You should have received a c... | dmacvicar/spacewalk | backend/server/test/test_rhnSession.py | Python | gpl-2.0 | 965 |