gt stringclasses 1
value | context stringlengths 2.49k 119k |
|---|---|
"""
Helper classes for handling file trasfers
"""
import logging
import os
import shutil
import subprocess
from taca.utils.filesystem import create_folder
from taca.utils.misc import hashfile, call_external_command
logger = logging.getLogger(__name__)
class TransferAgent(object):
"""
(Abstract) supe... | |
'''
------------------------------------------
Red9 Studio Pack: Maya Pipeline Solutions
Author: Mark Jackson
email: rednineinfo@gmail.com
Red9 blog : http://red9-consultancy.blogspot.co.uk/
MarkJ blog: http://markj3d.blogspot.co.uk
------------------------------------------
This is the main unittest for the Red9_Met... | |
# Copyright (c) 2011 OpenStack Foundation
# Copyright 2013 IBM 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... | |
#!/usr/bin/python
import sys
from copy import deepcopy
import rospy
import rospkg
import baxter_interface
from geometry_msgs.msg import (
PoseStamped,
Pose,
Point,
# Quaternion,
)
from std_msgs.msg import Header
from baxter_core_msgs.srv import (
SolvePositionIK,
SolvePositionIKRequest,
)
cla... | |
""" An implementation of the paper "A Neural Algorithm of Artistic Style"
by Gatys et al. in TensorFlow.
Author: Chip Huyen (huyenn@stanford.edu)
Prepared for the class CS 20SI: "TensorFlow for Deep Learning Research"
For more details, please read the assignment handout:
http://web.stanford.edu/class/cs20si/assignment... | |
from __future__ import absolute_import, division
from desispec.io import read_frame
from desispec.io import read_fiberflat
from desispec.io import read_sky
from desispec.io import shorten_filename
from desispec.io.fluxcalibration import read_stdstar_models
from desispec.io.fluxcalibration import write_flux_calibrati... | |
# Copyright 2015 TellApart, Inc.
#
# 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... | |
import os
import string
from itertools import chain
from django.conf import settings
from django.contrib.auth.hashers import mask_hash
from django.contrib.postgres.fields import ArrayField
from django.contrib.postgres.forms import SimpleArrayField
from django.core.validators import MinValueValidator, MaxValueValidator... | |
import colorsys
import itertools
import json
import zlib
from collections import defaultdict, namedtuple
from operator import attrgetter
from django.db import transaction
from django.db.models import Sum, Min, Max
from django.shortcuts import render, get_object_or_404, redirect
from django.views.decorators.csrf import... | |
from sympy import (limit, exp, oo, log, sqrt, Limit, sin, floor, cos, ceiling,
atan, gamma, Symbol, S, pi, Integral, cot, Rational, I, zoo,
tan, cot, integrate, Sum)
from sympy.abc import x, y, z
from sympy.utilities.pytest import XFAIL, raises
from sympy.utilities.iterables impor... | |
"""Reorder the declarations in a header so that all dependencies
are met.
Author: Peter Goodman (peter.goodman@gmail.com)
Copyright: Copyright 2012-2013 Peter Goodman, all rights reserved.
"""
import sys
import collections
from cparser import *
parser = CParser()
seen = set()
COMPOUNDS = set()
CHANGED = Fa... | |
# Lint as: python2, python3
# Copyright 2019 The TensorFlow Authors. 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
#
... | |
"""
MySQL database backend for Django.
Requires MySQLdb: http://sourceforge.net/projects/mysql-python
"""
from django.db.backends import util
try:
import MySQLdb as Database
except ImportError, e:
from django.core.exceptions import ImproperlyConfigured
raise ImproperlyConfigured, "Error loading MySQLdb mo... | |
# -*- coding: utf-8 -*-
"""
Base model container.
Provides a base model container, used by the Pyramid traversal
machinery and a mixin to aid with traversal from an instance
back up the tree.
"""
__all__ = [
"BaseModelContainer",
"InstanceTraversalMixin",
]
import re
import logging
from zope.interface impo... | |
"""
Copyright (c) 2014 Dan Obermiller
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, merge, publish, distribute,... | |
# file django/forms/fields.py
#
# Copyright 2010 Emory University General Library
#
# 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
... | |
# -*- coding: utf-8 -*-
import wabbit_wappa as _wabbit_wappa
from math import exp
import copy
from collections.abc import Mapping
class Namespace(_wabbit_wappa.Namespace):
"""
A subclass of wabbit wappa Namespace that allows one to set
features from a dictionary
"""
def add_features(self, feature... | |
# Natural Language Toolkit: Plaintext Corpus Reader
#
# Copyright (C) 2001-2013 NLTK Project
# Author: Edward Loper <edloper@gradient.cis.upenn.edu>
# URL: <http://www.nltk.org/>
# For license information, see LICENSE.TXT
"""
Corpus reader for the XML version of the British National Corpus.
"""
__docformat__ = 'epytex... | |
import numpy
import six
import chainer
from chainer import backend
from chainer.backends import cuda
from chainer.backends import intel64
from chainer import function
from chainer import function_node
from chainer.utils import type_check
import chainerx
def _extract_gates(x):
r = x.reshape((len(x), x.shape[1] //... | |
# encoding: utf-8
import datetime
from south.db import db
from south.v2 import DataMigration
from django.db import models
class Migration(DataMigration):
def forwards(self, orm):
orm.UserWarning.objects.all().delete()
def backwards(self, orm):
"Write your backwards methods here."
model... | |
import os
from os.path import dirname, join
from collections import OrderedDict
import pandas as pd
import numpy as np
from bokeh.io import curdoc
from bokeh.layouts import row, widgetbox, column
from bokeh.models import Select, Div, Column, HoverTool, ColumnDataSource, Button, CheckboxButtonGroup
from bokeh.plotting... | |
#!/usr/bin/env python2.6
# -*- cpy-indent-level: 4; indent-tabs-mode: nil -*-
# ex: set expandtab softtabstop=4 shiftwidth=4:
#
# Copyright (C) 2012,2013 Contributor
#
# 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... | |
# Copyright 2015-2018 Capital One Services, LLC
#
# 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 ... | |
# Copyright 2012 Josh Durgin
# Copyright 2013 Canonical Ltd.
# 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/LICENS... | |
#!/usr/bin/python
import csv
#import classes
from node import Node
from condition import Condition
from nodelist import NodeList
from flowPrinter import FlowPrinter
#1. Parse from CSV
#2. Create Node from Parse object - store in list
#3. Iterate the list and inject the path accordingly
#4. Generate Flow
#**GLOBAL
I... | |
# 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 applicable law or agreed to in... | |
#!/usr/bin/env python
# -*- mode: python; encoding: utf-8 -*-
"""Tests for Interrogate."""
import socket
from grr.client.client_actions import admin
from grr.lib import action_mocks
from grr.lib import aff4
from grr.lib import artifact_test
from grr.lib import client_index
from grr.lib import config_lib
from grr.lib... | |
from unittest import TestCase, main
from uritemplate import URITemplate, expand, partial
from uritemplate import variable
def merge_dicts(*args):
d = {}
for arg in args:
d.update(arg)
return d
class RFCTemplateExamples(type):
var = {'var': 'value'}
hello = {'hello': 'Hello World!'}
p... | |
###############################################################################
##
## Copyright (C) 2013-2014 Tavendo GmbH
##
## 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
##
## h... | |
# -*- coding: utf-8 -*-
#
# 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 "L... | |
import six
import click
from ns1cli.cli import State, write_options
from ns1cli.util import Formatter
from nsone.rest.resource import ResourceException
class RecordFormatter(Formatter):
def print_record(self, rdata):
ans = rdata.pop('answers')
fil = rdata.pop('filters')
reg = rdata.pop('... | |
import os
import textwrap
import warnings
import glob
import numpy as np
from astropy.table import Table, join
from astropy.io import fits
import astropy.units as u
from spectral_cube import SpectralCube
from . import catalogs
from scipy.ndimage import binary_opening
import aplpy
from config import plottingDictionary
... | |
# -*- coding: utf-8 -*-
'''This module provides a registry for skos providers.
This registry helps us find providers during runtime. We can also apply some
operations to all or several providers at the same time.
'''
import logging
log = logging.getLogger(__name__)
from .uri import is_uri
class RegistryException(... | |
"""
Execute raw graph to ATerm after inference but before evaluation.
"""
import string
import numpy as np
from collections import namedtuple
from blaze.datashape.coretypes import DataShape
from blaze.byteproto import CONTIGUOUS, READ
from blaze.expr.paterm import AAppl, ATerm, AAnnotation, AString, AInt, AFloat
fr... | |
from test.test_support import verify, TestFailed, check_syntax, vereq
import warnings
warnings.filterwarnings("ignore", r"import \*", SyntaxWarning, "<string>")
print "1. simple nesting"
def make_adder(x):
def adder(y):
return x + y
return adder
inc = make_adder(1)
plus10 = make_adder(10)
vereq(inc... | |
from Firefly import logging
from Firefly.const import (EVENT_ACTION_ANY, EVENT_ACTON_TYPE, TIME)
from typing import List
class Subscriptions(object):
"""Subscriptions.
Subscriptions should be stored like so:
{ DEVICE_SUBSCRIBED_TO: {EVENT_ACTION: [LIST_OF_SUBSCRIBERS], ...} }
"""
# TODO: Add functionality... | |
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
Created on Thu Jul 27 14:23:25 2017
@author: gtucker
"""
import numpy as np
from numpy.testing import assert_equal
from landlab import RasterModelGrid
from landlab.components import ErosionDeposition, FlowAccumulator
def test_erodep_slope_area_small_vs():
"""T... | |
import hashlib
import logging
from datetime import datetime
from django.db.backends.utils import strip_quotes
from django.db.models import Index
from django.db.transaction import TransactionManagementError, atomic
from django.utils import timezone
from django.utils.encoding import force_bytes
logger = logging.getLogg... | |
"""
a decorated KazooClient with handy operations on a ZK datatree and its znodes
"""
from contextlib import contextmanager
import os
import re
import socket
import sre_constants
import time
from kazoo.client import KazooClient, TransactionRequest
from kazoo.exceptions import NoAuthError, NoNodeError
from kazoo.protoc... | |
#!/usr/bin/env python
import numpy as np
import sys
# import string
__all__ = ['tokenizeline', 'guesstype', 'guessarraytype']
def tokenizeline(line, delimitter="", ignorestrings="#", prependstring=None,
format='list'):
"""
splits the string line into two substrings before and after the
... | |
"""Test the Xiaomi Miio config flow."""
from unittest.mock import Mock, patch
from construct.core import ChecksumError
from micloud.micloudexception import MiCloudAccessDenied
from miio import DeviceException
import pytest
from homeassistant import config_entries, data_entry_flow
from homeassistant.components import ... | |
# -*- coding: utf-8 -*-
from flask import Flask, request, jsonify
from flask.ext.basicauth import BasicAuth
from .database import AppDatabase
from .storage import InstanceStorage, InstanceNotFound
from .models import canonicalize_db_name
import plans
app = Flask('postgresapi')
app.config.from_pyfile('application.cfg... | |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may ... | |
#!/usr/bin/python
# -*- coding: utf-8 -*-
import sys
import random, time
from PIL import Image, ImageTk
from Tkinter import Tk, Frame, Canvas, ALL, NW
WIDTH = 300
HEIGHT = 300
DELAY = 100
DOT_SIZE = 10
ALL_DOTS = WIDTH * HEIGHT / (DOT_SIZE * DOT_SIZE)
RAND_POS = 27
RESIZE = 5, 5
x = [0] * ALL_DOTS
y = [0] * ALL_DO... | |
import falcon
import bcrypt
import base64
from db import User, Session
from sqlalchemy import exc
import smtplib
from email.mime.text import MIMEText
from random import randint
import datetime
def unauthorized_user(req):
req.context['user'] = None
description = "User was not found in database"
title = "Una... | |
# vim: set fileencoding=utf-8:
#
# GPIO Zero: a library for controlling the Raspberry Pi's GPIO pins
#
# Copyright (c) 2016-2021 Dave Jones <dave@waveform.org.uk>
# Copyright (c) 2019 Ben Nuttall <ben@bennuttall.com>
# Copyright (c) 2016-2019 Andrew Scheller <github@loowis.durge.org>
# Copyright (c) 2018 Philippe Mulle... | |
# the entire process of aligning and calculating bias
# parameters
# - donor: fasta file of target
# - reference: fasta file of reference
# - fastq: fastq files
import argparse
import os
import random
import bio
import config
def run( cmd ):
'''
run a system command
'''
bio.log_stderr( cmd )
os.system( ... | |
try:
import json
except ImportError:
import simplejson as json
import logging
import time
import requests
from flask import request, render_template, redirect, url_for, flash, session
from pegasus.metrics import app, db, loader, forms
log = logging.getLogger(__name__)
MAX_CONTENT_LENGTH = 16*1024
@app.befor... | |
#!/usr/bin/env python
# Copyright (c) 2016 Google Inc.
# 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 ... | |
#!/usr/bin/env python
#
# Copyright 2010 Google Inc. 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 require... | |
from __future__ import unicode_literals
from django.contrib.auth import get_user_model
from django.contrib.auth.models import Group, Permission
from django.test import TestCase
from guardian.shortcuts import assign_perm
from guardian.shortcuts import get_groups_with_perms
from guardian.shortcuts import get_objects_fo... | |
import pytest
import datetime
import csv
from io import StringIO
from random import random
import time
from api.base.settings.defaults import API_BASE, DEFAULT_ES_NULL_VALUE
from osf_tests.factories import (
InstitutionFactory,
AuthUserFactory,
)
from osf.metrics import UserInstitutionProjectCounts
from api.b... | |
# Copyright 2012,2013 James McCauley
#
# 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 writ... | |
import os
import pytest
import pip.baseparser
from pip import main
from pip import cmdoptions
from pip.basecommand import Command
from pip.commands import commands
class FakeCommand(Command):
name = 'fake'
summary = name
def main(self, args):
index_opts = cmdoptions.make_option_group(
... | |
# Client for the DICT protocol (RFC2229)
#
# Copyright (C) 2002 John Goerzen
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) ... | |
# Copyright 2018 The TensorFlow Authors. 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 applica... | |
#
# 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"); you may not us... | |
import os
import uuid
import httplib
import datetime
import jwe
import jwt
import furl
from flask import request
from flask import redirect
from flask import make_response
from modularodm.exceptions import NoResultsFound
from modularodm import Q
from framework import sentry
from framework.auth import cas
from framewo... | |
import gobject
import gobject.constants
import weakref
from inspect import getmembers, ismethod
from weak import weak_connect
from util import append_attr
SSIGNAL = gobject.SIGNAL_RUN_LAST | gobject.SIGNAL_NO_RECURSE | gobject.SIGNAL_ACTION
SACTION = gobject.SIGNAL_RUN_LAST | gobject.SIGNAL_ACTION
def attach_signal_... | |
import getpass
import gzip
import os
import shutil
import socket
import time
from pygresql import pg
from gppylib import gplog
from gppylib.commands.base import WorkerPool, Command, ExecutionError
from gppylib.commands.gp import Psql
from gppylib.commands.unix import Scp
from gppylib.utils import shellEscape
from gppy... | |
import matplotlib.pyplot as plt
import numpy as np
from matplotlib import dates
from matplotlib import patches
import os
import pickle
from datetime import datetime
import time
from pprint import pprint
import sys
from datetime import timedelta
from netCDF4 import Dataset
import numpy.ma as ma
from mpl_toolkits.basemap... | |
__description__ = \
"""
Control an automatic door via an arudino interface. The arduino is expected to
have an "open" sensor, a "closed" sensor, and an ambient light sensor.
"""
__author__ = "Michael J. Harms"
__date__ = "2017-09-23"
import PyCmdMessenger
import serial
import os, time, logging
class DoorException(... | |
import re
from lib import BaseTest
class CreateMirror1Test(BaseTest):
"""
create mirror: all architectures + all components
"""
runCmd = "aptly mirror create --ignore-signatures mirror1 http://mirror.yandex.ru/debian/ wheezy"
def check(self):
self.check_output()
self.check_cmd_ou... | |
"""
:class:`.OpenCage` is the Opencagedata geocoder.
"""
from geopy.compat import urlencode
from geopy.geocoders.base import Geocoder, DEFAULT_TIMEOUT, DEFAULT_SCHEME
from geopy.exc import (
GeocoderQueryError,
GeocoderQuotaExceeded,
)
from geopy.location import Location
from geopy.util import logger
__all__... | |
# Copyright 2013 Hewlett-Packard Development Company, L.P.
#
# Author: Kiall Mac Innes <kiall@hp.com>
#
# 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/L... | |
"""Support for Google Actions Smart Home Control."""
import asyncio
from datetime import timedelta
import logging
from uuid import uuid4
from aiohttp import ClientError, ClientResponseError
from aiohttp.web import Request, Response
import jwt
# Typing imports
from homeassistant.components.http import HomeAssistantVie... | |
#!/usr/bin/env python3
from pathlib import Path
from configparser import RawConfigParser
from collections import OrderedDict
import itertools
import json
from collections import defaultdict
import os
print('parsing babel language mapping')
import sqlite3
DB = sqlite3.connect(':memory:')
class Row(sqlite3.Row):
def ... | |
#!/usr/bin/env python
"""
SlipStream Client
=====
Copyright (C) 2014 SixSq Sarl (sixsq.com)
=====
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-... | |
# -*- coding: utf-8 -*-
#
# This file is part of Invenio.
# Copyright (C) 2015-2018 CERN.
#
# Invenio is free software; you can redistribute it and/or modify it
# under the terms of the MIT License; see LICENSE file for more details.
"""Test case for views."""
import time
import pytest
from flask import url_for
from... | |
import datetime
from itertools import chain, product
import json
import re
from urllib.parse import urlparse
from flask import current_app
from sqlalchemy import desc
from mock import ANY
import pytest
from dmtestutils.comparisons import AnyStringMatching, AnySupersetOf, RestrictedAny
from app import db
from app.mo... | |
#!/usr/bin/env python2.5
#
# Copyright 2009 the Melange authors.
#
# 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 applic... | |
"""
Tests for dataset creation
"""
import random
import math
import unittest
import os
import numpy as np
import deepchem as dc
try:
import torch # noqa
PYTORCH_IMPORT_FAILED = False
except ImportError:
PYTORCH_IMPORT_FAILED = True
def load_solubility_data():
"""Loads solubility dataset"""
current_dir = o... | |
"""DHCPv4 options part5"""
# pylint: disable=invalid-name,line-too-long
import pytest
import srv_msg
import srv_control
import misc
@pytest.mark.v4
@pytest.mark.options
def test_v4_options_nisplus_domain_name():
misc.test_setup()
srv_control.config_srv_subnet('192.168.50.0/24', '192.168.50.1-192.168.50.10... | |
"""The tests for the Netatmo climate platform."""
from unittest.mock import Mock, patch
import pytest
from homeassistant.components.climate import (
DOMAIN as CLIMATE_DOMAIN,
SERVICE_SET_HVAC_MODE,
SERVICE_SET_PRESET_MODE,
SERVICE_SET_TEMPERATURE,
SERVICE_TURN_OFF,
SERVICE_TURN_ON,
)
from home... | |
# Copyright 2015-2018 Capital One Services, LLC
#
# 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 ... | |
#!/usr/bin/env python
"""
A library for computing local K function for network-constrained data
Author:
Andrew Winslow Andrew.Winslow@asu.edu
Myunghwa Hwang mhwang4@gmail.com
"""
import unittest
import numpy as np
import geodanet.network as pynet
import geodanet.kfuncs as pykfuncs
import geodanet.simulator as pysim
... | |
# coding:utf-8
import argparse
import logging
import os
import re
import time
import urlparse
from config import config
import requests
import torndb
class Error(Exception):
"""Base class for exceptions in this module."""
pass
class DownloadError(Error):
def __init__(self, code, message):
sel... | |
# Copyright 2012 OpenStack Foundation
#
# 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... | |
# Copyright 2017 The TensorFlow Authors. 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 applica... | |
"""Test script for ftplib module."""
# Modified by Giampaolo Rodola' to test FTP class, IPv6 and TLS
# environment
import ftplib
import asyncore
import asynchat
import socket
import io
import errno
import os
import threading
import time
try:
import ssl
except ImportError:
ssl = None
from unittest import Test... | |
#!/usr/bin/env python3
# Copyright (c) 2014-2018 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test the fundrawtransaction RPC."""
from decimal import Decimal
from test_framework.test_framework imp... | |
#! /usr/bin/env python
import shlex, argparse, cmd
import logging
import random, time, os, sys
import multiprocessing
import signal
################################################################
class Conversions(object):
"""Support conversions of storage units with SI-ish units."""
import re as _re
... | |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright 2019 Google LLC
#
# 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless requir... | |
# Copyright 2016 The TensorFlow Authors. 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 applica... | |
from unittest import TestCase
import os
from zope.interface import verify
from filesystems import exceptions, interfaces
from filesystems._path import Path, RelativePath
class TestPath(TestCase):
def test_div(self):
self.assertEqual(Path("a") / "b" / "c", Path("a", "b", "c"))
def test_div_nonsense(... | |
#!/usr/bin/env python
import vtk
import numpy as np
from vmtk import vmtkscripts
from vmtk import vtkvmtk
import argparse
import itertools
import os
def close_cell(section):
#assume the cell array of lines
section.BuildCells()
section.BuildLinks()
numberOfLinePoints = section.GetNumberOfPoints()
... | |
'''
module: utils.py
use: contains functions associated with general functionality that are not unique to any particular part of the project
'''
import numpy as np
#from scipy.stats import mode #this isnt actually used i think
def getDifferenceArray(vector):
'''
Purpose:
Takes an m by n vector and returns a sym... | |
# Copyright 2022 Google LLC. 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 applicable law o... | |
# -*- coding: utf-8 -*-
"""
pygments.lexers.textfmts
~~~~~~~~~~~~~~~~~~~~~~~~
Lexers for various text formats.
:copyright: Copyright 2006-2014 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
import re
from pygments.lexer import RegexLexer, bygroups
from pygments.to... | |
"""
Metadata for four-body terms listed in alphabetical order
Each functional_form has the following values:
- form: The overall mathematical expression of the term
- parameters: The ordered name of the terms as they will be stored with their expected unit contexts
- units: A dictionary that contains the unit co... | |
from typing import Any, Dict, List, Union
from unittest import mock
import orjson
from zerver.lib.actions import (
do_remove_realm_custom_profile_field,
do_update_user_custom_profile_data_if_changed,
try_add_realm_custom_profile_field,
try_reorder_realm_custom_profile_fields,
)
from zerver.lib.externa... | |
import appengine_config
import json
import logging
import uuid
import GlobalUtilities as tools
import spreadsheet_pipelines
from google.appengine.api import taskqueue, memcache
from google.appengine.ext import deferred
# Cloud Endpoints
import endpoints
from protorpc import remote
from endpoints_messages import *
#... | |
#Copyright ReportLab Europe Ltd. 2000-2004
#see license.txt for license details
#history http://www.reportlab.co.uk/cgi-bin/viewcvs.cgi/public/reportlab/trunk/reportlab/pdfbase/ttfonts.py
"""TrueType font support
This defines classes to represent TrueType fonts. They know how to calculate
their own width and how to w... | |
#!/usr/bin/python
# -*- coding: utf-8 -*-
import json
import logging
import time
import redis
import redis.exceptions
import MySQLdb
import config
import data
import exceptions
import log
class Db(object):
db_mem = None
db_mem_posts = None
db_disk_posts = None
db_cursor = None
retries = 360
... | |
# -*- coding: utf-8 -*-
import sys
sys.path[0:0] = [""]
import unittest
from mongoengine import *
from mongoengine.connection import get_db
__all__ = ("GeoFieldTest", )
@unittest.skip("geo fields not implemented")
class GeoFieldTest(unittest.TestCase):
def setUp(self):
connect(db='mongoenginetest')
... | |
# Copyright 2018 The TensorFlow Probability Authors.
#
# 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 o... | |
# Copyright (C) 2012 Apple. 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 the follo... | |
"""
Test the fastica algorithm.
"""
import itertools
import warnings
import numpy as np
from scipy import stats
from sklearn.utils.testing import assert_almost_equal
from sklearn.utils.testing import assert_array_almost_equal
from sklearn.utils.testing import assert_true
from sklearn.utils.testing import assert_less
... | |
from collections import defaultdict
from pathlib import Path as p
import rdflib
from rdflib import *
from ilxutils.tools import open_pickle, create_pickle
from ilxutils.interlex_sql import IlxSql
import pickle
import os
from typing import *
class rdfGraph(Graph):
''' Adds needed functions to rdflib.Graph '''
... | |
#!/usr/bin/env python
import os, sys, time, datetime, codecs, shutil, subprocess, re, math, base64
from stat import *
from tiapp import *
from xml.dom.minidom import parseString
# mako and simplejson are in support/common
this_dir = os.path.dirname(os.path.abspath(__file__))
common_dir = os.path.join(os.path.dirname(... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.