text stringlengths 17 737k |
|---|
"""
mod_ci Controllers
===================
In this module, we are trying to maintain all functionality related
running virtual machines, starting and tracking tests.
"""
import hashlib
import json
import os
import shutil
import sys
import requests
import datetime
from flask import Blueprint, request, abort, g, url_f... |
#!/usr/bin/env python
#
#
import sys
#
# Use scipy to integrate:
#
# dy^2 / dt^2 = -g + r (dh/dt)^2 (object falling with drag)
#
from scipy.linalg import det, solve
from scipy.integrate import odeint
import scipy.stats
import numpy as np
def deriv(h,t,param):
"""return derivatives of the array y"""
g = 9.8... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""
(C) Copyright [2014] InfoSec Consulting, 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 requir... |
import os.path
import sys
import re
import cx_Oracle
from django.db import connection, models
from django.db.backends.util import truncate_name
from django.core.management.color import no_style
from django.db.backends.oracle.base import get_sequence_name
from django.db.models.fields import NOT_PROVIDED
fro... |
"""
Module containing a collection of detector functions used by the
Measurement Control.
"""
import traceback
import numpy as np
from copy import deepcopy
import time
from string import ascii_uppercase
from pycqed.analysis import analysis_toolbox as a_tools
from pycqed.utilities.timer import Timer, TimedMetaClass
from... |
import unittest
from lambdazen import zen
class GivenAZenDecorator(unittest.TestCase):
def test_It_creates_functions_from_alternate_lambda_syntax(self):
@zen
def lambdaContainer():
lambdaContainer.func = (x) > x + 1
def emptyFunction():
pass
self.assertTru... |
#!/usr/bin/env python
""" Minibook: the Facebook(TM) status updater
(C) 2009 Gergely Imreh <imrehg@gmail.com>
"""
VERSION = '0.1.0'
APPNAME = 'minibook'
MIT = """
Copyright (c) 2009 Gergely Imreh <imrehg@gmail.com>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and assoc... |
#!/usr/bin/env python
"""
This module provides classes that define a chemical reaction.
"""
from __future__ import division
__author__="Shyue Ping Ong, Anubhav Jain"
__copyright__ = "Copyright 2011, The Materials Project"
__version__ = "1.0"
__maintainer__ = "Shyue Ping Ong"
__email__ = "shyue@mit.edu"
__status__ = ... |
# coding: utf-8
from __future__ import division, unicode_literals, print_function
"""
Input sets for VASP GW calculations
Single vasp GW work: Creates input and jobscripts from the input sets for a specific job
"""
__author__ = "Michiel van Setten"
__copyright__ = " "
__version__ = "0.9"
__maintainer__ = "Michiel v... |
#!/usr/bin/env python
__author__ = 'Thomas R. Lennan, Michael Meisinger'
__license__ = 'Apache 2.0'
from pyon.datastore.datastore import DataStore
COUCHDB_CONFIGS = {
DataStore.DS_PROFILE.OBJECTS:{
'views': ['object','association']
},
DataStore.DS_PROFILE.RESOURCES:{
'views': ['resource'... |
# -*- coding: utf-8 -*-
"""
This is a template for a pysat.Instrument support file.
Modify this file as needed when adding a new Instrument to pysat.
This is a good area to introduce the instrument, provide background
on the mission, operations, instrumenation, and measurements.
Also a good place to provide contact i... |
##########################################################################
#
# Copyright (c) 2012, John Haddon. All rights reserved.
# Copyright (c) 2013, Image Engine Design Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that ... |
#!/usr/bin/python
#
# This is a 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) any later version.
#
# This Ansible library is distributed in the hope that i... |
# -*- coding: utf-8 -*-
# Copyright(C) 2012 Roger Philibert
#
# This file is part of weboob.
#
# weboob 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 op... |
#
# Copyright 2016 The BigDL 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 or agreed to in ... |
"""
Support to use flic buttons as a binary sensor.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/binary_sensor.flic/
"""
import logging
import threading
import voluptuous as vol
import homeassistant.helpers.config_validation as cv
from homeassistant.... |
"""
ARCHES - a program developed to inventory and manage immovable cultural heritage.
Copyright (C) 2013 J. Paul Getty Trust and World Monuments Fund
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 Founda... |
import json
import os
import sys
import django
from bs4 import BeautifulSoup
from django.db.models import Q
if '__file__' in locals():
sys.path.append(os.path.join(os.path.dirname(__file__), os.path.pardir))
django.setup()
from article.models import Article
from core.models import AffixImage
from django.conf im... |
# !/usr/bin/env python
# -*- coding: utf-8 -*-
from bs4 import BeautifulSoup
import requests
import json
from podgen import Media, Podcast, Person, Category
from datetime import datetime
import traceback
import pytz
class Ximalaya():
def __init__(self, album_id):
self.podcast = None
self.album_id ... |
"""
Module that performs some nonequispaced ffts using the nfft C library.
This module is made for simulation of diffraction
patterns and is not intended for general use.
"""
import pylab
import nfft_c as _nfft_c
def nfft1d(coordinates, vin):
"""
Performs a 1d nonequispaced fft.
Input:
coordinates :... |
"""
Support for Radio Thermostat wifi-enabled home thermostats.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/climate.radiotherm/
"""
import datetime
import logging
import voluptuous as vol
from homeassistant.components.climate import ClimateDevice, P... |
# Orca
#
# Copyright 2005-2009 Sun Microsystems Inc.
#
# This library 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 2.1 of the License, or (at your option) any later version.
#
# This... |
from database.main import session
from models.misc.levelup_stats import LevelUpStats
from models.misc.level_xp_requirement import LevelXpRequirement
from decorators import run_once
from utils.helper import parse_int
@run_once
def load_character_level_stats() -> dict:
"""
Return a dictionary holding informatio... |
#!/usr/bin/env python3
from argparse import ArgumentParser
import logging
import os
import sys
root_dir = os.path.normpath(os.path.join(os.path.dirname(__file__), '..'))
sys.path.append(root_dir)
from fusion_engine_client.analysis.file_reader import FileReader, TimeAlignmentMode
from fusion_engine_client.messages.co... |
# coding: utf8
from __future__ import unicode_literals
# Source https://github.com/stopwords-iso/stopwords-fi/blob/master/stopwords-fi.txt
# Reformatted with some minor corrections
STOP_WORDS = set("""
aiemmin aika aikaa aikaan aikaisemmin aikaisin aikana aikoina aikoo aikovat
aina ainakaan ainakin ainoa ainoat aio... |
#!/usr/bin/python
# -- Content-Encoding: UTF-8 --
"""
Herald HTTP transport servlet
:author: Thomas Calmant
:copyright: Copyright 2014, isandlaTech
:license: Apache License 2.0
:version: 0.0.3
:status: Alpha
..
Copyright 2014 isandlaTech
Licensed under the Apache License, Version 2.0 (the "License");
yo... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import pytest
class TestAuditConf(object):
@pytest.fixture(autouse=True)
def init(self, ssh_audit):
self.AuditConf = ssh_audit.AuditConf
self.usage = ssh_audit.usage
def _test_conf(self, conf, **kwargs):
options = {
'host': None,
'port': 22,
'ssh1': Tr... |
# coding: utf-8
#
# spyne - Copyright (C) Spyne contributors.
#
# This library 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 2.1 of the License, or (at your option) any later version.... |
"""Switch implementation for Wireless Sensor Tags (wirelesstag.net)."""
from __future__ import annotations
import voluptuous as vol
from homeassistant.components.switch import (
PLATFORM_SCHEMA,
SwitchEntity,
SwitchEntityDescription,
)
from homeassistant.const import CONF_MONITORED_CONDITIONS
import homea... |
# Copyright 2016-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 ... |
# -*- coding: utf-8 -*-
from gibberish import classify_gibberish, strip_unwanted
from datahandling import is_frequent_sentence
from globalvars import GlobalVars
import pytest
GlobalVars.frequent_sentences = ["try this", "try the following",
"try this code"]
# actual sentences are stor... |
# coding=utf-8
import json
import unittest
from loadimpact.clients import Client
from loadimpact.resources import Resource, TestConfig, UserScenario
class MockRequestsResponse(object):
def __init__(self, status_code=200, **kwargs):
self.status_code = status_code
self.kwargs = kwargs
for ... |
"""
Created on Jun 30, 2012
@author: eric
"""
import unittest
import os
from bundles.testbundle.bundle import Bundle
from ambry.run import get_runconfig
from ambry.warehouse.manifest import Manifest
from test_base import TestBase
from ambry.util import get_logger, Constant
from ambry.orm import Config
import manifes... |
# Authors: Alexandre Gramfort <gramfort@nmr.mgh.harvard.edu>
#
# License: BSD (3-clause)
import numpy as np
from scipy import linalg
from . import fiff, Epochs
from .fiff.pick import pick_types
from .event import make_fixed_length_events
def read_proj(fname):
"""Read projections from a FIF file.
Parameters
... |
#!/bin/python3
import requests
import grequests
import multiprocessing
assets = ['USD', 'USDT', 'EUR', 'BTC', 'XRP', 'ETH', 'HKD', 'LTC', 'RUR',
'CNY', 'DASH', 'ZEC']
#btce
def btc_e(assets):
r = requests.get('https://btc-e.com/api/3/info').json()
urls=[]
pairs = []
for k, v in r['pairs'].it... |
"""
abuse.ch Palevo C&C feed RSS bot.
Maintainer: Lari Huttunen <mit-code@huttu.net>
"""
import urlparse
from abusehelper.core import bot
from . import host_or_ip, split_description, AbuseCHFeedBot
class PalevoCcBot(AbuseCHFeedBot):
feed_malware = "Palevo"
feed_type = "c&c"
feeds = bot.ListParam(defau... |
""" NaCl SDK support"""
import os
import stat
import urllib
import zipfile
import subprocess
from mod import log, util, config
#-------------------------------------------------------------------------------
def get_sdk_url() :
"""returns the SDK download URL"""
return 'http://storage.googleapis.com/nativecl... |
# -*- coding: utf-8 -*-
#BEGIN_HEADER
from __future__ import division
from __future__ import print_function
import copy
import math
import os
import re
import sys
import uuid
import random
from datetime import datetime
from pprint import pformat,pprint
import ete3
import matplotlib.pyplot as pyplot # use this instea... |
from lib.bitparser import Parse
from lib.lexer import lex
from lib.basefuncs import Token, tokens
import os
from lib.evaluator import runStates as evaluate
import hashlib
def h11(w):
return hashlib.md5(w.encode()).hexdigest()[:9]
def interpret(text):
lexed = lex(text, tokens)
parsed = Parse(lexed)
evaluate(par... |
# Copyright (c) 2012-2014 ARM Limited
# All rights reserved.
#
# The license below extends only to copyright in the software and shall
# not be construed as granting a license to any other intellectual
# property including but not limited to intellectual property relating
# to a hardware implementation of the functiona... |
# Swift Message & Alert System
#
# Opens and accepts messages over a socket
# and from a multiprocessing queue for irc channel alerts
import asyncio
import sqlite3
import socket
import ssl
import sys
import re
from hangups import ChatMessageSegment
from Bank.Hangouts import name_to_nick
from Bank import g
import json
... |
# (c) 2014, James Tanner <tanner.jc@gmail.com>
#
# 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) any later version.
#
# Ansible is distributed i... |
# -*- coding: utf-8 -*-
"""
Helper functions used in views.
"""
import csv
from threading import Lock
import urllib
from datetime import datetime, timedelta
from json import dumps
from functools import wraps
from flask import Response
from lxml import etree
from presence_analyzer.main import app
import logging
... |
# (c) 2014, James Tanner <tanner.jc@gmail.com>
#
# 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) any later version.
#
# Ansible is distributed i... |
from collections import Counter
from functools import partial, wraps
from itertools import izip_longest
from recipes import *
__all__ = ['chunked', 'first', 'peekable', 'collate', 'consumer', 'ilen',
'iterate', 'with_iter', 'distinct_permutations']
_marker = object()
def chunked(iterable, n):
"""Bre... |
import paho.mqtt.client as mqtt
import paho.mqtt.publish as publish
import socket
import sys
import time
## this agent reads from the solarmax inverter socket and
## publishes the data to a mqtt listener
## constants
inverter_ip = "192.168.1.90"
inverter_port = 12345
mqtt_broker_ip = "192.168.1.24"
mqtt_broker_por... |
from django.db import connections
from django.core.cache import cache
from utils.cache import entkeys
from utils.functions import my_make_key_cache, fo2logger
from utils.functions.models import rows_to_dict_list, rows_to_dict_list_lower
import produto.queries
def produtos_n1_basic(param):
tipo = param[0:2]
... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""
Program to (re)categorize images at commons.
The program uses commonshelper for category suggestions.
It takes the suggestions and the current categories. Put the categories through
some filters and adds the result.
The following command line parameters are supported:
-o... |
"""
Simple script to install PyQt or PySide in CI (Travis and AppVeyor).
"""
from __future__ import print_function
import os
import sys
import subprocess
import urllib
if 'APPVEYOR' in os.environ:
def fix_registry(python_ver):
"""Update install path on windows registry so PyQt installation installs at the... |
"""
MPP Solar Inverter Command Library
reference library of serial commands (and responses) for PIP-4048MS inverters
mppcommand.py
"""
# Backward compatibility to python2
from builtins import bytes
import ctypes
import logging
import random
log = logging.getLogger('MPP-Solar')
def crc(byte_cmd):
"""
Calcul... |
'''View Controller
======================
Displays the preview or live pixel output of the experiment.
'''
import multiprocessing as mp
import numpy as np
import os
import sys
from fractions import Fraction
import traceback
from queue import Empty
import uuid
from typing import Optional, Dict, List
from ... |
#!/usr/bin/env python
import sys
import os
import subprocess
import pysam
import textwrap
import argparse
from uuid import uuid4
def print_header():
print textwrap.dedent("""\
##fileformat=VCFv4.1
##phasing=none
##INDIVIDUAL=TRUTH
##SAMPLE=<ID=TRUTH,Individual="TRUTH",Description="bamsurgeon spik... |
from __future__ import division
from __future__ import print_function
import argparse
import gc
import json
import math
import platform
import sys
import time
import traceback
from collections import defaultdict
from datetime import datetime
from distutils.version import StrictVersion
import py
import pytest
from . ... |
import ConfigParser
import os
class Config(object):
config = None
def __init__(self):
self.read_config()
def read_config(self):
"""Return config object from config file"""
self.cfg = ConfigParser.ConfigParser()
self.cfg.read(os.path.join(os.getenv('CONFROOT'),'salvavida.cf... |
#!/usr/bin/env python3
#
# 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... |
from datetime import date, datetime, timedelta, time
from calendar import month_name
from dimagi.utils.logging import log_exception
from dimagi.utils.parsing import string_to_datetime
from dateutil.rrule import *
def force_to_date(val):
"""Forces a date, string, or datetime to a date."""
if not val: ... |
import sys
import rlp
from rlp.sedes import CountableList, binary
from rlp.utils import decode_hex, encode_hex, ascii_chr, str_to_bytes
from ethereum import opcodes
from ethereum import utils
from ethereum import specials
from ethereum import bloom
from ethereum import vm as vm
from ethereum.exceptions import *
from et... |
from mayavi import mlab
import numpy
import re
def mycolor(x):
"""Returns a color vector (a triple of floats) based on x, where x is
in the range [0, 1].
"""
lut = [
[ 0, 0, 0, 255],
[ 1, 0, 0, 255],
[ 2, 0, 0, 255],
[ 4, 0, 0, 255],
[ 5, ... |
#!/usr/bin/env python
# -*- encoding: utf-8 -*-
#
import sys; reload(sys)
sys.setdefaultencoding('utf-8') # we always need failsafe utf-8, in some way
import os
import re
import time
import hashlib
import urllib
import difflib
import smtplib
import htmlentitydefs
from email.mime.text import MIMEText
# tag used in ... |
import pyVmomi
import datetime
from common.methods import set_progress
from resourcehandlers.vmware.pyvmomi_wrapper import get_vm_by_uuid, wait_for_tasks
from resourcehandlers.vmware.models import VsphereResourceHandler
from resourcehandlers.vmware.vmware_41 import TechnologyWrapper
from jobengine.jobmodules.syncvmsjob... |
import py
import pytest
from xdist.slavemanage import SlaveController, unserialize_report
from xdist.remote import serialize_report
import execnet
import marshal
queue = py.builtin._tryimport("queue", "Queue")
WAIT_TIMEOUT = 10.0
def check_marshallable(d):
try:
marshal.dumps(d)
except ValueError:
... |
import os
import pickle
import numpy as np
import sys
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "ms2ldaviz.settings")
import django
django.setup()
import jsonpickle
from basicviz.models import Experiment,Document,Feature,FeatureInstance,Mass2Motif,Mass2MotifInstance,DocumentMass2Motif,FeatureMass2MotifInstance... |
from django.shortcuts import get_object_or_404, render_to_response
from django.conf import settings
from django.http import HttpResponse, HttpResponseBadRequest
##from multiuploader.models import MultiuploaderImage
from django.core.files.uploadedfile import UploadedFile
#importing json parser to generate jQuery plugi... |
import pep8
import re
import os
import sys
import token as token_type
CLASS_NAME_MATCH = re.compile(r'^_*[A-Z][a-zA-Z0-9]*_*$')
FUNCTION_NAME_MATCH = re.compile(r'^(_*|test_)[a-z][a-zA-Z0-9]*_*$')
MEMBER_NAME_MATCH = re.compile(r'^[a-z_][a-z0-9_]*$')
VARIABLE_NAME_MATCH = re.compile(r'^[a-z][a-z0-9_]*$')
# Check the... |
import sublime
import sublime_plugin
class SbpToggleCommentCommand(sublime_plugin.TextCommand):
def run(self, edit, **args):
self.view.run_command("toggle_comment")
self.view.run_command("sbp_cancel_mark")
# Remove any existing marks
#
class SbpCancelMarkCommand(sublime_plugin.TextCommand):
... |
from UM.Workspace.WorkspaceReader import WorkspaceReader
from UM.Application import Application
from UM.Logger import Logger
from UM.i18n import i18nCatalog
from UM.Settings.ContainerStack import ContainerStack
from UM.Settings.DefinitionContainer import DefinitionContainer
from UM.Settings.InstanceContainer import In... |
# -*- coding: utf-8 -*-
from connection import ScrapeBase
import urlparse
import urllib2
import json
import sys, os
class Analysis( ScrapeBase ):
"""
Runs analysis on a website to try to find appropioate tags and code
"""
def __init__(self, mainUrl):
self.url = mainUrl
def loadSoup(self):
print "getti... |
#!/usr/bin/env python
# Reads energy levels from qe output and plots (1d) band structure
# to file "bands.png"
import atk.format.qe as qe
from sys import argv
import numpy as np
import matplotlib as mpl
mpl.use('Agg')
import matplotlib.pylab as plt
import argparse
# Define command line parser
parser = argparse.Argume... |
#!/usr/bin/env python3
###############################################################################
# Copyright 2018 The Apollo 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... |
#!/usr/bin/env python
# coding: utf-8
import pandas as pd
import numpy as np
import scIB
import warnings
warnings.filterwarnings('ignore')
import argparse
from functools import reduce
if __name__=='__main__':
"""
Scale LISI scores in the output of merge_metrics.py
"""
parser = argparse.ArgumentPa... |
# -*- coding: utf-8 -*-
##
## This file is part of CDS Invenio.
## Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008 CERN.
##
## CDS Invenio 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 versio... |
from ..backend import KeyringBackend
class Keyring(KeyringBackend):
"""
Keyring that raises error on every operation.
>>> kr = Keyring()
>>> kr.get_password('svc', 'user')
Traceback (most recent call last):
...
RuntimeError: ...No recommended backend...
"""
priority = 0
def ... |
# encoding: utf-8
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Create temporary columns
db.add_column('generic_rating', 'object_pk_migrating', self.gf('django.db.model... |
from __future__ import print_function, absolute_import, division
import pytest
import itertools
import operator
import numpy as np
from numpy.testing import assert_allclose
from numpy.lib.stride_tricks import as_strided
from astropy.wcs import WCS
from astropy import units as u
from .test_spectral_cube import cube_an... |
from __future__ import print_function, division, absolute_import
from collections import Iterable, defaultdict
from itertools import count, cycle
import random
import socket
import uuid
from tornado import gen
from tornado.gen import Return
from tornado.ioloop import IOLoop
from tornado.iostream import IOStream, Stre... |
from retrieval.boolean_parser import BooleanParser
from retrieval.ranking import score
from retrieval.index import Index
from preprocess.index_builder import getstem
class SearchEngine:
parser = BooleanParser()
index = None
stopwords = []
lastQuery = None
def __init__(self, index_folder, stopwords = []):
self... |
# -*- coding: utf-8 -*-
#***************************************************************************
#* Copyright (c) 2009, 2010 Yorik van Havre <yorik@uncreated.net> *
#* Copyright (c) 2009, 2010 Ken Cline <cline@frii.com> *
#* ... |
# -*- coding: utf-8 -*-
#
# Copyright (c) 2010 Red Hat, Inc
# Copyright (c) 2009 Milos Komarcevic
# Copyright (c) 2008 Tim Lauridsen
#
# kitchen 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 ve... |
"""The constants module defines the gyromagnetic ratios and scalar coupling
constants.
Define the gyromagnetic ratios in rad/s/T
IUPAC values: Harris et al, Concepts in Magn. Reson., (2002) 14, p326
"""
import collections
import numpy as np
GAMMA = {
"h": 26.752_212_8e07,
"q": 26.752_212_8e07,
"n": -2.7... |
# This work was created by participants in the DataONE project, and is
# jointly copyrighted by participating institutions in DataONE. For
# more information on DataONE, see our web site at http://dataone.org.
#
# Copyright 2009-2019 DataONE
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you ma... |
"""Allows to control the bot via REST calls."""
import json
import logging
import os
import requests
import threading
import urllib.parse
from bottle import ServerAdapter, abort, request, route, run
from jwcrypto import jwk, jws, jwt
from bot.paths import CONFIG_PATH
from bot.paths import OIDC_API, USER_ID_API
# Reg... |
import ctypes
import faulthandler
import io
import itertools
import logging
import multiprocessing
import os
import pickle
import sys
import textwrap
import unittest
from importlib import import_module
from io import StringIO
from django.core.management import call_command
from django.db import connections
from django... |
"""Django test runner that invokes nose.
You can use... ::
NOSE_ARGS = ['list', 'of', 'args']
in settings.py for arguments that you want always passed to nose.
"""
import new
import os
import sys
from optparse import make_option
from django.conf import settings
from django.core import exceptions
from django.co... |
'''
Python questions to work on. To invoke with pytest use
$ python3 answer_template.py
or
$ python3 -m pytest answer_template.py
'''
import pytest
def inclusive_range(n):
# For n = 5, return [1, 2, 3, 4, 5]
return [1, 2, 3, 4, 5]
def average(ol):
# The mean for a series of numbers
pass
... |
#
# Copyright (c) 2014, Arista Networks, 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 copyright notice,
# this list of condit... |
from flask import Flask, render_template, url_for, request, g
from flask_bootstrap import Bootstrap
import json
import os.path
from storage_api import create_storage, TEST_PATH
app = Flask(__name__)
Bootstrap(app)
def collect_tests():
result = []
for file in os.listdir(TEST_PATH):
if file.endswith("... |
# This file is part of the GOsa framework.
#
# http://gosa-project.org
#
# Copyright:
# (C) 2016 GONICUS GmbH, Germany, http://www.gonicus.de
#
# See the LICENSE file in the project's top-level directory for details.
"""
Object Index
============
The Object Index is the search engine in GOsa. It keeps track about
a... |
import numpy as np
import datetime
# NOTE: we don't import cluster here because it causes an
# issue with PyCUDA and our daemonize procedure, see
# the hdp function for where this is actually imported
# from flowstats import cluster
import json
PROCESS_LIST = {
1: 'Test',
2: 'HDP'
}
def test(process_request)... |
# -*- coding: utf-8 -*-
"""\
This module converts cable(s) to CSV:
Reference ID | Created | Origin | Subject
It expects a cable directory ./cable/ with the cables
and saves the cables into './cables.csv'
"""
import csv
import codecs
import cStringIO
from cablemap.core import cables_from_directory
from cablemap.co... |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, division, print_function
import json
import os
import requests
import tarfile
from clint.textui import progress
from clint.textui.progress import Bar
from hestia.list_utils import to_list
from requests_toolbelt import MultipartEncoder, MultipartEncoderMo... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Hive Appier Framework
# Copyright (c) 2008-2017 Hive Solutions Lda.
#
# This file is part of Hive Appier Framework.
#
# Hive Appier Framework is free software: you can redistribute it and/or modify
# it under the terms of the Apache License as published by the Apach... |
from __future__ import print_function
import random
import warnings
from twisted.internet.defer import QueueUnderflow, Deferred, fail
from twisted.internet.task import Clock
from spinoff.actor import Actor, actor, CoroutineStopped, CoroutineNotRunning, CoroutineAlreadyStopped, CoroutineAlreadyRunning, CoroutineRefus... |
import json
from django.shortcuts import render, render_to_response
from django.http import HttpResponseRedirect, HttpResponse
from django.template import RequestContext
from django.contrib import auth
from django.contrib.auth.forms import UserCreationForm
from django.contrib.auth.decorators import login_required, per... |
import datetime
from django.db import models
from django.utils import timezone
class Question(models.Model):
question_text = models.CharField(max_length=200)
pub_date = models.DateTimeField('date published')
def __str__(self):
return self.question_text
def was_published_recently(self):
return self.p... |
import hashlib
import os
import subprocess
import threading
import time
import uuid
from django.db import models
from mysqlapi.api.database import Connection
def generate_password():
return hashlib.sha1(uuid.uuid4().hex).hexdigest()
def generate_user(username):
if len(username) > 16:
_username = u... |
# -*- coding: utf-8 -*-
from __future__ import division, print_function, absolute_import
import pyworld
class WORLD(object):
"""WORLD-based speech analyzer
Parameters
----------
fs : int, optional
Sampling frequency
Default set to 16000
minf0 : int, optional
Floor in f0 ... |
import boto3
import uuid
import utils.MentiiLogging as MentiiLogging
from boto3.dynamodb.conditions import Key, Attr
from utils.ResponseCreation import ControllerResponse
from utils import db_utils as dbUtils
from flask import g
def getActiveClassList(dynamoDBInstance, email=None):
response = ControllerResponse()
... |
import os
from numpy.testing import assert_allclose
import torch
from allennlp.commands.train import train_model_from_file
from allennlp.common import Params
from allennlp.common.testing.test_case import AllenNlpTestCase
from allennlp.data import DataIterator, Dataset, DatasetReader, Vocabulary
from allennlp.models i... |
# Copyright 2021 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 required by applicable law or agreed to in writing, so... |
from lacli.decorators import command
from lacli.log import getLogger
from lacli.compose import compose
from lacli.command import LaBaseCommand
from lacli.decorators import contains, login_async, expand_args
from twisted.python.log import startLogging, msg, err
from twisted.internet import reactor, defer, threads
from t... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.