text stringlengths 3.07k 22.1k |
|---|
"""
Title: Neural style transfer
Author: [fchollet](https://twitter.com/fchollet)
Date created: 2016/01/11
Last modified: 2020/05/02
Description: Transfering the style of a reference image to target image using gradient descent.
"""
"""
## Introduction
Style transfer consists in generating an image
with the same "con... |
#Gemaakt door <NAME>, <NAME>, <NAME>, <NAME> en <NAME>
#Module voor het inlezen van het .csv bestand en intevoeren in een array
def leesBestand(bestand_naam, bestand_sep):
#Initialisatie
bestand_lijst = []
lege_str = ''
#Ervoor zorgen dat de koptekst niet meegenomen wordt
bestand_naam.readline()... |
#!/usr/bin/env python
# coding: utf-8
# Import Splinter and BeautifulSoup
from splinter import Browser
from bs4 import BeautifulSoup
import pandas as pd
import datetime as dt
def scrape_all():
# Initiate headless driver for deployment
browser = Browser("chrome", executable_path="chromedriver", headless=True)
... |
from __future__ import absolute_import, division, print_function, unicode_literals
from progress.bar import IncrementalBar
from bs4 import BeautifulSoup
import threading
import arrow
import bibtexparser
import codecs
import hashlib
import pprint
import random
import re
import requests
import sys
import time
_GOOGLEID... |
import os
import traceback
from datetime import datetime
from rdflib import Namespace, Graph
# To avoid duplication of namespaces across converters
NS = {
'en': Namespace("http://www.dfki.de/lt/en.owl#"),
'dax': Namespace("http://www.dfki.de/lt/dax.owl#"),
'cfi': Namespace("http://www.dfki.de/lt/cfi.owl#"),
... |
import numpy as np
from keras.layers.core import Dense, Dropout
from keras.models import Sequential
from keras.optimizers import Adam
from keras.utils import to_categorical
from player import Player
from snake import Snake
from utils import create_empty_board
from utils import CustomEvent
from utils import Dimension
... |
import torch
import torch.nn as nn
from nltk.translate.bleu_score import sentence_bleu, SmoothingFunction
from rouge import Rouge
from transformers import AutoConfig
from bojone_snippets import text_segmentate, DataGenerator, sequence_padding, AutoRegressiveDecoder
from bojone_tokenizers import load_vocab, Tokenizer
f... |
import random
global solvedboard
solvedboard = []
def maker():
board = [
[5, 8, 6, 2, 9, 1, 7, 4, 3],
[2, 9, 4, 3, 7, 8, 5, 6, 1],
[3, 7, 1, 6, 5, 4, 2, 8, 9],
[9, 3, 2, 4, 8, 6, 1, 5, 7],
[8, 4, 7, 9, 1, 0, 3, 2, 6],
[1, 6, 5, 7, 3, 2, 0, 9, 4],
[4... |
import argparse
import os
import time
from typing import Dict, Callable
from shutil import copytree, ignore_patterns, rmtree
import tensorflow as tf
from .input_fn import predict_input_fn, train_eval_input_fn
from .model_fn import BertMultiTask
from .params import DynamicBatchSizeParams, BaseParams
from .special_toke... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Created by imoyao at 2019/6/29 15:17
from sqlalchemy import extract, and_
from back.models import Article, ArticleBody, Category, Comment, Tag, User
from back.utils.date import DateTime
date_maker = DateTime()
def assert_new_tag_in_tags(tags_for_new_post):
"""
... |
import utils
import openslide
import cv2
import numpy as np
import os
import random
import csv
from xml.etree.ElementTree import parse
from PIL import Image
def _read_xml(xml_path, mask_level):
''' read xml files which has tumor coordinates list
return coordinates of tumor areas
Args:
slid... |
# Copyright 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 law or agreed to in wri... |
# Copyright (c) 2020 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
#
# Unless required by app... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import torch
import random
import torch.nn as nn
import torch.nn.functional as F
"""
https://github.com/pytorch/examples/blob/master/vae/main.py
https://github.com/wiseodd/generative-models/blob/master/VAE/conditional_vae/cvae_pytorch.py
"""
class KLDivergenceLoss(nn.Mod... |
#!/usr/bin/env python3
"""Gracz w grze Gomoku"""
import copy
import math
import pygame
import constants as c
import develop
import stone
class Player:
"""Klasa reprezentująca gracza w grze."""
def __init__(self, screen, tie, number, color):
self.screen = screen
self.actual_tie = tie
... |
# =============================================================================
#
# EZID :: ezidapp/models/search_identifier.py
#
# Database model for identifiers in the search database.
#
# Author:
# <NAME> <<EMAIL>>
#
# License:
# Copyright (c) 2015, Regents of the University of California
# http://creativecomm... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import time
import signal
import Xlib.display
import Xlib.protocol
import gi
gi.require_version('Gdk', '3.0')
gi.require_version('Gtk', '3.0')
gi.require_version('Keybinder', '3.0')
from gi.repository import GLib, Gdk, GdkX11, Gtk, Keybinder
from Xlib import X
# GdkX11... |
#####################################################.
# This file stores all the functions #
# used for genrating details for nmr #
#####################################################.
import numpy as np
import os
import subprocess
import glob
import pandas as pd
from aqme.cheshire_lo... |
import http.client
import http.cookiejar
import json
import random
import re
import ssl
import time
import unittest
from xml.dom import minidom
import logging
logger = logging.getLogger(__name__)
__unittest = True
PROXYHOST = ""
PROXYPORT = ""
PROXYHTTPSPORT = ""
'''
Based on https://stackoverflow.com/questions/61... |
###########################
# whiteboard.py
# contains whiteboard features
# adileo
###########################
from tkinter import *
import math
import tkinter_png
from tkinter.colorchooser import askcolor
from tkinter import filedialog
class Whiteboard(object):
def __init__(self):
self.margin = 10
... |
import glob
import os
import re
import numpy as np
import pandas as pd
from datatable import dt, fread, f, g, join, by, sort, update
import polars as pl
from polars import col
# -- Enable logging
from loguru import logger
import sys
logger_config = {
"handlers": [
{"sink": sys.stdout, "colorize": True, "f... |
import numpy as np
import random
from KPI import KPI
# 每日收益和每日收益率
def gap(open_price, close_price, init_money, num_stock):
return 1.0 * (np.sum(close_price / open_price) - num_stock) * init_money / num_stock
def std_gap(open_price, close_price, init_money):
return 1.0 * (close_price / open_price - 1) * init_mo... |
from cubelang.compiler.expression import VariablesPool, Expression, ConditionExpression, WhileLoopExpression, \
RepeatLoopExpression, DoWhileLoopExpression, ForLoopExpression, CubeTurningExpression, CubeRotationExpression, \
FunctionDeclarationExpression
from cubelang.compiler.types import Integer, Real, Bool, ... |
# Copyright 2016 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... |
from typing import Dict, Optional, Union, Tuple
import math
import numpy as np
import xarray as xr
import pandas as pd
import eccodes
def create_data_array_from_message(
message,
level_dim_name: Optional[str] = None,
field_name: Optional[str] = None,
) -> xr.DataArray:
"""
Create ``x... |
"""The Atomic Local Storm Report ... Report"""
# pylint: disable=unsubscriptable-object
import re
from datetime import timezone, timedelta
from pyiem import reference
from pyiem.util import html_escape
ICE_ACCUM_V0 = re.compile(r"(\d+)/(\d+)\"?T?H?S? O?F?\s*A?N?\s*(INCHES|INCH)")
ICE_ACCUM_V1 = re.compile(
r"(0\.... |
#!/usr/bin/env python3
# This script is intended to push commands to a mass amount of devices.
# Version: 0.2.4
import fnmatch
import re
import os
import tkinter as Tk
import tkinter.messagebox
import tkinter.simpledialog
from tkinter import filedialog
from paramiko import *
import paramiko
# Variables
infile_check, ... |
import os, numpy, random
from polymuse import dataset, transformer, enc_deco, dutils, dataset2 as d2, pattern
from keras.models import load_model
from polymuse import rnn_player, rnn
def play_multitrack(lead, chorus, drum, ini = None, predict_instances = 50, ip_memory = 32, raw = False):
ip_memory = 32
pr... |
"""
Allow for easily adding segments to lines.
"""
from __future__ import division
from builtins import object
from builtins import zip
from cairo import Matrix, ANTIALIAS_NONE
from simplegeneric import generic
from gaphas.aspect import ConnectionSink
from gaphas.aspect import HandleFinder, HandleSelection, PaintFoc... |
# -*- coding: utf8 -*-
from example_config import *
from tablestore import *
import time
import json
table_name = 'group_by_example_table'
index_name = 'search_index_group_by'
client = None
def group_by_field(table_name, index_name):
print('**** Begin Sample 1 ****\n')
query = TermQuery('d', 0.1)
group_... |
from nose.tools import assert_equal, assert_almost_equal, assert_less_equal
from numpy.testing.utils import assert_allclose
from kernel_exp_family.kernels.incomplete_cholesky import incomplete_cholesky,\
incomplete_cholesky_new_point, incomplete_cholesky_new_points
from kernel_exp_family.kernels.kernels import gau... |
#!/usr/bin/env python
# coding: utf-8
from __future__ import print_function
import torch
import torch.nn as nn
import torch.optim as optim
import numpy as np
import torchvision
from torchvision import datasets, models, transforms
import copy
import os
import shutil
import sys
def init_reg_params(model, use_gpu,... |
import sys
sys.path.append("../")
import os
import pandas as pd
import numpy as np
from pyspark.ml.recommendation import ALS
import pyspark.sql.functions as F
from pyspark.sql import SparkSession
from pyspark.sql.types import StructType, StructField
from pyspark.sql.types import StringType, FloatType, IntegerType, Long... |
import pandas as pd
import numpy as np
from datetime import date
from sklearn.ensemble import GradientBoostingRegressor, RandomForestRegressor
from sklearn import linear_model
import csv
# Function to write save outfile in csv file in given format
def write_csv_output(outputfile):
with open("output_final"+".csv",'... |
import os
import os.path
import torch
from pathlib import Path
import numpy as np
import pypianoroll
import pretty_midi
from collections import defaultdict
import json
import sys
sys.path.append('/data2/qt/MusicGeneration/mg/model/')
import hashlib
from progress.bar import Bar
from concurrent.futures import ProcessPool... |
from data.abstract_dataset import Abstract_Dataset
from data.invariance_database import Invariance_Database
from data.triplet_dataset import Triplet_Dataset
import math
class Invariance_Dataset(Abstract_Dataset):
"""
The Invariance_Dataset takes in an Invariance_Database and provides its anchor2positive pairs... |
import itertools
import teek
from teek._tcl_calls import to_tcl
flatten = itertools.chain.from_iterable
def _font_property(type_spec, option):
def getter(self):
return teek.tcl_call(type_spec, "font", "actual", self, "-" + option)
def setter(self, value):
if not isinstance(self, NamedFont)... |
# coding=UTF-8
'''Modulo de Exportación'''
from func.data.setup import data as s
from func.gen.habs import HabMod
from func.gen.dotes import ver_dotes
from func.core.config import guardar_json
from func.core.prsnj import Pj as p
from func.gen.objetos import imprimir_nom_objmag
from func.core.lang import t
from... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import datetime, re, pytz
from decimal import Decimal, InvalidOperation
ec_tz = pytz.timezone('America/Guayaquil')
utc = pytz.utc
class MarketPlace(object):
def __init__(self, count, list):
self.trades = []
if count > 0:
self.trades = [self.Trade(**t) fo... |
import pygame,sys,math
from pygame.locals import *
import pygame_gui
from my_tour import Warnsdorff
import numpy as np
pygame.init() #Initalises pygame
fpsClock = pygame.time.Clock() #Sets the frames per second
WHITE=(255,255,255) #RGB Value for White
BLACK = (0,0,0) #RGB Value for Black
RED = (255, 0, 0) # RGB Value... |
import heapq
import time
from enum import Enum
from typing import List, Optional
import matplotlib.pyplot as plt
import numpy as np
import pygame
from mazelib import Maze as _Maze
from mazelib.generate.Prims import Prims
class Modes(Enum):
walkable = 1
obstacle = 2
start = 3
end = 4
class Node:
... |
#import cupy as np
import numpy as np
import matplotlib.pyplot as plt
import FourierTransform
import cv2
def template_matching(template,target):
"""
(location_coordinate, correlation_image) = template_matching(template_window_image, target_image)
template: is the smaller cutout you want to find in the target_image... |
import json
import math
import numpy
from colorful.fields import RGBColorField
from django.conf import settings
from django.contrib.gis.db import models
from django.contrib.gis.gdal import Envelope, OGRGeometry, SpatialReference
from django.contrib.postgres.fields import ArrayField
from django.db.models import Max, M... |
import pysam
import sys
import argparse
"""
This script first validates each read to be "valid" BSJ read and then splits a BSJ bam file by strand into:
1. Plus strand only bam file
2. Minus strand only bam file
3. BSJ bed file with score(number of reads supporting the BSJ) and strand information
Logic (for PE reads):... |
# 12/17/20
from enum import Enum
from Helpers.AOC import whiteFlag
from Helpers.FileHelper import readFile
from typing import List, Set, Tuple
FILEPATH: str = "2020/Input/day17.txt"
class Status(Enum):
"""
Cube activity status
"""
ACTIVE = "#"
INACTIVE = "."
def create3DActiveSet(strList: List[str]) -... |
# overlap coefficient join
from joblib import delayed, Parallel
from six import iteritems
import pandas as pd
import pyprind
from py_stringsimjoin.filter.overlap_filter import OverlapFilter
from py_stringsimjoin.index.inverted_index import InvertedIndex
from py_stringsimjoin.utils.generic_helper import convert_datafra... |
import matplotlib.pyplot as plt
import numpy as np
import scipy as sp
from matplotlib.lines import Line2D
import matplotlib.animation as animation
import cmath as cm
from collections.abc import Iterable
pause = False
# Your Parameters
amp = 1 # 1V (Amplitude)
f = 1000 # 1kHz (Frequency)
fs = 200000 # 2... |
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
A generic RESTful API Wrapper for tensorflow object detction with Flask and
object_detector in object_detector.py, which could be used for any tensorflow
frozen inference graph and deployed on either Cloud Foundry or on-premise server.
Endpo... |
import dateutil.parser
from utils.api import APIView, validate_serializer
from account.decorators import ensure_created_by
from ..models import Course, CourseAnnouncement, Course_task, UserCourse,Taskproblem,TaskSmallproblem
from account.models import User
from ..serializers import (CourseAdminSerializer, CreateCours... |
#!/usr/bin/python
import requests
import json
import random
import sys
url = 'http://localhost:9200/'
indexingRoute = '/_mapping/_doc'
postDataRoute = '/_doc'
headers = {"Content-type": "application/json"}
# type keyword is often used for aggregation and sorting. It can only searched by its exact value
# type text i... |
#!/usr/bin/env python3
"""
Module to contain the runtime options for the CCPP Framework.
Function to parse arguments to the CCPP Framework and store them in an
object which allows various framework functions to access CCPP
Framework runtime information and parameter values.
"""
# Python library imports
import argpars... |
# -*- encoding:ascii -*-
from mako import runtime, filters, cache
UNDEFINED = runtime.UNDEFINED
__M_dict_builtin = dict
__M_locals_builtin = locals
_magic_number = 6
_modified_time = 1434391208.8490701
_template_filename='templates/user/toolbox_filters.mako'
_template_uri='user/toolbox_filters.mako'
_template_cache=cac... |
#!/usr/bin/python3
##
## File: cxpm.py
##
## Author: <NAME> <<EMAIL>>
##
## Description: Compresses an XPM to my own "cxpm" format that I invented
## This script takes an XPM file, converting it and storing it as
## a CXPM file in the "img_cxpm" directory. XPM files use an
## ... |
import sys
from django.core.exceptions import ValidationError
from django.db import models
from django.db.models import Sum
from django.utils.translation import gettext_lazy as _
from contacts.models import Contact, Organisation
class ItemType(models.IntegerChoices):
OTHER = 0, _('Other')
HARDWARE = 100, _(... |
import seaborn as sns
import numpy as np
from ..StoneModel import StoneModel
IgList = ['IgG1', 'IgG2', 'IgG3', 'IgG4']
def iggRename(name):
return 'h' + name
Igs = {'IgG1': 'o', 'IgG2': 'd', 'IgG3': 's', 'IgG4': '^',
'hIgG1': 'o', 'hIgG2': 'd', 'hIgG3': 's', 'hIgG4': '^'}
FcgRlist = ['FcgRI',
... |
import numpy as np
import pandas as pd
import sys
import utils
from tqdm.notebook import tqdm
from minHash import MinHash
from minHashLSH import MinHashLSH
from minHashStorage import LSHStorage
def mem_size(object):
"""Return object size in kb
"""
return sys.getsizeof(object) / 1024
def mem_size_dict(d)... |
"""The Deck model and related utilities"""
import enum
import logging
import typing as t
import urllib.error
from datetime import datetime
import tqdm
import infiltrate.browsers as browsers
import infiltrate.global_data as global_data
import infiltrate.models.card as card
# todo replace application with config injec... |
import json
import logging
from dataclasses import dataclass
from datetime import datetime, timedelta, timezone
from string import Template
from typing import Any, List, Optional
import pytest
from django.conf import settings
from guardian.shortcuts import assign_perm
from open_city_profile.tests import to_graphql_na... |
# -*- coding: utf-8 -*-
#
# test_stdp_multiplicity.py
#
# This file is part of NEST.
#
# Copyright (C) 2004 The NEST Initiative
#
# NEST 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, either version 2 of the ... |
import numpy as np
def project_electrodes_anydirection(tri, vert, elecmatrix, proj_direction):
'''
Projects electrode locations onto the convex hull of a cortical surface.
This allows for the electrode locations to wrap smoothly around the
cortical surface instead of being outside the brain or going i... |
#Made by Kerb
import sys
from java.lang import System
from com.l2jserver import Config
from com.l2jserver.gameserver.model.quest import QuestState
from com.l2jserver.gameserver.model.quest import State
from com.l2jserver.gameserver.model.quest.jython import QuestJython as JQuest
from com.l2jserver.gameserver.network... |
import errno
import math
import librosa
import numpy as np
import scipy.signal
import tempfile
import os
import shutil
import multiprocessing
from multiprocessing import Pool
import subprocess
import sys
import argparse
from pathlib import Path
from PIL import Image
from PIL import ImageChops
### Tunable values ###
... |
import paho.mqtt.client as paho
import time
import sys
import os
from getpass import getpass
import json
import RPi.GPIO as GPIO
from time import sleep
broker = "172.16.17.32"
port = 1883
sleep_time = 10
in1 = 24
in2 = 23
in3 = 17
in4 = 27
ena = 25
enb = 26
temp1=1
GPIO.setmode(GPIO.BCM)
GPIO.setup(in1,GPIO... |
from typing import Any, Dict, List, Tuple
from dateutil.relativedelta import relativedelta
from django.utils import timezone
from ee.clickhouse.client import sync_execute
from ee.clickhouse.models.element import get_elements_by_elements_hashes
from ee.clickhouse.models.event import ClickhouseEventSerializer
from ee.c... |
import functools
import generic
from abc import ABCMeta, abstractmethod
from typing import Tuple, List, Optional, Generator
from enum import Enum
class CheckStatus(Enum):
OK = 1
WARNING = 2
CRITICAL = 3
def combine_statuses_and(s1: CheckStatus, s2: CheckStatus):
if s1 == CheckStatus.CRITICAL or s2 ==... |
import os
import numpy as np
import json
import tensorflow as tf
import keras.backend as k
from keras.layers import *
from keras.layers import InputLayer, Input
from keras.models import Sequential, Model, load_model
from keras.layers import concatenate
from keras.optimizers import Adam
from keras.callbacks import Earl... |
import struct
import argparse
import requests
import yaml
from colour import Color
import xml.etree.ElementTree as ET
import json
class CcxmlGenerator:
PALETTE_XML_NS = "http://markembling.info/xmlschema/colourchooser/palette/1"
def generate_file(self, colors, path):
el_palette = ET.Element(self._elem... |
# %%
# =========================================================================== #
# EARLY STOP CLASSES #
# =========================================================================== #
from abc import ABC, abstractmethod, ABCMeta
from collections import deque
... |
# -*- coding: utf-8 -*-
# @Time : 2021/9/2 21:12
# @Author : <NAME>
# @File : gbk2gff.py
# @Usage : change Genbank to gff
# @Note : mainly for NCBI gff
# @E-mail : <EMAIL>
from BCBio import GFF
from Bio import SeqIO
from Bio.SeqRecord import SeqRecord
from Bio.SeqFeature import SeqFeature, CompoundLocatio... |
import pygame
import math
import time
from pygame import mixer
pygame.init()
print_value = True
x, y = 800, 600
start = False
Font = pygame.font.SysFont("Times New Roman", 50)
Font1 = pygame.font.SysFont(None, 40)
Font2 = pygame.font.SysFont(None, 25)
p1win = Font.render("Player1 won", True, (255, 255,... |
#!/usr/bin/env python
#
# Python version of PAHFIT
#
# written Nov 2015 by <NAME> (<EMAIL>)
#
from __future__ import print_function
import numpy as np
import astropy.io.fits as pyfits
import matplotlib.pyplot as plt
import argparse
import matplotlib
#print(plt.get_backend())
import scipy.optimize as op
from lmfit im... |
#!/usr/bin/env python
# Download and log the MTA's status updates. We only log changes.
from __future__ import print_function
import argparse
import doctest
import json
import os
import random
import string
import re
import sys
from datetime import datetime, timedelta
from filewrapper import FileWrapper
from parser im... |
# Copyright 2022 Matusson
# Released under MIT License
# Version 1.0.0
from PySide2 import QtWidgets as qw, QtCore
import substance_painter.logging as lg
import substance_painter.project as pr
import substance_painter.event as ev
import substance_painter.textureset as ts
import substance_painter.js as js
imp... |
import re
from Bio import __version__ as bio_version
if bio_version < '1.77':
from Bio.SubsMat.MatrixInfo import pam250
else:
from Bio.Align import substitution_matrices
pam250 = substitution_matrices.load('PAM250')
from Bio import pairwise2
cigar_re = re.compile('(\d+)?([\D])')
non_gap_re = re.compile('[^... |
# Copyright (c) 2020 - 2021 Persanix 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 ... |
#H#######################################################################
# FILENAME : mosaic.py
#
# REF : https://stackoverflow.com/questions/34264710/what-is-the-point-of-floatinf-in-python
# https://docs.python.org/2/library/multiprocessing.html#multiprocessing-programming
# https://docs.o... |
#!/usr/bin/env python
'''
setup.py file for SWIG eHealth module
'''
from __future__ import print_function
import os
import shutil
from subprocess import check_call, CalledProcessError, STDOUT
import sys
import time
import urllib
import tarfile
import pip
from setuptools import setup, Extension, find_packages
from se... |
import tensorflow as tf
import random
from tqdm import tqdm
import spacy
import ujson as json
from collections import Counter
import numpy as np
from codecs import open
import jieba
import os
'''
This file is taken and modified from R-Net by HKUST-KnowComp
https://github.com/HKUST-KnowComp/R-Net
'''
def word_tokenize... |
from __future__ import absolute_import
import six
import inspect
from .exceptions import BadValueError
function_name = None
if six.PY3:
def function_name(f):
return f.__name__
else:
def function_name(f):
return f.func_name
class JsonProperty(object):
default = None
type_config = None... |
"""
Unit and regression test for the plbenchmark package.
"""
# Import package, test suite, and other packages as needed
import os
import pytest
import pandas as pd
import yaml
from rdkit import Chem, DataStructs
from rdkit.Chem import rdFMCS
from openforcefield.topology import Molecule
import plbenchmark
from plben... |
import pandas as pd
import os
from datetime import datetime
import numpy as np
import sys
from models import SnapshotModels, BigramModel, SnapshotModelsPreset
from helper_functions import get_time_windows
def get_samples_and_test_set(gnames, all_groups_contribs, all_groups_toks,
window_fu... |
# Copyright 2017 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.
"""This module is for actions on identified culprits for build failure.
It provides functions to:
* Determine if Findit should take actions on a culprit
""... |
import itertools
import torch
import torch.nn as nn
import numpy as np
from torchvision.ops import nms
import os
import pycuda.driver as cuda
import pycuda.autoinit
import tensorrt as trt
from threading import Thread
import time
import cv2
import random
EXPLICIT_BATCH = 1 << (int)(trt.NetworkDefinitionCreationFlag... |
#!/usr/bin/env python3
#
# Copyright 2016 The Chromium OS Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import logging
import unittest
from cros.factory.testlog import testlog
from cros.factory.testlog import testlog_utils
from cros... |
'''<NAME> mmb1995
'EightPuzzleWithHeuristics.py
A variation on the classic Eight Puzzle that uses
heuristics in order to estimate a given state's distance from
the goal state.
'''
# <METADATA>
QUIET_VERSION = "0.2"
PROBLEM_NAME = "Eight Puzzle"
PROBLEM_VERSION = "0.1"
PROBLEM_AUTHORS = ['<NAME>']
PROBLEM_CREATION_DAT... |
#
# Copyright © 2021 United States Government as represented by the Administrator
# of the National Aeronautics and Space Administration. No copyright is claimed
# in the United States under Title 17, U.S. Code. All Other Rights Reserved.
#
# SPDX-License-Identifier: NASA-1.3
#
"""Plot an observing plan."""
import logg... |
#!/usr/bin/env python
import boto3, botocore, json, sys, time, shutil, os, glob, argparse, logging, datetime, re
JSON_INDENT = 2
AWS_CREDENTIAL_PROFILE="default"
AWS_SLEEP_INTERVAL = 10 #seconds
LOCAL_SLEEP_INTERVAL = 1 #seconds
ARPD_FILE = "AssumeRolePolicyDocument.json"
ACCOUNT_FILE = "src_account_number.txt"
POLIC... |
import numpy as np, scipy as sp, networkx as nx
import math, time, os, sys
from config import *
#Input: graph, RepMethod
#Output: dictionary of dictionaries: for each node, dictionary containing {node : {layer_num : [list of neighbors]}}
# dictionary {node ID: degree}
def get_khop_neighbors(graph, rep_method):
... |
"""Convenience methods to display images using matplotlib.pyplot."""
import inspect
import matplotlib.pyplot as plt
import numpy as np
__author__ = "<NAME>"
__copyright__ = "<NAME>"
__license__ = "mit"
def _extract_method_kwargs(kwargs, method, remove=True):
"""Internal method to extract keyword arguments relate... |
import argparse
import hashlib
import os
import re
import snowflake.connector
import sys
import time
# Set a few global variables here
_snowchange_version = '2.1.0'
_metadata_database_name = 'METADATA'
_metadata_schema_name = 'SNOWCHANGE'
_metadata_table_name = 'CHANGE_HISTORY'
def snowchange(root_folder, snowfl_acc... |
# import self as self
from django.conf import settings
from django.shortcuts import redirect
from django.shortcuts import render, get_object_or_404
# from .models import items
from django.http import JsonResponse
# from django.contrib
from django.core.exceptions import ObjectDoesNotExist
from django.contrib.auth.decora... |
import time
import sys
import argparse
import ast
from typing import List, Dict
from tqdm.auto import tqdm
from ntropy_sdk import SDK, Transaction
def limited_type(field, min, max):
def _lim(x):
x = int(x)
if x < min:
raise argparse.ArgumentTypeError(f"Minimum value for {field} is {mi... |
import csv
from tempfile import NamedTemporaryFile
from airflow.hooks.postgres_hook import PostgresHook
from airflow.hooks.S3_hook import S3Hook
from airflow.models import BaseOperator
from airflow.plugins_manager import AirflowPlugin
from airflow.utils.decorators import apply_defaults
from airflow.operators.postgres_o... |
# Generated by the protocol buffer compiler. DO NOT EDIT!
# sources: onos/config/admin/admin.proto
# plugin: python-betterproto
from dataclasses import dataclass
from datetime import timedelta
from typing import AsyncIterable, AsyncIterator, Iterable, List, Optional, Union
import betterproto
import grpclib
import gnm... |
'''
Created on 12.04.2018
@author: hm
'''
import re
import traceback
import os.path
import tempfile
import posix
import fnmatch
import base.FileHelper
import base.MemoryLogger
class UnitTestAppInfo:
def __init__(self, usage):
self._usage = usage
class UnitTestCase:
def __init__(self):
self.... |
import os
import sys
import time
import yaml
import numpy as np
import soundfile
from tps import cleaners, Handler, load_dict, save_dict
from tps.types import Delimiter
root_path = os.path.dirname(os.path.abspath(__file__))
sys.path.insert(0, root_path)
import backend_wrappers as bw
from utils.async_utils import Ba... |
import math
import json
from collections import deque
from timeit import default_timer as timer
import gym
from gym import error, spaces, utils
from gym.utils import seeding
from abc import ABC, abstractmethod
import numpy as np
import pygame as pygame
from ray.rllib.utils.framework import try_import_torch
from ag... |
#from __future__ import print_function
"""Train with PyTorch."""
"""
This code is forked and modified from 'https://github.com/kuangliu/pytorch-cifar'. Thanks to its contribution.
"""
import torch
import torch.nn as nn
import torch.optim as optim
import torch.nn.functional as F
import torch.backends.cudnn as cudnn
fr... |
#!/usr/bin/env python
from __future__ import print_function
import getopt, os, sys, plistlib, re, shutil, sys, argparse
if sys.stdout.isatty():
class tc:
green = '\033[92m'
yellow = '\033[93m'
red = '\033[91m'
grey = '\033[2m'
cancel = '\033[0m'
else:
class tc:
... |
# -*- encoding: utf-8 -*-
import json
import os
import datetime
from lxml import etree
from openerp.tests import common
from openerp.tools import html_escape as e
from openerp.addons.base.ir import ir_qweb
directory = os.path.dirname(__file__)
class TestExport(common.TransactionCase):
_model = None
def set... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.