src stringlengths 721 1.04M |
|---|
from django.template.loader import render_to_string
from .api import ChatworkApiClient
client = ChatworkApiClient()
api_account_info = client.get_my_profile()
api_account_id = getattr(api_account_info, 'account_id', '0')
api_room_id = getattr(api_account_info, 'room_id', '0')
def get_rooms(room_type='group'):
... |
import numpy as np
from scipy.cluster.hierarchy import linkage, fcluster
from scipy.spatial.distance import pdist, squareform
import scipy.linalg as Linalg
from scipy.stats import multivariate_normal as mvn
class Cluster(object):
def __init__(self, X):
"""Return a new object to cluster data based on sele... |
# Copyright (C) 2011 One Laptop Per Child
#
# 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 distribu... |
import os
import argparse
import glob
import traceback
import mysql
import dataquality as dq
def upload_throughput(sdb, infile, force=False):
"""Upload throughput measurements to the Science Database
Parameters
----------
sdb: ~mysql.sdb
Connection to the Science Database
infile: str
... |
import os
import math
import time
import warnings
import numpy as np
from util import FileName
from util import ObsFile
from util import TCS
from interval import interval
import pyfits
import matplotlib.pyplot as plt
import pickle
from headers.DisplayStackHeaders import writeImageStack, readImageStack
class ObsFileS... |
import sys
import re
from .. utils import common as uc
def print_line(sample, region, location, type_var, removed,
added, abnormal, normal, ratio, min_cov, min_exclu,
variant, target, info, var_seq, ref_seq):
line = "\t".join([sample, region, location, type_var, removed,
... |
"""User models."""
import django
from django.contrib.auth.models import (
AbstractBaseUser, BaseUserManager, PermissionsMixin)
from django.core.mail import send_mail
from django.db import models
from django.utils import timezone
from django.utils.translation import ugettext_lazy as _
class EmailUserManager(BaseUs... |
#!/usr/bin/env python
"""disutils setup/install script for xvfbwrapper"""
import os
from distutils.core import setup
this_dir = os.path.abspath(os.path.dirname(__file__))
with open(os.path.join(this_dir, 'README.rst')) as f:
LONG_DESCRIPTION = '\n' + f.read()
setup(
name='xvfbwrapper',
version='0.2.... |
import datetime
from bokeh.charts import Area, output_file, show
from bokeh.models.formatters import DatetimeTickFormatter
from bokeh.models.widgets import Panel, Tabs
def unix_time_ms(dt):
"""
Converts datetime to timestamp float (milliseconds) for plotting
:param dt: datetime
:return: timestamp flo... |
"""Config flow for Plaato."""
import logging
from pyplaato.plaato import PlaatoDeviceType
import voluptuous as vol
from homeassistant import config_entries
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import CONF_SCAN_INTERVAL, CONF_TOKEN, CONF_WEBHOOK_ID
from homeassistant.core impor... |
from __future__ import division
from flask import Flask, request, session, redirect, url_for, \
render_template, jsonify, abort
from collections import defaultdict
import math
import os
import sys
import importlib
import traceback
import time
import datetime
import re
import json
from functools import wraps
import ... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# ----------------------------------------------------------------
# cssqc/singleLinePerProperty.py
#
# Do not allow property on multiple lines.
# ----------------------------------------------------------------
# copyright (c) 2014 - Domen Ipavec
# Distributed under The ... |
from osim.env import ProstheticsEnv, rect
import numpy as np
import unittest
import math
class SimulationTest(unittest.TestCase):
def test_reset(self):
env = ProstheticsEnv(visualize=False, difficulty=0)
o = env.reset()
self.assertEqual(type(o), list)
o = env.reset(project = False)
... |
import os
import glob
import shutil
import datetime
import numpy as np
import pandas as pd
# Dataset
PROJECT_NAME = "TalkingData AdTracking Fraud Detection"
PROJECT_FOLDER_PATH = os.path.join(os.path.expanduser("~"), "Documents/Dataset",
PROJECT_NAME)
# Submission
TEAM_NAME = "Auror... |
#/*
# *
# * TuneIn Radio for Kodi.
# *
# * Copyright (C) 2015 Brian Hornsby
# *
# * 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... |
#!/usr/bin/env python
##############################################################################
##
## This file is part of Sardana
##
## http://www.sardana-controls.org/
##
## Copyright 2011 CELLS / ALBA Synchrotron, Bellaterra, Spain
##
## Sardana is free software: you can redistribute it and/or modify
## it un... |
# -*- coding: utf-8 -*-
###############################################################################
#
# ODOO (ex OpenERP)
# Open Source Management Solution
# Copyright (C) 2001-2015 Micronaet S.r.l. (<http://www.micronaet.it>)
# Developer: Nicola Riolini @thebrush (<https://it.linkedin.com/in/thebrush>)
# This prog... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright 2011 University of Oslo, Norway
#
# This file is part of Cerebrum.
#
# Cerebrum 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 th... |
# -*- coding: utf-8 -*-
from django.core.files.base import ContentFile
import os
from photologue.models import Photo, PhotoSizeCache
from photologue.tests.helpers import PhotologueBaseTest, SQUARE_IMAGE_PATH, PORTRAIT_IMAGE_PATH
class ImageResizeTest(PhotologueBaseTest):
def setUp(self):
super(ImageResizeT... |
""" Independent Component Analysis variants """
import os
import cPickle
from copy import deepcopy
import numpy
try:
import mdp
from mdp.nodes import FastICANode
except:
pass
from pySPACE.missions.nodes.spatial_filtering.spatial_filtering import SpatialFilteringNode
from pySPACE.resources.data_types.time... |
#!/usr/bin/env python
###############################################################################
# $Id: ndf.py 32163 2015-12-13 17:44:50Z goatbar $
#
# Project: GDAL/OGR Test Suite
# Purpose: Test NLAPS/NDF driver.
# Author: Frank Warmerdam <warmerdam@pobox.com>
#
##############################################... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
from math import sin
# Replaces data[1..2*nn] by its discrete Fourier transform, if isign */
# is input as 1; or replaces data[1..2*nn] by nn times its inverse */
# discrete Fourier transform, if isign is input as -1. data is a */
# complex array of length nn or, equ... |
__author__ = 'Kristy'
#methods for em clustering on a clustercontainer object
import LanguageModel
from collections import deque
from collections import defaultdict
import numpy as np
'''Classes that handle building topic-based language models from documents using Expectation Maximisation.
ThetaParams hold... |
import re
import sys
import traceback
class ReportBuilder(object):
def __init__(self, message_limit=None):
self.messages = []
self.assignments = []
self.message_count = 0
self.message_limit = message_limit
self.stack_block = None # (first_line, last_line) numbers, not inde... |
from django.conf.urls import patterns
from django.http import HttpResponse
from django.test import TestCase
from rest_framework import status
from rest_framework.authentication import OAuth2Authentication
from rest_framework.views import APIView
from legalaid.tests.views.test_base import CLAOperatorAuthBaseApiTestMixi... |
"""
Author: RedFantom
License: GNU GPLv3
Source: This repository
"""
# Based on an idea by Nelson Brochado (https://www.github.com/nbrol/tkinter-kit)
import tkinter as tk
from tkinter import ttk
import webbrowser
class LinkLabel(ttk.Label):
"""
A :class:`ttk.Label` that can be clicked to open a link with a de... |
import roller
import random
DEFAULT_CARD_AMOUNT = 1
MAX_CARDS = 15
CARD_SEPARATOR = "||"
def ping_exec(irc, message):
pong = 'PONG ' + message.text.split(" ")[1] + '\r\n'
irc.send(pong.encode("utf-8"))
def roll_exec(irc, message):
'''
A !roll comand has the following structure:
!rol... |
# Project: MXCuBE
# https://github.com/mxcube
#
# This file is part of MXCuBE software.
#
# MXCuBE 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 3 of the License, or
# (at your o... |
# -*- coding: utf-8 -*-
"""
Default Controllers
"""
module = "default"
# -----------------------------------------------------------------------------
def call():
"Call an XMLRPC, JSONRPC or RSS service"
# If webservices don't use sessions, avoid cluttering up the storage
#session.forget()
return... |
from . import trelloobject
class Organisation(trelloobject.TrelloObject):
def __init__(self, trello_client, organisation_id, name='', **kwargs):
super(Organisation, self).__init__(trello_client, **kwargs)
self.id = organisation_id
self.name = name
self.base_uri = '/organizations... |
# -*- coding: utf-8 -*-
#
# Packer documentation build configuration file, created by
# sphinx-quickstart on Tue Jul 30 02:22:45 2013.
#
# 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 ... |
from django.shortcuts import render_to_response
from django.template.context import RequestContext
from django.core.paginator import Paginator
from django.http import Http404, HttpResponseServerError
from haystack.query import SearchQuerySet
from django.conf import settings
import datetime, time
RESULTS_PER_PAGE = get... |
# -*- encoding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2012 Slobodni programi d.o.o. (<http://www.slobodni-programi.com>).
# $Id$
#
# This program is free software: you can redistribute it and/or m... |
# Copyright (C) 2014 Jian-Ming Tang <jmtang@mailaps.org>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later versio... |
# coding=utf-8
# Copyright 2021 The Google Research 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 applicab... |
# Copyright (c) 2016, MapR Technologies
# 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 re... |
# -*- 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... |
# Copyright 2013 New Dream Network, LLC (DreamHost)
#
# 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 a... |
#!/usr/bin/env python
#
# sproxy.py
# Copyright (C) 2014 by A.D. <adotddot1123@gmail.com>
#
# 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 the hope ... |
#!/usr/bin/env python3
from urllib.request import urlopen
from subprocess import call
import os
import re
import sys
import json
import shutil
import urllib
import sqlite3
import zipfile
import string
# path definitions
REF_PATH = "ref"
JSON_PATH = "json"
# filenames definitions
DOC_ZIP = "refdoc.zip"
DB_FILE = "doc... |
# -*- coding: utf-8 -*-
# (c) 2017 Tuomas Airaksinen
#
# This file is part of Serviceform.
#
# Serviceform 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)... |
from django.contrib.auth.models import Group, User
from rest_framework import serializers
from rest_hooks.models import Hook
from .models import Identity, OptIn, OptOut
class UserSerializer(serializers.ModelSerializer):
class Meta:
model = User
fields = ("url", "username", "email", "groups")
cl... |
import sys
sys.path.append("GUI/")
import epistasisviewer as viewer
import gridepistasis as epistasisControl
import wx
#import time
import os
sys.path.append("RfilesAndscripts/")
import readdata
from threading import Thread
import Configuration.epistasisconfiguration as config
exec_state = "executing"
pending_state... |
# -*- coding: utf-8 -*-
import datetime
import importlib
import inspect
import sys
import os
import django
year = datetime.datetime.now().strftime("%Y")
sys.path.append(os.path.join(os.path.dirname(os.path.abspath(__file__)), os.pardir))
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "tests.testapp.settings")
dja... |
#Use the included script run.sh to execute gpg_package_handler - execute run using ./run.sh
#the options available to run.sh are shown below
# debugFlag - If value is 1 print error/descriptive messages.
# pathToScript - The path leading to the folder containing this script.
# (Used if run.sh is launched outs... |
# -* - coding: UTF-8 -* -
## Virtual Machine 2.3.1
## 小步语义 -- 表达式
## python 3.4
class Number(object):
""" 数值符号类
"""
def __init__(self, value):
self.value = value
def reducible(self):
return False
def to_s(self):
return str(self.value)
class Boolean(object):
""" 布尔值符号... |
from mittab.apps.tab.forms import RoomForm
from mittab.libs.data_import import Workbook, WorkbookImporter, InvalidWorkbookException
def import_rooms(file_to_import):
try:
workbook = Workbook(file_to_import, 2)
except InvalidWorkbookException:
return ["Rooms file is not a valid .xslx file"]
... |
#!/usr/bin/env python
"""
Sentry
======
Sentry is a realtime event logging and aggregation platform. It specializes
in monitoring errors and extracting all the information needed to do a proper
post-mortem without any of the hassle of the standard user feedback loop.
Sentry is a Server
------------------
The Sentry ... |
"""Implementation of HyperLogLog
This implements the HyperLogLog algorithm for cardinality estimation, found
in
Philippe Flajolet, Éric Fusy, Olivier Gandouet and Frédéric Meunier.
"HyperLogLog: the analysis of a near-optimal cardinality estimation
algorithm". 2007 Conference on Analysis of Algori... |
import numpy as n
from .afg import AFG_channel, Arb
def sync(length, amp=16382):
s = n.zeros((length,), dtype=n.uint16)
s[1::2] = 1
return s * amp
def zigzagify(A):
"""reshape a 2d array to have alternate rows going backward"""
A[1::2] = A[1::2][:,::-1]
def pairify(a):
""" return an array th... |
# -*- Mode: Python -*-
# vi:si:et:sw=4:sts=4:ts=4
#
# Flumotion - a streaming media server
# Copyright (C) 2004,2005,2006,2007 Fluendo, S.L. (www.fluendo.com).
# All rights reserved.
# This file may be distributed and/or modified under the terms of
# the GNU General Public License version 2 as published by
# the Free ... |
#* This file is part of the MOOSE framework
#* https://www.mooseframework.org
#*
#* All rights reserved, see COPYRIGHT for full restrictions
#* https://github.com/idaholab/moose/blob/master/COPYRIGHT
#*
#* Licensed under LGPL 2.1, please see LICENSE for details
#* https://www.gnu.org/licenses/lgpl-2.1.html
from .sched... |
# -*- coding: utf-8 -*-
from mock import patch
from tests import TestCase
from yarn_api_client.history_server import HistoryServer
from yarn_api_client.errors import IllegalArgumentError
@patch('yarn_api_client.history_server.HistoryServer.request')
class HistoryServerTestCase(TestCase):
def setUp(self):
... |
#!/usr/bin/env python
# -*- coding=utf-8 -*-
## Amazon S3cmd - testsuite
## Author: Michal Ludvig <michal@logix.cz>
## http://www.logix.cz/michal
## License: GPL Version 2
import sys
import os
import re
from subprocess import Popen, PIPE, STDOUT
import locale
import pwd
count_pass = 0
count_fail = 0
count_sk... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# -----------------------------------------------------------------------------
#
# FreeType high-level python API - Copyright 2011 Nicolas P. Rougier
# Distributed under the terms of the new BSD license.
#
# ---------------------------------------------------------------... |
# coding: utf-8
import re
from datetime import datetime
from pyquery import PyQuery
from mosecom_air.api.parser import Substance, Measurement, Result
SUBSTANCE_RE = re.compile(r'^(?P<name>[^\s_]*)(?:\s*\((?P<alias>.*?)\))?')
STATION_ALIAS_RE = re.compile(ur'«(?P<alias>[^»]*)»')
FULL_DATETIME_FORMAT = '%d.%m.%Y %H:%... |
import unittest
import tensorflow as tf
import numpy as np
from kerastuner.tuners import RandomSearch
class TestKerasTuner(unittest.TestCase):
def test_search(self):
def build_model(hp):
x_train = np.random.random((100, 28, 28))
y_train = np.random.randint(10, size=(100, 1))
... |
#!/usr/bin/python
# Copyright 2020 Makani Technologies 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 applicabl... |
# -*- coding: utf-8 -*-
#
# 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
... |
core_store_students_programs = False
core_store_students_programs_path = 'files_stored'
core_experiment_poll_time = 350 # seconds
# Ports
core_facade_soap_port = 20123
core_facade_xmlrpc_port = 29345
core_facade_json_port = 28345
admin_facade_json_port = 28545
core_web_facade_port = 29745
core_... |
# -*- coding: utf-8 -*-
"""QGIS Unit test utils for provider tests.
.. note:: 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.
"... |
import codecs
import gzip
import json
import storage
class File(storage.Storage):
DEFAULTCONF = {
'ENABLED': True,
'path': 'report.json',
'gzip': False,
'files-per-line': 1
}
def setup(self):
if self.config['gzip'] is True:
self.file_handle = gzip.open... |
#
#
# All Rights Reserved.
# Copyright 2011 OpenStack Foundation.
# 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... |
""" Example file submission script
Requires the `aws` command line utility: http://aws.amazon.com/cli/
"""
import hashlib
import json
import os
import requests
import subprocess
import sys
import time
host = 'REPLACEME'
encoded_access_key = 'UISQC32B'
encoded_secret_access_key = 'ikc2wbs27minvwo4'
path = 'test.bam'
... |
# Licensed to Elasticsearch B.V. under one or more contributor
# license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright
# ownership. Elasticsearch B.V. licenses this file to you under
# the Apache License, Version 2.0 (the "License"); you may
# not use ... |
#!/usr/bin/python
import sys
import fnmatch
import os
import shutil
import argparse
from argparse import RawTextHelpFormatter
import time
import math
import matplotlib
# Force matplotlib to not use any Xwindows backend.
matplotlib.use('Agg')
import pylab as pl
from matplotlib.ticker import MultipleLocator, FormatStrFo... |
# Mantid Repository : https://github.com/mantidproject/mantid
#
# Copyright © 2018 ISIS Rutherford Appleton Laboratory UKRI,
# NScD Oak Ridge National Laboratory, European Spallation Source
# & Institut Laue - Langevin
# SPDX - License - Identifier: GPL - 3.0 +
"""
Unit test for Vesuvio reduction
Assumes ... |
from calculate import calculate
def test_basic_operators():
assert calculate('5+5') == 10
assert calculate('5*5') == 25
assert calculate('10/2') == 5
assert calculate('10-4') == 6
assert calculate('10%4') == 2
assert calculate('6/3') == 2
assert calculate('5-10') == -5
assert calcula... |
import numpy as np
# sigmoid function
def nonlin(x,deriv=False):
if(deriv==True):
return x*(1-x)
return 1/(1+np.exp(-x))
def displayPred(num):
if(num> 0.5 and num <0.75):
return " - Draw"
elif(num>0.75):
return " - Win"
else:
return " - Loss"
# for training data we... |
import sys
from SettingsAnalyzer import SettingsAnalyzer
#import statprof
PARAM_FILENAME = "-filename"
PARAM_OUTPUT_FILENAME = '-output_filename'
PARAM_SETTINGS_FILENAME = '-settings_filename'
class Main:
filename = ""
settings_filename = ""
output_filename = ""
def __init__(self, filename, setting... |
from constants import MAX_LIMIT
from version import __version__, version_info
import requests
from cStringIO import StringIO
import csv
import json
__author__ = "Cristina Munoz <hi@xmunoz.com>"
class Socrata(object):
def __init__(self, domain, app_token, username=None, password=None,
access_tok... |
from unittest import mock
from django.conf import settings
from django.utils import timezone
import pytest
from p3.models import TicketConference
from p3.models import P3Profile
from tests.factories import (
ConferenceFactory,
TicketFactory,
FareFactory,
TicketConferenceFactory
)
pytestmark = pytest... |
import pickle, socket, time, threading
class ServerHandler:
def __init__(self,host,port):
self.activePlayers = []
self.serverSocket = socket.socket(socket.AF_INET, socket.SOCK_STREAM) # Starting arguments for the socket are general default which i took
self.serverSocket.setsockopt(socket.SOL... |
"""SCons.Platform.irix
Platform-specific initialization for SGI IRIX systems.
There normally shouldn't be any need to import this module directly. It
will usually be imported through the generic SCons.Platform.Platform()
selection method.
"""
#
# Copyright (c) 2001, 2002, 2003, 2004 The SCons Foundation
#
# Permiss... |
import astropy.io.fits as fits
import astropy.units as u
import numpy as np
import scipy.interpolate as interpolate
from gbmgeometry.utils.gbm_time import GBMTime
class PositionInterpolator(object):
def __init__(self, poshist=None, T0=None, trigdat=None):
# Use position history file
"""
... |
# This is an example for demonstrating use of the GtkTreeView widget.
# The code in this example is not particularly good: it is written to
# concentrate on widget usage demonstration, not for maintainability.
import pygtk
pygtk.require("2.0")
import gtk
import gobject
view = None
choose_parent_view = None
dialog = N... |
#!/bin/env python
"""
The MIT License
Copyright (c) 2010 The Chicago Tribune & Contributors
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 ... |
# encoding:utf-8
#
# Gramps - a GTK+/GNOME based genealogy program
#
# Copyright (C) 2009 Benny Malengier
#
# 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
# ... |
#! /bin/env python
"""
PyAutorunalizer 0.1
Python script for autorunalize: http://sysinternals.com/autoruns.com listing autoruns Windows
items. Version 11.6 or greater needed.
http://Virutotal.com externa database of viruses.
original idea: http://trustedsignal.blogspot.com.es/2012/02/finding-evil-automating-aut... |
import copy
import random
import string
import pytest
from cosmo_tester.test_suites.cluster.conftest import run_cluster_bootstrap
from cosmo_tester.framework.examples import get_example_deployment
from .cluster_status_shared import (
_assert_cluster_status,
_verify_status_when_postgres_inactive,
_verify_s... |
from PyQt4 import QtCore, QtGui
from ..util import log, metrix, ui
class Widget(ui.Widget):
def setup(self):
frmServerSelection = QtGui.QGroupBox("Server Selection", self)
layoutServerSelection = QtGui.QHBoxLayout(frmServerSelection)
lblServer = QtGui.QLabel("&Server / Host name:", frmServerSelection)
... |
"""
Command-line interface to the fantail site generator.
setuptools will create a console script pointing to cli:main
"""
import argparse
import logging
from fantail.staticsite import StaticSite
def cmd_init_site(args):
"""
Creates a new site with default templates.
"""
site = StaticSite(args.site_d... |
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: helloworld.proto
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from google.protobuf import reflection as _reflection
from google.protobuf import symbol_database as _symbol_database
from google.p... |
#!/usr/bin/env python
"""
Sentry
======
Sentry is a realtime event logging and aggregation platform. It specializes
in monitoring errors and extracting all the information needed to do a proper
post-mortem without any of the hassle of the standard user feedback loop.
Sentry is a Server
------------------
The Sentry ... |
#!/usr/bin/env python
import optparse
import os
import socket
import select
import MySQLdb
import sys
import time
import simplejson
import SocketServer
db_info={'db_name':'deploy',
'host':'10.117.74.247',
'user':'root',
'password':'helloworld',
}
class MainMaster(object):
def __init__(self):
global db_info
s... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""Tests for the serializer object implementation using JSON."""
from __future__ import unicode_literals
import collections
import json
import time
import unittest
import uuid
from dfvfs.lib import definitions as dfvfs_definitions
from dfvfs.path import fake_path_spec
f... |
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: protobufs/Libsodium.proto
import sys
_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from google.protobuf import reflecti... |
# -*- coding: utf-8 -*-
# Copyright 2010-2012 Kolab Systems AG (http://www.kolabsys.com)
#
# Jeroen van Meeuwen (Kolab Systems) <vanmeeuwen a kolabsys.com>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software ... |
from csv import DictReader
import csv
from sys import argv, exit
# from negotiator import Negotiator
# from door_in_face_negotiator import DoorInFaceNegotiator
# from greedy_negotiator import GreedyNegotiator
# from door_in_face_dummy import DIFDummyNegotiator
# from negotiator_a import Negotiator_A
from random import ... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# AppleII (Colour) Image Filter - Apple II plugin for The GIMP.
# Copyright (C) 2008, 2010 Paulo Silva <nitrofurano@gmail.com>
# Copyright (C) 2008 Daniel Carvalho
# Copyright (C) 2010 Dave Jeffery <kecskebak.blog@gmail.com>
#
# This program is free software: ... |
"""
Unit tests for courseware context_processor
"""
from django.contrib.auth.models import AnonymousUser
from mock import Mock
from lms.djangoapps.courseware.context_processor import user_timezone_locale_prefs
from openedx.core.djangoapps.user_api.preferences.api import set_user_preference
from common.djangoapps.stu... |
# Copyright (c) 2014-present PlatformIO <contact@platformio.org>
#
# 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... |
"""CNN for image processing."""
from typing import cast, Callable, Dict, List, Tuple, Union
from typeguard import check_argument_types
import numpy as np
import tensorflow as tf
from neuralmonkey.dataset import Dataset
from neuralmonkey.decorators import tensor
from neuralmonkey.model.feedable import FeedDict
from n... |
# -*- encoding:utf8 -*-
# patched for python 3.5
import os
import json
import memcache
import requests
import logging
import base64
from hashlib import md5
logging.basicConfig(format='%(levelname)-8s [%(asctime)s] %(message)s', level=logging.DEBUG)
def send_email(rest_api_id, rest_api_secret, email):
print("Se... |
from unittest import TestCase
from stat_calculator import StatCalculator
class TestStatCalculator(TestCase):
def setUp(self):
self.calculator = StatCalculator()
def test_calc(self):
self.assertEqual(1, 1)
def test_minimum(self):
self.assertEqual( self.calculator.calc([6, 9, 15,... |
from django import template
from django.core import urlresolvers
from django.utils.translation import ugettext_lazy as _
from wagtail.wagtailadmin import hooks
from wagtail.wagtailadmin.menu import MenuItem
from wagtail.wagtailcore.models import get_navigation_menu_items, UserPagePermissionsProxy
from wagtail.wagtail... |
import tensorflow as tf
import numpy as np
"""
Some utility functions for dealing with span prediction in tensorflow
"""
def best_span_from_bounds(start_logits, end_logits, bound=None):
"""
Brute force approach to finding the best span from start/end logits in tensorflow, still usually
faster then the p... |
from __future__ import division, print_function, absolute_import
import numpy as np
from numpy.testing import assert_allclose
from pytest import raises as assert_raises
from scipy.stats import (binned_statistic, binned_statistic_2d,
binned_statistic_dd)
from scipy._lib.six import u
from .comm... |
""" Script for GLM functions.
Run with:
python glm_script.py
"""
# Loading modules.
from __future__ import absolute_import, division, print_function
import numpy as np
import matplotlib.pyplot as plt
import nibabel as nib
import os
import sys
# Relative paths to subject 1 data.
project_path = "../../..... |
""" Define the data models for the KidsTasks app """
import datetime
from django.db import models
class Kid(models.Model):
""" Defines the kids which have to do the tasks. """
name = models.CharField(max_length=256)
last_update_date = models.DateField(default=datetime.datetime.today)
days = [
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.