src stringlengths 721 1.04M |
|---|
# pylint: skip-file
# -*- coding: utf-8 -*-
import datetime
import json
import ddt
import mock
import six
from django.test import RequestFactory, TestCase
from django.urls import reverse
from edx_django_utils.cache import RequestCache
from mock import Mock, patch
from pytz import UTC
from six import text_type
impor... |
import os
import sys
import numpy as np
import time
from scipy import interpolate
import matplotlib.pyplot as plt
DIR = os.path.abspath(os.path.dirname(__file__))
sys.path.insert(0, os.path.join(DIR, '../..'))
from SEAS_Main.atmosphere_effects.cloud import File_Cloud_Simulator, Physical_Cloud_Simulator
from SEAS_Ut... |
# -*- coding: utf-8 -*-
"""Source code management (SCM) host related classes."""
__author__ = 'Nicholas Wiles'
__copyright__ = 'Copyright 2018'
class ScmHost(object):
"""Parent of all ScmHost objects."""
class ScmHostError(Exception):
"""Parent of all ScmHost errors."""
class ScmHostRepo(object):
"""P... |
#!/usr/bin/python
###
# Copyright (c) 2016 Nishant Das Patnaik.
#
# 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 b... |
# 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, ... |
#Chapter 9, Exercise 11...any_lowercase tests
def any_lowercase1(s):
for c in s:
if c.islower():
return True
else:
return False
def any_lowercase2(s):
for c in s:
if 'c'.islower():
return 'True'
else:
return 'False'
... |
# -*- coding: utf-8 -*-
# Copyright (C) 2007-2010, 2015, 2020 Rocky Bernstein
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any lat... |
import pandas as pd
import sqlalchemy as sa
import sqlalchemy.dialects.mysql as mysql
from ibis.sql.alchemy import (unary, fixed_arity, infix_op,
_variance_reduction)
import ibis.common as com
import ibis.expr.types as ir
import ibis.expr.datatypes as dt
import ibis.expr.operations as ops... |
# -*- coding: utf-8 -*-
#
# Copyright 2010-2014 The pygit2 contributors
#
# This file is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License, version 2,
# as published by the Free Software Foundation.
#
# In addition to the permissions in the GNU General Public Li... |
# -*- coding: utf-8 -*-
#
# Yade documentation build configuration file, created by
# sphinx-quickstart on Mon Nov 16 21:49:34 2009.
#
# 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.
#
# All co... |
#
# __init__.py
#
# Copyright (c) 2016-2017 Junpei Kawamoto
#
# This file is part of rgmining-fraudar.
#
# rgmining-fraudar 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
#... |
import os
import glob
import ntpath
import shutil
from geobricks_processing.core.processing_core import process_data
process_obj_emission_factor = [
{
# "output_path": output_path + "/gdal_translate",
# "output_file_name": "MOD13A2_3857.tif",
"process": [
{
"gd... |
# This file is part of the Enkel web programming library.
#
# Copyright (C) 2007 Espen Angell Kristiansen (espen@wsgi.net)
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of... |
#!/usr/bin/env python2
#
# Copyright 2015 Free Software Foundation, Inc.
#
# This file is part of PyBOMBS
#
# PyBOMBS 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, or (at your option)
# any... |
#
# Copyright (c) 2013 Juniper Networks, Inc. All rights reserved.
#
import sys
import gevent.monkey
gevent.monkey.patch_all()
import logging
import tempfile
import mock
from pprint import pformat
import coverage
import fixtures
import testtools
from testtools import content
from flexmock import flexmock
from webtest ... |
import argparse
import cv2
import datetime
import json
import matplotlib.pyplot as plt
import numpy as np
import os
import os.path as osp
import PIL.Image
import PIL.ImageDraw
import yaml
from chainercv.utils.mask.mask_to_bbox import mask_to_bbox
from grasp_data_generator.visualizations \
import vis_occluded_inst... |
# -*- coding: 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):
# Deleting field 'Datasource.imported'
db.delete_column('dpnetcdf_datasource', 'imported')
def backwar... |
"""
Base Record Object
"""
import logging
from infoblox import exceptions
from infoblox import mapping
LOGGER = logging.getLogger(__name__)
class Record(mapping.Mapping):
"""This object is extended by specific Infoblox record types and implements
the core API behavior of a record class. Attributes that map... |
"""Test model factories provided by Improved User"""
from django.test import TestCase
from improved_user.factories import UserFactory
from improved_user.models import User
class UserFactoryTests(TestCase):
"""Test for UserFactory used with Factory Boy"""
def test_basic_build(self):
"""Test creation ... |
from abc import ABCMeta, abstractmethod
import operator
from future.utils import with_metaclass, lmap
from selene.abctypes.conditions import IEntityCondition
from selene.abctypes.webdriver import IWebDriver
from selene.abctypes.webelement import IWebElement
from selene.exceptions import ConditionMismatchException
c... |
#!/usr/bin/python
#////////////////////////////////////////////////////////////////////////////////
#// //
#// wav2Header.py //
#// -PYTHON SCRIPT- ... |
#!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates.
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
# Download and build the data if it does not exist.
from parlai.core.build_data import DownloadableFile
import parlai.co... |
from ink2canvas.svg.AbstractShape import AbstractShape
class Text(AbstractShape):
def textHelper(self, tspan):
val = ""
if tspan.text:
val += tspan.text
for ts in tspan:
val += self.textHelper(ts)
if tspan.tail:
val += tspan.tail
return va... |
# -*- coding: utf-8 -*-
"""
***************************************************************************
qgswps.py QGIS Web Processing Service Plugin
-------------------------------------------------------------------
Date : 09 November 2009
Copyright : (C) 2009 by Dr. Horst Duester
email... |
from __future__ import unicode_literals
import functools
from collections import MutableMapping
from datetime import datetime
try:
from datetime import timezone
utc = timezone.utc
except ImportError:
from datetime import timedelta, tzinfo
class UTC(tzinfo):
def utcoffset(self, dt):
... |
"""Low level HTTP server."""
import asyncio
import warnings
from typing import Any, Awaitable, Callable, Dict, List, Optional # noqa
from .abc import AbstractStreamWriter
from .http_parser import RawRequestMessage
from .streams import StreamReader
from .web_protocol import RequestHandler, _RequestFactory, _RequestHan... |
from django.shortcuts import render_to_response
from django.template import RequestContext
from django.http import HttpResponse
from django.utils import timezone
from django.conf import settings
from django.views.decorators.cache import cache_page
import urllib2
"""
Takes in results from a vote in the following form... |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may ... |
import json
import datetime
import markdown
from pyramid.view import view_config
from pyramid.httpexceptions import HTTPFound, HTTPForbidden, HTTPNotFound
from pyramid.response import Response
from intranet3.utils.views import BaseView
from intranet3.forms.scrum import SprintForm
from intranet3.forms.common import De... |
# -*- coding: utf-8 -*-
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
#... |
# -*- coding: utf-8 -*-
#
# Copyright (c) 2018, Marcelo Jorge Vieira <metal@alucinados.com>
#
# This program is free software: you can redistribute it and/or modify it
# under the terms of the GNU Affero General Public License as published by the
# Free Software Foundation, either version 3 of the License, or (at yo... |
import os
import traceback
from datetime import datetime
from itertools import groupby
from xml.sax.saxutils import XMLGenerator
from xml.sax.xmlreader import AttributesImpl
from django.utils.unittest import TextTestResult
from discover_jenkins.utils import total_seconds
try:
from django.utils.encoding import smar... |
import inspect
import sys
from datetime import datetime, timezone
from typing import Collection, Mapping, Optional, TypeVar, Any
def _get_type_cons(type_):
"""More spaghetti logic for 3.6 vs. 3.7"""
if sys.version_info.minor == 6:
try:
cons = type_.__extra__
except AttributeError:
... |
# 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):
# Adding unique constraint on 'Category', fields ['slug']
db.create_unique('shop_simplecategories_category... |
import json
from django.shortcuts import render, get_object_or_404
from django.db.models import F
from django.http import HttpResponse
from django.views.decorators.http import require_POST
from django.core.urlresolvers import reverse
from django.contrib.admin.views.decorators import staff_member_required
from django.v... |
#!/usr/bin/python
import requests
class KongPlugin:
def __init__(self, base_url, api_name):
self.base_url = "{}/apis/{}/plugins" . format(base_url, api_name)
self.api = api_name
def list(self):
return requests.get(self.base_url)
def _get_plugin_id(self, name, plugins_li... |
"""
Copyright 2012 Free Software Foundation, Inc.
This file is part of GNU Radio
GNU Radio Companion is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later... |
# MIT License
# Copyright (c) 2016 Morgan McDermott & John Carlyle
# 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, cop... |
"""Selected UniProt data saved in Python."""
# Copyright (C) 2014-2019 DV Klopfenstein. All rights reserved
#
# ADAPTED TO PYTHON from the UniProt file:
# ftp://ftp.uniprot.org/pub/databases/uniprot/current_release/knowledgebase/complete
DOWNLOADED = "2019_03_07" # UniProt source files were downloaded on this date
# ... |
#
"""test_date - Date tests"""
# Copyright © 2012-2018 James Rowe <jnrowe@gmail.com>
#
# SPDX-License-Identifier: GPL-3.0-or-later
#
# This file is part of versionah.
#
# versionah 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 So... |
# -*- 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 required by applicable law or... |
"""
A pure python (slow) implementation of rijndael with a decent interface
To include -
from rijndael import rijndael
To do a key setup -
r = rijndael(key, block_size = 16)
key must be a string of length 16, 24, or 32
blocksize must be 16, 24, or 32. Default is 16
To use -
ciphertext = r.encrypt(plaintext)
plai... |
import copy
import json
import time
from urllib.parse import urljoin
import requests
from data_acquisition.consts import ACQUISITION_PATH, UPLOADER_REQUEST_PATH
from data_acquisition.resources import get_download_callback_url, get_metadata_callback_url
from data_acquisition.acquisition_request import AcquisitionReque... |
#!/usr/bin/env python
#coding:utf-8
# Purpose: observer pattern
# Created: 22.01.2011
# Copyright (C) 2011, Manfred Moitzi
# License: MIT
from __future__ import unicode_literals, print_function, division
__author__ = "mozman <mozman@gmx.at>"
from weakref import WeakSet
class Observer(object):
""" Simp... |
import eva
import eva.globe
import eva.job
import eva.rest.resources
import productstatus.exceptions
import datetime
import falcon
class BaseResource(eva.globe.GlobalMixin):
def set_eventloop_instance(self, eventloop):
self.eventloop = eventloop
def set_response_message(self, req, message):
... |
#!/usr/bin/env python
#
# Copyright 2015, 2016 Adam Victor Brandizzi
#
# This file is part of Inelegant.
#
# Inelegant 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 License, or... |
__author__ = 'Felix Simkovic'
import os
import pytest
import sys
from pyjob.cexec import cexec
from pyjob.exception import PyJobExecutableNotFoundError, PyJobExecutionError
class TestCexec(object):
def test_1(self):
stdout = cexec([sys.executable, '-c', 'import sys; print("hello"); sys.exit(0)'])
... |
#!/usr/bin/env python
# Copyright 2020 Arm Limited.
# SPDX-License-Identifier: Apache-2.0
#
# 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
#... |
#!/usr/bin/env python
import argparse
import csv
import glob
import os
import itertools
from pylab import *
import matplotlib.pyplot as plt
from matplotlib.backends.backend_pdf import PdfPages
from asyncore import loop
# Values we care about
keys = []
keys.append('num_read')
keys.append('num_writes')
keys.append('n... |
# coding: utf-8
"""
Talon.One API
The Talon.One API is used to manage applications and campaigns, as well as to integrate with your application. The operations in the _Integration API_ section are used to integrate with our platform, while the other operations are used to manage applications and campaigns. #... |
"""Dummy Framework Extension"""
from ..core import backend, output, handler, mail
from ..utils.misc import minimal_logger
LOG = minimal_logger(__name__)
class DummyOutputHandler(output.CementOutputHandler):
"""
This class is an internal implementation of the
:ref:`IOutput <cement.core.output>` interfac... |
"""
OSD volume overlay
A transparent OSD volume indicator for the bottom-right corner.
Various code snippets taken from https://github.com/kozec/sc-controller
"""
import math
import cairo
from gi.repository import Gdk, Gtk, GdkX11, GLib
import volctl.xwrappers as X
class VolumeOverlay(Gtk.Window):
"""Window t... |
from os.path import dirname
from adapt.intent import IntentBuilder
from mycroft.skills.core import MycroftSkill
from mycroft.util.log import getLogger
import random
__author__ = 'paul'
LOGGER = getLogger(__name__)
class RollDiceSkill(MycroftSkill):
def __init__(self):
super(RollDiceSkill, self).__init... |
from copy import deepcopy
from functools import partial
import sys
import types
# Global import of predefinedentities will cause an import loop
import instanceactions
from validator.constants import (BUGZILLA_BUG, DESCRIPTION_TYPES, FENNEC_GUID,
FIREFOX_GUID, MAX_STR_SIZE)
from validat... |
from .base import RouterDaemon
from .utils import ConfigDict
class OpenrDaemon(RouterDaemon):
"""The base class for the OpenR daemon"""
NAME = 'openr'
@property
def STARTUP_LINE_EXTRA(self):
# Add options to the standard startup line
return ''
@property
def startup_line(self... |
from postmarkup import render_bbcode
from sqlite3 import connect
from contextlib import closing
from flask import Flask, request, session, g, redirect, url_for, abort, render_template, flash
# config
DATABASE = 'flaskr.db'
DEBUG = True
SECRET_KEY = 'devkey'
USERNAME = 'admin'
PASSWORD = 'default'
# create app
app = F... |
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not... |
# Copyright 2019-2021 The Kubeflow 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 ... |
# encoding: utf-8
# module PyKDE4.kdeui
# from /usr/lib/python3/dist-packages/PyKDE4/kdeui.cpython-34m-x86_64-linux-gnu.so
# by generator 1.135
# no doc
# imports
import PyKDE4.kdecore as __PyKDE4_kdecore
import PyQt4.QtCore as __PyQt4_QtCore
import PyQt4.QtGui as __PyQt4_QtGui
import PyQt4.QtSvg as __PyQt4_QtSvg
cl... |
# coding: UTF-8
#
# TileCutter Project Module (Old version)
#
# Copyright © 2008-2011 Timothy Baldock. All Rights Reserved.
import os, sys
import wx
import logger
debug = logger.Log()
import config
config = config.Config()
from tc import Paths
paths = Paths()
from environment import getenvvar
# project[view][sea... |
import shutil
import os
import time
import csv
import json
from PIL import Image
import numpy as np
from sklearn.cross_validation import train_test_split
from sklearn.utils import shuffle
import plyvel
from caffe_pb2 import Datum
import constants
import utils
def prepare_data():
"""
Prepares our training and... |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
import logging
from odoo import models, fields, api, _
from odoo.tools.float_utils import float_compare
_logger = logging.getLogger(__name__)
class BarcodeRule(models.Model):
_inherit = 'barcode.rule'
type =... |
# Copyright 2014: Mirantis Inc.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required b... |
# -*- coding: utf-8
# pylint: disable=line-too-long
"""
A module for dealing with genome storages.
Pangenomic workflow heavily uses this module.
Ad hoc access to make sense of internal or external genome descriptions is also welcome.
"""
import os
import sys
import copy
import hashlib
import argparse
fr... |
#------------------------------------------------------------------------------
# Copyright (c) 2005-2011, Enthought, Inc.
# All rights reserved.
#
# This software is provided without warranty under the terms of the BSD
# license included in enthought/LICENSE.txt and may be redistributed only
# under the conditions des... |
# Copyright (C) 2012 Aaron Krebs akrebs@ualberta.ca
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# This program is... |
import operator
from django.contrib.auth.models import User, Group, Permission
from django.contrib.contenttypes.models import ContentType
from django.db.models import Q
from bop.models import ObjectPermission
def get_model_perms(model):
return [p[0] for p in model._meta.permissions] + \
[model._meta.get... |
import bibliopixel.colors as colors
#Load driver for your hardware, visualizer just for example
import time
from bibliopixel.animation import BaseMatrixAnim
class Leuchtturm(BaseMatrixAnim):
def __init__(self, led, start=0, end=-1, period = 20):
#The base class MUST be initialized by calling super like thi... |
# -*- coding: UTF-8 -*-
# File: trainer.py
# Author: Yuxin Wu <ppwwyyxx@gmail.com>
import tensorflow as tf
import threading
import time
from six.moves import zip
from .base import Trainer
from ..dataflow.common import RepeatedData
from ..models import TowerContext
from ..utils import *
from ..tfutils import *
from ... |
def isChiral(atom):
"""(atom) -> See if the bfs atoms can form a chiral center"""
q = {}
weights = {}
for oatom in atom.oatoms:
q[oatom] = [{atom:1, oatom:1}, oatom.number, [oatom]]
weights[oatom] = oatom.number + oatom.hcount
if len(q) == 3:
if atom.hcount != 1:
... |
from rest_framework import serializers
from .core import MoneyField
class StateListField(serializers.ListField):
id = serializers.PrimaryKeyRelatedField(source='pk', read_only=True)
state = serializers.CharField(source='name', read_only=True)
description = serializers.CharField(read_only=True)
class Ca... |
# -*- coding: utf-8 -*-
from django.contrib.auth.models import User
from django.shortcuts import render_to_response, get_object_or_404, redirect
from django.template import RequestContext
from friends.utils import get_following_set, get_follower_set, get_mutual_set
from django.contrib.auth.decorators import login_requi... |
#
# Copyright 2011 Matt Kenney
#
# This file is part of Feedsqueeze.
#
# Feedsqueeze 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 vers... |
import random
import redis
import json
client = redis.Redis()
client.execute_command('TS.CREATEDOC', "tsdoctest", json.dumps({
"interval": "hour",
"timestamp": "2016:01:01 00:00:00",
"key_fields": ["userId", "deviceId"],
"ts_fields": ["pagesVisited", "storageUsed", "trafficUsed"]
... |
# -*- coding: utf-8 -*-
################################################################
### common functions for data structures, file name manipulation, etc.
################################################################
from __future__ import print_function
import os
import os.path
import re
import sys
import sy... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# PAMMySQLTools documentation build configuration file, created by
# sphinx-quickstart on Mon Jan 11 02:34:00 2016.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in thi... |
# Copyright (c) 2015 Intel Research and Development Ireland Ltd.
#
# 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 app... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
with open('README.rst') as readme_file:
readme = readme_file.read()
with open('HISTORY.rst') as history_file:
history = history_file.read().replace('.. :changelog:', ... |
import base64
import io
import tarfile
from .base_artifact_processor import BaseArtifactProcessor
class TgzArtifactProcessor(BaseArtifactProcessor):
"""ArtifactProcessor that converts dir <=> inline compressed bytes."""
ARTIFACT_TYPE = 'tgz:bytes'
def dir_to_artifact(self, dir_=None, **kwargs):
... |
import functools
from tests.utils import should_throw
from tests.utils.registry import register
from wallace.db import String, NoSqlModel
from wallace.errors import SetupError
def _insert(f):
@functools.wraps(f)
def wraps():
class Driver(NoSqlModel):
pass
return f(Driver)
ret... |
#
# Gramps - a GTK+/GNOME based genealogy program
#
# Copyright (C) 2002-2006 Donald N. Allingham
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at you... |
# -*- coding: utf-8 -*-
#
# heroku-libsass-python documentation build configuration file, created by
# sphinx-quickstart.
#
# 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.
#
# All configuration... |
# -*- coding: utf-8 -*-
from tests.base_case import ChatBotTestCase
from chatterbot.trainers import ListTrainer
class ListTrainingTests(ChatBotTestCase):
def setUp(self):
super(ListTrainingTests, self).setUp()
self.chatbot.set_trainer(ListTrainer)
def test_training_adds_statements(self):
... |
import unittest
from pypika import (
Columns,
Database,
Query,
Tables,
)
class DropTableTests(unittest.TestCase):
database_xyz = Database("mydb")
new_table, existing_table = Tables("abc", "efg")
foo, bar = Columns(("a", "INT"), ("b", "VARCHAR(100)"))
def test_drop_database(self):
... |
from . import error
import logging
import requests
class RestAdapter(object):
def __init__(self):
self.logger = logging.getLogger('tsheets_logger')
def get(self, url, params, headers):
self.logger.debug("GET {} {} {}".format(url, params, headers))
response = None
try:
... |
""" Dataframe optimizations """
import operator
from dask.base import tokenize
from ..optimization import cull, fuse
from .. import config, core
from ..highlevelgraph import HighLevelGraph
from ..utils import ensure_dict
from ..blockwise import optimize_blockwise, fuse_roots, Blockwise
def optimize(dsk, keys, **kwar... |
# coding=UTF-8
from bellum.common.models import ResourceIndex, Requirement
from bellum.meta import MTI
_costs = {0:(ResourceIndex(titan=900, pluton=900, men=100), 1500), # infantry armor
1:(ResourceIndex(titan=60000, pluton=80000, men=20000), 36000), # nanobot armor
2:(ResourceIndex(titan=500, pluton=400, men=100)... |
#!/usr/bin/env python
#
# Copyright (C) 2019, Luca Baldini.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# This p... |
# Copyright 2018 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... |
# LIPGLOSS - Graphical user interface for constructing glaze recipes
# Copyright (C) 2017 Pieter Mostert
# 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, version 3 of the License.
# This progra... |
# -*- coding: utf-8 -*-
from flask import Flask
from flask_bootstrap import Bootstrap
from flask_sqlalchemy import SQLAlchemy
from flask_login import LoginManager
from flask_babel import Babel
from flask_moment import Moment
from .assets import assets_env, bundles
from flask_caching import Cache
from config import Con... |
# coding=utf-8
"""
复合字段的样例
"""
from __future__ import print_function
from data_packer import OptionalField
from data_packer import SelectorField, CompositedField
from data_packer import err, container
from common import demo_run
#### 多选字段 ####
# 最多选一个字段
fields = [
SelectorField(
fields = [
Op... |
from django import forms
from django.contrib.auth.models import User
# import from ac models
from ac.models import Contact
from ac.models import Coordinator, AakashCentre, User
from ac.models import Project, TeamMember, Mentor ,Manager
from captcha.fields import ReCaptchaField
class ContactForm(forms.ModelForm):
... |
# -*- Mode:Python; -*-
# /*
# * Copyright (c) 2010 INRIA
# *
# * This program is free software; you can redistribute it and/or modify
# * it under the terms of the GNU General Public License version 2 as
# * published by the Free Software Foundation;
# *
# * This program is distributed in the hope that it will b... |
import os
from django.utils.translation import ugettext_lazy as _
from openstack_dashboard import exceptions
{%- from "horizon/map.jinja" import server with context %}
{%- set app = salt['pillar.get']('horizon:server:app:'+app_name) %}
HORIZON_CONFIG = {
'dashboards': ({% if app.plugin is defined %}{% for plugin_... |
# SPDX-License-Identifier: MIT
'''Usage:
{0} scan (FILE)
{0} dependencies (JARNAME)
{0} (--help | --version)
Arguments:
scan Scan pom file for dependencies
dependencies Show dependency tree for jarFile
'''
import shutil
import sys
import os
from dependency_reader import DependencyReader
from doco... |
# -*- coding: utf-8 -*-
"""
Copyright (C) 2018-2018 plugin.video.youtube
SPDX-License-Identifier: GPL-2.0-only
See LICENSES/GPL-2.0-only for more information.
"""
from six.moves import BaseHTTPServer
from six.moves.urllib.parse import parse_qs, urlparse
from six.moves import range
import json
import os
... |
"""Contains functions to control games."""
import time
from bot.utilities.permission import Permission
from bot.utilities.tools import replace_vars
def start_game(bot, user, msg, cmd):
"""Return whether a user can start a game.
Takes off points if a non moderator wants to start a game.
Also makes sure ... |
# Copyright (C) 2010-2011 Richard Lincoln
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to
# deal in the Software without restriction, including without limitation the
# rights to use, copy, modify, merge, publish... |
# -*- coding: utf-8 -*-
# Copyright 2016 Antonio Espinosa <antonio.espinosa@tecnativa.com>
# Copyright 2014-2017 Tecnativa - Pedro M. Baeza <pedro.baeza@tecnativa.com>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl
from openerp import models, fields, api, exceptions, _
class L10nEsAeatMapTax(models.Mo... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.