text stringlengths 1 927k |
|---|
class Node:
def __init__(self, value):
self.value = value
self.next = None
class LinkedList:
def __init__(self, init_list: list = None):
self.head = None
if init_list:
for value in init_list:
self.append(value)
def append(self, value):
i... |
# Copyright 2018 DeepMind Technologies Limited. 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 a... |
from flask import Blueprint
from .users import UserList, User
from flask_restful import Api
from .beat import Beat
api_bp = Blueprint('api', __name__)
api = Api(api_bp, prefix='/ohioh/api/v1')
api.add_resource(Beat, '/')
api.add_resource(UserList, '/users')
api.add_resource(User, '/users/<user_id>') |
# global
import tensorflow as tf
from tensorflow.python.types.core import Tensor
from typing import Union, Optional, Tuple, Literal
# local
from ivy import inf
# noinspection PyUnusedLocal,PyShadowingBuiltins
def vector_norm(x: Tensor,
axis: Optional[Union[int, Tuple[int]]] = None,
k... |
# -*- coding: utf-8 -*-
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: tensorboard/compat/proto/event.proto
import sys
_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
from google.protobuf.internal import enum_type_wrapper
from google.protobuf import descriptor as _descr... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""
Created on Fri May 1 16:28:06 2015
@author: ddboline
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import csv
import gzip
import numpy as np
import pandas as pd
f... |
import numpy as np
import iso639
from collections import defaultdict
all_langs = ('cay', 'dan', 'deu', 'eng', 'fra', 'kwk', 'see', 'swe')
codelang = [('cay', 'Cayuga'), ('see', 'Seneca'), ('other', 'Other')]
code2lang_dict = {c:l for (c,l) in codelang}
lang2code_dict = {l:c for (c,l) in codelang}
def code2lang(code)... |
import copy
configs = dict()
config = dict(
agent=dict(),
algo=dict(
discount=0.99,
batch_size=256,
learning_rate=1.5e-4, # Adam Optimizer
target_update_interval=1000,
clip_grad_norm=40.,
min_steps_rl=int(1e5),
double_dqn=True,
prioritized_repl... |
from django.db.transaction import non_atomic_requests
from django.utils.decorators import classonlymethod
from django_statsd.clients import statsd
from elasticsearch_dsl import Q, query
from rest_framework import mixins, status, viewsets
from rest_framework.decorators import action
from rest_framework.exceptions impor... |
import yaml
from easydict import EasyDict as edict
from tensorflow.python.ops import data_flow_ops
import tensorflow as tf
def load_yml(path):
with open(path, 'r') as f:
try:
config = yaml.load(f)
print(config)
return edict(config)
except yaml.YAMLError as exc:
... |
import torch
import torch.nn as nn
import torch.nn.functional as F
import sys
from Modules.MultiHeadAttention import MultiHeadAttention
class Attention(nn.Module):
def __init__(self, dim):
super(Attention, self).__init__()
self.encoders = self._build_model(dim)
def _build_model(self, dim):
... |
import numpy as np
def correct_boxes(boxes, hwls, xyzs, yaws, path_calib):
with open(path_calib, "r") as ff:
file = ff.readlines()
p2_str = file[2].split()[1:]
p2_list = [float(xx) for xx in p2_str]
P = np.array(p2_list).reshape(3, 4)
boxes_new = []
for idx in range(boxes):
hw... |
from pyfk.config.config import Config, SeisModel, SourceModel
from pyfk.gf.gf import calculate_gf
from pyfk.gf.waveform_integration import mpi_info
from pyfk.sync.sync import calculate_sync, generate_source_time_function
__all__ = [
"SourceModel",
"SeisModel",
"Config",
"calculate_gf",
"calculate_s... |
# -*- coding: utf-8 -*-
"""
Created on Thu Feb 21 15:38:52 2019
@author: Ditskih
"""
import os
import json
import re
import csv
from nltk.tokenize import word_tokenize
from nltk.stem import WordNetLemmatizer
from sklearn.feature_extraction.text import CountVectorizer
#from sklearn.feature_extraction.text import ENGLIS... |
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... |
"""add sessions table
Revision ID: 3ee15b8edebb
Revises: feac35539764
Create Date: 2018-08-03 23:32:03.940252
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '3ee15b8edebb'
down_revision = 'feac35539764'
branch_labels = None
depends_on = None
def upgrade():
... |
import os
import time
import torch
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
class Callback:
def __init__(self): pass
def on_train_begin(self, logs): pass
def on_train_end(self, logs): pass
def on_epoch_begin(self, epoch, logs): pass
def on_epoch_end(self, epoch, logs):... |
import iu.i524.S17IRP013.ncdc.weather_services as Services
import iu.i524.S17IRP013.dao.stations_dao as stations
import iu.i524.S17IRP013.dao.weather_dao as weather
import iu.i524.S17IRP013.util.app_util as AppUtil
###############################################################
def load_stations():
limit = 25 ... |
from math import gcd
# def getGcd(n, m):
# while m != 0:
# temp = n % m
# n = m
# m = temp
# return n
def solution(n: int, m: int):
# gcd = getGcd(n, m)
# lcm = n * m // gcd
# return [gcd, lcm]
g = gcd(n, m)
l = n * m // g
return g, l
if __name__ == "__main_... |
import sys
import random
import string
import datetime
import logging
import subprocess
import json
import time
import requests
import urllib.request
import ssl
# Fixed Scraping: SSL: CERTIFICATE_VERIFY_FAILED error
ssl._create_default_https_context = ssl._create_unverified_context
HELP = """OPTIONS:
--cute ... |
# LTD simulation models / perturbances
# Attribute name case sensitive.
# Commented and empty lines are ignored
# Double quoted variable names in sysPert parameters ignored
# Uses Steps and no ACE filtering
# Perturbances
mirror.sysPerturbances = [
#'load 9 : step P 5 75 rel',
#'gen 5 : step Pm 5 -75 rel',
... |
from django.shortcuts import redirect, render
from django.views.generic.base import TemplateView
from django.views.generic.edit import CreateView
from django.urls import reverse_lazy
from django.contrib.auth import login
from django.contrib import messages
from django.db import transaction
from .forms import CustomUser... |
"""
Elo Rating Calculator
"""
from whist.core.scoring.score_card import ScoreCard
from whist.core.scoring.team import Team
from whist.core.user.player import Player
# pylint: disable=too-few-public-methods
class EloRater:
"""
Static class that calculates the Elo-Rating for players after several hands played.
... |
# 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 ... |
from setuptools import setup
setup(name='gym_tictac4',
version='0.0.1',
install_requires=['gym'] # And any other dependencies foo needs
) |
import requests
import urllib.parse
import base64
import json
import io
import numpy as np
from PIL import Image
import cv2.cv2 as cv
from solve import *
def combine_and_show_alphabet():
imgTop = np.empty((50, 0))
imgBottom = np.empty((50, 0))
for char in alphabet[:16]:
imgTop = np.append(imgTop, n... |
import unittest
import sys
import os
import glob
root = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
sys.path.append(root)
from ResultsWriter import ImageWithBoundingBoxes
class TestResultsWriter(unittest.TestCase):
def test_basic_box_drawing(self):
writer = ImageWithBoundingBoxes()
... |
from __future__ import (absolute_import, division, print_function,
unicode_literals)
import six
import matplotlib
import matplotlib.artist as martist
from matplotlib.artist import allow_rasterization
from matplotlib import docstring
import matplotlib.transforms as mtransforms
import matplotli... |
"""
class NewUser:
def __init__(self, fName, mName, lName, nickName, photo, title, company, address, hTel, mTel, wTel, eMail, homepage, sAddress, sHome, sNotes):
self.fName = fName
self.mName = mName
self.lName = lName
self.nickName = nickName
self.photo = photo
self.... |
_components = {}
def add_component(path, data):
_components[path] = data
def get_component(path):
try:
return _components[path]
except KeyError:
raise NameError('There is no component with path {}'.format(path)) |
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import math
import sys
import beanmachine.ppl as bm
import pytest
import torch
import torch.distributions as dist
from beanmachine.ppl.infe... |
import os
from decouple import config, Csv
DEBUG = config('DEBUG', default=False, cast=bool)
FRANCIS_TOKEN = config('FRANCIS_TOKEN')
OZ_TOKEN = config('OZ_TOKEN')
MY_ID = config('MY_ID', cast=int)
SERVER_ID = config('SERVER_ID', cast=int)
BOT_PREFIX = config('BOT_PREFIX', default='!')
# Twitter stuff
TWITTER_CONSUME... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Author : jeffzhang
# @Time : 2019/9/6
# @File : port_orm.py
# @Desc : ""
import time
from bson import ObjectId
from flask import session
from fuxi.core.databases.db_error import DatabaseError
from fuxi.core.databases.orm.database_base import DatabaseBase
from... |
import wx
import wx.lib.agw.customtreectrl as customtree
class BaseTreeControl(customtree.CustomTreeCtrl):
def __init__(self, parent, *args, **kwargs):
"""Base tree controls implements a custom drag drop operation"""
customtree.CustomTreeCtrl.__init__(self, parent, *args, **kwargs)
# for... |
from keras.applications.resnet50 import ResNet50
from keras.preprocessing import image
from keras.applications.resnet50 import preprocess_input
from keras.models import Model
import numpy as np
import time
import cv2
def collect_demo(path, num_patch, aux_dim, action_dim):
for i in range(num_patch):
path_... |
import torch
import numpy as np
import time
import pdb
from rlkit.torch.core import eval_np, np_ify
import argparse
parser = argparse.ArgumentParser()
parser.add_argument('--exp_name', type=str, default='SimpleSupLSTM')
parser.add_argument('--extra_name', type=str, default='obs1int10')
parser.add_argument('--log_dir',... |
import os
import Utils
def load_data():
files = []
documents = []
path = 'Data/Plagiarism Documents';
for r, d, f in os.walk(path):
for file in f:
if '.txt' in file:
files.append(path+'/'+file)
for path in files:
file = open(path ,'r')
lines = ... |
#!/usr/bin/env python
import sys
sys.path.append("../")
from harborclient_light import harborclient
host = "127.0.0.1"
user = "admin"
password = "Harbor12345"
client = harborclient.HarborClient(host, user, password)
# Promote as admin
user_id = 2
client.promote_as_admin(user_id) |
import sys
import json
from datetime import datetime
lastEnd=0
with open(sys.argv[1]) as json_file:
data = json.load(json_file)
times=sorted(list(data['details']))
for time in times:
p=data['details'][time]
print('{0} {1} {2}-{3}'.format(
datetime.utcfromtimestamp(p['unixTimeBegin']).strftime('%Y-%m-%d %H:%... |
# -*- coding: utf-8 -*-
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
"""
This file contains components with some default boilerplate logic user may need
in training / testing. They will not work for everyone, but many users may find them useful.
The behavior of functions/classes in this file ... |
# -*- coding: utf-8 -*-
# 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... |
from os import listdir
import os.path as osp
class AudiofileProcessor(object):
SECONDS = 60
POMADORO_LENGTH_IN_SECONDS = 25 * SECONDS
def __init__(self, directory, filter_by_ext, length_calculator):
self.directory = directory
self.filter_by_ext = filter_by_ext
self.length_calculator = length_calculator
de... |
# -*- coding: utf-8 -*-
from dndgui.gui import MainForm |
#!/usr/bin/env python3
"""
Tetris for Python / Tkinter
Ole Martin Bjorndalen
https://github.com/olemb/tetris/
http://tetris.wikia.com/wiki/Tetris_Guideline
"""
import random
from dataclasses import dataclass, replace
import tkinter
shapes = {
# See README.md for format.
'O': ['56a9', '6a95', 'a956', '956a']... |
# Copyright 2021, Kay Hayen, mailto:kay.hayen@gmail.com
#
# Python tests originally created or extracted from other peoples work. The
# parts were too small to be protected.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the ... |
# Copyright The IETF Trust 2007-2020, All Rights Reserved
# -*- coding: utf-8 -*-
# old meeting models can be found in ../proceedings/models.py
import datetime
import io
import os
import pytz
import random
import re
import string
from collections import namedtuple
from pathlib import Path
from urllib.parse import u... |
from django.apps import AppConfig
class CoachesConfig(AppConfig):
name = 'coaches' |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import pytest
import numpy as np
import scipy.ndimage
import dask.array as da
import dask_image.ndfilters
@pytest.mark.parametrize(
"da_func",
[
(dask_image.ndfilters.convolve),
(dask_image.ndfilters.correlate),
]
)
@pytest.mark.parametrize(
... |
from pathlib import Path
def project_root() -> Path:
"""Returns project root folder."""
return Path(__file__).parent.parent |
# -*- coding: utf-8 -*-
"""
Messaging constant variables.
"""
from __future__ import unicode_literals
from builtins import str as text
from django.utils.translation import ugettext as _
XFORM = text('xform')
PROJECT = text('project')
USER = text('user')
APP_LABEL_MAPPING = {
XFORM: 'logger',
PROJECT: 'logg... |
# This file is part of Scapy
# Copyright (C) 2007, 2008, 2009 Arnaud Ebalard
# 2015, 2016, 2017 Maxence Tury
# This program is published under a GPLv2 license
"""
TLS client automaton. This makes for a primitive TLS stack.
Obviously you need rights for network access.
We support versions SSLv2 to TLS 1.... |
import arcpy
import os
# Creates an OGC Geopackage from the CADRG Folder
cwd = arcpy.env.workspace = r"C:\services\data\cadrg"
workspaces = arcpy.ListWorkspaces("*")
gpkgs = []
try:
for workspace in workspaces:
gpkg_name = os.path.split(workspace)[1] + ".gpkg"
if arcpy.Exists(gpkg_name) == Fal... |
from utils import calc_compcor_components, \
erode_mask
from nuisance import create_nuisance, \
calc_residuals, \
bandpass_voxels, \
extract_tissue_data
__all__ = ['create_nuisance', \
'calc_residuals', \
'bandpass_... |
from __future__ import absolute_import
from datetime import timedelta
from django.utils import timezone
from sentry.models import Environment, GroupRelease, Release
from sentry.testutils import TestCase
class GetOrCreateTest(TestCase):
def test_simple(self):
project = self.create_project()
group... |
#! /usr/bin/env python
# $Id: test_contents.py 8771 2021-06-18 18:55:08Z milde $
# Author: David Goodger <goodger@python.org>
# Copyright: This module has been placed in the public domain.
"""
Tests for `docutils.transforms.parts.Contents` (via
`docutils.transforms.universal.LastReaderPending`).
"""
from __future__ i... |
from mongoengine import (
Document,
DynamicDocument,
StringField,
FloatField,
DateField,
IntField,
EmbeddedDocument,
EmbeddedDocumentField,
ListField
)
import re
class Image(EmbeddedDocument):
original = StringField()
stack = StringField()
class Product(DynamicDocume... |
from typing import Optional, Union, cast, Callable
import z3
from mythril.laser.smt.bitvec import BitVec, Bool, And, Annotations
from mythril.laser.smt.bool import Or
import operator
def _arithmetic_helper(
a: "BitVecFunc", b: Union[BitVec, int], operation: Callable
) -> "BitVecFunc":
"""
Helper functi... |
# Importando as bibliotecas necessárias
import pandas as pd
import streamlit as st
import plotly.express as px
from sklearn.ensemble import RandomForestRegressor
# Criando uma função para carregar o dataset
#@st.cache # Notação para ficar em cache
def get_data():
return pd.read_csv("model/data_deploy.csv")
# Cria... |
# Copyright 2015 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 applica... |
# coding: utf-8
from __future__ import unicode_literals, division
import re
from .common import InfoExtractor
from ..compat import compat_HTTPError
from ..utils import (
determine_ext,
float_or_none,
int_or_none,
parse_age_limit,
parse_duration,
url_or_none,
ExtractorError
)
class Crackl... |
from __future__ import unicode_literals
import frappe
from toolz.curried import compose, unique, map, filter
def on_submit(doc, method):
_update_booking_orders(
[x for x in doc.references if x.reference_doctype == "Sales Invoice"]
)
def on_cancel(doc, method):
_update_booking_orders(
[x ... |
do_you_know_this_function() |
import random
from pathlib import Path
from typing import Union, List
import torch
from torch.nn.utils.rnn import pad_sequence
from ..core.transforms_interface import BaseWaveformTransform, EmptyPathException
from ..utils.convolution import convolve
from ..utils.file import find_audio_files
from ..utils.io import Aud... |
from src.query import *
if __name__ == '__main__':
ask_query("[[Authority::Linnaeus]]", "taxa_by_linnaeus.csv") |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from . import __version__ as app_version
app_name = "meeting"
app_title = "Meeting"
app_publisher = "Zlash65"
app_description = "Set up Meetings and stuff"
app_icon = "octicon octicon-file-directory"
app_color = "grey"
app_email = "zarrar65@gmail.com"
app... |
# Copyright 2020 Lane Shaw
#
# 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, softwar... |
# Copyright 2019 The ROBEL 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 or agreed to in wr... |
import functools
import time
import weakref
from enum import IntFlag
from itertools import count
from logging import LoggerAdapter, getLogger
from typing import ClassVar, FrozenSet
from .log import control_layer_logger
def select_version(cls, version):
"""Select closest compatible version to requested version
... |
# -*- coding: utf-8 -*-
# -----------------------------------------------------------------------------
# MIT License
#
# Copyright (c) 2020 Ivo Steinbrecher
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
#... |
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------... |
# MIT License
#
# Copyright (c) 2021 Martin Kloesch
#
# 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
# to use, copy, modify, merg... |
# -*- coding: utf-8 -*-
"""
Created on Wed Aug 22 13:22:01 2018
@author: Cody
"""
from setuptools import setup
from setuptools import Extension
from Cython.Distutils import build_ext
import numpy as np
setup(
cmdclass = {'build_ext': build_ext},
ext_modules = [Extension("Rearranger", sources= ["pyRearranger... |
print(-~sum(map(int,input().split()))//2) |
import unittest
class TestEtagSupport(unittest.TestCase):
def test_interfaces(self):
from OFS.EtagSupport import EtagBaseInterface
from OFS.EtagSupport import EtagSupport
from zope.interface.verify import verifyClass
verifyClass(EtagBaseInterface, EtagSupport) |
import dat_NABS
import importlib
importlib.reload(dat_NABS)
dat_NABS.printme(str="al10.dat") |
from .base_object import BaseObject
from .rectangle import BaseRectangle
from .collectible import BaseCollectible
from .trigger import BaseTrigger
from .obstacle import BaseObstacle
from .layer import BaseLayer |
programCounterX = 0
lines = []
symbol_Table=[]
ErrorFlag = False
ErrorList = []
opCode_Table = {'CLA': 0, 'LAC': 1, 'SAC': 2, 'ADD': 3, 'SUB': 4, 'BRZ': 5, 'BRN': 6, 'BRP': 7, 'INP': 8, 'DSP': 9, 'MUL': 10, 'DIV': 11, 'STP': 12, 'DW':13}
def lineCheck(line):
# used to check if line[0] is a label or symbol
if ... |
import komand
import requests
from .schema import DeprovisionUserInput, DeprovisionUserOutput
class DeprovisionUser(komand.Action):
def __init__(self):
super(self.__class__, self).__init__(
name="deprovision_user",
description="remove user",
input=DeprovisionUserInput()... |
favorite_robot = "Cedric"
meaning_of_life = 42 |
import pytest
from traitlets import TraitError
from ipygany import PolyMesh, IsoColor
from .utils import get_test_assets
def test_default_input():
vertices, triangles, data_1d, data_3d = get_test_assets()
poly = PolyMesh(vertices=vertices, triangle_indices=triangles, data=[data_1d, data_3d])
colored_... |
import pyaf.tests.model_control.test_ozone_custom_models_enabled as testmod
testmod.build_model( ['Integration'] , ['PolyTrend'] , ['NoCycle'] , ['ARX'] ); |
import sys
import threading
import pytest
from tornado import ioloop, web
from dummyserver.server import (
SocketServerThread,
run_tornado_app,
run_loop_in_thread,
DEFAULT_CERTS,
HAS_IPV6,
)
from dummyserver.handlers import TestingApp
from dummyserver.proxy import ProxyHandler
if sys.version_info... |
import re
import utilities.utils as utils
from spytest import st
from spytest.utils import filter_and_select
from spytest.utils import exec_foreach, exec_all
import utilities.common as utility
import apis.switching.portchannel as portchannel
import apis.system.basic as basic
from utilities.parallel import ensure_no_exc... |
#------------------------------------------------------------------------------
#
# Copyright (c) Microsoft Corporation.
# All rights reserved.
#
# This code is licensed under the MIT License.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated document... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
MIT License
Copyright (c) 2019 Paweł Kacperski (screamingbox@gmail.com)
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, inc... |
#coding:utf-8
import flask_login
from flask import render_template
from sigda.models import db, User
from sigda.config.common import ErrorCode
import logging
login_manager = flask_login.LoginManager()
class UserDbService(object):
@staticmethod
def add(email, name, passwd):
u = UserDbService.get_u... |
import codecs
import re
filename = "18181.txt"
#fileone = codecs.open("F:/Dropbox/Master/Plenarprotokolle/Annotiert/alle-final/Gold-18181-noAnhang.conll", "r", "utf-8")
fileone = codecs.open("F:/Dropbox/Master/"+filename+".conll", "r", "utf-8")
TextString = fileone.read()
#print(TextString)
TextList = TextString.spl... |
from django.shortcuts import get_object_or_404, render
from .models import Category, Product
def product_all(request):
products = Product.products.all()
return render(request, 'home.html', {'products': products})
def category_list(request, category_slug=None):
category = get_object_or_404(Category, slu... |
import cv2
import tensorflow as tf
import numpy as np
import random
y = tf.constant([1,2,3,4,5,6], name='y',dtype=tf.float32)
y_ = tf.constant([0,1,2,3,4,5], name='Y_',dtype=tf.float32)
y = tf.reshape(y,[2,3])
y_ = tf.reshape(y_,[2,3])
z= tf.constant([1,2], name='z',dtype=tf.float32)
z=tf.reshape(z,[2,-1])
result=[]... |
from abc import *
class Cipher(metaclass=ABCMeta):
WORDSIZE = 0
WORDMASK = 0
NUM_ROUNDS = 0
@abstractmethod
def name(self):
pass
@abstractmethod
def expand_key(self, mk, num_rounds):
pass
@abstractmethod
def encrypt_one_round(self, pt, rk):
pass
@abst... |
# -*- coding: utf-8 -*-
"""
Tencent is pleased to support the open source community by making 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community
Edition) available.
Copyright (C) 2017-2020 THL A29 Limited, a Tencent company. All rights reserved.
Licensed under the MIT License (the "License"); you may not use this file except in co... |
# Copyright 2021 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.
# pylint: disable=W0401,W0614
from telemetry import story
from telemetry.page import page as page_module
from telemetry.page import shared_page_state
clas... |
from __future__ import division
from __future__ import print_function
from __future__ import absolute_import
from __future__ import unicode_literals
import numpy as np
import argparse
import os
from scipy.stats import pearsonr
import sys
sys.path.append("..")
from scripts.load_movielens import load_movielens
from scri... |
###############################################################################
# prop_mod.py
###############################################################################
#
# Calculate mod without numpy issue
#
###############################################################################
import numpy as np
from t... |
from __future__ import absolute_import
from __future__ import print_function
from __future__ import unicode_literals
import argparse
import io
import tokenize
double_quote_starts = tuple(s for s in tokenize.single_quoted if '"' in s)
def handle_match(token_text):
if '"""' in token_text or "'''" in token_text:
... |
from app import app
import json
import time
from random import random
from flask import Flask, render_template, make_response,request, redirect
@app.route('/create/task', methods = ["POST"])
def createTask():
if request.Method == "POST" :
data = request.get_json()
if |
# coding: utf-8
"""
Copyright 2015 SmartBear Software
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 applica... |
from src.exceptions.exceptions import (
ExternalError,
external_error,
ResourceAlreadySynced,
resource_already_synced,
ResourceNotFound,
resource_not_found,
) |
import pandas as pd
import numpy as np
ts = pd.Series(np.random.randn(1000),index=pd.date_range('1/1/2000', periods=1000))
ts |
from __future__ import absolute_import
from distutils.version import LooseVersion
import scipy # Weird bug in new pytorch when import scipy after import torch
import torch as th
import builtins
from torch.utils import dlpack
from ... import ndarray as nd
from ... import kernel as K
from ...function.base import Targe... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.