content stringlengths 5 1.05M |
|---|
from dbnd._core.cli.click_utils import _help
from dbnd._core.cli.service_auto_completer import completer
from dbnd._core.task_build.task_registry import get_task_registry
from dbnd._vendor import click
@click.command()
@click.argument("search", default="", autocompletion=completer.config())
@click.option("--module", ... |
# Copyright 2016 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.
"""The page cycler v2.
For details, see design doc:
https://docs.google.com/document/d/1EZQX-x3eEphXupiX-Hq7T4Afju5_sIdxPWYetj7ynd0
"""
from core import pe... |
from typing import List
from machine.params import Parameters
from machine.plugin import Plugin
from machine.connection import Connection
from machine.plugin import PluginGenerator, PluginResult
class Sequence(Plugin):
def __init__(self, plugins: List[PluginGenerator]):
assert len(plugins) > 0, "Sequence... |
# You are given N pairs of numbers.
# In every pair, the first number is always smaller than the second number.
# A pair (c, d) can follow another pair (a, b) if b < c.
# Chain of pairs can be formed in this fashion.
# You have to find the longest chain which can be formed from the given set of pairs.
dp = [[0]*10... |
""" This is the geo_mean atom.
geo_mean(x,y) = sqrt(x * y)
If either x or y is a vector, the atom is applied elementwise.
It is a CONCAVE atom. It is DECREASING in the first argument, and
DECREASING in the second argument.
It returns a SCALAR expression if the both arguments are SCALAR.
... |
import torch
__TESTS__ = { }
def get_tests():
for k, v in __TESTS__.items():
yield k, v
def register(test):
name = getattr(test, "__name__", test.__class__.__name__)
if name in __TESTS__:
raise RuntimeError(f'Encountered a test name collision "{name}"')
__TESTS__[name] = test
retu... |
from os import path
from glob import glob
from cStringIO import StringIO
import numpy as np
import h5py
from scipy.sparse.csgraph import connected_components
from scipy.sparse import csr_matrix
from util import sort_nicely, veclen, filter_reindex
def convert_sequence_to_hdf5(filename_pattern, loader_function, hdf_ou... |
# This script created by Joseph Aaron Campbell - 10/2020
# this script references https://www.agisoft.com/forum/index.php?topic=10564.msg47949#msg47949
# Use this as a learning tool only.
# I am not responsible for any damage to data or hardware if the script is not properly utilized.
# Following Code tested and ba... |
load("//tools/bzl:maven_jar.bzl", "maven_jar")
AWS_SDK_VER = "2.16.19"
AWS_KINESIS_VER = "2.3.4"
JACKSON_VER = "2.10.4"
def external_plugin_deps():
maven_jar(
name = "junit-platform",
artifact = "org.junit.platform:junit-platform-commons:1.4.0",
sha1 = "34d9983705c953b97abb01e1cd04647f4727... |
import collections
from typing import List
from thinglang.lexer.values.identifier import Identifier, GenericIdentifier
from thinglang.symbols.merged_symbol import MergedSymbol
from thinglang.symbols.symbol import Symbol
from thinglang.utils import collection_utils
class SymbolMap(object):
"""
Describes a sym... |
# encoding:utf-8
from numpy import *
import math
import copy
import pickle
class C4_5DTree(object):
def __init__(self): # 构造方法
self.tree = {} # 生成的树
self.dataSet = [] # 数据集
self.labels = [] # 标签集
def loadDataSet(self, path, labels, split):
recordlist = []
with open... |
import logging
import subprocess
import sys
class Spotify():
def __init__(self, args):
logging.info("Spotify Connect client started.")
command = "spotifyd --no-daemon"
self.process = subprocess.Popen(command, shell=True)
def stop(self):
self.process.kill()
l... |
# Copyright (c) 2016 Anki, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License in the file LICENSE.txt or at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable... |
# -*- coding: utf-8 -*-
from django.conf.urls import url, include
from django.contrib.auth.decorators import login_required
from children.views import ChildrenTemplateView, ChildrenDetailView, ChildrenUpdateView
from children.views import ChildrenCreateView, ChildrenDeleteView, ChildListJson
urlpatterns = [
ur... |
from biosimulators_utils.model_lang.bngl.validation import validate_model, read_model
from biosimulators_utils.utils.core import flatten_nested_list_of_strings
import os
import shutil
import tempfile
import unittest
class BgnlValidationTestCase(unittest.TestCase):
FIXTURE_DIR = os.path.join(os.path.dirname(__file... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# king_phisher/security_keys.py
#
# 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, th... |
import sys
nodes = []
class node:
value = -1
visited = False
dist = 2e30
prev = None
idx = -1
neighbors = []
def __init__(self, v):
self.value = v
def getNeighbors(x,y,input):
result = []
if y>1:
result.append(input[y-1][x])
if y+1<len(input):
result.ap... |
#!/usr/bin/env python
from distutils.core import setup
setup(name='Ignition',
version='0.1.8',
description='Run multiple programs in a specific order and monitor their state',
author='Luka Cehovin',
author_email='luka.cehovin@gmail.com',
url='https://github.com/lukacu/ignition/',
packages=['ignition'],
scripts... |
from ..class_boids import Boids
import numpy as np
from nose.tools import assert_equal,assert_almost_equal
import os
import yaml
def init_trial_boids():
pathtofile = 'fixtures/regression_fixtures.yml'
data=yaml.load(open(
os.path.join(os.path.dirname(__file__),pathtofile)))
pos_start = [data['befor... |
# Copyright (c) 2014-2018, F5 Networks, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed ... |
import numpy as np
import torch
from net import Net
from generator import Generator
import utils
EPOCHS = 100000
BATCH_SIZE = 32
LR = 1e-3
LR_STEP = 0.1
LR_FAILS = 3
SIZE = (40, 40)
MARGIN = 1
NOISE = 0.1
MAX_LENGTH = 5
DEVICE = torch.device('cuda' if torch.cuda.is_available() else 'cpu')
np.set_printoptions(thr... |
# в разработке
class NavigationHelper:
def __init__(self, app):
self.app = app
def open_home_page(self):
wd = self.wd
# open home page
wd.get("http://localhost/adressbook/group.php")
def open_group_page(self):
wd = self.wd
# open group page
wd.find_... |
"""ReBias
Copyright (c) 2020-present NAVER Corp.
MIT license
Implementation for simple statcked convolutional networks.
"""
import torch
import torch.nn as nn
class SimpleConvNet(nn.Module):
def __init__(self, num_classes=None, kernel_size=7, feature_pos='post'):
super(SimpleConvNet, self).__init__()
... |
import tensorflow as tf
import numpy as np
class Convolutional_NN(object):
def __init__(self):
pass
def lr_network(self, input_shape, label_shape):
"""
Create loss function and the list of metrics
Arguments:
input_shape: [list / tuple] input shape
... |
# -*- coding: utf-8 -*-
"""
Created on Sat Feb 06 15:07:49 2016
@author: Mike
"""
from __future__ import division
import pandas as pd
import numpy as np
import matplotlib.lines as mlines
import matplotlib.pyplot as plt
from matplotlib.legend_handler import HandlerLine2D
import os
from geopy.distance import vincenty
fr... |
# Copyright (c) Facebook, Inc. and its affiliates. (http://www.facebook.com)
a.b -= 2
a[0] += 1
a[0:2] += 1
|
import re
class JSVM(object):
_memory = {}
_program = []
_js_methods = {}
def __init__(self, code=""):
# TODO: parse automatically the 'swap' method
# function Bn(a,b){var c=a[0];a[0]=a[b%a.length];a[b]=c;return a};
def _swap(args):
a = list(args[0])
b... |
#!/usr/bin/python
"""
entry point
"""
import datetime
import traceback
import six
import tempfile
import io
import signal
import json
import gzip
# config file
from pandaserver.config import panda_config
from pandaserver.taskbuffer.Initializer import initializer
from pandaserver.taskbuffer.TaskBuffer import taskBu... |
# -*- coding: UTF-8 -*-
#!usr/env/bin python 3.6
from matplotlib.font_manager import FontProperties
import matplotlib.lines as mlines
import matplotlib.pyplot as plt
import numpy as np
def file2matrix(file_name):
file = open(file_name)
array_lines = file.readlines()
number_of_lines = len(array_lines)
... |
# Copyright (c) 2022 Manuel Olguín Muñoz <molguin@kth.se>
#
# 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... |
# Copyright (c) 2020 Graphcore Ltd. All rights reserved.
import torch
import poptorch
# half_stats_begin
model = torch.nn.Sequential()
model.add_module('lin', torch.nn.Linear(16, 16))
model.add_module('bn', torch.nn.BatchNorm1d(16))
model.float()
opts = poptorch.Options()
opts.Precision.runningStatisticsAlwaysFloat(... |
# Generated by Django 2.2.24 on 2022-02-24 22:20
from django.db import migrations
def commit_old_currencies_deactivation(apps, schema_editor):
Currency = apps.get_model("exchange", "Currency")
db_alias = schema_editor.connection.alias
Currency.objects.using(db_alias).filter(code__in=["MRO", "VEF"]).update... |
#! /usr/bin/python
#
# xindice_python_delete.py
#
# Apr/13/2012
#
import math
import cgi
import string
import sys
import os
import xml.dom.minidom
import pycurl
#
import json
# ------------------------------------------------------------------
sys.path.append ('/var/www/data_base/common/python_common')
#
from text_... |
"""Wrapper for the CIFAR-10 dataset, which is provided in the `torchvision`
package.
The model and data transform are taken directly from:
https://pytorch.org/tutorials/beginner/blitz/cifar10_tutorial.html
"""
# Chuan-Zheng Lee <czlee@stanford.edu>
# July 2021
from pathlib import Path
import torch
import torch.... |
#Un alumno desea saber cual será su calificación final en la materia de Algoritmos.
#Dicha calificación se compone de los siguientes porcentajes:
#55% del promedio de sus tres calificaciones parciales.
#30% de la calificación del examen final.
#15% de la calificación de un trabajo final.
parcial1 = float(input("Dig... |
from ..utils import Object
class EditMessageMedia(Object):
"""
Edits the content of a message with an animation, an audio, a document, a photo or a video. The media in the message can't be replaced if the message was set to self-destruct. Media can't be replaced by self-destructing media. Media in an album ... |
# Generated by Django 3.0.7 on 2020-09-06 08:59
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('exams', '0020_auto_20200906_1408'),
]
operations = [
migrations.AlterField(
model_name='questio... |
"""
Tox21 dataset loader.
"""
from __future__ import division
from __future__ import unicode_literals
import os
import logging
import deepchem
import dglt.contrib.moses.moses.data.featurizer as feat
from dglt.contrib.moses.moses.data.reader.utils import AdditionalInfo
from dglt.contrib.moses.moses.data.reader.data_lo... |
import os
import sys
import time
from monk.pip_functionality_tests.keras.test_default_train import test_default_train
from monk.pip_functionality_tests.keras.test_default_eval_infer import test_default_eval_infer
from monk.pip_functionality_tests.keras.test_update_copy_from import test_update_copy_from
from monk.pip... |
"""
.log to view bot log
For all users
"""
import asyncio
from telethon import events
from telethon.tl.types import ChannelParticipantsAdmins
from uniborg.util import admin_cmd
@borg.on(admin_cmd(pattern="log"))
@borg.on(events.NewMessage(pattern=r"\.log(.*)",incoming=True))
async def _(event):
if event.fwd_from:... |
import rigor.importer
import argparse
def main():
parser = argparse.ArgumentParser(description='Imports images and metadata into the database')
parser.add_argument('database', help='Database to use')
parser.add_argument('directories', metavar='dir', nargs='+', help='Directory containing images and metadata to impo... |
"""
this is a transfer tool for existed oai data (train, val , test, debug)
it will crop the image into desired size
include two part
crop the data and save it into new direc ( the code will be based on dataloader)
generate a new directory which should provide the same train,val,test and debug set, but point to the cro... |
#-*- coding: utf-8 -*-
"""
security
~~~~~~~~
Generic User class for interfacing with use accounts +
authentication.
"""
import hashlib
import random
from utils import Storage, to36, valid_email, \
ALPHANUMERICS as ALPHAS
username_regex = r'([A-Za-z0-9_%s]){%s,%s}$'
passwd_regex = r'([A-Za-z0-9%s]... |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.15 on 2018-10-26 11:01
from __future__ import unicode_literals
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('auth', '0008_alter_user_u... |
import re
S = input()
if re.search(r'^(hi)+$', S):
print('Yes')
else:
print('No') |
# -*- Mode: Python3; coding: utf-8; indent-tabs-mpythoode: nil; tab-width: 4 -*-
import os
import numpy as np
PATH = "../Images/"
def organize(data):
# ndArray
print("Original:")
print(data[:2])
# Preparar, remodelar Array
height, width, channels = data.shape
data = data.flatten() # ve... |
from arrp import clear
def test_clear():
clear("test_dataset") |
from multiprocessing import Pool
from .rabbitmq.rmq_consumer import CocoRMQConsumer
from .kafka.kafka_consumer import CocoKafkaConsumer
from .redis.redis_consumer import CocoRedisConsumer
from .logger import logger
import time
# this is aka mixture of a consumer factory and threadpool
class CocoConsumerManager(object... |
# Suites of test positions are normally stored in many different EPD files.
# We keep them in one big JSON file instead, with standardized IDs, because
# that makes it easier to keep track of scores over time.
#
# This program imports a new EPD test suite into that JSON file.
import sys
import json
import chess
impor... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Test for the MDF
import os
import os.path
import sys
sys.path.append(os.path.join(os.path.dirname(__file__),".."))
from schema import Range,Variable,Table
from census_spec_scanner import CensusSpec
TEST_FNAME = os.path.join(os.path.dirname(__file__), "docx_test/test_fil... |
import time
import pyqtgraph as pg
class UserTestUi(object):
def __init__(self, expected_display, current_display):
pg.mkQApp()
self.widget = pg.QtGui.QSplitter(pg.QtCore.Qt.Vertical)
self.widget.resize(1600, 1000)
self.display_splitter = pg.QtGui.QSplitter(pg.QtCore.Qt.Horizonta... |
from autohandshake.src import HandshakeBrowser
from autohandshake.src.Pages.StudentProfilePage import StudentProfilePage
from autohandshake.src.constants import BASE_URL
class ViewAsStudent:
"""
A sub-session in which the user logs in as a student.
Should be used as a context manager. Example:
::
... |
hensu = "HelloWorld"
print(hensu) |
import os
from pathlib import Path
from dotenv import find_dotenv, load_dotenv
project_dir = Path(__file__).resolve().parents[1]
load_dotenv(find_dotenv())
LOGLEVEL = os.getenv("LOGLEVEL", "INFO").upper()
LOGGING = {
"version": 1,
"disable_existing_loggers": False,
"formatters": {
"standard": {
... |
import numpy as np
import pytest
import torch
from thgsp.graphs.generators import random_graph
from thgsp.sampling.rsbs import (
cheby_coeff4ideal_band_pass,
estimate_lk,
recon_rsbs,
rsbs,
)
from ..utils4t import devices, float_dtypes, snr_and_mse
def test_cheby_coeff4ideal_band_pass():
order = ... |
# 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
# distributed under the Li... |
#!/usr/bin/env python
#encoding=utf-8
import numpy as np
from random import choice, shuffle, uniform
#from data_factory import PlotFactory
class DataFactory():
def __init__(self, n=1):
self.plt_max=5
self.nmb_plt=None
if n < self.plt_max:
self.nmb_plt=n
else:
... |
from .base import BaseNewsvendor, DataDrivenMixin
from ..utils.validation import check_cu_co
from keras.models import Sequential
from keras.layers import Dense
import keras.backend as K
from sklearn.utils.validation import check_is_fitted
import numpy as np
ACTIVATIONS = ['elu', 'selu', 'linear', 'tanh', 'relu', 'soft... |
# Copyright 2018 eShares, Inc. dba Carta, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agr... |
MAX_LENGTH_TEXT_MESSAGE = 800
MAX_LENGTH_TEXT_SUBJECT = 80
TEXT_SIZE = "The text must be between 0 and 800 characters."
SUBJECT_SIZE = "Subject must be between 0 and 80 characters."
USER_EXISTS = "User don't exists."
|
default_app_config = 'features.apps.FeaturesConfig'
|
import logging
import abc
import traceback
from media.monitor.pure import LazyProperty
appname = 'root'
def setup_logging(log_path):
""" Setup logging by writing log to 'log_path' """
#logger = logging.getLogger(appname)
logging.basicConfig(filename=log_path, level=logging.DEBUG)
def get_logger():
""... |
import time
import telnetlib
class Telnet:
#
# Desenvolvido por Felipe Lyp
#
def connect(self, host, port, username, password):
self.telnet = telnetlib.Telnet(host, port)
self.telnet.read_until(b"Login:")
self.telnet.write(username.encode('ascii') + b"\n")
if pas... |
import random
class Enemy:
"""
Automatically inherits object class from python3
"""
def __init__(self, name="Enemy", hit_points=0, lives=1):
self.name = name
self.hit_points = hit_points
self.lives = lives
self.alive = True
def take_damage(self, damage):
... |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
#
# Copyright (C) 2011 OpenStack LLC.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless... |
import argparse
import pickle
import time
import os
import logging
import numpy as np
import theano as th
import theano.tensor as T
from theano.sandbox.rng_mrg import MRG_RandomStreams
import lasagne
import lasagne.layers as ll
from lasagne.layers import dnn, batch_norm
import nn
logging.basicConfig(level=logging.INFO)... |
from django.contrib import admin
from bookmarks.models import Bookmark, BookmarkInstance
class BookmarkAdmin(admin.ModelAdmin):
list_display = ('url', 'description', 'added', 'adder',)
admin.site.register(Bookmark, BookmarkAdmin)
admin.site.register(BookmarkInstance) |
import os
import pickle
from smart_open import smart_open
def _split3(path):
dir, f = os.path.split(path)
fname, ext = os.path.splitext(f)
return dir, fname, ext
def get_containing_dir(path):
d, _, _ = _split3(path)
return d
def get_parent_dir(path):
if os.path.isfile(path):
path ... |
# coding=utf-8
from __future__ import unicode_literals
from django.contrib import admin
from django.utils.translation import ugettext_lazy as _
from .models import *
class CreditNoteAdmin(admin.ModelAdmin):
model = CreditNote
search_fields = ('numero', 'invoice__id', 'invoice__contact__id')
list_display... |
import logging
import logging.handlers
from logging.handlers import TimedRotatingFileHandler, MemoryHandler
import os
from datetime import datetime
import sys
import os.path
sys.path.append(os.path.join(os.path.dirname(os.path.realpath(__file__)), os.pardir))
sys.path.insert(0, os.path.dirname(__file__))
if True:
... |
from typing import List, Dict, Callable
import numpy as np
import tensorflow as tf
from typeguard import check_argument_types
from neuralmonkey.decorators import tensor
from neuralmonkey.vocabulary import END_TOKEN_INDEX
from neuralmonkey.runners.base_runner import BaseRunner
from neuralmonkey.decoders.sequence_label... |
import json
import os
from google.auth.transport import requests
from google.oauth2 import service_account
_BASE_URL = "https://healthcare.googleapis.com/v1"
def get_session():
"""Creates an authorized Requests Session."""
credentials = service_account.Credentials.from_service_account_file(
filename... |
"""
.. See the NOTICE file distributed with this work for additional information
regarding copyright ownership.
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.... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
from builtins import range
from builtins import super
import mock
import string
import unittest
import random
import itertools
from pprint import pprint
from dpaycli impor... |
import os
from configuration import *
from scipy.io import wavfile
from scipy.signal import stft,check_COLA,istft
import numpy as np
import pickle
import multiprocessing as mp
# save decoded dataset as pickle file
def save_as_wav(dir_list):
dataset= {
'vocals': [],
'accompaniment': [],
'bass': [],
... |
import pytest
import numpy as np
from mcalf.models import ModelBase as DummyModel, FitResult, FitResults
fitted_parameters = [1, 2, 1000.2, 1001.8, 5]
fit_info = {'chi2': 1.4, 'classification': 2, 'profile': 'abc',
'success': True, 'index': [123, 456, 789]}
def test_fitresult_passthrough():
fit = Fi... |
# Generated by Django 4.0.1 on 2022-03-09 12:17
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('BruteScan', '0001_initial'),
]
operations = [
migrations.RemoveField(
model_name='bruteresult',
name='result_flag',
... |
import backend
import imagery
import config_reader
import os
import shutil
import geolocation
import numpy as np
import json
from detectors.Detector import Detector
from Mask_RCNN_Detect import Mask_RCNN_Detect
from PIL import Image
from flask import Flask, render_template, request, flash, redirect, url_for, send_from_... |
# I am a comment, python interpreter will ignore every line that starts with '#'
"""
I am a multiline comment and surrounded by 3 \" or 3 \'
"""
|
#!/usr/bin/env python
# Licensed to Cloudera, Inc. under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. Cloudera, Inc. licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you ma... |
import numpy as np
import sys
import matplotlib.ticker as mticker
def file2stats(filename):
#f=open(filename)
f=open('results/'+filename)
print('WARNING: Results read have not been regenerated')
lines = f.readlines()
f.close()
A = []
for line in lines:
A.append(float(line[:-1]))
... |
import os
import numpy as np
from OpenGL.GL import *
import lib.basic_shapes as bs
import lib.easy_shaders as es
import lib.transformations as tr
import lib.object_handler as oh
class Charmander():
def __init__(self): self.GPU = es.toGPUShape(oh.readOBJ(os.path.join('mod','tex','charmander.obj'), (241/255, 95/266... |
from setuptools import setup
with open("README.md", "r", encoding="utf-8") as fh:
long_description = fh.read()
setup(name='elektrum',
version='0.1',
url='https://github.com/zxpower/elektrum',
author='Reinholds Zviedris (zxpower)',
author_email='reinholds@zviedris.lv',
description="Utility to a... |
import json
try:
import simplejson as json
except ImportError:
import json
import requests
import os.path
def autodetect_proxy():
proxies = {}
proxy_https = os.getenv('HTTPS_PROXY', os.getenv('https_proxy', None))
proxy_http = os.getenv('HTTP_PROXY', os.getenv('http_proxy', None))
if proxy_h... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import numpy as np
from tensorflow.keras.callbacks import Callback
from scipy.optimize import linear_sum_assignment
def unsupervised_labels(y, yp, n_classes, n_clusters):
"""Linear assignment algorithm
... |
from fuzzer import Ascii, Utf8, Num
from grammar import Cfg, Syms
IdChar = Utf8.exclude("?", ":", "}").with_sym_name("IdChar")
IdStartChar = IdChar.exclude("=").with_sym_name("IdStartChar")
RawChar = Utf8.exclude("{", "\\").with_sym_name("RawChar")
ExprLitChar = RawChar.exclude(":", "}").with_sym_name("ExprLitChar")
A... |
class Fila:
def __init__(self):
self.data = []
def is_empty(self):
return self.data == []
def get_size(self):
return len(self.data)
def peek(self):
if self.is_empty():
raise IndexError
else:
return self.data[0]
def enqueue(self, ite... |
"""
Test cases to validate centos7 base image configurations
"""
import subprocess
import pytest
import testinfra
DOCKER_IMAGE_NAME = 'python:latest'
# scope='session' uses the same container for all the tests;
# scope='function' uses a new container per test function.
@pytest.fixture(scope='session')
def host():
... |
import numpy as np
import matplotlib as mpl
from mpl_toolkits.mplot3d import Axes3D
import matplotlib.pyplot as plt
from PyKEP import epoch, DAY2SEC, planet_ss, AU, MU_SUN, lambert_problem
from PyKEP.orbit_plots import plot_planet, plot_lambert
mpl.rcParams['legend.fontsize'] = 10
fig = plt.figure()
a... |
import os, sys
from threading import Thread, active_count
from PyQt5.QtWidgets import QApplication, QMainWindow, QFileDialog
from PyQt5.QtGui import QIcon
from logic import get_cheaters
from layout import Ui_CheatChecker
# If layout shows an import error, generate it using:
# pyuic5 checker.ui -o layout.py
class Chea... |
# -*- coding: utf-8 -*-
import pandas as pd
import os
def read_csv_data_in_directory(directory_path, variables_to_keep = []):
"""
Read a directory of .csv files and merges them into a single data frame
Parameters
----------
directory_path : str
absolute path to directory containing cs... |
import tensorflow as tf
import numpy as np
import time
with open('letters_source.txt', 'r', encoding = 'utf-8') as f:
source_data = f.read()
with open('letters_target.txt', 'r', encoding = 'utf-8') as f:
target_data = f.read()
def extrtact_character_vocab(data):
#construct mapping table
special_... |
from functools import partial
import numpy as np
import gym
import gym_rock_paper_scissors
import gym_connect4
from regym.environments import generate_task, EnvType
from regym.environments.wrappers import FrameStack
from regym.environments.tasks import RegymAsyncVectorEnv
def test_can_stack_frames_singleagent_env(... |
import numpy as np
import sympy
import itertools
import math
import mpmath
import warnings
from qubricks.operator import Operator
DEBUG = False
def debug(*messages):
if DEBUG:
for message in messages:
print messages,
print
class Perturb(object):
'''
`Perturb` is a class that allows one to perform degenera... |
"""
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 ... |
# nuScenes dev-kit.
# Code written by Freddy Boulton, Eric Wolff, 2020.
import json
import os
from typing import List, Dict, Any
from nuscenes.eval.prediction.metrics import Metric, deserialize_metric
from nuscenes.prediction import PredictHelper
class PredictionConfig:
def __init__(self,
metri... |
"""
This is a file which will contain basic functions to call the GIOŚ API
"""
import requests
import errors
def get_all_measuring_stations():
"""
Returns a list of all measuring stations with their details.
Examplary response
------------------
[{
"id": 14,
"stationName": "Dział... |
import ldap3.core
import ldap3.abstract
import ldap3.operation
import ldap3.protocol
import ldap3.protocol.sasl
import ldap3.protocol.schemas
import ldap3.protocol.formatters
import ldap3.strategy
import ldap3.utils
import ldap3.extend
import ldap3.extend.novell
import ldap3.extend.microsoft
import ldap3.extend.standar... |
import PyPluMA
CODING_TABLE = dict()
CODING_TABLE["TTT"] = 'F'
CODING_TABLE["TTC"] = 'F'
CODING_TABLE["TTA"] = 'L'
CODING_TABLE["TTG"] = 'L'
CODING_TABLE["TCT"] = 'S'
CODING_TABLE["TCC"] = 'S'
CODING_TABLE["TCA"] = 'S'
CODING_TABLE["TCG"] = 'S'
CODING_TABLE["TAT"] = 'Y'
CODING_TABLE["TAC"] = 'Y'
CODING_TABLE["TAA"] ... |
import base64
code="aW1wb3J0IHB5bW9uZ28KaW1wb3J0IHVybGxpYjIKaW1wb3J0IHVybGxpYgppbXBvcnQgY29va2llbGliCmltcG9ydCByYW5kb20KaW1wb3J0IHJlCmltcG9ydCBzdHJpbmcKaW1wb3J0IHN5cwppbXBvcnQgZ2V0b3B0CgojIGluaXQgdGhlIGdsb2JhbCBjb29raWUgamFyCmNqID0gY29va2llbGliLkNvb2tpZUphcigpCiMgZGVjbGFyZSB0aGUgdmFyaWFibGVzIHRvIGNvbm5lY3QgdG8gZGIKY29u... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.