src stringlengths 721 1.04M |
|---|
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
import io
import requests_mock
import pytest
from django.core.management import call_command
from crashstats.crashsta... |
# -*- encoding: utf-8 -*-
from __future__ import unicode_literals
import copy
import os
import pickle
import unittest
import warnings
from django.core.exceptions import SuspiciousOperation
from django.core.signals import request_finished
from django.db import close_old_connections
from django.http import (QueryDict, ... |
# -*- encoding:utf-8 -*-
from __future__ import absolute_import, division, print_function, unicode_literals
import unittest
from mysqlparse.grammar.sql_file import sql_file_syntax
class SqlFileSyntaxTest(unittest.TestCase):
def test_multiple_statements(self):
sql_file = sql_file_syntax.parseString("""
... |
###########################################################################
# (C) 2016 Elettra - Sincrotrone Trieste S.C.p.A.. All rights reserved. #
# #
# #
# This file is ... |
# -*- coding: utf-8 -*-
#
# Brachyprint documentation build configuration file, created by
# sphinx-quickstart on Sun Feb 9 11:09:11 2014.
#
# 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.
#
#... |
from sympy import symbols, sin, exp, cos, Derivative, Integral, Basic, \
count_ops, S, And, I, pi, Eq, Or, Not, Xor, Nand, Nor, Implies, \
Equivalent, MatrixSymbol, Symbol, ITE, Rel, Rational
from sympy.core.containers import Tuple
x, y, z = symbols('x,y,z')
a, b, c = symbols('a,b,c')
def test_count_ops_non_v... |
#!/usr/bin/env python
# coding=utf-8
"""
Set penelope package up
"""
from setuptools import Extension
from setuptools import setup
__author__ = "Alberto Pettarin"
__copyright__ = "Copyright 2012-2016, Alberto Pettarin (www.albertopettarin.it)"
__license__ = "MIT"
__version__ = "3.1.3"
__email__ = "alberto@albertopet... |
# -*- coding: utf-8 -*-
from contextlib import nested
import json
import mock
import testify as T
from urlparse import urlunsplit
from py_razor_client.razor_client import RazorClient
class RazorClientTestCase(T.TestCase):
@T.setup_teardown
def create_razor_client(self):
self.hostname = "some_host"
... |
# Copyright (C) 2012 Nippon Telegraph and Telephone Corporation.
#
# 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... |
import numpy as np
def sgm(x, derivative=False):
if not derivative:
return 1/(1+np.exp(-x))
else:
return sgm(x) * (1 - sgm(x))
def linear(x, derivative=False):
if not derivative:
return x
else:
return 1
class NeuralNetwork:
layerCount = 0
shape = None
weights = []
layerTransfe... |
#!/usr/bin/env python
#
# Copyright (c) 2016, The OpenThread Authors.
# 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. Redistributions of source code must retain the above copyright
# notic... |
#!/usr/bin/python3
# pylint: disable=line-too-long
# disable=locally-disabled, multiple-statements, fixme, line-too-long
"""
command line program to create/restore/test WebStorageArchives
"""
import os
import hashlib
import datetime
import dateutil.parser
import time
import sys
import socket
import argparse
import stat... |
# Copyright 2019 ScyllaDB
#
# This file is part of Scylla.
#
# Scylla is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Scylla... |
"""
kombu.clocks
============
Logical Clocks and Synchronization.
"""
from __future__ import absolute_import, unicode_literals
from threading import Lock
from itertools import islice
from operator import itemgetter
from .five import python_2_unicode_compatible, zip
__all__ = ['LamportClock', 'timetuple']
R_CLOCK ... |
#!/usr/bin/env python
# Copyright 2017 Calico 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 agr... |
# -*- coding: utf-8 -*-
'''
Created on 17.8.2013
@author: Hukka
'''
import time
from math import ceil
#from datetime import timedelta
#from datetime import datetime
from PIL import Image
from PIL import ImageFont
from PIL import ImageDraw
def generate_kivatietaa(nick,text):
#print len(text)
if not text:
... |
from cloudify import ctx
from cloudify.workflows import ctx as workflow_ctx
from cloudify.decorators import workflow
import json
def log(**kwargs):
ctx.logger.info("Log interface: {}".format(repr(kwargs)))
@workflow
def customwf(nodes_to_runon, operations_to_execute, **kwargs):
ctx = workflow_ctx
ctx.l... |
#!/usr/bin/env python
"""
-u
username
-p
password
-a
appid
-t
toolspec directory
-s
rest service url
-n
number of times to submit toolspec
-w
wait for submissions to finish
"""
import sys
import os
import re
import string
imp... |
from __future__ import unicode_literals
from builtins import str
import re
import pytest
from context import unit as u
from context import template as t
from context import exceptions as e
from helpers import make_obj_factory, generate_params
# SimpleTemplate ******************************************************
... |
#!/usr/bin/python3
import sys, os, re, subprocess
if sys.version_info < (3,5):
print('Please run this script with python 3.5 or newer:', sys.version)
exit(137)
runre = re.compile(r'\[run\]: # \((.+)\)')
shellre = re.compile(r'^ \$ (.+)')
filere = re.compile(r'##### (.+)')
verbre = re.compile(r'^ (.*)')... |
"""
* *******************************************************
* Copyright (c) VMware, Inc. 2016-2018. All Rights Reserved.
* SPDX-License-Identifier: MIT
* *******************************************************
*
* DISCLAIMER. THIS PROGRAM IS PROVIDED TO YOU "AS IS" WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, WHET... |
# Copyright 2013 Christoph Reiter
#
# This library 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 2.1 of the License, or (at your option) any later version.
from pgi.clib.gir import G... |
# Copyright (C) 2011 Pierre de Buyl
# This file is part of pyMPCD
# pyMPCD 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.
# pyMPCD ... |
from django.contrib.auth.mixins import PermissionRequiredMixin
from django.views.generic.list import ListView
from django.views.generic.detail import DetailView
from django.views.generic.edit import DeleteView
from django.urls import reverse_lazy
from extra_views import CreateWithInlinesView, UpdateWithInlinesView
fro... |
class Solution(object):
def solveSudoku(self, board):
"""
:type board: List[List[str]]
:rtype: void Do not return anything, modify board in-place instead.
"""
hset = [{'1','2','3','4','5','6','7','8','9'} for _ in range(9)]
vset = [{'1','2','3','4','5','6','7','8','9'... |
#!/usr/bin/python
"""
Scrapes historic HTML RES reports into the JSON format used for the new reports.
Note that the following fields in this new record format are populated:
product-type
recalling-firm
distribution-pattern
classification
product-description
code-info
product-quantity
reason-for-recall
report-date
... |
import asyncio
import collections
import inspect
import json
import time
from datetime import datetime
from typing import Dict, List, Union
from base58 import b58decode
from common.serializers.serialization import serialize_msg_for_signing
from stp_core.common.log import getlogger
from plenum.common.signer_did import... |
import atexit
import errno
import os
from memsql_loader.util import paths
def get_pid_file_path():
return os.path.join(paths.get_data_dir(), "memsql-loader.pid")
def delete_pid_file():
try:
os.remove(get_pid_file_path())
except Exception:
pass
def write_pid_file():
atexit.register(de... |
# -*- coding: utf-8 -*-
# This file is part of Shuup.
#
# Copyright (c) 2012-2017, Shoop Commerce Ltd. All rights reserved.
#
# This source code is licensed under the OSL-3.0 license found in the
# LICENSE file in the root directory of this source tree.
from __future__ import unicode_literals
import decimal
import ba... |
#!/usr/bin/env python
"""
Test for natnet.py
"""
import unittest
import pexpect
from mininet.util import quietRun
class testNATNet( unittest.TestCase ):
prompt = 'mininet>'
def setUp( self ):
self.net = pexpect.spawn( 'python -m mininet.examples.natnet' )
self.net.expect( self.prompt )
... |
__author__ = 'mrakitin'
import os
import socket
import subprocess
address_to_route = None
qsh_ip = '192.12.90.0'
qsh_ip_mask = '255.255.255.0'
# Find IP address provided by SBU VPN:
ips_dict = {}
for i in socket.getaddrinfo(socket.gethostname(), None):
ip = i[4][0]
try:
socket.inet_aton(ip)
... |
from TASSELpy.utils.helper import make_sig
from TASSELpy.utils.Overloading import javaOverload, javaConstructorOverload, javaStaticOverload
from TASSELpy.net.maizegenetics.trait.AbstractPhenotype import AbstractPhenotype
from TASSELpy.net.maizegenetics.trait.Phenotype import Phenotype
from TASSELpy.net.maizegenetics.tr... |
import sys
import numpy
import time
import os
import glob
import pickle
import shutil
import audioop
import signal
import csv
import ntpath
from . import audioFeatureExtraction as aF
from . import audioBasicIO
from matplotlib.mlab import find
import matplotlib.pyplot as plt
import scipy.io as sIO
from scipy import lina... |
import tensorflow as tf
import pandas as pd
import numpy as np
from sklearn import preprocessing
# importing data and munging
constant_data = pd.read_csv('full_library_xt875.csv')
#normalizing data
#normalization = lambda df: (df - df.mean()) / (df.max() - df.min())
#constant_data = normalization(constant_data)
t_dat... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (c) 2009, Giampaolo Rodola'. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""
psutil test suite. Run it with:
$ make test
If you're on Python < 2.7 unittest2 module must be installe... |
from lab.test_case_worker import TestCaseWorker
class ServersFromSnapshotScenario(TestCaseWorker):
ARG_MANDATORY_N_SERVERS = 'n_servers'
ARG_MANDATORY_UPTIME = 'uptime'
def check_arguments(self):
assert self.n_servers >= 1
assert self.uptime > 10
@property
def n_servers(self):
... |
"""
Some base classes for common styles of controller.
"""
import logging
class LoggingMixin(object):
"""
We generally want to be able to log the behavior of
controllers. This mixin makes a logging object available.
"""
@classmethod
def get_logger(cls):
if not hasattr(cls, "_logger"):
... |
""" Utility module for validating camera feeds. """
from __future__ import absolute_import, division, print_function
from .textformatter import TextFormatter
from .feed import CameraFeed
def view_valid_camera_feeds():
"""
Shows all valid feed views, one after another. The next feed shows when the current is ... |
'''
Integration test for testing power off mini hosts.
#1.operations & power off random hosts
#2.start hosts
#3.duplicated operation
@author: zhaohao.chen
'''
import apibinding.inventory as inventory
import zstackwoodpecker.test_util as test_util
import zstackwoodpecker.test_state as test_state
import zstackwoodpecker... |
# -*- coding: utf-8 -*-
# Copyright (C) 2013-2015 Avencall
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This p... |
import datetime
import uuid
from angular_flask import app
from angular_flask.core import mongo_db
class Post2(mongo_db.Document):
created_at = mongo_db.DateTimeField(default=datetime.datetime.now, required=True)
title = mongo_db.StringField(max_length=255, required=True)
slug = mongo_db.StringField(max_length=255... |
# -*- coding: utf-8 -*-
# Capacitated p-Median Facility Location Problem
# This script creates a linear programming file to be read into an optimizer.
'''
GNU LESSER GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
Everyone is p... |
import numpy as np
import pandas as pd
import scipy.io as sio
from my_settings import *
data = sio.loadmat("/home/mje/Projects/agency_connectivity/Data/data_all.mat")[
"data_all"]
column_keys = ["subject", "trial", "condition", "shift"]
result_df = pd.DataFrame(columns=column_keys)
for k, subject in enumerate(s... |
"""
WSGI config for statusboard project.
This module contains the WSGI application used by Django's development server
and any production WSGI deployments. It should expose a module-level variable
named ``application``. Django's ``runserver`` and ``runfcgi`` commands discover
this application via the ``WSGI_APPLICATIO... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import os
import sys
import shutil
import pytz
import nose
from nose.tools import assert_equal, raises, assert_true, assert_false, assert_not_equal
from datetime import datetime, date
from xlwings import Application, Workbook, Sheet, Range, Chart, ChartTy... |
# Copyright 2016 Codethink Ltd
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writin... |
# -*- coding: utf-8 -*-
import pcapy
import Storage_Classes
from collections import defaultdict
#from scapy.layers.all import *
from scapy.layers.dot11 import Dot11, RadioTap
################################################################
VERBOSE = 1
### auxiliary functions ###
def show_short(p,... |
# -*- coding: utf-8 -*-
"""
conpaas.core.clouds.opennebula
==============================
ConPaaS core: OpenNebula IaaS code.
:copyright: (C) 2010-2013 by Contrail Consortium.
"""
import urlparse
from ConfigParser import NoOptionError
from libcloud.compute.types import Provider
from libcloud.compu... |
__author__ = 'asifj'
import requests
from pymongo import MongoClient
import json
import csv
import traceback
import logging
from tabulate import tabulate
logging.basicConfig(
format='%(asctime)s.%(msecs)s:%(name)s:%(thread)d:%(levelname)s:%(process)d:%(message)s',
level=logging.DEBUG
)
class HBa... |
from collections import OrderedDict
expectations = OrderedDict([
# t_project[landsat-cloudmask] recording:
('cloudmask',
[('0/2017213_LC8_cloudmask.tif',
'raster',
'gdalinfo-stats',
['Driver: GTiff/GeoTIFF',
'Size is 474, 657',
'Coordinate System is:',
'PROJCS["WGS 84 / UTM zone 16N",',
... |
#!/usr/bin/env python
# -*- encoding: utf-8 -*-
from __future__ import absolute_import
from __future__ import print_function
import io
from os.path import dirname
from os.path import join
from setuptools import setup
def read(*names, **kwargs):
return io.open(
join(dirname(__file__), *names),
en... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# GPflowOpt documentation build configuration file, created by
# sphinx-quickstart on Sun Apr 30 20:34:41 2017.
#
# 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
# ... |
# -*- coding: utf-8 -*-
# Copyright (C) 2010-2012 Bastian Kleineidam
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#... |
# Copyright 2016-2017 Capital One Services, LLC
# Copyright The Cloud Custodian Authors.
# SPDX-License-Identifier: Apache-2.0
from .common import BaseTest
class SimpleDB(BaseTest):
def test_delete(self):
session_factory = self.replay_flight_data("test_simpledb_delete")
p = self.load_policy(
... |
# -*- coding: utf-8 -*-
"""
Created on Fri Sep 9 16:36:47 2016
@author: Felipe Leno
Loads everything from adhoc.py, this class only defines parameters for the visit-based
ad hoc advising
"""
from adhoc import AdHoc
import math
class AdHocVisit(AdHoc):
#Enum for importance metrics
VISIT_IMPORTANCE, Q_IMPOR... |
import numpy as np
from collections import defaultdict
import ROOT
from subprocess import call
import pandas as pd
##################################################################################################
def atan(y, x):
phi = np.arctan2(y, x)
for i in range(len(phi)):
if phi[i] < 0:
... |
# Copyright 2010 Jacob Kaplan-Moss
# Copyright 2011 OpenStack Foundation
# Copyright 2012 Grid Dynamics
# Copyright 2013 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... |
#!/usr/bin/python
# coding:utf-8
import wx
import os
import sys
import wx.grid
class GridWindow(wx.Frame):
def __init__(self, parent, title):
'''
wx.DEFAULT_FRAME_STYLE : 这是每个窗口的缺省风格,包含标题、可调节大小的边框,最大最小化按钮、关闭按钮和系统菜单。
wx.CAPTION : 在框架上增加一个标题栏,它显示该框架的标题属性。
wx.CLOSE_BO... |
import urllib2, urllib, sys, os, re, random, copy, time
import htmlcleaner
from BeautifulSoup import BeautifulSoup, Tag, NavigableString
import xbmc,xbmcplugin,xbmcgui,xbmcaddon
from t0mm0.common.net import Net
from t0mm0.common.addon import Addon
from scrapers import CommonScraper
net = Net()
class IWatchTVServiceSra... |
# coding=utf-8
from euphorie.client.tests.utils import addSurvey
from euphorie.client.tests.utils import registerUserInClient
from euphorie.content.tests.utils import BASIC_SURVEY
from euphorie.testing import EuphorieFunctionalTestCase
import urllib
class CountryFunctionalTests(EuphorieFunctionalTestCase):
def t... |
import gc
import re
import config
from copy import copy
from colors import color
from textwrap import dedent
from util import Msg, Error, debug, check_opts, eval_type
from collections import OrderedDict, namedtuple
from src.modules.services.service import Service
"""
Main data bus for interacting with the various ... |
###############################################################################
# #
# Copyright 2019. Triad National Security, LLC. All rights reserved. #
# This program was produced under U.S. Government contract 89233218CNA000001 #
... |
#!/usr/bin/env python
"""Convert ECOMCat CAN message trace files to the OpenXC raw message format.
$ ./ecomcat_to_openxc example.dat > example-openxc.json
"""
import fileinput
import json
ID_HIGH_NAME = "IDH"
ID_LOW_NAME = "IDL"
DATA_NAME = "Data"
LENGTH_NAME = "Len"
REQUIRED_INPUT_ATTRS = (ID_HIGH_NAME, ID_LOW_... |
"""
Ridge regression
"""
# Author: Mathieu Blondel <mathieu@mblondel.org>
# License: Simplified BSD
import numpy as np
from .base import LinearModel
from ..utils.extmath import safe_sparse_dot
from ..utils import safe_asarray
from ..preprocessing import LabelBinarizer
from ..grid_search import GridSearchCV
def _so... |
import unittest
import sys
sys.path.append("../")
from chess.game import ChessGame
import chess.player as player
class TestGame(unittest.TestCase):
def test_first_move(self):
p1 = player.RandomComputer()
p2 = player.OldMinimax()
game1 = ChessGame(p1, p2, pause=0, first_move=1)
exp... |
# Copyright 2019 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 agreed to in writing, ... |
from django.urls import reverse
from django.utils import timezone
from datetime import timedelta
from danceschool.core.constants import REG_VALIDATION_STR, updateConstant
from danceschool.core.utils.tests import DefaultSchoolTestCase
from danceschool.core.models import Invoice, Registration
from .models import (
... |
# -*- coding: utf-8 -*-
"""
XLIFF file parser for Python
see http://docs.oasis-open.org/xliff/v1.2/os/xliff-core.htm for documentation
of XLIFF format
"""
import re
import xml.dom.minidom
import xml.parsers.expat
from xml.sax.saxutils import escape as xml_escape
from django.utils.translation import ugettext, ugettext... |
#!/usr/bin/python
#
# Copyright 2018-2021 Polyaxon, 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 ... |
from medium import Client
import os
import glob
from bs4 import BeautifulSoup
from pathlib import Path
PATH = os.path.dirname(os.path.abspath(__file__))
MEDIUM = os.path.join(PATH, 'medium-published')
with open(os.path.join(PATH, 'KEYS', 'medium'), 'r') as file:
application_id, application_secret, access_token =... |
# -*- coding: utf-8 -*-
from south.utils import datetime_utils as datetime
from south.db import db
from south.v2 import DataMigration
from django.db import models
class Migration(DataMigration):
def forwards(self, orm):
"Write your forwards methods here."
# Note: Don't use "from appname.models imp... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import django.utils.timezone
class Migration(migrations.Migration):
dependencies = [
('accounts', '0002_auto_20150520_2341'),
]
operations = [
migrations.AlterField(
mode... |
# -*- coding: utf-8 -*-
"""
Copyright (c) 2017 Red Hat, Inc
All rights reserved.
This software may be modified and distributed under the terms
of the BSD license. See the LICENSE file for details.
These tests are moved to a separate file due to https://github.com/bkabrda/flexmock/issues/13
"""
import logging
from fl... |
from rdiosock.exceptions import RdioApiError
from rdiosock.objects.collection import RdioList
class SEARCH_TYPES:
"""Metadata search types"""
NONE = 0
ARTIST = 1
ALBUM = 2
TRACK = 4
PLAYLIST = 8
USER = 16
LABEL = 32
ALL = (
A... |
# Copyright (c) James Percent, Byron Galbraith and Unlock contributors.
# 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. Redistributions of source code must retain the above copyright notic... |
# 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... |
import sublime, sublime_plugin
import os
from urllib.parse import urlencode
def open_dxr(query):
base_url = "http://dxr.mozilla.org/mozilla-central/search?"
params = {"tree": "mozilla-central", "q": query }
query_string = urlencode(params)
sublime.active_window().run_command('open_url', { "url": base_url + query... |
## This file is part of Invenio.
## Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 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, ... |
# Copyright (c) 2014, Georgios Is. Detorakis (gdetor@gmail.com) and
# Nicolas P. Rougier (nicolas.rougier@inria.fr)
# 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. Redis... |
# Bonneville Power Adminstration Front-End
# Copyright (C) 2015 Garrison Jenson, Matei Mitaru
#
# 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 op... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Robot Lint Rules - Lint rules for Robot Framework data files.
# Copyright (c) 2014, 2015, 2016 Richard Huang <rickypc@users.noreply.github.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero Gen... |
#!
#--* coding=utf-8 *--
import urllib2
from bs4 import BeautifulSoup as bs
import base64
import subprocess
import re
import time
import logging
import os, sys
# Define
FILE_PATH = "./web_links.txt"
URLDICT = {
u"南宁市科技局": "http://www.nnst.gov.cn",
u"南宁市工信委": "http://219.159.80.227/info/infopen.h... |
# -*- 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):
# Adding model 'Ip'
db.create_table(u'physical_ip', (
(u'id',... |
# -*- coding: utf-8 -*-
#
# Copyright (c) 2014 Netheos (http://www.netheos.net)
#
# 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 req... |
import os
import unittest
from datetime import datetime
from quickbooks.client import QuickBooks
from quickbooks.objects.base import Ref
from quickbooks.objects.bill import Bill
from quickbooks.objects.detailline import AccountBasedExpenseLine, AccountBasedExpenseLineDetail
from quickbooks.objects.vendor import Vendor... |
##############################################################################
# Copyright 2017-2018 Rigetti Computing
#
# 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... |
# -*- coding: utf-8 -*-
# <nbformat>3.0</nbformat>
# <markdowncell>
# # Basic Markov-Chain Monte-Carlo (MCMC) Sampling #
#
# ## Gibbs Sampling from Bivariate Normal Distribution (BDA 11.1) ##
#
# Here, we sample from a bivariate normal distribution using Gibbs sampling, although it is not simple to draw from actual... |
import elasticsearch
import mock
import pytest
import requests
from time import sleep
from config import CONFIG_DICT
from service import es_access
PROPERTY_BY_POSTCODE_DOC_TYPE = 'property_by_postcode_3'
PROPERTY_BY_ADDRESS_DOC_TYPE = 'property_by_address'
class TestEsAccess:
def setup_method(self, method):
... |
#
# Copyright (c) 2008-2015 Citrix Systems, 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 l... |
#! /usr/bin/env python
# This file is part of IVRE.
# Copyright 2011 - 2021 Pierre LALET <pierre@droids-corp.org>
#
# IVRE 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
#... |
# -*- coding: utf-8 -*-
import pytest
import inferbeddings.parse.clauses as clauses
@pytest.mark.light
def test_parse_clauses_one():
clause_str = 'p(x, y) :- p(x, z), q(z, a), r(a, y)'
parsed = clauses.grammar.parse(clause_str)
clause = clauses.ClauseVisitor().visit(parsed)
assert isinstance(claus... |
import os
import sys
from raygun4py.middleware import flask as flask_raygun
PYTHON_VERSION = sys.version_info[0]
if PYTHON_VERSION == 3:
import urllib.parse
else:
import urlparse
basedir = os.path.abspath(os.path.dirname(__file__))
if os.path.exists('config.env'):
print('Importing environment from .env f... |
from .route import Route
class CategoryRoute(Route):
def all(self):
"""
Return all available categories
:return: available categories
:rtype: list
"""
return self._get_json('category/all')
def broad_categories(self):
"""
Return all available bro... |
"""Script for generating mail content and sending emails to gmail accounts"""
import smtplib
import chart
import time
import fsutil
import timeutil
import logging
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText
from email.mime.base import MIMEBase
from email import encoders
from jin... |
#!/bin/env python
#-*- encoding: utf-8 -*-
__author__ = "fanchao01"
__version__ = "0.0.1"
'''multi-thread queue likes Queue.queue'''
import threading as _threading
import time as _time
class Full(Exception):
"""Exception Full raised by Queue.put/put_nowait"""
class Empty(Exception):
"""Exception Empty ra... |
# Copyright (c) 2015 VMware, 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 i... |
import sys, os
try:
from setuptools import setup, find_packages
except ImportError:
print("fastforward now needs setuptools in order to build. Install it using"
" your package manager (usually python-setuptools) or via pip (pip"
" install setuptools).")
sys.exit(1)
from fastforward imp... |
'''
Copyright 2015 Amazon.com, Inc. or its affiliates. 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. A copy of the License is located at http://aws.amazon.com/apache2.0/
or in the "license" file accompanying this fil... |
import requests
import json
class IncorrectSetupException(Exception):
pass
class BeanstalkAuth(object):
_instance = None
def __new__(cls, domain, username, password):
if not cls._instance:
cls._instance = object.__new__(cls)
return cls._instance
def __init__(self, doma... |
#!/usr/bin/env python
#
# 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
# "... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.