text
stringlengths
1
927k
import glob from demisto_sdk.common.tools import re, print_error, print_warning, os, get_yaml from demisto_sdk.common.constants import INTEGRATION_REGEX, BETA_INTEGRATION_REGEX, BETA_INTEGRATION_DISCLAIMER class DescriptionValidator: """DescriptionValidator was designed to make sure we provide a detailed descrip...
# Copyright 2010-2021 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...
from typing import Any, Dict, Optional, Union from sqlalchemy.orm import Session from app.core.security import get_password_hash, verify_password from app.crud.base import CRUDBase from app.models.user import User from app.schemas.user import UserCreate, UserUpdate class CRUDUser(CRUDBase[User, UserCreate, UserUpda...
import numpy as np import pandas as pd #データ分割用 from sklearn.model_selection import train_test_split #LightGBM import lightgbm as lgb #pickle import pickle #データ読み込み df_train = pd.read_csv("train.csv") df_test = pd.read_csv("test.csv") #データ結合 df_train["TrainFlag"] = True df_test["TrainFlag"] = False df_all = df_tra...
import pygame import constants class Bullet(pygame.sprite.Sprite): def __init__(self, screen, plane, speed=30): super().__init__() # 绘制屏幕对象 self.screen = screen # 发射子弹的飞机 self.plane = plane self.speed = speed self.image = pygame.image.load(constants.BUL...
# 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 ...
import pandas as pd from gene import get_gene_bnum df = pd.DataFrame.from_dict( {'OBJECT_ID': ['ECK120000001'], 'OBJECT_SYNONYM_NAME': ['b4053'], 'OS_INTERNAL_COMMENT': [None], 'KEY_ID_ORG': ['ECK12']}, orient="columns") assert(get_gene_bnum("ECK120000001", df) == "b4053") print("DONE")
# coding: utf-8 import os import re import time import signal import shutil import logging import tempfile import subprocess import errno import distutils.version import six try: # yatest.common should try to be hermetic, otherwise, PYTEST_SCRIPT (aka USE_ARCADIA_PYTHON=no) won't work. import library.python....
from pybench import Test class SimpleListManipulation(Test): version = 2.0 operations = 5* (6 + 6 + 6) rounds = 130000 def test(self): l = [] append = l.append for i in xrange(self.rounds): append(2) append(3) append(4) append...
import binwalk.core.plugin class ZipHelperPlugin(binwalk.core.plugin.Plugin): ''' A helper plugin for Zip files to ensure that the Zip archive extraction rule is only executed once when the first Zip archive entry is encountered. This resets once and end of zip archive is found. ''' MODULES...
from __future__ import print_function import matplotlib.pyplot as plt import matplotlib.dates as mdates import pandas as pd import io from flask import Flask, make_response from matplotlib.backends.backend_agg import FigureCanvasAgg as FigureCanvas app = Flask(__name__) @app.route('/plot.png') def home_page(): ch...
"""Integration tests for running tools in Docker containers.""" import os import unittest from base import integration_util from base.populators import ( DatasetPopulator, ) from galaxy.tools.deps.commands import which from .test_job_environments import RunsEnvironmentJobs SCRIPT_DIRECTORY = os.path.abspath(os....
import cv2 import numpy as np import copy import algo.mrcnn.visualize_pdl1 as vis_pdl1 class_names = {"INFLAMMATION": 1, "NEGATIVE": 2, "POSITIVE": 3, "OTHER": 4} def gamma_correction(img, gammas): """ apply gamma correction on the given image. allow different gamma for each color channel :param img:...
import calendar import datetime import struct from dxtbx.format.Format import Format from dxtbx.format.FormatRAXIS import RAXISHelper class FormatRAXISIVSPring8(RAXISHelper, Format): """Format class for R-AXIS4 images. Currently the only example we have is from SPring-8, which requires a reverse axis goniome...
"""Setup for worldmap XBlock.""" import os from setuptools import setup # def package_data(pkg, root): # """Generic function to find package_data for `pkg` under `root`.""" # data = [] # for dirname, _, files in os.walk(os.path.join(pkg, root)): # for fname in files: # path = os.path....
## 3. Condensing the Class Size Data Set ## class_size = data['class_size'] class_size = class_size[class_size['GRADE ']=='09-12' ] class_size = class_size[class_size['PROGRAM TYPE']=='GEN ED'] print(class_size.head()) ## 5. Computing Average Class Sizes ## import numpy as np class_size ...
# ------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for # license information. # -------------------------------------------------------------------------- from typi...
#!/usr/bin/env python # -*- coding: utf-8 -*- """ QDSpy module - interprets and presents compiled stimuli 'Presenter' Presents a compiled stimulus. This class is a graphics API independent. Copyright (c) 2013-2016 Thomas Euler Distributed under the terms of the GNU General Public License (GPL) """ # ----------...
import os import errno from datetime import datetime import pprint import pickle from warnings import warn import csv printer = pprint.PrettyPrinter(indent=4) def make_sure_path_exists(path): '''Make this directory if it doesn't already exist.''' try: os.makedirs(path) return 1 except OSError as exception: i...
from coffea.jetmet_tools.JECStack import JECStack import awkward import numpy import warnings from copy import copy class CorrectedMETFactory(object): def __init__(self, name_map): if 'xMETRaw' not in name_map or name_map['xMETRaw'] is None: warnings.warn('There is no name mapping for ptRaw,'...
# Copyright (c) 2015 Michel Oosterhof <michel@oosterhof.net> # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are met: # # 1. Redistributions of source code must retain the above copyright # notice, th...
import jinja2 from honcho.export.base import BaseExport from honcho.export.base import File class Export(BaseExport): def get_template_loader(self): return jinja2.PackageLoader(__name__, 'templates/supervisord') def render(self, processes, context): context['processes'] = processes f...
# Copyright (C) 2004-2019 by # Aric Hagberg <hagberg@lanl.gov> # Dan Schult <dschult@colgate.edu> # Pieter Swart <swart@lanl.gov> # All rights reserved. # BSD license. # # Authors: Aric Hagberg <aric.hagberg@gmail.com> # Pieter Swart <swart@lanl.gov> # Sasha Gutfraind <ag362@corne...
# Copyright 2022 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...
# Database code for the reports of the Logs Analysis Project. import psycopg2 DBNAME = "news" USER = "postgres" PASSWORD = "123" def get_connection_string(): """Return the connection string""" conn_string = "dbname='" + DBNAME + "' user='" + USER + "' password='" \ + PASSWORD + "'" ret...
from jsf import JSF from fastapi import FastAPI app = FastAPI(docs_url="/") generator = JSF.from_json("custom.json") @app.get("/generate", response_model=generator.pydantic()) def read_root(): return generator.generate()
from cement import App, Controller, ex from boxmetrics.core.info.cpu import CPUInst as infoCPU class CPU(Controller): class Meta: label = "cpu" stacked_on = "info" stacked_type = "nested" description = "Get CPU info" arguments = [ ( ["-D", "--de...
topbar = "Clear My Record | Get help clearing your criminal record in San Francisco" main_headline = "Better days ahead" subheadline = "Reduce or dismiss convictions on your criminal record" call_to_action_time = "Take the first step. Apply in 10 minutes." call_to_action_button = "Apply now" learn_more_button = "Learn ...
import sys import time import forward_messages import helpers try: import config except (ImportError, ModuleNotFoundError): print( "config.py not found. Rename config.example.py to config.py after configuration." ) sys.exit(1) def main(): if config.forward_user: forward_messages....
"""Defines overall information which is media-independent, and relevant to the entire presentation considered as a whole """ from functools import reduce from .atom import FullBox, full_box_derived def atom_type(): """Returns this atom type""" return 'mvhd' @full_box_derived class Box(FullBox): """Mo...
# Question: Given two sorted arrays, find the number of elements in common. The arrays are the same length an each has all distinct elements # # A: 13 27 25 40 49 55 59 # B: 17 35 39 40 55 58 60 from typing import List, Any def get_common_elements(A: list, B: list) -> list: common: List[Any] = [] index = 0 ...
import pandas as pd import sys sys.path.append("../../..") from classification import ( Hierarchy, repeated_table_to_parent_id_table, parent_code_table_to_parent_id_table, spread_out_entries, sort_by_code_and_level, Classification, ) def get_hs_services(file="./in/Services_Hierarchy.csv"): ...
""" Tests of the API :Author: Jonathan Karr <jonrkarr@gmail.com> :Date: 2018-04-19 :Copyright: 2018, Karr Lab :License: MIT """ import types import unittest import wc_model_gen class ApiTestCase(unittest.TestCase): def test(self): self.assertIsInstance(wc_model_gen.ModelGenerator, type)
#!/usr/bin/env python import rospy from sensor_msgs.msg import MagneticField from geometry_msgs.msg import Vector3Stamped class Relay: def __init__(self): rospy.init_node("imu_time") self._mag_pub = rospy.Publisher("imu/mag_fixed", MagneticField, queue_size=10) self._mag_sub = rospy.Subscri...
# -*- coding: utf-8 -*- from django.forms import ModelForm, Form from django.forms.models import inlineformset_factory from django.utils import timezone from django.utils.translation import ugettext_lazy as _ from betterforms.multiform import MultiModelForm from collections import OrderedDict from datetimewidget.wid...
#!/usr/bin/env python2 import os import errno import sys import subprocess import shutil sys.path.append(os.path.join(os.path.dirname(__file__), '..', '..', '..', '..', 'xar')) import xar import xml.etree.ElementTree as ET # Check that the install location is set to / in the settings during the build process test...
# # 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 us...
# coding: utf-8 """ Beanie ERP API An API specification for interacting with the Beanie ERP system # noqa: E501 OpenAPI spec version: 0.2 Contact: dev@bean.ie Generated by: https://github.com/swagger-api/swagger-codegen.git """ from __future__ import absolute_import import re # noqa: F401 #...
import os import argparse from solver import Solver from data_loader import get_loader from torch.backends import cudnn def str2bool(v): return v.lower() in ('true') def main(config): cudnn.benchmark = True if not os.path.exists(config.log_dir): os.makedirs(config.log_dir) if not os.path.exis...
""" File for implemeting migrations Still incomplete. Will be available in the next revision. """ import argparse import os import os.path import shutil TEMPLATE_FILE_NAME = 'template_config_file.py' CONFIG_FILE_NAME = 'migrations_config.py' SCRIPT_FILE_DIR = os.path.dirname(os.path.realpath(__file__)) CONFIG_T...
"""Module containing constants and keyboards displayed by the bot through main.py file. """ from aiogram.types import KeyboardButton, ReplyKeyboardMarkup BACK_BUTTON = "На главную" PENSION_BUTTON = "Готовлюсь к пенсии. С чего начать?" NEED_DOCUMENTS_BUTTON = "Список документов" YEAR_PERIOD_BUTTON = "До пенсии остал...
P = range(4) C = range(10) # Stages: Draws # State: Card we have just drawn; Current board # Actions: Choosing one of the empty positions to place the card # Value function: cards() returns the minimum expected value if we get "card" # when we have board in state "board" _V = {} def cards(card, boar...
# Copyright (c) 2021, INRIA # Copyright (c) 2021, University of Lille # 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, thi...
import argparse import os, sys from abc import ABC, abstractmethod import torch import models import datasets class BaseOptions(ABC): """This class is an abstract base class (ABC) for options. To create a subclass, you need to implement the following five functions: -- <__init__>: ...
import logging import serial import time ################################################################################### class CommUART(object): def __init__(self, address): self.address = address self.sc = None def connect(self): logging.debug("Opening COM port : {0}".format(sel...
# Copyright 2016 Google 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 by applicable law ...
# coding=utf8 # Copyright 2018 JDCLOUD.COM # # 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 ...
""" Created on Mon Nov 05 03:52:36 2018 @author: Paul """ ### Boiler-Plate ### from threading import Thread import matplotlib.pylab as plt import numpy as np import scipy as sp from numpy import random import time from Func import * from iapws97 import _PSat_T #######################################################...
import numpy as np import torch from agents.DQN import Model as DQN_Agent from networks.network_bodies import SimpleBody, AtariBody from networks.networks import DuelingQRDQN from utils.ReplayMemory import PrioritizedReplayMemory class Model(DQN_Agent): def __init__(self, static_policy=False, env=None, config=No...
from sqlalchemy import Column, Integer, String, orm from Model.util import log_message from Model.FirefoxModel.SQLite.base import * ID = "ID" ORIGIN = "Herkunft" TYPE = "Erlaubnistyp" EXPIRYAT = "Ungueltig ab" LASTMODIFIED = "Zuletzt geaendert" class Permission(BaseSession, BaseSQLiteClass): __tablename__ = "moz...
#!/usr/bin/env python3 import unittest from netsuite.api.customer import ( get_or_create_customer, get_customer ) from netsuite.api.sale import ( create_cashsale, create_salesorder ) from netsuite.test_data import ( data, prepare_customer_data, ) class NetsuiteTestCase(unittest.TestCase): ...
import pytest from pytest_lazyfixture import lazy_fixture import stk # Fixtures need to visible for lazy_fixture() calls. from .fixtures import * # noqa @pytest.fixture( scope='session', params=( lambda: stk.Alcohol( oxygen=stk.O(1), hydrogen=stk.H(2), atom=stk.C...
""" Cisco Intersight Cisco Intersight is a management platform delivered as a service with embedded analytics for your Cisco and 3rd party IT infrastructure. This platform offers an intelligent level of management that enables IT organizations to analyze, simplify, and automate their environments in more advan...
#!/usr/bin/env python from azure.identity import ClientSecretCredential from azure.mgmt.network import NetworkManagementClient from relay_sdk import Interface, Dynamic as D import logging logging.basicConfig(level=logging.WARNING) relay = Interface() credentials = ClientSecretCredential( client_id=relay.get(D.a...
# 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 ...
"""Integrate with admin module.""" from django.contrib import admin from django.contrib.auth.admin import UserAdmin as DjangoUserAdmin from django.utils.translation import ugettext_lazy as _ from .models import User @admin.register(User) class UserAdmin(DjangoUserAdmin): """Define admin model for custom User mo...
# 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 ...
# coding: utf-8 # # Copyright 2019 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 "lice...
# Copyright (c) 2020 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by appli...
from cec2013lsgo.cec2013 import Benchmark import numpy as np from jmetal.core.problem import FloatProblem, S class CEC2013LSGO(FloatProblem): def __init__(self, function_type: int = 0, number_of_variables: int = 1000): super(CEC2013LSGO, self).__init__() self.number_of_objectives = 1 sel...
#!/usr/bin/env python2 # # Copyright 2017 Google 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 requir...
import os from scipy import misc import numpy as np import matplotlib.pyplot as plt from skimage.util import img_as_bool # this script creates batches from the dataset # batch size: 224 * 224 * 3 # we save the batch and its ground truth in two separate folders "batches" , "batches_ground path = "/home/ahmed/melanoma...
import Domoticz from devices.custom_sensor import CustomSensor class Adapter(): def __init__(self, devices): self.devices = [] self.devices.append(CustomSensor(devices, 'signal', 'linkquality', ' (Link Quality)')) def convert_message(self, message): return message def register(se...
# This file is part of h5py, a Python interface to the HDF5 library. # # http://www.h5py.org # # Copyright 2008-2013 Andrew Collette and contributors # # License: Standard 3-clause BSD; see "license.txt" for full license terms # and contributor agreement. """ Implements operations common to all high-lev...
import tokenize # # Text: a tokenized (by word) representation of a text # # Must be instantiated from a type implementing readline(), such # as a file # class Text: def __init__(self, data): op = getattr(data, 'readline', None) self.lines = [] if callable(op): self.linedicts =...
"""This module houses helpers to implement safe shutdown of consumers. Module logic applies to all consumers executing in the current python environment, on the main thread. """ import signal import threading from typing import Tuple # Default signals that trigger a shutdown event. DEFAULT_SHUTDOWN_SIGNALS = (signal...
# -*- coding: utf-8 -*- # Copyright (c) 2017, Frappe Technologies Pvt. Ltd. and Contributors # See license.txt from __future__ import unicode_literals import frappe import unittest class TestAssessmentResultTool(unittest.TestCase): pass
# Copyright (c) 2010-2021 openpyxl import pytest import datetime from io import BytesIO from lxml.etree import iterparse, fromstring from openpyxl.xml.constants import SHEET_MAIN_NS from openpyxl.utils.indexed_list import IndexedList from openpyxl.packaging.relationship import Relationship, RelationshipList from op...
import pandas as pd import featuretools as ft def load_weather(nrows=None, return_single_table=False): ''' Load the Australian daily-min-temperatures weather dataset. Args: nrows (int): Passed to nrows in ``pd.read_csv``. return_single_table (bool): Exit the function ea...
# -*- 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...
def dest(t, d): #print(d) if d == 0: return 1 s = 0 for i in range(1, min(d, t)+1): s += dest(i, d-i) return s n = int(input()) print(dest(n, n))
import jsonschema class Verifier: """ A class used to verify documents. Examples ------- Verifying if the `specification_path`'s file uses/follows the schema defined in `schema_path`'s file specification_path = '../../JSON_Files/mDL_specification_prototype.json' schema_path = '../...
import os from flask import render_template from flask_mail import Message from app import create_app from app import mail def send_email(recipient, subject, template, **kwargs): try: app = os.getenv('APP_NAME', 'FLASK') msg = Message( subject + '' + app, sender=os.getenv...
""" deprecated 2019-05 import asyncio import certifi import datetime import pycurl from io import BytesIO from necrobot.util import console from necrobot.util.singleton import Singleton from necrobot.config import Config class VodRecorder(object, metaclass=Singleton): def __init__(self): self._lock = as...
from .base import * DEBUG = False WAGTAILSEARCH_BACKENDS = { 'default': { 'BACKEND': 'wagtail.wagtailsearch.backends.elasticsearch.ElasticSearch', 'INDEX': 'wagtaildemo' } } INSTALLED_APPS+= ( 'djcelery', 'kombu.transport.django', 'gunicorn', ) CACHES = { 'default': { ...
import os import shutil import sys import tempfile from pathlib import Path import django # Path to the temp mezzanine project folder TMP_PATH = Path(tempfile.mkdtemp()) / "project_template" TEST_SETTINGS = """ from . import settings globals().update(i for i in settings.__dict__.items() if i[0].isupper()) # Add ou...
# Copyright (c) 2018 Huawei Technologies Co., Ltd. # All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # ...
''' helper function to use pagination in marketstack to extract values above limit ''' from concurrent.futures import ThreadPoolExecutor import requests def pagination_marketstack_threaded( url: str, token: str, symbol: str, set_total=None) -> list: ''' pagination using threading, all (up to 50 batches...
""" Created on Feb 9, 2016 @author: Chris Smith """ from __future__ import division, print_function, absolute_import, unicode_literals import os import numpy as np from skimage.measure import block_reduce import h5py from .df_utils.dm_utils import read_dm3 from pyUSID.io.image import read_image from pyUSID.io.tran...
from bs4 import BeautifulSoup import requests from chatbotapp.kakaojsonformat.response import * def get_arcademic_answer(): url = "https://plus.cnu.ac.kr/_prog/_board/?code=sub07_0702&site_dvs_cd=kr&menu_dvs_cd=0702" res = requests.get(url) res.raise_for_status() soup = BeautifulSoup(res.content, 'htm...
__title__ = "web_video" __version__ = "0.8" __author__ = "Carl Mai" __license__ = "MIT" from .run import main, run
# pylint: disable=missing-docstring import unittest from django.conf import settings from django.test import TestCase from oauth2_provider.models import AccessToken, Application, RefreshToken from openedx.core.djangoapps.oauth_dispatch.tests import factories from common.djangoapps.student.tests.factories import Use...
from gensim.models import KeyedVectors import numpy as np import nltk # model = KeyedVectors.load_word2vec_format('data/GoogleNews-vectors-negative300.bin',binary=True) # # vecab = model.vocab.keys() # print(len(vecab)) # vector = model.get_vector('This') # print(type(vector)) # print(vector.shape) def load_model(f...
from kolibri.core.auth.models import FacilityDataset, FacilityUser, Classroom import re from django.db.models import Q from collections import defaultdict COLLECTION_KIND_FACILITY = 'facility' # Gets all learners for a subject and divides them into mentees and mentors def get_learners(subject, facility_id): learner...
import argparse import pandas as pd if __name__ == '__main__': parser = argparse.ArgumentParser() # debug parser.add_argument('feature_csv', help='feature csv file') parser.add_argument('tags_csv', help='tags csv. extract dataset=1 samples') parser.add_argument('out_csv', help='feature csv file') ...
import pickle import openpyxl from local_settings_eclipse import db def fetch_file(path): with open(path, 'rb') as fp: file = pickle.load(fp) return file RELATIVE_PATH = "/home/imlegend19/PycharmProjects/Research - Data Mining/eclipse/" wb = openpyxl.Workbook() sheet = wb.active titles = ["Assign...
# coding: utf-8 # # Copyright 2014 The Oppia 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 requi...
def main(dr): #**************** TESTING PARAMS (WOULD BE REMOVED)*******# TRUNCATE = True #**************** ---------------------------------*******# import gmi_misc #**************** PRINT HEADER ***************************# gmi_misc.print_header() print ("Script no. 3: Creation of desi...
#!/usr/bin/python # @lint-avoid-python-3-compatibility-imports # # vfscount Count VFS calls ("vfs_*"). # For Linux, uses BCC, eBPF. See .c file. # # Written as a basic example of counting functions. # # Copyright (c) 2015 Brendan Gregg. # Licensed under the Apache License, Version 2.0 (the "License") # # 14-...
# -*- coding: utf-8 -*- import torch from caption.tokenizers import TextEncoderBase def mask_fill( fill_value: float, tokens: torch.tensor, embeddings: torch.tensor, padding_index: int, ) -> torch.tensor: """ Function that masks embeddings representing padded elements. :param fill_value: t...
from httpx_socks import AsyncProxyTransport import nonebot from nonebot.log import logger global_config = nonebot.get_driver().config if proxies_socks := global_config.proxies_socks: logger.info('已配置socks代理') transport = AsyncProxyTransport.from_url(proxies_socks) proxies = None elif proxies_http := globa...
import config import logging from flask_restful import Api, Resource api = Api(prefix=config.API_PREFIX) class SampleAPI(Resource): def get(self): logging.info("Sample API called") return "Sample API of Avengers service" # sample route endpoint api.add_resource(SampleAPI, '/sample')
from Crypto.Util.number import getPrime from random import randint from math import gcd with open("flag.txt",'r') as f: flag = f.read() p = getPrime(1024) g = 3 MASK = 2**1024 - 1 def gen_keys(): x = randint(1, p-2) y = pow(g, x, p) return (x, y) def sign(answer: str, x: int): while True: m = int(asnwer, 16)...
# coding=utf-8 # Copyright 2018 The Google AI Language Team 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 ...
# -*- coding: utf-8 -*- import zipfile import tempfile import json import platform from ctypes import c_void_p, c_uint64, c_char_p, c_int from django.http import HttpResponse from django.utils.encoding import smart_str from django.views.generic import ListView from geoq.maps.models import AOI, Feature from models imp...
import numpy as np from sklearn.metrics import r2_score from uncoverml.cubist import Cubist, MultiCubist # Declare some test data taken from the boston houses dataset x = np.array([ [0.006, 18.00, 2.310, 0.5380, 6.5750, 65.20, 4.0900, 1, 296.0, 15.30], [0.027, 0.00, 7.070, 0.4690, 6.4210, 78.90, 4.967...
""" PDBe (Protein Data Bank in Europe) @website https://www.ebi.ac.uk/pdbe @provide-api yes (https://www.ebi.ac.uk/pdbe/api/doc/search.html), unlimited @using-api yes @results python dictionary (from json) @stable yes @parse url, title, content, img_src """ from...
# coding: utf-8 from __future__ import absolute_import import os from django.apps import apps from celery import Celery from .celerybeat_schedule import CELERYBEAT_SCHEDULE os.environ.setdefault("DJANGO_SETTINGS_MODULE", "TipEx.settings.local") app = Celery("TipEx_tasks") app.config_from_object("django.conf:set...
#!/usr/bin/env python # # Use the raw transactions API to spend bitcoins received on particular addresses, # and send any change back to that same address. # # Example usage: # spendfrom.py # Lists available funds # spendfrom.py --from=ADDRESS --to=ADDRESS --amount=11.00 # # Assumes it will talk to a bitcoind or Bit...
import pyjd # dummy in pyjs from pyjamas.ui.RootPanel import RootPanel from pyjamas.ui.HTML import HTML from pyjamas.ui.Label import Label from pyjamas.ui import HasAlignment from pyjamas.ui.Button import Button from pyjamas import Window from pyjamas.ui.VerticalSplitPanel import VerticalSplitPanel from pyjamas.ui.H...