text stringlengths 2 999k |
|---|
"""
This files test the event rsvp functionality
"""
from __future__ import absolute_import
import unittest
import json
from app import app, db
# local imports
from config import app_config
from .helper_methods import Helper
class TestEventsDetails(unittest.TestCase, Helper):
"""This class represents the Events... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""Anella 4.0 Orchestrator"""
from flask import Flask, Blueprint
from flask_restful import Api
import ConfigParser
from flask_mongoengine import MongoEngine
from api.service_instance import ServiceInstance
from api.service_instance import ServiceInstanceBilling
CONFIG = Confi... |
#!/usr/bin/env python
from nodes import Node
import lang_ast
class Goto(Node):
char = "r"
args = 0
def prepare(self, stack):
raise lang_ast.GotoStart(stack)
@Node.is_func
def goto_start(self):
"""Goto the start of the program, keeping the same stack"""
pass
... |
"""
This module lets you practice the ACCUMULATOR pattern
in its simplest classic forms:
SUMMING: total = total + number
Authors: David Mutchler, Dave Fisher, Vibha Alangar, Mark Hays, Amanda Stouder,
their colleagues and Gerardo Santana.
""" # Done: 1. PUT YOUR NAME IN THE ABOVE LINE.
def main():... |
import enum
import os
try:
from psycopg2ct.compat import register
except ImportError:
pass
else:
register()
from pytest import fixture, yield_fixture
from sqlalchemy.engine import create_engine
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import sessionmaker
from sqlalchemy.p... |
# Copyright 2014 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, ... |
"""diff_factory wraps a model's diff and returns a queryable DiffModel."""
import copy
from django.apps import apps
from django.contrib.contenttypes.models import ContentType
from django.urls import reverse
from django.utils import timezone
from django.utils.html import format_html
import django_tables2 as tables
fr... |
from django.urls import path
from . import views
urlpatterns = [
path('', views.login, name='index_login'),
path('login/', views.login, name='login'),
path('logout/', views.logout, name='logout'),
path('register/', views.register, name='register'),
path('update/<int:contact_id>', views.update_view,... |
# Owner(s): ["module: dataloader"]
import copy
import http.server
import itertools
import os
import os.path
import pickle
import random
import socketserver
import sys
import tarfile
import tempfile
import threading
import time
import unittest
import warnings
import zipfile
from functools import partial
from typing imp... |
"""Backer Tests."""
|
from django.contrib import admin
from django.db import models
from django.forms import Textarea, Select
from django.utils.html import format_html
from research.models import Paper
class PaperAdmin(admin.ModelAdmin):
list_per_page = 10
list_display = (
'title',
'created_date',
'is_acti... |
# Copyright (c) OpenMMLab. All rights reserved.
import importlib
from mmdeploy.utils import Codebase
from .base import BaseTask, MMCodebase, get_codebase_class
extra_dependent_library = {
Codebase.MMOCR: ['mmdet'],
Codebase.MMROTATE: ['mmdet']
}
def import_codebase(codebase: Codebase):
"""Import a codeb... |
# DO NOT EDIT! This file is automatically generated
import datetime
import typing
from commercetools.types._abstract import _BaseType
from commercetools.types._common import BaseResource
if typing.TYPE_CHECKING:
from ._cart import (
DiscountCodeState,
DiscountedLineItemPriceForQuantity,
Li... |
from django.urls import path, include
from .user_admin import urls as user_admin_urls
app_name = "baserow_premium.api"
urlpatterns = [
path("admin/user/", include(user_admin_urls, namespace="admin_user")),
]
|
latest_block_redis_key = 'latest_block_from_chain'
latest_block_hash_redis_key = 'latest_blockhash_from_chain'
most_recent_indexed_block_redis_key = 'most_recently_indexed_block_from_db'
most_recent_indexed_block_hash_redis_key = 'most_recently_indexed_block_hash_from_db'
|
from django.core.management.base import BaseCommand
from parkings.importers import ParkingAreaImporter
class Command(BaseCommand):
help = 'Uses the ParkingAreaImporter to import parking areas.'
def add_arguments(self, parser):
parser.add_argument('geojson_file_path')
parser.add_argument('--g... |
# Generated by Django 2.1.15 on 2021-09-05 00:18
import django.core.validators
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('core', '0001_initial'),
]
operations = [
migrations.AddField(
model_name='user',
name... |
from . import views
from django.conf import settings
from django.urls import path, re_path
from django.conf.urls.static import static
from rest_framework.authtoken.views import ObtainAuthToken
urlpatterns=[
#post and get urls
path('api/hood/',views.NeighborhoodList.as_view(),name='neighbor'),
path('api/busines... |
#!/usr/bin/env python3
import time
import re
import os
import logging
import glob
import argparse
import change_dir
import abunpack
import acb2wav
__version__ = "2.2.8"
def main():
# argparse 설정
arg_parser = argparse.ArgumentParser()
arg_parser.add_argument("-o", "--output_dir", help="Master output di... |
# MIT License
#
# Copyright (c) 2018-2019 Red Hat, 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, m... |
#! /usr/bin/python
import sys, os
import pytest
from utils import *
from dynaconfig.render import *
def test_requirements_simple():
logging.info("multi-pass")
data = { 'size' : 100
,'x':
{ 'min' : -1.
, 'max' : 2.
, 'dx' : '$( (${max} - ${min}) / ${/size} )'
}
... |
import yaml
import os.path
import re
import sys
kwarg_pattern = re.compile('<([a-zA-Z0-9_]+=?[a-zA-Z0-9_, \(\)\'\"]*)>')
def to_string(value):
if type(value) in (list, tuple):
return ",".join(map(str, value))
elif value is None:
return ""
else:
return str(value)
def indent(text,... |
# coding=utf-8
# Copyright 2015 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import absolute_import, division, print_function, unicode_literals
from pants_test.pants_run_integration_test import PantsRunIntegrationTest
class NodeLin... |
'''Immutable dict
'''
from collections import Mapping
__all__ = ['FrozenDict']
class FrozenDict(Mapping):
'''An immutable dict'''
def __init__(self, items):
self._m = dict()
for k, v in items.items():
self._m[k] = v
self._h = None
def __len__(self):
return le... |
import pygame
WIDTH, HEIGHT = 800, 800
ROWS, COLS = 8, 8
SQUARE_SIZE = WIDTH//COLS
# RGB colours
RED = (255, 0, 0)
WHITE = (255, 255, 255)
BLACK = (0, 0, 0)
BLUE = (0, 0, 255)
GREY = (128, 128, 128)
WHITE_STRING = "White"
RED_STRING = "Red"
CROWN = pygame.transform.scale(pygame.image.load('checkers/assets/crown.png... |
"""
Use: "python ...\Tools\visitor_edit.py string rootdir?".
Add auto-editor startup to SearchVisitor in an external subclass component;
Automatically pops up an editor on each file containing string as it traverses;
can also use editor='edit' or 'notepad' on Windows; to use texteditor from
later in the book, try r'py... |
from tkinter import *
import time
from pygame import mixer
import datetime
root=Tk()
"""Define the count down function"""
def click(event):
global t
text=event.widget.cget('text')
if text=="Start":
try:
for i in range (int(t.get()),-2,-1):
if i==-1:
... |
import os
import sklearn.metrics
import numpy as np
import sys
import time
from . import sentence_encoder
from . import data_loader
import torch
from torch import autograd, optim, nn
from torch.autograd import Variable
from torch.nn import functional as F
# from pytorch_pretrained_bert import BertAdam
from transformers... |
# coding=utf-8
# *** WARNING: this file was generated by the Pulumi SDK Generator. ***
# *** 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 _utilities, _tables
__a... |
# AUTO-GENERATED by tools/checkspecs.py - DO NOT EDIT
from ..featuredetection import DilateMask
def test_DilateMask_inputs():
input_map = dict(
args=dict(argstr="%s",),
environ=dict(nohash=True, usedefault=True,),
inputBinaryVolume=dict(argstr="--inputBinaryVolume %s", extensions=None,),
... |
from tkinter import *
from speedtest import Speedtest
#Function for checking the speed
def update_text():
speed_test = Speedtest()
download = speed_test.download()
upload = speed_test.upload()
download_speed = round(download / (10**6), 2)
upload_speed = round(upload / (10**6), 2)
speed_test.get... |
from enum import Enum
from typing import List
from pydantic import BaseModel
class UpdateStatus(Enum):
upToDate = 'upToDate'
mismatch = 'mismatch'
remoteAhead = "remoteAhead"
localAhead = "localAhead"
class PackageVersionInfo(BaseModel):
version: str
fingerprint: str
class CheckUpdateResp... |
"""
Deploy code snips into swig interface files
(c) Hex-Rays
"""
from __future__ import print_function
import sys, re, os, glob
major, minor, micro, _, _ = sys.version_info
try:
from argparse import ArgumentParser
except:
print("Failed to import module 'argparse'. Upgrade to Python 2.7, copy argparse.py to ... |
import os
import collections
import gym
import numpy as np
import joblib
import tensorflow.compat.v1 as tf
import sonnet as snt
from baselines.common.input import observation_placeholder, encode_observation
from baselines.common.policies import PolicyWithValue
from gfootball.env import football_action_set
from gfootbal... |
from grafana_snapshots.constants import (PKG_NAME, PKG_VERSION)
from setuptools import setup, find_packages
# Global variables
name = PKG_NAME
version = PKG_VERSION
requires = [
'grafana-api',
'jinja2'
]
setup(
name=name,
version=version,
description='A Python-based application to build Grafana sn... |
# -*- coding: utf-8 -*-
# PLEASE DO NOT EDIT THIS FILE, IT IS GENERATED AND WILL BE OVERWRITTEN:
# https://github.com/ccxt/ccxt/blob/master/CONTRIBUTING.md#how-to-contribute-code
from ccxt.base.exchange import Exchange
from ccxt.base.errors import ExchangeError
from ccxt.base.errors import AuthenticationError
from cc... |
import pytest
import tardis.montecarlo.montecarlo_numba.numba_interface as numba_interface
import numpy.testing as npt
import numpy as np
@pytest.mark.parametrize(
["current_shell_id", "nu"],
[(0, 0.6), (1, 0.4)]
)
def test_coninuum_opacities(
verysimple_continuum, current_shell_id, nu):
... |
# YOLOv5 🚀 by Ultralytics, GPL-3.0 license
"""
Image augmentation functions
"""
import math
import random
import cv2
import numpy as np
from utils.general import LOGGER, check_version, colorstr, resample_segments, segment2box
from utils.metrics import bbox_ioa
class Albumentations:
# YOLOv5 Albumentations cla... |
import numpy
from scipy.integrate import trapz
from skipi.function import Function, evaluate
from skipi.domain import Domain
class FourierTransform(Function):
@classmethod
def to_function(cls, domain, feval, frequency_domain):
#TODO: frequency_domain as Domain?
#domain = Domain.from_domain(d... |
#!/usr/bin/env python3
class Solution(object):
def search(self, nums, target):
"""
:type nums: List[int]
:type target: int
:rtype: int
"""
if not nums:
return -1
low = 0
high = len(nums) - 1
while low <= high:
mid = (... |
from qtpy.QtWidgets import QWidget, QSizePolicy
class FormBaseWidget(QWidget):
def __init__(self):
super().__init__()
self.setMaximumWidth(400)
self.setMinimumWidth(400)
sp = self.sizePolicy()
sp.setVerticalPolicy(QSizePolicy.Minimum)
self.setSizePolicy(sp)
|
#: Max number of units of distance a ship can travel in a turn
MAX_SPEED = 7.0
#: Radius of a ship
SHIP_RADIUS = 0.5
#: Starting health of ship, also its max
MAX_SHIP_HEALTH = 255
#: Starting health of ship, also its max
BASE_SHIP_HEALTH = 255
#: Starting health of ship, also its max
TURNS_TO_DESTROY_SHIP = 4
#: Weapon... |
import os
import sys
import yaml
import warnings
import cftime
import calendar
import numpy as np
import pandas as pd
import xarray as xr
import matplotlib.pyplot as plt
import util
start_date = '1998-12-01'
end_date = '2020-03-01'
southern_ocean_stn_list = ['CRZ', 'MQA', 'DRP', 'PSA', 'SYO', 'CYA', 'MAA', 'HBA'... |
# coding=utf-8
# Copyright 2018-2020 EVA
#
# 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 ... |
# -*- coding: utf-8 -*-
from shoop.apps import AppConfig
class PugConfig(AppConfig):
name = "shoop_pugme"
provides = {
"admin_module": [
"shoop_pugme.admin_module:PugAdminModule"
]
}
|
'''
Author: Yiwen Ding <dyiwen@umich.edu>
Date: May 2, 2021
'''
import csv
import os
from io import StringIO
from pdfminer3.pdfinterp import PDFResourceManager, PDFPageInterpreter
from pdfminer3.converter import TextConverter
from pdfminer3.layout import LAParams
from pdfminer3.pdfpage import PDFPage
def retrieve_ur... |
#!/usr/bin/env python3
# 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.
"""Configuration file (powered by YACS)."""
import argparse
import os
import sys
from pycls.core.io import cache_url... |
"""Support for displaying persistent notifications."""
from collections import OrderedDict
import logging
from typing import Any, Mapping, MutableMapping, Optional
import voluptuous as vol
from homeassistant.components import websocket_api
from homeassistant.core import HomeAssistant, callback
from homeassistant.exce... |
from .configuration import config
from collections import namedtuple
import falcon
import logging
import marshmallow
import slackclient
class SlackMessageRouter:
def __init__(self):
self._slack = slackclient.SlackClient(config['slack']['bot_user']['token'])
webhook = config['slack']['outgoing_web... |
''' data processing for neuron project '''
# built-in
import sys
import os
import shutil
import six
# third party
import nibabel as nib
import numpy as np
import scipy.ndimage.interpolation
from tqdm import tqdm_notebook as tqdm # for verbosity for forloops
import matplotlib.pyplot as plt
# note sure if tqdm_notebo... |
import numpy
# from cryptography.fernet import Fernet
def handler(event, context):
# Try using some of the modules to make sure they work & don't crash the process
# print(Fernet.generate_key())
return {"pi": "{0:.2f}".format(numpy.pi)}
def first_function_handler(event, context):
return "Hello Wo... |
#! /usr/bin/env python3
# coding=utf8
import pycurl
import json
import requests
import re
class PKO:
sid = ""
flow_id = ""
account = ""
def _httpIPKO(self, url, data):
headers = {'x-ias-ias_sid': self.sid,
'X-Requested-With': "XMLHttpRequest"}
res = requests.post(u... |
# Copyright 2018-2019 The glTF-Blender-IO 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 applicable law or ... |
def find_in_sorted(arr, x):
def binsearch(start, end):
if start == end:
return -1
mid = start + (end - start) // 2
if x < arr[mid]:
return binsearch(start, mid)
elif x > arr[mid]:
return binsearch(mid + 1, end)
else:
return mid... |
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
Created on Thu Dec 14 10:46:53 2017
@author: dalonlobo
"""
from __future__ import print_function
import os
import glob
import pysrt
# Path to the srt files
srt_files_path = "/home/dalonlobo/deepspeech_models/srt_data"
# Path for the text file
text_file_path = "/ho... |
# a quick and dirty python script to build.
import os
import sys
import requests
def minifiy_js(code):
'''
minify and return javascript code
'''
r = requests.post("http://javascript-minifier.com/raw", data={'input': code})
r.raise_for_status()
return r.text
# combine all code into a single fi... |
from rest_framework import serializers
from .models import Comment, Talk, Vote
class CommentSerializer(serializers.ModelSerializer):
class Meta:
model = Comment
fields = ('id', 'user', 'talk', 'content', 'created', 'modified')
class VoteSerializer(serializers.ModelSerializer):
class Meta:
... |
# 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... |
# -*- coding: utf-8 -*-
import unittest
from openprocurement.tender.twostage.tests import tender
def suite():
suite = unittest.TestSuite()
suite.addTest(tender.suite())
return suite
if __name__ == '__main__':
unittest.main(defaultTest='suite')
|
# coding: utf-8
"""
Kubernetes
No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
OpenAPI spec version: v1.11.1
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
import os
import sys
i... |
#Compiled By Ahmad Riswanto
#Facebook : https://www.facebook.com/ahmad.riswanto.180
import marshal
exec(marshal.loads('c\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x00\x00@\x00\x00\x00s\x94\x00\x00\x00d\x00\x00d\x01\x00l\x00\x00Z\x00\x00d\x00\x00d\x01\x00l\x01\x00Z\x01\x00d\x00\x00d\x01\x00l\x02\x00Z\x02\x00d\x02\x00GHd\x... |
from __future__ import annotations
import asyncio
import datetime
import gzip
import itertools
import json
import string
from pathlib import Path
from typing import Counter, Iterable, Sequence, TypeVar
import platformdirs
import pyperclip
from rich.align import Align
from rich.bar import Bar
from rich.console import ... |
# -*- coding: utf-8 -*-
# Copyright (c) 2020, Frappe Technologies and Contributors
# See license.txt
from __future__ import unicode_literals
# import frappe
import unittest
class TestEventProducerLastUpdate(unittest.TestCase):
pass
|
# -*- coding: utf-8 -*-
"""
Azure Resource Manager (ARM) Virtual Network Peering State Module
.. versionadded:: 1.0.0
.. versionchanged:: 4.0.0
:maintainer: <devops@eitr.tech>
:configuration: This module requires Azure Resource Manager credentials to be passed via acct. Note that the
authentication parameters ar... |
"""
A problem that incurs a constant delay at each `_evaluate` call.
"""
__docformat__ = "google"
from time import sleep
from pymoo.core.problem import Problem
import numpy as np
from .wrapped_problem import WrappedProblem
class Delayer(WrappedProblem):
"""
A problem that sleeps for a set amount of time at... |
""" serverextension for starters
"""
from .handlers import add_handlers
from .manager import StarterManager
def load_jupyter_server_extension(nbapp):
"""create a StarterManager and add handlers"""
manager = StarterManager(parent=nbapp)
add_handlers(nbapp, manager)
nbapp.log.info(f"""💡 starters: {", "... |
"""
Collection of MXNet reduction functions, wrapped to fit Ivy syntax and signature.
"""
# global
import mxnet as _mx
from numbers import Number
# local
from ivy.functional.backends.mxnet.core.general import _flat_array_to_1_dim_array
def reduce_sum(x, axis=None, keepdims=False):
if axis is None:
num_d... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Author: Seaky
# @Date: 2019/6/25 10:00
import json
import random
import re
import warnings
from functools import wraps
from pathlib import Path
from urllib import parse
import requests
from bs4 import BeautifulSoup
from ..func.base import MyClass
from ..func.mrun im... |
# -*- coding: utf-8 -*-
from pkg_resources import get_distribution, DistributionNotFound
try:
# Change here if project is renamed and does not equal the package name
dist_name = 'actinia_module_plugin.wsgi'
__version__ = get_distribution(dist_name).version
except DistributionNotFound:
__version__ = 'un... |
# System modules
import uuid
from dataclasses import dataclass, field
from typing import List
# 3rd party modules
from flask import make_response, abort
# local modules
from config import ma
from models.model import Model
from models.recipe import Recipe
from models.user import requires_login
from common.database imp... |
# TODO: needs to be standardized with BaseTask
import pandas as pd
import numpy as np
import os
from tophat.constants import SEED
from config.common import *
from gensim.models.doc2vec import TaggedDocument, FAST_VERSION
from gensim.models import Doc2Vec
import fastavro as avro
import itertools as it
from tophat.sch... |
# -*- coding: utf-8 -*-
#
# Configuration file for the Sphinx documentation builder.
#
# This file does only contain a selection of the most common options. For a
# full list see the documentation:
# http://www.sphinx-doc.org/en/stable/config
# -- Path setup ------------------------------------------------------------... |
"""Testing for Lower Bounds of Dynamic Time Warping."""
import numpy as np
import pytest
import re
from math import sqrt
from pyts.metrics.lower_bounds import (
_lower_bound_yi_x_y, _lower_bound_yi_X_Y, _warping_envelope, _clip
)
from pyts.metrics import (lower_bound_improved, lower_bound_keogh,
... |
from math import sqrt
from libs.ustr import ustr
import hashlib
import re
import sys
import numpy as np
import pydicom
try:
from PyQt5.QtGui import *
from PyQt5.QtCore import *
from PyQt5.QtWidgets import *
except ImportError:
from PyQt4.QtGui import *
from PyQt4.QtCore import *
def new_icon(ico... |
notebooks_docs = "notebooks.rst"
notebooks_path = "notebooks"
repo_directory = "notebooks"
repo_owner = "openvinotoolkit"
repo_name = "openvino_notebooks"
artifacts_link = "https://repository.toolbox.iotg.sclab.intel.com/projects/ov-notebook/0.1.0-latest/latest/dist/rst_files/"
blacklisted_extensions = ['.xml', '... |
#!/usr/bin/env python
from os.path import exists
import versioneer
from setuptools import setup
with open("requirements.txt") as f:
install_requires = f.read().strip().split("\n")
if exists("README.rst"):
with open("README.rst") as f:
long_description = f.read()
else:
long_description = ""
setu... |
################################################################################
# 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... |
import os
from setuptools import find_packages, setup
# Load version number
__version__ = None
src_dir = os.path.abspath(os.path.dirname(__file__))
version_file = os.path.join(src_dir, 'chemprop', '_version.py')
with open(version_file, encoding='utf-8') as fd:
exec(fd.read())
# Load README
with open('README.md'... |
"""
백준 17298번 : 오큰수
"""
n = int(input())
array = list(map(int, input().split()))
answer = [-1] * n
# 스택에 인덱스 넣기
stack = [0]
for i in range(1, n):
while stack and array[stack[-1]] < array[i]:
# 스택의 오른쪽부터 빠져나감
answer[stack.pop()] = array[i]
stack.append(i)
print(*answer) |
padding_left = 0
padding_right = 8
padding_top = 10
padding_bottom = 20
|
import requests
from bs4 import BeautifulSoup
URL = "https://www.worldometers.info/coronavirus/countries-where-coronavirus-has-spread/"
r = requests.get(URL)
soup = BeautifulSoup(r.content, 'html5lib')
data = {}
number_of_data = 0
for tag in soup.findAll("tr"):
# stag = second tag
list_of_data = []
for... |
"""
dj-stripe Webhook Tests.
"""
import json
import warnings
from collections import defaultdict
from copy import deepcopy
from importlib import reload
from unittest.mock import Mock, PropertyMock, call, patch
from django.test import TestCase, override_settings
from django.test.client import Client
from django.urls im... |
#!/usr/bin/env python
# ToDo: comment
# ToDo: make convergence measurements relative
import numpy
import matplotlib.pyplot as plt
import input.read as read
from numba import jitclass, int64, float64
import moc_transport.step_characteristic as moc
from scipy.sparse import csr_matrix
import datetime
import matplotlib.t... |
# The tools in this script positionally calculate operations on matrices,
# create blank and identity matrices, and convert short matrices to and from long matrices.
#
# Matrices use the following example notation:
# [[0, 1, 2], [3, 4, 5], [6, 7, 8]]
#
# Which can be visually expressed as:
# [[0, [3, [6,
# 1, 4, 7,... |
# 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 the Li... |
import mock
import re
from testtools import TestCase, ExpectedException # noqa
from padre import channel as c
from padre.tests import common
from padre.wsgi_servers import sensu
from webob import exc
class SensuHookApplicationTest(TestCase):
def setUp(self):
super(SensuHookApplicationTest, self).setUp(... |
from logging import getLogger
class AbstractETAEncoder(object):
"""ETA Encoder
ETA Encoder is used to encode the spatiotemporal information in trajectory.
We abstract the encoding operation from the Dataset Module to facilitate developers
to achive more flexible and diverse trajectory representation ... |
from util.conf import JIRA_SETTINGS, CONFLUENCE_SETTINGS, BITBUCKET_SETTINGS, JSM_SETTINGS
from util.api.jira_clients import JiraRestClient
from util.api.confluence_clients import ConfluenceRestClient
from util.api.bitbucket_clients import BitbucketRestClient
from lxml import etree
import json
JIRA = 'jira'
CONFLUENCE... |
# Copyright (c) 2019 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 app... |
import os
from unittest.mock import Mock
import boto3
from boto3.dynamodb.table import TableResource
from boto3.resources.base import ServiceResource
from botocore.session import Session
from mock.mock import MagicMock
profile = os.environ['AWS_PROFILE'] if 'AWS_PROFILE' in os.environ else None
def resource(service... |
import typing
import logging
import urllib.parse
import requests
import presalytics.lib.tools.ooxml_tools
import presalytics.lib.exceptions
if typing.TYPE_CHECKING:
from presalytics.client.api import Client
from io import BytesIO
logger = logging.getLogger(__name__)
def story_post_file_bytes(client: 'Client... |
# subprocess - Subprocesses with accessible I/O streams
#
# For more information about this module, see PEP 324.
#
# Copyright (c) 2003-2005 by Peter Astrand <astrand@lysator.liu.se>
#
# Licensed to PSF under a Contributor Agreement.
# See http://www.python.org/2.4/license for licensing details.
r"""Subprocesses with ... |
#!/usr/bin/env python3
"""
Rules for building C/API module with f2py2e.
Here is a skeleton of a new wrapper function (13Dec2001):
wrapper_function(args)
declarations
get_python_arguments, say, `a' and `b'
get_a_from_python
if (successful) {
get_b_from_python
if (successful) {
callfortran
... |
# Generated by Django 2.1.7 on 2019-03-03 09:18
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('movielist', '0001_initial'),
]
operations = [
migrations.AlterField(
model_name='movie',
... |
from typing import Dict, List
import numpy as np
import torch
from torch.utils.data import Dataset
from allennlp.data import Vocabulary
from updown.config import Config
from updown.data.readers import CocoCaptionsReader, ConstraintBoxesReader, ImageFeaturesReader
from updown.types import (
TrainingInstance,
T... |
from tixte_foss import app
from multiprocessing import Process
import pytest
def test_run():
server = Process(target=app.run)
server.start()
server.terminate()
|
#
# @lc app=leetcode id=321 lang=python3
#
# [321] Create Maximum Number
#
# @lc code=start
# class Solution:
# def maxNumber(self, nums1, nums2, k):
# if not nums1 and not nums2:
# return []
# l1, l2 = len(nums1), len(nums2)
# dp = [[0] * (l2 + 1) for _ in range(l1 + 1)]
# ... |
from celery import Celery
from flasgger import Swagger
from flask_caching import Cache
from flask_cors import CORS
from flask_jwt_extended import JWTManager
from flask_migrate import Migrate
from flask_redis import FlaskRedis
from flask_sqlalchemy import SQLAlchemy
redis_store = FlaskRedis()
cors = CORS()
migrate = ... |
import tushare
from datetime import datetime, timedelta
import pytz
import logging
import json
import os
from pymongo import MongoClient
from apscheduler.schedulers.background import BackgroundScheduler
from apscheduler.triggers.cron import CronTrigger
from .ProxyManager import ProxyManager
from .Constants im... |
# -*- coding: utf-8 -*-
""":mod:`dodotable.environment.flask` --- Flask environment
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Yet, dodotable only supports Jinja2_ for template, it can be possible to use
another template engine but if you have a mind to use Jinja2_,
maybe you have interest with Flask_... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.