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 |
|---|---|---|---|---|---|---|
"""
Domain middleware: enables multi-tenancy in a single process
"""
from anaf.core.domains import setup_domain, setup_domain_database
from anaf.core.db import DatabaseNotFound
from anaf.core.conf import settings
from django.http import HttpResponseRedirect
from django.db.utils import DatabaseError
from django.core.url... | tovmeod/anaf | anaf/core/middleware/domain.py | Python | bsd-3-clause | 1,463 | 0.000684 |
# Copyright (c) 2017 Ultimaker B.V.
# Cura is released under the terms of the LGPLv3 or higher.
import configparser # For reading the legacy profile INI files.
import io
import json # For reading the Dictionary of Doom.
import math # For mathematical operations included in the Dictionary of Doom.
import os.path # ... | alephobjects/Cura2 | plugins/LegacyProfileReader/LegacyProfileReader.py | Python | lgpl-3.0 | 10,008 | 0.006695 |
#!/usr/bin/python
#
# Copyright 2012 Google Inc. 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 b... | krux/adspygoogle | examples/adspygoogle/dfp/v201204/get_user.py | Python | apache-2.0 | 1,504 | 0.001995 |
"""
WSGI config for yearendsite 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_S... | menzenski/django-year-end-site | yearendsite/wsgi.py | Python | mit | 399 | 0 |
# Copyright 2008, 2009, 2016 Free Software Foundation, Inc.
# This file is part of GNU Radio
#
# SPDX-License-Identifier: GPL-2.0-or-later
#
from __future__ import absolute_import
import sys
import textwrap
from distutils.spawn import find_executable
from gi.repository import Gtk, GLib
from . import Utils, Actions... | jdemel/gnuradio | grc/gui/Dialogs.py | Python | gpl-3.0 | 15,494 | 0.002259 |
# -*- encoding: utf-8 -*-
from pygithub3.requests.base import Request
from pygithub3.resources.git_data import Tag
class Get(Request):
uri = 'repos/{user}/{repo}/git/tags/{sha}'
resource = Tag
class Create(Request):
uri = 'repos/{user}/{repo}/git/tags'
resource = Tag
body_schema = {
'sc... | dongguangming/python-github3 | pygithub3/requests/git_data/tags.py | Python | isc | 412 | 0 |
from reportlab.pdfgen.canvas import Canvas
from reportlab.lib.units import inch
from xml.etree.ElementTree import ElementTree
import Image, re, sys
class HocrConverter():
"""
A class for converting documents to/from the hOCR format.
For details of the hOCR format, see:
http://docs.google.com/View?docid... | jbrinley/HocrConverter | HocrConverter.py | Python | mit | 5,986 | 0.019044 |
print "hello"
print "world"
print "hello world"
print hello world
end
haha
| fausthuang/faust-s-test-repo | hello world.py | Python | gpl-2.0 | 76 | 0.013158 |
import os
from distutils.util import strtobool
def is_int(value):
"""
Verifies that 'value' is an integer.
"""
try:
int(value)
except ValueError:
return False
else:
return True
def is_float(value):
"""
Verifies that 'value' is a float.
"""
try:
... | INRA-LPGP/bio_tools | bio_tools/parameters/type_checks.py | Python | mit | 1,406 | 0 |
# -*- coding: utf-8 -*-
#
# Anaconda documentation build configuration file, created by
# sphinx-quickstart on Wed Sep 18 14:37:01 2013.
#
# 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.
#
# Al... | jkonecny12/anaconda | docs/conf.py | Python | gpl-2.0 | 11,653 | 0.006522 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
]
operations = [
migrations.CreateModel(
name='MissingTeacherEntry',
fields=[
('id', models.Au... | AlexandreDecan/Dashbird | widgets/schoolwidget/migrations/0001_initial.py | Python | gpl-3.0 | 2,474 | 0.005255 |
# Copyright 2021 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | google/CFU-Playground | proj/hps_accel/gateware/gen1/set.py | Python | apache-2.0 | 4,133 | 0 |
#!/usr/bin/env python
#-*-*- encoding: utf-8 -*-*-
#
# Copyright (C) 2005 onwards University of Deusto
# All rights reserved.
#
# This software is licensed as described in the file COPYING, which
# you should have received as part of this distribution.
#
# This software consists of contributions made by many individual... | morelab/weblabdeusto | server/src/weblab/core/coordinator/checker.py | Python | bsd-2-clause | 5,307 | 0.006785 |
import numpy as np
class PointBrowser:
"""
Click on a point to select and highlight it -- the data that
generated the point will be shown in the lower axes. Use the 'n'
and 'p' keys to browse through the next and previous points
"""
def __init__(self):
self.lastind = 0
self.t... | cactusbin/nyt | matplotlib/examples/event_handling/data_browser.py | Python | unlicense | 2,233 | 0.011196 |
# -*- coding: utf-8 -*-
"""
pygments.lexers.pascal
~~~~~~~~~~~~~~~~~~~~~~
Lexers for Pascal family languages.
:copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
import re
from ..lexer import Lexer, RegexLexer, include, bygroups, words, ... | facelessuser/sublime-markdown-popups | st3/mdpopups/pygments/lexers/pascal.py | Python | mit | 32,536 | 0.001014 |
# coding: utf-8
from openerp import models, api, fields
class LibraryReturnsWizard(models.TransientModel):
_name = 'library.returns.wizard'
member_id = fields.Many2one('library.member', 'Member')
book_ids = fields.Many2many('library.book', 'Books')
@api.multi
def record_returns(self):
l... | vileopratama/vitech | docs/tutorials/ebook/Odoo Development Cookbook/OdooDevelopmentCookbook_Code/Chapter06_code/Ch06_R05/some_model_ch06r05/models.py | Python | mit | 913 | 0 |
import boto3
import collections
import datetime
import time
import sys
import botocore
ec2_client = boto3.client('ec2',region_name='ap-southeast-2')
ec2_resource = boto3.resource('ec2',region_name='ap-southeast-2')
sns = boto3.client('sns')
images_all = ec2_resource.images.filter(Owners=["self"])
today_fmt = (datetime... | RexChenjq/AWS-Image-Backup | purge latest.py | Python | mit | 2,667 | 0.009374 |
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Ansible is distributed in the hope that ... | e-gob/plataforma-kioscos-autoatencion | scripts/ansible-play/.venv/lib/python2.7/site-packages/ansible/module_utils/facts/network/dragonfly.py | Python | bsd-3-clause | 1,202 | 0.000832 |
"""Module containing a preprocessor that converts outputs in the notebook from
one format to another.
"""
# Copyright (c) Jupyter Development Team.
# Distributed under the terms of the Modified BSD License.
from .base import Preprocessor
from traitlets import Unicode
class ConvertFiguresPreprocessor(Preprocessor)... | unnikrishnankgs/va | venv/lib/python3.5/site-packages/nbconvert/preprocessors/convertfigures.py | Python | bsd-2-clause | 1,450 | 0.002759 |
#!env/bin/python
"""Create the database"""
from migrate.versioning import api
from config import SQLALCHEMY_DATABASE_URI
from config import SQLALCHEMY_MIGRATE_REPO
from app import db
import os.path
db.create_all()
if not os.path.exists(SQLALCHEMY_MIGRATE_REPO):
api.create(SQLALCHEMY_MIGRATE_REPO, 'database reposit... | dianvaltodorov/happy-commas | db_create.py | Python | mit | 566 | 0 |
# -*- coding: utf-8 -*-
import datetime
from django.http import HttpResponseRedirect
from django.shortcuts import render_to_response
from django.core.urlresolvers import reverse
from django.conf import settings
from django import forms
from commons.decorators import submitted_applicant_required
from commons.decorator... | jittat/adm2 | application/views/update.py | Python | agpl-3.0 | 12,858 | 0.003085 |
inside = lambda x, y: 4*x*x+y*y <= 100
def coll(sx, sy, dx, dy):
m = 0
for p in range(32):
m2 = m + 2**(-p)
if inside(sx + dx * m2, sy + dy * m2): m = m2
return (sx + dx*m, sy + dy*m)
def norm(x, y):
l = (x*x + y*y)**0.5
return (x/l, y/l)
sx, sy = 0, 10.1
dx, dy = 1.4, -19.7
for ... | jokkebk/euler | p144.py | Python | mit | 538 | 0.013011 |
from tensorflow.keras.applications.resnet50 import ResNet50
from tensorflow.keras.preprocessing import image
from tensorflow.keras.applications.resnet50 import preprocess_input, decode_predictions
import numpy as np
model = ResNet50(weights='imagenet')
img_path = 'elephant.jpg'
img = image.load_img(img_path, target_s... | lukas/ml-class | examples/keras-transfer/resnet50-inspect.py | Python | gpl-2.0 | 517 | 0.001934 |
# pylint: skip-file
# flake8: noqa
# pylint: disable=too-many-lines
# noqa: E301,E302,E303,T001
class OpenShiftCLIError(Exception):
'''Exception class for openshiftcli'''
pass
ADDITIONAL_PATH_LOOKUPS = ['/usr/local/bin', os.path.expanduser('~/bin')]
def locate_oc_binary():
''' Find and return oc binar... | abutcher/openshift-ansible | roles/lib_openshift/src/lib/base.py | Python | apache-2.0 | 21,696 | 0.001244 |
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
setup(
name='Unirest',
version='1.1.7',
author='Mashape',
author_email='opensource@mashape.com',
packages=['unirest'],
url='https://github.com/Mashape/unirest-python',
license='LICENSE',
descr... | abhishekgahlot/unirest-python | setup.py | Python | mit | 431 | 0 |
# -*- coding: utf-8 -*-
"""Core Service Interface Definitions
osid version 3.0.0
The Open Service Interface Definitions (OSIDs) is a service-based
architecture to promote software interoperability. The OSIDs are a large
suite of interface contract specifications that describe the integration
points among services and ... | birdland/dlkit-doc | dlkit/mongo/osid/summary_doc.py | Python | mit | 17,271 | 0 |
"""
Django settings for {{ project_name }} project.
For more information on this file, see
https://docs.djangoproject.com/en/1.8/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.8/ref/settings/
"""
# Build paths inside the project like this: os.path.join(BASE_D... | jmorenobl/django-template-project-1.8 | project_name_project/config/settings/base.py | Python | mit | 9,481 | 0.004324 |
# Copyright 2017 Google Inc. 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 applicable law or... | google/tmppy | _py2tmp/utils/__init__.py | Python | apache-2.0 | 784 | 0 |
import numpy as np
import active_subspaces as ac
def borehole(xx):
#each row of xx should be [rw, r, Tu, Hu, Tl, Hl, L, Kw] in the normalized space
#returns column vector of borehole function at each row of inputs
x = xx.copy()
x = np.atleast_2d(x)
M = x.shape[0]
#unnormalize inpus
... | paulcon/active_subspaces | tutorials/test_functions/borehole/borehole_functions.py | Python | mit | 2,595 | 0.035067 |
#!/usr/bin/env python
f = open("repair.log", "r");
lines = f.readlines();
cnt = 0;
for line in lines:
tokens = line.strip().split();
if (len(tokens) > 3):
if (tokens[0] == "Total") and (tokens[1] == "return"):
cnt += int(tokens[3]);
if (tokens[0] == "Total") and (tokens[2] == "differ... | jyi/ITSP | prophet-gpl/tools/return_counter.py | Python | mit | 423 | 0.018913 |
"""djangochat URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.11/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
Class... | ploggingdev/djangochat | djangochat/urls.py | Python | gpl-3.0 | 817 | 0 |
"""
Create inset.
"""
from __future__ import absolute_import
#Init has to be imported first because it has code to workaround the python bug where relative imports don't work if the module is imported as a main module.
import __init__
from fabmetheus_utilities.geometry.creation import lineation
from fabmetheus_utili... | natetrue/ReplicatorG | skein_engines/skeinforge-40/fabmetheus_utilities/geometry/manipulation_paths/_outset.py | Python | gpl-2.0 | 1,041 | 0.009606 |
from django.db import models
class Article(models.Model):
posttitle = models.TextField(default="Post")
post = models.TextField()
piclink = models.TextField(blank=True)
pub_date = models.DateTimeField(auto_now_add=True)
class BlogPost(Article):
def __str__(self):
return self.posttitle
class PagePost(Article):
... | GabMus/simpelblog | blog/models.py | Python | gpl-3.0 | 969 | 0.034056 |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
# -----------------------------------------------------------------------------
# Copyright (c) 2014, Nicolas P. Rougier. All Rights Reserved.
# Distributed under the (new) BSD License.
# -----------------------------------------------------------------------------
""" Thi... | duyuan11/glumpy | examples/interpolations.py | Python | bsd-3-clause | 4,303 | 0.008599 |
import os
from sqlalchemy import and_
from photomanager.lib.pmconst import TODO_INX_NAME
from photomanager.utils.imageutils import ImageInfo
from photomanager.db.helper import exif_to_model
from photomanager.db.models import ImageMeta
from photomanager.lib.helper import get_file_md5
from photomanager.db.config import C... | wrenchzc/photomanager | photomanager/db/imagehandler.py | Python | mit | 2,547 | 0.000785 |
from mimetypes import guess_type
from django.conf import settings
from django.contrib.syndication.views import Feed
from django.core.urlresolvers import reverse
from django.shortcuts import get_object_or_404
from django.utils.text import Truncator
from django.utils.translation import ugettext as _
from storybase_asse... | denverfoundation/storybase | apps/storybase_story/feeds.py | Python | mit | 4,815 | 0.003323 |
"""Copyright 2008 Orbitz WorldWide
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, softwa... | brutasse/graphite-api | graphite_api/render/datalib.py | Python | apache-2.0 | 7,097 | 0 |
# -*- coding: utf-8 -*-
from chat.models import Message
from django.conf.urls import patterns, include, url
from django.contrib import admin
from django.contrib.auth.models import User
from django.views.generic.list import ListView
# Uncomment the next two lines to enable the admin:
admin.autodiscover()
urlpatterns ... | rewiko/chat_django | chat/urls.py | Python | gpl-2.0 | 881 | 0.013652 |
#!/usr/bin/env python
#
# Raman off-resonant activity calculator
# using VASP as a back-end.
#
# Contributors: Alexandr Fonari (Georgia Tech)
# Shannon Stauffer (UT Austin)
#
# MIT license, 2013
#
def parse_poscar_header(inp_fh):
import sys
from math import sqrt
#
inp_fh.seek(0) # just in... | alexandr-fonari/raman-sc | VASP/vasp_raman.py | Python | mit | 11,443 | 0.008914 |
import matplotlib as mpl
mpl.rcParams['font.size'] = 14
from morphforge.stdimports import *
from morphforgecontrib.stdimports import *
eqnset_txt_na = """
define_component hh_na {
i = g * (v-erev) * m**3*h
m_inf = m_alpha_rate / (m_alpha_rate + m_beta_rate)
m_tau = 1.0 / (m_alpha_rate + m_beta... | mikehulluk/morphforge | doc/srcs_generated_examples/python_srcs/poster1.py | Python | bsd-2-clause | 4,063 | 0.007138 |
# Copyright 2017 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,... | google/wasserstein-dist | compute_all.py | Python | apache-2.0 | 2,165 | 0.006467 |
# -*- coding: utf-8 -*-
#
# This program is part of GASP, a toolkit for newbie Python Programmers.
# Copyright (C) 2009, the GASP Development Team
#
# 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 Foundatio... | tarzenda/gasp | tests/mockbackends.py | Python | gpl-3.0 | 772 | 0 |
import Image
import os
import math
import argparse
# Set the root directory
BASE_DIR = os.path.dirname(os.path.dirname(__file__))
HTML_DIR = os.path.join(BASE_DIR, 'diced_images')
def dice(image_path, out_name, out_ext, outdir, slices):
img = Image.open(image_path) # Load image
imgdir = os.path.join(outdir, ... | skolsuper/imagedicer | imagedicer.py | Python | mit | 3,913 | 0.004856 |
import os
from cauldron.test import support
from cauldron.test.support import scaffolds
class TestAlias(scaffolds.ResultsTest):
"""..."""
def test_unknown_command(self):
"""Should fail if the command is not recognized."""
r = support.run_command('alias fake')
self.assertTrue(r.faile... | sernst/cauldron | cauldron/test/cli/commands/test_alias.py | Python | mit | 2,067 | 0 |
import django_filters
from dal import autocomplete
from .models import Alert
class AlertFilter(django_filters.FilterSet):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.filters["reason"].lookup_expr = "icontains"
self.filters["author"].widget = autocomplete.Mo... | watchdogpolska/feder | feder/alerts/filters.py | Python | mit | 466 | 0 |
# -*- 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 'Repository.study'
db.add_column(u'repos_repository', 'study',
self.gf(... | 9929105/KEEP | keep_backend/repos/migrations/0002_auto__add_field_repository_study.py | Python | mit | 8,118 | 0.007761 |
import os
import sys
import threading
import SimpleHTTPServer
import SocketServer
import shutil
import enaml
from enaml.qt.qt_application import QtApplication
from PyQt4.QtCore import QFileSystemWatcher
from atom.api import Atom, Unicode, observe, Typed, Property, Int
from btsync import BTSync
import logging
logger ... | jminardi/syncnet | syncnet/main.py | Python | mit | 8,094 | 0.001483 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
################################################################################
#
# Copyright (c) 2015 Baidu.com, Inc. All Rights Reserved
#
################################################################################
"""
Description : manage config file $HOME/.b... | baidu/broc | dependency/BrocConfig.py | Python | apache-2.0 | 5,186 | 0.003471 |
import csv
import collections
import itertools
def evaluateDuplicates(found_dupes, true_dupes):
true_positives = found_dupes.intersection(true_dupes)
false_positives = found_dupes.difference(true_dupes)
uncovered_dupes = true_dupes.difference(found_dupes)
print('found duplicate')
print(len(found_d... | dedupeio/dedupe-examples | patent_example/patent_evaluation.py | Python | mit | 1,311 | 0.006102 |
from flex.datastructures import (
ValidationDict,
)
from flex.constants import (
OBJECT,
)
from flex.validation.common import (
generate_object_validator,
)
from .operation import (
operation_validator,
)
from .parameters import (
parameters_validator,
)
path_item_schema = {
'type': OBJECT,
}
... | pipermerriam/flex | flex/loading/schema/paths/path_item/__init__.py | Python | mit | 1,084 | 0 |
class Solution(object):
def isPalindrome(self, x):
"""
:type x: int
:rtype: bool
"""
s=str(x)
l=list(s)
l.reverse()
sq=''
s1=sq.join(l)
if s==s1:
return True
else:
return False
| thydeyx/LeetCode-Python | Palindrome Number.py | Python | mit | 302 | 0.023179 |
# Copyright 2006 Red Hat, 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; version 2 of the License.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY W... | aronparsons/spacewalk | client/rhel/rhn-client-tools/src/firstboot-legacy-rhel5/rhn_provide_certificate_gui.py | Python | gpl-2.0 | 2,411 | 0.004977 |
from tower import ugettext_lazy as _
# Add-on and File statuses.
STATUS_NULL = 0
STATUS_PENDING = 2
STATUS_PUBLIC = 4
STATUS_DISABLED = 5
STATUS_DELETED = 11
STATUS_REJECTED = 12
STATUS_APPROVED = 13
STATUS_BLOCKED = 15
STATUS_UNLISTED = 16
# AMO-only statuses. Kept here only for memory and to not re-use the IDs.
_S... | tsl143/zamboni | mkt/constants/base.py | Python | bsd-3-clause | 10,226 | 0 |
from .app import App
from .reviews import Reviews
from .r_longboarding import RLongboarding | Widdershin/community-review-poster | autoposter/__init__.py | Python | mit | 91 | 0.010989 |
# -*- coding: utf-8 -*-
"""
object file io is a Python object to single file I/O framework. The word
'framework' means you can use any serialization/deserialization algorithm here.
- dump: dump python object to a file.
- safe_dump: add atomic writing guarantee for ``dump``.
- load: load python object from a file.
Fe... | MacHu-GWU/single_file_module-project | sfm/obj_file_io.py | Python | mit | 6,059 | 0.000332 |
import numpy as np
from menpo.image import Image, BooleanImage, MaskedImage
from menpo.shape import PointCloud
from menpo.testing import is_same_array
def test_image_copy():
pixels = np.ones([1, 10, 10])
landmarks = PointCloud(np.ones([3, 2]), copy=False)
im = Image(pixels, copy=False)
im.landmarks['... | grigorisg9gr/menpo | menpo/image/test/image_copy_test.py | Python | bsd-3-clause | 1,372 | 0 |
from sqlalchemy import BigInteger, Column, String
from tornado.gen import coroutine
from tornado.ioloop import IOLoop
from tornado.web import Application, RequestHandler
from tornado_sqlalchemy import (
SessionMixin,
as_future,
set_max_workers,
SQLAlchemy,
)
db = SQLAlchemy()
set_max_workers(10)
c... | siddhantgoel/tornado-sqlalchemy | examples/multiple_databases.py | Python | mit | 2,508 | 0 |
##############################################################################
#
# Copyright (C) 2009 EduSense BV (<http://www.edusense.nl>).
# Copyright (C) 2011 credativ Ltd (<http://www.credativ.co.uk>).
# All Rights Reserved
#
# This program is free software: you can redistribute it and/or modify
# i... | rschnapka/bank-payment | account_banking_uk_hsbc/account_banking_uk_hsbc.py | Python | agpl-3.0 | 5,362 | 0 |
import importlib.util
class Config:
def __init__(self, path: str) -> None:
spec = importlib.util.spec_from_file_location('conf', path)
self.module = importlib.util.module_from_spec(spec)
spec.loader.exec_module(self.module)
@property
def rst_epilog(self) -> str:
"""A strin... | jeff-allen-mongo/mut | mut/tuft/config.py | Python | apache-2.0 | 911 | 0 |
"""
WSGI config for dtcbusroutes 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... | dhirajt/dtc | wsgi/dtcbusroutes/dtcbusroutes/wsgi.py | Python | gpl-3.0 | 1,146 | 0.000873 |
"""Undocumented Module"""
__all__ = ['doTest']
from panda3d.core import *
from panda3d.direct import *
from .IntervalGlobal import *
def doTest():
smiley = loader.loadModel('models/misc/smiley')
smiley.reparentTo(render)
pi = ProjectileInterval(smiley, startPos=Point3(0, 0, 0),
... | brakhane/panda3d | direct/src/interval/ProjectileIntervalTest.py | Python | bsd-3-clause | 437 | 0.009153 |
from .constants import *
from ._xlcall import * | thatcr/cffi-xll | src/xlcall/templates/__init__.py | Python | mit | 47 | 0.021277 |
# Copyright 2015 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 subprocess
from devtoolslib.shell import Shell
from devtoolslib import http_server
class LinuxShell(Shell):
"""Wrapper around Mojo shell running ... | collinjackson/mojo | mojo/devtools/common/devtoolslib/linux_shell.py | Python | bsd-3-clause | 2,385 | 0.002935 |
#(C) Copyright Syd Logan 2017-2020
#(C) Copyright Thousand Smiles Foundation 2017-2020
#
#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 req... | slogan621/tscharts | tschartslib/clinicstation/clinicstation.py | Python | apache-2.0 | 30,523 | 0.003407 |
#coding:utf8
from flask.ext.sqlalchemy import SQLAlchemy
from . import app
app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///relative/../../test.db'
db = SQLAlchemy(app)
| prikevs/PasteSite | paste/database.py | Python | mit | 173 | 0.00578 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import django.db.models.deletion
import rdmo.core.models
class Migration(migrations.Migration):
dependencies = [
('domain', '0001_initial_after_reset'),
]
operations = [
migrations.C... | DMPwerkzeug/DMPwerkzeug | rdmo/questions/migrations/0001_initial_after_reset.py | Python | apache-2.0 | 5,793 | 0.003798 |
# Sum of num divisble by 3 and 5 upto 1000
def sumN(n):
return ((n * (n+1)) // 2)
def sumDivisibleBy(num, upto):
linearUpto = (upto-1)//num
return num * sumN(linearUpto)
upto = int(input())
ans = sumDivisibleBy(3,upto) + sumDivisibleBy(5,upto) - sumDivisibleBy(15,upto)
print(ans)
| iammrdollar/ProjectEulerSolutions | Problem 1 - Multiples of 3 and 5/mul_3_5.py | Python | mit | 296 | 0.016892 |
from flask import Flask
from flask.ext.restful import reqparse, abort, Api, Resource
app = Flask(__name__)
api = Api(app)
TODOS = {
'todo1': {'task': 'build an API'},
'todo2': {'task': '?????'},
'todo3': {'task': 'profit!'},
}
def abort_if_todo_doesnt_exist(todo_id):
if todo_id not in TODOS:
... | CanalTP/flask-restful | examples/todo.py | Python | bsd-3-clause | 1,446 | 0.003458 |
# 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... | openstack/senlin | senlin/tests/unit/cmd/test_conductor.py | Python | apache-2.0 | 1,992 | 0 |
##############################################################################
# Copyright (c) 2013-2017, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
#
# This file is part of Spack.
# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
# LLNL-CODE-64... | skosukhin/spack | var/spack/repos/builtin/packages/htop/package.py | Python | lgpl-2.1 | 1,706 | 0.000586 |
import ctypes
import graph_partitioning.partitioners.utils as putils
from graph_partitioning.partitioners.patoh.parameters import PATOHParameters
'''
Usage:
# Load the library
libPath = 'path/to/libpatoh.dylib' # .so for linux
lib = LibPatoh(libraryPath = libPath)
lib.load()
# Check library is Loaded
if lib.libIsLo... | sbarakat/graph-partitioning | graph_partitioning/partitioners/patoh/patoh.py | Python | mit | 5,305 | 0.005844 |
from __future__ import (absolute_import, division, print_function,
unicode_literals)
from prov.model import *
EX_NS = Namespace('ex', 'http://example.org/')
EX_OTHER_NS = Namespace('other', 'http://example.org/')
class TestAttributesBase(object):
"""This is the base class for testing su... | krischer/prov | prov/tests/attributes.py | Python | mit | 5,400 | 0.000926 |
# ##### BEGIN GPL LICENSE BLOCK #####
#
# 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 distrib... | portnov/sverchok | utils/sv_IO_monad_helpers.py | Python | gpl-3.0 | 3,948 | 0.002786 |
import codecs
import json
import os
import shutil
import socket
import subprocess
import tempfile
from contextlib import contextmanager
from cStringIO import StringIO
from django.conf import settings
from django.core import mail
from django.core.files.storage import default_storage as storage
from django.core.urlresol... | kumar303/zamboni | mkt/developers/tests/test_tasks.py | Python | bsd-3-clause | 24,331 | 0 |
import sys
import solution
# from classes import ?
class TestSuite:
def run(self):
self.test000()
self.test001()
self.test002()
# self.test003()
# self.test004()
def test000(self):
print 'test 000\n'
n = 13
r = solution.answer(n)
pr... | 54lihaoxin/GoogleFooBar | src/guard_game/test_suite.py | Python | apache-2.0 | 938 | 0.007463 |
from fabric.api import *
from fabric.utils import *
from fabric.contrib import *
class Apt(object):
def __init__(self):
return
def update(self):
cmd = 'sudo apt update'
run(cmd)
print(cmd)
def purge(self, package):
cmd = 'sudo apt purge -y %(package)s' % {'packag... | stregatto/fabric_lib | apt.py | Python | gpl-2.0 | 651 | 0.003072 |
"""
WSGI config for pelawak 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
from whitenoise.django import Django... | mclumd/pelawak | pelawak/wsgi.py | Python | mit | 482 | 0 |
# -*- coding: utf-8 -*-
import io
import os
import pytest
import six
from anymarkup_core import *
from test import *
class TestSerialize(object):
"""Note: testing serialization is a bit tricky, since serializing dicts can result
in different order of values in serialized string in different runs.
That ... | bkabrda/anymarkup-core | test/test_serialize.py | Python | bsd-3-clause | 3,156 | 0.000951 |
"""Handle automations."""
# Copyright 2013-2017 The Home Assistant Authors
# https://github.com/home-assistant/home-assistant/blob/master/LICENSE.md
# This file was modified by The Camacq Authors.
import logging
from collections import deque
from functools import partial
import voluptuous as vol
from camacq.exception... | CellProfiling/cam_acq | camacq/plugins/automations/__init__.py | Python | apache-2.0 | 10,741 | 0.000745 |
# -*- coding: utf-8 -*-
# @Date : Jul 13, 2016
# @Author : Ram Prakash, Sharath Puranik
# @Version : 1
import CART
from QuillLanguage import QuillLanguage
import pickle
class QuillTrainer(object):
def __init__(self,quillLang):
if isinstance(quillLang,QuillLanguage):
self.langua... | teamtachyon/Quillpad-Server | QuillTrainer.py | Python | bsd-3-clause | 4,979 | 0.022896 |
"""
Module for storing static data structures
"""
import os
import sys
VERSION = 0.9999
PID = os.getpid()
S3SITE_CFG_DIR = os.path.join(os.path.expanduser('~'), '.s3site')
S3SITE_CFG_FILE = os.path.join(S3SITE_CFG_DIR, 'config')
S3SITE_LOG_DIR = os.path.join(S3SITE_CFG_DIR, 'logs')
S3SITE_META_FILE = '__s3site.cfg'
... | jtriley/s3site | s3site/static.py | Python | gpl-3.0 | 2,179 | 0 |
from pylab import *
data = loadtxt('Data/dummy_data.dat')
posterior_sample = atleast_2d(loadtxt('posterior_sample.txt'))
ion()
for i in xrange(0, posterior_sample.shape[0]):
hold(False)
plot(data[:,0], data[:,1], 'bo')
hold(True)
plot(data[:,0], posterior_sample[i, -data.shape[0]:], 'r-')
ylim([0, 1.1*data[... | jchiang87/TimeBombs | display.py | Python | gpl-3.0 | 548 | 0.021898 |
"""
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
Written (W) 2013 Heiko Strathmann
Written (W) 2013 Dino Sejdinovic
"""
fro... | karlnapf/kameleon-mcmc | kameleon_mcmc/tools/Visualise.py | Python | bsd-2-clause | 5,656 | 0.006895 |
import os
from twisted.trial import unittest
from lisa.server.plugins.PluginManager import PluginManagerSingleton
class LisaPluginTestCase(unittest.TestCase):
def setUp(self):
self.pluginManager = PluginManagerSingleton.get()
def test_a_install_plugin_ok(self):
answer = self.pluginManager.ins... | Seraf/LISA | lisa/server/tests/test_plugins.py | Python | mit | 2,790 | 0.002867 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.3 on 2017-07-03 18:56
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.manager
class Migration(migrations.Migration):
dependencies = [
('wiblog', '0003_auto_20160325_1441'),
]
operations =... | lo-windigo/fragdev | wiblog/migrations/0004_auto_20170703_1156.py | Python | agpl-3.0 | 1,015 | 0 |
"""
This scripts compares the autocorrelation in statsmodels with
the one that you can build using only correlate.
"""
import numpy as np
import matplotlib.pyplot as plt
import scipy.signal as signal
import statsmodels.api as sm
from signals.time_series_class import MixAr, AR
from signals.aux_functions import sidekick... | h-mayorquin/time_series_basic | examples/auto_correlations_compare.py | Python | bsd-3-clause | 1,897 | 0 |
from logbook import Logger
from ..core.local import get_current_conf
from ..core.connection import autoccontext
from .. import db
from datetime import timedelta, datetime
log = Logger(__name__)
def del_inactive_queries():
conf = get_current_conf()
with autoccontext(commit=True) as conn:
before = db.... | Answeror/torabot | torabot/tasks/delete.py | Python | mit | 1,277 | 0.003132 |
import os
from autotest.client import test, utils
# tests is a simple array of "cmd" "arguments"
tests = [["aio-dio-invalidate-failure", "poo"],
["aio-dio-subblock-eof-read", "eoftest"],
["aio-free-ring-with-bogus-nr-pages", ""],
["aio-io-setup-with-nonwritable-context-pointer", ""],
... | nacc/autotest | client/tests/aio_dio_bugs/aio_dio_bugs.py | Python | gpl-2.0 | 1,337 | 0.005236 |
#!/usr/bin/env python
"""
Copyright (c) 2021 Alex Forencich
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merg... | alexforencich/xfcp | lib/eth/lib/axis/tb/axis_frame_length_adjust_fifo/test_axis_frame_length_adjust_fifo.py | Python | mit | 9,383 | 0.001172 |
import sys
sys.path.append("../")
sys.path.append("../neuralmind")
import gzip
import cPickle
import numpy as np
import theano
import theano.tensor as T
from neuralmind import NeuralNetwork
from layers import HiddenLayer
from layers import DropoutLayer
import activations
from trainers import SGDTrainer
from trainer... | miguelpedroso/neuralmind | examples/cifar10_mlp2.py | Python | mit | 1,690 | 0.049112 |
# -*- coding: utf-8 -*-
#
# Atizo - The Open Innovation Platform
# http://www.atizo.com/
#
# Copyright (c) 2008-2010 Atizo AG. 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 Foundati... | atizo/djangojames | djangojames/forms/fields.py | Python | gpl-2.0 | 2,436 | 0.006568 |
#!/usr/bin/python2
# -*- coding: utf-8 -*-
#
# The Qubes OS Project, http://www.qubes-os.org
#
# Copyright (C) 2016 Marek Marczykowski-Górecki
# <marmarek@invisiblethingslab.com>
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the ... | woju/qubes-core-admin | tests/hardware.py | Python | lgpl-2.1 | 2,564 | 0.00078 |
######################## BEGIN LICENSE BLOCK ########################
# The Original Code is mozilla.org code.
#
# The Initial Developer of the Original Code is
# Netscape Communications Corporation.
# Portions created by the Initial Developer are Copyright (C) 1998
# the Initial Developer. All Rights Reserved.
... | adam111316/SickGear | lib/chardet/eucjpprober.py | Python | gpl-3.0 | 3,754 | 0.001332 |
"""
Serialization
``django.core.serializers`` provides interfaces to converting Django
``QuerySet`` objects to and from "flat" data (i.e. strings).
"""
from decimal import Decimal
from django.db import models
class CategoryMetaDataManager(models.Manager):
def get_by_natural_key(self, kind, name):
retur... | mattseymour/django | tests/serializers/models/base.py | Python | bsd-3-clause | 3,903 | 0.000769 |
import io
import sys
import threading
import six
from chainer.dataset import dataset_mixin
class TextDataset(dataset_mixin.DatasetMixin):
"""Dataset of a line-oriented text file.
This dataset reads each line of text file(s) on every call of the
:meth:`__getitem__` operator.
Positions of line bound... | okuta/chainer | chainer/datasets/text_dataset.py | Python | mit | 6,272 | 0 |
"""Authentication for HTTP component."""
import base64
import logging
from aiohttp import hdrs
from aiohttp.web import middleware
import jwt
from homeassistant.auth.providers import legacy_api_password
from homeassistant.auth.util import generate_secret
from homeassistant.const import HTTP_HEADER_HA_AUTH
from homeass... | fbradyirl/home-assistant | homeassistant/components/http/auth.py | Python | apache-2.0 | 7,407 | 0.001215 |
# -*- coding: utf-8 -*-
"""
Project Bluebox
Copyright (C) <2015> <University of Stuttgart>
This software may be modified and distributed under the terms
of the MIT license. See the LICENSE file for details.
"""
from mcm.Bluebox import app
from mcm.Bluebox import configuration
# socketio.run(
# app,
app.run... | timwaizenegger/swift-bluebox | _runApp_Development_nodebug.py | Python | mit | 442 | 0.011312 |
from __future__ import unicode_literals
from django.db import models
from django.utils.translation import ugettext_lazy as _
from django.db.models.fields import FieldDoesNotExist
from django.core.exceptions import ImproperlyConfigured
from django.utils.timezone import now
from model_utils.managers import QueryManager... | GbalsaC/bitnamiP | venv/lib/python2.7/site-packages/model_utils/models.py | Python | agpl-3.0 | 3,021 | 0 |
import logging
from dao import DAO, TableDesc, FieldDesc
log = logging.getLogger(__name__)
card_td = TableDesc("Cards", "multiverseid",
[FieldDesc("multiverseid", "int"),
FieldDesc("set_code", "text"),
FieldDesc("number", "int"),
Fiel... | nuxgu/magic_db | sqldb/card_dao.py | Python | gpl-3.0 | 1,343 | 0.001489 |
# Copyright (c) 2014 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 unittest
from telemetry.core.timeline import model
from telemetry.core.backends.chrome import tracing_timeline_data
class TimelineModelUnittest(... | patrickm/chromium.src | tools/telemetry/telemetry/core/timeline/model_unittest.py | Python | bsd-3-clause | 529 | 0.003781 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.