text stringlengths 1 927k |
|---|
from pydantic_cli.examples.simple_with_boolean_custom import Options, example_runner
from . import _TestHarness, HarnessConfig
class TestExamples(_TestHarness[Options]):
CONFIG = HarnessConfig(Options, example_runner)
def test_simple_01(self):
self.run_config(
[
"--input_... |
from twindb_backup.configuration import TwinDBBackupConfig
def test_azure(config_file):
tbc = TwinDBBackupConfig(config_file=str(config_file))
assert tbc.azure.azure_access_key == 'XXXXX'
assert tbc.azure.azure_account == 'YYYYY'
assert tbc.azure.endpoint == 'core.windows.net'
assert tbc.azure.buc... |
import logging
import time
import sys
import os
import numpy as np
from multiprocessing import Pool, cpu_count
import random
import string
from tensors import *
import pickle
import tvm
import topi
from topi.testing import conv2d_nchw_python
from tvm import te
from tvm import autotvm
from tvm.autotvm.tuner import XGB... |
import sys
import os
import string
import copy
from string import Template
sys.path.append(os.path.join(os.path.dirname(__file__), os.pardir))
import utils
import arbiter
import gen_top
import verilog_utils as vutils
import module_builder as mb
import sim_utils as sutils
from gen import Gen
class GenSimTop(Gen):
... |
# Licensed to the StackStorm, Inc ('StackStorm') 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 th... |
"""Test the LinearBlockGS linear solver class."""
import unittest
import numpy as np
import openmdao.api as om
from openmdao.solvers.linear.tests.linear_test_base import LinearSolverTests
from openmdao.test_suite.components.sellar import SellarImplicitDis1, SellarImplicitDis2, \
SellarDis1withDerivatives, Sellar... |
#!/usr/bin/env python
from __future__ import print_function
import sys
from Configuration.PyReleaseValidation.MatrixReader import MatrixReader
from Configuration.PyReleaseValidation.MatrixRunner import MatrixRunner
from Configuration.PyReleaseValidation.MatrixInjector import MatrixInjector,performInjectionOptionTest
... |
"""Stripping the python 3.6 type hints for backwards compatibility."""
import os
import sys
if sys.version_info.major < 3 or (sys.version_info.major == 3 and sys.version_info.minor < 6):
from strip_hints import strip_on_import
strip_on_import(__file__, to_empty=False, no_ast=False, no_colon_move=False,
... |
#!/usr/bin/env python3
# Copyright (c) 2019 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test bitcornd aborts if can't disconnect a block.
- Start a single node and generate 3 blocks.
- Delete the... |
from ..bright import doimaker
__author__ = "Gareth Murphy"
__credits__ = ["Gareth Murphy"]
__license__ = "GPL"
__version__ = "1.0.1"
__maintainer__ = "Gareth Murphy"
__email__ = "garethcmurphy@gmail.com"
__status__ = "Development"
def test_doi():
bright = doimaker.DOIMaker()
assert isinstance(bright.passw, s... |
#!/usr/bin/python
from mechanize import Browser
from bs4 import BeautifulSoup
import json, sys, re
b = Browser()
b.set_handle_robots(False)
b.set_handle_refresh(False)
b.addheaders = [('User-agent', 'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; Windows Phone 6.5.3.5)')] # Facebook still supports Windows Phone 6... |
# Copyright (c) 2012-2016 Seafile Ltd.
# -*- coding: utf-8 -*-
import datetime
import os
import json
import logging
from django.urls import reverse
from django.db import models
from django.conf import settings
from django.forms import ModelForm, Textarea
from django.utils.html import escape
from django.utils.translati... |
#!/usr/bin/env python3
import os
import logging
import sys
import json
from pathlib import Path
logger = logging.getLogger(__name__)
logging.basicConfig(level=logging.DEBUG)
#::for i in **/*\'* ; do mv -v "$i" "${i//\'/}" ; done
def find_files(path: str, substring: str) -> []:
"""Find files in directory matchi... |
from flask_wtf import FlaskForm
from flask_wtf.file import FileField, FileAllowed
from wtforms import StringField, PasswordField, SubmitField, BooleanField
from wtforms.validators import (DataRequired, Length, EqualTo, Email,
ValidationError)
from flask_login import current_user
from fl... |
import math
import requests
import json
import os
# Author: Michael Woods
# Home Page: https://github.com/vgm64/gmplot
# Keywords: python wrapper google maps
# License: MIT
# Package Index Owner: Michael.Woods
class GoogleMapPlotter(object):
def __init__(self, center_lat, center_lng, zoom):
self.center = (float... |
from .._discrete_distribution import DiscreteDistribution
from ...util import ParameterError,ParameterWarning
import warnings
from ..c_lib import c_lib
import ctypes
from numpy import *
class Korobov(DiscreteDistribution):
"""
Quasi-Random Korobov nets.
>>> k = Korobov(2,generator=[1,3],seed=7)
>... |
name = "potty"
from krux.types.check import is_integer
from .client_pool import ClientPool
__all__ = [
'connect',
'new_session', 'ls_sessions', 'gcs', 'scs',
'ns', 'lss', 'gcs', 'scs',
'ls', 'cd', 'select',
'fetch',
]
_pot_client_pool = ClientPool()
_pot_session_pool = None
_pot_current_session =... |
# Copyright 2018 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,... |
# -*- coding: utf-8 -*-
"""
Helpers for managing the ``.aiida-testing-config.yml`` configuration file.
"""
import os
import pathlib
import typing as ty
import collections
from voluptuous import Schema
from enum import Enum
import yaml
CONFIG_FILE_NAME = '.aiida-testing-config.yml'
class ConfigActions(Enum):
""... |
# -*- coding: utf-8 -*-
#
# 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law... |
"""Entry point for setuptools, configuration is in setup.cfg."""
import re
from pathlib import Path
from typing import List
from semver.version import Version
from setuptools import setup
ROOT_DIR = Path(__file__).parent
SEMVER_RE = re.compile(r"(?:#{2}\s*\[)(?P<version>.*)(?:\])")
def semver_from(changelog: Path)... |
from ..service import Service
from ..exception import TombaException
class Count(Service):
def __init__(self, client):
super(Count, self).__init__(client)
def email_count(self, domain):
"""get Email Count"""
if domain is None:
raise TombaException('Missing required param... |
#
"""
Useful python tools for working with the MIRI LRS; calls a specific version
of the tools specified below.
This version of the tools hooks into the JWST Calibration
Pipeline code to do the heavy lifting. Note that this
means performance may be affected by what version of
the pipeline you are running!! It does, ... |
# Generated by command write_metadata_files version 1
from django.contrib import admin
from metadata.models import EuiLevel1
from .base_metadata import BaseMetadataAdmin
__all__ = ['EuiLevel1Admin']
@admin.register(EuiLevel1)
class EuiLevel1Admin(BaseMetadataAdmin):
pass |
from django.conf import settings
from django.conf.urls.static import static
from django.contrib.staticfiles.views import serve
urlpatterns = []
def staticfiles_urlpatterns(prefix=None):
"""
Helper function to return a URL pattern for serving static files.
"""
if prefix is None:
prefix = setti... |
cpu6_2_7 = [33.2, 15.8, 0.2, 1.2, 0.7, 2.0, 1.8, 3.9, 1.5, 1.0, 1.7, 1.0, 0.8, 0.5, 1.3, 0.5, 3.2, 0.6, 1.4, 0.7, 1.0, 0.1, 0.3, 0.5, 2.3, 3.3, 1.0, 0.6, 0.3, 0.5, 0.4, 0.7, 0.2, 2.3, 1.9, 1.6, 0.9, 0.5, 0.7, 0.8, 0.5, 3.2, 3.4, 0.7, 0.2, 0.7, 0.0, 1.0, 1.2, 4.9, 8.2, 3.8, 1.8, 1.8, 3.4, 1.7, 0.1, 0.1, 0.5, 0.2, 0.8, 0... |
#!/usr/bin/env python
# Software License Agreement (BSD License)
#
# Copyright (c) 2012, Yujin Robot
# 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 r... |
import tensorflow as tf
from src.nn_utils.general import exp_mask_for_high_rank, mask_for_high_rank
from src.nn_utils.integration_func import directional_attention_with_dense
from src.nn_utils.nn import bn_dense_layer, linear
def bi_directional_simple_block_attention(
rep_tensor, rep_mask, block_len=5, scope... |
#!/Users/blueprint/Documents/Like_Lion_7th/LikeLion_Django_Study_Summary/myvenv/bin/python3
from django.core import management
if __name__ == "__main__":
management.execute_from_command_line() |
"""
Django settings for votingsite project.
Generated by 'django-admin startproject' using Django 2.1.3.
For more information on this file, see
https://docs.djangoproject.com/en/2.1/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/2.1/ref/settings/
"""
import os... |
str = '''
jobnum is 1, thread_num is 2
jobnum is 10, thread_num is 3
jobnum is 9, thread_num is 3
jobnum is 8, thread_num is 3
jobnum is 7, thread_num is 3
jobnum is 6, thread_num is 3
jobnum is 15, thread_num is 6
jobnum is 14, thread_num is 6
jobnum is 13, thread_num is 6
jobnum is 12, thread_num is 6
jobnum is 11, t... |
# 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... |
import numpy as np
from catboost import CatBoostRegressor
from sklearn.datasets import load_boston
from sklearn.metrics import mean_absolute_error
from tools.catboost_custom import MaeObjective
np.random.seed(42)
if __name__ == "__main__":
X, y = load_boston(return_X_y=True)
# Using this, it learns
cb ... |
# Copyright 2019 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 applicable law or agreed to ... |
#!/usr/bin/env python3
# Copyright (c) 2015-2018 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 multiple RPC users."""
from test_framework.test_framework import BitcoinTestFramework
from test_f... |
from .spring import SpringBoot |
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... |
import os
DEFAULTS = {
"quantity": "1",
"currency": "EUR",
"bank_suffix": "",
"currency_note": "",
"note": "",
"category": "none",
"template": "template/invoice.tex",
"row": "template/row.tex",
"vat": "0",
}
CONTACT = {"vat_reg": "", "tax_reg": ""}
RATE_URL = (
"http://www.cnb.c... |
import logging
import math
import os
from bokeh.core.properties import without_property_validation
from bokeh.layouts import column, row
from bokeh.models import (
BoxZoomTool,
ColumnDataSource,
DataRange1d,
HoverTool,
NumeralTickFormatter,
PanTool,
ResetTool,
Select,
WheelZoomTool,... |
# Copyright (c) OpenMMLab. All rights reserved.
import torch
import torch.nn as nn
from mmcv.runner import BaseModule
from mmdet.models.builder import HEADS
from ...core import bbox_cxcywh_to_xyxy
@HEADS.register_module()
class EmbeddingRPNHead(BaseModule):
"""RPNHead in the `Sparse R-CNN <https://arxiv.org/abs/201... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('conference', '0002_talk_domain'),
]
operations = [
migrations.AddField(
model_name='talk',
name='dom... |
# -*- coding: utf-8 -*-
##########################################################################
#
# pgAdmin 4 - PostgreSQL Tools
#
# Copyright (C) 2013 - 2018, The pgAdmin Development Team
# This software is released under the PostgreSQL Licence
#
# config.py - Core application configuration settings
#
############... |
# -*- coding: utf-8 -*-
"""
API functions.
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from zope.interface import providedBy
from zope.component import getSiteManager
from zope.container.interfaces import IContainer
from zope.traversing import api a... |
"""just to overcome the prob that console PyLoad uses import,
and the parser there prevents using '(' in args so can't do reload :p
probably a good idea to add a proper py console soon-ish."""
import input
input = reload(input) |
from django.views.generic import View
from django.http import HttpResponse
from django.conf import settings
import os
class ReactAppView(View):
def get(self, request):
try:
with open(os.path.join(str(settings.ROOT_DIR), 'frontend', 'build', 'index.html')) as file:
return HttpRes... |
from django.contrib import admin
from oscar.core.loading import get_model
ConditionalOffer = get_model('offer', 'ConditionalOffer')
Condition = get_model('offer', 'Condition')
Benefit = get_model('offer', 'Benefit')
Range = get_model('offer', 'Range')
class ConditionAdmin(admin.ModelAdmin):
list_display = ('typ... |
# Copyright 2020 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... |
# Generated by Django 3.2.6 on 2021-08-25 11:43
from django.db import migrations, models
import django.db.models.deletion
import wagtail.core.blocks
import wagtail.core.fields
import wagtail.images.blocks
class Migration(migrations.Migration):
dependencies = [
('home', '0052_solutionpage_new_problem_for... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sun May 26 18:29:17 2019
@author: isoamylacetate
"""
import requests
import argparse
import sys
import json
from typing import List, Dict
sys.path.append('..')
import exceptions
CHANEL_INFO_KEYS = ['title', 'description', 'customUrl', 'publishedAt', 'co... |
#!/usr/bin/env python
"""Lists available nf-core pipelines and versions."""
from __future__ import print_function
from collections import OrderedDict
import click
import datetime
import errno
import json
import logging
import os
import re
import subprocess
import sys
import git
import requests
import tabulate
impor... |
"""Implements an operator that detects traffic lights."""
import logging
import erdos
import numpy as np
import pylot.utils
from pylot.perception.detection.traffic_light import TrafficLight, \
TrafficLightColor
from pylot.perception.detection.utils import BoundingBox2D
from pylot.perception.messages import Traff... |
# coding: utf-8
"""
Isilon SDK
Isilon SDK - Language bindings for the OneFS API # noqa: E501
OpenAPI spec version: 5
Contact: sdk@isilon.com
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
import unittest
import isi_sdk_8_1_0
from i... |
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... |
# Licensed under a 3-clause BSD style license - see LICENSE.rst
"""Unit tests for the Fit class"""
import pytest
from numpy.testing import assert_allclose
from astropy.table import Table
from gammapy.datasets import Dataset
from gammapy.modeling import Fit, Parameter
from gammapy.modeling.models import Model, Models
fr... |
from mod_pywebsocket import handshake
def web_socket_do_extra_handshake(request):
message = (b'HTTP/1.1 101 Switching Protocols\r\n'
b'Upgrade: websocket\r\n'
b'Connection: Upgrade\r\n'
b'Sec-WebSocket-Accept: XXXXthisiswrongXXXX\r\n'
b'\r\n')
reques... |
# This file is initialized with a code version of this
# question's sample test case. Feel free to add, edit,
# or remove test cases in this file as you see fit!
import program
import unittest
class LinkedList(program.LinkedList):
def addMany(self, values):
current = self
while current.next is no... |
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... |
from plotly.basedatatypes import BaseTraceHierarchyType as _BaseTraceHierarchyType
import copy as _copy
class ColorBar(_BaseTraceHierarchyType):
# class properties
# --------------------
_parent_path_str = "scattermapbox.marker"
_path_str = "scattermapbox.marker.colorbar"
_valid_props = {
... |
"""
Module providing a macro to automatically absorb X percent of the
beam using the absorbers at the NanoMAX beamline
"""
import os
import numpy as np
from contrast.environment import env, macro, register_shortcut, runCommand
# ToDo
# - avoid elements with absorption edges close to the current energy
# ... |
# coding: utf-8
#
# Copyright 2022 :Barry-Thomas-Paul: Moss
#
# 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... |
"""Numerical timestepping methods for stochastic differential equation (SDE) systems."""
import sympy
import symnum.numpy as snp
import symnum.diffops.symbolic as diffops
def euler_maruyama_step(drift_func, diff_coeff):
"""Construct Euler-Maruyama integrator step function."""
def forward_func(z, x, v, δ):
... |
from .diagrams import show_diagram, diagram_to_dotstring |
from migen import *
from litex.soc.interconnect.csr import *
from litepcie.common import *
# --------------------------------------------------------------------------------------------------
class LitePCIeMSI(Module, AutoCSR):
def __init__(self, width=32):
self.irqs = Signal(width)
self.sourc... |
# import pytest
# import napari_labeller
# this is your plugin name declared in your napari.plugins entry point
# MY_PLUGIN_NAME = "napari-labeller"
# the name of your widget(s)
# MY_WIDGET_NAMES = ["Example Q Widget", "example_magic_widget"]
# @pytest.mark.parametrize("widget_name", MY_WIDGET_NAMES)
# def test_wit... |
#! /usr/bin/env python
"""
Copyright 2016 The Trustees of University of Arizona
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
Un... |
"""The game engine module of Mighty, built for the Mighty-Online project.
This module contains all the underlying classes needed for playing a game of mighty.
"""
from .cards import *
from . import constructs as cs
from typing import List, Optional, Tuple
from enum import IntEnum
class BiddingReturnType(IntEnum):
... |
#!/usr/bin/env python
# -*- coding: latin-1 -*- ######################################################
# ____ _ __ #
# ___ __ __/ / /__ ___ ______ ______(_) /___ __ #
# / _ \/ // / / (_-</ -_) __/ // / __/ / __/ // / ... |
from twisted.internet.defer import inlineCallbacks
from vumi.transports.base import Transport
from vumi.transports.failures import FailureMessage
from vumi.transports.tests.helpers import TransportHelper
from vumi.tests.helpers import (
VumiTestCase, IHelper, PersistenceHelper, MessageHelper, WorkerHelper,
Mes... |
# -*- coding: UTF-8 -*-
#
# copyright: 2020-2021, Frederico Martins
# author: Frederico Martins <http://github.com/fscm>
# license: SPDX-License-Identifier: MIT
"""Discogs data handler.
This module handles Discogs data.
The following is a simple usage example::
from .discogs import Discogs
d = Discogs('my_discog... |
#!/usr/bin/env python3
# Copyright 2010-2021 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 ... |
"""*****************************************************************************
* Copyright (C) 2019 Microchip Technology Inc. and its subsidiaries.
*
* Subject to your compliance with these terms, you may use Microchip software
* and any derivatives exclusively with Microchip products. It is your
* responsibility to ... |
from turtle import Turtle
class Ball(Turtle):
"""
Class used to represent a ball
Attributes
----------
x_move : int
the number of paces the ball goes along the x-axis
y_move : int
the number of paces the ball goes along the y-axis
move_speed : float
the speed at ... |
from __future__ import absolute_import
import unittest
import shutil
import json
import errno
import os.path
from testbenchexecutor import TestBenchExecutor
import dateutil.parser
__author__ = 'adam'
_this_dir = os.path.dirname(os.path.abspath(__file__))
class TBManifestTestBase(unittest.TestCase):
def _create... |
#!/usr/bin/python3 -i
#
# Copyright 2013-2021 The Khronos Group Inc.
#
# SPDX-License-Identifier: Apache-2.0
import os
import re
from generator import (GeneratorOptions, OutputGenerator, noneStr,
regSortFeatures, write)
class CGeneratorOptions(GeneratorOptions):
"""CGeneratorOptions - subc... |
"""config URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.10/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
Class-bas... |
import unittest
from pymath.primes.prime_factors import prime_factors
class PrimeFactorsTest(unittest.TestCase):
def test_1(self):
self.assertEqual([], prime_factors(1))
def test_2(self):
self.assertEqual([2], prime_factors(2))
def test_3(self):
self.assertEqual([3], prime_facto... |
# Copyright 2020, Battelle Energy Alliance, LLC
# ALL RIGHTS RESERVED
import numpy as np
import math
import random
from scipy.integrate import quad
def run(self,Input):
# intput: t, T (max time)
# output: outcome
if self.t_SG > self.T:
self.outcome_SG = 0 # OK
else:
self.outcome_SG = 1 # SD
self.p... |
import os
import sys
from acconeer.exptool import configs, recording, utils
from acconeer.exptool.clients import SocketClient, SPIClient, UARTClient
def main():
parser = utils.ExampleArgumentParser()
parser.add_argument("-t", "--temp", type=str, required=True)
parser.add_argument("-l", "--label", type... |
"""
Copyright (c) 2017 Red Hat, Inc
All rights reserved.
This software may be modified and distributed under the terms
of the BSD license. See the LICENSE file for details.
"""
import copy
import os
import json
from atomic_reactor.constants import (PLUGIN_FETCH_WORKER_METADATA_KEY,
... |
# Copyright 2019 Michael Kemna.
#
# 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 wri... |
from collections import Counter
def missing_alphabets(s):
res=Counter("".join(sorted(s)))
check=res.most_common(1)[0][1]
solution=""
for i in "abcdefghijklmnopqrstuvwxyz" :
solution+=i*(check-res.get(i, 0))
return solution |
"""
This module contains the unit tests related to
the views in app ``core``.
"""
# from django.test import TestCase |
#!/Users/amitbadheka/work/lambdaFunctions/ProtoGraph_CDN_Invalidator/bin/python3.6
# $Id: rst2latex.py 5905 2009-04-16 12:04:49Z milde $
# Author: David Goodger <goodger@python.org>
# Copyright: This module has been placed in the public domain.
"""
A minimal front end to the Docutils Publisher, producing LaTeX.
"""
... |
import numpy as np
from sys import stdin
def SquaredErrorDistortion(data, centers):
distances = np.zeros((data.shape[0],centers.shape[0]))
for idx, center_i in enumerate(centers):
distances[:,idx] = np.array(np.sqrt(np.sum(np.power(data - center_i, 2), 1)).T)
return np.sum(np.power(np.min(distance... |
import os
import json
import uuid
import time
from IPython.display import Javascript
from jinja2 import Template
from biokbase.narrative.jobs.specmanager import SpecManager
import biokbase.narrative.clients as clients
from biokbase.narrative.app_util import (
map_outputs_from_state,
validate_parameters,
che... |
# -*- coding: utf-8 -*-
#
# Copyright (c) 2014, Paweł Wodnicki
# 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, t... |
"""
Displays overview financial data (cash flow)
"""
import curses
from app.const import NC_COLOR_TAB, NC_COLOR_TAB_SEL
from app.methods import format_currency, ellipsis, alignr
from app.page import Page
class PageOverview(Page):
""" Page class to display overview data """
def __init__(self, win, api, set_st... |
# -*- coding: utf-8 -*-
"""
Elasticsearch - A distributed RESTful search and analytics server
Module to provide Elasticsearch compatibility to Salt
(compatible with Elasticsearch version 1.5.2+)
.. versionadded:: 2015.8.0
:depends: `elasticsearch-py <http://elasticsearch-py.readthedocs.org/en/latest/>`_
:conf... |
# 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 *
class PyPyld(PythonPackage):
"""This library is an implementation of the JSON-LD specification i... |
import config
from src.bot.discord_bot import bot
from src.util.logging import log
if __name__ == '__main__':
token = config.token # create config.py file and enter a new string!
if token:
# initialize_logging()
log.info("Starting pob discord bot...")
bot.run(token) |
#!/usr/bin/env python
# Copyright (c) 2015-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.
'''
This checks if all command line args are documented.
Return value is 0 to indicate no error.
Author: @... |
# Cogs to enable on Starting
__cogs__ = ['cogs.admin',
'cogs.anime',
'cogs.fun',
'cogs.information'
#'cogs.utilities'
] |
from __future__ import division, print_function, absolute_import
import numpy as np
import numpy.testing as npt
from dipy.reconst.recspeed import (local_maxima, remove_similar_vertices,
search_descending)
from dipy.data import get_sphere, get_data
from dipy.core.sphere import unique_... |
from typing import Any, Dict
from storey import MapClass
this_path = "mlrun.feature_store.steps"
class FeaturesetValidator(MapClass):
def __init__(self, featureset=None, columns=None, name=None, **kwargs):
super().__init__(full_event=True, **kwargs)
self._validators = {}
self.featureset ... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import asyncio
import time
import unittest
from syncer import sync
from pyppeteer.errors import ElementHandleError, NetworkError, TimeoutError
from .base import BaseTestCase
from .frame_utils import attachFrame, detachFrame, dumpFrames, navigateFrame
from .utils import... |
import html
from typing import Optional
from Ichigo import LOGGER, TIGERS, dispatcher
from Ichigo.modules.helper_funcs.chat_status import (
bot_admin,
can_restrict,
connection_status,
is_user_admin,
user_admin,
)
from Ichigo.modules.helper_funcs.extraction import (
extract_user,
extract_use... |
"""
DATA DESCRIPTION
sentiment140 dataset. It contains 1,600,000 tweets extracted using the twitter api . The tweets have been annotated (0 = negative, 4 = positive) and they can be used to detect sentiment .
It contains the following 6 fields:
target: the polarity of the tweet (0 = negative, 2 = neutral, 4 = positi... |
# @Time : 2020/7/7
# @Author : Yupeng Hou
# @Email : houyupeng@ruc.edu.cn
# UPDATE
# @Time : 2020/9/9, 2020/9/16
# @Author : Yupeng Hou, Yushuo Chen
# @email : houyupeng@ruc.edu.cn, chenyushuo@ruc.edu.cn
"""
recbole.data.dataloader.context_dataloader
################################################
"""
from re... |
# Copyright (c) 2016-2021 The Regents of the University of Michigan
# Part of fresnel, released under the BSD 3-Clause License.
"""The fresnel ray tracing package."""
import os
import numpy
from . import geometry # noqa: F401 - ignore unused import
from . import tracer
from . import camera
from . import color # no... |
#!/usr/bin/env python3
import os
import socket
import selectors
import threading
from argparse import ArgumentParser
import i3ipc
SOCKET_FILE = '/tmp/i3-cycle-focus'
MAX_WIN_HISTORY = 16
UPDATE_DELAY = 2.0
class FocusWatcher:
def __init__(self):
self.i3 = i3ipc.Connection()
self.i3.on('window::... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.