src stringlengths 721 1.04M |
|---|
"""
Created on Feb 27, 2018
@author: nhan.nguyen
This module contains class "TesterSimulateTraffic" that simulates the real time
traffic.
"""
import threading
import random
import time
import utils
import os
import asyncio
import argparse
import requests_sender
import requests_builder
import perf_add_requests
from ... |
#!/usr/bin/env python
# Copyright (c) 2016 Satya Mallick <spmallick@learnopencv.com>
# All rights reserved. No warranty, explicit or implicit, provided.
import cv2
import numpy as np
import math
import random
R = np.matrix([[0.6927,-0.7146,0.0978],[0.7165,0.6973,0.0198],[-0.0824,0.0564,0.995]])
# Checks if a matrix ... |
#!/usr/bin/env python3
import logging
import plotly.express as px
from pybmrb.get_database_cs_data import ChemicalShiftStatistics
class Histogram(object):
'''
Fetches chemical shift records from BMRB, plots histograms and calculates statistical properties.
'''
@classmethod
def hist(self, residue... |
# Copyright 2018 Eficent Business and IT Consulting Services S.L.
# (http://www.eficent.com)
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
from odoo import api, fields, models, _
from collections import defaultdict
from datetime import datetime, timedelta
from odoo.tools.misc import DEFAULT_S... |
"""
Django settings for encuesta 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 o... |
"""
Tools for controlling and interacting with Windows processes.
"""
import time
import pywintypes
import win32api
import win32com.client
import win32con
from .utility import only
from .exceptions import TooFewItemsError, verify_type, verify_callable
__author__ = 'Aaron Hosford'
__all__ = [
"process_exists... |
"""Helper functions for interatcing with Magenta DDSP internals.
"""
import json
import os
from absl import logging
from ddsp.training import train_util
import tensorflow.compat.v2 as tf
from google.cloud import storage
def get_strategy(tpu='', gpus=None):
"""Chooses a distribution strategy.
AI Platform auto... |
# -*- 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... |
#coding=utf8
from qt_ui.ui_position_editor import Ui_position_editor_dialog
from gui_impl.qt_mvc_impl import MatrixModel, AutoFormDelegate
from gui_impl.qtableview_utility import getSelectedRows
from utility.data_handler import TableHandler
from PyQt4.QtCore import *
from PyQt4.QtGui import *
########################... |
# 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.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes ... |
# Licensed under the GPLv3 - see LICENSE
"""
Definitions for VLBI Mark 5B frames.
Implements a Mark5BFrame class that can be used to hold a header and a
payload, providing access to the values encoded in both.
For the specification, see
http://www.haystack.edu/tech/vlbi/mark5/docs/Mark%205B%20users%20manual.pdf
"""
i... |
import grokcore.component
import z3c.traverser.interfaces
import zeit.cms.workingcopy.interfaces
import zope.app.container.btree
import zope.app.security.interfaces
import zope.component
import zope.dublincore.interfaces
import zope.interface
import zope.publisher.interfaces
import zope.security.interfaces
import zope.... |
import os
import requests
import urania.connection
def get_devices(users=None):
users = users if users is not None else urania.config.all_users()
return [urania.connection.get_registered_devices(user) for user in users]
def download_track(user, track, path):
url = urania.connection.get_stream_url(user, tr... |
from django.contrib.sites.models import Site
from django.contrib.sites.models import RequestSite
from user_registration.models import UserRegistration
class DefaultRegistrationBackend(object):
"""
Backend defines how the registration and activation processes are defined
@register: What to do after valid ... |
import wx
import paramiko
import os
import posixpath
import platform
import logging
import datetime
# We mirror the paramiko exception up to the UI so it doesn't have to know anything about paramiko
class AuthenticationException(Exception):
pass
def mkdir(ftp, path, mode=511, ignore_existing=F... |
from selenium import selenium
import unittest, time, re, urllib2
from post import *
import os
import sys
import time
class testingPost(unittest.TestCase):
def setUp(self):
self.verificationErrors = []
self.selenium = selenium("localhost", 4444, "*firefox", server)
self.selenium.start()
... |
# -*- coding: utf-8 -*-
#
# 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
#... |
import random
import numpy as np
import time
from sklearn.linear_model import LogisticRegression
from sklearn.metrics import roc_auc_score
def read_drugbank_data():
# read interaction data
interaction_file = open('data/interacts.csv')
interact_dict = {}
line = interaction_file.readline()
while line... |
# Copyright (C) 2009 Google Inc. All rights reserved.
# Copyright (C) 2009 Apple Inc. All rights reserved.
# Copyright (C) 2011 Daniel Bates (dbates@intudata.com). All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following condit... |
"""Flask MIME JSON encoder and decoder."""
__all__ = 'JsonMimeEncoder'.split()
from . import MimeEncoders
from flask import json, request, Response
from functools import wraps
class JsonMimeEncoder(MimeEncoders.base):
"""Flask MIME JSON encoder and decoder."""
name = 'json'
mimetype = 'application/json'
... |
# 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/.
import pytest
from selenium.common.exceptions import TimeoutException
from pages.contribute.contribute import Contribut... |
#!/usr/bin/env python
# (C) Copyright IBM Corporation 2004, 2005
# All Rights Reserved.
#
# 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
# ... |
#!/usr/bin/env python3
import argparse
import datetime
import glob
import json
import os.path
import pathlib
import re
import sqlite3
import subprocess
import sys
import zipfile
# Paths to various files
approot = os.path.expanduser("~/Library/Containers/net.shinyfrog.bear/Data")
dbpath = os.path.join(approot, "Documen... |
# -*- coding: utf-8 -*-
"""
Created on 09.06.16
Created for pyclamster-gui
Copyright (C) {2016}
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
... |
import tensorflow as tf
from tensorflow.contrib import layers
from tensorflow.contrib import learn
def make_input_fn(mode, filename_in, filename_out, in_vocab_file, out_vocab_file, batch_size, vocab_size,
input_max_length, output_max_length, queue_capacity=10000, num_threads=10):
def input_fn():... |
import networkx as nx
import numpy as np
def bipartite_region_tracking(partition, optical_flow, reliability,
matching_th=0.1, reliability_th=0.2):
"""
Parameters
----------
partition: numpy array
A 3D label array where each label represents a region
optical_flow: numpy arra... |
# Rekall Memory Forensics
# Copyright (c) 2012, Michael Cohen <scudette@gmail.com>
# Copyright (c) 2010, 2011, 2012 Michael Ligh <michael.ligh@mnin.org>
# Copyright 2013 Google Inc. All Rights Reserved.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Publ... |
import dbus
from servicetest import assertEquals, assertNotEquals, call_async, EventPattern
from gabbletest import exec_test, acknowledge_iq, make_muc_presence
import constants as cs
from twisted.words.xish import xpath
import ns
from mucutil import join_muc_and_check
def test(q, bus, conn, stream, access_control):... |
# Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
#
# Copyright 2011, Piston Cloud Computing, Inc.
#
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in ... |
import sys
import subprocess
import detect_camera
import touch_hdr_variables
from PySide.QtCore import *
from PySide.QtGui import *
class TouchHDRMenu(QWidget):
def __init__(self):
super(TouchHDRMenu, self).__init__()
self.check = QCheckBox("HDR", self)
self.btn_take_fast_hdr = QPushButton(... |
import numpy as np
from pack.ml.nodes.hinge_loss_node_pb2 import HingeLossNodeProto
class HingeLossNode(object):
class Hyperparameters(object):
def __eq__(self, other):
return self.__dict__ == other.__dict__
def generate_random_hyperparameters(self):
pass
def __init__(... |
from scipy.cluster.vq import *
from sklearn.preprocessing import Normalizer
from sklearn.svm import LinearSVC
from sklearn.externals import joblib
from sklearn.svm import *
from sklearn.metrics import *
from sklearn import linear_model
import matplotlib.pyplot as plt
import cv2
import os
import numpy as np
from sklearn... |
from sklearntools.transformers import Constant, VariableTransformer, Identity,\
Censor, NanMap, Log
import numpy as np
import pandas
from numpy.testing.utils import assert_array_almost_equal
from sklearn.datasets.base import load_boston
from pyearth.earth import Earth
from sklearntools.calibration import ResponseTr... |
# 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.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may ... |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file './Plugins/WizardPlugins/QRegExpWizard/QRegExpWizardRepeatDialog.ui'
#
# Created: Tue Nov 18 17:53:58 2014
# by: PyQt5 UI code generator 5.3.2
#
# WARNING! All changes made in this file will be lost!
from PyQt5 import QtCore, QtGui, QtW... |
#!/usr/bin/env python
# Fri 2013-05-03 23:44:30 -0400
# Copyright (c) 2013 by Ken Guyton. All Rights Reserved.
"""Test the guess binary player classes."""
__author__ = 'Ken Guyton'
import guess_num2
import player
import unittest
NUM_TO_GUESS = 42
HIGH_GUESS = 50
LOW_GUESS = 21
# Binary search.
EXPECTED_SEQUENCE =... |
#!/usr/bin/env python
"""celerybeat
.. program:: celerybeat
.. cmdoption:: -s, --schedule
Path to the schedule database. Defaults to ``celerybeat-schedule``.
The extension ".db" will be appended to the filename.
.. cmdoption:: -f, --logfile
Path to log file. If no logfile is specified, ``stderr`` is us... |
import argparse
import pdb
from multiprocessing import Pool
import numpy as np
import os
import pylab as pl
import pyfits as pf
import scipy
import sys
import datetime
import NPK.Fit
import NPK.Bar as Bar
from astropy.table import Table
from scipy.spatial import KDTree
import scipy.signal as SG
from numpy.polyno... |
from django.shortcuts import render, redirect
from django.http import HttpResponse, HttpResponseRedirect
from django.contrib.auth.decorators import login_required
from reader.documents import *
import datetime
import json
import urllib
@login_required
def like_article(request, record_id):
record = ReadRecord.objec... |
"""Tests for ``ximenez.shared.ssh`` module.
$Id$
"""
from base import XimenezTestCase
from ximenez.shared import ssh
from ximenez.shared import ConnectionException
class SSHTestCase(XimenezTestCase):
"""A test case for ``ximenez.shared.ssh`` module.
Some of theses tests presume that there is an SSH server... |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.6 on 2016-05-31 20:24
from __future__ import unicode_literals
from django.db import migrations, models
import django_extensions.db.fields
import stdimage.models
import stdimage.utils
class Migration(migrations.Migration):
initial = True
dependencies = [
... |
from __future__ import print_function
from __future__ import absolute_import
# ###################################################################
# Import packages
# ###################################################################
import re # for interpretation of lines
import struct # for binary representati... |
# 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... |
#!/usr/bin/env python
#
# A library that provides a Python interface to the Telegram Bot API
# Copyright (C) 2015-2016
# Leandro Toledo de Souza <devs@python-telegram-bot.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 b... |
#! /usr/bin/python
import tweepy
#import twitter dev account informaiton
from config import *
import gzip
import json
from multiprocessing import Pool
import time
import logging
#loggin setup
logging.basicConfig(filename="collector.log", filemode="a", level=logging.INFO, format="[ %(asctime)s ] %(levelname)s : %(mes... |
"""Wald distribution."""
import numpy
from scipy import special
import chaospy
from ..baseclass import SimpleDistribution, ShiftScaleDistribution
class wald(SimpleDistribution):
"""Wald distribution."""
def __init__(self, mu):
super(wald, self).__init__(dict(mu=mu))
def _pdf(self, x, mu):
... |
#!/usr/bin/env python
"""encode/decode base58 in the same way that Bitcoin does"""
import hashlib
import math
__b58chars = '123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz'
__b58base = len(__b58chars)
getNewRIPEMD160 = None
getNewSHA256 = None
def b58encode(v):
""" encode v, which is a string of bytes... |
#!/usr/bin/python
# -*- coding: UTF-8 -*-
import os
import sys
import subprocess
from pathmanager import node
from pathmanager import link
from pathmanager import paths
from pathmanager import tool
def superscp(argv):
if len(argv) != 5:
usage()
return
src = argv[2]
tip = argv[3]
td... |
#!/usr/bin/env python3
# for debug logging
import logging
# use Frame
from vocto.frame import Frame, X, Y, L, T, R, B
# for cloning objects
import copy
# for parsing configuration items
import re
log = logging.getLogger('Composites')
class Composites:
""" a namespace for composite related methods
"""
de... |
#####
# Author: Maria Sandrikova
# Copyright 2017, Inspiry
#####
from typing import List
from .compute_tools import TripHyposesis
NOT_FOUND = -1
class Trip:
def __init__(self, trip_hyposesis: TripHyposesis):
self.posts = trip_hyposesis.posts
self.country = trip_hyposesis.country
city_nam... |
# -*-coding: utf-8 -*-
import colander
from . import(
Date,
SelectInteger,
ResourceSchema,
BaseForm,
BaseSearchForm,
BaseAssignForm,
)
from ..resources.vats import VatsResource
from ..models import DBSession
from ..models.vat import Vat
from ..models.service import Service
from ..models.accou... |
# Copyright (C) 2014-2015 Andrey Antukh <niwi@niwi.be>
# Copyright (C) 2014-2015 Jesús Espino <jespinog@gmail.com>
# Copyright (C) 2014-2015 David Barragán <bameda@dbarragan.com>
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# pub... |
"""
Author: RedFantom
Contributors: Daethyra (Naiii) and Sprigellania (Zarainia)
License: GNU GPLv3 as in LICENSE.md
Copyright (C) 2016-2018 RedFantom
"""
# UI Libraries
import tkinter as tk
import tkinter.ttk as ttk
import tkinter.messagebox as mb
from tkinter.filedialog import askopenfilename
from widgets import Vert... |
import unittest
from .helpers import StubBoard, StubPiece, C, WHITE, BLACK
class TestQueenMovement(unittest.TestCase):
def get_queen(self, board, team, position):
from chess.models import Queen
return Queen(board, team, position)
# VALID MOVES --------------------------------------------------... |
# coding=utf-8
from __future__ import division, print_function, absolute_import
import math
import numpy as np
import scipy
from astropy.stats import LombScargle
from scipy.signal import fftconvolve
from scipy.stats import linregress
from scipy import integrate
from six.moves import range
class Autoperiod(object):
... |
"""
Iperf network performance testing module.
Used by tests for simple bandwidth measurements; uses iperf.
"""
import time
from pyltc.util.cmdline import CommandLine
# FIXME: Do we need these? Remove if not.
OUTPUT_REGEXP = r'^\[.*?\]\s+\d+\.\d+\-\d+\.\d+\s+sec\s+\d[\.\d]+\s+\w+\s+(\d+)\s+bits/sec.*$'
TIMEOUT = 60... |
import pdb
import time
import math
import copy
import warnings
import numpy as np
from hm import HorsetailMatching
class WeightedSum(HorsetailMatching):
'''Class for using weighted sum of moments within an optimization.
The code is written such that all arguments that can be used at the
initialization o... |
from command.public import SourceCommand
from .mountpoint_mapping import MountpointMapper
class DeviceIdentificationCommand(SourceCommand):
"""
takes care of identifying, which of the targets devices, should replicated, which device of the source system
"""
class NoMatchingDevicesException(SourceComm... |
import json
import pytest
from mock import MagicMock
from discovery_assist.liblastfm import LastFM
def test_clean_string():
fm = LastFM('no api key')
assert fm._clean_string('<esi>sys64738</esi>') == 'sys64738'
def test_get_similar_tracks():
with open('lastfm-track.getSimilar.json') as fh:
da... |
"""
Set up the plot figures, axes, and items to be done for each frame.
This module is imported by the plotting routines and then the
function setplot is called to set the plot parameters.
"""
import numpy as np
import os, shutil
from mapping import Mapping
import dtopotools_horiz_okada_and_1d as dtopotools
lengt... |
# Calculates and optionally plots the entropy of input files.
import os
import math
import zlib
import binwalk.core.common
from binwalk.core.compat import *
from binwalk.core.module import Module, Option, Kwarg
class Entropy(Module):
XLABEL = 'Offset'
YLABEL = 'Entropy'
XUNITS = 'B'
YUNITS = 'E'
... |
#
# synctool.overlay.py WJ111
#
# synctool Copyright 2015 Walter de Jong <walter@heiho.net>
#
# synctool COMES WITH NO WARRANTY. synctool IS FREE SOFTWARE.
# synctool is distributed under terms described in the GNU General Public
# License.
#
'''synctool.overlay maps the repository onto the root directory... |
from ctypes import sizeof, windll, addressof, c_wchar, create_unicode_buffer
from ctypes.wintypes import DWORD, HANDLE
PROCESS_TERMINATE = 0x0001
PROCESS_QUERY_INFORMATION = 0x0400
PROCESS_VM_READ = 0x0010
def get_pids(process_name):
BIG_ARRAY = DWORD * 4096
processes = BIG_ARRAY()
needed = DWORD()
p... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import vtk
def main():
origin = [0.0, 0.0, 0.0]
p0 = [1.0, 0.0, 0.0]
p1 = [0.0, 1.0, 0.0]
p2 = [0.0, 1.0, 2.0]
p3 = [1.0, 2.0, 3.0]
# Create a vtkPoints object and store the points in it.
points = vtk.vtkPoints()
points.InsertNextPoint(ori... |
#
# awesome.py
#
# Copyright (C) 2010 Fabio Erculiani
#
# 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... |
# Copyright (c) 2014 Mirantis Inc.
#
# Licensed under the Apache License, Version 2.0 (the License);
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to in writing, ... |
# -*- coding: utf-8 -*-
import pytest
from girder.api.rest import loadmodel, Resource
from girder.api import access
from girder.constants import AccessType, TokenScope
from girder.models.user import User
from girder.models.token import Token
from girder.settings import SettingKey
from pytest_girder.assertions import a... |
import time
import logging
LOGGER = logging.getLogger(__name__)
class Room(object):
def __init__(self, name):
self.name = name
self.peers = {}
def broadcast(self, msg):
if msg:
for peer in self.peers.values():
if peer != msg.user:
LOGGER.info('peer: %s', peer)
peer.send(msg)
def add_peer(s... |
import argparse
import json
import logging
import os
from datetime import datetime
import tenacity
import gservices
from risklimits import extract_navs, compute_high_watermark, extract_flows
def from_excel_datetime(excel_date):
return datetime.fromordinal(datetime(1900, 1, 1).toordinal() + int(excel_date) - 2)
... |
# -*- coding: utf-8 -*-
# © 2015 Therp BV <http://therp.nl>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from openerp import http
from openerp.http import request
class Main(http.Controller):
@http.route('/my_module/all-books', type='http', auth='none')
def all_books(self):
rec... |
##############################
# Robinhood API based on https://github.com/Jamonek/Robinhood.git
# refence available at https://github.com/sanko/Robinhood.git
##############################
import getpass
import requests
from datetime import datetime
import numpy as np
class Robinhood:
"""wrapper class f... |
#!/usr/bin/env python
"""
@file mpl_dump_onNet.py
@author Daniel Krajzewicz
@author Michael Behrisch
@date 2007-10-25
@version $Id: mpl_dump_onNet.py 11671 2012-01-07 20:14:30Z behrisch $
This script reads a network and a dump file and
draws the network, coloring it by the values
found within the dump-file.... |
#!/usr/bin/env python
"""
Fetches a PDB file (optionally the biological unit) from the RCSB database.
usage: python pdb_fetch.py [-biounit] <pdb id>
example: python pdb_fetch.py 1CTF
Author: {0} ({1})
This program is part of the PDB tools distributed with HADDOCK
or with the HADDOCK tutorial. The utilities in this ... |
from django.core.exceptions import PermissionDenied
from django.contrib.auth.models import User
from django.contrib.auth.decorators import login_required
from django.views.decorators.http import require_http_methods
from django.utils.translation import ugettext as _
from django.views.decorators.http import require_POST... |
from .fontref import pdf_character_widths
import copy
CORE_FONTS = {
'courier': 'Courier',
'courier_bold': 'Courier-Bold',
'courier_italic': 'Courier-Oblique',
'courier_bold_italic': 'Courier-BoldOblique',
'helvetica': 'Helvetica',
'helvetica_bold': 'Helvetica-Bold',
'helvetica_it... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#----------------------------------------------------------------------------
# Copyright 2017 Marcel Paffrath (Ruhr-Universitaet Bochum, Germany)
#
# Several functions in this file are the work of Kueperkoch et al.
#
# This file is part of ActiveSeismoPick3D
#-------... |
# This is a sample transform plugin script for bbcrack
# All transform plugin scripts need to be named trans*.py, in the plugins folder
# Each plugin script should add Transform objects.
# First define a new Transform class, inheriting either from Transform_char or
# Transform_string:
# - Transform_char: for... |
__author__ = 'SongJun-Dell'
try:
xrange
except NameError:
xrange = range
class CheckerGradient(object):
def __init__(self):
self.delta = 1e-5
self.rel_error_thr_warning = 1e-2
self.rel_error_thr_error = 1.0
self.status_types = ['PASS', 'ZEOR', 'SMALL', 'WARNING', '!!!---ER... |
from frontpage.models import Article, Profile, Media, ArticleMedia, MediaUpload, Post, Settings
from django.contrib.auth.models import User
# This function assumes that the create superuser command has already been run.
def make_testing_db():
m = Media()
m.headline = "Most ugly image"
m.lowResFile = "htt... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# =============================================================================
# FileName: api.py
# Desc: 2015-15/4/16:下午5:54
# Author: 苦咖啡
# Email: voilet@qq.com
# HomePage: http://blog.kukafei520.net
# History:
# =======================... |
from . import FixtureTest
class DuplicatePoints(FixtureTest):
def _assert_no_repeated_points(self, coords):
last_coord = coords[0]
for i in range(1, len(coords)):
coord = coords[i]
self.assertFalse(
coord == last_coord,
'Coordinate %r (at %d... |
import numpy as np
import matplotlib.pyplot as plt
def load_asc(filename):
fp = open(filename)
ncols, count = fp.readline().split()
ncols = int(count)
nrows, count = fp.readline().split()
nrows = int(count)
xllcorner, value = fp.readline().split()
xllcorner = float(value)
yllcorner,... |
"""
Implementation of per object permissions for Django.
"""
from __future__ import unicode_literals
from . import checks
try:
from .version import version as __version__
__version__split__ = __version__.split(".")
VERSION = tuple(['1', '5', '7'])
def get_version():
"""
Returns shorte... |
"""
Supporting celery tasks go in this module. The primarily interesting one is
SendEmailTask, which handles sending a single Django EmailMessage object.
"""
import logging
from django.conf import settings
from celery.task import Task
from boto.ses.exceptions import SESAddressBlacklistedError, SESDomainEndsWithDotError... |
from datetime import date
import dateutil.parser as date_parser
from backend import config
from fuzzywuzzy import fuzz
from itertools import product
# Cascades:
# 1) case sensitive partial ratio on character level with penalty
# 2) case insensitive partial ratio on character level with penalty
# 3) token sorted cas... |
from procrasdonate.applib import SmtpApiHeader
from django.utils import simplejson as json
hdr = SmtpApiHeader.SmtpApiHeader()
receiver = ['lucy@bilumi.org','cwallardo@gmail.com','messenger@bilumi.org']
times = ['1pm', '2pm', '3pm']
names = ['lucy', 'clay', 'messenger']
hdr.addTo(receiver)
hdr.addSubVal('<time>',... |
# Copyright (C) 2010-2014 CEA/DEN, EDF R&D
#
# 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.
#
# This library ... |
from functools import wraps
from flask import current_app, request
from flask_allows import allows, Or
def is_logged_in(user):
"""Checks if the user is logged in."""
if current_app.config.get('LOGIN_DISABLED') or \
(user.is_authenticated and user.is_active):
return True
return False
... |
#!/usr/bin/env python
# Copyright 2020 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless require... |
# Copyright 2010 Orbitz WorldWide
#
# 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 writ... |
##############################################################
# Python script to attempt automatic unpacking/decrypting of #
# malware samples using WinAppDbg. #
# #
# unpack.py v2016.01.25 #
# htt... |
"""Handle mailto URL"""
import email
import os
import poplib
import socket
import multipla
content_encodings = multipla.power_up('scriba.content_encodings')
content_types = multipla.power_up('scriba.content_types')
email_mimes = multipla.power_up('scriba.email_mimes')
class BadPOP3Response(Exception):
pass
d... |
# oxAuth is available under the MIT License (2008). See http://opensource.org/licenses/MIT for full text.
# Copyright (c) 2016, Gluu
#
# Author: Yuriy Movchan
#
import json
from java.util import Arrays
from oneid import OneID
from org.apache.http.entity import ContentType
from org.xdi.model.custom.script.type.auth imp... |
# Includes Credit notes
import logging
from django.views.generic import CreateView, DetailView, UpdateView
from django.forms import ModelForm
from django.db.models import Sum
from django.shortcuts import reverse, redirect
from django_tables2 import SingleTableView, LazyPaginator
from braces.views import StaffuserRequ... |
from data_structures.stack import Stack
class Node(object):
def __init__(self, key=None, val=None, capacity=3):
self.count = 0
if key is not None:
self.count = 1
self.elems = [(key, val)]
for i in xrange(capacity-1):
self.elems.append((None, None))
s... |
# 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/.
#
# Author: Kyle Lahnakoski (kyle@lahnakoski.com)
#
from __future__ import absolute_import
from __f... |
#!/usr/bin/python
import sys
import re
color_map = [ "silver", "aquamarine", "tan", "skyblue", "plum", "yellowgreen", "moccasin" ]
def get_color_level(n):
return color_map[n % len(color_map)]
def enstyle_parameters(s):
result = ""
if s == "" or s == "void":
return "<b>void</b>"
nexti = s.find("=")
while... |
import sys
sys.path.append('/home/jwalker/dynamics/python/atmos-tools')
sys.path.append('/home/jwalker/dynamics/python/atmos-read')
sys.path.append('/home/jwalker/dynamics/python/monsoon-onset')
import numpy as np
import xarray as xray
import pandas as pd
import matplotlib.pyplot as plt
import matplotlib as mpl
from m... |
from ..DynamicDiffusionModel import DynamicDiffusionModel
import numpy as np
import networkx as nx
import future.utils
from scipy import stats
__author__ = "Letizia Milli"
__license__ = "BSD-2-Clause"
__email__ = "letizia.milli@isti.cnr.it"
class DynKerteszThresholdModel(DynamicDiffusionModel):
"""
... |
# -*- encoding: utf-8 -*-
################################################################################
# #
# Copyright (C) 2013-Today Carlos Eduardo Vercelino - CLVsol #
# ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.