text stringlengths 3.07k 22.1k |
|---|
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created: Mon Apr 29 09:37:24 2019
Author: crdrisko
Description: Mie Theory code for the calculation of C_extinction and C_scattering.
References: 1) "Optical extinction spectroscopy of single silver nanoparticles" by <NAME>,
<NAME>, <NAME>,... |
import sys
sys.path.append("..")
sys.path.append("../MPC")
import pandas as pd
import numpy as np
import pickle
import datetime
import yaml
import pytz
import pprint
import datetime
import utils
def apply_temperature_change(df):
no_change_data = df[df["t_next"] == df["t_in"]]
increase_data = df[df["t_ne... |
# Copyright (c) 2019-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
#
import sys
import unicodedata
import six
import argparse
import os
import re
import os.path
import shutil
from tensor2tensor.c... |
try:
from PySide2 import QtWidgets, QtCore, QtGui
except ImportError:
from PySide import QtCore, QtGui
QtWidgets = QtGui
styleSheet = """
QFrame {
font: italic 12px;
border: 2px solid rgb(20,20,20);
border-radius: 4px;
border-width: 0px;
padding: 2px;
background-color: rgb(70,70,70... |
from radionets.simulations.gaussians import create_grid, create_rot_mat
import numpy as np
from tqdm import tqdm
import h5py
def gaussian_component(x, y, flux, x_fwhm, y_fwhm, rot, center=None):
"""
Adds a gaussian component to a 2d grid.
Parameters
----------
x: 2darray
x coordinates of ... |
#!/usr/bin/env python3
import argparse
import json
import logging
import sys
from pprint import pformat
from typing import Any, Callable, Dict, Mapping, NewType, Optional, cast
import requests
import yaml
logger = logging.getLogger(__name__)
Args = NewType('Args', argparse.Namespace)
NUTID_USER_V1 = 'https://scim.e... |
'''Various image handling functions.'''
from .common import *
import math
import numpy as np
# HANDLE IMAGE LOADING
try:
import lycon
# define functions
def imwrite(img_path, img):
'''Stores image to disk.'''
img = np.ascontiguousarray(img, dtype=np.uint8)
lycon.save(img_path, i... |
# from personal_dashboard.mint import Mint
from flask import Flask, render_template, request, redirect, url_for, abort, session, jsonify
import time, threading, random, webbrowser
from personal_dashboard.quotes import Quote
from flask import send_from_directory
from personal_dashboard.rescuetime import RescueTime
# fro... |
from beziers.cubicbezier import CubicBezier
from beziers.quadraticbezier import QuadraticBezier
from beziers.line import Line
from beziers.point import Point
import math
"""
This implements (possibly badly) the algorithm in "Computing the
minimum distance between two Bézier curves", Chen et al.,
*Journal of Computatio... |
"""
TBD
Class :py:class:`geometry` supports tentative format of geometry constants for LCLS2
====================================================================================
Usage::
from psana.pscalib.geonew.utils import object_from_python_code
geometry_cspad = object_from_python_code('lcls2/psana/psana/... |
from time import time
from queue import deque
import torch
def make_state(state, recurrent):
state = torch.FloatTensor(state).to(algo.device).unsqueeze(0)
if recurrent:
state = state.unsqueeze(0)
return state
def train(
env,
algo,
experience_replay,
num_episodes:... |
# -*- coding: utf-8 -*-
"""
Client module.
SPDX-License-Identifier: MIT
"""
import datetime
import logging
import re
from typing import Dict, Optional, Union
import aiohttp
import async_timeout
from bs4 import BeautifulSoup
_LOGGER = logging.getLogger('countdoom')
class CountdoomClient:
"""
Countdoom cli... |
import importlib
import logging
import os
import random
from collections import defaultdict
import cv2
import imgaug as ia
import numpy as np
import torch
import yamlenv
from huepy import green
def setup(args):
torch.set_num_threads(1)
cv2.setNumThreads(0)
cv2.ocl.setUseOpenCL(False)
os.environ['OMP_... |
import os
from onconet.datasets.factory import RegisterDataset
from onconet.datasets.abstract_onco_dataset import Abstract_Onco_Dataset
import onconet.utils
from tqdm import tqdm
from random import shuffle
import pickle
import numpy as np
import pdb
np.random.seed(1)
METADATA_FILENAMES = {
'Detection' : "mammo_m... |
# -*- coding: utf-8 -*-
"""
plugin load mannger
"""
import os
import sys
from imp import find_module, load_module, acquire_lock, release_lock
import flybirds.utils.flybirds_log as log
from flybirds.core.global_context import GlobalContext
from flybirds.core.plugin.plugin_proxy import PluginProxy
def append_prex(name... |
'''
Answer class
'''
import time
import json
import datetime
import logging
import warnings
from sqlalchemy.types import ARRAY as Array
from sqlalchemy import Column, DateTime, String, Integer, Float, ForeignKey
from sqlalchemy.types import JSON
from sqlalchemy.orm import relationship, backref
from sqlalchemy import ... |
import http
import json
import pickle
import time
from os.path import exists
import requests
from requests import RequestException
import base64
import logging
import http.client as http_client
import importlib
from infusionsoft.token import Token
class Infusionsoft:
"""Infusionsoft object for using their `REST ... |
import re
import pandas as pd
import subprocess
import json
import urllib
import os
import matplotlib.pyplot as plt
# Compied and modified from https://github.com/pandas-dev/pandas/pull/19065
# The merged code doesn't allow optional days
iso_pater = re.compile(r"""P
(?:(?P<days>-?[0-9]*)D)?
... |
from kubernetes import client, config, watch
#from pprint import pprint
import threading
import random
import time
import os
import sys
import traceback
import Modeler
#import Markers
import Integers
#import Fingerprints
#import Histograms
sys.path.append(os.path.dirname(os.path.realpath(__file__)))
#import Fingerpri... |
#!/usr/bin/env python
# coding=utf-8
# Lint as: python3
"""Masked language model training script for UDGN."""
import argparse
import math
import random
import time
import numpy as np
import torch
import torch.nn as nn
import torch.optim.lr_scheduler as lr_scheduler
import data_dep
import models
from utils import bat... |
import bisect
import math
import torch
class CandidateDomain:
'''
Object representing a domain as produced by the BranchAndBound algorithm.
Comparison between its elements is based on the values of the lower bounds
that are estimated for it.
'''
def __init__(self, lb=-float('inf'), ub=float('i... |
"""
loops.py
Models the loops, or logical segment groupings, for the Enrollment 834 005010X220A1 transaction set.
- Header
- Loop 1000A (Sponsor Name)
- Loop 1000B (Payer Name)
- Loop 1000C (TPA Broker Name)
- Loop 1100C (TPA Broker Account Information)
- Loop 2000 (Member Level Detail)
- Loop 2100A (Member N... |
import configparser
import datetime as dt
import json
import os
import sqlite3
import subprocess
import i18n
import psutil
import yaml
from btb_manager_telegram import settings
from btb_manager_telegram.formating import escape_tg
from btb_manager_telegram.logging import logger
from btb_manager_telegram.schedule impor... |
#!/usr/bin/env python
import click
import json
import pickle
import os
import numpy as np
from nltk.corpus import stopwords
from scipy.sparse import hstack
from sklearn.metrics import f1_score
from langdetect import detect
from model import Model
from preprocessing import preprocess_data, regularize_text
def prepar... |
from appJar import gui
import constantes
import utiles
import waterpy
import os
import sys
raiz = {}
# Esta función es para PyInstaller
def resolver_ruta(ruta_relativa):
if hasattr(sys, '_MEIPASS'):
return os.path.join(sys._MEIPASS, ruta_relativa)
return os.path.join(os.path.abspath('.'), ruta_relativa... |
# -*- coding: utf-8 -*-
from django.conf import settings
from django.contrib.auth import get_user_model
from django.db.models import Q
from django.http import Http404
from django.shortcuts import get_object_or_404
from rest_framework import mixins, views, viewsets, status
from rest_framework.decorators import action
f... |
# -*- coding: utf-8 -*-
"""
The :mod:`coclust.coclustering.coclust_dcc` module provides an implementation
of a model-based von Mises-Fisher co-clustering with a Conscience.
"""
# Author: <NAME> <<EMAIL>>
# License: BSD 3 clause
import numpy as np
from sklearn.utils import check_random_state, check_array
from scipy.... |
import os
import ipdb
import json
import math
import collections
import pandas as pd
import numpy as np
from tqdm import tqdm
import subprocess
from sklearn.feature_extraction.text import TfidfVectorizer
from game_seq_embedder import init_model_and_tokenizer
from app_utils import get_all_indices
from app_utils import h... |
# -*- coding: utf-8 -*-
"""
Created on Fri Jan 16 09:16:56 2015
@author: adelpret
"""
import matplotlib as mpl
import matplotlib.pyplot as plt
import matplotlib.ticker as ticker
import numpy as np
DEFAULT_FONT_SIZE = 20
DEFAULT_AXIS_FONT_SIZE = DEFAULT_FONT_SIZE
DEFAULT_LINE_WIDTH = 4 # 13
DEFAULT_MARKER_SIZE = 6
D... |
import torch
import torch.distributions as D
import torch.nn as nn
import torch.nn.functional as F
from set_matching.models.modules import ISAB, FeedForwardLayer, make_attn_mask
PADDING_IDX = 0
# An implementation of SetVAE
# https://arxiv.org/abs/2103.15619
# Some modules are based on the following.
# https://githu... |
# -*- coding: utf-8 -*-
"""
Created on Sun Feb 21 23:34:16 2016
Library of objects and internal functions
Ing.,Mgr. (MSc.) <NAME>
Biomedical engineering
International Clinical Research Center
St. Anne's University Hospital in Brno
Czech Republic
&
Mayo systems electrophysiology lab
Mayo Clinic
200 1st St SW
Rochester... |
"""
Set of functions to analysis job related in HPC workloads.
"""
from analysis import ProbabilityMap
from commonLib.nerscLib import (getDBInfo, parseFromSQL_LowMem,
getSelectedDataFromRows)
from slurm.trace_gen import extract_records
import numpy as np
def get_jobs_data_trace(... |
from utils import AverageMeter, set_requires_grad, ProgressMeter, plot_loss
from torchvision import transforms as T
import numpy as np
import torch
from PIL import Image
import time
class Denormalize(T.Normalize):
"""DeNormalize a tensor image with mean and standard deviation.
Given mean: ``(mean[1],...,mean[... |
from __future__ import division, print_function
import numpy as np
from scipy import special
from ..core import models
from functools import partial
try:
import matplotlib.pyplot as plt
except ImportError:
pass
cx_fits = {40: [0.39004112, -34.24186523],
4: [0.40712338, -33.82360615],
}
d... |
from __future__ import print_function
import os
import sys
import numpy as np
from PIL import Image
BASE_DIR = os.path.dirname(os.path.abspath(__file__))
ROOT_DIR = os.path.dirname(BASE_DIR)
sys.path.append(BASE_DIR)
from lyft_dataset_sdk.utils.data_classes import LidarPointCloud, Box, Quaternion, Radar... |
#! /usr/bin/env python
__author__ ='<NAME>'
import os
import sys
import numpy as np
from cv_bridge import CvBridge, CvBridgeError
#sys.path.append(os.path.dirname(__file__) + "/../pose-tensorflow/")
#sys.path.append("/opt/ros/kinetic/lib/python2.7/dist-packages/")
# ROS
import rospy
from sensor_msgs.msg import Image
... |
# -*- coding: utf-8 -*-
"""
Created on Tue Aug 11 10:37:24 2020
@author: draveendran
"""
import json
import boto3
import time
import datetime
import ssm_functions
def lambda_handler(event, context):
# TODO implement
print("Executor triggered with event [" + str(event) + "].")
if 'stage' in eve... |
import glob
import logging
import os
import regex
from doc_curation.md import library
from doc_curation.md.file import MdFile
from doc_curation.md.library import get_include
dest_dir_suuktas = "/home/vvasuki/vishvAsa/vedAH/content/atharva/shaunakam/rUDha-saMhitA/sarva-prastutiH"
dest_dir_static = dest_dir_suuktas.re... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#########################################################################################################
# Data ingestion script for the TBFY Knowledge Graph (http://data.tbfy.eu/)
#
# This file contains a script that downloads OCDS JSON documents from the
# OpenOpps OCDS AP... |
import torch
import cv2
import os
import glob
from torch.utils.data import Dataset
import random
import numpy as np
import time
import logging
import torch.optim as optim
from PIL import Image
from tqdm import tqdm
from glob import glob
import albumentations as A
from albumentations.pytorch import ToTensorV2
from al... |
#Author-
#Description-
import adsk.core, adsk.fusion, adsk.cam, traceback
import os
_app = None
_ui = None
# Global set of event handlers to keep them referenced for the duration of the command
_handlers = []
class Print3DPiece():
def __init__(self, full_path):
self.full_path = full_path
self.e... |
#!/usr/bin/env python
# coding: utf-8
# # Captum Robustness with Image Classification
#
#
# This tutorial demonstrates how to apply robustness tooling in captum.robust including adversarial attacks (FGSM and PGD) as well as robustness metrics to measure attack effectiveness and generate counterfactual examples.
#
#... |
from bs4 import BeautifulSoup
import requests
import time
import datetime
import json
import re
import xlsxwriter
import os
cook='shshshfpa=3716a4c3-457c-62f8-3984-99f57985b0f8-1530629113; shshshfpb=1a6d428e2eadd4007a5d510cf3fa35763247552e8427356e25b3b8bfc7; 3AB9D23F7A4B3C9B=C4PWX5Z5AY5Y5DTJHKUEQML5EMPZ... |
import tkinter as tk
from tkinter import *
from PIL import Image, ImageTk
import os
import random
category = 'sides'
ink_color = (255, 255, 255)
example_img = None
total_symbols = 0
# data variables
grid = [0 for j in range(28*28)]
current_symbol = 1
num_categories = 3
def get_magnitude(dist, max_dist):
fade = 0... |
#!/usr/bin/env python3
import os
import sys
import signal
import logging
import threading
from configparser import ConfigParser
import functools
import inspect
import traceback
import typing as t
import dbus
import dbus.service
import dbus.mainloop.glib
import dbus.exceptions
from xdg.BaseDirectory import save_config_... |
import numpy as np
from tqdm import tqdm
from scipy.stats import median_abs_deviation as mad
def drop_near_zero_variance(adata,
freq_thresh=0.05,
unique_thresh=0.01,
drop=True,
verbose=False):
"""Drop f... |
from pathlib import Path
from shutil import rmtree, copyfile
import matplotlib.pyplot as plt
import pandas as pd
import numpy as np
import os
def create_cifar_subset(path, fullpath=Path(), copypath='', p=0.1, copydirs=['train','valid','test']):
"""Copies subset `p` percent of a dataset: dataroot/ -> dataroot_tmp/,... |
from copy import deepcopy
from functools import partial
from random import choice, randint, random
from typing import Any, Callable, TYPE_CHECKING, Union
from fedot.core.composer.constraint import constraint_function
from fedot.core.dag.graph import List
from fedot.core.log import Log
from fedot.core.optimisers.gp_com... |
from django.core.management import CommandError, BaseCommand
from django.conf import settings
from django.db import connection, transaction
from django.db.models import ManyToManyField
from django.utils import timezone
from django.contrib.contenttypes.models import ContentType
from django.db.migrations.loader import Mi... |
#!/usr/bin/env python
# encoding: utf-8
"""
delegate/__init__.py
Created by <NAME> on 2011-02-08.
Copyright (c) 2011 Objects in Space and Time. All rights reserved.
"""
import types
from django.db import models
consumable_types = (
types.FunctionType,
types.MethodType,
)
delegateable_types = consumable_typ... |
import summer_py.summer_model as sm
from numpy import linspace
def find_first_list_element_above(a_list, value):
"""
Simple method to return the index of the first element of a list that is greater than a specified value.
Args:
a_list: List of floats
value: The value that the element must... |
from flask import Flask, render_template, request
from flask import redirect, jsonify, url_for, flash
from sqlalchemy import create_engine, asc
from sqlalchemy.orm import sessionmaker
from models import Base, Sport, Item, User
from flask import session as login_session
import random
import string
from oauth2client.clie... |
def get_url_images(key_term: str, search_term: str, search_lang: str, credentials: dict) -> list:
import requests, json
# Defines search parameters
params = {
'key': credentials['api_key'],
'cx': credentials['search_engine_id'],
'lr': 'lang_' + search_lang,
'exact... |
"""
Baysian hyperparameter optimization [https://github.com/fmfn/BayesianOptimization]
based on <NAME>
"""
import pandas as pd
import xgboost as xgb
from bayes_opt import BayesianOptimization
from scipy.stats import kurtosis, skew
from scipy.ndimage import laplace, sobel
import numpy as np
from multiprocessing import ... |
# Copyright (C) 2008-2010 Association of Universities for Research in Astronomy (AURA)
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# 1. Redistributions of source code must retain the above copyright
# not... |
import logging
# Some common GUI helpers
from PyQt5 import QtCore
from PyQt5.QtGui import QRegExpValidator
from PyQt5.QtWidgets import QTreeView, QDialog, QLineEdit, QComboBox, QVBoxLayout, QHBoxLayout, QDialogButtonBox, QLabel, QMessageBox
from vqt.main import idlethread
logger = logging.getLogger(__name__)
if not... |
"""Report markup with revisions for omitted, duplicate, and derived targets."""
import logging
import pandas as pd
log = logging.getLogger(__name__)
def run(df, target_list):
"""Orchestrate report annotation.
Args:
df (pandas.core.frame.DataFrame): dataframe containing each identified
... |
import os
import re
import html5lib
import xml
import html
from html.parser import HTMLParser
from xml.etree import ElementTree
from collections import OrderedDict
from html5lib.treebuilders import getTreeBuilder
from .xmlfragmentparser import XmlFragmentParser
from .common import escape_url, escape_html
class Sc... |
from collections import defaultdict, OrderedDict
import itertools
import json
import tempfile
from django.http import Http404, HttpResponseForbidden, JsonResponse
from django.shortcuts import redirect
from django.urls import reverse
from django.views.decorators.http import require_POST
from django.views.generic import... |
import glob
import json
import os
import requests
import shutil
import sys
import time
from px import __version__
REPO = "genotrance/px"
def get_argval(name):
for i in range(len(sys.argv)):
if "=" in sys.argv[i]:
val = sys.argv[i].split("=")[1]
if ("--%s=" % name) in sys.argv[i]:
... |
import torch
import torch.nn as nn
import torchaudio
from dataset_utils import create_timit_target, PhonemeTransformer, TextTransformer, get_phoneme_timestamp_information
class LibrispeechCollator(object):
def __init__(self, n_mels, transformer):
self.n_mels = n_mels
self.transformer = transformer... |
"""
BeeWare the Python Music Player.
"""
import toga
from toga.style import Pack
from toga.style.pack import CENTER, LEFT, RIGHT, COLUMN, ROW
from toga.fonts import SANS_SERIF
import pygame
import os
import threading
import time
import eyed3
import bs4
import requests
import re
class Terpsichore(toga.App):
def s... |
import copy
from deap import base # conda install -c conda-forge deap
from deap import cma
from deap import creator
from deap import tools
import math
import numpy as np
import random
def cmaes(dim, f, y_target=0.0):
'''Return x for which f(x) is minimal. Stop early when y-target is reached.'''
if dim < 2 or ... |
from common.constants import infinite_distance
from rift_expect_session import RiftExpectSession
def check_ew_absence_in_south_spf(res):
# E-W neighbor of tof_1_2_1 -> tof_1_2_2
res.check_spf_absent(node="tof_1_2_1", direction="south", destination="122")
# E-W neighbor of tof_2_2_1 -> tof_2_2_2
res.ch... |
from os import name
import pytest
import random
from automates.program_analysis.CAST2GrFN.model.cast import (
AstNode,
Assignment,
Attribute,
BinaryOp,
BinaryOperator,
Call,
ClassDef,
Dict,
Expr,
FunctionDef,
List,
Loop,
ModelBreak,
ModelContinue,
ModelIf,
... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import socket, struct
import select
import time
import json
import sys
import os
import serial
import yaml
import signal
import keyboard
DISTANCE_THRESHOLD = 0.5
MAXIMUM_MOTOR_INPUT = 99
with_connection = True
NB_OF_DRONES = 5
NB_OF_INFORMATION = 11
DESIRED_HEIGHT = 1.0
L... |
import torch
import torch.nn as nn
import torch.nn.functional as F
from utils.gdn import GDN
class LDCT(nn.Module):
def __init__(self, num_channels=1) -> None:
super(LDCT, self).__init__()
self.conv1 = nn.Conv2d(num_channels, 64, kernel_size=9, padding=9//2)
self.conv2 = nn.Conv2d(64, 32, k... |
from random import randrange
from random import choice
from dicts import *
#upgrade: enforce realistic-ish geometry, maybe...
#ALL HAIL THE GREAT OLD ONES ^(;,;)^
# {|}
class Graph:
#creates a graph with a set number of nodes, completely disconected, the default node val is 0
def _... |
import pandas as pd
import requests
import logging
import os
import cartoframes
import datetime
import cartosql
from collections import OrderedDict
import numpy as np
import sys
### Constants
LOG_LEVEL = logging.INFO
DATA_DIR = 'data'
DATA_LOCATION_URL = 'https://api.transitfeeds.com/v1/getLocations?key=258e3d67-9c2e-... |
#! /user/bin/evn python
# -*- coding:utf8 -*-
"""
TextTransformer
======
A class for something.
"""
import torch
import torch.nn as nn
import torch.nn.functional as F
import numpy as np
import sys
import argparse
import datetime
import math
from Deep.Base_Model import Base_Model
from torch.autograd import Variable
im... |
"""
Copyright 2017 ARM Limited
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, software
dis... |
# -*- coding: utf-8 -*-
"""
Multivariate metric: ES and VS.
Then, the DM test is performed.
"""
import math
import os
import pickle
import random
import seaborn as sns
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
from GEFcom2014 import read_file
from GEFcom2014 import pv_data, wind_data, l... |
# encoding: utf-8
import tkinter.messagebox
import webbrowser
from tkinter import *
import jieba
import pandas as pd
import pymongo
from pyecharts import options as opts
from pyecharts.charts import Bar, Page, Pie, WordCloud, Line, Map
class App:
def __init__(self, master):
self.master = ... |
import logging
import os
import platform
import requests
import shutil
import time
import tempfile
import traceback
import unicodedata
from threading import Thread
logger = None
DEBUG = False
def catch_exceptions(func):
"""Decorator to catch exceptions and print it in DEBUG mode.
All threaded functions s... |
import sys
import os
import csv
import math
import json
from datetime import datetime
import cv2
import pandas as pd
import numpy as np
from sklearn.preprocessing import MinMaxScaler
from sklearn.preprocessing import StandardScaler
from sklearn.preprocessing import PowerTransformer
from sklearn.decompos... |
import collections
import functools
import json
import os
import re
import attr
import httpx
from miro_ids import (
parse_miro_id,
NotMiroAssetError,
IsMiroMoviesError,
IsCorporatePhotographyError,
)
from miro_shards import choose_miro_shard
from s3 import get_s3_object, list_s3_objects_from
@attr.s... |
import logging
from django.conf import settings
from django.db import transaction
from django.contrib.auth.models import User, Group, ContentType
from django.core.exceptions import PermissionDenied
from django.http import HttpRequest, HttpResponseRedirect, HttpResponse, \
HttpResponseForbidden, HttpResponseNotFoun... |
import requests
import json
import re
import os
import argparse
import datetime
import zipfile
import gzip
import shutil
from bs4 import BeautifulSoup
from requests.packages.urllib3.exceptions import InsecureRequestWarning
requests.packages.urllib3.disable_warnings(InsecureRequestWarning)
COMPRESSED_DATA_PATH = "./c... |
#!/usr/bin/env python
from tkinter import *
from tkinter import StringVar, ttk
from tkinter.filedialog import askopenfilename
import tkinter.messagebox
import requests
import json
import os
import datetime
from hdfs import InsecureClient
from hdfs.util import HdfsError
LABEL_FILE_UPLOAD = 'Choose file'
LABEL_PROJEC... |
# MIT License
#
# Copyright (c) 2020 by <NAME>, <NAME>, Carnegie Mellon University
#
# 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... |
import re
import urllib
import requests
from ..module import Module
from ..interfaces import IInterpreter
from typing import List, Optional
# Unit separator
US = chr(31)
class ConfluenceError(RuntimeError):
pass
class ConfluenceModule(Module):
"""This implements basic support to upsert wiki pages to Conflu... |
# Copyright 2021 <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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, sof... |
import os
import csv
import numpy as np
from tqdm import tqdm
from sklearn.utils import shuffle
from sklearn.model_selection import train_test_split
seed = 3535999445
def _rocstories(path):
with open(path, encoding='utf_8') as f:
f = csv.reader(f)
st = []
ct1 = []
ct2 = []
... |
html = """
<html lang="en">
<body>
<div id="wrap">
<header>
<!-- working version it may change -->
<div class="logo"></div>
<div class="registration-header">
<a href="" class="login-btn">
prihlásenie
</a>
... |
import json
import os
from os import listdir
from subprocess import Popen, PIPE, TimeoutExpired
import matplotlib.pyplot as plt
from pylab import *
from textops import find
EXCLUDED_LANGS = {'gitignore', 'Markdown', 'License', 'JSON', 'YAML', 'Prolog', 'Batch', 'Properties File'}
INCLUDED_LANGS = {'Java', 'Python', ... |
#!/usr/bin/env python
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import argparse
from isicdata import download_archive
from tqdm import tqdm
import sys
import random
import io
import contextlib2
import tensorflow as tf
import PIL
import glob
import cv2... |
"""
Main module of the command line application.
It contains all the logic for building and openning URLs on remote repos.
"""
import os
import re
import subprocess
import webbrowser
from optparse import OptionParser
from . import __version__
CURRENT_DIR_PATH = "."
DEFAULT_PROTOCOL = "https://"
DEFAULT_REMOTE_NAME ... |
"""CSC148 Assignment 2
=== CSC148 Winter 2020 ===
Department of Computer Science,
University of Toronto
This code is provided solely for the personal and private use of
students taking the CSC148 course at the University of Toronto.
Copying for purposes other than this use is expressly prohibited.
All forms ... |
# Model of runtime values from debug session
__all__ = [
"Value"
]
from common import (
lazy
)
from .expression import (
Register,
Constant,
AddressSize,
Deref,
ObjDeref,
Mul,
Plus
)
from .glob import (
Datum
)
from .type import (
Field,
TYPE_CODE_PTR,
TYPE_CODE_ARRA... |
# coding: utf-8
import os
import time
import json
from picklefield import PickledObjectField
from django.conf import settings
from django.contrib.gis.db import models
from django.db.models import Manager as GeoManager
from django.utils.html import escape
from madrona.common.utils import asKml
from madrona.common.jsonu... |
import torch
import torchvision
import torchvision.transforms as transforms
import numpy as np
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
from torch.autograd import Function, Variable
from torch.nn.parameter import Parameter
from torch.distributions import Bernoulli
cl... |
#!/usr/bin/env python3
# -*- coding:utf-8 -*-
# author: bigfoolliu
"""
平衡二叉树python实现
avl树实现
"""
import math
import random
class Queue(object):
"""实现简易队列"""
def __init__(self):
self.data = []
self.head = 0
self.tail = 0
def is_empty(self):
return self.head == self.tail
... |
import numpy
import cupy
import chainer
import chainer.functions as F
import chainer.links as L
from chainer import variable
class EltFilter(chainer.Link):
def __init__(self, width, height, channels, batchSize=1, wscale=1, bias=0,
nobias=False, initialW=None, initial_bias=None):
W_shape =... |
#!/usr/bin/python3
from abc import ABCMeta, abstractmethod
from venus.stock_base import StockEventBase, StockBase
from venus import stock_base
import pandas
import datetime
import numpy as np
from jupiter.utils import TIME_FMT
"""
趋势跟踪法
所有的择时法,最终都输出一个stock list
所有的风控,都实时输出signal
所有的选股法,最终也输出一个stock list
1.当90日线位于250日线... |
# file: bgp/tests.py
from django.test import TestCase
from django.urls import reverse
from django.contrib.auth.models import User
from netdevice.tests import create_router, create_interface
from bgp.models import aut_num, neighbor
def create_aut_num(asn):
test_asn = aut_num.objects.create(asn=asn,
... |
import time, network, ujson, ubinascii, gui, gc
from umqtt.simple2 import MQTTClient
from machine import Pin
import usocket
from uselect import select
from neopixel import NeoPixel
from tftlcd import LCD32
RED = (255, 0, 0)
GREEN = (0, 255, 0)
BLUE = (0, 0, 255)
BLACK = (0, 0, 0)
WHITE = (255, 255, 255)
GREY = (178, 1... |
"""Combine multiple structural variation callers into single output file.
Takes a simple union approach for reporting the final set of calls, reporting
the evidence from each input.
"""
import collections
import fileinput
import os
import shutil
import toolz as tz
import vcf
from bcbio import utils
from bcbio.distri... |
"""Test the microXS reader."""
import os
import unittest
import numpy
from serpentTools.settings import rc
from serpentTools.data import getFile
from serpentTools.parsers import MicroXSReader
from serpentTools.messages import SerpentToolsException
class TestBadFile(unittest.TestCase):
"""
Test bad files.
... |
# Copyright (c) 2020 The FedVision 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 appl... |
import argparse
import logging
import os
import pickle
import time
import numpy as np
from sklearn import linear_model, neural_network, svm
from scipy.sparse import load_npz
from sklearn.externals import joblib
from sklearn.ensemble import RandomForestClassifier
import lightgbm as lgb
topic_list = [
'321', '336',... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.