content stringlengths 4 20k |
|---|
#!/usr/bin/env python
import sys,os
sys.path.append(os.path.join(os.path.dirname(os.path.abspath(__file__)),"../python"))
import cProfile
from PySide.QtCore import *
from PySide.QtGui import *
import numpy as np
import cv2
import sys
import pyopencl as cl
from gazetools import *
class Image(QLabel):
mousePress... |
# -*- coding: utf-8 -*-
"""
sphinx.util.docfields
~~~~~~~~~~~~~~~~~~~~~
"Doc fields" are reST field lists in object descriptions that will
be domain-specifically transformed to a more appealing presentation.
:copyright: Copyright 2007-2011 by the Sphinx team, see AUTHORS.
:license: BSD, see LI... |
import claudio
import librosa
import logging
import numpy as np
import os
import pandas as pd
import scipy.signal as sig
import shutil
import minst.hll as H
import minst.utils as utils
logger = logging.getLogger(__name__)
def hll_onsets(filename, mfilt_len=51, threshold=0.5, wait=100):
time_points, freqs, amps ... |
import sys
import re
import os
import shutil
import commands
"""Copy Special exercise
"""
# +++your code here+++
# Write functions and modify main() to call them
def get_special_paths(dir):
filenames = os.listdir(dir)
special_paths = []
for filename in filenames:
if re.search(r'__\w+__', filename):
s... |
from flask import Flask, render_template
import views, config
app = Flask(__name__)
app.config.from_object('config.Config')
app.add_url_rule('/', view_func=views.index)
app.add_url_rule('/users/<user_id>/', view_func=views.users)
#app.add_url_rule('/key', view_func=views.key)
#app.add_url_rule('/audit', view_func=vi... |
{
'name': 'Modifica Vistas Account',
'version': '0.1',
'author': '[OpenDrive Ltda]',
'website': '[http://www.opendrive.cl]',
'category': 'Localization',
'description': """ """,
'depends': ['base','account'],
'data' : [
'account_views.xml'
],
'css': [
... |
"""
Tests For CellStateManager
"""
import datetime
import time
import mock
from oslo_config import cfg
from oslo_db import exception as db_exc
from oslo_utils import timeutils
import six
from jacket.compute.cells import state
from jacket.db.compute.sqlalchemy import models
from jacket.compute import exception
from j... |
from __future__ import absolute_import
import logging
import os
from debian import deb822
from debian.debian_support import version_compare
# supported compression formats for Sources files. Order does matter: formats
# appearing early in the list will be preferred to those appearing later
SOURCES_COMP_FMTS = ['gz',... |
"""
********************************************************************************
* Name: base.py
* Authors: Nathan Swain and Ezra Rice
* Created On: May 2015
* Copyright: (c) Brigham Young University 2015
* License: BSD 2-Clause
********************************************************************************
"""
im... |
"permutation-type operations for sequences"
def permute(list):
if not list: # shuffle any sequence
return [list] # empty sequence
else:
res = []
for i in range(len(list)):
rest = list[:i] + list... |
from essentia_test import *
class TestZeroCrossingRate(TestCase):
def testEmpty(self):
input = []
self.assertComputeFails(ZeroCrossingRate(), input)
def testZero(self):
input = [0]*100
self.assertAlmostEqual(ZeroCrossingRate()(input), 0)
def testOne(self):
input =... |
import json
import cryptography.fernet
from django.conf import settings
from django_pgjson.fields import get_encoder_class
# Allow the use of key rotation
if isinstance(settings.FIELD_ENCRYPTION_KEY, (tuple, list)):
keys = [
cryptography.fernet.Fernet(k)
for k in settings.FIELD_ENCRYPTION_KEY
... |
from random import randint
from bsp_map_generator import generate_map
from settings import MAP_HEIGHT, MAP_WIDTH, MAX_ROOM_MONSTERS, MAX_ROOM_ITEMS
from objects import Hobo, Bandit, Dog, StoneFloor, StoneWall, Medkit
class Map:
def __init__(self, height, width):
self.height = height
self.width ... |
from markdown import markdown
from pymongo import MongoClient
from controllers.utils import oid
TOOL_PROD = 'https://dariah-beta.dans.knaw.nl'
TOOL_DEV = 'http://127.0.0.1:8080'
TOOL = TOOL_PROD
MONGO = None
COORD = 'coord'
POWER = {'office', 'system', 'root'}
def dbAccess():
clientm = MongoClient()
global MON... |
"""A timer class.
"""
from __future__ import print_function
from datetime import datetime
class Timer(object):
"""A class for measuring elapsed time.
A Timer object measures elapsed real time since a specified time, which
by default is the time of the creation of the Timer.
Parameters:
- `sta... |
"""
WSGI config for postalware project.
This module contains the WSGI application used by Django's development server
and any production WSGI deployments. It should expose a module-level variable
named ``application``. Django's ``runserver`` and ``runfcgi`` commands discover
this application via the ``WSGI_APPLICATION... |
FLAVOR_ID = "awhite"
_AWHITE_MIX_NODE = "AwhiteMix"
def __create_node__(node_tree):
"""Create node for alpha to white mixing.
:param node_tree: node tree on which this flavor will be used
:type node_tree: bpy.types.NodeTree
:return: alpha to white mixing node
:rtype: bpy.types.Node
"""
a... |
from .sub_resource import SubResource
class NetworkInterfaceIPConfiguration(SubResource):
"""IPConfiguration in a network interface.
:param id: Resource ID.
:type id: str
:param application_gateway_backend_address_pools: The reference of
ApplicationGatewayBackendAddressPool resource.
:type a... |
import os
import sys
import pygame
import random
import model
import planningScreen
import background
import scrollingBackground
import incint
import soundSystem
from constants import *
class Model(model.Model):
def __init__(self, characters, xp):
super(Model, self).__init__()
self.goBack = Fal... |
#!/usr/bin/env python
import logging
import re
import subprocess
import time
import urllib2
DIST_TEST_URL = "http://dist-test.cloudera.org"
# GCE bills 10-minute minimum, so if we've started instances
# more recently than 10 minutes ago, we shouldn't shut them down.
SHRINK_LAG = 600
def get_stats():
page = urllib2... |
GLANCE_VENDOR = "OpenStack Foundation"
GLANCE_PRODUCT = "OpenStack Glance"
GLANCE_PACKAGE = None # OS distro package version suffix
loaded = False
class VersionInfo(object):
release = "REDHATGLANCERELEASE"
version = "REDHATGLANCEVERSION"
def version_string(self):
return self.version
def ca... |
"""
Models for configuration of the feature flags
controlling the new assets page.
"""
from config_models.models import ConfigurationModel
from django.db.models import BooleanField
from six import text_type
from openedx.core.djangoapps.xmodule_django.models import CourseKeyField
class NewAssetsPageFlag(ConfigurationM... |
# -*- coding: utf-8 -*-
from django.core.management import call_command, CommandError
from django.test import TestCase
from django.utils.six import StringIO
from models import TestModelTwo
class TestPresets(TestCase):
@classmethod
def setUpTestData(cls):
TestModelTwo.objects.create(text_field="The qu... |
import unittest
from xml.etree import ElementTree
from pylib.utils import dexdump
# pylint: disable=protected-access
class DexdumpXMLParseTest(unittest.TestCase):
def testParseRootXmlNode(self):
example_xml_string = (
'<api>'
'<package name="com.foo.bar1">'
'<class'
' name="C... |
from __future__ import print_function
from __future__ import unicode_literals
#%%
from future import standard_library
standard_library.install_aliases()
from builtins import str
from builtins import object
import tkinter as tk
from tkinter import Tk, Label, Button, StringVar, DISABLED, W
from tkinter impor... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import (division, print_function, absolute_import,
unicode_literals)
__all__ = ["plot_bpt"]
import numpy as np
import matplotlib.pyplot as plt
import pkg_resources
c = 2.9979e10
def plot_bpt(logq_val='all', z_val=1.0, kappa_val=20... |
import argparse
import errno
import os
import yaml
import sys
from textwrap import dedent
class ConfigError(Exception):
pass
# We split these messages out to allow packages to override with package
# specific instructions.
MISSING_REPORT_STATS_CONFIG_INSTRUCTIONS = """\
Please opt in or out of reporting anonymi... |
"""
Helper functions for making fixtures that setup specific environment
"""
from contextlib import contextmanager
from django.contrib.auth.models import (User, Group)
from dashboard_app.models import (Bundle, BundleStream)
class test_loop(object):
"""
Support class that tells you something about a test cr... |
import click
import types
import json
import gluon.common.particleGenerator.cli as cligen
import sys
sys.tracebacklimit=0
def dummy():
pass
def make_a_func(operation, tablename, primary_key):
def update_func(**kwargs):
url = cligen.make_url(kwargs["host"], kwargs["port"], tablename, kwargs[primary_ke... |
import logging
import os
import shlex
import sys
from pathlib import Path
from typing import Dict, List, Optional
from eden.fs.cli.doctor.problem import Problem, ProblemSeverity, ProblemTracker
from eden.fs.cli.proc_utils import EdenFSProcess, ProcessID, ProcUtils
log: logging.Logger = logging.getLogger("eden.fs.cli... |
from oslo.config import cfg
import pecan
from solum.api import auth
from solum.api import config as api_config
# Register options for the service
API_SERVICE_OPTS = [
cfg.IntOpt('port',
default=9777,
help='The port for the solum API server'),
cfg.StrOpt('host',
def... |
import numpy as np
import bpy
from bpy.props import FloatProperty, EnumProperty, BoolProperty, IntProperty
from mathutils import Vector
from sverchok.node_tree import SverchCustomTreeNode
from sverchok.data_structure import updateNode, zip_long_repeat, throttle_and_update_node, ensure_nesting_level
from sverchok.util... |
# -*- coding: utf-8 -*-
"""Windows time zones collector."""
from winregrc import data_format
from winregrc import errors
from winregrc import interface
class TimeZone(object):
"""Time zone.
Attributes:
localized_name (str): localized name.
name (str): name.
offset (int): time zone offset in number o... |
"""
=================================================
Concatenating multiple feature extraction methods
=================================================
In many real-world examples, there are many ways to extract features from a
dataset. Often it is beneficial to combine several methods to obtain good
performance. Th... |
from ewsgi.server import wsgi
from cloudlib import logger
from cloudlib import parse_ini
def preload_and_start(app_name, load_app, config_path=None, config_ext='ini',
loggers=None):
"""Load all of our Configuration and logging before running the server.
This will look for and use sever... |
#!/usr/bin/env python
from validictory.validator import SchemaValidator, ValidationError, SchemaError
__all__ = ['validate', 'SchemaValidator', 'ValidationError', 'SchemaError']
__version__ = '0.7.0'
def validate(data, schema, validator_cls=SchemaValidator,
format_validators=None, required_by_default=T... |
"""
Copyright 2014 Matthias Frey
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... |
from django.core.urlresolvers import reverse
from django.forms.models import modelformset_factory
from django.shortcuts import get_object_or_404
from django.http import HttpResponseRedirect
from django.views.generic import simple
from expedient.common.utils.views import generic_crud
from expedient.common.messaging.mode... |
import json
from django.shortcuts import render_to_response
from django.views.generic import View
from silk.code_generation.curl import curl_cmd
from silk.models import Request
from silk.code_generation.django_test_client import gen
class RequestView(View):
def get(self, request, request_id):
silk_requ... |
import os, sys, time, functools, gc, zlib
import cPickle as pickle
from misc import filetool
from misc.securehash import sha_construct
from generator.runtime.ShellCmd import ShellCmd
from generator.runtime.Log import Log
memcache = {} # {key: {'content':content, 'time': (time.time()}}
check_file = u".cache_check_... |
from __future__ import unicode_literals, print_function, division
__author__ = "mozman <<EMAIL>>"
from datetime import datetime
from .compatibility import tostr
from .xmlns import CN, subelement, etree, register_class, XMLMixin
from .const import META_NSMAP, GENERATOR, META_NS
TAGS = {
'generator': 'meta:generat... |
# The name of the project
name = "hello_world"
# The version of the project. You don't have to use major.minor.patch - use
# whatever is most appropriate to your project.
version = "1.0.0"
# The author(s) of the project
authors = ["ajohns"]
# A meaningful description of the project. NOT a description of this specifi... |
''' Command to uUpload a fileset to the artifact repository '''
import logging
import os
import shutil
import zipfile
import nimp.command
def _try_remove(file_path, dry_run):
if os.path.isdir(file_path):
logging.info('Removing %s', file_path)
if not dry_run:
shutil.rmtree(file_path)
... |
""" This module contains REST servlets to do with profile: /profile/<paths> """
from synapse.api.errors import Codes, SynapseError
from synapse.http.servlet import RestServlet, parse_json_object_from_request
from synapse.rest.client.v2_alpha._base import client_patterns
from synapse.types import UserID
class Profile... |
'''
Created on Dec 13, 2013
@package: content
@copyright: 2013 Sourcefabric o.p.s.
@license: http://www.gnu.org/licenses/gpl-3.0.txt
@author: Mugur Rus
Implementation for content package item.
'''
from ally.api.validate import validate
from ally.container.support import setup
from mongo_engine.impl.entity import Ent... |
# being a bit too dynamic
# pylint: disable=E1101
from __future__ import division
import numpy as np
from pandas.util._decorators import deprecate_kwarg
from pandas.core.dtypes.missing import notna
from pandas.compat import range, lrange, lmap, zip
from pandas.io.formats.printing import pprint_thing
from pandas.plo... |
import GemRB
from GUIDefines import *
import CharOverview
import CommonTables
from ie_stats import IE_STR, IE_DEX, IE_CON, IE_INT, IE_WIS, IE_CHR
AbilityWindow = 0
TextAreaControl = 0
DoneButton = 0
AbilityTable = 0
PointsLeft = 0
Minimum = 0
Maximum = 0
Add = 0
KitIndex = 0
CharGen = 0
Stats = [ IE_STR, IE_DEX, IE_CO... |
"""Account views."""
# Imports
from django.contrib import messages
from django.contrib.auth import update_session_auth_hash
from django.http import HttpResponseRedirect
from django.shortcuts import render
from django.urls import reverse
from gl_site.custom_auth import login_required
from gl_site.forms.user_registrat... |
import os
import shutil
from unittest import mock
import pytest
from click.testing import CliRunner
from great_expectations import DataContext
from great_expectations.cli.v012 import cli
from great_expectations.data_context.templates import CONFIG_VARIABLES_TEMPLATE
from great_expectations.data_context.util import fi... |
import foauth.providers
from foauth import OAuthDenied, OAuthError
class Stripe(foauth.providers.OAuth2):
# General info about the provider
provider_url = 'https://stripe.com/'
docs_url = 'https://stripe.com/docs/api'
category = 'Money'
# URLs to interact with the API
authorize_url = 'https:/... |
#!/usr/bin/python3
# -*- coding: utf-8 -*-
# --- Day 8: Matchsticks ---
# Space on the sleigh is limited this year,
# and so Santa will be bringing his list as a digital copy.
# He needs to know how much space it will take up when stored.
# It is common in many programming languages to provide
# a way to escape spe... |
"""
HeaderID Extension for Python-Markdown
======================================
Auto-generate id attributes for HTML headers.
Basic usage:
>>> import markdown
>>> text = "# Some Header #"
>>> md = markdown.markdown(text, ['headerid'])
>>> print md
<h1 id="some-header">Some Header</h1>
All head... |
"""Train a network with Detectron."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import argparse
import cv2 # NOQA (Must import before importing caffe2 due to bug in cv2)
import logging
import numpy as np
import... |
"Define motors related to optics"
from ophyd import EpicsMotor, Device
from ophyd import Component as Cpt
# A Hutch
## Filter
fltr6_y = EpicsMotor('XF:28IDA-OP:0{Fltr:6-Ax:Y}Mtr', name='fltr6_y')
## DLM
dlm_c1_bnd_bi = EpicsMotor('XF:28IDA-OP:1{Mono:DLM-C:1-Ax:BndBI}Mtr', name='dlm_c1_bnd_bi')
dlm_c1_bnd_bo = EpicsM... |
import plistlib
import struct
import socket
from datetime import datetime
from progressbar import ProgressBar, Percentage, Bar, SimpleProgress, ETA
from usbmux import usbmux
from util import sizeof_fmt
kIOAESAcceleratorEncrypt = 0
kIOAESAcceleratorDecrypt = 1
kIOAESAcceleratorGIDMask = 0x3E8
kIOAESAccele... |
import unittest
import wradlib.zr as zr
import wradlib.trafo as trafo
import numpy as np
class ZRConversionTest(unittest.TestCase):
def setUp(self):
img = np.zeros((5, 11), dtype=np.float32)
img[0:1, 1:3] = 11. # precip field
img[0:1, 6:9] = 45.
img[2:3, 1:3] = 38.
img[2:... |
""" https://stackoverflow.com/a/29834357
"""
import os
import sys
import threading
import time
BLACKLIST_OS_NAMES = [
'nt',
]
class StreamBuffer(object):
""" Class used to grab standard output or another stream.
"""
escape_char = b"\b"
stream_fd = None
worker_thread = None
def __init__(s... |
# The purpose of this file is twofold:
# 1. it tells python that woo (this directory) is package of python modules
# see http://http://www.python.org/doc/2.1.3/tut/node8.html#SECTION008400000000000000000
#
# 2. import the runtime namespace (will be populated from within c++)
#
"""Common initialization core for woo... |
# Check the env command
#
# RUN: not %{lit} -j 1 -a -v %{inputs}/shtest-env \
# RUN: | FileCheck -match-full-lines %s
#
# END.
# Make sure env commands are included in printed commands.
# CHECK: -- Testing: 7 tests{{.*}}
# CHECK: FAIL: shtest-env :: env-args-last-is-assign.txt ({{[^)]*}})
# CHECK: Error: 'env' requi... |
from django.conf.urls import patterns, include, url
from django.conf.urls.static import static
from django.conf import settings
from django.views.generic import TemplateView
# Uncomment the next two lines to enable the admin:
from django.contrib import admin
admin.autodiscover()
urlpatterns = patterns('',
url(r'^... |
import collections
import itertools
import sys
from oslo_config import cfg
from oslo_log import log
import six
from heat.common import plugin_loader
LOG = log.getLogger(__name__)
class PluginManager(object):
"""A class for managing plugin modules."""
def __init__(self, *extra_packages):
"""Initial... |
import cards
import hands
import preflop_sim
import afterflop_sim
import afterturn_sim
import afterriver_sim
import random
kPositionAdvantage = .025
kPositionDisadvantage = .025
kRandomFactor = .1 # max value of random factor
# returns bet size of small blind, with -1 being fold
# small_blind is true if small blind... |
#! /usr/bin/python
from bs4 import BeautifulSoup
from cookielib import CookieJar
import re
import time
import urllib2
import codecs
import yaml
# This page is used to get the web addresses for each league table
#stattopage = urllib2.urlopen('http://www.statto.com/football/stats/england/premier-league/2011-2012').read... |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals
from datetime import datetime
from scrapy.utils.httpobj import urlparse_cached
from six.moves import map
class LogicBase(object):
def __init__(self, settings):
self.ignore_missing = settings.getbool('HTTPCACHE_IGNORE_MISSI... |
from shinken_test import *
class TestBadRealmConf(ShinkenTest):
def setUp(self):
self.setup_with_file('etc/nagios_bad_realm_conf.cfg')
def test_bad_conf(self):
self.assert_(not self.conf.conf_is_correct)
if __name__ == '__main__':
unittest.main() |
from scrapy.contrib.spiders import CrawlSpider, Rule
from scrapy.contrib.linkextractors.sgml import SgmlLinkExtractor
from scrapy.selector import HtmlXPathSelector
from d3.config import Config
import MySQLdb
from d3.items import ItemItem
class ItemSpider(CrawlSpider):
name = 'Item'
allowed_domains = ['battle.n... |
from django.contrib.auth import get_user_model
from django.test import TestCase
from django.test.client import Client
from molo.core.models import SiteLanguageRelation, Main, Languages, ArticlePage
from molo.core.tests.base import MoloTestCaseMixin
from molo.surveys.models import (
MoloSurveyPage,
MoloSurveyFo... |
import random
import re
from time import strptime, strftime
from urllib import quote
from util import hook, http
@hook.api_key('twitter')
@hook.command
def twitter(inp, api_key=None):
".twitter <user>/<user> <n>/<id>/#<search>/#<search> <n> -- " \
"get <user>'s last/<n>th tweet/get tweet <id>/do <search>... |
{
'name': 'Clouder Invoicing',
'version': '10.0.10.0.0',
'category': 'Clouder',
'depends': ['base', 'clouder', 'account', 'account_accountant', 'product'],
'author': 'Yannick Buron (Clouder), Nicolas Petit',
'license': 'LGPL-3',
'website': 'https://github.com/clouder-community/clouder',
... |
## this is a main module to run main loop
from steplogic import *
from Enum import *
import time
from timer import updateTimers
from Test_I2C import GetTemperature
from Outputs import UpdateOutputs
import os
import errno
EXIT = False
pipeName = '/tmp/BrewStatePipe'
def LoadProgram():
global stepProgram
glob... |
# -*- coding: utf-8 -*-
#config.py - Variables used to set optional configuration options
########### SVN repository information ###################
# $Date: 2018-05-15 20:24:54 +0300 (Tue, 15 May 2018) $
# $Author: vondreele $
# $Revision: 3388 $
# $URL: https://subversion.xray.aps.anl.gov/pyGSAS/trunk/config_ex... |
"""
F2x 'ctypes' template glue library.
This module contains helpers that are used by the code generated by the 'ctypes' library. It mainly deals with setting
correct C interfaces and converting values between FORTRAN and Python types. Arrays are handled by NumPy.
Usually there should be no need to access this module... |
from Quadrature2DQuadratic import *
# ----------------------------------------------------------------------
# Quadrature2Din3DQuadratic class
class Quadrature2Din3DQuadratic(Quadrature2DQuadratic):
"""
Python container holding quadrature information for a 1-D quadratic
finite-element cell used in testing finit... |
import os.path
from django.test import TestCase
from django.core.urlresolvers import reverse
from django.conf import settings
from django.contrib.auth.models import User
from avatar import AVATAR_DEFAULT_URL, AVATAR_MAX_AVATARS_PER_USER
from avatar.util import get_primary_avatar
from avatar.models import Avatar
try... |
"""
This file demonstrates two different styles of tests (one doctest and one
unittest). These will both pass when you run "manage.py test".
Replace these with more appropriate tests for your application.
"""
from django.test import TestCase
class SimpleTest(TestCase):
def test_basic_addition(self):
"""
... |
# -*- coding: utf-8 -*-
"""
Django settings for rest_test 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/
"""
# Build paths inside the project like this: os.p... |
import os, sys
sys.path.insert(0, os.path.join("..",".."))
from nodebox.graphics.context import *
from nodebox.graphics import *
from nodebox.graphics.shader import *
# This example will make more sense after you've seen the examples in /07-filter
# NodeBox for OpenGL has a range of commands for filtering images.
#... |
#!/usr/bin/env python
# -*- coding: utf-8 -*- #
from __future__ import unicode_literals
AUTHOR = u'spseol.cz'
SITENAME = u'spseol.github.io'
# SITEURL = 'spseol.github.io'
# SITEURL = ''
PATH = 'content'
THEME = 'themes/simplegrey'
TIMEZONE = 'Europe/Prague'
TYPOGRIFY = True
DEFAULT_LANG = u'cz'
# Feed generation ... |
"""
Checker for common errors in Lore documents.
"""
from xml.dom import minidom as dom
import parser, urlparse, os.path
from twisted.lore import tree, process
from twisted.web import domhelpers
from twisted.python import reflect
# parser.suite in Python 2.3 raises SyntaxError, <2.3 raises parser.ParserError
parser... |
"""
Django settings for sas_challenge project.
Generated by 'django-admin startproject' using Django 1.8.4.
For more information on this file, see
https://docs.djangoproject.com/en/1.8/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.8/ref/settings/
"""
# Buil... |
import os
import numpy as np
import pyfits
from momentfunc import moment
import pymconvolve
class Gini:
"""Calculate gini coefficient at different radii. This will also call
the function to compute M20. The algorithm is as follows
1. Find the pixels in the image which belong to the galaxy, ie. make... |
from django.db import models
from django.utils.translation import ugettext_lazy as _
from django.contrib.auth.models import User
from datetime import datetime
from django.template.defaultfilters import slugify
import markdown
import os
class ConfTemplate(models.Model):
ACTIVE = 'A'
DELETED = 'D'
STATUS =... |
"""Helper class for testing modal widgets (dialogs).
Suggested usage:
class TestModalDialog(unittest.TestCase):
def test_my_dialog(self):
def testing_function(widget):
widget.setTextValue('Hello World!')
text = widget.textValue()
self.assertEqual(text, 'Hello World!')... |
import os
from csv import DictReader
from altmetric_client.output_writer_csv.csv_writer_user_demographics import CSVWriterUserDemographics
from altmetric_client.user_demographics import UserDemographics
class TestBareMinimumUserDemographics:
def setup_method(self):
self._files_out_directory = '../files_... |
import types, string, pprint, exceptions
class EnumException(exceptions.Exception):
pass
class Enumeration:
def __init__(self, name, enumList):
self.__doc__ = name
lookup = { }
reverseLookup = { }
i = 0
uniqueNames = [ ]
uniqueValues = [ ]
f... |
# -*- coding: utf-8 -*-
"""
pyvisa.resources
~~~~~~~~~~~~~~~~
High level wrappers for resources.
This file is part of PyVISA.
:copyright: 2014 by PyVISA Authors, see AUTHORS for more details.
:license: MIT, see LICENSE for more details.
"""
from __future__ import division, unicode_literals, ... |
''' default.py - Stock plugin to add in some statically configured text into a commit message.'''
from flashbake.plugins import AbstractMessagePlugin
import flashbake
class Default(AbstractMessagePlugin):
def __init__(self, plugin_spec):
AbstractMessagePlugin.__init__(self, plugin_spec, False)
s... |
from tests.testcase import TestCase
from edmunds.log.logmanager import LogManager
class TestLogServiceProvider(TestCase):
"""
Test the Log Service Provider
"""
def test_logging_disabled(self):
"""
Test logging disabled
"""
log_string = 'LogServiceProviderTest::test_lo... |
"""Core model represents data in the database"""
import datetime
import peewee
# from wtfpeewee.orm import model_form
# from wtforms_tornado import Form
from config import dbconfig
db = dbconfig['sqlite']['db']
database = peewee.SqliteDatabase(db)
class BaseModel(peewee.Model):
"""Base model"""
class Meta... |
#!/usr/bin/env python3
import argparse
from support.logging import log
import edp_modules.edp_controller as edp_controller
def _check_arguments(args):
start_system = None
end_system = None
if args.tests:
edp_controller.run_tests()
exit(0)
if args.refresh:
edp_db.retrieve_dat... |
#!/usr/bin/env python3
import json
import os
import sys
from hyriseBenchmarkCore import close_benchmark, check_exit_status, check_json, initialize, run_benchmark
# This test runs the binary hyriseBenchmarkJoinOrder with two different sets of arguments.
# During the first run, the shell output is validated using pex... |
"""
Module for handling Items.
Items are the basic meaningful units of notes in ParaJumper.
They can be created, updated, and removed.
They have attributes such as creation date, tags, types and contents.
The contents are Markdown text."""
import uuid
import re
from datetime import date
from clint.textui import co... |
# coding: utf-8
import base64
import io
import json
import os
from os.path import join as pjoin
import shutil
import requests
from notebook.utils import url_path_join
from notebook.tests.launchnotebook import NotebookTestBase, assert_http_error
from nbformat import write
from nbformat.v4 import (
new_notebook, ne... |
import argparse
import gsf
def Hex2(val):
return '0x' + ('%02x' % ord(val)).upper()
def Pieces(data, max_size):
"""Yield max_size components from data."""
for i in range(0, len(data), max_size):
yield data[i:i + max_size]
def DumpHex(filename, include_cpp=True):
gsf_file = gsf.GsfFile(filename)
if... |
#!/usr/bin/python
import sys
import matplotlib.pyplot as plt; plt.rcdefaults()
from matplotlib import rc
rc('font',**{'family':'sans-serif','sans-serif':['Helvetica']})
rc('text', usetex=True)
plt.rcParams.update({'font.size': 12})
import numpy as np
from matplotlib import pyplot as plt
from mpl_toolkits.mpl... |
"""
This sample illustrates how particles of interest can be accessed via slicing.
"""
#
# Copyright (C) 2013-2018 The ESPResSo project
#
# This file is part of ESPResSo.
#
# ESPResSo is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Fr... |
#!/usr/bin/env python3
"""Generate a table of cross-identifications for SWIRE objects.
Matthew Alger <<EMAIL>>
Research School of Astronomy and Astrophysics
The Australian National University
2017
"""
import collections
import itertools
import re
import astropy.io
import astropy.table
import numpy
import pipeline
... |
import os, json, logging
from functools import partial
log = logging.getLogger()
from vlib.analyzers import exploitability, freshness, popularity, reproducibility
from vlib.analyzers.tools import call_for_each_bug
from vlib.supertrace import SuperTrace
def store_analysis(summary_dict, analyzers, bug_cache_dir, anal... |
"""Trains and evaluates Stackoverflow NWP model."""
import collections
import functools
import random
from typing import List, Tuple
from absl import app
from absl import flags
from absl import logging
import tensorflow as tf
import tensorflow_federated as tff
from dp_ftrl import dp_fedavg
from dp_ftrl import optimi... |
"""
API for Catalogue Service for the Web (CSW) methods and metadata.
Supports version 2.0.2 and 3.0.0 of the CSW specification.
"""
from .catalogue import csw2, csw3
from .catalogue.csw2 import CswRecord
from .util import clean_ows_url, Authentication
def CatalogueServiceWeb(url, lang='en-US', version='2.0.2', tim... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.