text stringlengths 2 999k |
|---|
# -*- coding: utf-8 -*-
# Copyright (C) 2020. Huawei Technologies Co., Ltd. All rights reserved.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the MIT License.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without ev... |
from setuptools import setup, find_packages
with open("README.md", "r", encoding="utf-8") as f:
long_description = f.read()
setup_requirements = [
"wheel>=0.35.1",
]
requirements = ["Pillow>=7.2.0"]
test_requirements = [
"flake8>=3.8.3",
"pytest>=5.4.3",
]
dev_requirements = [
*setup_requiremen... |
from collections import OrderedDict
import pytest
from company.constants import RegistrationNumberChoices
from company.models import Country
from company.serialisers import CompanySerialiser
from .factories import CompanyFactory, IndustryCodeFactory, PrimaryIndustryCodeFactory, RegistrationNumberFactory
@pytest.mar... |
"""
Django settings for drf_sample project.
Generated by 'django-admin startproject' using Django 1.10.1.
For more information on this file, see
https://docs.djangoproject.com/en/1.10/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.10/ref/settings/
"""
import ... |
import os
from flask import render_template, url_for, redirect
from werkzeug.utils import secure_filename
from app import app
from app.forms import ScriptForm
from Script_reader import table_creator
@app.route('/', methods=['POST', 'GET'])
@app.route('/index', methods=['POST', 'GET'])
def index():
form = ScriptF... |
import pandas as pd
import numpy as np
from collections import defaultdict
import RemovingDataSolns as s
# Question 1
def prop_sals_test(prop_sals):
'''
INPUT prop_sals - a float as the percent of missing values in the salary column
Prints statement related to the correctness of the solution of ... |
# import sharpy.utils.settings as settings
# import sharpy.utils.exceptions as exceptions
# import sharpy.utils.cout_utils as cout
import numpy as np
import importlib
import unittest
import os
import sharpy.utils.cout_utils as cout
class TestCoupledPrescribed(unittest.TestCase):
"""
"""
@classmethod
... |
# coding: utf-8
"""
Isilon SDK
Isilon SDK - Language bindings for the OneFS API # noqa: E501
OpenAPI spec version: 9
Contact: sdk@isilon.com
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
import pprint
import re # noqa: F401
import six
from isi_sdk_8_2_2.models.cloud_p... |
from django.urls import include, path
from rest_framework import routers
from . import views
from .views import *
router = routers.DefaultRouter()
router.register(r"tracks", views.TrackViewSet)
urlpatterns = [
path("", include(router.urls)),
path('playlist/add', PlaylistAPIView.as_view()),
path('allplayl... |
# Данный пример выводит изображения myImage_1 и myImage_2.
# Создаём изображение "смайлик".
myImage_1 = [ 0b00111100, #
0b01000010, #
0b10100101, # ... |
#!/usr/bin/env python3
# Copyright (c) 2016 Anki, 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 in the file LICENSE.txt or at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unles... |
from django.http import HttpResponse
from django.views.decorators.http import require_http_methods
from django.shortcuts import render
import re
# Create your views here.
@require_http_methods(['GET', 'POST'])
def echo_0(request):
if request.method == 'GET' and something == None:
return render(request,'tem... |
from kivy.app import App
from kivy.factory import Factory
from kivy.properties import ObjectProperty
from kivy.lang import Builder
from kivy.clock import Clock
from kivy.uix.label import Label
from electrum_commercium_gui.kivy.i18n import _
from datetime import datetime
from electrum_commercium.util import InvalidPass... |
import math
from typing import List
import numpy
from allennlp.common.util import JsonDict, sanitize
from allennlp.interpret.saliency_interpreters.saliency_interpreter import SaliencyInterpreter
from allennlp.nn import util
@SaliencyInterpreter.register("simple-gradient")
class SimpleGradient(SaliencyInterpreter):
... |
# coding: utf-8
"""
FlashArray REST API
No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
OpenAPI spec version: 2.5
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
import pprint
import re
import six
import typing
from .... |
# Copyright 2019 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 applicable law or agreed to in ... |
# -*- coding: utf-8 -*-
from framework.routing import Rule, json_renderer
from website.addons.github import views
settings_routes = {
'rules': [
# Configuration
Rule(
[
'/project/<pid>/github/settings/',
'/project/<pid>/node/<nid>/github/settings/',
... |
import matplotlib.pyplot as plt
from math import pi
import numpy as np |
# coding=utf-8
# Copyright 2017 The Tensor2Tensor 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... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Copyright 2019, 2020 Matt Post <post@cs.jhu.edu>
#
# 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/LICE... |
import tensorflow as tf
import numpy as np
import os,glob,cv2
import sys,argparse
# First, pass the path of the image
dir_path = os.path.dirname(os.path.realpath(__file__))
image_path=sys.argv[1]
filename = dir_path +'/' +image_path
image_size=128
num_channels=3
images = []
# Reading the image using OpenCV
image = c... |
"""
ARIA -- Ambiguous Restraints for Iterative Assignment
A software for automated NOE assignment
Version 2.3
Copyright (C) Benjamin Bardiaux, Michael Habeck, Therese Malliavin,
Wolfgang Rieping, and Michael Nilges
All rights reserved.
NO W... |
import numpy as np
import torch
import torch.nn.functional as F
import torch.nn as nn
from sklearn.utils import class_weight
from utils.lovasz_losses import lovasz_softmax
import pdb
def make_one_hot(labels, classes):
one_hot = torch.FloatTensor(labels.size()[0], classes, labels.size()[2], labels.size()[3]).zero_... |
from collections import deque
from dataclasses import dataclass
from types import TracebackType
from typing import Deque, Optional, Tuple, Type
from warnings import warn
from ..lowlevel import cancel_shielded_checkpoint, checkpoint, checkpoint_if_cancelled
from ._compat import DeprecatedAwaitable
from ._eventloop impo... |
# Copyright 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 requ... |
"""
Data structures for sparse float data. Life is made simpler by dealing only
with float64 data
"""
from __future__ import division
# pylint: disable=E1101,E1103,W0231,E0202
import warnings
from pandas.compat import lmap
from pandas import compat
import numpy as np
from pandas.core.dtypes.missing import isna, notna... |
import time
import telebot
from Responses import TELE_HI_GREET, TELE_CLASS_CODE
import BacaPdf as pdf
import csvHandler as csvH
with open('API_KEY.txt') as API_KEY:
bot = telebot.TeleBot(API_KEY.read()[:-1])
#Message type check
#ClassCode, TimeInterval, Status, Feedback
messageBool = [False, False,... |
#!/usr/bin/python3
# encoding: utf-8
### python script to interact with Complice
### giovanni, Saturday, April 10, 2021, 2:11 PM
### March 2022 updated to Python 3
import sys
from config import POMOLENGTH, TIMERLENGTH, TOKEN
import complice_post
myInput = sys.argv[1]
if myInput == "startTimer":
complic... |
import unittest
from troposphere import Tags, Template
from troposphere.s3 import Filter, Rules, S3Key
from troposphere.serverless import (
Api, DeadLetterQueue, DeploymentPreference, Function, FunctionForPackaging,
LayerVersion, S3Event, S3Location, SimpleTable,
)
class TestServerless(unittest.TestCase):
... |
import sys
import csv
import time
import calendar
import matplotlib.pyplot as plt
from collections import OrderedDict
from datetime import date, timedelta as td
if __name__ == '__main__':
if len(sys.argv) < 2:
print 'Please insert processed twitdata.csv'
exit()
twitReader = csv.DictReader(ope... |
from django.shortcuts import render
from django.http import JsonResponse
from django.http import HttpResponse, HttpResponseNotFound
from django.contrib.auth.decorators import login_required
from floweditor.models import B1if
from easywebdavbiffy import *
import xmltodict
import StringIO
from zipfile import ZipFile
from... |
# -*- coding: utf-8 -*-
# Copyright 2011 Google Inc. All Rights Reserved.
# Copyright 2011, Nexenta Systems 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/... |
from math import sqrt
from math import pi
import json
import tf
from geometry_msgs.msg import Quaternion
def dynamic_euclid_dist(a, b):
o = 0
for i in range(len(a)):
o += (a[i]-b[i])**2
return sqrt(o)
def quaternion_from_euler(roll, pitch, yaw):
'''
From HSR's utils.py
'''
q = tf.t... |
import re
from anchore_engine.apis.authorization import (
ActionBoundPermission,
Permission,
RequestingAccountValue,
get_authorizer,
)
from anchore_engine.apis.context import ApiRequestContextProxy
from anchore_engine.apis.exceptions import BadRequest
from anchore_engine.clients.services import interna... |
import io
import re
import sys
from setuptools import setup
if sys.version_info < (3, 5):
sys.exit('Sorry, Python < 3.5 is not supported.')
with io.open('README.rst', 'rt', encoding='utf8') as f:
readme = f.read()
with io.open('pygclip/__init__.py', 'rt', encoding='utf8') as f:
version = re.search(r'__ve... |
from setuptools import setup
setup(
name='unsolve',
version='0.1',
py_modules=['unsolve'],
install_requires=[
'Click',
],
entry_points='''
[console_scripts]
unsolve=unsolve:cli
''',
)
|
#!/usr/bin/env python3
import sys
import re
import configparser
def app(specs, spec):
if not specs:
return spec
else:
delimiter = "\n\n"
return delimiter.join((specs, spec))
# TODO: for Python 3.5 or higher: z = {**x, **y}
def merge_two_dicts(x, y):
z = dict(x)
z.update(y)
re... |
import logging
import mist.api.users.models
import mist.api.auth.models
import mist.api.tag.models
log = logging.getLogger(__name__)
class AuthContext(object):
def __init__(self, user, token):
assert isinstance(user, mist.api.users.models.User)
self.user = user
assert isinstance(token... |
import json
import base64
from tests import TestBase
class TestAuth(TestBase):
def setUp(self):
super(TestAuth, self).setUp()
self.data_user = {
'username': 'nicolas',
'password': 'password',
}
def test_auth(self):
self.app.post(
... |
from django.contrib import auth
from django.conf import settings
from django.utils.deprecation import MiddlewareMixin
class FakeLoginMiddleware(MiddlewareMixin):
"""
Login using ?fakeuser=USERNAME as long as settings.DEBUG is true.
This is for DEVELOPMENT ONLY.
"""
def process_request(self, requ... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
# vi: set ft=python sts=4 ts=4 sw=4 et:
# @Author: oesteban
# @Date: 2017-06-13 09:42:38
import os.path as op
import sys
def main():
from mriqc.__about__ import __version__
print(__version_... |
import claripy
import logging
from archinfo.arch_arm import is_arm_arch
l = logging.getLogger(name=__name__)
#l.setLevel(logging.DEBUG)
# pylint: disable=R0911
# pylint: disable=W0613
# pylint: disable=W0612
# pylint: disable=invalid-unary-operand-type
###############
### Helpers ###
###############
# There might b... |
# Copyright 2018, The TensorFlow Federated 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... |
from __future__ import print_function
import sys, os, time
sys.path.insert(1, os.path.join("..","..",".."))
import h2o
from tests import pyunit_utils
from h2o.targetencoder import TargetEncoder
"""
This test is used to check Rapids wrapper for java TargetEncoder
"""
def test_target_encoding_parameters():
print("C... |
import datasets.import_datasets as im
import pandas as pd
#Takes a very long time to run, probably not worth running when the output
datasets = ["BMS1",
"BMS2",
"toydata"
"uci_retail",
"mushroom",
"Belgian_retail",
"chess",
"conn... |
import sys; sys.path.append('..')
from API.tools import EarlyStopping
from API.exp_basic import Exp_Basic
import numpy as np
import torch
import torch.nn as nn
from torch import optim
from ex_ablation.model import ConvUnet
from API.dataloader import load_data
import json
import os
import time
import logging
from tqd... |
from nose.exc import SkipTest
import os
import sys
import unittest
try:
maketrans = str.maketrans
except AttributeError:
from string import maketrans
import rdflib
"""
SWAP N3 parser test suite
"""
rdf = rdflib.Namespace("http://www.w3.org/1999/02/22-rdf-syntax-ns#")
rdfs = rdflib.Namespace("http://www.w3.or... |
"""
This module contains shared fixtures.
"""
import json
import pytest
import selenium.webdriver
@pytest.fixture
def config(scope='session'):
# Read JSON file
with open('config.json') as config_file:
config = json.load(config_file)
# Assert values are acceptable
assert config['browser'] in ['Firefox'... |
# coding: utf-8
import re
import six
from huaweicloudsdkcore.utils.http_utils import sanitize_for_serialization
class ComputeFlavorGroupsInfo:
"""
Attributes:
openapi_types (dict): The key is attribute name
and the value is attribute type.
attribute_map (dict): Th... |
import project_RL.linear_sarsa.train
from project_RL.linear_sarsa.sarsa_lambda_agent import *
|
"""sc-githooks - Git routines
Copyright (c) 2021 Scott Lau
Portions Copyright (c) 2021 InnoGames GmbH
Portions Copyright (c) 2021 Emre Hasegeli
"""
from os.path import isabs, join as joinpath, normpath
from subprocess import check_output
from githooks.utils import get_exe_path, get_extension, decode_str
git_exe_pat... |
import numpy as np
import os
import sys
import cntk
from cntk.layers import Convolution2D, MaxPooling, Dense, Dropout
from utils import *
import argparse
from cntk.train.distributed import Communicator, mpi_communicator
# Hyperparams
EPOCHS = 1
BATCHSIZE = 64 * 4
LR = 0.01
MOMENTUM = 0.9
N_CLASSES = 10
def create_bas... |
# File : transformer.py
# Author : Zhengkun Tian
# Email : zhengkun.tian@outlook.com
import logging
import torch
import torch.nn as nn
from otrans.module.pos import MixedPositionalEncoding, RelPositionalEncoding
from otrans.module.ffn import PositionwiseFeedForward
from otrans.module.attention import MultiHeadedSel... |
# -*- coding: utf-8 -*-
"""Application configuration.
Most configuration is set via environment variables.
For local development, use a .env file to set
environment variables.
"""
from os import path, urandom
class Config:
"""Application Configuration."""
from environs import Env
env = Env()
env.r... |
# Configuration file for the Sphinx documentation builder.
#
# This file only contains a selection of the most common options. For a full
# list see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html
# -- Path setup --------------------------------------------------------------
# If ex... |
# Copyright 2017 StreamSets 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 writi... |
import json
from django.test import TestCase
from django.test import Client
class TestHealthCheck(TestCase):
def setUp(self):
self.c = Client()
def test_is_service_online_route(self):
resp = self.c.get("/health/")
self.assertEquals(json.loads(resp.content), {"status": "online"})
|
# -*- coding: utf-8 -*-
#
# Copyright 2010 British Broadcasting Corporation and Kamaelia Contributors(1)
#
# (1) Kamaelia Contributors are listed in the AUTHORS file and at
# http://www.kamaelia.org/AUTHORS - please extend this file,
# not this notice.
#
# Licensed under the Apache License, Version 2.0 (the "Li... |
# Copyright 2017 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... |
import torch
import torch.distributions as td
import torch.nn as nn
import torch.nn.functional as tf
from rlpyt.utils.collections import namedarraytuple
from rlpyt.utils.buffer import buffer_method
from dreamer.utils.module import FreezeParameters
RSSMState = namedarraytuple('RSSMState', ['mean', 'std', 'stoch', 'det... |
# 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 ... |
class JournalEntry(DependencyObject,ISerializable):
""" Represents an entry in either back or forward navigation history. """
@staticmethod
def GetKeepAlive(dependencyObject):
"""
GetKeepAlive(dependencyObject: DependencyObject) -> bool
Returns the System.Windows.Navigation.JournalEntry.KeepAlive�... |
#!/usr/bin/python
import participantCollection
import string
import re
import datetime
import pyperclip
#TODO: need to figure out how to get total days in current month...
# Remember, this is during signup, so current month is not July, it's June.
currentMonthTotalDays = 30
#TODO: fill in the current month url...
curr... |
"""Tests for C-implemented GenericAlias."""
import unittest
import pickle
import copy
from collections import (
defaultdict, deque, OrderedDict, Counter, UserDict, UserList
)
from collections.abc import *
from concurrent.futures import Future
from concurrent.futures.thread import _WorkItem
from contextlib import A... |
from os import listdir
from os.path import isfile, join
from re import compile
from typing import Dict
from PyQt5.QtCore import QRegularExpression
from PyQt5.QtGui import QRegularExpressionValidator
from PyQt5.QtWidgets import QDialog, QMessageBox
from dbus import DBusException
from snapper.SnapperConnection import S... |
#!/usr/bin/python3
from init_env import init_env
init_env()
from pymavlink import mavutil
connection = mavutil.mavlink_connection('udpin:localhost:11000')
mav = connection
while (True):
msg = mav.recv_match(blocking=True)
print("Message from %d: %s" % (msg.get_srcSystem(), msg))
|
# Generated by Django 2.2.2 on 2019-09-07 14:38
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('ReclamaCaicoApp', '0010_comentario_user'),
]
operations = [
migrations.RemoveField(
model_name='comentario',
name='u... |
from typing import List, Tuple, Optional
from pydantic import Field, HttpUrl, BaseModel
class Intents(BaseModel):
guilds: bool = True
guild_members: bool = True
guild_messages: bool = False
guild_message_reactions: bool = True
direct_message: bool = False
message_audit: bool = False
forum... |
"""
This file offers the methods to automatically retrieve the graph Pseudoalteromonas tunicata.
The graph is automatically retrieved from the STRING repository.
Report
---------------------
At the time of rendering these methods (please see datetime below), the graph
had the following characteristics:
Datetime: ... |
import os
import pathlib
import shutil
import typing
import alembic.command
import alembic.config
from mlrun import mlconf
class AlembicUtil(object):
def __init__(self, alembic_config_path: pathlib.Path):
self._alembic_config_path = str(alembic_config_path)
self._alembic_config = alembic.config.... |
# -*- coding: utf8 - *-
"""
Utility and helper methods for cihai.
"""
from __future__ import absolute_import, print_function, unicode_literals
import sys
from . import exc
from ._compat import collections_abc, reraise
def merge_dict(base, additional):
"""
Combine two dictionary-like objects.
Notes
... |
from pydub import AudioSegment
import json
import re
timing_src = [
"./inputs/timing/04-JHN-01-timing.txt",
"./inputs/timing/04-JHN-02-timing.txt",
"./inputs/timing/04-JHN-03-timing.txt",
"./inputs/timing/04-JHN-04-timing.txt",
"./inputs/timing/04-JHN-05-timing.txt",
"./inputs/timing/04-JHN-06-timing.txt"... |
import info
class subinfo(info.infoclass):
def setDependencies(self):
self.runtimeDependencies["virtual/base"] = None
self.runtimeDependencies["libs/qt5/qtbase"] = None
self.runtimeDependencies["libs/openssl"] = None
self.runtimeDependencies["libs/cyrus-sasl"] = None
def setTa... |
"""
WSGI config for dataflair project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/3.0/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault('DJANGO_SET... |
from tictactoe.board import BoardAPI, XOBoard
from tictactoe.main import PlayerFcty, recap_game_stats
from tictactoe.player import PlayerAPI, HumanUI
__ALL__ = [PlayerAPI, PlayerFcty, HumanUI, BoardAPI, XOBoard, recap_game_stats]
|
import io
import re
import textwrap
from typing import List
import pytest
from pytest_console_scripts import ScriptRunner
SCRIPT_NAME = "zkeys"
SCRIPT_USAGE = f"usage: {SCRIPT_NAME} [-h] [--version]"
def test_prints_help(script_runner: ScriptRunner) -> None:
result = script_runner.run(SCRIPT_NAME, "-h")
ass... |
"""Module for parsing montly school collections data."""
from typing import ClassVar
import pandas as pd
import pdfplumber
from ...utils.misc import rename_tax_rows
from ...utils.pdf import extract_words, words_to_table
from .core import COLLECTION_TYPES, MonthlyCollectionsReport, get_column_names
class SchoolTaxCo... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
time math calculation.
"""
from datetime import date, datetime, timedelta
try:
from .tz import utc, local
except: # pragma: no cover
from rolex.tz import utc, local
def to_ordinal(a_date):
"""
Calculate number of days from 0000-00-00.
"""
... |
#!/usr/bin/env python2.4
"""
"""
def thousands_with_commas(i):
s = ''
while i > 999:
r = i % 1000
i = i // 1000
s = (",%03d" % r) + s
if i:
s = str(i) + s
print s
return s
if __name__ == '__main__':
assert thousands_with_commas(1001) == '1,001'
assert tho... |
from django.contrib.auth import get_user_model
from django.urls import reverse
from django.test import TestCase
from rest_framework import status
from rest_framework.test import APIClient
from core.models import Ingredient, Recipe
from recipe.serializers import IngredientSerializer
INGREDIENTS_URL = reverse('recipe:... |
#
# Solution to Project Euler problem 231
# Copyright (c) Project Nayuki. All rights reserved.
#
# https://www.nayuki.io/page/project-euler-solutions
# https://github.com/nayuki/Project-Euler-solutions
#
import eulerlib
def compute():
N = 20000000
K = 15000000
smallestprimefactor = eulerlib.list_smallest_prime... |
class Solution:
def removeInterval(self, intervals: List[List[int]], toBeRemoved: List[int]) -> List[List[int]]:
res = []
x, y = toBeRemoved
for interval in intervals:
l, h = interval
if l <= x <= h <= y:
res.append([l, x])
elif x ... |
VGG_MEAN = [103.939, 116.779, 123.68]
|
import json
import boto3
from datetime import datetime
import ast
class S3DAO:
USERS_DISHES_S3_KEY = 'users-dishes'
PAGE_CONTENT_S3_KEY = 'page-content'
BRINE_DATA_BUCKET_NAME = 'brine-data'
def __init__(self):
self.s3_client = None
self.users_dishes_last_modified = None
self.p... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import datetime
import json
import sys
import traceback
from getopt import getopt, GetoptError
from multiprocessing import Process
from wsgiref.simple_server import make_server
from JobBrowserBFF.jsonrpcbase import JSONRPCService, InvalidParamsError, KeywordError, \
JSO... |
# -*- 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
#... |
__doc__ = """
Manipulate audio with an simple and easy high level interface.
See the README file for details, usage info, and a list of gotchas.
"""
from setuptools import setup
setup(
name='pydub',
version='0.11.1',
author='James Robert',
author_email='jiaaro@gmail.com',
description='Manipulate ... |
for num in range(1, 51):
if num % 3 == 0 and num % 5 == 0:
print("fizzbuzz")
elif num % 3 == 0 and num % 5 != 0:
print("fizz")
elif num % 3 != 0 and num % 5 == 0:
print("buzz")
else:
print(num) |
from unittest import TestCase
import pytest
from django.core.exceptions import ValidationError
from va_explorer.tests.factories import UserFactory
from va_explorer.users.models import UserPasswordHistory
from va_explorer.users.validators import PasswordComplexityValidator, PasswordHistoryValidator
pytestmark = pytest... |
#!/usr/bin/env python
# Copyright 2017 The Forseti Security 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
#
#... |
# -*- coding: utf-8 -*-
# Copyright (c) 2014, Vispy Development Team.
# Distributed under the (new) BSD License. See LICENSE.txt for more info.
""" vispy.app.backends
The backend modules are dynamically imported when needed. This module
defines a small description of each supported backend, so that for
instance we ca... |
# -*- coding: utf-8 -*-
import dgl
import networkx as nx
import numpy as np
import torch
from dataset.codesearchnet import MAX_SUB_TOKEN_LEN
def build_graph(tree_dict, dictionary, tree_leaf_subtoken=1, DGLGraph_PAD_WORD=-1) -> dgl.DGLGraph:
# 叶子节点存的是拆开后的subtoken ,当然,如果token拆不开,那就还是一个token
# 用来训练的.pt数据里叶子节点... |
from ._SpeechDataset import SpeechDataset, SpeechDatasetQuerySet
|
#!/usr/bin/env python
# coding=utf8
from flask import Blueprint
running = Blueprint('running', __name__)
from snapshot import *
from log import *
|
from rest_framework import serializers
from ..models import Tweet
from accounts.api.serializers import UserModelSerializer
from django.utils.timesince import timesince
class ParentTweetModelSerializer(serializers.ModelSerializer):
user = UserModelSerializer(read_only=True)
date_display = serializers.Serializer... |
#!/usr/bin/env python3
# SPDX-License-Identifier: Apache-2.0
# Copyright (c) 2020 Intel Corporation
""" ETCD Access Management Tool """
import argparse
import logging
import os
import sys
import eis_integ
def parse_arguments(_cli_args):
""" Parse argument passed to function """
parser = argparse.ArgumentParse... |
from pytest import fixture
from novel_tools.common import NovelData, Type
from novel_tools.processors.transformers.pattern_transformer import PatternTransformer
@fixture
def pattern_transformer():
return PatternTransformer({
'units': [
{
'filter': {
'type': ... |
import json
import logging
import pathlib
import shutil
import tempfile
from typing import List
import marshmallow_dataclass
from defusedxml.ElementTree import parse
from osgeo import gdal
from osgeo import ogr
from osgeo import osr
from .util_numba import _accumulate_dicts
logger = logging.getLogger(__name__)
@ma... |
#!python
# -*- coding: utf-8 -*-
"""Example of qdarkstyle use for Python and Qt applications.
This module a main window with every item that could be created with
Qt Design (common ones) in the basic states (enabled/disabled), and
(checked/unchecked) for those who has this attribute.
Requirements:
- Python 2 or... |
"""
A state module designed to enforce load-balancing configurations for F5 Big-IP entities.
:maturity: develop
:platform: f5_bigip_11.6
"""
import salt.utils.json
# set up virtual function
def __virtual__():
"""
Only load if the bigip exec module is available in __salt__
"""
if "b... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.