src stringlengths 721 1.04M |
|---|
import numpy
from numpy import shape
from pylab import figure, show, connect
##import sys
##for arg in sys.argv:
##
## print arg
## data=arg
class IndexTracker:
def __init__(self, ax, X):
self.ax = ax
ax.set_title('use scroll wheen to navigate images')
self.X = X
rows,c... |
from django.conf import settings
from django.core.exceptions import ImproperlyConfigured
from django.core.mail import EmailMessage
from django.core.mail import EmailMultiAlternatives
from django.test import SimpleTestCase as TestCase
from sgbackend import SendGridBackend
settings.configure()
class SendGridBackendTe... |
from sqlalchemy.sql import table, column, ClauseElement, operators
from sqlalchemy.sql.expression import _clone, _from_objects
from sqlalchemy import func, select, Integer, Table, \
Column, MetaData, extract, String, bindparam, tuple_, and_, union, text,\
case, ForeignKey, literal_column
from sqlalchemy.testing... |
from gh.base import Command
class ForkRepoCommand(Command):
name = 'fork.repo'
usage = '%prog [options] fork.repo [options] login/repo'
summary = 'Fork a repository'
subcommands = {}
def __init__(self):
super(ForkRepoCommand, self).__init__()
self.parser.add_option('-o', '--organi... |
# This Gaia Sky script showcases a constant camera turn
# Created by Toni Sagrista
from py4j.clientserver import ClientServer, JavaParameters, PythonParameters
import time
class CameraUpdateRunnable(object):
def __init__(self, gs, rotation_rate):
self.gs = gs
self.rotation_rate = rotation_rate
... |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.6 on 2017-03-22 20:28
from __future__ import unicode_literals
from django.db import migrations, models
import users.managers
class Migration(migrations.Migration):
dependencies = [
('auth', '0008_alter_user_username_max_length'),
('users', '0001... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
import sys
from music21.ext import xlrd
#sys.path.append('/mit/cuthbert/www/music21')
if len(sys.argv) != 3:
raise Exception("Need two arguments to diff!")
if (sys.argv[1].count(':') == 1):
(book1name, sheetname1) = sys.argv[1].split(':')
if (book1name.count('... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import threading
from Queue import Queue
import time
import lxml.html
from CallMonitorMessage import CallMonitorMessage
from Database import Database
# 23.04.2015 Änderung bei der 11880-Suche von h3 auf h1 in root.cssselect()
# #########################################... |
from django.conf.urls import url
from web import views
from web.views import HomePageView
from web.views import FAQView
from web.views import SightingExpertCommentsView
from web.views import SightingView
from web.views import SightingsView
from web.views import SightQuestionView
from web.views import LocationsPageView
... |
# -*- coding: utf-8 -*-
class Environment:
""" Compile-time environment """
var_counter_root = 0 # Счетчик переменных для stack memory
var_counter = 0 # Счетчик переменных для stack memory
vars = {} # Переменные в stack memory
label_counter = 0 # Счетчик меток
la... |
"""
Miscellaneous utilities.
Pyro - Python Remote Objects. Copyright by Irmen de Jong (irmen@razorvine.net).
"""
import sys
import zlib
import logging
import linecache
import traceback
import inspect
import Pyro4.errors
import Pyro4.message
try:
import copyreg
except ImportError:
import co... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#--------------------------------------------------------------------------------------------------
# pyOwaspBELVA - Contextual custom dictionary builder with character and word variations for pen-testers
# Copyright (C) 2016 OWASP Foundation / Kenneth F. Belva
#
... |
from django.core.management.base import BaseCommand, CommandError
from django.core.management import call_command
from django.conf import settings
from django.db import connection
from common.alignment import Alignment, ClosestReceptorHomolog
from protein.models import Protein, ProteinSegment
from structure.models imp... |
# -*- coding: utf-8 -*-
#
# lld documentation build configuration file.
#
# 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 commented ... |
import json
import logging
import os
import subprocess
from concurrent.futures import ThreadPoolExecutor, wait, ALL_COMPLETED
import requests
import yaml
logging.basicConfig(level=logging.INFO)
logger = logging.getLogger(__name__)
def run_subprocess(command, shell=True, cwd=None):
current_working_directory = cw... |
"""
Django settings for aprocacaho project.
Generated by 'django-admin startproject' using Django 1.9.4.
For more information on this file, see
https://docs.djangoproject.com/en/1.9/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.9/ref/settings/
"""
from loca... |
from svg import Svg
import codecs
MARGIN_X=20
MARGIN_Y=60
MAGNIFICATION = 500
MIN_D = 1
MAX_D = 4
DIMMEST_MAG = 6
BRIGHTEST_MAG = -1.5
LABEL_OFFSET_X = 4
LABEL_OFFSET_Y = 3
FONT_SIZE=16
FONT_COLOUR='#167ac6'
TITLE_SIZE=16
TITLE_COLOUR='#000'
COORDS_SIZE=12
COORDS_COLOUR='#000'
STAR_COLOUR='#000'
CURVE_WIDTH = 0... |
# -*- encoding: utf-8 -*-
from django.contrib import admin
from recmap.models import Endereco, Horario, Coleta, Setor, ColetaHorario, Feedback
class EnderecoAdmin(admin.ModelAdmin):
fieldsets = (
(u'Nome da Rua', {'fields': ('nome_bruto', 'nome_min', 'nome')}),
(u'Bairro / Geolocalização', {'fie... |
##########################################################################
#
# Copyright (c) 2012, John Haddon. 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 so... |
from Bio import SeqIO
import yaml
import sys
import os
def replace_deletions(word, seq, idxs, del_letter='d'):
"""
Replace any '-' in word with del_letter if the nucleotides next to it in
seq are not '-'.
"""
new_word = [c for c in word]
for i, letter in enumerate(word):
# assume we're... |
"""Test Github resolution."""
from __future__ import absolute_import, unicode_literals
from travis_log_fetch.config import (
_get_github,
get_options,
)
from travis_log_fetch.get import (
get_forks,
)
import pytest
# Note 'foo' is a real Github user, but they do not
# have repos bar or baz
class TestFor... |
"""
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 use this ... |
#!/usr/bin/env python
"""An interface to the Earth Engine batch processing system.
Use the static methods on the Export class to create export tasks, call start()
on them to launch them, then poll status() to find out when they are finished.
The function styling uses camelCase to match the JavaScript names.
"""
# pyl... |
# -*- coding: utf-8 -*-
from django.shortcuts import render_to_response
from django.template import RequestContext
from django.http import HttpResponseRedirect
from django.core.urlresolvers import reverse
from myproject.myapp.forms import EmailForm
from myproject.myapp.models import Document
from myproject.myapp.forms ... |
# coding: utf-8
import wx
import dataset
import xlsxwriter
from xlsxwriter.workbook import Workbook
import xlwt
import tagtool
import codecs
import csv
import csvkit
from stuf import stuf
# import the newly created GUI file
import JukuPlanner
import subprocess
import os
import sys
import glob
import funzioni
import cal... |
import pytest
import time
# Not entirely happy with this check
# TODO Change when I understand pytest better
def skip_if_unplugged():
import usb.core
dev = usb.core.find(idVendor=0x0403, idProduct=0x6014)
if dev is None:
pytest.skip("FT232H not plugged in")
def test_lights(num_lights, light_type... |
"""Test optional udocker feature."""
import copy
import os
import subprocess
import sys
from pathlib import Path
import pytest
from _pytest.tmpdir import TempPathFactory
from .util import get_data, get_main_output, working_directory
LINUX = sys.platform in ("linux", "linux2")
@pytest.fixture(scope="session")
def u... |
"""
Test for softmax_regression.ipynb
"""
import os
from pylearn2.testing.skip import skip_if_no_data
from pylearn2.config import yaml_parse
from theano import config
def test():
skip_if_no_data()
dirname = os.path.join(os.path.abspath(os.path.dirname(__file__)), '..')
with open(os.path.join(dirname, ... |
'''
Anthony NG
@ 2017
## MIT License
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAI... |
# -*- coding: utf-8 -*-
# Copyright 2016 Open Permissions Platform Coalition
# 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 appl... |
# Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 Alan W. Irwin
# Window positioning demo.
#
# This file is part of PLplot.
#
# PLplot is free software; you can redistribute it and/or modify
# it under the terms of the GNU Library General Public License as published
# by the Free Software Foundation... |
#!/usr/bin/env python
import os, subprocess, sys, time, shutil
sumoHome = os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '..', '..', '..'))
sys.path.append(os.path.join(sumoHome, "tools"))
import traci
if sys.argv[1]=="sumo":
sumoBinary = os.environ.get("SUMO_BINARY", os.path.join(sumoHome, 'bin',... |
import os
from pathlib import Path
import unittest
import ray
import ray.rllib.agents.marwil as marwil
from ray.rllib.utils.framework import try_import_tf
from ray.rllib.utils.test_utils import check_compute_single_action, \
framework_iterator
tf1, tf, tfv = try_import_tf()
class TestMARWIL(unittest.TestCase):
... |
import numpy as np
import inspect
import os
def get_planck(restricted=True):
""" Priors from COM_CosmoParams_fullGrid_R2.00\base_w\plikHM_TT_lowTEB\base_w_plikHM_TT_lowTEB"""
file = os.path.abspath(inspect.stack()[0][1])
dir_name = os.path.dirname(file)
results = np.load(dir_name + "/planck.npy")
... |
import os
import webbrowser
import json
from app.ListenerInterface import ListenerInterface
from app.SearcherInterface import SearcherInterface
class UserInterface:
def __init__(self):
super(UserInterface, self).__init__()
self._auth = None
self._search_terms = ''
self._num_tweets ... |
#!/usr/bin/env python
#
# Copyright (c) 2016, The OpenThread Authors.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# 1. Redistributions of source code must retain the above copyright
# notic... |
import uuid
import re
import datetime
import decimal
import itertools
import functools
import random
import string
import six
from six import iteritems
from ..exceptions import (
StopValidation, ValidationError, ConversionError, MockCreationError
)
try:
from string import ascii_letters # PY3
except ImportErr... |
from django.conf.urls import patterns, url
from django.utils.translation import ugettext_lazy as _
from funky_user.conf import PASSWORD_TOKEN
from funky_user.forms import PasswordResetForm
# Built-in Django views
urlpatterns = patterns('django.contrib.auth.views',
url(_(r'^login/$'), 'login',
{'template... |
#!/usr/bin/python
import sys
import pygame
from Buttons import Buttons
from GameButton import GameButton
from MenuButton import MenuButton
from gi.repository import Gtk
class Grammar_Game:
def __init__(self):
# Set up a clock for managing the frame rate.
self.clock = pygame.time.Clock()
s... |
from __future__ import absolute_import
from collections import Iterable, OrderedDict, Sequence
import difflib
import itertools
import re
import textwrap
import warnings
import numpy as np
import sys
from six import string_types, reraise
from ..models import (
BoxSelectTool, BoxZoomTool, CategoricalAxis,
TapT... |
# ##### BEGIN GPL LICENSE BLOCK #####
#
# 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 distrib... |
# Importation of Pygame
import pygame
from car import Car
import os
folder = os.path.dirname(os.path.realpath(__file__))
pygame.init()
pygame.mixer.init()
# Colouration
BLACK = ( 0, 0, 0)
WHITE = ( 255, 255, 255)
GREEN = ( 0, 255, 0)
RED = ( 255, 0, 0)
BLUE = (0, 0, 255)
SKYBLUE = (135,206,235)
GRASSG... |
#!/usr/bin/python3.3
def gensquares(N):
for i in range(N):
yield i ** 2
for i in gensquares(5):
print(i, end=":")
print()
x = gensquares(4)
print(x)
print(next(x))
print(next(x))
print(next(x))
print(next(x))
# throw exception: StopIteration
# print(next(x))
def ups(line):
for x in line.split(',... |
__author__ = 'dimitris'
import time
from datetime import datetime
from django.db.models import Q
from django.core.management import BaseCommand
from linda_app.models import DatasourceDescription
class Command(BaseCommand):
help = 'Update existing datasources'
def handle(self, *args, **options):
whil... |
# Protocol Buffers - Google's data interchange format
# Copyright 2008 Google Inc. All rights reserved.
# http://code.google.com/p/protobuf/
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions o... |
from __future__ import print_function
from docopt import docopt
import cloudmesh_vagrant as vagrant
from cloudmesh_client.common.dotdict import dotdict
from pprint import pprint
from cloudmesh_client.common.Printer import Printer
from cloudmesh_client.common.Shell import Shell
import sys
import os
from cloudmesh_vagra... |
#!/usr/bin/env python
"""Utilities for modifying the GRR server configuration."""
import argparse
import getpass
import os
import re
import shutil
import socket
import subprocess
import sys
import time
from typing import Optional, Text, Generator
from urllib import parse as urlparse
import MySQLdb
from MySQLdb.consta... |
import os
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
SECRET_KEY = os.environ.get('SECRET_KEY', 'zo3^4x8eqz8*ye9r$hrh*w)13)l@w7ymod_#%%&7+6+j*8l&$#')
DEBUG = bool(os.environ.get('DEBUG', False))
if DEBUG:
print('WARNING: The DEBUG is set to True.')
DEV = bool(os.environ.get('DEV', Fal... |
# Copyright (C) 2010 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... |
"""
Tests that Gabble doesn't explode if it gets Jingle stanzas for unknown
sessions.
"""
from gabbletest import exec_test
from servicetest import assertEquals
from jingletest2 import JingleProtocol031
import ns
def assertHasChild(node, uri, name):
try:
node.elements(uri=uri, name=name).next()
except ... |
# -*- Mode:Python; indent-tabs-mode:nil; tab-width:4 -*-
#
# Copyright (C) 2015-2018 Canonical Ltd
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 3 as
# published by the Free Software Foundation.
#
# This program is distributed in ... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from collections import namedtuple
path_attr = namedtuple("path_attr", ("PATH", "ATTR"))
__ALL__ = ["SENCORE_URLS_ENUM", "SENCORE_DATA_PATH", "SENCORE_ATTRS_ENUM", "RESULT_PATH"]
class SENCORE_URLS_ENUM(object):
ETH = "http://{address}/probe/ethdata"
ETR_ALL = ... |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.2 on 2017-07-09 22:57
from __future__ import unicode_literals
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
import django.utils.timezone
import uuid
class Migration(migrations.Migration):
dependencies... |
# -*- coding: utf-8 -*-
"""
eve-demo settings
~~~~~~~~~~~~~~~~~
Settings file for our little demo.
PLEASE NOTE: We don't need to create the two collections in MongoDB.
Actually, we don't even need to create the database: GET requests on an
empty/non-existant DB will be served correctly ('200' O... |
from string import letters, digits
from random import shuffle
def random_monoalpha_cipher(pool=None):
"""Generate a Monoalphabetic Cipher"""
if pool is None:
pool = letters + digits
original_pool = list(pool)
shuffled_pool = list(pool)
shuffle(shuffled_pool)
return dict(zip(original_poo... |
<<<<<<< HEAD
<<<<<<< HEAD
"""Fixer that addes parentheses where they are required
This converts ``[x for x in 1, 2]`` to ``[x for x in (1, 2)]``."""
# By Taek Joo Kim and Benjamin Peterson
# Local imports
from .. import fixer_base
from ..fixer_util import LParen, RParen
# XXX This doesn't support nested for loops l... |
from operator import attrgetter
from django.db import connection, connections, router, transaction
from django.db.backends import utils
from django.db.models import signals
from django.db.models.fields import (AutoField, Field, IntegerField,
PositiveIntegerField, PositiveSmallIntegerField, FieldDoesNotExist)
from ... |
# Copyright 2021 The Brax 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 law or agreed to in wri... |
import sys
import math
import time
print "\v\v\v\v\v\v\v\v\v\v\v\v\v\v\v\v\v\v\v\v\v\v\v\v\v\v\v\v\v\v\v\v\vEnter Your name"
name = raw_input("> ")
"""This will display only first name"""
f_name = name.split()
print "\v\v\v\v\v\v\v\v\v\v\v\v\v\v\v\v\v\v\v\v\v\v\v\v\v\v\vWelcome %r! Be a \n\n\n\n\t\t\t...TRAILBLAZER..."... |
# -*- coding: iso-8859-1 -*-
# Copyright (C) 2001,2002 Python Software Foundation
# csv package unit tests
import sys
import os
import unittest
from StringIO import StringIO
import tempfile
import csv
import gc
from test import test_support
class Test_Csv(unittest.TestCase):
"""
Test the underl... |
# noinspection PyPackageRequirements
import wx
import eos.config
import gui.mainFrame
from eos.utils.spoolSupport import SpoolType, SpoolOptions
from gui import globalEvents as GE
from gui.contextMenu import ContextMenu
from service.settings import ContextMenuSettings
from service.fit import Fit
class SpoolUp(Contex... |
# -*- coding: utf-8 -*-
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import datetime
import os
import sqlite3
from common import conf
class UrlDb:
def __init__(self):
self.conn = None
self.c = None
def _open_sqlite3(self, url_db_file):
self.conn = sqlite3.connect(
url_db_file,
dete... |
# 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... |
import django
from django.conf import settings
from django.template.loader import render_to_string
from django.utils.translation import ugettext_lazy as _
from debug_toolbar.panels import DebugPanel
import sys
class VersionDebugPanel(DebugPanel):
'''
Panel that displays the Django version.
'''
name =... |
#!/usr/bin/env python
#
# Copyright 2012 the Melange 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 applicabl... |
#!/usr/bin/env python
"""This is the setup.py file for the GRR client.
This is just a meta-package which pulls in the minimal requirements to create a
full grr server.
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import unicode_literals
import itertools
import os
import s... |
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
import time
import subprocess
import os
import signal
PAGES = ['http://www.google.co.uk', 'http://www.youtube.com',
'http://www.google.com', 'http://www.facebook.com',
'http://www.reddit.com', 'http://www.amazon.co.uk',
... |
import random
import string
import logging
import datetime
from dateutil.relativedelta import relativedelta
# An abstracted data model for fetching data from honeypot_logs
class HoneypotLogTable(object):
# Create model for a specific airflow database
def __init__(self, table_name, sql_conn_id='airflow_db'):
... |
# ##### BEGIN GPL LICENSE BLOCK #####
#
# 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 distrib... |
'''
Created on Apr 4, 2014
Simple json marshalling utils for the classes in this project
#TODO Note: This whole module is pointless! Bottle.py can easily marshal dictionaries into/from json!
@author: theoklitos
'''
from control import brew_logic
from util import misc_utils, configuration
from database import db_adap... |
# -*- coding: utf-8 -*-
"""
pygments.lexers.shell
~~~~~~~~~~~~~~~~~~~~~
Lexers for various shells.
:copyright: Copyright 2006-2013 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
import re
from pygments.lexer import Lexer, RegexLexer, do_insertions, bygroups, inclu... |
from __future__ import division
import pandas as pd
import sklearn.datasets as ds
import DSTK.BoostedFeatureSelectors.boselector as bs
import numpy as np
cancer_ds = ds.load_breast_cancer()
cancer_df = pd.DataFrame(cancer_ds['data'], columns=cancer_ds['feature_names'])
targets = pd.Series(cancer_ds['target'])
def t... |
from contextlib import closing
from matplotlib.pyplot import plot, figure, hold, axis, ylabel, xlabel, savefig, title
from numpy import sort, logical_xor, transpose, logical_not
from numpy.numarray.functions import cumsum, zeros
from numpy.random import rand, shuffle
from numpy import mod, floor
import time
import clou... |
#!/usr/bin/env python
# This file is part of Tryton. The COPYRIGHT file at the top level of
# this repository contains the full copyright notices and license terms.
from setuptools import setup
import re
import os
import ConfigParser
def read(fname):
return open(os.path.join(os.path.dirname(__file__), fname)).r... |
#!/usr/bin/env python
"""
Rotated genetic design to generate a homology matrix for CRISPRi circuit
"""
import numpy as np
import string
import dnaplotlib as dpl
import matplotlib.pyplot as plt
import matplotlib
import pylab
import csv
import matplotlib.gridspec as gridspec
from matplotlib.transforms import Affine2D
i... |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.1 on 2017-01-17 14:13
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('seshdash', '0005_remove_report_sent_report_date'),
]
... |
# Copyright (c) 2012 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
from api_data_source import APIDataSource
from api_list_data_source import APIListDataSource
from appengine_wrappers import IsDevServer
from availability... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""
Created by Chouayakh Mahdi
08/07/2010
The package contains functions to perform test
It is more used for the subject
Functions:
unit_tests : to perform unit tests
"""
import unittest
import logging
logger = logging.getLogger("dialogs")
from dialogs.dialog_core ... |
# -*- coding: utf-8 -*-
from git_lab.apis.mergerequest.models import MergeRequest, Note
class MergeRequestRepository(object):
def __init__(self, client=None, project=None):
u"""
@param client : GitLabクライアント
@type client : gitlab.Gitlab
"""
from git_lab.utils import get_cl... |
from __future__ import print_function
import os
import time
import json
import pickle
import sys
from itertools import product, combinations
import matplotlib
import matplotlib.pyplot as plt
import seaborn as sns
import pandas as pd
import numpy as np
from sklearn.preprocessing import LabelEncoder
from ruzicka.util... |
# Copyright (c) 2016 Gabriel Casarin da Silva, All Rights Reserved.
from comum.automatos import AutomatoFinito
from comum.automatos.estado import Estado, EstadoNaoDeterministico
def eliminar_transicoes_em_vazio(automato):
def epsilon_closure(estado):
fecho = [estado]
pilha = list(fecho)
... |
#!/usr/bin/env python
import utils
import sys
import signal
import os
try:
import argparse
parsermodule = argparse.ArgumentParser
except:
import optparse
parsermodule = optparse.OptionParser
parsermodule.add_argument = parsermodule.add_option
def getCommandLineArguments():
# Command line argume... |
# Copyright (C) 2009 Google Inc. All rights reserved.
# Copyright (C) 2009 Apple Inc. All rights reserved.
# Copyright (C) 2011 Daniel Bates (dbates@intudata.com). All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following condit... |
# -*- coding: utf-8 -*-
"""
Custom UI Widgets used by the survey application
@copyright: 2011-2012 (c) Sahana Software Foundation
@license: MIT
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the "Software"), to... |
import base58
import cbor
from mediachain.proto import Types_pb2 # pylint: disable=no-name-in-module
from mediachain.datastore.data_objects import MultihashReference
def multihash_ref(ref):
if isinstance(ref, MultihashReference):
return ref
try:
ref = ref.reference
except AttributeError:... |
import os, Pyro4, new
import django.htoken.serializer
from django.utils.importlib import import_module
from django.analysis.persisted import mw_socket
from django.http import get_changeset
PYRO_NAME = 'middleware'
def pre_req(self, request, delta):
request = self.cereal.deserialize(request)
self.cereal.apply_... |
import asyncore
import base
import logging
import os.path
import re
import urllib
import uuid
class HTTPHandler(base.BaseHandler):
def __init__(self, server, conn, addr):
base.BaseHandler.__init__(self, server, conn, addr)
self.set_terminator(b"\r\n")
logging.info("HTTP connection from {... |
"""
A backport of the Python 3.2 TemporaryDirectory object.
From:
https://stackoverflow.com/questions/19296146/tempfile-temporarydirectory-context-manager-in-python-2-7
"""
from __future__ import print_function
import warnings as _warnings
import os as _os
import sys as _sys
from tempfile import mkdtemp
class Res... |
# -*- coding: utf-8 -*-
#
# minihmm documentation build configuration file, created by
# sphinx-quickstart on Fri Jun 5 00:24:09 2015.
#
import sys
import os
import minihmm
import mock
# Manual mocking
class SetMock():
def __contains__(self, val):
return True
class DocMock(mock.MagicMock):
"""Pro... |
# BigBrotherBot(B3) (www.bigbrotherbot.net)
# Copyright (C) 2005 Michael "ThorN" Thornton
#
# 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... |
#
# Copyright 2005-2017 ECMWF.
#
# This software is licensed under the terms of the Apache Licence Version 2.0
# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
#
# In applying this licence, ECMWF does not waive the privileges and immunities
# granted to it by virtue of its status as an intergovern... |
#
# This file is part of Gruvi. Gruvi is free software available under the
# terms of the MIT license. See the file "LICENSE" that was provided
# together with this source file for the licensing terms.
#
# Copyright (c) 2012-2014 the Gruvi authors. See the file "AUTHORS" for a
# complete list.
from __future__ import a... |
import requests
import gzip
import bz2
import csv
def opener(filenames):
for name in filenames:
if name.endswith(".gz"):f = gzip.open(name)
elif name.endswith(".bz2"): f = bz2.BZ2File(name)
else: f = open(name)
yield f
def cat(filelist):
for f in filelist:
r = csv.reade... |
import numpy as np
# calculate the false alarm probability
def fap(x, y, basis, fs, N, plot=False, sig=False):
amp2s, s2n, _ = K2pgram(x, y, basis, fs) # 1st pgram
if sig: power = s2n
else: power = amp2s
mf, ms2n = peak_detect(fs, power) # find peak
AT = np.concatenate((basis, np.ones((3, len(y))... |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.1 on 2016-01-14 13:59
from __future__ import unicode_literals
from django.db import migrations, models
import django.utils.timezone
class Migration(migrations.Migration):
initial = True
dependencies = [
('auth', '0007_alter_validators_add_error_mess... |
# using JSON and the WeatherUnderground API
# parsing data and emailing it to myself
import smtplib
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText
import urllib.request
import json
from API_KEYS import EMAIL_ADDRESS, EMAIL_PASSWORD
from API_KEYS import WEATHER_UNDERGROUND_KEY
# g... |
# Copyright (c) 2015, 2016 Timothy Savannah under terms of LGPLv3. You should have received a copy of this with this distribution as "LICENSE"
'''
utils - Some general-purpose utility functions
'''
import re
__all__ = ('cmp_version', )
# Yes, cmp is DA BOMB. What a huge mistake removing it from the language!!
tr... |
from lib.iq_mixer_calibration import *
from lib.data_management import *
from lib2.DispersiveHahnEcho import DispersiveHahnEcho
from lib2.ReadoutExcitationShiftCalibration import \
ReadoutExcitationShiftCalibration
from lib2.fulaut.ACStarkRunnner import ACStarkRunner
from lib2.fulaut.ResonatorOracle import *
from ... |
# -*- coding: utf-8 -*-
# This file is part of Shoop.
#
# Copyright (c) 2012-2016, Shoop Ltd. All rights reserved.
#
# This source code is licensed under the AGPLv3 license found in the
# LICENSE file in the root directory of this source tree.
import pytest
import six
from django.forms.models import ModelForm
from djan... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.