gt stringclasses 1
value | context stringlengths 2.49k 119k |
|---|---|
import numpy as np
import pytest
import pandas as pd
from pandas import (
DataFrame,
MultiIndex,
Series,
)
import pandas._testing as tm
class TestMultiLevel:
def test_reindex_level(self, multiindex_year_month_day_dataframe_random_data):
# axis=0
ymd = multiindex_year_month_day_datafra... | |
"""
Linux on Hyper-V and Azure Test Code, ver. 1.0.0
Copyright (c) Microsoft 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/LICEN... | |
#
# Author: Pearu Peterson, March 2002
#
# w/ additions by Travis Oliphant, March 2002
# and Jake Vanderplas, August 2012
from __future__ import division, print_function, absolute_import
__all__ = ['solve', 'solve_triangular', 'solveh_banded', 'solve_banded',
'solve_toeplitz', 'solve_circulant... | |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2012 NEC 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... | |
# sapid lisp
# python implementation
# gilles.arcas@gmail.com, https://github.com/GillesArcas/sapid-lisp
# MIT license
from __future__ import print_function
import sys
import os
import time
# Configuration
TailRecursionOptimization = 'MutualRecursion' # None | 'TailRecursion' | 'MutualRecursion'
# 2/3 compatibilit... | |
################################################################################
# The Neural Network (NN) based Speech Synthesis System
# https://svn.ecdf.ed.ac.uk/repo/inf/dnn_tts/
#
# Centre for Speech Technology Research
# University of Edinburgh, UK
# ... | |
#!/usr/bin/python3 -tt
# -*- coding: utf-8 -*-
# from twisted.internet import reactor
from twisted.internet import task
from twisted.python import log
from html.parser import HTMLParser
from requests.auth import HTTPBasicAuth
from requests.exceptions import RequestException
import requests
import re
import datetime
... | |
# Generated by Django 2.2.4 on 2019-08-23 17:35
import apps.adjudication.fields
from django.conf import settings
import django.contrib.postgres.fields
import django.contrib.postgres.fields.jsonb
import django.contrib.postgres.fields.ranges
import django.core.validators
from django.db import migrations, models
import d... | |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may ... | |
'''
The MIT License (MIT)
Copyright (C) 2014, 2015 Seven Watt <info@sevenwatt.com>
<http://www.sevenwatt.com>
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 withou... | |
# Copyright 2015 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
import logging
import os
from contextlib import contextmanager
from typing import List, Mapping, Optional, Tuple
from pants.base.build_environment import get_buildroot
from pants.base.cmd... | |
#!/usr/bin/env python3
# Copyright (c) 2018-2019 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test bitcoin-wallet."""
import hashlib
import os
import stat
import subprocess
import textwrap
from t... | |
#!/usr/bin/env python
import datetime as tm
import re
import sys
import os
from pandas import read_csv, to_numeric, concat
from poplerGUI.logiclayer.class_metaverify import MetaVerifier
from poplerGUI.logiclayer.class_helpers import check_registration
from poplerGUI.logiclayer.class_tablebuilder import (
Study_Site... | |
# Copyright 2021 Google 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 applicable law o... | |
import os
import glob
import os.path
import shutil
import subprocess
import time
import unittest
import tempfile
import re
def my_check_output(*popenargs, **kwargs):
"""
If we had python 2.7, we should simply use subprocess.check_output.
This is a stop-gap solution for python 2.6
"""
if 'stdout' in... | |
#!/usr/bin/env python
"""
The Requester module is in charge of simplifying HTTP requests and
automatically log HTTP transactions by calling the DB module.
"""
import sys
import httplib
import logging
import urllib
import urllib2
from framework.dependency_management.dependency_resolver import BaseComponent
from framew... | |
# -*- encoding: utf-8 -*-
"""
Sends slack notifications for alarms events
"""
import datetime as dt
import json
import os
import attr
import boto3
import requests
from wellcome_aws_utils.lambda_utils import log_on_error
from cloudwatch_alarms import (
build_cloudwatch_url,
datetime_to_cloudwatch_ts,
Thre... | |
# stdlib
from typing import Any
from typing import Callable
from typing import Dict
from typing import List
from typing import Type
from typing import Union
# third party
from nacl.encoding import HexEncoder
from nacl.signing import SigningKey
from nacl.signing import VerifyKey
# syft absolute
import syft as sy
# re... | |
# Copyright 2021 D-Wave 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 law or... | |
import hashlib
from . import db, login_manager
from werkzeug.security import generate_password_hash, check_password_hash
from flask import current_app, url_for
from flask.ext.login import UserMixin, current_user, AnonymousUserMixin
from itsdangerous import TimedJSONWebSignatureSerializer as Serializer
from datetime im... | |
import sublime
import sublime_plugin
import re
attributes = {}
attributes["exit \"$1\";"] = []
attributes["pageencoding \"$1\";"] = []
attributes["include \"$1\";"] = []
attributes["import \"$1\";"] = []
attributes["throw \"$1\";"] = []
attributes["rethrow"] = []
attributes["location"] = []
attributes["abort"] = []
at... | |
#!/Library/Frameworks/Python.framework/Versions/Current/bin/python
#This file isn't in use yet, we have to fix it up to do uploads later
import os
import sys
import random
import optparse
import httplib
import getpass
import base64
def upload(file, project_name, user_name, password, summary, labels=None):
"""Upload... | |
from __future__ import division
import abc
import warnings
import numpy as np
import six
np.seterr('warn')
from scipy.special import gamma as scipy_gamma
from scipy.special import gammaln as scipy_gammaln
from astropy.modeling.fitting import _fitter_to_model_params
from astropy.modeling import models
from stingray... | |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright 2019 The FATE 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/lic... | |
#!/usr/bin/env python
import time
import roslib; roslib.load_manifest('ur_driver')
import rospy
import actionlib
import threading
import pygame
import sys
import os
sys.path.insert(0, '/home/ubuntu/catkin_ws/src/keyboard/scripts/')
import keyboard_talker
import socket
sys.path.insert(0, '/home/ubuntu/catkin_ws/src/joys... | |
r"""*Root conftest for* ``sphobjinv``.
``sphobjinv`` is a toolkit for manipulation and inspection of
Sphinx |objects.inv| files.
**Author**
Brian Skinn (bskinn@alum.mit.edu)
**File Created**
20 Mar 2019
**Copyright**
\(c) Brian Skinn 2016-2022
**Source Repository**
http://www.github.com/bskinn/spho... | |
# 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 use ... | |
# Copyright 2017 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 python
import json
import os.path
from time import time
from pysnap.utils import (encrypt, decrypt, decrypt_story,
make_media_id, request)
MEDIA_IMAGE = 0
MEDIA_VIDEO = 1
MEDIA_VIDEO_NOAUDIO = 2
FRIEND_CONFIRMED = 0
FRIEND_UNCONFIRMED = 1
FRIEND_BLOCKED = 2
PRIVACY_EVERYONE ... | |
# -*- coding: utf-8 -*-
"""
Django settings for tecnoservicio project.
For more information on this file, see
https://docs.djangoproject.com/en/dev/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/dev/ref/settings/
"""
from __future__ import absolute_import, unico... | |
# Copyright 2012, 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 agr... | |
"""
Wrapper for rsync
.. versionadded:: 2014.1.0
This data can also be passed into :ref:`pillar <pillar-walk-through>`.
Options passed into opts will overwrite options passed into pillar.
"""
import errno
import logging
import re
import tempfile
import salt.utils.files
import salt.utils.path
from salt.exceptions im... | |
import logging
import os
import sys
PROJECT_DIR = os.path.abspath(os.path.dirname(os.path.dirname(__file__)))
DATA_ROOT = os.path.join(PROJECT_DIR, '.gaedata')
# Overrides for os.environ.
env_ext = {'DJANGO_SETTINGS_MODULE': 'settings'}
def setup_env():
"""Configures GAE environment for command-line apps."""
... | |
# -*- coding: utf-8 -*-
import furl
import lxml
import time
import logging
import requests
from django.db.models import QuerySet
from framework.auth.utils import impute_names
from website.identifiers.metadata import remove_control_characters
from website.identifiers.clients.base import AbstractIdentifierClient
from w... | |
'Toolkit for automatic-differentiation of Python functions'
# Resources for automatic-differentiation:
# https://en.wikipedia.org/wiki/Automatic_differentiation
# https://justindomke.wordpress.com/2009/02/17/
# http://www.autodiff.org/
from __future__ import division
import math
## Dual Number Class ##############... | |
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------... | |
import types
import sys
import os
from itertools import izip
import django.db.models.manager # Imported to register signal handler.
from django.core.exceptions import ObjectDoesNotExist, MultipleObjectsReturned, FieldError, ValidationError, NON_FIELD_ERRORS
from django.core import validators
from django.db.models.f... | |
"""
Testing for the gradient boosting module (sklearn.ensemble.gradient_boosting).
"""
import warnings
import numpy as np
from scipy.sparse import csr_matrix
from scipy.sparse import csc_matrix
from scipy.sparse import coo_matrix
from scipy.special import expit
import pytest
from sklearn import datasets
from sklearn... | |
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | |
#!/usr/bin/env python
##
# 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 r... | |
# 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
# d... | |
import logging
import os
import socket
import sqlite3
from datetime import date, datetime, time, timedelta
from os.path import normpath, split
from uuid import uuid4
import icalendar
from atomicwrites import AtomicWriter
from dateutil.tz import tzlocal
from todoman import exceptions
logger = logging.getLogger(name=_... | |
import ctypes
import fcntl
from .base import DrmObject
from .drm_h import DRM_IOCTL_MODE_OBJ_GETPROPERTIES, DRM_IOCTL_MODE_GETPROPERTY, DRM_IOCTL_MODE_OBJ_SETPROPERTY
from .drm_mode_h import DrmModeObjGetPropertiesC, DrmModeObjGetPropertyC, DrmModePropertyEnumC, DrmModeObjSetPropertyC
from .drm_mode_h import DRM_MODE_... | |
import aredis
import asyncio
import uvloop
import time
import sys
from functools import wraps
from argparse import ArgumentParser
if sys.version_info[0] == 3:
long = int
def parse_args():
parser = ArgumentParser()
parser.add_argument('-n',
type=int,
help='T... | |
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
from __future__ import unicode_literals
import frappe, json
from frappe import _dict
import frappe.share
class UserPermissions:
"""
A user permission object can be accessed as `frappe.get_user()`
"""
def __init__(... | |
import copy
import math
import pickle
import numpy
import pytest
import chainerx
import chainerx.testing
from chainerx_tests import array_utils
def _check_array(
array, expected_dtype, expected_shape, expected_data_list=None,
device=None):
expected_dtype = chainerx.dtype(expected_dtype)
as... | |
# Code in this file is copied and adapted from
# https://github.com/openai/evolution-strategies-starter.
from collections import namedtuple
import logging
import numpy as np
import time
import ray
from ray.rllib.agents import Trainer, with_common_config
from ray.rllib.agents.es import optimizers, utils
from ray.rllib... | |
# coding=utf-8
# Copyright 2022 The Tensor2Tensor 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... | |
#!/usr/bin/python
#
# Author: Jarkko Vatjus-Anttila <jvatjusanttila@gmail.com>
#
# For conditions of distribution and use, see copyright notice in license.txt
#
import os
import sys
##########################################################################
# Class MaterialContainer
#
class MaterialContainer():
de... | |
import six
import pytest
import verta
from verta._protos.public.modeldb import ExperimentRunService_pb2 as _ExperimentRunService
OPERATORS = six.viewkeys(verta.tracking.entities.ExperimentRuns._OP_MAP)
class TestFind:
def test_reject_unsupported_keys(self, client, floats):
# known unsupported keys
... | |
#!/usr/bin/python
#
# linearize-data.py: Construct a linear, no-fork version of the chain.
#
# Copyright (c) 2013-2014 The Gtacoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
#
from __future__ import print_func... | |
import maya.cmds as mc
def findAllModules(sDir):
#find the available modules in the path
# returns: list of modules excluding the *.py
aModuleList = []
aAllPyFiles = findAllFiles(sDir, '.py')
for file in aAllPyFiles:
if file != '__init__':
aModuleList.append(file)
return aModuleList
def findAllModuleNames... | |
# Copyright The Cloud Custodian Authors.
# SPDX-License-Identifier: Apache-2.0
from .common import BaseTest
class ReplInstance(BaseTest):
def test_describe_augment_no_tags(self):
session_factory = self.replay_flight_data(
"test_dms_repl_instance_describe_sans_tags"
)
p = self... | |
# Copyright (c) 2013 dotCloud, Inc.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requir... | |
import re
from collections import defaultdict
from pdfminer.layout import LTComponent, LTImage
from pt_law_parser.auxiliar import eq, middle_x
class Paragraph(object):
@staticmethod
def sanitize(text):
# hyphens in words are getting a space from PDFminer. Remove it.
return re.sub(ur' (\-\w+... | |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import unittest
from ebstall.deployers.openvpn import OpenVpnConfig
__author__ = 'dusanklinec'
test1 = """client-to-client
server 10.8.0.0 255.255.255.0
;server 10.7.0.0 255.255.255.0
key server.key # This file should be kept secret
;key server.key # This file should ... | |
from django.test import TestCase
from django.core.exceptions import ValidationError
from .models import Part, PartCategory, PartParameter, PartParameterTemplate
class CategoryTest(TestCase):
"""
Tests to ensure that the relational category tree functions correctly.
Loads the following test fixtures:
... | |
"""The tests for the Recorder component."""
# pylint: disable=protected-access
import asyncio
from datetime import datetime, timedelta
import sqlite3
from unittest.mock import patch
import pytest
from sqlalchemy.exc import DatabaseError, OperationalError, SQLAlchemyError
from homeassistant.components import recorder
... | |
#__BEGIN_LICENSE__
# Copyright (c) 2015, United States Government, as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All rights reserved.
#
# The xGDS platform is licensed under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance... | |
# Django settings for cms project.
from distutils.version import LooseVersion
import django
import os
PROJECT_DIR = os.path.abspath(os.path.dirname(__file__))
DEBUG = True
TEMPLATE_DEBUG = DEBUG
ADMINS = (
)
CACHE_BACKEND = 'locmem:///'
MANAGERS = ADMINS
DATABASES = {
'default': {
'ENGINE': 'django.db.... | |
# -*- coding: utf-8 -*-
#
# 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
#... | |
import logging
import libvirt
from vnc.models import Vnc
from .tasks import start_websock
from os import kill
from xml.dom.minidom import parseString
from multiprocessing import Process
class LibvirtBackend(object):
def __init__(self):
self.logger = logging.getLogger(__name__)
try:
se... | |
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the Li... | |
#!/usr/bin/env python2
##
# autosign
# https://github.com/leosartaj/autosign.git
#
# copyright (c) 2014 sartaj singh
# licensed under the mit license.
##
import os
import re
import exce
"""
Main functions
"""
def getIndex(fName, options):
"""
returns the start and end of a signature in a file
returns N... | |
"""
To ensure compatibility from Python ``2.6`` - ``3.3``, a module has been
created. Clearly there is huge need to use conforming syntax.
"""
import sys
import imp
import os
import re
try:
import importlib
except ImportError:
pass
is_py3 = sys.version_info[0] >= 3
is_py33 = is_py3 and sys.version_info.minor >... | |
# Natural Language Toolkit: Chunk format conversions
#
# Copyright (C) 2001-2017 NLTK Project
# Author: Edward Loper <edloper@gmail.com>
# Steven Bird <stevenbird1@gmail.com> (minor additions)
# URL: <http://nltk.org/>
# For license information, see LICENSE.TXT
from __future__ import print_function, unicode_lit... | |
import os
import wx
import wx.lib.agw.multidirdialog as MDD
from abc import ABCMeta, abstractmethod
from gooey.gui.lang import i18n
from gooey.gui.util.filedrop import FileDrop
from gooey.gui.widgets.calender_dialog import CalendarDlg
class WidgetPack(object):
"""
Interface specifying the contract to which
al... | |
from operator import (
and_,
ge,
gt,
le,
lt,
methodcaller,
ne,
or_,
)
from unittest import TestCase
import numpy
from numpy import (
arange,
eye,
full,
isnan,
zeros,
)
from pandas import (
DataFrame,
date_range,
Int64Index,
)
from zipline.modelling.expre... | |
"""Miscellaneous operations for traditional philology and simple
statistics."""
__author__ = ['Kyle P. Johnson <kyle@kyle-p-johnson.com>',
'Steven Bird <stevenbird1@gmail.com>', # original author of NLTK's ConcordanceIndex()
'Edward Loper <edloper@gmail.com>'] # original author of NLTK's ... | |
#
# 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
# ... | |
# 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... | |
# Copyright 2013: Mirantis 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 b... | |
"""Device, context and memory management on CuPy.
.. note::
The package ``chainer.cuda`` has been renamed to
:mod:`chainer.backends.cuda` as of v4.0.0, but the previous module path
``chainer.cuda`` is also available.
Chainer uses `CuPy <https://cupy.chainer.org/>`_ (with very thin wrapper)
to exploit the spe... | |
# -*- coding: utf-8 -*-
"""
Created on Sat Dec 13 18:36:41 2014
@author: favi
"""
from PyQt4 import QtCore, QtGui
from FsmGraphicHandle import FsmGraphicHandle
class FsmTransition(QtGui.QGraphicsPathItem):
#class FsmTransition(QtGui.QGraphicsLineItem):
def __init__(self, startItem, endItem, parent=None, scene=No... | |
"""
Define various message strings generated in the code.
As far as possible, user display strings referenced directly by
source code are isolated here to facilitate editing and translation.
"""
from __future__ import unicode_literals
from __future__ import absolute_import, division, print_function
__author__ =... | |
#!/usr/bin/env python
#
# Electrum - lightweight ParkByte client
# Copyright (C) 2015 Thomas Voegtlin
#
# 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 withou... | |
import os
import numpy as np
from os.path import join as pjoin
from dipy.viz import actor, window, widget, fvtk
from dipy.data import DATA_DIR
from dipy.data import fetch_viz_icons, read_viz_icons
import numpy.testing as npt
from dipy.testing.decorators import xvfb_it
use_xvfb = os.environ.get('TEST_WITH_XVFB', False... | |
#!/usr/bin/env python3
# Minimal install
# apt-get install python3-regex
# apt-get install python3-pandas
import sys
import re
from optparse import OptionParser
import BQhelper as bq
import pandas as pd
# Infer subexpressions to access indicator columns
# Column Matcher
Patterns={
'TestDate':[ # NB: Row dates a... | |
# Copyright 2014 The Chromium OS Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""cros pinchrome: Pin chrome to an earlier version."""
from __future__ import print_function
import fnmatch
import glob
import os
import re
import shut... | |
import json
import uuid
from unittest.mock import patch
import django_rq
from django.http import HttpResponse
from django.urls import reverse
from requests import Session
from rest_framework import status
from extras.models import Webhook
from extras.webhooks import enqueue_object, flush_webhooks, generate_signature
... | |
from __future__ import absolute_import
import re
from cStringIO import StringIO
from datetime import datetime, date, timedelta
from psycopg2.extensions import QuotedString, Binary, AsIs
class PostgresWriter(object):
"""Base class for :py:class:`mysql2pgsql.lib.postgres_file_writer.PostgresFileWriter`
and :p... | |
# 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 -*-
# Copyright 2021 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... | |
# Copyright 2010 Jacob Kaplan-Moss
# Copyright 2011 OpenStack Foundation
# Copyright 2011 Piston Cloud Computing, Inc.
# Copyright 2013 Alessio Ababilov
# Copyright 2013 Grid Dynamics
# Copyright 2013 OpenStack Foundation
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you ... | |
# -*- coding: utf-8 -*-
#
# general_models.py
#
# Copyright 2020 Amazon.com, Inc. or its affiliates. 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.ap... | |
from lsst.sims.maf.db import trackingDb, resultsDb
import os
import json
class MetricObj(object):
"""
Save a metric as an object
"""
def __init__(self, metadata):
self.metadata = metadata
self.plots = {}
self.stats = []
def __repr__(self):
return json.dumps(self.met... | |
# Copyright 2016-2017 Capital One Services, 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 ... | |
#
# 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
# ... | |
#!/usr/bin/env python
# -*- coding: utf8 -*-
"""
This script is meant as a simple way to reply to ical invitations from mutt.
See README for instructions and LICENSE for licensing information.
"""
from __future__ import with_statement
__author__="Martin Sander"
__license__="MIT"
import vobject
import tempfile, time... | |
# Copyright 2008 the V8 project authors. All rights reserved.
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditi... | |
# Copyright (c) 2021 PaddlePaddle 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 app... | |
"""
Defines the GridMapper class, which maps from a 2-D region in data space
into a structured (gridded) 1-D output space.
"""
# Python standard library imports
from contextlib import contextmanager
# Major library imports
from numpy import column_stack, transpose
# Enthought library imports
from traits.api import B... | |
# -*- coding: utf-8 -*-
# Copyright (c) 2015-2018, Exa Analytics Development Team
# Distributed under the terms of the Apache License 2.0
"""
Molcas Output Parser
#####################
Multiple frames are not currently supported
"""
from __future__ import absolute_import
from __future__ import print_function
from __fut... | |
from collections import defaultdict
import threading
import traceback
import redis
import grpc
import ray
from ray import ray_constants
from ray import cloudpickle as pickle
import ray._private.profiling as profiling
import logging
logger = logging.getLogger(__name__)
class ImportThread:
"""A thread used to im... | |
# -*- coding: utf-8 -*-
# :coding=utf-8:
# base settings - imported by other settings files, then overridden
import os.path
import posixpath
from django.core.urlresolvers import reverse_lazy
from django.utils.translation import ugettext_lazy as _
def env_or_default(NAME, default):
return os.environ.get(NAME, de... | |
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | |
import imghdr
import json
import logging
from django.conf import settings
from django.db.models import Q
from django.http import (HttpResponse, HttpResponseRedirect,
HttpResponseBadRequest, Http404)
from django.shortcuts import get_object_or_404, render
from django.views.decorators.clickjackin... | |
#!/usr/bin/env python
# OpenVirteX control script
# Heavily based on FlowVisor's fvctl
#import local thrift files
import TenantServer
from ttypes import *
#import Thrift packages to connect to server
from thrift import Thrift
from thrift.transport import TSocket
from thrift.transport import TTransport
from thrift.pr... | |
# -- coding: utf-8 --
"""
Spotify Playmaker
:summary: A basic webapp that creates a Spotify playlist using a phrase.
:note: Initially based on selected code from the Flaskr demo app.
:author: Jonathan Sedar
:contact: jon.sedar\@gmail.com
:copyright: 2012 by Jon Sedar and Flaskr is (c) 2010 by A... | |
import argparse
import sys
import warnings
from gettext import gettext
from typing import Any
from typing import Callable
from typing import cast
from typing import Dict
from typing import List
from typing import Mapping
from typing import Optional
from typing import Sequence
from typing import Tuple
from typing import... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.