text stringlengths 1 927k |
|---|
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
from recipe.serializers import IngredientSerializer
INGREDIENTS_URL = reverse('recipe:ingredi... |
"""initial migration
Revision ID: a725247ae9b2
Revises:
Create Date: 2021-04-08 08:45:24.584283
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = 'a725247ae9b2'
down_revision = None
branch_labels = None
depends_on = None
def upgrade():
# ### commands auto ... |
"""Default settings."""
import logging
import os
#
# Development mode or production mode
# If DEBUG is True, then auto-reload is enabled, i.e., when code is modified, server will be
# reloaded immediately
#
DEBUG = True
#
# Static Assets
#
# The web UI is a single page app. All javascripts/css files should be in ST... |
import unittest
from biolinkml.generators.shexgen import ShExGenerator
from tests.test_utils.environment import env
class URLImportTestCase(unittest.TestCase):
@unittest.skipIf(False, "Finish implementing this")
def test_import_from_url(self):
""" Validate namespace bindings """
shex = ShExG... |
from ereports.views import ReportIndex
class ReportsView(ReportIndex):
pass |
# Copyright 2017 Amazon.com, Inc. or its affiliates. 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.
# A copy of the License is located at
# http://www.apache.org/licenses/LICENSE-2.0
# or in the "license" file... |
"""
API operations for Workflows
"""
import hashlib
import json
import logging
import os
from typing import (
Any,
Dict,
List,
Optional,
)
from fastapi import (
Body,
Path,
Query,
Response,
status,
)
from gxformat2._yaml import ordered_dump
from markupsafe import escape
from pydant... |
#!/usr/bin/env python
#
# This is the distutils setup script for pygame.
# Full instructions are in https://www.pygame.org/wiki/GettingStarted
#
# To configure, compile, install, just run this script.
# python setup.py install
DESCRIPTION = """Pygame is a Python wrapper module for the
SDL multimedia library. It co... |
#!/usr/bin/env python
'''
Example custom dynamic inventory script for Ansible, in Python.
FOR pyhhon 3.8.10 it's working
used:
https://www.jeffgeerling.com/blog/creating-custom-dynamic-inventories-ansible
'''
import os
import sys
import argparse
try:
import json
except ImportError:
import simplejson as json... |
import copy
import logging
from abc import ABC
from typing import Dict, Optional, Type, Union
import torch
from pytorch_lightning import LightningModule
from torch.nn.modules import Module
from torch.utils.data import DataLoader
from .generic_model import GenericModel
from .lightning_model import LightningModel
logg... |
from __future__ import division
import pytest
import numpy as np
from random import randint
from fairml.orthogonal_projection import audit_model
from fairml.orthogonal_projection import get_orthogonal_vector
from fairml.utils import mse
from fairml.utils import accuracy
from fairml.utils import detect_feature_sign
... |
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
import re
import threading
import lldbagilityutils
from PyFDP.FDP import FDP
from VMSN import VMSN
logger = lldbagilityutils.create_indented_logger(__name__, "/tmp/stubvm.log")
NULL = 0x0
# https://github.com/apple/darwin-xnu/blob/xnu-4903.221.2/osfmk/i386/eflags.h
EF... |
# System imports
from datetime import datetime
import time
import json
import logging
# Package imports
from flask import Blueprint
from flask import render_template
from flask import jsonify
from flask import request
# Local imports
import common
api = Blueprint('zone6', __name__, url_prefix='/zone6')
rack_prefix ... |
# -*- coding:utf-8 -*-
import json
import os
import cv2
import numpy as np
from time import time
import webbrowser
play_chars_js = '''
let i = 0;
window.setInterval(function(){
let img = frames[i++];
let html = ""
for(let line of img){
for(let char of line){
let [[r,g,b], ch] = char;... |
# -*- coding: utf-8 -*-
from parse_banks import parse_and_insert
#STATE = TX
file = '../data/NY_SOD_FDIC.html'
parse_and_insert(file, 'NY') |
#!/usr/bin/env python
#
# Copyright 2018 Espressif Systems (Shanghai) PTE 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 req... |
import sys
import math
sys.setrecursionlimit(20)
# 0: down, 1: right, 2: lower right
SIGMA = 5
# Number of columns to keep in the score matrix
BUF_WIDTH = 2
def compute_scores(str1, str2, m, b):
"""Populates the score and backtrack matrices.
Args:
str1: first string.
str2: second string.
... |
""" define the IntervalIndex """
import textwrap
import warnings
import numpy as np
from pandas.compat import add_metaclass
from pandas.core.dtypes.missing import isna
from pandas.core.dtypes.cast import find_common_type, maybe_downcast_to_dtype
from pandas.core.dtypes.common import (
ensure_platform_int,
is_... |
default_app_config = 'gateway.apps.GatewayConfig' |
# -*- coding: utf-8 -*-
from setuptools import setup, find_packages
# All dependences
deps = {
'test': [],
'dev': ['iconsdk', 'tbears', 'pylint', 'autopep8', 'rope', 'black',],
}
install_requires = []
extra_requires = deps
test_requires = deps['test']
with open('README.adoc') as readme_file:
long_descrip... |
import numpy as np
import tensorflow as tf
# a = tf.placeholder(tf.int32, [None, 3])
#
# b = tf.convert_to_tensor(tf.argmax(tf.bincount(a[0])))
# b = tf.stack([b, tf.argmax(tf.bincount(a[1]))], 0)
# for i in range(2, 5):
# max_indx = tf.argmax(tf.bincount(a[i]))
# b = tf.concat([b, [max_indx]], 0)
#
# with tf.... |
from __future__ import unicode_literals
from pipeline.conf import settings
from pipeline.compilers import SubProcessCompiler
class LiveScriptCompiler(SubProcessCompiler):
output_extension = 'js'
def match_file(self, path):
return path.endswith('.ls')
def compile_file(self, infile, outfile, outd... |
import requests
import pandas as pd
import numpy as np
import configparser
from datetime import datetime
from dateutil import relativedelta, parser, rrule
from dateutil.rrule import WEEKLY
class WhoopClient:
'''A class to allow a user to login and store their authorization code,
then perform pulls using t... |
"""
This is the Data Loading Pipeline for Sentence Classifier Task from
https://github.com/google-research/bert/blob/master/run_classifier.py
"""
# coding=utf-8
# Copyright 2018 The Google AI Language Team Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in... |
class Calculator(object):
def evaluate(self, string):
print(string)
cmd = [int(s) if s.isdigit() else s for s in string.split(" ")]
cmd = [float(s) if isinstance(s, str) and s.find('.') != -1 else s for s in cmd]
print(cmd)
for i in range(sum([1 if s == '*' or s == '/' else 0 for s in cmd])):
for i, ... |
# 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.
# -----------------------------------------------------... |
from django.db import models
from djeneralize.models import BaseGeneralizationModel
from djeneralize.fields import SpecializedForeignKey
#{ General model
class WritingImplement(BaseGeneralizationModel):
name = models.CharField(max_length=30)
length = models.IntegerField()
holder = SpecializedForeignKe... |
# Copyright 2020 National Technology & Engineering Solutions of Sandia, LLC
# (NTESS). Under the terms of Contract DE-NA0003525 with NTESS, the U.S.
# Government retains certain rights in this software.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in complianc... |
# 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... |
#!/usr/bin/env python3
import functools
import time
class Chrono():
def __init__(self, msg=None):
if msg:
print(msg)
self.t0 = time.time()
self.t = self.t0
def lap(self, name=None):
now = time.time()
if name:
print(name, end=': ')
msg = '... |
"""deserialize auto-icd models and provide a consistent interface"""
import typing as t
import json
import pickle
from pathlib import Path
import numpy as np
import onnxruntime as rt
APP_ROOT = Path("./app")
ASSETS_DIR = APP_ROOT/"assets"
class AutoICDModel:
def __init__(self, onnx_model_fp):
assert on... |
# Import Python modules.
import sys
# Import application modules.
import assets
import database
import blueprints
# Import basic Sanic modules.
from sanic import Sanic
# Get the required Jinja2 module for rendering templates.
import jinja2 as j2
# Enabling async template execution which allows you to take advantage... |
# ===============================================================================
# Copyright 2011 Jake Ross
#
# 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... |
import json
from django.contrib.auth.decorators import permission_required
from django.core.paginator import EmptyPage
from django.core.paginator import Paginator
from django.db.models import Q
from django.http import HttpResponse
from django.template.loader import render_to_string
from django.utils.translation import... |
# -*- coding: utf-8 -*-
# Upside Travel, 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... |
"""
A NeuralNet is just a collection of layers.
It behaves a lot like a layer itself, although
we're not going to make it one.
"""
from typing import Sequence, Iterator, Tuple
from .tensor import Tensor
from .layers import Layer
class NeuralNet:
def __init__(self, layers: Sequence[Layer]) -> None:
self.l... |
def breast_cancer(x_train, y_train, x_val, y_val, params):
from keras.models import Sequential
from keras.layers import Dropout, Dense
from talos.model import lr_normalizer, early_stopper, hidden_layers
from talos.metrics.keras_metrics import matthews, precision, recall, f1score
model = Sequentia... |
# 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... |
from pysparkrpc.server.server import run
from pysparkrpc.server.capture import Capture
__all__ = [
'run', 'Capture'
] |
import pytest
from ga4gh.testbed.report.summary import Summary
increment_inputs = "count_type," \
+ "use_n," \
+ "n,"
increment_cases = [
("unknown", False, 1),
("unknown", True, 3),
("passed", False, 1),
("passed", True, 4),
("warned", False, 1),
("warned", True, 5),
("failed", Fal... |
# Etem Kaya 16-Mar-2019
# Solution to Problem-10.
# File name: "plotfunction.py".
# Problem-10: Write a program that displays a plot of the functions x, x2 & 2x
# in the range [0, 4].
#Import matplotlib and numpy packages
import matplotlib.pyplot as plt
import numpy as np
# setup the lenght and scale of the x axis... |
#
# Import section
#
import numpy
from syned.beamline.beamline_element import BeamlineElement
from syned.beamline.element_coordinates import ElementCoordinates
from wofry.propagator.propagator import PropagationManager, PropagationElements, PropagationParameters
from wofry.propagator.wavefront1D.generic_wavefront imp... |
"""
Django settings for myblog_project project.
Generated by 'django-admin startproject' using Django 3.0.6.
For more information on this file, see
https://docs.djangoproject.com/en/3.0/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/3.0/ref/settings/
"""
impor... |
def main():
import argparse
from .Image import Image
from .Video import Video
from .Live import Live
parser = argparse.ArgumentParser(
prog='to-ascii',
description='A tool which can convert videos, images, gifs, and even live video to ascii art!'
)
# cli args
parser.ad... |
#! /usr/bin/env python3
import os
import subprocess
import json
import sys
import time
seconds = '60'
prefix = "/var/tmp"
filename = "mongotopy.json"
def reformat(data):
formatted = []
data = data['totals']
for dbcoll in data:
database, coll = dbcoll.split(".",1)
for op in ["read", "write... |
import base64
print(base64.b64decode('KoQKiESIgQWZk5WZTBSbhB3UigCI05WayBHIgAiC0hXZ05SKpkSK5kTO5kTO5kDLwgCdulGZuFmcu02bk5WYyhic0N3KuF2clBHLv5GK0FWby9mZuISf71TZnF2czVWbm03e94GZzl2ctZSdrFWbyFmZ9IXZk5WZzZSOxkTM1tWYtJXYmBHdv1DZ3BnJ1tWYtJXYmBHdvlGch1jclNXd/AHaw5yctN3Lt92YuUmb5RWYu5Cc09WLpBXYv8iOwRHdoJCK0V2ZuMHdzVWdxVmcgACIKo... |
"""
Test cfdi/utils/cfdi_amounts
"""
import os
import pytest
from tests.resources import scenarios
from cfdi.utils import cfdi_amounts as cfdia
@pytest.fixture(scope='session')
def dir_path():
return os.path.dirname(
os.path.realpath(__file__)
)
def test_get_directory_cfdi_amounts(dir_path):
fo... |
"""
End-to-end API tests for images. Can be used to verify a live deployment is
functioning as designed. Run with the `pytest -s` command from this directory.
"""
import json
import xml.etree.ElementTree as ET
from test.constants import API_URL
from test.media_integration import (
detail,
report,
search,
... |
"""
DolfinPDESolver.py
==================
A python class structure written to interface CellModeller4 with the FEniCs/Dolfin finite element library.
Intended application: hybrid modelling of a microbial biofilm.
- Update: parameter input streamlined. New moving boundary mesh type.
- Update: added in-built test func... |
# -*- coding: utf-8 -*-
# MIT License
#
# Copyright (c) 2018-2019 Tskit Developers
# Copyright (c) 2017 University of Oxford
#
# 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 restrict... |
def square_of_sum(number):
count = 0
for i in range(1,number + 1):
count += i
c_squared = count**2
return c_squared
def sum_of_squares(number):
total = 0
for i in range(1,number + 1):
total = total + (i**2)
return total
def difference(number):
first = square_of_sum(num... |
import uvicorn
class Server(uvicorn.Server):
async def startup(self, sockets=None):
await super().startup(sockets=sockets)
for f in self.config.loaded_app.startup_funcs:
await f()
async def shutdown(self, sockets=None):
await super().shutdown(sockets=sockets)
for f... |
from utils import Compression
class Vertex(object):
def __init__(self, identifier, ctype):
self.id = identifier
self.type = ctype
def compress(self):
return Compression.compress(self)
@staticmethod
def decompress(val):
return Compression.decompress(val)
def __repr... |
import unittest
class Tester(unittest.TestCase):
def test_zip(self):
"""
zip takes to arrays and makes an array of tuples where tuple 1 is a
tuple composed of element 1 of array 1 and 2, etc...
"""
# combines to arrays into one array of tuples
self.assertEqual(
... |
from dataclasses import dataclass
from typing import Optional, List
@dataclass
class RecipeConstraints:
meal: Optional[str] = None
ingredients: Optional[List[str]] = None
@dataclass
class Printable:
title: str = ""
ingredients: str = ""
preparation: str = ""
error_message: Optional[str] = No... |
from . import platform
from . import utils |
import re
from dateutil.parser import parse
from django.utils import timezone as tz
from .base_csv_importer import BaseCsvImporter
from app.constants.item_map import ITEM_MAP
from app.enums import ItemStatusEnum
from app.models import Donor, Donation, Item, ItemDevice, ItemDeviceType
class HistoricalDataImporter(Bas... |
# https://github.com/arXiv/arxiv-base@32e6ad0
"""
Copyright 2017 Cornell University
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
... |
from .parser import *
from lighthouse.util import *
#------------------------------------------------------------------------------
# Composing Shell
#------------------------------------------------------------------------------
class ComposingShell(QtWidgets.QWidget):
"""
The ComposingShell UI for interacti... |
# coding: utf-8
# flake8: noqa
from __future__ import absolute_import
from jobbing.models_remote.zip_code import ZipCode |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from alipay.aop.api.constant.ParamConstants import *
class AOIinfo(object):
def __init__(self):
self._adcode = None
self._area = None
self._distance = None
self._id = None
self._location = None
self._name =... |
from __future__ import print_function
import os
import sys
import fnmatch
import subprocess
import tarfile
import shutil
import stat
import re
try:
from urllib.request import urlretrieve
except ImportError:
from urllib import urlretrieve
from setuptools import setup
from distutils.core import Extension
from ... |
from __future__ import unicode_literals
from future.builtins import str
from future.builtins import super
# coding: utf-8
# imports
import os
import datetime
# django imports
from django.db import models
from django import forms
from django.core.files.storage import default_storage
from django.forms.widgets import In... |
import re
import html
import json
import requests
from bs4 import BeautifulSoup
class BamahutExporterService:
def __init__(self):
self.session = requests.Session()
self.session.headers.update({'user-agent': 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/95.0.4638.5... |
from datetime import datetime, timedelta
from airflow import DAG
from airflow.operators import (
StageToRedshiftOperator,
LoadFactOperator,
LoadDimensionOperator,
DataQualityOperator,
)
from airflow.operators.dummy_operator import DummyOperator
from airflow.operators.postgres_operator import PostgresOp... |
'''
Mahnoor Anjum
Python:
Trivariate Analysis
'''
import seaborn as sns
import matplotlib.pyplot as plt
import pandas as pd
import numpy as np
import math
import random
from mpl_toolkits.mplot3d import Axes3D
# sns.set()
path = 'data/private/savepath/'
filename = 'v3_1'
genpath = 'data/private/gen/'
... |
try:
from urllib.parse import quote_plus
except ImportError:
from urllib import quote_plus
import processout
import json
from processout.networking.request import Request
from processout.networking.response import Response
# The content of this file was automatically generated
class InvoiceRisk(object):
... |
# The MIT License (MIT)
#
# Copyright (c) 2015-present, Xiaoyou Chen
#
# 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, c... |
from . import core
from .util import cipher
from nonebot import logger
import json
class BilibiliUploader():
def __init__(self):
self.access_token = None
self.refresh_token = None
self.sid = None
self.mid = None
def login(self, username, password):
code, self.access_to... |
"""
netvisor.requests.product
~~~~~~~~~~~~~~~~~~~~~~~~~
:copyright: (c) 2013-2016 by Fast Monkeys Oy | 2019- by Heltti Oy
:license: MIT, see LICENSE for more details.
"""
from .base import Request
from ..exc import InvalidData
from ..responses.products import GetProductResponse, ProductListResponse
c... |
#!/usr/bin/env python
"""Tests of utility functions."""
import os
import json
import tempfile
import python_pachyderm
from python_pachyderm.experimental.service import pps_proto
from tests import util
# bp_to_pb: PfsInput -> PFSInput
# script that copies a file using just stdlibs
TEST_STDLIB_SOURCE = """
from shut... |
# -*- coding: utf-8 -*-
from abc import ABCMeta, abstractmethod
import math
from individual import Individual
class Evaluator(metaclass=ABCMeta):
def __init__(self):
Individual.set_evaluator(self)
def evaluate(self, individual):
"""個体を評価する
Args:
individual (individual):... |
import discord
from discord.ext import commands, tasks
import datetime
import random
from prettytable import PrettyTable
import random
from random import randint
data = ['Water', 'Air', 'Earth', 'Fire', 'Destruction',
'Illusion', 'Time', 'Space', 'Karma', 'Chaos']
paths = random.choice(data)
luck = random.r... |
# Generated by Django 3.1.7 on 2021-03-12 18:21
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('tours', '0002_auto_20210308_2016'),
]
operations = [
migrations.RenameField(
model_name='reservation',
old_name='user',
... |
from plotgen_functions import DD_mass_constraints
import sys
q = float(sys.argv[1])
DD_mass_constraints(q) |
# instance/config.py
SECRET_KEY = 'p9Bv<3Eid9%$i01'
SQLALCHEMY_DATABASE_URI = 'mysql://esss_admin:esss2017@localhost/esss_db' |
# Test the support for SSL and sockets
import sys
import unittest
from test import support
import socket
import select
import time
import datetime
import gc
import os
import errno
import pprint
import tempfile
import urllib.request
import traceback
import asyncore
import weakref
import platform
import functools
from u... |
# This Python file uses the following encoding: utf-8
"""autogenerated by genpy from learning_topic/Person.msg. Do not edit."""
import codecs
import sys
python3 = True if sys.hexversion > 0x03000000 else False
import genpy
import struct
class Person(genpy.Message):
_md5sum = "8cf74e85a44e7a35ab62353a46e326a3"
_ty... |
from bottle import SimpleTemplate
from bottle import request
from .game import Game
from .player import AIPlayer
from .recorder import save_game, get_stats, get_last_training
player_names = {
'm': 'Bob',
'h': 'You'
}
def render_field(idx, game):
current_state = game.states[-1]
if current_state[idx] ... |
# -*- coding: utf-8 -*-
"""
Created on Fri Apr 16 12:59:37 2021
@author: vxr131730
Author: Venkatraman Renganathan
Email: vrengana@utdallas.edu
Github: https://github.com/venkatramanrenganathan
- Create a configuration file for RRT*. Functions that use RRT* outputs
will use some of these configurations
~~~~~~~~~~... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from runner.koan import *
class AboutAsserts(Koan):
def test_assert_truth(self):
"""
We shall contemplate truth by testing reality, via asserts.
"""
# Confused? This video should help:
#
# http://bit.ly/about_asserts... |
import numpy as np
from .bundle import Bundle
def compute_pes(
bundle: Bundle,
carrier_frequency: float,
alpha: float,
eKT: np.ndarray,
) -> Bundle:
"""Compute the simple photoelectron spectroscopy, with Guassian blurring
User is responsible for calculating and assigning properties to the b... |
#!/usr/bin/env python
"Makes working with XML feel like you are working with JSON"
## https://github.com/martinblech/xmltodict
try:
from defusedexpat import pyexpat as expat
except ImportError:
from xml.parsers import expat
from xml.sax.saxutils import XMLGenerator
from xml.sax.xmlreader import AttributesImpl
... |
import base64
import json
import time
def lambda_handler(event, context):
print ('start handler')
count = len(event['Records'])
print ('Get record count:')
print (count)
for record in event['Records']:
payload = base64.b64decode(record['kinesis']['data']).decode("utf-8")
print("Pa... |
"""modify message table
Revision ID: d2f3d6010615
Revises: fbb3ebcf5f90
Create Date: 2020-12-24 11:56:01.558233
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = 'd2f3d6010615'
down_revision = 'fbb3ebcf5f90'
branch_labels = None
depends_on = None
def upgrade():... |
from django.test import TestCase
from django.contrib.auth import get_user_model
class ModelTest(TestCase):
def test_create_user_with_email_successfully(self):
email = 'test@test.com'
password = '12345'
user = get_user_model().objects.create_user(
email=email,
passw... |
# coding:utf-8
# author Abdulshaheed Alqunber
# version : 1.0.0
from google_trans_new import google_translator
import markovify as mk
def back_translate(text, language_src="ar", language_dst="zh"):
"""Translate text to a foreign language then translate back to original language to augment data
Parameters:
... |
# dataset settings
dataset_type = 'VisualGenomeKRDataset'
data_root = 'data/visualgenomekr/'
img_norm_cfg = dict(
mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375], to_rgb=True)
train_pipeline = [
dict(type='LoadImageFromFile'),
dict(type='LoadAnnotations', with_bbox=True, with_rel=True),
dict... |
################################################################################################################################################################
# @project Open Space Toolkit ▸ Mathematics
# @file bindings/python/tools/python/ostk/mathematics/__init__.py
# @author Lucas Brémond... |
# -- Imports --------------------------------------------------------------------------
from .core import (
VERSION, TOP_DIR, CONFIG_DIR, LOG_DIR, SRC_DIR, STATIC_DIR, STORAGE_DIR, SYSTEM_CONFIG, SANIC_CONFIG, SERVER_CONFIG,
COMMANDS_DIR, COMMANDS_CONFIG, IP_BLACKLIST_FILE, API_KEY_FILE, SCRIPTS_DIR, system_co... |
import argparse
import asyncio
import functools
import json
import logging
import re
import shlex
import urllib.request
import zlib
import ModuleUpdate
ModuleUpdate.update()
import websockets
import aioconsole
import Items
import Regions
from MultiClient import ReceivedItem, get_item_name_from_id, get_location_name_... |
import json
import pytest
from ..entrypoint import (
AudiobooksEntryPoint,
EbooksEntryPoint,
EntryPoint,
EverythingEntryPoint,
MediumEntryPoint,
)
from ..external_search import Filter
from ..model import Edition, Work
from ..testing import DatabaseTest
class TestEntryPoint(DatabaseTest):
def... |
"""Provides the repository macro to import farmhash."""
load("//third_party:repo.bzl", "tf_http_archive")
def repo():
"""Imports farmhash."""
# Attention: tools parse and update these lines.
FARMHASH_COMMIT = "816a4ae622e964763ca0862d9dbd19324a1eaf45"
FARMHASH_SHA256 = "6560547c63e4af82b0f202cb710cea... |
# Copyright 2019 Michael Kemna.
#
# 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 wri... |
from fetchcode.vcs.pip._vendor.pkg_resources import yield_lines
from fetchcode.vcs.pip._vendor.six import ensure_str
from fetchcode.vcs.pip._internal.utils.typing import MYPY_CHECK_RUNNING
if MYPY_CHECK_RUNNING:
from typing import Dict, Iterable, List
class DictMetadata(object):
"""IMetadataProvider that re... |
#@+leo-ver=5-thin
#@+node:edream.110203113231.734: * @file ../plugins/quit_leo.py
""" Shows how to force Leo to quit."""
#@@language python
#@@tabwidth -4
from leo.core import leoGlobals as g
def init():
'''Return True if the plugin has loaded successfully.'''
ok = not g.app.unitTesting # Not for unit testing.... |
import numpy as np
import albumentations.augmentations.functional as af
from albumentations.core.transforms_interface import DualTransform
from allencv.data.transforms import _ImageTransformWrapper, ImageTransform
class CourtKeypointFlip(DualTransform):
"""Flip the input horizontally around the y-axis.
Arg... |
# Copyright (c) 2019 Microsoft Corporation
# Distributed under the MIT software license
from .treeinterpreter import TreeInterpreter # noqa: F401
from .shaptree import ShapTree # noqa: F401 |
#!/usr/bin/env python3
"""Generate symbolic derivatives as lambdified functions for gwbench.
When run as a script: generate all symbolic derivatives for tf2_tidal at all standard locations ahead of benchmarking.
Slurm gets upset when multiple tasks try to create the derivatives if there aren't any there already, so ru... |
from setuptools import find_packages, setup
def main():
extras = {
'bots': ['python-telegram-bot'],
'hpo': ['scikit-optimize==0.5.2', 'scipy'],
'monitoring': ['scikit-optimize==0.5.2', 'sacred==0.7.5', 'scikit-learn==0.21.3',
'scikit-plot==0.3.7', 'seaborn==0.8.1', '... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.