src stringlengths 721 1.04M |
|---|
import imp
from io import StringIO
from pluggdapps.plugin import Plugin, implements
from tayra import BaseTTLPlugin
def __traceback_decorator__( frames ):
from copy import deepcopy
from os.path import basename
def _map2ttl( frame ):
filename = frame.fil... |
import argparse
import itertools
import shlex
import unittest2 as unittest
class FabricioTestCase(unittest.TestCase):
def command_checker(self, args_parsers=(), expected_args_set=(), side_effects=()):
def check_command_args(command, **kwargs):
try:
command_parser = next(args_... |
# -*- coding: utf8 -*-
"""
This file implementns:
* class adapter which offer unificated API for requests ticker, trades, orderbook, ...
* class for symbol
"""
__author__ = "Jan Seda"
__copyright__ = "Copyright (C) Jan Seda"
__credits__ = []
__license__ = ""
__version__ = "0.1"
__maintainer__ = "Jan Seda"
__email__... |
import unittest
from utilities import *
from constants import *
class TestUtilities(unittest.TestCase):
def test_script_safe(self):
path="tests/bot_unsafe1.py"
self.assertFalse(is_script_safe(path))
path="tests/bot_unsafe2.py"
self.assertFalse(is_script_safe(path))
... |
#=======================================================================
# Author: Donovan Parks
#
# Sequence histogram plot.
#
# Copyright 2011 Donovan Parks
#
# This file is part of STAMP.
#
# STAMP is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as publi... |
# Source File: server.py - simple multithreaded echo server
# Program: Scalable Server Methods 8005A2
# Functions:
# setup
# handler
# main
# Date: February 23, 2015
# Designer: Callum Styan, Jon Eustace
# Programmer: Callum Styan, Jon Eustace
from socket import *
import select
import thread
import sys
imp... |
#-----------------------------------------------------------------------------
#
# Paper: When Crowdsourcing Fails: A Study of Expertise on Crowdsourced
# Design Evaluation
# Author: Alex Burnap - aburnap@umich.edu
# Date: October 10, 2014
# License: Apache v2
# Descrip... |
#!/usr/bin/python
# Copyright (c) 2011 The Native Client Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
from optparse import OptionParser
import os
import subprocess
import sys
NATIVE_CLIENT_DIR = os.path.dirname(os.path.dirname(__... |
# Amara, universalsubtitles.org
#
# Copyright (C) 2014 Participatory Culture Foundation
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your ... |
from gi.repository import Gtk
import os
from collections import OrderedDict
from coalib.settings.ConfigurationGathering import load_configuration
from coalib.output.ConfWriter import ConfWriter
from coalib.output.printers.LogPrinter import LogPrinter
from pyprint.NullPrinter import NullPrinter
from coalib.settings.Sect... |
#!/usr/bin/env python3
import random
import sys
import math
def get_random_direction():
direction = ""
probability = random.random()
if probability < 0.25:
direction = "west"
elif 0.25<=probability<0.5:
direction= "north"
elif 0.5<= probability<0.75:
direction= "south"
... |
"""Copies the contents (indicators and actions) of one campaign into another
"""
# Copyright 2010,2011 Good Energy Research Inc. <graham@goodenergy.ca>, <jeremy@goodenergy.ca>
#
# This file is part of Good Energy.
#
# Good Energy is free software: you can redistribute it and/or modify
# it under th... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
###########################################################
# WARNING: Generated code! #
# ************************** #
# Manual changes may get lost if file is generated again. #
# Only code inside the [MANUAL] ta... |
################################################################################
# This file is part of OpenELEC - http://www.openelec.tv
# Copyright (C) 2009-2014 Stephan Raue (stephan@openelec.tv)
#
# OpenELEC is free software: you can redistribute it and/or modify
# it under the terms of the GNU General ... |
import logging
from typing import Dict, Optional
import numpy as np
import pandas as pd
from great_expectations.core import ExpectationConfiguration
from great_expectations.exceptions import InvalidExpectationConfigurationError
from great_expectations.execution_engine import (
ExecutionEngine,
PandasExecution... |
#!/usr/bin/env python -OO
# encoding: utf-8
###########
# ORP - Open Robotics Platform
#
# Copyright (c) 2010 John Harrison, William Woodall
#
# 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 Softwa... |
#!/usr/bin/python
import hash
import os
import config
import video_info
watched_cache = {}
def prepwatched( conn ):
global watched_cache
result = conn.execute( "SELECT * FROM history" )
queueitem = result.fetchone()
while( queueitem ):
watched_cache[ queueitem[ 0 ] ] = True
queueitem ... |
#!/usr/bin/python
import sys
import socket
import logging
from optparse import OptionParser
from tls import *
def make_hello():
hello = ClientHelloMessage.create(TLSRecord.TLS1_0,
'01234567890123456789012345678901',
[TLS_RSA_WITH_RC4_128... |
import requests
from time import sleep
import json
import ConfigParser
import modules
# config
config = ConfigParser.ConfigParser()
config.read("config.ini")
key = config.get("setting","key")
limit = config.getint("setting","limit")
sleepTime = config.getint("setting","sleep")
queryLimit = config.getint("setting","que... |
from django.template import Library, Node
from django.template.loader import render_to_string
from django.contrib.sites.models import Site
from django.conf import settings
import os, urlparse
register = Library()
def _absolute_url(url):
if url.startswith('http://') or url.startswith('https://'):
... |
"""Preconfigured converters for ujson."""
from base64 import b85decode, b85encode
from datetime import datetime
from .._compat import Set
from ..converters import Converter, GenConverter
def configure_converter(converter: Converter):
"""
Configure the converter for use with the ujson library.
* bytes ar... |
from check_information_version import *
from check_information_db2system import *
from check_configuration_audit_buffer import *
from check_configuration_authentication_mechanism import *
from check_configuration_catalog_noauth import *
from check_configuration_datalinks import *
from check_configuration_dftdbpath impo... |
from shlex import quote
from bundlewrap.exceptions import BundleError
from bundlewrap.items import Item
from bundlewrap.utils.text import mark_for_translation as _
def svc_start(node, svcname):
return node.run(f"rc-service {quote(svcname)} start", may_fail=True)
def svc_running(node, svcname):
result = nod... |
# Copyright (c) 2012 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 ... |
#####################################################################################
#
# Copyright (C) Tavendo GmbH
#
# Unless a separate license agreement exists between you and Tavendo GmbH (e.g. you
# have purchased a commercial license), the license terms below apply.
#
# Should you enter into a separate licen... |
#!/usr/bin/env python
# -*-coding:utf-8-*-
"""
Minimal character-level Vanilla RNN model. Written by Andrej Karpathy (@karpathy)
BSD License
"""
import numpy as np
# data I/O
data = open('input.txt', 'r').read() # should be simple plain text file
chars = list(set(data))
data_size, vocab_size = len(data), len(chars)
... |
##
# Copyright 2011-2016 Ghent University
#
# This file is part of EasyBuild,
# 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://www.vscentrum.be),
# Flemish Research Foundation (F... |
# -*- coding: utf-8 -*-
from django.conf import settings as django_settings
from django.core.urlresolvers import reverse_lazy
from django.utils.translation import ugettext as _
# Should urls be case sensitive?
URL_CASE_SENSITIVE = getattr( django_settings, 'WIKI_URL_CASE_SENSITIVE', False )
# Non-configurable (at the... |
#!/usr/bin/python
# openvpn.py: library to handle starting and stopping openvpn instances
import subprocess
import threading
import time
class OpenVPN():
def __init__(self, config_file=None, auth_file=None, timeout=10):
self.started = False
self.stopped = False
self.error = False
... |
#!/usr/bin/env python
# -*- encoding: utf-8 -*-
# Copyright 2016 Twitter. 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... |
# Copyright 2013 IBM Corp.
#
# 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 t... |
# -*- coding: utf-8 -*-
import os, codecs
import itertools
import re
import checkers
from bs4 import BeautifulSoup
# Headers for extracting different types of data from PDF
headers = {
"extract_date": [u"ამონაწერის მომზადების თარიღი:"],
"subject": [u"სუბიექტი"],
"name": [u"საფირმო სახელწოდება:",u"სახელწოდე... |
from collections import deque
class JobList(object):
def __init__(self, jobMap=None, initial=None):
self.jobs = dict()
self.merged= deque()
if type(jobMap) is dict:
for (user, prev) in jobMap.iteritems():
assert type(prev) is list
self.jobs[user] = prev
if ... |
import curses
import datetime
import sys
from writelightly.calendar import Calendar
from writelightly.conf import Config
from writelightly.edit import edit_date, get_edits, clean_tmp, show_edits
from writelightly.metadata import Metadata
from writelightly.screen import ScreenManager, TextArea
from writelightly.tags im... |
# -*- coding: utf-8 -*-
# Copyright (C) 2006 Osmo Salomaa
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This pr... |
# convert the downscaled data archive
def run( x ):
''' simple wrapper to open and return a 2-D array from a geotiff '''
import rasterio
return rasterio.open(x).read(1)
def sort_files( files, split_on='_', elem_month=-2, elem_year=-1 ):
'''
sort a list of files properly using the month and year parsed
from the... |
# -*- coding: utf-8 -*-
from south.utils import datetime_utils as datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding model 'OAuthApplication'
db.create_table(u'profiles_oauthapplica... |
# _*_ coding: utf-8 _*_
__author__ = 'LennonChin'
__date__ = '2017/10/23 21:37'
# pip install pycryptodome
__author__ = 'bobby'
from datetime import datetime
from Crypto.PublicKey import RSA
from Crypto.Signature import PKCS1_v1_5
from Crypto.Hash import SHA256
from base64 import b64encode, b64decode
from... |
from django.contrib.contenttypes.models import ContentType
from django.core import exceptions
from django.conf import settings
from django.contrib.admin.views.decorators import staff_member_required
from django.contrib.auth.decorators import permission_required
from django.contrib.contenttypes.models import ContentType... |
from bisect import insort_left
from collections import MutableMapping, OrderedDict
import random
import struct
import hashlib
from threading import Lock
import os
from engine.utils.timeutils import milliseconds
_inc_lock = Lock()
_inc = 0
_pid = int(os.getpid()) % 0xffff
def random_id(length=18):
"""Generate i... |
import collections
from werkzeug.wrappers import Response
from lexington.util import di
from lexington.util import route
from lexington.util import view_map
from lexington.util import paths
def default_dependencies(settings):
dependencies = di.Dependencies()
dependencies.register_value('settings', settings)
... |
import hashlib
import os
from django.conf import settings
from django.core.files.storage import default_storage as storage
from django.db import transaction
from elasticsearch_dsl import Search
from PIL import Image
import olympia.core.logger
from olympia import amo
from olympia.addons.models import (
Addon, att... |
import os, sys
os.environ.setdefault("DJANGO_SETTINGS_MODULE","geonode.settings")
import csv
from django.db import connection, connections
from django.conf import settings
from geodb.models import Glofasintegrated, AfgBasinLvl4GlofasPoint
from netCDF4 import Dataset, num2date
import numpy as np
from django.contrib.g... |
from jsonrpc import ServiceProxy
import sys
import string
# ===== BEGIN USER SETTINGS =====
# if you do not set these you will be prompted for a password for every command
rpcuser = ""
rpcpass = ""
# ====== END USER SETTINGS ======
if rpcpass == "":
access = ServiceProxy("http://127.0.0.1:9451")
else:
access = Ser... |
# -*- coding: utf-8 -*-
#------------------------------------------------------------
# tvalacarta - XBMC Plugin
# Canal para 8TV
# http://blog.tvalacarta.info/plugin-xbmc/tvalacarta/
#------------------------------------------------------------
import re
import sys
import os
import traceback
import urllib2
from core ... |
import unittest
from zoonomia.solution import (
verify_closure_property, BasisOperator, TerminalOperator, OperatorSet,
Objective, Fitness, Solution
)
class TestVerifyClosureProperty(unittest.TestCase):
def test_verify_closure_property(self):
def add(left, right): return left + right
int... |
import traceback
import functools
import inspect
import logging
import six
import wsme.exc
import wsme.types
from wsme import utils
log = logging.getLogger(__name__)
def iswsmefunction(f):
return hasattr(f, '_wsme_definition')
def wrapfunc(f):
@functools.wraps(f)
def wrapper(*args, **kwargs):
... |
from PyQt5 import QtCore, QtSql
from PyQt5.QtSql import QSqlDatabase, QSqlQuery
from PyQt5.QtCore import Qt, pyqtSignal
from PyQt5.QtGui import QPixmap
from PyQt5.QtWidgets import *
from OpenNumismat.Reference.ReferenceDialog import ReferenceDialog, CrossReferenceDialog
class SqlTableModel(QtSql.QSqlTableModel):
... |
# -*- coding: utf-8 -*-
# Resource object code
#
# Created by: The Resource Compiler for PyQt5 (Qt v5.7.0)
#
# WARNING! All changes made in this file will be lost!
from PyQt5 import QtCore
qt_resource_data = b"\
\x00\x00\x05\x88\
\x89\
\x50\x4e\x47\x0d\x0a\x1a\x0a\x00\x00\x00\x0d\x49\x48\x44\x52\x00\
\x00\x00\x10\x0... |
# Django settings for example project.
DEBUG = True
TEMPLATE_DEBUG = DEBUG
ADMINS = (
('Christopher Glass', 'tribaal@gmail.com'),
)
MANAGERS = ADMINS
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3', # Add 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'.
... |
from copy import deepcopy
import re
from django.utils.datastructures import SortedDict, MultiValueDict
from django.utils.html import conditional_escape
from django.utils.encoding import StrAndUnicode, smart_unicode, force_unicode
from django.utils.safestring import mark_safe
from django.forms.widgets import flatatt
fr... |
# -*- coding: utf-8 -*-
# Añade la funcionalidad group_concat de mysql al sqlalchemy
from sqlalchemy.ext import compiler
from sqlalchemy.sql import ColumnElement
from sqlalchemy.orm.attributes import InstrumentedAttribute
class group_concat(ColumnElement):
def __init__(self, col1, col2=None, separator=None):
... |
from core.himesis import Himesis, HimesisPreConditionPatternLHS
import uuid
class HEC_prop2_CompleteLHS(HimesisPreConditionPatternLHS):
def __init__(self):
"""
Creates the himesis graph representing the AToM3 model HEC_prop2_CompleteLHS.
"""
# Fla... |
"""Tests for the models of the ``generic_positions`` app."""
from django.contrib.contenttypes.models import ContentType
from django.test import TestCase
from mixer.backend.django import mixer
from ..models import ObjectPosition, save_positions
from .test_app.models import DummyModel
class ObjectPositionTestCase(Tes... |
#! /usr/bin/env python3
#
# Copyright (C) 2011, 2012, 2013, 2014, 2015, 2016, 2018 Ed Bueler and Constantine Khroulev and David Maxwell
#
# This file is part of PISM.
#
# PISM 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... |
# coding=utf-8
"""Provider code for MoreThanTV."""
from __future__ import unicode_literals
import logging
import re
import time
from medusa import tv
from medusa.bs4_parser import BS4Parser
from medusa.helper.common import (
convert_size,
try_int,
)
from medusa.helper.exceptions import AuthException
from me... |
#!/usr/bin/env python
# coding: utf-8
from __future__ import print_function
from __future__ import absolute_import
import os
import sys
import tct
from tct import deepget
ospj = os.path.join
params = tct.readjson(sys.argv[1])
facts = tct.readjson(params['factsfile'])
milestones = tct.readjson(params['milestonesfil... |
import unittest
from functools import partial
from numpy.testing import assert_array_equal
from hypothesis import given
from hypothesis.strategies import sampled_from
from tvtk.api import tvtk
from simphony.core.cuba import CUBA
from simphony.testing.abc_check_lattice import (
CheckLatticeNodeOperations, CheckLat... |
# -*- coding: latin-1 -*-
"""This file contains the public interface to the aiml module."""
import AimlParser
import DefaultSubs
import Utils
from PatternMgr import PatternMgr
from WordSub import WordSub
from ConfigParser import ConfigParser
import copy
import glob
import os
import random
import re
import string
impor... |
from konlpy.tag import Hannanum
from collections import Counter
import pandas as pd
import csv
import json
def read_localcsv(path):
result = pd.read_csv(path, encoding='UTF-8')
print(result)
return result
def get_json_data(path):
#r = requests.get(URL)
#data = r.text
RESULTS = {"children": []}
with open(... |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals
from ctypes import POINTER, byref, string_at, create_string_buffer, c_void_p, c_char_p, c_int, c_size_t
from ._c import lib, osip_parser, osip_content_type, osip_from, osip_header, osip_content_length, osip_body
from .error impor... |
import sqlite3
from ApiClientes import *
from AbstractClassBuilders import *
import sys
#Autor y programador - "Maximiliano García De Santiago"
class SqlCRUDCliente(AbstractProyectClient):
def __init__(self):
self.conexion = sqlite3.connect('ProyectTaco.db')
self.cursor = self.conexion.cursor()
... |
#!/usr/bin/env python
#encoding: utf8
import unittest, rostest
import rosnode, rospy
import time
from pimouse_ros.msg import MotorFreqs
from geometry_msgs.msg import Twist
class MotorTest(unittest.TestCase):
def file_check(self,dev,value,message):
with open("/dev/" + dev,'r') as f:
self.assertE... |
__all__ = [
'PlotAnim',
]
class PlotAnim(object):
def __init__(self):
self.handle_line = {}
self.handle_text = {}
self.pylab = None
def set_pylab(self, pylab):
self.pylab = pylab
def assert_pylab_given(self):
if self.pylab is None:... |
#!/usr/bin/env python
from psqlgraph import Node, Edge
from gdcdatamodel import models as md
CACHE_EDGES = {
Node.get_subclass_named(edge.__src_class__): edge
for edge in Edge.get_subclasses()
if 'RelatesToCase' in edge.__name__
}
LEVEL_1_SQL = """
INSERT INTO {cache_edge_table} (src_id, dst_id, _prop... |
import cv2
import numpy as np
import os.path
from sys import argv
if len(argv) < 2:
print("Usage: {} img_file [img_file ...]".format(argv[0]))
exit()
# process images
for fn in argv[1:]:
try:
src_img = cv2.imread(fn) # load image
except:
print("Failed to read image {}".format(fn))
... |
#!/usr/bin/python
#
# Copyright 2019 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... |
# Copyright (c) 2012 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.0
#
# Unless ... |
"""
This submodule holds the frame creators that produce an image sequence that will be converted into a movie.
A frame creator is an object that when called with the frame number will return the corresponding frame as a
``matplotlib.figure.Figure`` object and has a length (i.e. ``__len__``) equal to the number of fram... |
#!/usr/bin/env python
# -*- coding:utf-8 -*-
class FrameworkFactory(object):
__framework = None
@staticmethod
def set_framework(framework):
FrameworkFactory.__framework = framework
@staticmethod
def get_framework():
return FrameworkFactory.__framework
class BaseFramework(object... |
#!/usr/bin/env python
import numpy as np
import scipy
import sys
import os
import os.path
import argparse
import myutils
#--------Version History----------------------------------------------------------------------------
# 16/nov/2017: parallax mission time scaling factor fixed (goes as (5./tm)**0... |
#!/usr/bin/env python
import os
import pytest
import json
import boutiques as bosh
import boutiques.creator as bc
from boutiques import __file__ as bfile
from boutiques.localExec import ExecutorError
from argparse import ArgumentParser
from unittest import TestCase
import mock
from boutiques_mocks import mock_zenodo_s... |
# core_on_login.py chromatic universe william k. johnson 2018
from time import sleep
#cci
from cci_imap_gadget.imap_gadget_base import cci_chilkat , \
cci_ecosys , \
cci_mini_imap_mail
from cci_imap_gadget.core_on_logout i... |
import datetime
from recirq.qaoa.experiments.optimization_tasks import (
OptimizationAlgorithm, OptimizationTask, collect_optimization_data)
from recirq.qaoa.experiments.problem_generation_tasks import (
HardwareGridProblemGenerationTask, SKProblemGenerationTask,
ThreeRegularProblemGenerationTask)
def ma... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# ####################################################################
# Copyright (C) 2005-2013 by the FIFE team
# http://www.fifengine.net
# This file is part of FIFE.
#
# FIFE is free software; you can redistribute it and/or
# modify it under the terms of the GNU ... |
#
# Baruwa - Web 2.0 MailScanner front-end.
# Copyright (C) 2010-2012 Andrew Colin Kissa <andrew@topdog.za.net>
#
# 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... |
#! /usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Copyright © 2016-2018 Cyril Desjouy <ipselium@free.fr>
#
# This file is part of cpyvke
#
# cpyvke 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 vers... |
#
# Copyright 2013 Intel Corp.
# Copyright 2014 Red Hat, 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 applica... |
from __future__ import division
from builtins import object
from past.utils import old_div
import pytest
import shutil, os, glob
from tempfile import mkdtemp
from os.path import abspath, dirname, join
from psychopy import microphone
from psychopy.microphone import _getFlacPath
from psychopy import core
from psychopy.... |
from flask import Flask, url_for, Response, json, jsonify, request
app = Flask(__name__)
import indigo
from decorators import requires_apitoken, requires_auth
import requests
import db
import settings
#
# Appspot Account Setup Process
@app.route('/token', methods=['PUT'])
def token():
new_api_token = request.head... |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2011 Governo do Estado do Rio Grande do Sul
# Copyright (C) 2011 Lincoln de Sousa <lincoln@comum.org>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Fou... |
"""The manager for defining and managing scores."""
import datetime
from django.db.models import Q
from django.core.exceptions import ObjectDoesNotExist
from django.db.models.aggregates import Sum, Max
from apps.managers.challenge_mgr import challenge_mgr
from apps.managers.score_mgr.models import ScoreboardEntry, Poi... |
# -*- coding: utf-8 -*-
from base64 import urlsafe_b64encode
from os import urandom
import struct
import time
from redis.exceptions import WatchError
from doodle.config import CONFIG
from doodle.core.redis_client import redis_cache_client
from .base_model import SimpleModel
class Auth(SimpleModel):
KEY = 'Aut... |
# -*- coding: utf-8 -*-
"""
Created on Mon Jun 8 15:37:51 2015
@author: Anton O Lindahl
"""
import h5py
import argparse
import matplotlib.pyplot as plt
import numpy as np
import time
import os
import sys
import lmfit
import warnings
from aolPyModules import wiener, wavelet_filter
import time_to_energy_conversion as ... |
from django import forms
from django.contrib.auth.forms import UserChangeForm
from ppuser.models import CustomUser
class CustomUserCreationForm(forms.ModelForm):
password1 = forms.CharField(label='Password', widget=forms.PasswordInput)
password2 = forms.CharField(label='Password confirmation', widget=forms.Pa... |
from unittest import TestCase
from rfxcom.protocol.lighting1 import Lighting1
from rfxcom.exceptions import (InvalidPacketLength, UnknownPacketSubtype,
UnknownPacketType)
class Lighting1TestCase(TestCase):
def setUp(self):
self.data = bytearray(b'\x07\x10\x00\x01\x41\x0A... |
# Copyright (c) 2014, Fundacion Dr. Manuel Sadosky
# All rights reserved.
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# 1. Redistributions of source code must retain the above copyright notice, this
# list of condit... |
#
# This file is part of Mapnik (c++ mapping toolkit)
#
# Copyright (C) 2015 Artem Pavlenko
#
# Mapnik 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 op... |
#!/usr/bin/python
'''itunes utility classes'''
from __future__ import absolute_import, print_function
import logging
import re
from muslytics.Utils import strip_featured_artists, AbstractTrack, MULT_ARTIST_PATTERN, UNKNOWN_GENRE
logger = logging.getLogger(__name__)
FEAT_GROUP_PATTERN = re.compile('.*\(feat\.(?P<art... |
#!/usr/bin/env python
# -*- coding: utf-8 -*
#
# File: lp_cli.py
#
# Copyright (C) 2012 Hsin-Yi Chen (hychen)
# Author(s): Hsin-Yi Chen (hychen) <ossug.hychen@gmail.com>
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the "Software... |
#
# ----------------------------------------------------------------------------------------------------
#
# Copyright (c) 2007, 2015, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify ... |
from abc import ABCMeta, abstractmethod
from threading import Thread
from time import sleep, time
class Transform(object):
__metaclass__ = ABCMeta
def __init__(self, *args, **kwargs):
self.args = args
self.kwargs = kwargs
@abstractmethod
def apply(self,target_df=None):
""" Ap... |
import pandas as pd
# TODO: Load up the table, and extract the dataset
# out of it. If you're having issues with this, look
# carefully at the sample code provided in the reading
df = pd.read_html('http://espn.go.com/nhl/statistics/player/_/stat/points/sort/points/year/2015/seasontype/2', header=1)[0]
# TODO: Renam... |
# Copyright 2015 The Meson development team
# 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 ... |
import fix_paths
from models.commit import Commit
import common
import config
from models.file_diff import FileDiff
from models.hunk import Hunk
import csv
import random
num_train = raw_input("Enter number of samples for the training set [100]:")
num_test = raw_input("Enter number of samples for the testing set [100... |
from __future__ import unicode_literals
import re
from django.contrib.auth.hashers import (check_password, make_password,
is_password_usable)
from django.contrib.auth.models import BaseUserManager, PermissionsMixin
from django.db import models
from django.forms.models import mo... |
import function
from matplotlib.pyplot import *
from pylab import *
import numpy as np
import math
class Trapecio:
def __init__(self, fun, xi, xf):
self.fun = function.Function(fun,'x')
self.a,self.b = xi,xf
self.fig, self.ax = subplots()
def relativeError(self):
f = self.fun.getDerivate()
Ea = ((self.b-... |
#
# Copyright 2011-2013 Blender 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 to in... |
# coding=UTF-8
# Viz.py
import os
from math import ceil
from func.core.lang import t, probar_input
def PrepPrint(lista):
imp = ''
lineas = []
for elemento in lista:
imp += str(elemento)+', '
if len(imp) > 75:
lineas.append(imp)
imp = ''
... |
class WordFilter:
def __init__(self, words):
"""
:type words: List[str]
"""
from collections import defaultdict
self.prefix = defaultdict(list)
self.suffix = defaultdict(list)
for wi, word in enumerate(words):
for i in range(len(word) + 1):
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.