text stringlengths 1 927k |
|---|
# encoding: utf-8
'''API functions for updating existing data in CKAN.'''
import logging
import datetime
import time
import json
from ckan.common import config
import ckan.common as converters
import six
from six import text_type
import ckan.lib.helpers as h
import ckan.plugins as plugins
import ckan.logic as logic... |
# coding=utf-8
# Copyright 2018 The Google AI Language Team 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 ... |
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
config = {
'description': 'My Project',
'author': 'Aung Kyaw Khaing',
'url': 'URL to get it at.',
'download_url': 'Where to download it.',
'author_email': 'mitu16888@gmail.com',
'version': '0.1',
... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# (c) 2012, Matt Wright <matt@nobien.net>
#
# This file is part of Ansible
#
# Ansible 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... |
version_info = (5, 2, 2)
__version__ = "5.2.2"
# unlike `.dev`, alpha, beta and rc _must not_ have dots,
# or the wheel and tgz won't look to pip like the same version.
assert __version__ == (
".".join(map(str, version_info)).replace(".b", "b").replace(".a", "a").replace(".rc", "rc")
)
assert ".b" not in __versio... |
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
import io
import os
import numpy
from setuptools import find_packages, setup, Extension
# Package meta-data.
NAME = "pyqlib"
DESCRIPTION = "A Quantitative-research Platform"
REQUIRES_PYTHON = ">=3.5.0"
VERSION = "0.6.3.99"
# Detect Cython
try:... |
# coding: utf-8
#
# Copyright 2020 The Oppia 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 requi... |
# -*- coding: utf8 -*-
__all__ = ['blueprint', 'ResourceService']
from console.resource.controller import blueprint
from console.resource.service import ResourceService |
# Copyright (c) 2009 Upi Tamminen <desaster@gmail.com>
# See the COPYRIGHT file for more information
# coding=utf-8
from __future__ import annotations
import codecs
import datetime
import getopt
import random
import re
import time
from typing import Callable
from twisted.internet import error, reactor # type: igno... |
import matplotlib.pyplot as plt
import numpy as np
from sklearn.linear_model import LinearRegression
def simple_example():
X = [10, 20, 30]
Y = [15, 19, 45]
plt.scatter(X, Y,)
plt.show()
A = np.array([10, 1, 20, 1, 30, 1]).reshape(3, 2)
B = np.array(Y).reshape(3, 1)
a = np.linspace(10, 3... |
from ._base import Base
from loguru import logger
from os import path
import subprocess, os, platform
class Edit(Base):
"""Edit.
Opens the default editor (run `echo $EDITOR`) to edit the package file.
Usage: gitget edit [global options]
Examples:
gitget edit
"""
def run(self):
... |
# -*- coding:utf-8 -*-
class BaseModel(object):
_all_dic = None
''' Base Model '''
def __init__(self, uid, dic):
''' initializer '''
self.uid = uid
# keep all values in dic
for key in dic.keys():
setattr(self, key, dic.get(key, None))
@classmethod
def... |
# Multiprocessing: ability of a system to support more than one processor at the same time.
# Requires-
# 1. Multiprocessor - more than one central processor.
# 2. Hyper-Threading - makes each core look like two CPUs to the operating system
import time
from multiprocessing import Process
def cpu_bound(n, name):
... |
import json
import re
import requests
import dbt.exceptions
import dbt.semver
PYPI_VERSION_URL = 'https://pypi.org/pypi/dbt/json'
def get_latest_version():
try:
resp = requests.get(PYPI_VERSION_URL)
data = resp.json()
version_string = data['info']['version']
except (json.JSONDecode... |
# Copyright (c) 2019 Princeton University
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
from datetime import datetime, timedelta
import json
import os.path
import pandas as pd
import sys
sys.path = ['./', '../'] + sys.path
# Local
from G... |
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_li... |
ERRATA = {
"earth": {"repl": "earth1|earth2", "num_tokens": 2},
"enter (去)[": {
"repl": "enter|evening|extinguish|eye|fall|Hanzi|徃 (去) [徃来]",
"num_tokens": 7,
},
"far": {
"repl": "far|fart, to|fast|fat [of person]|fat [of meat]|father|fear, to|Hanzi|径",
"num_tokens": 8,
... |
'''
Created on Jan 6, 2015
@author: Ciprian Cosma
'''
def find_first_eligible(matrix):
''' return the first empty location of the matrix
it searches by row/column
if all the matrix has values, it returns -1, -1
'''
size = len(matrix)
for x in range(size):
for y in range(size):
... |
import numpy as np
from copy import copy
class _Validator:
"""Performs internal validations on various input types."""
def observation_sequences(self, X, allow_single=False):
"""Validates observation sequence(s).
Parameters
----------
X: numpy.ndarray or List[numpy.ndarray]
... |
from __future__ import print_function
import json
import sys
import os
import boto3
from fleece.xray import monkey_patch_botocore_for_xray
monkey_patch_botocore_for_xray()
import twitter
SSM_NAME = os.getenv("SSM_PARAMETER_NAME")
REGION = os.getenv("REGION")
STREAM_NAME = os.getenv("STREAM_NAME")
session = boto3.s... |
from ._cov_cov import covCov_estimator
from ._cov import cov |
from django.shortcuts import render
from rest_framework.views import APIView
from rest_framework.response import Response
from rest_framework import permissions
# from django.views.decoraors.csrf import ensure_csrf_cookie, csrf_protect
from django.middleware.csrf import get_token
# Create your views here.
def welcome(... |
"""SihProject URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/3.0/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: path('', views.home, name='home')
Class-ba... |
# Copyright 2019-present NAVER 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 agreed to in ... |
# Copyright 2015 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... |
#!/usr/bin/env python
import codecs
import sys
import re
import writenumbers
## Global vars
normdict = {".": "",
",": "",
":": "",
";": "",
"?": "",
"\\": " ",
"\t": " "
}
t_table = str.maketrans(normdict)
## Main
numtable = writ... |
from __future__ import division
from multiprocessing import pool
import numpy
from chainer.dataset import iterator
from chainer.iterators import _statemachine
from chainer.iterators.order_samplers import ShuffleOrderSampler
class MultithreadIterator(iterator.Iterator):
"""Dataset iterator that loads examples i... |
"""Access functions to read spectra from data files.
The following structure is expected:
- Reading functions for each data file type defined in specific modules
- Modules named as {datatype}.py, e.g. swan.py
- Functions named as read_{dataname}, e.g. read_swan
All functions defined with these conventions... |
'''oscaar v2.0
Module for differential photometry
Developed by Brett Morris, 2011-2013'''
import numpy as np
from matplotlib import pyplot as plt
import matplotlib.cm as cm
def phot(image, xCentroid, yCentroid, apertureRadius, plottingThings, annulusOuterRadiusFactor=2.8, annulusInnerRadiusFactor=1.40, ccdGain=... |
"""
Various utility functions.
"""
import numpy as np
import re
import subprocess
__all__ = ['rstate', 'SubprocessQuery', 'InteractiveQuery']
def rstate(rng=None):
"""
Return a RandomState object. This is just a simple wrapper such that if rng
is already an instance of RandomState it will be passed ... |
"""
Biothings Web API Handlers
Supports: (all features in parent classes and ...)
- payload type 'application/json' (through self.json_arguments)
- parsing keyword argument options (type, default, alias, ...)
- multi-type dictionary output (json, yaml, html, msgpack)
- standardized error response ... |
# oxAuth is available under the MIT License (2008). See http://opensource.org/licenses/MIT for full text.
# Copyright (c) 2016, Gluu
#
# Author: Yuriy Movchan
#
from org.xdi.model.custom.script.type.scope import DynamicScopeType
from org.xdi.service.cdi.util import CdiUtil
from org.xdi.oxauth.service import UserServic... |
# --------------------------------------------------------
# Deformable Convolutional Networks
# Copyright (c) 2017 Microsoft
# Licensed under The Apache-2.0 License [see LICENSE for details]
# Written by Yuwen Xiong
# --------------------------------------------------------
import os
import sys
os.environ['PYTHONUNBU... |
# -*- coding: utf-8 -*-
from django.conf import settings
from django.utils.translation import gettext_lazy as _
from bluebottle.notifications.messages import TransitionMessage
class DonationSuccessActivityManagerMessage(TransitionMessage):
subject = _(u"You have a new donation!💰")
template = 'messages/donat... |
"""Checks for attributes and code examples in RedditBase subclasses"""
import os
import re
import sys
# This line imports from the local PRAW rather than the global installed PRAW.
sys.path.insert(0, os.path.abspath(os.path.join(__file__, "..", "..")))
from praw.models.reddit.base import RedditBase # noqa: E402
fro... |
'''
@author Fabio Zadrozny
'''
import os
import sys
#make it as if we were executing from the directory above this one (so that we can use pycompletionserver
#without the need for it being in the pythonpath)
#twice the dirname to get the previous level from this file.
sys.path.insert(1, os.path.split(os.path.split(__f... |
import requests
import csv
import json
import pandas as pd
import os
import numpy as np
import datetime
import os
from selenium.webdriver.chrome.options import Options
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.common.... |
# coding: utf-8
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License... |
from agent.AlphaZero import AlphaZero
def main():
alphazero = AlphaZero()
alphazero.train()
if __name__ == "__main__":
main() |
# This file is dual licensed under the terms of the Apache License, Version
# 2.0, and the BSD License. See the LICENSE file in the root of this repository
# for complete details.
from __future__ import absolute_import, division, print_function
import attr
from construct import Container, ListContainer
from six imp... |
#!/usr/bin/env python3
#encoding=utf-8
# Copyright (c) 2019 The Monero Project
#
# 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 cop... |
import time
import sys
import math
import random
import george
import numpy as np
import os
#acq function
from trimtuner.acquisition_functions.constrained_entropy_search import Constrained_EntropySearch
from trimtuner.acquisition_functions.marginalization import MarginalizationGPMCMC, MarginalizationDT
from robo.acqui... |
from output.models.ms_data.regex.re_i73_xsd.re_i73 import Doc
__all__ = [
"Doc",
] |
########################################################################################################################
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import sys
if sys.version_info[0] < 3:
raise EnvironmentError("Hey, caveman, use Python 3.")
__doc__ = \
"""
PDB minimization for different... |
import FWCore.ParameterSet.Config as cms
from Calibration.TkAlCaRecoProducers.AlcaBeamSpotProducer_cfi import *
alcaBeamSpot = cms.Sequence( alcaBeamSpotProducer ) |
# Programmer: Navraj Chohan <nlake44@gmail.com>
"""
Cassandra Interface for AppScale
"""
import base64
import logging
import os
import string
import sys
import time
from thrift_cass.Cassandra import Client
from thrift_cass.ttypes import *
from thrift import Thrift
from thrift.transport import TSocket
from thrift.tra... |
##############################################################################
# Institute for the Design of Advanced Energy Systems Process Systems
# Engineering Framework (IDAES PSE Framework) Copyright (c) 2018-2020, by the
# software owners: The Regents of the University of California, through
# Lawrence Berkeley N... |
import os
class Empresa():
def __init__(self,nom="",ruc=0,dire="",tele=0,ciud="",tipEmpr=""):
self.nombre=nom
self.ruc=ruc
self.direccion=dire
self.telefono=tele
self.ciudad=ciud
self.tipoEmpresa=tipEmpr
def datosEmpresa(self):#3
self.nombre=input("Ingres... |
# 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... |
# Copyright 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 or agreed to in writing, ... |
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
from . import test_res_users |
from __future__ import print_function
from builtins import range
from builtins import object
import numpy as np
import matplotlib.pyplot as plt
from past.builtins import xrange
class TwoLayerNet(object):
"""
A two-layer fully-connected neural network. The net has an input dimension of
N, a hidden layer di... |
"""
Utilities for hdf5 data
"""
# Copyright 2019 Gabriele Valvano
#
# 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 require... |
# -*- coding: future_fstrings -*-
from xml.dom import minidom
import xpath
import os
import base64
import mimetypes
class TemplateSVG:
def __init__(self, templateFile):
with open(templateFile, 'r') as arquivo:
self.template = minidom.parse(arquivo)
self.svg = self.template.cloneNod... |
from django.urls import path
from . import views
app_name = "main"
urlpatterns = [
path('',views.homepage,name="homepage")
] |
from __future__ import (absolute_import, print_function)
# From system
import os
import re
import sys
import time
import json
import shutil
import logging
from distutils.util import strtobool
from boto.s3.connection import S3Connection
from boto.s3.key import Key
from boto.exception import S3ResponseError
from datetim... |
from tqdm.notebook import tqdm as tqdm_notebook
from tqdm.auto import tqdm as tqdm_auto
# To tqdm_notebook, None means do not display. To standard tqdm, None means
# display only when connected to a TTY.
TQDM_DEFAULT_DISABLE = False if tqdm_auto == tqdm_notebook else None
def tqdm(*args, disable=TQDM_DEFAULT_DISABLE... |
import os
import math
import ctypes
import numpy as np
import pandas as pd
import OpenGL.GL as GL
import OpenGL.GL.shaders
import pygame
from PIL import Image
from pyrr import Quaternion, matrix44, Matrix44, Vector3
# https://github.com/adamlwgriffiths/Pyrr/tree/master/pyrr
# https://www.opengl.org/discussion_boards/... |
# Copyright (c) 2021-2022, Ethan Henderson
# 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
# list of condition... |
from http import HTTPStatus
from uuid import UUID
import pytest
from fastapi.testclient import TestClient
from api_pedidos.api import app, recuperar_itens_por_pedido
from api_pedidos.config_logging import logging
from api_pedidos.esquema import Item
from api_pedidos.excecao import (
FalhaDeComunicacaoError,
P... |
from classytags.core import Tag
from classytags.utils import flatten_context
from django.core.exceptions import ImproperlyConfigured
from django.template.loader import render_to_string
class AsTag(Tag):
"""
Same as tag but allows for an optional 'as varname'. The 'as varname'
options must be added 'manual... |
import asyncio
import secrets
import string
from faker import Faker
from sqlalchemy.exc import IntegrityError
from trustadapter.trustadapter import (
Patient_IE,
TrustIntegrationCommunicationError,
PseudoTrustAdapter
)
from containers import SDContainer
from models.db import db, DATABASE_URL
from models imp... |
# 141, Суптеля Владислав
# 【Дата】:「19.03.20」
# 2. Описати рекурсивную функцію Fact2 (N) дійсного типу, яка обчислює значення подвійного факторіала N !! = N • (N-2) • (N-4) • ...
# (N> 0 - параметр цілого типу; останній співмножник в творі дорівнює 2, якщо N - парне число, і 1, якщо N - непарне).
# За допомогою цієї фун... |
import cv2
import time
import numpy as np
from detection.FaceDetector import FaceDetector
from recognition.FaceRecognition import FaceRecognition
from classifier.FaceClassifier import FaceClassifier
VIDEO_INPUT_FILE = './media/test_video/Zidane_1.avi'
VIDEO_OUTPUT_FILE = './media/test_video_output/Zidane_Recognition_1... |
# This file helps to compute a version number in source trees obtained from
# git-archive tarball (such as those provided by githubs download-from-tag
# feature). Distribution tarballs (built by setup.py sdist) and build
# directories (produced by setup.py build) will contain a much shorter file
# that just contains th... |
from watchopticalmc.scripts.runall import main
main() |
"""Unit tests that involve postgres access."""
import logging
from fonduer.candidates import CandidateExtractor, MentionExtractor, MentionFigures
from fonduer.candidates.matchers import LambdaFunctionFigureMatcher
from fonduer.candidates.models import (
Candidate,
Mention,
candidate_subclass,
mention_s... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#****************************************************************************************************************************************************
# Copyright 2017 NXP
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modifi... |
class ApiError(Exception):
"""Raised when an error occured while communicating with the API.""" |
"""Setup for rhasspyasr_pocketsphinx_hermes"""
import os
import setuptools
this_dir = os.path.abspath(os.path.dirname(__file__))
with open(os.path.join(this_dir, "README.md"), "r") as readme_file:
long_description = readme_file.read()
with open(os.path.join(this_dir, "requirements.txt"), "r") as requirements_fil... |
# cython: language_level=3, linetrace=True
#
# Copyright (c) 2020 by Kristoffer Paulsson <kristoffer.paulsson@talenten.se>.
#
# This software is available under the terms of the MIT license. Parts are licensed under
# different terms if stated. The legal terms are attached to the LICENSE file and are
# made available o... |
from __future__ import absolute_import, division, print_function
from .version import __version__
from .imu import *
from .server import *
from .client import *
from .imu import * |
# -*- coding: utf-8 -*-
"""
# Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information.
#
# This file was generated and any changes will be overwritten.
"""
from enum import Enum
class FreeBusyStatus(Enum):
"""The Enum ... |
import os
from instaloader import Profile, Post
class IgpdLinuxFeaturesPrivate:
def download_post(self,link,p_instance_param):
pid = link.rsplit("/",2)[-2]
post = Post.from_shortcode(p_instance_param.context, pid)
p_instance_param.download_post(post,target=(pid))
print("\nPost do... |
import os
import base64
import urllib2
import subprocess
import urlparse
import nltk
import sys
reload(sys)
sys.setdefaultencoding('utf8')
from bs4 import BeautifulSoup
os.system('cls')
url_list = ['https://en.wikipedia.org/wiki/Islamic_State_of_Iraq_and_the_Levant']
print '-----------------------'
print ' Claw Searc... |
#!/usr/bin/env python
# Copyright (c) 2014 Park Ilsu. See LICENSE for details.
from wind.web.httpserver import HTTPServer
from wind.web.app import WindApp, path, Resource
class HelloResource(Resource):
def handle_get(self):
self.write('Hello')
self.finish()
def main():
app = WindApp([
... |
from django.db import models
from django.utils.translation import gettext_lazy as _
from taggit.managers import TaggableManager
from django.utils.text import slugify
from category.models import Category
from django.contrib.auth import get_user_model
from .mixins import TimeStamp
User = get_user_model()
class Post(Ti... |
# Copyright 2016 The Closure Rules 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... |
# Copyright (c) 2016 Uber Technologies, Inc.
#
# 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, publ... |
import sabre as env
import math
from network import Zero
from tracepool import tracepool
import numpy as np
from rules import rules
from log import log
import os
from multiprocessing import cpu_count
import multiprocessing as mp
NUM_AGENT = 2
USE_CORES = cpu_count()
def agent(agent_id, net_params_queue, exp_queue):
... |
"""
BETA test commands
"""
# dependancies
import asyncio
import discord
from discord.ext import commands
# util
from utility.cog.player.player import Player
from utility.cog.combat_system.cpu import CPU
# characters
from utility.cog.character.list import c001_sabimen
from utility.cog.character.list import c002_sabim... |
import os
import markdown
import codecs
import difflib
try:
import nose
except ImportError as e:
msg = e.args[0]
msg = msg + ". The nose testing framework is required to run the Python-" \
"Markdown tests. Run `pip install nose` to install the latest version."
e.args = (msg,) + e.args[1:]
ra... |
import random
import cv2
import numpy as np
from tqdm import tqdm
file_name = 'map.png'
img = cv2.imread(file_name, -1)
dst = img.copy()
h, w = img.shape
epsilon = 0.9999
# 그레이스케일과 바이너리 스케일 변환
th = cv2.bitwise_not(dst)
contours, _ = cv2.findContours(th, cv2.RETR_CCOMP, cv2.CHAIN_APPROX_SIMPLE)
contours.sort(key=len... |
"""
Django settings for project project.
Generated by 'django-admin startproject' using Django 1.8.3.
For more information on this file, see
https://docs.djangoproject.com/en/1.8/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.8/ref/settings/
"""
# Build path... |
"""
A module for every helper of the OpenAPI documentation generator.
"""
import symmetric.constants
def is_not_docs(route):
"""Checks if a route is not a documentation-related route."""
# Check that the route is not the schema route
not_schema = route != symmetric.constants.OPENAPI_ROUTE
# Check tha... |
import re
from typing import Dict, List, Union
import pymongo
from bson import ObjectId
from loguru import logger
from pymongo import MongoClient
from pymongo.collection import Collection
from pymongo.database import Database
from pymongo.errors import ServerSelectionTimeoutError
from pymongo.results import InsertMany... |
#!/usr/bin/env python
#
# Copyright (c) 2016, The OpenThread Authors.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# 1. Redistributions of source code must retain the above copyright
# ... |
# -------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
# --------------------------------------------------------------------------
"""
input... |
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under t... |
import os
import pytest
from catalyst import dl
from catalyst.contrib.datasets import MNIST
from catalyst.data import ToTensor
from catalyst.utils.torch import get_available_engine
from torch import nn, optim
from torch.utils.data import DataLoader
import dvclive
from dvclive.catalyst import DvcLiveCallback
# pylint... |
"""
_test_pager_
Tests for the pager module and LambdaPager class.
Here I don't provide full integration testing or individual unit tests,
but due to the nature and simplicity of the pager, test that for a given
configuration the pager makes the correct requests and twilio API calls
through mocks.
"""
import os
impor... |
#!/usr/bin/env python3
import os
from urllib.parse import quote_plus
from urllib.parse import unquote_plus
from fedoidcmsg.bundle import FSJWKSBundle
from fedoidcmsg.test_utils import create_federation_entities
from oidcmsg.key_jar import KeyJar
# make sure the necessary directories are there
for _dir in ['public', ... |
import torch
from torch import nn
from torch.utils.data import DataLoader, Dataset
class DatasetSplit(Dataset):
def __init__(self, dataset, idxs):
self.dataset = dataset
self.idxs = list(idxs)
def __len__(self):
return len(self.idxs)
def __getitem__(self, item):
image, la... |
import sys
import os
import shutil
import readline
import argparse
import invest_natcap.testing
from invest_natcap.testing import test_writing
from invest_natcap.testing import autocomplete
from invest_natcap.iui import fileio
#CONFIG_DATA = {
# 'Input archive': '',
# 'Output archive': '',
#}
class ConfiguredC... |
#!/usr/bin/env python3
import numpy as np
dirs = [(0,1), (1,0), (0, -1), (-1, 0), (1,1), (1,-1), (-1, 1), (-1,-1)]
def parse_seats(line):
v = []
for s in line:
if s == 'L':
v.append(0)
else:
v.append(-1)
return v
def allpos(xx,yy):
all_p = []
for x in xx:
... |
from pysparkling import *
from pyspark.sql import SparkSession
spark = SparkSession.builder.appName("App name").getOrCreate()
# Check if Sparkling Water classes are available
jvm = spark.sparkContext._jvm
package = getattr(jvm.ai.h2o.sparkling.backend, "BuildInfo$")
module = package.__getattr__("MODULE$")
# This would... |
# coding: utf-8
"""
FlashArray REST API
No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
OpenAPI spec version: 2.2
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
import re
# pyth... |
#!/usr/bin/env python
from tree import TreeNode
class BST:
def __init__(self):
self.root = None
def put(self, val):
self.root = self.put_int(self.root, val)
def put_int(self, node, val):
if node == None:
return TreeNode(val)
if val < node.val:
nod... |
import abc
import copy
import os
import tempfile
from collections import OrderedDict
from typing import Dict, Optional, Sequence, Tuple, Union
import numpy as np
from ..C import FVAL, MODE_FUN, MODE_RES, RDATAS
from .amici_calculator import AmiciCalculator
from .amici_util import (
create_identity_parameter_mappi... |
import os
from time import sleep
from unittest import TestCase
from datadog import ThreadStats
from microengine_utils.constants import SCAN_TIME, SCAN_VERDICT
from microengine_utils.datadog import configure_metrics
DATADOG_API_KEY = 'my_api_key'
DATADOG_APP_KEY = 'my_app_key'
# Configure Datadog metric keys for use ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.