text stringlengths 17 737k |
|---|
# -*- encoding: utf-8 -*-
"""
A simple dependency injection library.
"""
import functools
try:
from unittest import mock
except ImportError:
try:
import mock
except ImportError:
mock = None
_PROVIDERS = {}
class DuplicateProviderError(ValueError):
"""
Raised when two providers... |
# -*- coding: utf-8 -*-
from datetime import datetime
from openerp import api, fields, models, _
class TimeFrame(models.Model):
_name = "time.frame"
_order = "delivery_date, id"
@api.onchange('delivery_date')
def onchange_delivery_date(self):
if self.delivery_date:
... |
#!/usr/bin/env python3
import os
import json
import uncertain
import sys
TIMINGS_DIR = 'collected'
def mean_latency(data):
"""Summarize the data from a single run."""
all_latencies = []
all_draw_latencies = []
for msg in data['messages']:
# As a sanity check, we can get an average frame laten... |
# -*- coding: utf-8 -*-
'''
All salt configuration loading and defaults should be in this module
'''
# Import python libs
from __future__ import absolute_import
from __future__ import generators
import os
import re
import sys
import glob
import getpass
import time
import codecs
import logging
from copy import deepcopy... |
from datetime import datetime
from enum import IntEnum
class GameTag(IntEnum):
"""GAME_TAG"""
TAG_NOT_SET = 0
TAG_SCRIPT_DATA_NUM_1 = 2
TAG_SCRIPT_DATA_NUM_2 = 3
TAG_SCRIPT_DATA_ENT_1 = 4
TAG_SCRIPT_DATA_ENT_2 = 5
MISSION_EVENT = 6
TIMEOUT = 7
TURN_START = 8
TURN_TIMER_SLUSH = 9
PREMIUM = 12
GOLD_REWARD_... |
from django.core.management.base import copy_helper, CommandError, LabelCommand
import os
import re
from random import choice
INVALID_PROJECT_NAMES = ('django', 'site', 'test')
class Command(LabelCommand):
help = "Creates a Django project directory structure for the given project name in the current directory."
... |
import tensorflow as tf
from tensor_train_base import TensorTrainBase
from tensor_train import TensorTrain
from tensor_train_batch import TensorTrainBatch
import shapes
import utils
import decompositions
# TODO: add complexities to the comments.
def full(tt):
"""Converts a TensorTrain into a regular tensor or mat... |
# -*- coding: utf-8 -*-
'''
A module to wrap (non-Windows) archive calls
.. versionadded:: 2014.1.0
'''
from __future__ import absolute_import
import os
import contextlib # For < 2.7 compat
import logging
# Import salt libs
from salt.exceptions import SaltInvocationError, CommandExecutionError
from salt.ext.six impo... |
# author: G. Alomar
from hecuba.Plist import *
from conf.hecuba_params import execution_name
from collections import defaultdict
from hecuba.settings import session
from hecuba.dict import PersistentDict
import time
class StorageObj(object):
keyList = defaultdict(list)
nextKeys = []
cntxt = ''
@stati... |
# -*- coding: utf-8 -*-
'''
A module to wrap (non-Windows) archive calls
.. versionadded:: 2014.1.0
'''
from __future__ import absolute_import
import os
# Import salt libs
from salt.exceptions import SaltInvocationError, CommandExecutionError
from salt.ext.six import string_types, integer_types
import salt.utils
# T... |
import tornado.web
from tornado.options import define, options
import os
import re
from tornado.escape import json_decode
define("config")
define("debug", default=False)
define("cookie_secret", default="music-hack-day")
define("port", default=8080, type=int)
define("creator", default="Dmitri Cherniak")
define("creator... |
#!/usr/bin/env python
'''
Data script for the RTEI website.
Check ./build_data.py -h for details
'''
import re
import os
import simplejson as json
import csv
import argparse
import random
import string
from collections import OrderedDict
from decimal import Decimal
from openpyxl import load_workbook
# Change as appr... |
"""@cmlccie Cisco Spark Python SDK."""
from datetime import datetime
import pytz
from jsondata import JSONData, READ_ONLY, READ_WRITE
from restapi import RESTfulAPI
# Module constants
DEFAULT_API_URL = 'https://api.ciscospark.com/v1/'
PEOPLE_URL = 'people'
ROOMS_URL = 'rooms'
MEMBERSHIPS_URL = 'memberships'
MESSAG... |
from datetime import timedelta
from functools import wraps
from flask import jsonify, request, current_app
from flask_restful import Api, Resource as FlaskRestfulResource, abort, \
reqparse, inputs
from ipaddr import IPAddress
from sqlalchemy.exc import IntegrityError
from pycroft import config
from pycroft.lib.f... |
# -*- coding: utf-8 -*-
###############################################################################
#
# ODOO (ex OpenERP)
# Open Source Management Solution
# Copyright (C) 2001-2015 Micronaet S.r.l. (<http://www.micronaet.it>)
# Developer: Nicola Riolini @thebrush (<https://it.linkedin.com/in/thebrush>)
# This pro... |
#!/usr/bin/python
import random
import numpy as np
from importlib import import_module
import copy
#####Classe de base
vu_class={
'imitation':'imitation.Imitation',
'imitation_permutation':'imitation.ImitationPermutation',
'minimal':'minimal.Minimal',
'minimal_keeppreference':'minimal.MinimalKeepPreference',
'mi... |
import unittest
from sklearn.naive_bayes import GaussianNB
from sklearn.svm import SVC
from skmultilearn.cluster.igraph import IGraphLabelCooccurenceClusterer
from skmultilearn.ensemble.partition import LabelSpacePartitioningClassifier
from skmultilearn.problem_transform.lp import LabelPowerset
from skmultilearn.tests... |
# -*- coding: utf-8 -*-
from copy import copy
from datetime import datetime
from itertools import chain
import re
from classytags.values import StringValue
from cms.utils.urlutils import admin_reverse
from django import template
from django.conf import settings
from django.contrib.sites.models import Site
from django.... |
import logging
from multimap import MultiMap
from ..request import Request
from ..api import as_api
log = logging.getLogger(__name__)
class CRUD(object):
def __init__(self, Session, render, model_class, form_class, partial, partial_key,
partial_kwargs=None, keys=None, table=None, form_template=... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
pgo-evoleval
Copyright (c) 2016 nipil <https://github.com/nipil>
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 wi... |
import pytest
from app.models.broadcast_message import BroadcastMessage
from tests import broadcast_message_json
def test_simple_polygons():
broadcast_message = BroadcastMessage(broadcast_message_json(
area_ids=[
# Hackney Central
'wd20-E05009372',
# Hackney Wick
... |
# -*- coding: utf-8 -*-
###############################################################################
#
# ODOO (ex OpenERP)
# Open Source Management Solution
# Copyright (C) 2001-2015 Micronaet S.r.l. (<http://www.micronaet.it>)
# Developer: Nicola Riolini @thebrush (<https://it.linkedin.com/in/thebrush>)
# This pro... |
# The MIT License (MIT)
#
# Copyright (c) 2016 Bartosz Zaczynski
#
# 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,... |
#!/usr/bin/env python3
import os
import time
import numpy
from tempfile import TemporaryDirectory
import logging
logger = logging.getLogger(__name__)
import h5py
import hdf5plugin
#Needed for
from queue import Queue
from threading import Thread, Event
import multiprocessing
# Some constants
ndim = 3
size = 1024
chun... |
#!/usr/bin/env python
"""
build_util.py - Build related functions
@author pjenvey
"""
import distutils.util, md5, os, setup, shutil, sys, tarfile
from Hellanzb.Util import Ptyopen2
__id__ = '$Id$'
VERSION_FILENAME = './Hellanzb/__init__.py'
def assertUpToDate(workingCopyDir = None):
""" Ensure the working co... |
import mock
import numpy
import six
import threading
import unittest
import cupy
from cupy import testing
def fusion_default_array_equal():
def deco(func):
def wrapper(self_x, name, xp, dtype):
@cupy.fuse()
def f(*args):
return getattr(xp, name)(*args)
... |
'''
The AWS Cloud Module
====================
The AWS cloud module is used to interact with the Amazon Web Services system.
To use the AWS cloud module the following configuration parameters need to be
set in the main cloud config:
.. code-block:: yaml
# The AWS API authentication id
AWS.id: GKTADJGHEIQSXMK... |
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU... |
import os, sys, threading, shutil, re
from subprocess import Popen, PIPE, STDOUT
class BuildContext:
def __init__(self, args):
self.CPPFLAGS = ""
self.EXTRAFLAGS = ""
self.LDFLAGS = "-L${INSTALL_DIR}/lib"
self.LASTLDFLAGS = ""
self.JNIEXT = ""
self.JNILIBFLAGS = ""
... |
'''
test registerdid/modifydid when fork occured
'''
from utils import common
from TestCase.MVSTestCase import *
class TestFork(ForkTestCase):
def test_0_fork_at_send(self):
self.make_partion()
# make transaction and mine
Alice.send_etp(Bob.mainaddress(), 10**8)
Alice.mining()
... |
import time
import urllib3
import threading
import dropbox
from dropbox.session import DropboxSession
from dropbox.client import DropboxClient
from onitu.plug import Plug
from onitu.plug import DriverError, ServiceError
from onitu.escalator.client import EscalatorClosed
# Onitu has a unique set of App key and secret... |
# comentario extra
from . import model
from . import wizard
|
import datetime
import os
import sys
import time
from multiprocessing import Process, Lock, Value, Manager
import swiftclient
import olrcdb
# Settings
SEGMENT_SIZE = 100 * 10 ** 6
COUNT = 0
FAILED_COUNT = 0
SLEEP = 1 # Sleep timeout when trying to connect to the database.
LOGDIR = '/data/swiftbulkuploader/logs_uplo... |
import json
import hangups
from hangups.ui.utils import get_conv_name
from utils import text_to_segments
from version import __version__
def _initialise(Handlers, bot=None):
if "register_admin_command" in dir(Handlers) and "register_user_command" in dir(Handlers):
Handlers.register_admin_command(["users"... |
# -*- coding: utf-8 -*-
# Copyright (c) 2010-2012, GEM Foundation.
#
# OpenQuake is free software: you can redistribute it and/or modify it
# under the terms of the GNU Affero General Public License as published
# by the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version... |
# Log the time student click the 'show_hint' button
import os
import sys
import MySQLdb
from flask import request, Flask
from flask_cors import CORS, cross_origin
import logging.handlers
import logging
# logging settings
log_path = '~/show_hint.log'
logger = logging.getLogger('show_hint')
handler = logging.handlers.Ro... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from appconf import AppConf
class OppsContainerConf(AppConf):
SITE_ID = None
class Meta:
prefix = 'opps_containers'
|
'''
Created on Mar 30, 2016
@author: Noe
'''
import Tkinter
tsnames = ('C-cex','Bittrex')
msgvar=('Select the site you want to monitor trades on.', "Before getting started you will want to save your cookies after logging in.\n\nThis is so that you don't have to log in every time.\n\nIf you haven't used this app in ... |
# 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# =============================================================================
## @file bernstein.py
#
# Module with some useful utilities for dealing with Bernstein polynomials
#
# @author Vanya BELYAEV Ivan.Belyaev@cern.ch
# @date 2011-12-01
# ======================... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Provides variables for string and integer conversion."""
NOT_THE_QUESTION = 'The answer to life, the universe, and everything? It\'s '
ANSWER = 42
THANKS_FOR_THE_FISH = str(NOT_THE_QUESTION) + str(ANSWER)
|
# Copyright (c) 2022, DjaoDjin Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice,
# this list of conditions and t... |
# -*- coding: utf-8 -*-
from PyQt5 import QtCore, QtGui, QtWidgets
from PyQt5.QtCore import QTimer, QUrl
from MainWindow_raspi import Ui_MainWindow
from PyQt5.QtGui import QDesktopServices
import sys
import datetime
import os as os
import logging
import time
import soco
class QPlainTextEditLogger(logging.Handler):
... |
from arelle.ModelValue import qname
import os
xsd = "http://www.w3.org/2001/XMLSchema"
qnXsdSchema = qname("{http://www.w3.org/2001/XMLSchema}xsd:schema")
qnXsdAppinfo = qname("{http://www.w3.org/2001/XMLSchema}xsd:appinfo")
qnXsdDefaultType = qname("{http://www.w3.org/2001/XMLSchema}xsd:anyType")
xsi = "http://www.w3... |
"""
Group Testing Module
"""
import pytest
import api.user
import api.team
import api.common
import bcrypt
from api.common import WebException, InternalException
from common import clear_collections, ensure_empty_collections
from common import teacher_user
from conftest import setup_db, teardown_db
class TestGroups(... |
############################TESTS ON POTENTIALS################################
import sys
import numpy
import os
from galpy import potential
_TRAVIS= bool(os.getenv('TRAVIS'))
#Test whether the normalization of the potential works
def test_normalize_potential():
#Grab all of the potentials
pots= [p for p in d... |
# Copyright 2015 Daniel Neve
#
# 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, ... |
"""evaluation_framework.py -- All that is needed to evaluate feature selection algorithms."""
import numpy as np
import sklearn
import sklearn.linear_model as lm
import sklearn.cross_validation as cv
import tables as tb
import subprocess
import shlex
import math
def consistency_index(sel1, sel2, num_features):
"... |
from rest_framework.relations import HyperlinkedRelatedField
from drf_queryfields import QueryFieldsMixin
from api.models import *
from rest_framework import serializers
class AgencySerializer(QueryFieldsMixin, serializers.HyperlinkedModelSerializer):
class Meta:
model = Agency
fields = ('id', ... |
'''
Created on Jun 19, 2010
@author: jnaous
'''
import logging
from pprint import pformat
from django.views.generic import simple
from django.shortcuts import get_object_or_404
from expedient.clearinghouse.slice.models import Slice
from expedient.clearinghouse.project.models import Project
from openflow.plugin.models ... |
# Copyright (c) 2012, GPy authors (see AUTHORS.txt).
# Licensed under the BSD 3-clause license (see LICENSE.txt)
"""
Gaussian Processes regression examples
"""
import pylab as pb
import numpy as np
import GPy
def olympic_marathon_men(optimize=True, plot=True):
"""Run a standard Gaussian process regression on the ... |
import string
import random
from jobtastic import JobtasticTask
leaky_global = []
class BaseMemLeakyTask(JobtasticTask):
"""
This task leaks memory like crazy, by adding things to `leaky_global`.
"""
significant_kwargs = [
('bloat_factor', str),
]
herd_avoidance_timeout = 0
def ... |
"""
Deploy this project in dev/stage/production.
Requires commander_ which is installed on the systems that need it.
.. _commander: https://github.com/oremj/commander
"""
import os
import sys
sys.path.append(os.path.dirname(os.path.abspath(__file__)))
from commander.deploy import task, hostgroups
import commander_... |
# coding=utf-8
# Copyright 2018 Google AI, Google Brain and Carnegie Mellon University Authors and the HuggingFace Inc. team.
# Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the Lice... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""This module provides a function that knows what you mean"""
def know_what_i_mean(wink, numwink=2):
"""This function knows what you mean and provides a statement.
Args:
wink (str): The person's name you are winking to.
numwink (int, optional): N... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Lesson 07, Task 05"""
import data
SUPER_SIDEKICKS = {}
for HERO, HERO_DATA in data.SUPERHEROES.iteritems():
SUPER_SIDEKICKS[HERO] = HERO_DATA.get('pet')
print SUPER_SIDEKICKS
|
# -*- coding: utf-8 -*-
from __future__ import absolute_import, division, print_function
import subprocess
import re
import os
import six
import numpy as np
import pandas as pd
from .region import parse_region
def atoi(s):
return int(s.replace(',', ''))
def natsort_key(s, _NS_REGEX=re.compile(r'(\d+)', re.U))... |
#!/usr/bin/env python2
__author__="The Font Bakery Authors"
import os, sys, argparse, glob, logging, requests, subprocess
from bs4 import BeautifulSoup
from fontTools import ttLib
font = None
fixes = []
def assert_table_entry(tableName, fieldName, expectedValue):
""" This is a helper function to accumulate
... |
# devicetree.py
# Device management for anaconda's storage configuration module.
#
# Copyright (C) 2009, 2010, 2011, 2012, 2013 Red Hat, Inc.
#
# This copyrighted material is made available to anyone wishing to use,
# modify, copy, or redistribute it subject to the terms and conditions of
# the GNU General Public Lice... |
import asyncio
import os
import re
from copy import copy
from numbers import Number
import aiohttp
import discord
from __main__ import send_cmd_help
from cogs.utils import checks
from discord.ext import commands
from discord.ext.commands import formatter
from .utils.dataIO import dataIO
try:
from bs4 import Beau... |
#coding=utf-8
from django import forms
from django.contrib.auth.models import User
from django.utils.translation import ugettext_lazy as _
from django.forms import ModelForm
from django.forms.extras.widgets import SelectDateWidget
# Register your models here.
from jizhang.models import Item, Category
from jizhang.data... |
import pandas as pd
"""
formatting.py: formats the output from VAPr such that the output matches MAF format, allowing for downstream processing
and analysis in Maftools
"""
__author__ = 'John David Lin', 'Kriti Agrawal'
__date__ = 'Sept. 11, 2018'
### 1. EXTRACT SAMPLES
# Take each sample out from the sample col... |
import re
import ssl
import base64
import socket
import itertools
import smtplib
from nylas.logging import get_logger
log = get_logger()
from inbox.models.session import session_scope
from inbox.models.backends.imap import ImapAccount
from inbox.models.backends.oauth import token_manager as default_token_manager
from... |
import os.path
from unittest import TestCase
from generator import generate, generator
from nose.plugins.skip import SkipTest
from whylog.config import YamlConfig
from whylog.log_reader import LogReader
from whylog.tests.tests_log_reader.constants import TestPaths
path_test_files = ['whylog', 'tests', 'tests_log_rea... |
# -*- coding: utf-8 -*-
# Copyright 2011 Tomo Krajina
#
# 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 ... |
#!/usr/bin/env python
import argparse
import shutil
from os.path import join
import subprocess
import json
import boto
parser = argparse.ArgumentParser("export js to your s3")
parser.add_argument("path",
help=('path to s3 keys should look like '
'{"AWS_ACCESS_KEY" : "x... |
# coding: utf-8
'''
Usage:
python manage.py runscript repop_known_cols --script-args=<assetUid>
'''
import re
import json
from pprint import pprint
from kpi.models.asset import Asset
from kobo.apps.subsequences.models import SubmissionExtras
from kobo.apps.subsequences.utils.parse_knowncols import parse_knowncols
... |
from __future__ import unicode_literals
from datetime import timedelta
from slugify import slugify
from django.views.decorators.cache import cache_control
from django.core.exceptions import ValidationError
from django.core.urlresolvers import reverse
from django.http import HttpResponse, HttpResponseRedirect, Http40... |
# Copyright 2008 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 or agreed to in writing, ... |
# -*- mode: python; coding: utf-8 -*-
# Copyright 2019 the HERA Collaboration
# Licensed under the 2-clause BSD license.
"""
This module defines all of the system parameters for hookup. It tries to
contain all of the ad hoc messy part of walking through a signal chain to
this one file.
The two-part "meta" assumption... |
# -*- coding: utf-8 -*-
"""
extension
~~~~
Sanic-CORS is a simple extension to Sanic allowing you to support cross
origin resource sharing (CORS) using a simple decorator.
:copyright: (c) 2019 by Ashley Sommer (based on flask-cors by Cory Dolphin).
:license: MIT, see LICENSE for more details.
"... |
from __future__ import unicode_literals
import logging
import sys
from django.db import connections, DatabaseError
from django.utils import six
from nodeconductor.core import utils as core_utils
from nodeconductor.monitoring.zabbix import errors, api_client
from nodeconductor.monitoring.zabbix import sql_utils
logg... |
from django import forms
from django.conf import settings
from django.core.mail import send_mail
from django.core.mail import EmailMessage
class ContactForm(forms.Form):
subject = forms.CharField(label="Betreff", max_length=100)
sender = forms.EmailField(label="Emailadresse")
message = forms.CharField(lab... |
from django.conf.urls.defaults import patterns, url
from django.core.urlresolvers import reverse, get_callable
from django.http import HttpResponseRedirect, HttpResponse
from django.shortcuts import render_to_response as render
from django.template import RequestContext, TemplateDoesNotExist
from functools import wraps... |
"""
Define the resolution functions for the data.
This defines classes for 1D and 2D resolution calculations.
"""
from __future__ import division
import unittest
from scipy.special import erf # type: ignore
from numpy import sqrt, log, log10, exp, pi # type: ignore
import numpy as np # type: ignore
__all__ = ["R... |
import datetime
from collections import OrderedDict
from hashlib import md5
from flask import current_app
from flask_login import UserMixin
from itsdangerous import URLSafeTimedSerializer, \
TimedJSONWebSignatureSerializer
from sqlalchemy import or_
from catwatch.lib.util_sqlalchemy import ResourceMixin
from c... |
from __future__ import absolute_import
from collections import OrderedDict
from time import time
from sympy import (Eq, Indexed, cos, sin)
from devito.dse.aliases import collect_aliases
from devito.dse.clusterizer import clusterize
from devito.dse.extended_sympy import bhaskara_cos, bhaskara_sin
from devito.dse.insp... |
from PyQt5 import QtWidgets, QtGui
from .scan_ui import Ui_Form
from ...core.mixins import ToolWindow
from ...core.scangraph import ScanGraph
from ....core.commands.motor import Moveto
from ....core.commands.scan import Scan
from ....core.commands.xray_source import Shutter
from ....core.devices import Motor
from ....... |
'''
@author: Remi Cattiau
'''
from PyQt4.QtCore import QThread, QObject, pyqtSignal, pyqtSlot, QCoreApplication
from threading import current_thread
from time import sleep, time
from nxdrive.engine.activity import Action, IdleAction
from nxdrive.logging_config import get_logger
from urllib2 import HTTPError
log = get_... |
# Copyright 2017 CBSD Project 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 applic... |
# Copyright (c) 2010-2013, GEM Foundation.
#
# OpenQuake is free software: you can redistribute it and/or modify it
# under the terms of the GNU Affero General Public License as published
# by the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# OpenQuake is distri... |
from flask import jsonify
from validate_email import validate_email
from modals.modals import BucketModal
class Bucket(object):
"""
Handles all bucket operations
"""
def create_bucket(self, name, desc, user_id):
"""
Creates a new bucket
"""
if not name:
re... |
from unittest import TestCase
from mock import Mock, MagicMock, call, patch
from cloudshell.cp.aws.domain.services.ec2.elastic_ip import ElasticIpService
from cloudshell.cp.aws.models.network_actions_models import DeployNetworkingResultModel
from cloudshell.cp.core.models import PrepareSubnetParams, ConnectSubnet, Co... |
#!/usr/bin/env python
# =============================================================================
# MODULE DOCSTRING
# =============================================================================
"""
Experiment
==========
Tools to build Yank experiments from a YAML configuration file.
This is not something tha... |
"""Tests projects that use isort to see if any differences are found between
their current imports and what isort suggest on the develop branch.
This is an important early warning signal of regressions.
NOTE: If you use isort within a public repository, please feel empowered to add your project here!
It is important t... |
#!/usr/bin/env python
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
# Copyright (c) 2017 Mozilla Corporation
import time
import json
import pytest
import os
import... |
#
# core.py: public Python interface for core components
#
# Subversion is a tool for revision control.
# See http://subversion.tigris.org for more information.
#
######################################################################
#
# Copyright (c) 2000-2004 CollabNet. All rights reserved.
#
# This software is lice... |
#############################################################################
##
## Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
## Contact: http://www.qt-project.org/legal
##
## This file is part of Qt Creator.
##
## Commercial License Usage
## Licensees holding valid commercial Qt licenses may use this f... |
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
from taar.recommenders.ensemble_recommender import EnsembleRecommender
from taar.recommenders.hybrid_recommender import ... |
"""
Unit tests for methods in `tardis/montecarlo/src/cmontecarlo.c`.
* `ctypes` library is used to wrap C methods and expose them to python.
Probable Reasons for Failing Tests:
-----------------------------------
1. Change made in C struct declarations:
- Reflect the changes done in C structs, into Python counterp... |
import sys
from evolib.SequenceFormats import FastaFormat
fileName = sys.argv[1]
fileObject = open(fileName, 'r')
F = FastaFormat(fileObject)
chrom = fileName[9:19]
dna = set(['A', 'T', 'G', 'C'])
bp = 1
for site in F.iter_sites():
if len(list(set(site.upper()) - dna)) > 0:
print chrom, bp, 'NA', 'NA',... |
from django.test.client import Client
from django.utils import six
from django_performance_testing.queries import QueryCollector, QueryBatchLimit
orig_client_request = Client.request
def client_request_that_fails_for_too_many_queries(client_self, **request):
path_info_as_text = six.text_type(request['PATH_INFO']... |
from django.conf import settings
from django.contrib.gis.geos.polygon import Polygon
from django.core.paginator import Paginator, PageNotAnInteger, EmptyPage
from django.db.models import Q
from django.forms.models import model_to_dict
from django.http import FileResponse
from django.shortcuts import get_object_or_404
... |
#!/usr/bin/python
import copy
import widget
import textbox
import curses
import titlefield
import Popup
import weakref
MORE_LABEL = "- more -" # string to tell user there are more options
class FilterPopupHelper(Popup.Popup):
def create(self):
super(FilterPopupHelper, self).create()
self.filterbox = self.add(tit... |
from django.contrib.auth.models import User
from django_countries import countries
def get_user(user_id):
user = User.objects.get(id=user_id)
return user
def get_user_profile(user_id):
user = User.objects.get(id=user_id)
return user.profile
def get_ambassadors(country_code=None):
ambassadors =... |
#!/usr/bin/env python
import os
import sys
import autoProcessMovie
import tmdb
import guessit
from imdb_mp4 import imdb_mp4
from readSettings import ReadSettings
from mkvtomp4 import MkvtoMp4
from extensions import valid_input_extensions
print "nzbToCouchPotato MP4 edition"
def FILEtoIMDB(file_name): #Added function ... |
#!/usr/bin/python -u
"""
These are the Connection classes, relatively high level classes that handle
incoming or outgoing network connections.
"""
##############################################################################
LICENSE = """\
This file is part of pagekite.py.
Copyright 2010-2012, the Beanstalks Project e... |
# -*- coding: utf-8 -*-
#
# Copyright 2016 edX PDR Lab, National Central University, Taiwan.
#
# http://edxpdrlab.ncu.cc/
#
# 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://w... |
# orm/mapper.py
# Copyright (C) 2005-2022 the SQLAlchemy authors and contributors
# <see AUTHORS file>
#
# This module is part of SQLAlchemy and is released under
# the MIT License: https://www.opensource.org/licenses/mit-license.php
"""Logic to map Python classes to and from selectables.
Defines the :class:`~sqlalch... |
"""Defines the database model for product files"""
from __future__ import unicode_literals
import logging
import os
import django.contrib.gis.db.models as models
import django.utils.timezone as timezone
from django.db import transaction
import storage.geospatial_utils as geo_utils
from job.models import JobManager
f... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.