src stringlengths 721 1.04M |
|---|
# -*- coding: utf-8 -*-
"""
All unit tests for the newspaper library should be contained in this file.
"""
import sys
import os
import unittest
import time
import traceback
from collections import defaultdict, OrderedDict
import concurrent.futures
TEST_DIR = os.path.abspath(os.path.dirname(__file__))
PARENT_DIR = os.p... |
# Copyright 2020 Google LLC. 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 law or a... |
"""Module containing the `User` model."""
import uuid
import secrets
import string
from datetime import datetime
from sqlalchemy.dialects.postgresql import UUID
from sqlalchemy_utils.models import Timestamp
from flask import current_app
from boilerplateapp.extensions import db, passlib
class User(db.Model, Timesta... |
#!/usr/bin/python2.7
# -*- coding: utf-8 -*-
import os, functions, settings
# STARTUP BAZY DANYCH
################################################################################
database = settings.cDatabase(settings.databaseFile)
for kraina in settings.swiat:
print kraina.nazwa + "."
# KAMERY
############... |
import os
import re
import pandas as pd
import string
import itertools
import numpy as np
import sys
import argparse
from collections import OrderedDict
if __name__ == '__main__':
parser = argparse.ArgumentParser(description='Create GO annotation and enrichment file')
parser.add_argument('-i',type=str,dest='i... |
# Create your views here.
from django.core.urlresolvers import reverse
from django.http.response import JsonResponse, HttpResponse
from settings.settings import AUTHORIZED_KEYS_FILE, SITE_URL
from bioshareX.models import Share, SSHKey, MetaData, Tag
from bioshareX.forms import MetaDataForm, json_form_validate
from guar... |
from bap import disasm
from bap.adt import Visitor, visit
from ..util import flatten
from z3 import If, eq, Const, And, BitVecRef, ArrayRef, BitVecNumRef, \
BitVecVal, BitVecSort, Context
from re import compile
def boolToBV(boolExp, ctx):
return If(boolExp, BitVecVal(1, 1, ctx=ctx), BitVecVal(0, 1, ctx=ct... |
import collections
import queue
import unittest
from contextlib import contextmanager
import pytest
from tests.BearTestHelper import generate_skip_decorator
from coalib.bears.LocalBear import LocalBear
from coalib.misc.ContextManagers import prepare_file
from coalib.settings.Section import Section
from coalib.setting... |
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
#
# Copyright (c) 2006 ACYSOS S.L.. (http://acysos.com) All Rights Reserved.
# Pedro Tarrafeta <pedro@acysos.com>
#
# Corregido para instalación TinyERP estándar 4.2.... |
import cPickle
import os, sys , numpy, glob
import difflib
from prettytable import PrettyTable
modellsi = "movietext"
folderlsi= "text/"
def readFiles(foldername):
try:
fileNames = cPickle.load(open(folderName+folderlsi + modellsi + '.filenames', 'rb'))
similarityTextMatrix = numpy.load(folderName + folder... |
# -*- coding: utf-8 -*-
# Copyright(C) 2013 Laurent Bachelier
#
# This file is part of weboob.
#
# weboob 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 ... |
# Copyright (c) 2016-present, Facebook, 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... |
# coding=utf-8
# Copyright 2014 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import (absolute_import, division, generators, nested_scopes, print_function,
unicode_literals, with_statement)
import logging
from... |
from pagarme import plan
from tests.resources.dictionaries import plan_dictionary
import time
def test_create_boleto_plan():
_plan = plan.create(plan_dictionary.BOLETO_PLAN)
assert _plan['payment_methods'] == ["boleto"]
def test_create_credit_card_plan():
_plan = plan.create(plan_dictionary.CREDIT_CARD_... |
"""This class stores all of the samples for training. It is able to
construct randomly selected batches of phi's from the stored history.
"""
import numpy as np
import time
import theano
floatX = theano.config.floatX
class DataSet(object):
"""A replay memory consisting of circular buffers for observed images,
a... |
# -*- coding: utf-8 -*-
# Copyright (C) 2010 by RoboLab - University of Extremadura
#
# This file is part of RoboComp
#
# RoboComp 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... |
import re
import os
import sys
import subprocess
PRINT_DEBUG = True
def debug(*args):
"""Like print(), but on stderr."""
if PRINT_DEBUG:
print(*args, file=sys.stderr)
def parse_specifications():
"""Parse the LaTeX file of the course to use as an example input
and output."""
tex = os.path.... |
# coding=utf-8
# Copyright 2014 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import absolute_import, division, print_function, unicode_literals
import os
import sys
from abc import abstractmethod
from builtins import filter, map, obj... |
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may ... |
import RPi.GPIO as GPIO
import time
import curses
#added motor enable to pi
#pin 16 ->enable
#pin 18 ->enable
class NiksRobot:
def __init__(self):
#setup
GPIO.setmode(GPIO.BOARD)
GPIO.setup(7,GPIO.OUT)
GPIO.setup(11,GPIO.OUT)
GPIO.setup(13,GPIO.OUT)
GPIO.setup(15,GPIO.OUT)
#GPIO.setup(16,GPIO.OUT)
#... |
"""Tests for the bob_emploi.data_analysis.importer.deployments.uk.career_changers module."""
import io
from os import path
import unittest
import requests_mock
from bob_emploi.data_analysis.importer.deployments.uk import career_changers
@requests_mock.mock()
class TestCareerChangers(unittest.TestCase):
"""Test... |
from django.core.exceptions import ImproperlyConfigured
try:
from django.urls import reverse
except:
from django.core.urlresolvers import reverse
__all__ = ['config']
def required(name):
from django.conf import settings
result = getattr(settings, name, None)
if result is None:
raise Impro... |
# Copyright (C) 2007, Eduardo Silva <edsiper@gmail.com>.
# Copyright (C) 2008, One Laptop Per Child
# Copyright (C) 2009, Simon Schampijer
#
# 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; eithe... |
import utils
import numpy as np
from modu import modu,toComplex,dpmap
import math
from channel import channel
from rfir import rfir
from const import Primary
class SIOT:
def __init__(self,k):
self.length = 1<<k
self.Gpilot = utils.gold(Primary[k][0],Primary[k][1])
self.Pilot = self.Gpilot.toReal(self.... |
import os
import datetime
import tflearn
import tensorflow as tf
from datasets import Germeval
from datasets import id2seq
from models import BLSTMGermEval
from datasets import onehot2seq
# Model Parameters
tf.flags.DEFINE_integer("embedding_dim", 300, "Dimensionality of character "
... |
SKILL_CATEGORIES = { # Not used
'co': 'Cooking',
'cs': 'Common Sense',
'en': 'Endurance',
'le': 'Leisure',
'pa': 'Psi Ability',
'pe': 'Performance',
'se': 'Seafairing',
'so': 'Social',
'sp': 'Sports',
'su': 'Survival',
}
SKILLS = {
'ac': 'Arts & Crafts',
'ah': 'Animal Handling',
'ar': 'Arc... |
import requests
from bs4 import BeautifulSoup
import logging
import time
import re
import os.path
from base64 import b16encode
logging.getLogger().setLevel(logging.DEBUG)
_r_learnprogramming_url = re.compile(r'http://(www.)?reddit.com/r/learnprogramming')
def downloadRedditUrl(url):
logging.debug("Downloading url: {... |
"""
Functions to grab info from papercall.io
"""
import os
import time
import requests
token = 'your_papercall_token' # ,<-- fill this in
THIS_DIR = os.path.abspath(os.path.dirname(__file__))
des_template = """
Title: {title}
URL: 2017/descriptions/{id}.html
save_as: 2017/descriptions/{id}.html
{description}
""".... |
"""distutils.command.build_clib
Implements the Distutils 'build_clib' command, to build a C/C++ library
that is included in the module distribution and needed by an extension
module."""
__revision__ = "$Id: build_clib.py 72379 2009-05-06 07:26:24Z tarek.ziade $"
# XXX this module has *lots* of code ripped-off quite... |
# coding: utf-8
"""Tools to compute equations of states with different models."""
from __future__ import unicode_literals, division, print_function
import collections
import numpy as np
import pymatgen.core.units as units
from pymatgen.core.units import FloatWithUnit
import logging
logger = logging.getLogger(__file_... |
from SpaceDock.config import _cfg
from github import Github
from flask import url_for
import subprocess
import json
import os
import re
# TODO(Thomas): Make this modular
def send_to_ckan(mod):
if not _cfg("netkan_repo_path"):
return
if not mod.ckan:
return
json_blob = {
... |
#! /usr/bin/env python
"""
pyparsing based grammar for DCPU-16 0x10c assembler
"""
try:
from itertools import izip_longest
except ImportError:
from itertools import zip_longest as izip_longest
try:
basestring
except NameError:
basestring = str
import logging; log = logging.getLogger("dcpu16_asm")
log... |
#! /usr/bin/env python
# -*- coding:utf-8 -*-
from __future__ import print_function # , unicode_literals
# Based on dm-tool.c from the LightDM project.
# Original Author: Robert Ancell <robert.ancell@canonical.com>
# Copyright (C) 2013 Antonis Kanouras <antonis@metadosis.eu>
#
# This program is free software: you can... |
"""
Helper functions for creating Form classes from Django models
and database field objects.
"""
from __future__ import unicode_literals
from collections import OrderedDict
from itertools import chain
from django.core.exceptions import (
NON_FIELD_ERRORS, FieldError, ImproperlyConfigured, ValidationError,
)
fro... |
# -*- coding: utf-8 -
#
# This file is part of http-parser released under the MIT license.
# See the NOTICE for more information.
from io import DEFAULT_BUFFER_SIZE, RawIOBase
from http_parser.util import StringIO
class HttpBodyReader(RawIOBase):
""" Raw implementation to stream http body """
def __init__... |
"""Constants used by pycounter."""
NS = {
'SOAP-ENV': "http://schemas.xmlsoap.org/soap/envelope/",
'sushi': "http://www.niso.org/schemas/sushi",
'sushicounter': "http://www.niso.org/schemas/sushi/counter",
'counter': "http://www.niso.org/schemas/counter",
}
METRICS = {
u"JR1": u"FT Article Req... |
from jsonrpc import ServiceProxy
import sys
import string
# ===== BEGIN USER SETTINGS =====
# if you do not set these you will be prompted for a password for every command
rpcuser = ""
rpcpass = ""
# ====== END USER SETTINGS ======
if rpcpass == "":
access = ServiceProxy("http://127.0.0.1:11814")
else:
access = Se... |
# python modules
from enum import Enum
# django modules
from django.db import models
# nt modules
from .province import Province
from .infrastructure import Building
# meta
from ntmeta.models import Entity
class Effect(models.Model):
""" The core component of province change """
""" e.g. Peasant Growth - ... |
import os
import math
import hashlib
import xml.dom.minidom
from framerange import FrameRange
from valuerange import ValueRange
from cross3d.constants import ControllerType, TangentType, ExtrapolationType
class Key(object):
def __init__(self, **kwargs):
self.value = float(kwargs.get('value', 0.0))
... |
# vim:set et sts=4 sw=4:
#
# ibus-xkb - IBus XKB
#
# Copyright(c) 2012 Takao Fujiwara <takao.fujiwara1@gmail.com>
# Copyright(c) 2007-2010 Peng Huang <shawn.p.huang@gmail.com>
# Copyright(c) 2007-2012 Red Hat, Inc.
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU ... |
import paddle
import paddle.fluid as fluid
import paddle.fluid.dygraph as dygraph
import os.path as osp
import sys
CURRENT_DIR = osp.dirname(__file__)
sys.path.append(osp.join(CURRENT_DIR, '..', '..', '..'))
from ltr.models.backbone.resnet_dilated import resnet50
from ltr.models.backbone.alexnet import AlexNet
from l... |
# -*- coding=utf-8 -*-
# Copyright (C), 2013-2014, China Standard Software Co., Ltd.
"""
测试框架的主入口及配置文件解析
类说明:
无
函数说明:
load_tests: 根据全局变量test_cases来装载测试用例
initialize: 根据用例的配置文件,返回tc_list
createTestCase: 根据配置文件名字,返回测试用例集的列表
create_testcase_by_module: 根据测试用例模块的名字返回测试用例集
get_log_level: 从GlobalConf... |
# Copyright (c) 2012 - 2015 EMC Corporation.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unle... |
# Copyright 2015 Dell 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... |
import csv
import os
from io import BytesIO
from io import StringIO
import unittest
from pathlib import Path
import pytest
from micall.core.trim_fastqs import censor, trim, cut_all
from micall.utils.translation import reverse_and_complement
class CensorTest(unittest.TestCase):
def setUp(self):
self.addT... |
#!/usr/bin/env python3
# Copyright (c) 2014-2016 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
# Test for -rpcbind, as well as -rpcallowip and -rpcconnect
from test_framework.test_framework im... |
# -*- coding: utf-8 -*-
#
# Configuration file for the Sphinx documentation builder.
#
# This file does only contain a selection of the most common options. For a
# full list see the documentation:
# http://www.sphinx-doc.org/en/master/config
# -- Path setup ------------------------------------------------------------... |
# -*- coding: utf-8 -*-
"""
ccp.client
~~~~~~~~~~~~
This module implements the Changelog API.
:license: MIT, see LICENSE for more details.
"""
import sys
import requests
import json
from time import time
import logging
from pkg_resources import get_distribution
API_HOST = "localhost"
API_PORT = 5000
SEVERITY = di... |
import copy
import json
import os
import unittest
from urllib3.request import urlencode
from sciroccoclient.exceptions import SciroccoInitParamsError
from sciroccoclient.http.requestadapter import RequestsAdapter, RequestAdapterResponse, RequestManagerResponseHandler, \
RequestManagerDataResponseHandler, RequestM... |
'''
Code Input
==========
.. versionadded:: 1.5.0
.. image:: images/codeinput.jpg
The :class:`CodeInput` provides a box of editable highlited text like the one
shown in the image.
It supports all the features provided by the :class:`~kivy.uix.textinput` as
well as code highliting for `languages supported by pygmen... |
#!/usr/bin/env python
# Copyright (c) 2013 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.
"""Usage: mffr.py [-d] [-g *.h] [-g *.cc] REGEXP REPLACEMENT
This tool performs a fast find-and-replace operation on files in
the ... |
"""UserObservees 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
class UserObserveesAPI(BaseCanvasAPI):
"""UserObservees API Version 1.0."""
def __init__(sel... |
# gaf.netlist - gEDA Netlist Extraction and Generation
# Copyright (C) 1998-2010 Ales Hvezda
# Copyright (C) 1998-2010 gEDA Contributors (see ChangeLog for details)
# Copyright (C) 2013-2019 Roland Lutz
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Publ... |
from qxpacker.Container import Container , ContainerFileType
from qxpacker.DdContainer import DdContainer
from qxpacker.EchoContainer import EchoContainer
import os , tempfile
import tarfile
# OPTIONS:
# name : possible values : description
#------------------------------------------------------------
# ... |
#!/usr/bin/python
#coding:utf-8
print '这是一个抓取百度贴吧小说的爬虫,将某部小说贴吧的精品贴进行抓取并合并在一起'+'\n'
import urllib2
import re
#url=raw_input('请输入精品连载贴地址')
url='http://tieba.baidu.com/f/good?kw=%E5%A4%A7%E4%B8%BB%E5%AE%B0&ie=utf-8&cid=2'
#找到每一章节帖子的地址,并以page_address列表形式存储
def get_page_address():
#这里的函数可以连起来写
#像这样 html=urllib2.urlop... |
#!/usr/bin/python
# -*- coding: utf8 -*-
"""
lof
~~~~~~~~~~~~
This module implements the Local Outlier Factor algorithm.
:copyright: (c) 2013 by Damjan Kužnar.
:license: GNU GPL v2, see LICENSE for more details.
"""
from __future__ import division
import warnings
def distance_euclidean(instance1, instance2):
""... |
#!/usr/bin/python
# This file is the main file that manages everything
from redditManager import RedditManager
import json
import time
import getpass
import sys
import traceback
def main():
# Clear the logfile
logfile = open('logfile.log', 'w')
logfile.write('')
logfile.close()
writeLogfile('Sta... |
__source__ = 'https://leetcode.com/problems/maximum-size-subarray-sum-equals-k/'
# https://github.com/kamyu104/LeetCode/blob/master/Python/maximum-size-subarray-sum-equals-k.py
# Time: O(n)
# Space: O(n)
#
# Description: Leetcode # 325. Maximum Size Subarray Sum Equals k
#
# Given an array nums and a target value k, f... |
'''
matrix.py
Basic operations with matrixes:
- multiply
- transpose
- invert
And a simple linear least squares solver,
performing a linear fit between two vectors
yi = a+b.xi
Revision History
rev Date Description
0.1 2013.02.13 first issue, basic insanity check
Rafael Rossi
RaRossi@external.technip.... |
from typing import Tuple
from overrides import overrides
import torch
from torch.autograd import Function, Variable
from torch.nn import Parameter
from torch.nn.utils.rnn import PackedSequence, pad_packed_sequence, pack_padded_sequence
from allennlp.nn.initializers import block_orthogonal
from allennlp.custom_extensi... |
"""
Created on Dec 09, 2014.
"""
from pyramid.httpexceptions import HTTPOk
from everest.mime import XmlMime
from everest.resources.utils import get_root_collection
from thelma.interfaces import ITubeRack
from thelma.tests.functional.conftest import TestFunctionalBase
class TestRackFunctional(TestFunctionalBase):
... |
import sys
sys.path.append("./django/")
import mysite.settings
import os
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "mysite.settings")
from django.core.management import setup_environ
from django.db import transaction
setup_environ(mysite.settings)
import waw_app.models
import re
import time
import sys
from sha... |
# -*- encoding: utf-8 -*-
##############################################################################
#
# Odoo, Open Source Management Solution
# This module copyright (C) 2015 Slobodni-programi d.o.o.# #
# This program is free software: you can redistribute it and/or modify
# it under the terms of th... |
# -*- coding: utf-8 -*-
# Copyright (c) 2016 Ericsson AB
#
# 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 ... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (c) 2014 Vincent Celis
#
# 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 righ... |
# (C) British Crown Copyright 2015, Met Office
#
# This file is part of Iris.
#
# Iris 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 ve... |
import numpy as np
from .. import six
from astropy.utils.console import ProgressBar
from astropy import log
def parse_newick(string):
items = {}
# Find maximum level
current_level = 0
max_level = 0
log.debug('String loading...')
for i, c in enumerate(string):
if c == '(':
... |
#!/usr/bin/env python
import numpy as np
from matplotlib import pyplot as pl
from matplotlib import animation
from mpl_toolkits.mplot3d import Axes3D
from scipy.special import sph_harm
from numpy import sin, cos, pi
from argparse import ArgumentParser
parser = ArgumentParser(description="""Uses matplotlib to animates... |
import string
from model_mommy import mommy
from datetime import datetime
from django_rq import job
from django.test.client import Client
from django.core.urlresolvers import reverse
from django.test.client import RequestFactory
from django.contrib.auth.models import User
from django.utils import timezone
from dateutil... |
##########################################################################
#
# Copyright (c) 2008-2013, Image Engine Design Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redis... |
try:
import requests
import vim
import json
except Exception:
print("Error occurred while importing dependencies.")
URL = ["http://api.duckduckgo.com/?q=", "&format=json&t=VimSearch"]
def setUrl(query):
URL.insert(1, query)
return ''.join(URL)#Return a string of the final URL (list to str)
d... |
# syntax.py
import sys
from PyQt5.QtCore import QRegExp
from PyQt5.QtGui import QColor, QTextCharFormat, QFont, QSyntaxHighlighter
def format(color, style=''):
"""Return a QTextCharFormat with the given attributes.
"""
_color = QColor()
_color.setNamedColor(color)
_format = QTextCharFormat()
... |
from core.himesis import Himesis, HimesisPreConditionPatternLHS
import cPickle as pickle
class HKillRuleLHS(HimesisPreConditionPatternLHS):
def __init__(self):
"""
Creates the himesis graph representing the AToM3 model HKillRuleLHS.
"""
# Create the himesis graph
... |
#!/usr/bin/env python
#
# Copyright (c) 2014, 2016 Apple Inc. All rights reserved.
# Copyright (c) 2014 University of Washington. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributio... |
from datetime import datetime
from django.core.paginator import Page
from django.conf import settings
from lxml import etree, objectify
from codalib import bagatom
from unittest import mock
import pytest
from urllib.error import URLError
from coda_mdstore import factories, models, presentation, views, exceptions
from... |
# Copyright (C) 2008, One Laptop Per Child
# Copyright (C) 2009, Tomeu Vizoso, Simon Schampijer
#
# 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 o... |
# -*- coding: utf-8 -*-
#
# This tool helps you to rebase package to the latest version
# Copyright (C) 2013-2014 Red Hat, Inc.
#
# 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
# he Free Software Foundation; either version 2 ... |
# Copyright 2015-2016 Yelp 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 writin... |
# -*- coding: utf-8 -*-
#
# org_example_foo documentation build configuration file, created by Quark
extensions = [
'sphinx.ext.autodoc',
'sphinx.ext.napoleon'
]
templates_path = ['_templates']
source_suffix = '.rst'
master_doc = 'index'
project = u'org_example_foo'
copyright = u'2015, org_example_foo authors'
... |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (C) 2011 ~ 2012 Deepin, Inc.
# 2011 ~ 2012 Wang Yong
#
# Author: Wang Yong <lazycat.manatee@gmail.com>
# Maintainer: Wang Yong <lazycat.manatee@gmail.com>
#
# This program is free software: you can redistribute it and/or modify
# it under t... |
# -*- 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... |
# -*- coding: utf-8 -*-
from __future__ import division
from psychopy import visual, core, event
from settings import * # Carica la maschera per le impostazioni
# --------------------------------------
# Impostazioni esprimento
# --------------------------------------
buttons = ['l','a'] # Pulsanti di rispos... |
import random,khmer,sys, mmh3, math
class HyperLogLog:
def __init__(self, log2m):
self.log2m = log2m
self.m = 1 << log2m
self.data = [0]*self.m
self.alphaMM = (0.7213 / (1 + 1.079 / self.m)) * self.m * self.m
def add(self, o,k):
x=mmh3.hash(str(0),... |
# Created by Sean Nelson on 2018-08-19.
# Copyright 2018 Sean Nelson <audiohacked@gmail.com>
#
# This file is part of pyBusPirate.
#
# pyBusPirate 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... |
#!/usr/bin/env python3
import json
import codecs
from lxml import etree
import sys
import kdtree
import math
import re
import urllib.parse
import urllib.request
QUERY = """
[out:json][timeout:250][bbox:{{bbox}}];
(
relation["route"="subway"];<<;
relation["route"="light_rail"];<<;
relation["public_transport"="st... |
# Author: Mr_Orange <mr_orange@hotmail.it>
#
# This file is part of SickRage.
#
# SickRage 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 versi... |
"""This module contains functionality to async'ly retrieve
credentials from the key store."""
import httplib
import logging
from ks_util import filter_out_non_model_creds_properties
from ks_util import AsyncAction
_logger = logging.getLogger("KEYSERVICE.%s" % __name__)
class AsyncCredsRetriever(AsyncAction):
... |
# coding=utf-8
########################################################################################################################
### Do not forget to adjust the following variables to your own plugin.
# The plugin's identifier, has to be unique
plugin_identifier = "FLU"
# The plugin's python package, should b... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# EM MEDIA HANDLER
# Copyright (c) 2014-2021 Erin Morelli
#
# 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
# wit... |
"""
Custom SNMPv1 TRAP
++++++++++++++++++
Send SNMPv1 TRAP through unified SNMPv3 message processing framework.
Original v1 TRAP fields are mapped into dedicated variable-bindings,
(see `RFC2576 <https://www.ietf.org/rfc/rfc2576.txt>`_) for details.
* SNMPv1
* with community name 'public'
* over IPv4/UDP
* send TRAP... |
from django import forms
from django.utils.translation import ugettext_lazy as _, ugettext
from . import models
from ..forms.widgets import DecimalInput
from ..product.forms import registry
class QuantityForm(object):
def clean_quantity(self):
val = self.cleaned_data['quantity']
if val < 0:
... |
import json
from odoo.addons.account.tests.common import AccountTestCommon
from odoo.tests import tagged
@tagged('post_install', '-at_install')
class TestAccountIncomingSupplierInvoice(AccountTestCommon):
def setUp(self):
super(TestAccountIncomingSupplierInvoice, self).setUp()
self.env['ir.conf... |
# -*- coding: utf-8 -*-
__author__ = 'Patrick Michl'
__email__ = 'patrick.michl@gmail.com'
__license__ = 'GPLv3'
import nemoa
import qdeep.objects.common
from PySide import QtGui, QtCore
class Editor(qdeep.objects.common.Editor):
objType = 'script'
def createCentralWidget(self):
self.textArea = Q... |
import StringIO
import asyncore
import socket
import urlparse
import re
import settings as settings_herp
import os
import mimetypes
import time
import traceback
import docs
import http
mimetypes.init()
response_reasons = {
200: 'OK',
304: 'Not Modified',
404: 'Not Found',
500: 'Internal Server Error',
501: 'Not I... |
#!/usr/bin/python
# Copyright (C) 2015 Jaroslav Henner
#
# This file is part of pyvmomi ansible module.
#
# pyvmomi_ansible module 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 Lice... |
#
# Copyright (C) 2021 Satoru SATOH <satoru.satoh@gmail.com>
# License: MIT
#
"""File based test data collector.
"""
import ast
import importlib.util
import json
import pathlib
import typing
import warnings
from .datatypes import (
DictT, MaybePathT, TDataPaths
)
def target_by_parent(self: str = __file__):
"... |
# coding=utf-8
import ibm_db_dbi
import random
# 连接数据库
dsn = "DRIVER={IBM DB2 ODBC DRIVER};DATABASE=UACSDB0;" \
"HOSTNAME=10.25.101.8;PORT=50000;PROTOCOL=TCPIP;UID=UACSAPP;PWD=UACSAPP;"
conn = ibm_db_dbi.connect(dsn, "", "")
# 添加数据记录
if conn:
conn.set_autocommit(True)
cursor = conn.cursor()
for i in... |
import math
class Numerical:
@staticmethod
def pointAtAngle(coords, angle, distance):
return (coords[0] + math.sin(angle)*distance, coords[1] + math.cos(angle)*distance)
@staticmethod
def solveQuadraticPrune(equation): # choose the fastest
delta = equation[1]**2 - 4*equation[0]*equation[2]
if delta < 0:
... |
import codecs
import subprocess
import os
import sys
from django.core.exceptions import ImproperlyConfigured
from django.contrib.staticfiles import finders
import execjs
from .config import settings
try:
from django.core.cache import caches
def get_cache(name):
return caches[name]
except ImportError... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.