src stringlengths 721 1.04M |
|---|
__doc__="functions for analysis of text by isolated functionalities \
or analysis and rendering roadmaps"
def measureAll(authors_texts,sectorialized_agents):
"""Overall text analysis routine, uses all resources
Uses: P.text.aux.textFromAuthors()
P.text.aux.textFromSectors()
Used by: P.re... |
#!/usr/bin/env python
# encoding: 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, Vers... |
# -*- Mode: python; tab-width: 4; indent-tabs-mode:nil; coding:utf-8 -*-
# vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4 fileencoding=utf-8
#
# MDAnalysis --- https://www.mdanalysis.org
# Copyright (c) 2006-2017 The MDAnalysis Development Team and contributors
# (see the file AUTHORS for the full list of names)
#... |
import datetime
from django.test import TestCase
from django.utils.timezone import get_current_timezone
from factory.fuzzy import FuzzyChoice
from freezegun import freeze_time
from django.urls import reverse
from django.core.management import call_command
from fixturedb.factories.win import create_win_factory
from... |
from google.appengine.ext import webapp
from google.appengine.ext.webapp.util import run_wsgi_app
from model import FreebieItem, Distributor, Contributor
import datetime
import logging
head = '''
<html>
<head>
<title>%s</title>
<script src="/static/sorttable.js"></script>
<style>
body {
background-c... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright 2008-2010 Zuza Software Foundation
#
# This file is part of translate.
#
# translate 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 ... |
#!/usr/bin/env python
from graphitesend import graphitesend
import unittest
import socket
import os
class TestAll(unittest.TestCase):
""" Basic tests ( better than nothing ) """
def setUp(self):
""" reset graphitesend """
# Drop any connections or modules that have been setup from other test... |
import datetime
import pytest
from channels.testing import WebsocketCommunicator
from alarms.collections import AlarmCollection
from ias_webserver.routing import application as ias_app
from ias_webserver.settings import PROCESS_CONNECTION_PASS
class TestCoreConsumer:
"""This class defines the test suite for the C... |
import zmq,json,time
import pygame
import RPi.GPIO as GPIO
pygame.mixer.init()
GPIO.setmode(GPIO.BCM)
GPIO.setup(25,GPIO.OUT)
GPIO.setup(8,GPIO.OUT)
GPIO.output(25,0)
GPIO.output(8,0)
entradas={"puerta":17,"ventanaCocina":27,"ventanaDormitorio":22}
for entrada in entradas.values():
GPIO.setup(entrada,GPIO.IN,pull_u... |
# encoding: utf-8
#
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this file,
# You can obtain one at http:# mozilla.org/MPL/2.0/.
#
# Contact: Kyle Lahnakoski (kyle@lahnakoski.com)
#
from __future__ import absolute_import, divisi... |
import numpy as np
import theano
import theano.tensor as T
import mlbase.networkhelper as N
import h5py
from theano.scalar.basic import UnaryScalarOp, same_out_nocomplex
from theano.tensor.elemwise import Elemwise
class BinaryOp(UnaryScalarOp):
def c_code(self, node, name, x1, z1, sub):
x = x1[0]
... |
''' @ author: James Ghawaly Jr.
@ version: 1.2
'''
import numpy
import os
class HexCore():
def __init__(self,side,hexSpace,coreRadius,coreHeight,rodRadius,rodHeight,radiusLimiter):
# generics
self.surfaceNumber = 0
self.cellNumber = 0
self.materNumber = 0
self.cente... |
# ----------------------------------------------------------------------------
# pyglet
# Copyright (c) 2006-2007 Alex Holkner
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# * Redistributi... |
from yambopy import *
import numpy as np
import shutil
import os
from netCDF4 import Dataset
def abs2(x):
return x.real**2 + x.imag**2
class YamboWFDB():
def __init__(self,savedb,path=None,save='SAVE',filename='ns.wf'):
"""
load wavefunction from yambo
"""
if path is None:
... |
# 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... |
#!/usr/bin/python
#coding: utf-8 -*-
# (c) 2016, Mathieu Bultel <mbultel@redhat.com>
# (c) 2016, Steve Baker <sbaker@redhat.com>
#
# This module 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 ... |
## begin license ##
#
# "Digitale Collectie ErfGeo Enrichment" is a service that attempts to automatically create
# geographical enrichments for records in "Digitale Collectie" (http://digitalecollectie.nl)
# by querying the ErfGeo search API (https://erfgeo.nl/search).
# "Digitale Collectie ErfGeo Enrichment" is devel... |
"""Base classes for Builders."""
import logging
import os
import shutil
from functools import wraps
from readthedocs.projects.models import Feature
log = logging.getLogger(__name__)
def restoring_chdir(fn):
# XXX:dc: This would be better off in a neutral module
@wraps(fn)
def decorator(*args, **kw):
... |
#!/usr/bin/env python
# -*- encoding: utf-8 -*-
################################################################################
# #
# Copyright (C) 2013-Today Carlos Eduardo Vercelino - CLVsol #
# ... |
from core.himesis import Himesis
class HepackagelefteAnnotationsSolveRefEPackageEAnnotationEPackageEAnnotation(Himesis):
def __init__(self):
"""
Creates the himesis graph representing the AToM3 model HepackagelefteAnnotationsSolveRefEPackageEAnnotationEPackageEAnnotation.
"""
# Fl... |
#!/usr/bin/env python
import StringIO
from camel import Camel
from InventoryFilter import InventoryFilter
from InventoryProviders import get_all_drivers
class GenericInventory(InventoryFilter):
def __init__(self):
InventoryFilter.__init__(self)
self.filter_classes = get_all_drivers()
def g... |
"""
SALTS XBMC Addon
Copyright (C) 2014 tknorris
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.
T... |
import unittest
import mock
from crawler.src.controllers.worker import ParticipantsWorker
import webapp2
import webtest
from google.appengine.ext import testbed
import logging
logger = logging.getLogger()
logger.setLevel(logging.DEBUG)
class ParticipantsWorkerTests(unittest.TestCase):
def setUp(self):
se... |
#coding: utf-8
charlist = {}
char = []
into = False
enc = 0
for l in file('ter-u12n.bdf', 'r').readlines():
l = l.strip()
if into:
if l == 'ENDCHAR':
charlist[enc] = char
# print char
char = []
into = False
else:
char += [int(l, 16)]
... |
#!/usr/bin/env python
import os
import sys
import subprocess
import django
from coverage import coverage
from django.conf import settings
from django.test.utils import get_runner
FLAKE8_ARGS = ['mailtrail', 'tests/', '--ignore=E501']
def exit_on_failure(command, message=None):
if command:
sys.exit(comma... |
# -*- 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 o... |
import random
import numpy as np
from PIL import Image, ImageEnhance
class RandomEnhance():
"""
Class to randomly enhance image by adjusting color, contrast, sharpness and
brightness
"""
def __init__(self, seed=None, p=1.0, intensity=0.5):
"""
Initialises an instance.
Pa... |
"""posts table
Revision ID: 780739b227a7
Revises: e517276bb1c2
Create Date: 2017-09-11 12:23:25.496587
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '780739b227a7'
down_revision = 'e517276bb1c2'
branch_labels = None
depends_on = None
def upgrade():
# ##... |
from django.conf import settings
import re
# this is not intended to be an all-knowing IP address regex
IP_RE = re.compile('\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}')
def get_ip(request):
"""
Retrieves the remote IP address from the request data. If the user is
behind a proxy, they may have a comma-separated l... |
from django.db import models
class Poll(models.Model):
id = models.AutoField(primary_key=True)
title = models.CharField(blank=True, null=True, max_length=255)
message = models.TextField(blank=True, null=True)
select = models.IntegerField(blank=True, null=True)
type = models.IntegerField(blank=True... |
# Project Euler Problem 12
# Created on: 2012-06-15
# Created by: William McDonald
import math
# Short list of prime numbers under 20
primeList = [2, 3, 5, 7, 9, 11, 13, 17, 19]
last = 21
# Returns True if n is prime, otherwise False
def isPrime(n):
prime = True
for i in primeList:
if n % i == 0:
... |
my_name = "Alex Liew"
my_age = 25 # this is no lie
my_height = 174 # cm
my_weight = 65 # kg
my_eyes = 'Brown'
my_teeth = 'White'
my_hair = 'Black'
print("Let's talk about {0}.".format(my_name))
print("He's {0} centimeters tall.".format(my_height))
print("He's {0} kilograms heavy.".format(my_weight))
print("Actually th... |
from datetime import timedelta
from django.core.exceptions import ValidationError
from django.db.models import Count, Max, OuterRef, Subquery
from django.template.defaultfilters import floatformat
from django.urls import reverse
from django.utils.html import format_html
from django.utils.safestring import mark_safe
fr... |
#! /usr/bin/env python2
import pgdb
import time
import sys
db = pgdb.connect(database="wahl")
fs_wahl = 2
berechtigte = {}
berechtigte[0] = 22552
berechtigte[1] = 22552 # StuPa
berechtigte[2] = 0 # FS
berechtigte[3] = 3543 # Auslaender
berechtigte[4] = 5998 # Frauen
fs_berechtigte = {}
fs_berechtigte['bau'] = ... |
from collections import namedtuple
import pytest
from pk.share import (
Permission,
UserGroupAccess,
ShareableObject,
set_delimiter,
UserGroupAccessMerge,
merge,
PUBLIC_ACCESS_INHERITED,
validate_args,
validate_data_access
)
from pk.common.exceptions import PKClientException
clas... |
# -*- coding: utf-8 -*-
"""
GUI Code
"""
import LinkGPIB
import pyqtgraph as pg
from pyqtgraph.Qt import QtGui, QtCore
from pyqtgraph.widgets.RemoteGraphicsView import RemoteGraphicsView
import numpy as np
from time import sleep, strftime
## Constants
versionTxt = 'CellShot V2.6.3'
observerModel = 2602 #2461
sourceMo... |
import subprocess
import os
import time
import traceback
import sys
class Installer:
############################################################
# install_software
############################################################
def install_software(self):
if self.benchmarker.install == 'all' or self.benchma... |
##
# Copyright (c) 2006-2015 Apple 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 by applicable l... |
# encoding: utf-8
"""Graphic Frame shape and related objects.
A graphic frame is a common container for table, chart, smart art, and media
objects.
"""
from pptx.enum.shapes import MSO_SHAPE_TYPE
from pptx.shapes.base import BaseShape
from pptx.shared import ParentedElementProxy
from pptx.spec import (
GRAPHIC_D... |
# -*- coding: utf-8 -*-
from django.conf import settings
from django.test import TestCase, override_settings
from django.db.migrations.autodetector import MigrationAutodetector
from django.db.migrations.questioner import MigrationQuestioner
from django.db.migrations.state import ProjectState, ModelState
from django.db.... |
#!/usr/bin/env python
# *
# * Copyright (C) 2012-2013 Garrett Brown
# * Copyright (C) 2010 j48antialias
# *
# * 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, or (... |
from setuptools import setup, find_packages
with open('trix/version.py') as f:
code = compile(f.read(), "trix/version.py", 'exec')
exec(code)
setup(
name='trix',
description='Next generation Trix. Detailed task control and statistics app for better'
' learning outcome.',
version=__version__, ... |
import copy
import test_MySql
try:
from nive.utils.dataPool2.mySqlPool import *
except:
pass
def sqlquery4(n):
pool = MySql(test_MySql.conf)
pool.SetStdMeta(copy.copy(test_MySql.stdMeta))
pool.GetPoolStructureObj().SetStructure(test_MySql.struct)
pool.CreateConnection(test_MySql.conn)
... |
# coding: utf-8
#
# Copyright 2010-2014 Ning, Inc.
# Copyright 2014-2020 Groupon, Inc
# Copyright 2020-2021 Equinix, Inc
# Copyright 2014-2021 The Billing Project, LLC
#
# The Billing Project, LLC licenses this file to you under the Apache License, version 2.0
# (the "License"); you may not use this file except in com... |
"""
Author: Mohammed Fahad Kaleem
Problem: Find the nth node from the end of Linked List
Method:
Maintain two pointers
1. Reference pointer and main pointer.
2. Initialize both reference and main pointers to head.
3. First move reference pointer to n nodes from head.
4. Move both pointers one by one until reference ... |
import resources.lib.util as util
import re
from BeautifulSoup import BeautifulSoup
from BeautifulSoup import BeautifulStoneSoup
from BeautifulSoup import SoupStrainer
class SiteApi():
MAIN_URL = 'http://www.india4movie.com/'
LONG_NAME = 'India 4 Movie'
def get_menu_category(self):
... |
import pytest
from numpy.testing import assert_equal
from spacy.attrs import DEP
from spacy.lang.en import English
from spacy.training import Example
from spacy.tokens import Doc
from spacy import util
from ..util import apply_transition_sequence, make_tempdir
TRAIN_DATA = [
(
"They trade mortgage-backe... |
# coding: utf-8
"""
Qc API
Qc API # noqa: E501
The version of the OpenAPI document: 3.0.0
Contact: cloudsupport@telestream.net
Generated by: https://openapi-generator.tech
"""
from __future__ import absolute_import
import unittest
import datetime
import telestream_cloud_qc
from telestream_cl... |
# Copyright (C) 2015 Research and Innovation Advanced Network New Zealand Ltd.
# Copyright (C) 2015--2018 The Contributors
#
# 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.ap... |
# -*- coding: utf-8 -*-
"""
Copyright (C) 2014-2016 bromix (plugin.video.youtube)
Copyright (C) 2016-2018 plugin.video.youtube
SPDX-License-Identifier: GPL-2.0-only
See LICENSES/GPL-2.0-only for more information.
"""
from six.moves import html_parser
from .base_item import BaseItem
class AudioItem... |
import model
from utils import *
import data
with status("Loading n-gram model..."):
n = 5
ngram_db_path = "ngram_db_{}.npz".format(n)
train_test_divider = int(len(data.lengths) * 0.80)
try:
npzfile = np.load(ngram_db_path)
ngram_dataset = npzfile["ngram_dataset"]
ngram_probability_table = npzfil... |
#
# 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.
#
# Written (W) 2006-2007 Soeren Sonnenburg
# Written (W) 2007 Gunna... |
import numpy, math, cmath, scipy.interpolate, scipy.integrate, argparse
from ROOT import *
class MatterDensityContrast(object):
"""
Object defining a matter cosmological density contrast.
The field is just defined according to a gaussian random field. Not precise, but fast for testing.
The algorithm is as follows:... |
import matplotlib.pyplot as plt
import os
import csv
import pickle
import operator
import numpy as np
from numpy.linalg import svd, qr
from scipy.spatial.distance import cosine
from scipy.sparse.linalg import svds
class Word2vecMF(object):
def __init__(self):
"""
Main class for working with w... |
"""
"""
import os
from .const import *
from . import table, area
from . import basic, input, button
from . import pguglobals
class Dialog(table.Table):
"""A dialog window with a title bar and an "close" button on the bar.
Example:
title = gui.Label("My Title")
main = gui.Container()
#add stuff to the contai... |
#!/usr/bin/env python3
import argparse
import csv
import os
import pathlib
from collections import OrderedDict
from datetime import datetime, timedelta
from time import sleep
import yaml
import sqlalchemy as sqa
import serial
from serial.tools import list_ports
import logging
logging.basicConfig()
logger = logging.... |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (c) 2011-2012, Code Aurora Forum. 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 a... |
'''
Copyright (c) 2015, Salesforce.com, Inc.
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 notice, this list of conditions and the foll... |
#!/usr/bin/python
# -*- encoding: utf-8 -*-
###############################################################################
# Module Writen to OpenERP, Open Source Management Solution
# Copyright (C) OpenERP Venezuela (<http://www.vauxoo.com>).
# All Rights Reserved
############# Credits ######################... |
from PIL import ImageDraw, Image
from SyntheticDataset2.ElementsCreator import Shape
class Cross(Shape):
def __init__(self, height, color, rotation):
"""
Initialize a Cross shape
:param height: height in pixels
:type height: int
:param color: color of shape - RGB
:... |
from asap3 import *
from ase import units
from ase.lattice.cubic import FaceCenteredCubic
import numpy as np
import matplotlib.pyplot as plt
import time
repeat = 25
AsapThreads()
#set_verbose(1)
atoms = FaceCenteredCubic(size=(50,50,50), symbol='Cu')
atoms.set_calculator(EMT())
lgv = Langevin(atoms, 5*units.fs, 0.0... |
# -*- coding: utf-8 -*-
#
# pyssf documentation build configuration file, created by
# sphinx-quickstart on Fri Feb 25 10:29:07 2011.
#
# This file is execfile()d with the current directory set to its containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
# All c... |
# -----------------------------------------------------------------------------
# Copyright (c) 2014--, The Qiita Development Team.
#
# Distributed under the terms of the BSD 3-clause License.
#
# The full license is in the file LICENSE, distributed with this software.
# ------------------------------------------------... |
# -*- encoding: utf-8 -*-
##############################################################################
#
# Account Cut-off Prepaid module for OpenERP
# Copyright (C) 2013 Akretion (http://www.akretion.com)
# @author Alexis de Lattre <alexis.delattre@akretion.com>
#
# This program is free software: you can... |
from __future__ import (absolute_import, division,
print_function, unicode_literals)
class Slit:
def __init__(self, x, y, length, width, pa, name):
'''
Representation of a slit in a mask. Coordinates are relative to the mask, so that
the x-axis is along the lon... |
# $Id: forms.py ef5633b6df44 2009/09/06 14:08:22 jpartogi $
from django import forms
from django.forms import ModelForm
from django.utils.translation import ugettext as _
from contact_form.models import Message, Subject
# Override the labels
class ContactForm(ModelForm):
sender_name = forms.CharField(label=_('You... |
import pytest
from svg.path import parser
PATHS = [
(
"M 100 100 L 300 100 L 200 300 z",
[("M", "100 100"), ("L", "300 100"), ("L", "200 300"), ("z", "")],
[("M", 100 + 100j), ("L", 300 + 100j), ("L", 200 + 300j), ("z",)],
),
(
"M 5 1 v 7.344 A 3.574 3.574 0 003.5 8 3.515 3.... |
import numpy as np
from numpy.linalg import norm
def compute_error(A_in, Ag_in):
A = A_in
Ag = Ag_in
#reallign
D = A.shape[1]
inner = np.zeros((D, D))
for i in range(D):
for j in range(D):
inner[i, j] = np.asscalar(A[:, i].transpose() * Ag[:, j] )/(norm(A[:, i]) * norm(Ag[:... |
# -*- coding: utf-8 -*-
#
# Copyright (c) 2010 Andrew Stone
#
# This file is part of of Verbinator.
#
# Verbinator 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... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Calculatrice PyGtk
#
# Copyright 2014 Chiheb Nexus
#
# 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.
#... |
# Example of function overloading with functools.singledispatch
from functools import singledispatch
class Shape:
def __init__(self, solid):
self.solid = solid
class Circle(Shape):
def __init__(self, center, radius, *args, **kwargs):
super().__init__(*args, **kwargs)
self.center = ce... |
# Copyright 2021 The Magenta Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in ... |
import pytest
from utils import *
from fireplace.exceptions import GameOver
LORD_JARAXXUS = "EX1_323"
LORD_JARAXXUS_HERO = "EX1_323h"
LORD_JARAXXUS_WEAPON = "EX1_323w"
INFERNO = "EX1_tk33"
INFERNO_TOKEN = "EX1_tk34"
def test_jaraxxus():
game = prepare_game(CardClass.WARRIOR, CardClass.WARRIOR)
game.player1.hero.... |
from test import support
from test.support import bigmemtest, _1G, _2G, _4G, precisionbigmemtest
import unittest
import operator
import sys
import functools
# Bigmem testing houserules:
#
# - Try not to allocate too many large objects. It's okay to rely on
# refcounting semantics, but don't forget that 's = creat... |
import datetime
import logging
import pytz
from django.contrib.auth import get_user_model
from django.db.models import Q, QuerySet
from django.utils.translation import ugettext as _
from django_filters import rest_framework as filters
from dry_rest_permissions.generics import DRYPermissionFiltersBase
from guardian.sho... |
"""
map_util.py
Visualizing US state data on a geographical colormap
"""
import numpy as np
import matplotlib as mpl
import matplotlib.pyplot as plt
from mpl_toolkits.basemap import Basemap as Basemap
from matplotlib.colors import rgb2hex
from matplotlib.patches import Polygon
def usa_state_colormap(state_dict, title... |
#!/usr/bin/env python
#
# OmsAgentForLinux Extension
#
# Copyright 2015 Microsoft Corporation
#
# 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.... |
# -*- coding: utf-8 -*-
# Generated from the Telepathy spec
""" Copyright © 2010 Collabora Limited
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 (a... |
# -*- coding: utf-8 -*-
#
# license: AGPLv3, see LICENSE for details. In addition we strongly encourage
# you to buy us beer if we meet and you like the software.
"""Utilities."""
from base64 import b64encode
from contextlib import contextmanager
from copy import deepcopy
from email.mime.text import MIMEText... |
import requests, urllib, os, os.path, sys, tempfile, shutil
from subprocess import call, check_call
latex_header = """\\documentclass[11pt,oneside]{book}
\\usepackage{makeidx}
\\usepackage{graphicx}
\\usepackage[german]{babel}
\\usepackage[utf8]{inputenc}
\usepackage[hmargin=1cm,vmargin=1.5cm]{geometry}
\usepackage{... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import numpy as np
import tensorflow as tf
from keras.layers import Dense
from keras.preprocessing.image import apply_transform
import matplotlib.pyplot as plt
def take_glimpses(image, location, sizes):
... |
#!/usr/bin/env /usr/local/bin/python
"""
WML support.
Copyright (c) 2005 Dustin Sallings <dustin@spy.net>
"""
import sys
import cgi
import ConfigParser
import backpack
CONFIG_FILE="/usr/local/etc/backpack.conf"
# Get the config loaded
conf=ConfigParser.ConfigParser()
conf.read(CONFIG_FILE)
HEADER="""<?xml versio... |
import ast
import os
import pytest
try:
from flake8.engine import pep8
except ImportError:
import pycodestyle as pep8
from flake8_function_definition.checker import FunctionDefinitionChecker
from test.utils import extract_expected_errors
def load_test_cases():
base_path = os.path.dirname(__file__)
t... |
# This file is part of PyEMMA.
#
# Copyright (c) 2015, 2014 Computational Molecular Biology Group, Freie Universitaet Berlin (GER)
#
# PyEMMA 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 versi... |
import img_utils
import img_convert_resize
import img_resize_keep_exif
import PIL
from PIL import Image
import sys
sys.path.append('bn_python_common.zip')
from bn_python_common import *
def img_utils_testGetMarkFromFilename():
# tests splitting a filename that contains the "__MARKAS__" marker.
assertEq(('/tes... |
# -*- encoding: utf-8 -*-
##############################################################################
#
# Copyright (C) 2014 Compassion CH (http://www.compassion.ch)
# Releasing children from poverty in Jesus' name
# @author: David Coninckx
#
# The licence is in the file __openerp__.py
#
#######... |
###
# Copyright (c) 2015, KG-Bot
# 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 notice,
# this list of conditions, and t... |
import numpy as np
from numpy.testing import assert_array_equal
try:
from nose.tools import assert_is
except ImportError:
from landlab.testing.tools import assert_is
from landlab import RasterModelGrid
def test_flux_from_south_to_north():
rmg = RasterModelGrid(4, 5)
active_link_flux = np.array([0., 0... |
#!/usr/bin/env python
import os
import sys
from os.path import dirname, abspath
from django.conf import settings
TRAVIS = False
if os.environ.get('TRAVIS') is not None:
TRAVIS = True
if not settings.configured:
DATABASES = {
'default': {
'ENGINE': 'django.contrib.gis.db.backends.spatiali... |
#imports of python modules
import json
import sys
import re
import random
from xml.etree import ElementTree
#Imports of django modules
from django.http import HttpResponse
from django.http import JsonResponse
from django.shortcuts import render
from django.http import HttpResponseRedirect
from django.utils import tra... |
"""Unit testing of tests in docs/source/examples"""
import unittest
import os
import numpy as np
from gpkit import settings
from gpkit.tests.helpers import generate_example_tests
from gpkit.small_scripts import mag
from gpkit.small_classes import Quantity
def assert_logtol(first, second, logtol=1e-6):
"Asserts t... |
import unittest
from katas.beta.string_cleaning import string_clean
class StringCleaningTestCase(unittest.TestCase):
def test_equal_1(self):
self.assertEqual(string_clean(
'My "me3ssy" d8ata issues2! Will1 th4ey ever, e3ver be3 so0lved?'
), 'My "messy" data issues! Will they ever, eve... |
#/usr/bin/env python
'''
Mutually Inhibitory Toggle Switch with protein burst.
X ---| Y; Y ---| X
DEs for the toggle switch system:
The equivalent chemical system:
R1:
R2:
R3:
R4:
System variables: X, Y, Px, and Py
Dummy variable: phi
System parameters: gX, gY, ... |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from werkzeug.exceptions import NotFound
from odoo import http
from odoo.http import request
class RatingProject(http.Controller):
@http.route(['/project/rating'], type='http', auth="public", website=True, sitema... |
#!/usr/bin/python3
# -*- coding: utf8 -*-
# -*- Mode: Python; py-indent-offset: 4 -*-
"""Globals for weather app"""
from datetime import datetime, timedelta
from django.conf import settings
KEY_METEAR_NO_SITE_ID = "metear_no_site_id"
KEY_METEAR_BAD_URL = "metear_bad_url"
KEY_METEAR_PROBLEM_WS = "metear_problem_ws"
K... |
"""Test spam privacy feature extraction."""
import unittest
import os
from caliopen_storage.config import Configuration
if 'CALIOPEN_BASEDIR' in os.environ:
conf_file = '{}/src/backend/configs/caliopen.yaml.template'. \
format(os.environ['CALIOPEN_BASEDIR'])
else:
conf_file = '../../../../../... |
# coding=utf-8
# Copyright 2015 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import (absolute_import, division, generators, nested_scopes, print_function,
unicode_literals, with_statement)
import inspect
from... |
# Copyright (c) 2012 Cloudera, 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 by applicable law o... |
# @file group.py
# Node implementation
## @package groups
# @author Evtushenko Georgy
# @date 05/03/2015 17:19:00
# @version 1.1
## @mainpage Metanet documentation
# @section intro_sec Introduction
# Short script to demonstrate the use of doxygen.
#
# @section license_sec License
#\verbatim This file is par... |
# -*- coding: utf-8 -*-
#############################################################################
# _________ ____________ ___ #
# / _____// _____/\ \/ / ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ #
# \_____ \/ \ ___ \ / THE E(X)TENDED (S)ELFISH (G)E... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.