src stringlengths 721 1.04M |
|---|
# pylint: disable=C0111,R0902,R0904,R0912,R0913,R0915,E1101
# Smartsheet Python SDK.
#
# Copyright 2018 Smartsheet.com, 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.... |
# Copyright 2018 D-Wave Systems 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... |
# This file is part of PooPyLab.
#
# PooPyLab is a simulation software for biological wastewater treatment processes using International Water Association
# Activated Sludge Models.
#
# Copyright (C) Kai Zhang
#
# PooPyLab is free software: you can redistribute it and/or modify it under the terms of the GNU Gener... |
"""
Adapters for the Parallel Python library (http://www.parallelpython.com).
The PPScheduler class uses an existing pp scheduler and is a simple adapter.
LocalPPScheduler includes the creation of a local pp scheduler.
NetworkPPScheduler includes the management of the remote slaves via SSH.
"""
from __future__ impor... |
# -*- coding: utf-8 -*-
# Resource object code
#
# Created: Mon Mar 6 11:25:14 2017
# by: The Resource Compiler for PyQt (Qt v4.8.6)
#
# WARNING! All changes made in this file will be lost!
from PyQt4 import QtCore
qt_resource_data = "\
\x00\x00\x1b\x93\
\x89\
\x50\x4e\x47\x0d\x0a\x1a\x0a\x00\x00\x00\x0d\x49\x4... |
import threading
import time
import sys
import serial
from deployment.ClientServer import Monitor, WebClient
from deployment.DBMS import TemperatureDatabase
from deployment.IO.configuration import ServerConfiguration
global id_flag
global server
def monitoring(database, lock, debug=False):
"""
this function ... |
#! /usr/bin/env python
import rospy
import roslib
roslib.load_manifest("otl_diff_drive")
from std_msgs.msg import Float64
from dynamixel_msgs.msg import JointState
class Publisher:
def __init__(self):
left_name = rospy.get_param("~left_wheel_controller")
right_name = rospy.get_param("~right_wheel... |
#!/usr/bin/env python3
#
# Generate surfaces, pins, and lattice for FastDrum Serpent deck
# Ondrej Chvala, ochvala@utk.edu
# 2016-08-02
import math
def write_surfaces(N, r, refl):
'''Function to write material cards for Serpent input deck.
Inputs:
N: size of the N x N checkerboard lattice
... |
# 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
#
# Unless required by applica... |
import json
from django.conf import settings
from django.http import HttpResponse, Http404
from django.template import RequestContext, loader
from opencontext_py.libs.general import LastUpdatedOrderedDict
from opencontext_py.libs.rootpath import RootPath
from opencontext_py.libs.requestnegotiation import RequestNegotia... |
#!/usr/bin/python
import webbrowser
import os
import datetime
def stringchecker (orig,v1):
ret = True
x = len(v1)
j=0
for j in range(0,x,1):
if(len(v1)<=len(orig)):
if orig[j].capitalize() == v1[j] or orig[j]==v1[j]:
ret = ret and True
elif orig[j] != v1[j]:
ret = ret and False
... |
# -*- coding: utf-8 -*-
#
# django-faq documentation build configuration file, created by
# sphinx-quickstart on Sat Sep 17 13:09:21 2011.
#
# This file is execfile()d with the current directory set to its containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
# ... |
############################
# Import Required Modules #
############################
import argparse
import base64
from datetime import datetime, timedelta
import httplib
import json
import numpy as np
from pytz import UTC, timezone
import random
from decimal import Decimal
import struct
import time
from time import ... |
# cosmology.py
# (formerly distance_modulus.py)
from math import log, sqrt, pi, sin, cos, exp
from nr import erffc
#from ppgplot_spb import *
from checkarray import checkarray
import scipy.integrate
import numpy as N
# WMAP 1-year results
h0_WMAP1 = 0.71
H0_WMAP1 = h0_WMAP1 * 100.0
omega_m0_WMAP1 = 0.135 / h0_WMAP1**... |
import os
import sys
import re
import textwrap
from utils import logger
def add_gae_pth(env_dir):
site_packages_dir = os.path.join(
env_dir,
'lib', 'python{0}.{1}'.format(sys.version_info.major, sys.version_info.minor),
'site-packages')
if not os.path.exists(site_packages_dir):
logger.error('Python site p... |
from .base import NullBrowser # noqa: F401
from .edge import (EdgeBrowser, # noqa: F401
EdgeDriverWdspecExecutor, # noqa: F401
check_args, # noqa: F401
browser_kwargs, # noqa: F401
executor_kwargs, # noqa: F401
env_extr... |
import logging
from cim import CIM
from cim.objects import Namespace
def main(type_, path):
if type_ not in ("xp", "win7"):
raise RuntimeError("Invalid mapping type: {:s}".format(type_))
Values = ["FolderPath", "ExplorerFileName", "FileSize", "LastUserName", "LastUsedTime", "TimeZoneOffset",
... |
#!/usr/bin/env python
from distutils.core import setup
import os
import sys
import warnings
import subprocess
import fpdf
package_dir = 'fpdf'
# convert the README and format in restructured text (only when registering)
long_desc = ""
if os.path.exists("README.md"):
try:
cmd = ['pandoc', '--from=markdow... |
# -*- coding: utf-8 -*-
'''
OpenSCAP scanner execution module.
:maintainer: Christer Edwards (christer.edwards@gmail.com)
:maturity: 20160430
:platform: Linux
:requires: SaltStack
:upstream: http://open-scap.org
This execution module uses the openSCAP scanner utility and an argument of an
XML guide. The returned dat... |
#!/usr/bin/env python3
# Copyright 2014 (C) Raster Software Vigo (Sergio Costas)
#
# This file is part of DeVeDe-NG
#
# DeVeDe-NG is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the Licens... |
import os
from numba import *
from numba import error
import numpy as np
#------------------------------------------------------------------------
# Structs as locals
#------------------------------------------------------------------------
struct_type = struct(a=char.pointer(), b=int_)
@autojit(backend='ast', loc... |
#! /usr/bin/env python3
# -*- coding: utf-8 -*-
# Copyright 2020 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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requi... |
# -*- coding: utf-8 -*-
"""
revision.history
~~~~~~~~~~~~~~~~
:copyright: (c) 2018 by SENSY Inc.
:license: MIT, see LICENSE for more details.
"""
from __future__ import absolute_import
import os
from revision.data import Revision
from revision.exceptions import InvalidArgType
__all__ = (
"Histo... |
# ----------------------------------------------------------------------------
# Copyright (c) 2016-2019, QIIME 2 development team.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file LICENSE, distributed with this software.
# ------------------------------------------------... |
###############################################################################
#
# Tests for XlsxWriter.
#
# Copyright (c), 2013-2016, John McNamara, jmcnamara@cpan.org
#
from ..excel_comparsion_test import ExcelComparisonTest
from ...workbook import Workbook
class TestCompareXLSXFiles(ExcelComparisonTest):
"""... |
# Filename: request.py
"""
LendingClub2 Request Module
Interface functions:
get
post
"""
# Standard libraries
import datetime
import time
# Requests
import requests
# Lending Club
from lendingclub2.authorization import Authorization
from lendingclub2.config import REQUEST_LIMIT_PER_SEC
from lendingclub2.er... |
from cdms2 import open as CDMS2open
from os.path import join as join_path
from os import environ
from sys import exit
#from EnsoMetrics.EnsoCollectionsLib import CmipVariables, defCollection, ReferenceObservations
#from EnsoMetrics.EnsoComputeMetricsLib import ComputeCollection
from EnsoCollectionsLib import CmipVaria... |
"""test_import.py: Functional tests for code that imports raw data from
scientists and writes data files formatted to be included in the package
distributions
"""
import re
__author__ = "Joel Dubowy"
from eflookup.fccs2ef.importer import (
Fccs2CoverTypeImporter, CoverType2EfGroupImporter,
EfGroup2EfIm... |
# -*- coding: utf-8 -*-
# Copyright 2018 OpenSynergy Indonesia
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from openerp import models, fields, api, _
from openerp.exceptions import Warning as UserError
class StockWarehouse(models.Model):
_inherit = "stock.warehouse"
missing_type_id = fie... |
from gobject import GObject, SIGNAL_RUN_FIRST
from Move import Move
from lutils.egtb_k4it import egtb_k4it
from lutils.egtb_gaviota import egtb_gaviota
providers = []
class EndgameTable(GObject):
""" Wrap the low-level providers of exact endgame knowledge. """
__gsignals__ = {
"scored": (SIGNA... |
from django import forms
from django.contrib.auth import authenticate
from django.conf import settings
from django.contrib.auth import get_user_model
from amon.apps.notifications.models import notifications_model
from amon.apps.alerts.models import alerts_model
from amon.apps.account.models import user_preferences_mod... |
import pkg_resources
from trac.core import Component, implements
from trac.admin import IAdminPanelProvider
from trac.web.chrome import add_notice, add_warning, ITemplateProvider
from trac.util.text import exception_to_unicode
SECTION_NAME = 'tochatwork'
class AdminPanel(Component):
implements(IAdmin... |
# -*- coding: utf-8 -*-
""" Sahana Eden Survey Tool
@copyright: 2011-2014 (c) Sahana Software Foundation
@license: MIT
ADAT - Assessment Data Analysis Tool
For more details see the blueprint at:
http://eden.sahanafoundation.org/wiki/BluePrint/SurveyTool/ADAT
Permission is hereby granted, fr... |
# Copyright 2019, The TensorFlow Federated 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... |
import pandas as pd
# TODO: Load up the dataset Ensuring you set the appropriate header column names
df = pd.read_csv('Datasets/servo.data')
df.columns = ['motor', 'screw', 'pgain', 'vgain', 'class']
print(df.describe())
# TODO: Create a slice that contains all entries having a vgain equal to 5. Then print the lengt... |
import math
import struct
try:
from itertools import izip_longest
except:
from itertools import zip_longest as izip_longest
from numbers import Number
class RecordBase(object):
# namedtuple-like base class. Subclasses should must __slots__
__slots__ = ()
# TODO: switch back to namedtuple, and do... |
import time
from pathlib import Path
import numpy as np
from torchvision.datasets import MNIST
import nn
import layers
DATA_DIR = Path(__file__).parent / 'datasets' / 'MNIST'
SAVE_DIR = Path(__file__).parent / 'out'
config = {}
config['max_epochs'] = 8
config['batch_size'] = 50
config['save_dir'] = SAVE_DIR
config[... |
#!/user/bin/python
import argparse
import collections
import logging
import os
import random
import sys
logging.getLogger("scapy").setLevel(1)
from scapy.all import *
parser = argparse.ArgumentParser(description="Test packet generator")
parser.add_argument('--out-dir', help="Output path", type=str, action='store', ... |
from datetime import datetime
import pandas as pd
import pytz
def annualized_weather_normal(formatter, model, weather_normal_source):
''' Annualize energy trace values given a model and a source of 'normal'
weather data, such as Typical Meteorological Year (TMY) 3 data.
Parameters
----------
for... |
# -*- coding: utf-8 -*-
import logging
from django.db.models import Q
from django.shortcuts import get_object_or_404, redirect, render
from django.contrib.auth.models import User
from .settings import User, settings
from .decorators import allowed_user_required
from .signals import session_begin, session_end
from .help... |
# pylint: disable-msg=W0401,W0511,W0611,W0612,W0614,R0201,E1102
"""Tests suite for MaskedArray & subclassing.
:author: Pierre Gerard-Marchant
:contact: pierregm_at_uga_dot_edu
"""
__author__ = "Pierre GF Gerard-Marchant"
import types
import warnings
import numpy as np
import numpy.core.fromnumeric as fromnumeric
fr... |
# -*- coding: utf-8 -*-
# <nbformat>3.0</nbformat>
# <codecell>
import matplotlib.pyplot as plt
import numpy as np
%matplotlib inline
# <headingcell level=2>
# Extract HRRR data using Unidata's Siphon package
# <codecell>
# Resolve the latest HRRR dataset
from siphon.catalog import TDSCatalog
latest_hrrr = TDSCat... |
# Copyright 2016-2018 Tal Liron
#
# 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 writin... |
import pickle
import numpy as np
import numpy.random as npr
import matplotlib.pyplot as plt
from pyglm.utils.utils import expand_scalar, compute_optimal_rotation
dim = 2
N = 20
r = 1 + np.arange(N) // (N/2.)
th = np.linspace(0, 4 * np.pi, N, endpoint=False)
x = r * np.cos(th)
y = r * np.sin(th)
L = np.hstack((x[:, Non... |
#!/usr/bin/python
# Author: Hao WANG
###############################################
# An implementation of paired bootstrap resampling for testing the statistical
# significance of the difference between two systems from (Koehn 2004 @ EMNLP)
# Specified for reordering Scores.
# Usage: ./bootstrap-resampling.py hypoth... |
# -*- coding: utf-8 -*-
"""
Showcases colour models volume and gamut plotting examples.
"""
import numpy as np
from colour.plotting import (plot_RGB_colourspaces_gamuts, plot_RGB_scatter,
colour_style)
from colour.utilities import message_box
message_box('Colour Models Volume and Gamut P... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""BufferWorkSpace module."""
import os
new_lines = ["\r\n", "\n", "\r"]
new_lines_bytes = [n.encode("ascii") for n in new_lines] # we only support encodings that's backward compat with ascii
class BufferWorkSpace:
"""It is a helper module for FileReadBackwards."... |
# (c) 2012-2014, Michael DeHaan <michael.dehaan@gmail.com>
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) an... |
import html
import base64
import datetime
import gzip
import shlex
import string
import urllib
from ..util import hexdump, printable_data, copy_to_clipboard, clipboard_contents, encode_basic_auth, parse_basic_auth
from ..console import CommandError
from io import StringIO
def print_maybe_bin(s):
binary = False
... |
# -*- coding: utf-8 -*-
import argparse
import sys
import logging
import numpy
import numpy as np
sys.path.append("../")
import itertools
import theano
import theano.tensor as T
from copy import deepcopy
class Rotrofit(object):
def __init__(self, q_old, alpha, gazs):
self.q_old = q_old
self.q_n... |
from typing import Dict, Sequence, Union
from gi.repository import Gtk
VIEW_ACCELERATORS: Dict[str, Union[str, Sequence[str]]] = {
'app.quit': '<Primary>Q',
'view.find': '<Primary>F',
'view.find-next': '<Primary>G',
'view.find-previous': '<Primary><Shift>G',
'view.find-replace': '<Primary>H',
... |
#!/usr/bin/env python
import configparser
import os
import sys
import xml.etree.ElementTree as ET
from pathlib import Path
from urllib.parse import unquote
import requests
from moviepy.editor import VideoFileClip
from requests.exceptions import ConnectionError
def generate_gif(media_path: str, time: int, size: floa... |
__author__ = 'adean'
import ConfigParser
from objects import event_action as event_action_mod
from objects import detector_rules as detector_rules_mod
class Config(object):
def __init__(self, config_file):
self.config_obj = ConfigParser.ConfigParser()
self.config_obj.read(config_file)
se... |
from math import sin, cos, radians
from time import sleep
#setup the constants
WIDTH = 500
HEIGHT = 300
BALLSPEED = 10
PADDLESPEED = 5
MAXBOUNCEANGLE = 75
def reset_game(angle):
#setup ball properties
ball.pos = WIDTH / 2, HEIGHT / 2
ball.x_float = float(ball.x)
ball.y_float = float(ball.y)
ball.... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# This file was forked from the Apache Spark project and modified. Many
# thanks to those guys for a great time-saving file.
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed wit... |
#!/usr/bin/env python3
'''Psychomotor Vigilance Task'''
#########################################################
# STAP constants and stdio
import json,sys
if 'raw_input' in vars(__builtins__): input = raw_input #Fix for Python 2.x raw_input
def send(d): print(json.dumps(d)); sys.stdout.flush()
def recv(): retur... |
import csv
from openpyxl import load_workbook
from portality.models import Journal
if __name__ == "__main__":
import argparse
parser = argparse.ArgumentParser()
parser.add_argument("-i", "--infile", help="path to SAGE spreadsheet", required=True)
parser.add_argument("-o", "--out", help="output file p... |
#!/usr/bin/env python3
"""
1.0-preprocess.py
This script preprocesses raw sequencing data in preparation for VDJ analysis. Paired end fastq
files will be filtered and merged using vsearch, or single read fastq or fasta files can be
specified. For fastq input, an optional QC analysis can be printed (from vsear... |
from abc import ABCMeta
from typing import Any, Dict, List
# pylint: disable=unused-import
from typing import Optional
# pylint: enable=unused-import
import tensorflow as tf
from neuralmonkey.dataset import Dataset
# pylint: disable=invalid-name
FeedDict = Dict[tf.Tensor, Any]
# pylint: enable=invalid-name
class F... |
import os
import sys
from setuptools import setup, find_packages
VERSION = "0.3.0"
def get_requirements():
basedir = os.path.dirname(__file__)
with open(os.path.join(basedir, 'requirements.txt')) as f:
return [l.strip() for l in f]
setup(
name="leeroy",
version=VERSION,
url="https://gith... |
"""
This is an example thingflow program that is described in tutorial.rst.
"""
# First, let's define a sensor that generates a random number each time
# it is sampled.
import random
random.seed()
from thingflow.base import SensorAsOutputThing
class RandomSensor:
def __init__(self, sensor_id, mean, stddev, sto... |
# -*-coding:Utf-8 -*
# Copyright (c) 2010 LE GOFF Vincent
# 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 copyright notice, this
# lis... |
from Config import Config
import gym
import PIL
from collections import deque
import numpy as np
class Environment(object):
def __init__(self, game="MsPacman-v0"):
self.screen_h = Config.SCREEN_H
self.screen_w = Config.SCREEN_W
self.screen_shape = Config.SCREEN_SHAPE
self.frame_pe... |
from django.conf import settings
from django.contrib import messages
from django.contrib.auth.decorators import permission_required
from django.db import transaction
from django.db.models import F, Q
from django.forms import modelformset_factory
from django.http import HttpResponse, JsonResponse
from django.shortcuts i... |
import json
from rob.base import BaseObject
class JsonObject(BaseObject):
"""
An object that does a JSON dump of the dictionary
and save it in a Redis hash.
Needs to define `HASH_KEY` - the key to the hash.
"""
def save(self):
return self.redis.hset(
self.HASH_KEY,
... |
"""
.. module:: django_core_models.location.tests.test_validation
:synopsis: location application validation unit test module.
*location* application validation unit test module.
"""
from __future__ import print_function
from django.core.exceptions import ValidationError
from django_core_utils.tests.test_utils i... |
#import os
import mne
from jumeg.jumeg_base import jumeg_base
#from jumeg.decompose.ocarta import ocarta
#from jumeg.ctps import ctps
#from jumeg import jumeg_plot
#################################################################
#
# apply epocher data
#
##################... |
#!/usr/bin/env python
# coding:utf-8
__version__ = '3.2.0'
__password__ = ''
__hostsdeny__ = () # __hostsdeny__ = ('.youtube.com', '.youku.com')
import os
import re
import time
import struct
import zlib
import base64
import logging
import urlparse
import httplib
import io
import string
import json
from BaseHTTPServ... |
from datetime import datetime, timedelta
from django.contrib.contenttypes.models import ContentType
from debugged.stream.models import StreamEntry, StreamItem
def _get_stream_item(instance):
instance_type = ContentType.objects.get_for_model(instance)
try:
s = StreamItem.objects.get(content_type=instan... |
##############################################################################
# Copyright (c) 2013-2017, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
#
# This file is part of Spack.
# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
# LLNL-CODE-64... |
#Constraining Order - a simple constraint satisfaction library
#
#Copyright (c) 2015 Johannes Reinhardt <jreinhardt@ist-dein-freund.de>
#
#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 ... |
from TorrentPython.PieceRadio import *
class PieceHunterActor(pykka.ThreadingActor):
DEFAULT_REQUEST_ORDER_SIZE = 5
def __init__(self, piece_hunter, hunting_scheduler, piece_assembler, client_id, metainfo, peer_ip, peer_port):
super(PieceHunterActor, self).__init__()
self.piece_hunter = piece... |
#!/usr/bin/python3
###############################################################################
# #
# ddns - A dynamic DNS client for IPFire #
# Copyright (C) 2012 IPFire development team ... |
# Copyright (C) 2013 Andrey Antukh <niwi@niwi.nz>
# Copyright (C) 2014-2016 Jesús Espino <jespinog@gmail.com>
# Copyright (C) 2014-2016 David Barragán <bameda@dbarragan.com>
# Copyright (C) 2014-2016 Alejandro Alonso <alejandro.alonso@kaleidos.net>
# This program is free software: you can redistribute it and/or modify
... |
"""
Enterprise SSO ID Verification tests
"""
from regression.pages.enterprise.enterprise_const import ENT_COURSE_ID, ENT_COURSE_TITLE
from regression.pages.whitelabel.basket_page import SingleSeatBasketPage
from regression.tests.enterprise.ent_test_base import EnterpriseTestBase
class TestEnterpriseSSOIDVerification... |
#
# 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 writing, software
# ... |
# -*- coding: utf-8 -*-
#
# Copyright 2017-2020 BigML
#
# 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... |
#Program using word problems to demonstrate math and number operators
print("If a 2000 pound pregnant hippo gives birth to a 100 pound calf,")
print("but then eats 50 pounds of food, how much does she weigh?")
input("Press the enter key to find out.")
print("2000 - 100 + 50 = ", 2000 - 100 + 50)
print("\nIf an advent... |
import json
import os
import shutil
from lxml import etree as ET
from mets_dnx.factory import (
build_mets,
build_single_file_mets,
build_mets_from_json)
# declare namespaces
DC_NS = "http://purl.org/dc/elements/1.1/"
DCTERMS_NS = "http://purl.org/dc/terms/"
XSI_NS = "http://www.w3.org/2001/XMLSchema-in... |
"""
Utilities for importing data
See example usage at the bottom.
"""
import json
from Util import Util
class ApiForm:
"""
Handles interaction with the Catalog databaseq
"""
def __init__(self, catalog_client):
self.catalog_client = catalog_client
def delete_api_by_dbid(self, dbid):
... |
from gbdxtools import Interface
from gbdxtools.s3 import S3
from auth_mock import get_mock_gbdx_session
import vcr
import os
import tempfile
import unittest
"""
How to use the mock_gbdx_session and vcr to create unit tests:
1. Add a new test that is dependent upon actually hitting GBDX APIs.
2. Decorate the test with ... |
#!/usr/bin/env python3
"""
Additional commands to add to the CLI beyond the OpenAPI spec.
"""
from __future__ import print_function
import functools
import operator
import os
import sys
import time
import click
import requests
import webbrowser
import civis
from civis.io import file_to_civis, civis_to_file
# From ... |
# -*- coding: iso-8859-1 -*-
from enigma import eConsoleAppContainer
from Components.Console import Console
from Components.About import about
from Components.PackageInfo import PackageInfoHandler
from Components.Language import language
from Components.Sources.List import List
from Components.Ipkg import IpkgComponent... |
# coding: utf-8
from __future__ import unicode_literals
import pytest
from porridge.utils import ensure_bytes, b64_decode_raw, b64_encode_raw
raw_b64_string = pytest.mark.parametrize('raw_b64_string', [
('YQ', b'a'),
('YWE', b'aa'),
('YWFh', b'aaa'),
('', b''),
('AA==', b'\x00'),
('AA', b'\x... |
"""LabeledDataset for labeled datasets"""
import numpy as np
import ankura.pipeline
def get_labels(filename):
"""Since labels are assumed to be normalized from 0 to 1 in computing the
augmented Q matrix, this function will scale all labels to fit this range
"""
smallest = float('inf')
largest = fl... |
#
# Copyright (c) 2013 Markus Eliasson, http://www.quarterapp.com/
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use... |
from externals.moduleman.plugin import moduleman_plugin
import itertools
class piterator_void:
text="void"
def count(self):
return self.__count
def __init__(self, *i):
self._dic = i
self.__count = max(map(lambda x:x.count(), i))
self.it = self._dic[0]
def next(self):... |
from __future__ import division
import collections
import re
import sector
import vector3
# "Imagine the galaxy is a giant slice of Battenberg
# which for reasons beyond our ken has had small chunks
# of carrot cake pushed into it all over the place..."
# - CMDR Jackie Silver
# This does not validate sector name... |
# -* coding: utf-8 -*-
import tornado.web
import json
import traceback
import numpy as np
import random
import contextlib
from db.database import Database
from numpy.random.mtrand import _rand as global_randstate
global numpy
class ExceptionHandler(tornado.web.HTTPError):
pass
class BaseHandler(tornado.web.Req... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""Western Digital Hardware Controller Client.
Copyright (c) 2017 Michael Roland <mi.roland@gmail.com>
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, ... |
# -*- coding: utf-8 -*-
#
# This file is part of Glances.
#
# Copyright (C) 2015 Nicolargo <nicolas@nicolargo.com>
#
# Glances is free software; you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation, either version 3 of the Lic... |
"""
The Protocol object relays the client request, accumulates the server response
data, and combines it with the cached. From there the Response object
reads this to the client.
"""
import calendar, os, time, socket, re
import Params, Runtime, Response, Resource, Rules
import HTTP
#from util import *
import log
ma... |
"""
NotificationChannelProvider to integrate with the Urban Airship mobile push
notification services
"""
import json
import logging
import six
import requests
from requests.auth import HTTPBasicAuth
from requests.exceptions import RequestException
from edx_notifications.channels.channel import BaseNotificationChan... |
import logging
from pathlib import Path
import threading
from watchdog.observers import Observer
from sqlalchemy.orm.exc import NoResultFound
from osfoffline import utils
from osfoffline.utils.authentication import get_current_user
from osfoffline.exceptions import NodeNotFound
from osfoffline.sync.ext.watchdog impor... |
from typing import cast
import requests
from .. import CachingSession
from ..cache import MemoryCache, FileCache, SQLiteCache, CacheStorageBase
DUMMY_URL = "http://dummy/"
HTTPBIN = "http://httpbin.org/"
def test_default_key_for_request() -> None:
cs = CachingSession()
# non-get methods
for method in ("... |
#!/usr/bin/env python
#
# Copyright 2011 Tjerk Santegoeds
#
# 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 applicabl... |
# -*- coding: utf-8 -*-
import os
# two dimensional FFT example
# following
# http://matlabgeeks.com/tips-tutorials/how-to-do-a-2-d-fourier-transform-in-matlab/
import matplotlib.cm
import pylab
import numpy
import math
# get the figure
f = pylab.imread("luna_bw.png")
# two dimension FFT -- F is complex
F = numpy... |
import hippiehug
from hippiehug.Utils import binary_hash
from .encodings import ensure_binary
# TODO: Move to hippiehug 1.0
# TODO: Move the tests out of doctests
class Blob(bytes):
@property
def hid(self):
return binary_hash(self)
def _check_hash(key, value):
if value.hid != key:
rai... |
# -*- coding: utf-8 -*-
# Generated by Django 1.9 on 2015-12-23 13:39
from __future__ import unicode_literals
from django.conf import settings
import django.contrib.postgres.fields.jsonb
from django.db import migrations, models
import django.db.models.deletion
import uuid
class Migration(migrations.Migration):
... |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2007-2013 Edgewall Software
# Copyright (C) 2007 Eli Carter <retracile@gmail.com>
# All rights reserved.
#
# This software is licensed as described in the file COPYING, which
# you should have received as part of this distribution. The terms
# are also available at http://trac.... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.