text stringlengths 957 885k |
|---|
<gh_stars>1-10
import gc
import os
from distutils.util import strtobool
from pathlib import Path
from typing import Optional, Union
import numpy as np
import scipy.sparse as sps
_USE_NUMBA = bool(strtobool(os.environ.get("USE_NUMBA", "True")))
_USE_NUMBA_PARALLEL = bool(strtobool(os.environ.get("USE_NUMBA_PARALLEL", ... |
<reponame>kotania/impy
'''This module initializes lists of namedtuple that link the definitions
of models and their various versions to the existing wrapper classes.
'''
from collections import namedtuple
from impy.models import (sibyll, dpmjetIII, epos, phojet, urqmd, pythia6,
pythia8, qgsjet... |
import torch
import numpy as np
from openmixup.models.utils import precision_recall_f1, support
from openmixup.utils import build_from_cfg, print_log
from .registry import DATASETS, PIPELINES
from .base import BaseDataset
from torchvision.transforms import Compose
from .utils import to_numpy
try:
from skimage.feat... |
<gh_stars>0
from os import listdir
from os.path import isfile, join
from subprocess import run, PIPE
from typing import List, Dict
from .... import R
import kfp
import pytest
import yaml
import tempfile
"""
To run these tests from your terminal, go to the tests directory and run:
`python -m pytest -s -n 3 run_int... |
import numpy as np
from cv2 import cv2
def ORB(template_gray, target_gray, debug=False):
orb = cv2.ORB_create()
kp1, des1 = orb.detectAndCompute(template_gray, None)
kp2, des2 = orb.detectAndCompute(target_gray, None)
bf = cv2.BFMatcher(cv2.NORM_HAMMING, crossCheck=True)
matches = bf.match(des1,... |
from django.db import models
from django.utils import timezone
from postgres_copy import CopyManager
from django.contrib.postgres.fields import JSONField
# image Table
class Image(models.Model):
image_name = models.CharField(max_length=512, blank=False, primary_key=True)
publisher = models.CharField(max_length... |
# -*- coding: utf-8 -*-
"""Shared logic and abstractions of frameworks."""
import os
import abc
import copy
import json
import time
import filecmp
import re
import six
import gzip
import shutil
import collections
import traceback
from nmtwizard.logger import get_logger
from nmtwizard import config as config_util
from... |
<gh_stars>1000+
"""shell
pip install autokeras
"""
import os
import numpy as np
import tensorflow as tf
from sklearn.datasets import load_files
import autokeras as ak
"""
## A Simple Example
The first step is to prepare your data. Here we use the [IMDB
dataset](https://keras.io/datasets/#imdb-movie-reviews-sentimen... |
<gh_stars>10-100
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: Apache-2.0
import boto3
import botocore
import os
import logging
from gamekithelpers import ddb
from gamekithelpers.handler_request import get_player_id, get_path_param, log_event
from gamekithelpers.hand... |
<filename>backend/fullBack.py
import networkx as nx
import matplotlib.pyplot as plt
import random
from itertools import combinations
"""
all these added below
1. cycle
2. star
3. tree
4. path
5. complete
6. bipartite
7. hypercubes
8. petersen
9. custom
10.temporal
1. bfs
2. dfs
3. dijkstra
4. cycle det
5. foremost
... |
from __future__ import annotations
from babi.screen import VERSION_STR
from testing.runner import and_exit
def test_window_height_2(run, tmpdir):
# 2 tall:
# - header is hidden, otherwise behaviour is normal
f = tmpdir.join("f.txt")
f.write("hello world")
with run(str(f)) as h, and_exit(h):
... |
<reponame>atzberg/gmls-nets
"""
.. image:: overview.png
PyTorch implementation of GMLS-Nets. Module for neural networks for
processing scattered data sets using Generalized Moving Least Squares (GMLS).
If you find these codes or methods helpful for your project, please cite:
| @article{trask_patel_gro... |
<gh_stars>1-10
#!/usr/bin/env python3
# Copyright (C) 2016 <NAME> <<EMAIL>>
#
# This file is subject to the terms and conditions of the GNU Lesser
# General Public License v2.1. See the file LICENSE in the top level
# directory for more details.
import sys
from testrunner import run
def test1(term):
term.expect... |
<reponame>Pandentia/journal
import pymongo.results
import pytz
import typing
from autoslot import Slots
from journal.db.util import id_to_time
if typing.TYPE_CHECKING:
from journal.db import DatabaseInterface, User
class Entry(Slots):
def __init__(self, db: 'DatabaseInterface' = None, **data):
self.... |
<reponame>yashpatel12/CPIMS-api-newtest<filename>cpovc_offline_mode/helpers.py<gh_stars>1-10
import base64
import json
import logging
from django.core.cache import cache
from django.utils import timezone
from cpovc_forms.models import OVCCareEvents, OVCCareAssessment, OVCCareEAV, OVCCarePriority, OVCCareServices, \
... |
<filename>zigzag/zigzag.py
from random import random
from typing import List
class Kline:
def __init__(self, idx, high, low) -> None:
self.idx = idx
self.high = high
self.low = low
class Point:
def __init__(self, kline: Kline, is_low) -> None:
self.kline = kline
... |
<gh_stars>1-10
#!/usr/bin/env python
#
# Copyright 2020 VMware, Inc.
# SPDX-License-Identifier: BSD-2-Clause OR GPL-3.0-only
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
# BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY... |
<gh_stars>1-10
# coding: utf-8
from ctypes import *
import sys,getopt,time
###########################################
class VSC_level_desc(Structure):
_fields_ = [
("verbosity" ,c_uint), #unsigned verbosity;
("label", c_char_p), #const char *label; /* label */
... |
<gh_stars>10-100
import asyncio
import webbrowser
from logging import getLogger
from typing import List
from kivymd.uix.list import ImageLeftWidget, OneLineListItem, ThreeLineAvatarIconListItem
from naturtag.app import get_app
from naturtag.controllers import Controller, TaxonBatchLoader
from naturtag.models import T... |
import numpy as np
from scipy.special import ndtr,log_ndtr
from reciprocalspaceship.utils import compute_structurefactor_multiplicity
def _acentric_posterior(Iobs, SigIobs, Sigma):
"""
Compute the mean and std deviation of the truncated normal
French-Wiilson posterior.
Parameters
----------
I... |
def copy_nested_list(l):
"""Return a copy of list l to one level of nesting"""
return [list(i) for i in l]
def normalize_table(table, n):
"""Return a normalized version of table such that it has n columns in each row, possibly with empty cells"""
normalized_table = copy_nested_list(table)
for row ... |
<filename>face_detector_ssd/dataset/create_dataset.py
import json
import os
import sys
from io import BytesIO
import tensorflow as tf
import numpy as np
from PIL import Image, ImageDraw
from jaccard_overlap import jaccard_overlap
FLAGS = tf.flags.FLAGS
tf.flags.DEFINE_string('base_dir', None,
... |
"""
Copyright (C) 2017, <NAME>
Example:
tc = TypeContext()
@tc.prototype("test", "pipe", "field")
class ModelA(ModelBase):
fieldA = Int8()
class Child(ModelBase):
fieldB = Int8()
fieldC = Int32()
fieldA = Uint32()
inst = mc.init_instance()
ins... |
from vnpy.trader.object import (
TickData,
OrderData,
TradeData,
PositionData,
AccountData,
ContractData,
OrderRequest,
CancelRequest,
SubscribeRequest,
HistoryRequest,
)
from vnpy.trader.constant import (
Direction,
Exchange,
OrderType,
Product,
Status,
O... |
<filename>Experiments/main_bigram_next_exp.py
import sys
sys.path.insert(0, '../')
import re
from Code.bigram import BigramModel
from Experiments.bigram_next import BigramModelNext
DATA_PATH = '../DataSets/'
OUTPUT_DIR = '../Output/BigramExperiment/'
TRAINING_FILES = {
'en': ['en-the-little-prince.txt', 'en... |
<reponame>cytomine/S_Segment-CV-AdaptThres-Sample<gh_stars>1-10
# -*- coding: utf-8 -*-
# * Copyright (c) 2009-2019. Authors: see NOTICE file.
# *
# * 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 Li... |
<reponame>yuvalabou/homeassistant
"""Base HACS class."""
from __future__ import annotations
import asyncio
from dataclasses import asdict, dataclass, field
from datetime import timedelta
import gzip
import json
import logging
import math
import os
import pathlib
import shutil
from typing import TYPE_CHECKING, Any, Awa... |
<reponame>nicholaspcr/Inicia-o_Cient-fica
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from pymoo.factory import get_problem, get_performance_indicator, get_reference_directions, get_visualization
from pymoo.performance_indicator.hv import Hypervolume
import os
import sys
# important methods ... |
import os
import pytest
import subprocess
import time
import unittest
from tests.e2e import setup_e2e
debug_log = "--logging-level=DEBUG"
indexing_sleep_time = 1 # wait 1 second to confirm server has indexed updates
project_name = "not-default-name"
group_name = "test-ing-group"
workbook_name = "namebasic"
# to ru... |
<reponame>nanusefue/CAP2-1<filename>cap2/extensions/experimental/tcems/cli.py
import click
import luigi
import time
import logging
from .tcem_repertoire import TcemRepertoire
from .tcem_aa_db import TcemNrAaDb
from ....pangea.cli import set_config
from ....pangea.api import (
wrap_task,
recursively_wrap_tas... |
import os
import cv2
import torch
import pickle
import tempfile
import numpy as np
from utils_cv.action_recognition.dataset import VideoDataset, \
get_transforms, get_default_tfms_config
from perception.common.video import read_frames_dir, read_all_frames
from interaction.scenario import scenario_to_id, id_to_scen... |
"""fips verb to build the samples webpage"""
import os
import yaml
import shutil
import subprocess
import glob
from string import Template
from mod import log, util, project, emscripten, android
# sample attributes
samples = [
[ 'clear', 'clear-sapp.c', None],
[ 'triangle', 'triangle-sapp.c', 'triangle-sapp.... |
class DataGridViewCheckBoxColumn(DataGridViewColumn,ICloneable,IDisposable,IComponent):
"""
Hosts a collection of System.Windows.Forms.DataGridViewCheckBoxCell objects.
DataGridViewCheckBoxColumn()
DataGridViewCheckBoxColumn(threeState: bool)
"""
def Dispose(self):
"""
Dispose(self: DataGridV... |
<filename>model.py
import pytorch_lightning as pl
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
from pytorch_lightning.metrics.functional.classification import accuracy
class BaseModel(pl.LightningModule):
def __init__(self):
super().__init__()
def tra... |
"""This script can be used to generate a Aruco marker board. This board is used in the
camera pose estimation.
.. note::
**Printing instructions:**
- Make sure Scale to fit is selected.
- Verify the size of the markers after the board is printed. If
size does not match change the settin... |
<gh_stars>0
from rest_framework import serializers
from django.db.models import Q, F, Avg, Max, Min, Count, Sum
from app.models import *
class UserDataSerializer(serializers.ModelSerializer):
user_school = serializers.SerializerMethodField()
user_class = serializers.SerializerMethodField()
user_team = ser... |
import os
import sys
import json
import logging
import pandas as pd
from tqdm import tqdm
import numpy as np
import gensim
from keras import backend as K
from keras.engine import Layer
try:
import cPickle as pickle
except ImportError:
import pickle
try:
import nirvana_dl
except ImportError:
pass
d... |
<reponame>kconner/white-elephant<filename>main.py
__author__ = 'derekbrameyer'
import random
import json
import datetime
def main():
maxstealcount = 2
currentturn=1
boolines = json.loads(open("boo_lines.json").read())
reportlines = json.loads(open("report_lines.json").read())
print greenify("\nWe... |
"""Access to the base Slack Web API.
Attributes:
ALL (:py:class:`object`): Marker for cases where all child methods
should be deleted by :py:func:`api_subclass_factory`.
"""
from copy import deepcopy
import logging
import aiohttp
from .core import Service, UrlParamMixin
from .utils import FriendlyError, rais... |
import os
import random as rnd
import string
import pytest
from settings import valid_email, valid_pass, not_valid_email, not_valid_password,\
pet_id_valid, pet_id_novalid, pet_photo_valid, pet_photo_novalid
import API_PETFRIENDS
pf = API_PETFRIENDS.API()
_, key = pf.get_api_key(valid_email, valid_pass)
_, my_p... |
<reponame>donalm/thrum
#!/usr/bin/env pypy
# -*- coding: utf-8 -*-
# Copyright (c) <NAME>
# See LICENSE for details.
import os
import sys
import socket
from . import binary
# Format code
FC_TEXT = 0
FC_BINARY = 1
# IP address family codes
PGSQL_AF_INET = 2 # IPv4
PGSQL_AF_INET6 = 3 # IPv6
# PG constants for nume... |
import unittest
from src.core.pre.text.pre_inference import *
class UnitTests(unittest.TestCase):
# def test_all(self):
# example_text = "This is a test. And an other one.\nAnd a new line.\r\nAnd a line with \r.\n\nAnd a line with \n in it. This is a question? This is a error!"
# #example_text = read_text(... |
"""
Generates setups for baroclinic MMS tests
"""
import sympy
import numbers
from sympy import init_printing
init_printing()
# coordinates
x, y, z = sympy.symbols('xyz[0] xyz[1] xyz[2]')
x_2d, y_2d = sympy.symbols('xy[0] xy[1]')
z_tilde = sympy.symbols('z_tilde')
# domain lenght, x in [0, Lx], y in [0, Ly]
lx, ly = ... |
<reponame>lienching/nasbench_keras
# Copyright evgps
# Licensed under the MIT license:
# http://www.opensource.org/licenses/mit-license.php
# 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 Softw... |
# import tensorflow as tf
# import numpy as np
import functools
import torch
import numpy as np
import torch.nn as nn
import torch.nn.functional as F
import math
from torch.nn.modules.linear import Linear
class ResBlock(nn.Module):
expansion = 1
def __init__(self, in_planes, planes, bn=False, stride=1):
... |
import json
from pathlib import Path
from ..exceptions import TaskValidationError
def validate_task_options(task_name, required, **options):
"""
Validate that all options respect the task requirements.
Arguments:
task_name (string): Task name to output in possible error.
required (list):... |
<gh_stars>0
import io
import json
# import torchvision.transforms as transforms
from flask import Flask, jsonify, request
from PIL import Image
# from torchvision import datasets, models
# importing the libraries
#test
import matplotlib.pyplot as plt
import numpy as np
import torch
from torch import nn
from torch i... |
#
#------------------------------------------------------------------------------
# Copyright (c) 2013-2014, <NAME>
#
# 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... |
<gh_stars>10-100
# Copyright (c) 2018 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 la... |
<filename>calx/diffractometer/diffractometer_swissfel.py
import numbers
import numpy as np
from numpy.linalg import norm
import warnings
import re
from xrayutilities import Experiment,QConversion
# package internal imports
from xrayutilities import math
# from xrayutilities import materials
# from xrayutilities import... |
import httplib
import urllib
import random
import time
from PIL import Image
import os
from xml.etree import ElementTree
import logging
import StringIO
all_extras = ("description,license,date_upload,date_taken,owner_name,"
"icon_server,original_format,last_update,geo,tags,machine_tags,o_dims,"
"views,media,path_alias,... |
<filename>morphling/copy.py
import re
import csv
class Copy:
def __init__(self, reader, writer):
self.reader = reader
self.writer = writer
self.data = list()
def __construct(self, data):
field = 0
message_tmps = list()
tmp_list = list()
check_datetime = ... |
<reponame>xboix/FakeNews-Code
#! /usr/bin/env python
import tensorflow as tf
import numpy as np
np.set_printoptions(threshold=np.nan)
import os
import sys
import csv
import interpret
import data_helpers
from sklearn import metrics
from tensorflow.contrib import learn
#import yaml
import pickle
maxpool_x = 2;
maxpool_... |
<gh_stars>0
import collections
import json
import re
class Writer:
def __init__(self, conn, debug):
self.conn = conn
self.debug = debug
self.schema_cache = {}
TYPE_MAPS = collections.defaultdict(lambda: lambda x: x)
TYPE_MAPS[list] = TYPE_MAPS[dict] = TYPE_MAPS[tuple] = TYPE_MAPS[... |
<filename>variation/tokenizers/tokenize_base.py
"""Module for commonly used tokenization methods."""
from typing import Tuple, Optional, Union
from variation.tokenizers.caches import NucleotideCache, AminoAcidCache
import re
class TokenizeBase:
"""Class for Tokenize methods."""
def __init__(self, amino_acid_... |
<gh_stars>0
import time
# Third-party imports
import numpy
import scipy.stats
import matplotlib
from matplotlib import cm
from matplotlib.collections import PatchCollection
import matplotlib.pyplot as pyplot
import cartopy
import cartopy.crs as ccrs
from cartopy.mpl.gridliner import LONGITUDE_FORMATTER, LATITUDE_FORMA... |
<gh_stars>1-10
#!/bin/python3;
a="""
This script will insert a row before the first row of the supplied CSV file.
Each field of this row will contain the numeric value of the ordinal position of the given field.
This script will also insert a column before the first column of the supplied CSV file.
The field of thi... |
<filename>scriptsForPreprocessing/crete_mask_manual.py
import os, json
import random
import cv2
import numpy as np
from PIL import Image, ImageDraw
def random_color():
levels = range(32, 256, 32)
return tuple(random.choice(levels) for _ in range(3))
points = []
cropping = False
def click_and_crop(event, x... |
person_1 organizing case ; each had books . she had shelves ; she have total ?
person_1 halt momentum ; each halt momentum . she halt momentum ; she halt total ?
person_1 thick case ; each thick books . she thick shelves ; she have total ?
person_1 activated shield ; each had nothing . we activated shelves ; we activa... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
###############################################################################
# #
# RMG - Reaction Mechanism Generator #
# ... |
<filename>src/py/test_day4_giant_squid.py
def part1(inp):
drawn_numbers = [int(x) for x in inp.pop(0).split(",")]
boards = []
for i in range(len(inp) // 6):
inp.pop(0)
board = [[int(x) for x in inp.pop(0).split()] for j in range(5)]
boards.append(board)
for num in drawn_numbers:... |
# Copyright 2020 ETH Zurich
#
# 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, sof... |
import json
import os
from dotenv import load_dotenv
from flask import Flask, render_template, request, redirect, url_for, flash, abort, session
from deta import Deta
from flask_qrcode import QRcode
import requests
app = Flask(__name__)
jdoodle_url = 'https://api.jdoodle.com/v1/execute'
load_dotenv()
@app.errorhandl... |
<gh_stars>1-10
thickarrow_strings = ( # sized 24x24
"XX ",
"XXX ",
"XXXX ",
"XX.XX ",
"XX..XX ",
"XX...XX ",
"XX....XX ",
"XX.....XX ",
"XX....... |
import os
from PilotErrors import PilotErrors
from pUtil import tolog, readpar
class DBReleaseHandler:
"""
Methods for handling the DBRelease file and possibly skip it in the input file list
In the presence of $[VO_ATLAS_SW_DIR|OSG_APP]/database, the pilot will use these methods to:
1. Extract the req... |
#!/usr/bin/env python3
from argparse import ArgumentParser
from io import StringIO
from enum import Enum, auto
import os.path
import sys
class Cell:
def __init__(self, name, keep=False, port_attrs={}):
self.name = name
self.keep = keep
self.port_attrs = port_attrs
CELLS = [
# Design... |
<reponame>jonnyns/sosi_files_importer
# -*- coding: utf-8 -*-
"""
Copyright © 2022 <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 ri... |
<filename>one_fm/grd/doctype/moi_residency_jawazat/moi_residency_jawazat.py
# -*- 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 import _
from frappe.model.document import Document
from ... |
"""
test_click_jacking.py
Copyright 2012 <NAME>
This file is part of w3af, http://w3af.org/ .
w3af is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation version 2 of the License.
w3af is distributed in the hope that ... |
<reponame>guanchaoguo/forsun
# -*- coding: utf-8 -*-
# 15/6/27
# create by: snower
import os
import configparser
from .utils import unicode_type, string_type, number_type, ensure_unicode
class ConfFileNotFoundError(Exception):
pass
__config = {}
DEFAULT_CONFIG = {
"LOG_FILE": "/var/log/forsun.log",
"LOG... |
# Author : <NAME>
from migtool import *
import subprocess,os
import multiprocessing
import getpass
def userinput():
global VCAUser, VCAPasswd, enttype, API_URL, VCAOrgName, PCCHost, PCCUser, PCCpass, SubRawURL
pullbanner = banner(text='vCloud Director to vCenter VM Cold Migration Tool')
endbanner = ban... |
<reponame>flaght/panther
# -*- coding: utf-8 -*-
import pdb,importlib,inspect,time,datetime,json
# from PyFin.api import advanceDateByCalendar
# from data.polymerize import DBPolymerize
from data.storage_engine import StorageEngine
import time
import pandas as pd
import numpy as np
from datetime import timedelta, date... |
<filename>parse_halos.py
#!/usr/bin/env python
"""
@file parse_halos.py
@brief Script to extract halos from binary sim... |
<reponame>saiakhil0034/SemanticSegmentation<filename>dataloader.py
from torch.utils.data import Dataset, DataLoader# For custom data-sets
import torchvision.transforms as transforms
import numpy as np
from PIL import Image, ImageOps
import torch
import pandas as pd
from collections import namedtuple
import matplotlib.p... |
# Copyright 2010 Google 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 applicable law or a... |
import os
import json
class SerialHelper:
path = 'input.json'
langs_dictionairy = {}
@staticmethod
def read():
if os.path.isfile(SerialHelper.path):
with open(SerialHelper.path, 'r') as json_file:
return json.load(json_file)
else:
raise FileNotF... |
import os
import sys
import onedrivesdk
REDIRECT_URL = 'http://localhost:8080/'
CLIENT_ID = '00000000401CDF7B'
CLIENT_SECRET = '<KEY>'
SCOPES=['wl.signin', 'wl.offline_access', 'onedrive.readwrite']
def get_client():
client = onedrivesdk.get_default_client(CLIENT_ID, SCOPES)
auth_url = client.auth_prov... |
import pytest
import inspect
from ipaddress import IPv4Address, IPv4Network
from prettytable import PrettyTable
import numpy as np
from CybORG import CybORG
from CybORG.Shared.Actions import Remove
from CybORG.Shared.Enums import TrinaryEnum
from CybORG.Agents.SimpleAgents.B_line import B_lineAgent
from CybORG.Agents... |
import sys
import itertools
import Queue
def combine_interactions(a, b):
if a == 'fix' or b == 'fix':
return 'fix'
if a == 'break' or b == 'break':
return 'break'
return 'neutral'
class RTG:
def __init__(self, metal):
self.metal = metal
def broken(self, room):
retu... |
from typing import Optional, Dict, Union
import itertools
import json
from typing import Optional, Dict, Union
from nltk import sent_tokenize
import torch
from transformers import (
AutoModelForSeq2SeqLM,
AutoTokenizer,
PreTrainedModel,
PreTrainedTokenizer,
)
from transformers import (
AutoModel... |
"""Instruction module."""
# Official Libraries
# My Modules
from stobu.syss import messages as msg
from stobu.tools.translater import translate_tags_str
from stobu.types.action import ActDataType, ActionRecord, ActionsData, ActType
from stobu.types.action import NORMAL_ACTIONS
from stobu.utils.log import logger
__... |
<filename>points/viewsets.py
from .models import Payer, Transaction, Spend
from .serializers import PayerSerializer, TransactionSerializer, SpendSerializer
from rest_framework import viewsets, status
from rest_framework.response import Response
class PayerViewSet(viewsets.ModelViewSet):
queryset = Payer.objects.a... |
<filename>tests/test_MesaFileAccess.py
import pytest
from typing import Tuple,List
from MesaHandler import MesaFileAccess
from MesaHandler.support import *
import shutil
testWritePath = "tests/playground/"
inlistpgstarParameters = [
"HR_win_flag",
"HR_logT_min",
"HR_logT_max",
"HR_logL_min",
"HR... |
<reponame>Eo300/react_flask_pdb2pqr
import os, sys, time
import glob
import requests
import logging
from multiprocessing import Process
from pprint import pprint
from json import dumps
from flask import request
import kubernetes.client
from kubernetes import config
from kubernetes.client.rest import ApiException
from... |
import unittest
from robot.utils.asserts import assert_equal, assert_true, assert_false
from robot import utils
from robot.model.tags import *
class TestTags(unittest.TestCase):
def test_empty_init(self):
assert_equal(list(Tags()), [])
def test_init_with_string(self):
assert_equal(list(Tags... |
#!/usr/bin/env python3
#
# Copyright 2021 Venafi, 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... |
# -*- coding: utf-8 -*-
# Copyright (C) 2015 Mag. <NAME> All rights reserved
# Glasauergasse 32, A--1130 Wien, Austria. <EMAIL>
# #*** <License> ************************************************************#
# This module is part of the package GTW.OMP.PAP.E164.
#
# This module is licensed under the terms of the BSD 3-C... |
import torch
import torch.nn as nn
from MHA import MultiHeadedAttention
from FeedForward import PositionwiseFeedForward
from PositionalEncoding import *
from Encoder import EncoderLayer, sequence_mask
from Decoder import DecoderLayer
class subclass(nn.Module):
def __init__(self,
d_model,
... |
<filename>CODE/dapt_task/controller.py
#! -*- encoding:utf-8 -*-
"""
@File : controller.py
@Author : <NAME>
@Contact : <EMAIL>
@Dscpt :
"""
import json
import logging
import os
from torch.utils.data import dataloader
logger = logging.getLogger("controller")
console = logging.StreamHandler();console.set... |
<reponame>bengentil/openshift-ansible-contrib
#!/usr/bin/env python
# vim: sw=2 ts=2
import click
import os
import sys
@click.command()
### Cluster options
@click.option('--console-port', default='443', type=click.IntRange(1,65535), help='OpenShift web console port',
show_default=True)
@click.option('-... |
import logging
log = logging.getLogger(__name__)
import itertools
import numpy as np
from copy import deepcopy
import pycqed.measurement.waveform_control.sequence as sequence
from pycqed.utilities.general import add_suffix_to_dict_keys
import pycqed.measurement.randomized_benchmarking.randomized_benchmarking as rb
impo... |
# -*- coding: utf-8 -*-
"""
/dms/faqitem/help_form.py
.. enthaelt die kompletten Kontext-Hilfetexte fuer FAQ-Beitraege
Django content Management System
<NAME>
<EMAIL>
Die Programme des dms-Systems koennen frei genutzt und den spezifischen
Beduerfnissen entsprechend angepasst werden.
0.01 01.10.2007 Begin... |
from selenium import webdriver
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.common import exceptions
from selenium.webdriver.chrome.options import Options
from pdlearn import user_agent
import os
import itchat
class Mydriver:
... |
<filename>env/lib/python3.5/site-packages/mne/viz/backends/base_renderer.py
"""Core visualization operations."""
# Authors: <NAME> <<EMAIL>>
# <NAME> <<EMAIL>>
# <NAME> <<EMAIL>>
# <NAME> <<EMAIL>>
#
# License: Simplified BSD
from abc import ABCMeta, abstractclassmethod
class _BaseRendere... |
<gh_stars>1-10
"""
@author: 代码医生工作室
@公众号:xiangyuejiqiren (内有更多优秀文章及学习资料)
@来源: <PyTorch深度学习和图神经网络(卷 1)——基础知识>配套代码
@配套代码技术支持:bbs.aianaconda.com
Created on Tue Mar 19 22:24:58 2019
"""
import torch
import torchvision
from torch import nn
import torch.nn.functional as F
from torch.utils.data import DataLoader
from to... |
#pylint: disable=invalid-name,no-self-use
"""The tests for DrawWrite."""
# Imports {{{
import datetime
import logging
from unittest import mock
from django.core.files.uploadedfile import SimpleUploadedFile
from django.core.files.storage import Storage
from django.test import TestCase
from django.utils import timezone... |
#!/usr/bin/env python3
import argparse
import random
import serial
from datetime import datetime, timedelta
from tests.testmtrreader import MtrDataBytesBuilder
def create_argparser():
argparser = argparse.ArgumentParser(
description=(
"Mock MTR supporting spool-all command ('/SA'). "
... |
import torch
import pyro
import pyro.distributions as dist
from torch.distributions import constraints
from pyro import poutine
from pyro.infer import SVI, Trace_ELBO, TraceEnum_ELBO, config_enumerate, infer_discrete
from pyro.infer.autoguide import AutoDiagonalNormal
from pyro.ops.indexing import Vindex
import pyro.p... |
from django.test import TestCase
from dcim.models import Site
class NaturalOrderByManagerTest(TestCase):
"""
Ensure consistent natural ordering given myriad sample data. We use dcim.Site as our guinea pig because it's simple.
"""
def setUp(self):
return
def evaluate_ordering(self, names... |
<reponame>cdeck3r/3DScanner<gh_stars>1-10
#
# Testinfra testcases to validate the autosetup run.
#
# Author: cdeck3r
#
import pytest
#####################################################
# Tests
#####################################################
@pytest.mark.usefixtures("camnode_ssh_config")
class TestAutosetupC... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.