text stringlengths 2 999k |
|---|
# -*- coding: utf-8 -*-
import finicityapi.models.institution_address
class Institution(object):
"""Implementation of the 'Institution' model.
A financial institution's Finicity registered details
Attributes:
id (long|int): Finicity’s institution ID
name (string): The name o... |
"""
REST API Documentation for the NRS TFRS Credit Trading Application
The Transportation Fuels Reporting System is being designed to streamline
compliance reporting for transportation fuel suppliers in accordance with
the Renewable & Low Carbon Fuel Requirements Regulation.
OpenAPI spec version: ... |
# Copyright 2021 Huawei Technologies Co., Ltd
#
# 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... |
relação = list()
while True:
nome = str(input('Nome: '))
nota1 = float(input('Primeira nota'))
nota2 = float(input('Segunda nota'))
sn = str(input('Deseja sair? [S/N]'))
média = (nota1 + nota2) / 2
relação.append([nome,[nota1, nota2], média])
if sn in 'Ss':
break
print('Nº | Nome |... |
import numpy as np
from astropy.time import Time
from astropy import units as u
from ...constants import Constants as c
from ...testing import testOrbits
from ..orbits import Orbits
from ..propagate import propagateOrbits
from ..lambert import calcLambert
MU = c.MU
TARGETS = [
"Amor",
"Eros",
"Eugenia",
]... |
import re
from lib.Requests import Requests
from lib.verify import get_list
def get_info(url):
try:
req = Requests()
url = url + '/solr/'
r = req.get(url)
if r.status_code is 200 and 'Solr Admin' in r.text and 'Dashboard' in r.text:
return 'Apache Solr Admin leask: ' +... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Tests for `fake_cytoscapesearch` package."""
import os
import json
import unittest
import shutil
import tempfile
import re
import io
import uuid
from werkzeug.datastructures import FileStorage
import fake_cytoscapesearch
class TestNbgwas_rest(unittest.TestCase):
... |
# Copyright 2018 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, s... |
#!/usr/bin/env python
import os
from setuptools import setup, find_packages
__version__ = "0.2.2"
def read(fname):
try:
with open(os.path.join(os.path.dirname(__file__), fname)) as fp:
return fp.read()
except IOError:
return ""
setup(
name='deltasigma',
version=__version__... |
#!/usr/bin/env python3
import math
from cereal import car
from common.conversions import Conversions as CV
from selfdrive.swaglog import cloudlog
import cereal.messaging as messaging
from selfdrive.car import gen_empty_fingerprint, get_safety_config
from selfdrive.car.interfaces import CarInterfaceBase
# mocked car in... |
import subprocess
import xmltodict
import os
import sys
import logging
import stat
from functools import lru_cache
import iepy
from iepy.utils import DIRS, unzip_from_url
logger = logging.getLogger(__name__)
def detect_java_version():
java_cmd = os.getenv('JAVAHOME')
if not java_cmd:
print('Environ... |
# -*- coding: utf-8 -*-
# Copyright (c) 2019, Youssef Restom and Contributors
# See license.txt
from __future__ import unicode_literals
# import frappe
import unittest
class TestAdministrativeCommunications(unittest.TestCase):
pass
|
# Copyright 2016 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 ag... |
"""Template helper methods for rendering strings with Home Assistant data."""
import base64
import collections.abc
from datetime import datetime, timedelta
from functools import wraps
import json
import logging
import math
from operator import attrgetter
import random
import re
from typing import Any, Iterable, List, O... |
from django.shortcuts import render
from rest_framework import generics, authentication, permissions
from rest_framework.authtoken.views import ObtainAuthToken
from rest_framework.settings import api_settings
# Create your views here.
from user.serializers import UserSerializer, AuthTokenSerializer
class CreateUserVie... |
from videoflow.core import Flow
from videoflow.producers import IntProducer
from videoflow.processors import IdentityProcessor, JoinerProcessor
from videoflow.consumers import CommandlineConsumer
producer = IntProducer(0, 40, 0.1)
identity = IdentityProcessor(fps = 2, nb_tasks = 5, name = 'i1')(producer)
identity1 = I... |
import logging
import time
from contextlib import contextmanager
@contextmanager
def timeit(label=""):
start = time.time()
yield
end = time.time()
logging.info('%s : %s' % (round(end-start, 2), str(label)))
def wrap_time(label):
def wrap(f):
def decorated(*args, **kwargs):
wi... |
#!/usr/bin/env python
# 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
# "Li... |
#!/usr/bin/env python
"""
This class reads left join dictionary
"""
__author__ = "Dong Liang <liangd@ihep.ac.cn>"
__revision__ = "$Revision: 1.11 $"
import os
from yaml import load_all
from yaml import Loader
def load_file(filename):
"""load all datas from yamlfile"""
ifile = open(filename, 'r')
datas =... |
# Copyright 2015-2017 Capital One Services, 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 ... |
#!/usr/bin/env python3
import os, sys
device = "up5k"
# This script is designed to determine which DSPs have configuration bits
# not in their usual position, as in some cases DSP and IPConnect tiles have
# their config bits swapped
# Unfortunately, arbitrary configurations are not allowed by icecube, so
# we defin... |
#
# Copyright 2012 NVIDIA Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable ... |
# -*- coding: utf-8 -*-
"""
Created on Wed Mar 14 14:43:49 2018
@author: Victor Onink
"""
from parcels import FieldSet, ParticleSet, JITParticle, AdvectionRK4,ErrorCode, plotTrajectoriesFile,Variable
from datetime import timedelta, datetime
import numpy as np
from operator import attrgetter
import math
#We can add or... |
#!/usr/bin/python3
# -*- coding: utf-8 -*-
# @Author: Sangeet Sagar
# @Date: 2021-01-10 16:35:59
# @Email: sasa00001@stud.uni-saarland.de
# @Organization: Universität des Saarlandes
# @Last Modified time: 2021-01-14 23:19:57
"""
Implementation of IBM Model 1, which is used in statistical
machine translation to tra... |
import time
from backend.util.crypto_hash import crypto_hash
from backend.util.hex_to_binary import hex_to_binary
from backend.config import MINE_RATE
GENESIS_DATA = {
'timestamp': 1,
'last_hash': 'genesis_last_hash',
'hash': 'genesis_hash',
'data': [],
'difficulty': 3,
'nonce': 'genesis_nonce... |
from pyswagger import SwaggerApp, errs
from ..utils import get_test_data_folder
from pyswagger.primitives import Model, Array
from pyswagger.io import SwaggerRequest
import unittest
app = SwaggerApp._create_(get_test_data_folder(version='1.2', which='wordnik'))
class SwaggerRequest_Pet_TestCase(unittest.TestCase):... |
# Include basic configurations
from pandas import read_csv
from matplotlib import pyplot
from sklearn.model_selection import train_test_split
from sklearn.model_selection import cross_val_score
from sklearn.model_selection import StratifiedKFold
# compare algorithms
from sklearn.linear_model import LogisticRegression... |
# -*- coding: utf-8 -*-
# pylint: disable=locally-disabled, multiple-statements
# pylint: disable=fixme, line-too-long, invalid-name
# pylint: disable=W0703
""" Coronavirus-Extractor: An effort to track potential fake news sources """
__author__ = 'EA1HET'
__date__ = "23/03/2020"
import re
import date
import datetim... |
#!/usr/bin/env python3
# Copyright (c) 2014-2017 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test the listtransactions API."""
from test_framework.test_framework import BitcoinTestFramework
from ... |
from __future__ import print_function
import json
import logging
import os
import time
from datetime import datetime, timedelta
from airflow import models
from airflow.hooks.postgres_hook import PostgresHook
from airflow.operators.python_operator import PythonOperator
logging.basicConfig()
logging.getLogger().setLev... |
from typing import Dict
from setuptools import find_packages, setup
def get_version() -> str:
version: Dict[str, str] = {}
with open("dagster_spark/version.py") as fp:
exec(fp.read(), version) # pylint: disable=W0122
return version["__version__"]
if __name__ == "__main__":
ver = get_versi... |
# 星座
zodiac_name = ('魔蝎座', '水瓶座', '双鱼座', '白羊座', '金牛座', '双子座', '巨蟹座',
'狮子座', '处女座', '天平座', '天蝎座', '射手座')
zodiac_days = ((1, 20), (2, 19), (3, 21), (4, 21), (5, 21), (6, 22), (7, 23),
(8, 23), (9, 23), (10, 23), (11, 23), (12, 23))
# 元祖的比较
print((4) > (5))
# 这里的元祖可以看作是 421 和 520 标记大小
print(... |
# Simulate a Poisson point process on a triangle.
# Author: H. Paul Keeler, 2018.
# Website: hpaulkeeler.com
# Repository: github.com/hpaulkeeler/posts
# For more details, see the post:
# hpaulkeeler.com/simulating-a-poisson-point-process-on-a-triangle/
import numpy as np; # NumPy package for arrays, random nu... |
from django.urls import include, path
from rest_framework.routers import DefaultRouter
from api.views import (BreedViewSet, CommentViewSet, GroupViewSet, PetViewSet,
PostViewSet, SpeciesViewSet, UserCodeViewSet,
UserTokenViewSet, UserViewSet)
router = DefaultRouter()
rout... |
from marshmallow import validate
from marshmallow.fields import Boolean
from marshmallow.fields import DateTime as Date_Time
from marshmallow.fields import Float, Integer, List, Nested, Raw, Str
from schema.base import Base_Schema
from utils.datetime import FORMAT
_all__ = [
'Config_Request_Schema',
'Config_A... |
#!/usr/bin/env python3
import mariadb
from flask import Flask, jsonify
app = Flask(__name__)
app.config.from_json('config.json')
config = {
'port': 3306,
'user': 'awendelk',
'host': app.config['MARIADB_HOST'],
'password': app.config['MARIADB_PASSSWORD'],
'database': 'demo'
}
@app.route('/', m... |
#!/usr/bin/env python
############################################################################
# Copyright (C) by GFZ Potsdam #
# #
# You can redistribute and/or modify this program under the ... |
#
# PySNMP MIB module Nortel-Magellan-Passport-BaseRoutingMIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/Nortel-Magellan-Passport-BaseRoutingMIB
# Produced by pysmi-0.3.4 at Wed May 1 14:26:32 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwan... |
from http.server import BaseHTTPRequestHandler
from api.getters import *
class handler(BaseHTTPRequestHandler):
def do_GET(self):
args = get_args_from_url(self.requestline)
course_index = args[constant.ARG_COURSE]
school_index = args[constant.ARG_SCHOOL] + 1
year = args[constant.... |
import base64
import numpy as np
from . import _marching_cubes_lewiner_luts as mcluts
from . import _marching_cubes_lewiner_cy
from ._marching_cubes_classic import _marching_cubes_classic
def marching_cubes(volume, level=None, *, spacing=(1., 1., 1.),
gradient_direction='descent', step_size=1,
... |
from typing import List
class Solution:
def sortedSquares(self, A: List[int]) -> List[int]:
return sorted([i ** 2 for i in A])
|
"""Try the environment to see how the agent moves at random."""
import random
import time
import argparse
from gym.wrappers import TimeLimit
from gym_sapientino_case.env import SapientinoCase
def main():
"""Just visualizes a random exploration of the environment."""
# One option
parser = argparse.Argum... |
import torch
import torch.nn.functional as F
from ..box_utils import decode, jaccard, index2d
from Yolact_res101.utils import timer
from Yolact_res101.data import cfg, mask_type
import numpy as np
class Detect(object):
"""At test time, Detect is the final layer of SSD. Decode location preds,
apply non-maxi... |
#!/usr/bin/env python
"""
Command line utility for executing MongoDB tests of all kinds.
"""
from __future__ import absolute_import
import os.path
import random
import sys
import time
# Get relative imports to work when the package is not installed on the PYTHONPATH.
if __name__ == "__main__" and __package__ is Non... |
import tensorflow as tf
def create_translation_tf_encode_func(tokenizer_pt, tokenizer_en):
def encode(lang1, lang2):
lang1 = [tokenizer_pt.vocab_size] + tokenizer_pt.encode(lang1.numpy()) + [tokenizer_pt.vocab_size + 1]
lang2 = [tokenizer_en.vocab_size] + tokenizer_en.encode(lang2.numpy()) + [tok... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Copyright © 2020 Michael J. Hayford
"""
.. Created on Thu Dec 24 17:17:36 2020
.. codeauthor: Michael J. Hayford
"""
import warnings
from openpyxl import load_workbook
from openpyxl import worksheet
from opticalglass import ohara
import opticalglass.glass as catgl
fr... |
import os
from multiprocessing import Process
from flask import Flask
from flask_restplus import Api
from flask_jwt_simple import JWTManager
from flask_sqlalchemy import SQLAlchemy
from flask_marshmallow import Marshmallow
from micro_utils.api_gateway.routes import list_routes
from micro_utils.service_registry.regist... |
#coding=utf-8
from main.helpers import templated,get_online_users
from flask_login import login_required,current_user
from flask import Response,current_app,request,flash
from flask_sse import sse
import psutil
from time import sleep
from . import bp
from main.decorators import admin_required
from .forms import Prod... |
# Copyright (c) 2018 gevent community
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, di... |
import logging
import tempfile
from six import string_types, text_type
from six.moves import shlex_quote
from galaxy import exceptions
from galaxy.util import odict
from galaxy.util.none_like import NoneDataset
from galaxy.util.object_wrapper import wrap_with_safe_string
log = logging.getLogger(__name__)
# Fields i... |
from flask import render_template, url_for, flash, redirect, request
from website import app, db, login_manager
from website.forms import LinkForm, EditForm, LoginForm
from website.models import Link, User
import json
import re
from flask_login import LoginManager, login_user, current_user, logout_user, login_required
... |
import os
import sys
from setuptools import find_packages
from numpy.distutils.core import setup
# Project Information
DISTNAME = "deep-forest"
DESCRIPTION = "Deep Forest"
with open("README.rst") as f:
LONG_DESCRIPTION = f.read()
MAINTAINER = "Yi-Xuan Xu"
MAINTAINER_EMAIL = "xuyx@lamda.nju.edu.cn"
URL = "https://... |
num = int(input('Digite um número: '))
tab = num * 0, num * 1, num * 2, num * 3, num * 4, num * 5, num * 6, num * 7, num * 8, num * 9, num * 10
print('A tabuada de {} é {} ' .format(num, tab)) |
from stst.modules.features import Feature
from stst import utils
class DependencyGramFeature(Feature):
def __init__(self, convey='count', **karwgs):
super(DependencyGramFeature, self).__init__(**karwgs)
self.convey = convey
self.feature_name += '-%s' % (convey)
def extract_information... |
import haydi as hd
from haydi.base import cnf as hdc
from haydi.base import basictypes as hdt
from haydi import USet
def test_atom_is_canonical():
ax = USet(3, "a")
c = [a for a in ax.all() if hdc.is_canonical(a)]
assert c == [ax.get(0)]
def test_const_is_canonical():
assert hdc.is_canonical(0)
... |
import urllib.parse
from django.contrib.auth import get_user_model
from django.test import Client, TestCase
from django.urls import reverse
from dcim.constants import CABLE_TYPE_CAT6, IFACE_FF_1GE_FIXED
from dcim.models import (
Cable, Device, DeviceRole, DeviceType, Interface, InventoryItem, Manufacturer, Platfo... |
import datetime
import pytest
from inventorymgr.db import db
from inventorymgr.db.models import (
BorrowableItem,
BorrowState,
LogEntry,
TransferRequest,
User,
)
def test_get_transfer_requests_unauthenticated(client):
response = client.get("/api/v1/transferrequests")
assert response.stat... |
"""Campaign Manager Conversion Uploader beam module."""
# 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unl... |
# Description: Display all symmetry mates in in a 1 x 4 x 4 array. Uses supercell.py in $HOME/Scripts/PyMOLscripts/.
# Source: placeHolder
"""
cmd.do('run $HOME/${1:Scripts/PyMOLscripts/}supercell.py;')
cmd.do('supercell 1, 4, 4, , ${2:orange}, ${3:supercell1}, 1;')
"""
cmd.do('run $HOME/Scripts/PyMOLscripts/supe... |
# -*- python -*-
# This software was produced by NIST, an agency of the U.S. government,
# and by statute is not subject to copyright in the United States.
# Recipients of this software assume all responsibilities associated
# with its operation, modification and maintenance. However, to
# facilitate maintenance we as... |
import cv2
import math
import numpy as np
import pandas as pd
import urllib
import os
import requests
import threading
import redis
face_cascade = cv2.CascadeClassifier('haarcascade_frontalface_default.xml')
eyes_cascade = cv2.CascadeClassifier('haarcascade_eye.xml')
def analyse_video(video_path, frame_rate):
distan... |
# 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.
import inspect
from typing import Any, Dict, List
from fairseq import metrics, utils
from fairseq.dataclass import FairseqDataclass
from fair... |
#!/usr/bin/env python3
#-*- coding: utf-8 -*-
"""
- Website : https://www.stretchsense.com
- Important : This StretchSense Library has been designed to enable the connection of one or more "StretchSense Sensor" and "StretchSense IC Boards" to your Raspberry Pi
- Author : Louis Germain
- Copyright :... |
import sst
from mhlib import componentlist
# Global variables
debugScratch = 0
debugL1 = 0
debugL2 = 0
debugL3 = 0
debugCore0 = 0
debugCore1 = 0
core_clock = "2GHz"
# Define the simulation components
comp_cpu0 = sst.Component("cpu0", "memHierarchy.ScratchCPU")
comp_cpu0.addParams({
"scratchSize" : 65536, # 64K ... |
import numpy as np
import matplotlib.pyplot as plt
from scipy import integrate
#-------------------------------------------------------------------------------
def scatter(radius, theta, phi):
"""compute the scattering angle
Parameters
----------
radius : float, int
radius to the scattering p... |
"""dateTester URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/3.1/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... |
"""
HTML Widget classes
"""
from __future__ import unicode_literals
import copy
from itertools import chain
import warnings
from django.conf import settings
from django.forms.utils import flatatt, to_current_timezone
from django.utils.datastructures import MultiValueDict, MergeDict
from django.utils.html import cond... |
"""Tools for use in AppleEvent clients and servers.
pack(x) converts a Python object to an AEDesc object
unpack(desc) does the reverse
packevent(event, parameters, attributes) sets params and attrs in an AEAppleEvent record
unpackevent(event) returns the parameters and attributes from an AEAppleEvent record
Plus... ... |
# -*- coding: utf-8 -*-
import requests_mock
import json
import logging
from .utils import requiresauthentication
mockserverlogger = logging.getLogger("LogInsightMockAdapter")
class MockedVersionMixin(requests_mock.Adapter):
def __init__(self, **kwargs):
super(MockedVersionMixin, self).__init__(**kwargs... |
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
import os
from setuptools import setup
REQUIRES = [
"azure-cognitiveservices-language-luis==0.2.0",
"botbuilder-schema==4.12.0",
"botbuilder-core==4.12.0",
"aiohttp==3.6.2",
]
TESTS_REQUIRES = ["aiounittest>... |
from typing import Any, Tuple, TextIO
import swan.io.ioutil
import swan.util
import os
import platform
import datetime
class File:
""" Describes a file and allows for the aplication of usefull functions.
This class describes a file with usefull information like permissions size and other features
like th... |
"""
This module lets you practice:
-- ITERATING (i.e. LOOPING) through a SEQUENCE
-- Using OBJECTS
-- DEFINING functions
-- CALLING functions
Authors: David Mutchler, Dave Fisher, Valerie Galluzzi, Amanda Stouder,
their colleagues and Logan Cody.
""" # DONE: 1. PUT YOUR NAME IN THE ABOVE LINE.
impor... |
import discord
from discord.ext import commands
from time import sleep
from discord.utils import get
BOT_TEST = 749473757843947671
BOT_LOGS = 786084620944146504
GUILD_ID = 742797665301168220
class verification(commands.Cog):
def __init__(self, client):
self.client = client
self.dat... |
CONFIG_BINDIR="<CONFIG_BINDIR>"
CONFIG_LIBDIR="<CONFIG_LIBDIR>"
CONFIG_LOCALSTATEDIR="<CONFIG_LOCALSTATEDIR>"
CONFIG_SYSCONFDIR="<CONFIG_SYSCONFDIR>"
CONFIG_SYSCONFDIR_DSC="<CONFIG_SYSCONFDIR_DSC>"
CONFIG_OAAS_CERTPATH="<OAAS_CERTPATH>"
OMI_LIB_SCRIPTS="<OMI_LIB_SCRIPTS>"
PYTHON_PID_DIR="<PYTHON_PID_DIR>"
DSC_NAMESPACE... |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
#
# Copyright 2014 OpenStack Foundation
#
# 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... |
#!/usr/bin/env python3
from http.server import HTTPServer, BaseHTTPRequestHandler
import os
# used for development on http://localhost:8000/
class StaticServer(BaseHTTPRequestHandler):
def do_GET(self):
root = os.path.join(os.path.dirname(os.path.dirname(os.path.abspath(__file__))), 'html')
root... |
def binary_search(items_list, item,
recursive=False, first_ptr=-1, last_ptr=-1):
"""
Searches the list 'items_list' for an item 'item'
using binary search algorithm
>>> from pydsa import binary_search
>>> a = [1, 2, 7, 9, 10, 33, 56, 70, 99]
>>> binary_search(a, 9)
3
>... |
# Copyright (c) 2017 Mirantis, 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... |
# Copyright The PyTorch Lightning 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 i... |
class Solution:
def nextGreaterElement(self, n: int) -> int:
num = list(str(n))
i = len(num) - 2
while i >= 0:
if num[i] < num[i + 1]:
break
i -= 1
if i == -1:
return -1
j = len(num) - 1
while num[j] <= nu... |
import logging
from aiohttp import web
from chatbrick.brick import find_custom_brick
logging.basicConfig(level=logging.DEBUG)
logger = logging.getLogger(__name__)
async def telegram_get(request):
data = request.query
logger.info(data)
return web.Response(text='null', status=200)
async def telegram_pos... |
# -*- coding: utf-8 -*-
import logging
from PyQt5.QtCore import Qt
from PyQt5.QtGui import QPainter
class Board:
def __init__(self, screen):
logging.debug("Board constructor")
self.toolbar_margines = 40
self.screen = screen
self.redraw()
@property
def size_of_one_tile(sel... |
# -*- coding: utf-8 -*-
# Copyright 2019 Cohesity Inc.
class PrivilegeIdUserEnum(object):
"""Implementation of the 'PrivilegeId_User' enum.
TODO: type enum description here.
Attributes:
KPRINCIPALVIEW: TODO: type description here.
KPRINCIPALMODIFY: TODO: type description here.
KA... |
from colorama import Style
from datetime import datetime
import dbt.events.functions as this # don't worry I hate it too.
from dbt.events.base_types import Cli, Event, File, ShowException, NodeInfo, Cache
from dbt.events.types import EventBufferFull, T_Event, MainReportVersion, EmptyLine
import dbt.flags as flags
# T... |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes ... |
from graphlib import TopologicalSorter
table_references = {
"customers": set(),
"accounts": {"customers"},
"products": set(),
"orders": {"accounts", "customers"},
"order_products": {"orders", "products"},
}
if __name__ == "__main__":
sorter = TopologicalSorter(table_references)
print(list(... |
import collections
import torch
import itertools
from typing import List
import math
import numpy as np
SSDBoxSizes = collections.namedtuple('SSDBoxSizes', ['min', 'max'])
SSDSpec = collections.namedtuple('SSDSpec', ['feature_map_size', 'shrinkage', 'box_sizes', 'aspect_ratios'])
def generate_ssd_priors(specs: List... |
days = "Mon Tue Wed Thu Fri Sat Sun"
months = "\nJan\nFeb\nMar\nApr\nMay\nJun\nJul\nAug"
print "Here are the days: ", days
print "Here are the months: ", months
print """
There's something going on here.
With the three double-quotes.
We'll be able to type as much as we like.
Even 4lines if we want, or 5, or 6.
"""
|
from django import forms
from django.utils.safestring import mark_safe
from eulcommon.searchutil import search_terms
class KeywordSearchForm(forms.Form):
"Simple keyword search form"
kw_help = '''enter one or more terms;
use * or ? for wildcards, quotes for an "exact phrase"'''
keywords = forms.CharFi... |
from utils.dependency_injection.container import container
from utils.dependency_injection.provider import provider |
import numpy as np
import os
from qtim_tools.qtim_utilities.format_util import convert_input_2_numpy
from qtim_tools.qtim_utilities.nifti_util import save_numpy_2_nifti
from qtim_tools.test_data.load import load_test_file
from qtim_tools.qtim_utilities.file_util import nifti_splitext, grab_files_recursive
def correla... |
# model settings
model = dict(
type="FasterRCNN",
pretrained="open-mmlab://resnext101_32x4d",
backbone=dict(
type="ResNeXt",
depth=101,
groups=32,
base_width=4,
num_stages=4,
out_indices=(0, 1, 2, 3),
frozen_stages=1,
norm_cfg=dict(type="BN", r... |
# Copyright (c) 2019 Intel Corporation. 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 applicabl... |
# Copyright 2013-2019 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 PyStatsmodels(PythonPackage):
"""Statistical computations and models for use with SciPy"""... |
from pathlib import Path
import pandas as pd
from data_pipeline.etl.base import ExtractTransformLoad
from data_pipeline.utils import get_module_logger, download_file_from_url
logger = get_module_logger(__name__)
class CDCLifeExpectancy(ExtractTransformLoad):
def __init__(self):
self.FILE_URL: str = "htt... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from slipstream.job.base import main
from slipstream.job.executor import Executor
if __name__ == '__main__':
main(Executor)
|
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
class implementations for real-time 3D feature extraction
"""
import pandas as pd
import os
import glob
import numpy as np
from tomo_encoders import *
from tensorflow import keras
from tomo_encoders import Patches
import tensorflow as tf
from tensorflow.keras.mode... |
# Generated by Django 2.1.14 on 2020-01-26 15:04
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('products', '0001_initial'),
]
operations = [
migrations.RenameField(
model_name='product',
old_name='productcategoryid',
... |
from Compiler.program import Program
from .GC import types as GC_types
import sys
def run(args, options):
""" Compile a file and output a Program object.
If options.merge_opens is set to True, will attempt to merge any
parallelisable open instructions. """
prog = Program(args, options)
... |
# UPDATE VERSIONS SCRIPT by Chris Pyles
# Updates version numbers in all files that need to know the exact version
# Execute this file in order to update all those files. Add any files that
# need updating to the FILES_WITH_VERSIONS variable. Update the
# CURRENT_VERSION and NEW_VERSION variables before running.
# ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.