text stringlengths 3.07k 12.6k |
|---|
import pymongo, time, datetime, os
# Parsing related modules
import AutoInject.bin.build_From_Source as bfs
import AutoInject.bin.github_Parser as gp
import AutoInject.bin.patch_Handler as ph
import AutoInject.bin.system_Functions as sf
import AutoInject.bin.website_Parser as wp
from pymongo ... |
from copy import deepcopy
import json
import globus_sdk
# *************************************************
# * Globus Search utilities
# *************************************************
SEARCH_INDEX_UUIDS = {
"mdf": "1a57bbe5-5272-477f-9d31-343b8258b7a5",
"mdf-test": "5acded0c-a534-45af-84be-dcf042e36412"... |
# -*- coding: utf-8 -*-
import json
import re
import scrapy
from locations.items import GeojsonPointItem
BRAND_MAP = {
"hj": "hojo",
"HJ": "hojo",
"hojo": "HJ",
"lq": "laquinta",
"LQ": "laquinta",
"laquinta": "LQ",
"di": "days-inn",
"DI": "days-inn",
"days-inn": "DI",
"bh": "haw... |
# Copyright 2009-present MongoDB, 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 to in wri... |
# backup.py - Simple and flexible backup algorithm written for humans
__license__ = 'MIT'
__author__ = '<NAME>'
__email__ = '<EMAIL>'
from os import chdir
from os import name
from os import walk
from os import rename
from os import makedirs
from os import remove
from os.path import join as join_path
... |
MODES = ['I','D','R']
class GrowingList(list):
def __auto_extend__(self, index):
max_len = 0
if isinstance(index, slice):
ix_max = max(index.start, index.stop)
if ix_max >= len(self):
max_len = ix_max
elif index >= len(self):
max_len = ind... |
import glob
import os
import re
import pandas
import argparse
import numpy as np
import matplotlib.pyplot as plt
def isqrt(n):
x = n
y = (x + 1) // 2
while y < x:
x = y
y = (x + n // x) // 2
return x
def choose_color(is_cliff, index):
cliff_colors = ["maroon", "red", "orange", "g... |
# Python program to create
# Image Classifier using CNN
# Importing the required libraries
import cv2
import os
import numpy as np
from random import shuffle
from tqdm import tqdm
import tflearn
from tflearn.layers.conv import conv_2d, max_pool_2d
from tflearn.layers.core import input_data, dropout, fully_co... |
from typing import Union, Tuple
import logging
import numpy as np
import pandas as pd
"""
These routines drive all type inference for the schema generation and the
FBS (REST OTA) encoding.
H5AD Type REST REST
(ndarray, Series, Index) FBS encoding schema type ERRO... |
from core import auth
from core.menu import generate_menu
from core.models import Blog, template_tags, Category, PageCategory
from core.models.transaction import transaction
from core.libs.bottle import template, request, redirect
from settings import BASE_URL
from . import search_contexts, report
def new_category(blo... |
""" pytest -s -p no:warnings test_onnx_io.py
"""
import os
import sys
sys.path.append(os.path.join(os.path.dirname(os.path.abspath(__file__)), "../.."))
import torch
import inspect
import numpy as np
from backend import AnalyticMarching
from backend import MLP
from backend import save_model, load_model
DIR = os.path.j... |
from datetime import datetime
from django.contrib.auth import get_user_model
from django.db import transaction
from pytz import timezone
from centers.models import Center
User = get_user_model()
def update_tournament_with_soup(tournament, soup):
name = get_name(soup)
if name:
tournament.name = name... |
import logging
import os
import shutil
import tempfile
import uuid
from typing import Tuple, List, Text, Set, Union, Optional
import re
import rasa.utils.io as io_utils
from rasa.skill import SkillSelector
logger = logging.getLogger(__name__)
def get_core_directory(
paths: Optional[Union[Text, List[Text]]],
... |
# Copyright (C) 2019 The Raphielscape Company LLC.
#
# Licensed under the Raphielscape Public License, Version 1.c (the "License");
# you may not use this file except in compliance with the License.
#
# C O D E A Z - Samil
from userbot.events import register
from userbot import CMD_HELP, bot, LOGS, CLEAN_WELCOME, BO... |
"""
``StatsNbaPossessionLoader`` loads possession data for a game and
creates :obj:`~pbpstats.resources.possessions.possession.Possession` objects for each possession
The following code will load possession data for game id "0021900001" from a
pbp file located in the ``/pbp`` subdirectory of the ``/data`` directory
.... |
"""
Copyright (c) 2021, <NAME>
All rights reserved.
This source code is licensed under the BSD-style license found in the
LICENSE file in the root directory of this source tree.
------------------------------------------------------
Encryption Suite: loq api
Tools for encrypting files, and interacting with encrypte... |
"""All functions related to generating quality metrics."""
import os
import numpy as np
import open3d
import pymesh
import cv2
import json
from depthquality import transformations as tfms
from depthquality.fiducials import detect_arucos
def align_pointcloud_to_reference(
reference_mesh, rgb_filename, camera_m... |
#!/usr/bin/env python
import optparse
import os
import sys
import tempfile
import shutil
import subprocess
import re
import logging
assert sys.version_info[:2] >= (2, 6)
log = logging.getLogger(__name__)
working_directory = os.getcwd()
tmp_stderr_name = tempfile.NamedTemporaryFile(dir=working_directory, suffix='.stde... |
import asyncio
from inspect import iscoroutinefunction
from typing import Any, Union
from unittest.mock import Mock
import yaml
from behave import given, then, when # type: ignore
from mqtt_io.exceptions import ConfigValidationFailed
from mqtt_io.mqtt import MQTTMessage, MQTTMessageSend
from mqtt_io.server import Mqt... |
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
import copy
import optparse # pylint: disable=deprecated-module
import re
from pylint import utils
# pylint: disable=unused-argument
def _csv_validator(_, name, value):
... |
# Copyright 2019 The Android Open Source Project
#
# 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... |
# Copyright (c) 2006, 2008-2010, 2012-2014 LOGILAB S.A. (Paris, FRANCE) <<EMAIL>>
# Copyright (c) 2014-2016 <NAME> <<EMAIL>>
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
# For details: https://github.com/PyCQA/pylint/blob/master/COPYING
"""diagram objects
"""
import astroid
from p... |
import shlex
from typing import List
from dataclasses import dataclass
from azul import config
from azul.deployment import aws
from azul.objects import InternMeta
from azul.template import emit
@dataclass(frozen=True)
class Lambda:
"""
Represents a AWS Lambda function fronted by an AWS API Gateway.
"""
... |
from __future__ import division
import os
import sys
import argparse
import json
import torch
import torch.nn as nn
from torch import cuda
import table
import table.Models
import table.ModelConstructor
import table.modules
from table.Utils import set_seed
import opts
from tensorboard_logger import Logger
from path im... |
#!/usr/bin/env python
# coding: utf-8
# # Desafio 5
#
# Neste desafio, vamos praticar sobre redução de dimensionalidade com PCA e seleção de variáveis com RFE. Utilizaremos o _data set_ [Fifa 2019](https://www.kaggle.com/karangadiya/fifa19), contendo originalmente 89 variáveis de mais de 18 mil jogadores do _game_ FI... |
# -*- coding: utf-8 -*-
# Copyright 2018 The Blueoil 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
#
# Unles... |
#!/usr/bin/env python
import os, argparse, tempfile, operator, pickle
from collections import defaultdict
import pybedtools, pysam
def rev_comp(str):
"""
Given a DNA string, returns the reverse complement
>>> rev_comp("AATTGGCC")
'GGCCAATT'
"""
rev_dic = {'A':'T','G':'C','C':'G','T':'A'}
return ''.join([rev_d... |
"""Config flow for Sonarr."""
import logging
from typing import Any, Dict, Optional
from sonarr import Sonarr, SonarrAccessRestricted, SonarrError
import voluptuous as vol
from homeassistant.config_entries import CONN_CLASS_LOCAL_POLL, ConfigFlow, OptionsFlow
from homeassistant.const import (
CONF_API_KEY,
CO... |
#!/usr/bin/env python3
# daemon12.py measures the CPU load.
# uses moving averages
import configparser
import os
import sys
import syslog
import time
import traceback
from mausy5043libs.libdaemon3 import Daemon
import mausy5043funcs.fileops3 as mf
# constants
DEBUG = False
IS_JOURNALD = os.path.isfile('/bin/j... |
import sys
import json
import time
use_periphery = False
use_serial_lock = False
if sys.implementation.name == 'cpython':
if sys.platform == "linux" or sys.platform == "linux2":
use_periphery = True
from periphery import I2C
use_serial_lock = True
from filelock import Timeout, Fil... |
import unittest
import os
import json
from pathlib import Path
from RecordedFuture import (
lookup_command,
Client,
enrich_command,
get_alert_rules_command,
get_alerts_command,
get_alert_single_command,
triage_command,
)
from CommonServerPython import CommandResults
import vcr as vcrpy
CAS... |
import discord
from modules.botModule import *
import shlex
from tinydb import TinyDB, Query
import datetime
import asyncio
import requests
import modules.reactionscroll as rs
class NOAAScrollable(rs.Scrollable):
def preprocess(self, data): # Ok this actually does nothing
return data
def refresh(self... |
import collections
import copy
import numpy as np
from pyquaternion import Quaternion
from ..base import RandomizationError
from ....util import Qpos
from ... import transform_utils as T
class ObjectPositionSampler:
"""Base class of object placement sampler."""
def __init__(self):
pass
def set... |
import numpy as np
from algos import learn, policy
from env import LoopEnv
from utils import sample_demos, prob_dists
import argparse
import copy
import matplotlib.pyplot as plt
import os
from tqdm import tqdm
from mdp.borlangeworld import BorlangeWorld
import multiprocessing as mp
def get_args():
parser = argpar... |
import datetime
import os
import threading
import time
import pickle
try:
import pymongo
import pymongo.errors
import bson
except ImportError:
pymongo = None
bson = None
from beaker.container import NamespaceManager
from beaker.synchronization import SynchronizerImpl
from beaker.util import SyncDi... |
#!/usr/bin/python
# encoding: utf-8
"""
rcsb.py
For functions relating to getting data from the RCSB.
Created by <NAME> 2011/2012
"""
import os
import io
from io import BytesIO
import urllib.request, urllib.parse, urllib.error
import gzip
import shlex
from klab.comms.http import Connection
from klab.fs.fsio import r... |
# Copyright 2020-2021 Leibniz Information Centre for Economics
#
# 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 applic... |
import youtube_dl
import asyncio
import discord
import os
from discord.ext import commands
from myQueue import Queue
TOKEN = os.environ['token']
intents = discord.Intents.default()
intents.members = True
client = commands.Bot(command_prefix = '!', intents = intents, help_command = None)
q = Queue()
ytdl_format_opt... |
# 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 applic... |
# Copyright (c) Facebook, Inc. and its affiliates.
import argparse
import logging
import matplotlib.pyplot as plt
import numpy as np
import os
import random
import torch
import torch.nn as nn
from fairmotion.tasks.motion_prediction import generate, utils, test
from fairmotion.utils import utils as fairmotion_utils
... |
from re import I
import esphome.codegen as cg
import esphome.config_validation as cv
from esphome.components import sensor
from esphome.const import (
CONF_ID,
DEVICE_CLASS_EMPTY,
STATE_CLASS_MEASUREMENT,
UNIT_EMPTY,
UNIT_METER,
)
# DEPENDENCIES = ["i2c"]
AUTO_LOAD = ["sensor", "binary_sensor", "t... |
#!/usr/bin/env python2.5
#
# Copyright 2010 the Melange 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 applic... |
# This file is part of Buildbot. Buildbot 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, version 2.
#
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without eve... |
import random
import torch
import numpy as np
from torch_geometric.utils import degree, to_undirected
from .num_nodes import maybe_num_nodes
def negative_sampling(edge_index, num_nodes=None, num_neg_samples=None,
force_undirected=False):
r"""Samples random negative edges of a graph given b... |
'''
LinkedList and Node classes.
'''
class Node:
def __init__(self, value, node=None):
self.value = value
self.next_node = node
def get_next(self):
return self.next_node
def set_next(self, node):
self.next_node = node
def get_value(self):
return self.value
... |
#!/usr/bin/env python3
'''
Evaluate the classification potential of gene sets on a dataset.
'''
import argparse
import matplotlib.pyplot as plt
import numpy as np
import os
import pandas as pd
import random
import seaborn as sns
import sklearn.metrics
import sys
import utils
def plot_confusion_matrix(
name,
... |
# coding=utf-8
# Distributed under the MIT software license, see the accompanying
# file LICENSE or http://www.opensource.org/licenses/mit-license.php.
import argparse
import faulthandler
import logging
import threading
from os.path import expanduser
from mock import MagicMock
from twisted.internet import reactor
from... |
"""
Copyright (c) 2022 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 writin... |
""":mod:`mirgecom.boundary` provides methods and constructs for boundary treatments.
Boundary Treatment Interface
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.. autoclass FluidBoundary
Inviscid Boundary Conditions
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.. autoclass:: PrescribedFluidBoundary
.. autoclass:: DummyBoundary
.. autoclass:: Adiab... |
# -*- coding: utf-8 -*-
# MegEngine is Licensed under the Apache License, Version 2.0 (the "License")
#
# Copyright (c) 2014-2020 Megvii Inc. All rights reserved.
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT ARRANTI... |
import click
from code42cli.click_ext.types import MagicDate
from code42cli.click_ext.types import TOTP
from code42cli.cmds.search.options import AdvancedQueryAndSavedSearchIncompatible
from code42cli.cmds.search.options import BeginOption
from code42cli.date_helper import convert_datetime_to_timestamp
from code42cli.... |
# TO DO
# - add cycle for each resource
# - add tab ability to go to next resource
# - add tracking support for states with corresponding tags to enable sub rule
# files
import json
import os
from time import sleep
from talon import Context, Module, actions, ctrl, settings, ui
from talon_plugins.eye_mouse import confi... |
import numpy as np
import pandas as pd
from scipy.special import lmbda
np.random.seed(999) # Force same random sequence for each test
from sklearn.linear_model import LinearRegression, Ridge, Lasso, LogisticRegression
from sklearn.datasets import load_boston
from sklearn.model_selection import train_test_split
from s... |
'''
Workers to run in processes
'''
import pickle
import numpy as np
def load_worker(args):
'''
Load the model weights
Arguments:
args -- [weights_file]
Returns:
The weights list from the weights_file
'''
weights_file = args[0]
with open(weights_file, 'rb') as file:
... |
import numpy as np
import matplotlib.pyplot as plt
from matplotlib import cm
from matplotlib.widgets import Slider
from matplotlib.patches import FancyArrowPatch
from mpl_toolkits import mplot3d
from itertools import chain
from matplotlib import rcParams
# rcParams['text.usetex'] = True
# rcParams['text.latex.preamble'... |
#!/usr/local/bin/python3
import collections
import os
IN = 1
OUT = 2
with open("input.txt") as f:
program = [int(word) for word in f.readline().split(",")]
class VM(object):
def __init__(self, program, input=None):
self.program = collections.defaultdict(int)
for i, instruction in enumerate(p... |
# This file is part of h5py, a Python interface to the HDF5 library.
#
# http://www.h5py.org
#
# Copyright 2008-2013 <NAME> and contributors
#
# License: Standard 3-clause BSD; see "license.txt" for full license terms
# and contributor agreement.
import sys
import os
import shutil
import inspect
import temp... |
"""
This is a dual-purpose lambda function that handles creation of an SSH key
from within a CloudFormation template.
It is used as a macro that transforms a template with an EC2 resource. If the
resource has a KeyName property with a value that starts with AutoGenerate, the
template will be transformed to include ... |
# Copyright (c) 2020 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 app... |
# Lint as: python3
# Copyright 2019, The TensorFlow Federated 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 ... |
# Copyright 2020,2021 Sony Corporation.
# Copyright 2021 Sony Group 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 ... |
import tempfile
import numpy as np
import theano
import theano.tensor as T
from scipy import stats
from neupy import layers, algorithms, storage
from neupy.utils import asfloat
from neupy.exceptions import LayerConnectionError
from neupy.layers.normalization import find_opposite_axes
from base import BaseTestCase
fr... |
from os.path import join
from os.path import relpath
from re import compile
from contextlib import contextmanager
from ..staging import COMMAND_VERSION_FILENAME
from ..action_mapper import FileActionMapper
from logging import getLogger
log = getLogger(__name__)
# All output files marked with from_work_dir attribute... |
from random import sample
from flask import Flask, request, jsonify, make_response
from werkzeug.security import generate_password_hash, check_password_hash
import uuid
import jwt
import datetime
from functools import wraps
from backend import app
from backend.users_db import Users
from flask_cors import cross... |
# -*- coding: utf-8 -*-
from __future__ import division, print_function
import numpy as np
from scipy.signal import remez, freqz
import matplotlib.pyplot as plt
def bellanger_estimate(deltap, deltas, width, fs):
"""
Estimate the number of taps required for the given filter specifications.
"""
n = (-... |
# Copyright 2016 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... |
# pyflyby/_format.py.
# Copyright (C) 2011, 2012, 2013, 2014 <NAME>.
# License: MIT http://opensource.org/licenses/MIT
from __future__ import absolute_import, division, with_statement
import six
class FormatParams(object):
max_line_length = 79
wrap_paren = True
indent = 4
hanging_indent = 'never'
... |
import os
from dagster import (
Enum,
EnumValue,
Failure,
Field,
InputDefinition,
Noneable,
Nothing,
OutputDefinition,
Permissive,
check,
solid,
)
from .utils import execute, execute_script_file
def shell_solid_config():
return {
"env": Field(
None... |
#!/usr/bin/env python
from __future__ import print_function
import unittest
import shutil
import sys
"""
test_transform_with_no_re_matches.py
test messages with no regular expression matches
"""
import os
tempdir = os.path.relpath(os.path.abspath(os.path.splitext(__file__)[0])) + "/"
# add grandparent... |
# File : transformer.py
# Author : <NAME>
# Email : <EMAIL>
import logging
import torch
import torch.nn as nn
from otrans.module.pos import PositionalEncoding
from otrans.module.ffn import PositionwiseFeedForward
from otrans.module.attention import MultiHeadedSelfAttention, MultiHeadedSelfAttentionWithRelPos
logg... |
import numpy as np
class NetworkBase(object):
def __init__(self, ntw, pointpattern,nsteps=10,
permutations=99, threshold=0.5,
distribution='poisson',
lowerbound=None,upperbound=None):
self.ntw = ntw
self.pointpattern = pointpattern
self.n... |
"""
An adapter to WeatherAPI (https://www.weatherapi.com/).
"""
import logging
import urllib.parse
from datetime import date
from datetime import datetime
from datetime import timedelta
from datetime import timezone
from typing import Any
from typing import cast
from typing import Dict
from typing import Iterator
from ... |
#====================== BEGIN GPL LICENSE BLOCK ======================
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later vers... |
from __future__ import annotations
import numpy as np
import pytest
from pytest import approx
from hist import Hist, axis, intervals
@pytest.fixture(scope="session")
def hist_fixture():
np.random.seed(42)
hist_1 = Hist(
axis.Regular(
10, -3, 3, name="X", label="x [units]", underflow=Fal... |
import io
import math
from gws.ext.ows.provider.wmts.types import TileMatrix, TileMatrixSet
import gws
import gws.types as t
import gws.lib.metadata
import gws.base.ows.service as ows
import gws.lib.extent
import gws.lib.gml
import gws.lib.legend
import gws.lib.proj
import gws.lib.render
import gws.lib.shape
import g... |
import random
from abc import ABC, abstractmethod
from collections import deque
from enum import Enum, unique
from operator import itemgetter
from typing import Tuple, NamedTuple, Hashable, Optional
import gym
import numpy as np
import os
os.environ['PYGAME_HIDE_SUPPORT_PROMPT'] = "hide"
import pygame
from gym import ... |
def load_data_set():
data_set = [['面包', '黄油', '尿布','啤酒'],
['咖啡', '糖','小甜饼','鲑鱼','啤酒'],
['面包', '黄油','咖啡','尿布','啤酒','鸡蛋'],
['面包', '黄油', '鲑鱼','鸡'],
['鸡蛋', '面包','黄油'],
['鲑鱼', '尿布','啤酒'],
['面包', '茶','糖鸡蛋'],
... |
#!/usr/bin/env python
#-*- coding: utf-8 -*-
##---------------------------------------------------------------------------------------
# Styles, Fonts, Colors
#
##---------------------------------------------------------------------------------------
import kivy
from kivy.utils import get_color_from_hex
import random... |
from django_filters import CharFilter, FilterSet, NumberFilter, OrderingFilter
import graphene
from graphene_django.types import DjangoObjectType
from graphene_django.filter import DjangoFilterConnectionField
from graphql import GraphQLError
from graphql_relay import from_global_id
from coordinator.api.models.release_... |
# Copyright (c) 2020, <NAME>
# Licensed under the BSD 3-clause license (see LICENSE.txt)
# ---------------------------------------------------------
# Helper functions for influence functions'
# computation in Pytorch
# ---------------------------------------------------------
from __future__ import division
from _... |
from django.contrib.auth import get_user_model
from django.urls import reverse
from django.test import TestCase
from rest_framework import status
from rest_framework.test import APIClient
from mainapp.models import Tag, Recipe
from recipe.serializers import TagSerializer
TAGS_URL = reverse('recipe:tag-list')
def... |
import os
import pandas as pd
import numpy as np
import nips15
folds_dir = 'models/jmlr/folds'
demographic = ['female', 'afram']
molecular = ['aca', 'scl']
pfvc_spec = {'t':'years_seen_full', 'y':'pfvc', 'x1':demographic, 'x2':demographic + molecular}
pfvc = pd.read_csv('data/benchmark_pfvc.csv')
pfvc_pd = [nips15.... |
from nmigen import (
Cat,
C,
Elaboratable,
Signal,
Module
)
from nmigen.build import Platform
class UART(Elaboratable):
"""
Parameters
----------
divisor : int
Set to ``round(clk-rate / baud-rate)``.
E.g. ``12e6 / 115200`` = ``104``.
Based off of the nmigen exam... |
from datetime import timedelta
from dateutil import relativedelta
from django.core.exceptions import ValidationError
from django.db import models
from django.utils import timezone
from holidays.models import Holiday
from piony import const
def podziel_liste_dni(v):
v = v.strip()
if not v:
return
... |
# -*- coding:utf-8 -*-
# ##### BEGIN GPL LICENSE BLOCK #####
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# ... |
#
# GeomProc: geometry processing library in python + numpy
#
# Copyright (c) 2008-2021 <NAME> <<EMAIL>>
# under the MIT License.
#
# See file LICENSE.txt for details on copyright licenses.
#
"""This module contains auxiliary functions of the GeomProc geometry
processing library.
"""
import numpy as np
import math
im... |
import pygame
from gameSprites import *
TYPE_LIST = ("不出","单张","对子","三张","三带一","顺子","炸弹") #-1为非法
class CardList(object):
'''牌组类'''
def __init__(self, pos , partition):
self.index_l = []
self.group = pygame.sprite.Group() #牌类精灵组
self.partition = partition #间隔占比
self.pos = pos #起始... |
from torch.utils.data import Dataset, DataLoader, WeightedRandomSampler
import random
import csv
import os
import json
from collections import Counter
import torch
from torchvision import transforms
from PIL import Image
# helper function for extracting UI elements from hierarchy
def add_screen_elements(tree, elemen... |
# -*- coding=UTF-8 -*-
# pyright: strict
"""template matching. """
import datetime as dt
import logging
import os
import pathlib
from typing import Dict, Iterator, Optional, Set, Text, Tuple, Union
import cv2
import numpy as np
from PIL.Image import Image
from PIL.Image import open as open_image
from . import clien... |
import capstone
import struct
class BinaryDisassembler(object):
def set_org(self, org):
pass
def disassemble_unknown_region(self, region, data):
pass
def disassemble_code_region(self, region, data):
pass
def disassemble_data_region(self, region, data):
pass
def disas... |
import frappe
from frappe import _
from frappe.custom.doctype.custom_field.custom_field import create_custom_fields
def get_setup_stages(args=None):
return [
{
"status": _("Setting up Shopify"),
"fail_msg": _("Failed to create Shopify masters"),
"tasks": [
{
"fn": setup_custom_fields,
"args"... |
"""Data preprocessing functions for DeepSpeech distances.
Based on NVIDIA's OpenSeq2Seq's code:
https://github.com/NVIDIA/OpenSeq2Seq/blob/master/open_seq2seq/data/speech2text/speech2text.py
https://github.com/NVIDIA/OpenSeq2Seq/blob/master/open_seq2seq/data/speech2text/speech_utils.py
"""
import io
import os
import ... |
import collections
import contextlib
import logging
import pygame
from pyradiator.app_state import ApplicationState
from pyradiator.command_line_args import get_configuration
from pyradiator.command_line_args import is_quiet_mode
from pyradiator.common import PrintText
from pyradiator.common import create_font
from p... |
import argparse
import json
import re
import requests
import subprocess
import os
import pathlib
import toml
# See https://pkg.go.dev/gitlab.com/ignitionrobotics/web/cloudsim/simulations for original names
WORLDS = dict(
tq = "Tunnel Qualification",
ts1 = "Simple Tunnel 1", # Yes, tunnel has swapped word "s... |
# -*- coding: utf-8 -*-
__author__ = "<NAME>"
import os
import sys
import tensorflow as tf
from keras.layers import Layer, RNN
from keras import activations
sys.path.append(os.path.abspath('../'))
from utils.keras_helpers import *
from ops.complex_ops import *
#---------------------------------------------------... |
import tensorflow as tf
import numpy as np
def vgg16_backbone(img_shape):
original = tf.keras.applications.VGG16(include_top=False, \
weights='imagenet', \
input_tensor=None, \
input_shape=img_shape
... |
# Copyright 2019-2020 ETH Zurich and the DaCe authors. All rights reserved.
""" Loop detection transformation """
import sympy as sp
import networkx as nx
import typing
from typing import AnyStr, Optional, Tuple, List
from dace import sdfg as sd, symbolic
from dace.sdfg import utils as sdutil
from dace.transformation... |
"""
Cluster module implements k-meas cluster reduction of potentials. WIP at this moment.
[1] <NAME> & <NAME>. (2011). Ckmeans.1d.dp: Optimal k-means Clustering
in One Dimension by Dynamic Programming. The R Journal. 3. 29-33. 10.32614/RJ-2011-015.
"""
import bisect
import collections
import dataclasses
import math
im... |
import pytest
import itertools
from web_stats import WebStat
from console_writer import ConsoleWriter, WebPerformanceDashboard
from website import Website
from collections import deque
import datetime
"""
Fixtures
"""
@pytest.fixture
def alert_datetimes():
d = {
"25_0": datetime.datetime(2020, 1, 22, 12,... |
""" based on https://github.com/niladri18/Phidl/blob/master/src/ppe.py
"""
import math
from typing import List, Tuple
import pp
from pp.component import Component
@pp.cell
def line(
x0: float, y0: float, width: float, height: float, layer: Tuple[int, int],
) -> Component:
L = pp.Component()
L.add_polygo... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.