text stringlengths 475 200k |
|---|
import datetime
import ddt
import pytz
from django.core.files.uploadedfile import SimpleUploadedFile
from django.urls import reverse
from django.test import RequestFactory
from opaque_keys.edx.keys import CourseKey
from openedx.core.lib.courses import course_image_url
from rest_framework.test import APIClient
from xmo... |
from django.contrib.auth import get_user_model
from django.core.management.base import LabelCommand
from account.conf import settings
from account.models import PasswordExpiry
class Command(LabelCommand):
help = "Create user-specific password expiration period."
label = "username"
def add_arguments(sel... |
import json
import os
import time
from datetime import (datetime,
timedelta)
import pytest
from treeherder.model.models import (Repository,
RepositoryGroup)
@pytest.fixture
def repository_id():
repo_group = RepositoryGroup.objects.create(name='mygroup')... |
"""Constants for Lovelace."""
from typing import Any
import voluptuous as vol
from homeassistant.const import CONF_ICON, CONF_MODE, CONF_TYPE, CONF_URL
from homeassistant.exceptions import HomeAssistantError
from homeassistant.helpers import config_validation as cv
from homeassistant.util import slugify
DOMAIN = "lo... |
import operator
from django.contrib.auth.models import User
from django.db.models import Q
from selectable.base import ModelLookup
from selectable.registry import registry
class UserLookup(ModelLookup):
model = User
search_fields = (
'first_name__icontains',
'last_name__icontains',
'... |
# coding: utf-8
from __future__ import unicode_literals
import hashlib
import re
from .common import InfoExtractor
from ..compat import (
compat_parse_qs,
compat_urlparse,
)
from ..utils import (
ExtractorError,
int_or_none,
float_or_none,
parse_iso8601,
smuggle_url,
strip_jsonp,
u... |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes ... |
import pysftp
import json
import os
from datetime import datetime
import re
import getpass
import godirec
import mutagen
import copy
from contextlib import contextmanager
import tempfile
import shutil
from godirec import core
from PyQt5.QtCore import QObject, pyqtSignal, QThread
from paramiko import ssh_exception
impor... |
#!/usr/bin/env python
# coding=utf-8
from __future__ import unicode_literals
import hashlib
import os
import os.path
import nose.tools as nose
import yvs.cache as cache
from tests import set_up, tear_down
from tests.decorators import redirect_stdout
@nose.with_setup(set_up, tear_down)
@redirect_stdout
def test_ca... |
#!/usr/bin/python
import sys, os
import time
class Message(object):
def __init__(self, tp, tm):
self.typ = tp
self.time = tm
class Location(Message):
def __init__(self, time, latitude, longitude, altitude):
super(Location, self).__init__('location', time)
self.lat = latitude
... |
import os
import skimage as si
import skimage.io as sio
import numpy as np
from numpy.testing import (
assert_array_equal, assert_array_almost_equal, run_module_suite)
from tempfile import NamedTemporaryFile
_plugins = sio.plugin_order()
sio.use_plugin('tifffile')
np.random.seed(0)
def teardown():
sio.re... |
# -*- coding: utf-8 -*-
"""A plugin to generate a list of domains visited."""
from __future__ import unicode_literals
from urllib import parse as urlparse
from plaso.analysis import interface
from plaso.analysis import manager
from plaso.containers import reports
class UniqueDomainsVisitedPlugin(interface.Analysis... |
# Copyright 2013 IBM Corp.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agree... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
from __init__ import *
from common.models import *
from base import BaseController
import logging
from datetime import datetime
class Controller(BaseController):
template_module = 'generator'
def pre_dispatch(self, action, key=None):
if key:
... |
# coding=utf-8
#
# 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");... |
# -*- coding: utf-8 -*-\
from tg import expose, request, flash, redirect, require
from tg.predicates import Any, is_user, has_permission
from tg.i18n import lazy_ugettext as l_
#from tg.predicates import has_permission
from molgears.model import DBSession, User, Projects, Tags, Group, Permission, ProjectTests
from molg... |
from django.utils import timezone
from oscar.core.loading import get_model
from oscarapi.tests.utils import APITest
Basket = get_model('basket', 'Basket')
ConditionalOffer = get_model('offer', 'ConditionalOffer')
Voucher = get_model('voucher', 'Voucher')
class VoucherTest(APITest):
fixtures = [
'produ... |
import json
import os
import posixpath
import socket
from mysos.common import zookeeper
from mysos.common.testing import Fake
from mysos.executor.executor import MysosExecutor
from mysos.executor.mysos_task_runner import MysosTaskRunner, TaskRunnerProvider
from mysos.executor.noop_installer import NoopPackageInstaller... |
# Copyright (c) 2015 Ultimaker B.V.
# Uranium is released under the terms of the LGPLv3 or higher.
import sys
from UM.Logger import Logger
try:
from . import ThreeMFWriter
except ImportError:
Logger.log("w", "Could not import ThreeMFWriter; libSavitar may be missing")
from . import ThreeMFWorkspaceWriter
from... |
# Copyright (c) 2015-2016, The Authors and Contributors
# <see AUTHORS file>
# 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 n... |
py_object = object
import pixie.vm.object as object
from pixie.vm.object import affirm
from pixie.vm.primitives import nil, true, false
from pixie.vm.numbers import Integer
import pixie.vm.stdlib as proto
from pixie.vm.code import extend, as_var
from rpython.rlib.rarithmetic import r_uint, intmask, widen
import rpytho... |
# Copyright 2017 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... |
strlist = """08 02 22 97 38 15 00 40 00 75 04 05 07 78 52 12 50 77 91 08
49 49 99 40 17 81 18 57 60 87 17 40 98 43 69 48 04 56 62 00
81 49 31 73 55 79 14 29 93 71 40 67 53 88 30 03 49 13 36 65
52 70 95 23 04 60 11 42 69 24 68 56 01 32 56 71 37 02 36 91
22 31 16 71 51 67 63 89 41 92 36 54 22 40 40 28 66 33 13 80
24 47 3... |
#!/usr/bin/python
#
# Copyright 2012 the v8-i18n authors.
#
# 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... |
# -*- coding: utf-8 -*-
from django.conf import settings
import fudge
import mock
from nose.tools import eq_
import amo
import amo.tests
from amo.helpers import urlparams
from amo.urlresolvers import reverse
from mkt.site.helpers import css, get_login_link, js
def test_login_link():
request = mock.Mock()
... |
# © 2019 Comunitea
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo import models, fields, tools
class StockPickingReport(models.Model):
_name = 'stock.picking.report'
_description = "Sales Picking Statistics"
_auto = False
_rec_name = 'date'
_order = 'date desc'
nam... |
import urllib
import sys
import hashlib
import io
import os.path
import datetime
import time
import csv
import glob
import random
from bs4 import BeautifulSoup
from shutil import copyfile
from collections import deque
def md5(fname):
hash_md5 = hashlib.md5()
with open(fname, "rb") as f:
for chunk in it... |
# This file is part of the Trezor project.
#
# Copyright (C) 2012-2018 SatoshiLabs and contributors
#
# This library is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License version 3
# as published by the Free Software Foundation.
#
# This library is distrib... |
# Copyright (c) 2007 Ruben Reifenberg.
# 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 notice, this
# list of conditions ... |
# coding: utf-8
"""
Copyright 2015 SmartBear Software
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... |
#!/usr/bin/env python
# Copyright (c) 2009, Jay Loden, 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.
"""
A clone of iotop (http://guichaz.free.fr/iotop/) showing real time
disk I/O statistics.
It works on Linux only (Free... |
#!/usr/bin/python
#
# Copyright (c) 2016 Matt Davis, <[EMAIL]>
# Chris Houseknecht, <[EMAIL]>
#
# This file is part of Ansible
#
# Ansible 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, eit... |
#
# Copyright 2013 Quantopian, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in wr... |
from __future__ import print_function, division
from sympy.core.containers import Tuple
from sympy.core.core import C
from sympy.core.expr import Expr
from sympy.core.mul import Mul
from sympy.core.singleton import S
from sympy.core.sympify import sympify
from sympy.concrete.expr_with_intlimits import ExprWithIntLimit... |
from django.core.exceptions import ObjectDoesNotExist
from django.utils.translation import ugettext as _
from couchdbkit.exceptions import ResourceNotFound
def get_object_or_not_exist(cls, doc_id, domain, additional_doc_types=None):
"""
Given a Document class, id, and domain, get that object or raise
an Ob... |
"""
Module for visitor class mapping.
"""
import sqlalchemy as sa
from migrate.changeset.databases import sqlite, postgres, mysql, oracle
from migrate.changeset import ansisql
# Map SA dialects to the corresponding Migrate extensions
dialects = {
sa.engine.default.DefaultDialect: ansisql.ANSIDialect,
sa.dat... |
# -*- coding: utf-8 -*-
from collections import OrderedDict
from ..index import Index
from ..table import Table
from ..identifier import Identifier
from ..exceptions import DBALException
from ...utils import basestring
class Platform(object):
_keywords = None
CREATE_INDEXES = 1
CREATE_FOREIGNKEYS = 2
... |
from __future__ import print_function
import hashlib
import hostlists
import logging
import multiprocessing
import os
import requests
import shutil
import subprocess
import sys
import tarfile
import telnetlib
import tempfile
import time
from .exceptions import BoardNotResponding, NoSuchBoard
from .utility import connec... |
#!/usr/bin/env python
import os
from setuptools import setup, find_packages
def prerelease_local_scheme(version):
"""
Return local scheme version unless building on master in CircleCI.
This function returns the local scheme version number
(e.g. 0.0.0.dev<N>+g<HASH>) unless building on CircleCI for a... |
#!/usr/bin/env python-i
from summon.core import *
from summon import shapes
import summon
from itertools import izip
NOVALUE = object()
class VarDisplay (object):
def __init__(self, obj, x=None, y=None, width=None, height=None):
self.obj = obj
self.x = x
self.y = y
self.width = ... |
# -*- coding: utf-8 -*-
"""
celery.worker.job
~~~~~~~~~~~~~~~~~
This module defines the :class:`TaskRequest` class,
which specifies how tasks are executed.
:copyright: (c) 2009 - 2011 by Ask Solem.
:license: BSD, see LICENSE for more details.
"""
from __future__ import absolute_import
import... |
from yt.mods import *
import sys
import os
import fnmatch
import string
#type in path to directory for data;
#.png images will also be saved there by default
#otherwise change 'outpath'
#PS: don't forget to include '/' at the end of path
path = '/home/'
outpath = path
pfprefix='plt'
#the list of all fiels in the fo... |
# Author: Daniel Verde
# License: GNU GPLv2, see LICENSE.txt
import random
class Playlist(object):
"""Representation of a playlist of movies."""
def __init__(self, movies, is_random):
"""Create a playlist from the provided list of movies."""
self._movies = movies
self._index = None
... |
class BaseViewport(object):
"""
Class that implements a basic viewport [window into the qtop matrix] and basic movement restrictions
"""
def __init__(self, vstart=0, hstart=0):
self._v_start = vstart
self._v_stop = 0
self._h_start = hstart
self._h_stop = 0
self.ma... |
#!/usr/bin/python
from Tkinter import *
class LevelEditor:
def __init__(self, master):
self.__master = master
#frame = Frame(master)
#frame.pack()
#packX = Pack(master, )
#frameX = Frame(frame);
#Label(frameX, text = "Size X:").pack(side = LEFT)
#self.fieldSizeX = Entry(frameX, wid... |
from __future__ import print_function, division
import matplotlib
import logging
from sys import stdout
matplotlib.use('Agg') # Must be before importing matplotlib.pyplot or pylab!
from neuralnilm import (Net, RealApplianceSource,
BLSTMLayer, DimshuffleLayer,
Bidirectio... |
# -*- coding: utf-8 -*-
##############################################################################
#
# Copyright (C) 2019 Compassion CH (http://www.compassion.ch)
# Releasing children from poverty in Jesus' name
# @author: Emanuel Cino <[EMAIL]>
#
# The licence is in the file __manifest__.py
#
#########... |
from __future__ import unicode_literals, division, absolute_import
import os
import shutil
import imp
from tests import FlexGetBase, with_filecopy
from tests.util import maketemp
from nose.plugins.skip import SkipTest
class TestExtract(FlexGetBase):
__tmp__ = True
__yaml__ = """
templates:
... |
from documentadmin import SchemaAdmin
from django import forms
from django.contrib.admin.util import flatten_fieldsets
from django.utils.functional import curry
from dockit.forms.formsets import BaseInlineFormSet, inlinedocumentformset_factory
class InlineSchemaAdmin(SchemaAdmin):
schema = None
formset = Bas... |
import json
import math
import re
from decimal import Decimal
from django.contrib.gis.db.models import functions
from django.contrib.gis.geos import (
GEOSGeometry, LineString, Point, Polygon, fromstr,
)
from django.contrib.gis.measure import Area
from django.db import connection
from django.db.models import Sum
f... |
import serial
import struct
import time
class msgTypes(object):
ACKValid = chr(0)
ACKInvalid = chr(1)
EchoRequest = chr(2)
EchoReply = chr(3)
PIDsetSpeed = chr(4)
PIDgetOdometry = chr(5)
PIDsetMultiplier = chr(6)
PIDgetMultiplier = chr(7)
PIDgetSpeed = chr(8)
TCSGetRawData = chr(9)
class xmegaTester(object... |
# -*- coding: utf-8 -*-
"""
pygments.lexers.igor
~~~~~~~~~~~~~~~~~~~~
Lexers for Igor Pro.
:copyright: Copyright 2006-2014 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
import re
from pygments.lexer import RegexLexer, words
from pygments.token import Text, Commen... |
#! /usr/bin/env python
import rospy
import math
import numpy
import cv2
from cv_bridge import CvBridge
from sensor_msgs.msg import LaserScan
from sensor_msgs.msg import Image
from std_msgs.msg import Header
from multiprocessing import Pool
from multiprocessing import cpu_count
class Line:
def __init__(self, po... |
# Copyright 2017 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... |
###############################################################################
#
# The MIT License (MIT)
#
# Copyright (c) Crossbar.io Technologies GmbH
#
# 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 ... |
# Generated by Django 1.9.2 on 2016-02-21 20:53
from __future__ import unicode_literals
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
import dnd.models
class Migration(migrations.Migration):
initial = True
dependencies = [
migrations.swap... |
# Copyright (c) 2001-2014, Canal TP and/or its affiliates. All rights reserved.
#
# This file is part of Navitia,
# the software to build cool stuff with public transport.
#
# Hope you'll enjoy and contribute to this project,
# powered by Canal TP (www.canaltp.fr).
# Help us simplify mobility and open public tr... |
# Author: Adam Chodorowski
# Contact: [EMAIL]
# Revision: $Revision: 2224 $
# Date: $Date: 2004-06-05 21:40:46 +0200 (Sat, 05 Jun 2004) $
# Copyright: This module has been placed in the public domain.
# New language mappings are welcome. Before doing a new translation, please
# read <http://docutils.sf.net... |
"""
This module contains the core classes of version 2.0 of SAX for Python.
This file provides only default classes with absolutely minimum
functionality, from which drivers and applications can be subclassed.
Many of these classes are empty and are included only as documentation
of the interfaces.
$Id: handler.py,v ... |
# Copyright (C) 2016- The University of Notre Dame This software is distributed
# under the GNU General Public License.
# See the file COPYING for details.
#
## @package ResourceMonitorPython
#
# Python Work Queue bindings.
#
# The objects and methods provided by this package correspond to the native
# C API in @ref ca... |
from .env import YowsupEnv
import base64
import hashlib
class AndroidYowsupEnv(YowsupEnv):
_SIGNATURE = "MIIDMjCCAvCgAwIBAgIETCU2pDALBgcqhkjOOAQDBQAwfDELMAkGA1UEBhMCVVMxEzARBgNVBAgTCkNhbGlmb3JuaWExFDASBgNV" \
"BAcTC1NhbnRhIENsYXJhMRYwFAYDVQQKEw1XaGF0c0FwcCBJbmMuMRQwEgYDVQQLEwtFbmdpbmVlcmluZzEUMBIGA1... |
import uuid
from datetime import datetime
from flask import current_app
from gds_metrics import Histogram
from notifications_utils.clients import redis
from notifications_utils.recipients import (
format_email_address,
get_international_phone_info,
validate_and_format_phone_number,
)
from notifications_uti... |
# Copyright IBM Corp. 2015
#
# 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, so... |
# Copyright 2012 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 a... |
#!/tps/bin/python
import string
from xml.sax import saxutils
from xml.sax import make_parser
from xml.sax.handler import feature_namespaces
def normalize(text):
return string.join(string.split(text), ' ')
def countTuple(tupe):
c = 0
for x in tupe:
c += 1
return c
class Channel:
def __init... |
'''
counts2subsample.py
====================
:Author: Nick Ilott
:Release: $Id$
:Date: |today|
:Tags: Python
Purpose
-------
subsample a count table of form:
ref count
COG1 23
COG2 1000
Usage
-----
Example::
Type::
for command line help.
Command line options
--------------------
'''
import ... |
# -*- coding: utf-8 -*-
# pylint: disable=no-member
"""Tests for the teams API at the HTTP request level."""
from contextlib import contextmanager
from datetime import datetime
import ddt
import itertools
from mock import Mock
import pytz
from django_comment_common.signals import (
thread_created,
thread_edite... |
# -*- coding: utf-8 -*-
import os
import re
import zipfile
from django import forms
from django.conf import settings
from django.core.cache import cache
from django.core.urlresolvers import reverse
from mock import Mock, patch
from nose.tools import eq_
from mkt.files.helpers import FileViewer, DiffHelper
from mkt.f... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
sphinx-autopackage-script
This script parses a directory tree looking for python modules and packages and
creates ReST files appropriately to create code documentation with Sphinx.
It also creates a modules index (named modules.<suffix>).
"""
# Copyright 2008 Société ... |
from browser import window, document, alert, html
container = document['container'] # Game board
zone = document['zone'] # Zone where cells move
ctx = zone.getContext('2d')
tools = document['tools']
# Window dimensions
width = window.innerWidth
height = window.innerHeight
dim = min(width, height)
if width>height:
... |
"""
===============================
Advanced Triangle Manipulation
===============================
This example demonstrates several advanced data manipulation features of the
Triangle class including:
1. Delayed calculation using ``virtual_columns``
2. Advanced ``groupby`` functionality
3. Custom sorting... |
#vim: set encoding=utf-8
from lxml import etree
from regparser.notice.sxs import *
from unittest import TestCase
class NoticeSxsTests(TestCase):
def test_find_page(self):
xml = """<ROOT>
<P />
Text
<P />
<PRTPAGE P="333" />
<P />
<PRT... |
"""Script to clean guest users from DB."""
import argparse
import logging
from typing import List, Optional
from bob_emploi.common.python import now
from bob_emploi.frontend.server import mongo
from bob_emploi.frontend.server import proto
from bob_emploi.frontend.server.asynchronous import report
_, _DB, _ = mongo.g... |
from django.db import models
from django.contrib.auth.models import User
# Create your models here.
class Disaster (models.Model):
name = models.CharField(max_length=128)
lat_coord = models.DecimalField(max_digits=10, decimal_places=4)
long_coord = models.DecimalField(max_digits=10, decimal_places=4)
def __unicod... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright 2015 clowwindy
#
# 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 b... |
"""
sentry.plugins.sentry_useragents.models
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:copyright: (c) 2010-2014 by the Sentry Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
from __future__ import absolute_import
import sentry
from django.utils.translation import ugettext_lazy as _... |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes ... |
"""
Functional test
Loads the ADSOrcid workers. It then injects input onto the first worker and
traces what they do.
"""
import unittest
import time
import json
from aip import models, tasks
class TestPipeline(unittest.TestCase):
"""
Class for testing the overall functionality of the import pipeline.
... |
#! python3
from win32api import *
from win32pipe import *
from win32security import *
from win32event import *
from win32file import *
from winerror import *
from win32con import *
import threading
import json
import sys
from input_methods.serviceManager import textServiceMgr
class Client:
def __init__(self, serv... |
# Copyright 2017-2021 TensorHub, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writ... |
#!/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
"License");... |
# $Id: saslsession.py,v 1.9 2004/09/28 01:19:20 jpwarren Exp $
# $Revision: 1.9 $
#
# BEEPy - A Python BEEP Library
# Copyright (c) 2002-2004 Justin Warren <[EMAIL]>
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as... |
#-*-coding:utf-8-*-
from scrapy_redis.spiders import RedisMixin
from scrapy.contrib.spiders import CrawlSpider, Rule
from scrapy.contrib.linkextractors.sgml import SgmlLinkExtractor
from example.items import ExampleLoader
class MyCrawler(RedisMixin, CrawlSpider):
"""Spider that reads urls from redis queue (mys... |
import logging
from threading import RLock
from ahocorasick import Automaton, EMPTY
from aleph.core import get_config
from aleph.text import match_form
from aleph.model import Entity
from aleph.analyze.analyzer import Analyzer
from aleph.model import DocumentTag, DocumentTagCollector
log = logging.getLogger(__name__... |
# Copyright 2012 Lee Verberne <[EMAIL]>
#
# 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 distribut... |
# -*- coding: iso-8859-1 -*-
"""
MoinMoin - Theme Package
@copyright: 2003-2008 MoinMoin:ThomasWaldmann
@license: GNU GPL, see COPYING for details.
"""
import StringIO
from MoinMoin import log
logging = log.getLogger(__name__)
from MoinMoin import i18n, wikiutil, config, version, caching
from MoinMoin.a... |
#!/usr/bin/python2.4
#
# Copyright 2008 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals, division
from django.shortcuts import redirect, get_object_or_404
from django.db import transaction
from django.contrib.auth.decorators import login_required
from django.core.exceptions import ObjectDoesNotExist
from xue.common import choices as xue_ch... |
import gym,time,copy,re
import numpy as np
import tensorflow as tf
from matplotlib import pyplot as plt
import cv2
import matplotlib
from Replay_Memory import Replay_Memory
tf.logging.set_verbosity(tf.logging.INFO)
MEMORY_LENGTH = 4
ACTIONS = 4
LEARNING_RATE_SGD = 0.0001
LEARNING_RATE_RMSPROP = .0002
FINAL_EXPLORAT... |
#!/usr/bin/python
from os.path import isfile, join
import codecs
import glob
import os
import re
from setuptools import setup
if isfile("MANIFEST"):
os.unlink("MANIFEST")
TOPDIR = os.path.dirname(__file__) or "."
VERSION = re.search('__version__ = "([^"]+)"',
codecs.open(TOPDIR + "/dateutil... |
from __future__ import unicode_literals
from django.db import models
from pygments.lexers import get_all_lexers, get_lexer_by_name
from pygments.styles import get_all_styles
from pygments.formatters.html import HtmlFormatter
from pygments import highlight
LEXERS = [item for item in get_all_lexers() if item[1]]
LANGUA... |
from spotdl.metadata import ProviderBase
from spotdl.metadata import StreamsBase
import pytest
class TestStreamsBaseABC:
def test_error_abstract_base_class_streamsbase(self):
with pytest.raises(TypeError):
# This abstract base class must be inherited from
# for instantiation
... |
#!/usr/bin/env python
""" A simple runner for Rosalind solutions
"""
import importlib
import os.path
import argparse
import re
def runner(modulename, inputfile, compare_output):
try:
# Import the solution from the solutions package
solution = importlib.import_module('.%s' % modulename, package='so... |
from __future__ import division
import nibabel
import nibabel.dft
import numpy as np
import pprint
from decimal import Decimal
from DICOMFile import DICOMFile, ImageFrame, MRFrame
__all__ = ['read_dicom']
def _read_functional_group(dcm, fg, shared_fgs):
""" Reads a functional group from the DICOM file and retur... |
# -*- coding: utf-8 -*-
import cgi
import os
import random
import re
import json
import string
import pprint
filesdir = "/var/www/html/docent-learner/boldtext/"
docentlearnerdir = "/var/www/docent-learner/dl/"
length_of_key = 6
html_header = """
<html>
<title>Docent Learner</title>
<link rel="stylesheet" type="text/... |
#!/usr/bin/env python
from setuptools import setup
requires = []
entry_points = {
'console_scripts': []
}
packages = []
setup(
name='pelican-tools',
version='1.0.0',
url='http://getpelican.com/',
author='Alexis Metaireau',
author_email='[EMAIL]',
description='Tools developed for the Peli... |
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Addons modules by CLEARCORP S.A.
# Copyright (C) 2009-TODAY CLEARCORP S.A. (<http://clearcorp.co.cr>).
#
# This program is free software: you can redistribute... |
"""
Support for TPLink lights.
For more details about this component, please refer to the documentation at
https://home-assistant.io/components/light.tplink/
"""
import logging
import colorsys
import time
from homeassistant.const import (CONF_HOST, CONF_NAME)
from homeassistant.components.light import (
Light, AT... |
import pytest
from pgcli.packages.sqlcompletion import suggest_type
from test_sqlcompletion import sorted_dicts
def test_slash_suggests_special():
suggestions = suggest_type('\\', '\\')
assert sorted_dicts(suggestions) == sorted_dicts(
[{'type': 'special'}])
def test_slash_d_suggests_special():
su... |
#testan
from chord import chord;
from chord_type import chord_type;
from midi_notes import *;
from audio import *;
#the key to test
Dmajor = chord_type(D4,'maj',D3);
Dchords = Dmajor.getNativeChords();
Dchords7 = Dmajor.getNativeChords(1);
Fminor = chord_type(F4,'min',F3);
FchordsN = Fminor.getNativeChords(0,'natu... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.