src stringlengths 721 1.04M |
|---|
# Copyright (C) 2016 Fabian Wenzelmann
#
# This file is part of csd-freiburg-forms.
#
# csd-freiburg-forms 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)... |
#!/usr/bin/env python3
"""A simple dropbox parser
This is a simple tool that can parse errors in android dropbox and
print errors on stardand output, The errors are stored in a global
dict variable named "result".
"""
import os
import sys
import re
import gzip
import shutil
import time
from datetime import datetime... |
from sql_statement import SQLStatement
from catalog import Catalog
from operation_status import OperationStatus
import simple_dbms
try:
from bsddb import db
except ImportError:
from bsddb3 import db
class CreateStatement(SQLStatement, object):
def __init__(self, table, column_def_list):
"""
... |
import os
import glob
#####################################################
######Init the arff##################################
#####################################################
os.remove("ngram_short.arff")
file_ = open("ngram_short.arff", "a")
file_.write("@RELATION sys_attack\n")
file_.write("@ATTRIBUTE "... |
'''
Copyright 2015 Serendio Inc.
Author - Satish Palaniappan
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 ... |
# Copyright 2016 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable ... |
# -*- coding: utf-8 -*-
# Generated by Django 1.10 on 2017-04-14 21:17
from __future__ import unicode_literals
import django.contrib.auth.models
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
('auth', ... |
import warnings
__SEABREEZE_BACKEND = 'cseabreeze'
def use(backend):
if not backend in ['cseabreeze', 'pyseabreeze']:
raise Exception('Choose backend from "cseabreeze", "pyseabreeze"')
else:
global __SEABREEZE_BACKEND
__SEABREEZE_BACKEND = backend
def get_backend():
global __SEABR... |
"""This module works with similarity matrices of aminoacids"""
import os
available_matrices = {
'PAM120': 'matrices/PAM120.txt'
}
class SimilarityMatrix:
def __init__(self, name):
filename = available_matrices[name]
# get the raw matrix from file
matrix = self.read_raw_matrix(filen... |
import os
import collections
import json
import subprocess
import re
import click
from .cache import region
class NixEvalError(Exception):
pass
def nix_packages_json():
click.echo('Refreshing cache')
try:
output = subprocess.check_output(['nix-env', '-qa', '--json', '--show-trace'],
... |
#!/usr/bin/env python
'''
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")... |
# Licensed under the MIT license
# http://opensource.org/licenses/mit-license.php or see LICENSE file.
# Copyright 2007-2008 Brisa Team <brisa-develop@garage.maemo.org>
""" Glib2/GObject based reactor. Works trasparently with GObject-dependent
things, such as Dbus.
"""
from brisa.core.ireactor import ReactorInterface... |
"""
ANSI - Gives colour to text.
Use the codes defined in ANSIPARSER in your text
to apply colour to text according to the ANSI standard.
Examples:
This is %crRed text%cn and this is normal again.
This is {rRed text{n and this is normal again.
Mostly you should not need to call parse_ansi() explicitly;
it is run b... |
import os
import re
import subprocess
import sys
from collections import defaultdict
from Bio import Entrez
from Bio import SeqIO
from PyQt5 import QtWidgets, QtCore
from PyQt5.QtCore import Qt
from PyQt5.QtGui import QDesktopServices
from PyQt5.QtWidgets import QMessageBox
from gaosb.gui.mainwindow import Ui_MainWin... |
# -*- coding: UTF-8 -*-
# globalPlugins/mp3DirectCut/mp3DirectCutDialog.py.
# Copyright 2017-2018 Abdelkrim Bensaïd and other contributors, released under gPL.
#This file is covered by the GNU General Public License.
#See the file COPYING for more details.
import addonHandler
import config
import wx
import os
import... |
# Copyright 2016 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... |
from time import clock
def timer(function):
def wrapper(*args, **kwargs):
start = clock()
print(function(*args, **kwargs))
print("Solution took: %f seconds." % (clock() - start))
return wrapper
@timer
def find_answer():
total = 0
primes = sieve(1000000)
primes.remove(0)
... |
from vector import Vector
class Config:
"""
Configuration - mostly the (relative) position of various screen elements
"""
# TODO: Work this out dynamically
tabletop_size = Vector(1368, 768)
scaling_factor = 1
card_size = Vector(100, 120)
card_spacing = 10
column_width = card_si... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django import forms
from django.conf import settings
from django.contrib.auth import password_validation
from django.utils.translation import ugettext as _, ugettext_lazy
from modoboa.core.password_hashers import get_dovecot_schemes
from modoboa.co... |
import os, struct
from array import array
import numpy as np
import random, math
TRAIN_FILE_NAME = 'train-images.idx3-ubyte'
def read(dataset = "training", path = "."):
"""
Python function for importing the MNIST data set.
"""
if dataset is "training":
fname_img = os.path.join(path, 'train... |
"""
koan = kickstart over a network
general usage functions
Copyright 2006-2008 Red Hat, Inc.
Michael DeHaan <mdehaan@redhat.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 Foundation; either version 2 of ... |
###
# Copyright 2008-2011 Diamond Light Source Ltd.
# This file is part of Diffcalc.
#
# Diffcalc 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 late... |
from PIL import Image, ImageDraw
import StringIO
def sparkline(points, point=None, height=15*2, width=40*2, bubble=2*2, linewidth=1.5*2, margin=5*2, scalefactor=5):
margin *= scalefactor
height *= scalefactor
width *= scalefactor
bubble *= scalefactor
im = Image.new("RGBA", (width, height), (0... |
import os
import sys
sys.path.append('../..')
import numpy
from anna import util
from anna.datasets import supervised_dataset
from models import CNNModel
print('Start')
pid = os.getpid()
print('PID: {}'.format(pid))
f = open('pid', 'wb')
f.write(str(pid)+'\n')
f.close()
model = CNNModel('experiment', './', learni... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
import os
import matplotlib.pyplot as plt
import keras.backend as K
from keras.datasets import mnist
from keras.layers import *
from keras.models import *
from keras.optimizers import *
from keras.initializers import *
from keras.utils.generic_utils import Progbar
GPU = "0"... |
###################################################################
# This file is a modification of the file "__init__.py" from the #
# RPi Telecine project. I've included that project's header and #
# copyright below. #
##############################################... |
import copy
from collections import OrderedDict
from mongoengine import fields as me_fields
from mongoengine.errors import ValidationError as me_ValidationError
from rest_framework import fields as drf_fields
from rest_framework import serializers
from rest_framework.compat import unicode_to_repr
from rest_framework.u... |
import dpath.util
def test_set_existing_separator():
dict = {
"a": {
"b": 0,
},
}
dpath.util.set(dict, ';a;b', 1, separator=";")
assert(dict['a']['b'] == 1)
dict['a']['b'] = 0
dpath.util.set(dict, ['a', 'b'], 1, separator=";")
assert(dict['a']['b'] == 1)
def... |
"""
Base graph objects
"""
from evh.base import EvHandler,EvStack
from math import *
class Drawable(object):
"""
Base class for drawable objects.
"""
def __init__(self,x,y,scale=1.0):
self.x=x
self.y=y
self.scale=scale
def Draw(self,ctx):
ctx.save()
ctx.sca... |
import numpy
import pylab
from scipy.optimize import curve_fit
import math
import scipy.stats
V, dV, I, dI = pylab.loadtxt("data00.txt", unpack="True")
#Best fit analitico
#Dy e Dx sono le colonne di errori
x = V
Dx = dV
y = I
Dy = dI
#set error an statistical weight
sigma = Dy
w = 1/(sigma**2)
#determine the coeff... |
#!/usr/bin/env python
import hashlib
import os
import sys
from datetime import datetime
HASH = hashlib.md5(str(datetime.now())).hexdigest()
def normalize(path, file_func=None, dir_func=None):
''' recursive normalization of directory and file names
applies the following changes to directory and filenames... |
from raptiformica.actions.slave import assimilate_machine
from tests.testcase import TestCase
class TestAssimilateMachine(TestCase):
def setUp(self):
self.log = self.set_up_patch('raptiformica.actions.slave.log')
self.download_artifacts = self.set_up_patch('raptiformica.actions.slave.download_arti... |
import json
from collections import OrderedDict
import execInstructionsProcedural as instruction
class Parser():
def parseJson(self, jsonFile):
with open("instruction.json", "w") as text_file:
text_file.write(jsonFile)
# Loads the Json file in a OrderedDict
parsed_json = json... |
import unittest
from StringIO import StringIO
from py64.loaders.prg import Loader
class PrgTest(unittest.TestCase):
def setUp(self):
file_bytes = StringIO(
'\x01\x08\x0f\x08\xcf\x07\x9e\x32\x30\x36\x35\x20\x41\x42\x43\x00'
)
self.file_name = 'TestFileName.PRG'
self.l... |
#! /usr/bin/env python
"""
Netconfig tool
Copyright 2011 Red Hat, Inc.
Licensed under the GNU General Public License, version 2 as
published by the Free Software Foundation; see COPYING for details.
"""
__author__ = """
jpirko@redhat.com (Jiri Pirko)
"""
import getopt
import sys
import logging
import re
import os
fr... |
# -*- coding: utf-8 -*-
"""
willie-trello.py - Enhanced Trello links
Licensed under the GNU GPLv3
Copyright (C) 2015 Kieran Peckett
"""
import willie.module
import requests
import time
import re
def setup(bot):
regex = re.compile(r".*\bhttps?://trello\.com/c/(\w+).*")
if not bot.memory.contains('url_callbacks'):
b... |
# vim: set ts=2 expandtab:
# -*- coding: utf-8 -*-
"""
Module: Emulator.py
Desc: pass keypresses to a game emultor or something.
Author: on_three
Email: on.three.email@gmail.com
DATE: Thursday, Jan 16th 2014
"""
import string
import re
from twisted.python import log
from controls import Key
class Emulator(object)... |
"""
Contains classes controlling wizards for making new maps
"""
import tkinter as tk
import mathsmap.colours as colours
class Wizard:
"""
A base class for all wizards in this project
"""
def clear(self):
"""
Remove all current widgets from top level of wizard
"""
for c... |
'''Process the token HTML and TXT files.'''
import re
import string
import lxml.html
import collections
import pprint
import textwrap
HTML_DB_FILENAMES = tuple(
['token_!.html', 'token_0-9.html'] +
['token_{}.html'.format(char) for char in string.ascii_lowercase]
)
TokenMetadata = collections.namedtupl... |
"""
Django's standard crypto functions and utilities.
"""
import hashlib
import hmac
import secrets
import warnings
from django.conf import settings
from django.utils.deprecation import RemovedInDjango40Warning
from django.utils.encoding import force_bytes
class InvalidAlgorithm(ValueError):
"""Algorithm is not ... |
#!usr/bin/python
# -*- coding:utf-8 -*-
import pandas as pd
import numpy as np
import scipy as sp
import os
import random
import time
import sys
def append_module_path():
import sys
paths = [ \
"../gen_data",
"../evaluate",
"../read_data"
]
for path in paths:
if pa... |
#! /bin/bin/env python
# -*- coding: utf-8 -*-
"""
"""
from __future__ import with_statement
import ConfigParser
import os
import time
import datetime
import logging
from .config import DATE_FORMAT
from . import paths
_logger = logging.getLogger('vmchecker.submissions')
def get_time_struct_from_str(time_str):
... |
# 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 ... |
# coding=utf-8
# Copyright 2019 The Authors of RL Reliability Metrics.
#
# 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 b... |
import random
from canari.maltego.transform import Transform
from canari.maltego.entities import URL
from canari.framework import EnableDebugWindow
from common.entities import NettackerScan
from lib.scan.wp_xmlrpc.engine import start
from database.db import __logs_by_scan_id as find_log
__author__ = 'Shaddy Garg'
_... |
import Image
import colorsys
import glob
import os
start_dir = "../images/pokemonParts/"
end_dir = "../images/croppedPokeParts/"
file = open("data.txt",'w')
def findCrop(xdir):
if not os.path.exists(xdir):
xdir = start_dir+xdir
filedir = os.path.split(xdir)
ydir = end_dir+os.path.split(filedir[0])... |
# Copyright 2015 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... |
"""
Processors are little transformation blocks that transform the fragments list
from a buffer before the BufferControl will render it to the screen.
They can insert fragments before or after, or highlight fragments by replacing the
fragment types.
"""
import re
from abc import ABCMeta, abstractmethod
from typing imp... |
# -*- coding: utf-8 -*-
# © <YEAR(S)> <AUTHOR(S)>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from openerp import _, api, fields, models
from openerp.exceptions import ValidationError
class AccountInvoice(models.Model):
_inherit = 'account.invoice'
factoraje_v2 = fields.Boolean(
... |
"""
Invoke tasks to be run from the command line.
"""
import os
from invoke import task
from eptools import talks, people
from eptools.gspread_utils import get_api_key_file
from eptools.config import (
conference,
sponsors_billing_worksheet,
finaid_submissions_worksheet
)
@task
def sponsor_agreement(ctx,... |
#-------------------------------------------------------------------------
# Copyright (c) Microsoft. 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.apa... |
import json
class MyStack: # just an implementation of a queue
def __init__(self):
self.elements = []
def push(self,val):
self.elements.append(val)
def pop(self):
val = None
try:
val = self.elements[len(self.elements) - 1]
if len(self.elements) == 1:
self.elements = []
else:
self.element... |
#!/usr/bin/env python
#
# Copyright (c) 2009-2013, Luke Maurits <luke@maurits.id.au>
# All rights reserved.
# With contributions from:
# * Chris Clark
# * Klein Stephane
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:... |
# Copyright (c) 2012 Midokura Japan K.K.
#
# 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 l... |
# encoding: utf-8
"""
Run Fiji is just ImageJ macros headless with python.
"""
import pydebug, subprocess, os, re
from tempfile import mkstemp
import fijibin
# debug with DEBUG=fijibin python script.py
debug = pydebug.debug('fijibin')
##
# Running macros
##
def run(macro, output_files=[], force_close=True):
"""
... |
#!/usr/bin/python
#
# Copyright 2012 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 required b... |
'''
Count Syllables v1.0
A simple class to count syllables using a dictionary method
This class will attempt to calculate syllables of words not found in dictionary
'''
class CountSyllables(object):
... |
# -*- Mode: python; tab-width: 4; indent-tabs-mode:nil; coding:utf-8 -*-
# vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4
#
# MDAnalysis --- http://www.mdanalysis.org
# Copyright (c) 2006-2016 The MDAnalysis Development Team and contributors
# (see the file AUTHORS for the full list of names)
#
# Released under t... |
"""Flask and other extensions instantiated here.
To avoid circular imports with views and create_app(), extensions are instantiated here. They will be initialized
(calling init_app()) in application.py.
"""
from logging import getLogger
from flask import current_app
from flask.ext.sqlalchemy import SQLAlchemy
from s... |
# This file is part of EventGhost.
# Copyright (C) 2005 Lars-Peter Voss <bitmonster@eventghost.org>
#
# EventGhost is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (a... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
#############################################################################
##
## Copyright (C) 2016 The Qt Company Ltd.
## Contact: https://www.qt.io/licensing/
##
## This file is part of the test suite of PySide2.
##
## $QT_BEGIN_LICENSE:GPL-EXCEPT$
## Commercial Lice... |
#!/usr/bin/env python
__author__ = 'Adam R. Smith, Michael Meisinger'
import uuid
import os
import logging
import sys
from ooi.logging import log
from pyon.core import log as logutil
import pyon
# NOTE: no other imports inside pyon
# @WARN: GLOBAL STATE
# ----------------------------------------------------------... |
# -*- coding: utf-8 -*-
#
# This file is part of INSPIRE.
# Copyright (C) 2014, 2015 CERN.
#
# INSPIRE 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... |
# ----------------------------------------------------------------------------
# Copyright (c) 2016-2019, QIIME 2 development team.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file LICENSE, distributed with this software.
# ------------------------------------------------... |
"""
This module is always imported during Maya's startup. It is imported from
both the maya.app.startup.batch and maya.app.startup.gui scripts
"""
import atexit
import os.path
import sys
import traceback
import maya
import maya.app
import maya.app.commands
from maya import cmds, utils
def setupScriptPaths():
"""
... |
from tek.errors import TException
class ConfigError(TException):
pass
class NoSuchOptionError(ConfigError):
def __init__(self, key):
super(NoSuchOptionError, self).__init__('No such config option: %s' % key)
class DuplicateDefaultError(ConfigError):
def __init__(self, key):
super(Du... |
"""Example reboot device test with GDM + unittest.
Usage:
python3 unittest_example_test.py -d somedevice-1234
See README.md for more details.
"""
import argparse
import logging
import sys
from typing import List, Tuple
import unittest
import gazoo_device
# If using a device controller from an extension package:
#... |
# -*- coding: utf-8 -*-
'''
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 program is dis... |
# -*- coding: utf-8 -*-
# TODO: this is just stuff from utils.py - should be splitted / moved
from django.conf import settings
from django.core.files.storage import get_storage_class
from django.utils.functional import LazyObject
from cms import constants
from cms.utils.conf import get_cms_setting
from cms.utils.conf ... |
#!/usr/bin/python
#
# Copyright 2014 Marta Rodriguez.
#
# 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... |
# Principal Component Analysis Code :
from numpy import mean,cov,double,cumsum,dot,linalg,array,rank,size,flipud
from pylab import *
import numpy as np
import matplotlib.pyplot as pp
#from enthought.mayavi import mlab
import scipy.ndimage as ni
import roslib; roslib.load_manifest('sandbox_tapo_darpa_m3')
import ro... |
# coding: spec
from harpoon.errors import FailedImage, BadImage, AlreadyBoundPorts, ProgrammerError
from harpoon.option_spec.harpoon_specs import HarpoonSpec
from harpoon.ship.runner import Runner
from tests.helpers import HarpoonCase
from delfick_project.option_merge import Converter, MergedOptions
from delfick_pro... |
#!/usr/bin/env python
from textcad import *
import magpie.utility
import magpie.hardware
class Stepper(component.Element):
def __init__(self,
size="GenericNEMA17",
negative=False,
negativeLength=10):
component.Element.__init__(self, name="stepper")
... |
# -*- coding: utf-8 -*-
"""Tests for cihai.
test.conversion
~~~~~~~~~~~~~~~
"""
from __future__ import absolute_import, print_function, unicode_literals
from cihai import conversion
from cihai._compat import string_types, text_type
def test_text_type():
c1 = '(same as U+7A69 穩) firm; stable; secure'
c2 = ... |
'''
This is the instruction data grabbed from the Instruction Set Summary table
in the Pic data sheet for an enhanced midrange (14bit) processor such as the
16f1826 or 12f1822. This is used to initialize the decoder.
fields:
mnemonic
arguments
description
cycles
opcode format
status bits affe... |
import json
from flask import render_template, flash, redirect, url_for, request, abort
from flask_login import login_required, login_user, logout_user, current_user
from thermos import app, db, login_manager
from forms import BookmarkForm, LoginForm, SignupForm
from models import User, Bookmark, Tag
@login_manager... |
"""Testing for inesrt sort."""
from radix_sort import radix
import pytest
from random import randint
TEST_PARAMS = [
([i for i in range(50)]),
([randint(1, 500) for i in range(50)]),
([5, 9, 1, 2, 6])
]
PARAMS_TABLE = [
([234, 23, 52, 66], [23, 52, 66, 234]),
([4, 3, 2, 1], [1, 2, 3, 4]),
([... |
from klampt import *
from klampt.io import loader,resource
from klampt.math import se3
from klampt.model.trajectory import Trajectory,RobotTrajectory
from klampt.model.multipath import MultiPath
from klampt.model import types
from klampt import vis
from klampt.vis.qtbackend import QtGLWindow
from klampt.vis.glcommon im... |
#!/usr/bin/env python
import argparse
import os
from datetime import datetime
class Tag:
DATE_FMT = '%a %m/%d/%y %I:%M%p'
def __init__(self, string=None, label=None, timestamp=None):
if string is not None:
temp = string.strip().split(maxsplit=1)
self.datetime = datetime.fromtimestamp(int(temp[... |
# -*- 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
#... |
from sys import modules
from core import Element as Element
class js(Element):
tag = 'js'
def __init__(self, script='', url=''):
if script:
self.format = '<script type="text/javascript">%s</script>' % script
elif url:
self.format = '<script type="text/javascript" src="%... |
import logging
from rest_framework.generics import GenericAPIView, ListCreateAPIView
from rest_framework.response import Response
from .models import FlashCard
from .serializers import FlashCardSerializer
LOG = logging.getLogger(__name__)
class ListAddFlashCards(ListCreateAPIView):
model = FlashCard
serialize... |
# 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 ... |
"""
Given an array S of n integers, are there elements a, b, c, and d in S such that a + b + c + d = target? Find all unique quadruplets in the array which gives the sum of target.
Note: The solution set must not contain duplicate quadruplets.
For example, given array S = [1, 0, -1, 0, -2, 2], and target = 0.
... |
from .. import Backend
import pytest
backends = []
for bk in Backend.backends.keys():
try:
_be = Backend(bk)
except ImportError:
continue
_x = _be.Symbol('x')
try:
_be.cse([_x])
except:
continue
backends.append(bk)
def _inverse_cse(subs_cses, cse_exprs):
... |
"""
Mailchimp v3 Api SDK
"""
from mailchimp3.mailchimpclient import MailChimpClient
from mailchimp3.entities.authorizedapp import AuthorizedApp
from mailchimp3.entities.automation import Automation
from mailchimp3.entities.message import Message
from mailchimp3.entities.campaign import Campaign
from mailchimp3.entitie... |
#!/usr/bin/env python
# Try to determine how much RAM is currently being used per program.
# Note per _program_, not per process. So for example this script
# will report RAM used by all httpd process together. In detail it reports:
# sum(private RAM for program processes) + sum(Shared RAM for program processes)
# The... |
from functools import wraps
from django.core.exceptions import PermissionDenied
from flash.models import Deck
from flash.services import has_role_with_request
def check_role(roles, entity_type):
"""
A decorator that checks to see if a user has the required role in a collection.
Allows the user to enter t... |
# -*- coding: utf-8 -*-
# Copyright (C) 2015 Patrick Happel <patrick.happel@rub.de>
#
# This file is part of pySICM.
#
# pySICM 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, ... |
from csrv.model import actions
from csrv.model import timing_phases
from csrv.model.cards import card_info
from csrv.model.cards import event
class ChooseUnrezzedIce(timing_phases.BasePhase):
"""Choose unrezzed ice to force the corp to rez or trash it."""
DESCRIPTION = 'Choose unrezzed ice to force the corp to r... |
from __future__ import division
import base64
import random
import re
import sys
import time
from twisted.internet import defer
from twisted.python import log
import bitcoin.getwork as bitcoin_getwork, bitcoin.data as bitcoin_data
from bitcoin import helper, script, worker_interface
from util import forest, jsonrpc,... |
#!/usr/bin/env python
# Copyright 2017 F5 Networks 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... |
# -*- coding: utf-8 -*-
from __future__ import with_statement
import os
from fabric import api as fab
from fabric.contrib.files import uncomment, comment
from ..base import _
from ..utils import render_template, upload_template
from ..deployment import command
class DjangoProject(object):
namespace = 'django'
... |
from __future__ import absolute_import
from __future__ import print_function
__author__ = 'noe'
import time
import numpy as np
from .. import moments
def genS(N):
""" Generates sparsities given N (number of cols) """
S = [10, 90, 100, 500, 900, 1000, 2000, 5000, 7500, 9000, 10000, 20000, 50000, 75000, 90000] ... |
#
# Copyright (C) 2008 Cournapeau David <cournape@gmail.com>
#
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# ... |
__author__ = "Christian Kongsgaard"
__license__ = 'MIT'
# -------------------------------------------------------------------------------------------------------------------- #
# IMPORTS
# Modules
import pandas as pd
import matplotlib.pyplot as plt
# RiBuild Modules
# -----------------------------------------------... |
#!/usr/bin/python
import sys
import os
import tempfile
import gobject
import gtk
import socket
import shm
import threading
import time
import struct
import cairo
import array
import cPickle as pickle
import message
import config
#gtk.gdk.threads_init()
def olog(str):
olog_nonl(str + "\n")
def olog_nonl(str):
... |
# Copyright (C) 2002-2005 Stephen Kennedy <stevek@gnome.org>
# Copyright (C) 2010, 2012-2013 Kai Willadsen <kai.willadsen@gmail.com>
# 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... |
# Alexandre's backup script
# Copyright © 2014 Alexandre A. de Verteuil
#
# 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/python
import sys
import os
from mininet.topo import Topo
from mininet.node import CPULimitedHost
from mininet.link import TCLink
from mininet.net import Mininet
from mininet.log import lg, info
from mininet.util import dumpNodeConnections
from mininet.cli import CLI
from mininet.util import pmonitor
from s... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.