filename stringlengths 13 19 | text stringlengths 134 1.04M |
|---|---|
the-stack_0_12769 | # -*- coding: utf-8 -*-
"""
Created on Fri Aug 14 11:58:01 2020
@author: Jhon Corro
@author: Cristhyan De Marchena
"""
import vtk
tube = vtk.vtkTubeFilter()
def get_program_parameters():
import argparse
parser = argparse.ArgumentParser()
parser.add_argument('data_file', nargs='?', default=None, help='da... |
the-stack_0_12770 | import logging
import os
import shutil
import re
from collections import defaultdict
import sys
from bs4 import BeautifulSoup
def _getSubstring(block, delimiters):
# No error checking...don't do anything dumb
return block[delimiters[0]:delimiters[1]]
def _textify(block):
"""
Smash down any html for... |
the-stack_0_12773 | import os
import unittest
from programytest.client import TestClient
class StarPrecedenceTestClient(TestClient):
def __init__(self):
TestClient.__init__(self)
def load_storage(self):
super(StarPrecedenceTestClient, self).load_storage()
self.add_default_stores()
self.add_sing... |
the-stack_0_12774 | from chef import DataBag, DataBagItem, Search
from chef.exceptions import ChefError
from chef.tests import ChefTestCase
class DataBagTestCase(ChefTestCase):
def test_list(self):
bags = DataBag.list()
self.assertIn('test_1', bags)
self.assertIsInstance(bags['test_1'], DataBag)
def test_... |
the-stack_0_12776 | from .position import Position
class Portfolio(object):
def __init__(self, price_handler, cash):
"""
On creation, the Portfolio object contains no
positions and all values are "reset" to the initial
cash, with no PnL - realised or unrealised.
Note that realised_pnl is the ... |
the-stack_0_12777 | # Copyright (c) 2017-present, Facebook, 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... |
the-stack_0_12778 | # -*- coding: utf-8 -*-
"""Interface for running Python functions as subprocess-mode commands.
Code for several helper methods in the `ProcProxy` class have been reproduced
without modification from `subprocess.py` in the Python 3.4.2 standard library.
The contents of `subprocess.py` (and, thus, the reproduced methods... |
the-stack_0_12780 | #!/usr/bin/python27
#coding:utf-8
#pylab inline
from __future__ import division
import matplotlib
matplotlib.use('TkAgg') # matplotlib 'agg'是不画图的,'Tkagg'是画图的.
import os
import numpy as np
import PIL.Image as pil
import tensorflow as tf
from SfMLearner import SfMLearner
from utils import normalize_depth_for_display
imp... |
the-stack_0_12781 | import numpy as np
import pytest
import unyt as u
from unyt.testing import assert_allclose_units
from gmso import Topology
from gmso.formats.mol2 import from_mol2
from gmso.tests.base_test import BaseTest
from gmso.utils.io import get_fn
class TestMol2(BaseTest):
def test_read_mol2(self):
top = Topology.... |
the-stack_0_12782 | from . import common
import pandas as pd
import os
FILENAME_ATTR = 'Filename'
VOLUME_ATTR = 'Volume'
URL_ATTR = 'Mirror'
class NoiseDownloader:
def __init__(
self,
output_files_key,
output_volumes_key,
data,
download_directory):
self.output_file... |
the-stack_0_12783 | """
cwpair2.py
Takes a list of called peaks on both strands and produces a list of matched pairs and a list
of unmatched orphans using a specified method for finding matched pairs. Methods for finding
matched pairs are mode, closest, largest or all, where the analysis is run for each method
Input: list of one or mor... |
the-stack_0_12787 | ################################################################################
# Copyright (C) 2016 Advanced Micro Devices, Inc. All rights reserved.
#
# 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 th... |
the-stack_0_12788 | import os
import argparse
import time
import numpy as np
import torch
import torch.nn as nn
import torch.optim as optim
import numpy as np
parser = argparse.ArgumentParser('ODE demo')
parser.add_argument('--method', type=str, choices=['dopri5', 'adams'], default='dopri5')
parser.add_argument('--data_size', type=int, d... |
the-stack_0_12790 | #-----------------------------------------------------------------------------
# Copyright (c) 2012 - 2022, Anaconda, Inc., and Bokeh Contributors.
# All rights reserved.
#
# The full license is in the file LICENSE.txt, distributed with this software.
#-------------------------------------------------------------------... |
the-stack_0_12793 | import unittest
from test import script_helper
from test import support
import subprocess
import sys
import signal
import io
import locale
import os
import errno
import tempfile
import time
import re
import sysconfig
import warnings
import select
import shutil
import gc
try:
import resource
except ImportError:
... |
the-stack_0_12796 | from stix_shifter_utils.modules.base.stix_transmission.base_ping_connector import BasePingConnector
from stix_shifter_utils.utils import logger
from stix_shifter_utils.utils.error_response import ErrorResponder
class PingConnector(BasePingConnector):
def __init__(self, api_client):
self.api_client = api_c... |
the-stack_0_12797 | import os
import numpy as np
from tensorflow.keras.callbacks import TensorBoard
from tensorflow.keras.datasets import mnist
from tensorflow.keras.initializers import Constant
from tensorflow.keras.initializers import TruncatedNormal
from tensorflow.keras.layers import Activation
from tensorflow.keras.layers import Den... |
the-stack_0_12799 | """
Problem 53: Combinatoric selections
https://projecteuler.net/problem=53
There are exactly ten ways of selecting three from five, 12345:
123, 124, 125, 134, 135, 145, 234, 235, 245, and 345
In combinatorics, we use the notation, (5 over 3) = 10.
In general, (n over r) = n! / (r! * (n−r)!), where r <= n, n! = n *... |
the-stack_0_12803 | # Copyright (c) 2014 Hewlett-Packard Development Company, L.P.
#
# 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 re... |
the-stack_0_12804 | from .models import Agent
from model_bakery.recipe import Recipe, seq
from model_bakery import baker
from itertools import cycle
from django.utils import timezone as djangotime
agent = Recipe(
Agent,
client="Default",
site="Default",
hostname=seq("TestHostname"),
monitoring_type=cycle(["workstation... |
the-stack_0_12808 | """Grafico con los valores obtenidos en la implementacion serial en CPU"""
import matplotlib.pyplot as plt
import numpy as np
import csv
path = "Data/"
if __name__ == "__main__":
size = []
time = []
with open(path + 'serial_CPU.csv', mode='r') as csv_file:
csv_reader = csv.DictReader(csv_file)
... |
the-stack_0_12809 | """
Functions to write atomic coordinates in commmon chemical formats.
"""
import os
def write_pdb(file_name, atoms, coordinates, header='mol'):
""" Write given atomic coordinates to file in pdb format """
with open(file_name, 'w') as pdb_file:
pdb_file.write('HEADER ' + header + '\n')
form... |
the-stack_0_12813 | import random
import discord
import json
import requests
import io
from random import randint
from discord.ext import commands
from utils import lists, http, default, eapi, sfapi
processapi = eapi.processapi
processshowapi = eapi.processshowapi
search = sfapi.search
class ResultNotFound(Exception):
"""Used if R... |
the-stack_0_12814 | import os
import json
import pandas
from flask import Flask, jsonify, redirect, render_template, request
from google.cloud import secretmanager
from alpha_vantage.timeseries import TimeSeries
app = Flask(__name__)
PROJECT_ID = os.environ.get("PROJECTID")
secrets = secretmanager.SecretManagerServiceClient()
ALPH... |
the-stack_0_12815 | # Copyright 2020 MONAI Consortium
# 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... |
the-stack_0_12816 | #!/usr/bin/env python
#-*- coding: utf-8 -*-
#-----------------------------------------------------------------------
# Author: delimitry
#-----------------------------------------------------------------------
import os
import time
import math
import datetime
from asciicanvas import AsciiCanvas
x_scale_ratio = 1.75... |
the-stack_0_12817 | # coding: utf-8
import socketserver
import os
# Copyright 2013 Abram Hindle, Eddie Antonio Santos
#
# 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/LICE... |
the-stack_0_12819 | # Copyright 2018 Xu Chen 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 agree... |
the-stack_0_12821 | # Copyright 2020 Xanadu Quantum Technologies 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 agre... |
the-stack_0_12822 | # -*- coding: utf-8 -*-
from __future__ import print_function
# tag::mcts_go_cnn_preprocessing[]
import numpy as np
from keras.models import Sequential
from keras.layers import Dense, Dropout, Flatten
from keras.layers import Conv2D, MaxPooling2D
np.random.seed(123)
X = np.load('../generated_games/features-200.npy')... |
the-stack_0_12825 | from pyunity import Behaviour, SceneManager, GameObject, Vector3, MeshRenderer, Mesh, Material, RGB, ShowInInspector
class Rotator(Behaviour):
def Update(self, dt):
self.transform.eulerAngles += Vector3(0, 90, 135) * dt
def main():
scene = SceneManager.AddScene("Scene")
scene.mainCamera.... |
the-stack_0_12829 | import os, sys
# pylint: disable-msg=F0401
from setuptools import setup, find_packages
here = os.path.dirname(os.path.realpath(__file__))
sys.path.insert(0, os.path.normpath(os.path.join(here,
'openmdao',
'examples',
... |
the-stack_0_12830 | # -*- coding: utf-8 -*-
"""
GoPro Encoding
==============
Defines the *GoPro* *Protune* encoding:
- :func:`colour.models.log_encoding_Protune`
- :func:`colour.models.log_decoding_Protune`
See Also
--------
`RGB Colourspaces Jupyter Notebook
<http://nbviewer.jupyter.org/github/colour-science/colour-notebooks/\
bl... |
the-stack_0_12832 | # coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may ... |
the-stack_0_12833 | import pandas as pd
from jnius import autoclass
from awesome_data import DataSet
from marspy.convert.molecule import *
class Archive:
def __init__(self, filepath):
self.filepath = filepath
self.name = self.filepath.split('/')[-1]
self.File = autoclass('java.io.File')
self.yamaFil... |
the-stack_0_12837 | import numpy as np
from sys import argv
import sys
import numpy as np
import pandas as pd
from matplotlib import pyplot as plt
import seaborn as sns
import matplotlib.ticker as ticker
from collections import Counter
from mpl_toolkits.axes_grid1.inset_locator import inset_axes
from EpiModel import *
import cv19
#--... |
the-stack_0_12839 | #!/usr/bin/env python3
"""A script for running Robot Framework's own acceptance tests.
Usage: atest/run.py [--interpreter interpreter] [options] [data]
`data` is path (or paths) of the file or directory under the `atest/robot`
folder to execute. If `data` is not given, all tests except for tests tagged
with `no-ci`... |
the-stack_0_12840 | import requests
import json
session = requests.Session()
jar = requests.cookies.RequestsCookieJar()
baseurl = "https://general.direction.com:8443/wsg/api/public/v6_1/" #replace "general.direction.com" with either the host name or IP of a member of the cluster
# Written with 3.6.2 in mind
#http://docs.ruckuswireless.... |
the-stack_0_12841 | from django.conf import settings
from datetime import datetime
OUTPUT_FOLDER = settings.MEDIA_ROOT
METRICS = {'R' : 'Pearson\'s r',
'p_R' : 'Pearson\'s r p-value',
'rho' : 'Spearman\'s rho',
'p_rho' : 'Spearman\'s rho p-value',
'RMSD' : 'Root-mean-square deviation',
... |
the-stack_0_12842 | #!/usr/bin/env python
"""
Script to run benchmarks (used by regression tests)
"""
import os
import os.path
import sys
import csv
from LogManager import LoggingManager
def printf(format, *args):
sys.stdout.write(format % args)
_log = LoggingManager.get_logger(__name__)
def isexec (fpath):
if fpath == None: ... |
the-stack_0_12843 | # Python
import unittest
# Ats
from pyats.topology import Device
# Genie package
from genie.ops.base import Base
from genie.ops.base.maker import Maker
from unittest.mock import Mock
# genie.libs
from genie.libs.ops.static_routing.iosxe.static_routing import StaticRouting
from genie.libs.ops.static_routing.iosxe.tes... |
the-stack_0_12846 | # -*- coding: utf-8 -*-
from tkinter import *
import os
import sys
import subprocess
class Application:
def __init__(self, master=None):
self.fontePadrao = ("Arial", "10")
self.primeiroContainer = Frame(master)
self.primeiroContainer["padx"] = 50
self.primeiroContainer.pack()
... |
the-stack_0_12847 | """Support for Voice mailboxes."""
from __future__ import annotations
import asyncio
from contextlib import suppress
from datetime import timedelta
from http import HTTPStatus
import logging
from aiohttp import web
from aiohttp.web_exceptions import HTTPNotFound
import async_timeout
from homeassistant.components.htt... |
the-stack_0_12852 | from typing import Union, Tuple, Optional
from torch_geometric.typing import (OptPairTensor, Adj, Size, NoneType,
OptTensor)
import torch
from torch import Tensor
import torch.nn.functional as F
from torch.nn import Parameter, Linear
from torch_sparse import SparseTensor, set_diag
f... |
the-stack_0_12853 | # -*-coding:Utf-8 -*
# Copyright (c) 2014 LE GOFF Vincent
# All rights reserved.
#
# 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, this
# lis... |
the-stack_0_12855 | import logging
import os
from argparse import ArgumentDefaultsHelpFormatter, ArgumentParser
import torch
import torch.distributed as dist
from monai.config import print_config
from monai.handlers import (
CheckpointSaver,
LrScheduleHandler,
MeanDice,
StatsHandler,
ValidationHandler,
)
from monai.in... |
the-stack_0_12856 | import asyncio
import pickle
from time import time
from typing import FrozenSet, Optional
import aiomcache
import morcilla
from sqlalchemy import and_, select
from athenian.api.cache import cached, middle_term_exptime, short_term_exptime
from athenian.api.models.metadata.github import Bot
from athenian.api.models.sta... |
the-stack_0_12858 | ##########################################################################
#
# Copyright (c) 2018, Alex Fuller. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of so... |
the-stack_0_12860 | # Copyright (C) 2020 THL A29 Limited, a Tencent company.
# All rights reserved.
# Licensed under the BSD 3-Clause License (the "License"); you may
# not use this file except in compliance with the License. You may
# obtain a copy of the License at
# https://opensource.org/licenses/BSD-3-Clause
# Unless required by appl... |
the-stack_0_12863 | import sys
import re
import PySimpleGUI as sg
import subprocess
import datetime
from bs4 import BeautifulSoup
import shutil
import openpyxl
def insert_Excel(translatedHtmlFile, checkedHtmlFile, resultsFile):
# 結果を入れるエクセルを用意
shutil.copyfile(xlsxTemplate, resultsFile)
# 翻訳後のhtmlをオープンしてパース
with open(tra... |
the-stack_0_12864 | import csv
import json
input_file_name = "C:/Users/cch23/Desktop/창업 아이템/걸어서나눔나눔/파싱/in.csv"
output_file_name = "C:/Users/cch23/Desktop/창업 아이템/걸어서나눔나눔/파싱/in.json"
with open(input_file_name, "r", encoding="utf-8", newline="") as input_file, \
open(output_file_name, "w", encoding="utf-8", newline="") as output_fi... |
the-stack_0_12865 | """
Experiment Management
"""
from datetime import datetime
from os import pardir
from attrdict import AttrDict
import pathlib
import hashlib
import os
from rl_helper import envhelper
import yaml
class ExperimentManager(object):
def __init__(self,add_env_helper=True) -> None:
super().__init__()
... |
the-stack_0_12866 | import unicodedata
from typing import Optional
from django.utils.translation import gettext as _
from zerver.lib.exceptions import JsonableError
from zerver.models import Stream
# There are 66 Unicode non-characters; see
# https://www.unicode.org/faq/private_use.html#nonchar4
unicode_non_chars = {
chr(x)
for... |
the-stack_0_12867 | import tensorflow as tf
import numpy as np
# NOTE: If you want full control for model architecture. please take a look
# at the code and change whatever you want. Some hyper parameters are hardcoded.
# Default hyperparameters:
hparams = tf.contrib.training.HParams(
name="wavenet_vocoder",
# Convenient model ... |
the-stack_0_12874 | # -*- coding: utf-8 -*-
from __future__ import (absolute_import, division, print_function,
unicode_literals)
import json
import os
import psutil
import shutil
import signal
import subprocess
import sys
import time
import zlib
from datetime import datetime, timedelta, timezone
from multiprocess... |
the-stack_0_12875 | import os
import requests
import codecs
import json
import hashlib
import io
from pathlib import Path
import pandas as pd
from bs4 import BeautifulSoup as bs
from bs4.element import Tag
from sklearn.model_selection import train_test_split
from finetune.datasets import Dataset
from finetune import SequenceLabeler
from... |
the-stack_0_12878 | """Place multiple rectangles with the mouse."""
import pygame
from pygame.locals import *
RED = (255, 0, 0)
BLUE = (0, 0, 255)
GRAY = (127, 127, 127)
pygame.init()
screen = pygame.display.set_mode((640, 240))
start = (0, 0)
size = (0, 0)
drawing = False
rect_list = []
running = True
while running:
for event i... |
the-stack_0_12879 | import asyncio
import inspect
import click
from fastapi import FastAPI, APIRouter
from starlette.middleware.sessions import SessionMiddleware
try:
from importlib.metadata import entry_points, version
except ImportError:
from importlib_metadata import entry_points, version
from . import logger, config
from .m... |
the-stack_0_12880 | import rclpy
from rclpy.node import Node
from std_msgs.msg import String
class TestSubscriber(Node):
def __init__(self):
super().__init__('test_subscriber')
self.subscription = self.create_subscription(
String,
'websock_echo',
self.listener_callback,
... |
the-stack_0_12881 | import typing
from PyQt5.QtCore import QAbstractListModel, QModelIndex, Qt, QMimeData
from PyQt5.QtGui import QFont
from PyQt5.QtWidgets import QFileDialog
from src.expression import calculateExpr, isValidExpression, toEditableExpr, fromEditableExpr
from .utils import saveHistoryToFile, addExpressionToHistoryCache, c... |
the-stack_0_12882 | import pytest
from numpy.testing import assert_allclose
from sklearn import __version__
from sklearn.exceptions import NotFittedError
from pysindy import FourierLibrary
from pysindy import SINDy
from pysindy import STLSQ
from pysindy.deeptime import SINDyEstimator
from pysindy.deeptime import SINDyModel
def test_est... |
the-stack_0_12883 | #!/usr/bin/env python3
#
# Constants for the generation of patches for CBMC proofs.
#
# Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to... |
the-stack_0_12884 | # Copyright 2016 The TensorFlow 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 applicab... |
the-stack_0_12885 | from __future__ import unicode_literals
import logging
import traceback
from django.core.paginator import Paginator
from django.http import HttpResponseServerError, Http404
from django.shortcuts import get_object_or_404
from django.template import RequestContext
from django.template.loader import render_to_string
fro... |
the-stack_0_12886 | def extract_items(list):
result = []
for index in range(0, len(list)):
bottom = list[0:index]
top = list[index+1:]
item = list[index]
result.append((item, bottom + top))
return result
def perms(list):
if list == []:
return [[]]
result = []
for (item, rest... |
the-stack_0_12889 | # Copyright (c) 2017 Midokura SARL
# 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 require... |
the-stack_0_12890 | # -*- coding: utf-8 -*-
"""Admin index for Django."""
# :copyright: (c) 2017, Maykin Media BV.
# All rights reserved.
# :license: BSD (3 Clause), see LICENSE for more details.
from __future__ import absolute_import, unicode_literals
import re
from collections import namedtuple
__version__ = "1.4.0"
__a... |
the-stack_0_12892 | # Copyright 2020 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.
import contextlib
import json
import mock
import re
import requests
import sys
import unittest
from six.moves.urllib.parse import urlparse
from blinkpy.comm... |
the-stack_0_12893 | # Copyright 2018-2021 Xanadu Quantum Technologies 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 applicabl... |
the-stack_0_12894 | from datetime import time
from django.forms import TimeInput
from django.test import override_settings
from django.utils import translation
from .base import WidgetTest
class TimeInputTest(WidgetTest):
widget = TimeInput()
def test_render_none(self):
self.check_html(self.widget, 'time', None, html=... |
the-stack_0_12895 | import json
import logging
import os
from datetime import date
from sensors import Light
from utils import catch_measurement, save_measurement, find, exit_on_time
def main():
with open(find('setup_agriculture.json', '/')) as f:
setup = json.load(f)
local_storage: str = setup.get('local_storage')
... |
the-stack_0_12896 | import sys
import common as _c
class StatusArg:
def __init__(self):
self.test = False
def parsearg(globvar):
globvar['status'] = StatusArg();
for arg in sys.argv[1:]:
if arg == '-t':
globvar['status'].test = True
else:
print("unknown argument : {0}".format... |
the-stack_0_12897 | # -*- coding: utf-8 -*-
from PySide2.QtCore import Signal
from PySide2.QtWidgets import QWidget
from ......Classes.CondType21 import CondType21
from ......GUI import gui_option
from ......GUI.Dialog.DMachineSetup.SBar.PCondType21.Gen_PCondType21 import (
Gen_PCondType21,
)
class PCondType21(Gen_PCondType21, QWi... |
the-stack_0_12898 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
zmap.py - version and date, see below
Source code : https://github.com/nanshihui/python-zmap/
Author :
* Sherwel Nan - https://github.com/nanshihui/python-zmap/
Licence : Apache License 2.0
A permissive license whose main conditions require preservation of copy... |
the-stack_0_12899 | # coding=utf-8
# Copyright 2018 The Google AI Language Team Authors and The HuggingFace Inc. team.
# Copyright (c) 2018, NVIDIA CORPORATION. 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 cop... |
the-stack_0_12900 | from graphbrain.meaning.corefs import main_coref
def is_actor(hg, edge):
"""Checks if the edge is a coreference to an actor."""
if edge.type()[0] == 'c':
return hg.exists(('actor/p/.', main_coref(hg, edge)))
else:
return False
def find_actors(hg, edge):
"""Returns set of all corefere... |
the-stack_0_12901 | '''
Kattis - jackpot
Simply get the LCM of all numbers. Note the property that LCM(a, b, c, ...) = LCM(LCM(a, b), c, ...)
GCD also has this property.
Time: O(n * log(INT_MAX)) Space O(n), Assuming Euclidean algorithm is O(log (INT_MAX))
'''
from math import gcd
def lcm(a, b):
return a * b // gcd(a, b)
num_tc = in... |
the-stack_0_12902 | # Copyright 2020 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, ... |
the-stack_0_12904 | import torch
from torch.nn.functional import softmax
import json
import nltk
nltk.download('punkt')
from nltk.tokenize import sent_tokenize
from transformers import AutoTokenizer, AutoModelForMaskedLM
import numpy as np
import sys
import random
import os
from os import path
def get_abstract(article):
return ' '.j... |
the-stack_0_12906 | #-*- coding: utf-8 -*-
import re
import pickle
# say-as 기본 규칙: 참고 논문 <기술문에서 우리말 숫자 쓰기, 권성규>
_mandarin_num = {"0": "공", "1": "일", "2": "이", "3": "삼", "4": "사", "5": "오", "6": "육", "7": "칠",
"8": "팔", "9": "구", "10": "십", "100": "백", "1000": "천", "10000": "만", "100000000": "억",
"... |
the-stack_0_12907 | import pathlib
import random
import sys
import panel as pn
import param
_COLORS = [
("#00A170", "white"),
("#DAA520", "white"),
("#2F4F4F", "white"),
("#F08080", "white"),
("#4099da", "white"), # lightblue
]
_LOGOS = {
"default": "https://panel.holoviz.org/_static/logo_stacked.p... |
the-stack_0_12908 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Utility functions for dealing with files"""
import pkg_resources
import pathlib
EXAMPLE_AUDIO = "example_data/Kevin_MacLeod_-_Vibe_Ace.ogg"
__all__ = ["example_audio_file", "find_files"]
def example_audio_file():
"""Get the path to an included audio example file... |
the-stack_0_12911 | '''
This module was downloaded from the pycroscopy github page: https://github.com/pycroscopy/pycroscopy
It was edited slightly with contributor Jessica Kong @kongjy to accomodate the new format
in which PiFM data is taken with a polarizer installed.
'''
import os
import numpy as np
from pyUSID.io.translator import T... |
the-stack_0_12912 | from django.urls import path,re_path
from measure import views
from rest_framework.routers import DefaultRouter
app_name = 'measure'
router = DefaultRouter()
urlpatterns = [
re_path(r'api/MeasureRecordCreate/', views.MeasureRecordCreate.as_view()),
re_path(r'api/MeasureRecordList/(?P<userid>[a-zA-Z0-9]+)/(?P... |
the-stack_0_12914 | from colorama import Fore
from time import sleep
from config import token
from codecs import open
from requests import get
import os
logo = """
__ _ _ _ _
/ _| | | | | (_) |
__ _| |_ ___| |_ ___| |__ _| |_
\ \/ / _/ _ \ __/ __| '_ \| | __|
> <| || __/ || (__| | | | | |_
/_/\_\... |
the-stack_0_12918 | #!/usr/bin/env python
# -*- encoding: utf-8 -*-
# Copyright 2011-2018, Nigel Small
#
# 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
#
# Unle... |
the-stack_0_12919 | """
Display number of ongoing tickets from RT queues.
Configuration parameters:
cache_timeout: how often we refresh this module in seconds (default 300)
db: database to use (default '')
format: see placeholders below (default 'general: {General}')
host: database host to connect to (default '')
pass... |
the-stack_0_12920 | from __future__ import division
import inspect
import os
from collections import OrderedDict, namedtuple
from copy import copy
from distutils.version import LooseVersion
from itertools import product
import corner
import json
import matplotlib
import matplotlib.pyplot as plt
from matplotlib import lines as mpllines
i... |
the-stack_0_12921 | # -*- coding: utf-8 -*-
from __future__ import division
from __future__ import print_function
import datetime
import json
import math
import os
import time
import sys
import unittest
from artists.miro.constraints import (
DatasetConstraints,
Fields,
FieldConstraints,
MinConstraint,
MaxConstraint,
... |
the-stack_0_12925 | """
Open3d visualization tool box
Written by Jihan YANG
All rights preserved from 2021 - present.
"""
import open3d
import torch
import matplotlib
import numpy as np
box_colormap = [
[1, 1, 1],
[0, 1, 0],
[0, 1, 1],
[1, 1, 0],
]
def get_coor_colors(obj_labels):
"""
Args:
obj_labels: 1... |
the-stack_0_12927 | # vim:ts=4:sts=4:sw=4:expandtab
import copy
import datetime
import dateutil.parser
import glob
import json
import logging
import math
from multiprocessing import Process
import os
import random
import shutil
import subprocess
import sys
import tempfile
import traceback
from threading import Thread
import time
import u... |
the-stack_0_12928 | """Helper functions for beam search."""
import numpy as np
from queue import PriorityQueue
from future.utils import implements_iterator
def InitBeam(phrase, user_id, m):
# Need to find the hidden state for the last char in the prefix.
prev_hidden = np.zeros((1, 2 * m.params.num_units))
for word in phrase[:-1]:
... |
the-stack_0_12932 | from django.urls import path
from .consumers import AnalysisConsumer, ServiceConsumer
websocket_urlpatterns = [
path(r"ws/service/", ServiceConsumer),
path(r"ws/analyses/", AnalysisConsumer),
path(r"ws/analyses/<uuid:analysis_id>/", AnalysisConsumer),
]
|
the-stack_0_12934 | # -*- coding: utf-8 -*-
"""
Created on Tue Jun 26 11:50:02 2018
@author: Andrija Master
"""
import numpy as np
import pandas as pd
import warnings
warnings.filterwarnings('ignore')
from scipy.optimize import minimize
import scipy as sp
from sklearn.metrics import accuracy_score
from sklearn.model_selection import tr... |
the-stack_0_12935 | """The tests for the Switch component."""
# pylint: disable=protected-access
import unittest
from homeassistant.setup import setup_component, async_setup_component
from homeassistant import core, loader
from homeassistant.components import switch
from homeassistant.const import STATE_ON, STATE_OFF, CONF_PLATFORM
from... |
the-stack_0_12937 | from io import StringIO
from .dvexpansion import *
class YMLConfigPP:
def __init__(self, pathes):
self.out_fd = StringIO()
self.include_files = set()
self.pp_pathes = []
for p in pathes:
self.pp_pathes.append(evaluate_dollar_var_expr(p))
def find_yml_file(self, yml)... |
the-stack_0_12938 | """Metrics related to messages."""
from prometheus_client import Counter, Gauge
msgs_sent = Counter("msg_sent",
"Number of messages sent between nodes",
["node_id", "msg_type"])
msg_rtt = Gauge("msg_rtt",
"Time taken to send a message to a node and get an ACK",... |
the-stack_0_12939 | import sys
import studentdirectory as sd
import gui
def main_for_command_line():
stud_dir = sd.StudentDirectory()
while(1):
print("\nSTUDENT DIRECTORY MENU")
print(" [a] Add New Student")
print(" [b] View Student Details")
print(" [c] Show Student Directory")
... |
the-stack_0_12940 | # --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------... |
the-stack_0_12944 | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
from caffe2.proto import caffe2_pb2
from caffe2.python import core
from hypothesis import assume, given
import caffe2.python.hypothesis_test_util as hu
import ca... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.