text stringlengths 957 885k |
|---|
"""Functional tests using pytest-flask."""
from backend import models
from pytest import mark
from tests import asserts
@mark.parametrize('endpoint', ['reports.list_submits'], indirect=True)
class TestListSubmits:
@mark.usefixtures('grant_admin')
@mark.parametrize('query', indirect=True, argvalues=[
... |
#
# caloStage2Params_2017_v1_10
# change w.r.t. v1_8_4: 92X Layer 1 SF
#
import FWCore.ParameterSet.Config as cms
from L1Trigger.L1TCalorimeter.caloParams_cfi import caloParamsSource
import L1Trigger.L1TCalorimeter.caloParams_cfi
caloStage2Params = L1Trigger.L1TCalorimeter.caloParams_cfi.caloParams.clone()
# towers
c... |
# -*- coding: utf-8 -*-
# *****************************************************************************
# NICOS, the Networked Instrument Control System of the MLZ
# Copyright (c) 2009-2022 by the NICOS contributors (see AUTHORS)
#
# This program is free software; you can redistribute it and/or modify it under
# the t... |
<reponame>leelige/mindspore
# Copyright 2021 Huawei Technologies Co., Ltd
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by... |
<filename>search/irank.py
import numpy as np
from structures import Graph
def normalize(vec):
"""
Function performs mathematical normalization of the first order for a given n - dimensional vector.
:param vec: vector to be normalized
:return: normalized vector
"""
if np.count_nonzero(vec) == ... |
<gh_stars>0
import re
import pandas as pd
import urllib.parse
from collections import namedtuple
text_doc_head_pattern_str = "<doc id=\"(.*?)\" url=\"(.*?)\" title=\"(.*?)\""
anchor_pattern_str = "<a href=\"(.*?)\">(.*?)</a>"
WikiTextInfo = namedtuple('WikiTextInfo', ['title', 'wid', 'text'])
no_comma_util_title_pr... |
<gh_stars>0
from django.shortcuts import render
from django.http import HttpResponse, HttpResponseBadRequest, HttpResponseServerError
from django.shortcuts import redirect
from sampleAppOAuth2.services import *
from sampleAppOAuth2 import getDiscoveryDocument
import urllib
# from django.template import Context, Templat... |
<filename>landscape/vault.py
import hvac
import os
import sys
import yaml
import base64
import logging
def kubeconfig_context_entry(context_name):
"""
Generates a kubeconfig context entry
Args:
context_name (str): The Kubernetes context
Returns:
context entry for kubeconfig file (dict... |
<reponame>seqRep/dgl-lifesci
# -*- coding: utf-8 -*-
#
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: Apache-2.0
#
# SchNet
# pylint: disable=C0103, C0111, W0621, W0221, E1102, E1101
import numpy as np
import torch
import torch.nn as nn
from dgl.nn.pytorch import CFCon... |
<reponame>huilin16/PaddleRS
# Copyright (c) 2022 PaddlePaddle 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
#... |
<filename>neural_circuits/SC_Circuit_4.py
import tensorflow as tf
import numpy as np
import scipy
from scipy.special import expit
import matplotlib.pyplot as plt
import os
from epi.util import get_conditional_mode
DTYPE = tf.float32
t_cue_delay = 1.2
t_choice = 0.3
t_post_choice = 0.3
t_total = t_cue_delay + t_choice... |
<gh_stars>0
#!/usr/bin/env python
import matplotlib.pyplot as plt
def main(output: str):
output = output.replace("silhouette with k=", '').replace(' ', '').strip().split()
values = [(int(line[0]), float(line[1])) for line in [l.split(':') for l in output]]
xs = [x for (x, _) in values]
ys = [y for (_, ... |
<reponame>testigos2022/ocr-forms
import itertools
import os
from pathlib import Path
import numpy as np
from sklearn.decomposition import PCA
from sklearn.metrics.pairwise import cosine_similarity
from sklearn.pipeline import Pipeline
from sklearn.preprocessing import StandardScaler
from tqdm import tqdm
from data_io... |
<reponame>Ravillatypov/zadarma-call-integation
import os
from asyncio import sleep
from datetime import date, datetime, timedelta
from settings import Config
from zadarma import ZadarmaAPI
from functools import lru_cache
from dataclasses import dataclass
from models import CallRecords
from sanic.log import logger
@d... |
# -*- coding: utf-8 -*-
##########################################################################
# NSAp - Copyright (C) CEA, 2020
# Distributed under the terms of the CeCILL-B license, as published by
# the CEA-CNRS-INRIA. Refer to the LICENSE file or to
# http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
#... |
from __future__ import annotations
import sys
from typing import Any, TypeVar, Type, Union, Optional, Callable
from objectmodel.base import ObjectModelABC, FieldABC
from objectmodel.errors import FieldValidationError, FieldValueRequiredError
__all__ = [
'NOT_PROVIDED',
'Field',
'ObjectField',
'List... |
import datetime
import math
import itertools
import pytest
import calendar
from homeplotter.timeseries import TimeSeries
sample_data = {
"broken":[[datetime.date(2020, 10, 12), 200.0],[datetime.date(2020, 11, 24), 50.0],[datetime.date(2020, 12, 5), 200.0], [datetime.date(2020, 12, 30), 400.0], [datetime.date(2020... |
<reponame>TimKam/py-ciu
import random
import pandas as pd
from ciu.ciu_object import CiuObject
def _generate_samples(case, feature_names, min_maxs, samples, indices,
category_mapping):
rows = []
rows.append(case)
for sample in range(samples):
sample_entry = {}
for in... |
<reponame>NanoMembers/DeepFlow
#!/usr/bin/env python3
###Use CUDA_VISIBLE_DEVICES=0,1,2... is used to make sure only the right GPUs
###are made visible
import argparse
import numpy as np
import os
import tensorflow as tf
import time as _time
import timeit
tf.debugging.set_log_device_placement(True)
v = tf.Variable(1... |
import polyphony
from polyphony.io import Port
from polyphony.typing import bit, uint3, uint12, uint24
from polyphony.timing import clksleep, clkfence, wait_rising, wait_falling
CONVST_PULSE_CYCLE = 10
CONVERSION_CYCLE = 39
@polyphony.module
class spi_lis3dh:
def __init__(self):
self.sclk = Port(bit, 'ou... |
<reponame>petertdavies/execution-specs
"""
Ethash Functions
^^^^^^^^^^^^^^^^
.. contents:: Table of Contents
:backlinks: none
:local:
Introduction
------------
Ethash algorithm related functionalities.
"""
from typing import Callable, Tuple, Union
from ethereum.base_types import UINT32_MAX_VALUE, Bytes8, U... |
<filename>lib/pytaf/tafdecoder.py
import re
from .taf import TAF
class DecodeError(Exception):
def __init__(self, msg):
self.strerror = msg
class Decoder(object):
def __init__(self, taf):
if isinstance(taf, TAF):
self._taf = taf
else:
raise DecodeError("Argument... |
# coding: utf-8
import logging
import argparse
import random
import torch
import torchtext
from torch.optim.lr_scheduler import StepLR
import seq2seq
from seq2seq.trainer import SupervisedTrainer
from seq2seq.models import EncoderRNN, DecoderRNN, Seq2seq
from seq2seq.loss import Perplexity
from seq2seq.optim import ... |
<gh_stars>0
{'type':'CustomDialog',
'name':'prefsDialog',
'title':'standaloneBuilder Preferences',
'position':(133, 73),
'size':(705, 395),
'components': [
{'type':'TextField',
'name':'resEditPath',
'position':(205, 30),
'size':(405, -1),
'actionBindings':{},
'userdata':'Se... |
'''
@author: <NAME> (jakpra)
@copyright: Copyright 2020, <NAME>
@license: Apache 2.0
'''
import sys
import math
from operator import itemgetter
from collections import OrderedDict, Counter
import time
import random
import torch
import torch.nn.functional as F
import torch.optim as optim
from .oracle.oracle import m... |
<reponame>markdewing/qmcpack
##################################################################
## (c) Copyright 2015- by <NAME> ##
##################################################################
#====================================================================#
# fileio.py ... |
<reponame>glader/airflow-clickhouse-plugin
from unittest import TestCase, mock
from clickhouse_driver.errors import ServerException, ErrorCodes
from tests.util import LocalClickHouseHook
class ClientFromUrlTestCase(TestCase):
def test_temp_table(self):
hook = LocalClickHouseHook()
temp_table_nam... |
<filename>ubiops_cli/src/deployments.py
import ubiops as api
import os
from time import sleep
from ubiops_cli.utils import init_client, read_yaml, write_yaml, zip_dir, get_current_project, \
set_dict_default, write_blob, default_version_zip_name, parse_json
from ubiops_cli.src.helpers.deployment_helpers import def... |
from restclients_core import models
# Create your models here.
class Status(models.Model):
STATUS_TYPE_BOOKED_SPACE = -14
STATUS_TYPE_WAIT = -13
STATUS_TYPE_CANCEL = -12
STATUS_TYPE_INFO_ONLY = -11
STATUS_TYPE_CHOICES = (
(STATUS_TYPE_BOOKED_SPACE, 'Booked Space'),
(STATUS_TYPE_WA... |
<gh_stars>1-10
from Simulation import MMCC
from Event import Event
from pylab import *
from math import factorial
def blockingProbability(num_servers: int, arrival_rate: float, departure_rate: float) -> float:
""" Static function to be able to analytical determine the expected blocking
probability for a simula... |
<reponame>onlyyou2023/buildtools
#!/usr/bin/env python
# Copyright 2012 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Makes sure that files include headers from allowed directories.
Checks DEPS files in the source tr... |
from datetime import datetime
from datetime import timedelta
from yelp_beans.matching.match import generate_meetings
from yelp_beans.matching.match_utils import get_counts_for_pairs
from yelp_beans.matching.match_utils import get_previous_meetings
from yelp_beans.matching.match_utils import save_meetings
from yelp_bea... |
<filename>utils/optimize_thresholds.py
import os
import sys
sys.path.insert(1, os.path.join(sys.path[0], '../utils'))
import numpy as np
import argparse
import h5py
import math
import time
import logging
import sklearn
import pickle
from sklearn import metrics
import matplotlib.pyplot as plt
from autoth.core import Hyp... |
<gh_stars>0
from __future__ import unicode_literals
import os
import sys
import unittest
import yaml
from aws_okta_keyman.config import Config
if sys.version_info[0] < 3: # Python 2
import mock
else:
from unittest import mock
class ConfigTest(unittest.TestCase):
def test_full_app_url(self):
... |
<filename>eyelab/main.py<gh_stars>0
import logging
import os
import sys
from functools import partial
from pathlib import Path
import eyepy as ep
import requests
from packaging import version
from PySide6 import QtWidgets
from PySide6.QtCore import QCoreApplication, QSize
from PySide6.QtGui import QIcon
from PySide6.Q... |
# author: <NAME>, <NAME>
# version: 3.0
import cx_Oracle
import PySimpleGUI as sg
from Edit_Students import run_program as edit
from input_checker import check_string as check_string
old_class = '' # variable, holds the current name of the class
old_period_number = 0 # variable, holds the current period number of t... |
import datetime
import logging
import sys
from nltk.stem import WordNetLemmatizer
import projection
def crossLexiconOnRaw(corpusPath, crossedCorpusPath, csvFilePath, fieldNum=1):
time = datetime.datetime.now()
# Read the raw corpus
scoreDic = readScores(csvFilePath, fieldNum)
lexicon = readLexicon()... |
<reponame>tachyonicClock/avalanche<gh_stars>0
from abc import ABC
from typing import List, TYPE_CHECKING
from avalanche.core import StrategyCallbacks
if TYPE_CHECKING:
from avalanche.evaluation.metric_results import MetricValue
from avalanche.training.strategies import BaseStrategy
class StrategyLogger(Str... |
# coding: utf-8
from __future__ import with_statement
from operator import add
try:
from cStringIO import StringIO
except ImportError:
from StringIO import StringIO
import pytest
from chef.interpreter import Interpreter
from chef.datastructures import Ingredients, Ingredient, IngredientProperties
from chef.e... |
# -*- coding: utf-8 -*-
# Written in Python 2.7, but try to maintain Python 3+ compatibility
from __future__ import print_function
from __future__ import division
import unittest
from os import path
from classic_heuristics.parallel_savings import parallel_savings_init
from classic_heuristics.sequential_savings impor... |
# -*- coding: utf-8 -*-
# Copyright (c) 2020, <NAME> and contributors
# For license information, please see license.txt
from __future__ import unicode_literals
import frappe
from frappe.utils import getdate, get_time, flt, now_datetime
from datetime import datetime, timedelta, date, time
from frappe.model.document imp... |
import socket
import sys
import json
from config import Config
import time
from threading import Lock
from typing import List
import logging
import re
class LightningClient:
def __init__(self, socket_file):
self.sock = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
try:
self.sock.co... |
<gh_stars>0
"""
Given the weights and profits of ‘N’ items, we are asked to put these items
in a knapsack which has a capacity ‘C’. The goal is to get the maximum profit
from the items in the knapsack.
we are allowed to use an unlimited quantity of an item.
Let’s take the example of Merry, who wants to carry some frui... |
# Copyright 2014: Mirantis 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 b... |
import os, re, time, shutil
import requests
from bs4 import BeautifulSoup
from multiprocessing import Pool
# the only global variable, would be nice if i could somehow implement it in
# main() but idk how?
temp = './temp/'
# gets the url and returns beautifulsoup'd html
#
# it's used multiple times so i de... |
import glob
import matplotlib.pyplot as plt
import numpy as np
import os
import PIL
from tensorflow.keras import layers
import tensorflow as tf
import time
from IPython import display
(train_images,train_labels),(_,_)=tf.keras.datasets.mnist.load_data()
print(train_images.shape)
train_images=train_im... |
# -*- coding: utf-8 -*-
"""
Created on 2018-08-28 17:38:43
---------
@summary: 根据json生成表
---------
@author: Boris
@email: <EMAIL>
"""
import time
import pyperclip
import feapder.setting as setting
import feapder.utils.tools as tools
from feapder.db.mysqldb import MysqlDB
from feapder.utils.tools import key2underlin... |
<gh_stars>0
# -*- coding: utf-8 -*-
""" Sahana Eden Security Model
@copyright: 2012-14 (c) Sahana Software Foundation
@license: MIT
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 Sof... |
from ncc.models.ncc_model import NccEncoderDecoderModel
from ncc.modules.embedding import Embedding
from ncc.modules.code2vec.lstm_encoder import LSTMEncoder
from ncc.modules.seq2seq.lstm_decoder import LSTMDecoder
from ncc.models import register_model
from ncc.utils import utils
DEFAULT_MAX_SOURCE_POSITIONS = 1e5
DEF... |
<reponame>rokroskar/gastrodon<filename>gastrodon/__init__.py
'''
Gastrodon module header
'''
import re
from abc import ABCMeta, abstractmethod
from collections import OrderedDict, Counter
from collections import deque
from functools import lru_cache
from sys import stdout,_getframe
from types import FunctionType,Lambd... |
<gh_stars>10-100
import time
from typing import AsyncGenerator, Dict
import aioredis # type: ignore
import pytest
from fast_tools.base.redis_helper import Lock, LockError, RedisHelper, errors
pytestmark = pytest.mark.asyncio
@pytest.fixture()
async def redis_helper() -> AsyncGenerator[RedisHelper, None]:
redi... |
import angr
import claripy
import logging
import simuvex
import random
import capstone
import signal
import os
from random import shuffle
from utils import *
angr.loggers.disable_root_logger()
log = logging.getLogger("CoreTaint")
log.setLevel("DEBUG")
GLOB_TAINT_DEP_KEY = 'taint_deps'
UNTAINT_DATA = 'untainted_data'... |
from __future__ import division, absolute_import, print_function
import numpy as np
from numpy.lib.histograms import histogram, histogramdd, histogram_bin_edges
from numpy.testing import (
assert_, assert_equal, assert_array_equal, assert_almost_equal,
assert_array_almost_equal, assert_raises, assert_allclose... |
<gh_stars>0
# Copyright 2016-2020 Blue Marble Analytics 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 applicab... |
<filename>root_gnn/src/models/decay_simulator.py
import tensorflow as tf
import sonnet as snt
from graph_nets import utils_tf
from graph_nets import modules
from graph_nets import blocks
from root_gnn.src.models.base import InteractionNetwork
from root_gnn.src.models.base import make_mlp_model
from root_gnn.src.model... |
# Copyright 2020 - 2021 MONAI Consortium
# 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... |
#!/usr/bin/env python3
import os
from os import listdir
from os.path import isfile, join, isdir, basename, split
from azure.storage.blob import ContentSettings, BlobServiceClient, BlobClient, ContainerClient, __version__
from typing import List, Set, Dict, Tuple, Optional
import mimetypes
def help():
print("""
... |
<reponame>alperkamil/csrl
"""
Omega-Automata
"""
from subprocess import check_output
import random
import numpy as np
import os
import re
import importlib
from itertools import chain, combinations
if importlib.util.find_spec('spot'):
import spot
else:
spot=None
class OmegaAutomaton:
"""Transforms the LT... |
# Copyright 2021 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... |
<reponame>sohwaje/oci-ansible-collection<gh_stars>0
#!/usr/bin/python
# 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.... |
<reponame>beevans/integrated-manager-for-lustre<filename>chroma_api/log.py
# Copyright (c) 2020 DDN. All rights reserved.
# Use of this source code is governed by a MIT-style
# license that can be found in the LICENSE file.
from chroma_core.lib.util import normalize_nid
from chroma_api.utils import DateSerializer
fr... |
# Big Data, Xarxes Neuronals i Màrqueting: la clau de l'èxit?
# Treball de recerca (TR)
# <NAME> - <NAME>
#
#
#
# Copyright (c) 2021, <NAME>
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are me... |
#
# This file is part of LiteHyperBus
#
# Copyright (c) 2019 <NAME> <<EMAIL>>
# Copyright (c) 2019-2021 <NAME> <<EMAIL>>
# Copyright (c) 2021 <NAME> <<EMAIL>>
# SPDX-License-Identifier: BSD-2-Clause
from migen import *
from migen.genlib.misc import timeline
from litex.build.io import DifferentialOutput
from litex.so... |
<gh_stars>1-10
import re
# The available regex functions in the Python re module fall into the following
# three categories:
# 1. Searching functions
# 2. Substitution functions
# 3. Utility functions
# Searching functions scan a search string for one or more matches of the
# specified regex:
# re.search(<regex>, <st... |
<gh_stars>100-1000
import datetime
import math
import random
import gym
import numpy as np
from gym import spaces
from gym.utils import seeding
from stable_baselines3.common.vec_env import DummyVecEnv
from finrl_meta.env_fx_trading.util.log_render import render_to_file
from finrl_meta.env_fx_trading.util.plot_chart i... |
<gh_stars>1-10
#!/usr/bin/python3
import nltk
import os, argparse, json, re, math, statistics, sys
### from: http://www.aclweb.org/anthology/P89-1010.pdf
# How to calculate PMI:
# What is "mutual information"? According to [Fano (1961), p. 28], if
# two points (words), x and y, have probabilities P(x) and P(y), then... |
import hashlib
import json
import os
from time import time
from typing import Dict, Optional, Union
from flask import Flask, render_template, request
from flask.typing import ResponseReturnValue
APP_DIR = os.path.dirname(os.path.abspath(__file__))
STATIC_DIR = os.path.join(APP_DIR, "static")
DATA_DIR = os.path.join(A... |
# -*- coding:utf-8 -*-
import sys
sys.path.append("..")
import time
import requests
from bs4 import BeautifulSoup
from tools.Date_Process import time_process
from tools.Emoji_Process import filter_emoji
from tools.Mysql_Process import mysqlHelper
from tools import Cookie_Process
from tools.Mysql_Process import get_db
... |
<gh_stars>0
# Copyright 2019 Google LLC. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... |
import csv
import sys
import os
import mapdamage
import pysam
import itertools
import math
import logging
import time
def phred_pval_to_char(pval):
"""Transforming error rate to ASCII character using the Phred scale"""
return chr(int(round(-10*math.log10(abs(pval)))+33))
def phred_char_to_pval(ch):
"""Tr... |
<reponame>dberardi2020/MovieSorter
import shutil
import subprocess
import sys
import time
from os import path
from InquirerPy import inquirer
from InquirerPy.base import Choice
from Classes import Directories, ANSI, Statistics
from Classes.Logger import Logger
from Classes.Movie import Movie
from definitions import c... |
<gh_stars>0
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Models declaration for application ``django_mailbox``.
"""
from email.encoders import encode_base64
from email.message import Message as EmailMessage
from email.utils import formatdate, parseaddr, parsedate_tz, parsedate_to_datetime
from quopri import enco... |
import pandas as pd
import numpy as np
import matplotlib as plt
import math
import random
import decimal
from sympy import symbols, diff
wine = pd.read_csv("winequality-red.csv",delimiter=",")
def get_slope():
slope = []
for i in range (0,11):
slope.append(float(decimal.De... |
<filename>web/tests.py
import datetime
from django.contrib.flatpages.models import FlatPage
from django.contrib.sites.models import Site
from django.core.files.uploadedfile import SimpleUploadedFile
from django.test import TestCase
from django.urls import reverse
from django_dynamic_fixture import G
from accounts.mod... |
<reponame>jlangdev/falconpy
"""
_______ __ _______ __ __ __
| _ .----.-----.--.--.--.--| | _ | |_.----|__| |--.-----.
|. 1___| _| _ | | | | _ | 1___| _| _| | <| -__|
|. |___|__| |_____|________|_____|____ |____|__| |__|__|__|_____|
|: 1 | ... |
<reponame>MingheCao/pysot
# Copyright (c) SenseTime. All Rights Reserved.
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import numpy as np
from pysot.core.config import cfg
from pysot.tracker.siamrpn_tracker import... |
# -*- coding: utf-8 -*-
"""
Created on Thu Mar 24 14:44:33 2022
@author: aknur
"""
import openseespy.opensees as ops
import pandas as pd
import csv
import os
import numpy as np
import random
import math
from functions import *
import column
import time
start_time = time.time()
pd.options.display.max... |
<reponame>prateek-77/rcan-it
import math
from typing import Optional
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.nn.parameter import Parameter
from ._utils import conv3x3, conv1x1, get_activation
class ResidualBase(nn.Module):
def __init__(self, stochastic_depth: bool = False,
... |
#!/usr/bin/python
import subprocess
import os
import sys
import getopt
import traceback
import shutil
import re
def Usage(args):
print sys.argv[0] + ' [-hp] [-r revision]'
print ''
print ' -r\t: Specify rocket internal revision number'
print ' -p\t: Include python libraries'
print ' -s\t: Include full source code... |
<reponame>aghosh92/atomai
"""
jrvae.py
=======
Module for analysis of system "building blocks" with rotationally-invariant
variational autoencoders for joint continuous and discrete representations
Created by <NAME> (email: <EMAIL>)
"""
from typing import Optional, Union, List
from copy import deepcopy as dc
import... |
<filename>pygmt/tests/test_config.py
"""
Tests for gmt config.
"""
import pytest
from pygmt import Figure, config
from pygmt.helpers.testing import check_figures_equal
@pytest.mark.mpl_image_compare
def test_config():
"""
Test if config works globally and locally.
"""
fig = Figure()
# Change globa... |
<filename>wavefront_api_client/__init__.py
# coding: utf-8
# flake8: noqa
"""
Wavefront REST API
<p>The Wavefront REST API enables you to interact with Wavefront servers using standard REST API tools. You can use the REST API to automate commonly executed operations such as automatically tagging sources.</p>... |
<reponame>mikeengland/fireant
import itertools
import pandas as pd
import numpy as np
from typing import Dict, List, Optional, Tuple
from datetime import timedelta
from fireant import (
formats,
utils,
)
from fireant.dataset.fields import DataType, Field
from fireant.dataset.totals import TOTALS_MARKERS
from... |
<filename>stanCode-projects/Object oriented-Breakout game/breakout_ex.py
"""
stanCode Breakout Project
Adapted from <NAME>'s Breakout by
<NAME>, <NAME>, <NAME>,
and <NAME>.
Name: <NAME>
"""
from campy.gui.events.timer import pause
from breakoutgraphics_ex import BreakoutGraphics
# ex import
import random
FRAME_RAT... |
#!/usr/bin/env python
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# ----------------------------------------------... |
<reponame>Nailim/shuttler
#import sys
#import os
from datetime import datetime
import commands # use GeoidEval trough command line
import argparse
from geographiclib.geodesic import Geodesic
#import gpsRangeRing
global inputParser # just a reminder, it's used as a global variable
global inputArgs # just a reminder... |
<filename>chaco/multi_line_plot.py
""" Defines the MultiLinePlot class.
"""
from __future__ import with_statement
# Standard library imports
import warnings
from math import ceil, floor
# Major library imports
import numpy as np
from numpy import argsort, array, invert, isnan, take, transpose
# Enthought library im... |
<filename>sdl2/sdl2_rect.py
# Python-SDL2 : Yet another SDL2 wrapper for Python
#
# * https://github.com/vaiorabbit/python-sdl2
#
# [NOTICE] This is an automatically generated file.
import ctypes
from .api import SDL2_API_NAMES, SDL2_API_ARGS_MAP, SDL2_API_RETVAL_MAP
# Define/Macro
# Enum
# Typedef
# Struct
class... |
<reponame>jskora/scratch-python
# simple_repl.py
from Tester import Test, Tester
import re
def tokenize(expression):
if expression == "":
return []
regex = re.compile("\s*(=>|[-+*\/\%=\(\)]|[A-Za-z_][A-Za-z0-9_]*|[0-9]*\.?[0-9]+)\s*")
tokens = regex.findall(expression)
return [s for s in to... |
# Copyright 2020 The Kale 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 or agreed to ... |
<filename>emodelrunner/create_cells.py
"""Functions to create cells."""
# Copyright 2020-2021 Blue Brain Project / EPFL
# 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.apach... |
<filename>patch_management/tests/test_cve_scan_utils.py
from django.test import TestCase
from django.urls import reverse, resolve
from ..models import User, SSHProfile, System, Package, CVE
from ..tasks import celery_scan_cve
class CveScanViewTestCase(TestCase):
'''
Test CVE scanning function
This test re... |
# Copyright 2021 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 requi... |
<reponame>vtmoreau/doccano
from django.conf import settings
from django.contrib.auth.models import User
from model_mommy import mommy
from rest_framework import status
from rest_framework.reverse import reverse
from rest_framework.test import APITestCase
from .utils import (assign_user_to_role, create_default_roles,
... |
<gh_stars>0
#!/usr/bin/python3
# -*- coding: latin-1 -*-
import os
import sys
# import psycopg2
import json
from bson import json_util
from pymongo import MongoClient
from flask import Flask, request, session, g, redirect, url_for, abort, \
render_template, flash
def strip_quotes(word):
"""Strip all quotatio... |
<filename>cogs/mod_mail.py
import config
import discord
from discord.ext import commands
from discord.ext.commands import Cog
from helpers.checks import check_if_verified_or_dms
from helpers.userlogs import get_blank_userlog, get_userlog, set_userlog
import json
import time
class ModMail(Cog):
def __init__(self, ... |
from abc import ABCMeta, abstractmethod
import sys
import traceback
from ..utility.text import colour_text as coloured
def _model_wrapper(dependency=None, message=None, complete=None):
def private(self, key, default=None):
return getattr(self,'_%s%s'%(self.__class__.__name__,key),default)
def private_set(sel... |
import dtlpy as dl
import os
import logging
logger = logging.getLogger(__name__)
def deploy_predict(package):
input_to_init = {
'package_name': package.name,
}
logger.info('deploying package . . .')
service_obj = package.services.deploy(service_name='predict',
... |
# this program use SymPy to symbolically derive several quantities that are described
# in the notes: the (1) relaxation and buoyancy transfer functions, (2) the velocity
# solutions, and (3) a limiting value of one of the eigenvalues of the problem.
#
# all of the printing is commented out; this file is best read/used... |
<reponame>JustM3Dev/Minecraft
# Imports, sorted alphabetically.
# Python packages
import random
# Third-party packages
# Nothing for now...
# Modules from this project
from blocks import *
#
# Base
#
class SmallPlant:
block = None
grows_on = grass_block, dirt_block
@classmethod
def add_to_world(... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.