src stringlengths 721 1.04M |
|---|
'''
Copyright 2013 Cosnita Radu Viorel
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, distribute... |
from pyramid.authentication import AuthTktAuthenticationPolicy
from pyramid.authorization import ACLAuthorizationPolicy
from pyramid.config import Configurator
from pyramid.security import ALL_PERMISSIONS, Allow, Authenticated
from pyramid.session import UnencryptedCookieSessionFactoryConfig
from sqlalchemy import engi... |
#!/usr/bin/env python
import subprocess
import select
import sys
import datetime
import time
import re
import json
import socket
import logging
import telegram
from contextlib import closing
from telegram.ext import Updater, CommandHandler, MessageHandler, Filters
savefile = "chatlist.json"
user_token = "8c6d20cee783... |
import kivy
kivy.require('1.9.1')
from kivy.clock import Clock
from kivy.uix.boxlayout import BoxLayout
from kivy.uix.stacklayout import StackLayout
from pygments.formatters.bbcode import BBCodeFormatter #explicit import to make pyinstaller work. do not remove
from kivy.uix.codeinput import CodeInput
from kivy.uix.text... |
"""This file contains code used in "Think Stats",
by Allen B. Downey, available from greenteapress.com
Copyright 2014 Allen B. Downey
License: GNU GPLv3 http://www.gnu.org/licenses/gpl.html
"""
from __future__ import print_function
import math
import random
import scipy.stats
import brfss
import first
import thinks... |
# -*- coding: utf-8 -*-
from odoo import models, fields, api
from odoo.exceptions import UserError
class ScanBarcode(models.Model):
_name = 'scan.barcode'
scan_barcode_input_code = fields.Char(string='输入要扫描的条码')
def prepare_line_out_data(self, line_out_ids):
line_data = {}
for line in lin... |
"""
Django settings for django_digisys 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(BASE_DIR, ... |
import uuid
import os
import traceback
import socket
import logging
import threading
import json
import time
import struct
import binascii
import sys
from hera import vmcontroller
from hera import accounting
from hera import settings
from hera import disks
HALT_TIMEOUT = 0.2
TIME_BETWEEN_REGISTRATIONS = 2
def numip(... |
#!/bin/python
import os, subprocess
import logging
from autotest.client import test
from autotest.client.shared import error, software_manager
sm = software_manager.SoftwareManager()
class libusb(test.test):
"""
Autotest module for testing basic functionality
of libusb
@author Xu Zheng ,zhengxu@cn.i... |
import os
from email import message_from_string
from io import BytesIO
from zipfile import ZipFile
import pytest
from pip._vendor.contextlib2 import ExitStack
from pip._internal.exceptions import UnsupportedWheel
from pip._internal.utils import wheel
from pip._internal.utils.typing import MYPY_CHECK_RUNNING
from test... |
#
# Copyright 2015-2017 Eric Thivierge
#
import math
import json
from kraken.ui.Qt import QtWidgets, QtGui, QtCore
from port import InputPort, OutputPort, IOPort
class NodeTitle(QtWidgets.QGraphicsWidget):
__color = QtGui.QColor(25, 25, 25)
__font = QtGui.QFont('Roboto', 14)
__font.setLetterSpacing(QtG... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
from django.conf import settings
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]
operations = [
migrations.Create... |
# This file is part of django-ca (https://github.com/mathiasertl/django-ca).
#
# django-ca 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... |
# Django settings for inspecttp project.
DEBUG = True
TEMPLATE_DEBUG = DEBUG
ADMINS = (
# ('Your Name', 'your_email@example.com'),
)
MANAGERS = ADMINS
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.', # Add 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'.
'NAME': '', ... |
import scipy as sp
import matplotlib.pyplot as plt
import matplotlib.animation as animation
# animation of the probability density of the wavefunction over the course
# of time
def probabilityDensity(x, t, V, psi):
# convert to the probability density
Nt = len(t)
rho = sp.real(sp.conjugate(psi)*psi)
... |
from __future__ import absolute_import, print_function, division
import netlib.utils
pkg_data = netlib.utils.Data(__name__)
class LRUCache:
"""
A simple LRU cache for generated values.
"""
def __init__(self, size=100):
self.size = size
self.cache = {}
self.cacheList = ... |
#!/usr/bin/env python
# encoding: utf-8
# massive_dos.py
#
# Copyright 2018 Rosalia d'Alessandro
#
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
#... |
# -*- coding: UTF-8 -*-
# Búsqueda de tweets por término
import tweepy
import time
import sys
# import os
consumer_key = 'e2C0wlpcDF2HFRZ1isnWXvdTm'
consumer_secret = 'muqOqWH1KByuC9ARZy006P8wclAryQcUgIsa1kcEzgXuUPw1aH'
access_token = '108874877-nLkeHo0WRx6Nsz9uctXFVtt9F2oam2Y8E5UfEZjt'
access_token_secret = '7puoG65... |
from django.test import Client, TestCase
from django.contrib.auth.models import User
from django.core.urlresolvers import reverse
from resources.models import Resource
from django.test.utils import setup_test_environment
setup_test_environment()
class CommunityViewTest(TestCase):
def setUp(self):
self.c... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import print_function
from pprint import pprint as ppt
import unittest
import sqlite3
import pickle
class Unittest(unittest.TestCase):
def test_UPDATE(self):
connect = sqlite3.connect(":memory:")
cursor = connect.cursor()
# ... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# author: limanman
# emails: xmdevops@vip.qq.com
from __future__ import unicode_literals
from django.db import models
from django.utils import timezone
AREA_CHOICE = [
('亚洲区域', (
('Asia', 'Asia'),
('Asia_Afghanistan', 'Asia_Afghanistan'),
('... |
import datetime
import pathlib
import re
import packaging.version
import requests
import tabulate
FILE_HEAD = r"""Plugins List
============
PyPI projects that match "pytest-\*" are considered plugins and are listed
automatically. Packages classified as inactive are excluded.
"""
DEVELOPMENT_STATUS_CLASSIFIERS = (
... |
import sys
def generate_npms(user_id, image_id, count, use_seq=False):
result_rows = []
latest = "2.1.0"
versions_json = '["2.1.0"]'
licenses_json = '["MIT"]'
origins_json = "[]"
source_pkg = ""
seq = 0
for c in range(count):
path = "/usr/testing/somegems/{}".format(c)
... |
#!/usr/bin/python
#
# Copyright (c) 2011 The Bitcoin developers
# Distributed under the MIT/X11 software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
#
import time
import json
import pprint
import hashlib
import struct
import re
import base64
import httplib
import... |
from btray import db
from btray.models.webhook_config import WebhookConfig
class User(db.Model):
user_id = db.Column(db.Integer, primary_key=True)
username = db.Column(db.String(80), unique=True)
email = db.Column(db.String(120), unique=True)
password = db.Column(db.PasswordType(schemes=['pbkdf2_sha512... |
from tkinter import *
from pygeocoder import Geocoder
import forecastio
def getForecast(latt, lngg, results):
#Set up the box that will hold all the results.
result = Tk()
result.title("Weather Results")
api_key = "d747bd6c3aa83c90ecc20dbbb019d5ea"
lat = latt
lng = lngg
forecast = ... |
#
# ASTLineOperatorVisitor.py
#
# This file is part of NEST.
#
# Copyright (C) 2004 The NEST Initiative
#
# NEST 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 o... |
# -*- 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
#... |
# 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
# Copyright 2014 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import (nested_scopes, generators, division, absolute_import, with_statement,
print_function, unicode_literals)
import hashlib
impor... |
import numpy as np
import pandas as pd
from pyFTS.benchmarks.Measures import acf
def BoxPierceStatistic(data, h):
"""
Q Statistic for Box-Pierce test
:param data:
:param h:
:return:
"""
n = len(data)
s = 0
for k in np.arange(1, h + 1):
r = acf(data, k)
s += r ** ... |
#!/usr/bin/env python
# -*- Mode: Python; tab-width: 4 -*-
#
# Netfarm Mail Archiver - release 2
#
# Copyright (C) 2005-2007 Gianluigi Tiesi <sherpya@netfarm.it>
#
# 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 Sof... |
import petsc4py, sys
petsc4py.init(sys.argv)
from petsc4py import PETSc
import os, inspect
from dolfin import *
import numpy
import ExactSol
import MatrixOperations as MO
import CheckPetsc4py as CP
import HiptmairPrecond
import HiptmairSetup
from timeit import default_timer as timer
m = 8
errL2b =numpy.zeros((m-1,1))... |
import re
from cfme.common import TopologyMixin, TimelinesMixin
from . import MiddlewareProvider
from utils.appliance import Navigatable
from utils.db import cfmedb
from utils.varmeth import variable
from . import _get_providers_page, _db_select_query
from . import download, MiddlewareBase, auth_btn, mon_btn
from util... |
from pyramid.response import Response
from pyramid.view import view_config
from sqlalchemy.exc import DBAPIError
from ..models import MyModel
@view_config(route_name='home', renderer='../templates/mytemplate.jinja2')
def my_view(request):
try:
query = request.dbsession.query(MyModel)
one = query... |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'ui/statementText.ui'
#
# Created: Sat Jul 25 12:17:11 2015
# by: PyQt4 UI code generator 4.9.1
#
# WARNING! All changes made in this file will be lost!
from PyQt4 import QtCore, QtGui
try:
_fromUtf8 = QtCore.QString.fromUtf8
excep... |
# -*- 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):
# Adding field 'Client.immigration_status'
db.add_column('morello_client', 'immigration_status',
... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
'''
1327. Fuses
Time limit: 1.0 second
Memory limit: 64 MB
[Description]
Sasha Privalov, a young programmer working in the SRITS (Scientific Research
Institute for Thaumaturgy and Spellcraft), finds his job rather enjoyable.
Indeed, he is the only programmer of such a wonderf... |
import time
import subprocess
from Hover_library import Hover
hover = Hover(address=0x42, ts=23, reset=24)
try:
while True:
# Check if hover is ready to send gesture or touch events
if (hover.getStatus() == 0):
# Read i2c data and print the type of gesture or touch event
... |
import matplotlib.pyplot as plt
import numpy as np
from matplotlib.ticker import MultipleLocator, FormatStrFormatter
from matplotlib.backends.backend_pdf import PdfPages
plt.rcParams['axes.linewidth'] = 2
pp = PdfPages('ggchem.pdf')
single_figures = 0
file = 'Static_Conc.dat'
data = open(file)
dummy = data.readl... |
"""Module for compiling codegen output, and wrap the binary for use in
python.
.. note:: To use the autowrap module it must first be imported
>>> from sympy.utilities.autowrap import autowrap
This module provides a common interface for different external backends, such
as f2py, fwrap, Cython, SWIG(?) etc. (Curren... |
from django.shortcuts import render_to_response, get_object_or_404
from django.http.response import HttpResponse, HttpResponseRedirect
from principal.models import Receta, Comentario
from django.contrib.auth.models import User
from django.template.context import RequestContext
from principal.forms import ContactoF... |
# -*- coding: utf-8 -*-
#
# This file is part of Invenio.
# Copyright (C) 2015 CERN.
#
# Invenio is free software; you can redistribute it
# and/or modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation; either version 2 of the
# License, or (at your option) any later... |
from flask import Blueprint, request, jsonify, g
from flask_restplus import abort, Resource, fields, Namespace, marshal_with
from app.models.item import Item
from app.models.bucketlist import Bucketlist
from app.utils.utilities import auth
item_api = Namespace(
'bucketlists', description='A bucketlist item manipul... |
import factory
from time import time
from decimal import Decimal as D
from django.utils.timezone import now
from django.db.models import get_model
from oscar.core.loading import get_class
from oscar_mws import MWS_MARKETPLACE_US
Selector = get_class('partner.strategy', 'Selector')
class UserFactory(factory.Djang... |
#! /usr/bin/python
# Version info: $Id: FitAllEquations2D.py 75 2009-08-04 19:32:09Z zunzun.com $
# the pythonequations base is located up one directory from the top-level examples
# directory, go up one directory in the path from there for the import to work properly
from __future__ import generators
import sys, o... |
"""
tests
-----
The module which call and centralize all the tests utilities.
"""
from parallel_tools import test_parallel_tools
from Logger import test_logger
from TUI_tools import test_tui_tools
from CodingText import test_codingtext
from ProcessTools import test_processtools
from numpy_tools import test_numpytool... |
"""
--------------------------------------------------------------------------------------------
Extracted from skikit-learn to ensure basic compatibility
without creating an explicit dependency.
For the original code see
http://scikit-learn.org/
and
https://github.com/scikit-learn
----------------------------... |
#
# ParameterWeaver: a code generator to handle command line parameters
# and configuration files for C/C++/Fortran/R/Octave
# Copyright (C) 2013 Geert Jan Bex <geertjan.bex@uhasselt.be>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as p... |
# vi: sw=4 ts=4 et:
"""network.py - cMonkey network module
This file is part of cMonkey Python. Please see README and LICENSE for
more information and licensing details.
"""
import numpy as np
import logging
import os.path
import cmonkey.util as util
import cmonkey.datamatrix as dm
import cmonkey.scoring as scoring
... |
import json
import logging
import textwrap
from collections import OrderedDict
from dataclasses import dataclass, fields
from pathlib import Path
from test.conftest import silent
from test.testutils import *
from typing import Any, Dict, List, Mapping, Optional, Set, Tuple, Type, Union
import pytest
import yaml
from ... |
#!/usr/bin/env python
import numpy as np
import matplotlib.pyplot as plt
from scipy.interpolate import interp1d
import scipy.special, scipy.interpolate, scipy.integrate
from scipy.interpolate import UnivariateSpline
from mpl_toolkits.mplot3d import Axes3D
plt.ion()
binprec = '>f8'
flag_plot = 1
flag_topo = 2 # 0: no... |
#Created by Dmytro Konobrytskyi, 2014 (github.com/Akson)
import numpy as np
import matplotlib
import matplotlib.pyplot
from RCP3.Infrastructure import TmpFilesStorage
class Backend(object):
def __init__(self, parentNode):
self._parentNode = parentNode
def Delete(self):
"""
This method ... |
from rospy.rostime import Time
import rospy
from python_qt_binding.QtCore import QTranslator
from abstract_item import AbstractItem
from helper_functions import prepare_number_for_representation, UPDATE_FREQUENCY, TOPIC_AGGREGATION_FREQUENCY, \
ROUND_DIGITS, MAXIMUM_OFFLINE_TIME
from arni_core.helper import SEUID... |
# Author: Nic Wolfe <nic@wolfeden.ca>
# URL: http://code.google.com/p/sickbeard/
#
# This file is part of Sick Beard.
#
# Sick Beard 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 t... |
import ctypes
from rlbot.utils.structures.bot_input_struct import PlayerInput
from rlbot.utils.structures.game_data_struct import Vector3
from rlbot.utils.structures.start_match_structures import MAX_PLAYERS
class Quaternion(ctypes.Structure):
_fields_ = [("x", ctypes.c_float),
("y", ctypes.c_flo... |
# -*- coding: utf-8 -*-
# Generated by Django 1.11 on 2017-05-05 08:31
from __future__ import unicode_literals
import ckeditor_uploader.fields
from django.db import migrations, models
import django.db.models.deletion
import django.db.models.manager
import djgeojson.fields
class Migration(migrations.Migration):
... |
"""cleverhans.model.Model implementation of cifar10_challenge.model.Model
This re-implementation factors variable creation apart from forward
propagation so it is possible to run forward propagation more than once
in the same model.
based on https://github.com/tensorflow/models/tree/master/resnet
"""
from __future__... |
# -*- coding: utf-8 -*-
#
# distributed documentation build configuration file, created by
# sphinx-quickstart on Wed Nov 27 17:56:03 2013.
#
# 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.
#
#... |
class InstancePermissionBackend(object):
supports_object_permissions = True
supports_anonymous_user = True
supports_inactive_user = True
def authenticate(self, username, password):
""" Abstain from offering user authentication. """
return None
def has_perm(self, user_obj, perm, obj... |
from header_sounds import *
from ID_factions import *
# default values:
# sf_priority_5
# sf_vol_10
sounds = [
("click", sf_2d|sf_vol_1,["drum_3.wav"]),
("gong", sf_2d|sf_priority_9|sf_vol_7, []),
("quest_taken", sf_2d|sf_priority_9|sf_vol_7, []),
("quest_completed", sf_2d|sf_priority_9|sf_vol_7, []),
("quest_su... |
#!/usr/bin/python3
"""
Usage: bugz.py [options]
Options:
-h, --help show this help message and exit
-u BZ_URL, --url=BZ_URL
Bugzilla URL
-q Q_URL, --query=Q_URL
Bugzilla Query URL
-b BUGID, --bugid=BUGID
Bug Id
-v, --verbose ... |
import dpkt
import humanfriendly
import nids
import sys
import pandas as pd
import socket
ips = {}
ip_to_domain = {}
def handle_tcp_stream(tcp):
end_states = (nids.NIDS_CLOSE, nids.NIDS_TIMEOUT, nids.NIDS_RESET)
ports = [80, 443]
if tcp.addr[1][1] not in ports:
return
global ips
if tcp.nid... |
# -*- coding: utf-8 -*-
#
# Copyright 2008-2010 Brett Adams
# Copyright 2015-2016 Mario Frasca <mario@anche.no>.
# Copyright 2017 Jardín Botánico de Quito
#
# This file is part of ghini.desktop.
#
# ghini.desktop is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public Lice... |
#! /usr/bin/python
#
# Auto-generate reST documentation for Sphinx from Evennia source
# code.
#
# Uses etinenned's sphinx autopackage script. Install it to folder
# "autogen" in this same directory:
#
# hg clone https://bitbucket.org/etienned/sphinx-autopackage-script autogen
#
# Create a directory tree "code/" co... |
import xgboost as xgb
import numpy as np
import sklearn.datasets
import sklearn.metrics
from sklearn.model_selection import train_test_split
from ray import tune
def XGBCallback(env):
tune.track.log(**dict(env.evaluation_result_list))
def train_breast_cancer(config):
data, target = sklearn.datasets.load_br... |
# -*- coding: utf-8 -*-
import os.path
import json
import itertools
import UserDict
import weakref
class JsonObj(object):
def __init__(self, path):
self._path = path
self._data = {}
self._load()
self._deleted = False
def __eq__(self, other):
return self._path == other... |
from __future__ import absolute_import
from django.http import HttpResponseForbidden
from .settings import OJ_IP_FILTER, OJ_USERS_IPS, OJ_PROXY_SIGNATURE, \
OJ_REMOTE_ADDR
def get_ip(request):
return request.META.get("HTTP_X_FORWARDED_FOR", "").strip().split(',')[0]
def get_proxy(request):
return reques... |
# -*- coding: utf-8 -*-
# ---------------------------------------------------------------------
#
# ---------------------------------------------------------------------
# Copyright (C) 2017-2018 The --- Project
# See LICENSE for details
# ---------------------------------------------------------------------
from rand... |
import sys
import operator
from collections import OrderedDict
from functools import reduce
from django.db import models
from django.db.models.fields.related import ForeignObjectRel
from django.db.models.constants import LOOKUP_SEP
from django.db.models.sql.constants import QUERY_TERMS
from django.shortcuts import get... |
from ctypescrypto.pkey import PKey
from ctypescrypto import pyver
import unittest,re
from base64 import b64decode, b16decode
from subprocess import Popen,PIPE,CalledProcessError
def pem2der(s):
start=s.find('-----\n')
finish=s.rfind('\n-----END')
data=s[start+6:finish]
return b64decode(data)
def runop... |
#!/usr/bin/env python
# Licensed to Cloudera, Inc. under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. Cloudera, Inc. licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you ma... |
# coding: utf-8
import logging
from django import forms
logger = logging.getLogger(__name__)
class CreateMovieForm(forms.Form):
latLng = forms.CharField(
label=u'緯度経度',
widget=forms.HiddenInput(attrs={'class': 'form-control'}),
)
start_lon = forms.DecimalField(
label=u'経度(スタート)... |
# Copyright 2018 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, ... |
import os
import sys
import logging
from atve import log
WORK_DIR = os.path.normpath(os.path.dirname(__file__))
LIB_DIR = os.path.normpath(os.path.join(WORK_DIR, "lib"))
SCRIPT_DIR = os.path.normpath(os.path.join(WORK_DIR, "script"))
TMP_DIR = os.path.normpath(os.path.join(WORK_DIR, "tmp"))
LOG_DIR = os.path.normpath... |
# -*- coding: utf-8 -*-
# Copyright(C) 2016 Edouard Lambert
#
# This file is part of a weboob module.
#
# This weboob module 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... |
import ckan.plugins as plugins
import ckan.plugins.toolkit as toolkit
import json
import ckanext.mdedit.logic.action as action
import pylons
from ckanext.mdedit import helpers
from ckanext.mdedit import validators as v
ignore_empty = plugins.toolkit.get_validator('ignore_empty')
from ckanext.mdedit.helpers import (
... |
import sys
sys.path.insert(1, "../../../")
import h2o, tests
import random
def random_attack():
def attack(family, train, valid, x, y):
kwargs = {}
kwargs['family'] = family
gaussian_links = ["inverse", "log", "identity"]
binomial_links = ["logit"]
poisson_links =... |
import sys
import re
import json
import argparse
import euphoria as eu
from .botbot import BotBot
from . import euphutils
from . import snapshot
room_name = 'testing'
password = None
nickname = 'BotBot'
help_text = '''\
@BotBot is a bot for Euphoria created by @myhandsaretypingwords that creates
other bots.
Usage
... |
#!/usr/local/bin/python3
# -*- coding: utf-8 -*-
'''
geetest常用公共方法
'''
SPLIT_ARRAY_JS = '''
function getSplitArray() {
for (var a, b = "6_11_7_10_4_12_3_1_0_5_2_9_8".split("_"), c = [], d = 0, e = 52; d < e; d++)
a = 2 * parseInt(b[parseInt(d % 26 / 2)]) + d % 2,
parseInt(... |
"""
Label Points
~~~~~~~~~~~~
Use string arrays in a point set to label points
"""
# sphinx_gallery_thumbnail_number = 3
from pyvista import examples
import pyvista as pv
import numpy as np
# Labels are not currently supported by the VTKjs conversion script
pv.rcParams["use_panel"] = False
##########################... |
from urlparse import urlparse
from lib.numbers import base36encode
from models import db, Url
from flask import Flask, Response, json, request, redirect
app = Flask(__name__)
# db.create_all()
@app.route("/create", methods=["GET", "POST"])
def create():
"""Create a short URL and return a JSON response."""
f... |
# Copyright (C) 2016 Arvid Fahlström Myrman
#
# 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 your option) any later version.
#
# This program is distr... |
from social_core.backends.base import BaseAuth
from social_core.utils import module_member
from .utils import setting
DEFAULT_AUTHENTICATION_PROVIDERS_BRIEF = 3
def get_login_providers(request, short=False):
"""
Returns a list of available login providers based on the
AUTHENTICATION_BACKENDS setting. Ea... |
"""
Create SQL statements for QuerySets.
The code in here encapsulates all of the SQL construction so that QuerySets
themselves do not have to (and could be backed by things other than SQL
databases). The abstraction barrier only works one way: this module has to know
all about the internals of models in order to get ... |
# Copyright 2012 the rootpy developers
# distributed under the terms of the GNU General Public License
from nose.plugins.skip import SkipTest
from rootpy.utils.silence import silence_sout
try:
with silence_sout():
import ROOT
from ROOT import (RooFit, RooRealVar, RooGaussian, RooArgusBG,
... |
#!/usr/bin/python
## system-config-printer
## Copyright (C) 2006, 2007, 2008, 2010 Red Hat, Inc.
## Authors:
## Florian Festi <ffesti@redhat.com>
## Tim Waugh <twaugh@redhat.com>
## This program is free software; you can redistribute it and/or modify
## it under the terms of the GNU General Public License as publi... |
from . import ptype, parray, pstruct, pbinary, pint, pfloat, pstr
from . import utils, dynamic, provider
dyn, prov = dynamic, provider
__all__ = 'ptype','parray','pstruct','pbinary','pint','pfloat','pstr','dynamic','dyn','prov'
from . import config
Config = config.defaults
## globally changing the ptype provider
def... |
from __future__ import unicode_literals
import re
from setuptools import find_packages, setup
def get_version(filename):
with open(filename) as fh:
metadata = dict(re.findall("__([a-z]+)__ = '([^']+)'", fh.read()))
return metadata['version']
setup(
name='A Mopidy Party tool, who all People... |
#!/usr/bin/env python
import sys
import re
import hashlib
import logging
from collections import defaultdict
_log = logging.getLogger('a14otp')
_PATT3 = re.compile(r'(?:(\w)\1\1)')
_PATT5 = re.compile(r'(?:(\w)\1\1\1\1)')
_MAX_CURSOR = 10000000 # 10 million
def clean(items, predicate):
assert isinstance(items,... |
from endpoints import Controller, CorsMixin
import sqlite3
from datetime import datetime
conn = sqlite3.connect('databaseForTest.db')
cur = conn.cursor()
class Default(Controller, CorsMixin):
def GET(self):
return "CIUK"
def POST(self, **kwargs):
return '{}, {}, {}'.format(kwargs['title'], kwargs['desc']... |
"""
Django settings for app 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(BASE_DIR, ...)
import... |
from __future__ import absolute_import, unicode_literals
import pickle
import pytest
from itertools import count
from case import Mock, mock, skip
from kombu.five import (
items, PY3,
)
from kombu.utils import functional as utils
from kombu.utils.functional import (
ChannelPromise, LRUCache, fxrange, fxran... |
# Copyright 2013 The Servo Project Developers. See the COPYRIGHT
# file at the top-level directory of this distribution.
#
# Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
# http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
# <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
#... |
# ----------------------------------------------------------------
# name : simpleHTTPServer.py
# object: Simple MultiThreaded Web Server
# usage: python SimpleHTTPServer [port] / default port: 8080
# author: denis_guillemenot@fr.ibm.com / denis.guillemenot@gmail.com
# date : 19/09/2013
# ---------------------------... |
'''Basic module for accounting'''
import utils as ul
import parse_singularo_afm as pafm
FORMAT_LINE = '%-15s %12s %12s'
SPLIT_CHAR = '.'
LM1 = ul.read_txt_to_dict('log_sxedio.txt')
def parse_afm_5398(file='afm-5398.txt'):
afmdic = {}
pfpadic = {}
with open(file) as fle:
for line in fle:
... |
# coding=utf-8
# Copyright 2014 Timothy Zhang(zt@live.cn).
#
# This file is part of Structer.
#
# Structer 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)... |
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from django.test import TestCase
class GuessedTestCase(TestCase):
"""
Generated: 2015-10-18T13:44:15.980585
is_html5: True
is_ajax: False
is_authenticated: True
has_context_data: True
has_template_name: True
has_get_params:... |
"""
@package mapwin.mapwindow
@brief Map display canvas - buffered window.
Classes:
- mapwindow::BufferedWindow
- mapwindow::GraphicsSet
- mapwindow::GraphicsSetItem
(C) 2006-2013 by the GRASS Development Team
This program is free software under the GNU General Public License
(>=v2). Read the file COPYING that c... |
#!/usr/bin/env python
import sys
import os
import re
import tempfile
import subprocess
import fileinput
import shutil
import optparse
import urllib2
from ftplib import FTP
import tarfile
from galaxy.util.json import from_json_string, to_json_string
def stop_err(msg):
sys.stderr.write(msg)
sys.exit(1)
def fe... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.