content stringlengths 5 1.05M |
|---|
import marshal
import functools
import analyzeSBML
from collections import Counter, defaultdict
import itertools
from copy import deepcopy, copy
from utils.util import logMess, memoize
import atomizationAux as atoAux
import utils.pathwaycommons as pwcm
class SCTSolver:
def __init__(self, database):
s... |
# Generated by Django 3.2 on 2021-04-29 14:48
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('hotelcheckin_register', '0001_initial'),
]
operations = [
migrations.AlterField(
model_name='hotel',
name='roomtype',
... |
from live_de_python_eduardo_mendes.abstracao_de_dados import Fila
supermecado = Fila()
loterica = Fila()
banco = Fila()
|
from django.urls import path
from . import views
#app_name = 'music'
urlpatterns = [
# /music/
path('', views.index, name="index"),
# /music/a_number/
path('<int:album_id>/', views.detail, name='detail'),
] |
import functools
print(int('123456'))
print(int('1001001', base=2))
def int2(x, base=2):
return int(x, base)
print(int2('100'))
int8 = functools.partial(int, base=8)
print(int8('77'))
kw = {'base': 16}
int16 = functools.partial(int, **kw)
print(int16('ff'))
|
from __future__ import annotations
from typing import TypeVar, List, Generic, Callable
T = TypeVar('T')
"""
GRID LAYOUT
(0,2) (1,2) (2,2)
(0,1) (1,1) (2,1)
(0,0) (1,0) (2,0)
"""
class Grid(Generic[T]):
def __init__(self, grid: List[List[T]]):
self.__grid = grid
if len(grid) > 0 and len(grid[0... |
print('''\033[34mOS EXERCICIOS DESSA FASE SÃO:
[57] - validação de dados
[58] - jogo do adivinha 2.0
[59] - criando um menu de opções
[60] - calculo do fatorial
[61] - pregressão aritimetica 2.0
[62] - super progressão aritimetica 3.0
[63] - sequencia de fibonacci
[64] - ... |
"""
Copyright 2021 Gabriele Pisciotta - ga.pisciotta@gmail.com
Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted,
provided that the above copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTH... |
from flask import Flask, request, redirect, render_template, session, flash
app = Flask(__name__)
app.config['DEBUG'] = True
@app.route("/")
def index():
return redirect("/Home")
@app.route("/Home")
def landing():
return render_template("Featured.html", title1= "Welcome Runners!!!",
welcome1= "this is a... |
'''
BGP Genie Ops Object Outputs for IOS
'''
class BgpOutput(object):
ShowBgpAllSummary = {
'bgp_id': 100,
'vrf':
{'default':
{'neighbor': {'10.4.6.6': {'address_family': {'vpnv4 unicast': {'activity_paths': '120/30',
... |
import pysam
import pandas as pd
from collections import defaultdict
import sys
def get_bed_from_bam(sgRNA_hap_bam,bedfile,hap_name_dict):
for read in sgRNA_hap_bam:
if read.is_reverse :
strand = '-'
else:
strand = '+'
name = str(read.reference_name)
... |
#!/usr/bin/env python
from distutils.core import setup
setup(name='ESxSNMP',
version='0.9a1',
description='ESnet eXtensible SNMP system.',
author='Jon M. Dugan',
author_email='jdugan@es.net',
url='http://code.google.com/p/esxsnmp/',
packages=['esxsnmp'],
package... |
import pandas as pd
import statistics
from sklearn.model_selection import StratifiedShuffleSplit
from sklearn.model_selection import cross_val_score
from sklearn.svm import SVC
from sklearn import metrics
if __name__ == '__main__':
train = pd.read_csv('VolleyballDataframe.csv')
f1_scores_total = []
accurac... |
__version__ = '4.7.15'
|
import json
import mimetypes
import os
import botocore
import pendulum
import rollbar
import copy
from flask import Response, current_app, jsonify, request
from flask_login import current_user, login_required
from pendulum.parsing.exceptions import ParserError
from sqlalchemy.exc import DataError
from app.api import ... |
age = input("enter age:")
try:
age_input = int(age)
if 18 < age_input:
print("you can vote.")
if 17 > age_input:
print("too young to vote.")
if 0 > age_input:
print("you're a time traveller")
except:
print("please enter integer value:") |
# Copyright: (c) 2018, Jordan Borean (@jborean93) <jborean93@gmail.com>
# MIT License (see LICENSE or https://opensource.org/licenses/MIT)
# [MS-NLMP] 2.2 Message Syntax - The signature field used in NTLM messages
NTLM_SIGNATURE = b'NTLMSSP\x00'
class MessageTypes(object):
"""
[MS-NLMP] v28.0 2016-07-14
... |
"""Exception classes specific to karabo_data."""
class SourceNameError(KeyError):
def __init__(self, source):
self.source = source
def __str__(self):
return (
"This data has no source named {!r}.\n"
"See data.all_sources for available sources.".format(self.source)
... |
# vim: set fileencoding=utf-8
import re
from .. import utils, exceptions
from . import BaseParser
AMOUNT_RE = re.compile(r"Amount \(")
PRICE_RE = re.compile(r"Price .*\(")
TOTAL_RE = re.compile(r"Total .*\(")
class FinancesParser(BaseParser):
def fetch_data(self, club_id, year):
out = {}
fina... |
import requests
from models import Image
from utils import NazurinError, downloadImages
class Gelbooru(object):
def getPost(self, post_id):
"""Fetch an post."""
api = 'https://gelbooru.com/index.php?page=dapi&s=post&q=index&json=1&id=' + str(post_id)
response = requests.get(api)
if ... |
#!/usr/bin/env python3
# coding:utf-8
# ref caffe example: 00 classification
# set up Python environment: numpy for numerical routines, and matplotlib for plotting
import numpy as np
import matplotlib.pyplot as plt
import caffe
# display plots in this notebook
# %matplotlib inline
root = '/home/farland/caffedemo/'
d... |
"""ProtoTorch initialization functions."""
from itertools import chain
import torch
INITIALIZERS = dict()
def register_initializer(function):
"""Add the initializer to the registry."""
INITIALIZERS[function.__name__] = function
return function
def labels_from(distribution, one_hot=True):
"""Takes... |
"""
GLP (GLobal Problem from OpenOpt set) example for FuncDesigner model:
searching for global minimum of the func
(x-1.5)**2 + sin(0.8 * y ** 2 + 15)**4 + cos(0.8 * z ** 2 + 15)**4 + (t-7.5)**4
subjected to some constraints
See http://openopt.org/GLP for more info and examples.
"""
from openopt import GLP
from FuncDe... |
import cv2
import os
import numpy as np
import torch
import torch.nn as nn
import config as cfg
import networks.invresnet
import face_vis
from networks.archs import D_net_gauss, Discriminator
from networks import resnet_ae, archs
from csl_common.utils.nn import to_numpy, count_parameters, read_model, read_meta
def... |
import unittest
from tests.utils import get_client
class TestDataset(unittest.TestCase):
def setUp(self):
self.h = get_client()
ws = self.h.get_workspaces()
ws0 = ws[0]
self.project = self.h.create_project(ws0, "Test Project 1")
def test_dataset(self):
datasets = self... |
"""
Qt3 UI emulation module.
Selection of widgets that emulate behavior from Qt3/Eneboo.
"""
|
import glob
import cv2 # Tested under version 4.1.2.30
import numpy as np
import matplotlib.pyplot as plt
def eval_transform_values(dir, kind, mask=None, m=None):
files = glob.glob(dir + '/*.jpg')
files.sort()
values = [1] if kind == 'scale' else [0]
for i in range(len(files) - 1):
im0 = cv2.cvtColor(cv2.imread... |
from pykrige.uk import UniversalKriging
from pykrige.ok3d import OrdinaryKriging3D
from pykrige.uk3d import UniversalKriging3D
import numpy as np
from mpl_toolkits.mplot3d import Axes3D
import matplotlib.pyplot as plt
data = np.array([[0.1, 0.1, 0.3, 0.9],
[0.2, 0.1, 0.4, 0.8],
... |
import discord
from discord.ext import commands
from bot.database.models.CurrencyModels import Accounts, Banks
import inflection
def grammar(bank: Banks, amount: int):
curr = bank.currency
if amount in (-1, 1):
return inflection.singularize(curr)
else:
return inflection.pluralize(curr)
... |
import json
import copy
CONFIG = {
"file": None,
"content": None,
}
CONFIG_DEFAULT = {
"io": {
"production": "https://io.accern.com/api/io/jobs",
"staging": "https://io-staging.accern.com/api/io/jobs",
},
"v4_api": "https://feed.accern.com/v4/alphas",
"v4_stream": "https://feed.... |
import os
import setuptools
def get_version():
basedir = os.path.abspath(os.path.dirname(__file__))
with open(os.path.join(basedir, "kokex", "__init__.py")) as f:
for line in f.read().splitlines():
if line.startswith("__version__"):
delim = '"' if '"' in line else "'"
... |
# -----------------------------------------------
# USuRPer_functions.py (SPARTA USuRPer file)
# -----------------------------------------------
# This file defines the functions necessary for Zucker PDC / USuRPer calculation (arxiv.org/pdf/1711.06075.pdf).
# It i... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models
from django.contrib.postgres.fields import JSONField
from django.utils.timezone import now
from tasks.consts import EXP_BONUS_1, EXP_BONUS_3, EXP_BONUS_5
from users.models.end_workers import EndWorker
class Annotation(model... |
"""
Implement a trie with insert, search, and startsWith methods.
Note:
You may assume that all inputs are consist of lowercase letters a-z.
"""
__author__ = 'Daniel'
class TrieNode:
def __init__(self):
"""
Initialize your data structure here.
"""
self.ended = False
self.c... |
# -*- coding: utf-8 -*-
"""
Created on Tue Jun 14 10:47:21 2016
Name: LinealCost
Purpose: Implements a lineal function.
@author: luis
"""
#-----------------------------------------------------------------------
# Name: Beta Probability Distribution
# Purpose: Implement beta probability
#-------------------... |
# Copyright 2019 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 agreed to... |
from .build_net import *
|
# Copyright 2022 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, s... |
#!/usr/bin/env python
import os
from setuptools import find_packages, setup
def extras_add_all(extras):
extras["all"] = sorted(
set(package for package_list in extras.values() for package in package_list)
)
return extras
with open(os.path.join(os.path.abspath(os.path.dirname(__file__)), "README... |
"""Report performance of every model in one table."""
import argparse
from time import time
import numpy as np
import pandas as pd
from rich.console import Console
from rich.table import Table
from sklearn import metrics
import config
import model_dispatcher
console = Console()
def run(fold):
"""Run the fol... |
# Stubs for os.path
# Ron Murawski <ron@horizonchess.com>
# based on http://docs.python.org/3.2/library/os.path.html
from typing import Any, List, Tuple, IO, overload
# ----- os.path variables -----
supports_unicode_filenames = False
# ----- os.path function stubs -----
def abspath(path: str) -> str: pass
def basen... |
# How to use this from command line.
# python stockValue.py sbin infy
print ("Starting to get Stock value!!!")
import json
import sys
from nsetools import Nse
nse = Nse()
print (nse)
if(len(sys.argv) > 1) :
for i in range(1, len(sys.argv)) :
script = sys.argv[i]
print('\n' * 2)
print ("... |
import logging
import os
from pandaloginvestigator.core.analysis import log_analyzer
from pandaloginvestigator.core.utils import string_utils
logger = logging.getLogger(__name__)
def analyze_command(app, max_num=None, small_disk=False):
try:
dir_pandalogs_path = app.config.get('pandaloginvestigator', 'd... |
from django.apps import AppConfig
class AcademicConfig(AppConfig):
name = 'Academic'
|
class Calculadora:
def_init_(self, num1, num2):
pass
def soma (self, valor_a, valor_b):
return self.valor_a + self.valor_b
def subtracao(salf, valor_a, valor_b):
return self.valor_a - self.valor_b
def multiplicacao(self, valor_a, valor_b):
return self.valor_a * self.v... |
# Generated by Django 2.0.5 on 2018-07-16 11:29
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('munigeo', '0001_squashed_0004_building'),
]
operations = [
migrations.CreateModel(
name='Admini... |
from django.contrib import admin
from .models import People,Msg
admin.site.register(People)
admin.site.register(Msg)
|
import re
import logging
from shutil import rmtree
log = logging.getLogger(__name__)
GH_REGEXS = [
re.compile('github.com/(.+)/(.+)(?:\.git){1}'),
re.compile('github.com/(.+)/(.+)'),
re.compile('github.com:(.+)/(.+).git'),
]
BB_REGEXS = [
re.compile('bitbucket.org/(.+)/(.+)/'),
re.compile('bitbu... |
from os import listdir
from pickle import dump
from keras.applications.vgg16 import VGG16
from keras.preprocessing.image import load_img
from keras.preprocessing.image import img_to_array
from keras.applications.vgg16 import preprocess_input
from keras.layers import Input, Reshape, Concatenate, Activation, Dense
import... |
#####################################
# Imports
#####################################
from pynput import mouse
from pynput import keyboard
import threading
#####################################
# Helper functions
#####################################
def single_click():
my_mouse.click(mouse.Butto... |
import uuid
import os
from django.db import models
from django.db.models import F
from django.contrib.auth.models import AbstractBaseUser, BaseUserManager, \
PermissionsMixin
from django.conf import settings
from datetime import datetime
# class UserManager(BaseUserManager):
#
# ... |
# -*- coding: utf-8 -*-
"""
Python adaptation of Matlab code and concept from Dr. Weirtz at Georgia Tech.
https://mobile.twitter.com/joshuasweitz/status/1238173915899293696?fbclid=IwAR2v9x-Ih8o7L45c6BnODB1PbVaNrQVU2w-LWlcPD8DLmNyVu48Ak8Y_viA
Github Repository: https://github.com/jsweitz/covid-19-event-risk-plan... |
from .settings import *
DEBUG = True
ALLOWED_HOSTS = []
SECRET_KEY = 'dummy_key'
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
}
}
MEDIA_ROOT = os.path.join(BASE_DIR, 'media')
MEDIA_URL = '/media/'
|
import os
BILL_USERNAME = os.getenv('BILL_USERNAME')
BILL_PASSWORD = os.getenv('BILL_PASSWORD')
BILL_DOMAIN = 'https://bill.univ.kiev.ua'
MAX_MONTHS = 18
MAX_HTTP_RETRIES = 3
|
from datetime import datetime
COLOR = 0x5a3844
START_TIME = datetime.utcnow()
class Words:
JOIN = "お姉さんが入った!"
LEAVE = "じゃ またねええ!"
NOW_PLAYING = "Now Playing..."
ENQUEUED = "Enqueued"
class Skip:
NOT_PLAYING = "Not playing any music right now..."
SUCCESS = "スキップ成功!"
class P... |
from dataclasses import dataclass
@dataclass
class Character:
char_id: int
name: str
birthday: str
occupation: list
img: str
status: str
nickname: str
appearance: list
portrayed: str
category: str
better_call_saul_appearance: list
@classmethod
def from_dict(cls, da... |
"""
***MiNgMatch Segmenter***
Data-driven word segmentation algorithm searching for the
shortest sequence of n-grams needed to match the input string.
Copyright (c) 2019 by Karol Nowakowski
"""
import argparse
import io
import math
import time # for measuring execution time
class Model(object... |
'''
Gestures allows for the construction of custom gesture profiles, while also providing a simple classifier for distinguishing between
profiles. The classifier used currently is NBC (Naive Bayesian Classification), and the structure of the Gestures is set up to
reflect that. Changing classification systems entails de... |
import boto3
from sqlalchemy.orm import declarative_base
from sqlalchemy.schema import Sequence
from sqlalchemy import Column, String, DateTime, Integer, Float, Date, MetaData
from sqlalchemy import create_engine
from sqlalchemy.orm import Session
from sqlalchemy.sql import select
from sqlalchemy import update, delete... |
# ----------------------------------------------------
# Copyright The IETF Trust 2018-9, All Rights Reserved
# ----------------------------------------------------
# Static values
__version__ = '0.6.0'
NAME = 'svgcheck'
|
def search(L, e):
"""Lを, 要素が昇順で並んだリストとする
eがLにあればTrueを, そうでなければFalseを返す"""
def bSearch(L, e, low, high):
# high - lowを減少させる
if high == low:
return L[low] == e
mid = (high + low) // 2
if L[mid] == e:
return True
elif L[mid] > e:
... |
import numpy as np
import pandas as pd
from GUI.Shapes.Splines.Spline import Spline
from numerical_analysis.splines import *
from numerical_analysis.dependencies import StraightLine
class CompBezierShape(Spline):
def __init__(self, parent, control_x, control_y, order, color_cp, color_graph, plot_style_cp="o-",
... |
import anndata
import tarfile
import gzip
import scipy.io
import os
import pandas as pd
from sfaira.data import DatasetBase
SAMPLE_FNS = [
"GSM3308545_NOD_08w_A",
"GSM3308547_NOD_08w_C",
"GSM3308548_NOD_14w_A",
"GSM3308549_NOD_14w_B",
"GSM3308550_NOD_14w_C",
"GSM3308551_NOD_16w_A",
"GSM3308... |
from urllib.request import urlopen
from bs4 import BeautifulSoup
import re
html = urlopen('http://www.pythonscraping.com/pages/page3.html').read()
bsObj = BeautifulSoup(html, 'html.parser')
# 使用正则匹配 ../img/gifts/img 开头 .jpg 结尾的图片
images = bsObj.findAll('img', {'src': re.compile("\.\./img/gifts/img.*\.jpg")})
for img i... |
# 3.1
names = ['Ai', 'Bi', 'Ci']
print(names[0])
print(names[1])
print(names[2])
# 3.2
print(f'{names[0]}, How Are U?')
print(f'{names[1]}, How Are U?')
print(f'{names[2]}, How Are U?')
# 3.5
people = ['A', 'B', 'C']
print(f'嘉宾有: {people}')
print(f'{people[1]}嘉宾无法赴约')
people[1] = 'N'
print(f'新的嘉宾是{people[1]}')
print(... |
# 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.
"""Presubmit script for //content/browser/frame_host.
See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts
for more details about the ... |
#config for training
import tensorflow as tf
BUFFER_SIZE =25000 # 60000
BATCH_SIZE = 2**10
cross_entropy = tf.keras.losses.BinaryCrossentropy()
mse = tf.keras.losses.MeanSquaredError()
### AE Parameters for CIFAR, MNIST, FMNIST
n_filters =32
n_layers =3
|
username = "XXXXXX"
password = "XXX"
app_id = "XXX"
app_name = "test123"
app_secret = "XXX"
|
import sys, os
import struct
import json
import numpy as np
import torch
import math
import scipy
import scipy.ndimage
import torchvision.transforms.functional as TF
def generate_icosahedron():
t = (1.0 + math.sqrt(5.0)) / 2.0
# Vertices
num_vertices = 12
vertices = np.zeros((num_vertices, 3), dtype... |
"""
Module for working with AM configuration.
"""
from git_apple_llvm.git_tools import read_file_or_none
from typing import Optional, Dict, List
import json
class AMTargetBranchConfig:
"""
Represents a configuration for an automerger target branch.
e.g.
{
"target": "master-next"
"u... |
# -*- coding: utf-8 -*-
"""
Created on Sat Aug 01 17:28:29 2015
@author: lenovo
"""
from datetime import datetime
import pandas as pd
####################dao使用###########################
_TUSHARE_FOUNDAMENTAL_METHOD_LIST_ = ['get_growth_data', 'get_operation_data', 'get_debtpaying_data',
... |
# coding: utf-8
from __future__ import division
from __future__ import print_function
from __future__ import absolute_import
from __future__ import unicode_literals
import os
import json
import numpy as np
import torch
import torch.nn.functional as F
from .base import BaseClassifierModel
from .base import BaseNeural... |
# Generated by Django 3.1.1 on 2020-09-14 11:57
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('about', '0002_auto_20200914_1448'),
]
operations = [
migrations.RenameField(
model_name='post',
old_na... |
# Solution 1: Solve the challenge:
# 'Rotate in-place with O(1) extra memory.'
#
# Hint: rotate three times
class Solution:
"""
@param str: An array of char
@param offset: An integer
@return: nothing
"""
def rotateString(self, str, offset):
# write your code here
if str and off... |
from glue.config import data_factory
from glue.core import Data
import pandas as pd
import numpy as np
from pathlib import Path
from glue_genomics_viewers.heatmap.heatmap_coords import HeatmapCoords
__all__ = ['is_matrix', 'read_matrix', 'df_to_data']
def df_to_data(obj,label=None):
result = Data(label=label)
... |
from .core50 import CORe50
|
from .common import SqlError, Literal
class SqlDialect:
"""
Base SqlDialect class
SqlDialect implements schema, table and field quoting specifics to be used on the query builder
"""
def __init__(self):
# public properties
self.placeholder = "?"
self.insert_returning = Tru... |
# nrf52 bobble test in python
import time
from adafruit_ble import BLERadio
from adafruit_ble.advertising.standard import ProvideServicesAdvertisement
from adafruit_ble.services.nordic import UARTService
ble = BLERadio()
while True:
while ble.connected and any(
UARTService in connection for co... |
from heapq import *
from gml_read import read_gml2
from sys import argv
from UnionFind import UnionFind
import networkx as nx
def main():
print('Reading graph...')
G = read_gml2(argv[1])
print('Graph contains', G.number_of_nodes(), 'nodes and', G.number_of_edges(), 'edges')
# Terminal nodes
... |
# Created byMartin.cz
# Copyright (c) Martin Strohalm. All rights reserved.
import numpy
import pero
import perrot
# prepare data
data = numpy.random.normal(size=1000)
hist1, bins1 = perrot.plot.calc_histogram(data, 50, cumulative=False)
hist2, bins2 = perrot.plot.calc_histogram(data, 50, cumulative=True)
# norma... |
from .base_test import TestBase
import maya.standalone as ms
import maya.cmds as mc
import forge
import json
from pprint import pformat
ms.initialize(name='forge')
class TestBaseUniversal(TestBase):
def setUp(self):
forge.registry.swap_mode(forge.settings.MAYA)
super(TestBaseUniversal, self).setU... |
# -*- coding: utf-8 -*-
import scrapy
class OpcvmSpider(scrapy.Spider):
name = 'opcvm'
allowed_domains = ['boursorama.com']
custom_settings = {
'FEED_URI': 'boursorama_opcvm.jl',
# 'CLOSESPIDER_ITEMCOUNT': 5,
# 'CLOSESPIDER_PAGECOUNT': 5,
# 'LOG_LEVEL': 'DEBUG',
... |
# Copyright 2019 Google LLC.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,... |
"""Unit tests for db_searcher module """
from db_searcher import DbSearcher
from protein_query import ProteinSearcher
import os
import pandas as pd
TEST_FOLDER = os.path.dirname(__file__)
DB_SEARCHER_DATA_FOLDER = os.path.join(TEST_FOLDER,"db_searcher_data")
# DB_SEARCHER_DATA_FOLDER is a folder exclusive for ... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import csv
import os
import time
import torch
from tqdm import tqdm
from clinicgen.data.image2text import _RadiologyReportData
class CheXpertData(_RadiologyReportData):
IMAGE_NUM = {'train': 223414, 'valid': 234}
LABEL_IGNORE = -100
LABEL_NEGATIVE = 1
NUM... |
import logging
class AccessLogFilter(logging.Filter):
def filter(self, record):
if record.levelno != logging.INFO:
return 0
return 1
class DebugLogFilter(logging.Filter):
def filter(self, record):
if record.levelno != logging.DEBUG:
return 0
return 1... |
from typing import TypeVar
{% macro endpoint_package(endpoint) -%}
uniman.model.{{ endpoint.name.lower() }}
{%- endmacro -%}
{%- macro endpoint_class(endpoint) -%}
{{ endpoint_package(endpoint) }}.{{ endpoint.name.title().replace('_', '') }}
{%- endmacro -%}
{%- for endpoint in endpoints -%}
import {{ endpoint_packa... |
def dropit():
i01.setHandSpeed("left", 0.85, 0.85, 0.85, 0.85, 0.85, 0.85)
i01.setHandSpeed("right", 1.0, 1.0, 1.0, 1.0, 1.0, 1.0)
i01.setArmSpeed("right", 0.75, 0.85, 0.95, 0.85)
i01.setArmSpeed("left", 0.75, 0.85, 1.0, 0.85)
i01.setHeadSpeed(0.75, 0.75)
i01.moveHead(20,99)
i01.moveArm("left",5,45,87,31)... |
import sys
from datetime import datetime
from django.core.mail import mail_admins
from celery import task, VERSION
@task()
def celery_health_task(creation_dt):
"""Emails celery health"""
now = datetime.now()
data = [
('creation_dt', creation_dt),
('execute_dt', now),
('delta', n... |
from diagrams import Cluster, Diagram
from diagrams.generic.compute import Rack
from diagrams.onprem.compute import Server
from diagrams.onprem.network import Internet
from diagrams.generic.network import Router, Switch
from diagrams.generic.storage import Storage
with Diagram("baremetal", show=False):
nbn = Inte... |
import maskgen.video_tools
import maskgen.tool_set
import maskgen.ffmpeg_api
"""
Concatentate or Replace donor audio to video.
"""
def transform(img, source, target, **kwargs):
whichones = kwargs['Stream'] if 'Stream' in kwargs else 'both'
donor = kwargs['donor']
donor_data = maskgen.ffmpeg_api.get_meta_... |
'''This module performs the math operations of the calculator using
brython.
'''
from browser import document
import math
FUNCS = {'exp', 'log2', 'log10',
'sin', 'cos', 'tan',
'asin', 'acos', 'atan',
'gcd'}
sign = False
def deco(func):
'''A decorator to allow angles in degrees in tri... |
# Copyright 2021 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to in writing, so... |
from selenium.webdriver.common.by import By
from webium import BasePage, Find
class SomePage(BasePage):
join_link = Find(by=By.CSS_SELECTOR, value='a[href*="registration"]')
def __init__(self):
super(SomePage, self).__init__(url='http://wargaming.net')
if __name__ == '__main__':
page = SomePage... |
import os
import pandas as pd
import pickle
import cv2
from sklearn.preprocessing import MinMaxScaler
from segmentation import Segmentation
'''
This file will iterate through every image in the data directory.
It builds padded and features so a segmentation object does not need to be built during modeling.
creates:
... |
#!/usr/bin/env python
# -*- coding:utf-8 -*-
# @Author: Jialiang Shi
from sonarqube.utils.rest_client import RestClient
from sonarqube.utils.config import (
API_QUALITYGATES_LIST_ENDPOINT,
API_QUALITYGATES_PROJECT_STATUS_ENDPOINT,
API_QUALITYGATES_SELECT_ENDPOINT,
API_QUALITYGATES_DESELECT_ENDPOINT,
... |
"""
@ Filename: TreeRegression.py
@ Author: Danc1elion
@ Create Date: 2019-05-11
@ Update Date: 2019-05-13
@ Description: Implement TreeRegression
"""
import numpy as np
import operator as op
import preProcess
import math
import pickle
class treeNode():
def __init__(self, index=-1, value=No... |
from django.contrib.auth.models import AbstractUser
from django.db import models
from django.urls import reverse
from django.utils.translation import gettext_lazy as _
from phonenumber_field.modelfields import PhoneNumberField
class User(AbstractUser):
# First Name and Last Name Do Not Cover Name Patterns
# ... |
from rllab.core.serializable import Serializable
from rllab.spaces.box import Box
from rllab.exploration_strategies.base import ExplorationStrategy
import numpy as np
class RandomStrategy(ExplorationStrategy, Serializable):
"""
This strategy always output a random action
"""
def __init__(self, env_spec):
... |
# to jest komentarz
import pgzrun
WIDTH = 1280
HEIGHT = 847
def draw():
screen.blit("ptak-tlo-1280x847", (0,0))
pgzrun.go()
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.