gt stringclasses 1
value | context stringlengths 2.49k 119k |
|---|---|
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2011 OpenStack Foundation
# Copyright 2012 Justin Santa Barbara
#
# 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
#
# h... | |
#!/usr/bin/env python
# Copyright 2015-2016 Yelp 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 ... | |
# Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
#
# 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... | |
"""
PSF Fitting
===========
This script can be used to fit a set of basis functions to a point spread function.
:requires: Scikit-learn
:requires: PyFITS
:requires: NumPy
:requires: SciPy
:requires: matplotlib
:requires: VISsim-Python
:version: 0.2
:author: Sami-Matias Niemi
:contact: smn2@mssl.ucl.ac.uk
"""
import... | |
#!/usr/bin/python
"""
Copyright 2014 Google Inc.
Use of this source code is governed by a BSD-style license that can be
found in the LICENSE file.
Test the render_pictures binary.
"""
# System-level imports
import json
import os
import shutil
import tempfile
# Imports from within Skia
import base_unittest
# Maxim... | |
# Copyright (c) 2011 OpenStack Foundation
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless ... | |
import itertools
import torch
import torch.nn as nn
import seq2seq.data.config as config
from seq2seq.models.attention import BahdanauAttention
from seq2seq.utils import init_lstm_
class RecurrentAttention(nn.Module):
"""
LSTM wrapped with an attention module.
"""
def __init__(self, input_size=1024,... | |
from .Exporter import Exporter
from ..python2_3 import asUnicode
from ..parametertree import Parameter
from ..Qt import QtGui, QtCore, QtSvg, QT_LIB
from .. import debug
from .. import functions as fn
import re
import xml.dom.minidom as xml
import numpy as np
__all__ = ['SVGExporter']
class SVGExporter(Exporter):
... | |
# Copyright 2012-2014 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. A copy of
# the License is located at
#
# http://aws.amazon.com/apache2.0/
#
# or in the "license" file ac... | |
"""Base Integration for Cortex XSOAR - Unit Tests file
Pytest Unit Tests: all funcion names must start with "test_"
More details: https://xsoar.pan.dev/docs/integrations/unit-testing
MAKE SURE YOU REVIEW/REPLACE ALL THE COMMENTS MARKED AS "TODO"
You must add at least a Unit Test function for every XSOAR command
you... | |
#!/usr/bin/env python
# -*- encoding: utf-8 -*-
"""Test client standard actions."""
import hashlib
import io
import os
import platform
import stat
import unittest
from unittest import mock
from absl import app
from grr_response_client.client_actions import standard
from grr_response_client.vfs_handlers import files
... | |
# -*- coding: utf-8 -*-
"""A searcher to find file entries within a file system."""
import re
import sre_constants
from dfvfs.lib import definitions
from dfvfs.lib import errors
from dfvfs.lib import glob2regex
from dfvfs.lib import py2to3
from dfvfs.path import factory as path_spec_factory
class FindSpec(object):
... | |
# -*- coding: utf-8 -*-
"""The profiler classes."""
from __future__ import unicode_literals
import codecs
import gzip
import os
import time
class CPUTimeMeasurement(object):
"""The CPU time measurement.
Attributes:
start_sample_time (float): start sample time or None if not set.
total_cpu_time (float):... | |
#!/usr/bin/env python3
#Copyright (c) 2013, Eduard Broecker
#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 o... | |
from itertools import permutations
import numpy as np
from scipy import spatial, stats
def test(X, Y, perms=10000, method="pearson", tail="two-tail", ignore_nans=False):
"""
Takes two distance matrices (either redundant matrices or condensed vectors)
and performs a Mantel test. The Mantel test is a signif... | |
import pytest
from pytestqt.exceptions import (
_is_exception_capture_enabled,
_QtExceptionCaptureManager,
)
from pytestqt.logging import QtLoggingPlugin, _QtMessageCapture
from pytestqt.qt_compat import qt_api
from pytestqt.qtbot import QtBot, _close_widgets
@pytest.fixture(scope="session")
def qapp_args():... | |
# Copyright 2018 The LUCI Authors. All rights reserved.
# Use of this source code is governed under the Apache License, Version 2.0
# that can be found in the LICENSE file.
from recipe_engine import recipe_api
class ArchiveApi(recipe_api.RecipeApi):
"""Provides steps to manipulate archive files (tar, zip, etc.).""... | |
"""Support for LED selects."""
from __future__ import annotations
from functools import partial
from wled import Live, Playlist, Preset
from homeassistant.components.select import SelectEntity
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import ENTITY_CATEGORY_CONFIG
from homeassista... | |
"""Tests for 'site'.
Tests assume the initial paths in sys.path once the interpreter has begun
executing have not been removed.
"""
import unittest
import test.support
from test.support import captured_stderr, TESTFN, EnvironmentVarGuard
import builtins
import os
import sys
import re
import encodings
import urllib.re... | |
try:
from invoke.vendor.six import StringIO
except ImportError:
from six import StringIO
from mock import Mock, call
from pytest_relaxed import raises
from pytest import skip # noqa
from paramiko import SFTPAttributes
from fabric import Connection
from fabric.transfer import Transfer
# TODO: pull in all ed... | |
# Copyright 2016 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | |
import asyncio
from collections import defaultdict
from functools import partial
from itertools import cycle
import logging
import random
from dask.optimization import SubgraphCallable
import dask.config
from dask.utils import parse_timedelta
from tlz import merge, concat, groupby, drop
from .core import rpc
from .ut... | |
# Copyright 2012 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 agree... | |
from setup.linux import setup_util
from benchmark import framework_test
from benchmark.test_types import *
from utils import header
from utils import gather_tests
from utils import gather_frameworks
from utils import verify_database_connections
import os
import shutil
import stat
import json
import subprocess
import ... | |
#Libtest
#check doc/libtest.txt for information
platform = None
# __pragma__ ('skip')
import os, sys
if os.name in ('posix', 'nt', 'os2', 'ce', 'riscos'):
os.environ['PYGAME_HIDE_SUPPORT_PROMPT'] = "hide"
import pygame as pg
platform = 'pc'
executor = 'python'
library = 'pygame'
elif os.name =... | |
# Copyright 2016 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import argparse
import os.path
import sys
import re
try:
import json
except ImportError:
import simplejson as json
# Path handling for libraries and tem... | |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, division, print_function, unicode_literals
from os.path import join, splitext, basename
from utool import util_inject
print, rrr, profile = util_inject.inject2(__name__)
def add_new_mimetype_association(ext, mime_name, exe_fpath=None, dry=True):
"""
... | |
import operator
import logging
import numpy as np
from .io import extract_data_fits, extract_data_hdf5
from .coordinates import Coordinates, coordinates_from_header
from .visual import VisualAttributes
from .visual import RED, GREEN, BLUE, BROWN, ORANGE, PURPLE, PINK
from .exceptions import IncompatibleAttribute
from... | |
import json
import os.path
import random
import re
import uuid
import zipfile
from django import forms
from django.conf import settings
from django.core.cache import cache
from django.db.models import Q
from django.forms import ValidationError
from django.utils.translation import ugettext
import waffle
from olympia ... | |
# -* coding: utf-8 -*-
"""
flaskext.openid
~~~~~~~~~~~~~~~
Tiny wrapper around python-openid to make working with the basic
API in a theflasktest application easier. Adapt this code for your own
project if necessary.
:copyright: (c) 2010 by Armin Ronacher.
:license: BSD, see LICENSE for m... | |
"""Support for WeMo humidifier."""
import asyncio
import logging
from datetime import timedelta
import requests
import async_timeout
import voluptuous as vol
import homeassistant.helpers.config_validation as cv
from homeassistant.components.fan import (
DOMAIN, SUPPORT_SET_SPEED, FanEntity,
SPEED_OFF, SPEED_L... | |
#
# This file is part of Python-ASN1. Python-ASN1 is free software that is
# made available under the MIT license. Consult the file "LICENSE" that is
# distributed together with this file for the exact licensing terms.
#
# Python-ASN1 is copyright (c) 2007-2008 by the Python-ASN1 authors. See the
# file "AUTHORS" for a... | |
# -*- coding: utf-8 -*-
""" Core components """
from boto.exception import JSONResponseError, BotoServerError
from dynamic_dynamodb import calculators
from dynamic_dynamodb.aws import dynamodb, sns
from dynamic_dynamodb.core import circuit_breaker
from dynamic_dynamodb.statistics import table as table_stats
from dynam... | |
# 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 python3
# Copyright 2012-2015 The Meson development team
# 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... | |
from itertools import permutations
from sympy.core.compatibility import range
from sympy.core.expr import unchanged
from sympy.core.relational import Eq
from sympy.core.symbol import Symbol
from sympy.core.singleton import S
from sympy.combinatorics.permutations import (Permutation, _af_parity,
_af_rmul, _af_rmuln... | |
# Copyright (c) 2012-2013, Harry Bock <bock.harryw@gmail.com>
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice, this
# ... | |
import csv
import pytz
from datetime import timedelta
from django.utils import timezone
from django.conf import settings
from django.db.models import Q
from django.db import IntegrityError
from easyCall.apps.call_records.models import CallRecord
from easyCall.apps.call_records.models import QueueEntry
from easyCall.... | |
# Copyright 2017 Balazs Nemeth, Mark Szalay, Janos Doka
#
# 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... | |
# Copyright (c) 2015, MapR Technologies
#
# 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... | |
from django.db.models import Q
from django.forms.extras.widgets import SelectDateWidget
from django import forms
from django.utils.translation import ugettext_lazy as _
from onadata.apps.fieldsight.models import Site
from onadata.apps.fieldsight.utils.forms import HTML5BootstrapModelForm, KOModelForm, HRBSFormField
fro... | |
# Copyright 2015 Hitachi Data Systems.
# 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 req... | |
# BaselineTurbineAnalysis.py
#
# NREL 5MW Wind Turbine Analysis
# Using parameters specified by the NREL report for the 5MW tower, perform
# aerodynamic, structural and cost analysis on the turbine to verify that the
# numbers are reasonable.
#
# Author: Lewis Li (lewisli@stanford.edu)
# Original Date: November 1st 2... | |
"""
Set operations for 1D numeric arrays based on sorting.
:Contains:
ediff1d,
unique,
intersect1d,
setxor1d,
in1d,
union1d,
setdiff1d
:Notes:
For floating point arrays, inaccurate results may appear due to usual round-off
and floating point comparison issues.
Speed could be gained in some operations ... | |
'''
Individual stages of the pipeline implemented as functions from
input files to output files.
The run_stage function knows everything about submitting jobs and, given
the state parameter, has full access to the state of the pipeline, such
as config, options, DRMAA and the logger.
'''
from utils import safe_make_di... | |
"""Implementation of JSONDecoder
"""
import re
from json import scanner
try:
from _json import scanstring as c_scanstring
except ImportError:
c_scanstring = None
__all__ = ['JSONDecoder', 'JSONDecodeError']
FLAGS = re.VERBOSE | re.MULTILINE | re.DOTALL
NaN = float('nan')
PosInf = float('inf')
NegInf = float... | |
"""Demo platform for the cover component."""
from homeassistant.components.cover import (
ATTR_POSITION,
ATTR_TILT_POSITION,
SUPPORT_CLOSE,
SUPPORT_OPEN,
CoverDevice,
)
from homeassistant.helpers.event import track_utc_time_change
from . import DOMAIN
async def async_setup_platform(hass, config, ... | |
"""
tests.test_component_group
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Tests the group compoments.
"""
# pylint: disable=protected-access,too-many-public-methods
import unittest
import logging
import homeassistant.core as ha
from homeassistant.const import STATE_ON, STATE_OFF, STATE_HOME, STATE_UNKNOWN
import homeassistant.comp... | |
# Copyright 2011 OpenStack Foundation
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requ... | |
from __future__ import with_statement
import Queue
from itertools import chain
import os
from select import select
import socket
import sys
import threading
import warnings
from redis._compat import b, xrange, imap, byte_to_chr, unicode, bytes, long, \
nativestr, basestring, iteritems, LifoQueue, Empty, Full, url... | |
import nose
from distutils.version import LooseVersion
import numpy as np
from pandas import tslib
import pandas._period as period
import datetime
import pandas as pd
from pandas.core.api import Timestamp, Series, Timedelta, Period, to_datetime
from pandas.tslib import get_timezone
from pandas._period import period_a... | |
# Copyright 2014 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
from telemetry.page import page
from telemetry import story
TOP_2013_URLS = [
'http://www.facebook.com/barackobama',
'https://www.google.com/search?q=b... | |
#!/usr/bin/env python
# 3dhubs-crawler.py
# by Xilin Sun
# April 2015
import urllib2
import bs4
import requests
import pandas as pd
import json
from StringIO import StringIO
# Get list of 3d hubs
def find_hub_lists(URL):
hub_lists = []
response = requests.get(URL)
soup = bs4.BeautifulSoup(response.text)
... | |
#!/usr/bin/env python
# Copyright (c) 2012 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import cStringIO
import logging
import os
import sys
import textwrap
import unittest
ROOT_DIR = os.path.dirname(os.path.dirname(os... | |
#!/usr/bin/env python3
"""
Periscope API for the masses
Portions of the code in this file are Copyright (c) 2015 Russell Harkanson and are available
under The MIT License as part of Pyriscope: https://github.com/rharkanson/pyriscope
"""
import os
import shutil
import time
from subprocess import Popen
from urllib.par... | |
import os
import sys
import time
import pty
import tty
import errno
import signal
from contextlib import contextmanager
import ptyprocess
from ptyprocess.ptyprocess import use_native_pty_fork
from .exceptions import ExceptionPexpect, EOF, TIMEOUT
from .spawnbase import SpawnBase
from .utils import (
which, split_... | |
# coding=utf-8
# Copyright 2022 The Google Research 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 sys
import time
from ...vendor.Qt import QtWidgets, QtCore
from ... import api, io, style
from ..models import AssetModel
from ..widgets import AssetWidget
from .. import lib
from .widgets import SubsetWidget, VersionWidget, FamilyListWidget
module = sys.modules[__name__]
module.window = None
# Custom roles... | |
import ctypes
import struct
from coapthon import defines
from coapthon.messages.message import Message
from coapthon.messages.option import Option
from coapthon.messages.request import Request
from coapthon.messages.response import Response
__author__ = 'Giacomo Tanganelli'
__version__ = "2.0"
class Serializer(objec... | |
"""Provide functionality to stream video source.
Components use create_stream with a stream source (e.g. an rtsp url) to create
a new Stream object. Stream manages:
- Background work to fetch and decode a stream
- Desired output formats
- Home Assistant URLs for viewing a stream
- Access tokens for URLs for vi... | |
import iSenseAPI
# Field Types
TIMESTAMP = iSenseAPI.TIMESTAMP
NUMBER = iSenseAPI.NUMBER
TEXT = iSenseAPI.TEXT
LATITUDE = iSenseAPI.LATITUDE
LONGITUDE = iSenseAPI.LONGITUDE
class Project(object):
def __init__(self, project_id):
dictionary = iSenseAPI.getProject(project_id, recur=True)
# __ ma... | |
# 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... | |
r"""
D:\apps\skitai\skitai\protocol\smtp>D:\apps\xlmail\lib\sendlufex.py
send: 'ehlo [127.0.0.1]\r\n'
reply: '250-smtp.gmail.com at your service, [xx.xx.xx.xx]\r\n'
reply: '250-SIZE 35882577\r\n'
reply: '250-8BITMIME\r\n'
reply: '250-AUTH LOGIN PLAIN XOAUTH2 PLAIN-CLIENTTOKEN OAUTHBEARER XOAUTH\r\n'
reply: '250-ENHANCE... | |
# measure/models.py
# Brought to you by We Vote. Be good.
# -*- coding: UTF-8 -*-
from django.db import models
from django.db.models import Q
from exception.models import handle_exception, handle_record_found_more_than_one_exception
from wevote_settings.models import fetch_next_we_vote_id_last_contest_measure_integer,... | |
from rpython.rlib.rstring import StringBuilder
from rpython.rtyper.lltypesystem import lltype, rffi
from rpython.rtyper.lltypesystem.rstr import copy_string_to_raw
from rpython.rtyper.annlowlevel import llstr
from hippy.builtin import Optional, ExitFunctionWithError, wrap, W_Root
from hippy.module.regex import _pcre
... | |
from django.db import models
from django.core.validators import RegexValidator
import datetime
# Create your models here.
class Nodeowner(models.Model):
ad_client_id = models.DecimalField(max_digits=10,decimal_places=0,null=False,default=1000000)#Alternative Solution
ad_org_id = models.DecimalField(max_digits... | |
"""
Pika connection pool inspired by:
- https://github.com/WeatherDecisionTechnologies/flask-pika
and this interface:
- http://docs.sqlalchemy.org/en/latest/core/pooling.html#sqlalchemy.pool.Pool
Get it like this:
.. code:: python
$ pip install pika-pool
Use it like e.g. this:
.. code:: python
... | |
import csv
import six
import io
import chardet
if six.PY2:
from StringIO import StringIO
elif six.PY3:
from io import StringIO
MAX_READ = 100000
class Parser(object):
def __init__(self):
self._has_header = None
self._delimiter = None
self._column_names = None
self._handle... | |
# python3
# pylint: disable=g-bad-file-header
# Copyright 2019 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... | |
# Copyright 2014 Red Hat, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... | |
"""
Sync Media to S3
================
Django command that scans all files in your settings.MEDIA_ROOT and
settings.STATIC_ROOT folders and uploads them to S3 with the same directory
structure.
This command can optionally do the following but it is off by default:
* gzip compress any CSS and Javascript files it finds ... | |
"""RPC Implemention, originally written for the Python Idle IDE
For security reasons, GvR requested that Idle's Python execution server process
connect to the Idle process, which listens for the connection. Since Idle has
has only one client per server, this was not a limitation.
+--------------------------------... | |
#
# 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... | |
"""
Copyright 2017-present Airbnb, Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, sof... | |
# -*- coding: utf-8 -*-
from .base import FunctionalTestCase
from .pages import game
DATE_REGEX = r'\[\d{1,2}-\d{1,2} \d{2}:\d{2}\] '
class UndoTests(FunctionalTestCase):
def test_can_undo_player_transfering_money_to_bank(self):
self.story('Alice is a user who has a game with a player')
self.brows... | |
#!/usr/bin/env python
'''
Created on 12 Mar 2013
@author: nathan
'''
from collections import namedtuple
from threading import Thread, current_thread, RLock
import math
import time
from controller import Robot
import rospy
from sf_controller_msgs.msg import SunflowerAction, SunflowerFeedback, SunflowerResult
import... | |
<<<<<<< HEAD
<<<<<<< HEAD
"""Tests for distutils.command.install."""
import os
import sys
import unittest
import site
from test.support import captured_stdout, run_unittest
from distutils import sysconfig
from distutils.command.install import install
from distutils.command import install as install_module
from distu... | |
#!/usr/bin/env python3
# Copyright (c) 2015-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.
"""Functionality to build scripts, as well as signature hash functions.
This file is modified from python... | |
# 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 ... | |
# -------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
# --------------------------------------------------------------------------
from typin... | |
"""
svn-Command based Implementation of a Subversion WorkingCopy Path.
SvnWCCommandPath is the main class.
"""
import os, sys, time, re, calendar
import py
import subprocess
from py._path import common
#-----------------------------------------------------------
# Caching latest repository revision and repo-path... | |
#
# Copyright (c) 2008-2015 Citrix Systems, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License")
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable l... | |
from datetime import date, timedelta
import pytest
from prices import Money, TaxedMoney
from saleor.checkout.utils import get_voucher_discount_for_checkout
from saleor.discount import DiscountValueType, VoucherType
from saleor.discount.models import NotApplicable, Sale, Voucher
from saleor.discount.utils import (
... | |
"""song_scraper.py: Downloads all the songs of movies starting with a given alphabet."""
__author__ = "Nikhil Bharadwaj"
__license__ = "MIT License"
__version__ = "Python 3.5"
import sys, os, requests, warnings
from bs4 import BeautifulSoup
import urllib.request
error_count_alphabet = 0 #Keeps a... | |
# -*- coding: UTF-8 -*-
# Documentation available here:
# http://www.vtk.org/VTK/img/file-formats.pdf
import os
import copy
import tempfile
import numpy as np
from tractconverter.formats import header
from tractconverter.formats.header import Header as H
def readBinaryBytes(f, nbBytes, dtype):
buff = f.read(nb... | |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright (c) 2014 clowwindy
#
# 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 without limitation the rights
# to u... | |
# -*- coding: utf-8 -*-
# NOTE(jkoelker) patch time to include monotonic
import monotime # noqa
import collections
import Queue as queue
import time
import threading
import traceback
import collectd
import influxdb
import requests
def parse_types_file(path):
""" This function tries to parse a collectd complia... | |
from sklearn.feature_extraction.text import CharNGramAnalyzer
from sklearn.feature_extraction.text import WordNGramAnalyzer
from sklearn.feature_extraction.text import strip_accents
from sklearn.feature_extraction.text import to_ascii
from sklearn.feature_extraction.text import CountVectorizer
from sklearn.feature_ext... | |
import unittest
import json
from btctxstore import BtcTxStore
from dataserv.run import app, db
from dataserv.app import secs_to_mins, online_farmers
from email.utils import formatdate
from datetime import datetime
from datetime import timedelta
from time import mktime
class AppTest(unittest.TestCase):
# setup
... | |
"""
Unit tests for trust-region iterative subproblem.
To run it in its simplest form::
nosetests test_optimize.py
"""
import numpy as np
from scipy.optimize._trustregion_exact import (
estimate_smallest_singular_value,
singular_leading_submatrix,
IterativeSubproblem)
from scipy.linalg import (svd, get_l... | |
# Copyright (c) Twisted Matrix Laboratories.
# See LICENSE for details.
"""
Implements the SSH v2 key agent protocol. This protocol is documented in the
SSH source code, in the file
U{PROTOCOL.agent<http://www.openbsd.org/cgi-bin/cvsweb/src/usr.bin/ssh/PROTOCOL.agent>}.
Maintainer: Paul Swartz
"""
from __future__ i... | |
"""Basic tests for Byterun."""
from __future__ import print_function
from . import vmtest
import six
PY3, PY2 = six.PY3, not six.PY3
class TestIt(vmtest.VmTestCase):
def test_constant(self):
self.assert_ok("17")
def test_globals(self):
self.assert_ok("""\
global xyz
... | |
##==============================================================================
## Copyright 2013 Samuele Santi
##
## 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.apach... | |
#!/usr/bin/env python
#
# Copyright 2009 Facebook
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... | |
# coding: utf-8
# # Training Regression on wassa data
# In[1]:
emoNames = ['anger','fear','joy','sadness']
# emoNames_hashTag = ['sadness', 'disgust', 'surprise', 'anger', 'fear', 'joy']
# In[2]:
from nltk.tokenize import TweetTokenizer
import nltk.tokenize.casual as casual
from drevicko.twitter_regexes import c... | |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright (c) 2010 OpenStack, LLC.
# Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# ... | |
"""
Test the lldb command line completion mechanism.
"""
import os
from multiprocessing import Process
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbplatform
from lldbsuite.test import lldbutil
class CommandLineCompletionTestCase(TestBase):... | |
# Copyright 2011 Nicholas Bray
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing... | |
#!/usr/bin/env python
import roslib; roslib.load_manifest('hanse_behaviourctrl')
import rospy
import smach
import smach_ros
import signal
import os
import actionlib
from hanse_msgs.msg import sollSpeed, pressure
from std_msgs.msg import Float64, Float32, String
from geometry_msgs.msg import PoseStamped, Point, Twist, V... | |
#!/usr/bin/python
# This is distributed under cc0. See the LICENCE file distributed along with
# this code.
"""
Let's simulate a tor network! We're only going to do enough here
to try out guard selection/replacement algorithms from proposal
259, and some of its likely variants.
"""
import random
from py3hax... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.