text stringlengths 3.07k 22.1k |
|---|
import socket
import sys
import time
from tox import hookimpl
from tox.config import SectionReader
from docker.errors import ImageNotFound
import docker as docker_module
import py
NANOSECONDS = 1000000000
class HealthCheckFailed(Exception):
pass
def escape_env_var(varname):
"""
Convert a string to a ... |
'''
Contentstack's Content Management API Python wrapper
https://www.contentstack.com/docs/developers/apis/content-management-api/
<EMAIL>
2020-09-28
Environmental Variables needed:
- CS_REGION = EU/NA (Europe/North-America)
- CS_MANAGEMENTOKEN (Stack Management Token)
- CS_APIKEY (Stack API Key)
'''
import os
from... |
from machine import Pin
from microbit import *
def set_pixel(x,y,r,g,b):
v=(r,g,b)
display.Led.LoadPos(20-x*5+y,v)
display.Led.Show()
def get_pixel(x,y):
return display.Led.__getitem__(20-x*5+y)
display.set_pixel = set_pixel
display.get_pixel = get_pixel
MYCO='mycobit'
DFLT='default'
pin0.write_ana... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# (c) 2020, <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 = {'metadata_version': '1.1',
... |
#!/usr/bin/env python
# UNIT 4 HOMEWORK
#1 Gold Star
#################################
## 5 Better splitting
#The built-in <string>.split() procedure works
#okay, but fails to find all the words on a page
#because it only uses whitespace to split the
#string. To do better, we should also use punctuation... |
#!/usr/bin/env python
# coding: utf-8
from pyexpect import expect
import itertools
from operator import attrgetter
from fluent import *
def assert_almost_sums_to_one(probabilities):
epsilon = .00000001
assert abs(1 - sum(probabilities)) < epsilon, 'Probability tables need to sum to (almost) 1'
class Refe... |
import os, sys
import argparse, logging
from typing import Dict, List
import secrets
import math
from pprint import pprint
logging.basicConfig()
logger = logging.getLogger("rnaConstructor")
logger.setLevel(logging.INFO)
parser = argparse.ArgumentParser(description="Optimize RNA sequence for target amino acids by map... |
# ------*------ coding: utf-8 ------*------
# @Time : 2022/2/13 20:29
# @Author : 冰糖雪狸 (NekoSilverfox)
# @Project : Statistica-model
# @File : main.py
# @Software: PyCharm
# @Github :https://github.com/NekoSilverFox
# -----------------------------------------
import numpy as np
from matplotlib import pyplot as... |
import os
import shutil
import numpy as np
from osgeo import gdal, osr
# Set this variable to your osgeopy-data directory so that the following
# examples will work without editing. We'll use the os.path.join() function
# to combine this directory and the filenames to make a complete path. Of
# course, you can type t... |
import argparse
from mmdet.apis import init_detector, show_result_pyplot, inference_detector
import warnings
import cv2
import mmcv
import torch
from mmcv.parallel import collate, scatter
from mmdet.datasets.pipelines import Compose
import numpy as np
from pycocotools.coco import COCO
from pycocotools.cocoeval import C... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
import bpy
### --- VERTEX GROUP CHECKS --- ###
def checkHasAnyVGroups(obj):
return len(obj.vertex_groups) > 0
# check if all vertices belong to a vertex group
# markmesh will select the vertices without groups
def checkAllVerticesBelongToAVGroup(obj, markmesh=False):
... |
import itertools
from django.utils import unittest
try:
from wikify.diff_utils import side_by_side_diff, context_diff
except ImportError:
can_test_diff = False
else:
can_test_diff = True
@unittest.skipUnless(can_test_diff, "Diff match patch library not installed")
class SideBySideDiffTest(unittest.TestCa... |
import pickle
import os
from typing import Set
import torch
import torch.nn
import numpy as np
# from numpy import random
import random
import scipy.signal
from collections import deque
import matplotlib.pyplot as plt
#from running_state import ZFilter
import math
import logging
def set_random_seed(seed: int, using_c... |
"""PyTorch script for test (Autoencoder).
Copyright (C) 2021 by <NAME>
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, m... |
#!/usr/bin/env python
import numpy as np
import time
import pickle
import matplotlib.pyplot as plt
from shutil import rmtree
import sys
# np.set_printoptions(threshold=np.inf)
from circuit_searcher import CircuitSearcher
def fluxonium(N, E_c, E_j, phi, n):
"""
Hamiltonium function computing fluxonium qubit... |
#! /usr/bin/python3
import argparse
import logging
import os
import sys
from collections import namedtuple
import torch
from torch.utils.data import DataLoader, SequentialSampler
from tqdm import tqdm
from modeling_bertabs import BertAbs, build_predictor
from transformers import BertTokenizer
from utils_summarization... |
import os
import re
import json
import asyncio
from chess import Board
import discord
from discord.ext.commands import group, Greedy
from .emoji import BLACK_SQUARE, WHITE_SQUARE, ZWSP, LETTERS, NUMBERS
from .games import Games
from .i18n import embed, i18n
from .utils import DummyCtx, lone_group, background
# +x => r... |
"""Module for Diagnosis Plots of Lineare Regression Models."""
# Standard
import math
# Extra Libs
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import statsmodels.api as sm
from statsmodels.stats.outliers_influence import summary_table, OLSInfluence
from statsmodels.nonparametric.smoothers_lo... |
# -*- coding: utf-8 -*- #
# Copyright 2016 Google LLC. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requir... |
import argparse
import itertools
import multiprocessing
import pathlib
import numpy as np
import sys
import typing
import tqdm
from scipy import ndimage
from precomputed_tif.client import ArrayReader
from precomputed_tif.blockfs_stack import BlockfsStack
from blockfs.directory import Directory
def parse_args(args:ty... |
import logging
import re
from drf_spectacular.extensions import OpenApiSerializerFieldExtension
from drf_spectacular.openapi import AutoSchema
from rest_framework import serializers
from rest_framework.relations import ManyRelatedField
from nautobot.core.api import (
ChoiceField,
SerializedPKRelatedField,
... |
import numpy as np
import copy
import random
from copy import deepcopy
# Krzysztof
def generate_map(map, developers, menagers):
new_data = []
used_devs = []
used_mens = []
for i in range(len(map)):
new_line = []
for j in range(len(map[i])):
if map[i][j] != '... |
# coding=utf-8
import sys
import subprocess
import shutil
import os
import logging
import ue4_constants
import pathlib
from unittest.mock import MagicMock
from . import editorutilities as editorUtilities
L = logging.getLogger(__name__)
class BuilderFactory:
def __init__(self, run_config, build_config_name=""):
... |
import argparse
import copy
import os
import time
import numpy as np
import torch
import torch.distributed as dist
import torch.multiprocessing as mp
from torch.multiprocessing import Process
from torch.nn.parallel import DistributedDataParallel as DDP
from tqdm import tqdm
from cogdl.data.sampler import ClusteredDat... |
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
""" Global monitor for the fuzzing run """
import time
from engine.core.status_codes_monitor import StatusCodesMonitor
from engine.core.renderings_monitor import RenderingsMonitor
def Monitor():
""" Accessor for the FuzzingMonitor singleton... |
#!/usr/bin/env python
# /*
# (c) 2020 <NAME>.
# */
import os
import sys
import shutil
import subprocess
import git
import re
from pygments import highlight
from pygments.formatters import HtmlFormatter
from pygments.lexers import get_lexer_by_name
from pygments.lexers import get_lexer_for_filename
from pygments.styl... |
"""
Wrapper Module to generate molecular descriptors by using other packages
"""
import math
import numpy as np
import os
import pandas as pd
from abc import ABC, abstractmethod
from rdkit import Chem
from rdkit.Chem import AllChem, MACCSkeys
import rdkit.Chem.rdmolops as rdmolops
import rdkit.Chem.rdMolDescriptors a... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
pglev.py
MIT license (c) 2021 Asylum Computer Services LLC
https://asylumcs.net
"""
import re
import os
import sys
import pprint
import argparse
import datetime
from time import gmtime, strftime
def levenshteinDistance(s1, s2):
if len(s1) > len(s2):
... |
"""
matplotlib helper functions for commong drawing tasks.
"""
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.patches
import scipy.spatial
from ..math import eigsorted, nancov
from ..text import int_to_alpha
from ..missing import cooccurence_pattern
from .interpolation import interpolate... |
#!/usr/bin/env python
# encoding: utf-8
#
# Copyright © 2019, SAS Institute Inc., Cary, NC, USA. All Rights Reserved.
# SPDX-License-Identifier: Apache-2.0
"""Commonly used tasks in the analytics life cycle."""
import json
import logging
import pickle
import re
import sys
import warnings
from . import utils
from .c... |
"""
problog.nnf_formula - d-DNNF
----------------------------
Provides access to d-DNNF formulae.
..
Part of the ProbLog distribution.
Copyright 2015 <NAME>, DTAI Research Group
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the Li... |
#!/usr/bin/env python2
# -*- coding: utf-8 -*- #
#
# Creates a zip file of the self executable Ardublockly application.
#
# Copyright (c) 2015 carlosperate https://github.com/carlosperate/
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the Licen... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Copyright 2018 SiLeader and Cerussite.
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/LICENS... |
import typing as tp
import numpy as np
import tensorflow as tf
def canonicalize_axis(axis: int, ndims: int) -> int:
if axis < 0:
axis += ndims
assert 0 <= axis < ndims
return axis
def squeeze(st: tf.SparseTensor, axis=None) -> tf.SparseTensor:
"""Same as tf.squeeze but supports `tf.SparseTe... |
# Copyright 2019 Quantapix 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 applicable l... |
from collections import Counter
import hdbscan
from sklearn import metrics
import skfuzzy as fuzz
import os
from load_bws import *
def initial_centers(tfidf, k, seed):
return tfidf[np.random.default_rng(seed=seed).choice(tfidf.shape[0], k, replace=False)]
def sphericalkmeans(tfidf, centers, max_iter=100):
... |
import numpy as np
# custom modules
import graph_ltpl
# custom packages
import trajectory_planning_helpers as tph
def gen_node_skeleton(graph_base: graph_ltpl.data_objects.GraphBase.GraphBase,
length_raceline: list,
var_heading=True,
closed: bool = T... |
from os.path import join
import numpy as np
from ctf_dataset.load import create_wrapped_dataset
from ctf_dataset.info import events as event_names
base_dir = '/mnt/bucket/labs/hasson/snastase/social-ctf'
data_dir = join(base_dir, 'data')
# Create wrapped CTF dataset
wrap_f = create_wrapped_dataset(data_dir, output_da... |
# coding=utf-8
# Licensed Materials - Property of IBM
# Copyright IBM Corp. 2017,2018
import unittest
import os
import sys
import itertools
import logging
import json
from streamsx.topology.topology import *
from streamsx.topology.context import JobConfig, ConfigParams, submit
from streamsx.topology.tester import Test... |
#!/usr/bin/env python
from __future__ import print_function
import os
import re
import sys
import argparse
from task_models.task import (SequentialCombination, LeafCombination)
from task_models.supportive import (SupportivePOMDP, AssembleLeg, AssembleLegToTop,
NHTMHorizon)
from ta... |
import os
import numpy as np
import itertools
from numpy.core.shape_base import _block_slicing
import prody as pr
import datetime
from scipy.sparse.csr import csr_matrix
from scipy.sparse import lil_matrix
from scipy.sparse.sputils import matrix
from ..basic import hull
from ..basic import utils
from ..basic.filter i... |
from dagit.schema import dauphin
from dagit.schema import model
from dagster.core.execution import ExecutionSelector, ExecutionMetadata
from ..version import __version__
class DauphinQuery(dauphin.ObjectType):
class Meta:
name = 'Query'
version = dauphin.NonNull(dauphin.String)
pipelineOrError = ... |
import numpy as np
from typing import Callable, Tuple, Dict, List
import scipy.fft
from scipy.fft import dct, idct, rfft, irfft
from scipy.stats import ortho_group
NumpynDArray = np.ndarray
MatrixTensorProduct = Callable[[NumpynDArray], NumpynDArray]
def _default_transform(tube_size: int) -> Tuple[MatrixTensorProdu... |
#!/usr/bin/env python3
import tweepy
from local_config import *
from tweepy import Stream
from tweepy.streaming import StreamListener
import json
from collections import Counter
import sqlite3
import time
# regular expression
import re
# import pbd
#Country name with their languages
langs = {
'ar': 'Arabic', 'bg'... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon Dec 2 12:44:57 2019
@author: ilia10000
"""
import numpy as np
from skimage.measure import compare_ssim, compare_mse, compare_nrmse
from utils.baselines import average_train
import torch
def permute_list(list):
indices = np.random.permutation(len(l... |
#!/usr/bin/env python
#
#--------------------------------------------------------------------------------
# Authors:
# - <NAME>: <EMAIL>
# - <NAME>: <EMAIL>
#
# MIT License
# Copyright (c) 2021 CORSMAL
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associate... |
import datetime as dt
import pytz
import pytest
import flask_application.data as data
def strip_html_tags(text):
finished = 0
while not finished:
finished = 1
start = text.find("<")
if start >= 0:
stop = text[start:].find(">")
if stop >= 0:
text... |
# Copyright (c) Microsoft Corporation
# All rights reserved.
#
# MIT License
#
# 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 rights to ... |
from django.conf import settings
from django.contrib.auth.models import AbstractUser
from django.db import models
from django.db.models import Count, Sum
from django_datatables.columns import DatatableColumn, CurrencyPenceColumn, ColumnBase, ManyToManyColumn, \
DateColumn
from django_datatables.model_def import Dat... |
# -*- coding: utf-8 -*-
#
# eso-blog
# Copyright (c) 2007-2017, European Southern Observatory (ESO)
# 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 reta... |
import collections
from typing import List
class TrieNode:
def __init__(self, word=None):
self.word = word
self.children = collections.defaultdict(TrieNode)
class Trie:
def __init__(self):
self.head = TrieNode()
def insert(self, word: str) -> None:
def insert_char(remai... |
""" Analyze IOT datasets (data-clean.zip: 20GB, 20210714) collected on 2021.
"""
import collections
import os
import subprocess
import numpy as np
from itod.pparser.pcap import PCAP, pcap2flows, flow2subflows
from itod.utils.tool import dump_data, load_data
from reprst.report.paper_results import check_path
RANDOM_... |
import torch
import torchvision
import torch.optim as optim
import torch.utils.data
from torchvision import datasets, transforms
import os
import argparse
import numpy as np
import ipdb
import json
import sys
sys.path.append("..") # Adds higher directory to python modules path.
from utils.utils import create_loaders, ... |
import threading, os, utils
from collections import OrderedDict
data_folder = 'data'
last_update_time = None
info_folder = 'eval-results'
info_path = 'client/' + info_folder + '/info.txt'
info = None
lock = threading.Lock()
def scan_files(data_folder, extension='.tif'):
import os
files_scanned = []
for root, dirs,... |
import os
import json
import math
from datetime import datetime
from functools import wraps
from typing import List, Dict, Any, Iterator, Tuple
import requests
from flask import request, jsonify
from sqlalchemy import and_
from app import app_cache, client
from app.models import Submission, PostSubmitActionEnum, User... |
import sys
import signal
import os
import stat
import atexit
import subprocess
from siginfo.localclass import LocalClass
class SiginfoBasic:
"""
Base class for the SigInfo module
Args
----
info : bool
Listen for SIGINFO
Default: True
(works only on Mac and BSD)
usr1 :... |
"""
Components/Chip
===============
.. seealso::
`Material Design spec, Chips <https://material.io/components/chips>`_
.. rubric:: Chips are compact elements that represent an input, attribute, or action.
.. image:: https://github.com/HeaTTheatR/KivyMD-data/raw/master/gallery/kivymddoc/chips.png
:align: cen... |
"""
Filters Ontario COVID data and all universities' tweets to useful data.
Copyright and Usage Information
===============================
This file is provided solely for the personal and private use of evaluators
of CSC110 at the University of Toronto St. George campus. All forms of
distribution of this code, wheth... |
#!/usr/bin/env python
# vim: set fileencoding=utf-8 :
"""Re-usable blocks for legacy bob.bio.base algorithms"""
import functools
import logging
import os
from bob.bio.base.algorithm import Algorithm
from bob.pipelines import DelayedSample
from bob.pipelines import DelayedSampleSet
from bob.pipelines import SampleSet... |
import re
import pprint
import random
import colorsys
import discord
import wolframalpha
from discord.ext import commands
import os
import dotenv
from dotenv import load_dotenv
load_dotenv()
wolfram = os.getenv('wolfram')
class askwolfram(commands.Cog):
"""
Interface with Wolfram|Alpha
You can ask the b... |
# 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
# d... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import sys
import numpy as np
from utils import read_corpus, batch_iter
from vocab import Vocab
from nmt_model import NMT
import torch
import torch.nn as nn
import torch.nn.utils
BATCH_SIZE = 5
EMBED_SIZE = 3
HIDDEN_SIZE = 3
DROPOUT_RATE = 0.0
def reinitialize_laye... |
"""
Tests for the API views.
These are run by `./manage.py test`.
"""
import json
import requests
from django.conf import settings
from django.test import TestCase
from django.test.client import Client
from api.apiconsumer.models import APIConsumer
from models import Alias, Course, CourseHistory, Department, Instruc... |
import os
import shutil
from hardhat.util import check_directory, patch
from hardhat.environment import target_path_env
from hardhat.urls import Urls
from .gcc_mpfr import GccMpfrRecipe
from .gcc_mpc import GccMpcRecipe
from .gcc_gmp import GccGmpRecipe
from .gcc_isl import GccIslRecipe
from hardhat.recipes.cross.base ... |
"""Performs additional analysis on MNIST variants."""
import re
import os
from os.path import join
import json
from glob import glob
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
from natsort import natsorted
from tqdm import tqdm
from sklearn.manifold import TSNE
import ... |
# Copyright (c) 2014 OpenStack Foundation
#
# 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 ... |
"""
Environment control in blender.
Classes:
Props - Snapshot of prop collections in blender's data.
ReportDelta - Decorator for functions to report changes the function made to blender after execution.
Key - Timeline management (lim and auto_lim are really useful)
Functions:
re... |
from .defaults import ChildPopulationCollection
from ..transforms import apply_transform
from .utilities import density_dependent_downsample
from shapely.geometry.polygon import Polygon
from scipy.spatial import ConvexHull
from functools import partial
import pandas as pd
import numpy as np
class GateError(Exception)... |
# $yfId$
import sys
import os
#
# common code template for static/dynamic class
#
common_template = """%%(decl_top)s
cdef object c_base
c_base = (b'const ' if is_const else b'') + b'%%%%(ctype)s'
%%(obj_ref)s._c_base_type = c_base
%%(obj_ref)s._c_esize = sizeof(%%%%(ctype)s)
%%... |
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.animation as animation
from matplotlib.animation import FuncAnimation
from matplotlib import cm, colors
from src.Model import HIOM
from scenarios.test import agents
def plot_opinion_distribution(opinions):
iterations = len(opinions)
steps =... |
# -*- coding: utf-8 -*-
import os
import paramiko
import traceback
import hashlib
import magic
from datetime import timedelta
from celery import states
from celery import task, shared_task
from celery.task import periodic_task
from celery.exceptions import Ignore
from collections import OrderedDict
from .models import... |
import os
import sys
sys.path.append('modules/pytorch_mask_rcnn')
import numpy as np
import torch
import matplotlib.pyplot as plt
from torch.autograd import Variable
from torch.autograd.gradcheck import zero_gradients
from model import Dataset, unmold_image, MaskRCNN, compute_losses
from visualize import display_inst... |
"""
Contains code for logging approximate FID scores during training.
If you want to output ground-truth images from the training dataset, you can
run this file as a script.
"""
import os
import shutil
import torch
import copy
import argparse
from torch.utils.data import dataset
from torchvision.utils import save_ima... |
import xxtea
import os
from traveDir import depthIteratePath
import sys
import random
from loguru import logger
from io import BytesIO
import zipfile
dIP = depthIteratePath([".luac"])
"""1.Print Log"""
try:
from shutil import get_terminal_size as get_terminal_size
except:
try:
from backports.shutil_ge... |
import numpy as np
from scipy.spatial.distance import cdist
def cmeans(data, c, h, error, maxiter, metric='euclidean', init=None, seed=None):
"""
Fuzzy c-means clustering algorithm [1].
Parameters
----------
data : 2d array, size (S, N)
Data to be clustered. N is the number of... |
# -*- coding: utf-8 -*-
#
# Copyright 2020 Huawei Technologies Co., Ltd
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required ... |
#coding=utf-8
"""
新的scanner模块
Scanner主要来整体调度,主要是扫描已插入的代码块
然后更新TaskStore
TaskStore会去调用TaskInfo对象来更新代码块
TaskInfo会托管代码块的变化,当代码块产生变化时会重新加载,并且构建
TaskStore在更新时,会同时检查代码块和配置的变化
当有产生变化的部分时,会更新调度器的任务信息
删除任务应当由Scanner来保证,
Scanner必须能检测有代码块被拔出并执行删除操作
"""
import os,importlib,sys
from . import task
from .corelogger import CoreLogger,... |
# -*- coding: utf-8 -*-
"""
Created on Fri Feb 4 12:14:09 2022
@author: johan
"""
import dash
from dash import dcc, html, Input, Output
import dash_labs as dl
import dash_bootstrap_components as dbc
from dash_bootstrap_templates import load_figure_template
#from dash_bootstrap_templates import ThemeSwitchAIO
import... |
#!/usr/bin/env python
# Copyright (c) 2012 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Unit tests for path_set.py."""
import os
import sys
import unittest
from build_tools import path_set
class TestPathSet(unitt... |
# A part of pdfrw (https://github.com/pmaupin/pdfrw)
# Copyright (C) 2006-2015 <NAME>, Austin, Texas
# MIT license -- See LICENSE.txt for details
'''
The PdfWriter class writes an entire PDF file out to disk.
The writing process is not at all optimized or organized.
An instance of the PdfWriter class has two methods... |
# -*- coding: utf-8 -*-
"""
Collection of numerical algorithms.
"""
import numpy
import krypy
class ForcingConstant(object):
def __init__(self, eta0):
self.eta0 = eta0
return
def get(self, eta_previous, resval_previous, F0, F_1):
return self.eta0
class Forcing_EW1(object):
"""Li... |
from google.protobuf.duration_pb2 import Duration
from airflow.utils.task_group import TaskGroup
from airflow.operators.python import PythonOperator
from airflow.operators.dummy import DummyOperator
from airflow.providers.google.cloud.operators.dataproc import DataprocSubmitJobOperator
from debussy_framework.v3.operato... |
import itertools
from operator import itemgetter
from collections import defaultdict
from django.db.models import Q
from django.utils.functional import cached_property
from django.utils.text import slugify
from core.utils import filter_key
from mi.models import UKRegionTarget
from mi.views.team_type_views import Team... |
import streamlit as st
import random
import psycopg2
import pandas as pd
import numpy as np
from sqlalchemy import create_engine
from sqlalchemy.types import Integer
from streamlit.report_thread import get_report_ctx
#from streamlit.report_thread import add_script_run_ctx
import pydeck as pdk
from datasets import load_... |
# USAGE
# python detect_mask_video.py
# import the necessary packages
from tensorflow.keras.applications.mobilenet_v2 import preprocess_input
from tensorflow.keras.preprocessing.image import img_to_array
from tensorflow.keras.models import load_model
from imutils.video import VideoStream
import numpy as np
import argp... |
# Copyright (c) 2014, Fundacion Dr. <NAME>
# All rights reserved.
# 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 notice, this
# list of conditions and... |
import json
import urllib
import requests
import random
import RPi.GPIO as GPIO
import time
import inspect
import sys
from pprint import pprint
from os.path import expanduser, isdir, isfile, join, dirname
from os import getenv, remove, listdir
from SimpleCV import Image, Camera # is python 2
from pygame import mixer
... |
"""
Copyright (c) 2019 LINKIT, The Netherlands. All Rights Reserved.
Author(s): <NAME>
This software may be modified and distributed under the terms of the
MIT license. See the LICENSE file for details.
"""
import sys
import re
import time
# pylint: disable=E0401
import boto3
# pylint: disable=E0402
from .exceptions... |
import sys
import unittest
import pywren_ibm_cloud as pywren
import urllib.request
from pywren_ibm_cloud.storage.backends import cos
from pywren_ibm_cloud import wrenconfig
from multiprocessing.pool import ThreadPool
import logging
# logging.basicConfig(level=logging.DEBUG)
def initTests():
print('Uploading tes... |
from numbers import Number
from abc import ABC, abstractmethod
import numpy as np
class Key(tuple):
def __new__(cls, value):
try:
if isinstance(value, str) or isinstance(value, Number):
return tuple.__new__(cls, (value,))
return tuple.__new__(cls, value)
exc... |
from functools import reduce
from typing import Tuple, Callable
import numpy as np
from .backend import choose_backend
from ._shape import EMPTY_SHAPE, Shape, shape, parse_dim_order
from ._tensors import Tensor, NativeTensor, TensorStack, CollapsedTensor
from . import _functions as math
def simplify_add(val: dict):... |
# -*- coding: utf-8 -*-
"""
Created on Wed Jun 6 19:05:51 2018
@author: nac2313
"""
import time
import numpy as np
import copy
import itertools
from TensorOps import spinops as so
from TensorOps import spintensor as st
exp = np.exp
#Various support functions used throughout the program. Most involve manipulating the... |
#%%
from kdg import kdn
from kdg.utils import get_ece
import openml
import multiprocessing
from joblib import Parallel, delayed
import numpy as np
import pandas as pd
from sklearn.model_selection import StratifiedKFold
from sklearn.ensemble import RandomForestClassifier as rf
from sklearn.metrics import cohen_kappa_sco... |
import datetime
from django.conf import settings
from django.db import models
from django.db.models import Q
from django.urls import reverse
from django.utils.timezone import utc
from django.utils.translation import ugettext_lazy as _
import reversion
from devicegroups.models import Devicegroup
from devicetypes.mode... |
import json
import re
from aiohttp import web
# default versions
GRAPHIQL_VERSION = '0.11.11'
SUBSCRIPTIONS_TRANSPORT_VERSION = '0.8.3' # '0.9.6' already implements connection_parameters, but the fetcher doesn't seem to work with it
REACT_VERSION = '16.2.0'
SUBSCRIPTIONS_FETCHER_VERSION = '0.0.2'
TEMPLATE = '''
<!D... |
from collections import OrderedDict
from runx.logx import logx
import xgboost as xgb
import pandas as pd
import joblib
import os
from pathlib import Path
import argparse
import json
import torch
from models import XGBOOST_FEATURES, EIGENMETRICS
from sklearn.metrics import r2_score
from sklearn.metrics import mean_squa... |
from graphembeddingnetwork import GraphEmbeddingNet
from graphembeddingnetwork import GraphPropLayer
import torch
def pairwise_euclidean_similarity(x, y):
"""Compute the pairwise Euclidean similarity between x and y.
This function computes the following similarity value between each pair of x_i
and y_j: ... |
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.autograd import Variable
from model.utils import initialize_weights
from model.shakeshakeblock import shake_shake, generate_alpha_beta
from model.shakedrop import shake_drop, generate_alpha_beta_single
class SkipConnection(nn.Module):
d... |
import re
import requests
from lxml import etree
from sqlalchemy.orm import sessionmaker
from sqlalchemy import create_engine, and_
from wordparse import Tiku ,mysqlname ,password
import time
engine = create_engine("mysql+pymysql:{0}:{1}//@localhost:3306/tiku".format(mysqlname,password),
encodi... |
from __future__ import absolute_import
from builtins import map
from builtins import str
from . import luqum
from .luqum.parser import parser
from .luqum.utils import LuceneTreeTransformer
from .NED import get_ned_data
from .SIMBAD import get_simbad_data
from .client import client
from astropy import units as u
from as... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.