text stringlengths 12 6.59M |
|---|
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU... |
#!/usr/bin/env python2
import rospy
from bitbots_msgs.msg import FootPressure
from bitbots_msgs.srv import FootScale, FootScaleRequest, FootScaleResponse
from std_srvs.srv import Empty, EmptyRequest, EmptyResponse
from geometry_msgs.msg import PointStamped, TransformStamped
from geometry_msgs.msg import WrenchStamped
... |
#!/usr/bin/env python
# Copyright (c) 2018 Orange and others.
#
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Apache License, Version 2.0
# which accompanies this distribution, and is available at
# http://www.apache.org/licenses/LICENSE-2.0
"""Cloudify... |
from django.test import LiveServerTestCase
from selenium import webdriver
from allauth.account.models import EmailAddress
class AbstractTestCase(LiveServerTestCase):
def setUp(self):
self.browser = webdriver.Firefox()
self.browser.implicitly_wait(3)
def tearDown(self):
self.browser.q... |
#!/usr/bin/python2
"""
Copyright 2013 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 required by applicable ... |
from futaba import *
|
###############################################################################
#
# bovy_coords: module for coordinate transformations between the equatorial
# and Galactic coordinate frame
#
#
# Main included functions:
# radec_to_lb
# lb_to_radec
# lbd_to_XYZ
# ... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# The MIT License (MIT)
#
# Copyright (c) 2017 William Forde
#
# 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 restriction, including w... |
# coding=utf-8
# user control script
import argparse
import sqlite3
def get_cursor(filename):
"""Provides database cursor."""
conn = sqlite3.connect(filename)
return conn.cursor()
def list_sessions(args):
"""Lists sessions in the database file."""
print 'list'
def add_session(args):
"""Add... |
# -*- coding: utf-8 -*-
from django.conf import settings
from django.core import mail
from django.http import HttpResponse
from django.test import override_settings
from django_auth_ldap.backend import LDAPSearch, _LDAPUser
from django.test.client import RequestFactory
from django.utils.timezone import now as timezone_... |
# Ariane CLI Python 3
# Injector Component acceptance test
#
# Copyright (C) 2015 echinopsii
#
# 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 yo... |
from flask import request, jsonify
from ereuse_devicehub.exceptions import WrongCredentials
from ereuse_devicehub.resources.account.domain import AccountDomain, UserNotFound
def login():
"""
Performs a login. We make this out of eve, being totally open.
:return:
"""
try:
account = Account... |
"""
.. Copyright 2017 EMBL-European Bioinformatics Institute
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... |
import pytest
from flask import json
from app.notifications.notifications_sms_callback import validate_callback_data
def firetext_post(client, data):
return client.post(
path='/notifications/sms/firetext',
data=data,
headers=[
('Content-Type', 'application/x-www-form-urlencode... |
import datetime
import os
import shutil
from typing import Any, Callable, Dict, FrozenSet, List, Optional, Set, Tuple
from unittest.mock import patch
import orjson
from django.conf import settings
from django.db.models import Q
from django.utils.timezone import now as timezone_now
from analytics.models import UserCou... |
import logging
import sys
import os
import time
import abc
class Tee(object):
def __init__(self, *files):
self.files = files
def write(self, obj):
for f in self.files:
f.write(obj)
f.flush() # If you want the output to be visible immediately
def flush(self) :
... |
#!/usr/bin/env python2.5
#
# Copyright 2011 the Melange 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 applic... |
import os, os.path
def read(path):
'''Reads file located at path'''
with open(path) as f:
return f.read()
def safe_write(path, content):
'''Writes content to a temporary file in path's directory,
then atomically renames temporary file to path'''
import tempfile, contextlib
... |
'''
Read ZStack Config from ZStack
@author: Youyk
'''
import sys
import traceback
import threading
import time
import xml.etree.cElementTree as etree
import xml.dom.minidom as minidom
import xml.etree.ElementTree as ElementTree
import zstacklib.utils.sizeunit as sizeunit
import zstacklib.utils.jsonobject as jsonobje... |
#!/usr/bin/env python2
"""Get grid-wise features."""
from __future__ import absolute_import, division, print_function
import argparse
from itertools import product
import numpy as np
import scipy.ndimage
import scipy.stats
import dwi.files
import dwi.util
def parse_args():
"""Parse command-line arguments."""
... |
# Copyright 2017,2018 IBM Corp.
#
# 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 agr... |
#!/usr/bin/env python2
"""Get grid-wise features."""
from __future__ import absolute_import, division, print_function
import argparse
from itertools import product
import numpy as np
import scipy.ndimage
import scipy.stats
import dwi.files
import dwi.util
def parse_args():
"""Parse command-line arguments."""
... |
# vim: set fileencoding=utf-8 :
import sys, socket, time
from helper import *
socket.setdefaulttimeout(15)
from random import choice
import logging
log = logging.getLogger('main')
try:
import config
except:
class config:
keepalive = True
dns_reset = 60 * 60 * 8 # we cache dns->ip and after ... |
import unittest
import numpy
import cupy
from cupy import testing
class TestUserkernel(unittest.TestCase):
def test_manual_indexing(self, n=100):
in1 = cupy.random.uniform(-1, 1, n).astype(cupy.float32)
in2 = cupy.random.uniform(-1, 1, n).astype(cupy.float32)
uesr_kernel_1 = cupy.Elemen... |
# vim: set fileencoding=utf-8 :
import sys, socket, time
from helper import *
try:
import config
except:
class config:
keepalive = True
dns_reset = 60 * 60 * 8 # we cache dns->ip and after this time we will refresh our cacheentry
GZIP = True
try:
import StringIO, gzip
except:
GZIP = F... |
#!/usr/bin/python2.7
# Copyright 2010 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ... |
# vim: set fileencoding=utf-8 :
import sys, socket, time
from helper import *
socket.setdefaulttimeout(15)
from random import choice
import logging
log = logging.getLogger('main')
try:
import config
except:
class config:
keepalive = True
dns_reset = 60 * 60 * 8 # we cache dns->ip and after ... |
#!/usr/bin/python
#
# Copyright (C) 2010, Nokia <jean-luc.lamadon@nokia.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 option) any later ve... |
# Copyright 2016 The ci_edit Authors. All rights reserved.
# Use of this source code is governed by an Apache-style license that can be
# found in the LICENSE file.
import app.log
import curses
import re
import sys
import time
import traceback
importStartTime = time.time()
commentColorIndex = 2
defaultColorIndex = 0... |
# -*- coding: utf-8 -*-
import re
from itertools import chain
from django.db.models import Q, CharField, TextField
def normalize_query(query_string,
findterms=re.compile(r'"([^"]+)"|(\S+)').findall,
normspace=re.compile(r'\s{2,}').sub):
return [normspace(' ', (t[0] or t[1... |
from __future__ import absolute_import
from __future__ import unicode_literals
from app import redis
import collections
class RedisOperationNotAllowedException(Exception):
pass
class RedisModel(collections.MutableMapping):
"""Defines a basic model for data storage using HASH inside
redis.
Implement... |
"""Forest of trees-based ensemble methods
Those methods include random forests and extremely randomized trees.
The module structure is the following:
- The ``BaseForest`` base class implements a common ``fit`` method for all
the estimators in the module. The ``fit`` method of the base ``Forest``
class calls the ... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""
File: gcexport.py
Original author: Kyle Krafka (https://github.com/kjkjava/)
Date: April 28, 2015
Fork author: Michae P (https://github.com/moderation/)
Date: February 21, 2016
Description: Use this script to export your fitness data from Garmin Connect.
See README.md... |
import os
from itertools import chain, count
from warnings import catch_warnings
import numpy as np
from PyQt4 import QtGui, QtCore
from PyQt4.QtGui import QSizePolicy as Policy
from Orange.canvas.gui.utils import OSX_NSURL_toLocalFile
from Orange.data import Domain, DiscreteVariable, StringVariable
from Orange.data.... |
# -*- coding: utf-8 -*-
"""
===============================================================================
Structure generator base module (:mod:`sknano.generators._base`)
===============================================================================
.. currentmodule:: sknano.generators._base
"""
from __future__ im... |
# -*- coding: utf-8 -*-
"""
===============================================================================
Structure Generator base classes (:mod:`sknano.generators._base`)
===============================================================================
.. currentmodule:: sknano.generators._base
"""
from __future__ i... |
# -*- coding: utf-8 -*-
import skrf as rf
import numpy as np
import unittest
import os, sys
from numpy.testing import assert_array_almost_equal, run_module_suite
class CircuitTestConstructor(unittest.TestCase):
'''
Various tests on the Circuit constructor.
'''
def setUp(self):
# Importing netw... |
#!/usr/bin/env python
from __future__ import with_statement, absolute_import
import time
import logging
import os
import math
import random
import fileinput
from collections import deque
from stat import S_IFDIR, S_IFREG, S_IFCHR, S_IFIFO
from errno import ENOENT
from sys import argv, exit, stdout
from fuse import F... |
print("Starting up Harmonbot...")
import discord
from discord.ext import commands
import asyncio
import json
import logging
import os
import re
import sys
import traceback
from modules import conversions
from modules.utilities import *
from utilities import checks
from utilities import errors
import credentials
fr... |
# Copyright 2013 Hewlett-Packard Development Company, L.P.
#
# Author: Endre Karlson <endre.karlson@hp.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/lice... |
from pecan import conf
import os
import hashlib
from random import randrange
import six
from unittest import TestCase
from deuce.tests import FunctionalTest
class TestBlocksController(FunctionalTest):
def setUp(self):
super(TestBlocksController, self).setUp()
# Create a vault for us to work with... |
import os
import pip
import tempfile
import subprocess
BUCKET_NAME = 'deepchem.io'
if not any(d.project_name == 's3cmd' for d in pip.get_installed_distributions()):
raise ImportError('The s3cmd pacakge is required. try $ pip install s3cmd')
# The secret key is available as a secure environment variable
# on travi... |
"""Tests for access control and other rules in LDAP
Most of these focus on ACLs, but some rules are implemented in other ways.
All get tested here as they all contribute to the overall security policy.
Andrew Findlay
21 June 2011
"""
import sys
import unittest
import re
import ldap
import ldap.modlist
from ldif impo... |
# Copyright 2014-2019 The PySCF Developers. 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 appl... |
#!/usr/bin/env python
# Copyright 2014-2018 The PySCF Developers. 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
#
# U... |
import floppyforms as forms
from organization.models import Organization
from core.utils import CONCENTRATION_UNITS, VOLUME_UNITS, TIME_UNITS, SPEED_UNITS, TEMPERATURE_UNITS, MASS_UNITS, AMMOUNT_UNITS
class NodeForm(forms.Form):
name = forms.CharField(max_length=100, required=False)
technique_comment = forms.... |
"""
request body parsing logic derived from bottle.py
(https://github.com/defnull/bottle)
Copyright (c) 2014, Marcel Hellkamp.
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 restriction,... |
import numpy as np
from pystella.rf import band
from pystella.rf.ts import TimeSeries, SetTimeSeries
__author__ = 'bakl'
class LightCurve(TimeSeries):
def __init__(self, b, time, mags, errs=None, tshift=0., mshift=0.):
"""Creates a Light Curve instance. Required parameters: b (band), time, mags."""
... |
# -*- coding: utf-8 -*-
import sympy
from sympy import Matrix
from pysymoro.geometry import compute_screw_transform
from pysymoro.geometry import compute_rot_trans, Transform
from pysymoro.kinematics import compute_vel_acc
from pysymoro.kinematics import compute_omega
from symoroutils import symbolmgr
from symorouti... |
# -*- coding: utf-8 -*-
# This file is part of the OpenSYMORO project. Please see
# https://github.com/symoro/symoro/blob/master/LICENCE for the licence.
"""
This module of SYMORO package provides description
of the robot parametrizaion container and symbol replacer class.
"""
import re
import os
import copy
from... |
# Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: Apache-2.0
"""Tests enforcing code coverage for production code."""
import os
import platform
import re
import shutil
import pytest
from framework import utils
import host_tools.cargo_build as host # pylint: disable... |
########
# Copyright (c) 2013 GigaSpaces Technologies Ltd. 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... |
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import unicode_literals
import unittest
import pickle
from sslyze.plugins.http_headers_plugin import HttpHeadersPlugin, HttpHeadersScanCommand
from sslyze.server_connectivity import ServerConnectivityInfo
class HttpHeadersPluginTestCase(u... |
# -*- coding: utf-8 -*-
# FOGLAMP_BEGIN
# See: http://foglamp.readthedocs.io/
# FOGLAMP_END
""" Test authentication REST API """
import os
import http.client
import json
import time
import pytest
__author__ = "Vaibhav Singhal"
__copyright__ = "Copyright (c) 2019 Dianomic Systems"
__license__ = "Apache 2.0"
__versi... |
def _hash(word):
return "".join(sorted(word))
def is_anagram(w1, w2):
return _hash(w1) == _hash(w2)
def collect_anagrams(words):
anagrams = {}
for w in words:
key = _hash(w)
if key not in anagrams:
anagrams[key] = []
anagrams[key].append(w)
return anagrams.val... |
#!/usr/bin/python
import Tkinter as Tk
import tkFileDialog
import subprocess
import os
root = Tk.Tk()
class App:
def __init__(self, master):
frame = Tk.Frame(master)
frame.pack()
input = Tk.Frame(frame)
input.grid(row = 0, column = 0)
Tk.Label(input, text = 'Input Folder:').grid(row = 0, sticky=Tk.E)
... |
# import the random library, to set the initial position of the rock.
import random
# Set the size of the window
WIDTH = 600
HEIGHT = 500
# Create the actors
spacecraft = Actor('spacecraft') # The spacecraft actor
rock = Actor('rock') # Rock actor with the same image
# Calculate the centre of the screen, to avoid... |
import requests
import json
# Tag an image based on detected visual content which mean running a CNN on top of it.
# https://pixlab.io/#/cmd?id=tagimg for more info.
# Target Image: Change to any link or switch to POST if you want to upload your image directly, refer to the sample set for more info.
img = 'https://s-... |
import uuid
import sys
from gmail import gmail
import json
import re
import base64
def integrate_cid_in_html(mail):
def insert_cid(image_tag):
cid = image_tag.group(1)
for attachment in mail.attachments:
if attachment.name.startswith(cid):
extension = attachment.name[at... |
# -*- mode: python; coding: utf-8 -*-
# Copyright (c) 2018 Radio Astronomy Software Group
# Licensed under the 2-clause BSD License
"""Commonly used utility functions."""
import numpy as np
import warnings
import copy
from scipy.spatial.distance import pdist, squareform
from astropy.time import Time
from astropy.coord... |
# -*- coding: utf-8 -*-
"""
pyvisa-py.gpib
~~~~~~~~~~~~~~
GPIB Session implementation using linux-gpib.
:copyright: 2015 by PyVISA-py Authors, see AUTHORS for more details.
:license: MIT, see LICENSE for more details.
"""
from __future__ import division, unicode_literals, print_function, absolut... |
# -*- coding: utf-8 -*-
"""
Objects representing various types of MediaWiki, including Wikibase, pages.
This module also includes objects:
* Property: a type of semantic data.
* Claim: an instance of a semantic assertion.
* Revision: a single change to a wiki page.
* FileInfo: a structure holding imageinfo of latest ... |
# Copyright (c) 2015 SONATA-NFV, Thales Communications & Security
# 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
#
#... |
# -*- coding: utf-8 -*-
##############################################################################
#
# Author: Nicolas Bessi
# Copyright 2013 Camptocamp SA
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# publi... |
#!/usr/bin/env python
# Symop2mat.py
#
# Copyright (C) 2007 CCLRC, Graeme Winter
#
# This code is distributed under the BSD license, a copy of which is
# included in the root directory of this package.#
#
# A wrapper for the jiffy program symop2mat, which converts a symmetry
# operation to a matrix, for inpu... |
# -*- coding: utf-8 -*-
"""
Objects representing various types of MediaWiki, including Wikibase, pages.
This module also includes objects:
* Property: a type of semantic data.
* Claim: an instance of a semantic assertion.
* Revision: a single change to a wiki page.
* FileInfo: a structure holding imageinfo of latest ... |
import logging
import warnings
from itertools import islice
from django.core.exceptions import ImproperlyConfigured
from django.db.backends import (
BaseDatabaseOperations,
BaseDatabaseClient,
BaseDatabaseIntrospection,
BaseDatabaseWrapper,
BaseDatabaseFeatures,
BaseDatabaseValidation
)
try:
... |
# Copyright (c) 2015 SONATA-NFV, Thales Communications & Security
# 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
#
#... |
import json
import gspread
from oauth2client.client import SignedJwtAssertionCredentials
def get_google_sheet():
json_key = json.load(open('podcast-access.json'))
scope = ['https://spreadsheets.google.com/feeds']
credentials = SignedJwtAssertionCredentials(json_key["client_email"], json_key['private_key'],... |
# -*- coding: iso8859-1 -*-
#
# Copyright (C) 2003, 2004, 2005 Edgewall Software
# Copyright (C) 2003, 2004, 2005 Christopher Lenz <cmlenz@gmx.de>
#
# Trac 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; eithe... |
# -*- coding: utf-8 -*-
"""
Objects representing various types of MediaWiki pages.
"""
#
# (C) Pywikipedia bot team, 2008-2012
#
# Distributed under the terms of the MIT license.
#
__version__ = '$Id$'
import pywikibot
from pywikibot import deprecate_arg
from pywikibot import deprecated
from pywikibot import config
i... |
from django.db import models
from django.utils.translation import gettext_lazy as _
CONTENT_TYPE_CACHE = {}
class ContentTypeManager(models.Manager):
def get_for_model(self, model):
"""
Returns the ContentType object for the given model, creating the
ContentType if necessary.
"""
... |
import os
import json
import pprint
import requests
from requests_toolbelt import MultipartEncoder
from tethys_dataset_services.base import DatasetEngine
class CkanDatasetEngine(DatasetEngine):
"""
Definition for CKAN Dataset Engine objects.
"""
@property
def type(self):
"""
CKAN... |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2004-2009 Edgewall Software
# Copyright (C) 2004-2005 Jonas Borgström <jonas@edgewall.com>
# Copyright (C) 2004-2005 Daniel Lundin <daniel@edgewall.com>
# Copyright (C) 2005-2006 Christopher Lenz <cmlenz@gmx.de>
# All rights reserved.
#
# This software is licensed as described ... |
# -*- coding: utf-8 -*-
"""
Objects representing MediaWiki sites (wikis) and families (groups of wikis
on the same topic in different languages).
"""
#
# (C) Pywikipedia bot team, 2008
#
# Distributed under the terms of the MIT license.
#
__version__ = '$Id$'
import pywikibot
from pywikibot import deprecate_arg
from ... |
import sys, time
from django.db.backends.creation import BaseDatabaseCreation
TEST_DATABASE_PREFIX = 'test_'
PASSWORD = 'Im_a_lumberjack'
class DatabaseCreation(BaseDatabaseCreation):
# This dictionary maps Field objects to their associated Oracle column
# types, as strings. Column-type strings can contain fo... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
from abc import abstractmethod, ABCMeta
from time import time
import logging
import numpy
import theano
import theano.tensor as tensor
from theanolm.exceptions import IncompatibleStateError, NumberError
from theanolm.matrixfunctions import test_value
from theanolm.debugfu... |
'''
Train AlexNet on ImageNet with 2 GPUs.
'''
import sys
import time
from multiprocessing import Process, Queue
import yaml
import numpy as np
import zmq
import pycuda.driver as drv
import pycuda.gpuarray as gpuarray
sys.path.append('./lib')
from tools import (save_weights, load_weights,
save_mom... |
# -*- coding: utf-8 -*-
"""
Objects representing MediaWiki sites (wikis).
This module also includes functions to load families, which are
groups of wikis on the same topic in different languages.
"""
#
# (C) Pywikibot team, 2008-2017
#
# Distributed under the terms of the MIT license.
#
from __future__ import absolute... |
import sys, time
from django.core import management
# This dictionary maps Field objects to their associated Oracle column
# types, as strings. Column-type strings can contain format strings; they'll
# be interpolated against the values of Field.__dict__ before being output.
# If a column type is set to None, it won't... |
from datetime import datetime
from io import BytesIO
from time import time
from typing import List, Any
# Specify render backend. 'Agg' can only generate images. Default 'TkAgg' is unsupported on Heroku.
import matplotlib; matplotlib.use('Agg')
import matplotlib.pyplot as plt
from matplotlib.ticker import MaxNLocator
... |
import strings
# The bot does not issue a WHO command upon joining a channel, because of ircd-specific syntax. Hosts (and
# account names) are therefore not generally available.
prefixmodes = {
"~": "q",
"&": "a",
"@": "o",
"%": "h",
"+": "v",
}
class UserData(object):
def __init__(self):
... |
# Third-party
import astropy.units as u
import numpy as np
import time
# Package
from ...data import RVData
from ..likelihood import marginal_ln_likelihood
from ..fast_likelihood import batch_marginal_ln_likelihood
from .. import JokerParams, TheJoker
from .helpers import FakeData
def test_against_py():
joker_pa... |
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# License: MIT. See LICENSE
import json
import frappe
from frappe.tests.utils import FrappeTestCase
from frappe.utils import set_request
from frappe.website.doctype.web_form.web_form import accept
from frappe.website.serve import get_response_content... |
#!/usr/bin/python2.5
#
# Copyright 2008 the Melange 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 applicab... |
import gym
import numpy as np
from keras.models import Sequential
from keras.optimizers import RMSprop
from keras.layers import Dense, Reshape, Flatten
from keras.layers.convolutional import Convolution2D
class DQNAgent:
def __init__(self):
self.render = "True"
width, height, length = 84, 84, 4
... |
import redis
class Store():
"""
Redis storage class
"""
redis_url_local = 'redis://localhost:6379'
def __init__(self, redis_url=redis_url_local):
self.redis = redis.from_url(redis_url)
self.pipe = self.redis.pipeline()
def set_user(self, user_id, access_token, refresh_to... |
import re
import itertools as it
import cStringIO
BLANK = 0x0
NOUGHT = 0x1
CROSS = 0x2
VALID = set((NOUGHT, CROSS))
SYMBOLS = {
BLANK: '_',
NOUGHT: 'O',
CROSS: 'X'
}
def _pair_to_index(x_pos, y_pos):
return x_pos + 3 * y_pos
def _index_to_pair(pos):
pair = divmod(pos, 3)
return pair[1], pa... |
#! /usr/bin/env python
from datetime import datetime
from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg, NavigationToolbar2TkAgg
from scipy.interpolate import interp1d
import scipy.optimize
from scipy.optimize import curve_fit
from Tkinter import *
from PIL import Image, ImageTk
import base64
import collec... |
# -*- coding: utf-8 -*-
"""
Objects representing MediaWiki sites (wikis) and families (groups of wikis
on the same topic in different languages).
"""
#
# (C) Pywikipedia bot team, 2008
#
# Distributed under the terms of the MIT license.
#
__version__ = '$Id$'
import pywikibot
from pywikibot import deprecate_arg
from... |
"""
PostgreSQL database backend for Django.
Requires psycopg 2: http://initd.org/projects/psycopg2
"""
import threading
import warnings
from django.conf import settings
from django.core.exceptions import ImproperlyConfigured
from django.db import DEFAULT_DB_ALIAS
from django.db.backends.base.base import BaseDatabase... |
"""
filebrowser.utils
"""
import subprocess
import json
import logging
import os
import re
import time
import shutil
from django.conf import settings
from datetime import datetime
_logger = logging.getLogger('bigpandamon-filebrowser')
filebrowserDateTimeFormat = "%Y %b %d %H:%M:%S"
def get_filebrowser_vo():... |
#
# Copyright (C) 2019 by frePPLe bvba
#
# This library 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 library is dist... |
#! /usr/bin/env python
"""
mbed SDK
Copyright (c) 2011-2013 ARM Limited
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... |
from unittest import main, TestCase
import json
from models import *
from app import app
import requests
class DBTests(TestCase):
def test_create_game(self):
game = Game(title="Mugman: The Game", description="Best game.", rating=100.0, image_url='https://img00.deviantart.net/6d0a/i/2017/138/e/d/sad_mugman... |
#! /usr/bin/env python
from datetime import datetime
from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg, NavigationToolbar2TkAgg
from scipy.interpolate import interp1d
import scipy.optimize
from scipy.optimize import curve_fit
from Tkinter import *
import base64
import collections
import glob
import iterto... |
# -*- coding: utf-8 -*-
"""
Objects representing MediaWiki sites (wikis).
This module also includes functions to load families, which are
groups of wikis on the same topic in different languages.
"""
#
# (C) Pywikibot team, 2008-2020
#
# Distributed under the terms of the MIT license.
#
from __future__ import absolute... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
django_react_templatetags
----------
This extension allows you to add React components into your django templates.
"""
__title__ = "django_react_templatetags"
__version__ = "3.0.2"
__build__ = 302
__author__ = "Martin Sandström"
__license__ = "MIT"
__copyright__ = "Co... |
from __future__ import (absolute_import, division,
print_function, unicode_literals)
import logging
import re
import argparse
logging.basicConfig(level=logging.INFO)
logger = logging.getLogger(__name__)
from kamaki.clients import astakos, cyclades
from kamaki.clients import ClientError
from ka... |
from unittest import expectedFailure
from django.contrib.auth.models import User
from django.test import TestCase
from models import *
class SkuModelTests(TestCase):
def setUp(self):
"""also satisfies creating a new sku"""
self.brand = Brand(name='test brand')
self.brand.save()
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.