text stringlengths 2 999k |
|---|
import logging
import time
import orjson
import structlog
structlog.configure(
cache_logger_on_first_use=True,
wrapper_class=structlog.make_filtering_bound_logger(logging.INFO),
processors=[
structlog.threadlocal.merge_threadlocal_context,
structlog.processors.add_log_level,
struct... |
import numpy as np
from pydemic.diseases import covid19
from pydemic.models import eSIR
class TestSIR:
def test_basic_esir_api(self):
m = eSIR(disease=covid19)
m.run(30)
res = m["I"]
ok = m.data.loc[m.times[0], "infectious"] * np.exp(m.K * m.times)
assert m.R0 == 2.74
... |
"""
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 logging
from flexmock import flexmock
from atomic_reactor.constants import DOCKERFILE_FILENAME, PLUGIN_REMOVE_WORKER_METADATA_KEY
fr... |
# -*- coding: utf-8 -*-
import os
import logging
logging.getLogger().setLevel(logging.DEBUG)
from datetime import datetime
from vilya.libs.props import PropsMixin
from vilya.libs.model import BaseModel, ModelField
from vilya.libs.store import cache, store
from vilya.models.consts import PULL_REF_H, PULL_REF_M
from vi... |
# Copyright 2018 Davide Spadini
#
# 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... |
from datetime import datetime
from guillotina import configure
from guillotina import task_vars
from guillotina.catalog import index
from guillotina.catalog.utils import get_index_fields
from guillotina.catalog.utils import get_metadata_fields
from guillotina.catalog.utils import parse_query
from guillotina.component i... |
import csv
import datetime
import json
import operator
import os
import sys
import tempfile
try:
from StringIO import StringIO
except ImportError:
from io import StringIO
from peewee import *
from playhouse.dataset import DataSet
from playhouse.dataset import Table
from .base import db_loader
from .base impor... |
import pytest
from mitmproxy.addons import modifybody
from mitmproxy.test import taddons
from mitmproxy.test import tflow
class TestModifyBody:
def test_configure(self):
mb = modifybody.ModifyBody()
with taddons.context(mb) as tctx:
tctx.configure(mb, modify_body=["one/two/three"])
... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import neurovault.apps.statmaps.models
import neurovault.apps.statmaps.storage
class Migration(migrations.Migration):
dependencies = [
('statmaps', '0010_atlas'),
]
operations = [
mi... |
import pickle
import numpy as np
import os
import lasagne
from PIL import Image
import torch
from torchvision import datasets, transforms
def main():
in_path = "horse2zebra/train"
out_path = "horse2zebra_64/"
for filename in os.listdir(in_path):
img = Image.open(os.path.join(in_path, filename))
... |
# coding: utf8
{
'!langcode!': 'fr',
'!langname!': 'Français',
'"update" is an optional expression like "field1=\'newvalue\'". You cannot update or delete the results of a JOIN': '"update" est une expression optionnelle comme "champ1=\'nouvellevaleur\'". Vous ne pouvez mettre à jour ou supprimer les résultats d\'un JOI... |
"""
Module defining Falcon resource, for the API's P3P Policy Reference File
Copyright (C) 2016 ERT Inc.
"""
import falcon
from api import config_loader
str_route = 'p3p.xml'
"""
String representing the URI path for this endpoint
E.g., "/p3p.xml"
"""
reference_file_name = 'p3p.xml'
# String, representing the name ... |
from tkinter.filedialog import askopenfilename
def main():
sum = 0.0
count = 0
filename = askopenfilename()
file = open(filename, 'r')
# Read header line
file.readline()
# for line in file.readlines():
# temp = float(line)
# sum += temp
# count += 1
line = ... |
# Scan an Apple header file, generating a Python file of generator calls.
import sys
import os
from bgenlocations import TOOLBOXDIR, BGENDIR
sys.path.append(BGENDIR)
from scantools import Scanner
def main():
input = "MacWindows.h"
output = "wingen.py"
defsoutput = TOOLBOXDIR + "Windows.py"
scanner = M... |
from flask_security import current_user
from flask import url_for, redirect, request, abort
from flask_admin.contrib import sqla
class AdminModelView(sqla.ModelView):
def is_accessible(self):
return current_user.is_active and current_user.is_authenticated and current_user.has_role("superuser")
def _... |
from django.apps import AppConfig
class CoreConfig(AppConfig):
name = 'core'
label = 'core'
|
# read_temperature_v04 tlfong01 2021feb13hkt2024
# Reference:
# RandomNerd https://RandomNerdTutorials.com
import machine, onewire, ds18x20, time
# *** Config ***
tempSensorPinNum = 27
tempSensorPin = machine.Pin(tempSensorPinNum)
tempSensor = ds18x20.DS18X20(onewire.OneWire(tempSensorPin))
... |
## \file OutputFormat.py
# \author Nikitha Krithnan and W. Spencer Smith
# \brief Provides the function for writing outputs
## \brief Writes the output values to output.txt
# \param is_safePb probability of glass breakage safety requirement
# \param is_safeLR 3 second load equivalent resistance safety requirement
# \pa... |
"""
Common web app urls
"""
from . import views
COMMON_URLS = [
('/', views.RenderTemplateView.as_view('index', template_name='common/index.html')),
]
|
"""
The binderhub application
"""
import asyncio
import ipaddress
import json
import logging
import os
import re
import secrets
from binascii import a2b_hex
from concurrent.futures import ThreadPoolExecutor
from glob import glob
from urllib.parse import urlparse
import kubernetes.client
import kubernetes.config
from j... |
"""This module contains these classes: ``Hfss`` and ``BoundaryType``."""
from __future__ import absolute_import # noreorder
import math
import os
import tempfile
import warnings
from collections import OrderedDict
import ast
from pyaedt.application.Analysis3D import FieldAnalysis3D
from pyaedt.generic.constants imp... |
from __future__ import annotations
from typing import Any
import pandas._libs.json as json
from pandas._typing import (
FilePath,
StorageOptions,
WriteExcelBuffer,
)
from pandas.io.excel._base import ExcelWriter
from pandas.io.excel._util import (
combine_kwargs,
validate_freeze_panes,
)
class ... |
import FWCore.ParameterSet.Config as cms
process = cms.Process("SKIMb")
process.load("FWCore.MessageLogger.MessageLogger_cfi")
process.load("CondCore.DBCommon.CondDBSetup_cfi")
process.source = cms.Source("PoolSource",
fileNames = cms.untracked.vstring(
# '/store/data/Commissioning09/Cosmics/RAW/v1/... |
"""
Redis Backends
------------------
Provides backends for talking to `Redis <http://redis.io>`_.
"""
from __future__ import absolute_import
import typing
import warnings
from ..api import BytesBackend
from ..api import NO_VALUE
if typing.TYPE_CHECKING:
import redis
else:
# delayed import
redis = Non... |
import sys
# This is needed to make the "pytest" command able to import from our
# working directory. Note that "pytest" must be run from the repo root.
sys.path.insert(0, ".")
|
'''
Copyright (c) 2020 Cisco and/or its affiliates.
This software is licensed to you under the terms of the Cisco Sample
Code License, Version 1.1 (the "License"). You may obtain a copy of the
License at
https://developer.cisco.com/docs/licenses
All use of the material herein must be in accordance with the ... |
# -*- coding: utf-8 -*-
"""Copy of Data Augmentation in Pets
Automatically generated by Colaboratory.
Original file is located at
https://colab.research.google.com/drive/1OAp7fCtBXHzyLKT-1vA2_EFlq_pd0sZE
"""
# Initialization
# Setting up Fast.ai Environment
# I am doing this project on Google Colab using Fast.ai... |
# 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 appli... |
# Copyright 2018 The TensorFlow Probability 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 o... |
import asyncio
import unittest
from unittest import TestCase, IsolatedAsyncioTestCase
from time import sleep
import sys
import os
import pdb
import orbit_service as orbit_service
from kubesat.message import Message
from kubesat.nats_handler import NatsHandler
from kubesat.orekit import absolute_time_converter_utc_manua... |
import pytest
from random import Random
from bionic.utils.keyed_priority_stack import KeyedPriorityStack
def test_simple_push():
kps = KeyedPriorityStack()
assert len(kps) == 0
kps.push("ONE", "1", 1)
kps.push("TWO_A", "2a", 2)
kps.push("THREE", "3", 3)
kps.push("TWO_B", "2b", 2)
asse... |
from .bleu import *
|
def search(L, e):
for i in range(len(L)):
if L[i] == e:
return True
if L[i] > e:
return False
return False
def newsearch(L, e):
size = len(L)
for i in range(size):
if L[size-i-1] == e:
return True
if L[i] < e:
return False... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import filer.fields.image
import django.db.models.deletion
import app_data.fields
class Migration(migrations.Migration):
dependencies = [
('aldryn_newsblog', '0007_default_newsblog_config'),
]
... |
"""
__MT_pre__ApplyModel.py_____________________________________________________
Automatically generated AToM3 syntactic object (DO NOT MODIFY DIRECTLY)
Author: gehan
Modified: Sun Feb 15 10:22:14 2015
____________________________________________________________________________
"""
from ASGNode import *
from ATOM3Typ... |
import json
import re
from os import path
# 12306 账号
from py12306.helpers.func import *
@singleton
class Config:
IS_DEBUG = False
USER_ACCOUNTS = []
# 查询任务
QUERY_JOBS = []
# 查询间隔
QUERY_INTERVAL = 1
# 用户心跳检测间隔
USER_HEARTBEAT_INTERVAL = 120
# 多线程查询
QUERY_JOB_THREAD_ENABLED = 0
... |
import testGeomParam
import testXform
import testPolyMesh
import testCurves
import testNurbs
import testPoints
import testXform
import testCamera
import testSubDFaceSet
import testLight
|
import copy
import json
from ipywidgets import (
Widget, DOMWidget, Box, Color, CallbackDispatcher, widget_serialization,
interactive, Style
)
from ipywidgets.widgets.trait_types import InstanceDict
from traitlets import (
Float, Unicode, Int, Tuple, List, Instance, Bool, Dict, Enum,
link, observe, ... |
# qubit number=3
# total number=31
import numpy as np
from qiskit import QuantumCircuit, execute, Aer, QuantumRegister, ClassicalRegister, transpile, BasicAer, IBMQ
from qiskit.visualization import plot_histogram
from typing import *
from pprint import pprint
from math import log2
from collections import Counter
from... |
30 mtime=1639777085.549355983
30 atime=1639777086.405355983
30 ctime=1639777126.985355983
|
#!/usr/bin/env python3
# Copyright 2022 The Pigweed 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicab... |
import queue
import sched
import threading
import time
import unittest
from test import support
TIMEOUT = 10
class Timer:
def __init__(self):
self._cond = threading.Condition()
self._time = 0
self._stop = 0
def time(self):
with self._cond:
return self._time
... |
import os.path as osp
import numpy as np
from PIL import Image
import io
import cv2
import ffmpeg
import copy
import math
import random
import os
from tqdm import tqdm
# try:
# import mc
# except ImportError:
# pass
import argparse
pil_resize_mode_dict = {
"pil-bilinear": Image.BILINEAR,
"pil-nearest"... |
#!/usr/bin/python3
"""
Streaming 6-DOF data from QTM forever
(start QTM first, Capture->Continuous Capture)
"""
import asyncio
import xml.etree.ElementTree as ET
import pkg_resources
import qtm
import json
import numpy as np
import socket
def create_body_index(xml_string):
""" Extract a name to index di... |
"""
problem_2021_09.py
"""
import sys
from typing import List, Any, Generator, Iterator
from dataclasses import dataclass
import pprint
from enum import IntEnum
import copy
from itertools import combinations
import logging
from flood_advent.utils import line_to_parts
from flood_advent.utils import SparseGrid
fr... |
# minecraft.py (c) 2017 D.J.Whale 15/01/2017
#
# Based on ideas by D.J.Whale on 10/06/2016 (see ideas.txt)
# usage:
# from minecraft import * (bit like from turtle import *)
# import minecraft (bit like import turtle)
# TODO: Needs to be a class with module wrappers,
# so that like turtle, we could have a defau... |
# coding: utf-8
"""
some helper functions that might be generally useful
"""
from __future__ import absolute_import, print_function
from functools import partial
import re
from .compat import text_type, binary_type
if False: # MYPY
from typing import Any, Dict, Optional, List, Text # NOQA
from .compat im... |
length = float(input())
width = float(input())
height = float(input())
perc_full = float(input())
aquarium_volume = length*width*height
total_liters = aquarium_volume*0.001
perc = perc_full*0.01
needed_liters = total_liters*(1-perc)
print(needed_liters) |
# SPDX-FileCopyrightText: 2016 Scott Shawcroft for Adafruit Industries
#
# SPDX-License-Identifier: MIT
# pylint: disable=too-few-public-methods
"""
`adafruit_register.i2c_bcd_datetime`
====================================================
Binary Coded Decimal date and time register
* Author(s): Scott Shawcroft
"""
... |
from __future__ import print_function, division, absolute_import
import os
import sys
import datetime
import argparse
import numpy as np
from jplephem.spk import SPK
from wmpl.Config import config
from wmpl.Utils.Earth import calcEarthRectangularCoordJPL
from wmpl.Utils.ShowerAssociation import associateShower
fr... |
# Generated by Django 3.2.4 on 2021-06-23 16:47
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("data_refinery_common", "0066_auto_20210611_1900"),
]
operations = [
migrations.AddField(
model_name="dataset", name="notify_me",... |
def repeat(phrase, num):
"""Return phrase, repeated num times.
>>> repeat('*', 3)
'***'
>>> repeat('abc', 2)
'abcabc'
>>> repeat('abc', 0)
''
Ignore illegal values of num and return None:
>>> repeat('abc', -1) is None
True
>>> repeat(... |
import oci
text = "Zoom interface is really simple and easy to use. The learning curve is very short thanks to the interface. It is very easy to share the Zoom link to join the video conference. Screen sharing quality is just ok. Zoom now claims to have 300 million meeting participants per day. It chose Oracle Corpora... |
# GENERATED BY KOMAND SDK - DO NOT EDIT
import komand
import json
class Component:
DESCRIPTION = "Delete user from WordPress instance"
class Input:
REASSIGNEE = "reassignee"
USERNAME = "username"
class Output:
SUCCESS = "success"
class DeleteUserInput(komand.Input):
schema = json.loa... |
import boto3
import urllib
import requests
import logging
import unicodedata
from base64 import b64decode
from lxml import etree
from Crypto.Cipher import AES
logger = logging.getLogger(__name__)
class PreservicaBucketAPI(object):
""" Interacts with the Preservica API to get a list of bucket names and
I... |
import operator
import logging
from rtamt.spec.stl.visitor import STLVisitor
#from rtamt.operation.sample import Sample
#from rtamt.lib.rtamt_stl_library_wrapper.stl_sample import Sample
class STLEvaluator(STLVisitor):
def __init__(self, spec):
self.spec = spec
name = None
if spec.is_pu... |
"""Contains functions for filtering
"""
import math
import pandas as pd
def remove_media_timepoints(in_mat_file, args, out_mat_file):
"""Takes an input matrix and removes specific timepoints
"""
media_timepoints = args.misc["media_timepoints"]
data = pd.read_table(in_mat_file)
keep_columns = [col... |
# © 2019 Nokia
# Licensed under the BSD 3 Clause license
# SPDX-License-Identifier: BSD-3-Clause
from radish_ext.radish.step_config import StepConfig
from radish_rest.radish.requests_test_data import RequestTestData
from radish_rest.sdk.rest import RestConfig, RestClient, SimpleRestConfig
class RequestsStepsConfig(... |
from django.shortcuts import render, redirect
from django.db import connection
from django.shortcuts import render
from django.http import JsonResponse, Http404
from datetime import datetime
def set_session(request, response):
response['is_authenticated'] = request.session.get('is_authenticated')
response['use... |
num = 1
while (num<100):
print ("El numero es = ", num)
num = num+1
|
# flake8: noqa
# There's no way to ignore "F401 '...' imported but unused" warnings in this
# module, but to preserve other warnings. So, don't check this module at all.
__version__ = "3.0.2"
# Work around to update TensorFlow's absl.logging threshold which alters the
# default Python logging output behavior when pre... |
# coding: utf-8
"""
CardPay REST API
Welcome to the CardPay REST API. The CardPay API uses HTTP verbs and a [REST](https://en.wikipedia.org/wiki/Representational_state_transfer) resources endpoint structure (see more info about REST). Request and response payloads are formatted as JSON. Merchant uses API to c... |
from Database import DbManager
import argparse
import yaml
import json
import csv
import os
import sys
import jmespath
from datetime import date
from deepdiff import DeepDiff
from logging import getLogger, StreamHandler, Formatter, FileHandler, DEBUG, INFO
# getコマンドの処理
def command_get(args, logger):
logger.info("Eve... |
# 打开文件
file1 = open(file='/Users/Ted/Desktop/test/abc.txt', mode='r', encoding='utf-8')
# 读文件
filecontent = file1.read()
# 显示内容
print(filecontent)
# 关闭文件
file1.close()
# 为了避免打开文件后忘记关闭,占用资源或当不能确定关闭文件的恰当时机的时候,我们可以用到关键字with,之前的例子可以写成这样:
# 普通写法
file1 = open('abc.txt', 'a')
file1.write('张无忌')
file1.close()
# 使用with关键字的写法
... |
from functools import partial
import mmcv
import numpy as np
import torch
from mmcv.runner import load_checkpoint
def generate_inputs_and_wrap_model(config_path, checkpoint_path, input_config):
"""Prepare sample input and wrap model for ONNX export.
The ONNX export API only accept args, and all inputs shoul... |
import datetime
from bson import ObjectId
from mongoengine import DateTimeField, Document, ObjectIdField, StringField, URLField, IntField # noqa: E501
class ChallengePlatform(Document):
id = ObjectIdField(primary_key=True, default=ObjectId)
name = StringField(required=True, unique=True)
displayName = Str... |
# copyright 2003-2013 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
# contact http://www.logilab.fr/ -- mailto:contact@logilab.fr
#
# This file is part of logilab-astng.
#
# logilab-astng is free software: you can redistribute it and/or modify it
# under the terms of the GNU Lesser General Public License as publis... |
import requests
import sys
import json
import time
HOST="https://www.protabank.org/"
USERNAME=sys.argv[1]
PASSWORD=sys.argv[2]
r = requests.post(HOST + 'subscriber/api/obtain-token/', data={'username':USERNAME, 'password':PASSWORD})
token = r.json()['token']
headers = {'Authorization': 'Token {}'.format(token), 'conten... |
""" Don't load any Java stuff at global scope, needs to be importable by CPython also """
import storytext.guishared, os, types
from threading import Thread
class ScriptEngine(storytext.guishared.ScriptEngine):
eventTypes = [] # Can't set them up until the Eclipse class loader is available
signalDescs = {}
... |
def max_cars_parked(array):
arr_len = len(array)
parking_register = [[0,True] for i in range(2 * arr_len)]
for i in range(arr_len):
parking_register[2 * i] = [array[i][0], True]
parking_register[2 * i + 1] = [array[i][1], False]
parking_register.sort()
curr_cnt = 0
final_... |
from __future__ import unicode_literals
from model_mommy import mommy
from .functional_base import BaseLiveServer
class CategoryFunctionalTestCase(BaseLiveServer):
def test_create_category(self):
self.create_auth_session()
self.visit('/setup/')
self.browser.click_link_by_partial_href('... |
# -*- coding: utf-8 -*-
# xmlrpcmapper.py ---
#
# Created: Wed Apr 11 15:40:26 2012 (-0600)
# Author: Patrick Hull
#
import xmlrpclib
from diablo.datamapper import DataMapper
from diablo import http
class XmlRpcMapper(DataMapper):
"""XML-RPC mapper
The mapper must be set using the format arg or explicitly ... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys, os, shutil, re, argparse, json, random, glob
from collections import defaultdict, Counter, OrderedDict
sys.path.append("../utils")
from code_process import tokenize_code, tokenize_err_msg
class Processor(object):
def __init__(self, args):
self.a... |
from typing import TYPE_CHECKING
from modules.base import ModuleProcessor
from opta.core.gcp import GCP
from opta.exceptions import UserErrors
if TYPE_CHECKING:
from opta.layer import Layer
from opta.module import Module
class GcpGkeProcessor(ModuleProcessor):
def __init__(self, module: "Module", layer:... |
from . import constants as _c
from .client_auth import KrakenAuth
from .client_public import KrakenPublic
__all__ = [
'Kraken',
]
class Kraken:
# Enum Types
Currency = _c.Currency
Symbol = _c.Symbol
# Clients
Auth = KrakenAuth
Public = KrakenPublic
|
# Generated by Django 3.2.4 on 2021-08-06 18:27
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
import django.utils.timezone
class Migration(migrations.Migration):
initial = True
dependencies = [
migrations.swappable_dependency(settings.AUT... |
# -*- coding: utf-8 -*-
"""Version information for :mod:`geometric_graphs`.
Run with ``python -m geometric_graphs.version``
"""
import os
from subprocess import CalledProcessError, check_output # noqa: S404
__all__ = [
"VERSION",
"get_version",
"get_git_hash",
]
VERSION = "0.0.4-dev"
def get_git_has... |
#!/usr/bin/env python3
numbers = []
with open('numbers', 'r') as data:
numbers = data.read().split(',')
boards = []
with open('boards', 'r') as data:
stuff = data.read()
boardsplit = stuff.split("\n\n")
for board in boardsplit:
intboard = []
lines = board.split("\n")
if len(li... |
#!/usr/bin/env python3
import sys
from pathlib import Path
import unittest
import itertools, re
import colorama
sys.path.insert(0, str(Path(__file__).parent.parent))
from collections import OrderedDict
dict = OrderedDict
import {{cookiecutter.package_name}}
from {{cookiecutter.package_name}} import *
class Tests(... |
# coding: utf-8
"""JupyterLab command handler"""
# Copyright (c) Jupyter Development Team.
# Distributed under the terms of the Modified BSD License.
import contextlib
import errno
import hashlib
import itertools
import json
import logging
import os
import os.path as osp
import re
import shutil
import stat
import site... |
"""Base implementation of event loop.
The event loop can be broken up into a multiplexer (the part
responsible for notifying us of I/O events) and the event loop proper,
which wraps a multiplexer with functionality for scheduling callbacks,
immediately or at a given time in the future.
Whenever a public API takes a c... |
# 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
from... |
# encoding: utf-8
import random
from sina.cookies import cookies, init_cookies
from sina.user_agents import agents
class UserAgentMiddleware(object):
""" 换User-Agent """
def process_request(self, request, spider):
agent = random.choice(agents)
request.headers["User-Agent"] = agent
class Coo... |
# Single projection original code
import argparse
import cv2
import numpy as np
import math
import os
from objloader_simple import *
# PARAMETERS
THRESHOLD = 10 # min number of matches to be recognized
# 105 for mark4, 65 - mark2
# for sift: 10 for mark4
SIZE = 3 # size for the display obj
# 3 for rat,fox, 1 for wol... |
"""Argparser module for Pod runtimes"""
import argparse
from jina.enums import PollingType, SchedulerType, PodRoleType
from jina.parsers.helper import add_arg_group, _SHOW_ALL_ARGS
def mixin_base_pod_parser(parser):
"""Add mixin arguments required by :class:`BasePod` into the given parser.
:param parser: th... |
# coding: utf-8
"""
Memsource REST API
Welcome to Memsource's API documentation. To view our legacy APIs please [visit our documentation](https://wiki.memsource.com/wiki/Memsource_API) and for more information about our new APIs, [visit our blog](https://www.memsource.com/blog/2017/10/24/introducing-rest-apis... |
# Copyright (c) 2011 OpenStack Foundation
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless ... |
#Exercise 9 -printing, printing, printing #Use the comments here to print out
#the markdown comments on the
#Jupyter notebooks.
#------
#- Write down the code to apply more about the codes learnt;
#```python
#```code
#```
... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
result = {
u"field_a": u"name",
u"field_b": 43,
u"repeated_field": 1420748978.892028,
u"record": {
u"name": u"name",
u"float": 43.2
}
}
|
#!/usr/bin/env python
# -*- coding: utf8 -*-
"""
SAMI XJoin
This script simply joins the four existing extensions inside a FITS file
created during observations with SAMI (SAM Imager). During the reduce,
it also fits a 2nd degree polynomium to the OVERSCAN region that is
subtracted from the corresp... |
"""Camera platform that receives images through HTTP POST."""
import asyncio
from collections import deque
from datetime import timedelta
import logging
import aiohttp
import async_timeout
import voluptuous as vol
from homeassistant.components.camera import (
PLATFORM_SCHEMA,
STATE_IDLE,
STATE_RECORDING,
... |
from ._abstract import AbstractScraper
from ._utils import get_minutes, normalize_string
class TudoGostoso(AbstractScraper):
@classmethod
def host(cls):
return 'tudogostoso.com.br'
def title(self):
return normalize_string(self.soup.find('h1').get_text())
def total_time(self):
... |
import numpy as np
from sklearn.metrics import precision_recall_fscore_support
from sklearn.metrics import accuracy_score
from sklearn.metrics import mean_squared_error
def evaluation(args):
'''
We use f-score, accuracy, MSE to evaluation the performance of different models.
Here, the best model is selecte... |
from model.contact import Contact
import random
from selenium.webdriver.support.wait import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
def test_delete_some_contact_via_main_view(app, db,check_ui):
if len(db.get_contact_list()) == 0:
app.contact.add(Contact(first... |
from dagster import Dict, Field, Int, PermissiveDict, String
from .types import S3ACL
def put_object_configs():
return Field(
Dict(
fields={
'ACL': Field(
S3ACL, description='The canned ACL to apply to the object.', is_optional=True
),
... |
from constants.statuses import BaseStatuses, StatusOptions
from constants.unknown import UNKNOWN
class JobLifeCycle(BaseStatuses):
"""Experiment lifecycle
Props:
* CREATED: created.
* BUILDING: This includes time before being bound to a node,
as well as time spent pulling ... |
# https://leetcode.com/problems/maximum-subarray/
# Using Kadanes Algorithm
class Solution(object):
def maxSubArray(self, nums):
"""
:type nums: List[int]
:rtype: int
"""
maxCurrent = maxGlobal = nums[0]
if (len(nums) == 1):
maxGlobal = nums[0]
eli... |
"""This script is used to measure output dispersion score of synthetic datasets
"""
import os
import sys
import numpy as np
import torch
import random
import tqdm
import time
from pathlib import Path
from os.path import join
from model.model import EncoderDecoder
sys.path.append(join(os.path.dirname(os.path.abspath(__f... |
# 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... |
from setuptools import setup, find_packages
import os
PKG_VERSION = os.environ.get('PACKAGE_VERSION') or '0.2.1'
PKG_NAME = os.environ.get('PACKAGE_NAME') or 'python3-wrapper-vcx'
setup(
name=PKG_NAME,
version=PKG_VERSION,
description='Python 3 wrapper for libcxs',
long_description='None...for now',
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.