src stringlengths 721 1.04M |
|---|
# -*- coding: utf-8 -*-
# MySQL Connector/Python - MySQL driver written in Python.
# Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
# MySQL Connector/Python is licensed under the terms of the GPLv2
# <http://www.gnu.org/licenses/old-licenses/gpl-2.0.html>, like most
# MySQL Connectors. There a... |
# -*- encoding: utf-8 -*-
import bz2
import os
import sqlite3
import requests
from flask_script import Command, Option
from lazyblacksmith.models import db
from lbcmd.importer import Importer
class SdeImport(Command):
"""
Manage SDE Data in lazyblacksmith.
If all flags are specified, "clear" action is ... |
"""Wavelength Solution is a task describing the functional form for transforming
pixel position to wavelength. The inputs for this task are the given pixel position
and the corresponding wavelength. The user selects an input functional form and
order for that form. The task then calculates the coefficients for that ... |
#!/usr/bin/env python
"""
Dummy Subsystem for Testing Purposes
(C) 2008-2009 Michael 'Mickey' Lauer <mlauer@vanille-media.de>
(C) 2008 Openmoko, Inc.
GPLv2 or later
Package: testing
Module: testing
"""
MODULE_NAME = "testing"
__version__ = "0.0.0"
from framework import resource
import dbus
import dbus.service
impo... |
"""
Timothy James Lang
tjlangco@gmail.com
Last Updated 04 September 2015 (Python 2.7/3.4)
Last Updated 26 July 2005 (IDL)
csu_kdp v1.4
Change Log
----------
v1.4 Major Changes (09/04/2015):
1. Added window keyword to enable stretching the FIR window (e.g.,
use a 21-pt filter over 5 km with 250-m gate spacing
2. F... |
"""
===============================================================
Customized sampler to implement an outlier rejections estimator
===============================================================
This example illustrates the use of a custom sampler to implement an outlier
rejections estimator. It can be used easily wi... |
# -*- coding: utf-8 -*-
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... |
# coding: utf-8
from __future__ import unicode_literals
import re
from .common import InfoExtractor
from ..compat import compat_str
from ..utils import (
ExtractorError,
unified_strdate,
HEADRequest,
int_or_none,
)
class WatIE(InfoExtractor):
_VALID_URL = r'(?:wat:|https?://(?:www\.)?wat\.tv/video/.*-)(?P<id>[... |
#!/usr/bin/env python
from settings import *
import os.path, Tkinter, tkFont, tkFileDialog
import taxonutils
class TaxonLinker():
def __init__(self,root):
self.taxondict = DICTIONARY_FILE
self.nameslist = []
self.results = []
self.dictload = False
self.nmload = False
# options and ... |
#!/usr/bin/env python
"""Extract photos from all .VCF files in a given directory."""
import sys
import argparse
import os.path
import vobject
def process_vcf_file(pathname):
"""Process a VCF file (or all in a directory)."""
outfname = os.path.splitext(pathname)[0]
with open(pathname, 'r') as vcf_file:
... |
#!/usr/bin/env python
# Read in a WAV and find the freq's
import wave
import sys
import numpy as np
import matplotlib.pyplot as plt
chunk = 2048
# open up a wave
wf = wave.open(sys.argv[1], 'rb')
swidth = wf.getsampwidth()
RATE = wf.getframerate()
# use a Blackman window
window = np.blackman(chunk)
# read som... |
#!/usr/bin/env python
import argparse
import sys
import yaml
import rospy
import rospkg
from uav_abstraction_layer.srv import TakeOff, GoToWaypoint, Land
from geometry_msgs.msg import PoseStamped
def track_waypoints():
# Parse arguments
parser = argparse.ArgumentParser(description='Track waypoints defined in a... |
# coding=utf-8
import vdebug.log
import vdebug.opts
import vim
import re
class Dispatcher:
def __init__(self,runner):
self.runner = runner
def visual_eval(self):
if self.runner.is_alive():
event = VisualEvalEvent()
return event.execute(self.runner)
def eval_under_c... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""
PyQt4 DDC/CI GUI, python-ddcci example
"""
import sys
import ddcci
import os
from PyQt4 import QtGui, QtCore
from PyKDE4.kdeui import KStatusNotifierItem
script_path = os.path.dirname(os.path.realpath(os.path.abspath(__file__)))
assets_path = os.path.join(script_path, 'a... |
import unittest
import numpy as np
from empirical.quadrature import *
def function(x):
return x * np.sin(30 * x) + np.cos(5 * x)
def function_integral(x):
return (-(1 / 30) * x * np.cos(30 * x) +
(1 / 5) * np.sin(5 * x) +
(1 / 900) * np.sin(30 * x))
integration_value = function_inte... |
#!/usr/bin/env python
import sys, re
# Packet class
class Packet(object):
def __init__(self):
# These data types are taken directly from the APRS spec at http://aprs.org/doc/APRS101.PDF
# This is not an exhaustive list. These are the most common ones, and were added during
# testing.
self._data_typ... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Licensed under the GNU LGPL v2.1 - http://www.gnu.org/licenses/lgpl.html
"""
Text corpora usually reside on disk, as text files in one format or another
In a common scenario, we need to build a dictionary (a `word->integer id`
mapping), which is then used to construct ... |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2012 OpenStack Foundation
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apach... |
#!/usr/bin/env python
"""A Storage SCU application.
Used for transferring DICOM SOP Instances to a Storage SCP.
"""
import argparse
import os
from pathlib import Path
import sys
from pydicom import dcmread
from pydicom.errors import InvalidDicomError
from pydicom.uid import (
ExplicitVRLittleEndian, ImplicitVRLi... |
# This software is licensed under the GNU Affero General Public License
# version 3 (see the file LICENSE).
import itertools
import os
import pwd
import threading
import urllib
import urllib2
import webbrowser
import sublime
import sublime_plugin
class UserInterface(object):
"""User interface for this plugin.""... |
# Copyright 2013-2014 Massachusetts Open Cloud Contributors
#
# 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 sys
import inspect
import os.path
import babel.support
import gettext
import jinja2
import filters# TODO get rid of this circular dependency
class TemplateLoader(jinja2.loaders.BaseLoader):
def __init__(self, src_path):
self.src_path = os.path.abspath(src_path)
self.aliases = {}
def ad... |
'''
*
* Copyright [2011] [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 ag... |
from PythonConfluenceAPI import ConfluenceAPI
import Configuration
import CustomModules.SQL_Connector
from Configuration import MySQLConfig, MediaWIKIConfig
from Migration_to_xWiki.Users_association import Users
from CustomModules import Mechanics
from CustomModules.Mechanics import XWikiClient, MysqlConnector, Migrat... |
import warnings
import numpy as np
from numpy import linalg as la, random as rnd
from scipy.linalg import expm
# Workaround for SciPy bug: https://github.com/scipy/scipy/pull/8082
try:
from scipy.linalg import solve_continuous_lyapunov as lyap
except ImportError:
from scipy.linalg import solve_lyapunov as lyap... |
# -*- coding: utf8 -*-
#
# Copyright (C) 2014 NDP Systèmes (<http://www.ndp-systemes.fr>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License,... |
import requests
from flask import request, redirect, url_for, current_app, Response
from whyis.blueprint.sparql import sparql_blueprint
from whyis.decorator import conditional_login_required
@sparql_blueprint.route('/sparql', methods=['GET', 'POST'])
@conditional_login_required
def sparql_view():
has_query = Fal... |
from numpy import asarray, array, sqrt
from uncertainties import unumpy, ufloat
def linfit(x_true, y, sigmay=None, relsigma=True, cov=False, chisq=False, residuals=False):
"""
Least squares linear fit.
Fit a straight line `f(x_true) = a + bx` to points `(x_true, y)`. Returns
coefficients `a` an... |
__license__ = '''
This file is part of Dominate.
Dominate 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 3 of
the License, or (at your option) any later version.
Dominate is distributed in... |
# -*- coding: utf-8 -*-
from django.conf import settings
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [migrations.swappable_dependency(settings.AUTH_USER_MODEL), ('auth', '__first__')]
operations = [
migrations.CreateModel(
name='EighthA... |
# -*- coding: utf-8 -*-
# wrapper.py
# Copyright (C) 2016 LEAP
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Thi... |
import os
os.environ['DJANGO_SETTINGS_MODULE']='settings'
import webapp2 as webapp
from google.appengine.ext.webapp.util import run_wsgi_app
from google.appengine.ext.webapp import template
import numpy as np
import cgi
import cgitb
cgitb.enable()
class yulefurryQaqcPage(webapp.RequestHandler):
de... |
# Licensed under a 3-clause BSD style license - see LICENSE.rst
from __future__ import (absolute_import, division, print_function,
unicode_literals)
import numpy as np
from ..nduncertainty_var import VarianceUncertainty
from ..nduncertainty_stddev import StdDevUncertainty
from ...utils.numbau... |
# 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 unicode_literals
from __... |
# :coding: utf-8
"""Parser to fetch_environment all information from a :term:`Javascript` API in order
to document each element from a simple identifier.
"""
import os
from .js_module import fetch_environment as fetch_module_environment
from .js_file import fetch_environment as fetch_file_environment
def fetch_env... |
"""
Module designed to route messages based on strategy pattern.
This module includes class mapper tuple to correlate received from telegram
user command with target command class to run. Additionally, this module
generates help message based on command list.
"""
from typing import Any, Dict
from .co... |
"""Support for restoring entity states on startup."""
import asyncio
import logging
from datetime import timedelta, datetime
from typing import Any, Dict, List, Set, Optional # noqa pylint_disable=unused-import
from homeassistant.core import (
HomeAssistant,
callback,
State,
CoreState,
valid_enti... |
#!/usr/bin/python
#
# Copyright (C) 2010, 2012, 2013 Google Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# ... |
import tarfile
import os
import posixpath
from pathlib import Path
from kubeflow.fairing.preprocessors.converted_notebook import ConvertNotebookPreprocessor
from kubeflow.fairing.preprocessors.converted_notebook import ConvertNotebookPreprocessorWithFire
from kubeflow.fairing.preprocessors.converted_notebook import Fi... |
# -*- coding: utf-8 -*-
import copy
import nose.tools as nt
from IPython.nbformat import validate
from .. import convert
from . import nbexamples
from IPython.nbformat.v3.tests import nbexamples as v3examples
from IPython.nbformat import v3, v4
def test_upgrade_notebook():
nb03 = copy.deepcopy(v3examples.nb0)
... |
import pdb
import posixpath
import re
import os
try:
from urllib.parse import unquote
except ImportError: # Python 2
from urllib import unquote
from exceptions import Exception
from django.core.files import File
from django.core.files.storage import DefaultStorage
from django.core.urlresolvers import rever... |
#!/usr/bin/env python2
"""
simple_hash.py
Generates a hash using the "simple" method outlined on:
http://www.hackerfactor.com/blog/index.php?/archives/432-Looks-Like-It.html
:author: Brandon Arrendondo
:author: James Jenkins
:license: MIT
"""
import sys
import argparse
import numpy
import glo... |
import numpy as np
def iou(box_1, box_2):
box_1_ulx = box_1[0] - box_1[2] * 0.5
box_1_uly = box_1[1] - box_1[3] * 0.5
box_1_lrx = box_1[0] + box_1[2] * 0.5
box_1_lry = box_1[1] + box_1[3] * 0.5
box_2_ulx = box_2[0] - box_2[2] * 0.5
box_2_uly = box_2[1] - box_2[3] * 0.5
box_2_lrx = box_2[... |
# coding: utf-8
"""
An API to insert and retrieve metadata on cloud artifacts.
No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) # noqa: E501
OpenAPI spec version: v1alpha1
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
... |
from office365.sharepoint.publishing.primary_city_time import PrimaryCityTime
from office365.sharepoint.publishing.site_page_metadata_collection import SitePageMetadataCollection
from office365.sharepoint.publishing.site_page_service import SitePageService
from office365.sharepoint.publishing.video_service_discoverer i... |
"""
HOW THIS WORKS:
1. Message objects are created via /dashboard/messages. Message objects have a string indicating their audience (e.g. all registered hackers, all checked-in, mailing list people, teammates listed on people's applications)
2. Message.enqueue_tasks() enqueues a bunch of Tas objects in the `messages` q... |
import os as _os
on_rtd = _os.environ.get('READTHEDOCS', None) == 'True'
if not on_rtd:
import matplotlib.pyplot as _plt
from matplotlib import gridspec as _gridspec
def setup_figure(rows=1, cols=1, **kwargs):
"""
Sets up a figure with a number of rows (*rows*) and columns (*cols*), *\*\*kwargs* passe... |
from django.contrib.auth.models import BaseUserManager
class UserManager(BaseUserManager):
use_in_migrations = True
def _create_user(self, username, email, password, **extra_fields):
"""
Creates and saves a User with the given username, email and password.
"""
if not username:... |
# Roulette.py was created by Redjumpman for Redbot
# This will create a rrgame.JSON file and a data folder
import os
import random
import asyncio
from time import gmtime, strftime
from discord.ext import commands
from .utils.dataIO import dataIO
from .utils import checks
from __main__ import send_cmd_help
... |
# Copyright 2011 Grid Dynamics
# 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... |
from django.db import models
from json_field import JSONField
SMALL = 'S'
MEDIUM = 'M'
LARGE = 'L'
XLARGE = 'XL'
ITEM_SIZE_CHOICES = (
(SMALL, 'Small (S)'),
(MEDIUM, 'Medium (M)'),
(LARGE, 'Large (L)'),
(XLARGE, 'Extra Large (XL)'),
)
class StoreItem(models.Model):
name = models.C... |
#!/usr/bin/env python
#
# Electrum - lightweight Bitcoin client
# Copyright (C) 2014 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 without... |
# Copyright (c) 2018 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 appli... |
import time
import logging
import tornado.ioloop
class Client(object):
def __init__(self):
tornado.ioloop.PeriodicCallback(self._check_last_recv_timestamps, 60 * 1000).start()
def _on_connection_identify(self, conn, data, **kwargs):
logging.info('[%s:%s] IDENTIFY sent %r' % (conn.id, self.na... |
# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... |
import os
from casacore.images import image as casa_image
from PIL import Image
import subprocess
import time
import monotonic
import logging
import atexit
logger = logging.getLogger(__name__)
FPS = 25
cmd = ["ffmpeg",
# for ffmpeg always first set input then output
# silent audio
'-f', 'lavfi'... |
#!/usr/bin/env python
"""Mechanical Turk-related utilities, written by Neeraj Kumar.
Licensed under the 3-clause BSD License:
Copyright (c) 2013, Neeraj Kumar (neerajkumar.org)
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the follow... |
from __future__ import absolute_import, print_function
import BaseHTTPServer
import SimpleHTTPServer
import base64
import io
import json
import threading
import time
import hashlib
import os
import sys
import urllib2
from decimal import Decimal
from optparse import OptionParser
from twisted.internet import reactor
... |
# coding=utf-8
import os
import sys
from datetime import datetime
sys.path.append('gen-py')
sys.path.append('/usr/lib/python2.7/site-packages')
from flask_sqlalchemy import SQLAlchemy
from app import app
from models import PasteFile as BasePasteFile
from utils import get_file_md5
db = SQLAlchemy(app)
from thrift.t... |
import socket
import sqlite3
class Plugin:
def __init__(self, parser, sqlitecur):
self._cursor = sqlitecur
self._cursor.execute("CREATE TABLE IF NOT EXISTS IPs(Id INT, Name TEXT, IP TEXT, MUC TEXT)")
parser.registerCommand([(u"ip", ), (u"list", "List all registered IPs", self._list)])
... |
#!/usr/bin/python3
import boto3
import argparse
import pprint
import sys
##############################################################################
def debug(args):
print('Cluster Name: {}'.format(args.cluster))
print('Service Name: {}'.format(args.service))
print('Image Version: {}'.format(args.imag... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import copy
import re
from collections import MutableMapping
from six import iteritems, itervalues
from werkzeug import cached_property
from flask.ext.restful import abort
from jsonschema import Draft4Validator
from jsonschema.exceptions import Validat... |
# Standard Library
import boto
import re
import datetime
import json
import time
import uuid
# Third Party
import pymysql
import mixingboard
from ..database import Base
from ..aws import getIAMConn, getEC2Conn, getMasterCredentials, getS3Conn
from sqlalchemy import Column, Integer, String, DateTime
from sqlalchemy.orm... |
import os
import pytest
import numpy as np
import mbuild as mb
from mbuild.exceptions import MBuildError
from mbuild.tests.base_test import BaseTest
class TestPacking(BaseTest):
def test_fill_box(self, h2o):
filled = mb.fill_box(h2o, n_compounds=50, box=[2, 2, 2, 4, 4, 4])
assert filled.n_partic... |
#
# __init__.py
# Copyright (C) orion 2011 <luca.barbara@live.com>
#
# PyFbGraph 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.
#
# ... |
#!/usr/bin/python
# Copyright (C) CITC, Communications and Information Technology Commission,
# Kingdom of Saudi Arabia.
#
# Developed by CITC Tunnel Broker team, tunnelbroker@citc.gov.sa.
#
# This software is released to public domain under GNU General Public License
# version 2, June 1991 or any later. Please... |
"""
Tests to verify correct number of MongoDB calls during course import/export and traversal
when using the Split modulestore.
"""
from tempfile import mkdtemp
from shutil import rmtree
from unittest import TestCase, skip
import ddt
from xmodule.modulestore.xml_importer import import_from_xml
from xmodule.modulestor... |
# -*- coding: utf-8 -*-
#
# blogtool documentation build configuration file, created by
# sphinx-quickstart on Thu Mar 21 11:36:34 2013.
#
# This file is execfile()d with the current directory set to its containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
# Al... |
# -*- coding: utf-8 -*-
import networkx as nx
def get_all_cycles(breakpoint_graph):
visited = set()
cycles = []
for vertex in breakpoint_graph.nodes():
if vertex in visited:
continue
try:
cycle = nx.find_cycle(breakpoint_graph.bg, vertex)
new = False
... |
#!/usr/bin/env python
# Copyright (C) 2006-2016 Music Technology Group - Universitat Pompeu Fabra
#
# This file is part of Essentia
#
# Essentia 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 ... |
# -*- mode: python; coding: utf-8 -*-
# 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 use, copy, modify, merge, publish,
# d... |
import vcf
#
# Simple method to count the number of records in a
# VCF file. This is useful for providing progress on
# very large runs.
#
def count_vcf_records(fname):
return len([rec for rec in vcf.Reader(filename=fname)])
#
# Represents the placement of a read within an
# assembly or mapping.
#
class ReadPlac... |
#
# Copyright 2015 eNovance
#
# 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
# vim: ts=4:sw=4:expandtab
# BleachBit
# Copyright (C) 2008-2016 Andrew Ziem
# https://www.bleachbit.org
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3... |
import random
import pygame
from behaviours.Behaviour import Behaviour
from behaviours.Collide import Collide
from src.GameMethods import GameMethods
class Jump(Behaviour):
def __init__(self, jump_velocity=10, jump_key=None):
self.jump_velocity = jump_velocity
self.can_jump = False
self.... |
from flask import request, url_for
from userv.encyclopedia.models import Fact
from pprint import pprint
from datetime import datetime, timezone
import arrow
import json
def test_factoids_all_one(session, db,app, client):
now = datetime.now(timezone.utc)
anow = arrow.get(now)
f = Fact(id=1, name='foo', a... |
import json
from base64 import b64decode
from datetime import datetime
from unittest import TestCase
import mock
from hvac import Client
class TestAwsIamMethods(TestCase):
"""Unit tests providing coverage for AWS (EC2) auth backend-related methods/routes."""
@mock.patch('hvac.aws_utils.datetime')
@mock... |
from collections import defaultdict, deque
import datetime
import errno
import os
import time
import torch
import torch.distributed as dist
class SmoothedValue(object):
"""Track a series of values and provide access to smoothed values over a
window or the global series average.
"""
def __init__(self... |
#!/usr/bin/env python
import corr,time,numpy,struct,sys,logging,pylab,matplotlib
import mad_conf_parse
import os
config_file='.'
fpga = []
def exit_fail():
print 'FAILURE DETECTED. Log entries:\n',lh.printMessages()
try:
fpga.stop()
except: pass
raise
exit()
def exit_clean():
try:
... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# vim: expandtab:tabstop=4:shiftwidth=4
# pylint: disable=no-name-in-module, import-error, wrong-import-order, ungrouped-imports
"""
Custom filters for use in openshift-ansible
"""
import os
import pdb
import pkg_resources
import re
import json
import yaml
import random
from a... |
# Copyright 2020 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... |
#constraint: list_of_ints will always have at least 3 integers
#can have negative numbers
def highest_product_three_ints(list_of_ints):
biggest_int = max(list_of_ints)
list_of_ints.remove(biggest_int)
max_int1 = max(list_of_ints)
list_of_ints.remove(max_int1)
max_int2 = max(list_of_ints)
list_... |
"""Support for VeSync switches."""
import logging
from homeassistant.components.switch import SwitchEntity
from homeassistant.core import callback
from homeassistant.helpers.dispatcher import async_dispatcher_connect
from .common import VeSyncDevice
from .const import DOMAIN, VS_DISCOVERY, VS_DISPATCHERS, VS_SWITCHES... |
#!/usr/bin/env python
#
# Copyright (c) 2013, Digium, Inc.
#
import unittest
import swaggerpy
from swaggerpy import swagger_model
class TestProcessor(swagger_model.SwaggerProcessor):
def process_resource_listing(self, resources, context):
resources['processed'] = True
class LoaderTest(unittest.TestCa... |
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,... |
import pandas as pd
import numpy as np
import os
import wx
import threading
import time
def processMG(arg1):
if arg1 == None:
return float(0)
elif 'm' in arg1:
return float(arg1[:-1])*1048576
elif 'g' in arg1:
return float(arg1[:-1])*1048576*1024
else:
return float(arg1)... |
import re
from wsgifire.helpers import func_from_str
from wsgifire.core.helpers import permanent_redirect
from wsgifire.exceptions import NoMatchingURL, ViewFunctionDoesNotExist
def dispatcher(request, url_seq):
"""
Match the requested url against patterns defined in settings.URLS and
return the resulting ... |
"""
Module for a subscription object, which manages a podcast URL, name, and information about how
many episodes of the podcast we have.
"""
import collections
import datetime
import enum
import logging
import os
import platform
import time
from typing import Any, Dict, List, Mapping, Optional, Tuple, MutableSequence
... |
from __future__ import absolute_import
import warnings
from contextlib import contextmanager
import six
from funcy import decorator, identity, memoize, LazyObject
import redis
from redis.sentinel import Sentinel
from .conf import settings
if settings.CACHEOPS_DEGRADE_ON_FAILURE:
@decorator
def handle_connect... |
import os
from optparse import make_option
class Variable(object):
def __init__(self, name, default=None, environ=None, help=None,
metavar=None, prompt=None):
self.name = name
if environ:
self.default = os.environ.get(environ, default)
else:
self.d... |
import numpy as np
import matplotlib
import matplotlib.pyplot as plt
import matplotlib.animation as animation
import random
import time
def maxsubsumOn(vector):
max_ending_here = max_so_far = vector[0]
for x in vector[1:]:
max_ending_here = max(x, max_ending_here + x)
max_so_far = max(max_so_f... |
from __future__ import print_function, absolute_import, division
from future.builtins import *
from future import standard_library
standard_library.install_aliases()
# Copyright 2017 Autodesk Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with ... |
#!/usr/bin/env python
# Copyright 2013 Hewlett-Packard Development Company, L.P.
# 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.or... |
# -*- coding: utf-8 -*-
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... |
# Copyright (c) 2016-2019 The University of Manchester
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This progra... |
from django.db import models
import datetime
class Category(models.Model):
title = models.CharField(max_length=250, help_text='Maximum 250 characters')
slug = models.SlugField()
description = models.TextField()
class Meta:
ordering = ['title']
verbose_name_plural = "Categories"
class Admin:
pass
#TO... |
# -*- coding: utf-8 -*-
""" helper functions for time management
"""
import math
def sin(x):
return math.sin(math.radians(x))
def cos(x):
return math.cos(math.radians(x))
def atan2(y , x):
return math.degrees(math.atan2(y, x))
def reduce360(x):
return x % 360.0
def dms2ddd(hour, minute, second):
"""... |
# Plot error surface for linear regression model.
# Based on https://github.com/probml/pmtk3/blob/master/demos/contoursSSEdemo.m
import numpy as np
import matplotlib.pyplot as plt
import os
figdir = os.path.join(os.environ["PYPROBML"], "figures")
def save_fig(fname): plt.savefig(os.path.join(figdir, fname))
from mpl_... |
# -*- coding: utf-8 -*-
# TODO: test do_until_success function
from gevent import monkey
monkey.patch_all()
import logging
from mock import MagicMock, call
import pytest
from openprocurement.auction.databridge import AuctionsDataBridge
from openprocurement.auction.utils import FeedItem
from openprocurement.auction.tes... |
# this file is only used for continuous evaluation test!
import os
import sys
sys.path.append(os.environ['ceroot'])
from kpi import CostKpi, DurationKpi, AccKpi
# NOTE kpi.py should shared in models in some way!!!!
train_cost_kpi = CostKpi('train_cost', 0.05, 0, actived=True)
test_acc_kpi = AccKpi('test_acc', 0.005,... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.