src
stringlengths
721
1.04M
# Copyright 2013 Cloudbase Solutions Srl # 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 applicabl...
# Import python modules import numpy as np import csv import matplotlib.pyplot as plt import nltk from nltk.stem.porter import * import string from sklearn.feature_extraction.text import TfidfVectorizer from sklearn.naive_bayes import BernoulliNB from sklearn.ensemble import RandomForestClassifier from sklearn.linear_...
# Sublime Suricate, Copyright (C) 2013 N. Subiron # # This program comes with ABSOLUTELY NO WARRANTY. This is free software, and you # are welcome to 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 (...
#!/usr/bin/env python from road import Road import time # impacts default behavior for most states SPEED_LIMIT = 10 # all traffic in lane (besides ego) follow these speeds LANE_SPEEDS = [6,7,8,9] # LANE_SPEEDS = [5,6,7,8] # Number of available "cells" which should have traffic TRAFFIC_DENSITY ...
#!/usr/bin/env python # # Axis camera image driver. Based on: # https://code.ros.org/svn/wg-ros-pkg/branches/trunk_cturtle/sandbox/axis_camera # /axis.py # import threading import urllib2 import rospy from sensor_msgs.msg import CompressedImage, CameraInfo import camera_info_manager class StreamThread(threading.Thr...
""" tools to run the double ended connect in a separte process and make sure the the minima and transition states found are incorporated back into the master database """ import multiprocessing as mp import sys import signal import logging import numpy as np from PyQt4 import QtCore, QtGui from pygmin.utils.events...
#!/usr/bin/env python """ Copyright 2012 GroupDocs. 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...
MAP_WIDTH = 80 MAP_HEIGHT = 20 CELL_SIZE_X = 10 CELL_SIZE_Y = 10 CELLS_COUNT_X = MAP_WIDTH // CELL_SIZE_X CELLS_COUNT_Y = MAP_HEIGHT // CELL_SIZE_Y MOVE_VECTORS = [[-1, -1], [-1, 0], [-1, 1], [0, -1], [0, 1], [1, -1], [1, 0], [1, 1]] ROOMS = dict() ROOMS['normal'] = dict() ROOMS['normal']['min width'] = ...
"""Code to handle a Dynalite bridge.""" from typing import Any, Callable, Dict, List, Optional from dynalite_devices_lib.dynalite_devices import ( CONF_AREA as dyn_CONF_AREA, CONF_PRESET as dyn_CONF_PRESET, NOTIFICATION_PACKET, NOTIFICATION_PRESET, DynaliteBaseDevice, DynaliteDevices, Dyna...
#!/user/bin/python # -*- coding: utf-8 -*- # Author : (DEK) Devendra Kavthekar # program# : Name # => # Write a program that computes the net amount of a bank account # based a transaction log from console input. The transaction log # format is shown as following: # D 100 # W 200 # �� # D means deposit while W means ...
from PySide import QtCore, QtGui import sys class Actor(QtGui.QGraphicsWidget): nick_name = '' real_name = '' gender = '' bday = '' age = '' marital = '' children = '' death = '' important = False notes = '' def __init__(self, nick_name, real_name, gender, bday, age, marital...
# This file is part of Indico. # Copyright (C) 2002 - 2019 CERN # # Indico is free software; you can redistribute it and/or # modify it under the terms of the MIT License; see the # LICENSE file for more details. from __future__ import unicode_literals from io import BytesIO from flask import jsonify, request, sessi...
"""empty message Revision ID: 42caf438dcdf Revises: None Create Date: 2015-05-15 13:14:21.980616 """ # revision identifiers, used by Alembic. revision = '42caf438dcdf' down_revision = None from alembic import op import sqlalchemy as sa def upgrade(): ### commands auto generated by Alembic - please adjust! ###...
############################################################################ ## ## Copyright (c) 2000-2015 BalaBit IT Ltd, Budapest, Hungary ## Copyright (c) 2015-2018 BalaSys IT Ltd, Budapest, Hungary ## ## ## This program is free software; you can redistribute it and/or modify ## it under the terms of the GNU General...
""" @file: models.py @description: Django ORM model for cluster manager @author: Ido Nahshon """ import os from django.db import models from pyxcm.config import EXPORTDIR, IMAGEDIR, KICKSTARTDIR class OperatingSystem(models.Model): name = models.CharField(max_length=32, primary_key=True) distro =...
#!/usr/bin/env python # Licensed to Cloudera, Inc. under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. Cloudera, Inc. licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you ma...
import numpy as np def spinfock(eorbitals): """ """ if type(eorbitals) is np.ndarray: dim = 2*len(eorbitals) fs = np.zeros(dim) for i in range(0,dim): fs[i] = eorbitals[i//2] fs = np.diag(fs) # put MO energies in diagonal array elif type(eorbitals) is dict: ...
from django.db import models from django.db.models import Q from django.db.models.signals import pre_save, post_delete from django.dispatch import receiver from datetime import datetime from confucius.models import ConfuciusModel, User class Action(ConfuciusModel): name = models.CharField(max_length=155, verbose_...
# Copyright (c) 2008-2009 Participatory Culture Foundation # See LICENSE for details. from django.http import HttpResponseRedirect from django.core import cache from django.core.paginator import Paginator, InvalidPage from django.contrib.auth.decorators import permission_required from django.db.models import Count fro...
# Задача 9. Вариант 22. # Создайте игру, в которой компьютер выбирает какое-либо слово, а игрок должен # его отгадать. Компьютер сообщает игроку, сколько букв в слове, и дает пять попыток # узнать, есть ли какая-либо буква в слове, причем программа может отвечать только # "Да" и "Нет". Вслед за тем игрок должен попробо...
from thunder.fields import Field from thunder.info import get_obj_info class ReferenceField(Field): def __init__(self, local_field, remote_cls, remote_attr='_id', **kwargs): if not isinstance(local_field, Field): # pragma nocoverage raise TypeError( "first argument must be a F...
import numpy as np import scipy import matplotlib.pyplot as plt import random # N points in d dimensions def generatePoints(n,d): points = [] for i in range(0,n): point = np.random.normal(0,1,d); p = point**2; den = np.sqrt(sum(p)); point = list(point/den); points.append...
import sys # where RobotControl.py, etc lives sys.path.append('/home/pi/Desktop/ADL/YeastRobot/PythonLibrary') from RobotControl import * ################################# ### Define Deck Layout ################################# deck="""\ DW96W SW96P SW96P SW96P SW96P SW96P SW96P BLANK BLANK BLANK BLANK B...
from django.test import TestCase, override_settings from bootstrap4.bootstrap import get_bootstrap_setting, include_jquery, jquery_slim_url, jquery_url class SettingsTest(TestCase): def test_get_bootstrap_setting(self): self.assertIsNone(get_bootstrap_setting("SETTING_DOES_NOT_EXIST")) self.asser...
from __future__ import absolute_import import json import os from ddt import ddt, file_data from django.core.exceptions import PermissionDenied from django.test import TestCase from mock import patch, Mock from workbench.test_utils import scenario, XBlockHandlerTestCaseMixin from ubcpi.persistence import Answers, VOT...
""" data engine API """ import json import random import requests import socket import time import traceback from websocket import create_connection from jut import defaults from jut.api import deployments from jut.common import debug, is_debug_enabled from jut.exceptions import JutException def get_data_url(depl...
# -*- coding: utf-8 -*- # Form implementation generated from reading ui file 'uiChEsher.ui' # # Created: Sat May 06 23:31:14 2017 # by: PyQt4 UI code generator 4.11.3 # # WARNING! All changes made in this file will be lost! from PyQt4 import QtCore, QtGui try: _fromUtf8 = QtCore.QString.fromUtf8 except Attr...
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. """isort:skip_file""" import argparse import importlib import os from fairseq.dataclass import FairseqDataclass from fairseq.dataclass.utils ...
default_types = { "default" : "BLDG" } use_types_map = { "Residential" : "HSE", "Worship" : "CTTR", "Educational" : "SCH", "Commercial": "BLDO", "Industrial" : "MFG", "Health": "HSP", "Transport":"BLDG", "Military":"INSM", "unknown": "BLDG" } use_sub_types_map = { "Apartment...
#!/usr/bin/python # coding: utf8 from __future__ import absolute_import from geocoder.base import Base from geocoder.mapbox import Mapbox from geocoder.keys import mapbox_access_token from geocoder.location import Location class MapboxReverse(Mapbox, Base): """ Mapbox Reverse Geocoding ==================...
# vim: ft=python fileencoding=utf-8 sw=4 et sts=4 """Provides classes to store and load thumbnails from a shared cache. The ThumbnailStore transparently creates and loads thumbnails according to the freedesktop.org thumbnail management standard. The ThumbnailManager provides a asynchronous mechanism to load thumbnails...
# -*- coding: utf-8 -*- from south.utils import datetime_utils as datetime from south.db import db from south.v2 import SchemaMigration from django.db import models class Migration(SchemaMigration): def forwards(self, orm): # Adding model 'Post' db.create_table('blog_post', ( ('id', s...
from django.db import models from edc_base.model_fields import OtherCharField from edc_base.model_mixins import BaseUuidModel from ..choices import (YES_NO, TESTING_REASONS, TB_NONDISCLOSURE, HIV_TEST_RESULT, ARV_USAGE, ARV_TREATMENT_SOURCE, REASONS_ARV_NOT_TAKEN, TB_REAC...
# # This file is part of Mapnik (c++ mapping toolkit) # # Copyright (C) 2007 Artem Pavlenko, Jean-Francois Doyon # # Mapnik is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public # License as published by the Free Software Foundation; either # version 2.1 of the Li...
# -*- coding: utf-8 -*- # vim: tabstop=8 expandtab shiftwidth=4 softtabstop=4 __author__ = "Ole Christian Weidner" __copyright__ = "Copyright 2011-2012, Ole Christian Weidner" __license__ = "MIT" from bliss.interface import JobPluginInterface from bliss.plugins.local.process import LocalJobProcess import bliss....
import pickle import re from itertools import groupby class RLECompress: def __init__(self, file): self.file = file def verifier(self, objet): if isinstance(objet, list): return all(map(lambda elt: isinstance(elt, list), objet)) return False def dump(self, objet): ...
"""Testing functions in core_atram.""" # pylint: disable=too-many-arguments,unused-variable from os.path import join from unittest.mock import patch, MagicMock, call import tempfile import lib.core_atram as core_atram from lib.assemblers.base import BaseAssembler def set_up(): """Build a generic assembler.""" ...
A = -2.0 B = 2.0 eps = [0.5 * pow(10, -1 * i) for i in range(3, 8, 2)] def f(x): return float(x * (3 ** x + 1) ** (-1)) def rect(h): int_sum = 0 x = A + h / 2.0 while x < B: int_sum += f(x) x += h return h * int_sum def trap(h): int_sum = 0 x = A while x < B: ...
#! /usr/bin/env python # -*- coding: utf-8 -*- # # Copyright CEA (2014). # Copyright Université Paris XI (2014). # # Contributor: Olga Domanova <olga.domanova@cea.fr>. # # This file is part of highres-cortex, a collection of software designed # to process high-resolution magnetic resonance images of the cerebral # cort...
############################################################################## # Copyright (c) 2013-2017, Lawrence Livermore National Security, LLC. # Produced at the Lawrence Livermore National Laboratory. # # This file is part of Spack. # Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved. # LLNL-CODE-64...
from django.shortcuts import render, get_object_or_404 from django.views.generic import View from utils import (IanmannJsonResponse, respond_bad_request_verb, get_params_to_queryset_kwargs, valid_method, respond_list_deleted, ...
"""Linie handlers test specs.""" import logging from testfixtures import LogCapture from unittest import TestCase from linie import handlers, exceptions from linie.handlers import DEFAULT_FORMAT, _check_keys, _check_values, _get_fmts class TestStreamHandlerPrivates(TestCase): """Test private functions of the s...
#!/usr/bin/env python ''' nmea serial output module Matthew Ridley August 2012 UAV outback challenge search and rescue rules 5.15 Situational Awareness Requirement It is highly desirable that teams provide: - an NMEA 0183 serial output with GPRMC and GPGGA sentences for aircraft current location '''...
# -*- encoding: utf-8 -*- ############################################################################## # # OpenERP, Open Source Management Solution # This module copyright (C) 2013 Savoir-faire Linux # (<http://www.savoirfairelinux.com>). # # This program is free software: you can redistribute it and/or m...
#!/usr/bin/env python # SConsBuildFramework - Copyright (C) 2012, 2013, Nicolas Papier. # Distributed under the terms of the GNU General Public License (GPL) # as published by the Free Software Foundation. # Author Nicolas Papier from optparse import OptionParser from os.path import join import os, sys ...
from django.test import TestCase from .models import Profile from datetime import date class ViewsTest(TestCase): """ TestCase to test all exposed views for anonymous users. """ def setUp(self): pass def testHome(self): response = self.client.get('/user/') self.assertEqua...
#!/usr/bin/env python import rethinkdb as r class DatabaseError(Exception): pass class DataFile(object): def __init__(self, name, owner, checksum, mediatype, size): self.name = name self.owner = owner self._type = "datafile" self.atime = r.now() self.birthtime = self...
#!/usr/bin/env python3 from os.path import basename, splitext from logging import basicConfig, DEBUG import click from plumbum import local, FG __author__ = 'Gu Zhengxiong' __version__ = '0.1.0' PROGRAM_NAME = 'GH' PACKAGE_NAME = PROGRAM_NAME.lower() VERSION_PROMPT = ( '{version}\n\nCopyright 2015-2016 {autho...
# ##### BEGIN GPL LICENSE BLOCK ##### # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License # as published by the Free Software Foundation; either version 2 # of the License, or (at your option) any later version. # # This program is distrib...
############################################################################## # Copyright (c) 2013-2018, Lawrence Livermore National Security, LLC. # Produced at the Lawrence Livermore National Laboratory. # # This file is part of Spack. # Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved. # LLNL-CODE-64...
#!/usr/bin/python # -*- coding:utf8 -*- import time import jieba.analyse def post_cut(url): fr = open(url + "/post_data.txt") fo = open(url + "/post_key.txt", "a+") for line in fr.readlines(): term = line.strip().split("\t") if len(term) == 3 and term[2] != "": key_list = jieb...
from basicgraphs import graph # , GraphError, vertex, edge import permgrputil from permv2 import permutation from basicpermutationgroup import Orbit # deprecated def color_gradient(bg_1, bg_2, colors): # types correct? if not (isinstance(bg_1, graph) and isinstance(bg_2, graph)): print("Not two graph...
#!/usr/bin/env python # # Copyright 2018 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 requir...
# # Copyright 2015 VTT Technical Research Center of Finland # # 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 applicabl...
# -*- coding: utf-8 -*- try: # Python 2.7 from collections import OrderedDict except: # Python 2.6 from gluon.contrib.simplejson.ordered_dict import OrderedDict from gluon import current from gluon.storage import Storage from s3 import S3Method RED_CROSS = "Red Cross / Red Crescent" def config(sett...
# coding: utf-8 """ Flip API Flip # noqa: E501 The version of the OpenAPI document: 3.1 Contact: cloudsupport@telestream.net Generated by: https://openapi-generator.tech """ import pprint import re # noqa: F401 import six from telestream_cloud_flip.configuration import Configuration class...
# ---------------------------------------------------------------------- # Imports # ---------------------------------------------------------------------- from VyPy.data import OrderedBunch, Property import pickle from copy import deepcopy from time import time, sleep import numpy as np # ---...
from django.db import models from django.core import serializers # Create your models here. class User(models.Model): uid = models.CharField(max_length=250, primary_key=True) nameFirst = models.CharField(max_length=250) nameLast = models.CharField(max_length=250) githubId = models.CharField(max_length=...
import click import configparser import os from .api import * @click.group() @click.option('--credentials', help='Path to credentials file', default='~/.spark-oktawave-credentials') @click.pass_context def cli(ctx, credentials): ctx.obj['config'] = configparser.RawConfigParser() ctx.obj['config'].read(os.path....
# In this module all the static files are specified that are required by the # CATMAID front-end. The configuration is separated in libraries and CATMAID's # own files: # # Libraries: To add a new library, add a new entry into the libraries_js # dictionary and, if needed, add the libraries CSS files to sourcefiles # tu...
#!/usr/bin/env python2 # -*- coding: utf-8 -*- ''' This sample script shows a simple **nested** menu structure. There are two `group` items: `build_menu` and `test_menu`. These two items are shown on the main menu. Once selected, thier respective sub-items will be shown. `test_menu` has a sub-menu itself, ...
#@+leo-ver=5-thin #@+node:2014fall.20141212095015.1775: * @file wsgi.py # coding=utf-8 # 上面的程式內容編碼必須在程式的第一或者第二行才會有作用 ################# (1) 模組導入區 # 導入 cherrypy 模組, 為了在 OpenShift 平台上使用 cherrypy 模組, 必須透過 setup.py 安裝 #@@language python #@@tabwidth -4 #@+<<declarations>> #@+node:2014fall.20141212095015.1776: ** <<declar...
from django.contrib.auth.models import Permission from django.utils.translation import ugettext_lazy as _ def parse_permission_tree(): permission_tree = {} permission_tree_list = [] queryset = Permission.objects.filter(content_type__app_label__in=[ 'common', 'permission'], codename__contains='can_...
"""API v1 end-points""" from django.conf.urls import include, url from rest_auth.registration.urls import urlpatterns as urlpatterns_registration from rest_auth.urls import urlpatterns as urlpatterns_rest_auth from rest_framework_swagger.views import get_swagger_view from .views import ( CertificateCRLFileView, C...
import datetime from decimal import Decimal from typing import Optional from django.db import models from django.db.models import CASCADE from zerver.models import Realm class Customer(models.Model): """ This model primarily serves to connect a Realm with the corresponding Stripe customer object for pay...
# -*- 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...
import numpy as np from osgeo import gdal, osr from qgis import processing from qgis.core import (QgsGeometry, QgsProcessing, QgsProcessingAlgorithm, QgsProcessingException, QgsProcessingParameterFile, QgsProce...
#! /usr/bin/env python3 # Copyright (c) 2015 - thewisenerd <thewisenerd@protonmail.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 the License, or # (at your optio...
# tactic_api_client.py # Start here to run client for tactic api import sys import datetime from thlib.side.Qt import QtWidgets as QtGui from thlib.side.Qt import QtCore as QtCore from thlib.side.Qt import QtNetwork as QtNetwork import main_standalone import thlib.global_functions as gf from thlib.environment import ...
""" neural network stuff, intended to be used with Lasagne All this code, except otherwise mentionned, was written by openai taken from improvedgan repo on github """ import numpy as np import theano as th import theano.tensor as T from theano.tensor.nnet.abstract_conv import (bilinear_upsampling, ) from theano.sandb...
import simuvex import logging import claripy import pickle import nose import ana import gc from simuvex import SimState def test_state(): s = simuvex.SimState(arch='AMD64') s.registers.store('sp', 0x7ffffffffff0000) nose.tools.assert_equals(s.se.any_int(s.registers.load('sp')), 0x7ffffffffff0000) s....
class BST_Node: #initialize binary search tree def __init__(self, item = None, left = None, right = None): self.item = item self.left = left self.right = right #traversals def preorder(self): print self.item if self.left: self.left.inorder() if self.right: self.right.inorder() def inor...
# # @file TestReadFromFile5.py # @brief Reads test-data/l2v1-assignment.xml into memory and tests it. # # @author Akiya Jouraku (Python conversion) # @author Ben Bornstein # # $Id$ # $HeadURL$ # # ====== WARNING ===== WARNING ===== WARNING ===== WARNING ===== WARNING ====== # # DO NOT EDIT THIS FILE. # # This f...
import sys import re import json from flask import current_app, render_template, render_template_string from flask import Flask, jsonify from threading import Thread from flaskredoc import ReDoc from werkzeug.wsgi import DispatcherMiddleware from werkzeug.serving import run_simple from werkzeug.debug import DebuggedApp...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import sys from datetime import datetime from wand.image import Image from wand.drawing import Drawing from wand.color import Color def readStdinBinary(): return sys.stdin.buffer.read() def main(): img_binary = readStdinBinary() with Drawing() as draw: with I...
import unittest import logging from nose.plugins.attrib import attr from nose.plugins.skip import SkipTest from tests.common import get_check logging.basicConfig() CONFIG = """ init_config: instances: - host: . dimensions: dim1: value1 dim2: value2 """ class IISTestCase(unitt...
import os import json import sys import meta from meta.MetaProcessor import MetaProcessor class GlobalPlatform(MetaProcessor): """docstring for Preprocessor""" def __init__(self,config,stringUtils): super(GlobalPlatform, self).__init__(config, stringUtils) thisPath = os.path.realpa...
import pytest import supriya.assets.synthdefs import supriya.nonrealtime import supriya.synthdefs import supriya.ugens def test_manual_with_gate(): session = supriya.nonrealtime.Session(0, 2) with session.at(0): group = session.add_group(duration=4) for i in range(4): with session.at(i): ...
# -*- coding: utf-8 -*- # Copyright 2020 Green Valley Belgium NV # # 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 appl...
''' Created on Sep 18, 2011 @author: mike ''' import logging import healthdb.util import math from xml.dom import minidom import time from datetime import datetime from google.appengine.ext import db from google.appengine.api import datastore_errors import urllib2 import urllib from xml.parsers.expat import ExpatE...
from __future__ import unicode_literals import logging import re from client import OE1Client from mopidy import backend from mopidy.models import Ref, Track logger = logging.getLogger(__name__) class OE1Uris(object): ROOT = 'oe1:directory' LIVE = 'oe1:live' CAMPUS = 'oe1:campus' ARCHIVE = 'oe1:ar...
# Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not u...
# Your task is to read the input DATAFILE line by line, and for the first 10 lines (not including the header) # split each line on "," and then for each line, create a dictionary # where the key is the header title of the field, and the value is the value of that field in the row. # The function parse_file should retur...
"""Add columns to Event model Columns added: location_name latitude longitude price and max_attendants Revision ID: f90d3b386518 Revises: 1150136bf0ab Create Date: 2016-08-08 11:30:45.154593 """ # revision identifiers, used by Alembic. revision = 'f90d3b386518' down_revision = '1150136bf0ab' fro...
""" Copyright (C) 2004-2015 Pivotal Software, Inc. All rights reserved. This program and the accompanying materials are made available under the terms of the 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 ...
import os import sys import shutil import string import subprocess from numpy import * my_path = os.path.dirname(os.path.abspath(__file__)) sys.path.append(os.path.join(my_path, '../..')) from fds.cti_restart_io import * ref_fname = os.path.join(my_path, '..', 'data', 'cti-sample-restart-file.les') initial_state = ...
# This file is part of VoltDB. # Copyright (C) 2008-2014 VoltDB Inc. # # This file contains original code and/or modifications of original code. # Any modifications made by VoltDB Inc. are licensed under the following # terms and conditions: # # Permission is hereby granted, free of charge, to any person obtaining # a...
from unittest import TestCase, expectedFailure from autodepgraph import visualization as vis import autodepgraph as adg import networkx as nx from autodepgraph.graph import AutoDepGraph_DAG import yaml import os test_dir = os.path.join(adg.__path__[0], 'tests', 'test_data') class Test_Graph(TestCase): @classmeth...
# -*- coding: utf-8 -*- # # ----------------------------------------------------------------------------------- # Copyright (c) Microsoft Open Technologies (Shanghai) Co. Ltd. All rights reserved. # # The MIT License (MIT) # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this softw...
#!/usr/bin/env python ''' ckanext/ioos_theme/controllers/feedback.py IOOS Theme Feedback Controller ''' from ckan.lib.base import BaseController, render, _ from ckan.lib import helpers as h from ckan.common import request from ckanext.ioos_theme.lib import feedback from pylons import config import logging import urlli...
import calendar import datetime from .app import app, mongo from .filters import date from .nav import set_navbar_active from flask import render_template, g from flask.ext.pymongo import ASCENDING @app.route('/browse') @set_navbar_active def browse(): locations = sorted(mongo.db.cases.distinct('location')) ...
#<pre>Copyright 2006 The Closure Library 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 ...
import re import json import requests import urllib.parse from secrets import Secrets import TwitterSearch def run_search(): sources = [] try: tso = TwitterSearch.TwitterSearchOrder() tso.set_search_url("?%s" % urllib.parse.urlencode({"q":"\"%s\"" % SEARCH_TERM})) tso.set_locale('en') ...
#!/usr/bin/python # # www.blinkenlight.net # # Copyright 2011 Udo Klein # # 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 l...
from ..with_request import WithRequest class Account(WithRequest): def __init__(self, url, session_id): self.base_url = url self.session_id=session_id def account_get_by_id(self, i_account): """Get account by id""" endpoint = "{0}".format('/rest/Account/get_account_info') ...
""" Algorithm predicting a random rating. """ from __future__ import (absolute_import, division, print_function, unicode_literals) import numpy as np from .algo_base import AlgoBase class NormalPredictor(AlgoBase): """Algorithm predicting a random rating based on the distribution of the...
# -*- coding: utf-8 -*- # Form implementation generated from reading ui file 'interface.ui' # # Created by: PyQt5 UI code generator 5.14.2 # # WARNING! All changes made in this file will be lost! from PyQt5 import QtCore, QtGui, QtWidgets class Ui_MainWindow(object): def setupUi(self, MainWindow): Main...
"""Views for exercise app.""" from django.contrib.auth.mixins import LoginRequiredMixin, UserPassesTestMixin from django.http import HttpResponseRedirect from django.shortcuts import redirect, reverse from django.urls import reverse_lazy from django.views.generic import CreateView, DeleteView, DetailView, ListView, Upd...
# remove this file when no longer needed import os import shutil parent_dir = os.path.abspath(os.path.dirname(__file__)) cleaned_file = os.path.abspath(os.path.join(parent_dir, r'.cleaned.tmp')) if not os.path.isfile(cleaned_file): dead_dirs = [os.path.abspath(os.path.join(parent_dir, *d)) for d in [ ('to...
# -*- coding: utf-8 -*- import codecs, os, cStringIO as StringIO, re, sys class IStreamBuffer: @staticmethod def _conv(v): return v.rstrip(u'\n\r') def __init__(self,inputfile): self.input = codecs.getreader('utf-8')(inputfile) self.stack = [] def __iter__(self): r...