src stringlengths 721 1.04M |
|---|
import numpy as np
PERIODS = np.array([0.01, 0.07, 0.09, 0.11, 0.14, 0.18, 0.22, 0.27, 0.34, 0.42, 0.53, 0.65, 0.81, 1.01, 1.25, 1.56, 1.92, 2.44, 3.03, 3.7, 4.55, 5.88, 7.14, 9.09])
c1 = [-0.00219, -0.00236, -0.00244, -0.00245, -0.0024, -0.00235, -0.00235, -0.00233, -0.00231, -0.00224, -0.00213, -0.002, -0.00183, -0... |
"""
single_file.py:
A script that runs a UHBD calculation on a single file.
"""
"""
Version notes:
0.4: 060113
0.4.1: 060403
Hokiness fix. Changed from some_path = x + os.sep + y to os.path.join(x,y)
"""
__author__ = "Michael J. Harms"
__date__ = "060403"
__version__ = "0.4.1"
# USER INPUTS
pH_start = 0... |
from mmhandler import MmHandler
import telebot
import argparse
import re
import logging
import yaml
import telebot
import os
bot = telebot.TeleBot('280771706:AAG2jJxVekewCG_aTgcr2WQ3S6CcS7EZ_cg')
from mmhandler import MmHandler
TOKEN = ''
bot = telebot.TeleBot(TOKEN)
handler = MmHandler(0) # по умолчанию user_id =... |
from __future__ import absolute_import
import config
from dns.resolver import Resolver
# DEFAULTS
dns_config = {
'timeout': 15,
'lifetime': 15,
}
# /DEFAULTS
# CONFIG
if "dns" in config.CHECKS:
dns_config.update(config.CHECKS["dns"])
# /CONFIG
def check_dns(check, data):
check.addOutput("ScoreEngine: {} Check\n"... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
]
operations = [
migrations.CreateModel(
name='CrazyObject',
fields=[
('id', models.AutoField(... |
# -*- coding: utf-8 -*-
import urllib
from gluon.custom_import import track_changes; track_changes(True) # for reloading modules
#########################################################################
## This scaffolding model makes your app work on Google App Engine too
## File is released under public domain and ... |
"""empty message
Revision ID: 7ad0da0d1b72
Revises: af193c376724
Create Date: 2017-07-06 17:42:35.513647
"""
# revision identifiers, used by Alembic.
revision = '7ad0da0d1b72'
down_revision = 'af193c376724'
from alembic import op
import sqlalchemy as sa
def upgrade():
# ### commands auto generated by Alembic ... |
"""
Django settings for socializa project.
Generated by 'django-admin startproject' using Django 1.10.1.
For more information on this file, see
https://docs.djangoproject.com/en/1.10/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.10/ref/settings/
"""
import ... |
import sqlite3
from flask import Flask, render_template, g, request, session, flash, redirect, url_for, abort
DATABASE = 'test.db'
USERNAME = 'admin'
PASSWORD = 'admin'
SECRET_KEY = 'he who shall not be named'
app = Flask(__name__)
app.config.from_object(__name__)
@app.route('/')
def welcome():
return '<h1>Welco... |
# Copyright 2108-2019 Sergio Teruel <sergio.teruel@tecnativa.com>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo.addons.stock_barcodes.tests.test_stock_barcodes import\
TestStockBarcodes
class TestStockBarcodesPicking(TestStockBarcodes):
def setUp(self):
super().setUp()
... |
#
# Module for starting a process object using os.fork() or CreateProcess()
#
# multiprocessing/forking.py
#
# Copyright (c) 2006-2008, R Oudkerk
# Licensed to PSF under a Contributor Agreement.
#
from __future__ import absolute_import
import os
import sys
import signal
import warnings
from ._ext import Connection, ... |
"""
This file has been taken from http://pi.minecraft.net/
"""
import socket
import select
import sys
from util import flatten_parameters_to_string
""" @author: Aron Nieminen, Mojang AB"""
class RequestError(Exception):
pass
class Connection:
"""Connection to a Minecraft Pi game"""
RequestFailed = "Fail... |
#!/usr/bin/env python3
# ----------------------------------------------------------------------------------------
# Import Modules
# ----------------------------------------------------------------------------------------
import numpy as np
import setuptools
import sys
platform = setuptools.distutils.util.get_platf... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from ryu.base import app_manager
from ryu.ofproto import ofproto_v1_3
from command_sender import CommandSender
'''
###reduce_t###
--> flow collector
1) call rest_api and parse json
'''
class FlowCollector(app_manager.RyuApp):
'''
only collect access switches
... |
#!/usr/bin/env python
#
# Electrum - lightweight Bitcoin client
# Copyright (C) 2013 ecdsa@github
#
# 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 li... |
# -*- coding: utf-8 -*-
# Generated by Django 1.10 on 2016-08-18 15:27
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
class Migration(migrations.Migration):
initial = True
depend... |
import csv
import numpy as np
import matplotlib.pyplot as plt
def lookahead_moving_average(data, window):
ma = []
for i in range(len(data)):
avg = 0
if i + window > len(data):
window -= 1
for j in range(window):
avg += data[i+j]
ma.append(avg/float(windo... |
from django.db import models
from django.template.defaultfilters import slugify
from model_utils.models import TimeStampedModel
from experiments_manager.models import ChosenExperimentSteps
class ExperimentMeasure(models.Model):
name = models.CharField(max_length=255, editable=False)
description = models.Text... |
import numpy as np
from scipy.spatial.distance import pdist
class Fourier:
def __init__(self, X, k=60000, sigma=None):
self.X = X
self.k = k
self.N = X.shape[0]
self.d = k
if sigma is None:
sample_size = min(self.N, max(1000, int(X.shape[0]/10)))
self... |
#!/usr/bin/env python
import logging
import sys
from os import environ
from time import sleep
import json
from uuid import uuid4
from celery import Celery
import pika
def init_logging():
logger = logging.getLogger('server')
logger.setLevel(logging.INFO)
sh = logging.StreamHandler()
formatter = loggi... |
import struct
import time
import sys
import random
import string
def randString( z ):
s = ''
for i in range(z):
s += random.choice( string.lowercase + string.uppercase + string.digits)
return s
def delfile( dirs ):
### randomly select a directory then pull the file to remove
fl = ''
cnt = 0
while fl == ''... |
from golem.core.deferred import sync_wait
from golem.interface.command import group, Argument, command, CommandResult
@group(name="envs", help="Manage environments")
class Environments(object):
name = Argument('name', help="Environment name")
table_headers = ['name', 'supported', 'active', 'performance',
... |
from __future__ import division
import Tkinter
import preset
from engine2d import Engine2D
from engine3d import Engine3D
from util import *
simulator = None
keymap = {
u'\uf700': 'up',
u'\uf701': 'down',
u'\uf702': 'left',
u'\uf703': 'right',
'z': 'zoom_in',
'x': 'zoom_out',
'w': 'rotate_u... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
MoEDAL and CERN@school - ANN -> ORI.
See the README.md file and the GitHub wiki for more information.
http://cernatschool.web.cern.ch
"""
# Import the code needed to manage files.
import os, glob
#...for parsing the arguments.
import argparse
#...for the logg... |
# 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, software
# distributed under the... |
import numpy as np
from .utils import extract
class Optimizer(object):
def __init__(self, lr = 1e-3, *args, **kwargs):
minimize, kwargs = extract('minimize', True, **kwargs)
self._lr = lr * (2. * np.float64(minimize) - 1.)
self._construct(*args, **kwargs)
def apply(self, var_slot):
... |
from Converter import Converter
from time import localtime, strftime
from Components.Element import cached
class ClockToText(Converter, object):
DEFAULT = 0
WITH_SECONDS = 1
IN_MINUTES = 2
DATE = 3
FORMAT = 4
AS_LENGTH = 5
TIMESTAMP = 6
FULL = 7
SHORT_DATE = 8
LONG_DATE = 9
VFD = 10
FULL_DATE = 11
# add:... |
#!/usr/bin/env python
# Copyright 2017 The Kubernetes 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 appli... |
# -*- 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):
# Adding field 'UserProfile.membership_order_free'
db.add_column(u'bccf_userprofile', 'membership_order_free... |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'modisTrack_about_ui.ui'
#
# Created: Sat Jan 16 05:12:28 2016
# by: PyQt4 UI code generator 4.10.2
#
# WARNING! All changes made in this file will be lost!
from PyQt4 import QtCore, QtGui
try:
_fromUtf8 = QtCore.QString.fromUtf8
e... |
# -*- coding: utf-8 -*-
# $Id$
# -------------------------------------------------------------------
# Copyright 2012 Achim K�hler
#
# This file is part of openADAMS.
#
# openADAMS 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... |
"""
Copyright (c) 2015, NetIDE Consortium (Create-Net (CN), Telefonica Investigacion Y Desarrollo SA (TID), Fujitsu
Technology Solutions GmbH (FTS), Thales Communications & Security SAS (THALES), Fundacion Imdea Networks (IMDEA),
Universitaet Paderborn (UPB), Intel Research & Innovation Ireland Ltd (IRIIL), Fraunhof... |
# Copyright (c) 2017 OpenStack Foundation.
#
# 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 ... |
# -*- coding: utf-8 -*-
import traceback
from pelican import signals
from henet.comments import ArticleThread
from henet.rst.rst2html import rst2html
# xxx read config
storage_dir = '/Users/tarek/Dev/github.com/acr-dijon.org/comments/'
# xxx cache
def add_comments(generator, content):
try:
# the artic... |
#------------------------------------------------------------------------------
# Copyright (c) 2005, Enthought, Inc.
# All rights reserved.
#
# This software is provided without warranty under the terms of the BSD
# license included in enthought/LICENSE.txt and may be redistributed only
# under the conditions describe... |
# -*- coding: utf-8 -*-
###############################################################################################
#
# MediaPortal for Dreambox OS
#
# Coded by MediaPortal Team (c) 2013-2015
#
# This plugin is open source but it is NOT free software.
#
# This plugin may only be distributed to and executed... |
import tempfile
import os
from uuid import uuid4
from prettytable import PrettyTable
from timetabler.util import iter_time, DAY_LIST
class Schedule(object):
def __init__(self, sched):
"""Schedule
e.g. for ``sched``:
((Lab<status='Restricted', section='EECE 381 L2A', term='2', days='[u'T... |
"""Support for binary sensor using I2C MCP23017 chip."""
import logging
from adafruit_mcp230xx.mcp23017 import MCP23017 # pylint: disable=import-error
import board # pylint: disable=import-error
import busio # pylint: disable=import-error
import digitalio # pylint: disable=import-error
import voluptuous as vol
fr... |
""""
usage-
./manage.py builddata load_knowledgebase_csv ~/Documents/Scratch/knowledgebase.csv
Creates derived dataset of constants used by JS frontend. Data is sourced from cla_common.
you can then load the fixture with-
./manage.py loaddata cla_backend/apps/knowledgebase/fixtures/kb_from_spreadsheet.json
"""
from ... |
#!/usr/bin/env python
import sys
import os
import time
import random
import alsaaudio
import pyttsx
from subprocess import call
#
# Our sound coordinator
#
class SoundManager ():
SOUND_PLAYER = 'mpg123'
SOUNDS_DIR = os.path.dirname(__file__) + '/sounds'
SOUND_FILE_EXT = 'mp3'
sound_list = []
... |
from fabric.api import *
import fabric.contrib.project as project
import os
import shutil
import sys
import SocketServer
from pelican.server import ComplexHTTPRequestHandler
# Local path configuration (can be absolute or relative to fabfile)
env.deploy_path = 'output'
DEPLOY_PATH = env.deploy_path
# Remote server co... |
""" interpolate data given on an Nd rectangular grid, uniform or non-uniform.
Purpose: extend the fast N-dimensional interpolator
`scipy.ndimage.map_coordinates` to non-uniform grids, using `np.interp`.
Background: please look at
http://en.wikipedia.org/wiki/Bilinear_interpolation
http://stackoverflow.com/questions/6... |
from typing import List, Tuple
"""
Module for Location & Interval manipulation
"""
def intervals_from_locations(locations: List[float]) -> List[float]:
intervals = []
previous_location = None
for index, location in enumerate(locations):
if index == 0:
intervals.append(location)
... |
# Lint as: python2, python3
# Copyright 2019 Google 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 req... |
# -*- coding: utf-8 -*-
"""
Evaluation Models
=================
"""
from __future__ import division
from copy import copy
from itertools import izip
from collections import defaultdict
import numpy as np
import pandas as pd
import tools
__all__ = (
'DummyPriorModel',
'EloModel',
'EloResponseTime',
... |
# Copyright 2015 - StackStorm, 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 ... |
#!/usr/bin/env python3
"""
Function Library T w/ Redis
Libreria
Funzioni
T
Conterra` funzioni specifiche, ma anche quelle generali,
per ora ho separato quelle della gestione json file e pagine html,
tutte le altre funzioni pensavo di metterle qua.
Appunto: pensavo .. e invece ..
Aggiornamenti: Sat 19 Mar 2016 08:30... |
#!/usr/bin/env python
"""
Receive Geo location data from the Gps2Udp Android application
via UDP/IP and forward them to the stdout line by line.
There is some requirements to a valid incoming packet:
- it must be of form: TIMESTAMP LATITUDE LONGITUDE ACCURACY [other fields];
- TIMESTAMP is a Unix timestamp (seconds s... |
#!/usr/bin/env python
"""
Test parsing of simple date and times using the French locale
Note: requires PyICU
"""
import unittest, time, datetime
import parsedatetime.parsedatetime as pt
import parsedatetime.parsedatetime_consts as ptc
# a special compare function is used to allow us to ignore the seconds as
# ... |
# -*- coding: utf-8 -*-
"""
Presence analyzer unit tests.
"""
import os.path
import json
import datetime
import unittest
from mock import patch
from random import randint
from presence_analyzer import main, views, utils, decorators, helpers
CURRENT_PATH = os.path.dirname(__file__)
TEST_DATA_CSV = os.path.join(
CU... |
import FWCore.ParameterSet.Config as cms
process = cms.Process("myRECO")
process.load("FWCore.MessageService.MessageLogger_cfi")
process.load("Configuration.StandardSequences.Services_cff")
process.load("Configuration.StandardSequences.MagneticField_0T_cff")
process.load("Configuration.StandardSequences.GeometryDB_cf... |
# $HeadURL: $
''' CacheFeederAgent
This agent feeds the Cache tables with the outputs of the cache commands.
'''
from DIRAC import S_OK#, S_ERROR, gConfig
from DIRAC.AccountingSystem.Client.ReportsClient import ReportsClient
from DIRAC.Core.Base.... |
import scrapy
import re
import json
from locations.items import GeojsonPointItem
from locations.hours import OpeningHours
class AuBonPainSpider(scrapy.Spider):
name = "aubonpain"
download_delay = 0.5
allowed_domains = [
"www.aubonpain.com",
]
start_urls = (
'https://www.aubonpain.c... |
# -*- coding: utf-8 -*-
import os
import httplib as http
from flask import request
from flask import send_from_directory
from framework import status
from framework import sentry
from framework.auth import cas
from framework.routing import Rule
from framework.flask import redirect
from framework.routing import WebRen... |
from datetime import datetime
from enum import Enum
from json import dumps
from flask.ext.sqlalchemy import SQLAlchemy
from sqlalchemy_utils import ChoiceType as EnumType
db = SQLAlchemy()
class JudgeStatus(Enum):
PENDING = 0
STARTED = 1
FAILED = 2
FINISHED = 3
class JudgeFeedback(db.Model):
_... |
"""
Module for harvesting data from the
Gatwick Aviation Society (GAS) aircraft database
DO NOT USE
"""
# Imports
import requests
from bs4 import BeautifulSoup
from db.pghandler import Connection
# Constants
GAS_URL = "http://www.gatwickaviationsociety.org.uk/modeslookup.asp"
GAS_FIELDS = {"Registration": "registrat... |
# -*- coding: utf-8 -*-
#------------------------------------------------------------
# tvalacarta - XBMC Plugin
# Canal para TVN (Chile)
# http://blog.tvalacarta.info/plugin-xbmc/tvalacarta/
#------------------------------------------------------------
import urlparse,re
import urllib
from core import logger
from cor... |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
# Copyright (c) 2010 Citrix Systems, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you m... |
"""
A simple program to write an iCal file to create a calendar for the Low Volume Base
Training Plan for trainerroad.com
-Justin Deardorff 2015
"""
import re
import datetime
from datetime import timedelta
#defining iCal pieces for header, footer, and events
header = ["BEGIN:VCALENDAR\n",
"VERSION:2.0\n",
"X-WR-CA... |
# #
# Copyright 2009-2015 Ghent University
#
# This file is part of hanythingondemand
# originally created by the HPC team of Ghent University (http://ugent.be/hpc/en),
# with support of Ghent University (http://ugent.be/hpc),
# the Flemish Supercomputer Centre (VSC) (https://vscentrum.be/nl/en),
# the Hercules foundat... |
def valid(trans,ok):
trans=trans.split()
nin=int(trans[1])
lis_in=[]
for i in range(3,nin*3+1,3):
lis_in.append([trans[i], trans[i+1]])
#ins=trans[1:(nin)*3+1]
nout=int(trans[nin*3+2])
lis_out=[]
for i in range(nin*3+3,nin*3+4+nout,3):
lis_out.append([trans[i], trans[i+1]])
tin=0
tout=0
for i in lis_in:... |
"""Tests using hooks for validation"""
from collections import namedtuple
import pytest
import declxml as xml
from .helpers import strip_xml
_UserTuple = namedtuple('_UserTuple', [
'name',
'age',
])
class _UserClass(object):
def __init__(self, name=None, age=None):
self.name = name
se... |
import os
import re
import string
import logging
import urllib
import zlib
import boto3
import redis
REDIS_SERVER = os.environ['REDIS_SERVER']
REDIS_PORT = os.environ['REDIS_PORT']
REDIS_DB = os.environ['REDIS_DB']
REDIS_KEY = os.environ['REDIS_KEY']
DEST_BUCKET = os.environ['DEST_BUCKET']
DEST_PREFIX = os.environ['... |
# 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... |
"""
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
https://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distr... |
"""
Add modifications to a residue
"""
from ResidueEditor import ResidueEditor
from BaseExchanger import BaseExchanger
from ModificationRemover import ModificationRemover
from moderna.util.Errors import AddModificationError
from moderna.util.LogFile import log
from moderna.Constants import ANY_RESIDUE, MISSING_RESIDUE... |
# coding=utf-8
"""
Collect stats from Apache HTTPD server using mod_status
#### Dependencies
* mod_status
* httplib
* urlparse
"""
import re
import httplib
import urlparse
import diamond.collector
class HttpdCollector(diamond.collector.Collector):
def __init__(self, *args, **kwargs):
super(HttpdC... |
# encoding: utf-8
#
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this file,
# You can obtain one at http://mozilla.org/MPL/2.0/.
#
# Contact: Kyle Lahnakoski (kyle@lahnakoski.com)
#
from __future__ import absolute_import, divis... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
'''
Created on Sep 20, 2015
@author: freestyle4568
'''
"""
this progarm is to test fp-growth algorithm
user guide: result_list, support_data_dict = fptree(dataset, min_support)
该函数返回列表格式的result_list, 元素为列表, [[1元素项集], [2元素项集]]
子列表元素为固定集合 -- frozenset({, , ,})
support_data... |
###############################################################################
#
# recipemodel.py
#
# Provides the class model for a recipe. The class model is passed around in
# the application proper.
#
###############################################################################
import simplejson as json
class ... |
from abc import ABCMeta
from collections import OrderedDict
from collections.abc import Iterable
from copy import deepcopy
from math import sqrt, floor
from numbers import Real, Integral
from xml.etree import ElementTree as ET
import numpy as np
import openmc.checkvalue as cv
import openmc
from openmc.mixin import ID... |
#
# 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... |
#-*- coding: utf-8 -*-
"""
#---------------------------------------------
filename: ex_runTFmatmul.py
- Construct a computational graph which calculate
a matrix multiplication in Tensorflow
- Use tf.constant() in a matrix form
Written by Jaewook Kang
2017 Aug.
#-------------------------------------------... |
# coding: utf-8
# -------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
# ---------------------------------------------------------------------... |
import multiprocessing
import os
import signal
import tempfile
import time
import unittest
import shutil
import razer.client
import razer_daemon.daemon
import razer._fake_driver as fake_driver
import coverage
def run_daemon(daemon_dir, driver_dir):
# TODO console_log false
razer_daemon.daemon.daemonize(fore... |
# coding: utf-8
"""
Gene Feature Enumeration Service
The Gene Feature Enumeration (GFE) Submission service provides an API for converting raw sequence data to GFE. It provides both a RESTful API and a simple user interface for converting raw sequence data to GFE results. Sequences can be submitted one at a ti... |
from pysolar.solar import *
import numpy as np
import matplotlib.pyplot as plt
import datetime
latitude_deg = 45
# month, day, shift because of DST
dates_hour = [(12, 23, 1), (6, 22, 0)]
dates = [(12, 23), (1, 20), (2, 18), (3, 21), (4, 17), (5, 21), (6, 22)]
# dates = []
# for month in range(6):
# for day in ran... |
#!/usr/bin/python
#
# Copyright 2018 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 ag... |
import logging
import unittest
from config_test import build_client_from_configuration
_logger = logging.getLogger(__name__)
class TestNavigation(unittest.TestCase):
def test_all(self):
client = build_client_from_configuration()
for organization in client.v2.organizations:
if organiz... |
#!/usr/bin/python
import time
import os
import sys
import pygame
import numpy
from PIL import Image, ImageDraw, ImageChops
print("")
print("")
print(" USE l=3 to take a photo every 3 somethings, try a 1000 or 2")
print(" t to take triggered photos ")
print(" cap=/home/pi/folder/ to set caps path other than c... |
# -*- coding: UTF-8 -*-
import os,pickle,glob,time,sys
from tools import *
from entity import *
from Word import Word
from Syllable import Syllable
from ipa import ipa
import codecs
class Dictionary: # cf Word, in that Text.py will really instantiate Dictionary_en,Dictionary_fi,usw.
classnames=['Phoneme','Onset','Nu... |
# -*- coding: utf-8 -*-
#
# upass documentation build configuration file, created by
# sphinx-quickstart on Fri Dec 14 21:02:58 2012.
#
# 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 c... |
#!/usr/bin/python
import sys;
def sortedKeys(dict):
keys = dict.keys()
keys.sort()
return keys
if __name__ == '__main__':
i = 0
width = 1200
height = 600
reader = open(sys.argv[1], "r")
jsname = '%s.js' % sys.argv[1]
jswriter = open(jsname, "w")
htmlwriter = open(sys.argv[1] + '.html', "w")
charts = ... |
import sys
import urllib
import urlparse
import xbmcgui
import xbmcplugin
import xbmcaddon
import xbmc
import requests
from bs4 import BeautifulSoup
from lib import CMDTools
base_url = sys.argv[0]
web_name="NGAMVN.COM"
web_url = "http://www.ngamvn.com/"
def get_Web_Name():
return web_name
def get_img_thumb_url():... |
def encrypt(text, key, alphabet):
al_len = len(alphabet)
key_len = len(key)
table = []
result = ""
for i in range(al_len):
table.append(alphabet[i:] + alphabet[:i])
for i,char in enumerate(text):
if char.lower() in alphabet:
lower = False
if char.lower() == char:
lower = True
char = char.lower(... |
# The contents of this file are subject to the BitTorrent Open Source License
# Version 1.1 (the License). You may not copy or use this file, in either
# source code or executable form, except in compliance with the License. You
# may obtain a copy of the License at http://www.bittorrent.com/license/.
#
# Software di... |
# Generated by Django 2.0.7 on 2018-08-01 12:00
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
import picker.models
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('pic... |
import typing
import pytest
import abjad
values: typing.List[typing.Tuple] = []
values.extend((x / 2, (x / 2) % 12) for x in range(-48, 49))
values.extend(
[
("bf,", 10),
("c'", 0),
("cs'", 1),
("gff''", 5),
("", 0),
("dss,,", 4),
("fake", ValueError),
... |
# Copyright (C) 2012 Red Hat, Inc. All rights reserved.
#
# 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 by the Free Software Foundation; either
# version 2.1 of the License, or (at your option) any later version.
#
# ... |
"""Run the neurodocker examples and check for failures."""
import glob
import os
import subprocess
here = os.path.dirname(os.path.realpath(__file__))
def test_examples_readme():
with open(os.path.join(here, "README.md")) as f:
readme = f.read()
readme = readme.replace("\\\n", " ")
cmds = []
... |
#! /usr/bin/env python
#
# Ben Osment
# Mon Nov 11 06:39:55 2013
"""Unit tests for scrabble.py"""
import unittest
import sys
import os
current_dir = os.getcwd()
src_dir = os.path.join(current_dir, 'scrabble')
tests_dir = os.path.join(current_dir, 'tests')
# add the source directory to the load path
sys.path.append(... |
# Copyright 2017 The 'Scalable Private Learning with PATE' 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
#
# ... |
# Copyright 2015 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... |
# coding: utf-8
import re
import unicodedata
from urllib import quote_plus
class NestedDict(dict):
def __getitem__(self, key):
if key in self:
return self.get(key)
return self.setdefault(key, NestedDict())
def convert_to_underscore(name):
s1 = re.sub('(.)([A-Z][a-z]+)', r'\1_\2',... |
# Implementation of RAKE - Rapid Automtic Keyword Exraction algorithm
# as described in:
# Rose, S., D. Engel, N. Cramer, and W. Cowley (2010).
# Automatic keyword extraction from indi-vidual documents.
# In M. W. Berry and J. Kogan (Eds.), Text Mining: Applications and Theory.unknown: John Wiley and Sons, Ltd.
import... |
import base
import crypto
import echocmd
import string
import struct
import time
import re
import os
import sys
from socket import *
import rawtcp
import types
class SIDECMD(echocmd.ECHOCMD):
def __init__(self):
echocmd.ECHOCMD.__init__(self)
def TypeConvert(self, stype):
#print "In Ty... |
"""
Copyright (c) 2015 Red Hat, Inc
All rights reserved.
This software may be modified and distributed under the terms
of the BSD license. See the LICENSE file for details.
Exceptions raised by OSBS
"""
from traceback import format_tb
class OsbsException(Exception):
def __init__(self, message=None, cause=None... |
from firedrake import *
from firedrake.utils import cached_property
from abc import ABCMeta, abstractproperty
class Problem(object):
__metaclass__ = ABCMeta
def __init__(self, N=None, degree=None, dimension=None,
quadrilaterals=False):
super(Problem, self).__init__()
self.... |
# -*- coding: utf-8 -*-
from widgetastic.utils import VersionPick, Version
from widgetastic.widget import View, Text, ConditionalSwitchableView
from widgetastic_manageiq import PaginationPane
from widgetastic_patternfly import Dropdown, BootstrapSelect, FlashMessages
from cfme.base.login import BaseLoggedInPage
from w... |
import signal
import sys
from subprocess import Popen
import pytest
@pytest.mark.parametrize('exit_status', [0, 1, 2, 32, 64, 127, 254, 255])
@pytest.mark.usefixtures('both_debug_modes', 'both_setsid_modes')
def test_exit_status_regular_exit(exit_status):
"""dumb-init should exit with the same exit status as the... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.