text stringlengths 12 6.59M |
|---|
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Display module for interacting with matplotlib
Display
=======
.. autosummary::
:toctree: generated/
specshow
time_ticks
cmap
"""
import numpy as np
import matplotlib.image as img
import matplotlib.pyplot as plt
import warnings
from . import cache
fr... |
#!/usr/bin/env python
"""Feature extraction routines."""
import numpy as np
import librosa.core
#-- Chroma --#
def cqgram(y=None, sr=22050, n_fft=4096, hop_length=512, **kwargs):
'''Compute an approximate constant-Q spectrogram (piano roll).
'''
# First, get the spectrogram and track pitches
... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Feature extraction routines."""
import numpy as np
import scipy.signal
import librosa.core
import librosa.util
from . import cache
# - Features added by BWalburn
@cache
def spectral_centroid(y=None, sr=22050, S=None, n_fft=2048, hop_length=512,
... |
#
#
# Copyright (C) 2006, 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 distri... |
#
#
# Copyright (C) 2006, 2007, 2011 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 ... |
# -*- coding: utf-8 -*-
"""Tests for the proofreadpage module."""
#
# (C) Pywikibot team, 2015-2019
#
# Distributed under the terms of the MIT license.
#
from __future__ import absolute_import, division, unicode_literals
import json
import pywikibot
from pywikibot.data import api
from pywikibot.proofreadpage import ... |
link_template="""\
<ul>
<li><a href="{langfam_code:}/overview/introduction.html">Introduction</a></li>
<li><a href="{langfam_code:}/overview/tokenization.html">Tokenization</a></li>
<li>Morphology
<ul>
<li><a href="{langfam_code:}/overview/morphology.html">General principles</a></... |
# -*- coding: utf-8 -*-
##############################################################################
#
# Author: Nicolas Bessi
# Copyright 2013 Camptocamp SA
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# publi... |
# -*- coding: utf-8 -*-
##############################################################################
#
# Author: Nicolas Bessi
# Copyright 2013, 2014 Camptocamp SA
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# ... |
from __future__ import unicode_literals
import unittest
import frappe
from frappe.website.path_resolver import PathResolver
from frappe.website.serve import get_response, get_response_content
from frappe.utils import set_request
test_records = frappe.get_test_records('Web Page')
def get_page_content(route):
set_requ... |
#!/usr/bin/env python
import json
import random
import re
import string
import sys
import types
from datetime import datetime, timedelta
data = {
'NUMBER' : tuple("0123456789"),
'LETTER_UPPER' : tuple(string.uppercase),
'LETTER_LOWER' : tuple(string.lowercase),
'MALE_FIRST_NAME' : ("James", "John", "... |
#This should be stand alone
import numpy as np
import subprocess as sp
import shlex
import os
import matplotlib.pyplot as plt
import sys
import pandas as pd
import time
from exactpack.solvers.riemann import Sod
import warnings
def euler_exact(t,dv,thing):
warnings.filterwarnings("ignore")
r = np.linspace(0.0,... |
import pagerduty
from graphitepager.level import Level
from graphitepager.notifiers.base import BaseNotifier
class PagerdutyNotifier(BaseNotifier):
def __init__(self, storage, config):
super(PagerdutyNotifier, self).__init__(storage, config)
required = ['PAGERDUTY_KEY']
self.enabled = c... |
try:
import re
import os
import sys
import tempfile
import subprocess
from lib.core.exceptions import CrowbarExceptions
except Exception, err:
from lib.core.exceptions import CrowbarExceptions
raise CrowbarExceptions(str(err))
class Nmap:
def __init__(self):
self.nmap_path = "/usr/b... |
#
# Copyright (c) 2004-2009 rPath, Inc.
#
# This program is distributed under the terms of the Common Public License,
# version 1.0. A copy of this license should have been distributed with this
# source file in a file called LICENSE. If it is not present, the license
# is always available at http://www.rpath.com/perma... |
###############################################################################
# TwoPowerTriaxialPotential.py: General class for triaxial potentials
# derived from densities with two power-laws
#
# amp/[4pia^3]
# ... |
# Copyright (c) 2015 Ultimaker B.V.
# Uranium is released under the terms of the AGPLv3 or higher.
from copy import deepcopy
from PyQt5.QtCore import QObject, pyqtProperty, pyqtSignal, pyqtSlot
from UM.Application import Application
from UM.i18n import i18nCatalog
catalog = i18nCatalog("uranium")
class MachineMana... |
#
# Copyright (c) 2004-2009 rPath, Inc.
#
# This program is distributed under the terms of the Common Public License,
# version 1.0. A copy of this license should have been distributed with this
# source file in a file called LICENSE. If it is not present, the license
# is always available at http://www.rpath.com/perma... |
""" Tests for belief_manager.py. """
from collections import deque
import numpy as np
from belief_manager import BeliefManager
from kalman import Kalman
import statistics
import tests
class _TestingBeliefManager(BeliefManager):
""" A class for testing the belief manager. """
def __init__(self, initial_positio... |
#!/usr/bin/env python
# Test Harness to test the Game Controller Functionality
#
import requests # https://github.com/kennethreitz/requests/
import time
import random
import os
# Global Variables
controller_endpoint = os.environ['GC_ENDPOINT']
#Replace this variables as appropriate
server_url = 'http://' + contr... |
# Copyright (c) 2005-2007 rPath, Inc.
#
# This program is distributed under the terms of the Common Public License,
# version 1.0. A copy of this license should have been distributed with this
# source file in a file called LICENSE. If it is not present, the license
# is always available at http://www.rpath.com/permane... |
# coding=utf-8
"""
Copyright 2015 Samuel Góngora García
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 applicab... |
# Copyright (c) 2015 Cisco Systems Inc.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless re... |
# Copyright 2016 rpaas authors. All rights reserved.
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.
import os
import unittest
import mock
import consul
from rpaas import consul_manager, nginx
class ConsulManagerTestCase(unittest.TestCase):
def setUp(self)... |
import pytest
from slackminion.plugin import BasePlugin, cmd
from slackminion.plugins.core.core import Core
from slackminion.utils.test_helpers import *
# command, help
test_help_long_data = [
('!sleep', """Causes the bot to ignore all messages from the channel.
Usage:
!sleep [channel name] - ign... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
test_in_serializers
-------------------
Tests of the fields cooperation in the serializer interfaces for serialization, de-serialization,
and validation.
"""
# Django settings:
import os
os.environ['DJANGO_SETTINGS_MODULE'] = __name__
from django.conf.global_sett... |
from rets.configuration import Configuration
from rets.session import Session
import unittest
import os
from mock import patch
class SessionTester(unittest.TestCase):
@unittest.skip
def test_session(self):
c = Configuration('1.7.2')
c.login_url = os.environ.get("RETS_LOGIN_URL")
c.user... |
import discord
import re
from discord.ext import commands
class MCOCTools:
'''Tools for Marvel Contest of Champions'''
mcoc = bot.get_cog('MCOC')
lookup_links = {
'event': (
'Tiny MCoC Schedule',
'<http://simians.tk/MCOC-Sched>',
'Josh Morris Sch... |
#! /usr/bin/env python
# ______________________________________________________________________
'''test_multiarray_api
Test the code generation utility class numba.multiarray_api.MultiarrayAPI.
'''
# ______________________________________________________________________
import ctypes
import llvm.core as lc
import ll... |
import discord
import re
import csv
import random
import os
import datetime
from .utils import chat_formatting as chat
from discord.ext import commands
class MCOCTools:
'''Tools for Marvel Contest of Champions'''
lookup_links = {
'event': (
'<http://simians.tk/MCOC-Sched>',
... |
import os
import random
import time
import hashlib
import warnings
from tempfile import mkdtemp
from shutil import rmtree
from six.moves.urllib.parse import urlparse
from six import BytesIO
from twisted.trial import unittest
from twisted.internet import defer
from scrapy.pipelines.files import FilesPipeline, FSFilesS... |
"""you are not expected to understand this implementation. that's why it has tests."""
from __future__ import print_function, division
from time import time
from functools import wraps
from contextlib import contextmanager
import inspect
__all__ = ['measure_iter', 'measure_each', 'measure_first', 'measure_reduce',
... |
# -*- coding: utf-8 -*-
'''
Set up the Salt integration test suite
'''
# Import Python libs
from __future__ import absolute_import, print_function
import os
import re
import sys
import copy
import json
import time
import stat
import errno
import signal
import shutil
import pprint
import atexit
import socket
import lo... |
# -*- coding: utf-8 -*-
'''
Set up the Salt integration test suite
'''
# Import Python libs
from __future__ import print_function
import os
import re
import sys
import copy
import json
import time
import errno
import shutil
import pprint
import logging
import tempfile
import subprocess
import multiprocessing
from has... |
# -*- coding: utf-8 -*-
'''
Set up the Salt integration test suite
'''
# Import Python libs
from __future__ import print_function
import os
import re
import sys
import time
import errno
import shutil
import pprint
import logging
import tempfile
import subprocess
import multiprocessing
import json
from hashlib import ... |
from __future__ import absolute_import
import os
import shlex
import subprocess
from collections import namedtuple
from operator import attrgetter
import pytest
from .. import mock
from .testcases import DockerClientTestCase
from compose.cli.command import get_project
from compose.cli.docker_client import docker_cli... |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals
import simple_audit
import logging
from django.db import models
from django.contrib.auth.models import User, Group
from django.core.exceptions import ValidationError
from django.utils.translation import ugettext_lazy as _
from django.db.mo... |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals
import simple_audit
import logging
import datetime
from django.db import models
from django.core.exceptions import ValidationError
from django.utils.translation import ugettext_lazy as _
from django.db.models.signals import pre_save, post_... |
import os
from asyncaws import SNS
from tornado.testing import AsyncTestCase, gen_test
from random import randint
aws_key_id = os.environ['AWS_ACCESS_KEY_ID']
aws_key_secret = os.environ['AWS_SECRET_ACCESS_KEY']
aws_region = os.environ['AWS_REGION']
class TestSQS(AsyncTestCase):
@classmethod
def setUpClass(c... |
# (c) Fugro GeoServices. MIT licensed, see LICENSE.rst.
from __future__ import absolute_import
from subprocess import call
import logging
import os
import shutil
from django.conf import settings
from django.contrib.auth.models import User
from pandas.io.parsers import read_csv
from pandas import DataFrame
from tslib.... |
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
import sys
import os
import calendar
import time
try:
import ConfigParser
except ImportError:
import configparse... |
from webapi_tests import MinimalTestCase
class TestProximity(MinimalTestCase):
def tearDown(self):
self.marionette.execute_script("""
window.removeEventListener('devicelight', window.wrappedJSObject.prox_function);
""")
MinimalTestCase.tearDown(self)
def test_proximity_change(se... |
from django.conf import settings
from django.conf.urls import url
from django.views.generic import RedirectView
from crashstats.crashstats import views
products = r'/products/(?P<product>\w+)'
versions = r'/versions/(?P<versions>[;\w\.()]+)'
version = r'/versions/(?P<version>[;\w\.()]+)'
perm_legacy_redirect = sett... |
# -*- coding: utf-8 -*-
from __future__ import print_function, division
from datetime import datetime
import numpy as np
import pandas as pd
from pandas import to_datetime
from lifelines._utils import concordance_index as _cindex
def l1_log_loss(event_times, predicted_event_times, event_observed=None):
"""
... |
# -*- encoding: utf-8 -*-
from supriya.tools import osctools
from supriya.tools.requesttools.Request import Request
class NodeAfterRequest(Request):
### CLASS VARIABLES ###
__slots__ = (
'_node_id_pairs',
)
### INITIALIZER ###
def __init__(
self,
node_id_pairs=None,... |
"""
Model definitions for storing market data messages.
"""
from django.db import models
#
# Market Data Models
#
class UUDIFMessage(models.Model):
"""
A raw JSON UUDIF market message. This is typically only used on local
development workstations.
"""
key = models.CharField(max_length=255, uniqu... |
# -*- encoding: utf-8 -*-
import collections
from supriya.tools.systemtools.SupriyaObject import SupriyaObject
class UGenMethodMixin(SupriyaObject):
### CLASS VARIABLES ###
__documentation_section__ = 'SynthDef Internals'
__slots__ = ()
### SPECIAL METHODS ###
def __abs__(self):
r'''G... |
#!/usr/bin/env python
#
# @file query.py
# @brief general functions for querying objects
# @author Frank T. Bergmann
# @author Sarah M. Keating
# @author Matthew S. Gillman
#
# <!--------------------------------------------------------------------------
#
# Copyright (c) 2013-2018 by the California Institute of... |
import abc
from collections import OrderedDict, MutableMapping
import numpy as np
from menpo.base import Copyable
from menpo.transform.base import Transformable
from menpo.visualize.base import Viewable
class Landmarkable(Copyable):
r"""
Abstract interface for object that can have landmarks attached to them... |
import datetime
from django.core.management import BaseCommand
from django.utils import timezone
from django.utils.formats import date_format
from nuntius.models import Campaign
from ...stats import *
class Command(BaseCommand):
help = "Display weekly statistics"
def handle(self, *args, **options):
... |
#!/usr/bin/env python
"""
TopologyViewer3D is a 3D version of TopologyViewer, which shows Topology in PyGame surface.
Operation supported:
* a --- viewer position move left
* d --- viewer position move right
* w --- viewer position move up
* s --- viewer position move down
* pgup --- viewer position move forward (zoom... |
# (c) Continuum Analytics, Inc. / http://continuum.io
# All Rights Reserved
#
# conda is distributed under the terms of the BSD 3-clause license.
# Consult LICENSE.txt or http://opensource.org/licenses/BSD-3-Clause.
from __future__ import (absolute_import, division, print_function,
unicode_lite... |
# Let do it!
from openpyxl import load_workbook
from openpyxl.utils import column_index_from_string
wb = load_workbook('../datas/daily_gabia_20171127.xlsx') # 엑셀 열기
ws = wb.active # 현재 워크시크 가져오기
# 1. 이중 for문이 불필요하다는 사실 인지. ws.cell은 행,열만 알면되는데 첫번째 for 문에서 다 알 수 있기 때문에
# 2. 상수로 선언했던 `column_idx = 5`를 변수로 처리할 방법 찾음. `E`... |
import os
from gunicorn.app.base import BaseApplication
from gunicorn.six import iteritems
import multiprocessing
import time
from TwitterAPI import TwitterAPI, TwitterRestPager
from elasticsearch import Elasticsearch
from yaml import load, dump
CONSUMER_KEY = ''
CONSUMER_SECRET = ''
ACCESS_TOKEN_KEY = ''
ACCESS_T... |
import os
from gunicorn.app.base import BaseApplication
from gunicorn.six import iteritems
import multiprocessing
import time
from TwitterAPI import TwitterAPI, TwitterRestPager
from elasticsearch import Elasticsearch
from yaml import load, dump
CONSUMER_KEY = ''
CONSUMER_SECRET = ''
ACCESS_TOKEN_KEY = ''
ACCESS_T... |
import glob
import inspect
import os
import re
import types
from collections import namedtuple
from . import errors
class ModuleFinder(object):
ModuleSpecification = namedtuple('ModuleSpecification', ['parent_folder', 'module_name'])
file_re = re.compile(r"([Ss]pec|[Tt]est).*?\.py$")
folder_... |
# -*- coding: utf-8 -*-
"""
(C) 2014-2016 Roman Sirokov and contributors
Licensed under BSD license
http://github.com/r0x0r/pywebview/
"""
import os
import sys
import logging
from ctypes import windll
import clr
clr.AddReference("System.Windows.Forms")
clr.AddReference("System.Threading")
import System.Windows.Form... |
from pathlib import Path
class PathManager:
def __init__(self, path_to_env, env):
self.home = Path(path_to_env).resolve().parent
subdirectory = env.name if env.name != 'root' else ''
path_to_output = env._env_content.get('_path_to_output')
# if there is no path_to_output key, u... |
"""Operations are defined here"""
from sqlalchemy.orm import joinedload, raiseload
from todo.models import Board, Task
from todo.exceptions import NotFoundError
from todo.database import session
from todo.schemas import BoardSchema, BoardDetailsSchema, TaskSchema
from todo.auth import requires_auth
@requires_auth
de... |
import os
from flask import Flask, current_app
from redis import Redis
from rq import Connection, Queue, Worker
from .extensions import db
DEFAULT_SECRET = """
larencontrefortuitesurunetablededissectiond'unemachineàcoudreetd'unparapluie
"""
class CustomFlask(Flask):
jinja_options = Flask.jinja_options.copy()
... |
import datetime
from collections import defaultdict
from PyQt5.QtGui import *
import matplotlib
matplotlib.use('Qt5Agg')
import matplotlib.pyplot as plt
import matplotlib.dates as md
from matplotlib.patches import Ellipse
from matplotlib.offsetbox import AnchoredOffsetbox, TextArea, DrawingArea, HPacker
from .i18n im... |
import matplotlib
import matplotlib.ticker
import warnings
# the other imports are inside functions!!!1
def import_matplotlib_pyplot(interactive=True):
if interactive:
matplotlib.use('qt4agg')
import matplotlib.pyplot as plt
return plt
def format_list(values, divisor=1000):
powers = ['', 'K'... |
# -*- coding: utf-8 -*-
from __future__ import print_function, absolute_import
import inspect
import logging
import os
import sys
from flask import Flask, request
from cliff.app import App
from cliff.command import Command
from cliff.commandmanager import CommandManager
from momo import plugins
from momo.backends impor... |
# -*- coding: utf-8 -*-
# Import Python libs
from __future__ import absolute_import
import os
import os.path
import tempfile
# Import Salt Testing libs
from tests.support.unit import TestCase
# Import Salt libs
import salt.loader
import salt.config
import tests.integration as integration
from salt.exceptions import ... |
import unittest
from tml.token import VariableToken, TextToken, RulesToken, PipeToken
class LenRulesCompiler(object):
""" Dumb rules compiller """
def compile(self, token, value, options):
self.value = value
return self
def execute(self):
""" Say Hello """
return '%d symbo... |
__author__ = "Rick Sherman, Nitin Kumar"
__credits__ = "Jeremy Schulman"
import sys
from six import StringIO
from contextlib import contextmanager
import unittest
from nose.plugins.attrib import attr
from jnpr.junos import Device
from jnpr.junos.utils.scp import SCP
from mock import patch
import sys
if sys.version<... |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2003-2005 Edgewall Software
# Copyright (C) 2003-2005 Jonas Borgström <jonas@edgewall.com>
# All rights reserved.
#
# This software is licensed as described in the file COPYING, which
# you should have received as part of this distribution. The terms
# are also available at htt... |
# -*- coding: utf-8 -*-
"""
werkzeug.serving
~~~~~~~~~~~~~~~~
There are many ways to serve a WSGI application. While you're developing
it you usually don't want a full blown webserver like Apache but a simple
standalone one. From Python 2.5 onwards there is the `wsgiref`_ server in
the standa... |
import os
from whereami.pipeline import LocationPipeline
from whereami.get_data import get_train_data
from whereami.get_data import sample
def predict(tts=False):
X, y = get_train_data()
lp = LocationPipeline()
lp.fit(X, y)
if tts:
pred = lp.predict(sample())[0]
os.system("say " + pr... |
# -*- coding: utf8 -*-
from django.conf.urls import patterns, include, url
from django.contrib import admin
from django.views.generic.simple import redirect_to
admin.autodiscover()
slug_regex = ur'[A-Za-z0-9æøåÆØÅ]+'
urlpatterns = patterns('',
url(r'^admin/', include(admin.site.urls)),
url(r'^accounts/', ... |
import argparse
import datetime
import os
from pprint import PrettyPrinter
def migrate(filename, dry_run=True):
date = None
tmp_file = 'data/tmp.txt'
for line in filename:
if is_date(line):
if date:
write_to_dayone(date, tmp_file, dry_run) # Write to dayone
... |
from __future__ import print_function
import subprocess
import sys
import os
from os import makedirs, listdir, remove, rename
from os.path import exists, join, abspath, isdir, isfile, splitext, dirname, basename
import argparse
from subprocess import Popen, PIPE
from shutil import rmtree, copytree, copy2
from glob impo... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import print_function, absolute_import, unicode_literals
__all__ = ["corner", "hist2d", "error_ellipse"]
__version__ = "0.0.5"
__author__ = "Dan Foreman-Mackey (danfm@nyu.edu)"
__copyright__ = "Copyright 2013 Daniel Foreman-Mackey"
__contributors__ = [
... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
'''Basic Authorization tests for the OSF.'''
from __future__ import absolute_import
import unittest
import mock
from nose.tools import * # noqa PEP8 asserts
from website.addons.twofactor.tests import _valid_code
from tests.base import OsfTestCase
from tests.factories i... |
import sys, platform, os, traceback, datetime, codecs
from twisted.words.protocols import irc
from twisted.internet import reactor, protocol
from IRCResponse import IRCResponse, ResponseType
from IRCMessage import IRCMessage
from FunctionHandler import AutoLoadFunctions
import GlobalVars
class MoronBot(irc.I... |
#!/usr/bin/env python
# File: dataset_images.py
# Author: Kiri Wagstaff, 5/7/13
#
# Readers and plotters for image data sets.
#
# Copyright 2013-2015, by the California Institute of Technology. ALL
# RIGHTS RESERVED. United States Government Sponsorship
# acknowledged. Any commercial use must be negotiated with the Of... |
from phovea_server.util import to_json
class TestCustomEncoders:
# def test_sets(self):
# assert jsonify(set()) == []
def test_nan_values(self):
test_var = float('nan')
test_result = to_json(dict(myNum=test_var))
assert test_result == "{'myNum': null}"
|
from __future__ import division
from StringIO import StringIO
import numpy as np
import scipy as sp
import pandas as pd
from scipy.stats import gamma
import matplotlib.pyplot as plt
class HRFModel(object):
"""Abstract class definition for HRF Models."""
def __init__(self):
raise NotImplementedError
... |
from typing import Any, Dict, Text
from warnings import WarningMessage
from _pytest.pytester import Testdir
import pytest
from rasa.__main__ import create_argument_parser
import rasa.cli.data
import rasa.cli.scaffold
import rasa.cli.train
import rasa.shared.utils.io
def _warning_should_be_filtered_out(warning: Warn... |
# -*- coding: utf-8 -*-
#
# Copyright (c) 2011-2016 Genestack Limited
# All Rights Reserved
# THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF GENESTACK LIMITED
# The copyright notice above does not evidence any
# actual or intended publication of such source code.
#
import sys
from genestack_client import Application... |
#!/usr/bin/env python
import argparse
from datetime import datetime
import os
from os.path import abspath, expanduser
from select import select
import socket
import sys
import time
import Growl
import mpd
def msg(text):
dt = datetime.now()
timestamp = dt.strftime("[%Y-%m-%d %H:%M:%S] ")
print timestamp + ... |
from zipfile import is_zipfile
from copy import deepcopy
from django import forms
from django.conf import settings
from django.core.checks.messages import Error
from django.db.models import Q
from django.db.models.query import QuerySet
from django.db.models.fields.related import ForeignKey, ManyToManyField
from django... |
"""
This test file tests the lib.tokenclass
The lib.tokenclass depends on the DB model and lib.user
"""
PWFILE = "tests/testdata/passwords"
from .base import MyTestCase, FakeAudit, FakeFlaskG
from privacyidea.lib.resolver import (save_resolver)
from privacyidea.lib.realm import (set_realm)
from privacyidea.lib.user i... |
# Copyright (c) 2020, DjaoDjin Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice,
# this list of conditions and t... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# copyright 2015 Hamilton Kibbe <ham@hamiltonkib.be> and Paulo Henrique Silva
# <ph.silva@gmail.com>
# 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... |
#
# Copyright 2016 Quantopian, 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 wr... |
from neo4j import GraphDatabase, basic_auth
def set_up_connection():
# setup neo4j database connection
driver = GraphDatabase.driver("bolt://13.58.54.49:7687", auth=basic_auth("neo4j", "goSEAKers!"))
session = driver.session()
return session
def diagnose_symptoms_by_subset_of_anomaly(symptoms):
... |
from django.conf import settings
from django.db.models import Count, F, Sum
from django.utils.decorators import method_decorator
from django.views.decorators.cache import cache_page
from django_filters.rest_framework import DjangoFilterBackend
from api.activity.serializers import CodelistSerializer
from api.aggregatio... |
from mollie.api.objects.list import List
from mollie.api.objects.refund import Refund
PAYMENT_ID = 'tr_7UhSN1zuXS'
REFUND_ID = 're_4qqhO89gsT'
def test_get_refund(client, response):
"""Retrieve a specific refund of a payment"""
response.get('https://api.mollie.com/v2/payments/%s/refunds/%s' % (PAYMENT_ID, RE... |
# -*- coding: utf-8 -*-
#
# Copyright (c) 2010-2012 Cidadania S. Coop. Galega
#
# This file is part of e-cidadania.
#
# e-cidadania 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 Licen... |
from UM.i18n import i18nCatalog
from UM.Application import Application
from UM.Logger import Logger
from UM.Signal import signalemitter
from UM.Message import Message
from UM.Util import parseBool
from cura.PrinterOutputDevice import PrinterOutputDevice, ConnectionState
from cura.PrinterOutput.PrinterOutputModel impor... |
from unittest import TestCase
from unittest.mock import patch
from ruuvitag_sensor.ruuvi import RuuviTagSensor
class TestRuuviTagSensor(TestCase):
def get_data(self, mac):
return 'CtHsK0FKfA'
@patch('ruuvitag_sensor.ble_communication.BleCommunication.get_data',
get_data)
def test_tag... |
from abc import ABCMeta, abstractmethod
import inspect
import socket
import sys
import os
import traceback
from msgpackutil import dumps, loads
from geventmanager.exceptions import current_error
from geventmanager.log import get_logger
from geventmanager.rpcsocket import InetRpcSocket, GeventRpcSocket, RpcSocket
from t... |
# -*- coding: utf-8 -*-
"""
Django settings for WAStD 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_liter... |
# Copyright (c) 2020 Aldo Hoeben / fieldOfView
# OctoPrintPlugin is released under the terms of the AGPLv3 or higher.
from UM.i18n import i18nCatalog
from UM.Logger import Logger
from UM.Signal import signalemitter
from UM.Message import Message
from UM.Util import parseBool
from UM.Mesh.MeshWriter import MeshWriter
f... |
from pytest import raises
from unittest.mock import patch
from ruuvitag_sensor.ruuvi import RuuviTagSensor
from ruuvitag_sensor.ruuvitag import RuuviTag
# pylint: disable=line-too-long,no-self-use,unused-argument
class TestRuuviTagSensor():
def get_data(self, mac, bt_device):
# https://ruu.vi/#AjwYAMFc... |
# -*- coding: utf-8 -*-
"""
Django settings for Tickle 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_lite... |
import re, os, sys, hashlib, tarfile, shutil, subprocess, tempfile
def scrub(b):
if sys.version_info >= (3,) and type(b) == bytes:
return b.decode('ascii')
else:
return b
src_dir = scrub(os.getenv("CFG_SRC_DIR"))
if not src_dir:
raise Exception("missing env var CFG_SRC_DIR")
snapshotfile = os.path.join... |
"""Tests for selector_events.py"""
import collections
import errno
import gc
import pprint
import socket
import sys
import unittest
import mock
try:
import ssl
except ImportError:
ssl = None
HAS_SNI = False
else:
HAS_SNI = getattr(ssl, 'HAS_SNI', False)
from asyncio.py33_exceptions import (
Blocki... |
#!/usr/bin/env python
#
# helper_tools.py - Unit test cases for helper tools module.
#
# April 2014, Glenn F. Matthews
# Copyright (c) 2014-2015 the COT project developers.
# See the COPYRIGHT.txt file at the top-level directory of this distribution
# and at https://github.com/glennmatthews/cot/blob/master/COPYRIGHT.tx... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.