text
stringlengths
3.07k
22.1k
""" Contains : 1. KMeans clustering algorithm implemention 2. Agglomerative clustering algorithm implementation """ import numpy as np ## Note: From here onwards, distance => euclidean distance class KMeans: ''' KMeans Clustering Algorithm * Note : distance => Euclidean distance * ...
import random from collections import namedtuple from enum import Enum import pygame import torch import torchvision.transforms as T from PIL import Image from openRL.AI import DQL from openRL.Agents import Agent from openRL.Memory import ReplayBuffer directions = {"RIGHT": 0, "LEFT": 1, "UP": 2, "DOWN": 3} dir_list...
# --- # jupyter: # jupytext: # formats: ipynb,py:light # text_representation: # extension: .py # format_name: light # format_version: '1.5' # jupytext_version: 1.13.7 # kernelspec: # display_name: Python 3 # language: python # name: python3 # --- # + class PlottingUtils:...
from .dataset import Tabular, download from ..types import RegressionMixin, ClassificationMixin import os, json import requests import pandas as pd import ipdb import csv from datetime import datetime from sklearn.feature_extraction.text import CountVectorizer import machina class Airbnb(Tabular): ''' Any ...
#!/usr/bin/env python # -*- coding: utf-8 -*- import os from os.path import join as buildpath from pentest.manager import JarvisManager from pentest.utils import JarvisLogger from datetime import datetime from slugify import slugify import tty import termios import pty import shlex import sys import signal import subp...
import argparse import numpy as np import torch from torch import optim import pathlib import os import matplotlib.pyplot as plt from datetime import date from unityagents import UnityEnvironment from scripts.agent import SACAgent from scripts import utils os.chdir(pathlib.Path(__file__).parent.absolute()) RESULTS_D...
import numpy as np import warnings from smaug.core import types_pb2 from smaug.core import node_pb2 from smaug.python import global_vars, tensor_utils from smaug.python.ops import common def reorder(input_tensor, target_layout, name="reorder"): """Reorder the data of a given `Tensor` with the target layout. Args...
# -*- coding: UTF-8 -*- """ Transfer learning for feature extracting or finetuning. """ from schnablelab.apps.base import OptionParser, ActionDispatcher, put2slurm from schnablelab.CNN.base import EarlyStopping, image_transforms, initialize_model, train_model_regression from schnablelab.CNN.DatasetReady import Leafc...
#!/usr/bin/env python # # test_ldp_oc_acl_topo1.py # Part of NetDEF Topology Tests # # Copyright (c) 2020 by <NAME> # # Permission to use, copy, modify, and/or distribute this software # for any purpose with or without fee is hereby granted, provided # that the above copyright notice and this permission notice appear ...
"""Dynamic Topic Modelling This file exposes a class that wraps gensim's `DtmModel` to add utils for exploring topics, and it can be run as a script to train and persist a DTM. """ import argparse import datetime import logging import matplotlib.pyplot as plt import numpy as np import os import pandas as pd from colle...
from __future__ import print_function import argparse import sys import torch.optim as optim sys.path.append('./auxiliary/') from auxiliary.dataset_nd import * from auxiliary.ndmodel import * from auxiliary.my_utils import * import os import visdom # =============PARAMETERS======================================== #...
# -*- coding: utf-8 -*- # # Copyright (C) 2018 NU,FSM,GHSL. # # CD2H Repo Project is free software; you can redistribute it and/or modify it # under the terms of the MIT License; see LICENSE file for more details. """Views tests. We have simple, very high-level, view tests here even if the functionality is originally...
import pygame import random import time pygame.init() pygame.display.set_caption('Lights Out') # Keeps tracks of steps taken by the player numSteps = 0 # Displays numSteps onto the screen numStepsText = (pygame.font.Font('freesansbold.ttf', 32)).render('Steps: '+(str(numSteps)), True, [0,0,0]) # The puzzle is solved ...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Thu Jul 1 14:41:43 2021 @author: orram """ #!/usr/bin/env python3 # -*- coding: utf-8 -*- """ added the explore relations part after 735561 """ import os import sys import gc sys.path.insert(1, '/home/labs/ahissarlab/arivkind/imagewalker') sys.path.inser...
import math import torch import torch.nn as nn import torch.nn.functional as F import torch.utils.model_zoo as model_zoo import torchvision.models as models from modeling.sync_batchnorm.batchnorm import SynchronizedBatchNorm2d from modeling.backbone.resnext import ResNeXt101 class Densenet169(nn.Module): def __ini...
# -*- coding: utf-8 -*- import chainer # v0.7.0 で動作確認 import chainerrl from chainerrl import replay_buffer from chainerrl import experiments from chainerrl import links from chainerrl import explorers from chainerrl.q_functions import DistributionalDuelingDQN import gym import random import cv2 import datetime as dt i...
import time from .utils import convert_to_bytes, DictObj import random import hashlib import json from .exceptions import * import requests from enum import Enum, auto class PolygonAPI: def __init__(self, polygon_url, key, secret, pin=None): self.pin = pin self.polygon_address = polygon_url ...
import glob import random import json import os import six import cv2 import numpy as np from tqdm import tqdm from time import time from .train import find_latest_checkpoint from .data_utils.data_loader import get_image_array, get_segmentation_array,\ DATA_LOADER_SEED, class_colors, get_pairs_from_paths from .mo...
r"""Galaxy spectrum module. """ from astropy import units from astropy.io import fits import numpy as np from pkg_resources import resource_filename from skypy.utils.photometry import SpectrumTemplates __all__ = [ 'dirichlet_coefficients', 'KCorrectTemplates', 'kcorrect', ] def dirichlet_coefficients(...
# 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 # dist...
from __future__ import print_function import numpy as np import random import pickle from tqdm import tqdm import os, sys, pdb, math, time import networkx as nx import argparse import scipy.io as sio import scipy.sparse as ssp from sklearn import metrics from gensim.models import Word2Vec import warnings import pickle ...
import json import subprocess import sys from threading import Thread try: from Queue import Queue, Empty except ImportError: from queue import Queue, Empty # python 3.x from events import EventSource from model import TestMethod import pipes def enqueue_output(out, queue): """A utility method for cons...
import functools import tempfile import json import urllib.parse as parse from botocore.exceptions import ClientError import aioboto3 import itertools import ray from typing import Any, Dict, Callable, Optional, List from ray.experimental.workflow.common import StepID from ray.experimental.workflow.storage.base import ...
from PyQt5.QtGui import * from PyQt5.QtWidgets import * from PyQt5.QtCore import * class PushButton(QPushButton): BASE_COLOR = '#202020' HOVER_COLOR = '#505050' PRESS_COLOR = '#707070' def __init__(self, basecolor=BASE_COLOR, hovercolor=HOVER_COLOR, presscolor=PRESS_COLOR): super(PushButto...
"""Implementation of the Operation abstract base class.""" from __future__ import annotations import pathlib from abc import ABC from collections import defaultdict from functools import partial from typing import Callable, Dict, List, Optional, Union from meerkat import AbstractColumn from meerkat.mixins.identifier ...
# Copyright 2018 ICON 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 in writi...
# vim:fileencoding=utf-8:noet from __future__ import (unicode_literals, division, absolute_import, print_function) import os import re import codecs from collections import namedtuple from docutils.parsers.rst import Directive from docutils.parsers.rst.directives import unchanged_required from docutils import nodes ...
#!/usr/bin/env python # -*- coding: utf-8 -*- """ コマンド引数の処理を行います。 """ # Compatible module from __future__ import absolute_import from __future__ import unicode_literals # Buitin module import argparse import inspect import pprint import re import sys import unittest import collections # Global variable __author__ = ...
import torch.nn as nn import torch.nn.functional as F import torch import torch.cuda import onmt import onmt.io import onmt.modules from onmt.Utils import aeq import sys # copied from CopyGeneratorCriterion class RLGeneratorCriterion(object): def __init__(self, vocab_size, force_copy, pad, eps=1e-20): ...
from functools import singledispatch import numbers from loguru import logger from datetime import datetime from typing import Any, Dict, List, Union import numpy as np import pandas as pd from ..indexes import Index, InterpolatingIndex, IntervalIndex, MultiIndex from ..utils import singledispatchmethod from .base im...
# Copyright (c) 2020, <NAME>, Department of Geodesy and Geoinformation. # 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 # no...
import datetime import itertools import os import numpy as np from path import Path from tensorboardX import SummaryWriter from torch.backends import cudnn from torch.utils.data import DataLoader from dvmvs.dataset_loader import MVSDataset from dvmvs.losses import LossMeter, update_losses from dvmvs.pairnet.model imp...
# encoding: utf-8 """ family.py Created by <NAME> on 2010-01-19. Copyright (c) 2009-2017 Exa Networks. All rights reserved. License: 3-clause BSD. (See the COPYRIGHT file) """ from struct import pack from struct import unpack from exabgp.protocol.resource import Resource # =========================================...
#!/usr/bin/env python import os import sys import glob import multiprocessing as mp import numpy as np from sklearn.cluster import AgglomerativeClustering def get_args(): import argparse parser = argparse.ArgumentParser(description='''TrRefine: Refinement of trRosetta outputs''') # Input npz file (outputs...
# Some codes in this file was borrowed from https://github.com/chiphuyen/stanford-tensorflow-tutorials import tensorflow as tf import argparse import time import os import utils import vgg19 def kwargs(): description = "Tensorflow implementation of Image Style Transfer (Neural Style)" parser = argparse.Ar...
#!/usr/bin/env python ''' This code uses the Hokuyo UST-10LX Lidar data obtained thru the racecar package thru scomo.launch to drive the car along a wall to its left. Date: March 29, 2019 ''' # Python imports import numpy as np import time from numpy import pi # ROS imports import rospy from sensor_msgs.msg import La...
#!/usr/bin/env python3 #################################################################################################### # # Author: <NAME> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, e...
# Copyright 2020 Pants project contributors (see CONTRIBUTORS.md). # Licensed under the Apache License, Version 2.0 (see LICENSE). from pathlib import PurePath from textwrap import dedent from typing import Optional import pytest from pants.backend.python.dependency_inference.module_mapper import ( FirstPartyMod...
"""Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the "License"); you may not use this f...
''' Code for downloading and processing KITTI data (Geiger et al. 2013, http://www.cvlibs.net/datasets/kitti/) ''' import os import requests import urllib import numpy as np import hickle as hkl from bs4 import BeautifulSoup # Check scipy version for deprecated imread from scipy import __version__ as ...
# -*- coding: utf-8 -*- """ Created on Mon Dec 9 12:58:43 2019 @author: 0rion """ #%% class PyHealth: """This class initializes 5 methods used for calculating health and fitness metrics""" def __init__(self): self.data= [] def basal_metabolic_rate(): import Ba...
import helpers import re import numpy as np ''' Possible types: header/footer - has_words - is_top_or_bottom - small_text? - n_lines <= 3 body - has_words - normal_word_separation - normal_word_coverage - !overlaps - !small_text -...
#!/usr/bin/python3 # USAGE # python ./src/3.py ./result/vs/canny.jpg ./kernels/kernel.kern result_kernel import matplotlib.pyplot as plt from scipy import misc import numpy as np import hashlib import shutil import cv2 import sys import os def createFolder(directory): try: if not os.path.exists(director...
# -*- coding: utf-8 -*- # Copyright© 1986-2018 Altair Engineering Inc. """Pkr functions for handling the life cycle with k8s""" import base64 import os import shlex import subprocess import sys import yaml import zlib from tempfile import NamedTemporaryFile from time import sleep from pathlib import Path from kuberne...
import pandas as pd import matplotlib.pyplot as plt import numpy as np import random import operator df = pd.read_csv("titanic_medium_b.csv") # ~ df_1 = df # ~ df_2 = df #Drop row 0 from df and create new df df_1 = df.drop(df.index[0]) #Create new df with only rows of Survived with 1 df_2 = df[df.Survived != 0] #R...
import math import numpy as np import tensorflow as tf from tensorflow.python.framework import ops from utils_ import * class batch_norm(object): # h1 = lrelu(tf.contrib.layers.batch_norm(conv2d(h0, self.df_dim*2, name='d_h1_conv'),decay=0.9,updates_collections=None,epsilon=0.00001,scale=True,scope="d_h1_...
def tabulate(text): return '\n'.join([' ' + i for i in text.split('\n')]) class Assignment: def __init__(self, op, lvalue, rvalue): self.op = op self.lvalue = lvalue self.rvalue = rvalue def __str__(self): return '{} {} {}'.format(str(self.lvalue), self.op, str(self.rval...
###################################################################### # Author: Dr. <NAME> <NAME>, <NAME> # Username: heggens alfarozavalae, jamalie # # Assignment: A08: UPC Barcodes # # Purpose: Determine how to do some basic operations on lists # ###################################################...
"""Tests for graph.py.""" import contextlib import os import sys import unittest from importlab import environment from importlab import fs from importlab import graph from importlab import parsepy from importlab import resolve from importlab import utils class FakeImportGraph(graph.DependencyGraph): """An Impo...
#!/usr/bin/env python # # Copyright (C) 2013 <NAME> <<EMAIL>> # # 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, # t...
import copy from functools import partial import networkx as nx import numpy as np from scipy.spatial.distance import cosine def get_kernel_func(kernel_func_name: str): if kernel_func_name == 'features': return partial(features_kernel, measure='cos') if kernel_func_name == 'features_dot': re...
# Copyright 2019 The ROBEL Authors. # # 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 wr...
# -*- coding: utf-8 -*- """ :Module: khorosjx.spaces :Synopsis: Collection of deprecated functions relating to spaces/places :Usage: ``import khorosjx.spaces`` :Example: ``space_info = khorosjx.spaces.get_space_info(1234)`` :Created By: <NAME> :Last Modified: <NAME> ...
import pygame BLACK = ( 0, 0, 0) WHITE = ( 255, 255, 255) GREEN = ( 0, 255, 0) RED = ( 255, 0, 0) BLUE = (0, 0, 255) width = 30 height = 30 turn = 0 winner = 0 margin = 5 def empty_grid(): #creating a 2-D array # that is simply a list of lists grid = [] for row in range(7): #add an empty array that will hold...
from __future__ import print_function from __future__ import division import numpy as np import csv from scipy.ndimage.filters import gaussian_filter1d import os import file_namer import spectrum_functions as specfun import sys from scipy import stats def open_csv(filename, mode='r'): """Open a csv file in proper ...
import re def my_hash(_o): val = 0 for c in bytes(_o, encoding="ascii"): val *= 7 val += int(c) return val def str_list_hash(o): var = 0 for _ in o: var *= 7 var += my_hash(_) return var def unordered_list_hash(o): var = 0 for _ in o: var += ...
import numpy as np import pandas as pd import pytest import tensorflow as tf from probflow.distributions import Bernoulli, Normal from probflow.utils import metrics def is_close(a, b, tol=1e-5): return np.abs(a - b) < tol def test_as_numpy(): """Tests probflow.utils.metrics.as_numpy""" @metrics.as_num...
import itertools import numpy as np import torch from torch import nn def is_recurrent(layer): """Return True iff a given layer is recurrent and supported by PFRL. Args: layer (callable): Any callable object. Returns: bool: True iff a given layer is recurrent and supported by PFRL. ...
"""File wrapping sync related functions, You will see that this files uses the workspace repo/org and the github repo/org together with the raw Api of git for example. We are aware this is not the best design and ideally all git calls should be hidden within the workspace module but we chose to be pragmatic for the...
import gdspy import numpy import inspect import numpy as np import spira from copy import deepcopy from spira import param from spira.gdsii.elemental.port import __Port__ from spira.gdsii.elemental.port import Port from spira.core.initializer import ElementalInitializer from spira.core.mixin.transform import Tranforma...
# !/usr/bin/env python3 class Resume: """ Hello, Thank you for taking the time to review my application :) The first part of the document defines all the functions I need to enter all the relevant information about my application. If you are not interested in this technical part, you can jump ...
# -*- coding: utf-8 -*- # pylint: disable=all """ pytests for multi year resource handlers """ import numpy as np import os from pandas.testing import assert_frame_equal import pytest from rex import TESTDATADIR from rex.multi_file_resource import MultiH5Path from rex.multi_year_resource import (MultiYearH5, MultiYear...
# -*- coding: utf-8 -*- from screen_god.messages import t DEBUG_STR = '{:>12}: {}' class AbstractItem(object): __instances = {} def __get_item_size(self, base_size): value, unit = self.size() if unit is None: item_count = self.layout().item_count() return int(value...
import copy from operator import or_ from django.conf.urls.defaults import * from django.http import HttpResponse, Http404 from django.template import RequestContext from django.template.loader import select_template from django.core.urlresolvers import reverse from django.db.models import Q from things.fields import B...
from __future__ import print_function import sys import os import argparse import torch import torch.nn as nn import torch.backends.cudnn as cudnn import torchvision.transforms as transforms from torch.autograd import Variable from data import WIDERFace_ROOT , WIDERFace_CLASSES as labelmap from PIL import Image from da...
""" Test module. Tests the whole system as a black box. """ import os import io, shutil from six.moves import getcwd import pytest from chatette.parsing.parser import Parser from chatette.units.ast import AST from chatette.generator import Generator from chatette.adapters import RasaAdapter, JsonListAdapter class ...
from __future__ import annotations try: import ujson as json except ImportError: import json # type: ignore import os import tempfile from typing import Any import awkward._v2 as ak import fsspec import pytest from dask.base import is_dask_collection from ..core import Array, Scalar, from_awkward from ..io...
""" Vision systems calibration using a chessboard calibration object """ import cv2 import numpy as np from .geometry import rvec_to_rmat from .geometry import triangulate_points findcbc_flags = { 'default': cv2.CALIB_CB_ADAPTIVE_THRESH + cv2.CALIB_CB_NORMALIZE_IMAGE, 'at_or_fq': cv2.CALIB_CB_ADAPTIVE_THRESH ...
import os import cv2 import numpy as np from tqdm import tqdm from flask import Flask, render_template, Response from yolo.utils import yolo from common.body_parts import BODY_PARTS_BODY_25 from common.body_parts import BODY_PARTS_COCO from common.body_parts import BODY_PARTS_MPI from common.pose_pairs import POSE_PAIR...
from pecos.utils import index_to_datetime import matplotlib.pyplot as plt import datetime as dt from mhkit import qc import pandas as pd import numpy as np _matlab = False # Private variable indicating if mhkit is run through matlab def get_statistics(data,freq,period=600,vector_channels=[]): """ Calculat...
# -*- encoding: utf-8 -*- # # # Copyright (C) 2011 <NAME> <<EMAIL>> # Copyright (C) 2009-2011 <NAME> <<EMAIL>> # # This file is part of PyX (http://pyx.sourceforge.net/). # # PyX 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 Sof...
#!/usr/bin/env python # -*- coding: utf-8 -*- from __future__ import absolute_import from __future__ import print_function from __future__ import division import paddle import paddle.fluid as fluid import numpy as np from zhusuan.distributions.base import * import unittest device = paddle.set_device('gpu') paddle.di...
"""Knows about command structure, argument parsing, defaults, and checks.""" import argparse import os, os.path import re import typing as tg import pmlv.base as base description = "PowerPoint-based maintainable lecture videos tool" projectsite = "https://github.com/prechelt/pomalevi" def process_args(get_videores...
# Copyright (c) 2016-2017, <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 the foll...
# -*- coding: utf-8 -*- """ Tencent is pleased to support the open source community by making 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition) available. Copyright (C) 2017-2019 THL A29 Limited, a Tencent company. All rights reserved. Licensed under the MIT License (the "License"); you may not use this file except in co...
#!/usr/bin/env python3 import base64 import json import logging import os import re import argparse import yaml from collections import namedtuple from multiprocessing import Pool from pathlib import Path from typing import List, Optional import nbformat from nbclient import NotebookClient import traceback ROOT_PAT...
# -*- coding: utf-8 -*- """Addressbook functionality License: See LICENSE file. """ import abc import logging from .html_colors import get_random_color from .models import Recipient from .versioninfo import VersionInfo class Addressbook(metaclass=abc.ABCMeta): """Abstract class that store contacts and groups...
# -*- coding: utf-8 -*- """ Tencent is pleased to support the open source community by making BK-BASE 蓝鲸基础计算平台 available. Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. Licensed under the MIT License (the "License"); you may not use this file except in compliance with the License. You may o...
""" fit go no go task with external data (not simulated) This code is a work in progress. Not complete. """ import sys, os import numpy as np import pandas as pd import stan import arviz as az import nest_asyncio nest_asyncio.apply() from matplotlib import pyplot as plt import seaborn as sns sys.path.append('.') from ...
############################################################################## # # Copyright (c) 2002 Zope Foundation and Contributors. # # This software is subject to the provisions of the Zope Public License, # Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution. # THIS SOFTWARE IS PROVIDED "AS I...
# # <NAME>, November 2020 # import argparse import os import sys import logging import tables from ph5.core import ph5api, experiment, columns from ph5.utilities import nuke_table, kef2ph5 as K2T, tabletokef as T2K from ph5 import LOGGING_FORMAT PROG_VERSION = '2021.159' LOGGER = logging.getLogger(__name__) def ge...
# Copyright 2018 <NAME>. 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. # A copy of the License is located at # # http://www.apache.org/licenses/LICENSE-2.0 # # or in the "license" file accompanying this fil...
""" Utility functions for training one epoch and evaluating one epoch """ import torch import torch.nn as nn import math import dgl from train.metrics import accuracy_SBM as accuracy from train.metrics import accuracy_ogb """ For GCNs """ def train_epoch_sparse(model, optimizer, device, data_loader, epoc...
""" This module provides a name_to_constructor dict for all models/estimators in scikit-learn, plus a couple test models and error handling functions """ import warnings import inspect import sklearn.base import sklearn.utils.testing import joblib import numpy as np import os # Sometimes xgboost is hard to install s...
from PySide2 import QtWidgets, QtGui import maya.cmds as cmds import maya.mel as mel import os from maya.app.general.mayaMixin import MayaQWidgetDockableMixin class GroupText(QtWidgets.QWidget): """Group text create a line edit inside a groupbox""" def __init__(self, label, text="", placeHolderText="", p...
''' Library for Google Sheets functions. ''' from constants import * from googleapiclient.discovery import build from google_auth_oauthlib.flow import InstalledAppFlow from google.auth.transport.requests import Request import pickle import os import pandas as pd import re def read_values(sheetid, range_, config): ...
#!/usr/bin/env python # # win_repo_bench.py: run repository / server performance tests on Windows. # # Subversion is a tool for revision control. # See http://subversion.apache.org for more information. # # ==================================================================== # Licensed to the Apache Software Foun...
from . import CommandExecuterBase, DEFAULT_TIMEOUT_IN_SEC, SCSIReadCommand, SCSIWriteCommand from . import SCSI_STATUS_CODES from . import gevent_friendly from .errors import AsiSCSIError, AsiRequestQueueFullError from ctypes import * from logging import getLogger logger = getLogger(__name__) """ from /usr/include/sy...
import json import os import argparse import pandas as pd from tqdm import tqdm from gzreduction.panoptes.api import api_to_json from gzreduction import settings from pyspark.sql import SparkSession from pyspark.sql.functions import udf, lit from pyspark.sql.types import ArrayType, MapType, FloatType, StructType, ...
#!/usr/bin/env python """ Command line interface for running createdem """ import sys import glob import os import json import argparse from argparse import ( ArgumentError, ArgumentParser, ArgumentTypeError, FileType, RawTextHelpFormatter, ) import subprocess # from osgeo import gdal PATH = os.pa...
# -*- coding: utf-8 -*- """Operator controller.""" from datetime import datetime from sqlalchemy.exc import InvalidRequestError, ProgrammingError from werkzeug.exceptions import BadRequest, NotFound from ..database import db_session from ..models import Operator, Task from .parameters import list_parameters from .dep...
from builtins import range import sys sys.path.insert(1, "../../../") import h2o from tests import pyunit_utils from h2o.estimators.glm import H2OGeneralizedLinearEstimator def test_beta_constraints_binomial(): # binomial h2o_data = h2o.import_file(pyunit_utils.locate("smalldata/glm_test/binomial_20_cols_10K...
# Copyright 2020 The Cirq Developers # # 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 ...
from enum import Enum from typing import List import random class Color(Enum): NONE = 0 RED = 1 BLUE = 2 @property def opposite(self): if self is Color.NONE: return self elif self is Color.RED: return Color.BLUE else: return Color.RED ...
# -*- coding: utf-8 -*- from __future__ import unicode_literals import json from collections import OrderedDict import mock import pytest from thriftpy2.protocol.binary import read_list_begin from thriftpy2.protocol.binary import TBinaryProtocol from thriftpy2.transport import TMemoryBuffer from py_zipkin import Enc...
import os import subprocess import traceback from conans import ConanFile, tools from enum import Enum class ConanPackageHelper: class ArchVariations(Enum): WIN10_X86_64_VARIATION = "win10_x86_64" MACOSX_ARM64_VARIATION = "macosx_arm64" MACOSX_X86_64_VARIATION = "macosx_x86_64" MA...
import collections import colorsys import math """Colors, color manipulation and conversions, color maps calculations.""" class Color: """Base class for Color implementations in different color models.""" __slots__ = () @classmethod def from_values(cls, values, alpha=1.): raise NotImpleme...
# This file is for use with Scapy # See http://www.secdev.org/projects/scapy for more information # Copyright (C) Airbus DS CyberSecurity # Authors: <NAME>, <NAME>, <NAME> # This program is published under a GPLv2 license """Bluetooth 4LE layer""" import socket import struct from scapy.compat import orb, chb from sc...
# Copyright 2018 Amazon.com, Inc. or its affiliates. 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. A copy of the License # is located at # # http://aws.amazon.com/apache2.0/ # # or in the "license" file acc...
import os import json import re ### util def read_json(path): with open(path,'r') as f: return json.load(f) def write_json(path, value): with open(path,"w") as f: json.dump(value, f, sort_keys=True, indent=4) def group_map(l,f): res = {} for it in l: k,v = f(it) if k not in res: res[k] = []...