src stringlengths 721 1.04M |
|---|
"""
Agilent 33220A Function generator
"""
import socket
import time
class FunctionGenerator(object):
def __init__(self,addr=('192.168.1.135', 5025)):
self.addr = addr
def set_load_ohms(self,ohms):
self.send("OUTPUT:LOAD %d" % ohms)
def set_dc_voltage(self,volts):
s... |
import numpy as np
from numba import jit
import scipy.signal
import scipy.interpolate
from .pkbase import *
@jit
def triang(L):
# generate triangle
w=np.zeros(L)
if L%2==0: # even L
for i in range(int(L/2)):
n=i+1
w[i]=(2.*n-1.)/L
for i in range(int(L/2),L):
n=i+1
w[i]=2.-(2.*n-1.)/L
else: # odd L
... |
# 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 agreed to in... |
# -*- coding: utf-8 -*-
from django.shortcuts import render_to_response, redirect
from django.template.context import RequestContext
def index(request):
from gestion.models import Constitution, TypeProduit
from datetime import datetime
week_number = datetime.today().isocalendar()[1]
constitutions = Co... |
# Copyright (c) 2006-2009 The Trustees of Indiana University.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without ... |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, division, print_function, \
unicode_literals
import numpy as np
import pytest
from numpy.testing import assert_array_equal
from word_embedding_loader import word_embedding
import word_embedding_loader.saver as saver
@pytest.fixture
def word_embeddi... |
#!/usr/bin/env python3
import subprocess
import time
import random
def devices():
return Device.all()
class Device:
@staticmethod
def _exec(cmd):
return subprocess.Popen(
cmd,
shell=True,
stdout=subprocess.PIPE).communicate()[0].decode('utf-8')
@classm... |
# Droog
# Copyright (C) 2015 Adam Miezianko
#
# 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 option) any later version.
#
# This program is distr... |
# -*- coding: utf-8 -*-
#
# Apertium Plugin Utils documentation build configuration file, created by
# sphinx-quickstart on Sat Aug 9 11:05:41 2014.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerat... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import globalFunctions
import re
import os
import logging
class ReadComicOnlineLi(object):
def __init__(self, manga_url, download_directory, chapter_range, **kwargs):
current_directory = kwargs.get("current_directory")
conversion = kwargs.get("conver... |
"""
sphinx.util.i18n
~~~~~~~~~~~~~~~~
Builder superclass for all builders.
:copyright: Copyright 2007-2019 by the Sphinx team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
import gettext
import os
import re
import warnings
from collections import namedtuple
from datetime import datetim... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
__author__ = 'tanchao'
class Solution:
# @param {integer[]} nums
# @return {integer[][]}
def threeSum(self, nums):
res = []
if len(nums) < 3:
return res
nums.sort() # sorted array for value judgement
for i in range... |
from __future__ import unicode_literals
import re
from .common import InfoExtractor
from ..utils import (
ExtractorError,
unified_strdate,
determine_ext,
)
class DreiSatIE(InfoExtractor):
IE_NAME = '3sat'
_VALID_URL = r'(?:http://)?(?:www\.)?3sat\.de/mediathek/(?:index\.php|mediathek\.php)?\?(?:... |
#!/usr/bin/env python
#
# Tests ellipsoidal nested sampler.
#
# This file is part of PINTS.
# Copyright (c) 2017-2019, University of Oxford.
# For licensing information, see the LICENSE file distributed with the PINTS
# software package.
#
import unittest
import numpy as np
import pints
import pints.toy
# Unit tes... |
# This code is part of the Biopython distribution and governed by its
# license. Please see the LICENSE file that should have been included
# as part of this package.
#
import sys
# Add path to Bio
sys.path.append('../..')
"""Parser for FSSP files, used in a database of protein fold classifications.
This is a modul... |
# -*- coding: utf-8 -*-
"""s3 result store backend."""
from __future__ import absolute_import, unicode_literals
from kombu.utils.encoding import bytes_to_str
from celery.exceptions import ImproperlyConfigured
from .base import KeyValueStoreBackend
try:
import boto3
import botocore
except ImportError:
bo... |
from django.conf import settings
from django.core.mail.backends.base import BaseEmailBackend
from twilio.rest import TwilioRestClient
class SMSBackend(BaseEmailBackend):
def __init__(self, fail_silently=False, **kwargs):
super().__init__(fail_silently=fail_silently)
self.connection = None
def open(self):
""... |
"Use a canonical list of ingredients or foods to match."
import nltk
import pandas as pd
import functions as f
import common
## exploiting that ingredients are mentioned in instructions as well.
con = common.make_engine()
dfe = pd.read_sql_table('recipes_recipe', con)
x = dfe.head()
## intersection of ingredients... |
# Copyright: 2015, Grigoriy Petukhov
# Author: Grigoriy Petukhov (http://getdata.pro)
# License: MIT
from __future__ import absolute_import
import logging
from weblib.http import (normalize_url, normalize_post_data,
normalize_http_values)
from weblib.encoding import make_str, decode_pairs
from ... |
#! /usr/bin/env python
#
# DNmap Server - Edited by Justin Warner (@sixdub). Originally written by Sebastian Garcia
# Orginal Copyright and license (included below) applies.
#
# This is the server code to be used in conjunction with Minions, a collaborative distributed
# scanning solution.
#
#
# DNmap Version Modi... |
"""Access FTDI hardware.
Contents
--------
:class:`Error`
Base error class.
:class:`DeviceNotFoundError`
Raised when device is not connected.
:class:`DeviceError`
Raised for generic pylibftdi exceptions.
:class:`ReadError`
Raised on read errors.
:class:`WriteError`
Raised on write errors.
:cl... |
# coding=utf-8
__author__ = "Gina Häußge <osd@foosel.net>"
__license__ = 'GNU Affero General Public License http://www.gnu.org/licenses/agpl.html'
import logging
import os
import threading
import urllib
import time
import subprocess
import fnmatch
import datetime
import sys
import shutil
import octoprint.util as uti... |
"""Implementation of Valve learning layer 2/3 switch."""
# Copyright (C) 2013 Nippon Telegraph and Telephone Corporation.
# Copyright (C) 2015 Brad Cowie, Christopher Lorier and Joe Stringer.
# Copyright (C) 2015 Research and Education Advanced Network New Zealand Ltd.
# Copyright (C) 2015--2018 The Contributors
#
# L... |
"""EmailUser forms."""
import django
from django import forms
from django.contrib.auth import get_user_model
from django.contrib.auth.forms import ReadOnlyPasswordHashField
from django.utils.translation import ugettext_lazy as _
class EmailUserCreationForm(forms.ModelForm):
"""A form for creating new users.
... |
from flask_sqlalchemy import SQLAlchemy
db = SQLAlchemy()
athlete_teams = db.Table('athlete_teams',
db.Column('athlete_id', db.Integer, db.ForeignKey('athletes.id')),
db.Column('team_id', db.Integer, db.ForeignKey('teams.id'))
)
class Athlete(db.Model):
__tablename__ = 'athletes'
id = d... |
from collections import namedtuple
import json
import datetime
from pytz import utc
DATETIME_FORMAT = "%m-%d-%YT%H:%M:%S.%fZ"
"""
Stores a line of the food log
:type date UTC datetime
:type mood_rating int from 1 to 5 about your general mood
1 - Poor, 5 - Great
:type food_rating int from 1 to 5 about the food
... |
import requests
import re, base64
import xbmc
from ..scraper import Scraper
from ..common import clean_title,clean_search,random_agent
class housemovie(Scraper):
domains = ['https://housemovie.to/']
name = "Housemovies"
sources = []
def __init__(self):
self.base_link = 'https://housemovie.t... |
# -*- coding: utf-8 -*-
# * Authors:
# * TJEBBES Gaston <g.t@majerti.fr>
# * Arezki Feth <f.a@majerti.fr>;
# * Miotte Julien <j.m@majerti.fr>;
"""
Fiche formateur
Extension du module User qui vient rajouter la possibilité de stocker des
informations sur les formateurs
"""
from sqlalchemy import (
... |
# -*- coding: utf-8 -*-
"""
Local working copy path aliasing.
---
type:
python_module
validation_level:
v00_minimum
protection:
k00_public
copyright:
"Copyright 2016 High Integrity Artificial Intelligence Systems"
license:
"Licensed under the Apache License, Version 2.0 (the License);
you m... |
import uuid
from bootstrap import db, all_attr, policy_mode
from bootstrap.models import Ext, AttrAuth
from um.models import Contact, Attribute
class Container(db.Model, Ext):
id = db.Column(db.Integer, primary_key=True, autoincrement=True)
name = db.Column(db.Text, nullable=False) # name of the container
... |
# Copyright 2017 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 agreed to in writing, s... |
# coding: utf-8
from __future__ import print_function, division, absolute_import
from cutadapt.seqio import Sequence
from cutadapt.modifiers import (UnconditionalCutter, NEndTrimmer, QualityTrimmer,
Shortener)
def test_unconditional_cutter():
uc = UnconditionalCutter(length=5)
s = 'abcdefg'
assert UnconditionalCu... |
import os
import json
LATEST_SCHEMA_VERSION = 2
def _id_to_name(id):
return ' '.join(id.split('_'))
def _name_to_id(name):
return '_'.join(name.split(' '))
def ensure_schema_structure(schema):
schema['pages'] = schema.get('pages', [])
schema['title'] = schema['name']
schema['version'] = schema.g... |
# -*- coding: utf-8 -*-
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
# vi: set ft=python sts=4 ts=4 sw=4 et:
""" Set of interfaces that allow interaction with BIDS data. Currently
available interfaces are:
BIDSDataGrabber: Query data from BIDS dataset using pybids grabbids.
Change di... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from absl import app
from absl import flags
import matplotlib
import os
matplotlib.use('TkAgg')
import matplotlib.pyplot as plt
plt.style.use('ggplot')
FLAGS = flags.FLAGS
flags.DEFINE_string('plot_file', ''... |
# -*- coding: utf-8
"""Implements the collections class (the file name has an extra 'c' to avoid
masking the standard collections library).
If the user have analyzed their metagenome using a metagenome binning software
and identified draft genomes in their data (or by any other means binned their
contigs based on any... |
from flask import Flask, jsonify, send_from_directory, redirect, request
import requests
import os
url = 'http://54.183.25.174:9200/polar.usc.edu/_search?q=*:*&size=10000&fields='
#res = requests.get()
#result = res.json()['hits']['hits']
#print len(result)
data = []
with open('datasize.json', 'rb') as f:
data = e... |
# Copyright 2012-2013 Sebastien Maccagnoni-Munch
#
# This file is part of OSPFM.
#
# OSPFM is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published
# by the Free Software Foundation, either version 3 of the License, or
# (at you... |
#!/usr/bin/python
# -*- coding: UTF-8 -*-
# ---------------------------------------------------------------------------
# ___ __ ___ ___ ____ ____ __
# | \ | \ | | / | | | \ Automatic
# |__/ |__/ | | | |__ |__ | | Conference
# | |\... |
# -*- coding: utf-8 -*-
from efesto.handlers import BaseHandler
from pytest import fixture
@fixture
def handler(magic):
handler = BaseHandler(magic())
handler.q = magic()
return handler
def test_basehandler_init(magic):
model = magic()
handler = BaseHandler(model)
assert handler.model == mo... |
# This file is part of Awake - GB decompiler.
# Copyright (C) 2012 Wojciech Marczenko (devdri) <wojtek.marczenko@gmail.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... |
# Author: Ovidiu Predescu
# Date: July 2011
#
# 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 ... |
#
# 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 w... |
import multiprocessing
import threading
import weakref
from typing import Any, MutableMapping
try:
from dask.utils import SerializableLock
except ImportError:
# no need to worry about serializing the lock
SerializableLock = threading.Lock
try:
from dask.distributed import Lock as DistributedLock
excep... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from flask import redirect
from flask import request
from flask import url_for
from flask.ext.wtf import Form as BaseForm
from sqlalchemy.orm.exc import MultipleResultsFound
from sqlalchemy.orm.exc import NoResultFound
from wtforms import fields
from wtforms import validat... |
import autocomplete_light
from django import forms
from django.contrib import admin
from .models import (Instrument, Artist, Venue, Organization, Festival,
Concert, Performance)
from .widgets import PlacesAutocompleteWidget
class VenueForm(forms.ModelForm):
class Meta:
model = Venue
widget... |
#!/usr/bin/env python
from canari.maltego.utils import debug, progress
from canari.framework import configure #, superuser
from canari.maltego.entities import IPv4Address, Phrase
from common.launchers import get_qradio_data
__author__ = 'Zappus'
__copyright__ = 'Copyright 2016, TramaTego Project'
__credits__ = []
_... |
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from ellen.utils.mdiff import hunk2
from vilya.models.consts import LINECOMMENT_INDEX_EMPTY
from vilya.models.git.diff.line import Line
class Hunk(object):
# FIXME: old_lines/new_lines 不包含 'No newline at end of file',导致行号对不上,也导致review评论显示不出来
def... |
import string, re
# Written by Robert Belshaw (School of Biomedical & Healthcare Sciences, University of Plymouth) & Aris Katzourakis (Department of Zoology, University of Oxford)
# For more information and to cite see Belshaw, R & Katzourakis, A (2005) BlastAlign: a program that uses blast to align problematic nucleo... |
#!/usr/bin/env python
from xml.etree import ElementTree as etree
from base64 import b64decode
import iso639
import os
def clean_book(book):
"""Fixes up the book data"""
clean_book = {}
for k, v in book.items():
if k == "favicon":
v = b64decode(v)
elif k == "mediaCount":
... |
from django import forms
from accounts.models import Account
from django.utils.translation import ugettext as _
class RegistrationForm(forms.Form):
username = forms.RegexField(
label=_("Username"),
min_length=3,
max_length=30,
regex=r'^\w+$',
help_text=_("Required. 30 chara... |
#
# Copyright (C) 2016 Savoir-faire Linux Inc
#
# Authors: Seva Ivanov <seva.ivanov@savoirfairelinux.com>
# Simon Zeni <simon.zeni@savoirfairelinux.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 ... |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
import logging
from odoo import api, fields, models, _
from odoo.addons.iap.tools import iap_tools
from odoo.exceptions import UserError
_logger = logging.getLogger(__name__)
DEFAULT_ENDPOINT = 'https://iap-services.o... |
from django.conf import settings
from corehq.apps.commtrack.exceptions import NotAUserClassError
from corehq.apps.commtrack.sms import process
from corehq.apps.sms.api import send_sms_to_verified_number
from custom.ilsgateway.tanzania.handlers.ils_stock_report_parser import ILSStockReportParser
from custom.ilsgateway.t... |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# coding=utf-8
# Copyright 2012 Hewlett-Packard Development Company, L.P.
# Copyright (c) 2012 NTT DOCOMO, 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.... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import logging
from django import forms
from django.conf import settings
from django.utils.safestring import mark_safe
from django.utils import timezone
from paypal.standard.widgets import ValueHiddenInput, ReservedValueHiddenInput
from paypal.standard.conf import (POSTBACK... |
import copy
from warnings import catch_warnings
import itertools
import re
import operator
from datetime import datetime, timedelta, date
from collections import defaultdict
from functools import partial
import numpy as np
from pandas.core.base import PandasObject
from pandas.core.dtypes.dtypes import (
Extensio... |
import collections
from datetime import timedelta
import json
import logging
try:
from urllib.error import HTTPError
import urllib.parse as urlparse
except ImportError:
import urlparse
from urllib2 import HTTPError
from django.conf import settings
from django.contrib.auth import models as auth_models... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
from flask import Blueprint, jsonify, render_template, redirect, request
from models import Books, Authors, Stories, AuthorsStories
from peewee import fn
from decorators import count
from playhouse.shortcuts import model_to_dict
from collections import defaultdict
mod_routing... |
from django import forms
import Imex.models as m
import Imex.tasks as tasks
import HotDjango.views_base as viewb
from django.core.urlresolvers import reverse
from django.db import models
import settings
from django.shortcuts import redirect
import Imex
import_groups, export_groups = Imex.get_imex_groups()
actions = ... |
import libtcodpy as libtcod
import settings
NORTH = 0
SOUTH = 1
WEST = 2
EAST = 3
NORTHWEST = 4
NORTHEAST = 5
SOUTHWEST = 6
SOUTHEAST = 7
VI_NORTH = 200
VI_SOUTH = 201
VI_WEST = 202
VI_EAST = 203
VI_NORTHWEST = 204
VI_NORTHEAST = 205
VI_SOUTHWEST = 206
VI_SOUTHEAST = 207
ENTER = 104
REST = 105
ONE = 106
TWO = 107
TH... |
#!/usr/bin/env python
# Copyright (C) 2015 Wayne Warren
#
# 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 -*-
'''
Functions to calculate spike-triggered average and spike-field coherence of
analog signals.
:copyright: Copyright 2015-2016 by the Elephant team, see `doc/authors.rst`.
:license: Modified BSD, see LICENSE.txt for details.
'''
from __future__ import division, print_function, unicode_literal... |
#!/usr/bin/python2.4
# Copyright 2009, Google Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of... |
import json
import logging
import re
from HTMLParser import HTMLParser
import jsonschema
from django.conf import settings
from treeherder.etl.buildbot import RESULT_DICT
logger = logging.getLogger(__name__)
class ParserBase(object):
"""
Base class for all parsers.
"""
def __init__(self, name):
... |
import sys
from heapq import heappush, heappop, heapify
BEFORE = True
AFTER = False
def load_num():
line = sys.stdin.readline()
if line == ' ' or line == '\n':
return None
return int(line)
def load_case():
npeople = load_num()
people = []
for p in range(npeople):
people.app... |
#!/usr/bin/env python
#-*- coding:utf-8 -*-
import ConfigParser
try:
import cPickle as pickle
except:
import pickle
import itertools
import math
import os.path
from Queue import Queue
import random
import time
import threading
from Tkinter import *
import tkColorChooser
import tkFileDialog
import tkFont
import... |
from __future__ import with_statement
from contextlib import contextmanager
from Queue import Queue
import threading
from bson import BSON
from nose.tools import assert_equal
import zmq
from zrpc.concurrency import Callback
from zrpc.server import Server
from zrpc.registry import Registry
REGISTRY = Registry()
c... |
# Copyright 2011 OpenStack LLC.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required b... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""
This file is part of XBMC Mega Pack Addon.
Copyright (C) 2014 Wolverine (xbmcmegapack@gmail.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 Softwar... |
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import frappe, os, json
from frappe.custom.doctype.custom_field.custom_field import create_custom_fields
from erpnext.setup.setup_wizard.operations.tax... |
# -*- coding: utf-8 -*-
#
# Copyright © 2012 - 2014 Michal Čihař <michal@cihar.com>
#
# This file is part of Weblate <http://weblate.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, eithe... |
# This file is part of the Hotwire Shell project API.
# Copyright (C) 2007 Colin Walters <walters@verbum.org>
# 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, includin... |
# -*- coding: utf-8 -*-
"""
Note: Django 1.4 support was dropped in #107
https://github.com/pydanny/dj-braintree/pull/107
"""
from django.contrib import admin
from .models import Transaction
from .models import Customer
class CustomerHasCardListFilter(admin.SimpleListFilter):
title = "card presence"
... |
'''
Created on Mar 5, 2018
@author: johnrabsonjr
Functions:
generate_clearnet_firewall_configuration_file
generate_darknet_firewall_configuration_file
activate_firewall_configuration_file
configure_firewall
Classes:
_BackendNetworkFirewall
'''
import unittest
class Test_generate_clearnet_firewa... |
from math import sin,pi
from numpy import empty,array,arange
from pylab import plot,show
g = 9.81
l = 0.1
theta0 = 179*pi/180
a = 0.0
b = 10.0
N = 100 # Number of "big steps"
H = (b-a)/N # Size of "big steps"
delta = 1e-8 # Required position accuracy per unit time
def f(r):
theta = r[0]
ome... |
"""
Data structures to hold model parameters and attributes such as alignment file paths
"""
import json
import sys
import logging
logging.basicConfig(level=logging.DEBUG)
logger = logging.getLogger(__name__)
def setter_helper(fn, value):
"""
Some property setters need to call a function on their value -- e.g.... |
"""
Copyright 2014 Matthias Frey
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to i... |
# THIS FILE IS PART OF THE CYLC SUITE ENGINE.
# Copyright (C) 2008-2019 NIWA & British Crown (Met Office) & Contributors.
#
# 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 th... |
from setuptools import setup
import io
def read(*filenames, **kwargs):
encoding = kwargs.get('encoding', 'utf-8')
sep = kwargs.get('sep', '\n')
buf = []
for filename in filenames:
with io.open(filename, encoding=encoding) as f:
buf.append(f.read())
return sep.join(buf)
long_des... |
import json
from django.core.management import call_command
from django.test import override_settings, TestCase
from django.utils.six import StringIO
from elasticsearch import Elasticsearch
from elasticsearch.exceptions import NotFoundError
from simple_forums.backends.search import ElasticSearch
from simple_forums.t... |
from .apps import *
COUNTRY_APP = 'south_africa'
OPTIONAL_APPS = (
'speeches',
'za_hansard',
'pombola.interests_register',
'pombola.spinner',
)
OPTIONAL_APPS += APPS_REQUIRED_BY_SPEECHES
SPEECH_SUMMARY_LENGTH = 30
BLOG_RSS_FEED = ''
BREADCRUMB_URL_NAME_MAPPINGS = {
'info': ['Information', '/in... |
# Copyright 2014-2015 Robert Jordens <jordens@gmail.com>
#
# This file is part of redpid.
#
# redpid 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 l... |
# Copyright 2010 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 agreed to in wr... |
"""Driver module for Stanford Research Systems DS345 Function Generator."""
import serial
class DS345Driver:
#pylint: disable=too-many-public-methods
"""Class for low-level access to the function generator settings."""
def __init__(self, serial_port):
self._serial_port = str(serial_port)
# FUNC... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
]
operations = [
migrations.CreateModel(
name='Day',
fields=[
('id', models.AutoField(verbose_... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
import os
import json
import codecs
import shutil
import re
class JSONSchema2RST:
def __init__(self):
self.data = {'type': 'root', 'children': {}}
self.source = None
self.target = None
self.toctrees = []
def travel(self, source='./sche... |
# Copyright 2016 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... |
"""
calculatepi.py
Author: Morgan Meliment
Credit: none
Assignment:
Write and submit a Python program that computes an approximate value of π by calculating the following sum:
(see: https://github.com/HHS-IntroProgramming/Calculate-Pi/blob/master/README.md)
This sum approaches the true value of π as n approaches ∞.
... |
#!/usr/bin/python
# coding: utf-8
# #################################################################################
# Copyright (C) 2014 Francesco Giovannini, Neurosys - INRIA CR Nancy - Grand Est
# Authors: Francesco Giovannini
# email: francesco.giovannini@inria.fr
# website: http://neurosys.loria.fr/
# Permission... |
# dust documentation build configuration file, created by
# sphinx-quickstart.
#
# This file is execfile()d with the current directory set to its containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
# All configuration values have a default; values that are com... |
#!/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")... |
"""Utilities to manipulate hosts via UI."""
from robottelo.ui.base import Base
from robottelo.ui.locators import common_locators, locators, tab_locators
from robottelo.ui.navigator import Navigator
class Hosts(Base):
"""Provides the CRUD functionality for Host."""
def _configure_hosts_parameters(self, parame... |
#
# This file is part of the CCP1 Graphical User Interface (ccp1gui)
#
# (C) 2002-2007 CCLRC Daresbury Laboratory
#
# 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 ... |
# -*- 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):
# Deleting field 'Organization.mailing_address'
db.delete_column(u'sfpirgapp_organization', 'mailing_address... |
import pathlib
from allauth.account.forms import LoginForm, SignupForm, ResetPasswordForm
from django.conf import settings
from django.contrib.auth import login
from django.contrib.auth.mixins import LoginRequiredMixin
from django.contrib.auth.models import User
from django.db.utils import OperationalError
from django... |
# Copyright 2015: Mirantis 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 b... |
# -*- coding: utf-8 -*-
# Generated from the Telepathy spec
"""Copyright (C) 2005, 2006 Collabora Limited
Copyright (C) 2005, 2006 Nokia Corporation
Copyright (C) 2006 INdT
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 ... |
""" Define Worker process, for scanning the spectrum using a Keysight sensor.
"""
import sys
from spectrum.process import Process
from spectrum.common import log, parse_config, now
from pyams import Sensor
class Worker(Process):
""" Process implementation for spectrum scanning using a Keysight sensor.
"""
... |
# coding=utf-8
from rexploit.interfaces.iexploit import IExploit
class Exploit(IExploit):
def __init__(self):
super(Exploit, self).__init__(
name="DRG A225 WiFi router default WPA",
category="generator",
authors={
"Vulnerability discovery": "Muris Kurgas... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.