gt stringclasses 1
value | context stringlengths 2.49k 119k |
|---|---|
import datetime
from django.forms import *
from django.utils import formats
from django.utils.encoding import StrAndUnicode, force_unicode
from django.utils.html import conditional_escape
from django.utils.safestring import mark_safe
from django.forms.util import flatatt
from django.utils import datetime_safe
from do... | |
# -*- coding: utf-8 -*-
"""
drawing ERD(table relationships) by graphviz dot
"""
import os
import re
import json
from time import strftime, localtime
import logging
import subprocess
from mako.template import Template
from random import randint
from mabozen.config import get_db_config
from mabozen.lib.pg import pa... | |
# importing necessary utilities and frameworks
import os
import csv
import cv2
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.image as mpimg
import sklearn
# helper functions
def cropImage(image):
cropped_image = image[65:140, 0:320]
# NOTE: its img[y: y + h, x: x + w] and *not* img[x: x ... | |
#
# Copyright (c) 2008-2015 Citrix Systems, 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 l... | |
# coding: utf-8
from __future__ import absolute_import
from swagger_server.models.comment import Comment
from swagger_server.models.contact import Contact
from swagger_server.models.message import Message
from swagger_server.models.project import Project
from . import BaseTestCase
from six import BytesIO
from flask i... | |
import mock
from urlparse import urlparse
import pytest
from nose.tools import * # flake8: noqa
from framework.auth import core
from osf.models import Guid
from api.base.settings.defaults import API_BASE
from api.base.settings import osf_settings
from api_tests import utils as test_utils
from tests.base import ApiT... | |
# Copyright (c) 2016-present, Facebook, 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... | |
# coding=utf-8
"""
Collects JMX metrics from the Jolokia Agent. Jolokia is an HTTP bridge that
provides access to JMX MBeans without the need to write Java code. See the
[Reference Guide](http://www.jolokia.org/reference/html/index.html) for more
information.
By default, all MBeans will be queried for metrics. All n... | |
# No shebang line, this module is meant to be imported
#
# Copyright 2014 Oliver Palmer
#
# 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
#
# Unle... | |
# -*- coding: utf-8 -*-
#-----------------------------------------------------------------------------
# Copyright (c) 2011, Evan Leis
#
# Distributed under the terms of the Lesser GNU General Public License (LGPL)
#-----------------------------------------------------------------------------
'''
Created on Jun 8, 2011... | |
##################################
# InMoov auto generated calibration
# Sun Sep 03 02:32:48 UTC 2017
##################################
# Servo Config : i01.head.eyeX
i01.head.eyeX.detach()
i01.head.eyeX.setMinMax(60.0,100.0)
i01.head.eyeX.setVelocity(-1.0)
i01.head.eyeX.setRest(80.0)
i01.head.eyeX.setPin(22)
i01.he... | |
from django.shortcuts import render, redirect, get_object_or_404, reverse
from django.core.exceptions import PermissionDenied
from django.contrib import messages
from django.contrib.auth.decorators import login_required
from django.http import HttpResponse
from django.conf import settings
from ..models import Site
fro... | |
# Copyright 2018 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | |
import ssl
import zlib
import errno
import atexit
import select
import socket
import logging
import msgpack
import threading
import collections
logger = logging.getLogger(__name__)
import synapse.glob as s_glob
import synapse.common as s_common
import synapse.lib.scope as s_scope
import synapse.lib.msgpack as s_msgpa... | |
#
# Copyright (c) 2010-2014, MIT Probabilistic Computing Project
#
# Lead Developers: Dan Lovell and Jay Baxter
# Authors: Dan Lovell, Baxter Eaves, Jay Baxter, Vikash Mansinghka
# Research Leads: Vikash Mansinghka, Patrick Shafto
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may... | |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Project Compiler
#
import os, sys, re, shutil, time, run, sgmllib, codecs, tempfile, subprocess
template_dir = os.path.abspath(os.path.dirname(sys._getframe(0).f_code.co_filename))
sys.path.append(os.path.abspath(os.path.join(template_dir,'..')))
sys.path.append(os.pa... | |
# -*- coding: utf-8 -*-
__all__ = ['Reverse', 'UrlBuildingError']
from .url import URL
from .url_templates import UrlBuildingError
from ..utils import cached_property
class Location(object):
'''
Class representing an endpoint in the reverse url map.
'''
def __init__(self, *builders, **kwargs):
... | |
#PyJ2D - Copyright (C) 2011 James Garnon <https://gatc.ca/>
#Released under the MIT License <https://opensource.org/licenses/MIT>
from java.awt.image import BufferedImage, RasterFormatException
from java.lang import ArrayIndexOutOfBoundsException
from java.util import Hashtable
from pyj2d.rect import Rect
from pyj2d.c... | |
#!/usr/bin/env python
#
# Copyright (c) 2012-2015 PX4 Development Team. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# 1. Redistributions of source code must retain the above copyright
# ... | |
# Copyright 2011 OpenStack Foundation
# 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 requ... | |
# Copyright 2012 OpenStack LLC.
# 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... | |
##################################################################
# Code for testing the variational Multi-Stage Generative Model. #
##################################################################
# basic python
import numpy as np
import numpy.random as npr
import cPickle
# theano business
import theano
import th... | |
#!/usr/bin/env python
# Copyright 2020 gRPC 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... | |
#!/usr/bin/env python
# coding:utf-8
"""
GAEProxyHandler is the handler of http proxy port. default to 8087
if HTTP request:
do_METHOD()
elif HTTPS request:
do_CONNECT()
What is Direct mode:
if user access google site like www.google.com, client.google.com,
we don't need forward re... | |
__author__ = 'Sean Griffin'
__version__ = '1.0.0'
__email__ = 'sean@thoughtbot.com'
import sys
import os.path
import json
import shutil
from pymel.core import *
from maya.OpenMaya import *
from maya.OpenMayaMPx import *
kPluginTranslatorTypeName = 'Three.js'
kOptionScript = 'ThreeJsExportScript'
kDefaultOptionsStri... | |
import requests
import webbrowser
class APICall(object):
def __init__(self, token, user_id):
self.url = "https://manager.fenero.com/MobileApi/"
self.token = token
self.id = user_id
# API call worker function
def poll_api(self, req, p):
r = requests.get(self.url + req, para... | |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# http://pythonhosted.org/llfuse/example.html
# https://github.com/python-llfuse/python-llfuse
import errno
import logging
import os
import stat
import tarfile
import time
from argparse import ArgumentParser
try:
import faulthandler
except ImportError:
pass
else:
... | |
from flask import abort, request, jsonify, url_for, g
from ..models import User, Bucketlist, Item
from flask_restful import Api, Resource, reqparse, fields, marshal
from flask_sqlalchemy import SQLAlchemy
from flask_httpauth import HTTPTokenAuth
from app import db
from ..serializers import bucketlist_serializer, item_s... | |
"""A collection of string operations (most are no longer used).
Warning: most of the code you see here isn't normally used nowadays.
Beginning with Python 1.6, many of these functions are implemented as
methods on the standard string object. They used to be implemented by
a built-in module called strop, but strop is n... | |
#!/usr/bin/python
# -*- coding: utf-8 -*-
import cv2
import os
import re
import numpy as np
import platform
import time
import operator
from EmeraldAI.Config.Config import Config
from EmeraldAI.Logic.Modules import Global
from EmeraldAI.Logic.Singleton import Singleton
from EmeraldAI.Logic.Logger import FileLogger
from... | |
# -*- coding: utf-8 -*-
"""Parsers for MacOS fseventsd files."""
from dfdatetime import semantic_time as dfdatetime_semantic_time
from dfvfs.resolver import resolver as path_spec_resolver
from plaso.containers import events
from plaso.containers import time_events
from plaso.lib import definitions
from plaso.lib imp... | |
"""
Cache configuration.
This works in conjunction with dogpile.cache_ to provide caching for any Weasyl
project.
.. _dogpile.cache: http://dogpilecache.readthedocs.org/en/latest/
"""
import json
import threading
import dogpile.cache
import dogpile.cache.backends.memcached
import pylibmc
from dogpile.cache.api impo... | |
#! /usr/bin/python3
"""
This is a cleanup script for vexxhost/psi cloud.
To test openstack deployment on ovb jobs, on vexxhost/si cloud a heat
stack is created.
Normally, Heat stack is created and destroyed by job itself.
But, sometimes due to infra related issues heat stack failed to
create/delete by job itself.
In a ... | |
#
# Copyright (c) SAS Institute 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 w... | |
"""The tests for the Dialogflow component."""
import copy
import json
import pytest
from homeassistant import config_entries, data_entry_flow
from homeassistant.components import dialogflow, intent_script
from homeassistant.config import async_process_ha_core_config
from homeassistant.core import callback
from homeas... | |
########################################################################
#
# Documentation generator for panda.
#
# How to use this module:
#
# from direct.directscripts import gendocs
# gendocs.generate(version, indirlist, directdirlist, docdir, header, footer, urlprefix, urlsuffix)
#
# - version is the panda ve... | |
import sys
import time
import os
import errno
import shlex
import pydoc
import inspect
import collections
color2num = dict(
gray=30,
red=31,
green=32,
yellow=33,
blue=34,
magenta=35,
cyan=36,
white=37,
crimson=38
)
def colorize(string, color, bold=False, highlight=False):
attr... | |
# Copyright 2020 Google LLC
#
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file or at
# https://developers.google.com/open-source/licenses/bsd
import os
import re
from base64 import b64decode
from datetime import datetime, time
from uuid import UUID
from django.conf ... | |
from __future__ import absolute_import
from datetime import datetime
from django.db import models
from krankshaft.api import API as APIBase
from krankshaft.auth import Auth as AuthBase
from krankshaft.authn import Authn
from krankshaft.authz import Authz as AuthzBase
from krankshaft.resource import DjangoModelResource... | |
# Copyright 2011 OpenStack Foundation
# 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 requ... | |
"""
This is adapted from the PyObjC PythonBrowser demo.
I beleive that demo was written by Just van Rossum.
"""
import AppKit
from objc import python_method
from operator import getitem, setitem
import inspect
from vanilla.vanillaBase import VanillaBaseObject
from vanilla.nsSubclasses import getNSSubclass
import wa... | |
#!/usr/bin/env python3
# Copyright 2015-2016 Open Source Robotics Foundation, 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
#
# Unle... | |
"""
Description:
Requirements: pySerial, wxPython Phoenix
glossary and of other descriptions:
DMM - digital multimeter
PSU - power supply
SBC - single board computer
INS - general instrument commands
GEN - general sequence instructions
"""
import wx
import theme
import base
# from wx.lib.agw import spinctrl
cl... | |
#########################
### Domain Parameters ###
#########################
# Table grid resolution
RESOLUTION=0.1
# End-Effector Frame
FRAME = "end_effector_grasp"
# Object placement tolerance
EPSILON = 1e-4
########################
### Imported Modules ###
########################
# Import our planning packa... | |
# 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... | |
# -*- coding: utf-8 -*-
import logging
from modularodm import exceptions, StoredObject
from modularodm.fields import IntegerField
from modularodm.query.query import RawQuery as Q
from tests.base import ModularOdmTestCase
logger = logging.getLogger(__name__)
class BasicQueryTestCase(ModularOdmTestCase):
COUNT ... | |
##
# Copyright (c) 2006-2017 Apple Inc. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable l... | |
import tensorflow as tf
import numpy as np
import cv2
import sys
import os
import datetime
from scipy.ndimage.filters import maximum_filter
from dqn import DQNAgent
from memory import ExperienceMemory
from memory import MatchResults, GameHistory
from memory import Episode, EpisodeHistory
# TODO: Think where this ... | |
## This script was modified from Dr. Bjarni J. Vilhjalmsson's code (https://bitbucket.org/bjarni_vilhjalmsson/ldpred). We thank him for sharing his code
try:
import scipy as sp
except Exception:
print 'Using Numpy instead of Scipy.'
import numpy as sp
#from numpy import linalg
from scipy import lina... | |
# Copyright 2013 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import copy
import datetime
import logging
import os
import re
import time
from lib.bucket import BUCKET_ID
from lib.exceptions import EmptyDumpException, I... | |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Partially based on AboutMessagePassing in the Ruby Koans
#
from runner.koan import *
class AboutAttributeAccess(Koan):
class TypicalObject(object):
pass
def test_calling_undefined_functions_normally_results_in_errors(self):
typical = self.T... | |
# Copyright 2015 Alex Meade
#
# 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 ... | |
# -*- coding: utf-8 -*-
# __author__ = 'dsedad'
from uuid import uuid4
import inspect
from flask_xadmin.xadm_salib import *
from flask import flash, current_app
from flask import redirect
from flask import request
from flask import url_for
from flask import session
from flask_admin.contrib.sqla import ModelView
from... | |
#!/usr/bin/env python
import mock
import os
import socket
import threading
import time
import unittest
from uhppote_rfid import ControllerSocket, SocketConnectionException, SocketTransmitException
class TestControllerSocket(unittest.TestCase):
"""
Tests UHPPOTE socket transmission by emulating the control b... | |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from .Banners import *
from .DataModel import *
import sys
import pyperclip
class SearchWindow(QtWidgets.QDialog):
def __init__(self, parent, plugin, searchable):
super(SearchWindow, self).__init_... | |
# kytten/frame.py
# Copyrighted (C) 2009 by Conrad "Lynx" Wong
# Classes which wrap one Widget.
# Wrapper: a base class for Widgets which contain one other Widget.
# Frame: positions its contained Widget within a graphic, which it stretches
# to cover the Widget's area, or the space within which it is containe... | |
# -*- coding: utf-8 -*-
import pytest
import pandas as pd
import warnings
class TestConfig(object):
@classmethod
def setup_class(cls):
from copy import deepcopy
cls.cf = pd.core.config
cls.gc = deepcopy(getattr(cls.cf, '_global_config'))
cls.do = deepcopy(getattr(cls.cf, '_... | |
from datetime import datetime
from io import StringIO
import re
from typing import Dict, List, Union
import numpy as np
import pytest
import pandas as pd
from pandas import DataFrame, Index, Series, Timestamp, date_range
import pandas._testing as tm
@pytest.fixture
def mix_ab() -> Dict[str, List[Union[int, str]]]:
... | |
# -*- coding: utf-8 -*-
"""
Created on Fri Jun 30 10:13:41 2017
@author: Niv Haim (Weizmann Institute of Science)
"""
import numpy as np
import numba as nb
from numpy.linalg import norm
from sim.utils import REASON_NONE, OrbitalParameters, get_dt0
spec = [
# main arrays
('X', nb.double[:, :]),
('V', nb... | |
# Copyright 2012 Pinterest.com
#
# 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,... | |
#! /usr/bin/env python
#
# Copyright (c) 2015 Google Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# 1. Redistributions of source code must retain the above copyright notice,
# this list o... | |
# Copyright (c) 2015 EMC Corporation.
# 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 requ... | |
#!/usr/bin/python3
#
# getISOTimeStamp
# secondsSinceEpoch - an arbitrary number of seconds since the Unix epoch
# returns an ISO8601 formatted timestamp in UTC
# example: 2017-01-01T02:25:00+00:00
#
def getISOTimeStamp(secondsSinceEpoch):
timeStamp = datetime.fromtimestamp(secondsSinceEpoch, tz=timezone.utc)
... | |
from mock import MagicMock
from nose.tools import assert_raises
from paradrop.confd import wireless
from paradrop.confd.wireless import ConfigWifiIface, HostapdConfGenerator
def test_get_cipher_list():
assert wireless.get_cipher_list("psk2+tkip+ccmp") == ["TKIP", "CCMP"]
assert wireless.get_cipher_list("psk2... | |
"""
Copyright 2006-2008 SpringSource (http://springsource.com), 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
... | |
from django.conf import settings
from django.contrib.auth import authenticate, login
from django.contrib.auth.models import User
from django.http import HttpResponseRedirect
from django.utils import importlib
from django.utils.translation import ugettext_lazy as _
from django.views.generic.base import TemplateResponseM... | |
# -*- coding: utf-8 -*-
"""
Project
@author: Michael Howden (michael@sahanafoundation.org)
@date-created: 2010-08-25
Project Tracking
project_project and project_task moved from 05_org.py
"""
application = "project"
if deployment_settings.has_module("project"):
#========================... | |
# 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... | |
"""
Gaussian Mixture Models.
This implementation corresponds to frequentist (non-Bayesian) formulation
of Gaussian Mixture Models.
"""
# Author: Ron Weiss <ronweiss@gmail.com>
# Fabian Pedregosa <fabian.pedregosa@inria.fr>
# Bertrand Thirion <bertrand.thirion@inria.fr>
import numpy as np
from ..base... | |
# Copyright 2015 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 a... | |
# -*- coding: utf-8 -*-
from integration import BaseMongoTest
from tavi.documents import Document, EmbeddedDocument
from tavi import fields
class Address(EmbeddedDocument):
street = fields.StringField("street")
city = fields.StringField("city")
state = fields.StringField("state")
postal_code = fields.... | |
class Node(object):
def __init__(self, x, nxt):
self.x = x
self.next = nxt
# From problem 8.5.
def find_cycle(n):
# fast and slow pointers will collide if there is a cycle
slow = n
fast = n.next
while slow != fast:
slow = slow.next
fast = fast.next
if fast is... | |
# Copyright 2015 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
import argparse
import logging
import os
import posixpath
import shutil
import sys
from abc import ABC, abstractmethod
from contextlib import contextmanager
from dataclasses import datacla... | |
# Copyright 2020 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import web_idl
from . import name_style
from .blink_v8_bridge import blink_class_name
from .blink_v8_bridge import blink_type_info
from .blink_v8_bridge imp... | |
# Copyright 2012 OpenStack Foundation
# 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 requ... | |
"""The HTTP api to control the cloud integration."""
import asyncio
from functools import wraps
import logging
import aiohttp
import async_timeout
import voluptuous as vol
from homeassistant.core import callback
from homeassistant.components.http import HomeAssistantView
from homeassistant.components.http.data_valida... | |
# Copyright 2015 Palo Alto Networks, Inc
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agre... | |
# modmail_ticketmanager
# Python script developed on behalf on a need on /r/civcraft.
# Goal is to actively monitor the modmail queue on a particular subreddit
# and if a new modmail (or update) comes through, to push that into a
# Request Tracker (ticket manager) instance.
#
# Dependencies:
# Python - 2.6.8 or hi... | |
import functools
import mock
import warnings
try:
import urlparse
except ImportError: # Python 3
from urllib import parse as urlparse
from django.core.urlresolvers import NoReverseMatch, set_urlconf
from django.template import Context, Template
from django.test import TestCase
from django.test.client import R... | |
from pprint import pprint
from django.conf import settings
from apps.reader.models import MUserStory
from apps.rss_feeds.models import Feed, MStory, MFeedPage
from apps.rss_feeds.models import MFeedIcon, FeedIcon
from apps.analyzer.models import MClassifierTitle, MClassifierAuthor, MClassifierFeed, MClassifierTag
impor... | |
#
# 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 us... | |
"""
Note: this code is a Theano translation of the linesearch implemented in
scipy.optimize.linesearch
See :
https://github.com/scipy/scipy/blob/master/scipy/optimize/linesearch.py
"""
import theano
import theano.tensor as TT
from theano.ifelse import ifelse
from theano.sandbox.scan import scan
import numpy
one ... | |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
import curses
import sys
from gotask import GoTask
class Ui:
def __init__(self):
self.gotask = GoTask()
self.screen = curses.initscr()
curses.start_color()
curses.init_pair(1, curses.COLOR_CYAN, curses.COLOR_BLACK)
curses.ini... | |
# -*- coding: utf-8 -*-
# The MIT License (MIT)
#
# Copyright (c) 2013-2015 thewizardplusplus <thewizardplusplus@yandex.ru>
#
# 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 without restrict... | |
# -*- coding: utf-8 -*-
# Opcodes in Csound 6.05 from
# csound --list-opcodes
# except
# cggoto <http://www.csounds.com/manual/html/cggoto.html>
# cigoto <http://www.csounds.com/manual/html/cigoto.html>
# cingoto (undocumented)
# ckgoto <http://www.csounds.com/manual/html/ckgoto.html>
# cngoto <http://... | |
"""
sentry.plugins.base
~~~~~~~~~~~~~~~~~~~
:copyright: (c) 2010-2013 by the Sentry Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
__all__ = ('Plugin', 'plugins', 'register', 'unregister')
import logging
from django.core.context_processors import csrf
from django.core.urlresolv... | |
#!/usr/bin/python
# -*- coding: utf-8 -*-
import unittest
from mock import Mock
from preggy import expect
from holmes.config import Config
from holmes.reviewer import Reviewer
from holmes.validators.base import Validator
from tests.fixtures import PageFactory, ReviewFactory
from tests.unit.base import ApiTestCase
... | |
"""Fava's main WSGI application.
when using Fava's WSGI app, make sure to set ``app.config['BEANCOUNT_FILES']``.
To start a simple server::
from fava.application import app
app.config['BEANCOUNT_FILES'] = ['/path/to/file.beancount']
app.run('localhost', 5000)
Attributes:
app: An instance of :class:`f... | |
#!/usr/bin/env python
"""
heatsequer experiment input/output functions
"""
# amnonscript
__version__ = "0.9"
import heatsequer as hs
import numpy as np
import scipy.sparse
import csv
import biom
import os
from pdb import set_trace as XXX
import hashlib
import re
def load(tablename, mapname='map.txt', taxfile=''... | |
#
# This file is part of KoreanCodecs.
#
# Copyright(C) 2002-2003 Hye-Shik Chang <perky@FreeBSD.org>.
#
# KoreanCodecs 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 of the License, or... | |
import numpy as np
import pandas as pd
import pytest
import pymongo
from csv import DictReader
from datetime import datetime, timedelta
import mongots
mongo_client = pymongo.MongoClient()
mongo_client.drop_database('TestDb')
@pytest.fixture
def client():
return mongots.MongoTSClient(mongo_client=mongo_client)
... | |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import hashlib
import socket
import sys
from pypjlink import protocol
class ProjectorError(Exception):
pass
reverse_dict = lambda d: dict(zip(d.values(), d.keys()))
POWER_STATES = {
'off': '0',
'on': '1',
'cooling': '2',
'warm-up'... | |
__author__ = 'saeedamen' # Saeed Amen / saeed@thalesians.com
#
# Copyright 2015 Thalesians Ltd. - http//www.thalesians.com / @thalesians
#
# 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://... | |
import re
import sys
from struct import Struct
from lib.tarantool_connection import TarantoolConnection
from internal.compat import bytes_to_str, str_to_bytes
HEADER = '!BBHBBHLLQ'
HEADER_STRUCT = Struct(HEADER)
HEADER_SIZE = 24
LENGTH = "!8xL"
LENGTH_STRUCT = Struct(LENGTH)
INDECR = "!Q"
IN... | |
# Copyright 2019 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | |
#!/usr/bin/env python3
import geometry3d as g3d
import montecarlo as mc
from pyassimp import *
from math import *
import random
import matplotlib.pyplot as plt
def visualization(robot, est_pos, step, particles, particles_resampled, weights):
""" Visualization
:param robot: the current robot object
:par... | |
# ----------------------------------------------------------------------------
# pyglet
# Copyright (c) 2006-2008 Alex Holkner
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# * Redistribu... | |
# 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 t... | |
from ajabsacco.core.facades import loans as loan_facades
from ajabsacco.core.facades import savings as savings_facades
from ajabsacco.core.models import *
from ajabsacco.core.forms import *
from django.shortcuts import get_object_or_404, redirect
from django.contrib.auth.decorators import login_required
from django.... | |
import os
import sys
import tempfile
import unittest
import mock
import numpy
from chainer import cuda
from chainer import link
from chainer import links
from chainer import optimizers
from chainer.serializers import hdf5
from chainer import testing
from chainer.testing import attr
if hdf5._available:
import h5... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.