text stringlengths 6.04k 39.5k |
|---|
import csv
import contextlib
import datetime
import re
import io
import logging
import lxml.html
import os.path
import requests
import rdflib
import pdftableextract as pte
import pical
import yaml
import unicodedata
from email.utils import parsedate
from urllib.request import urlopen
from urllib.parse i... |
import numpy as np
import cantera as ct
import multiprocessing as mp
import matplotlib.pyplot as plt
from cantera_adaptive_testing.iutils import *
import cantera_adaptive_testing.plotter as plotter
import ruamel.yaml, os, warnings
# set plot font computer modern
plt.rcParams['mathtext.fontset'] = 'cm'
plt.rcParams['m... |
""" Cisco_IOS_XR_ncs1k_mxp_oper
This module contains a collection of YANG definitions
for Cisco IOS\-XR ncs1k\-mxp package operational data.
This module contains definitions
for the following management objects\:
hw\-module\: mxp hw\-module command chain
Copyright (c) 2013\-2016 by Cisco Systems, Inc.
All rights ... |
# coding=utf-8
"""
Tests for deepreg/model/layer
"""
import numpy as np
import pytest
import tensorflow as tf
import deepreg.model.layer as layer
def test_activation():
"""
Test the layer.Activation class and its default attributes.
"""
activation = layer.Activation()
assert isinstance(activatio... |
from itertools import combinations
from secrets import randbelow
from buidl.ecc import G, N, S256Point, SchnorrSignature
from buidl.hash import (
hash_challenge,
hash_keyaggcoef,
hash_keyagglist,
hash_musignonce,
hash_tapbranch,
hash_tapleaf,
hash_taptweak,
)
from buidl.helper import (
... |
import os
import json
import datetime
import multiprocessing
import random
import copy
import time
import warnings
import pandas as pd
import numpy as np
from datetime import date, timedelta
from pathlib import Path
from models.common.mit_buildings import MITBuildings
from models.common.to_precision import sig_fig_f... |
#!/usr/bin/env python3
import argparse
import math
import operator
import os
import string
from collections import Counter
from functools import partial
import tensorflow as tf
import tensorflow.contrib.lookup as tfl
import numpy as np
import pandas as pd
# Parse arguments
parser = argparse.ArgumentParser(descripti... |
"""
This module is responsible for generating plots that are involved with statistics about logfiles
"""
import collections
from collections import OrderedDict
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from matplotlib.ticker import MaxNLocator
import plots_helpers as hp
import features_... |
# emacs: -*- mode: python-mode; py-indent-offset: 4; indent-tabs-mode: nil -*-
# vi: set ft=python sts=4 ts=4 sw=4 et:
### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ##
#
# See COPYING file distributed along with the NiBabel package for the
# copyright and license terms.
#
### ### ### #... |
# 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, ... |
# PyQT4 & 5 interface for Iosoft Reporta project
#
# Copyright (c) <NAME> 2018. See iosoft.blog for more information
#
# 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.apa... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# #########################################################################
# Copyright (c) 2020, UChicago Argonne, LLC. All rights reserved. #
# #
# Copyright 2020. UChicago Argonne, LLC. This ... |
import logging
import random
import numpy as np
import pandas as pd
import rasterio as rio
import tensorflow as tf
from PIL import Image
import itertools
import tifffile as tiff
import io
import matplotlib.pyplot as plt
import matplotlib.colors as pltc
import matplotlib.patches as mpatches
import seaborn as sns
from ... |
import random
from asyncio import gather, get_event_loop
from datetime import datetime
import firebase_admin
from aiohttp import ClientSession, TCPConnector, ClientConnectorError
from scrappers import Scrappers
from product import Product
from database import Database
from time import sleep
import os
import json
from c... |
# -*- coding: utf-8 -*-
#################################################################################
# Author : Webkul Software Pvt. Ltd. (<https://webkul.com/>)
# Copyright(c): 2015-Present Webkul Software Pvt. Ltd.
# License URL : https://store.webkul.com/license.html/
# All Rights Reserved.
#
#
#
# This pr... |
# This file is part of the pyMOR project (http://www.pymor.org).
# Copyright 2013-2020 pyMOR developers and contributors. All rights reserved.
# License: BSD 2-Clause License (http://opensource.org/licenses/BSD-2-Clause)
from numbers import Number
import numpy as np
from pymor.core.base import ImmutableObject, abstr... |
#!/usr/bin/env python3
""" Use TGlauberMC to calculate expected path lengths with respect to event plane orientations.
"""
from dataclasses import dataclass
import enlighten
import numpy as np
import os
import logging
from pathlib import Path
import requests
import tarfile
from typing import Any, cast, List
# NOTE:... |
import re
import curses
import config
import time
import api
# 自定义的所有函数
# conf: 从config获取来自默认或者用户定义的配置信息
conf = config.config_info
# cont: 在运行过程中保存关于运行状态以及用于控制的信息
cont = config.control_info
# 全局使用,当前所访问版块的全部内容
thread_list = {}
# 全局使用,当前所访问的串的全部内容
post_list = {}
# TODO:注释
cont['browse_now_list'] = 0
# TODO: 需要把自定义版块,目前... |
# Supplier of Reagents version 0.2
# by DrLecter for the Official L2J Datapack Project.
# Visit http://forum.l2jdp.com for more details.
import sys
from com.l2jfrozen import Config
from com.l2jfrozen.gameserver.model.quest import State
from com.l2jfrozen.gameserver.model.quest import QuestState
from com.l2jfrozen.game... |
import pyomo.environ as pyo
from typing import Dict, Tuple
from time import time
import math
import logging
from tabulate import tabulate
from pyomo.opt import SolverStatus, TerminationCondition
from src.alns.solution import ProblemDataExtended, Solution
logging.getLogger('pyomo.core').setLevel(logging.ERROR)
class ... |
from copy import copy
import numpy as np
import cv2
import cv2.cv as cv
import math
import time
import numpy as np
import scipy.spatial.distance as spsd
def MFTrack(img, bb, ts, oldimg, **kwargs):
"""
**DESCRIPTION**
(Dev Zone)
Tracking the object surrounded by the bounding box in the given
i... |
from __future__ import absolute_import, division, print_function, unicode_literals
from builtins import ascii, bytes, chr, dict, filter, hex, input, int, map, next, oct, open, pow, range, round, str, super, zip
import sys
import numpy as np
import json
import scipy.io
import os
import collections
import config
import... |
# Copyright (c) 2021 SUSE LLC
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of version 3 of the GNU General Public License as
# published by the Free Software Foundation.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; witho... |
import random
import re
import math
from heltour.tournament.team_rating_utils import variance, \
team_rating_variance, team_rating_range
from itertools import combinations
from functools import partial
from multiprocessing import Pool
from django.conf import settings
AVOID_WEIGHT = 1000
FRIEND_WEIGHT = 1
class ... |
#!/usr/bin/env python3
import argparse
import sys
import os
from json import loads
from subprocess import Popen, PIPE
# Holds code regions statistics.
class Summary:
def __init__(
self,
name,
block_rthroughput,
dispatch_width,
ipc,
instructions,
iterations,
... |
import argparse
import os
import signal
from typing import Dict, Optional
import numpy as np
import torch
import torchaudio
from loguru import logger
from torch import Tensor, nn
from torch.optim import Adam, AdamW, Optimizer, RMSprop
from torch.types import Number
from df.checkpoint import load_model, read_cp, write... |
from __future__ import print_function, division, absolute_import
import os
import pytest
import subprocess32 as subprocess
import tempfile
from runner import main as runner
from differ import main as differ, SPLIT_MARKER
from test_utils import get_input_path, get_expected_path, get_temp_file_path
TOOL = 'tx'
CMD = [... |
import sys
import json
from struct import pack, unpack
from os.path import basename, join, isfile
from operator import attrgetter
from collections import defaultdict
import binaryninja as binja
PM = None
vars_and_sizes = {}
class PaperMachete():
def __init__(self):
self.functions = []
class PMFunction():... |
from torch.functional import broadcast_tensors
from tqdm.auto import tqdm
import time
import pandas as pd
import numpy as np
import torch
from rebar import arrdict, dotdict, parallel
from logging import getLogger
from itertools import combinations
from random import shuffle
from multiprocessing import set_start_method
... |
import argparse
from core.data.VOC import SuperpixelLoader
from core.utils import *
from core.model.vgg import *
from core.model.layers_custom import *
import multiprocessing as mp
import pydensecrf.densecrf as dcrf
def norm_score(score):
score = score - score.min()
score /= max(score.max(), 1e-5)
return s... |
import io
import json
import re
import shutil
import zipfile
from datetime import datetime
from os import path
import chardet
from django.conf import settings
from django.contrib import messages
from django.core.files.base import ContentFile, File
from django.db import transaction
from django.http import Http404
from ... |
from ..base import *
from ..button import Button
from ..tooltip import ToolTip
class DialogStandardButton(Button):
def __init__(self, parent, text="", tooltip_text=""):
gfx_ids = Skin.atlas.gfx_ids["dialog_standard_button"]
Button.__init__(self, parent, gfx_ids, text, "", tooltip_text,
... |
from bisect import bisect
from functools import wraps
from types import GeneratorType
from .constants import INF, NEG_INF
def _parse_end(end):
"""Helper for `from_string`. Determines if an endpoint is INF, NEG_INF, int, or float.
"""
if end == 'inf':
return INF
if end == '-inf':
retur... |
import logging
import os
import sys
from argparse import ArgumentParser
import baseline
from torch.nn.parallel import DistributedDataParallel
from torch.utils.data import DataLoader
from eight_mile.utils import str2bool, write_json, Average, Timer, get_num_gpus_multiworker
from baseline.pytorch.embeddings import *
impo... |
# -*- coding: utf-8 -*-
"""
Created on Thu Apr 8 18:33:32 2021
@author: <NAME>
"""
## Final Experiment Watch 7
import os
import numpy as np
import pandas as pd
import librosa
from matplotlib import pyplot as plt
from scipy.fft import rfft, fftfreq
from sklearn.model_selection import train_test_split
f... |
import math
import os
import numpy as np
import time
import torch
import torch.nn as nn
import torch.nn.functional as F
from collections import OrderedDict
from torch.nn.modules.batchnorm import _BatchNorm
# from utils_cuda import _neighbor_query, _spherical_conv
import vgtk
import vgtk.pc as pctk
# import vgtk.cuda.z... |
from __future__ import absolute_import, division, print_function
import os
import math
import matplotlib.pyplot as plt
import numpy as np
import random
import sys
import battleship_utils_py as bscpp
from pydrake.solvers import mathematicalprogram as mp
import pydrake.symbolic as sym
from pydrake.autodiffutils import... |
# -*- coding: utf-8 -*-
import os
import sys
import copy
import math
import logging
import torch
import torchvision
import torch.distributed as dist
from PIL import Image
base_dir = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
sys.path.append(base_dir)
import skeleton
import datasets
... |
"""Build targets for projects."""
import html
import json
import logging
import os.path
import shlex
import subprocess
import webbrowser
from abc import ABC, abstractmethod
from importlib import resources
from pathlib import Path
from shutil import rmtree
from typing import (
Any,
Dict,
Iterable,
List,... |
"""Image metrics.
The key difference between these implementations and those in torchmetrics
is that these metrics support operations on complex data types.
"""
from typing import Optional, Sequence, Union
import numpy as np
import torch
import torch.nn.functional as F
from packaging.version import Version
from med... |
try:
from ase.calculators.gulp import GULP
except ImportError:
from ase.calculators.gulp import Gulp as GULP
import math
import numpy as np
import os
import copy
import sys
import re
import subprocess
import threading
import gulp_calc
import time
import inputs
import itertools as it
import multiprocessing as m... |
from PyQt5.QtWidgets import *
from PyQt5.QtGui import *
from PyQt5.QtCore import *
from graphdebugger.Graph import Graph
from graphdebugger.Graph import GraphScene
import sys
import os
import math
import inspect
import multiprocessing
import importlib
import threading
import tempfile
import pkgutil
from enum import ... |
# Copyright (c) 2016 Mirantis, 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 writin... |
import numpy as np
# pytorch
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
import matplotlib.pyplot as plt
from nitorch.data import show_brain
class _CAE_3D(nn.Module):
'''
Parent Convolutional Autoencoder class for 3D images.
All other Convolutional Auto... |
import constants
import pygame
import menu
import gameobject
from math import ceil
import time
currentMilliseconds = lambda: int(round(time.time() * 1000))
# Setup
pygame.init()
pygame.display.set_caption("Pong")
pygame.mouse.set_visible(0)
class Game:
font = pygame.font.SysFont('Calibri', 25, True, ... |
"""
prepare_api_submission.py
This module defines the Task class and helper methods that are useful for
submitting tasks to the AI for Earth Camera Trap Batch Detection API.
Here's the stuff we usually do before submitting a task:
1) Upload images to Azure Blob Storage... we do this with azcopy, not addressed
i... |
# -*- coding: utf-8 -*-
"""
Created on Sun Sep 12 06:22:24 2021
@author: <EMAIL>
"""
import math as mt
import numpy as np
import matplotlib.pylab as plt
import os
from scipy.constants import hbar, Planck, speed_of_light, Avogadro
csc, hsc, NA, hbarsc = speed_of_light, Planck, Avogadro, hbar # SI un... |
'''
Stresses in a sphere compressed between rigid platens
Model from
HIRAMATSYU, Y., and OKA, Y., 1966, Int. J . Rock Mech. Min. Sci., 3, 89.
With corrections from
<NAME>, <NAME>, <NAME>, <NAME>, <NAME>,
Compression testing spherical particles for strength: Theory of the meridian crack test and implementation f... |
#!/usr/bin/env python
# coding: utf-8
# In[66]:
# Importing necessary packages
import yasara
from yasara import *
import os
import xlsxwriter
# In[68]:
# Using the text mode
info.mode = "txt"
# Turning the yasara console off
Console("Off")
# In[69]:
# Defining the list for storing filenames
res_filename = [... |
import argparse
import os
import torch
import numpy as np
import torch.optim as optim
import json
import time
from torchvision import datasets, transforms
from oracles import DL2_Oracle
from constraints import *
from resnet import ResNet18
from models import MLP, MnistNet
from sklearn.decomposition import PCA
import sy... |
# Copyright (c) 2020 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appli... |
#!/usr/bin/env python
#
# -----------------------------------------------------------------------------
# Copyright (c) 2015-2016 <NAME> <<EMAIL>>
# Copyright (c) 2015-2016 Indiana University
#
# This file is part of genhub (http://github.com/standage/genhub) and is
# licensed under the BSD 3-clause license: see LI... |
"""
Copyright (c) Facebook, Inc. and its affiliates.
"""
import unittest
from droidlet.memory.memory_nodes import (
SelfNode,
PlayerNode,
LocationNode,
ChatNode,
NamedAbstractionNode,
TripleNode,
)
from droidlet.memory.sql_memory import AgentMemory
from droidlet.base_util import Pos, Look, Playe... |
from netdice.common import Flow
from netdice.igp import IgpProvider
from netdice.my_logging import log
class Announcement:
def __init__(self, attrs: list):
"""
Create an announcement with given list of attributes.
LocalPref must be negated such that less is better, so:
attrs = [ -... |
"""
Color Scheme Tweaker (for sublime text).
Licensed under MIT
Copyright (c) 2013 - 2015 <NAME> <<EMAIL>>
"""
from __future__ import absolute_import
import sublime
from .st_colormod import Color
from mdpopups.coloraide import util
import re
NEW_SCHEMES = int(sublime.version()) >= 3150
FONT_STYLE = "font_style" if in... |
#!/usr/bin/env python3
#
# Copyright (c) 2013 <NAME> (Kronuz)
# Copyright (c) 2018 Codethink Limited
#
# 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 l... |
'''
<NAME>
(+) added customized outputs: flow_fwd, flow_bwd, segmentation mask (src/tgt), instance mask (src/tgt)
(+) added recursive_check_nonzero_inst
'''
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.utils.data as data
import numpy as np
from imageio import imread
from path impor... |
""" Module for computing the significant locations using gps data """
import math
from sklearn.cluster import KMeans, DBSCAN
import pandas as pd
import numpy as np
import LAMP
from ..feature_types import primary_feature, log
from ..raw.gps import gps
@primary_feature(
name='cortex.significant_locations',
depe... |
# -*- coding: utf-8
"""
This module is designed to hold implementations of simulation models. The
implementation uses oemof/tespy.
This file is part of project dhnx (). It's copyrighted
by the contributors recorded in the version control history of the file,
available from its original location:
SPDX-License-Identif... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# XTX Extractor
# Version 0.1
# Copyright © 2017 Stella/AboodXD
# This file is part of XTX Extractor.
# XTX Extractor 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 Found... |
"""
eduGrade
========
`eduGrade` is a toolbox for main app, it contains necessary methods that EduGrade page requires.
"""
import re
import os
import psutil
import subprocess32
from functools import partial
from gensim.summarization import keywords, summarize
from kivy.adapters.listadapter import ListAdapter
from ki... |
# Copyright 2017-2018, <NAME>. (<EMAIL>).
# 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 require... |
# -*- coding: utf-8 -*-
"""
Author: YinMo
Version: 2.1.0
Description: support pm and group chat!
"""
import hashlib
import json
import os
import base64
import axolotl_curve25519 as Curve25519
from cryptography.hazmat.primitives.ciphers.aead import AESGCM
from Crypto.Cipher import AES
from Crypto.Util.Padding import pad... |
# -*- coding: utf-8 -*-
# Importing os module for system operative utilities
import os
# Importing SparkSession:
from pyspark.sql.session import SparkSession
# Importing module to delete folders
from shutil import rmtree
# Importing module to work with urls
import urllib.request
# Importing module for regex
import re
#... |
"""
Utilities to work with the various eras of sequence archive files
"""
import collections
import logging
import os
import types
import re
import sys
import six
from six.moves.urllib.parse import urljoin, urlparse
from rdflib import BNode, Literal, Namespace, URIRef
from encoded_client.rdfhelp import (
dump_mode... |
#
# Copyright (c) 2020, Hyve Design Solutions Corporation.
# 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, th... |
"""
This module serves to define a wrapper around the pybullet's URDFBasedRobot
class and to define a new gym class NextroEnv. Both of these were created to
allow reinforcement learning techniques to work with all package, and conform
to the stardard gym environment.
"""
import time
from collections import deque
impor... |
#!/usr/bin/env python
import os,sys
import argparse
from collections import defaultdict,Counter
import time
from time import gmtime, strftime
import numpy as np
import pandas as pd
import math
import scipy.stats
import signal
import multiprocessing
from multiprocessing import Process,Pool,Manager
from itertools import ... |
#!/usr/bin/env python3
import os
import re
import socket
import threading
from struct import pack, unpack
from ctypes import *
from enum import Enum, auto, unique
from . import DebugAdapter
class DEBUG_STATUS(Enum):
NO_CHANGE = 0
GO = 1
GO_HANDLED = 2
GO_NOT_HANDLED = 3
STEP_OVER = 4
STEP_INTO = 5
BREAK = 6
N... |
import json
import logging
import string
import unittest
from pathlib import Path
import matplotlib.pyplot as plt
import pandas as pd
from dash import html
from deepcave.utils.cache import Cache
from deepcave.utils.compression import deserialize, serialize
from deepcave.utils.data_structures import update_dict
from d... |
import os
import itertools
from os.path import dirname, join, basename, exists
from typing import List, Tuple, Callable, Union
import cv2
import numpy as np
from numpy.lib.npyio import save
import pandas as pd
from tqdm import tqdm
from PIL import Image, ImageDraw
from openslide import OpenSlide
from ._functional im... |
"""
This app is an example showing how VariantMap can be utilized in a Dash app.
VariantMap is a genomic structural variant (SV) visualization technique that
displays variants across multiple samples in a single heatmap.
NOTE: This app may not be able to handle large input files (>32M) in Google Chrome.
Do try w... |
"""This file contains code for reaching definitions analysis
and optimization depending on it, e.g. constant propagation, etc."""
import dataclasses
from typing import Dict, Tuple, Any, Optional, List, Set
from Base import ir
from Base import opcode_tab as o
from Base import serialize
from Base import eval
# ir.REG... |
"""
OCCAM
Copyright (c) 2011-2020, SRI International
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 copyright notice, this
list of con... |
"""Simulator for bulk datasets"""
import matplotlib
import matplotlib.pyplot
import torch
import pyro
import anndata
import numpy as np
import pandas as pd
from typing import Dict, Optional
from ternadecov.stats_helpers import NegativeBinomialAltParam
from ternadecov.dataset import SingleCellDataset
from anndata impo... |
#!/usr/bin/env python3
#TODO: fix the row animation
import pygame
import sys
import random
import time
from copy import deepcopy
BOX_SIZE = 20 # how big each square is
SCREEN_WIDTH, SCREEN_HEIGHT = (350, 530)
X_MARGIN, Y_MARGIN = (15, 115) # padding between game board and SCREEN edge
BOARD_WIDTH, BOARD_HEIGHT = (10, ... |
"""
Formatters to alter response output - makes everything look pretty
"""
# Try to enable colorama support if we have it:
try:
import colorama
# Enable colorama:
colorama.init()
except:
# No colorama support, continue
pass
CHAR = '\u00A7' # Format char
OLD = '\u001b'
MAP = {'0': '\033[0m\... |
"""
Some simple logging functionality, vendored from Spinning Up's utilities.
"""
import json
import joblib
import shutil
import numpy as np
import time
import tensorflow as tf
from copy import deepcopy
import os.path as osp, time, atexit, os
from softlearning.policies.safe_utils.mpi_tools import proc_id, mpi_statist... |
## -*- encoding: latin-1 -*-
from numpy import *
from einsum2 import einsum2
from scipy import optimize
import scipy as sc
import pyfftw
import h5py
### Set U, U', J, J' as in parameters file (reduce module dependency)
def Uval_set(u0, JU_ratio):
J = JU_ratio*u0
u0_prime = u0 - 2*J
J_p... |
from django.core.paginator import Paginator, EmptyPage, PageNotAnInteger
from .models import Post, Author, Viewer, Admin, Subscriber
from django.shortcuts import render, get_object_or_404
from django.core.exceptions import PermissionDenied
from django.template.loader import get_template
from django.views.generic import... |
import io
import numpy as np
import sys
import tensorflow as tf
import tensorflow_addons as tfa
import tensorflow_datasets as tfds
def _normalize_img(img, label):
img = tf.cast(img, tf.float32) / 255.
return (img, label)
def get_data(data_type = 'mnist', data_kind='img'):
train_dataset, test_dataset = t... |
import math
import random
import numpy as np
import torch
import utils
import time
import networkx as nx
import scipy.sparse as sp
import MatterSim
class PanoSimulator(MatterSim.Simulator):
""" Simulator that can provide panoramic environment views. """
def __init__(self, args):
super(PanoSimulator,... |
#By <NAME>
#Import the relevant packages/libraries to be used in the program for creating GUI, connecting to database, displaying messages to the user, etc.
from tkinter import *
import tkinter.messagebox as MessageBox #To display messages in the application (for example, indicating that actions on the database ar... |
# Copyright (c) 2016-2017 <NAME>
"""
spark grammar differences over Python 3.1 for Python 3.0.
"""
from __future__ import print_function
from uncompyle6.parser import PythonParserSingle
from uncompyle6.parsers.parse31 import Python31Parser
class Python30Parser(Python31Parser):
def p_30(self, args):
"""
... |
import numpy as np
import math
# class Bezier(object):
# def __init__(self, points: list, smoothness: int):
# self.points = points
# self.smoothness = smoothness
# self.t_all_num = self.smoothness + 2
# self.space = 1 / (self.smoothness + 1)
# self.t_tuple = tuple... |
from __future__ import print_function
import Tkinter as tk
import ttk
import tkFileDialog
import tkMessageBox
import platform
import json
from ..config_check import is_seqlib, is_experiment, is_selection, seqlib_type
from .delete_dialog import DeleteDialog
from .seqlib_apply_dialog import SeqLibApplyDialog
from .edit_d... |
# Copyright The IETF Trust 2020, All Rights Reserved
import datetime
import debug # pyflakes:ignore
from unittest.mock import patch
from django.db import IntegrityError
from ietf.group.factories import GroupFactory, RoleFactory
from ietf.name.models import DocTagName
from ietf.person.factories import PersonFactory
... |
# -*- coding: utf-8 -*-
"""
pygments.lexers.objective
~~~~~~~~~~~~~~~~~~~~~~~~~
Lexers for Objective-C family languages.
:copyright: Copyright 2006-2014 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
import re
from pygments.lexer import RegexLexer, include, bygrou... |
# -*- coding: utf-8; indent-tabs-mode: nil; python-indent: 2 -*-
#
# Copyright (C) 2013-2019 <NAME>
#
# This file is part of WaterOnMars (https://github.com/tibonihoo/wateronmars)
#
# WaterOnMars is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as pub... |
from tkinter import *
class Nokta:
no_say = 1
def __init__(self, x, y):
self.no = Nokta.no_say
self.x = x
self.y = y
Nokta.no_say += 1
def reset(self):
Nokta.no_say = 1
def __repr__(self):
return '%s:(%s,%s)' % (self.no,self.x,... |
from __future__ import annotations
from typing import Optional, Any, Union, List, Iterable, MutableMapping, TypeVar, Type
from pymongo import InsertOne, UpdateOne
from pymongo.collation import Collation
from pymongo.collection import Collection
from pymongo.collection import ReturnDocument
from pymongo.command_cursor... |
from __future__ import print_function
import torch
import torch.nn as nn
import torch.optim as optim
import torch.nn.functional as F
import torch.backends.cudnn as cudnn
import torchvision
import torchvision.transforms as transforms
import itertools
import os
import sys
import time
import argparse
import datetime
impo... |
#!/usr/bin/python
# Copyright: (c) 2019, DellEMC
"""Ansible module for managing access zones on Isilon"""
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
'supported_by':... |
import json
exclude_words = ["import", "raise", "class", "from", "pass", "with", "global", "print", "short", "in", "args"]
types = {"Dictionary": "godot_dictionary", "Variant": "godot_variant", "Array": "godot_array", "String": "godot_string",
"PoolStringArray": "godot_pool_string_array", "Error": "godot_err... |
"""Usage:
This script should be placed with runexp.py.
I recommend to copy two files (this and runexp.py) in each directory where experiments are done.
### Usage 1: Low-level management of QusbWorkflow
# First, define the template qsub file for your experiment.
# In this template, __XXX__ is a placeholder, which wil... |
#!/usr/bin/env python3
# Copyright 2018 CMU and The HuggingFace Inc. team.
#
# 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 abc
import itertools
import typing
import slippy
import numpy as np
import warnings
from collections.abc import Sequence
from .abcs import _MaterialABC
from .influence_matrix_utils import plan_convolve, plan_coupled_convolve, bccg
from ._material_utils import memoize_components
__all__ = ["_IMMaterial", "Rigid"... |
import multiprocessing
import threading
from math import floor, pi
from src.point import Point
from src.quicksort_parallel import QuickSortParallel
from src.quicksort import QuickSort
def find_local_center_with_greatest_radius(cluster_center, radius, potential_centers, points):
###
# The method receives points and ... |
__source__ = 'https://github.com/kamyu104/LeetCode/blob/master/Python/the-skyline-problem.py'
# https://leetcode.com/problems/the-skyline-problem/
# http://www.geeksforgeeks.org/divide-and-conquer-set-7-the-skyline-problem/ //Divide and Conquer
# Time: O(nlogn)
# Space: O(n)
#
# Description: Leetcode # 218. The Skylin... |
"""The text-based ideal point model (TBIP) using Tensorflow 2.0.
Supports training either with model.fit() or iterative training."""
import os
import time
from absl import app
from absl import flags
import numpy as np
import scipy.sparse as sparse
import tensorflow as tf
import tensorflow_probability as tfp
flags.D... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.