src stringlengths 721 1.04M |
|---|
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
# Copyright (C) 2012 emijrp
# Copyright (C) 2015 Matt Hazinski <matt@hazinski.net>
# 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 ... |
# encoding: utf-8
"""Unit test suite for the docx.parts.story module"""
from __future__ import absolute_import, division, print_function, unicode_literals
import pytest
from docx.enum.style import WD_STYLE_TYPE
from docx.image.image import Image
from docx.opc.constants import RELATIONSHIP_TYPE as RT
from docx.packa... |
import logging
from zephserver.infra.service_manager import ServiceManager
from zephserver.service.service_interface import ServiceInterface
from zephserver.infra.cluster_adapter import ClusterAdapter
from zephserversettings import MY_ROOM_HANDLER
from threading import Thread, Event, Lock
class SaySocket(ServiceInter... |
__date__ = "02 Aug 2012"
__author__ = 'olivier.mattelaer@uclouvain.be'
from function_library import *
class ParamCardWriter(object):
header = \
"""######################################################################\n""" + \
"""## PARAM_CARD AUTOMATICALY GENERATED BY THE UFO #####################... |
# -*- coding: utf-8 -*-
import json
from django.conf import settings
from django.core.management.base import BaseCommand, CommandError
import requests
import olympia.core.logger
log = olympia.core.logger.getLogger('z.discovery.extract_content_strings')
class BaseAPIParser():
def get_results_content(self):
... |
# -*- encoding: utf-8 -*-
import io
from bs4 import BeautifulSoup
from bs4 import SoupStrainer
import urllib2
import urlparse
def _remove_div_vdx(soup):
for div in soup.find_all('div', class_='vidx'):
div.extract()
return soup
def get_data(urlchuong_list, i):
filename = 'urlsach/data/sach' + str... |
"""
File name: patch_3.py
This file is part of: priyomdb
LICENSE
The contents of this file are subject to the Mozilla Public License
Version 1.1 (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.mozilla.org/MPL/
Software distributed u... |
# test_toolbox_maths_ml_algorithms.py
import unittest
import sys
import os
root_fldr = os.path.abspath(os.path.dirname(os.path.abspath(__file__)) + os.sep + ".." + os.sep + "aikif" )
sys.path.append(root_fldr + os.sep + "toolbox")
import maths_ml_algorithms as ml
class LogTest(unittest.TestCase):
def test_01_en... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import django.core.validators
import django.utils.timezone
import django.contrib.auth.models
import datetime
from django.conf import settings
class Migration(migrations.Migration):
dependencies = [
(... |
#!/usr/bin/env python
from setuptools import setup
DESCRIPTION = ("REST API framework powered by Flask, SQLAlchemy and good "
"intentions.")
with open('README.rst') as f:
LONG_DESCRIPTION = f.read()
with open('CHANGES') as f:
LONG_DESCRIPTION += f.read()
install_requires = [
'Eve>=0.5,<0.... |
class Solution():
def permute(self, nums):
if nums is None:
return [[]]
elif len(nums) <= 1:
return [nums]
result = []
for i, item in enumerate(nums):
#print("i={0}, item={1}".format(i, item))
for p in permute(nums[:i] + nums[i + 1:]):... |
# 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/.
from collections import Counter
from logspam import WARNING_RE
from logspam.cli import BaseCommandLineArgs
from logspam... |
import os
from setuptools import setup, find_packages
here = os.path.abspath(os.path.dirname(__file__))
README = open(os.path.join(here, 'README.rst')).read()
CHANGES = open(os.path.join(here, 'CHANGES.rst')).read()
requires = [
'cdo',
'bokeh',
'ocgis',
'pandas',
'nose',
]
classifiers=[
... |
# Need sys for exit status and argv
import sys
# Import Deiman
from deiman import Deiman
# Create a new instance of Deiman, passing in a PID file to use
# this only instantiates the class, nothing more.
d = Deiman("/tmp/deiman.pid")
# Check incoming argv values to see if we have start, stop or status
# command.
if ... |
###############################################################################
# #
# Copyright 2019. Triad National Security, LLC. All rights reserved. #
# This program was produced under U.S. Government contract 89233218CNA000001 #
... |
"""
Main loop (early stopping).
TODO: write more documentation
"""
__docformat__ = 'restructedtext en'
__authors__ = ("Razvan Pascanu "
"KyungHyun Cho "
"Caglar Gulcehre ")
__contact__ = "Razvan Pascanu <r.pascanu@gmail>"
class Unbuffered:
def __init__(self, stream):
self.s... |
import time
import thread
import threading
# really basic implementation of a busy waiting clock
class Clock():
def __init__(self):
self.bpm(120)
# listeners stores things that listen for clock ticks
self._listeners = []
# when did we last tick?
self._last_tick = time.time()... |
'''
Analyses the clusters and returns v-type of vars
Author : Diviyan Kalainathan
Date : 28/06/2016
DEPRECATED - Use plot-gen/Cluster_extraction instead
'''
import csv,numpy
def v_test(input_data,data_folder,num_clusters, num_vars, list_vars):
"""
:param input_data: Data used to do the clustering(String)
:... |
#
# The Qubes OS Project, https://www.qubes-os.org/
#
# Copyright (C) 2010-2015 Joanna Rutkowska <joanna@invisiblethingslab.com>
# Copyright (C) 2013-2015 Marek Marczykowski-Górecki
# <marmarek@invisiblethingslab.com>
# Copyright (C) 2014-2015 Wojtek Porczyk <woju@invisiblethingslab.com>... |
"""This module provides the Bus class which knows how to talk to Bioloid
devices, and the BusError exception which is raised when an error is
enountered.
"""
import pyb
from bioloid import packet
from bioloid.dump_mem import dump_mem
from bioloid.log import log
class BusError(Exception):
"""Exception whic... |
"""Support to interface with universal remote control devices."""
from datetime import timedelta
import functools as ft
import logging
from typing import Any, Dict, Iterable, List, Optional, cast
import voluptuous as vol
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import (
ATTR_C... |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals
import calendar
import datetime
import os
from .utils import monthdelta
class Cleaner(object):
"""Provides functionality to remove backups based on configuration.
The relevant attributes for calculating files to delete are:
... |
# -*- coding: utf-8 -*-
# Author: HW <todatamining@gmail.com>
# See LICENSE.txt for details.
#!/usr/bin/env python
import re
import os
import math
import sys
import pickle
from nltk.stem.wordnet import WordNetLemmatizer
import os.path,subprocess
lmtzr = WordNetLemmatizer()
this_dir,this_filename = os.path.split(os.pa... |
from atmPy.general import timeseries as _timeseries
from atmPy.data_archives.arm import _netCDF
import pandas as _pd
import numpy as _np
from atmPy.aerosols.physics import hygroscopicity as _hygrow
from atmPy.tools import decorators as _decorators
class ArmDatasetSub(_netCDF.ArmDataset):
info = ("This data produc... |
"""Test to verify that Home Assistant core works."""
# pylint: disable=protected-access
import asyncio
import unittest
from unittest.mock import patch, MagicMock
from datetime import datetime, timedelta
import pytz
import homeassistant.core as ha
from homeassistant.exceptions import InvalidEntityFormatError
from home... |
# -*- coding: utf-8 -*-
##############################################################################
#
# Copyright (C) 2014 Comunitea Servicios Tecnológicos All Rights Reserved
# $Kiko Sánchez <kiko@comunitea.com>$
#
# This program is free software: you can redistribute it and/or modify
# it under the ter... |
from collections import namedtuple
from expenses.queries.cache import KeyedCache
class QueryParams:
"""Holder for query parameters."""
@classmethod
def from_dict(cls, dct):
return cls._make([dct[p] for p in cls._fields])
def to_string(self):
values = [getattr(self, param) for param ... |
# Copyright 2017 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ... |
## @file
# This file is used to define common items of class object
#
# Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR>
# This program and the accompanying materials
# are licensed and made available under the terms and conditions of the BSD License
# which accompanies this distribution. ... |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from datetime import datetime
from odoo import api, fields, models, _
from odoo.addons import decimal_precision as dp
from odoo.exceptions import UserError, ValidationError
from odoo.tools import float_compare
class S... |
# -*- coding: utf-8 -*-
#
# HnTool rules - vsftpd
# Copyright (C) 2010 Hugo Doria <mail@hugodoria.org>
#
# 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... |
"""
MIT License
Copyright (c) 2017 Code Society
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, ... |
# -*- coding: utf-8 -*-
"""
:copyright: (c) 2015 by Jan-Hendrik Dolling.
:license: Apache 2.0, see LICENSE for more details.
"""
import os
import sys
try:
import mock
except ImportError:
from unittest import mock
import re
import types
try:
import unittest2 as unittest
except ImportError:
import unittes... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from datetime import datetime
import hmac
import base64
import hashlib
from requests import Request
from paytrail.settings import BASE_API_URL, PAYTRAIL_AUTH_KEY, PAYTRAIL_ID, PAYTRAIL_SECRET
class PaytrailConnectAPIRequest(Request):
def __init__(s... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright 2019 The FATE Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/lic... |
# -*- coding: utf-8 -*-
import os
# Author: Rob Zinkov <rob at zinkov dot com>
# License: BSD 3 clause
import numpy as np
import matplotlib.pyplot as plt
from sklearn import datasets
from sklearn.cross_validation import train_test_split
from sklearn.linear_model import SGDClassifier, Perceptron
from sklearn.linear_... |
from parso.python import tree
from parso.python.token import PythonTokenTypes
from parso.parser import BaseParser
NAME = PythonTokenTypes.NAME
INDENT = PythonTokenTypes.INDENT
DEDENT = PythonTokenTypes.DEDENT
class Parser(BaseParser):
"""
This class is used to parse a Python file, it then divides them into ... |
#
# Copyright (C) 2013 UNIVERSIDAD DE CHILE.
#
# 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 program is dist... |
# -*- coding: utf-8 -*-
from __future__ import print_function
from datetime import datetime, time
import pytest
from numpy import nan
from numpy.random import randn
import numpy as np
from pandas import (DataFrame, Series, Index,
Timestamp, DatetimeIndex, MultiIndex,
to_date... |
#This shows the usage of property decorators
#Python @property is one of the built-in decorators. The main purpose of any decorator is to change your class methods or attributes in such a way so that the users neeed not make any additional changes in their code.
#Without property decorators
class BankAccount:
de... |
#!/usr/bin/env python
"""
Random submodule for `rotpy`
============================
This module provides methods for generating random rotations.
note: Methods defined here _may_ be moved to separate modules corresponding
to each rotation parametrization in the future. That will depend on where we
take the overall pa... |
# 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
# "License"); you may not u... |
#!usr/bin/env python
# -*- coding: utf-8 -*-
#
# Author: EarlGrey@codingpy.com
# Copyright: Public Domain
#
import time
import requests
import oss2
from qcloud_cos import StatFileRequest
from qcloud_cos import CosClient
def download_oss(file):
access_key = '# 根据自己的情况填写'
access_secret = '# 根据自己的情况填写'
aut... |
# Copyright 2010 Dan Smith <dsmith@danplanet.com>
#
# 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 program is ... |
import numpy as np
import scipy as sp
from scipy.linalg import norm
from pyamg import *
from pyamg.gallery import stencil_grid
from pyamg.gallery.diffusion import diffusion_stencil_2d
n=1e2
stencil = diffusion_stencil_2d(type='FE',epsilon=0.001,theta=sp.pi/3)
A = stencil_grid(stencil, (n,n), format='csr')
b = sp.rand(... |
# -*- coding: utf-8 -*-
import os
import sys
import unittest
import datetime as dt
from utils import generate_random_string, generate_random_number
from secvault_api import SecureVaultApi
import logger
log = logger.get_logger('/tmp/secvault_tests-%s.log' % os.environ['USER'])
SERVER_URI = 'http://localhost:17113/'
... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# -*- coding: utf-8 -*-
"""
[lib/interface/completer.py]
The autocomplete engine for ergonomica.
"""
# for completing directory/filenames
import os
import subprocess
import re
from prompt_toolkit.completion import Completer, Completion
from ergonomica.lib.lang.tokenizer... |
#!/usr/bin/env python
# -*- encoding: utf-8 -*-
#
# Copyright (c) 2015 ASMlover. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# * Redistributions of source code must retain the above copyrig... |
# -*- coding: utf-8 -*-
import os
import unittest
from flask import Flask
from luckydonaldUtils.logger import logging
from pytgbot.api_types.receivable.updates import Update
from teleflask.server.mixins import UpdatesMixin
__author__ = 'luckydonald'
logger = logging.getLogger(__name__)
class Foo(UpdatesMixin):
... |
#!/usr/bin/env python
""" Return explanation and options for each parameter.
ip.get_params_info(1) or ip.get_params_info("project_dir")
return the same result. If not argument, a summary of the available
parameters and their numbered references is returned.
Parameter info is stored as a dict of tupl... |
# -*- coding: utf-8 -*-
import csv
import re
import urllib2
from datetime import datetime
NOW = datetime(2013, 12, 17)
SAVEPATH = '../grs/twse_list.csv'
INDUSTRYCODE = '../grs/industry_code.csv'
TWSEURL = 'http://www.twse.com.tw/ch/trading/exchange/MI_INDEX/MI_INDEX2_print.php?genpage=genpage/Report%(year)s%(mon)02d... |
import pytest
from selenium import webdriver
from selenium.webdriver.support.wait import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
@pytest.fixture
#def driver(request):
# wd = webdriver.Firefox(firefox_binary="c:\\Program Files (x86)\\Mozilla Firefox\\firefox.exe")
# print(w... |
from django.contrib.postgres.fields import ArrayField
from django.contrib.staticfiles.templatetags.staticfiles import static
from django.db import models
from django.utils.safestring import mark_safe
from django.utils.text import slugify
from . import base
ESSENCE_MAP = {
'magic': {
'low': 11006,
... |
# Copyright (C) 2008-2010 Adam Olsen
#
# 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, or (at your option)
# any later version.
#
# This program is distributed in the hope that... |
from __future__ import division, print_function, absolute_import
import tensorflow as tf
from .. import summaries
"""
Summarizer contains some useful functions to help summarize variables,
activations etc... in Tensorboard.
"""
def summarize_all(train_vars, grads, activations,
summary_collection="... |
import random
def print_house(blueprint):
# Set up the walls / boundaries.
walls = set()
for y, l in enumerate(blueprint):
for x, c in enumerate(l):
if c == '*':
for i in range(5):
for j in range(3):
walls.add((4 * x + i, 2 * y... |
#!/usr/bin/env python
#
# Raspberry Pi input using buttons and rotary encoders
#
# Acknowledgement: This code is a variation oft the Rotary Switch Tutorial by Bob Rathbone.
# See http://www.bobrathbone.com/raspberrypi_rotary.htm for further information!
import RPi.GPIO as GPIO
class PushButton:
BUTTONDOWN = 1
BUT... |
# -*- coding: utf-8 -*-
# Copyright (c) 2019, Frappe Technologies and Contributors
# See license.txt
from __future__ import unicode_literals
import frappe
import unittest
from frappe.utils import random_string
from frappe.test_runner import make_test_records
class TestAutoAssign(unittest.TestCase):
def setUp(self):
... |
from __future__ import absolute_import
import os
from celery import Celery
from django.apps import AppConfig
from django.conf import settings
if not settings.configured:
# set the default Django settings module for the 'celery' program.
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "config.settings.local")... |
from multiprocessing import cpu_count
import axelrod as axl
import pyswarm
from axelrod_dojo.utils import score_player
from axelrod_dojo.utils import PlayerInfo
class PSO(object):
"""PSO class that implements a particle swarm optimization algorithm."""
def __init__(self, player_class, params_kwargs, objective... |
from celery import shared_task
from waldur_core.cost_tracking import CostTrackingRegister, models
from waldur_core.structure import models as structure_models
@shared_task(name='waldur_core.cost_tracking.recalculate_estimate')
def recalculate_estimate(recalculate_total=False):
""" Recalculate price of consumable... |
import re
from skf.api.chatbot.scripts import entity_reco
vulndict=entity_reco.entity_data()
vulndict = {k.lower(): v for k, v in vulndict.items()}
punctuations = '''!()-[]{};:'"\,<>./?@#$%^&*_~'''
def entity_recognizer(sentence):
listofWords = re.findall(r"[\w']+|[.,!?;]", sentence)
copyofWords=[... |
# coding=utf-8
import re
import requests
import json
import logging
from django.conf import settings
from .exceptions import LeanCloudException, PhoneNumberException
logger = logging.getLogger(__name__)
headers = getattr(settings, 'LEANCLOUD_HEADERS')
class LeanCloudSMS(object):
cell_phone_match = re.compile('... |
# -*- coding: utf-8 -*-
''' Django Notifications example views '''
from distutils.version import \
StrictVersion # pylint: disable=no-name-in-module,import-error
from django import get_version
from django.contrib.auth.decorators import login_required
from django.forms import model_to_dict
from django.shortcuts im... |
from urllib.parse import urlparse
import clamd
from django.conf import settings
from django.utils.functional import SimpleLazyObject
from safe_filefield import default_settings
def get_scanner(socket, timeout=None):
if socket.startswith('unix://'):
return clamd.ClamdUnixSocket(socket[7:], timeout)
e... |
# Copyright 2015 NEC 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
#
# Unless required ... |
# Mover.py
# Used by runJob and pilot to transfer input and output files from and to the local SE
import os
import sys
import commands
import re
import urllib
from xml.dom import minidom
from time import time, sleep
from timed_command import timed_command
from pUtil import createPoolFileCatalog, tolog, addToSkipped,... |
import itertools, collections
import numpy
from pymclevel import mclevel
import pymclevel.materials
import ancillary, carve, filter, vec
from contour import Contour, HeightMap, EdgeData
from carve import ChunkSeed
# TODO: Split this class into two separate classes. One purely for doing the practical work of re... |
# -*- coding: utf-8 -*-
# home made test
__author__= "Luis C. Pérez Tato (LCPT) and Ana Ortega (AOO)"
__copyright__= "Copyright 2015, LCPT and AOO"
__license__= "GPL"
__version__= "3.0"
__email__= "l.pereztato@gmail.com"
K= 1000 # Spring constant
l= 100 # Distance between nodes
F= 1 # Force magnitude
import xc_base
... |
"""
tvdip.py
~~~~~~~~
This module is a direct port of the original [1] tvdip Matlab script into
NumPy.
[1] M.A. Little, Nick S. Jones (2010) "Sparse Bayesian Step-Filtering for High-
Throughput Analysis of Molecular Machine Dynamics", in 2010 IEEE International
Conference on Acoustics, Speech and Signal Processing, 2... |
from direct.directnotify import DirectNotifyGlobal
import HoodDataAI
from toontown.toonbase import ToontownGlobals
from toontown.safezone import DistributedTrolleyAI
from toontown.safezone import BRTreasurePlannerAI
from toontown.classicchars import DistributedPlutoAI
from toontown.toon import DistributedNPCFishermanAI... |
from __future__ import unicode_literals
from django.db import models
from django.conf import settings
from django.db.models.signals import post_delete
from django.dispatch.dispatcher import receiver
import datetime
class Song(models.Model):
name = models.CharField(max_length=200)
notes = models.CharField(max_... |
# -*- coding: utf-8 -*-
# This file is part of beets.
# Copyright 2016, Adrian Sampson.
#
# 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 t... |
# The MIT License
#
# Copyright 2012 Sony Mobile Communications. All rights reserved.
#
# 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 r... |
#!/usr/bin/env python
"""
This bitcoin client does little more than try to keep an up-to-date
list of available clients in a text file "addresses".
"""
import asyncio
import binascii
import logging
import random
import time
from pycoinnet.helpers.standards import initial_handshake, version_data_for_peer
from pycoinn... |
# -*- coding: utf-8 -*-
#
# Author: huang
#
'''
The implementation of the framework of combining kmeans with distant supervision
'''
import argparse
import logging
import time
import random
import collections
from sklearn.cluster import MiniBatchKMeans, Birch
from sklearn.feature_extraction import FeatureHasher
fro... |
import os.path
import stat
import sys
from unittest import mock
import pytest
import re_assert
from pre_commit import error_handler
from pre_commit.errors import FatalError
from pre_commit.store import Store
from pre_commit.util import CalledProcessError
from testing.util import cmd_output_mocked_pre_commit_home
from... |
#!/usr/bin/python
import cv2
import wand.image
import wand.color
import wand.drawing
import sys
import logging
import argparse
logger = logging.getLogger(__name__)
def parse_cmdline():
parser = argparse.ArgumentParser(description='''
TODO: insert description.'''
)
parser.add_argument('-v', '--ver... |
# This file is part of cclib (http://cclib.github.io), a library for parsing
# and interpreting the results of computational chemistry packages.
#
# Copyright (C) 2020, the cclib development team
#
# The library is free software, distributed under the terms of
# the GNU Lesser General Public version 2.1 or later.... |
# -*- coding: utf-8 -*-
#
# || ____ _ __
# +------+ / __ )(_) /_______________ _____ ___
# | 0xBC | / __ / / __/ ___/ ___/ __ `/_ / / _ \
# +------+ / /_/ / / /_/ /__/ / / /_/ / / /_/ __/
# || || /_____/_/\__/\___/_/ \__,_/ /___/\___/
#
# Copyright (C) Bitcraze AB
#
# Crazyfl... |
###########################################################################
# Joshua R. Boverhof, LBNL
# See Copyright for copyright notice!
# $Id: WSsecurity.py 1134 2006-02-24 00:23:06Z boverhof $
###########################################################################
import sys, time, warnings
import sha, base6... |
#!/usr/bin/env python
"""Unit tests for Credential Wallet class
NERC Data Grid Project
"""
__author__ = "P J Kershaw"
__date__ = "03/10/08"
__copyright__ = "(C) 2009 Science and Technology Facilities Council"
__license__ = "BSD - see LICENSE file in top-level directory"
__contact__ = "Philip.Kershaw@stfc.ac.uk"
__revi... |
# Copyright 2015 Isotoma Limited
#
# 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... |
"""friends.py: Implementation of class AbstractTwitterFriendCommand
and its subclasses.
"""
from . import AbstractTwitterCommand
from ..parsers import (
parser_user_single,
parser_count_users,
parser_count_users_many,
parser_cursor,
parser_skip_status,
parser_include_user_entities)
# GET frien... |
import _sqlite3 # isort:skip
import codecs
import copy
from decimal import Decimal
from django.apps.registry import Apps
from django.db.backends.base.schema import BaseDatabaseSchemaEditor
from django.utils import six
class DatabaseSchemaEditor(BaseDatabaseSchemaEditor):
sql_delete_table = "DROP TA... |
# -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Changing field 'NodePath.parent'
db.alter_column(u'h1ds_nodepath', 'parent_id', self.gf('django.db.models... |
#!/usr/bin/python
#
# Copyright (C) 2006 Google Inc.
# Refactored in 2009 to work for Google Analytics by Sal Uryasev at Juice 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
#
# ht... |
from django.db import models
from django.utils.crypto import get_random_string
from issues.excs import InvalidAppError
DEFAULT_APP_DATA = { # Used by `.autodetermine()` and the migration
'identifier': 'default',
'name': 'Default',
'key': ''
}
def generate_api_key():
return get_random_string(30)
c... |
# Copyright 2015 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... |
import itertools
import collections
def nth(iterable, n, default=None):
"Returns the nth item or a default value"
return next(itertools.islice(iterable, n, None), default)
def find(item, source, depth=1, queue_limit=1000000, found_limit=1000000):
"Tries to find a pathway to access item from source."
a... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# barrowman documentation build configuration file, created by
# sphinx-quickstart on Tue Jul 9 22:26:36 2013.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# a... |
from __future__ import absolute_import
#copyright openpyxl 2010-2015
"""
Excel specific descriptors
"""
from openpyxl.xml.constants import REL_NS
from openpyxl.compat import safe_string
from openpyxl.xml.functions import Element
from . import (
MatchPattern,
MinMax,
Integer,
String,
Typed,
Se... |
r"""XML-RPC Servers.
This module can be used to create simple XML-RPC servers
by creating a server and either installing functions, a
class instance, or by extending the SimpleXMLRPCServer
class.
It can also be used to handle XML-RPC requests in a CGI
environment using CGIXMLRPCRequestHandler.
The Doc* cla... |
from typing import Optional
import logging
import random
from pajbot.managers.redis import RedisManager
from pajbot.managers.schedule import ScheduleManager
from pajbot.models.emote import Emote, EmoteInstance, EmoteInstanceCount
from pajbot.streamhelper import StreamHelper
from pajbot.utils import iterate_split_wit... |
"""
It is very simple selnium based code which cat with clevarbot and genrate log from chat
"""
import time
from datetime import datetime
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_con... |
# Copyright (C) 2011 Mark Burnett
#
# 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 program i... |
#!/usr/bin/env python
from __future__ import print_function
from argparse import ArgumentParser
import json
import os
import re
from jenkins import Jenkins
from jujuci import (
add_credential_args,
get_credentials,
)
from utility import (
find_candidates,
get_candidates_path,
)
def get_args(... |
########################################################################
# File name: __init__.py
# This file is part of: aioxmpp
#
# LICENSE
#
# This program 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 Foundat... |
"""
https://leetcode.com/problems/most-common-word/
https://leetcode.com/submissions/detail/150204402/
"""
class Solution:
def mostCommonWord(self, paragraph, banned):
"""
:type paragraph: str
:type banned: List[str]
:rtype: str
"""
wordAcc = dict()
for wor... |
#!/usr/bin/python
# Copyright 2010 Google Inc.
# Licensed under the Apache License, Version 2.0
# http://www.apache.org/licenses/LICENSE-2.0
# Google's Python Class
# http://code.google.com/edu/languages/google-python-class/
import sys
import re
import os
"""Baby Names exercise
Define the extract_names() function b... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.