text stringlengths 12 6.59M |
|---|
# -*- coding: utf-8 -*-
from __future__ import absolute_import, division, print_function
import six
from polyaxon_schemas.exceptions import PolyaxonConfigurationError
from polyaxon_schemas.polyaxonfile import validator
from polyaxon_schemas.polyaxonfile.parser import Parser
from polyaxon_schemas.polyaxonfile.specific... |
"""VideoCore IV QPU assembler.
This module implements an assembly language for VideoCore IV QPU and its
assembler. We took an approach that the language is implemented as an internal
DSL of Python language.
The QPU instruction set is described in the section 3 of the following document
`VideoCore(R) IV 3D Architectur... |
import csv
taxon_dict={}
year_keys=[]
taxonID=[]
def get_organized(file):
file=open(file, 'r')
for line in file:
line=line.split()
names = ' '.join(line[1:])
taxon_dict[line[0]]=names
taxonID.append(line[0])
file.close()
return (taxon_dict, taxonID)
hello = get_organized('taxon_list.txt')
da... |
import sys, os.path, operator, thread, threading
from operator import itemgetter, attrgetter
from itertools import count, imap, izip, ifilter, ifilterfalse
from pony import utils
from pony.thirdparty import etree
class OrmError(Exception): pass
class DiagramError(OrmError): pass
class SchemaError(OrmError)... |
# coding: utf-8
from os import path
from fabric import api as fab
from fabric.api import env, task
from bsdploy.fabutils import rsync
from ploy.config import value_asbool
AV = None
# hide stdout by default
# from fabric.state import output
# output['stdout'] = False
def get_vars():
global AV
if AV is None:
... |
#!/usr/bin/python2.4
#
# Copyright (c) 2004-2005 rPath, Inc.
#
import testsuite
testsuite.setup()
from mint_rephelp import MintRepositoryHelper
from mint import userlevels
from mint.mint_error import PermissionDenied
from mint.users import LastOwner, UserInduction, MailError
from mint.database import DuplicateItem
fr... |
import os
import sys
import numpy as np
import glob
import gfs_sublink_utils as gsu
import shutil
import math
import astropy
import astropy.io.fits as pyfits
#import matplotlib
#import matplotlib.pyplot as plt
import scipy
import scipy.ndimage
#import make_color_image
import numpy.random as random
import congrid
import... |
import __builtin__, re, sys, threading, types, inspect
from compiler import ast
from operator import attrgetter, itemgetter
from itertools import count, ifilter, ifilterfalse, imap, izip, chain
import datetime
try: from pony.thirdparty import etree
except ImportError: etree = None
from pony import options
f... |
import os
import numpy as np
from neuroimaging.testing import *
from neuroimaging.modalities.fmri.api import FmriImage, fromimage
from neuroimaging.modalities.fmri.pca import PCA
from neuroimaging.core.api import Image, load_image
from neuroimaging.testing import funcfile
class test_PCA(TestCase):
def setUp(... |
# Copyright (c) 2020, DjaoDjin Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice,
# this list of conditions and t... |
import numpy as np
import matplotlib.pyplot as plt
import plotly.plotly as py
from collections import Counter
from sklearn.decomposition import PCA
# Initialize values
individuals = 995
columns = 10101
fullData = [[0 for j in range(columns + 3)] for i in range(individuals)]
X = [[0 for j in range(columns)] for i in r... |
from django.shortcuts import render
from django.db.models import Q
from django.views.decorators.cache import cache_page
from collections import defaultdict
from django.conf import settings
import json
import functools
from contactnetwork.models import *
from structure.models import Structure
from protein.models impo... |
import logging
import requests
import json
from bs4 import BeautifulSoup
from requests_toolbelt.utils import dump
import datetime
import codecs
import tempfile
import pkg_resources
logging.basicConfig(level=logging.INFO)
logger = logging.getLogger('postcard-creator-wrapper')
class Debug(object):
debug = False
... |
import os, sys, re
import cvmfsmon_api
import cgi
# A URL is of the form:
# /cvmfsmon/api/v1.0/montests¶m1=value1¶m2=value2
# The "/cvmfsmon/api" is stripped off by apache.
# The value of "montests" and the params is determined in the
# cvmfsmon_api.dispatch function.
pattern = re.compile('^/(v[^/]*)/([^&]*... |
from pprint import pprint
from django.conf import settings
from django.db import connections
from geral.functions import is_alternativa
fo2_db_so = settings.FO2_DEFAULT_SYSTEXTIL_DB
fo2_db_sn = settings.FO2_ALTER_SYSTEXTIL_DB
def db_conn(name, request=None):
if request and name == fo2_db_so:
# 2021-02... |
import sys, os.path, operator, thread, threading
from operator import itemgetter, attrgetter
from itertools import count, imap, izip, ifilter, ifilterfalse
from pony import utils
from pony.thirdparty import etree
class OrmError(Exception): pass
class DiagramError(OrmError): pass
class SchemaError(OrmError)... |
# Copyright 2012 New Dream Network, LLC (DreamHost)
#
# 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 a... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Dissemin: open access policy enforcement tool
# Copyright (C) 2014 Antonin Delpeuch
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU Affero General Public License
# as published by the Free Software Foundation; eith... |
#!/usr/bin/env python
'''
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License")... |
"""Serialize graphs to/from files on disk."""
import ast
import os
import networkx as nx
import pandas as pd
from shapely import wkt
from . import osm_xml
from . import settings
from . import utils
from . import utils_graph
def save_graph_geopackage(G, filepath=None, encoding="utf-8"):
"""
Save graph nodes... |
#!/usr/bin/python
import datetime
import re
import sys
tsFormat = "%Y-%m-%d %H:%M:%S"
# Need to exclude milliseconds since this will only appear if explicitly configured in OpenSim.exe.config, etc.
tsRe = re.compile("^([\d-]+ [\d:]+)")
loginRe = re.compile("Login request for (\w+) (\S+)")
# 2014-01-16 00:28:54,961 ... |
import sys, os.path, operator, thread, threading
from operator import itemgetter, attrgetter
from itertools import count, imap, izip, ifilter, ifilterfalse
from pony import utils
try: from pony.thirdparty import etree
except ImportError: etree = None
class OrmError(Exception): pass
class DiagramError(Orm... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""
This bot retreives a list of anonymous editors on the wiki in the
last few hours and tries to identify proxies within that list.
"""
#
# (C) User:Mensis Mirabilis, 2019
# (C) User:Huji, 2019
#
# Distributed under the terms of the CC-BY-SA license.
#
from __future__ import ... |
##############################################################################
#
# Copyright (C) 2014 Pexego Sistemas Informáticos All Rights Reserved
# $Jesús Ventosinos Mayor <jesus@pexego.es>$
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero ... |
"""Definitions and implementations for data-path expressions to query and manipulate (insert, update, delete)."""
from . import urlquote
import copy
from datetime import date
import itertools
import logging
import re
from requests import HTTPError
import warnings
from . import DEFAULT_HEADERS
__all__ = ['DataPathExce... |
import scrapy
"""google_finance_spider.py
run with: scrapy runspider google_finance_spider.py -o google_finance.jl
scrapy crawl google_finance -o google_finance.json"""
class GoogleFinanceSpider(scrapy.Spider):
name = "google_finance"
allowed_domains = ["www.google.com"]
start_urls = [
... |
import asyncio
from collections import defaultdict, deque
from collections.abc import Mapping, Set
from contextlib import suppress
from datetime import timedelta
from functools import partial
import inspect
import itertools
import json
import logging
import math
from numbers import Number
import operator
import os
impo... |
import json
import requests
def urljoin(*args):
"""
Kinda ghetto.
"""
return "/".join(map(lambda x: str(x).rstrip('/'), args))
class ArcGIS:
"""
A class that can download a layer from a map in an
ArcGIS web service and convert it to something useful,
like GeoJSON.
Usage:
>>>... |
"""
LooLu is Copyright (c) 2009 Shannon Johnson, http://loo.lu/
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 rights to use, copy, modify, m... |
"""Serialize graphs to/from files on disk."""
import ast
import warnings
from pathlib import Path
import networkx as nx
import pandas as pd
from shapely import wkt
from . import settings
from . import utils
from . import utils_graph
def save_graph_geopackage(G, filepath=None, encoding="utf-8", directed=False):
... |
import re, threading, os.path, sys, cgi, urllib, Cookie, cPickle, time
from cStringIO import StringIO
from itertools import imap, count
from operator import attrgetter
import pony
from pony import routing, postprocessing, autoreload, auth, httputils, options
from pony.utils import decorator_with_params, tos... |
# Software License Agreement (BSD License)
#
# Copyright (c) 2010, Willow Garage, Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# * Redistributions of source code must retain the above... |
# © 2019 Comunitea
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo import models, fields, api
class SaleOrderLine(models.Model):
_inherit = 'sale.order.line'
def _compute_product_tags(self):
for line in self:
stream = []
if line.product_id and line.pr... |
from angular_flask.core import db
from angular_flask.models import Term, Course, Section
MODEL_PRIMARY_KEY_MAP = {
Term: 'term',
Course: 'course',
Section: 'class_'
}
def primary_key_from_model(model):
return MODEL_PRIMARY_KEY_MAP.get(model, '')
class StandardLocalDatabase(object):
"""View of the... |
# Jeremy Bouchard
# Emile Belanger
# 2016/02/22
# Pour executer, utiliser la commande : python BaseCalc.py
from tkinter import *
from tkinter.messagebox import *
class GUI:
current = 0
last = 0
power = 0
dot = 0
negative = 0
temp = 0
lastOperation = ""
history = ""
... |
# -*- coding: utf-8 -*-
"""Generalized logging utilities"""
import os
import logging
from traceback import print_exc
from datetime import datetime
import csutil
def formatMsg(*msg, **po):
"""Format the message for pretty visualization"""
t = csutil.time()
st = datetime.fromtimestamp(t).strftime('%x %X.%f'... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# IkaLog
# ======
# Copyright (C) 2015 Takeshi HASEGAWA
#
# 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/l... |
# Copyright 2012 Bouvet ASA
#
# Author: Endre Karlson <endre.karlson@bouvet.no>
#
# 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 ... |
"""
Docstrings for generated ufuncs
The syntax is designed to look like the function add_newdoc is being
called from numpy.lib, but in this file add_newdoc puts the docstrings
in a dictionary. This dictionary is used in
numpy/core/code_generators/generate_umath.py to generate the docstrings
for the ufuncs in numpy.co... |
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
import os
import urllib
import urllib2
import elementtree.ElementTree as ET
import time
from datetime import datetime, timedelta
from md5 import md5
__all__ = ['ApiClient']
def _local_date(string):
dt = datetime.strptime(string[0:25], '%a, %d %b %Y %H:%M:%S')
re... |
# Numenta Platform for Intelligent Computing (NuPIC)
# Copyright (C) 2021, Numenta, Inc. Unless you have an agreement
# with Numenta, Inc., for a separate license for this software code, the
# following terms and conditions apply:
#
# This program is free software you can redistribute it and/or modify
# it under... |
# coding:utf-8
from __future__ import with_statement
import threading
import sys
import traceback
from functools import wraps
import inspect
from contextlib import contextmanager, nested
try:
from abc import ABCMeta, abstractmethod
except ImportError:
ABCMeta = type
abstractmethod = lambda x: x
try:
... |
import os
import shlex
import subprocess
import sys
from textwrap import dedent
import pytest
from julia.core import which
from julia.python_jl import parse_pyjl_args
from julia.utils import is_apple
PYJULIA_TEST_REBUILD = os.environ.get("PYJULIA_TEST_REBUILD", "no") == "yes"
python_jl_required = pytest.mark.skipif... |
import time
import queue
from typing import List, Optional
from wsproto.frame_protocol import CloseReason
from wsproto.frame_protocol import Opcode
from mitmproxy import flow
from mitmproxy.net import websockets
from mitmproxy.coretypes import serializable
from mitmproxy.utils import strutils, human
class WebSocket... |
# -*- coding: UTF-8 -*-
from collections import defaultdict
from conference.models import Ticket, Speaker, Talk
from django.contrib.auth.models import User
from django.core.urlresolvers import reverse
from django.db.models import Q, Count
from p3 import models
from conference import models as cmodels
def _tickets(conf... |
'''
Created on 14 janv. 2015
@author: Remi Cattiau
'''
from nxdrive.engine.engine import Worker
from nxdrive.logging_config import get_logger
from nxdrive.client.common import LOCALLY_EDITED_FOLDER_NAME
from nxdrive.engine.activity import Action
from nxdrive.utils import current_milli_time
from PyQt4.QtCore import pyq... |
import os
import openerp.tests
inject = [
("openerp.website.Tour", os.path.join(os.path.dirname(__file__), '../../website/static/src/js/website.tour.js')),
("openerp.website.Tour.ShopTest", os.path.join(os.path.dirname(__file__), "../static/src/js/website.tour.sale.js")),
]
@openerp.tests.common.at_install(F... |
# -*- coding: UTF-8 -*-
from django import forms
from django import http
from django.conf import settings
from django.contrib import auth
from django.contrib.auth.decorators import login_required
from django.core.mail import send_mail
from django.core.urlresolvers import reverse
from django.db import transaction
from d... |
import PIL
import PIL.Image
import numpy as np
import os
# ==============================================================================
# VIZ_SEGMENTATION_LABEL
# ==============================================================================
def viz_segmentatio... |
# coding: utf-8
# zmq install
# >sudo apt-get install libzmq-dev
# >sudo apt-get install python-zmq
from ryu.ofproto import ether, inet
from ryu.ofproto import ofproto_v1_3
from ryu.ofproto import ofproto_v1_3_parser as parser
from ryu.lib.packet import ethernet, ipv6, icmpv6, vlan
from ryu.lib import hub
from scapy... |
#!/usr/bin/python
# Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
# chrome_tests.py
''' Runs various chrome tests through valgrind_test.py.'''
import glob
import logging
import optparse
import o... |
import base64
import datetime
import logging
import party
from ..credentials import load_credentials
LOG = logging.getLogger(__name__)
class Artifactory(object):
def __init__(self, repo_name=None):
self.repo_name = repo_name
self.credentials = load_credentials()
self.artifactory = party... |
"""
CFSheetPlotPanel must be subclassed to be used.
Subclasses PlotGroupPanel with additional buttons for Sheet access.
The Sheet menu was not included in PlotGroupPanel itself, because it
depends on the CFSheet class.
$Id$
"""
__version__='$Revision$'
from Tkinter import StringVar, Frame, LEFT, RIGHT, TOP, BOTTOM,... |
from contextlib import contextmanager
from concurrent.futures import ThreadPoolExecutor
from sqlalchemy import create_engine, event
from sqlalchemy.ext.declarative import declarative_base as _declarative_base
from sqlalchemy.orm import sessionmaker
__all__ = ['SessionMixin', 'set_max_workers', 'wrap_in_future',
... |
#!/usr/bin/env python
# vim: ai ts=4 sts=4 et sw=4 coding=utf-8
import os, glob
from django.core.management.base import BaseCommand, CommandError
from django.core.management import call_command
from odk_logger.import_tools import import_instances_from_zip
from odk_logger.models import Instance, XForm
from django.con... |
# import argparse
import sys
from app import generate_pokemon, initMove
import requests
from bs4 import BeautifulSoup
from models import Pokemon
def populate(arg):
if '-u' in arg or '--update' in arg:
pokeList = []
for poke in Pokemon.query.all():
for move in poke.stats['moves']:
... |
""":py:mod:`postgres` is a high-value abstraction over `psycopg2`_.
Installation
------------
:py:mod:`postgres` is available on `GitHub`_ and `PyPI`_::
$ pip install postgres
Tutorial
--------
Instantiate a :py:class:`Postgres` object when your application starts:
>>> from postgres import Postgres
... |
#!/usr/bin/python
import gdata.sample_util
import gdata.sites.client
import gdata.sites.data
import os
from datetime import datetime
import re
import xml.parsers.expat
import atom.core
from pprint import pprint, pformat
import cgi
import sys
import traceback
SOURCE_APP_NAME = 'backupApp-GoogleSitesAPIPythonLib'
clas... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import sys
import getopt
from optparse import OptionParser
import logging
import backup
import configparser
parser = OptionParser()
parser.add_option("-c", "--config", dest="config_filename", default="config.ini", help="read from FILE", metavar="CONFIG")
parser.... |
import math
import random
import tradingsim.configuration as configuration
import tradingsim.utils as utils
class Agent:
def __init__(self, name, x, y):
self.x = x
self.y = y
self.speed = configuration.AGENT_SPEED # simulation distance units by simulation time
self.name = name
... |
#!/usr/bin/env python
"""
Copyright (c) 2014-2022 Maltrail developers (https://github.com/stamparm/maltrail/)
See the file 'LICENSE' for copying permission
"""
import re
from core.common import retrieve_content
__url__ = "https://gitlab.com/gerowen/old-malware-domains-ad-list/-/raw/master/malwaredomainslist.txt"
__... |
import pyspeckit
import astropy.io.fits as fits
import numpy as np
import os
from .first_look import trim_edge_cube
from spectral_cube import SpectralCube
import astropy.constants as con
import astropy.units as u
import matplotlib.pyplot as plt
import aplpy
from skimage.morphology import remove_small_objects,closing,di... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
import unittest
from spambl import (UnknownCodeError, NXDOMAIN, HpHosts,
IpDNSBL, DomainDNSBL, GeneralDNSBL,
GoogleSafeBrowsing, UnathorizedAPIKeyError, HostCollection,
CodeClassificationMap, SumClassificationMap, H... |
from __future__ import print_function
import copy
import operator
import sys
import unittest
from collections import namedtuple
from datetime import datetime, timedelta
import numpy as np
import pytest
from numpy.testing import assert_almost_equal, assert_equal
import cftime
from cftime import datetime as datetimex
... |
import os
from flake8_commas._base import (
get_tokens, get_noqa_lines, get_comma_errors,
)
C813 = 'C813 missing trailing comma in Python 3'
C814 = 'C814 missing trailing comma in Python 2'
C815 = 'C815 missing trailing comma in Python 3.5+'
C816 = 'C816 missing trailing comma in Python 3.6+'
def test_get_noqa_... |
import unittest
import logging
import snap7
logging.basicConfig()
l = logging.getLogger()
l.setLevel(logging.INFO)
#ip = '192.168.200.24'
ip = '127.0.0.1'
db_number = 1
rack = 1
slot = 1
class TestClient(unittest.TestCase):
def setUp(self):
self.client = snap7.client.Client()
self.client.conn... |
"""Test the config file handling for coverage.py"""
import os, sys
import coverage
sys.path.insert(0, os.path.split(__file__)[0]) # Force relative import for Py3k
from coveragetest import CoverageTest
class ConfigTest(CoverageTest):
"""Tests of the different sources of configuration settings."""
def test_d... |
#!/usr/bin/env python2
import unittest
from common.unittests import ConfigTest
from common.dcfile import *
class TestConfigCore(ConfigTest):
def test_core_good(self):
config = """\
daemon:
name: Core Message Director
url: http://123.45.67.89/coremd/
... |
import pytest
from urllib3.fields import guess_content_type, RequestField
from urllib3.packages.six import u
from . import onlyPy2
class TestRequestField(object):
@pytest.mark.parametrize('filename, content_types', [
('image.jpg', ['image/jpeg', 'image/pjpeg']),
('notsure', ['application/octet-s... |
# -*- coding: utf-8 -*-
# This file is part of beets.
# Copyright 2016, Adrian Sampson.
#
# 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 t... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (c) 2009, Giampaolo Rodola'. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""
psutil test suite (you can quickly run it with "python setup.py test").
Note: this is targeted for both... |
# Copyright (C) 2013 Google Inc., authors, and contributors <see AUTHORS file>
# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>
# Created By: mouli@meics.org
# Maintained By: dan@reciprocitylabs.com
from flask import current_app, request
from ggrc.app import app
import ggrc_workflows.mod... |
#!/usr/bin/python
'''
Program to process a whole directory full of compressed source code archives
to create a knowledgebase. Needs a file LIST in the directory it is passed as
a parameter.
package version filename
seperated by whitespace.
Compression is determined using magic
'''
import sys, os, magic
import temp... |
from host import Host
from router import Router
from link import Link
from flow import Flow
from tahoe_flow import TahoeFlow
from reno_flow import RenoFlow
from Queue import PriorityQueue
import networkx as nx
import matplotlib.pyplot as plt
# Constants
# Time to update router info, in ms.
ROUTER_UPDATE_PERIOD = 100
... |
from itertools import chain
from operator import itemgetter
from django.conf import settings
from django.contrib import messages
from django.core.cache import cache
from django.core.exceptions import PermissionDenied
from django.http import Http404
from django.shortcuts import get_object_or_404, redirect, render
from ... |
from itertools import chain
from operator import itemgetter
from django.conf import settings
from django.contrib import messages
from django.core.cache import cache
from django.http import Http404
from django.shortcuts import get_object_or_404, redirect, render
from django.urls import NoReverseMatch, reverse
from djan... |
# -*- coding: utf-8 -*-
import pytest
def test_node_class():
"""Test Node."""
from linked_list import Node
new_node = Node('caterpillar')
assert new_node.data == 'caterpillar'
def test_search():
"""Search for node in list and return node."""
from linked_list import Node
from linked_list ... |
import pyelliptic
from pyelliptic import arithmetic as a, OpenSSL
def makeCryptor(privkey):
private_key = a.changebase(privkey, 16, 256, minlen=32)
public_key = pointMult(private_key)
privkey_bin = '\x02\xca\x00\x20' + private_key
pubkey_bin = '\x02\xca\x00\x20' + public_key[1:-32] + '\x00\x20' + public_key[-32... |
import re
KNOWN_FIRST_LINES = {
"\"THE BEER-WARE LICENSE\" (Revision 42): <phk@FreeBSD.ORG> wrote this file. As long as you retain this notice you can do whatever you want with this stuff. If we meet some day, and you think this stuff is worth it, you can buy me a beer in return Poul-Henning Kamp": "Beerware",
... |
#!/usr/bin/python
# =================================================================
#
# $Id$
#
# Authors: Tom Kralidis <tomkralidis@hotmail.com>
#
# Copyright (c) 2011 Tom Kralidis
#
# Permission is hereby granted, free of charge, to any person
# obtaining a copy of this software and associated documentation
# files ... |
__author__ = 'mariosky'
# -*- coding: utf-8 -*-
import shutil
import os
import tempfile
import subprocess
import json
def run_test(code, test, type=None):
try:
java_class = test[2:test.index('\n')-len('Test')]
code = unicode(code)
test = unicode(code)
tmp_dir = tempfile.mkdtemp()... |
import gpflow
import numpy as np
import unittest
import tensorflow as tf
from nose.plugins.attrib import attr
from gpflow.test_util import GPflowTestCase
from numpy.testing import assert_almost_equal, assert_allclose
@attr(speed='slow')
class SampleGaussianTest(GPflowTestCase):
class Gauss(gpflow.models.Model):
... |
from __future__ import absolute_import, division, print_function
import sys
import platform
import _pytest._code
import pytest
def runpdb_and_get_report(testdir, source):
p = testdir.makepyfile(source)
result = testdir.runpytest_inprocess("--pdb", p)
reports = result.reprec.getreports("pytest_runtest_log... |
import inspect
from itertools import chain
import sys
from fields import Fields
from hunter.actions import Action
from hunter.actions import CodePrinter
from hunter.actions import Debugger
from hunter.actions import VarsPrinter
__version__ = "0.1.0"
__all__ = 'F', 'CodePrinter', 'Debugger', 'VarsPrinter', 'trace', ... |
# -*- coding: utf-8 -*-
import random
import unittest
import filecmp
import os
import numpy as np
from sklearn.externals import joblib
from sklearn.svm import LinearSVC
from sklearn_porter.Porter import Porter
from sklearn_porter.utils.Environment import Environment
from sklearn_porter.utils.Shell import Shell
fro... |
import utils.response_builder as response_builder
import resources.bible as bible
def handle_welcome():
session_attributes = {}
card_title = "Welcome"
speech_output = "Christ Church Mayfair Assistant at your service. What " \
"would you like? "
should_end_session = False
repro... |
from spec import Spec, skip, eq_, raises
from invoke.collection import Collection
from invoke.tasks import task, Task
@task
def _mytask():
print "woo!"
class Collection_(Spec):
class init:
"__init__"
def can_accept_task_varargs(self):
"can accept tasks as *args"
@tas... |
import random
import unittest
import numpy as np
import mock
import modAL.models
import modAL.uncertainty
import modAL.disagreement
import modAL.density
import modAL.utils.selection
import modAL.utils.validation
import modAL.utils.combination
from copy import deepcopy
from itertools import chain, product
from collect... |
#!/usr/bin/env python
"""
demonstrate dill's ability to pickle different python types
"""
import dill as pickle
#pickle._trace(True)
#import pickle
typelist = []
import warnings; warnings.filterwarnings("ignore", category=DeprecationWarning)
# testing types
_none = None; typelist.append(_none)
_type = type; typelist... |
"""
Provides the default Series Champion screen for the Project CARS
Replay Enhancer
"""
from numpy import diff, nonzero
from PIL import Image, ImageDraw
from StaticBase import StaticBase
class Champion(StaticBase):
"""
Defines a static Champion card, consisting of the top three
finishers in points, as Ch... |
#!/usr/bin/python
class CharGrid(dict):
""" Grid of single characters for drawing ascii art.
Keys are (row,col) """
def __init__(self):
self.maxRow = 0 # total number of rows
self.maxCol = 0 # total number of cols
self._defaultVal = ' '
def __checkkey(self,key):
""" M... |
# coding=utf-8
from __future__ import absolute_import, division, print_function, \
unicode_literals
from typing import List, Optional
import filters as f
from iota import Address, Bundle, ProposedTransaction
from iota.commands import FilterCommand, RequestFilter
from iota.commands.extended.prepare_transfer import P... |
###############################################################################
# IsochronePotential.py: The isochrone potential
#
# - amp
# Phi(r)= ---------------------
# b + sqrt{b^2+r^2}
################################... |
"""
Copyright 2015, Institute for Systems Biology
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 writi... |
from rest_framework import serializers, parsers, renderers, exceptions
from rest_framework.views import APIView
from rest_framework.response import Response
from django.conf import settings
from rest_framework_jwt.settings import api_settings
from django.shortcuts import get_object_or_404
from django.contrib.auth imp... |
# Copyright (c) 2010-2012, GEM Foundation.
#
# OpenQuake is free software: you can redistribute it and/or modify it
# under the terms of the GNU Affero General Public License as published
# by the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# OpenQuake is distri... |
# Copyright (c) 2010-2012, GEM Foundation.
#
# OpenQuake is free software: you can redistribute it and/or modify it
# under the terms of the GNU Affero General Public License as published
# by the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# OpenQuake is distri... |
#!/usr/bin/env python
# Streams.py
# Copyright (C) 2006 CCLRC, Graeme Winter
#
# This code is distributed under the BSD license, a copy of which is
# included in the root directory of this package.
#
# Maintained by Graeme Winter
# 15th August 2006
#
# "Standard" output streams for the output of xia2dpa - these... |
# -*- coding: utf-8 -*-
# vim: tabstop=4 shiftwidth=4 softtabstop=4
#
# Copyright (C) 2015-2022 GEM Foundation
#
# OpenQuake is free software: you can redistribute it and/or modify it
# under the terms of the GNU Affero General Public License as published
# by the Free Software Foundation, either version 3 of the Licen... |
"""Classes that communicate the results."""
import curses
import threading
import formatter
import executor
import functools
from i18n import translate as _
# TODO: thread mutex
# TODO: cmdline_args, input, tempfile in begin_test
# TODO: help page
# TODO: summary page
# TODO: test info page
# TODO: i18n
_CALLBACKS... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.