src stringlengths 721 1.04M |
|---|
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
'''Finds yaml tests, converts them to Java tests.'''
from __future__ import print_function
import sys
import os
import os.path
import re
import time
import ast
import argparse
import metajava
import process_polyglot
import logging
from process_polyglot import Unhandled, S... |
# -*- coding: utf-8 -*-
# Define your item pipelines here
#
# Don't forget to add your pipeline to the ITEM_PIPELINES setting
# See: http://doc.scrapy.org/en/latest/topics/item-pipeline.html
import pymongo
from scrapy.conf import settings
from scrapy.exceptions import DropItem
from scrapy import log
from datetime ... |
# Generated by Django 3.0.3 on 2020-11-10 07:56
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('structure', '0032_structure_author_state'),
]
operations = [
migrations.RemoveField(
model_name... |
# -*- coding: utf-8 -*-
import os
basedir = os.path.abspath(os.path.dirname(__file__))
class Config:
SECRET_KEY = os.environ.get('SECRET_KEY') or 'greed is good who is your daddy?'
SSL_DISABLE = False
SQLALCHEMY_COMMIT_ON_TEARDOWN = True
SQLALCHEMY_RECORD_QUERIES = True
MAIL_SERVER = 'smtp.126.com... |
#!/usr/bin/env python3
# _*_coding:utf-8_*_
import os
import motor.motor_tornado
import redis
from pymongo import MongoClient
from common.logManageLib import get_logger
settings = dict(
template_path=os.path.join(os.path.dirname(__file__), "templates"),
static_path=os.path.join(os.path.dirname(__file__), "st... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import Skype4Py
import datetime
import time
import random
import logging
import sqlite3
from hashlib import sha1
from collections import deque
FORMAT=u'%(name)s %(thread)d %(levelname)s: %(message)s'
logging.basicConfig(format=FORMAT, level=logging.INFO)
logging.getLogg... |
import sublime
import time
class Printer(object):
""" Based on printer of Mavensmate
"""
printers = {}
def __init__(self, name):
self.name = name
self.visible = False
@classmethod
def get(cls, name, window_id=None):
if not window_id: window_id = sublime.active_window(... |
import unittest
from honeybee.radiance.analysisgrid import AnalysisGrid
from honeybee.radiance.recipe.solaraccess.gridbased import SolarAccessGridBased
from ladybug.analysisperiod import AnalysisPeriod
from ladybug.epw import EPW
from honeybee.futil import bat_to_sh
import os
class SunlighthoursTestCase(unittest.Tes... |
"""add fields for meetup
Revision ID: 2fb6ec55051f
Revises: 37f73d8e6963
Create Date: 2014-09-15 02:49:23.106092
"""
# revision identifiers, used by Alembic.
revision = '2fb6ec55051f'
down_revision = '37f73d8e6963'
from alembic import op
import sqlalchemy as sa
def upgrade():
### commands auto generated by Al... |
#!/usr/bin/env python
# pylint: disable=missing-docstring
# flake8: noqa: T001
# ___ ___ _ _ ___ ___ _ _____ ___ ___
# / __| __| \| | __| _ \ /_\_ _| __| \
# | (_ | _|| .` | _|| / / _ \| | | _|| |) |
# \___|___|_|\_|___|_|_\/_/_\_\_|_|___|___/_ _____
# | \ / _ \ | \| |/ _ \_ _| | __| \_ ... |
import unittest
from mock import patch
from exporters.exporter_config import ExporterConfig
from exporters.persistence.base_persistence import BasePersistence
from exporters.persistence.pickle_persistence import PicklePersistence
from exporters.utils import remove_if_exists
from .utils import valid_config_with_updates... |
'''
:copyright: Copyright 2013 by christian.meichsner@informatik.tu-chemnitz.de, see AUTHORS.
:license: BSD, see LICENSE for details.
'''
from distutils.core import setup
setup(name='ComparareEtPendere',
version='0.9',
packages=['MultisourceHtmlFormatter'],
provides=['MultisourceHtmlFormatter'],
... |
__author__ = "Radical.Utils Development Team (Andre Merzky, Ole Weidner)"
__copyright__ = "Copyright 2013, RADICAL@Rutgers"
__license__ = "MIT"
# import utility classes
from object_cache import ObjectCache
from plugin_manager import PluginManager
from singleton import Singleton
from threads import... |
"""foodapp URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.10/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
Class-ba... |
# Twitter API Test
# Execute: $ python twitter_test_02.py
from twython import TwythonStreamer
# Search terms (Note: hashtags only right now!)
terms = ['#fml', '#blessed', '#diy', '#guncontrol', '#obamacare']
# Twitter authentication
APP_KEY = 'li8wn8Tb7xBifCnNIgyqUw'
APP_SECRET = 'vcwq36w4C4VXamlqWBDKM2E8etsOoangDoM... |
from unittest import mock
from .. import *
from bfg9000.platforms import platform_name, target, posix
class TestTargetPlatform(TestCase):
def setUp(self):
platform_name._reset()
def tearDown(self):
platform_name._reset()
def test_default(self):
with mock.patch('platform.system'... |
import os
import base64
import time
from random import randrange
from mock import patch, MagicMock
from twisted.trial import unittest
from twisted.internet.defer import inlineCallbacks, returnValue
from twisted.internet import reactor, protocol
from twisted.internet.udp import Port
from twistar.registry import Regis... |
#coding:utf-8
"""
Django settings for mywebsite project.
For more information on this file, see
https://docs.djangoproject.com/en/1.7/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.7/ref/settings/
"""
# Build paths inside the project like this: os.path.join(B... |
"""
pyparticleprobe.dsd_calcs.attenuation
=========================
A grouping of functions that calcuates attenuation characteristics
7 Feb 2014 - Adapted by Nick Guy NOAA/NSSL/WRDD, NRC
"""
# HISTORY::
# 3 Feb 2014 - Nick Guy. NOAA/NSSL, NRC (nick.guy@noaa.gov)
#
# NOTES::
# Arrays seem to be able to be passe... |
"""
This example shows the trade-off (pareto frontier) of deficit against cost by altering a reservoir control curve.
Two types of control curve are possible. The first is a monthly control curve containing one value for each
month. The second is a harmonic control curve with cosine terms around a mean. Both Parameter... |
from __future__ import print_function
'''
qobuz.exception
~~~~~~~~~~~~~~~
:part_of: xbmc-qobuz
:copyright: (c) 2012 by Joachim Basmaison, Cyril Leclerc
:license: GPLv3, see LICENSE for more details.
'''
import sys
import pprint
import traceback
class QobuzXbmcError(Exception):
def __init__(... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import django.utils.timezone
import django_extensions.db.fields
from django.conf import settings
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('contenttypes', '0002_remove_content_type_nam... |
"""Manage assets.
Usage:
./manage.py assets rebuild
Rebuild all known assets; this requires tracking to be enabled:
Only assets that have previously been built and tracked are
considered "known".
./manage.py assets rebuild --parse-templates
Try to find as many of... |
# This program 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
# (at your option) any later version.
# This program is distributed in the hope that it will be useful... |
# coding=utf-8
# Copyright 2021 The Trax 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 a... |
#!/usr/bin/env python
"""
This is the testing unit for MUSiCC
"""
# to comply with both Py2 and Py3
from __future__ import absolute_import, division, print_function
import unittest
import os
import pandas as pd
import musicc
from musicc.core import correct_and_normalize
class MUSiCCTestCase(unittest.TestCase):
... |
"""
A script to obtain the Ashlock Fingerprints of all strategies in the Axelrod
library.
This writes a hash of the source code of each strategy to file: db.csv.
If the source code of a strategy changes **or** a new strategy is introduced
then the fingerprint is regenerated for that strategy.
"""
import inspect
impo... |
##########################################################################
# This file is part of WTFramework.
#
# WTFramework 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 ... |
from __future__ import print_function
from __future__ import absolute_import
from __future__ import division
try:
basestring
except NameError:
basestring = str
from compas_rhino.forms.base import BaseForm
from System.Windows.Forms import PictureBox
from System.Windows.Forms import PictureBoxSizeMode
from Sys... |
# -*- coding: utf-8 -*-
#
# Copyright © 2013-2016 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 License v.2, or (at your option) any later
# version. This program is distributed... |
#!/usr/bin/env python
#coding=utf-8
import json
import base64
import urllib
import urllib2
import ConfigParser
import subprocess
from baidu_nlu.srv import *
import rospy
'''
Baidu ASR Service need to register in http://yuyin.baidu.com
create your application, after that you will have your cuid,apikey,secretkey
all th... |
"""
# Copyright (C) 2016 OpenMotics BV
#
# 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 your option) any later version.
#
# This program is dist... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#########################################################################
# File Name: numpyIntro.py
# Author: lpqiu
# mail: qlp_1018@126.com
# Created Time: 2014年09月06日 星期六 16时33分05秒
#########################################################################
import numpy as... |
#!/usr/bin/env python
################################################
# Prey Configurator for Linux
# By Tomas Pollak
# (c) 2010 - Fork Ltd. (usefork.com)
################################################
# if having trouble with the GTK theme as root, do this:
# sudo ln -s ~/.themes/ /root/.themes
#################... |
import unittest
from rest_test import compare
class DictTestCase(unittest.TestCase):
def test_basic(self):
data = dict(
a=1,
b='2'
)
expected_data = dict(
b='2',
a=1
)
assert compare(data, expected_data)
def test_basic_... |
import logging
from django.http import HttpResponseRedirect, HttpResponseNotAllowed
from django.shortcuts import get_object_or_404, render
from django.db.models import Count, Q
from django.urls import reverse
from django.contrib.auth.decorators import permission_required
from django.contrib import messages
from django... |
#! /usr/bin/python
# -*- coding: utf-8 -*-
#
# Pybot server
#
# Copyright (c) 2012-2014 Alan Aguiar alanjas@hotmail.com
# Copyright (c) 2012-2014 Butiá Team butia@fing.edu.uy
# Butia is a free and open robotic platform
# www.fing.edu.uy/inco/proyectos/butia
# Facultad de Ingeniería - Universidad de la República - Urugu... |
###
### This script retrieves the coverage profiles of RNA-seq and Ribo-seq for all ribosomal protein genes. It stores it as text files.
###
import sys,numpy,HTSeq
import multiprocessing,multiprocessing.pool
def analysis(genomicFeature):
'''
This function computes the histograms of reads across transcript le... |
# Copyright 2012 OpenStack Foundation.
# 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 requ... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import json
from django.db import migrations
def clean_list(val):
if val is not None and (isinstance(val, str) or isinstance(val, unicode)):
return json.loads(val)
return val
def clean_int(val):
if val is not None and (isinstance(... |
# TestSwiftMetatype.py
#
# This source file is part of the Swift.org open source project
#
# Copyright (c) 2014 - 2016 Apple Inc. and the Swift project authors
# Licensed under Apache License v2.0 with Runtime Library Exception
#
# See https://swift.org/LICENSE.txt for license information
# See https://swift.org/CONTRI... |
#!/usr/bin/env python3
import sys, os, datetime, calendar, compile_gpx, pytz
import numpy as np
from scipy.io import wavfile
from housepy import log, config, util, drawing, science, crashdb
MEDIA_LENGTH = 2090.43 # hack per video to get everything to match correctly
log.info("Starting...")
if len(sys.argv) < 2 or n... |
# -*- coding: utf8 -*-
from __future__ import division, print_function, unicode_literals
from io import BytesIO
from gd3 import Gd3, Gd3Error
import unittest
GD3_ENCODING = 'utf-16'
class TestGd3(unittest.TestCase):
def __write_int32(self, buffer, value):
data = bytearray()
data.append(value & 0... |
"""
Given a string S and a string T, find the minimum window in S which will contain all the characters in T in complexity
O(n).
For example,
S = "ADOBECODEBANC"
T = "ABC"
Minimum window is "BANC".
Note:
If there is no such window in S that covers all characters in T, return the emtpy string "".
If there... |
#!/usr/bin/env python3
# vim:fileencoding=utf-8
# License: GPL v3 Copyright: 2018, Kovid Goyal <kovid at kovidgoyal.net>
import sys
from contextlib import contextmanager
from functools import wraps
from typing import (
IO, Any, Callable, Dict, Generator, Optional, Tuple, TypeVar, Union
)
from kitty.rgb import Col... |
from django.core.urlresolvers import reverse
from django.forms.models import modelformset_factory, modelform_factory
from django.http import HttpResponse
from django.shortcuts import redirect
from django.template import loader
from django_ajax.decorators import ajax
from corporate.auxiliary_scripts import update_resume... |
# Copyright 2015 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... |
from django.http import HttpResponse
from django.core import serializers
from django.shortcuts import render
from simple_rest import Resource
from .models import Client
def index(request):
return render(request, 'index.html')
class Clients(Resource):
def get(self, request):
clients = Client.object... |
# Copyright (C) 2016-2017 YouCompleteMe contributors
#
# This file is part of YouCompleteMe.
#
# YouCompleteMe 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 opt... |
# Copyright The Cloud Custodian Authors.
# SPDX-License-Identifier: Apache-2.0
import json
import hashlib
import operator
from concurrent.futures import as_completed
from c7n.actions import Action
from c7n.exceptions import PolicyValidationError
from c7n.filters import Filter, CrossAccountAccessFilter
from c7n.query i... |
gdir = 'c:/users/batagelj/work/python/graph/graph'
# wdir = 'c:/users/batagelj/work/python/graph/JSON/test'
wdir = 'c:/users/batagelj/work/python/graph/JSON/SN5'
import sys, os, datetime, json
sys.path = [gdir]+sys.path; os.chdir(wdir)
import GraphNew as Graph
import TQ
# fJSON = 'ConnectivityWeighted.json'
# f... |
import subprocess
import benchmark.util as Util
import benchmark.tools.template
import benchmark.result as result
class Tool(benchmark.tools.template.BaseTool):
def getExecutable(self):
return Util.findExecutable('wolverine')
def getVersion(self, executable):
return subprocess.Popen([execut... |
import sys
import os.path
import xml.etree.ElementTree as ET
flaglist = []
#VC7
flaglist.append({'name':'BasicRuntimeChecks', 'flag':'/GZ', 'value':'1'})
flaglist.append({'name':'BasicRuntimeChecks', 'flag':'/RTCsu', 'value':'3'})
flaglist.append({'name':'BasicRuntimeChecks', 'flag':'/RTCs', 'value':'1'})
flaglist.ap... |
"""@file reconstructor.py
contains the Reconstructor class"""
from abc import ABCMeta, abstractmethod
import os
import scipy.io.wavfile as wav
import numpy as np
class Reconstructor(object):
"""the general reconstructor class
a reconstructor is used to reconstruct the signals from the models output"""
__metacla... |
#!/usr/bin/env python
import math
import re
import StringIO
import copy
import random
import types
import struct
import colorsys
#Class definition for Gradients
#These use the format defined by the GIMP
#The file format is:
# GIMP Gradient ; literal identifier
# Name: <utf8-name> ; optional, else get from filename
... |
#
# SfaAPI authentication
#
import sys
from vt_manager_kvm.communication.sfa.util.faults import InsufficientRights, MissingCallerGID, MissingTrustedRoots, PermissionError, \
BadRequestHash, ConnectionKeyGIDMismatch, SfaPermissionDenied
#from vt_manager_kvm.communication.sfa.util.config import Config
from vt_manag... |
from __future__ import print_function
from builtins import object
# reborrowed from https://github.com/monsur/jsoncompare
import json
import sys
import types
TYPE = 'TYPE'
PATH = 'PATH'
VALUE = 'VALUE'
# Borrowed from http://djangosnippets.org/snippets/2247/
# with some modifications.
class Diff(object):
def __init... |
# -*- 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... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
(c) 2014 Brant Faircloth || http://faircloth-lab.org/
All rights reserved.
This code is distributed under a 3-clause BSD license. Please see
LICENSE.txt for more information.
Created on 21 April 2014 20:54 PDT (-0700)
"""
import os
import sys
import glob
import shu... |
# This program 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 (at your
# option) any later version.
#
# This program is distributed in the hope that it will be usefu... |
#!/usr/bin/env python3
'''
tests/lib/subtest.py
Utility functions for running sub-tests within a test case. Includes additional
logging to add context during sub-test execution.
'''
import logging
import unittest
from tests.lib.decorator import log_function
logger = logging.getLogger('sublime-ycmd.' + __name__)
de... |
# This file is part of goo-dataproxy.
#
# Copyright (c) 2103-2014 by Nucleo de Computacao Cientifica, UNESP
#
# Authors:
# Beraldo Leal <beraldo AT ncc DOT unesp DOT br>
# Gabriel von. Winckler <winckler AT ncc DOT unesp DOT br>
#
# goo-dataproxy is free software: you can redistribute it and/or modify
# it under ... |
from __future__ import unicode_literals
import unittest
import spotifyconnect
from spotifyconnect import utils
class ErrorTest(unittest.TestCase):
def test_error_is_an_exception(self):
error = spotifyconnect.Error(0)
self.assertIsInstance(error, Exception)
def test_maybe_raise(self):
... |
# coding: utf-8
# This Source Code is subject to the terms of the Mozilla Public License
# version 2.0 (the "License"). You can obtain a copy of the License at
# http://mozilla.org/MPL/2.0/.
import os, sys, re, subprocess, buildtools
from getopt import getopt, GetoptError
class Command(object):
name = property(lam... |
"""
Copyright 2017 Felix Widmaier
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 wr... |
import unittest
import join_circles
class Test(unittest.TestCase):
def setUp(self):
pass
def tearDown(self):
pass
def testStock(self):
self.assertEqual(18, join_circles.numCombos([1,2,3,4], 3))
self.assertEqual(180, join_circles.numCombos([1,2,3,4,5], 3))
s, nu... |
# 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 distributed in the hope that it will be useful
# but... |
import pytest
from chirc import replies
import chirc.tests.fixtures as fixtures
class TestWHOIS(object):
@pytest.mark.category("WHOIS")
def test_whois1(self, irc_session):
client1 = irc_session.connect_user("user1", "User One")
client2 = irc_session.connect_user("user2", "User Two")
... |
from django import forms
from django.contrib.auth.models import User
from captcha.fields import CaptchaField
from models import UserProfile
class UserForm(forms.ModelForm):
password = forms.CharField(required=True, widget=forms.PasswordInput(
attrs={'class':'form-control',
... |
# -*- coding:utf-8 -*-
# @author xupingmao <578749341@qq.com>
# @since 2020/12/08 01:46:35
# @modified 2021/07/04 17:09:54
# -*- coding:utf-8 -*-
# @since 2018-11-22 00:46:26
import os
import re
import math
import time
import web
import xconfig
import xutils
import xauth
import xmanager
import xtables
import random
fro... |
"""
Test utils
"""
import tempfile
import PIL
import numpy as np
from clouds.util.constants import HealthStatus
def createXors(tgt):
#create test xor images
xorIn = [
((255, 255, 255, 255), HealthStatus.GOOD),
((255, 255, 0, 0), HealthStatus.CLOUDY),
((0, 0, 0, 0), HealthStatus.GOOD),... |
"""Testcases for the clusterstats module."""
import unittest
import json
from pprint import pprint
import httpretty
from requests import HTTPError, Timeout
import pandas as pd
from clusterstats import http
from clusterstats import stats
class ClusterStatsTest(unittest.TestCase):
def test_read_servers(self):
... |
# Copyright 2017 Eficent Business and IT Consulting Services S.L.
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
from odoo import api, fields, models
import odoo.addons.decimal_precision as dp
class AnalyticResourcePlanLine(models.Model):
_inherit = 'analytic.resource.plan.line'
@api.... |
# Django settings for metadata project.
DEBUG = True
TEMPLATE_DEBUG = DEBUG
ADMINS = (
# ('Your Name', 'your_email@domain.com'),
)
MANAGERS = ADMINS
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3', # Add 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'.
'NAME': 'metada... |
from django.utils.translation import ugettext_lazy as _
from connected_accounts.conf import settings
from connected_accounts.provider_pool import providers
from .base import OAuth2Provider, ProviderAccount
class InstagramAccount(ProviderAccount):
PROFILE_URL = 'http://instagram.com/'
def get_profile_url(se... |
import numpy as np
def chained_updates(bounds, C_0_nnz, new_objval_at_feasible = None, new_objval_at_relaxation = None, MAX_CHAIN_COUNT = 20):
new_bounds = dict(bounds)
# update objval_min using new_value (only done once)
if new_objval_at_relaxation is not None:
if new_bounds['objval_min'] < new... |
import logging
from django import template
register = template.Library()
logger = logging.getLogger(__name__)
@register.filter
def round_num(number, precision=0):
"""Rounds a number to a given precision in decimal digits (default 0 digits) and returns the
integer value.
Precision may be negative. A pre... |
# -*- coding: utf-8 -*-
"""Return dictionary of secondary structure disorder.
Validate ss_dis data files. Download and/or regenerate if necessary.
Then return a dictionary of ss_dis data.
"""
from __future__ import (
absolute_import, division, print_function, unicode_literals)
import filecmp
import os
import re
... |
from __future__ import unicode_literals
from __future__ import print_function
from __future__ import division
from __future__ import absolute_import
import logging
import os
from collections import defaultdict
from builtins import object
import inspect
from typing import Any
from typing import Dict
from typing impor... |
# dnf configuration classes.
#
# Copyright (C) 2016-2017 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 License v.2, or (at your option) any later version.
# This program is distri... |
import logging
from django.utils.translation import ugettext
from django.utils.translation import ugettext_lazy as _
from xlivesettings import values
from xlivesettings.models import SettingNotSet
from xlivesettings.utils import is_string_like
log = logging.getLogger(__name__)
_NOTSET = object()
class Configuratio... |
# Copyright (C) 2015 - 2016 Google Inc.
# 2016 ycmd contributors
#
# This file is part of ycmd.
#
# ycmd 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 ... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright: (c) 2016, Abdoul Bah (@helldorado) <bahabdoul at gmail.com>
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'me... |
<<<<<<< HEAD
<<<<<<< HEAD
""" Test Codecs (used by test_charmapcodec)
Written by Marc-Andre Lemburg (mal@lemburg.com).
(c) Copyright 2000 Guido van Rossum.
"""#"
import codecs
### Codec APIs
class Codec(codecs.Codec):
def encode(self,input,errors='strict'):
return codecs.charmap_encode(input,errors,e... |
# -*- coding:utf-8 -*-
#注意类的声明方法:
class Thing(object):
#self是需要有的 否则报错
def test(self,hi):
print hi
a = Thing()#这是声明类的一个对象
a.test("hahaha")
print "---------------------------------"
test_things = "Apple Orange Crows Telephone Light Suger"
print "There is not 10 things in that list,let's fix it."
stuff = test_t... |
import math
import game_puck_board as board
from utils import *
racket_speed = 50
velocity_x = 0.0
velocity_z = 0.0
initial_pox_x = 0.0
initial_pox_z = 0.0
pos_x = 0.0
pos_z = 0.0
target_pos_x = 0.0
target_pos_z = 0.0
prev_pos_x = 0.0
prev_pos_z = 0.0
width = 2.0
length = 0.5
def setPosition(x,z):
global pos_x... |
# 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 use ... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import os
from nose.tools import eq_, ok_
from werkzeug.test import Client
from werkzeug.wrappers import BaseResponse
from clastic import Application
from clastic.render import (JSONRender,
JSONPRender,
... |
# -*- coding: utf-8 -*-
"""
Utilities and definitions for natsort, mostly all used to define
the _natsort_key function.
"""
from __future__ import (
print_function,
division,
unicode_literals,
absolute_import
)
# Std. lib imports.
import re
from math import isnan
from warnings import warn
from os impor... |
# /usr/bin/env python
"""
This module has utility functions for gathering up the static content
that is defined by XModules and XModuleDescriptors (javascript and css)
"""
import errno
import hashlib
import logging
import os
import sys
from collections import defaultdict
from docopt import docopt
from path import Pat... |
#!/usr/bin/python
# Copyright (c) 2012 The Native Client Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Cache accesses to GSDStorage locally.
Operations are provided to read/write whole files and to
read/write strings.
Read from G... |
# -*- coding: utf-8 -*-
# This code is part of Qiskit.
#
# (C) Copyright IBM 2019.
#
# This code is licensed under the Apache License, Version 2.0. You may
# obtain a copy of this license in the LICENSE.txt file in the root directory
# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0.
#
# Any modif... |
# Copyright 2020 Open Source Robotics Foundation, 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... |
__all__ = ['convex_hull_image', 'convex_hull_object']
import numpy as np
from ..measure._pnpoly import grid_points_in_poly
from ._convex_hull import possible_hull
from ..measure._label import label
from ..util import unique_rows
try:
from scipy.spatial import Delaunay
except ImportError:
Delaunay = None
def... |
# Copyright 2015 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from contextlib import contextmanager
from optparse import OptionParser
from pex.bin.pex import configure_clp, configure_clp_pex_resolution
from pex.fetcher import PyPIFetcher
from pex.pa... |
# -*- coding: utf-8 -*-
from django.core.exceptions import FieldError
from hvad.forms import TranslatableModelForm, TranslatableModelFormMetaclass
from hvad.test_utils.context_managers import LanguageOverride
from hvad.test_utils.testcase import NaniTestCase
from testproject.app.models import Normal
from django.db impo... |
# Copyright 2018-2020 The Wazo Authors (see the AUTHORS file)
# SPDX-License-Identifier: GPL-3.0-or-later
import time
import smtplib
from collections import namedtuple
from email import utils as email_utils
from email.mime.text import MIMEText
from wazo_auth.services.helpers import BaseService
EmailDestination = n... |
#!/usr/bin/env python3
"""Python binding of Joystick wrapper of LetMeCreate library."""
import ctypes
_LIB = ctypes.CDLL('libletmecreate_click.so')
def get_x():
"""Returns the X position of the joystick.
Note: An exception is thrown if it fails to read the X position from the
chip.
"""
pos_x = ... |
###
# Copyright (c) 2002-2005, Jeremiah Fincher
# Copyright (c) 2009-2010, James McCoy
# 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 ... |
from typing import Any, Dict, List, Optional
from unittest.mock import Mock, patch
from django.conf import settings
from zerver.apps import flush_cache
from zerver.lib.cache import (
MEMCACHED_MAX_KEY_LENGTH,
InvalidCacheKeyException,
NotFoundInCache,
bulk_cached_fetch,
cache_delete,
cache_del... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.