text stringlengths 3.07k 12.6k |
|---|
import sys
import h5py
import numpy as np
import pandas as pd
import torch
from torch.utils.data import TensorDataset, DataLoader
sys.path.append('.')
from src.data.build_input import build_input
from src.model.LSTMnn import LSTMnn
from src.model.metrics import evaluate
from src.visualize.visualize import plot_set_of... |
# Copyright 2017 Bloomberg Finance 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 required by applicable law or agreed to in writ... |
#!/usr/bin/env python
import json
import pickle
import numpy as np
from gryffin import Gryffin
from gemini import GeminiOpt as Gemini
from gemini.plotter import PlotterOpt
import olympus
from olympus.surfaces import Surface
#===============================================================================
#========... |
"""Useful decorators and decorator tools.
The `ox_decs` module contains useful decorators and related tools. See
documentation for the following for detailed information:
- `fix_doc`
- `withdoc`
- `composed`
The `fix_doc` function can be used in your own decorators to make sure
your decorator adds information ... |
import os
def ApiDependency(version):
string = '\t\t<dependency>\n'
string += '\t\t\t<groupId>net.gtaun</groupId>\n'
string += '\t\t\t<artifactId>shoebill-api</artifactId>\n'
string += '\t\t\t<version>' + version + '</version>\n'
string += "\t\t</dependency>\n"
return string
def CommonDependen... |
import torch.nn as nn
import torch.utils.data
import torch.nn.functional as F
from models.dgcnn import get_graph_feature
class get_model(nn.Module):
def __init__(self, output_channels=40, normal_channel=True):
super(get_model, self).__init__()
self.normal_channel = normal_channel
self.k = ... |
import pytest
import ray
import pandas as pd
import numpy as np
from sklearn.compose import ColumnTransformer
from sklearn.model_selection import train_test_split
from sklearn.pipeline import Pipeline
from sklearn.preprocessing import StandardScaler, MinMaxScaler
from sklearn.tree import DecisionTreeClassifier
from skl... |
import logging
import sys
from typing import Iterator, List, Optional
import blinker
from boadata.core.data_object import DataObject
class DataNode:
'''A branch/leaf in a data tree.
Signals:
--------
There are three blinker-based signals emitted by the data node:
* child_added(child)
* chil... |
#Import necessary package
import requests
import re
from bs4 import BeautifulSoup
import json
import html
import pandas as pd
import numpy as np
import datetime as dt
import configparser
import os
#Configure parameter
config = configparser.ConfigParser()
config.read(os.path.join(os.path.dirname(__file__), 'config.ini'... |
# =============================================================================
# MLDEPLOY_FUNCTIONS.PY
# -----------------------------------------------------------------------------
# Holds the functions that execute the commands in the CLI.
#
# ***This file MAY import from all other 'mldeploy' files.***
#
# The CLI ... |
#ESI
import random
import math
import time
def read_file_144():
file = input("Podaj nazwe pliku: ")
f = open(file, "r")
file_144 = f.readlines()
f.close()
return file_144
def read_file():
global list_144
list_144 = read_file_144()
def do_first():
#ile_os_list.clear()
... |
__all__ = [
'generate_values_profile',
'get_column_range_by_value_group',
'get_column_sampling_method',
'get_column_validation_method',
'get_values_profile',
'SCHEMA_DIR'
]
import io
import json
import os
import re
from ast import literal_eval
from collections import OrderedDict
from itertools... |
from __future__ import print_function
import os.path, sys, codecs, json, datetime
from googleapiclient.discovery import build_from_document
from google_auth_oauthlib.flow import InstalledAppFlow
from google.auth.transport.requests import Request
from google.oauth2.credentials import Credentials
# Script Information
... |
from datetime import datetime, timedelta
from copy import copy
from django.contrib.auth.decorators import login_required
from django.core.mail import EmailMessage
from django.core.urlresolvers import reverse
from django.db.models import Count, Prefetch
from django.http import HttpResponseRedirect
from django.shortcuts... |
from Branch_Sums import branchSums, BinaryTree
def findNode(nodes, id):
if id==None:
return None
for node in nodes:
if node["id"] == id:
n = BinaryTree(node['value'])
n.left = findNode(nodes, node['left'])
n.right = findNode(nodes, node['right'])... |
import itertools
from typing import Dict, List, Tuple, Union
import bitstring
from ops import KEY_CKR_CONTROL, KEY_CKR_DATA
from program import Channel, FPGA, Program
CKS_TARGET_QSFP = 0
CKS_TARGET_CKR = 1
class NoRouteFound(BaseException):
pass
class RoutingTarget:
def serialize(self):
raise Not... |
#!/usr/bin/python
# import numpy as np
# import matplotlib.pyplot as plt
# import scipy.ndimage
# from scipy.optimize import curve_fit
# from scipy.interpolate import interp1d
import mathstat
import unittest
def tangent_filter(a, w):
n = len(a)
k = int((w-1) / 2)
result = [0 for x in a]
for i in xrang... |
"""
Echo Agent.
The goal of this agent is to implement an agent that can create new static
connections, receive messages, and send messages while minimizing logic and,
therefore (hopefully) how much code needs to be maintained.
Required operations include:
- create static connection
- receive message
- retrieve messa... |
# -*- coding: utf-8 -*-
"""Service functions to handle the upload steps."""
from typing import Dict, List, Tuple
from django import http
from django.contrib import messages
from django.shortcuts import redirect, render
from django.urls import reverse
from django.utils.translation import ugettext as _
from ontask imp... |
from itertools import combinations_with_replacement
from math import factorial
import numpy as np
from scipy.special import binom
def vandermonde(cell, deg, pts, dim):
'''
-> Vandermonde matrix for monomial basis of polynomials up to degree
:param deg: and cell.dim spatial dimensions
V \in \R^(n,... |
import tensorflow as tf
import numpy as np
import functools
def lazy_property(function):
'''
<NAME>:
https://danijar.com/
https://gist.github.com/danijar
'''
attribute = '_cache_' + function.__name__
@property
@functools.wraps(function)
def decorator(self):
if not... |
"""
Contains functions to parse and get info about the cha files and xml files that corresponds to the checked lines in the cha files
"""
import codecs
import re
import json
from utils.filesystem import *
from utils.textmanipulation import *
def create_info_file():
""""
Creates the information for each... |
import json
import os
import re
import requests
import socket
from src.unettest_exceptions import RouteConfigException
def last_call(headers=None):
reqs = requests.get('http://localhost:4888/log')
return reqs.json()
class Service:
"""
Representation of a single SERVICE as represented in YAML.
""... |
from http import cookiejar
from urllib import request, parse, error as urlError
import base64
from urllib.error import URLError
import pandas as pd
import io
import re
import datetime
from sqlalchemy import create_engine
import time
class MeshDataSpoofer(object):
def __init__(self, login, password):
""" ... |
#!/usr/bin/env python
# -*- coding:utf-8 -*-
"""=================================================================
@Project : Algorithm_YuweiYin/LeetCode-All-Solution/Python3
@File : LC-0112-Path-Sum.py
@Author : [YuweiYin](https://github.com/YuweiYin)
@Date : 2022-03-08
==========================================... |
#
# Copyright 2020 <NAME>
#
# Distributed under MIT License
#
from .Globals import __TIME as _time
# Given a list of posets L, a poset P, and an integer n, decide if L has a poset
# isomorphic to P.
def _check(L, P, n):
if len(L) == 0 or len(L) <= n:
return False, None
if L[n].is_isomorphic(P):
... |
#!/usr/bin/env python
from __future__ import print_function
import argparse
import os
import pkg_resources
import subprocess
import sys
import time
from threading import Timer
from watchdog.observers import Observer
from watchdog.events import PatternMatchingEventHandler
version = pkg_resources.require('rundogd')[... |
import sys
from tokenizer import Token, Tokenizer
class AbstractSyntaxTree:
UNDEFINED = 0
ROOT = 1
COMMENT = 2
DEFINE = 3
DISPLAY = 4
REFERENCE = 5
BYTES = 6
WORDS = 7
IDENTIFIER = 8
IF = 9
LABEL = 10
LAMBDA = 11
LITERAL = 12
SEXPR = 13
STRING = 14
EQ... |
import re
import pathlib
import collections
from pybtex import database
from pybtex.database.output.bibtex import Writer as BaseWriter
from clldutils.source import Source as BaseSource
from clldutils.source import ID_PATTERN
__all__ = ['Source', 'Reference']
GLOTTOLOG_ID_PATTERN = re.compile('^[1-9][0-9]*$')
class... |
"""
--- Day 14: Extended Polymerization ---
The incredible pressures at this depth are starting to put a strain on your submarine. The
submarine has polymerization equipment that would produce suitable materials to reinforce the
submarine, and the nearby volcanically-active caves should even have the necessary input e... |
#!/usr/bin/python2
from pwn import *
def assemble_with_nasm(code):
with open("code.tmp", "wb") as file:
file.write(code)
subprocess.check_call(["nasm", "-o", "binary.tmp", "code.tmp"])
with open("binary.tmp", "rb") as file:
return file.read()
def exploit(connection):
modified_guest_... |
import math
import cmath
import mpmath
import matplotlib.pyplot as plt
from bigfloat import *
import numpy as np
class K_B:
def __init__(self):
pass
def f(self, t):
return t ** (- 0.5)
def df(self, t):
return - 0.5 * t ** (- 1.5)
class K_component:
def __init__(self, ti, ... |
#
# Python stuff to improve portability
#
from __future__ import print_function
#
# Python standard packages
#
import os
class NamingStrategy(object):
"""
Base class for Naming Strategies that convert source-side directory, file,
and symbolic link names into destination-side directory, file, and sybolic
... |
import importlib
import logging
import os
import re
import sys
import types
import requests
import json
import objectpath
# -----------
# -- Tests --
# -----------
import ConfigAbstractClass
import ConfigFromJson
from ConfigInfo import ConfigInfo, ConfigInfoList
def main():
# logging.basicConfig(filename='examp... |
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.animation as animation
import argparse
seeds = {
"diehard": [
[0, 0, 0, 0, 0, 0, 1, 0],
[1, 1, 0, 0, 0, 0, 0, 0],
[0, 1, 0, 0, 0, 1, 1, 1],
],
"boat": [[1, 1, 0], [1, 0, 1], [0, 1, 0]],
"r_pentomino": [[0, 1, ... |
# Ejecucion:
# python3 HolaOpenGL.py
from OpenGL.GLUT import * # GL Utilities Toolkit
from OpenGL.GL import *
from OpenGL.GLU import *
import math
import random
import sys
from PIL import Image
# INVESTIGUEN COMO INSTALAR PIL
# les evito la fatiga, hagan esto:
# sudo apt-get install python3-pil
import numpy
global t... |
import os
from copy import deepcopy
import torch
import torch.nn as nn
import torch.nn.functional as F
import torchvision
from tqdm import tqdm, trange
from arguments import get_args
from augmentations import get_aug
from models import get_model, get_backbone
from tools import AverageMeter
from datasets import get_data... |
import logging
from collections import namedtuple
from functools import lru_cache
from operator import attrgetter
import numpy
import soundfile
from audio_to_midi import midi_writer, notes
class Note:
__slots__ = ["pitch", "velocity", "count"]
def __init__(self, pitch, velocity, count=0):
self.pit... |
import json
import multiprocessing
import time
import urllib
from abc import abstractmethod, ABCMeta
from functools import partial
from multiprocessing.pool import ThreadPool
import numpy as np
import pandas as pd
from googleplaces import GooglePlaces
from yelp.client import Client
from yelp.oauth1_authenticator impor... |
#!/usr/bin/env python
import sys,os,re,fileinput,argparse
sys.path.append('/home/nucleo/lib/NCBI_taxonomy_tree')
import ncbiTaxonomyTree as ntt
import gzip
parser = argparse.ArgumentParser(description="produce a taxa distance from species A to B, given to lists. Think of bi-clustering")
parser.add_argument("--names",... |
"""Helper functions to assist in server flow."""
from model import (db, User, Itinerary, UserItinerary, Activity, Note, connect_to_db)
import json
import os
from datetime import date, time, timedelta
from twilio.rest import Client
TWILIO_ACCOUNT_SID = os.environ['TWILIO_ACCOUNT_SID']
TWILIO_AUTH_TOKEN = os.environ['T... |
# Django-Expenses
# Copyright © 2018-2021, <NAME>.
# All rights reserved.
# See /LICENSE for licensing information.
"""Bill management."""
import collections
from django.db import connection
from django.contrib import messages
from django.contrib.auth.decorators import login_required
from django.http import HttpResp... |
import tensorflow as tf
from tensorpack.graph_builder.model_desc import ModelDesc, InputDesc
from tensorpack.tfutils import (
get_current_tower_context, optimizer, gradproc)
from tensorpack.tfutils.scope_utils import auto_reuse_variable_scope
import tensorpack_extension
from data_load import phns
import params a... |
#!/usr/bin/env python3
import argparse
import logging
import os
import sys
logging.basicConfig(level=logging.INFO)
MY_PATH = os.path.normpath(os.path.abspath(os.path.dirname(__file__)))
sys.path.append(os.path.abspath(os.path.join(MY_PATH, 'python')))
import tmxlite
# # # # # # # # # # # # # # # # # # # # # # # # ... |
import typing
from ....core import grammar as g, transform as t
from ....validation.transform_validation import annotate
if typing.TYPE_CHECKING:
T = typing.TypeVar('T')
T2 = typing.TypeVar('T2')
Addable = typing.TypeVar('Addable', str, list)
def syntax_accum(
values: typing.Tuple[typing.Sequence[g.... |
from applications.api.v1.serializers import (
ApplicantApplicationSerializer,
AttachmentSerializer,
HandlerApplicationSerializer,
)
from applications.enums import ApplicationStatus
from applications.models import Application
from common.permissions import BFIsAuthenticated, BFIsHandler, TermsOfServiceAccept... |
from django.contrib import admin
from django.contrib.auth import get_user_model
from django.utils.translation import ugettext_lazy as _
from django.utils.html import format_html
from django.urls import reverse
from import_export.admin import ExportMixin
from .models import LivePollMultiple
from .models import LivePol... |
# References:
# 1. Algorithm Adapted from Artificial Intelligence: A Modern Approach, 3rd. Edition, <NAME> and <NAME>, p. 270. Prentice Hall, 2009.
import sys
from itertools import product
from a_star import a_star_search
from agent import BaseAgent
from base import State
from depth_limited import depth_limited_search... |
#!/usr/bin/env python3
"""Test WAV files using rhasspy-wake-raven.
Uses the same test directory structure as Mycroft Precise.
WAV files should be in:
test/
wake-word/
positive-example-00.wav
positive-example-01.wav
...
not-wake-word/
negative-example-00.wav
negative-example-01.wav
...
Out... |
# coding: utf-8
"""
Model for instrument log entries
This should not to be confused with internal logging like the object log.
"""
import enum
import datetime
import typing
from .. import db
from .instruments import Instrument
from .objects import Objects
instrument_log_entry_category_association_table = db.Table(... |
# -*- coding: utf-8 -*-
# Copyright 2017 Openstack Foundation.
#
# 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... |
import asyncio
from struct import pack, unpack
from enum import Enum
from typing import Union
import random
class Peer:
def __init__(self, data: Union[dict, bytes]):
if isinstance(data, dict):
self.peer_id = data['peer id']
self.ip_address = data['ip']
self.port = data... |
# -*- coding: utf-8 -*-
"""
The eigenvalue method of Silver and Chan (1991)
Low level routines works on numpy arrays and shifts using samples (doesn't know about time)
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from ..core import core, core3d, geom... |
import numpy as np # linear algebra
import pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv)
import data_helpers as data_helpers
from sklearn.ensemble import RandomForestRegressor
from sklearn.model_selection import train_test_split
from sklearn.preprocessing import StandardScaler
from sklearn.naive_baye... |
import numpy as np
from casadi import *
from casadi.tools import *
import pdb
import sys
import do_mpc
def logistic(x):
return 0.01*np.exp(x*700)/(1+0.01*(np.exp(700*x)-1))
def tanh_sig(x):
return 0.5 + 0.5 * np.tanh(1000 * x)
def Dribble_model():
"""
dynamics model:
x1_dot = x2
x2_dot = -g -... |
# -*- coding:utf-8 -*-
# email:<EMAIL>
# create: 2021/2/1
import networks
import os
import torch
from torch.functional import F
from utils.dl_util import init_net
from utils.dl_util import get_scheduler, get_optimizer, set_requires_grad, tensor2im
from models.base_model import BaseModel
from torch.nn import init
from u... |
import utilities as utilities
import rbm
import numpy as np
curr_int = np.int16
curr_float = np.float32
# Check quality of statistics
def calculate_error(RBM, data_tr, N_sequences = 800000, Nstep = 10, background = None):
N=RBM.n_v
q=RBM.n_cv
# Check how moments are reproduced
# Means
mudata = RB... |
class ReplaceMeWithAnAlgorithm:
"""Template for creating new algorithms that can be displayed in the GUI."""
def __init__(self):
self.dp = [] # You can use an array, dictionary, or something else to represent the dp table.
self.pars = {}
self.gui_vert_headers = []
self.gui_... |
from dataclasses import dataclass
from typing import Callable, Dict, Tuple
import numpy as np
import pandas as pd
import scipy.stats as ss
from statsmodels.distributions.empirical_distribution import ECDF
from .utils import calc_pvalue, NDArrayInt, NDArrayFloat
uniDist = ss.uniform(scale=0.5)
@dataclass
class RDTS... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
simpledocx.py - last updated 2018-01-31
1) DocxReader
=============
Read the text content of docx files ignoring all formatting/style information.
2) DocxTemplate
==============
Write docx files using a VERY simple templating approach.
It has limited capabilities, b... |
import itertools
import operator
import os
import sys
import numpy as np
from collections import OrderedDict
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..')))
import poreover
import poreover.decoding as decoding
def remove_gaps(a):
# only needed for greedy decoding
# unlike st... |
import difflib
import re
import requests
import json
import argparse
import os
import time
import datetime
import random
def parse_args():
parser = argparse.ArgumentParser()
parser.add_argument('--input_query', type = str, default="", help="input query to search")
parser.add_argument('--after', type = str,... |
from contextlib import closing
from multiprocessing import Pool
import pandas as pd
import numpy as np
import argparse
import glob
import time
import os
try:
import __builtin__
except ImportError:
# Python 3
import builtins as __builtin__
# For debugging purposes only:
def print(*args, **kwargs):
__bu... |
import argparse
import os
import tensorflow as tf
from tensorflow.keras import layers
import numpy as np
from . import model
from . import pellet_list
from util import gcs_util as util
PELLET_LIST = pellet_list.PELLET_LIST
WORKING_DIR = os.getcwd()
MODEL_NAME = 'pellet_labels_model.h5'
def get_args():
parser = ... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
CS224N 2019-20: Homework 3
run.py: Run the dependency parser.
<NAME> <<EMAIL>>
<NAME> <<EMAIL>>
"""
from datetime import datetime
import os
import pickle
import math
import time
import argparse
from torch import nn, optim
import torch
from tqdm import tqdm
from parse... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# SPDX-License-Identifier: Apache-2.0
# SPDX-FileCopyrightText: © 2021 Massachusetts Institute of Technology.
# SPDX-FileCopyrightText: © 2021 <NAME> <<EMAIL>>
# NOTICE: authors should document their contributions in concisely in NOTICE
# with details inline in source files... |
import os
from flask import Flask,request,jsonify,render_template, redirect, url_for,flash,session,abort,jsonify
from werkzeug.utils import secure_filename
from flask import send_from_directory
import urllib.request
import subprocess
import nltk
from nltk.corpus import stopwords
from nltk.tokenize import word_tokeniz... |
from fastapi import APIRouter, Depends, Security
from fastapi import BackgroundTasks
from kairon.shared.auth import Authentication
from kairon.api.models import Response, RegisterAccount, TextData, Password, FeedbackRequest, DictData, \
RecaptchaVerifiedTextData
from kairon.shared.constants import OWNER_ACCESS
from... |
# -*- coding: utf-8 -*-.
from __future__ import absolute_import, unicode_literals
import os
import time
import django
import redis
from django.contrib.sessions.backends.base import CreateError
from django.contrib.sessions.models import Session
from django.core import management
from redis_sessions_fork import backen... |
# Copyright 2017 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... |
"""
Useful for:
* users learning xarray
* building tutorials in the documentation.
"""
import os
import pathlib
import numpy as np
from .backends.api import open_dataset as _open_dataset
from .backends.rasterio_ import open_rasterio as _open_rasterio
from .core.dataarray import DataArray
from .core.dataset import D... |
# HQ XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
# HQ X
# HQ X quippy: Python interface to QUIP atomistic simulation library
# HQ X
# HQ X Portions of this code were written by
# HQ X <NAME>, <NAME>
# HQ X
# HQ X Copyright 2019
# HQ X
# HQ X These portions of the source code... |
# ***************************************************************
# Copyright (c) 2020 Jittor. Authors:
# <NAME> <<EMAIL>>
# <NAME> <<EMAIL>>
# <NAME> <<EMAIL>>.
# All Rights Reserved.
# This file is subject to the terms and conditions defined in
# file 'LICENSE.txt', which is part of this source code pac... |
import os
import json
import webbrowser
from datetime import datetime
try:
import constants
import printer
import builder
import config
import logger
except Exception:
from startcp import constants, printer, builder, config, logger
rangebi = printer.Rangebi()
logger = logger.Logger()
def js... |
import sqlite_utils
import datetime
from sqlite_utils.db import NotFoundError
import git
import json
def iterate_file_versions(repo_path, filepath, ref="master"):
repo = git.Repo(repo_path, odbt=git.GitDB)
commits = reversed(list(repo.iter_commits(ref, paths=filepath)))
for commit in commits:
blob... |
from __future__ import absolute_import
import mock
import os
from django.conf import settings
TEST_ROOT = os.path.normpath(
os.path.join(
os.path.dirname(__file__),
os.pardir,
os.pardir,
os.pardir,
os.pardir,
'tests'))
def pytest_configure(config):
# HACK: On... |
import random
import json
import os
import tensorflow as tf
import numpy as np
from nltk.translate.bleu_score import corpus_bleu
from .utils import gen_batched_data
FLAGS = tf.app.flags.FLAGS
def model_train(model, sess, data_train, KB_tuple):
batched_data = gen_batched_data(data_train, KB_tuple, FLAGS)
outpu... |
import operator as _operator
import sqlalchemy as sa
import trafaret as t
from sqlalchemy.dialects import postgresql
from sqlalchemy.sql import or_
from trafaret.contrib.rfc_3339 import DateTime
from ..exceptions import JsonValidaitonError
from ..utils import MULTI_FIELD_TEXT_QUERY, as_dict
__all__ = ['table_to_tra... |
#!/usr/bin/env python2.7
# -*- coding: UTF-8 -*-
#===============================================================================
# Name : check_cisco_temp.py
# Author : <NAME> <<EMAIL>>
# Description : Check all temperature on Cisco devices and alert if one is above thresholds.
#---------------------... |
from typing import TypeVar, Type, Dict, Union, List
import logging
import importlib
import inspect
import copy
from datapipelines import (
DataPipeline,
DataSink,
DataSource,
CompositeDataTransformer,
DataTransformer,
)
from ..data import Region, Platform
T = TypeVar("T")
logging.basicConfig(
... |
from helper import remove_punc
import numpy as np
import nltk
from nltk.corpus import stopwords
from nltk.stem import WordNetLemmatizer
from nltk.stem import PorterStemmer
#nltk.download('punkt')
#Clean and lemmatize the contents of a document
#Takes in a file name to read in and clean
#Return a list of wo... |
#!/usr/bin/env python
# encoding: utf-8
import os
import re
import sys
import argparse
import math
from datetime import timedelta
class CueSheet():
_fields = [
"performer",
"songwriter",
"title",
"flags",
"isrc"
]
def __init__(self):
self.rem = None
... |
# coding=utf-8
#
# This file is part of Hypothesis (https://github.com/DRMacIver/hypothesis)
#
# Most of this work is copyright (C) 2013-2015 <NAME>
# (<EMAIL>), but it contains contributions by others. See
# https://github.com/DRMacIver/hypothesis/blob/master/CONTRIBUTING.rst for a
# full list of people who may hold c... |
import numpy as np
def cls_type_to_id(cls_type):
type_to_id = {'Car': 1, 'Pedestrian': 2, 'Cyclist': 3, 'Van': 4}
if cls_type not in type_to_id.keys():
return -1
return type_to_id[cls_type]
class Object3d(object):
def __init__(self, line):
label = line.strip().split(' ')
self... |
#!/usr/bin/env python
# coding: utf-8
"""Using the parser to recognise your own semantics
spaCy's parser component can be used to trained to predict any type of tree
structure over your input text. You can also predict trees over whole documents
or chat logs, with connections between the sentence-roots used to annotat... |
"""Tests of the transform submodule"""
import math
import pytest
from fiona import transform
from .conftest import requires_gdal_lt_3
TEST_GEOMS = [
{"type": "Point", "coordinates": [0.0, 0.0, 1000.0]},
{
"type": "LineString",
"coordinates": [[0.0, 0.0, 1000.0], [0.1, 0.1, -1000.0]],
},
... |
#!/usr/bin/python
# Copyright (c) 2014 The Native Client 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 os
import subprocess
import sys
import lib
# Define a list of supported operating systems here. The OS is based on the
# ... |
# -*- coding: utf-8 -*-
"""
数据获取模块,ticK或bar频率
@author: <NAME>
"""
import re
import datetime
import requests
import tushare as ts
import pandas as pd
def get_stock_info():
"""
返回沪深两市所有的股票及其上市时间
"""
stock_info = ts.get_stock_basics()
stock_info = stock_info[['timeToMarket']]
stock_info.index... |
# coding=utf-8
# *** WARNING: this file was generated by the Pulumi SDK Generator. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union, overload
from ... import _utilities
fro... |
#
# All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
# its licensors.
#
# For complete copyright and license terms please see the LICENSE at the root of this
# distribution (the "License"). All use of this software is governed by the License,
# or, if provided, by the license below or th... |
#!/usr/bin/python3
# -*- coding: utf-8 -*-
"""
ZetCode PyQt5 tutorial
This program creates a statusbar.
author: <NAME>
website: zetcode.com
last edited: January 2015
"""
import sys, os
from PyQt5 import QtCore, QtWidgets
from PyQt5.QtCore import Qt, QSize
from PyQt5.QtGui import QIcon, QFont
from PyQt5.QtWidgets ... |
# Copyright (c) 2020, <NAME> (@e-bug).
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import os
import json
import random
import logging
import _pickle as cPickle
import numpy as np
import torch
from torch.utils.data import Dataset
logge... |
# Import the .NET class library
import clr, ctypes
# Import python sys module
import sys, os
# numpy import
import numpy as np
# Import c compatible List and String
from System import *
from System.Collections.Generic import List
from System.Runtime.InteropServices import Marshal
from System.Runtime.Int... |
# -*- cofing: utf-8 -*-
# MIT License
#
# Copyright (c) 2021 - Present nxtlo
#
# 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 limitation the rights
# t... |
from argparse import Namespace, ArgumentParser
from datetime import datetime
import re
import textwrap
from typing import TYPE_CHECKING, Callable, Iterable, Union
from itertools import combinations, chain
from os import path, makedirs, getenv, get_terminal_size
from termcolor import colored, COLORS, cprint
if TYPE_CHE... |
# coding: utf-8
from __future__ import print_function, division, absolute_import
from cutadapt.align import (locate, compare_prefixes, compare_suffixes,
Aligner)
from cutadapt.adapters import BACK
class TestAligner():
def test(self):
reference = 'CTCCAGCTTAGACATATC'
al... |
"""This module defines unit test data files and functions to access them.
Data files used in tests are truncated PDB files, e.g. most of atoms and/or
models and/or header sections are removed for having a compact installation
package that contains test modules and files as well."""
from os.path import join, isfile, s... |
# Copyright The PyTorch Lightning team.
#
# 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 i... |
import json
import requests
import datetime
import hashlib
import hmac
import base64
import subprocess
import socket
import os
import glob
import struct
#110: sm_app_clock (expect 1410 on A100, assume MHz)
#110: mem_app_clock (expect 1215 on A100, assume MHz))
#150: gpu_temp (in C)
#203: gpu_utilization
#252: fb_used ... |
# ===============================================================================
# Copyright 2012 <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/LI... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.