text stringlengths 3.07k 22.1k |
|---|
# for initial placement, I don't think it's very necessary to define a new class.
# use a seperate module is clean enough
import random, math, os
import block_occupation
import fastSA
from copy import deepcopy
'''
I use occupation grid (the matrix) to present and check if the unit grid is available or
if i... |
#############################################################################
#
# Copyright (c) 2010 by <NAME> and contributors
# All Rights Reserved.
#
# This software is subject to the provisions of the MIT License
# A copy of the license should accompany this distribution.
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT... |
# -*- coding: utf-8 -*-
"""
identity.utils
~~~~~~~~~~~~~~~~~~~
Utils of Flask-Identity
:author: solardiax <<EMAIL>>
:copyright: (c) 2020 by DreamEx Works.
:license: GPL-3.0, see LICENSE for more details.
"""
from datetime import datetime
from urllib.parse import parse_qsl, urlsplit, urlunspli... |
from __future__ import absolute_import, unicode_literals
import os
import pipes
import re
import shutil
import subprocess
import sys
from os.path import dirname, normcase
import pytest
import six
from virtualenv.info import IS_PYPY, WIN_CPYTHON_2
from virtualenv.run import cli_run
from virtualenv.util.path import Pa... |
from collections import OrderedDict
import numpy as np
import tensorflow as tf
import kaggle_environments.envs.halite.helpers as hh
from gym_halite.envs.halite_env import get_scalar_features, get_feature_maps
NETWORKS = {'CartPole-v1': models.get_q_mlp,
'CartPole-v1_duel': models.get_dueling_q_mlp,
... |
'''
This file was cloned from https://github.com/nogueirs/JMLR2018/blob/master/python/stability/__init__.py
The method was propsoed in Nogueira et al. 2017.
Docstring and signatures format were revised to google style.
Reference:
----------
<NAME>., <NAME>., & <NAME>. (2017). On the stability of feature selection alg... |
import math
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.autograd import Variable
import ConfigSpace
from autoPyTorch.components.networks.base_net import BaseImageNet
from autoPyTorch.utils.config_space_hyperparameter import add_hyperparameter, get_hyperparameter
from autoPyTorch.comp... |
from abc import abstractmethod
from collections import OrderedDict
from functools import partial
from typing import List
import numpy as np
import pymc3 as pm
import theano as th
import theano.tensor as tt
from pymc3.variational.updates import get_or_compute_grads
from .. import types
from ..io import io_commons
from... |
import streamlit as st
import numpy as np
import pandas as pd
import joblib
import matplotlib.pyplot as plt
import matplotlib
import seaborn as sns
import plotly.express as px
from PIL import Image
import os
import cv2
#from google.colab.patches import cv2_imshow
import dlib
from skimage import io
import matplotlib.p... |
"""Tests for scandir.walk(), copied from CPython's tests for os.walk()."""
import os
import shutil
import sys
import unittest
import scandir
walk_func = scandir.walk
class TestWalk(unittest.TestCase):
testfn = os.path.join(os.path.dirname(__file__), 'temp')
def test_traversal(self):
# Build:
... |
'''Test functions and SearchEngine class in SearchEngine.py.'''
# With mock replacements, the module does not use any gui widgets.
# The use of tk.Text is avoided (for now, until mock Text is improved)
# by patching instances with an index function returning what is needed.
# This works because mock Text.get does not ... |
# This example implements macroscopic homogenized model of Biot-Darcy-Brinkman model of flow in deformable
# double porous media.
# The mathematical model is described in:
#
#<NAME>., <NAME>., <NAME>.
#The Biot-Darcy-Brinkman model of flow in deformable double porous media; homogenization and numerical modelling.
... |
import os
#import urllib.request as urllib2
import urllib2
from urlparse import urlparse
import gzip
from constants import SECS_IN_DAY, SECS_IN_WEEK
from gps_time import GPSTime
from datetime import datetime
from unlzw import unlzw
import logging as log
def ftpcache_path(url):
p = urlparse(url)
return 'http://ftp... |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright (c) 2013 eBay Inc.
# Copyright (c) 2013 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... |
import time
import signal
import json
from os import makedirs, listdir
from os.path import exists, join, isfile, basename
from shutil import rmtree
from argparse import ArgumentParser
from multiprocessing import Process, Queue
import cv2
from tqdm import tqdm
def ensure_dir_exists(dir_path):
if not exists(dir_pa... |
from itertools import takewhile, product
import numpy as np
import string
# used for doc testing
def letters_25():
"""
>>> letters_25()
array([['A', 'B', 'C', 'D', 'E'],
['F', 'G', 'H', 'I', 'J'],
['K', 'L', 'M', 'N', 'O'],
['P', 'Q', 'R', 'S', 'T'],
['U', 'W', '... |
from pathlib import Path
import keras
from keras.datasets import cifar10, cifar100, mnist
from keras.utils import to_categorical # Does One-hot-encoding
import numpy as np
import pandas as pd
from sklearn.preprocessing import StandardScaler
from ..utils.data import consolidate_bins, crop_center
def load_data(load_... |
import os
import logging
from flask import Flask, g, request, jsonify, render_template, abort
import requests
import captain
import json
import random
import string
import shutil
import time
from combine.graph.type_graph import TypeGraph
logging.basicConfig(level=logging.INFO)
LOG_LVL = logging.INFO
logger = logging.g... |
# import os
import numpy as np
import scipy
import matplotlib.pyplot as plt
from mpl_toolkits.basemap import Basemap, cm
import statsmodels.api as sm
from matplotlib.collections import PatchCollection
from matplotlib.patches import Rectangle
def plotBox(data, labelC=None, labelS=None, colorLst='rbkgcmy', title=None,
... |
# -*- coding: utf-8 -*-
import tensorflow as tf
import tensorflow.keras.backend as K
from decepticon._losses import least_squares_gan_loss, compute_style_loss
from decepticon._losses import total_variation_loss, compute_gradient_penalty
@tf.function
def maskgen_training_step(opt, inpt_img, maskgen, classifier,
... |
import torch
import numpy as np
from loss_functions.ND_Crossentropy import CrossentropyND
from loss_functions.topk_loss import TopKLoss
from torch import nn
def softmax_helper(x):
rpt = [1 for _ in range(len(x.size()))]
rpt[1] = x.size(1)
x_max = x.max(1, keepdim=True)[0].repeat(*rpt)
e_x = torch.exp(... |
import pygame
from pygame.locals import *
import random
import time
pygame.init()
#Variables
frameRate = 20
windowWidth = 1000
windowLength = 800
score = 0
playerX = 20
playerY = 400
startGame = False
global HORIZ_MOV_INCR
HORIZ_MOV_INCR = 10 #speed of movement
# Define some colors
white = (255, 255, 255)
black = (0,... |
# Copyright (c) 2021 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... |
import random
import numpy as np
import tensorflow as tf
Normal = tf.contrib.distributions.Normal
np.random.seed(0)
tf.set_random_seed(0)
class VariationalAutoencoder(object):
#"VAE implementation is based on the implementation from McCoy, J.T.,et al."
#https://www-sciencedirect-com.stanford.idm.oclc.org/science/arti... |
# This file is part of Scapy
# See http://www.secdev.org/projects/scapy for more information
# Copyright (C) <NAME> <<EMAIL>>
# This program is published under a GPLv2 license
# scapy.contrib.description = Enumerator and Automotive Scanner Baseclasses
# scapy.contrib.status = loads
from collections import defaultdict... |
import yaml, requests, random, time, datetime, json, sys
from string import Template
from logger import Logger
from session import Session
from URL import URL
requests.packages.urllib3.disable_warnings()
class Instabot(object):
def __init__(self, config_path, log_file_path=None):
start_time = datetime.datetime... |
from __future__ import absolute_import
from collections import Counter
from collections import OrderedDict
from itertools import chain
import numpy as np
from .enchant_backend import in_dictionary
from .enchant_backend import suggest_words
from .nltk_backend import make_ngrams
from .nltk_backend import calculate_levens... |
# SPDX-License-Identifier: MIT
# Copyright © 2020 <NAME>
"""Utility functions for working with TensorFlow Graphs"""
from __future__ import absolute_import
from collections import defaultdict, namedtuple
from typing import List, Optional, Union
import numpy as np
import tensorflow as tf
from tensorflow.core.... |
# Copyright (c) 2020 zfit
import functools
import math as _mt
from collections import defaultdict
from typing import Any, Callable
import numpy as np
import tensorflow as tf
from ..settings import ztypes
from ..util.exception import BreakingAPIChangeError
from ..util.warnings import warn_advanced_feature
def const... |
import os
import subprocess
from collections import defaultdict
import statistics as st
def get_statistics(times_ns):
diffs = [(item[1] - item[0]) / 1000 for item in list(zip(times_ns, times_ns[1:]))]
return get_statistics_from_diffs(diffs)
def get_statistics_from_diffs(diffs):
the_mean = st.mean(diffs)... |
from __future__ import division
from math import ceil
import numpy as np
import chainer
import chainer.functions as F
from chainer import initializers
import chainer.links as L
from chainercv.experimental.links.model.pspnet.transforms import \
convolution_crop
from chainercv.links import Conv2DBNActiv
from chain... |
"""
Copyright (C) 2020 Intel Corporation
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 wri... |
# -*- coding: utf-8 -*-
'''Library for supportive divers functions'''
__author__ = '<NAME>'
__email__ = '<EMAIL>'
__copyright__ = 'Copyright (C) <NAME>. All rights reserved.'
__license__ = 'MIT License'
__version__ = '0.0.9'
__maintainer__ = '<NAME>'
__status__ = 'Development'
import config ... |
"""A1 - Simulation
This file contains the Simulation class, which is the main class for your
bike-share simulation.
At the bottom of the file, there is a sample_simulation function that you
can use to try running the simulation at any time.
"""
import csv
from datetime import datetime, timedelta
import json
from typi... |
# Copyright (c) ASAPP Inc.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import os
import sys
import fire
import shlex
import subprocess
def run_exp(
model='save/pretrained/wav2vec_small_100h.pt',
batch_scale=1,
lm="nolm-argm... |
from __future__ import absolute_import, division, print_function
import pytest
from blaze.compute.sql import compute, computefull, select
from blaze import SQL
from blaze.expr import *
import sqlalchemy
import sqlalchemy as sa
from blaze.compatibility import xfail
from blaze.utils import unique
t = TableSymbol('t', '... |
import os, torch, random, cv2, math, glob
import numpy as np
from torch.utils import data
from torchvision import transforms as T
from PIL import Image
from torch.nn import functional as F
from collections import defaultdict
import random
import copy
from torch.utils.data.sampler import Sampler
class IdentityCameraS... |
from keras import Model
from keras import models
from keras import optimizers
from keras import Sequential
from keras import layers
from keras import losses
from keras.preprocessing.image import ImageDataGenerator
from keras.optimizers import Adam
import keras.backend as K
import keras.applications
from keras import ap... |
# Licensed under an MIT open source license - see LICENSE
import numpy as np
import pytest
from .. import Dendrogram, periodic_neighbours, Structure
class Test2DimensionalData(object):
def test_dendrogramWithNan(self):
n = np.nan
data = np.array([[n, n, n, n, n, n, n, n],
... |
# coding=utf-8
# Copyright 2020 The Google Research 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 applicab... |
#
# Copyright 2017 <NAME> | Ansible
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# A... |
"""Test Board Group and related classes."""
import pytest
from j5.backends import CommunicationError
from j5.boards.board_group import BoardGroup
from .utils import (
MockBoard,
NoBoardMockBackend,
OneBoardMockBackend,
TwoBoardsMockBackend,
)
def test_create_boardgroup() -> None:
"""Test that w... |
import os
import time
import resource
import numpy as np
import torch as th
from . import logger
from mpi4py import MPI
def rcm(start, stop, modulus, mode="[)"):
"""
Interval contains multiple, where 'mode' specifies whether it's
closed or open on either side
This was very tricky to get right
"""... |
# This challenge is super big, and it's impossible to solve with IDA alone.
# However, we are sure that most of the code is just garbage - you can't have
# a 100-point challenge with that much non-garbage code. Therefore the idea is
# to use GDB along with hardware breakpoints to find out where each byte is
# verified... |
# Author: <NAME>
# Module: Siamese LSTM with Fully Connected Layers
# Competition : Quora question pairs
#packages required
import os
import re
import numpy as np
import pandas as pd
import sklearn
from sklearn.model_selection import train_test_split
from sklearn.metrics import accuracy_score,f1_score,c... |
'''_____Standard imports_____'''
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.widgets import Slider, Button, RadioButtons
'''_____Project imports_____'''
from toolbox.fits import gauss
def dB_plot(data1, data2=None, arguments=None):
fig = plt.figure(figsize=(15, 6))
if data2 is None... |
#
# 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 us... |
import binascii
import hashlib
import json
from logging import getLogger
from time import time
import base58
from bip32utils import BIP32Key
from bitcoin.wallet import P2PKHBitcoinAddress
from coincurve import PrivateKey, PublicKey
from mnemonic import Mnemonic
CONFIG = None
def get_config():
return CONFIG
cl... |
import cirq
import numpy as np
from quchem.Qcircuit.Hamiltonian_term_measurement_functions import change_pauliword_to_Z_basis_then_measure
def Get_state_as_str(n_qubits, qubit_state_int):
"""
converts qubit state int into binary form.
Args:
n_qubits (int): Number of qubits
qubit_state_int ... |
"""Customized panes used by Geo:N:G"""
# Standard library imports
import io
import textwrap
# Third party imports
import pandas as pd
import panel as pn
import param
from bokeh.models.widgets.tables import NumberFormatter
from pyconfs.configuration import Variables
# Geo:N:G imports
from app import config
from app.a... |
# -*- coding: utf-8 -*-
import os
import pickle
from glob import glob
import pdb
import functools
from multiprocessing import Pool
import xml.etree.ElementTree as ET
import cv2
import numpy as np
from tqdm import tqdm
config = {
"exemplar_size":127,
"instance_size":255,
"context_amount":0.5,
"sample_type":"uniform",
... |
# -*- coding: utf-8 -*-
import datetime
from odoo import api, fields, models, _
from odoo.exceptions import AccessError, ValidationError
import odoo.addons.decimal_precision as dp
class catalogos_sat_base(models.Model):
@api.multi
def name_get(self):
res = []
for record in self:
... |
#!/usr/bin/env python
# coding: utf-8
# ## TH_EventReader
#
# This code will load TH events using cmlreaders and then find the missing path data using the log files.
import os
import warnings
import numpy as np
import pandas as pd
from matplotlib import pyplot as plt
from cmlreaders import CMLReader, get_data_index
... |
#hpart = 'horizontal partition', vpart = 'vertical partition'
from numpy import hstack, vstack
def merge_2x2(TL, TR, BL, BR, A):
if TL.shape[0] > 0 and TL.shape[1] > 0:
for i in range(TL.shape[0]):
for j in range(TL.shape[1]):
A[i,j] = TL[i,j];
if TR.shape[0] > 0 and TR.sh... |
from __future__ import annotations
import re
import logging
import pandas as pd
import casparser
import src.constants as ct
import src.utils as ut
from typing import Iterator
from collections import defaultdict
from datetime import datetime
from src.utils import is_valid_date
class PDFParser:
def __init__(s... |
import asyncio
import os
import traceback
from io import StringIO
from random import choice
from typing import Coroutine
import aiohttp
import chess
import chess.engine
from dotenv import load_dotenv
from colorlogs import Color, Logger
from datamodels import APIEvent, BotUser, Game, GameStateEvent
from enums import C... |
# Copyright (c) <NAME>
# Licensed under the MIT License.
from contextlib import ExitStack, contextmanager
from typing import TYPE_CHECKING, Any, Dict, Generator, List, NamedTuple, Optional, Tuple, Union
import torch
from torch import Tensor
import torch.nn as nn
from fairscale.utils.state_dict import replace_by_pref... |
import warnings
import numpy as np
import numpy.testing as npt
import matplotlib
import matplotlib.mlab as mlab
import nitime.timeseries as ts
import nitime.analysis as nta
import platform
# Some tests might require python version 2.5 or above:
if float(platform.python_version()[:3]) < 2.5:
old_python = True
e... |
import numpy as np
import pandas as pd
import requests # Coleta de conteúdo em Webpage
from requests.exceptions import HTTPError
from bs4 import BeautifulSoup as bs # Scraping webpages
from time import sleep
import json
import re #biblioteca para trabalhar com regular expressions - regex
import string
import unidecode... |
# Snake
# by KidsCanCode 2014
# A Pygame snake clone
import pygame
import sys
import random
from os import path
BLACK = (0, 0, 0)
WHITE = (255, 255, 255)
RED = (255, 0, 0)
DARKRED = (155, 0, 0)
GREEN = (0, 255, 0)
DARKGREEN = (0, 155, 0)
DARKGRAY = (40, 40, 40)
BGCOLOR = BLACK
FPS = 15
# WIDTH & HEIGHT need to be mul... |
import os
import numpy as np
import torch
import stanza
import re
from tqdm import tqdm
from pytorch_pretrained_bert import BertModel, BertTokenizer
from text.dependency_relations import deprel_labels_to_id
def read_lexicon(lex_path):
lexicon = {}
with open(lex_path) as f:
for line in f:
t... |
# Copyright 2020 The TensorFlow Probability 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 o... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import requests
import json
import pymysql
import time, datetime
from decimal import Decimal
import sys
import os
import config
import traceback
import struct
url = config.url
connection = pymysql.connect(host=config.host_btca, port=config.port_btca, user=config.user_btca... |
# -*- coding: utf-8 -*-
"""A command line interface for PyKEEN.
Why does this file exist, and why not put this in ``__main__``? You might be tempted to import things from ``__main__``
later, but that will cause problems - the code will get executed twice:
- When you run ``python -m pykeen`` python will execute``__ma... |
#!/usr/bin/env python
#
# Copyright 2013 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.
"""Updates the Chrome reference builds.
Before running this script, you should first verify that you are authenticated
for SVN. You ... |
from flask_api import status
from models.main import *
from models.prescription import *
from sqlalchemy import desc, asc, and_, func
from flask import Blueprint, request
from flask_jwt_extended import (create_access_token, create_refresh_token,
jwt_required, get_jwt_identity)
from .util... |
import json
from urlparse import urljoin
from django.conf import settings
from django.core.urlresolvers import reverse
from django.test.utils import override_settings
import mock
from lxml import etree
from nose.tools import eq_
from pyquery import PyQuery as pq
import mkt.site.tests
from mkt.site.fixtures import fi... |
# =============================================================================
# Copyright (c) 2016, Cisco Systems, Inc
# 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 sour... |
"""
Network Protocol
----------------
This implements the network-facing side of lnsd. There are only two types of
messages, ``ANNOUNCE`` and ``CONFLICT``.
An ``ANNOUNCE`` packet is sent periodically to ensure that a host is still on a
network, and that it is asserting a particular hostname. Other hosts should
record... |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2006-2009 Edgewall Software
# All rights reserved.
#
# This software is licensed as described in the file COPYING, which
# you should have received as part of this distribution. The terms
# are also available at http://genshi.edgewall.org/wiki/License.
#
# This software consist... |
from greenonbrown import green_on_brown
from imutils.video import count_frames, FileVideoStream
import numpy as np
import imutils
import glob
import cv2
import csv
import os
def frame_analysis(exgFile: str, exgsFile: str, hueFile: str, exhuFile: str, HDFile: str):
baseName = os.path.splitext(os.path.basename(exhuF... |
from CommonServerPython import * # noqa: F403
from CommonServerUserPython import * # noqa: F403
import ansible_runner # pylint: disable=E0401
import json
from typing import Dict, cast, List, Union, Any
# Dict to Markdown Converter adapted from https://github.com/PolBaladas/torsimany/
def dict2md(json_block: Unio... |
'''
*****************************************************************************************
*
* ===============================================
* Nirikshak Bot (NB) Theme (eYRC 2020-21)
* ===============================================
*
* This script is to implement Task 1A - Part 1 of... |
import os
import glob
import cmat
import pickle
import math
import collections
from collections import Counter
import numpy as np
import pandas as pd
import sklearn.model_selection
import src.featurizer
def replace_classes(y, replace_dict):
if replace_dict:
return y.replace(replace_dict)
else:
... |
"""Configuration for MeerKAT observatory."""
from __future__ import division
from __future__ import absolute_import
import ephem
import json
import katpoint
import numpy
import os
from datetime import datetime, timedelta
from .simulate import user_logger, setobserver
from .targets import katpoint_target_string
try:... |
import torch
import itertools
import pytest
from piq import InformationWeightedSSIMLoss, information_weighted_ssim
from typing import Tuple, List
from skimage.io import imread
from contextlib import contextmanager
@contextmanager
def raise_nothing(enter_result=None):
yield enter_result
@pytest.fixture(scope='mo... |
# -*- coding: utf8 -*-
import requests, json
import random
__all__ = ["Graph"]
def test_unicode(text):
if type(text) == unicode:
text = str(text)
return text
class Graph:
def __init__(self):
self.url = 'http://localhost:8529'
self.graph_name = 'graph' + str(random.randint(1, 100... |
# -*- coding: utf-8 -*-
"""
Absolute spectral radiance calibration
"""
# Module importation
import os
import time
import string
import deepdish
import h5py
import numpy as np
import skimage.measure
import matplotlib.pyplot as plt
# Other modules
import source.processing as proccessing
from source.geometric_rolloff im... |
# coding: utf-8
import datetime
import glob
import multiprocessing as mp
import os
import queue
import random
import threading
import keras.backend.tensorflow_backend as KTF
import numpy as np
import tensorflow as tf
from keras import backend as K
from keras.applications.resnet50 import preprocess_input
from keras.app... |
from main import absorbdict
# 送信元または宛先IPがAnyかつそのゾーンがUntrust以外の場合そのポリシーはリストに(Any*2)個追加する
# 送信元または宛先IPがVIPかつプロトコルがANYの場合そのポリシーはリストに(該当するVIP)個追加する
service_element_num = 1
src_address_element_num = 1
dst_address_element_num = 1
pre_services = {'"PING"': {"icmp": ''},
'"ICMP-ANY"': {"icmp": ''},
... |
from __future__ import (absolute_import, division, print_function,
unicode_literals)
import six
from jsonschema import validate as js_validate
import warnings
import uuid
import time as ttime
import pandas as pd
from ..utils import sanitize_np, apply_to_dict_recursively
class DatumNotFound(Exc... |
# Copyright 2017 The TensorFlow 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 applica... |
"""
Copyright 2016 Deepgram
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
distri... |
# Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: Apache-2.0
import argparse
import multiprocessing
import time
import random
import os
import matplotlib.pyplot as plt
import matplotlib.patches as patches
import mxnet as mx
import numpy as np
from skimage.draw impor... |
# Copyright (C) 2020 Intel Corporation
#
# SPDX-License-Identifier: MIT
import os
import os.path as osp
import re
from datumaro.components.converter import Converter
from datumaro.components.extractor import (
AnnotationType, Bbox, DatasetItem, Importer, Label, LabelCategories,
SourceExtractor,
)
from datuma... |
#!/usr/bin/env python
"""Making sure we are running the right version of python"""
import sys
if sys.version_info[0] >= 3:
raise "Must be using Python 2"
"""Making sure soar library path environment is set
Remember to set the environment variable to point to where soar build is located, e.g.:
export LD_LIBRARY_PAT... |
import math
from scripts.src.path_following.config import NODE_SIZE
from scripts.src.path_following.destination import Destination
from scripts.src.path_following.movement_mode import MovementMode
class Vectorizer:
def __init__(self, minimize=False):
self.robot_position = None
self.robot_angle = ... |
"""Hierarchically build a multiconformer ligand."""
import argparse
import os.path
import sys
import logging
import time
from itertools import izip
from string import ascii_uppercase
logger = logging.getLogger(__name__)
import numpy as np
from .builders import HierarchicalBuilder
from .structure import Ligand, Struc... |
#!/usr/bin/python
#
# HTTP Authentication: Basic and Digest Access Authentication
#
import traceback
import falcon
import json
import uuid
import time
import re
import base64
import hashlib
import random
from wsgiref.simple_server import make_server
DOMAIN = 'github.com'
USERS = {'admin': '<EMAIL>', 'minh': 'nguyen-h... |
"""Functions that extracts values from text"""
__all__ = ["parse", "parse_expression"]
from typing import Dict, List, Optional, Union
from maha.constants import (
ALL_HARAKAT,
ARABIC,
ARABIC_LETTERS,
ARABIC_LIGATURES,
ARABIC_NUMBERS,
ARABIC_PUNCTUATIONS,
EMPTY,
ENGLISH,
ENGLISH_CA... |
import igraph
import csv
import numpy as np
import timeit
# Function to load the graph from file
def load_graph(path_to_graph_file):
g = igraph.Graph.Read_GraphML(path_to_graph_file)
return g
def construct_igraph(graph):
# 'vertices' contains the range of the vertices' indices in the graph
x = int(np.... |
#!/usr/bin/env python
"""
This script builds a LeNet Convolutional Neural Network (CNN) to predict which artist a painting belongs to within a collection of 10 impressionist painters.
The script tries to structure the code in such a way that it is built to run for this context of impressionist paintings, but could b... |
import sys
# from pylab import *
import seaborn as sns
import math
import matplotlib.pyplot as plt
import matplotlib.animation as animation
import tensorflow as tf
import gym
import numpy as np
import tensorflow.contrib.layers as layers
from gym import wrappers
class Agent(object):
def __init__(self, input_size=4... |
import sys
import os
import collections
import nltk.data
import string
import math
import features
import traceback
import time
import argparse
import nltk.corpus
import nltk.stem.porter
import textClasses as tc
import cluster
import fuzzy
import rules
CUE_PHRASE_FILE = 'bonus_words'
STIGMA_WORDS_FILE = 'stigma_word... |
from conans.errors import RequestErrorException, NotFoundException, ForbiddenException
from conans.server.store.file_manager import FileManager
import os
import jwt
from conans.util.files import mkdir
from conans.model.ref import PackageReference
from conans.util.log import logger
from conans.search.search import searc... |
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... |
# ARM processor definitions 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://w... |
"""
this repository implements canny line
author: github.com/ludlows
2018-04-10
"""
import cv2
import numpy as np
class CannyPF(object):
"""
pass
"""
def __init__(self, gauss_size, vm_grad, img):
"""
initialize parameters and applying gaussian smooth filter to original image
-... |
import numpy as np
import pandas as pd
from models.utility import get_precn
from sklearn.metrics import roc_auc_score
from sklearn.neighbors import NearestNeighbors
from sklearn.neighbors import LocalOutlierFactor
from sklearn.svm import OneClassSVM
from sklearn.ensemble import IsolationForest
from PyNomaly import loop... |
# -*- coding: utf-8 -*-
from gryphon.lib.exchange import exceptions
ALL_EXCHANGE_KEYS = [
'bitstamp_btc_eur',
'bitstamp_btc_usd',
'bitstamp_eth_eur',
'bitstamp_eth_usd',
'bitstamp_eth_btc',
'bitstamp_bch_btc',
'bitstamp_bch_eur',
'bitstamp_bch_usd',
'bitfinex_btc_usd',
'krak... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.