text stringlengths 3.07k 12.6k |
|---|
# -*- coding: utf-8 -*-
#
# rosindex documentation build configuration file, created by
# sphinx-quickstart on Tue Oct 2 16:34:57 2018.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
# ... |
# coding=utf-8
# pynput
# Copyright (C) 2015-2020 <NAME>
#
# This program is free software: you can redistribute it and/or modify it under
# the terms of the GNU Lesser General Public License as published by the Free
# Software Foundation, either version 3 of the License, or (at your option) any
# later version.
#
# Th... |
from __future__ import generator_stop
from flask import Blueprint, render_template, request, current_app as app, \
flash, session, g, redirect, url_for
from flask_login import login_user, logout_user, current_user
from functools import wraps
from psiturk.psiturk_config import PsiturkConfig
from psiturk.user_utils i... |
"""
Code from
"Two-Stream Aural-Visual Affect Analysis in the Wild"
<NAME> and <NAME> and <NAME>
Please see https://github.com/kuhnkeF/ABAW2020TNT
"""
import torch.nn as nn
import torch
from torchvision import models
from .loss import CCCLoss,AULoss
from torch.functional import F
import numpy as np
class Dummy(nn.Modu... |
import asyncio
import asyncio.events as events
import os
import sys
import threading
from heapq import heappop
def apply(loop=None):
"""Patch asyncio to make its event loop reentrent."""
loop = loop or asyncio.get_event_loop()
if not isinstance(loop, asyncio.BaseEventLoop):
raise ValueError('Can\'... |
import os
import sys
from collections import defaultdict
from typing import Callable, Tuple, List, Any
import numpy as np
import torch
from PIL import Image
from torch import nn
from torch.utils import data
from torchvision import datasets, transforms
from tqdm import tqdm
from tqdm.notebook import tqdm as tqdm_notebo... |
# OpenStreetMap Networkx library to download data from OpenStretMap
from ast import Mult
from operator import ge
import osmnx as ox
# CV2 & Scipy & Numpy & Pandas
import numpy as np
# Shapely
from shapely.geometry import *
from shapely.affinity import *
from shapely.ops import unary_union
# Geopandas
from geopandas ... |
#!/usr/bin/env python3
"""Usage:
report.py [-t N] [-l N] [--algorithm S] <CSV>
Detect duplicate or similar publications from database. This project aim to reduce size of the database by showing pairs of suspect duplications, to help citation easier and cleaner.
Export database as CSV file without header, with thes... |
""" Training architectures on 2012 ImageNet """
from __future__ import print_function, division
import sys
import timeit
import argparse
import numpy as np
import torch
import tensormonk
def parse_args():
parser = argparse.ArgumentParser(description="ImageNet using TensorMONK!")
parser.add_argument("-A", "--... |
import asyncio
import discord
from discord.ext import commands
class VoiceEntry:
def __init__(self, message, player):
self.requester = message.author
self.channel = message.channel
self.player = player
def __str__(self):
fmt = '*{0.title}* uploaded by {0.uploader} and requested... |
# Problem Set 4C
import string
from ps4a import get_permutations
# HELPER CODE #
def load_words(file_name):
"""
file_name (string): the name of the file containing
the list of words to load
Returns: a list of valid words. Words are strings of lowercase letters.
Depending on the size of the word... |
from __future__ import annotations
import enum
from math import sqrt, isclose
from typing import Any, NamedTuple, TYPE_CHECKING, Union
from .protocols.api_support.labware_like import LabwareLike
if TYPE_CHECKING:
from .protocol_api.labware import Labware, Well
from .protocols.geometry.module_geometry import M... |
# python3
# Copyright 2018 DeepMind Technologies Limited. 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 re... |
# Lint as: python3
# Copyright 2018 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 ... |
from helpers import serialize_text, deserialize_text, translate, hash
import yaml
import sys
import os
import re
class DB:
def __init__(self, path):
self.path = path
self.db = {}
def load(self):
if os.path.exists(self.path):
with open(self.path) as input_file:
... |
# coding=utf-8
"""
search.py - Sopel Search Engine Plugin
Copyright 2008-9, <NAME>, inamidst.com
Copyright 2012, <NAME>, embolalia.com
Licensed under the Eiffel Forum License 2.
https://sopel.chat
"""
from __future__ import absolute_import, division, print_function, unicode_literals
import re
import requests
import ... |
import base64
from collections import defaultdict
import streamlit as st
import pandas as pd
import os, sys, re
from get_html.env_defined_get import do_get
sys.path.append(os.path.dirname(os.path.realpath(__file__)))
from utils.customizer_constants import CustomizerConstants as cc
from utils.session_state import get... |
# Copyright 2019 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... |
import os
import glob
import sys
from sys import platform as _platform
from setuptools import setup, find_packages
from setuptools.extension import Extension
from setuptools.command.build_ext import build_ext as _build_ext
from setuptools.command.sdist import sdist as _sdist
from setuptools.command.build_py import buil... |
import logging
import sys
from collections import namedtuple
import reconcile.utils.gql as gql
from reconcile.quay_base import get_quay_api_store, OrgKey
from reconcile.status import ExitCodes
QUAY_REPOS_QUERY = """
{
apps: apps_v1 {
quayRepos {
org {
name
managedRepos
instance ... |
from builtins import range
import logging
import numpy as np
import os
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
import matplotlib.cm as cm
import matplotlib.colors as mcolors
logger = logging.getLogger(__name__)
def _cmap_discretize(cmap, N):
"""Return a discrete colormap from the... |
#!/usr/bin/python
# -*- coding: UTF-8 -*-
"""
Criado em 08 de Novembro de 2016
@author: <NAME> & <NAME>
Descricao: esta biblioteca possui as seguintes funcoes:
parametrosCaixaPixels: esta funcao recebe o nome de uma unica imagens, retornando os valores da coordenada central
e dimensa... |
"""
Copyright (c) Facebook, Inc. and its affiliates.
All rights reserved.
This source code is licensed under the MIT-style license found in the
LICENSE file in the root directory of this source tree.
"""
from __future__ import absolute_import, division, print_function, unicode_literals
import torch
from fairseq impo... |
import numpy as np
from sklearn.base import BaseEstimator
from .alignment import ProcrustesAlignment
from .kernels import compute_affinity
from .embedding import PCAMaps, LaplacianEigenmaps, DiffusionMaps
def _fit_one(x, app, kernel, n_components, random_state, gamma=None,
sparsity=0.9, **kwargs):
... |
import os
from google.cloud import storage
from google.cloud import speech_v1
from google.cloud.speech_v1 import enums
import subprocess
from pydub.utils import mediainfo
import subprocess
import datetime
from datetime import datetime
import srt
import sys
from sys import argv
from dotenv import load_dotenv
def main()... |
"""
Spider Middleware manager
See documentation in docs/topics/spider-middleware.rst
"""
from itertools import islice
from typing import Any, Callable, Generator, Iterable, Union, cast
from twisted.internet.defer import Deferred
from twisted.python.failure import Failure
from scrapy import Request, Spider
from scrap... |
from __future__ import annotations
from collections import namedtuple
from typing import (
TYPE_CHECKING,
Iterator,
)
from pandas._typing import ArrayLike
if TYPE_CHECKING:
from pandas.core.internals.blocks import Block
from pandas.core.internals.managers import BlockManager
BlockPai... |
import codecs
import errno
import os
import imp
from collections import defaultdict
import logging
from .snapshot import Snapshot
from .formatter import Formatter
from .error import SnapshotNotFound
logger = logging.getLogger(__name__)
class SnapshotModule(object):
_snapshot_modules = {}
def __init__(self... |
import numpy as np
import pytest
from nengo.spa.pointer import SemanticPointer
from nengo.utils.compat import range
def test_init():
a = SemanticPointer([1, 2, 3, 4])
assert len(a) == 4
a = SemanticPointer([1, 2, 3, 4, 5])
assert len(a) == 5
a = SemanticPointer(list(range(100)))
assert len(... |
from typing import Any
from sklearn.ensemble import (
AdaBoostClassifier,
AdaBoostRegressor,
BaggingClassifier,
BaggingRegressor,
ExtraTreesClassifier,
ExtraTreesRegressor,
GradientBoostingClassifier,
GradientBoostingRegressor,
RandomForestClassifier,
RandomForestRegressor,
)
fr... |
"""Classification and regression loss functions for object detection.
Localization losses:
* WeightedL2LocalizationLoss
* WeightedSmoothL1LocalizationLoss
Classification losses:
* WeightedSoftmaxClassificationLoss
* WeightedSigmoidClassificationLoss
"""
from abc import ABCMeta
from abc import abstractmethod
impo... |
import torch
import torch.nn.functional as F
import numpy as np
import copy
import pdb
from collections import OrderedDict as OD
from collections import defaultdict as DD
torch.random.manual_seed(0)
''' For MIR '''
def overwrite_grad(pp, new_grad, grad_dims):
"""
This is used to overwrite the gradients wi... |
'''The data model part of the RecycleView model-view-controller pattern.
It defines the models (classes) that store the data associated with a
:class:`~kivy.uix.recycleview.RecycleViewBehavior`. Each model (class)
determines how the data is stored and emits requests to the controller
(:class:`~kivy.uix.recycleview.Rec... |
from abc import ABC
from dataclasses import dataclass
from typing import List, Union
import torch
from ._internals import (
ShardMetadata,
validate_non_overlapping_shards_metadata
)
class PlacementSpec(ABC):
"""
Base class representing the placement of an entity. Subclasses of this
class can be us... |
"""
Copyright (c) 2019 Intel 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 law or agreed to in writin... |
from core.models import Genre, Theme, Platform, Developer, Publisher, Game
import datetime
popular_platforms = [
'Mac',
'Linux',
'PC (Microsoft Windows)',
'Nintendo Switch',
'PlayStation 4',
'PlayStation 3',
'Xbox One',
'Xbox 360',
'iOS',
... |
# These function can return and Column Expression or a list of columns expression
# Must return None if the data type can not be handle
# from dask_cudf.core import DataFrame as DaskCUDFDataFrame
import random
import string
import cudf
import dask
from optimus.engines.base.commons.functions import to_float_cudf, t... |
#!/usr/bin/env python
# Copyright 2015 Cloudera, 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 ... |
"""A library for simulating a user's phone.
Copyright (c) 2016-present, Facebook, Inc.
All rights reserved.
This source code is licensed under the BSD-style license found in the
LICENSE file in the root directory of this source tree. An additional grant
of patent rights can be found in the PATENTS file in the same di... |
#!/usr/bin/env python
import sys
import os
import wandb
import socket
import setproctitle
import numpy as np
from pathlib import Path
import torch
from onpolicy.config import get_config
from onpolicy.envs.mpe.MPE_env import MPEEnv
from onpolicy.envs.env_wrappers import SubprocVecEnv, DummyVecEnv
def make_render_env... |
import sys
import unittest
from tests.mock import patch, ANY
import os.path
import streamlink_cli.main
from streamlink import Streamlink
from streamlink_cli.compat import is_win32
PluginPath = os.path.join(os.path.dirname(__file__), "plugins")
def setup_streamlink():
streamlink_cli.main.streamlink = Streamlink... |
# Copyright 2022 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, ... |
"""CommMessages API Version 1.0.
This API client was generated using a template. Make sure this code is valid before using it.
"""
import logging
from datetime import date, datetime
from .base import BaseCanvasAPI
from .base import BaseModel
class CommMessagesAPI(BaseCanvasAPI):
"""CommMessages API Version 1.0."... |
__author__ = 'Elahe'
import ephem
import numpy as np
from datetime import datetime
import sqlite3 as lite
def set_data_range(lsst, date, tint):
'''Return numpy array of dates between astronomical twilight'''
ss = set_time(ephem.Date(twilightEve(lsst, date)))
sr = set_time(ephem.Date(twilightMorn(lsst, da... |
"""The module torch_mixin defindes Language mixin for pytorch."""
import itertools
import logging
from pathlib import Path
from typing import Any, Dict, Iterable, List, Optional, Sequence, Tuple, Union, cast
import spacy
import spacy.language
import srsly
import torch
from spacy.gold import GoldParse # pylint: disabl... |
#!/usr/bin/env python3
# vim: ts=3:sw=3:et
import argparse
import csv
import logging
import logging.config
import os
import os.path
from configparser import ConfigParser
from pysip import Client
from datetime import datetime
from datetime import timedelta
config = None
# This program exports all Analyzed indicators ... |
#! python3
from __future__ import absolute_import, unicode_literals
import os
import logging
import time
import environ
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.firefox.options import Options
from fake_useragent import UserAgent
import numpy as np
from ce... |
"""
CanSat Constellation Plant Model
cansat/components.py
Taken from
> <NAME>, <NAME>, <NAME>, <NAME>, <NAME>,
> "Safe Reinforcement Learning Benchmark Environments for Aerospace Control Systems,"
> IEEE Aerospace, Big Sky, MT, March 2022.
"""
from csaf import ContinuousComponent, DiscreteComponent, System
import ty... |
"""
This file holds many variables that are used throughout MoleculeACE
<NAME>, Eindhoven University of Technology, March 2022
"""
import datetime
import os
from enum import Enum
from pathlib import Path
def get_project_root() -> Path:
return Path(__file__).parent.parent.parent
###
# Benchmark parameters
###
... |
# This file is part of Indico.
# Copyright (C) 2002 - 2021 CERN
#
# Indico is free software; you can redistribute it and/or
# modify it under the terms of the MIT License; see the
# LICENSE file for more details.
from wtforms.ext.sqlalchemy.fields import QuerySelectField
from wtforms.fields import BooleanField, TextAr... |
import boto3
import decimal
import json
import os
ALARM_NAME_PREFIX = 'InstanceAlarm:'
ALARM_TEMPLATES_BUCKET = os.environ['ALARM_TEMPLATES_BUCKET']
ALARM_TEMPLATES_CACHE = {}
# Maximum number of alarms to delete per API call.
DELETE_ALARMS_MAX_NAMES = 100
autoscaling = boto3.client('autoscaling')
cloudwatch = bot... |
# coding=utf-8
# Copyright 2018 The Google AI Language Team Authors and The HuggingFace Inc. 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/LICEN... |
import MPS_class as MPS
import contraction_utilities as contract
import numpy as np
import numpy.linalg as LA
from ncon import ncon
from LanczosRoutines import expm_krylov_lanczos
## tensor contraction for minimization
## +--M--+
## | | |
## H_eff = L--H--R
## | | |
## +--M--+ ... |
"""
Installing the SageMath Jupyter Kernel and extensions
Kernels have to register themselves with Jupyter so that they appear
in the Jupyter notebook's kernel drop-down. This is done by
:class:`SageKernelSpec`.
"""
import os
import errno
from sage.env import (
SAGE_ROOT, SAGE_DOC, SAGE_LOCAL, SAGE_EXTCODE,
... |
# -*- coding:utf-8 -*-
# 生成任务文件功能
from monitor.util.allClass import *
from monitor.util.preload import logger, q
from threading import Thread
from monitor.models import Functions, FunctionsParam, FunctionsType, FunctionsPolicy, TaskLog
import ast
class TaskEngine:
def __init__(self, task_id, task_variable, task_s... |
from __future__ import absolute_import
from __future__ import print_function
from __future__ import division
import numpy as np
import copy
from collections import defaultdict
import sys
import warnings
try:
from torchreid.eval_cylib.eval_metrics_cy import evaluate_cy
IS_CYTHON_AVAI = True
print("Using Cy... |
# coding=utf-8
# Copyright 2021 The Google Research 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 applicab... |
#
# idlparse.py
#
# an example of using the parsing module to be able to process a subset of the CORBA IDL grammar
#
# Copyright (c) 2003, <NAME>
#
from pyparsing import Literal, CaselessLiteral, Word, OneOrMore, ZeroOrMore, \
Forward, NotAny, delimitedList, oneOf, Group, Optional, Combine, alphas, nu... |
import sys
import json
import os
import logging
from logging.config import dictConfig
from flask import Flask
from flask_cors import CORS
from flask_restful import reqparse, abort, Api, Resource
from flask import request, jsonify
import base64
import yaml
import argparse
import textwrap
sys.path.append... |
"""Test result object"""
import io
import sys
import traceback
from . import util
from functools import wraps
__unittest = True
def failfast(method):
@wraps(method)
def inner(self, *args, **kw):
if getattr(self, 'failfast', False):
self.stop()
return method(self, *args, **kw)
... |
import os
import os.path as op
import sys
import re
import subprocess
# import the bootstrap script from the generated project directory
sys.path.append(os.getcwd())
from bootstrap import *
def python_path():
if 'TRAVIS' in os.environ:
python_system_path = subprocess.check_output(['which', 'python']).deco... |
import torch
import torch.nn as tnn
import torchvision.datasets as dsets
import torchvision.transforms as transforms
BATCH_SIZE = 10
LEARNING_RATE = 0.01
EPOCH = 800
N_CLASSES = 3
transform = transforms.Compose([
transforms.RandomResizedCrop(224),
transforms.RandomHorizontalFlip(),
transforms.RandomVertic... |
#!/usr/bin/env python3
# pylint: disable=C0111 # docstrings are always outdated and wrong
# pylint: disable=W0511 # todo is encouraged
# pylint: disable=C0301 # line too long
# pylint: disable=R0902 # too many instance attributes
# pylint: disable=C0302 # too many lines in module
# pylint: disable=C0103 # single... |
# Copyright (c) 2021 IBM Corp. 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law o... |
import random
import numpy as np
import torch
from torch.nn.parallel import DataParallel
from torch.nn.parallel.distributed import DistributedDataParallel
from yacs.config import CfgNode
from mvt.cores.core_hook import HOOKS
from mvt.cores.hook import DistSamplerSeedHook, OptimizerHook, EvalHook, DistEvalHook
from mv... |
"""
Unit Test Fake orders
Copyright (c) 2019 <NAME>
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, publi... |
# !/usr/bin/env python3.8
# -*- coding: utf-8 -*-
import os
import json
import numpy as np
import seaborn as sns
from matplotlib import pyplot as plt
from Utils import Log
import pandas as pd
import datetime
import pytz
timezone = pytz.timezone("America/Los_Angeles")
dt = timezone.localize(datetime.datetime.now())
... |
#
# Copyright 2019-2021 <NAME>
# 2019 <NAME>
#
# ### MIT license
#
# 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 ... |
# Time: O(m * n * sqrt(m * n))
# Space: O(m * n)
# the problem is the same as google codejam 2008 round 3 problem C
# https://github.com/kamyu104/GoogleCodeJam-2008/blob/master/Round%203/no_cheating.py
import collections
# Time: O(E * sqrt(V))
# Space: O(V)
# Source code from http://code.activestate.com/recipes/1... |
from __future__ import print_function
from options import Options
from lib.data import load_data
from lib.model import Ganomaly
import numpy as np
import torch
from torch.autograd import Variable
import torch.optim as optim
import torch.nn as nn
import torchvision.utils as vutils
import torchvision.transforms as trans... |
# -*- coding: utf-8 -*-
# Copyright (c) 2018, Compiler Explorer Authors
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright not... |
# -*- coding: utf-8 -*-
# @author: <NAME>
# @email1: <EMAIL>
# @organization: University of Sherbrooke
"""
This module contains an implementation of the non-Markovian transfer tensor
method (TTM), introduced in [1].
[1] <NAME> and <NAME>, Phys. Rev. Lett 112, 110401 (2014)
"""
import numpy as np
from qutip import ... |
"""
Raster related functions to be used in Python scripts.
Usage:
::
from grass.script import raster as grass
grass.raster_history(map)
(C) 2008-2011 by the GRASS Development Team
This program is free software under the GNU General Public
License (>=v2). Read the file COPYING that comes with GRASS
for deta... |
import contextlib
from ctypes import (cdll, POINTER, c_double,
c_void_p, c_int, c_float, c_int32,
byref, string_at, create_string_buffer)
from warnings import warn
import numpy as np
from wurlitzer import pipes
from .vstwrap import (
AudioMasterOpcodes,
AEffect,
AEf... |
# (c) 2012-2019, Ansible by Red Hat
#
# This file is part of Ansible Galaxy
#
# Ansible Galaxy is free software: you can redistribute it and/or modify
# it under the terms of the Apache License as published by
# the Apache Software Foundation, either version 2 of the License, or
# (at your option) any later version.
#
... |
# coding=utf-8
# ------------------------------------
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
# ------------------------------------
from enum import Enum
from typing import TYPE_CHECKING, Dict, Any
from ._generated.models import ContentProperties as GeneratedContentProperties
if TYPE... |
# Copyright 2021 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
import datetime
import getpass
import re
import time
import pytest
from freezegun import freeze_time
from pants.base.build_environment import get_buildroot
from pants.base.exiter import ... |
# -*- coding: utf-8 -*- {{{
# vim: set fenc=utf-8 ft=python sw=4 ts=4 sts=4 et:
#
# Copyright 2019, Battelle Memorial Institute.
#
# 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... |
"""
A version helper in the spirit of versioneer.
Minimalistic and able to run without build step using pkg_resources.
"""
# __version__ is defined at the very end of this file.
import re
import os
import sys
from pathlib import Path
from subprocess import run, PIPE, CalledProcessError
from textwrap import dedent
fro... |
from stylesheet import *
from PyQt6.QtCore import *
from PyQt6.QtGui import *
from PyQt6.QtWidgets import *
from datetime import datetime
from sys import path
from typing import Optional
import subprocess, os, psutil
if path[0].endswith('\\app'):
del path[0]
if '' not in path:
path.append('')
from app.receive... |
import datetime
import pytz
from babel import numbers
import ckan.lib.i18n as i18n
from ckan.common import _, ungettext
##################################################
# #
# Month translations #
# ... |
import os
import numpy as np
import cv2
import torch.nn as nn
import torch.nn.functional as F
import torch
import math
import time
from typing import List
from visualDet3D.networks.utils import DETECTOR_DICT
from visualDet3D.networks.backbones import resnet
from visualDet3D.networks.lib.coordconv import CoordinateConv
... |
from __future__ import annotations # Needed for Python typing on "from_dict" static method
from typing import Dict, List, Set, Union, cast
import datetime
class DiffResult:
"""
Encapsulates the result of diffing two source responses
"""
def __init__(self, new_entries: List[Dict[str, str]], modified_... |
# python3
# Copyright 2021 InstaDeep Ltd. 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 applic... |
""" Module for model evaluation """
import diff_match_patch as dmp_module
import torch
import torch.utils.data
from torchtext.data.metrics import bleu_score
from models.generator import Transformer
from path_helper import get_project_root
from preprocessing.dataset import get_loader
from training.training_config impor... |
from mock import Mock
from django.conf import settings
from django.contrib.auth.models import AnonymousUser
from prices import Price
import pytest
from .core import Checkout, STORAGE_SESSION_KEY
from ..cart import Cart
from ..shipping.models import ShippingMethodCountry
from ..userprofile.models import Address
from .... |
import sys
from base64 import b64decode, b64encode
from io import BytesIO
__all__ = ("make_lambda_handler",)
DEFAULT_NON_BINARY_CONTENT_TYPE_PREFIXES = (
"text/",
"application/json",
"application/vnd.api+json",
)
def make_lambda_handler(
wsgi_app, binary_support=False, non_binary_content_type_prefix... |
"""
Provides a configuration class for the Hibiki module.
"""
import os.path
import json
from .constants import DEFAULT_CONFIG_FILE_PATH, DEFAULT_LIBRARY_FILE_PATH
class HibikiConfig(object):
"""Stores the configuration data used for synchronization."""
def __init__(self, destination=None, parent=None):
... |
from flask import Flask, render_template, request, session,url_for, redirect
from cassandra.cluster import Cluster
import requests
from pprint import pprint
#from jikanpy import Jikan
from werkzeug.security import generate_password_hash, check_password_hash
import os
cluster = Cluster(contact_points=['172.17.0.2'], po... |
from django.conf import settings
from django.contrib import admin
from django.db.models import Func
from django.forms import forms
from django.urls import reverse as django_reverse
from django.utils import timezone
from django.utils.functional import keep_lazy_text
from offer.models import Code
def reverse(viewname,... |
"""
"""
import argparse
import numpy as np
import os
import torch
from torchvision import datasets
from torch.nn.modules.loss import CrossEntropyLoss
from codes.sampler import DistributedSampler
from codes.simulators.simulator import (
ParallelTrainer,
DistributedEvaluator,
)
from codes.simulators.worker impor... |
################################################################################
# Measure, calibrate, and store all schlieren shots on a given day #
################################################################################
from funcs.post_processing.images import schlieren
import pandas as pd
impor... |
#######################################################################
#
# InfoBar Tuner State for Enigma-2
# Coded by betonme (c) 2011 <<EMAIL>ank(at)gmail.com>
# Support: http://www.i-have-a-dreambox.com/wbb2/thread.php?threadid=162629
#
# This program is free software; you can redistribute it and/or
# ... |
# uncompyle6 version 3.7.4
# Python bytecode 3.7 (3394)
# Decompiled from: Python 3.7.9 (tags/v3.7.9:13c94747c7, Aug 17 2020, 18:58:18) [MSC v.1900 64 bit (AMD64)]
# Embedded file name: T:\InGame\Gameplay\Scripts\Server\time_service.py
# Compiled at: 2018-06-05 22:34:57
# Size of source mod 2**32: 8950 bytes
import cac... |
from bs4 import BeautifulSoup
import requests
from tqdm import tqdm
import re
import matplotlib.pyplot as plt
import json, os
import datetime
def get_passages(url):
"""
get passages by url
:param url: the url to request a webpage
:return: passages from the page
"""
req = requests.get(url)
... |
# -*- coding: utf-8 -*-
import uuid
import pytz
from faker import Faker
from django.conf import settings
from django.contrib.auth import get_user_model
from django.contrib.gis.db.models import PointField
from django.contrib.postgres.indexes import BrinIndex
from django.contrib.postgres.fields import JSONField
from djan... |
from flask import Blueprint, render_template, request, redirect, session
from google.cloud import datastore
from utilities.vulnerabilities import get_vulnerability, assess_response, get_score_image, LEVEL1_POINTS, LEVEL2_POINTS
from utilities.sample_systems import sample_systems
vulnerability_defender = Blueprint("vul... |
from torch.utils.data import DataLoader
from ..util import barit, DirectoryDataset, LoadedDataset
from ..hdr.io import imread
from .opts import fetch_opts
def _custom_get_item(self, index):
if self.train:
img, target = self.train_data[index], self.train_labels[index]
else:
img, target = self.te... |
# Copyright (c) 2019 <NAME>
import math
from random import Random
from typing import List
from problem_sets import Problem, fmath, Widget, build_text_widget_options, gen_def
# Arbitrary number to keep while loops from hanging in rare cases
MAX_RANDOM_TRIES = 50
QUESTION_IS_FUNCTION = "is_function"
QUESTION_DOMAIN ... |
#!/usr/bin/env python3
import arbor
import pandas, seaborn
from math import sqrt
# Construct a cell with the following morphology.
# The soma (at the root of the tree) is marked 's', and
# the end of each branch i is marked 'bi'.
#
# b1
# /
# s----b0
# \
# b2
def make_cable_cell(gid):
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.