src stringlengths 721 1.04M |
|---|
INPUT_FILE = "shopping.txt"
OUTPUT_FILE = "results.txt"
def shopping_solver(max_individual_weight, shopping_items):
num_items = len(shopping_items["weights"])
# Each element of the table is (z, (a, b)) where z is the max value, and (a, b) are the x and y
# coordinates in the table for the parent that was... |
# -*- coding: utf-8 -*-
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... |
# -*-python-*-
#
# Copyright (C) 1999-2006 The ViewCVS Group. All Rights Reserved.
#
# By using this file, you agree to the terms and conditions set forth in
# the LICENSE.html file which can be found at the top level of the ViewVC
# distribution or at http://viewvc.org/license-1.html.
#
# For more information, visit h... |
from django.contrib import messages
from django.core.urlresolvers import reverse, reverse_lazy
from django.http import HttpResponseRedirect
from django.views.generic import ListView, CreateView, DeleteView
from questionnaire.forms.questions import QuestionForm
from questionnaire.models import Question, Questionnaire
... |
#
# Copyright (C) 2009 Smithsonian Astrophysical Observatory
#
#
# 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.
... |
"""
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... |
# -*- coding: utf-8 -*-
#
# This file is part of Invenio.
# Copyright (C) 2016, 2017 CERN.
#
# Invenio 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... |
#!/usr/bin/python2
import sys
import os
import errno
import subprocess
import importlib
import argparse
from time import *
from machinekit import launcher
def mkdir_p(path):
""" 'mkdir -p' in Python """
try:
os.makedirs(path)
except OSError as exc: # Python <=2.5
if exc.errno == errno.EEX... |
import ConfigParser
class Config:
"Configuration parser"
def __init__(self, fname):
self.parser = ConfigParser.ConfigParser()
self.parser.read( fname )
self.rpms = self._opt_break( "rpms" )
self.local_rpms = self._opt_break( "local_rpms" )
self.files = self._opt_break(... |
from cefbase import *
from google.appengine.api import users
# Permet de savoir si c'est le bon utilisateur qui cherche a avoir acces aux donnees
# Si l'utlisateur a aucun droit, il n'a acces a rien
# Si le contributeur est un admin de diocese, il n'a acees qu'a ses barres propres, ses menus propres et les menus pu... |
# 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... |
#------------------------------------------------------------------------------
# Product: OpenCTM
# File: openctm.py
# Description: Python API bindings (tested with Python 2.5.2 and Python 3.0)
#------------------------------------------------------------------------------
# Copyright (c) 2009-2010 Marcus G... |
# Copyright 2018 The TensorFlow Probability 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 o... |
# Default event queue for Simpleline application.
#
# This class is thread safe.
#
# This file is part of Simpleline Text UI library.
#
# Copyright (C) 2020 Red Hat, Inc.
#
# Simpleline is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by... |
import os
import re
from pathlib import Path
from . import elem_compare
from notify.email import send_mail
from utils import dir_purger
def data_pickup_and_compare(project_code):
model_path = os.environ["RVT_QC_PATH"]
model_title = os.path.basename(model_path).split(".rvt")[0]
re_string = r"\d{8}_\d{4}_... |
##
# Copyright 2009-2017 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... |
import os
import re
class SourceEnumerator(object):
@classmethod
def findDevRoot(cls, root_directory_name = "devel", verbose=False):
dev_root = os.path.dirname(os.path.realpath(__file__))
while True:
if verbose:
print("Looking at: %s" % dev_root)
dev_pat... |
# Copyright (c) 2017-2019 Uber Technologies, Inc.
# SPDX-License-Identifier: Apache-2.0
import warnings
from pyro import params
from pyro.distributions.distribution import Distribution
from pyro.poutine.util import is_validation_enabled
from .messenger import Messenger
class LiftMessenger(Messenger):
"""
G... |
# -*- coding: utf-8 -*-
"""
Created on Fri Nov 13 22:51:32 2015
@author: zah
"""
import unittest
import time
from reportengine.dag import DAG
from reportengine.utils import ChainMap
from reportengine import namespaces
from reportengine.resourcebuilder import (ResourceExecutor, CallSpec)
def f(param):
print("Exe... |
# Copyright 2020 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License")
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, s... |
import matplotlib.pyplot as plt
import numpy as np
import os
from inference import choose_J_from_general_form, infer_interactions, error_fn
from settings import FOLDER_OUTPUT
from visualize_matrix import plot_matrix
def get_spectrum_from_arr(J, real=True, sort=True):
# TODO deal with massive complex part if nece... |
#!/usr/bin/env python
#coding=utf8
import os
settings = {
'gzip': True,
'autoescape': 'xhtml_escape',
'static_path':os.path.join(os.path.dirname(__file__), 'static'),
'template_path':os.path.join(os.path.dirname(__file__), 'templates'),
"xsrf_cookies": True,
"cookie_secret": "61oETzKXQAGaYdkL5g... |
#!/usr/bin/python
#-*- coding:utf-8 -*-
import API.DFAAPI as DFA
import API.CFGAPI as CFG
import API.converter as converter
import API.socketAPI as socketAPI
import threading
# construct DFA based Data Extractor
consumer = DFA.dfa_construction('DataModel/cfi_dm.txt')
consumer_dfa = consumer[0]
consumer_extractedinfo ... |
"""
<Program Name>
test_der_encoder.py
<Purpose>
Unit testing for DER Encoding, uptane/encoding/asn1_codec.py
"""
from __future__ import print_function
from __future__ import unicode_literals
import uptane # Import before TUF modules; may change tuf.conf values.
import tuf.formats
import tuf.keys
import tuf.repo... |
#
# Copyright (c) 2010-2011, Nick Blundell
# 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 cond... |
# Copyright 2018 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 evy import patcher
from evy.patched import threading
from evy.patched import thread
from evy.patched import time
# *NOTE: doesn't test as much of the threading api as we'd like because many of
# the tests are launched via subprocess and therefore don't get patched
patcher.inject('test.test_threading',
... |
#!/usr/bin/env python3
# Copyright (C) 2017 Dmitry Malko
# This file is part of PeptoVar (Peptides of Variations): the program for annotation of genomic variations and generation of variant peptides.
#
# PeptoVar is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public Lic... |
# -*- coding: utf-8 -*-
"""
Created on Thu Jul 4 17:53:55 2013
@author: dan
"""
from parseLine import parseLine
from findAndChar import findAndChar
from addScalarInput import addScalarInput
from addVectorInput import addVectorInput
def readInput( fileName ):
redInput =... |
import re
from django.db import connection
from django.core.paginator import Paginator, Page
from django.test import Client
from django_nose.tools import *
from . import TestView
class TestIndexView(TestView):
@classmethod
def setUpClass(cls):
super(TestIndexView, cls).setUpClass()
cls.... |
# -*- coding: utf-8 -*-
#
# Etalage documentation build configuration file, created by
# sphinx-quickstart on Mon Sep 29 17:01:04 2014.
#
# 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.
#
# A... |
# -*- coding: utf-8 -*-
"""
Name: fitForecast.py
Author: Collin Rooney
Last Updated: 7/18/2017
This script will contain functions for all types of hierarchical modeling approaches.
It will use the prophet package as a forecasting tool.
The general idea of it is very similar to the hts package in R, but it is a little
m... |
# 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 applicable law or agre... |
import operator
import logging
from functools import reduce
from django.db.models import Q
from django.views.generic import ListView
from django.conf import settings
from website.apps.search_filter_sort.utils.misc import class_strings_to_class, convert_age_to_date
from website.mixins import LoginRequiredMixin
logg... |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.1 on 2016-10-25 01:14
from __future__ import unicode_literals
from django.db import migrations
skills = ['Arts/Handcrafting', 'Communication', 'Dance/Music', 'Law', 'Education', 'Sports', 'Cooking', 'Management', 'Idioms', 'Computers/Technology', 'Health', 'Others']
... |
# Copyright (c) 2018 Workonline Communications (Pty) Ltd. All rights reserved.
#
# The contents of this file are licensed under the Apache License version 2.0
# (the "License"); you may not use this file except in compliance with the
# License.
#
# Unless required by applicable law or agreed to in writing, software
# d... |
#!/usr/bin/env python
__author__ = 'Andrew J. Lambert, andy@andyroid.co.uk'
"""
example1P
A one layer network with fixed internal connections
"""
from pygfnn.tools.plotting.gfnn import *
import pygfnn.tools.shortcuts as gfnn
import numpy as np
import timeit
import matplotlib.pyplot as plt
import scipy.io as sio
if... |
import json
from django.contrib.auth.models import User
from django.urls import reverse
from rest_framework import status
from rest_framework.test import APITestCase
from lcc.models import (
Answer, Assessment, Country, Question
)
from lcc.serializers import AnswerSerializer
from lcc.tests.taxonomy import create_... |
"""
This code was originally published by the following individuals for use with
Scilab:
Copyright (C) 2012 - 2013 - Michael Baudin
Copyright (C) 2012 - Maria Christopoulou
Copyright (C) 2010 - 2011 - INRIA - Michael Baudin
Copyright (C) 2009 - Yann Collette
Copyright (C) 2009 - CEA - Jean-Marc Mart... |
# coding: utf-8
# # TensorFlow基础
# In this tutorial, we are going to learn some basics in TensorFlow.
# ## Session
# Session is a class for running TensorFlow operations. A Session object encapsulates the environment in which Operation objects are executed, and Tensor objects are evaluated. In this tutorial, we will... |
import binascii
import os
import shutil
import tempfile
from libtorrent import bencode
from twisted.internet.task import deferLater
from Tribler.Test.tools import trial_timeout
from twisted.internet.defer import inlineCallbacks, Deferred
from twisted.internet import reactor
from Tribler.Core.CacheDB.Notifier import... |
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See LICENSE in the project root
# for license information.
from __future__ import absolute_import, division, print_function, unicode_literals
import json
import os
import re
import runpy
import sys
# debugpy.__m... |
"""Send a digest of unpublished content to moderators"""
from django.conf import settings
from accounts.models import User
from games import models
from emails.messages import send_email
DEFAULT_COUNT = 12
def get_unpublished_installers(count=DEFAULT_COUNT):
"""Return a random list of unpublished installers"""
... |
# -*- coding: UTF-8 -*-
'''
Created on 29 août 2016
@author: dassierp
'''
import logging
from progdays import Progdays
class Channel():
'''
Control a water channel
'''
def __init__(self, pName, pChNumber, pHwInterface):
'''
Constructor
@param pName: channel name
@para... |
from django.conf.urls import patterns, include, url
guid_regex = "[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}"
sha1_regex = "[a-zA-Z0-9]+"
id_regex = "(({guid})|({sha1}))".format(guid=guid_regex,sha1=sha1_regex)
urlpatterns = patterns('api.views',
# get posts ... |
"""This command is intended for one-time use to migrate previously uploaded
files (images, audio, etc) to the new MediaStore model."""
from django.core.management.base import BaseCommand, CommandError
from harvardcards.settings.common import MEDIA_ROOT
from flash.services import handle_uploaded_media_file
from flash... |
import copy
import socket
from unittest import TestCase
from mock import Mock, patch
from hastexo.models import Stack
from hastexo.provider import ProviderException
from hastexo.common import (
get_stack,
update_stack,
update_stack_fields,
RemoteExecException,
)
from hastexo.tasks import (
PING_CO... |
from __future__ import print_function
__copyright__ = __license__ = """
Copyright (c) 2013-2019 Adobe Systems Incorporated. All rights reserved.
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software"),
to deal in the Software wi... |
# -*- coding: utf-8 -*-
"""
MediaProvider
A device centric multimedia solution
----------------------------------------------------------------------------
(C) direct Netware Group - All rights reserved
https://www.direct-netware.de/redirect?mp;core
The following license agreement remains valid unless any additions o... |
#
# Gramps - a GTK+/GNOME based genealogy program
#
# Copyright (C) 2000-2007 Donald N. Allingham
# Copyright (C) 2009-2010 Gary Burton
# Copyright (C) 2010 Nick Hall
# Copyright (C) 2011 Tim G L Lyons
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU... |
#!/usr/bin/env python
import networkx as nx
def validate_grid_path(r, c, s, t, p):
assert isinstance(p, list)
assert p[0] == s
assert p[-1] == t
s = ((s - 1) // c, (s - 1) % c)
t = ((t - 1) // c, (t - 1) % c)
assert len(p) == abs(t[0] - s[0]) + abs(t[1] - s[1]) + 1
p = [((u - 1) // c, (u -... |
from django import template
from django.contrib.contenttypes.models import ContentType
from django.template.loader import render_to_string
from ..models import TaggedItem, Tag
register = template.Library()
@register.assignment_tag
def get_tagged_items_for(object):
'''retrieve tagged items which relative with the... |
class Main:
def __init__(self):
self.n = int(input())
self.s = ""
def change(self):
self.con = 0
for i in range(0, len(self.s)):
if self.con == 12:
break
elif self.s[i] in ['a', 'k', 'u', 'G', 'Q']:
print(0, end='')
... |
from sqlalchemy.engine import default
from sqlalchemy.databases import *
from sqlalchemy.orm import mapper
from sqlalchemy.orm import Session
from sqlalchemy.testing import AssertsCompiledSQL, eq_
from sqlalchemy.testing import assert_raises_message
from sqlalchemy import exc
from test.orm import _fixtures
class Lega... |
#!/usr/bin/env python3
'''
Created on 1-June-2016
@author: Asawari.Vaidya
'''
from PythonNetBanxSDK.CardPayments.BillingDetails import BillingDetails
from PythonNetBanxSDK.CustomerVault.ACHBankAccount import ACHBankAccount
from PythonNetBanxSDK.CustomerVault.Profile import Profile
from PythonNetBanxSDK.DirectDebit.Pur... |
#!/bin/python
# -*- coding: utf-8 -*-
import os
from amazon_wrapper import AmazonWrapper
from rakuten_wrapper import RakutenWrapper
class Capybara:
def __init__(self, config_dir=None, tokens_dir=None):
self.wrappers = {}
self.wrappers['amazon'] = AmazonWrapper()
self.wrappers['rakuten'] = ... |
from subprocess import call
import os
import json
BUILDER_PATH = os.path.dirname(os.path.abspath(__file__))
ROOT_PATH = os.path.join(BUILDER_PATH, '..')
FONTS_FOLDER_PATH = os.path.join(ROOT_PATH, 'fonts')
CSS_FOLDER_PATH = os.path.join(ROOT_PATH, 'css')
SCSS_FOLDER_PATH = os.path.join(ROOT_PATH, 'scss')
def main()... |
# pyXLWriter: A library for generating Excel Spreadsheets
# Copyright (c) 2004 Evgeny Filatov <fufff@users.sourceforge.net>
# Copyright (c) 2002-2004 John McNamara (Perl Spreadsheet::WriteExcel)
#
# This library is free software; you can redistribute it and/or modify it
# under the terms of the GNU Lesser General Publi... |
import math
import time
import numpy as np
import taichi as ti
@ti.data_oriented
class MGPCG:
'''
Grid-based MGPCG solver for the possion equation.
See `examples/stable_fluid.py <https://github.com/taichi-dev/taichi/blob/master/examples/stable_fluid.py>`_ for a usage example.
.. note::
This solver only r... |
#!/usr/bin/env python
"""
Based on test code moved here from bottom of tulip/jtlvint.py
SCL; 31 Dec 2011.
"""
import os
from tulip.jtlvint import *
from tulip.polytope import Region
from tulip.prop2part import PropPreservingPartition
class jtlvint_test:
def setUp(self):
self.tmpdir = "tmpspec"
... |
from django.shortcuts import render
from merdeka.apps.utils.func import find_model, make_response, json_response, jsonify, set_data, set_status, set_message, set_child
from .models import GoodsChilds
def api_view(request, **kwargs):
resp = make_response()
m = kwargs.get('model', None)
# drop if model is e... |
# 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 ... |
# apis_v1/documentation_source/positions_count_for_one_ballot_item_doc.py
# Brought to you by We Vote. Be good.
# -*- coding: UTF-8 -*-
def positions_count_for_one_ballot_item_doc_template_values(url_root):
"""
Show documentation about positionsCountForOneBallotItem
"""
required_query_parameter_list =... |
from django.db import models, transaction
'''
create table dt_games (id integer primary key auto_increment, name varchar(100), lasteventid integer);
create table dt_spawns (id integer primary key auto_increment, name varchar(100), game_id integer references game(id), lasteventid integer);
insert into dt_games values (... |
# -*- coding: utf-8 -*-
#
# PyMysqlPool documentation build configuration file, created by
# sphinx-quickstart on Wed Aug 23 16:56:20 2017.
#
# 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.
#... |
# based on real-per-line.py
from _UTILITIES import _code
def f():
for i in range(0, len(ExpectedLines)):
if len(OutputLines)<=i:
return "N"+_("Not enough lines of output: {0} expected, {1} found").format(str(len(ExpectedLines)),
... |
from yattag import Doc, indent
from sys import stderr
def _inner_recurse_tags(obj, tree, doc, tag, text):
"""Execute inner loop structure of HTML generation.
Params:
obj (Object): The object currently being looped over
tree (Object): A VOTL Object containing the subtree-to-be
... |
#!/usr/bin/python
# Classification Banner
#
# Last update was 02 July 2018
#
# Script: classification-banner.py
# Description: Displays a Classification for an Xwindows session
# Copyright: Frank Caviggia, 2017
# Author: Frank Caviggia <fcaviggia (at) gmail.com>
# Version: 1.6.6
# License: GPLv2
import sys,os,optparse... |
import time
from flask import abort, Flask, jsonify, request
from . import plugins
from ..models import Developer, Integration
import jpush
from jpush import common
from .github import baseurl
@plugins.route('/discourse/<string:integration_id>/<string:token>/webhook', methods=['POST'])
def send_discourse_msg(integrat... |
from autosearch.form import Form
from autosearch.path import Path, PathFinder
from autosearch.utils import *
class Searcher(object):
def __init__(self, url, query):
self.url = url
top = addScore(parse(fetch(url)), query)
forms = []
paths = []
scores = []
# Find fo... |
import os
import time
import utils
class last:
def __init__(self):
self.nolast = "No foreign lastlog"
def lastlog(self):
fd = os.popen("last -10 -w -F")
users = [utils.get_username()]
nolastlog = True
for line in fd:
line = line.strip()
backup = line
if line == "":
break
pieces = line.spl... |
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: t -*-
# vi: set ft=python sts=4 ts=4 sw=4 noet :
# This file is part of Fail2Ban.
#
# Fail2Ban 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;... |
import json
from corehq.apps.reports.standard import export
from corehq.apps.reports.models import FormExportSchema, HQGroupExportConfiguration, CaseExportSchema
from corehq.apps.reports.standard.export import DeidExportReport
from couchexport.models import ExportTable, ExportSchema, ExportColumn
from django.utils.tran... |
import theano.tensor as T
def cca_loss(outdim_size, use_all_singular_values):
"""
The main loss function (inner_cca_objective) is wrapped in this function due to
the constraints imposed by Keras on objective functions
"""
def inner_cca_objective(y_true, y_pred):
"""
It is the loss ... |
#Variables y tipos de datos
#Autor: Javier Arturo Hernández Sosa
#Fecha: 28/Ago/2017
#Descripcion: Curso Python FES Acatlán
#Tipos de datos
numero = 5 #Operador de asignación
numero2 = 19
numeroFlotante = 25.0
cadena = "Hola Mundo"
boleano1 = True
boleano2 = False
complejo1 = 5 - 3j
complejo2 = 2 + 5j
#... |
#!/usr/bin/env python
# import sys
import logging
import struct
import serial
from . import errors
from . import fio
from . import ops
# import settings this as settings_module to avoid name conflicts
from . import settings as settings_module
logger = logging.getLogger(__name__)
logger.addHandler(logging.StreamHan... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import with_statement
import __builtin__
import __future__
import contextlib
from pathlib import _Accessor, Path, PureWindowsPath, PurePath, PosixPath
from pywatchman import bser, WatchmanError... |
# coding=utf-8
import os
import shutil
import sys
from operator import attrgetter
from typing import Optional
from ifj2017.interpreter.state import State
def disable_color():
"""
Return True if the running system's terminal supports color,
and False otherwise.
"""
# windows dark magic via https:... |
#!/usr/bin/python
import time, sqlite3, sys, urllib, csv
begin = time.time()
url = "http://www.correlatesofwar.org/COW2%20Data/SystemMembership/2011/states2011.csv"
print "Downloading from", url
response = urllib.urlretrieve(url, '../Data/states2011.csv')
print "Opening Database"
con = sqlite3.connect('../Data/PyRB... |
#!/usr/bin/env python
"""Particles orbiting around the origin.
Features:
- user attributes: particles are initialized within a radius from the
origin and are, at each simulation step, updated to orbit around the origin.
- NumPy: operations are done directly on the particle data for increased
performances.
"""
i... |
# Simple integration test which shows tests deploying other verticles, using the Vert.x API etc
from org.vertx.testtools import VertxAssert
import vertx_tests
from core.event_bus import EventBus
import vertx
# The test methods must begin with "test"
def test_http():
# Create an HTTP server which just sends back O... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import telebot
import config
import dbhelper
# Initialize bot
bot = telebot.TeleBot(config.token)
# Handle always first "/start" message when new chat with your bot is created
@bot.message_handler(commands=["start"])
def command_start(message):
bot.send_message(me... |
# Copyright 2017 Yahoo Inc.
# Licensed under the terms of the Apache 2.0 license.
# Please see LICENSE file in the project root for terms.
from __future__ import absolute_import
from __future__ import division
from __future__ import nested_scopes
from __future__ import print_function
from multiprocessing.managers imp... |
# Copyright 2015 Renzo Massobrio
# Facultad de Ingenieria, UdelaR
# 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.
# Th... |
# 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 ... |
from django.conf.urls.defaults import *
from django.conf import settings
from django.contrib.staticfiles.urls import staticfiles_urlpatterns
from geonode.sitemap import LayerSitemap, MapSitemap
from geonode.proxy.urls import urlpatterns as proxy_urlpatterns
# Uncomment the next two lines to enable the admin:
from djan... |
# -*- coding: utf-8 -*-
# Copyright (c) 2016-2020 Wintermute0110 <wintermute0110@gmail.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; version 2 of the License.
#
# This program is distr... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
from setuptools import setup
def read(fname):
with open(os.path.join(os.path.dirname(__file__), fname), "r") as f:
return f.read()
setup(
name="liquidcrystal",
version="0.1",
author="Davide Depau",
author_email="apps@davideddu.org... |
import threading
import collections
import log
import copy
import asyncio
import settings
import clargs
from recognition.actions.library import pywindow
from recognition.commands import loader
from recognition.actions import perform
from communication import topics, pubsub
import time
def create_message_subscriptions... |
import pygame, math
class Ball(pygame.sprite.Sprite):
SPEED = 50
@staticmethod
def load_images():
Ball.images = list()
for filename in ['red', 'blue', 'green', 'purple']:
img = pygame.image.load('./imgs/%s.png' % filename).convert_alpha()
w = h = 50
scal... |
#!/usr/bin/env python
# This is a visualizer which pulls TPC-C benchmark results from the MySQL
# databases and visualizes them. Four graphs will be generated, latency graph on
# sinigle node and multiple nodes, and throughput graph on single node and
# multiple nodes.
#
# Run it without any arguments to see what argu... |
#!/usr/bin/env python
# motion_utils
#
# Created on: April 13, 2015
# Authors: Francisco Vina
# fevb <at> kth.se
#
# Copyright (c) 2015, Francisco Vina, CVAP, KTH
# All rights reserved.
# Redistribution and use in source and binary forms, with or without
# modification, are permitted pr... |
#!/usr/bin/env python3
import shutil
import logging
from pathlib import Path
# setup logging level
logging.basicConfig(level=logging.INFO)
# some global paths
DOTFILES_ROOT = Path(__file__).resolve().parent
SUBMODULES = DOTFILES_ROOT / "submodules"
def setup_vim():
VIMRC_PATH = Path.home() / ".vimrc"
VIM_... |
from django import template
from django.utils.encoding import smart_str
from django.utils.safestring import mark_safe
register = template.Library()
class Nav(object):
def __init__(self, tree=None, root=None):
self._root = root or self
self._tree = tree or {}
def __getitem__(self, key):
... |
#-------------------------------------------------------------------------
# Name: Deploy service for Lambda
# Purpose: Demonstrate use of S3 Event Notifications, S3 Object Metadata to deploy lambda functions: (S3->Lambda->Lambda deploy function->Update target Lambda function)
# Author: Heitor Lessa
#--... |
# encoding: utf-8
import copy
import facepy
from . import url
def getdata(obj, key, default=None):
if key in obj:
return obj[key]['data']
else:
return default
class GraphAPI(facepy.GraphAPI):
def __init__(self, *vargs, **kwargs):
self.base = []
super(GraphAPI, self).__in... |
import os
import ntpath
import re
from functools import partial
import h5py
import design_matrix as dm
class LearningData:
DEFAULT_PREFIX = 'ARG'
CSV = '.csv'
HDF = '.hdf'
def __init__(self):
self.num_variables = None
self.num_observations = None
self.predictors = None
... |
from numpy import exp, eye, log
from optimix import Function, Scalar
from .._util import format_function
class EyeCov(Function):
"""
Identity covariance function, K = s·I.
The parameter s is the scale of the matrix.
Example
-------
.. doctest::
>>> from glimix_core.cov import Eye... |
# Copyright 2009-2011 Canonical Ltd. This software is licensed under the
# GNU Affero General Public License version 3 (see the file LICENSE).
__metaclass__ = type
from zope.component import getUtility
from lp.app.interfaces.launchpad import ILaunchpadCelebrities
from lp.registry.browser.tests.test_pillar_sharing i... |
"""
/******************************************************************************
This source file is not yet a part of the Avogadro project.
Copyright 2015 Tomislav Subic <tomislav.subic@gmail.com>
This source code is released under the New BSD License, (the "License").
Unless required by applicable law or... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.