src stringlengths 721 1.04M |
|---|
# -*- coding: utf-8 -*-
# Natural Language Toolkit: Phrase Extraction Algorithm
#
# Copyright (C) 2001-2016 NLTK Project
# Authors: Liling Tan, Fredrik Hedman, Petra Barancikova
# URL: <http://nltk.org/>
# For license information, see LICENSE.TXT
def extract(f_start, f_end, e_start, e_end,
alignm... |
"""gom_server URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.8/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-... |
# Divide and Conquer Algorithm for finding the maximum sub array sum
def maxSubArraySum(arr,h,t):
if h == t:
return arr[h]
m = (h+t)//2
# 1. find max in left subarray
leftSum = maxSubArraySum(arr,h,m)
# 2. find max in right subarray
rightSum = maxSubArraySum(arr,m+1,t)
# 3. find max in mid-point crossin... |
from warcio.capture_http import capture_http
import threading
from wsgiref.simple_server import make_server, WSGIServer
import time
import requests
from warcio.archiveiterator import ArchiveIterator
from pytest import raises
# ==================================================================
class TestCaptureHttp... |
#!/usr/bin/env python
"""
Author : tharindra galahena (inf0_warri0r)
Project: classifing music using neural network
Blog : http://www.inf0warri0r.blogspot.com
Date : 23/05/2013
License:
Copyright 2013 Tharindra Galahena
This is free software: you can redistribute it and/or modify it under
the terms of the G... |
NAME = "ZenPacks.boundary.EventAdapter"
VERSION = "1.0.0"
AUTHOR = "Boundary"
LICENSE = "Apache v2"
NAMESPACE_PACKAGES = ['ZenPacks', 'ZenPacks.boundary']
PACKAGES = ['ZenPacks', 'ZenPacks.boundary', 'ZenPacks.boundary.EventAdapter']
INSTALL_REQUIRES = []
COMPAT_ZENOSS_VERS = ">=4.2"
PREV_ZENPACK_NAME = ""
from setupt... |
import sys
import re
import os
import pika
path=os.path.abspath(__file__)
path=os.path.dirname(os.path.dirname(path))
sys.path.append(path)
def start():
msg="欢迎使用RPC程序,现在初始化rbbitMQ链接."
print(msg)
with open(path+"\conf\conf") as conf:
data=conf.read()
old=re.findall(r"RbbitMQ_server_ip=\".*\"",... |
# Copyright 1999-2012 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
import gzip
import errno
try:
import threading
except ImportError:
import dummy_threading as threading
from portage import _encodings
from portage import _unicode_encode
from portage.util import writemsg_leve... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Proxy models for augmenting our source data tables with methods useful for processing.
"""
from .ballotmeasurecontests import (
OCDBallotMeasureContestProxy,
OCDBallotMeasureContestIdentifierProxy,
OCDBallotMeasureContestOptionProxy,
OCDBallotMeasureCont... |
from django.db import models as model_fields
from django.conf.urls import url, include
from django.contrib.auth import models as django_models
from polymorphic import PolymorphicModel
from cabot.cabotapp import models
from rest_framework import routers, serializers, viewsets, mixins
import logging
logger = logging.get... |
#!/usr/bin/env python
# -*- coding: utf-8 -*- #
from __future__ import unicode_literals
AUTHOR = 'Calango'
SITENAME = 'Calango Hacker Club'
SITEURL = ''
PATH = 'content'
TIMEZONE = 'America/Sao_Paulo'
DEFAULT_LANG = 'pt'
ARTICLE_URL = 'blog/{slug}'
ARTICLE_SAVE_AS = 'blog/{slug}/index.html'
PAGE_URL = '{slug}'
PA... |
#!/usr/bin/env python
#
# Copyright 2010 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law o... |
import sys, random
import pygame
from pygame.locals import *
class Screen(object):
def __init__(self, width=640, height=400, fps=60, stars=200):
self.running = True
self.fps = fps
self.playtime = 0.0
self.total_stars = stars
pygame.init()
pygame.display.set_caption("Press ESC to quit")
self.width = w... |
# Copyright 2019 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 applicab... |
# Copyright (c) 2013 Mirantis Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writ... |
"""All necessary calculations in pre_simulate()
"""
import os
import logging
from energy_demand.read_write import data_loader
from energy_demand.basic import basic_functions
from energy_demand.scripts import init_scripts
from energy_demand.read_write import write_data
from energy_demand.assumptions import general_assu... |
#coding=utf-8
# Copyright (C) 2015, Alibaba Cloud Computing
#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, merg... |
'''
Docker interface module
'''
import os
from functools import wraps
from os import path
import six
from docker import APIClient, errors
from .graph.artifacts import Dockerfile
from .graph.nodes import Container, Root, Volume
from .helper import Logger
_cli = None
def _get_name(func):
@wraps(func)
def fun... |
#!/usr/bin/env python
"""
RS 2017/03/01: Simple target class to read in and hold JLA data
This reads in data files on type Ia supernova light curves from
"Improved cosmological constraints from a joint analysis
of the SDSS-II and SNLS supernova samples",
M. Betoule et al., A&A 568, A22 (2014).
I cal... |
"""
Tests for the best response check
"""
import numpy as np
from nashpy.utils.is_best_response import (
is_best_response,
)
def test_is_best_response_example_1():
"""
This tests an example from the discussion documentation.
The second assert checks that the column player strategy is as expected.
... |
import socket
import logging
import inspect
import threading
from datetime import datetime
__author__ = 'Dan Cristian <dan.cristian@gmail.com>'
class L:
def __init__(self):
pass
l = None
# KEY setting, this filters out message priority from being logged
LOGGING_LEVEL = logging.INFO
LOG_F... |
from django.db import models
import json as simplejson
from django.contrib.contenttypes.models import ContentType
from django.contrib.contenttypes import generic
from django.core.urlresolvers import reverse
from django.shortcuts import get_object_or_404
from django.utils.translation import ugettext_lazy as _
from mailc... |
# -*- coding: utf-8 -*-
# Copyright 2016 OpenSynergy Indonesia
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from openerp import models, fields, api
from openerp.tools.translate import _
from openerp.exceptions import Warning as UserError
class ResPartner(models.Model):
_inherit = "res.partner"... |
# -*- coding: utf-8 -*-
import json
import os
import sys
import requests
from genestack import environment
from genestack.genestack_exceptions import GenestackException
from genestack.java import decode_object
class _Bridge(object):
@staticmethod
def _send_request(path, data):
headers = {'Genestack-T... |
#!/usr/bin/python
ANSIBLE_METADATA = {'status': ['preview'],
'supported_by': 'community',
'version': '1.0'}
DOCUMENTATION = '''
---
module: k5_inter_project_link
short_description: Create inter-project link on K5 in particular AZ
version_added: "1.0"
description:
- K5 call ... |
# -*- coding: utf-8 -*-
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
... |
# -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import DataMigration
from django.db import models
class Migration(DataMigration):
def forwards(self, orm):
from django.core.management import call_command
call_command("loaddata", "parental_results.json")
def backwa... |
##
# Copyright (c) 2010-2017 Apple 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 by applicab... |
# ===========
# pysap - Python library for crafting SAP's network protocols packets
#
# SECUREAUTH LABS. Copyright (C) 2021 SecureAuth Corporation. All rights reserved.
#
# The library was designed and developed by Martin Gallo from
# the SecureAuth's Innovation Labs team.
#
# This program is free software; you can red... |
"""add test_result_status items
Revision ID: 95ecf01d9cb4
Revises: ea71f73f5460
Create Date: 2017-03-29 19:41:26.581925
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '95ecf01d9cb4'
down_revision = 'ea71f73f5460'
branch_labels = None
depends_on = None
def up... |
# LucidProgramming -- Natural Language Processing in Python: Part 1
# YouTube Video: https://www.youtube.com/watch?v=tP783g97C5o
# Prior to running this script, you will require Python to be installed on
# your machine. If so, you may run the following command via pip:
# pip install nltk
# Once installed, you shoul... |
import os
from pip.backwardcompat import urllib
from tests.path import Path
from pip.index import package_to_requirement, HTMLPage, get_mirrors, DEFAULT_MIRROR_HOSTNAME
from pip.index import PackageFinder, Link, InfLink
from tests.test_pip import reset_env, run_pip, pyversion, here
from string import ascii_lowercase
fr... |
import pytest
from unittest import mock
from django.urls import reverse
from django.contrib.auth.models import AnonymousUser
from django.contrib.contenttypes.models import ContentType
from django.test import RequestFactory
from base.test.factories import UserFactory
from base.test.factories import get_authenticated_req... |
"""
@summary: Converts the random PAMs back into CSVs and add back in headers
"""
import concurrent.futures
import csv
import os
import numpy as np
# .............................................................................
def writeCSVfromNpy(outFn, mtxFn, headerRow, metaCols):
"""
@summary: Converts a num... |
# 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 appl... |
"""
Handle multiple parsed junit reports
"""
from __future__ import unicode_literals
import os
from . import parser
from .common import ReportContainer
from .parser import SKIPPED, FAILED, PASSED, ABSENT
from .render import HTMLMatrix, HTMLReport
UNTESTED = "untested"
PARTIAL_PASS = "partial pass"
PARTIAL_FAIL = "part... |
"""
Control global computation context
"""
from contextlib import contextmanager
from collections import defaultdict
_globals = defaultdict(lambda: None)
class set_options(object):
""" Set global state within controled context
This lets you specify various global settings in a tightly controlled with
b... |
"""Modules API Version 1.0.
This API client was generated using a template. Make sure this code is valid before using it.
"""
import logging
from datetime import date, datetime
from .base import BaseCanvasAPI
from .base import BaseModel
class ModulesAPI(BaseCanvasAPI):
"""Modules API Version 1.0."""
def __i... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
'''
async web application.
'''
import logging; logging.basicConfig(level=logging.INFO)
import asyncio, os, json, time
from datetime import datetime
from aiohttp import web
from jinja2 import Environment, FileSystemLoader
from config import configs
import orm
from cor... |
# This only tests the TokenCredentials test case, since the
# CertificateCredentials would be mocked out anyway.
# Namely:
# - timing out of the token
# - creating multiple tokens for different topics
import pytest
from freezegun import freeze_time
from apns2.credentials import TokenCredentials
TOPIC = 'com.example.... |
import threading
import time
import requests
import datetime as dt
import NTUH_clinic as nc
# 門診查詢參數檔案(.CSV file)
ParamaterFileName = "NTUH_params"
# 查詢動作的時間間隔
interval = 300 # sec
def query(sess, classname, directory, url, hosp, dept, ampm, querydate):
bs = nc.BsObject(url, hosp, dept, ampm, querydate, sess)
... |
#
# file: innerprod.py
# Methods for evaluating inner products of P|H^t> where
# P is a given projector.
#
import numpy as np
from multiprocessing import Pool, cpu_count
from libcirc.stabilizer.stabilizer import StabilizerState
from libcirc.stateprep import prepH, prepL
# Median of means calculation can be done via ... |
import numpy
import scipy.ndimage
from ... import veros_method, runtime_settings as rs
from .. import utilities
@veros_method
def isleperim(vs, kmt, verbose=False):
utilities.enforce_boundaries(vs, kmt)
if rs.backend == 'bohrium':
kmt = kmt.copy2numpy()
structure = numpy.ones((3, 3)) # merge d... |
import mock
import string
from unittest import TestCase
from pantsmud.driver.command import CommandManager
class TestCommandManagerAdd(TestCase):
def setUp(self):
self.func = lambda: None
self.name = "test"
self.command_manager = CommandManager(self.name)
def test_command_exists_after... |
#/###################/#
# Import modules
#
#ImportModules
import ShareYourSystem as SYS
#/###################/#
# Build the model
#
#Simulation time
SimulationTimeFloat=150.
#SimulationTimeFloat=0.2
BrianingDebugVariable=0.1 if SimulationTimeFloat<0.5 else 25.
#Define
MyPredicter=SYS.PredicterClass(
).mapSet(
{
... |
#!/usr/bin/env python3
"""
Created on 21 Sep 2020
@author: Jade Page (jade.page@southcoastscience.com)
DESCRIPTION
The aws_group_setup utility is designed to automate the creation of AWS Greengrass groups using South
Coast Science's configurations.
The group must already exist and the ML lambdas must be associated ... |
#-*- coding: utf-8 -*-
import urllib,urllib2
import xml.dom.minidom
from resources.lib import utils
import json
title=['Canal +']
img=['cplus']
readyForUse=True
def get_token():
filePath=utils.downloadCatalog('http://service.mycanal.fr/authenticate.json/Android_Tab/1.1?highResolution=1','TokenCPlus.json',False,{}... |
# -*- coding: utf-8 -*-
"""
Players:
* one who makes sure a connection to the device is open
- a stable presence in the community; everyone knows where to find them
* one who holds the connection to the device
- may come and go with the connection
* one who knows how to command the device
* one who hears what the ... |
#
# Hubblemon - Yet another general purpose system monitor
#
# Copyright 2015 NAVER Corp.
#
# 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
#
# U... |
#!/usr/bin/env python3
# reproduce_fictional_prestige.py
# Scripts to reproduce models
# used in Chapter Three,
# The Directions of Literary Change.
import csv, os, sys, pickle, math
# we add a path to be searched so that we can import
# versatiletrainer, which will do most of the work
# Versatiletrainer, and the m... |
from abc import (
ABC, abstractmethod
)
from distutils.dir_util import copy_tree
import json
import os
import shutil
from django.conf import settings
from django.test import TestCase
from django.urls import reverse
from core.models import (
User, Batch, Section, Election, Candidate, CandidateParty,
Candid... |
###
# Copyright (c) 2013, Frumious Bandersnatch
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice,
# this list of co... |
"""Card and Deck definitions.
Cards are strings containing a rank character followed by a suit character,
because it's simpler than defining a class or named tuple while still being
immutable, hashable, easy to create, and human-readable.
I also want to define a deck as just a tuple of cards that contain exactly
all ... |
# coding: utf-8
# create_word_lists.py written by Duncan Murray 3/2/2014
# creates a simple list of verbs, nouns and adjectives for
# simple 'bag of words' parsing.
# First implementation uses the following dataset:
# WordNet 3.1 Copyright 2011 by Princeton University.
import os
import sys
from xml.dom.minidom ... |
#!/usr/bin/env python
"""The GRR relational database abstraction.
This defines the Database abstraction, which defines the methods used by GRR on
a logical relational database model.
"""
import abc
import collections
import re
from typing import Dict
from typing import Generator
from typing import Iterable
from typin... |
class ModelType:
def __init__(self):
self.type = None
self.properties = {}
self.models = []
self.logic_function_name = None
self.init_function_name = None
self.output_function_name = None
def __eq__(self, other):
if other.type == self.type:
re... |
import logging
import traceback
from aws_xray_sdk.core import xray_recorder
from aws_xray_sdk.core.models import http
from aws_xray_sdk.core.models.trace_header import TraceHeader
log = logging.getLogger(__name__)
# Django will rewrite some http request headers.
USER_AGENT_KEY = 'HTTP_USER_AGENT'
X_FORWARDED_KEY = ... |
#!/usr/bin/env python
# Copyright (c) 2012 Google Inc. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""
Test variable expansion of '<!()' syntax commands.
"""
import os
import TestGyp
test = TestGyp.TestGyp(format='gypd')
... |
'''
THIS CODE IS WRONG - LOOK TO THE .C ONE
Problem 61
16 January 2004
Triangle, square, pentagonal, hexagonal, heptagonal, and octagonal numbers are
all figurate (polygonal) numbers and are generated by the following formulae:
Triangle P3,n = n(n+1)/2 1, 3, 6, 10, 15, ...
Square P4,n = n^2 ... |
# coding: utf-8
# Copyright (c) 2012 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Defines class Rietveld to easily access a rietveld instance.
Security implications:
The following hypothesis are made:
- Rietveld enf... |
import os
import shutil
import threading
import time
import traceback
from lib.FileManager.FM import REQUEST_DELAY
from lib.FileManager.WebDavConnection import WebDavConnection
from lib.FileManager.workers.baseWorkerCustomer import BaseWorkerCustomer
class MoveToWebDav(BaseWorkerCustomer):
def __init__(self, sou... |
import itertools
import json
import logging
import baker
import yapga
import yapga.db
import yapga.util
log = logging.getLogger('yapga')
@baker.command
def fetch(url,
dbname,
mongo_host=yapga.db.DEFAULT_MONGO_HOST,
mongo_port=yapga.db.DEFAULT_MONGO_PORT,
username=None,
... |
#!/usr/bin/env python
from __future__ import print_function
import sys
from pycparser import c_parser, c_generator, c_ast, plyparser
from pycparser.ply import yacc
with open("paren/stddef") as f:
STDDEF = f.read()
class CParser(c_parser.CParser):
def __init__(self, *a, **kw):
super(CParser, self).__... |
# NOTE: Do not add any dependencies to this file - it needs to be run in a
# subprocess by a python version that might not have any installed packages,
# including importlab itself.
from __future__ import print_function
import ast
import json
import os
import sys
# Pytype doesn't recognize the `major` attribute:
# h... |
# -*- coding: utf-8 -*-
import base64
from .keywordgroup import KeywordGroup
from selenium.common.exceptions import TimeoutException
from kitchen.text.converters import to_bytes
class _AndroidUtilsKeywords(KeywordGroup):
# Public
def get_network_connection_status(self):
"""Returns an integer bitmask ... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (c) 2005-2010 ActiveState Software Inc.
# Copyright (c) 2013 Eddy Petrișor
"""Utilities for determining application-specific dirs.
See <http://github.com/ActiveState/appdirs> for details and usage.
"""
# Dev Notes:
# - MSDN on where to store app data files:
# ... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from __future__ import print_function
"""
This module implements a friendly (well, friendlier) interface between the raw JSON
responses from JIRA and the Resource/dict abstractions provided by this library. Users
will construct a JIRA ob... |
#! /usr/bin/env python
"""
Module with pixel and frame subsampling functions.
"""
from __future__ import division
from __future__ import print_function
__author__ = 'C. Gomez @ ULg'
__all__ = ['cube_collapse',
'cube_subsample',
'cube_subsample_trimmean']
import numpy as np
def cube_collapse(... |
from django.shortcuts import render_to_response
from django.template import RequestContext
from django.http import HttpResponse
from django.conf import settings
from operator import itemgetter
from datetime import datetime, timedelta
import json
import urllib2
import re
# Get API user and token from settings
user = se... |
#!/usr/bin/env python
# Copyright (c) 2012 Google Inc. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import copy
import gyp.input
import optparse
import os.path
import re
import shlex
import sys
import traceback
# Default debug modes for GY... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# ###
# Copyright (c) 2013, Rice University
# This software is subject to the provisions of the GNU Affero General
# Public License version 3 (AGPLv3).
# See LICENCE.txt for details.
# ###
"""The command-line interface for transforming cnxml files directly in workspace."""
... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Aaron LI
# Created: 2015-04-17
# Updated: 2016-06-30
#
"""
Convert the coordinates data in format (??h??m??s, ??d??m??s)
to format (degree, degree).
"""
import os
import sys
import re
import getopt
import math
USAGE = """Usage:
%(prog)s [ -h ] -i coords_file
R... |
import numpy as np
import numpy.random
import sympy as sp
import seaborn as sns
import matplotlib.pyplot as plt
def hmc(U, gradU, M, epsilon, m, theta, mhtest=1):
"""Hamiltonian Monte-Carlo algorithm with an optional Metropolis-Hastings test
U is potential energy as a callable function
gradU is its gradien... |
from bitcoin import *
import getpass
import json
import random
import argparse
import time
import os.path
import binascii
import readline
import platform
from . import diceware
from .blockchain_providers import *
from .aes import AES
SATOSHIS = 100000000
BTCUSD_RATE = 0
BTCUSD_FETCHED = 0
PROVIDER = None
NO_FIAT = Fal... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import django.db.models.deletion
from django.conf import settings
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]
operati... |
# Copyright 2014 The Oppia 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 applicable ... |
from django.db import models
class InterestStatus(models.Model):
status = models.CharField() #choices=visited, upcoming, skip, other
reason = models.TextField()
priority = models.IntegerField() #ramge: 1 to 5
class InterestType(models.Model):
itype = models.CharField() #choices=restaurant, cafe, s... |
from base import BabeBase, StreamHeader, StreamFooter
import csv
from charset import UTF8Recoder, UTF8RecoderWithCleanup, PrefixReader, UnicodeCSVWriter
import codecs
import logging
log = logging.getLogger("csv")
def linepull(stream, dialect, kwargs):
it = iter(stream)
fields = kwargs.get('fields', None)
... |
import sys
from twisted.web import proxy, http
from twisted.python import log
log.startLogging(sys.stdout)
class ScraperProxyClient(proxy.ProxyClient):
def handleHeader( self, key, value ):
proxy.ProxyClient.handleHeader(self, key, value)
def handleResponsePart(self, data):
proxy.Pr... |
import datetime
import logging
import os
import webapp2
from google.appengine.api import memcache
from google.appengine.ext import ndb
from google.appengine.ext.webapp import template
import tba_config
from base_controller import CacheableHandler
from consts.event_type import EventType
from helpers.event_helper impor... |
#!/usr/bin/env python
import dns
from dnsdisttests import DNSDistTest
class TestSpoofingSpoof(DNSDistTest):
_config_template = """
addAction(makeRule("spoofaction.spoofing.tests.powerdns.com."), SpoofAction({"192.0.2.1", "2001:DB8::1"}))
addAction(makeRule("spoofaction-aa.spoofing.tests.powerdns.com."), S... |
import tensorflow as tf
import matplotlib
import numpy as np
import matplotlib.pyplot as plt
import random
import math
np.random.seed(1234)
random.seed(1234)
plt.switch_backend("TkAgg")
def plotScatter(points, color):
xs = [x[0] for x in points]
ys = [y[1] for y in points]
plt.scatter(xs, ys, c=colo... |
#!/usr/bin/env python3
# -*- coding: utf8 -*-
"""
Usage:
stringinfo [options] [--] [STRING]...
Options:
STRING The strings for which you want information. If none are given, read from stdin upto EOF. Empty strings are ignored.
--list List all plugins, with their descriptions and whether they're defau... |
"""
Definition of urls for $safeprojectname$.
"""
from datetime import datetime
from django.conf.urls import url, include
from django.contrib import admin
import django.contrib.auth.views
import app.forms
import app.views
admin.autodiscover()
urlpatterns = [
url(r'^', include('app.urls', namespac... |
#coding=utf-8
'''
Created on 2015骞�12鏈�24鏃�
@author: Administrator
'''
import os
from queue import Queue
import re
import shutil
import Config
from process import Context, queueProcess, execCmd
from util import PackHelper, Log, Constant
def process(ctx):
if run(ctx, removebom) :
Log.pr... |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
import time
from .common import TestPurchase
class TestAveragePrice(TestPurchase):
def test_00_average_price(self):
""" Testcase for average price computation"""
self._load('account', 'test', 'ac... |
# -*- coding: utf-8 -*-
"""
xobox.utils.loader
~~~~~~~~~~~~~~~~~~
:copyright: Copyright 2017 by the Stormrose Project team, see AUTHORS.
:license: MIT License, see LICENSE for details.
"""
import importlib
import os
from xobox.utils import filters
def detect_class_modules(mod, parent=object):
"... |
# Copyright 2014 PerfKitBenchmarker 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 appli... |
# __author__ = 'Administrator'
# [
# {"questionId":"5","questionAns":"4"},
# {"questionId":"6","questionAns":"8"},
# {"questionId":"7","questionAns":"12"},
# {"questionId":"9","questionAns":"15"},
# {"questionId":"10","questionAns":"18"},
# {"questionId":"11","questionAns":"24"},
# {"questionId":"12","questionAns":"27... |
from marshmallow_jsonapi import fields
from marshmallow_jsonapi.flask import Relationship, Schema
class InstalledProfileSchema(Schema):
class Meta:
type_ = 'installed_profiles'
self_view = 'api_app.installed_profile_detail'
self_view_kwargs = {'installed_profile_id': '<id>'}
self_v... |
# -*- coding: utf-8 -*-
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: message.proto
import sys
_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from google.protobuf imp... |
import os
import botocore
import s3client
__author__ = 'Junya Kaneko <jyuneko@hotmail.com>'
def abspath(path, root_delimiter=True):
path = os.path.normpath(os.path.join(s3client.getcwd(), path))
if root_delimiter:
return path
else:
return path[1:]
def join(path, *paths):
return os.... |
from django.db import models
from openstates.data.models import LegislativeSession
class DataQualityReport(models.Model):
chamber = models.CharField(max_length=20)
session = models.ForeignKey(LegislativeSession, on_delete=models.CASCADE)
total_bills = models.PositiveIntegerField()
latest_bill_create... |
# list all the combination using recursive method
# use python 3.5 as default
"""
c(4, 2):
{1,2,3,4}
/ | \\
/ | \\
1{2,3,4} 2{3,4} 3{4}
/ ... |
# Copyright (c) 2010-2013 OpenStack Foundation
#
# 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 agree... |
# Copyright 2004-2015 Tom Rothamel <pytom@bishoujo.us>
#
# 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, m... |
import sys
from pathlib import Path
from typing import List, Optional, Set, Tuple
from dtags import style
from dtags.commons import (
dtags_command,
get_argparser,
normalize_dirs,
normalize_tags,
prompt_user,
)
from dtags.files import load_config_file, save_config_file
USAGE = "untag [-y] [DIR ...... |
import bpy
from functions import *
class Track(bpy.types.PropertyGroup):
'''object use to be listed as track in tracks list'''
def set_end_frame(self, context):
'''check that start and end frame are valid when
changing end frame settings'''
size = self.get(True).curve_to_frame.size
# check end isn't ov... |
# -*- coding: utf-8 -*-
from south.utils import datetime_utils as 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 'Article.content_list'
db.delete_column(u'articles_artic... |
raw=input("Enter the number 2 to 6:")
if(raw=='2'):
n1_str=input("n1: ")
n1=int(n1_str)
n2_str=input("n2: ")
n2=int(n2_str)
n3=0
n4=0
n5=0
n6=0
elif(raw=='3'):
n1_str=input("n1: ")
n1=int(n1_str)
n2_str=input("n2: ")
n2=int(n2_str)
n3_str=input("n3: ")
n3=int(n3_s... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.