text stringlengths 3.07k 22.1k |
|---|
#!/usr/bin/env python
# encoding: utf-8
# File Name: predict.py
# Author: <NAME>
# Create Time: 2017/07/17 21:57
# TODO:
import warnings
warnings.filterwarnings("ignore")
import os
import pickle as pkl
import numpy as np
import scipy.sparse as sp
import scipy.io
import argparse
import logging
from sk... |
#!/usr/bin/env python
"""Provides scikit interface."""
from toolz import curry, compose
from collections import deque
from collections import defaultdict
import networkx as nx
from ego.component import convert
from ego.component import get_subgraphs_from_graph_component
_bitmask_ = 4294967295
def fast_hash_1(dat, ... |
import datetime
import decimal
import uuid
from dateutil.relativedelta import relativedelta
from django.db import transaction
from django.db.models import Sum
from django.http import HttpResponse
from django.utils.translation import ugettext_lazy as _
from django_filters.rest_framework import DjangoFilterBackend
from ... |
import pandas as pd
import pandas.testing as pdt
import sdmx
from sdmx import message, model
from . import MessageTest
from .data import specimen
class DataMessageTest(MessageTest):
path = MessageTest.path / "ECB_EXR"
class TestGenericFlatDataSet(DataMessageTest):
filename = "ng-flat.xml"
... |
import os
from ray import tune
from ray.tune.suggest.hyperopt import HyperOptSearch
from ray.tune.suggest.bayesopt import BayesOptSearch
from ray.tune.suggest.basic_variant import BasicVariantGenerator
from ray.tune.schedulers import FIFOScheduler, ASHAScheduler, MedianStoppingRule
from ray.tune.suggest import Concurre... |
#!/usr/bin python
# -*- coding:utf-8 -*-
"""
"""
import random
#
import numpy as np
# import seaborn as sns
import matplotlib.colors as mcolors
import matplotlib.text as pltext
from matplotlib.collections import PatchCollection
import matplotlib.pyplot as plt
# ####################################################... |
import traceback
import datetime
import os
"""
reqs
1. generate teams based on the following constraints
-all teams get same number of games
-reffing is as balanced as possible
-reffing must before or after play
-cannot play/ref in more than one court at a time
stretch objectives:
1. minimize:
-[wi... |
#!/usr/bin/env python
import numpy as np
from collections import Counter
"""
<NAME>, <EMAIL>
k-medoid clustering usin partition around medoid (PAM) algorithm. Maybe FasterPAM will be added in the future.
It takes time to digest the paper.
"""
def farthest_search(dist_mat, k):
"""
Farthest-first traversal:
... |
#!/usr/bin/env python
import click, rdflib, glob, os
from rdflib.namespace import Namespace
from rdflib.plugins.sparql import prepareQuery
import xml.etree.ElementTree as ET
from xml.sax._exceptions import SAXParseException
class NoSkosSchemeException(Exception):
pass
class InvalidTemplateException(Exception):
... |
#!/usr/bin/env python3.8
import argparse
import logging
import pathlib
import re
import typing
from dataclasses import dataclass, field
from typing import Dict, Generator, List, Optional, Tuple, Union
import apischema
import lark
from . import transformer
from .common import FullLoadContext, StringWithContext, contex... |
# -*- coding: utf-8 -*-}
import logging
import math
from flask import g
from flask import request, current_app
from flask_babel import gettext
from flask_restful import Resource
from sqlalchemy import or_, and_
from app_auth import requires_auth
from schema import *
_ = gettext
log = logging.getLogger(__name__)
de... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Mar 20 13:18:37 2019
@author: Luke
"""
#==============================================================================
# SUMMARY
#==============================================================================
# 06 April 2020
# This script is used t... |
from bs4 import BeautifulSoup as BS
from urllib.parse import urlparse
from PIL import Image
import requests
import pathlib
import os
import re
import math
import urllib3
import json
# Links
artLink = "https://nookipedia.com/wiki/Art"
bugLink = "https://animalcrossing.fandom.com/wiki/Bugs_(New_Horizons)"
fishLink =... |
# -*- coding: utf-8 -*-
# Copyright 2016 Resonai Ltd. 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 requir... |
'''
Author: Tiexin
Time: 2019-8-15
'''
from __future__ import print_function
import sys
import time
import numpy as np
import scipy as sp
import scipy.stats
import torch
import torch.nn.functional as F
from .averagemeter import AverageMeter, ProgressMeter
from network.net_tools import one_hot
from preprocess.visualize... |
import logging
import warnings
from typing import Any, Dict, Optional
from airflow.models import BaseOperator
from airflow.utils.decorators import apply_defaults
from airflow_dbt.dbt_command_config import DbtCommandConfig
from airflow_dbt.hooks import DbtCliHook, DbtCloudBuildHook
class DbtBaseOperator(BaseOperator... |
import esphome.codegen as cg
import esphome.config_validation as cv
from esphome.components import (
ble_client,
climate,
switch,
sensor,
text_sensor,
binary_sensor,
number,
select,
)
from esphome.const import (
CONF_ENTITY_CATEGORY,
CONF_ICON,
CONF_ID,
CONF_INVERTED,
... |
"""
Class Features
Name: drv_data_io_geo
Author(s): <NAME> (<EMAIL>)
Date: '20180521'
Version: '2.0.7'
"""
######################################################################################
# Library
import logging
import numpy as np
from os.path import isfile, join
from src.common.... |
"""BleBox climate entities tests."""
import json
from blebox_uniapi.box_types import get_latest_api_level
from .conftest import CommonEntity, DefaultBoxTest, future_date, jmerge
# TODO: remove
SUPPORT_TARGET_TEMPERATURE = 1
HVAC_MODE_OFF = "hvac mode off"
HVAC_MODE_HEAT = "hvac mode heat"
CURRENT_HVAC_OFF = "current... |
# -*- coding: utf-8 -*-
# author: liuxu
import os
import threading
import hashlib
import urllib
import webbrowser
import Tkinter
import tkFont
from Tkinter import Label
from Tkinter import Entry
from Tkinter import Button
from Tkinter import Frame
from Tkinter import LabelFrame
from Tkinter import Menu
from PIL import... |
# 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
# d... |
from sim import simulation
import pymunk
import pymunk.pygame_util
import pygame
_scale = 500
def run(sim: simulation.Simulation, inputs_functions, post_tick_functions, pef_brain):
pygame.init()
pygame.font.init()
font = pygame.font.SysFont("Helvetica", 16)
screen: pygame.Surface = pygame.display.se... |
#Copyright 2014 <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, software
#d... |
"""
This module contains file- and path-related methods, classes, and modules.
"""
from __future__ import with_statement, absolute_import
__docformat__ = "restructuredtext en"
# ---------------------------------------------------------------------------
# Imports
# ---------------------------------------------------... |
import itertools
import numpy
import pytest
from helpers import *
from reikna.helpers import product
from reikna.dht import DHT, harmonic, get_spatial_grid
import reikna.cluda.dtypes as dtypes
class FunctionHelper:
"""
Encapsulates creation of functions in mode and coordinate space used for DHT tests.
"... |
import os
import sys
import json
import yaml
import pandas as pd
from ananke.graphs import ADMG
from networkx import DiGraph
from optparse import OptionParser
sys.path.append(os.getcwd())
sys.path.append('/root')
from src.causal_model import CausalModel
from src.generate_params import GenerateParams
def config_optio... |
# standard imports
import datetime
import time
import os
from os import path
import platform
import signal
import pygame
from pygame.locals import QUIT, VIDEORESIZE, KEYDOWN, K_q
import requests
# local imports
import config
def exit_gracefully(signum, frame):
sys.exit(0)
signal.signal(signal.SIGTERM, exit_grace... |
import threading
import time
# import module GUI
from tkinter import *
from tkinter.font import *
# internal module
from p2pchat import *
__version__ = "0.1-beta"
def rgb2hex(r , g, b):
return f'#{r:02x}{g:02x}{b:02x}'
def window_create_connection(event = None):
# some special function
def submitConnec... |
# -*- coding: utf-8 -*-
'''Chemical Engineering Design Library (ChEDL). Utilities for process modeling.
Copyright (C) 2017 <NAME> <<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 ... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from os.path import join
from os.path import dirname
from os.path import exists
import psutil
import numpy as np
import nibabel as nib
from joblib import Parallel, delayed
from scipy.ndimage.morphology import... |
import numpy as np
from sklearn.preprocessing import scale,StandardScaler
import torch
import torch.utils.data as Data
import math
import torch.nn as nn
from sklearn.metrics import confusion_matrix, classification_report,accuracy_score
def gpu_available():
use_gpu = torch.cuda.is_available()
return use_gpu
de... |
import json
import os
import functools
import logging
from collections import defaultdict, namedtuple
from typing import Collection, Dict, List, Optional, Tuple, Union
import flask as flask
LOCALHOST_ORIGIN = "http://localhost:3000"
# ------------------------------------------------------------------------------
#... |
import re
from test.utils import SIMPLE_PATH
import pytest
import requests
from hypothesis import given, settings
import schemathesis
from schemathesis.constants import USER_AGENT
from schemathesis.models import APIOperation, Case, Request, Response
def test_path(swagger_20):
operation = APIOperation("/users/{n... |
import glob
import requests
import hashlib
import binascii
from merkletools import MerkleTools
CHAINPOINT_CONTEXT = 'https://w3id.org/chainpoint/v2'
CHAINPOINT_HASH_TYPES = {'sha224': 'ChainpointSHA224v2',
'sha256': 'ChainpointSHA256v2',
'sha384': 'ChainpointSHA384v2',... |
###########################################
# Suppress matplotlib user warnings
# Necessary for newer version of matplotlib
import warnings
warnings.filterwarnings("ignore", category = UserWarning, module = "matplotlib")
#
# Display inline matplotlib plots with IPython
from IPython import get_ipython
get_ipython().run_... |
import pylatex
from pylatex.base_classes import Arguments as A
from pylatex import Command as C
from pylatex.utils import NoEscape as NE
import interface as db
def kreaturcommand(id, name, bes, klasse, kasten):
cmd = f"\kreatur{id}"
args = A(name, NE(bes), f"gfx/kreaturen/{klasse}", NE(kasten))
runs = C("... |
# coding: utf8
import time
import base64
import hashlib
from os import makedirs
def TransformationChiffres(chaine):
"""Fonction qui renvoi sous forme de la liste d'entiers correspont chacun à la valeur
unicode des caratères de la chaine précisée en arguments """
liste = list(chaine)
for index in r... |
#!/usr/bin/env python3
import math
import random
'''
The AutoSortedArray class encapsulates a list and arranges such that
if we add items one by one (using the .append() method), we do not have
to remember to sort the list after populating it-- items are inserted
in sorted order.
A binary search is done to determi... |
from __future__ import annotations
import itertools
import typing as t
import nltk.metrics as nltk_dist
import numpy as np
from arg_services.nlp.v1 import nlp_pb2
from scipy.spatial import distance as scipy_dist
from spacy.tokens import Doc, Span, Token # type: ignore
SpacyObj = t.Union[Doc, Token, Span]
# https:/... |
# Natural Language Toolkit: API for alignment and translation objects
#
# Copyright (C) 2001-2020 NLTK Project
# Author: <NAME> <<EMAIL>>
# <NAME> <<EMAIL>>
# <NAME> <<EMAIL>>
# <NAME> <<EMAIL>>
# URL: <http://nltk.org/>
# For license information, see LICENSE.TXT
import subprocess
from collecti... |
"""
Stakkr main controller. Used by the CLI to do all its actions
"""
import os
import subprocess
import sys
import click
from clint.textui import colored, puts, columns
from stakkr import command, docker_actions, os_patch, package_utils
from stakkr.configreader import Config
class StakkrActions():
"""Main class... |
from sklearn.model_selection import train_test_split
import pandas as pd
import tensorflow as tf
import tensorflow_hub as hub
from datetime import datetime
import bert
from bert import run_classifier
from bert import optimization
from bert import tokenization
from tensorflow import keras
import os
import... |
from common import ScanMode, ScanResult
import cv2
import itertools
import functools
import json
import numpy
import os
from typing import Dict, Iterator, List, Optional
# The expected color for the reactions background.
BG_COLOR = (254, 221, 244)
# The color of the middle dot on empty icons.
SELECT_COLOR = (166, 1... |
from __future__ import absolute_import, unicode_literals
import json
import sys
from django.contrib.contenttypes.models import ContentType
from django.core.urlresolvers import reverse, reverse_lazy
from django.http import HttpResponse, HttpResponseRedirect, JsonResponse
from django.utils import six
from django.utils... |
# Run Grtrans with rrjet model
# The rrjet model is defined in "fluid_model_rrjet.py"
# NOTE -- currently the power law emissivity is very slow because paralleization is off
# First make grtrans with 'make'
# Then run this in python
import numpy as np
import grtrans_batch as gr
import matplotlib.pyplot as plt
import... |
##########################################################################
#
# Copyright (c) 2012, <NAME>. All rights reserved.
# Copyright (c) 2013, Image Engine Design Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the f... |
# -*- test-case-name: yadis.test.test_etxrd -*-
"""
ElementTree interface to an XRD document.
"""
__all__ = [
'nsTag',
'mkXRDTag',
'isXRDS',
'parseXRDS',
'getCanonicalID',
'getYadisXRD',
'getPriorityStrict',
'getPriority',
'prioSort',
'iterServices',
'expandService',
'ex... |
import argparse
import os
import pytest
from shutil import rmtree, copytree
from afdko.makeinstancesufo import (
main as mkinstufo,
get_options,
_split_comma_sequence,
updateInstance,
)
from runner import main as runner
from differ import main as differ
from test_utils import get_input_path
TOOL = 'ma... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from unittest.mock import Mock
import colander
import pytest
from pyramid.exceptions import BadCSRFToken
from h.accounts import schemas
from h.services.user_password import UserPasswordService
pytestmark = pytest.mark.usefixtures("pyramid_config")
c... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import model
from tensorflow.keras import backend as K
from tensorflow.keras.constraints import max_norm
from tensorflow.keras.layers import BatchNormalization
from tensorflow.keras.layers import Conv2D, MaxPooling2D, AveragePooling2D
from tensorflow.keras.layers i... |
import json
import pytest
import pandas as pd
from pandas.testing import assert_frame_equal
from googleapiclient.errors import HttpError
from pysuite.sheets import Sheets, get_col_counts_from_range, get_column_number
from tests.test_auth import sheets_auth, multi_auth
from tests.test_drive import drive, drive_auth
fr... |
import os
os.environ['CUDA_VISIBLE_DEVICES'] = '3'
import sys
from tqdm import tqdm
import shutil
import argparse
import logging
import time
import random
import numpy as np
import matplotlib.pyplot as plt
plt.switch_backend('agg')
import torch
import torch.optim as optim
from torchvision import transforms
import torc... |
from design_baselines.data import StaticGraphTask, build_pipeline
from design_baselines.logger import Logger
from design_baselines.utils import spearman
from design_baselines.permmdtraining_rep_coms_cleaned.trainers import ConservativeObjectiveModel
from design_baselines.data import StaticGraphTask, build_pipeline
from... |
########################################################################
#
# Classes for optimizing and allocating portfolios of stocks.
#
# This version is for SINGLE-OBJECTIVE optimization. It has a lot of
# code in common with portfolio_multi.py but it is probably easier to
# read, understand and modify the code whe... |
"""Test Krylov methods."""
import numpy as np
from numpy.testing import (TestCase, assert_array_almost_equal,
assert_equal, assert_almost_equal)
from scipy.linalg import solve
import scipy.sparse as sparse
import pyamg
from pyamg.util.linalg import norm
from pyamg.krylov import bicgstab, cg,... |
from datetime import datetime
from ftplib import FTP, FTP_TLS, error_perm
from ftpretty.helpers import hash, split_file_info
from io import BytesIO, IOBase
from logging import basicConfig, DEBUG, debug, ERROR, error, getLogger, INFO, info
from os import listdir, path
from sys import exc_info, getsizeof
from time import... |
#!/usr/bin/env python
import os
import time
import re
from datetime import datetime
from contextlib import suppress
import requests
from google.cloud import pubsub
from google.cloud import storage
import pandas as pd
import dask.dataframe as dd
PROJECT_ID = os.getenv('PROJECT_ID', 'panoptes-survey')
# Storage
OBSER... |
#
# voice-skill-sdk
#
# (C) 2020, Deutsche Telekom AG
#
# This file is distributed under the terms of the MIT license.
# For details see the file LICENSE in the top directory.
#
#
# Test helpers
#
import csv
import yaml
import json
import gettext
import logging
import unittest
import datetime
from os import PathLike
... |
# Copyright 2021, 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 by applicable law o... |
"""
Determination of the echo top height from radar PPI data using the
Lakshmanan et al. (2013). method
@title: echotop
@author: <NAME> <<EMAIL>>
@date: 26/08/2021
@institution: Monash University
@reference: Lakshmanan et al. (2013), "An Improved Method for Estimating Radar
Echo-Top Height". Weather Forecas... |
#
# This file is part of the profilerTools suite (see
# https://github.com/mssm-labmmol/profiler).
#
# Copyright (c) 2020 mssm-labmmol
#
# 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 withou... |
import pytest
from aiocouch.database import Database
# All test coroutines will be treated as marked.
pytestmark = pytest.mark.asyncio
async def test_create_document(database: Database) -> None:
doc = await database.create("test_document")
# doc not yet saved, so it shouldn't be listed in the database
... |
import numpy as np
import random
import time
import re
COLOR_BLACK=-1
COLOR_WHITE=1
COLOR_NONE=0
#random.seed(0)
#don't change the class name
class AI(object):
#chessboard_size, color, time_out passed from agent
def __init__(self, chessboard_size, color, time_out):
self.chessboard_size = chessboard_size
... |
#
# Copyright (c) 2015-2021 <NAME> <tflorac AT ulthar.net>
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE... |
from __future__ import print_function
from tensorflow.keras.preprocessing.image import ImageDataGenerator
import numpy as np
import os
import glob
import skimage.io as io
import skimage.transform as trans
import cv2
from skimage import color
import time
import tensorflow as tf
from PIL import Image
import configparser... |
import sys
import requests
from lxml import etree
import pandas as pd
import re
import json
from pkg_resources import resource_filename
from pytaxize.refactor import Refactor
class NoResultException(Exception):
pass
def names_list(rank = 'genus', size = 10):
'''
Get a random vector of species names.
... |
from openpyxl import Workbook, load_workbook
import argparse
import odm as ODM
import supporting_docs as SD
from odmlib import odm_parser as P
from odmlib.define_2_1.rules import metadata_schema as METADATA
from odmlib.define_2_1.rules import oid_ref as OID
import xmlschema as XSD
import os.path
import Study, Standards... |
import time
import gc
import itertools as it
import os,math
import pydub
import os.path as osp
from typing import List
import warnings
from collections import deque, namedtuple
from fairseq.data import Dictionary
import fairseq
import soundfile as sf,wave
import numpy as np
import torch
import urllib.request
from examp... |
#!/usr/bin/env python
# encoding: utf-8
# The MIT License (MIT)
# Copyright (c) 2014-2019 CNRS
# 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 limita... |
import warnings
warnings.filterwarnings('ignore', category=DeprecationWarning)
import os
os.environ['MKL_SERVICE_FORCE_INTEL'] = '1'
os.environ['MUJOCO_GL'] = 'osmesa'
os.environ['MESA_GL_VERSION_OVERRIDE'] = '3.3'
os.environ['MESA_GLSL_VERSION_OVERRIDE'] = '330'
from pathlib import Path
import hydra
import numpy... |
"""``chameleon`` integration.
The engine returned by the template's ``pt_getEngine`` decides
whether the ``zope.tales`` or
the ``chameleon.tales`` TALES implementation is used:
``zope.tales`` is used when the engine is an instance of
``zope.pagetemplate.enging.ZopeBaseEngine``,
``chameleon.tales`` otherwise. This cou... |
# This file is the main file for my program. For this assignment, I decided to research
# the NetworkX library for Python. In this file, I generate an undirected, weighted graph
# and process the graph algorithm using the following three algorithms: A*, Triangles, and
# PageRank. Each algorithm processes a different a... |
#!/usr/bin/env python3
import math
import get_sample_data
import numpy as np
import nlopt
favorites = [
'SLSQP',
'cmaes',
'ImFil',
'Nomad',
# 'Bobyqa', # This version of bobyqa lacks quick termination
nlopt.LN_NEWUOA,
nlopt.LN_NELDERMEAD,
nlopt.LN_BOBYQA,
]
cheap = [
'Powell',
... |
import abc
from uuid import uuid1
import vrpn
import pyglet
from pyvrpn.logging import setup_module_logging
error, warning, info, debug = setup_module_logging(__name__)
__all__ = [
'TestTracker',
'TestButton',
'TestDial',
'PolhemusLibertyLatus',
]
class Receiver(pyglet.event.EventDispatcher, metac... |
import torch
import numpy
from fiberedae.utils import nn as nnutils
AVAILABLE_PROJECTION_TYPES = ["torus", "cube"]
def init_weights_b(layer):
"""Init for the bias"""
if type(layer) == torch.nn.Linear:
torch.nn.init.xavier_uniform_(layer.weight)
def init_weights(layer, batchsize=256, nonlinearity=to... |
import logging
import os
import pathlib
import re
import shutil
import stat
import subprocess
import textwrap
import click
# check environment before prompting
class SetupCommand(click.Command):
def parse_args(self, ctx, args):
logging.info("Checking for prerequisites...")
# command/name/require... |
"""
Augmenters that apply geometric transformations.
To use the augmenters, clone the complete repo and use
`from vidaug import augmenters as va`
and then e.g. :
seq = va.Sequential([ va.RandomRotate(30),
va.RandomResize(0.2) ])
List of augmenters:
* GaussianBlur
* ElasticTransf... |
from octopus.lib import dataobj
from octopus.lib import xml as xutil
from lxml import etree
class JATSException(Exception):
def __init__(self, message, rawstring, *args, **kwargs):
super(JATSException, self).__init__(message, *args, **kwargs)
self.raw = rawstring
class EPMCFullTextException(JATSEx... |
from datetime import datetime, timezone
import sys
import json
from update_queue_lenght import update_queue_length
sys.path.append('./objection_engine')
sys.path.append('./video-splitter')
from collections import Counter
import tweepy
import re
import time
import os
from persistqueue import Queue
import threading
impo... |
# ActivitySim
# See full license in LICENSE.txt.
import logging
import numpy as np
import pandas as pd
from activitysim.core.interaction_simulate import interaction_simulate
from activitysim.core import tracing
from activitysim.core import pipeline
from activitysim.core import config
from activitysim.core import inj... |
import json
import logging
import re
from contextlib import contextmanager
import pytest
from dagster import check, execute_pipeline, pipeline, solid, ModeDefinition
from dagster.core.definitions import SolidHandle
from dagster.core.events import DagsterEvent
from dagster.core.execution.plan.objects import StepFailu... |
# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appli... |
from __future__ import unicode_literals
from django.utils import six
from django.utils.html import escape
from djblets.markdown import markdown_escape, markdown_unescape
from djblets.webapi.resources.mixins.forms import (
UpdateFormMixin as DjbletsUpdateFormMixin)
from reviewboard.reviews.markdown_utils import (m... |
#!/usr/bin/env python
from __future__ import print_function
import datetime, optparse, os, shutil, sys, tarfile, tempfile, time
from . import utils_common, net
info = "'rethinkdb restore' loads data into a RethinkDB cluster from an archive"
usage = "rethinkdb restore FILE [-c HOST:PORT] [--tls-cert FILENAME] [-p] [-... |
# Copyright 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 agreed to... |
#!/usr/bin/env python3
# Copyright 2022 Xiaomi Corporation (Author: <NAME>)
#
# See ../../../../LICENSE for clarification regarding multiple 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 Licen... |
import sys
sys.path.append( "../../util" )
sys.path.append( "../../util/bert" )
from db_meta import *
def get_used_glove( vec_prop_f, set_out, target_dic ):
for v_f in vec_prop_f:
for t in v_f[ PF_QTOKS ]:
if t in target_dic:
set_out.add( t )
elif t.lower() in t... |
# coding: utf-8 -*-
'''
GSI.py contains utility functions for GSI
'''
__all__ = ['GSIstat']
import numpy as _np
import pandas as _pd
import re as _re
class GSIstat(object):
'''
Object containing the GSI statistics
'''
def __init__(self,filename,adate):
'''
Initialize the GSIstat o... |
import os
import time
import platform
import logging
import queue
import fnmatch
from collections import OrderedDict
from substance.monads import *
from substance.logs import *
from substance.shell import Shell
from substance.exceptions import (SubstanceError)
from substance.utils import getSupportFile
from substance.... |
r"""
Interface to mwrank
"""
#*****************************************************************************
# Copyright (C) 2005 <NAME> <<EMAIL>>
#
# Distributed under the terms of the GNU General Public License (GPL)
#
# This code is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRA... |
import os
import json
import collections
import re
import markdown
from . import config
from . import stixhelpers
from . import relationshiphelpers
from . import util
def generate():
"""Responsible for verifying group directory and starting off
group markdown generation
"""
# Verify if directory e... |
from test_series import verify_series_and_expr_api
import polars as pl
from polars import testing
def test_horizontal_agg(fruits_cars: pl.DataFrame) -> None:
df = fruits_cars
out = df.select(pl.max([pl.col("A"), pl.col("B")]))
assert out[:, 0].to_list() == [5, 4, 3, 4, 5]
out = df.select(pl.min([pl.... |
#!/usr/bin/env python3
""" This module contains a class to extract tokens and their corresponding NER tags from a
given text using Stanford's CoreNLP. It also contains a class to wrap pycorenlp
(https://github.com/smilli/py-corenlp) and capture its exceptions more explicitly.
Todo:
* I think we want some way o... |
import numpy as np
# Module loading
import numpy.linalg as npla
from devito.tools import memoized_meth, as_tuple
from devito import Function, Constant, Dimension, clear_cache
from sources import PointSource, Receiver
from geom_utils import AcquisitionGeometry
from twri_utils import applyfilt, compute_optalpha, applyf... |
import matplotlib
matplotlib.use('Agg')
import os
import sys
import csv
import json
import time
import numpy as np
import skimage.io as io
from joblib import Parallel, delayed
from openimages import OpenImages
def _url_to_license(licenses, mode='http'):
# create dict with license urls as
# mode is either htt... |
import json
import torch
import numpy as np
import argparse
import pickle
import pandas as pd
from sklearn.metrics.pairwise import cosine_similarity
from tqdm import tqdm
from scipy.stats import spearmanr, pearsonr
from transformers import BertModel, BertTokenizer, GPT2Tokenizer, GPT2LMHeadModel
torch.manual_seed(2000... |
### BS: my virtualenv doesn't have tkinter, so a basic check.
### from: https://stackoverflow.com/questions/1871549/determine-if-python-is-running-inside-virtualenv
import sys
def get_base_prefix_compat():
"""Get base/real prefix, or sys.prefix if there is none."""
return getattr(sys, "base_prefix", None)... |
'''
Created on Jun 28, 2012
@author: Chris
'''
import move_mode
import trait
import core.event_manager as event_manager
from core.event_manager import Event
import file.name as name
import random
class UnitType(object):
'''
defines characteristics of types of mobs
'''
def __init__(self, name, des... |
import numpy as np
import matplotlib
import matplotlib.pyplot as plt
import warnings
import strax
import straxen
from mpl_toolkits.axes_grid1 import inset_locator
from datetime import datetime
from .records_matrix import DEFAULT_MAX_SAMPLES
from .daq_waveforms import group_by_daq
export, __all__ = strax.exporter()
__a... |
# 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
# distribu... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.