text stringlengths 1 927k |
|---|
# coding: utf-8
# In[1]:
import pandas as pd
import matplotlib.pyplot as plt
import matplotlib
from matplotlib.dates import date2num
import datetime
import matplotlib.dates as mdates
import time
import numpy as np
from datetime import date
import matplotlib.lines as mlines
from mpl_toolkits.mplot3d import Axes3D
impo... |
from jsonrpc import ServiceProxy
import sys
import string
# ===== BEGIN USER SETTINGS =====
# if you do not set these you will be prompted for a password for every command
rpcuser = ""
rpcpass = ""
# ====== END USER SETTINGS ======
if rpcpass == "":
access = ServiceProxy("http://127.0.0.1:8332")
else:
access = Ser... |
import logging
import time
from flask import make_response, request
from flask_login import current_user
from flask_restful import abort
from redash import models, settings
from redash.tasks import QueryTask
from redash.permissions import require_permission, not_view_only, has_access, require_access, view_only
from re... |
fname = 0
lname = 1
number = 2
email = 3
def printallcontacts(arraylen, array):
print("")
print("== YOUR CONTACT LIST ==")
print("|")
i1 = 0
# print all names
while i1 < arraylen:
print(f"| {array[fname][i1]} {array[lname][i1]}, {array[number][i1]} {array[email][i1]}")
i1 +... |
"""
ulid/consts
~~~~~~~~~~~
Contains public API constant values.
"""
from . import ulid
__all__ = ['MIN_TIMESTAMP', 'MAX_TIMESTAMP', 'MIN_RANDOMNESS', 'MAX_RANDOMNESS', 'MIN_ULID', 'MAX_ULID']
#: Minimum possible timestamp value (0).
MIN_TIMESTAMP = ulid.Timestamp(b'\x00\x00\x00\x00\x00\x00')
#: Maximu... |
import re
def build_speaker_id(speaker_name):
"""Builds the id of the speaker from its name.
Parameters
----------
speaker_name: str
The name of the speaker.
Returns
-------
speaker_id: str
The id of the speaker.
"""
canonical_name = re.sub(r'\s+', '-', speaker_na... |
#!/usr/bin/env python
#
# OmsAgentForLinux Extension
#
# Copyright 2015 Microsoft Corporation
#
# 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.... |
# Copyright 2016-2018 Dirk Thomas
# Copyright 2018 Mickael Gaillard
# Licensed under the Apache License, Version 2.0
from pathlib import Path
import sys
def test_copyright_licence():
missing = check_files([Path(__file__).parents[1]])
assert not len(missing), \
'In some files no copyright / license li... |
#
# General-purpose Photovoltaic Device Model - a drift diffusion base/Shockley-Read-Hall
# model for 1st, 2nd and 3rd generation solar cells.
# Copyright (C) 2008-2022 Roderick C. I. MacKenzie r.c.i.mackenzie at googlemail.com
#
# https://www.gpvdm.com
#
# This program is free software; you can redist... |
# Be careful modifying this file: line ranges from it are included in docs/jtag/as.rst.
import enum
from bitarray import bitarray
__all__ = ['ATF15xxInstr', 'ATF1502ASDevice', 'ATF1504ASDevice', 'ATF1508ASDevice']
class ATF15xxInstr(enum.IntEnum):
EXTEST = 0x000
SAMPLE = 0x055
... |
# -*- coding: utf-8 -*-
from bs4 import BeautifulSoup
import pandas as pd
# Likely coming from
# https://www.google.com/maps/d/viewer?mid=151Itl_57S7UlpC7P-TdfvT2Pz7Y
class KMLConverter(object):
def __init__(self, filepath):
self.filepath = filepath
self.postes = []
self.parse()
def ... |
import numpy as np
import collections
import time
from pymoab import types
from pymoab import topo_util
from PyTrilinos import Epetra, AztecOO, ML
class StructuredUpscalingMethods:
"""Defines a structured upscaling mesh representation
Parameters
----------
coarse_ratio: List or array of integers
... |
import typing
from django.contrib import admin
from django.db.models import Model, QuerySet
from django.http.request import HttpRequest
from .core import EventApi
from .domain import EventLog, HandlerLog, SyncTask
class InmutableAdminModel(admin.ModelAdmin):
"""Admin model class that disables the
Add and Ed... |
from django.urls import path
from .views import (LoginView, LogoutView, RegisterView, ActivateView, PasswordResetView,
AccountCenterView, OrderListView, AddressView, WishlistView)
app_name = 'account'
urlpatterns = [
path('', AccountCenterView.as_view(), name='center'),
path('order/', Orde... |
# -*- coding: utf-8 -*-
# (c) 2009-2020 Martin Wendt and contributors; see WsgiDAV https://github.com/mar10/wsgidav
# Licensed under the MIT license: http://www.opensource.org/licenses/mit-license.php
"""
Implementation of a WebDAV provider that provides a very basic, read-only
resource layer emulation of a MongoDB dat... |
# Copyright 2019 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 2020-present Kensho Technologies, LLC.
import unittest
from ..serializers.base import BaseIO
from ..serializers.base_serializers import PickleIO, get_base_serializer_map
from ..serializers.registry import SerializerRegistry
class MockSerializer(BaseIO):
@staticmethod
def _deserialize_from_stream(... |
from contextlib import nullcontext
import tempfile
import pytest
import fault as f
import magma as m
from fault.verilator_utils import verilator_version
from .test_property import requires_ncsim
@pytest.mark.parametrize('success_msg', [None, "OK"])
@pytest.mark.parametrize('failure_msg', [None, "FAILED"])
@pytest.ma... |
# -*- coding: utf-8 -*-
"""
Created on 2020.03.02
@author: MiniUFO
Copyright 2018. All rights reserved. Use is subject to license terms.
"""
from xgrads.xgrads import open_CtlDataset, open_mfdataset
import xarray as xr
dset = open_CtlDataset('D:/Data/ULFI/output/2017101712_1721.ctl')
dset.sst[-1].where(dset.sst[-1]!=... |
# coding=utf-8
# *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union
from .. import _utilitie... |
while True:
s = input('Input your Github directory name: ')
if not s.startswith('P'):
print('The name must starts with P !')
continue
name_list = s.split('-')
if len(name_list) != 3:
print('The name must be like P25000-Beijing-Wei !')
continue
if name_list != [x.ca... |
# Copyright 2021 UW-IT, University of Washington
# SPDX-License-Identifier: Apache-2.0
"""
This is the interface for interacting with the UW Libraries Web Service.
"""
from datetime import datetime
from dateutil.parser import parse
import json
from urllib.parse import urlencode
from uw_libraries.dao import MyLib_DAO
... |
# 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... |
#!/usr/bin/env python3
from collections import namedtuple
import json
import os
import sys
Bundle = namedtuple('Bundle' , 'seq ext bundleName totalBytes files')
Diff = namedtuple('Diff', 'status path oldBytes newBytes isBigger diff')
BundleDiff = namedtuple('BundleDiff', 'total files')
class Status:
added ... |
# Generated by Django 4.0 on 2021-12-11 18:41
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('CalendarApp', '0001_initial'),
]
operations = [
migrations.AddField(
model_name='calendar',
name='test',
f... |
#build by mingH 06/12/2016 01:00
import speech_recognition as sr
from datetime import datetime
import pyttsx
import os
import time
import pyowm
import re
#set up the text to speech engine
engine = pyttsx.init()
rate = engine.getProperty('rate')
engine.setProperty('rate', 150)
engine.setProperty('voice', 1)
#openweathe... |
"""
MIT License
Copyright (c) 2019 RookiePC
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, dist... |
###############################################################################################
# mens
###############################################################################################
MENS_CATCH_WEIGHT = 'mens catch weight' # ??.?kg
MENS_STRAWWEIGHT = 'mens strawweight' # 52.5kg
MENS_FLYWEIGHT = '... |
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import csv
import numpy as np
import os
import sys
from observations.util import maybe_download_and_extract
def smoking(path):
"""smoking
A simple data set with only 6 observatio... |
import numpy as np
import matplotlib.pyplot as plt
import cv2
import os
from scipy import signal
from scipy import misc
from motion_blur.generate_PSF import PSF
from motion_blur.generate_trajectory import Trajectory
class BlurImage(object):
def __init__(self, image_path, PSFs=None, part=None, path__to_save=None)... |
import numpy as np
X = np.array([
[-2,4,-1],
[4,1,-1],
[1, 6, -1],
[2, 4, -1],
[6, 2, -1],
])
y = np.array([-1,-1,1,1,1])
def svm_sgd(X, Y):
w = np.zeros(len(X[0]))
eta = 1
epochs = 100000
for epoch in range(1,epochs):
for i, x in enumerate(X):
if (Y[i]*np.d... |
import pyautogui
import random
from time import sleep
sleep(2)
while True:
for i in range(random.randrange(350,450), random.randrange(550,650), 3):
if i > random.randrange(480, 600) and i < random.randrange(548,647):
pyautogui.click(1188, 300)
pyautogui.click(1188, i) |
# MIT License
# Copyright (c) 2020 Simon Schug, João Sacramento
# 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, ... |
from seminars.seminar_oop.employee import Employee
class HRRegistry:
def __init__(self, name: str, location: str):
self.name = name
self.location = location
self.registry = {}
self.counter = 1
def add_employee(self, employee: Employee):
self.registry[self.counter] = em... |
"Parser combinators for pattern-matching Hy model trees."
from collections import namedtuple
from functools import reduce
from itertools import repeat
from math import isinf
from operator import add
from funcparserlib.parser import (
NoParseError,
Parser,
State,
a,
finished,
many,
skip,
... |
from axelrod.action import Action, actions_to_str
from axelrod.player import Player
from axelrod.strategy_transformers import (
FinalTransformer,
TrackHistoryTransformer,
)
C, D = Action.C, Action.D
class TitForTat(Player):
"""
A player starts by cooperating and then mimics the previous action of the... |
from flask import request, Blueprint
from flask_restful import Api, Resource, reqparse
from flask_jwt_extended import jwt_required, get_jwt
from werkzeug import datastructures, utils
import os
import uuid
from .schemas import DocumentsSchema
from ..models import Documents
from config.default import UPLOAD_FOLDER
docu... |
from SuPyModes.Geometry import Geometry, Circle, Fused4
from SuPyModes.Solver import SuPySolver
from SuPyModes.sellmeier import Fused_silica
Clad = Fused4(Radius = 62.5, Fusion = 0.8, Index = Fused_silica(1.55))
Core0 = Circle( Position=Clad.C[0], Radi = 4.2, Index = Fused_silica(1.55)... |
# Copyright 2020 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import annotations
from dataclasses import dataclass
from pants.core.goals.package import OutputPathField
from pants.engine.rules import Get, collect_rules, rule
from pan... |
import unittest
import os
from pkg_resources import resource_filename
import astropy.units as q
from .. import modelgrid as mg
from .. import utilities as u
class TestModelGrid(unittest.TestCase):
"""Tests for the ModelGrid class"""
def setUp(self):
# Make Model class for testing
params = [... |
# Copyright (c) 2019, NVIDIA CORPORATION.
# 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 i... |
import numpy as np
import scipy.signal as spsig
import scipy.interpolate as sinterp
import PIL
import matplotlib.pyplot as plt
import matplotlib as mpl
from matplotlib.colors import ListedColormap, LinearSegmentedColormap
from mpl_toolkits.axes_grid1 import make_axes_locatable
try:
from cv2 import resize, INTER_ARE... |
from rpython.rlib import rgc
from rpython.rlib.objectmodel import we_are_translated, always_inline
from rpython.rlib.rarithmetic import ovfcheck, highest_bit
from rpython.rtyper.lltypesystem import llmemory, lltype, rstr
from rpython.rtyper.annlowlevel import cast_instance_to_gcref
from rpython.jit.metainterp.history i... |
#!/usr/bin/env micropython
import sys
import time
from ev3dev2.button import Button
from time import sleep
from push_blocks import blocks_and_crane
from swing2ramp import swing2ramp
from Traffic_Tree import Traffic_Tree
import os
os.system('setfont Lat15-TerminusBold32x16')
btn = Button()
function_list = [blocks_a... |
from __future__ import absolute_import, print_function
__all__ = ['IntegrationPipeline']
from django.db import IntegrityError
from django.db.models import Q
from django.http import HttpResponse
from django.utils import timezone
from sentry.api.serializers import serialize
from sentry.models import Identity, Identity... |
class Pizza:
def __init__(self, pizza_name: str):
self.name = pizza_name
def __str__(self):
return self.name
class PizzaPlace:
def __init__(self) -> None:
self.pizzas = {}
def get_pizza(self, pizza_name: str) -> Pizza:
if pizza_name not in self.pizzas:
sel... |
'''
Created on 22/08/2016
@author: Gabriel de O. Ramos
'''
from py_expression_eval import Parser
# represents a node in the network
class Node:
def __init__(self, name):
self.name = name # name of the node
# represents an edge in the network
class Edge:
def __init__(self, name, start, end, cost_f... |
import time
import numpy as np
import pandas as pd
from molecules import mol_from_smiles
from molecules import add_property
from molecules import (
add_atom_counts, add_bond_counts, add_ring_counts)
from .config import get_dataset_info
from .filesystem import load_dataset
SCORES = ["validity", "novelty", "unique... |
import os
import typing
import jk_typing
import jk_utils
#import jk_prettyprintobj
from .utils.TreeHelper import TreeHelper
from ._INode import _INode
from .EnumAction import EnumAction
from .FileTypeInfo import FileTypeInfo
from .Context import Context
from .AbstractProcessor import AbstractProcessor
from .utils.Col... |
import utils
from tqdm import tqdm
jfile_texts = lambda jload: [i['section_title'] + ': ' + i['text'] for i in jload]
def find_index(text, target, width=100, find_only=False, lowr=True):
if lowr:
text = utils.clean_text(text)
target = utils.clean_text(target)
if find_only:
return t... |
#!/usr/bin/env python3
# Copyright (c) 2017 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Class for bitcoind node under test"""
import decimal
import errno
import http.client
import json
import log... |
import numpy as np
import pytest
import pyccl as ccl
from pyccl import CCLError, CCLWarning
COSMO = ccl.Cosmology(
Omega_c=0.27, Omega_b=0.045, h=0.67, sigma8=0.8, n_s=0.96,
transfer_function='bbks', matter_power_spectrum='halofit')
COSMO_HM = ccl.Cosmology(
Omega_c=0.27, Omega_b=0.045, h=0.67, sigma8=0.... |
import gzip
import json
import logging
import os
import random
import StringIO
import threading
import time
import helpers.client
import pytest
from helpers.cluster import ClickHouseCluster, ClickHouseInstance
logging.getLogger().setLevel(logging.INFO)
logging.getLogger().addHandler(logging.StreamHandler())
# Creat... |
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------... |
# Copyright 2021 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import annotations
import itertools
import textwrap
from textwrap import dedent
import pytest
from pants.backend.scala.compile.scalac import CompileScalaSourceRequest
fr... |
import numpy as np
import matplotlib
def to_hsv(numb):
hue = np.interp(numb, [0, 1024], [0, 1])
rgb = matplotlib.colors.hsv_to_rgb(np.array([hue, 0.5, 1]))
bgr = rgb[:, :, ::-1] # RGB -> BGR
return np.array(bgr)
def hsv_depth(depth):
depth = to_hsv(depth)
return depth
def pretty_depth(depth)... |
##############################################################################
# Copyright 2019 Rigetti Computing
#
# 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://ww... |
'''
Preprocessing Tranformers Based on sci-kit's API
By Omid Alemi
Created on June 12, 2017
'''
import copy
import pandas as pd
import numpy as np
import transforms3d as t3d
import scipy.ndimage.filters as filters
from sklearn.base import BaseEstimator, TransformerMixin
from analysis.pymo.rotation_tools import Rotat... |
from distutils.core import setup
DEPENDENCIES = [
'python_terraform',
'requests',
'argparse'
]
VERSION = '0.6'
URL = 'https://github.com/deknijf/python-terraform-runner'
setup(
name='python-terraform-runner',
#packages=['tf-runner'],
version=VERSION,
# Chose a license from here: https://h... |
# MIT License
#
# Copyright (c) 2021 Soohwan Kim and Sangchun Ha and Soyoung Cho
#
# 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... |
from .darknet import Darknet
from .detectors_resnet import DetectoRS_ResNet
from .detectors_resnext import DetectoRS_ResNeXt
from .hourglass import HourglassNet
from .hrnet import HRNet
from .regnet import RegNet
from .res2net import Res2Net
from .resnest import ResNeSt
from .resnet import ResNet, ResNetV1d
from .resne... |
"""
Benchmarks on the power iterations phase in randomized SVD.
We test on various synthetic and real datasets the effect of increasing
the number of power iterations in terms of quality of approximation
and running time. A number greater than 0 should help with noisy matrices,
which are characterized by a slow spectr... |
import os
import re
import _import_wrapper as iw
class XsParser(object):
def __init__(self, path, unit):
self._path = path
retargeted = os.path.join(unit.path(), os.path.basename(path))
with open(path, 'rb') as f:
includes, induced = XsParser.parse_includes(f.readlines())
... |
import gd
from starlette.requests import Request
from starlette.responses import JSONResponse, RedirectResponse
from starlette.routing import Mount, Route
from gdrest.levels.level import Level
from auth import auth_client
async def get_level(request: Request):
client = auth_client(request.user)
lid: int = re... |
from sqlalchemy import Column, Integer, DateTime, Text, ForeignKey
from sqlalchemy.orm import relationship
from core.models.base import base
class JobRunLog(base):
__tablename__ = 'job_run_logs'
id = Column(Integer, primary_key=True)
job_run_id = Column(Integer, ForeignKey('job_runs.id', ondelete='CASCA... |
# SPDX-License-Identifier: Apache-2.0
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import numpy as np # type: ignore
import onnx
from ..base import Base
from . import expect
class CumSum(Base):
@staticmeth... |
# Copyright 2013-2021 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class EcpDataVisSdk(BundlePackage):
"""ECP Data & Vis SDK"""
homepage = "https://github.com... |
from regutil.util.timing import * |
from cssselect import GenericTranslator as OriginalGenericTranslator
from cssselect import HTMLTranslator as OriginalHTMLTranslator
from cssselect.xpath import XPathExpr as OriginalXPathExpr
from cssselect.xpath import _unicode_safe_getattr, ExpressionError
from cssselect.parser import FunctionalPseudoElement
class X... |
#!/usr/bin/env python
import argparse
import csv
import itertools
import os
import re
import numpy
import six
from sklearn.model_selection import StratifiedShuffleSplit
class KeyToFilepath(argparse.Action):
"""
Custom argparse action for parsing out positional class-to-filepath
arguments.
"""
re_... |
# Copyright (c) 2020 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 logging
from html import unescape
from typing import Optional
from urllib.parse import quote_plus
from discord import Embed
from discord.ext import commands
from bot.bot import Bot
from bot.constants import Colours
logger = logging.getLogger(__name__)
API_ROOT = "https://realpython.com/search/api/v1/"
ARTIC... |
from json import dumps
from typing import Any, Dict, Optional
from uuid import uuid4
def raise_(err: BaseException) -> BaseException:
raise err # pragma: no cover
class BaseError(Exception):
_id: str
_code: str = 'code'
_title: str = 'title'
_detail: str
_meta: Dict[str, Any]
def __ini... |
# -*- coding: utf-8 -*-
# Copyright (C) 2004-2018 by
# Aric Hagberg <hagberg@lanl.gov>
# Dan Schult <dschult@colgate.edu>
# Pieter Swart <swart@lanl.gov>
# All rights reserved.
# BSD license.
#
# Authors: Aric Hagberg (hagberg@lanl.gov)
# Pieter Swart (swart@lanl.gov)
# Sasha Gutfrai... |
# -*- coding: utf-8 -*-
#
# python-lz4 documentation build configuration file, created by
# sphinx-quickstart on Sat Jun 4 21:29:32 2016.
#
# 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.
#
... |
# coding=utf-8
# *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Dict, List, Mapping, Optional, Tuple, Union
from .. import ... |
import core
from component import Component
import asyncio
class Oneshot(Component):
async def start(self):
core.core.delete_component(self)
await asyncio.sleep(5)
print("End start")
def stop(self):
super().stop()
print("Closed") |
# Copyright 2013-2020 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
import os
class Lua(Package):
"""The Lua programming language interpreter and library."""
h... |
'''
Functions to work with ASEG-GDF format string
Refer to https://www.aseg.org.au/sites/default/files/pdf/ASEG-GDF2-REV4.pdf for further information
Created on 19 Jun. 2018
@author: u76345
'''
import re
import numpy as np
from collections import OrderedDict
from math import ceil, log10
import logging
logger = logg... |
import os
import datetime
import time
from models import checkin, metadata
from sqlalchemy import create_engine, MetaData
# Generates the variables used later
engine = create_engine('sqlite:///checkins.db')
#TODO: get the name associated with cardnumber from API
def returnName(numb):
#Temp name until API is in place... |
"""
Simple utils to save and load from disk.
"""
from __future__ import print_function
from __future__ import division
from __future__ import unicode_literals
# TODO(rbharath): Use standard joblib once old-data has been regenerated.
import joblib
from sklearn.externals import joblib as old_joblib
import gzip
import js... |
from functools import partial
# 偏函数(functools.partial)
def add(*args, **kwargs):
# 打印位置参数
for n in args:
print(n)
print("-" * 20)
# 打印关键字参数
for k, v in kwargs.items():
print('%s:%s' % (k, v))
add_partial = partial(add, 10, k1=10, k2=20)
if __name__ == '__main__':
# add(1, 2... |
MODE='NotTesting'
DEBUG=True
if MODE == 'Testing':
# For MacOS, this fixes an issue where you can't reach other endpoints on localhost
MYSQL_HOST='host.docker.internal'
BASE_URL='host.docker.internal'
else:
MYSQL_HOST='localhost'
BASE_URL='localhost'
MYSQL_PORT='3306'
MYSQL_USER="root"
MYSQL_PASSW... |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.13 on 2018-06-30 04:48
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('action', '0023_set_content_and_columns'),
]
operations = [
migrations.RenameField(... |
# -*- coding: utf-8 -*-
# pragma pylint: disable=unused-argument, no-self-use
"""Function implementation"""
import logging
from pymisp import PyMISP
from resilient_circuits import ResilientComponent, function, handler, StatusMessage, FunctionResult, FunctionError
PACKAGE= "fn_misp"
class FunctionComponent(ResilientC... |
#!/usr/bin/env python3
# Copyright (c) 2014-2016 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 for -rpcbind, as well as -rpcallowip and -rpcconnect
# TODO extend this test from the test framew... |
from discord import DiscordException
class ApplicationCommandError(DiscordException):
"""
The base exception type for all slash-command related errors.
This inherits from :exc:`discord.DiscordException`.
This exception and exceptions inherited from it are handled
in a special way as they are cau... |
import pika
import os
URL_RABBIT = os.getenv('URL_RABBIT')
connection = pika.BlockingConnection(pika.ConnectionParameters(URL_RABBIT))
channel = connection.channel()
channel.queue_declare(queue='hello')
channel.basic_publish(exchange='',
routing_key='hello',
body='Hello W... |
"""Unit test for treadmill.sproc.metrics"""
import unittest
# the point of this file is to check at least the syntax
from treadmill.sproc import metrics # noqa: F401
class MetricsTest(unittest.TestCase):
"""Test treadmill.sproc.metrics"""
pass
if __name__ == '__main__':
unittest.main() |
"""
Copyright 2017 Steven Diamond
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... |
dataset_type = 'CocoDataset'
data_root = 'data/coco/'
img_norm_cfg = dict(
mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375], to_rgb=True)
train_pipeline = [
dict(type='LoadImageFromFile'),
dict(type='LoadAnnotations', with_bbox=True, with_mask=True),
dict(type='Resize', img_scale=(1333, 800),... |
# coding: utf-8
"""
Pure Storage FlashBlade REST 1.9 Python SDK
Pure Storage FlashBlade REST 1.9 Python SDK. Compatible with REST API versions 1.0 - 1.9. Developed by [Pure Storage, Inc](http://www.purestorage.com/). Documentations can be found at [purity-fb.readthedocs.io](http://purity-fb.readthedocs.io/).
... |
# -*- coding: utf-8 -*-
"""API view decorators for response headers"""
from __future__ import unicode_literals
from h.views.api import API_VERSION_DEFAULT
from h.views.api.helpers.media_types import media_type_for_version, version_media_types
def version_media_type_header(wrapped):
"""View decorator to add resp... |
import telebot
from telebot.apihelper import ApiTelegramException
from blackbox.handlers.notifiers._base import BlackboxNotifier
from blackbox.utils.logger import log
STRING_LIMIT = 2000 # Limit output
CHECKMARK_EMOJI = "\U00002705" # ✔
FAIL_EMOJI = "\U0000274C" # ❌
WARNING_EMOJI = "\U000026A0" # ⚠
clas... |
'''
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 this ... |
# import the necessary packages
from imutils import face_utils
import numpy as np
import argparse
import imutils
import dlib
import cv2
#python facial_landmarks.py --shape-predictor shape_predictor_68_face_landmarks.dat --image test1.jpg
def rect_to_bb(rect):
# take a bounding predicted by dlib and convert it
# to the ... |
# Copyright (C) 2019 The Raphielscape Company LLC.
#
# Licensed under the Raphielscape Public License, Version 1.d (the "License");
# you may not use this file except in compliance with the License.
#
""" Userbot module containing commands related to android"""
import asyncio
import json
import re
import os
import tim... |
from flask import Flask
from database import register_db
from flask_bootstrap import Bootstrap
from flask_debug import Debug
from flask_session import Session
from nav import nav
from bundle import apply_assets
app = Flask(__name__)
app.config.from_object('config.DevConfig')
session = Session(app)
register_db(app, app... |
# These functions process and produce names for IQ data files using the
# following format:
# <descriptive text>_c<center frequency>_s<sample rate>.iq
#
# both the center frequency and the sample rate must be expressed in
# with gnuradio (eng_option) suffixes:
# k = 10^3
# M = 10^6
# G = 10^9
#
# Example: a file named ... |
# -*- coding: utf-8 -*-
"""
sphinx.ext.autosummary
~~~~~~~~~~~~~~~~~~~~~~
Sphinx extension that adds an autosummary:: directive, which can be
used to generate function/method/attribute/etc. summary lists, similar
to those output eg. by Epydoc and other API doc generation tools.
An :autolink: r... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.