text stringlengths 12 6.59M |
|---|
#! /usr/bin/env python
"""\
bundlebuilder.py -- Tools to assemble MacOS X (application) bundles.
This module contains two classes to build so called "bundles" for
MacOS X. BundleBuilder is a general tool, AppBuilder is a subclass
specialized in building application bundles.
[Bundle|App]Builder objects are instantiat... |
#!/usr/bin/env python3
import paho.mqtt.client as mqtt
import pandas as pd
import numpy as np
from sklearn import svm
from sklearn.externals import joblib
from pathlib import Path
import sys,logging
if len(sys.argv) > 2:
host = sys.argv[1]
basepath = Path(sys.argv[2])
else:
print("A host and path are required. Eg: ... |
import __future__
import sys, os
import unittest
import distutils.dir_util
import tempfile
from test import test_support
try: set
except NameError: from sets import Set as set
import modulefinder
# Note: To test modulefinder with Python 2.2, sets.py and
# modulefinder.py must be available - they are not in the stan... |
# Test suite for SocketServer.py
from test import test_support
from test.test_support import (verbose, verify, TESTFN, TestSkipped,
reap_children)
test_support.requires('network')
from SocketServer import *
import socket
import errno
import select
import time
import threading
import os
... |
from AppKit import *
from vanillaBase import _breakCycles, _calcFrame, _setAttr, _delAttr, _flipFrame, \
VanillaCallbackWrapper, VanillaError, VanillaBaseControl
class Window(NSObject):
"""
A window capable of containing controls.
To add a control to a window, simply set it as an attribute of th... |
from __future__ import division
def run():
import os
import libtbx.load_env
from libtbx.test_utils import show_diff
from libtbx import easy_run
try:
dials_regression = libtbx.env.dist_path('dials_regression')
except KeyError, e:
print 'FAIL: dials_regression not configured'
exit(0)
path = os... |
"""
Database connector wrapper
"""
import logging
import re
from collections import OrderedDict, defaultdict
from warnings import filterwarnings
import MySQLdb
from MySQLdb.cursors import DictCursor
from MySQLdb._exceptions import OperationalError, ProgrammingError
from indexdigest.schema import Column, Index
from in... |
import os.path
import logging
import sys
from lxml import etree
log = logging.getLogger('EAD PROCESSOR')
class EADProcessor:
def __init__(self, datafile, transforms, source, output_folder):
# the HDMS datafile
self.datafile = datafile
# the source URL for contructing the id
self.... |
from indra.sources.tas import process_from_web
def test_processor():
tp = process_from_web(affinity_class_limit=10)
assert tp
assert tp.statements
num_stmts = len(tp.statements)
# This is the total number of statements about human genes
assert num_stmts == 1601159, num_stmts
assert all(len... |
__version__ = '0.1.52'
|
import csv
import unittest
from infrastructure import models
from scorecard.models import Geography
from django.db import transaction
import xlrd
import logging
logger = logging.Logger(__name__)
headers = [
x.strip()
for x in """
Function, Project Description, Project Number,
Type, MTSF Service Outcom... |
"""
This scripts initializes the instruments and imports the modules
"""
# General imports
import time
t0 = time.time() # to print how long init takes
from instrument_drivers.meta_instrument.qubit_objects import duplexer_tek_transmon as dt
from importlib import reload # Useful for reloading while testing
import n... |
# NFDAkey.py
import os
import sys
import time
from time import clock
locipe = os.environ['SSH_CONNECTION'][10:12]
keycontent_raw = '1324'
if locipe == '21':
username = os.environ["USERNAME"]
username_prefix = username[:5]
if username_prefix == 'GaoMY':
print(' ')
print(' ')
... |
import logging
import os
BASEDIR = os.path.abspath(os.path.dirname(__file__))
class BaseConfig:
# Debug/Test Flags
DEBUG = False
TESTING = False
DEBUG_TB_ENABLED = True
# Cross-Origin Settings
CORS_HEADERS = 'Content-Type'
# Logger Settings
LOGGING_FORMAT = "[%(asctime)s] {%(pathna... |
# Copyright 2016 Euclidean Technologies Management 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 requ... |
from django.core.urlresolvers import reverse
from django.contrib.auth.models import User
from rest_framework import status
from rest_framework.test import APITestCase
class TodoListTests(APITestCase):
def setUp(self):
User.objects.create_user('test', 'test@example.com', 'test')
self.client.login... |
import json
import time
import unittest
from django.contrib.auth.models import User
from django.core.management import call_command
from django.test import LiveServerTestCase, TestCase
from django.utils.six import StringIO
from wagtail.tests.utils import WagtailPageTests, WagtailTestUtils
from wagtail.wagtailimages.te... |
#!/usr/bin/env python
from camera import ConfigurableCamera
from settings import Job, IMAGES_DIRECTORY
def main():
job = Job()
if job.exists():
file_prefix = job.image_settings.prefix
output_file = IMAGES_DIRECTORY + '/' + file_prefix + '_{counter:03d}.jpg'
with ConfigurableCamera(jo... |
'''
Well Log Data Tools
Created on Jun 12, 2013
@author: Jessica Good Alisdairi, AZGS jalisdairi@azgs.az.gov
This python script offers two different conversions for well log data:
1) Conversion from a BoreholeLASLogData.xls model to a LAS 2.0 file.
2) Conversion from a LAS 2.0 file to an entry in the WellLog Content... |
#!/usr/bin/python3
# create_pim_data.py
import os
import sys
root_fldr = os.path.abspath(os.path.join(os.path.dirname(__file__), '..', 'rawdata'))
sys.path.insert(1, root_fldr)
import generate
op_fldr = generate.dat_fldr + os.sep
words = generate.get_list_words()
places = generate.get_list_places()
# Dairy
custom_... |
"""Examples demonstrating various spinners.
Attributes
----------
CLEAR_LINE : str
To clear the current line
"""
import sys
import time
try:
import cursor
except:
import pip
pip.main(['install', 'cursor'])
import cursor
from spinners import Spinners
CLEAR_LINE = '\033[K'
def animate(frames, in... |
#!/usr/bin/env python3
# Copyright (c) 2015-2020 The Dash Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
import time
from test_framework.test_framework import DashTestFramework
from test_framework.util import set_n... |
import uuid
import json
import requests
from PIL import Image
from django.core.urlresolvers import reverse
from django.core.paginator import Paginator, EmptyPage, PageNotAnInteger
from django.shortcuts import render
from django.http import HttpResponse
from rest_framework.decorators import api_view, authentication_clas... |
import os
import sys
import shutil
import pygit2
SSH_KEY_PUBLIC = os.path.expanduser('~/.ssh/id_rsa.pub')
SSH_KEY_PRIVATE = os.path.expanduser('~/.ssh/id_rsa_unencrypted')
CREDENTIALS = pygit2.credentials.Keypair('git',
SSH_KEY_PUBLIC,
S... |
import itertools
import reprlib
import numpy as np
from lazy import *
class TimeSeries:
"""
A class to store time series data. Supports time series data of any type, including mixed type.
Supports all sequence operations (__getitem__, __setitem__, __len__).
Attributes
----------
Para... |
# Create your views here.
from django.http import HttpResponse
from django.http import HttpResponseNotAllowed, HttpResponseBadRequest, HttpResponseForbidden
from django.utils import simplejson
from django.contrib.auth.models import User
from api import models
from api import utils
from api import permissions
import da... |
#!/usr/bin/python
import sys
from datetime import datetime
from pytz import timezone
import pytz
if len(sys.argv) == 2:
timestampString = sys.argv[1];
#Etc/GMT have the reversed symbol, GMT-1 actually is GMT+1
timezone = timezone("Etc/GMT-1");
elif len(sys.argv) == 3:
timestampString = sys.argv[1];
tzString = sys... |
import simplejson as json
import yaml
from django.http import HttpResponse
from django.utils import timezone
from django.views.decorators.csrf import csrf_exempt
import api.models as models
import directions.models as directions
import users.models as users
from slog import models as slog
def translit(locallangstrin... |
#!/usr/bin/python
"""
Set the firewall to allow access to configured HTTP(S) proxies.
This is only necessary until rBuilder handles the EC2 image posting
and registration process.
"""
import os, sys, urllib, urlparse
from conary.conarycfg import ConaryConfiguration
def main(args):
cfg = ConaryConfiguration(False... |
from django.shortcuts import render
from django.views.decorators.csrf import csrf_exempt
from api.models import Post, Comment, Image, Friending, Author, Node
from api.serializers import PostSerializer, CommentSerializer, ImageSerializer, AuthorSerializer, FriendingSerializer
from api.serializers import UserSerializer
f... |
# -*- encoding: utf-8 -*-
#
# Copyright (C) 2014 Shang Yuanchun <idealities@gmail.com>
#
import copy
import logging
from django.http import JsonResponse
from django.utils import timezone
from django.shortcuts import render
from django.core.exceptions import ValidationError
from django.utils.translation import ugettex... |
from django.shortcuts import render
from rest_framework import views, generics, viewsets
from rest_framework.response import Response
from rest_framework.parsers import MultiPartParser, FormParser, FileUploadParser
from django.template.loader import render_to_string
from django.db.models import Q
from django.conf impor... |
from twisted.protocols import basic
from twisted.internet import reactor
import plugins.plugins as plugin_manager
import packetFactory
import config
import data.clients
import data.players
import data.blocks
commandList = {}
class CommandHandler(object):
def __init__(self, command_name, help_text=None, admin_c... |
#!/usr/bin/python
"""
Program for creating HTML plots
"""
import os
import sys
import json
import time
from readevtlog import *
def write_prefix():
f.write('''
<!doctype html>
<html>
<head>
<title>DNA performance report</title>
<script src="http://code.jquery.com/jquery-latest.min.js"></script>
<script src... |
#!/usr/bin/python
"""
Program for creating HTML plots
"""
import os
import sys
import json
import time
from readevtlog import *
def write_prefix():
f.write('''
<!doctype html>
<html>
<head>
<title>DNA performance report</title>
<script src="http://code.jquery.com/jquery-latest.min.js"></script>
<script src... |
'''The datamodels for the SNHC clintools patient tracking system'''
from django.db import models
from django.core.exceptions import ValidationError
import django.utils.timezone
# pylint: disable=I0011,missing-docstring,E1305
def validate_zip(value):
'''verify that the given value is in the ZIP code format'''
... |
#!/usr/bin/env python
############################################################################
#
# Copyright (C) 2012, 2013 PX4 Development Team. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are m... |
'''The datamodels for the Osler core'''
from itertools import chain
from django.db import models
from django.contrib.auth.models import User
from django.conf import settings
from django.utils.timezone import now
from django.utils.text import slugify
import os
from django.core.urlresolvers import reverse
from simple_h... |
# -*- coding: UTF-8 -*-
# Implemented in Python. Written by ShadowMan(Wang).
# Distributed under the MIT License.
'''This Package Provides Train Query
Object Type:
TraError ---
TraQuery ---
TraSelect ---
TraResult ---
Functions:
adult ---
student ---
@todo: Documen... |
# $Id: drawable.py,v 1.13 2003-07-11 20:49:33 petli Exp $
#
# Xlib.xobject.drawable -- drawable objects (window and pixmap)
#
# Copyright (C) 2000 Peter Liljenberg <petli@ctrl-c.liu.se>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public Licen... |
#!/usr/bin/env python
from __future__ import division, print_function
import argparse
import gzip
import sys
import numpy as np
import cooler
def main():
parser = argparse.ArgumentParser(
description="Convert a cooler file to a tsv file.")
parser.add_argument(
"cooler_file",
help="Coo... |
# -*- coding: utf-8 -*-
__author__ = 'IVMIT KFU: Gataullin Ravil & Veselovkiy Sergei'
import cv2
import math
import numpy as np
from CFiles.CHelper import CHelper
import StringIO
def substractPoint(point1, point2):
return (point2[0] - point1[0], point2[1] - point1[1])
def median(A): # A cheat to find the medi... |
"""Class for formatting target environment errors."""
from collections import Counter
import logging
import os
import sys
import traceback
_ERROR_HTML_PREAMBLE = """
<html>
<head>
<style>
BODY {
font-family: sans-serif;
}
H1 {
font-size: 1.5em;
}
A {
color: #15c;
cursor: pointer;
}
.traceback {
font-fa... |
#
# Typofinder for domain typo discovery
#
# Released as open source by NCC Group Plc - http://www.nccgroup.com/
#
# Developed by Ollie Whitehouse, ollie dot whitehouse at nccgroup dot com
#
# http://www.github.com/nccgroup/typofinder
#
# Released under AGPL see LICENSE for more information#
#
import re
import copy
... |
import logging
import asyncio
import random
import datetime
import decimal
import discord
import wolframalpha
import pyowm
from discord.ext import commands
from .common import Cog
log = logging.getLogger(__name__)
W_CLEAR_SKY = ':sunny:'
W_FEW_CLOUDS = ':white_sun_small_cloud:'
W_SCATTERED_CLOUD... |
"""
Copyright (c) 2015 Wellcome Trust Sanger Institute
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, pub... |
'''Flexible Freeze script for PostgreSQL databases
Version 0.5
(c) 2014 PostgreSQL Experts Inc.
Licensed under The PostgreSQL License
This script is designed for doing VACUUM FREEZE or VACUUM ANALYZE runs
on your database during known slow traffic periods. If doing both
vacuum freezes and vacuum analyzes, do the free... |
# coding: utf-8
from __future__ import division, print_function
__author__ = "adrn <adrn@astro.columbia.edu>"
# Standard library
import os
import sys
# Third-party
from astropy import log as logger
import numpy as np
# Project
from gary.util import get_pool
from streammorphology import potential_registry
from stre... |
# -*- coding: utf-8 -*-
#!/usr/bin/env python
import os
import sys
import csv
from datetime import datetime, time
from dateutil.relativedelta import relativedelta
import calebasse.settings
import django.core.management
django.core.management.setup_environ(calebasse.settings)
from django.contrib.auth.models import ... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import unittest
dbconfig = None
try:
import dbconfig
except ImportError:
pass
from datetime import datetime, timedelta
from yamlns import namespace as ns
import erppeek_wst
import generationkwh.investmentmodel as gkwh
@unittest.skipIf(not dbconfig, "depends on ... |
"""
Created on Jul 28, 2015
test code for ema_ipyparallel. The setup and teardown of the cluster is
taken from the ipyparallel test code with some minor adaptations
.. codeauthor:: jhkwakkel <j.h.kwakkel (at) tudelft (dot) nl>
"""
import logging
import unittest.mock as mock
import os
import socket
import time
import... |
import os
import pexpect
import signal
from urllib.parse import urlparse
from app.util import fs
from app.project_type.project_type import ProjectType
from app.util.conf.configuration import Configuration
class Git(ProjectType):
"""
Example API call to invoke a git-type build.
{
"type": "git",
... |
#!/usr/bin/env python
#
#
# Description: This script encompasses test cases/modules concerning instance specific behavior and
# features for Eucalyptus. The test cases/modules that are executed can be
# found in the script under the "tests" list.
import time
from concurrent.futures impor... |
#!/usr/bin/env python
#
#
# Description: This script encompasses test cases/modules concerning instance specific behavior and
# features for Eucalyptus. The test cases/modules that are executed can be
# found in the script under the "tests" list.
import time
from concurrent.futures impor... |
import torch
import torch.nn as nn
import torch.nn.functional as F
class SoftCrossEntropyLoss(nn.Module):
"""Computes the CrossEntropyLoss while accepting soft (float) targets
Args:
weight: a tensor of relative weights to assign to each class.
the kwarg name 'weight' is used to match Cros... |
from django.test import TestCase
from django.test.client import RequestFactory
from metaphor.utils import get_random_connectors
from metaphor.utils import get_language
from metaphor.utils import get_client_ip
from metaphor.utils import CONNECTORS
from metaphor.views import is_a_metaphor, random_metaphor, word2vec_subst... |
from .capability_api import CapabilityAPI
import warnings
warnings.simplefilter('always', DeprecationWarning)
TASK_ROUTER_BASE_URL = 'https://taskrouter.twilio.com'
TASK_ROUTER_BASE_EVENTS_URL = 'https://event-bridge.twilio.com/v1/wschannels'
TASK_ROUTER_VERSION = "v1"
REQUIRED = {'required': True}
OPTIONAL = {'requ... |
'''this code performs ontological reasoning and mutual modeling inference
from a knowledge base and update it with this infered knowledge'''
import logging
LOGGER = logging.getLogger('mylog')
DEBUG_LEVEL = logging.DEBUG
import sqlite3
import time
from kb import KBNAME, TABLENAME
REASONER_RATE = 2 #Hz
END = False
DEF... |
"""Enables the plotting of images.
Refer also to `SimpleITK Notebooks
<http://insightsoftwareconsortium.github.io/SimpleITK-Notebooks/10_matplotlib's_imshow.html>`_."""
import os
import matplotlib.colors as plt_colors
import matplotlib.pyplot as plt
import numpy as np
import SimpleITK as sitk
def plot_2d_image(path... |
#!/usr/bin/env python
# Quadcopter server-side control script, v0.1
# Python 2.x for Raspberry Pi
# by Ian Renton
# BSD 2-clause licenced
# http://ianrenton.com/quadcopter
import operator
import socket
import select
import serial
import time
import thread
#################
# Constants #
########... |
from dtest import Tester, debug, DISABLE_VNODES
import unittest
from ccmlib.cluster import Cluster
from ccmlib.node import Node, NodeError
from cassandra import ConsistencyLevel, Unavailable, ReadTimeout
from cassandra.query import SimpleStatement
import time, re
class NodeUnavailable(Exception):
pass
class TestR... |
# Copyright 2013-2021 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack.util.module_cmd import get_path_args_from_module_line, module
class CrayLibsci(Package):
"""The Cray Scien... |
#!/usr/bin/env python
from cms.test_utils.cli import configure
from cms.test_utils.tmpdir import temp_dir
import argparse
import sys
def main(test_runner='cms.test_utils.runners.NormalTestRunner', junit_output_dir='.',
time_tests=False, verbosity=1, failfast=False, test_labels=None):
if not test_labels:
... |
from django.contrib.contenttypes.models import ContentType
from django.core import exceptions
from django.contrib.admin.views.decorators import staff_member_required
from django.contrib.auth.decorators import permission_required
from django.db.models import Avg, Max, Min, Count, Sum, CharField
from django.db.models.man... |
# Django settings for experimentdb project.
DEBUG = True
TEMPLATE_DEBUG = DEBUG
ADMINS = (
# ('Your Name', 'your_email@domain.com'),
)
MANAGERS = ADMINS
DATABASE_ENGINE = 'mysql' # 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'.
DATABASE_NAME = 'experimentdb' # Or path... |
#!/usr/bin/env python3
import os
import pymssql
import pymysql.cursors
from contextlib import contextmanager
from enum import Enum
REDCAP_VERSION = '7.2.2'
REDCAP_PATH = 'redcap/redcap_v{}/'.format(REDCAP_VERSION)
REDCAP_UOL_PATH = 'redcap_v{}/'.format(REDCAP_VERSION)
REDCAP_INTERNAL_URL = 'https://briccs.... |
#!/usr/bin/env python
"""
Setuptools bootstrapping installer.
Run this script to install or upgrade setuptools.
"""
import os
import shutil
import sys
import tempfile
import zipfile
import optparse
import subprocess
import platform
import textwrap
import contextlib
import json
import codecs
from distutils import lo... |
#!python
"""Bootstrap setuptools installation
If you want to use setuptools in your package's setup.py, just include this
file in the same directory with it, and add this to the top of your setup.py::
from ez_setup import use_setuptools
use_setuptools()
If you want to require a specific version of setuptools... |
#!/usr/bin/env python
"""
Setuptools bootstrapping installer.
Run this script to install or upgrade setuptools.
"""
import os
import shutil
import sys
import tempfile
import zipfile
import optparse
import subprocess
import platform
import textwrap
import contextlib
import warnings
from distutils import log
try:
... |
from django.shortcuts import render
from fa import api
from datetime import datetime
import re
import logging
logger = logging.getLogger(__name__)
def index(request):
return render(request, 'fa/index.html', {})
def user(request, name):
context = api.get_profile_context(name)
return render(request, 'fa/us... |
import os.path
import shutil
import json
from urllib.parse import urljoin
from fnmatch import fnmatchcase
from zipfile import ZipFile
from pathlib import Path
from glob import glob
from fac.files import JSONFile
from fac.utils import JSONDict, Version
from fac.api import AuthError, OwnershipError, ModNotFoundError
... |
import codecs
import calendar
import datetime
import io
import json
import logging
import mimetypes
import sys
import urllib
import urllib2
import uuid
FACEBOOK_API = 'https://graph.facebook.com'
logger = logging.getLogger(__name__)
class MultipartFormdataEncoder(object):
def __init__(self):
self.bounda... |
"""
======================================================
Classification of text documents using sparse features
======================================================
This is an example showing how scikit-learn can be used to classify documents
by topics using a bag-of-words approach. This example uses a scipy.spars... |
#
# Copyright (c) 2004 Specifix, Inc.
# All rights reserved
#
import difflib
import enum
import filecontainer
import filecontents
import files
import helper
import log
import os
import package
import patch
import repository
import struct
import update
import versioned
import versions
ChangedFileTypes = enum.Enumerate... |
#
# Copyright (c) 2004 Specifix, Inc.
# All rights reserved
#
import filecontainer
import files
import package
import versions
import os
import repository
class ChangeSet:
def isAbstract(self):
return self.abstract
def validate(self, justContentsForConfig = 0):
for pkg in self.getNewPackageList():
# ... |
# -*- coding: utf-8 -*-
r"""
Compressible Mooney-Rivlin hyperelastic material model.
Large deformation is described using the updated Lagrangian formulation.
Incompressibility is treated by mixed displacement-pressure formulation.
Models of this kind can be used to model e.g. rubber or some biological
materials.
"""
i... |
#
# Copyright (c) 2004 Specifix, Inc.
# All rights reserved
#
import difflib
import enum
import filecontainer
import filecontents
import files
import helper
import log
import os
import package
import patch
import repository
import struct
import versioned
import versions
ChangedFileTypes = enum.EnumeratedType("cft", "... |
# -*- coding: utf-8 -*-
from EXOSIMS.SurveySimulation.linearJScheduler import linearJScheduler
from EXOSIMS.util.vprint import vprint
from EXOSIMS.util.get_module import get_module
import sys, logging
import numpy as np
import astropy.units as u
import astropy.constants as const
import random as py_random
import time
i... |
#
# Copyright (c) 2004-2005 Specifix, Inc.
#
# This program is distributed under the terms of the Common Public License,
# version 1.0. A copy of this license should have been distributed with this
# source file in a file called LICENSE. If it is not present, the license
# is always available at http://www.opensource.o... |
#
# Copyright (c) 2004 Specifix, Inc.
#
# This program is distributed under the terms of the Common Public License,
# version 1.0. A copy of this license should have been distributed with this
# source file in a file called LICENSE. If it is not present, the license
# is always available at http://www.opensource.org/li... |
'''
__author__ = Ryan Stephany
__date__ = 11Nov2014
__owner__ = District Data Labs
__purpose__ = SNA Workshop
'''
import re
import sys
import mailbox
from faker import Faker
from numpy.random import randint
from time import strptime, gmtime
from loremipsum import get_sentences, gener... |
# Copyright 2020 Google LLC.
#
# 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 and the following disclaimer.
#
#... |
#!/usr/bin/python
import os,sys,datetime,re
import shlex
import subprocess
from experiments import *
from helper import *
from run_config import *
import glob
now = datetime.datetime.now()
strnow=now.strftime("%Y%m%d-%H%M%S")
os.chdir('..')
PATH=os.getcwd()
result_dir = PATH + "/results/"
test_dir = PATH + "/tests-... |
from random import randint
from math import ceil, log, exp, floor, factorial, sqrt
import cyclo
import polyring
from collections import defaultdict
# http://www.math.dartmouth.edu/~carlp/PDF/complexity12.pdf
def is_prime(n):
if is_power(n):
return False
pairs, primes = find_pairs(n)
D = int(ceil(log(n, 2)**... |
#!/usr/bin/env python
'''Fast Avro file iteration.
Most of the code here is ripped off the Python avro package. It's missing a lot
of features in order to get speed.
'''
import json
from os import SEEK_CUR
from struct import pack, unpack
from zlib import decompress
from cStringIO import StringIO
VERSION = 1
MAGIC = ... |
#!/usr/bin/env python
from __future__ import print_function
import re
import sys
import hashlib
import json
import os
from collections import defaultdict
from contextlib import contextmanager
import subprocess
import time
from threading import Thread
from multiprocessing import cpu_count
from optparse import OptionPars... |
from .fdc import FDC
from . import classify
import numpy as np
import pickle
from scipy.cluster.hierarchy import dendrogram as scipydendro
from scipy.cluster.hierarchy import to_tree
from .hierarchy import compute_linkage_matrix
import copy
from collections import OrderedDict
class TREENODE:
def __init__(self, id... |
import os
import csv
import argparse
from glob import glob
import pycountry
import psycopg2
import git
TEST_LISTS_GIT_URL = 'https://github.com/citizenlab/test-lists/'
CREATE_URL_CATEGORIES_TABLE = """
CREATE SEQUENCE IF NOT EXISTS cat_no_seq;
CREATE TABLE IF NOT EXISTS url_categories
(
cat_no INT NOT NULL defa... |
#
# test_mail-alarm.py: uses unittest to test script "mail-alarm"
#
import tempfile
import os
import shutil
import sys
import unittest
import mock
from nose.tools import nottest
sys.path.append('./scripts/examples/python')
sys.modules['xcp'] = mock.Mock()
log_file_global = None
XML_MESSAGE_TEMPLATE = '''<?xml versi... |
#!/usr/bin/env python
from flexbe_core import EventState, Logger
'''
Created on 09.12.2013
@author: Philipp Schillinger
'''
class LogKeyState(EventState):
'''
A state that can log a predefined message including an input key to precisely inform the operator about what happened to the behavior.
-- text string ... |
from models import Boat, Telemetry, engine
from flask import Flask, jsonify
app = Flask(__name__)
@app.route("/data/v1")
def seabus():
telemetry = {'boats': []}
for boat in Boat.all():
lat = lon = None
if boat.is_seabus:
seabus_telemetry = Telemetry.latest_for_boat(boat)
... |
#!/usr/bin/env python
from __future__ import print_function
from sys import stderr
ACCEPT, REJECT, NEXT, REPEAT = -1, -2, -3, -4
STATE_NAME = {
ACCEPT: "ACCEPT",
REJECT: "REJECT",
NEXT: "NEXT",
REPEAT: "REPEAT",
}
FMTS = {
REPEAT: "REPEAT(line {i}, state {state}: --> (state}: (line})\n",
NEXT... |
# Copyright 2021 The SeqIO 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 wr... |
import ConfigParser
import webob.exc
from common.apiversion import APIVersion
from common.dbconn import DBConnection
from app.dbqueries import DBQueries
class APIv1App(APIVersion):
def __init__(self, config_file):
self.config = config_file
self.dbname = self.config.get('database', 'dbname')
self.dbhost = self.... |
from flask_wtf import FlaskForm
from wtforms import StringField, PasswordField, SubmitField, TextAreaField, BooleanField, HiddenField
from wtforms.validators import InputRequired, Email, EqualTo, Length
class RegisterForm(FlaskForm):
email = StringField('USTC Email', [InputRequired(), Email(), Length(max=63)])
... |
# here goes future multiple backends implementations |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2005 onwards University of Deusto
# All rights reserved.
#
# This software is licensed as described in the file COPYING, which
# you should have received as part of this distribution.
#
# This software consists of contributions made by many individuals,
# list... |
#!/usr/bin/env python
import argparse, tempfile, sys, os, re
from replace_imports import include_imports
from strip_comments import strip_comments
from split_file import split_coq_file_contents
from split_definitions import split_statements_to_definitions, join_definitions
from admit_abstract import transform_abstract_... |
# -*- coding: utf-8 -*-
#
# This file is part of Invenio.
# Copyright (C) 2012, 2013, 2014, 2015, 2016 CERN.
#
# Invenio 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 (a... |
import numpy as np
import matplotlib.pyplot as plt
from astropy import constants as c, units as u, table as t
from astropy.io import fits
import os
from scipy.interpolate import interp1d
from scipy.optimize import minimize
import spec_tools
import ssp_lib
import manga_tools as m
import cov_obs
from itertools import... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.