content string |
|---|
"""
Some spiders used for testing and benchmarking
"""
import time
from urllib import urlencode
from scrapy.spider import Spider
from scrapy.http import Request
from scrapy.item import Item
from scrapy.contrib.linkextractors.sgml import SgmlLinkExtractor
class MetaSpider(Spider):
name = 'meta'
def __init_... |
from django.shortcuts import render
from django.db.models import Sum
import datetime
from sponsorship.models import Sponsorship
from challenges.models import Challenge
from runs.models import Run
def contact(request):
return render(request, 'pages/contact.html')
def generate_raised(start_date, end_date):
... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
import sys
import os
import subprocess
import getopt
from subprocess import *
from netaddr import *
g_path = os.getcwd()
g_path = os.path.dirname(sys.argv[0]) + "/.."
g_path = os.path.abspath(g_path)
try:
opts, args = getopt.getopt(sys.argv[1:], "prdc", ["pcap=", "runv... |
import sys
if sys.version_info.major == 3:
import configparser
else:
import ConfigParser as configparser
from os.path import expanduser
def get_account_data(print_errors = False, config_file = 'conf.cfg', config_section = 'ote'):
"""
boolean print_errors: Print errors to stdout instead of raising a... |
# -*- coding: utf-8 -*-
# For debugging, use this command to start neovim:
#
# NVIM_PYTHON_LOG_FILE=nvim.log NVIM_PYTHON_LOG_LEVEL=INFO nvim
#
#
# Please register source before executing any other code, this allow cm_core to
# read basic information about the source without loading the whole module, and
# modules requ... |
from migrate.changeset import UniqueConstraint
from sqlalchemy import Integer, DateTime, String
from sqlalchemy import MetaData, Table, Column
from sqlalchemy.exc import SAWarning
from sqlalchemy.sql import select
from sqlalchemy.types import UserDefinedType
from nova.db.sqlalchemy import utils
from nova import except... |
"""Ethos-N integration end-to-end network tests"""
import pytest
pytest.importorskip("tflite")
pytest.importorskip("tensorflow")
from tvm import relay
from tvm.relay.op.contrib.ethosn import ethosn_available
from tvm.contrib import download
import tvm.relay.testing.tf as tf_testing
import tflite.Model
from . import ... |
# pylint: disable=C0183
'''
The MIT License (MIT)
Copyright (c) 2014 Andreas "Akki" Nitsch
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 ri... |
"""
Restore pgdump files from Dropbox.
See __init__.py for a list of options.
"""
from __future__ import (absolute_import, division,
print_function, unicode_literals)
import os
import tempfile
import gzip
import sys
from ... import utils
from ...dbcommands import DBCommands
from ...storage.base... |
from netfields import InetAddressField, CidrAddressField
from django.db import models
from django.core.exceptions import ValidationError
from django.utils.translation import ugettext_lazy as _
from django.conf import settings
from nodeshot.core.base.models import BaseAccessLevel
from ..managers import NetAccessLevelM... |
"""Unittests for prebuilts."""
from __future__ import print_function
import mock
import os
from chromite.cbuildbot import constants
from chromite.cbuildbot import prebuilts
from chromite.lib import cros_build_lib_unittest
from chromite.lib import osutils
# pylint: disable=W0212
class PrebuiltTest(cros_build_lib_un... |
from itertools import chain
__all__ = ('FilterPool',)
def _convert(*args, **kwargs):
c = chain(args, kwargs.iteritems())
return frozenset(c)
class FilterPool(object):
"""Filter pool which can hold a collection of filters."""
def __init__(self):
self._filters = {}
def register(self, cl... |
from urllib2 import urlopen,quote,Request,ProxyHandler,build_opener,install_opener
from time import strftime,sleep
from bs4 import BeautifulSoup
from json import loads
from sys import exit
def make_request(method,url,data):
headers = {'User-Agent':'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_5) AppleWebKit/537.36 (K... |
from game import _game
from tkinter import *
help_message = """---- Game with doom heads ----
As the game title suggests, in this game player finds himself in extremely
hostile environment completely surrounded by aggressive heads. Players task
is to kill them all by throwing metal balls. If head catches you, you die.... |
import logging
import sys
import time
from snn_utils.comm.zmq import MultiSubscriber
logger = logging.getLogger(__name__)
class SimpleTaskScheduler(object):
def __init__(self):
self._handles = []
def add_handle(self, callback, interval):
self._handles.append([callback, interval, 0])
de... |
import time #import the time module from python built-in-library
def main():
start = input("Do you want to start a count down timer? 'Y'/'N' ") #Ask a user if ready to start a count down timer
while start.lower == 'y':
how_many_minute = int(input("How many minutes do you want to count down to? ")) #Ask... |
"""
Copyright (c) 2012-2013 RockStor, Inc. <http://rockstor.com>
This file is part of RockStor.
RockStor is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published
by the Free Software Foundation; either version 2 of the License,
or (at your option) any la... |
try:
import uarray as array
except ImportError:
try:
import array
except ImportError:
print("SKIP")
raise SystemExit
a = array.array('B', [1, 2, 3])
print(a, len(a))
i = array.array('I', [1, 2, 3])
print(i, len(i))
print(a[0])
print(i[-1])
a = array.array('l', [-1])
print(len(a), a[... |
import glob
import mixtape.featurizer, mixtape.tica, mixtape.cluster, mixtape.markovstatemodel
import numpy as np
import mdtraj as md
from mixtape import ghmm, feature_selection, subset_featurizer
import sklearn.pipeline, sklearn.externals.joblib
import mixtape.utils
n_iter = 1000
n_choose = 50
stride = 1
lag_time = 1... |
"""This module contains the abstract class Relation, described gbelow."""
class Relation:
"""Abstract tlcass defining a standard relation.
Whatever the relation, it implies two models: the first one is
on the owning side of the relation, the second one is on the inverse
side. This notion is abstrac... |
#!/usr/bin/env python
from pylab import *
from time import time
import sys, os, gc
os.chdir(os.path.dirname(sys.argv[0]))
sys.path.insert(0, '..')
from lib import mypaintlib, tiledsurface, brush, document, command, helpers
def tileConversions():
# fully transparent tile stays fully transparent (without noise)
... |
"""Contains the logic for `aq add grn`."""
from aquilon.aqdb.model import Grn
from aquilon.worker.broker import BrokerCommand
from aquilon.worker.dbwrappers.change_management import ChangeManagement
class CommandAddGrn(BrokerCommand):
required_parameters = ["grn", "eon_id"]
def render(self, session, grn, e... |
"""
byceps.services.ticketing.attendance_service
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:Copyright: 2006-2019 Jochen Kupperschmidt
:License: Modified BSD, see LICENSE for details.
"""
from collections import defaultdict
from datetime import datetime
from itertools import chain
from typing import Dict, List, Set... |
import unittest
from nineml.abstraction.dynamics import (
Dynamics, Regime, On, OutputEvent)
from nineml.abstraction.ports import AnalogSendPort, AnalogReceivePort
# Testing Skeleton for class: DynamicsClonerPrefixNamespace
class DynamicsRenameSymbols_test(unittest.TestCase):
def test_rename_symbol(self):
... |
from __future__ import absolute_import, unicode_literals
import mock
from django.contrib.auth import get_user_model
from django.contrib.auth.models import Group
from django.test import TestCase
from wagtail.tests.modeladmintest.models import Author, Book, Publisher, Token
from wagtail.tests.utils import WagtailTestUt... |
from pyanaconda.ui.tui.spokes import NormalTUISpoke
from pyanaconda.ui.tui.simpleline import TextWidget, ColumnWidget
from pyanaconda.ui.tui.tuiobject import YesNoDialog
from pyanaconda.constants import USEVNC, USETEXT
from pyanaconda.constants_text import INPUT_PROCESSED
from pyanaconda.i18n import N_, _, C_
from pyan... |
try:
from omsdk.sdkinfra import sdkinfra
from omsdk.sdkcreds import UserCredentials
from omsdk.sdkfile import FileOnShare
HAS_OMSDK = True
except ImportError:
HAS_OMSDK = False
class iDRACConnection():
def __init__(self, module):
if not HAS_OMSDK:
results = {}
r... |
from lxml import html
import glob
import os
import re
def file_to_html(filename):
if os.path.exists(filename):
with open(filename, 'rt') as fin:
content = fin.read()
html_doc = html.fromstring(content)
return html_doc
def get_all_tags(ht, tag):
return ht.xpath('//%s'%tag)
d... |
# problem 7
def max (lista):
if (len (lista) > 0):
maxa = lista[0]
for i in range (0, len (lista)):
if (lista[i] > maxa):
maxa = lista[i]
return maxa
# problem 7
def min (lista):
if (len (lista) > 0):
mina = lista[0]
for i in range (0, len (lista)):
if (lista[i] < mina):
mina = lista[i]
ret... |
from __future__ import absolute_import
import os
import socket
try:
from django.conf import settings
from django.core.exceptions import ImproperlyConfigured, EnvironmentError
try:
# This handles the case where Django >=1.5 is in the python path
# but this particular project is not a django ... |
# coding: utf-8
from __future__ import unicode_literals
from .common import InfoExtractor
from ..compat import (
compat_urllib_request,
compat_urllib_parse,
)
from ..utils import (
determine_ext,
int_or_none,
parse_iso8601,
)
class ViewsterIE(InfoExtractor):
_VALID_URL = r'http://(?:www\.)?vi... |
import os
import unittest
import btrfsutil
from tests import BtrfsTestCase
class TestQgroup(BtrfsTestCase):
def test_subvolume_inherit(self):
subvol = os.path.join(self.mountpoint, 'subvol')
inherit = btrfsutil.QgroupInherit()
inherit.add_group(5)
btrfsutil.create_subvolume(subv... |
#!/usr/bin/python
# $Id:$
from __future__ import print_function
import pyglet
window = pyglet.window.Window()
tablets = pyglet.input.get_tablets()
canvases = []
if tablets:
print('Tablets:')
for i, tablet in enumerate(tablets):
print(' (%d) %s' % (i + 1, tablet.name))
print('Pres... |
from cyclone import escape
from cyclone.web import RequestHandler
from twisted.python import log
class SSEHandler(RequestHandler):
def __init__(self, application, request):
RequestHandler.__init__(self, application, request)
self.transport = request.connection.transport
self._auto_finish =... |
# coding=utf-8
import logging
import traceback
import flask_login
from flask_accept import accept
from flask_restx import Resource
from flask_restx import abort
from flask_restx import fields
from mycodo.databases.models import DeviceMeasurements
from mycodo.databases.models import Math
from mycodo.databases.models.m... |
from django.contrib.localflavor.at.forms import (ATZipCodeField, ATStateSelect,
ATSocialSecurityNumberField)
from django.test import SimpleTestCase
class ATLocalFlavorTests(SimpleTestCase):
def test_ATStateSelect(self):
f = ATStateSelect()
out = u'''<select name="bundesland">
<option value="B... |
import MySQLdb
import numpy
def display_results(db, pumano, tract, bg):
print '------------------------------------------------------------------'
print 'Geography: PUMA ID- %s, Tract ID- %0.2f, BG ID- %s' \
%(pumano, float(tract)... |
from keystone.tests import core as test
from keystone.common import driver_hints
class ListHintsTests(test.TestCase):
def test_create_iterate_satisfy(self):
hints = driver_hints.Hints()
hints.add_filter('t1', 'data1')
hints.add_filter('t2', 'data2')
self.assertEqual(2, len(hints.... |
__author__ = 'JORDI-MONTOYA'
from controller.database import DataBase
def menu():
print('\n\n\n')
print('\t=============================')
print('\tBIENVENIDO A BEACHSTORE')
print('\t=============================')
print('\t [1]: Ver todas las apps de la base de datos')
print('\t [2]: Ver las a... |
from setuptools import setup
import re
import os
import ConfigParser
def read(fname):
return open(os.path.join(os.path.dirname(__file__), fname)).read()
def get_require_version(name):
if minor_version % 2:
require = '%s >= %s.%s.dev0, < %s.%s'
else:
require = '%s >= %s.%s, < %s.%s'
r... |
import csv
import sqlite3
with open('players.csv', encoding="utf-8-sig") as csvfile:
csv_reader = csv.DictReader(csvfile)
fields = csv_reader.fieldnames
data = list(csv_reader)
with open('player_career.csv', encoding="utf-8-sig") as csvfile:
csv_reader2 = csv.DictReader(csvfile)
fi... |
"""
=============================================
Early stopping of Stochastic Gradient Descent
=============================================
Stochastic Gradient Descent is an optimization technique which minimizes a loss
function in a stochastic fashion, performing a gradient descent step sample by
sample. In particu... |
#!/usr/bin/python2.7
#coding:utf-8
import requests
from dummy import *
import re
info = {
'NAME':'CSCMS index.php/pen/bang SQL Injection',
'AUTHOR':'1c3z,wjk',
'TIME':'20150325',
'WEB':'',
'DESCRIPTION':'cscms index.php/open/bang sql injection,sql ๆฅ้ๆณจๅ
ฅ'
}
opts = {
'url':'http://testasp.vulnweb.com', #'target ip... |
#! /usr/bin/env python
import sys
from scipy.stats.stats import pearsonr
import math
'''
Compare 2 transcript files output by Stringtie (run with the -G and -e options)
'''
threshold = 0
fpkmsA = []
with open(sys.argv[1], 'r') as f:
for line in f:
if line[0] == '#':
continue
row = li... |
# -*- coding: utf-8 -*-
"""
This example demonstrates how to lemmatize a field in a MySQL database.
Requires MySQL-python module to be installed.
INSTRUCTIONS:
1. Create and populate a table named `test.`lemmatize`.
CREATE TABLE `test`.`lemmatize` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`text` text NOT NULL,
`... |
# -*- coding: utf-8
from __future__ import unicode_literals
from copy import deepcopy
from django.utils.translation import ugettext_lazy as _
from django.contrib import admin
try:
from django.core.urlresolvers import reverse
except ImportError:
from django.urls import reverse
from pybb import permissions
from ... |
import views_helper
import data_helper
import database_helper
import datetime_helper
from datetime import datetime, timedelta
from django.conf import settings
from django.http import HttpResponse, HttpResponseRedirect, HttpResponseBadRequest
from django.shortcuts import render_to_response
from django.template i... |
#!/usr/bin/env python
"""
pycallgraph
U{http://pycallgraph.slowchop.com/}
Copyright Gerald Kaszuba 2007
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 ... |
from mixbox import entities
from mixbox import fields
import cybox.bindings.dns_query_object as dns_query_binding
from cybox.common import DateTime, ObjectProperties, String, HexBinary
from cybox.objects.uri_object import URI
from cybox.objects.dns_record_object import DNSRecord
class DNSResourceRecords(entities.Ent... |
import unittest
from webob import exc
import os.path
from solo.web.ctx import serving, response
from solo.web.app import App
from webob import Request
from solo.util import json_encode
from solo.web.util import jsonify
class AppTest(unittest.TestCase):
def setUp(self):
self.app = App()
class He... |
# -*- coding: utf-8 -*-
import matplotlib.pyplot as plt
import numpy as np
from math import pi as Pi
from txt2py import *
from matplotlib.ticker import MultipleLocator
A = txt2py("aquisicao_triangulo_SMCx_lambda60_phi6_k103_0_2.txt")
#aquisicao_circulo_PIDSMCx_lambda70_phi6_k70_0_3: e_quad = 0.912252649215 | tau_quad... |
"""SdkContainerImageBuilder builds the portable SDK container with dependencies.
It copies the right boot dependencies, namely: apache beam sdk, python packages
from requirements.txt, python packages from extra_packages.txt, workflow
tarball, into the latest public python sdk container image, and run the
dependencies ... |
# -*- coding: utf-8 -*-
import sublime
from sublime_plugin import WindowCommand
from ..sync_manager import SyncManager
from ..sync_logger import SyncLogger
from ..sync_version import SyncVersion
from ..thread_progress import ThreadProgress
class SyncSettingsCreateAndUploadCommand(WindowCommand):
def run(self):
... |
from .base import FunctionalTest
class DeletePostTest(FunctionalTest):
def test_delete_post(self):
self.browser.get(self.live_server_url)
self.move_to_default_board()
# ์งํ์ด๋ 'django' ๋ํ ๊ฒ์๊ธ๊ณผ 'spring'์ ๋ํ ๊ฒ์๊ธ์ ์์ฑํ๋ค.
self.add_post('django', 'Hello django')
self.add_post('spr... |
"""Generic Netlink (lib/genl/genl.c).
https://github.com/thom311/libnl/blob/libnl3_2_25/lib/genl/genl.c
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 version 2.1
of the License.
"""
import ... |
import unittest
from mc.houston.tests import utils as _houston_test_utils
class BaseTestCase(unittest.TestCase):
def setUp(self):
self.houston = _houston_test_utils.generate_test_houston()
def _generate_cfg(self):
return _houston_test_utils.generate_test_cfg()
def _create_flow(self, flo... |
from passlib.apps import custom_app_context as pwd_context
import redash.models
from redash.models import db
from redash.permissions import ACCESS_TYPE_MODIFY
from redash.utils import gen_query_hash, utcnow
from redash.utils.configuration import ConfigurationContainer
class ModelFactory(object):
def __init__(self... |
from ..exceptions import InvalidEmail
from .partial import partial
@partial
def mail_validation(backend, details, is_new=False, *args, **kwargs):
requires_validation = backend.REQUIRES_EMAIL_VALIDATION or \
backend.setting('FORCE_EMAIL_VALIDATION', False)
send_validation = details.ge... |
#!/usr/bin/env python
#coding:utf-8
import sys
import os
import time
import importlib
import cyclone.web
from twisted.python import log
from twisted.internet import reactor
from mako.lookup import TemplateLookup
from sqlalchemy.orm import scoped_session, sessionmaker
from toughlib import logger, utils, dispatch
from to... |
from __future__ import print_function
import ecto
import ecto.ecto_test as ecto_test
import sys
import unittest
class TestActionlib(unittest.TestCase):
def execute_plasm(self, Sched, nthreads, niter, n_nodes, incdelay):
plasm = ecto.Plasm()
gen = ecto_test.Generate("Gen", step=1.0, start=0.0)
... |
from django.conf.urls import patterns
urlpatterns = patterns('dialer_contact.views',
# Phonebook urls
(r'^phonebook/$', 'phonebook_list'),
(r'^phonebook/add/$', 'phonebook_add'),
(r'^phonebook/contact_count/$', 'get_contact_co... |
"""The 'grit android2grd' tool."""
from __future__ import print_function
import getopt
import os.path
import sys
from xml.dom import Node
import xml.dom.minidom
import six
from six import StringIO
import grit.node.empty
from grit.node import node_io
from grit.node import message
from grit.tool import interface
fr... |
def has_applicable_environment(environment):
"""
dict environment - very likely os.environ
"""
return bool(
all(
key in environment
for key in
["COMP_WORDS", "COMP_LENGTHS", "COMP_CWORD", "PCS_AUTO_COMPLETE"]
)
and
environment['PCS_AUTO... |
import unittest
from rdflib.namespace import DCTERMS
from rdflib.graph import Graph
from rdflib.term import URIRef
from rdflib.py3compat import b
class NamespaceTest(unittest.TestCase):
def test_dcterms_title(self):
self.assertEqual(DCTERMS.title, URIRef(DCTERMS + 'title'))
class NamespacePrefixTest(un... |
from app import app
from app.models import db, AzurePricing
from sqlalchemy import and_, desc
from werkzeug.contrib.cache import SimpleCache
from app.ms_azure import azure_offers, azure_region_currency, azure_region_names
from app.ms_azure.pricing import fetch_region_pricing
from fractions import Fraction
cache = Simp... |
from random import randint
from Entity import Entity
__author__ = 'George'
class Ball(Entity):
def __init__(self, app):
super().__init__(app.canvas)
self.app = app
self.speed = 6
self.width = 50
self.height = 50
self.color = "#FF00FF"
self.lastNotePos = {
... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import base64
import csv
import os
from hashlib import sha1
FILENAME = os.path.expanduser('~/.PassTest')
class Hashes():
"""Handling hashes in hashes file"""
class Hash():
def __init__(self, name=None, hex_hash=None, salt=None):
self.name = na... |
"""DNS Result Codes."""
import dns.exception
NOERROR = 0
FORMERR = 1
SERVFAIL = 2
NXDOMAIN = 3
NOTIMP = 4
REFUSED = 5
YXDOMAIN = 6
YXRRSET = 7
NXRRSET = 8
NOTAUTH = 9
NOTZONE = 10
BADVERS = 16
_by_text = {
'NOERROR' : NOERROR,
'FORMERR' : FORMERR,
'SERVFAIL' : SERVFAIL,
'NXDOMAIN' : NXDOMAIN,
'NO... |
import rospy
from sensor_msgs import msg
import cv2
from cv_bridge import CvBridge, CvBridgeError
import argparse
parser = argparse.ArgumentParser()
parser.add_argument("-b", "--bgs_image", dest="bgs_image", default=None,
help="Image file location.", metavar="file_name")
parser.add_argument("-c"... |
import os
import stat
import time
import config
import signal
import subprocess
import pytest
from util import unindent
def stop_sssd():
with open(config.PIDFILE_PATH, "r") as pid_file:
pid = int(pid_file.read())
os.kill(pid, signal.SIGTERM)
while True:
try:
os.kill(pid, signal... |
from numpy import sqrt, inner, zeros, inf, finfo
from numpy.linalg import norm
from .utils import make_system
__all__ = ['minres']
def minres(A, b, x0=None, shift=0.0, tol=1e-5, maxiter=None,
M=None, callback=None, show=False, check=False):
"""
Use MINimum RESidual iteration to solve Ax=b
MI... |
colors = [
'antiquewhite',
'aquamarine',
'azure',
'beige',
'bisque',
'black',
'blanchedalmond',
'blue',
'blueviolet',
'brown',
'burlywood',
'cadetblue',
'chartreuse',
'chocolate',
'coral',
'cornflowerblue',
'cornsilk',
'crimson',
'cyan',
'd... |
#!/usr/bin/env python -W ignore::DeprecationWarning
'''
KPCA based feature engineering for MNIST handwritten digits classification with
combination of kernels in each layers
Author : Akhil P M
Kernel used : Arc-cosine Kernel, Gaussian Kernel, Polynomial kernel
'''
import kernel
from settings import *
from umkl_new i... |
"""Generate semantic segmentations
This module uses Xception model trained on ADE20K dataset to generate semantic
segmentation mask to any set of images.
"""
from absl import app
from absl import flags
from PIL import Image
import glob
import matplotlib.pyplot as plt
import numpy as np
import os
import os.path as osp
... |
import os
from click.testing import CliRunner
from morenines import application
def test_init(data_dir):
"""Inits a repo in a dir with files, subdirs and no existing repo"""
runner = CliRunner()
result = runner.invoke(application.main, ['init', data_dir])
assert result.exit_code == 0
mn_dir = ... |
# -*- encoding: utf-8 -*-
"""
staticDHCPd module: databases._ini
Purpose
=======
Provides a uniform datasource API, implementing an INI-file-based backend.
Legal
=====
This file is part of staticDHCPd.
staticDHCPd is free software; you can redistribute it and/or modify
it under the terms of the GNU General Publi... |
from __future__ import unicode_literals
import webnotes
from webnotes.utils import flt
def execute(filters=None):
if not filters: filters = {}
columns = get_columns()
last_col = len(columns)
item_list = get_items(filters)
aii_account_map = get_aii_accounts()
item_tax, tax_accounts = get_tax_accounts(item_list,... |
from enum import Enum, IntEnum
def is_int(var):
try:
_ = int(var)
return True
except (ValueError, TypeError):
return False
def is_int_range(minimum, maximum):
def wrapped(var):
if is_int(var):
var = int(var)
return (minimum <= var) and (maximum >= ... |
# -*- encoding: utf8 -*-
"""Tests for distutils.command.upload."""
import os
import unittest
from test.test_support import run_unittest
from distutils.command import upload as upload_mod
from distutils.command.upload import upload
from distutils.core import Distribution
from distutils.tests.test_config import PYPIRC,... |
def main():
pass
if __name__ == '__main__':
main()
import sys
from datetime import datetime, timedelta
import os
import re
import imaplib
import email
# # Read only emails from last 3 days
no_days_query = 5
server = "imap.gmail.com"
port_num = 993
import sys
dictfile = "D:\Django P... |
from StandardDataSets.scripts import JudgeAssistant
# Please feed your node list here:
tagLst = []
attrName = ''
attrVal = ''
dataToCheck = ''
class SimpleJudgingObject:
def __init__(self, _tagLst, _attrName, _attrVal, _data):
self.tagList = _tagLst
self.attrName = _attrName
se... |
import testtools
from tempest.api.compute import base
from tempest.common import utils
from tempest.common import waiters
from tempest import config
from tempest.lib.common.utils import data_utils
from tempest.lib import decorators
from tempest.lib import exceptions as lib_exc
CONF = config.CONF
class ServerRescueN... |
import ahocorasick
import collections
import itertools
import logging
from urbansearch.utils import db_utils
logger = logging.getLogger('filtering')
class CoOccurrenceChecker(object):
def __init__(self, cities=None):
"""
Initialises the co-occurrence checker. If a list of cities
is prov... |
import urllib2
import simplejson
import werkzeug
import requests
from openerp import models, fields, api
from openerp.exceptions import Warning
import logging
_logger = logging.getLogger(__name__)
class SaasPortalClient(models.Model):
_inherit = 'saas_portal.client'
backup = fields.Boolean('Backup on M... |
import os, sys, json
from fabric.api import *
import argparse
parser = argparse.ArgumentParser()
parser.add_argument('--storage', type=str, default='')
parser.add_argument('--cloud', type=str, default='')
parser.add_argument('--os_user', type=str, default='')
parser.add_argument('--cluster_name', type=str, default=''... |
from flask import Flask, request
from flask import render_template
from flask import jsonify
from flask.helpers import send_from_directory
# from flask_triangle.triangle import Triangle
import os
from apocalypse.utils.docker_client import DockerClientException
from apocalypse.utils.logger import init_logger
from apoc... |
import logging
import yaml
import time
import os
from sonmanobase import messaging
logging.basicConfig(level=logging.INFO)
LOG = logging.getLogger("son-mano-fakeslm")
LOG.setLevel(logging.DEBUG)
logging.getLogger("son-mano-base:messaging").setLevel(logging.INFO)
class fakeslm_updating(object):
def __init__(sel... |
import json
class StoreConfig(object):
def __init__(self, file="/etc/nhlplayoffs/store.json"):
self._file = file
self._store = "memory"
self._user = ""
self._password = ""
self._database = ""
self._server = ""
self._port = 5432
self.load()
@... |
# utility functions
import contextlib
import datetime
import gzip
import io
import json
import os
import pkg_resources
import pyramid.request
import tempfile
import time
from dcicutils.misc_utils import check_true, url_path_join, ignored, find_association
from io import BytesIO
from pyramid.httpexceptions import HTTP... |
# -*- coding: utf-8 -*-
import colorsys
class Color:
def __init__(self,RGB,HLS,HSV):
self.RGB = RGB
self.HLS = HLS
self.HSV = HSV
def Normalize(Value,Min,Max):
Output = Value
if Value > Max:
Output = Max
elif Value < Min:
Output = Min
return Output
def complementaryColor(ColorInput):
# Convert RGB (b... |
# project
from checks import AgentCheck
from utils.platform import Platform
import subprocess
class UpdatesCheck(AgentCheck):
def check(self, instance):
if not Platform.is_linux():
return
output = self.get_subprocess_output()
if output is None:
return
par... |
# ===========================================================================
# This is a web crawler periodically mining news from known sources
# ===========================================================================
from __future__ import print_function, division, absolute_import
import os
import cPickle
from ... |
"""
Django settings for fiocruz project.
Generated by 'django-admin startproject' using Django 1.11.
For more information on this file, see
https://docs.djangoproject.com/en/1.11/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.11/ref/settings/
"""
import os
... |
"""
BitBake 'Command' module
Provide an interface to interact with the bitbake server through 'commands'
"""
# Copyright (C) 2006-2007 Richard Purdie
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2 as
# published by the Free So... |
from __future__ import print_function
import time
import Pyro4.naming
print("Autoreconnect using Name Server.")
@Pyro4.expose
class TestClass(object):
def method(self, arg):
print("Method called with %s" % arg)
print("You can now try to stop this server with ctrl-C/ctrl-Break")
time.sleep... |
# coding: utf-8
"""
KubeVirt API
This is KubeVirt API an add-on for Kubernetes.
OpenAPI spec version: 1.0.0
Contact: <EMAIL>
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
# import models into sdk package
from .models.k8s_io_api_core... |
import sys
import DebugLog
Log = DebugLog.getLogger(__name__)
import os
import stat
import time
import types
def __module_init():
Log.Fine("Initialized")
UNIT = [ "bytes", "KB", "MB", "GB", "TB" ]
def GetRelPath(path):
# Working with pyInstaller
try:
base_path = sys._MEIPASS
except AttributeError:
base_pat... |
from PyQt4 import QtGui, QtCore
from PyQt4.QtCore import Qt
from ts2.scenery import abstract, helper
from ts2 import utils
translate = QtGui.qApp.translate
class PlaceInfoModel(QtCore.QAbstractTableModel):
def __init__(self):
super().__init__()
self._place = None
def rowCount(self, parent = Q... |
# -*- coding: utf-8 -*-
from django.db import migrations, models
forward = """
-- Remove constraints if they exist (in case they have been added manually
ALTER TABLE ONLY class_instance_class_instance
DROP CONSTRAINT IF EXISTS class_instance_class_instance_project_id_fkey;
ALTER TABLE ONLY class_i... |
# -*- coding: utf-8 -*-
import unittest
import os
import pytest
from wechatpy.utils import ObjectDict, check_signature, check_wxa_signature
_TESTS_PATH = os.path.abspath(os.path.dirname(__file__))
_CERTS_PATH = os.path.join(_TESTS_PATH, 'certs')
def skip_if_no_cryptography():
try:
import cryptography ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.