code stringlengths 3 1.05M | repo_name stringlengths 5 104 | path stringlengths 4 251 | language stringclasses 1
value | license stringclasses 15
values | size int64 3 1.05M |
|---|---|---|---|---|---|
# Copyright (c) 2016 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.
"""Helper functions for gcc_toolchain.gni wrappers."""
import os
import re
import subprocess
import shlex
import sys
_BAT_PREFIX = 'cmd /c call '
_WHIT... | geminy/aidear | oss/qt/qt-everywhere-opensource-src-5.9.0/qtwebengine/src/3rdparty/chromium/build/toolchain/wrapper_utils.py | Python | gpl-3.0 | 3,149 |
import unittest
from mock import patch
from qgis.core import QgsVectorLayer
from Roadnet.tests.integration.roadnet_test_cases import RoadnetTestCase
from Roadnet.roadnet import Roadnet
from Roadnet.ramp import ramp
import Roadnet.roadnet_exceptions as rn_except
class TestRamp(RoadnetTestCase):
def test_mock_ifa... | thinkWhere/Roadnet | tests/integration/test_ramp.py | Python | gpl-2.0 | 1,067 |
#!/usr/bin/env python
# encoding: utf-8
import tweepy
import json
import time
import csv
import jsonpickle
# Open/Create a file to append data
path = "/home/user/Downloads/twitter_app/twitter_data.json"
def start_mining():
#Twitter API credentials
access_token="838889260862287873-u6euWQmmwa5L5iq9SQOIGyS0YEY... | jluzuria2001/tuits | getweets.py | Python | apache-2.0 | 2,517 |
#!/usr/bin/python
# Week 2 Problem 3. Simple statistics.
# Use Python 3 print() function, Python 3 integer division
from __future__ import print_function, division
def get_stats(input_list):
'''
Accepts a list of integers, and returns a tuple of four numbers:
minimum(int), maximum(int), mean(float), and... | UI-DataScience/summer2014 | hw7/stats.py | Python | mit | 1,956 |
def autodiscover():
from autoload import autodiscover as auto_discover
auto_discover('dbindexes')
def load_indexes():
from django.conf import settings
from django.utils.importlib import import_module
for name in getattr(settings, 'DB_INDEX_MODULES', ()):
import_module(name)
| alefnula/perart | src/dbindexer/__init__.py | Python | gpl-3.0 | 309 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import sys
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
if sys.argv[-1] == 'publish':
os.system('python setup.py sdist upload')
sys.exit()
readme = open('README.rst').read()
history = open('HISTORY.rst... | db-art/mysql-statsd-tmp | setup.py | Python | bsd-3-clause | 1,554 |
from random import shuffle
import math
from app.domain.constants import CONSTANTS
from app.domain.format import FORMATS
from app.models import EventSearchMixin
from app.models.bot import Bot
from app.models.database import DBObject, DataInterface
from app.models.match import Match
class Bracket(DBObject, EventSearchM... | kaldonis/ft-event-manager | src/app/models/bracket.py | Python | gpl-2.0 | 9,518 |
# Copyright 2021 D-Wave Systems 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... | dwavesystems/dimod | dimod/binary/pybqm.py | Python | apache-2.0 | 12,149 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""
The obfs3 module implements the obfs3 protocol.
"""
import random
import obfsproxy.common.aes as aes
import obfsproxy.transports.base as base
import obfsproxy.transports.obfs3_dh as obfs3_dh
import obfsproxy.common.log as logging
import obfsproxy.common.hmac_sha256 as hm... | masterkorp/obfsproxy | obfsproxy/transports/obfs3.py | Python | bsd-3-clause | 9,428 |
"""
Generative Stochastic Networks
This is described in:
- "Generalized Denoising Auto-Encoders as Generative Models" Bengio, Yao, Alain,
Vincent. arXiv:1305.6663
- "Deep Generative Stochastic Networks Trainable by Backprop" Bengio,
Thibodeau-Laufer. arXiv:1306.1091
There is an example of training both unsuper... | lisa-lab/pylearn2 | pylearn2/models/gsn.py | Python | bsd-3-clause | 36,325 |
"""
:mod:`dic.dic_io` provides IO operations for DIC and associated files.
This includes loading (and possibly modifying) DIC data from ``.MAT`` files and MTS data from ``.CSV`` files.
In addition, the ability to find and sort image (or general) filenames is provided.
"""
from __future__ import absolute_import, divisi... | latture/dic | dic/dic_io.py | Python | mit | 12,496 |
from DateTime import DateTime
from DateTime.DateTime import safelocaltime
from DateTime.interfaces import DateTimeError
from Products.Archetypes import atapi
from Products.Archetypes.interfaces import IFieldDefaultProvider
from Products.Archetypes.public import BooleanField
from Products.Archetypes.public import FloatF... | bluedynamics/bda.plone.ticketshop | src/bda/plone/ticketshop/at/__init__.py | Python | bsd-3-clause | 12,235 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
.. module:: server
:platform: UNIX
:synopsis: Initialises and runs server.
.. moduleauthor:: Henry Mortimer <henry@morti.net>
"""
from twisted.internet import reactor
from twisted.internet.defer import inlineCallbacks, returnValue
from twisted.python import... | hennersz/finalYearProject | p2ppki/backend/server.py | Python | gpl-3.0 | 2,225 |
import unittest
import sys
from os.path import join, dirname
from mozlog import structured
import pytest
sys.path.insert(0, join(dirname(__file__), "..", ".."))
from wptrunner.testloader import EqualTimeChunker
structured.set_default_logger(structured.structuredlog.StructuredLogger("TestChunker"))
class MockTest(o... | youtube/cobalt | third_party/web_platform_tests/tools/wptrunner/wptrunner/tests/test_chunker.py | Python | bsd-3-clause | 3,008 |
# -*- coding: utf-8 -*-
#
# RERO ILS
# Copyright (C) 2021 RERO
# Copyright (C) 2021 UCLouvain
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, version 3 of the License.
#
# This program ... | rero/reroils-app | tests/unit/test_acq_order_lines_jsonschema.py | Python | gpl-2.0 | 1,804 |
"""The ants module provides basic functions for interfacing with ants functions.
Change directory to provide relative paths for doctests
>>> import os
>>> filepath = os.path.dirname( os.path.realpath( __file__ ) )
>>> datadir = os.path.realpath(os.path.join(filepath, '../../testing/data'))
>>> os.chdir(... | FredLoney/nipype | nipype/interfaces/ants/segmentation.py | Python | bsd-3-clause | 11,185 |
# encoding: utf-8
import os
import bson
import logging
import pymongo
from modularodm import fields, Q
from modularodm import exceptions as modm_errors
from modularodm.storage.base import KeyExistsException
from framework.auth import Auth
from framework.mongo import StoredObject
from framework.analytics import get_... | cldershem/osf.io | website/addons/osfstorage/oldels.py | Python | apache-2.0 | 6,749 |
# vim: ft=python fileencoding=utf-8 sts=4 sw=4 et:
# Copyright 2014-2016 Florian Bruhin (The Compiler) <mail@qutebrowser.org>
#
# This file is part of qutebrowser.
#
# qutebrowser 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 S... | bcb/qutebrowser | qutebrowser/misc/crashdialog.py | Python | gpl-3.0 | 24,670 |
import random
import pytest
from awx.api.versioning import reverse
from awx.main.models import (
Instance,
InstanceGroup,
ProjectUpdate,
)
from awx.main.utils import camelcase_to_underscore
@pytest.fixture
def tower_instance_group():
ig = InstanceGroup(name='tower')
ig.save()
return ig
@py... | GoogleCloudPlatform/sap-deployment-automation | third_party/github.com/ansible/awx/awx/main/tests/functional/api/test_instance_group.py | Python | apache-2.0 | 11,543 |
from django.conf import settings
from django.core.urlresolvers import reverse
from django.http import HttpResponse, HttpResponseForbidden, HttpResponseRedirect
from django.shortcuts import render_to_response, get_object_or_404
from django.template import RequestContext
from django.utils.translation import ugettext_lazy... | fgirault/smeuhsocial | apps/profiles/views.py | Python | mit | 7,878 |
# -*- coding: utf-8 -*-
"""Tests for LTI Xmodule LTIv2.0 functional logic."""
import datetime
import textwrap
import unittest
from mock import Mock
from pytz import UTC
from xblock.field_data import DictFieldData
from xmodule.lti_2_util import LTIError
from xmodule.lti_module import LTIBlock
from . import get_test... | stvstnfrd/edx-platform | common/lib/xmodule/xmodule/tests/test_lti20_unit.py | Python | agpl-3.0 | 16,973 |
###############################################################################
# Name: miscutil.py #
# Purpose: Various helper functions. #
# Author: Cody Precord <cprecord@editra.org> #
... | ezequielpereira/Time-Line | libs/wx/tools/Editra/src/ebmlib/miscutil.py | Python | gpl-3.0 | 1,166 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.7 on 2017-11-21 14:56
from __future__ import unicode_literals
import datetime
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('bot', '0023_auto_20171121_1454'),
]
operations = [
migratio... | foxcarlos/decimemijobot | bot/migrations/0024_auto_20171121_1456.py | Python | gpl-3.0 | 555 |
"""Test the config flow for the Insteon integration."""
from unittest.mock import patch
from homeassistant import config_entries, data_entry_flow, setup
from homeassistant.components.insteon.config_flow import (
HUB1,
HUB2,
MODEM_TYPE,
PLM,
STEP_ADD_OVERRIDE,
STEP_ADD_X10,
STEP_CHANGE_HUB_... | turbokongen/home-assistant | tests/components/insteon/test_config_flow.py | Python | apache-2.0 | 20,925 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.3 on 2017-02-12 13:10
from __future__ import unicode_literals
from django.conf import settings
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('instance', '0073_openstack_settings_data_defaults'),
]
... | open-craft/opencraft | instance/migrations/0074_openstack_region.py | Python | agpl-3.0 | 828 |
"""
yabon-py
- yet another binary object notation
- useful for sending objects through sockets
"""
import os
import sys
""""
For debugging purposes create a dummy class,
so it is runnable in CPython
"""
try:
from rpython.rlib.jit import JitDriver, elidable
except ImportError:
class JitDriver(object):
... | yabon-dev/yabon-rpy | src/de/yabon/main.py | Python | gpl-2.0 | 2,623 |
#!/usr/bin/python
#
# Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012 Google 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 ab... | andir/ganeti | lib/tools/burnin.py | Python | bsd-2-clause | 47,078 |
# Copyright 2016 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... | sandeepdsouza93/TensorFlow-15712 | tensorflow/python/debug/session_debug_testlib.py | Python | apache-2.0 | 35,597 |
from django.conf.urls import url
from corehq.apps.mobile_auth.views import (
admin_fetch_key_records,
fetch_key_records,
)
urlpatterns = [
url('^keys/$', fetch_key_records, name='key_server_url'),
url('^admin_keys/$', admin_fetch_key_records, name='admin_key_server_url'),
]
| dimagi/commcare-hq | corehq/apps/mobile_auth/urls.py | Python | bsd-3-clause | 293 |
import traceback
from selenium import webdriver
from selenium.common.exceptions import NoSuchElementException, StaleElementReferenceException, TimeoutException, \
NoAlertPresentException, UnexpectedAlertPresentException
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriver... | kiljoy001/keysurveyscrape | Key Survey Webscrape/index.py | Python | gpl-3.0 | 18,011 |
import base64
import hashlib
import json
import logging
import os
import smtplib
import urllib
import boto
from django.conf import settings
from django.core.mail import mail_admins
from django.core.validators import URLValidator
from django.core.exceptions import ValidationError
from django.http import HttpResponse, Ht... | krisrogers/textisbeautiful | tib/views.py | Python | apache-2.0 | 7,303 |
from ajenti.api import *
from ajenti.com import *
import json
class Backend (Plugin):
default_binary = { 'good_state': True }
default_decimal = { 'limit_susp': 33.0, 'limit_dang': 66.0 }
def __init__(self):
self.cfg = self._get_cfg()
def list_meters(self, category=None):
return filte... | jvehent/ajenti | ajenti/plugins/health/backend.py | Python | lgpl-3.0 | 1,404 |
import time
import requests
from .get import *
from .search import *
class Anilist:
"""
Initialize a new instance to the Anilist API.
This instance will handle read only credentials.
Pass in your client id and client secret.
In calls that require a user's auth token, you will need t... | ccubed/PyMoe | Pymoe/Anilist/__init__.py | Python | mit | 1,269 |
from flask import Flask, render_template, request, url_for
from API import main as builder
app = Flask(__name__)
@app.route('/', methods=['GET', 'POST'])
def homepage():
if request.method == 'POST':
return redirect(url_for('search'))
return render_template("pecan.html")
@app.route('/search', meth... | OmkarB/pecan | FlaskApp/__init__.py | Python | gpl-2.0 | 674 |
from __future__ import absolute_import
from sentry.message_filters import _browser_extensions_filter
from sentry.relay.config import ProjectConfig
from sentry.testutils import TestCase
class BrowserExtensionsFilterTest(TestCase):
def apply_filter(self, data):
project_config = ProjectConfig(self.project)
... | mvaled/sentry | tests/sentry/filters/test_browser_extensions.py | Python | bsd-3-clause | 3,336 |
from django.http import HttpResponseRedirect, HttpResponse
from django.shortcuts import render
from .reg2cal_func import UploadText, convert2calendar, get_time, create_ical_download
import csv
import base64
def index(request):
if request.method == 'POST':
form = UploadText(request.POST)
if form.is... | chin8628/Reg2Calendar | gcalendar_gen_class/genclass/views.py | Python | mit | 1,663 |
# -*- coding: utf-8 -*-
"""
Created on Fri Jun 06 18:48:19 2014
@author: Administrator
"""
import re
import os
def changecoder(item):
try:
item.decode('utf8')
k=item
except:
k = item.decode('gbk').encode('utf8');
k = k.replace(",","")
return k
def FileCheck(year,month,tid):
... | claudelee/bilibili-api | bilibili-video/数据分析/main.py | Python | mit | 13,191 |
# Copyright (c) 2009, Rotem Yaari <vmalloc@gmail.com>
# 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 li... | t-amerssonis/okami | src/Okami/third-parts/gitpy/exceptions.py | Python | mit | 2,527 |
# Copyright 2018 Open Source Robotics Foundation, 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... | ros2/launch | launch/test/launch/utilities/test_perform_substitutions.py | Python | apache-2.0 | 2,288 |
from datetime import date, datetime
import os
from django.conf import settings
from django.contrib import admin
from django.contrib.auth.models import User
from django.db import models
from django.db.models import Q
from django.utils.timezone import now
from pytz import timezone
localtz = timezone(settings.TIME_ZONE)... | ksmaheshkumar/django-DefectDojo | dojo/models.py | Python | bsd-3-clause | 24,279 |
import trollius as asyncio
from trollius import From
@asyncio.coroutine
def echo_server():
yield From(asyncio.start_server(handle_connection, 'localhost', 8000))
@asyncio.coroutine
def handle_connection(reader, writer):
while True:
data = yield From(reader.read(8192))
if not data:
... | haypo/trollius | examples/echo_server_tulip.py | Python | apache-2.0 | 479 |
#!/usr/bin/env python
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at https://mozilla.org/MPL/2.0/.
#
import sys
import json
import duo_client
import mozdef_client as mozdef
import pickle
from conf... | mpurzynski/MozDef | cron/duo_logpull.py | Python | mpl-2.0 | 9,367 |
import logging
from django.core.management.base import BaseCommand
from couchdbkit.exceptions import BulkSaveError
from dimagi.utils.couch.database import get_db
from corehq.util.couch import categorize_bulk_save_errors
logger = logging.getLogger(__name__)
def bulk_delete(db, docs):
if not docs:
retu... | dimagi/commcare-hq | corehq/apps/cleanup/management/commands/delete_doc_conflicts.py | Python | bsd-3-clause | 2,247 |
from cloudbot import hook
@hook.command("eval", permissions=["botcontrol"])
def eval_command(text, chan, nick, db, conn, bot, message, reply,
action, ctcp, notice, has_permission):
exec(text)
| Aaron1011/CloudBotPlugins | eval.py | Python | mit | 205 |
import os
import logging
LOG_LEVELS = {
'debug': logging.DEBUG,
'error': logging.ERROR,
'info': logging.INFO,
'none': logging.NOTSET,
'warning': logging.WARNING,
}
def start_logger(logname, filename, log_level):
consoleLogger = logging.StreamHandler()
consoleLogger.setLevel(logging.WARNING... | rubic/shaker | shaker/log.py | Python | bsd-2-clause | 935 |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
{
'name': 'Base',
'version': '1.3',
'category': 'Hidden',
'description': """
The kernel of OpenERP, needed for all installation.
===================================================
""",
'author': 'Op... | minhphung171093/GreenERP_V9 | openerp/addons/base/__openerp__.py | Python | gpl-3.0 | 2,841 |
import unittest
from tools.transcripts import Transcript, GenePredTranscript
class PositiveStrandTranscriptTests(unittest.TestCase):
"""
Tests the Transcript functionality part of sequence_lib.
Tests the example positive strand BED record drawn out below:
chrom 0 1 2 3 4 5 6 7 8 9 10 11 1... | ComparativeGenomicsToolkit/Comparative-Annotation-Toolkit | tests/transcript_tests.py | Python | apache-2.0 | 38,338 |
#doors
class Door(object):
"""Handle opening and closing of doors.
* Offener Durchgang
* Drehtuer
* Gitter
* Normale Tuer
* Getarnter Durchgang
* Schiebetuer
* Schwingtuer
"""
def __init__(self, name, key):
self.name = name
self.key = key
def open_door(self)... | empea-careercriminal/the_pool | tueren.py | Python | mit | 488 |
# vpnr 32
run_trial(rbs[2], duration=8.0)
run_trial(hori1, duration=1.500, speed=800)
run_trial(hori0, duration=3.000, speed=400)
run_trial(cm400, duration=8.0, speed=400)
run_trial(mem1, duration=5.000, speed=300)
run_trial(cm400, duration=8.0, speed=600)
run_trial(cm400, duration=8.0, speed=300)
run_trial(mem0, durat... | derNarr/synchronicity | experiment/sessions/ses_vp32.py | Python | mit | 5,332 |
#!/usr/bin/env python
# Raspberry Pi driver for the HC-SR04 ultrasonic rangefinder
# and similar devices.
# Copyright (C) 2014 Akkana Peck <akkana@shallowsky.com>>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free ... | akkana/pi-zero-w-book | distance/HC_SR04.py | Python | gpl-2.0 | 3,269 |
import os
import time
import yaml
from platform import python_version
from unittest import skipIf
import bzt
from bzt.engine import EXEC
from bzt.modules import ConsolidatingAggregator
from bzt.modules.functional import FuncSamplesReader, LoadSamplesReader, FunctionalAggregator
from bzt.modules._apiritif import Apir... | Blazemeter/taurus | tests/unit/modules/_selenium/test_python_executors.py | Python | apache-2.0 | 20,698 |
# -*- coding: utf-8 -*-
import re
from pyload.plugin.Account import Account
class FastshareCz(Account):
__name = "FastshareCz"
__type = "account"
__version = "0.06"
__description = """Fastshare.cz account plugin"""
__license = "GPLv3"
__authors = [("zoidberg", "zoidberg@mujmai... | ardi69/pyload-0.4.10 | pyload/plugin/account/FastshareCz.py | Python | gpl-3.0 | 1,367 |
"""
WSGI config for trellotask 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.10/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault("DJANGO_S... | true7/oleg_diatlenko_test_pj | src/trellotask/wsgi.py | Python | mit | 398 |
"""
Support for Cisco IOS Routers.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/device_tracker.cisco_ios/
"""
import logging
import voluptuous as vol
import homeassistant.helpers.config_validation as cv
from homeassistant.components.device_tracker im... | PetePriority/home-assistant | homeassistant/components/device_tracker/cisco_ios.py | Python | apache-2.0 | 4,756 |
# Copyright (c) 2013 "OKso http://okso.me"
#
# This file is part of Intercom.
#
# Intercom is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any late... | oksome/Intercom | intercom/minion.py | Python | agpl-3.0 | 4,028 |
#
# This file is a part of DNSViz, a tool suite for DNS/DNSSEC monitoring,
# analysis, and visualization.
# Created by Casey Deccio (casey@deccio.net)
#
# Copyright 2014-2015 VeriSign, Inc.
#
# DNSViz is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as publi... | edmonds/dnsviz | dnsviz/transport.py | Python | gpl-2.0 | 11,580 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.20 on 2019-07-30 10:42
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('competition', '0016_auto_20190401_2142'),
]
operations = [
migrations.Alte... | CasualGaming/studlan | apps/competition/migrations/0017_auto_20190730_1042.py | Python | mit | 1,095 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.4 on 2016-03-08 04:42
from __future__ import unicode_literals
import datetime
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [('eighth', '0036_merge')]
operations = [
migrations.RemoveField(
... | tjcsl/ion | intranet/apps/eighth/migrations/0037_auto_20160307_2342.py | Python | gpl-2.0 | 1,147 |
from sqlalchemy import create_engine, Column, Integer, String, DateTime, ForeignKey, func
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import sessionmaker, relationship, backref
Base = declarative_base()
engine = create_engine('sqlite:///news.db', connect_args={'check_same_thread':False}... | housne/tucao | news.py | Python | mit | 2,020 |
#!/usr/bin/env python
import sys
import os
from os.path import abspath, dirname, join
os.environ['DJANGO_SETTINGS_MODULE'] = 'example.settings'
sys.path.insert(0, abspath(join(dirname(__file__), '..', '..', 'example')))
sys.path.insert(0, abspath(join(dirname(__file__), '..', '..')))
from dynamic_forms import __vers... | uhuramedia/django-dynamic-forms | docs/source/conf.py | Python | bsd-3-clause | 1,222 |
# -*- coding: utf-8 -*-
from .. import Base
class State(Base):
""" State of an object """
| silenius/amnesia | amnesia/modules/state/model.py | Python | bsd-2-clause | 97 |
"""
WSGI config for djbootstrap4 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/3.0/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault('DJANGO_... | fullstackpython/blog-code-examples | bootstrap-4-django-template/step2/djbootstrap4/djbootstrap4/wsgi.py | Python | mit | 401 |
# 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-storage/azure/mgmt/storage/v2015_06_15/aio/_configuration.py | Python | mit | 3,345 |
from unittest.case import _ExpectedFailure, _UnexpectedSuccess
from unittesting import DeferrableTestCase, expectedFailure
class TestExpectedFailures(DeferrableTestCase):
def test_expected_failure_coroutine(self):
@expectedFailure
def testitem():
yield
1 / 0
try:
... | randy3k/UnitTesting | tests/test_expected_failures.py | Python | mit | 1,294 |
#!/usr/bin/env python
# ##### 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.
#
# ... | loglow/spine | web/spine/manage.py | Python | gpl-3.0 | 1,044 |
"""pinscher.
Usage:
pinscher init KEYFILE DATABASE [--key KEY] [--iv IV] [--length LENGTH] [--characters CHARACTERS]
pinscher add KEYFILE --domain DOMAIN --username USERNAME --pin PIN [--password PASSWORD] [--length LENGTH] [--characters CHARACTERS]
pinscher find KEYFILE... [--domain DOMAIN] [--username US... | WilliamMayor/pinscher | pinscher/scripts/pinscher.py | Python | gpl-3.0 | 4,224 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals, print_function
import ast
import token
import astroid
import unittest
import pytest
from .context import asttokens
from .tools import get_node_name
class TestUtil(unittest.TestCase):
def print_timing(self):
# pylint: disable=no-self-use
# T... | gristlabs/asttokens | tests/test_util.py | Python | apache-2.0 | 3,828 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
__author__ = 'Michael Liao'
'''
JSON API definition.
'''
import re, json, logging, functools
from transwarp.web import ctx
class Page(object):
'''
Page object for display pages.
'''
def __init__(self, item_count, page_index=1, page_size=10):
''... | ZhangChuann/awesome-python-webapp | www/apis.py | Python | gpl-3.0 | 3,886 |
# -*- coding: utf-8 -*-
'''
Local settings
- Run in Debug mode
- Use console backend for emails
- Add Django Debug Toolbar
- Add django-extensions as app
'''
from .common import * # noqa
# DEBUG
# ------------------------------------------------------------------------------
DEBUG = env.bool('DJANGO_DEBUG', default... | thisismsreddy/djangotwoscopes | config/settings/local.py | Python | bsd-3-clause | 1,955 |
"""
SocksProxy implementation.
"""
# TODO implement SocksProxy
| Valentijn1995/Kn0ckKn0ck | Proxies/SocksProxy.py | Python | mit | 68 |
# Copyright (C) 2012-2014 by the Free Software Foundation, Inc.
#
# This file is part of GNU Mailman.
#
# GNU Mailman 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 you... | trevor/mailman3 | src/mailman/runners/tests/test_confirm.py | Python | gpl-3.0 | 10,596 |
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | jcshen007/cloudstack | test/integration/component/test_netscaler_configs.py | Python | apache-2.0 | 108,213 |
import logging
import traceback
from cStringIO import StringIO
from psycopg2 import OperationalError
import openerp
from openerp import http
from openerp.service.model import PG_CONCURRENCY_ERRORS_TO_RETRY
from ..session import ConnectorSessionHandler
from ..queue.job import (OpenERPJobStorage,
... | Antiun/connector | connector/controllers/main.py | Python | agpl-3.0 | 4,204 |
#!/usr/bin/python
import xml.dom.minidom
import re
import sys
import string
import xmlparser
import codegenerator
def showParserInfo(parser):
for a in parser.attributes:
print "Attribute: "+str(parser.attributes[a])
print
for f in parser.methods:
print "Function: "+str(f)
def main():
... | yangrongwei/osgedit | src/doxygen/reflect.py | Python | gpl-2.0 | 1,071 |
from mock import patch
from tendrl.commons.message import Message as CommonMessage
from tendrl.commons.objects import BaseObject
from tendrl.node_agent.objects.cluster_message import ClusterMessage
from tendrl.node_agent.tests.test_init import init
def test_cluster_message():
init()
NS.config.data['message_r... | Tendrl/node-agent | tendrl/node_agent/tests/objects/test_cluster_message.py | Python | lgpl-2.1 | 992 |
# Copyright (c) 2015 Quobyte 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... | akash1808/nova_test_latest | nova/tests/unit/virt/libvirt/volume/test_quobyte.py | Python | apache-2.0 | 16,105 |
# coding: utf-8
from __future__ import unicode_literals
import functools
import hashlib
import json
import random
import re
import time
from .adobepass import AdobePassIE
from .common import InfoExtractor
from .youtube import YoutubeIE
from ..compat import (
compat_HTTPError,
compat_str,
)
from ..utils import... | spvkgn/youtube-dl | youtube_dl/extractor/vice.py | Python | unlicense | 12,414 |
import matplotlib.pyplot as plt
import numpy as np
import sys
sys.path.append('../../')
import pyterpol
# create the grid
sygri = pyterpol.SyntheticGrid()
# this one works - checked
sygri.read_list_from_file('gridlist', columns=['FILENAME', 'TEFF', 'LOGG'], family='BSTAR')
print sygri
print sygri.get_available_values... | chrysante87/pyterpol | pyterpol_test/test_SyntheticGrid/test_grid_creation.py | Python | gpl-2.0 | 1,351 |
# 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 ... | lmazuel/azure-sdk-for-python | azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/models/storage_profile.py | Python | mit | 2,446 |
import requests
import lxml.html
import datetime
import re
import urlparse
from mrq.context import connections, log
from mrq.job import queue_job
from mrq.task import Task
from mrq.queue import Queue
class Fetch(Task):
def run(self, params):
collection = connections.mongodb_jobs.simple_crawler_urls
... | IAlwaysBeCoding/mrq | examples/simple_crawler/crawler.py | Python | mit | 2,979 |
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
This module defines how cells are stored as tunacell's objects
"""
from __future__ import print_function
import numpy as np
import warnings
import treelib as tlib
from tunacell.base.observable import Observable, FunctionalObservable
from tunacell.base.datatools impo... | LeBarbouze/tunacell | tunacell/base/cell.py | Python | mit | 15,188 |
"""
Get accidents around a location. The input is currently the schools CSV list obtained by the project's team
This script is a standalone (using the API itself and not directly to DB) and can be run without setting up dev env.
To run:
python accidents_around_location.py <input_file> [flags]
"""
import argparse
impor... | hasadna/anyway | anyway/scripts/accidents_around_location.py | Python | mit | 7,703 |
# Copyright (c) 2013, Ny Fanilo Andrianjafy
# 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, this
# list of condi... | nylo-andry/PyFanorona | main.py | Python | bsd-2-clause | 1,639 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.7 on 2017-05-23 10:52
from __future__ import unicode_literals
import django.contrib.auth.models
import django.contrib.auth.validators
from django.db import migrations, models
import django.utils.timezone
class Migration(migrations.Migration):
initial = True
... | urfonline/api | api/users/migrations/0001_initial.py | Python | mit | 3,303 |
from django.db import models
from django.utils.encoding import python_2_unicode_compatible
from django.utils.translation import ugettext_lazy as _
from userena.utils import truncate_words
from userena.contrib.umessages.managers import (MessageManager, MessageContactManager,
... | bioinformatics-ua/django-userena | userena/contrib/umessages/models.py | Python | bsd-3-clause | 5,598 |
def includeme(obj):
obj.append(('init_includeme', obj))
return obj
def func(obj):
obj.append(('init_func', obj))
obj.include('.for_include.func_func')
return obj
| zzzsochi/includer | tests/__init__.py | Python | bsd-3-clause | 184 |
from distutils.core import setup
setup(
name='JSON Preprocessor',
packages=['json_preprocessor'],
scripts=['bin/json-preprocessor'],
url='https://bitbucket.org/tristanpenman/json-preprocessor',
description='JSON Preprocessor library and command line utility that can '
'be used to re... | tristanpenman/json-preprocessor | setup.py | Python | bsd-3-clause | 432 |
import re
import sys
import os.path
import os
pat1a = re.compile('include::([a-zA-Z0-9_\.\-/\/]+\/)\.([^\_]+)\_[a-zA-Z0-9]*\.py\[\]')
pat1b = re.compile('include::([a-zA-Z0-9_\.\-/\/]+\/)\.([^\_]+)\_[a-zA-Z0-9]*\.sh\[\]')
pat1c = re.compile('include::([a-zA-Z0-9_\.\-/\/]+\/)\.([^\_]+)\_[a-zA-Z0-9]*\.h\[\]')
pat1d = r... | kevincon/gcovr | doc/include_anchors.py | Python | bsd-3-clause | 2,392 |
import theano.tensor as T
import theano
import numpy as np
import caffe_pb2
import os
import cv2
import cPickle
from datetime import datetime
from collections import OrderedDict
from sklearn_theano.base import (Convolution, Relu, MaxPool, FancyMaxPool,
LRN, Feedforward, ZeroPad,
CaffePool)
from sklear... | erfannoury/SuperEdge | Codes/SuperEdge/SuperEdge/extract_feature.py | Python | mit | 17,136 |
#!/usr/bin/python3
# -*- coding: utf-8 -*-
import Pmf
import first
def ProbEarly(pmf):
"""
<= 37
"""
rate = 0.0
for w, p in pmf.Items():
if w > 37:
continue
rate += p
return rate
def ProbOnTime(pmf):
"""
38, 39, 40
"""
rate = 0.0
for w, p in pmf... | qrsforever/workspace | python/learn/thinkstats/2-6.py | Python | mit | 1,519 |
"""
Copyright (c) 2012-2013 RockStor, Inc. <http://rockstor.com>
This file is part of RockStor.
RockStor 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 la... | schakrava/rockstor-core | src/rockstor/storageadmin/models/dashboard_config.py | Python | gpl-3.0 | 967 |
__author__ = 'Sevak Mardirosian'
import sys
from PyQt4 import QtGui, uic
class DialogDemo(QtGui.QWidget):
#----------------------------------------------------------------------
def __init__(self):
"""Constructor"""
# super(DialogDemo, self).__init__()
QtGui.QWidget.__init__(self)
... | sevmardi/University-of-Applied-Sciences-Leiden | Python/ifscp_Opdrachten/Opdracht3.py | Python | mit | 1,376 |
#!/usr/bin/env python
from setuptools import setup
setup(
name='gmreader',
version='0.1.6',
description='Let python read your google emails to you. Listen to your gmails instead of reading them',
author='Jared Wright',
license='MIT',
keywords = "email gmail google mail read text to... | jawerty/gmreader | setup.py | Python | mit | 609 |
# -*- coding: utf-8 -*-
from __future__ import absolute_import
import os
import platform
import signal as _signal
from ... import platforms
from ... import signals
from ...app import app_or_default
from ..base import BasePool
from .pool import Pool, RUN
if platform.system() == "Windows": # pragma: no cover
# O... | mozilla/make.mozilla.org | vendor-local/lib/python/celery/concurrency/processes/__init__.py | Python | bsd-3-clause | 3,355 |
###############################################################################
#
# Tests for XlsxWriter.
#
# Copyright (c), 2013, John McNamara, jmcnamara@cpan.org
#
import unittest
from ...compatibility import StringIO
from ..helperfunctions import _xml_to_list
from ...drawing import Drawing
class TestAssembleDraw... | ivmech/iviny-scope | lib/xlsxwriter/test/drawing/test_drawing_chart01.py | Python | gpl-3.0 | 2,736 |
# coding=utf-8
# Author: Tyler Fenby <tylerfenby@gmail.com>
# URL: https://sickrage.github.io
# Git: https://github.com/SickRage/SickRage.git
#
# This file is part of SickRage.
#
# SickRage is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# t... | andrewleech/SickRage | sickbeard/failed_history.py | Python | gpl-3.0 | 8,907 |
# -*- coding: utf-8 -*-
import mdb
from unittest import TestCase
class TestGreaterFailure(TestCase):
def setUp(self):
import os
import errno
self.path = './testdbmi'
try:
os.makedirs(self.path)
except OSError as e:
if e.errno == errno.EEXIST and os.... | kunthar/hustle | deps/liblmdb/test/test_greater_failure.py | Python | mit | 4,516 |
#!/usr/bin/env micropython
from time import sleep
from sys import stderr
from os import listdir
from ev3dev2.console import Console
"""
Used to iterate over the system console fonts (in /usr/share/consolefonts) and show the max row/col.
Font names consist of three parameters - codeset, font face and font size. The cod... | dwalton76/ev3dev-lang-python | utils/console_fonts.py | Python | mit | 2,278 |
from gevent import monkey; monkey.patch_os()
from gevent.server import StreamServer
from multiprocessing import Process
def eat_cpu():
for i in xrange(10000): pass
def cb(socket, address):
eat_cpu()
socket.recv(1024)
socket.sendall('HTTP/1.1 200 OK\n\nHello World!!')
socket.close()... | dungeonsnd/test-code | dev_examples/pyserver/examples/fork.py | Python | gpl-3.0 | 624 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import django.utils.timezone
from django.conf import settings
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('spirit_topic... | gogobook/Spirit | spirit/comment/migrations/0001_initial.py | Python | mit | 1,836 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.