code stringlengths 1 199k |
|---|
from .command import main
main() |
"""
This module contains the base class for all the Entry classes. The
EntryBase class is essentially the API for entries in Pyblosxom. Reading
through the comments for this class will walk you through building your
own EntryBase derivatives.
This module also holds a generic generate_entry function which will generat... |
import msgpack, zlib, StringIO
import matplotlib.pyplot as plt, numpy as np, CoolProp
user_paths = [r'C:\Users\Belli',r'C:\Users\jowr']
with open(user_paths[1]+r'\.CoolProp\Tables\HelmholtzEOSBackend(Water[1.0000000000])/single_phase_logpT.bin.z','rb') as fp:
ph = zlib.decompress(fp.read())
values = msgpack.loa... |
from __future__ import print_function
import os
import subprocess
import sys
SOURCE_ROOT = os.path.abspath(
os.path.dirname(os.path.dirname(os.path.dirname(__file__))))
VENDOR_DIR = os.path.join(SOURCE_ROOT, 'vendor')
PYYAML_LIB_DIR = os.path.join(VENDOR_DIR, 'pyyaml', 'lib')
sys.path.append(PYYAML_LIB_DIR)
import ... |
from distutils.core import setup
from catkin_pkg.python_setup import generate_distutils_setup
d = generate_distutils_setup(
packages=['exploration_tasks_generator'],
package_dir={'': 'src'}
)
setup(**d) |
from django.conf.urls import patterns, url
from django.utils.translation import ugettext_lazy as _
from .views import UserProfileUpdate, UserProfileDetail
urlpatterns = patterns('',
url(_(r'^update$'), UserProfileUpdate.as_view(),
name='profiles_userprofile_update'),
url(_(r'^show/(?P<username>[\w.@+-]+... |
"""
Implements gamma_function().
"""
import math
from .factorial import factorial
def calculate_gamma_pdf(x):
"""
Helper function to calculate Gamma PDF for value x.
"""
first_part = math.sqrt(2 * math.pi / x)
second_part = pow((1 / math.e) * (x + (1 / ((12*x) - (1/10*x)))), x)
return(first_part... |
from aubio import filterbank, fvec
from pylab import loglog, show, xlim, ylim, xlabel, ylabel, title
from numpy import vstack, arange
win_s = 2048
samplerate = 48000
freq_list = [60, 80, 200, 400, 800, 1600, 3200, 6400, 12800, 24000]
n_filters = len(freq_list) - 2
f = filterbank(n_filters, win_s)
freqs = fvec(freq_list... |
import os
import stat
VERSION="0.1.2"
def list_scripts(directory):
scripts = []
executable = stat.S_IEXEC | stat.S_IXGRP | stat.S_IXOTH
for file in os.listdir(directory):
filename = os.path.join(directory, file)
if os.path.isfile(filename):
st = os.stat(filename)
mode... |
"""
This package contains datatypes used for testing purposes.
"""
__all__ = ["datatype1", "datatype2"] |
"""Encriptación de archivos
Revision ID: 1f38671f53c3
Revises: 4312431622eb
Create Date: 2015-11-01 19:36:09.819480
"""
revision = '1f38671f53c3'
down_revision = '4312431622eb'
from alembic import op
import sqlalchemy as sa
def upgrade():
### commands auto generated by Alembic - please adjust! ###
op.create_tab... |
import datetime
import time
from pysqlite2._sqlite import *
paramstyle = "qmark"
threadsafety = 1
apilevel = "2.0"
Date = datetime.date
Time = datetime.time
Timestamp = datetime.datetime
def DateFromTicks(ticks):
return apply(Date, time.localtime(ticks)[:3])
def TimeFromTicks(ticks):
return apply(Time, time.loc... |
from CUBRIDPy.CUBRIDConnection import *
import logging
logging.root.setLevel(logging.INFO)
logging.info('Executing test: %s...' % __file__)
conn = CUBRIDConnection()
conn.connect()
try:
tables = conn.schema_info('tables')
assert len(tables) == 34
assert tables[0][0] == 'db_collation'
assert tables[0].na... |
from __future__ import print_function
"""This is websubmit_file_stamper.py
This tool is used to create a stamped version of a PDF file.
+ Python API:
Please see stamp_file().
+ CLI API:
$ python ~invenio/lib/python/invenio/websubmit_file_stamper.py \\
--latex-template=demo-stamp-left.te... |
"""
Test analysis package
"""
__copyright__ = \
"""
Copyright (C) 2010-2015 Oracle Corporation
This file is part of VirtualBox Open Source Edition (OSE), as
available from http://www.virtualbox.org. This file is free software;
you can redistribute it and/or modify it under the terms of the GNU
General Public License (G... |
"""Example of how to extend the search list used by the Cheetah generator.
*******************************************************************************
This search list extension offers two extra tags:
'alltime': All time statistics.
For example, "what is the all time high temperature?"
's... |
"""
std library stuff
"""
arr = ['']
sorted(arr)[0]
next(reversed(arr))
next(open(''))
import re
c = re.compile(r'a')
c.startswith
c.match().start()
re.match(r'a', 'a').start()
for a in re.finditer('a', 'a'):
#? int()
a.start()
re.sub('a', 'a')
import weakref
weakref.proxy(1)
weakref.ref(1)
weakref.ref(1)()
imp... |
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import sys
import copy
from ansible import constants as C
from ansible.module_utils.basic import AnsibleFallbackNotFound
from ansible.module_utils.eos import ARGS_DEFAULT_VALUE, eos_argument_spec
from ansible.module_utils.six import... |
import sys, os
extensions = []
templates_path = ['_templates']
source_suffix = '.rst'
master_doc = 'index'
project = u'MongoDB C Driver'
copyright = u'2011, 10gen'
version = '0.4'
release = '0.4'
exclude_patterns = []
pygments_style = 'sphinx'
html_static_path = ['_static']
htmlhelp_basename = 'MongoDBCDriverdoc'
latex... |
"""
Packager Module: Dummy Packager
"""
from pybombs.packagers.base import PackagerBase
from pybombs import pb_logging
class Dummy(PackagerBase):
name = 'dummy'
"""
This isn't really a packager, this is just a dummy load
for testing functions that require packagers.
"""
def __init__(self):
... |
"""
Script used to start the Test Interface from MantidPlot
"""
from ui.poldi import poldi_gui
ui = poldi_gui.PoldiGui()
if ui.setup_layout():
ui.show() |
import frappe
from erpnext.accounts.utils import check_and_delete_linked_reports
def execute():
reports_to_delete = ["Requested Items To Be Ordered",
"Purchase Order Items To Be Received or Billed","Purchase Order Items To Be Received",
"Purchase Order Items To Be Billed"]
for report in reports_to_delete:
if fr... |
import os
from os.path import dirname, join, normpath, realpath, isdir
import sys
script_directory = dirname(realpath(sys.argv[0]))
root_directory = join(script_directory, '..')
root_directory = normpath(root_directory)
elections_directory = join(root_directory, 'elections')
election_options = [
e for e in os.listd... |
from django.views.generic import DetailView
from braces.views import LoginRequiredMixin
from .models import (
Result, Assumption, Indicator, SubIndicator, Target, Milestone, RiskRating
)
from .api import ResultSerializer
from .mixins import AptivateDataBaseMixin
class ResultEditor(LoginRequiredMixin, AptivateDataBa... |
import django.db.models.deletion
import django.utils.timezone
import model_utils.fields
import opaque_keys.edx.django.models
import simple_history.models
from django.conf import settings
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('student', '0001_squash... |
import yaml
def parse_checkmate_settings(content):
"""
Currently we only parse the YAML file. In the future we might perform additional checks.
"""
output = yaml.load(content)
return output |
from django.http import Http404
from django.shortcuts import get_object_or_404 as _get_object_or_404
def get_object_or_404(queryset, *filter_args, **filter_kwargs):
"""
Same as Django's standard shortcut, but make sure to raise 404
if the filter_kwargs don't match the required types.
"""
try:
... |
"""
course_overview api tests
"""
from mock import patch
from django.http.response import Http404
from opaque_keys.edx.keys import CourseKey
from openedx.core.djangoapps.catalog.tests.factories import CourseRunFactory
from openedx.core.djangoapps.content.course_overviews.models import CourseOverview
from openedx.core.d... |
"""Deprecated import support. Auto-generated by import_shims/generate_shims.sh."""
from import_shims.warn import warn_deprecated_import
warn_deprecated_import('course_blocks', 'lms.djangoapps.course_blocks')
from lms.djangoapps.course_blocks import * |
import project_work_type |
import glob
import sys
from nose.tools import *
from utilities import execution_path
import os, mapnik
default_logging_severity = mapnik.logger.get_severity()
def setup():
# make the tests silent since we intentially test error conditions that are noisy
mapnik.logger.set_severity(mapnik.severity_type.None)
... |
import hashlib
import sys
from typing import Any, Callable, Dict # novm
import llnl.util.tty as tty
hashes = {
'md5': 16,
'sha1': 20,
'sha224': 28,
'sha256': 32,
'sha384': 48,
'sha512': 64
}
_size_to_hash = dict((v, k) for k, v in hashes.items())
_deprecated_hash_algorithms = ['md5']
_hash_func... |
from spack import *
class Exabayes(AutotoolsPackage):
"""ExaBayes is a software package for Bayesian tree inference. It is
particularly suitable for large-scale analyses on computer clusters."""
homepage = "https://sco.h-its.org/exelixis/web/software/exabayes/"
url = "https://sco.h-its.org/exeli... |
import time
import zmq
import logging
logger = logging.getLogger(__name__)
class PyrePeer(object):
PEER_EXPIRED = 30 # expire after 10s
PEER_EVASIVE = 10 # mark evasive after 5s
def __init__(self, ctx, identity):
# TODO: what to do with container?
self._ctx = ctx ... |
from mailroom_for_testing import check_if_donor
from mailroom_for_testing import create_a_report
def test_check_if_not_donor():
assert not check_if_donor('Jack Hefner')
assert not check_if_donor('012345')
assert not check_if_donor(12345)
def test_check_if_donor():
assert check_if_donor('Zapp Brannigan')... |
from django.views.generic.detail import DetailView
from article.models import Article
class ArticleDetailView(DetailView):
model = Article
template_name = 'article/details.html' |
"""Support for displaying minimal, maximal, mean or median values."""
import logging
import voluptuous as vol
from homeassistant.components.sensor import PLATFORM_SCHEMA, SensorEntity
from homeassistant.const import (
ATTR_UNIT_OF_MEASUREMENT,
CONF_NAME,
CONF_TYPE,
STATE_UNAVAILABLE,
STATE_UNKNOWN,
... |
try:
import config
except ImportError:
print("Please copy template-config.py to config.py and configure appropriately !"); exit();
debug_communication=0
try:
# for Python2
from Tkinter import *
except ImportError:
# for Python3
from tkinter import *
import json
import time
import urllib3
def send_to_h... |
conf = {}
def ConfigureMonitoring(_conf):
if _conf is not None:
conf.update(_conf)
def GetMonitoringConfig():
return conf |
"""Functional test for learning rate decay."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from tensorflow.python.framework import dtypes
from tensorflow.python.framework import test_util
from tensorflow.python.ops import state_ops
from tensorflow.python.... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from tensorflow.python.framework import dtypes
from tensorflow.python.framework import random_seed
from tensorflow.python.ops import array_ops
from tensorflow.python.ops.linalg import linalg as linalg_lib
from t... |
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('main', '0063_v350_org_host_limits'),
]
operations = [
migrations.CreateModel(
name='TowerAnalyticsState',
fields=[
... |
"""Constants for the network integration."""
from __future__ import annotations
from typing import Final
import voluptuous as vol
import homeassistant.helpers.config_validation as cv
DOMAIN: Final = "network"
STORAGE_KEY: Final = "core.network"
STORAGE_VERSION: Final = 1
ATTR_ADAPTERS: Final = "adapters"
ATTR_CONFIGURE... |
"""Application base class.
"""
import itertools
import logging
import logging.handlers
import shlex
import cmd2
LOG = logging.getLogger(__name__)
class InteractiveApp(cmd2.Cmd):
"""Provides "interactive mode" features.
Refer to the cmd2_ and cmd_ documentation for details
about subclassing and configuring t... |
from oslo_config import cfg
upgrade_group = cfg.OptGroup('upgrade_levels',
title='Upgrade levels Options')
rpcapi_cap_cells_opt = cfg.StrOpt('cells',
help="""
Cells version
Cells client-side RPC API version. Use this option to set a version
cap for messages sent to local cells services.
Possible values:... |
"""
pygments.formatters.pangomarkup
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Formatter for Pango markup output.
:copyright: Copyright 2006-2021 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
from pygments.formatter import Formatter
__all__ = ['PangoMarkupFormatter']
_escape_ta... |
from __future__ import absolute_import
from __future__ import division
from fp16.avx import fp16_alt_xmm_to_fp32_xmm
from fp16.avx2 import fp16_alt_xmm_to_fp32_ymm
simd_width = YMMRegister.size // float_.size
for fusion_factor in range(1, 8 + 1):
arg_x = Argument(ptr(const_float_), "x")
arg_y = Argument(ptr(const_flo... |
import os
from PIL import Image
from django.conf import settings
from django.db import models
from django.utils.translation import ugettext_lazy as _
from paperclip.models import FileType as BaseFileType
from geotrek.authent.models import StructureRelated
from geotrek.common.mixins import PictogramMixin, OptionalPictog... |
from django.core.management import BaseCommand
from ...google_merchant import update_feed
class Command(BaseCommand):
help = 'Update Google merchant feed'
def handle(self, *args, **options):
update_feed() |
"""
Provides generic deployment steps for machines post boot.
"""
from __future__ import with_statement
import os
import binascii
from libcloud.utils.py3 import basestring
class Deployment(object):
"""
Base class for deployment tasks.
"""
def run(self, node, client):
"""
Runs this deploy... |
import ecto
import sys
HAS_GUI=False
try:
from PySide.QtCore import QTimer, Qt
from PySide.QtGui import QWidget, QDialog, QPushButton, QApplication, QCheckBox, \
QVBoxLayout, QLabel, QHBoxLayout, QLineEdit, QScrollArea, QMainWindow, QSizePolicy, \
QSpacerItem
HAS_GUI=True
class TendrilWidget(Q... |
"""
Several basic tests for hierarchical clustering procedures
"""
import itertools
from tempfile import mkdtemp
import shutil
import pytest
from functools import partial
import numpy as np
from scipy import sparse
from scipy.cluster import hierarchy
from scipy.sparse.csgraph import connected_components
from sklearn.me... |
"""
HTTPie - a CLI, cURL-like tool for humans.
"""
__author__ = 'Jakub Roztocil'
__version__ = '0.9.0-dev'
__licence__ = 'BSD'
class ExitStatus:
"""Exit status code constants."""
OK = 0
ERROR = 1
ERROR_TIMEOUT = 2
# Used only when requested with --check-status:
ERROR_HTTP_3XX = 3
ERROR_HTTP_... |
import os, tempfile
from multiprocessing import Process, Queue, cpu_count
from whoosh.compat import xrange, iteritems, pickle
from whoosh.codec import base
from whoosh.filedb.filewriting import PostingPool, SegmentWriter
from whoosh.support.externalsort import imerge
def finish_subsegment(writer, k=64):
# Tell the ... |
""" A module that displays the outline for the given data, either as a
box, or the corners of the bounding box.
"""
from traits.api import Instance, Enum, Property, Bool, \
DelegatesTo
from traitsui.api import View, Group, Item
from tvtk.api import tvtk
from tvtk.common import is_old_pipeline
from mayavi.core.m... |
"""
utils.py
Created by Thomas Mangin on 2009-09-06.
Copyright (c) 2009-2015 Exa Networks. All rights reserved.
"""
import os
import sys
import stat
import time
import syslog
import logging
import logging.handlers
from exabgp.protocol.family import AFI
from exabgp.protocol.family import SAFI
from exabgp.util.od import ... |
from __future__ import absolute_import, division, print_function
import numbers
import toolz
import inspect
from toolz import unique, concat, compose, partial
import toolz
from pprint import pprint
from ..compatibility import StringIO, _strtypes, builtins
from ..dispatch import dispatch
__all__ = ['Node', 'path', 'comm... |
import wx
import generic_class
from .constants import control, dtype, substitution_map
import os
import yaml
import modelDesign_window
ID_RUN = 11
class ModelConfig(wx.Frame):
# this creates the wx.Frame mentioned above in the class declaration
def __init__(self, parent, gpa_settings=None):
wx.Frame.__i... |
"""A wrapper for stored_object that separates internal and external."""
from __future__ import print_function
from __future__ import division
from __future__ import absolute_import
from google.appengine.ext import ndb
from dashboard.common import datastore_hooks
from dashboard.common import stored_object
@ndb.synctaskl... |
from rest_framework import serializers
class InboxSerializer(serializers.Serializer):
id = serializers.CharField()
message = serializers.CharField()
level = serializers.IntegerField()
tags = serializers.CharField()
date = serializers.DateTimeField(format=None)
url = serializers.URLField(required... |
"""
===========
Basic Units
===========
"""
import math
import numpy as np
import matplotlib.units as units
import matplotlib.ticker as ticker
class ProxyDelegate:
def __init__(self, fn_name, proxy_type):
self.proxy_type = proxy_type
self.fn_name = fn_name
def __get__(self, obj, objtype=None):
... |
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('hs_core', '0013_auto_20151114_2314'),
]
operations = [
migrations.AlterField(
model_name='relation',
name='type',
fie... |
import math
import random
import re
import sys
from hashlib import sha1
from flask import abort
from flask import render_template
from flask import request
from peewee import DoesNotExist
from peewee import ForeignKeyField
from peewee import Model
from peewee import SelectQuery
from flask_peewee._compat import text_typ... |
import sys
import time
from twisted.trial import unittest
from twisted.internet import defer
from buildbot.schedulers import timed
from buildbot.test.util import scheduler
from buildbot.test.util import config
class NightlyBase(scheduler.SchedulerMixin, unittest.TestCase):
"""detailed getNextBuildTime tests"""
... |
"""
Prints the rev_id, characters and hash of all revisions to Willy_on_Wheels.
"""
import getpass
import hashlib
import os
import sys
try:
sys.path.insert(0, os.path.abspath(os.getcwd()))
from mw import api
except: raise
api_session = api.Session("https://en.wikipedia.org/w/api.php")
print("(EN) Wikipedia cred... |
import io
import socket
import datetime
import textwrap
import unittest
import functools
import contextlib
from test import support
from nntplib import NNTP, GroupInfo
import nntplib
try:
import ssl
except ImportError:
ssl = None
TIMEOUT = 30
class NetworkedNNTPTestsMixin:
def test_welcome(self):
we... |
from json import load
from collections import OrderedDict
from os.path import splitext, dirname, join
locals().update(load(open('%s.json' % splitext(__file__)[0], 'rb'), object_pairs_hook=OrderedDict))
filename = join(dirname(__file__), filename) |
"""Compilers for Nikola.""" |
from . import base
from .generic_poll_text import GenPollUrl
import locale
_DEFAULT_CURRENCY = str(locale.localeconv()['int_curr_symbol'])
class BitcoinTicker(GenPollUrl):
"""
A bitcoin ticker widget, data provided by the coinbase.com API. Defaults to
displaying currency in whatever the current locale is. E... |
import chainer
from chainer.dataset.tabular import tabular_dataset
def from_data(data, *, size=None):
"""Create a TabularDataset from lists/arrays/callables.
>>> from chainer.dataset import tabular
>>>
>>> dataset = tabular.from_data([0, 1, 2])
>>> dataset[0]
0
>>> dataset = tabular.from_dat... |
"""Test to verify that Home Assistant core works."""
import os
import signal
import unittest
from unittest.mock import patch
import time
import threading
from datetime import datetime, timedelta
import pytz
import homeassistant.core as ha
from homeassistant.exceptions import (
HomeAssistantError, InvalidEntityForma... |
import os, subprocess
import logging
from autotest.client import test
from autotest.client.shared import error
class libogg(test.test):
"""
Autotest module for testing basic functionality
of libogg
@author Hariharan T.S. <harihare@in.ibm.com> ##
"""
version = 1
... |
import getopt
from gobject import *
import gtk
from tracecmd import *
import time
app = None
data_func_cnt = 0
TS_COL_W = 150
CPU_COL_W = 35
EVENT_COL_W = 150
PID_COL_W = 75
COMM_COL_W = 250
def timing(func):
def wrapper(*arg):
start = time.time()
ret = func(*arg)
end = time.time()
pri... |
import dj_database_url
import os
PROJECT_DIR = os.path.dirname(__file__)
DEBUG = True
TEMPLATE_DEBUG = DEBUG
ADMINS = ( ('Saymon Pires', 'piresaymon@gmail.com'),
# ('Your Name', 'your_email@example.com'),
)
DEFAULT_CHARSET = 'utf-8'
MANAGERS = ADMINS
#'ENGINE': 'django.db.backends.', # Add 'postgresql_psyco... |
"""Test suite for our zeromq-based message specification."""
import re
import sys
from distutils.version import LooseVersion as V
try:
from queue import Empty # Py 3
except ImportError:
from Queue import Empty # Py 2
import nose.tools as nt
from IPython.utils.traitlets import (
HasTraits, TraitError, Bool... |
import mock
import re
import xml.dom.minidom
from boto.exception import BotoServerError
from boto.route53.connection import Route53Connection
from boto.route53.exception import DNSServerError
from boto.route53.healthcheck import HealthCheck
from boto.route53.record import ResourceRecordSets, Record
from boto.route53.zo... |
from weboob.browser import PagesBrowser, URL
from .pages import SearchPage
class DHLBrowser(PagesBrowser):
BASEURL = 'http://nolp.dhl.de'
search_page = URL('/nextt-online-public/set_identcodes.do\?lang=en&idc=(?P<id>.+)', SearchPage)
def get_tracking_info(self, _id):
return self.search_page.go(id=_i... |
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
db.rename_column('survey_surveyuser', 'oneuser_id', 'user_id')
def backwards(self, orm):
db.rename_column('survey_surveyuser', 'use... |
from blending.src.maker.base_maker import BaseMaker
from blending.src.connector.connect_util import *
from blending.util.blending_config import BlendConfig
from blending.util.blending_error import blending_status
__author__ = 'DongMin Kim'
class MakeSimple(BaseMaker):
"""Make new blend atoms from inputs.
"""
... |
{ 'sequence': 500,
"name" : "Account Payment Extension - DO NOT INSTALL along with c2c_account_payment_extension_chricar"
, "version" : "1.1"
, "author" : "Zikzakmedia SL"
, "category" : "Generic Modules/Accounting"
, "website" : "www.zikzakmedia.com"
, "license" : "GPL-3"
, "description": """Account payment extension.... |
"""
Tree Walker from DOM Level 2. Allows multi-directional iteration over nodes.
WWW: http://4suite.com/4DOM e-mail: support@4suite.com
Copyright (c) 2000 Fourthought Inc, USA. All Rights Reserved.
See http://4suite.com/COPYRIGHT for license and copyright information
"""
from NodeFilter import NodeFilter
f... |
from CTFd.config import TestingConfig
from tests.helpers import create_ctfd, destroy_ctfd, login_as_user, register_user
def test_reverse_proxy_config():
"""Test that REVERSE_PROXY configuration behaves properly"""
class ReverseProxyConfig(TestingConfig):
REVERSE_PROXY = "1,2,3,4"
app = create_ctfd(c... |
"""
parsedatetime/context.py
Context related classes
"""
from threading import local
class pdtContextStack(object):
"""
A thread-safe stack to store context(s)
Internally used by L{Calendar} object
"""
def __init__(self):
self.__local = local()
@property
def __stack(self):
if... |
"""
Implementation of JSONEncoder
"""
import re
try:
from simplejson import _speedups
except ImportError:
_speedups = None
ESCAPE = re.compile(r'[\x00-\x19\\"\b\f\n\r\t]')
ESCAPE_ASCII = re.compile(r'([\\"/]|[^\ -~])')
ESCAPE_DCT = {
# escape all forward slashes to prevent </script> attack
'/': '\\/',
... |
'''
A place for some no-brainer basics :)
'''
from PyQt5 import QtCore
from PyQt5.QtWidgets import *
class BasicTreeView(QTreeView):
def __init__(self, parent=None):
QTreeView.__init__(self, parent=parent)
self.setAlternatingRowColors( True )
self.setSortingEnabled( True )
def setModel(s... |
import os, sys, json, flickrapi, codecs, urllib.request, urllib.parse, urllib.error
def callTheApi(api_key, seed, per_page_num):
#This calls the API with a search term or 'seed'
flickr = flickrapi.FlickrAPI(api_key)
json_photos = json.loads(flickr.photos_search(text=seed, \
per_page=str(per_page_num), format = 'jso... |
config = {
'CONTEXT': 'We are in TestFrontend context',
'IntanceType': 'medium',
'InstanceMin': '2',
'InstanceMax': '6',
'ServiceVersion': 'v3.65'
} |
import datetime
import mock
from oslo_config import cfg
from oslo_db import exception as db_exc
import oslo_messaging
from webob import exc
from neutron.api import extensions
from neutron.api.rpc.agentnotifiers import dhcp_rpc_agent_api
from neutron.api.rpc.handlers import dhcp_rpc
from neutron.api.rpc.handlers import ... |
import os
import subprocess
import sys
import pytest
import pyarrow as pa
def test_get_include():
include_dir = pa.get_include()
assert os.path.exists(os.path.join(include_dir, 'arrow', 'api.h'))
@pytest.mark.skipif('sys.platform != "win32"')
def test_get_library_dirs_win32():
assert any(os.path.exists(os.p... |
"""
Executes applied command periodically while Space Navigator isn't touched.
It can be used to add screensaver-ish application to Liquid Galaxy.
"""
import fcntl
import os
import sys
import time
import statsd
import subprocess
def checkConfig( key ):
conf = subprocess.Popen( ['/home/lg/bin/lg-config', key], stdout=... |
"""Config flow to configure forked-daapd devices."""
from contextlib import suppress
import logging
from pyforked_daapd import ForkedDaapdAPI
import voluptuous as vol
from homeassistant import config_entries
from homeassistant.components import zeroconf
from homeassistant.const import CONF_HOST, CONF_NAME, CONF_PASSWOR... |
from __future__ import absolute_import
from datetime import date, datetime # noqa: F401
from typing import List, Dict # noqa: F401
from tapi_server.models.base_model_ import Model
from tapi_server.models.tapi_common_admin_state_pac import TapiCommonAdminStatePac # noqa: F401,E501
from tapi_server.models.tapi_common_... |
import functools
from framework.auth import Auth
from website.archiver import (
StatResult, AggregateStatResult,
ARCHIVER_NETWORK_ERROR,
ARCHIVER_SIZE_EXCEEDED,
ARCHIVER_FILE_NOT_FOUND,
)
from website.archiver.model import ArchiveJob
from website import (
mails,
settings
)
def send_archiver_size... |
from __future__ import generators
from binascii import b2a_hex
from struct import pack, unpack
from BitTorrent.RawServer_magic import Handler
from BitTorrent.bitfield import Bitfield
from BitTorrent.obsoletepythonsupport import *
def toint(s):
return unpack("!i", s)[0]
def tobinary(i):
return pack("!i", i)
CHOK... |
"""Tests for initializers in init_ops."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import numpy as np
from tensorflow.core.protobuf import config_pb2
from tensorflow.python.client import session
from tensorflow.python.eager import context
from tensorfl... |
from vtk import *
import os.path
data_dir = "../../../../VTKData/Data/Infovis/SQLite/"
if not os.path.exists(data_dir):
data_dir = "../../../../../VTKData/Data/Infovis/SQLite/"
if not os.path.exists(data_dir):
data_dir = "../../../../../../VTKData/Data/Infovis/SQLite/"
sqlite_file = data_dir + "temperatures.db"
dat... |
from __future__ import absolute_import
import math
import os.path
import requests
try:
from cStringIO import StringIO
except ImportError:
from StringIO import StringIO
import numpy as np
import PIL.Image
import scipy.misc
from . import is_url, HTTP_TIMEOUT, errors
SUPPORTED_EXTENSIONS = ('.png', '.jpg', '.jpeg'... |
"""
==================================================
Plot different SVM classifiers in the iris dataset
==================================================
Comparison of different linear SVM classifiers on the iris dataset. It
will plot the decision surface for four different SVM classifiers.
"""
print(__doc__)
import... |
from antlr4.IntervalSet import IntervalSet
from antlr4.Token import Token
from antlr4.atn.ATNState import ATNState
from antlr4.error.Errors import NoViableAltException, InputMismatchException, FailedPredicateException, ParseCancellationException
class ErrorStrategy(object):
def reset(self, recognizer):
pass... |
__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
"""
Verify the error when the run command is passed no arguments.
"""
import TestSCons_time
test = TestSCons_time.TestSCons_time()
expect = """\
scons-time: run: No arguments or -f config file specified.
Type "scons-time help run" for help.
"""
t... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.