text stringlengths 3.07k 12.6k |
|---|
#
# Copyright (C) 2018-2019 <EMAIL>
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, merge, publish,
# di... |
# Copyright cocotb contributors
# Licensed under the Revised BSD License, see LICENSE for details.
# SPDX-License-Identifier: BSD-3-Clause
"""
Tests for concurrency primitives like First and Combine
"""
import re
from collections import deque
from random import randint
from common import _check_traceback
import cocot... |
# Copyright (c) 2021, ESI ITI GmbH, Modelica Association and contributors
#
# Licensed under the 3-Clause BSD license (the "License");
# you may not use this software except in compliance with
# the "License".
#
# This software is not fully developed or tested.
#
# THE SOFTWARE IS PROVIDED "as is", WITHOUT ANY WARRA... |
"""
Run the regression tasks on 2d data, this will train the models
"""
import argparse
import os
import os.path as osp
import time
from data.datasets import DeterministicLotkaVolteraData, CharacterTrajectoriesDataset
from models.neural_process import *
parser = argparse.ArgumentParser()
parser.add_argument('--gpu',... |
# Copyright 2020-2022 Huawei Technologies Co., Ltd
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agre... |
# Copyright 2021 <NAME>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,... |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals
import warnings
from .base import Base
from .crypto import KeyAddress, PrivateKey, PublicKey
from .roles import Role
from .permissions import Permission
from universa.exceptions import UniversaException
from universa.utils import ut, dt
... |
#!/usr/bin/env python3
import unittest
from typing import List
import pytorch_lightning as pl
import torch
import torch.nn as nn
import torch.optim as optim
from reagent.reporting import ReporterBase, CompoundReporter
from reagent.training import ReAgentLightningModule, MultiStageTrainer
from torch.utils.data import ... |
"""Represent the main entry point for the spline loc tool."""
# Copyright (c) 2018 <NAME>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy of this
# software and associated documentation files (the "Software"), to deal in the Software
# without restriction, including without limitation t... |
#!/usr/bin/env python
import numpy as np
import cv2
import os
import pickle
import time
import json
import math
import sys
import matplotlib.pyplot as plt
from rospy_message_converter import message_converter
from geometry_msgs.msg import Pose
import tf_conversions
def read_file(filename):
with open(filename, 'r') a... |
# coding: utf-8
import numpy as np
from files.functions import *
from files.util import im2col, col2im
import gc
class Relu:
def __init__(self):
self.mask = None
def forward(self, x):
print("relu")
self.mask = (x <= 0)
out = x.copy()
del x
gc.collect()
o... |
import time
import tweepy
from tweepy import OAuthHandler
from tweepy.models import Status
import json
import pickle
from multiprocessing import Process
from time import sleep
class StreamListener(tweepy.StreamListener):
def __init__(self, client, applier=None):
"""
:param client:
:param ... |
import re
from threading import Timer
import tweepy
try:
from atri_bot.twitter import config
client = tweepy.Client(bearer_token=config.bearer_token)
client.session.proxies = {"https": config.proxy}
client.session.trust_env = False
except:
print(
"please create config.py in twitter folder ... |
import tensorflow as tf
from ocnn import *
def get_input_signal(octree, depth, channel):
signal = octree_property(
octree, property_name='feature', dtype=tf.float32,
depth=depth, channel=channel)
signal = tf.reshape(signal, [1, channel, -1, 1])
return signal
def get_split_label(octree, depth):
... |
"""Abstractions for gene regions."""
from collections import defaultdict
from Region.region import direction_char
from Region.region import parse_direction_arg
from Region.region import Region
from Region.utils import Color
from utils import insert_in_sorted_list
__author__ = "<NAME>"
class ExonRegion(Region):
"... |
import numpy as np
import pandas as pd
from GridCal.Engine.Simulations.driver_template import DriverTemplate
from GridCal.Engine.Simulations.driver_types import SimulationTypes
from GridCal.Engine.Simulations.results_template import ResultsTemplate
from GridCal.Engine.Simulations.result_types import ResultTypes
from G... |
import os, time
import random
import threading, queue
from flaskr import handyfunctions
from sys import platform
import webbrowser
# The other candidate for notification windows is https://github.com/malja/zroya
import json
from datetime import datetime
import traceback
from flask import current_app
class SettingFile(... |
import sys
import numpy as np
import logging
LOG = logging.getLogger(__name__)
class IntCodeComputer(object):
def __init__(self, stdin=sys.stdin, stdout=sys.stdout):
self.stdin = stdin
self.stdout = stdout
self.relative_base_reg = 0
self.memory = None
self.ip = 0
def ... |
from shinymud.lib.world import World
from shinymud.data.config import AREAS_IMPORT_DIR, AREAS_EXPORT_DIR
from shinymud.lib.sport_plugins import SportError
import os
import re
import traceback
PATH = os.path.abspath(os.path.dirname(__file__))
NAME_REG = re.compile(r'(?P<name>[^_]+)_(?P<type>[^\.]+)\.(?P<format>\w+)')
... |
import six
__all__ = (
'List',
'Tuple',
'Set',
'Dict',
'L',
'T',
'S',
'D',
)
range = six.moves.range
filter = six.moves.filter
class SeqMixin(object):
"""
A basic mixin for all types of collections.
It provides additional methods and changes
collection's behaviour.
... |
import sys
sys.path.insert(0, '../../EMNLP2020')
from Fitting import bm25_fit
import time
import json
from handlers import load_data
import argparse
import os, sys
import datetime
from handlers.output_handler import FileHandler
from setting_keywords import KeyWordSettings
import pandas as pd
def get_query_docs(datapa... |
import os
from typing import Union, Optional, List
from mongoengine import NotUniqueError
from werkzeug.security import generate_password_hash, check_password_hash
from mini_gplus.models import User, Media
from mini_gplus.utils.profiling import timer
from mini_gplus.models import NotifyingAction
from .exceptions import... |
from perlin_noise import PerlinNoise
import matplotlib.pyplot as plt
import random
import json
from moviepy.editor import AudioFileClip, ImageClip
from gtts import gTTS
from PIL import Image, ImageDraw, ImageFont
from Google import Create_Service
from dotenv import load_dotenv
from googleapiclient.http import MediaFile... |
from datetime import datetime
from dateutil.parser import parse
import pytz
import requests
import matplotlib.pyplot as plt
import numpy as np
from matplotlib import dates
from matplotlib import patches
import webbrowser
# (user, pass)
auth = ('kittens', 'rainbows')
def genericFetch(target, cutoff, route):
'''
... |
import os
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2'
import tensorflow as tf
from tensorflow import keras
from sklearn.model_selection import train_test_split
import matplotlib.pyplot as plt
import numpy as np
from resnet import Residual, ResnetBlock
import pandas as pd
from tensorflow.keras import initializers
impor... |
# -*- coding: utf-8 -*-
# Copyright 2020 The Spond 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 ... |
# -*- coding: utf-8 -*-
# Copyright (c) 2021 <NAME> (@briantist)
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import (absolute_import, division, print_function)
from _pytest.fixtures import fixture
from _pytest.python_api import raises
__metaclass__ = typ... |
"""
Gym Environment for Bluelake Compatible with Atari.
## ALE apis those the games should implement :
self.ale = bluelake.pong.GMPong('Pong', 800, 550)
self._action_set = self.ale.getMinimalActionSet()
(screen_width,screen_height) = self.ale.getScreenDims()
reward += self.ale.... |
# Copyright 2017 The Bazel Authors. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable la... |
import bpy
import bmesh
import random
from functools import reduce
def flat_map(array):
return reduce(list.__add__, array)
def do_edges_share_vertex(e1, e2):
return e1.verts[0] == e2.verts[0] or e1.verts[1] == e2.verts[0] or e1.verts[0] == e2.verts[1] or e1.verts[1] == e2.verts[1]
def shared_vert(e1, e2):
... |
# -*- coding: utf-8 -*-
"""
Created on Tue Apr 7 18:36:59 2020
@author: jiayi
"""
# -*- coding: utf-8 -*-
"""
Created on Sat Mar 7 22:38:21 2020
@author: jiayi
"""
import os
import sys
import cv2
import glob
import json
import matplotlib.pyplot as plt
import numpy as np
from numpy import zeros
from numpy import a... |
# Copyright (c) 2016 Shotgun Software Inc.
#
# CONFIDENTIAL AND PROPRIETARY
#
# This work is provided "AS IS" and subject to the Shotgun Pipeline Toolkit
# Source Code License included in this distribution package. See LICENSE.
# By accessing, using, copying or modifying this work you indicate your
# agreement to the S... |
import collections
import datetime
import logging
import numpy as np
import requests
import multiprocessing
from bs4 import BeautifulSoup
from django.core.management.base import BaseCommand
logger = logging.getLogger(__name__)
Station = collections.namedtuple('Station', ['station_id', 'storages', 'station_name'])
S... |
# Copyright 2018 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... |
#==============================================================================
# COMP30027 Machine Learning
# 2017 Semester 1
# Project 2 - Short Text Language Identification
#
# Student Name : <NAME>
# Student ID : 736901
# Student Email : <EMAIL>
#
# project2.py
# Uses a trie-based classifier to predic... |
# -*- coding: utf-8 -*-
import os
import sys
import random
import math
import numpy as np
import skimage.io
import matplotlib
import matplotlib.pyplot as plt
import cv2
import time
from mrcnn.config import Config
from datetime import datetime
# Root directory of the project
start = time.clock()
ROOT_DIR ... |
'''
This script prepares the session-level transcript for au actions
'''
import os
import pandas as pd
pd.__version__
import Python.Data_Preprocessing.config.config as cfg
from tqdm import tqdm
def z_score_per_dev_fold(df, col_name):
# for loop
df_result = pd.DataFrame(columns=["Video_ID", col_name +'_z'... |
import json
import logging
import os
import sys
import time
from pathlib import Path
import numpy as np
from PIL import Image
from tqdm import tqdm
logger = logging.getLogger()
_PROJECT_TYPES = {"Vector": 1, "Pixel": 2}
_ANNOTATION_STATUSES = {
"NotStarted": 1,
"InProgress": 2,
"QualityCheck": 3,
"R... |
"""Train a model to predict XOR output values.
In this example we use LaminarFlow's DatasetWriter to write TensorFlow Examples
to a TFRecord file. Then we use LaminarFlow's DatasetReader to create an
input pipeline for that dataset, and then use it to train a model.
First we create a training dataset and test dataset... |
import logging
import discord
from discord.ext import commands
from utils.paginator import Paginator
log = logging.getLogger(__name__)
class Miscellaneous(commands.Cog):
def __init__(self, bot):
self.bot = bot
@commands.bot_has_permissions(add_reactions=True)
@commands.command(
descri... |
'''mcsimulation.py - Holds the MCSimulation class which interfaces with the
other classes in mcpy to provide a simple interface to run MC simulations.
'''
import numpy as np
class CounterIndex(object):
'''Just a simple counter class that increments when called.'''
def __init__(self):
self._cnt = 0
... |
# -*- coding: utf-8 -*-
# @author <NAME>
# @date 28/07/2019
from __future__ import absolute_import, division, print_function, unicode_literals
import tensorflow as tf
from nets.resnet_v2 import resnet_v2_50, resnet_v2_152, resnet_v2_200
from nets.resnet_v2 import resnet_v2,resnet_v2_block
from nets.mobilenet_v1 imp... |
import os
import torch
from torch.nn.utils.rnn import pad_sequence
import numpy as np
import kaldi_io
# Select kaldi,
if 'KALDI_ROOT' in os.environ:
print(os.environ['KALDI_ROOT'])
if not 'KALDI_ROOT' in os.environ:
# Default! To change run python with 'export KALDI_ROOT=/some_dir python'
print("no KALDI_... |
# coding=utf-8
import asyncio
import hashlib
import json
import logging
import random
import time
import voluptuous as vol
from datetime import timedelta
from homeassistant.components.sensor import PLATFORM_SCHEMA
from homeassistant.const import TEMP_CELSIUS
from homeassistant.helpers.entity import Entity
from homeass... |
"""bug, issue, and ticket extraction tool
A command line tool for interacting with bugs, issues, and tickets from various
trackers in different manners.
"""
import argparse
import concurrent.futures
from functools import partial
import os
from ..argparser import ArgumentParser, parse_file, override_attr
from ..base ... |
import os
import re
import platform
import time
import requests
import json
from requests.exceptions import (
InvalidURL,
Timeout
)
from hashlib import md5
from datetime import date, datetime
from . import __version__
from .errors import (
OpenBankingException,
RequiredFieldException
)
def get(d:... |
# This is the most fragile component of the package so be advised that
# these ARE NOT GENERAL PURPOSE READEDERS
from dolfin import Function, dof_to_vertex_map, warning, Mesh, MeshEditor
import xml.etree.ElementTree as ET
from itertools import dropwhile
from mpi4py import MPI
import numpy as np
try:
import h5py... |
import pytest
from opentrons.trackers.pose_tracker import (
Point, Node, add, descendants, ascend, change_base, max_z,
update, remove, translate, init, ROOT, has_children
)
from numpy import isclose, array, ndarray
def scale(cx, cy, cz) -> ndarray:
return array([
[ cx, 0.0, 0.0, 0], # NOQA
... |
"""
SC101 Baby Names Project
Adapted from <NAME>'s Baby Names assignment by
<NAME>.
YOUR DESCRIPTION HERE
"""
import tkinter
import babynames
import babygraphicsgui as gui
FILENAMES = [
'data/full/baby-1900.txt', 'data/full/baby-1910.txt',
'data/full/baby-1920.txt', 'data/full/baby-1930.txt',
'data/full/... |
import argparse
from io import StringIO
import json
from github import Github
def get_closed_pull_requests():
icevision_repo = g.get_repo("airctic/icevision")
pull_requests = icevision_repo.get_pulls(state="closed")
return pull_requests
def filter_pull_requests(
pull_requests,
start_pull_request... |
from io import StringIO
from unittest.mock import MagicMock, patch
from django.core.management import CommandError, call_command
from django.test import TestCase, override_settings
from gestore.gestore_command import GestoreCommand
from gestore.management.commands.importobjects import Command
class TestImportObject... |
# Unit constants
import math
# All units entered in SI (kg, m, s)
G_SI = 6.674e-11
times_SI = {'s':1.,
'hr':3600.,
'day': 86400.,
'days': 86400.,
'd': 86400.,
'yr':31557600., # Julian year (exact)
'yrs':31557600.,
'jyr':31557600.,
'sidereal_yr':31558149.7635,
'yr2pi':math.sqrt(1495... |
# class Preparation(Document):
# pass
# -*- coding: utf-8 -*-
# Copyright (c) 2021, <NAME> and contributors
# For license information, please see license.txt
from __future__ import unicode_literals
import frappe
import datetime
from frappe.utils import cstr
from frappe.utils import datetime
from frappe.utils import n... |
from .metric import *
from .qmap import *
from fastai.callbacks import *
from fastai.callbacks.hooks import layers_info
def abbreviate(x):
abbreviations = ["", "K", "M", "B", "T", "Qd", "Qn", "Sx", "Sp", "O", "N",
"De", "Ud", "DD"]
thing = "1"
a = 0
while len(thing) < len(str(x)) ... |
# -*- coding: utf-8 -*-
# Define here the models for your spider middleware
#
# See documentation in:
# https://doc.scrapy.org/en/latest/topics/spider-middleware.html
import time
from scrapy import signals
from scrapy.http import HtmlResponse
from selenium import webdriver
class CosmeticsSpiderMiddleware(object):... |
# -*- coding=utf-8 -*-
from __future__ import absolute_import, unicode_literals
import itertools
import resolvelib
import plette
import requirementslib
import vistir
from ..internals.hashes import get_hashes
from ..internals.reporters import StdOutReporter
from ..internals.traces import trace_graph
from ..internal... |
# -*- coding: utf-8 -*-
#
# Developed by <NAME>
# email: <EMAIL>
# Lot's of code reference to Pix2Vox:
# https://github.com/hzxie/Pix2Vox
import cv2
import json
import numpy as np
import os
import random
import scipy.io
import scipy.ndimage
import sys
import torch.utils.data.dataset
from datetime import datetime as... |
import os
import numpy as np
from quantumglare.solvers import quantum_solver
from quantumglare.common import graph, utils
def generate_raw_data(
n_cycles: int,
cycle_length: int,
p_noise: float = None,
n_edges_noise: int = None,
seeds_embedding=list(range(0, 50)),
seed... |
# -*- coding: utf-8 -*-
# Copyright 2018 Cereproc Ltd. (author: <NAME>)
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# THIS CODE IS PROVIDE... |
""" A simple interface to quickly set up and use a :obj:`logger.Logger`
instance.
This module implements methods to quickly set up a :obj:`logger.Logger`
instance with multiple different logging channels. Currently implemented are a
stream logger (to stream) and a file logger (to a log file).::
import logger
... |
import logging
import re
from BeautifulSoup import BeautifulSoup
from monocle.providers import registry, InternalProvider
from monocle.settings import settings
from monocle.signals import pre_consume, post_consume
logger = logging.getLogger(__name__)
class Consumer(object):
"""
Consumers are objects that ... |
import multiprocessing, os,RaspMain, psutil,re
from CommunicationModule import CommunicationModule
conn1, conn2 = multiprocessing.Pipe()
def welcome_message():
print("______ _ _ ___ ______ ___ ___ ___")
print("| ___ \ (_) | | / _ \ | _ \/ _ \ | \/ |")
... |
import random
import copy
class Roller:
def __init__(self, *dice, explode=None, tally_threshold=None, **kwargs):
self.results = None
self.raw_results = None
self.rollable_dice = []
dice_iter = iter(dice)
dice_pairs = zip(dice_iter, dice_iter)
for pair in dice_pairs:... |
import os
import copy
import time
import pickle
import joblib
from numpy import array, mean, broadcast_to, where
from pandas import concat, merge
class InsolverBaseWrapper:
def __init__(self, backend):
"""Base wrapper serving as a building block for other wrappers.
Parameters:
backend... |
""" Functions related to the Twitter API """
from logging.handlers import RotatingFileHandler
import sys
import logging
from time import sleep
from os import environ
import requests
from dotenv import load_dotenv
from ratelimit import limits, sleep_and_retry
from utils import exception_info, get_json_content, get_seco... |
from CSDGAN.classes.image.ImageDataset import ImageFolderWithPaths, ImageFolder
import utils.image_utils as iu
import utils.utils as uu
import CSDGAN.utils.constants as cs
from torch.utils import data
import torchvision
from sklearn.model_selection import train_test_split
import shutil
import torchvision.transforms as... |
import cobra.helper.logging as logging
import requests
import cobra.postgres.interface as pgi
import pandas as pd
import os
class Job():
'''
A job definition for a task that will be executed on a separate pod.
'''
def __init__(self):
self.l = logging.Logger(self)
self.l.debug("NE... |
import json
import requests
import random
import os
import sys
import time
from flask import Flask, request, make_response, render_template, redirect, url_for
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
import src.support.outbound_routing as ob
from src.agent_proc import start_aries
f... |
"""
Base class for Filters, Factors and Classifiers
"""
from numpy import (
empty,
float64,
full,
nan,
)
from weakref import WeakValueDictionary
from zipline.errors import (
InputTermNotAtomic,
TermInputsNotSpecified,
WindowLengthNotPositive,
WindowLengthNotSpecified,
)
from zipline.uti... |
#!/usr/bin/env python3
# Mikrotik Chimay Blue (SMB Buffer Overflow) Exploit by BigNerd95
# [mipsbe version]
# Advisory: https://www.coresecurity.com/advisories/mikrotik-routeros-smb-buffer-overflow
# (CVE-2018-7445)
# Tested on RouterOS 6.38.4 (mipsbe) [using a CRS109]
# Should be vulnerable until 6.41.2
# I could'... |
import torch
import torch.nn as nn
import numpy as np
import torchvision.transforms as T
import itertools
import matplotlib.pyplot as plt
def accuracy(output, target, topk=(1,)):
"""Computes the accuracy over the k top predictions for the specified values of k"""
with torch.no_grad():
maxk = max(topk)
... |
#!/usr/bin/env python
#
# Copyright (C) 2011, 2012 <NAME> <<EMAIL>>
# <NAME> <<EMAIL>>
#
# This file is part of YouCompleteMe.
#
# YouCompleteMe 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 F... |
"""Each ListNode holds a reference to its previous node
as well as its next node in the List."""
"""
What is the difference between an array and a linked list?
Arrays use memory differently.
Arrays store and index elements contiguously.
Each element of linked list is stored in a node.
Each node has... |
"""Provide time related functions."""
__all__ = [
'utcnow', 'localnow',
'as_local', 'as_utc',
'format_utc', 'format_utc_short', 'format_local', 'format_local_short',
'parse_utc', 'parse_local',
'diff_sec',
'format_sec', 'format_sec_fixed', 'format_sec_short',
'job_elapsed_time',
'format_job_count',
'... |
import random
import numpy as np
from numba import jit, njit
import matplotlib.pyplot as plt
import scipy
import scipy.spatial
import time
from typing import Tuple
from prm_NR import adjacency_mat
from matrix_utils import is_primitive
@jit(forceobj=True)
def sample_points(sx, sy, gx, gy, rr, ox, oy, N, bot_size):
... |
# -*- coding: utf-8 -*-
'''
Created on Jul 23, 2014
@author: alexandru-m-g
'''
import ckan.model as model
import logging as logging
import ckan.lib.helpers as h
import ckanext.hdx_theme.tests.hdx_test_base as hdx_test_base
import ckanext.hdx_theme.util.mail as hdx_mail
import ckanext.hdx_org_group.tests as org_group... |
# adapted from:
# https://github.com/pytorch/vision/blob/master/torchvision/datasets/voc.py
import os
import collections
import numpy as np
from PIL import Image
import torch
import torch.utils.data as data
from torchvision.datasets.vision import VisionDataset
import xml.etree.ElementTree as ET
from references.detec... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Functionality for Gaussian random fields.
This file is part of Fieldosophy, a toolkit for random fields.
Copyright (C) 2021 <NAME> <<EMAIL>>
This Source Code is subject to the terms of the BSD 3-Clause License.
If a copy of the license was not distributed with this ... |
import tensorflow as tf
from tensorflow.keras.optimizers import Adam
from tensorflow.keras.metrics import top_k_categorical_accuracy
from tensorflow.keras import layers
from tensorflow.keras.models import Model
from tensorflow.contrib.losses.python.metric_learning import triplet_semihard_loss
import logging
logging... |
import scrapy
from scrapy_selenium import SeleniumRequest
from scrapy.crawler import CrawlerProcess
from twisted.internet.error import ConnectionRefusedError
from urllib.parse import urlparse, urljoin
import logging
import time
import os
import csv
import re
import config, utils
_Logger = logging.getLogger(__name__)... |
"""QtWidgets that can be used as main GUI components for the EDA loop."""
from typing import Tuple
from PyQt5 import QtWidgets, QtCore, QtGui
import pyqtgraph as pg
import numpy as np
from pyqtgraph.graphicsItems.PlotCurveItem import PlotCurveItem
from qimage2ndarray import gray2qimage
from .data_structures import Pa... |
from random import randint
from datetime import datetime
from datetime import timedelta
from baseclass import ERObject
class Person(ERObject):
name = None
gender = None
dob = None
parameters = None
def __init__(self, id, parameters):
super().__init__(id)
self.name = self.names[ran... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import datetime
import re
import socket
from time import mktime
from typing import List, Dict
from urllib.error import HTTPError, URLError
from urllib.request import urlopen
import feedparser
from django.core.management.base import BaseCommand
from reque... |
import smbus
import logging
# Build smbus for Python3
# sudo apt-get install libi2c-dev # install dependency
# wget http://ftp.de.debian.org/debian/pool/main/i/i2c-tools/i2c-tools_3.1.0.orig.tar.bz2 # download i2c-tools source
# tar xf i2c-tools_3.1.0.orig.tar.bz2
# cd i2c-tools-3.1.0/py-smbus
# mv smbusmodule... |
#!/usr/bin/env python
# -*-coding:utf_8-*-
import ConfigParser
import argparse
import logging
import random
import sys
import time
import notification
import sensors
import paho.mqtt.subscribe as subscribe
# Create Logging
logger = logging.getLogger(__name__)
logger.setLevel(logging.DEBUG)
# Define the formatter
fo... |
import copy
from collections import OrderedDict
from fragresp.data_strc import connector
def read_infile(path, option_choices):
option_dict = OrderedDict()
with open(path, 'r') as file:
for line in file:
l = line.rstrip().lstrip().split()
if len(l) == 0:
... |
#!/usr/bin/env python3
"""
Copyright 2017, <NAME>, HKUST.
HSequence evaluation tools.
"""
import os
import glob
import pickle
import random
import cv2
import numpy as np
from utils.opencvhelper import SiftWrapper
class HSeqData(object):
def __init__(self):
self.img = []
self.patch = []
s... |
import jittor as jt
from jittor import nn
from jittor import Module
from jittor import init
from jittor.contrib import concat
# https://github.com/Jittor/segmentation-jittor/blob/master/backbone/mobilenet.py
def conv_bn(inp, oup, stride, BatchNorm):
return nn.Sequential(
nn.Conv(inp, oup, 3, stride, 1, b... |
import configparser
import multiprocessing
import os
import platform
import uuid
import sys
import psutil
from enum import Enum
from testandconquer import __version__, debug_logger
from testandconquer.client import MessageType
from testandconquer.git import Git
CONFIG_SECTION = 'conquer'
ENV_PREFIX = 'CONQUER_'
c... |
import xml.sax
class _Result(object):
"""Representation of a PSM"""
def __init__(self):
self.rank = ''
self.modifications = []
self.sequence = ''
self.experimentalMassToCharge = ''
self.calculatedMassToCharge = ''
self.isDecoy = ''
self.parameters = []
... |
# author: <NAME> <<EMAIL>>
# license: MIT
'''module for implementation utilities'''
import numpy as np
from numba import njit
# constants
DEGREE2_SPHERE = 60**4//100/np.pi
ARCMIN2_SPHERE = 60**6//100/np.pi
ARCSEC2_SPHERE = 60**8//100/np.pi
def restrict_interval(f, x, xmin, xmax):
'''restrict a function to an i... |
"""
Connect4 is an implementation of Connect4 game.
The board is 7x6 and is maintaind using 2D list.
Each block in the board can be player_a or player_b
or empty_block which are represented using 'X', 'O'
and '*' respectively. Winner is determined by checking
4 directions(horizontal, vertical, diagonal(/),
diagonal(\))... |
from json import dumps
from time import time, ctime
from termcolor import colored
from ipaddress import ip_network
from os.path import exists, isfile, join
from os import makedirs, listdir, stat, remove
def checkArgumentValidity(parser, args):
if args.permutation_wordlist and not args.permutate and args.permutation_... |
import re
import uuid
from dataclasses import dataclass
from bin.contentctl_project.contentctl_core.application.factory.object_factory import ObjectFactory, ObjectFactoryInputDto
from bin.contentctl_project.contentctl_core.application.adapter.adapter import Adapter
@dataclass(frozen=True)
class ContentChangerInputD... |
"""
Test PFI, ICE and PD
====================
"""
# Author: <NAME> <<EMAIL>>
# License: new BSD
import numpy as np
import pi_ice_pd as fns
import sklearn.datasets
import sklearn.linear_model
# Load the iris data set
IRIS = sklearn.datasets.load_iris()
IRIS_X = IRIS.data # [:, :2] # take the first two features onl... |
# -*- coding: utf-8 -*-
"""
Created on Thu Mar 10 01:31:46 2022
@author: Sameitos
"""
import numpy as np
from sklearn.ensemble import RandomForestClassifier
from sklearn.svm import SVC
from sklearn.model_selection import RandomizedSearchCV,RepeatedKFold,RepeatedStratifiedKFold
from sklearn.metrics impo... |
"""Errand order module
"""
import os
from errand.util import parse_literal_args, appeval
# NOTE: _header_ should have only one section
# NOTE: Other sections has a list of sections under a same section name
# NOTE: section enable is evaluated at loading the order file
class Section(object):
def __init__(self... |
# -*- coding: utf-8 -*-
#
# || ____ _ __
# +------+ / __ )(_) /_______________ _____ ___
# | 0xBC | / __ / / __/ ___/ ___/ __ `/_ / / _ \
# +------+ / /_/ / / /_/ /__/ / / /_/ / / /_/ __/
# || || /_____/_/\__/\___/_/ \__,_/ /___/\___/
#
# Copyright (C) 2016 Bitcraze AB
#
# Th... |
"""Tests for :mod:`fulltext.process.psv`."""
from unittest import TestCase
from .. import psv
PAULI = """
**<NAME>** is SciPy's Benevolent Dictator For Life (BDFL). He says:
*Truthfully speaking, we could have released a SciPy 1.0 a long time ago, so
I'm happy we do it now at long last. The project has a long histo... |
# Copyright 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.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required b... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.