src stringlengths 721 1.04M |
|---|
#! /usr/bin/env python
# MailTask Alpha: The Email Manager
# Copyright (C) 2015 Patrick Simmons
# 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 ... |
from tipsi_tools.drf.filters import EnumFilter
from tipsi_tools.drf.serializers import EnumSerializer
import django_filters
from django_filters.rest_framework import DjangoFilterBackend
from rest_framework import serializers, viewsets
from sampleapp.models import Article, ArticleType, Review
class ArticleSerializer(... |
import dateutil.parser
from shared import *
from sqlalchemy.dialects.postgresql import insert
import pytz
# Raw radio observation
class RadioObservation(db.Model):
classroom_id = db.Column(db.Integer, nullable=False, primary_key=True)
observed_at = db.Column(db.DateTime, nullable=False, primary_key=True)
r... |
##
farmer = {
'kb': '''
Farmer(Mac)
Rabbit(Pete)
Mother(MrsMac, Mac)
Mother(MrsRabbit, Pete)
(Rabbit(r) & Farmer(f)) ==> Hates(f, r)
(Mother(m, c)) ==> Loves(m, c)
(Mother(m, r) & Rabbit(r)) ==> Rabbit(m)
(Farmer(f)) ==> Human(f)
(Mother(m, h) & Human(h)) ==> Human(m)
''',
# Note that this order of conjuncts
# woul... |
#!/usr/bin/env python
"""
conference.py -- Udacity conference server-side Python App Engine API;
uses Google Cloud Endpoints
$Id: conference.py,v 1.25 2014/05/24 23:42:19 wesc Exp wesc $
created by wesc on 2014 apr 21
"""
__author__ = 'wesc+api@google.com (Wesley Chun)'
from datetime import datetime
import ... |
""" Run the CADRE model and make sure the value compare to the saved pickle."""
from __future__ import print_function
import os
import pickle
import unittest
import warnings
import numpy as np
from openmdao.core.problem import Problem
from CADRE.CADRE_group import CADRE
# Ignore the numerical warnings from perfor... |
'''
- Leetcode problem: 20
- Difficulty: Easy
- Brief problem description:
Given a string containing just the characters '(', ')', '{', '}', '[' and ']', determine if the input string is valid.
An input string is valid if:
Open brackets must be closed by the same type of brackets.
Open brackets must be closed in t... |
# Copyright 2019 SUSE LLC
#
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by ap... |
from MuseParse.tests.testHandlers import testclass
from MuseParse.classes.ObjectHierarchy.ItemClasses import Directions, Note, Mark, Part
from MuseParse.classes.Input import MxmlParser
class testHandleArticulation(testclass.TestClass):
def setUp(self):
testclass.TestClass.setUp(self)
self.piece.a... |
from rest_framework import serializers
from .models import County, District, School
class CountySerializer(serializers.HyperlinkedModelSerializer):
class Meta:
model = County
class CountyMixin(serializers.Serializer):
county = CountySerializer(read_only=True)
class DistrictCompactSerializer(seria... |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals
"""
oauthlib.oauth2.draft_25
~~~~~~~~~~~~~~
This module is an implementation of various logic needed
for signing and checking OAuth 2.0 draft 25 requests.
"""
from oauthlib.common import Request
from oauthlib.oauth2.draft25 import tokens... |
# Kdump anaconda configuration
#
# Copyright (C) 2014 Red Hat, Inc.
#
# This copyrighted material is made available to anyone wishing to use,
# modify, copy, or redistribute it subject to the terms and conditions of
# the GNU General Public License v.2, or (at your option) any later version.
# This program is distribut... |
# -*- coding: utf-8 -*-
## This file is part of Invenio.
## Copyright (C) 2011 CERN.
##
## Invenio 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... |
# -*- coding: utf-8 -*-
"""This file contains a parser for the iMessage database on OSX and iOS.
iMessage and SMS data in OSX and iOS are stored in SQLite databases named
chat.db and sms.db respectively.
"""
from plaso.containers import time_events
from plaso.lib import eventdata
from plaso.parsers import sqlite
from... |
# This class handles sprite sheets
# This was taken from www.scriptefun.com/transcript-2-using
# sprite-sheets-and-drawing-the-background
# I've added some code to fail if the file wasn't found..
# Note: When calling images_at the rect is the format:
# (x, y, x + offset, y + offset)
import pygame
class spritesheet(... |
# -*- coding: utf-8 -*-
import os
from subprocess import Popen, PIPE
from time import sleep
import signal
from nose.plugins.skip import SkipTest
from tests.functional_tests import isolate
from tuttle.workflow import Workflow
class TestKeyboardInterrupt:
def setUp(self):
if os.name != 'posix':
... |
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the... |
import os
import numpy as np
import pandas as pd
# Create dataframe in which dataset will be stored
df = pd.DataFrame(columns=['pre-job input', 'opening input file', 'upto appmgr start', 'initialisation', 'event loop', 'ending'])
# Initialize counting variables
filecount = 0
included = 0
# Loop through all files i... |
"""
Some small info about running live tests.
NFSN doesn't have trial accounts, so these tests can only
be run by those with an NFSN account. NFSN also requires
you to have an API key. More info here:
https://members.nearlyfreespeech.net/wiki/API/Introduction
You'll need an account to access that page.
Therefore, t... |
#-*- coding: utf-8 -*
import robot
r = robot.rmap()
r.loadmap('task4-11')
def task():
pass
#------- пишите код здесь -----
r.right()
r.down()
for line in range(13):
for step in range(line+1):
r.paint('red')
r.right()
for step in range(line+1):
r.le... |
# -*- coding: utf-8 -*-
"""
Created on Wed Jul 11 18:51:28 2018
@author: marian
"""
import os
import numpy as np
import pickle
# %% set parameters
# set input path
strPthPrnt = "/media/sf_D_DRIVE/MotionLocaliser/UsedPsychoPyScripts/P02/Conditions"
# provide names of condition files in the order that they were show... |
"""SQL implementations of element-wise ufuncs."""
from __future__ import absolute_import, division, print_function
from ...compute.function import function, kernel
from ...compute.ops import ufuncs
from .kernel import sql_kernel, SQL
from .syntax import Call, Expr, QOrderBy, QWhere, And, Or, Not
def sqlfunction(sig... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.conf import settings
from django.conf.urls import include, url
from django.conf.urls.static import static
from django.contrib import admin
from django.views.generic import TemplateView
from django.views import defaults as default_views
urlpat... |
import asyncio
import hashlib
import zlib
import cgi
import base64
import json
import urllib.parse
import zipfile
import os
import shutil
import random
import re
import pymysql
import rsa
import time
import smtplib
import string
import email
from email.mime.text import MIMEText
from PySide.QtCore import QIODevice, QF... |
from django.forms import ModelForm, Textarea, HiddenInput, IntegerField, CharField, Select
from django.utils.translation import ugettext as _
from base.models import Tag
from .models import Game, Saga, SagaGame, GameAttribute, GameLink, GameTag, GameUser
class GameForm(ModelForm):
class Meta:
model = Gam... |
from behave import given, when, then, step
import os
import blimey
from blimey.exceptions import IncorrectPasswordException
TEMP_KEYCHAIN_PATH = os.path.join('tests', 'fixtures', 'temp.agilekeychain')
CORRECT_PASSWORD = "correctpassword"
INCORRECT_PASSWORD = "incorrectpassword"
@given('I have a locked keychain')
def... |
from support import lib,ffi
from qcgc_test import QCGCTest
import unittest
class ObjectTestCase(QCGCTest):
def test_write_barrier(self):
o = self.allocate(16)
self.push_root(o)
arena = lib.qcgc_arena_addr(ffi.cast("cell_t *", o))
o.hdr.flags = o.hdr.flags & ~lib.QCGC_GRAY_FLAG
... |
# -*- coding: utf-8 -*-
from django.shortcuts import render
from django.template import RequestContext
from django.utils import translation
from django.shortcuts import get_object_or_404
from django.http import Http404, HttpResponseRedirect
from main.models import *
from ob.models import *
def events(request, categ... |
# Copyright 2018 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 absolute_import
import unittest
import mock
from systrace.tracing_agents import atrace_agent as systrace_atrace_agent
from telemetry... |
import requests
from CharlieChat import settings
import re
#ticket price variables. assumes no charlie-card
#most prices pertain to charlie card zones. '1A' is the price to go between two '1A' stops only
#the whole numbers are prices to go between a 1A stop to the listed zone, the keys that end
#in .5 are inte... |
# -*- coding: utf-8 -*-
from __future__ import absolute_import
# Standard Library Imports
import importlib
import binascii
import inspect
import logging
import time
import sys
import re
# Kodi imports
import xbmcaddon
import xbmcgui
import xbmc
# Package imports
from codequick.utils import parse_qs, ensure_native_st... |
"""
.. module:: l_area_work
The **L Area Work** Model.
PostgreSQL Definition
---------------------
The :code:`l_area_work` table is defined in the MusicBrainz Server as:
.. code-block:: sql
CREATE TABLE l_area_work ( -- replicate
id SERIAL,
link INTEGER NOT NULL,... |
from django.contrib.sites.models import get_current_site
from lfs.cart.utils import get_cart
from lfs.customer.utils import get_customer
from lfs.plugins import ShippingMethodPriceCalculator
from ups.client import UPSClient, UPSError
from ups.model import Package, Address
from .models import UPSConfiguration
class... |
# lbaas-magic.py
# setup of nova, salt-master, etc for lbaas shenanigans
# to be run on a prospective salt-master
# This will:
# configure the vm to be an lbaas-salt-master
# run the appropriate salt-cloud mappings
# set up the environment (secgroups, floating_ips, highstate, etc)
# test the environment
##... |
from vsims.block import Block
class NestedStore:
"""Simple key-value store that supports nested transactional blocks."""
def __init__(self):
self.blocks = []
self.store = {}
self.value_counts = {}
def set(self, key, value, doLog=True):
"""Add the key to the store if not alr... |
# coding=UTF-8
from django.shortcuts import render
from django.contrib.auth.decorators import login_required
from django.contrib.auth.models import AnonymousUser
from django.http import HttpResponseRedirect
from django.core.urlresolvers import reverse
from django.utils.translation import ugettext as _
from django.shor... |
# Copyright 2017 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... |
import argparse
parser = argparse.ArgumentParser(description='Load or create a Blekota model')
parser.add_argument('file',
help='Either a .pkl file containing an existing model or a .wav sound on which to train a new model. If a .wav is provided, other parameters can be used to specify model hyper... |
from challenges import FactoringChallenge, RSAChallenge
challenge_1 = FactoringChallenge(
1,
"Challenge #1 - Factor an RSA modulus",
int("\
17976931348623159077293051907890247336179769789423\
06572734300811577326758055056206869853794492129829\
59585501387537164015710139858647833778606925583497\
54108519659... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from runner.koan import *
class AboutControlStatements(Koan):
def test_if_then_else_statements(self):
if True:
result = 'true value'
else:
result = 'false value'
self.assertEqual('true value', result)
... |
# -*- coding: utf8 -*-
__module__ = "test_Array.py"
__author__ = "Jonathan D. Lettvin"
__copyright__ = "\
Copyright(C) 2016 Jonathan D. Lettvin, All Rights Reserved"
__credits__ = [ "Jonathan D. Lettvin" ]
__license__ = "GPLv3"
__version__ = "0.0.1"
__maintainer__ = "Jonathan D. Lettvin"
__email__ ... |
#!/usr/bin/python
import requests
from time import sleep
import json
import ConfigParser
import os
from os.path import dirname, join
CONFIGFILE = join(dirname(__file__), 'hue.cfg')
API_URL = 'https://client-eastwood-dot-hue-prod-us.appspot.com/api/nupnp'
class Light:
def __init__(self, ip=None, secret=None, light... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# grill-checkin-control documentation build configuration file, created by
# sphinx-quickstart on Sun Jun 25 22:20:49 2017.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are presen... |
#!/usr/bin/env python
##############################################################################
# Copyright (c) 2015 Huawei Technologies Co.,Ltd and others.
#
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Apache License, Version 2.0
# which accompan... |
# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... |
# (c) Copyright IBM Corp. 2021
# (c) Copyright Instana Inc. 2017
from __future__ import absolute_import
import opentracing
import opentracing.ext.tags as ext
import wrapt
from ..log import logger
from ..singletons import agent
from ..util.traceutils import get_active_tracer
from ..util.secrets import strip_secrets_f... |
from swf.models import History
from swf.querysets.base import BaseQuerySet
class HistoryQuerySet(BaseQuerySet):
"""WorkflowExecution history queryset"""
def __init__(self, domain, *args, **kwargs):
super(HistoryQuerySet, self).__init__(*args, **kwargs)
self.domain = domain
def get(self, ... |
# -*- coding: utf-8 -*-
"""
Django settings for id_website project.
For more information on this file, see
https://docs.djangoproject.com/en/dev/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/dev/ref/settings/
"""
from __future__ import absolute_import, unicode_... |
"""Common functions script
This script will be appended to each server script before being executed.
Please notice that to add custom common code, add it to the CommonServerUserPython script.
Note that adding code to CommonServerUserPython can override functions in CommonServerPython
"""
from __future__ import print_fu... |
from django.conf.urls.defaults import *
from redline import settings
urlpatterns = patterns('redline.accounts.views',
url(r'^$', 'accounts_list', name='account_list'),
url(r'^overview/(?P<year>\d+)/(?P<month>\d+)/$', 'accounts_detail', name='accounts_detail'),
url(r'^overview/(?P<year>\d+)/(?P<month>\d+)/(... |
###############################################################################
#
# Tests for XlsxWriter.
#
# Copyright (c), 2013-2016, John McNamara, jmcnamara@cpan.org
#
from ..excel_comparsion_test import ExcelComparisonTest
from ...workbook import Workbook
class TestCompareXLSXFiles(ExcelComparisonTest):
"""... |
__author__ = 'Frederik Diehl'
import numpy as np
from sklearn.base import BaseEstimator, RegressorMixin
from sklearn.utils import check_random_state
from sklearn.preprocessing import MinMaxScaler
class NeuralNetwork(BaseEstimator, RegressorMixin, object):
_maxSteps = None
_maxNonChangingSteps = None
_l... |
# -*- coding: utf-8 -*-
"""
Generate a summary of a previous loadtest run in this environment.
See for usage example in a jenkins job dsl:
https://github.com/edx/jenkins-job-dsl/blob/master/testeng/jobs/loadtestDriver.groovy
Prerequisites:
A logfile produced by util/run-loadtest.sh should be present in its
s... |
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... |
# Gramps - a GTK+/GNOME based genealogy program
#
# Copyright (C) 2000-2007 Donald N. Allingham
# Copyright (C) 2007-2012 Brian G. Matherly
# Copyright (C) 2010 Jakim Friant
# Copyright (C) 2014 Paul Franklin
# Copyright (C) 2010-2015 Craig J. Anderson
#
# This program is free software; you can redistrib... |
import numpy as np
from teafacto.blocks.seq.oldseqproc import SimpleVec2Idx, MemVec2Idx
from teafacto.blocks.seq.enc import SimpleSeq2Vec
from teafacto.blocks.seq.enc import Seq2Idx
from teafacto.blocks.lang.wordvec import Glove
from teafacto.blocks.memory import LinearGateMemAddr, DotMemAddr
from teafacto.scripts.sim... |
from flask_wtf import Form
from wtforms import StringField, PasswordField, validators, SubmitField
# Render login form. u' indicated unicode encoding
class LoginForm(Form):
username = StringField('Username', [validators.InputRequired(message=(u'Invalid Username')),
validator... |
# File: download_tedtalk.py
# Author: E. Partridge
# Date: 8 August 2012
# Description:
# This script parses the TED Talk audio feed and proceeds to
# download all audio files into the same directory that
# this script is located in. Files are prepended with the publication
# date for convenience.
#
... |
# Copyright (c) 2012 OpenStack Foundation.
#
# 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... |
class ListNode(object):
def __init__(self, x):
self.val = x
self.next = None
class Solution(object):
def mergeKLists(self, lists):
"""
:type lists: List[ListNode]
:rtype: ListNode
"""
from heapq import heappush, heappop, heapreplace, heapify
... |
import os
import pytest
try:
from types import TypeType
except ImportError:
TypeType = type
from amazonproduct import utils
from amazonproduct.processors import etree, minidom
def test_load_global_file_config(configfiles):
configfiles.add_file('''
[Credentials]
access_key = ABCDEFGH12345... |
import json
import time
import os
import re
import requests
from bs4 import BeautifulSoup
import chardet
"""
url_list = [
'http://tech.163.com/special/00097UHL/tech_datalist_02.js?callback=data_callback',
'http://ent.163.com/special/000380VU/newsdata_index_02.js?callback=data_callback',
'http://spor... |
# -*- coding: utf-8 -*-
# Merge k sorted linked lists and return it as one sorted list. Analyze and describe its complexity.
# Definition for singly-linked list.
class ListNode(object):
def __init__(self, x):
self.val = x
self.next = None
def __repr__(self):
if self:
return "... |
# -*- coding: utf-8 -*-
import logging
from datetime import datetime, timedelta
from time import sleep
from oupyc.queues import NamedAndTypedQueue
from oupyc.stdthreads import ExitEventAwareThread, QueueProcessorThread
__author__ = 'AMarin'
_l = logging.getLogger(__name__)
_l.setLevel(logging.INFO)
debug, info, warni... |
from fbuild.builders.platform import guess_platform
from fbuild.builders.c import guess_static
from optparse import make_option
import fbuild
def pre_options(parser):
group = parser.add_option_group('config options')
group.add_options((
make_option('--cc', help='Use the given C compiler'),
make... |
"""Base class copy from sklearn.base."""
# Authors: Gael Varoquaux <gael.varoquaux@normalesup.org>
# Romain Trachel <trachelr@gmail.com>
# Alexandre Gramfort <alexandre.gramfort@telecom-paristech.fr>
# Jean-Remi King <jeanremi.king@gmail.com>
#
# License: BSD (3-clause)
import numpy as np
f... |
import sqlite3
import urllib
import re
from urllib.request import urlopen
from bs4 import BeautifulSoup
# several names in the <pagehead> but not sure what to put as an author name
def main():
# The collection URL below.
collURL = 'http://www.thelatinlibrary.com/regula.html'
collOpen = urllib.request.urlo... |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2011 Alexander Shorin
# All rights reserved.
#
# This software is licensed as described in the file COPYING, which
# you should have received as part of this distribution.
#
import unittest
from StringIO import StringIO
from phoxpy import xml
class XMLTestsMixIn(object):
... |
import os
import h5py
import numpy as np
def read_group(filename, group, drop_last_dataset=False):
input_file = h5py.File(filename)
datasets = [
dataset[...]
for dataset in input_file[group].values()
if isinstance(dataset, h5py.Dataset)
]
if drop_last_dataset:
datasets ... |
#!/usr/bin/env python
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# ---------------------------------------------... |
#!/usr/bin/env python
#
# Copyright (c) 2014, 2016 Oracle and/or its affiliates. All rights reserved.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; version 2 of the License.
#
# This program... |
# -*- coding: utf-8 -*-
from mock import patch
from copy import deepcopy
from djangosanetesting import UnitTestCase
from django.utils.safestring import SafeString
from mypage.widgets.models import Widget
from mypage.pages.models import Page
from mypage.pages.layout import Layout, WidgetInLayout
from unit_project im... |
#!/bin/python
from telegram.ext import Updater, CommandHandler, Filters, MessageHandler
from src.handler import handler
from src.db_client import db_client
from src.config import config
from src.user_interface import user_interface
import logging
import sys
def usage(error=''):
ret = ""
if error != '':
... |
# Copyright 2007 Google 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; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the ho... |
# -*- coding: utf-8 -*-
#
# AGFusion documentation build configuration file, created by
# sphinx-quickstart on Mon Oct 10 11:07:09 2016.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
# ... |
import glob
import os
import shutil
import uuid
from os.path import expanduser
import requests
from ditto.core import logger
def setup():
global session_uuid
session_uuid = str(uuid.uuid1())
def cleanup():
shutil.rmtree(get_cache_dir(), True)
def get_session_uuid():
return session_uuid
def get... |
from google.appengine.ext import webapp
from google.appengine.api import users
from google.appengine.ext.webapp import template
from model import Membership
from util import membershipsOfUser
from util import descriptionOfBalanceInGroup
from util import descriptionOfTotalBalance
from comparators import compareMe... |
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... |
# Copyright 2013 Netherlands eScience Center
#
# 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... |
# Copyright 2012 Google Inc. All Rights Reserved.
"""EndpointsModel definition and accompanying definitions.
This model can be used to replace an existing NDB model and allow simple
conversion of model classes into ProtoRPC message classes. These classes can be
used to simplify endpoints API methods so that only enti... |
# -*- coding: utf-8 -*-
import random
import vdirsyncer.exceptions as exceptions
from vdirsyncer.storage.base import Storage
def _random_string():
return '{:.9f}'.format(random.random())
class MemoryStorage(Storage):
'''
Saves data in RAM, only useful for testing.
'''
def __init__(self, file... |
"""
Read or write MEME motif file
"""
import re
import math
from collections import OrderedDict
class MemeRecord(object):
def __init__(self,
name,
matrix,
altname = '',
mtype = 'letter-probability',
alength = None,
w = None,
nsites = 20,
E = 0,
URL = None
):
self.name = nam... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
from ..models.models import EmailAccount
PUBLIC = 0
def migrate_public_setting(apps, schema_editor):
EmailAccount = apps.get_model('email', 'EmailAccount')
email_accounts = EmailAccount.objects.all()
... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('exchange', '0011_conferenceroom'),
]
operations = [
migrations.AddField(
model_name='group',
name='d... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# import codecs
# import os
from distutils.core import setup
from setuptools import find_packages
# version_tuple = __import__('django_js_reverse').VERSION
# version = '.'.join([str(v) for v in version_tuple])
setup(
name='django-moe-auth',
version='0.0.1',
cl... |
# -*- coding: utf-8 -*-
"""
Functions that interact with local file system.
"""
from __future__ import with_statement
import os
import shutil
import logging
import itertools
from rex.core import regex
logger = logging.getLogger(__name__)
#============================================================================... |
from recipe_scrapers.cookpad import CookPad
from tests import ScraperTest
class TestCookPadScraper(ScraperTest):
scraper_class = CookPad
def test_host(self):
self.assertEqual("cookpad.com", self.harvester_class.host())
def test_canonical_url(self):
self.assertEqual(
"https:/... |
"""Command line arguments to the oggm_benchmark command
Type `$ oggm_benchmark -h` for help
"""
# External modules
import os
import sys
import argparse
import time
import logging
import pandas as pd
import geopandas as gpd
# Locals
import oggm.cfg as cfg
from oggm import utils, workflow, tasks
from oggm.exceptions ... |
# -*- coding: utf-8 -*-
""" This module is designed to contain classes that act as simplified / reduced
energy specific interfaces (facades) for solph components to simplify its
application and work with the oemof datapackage - reader functionality
SPDX-License-Identifier: GPL-3.0-or-later
"""
import logging
from py... |
from __future__ import unicode_literals, division, absolute_import
from builtins import * # pylint: disable=unused-import, redefined-builtin
from datetime import datetime
from flexget.utils import json
class TestJson(object):
def test_json_encode_dt(self):
date_str = '2016-03-11T17:12:17Z'
dt ... |
#!/usr/bin/env python
import roslib
roslib.load_manifest('laser_tfs')
import rospy
import math
import matplotlib.pyplot as plt
import numpy as np
import tf
from geometry_msgs.msg import PoseWithCovarianceStamped
def handle_fcu_pose(msg):
br = tf.TransformBroadcaster()
global count
p = msg.pose.pose.posi... |
import unittest
from .cafe_order_checker import is_first_come_first_served
class Test(unittest.TestCase):
def test_both_registers_have_same_number_of_orders(self):
result = is_first_come_first_served([1, 4, 5], [2, 3, 6], [1, 2, 3, 4, 5, 6])
self.assertTrue(result)
def test_registers_have_di... |
import sys, os, re, random, math, urllib2, time, cPickle
import numpy
import argparse
import onlineldavb
from operator import itemgetter
topics_30 = [
"NETWORKING / CONNECTIONS",
"HARDWARE / RESOURCES",
"DRIVERS",
"MMS",
"?1",
"JIRA",
"QUERY",
"REPLICATION",
"REPLICATION",
"STORAGE???",
"NETWORKING / SETUP / LIMITS",... |
""" This file defines two classes, TaxonomyCell and Referent, which work in
tandem to provide the 'kind' property to all referents, and the generalization
structure. The generalization structure (a taxonomy-- a directed acyclic graph
of IS-A relationships) is automatically constructed using the object-oriented
inher... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
from ansible.module_utils.basic import AnsibleModule
DOCUMENTATION = '''
---
module: dedicated_server_install
short_description: Install a new dedicated server
description:
- Install ... |
import flask
import decimal
import dateutil.parser
import flask.ext.login
import rod
import rod.model.student
import rod.model.lesson
import rod.model.group
import rod.model.company
import rod.model.transaction
import rod.model.schemas
lesson_handler = flask.Blueprint('lesson', __name__)
@lesson_handler.route('/le... |
# Copyright (c) by it's authors.
# Some rights reserved. See LICENSE, AUTHORS.
import wallaby.FX as FX
from wallaby.qt_combat import *
from ..baseWidget import *
from wallaby.pf.peer.pref import *
from twisted.internet import defer
from UI_prefController import *
from sheet import *
from ..logics import *
class Pr... |
from django.conf import settings
from django.core.exceptions import ValidationError
from django.core.urlresolvers import reverse
from django.db import models, IntegrityError
from django.db.models import Q, Sum
from django.utils import timezone
from django.db.models.signals import pre_save, post_save
from django.contrib... |
# Copyright 2015 - 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 ag... |
from django.test import TestCase
from django.contrib.auth.models import User, Permission
class BrowseTest(TestCase):
fixtures = ['srd.json']
def test_get(self):
response = self.client.get('/browse/spell/alarm/')
# Check that we got a result
self.assertEqual(200, response.status_code)
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.