src stringlengths 721 1.04M |
|---|
# -*- coding: utf-8 -*-
from datetime import datetime
import itertools
import logging
import math
import re
import uuid
from werkzeug.exceptions import Forbidden
from openerp import _
from openerp import api, fields, models
from openerp import http
from openerp import modules
from openerp import tools
from openerp im... |
#!/usr/local/bin/python2.7
from sys import exit, stdout, argv
from os import environ, system
environ['KERAS_BACKEND'] = 'tensorflow'
import numpy as np
import utils
import signal
from keras.layers import Input, Dense, Dropout, concatenate, LSTM, BatchNormalization, Conv1D, concatenate
from keras.models import Model ... |
#!/usr/bin/env python
import unittest
import os
import sys
import time
import subprocess
import signal
RCFILE = os.environ.get('COVERAGE_RCFILE', '.coveragerc')
from chatbot.client import Client
class ChatbotTest(unittest.TestCase):
@classmethod
def setUpClass(self):
self.port = '8002'
self... |
# 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 os
import sub... |
from hap_config_editor import hap_config_editor
import hap_config
import time
import threading
HAP_CE = hap_config_editor()
HAP_List = hap_config.HAP_List
# HAP_List HAP_ID HAP_Name login_time
def register(hap_name, hap_type, val_list=[], func_list=[]):
hap_id = "{0:04d}".format((len(HAP_List) + 1))
HAP_List.a... |
# 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... |
import httplib
import json
import time
import random
import socket
__version__ = "1.0"
def serialize(app, ver, host, instance):
update = dict(
app=app,
ver=ver,
host=host,
instance=instance)
data = json.dumps(update)
return data
def send_u... |
#!/usr/bin/env python3
import os
import glob
import argparse
import random
FLAG = None
def parse_single_file(fn):
feat_list = []
with open(FLAG.dir_name + '/' + fn, 'r') as f:
for line in f:
line_sp = line.rstrip().split(',')
line_sp.append(fn)
feat_list.append(lin... |
"""
Management command to sync all Users, Orders, Products, and Lines with Hubspot
and Line Items
"""
from django.contrib.auth.models import User
from django.core.management import BaseCommand
from applications.models import BootcampApplication
from hubspot.api import (
make_contact_sync_message,
make_product_... |
#!/usr/bin/env python
"""Performance test to compare the performance of buck between two revisions.
The general algorithm is:
Checkout <revisions_to_go_back - 1>
Warm up the cache:
Set .buckversion to old revision, build all targets
Set .buckversion to new revision, build all targets
For each revision to test:
... |
import numpy as np
def generate_surface(y_size, delta_x, grain_size):
wing_size = 12 * grain_size
noise = np.random.random(y_size + wing_size) * 2 * delta_x - delta_x
noise = noise / np.max(noise) * delta_x
gauss = np.fromfunction(lambda i: np.exp(
(i - 3 * grain_size) / (2 * grain_size ^ 2)),... |
# Example plugin for Graph for showing statistics information for a point series.
# The plugin creates an action and adds it to the main menu and the context menu of the function list.
# The plugin hooks into the function list. Every time a new element is selected, the action is updated to be enabled if the element is ... |
import json
import sys
from collections import UserList
from django.conf import settings
from django.core.exceptions import ValidationError # backwards compatibility
from django.utils import six, timezone
from django.utils.encoding import force_text
from django.utils.html import escape, format_html, format_html_join,... |
#!/usr/bin/env python
# This is the MIT License
# http://www.opensource.org/licenses/mit-license.php
#
# Copyright (c) 2007,2008 Nick Galbreath
#
# 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 Softw... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys, os
test_root = os.path.dirname(os.path.abspath(__file__))
os.chdir(test_root)
sys.path.insert(0, os.path.dirname(test_root))
sys.path.insert(0, test_root)
import unittest
from pycorreios.correios import Correios
from pycorreios.model import Cep, Frete, Encome... |
# This file is part of HDL Checker.
#
# Copyright (c) 2015 - 2019 suoto (Andre Souto)
#
# HDL Checker 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 ... |
from copy import deepcopy
from .errors import MissingElementAmountValue, FactoryStartedAlready, MissingRequiredFields
class Factory(object):
"""
The base class of all the factories.
Implementes the core factory logic.
"""
def __init__(self):
self._element_amount = 0
self._current_in... |
from __future__ import absolute_import
from copy import deepcopy
from django import forms
from django.db import models
from django.utils.translation import ugettext_lazy as _
from django_filters import filterset
from .. import compat, utils
from .filters import BooleanFilter, IsoDateTimeFilter
FILTER_FOR_DBFIELD_... |
# -*- coding: utf-8 -*-
import sys
import collections
# external libraries
import requests
import requests.exceptions
class YandexTranslate:
def __init__(self, yandex_api_key: str):
self._apikey = yandex_api_key
self._yt_url = 'https://translate.yandex.net/api/v1.5/tr.json/translate'
... |
import subprocess
class CmdRunException(Exception):
pass
class Util(object):
verbose = False
@classmethod
def cmdOutput(cls, cmd, havepassword = False):
if cls.verbose and not havepassword:
print(cmd)
proc = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE, stderr=su... |
"""
Resource to deal with epi-weeks
"""
import datetime
from dateutil.parser import parse
from flask import jsonify
from flask_restful import Resource
from meerkat_api.extensions import api
import meerkat_abacus.util.epi_week as epi_week_util
class EpiWeek(Resource):
"""
Get epi week of date(defaults to toda... |
# -*- coding: utf-8 -*-
# © 2016 Therp BV <http://therp.nl>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from mock import patch
from openerp.tests.common import TransactionCase
class TestMailNotificationEmailTemplate(TransactionCase):
def test_mail_notification_email_template(self):
... |
import numpy as np
from ..geometry import order_channels_by_distance
def noise_cov(path, dtype, batch_size, n_channels, neighbors, geom, temporal_size):
wfile = open(path, 'rb')
dsize = np.dtype(dtype).itemsize
flattenedLength = dsize*batch_size*n_channels
wfile.seek(0)
rec = wfile.read(flatt... |
# 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/.
# Common codegen classes.
import operator
import re
import string
import textwrap
import functools
from WebIDL import ... |
# -*- coding: utf-8 -*-
"""
Ex Test treatment
Explore treatment
Renamed - To avoid conflict with nose2.
Used by: Treatment
Created: 14 aug 2018
Last up: 14 apr 2021
"""
from __future__ import print_function
import json
from . import test_funcs
# ------------------------------------------------------... |
# -*- coding: utf8 -*-
import lxml.etree
import sys
import glob
import getopt
import os.path
import io
def transform(xsltfilename, sourcefilename, targetfilename = None, encoding = 'utf-8', **kwargs):
xsldir = os.path.dirname(__file__)
if xsltfilename[0] != '/': xsltfilename = os.path.join(xsldir, xsltfilenam... |
#!/usr/bin/env python
import sys
import bottle
from bottle import Bottle, request, error, response, Response
from os.path import abspath, dirname
import logging
sys.path.append(dirname(abspath(__file__)))
import pkppln
from webapp.admin.terms_server import TermsApp
from webapp.sword.sword_server import SwordServer
fr... |
from Screens.Screen import Screen
from Components.ActionMap import ActionMap
from enigma import eTimer
import os, struct, vbcfg
from vbipc import VBController
class HbbTVWindow(Screen):
skin = """
<screen name="HbbTVWindow" position="0,0" size="1280,720" backgroundColor="transparent" flags="wfNoBorder" title="Hbb... |
# -*- coding: utf-8 -*-
# !/usr/bin/env python
# -*- coding: utf-8 -*-
#
# pyvolume documentation build configuration file, created by
# sphinx-quickstart on Tue Jul 9 22:26:36 2013.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values... |
from __future__ import absolute_import, unicode_literals
from unittest import TestCase as UnitTestCase
import django
from django.contrib.contenttypes.models import ContentType
from django.core import serializers
from django.core.exceptions import ImproperlyConfigured, ValidationError
from django.test import TestCase,... |
##############################################################################
# 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 .base import FunctionalTest
from core.db.manager import DataHubManager
class LoginTest(FunctionalTest):
def test_sign_in_bad_user(self):
# Justin has not created an account, but he tries to sign in anyway
self.sign_in_manually()
justin_url = self.browser.current_url
self.assert... |
# Copyright (C) 2013-2015 Codethink Limited
#
# 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 distributed in the hope that it will be useful,
# but... |
# coding:utf-8
from flask import Flask, render_template, session, flash
from flask.ext.sqlalchemy import SQLAlchemy
app = Flask(__name__)
# strong secret key!!
app.config['SECRET_KEY'] = '\xa6\xb5\x0e\x7f\xd3}\x0b-\xaa\x03\x03\x82\x10\xbe\x1e0u\x93,{\xd4Z\xa3\x8f'
app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///e... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
BPMN diagram for FOMDES process 1
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
from bpmn_pgv import *
import pygraphviz as pgv
__author__ = 'mapologo'
PROCE... |
"""
For CommonsCloud copyright information please see the LICENSE document
(the "License") included with this software package. This file may not
be used in any manner except in compliance with the License
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed ... |
# coding=utf8
"""
This module contains some hard-coding data for level map.
"""
from __future__ import unicode_literals
import random
from collections import OrderedDict
from core import Map
class GameHelpers(object):
@staticmethod
def create_from_mine_index_list(height, width, mine_index_list):
retu... |
from __future__ import unicode_literals
import pytest
from django.db import models
from django.shortcuts import get_object_or_404
from django.test import TestCase
from django.utils import six
from rest_framework import generics, renderers, serializers, status
from rest_framework.response import Response
from rest_fra... |
from datetime import datetime
from dateutil.tz import gettz
import numpy as np
import pytest
import pytz
from pytz import utc
from pandas._libs.tslibs import (
NaT,
Timedelta,
Timestamp,
conversion,
to_offset,
)
from pandas._libs.tslibs.period import INVALID_FREQ_ERR_MSG
import pandas.util._test_d... |
#
import sys
import argparse
import logging
import time
import uuid
from random import random
import json
from functools import partial
import threading
import Queue
from itertools import cycle
from abc import ABCMeta, abstractmethod
from .base import message_valid
logger = logging.getLogger(__name__)
class Message... |
from github3.repos.repo import Repository
from .helper import UnitHelper
class TestRepository(UnitHelper):
described_class = Repository
example_data = {
"id": 1296269,
"owner": {
"login": "octocat",
"id": 1,
"avatar_url": "https://github.com/images/error/oc... |
# -*- coding: utf-8 -*-
"""
glashammer.bundles.middleware.csrf_protection
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Provides a simple middleware to secure against Cross Site Remote Forgery
attacks by setting cookies on every request and validate them on post
requests.
:copyright: 2010, The Glashammer Authors
:license: MIT
... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
r"""
On mac need to run with sudo
Testing:
python %HOME%/code/ibeis/_installers/ibeis_pyinstaller_data_helper.py --test-get_data_list
python ~/code/ibeis/_installers/ibeis_pyinstaller_data_helper.py --test-get_data_list
SeeAlso:
_installers/ibeis_pyinstalle... |
from pybindgen import Module, FileCodeSink, param, retval, cppclass, typehandlers
import pybindgen.settings
import warnings
class ErrorHandler(pybindgen.settings.ErrorHandler):
def handle_error(self, wrapper, exception, traceback_):
warnings.warn("exception %r in wrapper %s" % (exception, wrapper))
... |
import matplotlib as mpl
import matplotlib.pyplot as plt
import numpy as np
import scipy.constants as const
from scipy.optimize import curve_fit
def auswertung(material, querschnitt, einspannung, x, D, d, L, M):
if einspannung == "einseitig":
u = L*x**2 - x**3/3
g = const.g
F = M*g
# ... |
# coding:utf-8
'''
设置
Author : qbeenslee
Created : 2014/10/9
'''
import os
# 是否开启测试
DEBUG = False
BASE_PATH = os.path.abspath(os.path.join(os.path.dirname(__file__), os.path.pardir))
# 数据库设置
# if DEBUG:
# DB_CONFIG = {
# "host": '127.0.0.1',
# "db": 'nepenthes',
# "port": '3140',
# "user": '... |
#!/usr/bin/python3
# -*- coding: utf-8 -*-
#
# «recovery_xml» - Helper Class for parsing and using a bto.xml
#
# Copyright (C) 2010-2011, Dell Inc.
#
# Author:
# - Mario Limonciello <Mario_Limonciello@Dell.com>
#
# This is free software; you can redistribute it and/or modify it under
# the terms of the GNU General Pub... |
import threading
from cms.models import CMSPlugin
from django.db import models
from django.utils.translation import ugettext_lazy as _
from inline_ordering.models import Orderable
from filer.fields.image import FilerImageField
from django.core.exceptions import ValidationError
import utils
localdata = threading.loca... |
#!/usr/bin/env python
import time
import RPi.GPIO as GPIO
GPIO.setwarnings(False)
GPIO_TRIGGER=17
GPIO_ECHO=27
GPIO.setmode(GPIO.BCM)
GPIO.setup(GPIO_TRIGGER,GPIO.OUT)
GPIO.setup(GPIO_ECHO,GPIO.IN)
def getDistance_1():
GPIO.output(GPIO_TRIGGER, GPIO.LOW)
time.sleep(0.3)
GPIO.output(GPIO_TRIGGER, True)
ti... |
from __future__ import print_function
import pandas as pd
import pickle as pk
import cv2
import os
import re
import progressbar
import imutils
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
from mahotas.features import haralick
import json
from sklearn.decomposition import PCA
plt.style.use('s... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (c) 2014 University of Dundee & Open Microscopy Environment.
# All rights reserved.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foun... |
# # # # # # # # # # # # # # #
# Lucas Maximiliano Marino #
# (c) 2016 MIT License #
# http://lucasmarino.me #
# # # # # # # # # # # # # # #
#
# IMPORTS AND VARIABLES
#
import os
state = True
#
# MAGIC()
#
def magic(text, kind):
numb = input(text)
try:
if kind == "float":
numb = f... |
'''
通过用户id 获取网易云音乐用户听歌历史
歌曲云图
'''
import time
from os import path
from selenium import webdriver
import numpy as np
from bs4 import BeautifulSoup
from PIL import Image
from wordcloud import WordCloud
class SongCloudImage(object):
baseUrl = 'http://music.163.com/#/user/songs/rank?id={}'
def __init__(self, ... |
from mock import patch
from django.contrib.sites.models import Site
from django_webtest import TransactionWebTest
from requests.adapters import ConnectionError
from slumber.exceptions import HttpServerError
def raise_connection_error(*args, **kwargs):
raise ConnectionError()
def raise_http_server_error(*args, ... |
#!/usr/bin/env python
#
# Copyright 2015-2016 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
# GNU Radio 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, or (at your optio... |
# -*- coding: utf-8 -*-
"""
Helper functions used in views.
"""
import csv
import urllib2
import time
import threading
import locale
from json import dumps
from functools import wraps
from datetime import datetime
from lxml import etree
from functools import wraps
from flask import Response
from presence_analyzer.mai... |
# encoding: UTF-8
from six.moves import input
from time import time
from vnlbank import LbankRestApi, LbankWebsocketApi
API_KEY = '132a36ce-ad1c-409a-b48c-09b7877ae49b'
SECRET_KEY = '319320BF875297E7F4050E1195B880E8'
#----------------------------------------------------------------------
def restTest():
""""""... |
#!/usr/bin/python
import ConfigParser
import feedparser
import logging
import os
import pywapi
import string
import sys
import time
import unicodedata
from core.alive import alive
from pygeocoder import Geocoder
from core.aprsfi import AprsFi
from core.voicesynthetizer import VoiceSynthetizer
from core.phonetic impo... |
# 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, software
# distributed under the ... |
from . import base
from .decorators import *
import tuned.logs
from . import exceptions
from tuned.utils.commands import commands
import tuned.consts as consts
import os
import re
import tempfile
log = tuned.logs.get()
class BootloaderPlugin(base.Plugin):
"""
Plugin for tuning bootloader options.
Currently only ... |
# Copyright 2014-2016 Insight Software Consortium.
# Copyright 2004-2008 Roman Yakovenko.
# Distributed under the Boost Software License, Version 1.0.
# See http://www.boost.org/LICENSE_1_0.txt
"""
defines classes, that describe C++ types
"""
from . import algorithms_cache
class type_t(object):
"""base class f... |
# -*- coding: utf-8 -*-
import platform
""" there are lots of things not implemented for Gtk+ yet.
We've started this effort 1 Apr 2015 so it isn't fully functional. We will remove the ifs statements when are no needed"""
system = platform.system()
if system == "Windows":
import sys
import os
#redirect the orig... |
# Copyright 2014 Diamond Light Source Ltd.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed t... |
import argparse
import base64
import json
import numpy as np
import socketio
import eventlet
import eventlet.wsgi
import time
from PIL import Image
from PIL import ImageOps
from flask import Flask, render_template
from io import BytesIO
from random import randint
from keras.models import model_from_json
... |
"""
Example of use of sediment transport and vegetation drag operators over
a raster-derived topography
M. Perignon
perignon@colorado.edu
July 2014
"""
#------------------------------------------------------------------------------
# Import necessary modules
#-------------------------------------------... |
"""A convenience which constructs expression trees from an easy-to-read syntax
Use this unless you have a compelling reason not to; it performs some
optimizations that would be tedious to do when constructing an expression tree
by hand.
"""
from collections import OrderedDict
from inspect import isfunction, ismethod
... |
"""Commands for creating datasets."""
import sys
import os
import getpass
import datetime
try:
from StringIO import StringIO
except ImportError:
from io import StringIO
import click
import dtoolcore
import dtoolcore.storagebroker
import dtoolcore.utils
from ruamel.yaml import YAML
from ruamel.yaml.comments ... |
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be usefu... |
# coding=utf-8
# Copyright 2021 The TensorFlow Datasets 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 appl... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
################################################################################
# test_wpa2compare.py
# Tests for calculating PMK from MK and comparing - Modify Makefile to run
# Copyright (C) 2016 Jarrett Rainier
#
# This prog... |
import numpy as np
import matplotlib.pyplot as plt
import time
from BZI.symmetry import make_ptvecs
from BZI.sampling import make_grid
from BZI.pseudopots import Al_PP
from BZI.integration import monte_carlo
from BZI.plots import PlotMesh
class Convergence(object):
""" Compare integrations of pseudo-potentials by... |
import numpy as np
import scipy as sp
import openpnm as op
import openpnm.models.geometry.pore_seed as mods
class PoreSeedTest:
def setup_class(self):
self.net = op.network.Cubic(shape=[5, 5, 5])
self.geo = op.geometry.GenericGeometry(network=self.net,
... |
from decimal import *
import datetime
from operator import attrgetter
from django.forms.formsets import formset_factory
from django.contrib.sites.models import Site
from models import *
from forms import *
try:
from notification import models as notification
except ImportError:
notification = None
def is_n... |
# -*- coding: utf-8 -*-
import telebot # Librería de la API del bot.
import random
from telebot import types # Tipos para la API del bot.
import time # Librería para hacer que el programa que controla el bot no se acabe.
import sys
from sportbot import bot
reload(sys)
sys.setdefaultencoding("utf-8")
local = True
gi... |
# 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, software
# distributed under the Li... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from pytest import importorskip
from translate.convert import ini2po, test_convert
from translate.misc import wStringIO
importorskip("iniparse")
class TestIni2PO(object):
ConverterClass = ini2po.ini2po
def _convert(self, input_string, temp... |
# 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, software
# distributed under th... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
from DirectoryManagement import DirectoryManagement
import logging, random, string
from Utils import checkOptionsGivenByTheUser
from Constants import *
class ExternalTable (DirectoryManagement):
'''
Allow the user to read file thanks to external tables
'''
def __init__(... |
# -*- encoding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# This module copyright (C) 2011-2012 Therp BV (<http://therp.nl>)
# All Rights Reserved
#
# This program is free software: you can redistribute it and/or mod... |
# -*- coding: utf-8 -*-
# 1st-run initialisation
# Set settings.base.prepopulate to 0 in Production
# (to save 1x DAL hit every page).
pop_list = settings.get_base_prepopulate()
if pop_list == 0:
pop_list = []
else:
table = db[auth.settings.table_group_name]
# The query used here takes 2/3 the time of .co... |
# -*- coding: utf-8 -*-
"""
The core algorithm of reciever.
Definitely, it's the model of producer and consumer.
Coroutine is a better way of implementing that model.
However, when connecting to the server,
it also needs to keep alive by heartbeat.
"""
import time
import gevent
import struct
from ge... |
#!/usr/bin/env python3
import time
import argparse
import numpy as np
import gym
import gym_minigrid
from gym_minigrid.wrappers import *
from gym_minigrid.window import Window
import babyai
def redraw(img):
if not args.agent_view:
img = env.render('rgb_array', tile_size=args.tile_size)
window.show_im... |
import click
from prepare_args_all_instances import prepare_args
from generate_labels import generate_labels
from generate_mean_image_binaryprotos import generate_mean_files
from read_csv_seperated_rgb_histograms import generate_lmdbs
@click.command()
@click.option('--source_dir', type=click.STRING,
default='/... |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
# import sys
import os
from loguru import logger
import sys
import os.path
import numpy as np
from io import open
from .image import DataPlus
path_to_script = os.path.dirname(os.path.abspath(__file__))
sys.path.append(os.path.join(path_to_script, "./extern/sPickle"))
... |
"""GPU-based interactive Mandelbrot fractal example."""
from galry import *
import numpy as np
import numpy.random as rdn
FSH = """
// take a position and a number of iterations, and
// returns the first iteration where the system escapes a box of size N.
int mandelbrot_escape(vec2 pos, int iterations)
{
vec2 z = vec2... |
from conans import ConanFile, CMake
class BPTreeConan(ConanFile):
name = 'bptree'
version = '0.0.0'
url = 'https://github.com/jason2506/bptree-cpp'
license = 'MIT'
author = 'Chi-En Wu'
settings = ('os', 'compiler', 'build_type', 'arch')
generators = ('cmake', 'txt')
no_copy_source = ... |
import six
from babbage.query.parser import Parser
from babbage.exc import QueryException
class Ordering(Parser):
""" Handle parser output for sorting specifications, a tuple of a ref
and a direction (which is 'asc' if unspecified). """
start = "ordering"
def order(self, ast):
if isinstance(... |
#!/usr/bin/env python
#
# sf-crm-addDocument.py
# Copyright (C) <year> <name of author>
#
# 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) ... |
from __future__ import absolute_import
import six
from rest_framework.response import Response
from social_auth.models import UserSocialAuth
from django.conf import settings
from django.conf.urls import url
from django.core.urlresolvers import reverse
from django.utils.html import format_html
from sentry.api.serial... |
#!/usr/bin/env python3
'''{executable_name}: Importer for .po files to Audaces ML new translation format.
Usage:
{executable_name}: [--mark <mark>] [<file>]
This program imports .po (gettext translation) files to Audaces ML .tra format.
If a custom mark is set through --mark, it wil be placed on both ends of th... |
from collections import namedtuple
from pathlib import Path
from pprint import pformat
import difflib
Outcome = namedtuple("Outcome", 'source source_line passing description')
def caller_source_code(frames_up=2):
import inspect
src = inspect.stack(context=1)[frames_up]
return src
# return "{} ({}:{})"... |
import pytest
from flex.error_messages import MESSAGES
from flex.exceptions import ValidationError
from flex.loading.definitions.schema import schema_validator
from tests.utils import (
assert_path_not_in_errors,
assert_message_in_errors,
)
def test_format_is_not_required():
try:
schema_validato... |
from __future__ import unicode_literals, division, absolute_import
import logging
import subprocess
from flexget import plugin
from flexget.entry import Entry
from flexget.event import event
from flexget.config_schema import one_or_more
from flexget.utils.template import render_from_entry, render_from_task, RenderErr... |
import agros2d
from test_suite.scenario import Agros2DTestCase
from test_suite.scenario import Agros2DTestResult
class TestFlowPlanar(Agros2DTestCase):
def setUp(self):
# problem
problem = agros2d.problem(clear = True)
problem.coordinate_type = "planar"
problem.mesh_type = ... |
from go_somewhere_significant import *
from go_to_adjacent_systems import *
import Briefing
import Director
import VS
import debug
import faction_ships
import launch
import quest
import unit
import universe
import vsrandom
class cargo_mission (Director.Mission):
def initbriefing(self):
VS.IOmessage (0,"ca... |
# -*- mode: python -*-
# -*- coding: iso8859-15 -*-
##############################################################################
#
# Gestion scolarite IUT
#
# Copyright (c) 2001 - 2013 Emmanuel Viennet. All rights reserved.
#
# This program is free software; you can redistribute it and/or modify
# it under the ter... |
# -*- coding: utf-8 -*-
"""
=========================================
Generating a Map From Data
=========================================
A simple demonstration of creating a map from a numpy array of data.
"""
##############################################################################
# Start by importing the ne... |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
#
# Copyright 2010 OpenStack Foundation
# Copyright 2012 University Of Minho
#
# 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
#
# ... |
# -*- encoding: utf-8 -*-
from __future__ import unicode_literals
from south.db import db
from south.v2 import SchemaMigration
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding model 'Message'
db.create_table('djmail_message', (
('uuid', self.gf('django.db.models.f... |
import sys
from .dataload import load_specs
from .smartapi_parser import SmartAPIParser
from .filter import filterOps
import traceback
class MetaKG:
def __init__(self):
self.ops = []
self.parser = SmartAPIParser()
def populateOpsFromSpecs(self, specs, verbose=False):
"""Populate meta... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.