text stringlengths 12 6.59M |
|---|
__author__ = 'mmoisen'
import peewee
#MYSQL_USERNAME='username'
#MYSQL_DATABASE='database'
#MYSQL_PASSWORD='password'
#MYSQL_HOST='host'
'''
todo:
change this to a database proxy to use different dbs
'''
BREW_PROPERTIES_FILE = "brew.properties"
hostnames = ['raspberrypy','raspberrypy1']
try:
from local_settin... |
# Django settings for adagios project.
DEBUG = True
TEMPLATE_DEBUG = DEBUG
# Hack to allow relative template paths
import os
djangopath = os.path.abspath('.')
ADMINS = (
# ('Your Name', 'your_email@domain.com'),
)
MANAGERS = ADMINS
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.', # Add '... |
import json
import os
import random
import string
import subprocess
from ssl import create_default_context
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
BASE_DIR = os.path.dirname(os.path.abspath(__file__))
#########################################################
# Django settings
#######... |
#!/usr/bin/env python
from __future__ import absolute_import
from collections import defaultdict
import importlib
import os
from django.contrib import messages
import settingshelper as helper
# odd celery fix
import djcelery
djcelery.setup_loader()
DEBUG = True
LESS_DEBUG = DEBUG
# clone http://github.com/dimagi/V... |
# Django settings for experimentdb project.
DEBUG = True
TEMPLATE_DEBUG = DEBUG
ADMINS = (
# ('Your Name', 'your_email@domain.com'),
)
MANAGERS = ADMINS
DATABASE_ENGINE = 'mysql' # 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'.
DATABASE_NAME = 'experimentdb' # Or path... |
import sqlite3
create_table_mappings = '''
CREATE TABLE IF NOT EXISTS mappings (
mname VARCHAR(255) NOT NULL,
key INTEGER NOT NULL,
note INTEGER NOT NULL,
CONSTRAINT no_duplicates UNIQUE (mname, key, note)
)
'''
# TODO: split this table up in traditional relational style
# create_table_mappings = '''
# CREATE... |
"""
Wikipedia Tools library
Get the plain text, wikitext, HTML, or parse tree of an article via
MediaWiki API. You may get the whole article in those formats, just
the "lead" section (summary), or just the Infobox (if extant).
"""
__author__ = "Archer4499(originally by siznax)"
__contact__ = "https://github.com/Arche... |
# coding: utf-8
"""Backend management system classes
Used to communicate with providers without using CFME facilities
"""
from __future__ import absolute_import
import json
import requests
from requests.exceptions import Timeout
from .base import WrapanapiAPIBase
class LenovoSystem(WrapanapiAPIBase):
"""Client ... |
import pandas as pd
from shlex import quote
import os,subprocess,fnmatch,warnings,string
from igf_data.utils.dbutils import read_dbconf_json
from igf_data.igfdb.baseadaptor import BaseAdaptor
from igf_data.igfdb.fileadaptor import FileAdaptor
from igf_data.igfdb.projectadaptor import ProjectAdaptor
from igf_data... |
import os
import re
import copy
import tempfile
from fabfile.config import *
from fabfile.utils.fabos import *
from fabfile.utils.cluster import is_lbaas_enabled, get_orchestrator
from fabfile.utils.host import get_from_testbed_dict, get_openstack_internal_vip
from fabfile.tasks.helpers import reboot_node
@task
@para... |
# -*- coding: utf-8 -*-
# vim: set ts=4
import sys
from reportlab.lib.enums import TA_LEFT, TA_CENTER, TA_RIGHT
from reportlab.lib.pagesizes import A4
from reportlab.lib.styles import getSampleStyleSheet, ParagraphStyle
from reportlab.lib.units import inch
from reportlab.platypus import Image, Paragraph, SimpleDocTemp... |
"""Base ThermoState module."""
# Needed to support Python < 3.9
from __future__ import annotations
import sys
from typing import TYPE_CHECKING
import enum
from collections import OrderedDict
import CoolProp
from pint import UnitRegistry, DimensionalityError
from pint.unit import UnitsContainer, UnitDefinition
from pin... |
#!/usr/bin/env python3
# Copyright (C) 2015 taylor.fish (https://github.com/taylordotfish)
# Copyright (C) 2015 nc Krantz-Fire (https://pineco.net/)
# Added --prefix option.
#
# This file is part of shellbot.
#
# shellbot is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Pu... |
"""
Django compatibility utils
"""
try:
from unittest import mock # NOQA
except ImportError:
import mock # NOQA
try:
# djagno 1.7
from django.apps import apps
from django.utils.deconstruct import deconstructible # NOQA
from django.utils.module_loading import autodiscover_modules # NOQA
... |
"""
Adds audit trail to any NDB entity (including Expando-based models)
For more details see README.md
"""
import base64
import datetime
import hashlib
import logging
import os
from google.appengine.ext import ndb
__version__ = '1.1.3'
HASH_LENGTH = 8 # (in bytes out of 20 bytes for SHA-1)
class AuditMixin(object)... |
# -*- coding: utf-8 -*-
# Recording application
#
# Requirement
# PyQt4
# pyqtgraph
# pyaudio
#
# You can install them as below command:
# $ conda install pyqt
# $ python -m pip install pyqtgraph pyaudio
#
# Copyright (c) 2015 Sunao Hara, Okayama University.
import os
import sys
import codecs
#from PyQt4 im... |
import hashlib
import json
import os
import pickle
import shutil
from datetime import date, datetime
import pandas as pd
from catalyst.assets._assets import TradingPair
from six import string_types
from six.moves.urllib import request
from catalyst.constants import DATE_FORMAT, SYMBOLS_URL
from catalyst.exchange.exch... |
from __future__ import absolute_import
import codecs
import datetime
import logging
import os
import re
import socket
import sys
import warnings
log = logging.getLogger(__name__)
BLATHER = 1
TRACE = 5
BASE_FORMAT = '%(asctime)-15s %(levelname)s %(name)s: %(message)s'
FULL_FORMAT = '%(asctime)-15s %(login)s@%(ip)s... |
import unittest
from cobe.commands import LearnIrcLogCommand
class testIrcLogParsing(unittest.TestCase):
def setUp(self):
self.command = LearnIrcLogCommand()
def testNonPubmsg(self):
msg = "this is some non-pubmsg text found in a log"
cmd = self.command
self.assertEqual(None,... |
#!/usr/bin/env python
# coding=utf-8
# Copyright 2018 Criteo
#
# 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... |
from datetime import datetime as dt
from fabfile.config import *
from fabfile.utils.fabos import detect_ostype
from fabfile.utils.host import get_env_passwords
from fabric.contrib.files import exists
@roles('all')
@task
def tar_logs_cores():
sudo("rm -f /var/log/logs_*.tgz")
sudo("rm -f /var/crashes/*gz")
... |
'''
Created on Mar 7, 2016
This Module contains the first cut of the recommender service
@author: auerbach
'''
from SuperGLU.Util.ErrorHandling import logInfo
from SuperGLU.Core.FIPA.SpeechActs import INFORM_ACT, REQUEST_ACT
from SuperGLU.Core.MessagingGateway import BaseService
from SuperGLU.Core.Messaging imp... |
#!/usr/bin/env python2
# Copyright (c) 2013 phrack. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import argparse
from canvas_manager import CanvasManager
import cv2
import glob
import imp
import logging
import os
from PIL import Image, Imag... |
from adhocracy4.filters import widgets
def test_render_dropdown_link_widget_without_choices():
widget = widgets.DropdownLinkWidget()
html = widget.render('test_filter', 'test_val1', attrs={'id': 'test_id'})
assert len(widget.choices) == 0
assert '' == html
def test_render_dropdown_link_widget():
... |
#!/usr/bin/env python
'''
@file ion/services/sa/process/test/test_int_data_process_management_service.py
@author Maurice Manning
@test ion.services.sa.process.DataProcessManagementService integration test
'''
import time
import numpy as np
from gevent.event import Event
from nose.plugins.attrib import attr
from mock ... |
#
# Copyright (c) 2004 Specifix, Inc.
# All rights reserved
#
import os
import string
import errno
import sys
import traceback
import pdb
import exceptions
def mkdirChain(*paths):
for path in paths:
if path[0] != "/":
path = os.getcwd() + "/" + path
paths = string.split(pa... |
from oldowan.mtconvert.coverage import calc_coverage
from oldowan.mtconvert.coverage import Coverage
from oldowan.mtconvert.sites2seq import sites2seq
def test_single_rcrs_segment():
ranges = [(16024,16365),
(73,340),
(16000,340),
(16000,577),
(577,15992),
... |
from datetime import datetime
import base64
import hashlib
import hmac
import time
import warnings
try:
import simplejson as json
except ImportError:
import json
from .exceptions import FacepyError
class SignedRequest(object):
"""
Facebook uses 'signed requests' to communicate with applications on t... |
import numpy as np
import skimage
from skimage import morphology
import scipy.ndimage.filters as filters
import math
import SimpleITK as sitk
import util
def preprocess_brain(img, spacing, modality, image_orientation, atlas_orientation='pir'):
"""Perform all preprocessing steps associated with a given imaging mod... |
# -*- coding: utf-8 -*-
#
# Copyright 2016 Taŭga Tecnologia - Aristides Caldeira <aristides.caldeira@tauga.com.br>
# License AGPL-3 or later (http://www.gnu.org/licenses/agpl)
#
from __future__ import division, print_function, unicode_literals
from odoo import api, fields, models
class IrUiView(models.Model):
... |
import sys
import logging
import json
import pycurl
from urllib import urlencode
from cStringIO import StringIO
from pprint import pprint as pp
from flask import Flask, request, abort
APP_CONFIG = 'bot.cfg'
BASE_URL = 'https://api.telegram.org/bot'
GOOGLE_URL = 'http://finance.google.com/finance/info?client=ig&q='
D... |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
#
# Interpreter version: python 2.7
#
# Imports =====================================================================
import pytest
from zeo_connector_defaults import generate_environment
from zeo_connector_defaults import cleanup_environment
from zeo_connector_defaults i... |
import argparse
import inspect
import logging
import os
import re
import sys
from collections import defaultdict
from falafel.core import marshalling
DEFAULT_PATTERN = r'.*py$'
log = logging.getLogger(__name__)
DEFAULT_PLUGIN_MODULE = "falafel.plugins"
def load_package(package_name, pattern=None, loaded_map=set()):... |
import os, sys, re, json
import platform
import shutil
from collections import defaultdict
from datetime import datetime
from decimal import Decimal
import traceback
import urlparse
import urllib
import threading
from i18n import _
def normalize_version(v):
return [int(x) for x in re.sub(r'(\.0+)*$','', v).split("... |
import base64
from contextlib import ExitStack
from io import StringIO
import json
import os
from pathlib import Path
import re
import subprocess
import sys
from tempfile import TemporaryDirectory
import time
from unittest.mock import patch
import uuid
import warnings
import weakref
from xml.etree import ElementTree as... |
import unittest
from scrubadub.detectors.base import Detector, RegexDetector
from scrubadub.detectors.url import UrlDetector
from scrubadub.detectors.email import EmailDetector
from scrubadub.filth.base import Filth
from scrubadub.exceptions import UnexpectedFilth
import scrubadub
class DetectorTestCase(unittest.Tes... |
#
# Copyright (c) 2004 Specifix, Inc.
# All rights reserved
#
from build import fixedglob
import errno
import log
import os
import pdb
import shutil
import stat
import string
import sys
import traceback
import weakref
# build.py and policy.py need some common definitions
def checkUse(use):
"""
Determines whe... |
import unittest
import random
import pandas as pd
import category_encoders as encoders
import numpy as np
__author__ = 'willmcginnis'
class TestEncoders(unittest.TestCase):
"""
"""
def verify_numeric(self, X_test):
for dt in X_test.dtypes:
numeric = False
if np.issubdtype... |
import pytest
from rasa_core.policies import Policy
from rasa_core.policies.ensemble import (PolicyEnsemble, InvalidPolicyConfig,
SimplePolicyEnsemble)
from rasa_core.domain import Domain
from rasa_core.trackers import DialogueStateTracker
from rasa_core.events import UserUtter... |
import os
from subprocess import PIPE, Popen
import numpy as np
import pytest
import vtk
import vtki
from vtki import examples
from vtki.plotting import running_xserver
TEST_DOWNLOADS = False
try:
if os.environ['TEST_DOWNLOADS'] == 'True':
TEST_DOWNLOADS = True
except KeyError:
pass
@pytest.mark.sk... |
"""
Tests that do various complete logging runs like they might happen in a real
application, and then check the output.
There's a partial attempt at testing the TCP protocol using a dummy server
in old SVN revisions, but this proved really complicated without implementing
the protocol server side, so we're skip... |
import os
from subprocess import PIPE, Popen
import numpy as np
import pytest
import vtki
from vtki import examples
from vtki.plotting import running_xserver
@pytest.mark.skipif(not running_xserver(), reason="Requires X11")
def test_docexample_advancedplottingwithnumpy():
import vtki
import numpy as np
... |
#!/usr/bin/python
# vim: ts=4 et sts filetype=python
# This file is part of RCubic
#
# Copyright (c) 2012 Wireless Generation, Inc.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without r... |
import sys
import os
import tempfile
import unittest
import shutil
import copy
CURDIR = os.path.abspath(os.path.dirname(__file__))
TOPDIR = os.path.split(CURDIR)[0]
sys.path.insert(0, TOPDIR)
from ez_setup import (use_setuptools, _build_egg, _python_cmd, _do_download,
_install, DEFAULT_URL, DEFAULT_VERSION)
impor... |
import itertools, pickle, warnings as _builtin_warnings
from nutils import *
from nutils.testing import *
@parametrize
class check(TestCase):
def setUp(self):
super().setUp()
domain, param = mesh.rectilinear([1]*self.ndim, periodic=[0])
if self.ndim == 1:
self.geom = param**2
poly = numpy.a... |
import json
import io
import zipfile
from django.core.files import File
from django.test import TestCase
from greenwich.raster import Raster
from rest_framework.test import APIRequestFactory
from spillway import generics
from spillway.renderers import GeoJSONRenderer
from .models import Location, RasterStore
from .te... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import fnmatch
import re
from unittest import TestCase
import mock
from specchio.handlers import SpecchioEventHandler
from watchdog.events import DirCreatedEvent, FileModifiedEvent, FileMovedEvent
class SpecchioEventHandlerTest(TestCase):
def setUp(self):
w... |
#!/usr/bin/env python
import nose
import time
import threading
from nose.tools import eq_
from mock import MagicMock
from pylacrosse import (LaCrosse, LaCrosseSensor)
def static_vars(**kwargs):
def decorate(func):
for k in kwargs:
setattr(func, k, kwargs[k])
return func
return d... |
r"""
This file defines a codec called "mutf-8", or Modified UTF-8. This is the codec
that Java uses as an on-the-wire format for JNI and class files.
The format is a combination of CESU-8, the encoding formed by layering UTF-8 on
top of UTF-16, as well as encoding NUL (codepoint 0) as a two byte sequence.
"""
from __... |
from unittest import TestCase
from massapk import __version__
def test_version():
assert __version__ == '0.1.0'
class TestAdb(TestCase):
def test_start_server(self):
from massapk import adb
try:
adb.stop_server()
adb.start_server()
adb.stop_server()
... |
"""Template filters for Fava.
All functions in this module will be automatically added as template filters.
"""
import os
import unicodedata
from flask import g
from beancount.core import compare
from beancount.core import convert
from beancount.core import data
from beancount.core import prices
from beancount.core ... |
# -*- coding: utf-8 -*-
#
import numpy
from voropy.base import \
_base_mesh, \
_row_dot, \
compute_tri_areas_and_ce_ratios, \
compute_triangle_circumcenters
__all__ = ['MeshTri']
def _column_stack(a, b):
# http://stackoverflow.com/a/39638773/353337
return numpy.concatenate([a[... |
from builtins import str
from builtins import range
from .context import phaseflow
import fenics
import scipy.optimize as opt
T_f = 0.1
def melt_toy_pcm(output_dir = "output/test_melt_toy_pcm/",
restart = False, restart_filepath = '', start_time = 0.):
# Make the mesh.
initial_mesh_size = 1
... |
import re
import django
import core
import features
from core import tests
from features.associations import models as associations
from features.contributions import models as contributions
from features.memberships import test_mixins as memberships
def _get_adjusted_event_args(missing_keys=None, **kwargs):
""... |
from __future__ import absolute_import
from collections import OrderedDict
from conftest import EVAL, dims, time, x, y, z, skipif_yask
import numpy as np
import pytest
from devito import (clear_cache, Grid, Eq, Operator, Constant, Function,
TimeFunction, SparseFunction, Dimension, configuration)... |
from __future__ import absolute_import
from collections import OrderedDict
from conftest import EVAL, dims, time, x, y, z, skipif_yask
import numpy as np
import pytest
from devito import (clear_cache, Grid, Eq, Operator, Constant, Function,
TimeFunction, SparseFunction, Dimension, configuration)... |
# -*- coding: utf-8 -*-
"""Public section, including homepage and signup."""
import json
import urllib
try:
import urllib.request as urllib2
except ImportError:
import urllib2
from flask import (
Blueprint, request, render_template, flash,
current_app, abort, redirect
)
from flask.ext.login import c... |
# Released under The MIT License (MIT)
# http://opensource.org/licenses/MIT
# Copyright (c) 2014 SCoT Development Team
import unittest
from scot.parallel import parallel_loop
def f(x):
return x**2 - 1
def g(x, y, z):
return x**y - z
def h(x):
return x, x**2
class TestFunctions(unittest.TestCase):
... |
import re
from collections import OrderedDict
from datetime import timedelta
import scrapy
from dateutil.parser import parse as dateutil_parse
from scrapy.loader.processors import TakeFirst
from feeds.loaders import FeedEntryItemLoader
from feeds.spiders import FeedsXMLFeedSpider
def _remove_empty_headings(text, le... |
from django.test import TestCase
from mongoengine import Document, fields
from rest_framework.test import APIRequestFactory, APITestCase
from rest_framework_mongoengine.contrib.patching import Patch, PatchModelMixin
from rest_framework_mongoengine.serializers import DocumentSerializer
from rest_framework_mongoengine.v... |
from os import path
from ffflash import RELEASE, log, now, timeout
from ffflash.lib.clock import epoch_repr
from ffflash.lib.data import Element
from ffflash.lib.files import read_json_file, write_json_file
class Container:
def __init__(self, spec, filename):
self._spec = spec
self._location = pa... |
# Copyright 2015-2016 ARM Limited
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in w... |
# -*- coding: utf-8 -*-
from collections import defaultdict
import logging
import random
from .base import TestEntity, Base, BaseWithPool
from jukoro import arrow
from jukoro import pg
__all__ = ['TestQueryBuilderDescr', 'TestQueryViewBuilder']
logger = logging.getLogger(__name__)
class TestQueryBuilderDescr(B... |
from __future__ import absolute_import, division, print_function
from collections import OrderedDict
from ctd import DataFrame, Series
from ctd.utilities import Path
import matplotlib
import matplotlib.pyplot as plt
import numpy as np
from pandas import Panel
import pytest
matplotlib.use('Agg', warn=True)
data... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
test_pystamps
----------------------------------
Tests for `pystamps` module.
"""
from pystamps import pystamps
from ginga.qtw.QtHelp import QtGui, QtCore
import os
import sys
app = QtGui.QApplication.instance()
if not app:
app = QtGui.QApplication(sys.argv)
F... |
# Make sure to set configuration, needs to be before any galpy imports
import pytest
from galpy.util import config
config.__config__.set('astropy','astropy-units','True')
import numpy
from astropy import units, constants
sdf_sanders15= None #so we can set this up and then use in other tests
sdf_sanders15_nou= None #so ... |
import os
import datetime
import requests
from flask import jsonify, request
from dateutil.parser import parse
from server import app, sqldb
from penn.base import APIError
from .models import StudySpacesBooking, User
from .penndata import studyspaces
from .base import cached_route
@app.route('/studyspaces/gsr', met... |
# -*- coding: utf-8 -*-
# The MIT License (MIT)
#
# Copyright (c) 2015 Rafael Santos (rstogo@outlook.com)
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including wit... |
#! /usr/bin/env python
# runpbs_evol.py
# runs evolutionary algorithm on arm2dms model using PBS Torque in HPC
import os, sys
from numpy import mean
import csv
from random import Random
from time import time, sleep
import inspyred
import logging
from popen2 import popen2
import pickle
import multiprocessing
import Que... |
import Action
import Node
from Params import error
xsubpp_str = '${PERL} ${XSUBPP} -noprototypes -typemap ${EXTUTILS_TYPEMAP} ${SRC} > ${TGT}'
def xsubpp_file(self, node):
gentask = self.create_task('xsubpp', nice=1)
gentask.set_inputs(node)
gentask.set_outputs(node.change_ext('.c'))
cctask = self.cr... |
import DeepFried2 as df
_srng = df.th.sandbox.rng_mrg.MRG_RandomStreams()
class Dropout(df.Module):
def __init__(self, dropout):
df.Module.__init__(self)
self.dropout = dropout
def symb_forward(self, symb_input):
if self.training_mode:
shuffle_shape = (0, 1)
i... |
#!/usr/bin/env python3
# wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | sudo apt-key add -
# sudo sh -c 'echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google-chrome.list'
# apt update; apt install google-chrome-beta
import re
import os
impo... |
#!/usr/bin/env python
# -*- coding: utf-8; tab-width: 4; indent-tabs-mode: t -*-
#
# NetProfile: Entities module - Models
# © Copyright 2013-2016 Alex 'Unik' Unigovsky
#
# This file is part of NetProfile.
# NetProfile is free software: you can redistribute it and/or
# modify it under the terms of the GNU Affero General... |
#!/usr/bin/env python3
import sys
import smtplib
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText
from email.parser import Parser
from configparser import ConfigParser
from email.utils import parseaddr
from email.message import Message
#Parse config
config = ConfigParser()
config.r... |
import unittest
from robie import rankings, filehandler
class TestRankings(unittest.TestCase):
def setUp(self):
self.teams = filehandler.load_teams(path='tests/teams.txt')
schedule_items = filehandler.load_schedules(uri='tests/data.txt')
for team in self.teams:
team.load_sche... |
import os
import datetime
import requests
from flask import jsonify, request
from dateutil.parser import parse
from server import app, db, sqldb
from penn.base import APIError
from .models import StudySpacesBooking, User
from .penndata import studyspaces, wharton
from .base import cached_route
def get_wharton_sessi... |
#! /usr/bin/env python
# runpbs_evol.py
# runs evolutionary algorithm on arm2dms model using PBS Torque in HPC
import os, sys
from numpy import mean
import csv
from random import Random
from time import time, sleep
import inspyred
import logging
from popen2 import popen2
import pickle
import multiprocessing
import Que... |
import os.path
import importlib
import collections
from django.conf import settings
from .utils import get_url
from waliki.rst2html5 import HTML5Writer
def _get_default_data_dir():
settings_mod = importlib.import_module(settings.SETTINGS_MODULE)
project_dir = os.path.abspath(os.path.dirname(settings_mod.__nam... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# thumbor imaging service
# https://github.com/thumbor/thumbor/wiki
# Licensed under the MIT license:
# http://www.opensource.org/licenses/mit-license
# Copyright (c) 2011 globo.com timehome@corp.globo.com
from urllib import quote
import tempfile
import shutil
from os.path i... |
#!/usr/bin/python
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Ansible is distributed... |
import os
import sys
import pika
import math
import string
import sqlite3
import requests
import pyinotify
import subprocess
from time import time, sleep
from datetime import datetime
from random import SystemRandom
from ConfigParser import SafeConfigParser, NoOptionError, NoSectionError
from googleapiclient.errors im... |
import discord
import os
import json
import subprocess
from datetime import datetime
greetings = "Arcoex stands for **ar**bitrary **co**de **ex**ecution, and that's what this bot does! There are two ways to use me (you can use both at the same time if you want to):\n\n**1.** Mention me among with the language of the c... |
# Copyright (c) 2017 NEC Corp.
# 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... |
#!/usr/bin/env python3
import sys
import smtplib
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText
from email.parser import Parser
from configparser import ConfigParser
from email.utils import parseaddr
#Parse config
config = ConfigParser()
config.read('/home/fonorobert/scripts/mailf... |
from json import loads as json_loads, dumps as json_dumps
from sanic import Sanic
from sanic.response import json, text, redirect
from sanic.utils import sanic_endpoint_test
from sanic.exceptions import ServerError
import pytest
# ------------------------------------------------------------ #
# GET
# ---------------... |
"""
This is a set of RPC calls using the ZeroRPC library. This is used by the
tonetrainer web project to call Pyrapt's RAPT functionality for use in showing
vocal pitch. See the tonetrainer github repo for more details:
https://github.com/dgaspari/tonetrainer
"""
import zerorpc
from pyrapt import pyrapt
class Pyrapt... |
# The MIT License (MIT)
#
# Copyright (c) 2017 Scott Shawcroft for Adafruit Industries.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# (c) 2012, Mark Theunissen <mark.theunissen@gmail.com>
# Sponsored by Four Kitchens http://fourkitchens.com.
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as publishe... |
# -*- coding: utf-8 -*-
'''
Test the django module
'''
# Import Salt Testing libs
from salttesting import skipIf
from salttesting.helpers import ensure_in_syspath
from salttesting.mock import NO_MOCK, NO_MOCK_REASON, MagicMock, patch
ensure_in_syspath('../../')
# Import salt libs
import integration
from salt.modules ... |
# coding: utf8
"""
weasyprint.draw
---------------
Take an "after layout" box tree and draw it onto a cairo surface.
:copyright: Copyright 2011-2012 Simon Sapin and contributors, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
from __future__ import division, unicode_literals
import co... |
import math
from nose.tools import *
import networkx as nx
from networkx.exception import *
class TestResourceAllocationIndex():
def setUp(self):
self.func = nx.resource_allocation_index
def test_func(G, u, v, expected):
tol = 1e-7
result = self.func(G, u, v)
... |
import os
import unittest
from pyramid import testing
from pyramid.config import Configurator
from .base import DATA_DIR
from .resource import BOOKS
class ResourceFunctionalTests(unittest.TestCase):
def setUp(self):
settings = {
'pyramid_raml.apidef_path': os.path.join(DATA_DIR, 'test-api.... |
#!/usr/bin/env python2
from weboob.core import Weboob
from weboob.core.modules import ModuleLoadError
from weboob.exceptions import BrowserIncorrectPassword, BrowserPasswordExpired
from weboob.tools.backend import Module
import json
import os
import sys
import traceback
DATETIME_FORMAT = "%Y-%m-%dT%H:%M:%SZ"
# cwd ... |
#!/usr/bin/env python
import os
import sys
from optparse import OptionParser
from wsgiref.simple_server import make_server, WSGIServer, WSGIRequestHandler
CONFIG = 'tilelite.cfg'
MAP_FROM_ENV = 'MAPNIK_MAP_FILE'
parser = OptionParser(usage="""
python liteserv.py <mapfile.xml> [options]
""")
parser.add_o... |
#!/usr/bin/python3
from PyQt5 import QtCore, QtGui, QtWidgets
import ui
class Ui_window(ui.Ui_main_window):
def __init__(self,main_window):
super().__init__(main_window)
# Add list of Serial Port to serial_port object of Combo Box
def add_serial_port(self, list_serial):
# Add it
... |
#!/usr/bin/env python
from datetime import datetime
from functools import partial
import logging
import re
import sys
from xml.etree import ElementTree
import argparse
from BeautifulSoup import BeautifulSoup, NavigableString
import django
from django.contrib.auth.models import User
import giraffe.friends.models
from... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Weather cli - Weather from the command line
Basically the script checks your ip, geolocate the ip and
checks the weather based on that information, so cool!
"""
import os
import sys
import ConfigParser
import requests
from requests.exceptions import ConnectionError
imp... |
import getpass
import logging
import os
import re
import sys
import textwrap
import xmlrpclib
from ConfigParser import ConfigParser
from datetime import datetime
try:
from docutils.core import publish_parts
except ImportError:
print >> sys.stderr, \
'docutils is required to convert the PyFITS chang... |
#!/usr/bin/env python
import pytest
from mock import mock_open, patch
from aubreylib import resource
def generate_creator_list(num_creators, creator_type, name):
return [
{'content': {'type': creator_type, 'name': name}}
for _ in range(num_creators)
]
class TestGetAuthorCitationString():
... |
#!/usr/bin/env python2
from weboob.core import Weboob
from weboob.core.modules import ModuleLoadError
from weboob.exceptions import BrowserIncorrectPassword, BrowserPasswordExpired
from weboob.tools.backend import Module
from weboob.capabilities.base import empty
import json
import os
import sys
import traceback
from... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.