text
string
size
int64
token_count
int64
import time import os import pickle import warnings from typing import Union, Type, Optional, Dict, Any, Callable import gym import torch as th import numpy as np from stable_baselines3.common import logger from stable_baselines3.common.base_class import BaseAlgorithm from stable_baselines3.common.policies import Bas...
14,107
3,829
from django.conf.urls import url from django.contrib.auth import views as auth_views from django.contrib.auth.forms import AuthenticationForm from oscar.core.application import ( DashboardApplication as BaseDashboardApplication) from oscar.core.loading import get_class class DashboardApplication(BaseDashboardApp...
2,743
873
# -*- coding: utf-8 -*- # Generated by Django 1.10.4 on 2017-04-07 20:17 from __future__ import unicode_literals from django.conf import settings from django.db import migrations, models import django.db.models.deletion import uuid class Migration(migrations.Migration): dependencies = [ migrations.swapp...
4,783
1,374
import pandas as pd import pickle def read_metric_logs(bucket_type): metrics = pd.DataFrame(columns=['source_type', 'target_type', 'stats']) type_list_path = f'/l/users/shikhar.srivastava/data/pannuke/{bucket_type}/selected_types.csv' type_list = pd.read_csv(type_list_path)['0'] for source_type in t...
820
274
from D_E_U import * D_E = DSS(*extra_layer(vgg(base['dss'], 3), extra['dss']),config.BATCH_SIZE).cuda() U = D_U().cuda() U.cuda() data_dirs = [ ("/home/rabbit/Datasets/DUTS/DUT-train/DUT-train-Image", "/home/rabbit/Datasets/DUTS/DUT-train/DUT-train-Mask"), ] test_dirs = [("/home/rabbit/Datasets/SED1/SED1-I...
5,373
2,235
class Solution: def canArrange(self, arr: List[int], k: int) -> bool: """Hash table. Running time: O(n) where n == len(arr). """ d = collections.defaultdict(int) for a in arr: d[a % k] += 1 for key, v in d.items(): if key == 0 and v % 2 == 1: ...
445
137
# Machine Learning Online Class - Exercise 2: Logistic Regression # # Instructions # ------------ # # This file contains code that helps you get started on the logistic # regression exercise. You will need to complete the following functions # in this exericse: # # sigmoid.py # costFunction.py # predic...
5,122
1,870
# -*- coding: utf-8 -*- import pytest import goldsberry test_data = [ (goldsberry._nbaLeague, 'NBA', '00'), (goldsberry._nbaLeague, 'WNBA', '10'), (goldsberry._nbaLeague, 'NBADL', '20'), (goldsberry._nbaSeason, 1999, '1999-00'), (goldsberry._nbaSeason, 2000, '2000-01'), (goldsberry._seasonID, 1999, '21999'), (goldsb...
2,866
1,240
#poly_gauss_coil model #conversion of Poly_GaussCoil.py #converted by Steve King, Mar 2016 r""" This empirical model describes the scattering from *polydisperse* polymer chains in theta solvents or polymer melts, assuming a Schulz-Zimm type molecular weight distribution. To describe the scattering from *monodisperse* ...
4,295
1,772
# Copyright (c) 2021 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by appli...
4,939
1,621
import os from itertools import product from concurrent import futures from contextlib import closing from datetime import datetime import numpy as np from . import _z5py from .file import File, S3File from .dataset import Dataset from .shape_utils import normalize_slices def product1d(inrange): for ii in inrang...
14,814
4,561
"""Sensor platform support for Waste Collection Schedule.""" import collections import datetime import logging from enum import Enum import homeassistant.helpers.config_validation as cv import voluptuous as vol from homeassistant.components.sensor import PLATFORM_SCHEMA from homeassistant.const import CONF_NAME, CONF...
8,485
2,477
from concurrent.futures import ThreadPoolExecutor from functools import partial from json import JSONDecodeError import requests from funcy.calc import cache from funcy.debug import print_calls from funcy.simple_funcs import curry HEADERS = { "Accept": "application/json, text/javascript, */*; q=0.01", "User-A...
2,622
868
# -*- coding: utf-8 -*- # Pour passer de TICDataXXXFromBitfields @ TICDataBatchXXXFromFieldIndex # Expressions régulière notepad++ # Find : TICDataSelectorIfBit\( ([0-9]*), Struct\("([^\"]*)"\/([^\)]*).* # Replace: \1 : \3, # \2 from ._TIC_Tools import * from ._TIC_Types import * TICDataICEpFromBitfields = Struct...
4,398
2,268
# -*- coding: utf-8 -*- # # Copyright (c) 2016 Red Hat, 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...
2,095
599
import os import io import sys import subprocess import shlex import logging from threading import Timer from typing import Callable, Any, List from pathlib import Path # noqa: for doctest import tempfile # noqa: for doctest from .toolz import ( merge, map, pipe, curry, do, cprint ) log = log...
7,518
2,316
""" Data creation: Load the data, normalize it, and split into train and test. """ ''' Added the capability of loading pre-separated UCI train/test data function LoadData_Splitted_UCI ''' import numpy as np import os import pandas as pd import tensorflow as tf DATA_PATH = "../UCI_Datasets" class DataGenerator:...
8,934
3,201
from dataclasses import dataclass @dataclass class Paths: log: str data: str @dataclass class Files: train_data: str train_labels: str test_data: str test_labels: str @dataclass class Params: epoch_count: int lr: float batch_size: int @dataclass class MNISTConfig: paths: ...
362
129
import pprint import numpy as np import matplotlib.pyplot as plt import seaborn as sns from sklearn import manifold from gensim.models import KeyedVectors # Download polish word embeddings for word2vec github/Google drive: # https://github.com/sdadas/polish-nlp-resources # with 100 dimensionality word2vec_100 = KeyedV...
14,103
8,340
# This script adds a new message to a specific SQS queue # # Author - Paul Doyle Aug 2013 # # #from __future__ import print_function import sys import Queue import boto.sqs import argparse import socket import datetime import sys import time from boto.sqs.attributes import Attributes parser = argparse.ArgumentParser()...
1,427
583
from typing import Optional import pandas as pd from dero.ml.typing import ModelDict, AllModelResultsDict, DfDict def model_dict_to_df(model_results: ModelDict, model_name: Optional[str] = None) -> pd.DataFrame: df = pd.DataFrame(model_results).T df.drop('score', inplace=True) df['score'] = model_results[...
1,547
491
import pygame from engine.utils import Rect from engine.app import get_screen_size # EXPORT class View(object): def __init__(self, rect=None): if rect: self.rect = rect else: res = get_screen_size() self.rect = Rect(0,0,res[0],res[1]) def offset(self, d): ...
663
224
import shelve, random arguments = ["self", "info", "args", "world"] minlevel = 2 helpstring = "coin <bet>" def main(connection, info, args, world) : """Decides heads or tails based on the coinchance variable. Adds or removes appropriate amount of money""" money = shelve.open("money-%s.db" % (connection.netwo...
1,640
495
from __future__ import print_function import emcee from multiprocessing import Pool import numpy as np import corner import matplotlib.pyplot as plt import sys import scipy.optimize as op from rbvfit.rb_vfit import rb_veldiff as rb_veldiff from rbvfit import rb_setline as rb import pdb def plot_model(wave_obs,fnorm,e...
13,562
5,019
#!/usr/bin/env python3 # -*- coding:utf-8 -*- # Copyright (c) Megvii, Inc. and its affiliates. import torch from torch.utils.data.dataloader import DataLoader as torchDataLoader from torch.utils.data.dataloader import default_collate import os import random from .samplers import YoloBatchSampler def ...
6,409
2,107
#!/usr/bin/python # Copyright: Ansible Project # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) from __future__ import (absolute_import, division, print_function) __metaclass__ = type DOCUMENTATION = r''' --- module: ec2_vpc_vpn_info version_added: 1.0.0 short_description:...
7,765
2,207
import discord from discord.ext import commands from pathlib import Path from config import bot from collections import OrderedDict import json class RoleSelector(commands.Cog): def __init__(self, bot): self.bot = bot self.messages_path = str(Path('cogs/data/messages.json')) async def opener(...
10,454
3,386
# Define a procedure, fibonacci, that takes a natural number as its input, and # returns the value of that fibonacci number. # Two Base Cases: # fibonacci(0) => 0 # fibonacci(1) => 1 # Recursive Case: # n > 1 : fibonacci(n) => fibonacci(n-1) + fibonacci(n-2) def fibonacci(n): return n if n ==...
468
212
#!/usr/bin/env python3 from .base_test import BaseTest from fbc.symphony.cli.graphql_compiler.gql.utils_codegen import CodeChunk class TestRendererDataclasses(BaseTest): def test_codegen_write_simple_strings(self): gen = CodeChunk() gen.write('def sum(a, b):') gen.indent() gen.wri...
1,876
654
from flask import Flask def create_app(): app = Flask(__name__) app.config['JSON_AS_ASCII'] = False from .views import app as main_app app.register_blueprint(main_app) return app
202
69
import os import json def get_config(action, optimised = False): """ action: train, test, export or gdrive optimised: False --> DenseNet121 True --> DenseNet121Eff """ root_path = os.path.dirname(os.path.dirname(os.path.dirname(os.path.realpath(__file__)))) config_path = os....
898
293
# -*- coding: utf-8 -*- # Generated by the protocol buffer compiler. DO NOT EDIT! # source: udpa/annotations/versioning.proto """Generated protocol buffer code.""" from google.protobuf import descriptor as _descriptor from google.protobuf import message as _message from google.protobuf import reflection as _reflection...
3,337
1,181
import re from core.actionModule import actionModule from core.keystore import KeyStore as kb from core.utils import Utils class scan_smbclient_nullsession(actionModule): def __init__(self, config, display, lock): super(scan_smbclient_nullsession, self).__init__(config, display, lock) self.title ...
2,787
806
from numpy import logspace from sys import path as sysPath sysPath.append('../../src') #load the module from interfacePy import Cosmo cosmo=Cosmo('../../src/data/eos2020.dat',0,1e5) for T in logspace(-5,5,50): print( 'T=',T,'GeV\t', 'H=',cosmo.Hubble(T),'GeV\t', 'h_eff=',cosmo.heff(T),...
2,652
1,270
from __future__ import annotations from typing import Optional from psion.oauth2.exceptions import InvalidClient, OAuth2Error, UnsupportedTokenType from psion.oauth2.models import JSONResponse, Request from .base import BaseEndpoint class RevocationEndpoint(BaseEndpoint): """ Endpoint used by the `Client` ...
5,236
1,282
#!/usr/bin/env python3 import argparse import logging import sys import zlib sys.path.append("../..") from bento.client.api import ClientConnection from bento.common.protocol import * import bento.common.util as util function_name= "browser" function_code= """ import requests import zlib import os def browser(url, ...
1,851
603
from app import webapp, mysql from app.models import Search , Utils, Collection, WebUtils from flask import request, jsonify from flask.ext.jsonpify import jsonify as jsonp import json ''' Generic search call @params q: search query page: the page number of search results (default 0) t...
3,429
1,077
from flask import Flask, make_response app = Flask(__name__) @app.route("/") @app.route("/index.html") def index(): html = open("assets/index.html").read() return html @app.route("/assets/<name>") def wasm(name): r = make_response(open(f"assets/{name}","rb").read()) if name.endswith(".wasm"): ...
555
204
from .audio_source import AudioSource from engine import disk import pyglet.media class AudioDirector(object): """Director for loading audio and controlling playback. Attributes: attenuation_distance (int): The default attenuation distance for newly loaded audio. Existing audio will retai...
8,496
2,197
import os import time print("=====================================================================") print(" ") print(" STARTING SYSTEM REPAIR ") print(" ...
2,858
803
import numpy as np import pytest import torch from PIL import Image from pytorch_fid import fid_score, inception @pytest.fixture def device(): return torch.device('cpu') def test_calculate_fid_given_statistics(mocker, tmp_path, device): dim = 2048 m1, m2 = np.zeros((dim,)), np.ones((dim,)) sigma = ...
3,368
1,108
#!/usr/bin/env python # -*- coding: utf-8 -*- import socket import time class emsc_client: def __init__(self): self.host = "10.10.83.174" self.port = 5000 self.conn = socket.socket(socket.AF_INET, socket.SOCK_STREAM) def run(self): try: self.conn.connect((self.ho...
873
349
""" SNMP subagent entrypoint. """ import asyncio import functools import os import signal import sys import ax_interface from sonic_ax_impl.mibs import ieee802_1ab from . import logger from .mibs.ietf import rfc1213, rfc2737, rfc2863, rfc3433, rfc4292, rfc4363 from .mibs.vendor import dell, cisco # Background task u...
2,765
1,012
#!/usr/bin/python3 from __future__ import absolute_import, print_function from optparse import OptionParser, make_option import os import sys import uuid import dbus import dbus.service import dbus.mainloop.glib import time import socket from gi.repository import GLib from dbus.mainloop.glib import DBusGMainLoop impor...
8,000
2,652
import ai2thor.controller import numpy as np from PIL import Image, ImageDraw def get_rotation_matrix(agent_rot): ####### # Construct the rotation matrix. Ref: https://en.wikipedia.org/wiki/Rotation_matrix ####### r_y = np.array([[np.cos(np.radians(agent_rot["y"])), 0, np.sin(np.radians(agent_rot["y"...
11,479
3,335
# --------------------------------------------------------------------- # ElectronR.KO01M.get_metrics # --------------------------------------------------------------------- # Copyright (C) 2007-2020 The NOC Project # See LICENSE for details # --------------------------------------------------------------------- # NOC...
3,754
1,221
from __future__ import print_function __author__ = "Gianluca Santoni" __copyright__ = "Copyright 20150-2019" __credits__ = ["Gianluca Santoni, Alexander Popov"] __license__ = "" __version__ = "1.0" __maintainer__ = "Gianluca Santoni" __email__ = "gianluca.santoni@esrf.fr" __status__ = "Beta" from scipy.cluster impo...
17,041
5,498
#!/usr/bin/env python # Author: Nick Zwart # Date: 2015oct31 from __future__ import print_function import os import sys import stat import errno import shutil import optparse import traceback import subprocess wrappaconda_name_string = 'Wr[App]-A-Conda' class AppAtizer(object): def __init__(self): # ...
9,992
3,101
import requests class Wallet(object): def __init__(self, testnet=False): if testnet: self.base_url = 'https://testnet.watchtower.cash/api/' else: self.base_url = 'https://watchtower.cash/api/' def _get_utxos(self, wallet_hash, amount): url = self.base_url + f'...
557
199
from scripts.test import shared from . import utils class EmscriptenFinalizeTest(utils.BinaryenTestCase): def do_output_test(self, args): # without any output file specified, don't error, don't write the wasm, # but do emit metadata p = shared.run_process(shared.WASM_EMSCRIPTEN_FINALIZE + ...
858
272
from PyQt5.QtWidgets import QTreeWidget from PyQt5.Qt import pyqtSignal from PyQt5.QtWidgets import QTreeWidgetItem from PyQt5.Qt import Qt class TreeWidget(QTreeWidget): # enum ItemShowMode ItemsCollapsed = 0 ItemsExpanded = 1 def __init__(self, parent=None): super().__init__(parent) s...
6,206
1,720
import os import sys LOCALPATH = os.path.dirname(os.path.abspath(__file__)) sys.path.insert(0, LOCALPATH + '/../../../../') from app.api.v2.db import Db def format_sale(sale): """Formats the results to a dictionary""" sale = { "id": sale[0], "books": sale[1], "total": sale[2], ...
1,400
468
from bleSuite import bleConnectionManager, bleServiceManager from bluepy.btle import Scanner from ubirch.linux.bleServiceManager import BLEServiceManager class BLEManager(object): """ BLE network manager """ def __init__(self, address, adapter, addressType, securityLevel, createRequester, psm=0, mtu=0): ...
4,035
1,141
# Copyright (c) 2015-2020 Wind River Systems, Inc. # # SPDX-License-Identifier: Apache-2.0 # from cgtsclient.common import base from cgtsclient import exc CREATION_ATTRIBUTES = ['software_version', 'compatible_version', 'required_patches'] IMPORT_ATTRIBUTES = ['path_to_iso', 'path_to_sig', '...
1,952
629
# Copyright 2021 Sony Semiconductors Israel, Inc. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required b...
10,984
3,435
""":run """ import curses import datetime import json import logging import os import re import shlex import shutil import time import uuid from math import floor from queue import Queue from typing import Any from typing import Callable from typing import Dict from typing import List from typing import Optional from ...
33,494
9,261
#!/usr/bin/python # -*- coding: UTF-8 -*- """ @file : __init__.py.py @Time : 2020/11/12 13:37 @Author: Tao.Xu @Email : tao.xu2008@outlook.com """ """ phoronix-test-suite: Main for Performance Test =================== https://github.com/phoronix-test-suite/phoronix-test-suite The Phoronix Test Suite is the most compr...
480
193
# Copyright 2018 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, s...
8,279
2,590
from random import randint def k_means(data, K): """ k-Means clustering TODO: Assumes values from 0-255 :param data: NxD array of numbers :param K: The number of clusters :return: Tuple of cluster means (KxD array) and cluster assignments (Nx1 with values from 1 to K) """ N = len(dat...
1,843
623
""" Support for interacting with ModelCenter via the AnalysisServer protocol. Client-mode access to an AnalysisServer is provided by the 'client', 'factory', and 'proxy' modules. Server-mode access by ModelCenter is provided by the 'server' and 'wrapper' modules. An extension to the protocol allows 'eggs' to pe 'publ...
756
199
import os import numpy as np import tensorflow as tf import cv2 import time import sys import pickle import ROLO_utils as util class YOLO_TF: fromfile = None tofile_img = 'test/output.jpg' tofile_txt = 'test/output.txt' imshow = True filewrite_img = False filewrite_txt = False disp_console = True weights_file ...
24,476
11,660
import itertools import re import shlex class ScriptEmptyError(ValueError): pass def _quote_if_contains(value, pattern): if next(iter(re.finditer(pattern, value)), None): return '"{0}"'.format(re.sub(r'(\\*)"', r'\1\1\\"', value)) return value class Script(object): """Parse a script line (...
3,146
884
from .framework import Client, Resource from . import constants as const client = Client( base_url='https://login.microsoftonline.com', base_headers={ 'User-Agent': 'Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Firefox/60.0', 'Content-Type': 'application/x-www-form-urlencoded', ...
1,059
385
import logging import re from warn.cache import Cache as BaseCache from .urls import urls logger = logging.getLogger(__name__) class Cache(BaseCache): """A custom cache for Job Center sites.""" def save(self, url, params, html): """Save file to the cache.""" cache_key = self.key_from_url(u...
1,868
546
# Copyright 2014 Amazon.com, Inc. or its affiliates. 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. A copy of # the License is located at # # http://aws.amazon.com/apache2.0/ # # or in the "license" file accompa...
7,312
2,028
import unittest import speak class SpeakTests(unittest.TestCase): """ Unit test for the speak library """ def testHello(self): self.assertEqual("Hello World!", speak.helloworld()) def testGoodbye(self): self.assertEqual("Goodbye World!", speak.goodbyeworld()) if __name__ == "__mai...
346
108
#!/usr/local/bin/python import sys temperatures=[10,-20,-289,100] def c2f(cel_temp): if cel_temp < -273.15: return "The lowest possible temperature that physical matter can reach is -273.15C" else: fah_temp=(cel_temp*1.8)+32 return fah_temp for temp in temperatures: file = open('...
482
183
#!/usr/bin/env python3 # METADATA OF THIS TAL_SERVICE: problem="eggs" service="confirm_min_throws" args_list = [ ('min',int), ('n_eggs',int), ('n_floors',int), ('lang',str), ('ISATTY',bool), ] from sys import stderr, exit, argv from random import randrange from math import inf as IMPOSSIBLE from ...
2,285
838
errorFound = False def hasError(): global errorFound return errorFound def clearError(): global errorFound errorFound = False def error(message, lineNo = 0): report(lineNo, "", message) def report(lineNo, where, message): global errorFound errorFound = True if lineNo == 0: ...
460
148
#$ header variable x :: int #$ acc parallel private(idx) #$ omp parallel private(idx)
86
28
from django.contrib import admin from .models import Doctor, ConsultationTime, Medicine, Allergy, Child, Parent admin.site.site_header = "Allisto - We Do Good" @admin.register(Doctor) class DoctorAdmin(admin.ModelAdmin): list_display = ('name', 'aadhar_number', 'specialization', 'email', 'phone_number') lis...
1,361
438
from backend.entity.entity import DefinedFuntion from backend.ir.dumper import Dumper from backend.ir.stmt import Assign from backend.ir.stmt import Return from backend.ir.expr import Bin from backend.ir.expr import Call from backend.entity.scope import * def import_ir(data, asm_file): def_vars = list() def_...
4,067
1,203
import numpy as np from pyquil.gate_matrices import X, Y, Z, H from forest.benchmarking.operator_tools.superoperator_transformations import * # Test philosophy: # Using the by hand calculations found in the docs we check conversion # between one qubit channels with one Kraus operator (Hadamard) and two # Kraus operat...
10,060
4,300
class Solution: def solve(self, nums): return [num for num in nums if num != 0] + [0]*nums.count(0)
112
42
import OIL.color import OIL.label import OIL.parser import OIL.tools import OIL.errors
86
30
# Copyright 2013-2021 Lawrence Livermore National Security, LLC and other # Spack Project Developers. See the top-level COPYRIGHT file for details. # # SPDX-License-Identifier: (Apache-2.0 OR MIT) import sys import spack.cmd import spack.cmd.common.arguments as arguments import spack.environment as ev import spack.st...
2,866
864
import numpy as np import imageio from PoissonTemperature import FiniteDifferenceMatrixConstruction def ind_sub_conversion(img, ind2sub_fn, sub2ind_fn): rows, cols = img.shape[:2] num = rows*cols arange = np.arange(rows*cols, dtype=np.int32) ind2sub = np.empty((num, 2), dtype=np.int32) ind2sub[:, ...
1,680
682
from distutils.version import LooseVersion import requests import os import shutil import threading import webbrowser from zipfile import ZipFile from pathlib import Path import traceback import tempfile # import concurrent.futures from flask import Flask, url_for, make_response from flask.json import dumps from flask_...
10,343
3,255
# Copyright Contributors to the Pyro-Cov project. # SPDX-License-Identifier: Apache-2.0 import functools import io import logging import math import re import sys import torch import torch.multiprocessing as mp from Bio import AlignIO from Bio.Phylo.NewickIO import Parser from Bio.Seq import Seq from Bio.SeqRecord im...
9,686
3,582
import numpy as np import pandas as pd from sklearn.linear_model import LinearRegression def convert_to_sqft(str): tokens = str.split(' - ') if len(tokens) == 2: return (float(tokens[0]) + float(tokens[1])) / 2 try: return float(tokens[0]) except Exception: return np.NAN def co...
1,439
514
# https://www.codingame.com/training/easy/bank-robbers from heapq import * def calc_vault_time(c, n): return 10**n * 5**(c - n) def solution(): robbers = int(input()) vault = int(input()) vault_times = [] for i in range(vault): c, n = map(int, input().split()) vault_times.appen...
605
239
""" 模板语言: {{ 变量 }} {% 代码段 %} {% 一个参数时:变量|过滤器, Book.id | add: 1 <= 2 当前id+1来和2比较 两个参数时:变量|过滤器:参数 %}, 过滤器最多只能传2个参数,过滤器用来对传入的变量进行修改 {% if book.name|length > 4 %} 管道|符号的左右不能有多余的空格,否则报错,其次并不是name.length而是通过管道来过滤 {{ book.pub_date|date:'Y年m月j日' }} 日期的转换管道 """ """ CSRF 跨站请求伪造, 盗用...
576
529
# Licensed under a 3-clause BSD style license - see LICENSE.rst """Sky maps.""" from .base import * from .geom import * from .hpx import * from .hpxnd import * from .hpxsparse import * from .hpxmap import * from .wcs import * from .wcsnd import * from .wcsmap import * from .sparse import *
291
108
import warnings from typing import Dict, Tuple from lhotse import CutSet from lhotse.dataset.sampling.base import CutSampler def find_pessimistic_batches( sampler: CutSampler, batch_tuple_index: int = 0 ) -> Tuple[Dict[str, CutSet], Dict[str, float]]: """ Function for finding 'pessimistic' batches, i.e. ...
3,305
991
# -*- coding: utf-8 -*- # Generated by Django 1.11 on 2017-06-03 08:41 from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('book', '0009_book_folder'), ] operations = [ migrations.AddField( ...
606
199
#!/usr/bin/env python import ComparisonStatistics import cdutil import os,sys # Reference ref = os.path.join(cdutil.__path__[0],'..','..','..','..','sample_data','tas_dnm-95a.xml') Ref=cdutil.VariableConditioner(ref) Ref.var='tas' Ref.id='reference' # Test tst = os.path.join(cdutil.__path__[0],'..','..','..','..','s...
1,218
511
import math import numpy as np from mathipy.math import calculus class Linearithmic(calculus.Function): """ f(x) = (mx + h)log_b(kx + a) """ function_type = 'Linearithmic' def __init__(self, m = 1, h = 0, b = 10, a = 0, k = 1): self.m = m self.h = h self.b = b self....
1,087
414
#!/usr/bin/env python # -*- coding: utf-8 -*- """ This module contains the necessary functions to load a text-corpus from NLTK, contract all possible sentences, applying POS-tags to the contracted sentences and compare that with the original text. The information about which contraction+pos-tag pair gets expanded to ...
11,479
3,094
# pylint: disable = C0111 from setuptools import find_packages, setup setup(name="paperai", # version="1.5.0", # author="NeuML", # description="AI-powered literature discovery and review engine for medical/scientific papers", # long_description=DESCRIPTION, # long_description_content_typ...
1,881
627
from io import BytesIO from typing import List, Dict from PIL import Image from hit_analysis.commons.config import Config from hit_analysis.commons.consts import IMAGE, CROP_X, CROP_Y, CROP_SIZE, FRAME_DECODED, CLASSIFIED, CLASS_ARTIFACT, ORIG_IMAGE def append_to_frame(image: Image, detection: dict): hit_img = ...
3,295
1,168
# Copyright 2022 Huawei Technologies Co., Ltd # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to...
7,215
2,601
# -*- coding: utf-8 -*- from scipy.fftpack import fft, fftshift, ifft from scipy.fftpack import fftfreq from scipy.signal import find_peaks from scipy import signal import numpy as np import matplotlib.pyplot as plt import pickle import warnings import sys from scipy.signal.filter_design import maxflat warnings.filter...
42,937
18,800
import numpy as np import numpy.testing as npt import slippy import slippy.core as core """ If you add a material you need to add the properties that it will be tested with to the material_parameters dict, the key should be the name of the class (what ever it is declared as after the class key word). The value should ...
3,623
1,106
#!/usr/bin/env python """Restore files with ending BACKUP_ENDING to original files.""" # The copyright in this software is being made available under the BSD License, # included below. This software may be subject to other third party and contributor # rights, including patent rights, and no such rights are granted un...
2,602
857
# Copyright 2020-2021 OpenDR European Project # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agree...
4,851
1,746
# -*- coding: utf-8 -*- # Generated by Django 1.10.8 on 2019-01-30 10:40 from __future__ import unicode_literals import bluebottle.utils.fields from decimal import Decimal from django.db import migrations, models import django.db.models.deletion import djmoney.models.fields class Migration(migrations.Migration): ...
956
333
# import os # os.environ.setdefault('PICKLE_STORAGE_SETTINGS', 'pickle_storage.tests.settings')
95
36
import argparse import json import os class Config: DATA_PREFIX = "data" EXPERIMENT_PREFIX = "experiments" def write_config_to_file(args, output_path): config_path = os.path.join(output_path, "args.json") with open(config_path, 'w', encoding='utf-8') as f: json.dump(args.__dict__, f, indent...
6,592
2,048
from __future__ import absolute_import from __future__ import division, print_function, unicode_literals from sumy.parsers.html import HtmlParser from sumy.parsers.plaintext import PlaintextParser from sumy.nlp.tokenizers import Tokenizer #from sumy.summarizers.lsa import LsaSummarizer as Summarizer from sumy.summariz...
2,352
806
"""Unit test package for super_json_normalize."""
50
15