code stringlengths 3 1.05M | repo_name stringlengths 5 104 | path stringlengths 4 251 | language stringclasses 1
value | license stringclasses 15
values | size int64 3 1.05M |
|---|---|---|---|---|---|
from collective.grok import gs
from eappi.map import MessageFactory as _
from plone.registry.interfaces import IRegistry
from zope.component import getUtility
from eappi.map.interfaces import IEappiSettings
@gs.importstep(
name=u'eappi.map',
title=_('eappi.map import handler'),
description=_(''))
def setu... | oikoumene/eappi.map | eappi/map/setuphandlers.py | Python | lgpl-3.0 | 554 |
# Copyright (c) 2018 Ultimaker B.V.
# Cura is released under the terms of the LGPLv3 or higher.
from PyQt5.QtCore import Qt, pyqtSignal, pyqtProperty, QTimer
from typing import Iterable, TYPE_CHECKING
from UM.i18n import i18nCatalog
from UM.Qt.ListModel import ListModel
from UM.Application import Application
import U... | Patola/Cura | cura/Machines/Models/ExtrudersModel.py | Python | lgpl-3.0 | 9,841 |
import pytest
def test_terms():
from pycldf.terms import TERMS
assert 'alignment' in TERMS.properties
assert not TERMS.is_cldf_uri('http://example.org')
assert TERMS.is_cldf_uri('http://cldf.clld.org/v1.0/terms.rdf#source')
assert len(TERMS.properties) + len(TERMS.classes) == len(TERMS)
ass... | glottobank/pycldf | tests/test_terms.py | Python | apache-2.0 | 1,201 |
# -*-coding:Utf-8 -*
# Copyright (c) 2013 LE GOFF Vincent
# 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
# lis... | stormi/tsunami | src/secondaires/navigation/equipage/ordres/ramer.py | Python | bsd-3-clause | 3,377 |
'''
datetime.tzinfo timezone definitions generated from the
Olson timezone database:
ftp://elsie.nci.nih.gov/pub/tz*.tar.gz
See the datetime section of the Python Library Reference for information
on how to use these modules.
'''
# The Olson database is updated several times a year.
OLSON_VERSION = '2015b'
VERSI... | GbalsaC/bitnamiP | venv/lib/python2.7/site-packages/pytz/__init__.py | Python | agpl-3.0 | 34,010 |
# wsse/__init__.py
# coding=utf-8
# pywsse
# Authors: Rushy Panchal, Naphat Sanguansin, Adam Libresco, Jérémie Lumbroso
# Date: August 30th, 2016
import logging
from . import settings
# If a handler is not already present, add a basic null handler to suppress
# errors.
logger = logging.getLogger(settings.LOGGER_NAME... | PrincetonUniversity/pywsse | wsse/__init__.py | Python | lgpl-3.0 | 391 |
# Copyright (C) 2014 Saggi Mizrahi, 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 version 2 as
# published by the Free Software Foundation.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY... | germanovm/vdsm | lib/yajsonrpc/__init__.py | Python | gpl-2.0 | 18,676 |
"""
Settings for edX ACE on devstack.
"""
from __future__ import absolute_import
from openedx.core.djangoapps.ace_common.settings import common
def plugin_settings(settings):
"""
Override common settings and use `file_email` for better debugging.
"""
common.plugin_settings(settings)
settings.AC... | ESOedX/edx-platform | openedx/core/djangoapps/ace_common/settings/devstack.py | Python | agpl-3.0 | 485 |
#!/usr/bin/env python
import os
import sys
import routes
import logging
import coloredlogs
import numpy as np
import tornado.web
import tornado.ioloop
import psycopg2.extras
import db.dbconn as db
from tornado import gen
import tornado.platform.twisted
tornado.platform.twisted.install()
from toradbapi import Connectio... | TiMed-dev/TIMed-backend | main.py | Python | mit | 1,687 |
# -*- coding: utf-8 -*-
### BEGIN LICENSE
# Copyright (C) 2010 Benjamin Elbers <elbersb@gmail.com>
#This program is free software: you can redistribute it and/or modify it
#under the terms of the GNU General Public License version 3, as published
#by the Free Software Foundation.
#
#This program is distributed in the... | xsteadfastx/otr-verwaltung | otrverwaltung/downloader.py | Python | gpl-3.0 | 22,876 |
#!/usr/bin/env python3
# SPDX-License-Identifier: LGPL-2.1+
import sys
import collections
import re
from xml_helper import xml_parse, xml_print, tree
from copy import deepcopy
TEMPLATE = '''\
<refentry id="systemd.directives" conditional="HAVE_PYTHON">
<refentryinfo>
<title>systemd.directives... | splantefeve/systemd | tools/make-directive-index.py | Python | gpl-2.0 | 10,612 |
# -*- coding: utf-8 -*-
#
# Advanced Emulator Launcher miscellaneous set of objects
#
# 1. Always use new style classes in Python 2 to ease the transition to Python 3.
# All classes in Python 2 must have object as base class.
# See https://stackoverflow.com/questions/4015417/python-class-inherits-object
# Copyr... | Wintermute0110/advanced-emulator-launcher | resources/objects.py | Python | gpl-2.0 | 305,546 |
"""
Support for RFXtrx sensors.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/sensor.rfxtrx/
"""
import logging
import voluptuous as vol
import homeassistant.components.rfxtrx as rfxtrx
import homeassistant.helpers.config_validation as cv
from homeassi... | devdelay/home-assistant | homeassistant/components/sensor/rfxtrx.py | Python | mit | 4,779 |
'''Compares a simulation of a ball sliding down a plane to the analytical solution.'''
import os
import sys
import argparse
import math
import h5py
parser = argparse.ArgumentParser(description='Compares a simulation of a ball sliding down a plane to the analytical solution.')
parser.add_argument('-i', metavar='input_... | breannansmith/scisim | assets/ball2d/shell_scripts/sliding_particle_test.py | Python | apache-2.0 | 2,585 |
#!/usr/bin/env python
# encoding: utf-8
#
# Copyright (c) 2010 Doug Hellmann. All rights reserved.
#
"""Example setting the locale using environment variable(s).
"""
#end_pymotw_header
import locale
import os
import pprint
import codecs
import sys
sys.stdout = codecs.getwriter('UTF-8')(sys.stdout)
# Default setting... | qilicun/python | python2/PyMOTW-1.132/PyMOTW/locale/locale_env_example.py | Python | gpl-3.0 | 2,201 |
"""
Created on Fri Apr 7 21:49:16 2017
@author: cpkmanchee
"""
import numpy as np
import os
import csv
import pickle
import warnings
from beamtools.file_formats import file_formats
from beamtools.common import DataObj
__all__ = ['import_data_file', 'list_atr','list_filetypes']
def list_filetypes():
'''Displa... | kikimaroca/beamtools | beamtools/import_data_file.py | Python | mit | 2,861 |
"""
WSGI config for sporteasy_breaking_mvc 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... | sporteasy/sporteasy_breaking_mvc | sporteasy_breaking_mvc/wsgi.py | Python | mit | 1,166 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('members', '0002_auto_20150908_2259'),
]
operations = [
migrations.CreateModel(
name='Members',
field... | RocketSoftware/PythonBetaProject | Django/src/members/migrations/0003_auto_20150908_2304.py | Python | mit | 715 |
from __future__ import unicode_literals
import re
from .common import InfoExtractor
from ..utils import (
int_or_none,
)
class InstagramIE(InfoExtractor):
_VALID_URL = r'http://instagram\.com/p/(?P<id>.*?)/'
_TEST = {
'url': 'http://instagram.com/p/aye83DjauH/?foo=bar#abc',
'md5': '0d2da... | MiLk/youtube-dl | youtube_dl/extractor/instagram.py | Python | unlicense | 3,554 |
# coding=utf-8
# Copyright 2014 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import (absolute_import, division, generators, nested_scopes, print_function,
unicode_literals, with_statement)
from pants.util.cont... | mateor/pants | tests/python/pants_test/backend/python/tasks2/test_python_run_integration.py | Python | apache-2.0 | 2,791 |
__author__ = 'phili'
| SNET-Entrance/Entrance-UM | src/viewer/__init__.py | Python | apache-2.0 | 21 |
import cv2
cameraCapture = cv2.VideoCapture(0)
fps = 30 # an assumption
size = (int(cameraCapture.get(cv2.cv.CV_CAP_PROP_FRAME_WIDTH)),
int(cameraCapture.get(cv2.cv.CV_CAP_PROP_FRAME_HEIGHT)))
videoWriter = cv2.VideoWriter(
'MyOutputVid.avi', cv2.cv.CV_FOURCC('I', '4', '2', '0'), fps, size)
success, frame = cameraC... | Masesi/DeepLearning | ComputerVision/camera_frames.py | Python | mit | 499 |
from pulp.client.commands import options
from pulp.client.commands.repo import cudl, importer_config
from pulp.client.commands.repo.importer_config import ImporterConfigMixin
from pulp.client.extensions.core import TAG_SUCCESS
from pulp.common.compat import json
from pulp.common.plugins import importer_constants as con... | lsjostro/pulp_win | extensions_admin/test/unit/extensions/admin/test_repo_create_update.py | Python | gpl-2.0 | 11,724 |
# test plugin
from __future__ import absolute_import
from bot.pluginDespatch import Plugin
from django.conf import settings
from django.contrib.auth.models import User
from bot.logos_decorators import login_required
from .models import BotNetGroups
import logging
logger = logging.getLogger(__name__)
logging.config.d... | kiwiheretic/logos-v2 | botnet/bot_plugin.py | Python | apache-2.0 | 3,218 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
cx_setup
~~~~~~~~
Converts example scripts to Windows executables.
"""
import glob
import sys
from cx_Freeze import setup, Executable
if not len(sys.argv[1:]):
sys.argv.append('install_exe')
install_exe_options = {'install_dir': './Autocad tools'}
bu... | reclosedev/pyautocad | cx_setup.py | Python | bsd-2-clause | 905 |
from __future__ import (absolute_import, division, print_function,
unicode_literals)
import six
import sys
import inspect
from warnings import warn
import logging
def _hush_llvm():
# Necessary for current stable release 0.11.
# Not necessary (and unimplemented) in numba >= 0.12 (Febru... | daniorerio/trackpy | trackpy/try_numba.py | Python | bsd-3-clause | 4,135 |
from flask import Flask, render_template, request, redirect, Response, url_for, session, abort
import time, os, json, base64, hmac, urllib, random, string, datetime
from hashlib import sha1
from ConfigParser import SafeConfigParser
from logging import Formatter
import requests
import boto3
application = Flask(__name__... | igg/filedrop | filedrop/filedrop.py | Python | lgpl-2.1 | 5,365 |
#coding:UTF-8
#Lib
#
#[Beautiful Soup 4]
#(https://www.crummy.com/software/BeautifulSoup/bs4/doc/index.zh.html)
#[Requests]
#(http://docs.python-requests.org/en/master/)
#[lxml]
#(http://lxml.de/)
#[selenium]
#(http://selenium-python.readthedocs.io/index.html)
import os
import bs4
import urllib
import requests
from s... | wiryls/HomeworkCollectionOfMYLS | 2017.DigitalImageProcessing/src/module/crawler/old/crawler.py | Python | mit | 3,534 |
import os
import json
import asyncio
from unittest import mock
import pytest
from tests import utils as test_utils
from boto.glacier.exceptions import UnexpectedHTTPResponseError
from waterbutler.core.path import WaterButlerPath
from waterbutler.providers.osfstorage import settings
from waterbutler.providers.osfsto... | Johnetordoff/waterbutler | tests/providers/osfstorage/test_tasks.py | Python | apache-2.0 | 7,757 |
from openupgradelib import openupgrade
from odoo import SUPERUSER_ID, api, tools
from odoo.modules.module import get_module_resource
def _load_demo(env):
def load_file(env, module, *args):
tools.convert_file(
env.cr,
"account_wallet",
get_module_resource(module, *args)... | acsone/acsone-addons | account_wallet/hooks.py | Python | agpl-3.0 | 2,218 |
__author__ = 'calvin'
import os
import time
import datetime
from anonymoususage import AnonymousUsageTracker
usage_tracker = AnonymousUsageTracker(config='./anonymoususage.cfg',
uuid="ASDFGH",
filepath='./test.db',
... | lobocv/anonymoususage | test.py | Python | mit | 605 |
name1_0_1_0_1_0_0 = None
name1_0_1_0_1_0_1 = None
name1_0_1_0_1_0_2 = None
name1_0_1_0_1_0_3 = None
name1_0_1_0_1_0_4 = None | asedunov/intellij-community | python/testData/completion/heavyStarPropagation/lib/_pkg1/_pkg1_0/_pkg1_0_1/_pkg1_0_1_0/_pkg1_0_1_0_1/_mod1_0_1_0_1_0.py | Python | apache-2.0 | 128 |
# Generated by Django 1.9.13 on 2017-05-11 10:59
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('publisher', '0047_auto_20170413_1010'),
]
operations = [
migrations.AlterField(
model_name='historicalorganizationuserrole',
... | edx/course-discovery | course_discovery/apps/publisher/migrations/0048_auto_20170511_1059.py | Python | agpl-3.0 | 989 |
"""SCons.Tool.sgiar
Tool-specific initialization for SGI ar (library archive). If CC
exists, static libraries should be built with it, so the prelinker has
a chance to resolve C++ template instantiations.
There normally shouldn't be any need to import this module directly.
It will usually be imported through the gen... | looooo/pivy | scons/scons-local-1.2.0.d20090919/SCons/Tool/sgiar.py | Python | isc | 2,570 |
import pytest
import dcos_installer.config
from dcos_installer import cli
def test_default_arg_parser():
parser = cli.parse_args([])
assert parser.verbose is False
assert parser.port == 9000
assert parser.action is None
def test_set_arg_parser():
parser = cli.parse_args(['-v', '-p 12345'])
... | movicha/dcos | pytest/test_installer_init.py | Python | apache-2.0 | 2,886 |
#!/usr/bin/env python
import re
with open("sicp.texi") as sicp:
r = sicp.read()
r = re.sub("@dots{}", "...", r)
r = re.sub("@section (.*?)\n", "<h2> \\1 </h2> \n", r)
r = re.sub("@subsection (.*?)\n", "<h3> \\1 </h3> \n", r)
r = re.sub("@subsubheading (.*?)\n", "<h4> \\1 </h4> \n", r)
r = re.s... | sliz1/isicp | sicp_raw/texi.py | Python | mit | 1,550 |
#! /usr/bin/env python
"""
edits mothur taxonomy summary file
transfers last name that is not "unclassified" or "uncultured" to "unclassified" or "uncultured" assignment
make sure that the file has default sorting (by rankID)
Copyright:
tax_summary_edit edits mothur taxonomy summary file
Copyright (C) 2016... | Brazelton-Lab/lab_scripts | 16S/tax_summary_edit.py | Python | gpl-2.0 | 1,875 |
import unittest
from ddt import ddt, data, file_data, unpack
from test.mycode import larger_than_two, has_three_elements, is_a_greeting
class Mylist(list):
pass
def annotated(a, b):
r = Mylist([a, b])
setattr(r, "__name__", "test_%d_greater_than_%d" % (a, b))
return r
@ddt
class FooTestCase(unitte... | edx/ddt | test/test_example.py | Python | mit | 1,773 |
import pylab as pl
import matplotlib.cm as cm
import numpy.ma as ma
import numpy as np
# utility functions
from mpl_toolkits.axes_grid1 import make_axes_locatable
def nice_imshow(ax, data, vmin=None, vmax=None, cmap=None):
"""Wrapper around pl.imshow"""
if cmap is None:
cmap = cm.jet
if vmin is No... | charterscruz/auto-encoder-tests | visualization/visualization_utils.py | Python | mit | 2,348 |
#!/usr/bin/env python3
import os
import repl
import sys
from vm import VM
if __name__ == '__main__':
if len(sys.argv) == 1:
repl.run()
filepath = sys.argv[1]
if not os.path.exists(filepath):
raise FileNotFoundError(filepath)
else:
vm = VM()
vm.evalFile(filepath)
| hachibu/setack | setack.py | Python | mit | 317 |
# -*- coding: utf-8 -*-
import jft
fin = open("chichi.csv", "r")
fout = open("food.json", "w")
fout.write('[')
preb = ""
prer = ""
for line in fin.readlines():
while line[-1] == '\n' or line[-1] == '\r':
line = line[0:-1]
line = line.replace('\\', '\\\\')
arr = line.split('\t')
photographer = ... | YangMann/ChiChiApp_Android | json/get.py | Python | gpl-3.0 | 1,848 |
from unittest import TestCase
class TestApp(TestCase):
def test_make_app(self):
from pyramid.router import Router
from brouz.app import make_app
global_settings = {}
settings = {'brouz.db_url': 'sqlite://',
'brouz.secret': 'secret'}
wsgi_app = make_app(... | dbaty/Brouz | brouz/tests/test_app.py | Python | bsd-3-clause | 397 |
# Author: Philippe Katz <philippe.katz@gmail.com>,
# Sylvain Takerkart <Sylvain.Takerkart@incm.cnrs-mrs.fr>
# License: BSD Style.
# Frame0_pipe. This pipeline is a component of blankbased_pipeline. It is used to choice in GUI between frame0_division and frame0_subtraction.
# Makes the link between blankbased_p... | SylvainTakerkart/vobi_one | brainvisa/toolboxes/vobi_one/processes/Trial Analysis/Blank Based Denoising/frame0_pipe.py | Python | gpl-3.0 | 5,962 |
#
# ex:ts=4:sw=4:sts=4:et
# -*- tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*-
#
# BitBake Toaster Implementation
#
# Copyright (C) 2015 Intel Corporation
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2 as
# pub... | Brainbuster/openpli-buildumgebung | bitbake/lib/toaster/toastergui/widgets.py | Python | gpl-2.0 | 12,716 |
"""Utilities for making internal assertions."""
from .collections import ( # noqa
assert_all_valid_keys,
assert_iterable_contains_all_expr_symbols)
| welchbj/tt | tt/_assertions/__init__.py | Python | mit | 158 |
import time
import json
import re
from slackclient import SlackClient # https://github.com/slackhq/python-slackclient
# token found at https://api.slack.com/web#authentication
def connect_to_slack(access_token):
if not access_token:
access_token = str(raw_input("Enter your developer access token: "))
... | andrewsy97/Treehacks | slack_listener.py | Python | mit | 2,978 |
"""
WSGI config for django_mturk_minimalistic 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.6/howto/deployment/wsgi/
"""
import os
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "minimalistic_mturk.s... | raffienficiaud/django_mturk_minimalistic | minimalistic_mturk/wsgi.py | Python | mit | 418 |
# coding: utf-8
"""
EVE Swagger Interface
An OpenAPI for EVE Online
OpenAPI spec version: 0.4.6
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from pprint import pformat
from six import iteritems
import re
class GetStatusOk(object):
"""
NOTE: This class is auto ... | minlexx/pyevemon | esi_client/models/get_status_ok.py | Python | gpl-3.0 | 5,256 |
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
try:
import pypandoc
description = pypandoc.convert('README.md', 'rst')
except (IOError, ImportError):
description = 'Basic implementation of K-Means clustering algorithm.'
setup(
name='KMeans',
version='0.... | kubkon/kmeans | setup.py | Python | mit | 691 |
# Load values from the instance config
url = instance['url']
default_timeout = self.init_config.get('default_timeout', 5)
timeout = float(instance.get('timeout', default_time))
# Use a hash of the URL as an aggregation key
aggregation_key = md5(url).hexdigest()
# Check the URL
start_time = time.time()
try:
r = re... | macobo/documentation | code_snippets/guides-agentchecks-ex-request.py | Python | bsd-3-clause | 579 |
# coding: utf-8
# python 2.7
import Orange
import pandas as pd
import numpy as np
import sys
import os
from collections import defaultdict
from itertools import chain
from itertools import combinations
from itertools import compress
from itertools import product
from sklearn.metrics import accuracy_score
from multiproc... | gingi99/research_dr | python/apriori/orange_apriori.py | Python | mit | 10,135 |
import collections
import pytest
from utils import log
#: A dict of tests, and their state at various test phases
test_tracking = collections.defaultdict(dict)
# Expose the cfme logger as a fixture for convenience
@pytest.fixture(scope='session')
def logger():
return log.logger
@pytest.mark.hookwrapper
def ... | thom-at-redhat/cfme_tests | fixtures/log.py | Python | gpl-2.0 | 4,066 |
"""sportassociation URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.8/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')
... | QSchulz/sportassociation | sportassociation/urls.py | Python | mit | 2,230 |
#coding:utf-8
#################################
#Copyright(c) 2014 dtysky
#################################
import G2R
class ScSp(G2R.SpSyntax):
def Show(self,Flag,Attrs,US,UT,Tmp,FS):
sw=''
name,Attrs=self.Check(Flag,Attrs,UT,FS)
if Attrs['k']=='Main':
sw+=' $ store.chapter='
sw+="'Chapter."+Attrs['cp... | dtysky/Gal2Renpy | Gal2Renpy/SpSyntax/ScSp.py | Python | mit | 352 |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, print_function, unicode_literals
import re
import json
import tempfile
import toml
import os
class RequirementsTXTUpdater(object):
SUB_REGEX = r"^{}(?=\s*\r?\n?$)"
@classmethod
def update(cls, content, dependency, version, spec="==", hashes... | kennethreitz/pipenv | pipenv/vendor/dparse/updater.py | Python | mit | 4,566 |
# -*- coding:utf-8 -*-
"""
竞赛页面
"""
from flask import Blueprint
from flask import render_template
from application.utils.loginHelper import ContestLoginHelper
contest = Blueprint("contest", __name__)
@contest.route("/contest",methods=["GET"])
@ContestLoginHelper.login_required
def contest_index():
return render... | nature-python/youcai-contest | application/controller/contest.py | Python | apache-2.0 | 1,031 |
# -*- coding: utf-8 -*-
#
# Copyright 2012 James Thornton (http://jamesthornton.com)
# BSD License (see LICENSE for details)
#
"""
Interface for interacting with a graph database through Rexster.
"""
from bulbs.config import Config
from bulbs.gremlin import Gremlin
from bulbs.element import Vertex, Edge
from bulbs.mod... | mudbungie/NetExplorer | env/lib/python3.4/site-packages/bulbs/titan/graph.py | Python | mit | 2,869 |
from flask.ext.script import Manager, Shell
from flask.ext.migrate import Migrate, MigrateCommand
import os
from app import app, db
app.config.from_object(os.environ['APP_SETTINGS'])
migrate = Migrate(app, db)
manager = Manager(app)
shell = Shell(use_ipython=True)
manager.add_command('db', MigrateCommand)
if __name... | hkdsun/qkd | manage.py | Python | mit | 356 |
import sys
import time
import os
import unittest
sys.path.append(os.path.join(os.path.dirname(__file__), '..'))
TEST_DATA_DIR = os.path.join(os.path.dirname(__file__), 'data')
# text_ = os.path.expanduser(os.path.join(TEST_DATA_DIR, 'text'))
seeds_ = os.path.expanduser(os.path.join(TEST_DATA_DIR, 'seeds'))
labelled_d... | usc-isi-i2/WEDC | tests/test_database.py | Python | apache-2.0 | 3,966 |
# Written by Bram Cohen
# see LICENSE.txt for license information
from random import randrange, shuffle
from BitTornado.clock import clock
try:
True
except:
True = 1
False = 0
class PiecePicker:
def __init__(self, numpieces,
rarest_first_cutoff = 1, rarest_first_priority_cutoff = 3,
... | lehoanganh/kcsdb | chef-repo/.chef/murder-kcsd/dist/BitTornado/BT1/PiecePicker.py | Python | apache-2.0 | 11,915 |
from flask import Blueprint, request, jsonify
from sqlalchemy.exc import IntegrityError
from api.core import db
from api.utils import delete_item, get_items
from api.decorators import requires_login, requires_roles, requires_keys
from api.models.parts import Manufacturer
blueprint = Blueprint('manufacturers', __name__... | CalPolyIEEE/api.calpolyieee.org | api/routes/manufacturers.py | Python | mit | 1,049 |
import os
import re
import sys
import shlex
import subprocess
import time
import json
from operator import xor
from contextlib import contextmanager
dirname = os.path.dirname(os.path.realpath(__file__))
os.chdir(dirname)
sys.path.append("../lib")
from util import cmd
mzbench_dir = dirname + '/../'
scripts_dir = mzb... | MrAlone/mzbench | acceptance_tests/mzb_test_utils.py | Python | bsd-3-clause | 9,638 |
"""
=================================
Gaussian Mixture Model Selection
=================================
This example shows that model selection can be perfomed with
Gaussian Mixture Models using information-theoretic criteria (BIC).
Model selection concerns both the covariance type
and the number of components in the... | florian-f/sklearn | examples/mixture/plot_gmm_selection.py | Python | bsd-3-clause | 3,192 |
#!/usr/bin/env python2
# Copyright 2017 The Kubernetes Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appl... | abgworrall/test-infra | kettle/stream_test.py | Python | apache-2.0 | 4,290 |
__author__ = 'Axion'
import unittest
import datetime
from work_tracker import _parse_line_into_date_and_comment, _parse_date_string_into_date
from work_tracker import _get_refs_from_comment, _get_nums_from_comment, _get_pertinant_words
class WorkTrackerTests(unittest.TestCase):
def test_parse_line_into_date_and... | devinbarry/yellow-worktracker | tests.py | Python | apache-2.0 | 2,235 |
from __future__ import division, absolute_import, print_function
import re
import sys
import os
import subprocess
__doc__ = """This module generates a DEF file from the symbols in
an MSVC-compiled DLL import library. It correctly discriminates between
data and functions. The data is collected from the output of the... | Microvellum/Fluid-Designer | win64-vc/2.78/python/lib/site-packages/numpy/distutils/lib2def.py | Python | gpl-3.0 | 3,487 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.2 on 2016-03-08 09:56
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('neatweb', '0004_auto_20160308_0846'),
]
operations = [
migrations.AddField(
... | jasonb5/pyneat-web | neatweb/migrations/0005_organism_network.py | Python | apache-2.0 | 500 |
__author__ = 'Irwan Fathurrahman <irwan@kartoza.com>'
__date__ = '10/05/17'
class Version(object):
"""
Version model for tracking versions.
"""
version = 0.0
edited_by = ''
edited_at = ''
| meomancer/field-campaigner | flask_project/campaign_manager/models/version.py | Python | bsd-3-clause | 214 |
#!/usr/bin/env python
"""
Copyright 2008 Glencoe Software, Inc. All rights reserved.
Use is subject to license terms supplied in LICENSE.txt
"""
from ez_setup import use_setuptools
use_setuptools()
from setuptools import setup
from omero_version import omero_version as ov
setup(name="OmeroWeb",
... | hflynn/openmicroscopy | components/tools/OmeroWeb/setup.py | Python | gpl-2.0 | 722 |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
import sys
from glob import glob
try:
from distribute_setup import use_setuptools
use_setuptools()
except ImportError:
import ez_setup
ez_setup.use_setuptools()
from setuptools import setup, find_packages, Extension
#######################
# Pre-install... | philouc/pyhrf | setup.py | Python | gpl-3.0 | 3,704 |
from socket import *
import threading as thrd
import multiprocessing as mult
import time
#############CLASS############
def setdict(idic,dic):
for i in dic:
idic[i]=dic[i]
class idict(dict):
def __getattribute__(self,key):
try:
return self[key]
except:
pass
d... | fenichs/zopir | zopir.py | Python | apache-2.0 | 4,731 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys # for system io
import datetime
import sqlite3 # for DB Activities
import urllib2 # for url parssing et al
import textwrap # To limit o/p characters per line
import subprocess # To invoke espeak
import time
import os
from nltk.corpus import wo... | esotericnomen/vocab_prep | cluster.py | Python | gpl-3.0 | 2,476 |
# -*- coding: utf-8 -*-
"""
WSGI config for myproject project.
It exposes the WSGI callable as a module-level variable named ``application``.
https://docs.djangoproject.com/en/1.9/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault("DJANGO_SETTINGS_MODULE", ... | tkjone/django-starters | series_3/p_01/myproject/src/server/config/wsgi.py | Python | mit | 381 |
class Solution:
"""
@param s: The first string
@param b: The second string
@return true or false
"""
# Time: is equal to sorted O(nlogn)
# Space: O(1)
def anagram(self, s, t):
# write your code here
s = sorted(s)
t = sorted(t)
return s == t
| rosegun38/LintCode | Two_Strings_Are_Anagrams/Solution.py | Python | gpl-3.0 | 307 |
#!/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 http://mozilla.org/MPL/2.0/.
# Copyright (c) 2015 Mozilla Corporation
# Reads from papertrail using the API and inserts log da... | Phrozyn/MozDef | mq/esworker_papertrail.py | Python | mpl-2.0 | 16,704 |
############################ Copyrights and license ############################
# #
# Copyright 2012 Vincent Jacques <vincent@vincent-jacques.net> #
# Copyright 2012 Zearin <zearin@gonk.net> ... | ahmad88me/PyGithub | github/Download.py | Python | lgpl-3.0 | 11,274 |
"""
unit tests for clustershell roster
"""
from tests.support.mock import MagicMock, patch
# Import Salt Testing libraries
from tests.support.unit import TestCase, skipIf
try:
from ClusterShell.NodeSet import NodeSet # pylint: disable=unused-import
HAS_CLUSTERSHELL = True
except (ImportError, OSError) as e... | saltstack/salt | tests/unit/roster/test_clustershell.py | Python | apache-2.0 | 1,592 |
### Paper RMSD selections ###
sel = []
sel.append(['a2_subdomain1_backbone','backbone and resid 57:68 and not name H*'])
sel.append(['motif_2_backbone','backbone and resid 117:124 and not name H*'])
sel.append(['aligned_CAs','protein and (resid 20:25 50:55 73:75 90:94 112:116 142:147 165:169 190:194 214:218 236:240 2... | rbdavid/DENV-NS3h | RMSD_analyses/sel_list.py | Python | gpl-3.0 | 529 |
from OpenGL.GLUT import *
from OpenGL.GLU import *
from OpenGL.GL import *
import sys
name = 'ball_glut'
def main():
glutInit(sys.argv)
glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH)
glutInitWindowSize(400,400)
glutCreateWindow(name)
glClearColor(0.,0.,0.,1.)
glShadeModel(GL_SMOOTH)... | ActiveState/code | recipes/Python/325391_Open_GLUT_window_draw_sphere_using/recipe-325391.py | Python | mit | 1,249 |
from .version import __version__
from dtreeviz.classifiers import clfviz
| parrt/dtreeviz | dtreeviz/__init__.py | Python | mit | 74 |
'''Module to handle unit conversions.
'''
# conversion functions
def identity(x):
'''Identify conversion. Useful when converting from a unit to itself.
'''
return x
def m2ft(d):
'''Meters to feet conversion.
'''
return 3.28084 * d
def ft2m(d):
'''Feet to meters conversion.
'''
... | mgalloy/burin | burin/units.py | Python | bsd-3-clause | 1,673 |
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from datetime import datetime
from flask.ext.sqlalchemy import BaseQuery
import simplejson
from sqlalchemy import Column, DateTime, Integer
from sqlalchemy.orm.exc import NoResultFound
from sqlalchemy.types import TEXT, UserDefinedType, TypeDecorator
__a... | amorwilliams/gst | server/apps/common/sqlalchemy.py | Python | mit | 5,210 |
from django.http import HttpResponse
from django.contrib.auth.models import User, Group
from django.utils import simplejson
from ganeti_webmgr.authentication.models import ClusterUser
def search_users(request):
""" search users and groups and return results as json """
if 'term' in request.GET:
term ... | dannyman/ganeti_webmgr | ganeti_webmgr/ganeti_web/views/user_search.py | Python | gpl-2.0 | 4,845 |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
# Copyright (C) 2010-2012 Cristian Salamea Gnuthink Software Labs Cia. Ltda
{
'name': 'Ecuador - Accounting',
'version': '1.1',
'category': 'Localization',
'description': """
This is the base module to m... | chienlieu2017/it_management | odoo/addons/l10n_ec/__manifest__.py | Python | gpl-3.0 | 769 |
from . import BaseWordChoice
class WordPreference(BaseWordChoice):
def pick_w(self,m,voc,mem,context=[]):
if m in voc.get_known_meanings():
if m in list(mem['prefered words'].keys()):
w = mem['prefered words'][m]
if w not in voc.get_known_words(m=m):
w = voc.get_random_known_w(m=m)
else:
w =... | flowersteam/naminggamesal | naminggamesal/ngstrat/word_choice/word_preference.py | Python | agpl-3.0 | 997 |
import os
import CTK
UPLOAD_DIR = "/tmp"
def ok (filename, target_dir, target_file, params):
txt = "<h1>It worked!</h1>"
txt += "<pre>%s</pre>" %(os.popen("ls -l '%s'" %(os.path.join(target_dir, target_file))).read())
txt += "<p>Params: %s</p>" %(str(params))
txt += "<p>Filename: %s</p>" %(filename)
... | cherokee/pyscgi | tests/test5.py | Python | bsd-3-clause | 850 |
# -*- coding: utf-8 -*-
from cmd_resolution import analysis, words_to_func
def test_analysis():
words = analysis(' play 1213 ')
assert words == ['play', '1213']
def test_words_to_func():
words = ['play', '1213', 'hello']
func = words_to_func(words)
assert func == 'play(1213, hello)'
| JanlizWorldlet/FeelUOwn | history_research/Cli/tests/test_analysis.py | Python | mit | 310 |
class AnonError(Exception):
pass
__all__ = ('AnonError',)
| tek/amino | amino/anon/error.py | Python | mit | 64 |
# -*- Mode:Python -*-
##########################################################################
# #
# This file is part of AVANGO. #
# ... | vrsys/avangong | avango-utils/python/_field_dump.py | Python | lgpl-3.0 | 2,357 |
"""Low-level AMQP client for Python (fork of amqplib)"""
# Copyright (C) 2007-2008 Barry Pederson <bp@barryp.org>
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of... | neumerance/deploy | .venv/lib/python2.7/site-packages/amqp/__init__.py | Python | apache-2.0 | 1,576 |
##### Description of this python file #####
# This is the file to calculate the adjusted elevation and determine whether or not slope/flow directions need to be recalculated
##### VARIABLES - Used in this file#####
# DTM - Digital terrain model of the river catchment
# cell_size - the cell size of the model
# nbr - a... | nickicejones/ENGAGE | ENGAGE2.0/ENGAGE2.0/Main model code/masswasting.py | Python | gpl-2.0 | 15,037 |
"""
ARCHES - a program developed to inventory and manage immovable cultural heritage.
Copyright (C) 2013 J. Paul Getty Trust and World Monuments Fund
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 Founda... | archesproject/arches | tests/importer/ontology_import_tests.py | Python | agpl-3.0 | 14,162 |
#!/usr/bin/env python
import unittest
from mapreduce import parameters
from mapreduce.api import map_job
from mapreduce.api.map_job import sample_input_reader
class MapJobConfigTest(unittest.TestCase):
"""Test for MapJobConfig.
MapJobConfig is declarative. Thus most functional tests are already
done by its pa... | potatolondon/potato-mapreduce | test/mapreduce/api/map_job/map_job_config_test.py | Python | apache-2.0 | 1,243 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.4 on 2018-01-25 22:52
from __future__ import unicode_literals
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
import django.utils.datetime_safe
class Migration(migrations.Migration):
initial = True
... | YuriyLisovskiy/messenger | account/migrations/0001_initial.py | Python | mit | 2,010 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright 2011 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 requir... | riannucci/rietveldv2 | tests/test_incomingmail.py | Python | apache-2.0 | 8,777 |
from typing import Optional
from fastapi import FastAPI, Security
from fastapi.security import OAuth2AuthorizationCodeBearer
from fastapi.testclient import TestClient
app = FastAPI()
oauth2_scheme = OAuth2AuthorizationCodeBearer(
authorizationUrl="authorize",
tokenUrl="token",
description="OAuth2 Code Be... | tiangolo/fastapi | tests/test_security_oauth2_authorization_code_bearer_description.py | Python | mit | 2,343 |
# All of the other examples directly embed the Javascript and CSS code for
# Bokeh's client-side runtime into the HTML. This leads to the HTML files
# being rather large. An alternative is to ask Bokeh to produce HTML that
# has a relative link to the Bokeh Javascript and CSS. This is easy to
# do; you just pass in ... | zrhans/python | exemplos/Examples.lnk/bokeh/plotting/file/relative_paths.py | Python | gpl-2.0 | 1,061 |
# -*- coding: utf-8 -*-
#
# Copyright (C) Zing contributors.
#
# This file is a part of the Zing project. It is distributed under the GPL3
# or later license. See the LICENSE file for a copy of the license and the
# AUTHORS file for copyright and authorship information.
import pytest
from pootle_app.forms import Lang... | evernote/zing | tests/forms/language.py | Python | gpl-3.0 | 1,448 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2012 NEC Corporation
#
# 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
#... | fajoy/horizon-example | openstack_dashboard/dashboards/admin/networks/subnets/views.py | Python | apache-2.0 | 1,035 |
from __future__ import unicode_literals
from django.utils import six
from djblets.testing.decorators import add_fixtures
from djblets.webapi.errors import PERMISSION_DENIED
from reviewboard.attachments.models import FileAttachment
from reviewboard.webapi.resources import resources
from reviewboard.webapi.tests.base i... | chipx86/reviewboard | reviewboard/webapi/tests/test_file_attachment_draft.py | Python | mit | 14,062 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.