text stringlengths 12 6.59M |
|---|
import matplotlib.pyplot as plt; plt.rcdefaults()
import numpy as np
def horizontal_bar(sorted_streaks, sort):
"""
Render a horizontal bar chart of streaks.
Values have already been sorted by sort.
"""
users = [user for user, _ in sorted_streaks][::-1]
streaks = [getattr(streak, sort) for _, ... |
"""
To run this test, type this in command line <kolibri manage test -- kolibri.core.content>
"""
import datetime
import unittest
import uuid
import mock
import requests
from django.conf import settings
from django.core.cache import cache
from django.core.urlresolvers import reverse
from django.test import TestCase
fr... |
"""Leetcode 958. Check Completeness of a Binary Tree
Medium
URL: https://leetcode.com/problems/check-completeness-of-a-binary-tree/
Given a binary tree, determine if it is a complete binary tree.
Definition of a complete binary tree from Wikipedia:
In a complete binary tree every level, except possibly the last, is ... |
# encoding: utf-8
#
#
# 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/.
#
# Author: Kyle Lahnakoski (kyle@lahnakoski.com)
#
from __future__ import absolute_import
from _... |
#!/usr/bin/env jython
from __future__ import with_statement
from contextlib import contextmanager
import logging
from plugins import __all__
log = logging.getLogger('kahuna')
class PluginManager:
""" Manages available plugins """
def __init__(self):
""" Initialize the plugin list """
self.__... |
#!/usr/bin/env python
import os
import fnmatch
import swiftclient
# this script verifies we have the necessary swift capabilities
def get_swiftclient():
swift_conn = swiftclient.client.Connection(
authurl=os.environ.get("OS_AUTH_URL"),
user=os.environ.get("OS_USERNAME"),
key=os.environ.ge... |
# Copyright 2011 OpenStack Foundation
# Copyright 2013 Rackspace Hosting
# 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/lice... |
# python3
# Copyright 2018 DeepMind Technologies Limited. 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 re... |
import os
import sys
import pwd
import grp
from subprocess import call
import shutil
from time import strftime
import confparser, log, database
class Rebuild(object):
"""Does all the rebuilding work when a host needs to be reconstructed
with Pacha. Minimal configurations come from pacha.conf and more complex... |
'''
Created on Mar 27, 2016
@author: Noe
'''
import requests
import bs4
if __name__ == '__main__':
session = requests.session()
req = session.get('https://c-cex.com/?id=orders')
doc = bs4.BeautifulSoup(req.content,'lxml')
#firs param is tag name
print doc
# print doc.findAll('td', { "... |
from __future__ import print_function, division, absolute_import
import types as pytypes # avoid confusion with numba.types
from numba import ir
from numba.ir_utils import *
#from numba.annotations import type_annotations
from numba import types, config
from numba.types.npytypes import *
from numba.typing import npydec... |
# No shebang line, this module is meant to be imported
#
# This file is part of PyFarm.
# Copyright (C) 2008-2012 Oliver Palmer
#
# PyFarm 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 ... |
"""
Implementation of linear algebra operations.
"""
from __future__ import print_function, absolute_import, division
import contextlib
from llvmlite import ir
import numpy as np
from numba import jit, types, cgutils
from numba.targets.imputils import (lower_builtin, impl_ret_borrowed,
... |
#!/usr/bin/env python
#
# spot_finder_factory.py
#
# Copyright (C) 2013 Diamond Light Source
#
# Author: James Parkhurst
#
# This code is distributed under the BSD license, a copy of which is
# included in the root directory of this package.
from __future__ import division
def generate_phil_scope():
from iotbx.... |
# coding=utf-8
from __future__ import unicode_literals
from ben10.foundation.exceptions import ExceptionToUnicode
from ben10.foundation.reraise import Reraise
import pytest
import sys
#===================================================================================================
# ExecutePythonCode
#===========... |
# Foremast - Pipeline Tooling
#
# Copyright 2018 Gogo, LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required... |
import urllib2
import httplib
import logging
import mechanize
import cookielib
logger = logging.getLogger(__name__)
class FileGrabber():
def __init__(self):
"""
Get the file of an URL, use mechanize / cookiejar to simulate a browser because some IATI XML URLs deny bots
"""
browser... |
from activities.app_configs import UserSocialAuthAppConfig
class MovesConfig(UserSocialAuthAppConfig):
"""
Configure the Moves activity application.
"""
name = __package__
verbose_name = 'Moves'
in_development = True
data_description = {
'name': 'Location and GPS data',
... |
import datetime
import hashlib
import os
import time
import django_rq
import fulltext
import requests
from django.conf import settings
from django.core.cache import caches
from django_rq import job
from redis import Redis
from rest_framework_extensions.settings import extensions_api_settings
from rq import Worker
from... |
import itertools
import numpy as np
import pandas as pd
from zbox import toolz as tz, gen
from ..activitysim import eval_variables
from .. import mnl
def make_interactions(people, hh_id_col, p_type_col):
"""
Make two Pandas DataFrames associating people IDs with two
and three person interactions they ha... |
from bs4 import BeautifulSoup
from accessor_functions import *
from generate_dot import *
from rate_laws import *
from miriam import align_models
from tabulate import tabulate
import sys
import re
class SBMLDiff:
def __init__(self, model_strings, model_names, generate_dot, align=False, cartoon=False, show_params... |
import typing
import numpy
from openfisca_core import projectors
from openfisca_core.entities import Role
from openfisca_core.indexed_enums import EnumArray
from openfisca_core.populations import Population
class GroupPopulation(Population):
def __init__(self, entity, members):
super().__init__(entity)
... |
# Copyright (c) 2020 Aldo Hoeben / fieldOfView
# OctoPrintPlugin is released under the terms of the AGPLv3 or higher.
from collections import OrderedDict
from typing import Any, Tuple, List, Dict
class OctoPrintPowerPlugins():
def __init__(self) -> None:
self._available_plugs = OrderedDict() # type: Dic... |
# Copyright 2010 Jacob Kaplan-Moss
# Copyright 2011 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/L... |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, print_function, unicode_literals, division
from collections import defaultdict, namedtuple
from datetime import datetime
import hashlib
import sys
from xml.etree import ElementTree
import zlib
import mpyq
import sc2reader
from sc2reader import utils
... |
from itertools import permutations
from math import factorial
from scipy.spatial.distance import squareform
import numpy as np
def test(strings, meaning_distances, perms):
# Compute meaning distance residuals
meaning_residuals = residualize(meaning_distances)
# Determine category labels and the edit-distances ... |
# -*- coding: utf-8 -*-
# vim: tabstop=4 shiftwidth=4 softtabstop=4
#
# Copyright (C) 2017 GEM Foundation
#
# OpenQuake 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, o... |
from django.contrib.auth.models import AnonymousUser
from django.test import SimpleTestCase, TestCase, RequestFactory
from corehq.apps.domain.decorators import _login_or_challenge
from corehq.apps.domain.shortcuts import create_domain
from corehq.apps.users.models import WebUser, CommCareUser
SUCCESS = 'it worked!'
C... |
"""\
API
===
Import Scanpy's high-level API as::
import scanpy.api as sc
Preprocessing: PP
------------------
Filtering of highly-variable genes, batch-effect correction, per-cell (UMI) normalization, preprocessing recipes.
**Basic Preprocessing**
.. autosummary::
:toctree: .
pp.filter_cells
pp.filte... |
import logging
from threading import Thread
import time
from ee.batch import Task
logger = logging.getLogger(__name__)
class EarthEngineStatus(object):
def __init__(self, task_id, listener):
self.task_id = task_id
self.listener = listener
self.running = True
self.thread = Thread(... |
# -*- coding: utf-8 -*-
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright (c) 2010-2014, GEM Foundation.
#
# OpenQuake 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 Lice... |
"""
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 ... |
from collections import namedtuple, OrderedDict
from itertools import chain
import json
from urllib import urlencode
import uuid
from django import forms
from django.core.urlresolvers import reverse
from django.forms import Widget
from django.forms.util import flatatt
from django.template.loader import render_to_string... |
## This file is part of Scapy
## See http://www.secdev.org/projects/scapy for more informations
## Copyright (C) Philippe Biondi <phil@secdev.org>
## This program is published under a GPLv2 license
import sys,getopt,imp
import bz2, base64, os.path, time, traceback, zlib, sha
#### Import tool ####
def import_module... |
# -*- coding: utf-8 -*-
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright (c) 2010-2014, GEM Foundation.
#
# OpenQuake 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 Lice... |
"""
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 ... |
# Copyright (C) 2005-2007 Jelmer Vernooij <jelmer@jelmer.uk>
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation; either version 2.1 of the License, or
# (at your option) any later version.
... |
#!/usr/bin/python
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Ansible is distribut... |
from collections import namedtuple, OrderedDict
from itertools import chain
import json
from urllib import urlencode
import uuid
from django import forms
from django.core.urlresolvers import reverse
from django.forms import Widget
from django.forms.util import flatatt
from django.template.loader import render_to_string... |
# -*- coding:utf-8 -*-
import sys
PY3 = (sys.version_info[0] >= 3)
HTTP_OK = 200
HTTP_AUTHORIZATION_ERROR = 401
HTTP_URL = 'api.wmcloud.com'
HTTP_PORT = 443
BOND = '/api/bond/getBond.csv?secID=%s&ticker=%s&field=%s'
BONDCF = '/api/bond/getBondCf.csv?secID=%s&ticker=%s&beginDate=%s&cashTypeCD=%s&endDate=%s&field=%s'
BO... |
# -*- coding: utf-8 -*-
#
# Copyright 2017 KMEE
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
#
from __future__ import division, print_function, unicode_literals
from odoo import api, fields, models, _
from odoo.addons.l10n_br_base.constante_tributaria import TIPO_EMISSAO_PROPRIA
from odoo.addons.f... |
# -*- coding: utf-8 -*-
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright (c) 2010-2013, GEM Foundation.
#
# OpenQuake 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 Lice... |
# Copyright (c) 2010-2012 OpenStack, LLC.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to ... |
# Copyright 2012, Jeroen Hoekx <jeroen@hoekx.be>
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later ve... |
from __future__ import absolute_import
from __future__ import unicode_literals
import re
import weakref
from io import BytesIO
from uuid import uuid4
from xml.etree import cElementTree as ElementTree
from collections import defaultdict
import six
from casexml.apps.case.mock import CaseBlock, CaseFactory, CaseStructu... |
# -*- coding: utf-8 -*-
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright (c) 2010-2014, GEM Foundation.
#
# OpenQuake 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 Lice... |
"""
Client for Swift
Copyright 2012-2013 Gregory Holt
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... |
# -*- coding:utf-8 -*-
from __future__ import absolute_import
"""
SunPy PlotMan GUI
Plots FITS data using sunpy.Map in a Qt interface,
and provides tools for graphical plot manipulation.
Author: Matt Earnshaw <matt@earnshaw.org.uk>
"""
import sunpy
from matplotlib import pyplot as plt
from PyQt4.QtCore import pyqt... |
"""
globals.py
list of model objects (paramaters and variables) to be shared across modules
Can modified manually or via arguments from main.py
Version: 2015feb12 by salvadord
"""
###############################################################################
### IMPORT MODULES
#####################################... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright (c) 2014, Blue Box Group, Inc.
# Copyright (c) 2014, Craig Tracey <craigtracey@gmail.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... |
# -*- coding: utf-8 -*-
# Copyright (c) 2010-2014, GEM Foundation.
#
# OpenQuake 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... |
# -*- coding: utf-8; -*-
#
# This file is part of Superdesk.
#
# Copyright 2013, 2017 Sourcefabric z.u. and contributors.
#
# For the full copyright and license information, please see the
# AUTHORS and LICENSE files distributed with this source code, or
# at https://www.sourcefabric.org/superdesk/license
import re
i... |
# -*- coding: utf8 -*-
from hashlib import sha1
from tuttle.report.html_repport import nice_size
try:
from urllib2 import urlopen, Request, URLError, HTTPError, HTTPPasswordMgrWithDefaultRealm, HTTPBasicAuthHandler, \
build_opener, install_opener
except ImportError:
from urllib.request import urlopen, Re... |
import simi
from mamut_xml_templates import *
# Convert Simi data into MaMuT XML format.
# TODO:
# - This script should ultimately be a function within simi.py
# Parse a Simi BioCell .sbd file.
s = simi.Sbd('lineage.sbd')
# Declare initial variables.
spot_id = 1
last_frame = s.last_frame
# Lists aggregating spot... |
"""Base class for all the objects in SymPy"""
from copy import copy
from sympy.core.assumptions import ManagedProperties
from sympy.core.cache import cacheit
from sympy.core.core import BasicType, C
from sympy.core.sympify import _sympify, sympify, SympifyError
from sympy.core.compatibility import callable, reduce, cmp... |
# -*- coding: utf-8 -*-
# vim: tabstop=4 shiftwidth=4 softtabstop=4
#
# Copyright (C) 2014-2022 GEM Foundation
#
# OpenQuake 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 Licen... |
#!/usr/bin/env python
"""
Postpone module import to future.
Python versions: 1.5.2 - 2.3.x
Author: Pearu Peterson <pearu@cens.ioc.ee>
Created: March 2003
$Revision$
$Date$
"""
__all__ = ['ppimport','ppimport_attr','ppresolve']
import os
import sys
import string
import types
import traceback
_ppimport_is_enabled = 1
... |
#!/usr/bin/env python
# -*- coding: utf-8
import os
import olliebennett.logger as Log
import olliebennett.twitter as Twitter
__author__ = 'Ollie Bennett | http://olliebennett.co.uk/'
# Get current CPU temperature
cmd = '/opt/vc/bin/vcgencmd measure_temp'
line = os.popen(cmd).readline().strip()
temp = line.split('=')... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Simiki CLI
Usage:
simiki init [-p <path>]
simiki new | n -t <title> -c <category> [-f <file>]
simiki generate | g [--draft]
simiki preview | p [--host <host>] [--port <port>] [-w]
simiki update
simiki -h | --help
simiki -V | --version
Subcommands:
ini... |
import agate
import decimal
import re
import unittest
from contextlib import contextmanager
from requests.exceptions import ConnectionError
from unittest.mock import patch, MagicMock, Mock, create_autospec, ANY
import hologram
import dbt.flags as flags
from dbt.adapters.bigquery import BigQueryCredentials
from dbt.a... |
# -*- coding: utf-8 -*-
# Copyright 2014 OpenMarket 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 la... |
import logging
import networkx
from .. import Analysis, register_analysis
from ...utils.graph import dfs_back_edges
l = logging.getLogger(name=__name__)
class MultiNode:
def __init__(self, nodes):
self.nodes = [ ]
for node in nodes:
if type(node) is MultiNode:
self... |
# -*- coding: utf-8 -*-
# vim: tabstop=4 shiftwidth=4 softtabstop=4
#
# Copyright (C) 2021 GEM Foundation
#
# OpenQuake 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, o... |
#!/usr/bin/env python
"""Simple utility to assist with updating versions and
mirrored property lists."""
from __future__ import print_function
# pylint: disable=line-too-long
# pylint: disable=too-many-nested-blocks
import os
import subprocess
from datetime import datetime
from glob import glob
from sys import argv
... |
# -*- coding: utf-8 -*-
from threading import Thread
import time
import re
import math
from utils import parse_input, load_custom_commands
import vkrequests as vkr
from __init__ import PATH
from __init__ import DATA_PATH
from __init__ import __help__
from __init__ import __author__
from __init__ import __author_vk_i... |
import logging
import logging.config
import string
import sys
import tempfile
from pathlib import Path
from PyQt5 import QtCore, QtGui, QtWidgets
import scorer_to_usebio
import scorer_to_usebio.qt
all_filter = 'All files (*)'
scorer_filter = 'Scorer results files (*.xml)'
alphanum = string.digits + string.ascii_let... |
from __future__ import absolute_import, print_function, unicode_literals
from django.core.management import BaseCommand
from corehq.apps.app_manager.dbaccessors import get_build_doc_by_version, wrap_app
from corehq.apps.app_manager.models import import_app
class Command(BaseCommand):
help = "Make a copy of a sp... |
# -*- coding: utf-8 -*-
#
# This file is part of BridgeDB, a Tor bridge distribution system.
#
# :authors: Isis Lovecruft 0xA3ADB67A2CDB8B35 <isis@torproject.org>
# please also see AUTHORS file
# :copyright: (c) 2013, Isis Lovecruft
# (c) 2007-2013, The Tor Project, Inc.
# (c) 2007-201... |
"""The base Simon models"""
from collections import defaultdict
import sys
import warnings
from bson import ObjectId
from ._compat import get_next, iterkeys, itervalues, reraise, with_metaclass
from .exceptions import MultipleDocumentsFound, NoDocumentFound
from .meta import Meta
from .query import Q, QuerySet
from ... |
from __future__ import division, print_function
# Standard library
import tempfile
__all__ = ['copy_from_table']
def copy_from_table(cursor, table, Table):
"""
"""
copy_colnames = [str(x).split('.')[1].upper() for x in Table.__table__.columns]
# automatically figure out which columns are multidimen... |
from queue import Queue
from lexos.processors.prepare.cutter import split_keep_whitespace, \
count_words, strip_leading_white_space, strip_leading_blank_lines, \
strip_leading_characters, strip_leading_words, strip_leading_lines, cut
class TestBasicFunctions:
def test_whitespace_split(self):
asse... |
# -*- coding: utf-8 -*-
# Copyright 2014 - 2016 OpenMarket 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 applic... |
# vim: ts=4 sw=4 et
# Standard
import json
import os
# Celery
from celery import task
# OpenStack
import keystoneclient.v2_0.client as ksclient
from neutronclient.neutron import client
# Cosmo
from cosmo.events import send_event, get_cosmo_properties
@task
def provision(__cloudify_id, network, **kwargs):
neutr... |
# -*- coding: utf-8 -*-
"""
/***************************************************************************
Irmt
A QGIS plugin
OpenQuake Social Vulnerability and Integrated Risk
-------------------
begin : 2017-08-30
copyright ... |
from collections import OrderedDict
import itertools
import json
from django.core.exceptions import ImproperlyConfigured
from django.db import models, connection
class ScoreMock(object):
is_mock = True
def __init__(self, **kwargs):
kwargs.setdefault('retired', False)
kwargs.setdefault('disqu... |
# -*- coding: utf-8 -*-
#
# This file is part of BridgeDB, a Tor bridge distribution system.
#
# :authors: Isis Lovecruft 0xA3ADB67A2CDB8B35 <isis@torproject.org>
# please also see AUTHORS file
# :copyright: (c) 2013, Isis Lovecruft
# (c) 2007-2013, The Tor Project, Inc.
# (c) 2007-201... |
from __future__ import unicode_literals
import re
import logging
import functools
from copy import deepcopy
import six
import pytz
import xmltodict
from lxml import etree
from StringIO import StringIO
from dateutil import parser
from pycountry import languages
from nameparser import HumanName
from scrapi import requ... |
from flask import Flask
# from flask import request
app = Flask(__name__)
# Test URLs
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# http://localhost:8000/
# Produces 'Hello from Logan'
# http://localhost:8000/Bob
# Produces 'Hello from Bob'
# http://localhost:8000/add/5/5
# Produces 10
# http://localhost:8000/add/5/a
# Pro... |
import os
import logging
import contextlib
import tempfile
import pathlib
import synapse.exc as s_exc
import synapse.common as s_common
import synapse.telepath as s_telepath
import synapse.lib.base as s_base
import synapse.lib.boss as s_boss
import synapse.lib.const as s_const
import synapse.lib.lmdbslab as s_lmdbsl... |
# -*- coding: utf-8 -*-
import logging
from django import template
from django.conf import settings
from django.utils import timezone
from django.utils.safestring import mark_safe
from django.template.defaultfilters import linebreaksbr
from django.core.cache import cache
from django.contrib.sites.models import Site
f... |
# Copyright (c) 2010-2012 OpenStack Foundation
#
# 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 agree... |
# -*- coding: utf-8 -*-
import pytest
from api.base.settings.defaults import API_BASE
from osf_tests.factories import AuthUserFactory
from rest_framework import exceptions
@pytest.mark.django_db
class TestExceptionFormatting:
@pytest.fixture()
def user(self):
return AuthUserFactory(
full... |
from collections import namedtuple
import configparser
from functools import lru_cache
import unittest
from unittest.mock import patch, mock_open
import transaction
import testing.postgresql
import webtest
import datetime
from pyramid.config import Configurator
from pyramid.paster import get_app
from sqlalchemy import ... |
from __future__ import unicode_literals
import re
from copy import deepcopy
from nameparser import HumanName
URL_REGEX = re.compile(ur'(https?://\S*\.\S*)')
def updated_schema(old, new):
d = deepcopy(old)
for key, value in new.items():
if isinstance(value, dict) and old.get(key) and isinstance(old[k... |
'''
SimpleEval - (C) 2013/2014 Daniel Fairhead
-------------------------------------
An short, easy to use, safe and reasonably extensible expression evaluator.
Designed for things like in a website where you want to allow the user to
generate a string, or a number from some other input, without allowing full
eval() o... |
import types
import synapse.common as s_common
from synapse.eventbus import EventBus
class Task(EventBus):
'''
A cancelable Task abstraction which operates much like a Future
but with some additional features.
'''
def __init__(self, iden=None):
EventBus.__init__(self)
if iden is ... |
"""
Async Module
============
Helper utils for Orange GUI programming.
Provides :func:`asynchronous` decorator for making methods calls in async mode.
Once method is decorated it will have :func:`task.on_result` and :func:`task.callback` decorators for callback wrapping.
For instance::
class Widget(QObject):
... |
"""Geometrical Points.
Contains
========
Point
Point2D
Point3D
"""
from __future__ import division, print_function
from sympy.core import S, sympify
from sympy.core.compatibility import as_int, iterable, range
from sympy.core.containers import Tuple
from sympy.simplify import nsimplify, simplify
from sympy.geometry... |
''' All DUT alignment functions in space and time are listed here plus additional alignment check functions'''
from __future__ import division
import logging
import re
import os
import progressbar
import warnings
import matplotlib.pyplot as plt
from multiprocessing import Pool, cpu_count
import tables as tb
import nu... |
from __future__ import print_function
import numpy
import pylab
import PyQt4.QtGui as QG
import PyQt4.QtCore as QC
from matplotlib.backends.backend_qt4agg import (
FigureCanvasQTAgg as FigureCanvas,
NavigationToolbar2QTAgg as NavigationToolbar)
from matplotlib.figure import Figure
class SimplePlot(QG... |
# -*- coding: utf-8 -*-
# Copyright 2014, 2015 OpenMarket 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 applica... |
"""
Simple UDP client and server.
Client connects and sends a simple message.
Server randomly drops packets to simulate actual network packet loss.
Simple delay timer mechanism.
Reference: Foundations of Python Network Programming
"""
#!/usr/bin/env python
import socket
import sys
import optparse
import random
s =... |
import logging
import logging.config
from time import sleep
from django.conf import settings
from django.core.management.base import BaseCommand
from django.core.mail import send_mail
from github3 import login as github_login
from package.models import Package
logger = logging.getLogger(__name__)
class PackageUpd... |
# encoding: utf-8
"""
bgp.py
Created by Thomas Mangin on 2012-07-08.
Copyright (c) 2009-2015 Exa Networks. All rights reserved.
"""
# from exabgp.protocol.family import AFI
# from exabgp.protocol.family import SAFI
from exabgp.bgp.message import OUT
# from exabgp.bgp.message.update.nlri.nlri import NLRI
from exabgp... |
import datetime
mldb = mldb_wrapper.wrap(mldb) # noqa
start = datetime.datetime.now();
mldb.put("/v1/procedures/airline", {
"type":"import.text",
"params": {
"dataFileUrl": "https://s3.amazonaws.com/benchm-ml--main/train-1m.csv",
"offset" : 0,
"ignoreBadLines" : True,
"outputDa... |
import sys
import logging
import datetime
import time
from system import *
from statistics import *
class Simulation:
logger = logging.getLogger("sim")
def __init__(self, mission_time, iterations, raid_type, raid_num, disk_capacity,
disk_fail_parms, disk_repair_parms, disk_lse_parms, disk_scrub... |
import sys
import random
import signal
#Timer handler, helper function
class TimedOutExc(Exception):
pass
def handler(signum, frame):
#print 'Signal handler called with signal', signum
raise TimedOutExc()
class Manual_player:
def __init__(self):
pass
def move(self, temp_board, temp_block, old_m... |
# -*- coding: utf-8 -*-
# Copyright 2014, 2015 OpenMarket 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 applica... |
"""
sinecosine.py
Author: Roger Danilek
Credit: Adam Pikielny, Python math library
Assignment:
In this assignment you must use *list comprehensions* to generate sprites that show the behavior
of certain mathematical functions: sine and cosine.
The sine and cosine functions are provided in the Python math library. T... |
"""
sinecosine.py
Author: Anoushka Alavilli
Credit: <list sources used, if any>
Assignment:
In this assignment you must use *list comprehensions* to generate sprites that show the behavior
of certain mathematical functions: sine and cosine.
The sine and cosine functions are provided in the Python math library. Thes... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.