text stringlengths 3.07k 22.1k |
|---|
# -*- encoding: utf-8 -*-
# The MIT License (MIT)
#
# Copyright (c) 2014-2015 <NAME>, http://haltu.fi
#
# 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 withou... |
#!/usr/local/bin/python3
# solver2021.py : 2021 Sliding tile puzzle solver
#
# Code by: <EMAIL>
#
# Based on skeleton code by <NAME>, January 2021
#
import sys
from queue import PriorityQueue
ROWS=4
COLS=5
def printable_board(board):
return "\n".join([ ('%3d ')*COLS % board[j:(j+COLS)] for j in range(0, ROWS*CO... |
from pysb.testing import *
from pysb import *
from pysb.core import as_complex_pattern
from pysb.bng import *
import os
import unittest
from nose.tools import assert_raises_regexp
from pysb.generator.bng import BngPrinter
import sympy
import math
@with_model
def test_generate_network():
Monomer('A')
assert_ra... |
#!/usr/bin/env python
# coding: utf8
import asyncio
import datetime
import json
import os
import subprocess
import time
from sys import platform
from requests import get
from colorama import Fore, init
with open('settings.json', 'r') as settings:
settings = json.load(settings)
async def clear():
... |
import requests
import urllib3
from datetime import datetime, timedelta
from requests.auth import HTTPDigestAuth
import voluptuous as vol
from homeassistant.components.sensor import PLATFORM_SCHEMA, ENTITY_ID_FORMAT
from homeassistant.const import CONF_ID, CONF_NAME
import homeassistant.helpers.config_validation as c... |
#
# ovirt-engine-setup -- ovirt engine setup
#
# Copyright oVirt Authors
# SPDX-License-Identifier: Apache-2.0
#
#
"""
Package upgrade plugin.
"""
import datetime
import gettext
import os
from otopi import constants as otopicons
from otopi import plugin
from otopi import transaction
from otopi import util
from ovi... |
"""
Functionality for reading Capella SAR data into a SICD model.
"""
__classification__ = "UNCLASSIFIED"
__author__ = ("<NAME>", "<NAME>")
import logging
import json
from typing import Dict, Any, Tuple
from datetime import datetime
from collections import OrderedDict
from scipy.constants import speed_of_light
impo... |
"""InfluxDBClient is client for API defined in https://github.com/influxdata/influxdb/blob/master/http/swagger.yml."""
from __future__ import absolute_import
import configparser
import os
from influxdb_client import Configuration, ApiClient, HealthCheck, HealthService, Ready, ReadyService
from influxdb_client.client... |
#!/usr/bin/python
# this assumes you have the socks.py (http://phiral.net/socks.py)
# and terminal.py (http://phiral.net/terminal.py) in the
# same directory and that you have tor running locally
# on port 9050. run with 128 to 256 threads to be effective.
# kills apache 1.X with ~128, apache 2.X / IIS with ~256
# n... |
import os
import json
import numpy as np
from experiment_handler.time_synchronisation import convert_timestamps
from experiment_handler.finder import find_all_imu_files
def load_imu_file(filepath):
lines = []
with open(filepath, 'r') as file:
try:
lines = file.read().split("\n")
ex... |
# Copyright (c) Facebook, Inc. and its affiliates.
#
# 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 ... |
# Copyright 2015 Tesora 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 a... |
# -*- coding: utf-8 -*-
import numpy as np
import random
import sys
from collections import Counter
import json
from argparse import ArgumentParser
from json_utils import load_json_file, load_json_stream
def get_leaves(node, leaves):
if node["left"] is not None:
get_leaves(node["left"], leaves)
g... |
import itertools
from runtests.mpi import MPITest
import pybnb
from .common import mpi_available
def left_child(i):
return 2 * i + 1
def right_child(i):
return 2 * i + 2
def log2floor(n):
assert n > 0
return n.bit_length() - 1
def height(size):
return log2floor(size)
def set_none(heap, ... |
from typing import Dict, Tuple
from gym.envs.registration import register
import numpy as np
from highway_env import utils
from highway_env.envs.common.abstract import AbstractEnv, MultiAgentWrapper
from highway_env.road.lane import LineType, StraightLane, CircularLane, AbstractLane
from highway_env.road.regulation i... |
import os
import sys
import time
import pathlib
import json
import logging
import traceback
import requests
import argparse
import threading
import queue
from fastapi.testclient import TestClient
from urllib.parse import urlencode
from main import app
afscreener_url = os.environ.get(
"AF_URL", "")
afscreener_tok... |
"""
Implements Genetic algorithms for black-box optimisation.
--<EMAIL>
"""
# pylint: disable=invalid-name
# pylint: disable=no-member
from argparse import Namespace
from numpy.random import choice
# Local imports
from .blackbox_optimiser import BlackboxOptimiser, blackbox_opt_args
from ..utils.general_utils impo... |
#!/usr/bin/env python
"""Remote access utilities, via ssh & scp."""
from __future__ import print_function
import optparse
import os
import re
import shlex
import sys
import time
# The subprocess32 module is untested on Windows and thus isn't recommended for use, even when it's
# installed. See https://github.com/go... |
#!/usr/bin/env python3
"""
Pipeline for PANGAEA data, with custom NETCDF reading.
This script allows for data updates.
@author: giuseppeperonato
"""
import json
import logging
import os
import shutil
import sys
import frictionless
import numpy as np
import pandas as pd
import requests
import utilities
import xarray
... |
"""
This module is for inspecting OGR data sources and generating either
models for GeoDjango and/or mapping dictionaries for use with the
`LayerMapping` utility.
"""
from django.utils.six.moves import zip
# Requires GDAL to use.
from django.contrib.gis.gdal import DataSource
from django.contrib.gis.gdal.field import O... |
# Copyright 2019 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
#
# Unless required by applicable law or agreed to in writing, ... |
# Copyright 2016 <NAME>, alexggmatthews
#
# 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 wr... |
# BSD 3-Clause License
#
# Copyright (c) 2019, Elasticsearch BV
# 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 notice, t... |
# -*- coding: utf-8 -*-
"""
Tencent is pleased to support the open source community by making 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community
Edition) available.
Copyright (C) 2017-2021 TH<NAME>, a Tencent company. All rights reserved.
Licensed under the MIT License (the "License"); you may not use this file except in complianc... |
# Copyright (c) 2017 Sony 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 (c) 2017 Sony 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... |
# Licensed under a 3-clause BSD style license - see LICENSE.rst
# -*- coding: utf-8 -*-
import numpy as np
from asdf.versioning import AsdfVersion
from astropy.modeling.bounding_box import ModelBoundingBox, CompoundBoundingBox
from astropy.modeling import mappings
from astropy.modeling import functional_models
from a... |
#!/usr/bin/env python
"""
This is the interface for Dashboard information submission
It's meant to be run after every job, parsing information out
of the job and the report.
"""
from __future__ import print_function
from future import standard_library
standard_library.install_aliases()
from xml.dom import minidom
... |
#!/usr/bin/env python
import argparse
import os
from datetime import datetime
import subprocess
import numpy as np
import atmodat_checklib.utils.output_directory_util as output_directory
import atmodat_checklib.utils.summary_creation_util as summary_creation
from atmodat_checklib.utils.env_util import set_env_variabl... |
import cma
import logging as log
import numpy as np
import os.path
import pickle
import humblerl as hrl
from humblerl import ChainInterpreter, Mind, Worker
from memory import build_rnn_model, MDNInterpreter
from vision import BasicInterpreter, build_vae_model
from common_utils import ReturnTracker, create_directory, ... |
import requests
from bs4 import BeautifulSoup, Comment, Tag
from pathlib import Path
import pickle
import re
utcDocRegistry_urls = {
2000: "https://www.unicode.org/L2/L2000/Register-2000.html",
2001: "https://www.unicode.org/L2/L2001/Register-2001.html",
2002: "https://www.unicode.org/L2/L2002/Register-20... |
import uasyncio as asyncio
# NOTE: We use pyb.Timer and not machine.Timer so we can specify one of the high-speed timers
from pyb import LED, Timer
from machine import Pin, UART
import time
from primitives.switch import Switch
from py_cc.cc_classes import CCVersion
from py_cc.cc_protocol import CCActuator, CCAssignmen... |
"""Jobs for performing electron phonon calculations in VASP."""
from __future__ import annotations
import logging
from dataclasses import dataclass, field
from pathlib import Path
from typing import Dict, List, Tuple
import numpy as np
from jobflow import Flow, Response, job
from pymatgen.core import Structure
from ... |
# 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 may ... |
import numpy as np
import biorbd_casadi as biorbd
from casadi import MX, vertcat
from bioptim import (
OptimalControlProgram,
DynamicsFcn,
DynamicsList,
Bounds,
QAndQDotBounds,
InitialGuess,
ObjectiveFcn,
ObjectiveList,
ConstraintList,
ConstraintFcn,
InterpolationType,
No... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Jul 3 17:14:53 2019
@author: liuhongbing
"""
import pandas as pd
import numpy as np
from scipy import stats
from sklearn.metrics import precision_score, recall_score, f1_score, confusion_matrix, roc_curve, auc
import tensorflow as tf
# 加载数据集
def read... |
# This file is part of h5py, a Python interface to the HDF5 library.
#
# http://www.h5py.org
#
# Copyright 2008-2013 <NAME> and contributors
#
# License: Standard 3-clause BSD; see "license.txt" for full license terms
# and contributor agreement.
from __future__ import absolute_import
import sys
import nu... |
"""
This module converts code written for numarray to run with numpy
Makes the following changes:
* Changes import statements
import numarray.package
--> import numpy.numarray.package as numarray_package
with all numarray.package in code changed to numarray_package
import numarray --> import... |
# pylint: disable=g-bad-file-header
# Copyright 2017 The Bazel 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
... |
# Copyright 1999-2018 Alibaba Group Holding 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 a... |
import enum
import json
import pathlib
import shutil
from typing import Any, Dict, List, Optional
from determined_common import api, storage
from determined_common.api import gql
class ModelFramework(enum.Enum):
PYTORCH = 1
TENSORFLOW = 2
class Checkpoint(object):
"""
Class representing a checkpoin... |
from sympy import QQ, ZZ
from sympy.abc import x, theta
from sympy.core.mul import prod
from sympy.ntheory import factorint
from sympy.ntheory.residue_ntheory import n_order
from sympy.polys import Poly, cyclotomic_poly
from sympy.polys.matrices import DomainMatrix
from sympy.polys.numberfields.basis import round_two
f... |
from typing import Callable, Dict, List, Union
import dgl
import dgl.nn.pytorch as dglnn
import torch
import torch.nn as nn
class RelGraphEmbedding(nn.Module):
def __init__(
self,
hg: dgl.DGLHeteroGraph,
embedding_size: int,
num_nodes: Dict[str, int],
node_feats: Dict[str,... |
#!/usr/bin/env python
# -*- coding:utf-8 -*-
"""
Date: 2022/2/24 14:50
Desc: 真气网-空气质量
https://www.zq12369.com/environment.php
空气质量在线监测分析平台的空气质量数据
https://www.aqistudy.cn/
"""
import json
import os
import re
import pandas as pd
import requests
from py_mini_racer import py_mini_racer
from akshare.utils import demjson
... |
"""Terraform version management."""
from distutils.version import LooseVersion # noqa pylint: disable=import-error,no-name-in-module
import glob
import json
import logging
import os
import platform
import re
import shutil
import sys
import tempfile
import zipfile
# Old pylint on py2.7 incorrectly flags these
from six... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2011 <NAME> <<EMAIL>>
"""USAGE: %(program)s MATRIX.mm [CLIP_DOCS] [CLIP_TERMS]
Check truncated SVD error for the algo in gensim, using a given corpus. This script
runs the decomposition with several internal parameters (number of requested factors,
iter... |
"""Basic result reporters."""
import csv
import json
import pickle
import signal
from collections import defaultdict
from itertools import chain
from multiprocessing import Process, SimpleQueue
from xml.sax.saxutils import escape as xml_escape
from snakeoil import pickling
from snakeoil.decorators import coroutine
f... |
# coding=utf-8
# Copyright 2020 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... |
import contextlib
import math
from collections import defaultdict
from time import perf_counter
from warnings import filterwarnings
import numpy
import dask
from dask.base import tokenize
from dask.dataframe.core import new_dd_object
from dask.distributed import Client, performance_report, wait
from dask.utils import... |
""" Factory methods to build Data objects from files
Implementation notes:
Each factory method conforms to the folowing structure, which
helps the GUI Frontend easily load data:
1) The first argument is a file name to open
2) The return value is a Data object
3) The function should be decorated with data_factory a... |
# Copyright (c) 2021, Intel Corporation
#
# SPDX-License-Identifier: BSD-3-Clause
import matplotlib as mpl
mpl.use('Agg')
import matplotlib.dates as mdates
import matplotlib.pyplot as plt
import numpy as np
from matplotlib.ticker import (AutoMinorLocator, FuncFormatter, MaxNLocator,
For... |
import pytest
from uint import Uint
def test_positive_overflow():
u = Uint(0b11111111, 8)
u += 1
assert u.raw == 0b00000000
def test_negative_overflow():
u = Uint(0b00000000, 8)
u -= 1
assert u.raw == 0b11111111
def test_logical_shift():
u = Uint(0b10100101, 8)
u <<= 1
assert u... |
# This file is part of the P3IV Simulator (https://github.com/fzi-forschungszentrum-informatik/P3IV),
# copyright by FZI Forschungszentrum Informatik, licensed under the BSD-3 license (see LICENSE file in main directory)
import unittest
import numpy as np
from p3iv_utils.coordinate_transformation import CoordinateTran... |
"""
Here the structure of the network is made in pytorch
"""
from typing import List, Union, Optional
import torch
import os
from logger import logger
import torch.nn as nn
import torch.nn.functional as F
import numpy as np
from scipy.stats import norm
class Encoder(nn.Module):
"""
Encodes the data using a CN... |
import file_helper
import shutil
import os
import re
import yaml
import json
#
# The `specification` folder in the azure-rest-api-specs repo contains the folder hierarchy for the swagger specs
#
# specification
# |-service1 (e.g. `cdn` or `compute`)
# | |-common
# | |-quickstart-tem... |
# -*- coding: utf-8 -*-
# This file as well as the whole tsfresh package are licenced under the MIT licence (see the LICENCE.txt)
# <NAME> (<EMAIL>), Blue Yonder Gmbh, 2016
import os
import tempfile
import numpy as np
import pandas as pd
from mock import Mock
from tests.fixtures import DataTestCase
from tsfresh.feat... |
# coding=utf-8
#
# created by kpe on 28.Mar.2019 at 12:33
#
from __future__ import absolute_import, division, print_function
import tensorflow as tf
import params_flow as pf
from tensorflow import keras
from tensorflow.keras import backend as K
import bert
class PositionEmbeddingLayer(bert.Layer):
class Param... |
# predict probabilities for counts, given a set of future features
# execute: python predict.py
# This file can be scheduled to run at any time.
# It will generate hourly predictions for the remaining hours in today and N-additional days:
# - current hour - if the job is running at 8:45, the first prediction will be fo... |
from __main__ import sio
''' Events handlers for Join room and leave room ,
This method contains join room and leave room for all name spaces. This was introduced to ensure join room and leave
room happens within the namespace'''
@sio.on('join_room', namespace='/project')
async def join_room(sid, room_name):
pri... |
# -*- coding: utf-8 -*-
#
# miditk/smf/parser.py
#
"""MIDI file low-level binary parsing."""
from __future__ import absolute_import, unicode_literals
# standard library imports
import logging
# package-specific imports
from ..common.constants import (CHANNEL_PRESSURE, CONTROLLER_CHANGE, END_OF_EXCLUSIVE,
... |
"""
Train a new model on one or across multiple GPUs.
"""
from comet_ml import ExistingExperiment, Experiment
import collections
import math
import random
from getpass import getpass
import keyring
import numpy as np
import torch
from fairseq import (
checkpoint_utils,
distributed_utils,
options,
pr... |
#!/usr/bin/env python
# encoding: utf-8
"""Usage:
convert.py serial_speakers <input_path> <serie_uri> <annotation_path> <annotated_path> [--map]
"""
from pyannote.core import Annotation, Segment, Timeline
import pyannote.database
from Plumcot import Plumcot
import json
from termcolor import colored
import numpy as n... |
# -*- coding: utf-8 -*-
import unicodedata
from .base import BaseGenerator
class GenerateRFC(BaseGenerator):
key_value = 'rfc'
DATA_REQUIRED = ('complete_name', 'last_name', 'mother_last_name', 'birth_date')
partial_data = None
def __init__(self, **kwargs):
self.complete_name = kwargs.get('complete_name')
s... |
# Copyright (c) 2020, 2021 Oracle and/or its affiliates.
# This software is made available to you under the terms of the GPL 3.0 license or the Apache 2.0 license.
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
# Apache License v2.0
# See LICENSE.TXT for details.
"""This m... |
"""Conjugate Gradient Optimizer.
Computes the decent direction using the conjugate gradient method, and then
computes the optimal step size that will satisfy the KL divergence constraint.
Finally, it performs a backtracking line search to optimize the objective.
"""
import warnings
from dowel import logger
import nu... |
# Copyright (c) 2018 Cloudify Platform 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 ap... |
# -*- coding: utf-8 -*-
# mui ui text view class
import time
from enum import Enum
try:
from parts import AbsParts
from matrix import Matrix
from muifont import MuiFont
except ImportError:
from . import AbsParts
from . import Matrix
from . import MuiFont
LINE_OFFSET = (8+3)
class Border(Enu... |
'''
Modified from https://raw.githubusercontent.com/jeonsworld/ViT-pytorch/main/models/modeling.py
MIT License
Copyright (c) 2020 jeonsworld
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 witho... |
import os
import sys
import numpy as np
from joblib import Parallel, delayed
import joblib
import argparse
import importlib
from itertools import product
import collections
from copy import deepcopy
from mcpy.utils import filesafe
from mcpy import plotting
def _get(opts, key, default):
return opts[key] if (key in... |
import os
from django.conf import settings
from django.core.exceptions import ValidationError
from django.core.files.storage import default_storage as storage
from django.db import models
from django.db.models.fields import BLANK_CHOICE_DASH
from django.forms.widgets import RadioSelect
from django.utils.safestring imp... |
import pytest
from homepage.models import Course
from django.core.exceptions import ValidationError
from decimal import Decimal
# -----------course tests----------- #
# creating a single new course with valid input
@pytest.mark.parametrize("valid_courses", [
(1, "Linear Algebra 1", True, 4),
# ... |
# coding: utf8
"""
Ensemble de fonctions pour manipuler une instance du problème "Le jardinier et
les taupes", dans le cas où l'objectif est :
- qu'aucune taupe ne puisse pénétrer dans le jardin ;
- que le nombre de pièges soit minimal.
"""
import os
import itertools
import numpy as np
import pulp
def _dimcheck(g... |
#!/usr/bin/env python
# coding=utf-8
"""
Evaluation (t-tree comparison functions).
"""
from __future__ import unicode_literals
from __future__ import division
from builtins import zip
from builtins import range
from builtins import object
from past.utils import old_div
from collections import defaultdict
from enum im... |
'''
Created on Oct 23, 2017
@author: ronaldmaceachern
modules for methods to clean dirty .csv using a set of rules
'''
import re
import os
import numpy as np
import pandas as pd
from difflib import SequenceMatcher
def makeRowDf( x, desc_name = '', cols = None):
'''a wrapper function to make it neater to mak... |
import time
import random
import pygame
from shield import Shield
from explosion import Explosion
from meteor import Meteor
from ship import Ship
from bonus import Bonus
from const import *
from bullet import Bullet
import sys
pygame.init()
window = pygame.display.set_mode((SCREEN_WIDTH, SCREEN_HEIGHT))
bg... |
import os, sys
import argparse
import numpy as np
import cv2
from skimage import filters
from linefiller.thinning import thinning
from linefiller.trappedball_fill import trapped_ball_fill_multi, flood_fill_multi, mark_fill, build_fill_map, merge_fill, \
show_fill_map, my_merge_fill
def dline_of(x, low_thr=1, h... |
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
from pylab import *
import re
from sklearn.metrics.pairwise import euclidean_distances
import keywords
import problem_params
pb_video_id_dict = {
'1-1' : 'ID',
}
# specify problem number
unit = int(sys.argv[1])
pb = int(sys.argv[2])
u_pb = '{}-... |
# This code parses date/times, so please
#
# pip install python-dateutil
#
# To use this code, make sure you
#
# import json
#
# and then, to convert JSON from a string, do
#
# result = article_model_from_dict(json.loads(json_string))
from enum import Enum
from dataclasses import dataclass
from typing impo... |
import collections
import fnmatch
import json
import math
import os
from typing import Dict, List
from PIL import Image # requires: pip install Pillow
AllocatedSpace = collections.namedtuple("AllocatedSpace", ["x", "y", "width", "height"])
Row = collections.namedtuple("Row", ["top", "height", "free_width"])
class... |
# imports
import time
from pathlib import Path
from typing import Tuple, Union
import numpy as np
import torch
from shapely.geometry.point import Point
from skimage.draw import circle_perimeter_aa
from torch import nn, Tensor # using torch.Tensor is annoying
from torch.utils.data import Dataset, DataLoader
from CNN ... |
import json
import random
from datetime import datetime, timedelta
from flask import current_app
from notifications_utils.s3 import s3upload
from requests import HTTPError, request
from app import notify_celery
from app.aws.s3 import file_exists
from app.celery.process_ses_receipts_tasks import process_ses_results
fr... |
# -*- coding: utf-8 -*-
# Copyright FMR LLC <<EMAIL>>
# SPDX-License-Identifier: Apache-2.0
"""Handles payloads from markup files"""
import os
import sys
from abc import abstractmethod
from itertools import chain
from pathlib import Path
from spock.backend.handler import BaseHandler
from spock.backend.utils import ... |
import asyncio
from contextlib import asynccontextmanager
from datetime import datetime, timedelta
from http.cookies import SimpleCookie
from json import dumps
from typing import Any, AnyStr, AsyncGenerator, List, Optional, Tuple, TYPE_CHECKING, Union
from urllib.parse import unquote, urlencode
from .datastructures im... |
import sys, os, imp, math, shutil
import py
from cffi import FFI, FFIError
from cffi.verifier import Verifier, _locate_engine_class, _get_so_suffixes
from cffi.ffiplatform import maybe_relative_path
from testing.udir import udir
class DistUtilsTest(object):
def setup_class(self):
self.lib_m = "m... |
"""The Media Source implementation for the Jellyfin integration."""
from __future__ import annotations
import logging
import mimetypes
from typing import Any
import urllib.parse
from jellyfin_apiclient_python.api import jellyfin_url
from jellyfin_apiclient_python.client import JellyfinClient
from homeassistant.compo... |
# -*- coding: utf-8 -*-
"""
Created on Wed Aug 28 11:46:55 2013
@author: Craig
"""
# standard modules
import json
import logging
import pprint
import urllib
import urllib2
# site modules
# local modules
# CONSTANTS
# CKAN structure:
# A CKAN site has a number of datasets
# Each dataset is a collection of datafil... |
from django.contrib.auth.models import (
Permission,
Group
)
from django.contrib.auth import get_user_model
from django.contrib.contenttypes.models import ContentType
from papermerge.core.models import (
Access,
AccessDiff
)
# custom user is used - papermerge.core.models.User
User = get_user_model()
... |
import os
import random
import pickle as pk
import logging
from collections import defaultdict
from chemreader.readers.readmol2 import Mol2
import h5py
import numpy as np
from scipy import sparse
from tqdm import tqdm
from slgnn.config import PAD_ATOM, PAD_BOND
SEED = 1458907
random.seed(SEED)
class ZincToHdf5:
... |
from itertools import product, starmap
from pytest import fixture, mark, raises
from loggingex.context import (
ContextChange,
ContextChangeAlreadyStartedException,
ContextChangeNotStartedException,
ContextInvalidNameException,
)
from .helpers import InitializedContextBase
def test_default_construct... |
import time
from .. import jwt
import warnings
warnings.simplefilter('always', DeprecationWarning)
TASK_ROUTER_BASE_URL = 'https://taskrouter.twilio.com'
TASK_ROUTER_BASE_EVENTS_URL = 'https://event-bridge.twilio.com/v1/wschannels'
TASK_ROUTER_VERSION = "v1"
REQUIRED = {'required': True}
OPTIONAL = {'required': Fals... |
#!/usr/bin/python3
# -*- coding: utf-8 -*-
# Author: <NAME>
# Creation date: 2021-09-11 (year-month-day)
"""
Implements SGLD to sample from the input data distribution, and various buffers to
store the MCMC samples.
"""
import torch
import torch.nn as nn
from torch.distributions.bernoulli import Bernoulli as TorchBer... |
import sys
import os
# Root directory of the project
ROOT_DIR = os.getcwd()
print(f"{ROOT_DIR}")
# Import Mask RCNN
sys.path.append(ROOT_DIR) # To find local version of the library
from mrcnn import visualize
from mrcnn import model as modellib
from mrcnn import utils
from mrcnn.config import Config
from mrcnn.model... |
# coding=utf-8
# Copyright 2021 The Uncertainty Baselines 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 ap... |
# -*- coding: utf-8 -*-
# Copyright 2014 OpenMarket 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 la... |
# Copyright 2019 Xanadu Quantum Technologies 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 agre... |
import sys, os, shutil, yaml, subprocess, struct
import elftools.elf.elffile
import addrconv
GCC_PATH = r'C:\devkitPro\devkitPPC\bin/'
OBJ_PATH = r'C:\devkitPro\devkitPPC\powerpc-eabi\bin/'
GHS_PATH = 'C:/ghs/multi5327/'
TEMPLATE = """#!gbuild
primaryTarget=ppc_standalone.tgt
[Project]
\t-bsp generic
\t-cpu=espresso
... |
from urllib.request import urlopen
import json
import math
class API(object):
'''Methods for accessing the API'''
def __init__(self, key=''):
self.key = key
'''Api instance constructor
Parameters
---------
key: Optional argument which adds your API key to all API calls... |
from django.views.generic.base import View, TemplateView
from django.http import HttpResponseRedirect, JsonResponse
from django.core.urlresolvers import reverse
from django.utils import timezone
from django.contrib import messages
from django.utils.translation import ugettext_lazy as _
from django.core.paginator impor... |
import torch.nn as nn
from modules.DGL.transformer.layers import *
from modules.DGL.transformer.functions import *
from modules.DGL.transformer.embedding import *
from modules.DGL.transformer.optims import *
import dgl.function as fn
import torch.nn.init as INIT
class MultiHeadAttention(nn.Module):
... |
import os
import time
import argparse
from datetime import datetime
import subprocess
import pdb
import math
import numpy as np
import pybullet as p
import pickle
import matplotlib.pyplot as plt
import gym
from gym import error, spaces, utils
from gym.utils import seeding
from gym.spaces import Box, Dict
import torch
i... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.