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 |
|---|---|---|---|---|---|
'''
coffee.message
~~~~~~~~~~~~~~
Messages.
'''
import enum
from .channel import pack_float
class CommandType (enum.IntEnum):
Status1 = 1
Status2 = 2
Status3 = 3
Setpoint = 10
StartPump = 20
StopPump = 21
class Message (object):
#: Set this to a s... | blubber/silvia | coffee/coffee/message.py | Python | apache-2.0 | 1,937 |
# Copyright 2019 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.
from __future__ import print_function
from __future__ import division
from __future__ import absolute_import
import mock
import logging
import pprint
from ... | endlessm/chromium-browser | third_party/catapult/dashboard/dashboard/pinpoint/models/evaluators/job_serializer_test.py | Python | bsd-3-clause | 5,120 |
#!/usr/bin/env python3
import os
import sys
import time
from urllib.request import urlopen
from urllib.parse import urlencode
from urllib.error import HTTPError
from urllib.request import Request
from email.mime.multipart import MIMEMultipart
from email.mime.base import MIMEBase
from email.mime.application import MIM... | mworion/mountwizzard | snippets/ansrv/ps_ansrv.py | Python | apache-2.0 | 18,218 |
#
# webgateway/views.py - django application view handling functions
#
# Copyright (c) 2007, 2008, 2009 Glencoe Software, Inc. All rights reserved.
#
# This software is distributed under the terms described by the LICENCE file
# you can find at the root of the distribution bundle, which states you are
# free to use i... | joshmoore/openmicroscopy | components/tools/OmeroWeb/omeroweb/webgateway/views.py | Python | gpl-2.0 | 75,793 |
# -*- coding: utf-8 -*-
from werkzeug.serving import run_simple
from werkzeug.wsgi import DispatcherMiddleware
from quokka import create_app, create_api
application = DispatcherMiddleware(create_app(), {
'/api': create_api()
})
if __name__ == "__main__":
run_simple(
'0.0.0.0',
5000,
... | eltonsantos/quokka | wsgi.py | Python | mit | 392 |
# -*- coding: utf-8 -*-
#
# Copyright (C) Translate House and contributors.
#
# This file is a part of the PyLIFF 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 os
from lxml import etr... | translate/pyliff | pyliff/liff.py | Python | gpl-3.0 | 2,164 |
from .base import BaseImportTestCase
from tests.naturalkey_app.models import Place, Event
class NaturalKeyTestCase(BaseImportTestCase):
serializer_name = "tests.naturalkey_app.wizard.NoteSerializer"
def test_manual(self):
run = self.upload_file("naturalkey.csv")
# Inspect unmatched columns a... | wq/django-data-wizard | tests/test_naturalkey.py | Python | mit | 5,585 |
import OOMP
newPart = OOMP.oompItem(9101)
newPart.addTag("oompType", "INDU")
newPart.addTag("oompSize", "0806")
newPart.addTag("oompColor", "X")
newPart.addTag("oompDesc", "UH10")
newPart.addTag("oompIndex", "01")
OOMP.parts.append(newPart)
| oomlout/oomlout-OOMP | old/OOMPpart_INDU_0806_X_UH10_01.py | Python | cc0-1.0 | 243 |
###############################################################################
#
# codingDensityPlots.py - Create a GC histogram and a delta-CD plot.
#
###############################################################################
# #
#... | fw1121/CheckM | checkm/plot/distributionPlots.py | Python | gpl-3.0 | 2,829 |
#!/usr/bin/env python3
import sys
from sets import Set
edges=[]
surface_ids=[] # surface ids of the edges
nodes=[]
eles=[]
region_ids=[] # region ids of the elements
edge_attribute1=[] # first edge attribute
dim=-1
debug=0
def read_nodefile(filename):
f = open(filename, 'r')
global nodes, dim
[nodes, dim]=... | FluidityStokes/fluidity | tests/turbine_flux_penalty_2plus1/mesh/scripts/triangle.py | Python | lgpl-2.1 | 10,331 |
#! /usr/bin/python3
#
# This source code is part of icgc, an ICGC processing pipeline.
#
# Icgc 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... | ivanamihalek/tcga | icgc/10_local_db_loading/22_ensembl_id_tables.py | Python | gpl-3.0 | 2,911 |
# @MUNTJAC_COPYRIGHT@
# @MUNTJAC_LICENSE@
"""Provides a mechanism for handling a set of Properties."""
class IItem(object):
"""Provides a mechanism for handling a set of Properties, each associated
to a locally unique non-null identifier. The interface is split into
subinterfaces to enable a class to imp... | rwl/muntjac | muntjac/data/item.py | Python | apache-2.0 | 4,761 |
import logging
from uniform_model.functions.stack import FunctionStack
from uniform_model.functions.trunk import FunctionTrunk
from ..factories.base import Factory
logging.basicConfig(format='%(asctime)s <%(name)s> %(message)s')
logger = logging.getLogger('app.factories.function_factory')
logger.setLevel(logging.DEBU... | wenkaiqiu/petal | app/factories/function_factory.py | Python | bsd-3-clause | 1,004 |
import os
import subprocess
import requests
import shutil
import tempfile
from datetime import timedelta
from django.utils import timezone
from django.core.management.base import BaseCommand, CommandError
from core.models import Image, AnimatedGif
class Command(BaseCommand):
help = """
Generates animat... | timmygee/gifbox | gifbox/core/management/commands/render_gifs.py | Python | mit | 5,401 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright 2008-2009 Zuza Software Foundation
#
# This file is part of the Translate Toolkit.
#
# 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; e... | claudep/translate | translate/storage/placeables/parse.py | Python | gpl-2.0 | 3,307 |
## pygame - Python Game Library
## Copyright (C) 2000-2003 Pete Shinners
##
## This library is free software; you can redistribute it and/or
## modify it under the terms of the GNU Library General Public
## License as published by the Free Software Foundation; either
## version 2 of the License, or (... | kanaka/spacewar | python/mysysfont.py | Python | lgpl-2.1 | 9,605 |
# encoding: utf-8
"""Tests for code execution (%run and related), which is particularly tricky.
Because of how %run manages namespaces, and the fact that we are trying here to
verify subtle object deletion and reference counting issues, the %run tests
will be kept in this separate file. This makes it easier to aggreg... | noslenfa/tdjangorest | uw/lib/python2.7/site-packages/IPython/core/tests/test_run.py | Python | apache-2.0 | 13,433 |
# -*- coding: utf-8 -*-
r'''
werkzeug.script
~~~~~~~~~~~~~~~
.. admonition:: Deprecated Functionality
``werkzeug.script`` is deprecated without replacement functionality.
Python's command line support improved greatly with :mod:`argparse`
and a bunch of alternative modules.
Most ... | odubno/microblog | venv/lib/python2.7/site-packages/werkzeug/script.py | Python | bsd-3-clause | 11,241 |
# TODO add tests
class PatternPdf417:
START_SUBMODE = "ALPHA"
START_PATTERN = "11111111010101000"
STOP_PATTERN = "111111101000101001"
CHARACTER_PAD = 29
CODE_WORD_PAD = 900
SUBMODE_MAP = {
"ALPHA": {
"A": 0, "B": 1, "C": 2, "D": 3, "E": 4, "F": 5,
"G": 6, "H": 7... | sumsted/candybar | candybar/PatternPdf417.py | Python | apache-2.0 | 72,579 |
import datetime
import logging
from django.utils.functional import cached_property
from waldur_core.core import utils as core_utils
from .base import BaseReportLine
logger = logging.getLogger(__name__)
def parse_duration(value):
"""
Returns duration in minutes as an integer number.
For example 00:01:0... | opennode/nodeconductor-assembly-waldur | src/waldur_slurm/parser.py | Python | mit | 3,247 |
import os, re, unicodedata
from Renderer import Renderer
from enigma import ePixmap
from Tools.Alternatives import GetWithAlternative
from Tools.Directories import pathExists, SCOPE_SKIN_IMAGE, SCOPE_CURRENT_SKIN, resolveFilename
from Components.Harddisk import harddiskmanager
from ServiceReference import ServiceRefere... | popazerty/SDG-gui | lib/python/Components/Renderer/Picon.py | Python | gpl-2.0 | 4,029 |
"""SCons.Tool.Packaging
SCons Packaging Tool.
"""
#
# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 The SCons Foundation
#
# 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 Softwa... | cournape/numscons | numscons/scons-local/scons-local-1.2.0/SCons/Tool/packaging/__init__.py | Python | bsd-3-clause | 10,835 |
from django.forms import ModelForm
from .models import TvSub, MovieSub
class TvForm(ModelForm):
class Meta:
model = TvSub
fields = ['name', 'season', 'episode', 'lang', 'path']
class MovieForm(ModelForm):
class Meta:
model = MovieSub
fields = ['name', 'year', 'lang', 'path'... | antring/PollyPy | PollyUpload/forms.py | Python | mit | 322 |
from hashlib import sha1
import inspect
import sys
import re
import collections
from . import compat
def coerce_string_conf(d):
result = {}
for k, v in d.items():
if not isinstance(v, compat.string_types):
result[k] = v
continue
v = v.strip()
if re.match(r'^[-+... | dprince/dogpile.cache | dogpile/cache/util.py | Python | bsd-3-clause | 5,813 |
import http.client
import json
class Client:
def __init__(self, address):
self.connection = http.client.HTTPConnection(address)
def sources(self, start=-86400, end=0):
self.connection.request('GET', '/sources?start=' +
str(start) + '&end=' + str(end))
return json.loads(self.connection.getresponse().read()... | Preetam/sdb-python | sdb.py | Python | bsd-3-clause | 982 |
# -*- coding: utf-8 -*-
# Script que levanta a memoria el corpus, y graba los atributos "basicos" en las tablas correspondientes
import pln_inco.bioscope as bioscope
import pln_inco.bioscope.util
import os.path
import time
import sys
import sqlite3
working_dir=sys.argv[1]
dbname=os.path.join(working_dir,'bioscope.db... | gmonce/bioscope | thesis/src/scripts/test.py | Python | mit | 2,331 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
## Description Add Data to SDFile
##
## Authors: Inés Martínez (mmartinez4@imim.es)
## Manuel Pastor (manuel.pastor@upf.edu)
##
## Copyright 2015 Manuel Pastor
##
## This file is part of PhiTools
##
## PhiTools i... | manuelpastor/phitools | phitools/pivot.py | Python | gpl-3.0 | 4,138 |
from random import sample
from django.db.models import Count
from django.http import HttpResponse
from django.shortcuts import render
from homepage.models import Rotw, PSA
from referrals.models import Referral, Category
def homepage(request, template_name='homepage.html'):
categories = []
for category in Cat... | shubhendusaurabh/referiend | homepage/views.py | Python | mit | 2,044 |
__author__ = 'Joe Linn'
import abc
import pylastica.param
import pylastica.exception
class AbstractFilter(pylastica.param.Param):
__metaclass__ = abc.ABCMeta
def set_cached(self, cached=True):
"""
Sets the filter cache
@param cached:
@type cached: bool
@return:
... | jlinn/pylastica | pylastica/filter/abstractfilter.py | Python | apache-2.0 | 5,427 |
from appname.models import Product, Category
from flask import Blueprint, render_template, redirect, flash, url_for, request
from flask_table import Table, Col
from flask_wtf import Form
from wtforms import validators
from wtforms.fields import TextField, FileField
from wtforms.ext.sqlalchemy.fields import QuerySelectM... | ahmadpriatama/Flask-Simple-Ecommerce | appname/controllers/products.py | Python | bsd-2-clause | 4,039 |
{
'repo_type' : 'git',
'url' : 'https://github.com/georgmartius/vid.stab.git', #"Latest commit 97c6ae2 on May 29, 2015" .. master then I guess?
'rename_folder' : 'vidstab_git',
'conf_system' : 'cmake',
'configure_options' : '{cmake_prefix_options} -DCMAKE_INSTALL_PREFIX={target_prefix} -DENABLE_SHARED=OFF -DCMAKE... | DeadSix27/python_cross_compile_script | packages/dependencies/vidstab.py | Python | mpl-2.0 | 547 |
# pylint: disable=invalid-name, missing-docstring
from __future__ import print_function
import sys
with open(sys.argv[1], 'r') as fh:
for line in fh:
line = line.strip()
# TODO:
| durandj/codeeval | python/template.py | Python | gpl-3.0 | 203 |
# -*- coding: utf-8 -*-
# Copyright 2011 Takeshi KOMIYA
#
# 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... | unreal666/outwiker | plugins/diagrammer/diagrammer/libs/blockdiag/noderenderer/endpoint.py | Python | gpl-3.0 | 2,618 |
# Generated by Django 2.0 on 2017-12-21 19:58
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Patient',
fields=[
('id', mod... | jgirardet/unolog | unolog/patients/migrations/0001_initial.py | Python | gpl-3.0 | 1,186 |
# Copyright (c) 2013 Mirantis Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writ... | openstack/sahara | sahara/service/validations/clusters_scaling.py | Python | apache-2.0 | 3,432 |
# coding: utf-8
"""
Tv Shows related regex.
"""
from dsl import *
from refo import Plus, Question
from quepy.dsl import HasKeyword
from quepy.parsing import Lemma, Lemmas, Pos, QuestionTemplate, Particle
nouns = Plus(Pos("NN") | Pos("NNS") | Pos("NNP") | Pos("NNPS"))
class TvShow(Particle):
regex = Plus(Questi... | emoron/quepy | examples/freebase/freebase/tvshows.py | Python | bsd-3-clause | 3,001 |
from django.db import models
from django.utils.translation import ugettext_lazy as _
import re
class Account(models.Model):
user = models.ForeignKey(
'users.User',
verbose_name=_("user"),
related_name='accounts',
)
name = models.CharField(
max_length=255,
verbose_na... | bejmy/backend | bejmy/accounts/models.py | Python | mit | 1,856 |
import Hex # - импортируем модуль, содержащий в себе функцию symbols
from Hex import symbols
def delenie(x, n):
S = ''
lst = []
if n != 16:
if x < n: # - если введённое число меньше, чем основание n, то в список помещаем строковый формат введённого аргумента
lst = str(x)
return lst
else:
while x >=... | ElvisMongo/Mysnake | system_of_counts.py | Python | apache-2.0 | 2,145 |
"""
@name: PyHouse/src/Modules/Drivers/_test/test_Null.py
@author: D. Brian Kimmel
@contact: D.BrianKimmel@gmail.com
@copyright: (c) 2015-2018 by D. Brian Kimmel
@license: MIT License
@note: Created on Jul 30, 2015
@Summary:
"""
__updated__ = '2018-02-12'
# Import system type stuff
from twisted.tria... | DBrianKimmel/PyHouse | Project/src/Modules/Core/Drivers/_test/test_Null.py | Python | mit | 813 |
# -----------------------------------------------------------------------------
# Copyright (c) 2014--, The Qiita Development Team.
#
# Distributed under the terms of the BSD 3-clause License.
#
# The full license is in the file LICENSE, distributed with this software.
# ------------------------------------------------... | adamrp/qiita | qiita_db/metadata_template/__init__.py | Python | bsd-3-clause | 984 |
from twisted.trial import unittest
from sage import manifest, apps
class ManifestTests(unittest.TestCase):
def test_load_json(self):
manifest.load('../tests/apps_manifest.json')
self.assertEqual(len(manifest.apps), 2)
def test_load_apps(self):
manifest.load('../tests/apps_manifest.jso... | spicerack/sage | tests/test_manifest.py | Python | gpl-3.0 | 399 |
# -*- coding: utf-8 -*-
# Copyright 2021 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 ... | google/cloud-forensics-utils | libcloudforensics/providers/gcp/internal/storagetransfer.py | Python | apache-2.0 | 6,671 |
import src.sandbox.linalg as linalg
import numpy as np
class Cost(object):
def __init__(self):
pass
@staticmethod
def get(name):
if name == "quadratic":
return Cost.quadratic
if name == "np_quadratic":
return Cost.np_quadratic
return None
@sta... | awlange/brainsparks | src/sandbox/cost.py | Python | mit | 1,017 |
#! -*-coding:utf-8-*-
from flask import render_template, redirect, request, url_for, flash
from flask.ext.login import login_user, logout_user, login_required, current_user
from . import user
from .. import db
from .models import User
from .email import send_email
from .forms import LoginForm, RegistrationForm, ChangeP... | No7777/webserver | app/user/views.py | Python | gpl-3.0 | 5,897 |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals
import itertools
import logging
from datetime import datetime
from decimal import Decimal
import pytz
from django.contrib.auth.models import User
from example.models import DemoModel, Option
logger = logging.getLogger(__name__)
def cr... | saxix/django-excel-data-sync | tests/example/example/management/demo.py | Python | mit | 2,676 |
"""A simple web server that accepts POSTS containing a list of feed urls,
and returns the titles of those feeds.
"""
import eventlet
feedparser = eventlet.import_patched('feedparser')
# the pool provides a safety limit on our concurrency
pool = eventlet.GreenPool()
def fetch_title(url):
d = feedparser.parse(url)... | collinstocks/eventlet | examples/feedscraper.py | Python | mit | 1,125 |
# Copyright 2001 by Tarjei Mikkelsen. All rights reserved.
# This code is part of the Biopython distribution and governed by its
# license. Please see the LICENSE file that should have been included
# as part of this package.
# get set abstraction for graph representation
from functools import reduce
# TODO - Sub... | Ambuj-UF/ConCat-1.0 | src/Utils/Bio/Pathway/Rep/MultiGraph.py | Python | gpl-2.0 | 6,743 |
import numpy as np
import matplotlib.pyplot as plt
class One_Armed_Bandit:
def __init__(self, true_mean):
# Assigning the true mean as m
self.true_mean = true_mean
# Initializing mean as 0
# It will be further updated in the iteration
self.mean = 0
# Intializing number of actions to zero
sel... | arcyfelix/ML-DL-AI | Reinforcement Learning/2_one-armed_bandit.py | Python | apache-2.0 | 2,716 |
"""Support for Axis switches."""
from axis.event_stream import CLASS_OUTPUT
from homeassistant.components.switch import SwitchEntity
from homeassistant.core import callback
from homeassistant.helpers.dispatcher import async_dispatcher_connect
from .axis_base import AxisEventBase
from .const import DOMAIN as AXIS_DOM... | tchellomello/home-assistant | homeassistant/components/axis/switch.py | Python | apache-2.0 | 1,760 |
# Copyright (C) 2014 Andrey Antukh <niwi@niwi.be>
# Copyright (C) 2014 Jesús Espino <jespinog@gmail.com>
# Copyright (C) 2014 David Barragán <bameda@dbarragan.com>
# Copyright (C) 2014 Anler Hernández <hello@anler.me>
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU... | Zaneh-/bearded-tribble-back | taiga/permissions/service.py | Python | agpl-3.0 | 3,914 |
import pytest
import ibis
import ibis.expr.datatypes as dt
@pytest.mark.parametrize(
('column', 'raw_value'),
[
('double_col', 0.0),
('double_col', 10.1),
('float_col', 1.1),
('float_col', 2.2),
],
)
@pytest.mark.notimpl(["datafusion"])
def test_floating_scalar_parameter(b... | cpcloud/ibis | ibis/backends/tests/test_param.py | Python | apache-2.0 | 3,082 |
#!/usr/bin/env python
#
# Copyright 2018 Espressif Systems (Shanghai) PTE LTD
#
# 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... | krzychb/rtd-test-bed | tools/check_python_dependencies.py | Python | apache-2.0 | 4,451 |
#!env python
import sys
import time
from threading import Thread
from queue_util import Consumer, Producer
MAX_RUN_TIME = 120.0
def main(rabbit_queue_name, rabbit_host='127.0.0.1', rabbit_port=5672):
messages = [i for i in range(42, 690)]
producer = Producer(
rabbit_queue_name,
rabbit_ho... | EDITD/queue_util | tests/integration/app.py | Python | mit | 1,749 |
from django.contrib import admin
from app.models import Writer, Show, Episode
from awl.tests.models import Author, Book, Chapter
from awl.admintools import make_admin_obj_mixin, fancy_modeladmin
# remove the awl.test admin files, they confuse things
admin.site.unregister(Author)
admin.site.unregister(Book)
admin.site... | cltrudeau/django-awl | extras/sample_site/app/admin.py | Python | mit | 1,348 |
# -*- coding: utf-8 -*-
# $Id$
#
# Copyright (c) 2007-2011 Otto-von-Guericke-Universität Magdeburg
#
# This file is part of ECSpooler.
from backends import *
#from lib.data.BackendJob import BackendJob
from lib.data.BackendResult import BackendResult
from BackendTestCase import BackendTestCase
class ProgrammingBacke... | collective/ECSpooler | tests/ProgrammingBackendTestCase.py | Python | gpl-2.0 | 1,489 |
import math
from django.utils.html import urlize
from wagtail.core.blocks import StructBlock
from isi_mip.climatemodels.models import InputData, OutputData, BaseImpactModel, SimulationRound
from isi_mip.contrib.blocks import IntegerBlock, RichTextBlock
class ImpactModelsBlock(StructBlock):
description = RichTex... | bruecksen/isimip | isi_mip/climatemodels/blocks.py | Python | mit | 8,065 |
# Copyright (C) 2013 Linaro Limited
#
# Author: Tyler Baker <tyler.baker@linaro.org>
# Author: Antonio Terceiro <antonio.terceiro@linaro.org>
# Derived From: dummy.py
#
# This file is part of LAVA Dispatcher.
#
# LAVA Dispatcher is free software; you can redistribute it and/or modify
# it under the terms of the GNU Gen... | inwotep/lava-dispatcher | lava_dispatcher/device/jtag.py | Python | gpl-2.0 | 4,095 |
import pytest
from pandas._libs.tslibs.frequencies import (
INVALID_FREQ_ERR_MSG,
_period_str_to_code,
get_rule_month,
is_subperiod,
is_superperiod,
)
from pandas.tseries import offsets
@pytest.mark.parametrize(
"obj,expected",
[
("W", "DEC"),
(offsets.Week(), "DEC"),
... | toobaz/pandas | pandas/tests/tslibs/test_libfrequencies.py | Python | bsd-3-clause | 2,889 |
from __future__ import unicode_literals
from functools import total_ordering
from operator import attrgetter
from django import VERSION
from django.conf import settings
from django.contrib.contenttypes.fields import GenericRelation
from django.contrib.contenttypes.models import ContentType
from django.db import model... | tlksio/tlksio | env/lib/python3.4/site-packages/taggit/managers.py | Python | mit | 24,871 |
#coding:utf-8
import time
from helper import *
from core.cluster import Cluster
from router.client import StorageClient
class TestRouter(unittest.TestCase):
def testRouter(self):
stg = Cluster(keysPath + 'leo.pem')
stg._load('127.0.0.1/storage/0')
stg._load('127.0.0.1/storage/1'... | innerr/stars | _test/testrouter.py | Python | mit | 1,073 |
# Copyright 2014 Diamond Light Source Ltd.
#
# 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 t... | FedeMPouzols/Savu | savu/test/jenkins/plugin_tests/filter_tests/mc_near_absorption_correct_test.py | Python | gpl-3.0 | 1,357 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
A little bit of tests using pytest module.
"""
# py_ver : [3.5.2]
# date : [02.11.2016]
# author : [Aleksey Yakovlev]
# email : [nothscr@gmail.com]
import ac
POLICE = ac.AntiCheater()
class TestAntiCheat(object):
def test_base_word(self):
... | freenoth/nltktask | ac_test.py | Python | unlicense | 986 |
print "Hello World!"
print "Hello Again"
print "I like typing this."
print "This is fun."
print 'Yay! Printing.'
print 'I "said" do not touch this.'
print "I'd much rather you 'not'." | mble/Learn_Python | ex1.py | Python | gpl-2.0 | 183 |
# django-openid-auth - OpenID integration for django.contrib.auth
#
# Copyright (C) 2008-2010 Canonical Ltd.
#
# 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 ... | gimler/techism2 | django_openid_auth/auth.py | Python | apache-2.0 | 8,813 |
from __future__ import absolute_import, unicode_literals
from mopidy import compat
from mopidy.models import fields
from mopidy.models.immutable import ImmutableObject, ValidatedImmutableObject
from mopidy.models.serialize import ModelJSONEncoder, model_json_decoder
__all__ = [
'ImmutableObject', 'Ref', 'Image', ... | quartz55/mopidy | mopidy/models/__init__.py | Python | apache-2.0 | 10,873 |
#!/usr/bin/env python
#
# __COPYRIGHT__
#
# 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, merge, publish,
... | azverkan/scons | test/TEX/dryrun.py | Python | mit | 2,122 |
#!/usr/bin/env python
'''
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")... | zouzhberk/ambaridemo | demo-server/src/main/resources/scripts/relocate_host_components.py | Python | apache-2.0 | 16,871 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
import subprocess
import mechanize
import cookielib
import getpass
import sys
import os
import os.path
import errno
import ssl
import argparse
import atexit
import signal
import socket
import ConfigParser
import time
import zipfile
import urllib
import urlparse
import binascii... | sirfz/juniper-vpn-py | juniper-vpn.py | Python | lgpl-2.1 | 19,503 |
import json
import unittest
import wx
import os
from CreatorView.ResourceSheet import ResourceSheet
from ViewSetter import CreatorHolder
from viewmodel.SheetEntityChecker import AddModeSheetEntityChecker, EditModeSheetEntityChecker
DIR_TO_TEST_DEPS = "citySimNGView\\CreatorView\\test\\deps\\resource_sheet_test_deps\... | DarthThanatos/citySimNG | citySimNGView/CreatorView/test/ResourceSheetTest.py | Python | apache-2.0 | 4,420 |
"""Template for views - these features should be fulfilled to interact with main.py"""
class ViewInterface:
"""Basic game loop functions"""
def init(self, model):
"""Initialization, local use of model information"""
pass
def handle_events(self):
"""Process actions and interact with ... | betterin30days/PerpendicularPaths | view/viewinterface.py | Python | mit | 576 |
from setuptools import setup, find_packages
import sys, os
version = '0.0.25'
setup(
name='nodetool',
version=version,
description="Node tool to help with the build process.",
long_description="Node tool to help with the build process.",
classifiers=[],
keywords='',
author='Jeffrey Ness',
... | pombredanne/nodetool | setup.py | Python | gpl-2.0 | 999 |
import math
import torch
class MaternCovariance(torch.autograd.Function):
@staticmethod
def forward(ctx, x1, x2, lengthscale, nu, dist_func):
if any(ctx.needs_input_grad[:2]):
raise RuntimeError("MaternCovariance cannot compute gradients with " "respect to x1 and x2")
if lengthsca... | jrg365/gpytorch | gpytorch/functions/matern_covariance.py | Python | mit | 2,631 |
# -*- coding: utf-8 -*-
"""This module contains various functions for working with expressions.
- With `substitute()` you can replace occurrences of variables with an expression or sequence of expressions.
- With `replace()` you can replace a subexpression at a specific position with a different expression or
sequen... | wheerd/patternmatcher | matchpy/functions.py | Python | mit | 14,188 |
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: t -*-
# vi: set ft=python sts=4 ts=4 sw=4 noet :
# This file is part of Fail2Ban.
#
# Fail2Ban 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;... | Eyepea/fail2ban | fail2ban/tests/samplestestcase.py | Python | gpl-2.0 | 5,374 |
from edc_visit_schedule.site_visit_schedules import site_visit_schedules
from .rule import Rule
class VisitScheduleRule(Rule):
visit_schedule_name = None
schedule_name = None
visit_codes = None
def __init__(self, visit_schedule_name=None, schedule_name=None,
visit_codes=None, **kwa... | botswana-harvard/edc-rule-groups | edc_rule_groups/crf_rule.py | Python | gpl-2.0 | 1,227 |
# coding=utf-8
# Copyright 2018 The Tensor2Tensor 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 applicable... | mlperf/training_results_v0.5 | v0.5.0/google/research_v3.32/gnmt-tpuv3-32/code/gnmt/model/t2t/tensor2tensor/data_generators/wiki_revision.py | Python | apache-2.0 | 19,948 |
#-*- coding: utf-8 -*-
import unittest
from src.graph import Graph
from src.vertex_cover import vertex_cover
class VertexCoverTest(unittest.TestCase):
def test_vertex_cover_for_a_star_graph(self):
""" Given this graph:
(b)(c)(d)
\ | /
(i)-(a)-(e)
/... | topliceanu/learn | python/algo/test/test_vertex_cover.py | Python | mit | 2,060 |
# Authors:
# Jason Gerard DeRose <jderose@redhat.com>
#
# Copyright (C) 2008 Red Hat
# see file 'COPYING' for use and warranty information
#
# 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, ei... | hatchetation/freeipa | tests/test_ipalib/test_backend.py | Python | gpl-3.0 | 9,011 |
# vim: set expandtab sw=4 ts=4:
"""
Setup Celery Tasks Queue worker.
Copyright (C) 2014-2016 Dieter Adriaenssens <ruleant@users.sourceforge.net>
This file is part of buildtimetrend/python-service
<https://github.com/buildtimetrend/python-service/>
This program is free software: you can redistribute it and/or modify
... | buildtimetrend/service | celery_worker.py | Python | agpl-3.0 | 2,537 |
#!/usr/bin/env python
import argparse
import girder_client
from girder_client import GirderClient
import os
import fnmatch
import json
import mimetypes
from distutils.version import StrictVersion
if StrictVersion(girder_client.__version__) < StrictVersion("2.0.0"):
raise Exception("Girder 2.0.0 or newer is requir... | spinicist/ITK | Utilities/Maintenance/ArchiveTestingDataOnGirder.py | Python | apache-2.0 | 8,505 |
#!/usr/bin/env python
#
# Copyright 2008 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 o... | pcamp/google-appengine-wx-launcher | launcher/preferences_unittest.py | Python | apache-2.0 | 3,927 |
# Copyright (C) 2010-2012 CEA
#
# This file is part of shine
#
# 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 ... | kcgthb/lustre-shine | lib/Shine/Configuration/ModelFile.py | Python | gpl-2.0 | 19,390 |
# -*- coding: utf-8 -*-
from pandasqt.compat import Qt, QtCore, QtGui
import pytest
import pytestqt
import decimal
import numpy
import pandas
from pandasqt.models.ColumnDtypeModel import ColumnDtypeModel, DTYPE_ROLE
from pandasqt.models.SupportedDtypes import SupportedDtypes
from pandasqt.views.CustomDelegates imp... | datalyze-solutions/pandas-qt | tests/test_CustomDTypeModel.py | Python | mit | 5,894 |
from nfs4_const import *
from nfs4_type import createtype4, specdata4
from environment import check, checklist
def getDefaultAttr(c):
attr = {}
#attr[FATTR4_OWNER] = c.security.get_owner()
#attr[FATTR4_OWNER_GROUP] = c.security.get_group()
attr[FATTR4_MODE] = 0755
return attr
def _test_create(t, e... | srimalik/pynfs | nfs4.0/servertests/st_create.py | Python | gpl-2.0 | 8,053 |
__author__ = 'beast'
import base64, hashlib, random
from signals import post_save_activity
import redis
class Store(object):
def __init__(self, host="localhost", port=6379):
self.r = redis.StrictRedis(host=host, port=port, db=0)
self.user_id = None
def close(self):
pass
def logi... | mr-robot/granule | granule/granular/store.py | Python | mit | 3,362 |
# -*- coding: utf-8 -*-
from django import forms
from pagedown.widgets import PagedownWidget
from .models import Post
class PostForm(forms.ModelForm):
content = forms.CharField(widget=PagedownWidget(show_preview=True))
publish = forms.DateField(widget=forms.SelectDateWidget)
class Meta:
model = ... | lichi6174/django-api-lab | src/posts/forms.py | Python | mit | 462 |
""" Module for email related functionality. """
from flask_mail import Message
import api
mail = None
from api.common import check, validate, safe_fail
from api.common import WebException, InternalException
from voluptuous import Required, Length, Schema
from datetime import datetime
password_reset_request_schema ... | cganas/picoCTF-web | api/email.py | Python | mit | 6,072 |
import threading
class MessageQueue(object):
def __init__(self):
self.queue = []
self.mutex = threading.Lock()
def push_back(self, item):
if self.mutex.acquire():
self.queue.append(item)
self.mutex.release()
def pop_front(self):
item = None
... | toyteam/Mocores | python/mocores/core/util/message_queue.py | Python | mit | 756 |
# coding=utf-8
r"""
This code was generated by
\ / _ _ _| _ _
| (_)\/(_)(_|\/| |(/_ v1.0.0
/ /
"""
from tests import IntegrationTestCase
from tests.holodeck import Request
from twilio.base.exceptions import TwilioException
from twilio.http.response import Response
class SyncStreamTestCase(Integr... | tysonholub/twilio-python | tests/integration/sync/v1/service/test_sync_stream.py | Python | mit | 9,403 |
import cloudmesh
from pprint import pprint
mesh = cloudmesh.mesh("mongo")
username = cloudmesh.load().username()
print username
mesh.activate(username)
print cloudmesh.shell("cloud on india")
print cloudmesh.shell("cloud list")
flavor = mesh.flavor('india', 'm1.small')
image=mesh.image('india','futuresystems/ubuntu-14... | futuresystems-courses/465-Saksgupt | saksgupt_cloudmesh_ex3.py | Python | apache-2.0 | 381 |
from django.test import TestCase
from .factories import PurchaseOrderFactory, InvoiceFactory
from ..models import PurchaseOrder, Invoice
import pytest
@pytest.mark.django_db
class TestContractModel:
def test_model_instance(self):
model = InvoiceFactory.create()
assert isinstance(model, Invoice) ... | mpdevilleres/tbpc_app | tbpc/invoice_mgt/tests/test_models.py | Python | mit | 521 |
def test_packeteventsinformation_id_ip_source(self):
"""
Comprobacion de que el objeto de ip origen (referencia al modelo relacional) coincide con su asociado
Returns:
"""
ip_source = Ips.objects.get(Ip="127.0.0.2")
pei = PacketEventsInformation.objects.get(ID_IP_Source=ip_source)
self.asse... | MGautier/security-sensor | trunk/Documentacion/Memoria/trozos-codigo/codigo-9-1.py | Python | mit | 363 |
from datetime import datetime, timedelta
import pycron
from pytz import utc
import pendulum
import arrow
import udatetime
from delorean import Delorean
def test_day_names():
def run(now):
assert pycron.is_now('* * * * *', now)
assert pycron.is_now('* * * * thu', now)
assert pycron.is_now('... | kipe/pycron | tests/test_day_names.py | Python | mit | 4,280 |
from __future__ import absolute_import
from sentry.api.bases.project import ProjectEndpoint
from sentry.api.paginator import OffsetPaginator
from sentry.api.serializers import serialize
from sentry.models import GroupTombstone
class GroupTombstoneEndpoint(ProjectEndpoint):
def get(self, request, project):
... | jean/sentry | src/sentry/api/endpoints/group_tombstone.py | Python | bsd-3-clause | 934 |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'options_dialog_base.ui'
#
# Created: Mon Feb 17 11:50:09 2014
# by: PyQt4 UI code generator 4.10.3
#
# WARNING! All changes made in this file will be lost!
from PyQt4 import QtCore, QtGui
try:
_fromUtf8 = QtCore.QString.fromUtf8
e... | assefay/inasafe | safe_qgis/ui/options_dialog_base.py | Python | gpl-3.0 | 23,148 |
import os
__version__ = '1.0.0'
__license__ = 'GPL2'
__author__ = 'Bernd Strebel'
PACKAGE_DIR = os.path.dirname(os.path.abspath(__file__))
from .sync import EnClientSync
from .evernote_from_oxtask import EvernoteFromOxTask
from .evernote_from_toodledo import EvernoteFromToodledo
__all__ = [
'EnClientSync',
... | bstrebel/PySync | ensync/__init__.py | Python | gpl-2.0 | 371 |
import hashlib
import logging
import json
import psutil
from time import time, sleep
from uuid import uuid4
import dogstats_wrapper as dog_stats_api
from contextlib import contextmanager
from collections import Counter
from celery import Task, task
from celery.states import READY_STATES, SUCCESS, FAILURE, RETRY
from c... | BeDjango/intef-openedx | lms/djangoapps/emails_all_users/api.py | Python | agpl-3.0 | 48,719 |
from py_particle_processor_qt.tools.OrbitTool.OrbitTool import *
| DanielWinklehner/py_particle_processor | py_particle_processor_qt/tools/OrbitTool/__init__.py | Python | mit | 65 |
# -*- coding: utf-8 -*-
"""
pygments.lexers.r
~~~~~~~~~~~~~~~~~
Lexers for the R/S languages.
:copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
import re
from pygments.lexer import Lexer, RegexLexer, include, words, do_insertions
from ... | wandb/client | wandb/vendor/pygments/lexers/r.py | Python | mit | 23,755 |
"""mob URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.10/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-based ... | DmitryRendov/mob-site | mob/mob/urls.py | Python | mit | 989 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.