text stringlengths 3.07k 12.6k |
|---|
import pytest
import theano
import theano.tensor as tt
from operator import add
from unification import unify, reify, var, variables
from kanren.term import term, operator, arguments
from symbolic_pymc.meta import mt
from symbolic_pymc.utils import graph_equal
from symbolic_pymc.unify import (ExpressionTuple, etupl... |
# Copyright 2019 DeepMind Technologies Ltd. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appl... |
from imgaug import augmenters as iaa
import configparser
import tempfile
# 從config中讀取相對應的參數並選擇一個augmentation function
# noise function
def get_noise_fn(config):
# OneOf function提供選擇一個augmentation function的功用
aug = iaa.OneOf([])
# AddElementwise
if config.getboolean('AddElementwise', 'use'):
pr... |
import pika
import json
import iot_logging
from threading import Thread
from datetime import datetime
import boto3
from flask import render_template
from flask_mail import Message
from iot_api import app
from iot_api import mail
from iot_api import rabbit_parameters
from iot_api.user_api.model import User, Alert, Al... |
from django.http.response import HttpResponse
from django.shortcuts import redirect, render, get_object_or_404
from django.views import View
from django.contrib import messages
from classroom.models import ClassRoom, MemberShip
from profiles.models import Teacher, Student
from django.utils.decorators import method_deco... |
"""Implementation of 2D base layers.
"""
from typing import Tuple, Union
from torch import nn
from meddlr.modeling.layers.conv import ConvWS2d
def _get_same_padding(kernel_size: Union[int, Tuple[int, int]]):
if isinstance(kernel_size, int):
kernel_size = (kernel_size, kernel_size)
else:
ass... |
import pandas as pd
import numpy as np
import mayavi as mayax
from mayavi import mlab
from functools import partial
import tables as tb
import sys
sys.path.append("../../")
from focusadd.coils.CoilSet import CoilSet
def read_lhd_data():
r_surf = np.load("../../focusadd/initFiles/lhd/lhd_r_surf.npy")
nn = np.load("..... |
"""
Cloudflared Integration tests
"""
import unittest
import subprocess
import os
import tempfile
from contextlib import contextmanager
from pexpect import pxssh
class TestSSHBase(unittest.TestCase):
"""
SSH test base class containing constants and helper funcs
"""
HOSTNAME = os.environ["SSH_HOSTNA... |
#!/usr/bin/env python
# coding: utf-8
import copy
from openpyxl import load_workbook
from openpyxl import Workbook
from pandas.core.frame import DataFrame
from MyPythonDocx import *
def cal_risk_cnt(page, ips=[]):
values = []
df = DataFrame(page[1:], columns=page[0])
opt = (df['IP位址'] == ip... |
import wx
import os
import prefs
import datetime, time
import EnhancedStatusBar as ESB
from utility import platform
# get the images once at compile time
icons = {}
iconpath = os.path.join(wx.GetApp().path, "icons", "features")
if os.path.exists(iconpath):
for icon_file in os.listdir(iconpath):
feature, _ ... |
"""A simple dense neural network search space.
Copyright 2018 The AdaNet 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
https://www.apache.org/licenses/LICENSE-2... |
# Copyright 2017 Telstra Open Source
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agre... |
from xdrlib import Packer,Unpacker
class MessageHeader:
"""The header component of a message.
See RFC3588 section 3. After you have read that understanding the
class is trivial. The only fields and methods you will normally use
are:
command_code
application_id (maybe)
setProxiable
... |
#!/usr/bin/env python
"""These cron flows do the datastore cleanup."""
from grr_response_core import config
from grr_response_core.lib import rdfvalue
from grr_response_core.lib import utils
from grr_response_server import aff4
from grr_response_server import client_index
from grr_response_server import cronjobs
from ... |
# Baseline Python3 processing script for text version of CALL shared task
#
# The script reads the XML prompt/response grammar supplied with the download
# and uses it to process the text task training data spreadsheet.
#
# A prompt/recognition_result pair is
# accepted if the recognition_result is in the l... |
from django.core.exceptions import ImproperlyConfigured
from django.forms import models as model_forms
from django.http import HttpResponseRedirect
from django.views.generic.base import ContextMixin, TemplateResponseMixin, View
from django.views.generic.detail import (
BaseDetailView, SingleObjectMixin, SingleObjec... |
#!/usr/bin/env python
#
# Copyright (C) 2009 Google 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 ... |
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... |
class Gerador:
def __init__(self, nome, potencia, capacidade, tanque):
self.__nome = nome
self.__potencia = potencia
self.__capacidade = capacidade
self.__tanque = tanque
self.__status = 0
self.__combustivel = 0
def get_nome(self):
return self.__nome
... |
#!/usr/bin/env python
"""
Management of debmirror
=======================
Create debian mirrors, using debmirror
--------------------------------------
.. code-block:: yaml
debmirror_test1_present:
debmirror.mirror_present:
- name: test1
"""
import logging
import os
from functools import wraps
from... |
# Copyright 2018 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 ... |
import asyncio, socket, time
import collections
from inspect import stack
import os
from typing import AsyncIterator, Deque, List, Optional, Tuple, Union, Dict
from collections import deque
class Client:
def __init__(self, writer: asyncio.StreamWriter, reader: asyncio.StreamReader) -> None:
self.name = ... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright: (c) 2018, Ansible Project
# Copyright: (c) 2018, <NAME> <<EMAIL>>
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA ... |
import sys
import os
import torch
import torch.onnx
import torch.distributed as dist
import torch.nn as nn
import onnxruntime
from datetime import datetime
from torch.utils.data import DataLoader
import torch.multiprocessing as mp
from pepper_variant.modules.python.models.dataloader_predict import SequenceDataset
from... |
from looptools import Timer
from tqdm import tqdm
from mysql.toolkit.utils import wrap
# TODO: Organize methods into database and table classes
# TODO: Fix issue where primary and foreign keys are not being copied
# TODO: New functionality to allow for dumping to file
class CloneData:
def get_database_rows(self, ... |
import os
from django.urls import path, include
import face_recognition
import cv2
from imutils.video import VideoStream
import imutils
import numpy as np
from tensorflow.keras.models import load_model
from tensorflow.keras.applications.mobilenet_v2 import preprocess_input
from tensorflow.keras.preprocessin... |
"""
Description
-----------
Implements query and status report functionality for TUBS use cases.
:Authors:
- <NAME>
"""
import logging
from mcc.framework import *
from mcc.model import SimplePlatformModel
from mcc import parser as cfgparser
from mcc import lib
from mcc.configurator import GenodeConfigurator
fr... |
import numpy as np
from skimage import io, measure, feature
from scipy import ndimage
def autocrop(img):
"""
Remove zero-valued rectangles at the border of the image.
Parameters
----------
img: ndarray
Image to be cropped
"""
slices = ndimage.find_objects(img > 0)[0]
return i... |
# The module realizing specific algorithm to sort array with six random number elements
# from 1 to 6 example (5,6,4,1,3,2) to (1,2,3,4,5,6).
# For more information look README.
import argparse
from itertools import tee, zip_longest
SORTED_ARRAY = '123456'
ARRAY_LEN = len(SORTED_ARRAY)
TO_MOVE_POSSIBLE_POSITIONS = ... |
"""
.. module:: initialise
:synopsis: intialisation
.. moduleauthor:: <NAME> <<EMAIL>>
"""
from __future__ import print_function
import io_mp
import parser_mp # parsing the input command line
from data import Data
import sys
import os
from io_mp import dictitems,dictvalues,dictkeys
def initialise(custom_command... |
# Copyright 2018 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... |
import datetime
import sys
import subprocess as sp
from MyClass.GETSOUP import *
from MyClass.json_op import *
from MyClass.PUSH import *
from MyClass.LOG import *
'''CONFIG START'''
TOKEN = "" # Bot token
CHAT_ID = "" # Admin ID
'''CONFIG END'''
'''Global Variables'''
URL = "https://steamdb.info/upcoming/free/"
PA... |
#!/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.0.txt)
# Apache License v2.0
# See LICENSE.TXT for d... |
#!/usr/bin/python
#
# Copyright 2018-2021 Polyaxon, 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 ... |
from __future__ import barry_as_FLUFL
from django.db.models.query_utils import Q
from pyparsing import Keyword, ParserElement, Word, alphas, infixNotation, nums, opAssoc
from pyparsing.common import pyparsing_common
from pyparsing.core import Literal, OneOrMore, Or, QuotedString, Suppress
from pyparsing.helpers import... |
#!/usr/bin/env python3
import json
import argparse
import subprocess
# Workspaces are separated into groups of 10
# and navigation happens around those groups
WORKSPACE_GROUP = 0
WORKSPACES = {}
NEXTS = [[] for _ in range(10)]
TREE = None
ASSIGNS = {
6: 'Steam',
}
def main():
parser = get_parser()
args = ... |
import json
import sqlite3
conn = sqlite3.connect('4tccc_data.db')
cursor = conn.cursor()
cursor.execute('SELECT name, code, tower1, tower2, tower3, tower4 FROM submissions')
oldSubmissions = cursor.fetchall()
submissions = []
leaderboard = []
remainingCombos = []
#all elements of a are in b, for lists/tuples, if a... |
# Processing List (Title)
# Reading
# This program calculates the gross pay for each of Megan's baristas.
NUM_EMPLOYEES = 6
def main():
hours = [0] * NUM_EMPLOYEES
for index in range(NUM_EMPLOYEES):
hours[index] = float(input(f'Hours worked by employee {index + 1}: '))
pay_rate = float(input('Hou... |
# ----------------------------------------------------------------------
# |
# | Activate_custom.py
# |
# | <NAME> <<EMAIL>>
# | 2018-05-07 08:59:57
# |
# ----------------------------------------------------------------------
# |
# | Copyright <NAME> 2018-21.
# | Distributed under the Boost Software ... |
# Quick and Dirty CocktailDB ripper
# imports into database
# see the sql file in repo
# have fun
# BSD 2-Clause License
#
# Copyright (c) 2020, tomgrassmann
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following condition... |
#
# This file is referred and derived from project NetworkX,
#
# which has the following license:
#
# Copyright (C) 2004-2020, NetworkX Developers
# <NAME> <<EMAIL>>
# <NAME> <<EMAIL>>
# <NAME> <<EMAIL>>
# All rights reserved.
#
# This file is part of NetworkX.
#
# NetworkX is distributed under a BSD license; see LICEN... |
import numpy as np
from scipy import signal
def met_preproc(s, fs, met_try='diff', o=None):
if o is None:
o = (2 * fs) + 1
if met_try == 'diff':
s = np.diff(np.concatenate((np.array([s[0]]), s)))
elif met_try == 'hpnc':
# note that this is acausal! (on purpose, to answer reviewer)... |
from functools import reduce
"""
--- Day 2: Bathroom Security ---
You arrive at Easter Bunny Headquarters under cover of darkness. However, you left in such a rush that you forgot to use
the bathroom! Fancy office buildings like this one usually have keypad locks on their bathrooms, so you search the front
desk for t... |
import ast
from datetime import datetime, timedelta
import pytz
import json
import traceback
from django.db import models
from django.contrib.auth import models as auth_models
from django.db.models.signals import post_save
from django.dispatch import receiver
from zoom import zoom_api as zoom
class Event(models.Mode... |
import re
from django import forms
from dal import autocomplete
from django.forms.formsets import BaseFormSet
from data_wrapper.models import LSTSData, SeqData, ResFinderData, SeqTracking, OLN, CultureData
def get_model_fields(model):
fields = list()
for field in model._meta.fields:
field_id = str(fie... |
# IPython log file
from matplotlib import pyplot as plt, cm
imshow = plt.imshow
clf = plt.clf
figure = plt.figure
colorbar = plt.colorbar
hist = plt.hist
import numpy as np
from IPython import get_ipython
import mahotas as mh
import glob
import os
fns = os.listdir('.')
import functools as ft
fnw = ft.partial(glob.fnma... |
import importlib
import logging
import threading
import time
import uuid
import msgpack
import zmq
from .exceptions import Timeout, UnknownFormat, RemoteException, UnknownMessageType
LOGGER = logging.getLogger("zmqdrpc-client")
LOGGER.setLevel("WARNING")
_ = logging.StreamHandler()
_.setLevel('WARNING')
_.setFormat... |
"""Contains Tiler class for managing window placement"""
import re
import win32gui
import win32api
from win32con import MOUSEEVENTF_LEFTUP
from win32con import MOUSEEVENTF_ABSOLUTE
import wmpy.config as config
def check_overlap(a, b):
""" return True if two display_size overlap """
if a[0] >= b[2] or a[1] >... |
# -*- coding: utf-8 -*-
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
"""
This module implements functions for plotting geographical coordinates on a map
using matpl... |
"""Basic ratelimiting implementation. WARNING: bugs ahead.
Okay, so when coming to Discord's API, the ratelimiting may seem downright
strange. I'll ignore the documentation for this bit, as the documentation is
wrong. Here's the general process of ratelimiting that is used here.
#. Lock the route (sharded by the majo... |
import utils as ut
row_units = [ut.cross(r, ut.cols) for r in ut.rows]
column_units = [ut.cross(ut.rows, c) for c in ut.cols]
square_units = [ut.cross(rs, cs) for rs in ('ABC', 'DEF', 'GHI') for cs in ('123', '456', '789')]
unitlist = row_units + column_units + square_units
# Update the unit list to add the new diago... |
#!/usr/bin/env python3
import json
import logging
import os
import multiprocessing
import socket
import ssl
import sys
import typing
from mockdock import dns
CONFIG_PATH = os.getenv("CONFIG_PATH")
CONFIG_DATA = os.getenv("CONFIG_DATA")
TLS_CERTIFICATE = os.getenv("TLS_CERTIFICATE")
TLS_CERTIFICATE_KEY = os.getenv("... |
import re
import pdb
from lxml import html as etree
import requests
from lxml import html as etree
import pdfcutter
# Import relative Parent Directory for Helper Classes
import os, sys
sys.path.insert(0, os.path.abspath('..')) #Used when call is ` python3 file.py`
sys.path.insert(0, os.path.abspath('.')) #Used when ... |
from .algorithm import Algorithm
import copy
import torch
class SGD(Algorithm):
# The recommended learning rate is 1/L
def __init__(self, game, full_batch=False, *args, **kwargs):
super(SGD, self).__init__(game, *args, **kwargs)
self.full_batch = full_batch
def grad(self):
if self... |
# -*- coding: utf-8 -*-
# Copyright 2018-2022 the orix developers
#
# This file is part of orix.
#
# orix 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 3 of the License, or
# (at your option) ... |
from functools import reduce
from pypokerengine.engine.table import Table
from pypokerengine.engine.seats import Seats
from pypokerengine.engine.card import Card
from pypokerengine.engine.deck import Deck
from pypokerengine.engine.player import Player
from pypokerengine.engine.pay_info import PayInfo
from pypokerengin... |
from gzip import GzipFile
import logging
import numpy as np
from struct import unpack
from sys import argv
def get_size(format_string):
return sum(
size_lookup[_t]
for _t in list(format_string))
# define constants
size_lookup = {
"I": 4, # uint32
"Q": 8, # uint64
... |
import pygame
from sources.Entities.Entity import Entity
from sources.Settings import SETTINGS
class PlayerBeam(pygame.sprite.Sprite, Entity):
def __init__(self, player, x, y):
super().__init__()
self.image = pygame.image.load("assets/images/player_beam.png").convert_alpha()
self.rect = self.image.get_rect()
... |
from rest_framework import viewsets, permissions, filters, status, mixins
from rest_framework.decorators import detail_route
from rest_framework.parsers import FileUploadParser
from rest_framework.response import Response
from dateutil.parser import *
from trac.filters import TeamFilter
from trac.models import Team, T... |
import torch
import torch.nn as nn
import torchaudio.transforms as audio_transforms
from efficientnet_pytorch import EfficientNet
from efficientnet_pytorch import utils as efficientnet_utils
from typing import Tuple
from einops import rearrange, reduce, repeat
def upsample(x, ratio, target_length):
x = rearrange(... |
"""
Utility functions used in songs.
"""
import json
import pinyin
from ..datamodels import Lyrics
from ..config import convert
from .__init__ import ALLOWED_EXTENSIONS # , song_datamodel
def clean_arrangement(arrangement):
"""
Cleans the song arrangement and turns it into a list.
:example:
>>> st... |
import numpy as np
from copy import deepcopy
from fclsp.thresh.MeansEstimation import ThreshCV, Empirical
from fclsp.bd_thresh.MeansEstimation import FclspLLACV
from fclsp.reshaping_utils import vec_hollow_sym, fill_hollow_sym
from repro_lap_reg.toy_data.additive_noise import sample_add_noise
from repro_lap_reg.means... |
import os.path
def return_file_name(path):
"""returns file name from path
Args:
path (str): [file path]
Returns:
[str]: [file name]
"""
#return path.split("/")[len(path.split("/")) - 1]
return os.path.basename(path)
def capital_letters_file(path):
"""Turns content file to... |
#!/usr/bin/env python3
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... |
# coding:utf-8
import os
import unittest
import subprocess
import json
import socket
import time
from six.moves import queue
from captain_comeback.restart.engine import restart
from captain_comeback.restart.adapter import (docker, docker_wipe_fs, null)
from captain_comeback.cgroup import Cgroup
from captain_comeback.r... |
from tkinter import *
from tkinter import ttk
import tkinter.filedialog
from odf_tools import *
from app_dictionary import _, load_dictionary
class ScrollableCanvas(Frame):
def __init__(self, parent, bg='#FFFFFF', width=1000, height=600, scrollregion=(0,0,500,500)):
Frame.__init__(self, parent)
... |
def export_to_lt(system, template, output_name):
print("Writing lt file ...")
print("Writing header ...")
header = get_header(template)
output = open(output_name, "w")
output.write(header)
print("Writing groups ...")
output.write(get_atoms(system))
output.write("\n")
print("Writin... |
import os
import pytest
import time
import json
import re
import yaml
import glob
from argparse import ArgumentParser
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.common.action_chains import ActionChains
from selenium.webdriver.support import expected_conditions
fro... |
# Copyright 2014-2017 F5 Networks 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 agreed to in ... |
from tkinter import *
import webbrowser
from tkinter import ttk
new = 1
url = "https://www.fast.com"
def fastspeed():
webbrowser.open(url, new=new)
root = Tk()
root.title("Download Time Calculator by leon")
root['bg'] = "lightgreen"
ico = PhotoImage(file="C:\\Users\\GoodBoy69\\Desktop\everything\\dtc v0.1 st... |
# A part of NonVisual Desktop Access (NVDA)
# Copyright (C) 2014-2022 NV Access Limited
# This file is covered by the GNU General Public License.
# See the file COPYING for more details.
"""Framework for presentation of math.
Three types of presentation are supported: speech, braille and interaction.
All of the... |
# built-in
import subprocess
import sys
from io import BytesIO
from unittest.mock import patch, Mock
from pathlib import Path
from textwrap import dedent
# external
import pytest
# project
from flakehell._cli import main
# app
from .utils import chdir
def test_flake8helled_file():
"""Baseline behavior, when an... |
from __future__ import absolute_import
import os
import shutil
import tempfile
import sys
import re
from io import StringIO
import pytest
from cwltool.main import main
import cwltool.process
from .util import get_data, needs_docker, temp_dir, windows_needs_docker
@needs_docker
def test_missing_enable_ext():
... |
# -*- coding: utf-8 -*-
"""
human VS AI models
Input your move in the format: 2,3
@author: <NAME>
"""
from __future__ import print_function
import pickle
from game import Board, Game
# from mcts_pure import MCTSPlayer as MCTS_Pure
from MCTS import MCTSPlayer as MCTS_Pure
# from mcts_alphaZero import MCTSPlayer
import... |
# -*- coding: utf-8 -*-
from __future__ import division, print_function
import unittest
import numpy as np
from nufft import nufft1d1freqs, nufft1d1, nufft1d2, nufft1d3
def _get_data():
ms = 90
nj = 128
k1 = np.arange(-0.5 * nj, 0.5 * nj)
j = k1 + 0.5 * nj + 1
x = np.pi * np.cos(-np.pi * j / nj)
... |
"""
Python photo border utility
"""
from PIL import Image as img
from PIL import ImageOps as opts
from os import makedirs as mkd
import os
#import numpy as np
import ctypes
import json
from random import randint
posterizeval = 2 #default: 3
coloursort = False # True or False - sort by frequency
border = 'thick' # thic... |
import math
import torch
import torch.nn as nn
import torch.nn.init as init
import torch.utils.model_zoo as model_zoo
from ttq import Quantize as Quantize_, TTQ
__all__ = ['SqueezeNet', 'squeezenet1_0', 'squeezenet1_1']
model_urls = {
'squeezenet1_0': 'https://download.pytorch.org/models/squeezenet1_0-a815701f.p... |
import re
import requests
import random
from bs4 import BeautifulSoup
# iterations for random search
iterations = 20
# output file, name can be changed here
output_file = 'bibliography.txt'
# Put references in this file
ref_file = input("reference file name (e.g. references.txt):\n")
# code starts below
# define s... |
# -------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
# --------------------------------------------------------------------------
"""KQL Hel... |
# Shared functions for all http request service classes.
# Import external modules.
import jinja2
import json
import logging
import os
# Import app modules.
from configuration import const as conf
import cookie
import linkKey
import user
JINJA_ENVIRONMENT = jinja2.Environment(
loader = jinja2.FileSystemLoader(... |
#!/usr/bin/env python
import sys
import json
import requests
import traceback
import backoff
from datetime import datetime
from celery import uuid
from hysds.celery import app
from hysds.orchestrator import run_job
from hysds.log_utils import log_job_status
from utils import revoke
JOBS_ES_URL = app.conf["JOBS_ES_UR... |
import unittest
import os
from stackstate_checks.base.stubs import topology as top, aggregator
from stackstate_checks.aws_topology import AwsTopologyCheck, InitConfig
from stackstate_checks.base import AgentCheck
import yaml
import json
import mock
from contextlib import contextmanager
import botocore
import hashlib
im... |
import bisect
from html.parser import HTMLParser
from typing import Generator, List, Optional, Tuple
class Content:
def __init__(self, raw_content: str) -> None:
assert raw_content
self._line_offsets = tuple(self._gen_line_offsets(raw_content))
self._raw_content = raw_content
@propert... |
#!/usr/bin/python3
'''
OpenBLAS Relay Library Generator
Copyright (C) 2019 <NAME> <<EMAIL>>
License: MIT/Expat
Julia decided to mangle the symbols of the vendored copy of openblas
(INTERFACE64=1). I didn't read all the past discussions but in fact the symbol
mangling introduced difficulty in distribution packaging, an... |
from SBaaS_base.postgresql_orm_base import *
class data_stage02_isotopomer_dendrogram(Base):
__tablename__ = 'data_stage02_isotopomer_dendrogram'
id = Column(Integer, Sequence('data_stage02_isotopomer_dendrogram_id_seq'), primary_key=True)
analysis_id = Column(String(500))
leaves = Column(postgresql.AR... |
# Copyright (c) 2013 Hewlett-Packard Development Company, L.P.
#
# 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... |
from django.db import models
from django.db.models import Count
from titlecase import titlecase
from django.contrib.auth.models import User
from cuser.middleware import CuserMiddleware
from management.models import Team, Site
import socket
_statuses = (('needs-setup', 'Ready to be set up'),
('installed',... |
# bert_pos.py
# author: <NAME>
import argparse
import time
import torch
import torch.nn as nn
import numpy as np
from dataloading import POSDataset, padding_collate_fn, IDX2POS, POS2IDX, IGNORE_IDX
from torch.utils.data import DataLoader
from transformers import SqueezeBertConfig, SqueezeBertTokenizer, SqueezeBertForT... |
""" Multicast DNS Service Discovery for Python, v0.14-wmcbrine
Copyright 2003 <NAME>, 2014 <NAME>
This module provides a framework for the use of DNS Service Discovery
using IP multicast.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser Gene... |
"""
@file
@brief Various helpers about files
"""
import os
import stat
import warnings
from io import BytesIO, StringIO
from .synchelper import explore_folder_iterfile
from .internet_helper import read_url
from .file_info import is_file_string, is_url_string
def change_file_status(folder, status=stat.S_IWRITE, s... |
from abc import ABC, abstractmethod
from typing import Any, Dict, List, Tuple
import numpy as np
from scipy.sparse import diags
import lumos.numpy as lnp
from lumos.optimal_control.collocation import (
build_lagrange_differential_matrix,
build_lagrange_integration_matrix,
CollocationEnum,
get_colloca... |
#!/usr/bin/env python
# Copyright (c) 2018, The Regents of the University of California
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# * Redistributions of source code must retain the above cop... |
# -*- coding: utf-8 -*-
# 系统模块
import sys
# 获取文件目录模块
import os
# 时间处理模块
import datetime
# 数据处理模块
import pandas as pd
import numpy as np
# 日志记录模块
import logging
# web API所需使用的模块
from flask import Flask
from flask_cors import CORS, cross_origin
from gevent.pywsgi import WSGIServer
# 引入模型预测模块
path = os.path.dirname(... |
"""Recommend API.
"""
from copy import deepcopy
import numpy as np
from catalog import SimpleCatalog, Track
from cf.cf_hidden_feature import get_hidden_feature_matrix_GD
import itertools
from API.user import train_user_taste_model
# TODO: implement classes: UserTasteModel.
class RecommendationEngine(object):
de... |
# pylint: disable=global-variable-undefined, invalid-name
"""Multiprocess dataloader for distributed training"""
import multiprocessing as mp
import time
import traceback
from .dist_context import get_sampler_pool
from .. import backend as F
__all__ = ["DistDataLoader"]
def call_collate_fn(name, next_data):
"""... |
import numpy as np
import pandas as pd
from pandas.io.json import json_normalize
import copy, json
import functools
from dataclasses import dataclass, field
from typing import List, Any
import pickle
from cachetools import cached
from cachetools.keys import hashkey
from functools import partial
import logging
logger =... |
import os
import sys
import json
from keras.callbacks import CSVLogger
from dotenv import load_dotenv
load_dotenv()
sys.path.insert(0, 'train')
from model import *
from data import trainGenerator
from utils import create_directory, get_subfiles, get_current_date_time
# global constants
dataset_path = os.getenv('DAT... |
"""
#####################################################################################################
This module is for finding genes that are significantly correlated with phenotypes or other genotypes
Inputs:
Outputs:
<NAME>
11-4-2016
##################################################################... |
"""Mimics anchor/tests/multisig."""
from dataclasses import replace
from pytest import mark, fixture
from solana.keypair import Keypair
from solana.publickey import PublicKey
from solana.sysvar import SYSVAR_RENT_PUBKEY
from solana.transaction import AccountMeta
from anchorpy import Program, Context, Provider
from an... |
#!/usr/bin/env python3
# Token is BOTTOKEN in env-vars
# E.G. "BOTTOKEN=<something> python3 combo.py"
# Standard python imports
import os, string, unicodedata, sys, re, random, time, datetime, subprocess, json, traceback
import urllib.parse
import importlib
from os import listdir
from os.path import isfil... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.