content stringlengths 4 20k |
|---|
{
'name': 'Travel Journey by Rail',
'version': '0.1',
'author': 'Savoir-faire Linux',
'maintainer': 'Savoir-faire Linux',
'license': 'AGPL-3',
'website': 'http://www.savoirfairelinux.com',
'category': 'Customer Relationship Management',
'summary': 'Travel by Rail',
'description': """... |
#!/usr/bin/python
# -*- encoding: utf-8 -*-
from __future__ import print_function
import solidscraper as ss
import traceback
import argparse
import json
from time import time, sleep
from datetime import timedelta
from datetime import datetime
from dateutil import tz
try:
from urllib.parse import quote as url_enco... |
import ROOT
import root_numpy as rnp
from nose.tools import assert_raises, assert_equal
def check_array(cls, copy):
a = cls(10)
a[2] = 2
b = rnp.array(a, copy=copy)
assert_equal(b[2], 2)
assert_equal(b.shape[0], 10)
def test_array():
for copy in (True, False):
for cls in (getattr(ROO... |
from __future__ import unicode_literals
from unittest import TestCase, TestSuite, TestLoader, TextTestRunner
from pkg_resources import resource_stream # @UnresolvedImport
from babelfish import (LANGUAGES, Language, Country, Script, get_language_converter, get_country_converter,
LANGUAGE_CONVERTERS, LanguageReverse... |
#!/usr/bin/env python
# vim: ai ts=4 sts=4 et sw=4
import sys, time, readline, multiprocessing
from optparse import OptionParser
from sqlobject import SQLObject, IntCol, StringCol, BLOBCol
from sqlobject.sqlite.sqliteconnection import SQLiteConnection
'''
mock_client: this is a script that helps testing of Slingsho... |
import argparse
import ipaddr
from maas_common import get_auth_ref
from maas_common import get_keystone_client
from maas_common import metric
from maas_common import metric_bool
from maas_common import print_output
from maas_common import status_ok
import requests
from requests import exceptions as exc
def check(arg... |
"""Convert BAM/SAM to FASTQ format*
@name
sequence
+name
quality score (phred33)
files may be SAM or BAM (autodetected)
If the file(s) contain paired-end sequences, we will write to two files
(in the current working directory)
If the files contain single end sequences, we will write to stdout by default
Output is alwa... |
from oslo_serialization import jsonutils
from six.moves import http_client
import webob.dec
from murano.common import wsgi
class Controller(object):
"""A wsgi controller that reports which API versions are supported."""
def index(self, req):
"""Respond to a request for all OpenStack API versions.""... |
from django.db import models
from django_fsm import FSMField, FSMKeyField, transition
class Application(models.Model):
"""
Student application need to be approved by dept chair and dean.
Test workflow
"""
state = FSMField(default='new')
@transition(field=state, source='new', target='draft')
... |
#!/usr/bin/env python
"""
Script to automate the process of generating an isochrone library
using the Dotter isochrones.
Download isochrones from:
http://stellar.dartmouth.edu/models/isolf_new.html
New MESA isochrones come from:
http://waps.cfa.harvard.edu/MIST/interp_isos.html
"""
import os
import re
try:
from ... |
import numpy as np
from sklearn.preprocessing import Normalizer
from imgmani import collapse_image
class Normalize():
def __init__(self):
pass
def normalize(self, msi):
pass
class NormalizeIQ(Normalize):
"""Normalize by image quotient"""
def __init__(self, iqBand=None):
i... |
#!/usr/bin/env python
import sys
import wialon
from setuptools import setup, find_packages
extra = {}
if sys.version_info >= (3,):
extra['use_2to3'] = True
extra['convert_2to3_doctests'] = ['README.md']
CLASSIFIERS = [
'Development Status :: 5 - Production/Stable',
'Intended Audience :: Developers',... |
from models import Gene, Sample
# TODO method for creating samples faster
def test_gene_init():
gene = Gene('BAD')
assert gene.name == 'BAD'
same = Gene('BAD')
assert same == gene
assert same is gene
g = Gene('TP53', 'Tumour suppressor p53')
assert g.name == 'TP53'
assert g.descript... |
from typing import Optional
from stoq.data_classes import Payload, DispatcherResponse, Request
from stoq.plugins import DispatcherPlugin
class SimpleDispatcher(DispatcherPlugin):
RAISE_EXCEPTION = False
RETURN_ERRORS = False
SHOULD_ARCHIVE = True
WORKERS = ['dummy_worker']
async def get_dispatch... |
from django import forms
from django.utils.translation import (
ugettext_lazy as _, ugettext, pgettext_lazy
)
from django.utils.safestring import mark_safe
from django.utils.encoding import smart_unicode
from django.forms import ValidationError
from weblate.lang.models import Language
from weblate.trans.models impo... |
from six import StringIO
import pytest
from doit.exceptions import InvalidCommand
from doit.dependency import DbmDB, Dependency
from doit.cmd_forget import Forget
from .conftest import tasks_sample, CmdFactory
class TestCmdForget(object):
@pytest.fixture
def tasks(self, request):
return tasks_sampl... |
from django.core.urlresolvers import reverse
from django.utils.translation import ugettext_lazy as _
from django import forms
from django.forms.widgets import RadioSelect, CheckboxSelectMultiple
from django.shortcuts import get_object_or_404
from django.conf import settings
import urllib
from serv.models import Servi... |
'''
Copyright (C) 2010 Zachary Varberg
@author: Zachary Varberg
This file is part of Steganogra-py.
Steganogra-py 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 ... |
# -*- coding:utf-8 -*-
from __future__ import unicode_literals
from base64 import b64encode
from hashlib import md5
import os
from django.test import TestCase
from django.utils.encoding import force_bytes
from yepes.contrib.thumbnails.models import Configuration
from yepes.contrib.thumbnails.proxies import Configur... |
import netaddr
from neutron_lib import constants as n_consts
from oslo_log import log as logging
from neutron.agent import firewall
from neutron.agent.linux import ip_lib
from neutron.agent.linux.openvswitch_firewall import constants as ovsfw_consts
from neutron.common import constants
from neutron.common import utils... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
################################################################################
#
# This file is for import the Text Files with the descriptions of
# each transit and insert in the DB.
#
################################################################################
impor... |
#!/usr/bin/env python
# coding=utf-8
"""Scriptworker production CoT verification tests.
"""
import json
import logging
import os
import re
import tempfile
import aiohttp
import pytest
from asyncio_extras.contextmanager import async_contextmanager
from taskcluster.aio import Index, Queue, Secrets
import scriptworker.l... |
__source__ = 'https://leetcode.com/problems/score-after-flipping-matrix/'
# Time: O(R * C)
# Space: O(1)
#
# Description: Leetcode # 861. Score After Flipping Matrix
# We have a two dimensional matrix A where each value is 0 or 1.
#
# A move consists of choosing any row or column, and toggling each value in that row o... |
#!/usr/bin/env/python3
"""
by: gsilvapt
Function to find if a number is a prime or not,
(int) -> str, int
"""
def fetch_number(prompt):
"""
Asks for a number to see if it is prime.
(str) -> int
"""
return int(input(prompt))
def is_prime(number):
"""
Computes if number from prompt is prime. ... |
import select
import socket
class Stream(object):
"""
a stream is a file-like object that is used to expose a consistent and uniform
interface to the underlying 'physical' file-like object (like sockets and pipes),
which have many quirks (sockets may recv() less than `count`, pipes are simplex
an... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
from . agents import *
import random
class Manfro2Class(Agent):
def __init__(self, x=0, y=0):
Agent.__init__(self)
#self.img = 'agent_v5' # Immagine persomale
# Dichiaro le azioni
self.actions = ['GoEast', 'GoWest', 'GoNorth', 'GoSouth... |
"""
copyright 2015 austin ankney, ming fang, wenjun wang and yao zhou
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 l... |
"""Jobs for queries personalized to individual users."""
import ast
import logging
from core import jobs
from core.domain import config_domain
from core.domain import exp_services
from core.domain import rights_manager
from core.domain import role_services
from core.domain import subscription_services
from core.domai... |
from PyQt5.QtCore import *
from PyQt5.QtGui import *
from PyQt5.QtWidgets import *
from tikz_editor.models import Preferences
from tikz_editor.tools import isMacintoshComputer
from tikz_editor.tools.qt import Dialogs
class DocumentView(QMainWindow):
"""
TikZ document window. This class is just the root of the doc... |
import re
import sys
import warnings
from unittest import mock
import pytest
from _pytest import deprecated
from _pytest.compat import legacy_path
from _pytest.pytester import Pytester
from pytest import PytestDeprecationWarning
@pytest.mark.parametrize("attribute", pytest.collect.__all__) # type: ignore
# false po... |
"""
Starter fabfile for deploying the project_name project.
Change all the things marked CHANGEME. Other things can be left at their
defaults if you are happy with the default layout.
"""
import posixpath
from fabric.api import run, local, env, settings, cd, task
from fabric.contrib.files import exists
from fabric.o... |
from temboo.core.choreography import Choreography
from temboo.core.choreography import InputSet
from temboo.core.choreography import ResultSet
from temboo.core.choreography import ChoreographyExecution
import json
class ListSubscriptionsByTopic(Choreography):
def __init__(self, temboo_session):
"""
... |
# -*- coding: utf8 -*-
#
# Created by 'myth' on 10/3/15
from copy import deepcopy
from algorithms import AStarProblem, GAC
from common import *
from datastructures import AStarState, CSPState
class NonogramProblem(AStarProblem):
def __init__(self, path):
"""
Constructor for the NonogramProblem
... |
import unittest
import os
from ...workbook import Workbook
from ..helperfunctions import _compare_xlsx_files
class TestCompareXLSXFiles(unittest.TestCase):
"""
Test file created by XlsxWriter against a file created by Excel.
"""
def setUp(self):
self.maxDiff = None
filename = 'rich_... |
import logging
import traceback
from django.conf import settings
from django.core.paginator import Paginator
from django.http import HttpResponse, HttpResponseServerError
from django.shortcuts import get_object_or_404, render_to_response
from django.template import RequestContext
from django.template.loader import ren... |
import os
import urllib2
from datetime import date
from datetime import datetime
import json
import csv
import pprint
from xml.etree.cElementTree import Element, ElementTree
# Process the data created in parse_csv()
def create_IATI_xml(iatidata, dir, o):
node = Element('iati-activities')
node.set("version", "1... |
# coding=utf-8
"""Configure Anime Look & Feel and AniDB authentication."""
from __future__ import unicode_literals
import os
from medusa import (
app,
config,
logger,
ui,
)
from medusa.server.web.config.handler import Config
from medusa.server.web.core import PageTemplate
from tornroutes import rou... |
from PyQt5.QtWidgets import QMainWindow, QDialog, QFileDialog
from PyQt5.QtCore import pyqtSlot, Qt
from Compiled_UI.MainWindow import Ui_MainWindow
from Compiled_UI.about import Ui_About
import sys
import subprocess
class MainWindow(QMainWindow):
argv = []
def __init__(self):
super(MainWindow, self)... |
from sklearn import linear_model
from ml_ext import stats
from ml_ext import numpy
from ml_ext import pd
from ml_ext import logging
from ml_ext import inv
from ml_ext import plt
from ml_ext import sns
from ml_ext import metrics
class LinModel(linear_model.LinearRegression):
"""
LinearRegression class after sk... |
#!/usr/bin/env python
import fire
import os
import shutil
class ModuleStubber(object):
def __init__(self):
self._file_path = os.path.realpath(__file__)
self._top_level = os.path.dirname(os.path.dirname(self._file_path))
self._module = None
def stub(self, module):
self._module... |
import time, threading
from unittest import TestCase, main
from lucene import *
class PyLuceneThreadTestCase(TestCase):
"""
Test using threads in PyLucene with python threads
"""
def setUp(self):
self.classLoader = Thread.currentThread().getContextClassLoader()
self.directory = RAMD... |
#!/usr/bin/env python
import requests
import pandas as pd
import os
import pickle
import time
'''
This script uses foursquare EXPLORE api to fetch the foursquare
ratings for the restaurants in the inspection data.
'''
# read csv file and drop the irrelevant column
# Merge_target.csv is essentially a table containin... |
"""RESTful platform for notify component."""
import logging
import requests
import voluptuous as vol
from homeassistant.const import (
CONF_AUTHENTICATION,
CONF_HEADERS,
CONF_METHOD,
CONF_NAME,
CONF_PASSWORD,
CONF_RESOURCE,
CONF_USERNAME,
CONF_VERIFY_SSL,
HTTP_BASIC_AUTHENTICATION,... |
# -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding field 'Rule.user'
db.add_column('ui_rule', 'user',
self.gf('django.db.models.... |
from datetime import datetime, time
from openerp import models, api
class HrEmployee(models.Model):
_inherit = 'hr.employee'
@api.multi
def work_scheduled_on_day(self, date_dt, public_holiday=True,
schedule=True):
''''
returns true or false depending on if em... |
# -*- coding: utf-8 -*-
import scrapy, json
import pdb, datetime
class projectorItem(scrapy.Item):
Brand = scrapy.Field()
Name = scrapy.Field()
Price = scrapy.Field()
Uri = scrapy.Field()
ImageUri = scrapy.Field()
TimeStamp = scrapy.Field(... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
'''
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, or (at your option)
any later version.
This Program is distributed in the hope th... |
"""
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
"""
class ComponentDict(dict):
def __getitem__(self, key):
if hasattr(key, "get_eid"):
key = key.get_eid()
return super().__getitem__(key)
class BaseEntity:
root = None
def __init__(self, _eid=None, **kwargs):
... |
TILE_TYPES = {
'land': {
'name': 'land',
'defence': 5,
'pass_cost': 1.5,
'heal': 0,
'owner': None,
},
'forest': {
'name': 'forest',
'defence': 10,
'pass_cost': 2,
'heal': 0,
'owner': None,
},
'road': {
'name':... |
from datetime import datetime
from unittest import TestCase
import ddt
import freezegun
import mock
import pytz
from xblock.field_data import DictFieldData
from group_project_v2.group_project import GroupActivityXBlock
from group_project_v2.project_api import TypedProjectAPI
from group_project_v2.project_api.dtos imp... |
import json
from django.test import TestCase
from django.test import Client
from autofixture import AutoFixture
from rest_framework import status
from operis.api.test.client import OperisTestClient
{% for animport in imports %}
from {{animport}} import *
{% endfor %}
{% for model in models %}
#http://... |
from __future__ import unicode_literals, print_function
import frappe
import unittest, json, sys, os
import time
import xmlrunner
import importlib
from frappe.modules import load_doctype_module, get_module_name
from frappe.utils import cstr
import frappe.utils.scheduler
import cProfile, pstats
from six import StringIO... |
"""
ex_second_order_eq.py
Second order equation: z**2+p*z+q=0
Copyright (C) 2007-2009 Leif Roschier
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 ... |
"""
This module contains methods for creating a scatterplot of team forward line shot rates.
"""
import pandas as pd
import matplotlib.pyplot as plt
import matplotlib.colors as mplc
import scrapenhl2.plot.visualization_helper as vhelper
from scrapenhl2.scrape import schedules, players
import scrapenhl2.scrape.general... |
#!/usr/bin/env python
"""
A servo is for switching some tools on/off. This one is for Replicape.
Author: Mathieu Monney
email: zittix(at)xwaves(dot)net
Website: http://www.xwaves.net
License: GNU GPL v3: http://www.gnu.org/copyleft/gpl.html
Redeem is free software: you can redistribute it and/or modify
it under the... |
"""
Example Airflow DAG that execute the following tasks using
Cloud DLP service in the Google Cloud:
1) Creating a content inspect template;
2) Using the created template to inspect content;
3) Deleting the template from Google Cloud .
"""
import os
from google.cloud.dlp_v2.types import ContentItem, InspectConfig, I... |
# -*- coding: utf-8 -*-
"""
Application Admin Controllers
"""
import os
from shutil import rmtree
#import socket
import datetime
import copy
import gluon.contenttype
import gluon.fileutils
DEBUG = False
if DEBUG:
print >> sys.stderr, "APPADMIN: DEBUG MODE"
def _debug(m):
print >> sys.stderr, m
el... |
from nose.tools import eq_
from ruamel.yaml import YAML
from moban.core.data_loader import merge
def test_simple_union():
user = {"hi": "world"}
default = {"world": "hi"}
merged = merge(user, default)
assert merged == {"hi": "world", "world": "hi"}
def test_simple_overlapping():
user = {"hi": "... |
"""
Utilities to help Proton support both python2 and python3.
"""
import sys
# bridge between py2 Queue renamed as py3 queue
try:
import Queue as queue
except ImportError:
import queue # type: ignore
try:
from urlparse import urlparse, urlunparse
from urllib import quote, unquote # type: ignore
exce... |
#!/usr/bin/env python
import json
import os
import os.path
import shutil
import sys
from flask import current_app, Flask, jsonify, render_template, request
from flask.views import MethodView
# Meta
##################
__version__ = '0.1.0'
# Config
##################
DEBUG = True
SECRET_KEY = 'development key'
BASE_... |
from spack import *
import glob
import tempfile
class Wps(Package):
"""The Weather Research and Forecasting Pre-Processing System (WPS)
"""
homepage = "https://www.mmm.ucar.edu/weather-research-and-forecasting-model"
url = "https://github.com/wrf-model/WPS/archive/v4.2.tar.gz"
maintainers =... |
# -*- coding: utf-8 -*-
from optparse import OptionParser
import codecs
import itertools
def merge_file(text_file, box_file):
"""Merges a text file with a box file so it doesn't have to be done manually.
We take each char from the text file, and each line from the box file, and
simply line them up. If t... |
import percolation as P
from .rdflib import NS
a=NS.rdf.type
c=P.check
def performRdfsInference(data_context=None,ontology_context=None,inferred_context=None,clean_inferred_context=True):
# clean inference graph if True
if clean_inferred_context:
P.context(inferred_context,"remove")
previous_count... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""Extended File Object Module.
Module that Extends the functionality of the base file object
to import:
>>> import ExtendedFile
>>> from extendedfile import ExtendedFile
>>> ExtendedFile(path, mode)
"""
import os
from io import FileIO, BufferedReader, BufferedWriter
from .s... |
from dateutil.parser import parse
import trafaret as t
class TestTrafaret:
package = 'trafaret'
def __init__(self, allow_extra):
self.schema = t.Dict({
'id': t.Int(),
'client_name': t.String(max_length=255),
'sort_index': t.Float,
# t.Key('client_email'... |
import socket, requests, json, codecs
from flask import Flask, request, jsonify
from manager import AcquireManager, HeartBeatManager
app = Flask(__name__)
manager = AcquireManager()
heart = HeartBeatManager()
@app.route('/')
def index():
return 'Hello World!'
@app.route('/get_my_ip')
def get_my_ip():
return ... |
# coding: utf-8
# In[55]:
import sys
import os
import copy
import json
import time
import networkx as nx
import matplotlib.pyplot as plt
from itertools import product
# In[56]:
class BaseGraph:
def __init__(self, inputs):
self.inputs = inputs
self.shaft_names = {}
self.edge_list = None
... |
from flask import Flask, session, url_for, redirect, json, request
from flask.ext.sqlalchemy import SQLAlchemy
from flask.ext.script import Manager
from flask.ext.marshmallow import Marshmallow
from flask.ext.migrate import Migrate, MigrateCommand
from flask.ext.security import Security, SQLAlchemyUserDatastore, curren... |
#!/usr/bin/env python3
# coding: utf-8
import argparse
import struct
import os
import math
def int_ceil(float_):
""" Округлить float в больщую сторону """
return int(math.ceil(float_))
# в модуле argparse уже есть "rock solid"-реализация
# структуры, поэтому используем ее
USE_NAMESPACE = True
if USE_NAMESPAC... |
"""The only file where icon filenames are mentioned"""
from __future__ import absolute_import, division, unicode_literals
import os
from qtpy import QtGui
from qtpy import QtWidgets
from . import core
from . import qtcompat
from . import resources
from .compat import ustr
from .i18n import N_
KNOWN_FILE_MIME_TYPES ... |
#!/usr/bin/env python
import os
import re
import sys
import codecs
from setuptools import setup, find_packages
# When creating the sdist, make sure the django.mo file also exists:
if 'sdist' in sys.argv or 'develop' in sys.argv:
os.chdir('fluentcms_suit')
try:
from django.core import management
... |
from __future__ import absolute_import
import os.path
import re
import sys
import glob
import platform
import ctypes
import ctypes.util
def _environ_path(name):
if name in os.environ:
return os.environ[name].split(":")
else:
return []
class LibraryLoader(object):
def __init__(self):
... |
# -*- coding: utf-8 -*-
from Components.Converter.Converter import Converter
from Components.config import config
from enigma import iServiceInformation, iPlayableService, iPlayableServicePtr, eServiceReference, eEPGCache, eServiceCenter
from ServiceReference import resolveAlternate
from Components.Element import cache... |
# -*- coding: utf-8 -*-
from __future__ import absolute_import
import os
import json
import itertools
import collections
import requests
from six.moves import http_client as httplib
from six.moves import urllib_parse as urllib
from betfair import utils
from betfair import models
from betfair import exceptions
IDE... |
#!/usr/bin/env python3
from sys import exit
from test.http_test import HTTPTest
from test.base_test import HTTPS, SKIP_TEST
from misc.wget_file import WgetFile
import os
"""
This test ensures that Wget can download files from HTTPS Servers
"""
if os.getenv('SSL_TESTS') is None:
exit (SKIP_TEST)
############# ... |
import re
import bibtexparser
from .evidence import Evidence
from .bibtex_customizations import customizations
def bibtex_to_document(bibtex_entry, context=None):
""" Takes a single BibTeX entry and translates it into a Document object """
from owmeta.document import Document
res = Document.contextualiz... |
# -*- coding: utf-8 -*-
'''
Copyright 2012-2018 HWM
This file is part of PorDB3.
PorDB3 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 o... |
from __future__ import absolute_import
from __future__ import print_function
from keras.datasets import mnist
from keras.models import Sequential
from keras.layers.core import Dense, Dropout, Activation
from keras.optimizers import SGD, Adam, RMSprop
from keras.utils import np_utils
from keras.callbacks import Plotter
... |
r"""Benchmark base to run and report benchmark results."""
from __future__ import absolute_import as _absolute_import
from __future__ import division as _division
from __future__ import print_function as _print_function
from tensorflow.python.eager import test
class MicroBenchmarksBase(test.Benchmark):
"""Run and... |
"""Create a local Vitess database for testing."""
import logging
import os
from vttest import environment
from vttest import vt_processes
class LocalDatabase(object):
"""Set up a local Vitess database."""
def __init__(self, shards, schema_dir, mysql_only):
self.shards = shards
self.schema_dir = schema_... |
'''
Created on 19 Feb 2013
@author: Ioannis
'''
'''
Models an Interruption that schedules the operation of the machines by different managers
'''
import simpy
from OperatorRouter import Router
from opAss_LPmethod import opAss_LP
# ===========================================================================
# ... |
"""Benchmark scipy.special.round."""
from __future__ import print_function
import timeit
NAME = "round"
REPEATS = 3
ITERATIONS = 1000000
def print_version():
"""Print the TAP version."""
print("TAP version 13")
def print_summary(total, passing):
"""Print the benchmark summary.
# Arguments
* ... |
import json
from glosslist import GlossList
#####################################################################################
# This file is generated by Json2Class (https://github.com/DragonSpawn/Json2Class) #
# Modifications to this file will be lost the next time you run the tool. #
# ... |
from __future__ import unicode_literals
from markment.fs import Node
from .base import LOCAL_FILE as L
def test_node_depth_of():
("Node#depth_of(path) should return the approriate number")
path = L()
(Node(path).depth_of(L('sandbox_simple/img/logo.png')).should.equal(2))
(Node(path).depth_of(L('san... |
list_services = {
'status_code': [200],
'response_body': {
'type': 'object',
'properties': {
'services': {
'type': 'array',
'items': {
'type': 'object',
'properties': {
# NOTE: Now the typ... |
"""Tests for repository revision signatures."""
from bzrlib import (
errors,
gpg,
tests,
urlutils,
)
from bzrlib.testament import Testament
from bzrlib.tests import per_repository
class TestSignatures(per_repository.TestCaseWithRepository):
def setUp(self):
super(TestSignatures, self... |
"""
Opens all the URLs listed in config.ini [hs-browse] section
"""
#############################################################################
# Copyright (C) 2016 Areeb Beigh <<EMAIL>> #
# #
# This program is free soft... |
"""
SLA (Service-level agreement) is set of details for determining compliance
with contracted values such as maximum error rate or minimum response time.
"""
from rally.common.i18n import _
from rally.common import streaming_algorithms
from rally import consts
from rally.task import sla
@sla.configure(name="outlier... |
import logging
from django.core.urlresolvers import reverse
from django.template import defaultfilters as filters
from django.utils.translation import ugettext_lazy as _
from django.utils.translation import ungettext_lazy
from horizon import exceptions
from horizon import tables
from openstack_dashboard import api
f... |
# -*- coding: utf-8 -*-
# Source: https://leetcode.com/problems/letter-combinations-of-a-phone-number/
mapping = {
'1': [],
'2': ['a', 'b', 'c'],
'3': ['d', 'e', 'f'],
'4': ['g', 'h', 'i'],
'5': ['j', 'k', 'l'],
'6': ['m', 'n', 'o'],
'7': ['p', 'q', 'r', 's'],
'8': ['t', 'u', 'v'],
... |
import os
import oslo_i18n
from oslo_log import log
from keystone.common import profiler
import keystone.conf
from keystone import exception
# NOTE(dstanek): i18n.enable_lazy() must be called before
# keystone.i18n._() is called to ensure it has the desired lazy lookup
# behavior. This includes cases, like keystone... |
"""
Module to handle the necessary configuration file.
"""
class Config:
"""Parses the config file and returns a config object."""
def __init__(self):
"""Inits Config object with default values."""
self.domain = None
"""Social network to work with."""
self.start = None
... |
"""Tests for gate_compilation.py"""
import numpy as np
import pytest
import cirq
from cirq import value
from cirq_google.optimizers.two_qubit_gates.gate_compilation import (
gate_product_tabulation,
GateTabulation,
)
from cirq_google.optimizers.two_qubit_gates.math_utils import unitary_entanglement_fidelity
fr... |
from msrest.serialization import Model
class ImageStoreContent(Model):
"""Information about the image store content.
:param store_files: The list of image store file info objects represents
files found under the given image store relative path.
:type store_files: list of :class:`FileInfo
<azure... |
from unittest import mock
from dbt.adapters.base import BaseAdapter
from contextlib import contextmanager
def adapter_factory():
class MockAdapter(BaseAdapter):
ConnectionManager = mock.MagicMock(TYPE='mock')
responder = mock.MagicMock()
# some convenient defaults
responder.quote.... |
"""
sentry.utils.dates
~~~~~~~~~~~~~~~~~~
:copyright: (c) 2010-2014 by the Sentry Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
from __future__ import absolute_import
from datetime import (
datetime,
timedelta,
)
import pytz
from dateutil.parser import parse
from django... |
from odoo import models, fields, api, _
from odoo.addons.queue_job.job import job, related_action
import datetime
class MuskathlonRegistration(models.Model):
_name = 'event.registration'
_inherit = 'event.registration'
lead_id = fields.Many2one('crm.lead', 'Lead')
backup_id = fields.Integer(help='Old... |
#!/usr/bin/env python
# ScraperWiki Limited
# Ian Hopkinson, 2013-06-17
# -*- coding: utf-8 -*-
"""
ContainsTables tests
"""
import sys
sys.path.append('code')
import pdftables
from nose.tools import assert_equals
def test_it_finds_no_tables_in_a_pdf_with_no_tables():
fh = open('fixtures/sample_data/m27-dexpe... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import shutil
class AvailSpace:
def __init__(self, logger):
self.logger = logger
# Sprawdź ilość dostępnego miejsca i odzyskaj jeśli potrzeba
def check(self):
avail_space = self.get_avail_space()
print(str(avail_space))
... |
import logging
import random
from itertools import chain
import pytest
from flexmock import flexmock
from urwid.listbox import SimpleListWalker
from sen.tui.widgets.list.base import WidgetBase
from sen.tui.widgets.list.common import ScrollableListBox, AsyncScrollableListBox
from sen.tui.widgets.list.util import Respo... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.