src stringlengths 721 1.04M |
|---|
import unittest
import time
import redis
from lightqueue.queue import Queue
from lightqueue.test.testclass import TestClass
class TestLightqueue(unittest.TestCase):
def setUp(self):
self.queue = Queue(queue_name='lqtest')
self.filename = 'test_file.txt'
def tearDown(self):
db = redis... |
########################################################################
# #
# python-OBD: A python OBD-II serial module derived from pyobd #
# #
# Copyright 2004 Donour Siz... |
#!./python_link
# -*- coding: utf-8 -*-
################################################################################
# DChars-FE Copyright (C) 2008 Xavier Faure
# Contact: faure dot epistulam dot mihi dot scripsisti at orange dot fr
#
# This file is part of DChars-FE.
# DChars-FE is free software: you c... |
from __future__ import absolute_import, unicode_literals
from chatpro.rooms.models import Room
from dash.orgs.models import Org
from dash.utils import intersection
from dash.utils.sync import ChangeType
from django.contrib.auth.models import User
from django.db import models
from django.utils.translation import ugette... |
# pychess
# mposner 11/23/14
from piece import Piece
from piece_attributes import PieceType, Color
from utils import isValidPosition
class Board:
"""Represents a chess board"""
def __init__(self):
"""Initialize a new chess board"""
self.makeNewPieces()
def __str__(self):
result = " " + 33*"="... |
#
# Copyright 2016 Amazon.com, Inc. or its affiliates. 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.
# A copy of the License is located at
#
# http://aws.amazon.com/apache2.0
#
# or in the "license" file accom... |
# -*- coding: latin1 -*-
################################################################################################
import datetime, sys, time, json, os, os.path, shutil, time, struct, random
import subprocess
reload(sys)
sys.setdefaultencoding('utf-8')
########################################################... |
#
# pyfeyner - a simple Python interface for making Feynman diagrams.
# Copyright (C) 2005-2010 Andy Buckley, Georg von Hippel
# Copyright (C) 2013 Ismo Toijala
#
# pyfeyner 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... |
#!/usr/bin/env python3
"""
Chord peer
==========
This module provides peer of a Chord distributed hash table.
"""
import random
import time
import socket
import socketserver
import threading
import logging
logging.basicConfig(format='%(asctime)s %(levelname)s:%(message)s',
level=logging.DEBUG)
CH... |
# -*- coding: utf-8 -*-
# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
###############################################################################
# OpenLP - Open Source Lyrics Projection #
# ------------------------------------------------------... |
# -*- coding: utf-8 -*-
from glob import glob
from re import compile
from json import dumps
class Damage(object):
def __init__(self):
self.damage_start = 0
self.damage_addon = 0
self.speed_start = 0
self.speed_addon = 0
self.dmg_min_start = None
self.dmg_min_addon = ... |
# -*- coding: utf-8 -*-
###############################################################################
#
# Copyright (C) 2001-2014 Micronaet SRL (<http://www.micronaet.it>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License a... |
# -*- coding: utf-8 -*-
# Copyright (c) 2018, Frappe Technologies and contributors
# For license information, please see license.txt
from __future__ import unicode_literals
import base64
import json
import frappe
from frappe.model.document import Document
from frappe.utils.background_jobs import enqueue
from frappe.... |
'''
Given a string s and a dictionary of words dict, add spaces in s to construct a sentence where each word is a valid dictionary word.
Return all such possible sentences.
For example, given
s = "catsanddog",
dict = ["cat", "cats", "and", "sand", "dog"].
A solution is ["cats and dog", "cat sand dog"].
'''... |
"""
Copyright (c) 2015 Red Hat, Inc
All rights reserved.
This software may be modified and distributed under the terms
of the BSD license. See the LICENSE file for details.
"""
from email.mime.text import MIMEText
import os
import smtplib
import socket
try:
from urlparse import urljoin
except ImportError:
fro... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import os.path
import re
import sys
import requests
import gevent
try:
from html.parser import HTMLParser
except ImportError:
from HTMLParser import HTMLParser
COMMENT = "^\s*#"
class TableParser(HTMLParser):
"""
T... |
###### Expect this script to take 1-2 minutes to fully run. It has to download 170 URLS.
###### Run as "python ratemyprof.py" in the terminal. The output will be printed to "ratemyprof.json" in the same directory.
###### It overwrites the json file each time with the new data.
###### Author: Lexi Christiansen
###### F... |
# -*- test-case-name: beah.core.test.test_command -*-
# Beah - Test harness. Part of Beaker project.
#
# Copyright (C) 2009 Red Hat, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; eithe... |
# coding=utf-8
# Copyright 2015 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import absolute_import, division, print_function, unicode_literals
from builtins import object
from twitter.common.collections import OrderedSet
from pant... |
# -*- coding: utf-8 -*-
from cadnano.proxies.cnproxy import UndoCommand
from cadnano.decorators.insertion import Insertion
from cadnano.cntypes import (
StrandT
)
class AddInsertionCommand(UndoCommand):
def __init__(self, strand: StrandT, idx: int, length: int):
super(AddInsertionCommand, self).__init_... |
# encoding: UTF-8
'''
本文件包含了CTA引擎中的策略开发用模板,开发策略时需要继承CtaTemplate类。
'''
from ctaBase import *
from vtConstant import *
########################################################################
class MultiCtaTemplate(object):
"""MultiCTA策略模板"""
# 策略类的名称和作者
className = 'MultiCtaTemplate'
author = EM... |
"""YAWT extension for category management
This extension registers a Blueprint and provides - a template varable with the
article counts for all the categories (folders), on the system.
"""
import os
import re
from flask import current_app, Blueprint
from yawt.utils import cfg
from yawtext import HierarchyCount, Plu... |
# Copyright (C) 2011 Groza Cristian
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is di... |
# -*- coding: utf-8 -*-
# Copyright 2018 The Chromium OS Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Unittests for cros_oobe_autoconfig.py"""
from __future__ import print_function
import json
import os
import pwd
import sys
f... |
import re
import datetime
from django.db import models
from ietf.doc.models import Document
from ietf.person.models import Person
from ietf.group.models import Group
from ietf.name.models import DraftSubmissionStateName
from ietf.utils.accesstoken import generate_random_key, generate_access_token
def parse_email_li... |
# -*- coding: UTF-8 -*-
# Copyright 2014-2019 Rumma & Ko Ltd
# License: GNU Affero General Public License v3 (see file COPYING for details)
from lino.api import dd, rt, _
from lino.utils.mldbc import babeld
def objects():
ListType = rt.models.lists.ListType
List = rt.models.lists.List
mailing = babeld(... |
import datetime
from bitmovin import Bitmovin, Encoding, HTTPSInput, S3Output, \
StreamInput, SelectionMode, Stream, EncodingOutput, ACLEntry, ACLPermission, \
MuxingStream, CloudRegion, ProgressiveWebMMuxing, VP9CodecConfiguration, OpusCodecConfiguration, VP9Quality
from bitmovin.errors import BitmovinError
... |
#!/usr/bin/env python3
# THIS FILE IS PART OF THE CYLC WORKFLOW ENGINE.
# Copyright (C) NIWA & British Crown (Met Office) & Contributors.
#
# 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... |
#!/usr/bin/env python
"""Generates tikz scripts for configurations of the origami model.
Takes template tikz scripts for geneting configuration diagrams and outputs a
script for configurations at specified steps in the specified intput file.
"""
import argparse
import sys
import string
from origamipy.origami_io imp... |
# -*- coding: utf-8 -*-
from south.utils import datetime_utils as datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Deleting model 'BookTextQuestionChoice'
db.delete_table('supersyncer_bo... |
# -*- coding: utf-8 -*-
"""
Single Sign-On views
"""
from urllib.parse import unquote, urlparse, urlunparse
from flask import (
Blueprint,
redirect,
request,
session,
url_for
)
from flask_security.utils import login_user, logout_user
from app.extensions import (
user_datastore,
oidc
)
s... |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.5 on 2017-01-09 05:56
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.Crea... |
class BaseLoadMixin(object):
def load_case(self, case_obj, variants):
"""Load a case and all of it's variants to the database.
Args:
variant (dict): A variant dictionary
"""
raise NotImplementedError
def get_variant(self, variant):
"""Retur... |
import copy
from datetime import datetime
from decimal import Decimal
from typing import NamedTuple, Callable, TYPE_CHECKING
from kivy.app import App
from kivy.factory import Factory
from kivy.properties import ObjectProperty
from kivy.lang import Builder
from kivy.clock import Clock
from kivy.uix.label import Label
f... |
import requests # Used to make HTTP requests
import json # Used to parse JSON
import os # Used to infer environment variables
API_TAGO = os.environ.get('TAGO_API') or 'https://api.tago.io'
REALTIME = os.environ.get('TAGO_REALTIME') or 'https://realtime.tago.io'
class Plan:
def __init__(self, acc_token):
sel... |
# encoding: utf-8
"""
environment.py
Created by Thomas Mangin on 2011-11-29.
Copyright (c) 2011-2015 Exa Networks. All rights reserved.
"""
# XXX: raised exception not caught
# XXX: reloading mid-program not possible
# XXX: validation for path, file, etc not correctly test (ie surely buggy)
import os
import sys
imp... |
"""A parser for HTML and XHTML."""
# This file is based on sgmllib.py, but the API is slightly different.
# XXX There should be a way to distinguish between PCDATA (parsed
# character data -- the normal case), RCDATA (replaceable character
# data -- only char and entity references and end tags are special)
# a... |
"""
Resystem Scheduling Service.
Released under New BSD License.
Copyright © 2015, Vadim Markovtsev :: Angry Developers LLC
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 ... |
"""
Test basic std::list functionality but with a declaration from
the debug info (the Foo struct) as content.
"""
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
class TestDbgInfoContentList(TestBase):
mydir = TestBase.compute_mydir(__file__)
... |
# -*- coding: utf-8 -*-
import re
from string import Template
from outwiker.gui.guiconfig import HtmlRenderConfig
from outwiker.core.application import Application
class MyTemplate (Template):
"""
Класс работы с шаблонами. Единственное, для чего сделан такой класс
- избавитсья от замены $$ на $
Реал... |
from django.conf import settings
from django.core.urlresolvers import reverse
from django.http import HttpResponseRedirect, Http404
from django.shortcuts import render
from django.utils import timezone
from woot.apps.catalog.forms import CreateProductReviewForm,\
CreateShopReviewForm, CreateSpaceReviewForm
from wo... |
import click
from sqlalchemy import create_engine
from kamcli.ioutils import ioutils_dbres_print
from kamcli.cli import pass_context
from kamcli.cli import parse_user_spec
@click.group("aliasdb", help="Manage database user aliases")
@pass_context
def cli(ctx):
pass
@cli.command("add", short_help="Add a user-ali... |
import six
from pyramid import httpexceptions
from enum import Enum
from kinto.core.logs import logger
from kinto.core.utils import json, reapply_cors, encode_header
class ERRORS(Enum):
"""Predefined errors as specified by the API.
+-------------+-------+------------------------------------------------+
... |
# 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 ... |
from hubcheck.pageobjects.po_time_base_page import TimeBasePage
from hubcheck.pageobjects.basepageelement import Link
class TimeOverviewPage(TimeBasePage):
"""time overview page"""
def __init__(self,browser,catalog,groupid=None):
super(TimeOverviewPage,self).__init__(browser,catalog)
self.path... |
#!/usr/bin/env python3
# Copyright (c) 2012 Google Inc. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Make the format of a vcproj really pretty.
This script normalize and sort an xml. It also fetches all the properties
inside linke... |
import logging
import unittest
from dogstream.cassandra import parse_cassandra
logger = logging.getLogger(__name__)
class TestCassandraDogstream(unittest.TestCase):
def testStart(self):
events = parse_cassandra(logger, " INFO [main] 2012-12-11 21:46:26,995 StorageService.java (line 687) Bootstrap/Repla... |
# mapper.py is the map step of mapreduce.
import sys,random,uuid,os,fcntl,gzip,errno
from time import time
from glob import glob
from math import fmod
import ujson
from shuffler import Shuffle
from configs_parser import get_configs
class Map():
def __init__(self,map_function_name,project_name,input_dirs,se... |
import os
import sys
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
import base
import time
import hashlib
from subprocess import Popen
from subprocess import PIPE
from common.attribute import Attribute
class FirewallRule(base.Module):
def __init__(self):
self.ruleprefix = '... |
from parsl.executors.ipp_controller import Controller
from parsl.channels.ssh.ssh import SSHChannel
from parsl.providers.condor.condor import Condor
from parsl.config import Config
from parsl.executors.ipp import IPyParallelExecutor
# This is an example config, make sure to
# replace the specific values below w... |
# 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 ... |
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See LICENSE in the project root
# for license information.
from __future__ import absolute_import, division, print_function, unicode_literals
"""Provides facilities to dump all stacks of all threads in the process.
""... |
from EXOSIMS.PlanetPopulation.KeplerLike2 import KeplerLike2
from EXOSIMS.util.InverseTransformSampler import InverseTransformSampler
import astropy.units as u
import astropy.constants as const
import numpy as np
import scipy.integrate as integrate
import sys
# Python 3 compatibility:
if sys.version_info[0] > 2:
x... |
"""
========================================
Ammonia inversion transition TKIN fitter
========================================
Ammonia inversion transition TKIN fitter translated from Erik Rosolowsky's
http://svn.ok.ubc.ca/svn/signals/nh3fit/
.. moduleauthor:: Adam Ginsburg <adam.g.ginsburg@gmail.com>
Module API
^^^... |
# -*- encoding: utf-8 -*-
################################################################################
# #
# Copyright (C) 2013-Today Carlos Eduardo Vercelino - CLVsol #
# ... |
# Generated by Django 2.0.1 on 2018-01-17 13:57
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
('ligand', '0001_initial'),
('construct', '0001_initial'),
]
operations = [
migra... |
# Copyright (c) 2013 Arnel A. Borja <kyoushuu@yahoo.com>
# Copyright (c) 2013 Vadim Rutkovsky <roignac@gmail.com>
# Copyright (c) 2013 Seif Lotfy <seif@lotfy.com>
# Copyright (c) 2013 Guillaume Quintard <guillaume.quintard@gmail.com>
#
# GNOME Music is free software; you can redistribute it and/or modify
# it under the... |
from pastebin.testcase import CacheAwareTestCase
from freezegun import freeze_time
from django.core.urlresolvers import reverse
@freeze_time("2015-01-01")
class LatestPastesTests(CacheAwareTestCase):
def test_latest_pastes_empty(self):
"""
Test that latest pastes shows the "no pastes uploaded" me... |
import json
from urllib.parse import parse_qs
from pcs import settings
from pcs.common import pcs_pycurl as pycurl
from pcs.common.host import Destination
from pcs.common.node_communicator import(
RequestTarget,
RequestData,
Request,
Response,
)
from pcs.test.tools.custom_mock import MockCurlSimple
# ... |
##################################################################
# Copyright 2018 Open Source Geospatial Foundation and others #
# licensed under MIT, Please consult LICENSE.txt for details #
##################################################################
import unittest
import lxml
import lxml.etree
from ... |
# Copyright IBM Corp. 2015, 2017
#
# 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 w... |
import os
import uuid
from datetime import datetime
from couchdbkit.exceptions import ResourceNotFound
from django.conf import settings
from django.core.files.uploadedfile import UploadedFile
from django.core.management import call_command
from django.test import TestCase
from django.test import override_settings
fr... |
# -*- coding: utf-8 -*-
# __author__ = chenchiyuan
from __future__ import division, unicode_literals, print_function
from django.core.management import BaseCommand
import requests
from bs4 import BeautifulSoup
from applications.posts.models import Post
import time
headers = {
"referer": "http://weixin.sogou.com... |
#!/usr/bin/env python
# encoding: utf-8
"""
CombinatoricalMediaSimulations.py
Simulates all possible minimal media compositions consisting of unique carbon,
nitrogen, sulfate, phosphate sources. If a single compound provides multiple
elemental sources it serves a the solely source for them. # TODO: Reformulate this
K... |
"""Examples of using the ufunc (Universal Function) functionals in ODL.
Here we demonstrate how the functionals can be composed with other operators
and functionals in order to achieve more complicated functions.
We create the L2-norm squared in two ways, first using the built in
L2NormSquared functional, and also by... |
from rest_framework import serializers
from .models import EquipmentItem, Equipment
class EquipmentItemSerializer(serializers.ModelSerializer):
equipment_name = serializers.CharField(source='equipment.name')
equipment_type = serializers.CharField(source='equipment.type')
class Meta:
model = Equi... |
import unittest
from django.test import TestCase
from iati.factory import iati_factory
from iati_organisation.models import Organisation
from iati_synchroniser.create_publisher_organisation import (
create_publisher_organisation
)
from iati_synchroniser.factory import synchroniser_factory
class CreatePublisherO... |
#!/usr/bin/python3
# minibefu93.py -- a minimal Befunge93 interpreter written in Python
# usage: minibefu93.py <prog.fu>
import sys,random
o=sys.stdout
q=0,0
d=1,0
m=80,25
def k(x,y):return x+m[0]*y+y
def g(s,p=None):
x,y=q if p is None else p
return s[k(x,y)]
def p(s,p,v):
o=k(*p)
return s[:o]+chr(v)+s[o+1:]
d... |
# 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 ... |
import psycopg2, os
# import subprocess
from socket import gethostname
host = gethostname()
con = psycopg2.connect(host='bocian.inf.ed.ac.uk', database='alignment', user='aligner_admin', password='default99')
cur = con.cursor()
cur.execute("SELECT upload_dir FROM system_server WHERE host_name like '" + host + "'")
rec... |
#!/usr/bin/python
"""
(C) Copyright 2021 Intel Corporation.
SPDX-License-Identifier: BSD-2-Clause-Patent
"""
from random import choice
from re import findall
from apricot import TestWithServers
from general_utils import run_pcmd
class HarnessAdvancedTest(TestWithServers):
"""Advanced harness test cases.
... |
# watcher.py - high-level interfaces to the Linux inotify subsystem
# Copyright 2006 Bryan O'Sullivan <bos@serpentine.com>
# This library is free software; you can redistribute it and/or modify
# it under the terms of version 2.1 of the GNU Lesser General Public
# License, incorporated herein by reference.
'''High-l... |
# -*- coding: utf-8 -*-
"""
Python advanced pretty printer. This pretty printer is intended to
replace the old `pprint` python module which does not allow developers
to provide their own pretty print callbacks.
This module is based on ruby's `prettyprint.rb` library by `Tanaka Akira`.
The following implementations w... |
# -*- coding: utf-8 -*-
from .helpers import (
User, check_allow_for_user, check_allow_for_uri, is_authenticated,
)
try:
from django.utils.deprecation import MiddlewareMixin
except ImportError:
MiddlewareMixin = object # fallback for Django < 1.10
class ImpersonateMiddleware(MiddlewareMixin):
def pr... |
# Copyright (c) 2011-2013, ImageCat Inc.
#
# 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, either version 3 of the License, or
# (at your option) any later version.
#
# This pro... |
"""
Morgen.
Usage:
morgen [--root=<PATH>] [--address=<ADDRESS>] [--port=<PORT>]
--root=<PATH> specify the root directory to serve [default: app]
--address=<ADDRESS> bind the listen socket to the specified address: [default: 0.0.0.0]
--port=<PORT> listen to the specified port: [default: 88... |
# -*- coding: UTF-8 -*-
# Copyright (c) 2011-2020 Jose Antonio Chavarría <jachavar@gmail.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 Software Foundation, either version 3 of the License, or
# (at your op... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
""" A script to manage development tasks """
from __future__ import (
absolute_import, division, print_function, with_statement,
unicode_literals)
from os import path as p
from manager import Manager
from subprocess import call
manager = Manager()
BASEDIR = p.di... |
#!/usr/bin/env python
# pylint: disable=missing-docstring
# flake8: noqa: T001
# ___ ___ _ _ ___ ___ _ _____ ___ ___
# / __| __| \| | __| _ \ /_\_ _| __| \
# | (_ | _|| .` | _|| / / _ \| | | _|| |) |
# \___|___|_|\_|___|_|_\/_/_\_\_|_|___|___/_ _____
# | \ / _ \ | \| |/ _ \_ _| | __| \_ ... |
# A separate class to represent tree structure
# Xiang Ji
# xji3@ncsu.edu
from operator import itemgetter
from itertools import groupby
from Bio import Phylo
import networkx as nx
import os, sys
import numpy as np
from copy import deepcopy
from Common import *
class Tree:
def __init__(self, tree_newick, DupLosList... |
#!/opt/datadog-agent/embedded/bin/python
'''
Datadog
www.datadoghq.com
----
Make sense of your IT Data
Licensed under Simplified BSD License (see LICENSE)
(C) Boxed Ice 2010 all rights reserved
(C) Datadog, Inc. 2010-2013 all rights reserved
'''
# set up logging before importing any other... |
# -*- coding: utf-8 -*-
import pyxmpp2
import pyxmpp2.client
import pyxmpp2.interfaces
import pyxmpp2.jid
import pyxmpp2.message
import pyxmpp2.streamtls
from .IRC import IRC
class XMPP(IRC, pyxmpp2.client.Client):
__name__ = "XMPP"
__type__ = "addon"
__version__ = "0.18"
__status__ = "testing"
... |
# commands/info.py
# Copyright (C) 2011-2014 Andrew Svetlov
# andrew.svetlov@gmail.com
#
# This module is part of BloggerTool and is released under
# the MIT License: http://www.opensource.org/licenses/mit-license.php
import os
from textwrap import dedent
from bloggertool.exceptions import ConfigError
from bloggertoo... |
###########################################################
#
# Copyright (c) 2013, Southpaw Technology
# All Rights Reserved
#
# PROPRIETARY INFORMATION. This software is proprietary to
# Southpaw Technology, and is not to be reproduced, transmitted,
# or disclosed in any way without written permi... |
# -*- coding:utf-8 -*-
import os
sql_file = 'subsidy.sql'
def get_data(file_name):
res = {}
with open(file_name, mode='r') as f:
res['certificate_type'] = f.readline().strip();
res['kind'] = f.readline().strip();
res['level'] = f.readline().strip();
res['money'] = ... |
"""
Component to offer a way to select a date and / or a time.
For more details about this component, please refer to the documentation
at https://home-assistant.io/components/input_datetime/
"""
import asyncio
import logging
import datetime
import voluptuous as vol
from homeassistant.const import (
ATTR_ENTITY_... |
"""
This plugin provides highlighting of text in Messages View
matched by user defined regular expressions.
"""
import GPS
from gps_utils import hook
# number of regexps
cu_count = 5
# Initialize preference for regexp with number num
def cu_create_preference(num):
cu_regexp = GPS.Preference(
"Messages:... |
import fcntl
import os
import argparse
import subprocess as sp
from pathlib import Path
from hailtop.utils import blocking_to_async
class Flock:
def __init__(self, path, pool=None, nonblock=False):
self.path = Path(path).resolve()
self.lock_path = self.path.parent
self.pool = pool
... |
from cvwrap import cv2
import numpy as np
import chumpy as ch
from copy import deepcopy
def nothing(x):
pass
def get_renderer():
import chumpy as ch
from opendr.everything import *
# Load mesh
m = load_mesh('/Users/matt/geist/OpenDR/test_dr/nasa_earth.obj')
m.v += ch.array([0,0,3.])
... |
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as
# published by the Free Software Foundation; either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# bu... |
from django.utils.module_loading import import_string
from docutils.parsers.rst import directives
from ..settings import BASED_LIB_RST
def register_based_directives():
"""Register all directives, exists to avoid race conditions.
Sometimes stuff like publish_parts can be ran from command line functions
... |
"""Mixing Insert and Delete Proposers for backward compatibility"""
from LOTlib.Hypotheses.Proposers.DeleteProposer import *
from LOTlib.Hypotheses.Proposers.InsertProposer import *
from LOTlib.Hypotheses.Proposers.MixtureProposer import *
from LOTlib.Miscellaneous import lambdaOne, nicelog
class InsertDeleteProposer... |
import os
from setuptools import setup, find_packages
here = os.path.abspath(os.path.dirname(__file__))
with open(os.path.join(here, 'README.txt')) as f:
README = f.read()
with open(os.path.join(here, 'CHANGES.txt')) as f:
CHANGES = f.read()
requires = [
'pyramid',
'pyramid_chameleon',
'pyramid_d... |
import unittest
from simpledecorators.Cache import Cache, TimeCacheStorage
called = 0
class SafeTest(unittest.TestCase):
def test_AddToCache(self):
global called
called = 0
@Cache(cacheStorage=TimeCacheStorage(time_seconds=1, maxCount=1000))
def func1(a,b,c):
global cal... |
#!/usr/bin/env python
from setuptools import setup, find_packages
try:
import pypandoc
long_description = pypandoc.convert('README.md', 'rst')
except (IOError, ImportError):
long_description = open('README.rst', encoding="utf8").read()
with open('requirements.txt') as f:
requirements = f.read().split... |
#! /usr/bin/env python
"""
Runs Faceoff as a standalone web server. Do not use this is in production.
Copyright: (c) 2012-2014 Artem Nezvigin <artem@artnez.com>
License: MIT, see LICENSE for details
"""
from sys import path
from os import environ
from os.path import dirname, join
path.append(join(dirname(__file__),... |
from collections import namedtuple
from operator import itemgetter
from datetime import timedelta
from django.conf import settings
from exchange.adapters import BaseAdapter
from exchange.utils import import_class, memoize
from exchange.models import ExchangeRate
from exchange.cache import (update_rates_cached, get_ra... |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'designer\updater.ui'
#
# Created by: PyQt5 UI code generator 5.9
#
# WARNING! All changes made in this file will be lost!
from PyQt5 import QtCore, QtGui, QtWidgets
class Ui_MainWindow(object):
def setupUi(self, MainWindow):
Ma... |
# Copyright 2011 OpenStack, LLC.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed... |
# -*- coding: utf-8 -*-
import pytest
from extractor_train.public.forms import LoginForm
from extractor_train.user.forms import RegisterForm
from .factories import UserFactory
class TestRegisterForm:
def test_validate_user_already_registered(self, user):
# Enters username that is already registered
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.