text stringlengths 2 999k |
|---|
# -*- coding: utf-8 -*-
from __future__ import (absolute_import, division,
print_function, unicode_literals)
from django.conf.urls import include, url
from public_api.rest import TagViewSet, CategoryViewSet, UserViewSet, ArtistViewSet, CommentViewSet, PostViewSet
from rest_framework.routers ... |
# coding: utf-8
# -----------------------------------------------------------------------------------
# <copyright company="Aspose" file="render_page_request.py">
# Copyright (c) 2020 Aspose.Words for Cloud
# </copyright>
# <summary>
# Permission is hereby granted, free of charge, to any person obtaining a copy
# ... |
# -*- coding: utf-8 -*-
import telegram
import sys
import setpath
import settings
bot = None
# Groups
alexgeneral = -208181084
nitrictest = -217625579
papervideo = -239300120
nitriccalls = -249242528
dramafactory = -267176353
securebooking = -286958904
papervideo = -313764144
lemongroup = -244798008
def connect():
... |
# Cheer Creator
##############################
#### Problem Description #####
##############################
# You are cheering on your favorite team. After each play, if your team got over 10 yards further down the field, you stand up and give your friend a high five. If they don't move forward by at least a yard yo... |
# ##### BEGIN GPL LICENSE BLOCK #####
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distrib... |
from __future__ import annotations
import collections
import functools
import inspect
import logging
import time
from enum import Enum
from types import FunctionType, MethodType
from typing import Any, Callable, List, Optional, Type, TypeVar, Union, cast, overload
__all__ = ["LoggingDescriptor"]
def get_class_that_... |
from django.db import models
from django.db.models import Q, F
# Create your models here.
from treeckle.common.models import TimestampedModel
from organizations.models import Organization
from users.models import User
from venues.models import Venue
class BookingStatus(models.TextChoices):
PENDING = "PENDING"
... |
import pandas as pd
import os
import matplotlib.pyplot as plt
import numpy as np
from datetime import datetime
from sklearn.base import BaseEstimator, TransformerMixin
class ColumnTransformation(BaseEstimator, TransformerMixin):
'''A class to run various column transformation steps to prepare the
input until I... |
#encoding:utf-8
import torch.nn as nn
import torch.utils.model_zoo as model_zoo
import math
import torch.nn.functional as F
'''
只用了vgg16方法
'''
__all__ = [
'VGG', 'vgg11', 'vgg11_bn', 'vgg13', 'vgg13_bn', 'vgg16', 'vgg16_bn',
'vgg19_bn', 'vgg19',
]
model_urls = {
'vgg11': 'https://download.pytorch.org/mod... |
""" Optimizers class """
import torch
import torch.optim as optim
from torch.nn.utils import clip_grad_norm_
from onmt.utils import use_gpu
import operator
import functools
from copy import copy
from math import sqrt
def build_optim(model, opt, checkpoint):
""" Build optimizer """
saved_optimizer_state_dict =... |
import timeit
from copy import deepcopy
# import genetic_partition_test as gp
import networkx as nx
import numpy as np
import ujson
m1 = np.zeros(shape=(6,6))
m2 = np.array([[1,2,3,4],[5,6,7,8],[9,10,11,12],[13,14,15,16]])
for i in range(m2.shape[0]):
for j in range(m2.shape[1]):
m1[i][j] = m2[i][j]
print(m1) |
from bs4 import BeautifulSoup
import re
from ..occurrences.occurrences import Occurrences
from ..occurrences.occurrence_interface import OccurrenceInterface
class Recommendation08:
"""
Recomendação 08: Separar links adjacentes
"""
def __init__(self, sourcecode):
self.rec = 8
self.sou... |
'''module for views'''
from django.shortcuts import render, get_object_or_404, redirect
from django.urls import reverse
from django.http import Http404
from django.utils import timezone
from .models import Survey, Question, SurveyResponse
from .forms import FormRegistar
def surveys(request):
'''View to show list... |
from setuptools import setup, find_packages
setup(
name='django-debug-toolbar',
version='0.9.4',
description='A configurable set of panels that display various debug information about the current request/response.',
long_description=open('README.rst').read(),
# Get more strings from http://www.pyth... |
from pyhanlp import HanLP
# 分词
print(HanLP.segment("你好,欢迎使用 Python 中调用 HanLP 的 API 接口!"))
for term in HanLP.segment("下雨天地面积水"):
print(f'{term.word}\t{term.nature}') # 获取单词 与 词性
testCases = [
"商品和服务",
"结婚的和尚未结婚的确实在干扰分词啊",
"买水果然后来世博园最后去世博会",
"中国的首都是北京",
"欢迎新老师生前来就餐",
... |
#!/usr/bin/env mayapy
#
# Copyright 2020 Autodesk
#
# 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 a... |
from topojson import topojson
from geojson import geojson |
import fastapi as _fastapi
import fastapi.encoders as _encoders
import fastapi.responses as _responses
import services as _services
app = _fastapi.FastAPI()
@app.get("/programmer-memes")
def get_programmer_meme():
image_path = _services.select_random_image("ProgrammerHumor")
return _responses.FileResponse(... |
# coding=utf-8
r"""
This code was generated by
\ / _ _ _| _ _
| (_)\/(_)(_|\/| |(/_ v1.0.0
/ /
"""
from twilio.base import deserialize
from twilio.base import serialize
from twilio.base import values
from twilio.base.instance_context import InstanceContext
from twilio.base.instance_resource import... |
# ext/hybrid.py
# Copyright (C) 2005-2021 the SQLAlchemy authors and contributors
# <see AUTHORS file>
#
# This module is part of SQLAlchemy and is released under
# the MIT License: http://www.opensource.org/licenses/mit-license.php
r"""Define attributes on ORM-mapped classes that have "hybrid" behavior.
"hybrid" mea... |
#------------------------------------------------------------------------------
#
# 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... |
from __future__ import absolute_import
import os
from celery import Celery
from celery.schedules import crontab
from django.conf import settings
# set the default Django settings module for the 'celery' program.
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'dojo.settings')
app = Celery('dojo')
# Using a string he... |
from app import db
from flask_bcrypt import Bcrypt
from flask import current_app
import jwt
from datetime import datetime, timedelta
class User(db.Model):
"""This class defines the users table """
__tablename__ = 'users'
# Define the columns of the users table, starting with the primary key
id = db.... |
import mpmath as mp
from sympy.core.add import Add
from sympy.core.basic import Basic
from sympy.core.compatibility import (
Callable, NotIterable, as_int, is_sequence)
from sympy.core.decorators import deprecated
from sympy.core.expr import Expr
from sympy.core.kind import _NumberKind, NumberKind, UndefinedKind
f... |
__author__ = 'tk421'
|
#!/usr/bin/python
# -*- coding: utf-8 -*-
# (c) 2012, Michael DeHaan <michael.dehaan@gmail.com>, and others
# (c) 2016, Toshio Kuratomi <tkuratomi@ansible.com>
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as ... |
from django.db import migrations
def create_site(apps, schema_editor):
Site = apps.get_model("sites", "Site")
custom_domain = "test-template-dev-22776.botics.co"
site_params = {
"name": "Test Template",
}
if custom_domain:
site_params["domain"] = custom_domain
Site.objects.up... |
from django.template import loader, RequestContext
from django.http import HttpResponse, HttpResponseRedirect, HttpResponsePermanentRedirect, HttpResponseGone
from django.utils.log import getLogger
import warnings
warnings.warn(
'Function-based generic views have been deprecated; use class-based views instead.',
... |
# Copyright 2018,2019,2020,2021 Sony Corporation.
# Copyright 2021 Sony Group Corporation.
#
# 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
#... |
#created by @eve_enryu
import datetime
from telethon import events
from telethon.errors.rpcerrorlist import YouBlockedUserError
from telethon.tl.functions.account import UpdateNotifySettingsRequest
from userbot import bot, CMD_HELP
from userbot.events import register
@register(outgoing=True, pattern="^.firmware(?: |$... |
# Configuration file for the Sphinx documentation builder.
#
# This file only contains a selection of the most common options. For a full
# list see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html
# -- Path setup --------------------------------------------------------------
# If ex... |
#!/usr/bin/env python3
# Copyright (c) 2015-2016 The Youngseokcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test BIP 9 soft forks.
Connect to a single node.
regtest lock-in with 108/144 block signalling
a... |
# Copyright 2016 The Johns Hopkins University Applied Physics Laboratory
#
# 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... |
import math
from props import root, getNode
airdata_node = getNode('/sensors/airdata', True)
filter_node = getNode('/filters/filter[0]', True)
pilot_node = getNode('/sensors/pilot_input', True)
status_node = getNode('/status', True)
pos_node = getNode("/position", True)
vel_node = getNode("/velocity", True)
targets_n... |
from bot.database.DBStructure import User, Token, db_session, delete, select
class DBUtils:
def __init__(self):
pass
def is_admin(self, chat_id: int) -> bool:
with db_session:
return User.exists(chat_id=chat_id, is_admin=True)
def is_user(self, chat_id: int) -> bool:
... |
# coding=utf-8
# Copyright 2021 The TensorFlow Datasets 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 appl... |
from .lsr_petsc import LSRpetsc
from .lsr_numpy import LSRnumpy
|
"""
Basic tool parameters.
"""
import logging
import os
import os.path
import re
from xml.etree.ElementTree import XML
from six import string_types
import galaxy.model
import galaxy.tools.parser
from galaxy import util
from galaxy.util import (
sanitize_param,
string_as_bool,
unicodify
)
from galaxy.util.... |
# Copyright 2019 AUI, Inc. Washington DC, USA
#
# 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 ... |
# coding: utf-8
"""
Control-M Services
Provides access to BMC Control-M Services # noqa: E501
OpenAPI spec version: 9.20.30
Contact: customer_support@bmc.com
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
import pprint
import re # noqa: F401
import six
from ctm_saas_cl... |
"""An interpreter for the Scheme-Syntax Calculator Language
An interpreter for a calculator language that uses prefix-order call syntax.
Operator expressions must be operator symbols. Operand expressions are
separated by spaces.
Examples:
> (* 1 2 3)
6
> (+)
0
> (+ 2 (/ 4 8))
2.5
> (+ 2 2... |
# Copyright (c) 2010-2014 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 required by applicable law or agree... |
'''初始化'''
from .mine import Mine
from .text import TextBoard
from .gamemap import MinesweeperMap
from .emojibutton import EmojiButton |
# to allow importing to work correctly (in a dirty way)
import os
import sys
import inspect
filepath = os.path.abspath(inspect.getfile(inspect.currentframe()))
currentdir = os.path.dirname(filepath)
parentdir = os.path.dirname(currentdir)
sys.path.insert(0, parentdir)
import constants
import pandas as pd
from pathlib ... |
from subprocess import check_output
def get_minikube_ip():
return check_output(["minikube", "ip"]).decode("utf-8").strip()
|
from rest_framework.views import APIView
import json
from common.utils import token_required_class, create_json_response
from repository.service import RepositoryService
# Create your views here.
class Repository(APIView):
repositoryService = RepositoryService()
@token_required_class
def get(self, requ... |
import math
limit = int(input('n = '))
facs = {}
def fac(n):
if n not in facs:
facs[n] = math.factorial(n)
return facs[n]
def nOfR(n, r):
return fac(n) / (fac(r) * fac(n - r))
count = 0
for n in range(1, limit + 1):
for r in range(1, n + 1):
if nOfR(n, r) > 1000000:
count... |
import pandas as pd
import sanalytics.estimators.pu_estimators as pu
from gensim.models.doc2vec import Doc2Vec
import sanalytics.evaluation.evaluation_metric as see
from progressbar import progressbar
import sanalytics.algorithms.utils as sau
from time import time
import numpy as np
## Read threshold
arg = sys.argv[1]... |
# coding: utf-8
"""
timelight
This is the timelight api. # noqa: E501
OpenAPI spec version: 1.0
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
import pprint
import re # noqa: F401
import six
class SourcePatchGroupDto(object):
"""NOTE: This class is auto generated... |
# Import package
import requests
# Assign URL to variable: url
url = 'https://en.wikipedia.org/w/api.php?action=query&prop=extracts&format=json&exintro=&titles=pizza'
# Package the request, send the request and catch the response: r
r = requests.get(url)
# Decode the JSON data into a dictionary: json_data
json_data... |
from typing import TYPE_CHECKING
from kivy.app import App
from kivy.clock import Clock
from kivy.factory import Factory
from kivy.properties import ObjectProperty
from kivy.lang import Builder
from decimal import Decimal
from kivy.uix.popup import Popup
from electrum_onion.gui.kivy.i18n import _
from ...util import a... |
#!/usr/bin/python
# Copyright 2016 Attic Labs, Inc. All rights reserved.
# Licensed under the Apache License, version 2.0:
# http://www.apache.org/licenses/LICENSE-2.0
import argparse
import glob
import hashlib
import os
import os.path
import re
import shutil
def Main(projectName, stagingFunction):
"""Main shoul... |
def sanitize_text(text):
text = text.replace('@marcusgabrields', '')
text = text.strip()
if len(text) > 280 or text.isdigit() is False:
return None
return int(text)
def fizzbuzz(text):
num = sanitize_text(text)
if num is None:
return None
if num % 3 == 0 and n... |
"""
Base classes
.. codeauthor:: David Zwicker <david.zwicker@ds.mpg.de>
"""
import logging
from abc import ABCMeta, abstractmethod
from typing import Optional # @UnusedImport
from typing import TYPE_CHECKING, Any, Callable, Dict, Tuple, Union
import numpy as np
from ..fields import FieldCollection
from ..fiel... |
from abc import ABCMeta
import numpy as np
from six.moves import xrange
import warnings
class Attack(object):
"""
Abstract base class for all attack classes.
"""
__metaclass__ = ABCMeta
def __init__(self, model, back='tf', sess=None):
"""
:param model: A function that takes a sym... |
import functools
import json
import os
import sys
from timeit import default_timer
import prompt_toolkit
from prompt_toolkit.application import run_in_terminal
#from prompt_toolkit.eventloop.defaults import use_asyncio_event_loop
from prompt_toolkit.patch_stdout import patch_stdout
from prompt_toolkit.shortcuts import... |
from __future__ import absolute_import
import unittest
from unittest import skipIf
import warnings
import numpy as np
try:
import pandas as pd
is_pandas = True
except ImportError as e:
is_pandas = False
from bokeh.models.sources import DataSource, ColumnDataSource
from bokeh.util.serialization import tra... |
__version__ = 'v0.0.77'
|
'''OpenGL extension ARB.internalformat_query
This module customises the behaviour of the
OpenGL.raw.GL.ARB.internalformat_query to provide a more
Python-friendly API
Overview (from the spec)
OpenGL 4.1 has a number of queries to indicate the maximum number of
samples available for different formats. These give ... |
"""
Latin Hypercube Sampling
==================================
This example shows the use of the Latin Hypercube sampling class. In particular:
"""
# %% md
#
# - How to define the Latin Hypercube sampling method supported by UQpy
# - How to use different sampling criteria
# - How to plot the 2D samples
# %%
# %% ... |
"""Standardized service-level logger utils."""
import logging
from termcolor import colored
def configure_logger():
"""Configure the built-in root Python logger."""
logger = logging.getLogger()
handler = logging.StreamHandler()
formatter = logging.Formatter('%(asctime)s %(levelname)-8s %(message)s')... |
"""Test that lldb functions correctly after the inferior has crashed while in a recursive routine."""
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbplatformutil
from lldbsuite.test import lldbutil
class CrashingRecursiveInferiorTestCase(Tes... |
'''
Defines:
- the paramaters of data simulations,
- the list of methods to compare and their hyperparameters,
And launches all experiments.
'''
import pandas as pd
import argparse
from run_all import run
parser = argparse.ArgumentParser()
parser.add_argument('mdm', help='missing data mechanism',
... |
"""
Author: Justin Cappos
Start Date: May 16th, 2009
Description: Basic tests for the semaphore library...
"""
#begin include semaphore.repy
"""
Author: Justin Cappos
Start date: May 15th, 2009
Purpose: A simple library that provides a semaphore abstration on top of repy's locks...
"""
#begin include uniq... |
import FWCore.ParameterSet.Config as cms
process = cms.Process("HiggsDQM")
process.load("DQM.Physics.HiggsDQM_cfi")
process.load("DQMServices.Core.DQM_cfg")
process.load("DQMServices.Components.DQMEnvironment_cfi")
process.DQM.collectorHost = ''
process.dqmSaver.workflow = cms.untracked.string('/Physics/Higgs')
pro... |
"""
The MIT License (MIT)
Copyright (c) 2015-present Rapptz
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... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from alipay.aop.api.constant.ParamConstants import *
from alipay.aop.api.domain.ExtraInfo import ExtraInfo
class AlipayCommerceIndustryServiceSubmitModel(object):
def __init__(self):
self._extra_info = None
self._industry_info = None
... |
from validation import vworkspace
with vworkspace() as w:
w.all_functions.validate_phases("loop_fusion")
print "// With read_read dependence :"
w.props.keep_read_read_dependence = True
w.all_functions.validate_phases("loop_fusion")
|
#!/usr/bin/env python
import os
import sys
def main():
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "quotes_django.settings")
try:
from django.core.management import execute_from_command_line
except ImportError as exc:
raise ImportError(
"Couldn't import Django. Are you sure ... |
##################################
### ###
### Joshua G. Mausolf ###
### Computation Institute ###
### University of Chicago ###
### ###
##################################
from Quality_Check_speech_parser import *
from dateutil.parser import pars... |
#!/usr/bin/env python
# coding: utf-8
# Pypoll Election Analysis
import os
import csv
csvpath = os.path.join("Resources", "election_data.csv")
analysis = os.path.join("analysis", "Analysis.txt")
total_votes = 0
cand_dict = {}
unique_lst =[]
pct_lst = []
# Opening the CSV file
with open(csvpath) as csvfile:
fiel... |
"""APIs for working with Kubernetes deployments."""
from datetime import datetime, timezone
from kubernetes_asyncio import client
from kubernetes_asyncio.client.api_client import ApiClient
from kubernetes_asyncio.client.models import V1DeploymentList
async def restart_deployment(deployment: str, namespace: str) -> N... |
import cv2
def main():
video_file_1 = "D:/Videos/part2-HD_1.mp4"
video_file_2 = "D:/Videos/part2-HD_2.mp4"
# video_file_3 = "D:/Videos/part3/hockey/part3-2_d.mp4"
# video_file_4 = "D:/Videos/part3/hockey/part3-2_z.mp4"
output_file = "D:/Videos/part2-HD.mp4"
cap1 = cv2.VideoCapture(video_file_... |
# -*- coding: utf-8 -*-
# Author: Haoran Chen
# Date: 2019-10-07
import tensorflow as tf
import pickle
import numpy as np
import sys
from pprint import pprint
from collections import defaultdict
import time
sys.path.append('..')
from utils import *
np.random.seed(42)
data_dict = None
model = None
options = None
# ME... |
# 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
from ... import _utilities, _tables
from... |
from troposphere import Ref, Base64, Join, GetAtt, GetAZs, If, FindInMap
from troposphere.autoscaling import Tag as asgTag
from troposphere.autoscaling import AutoScalingGroup, LaunchConfiguration, ScalingPolicy
from troposphere.cloudwatch import Alarm
def build_user_data(r):
parts = ["""#!/bin/bash
#!/bin/bash
c... |
#! /usr/bin/python3
import tempfile
import pytest
from counterpartylib.lib import config
from counterpartylib.test import conftest # this is require near the top to do setup of the test suite
from counterpartylib.test import util_test
from counterpartylib.test.util_test import CURR_DIR
FIXTURE_SQL_FILE = CURR_DIR + '... |
import _plotly_utils.basevalidators
class UirevisionValidator(_plotly_utils.basevalidators.AnyValidator):
def __init__(self, plotly_name="uirevision", parent_name="pie", **kwargs):
super(UirevisionValidator, self).__init__(
plotly_name=plotly_name,
parent_name=parent_name,
... |
#### NOTICE: THIS FILE IS AUTOGENERATED
#### MODIFICATIONS MAY BE LOST IF DONE IMPROPERLY
#### PLEASE SEE THE ONLINE DOCUMENTATION FOR EXAMPLES
from swgpy.object import *
def create(kernel):
result = Creature()
result.template = "object/mobile/shared_dressed_mercenary_messanger_rod_m.iff"
result.attribute_templa... |
import requests
import pytest
import subprocess
# ============================================================================
class TestAuto(object):
PREFIX = 'http://localhost:8089'
USER = 'testauto'
LIST_ID = ''
AUTO_ID = ''
NUM_BROWSERS = 2
@classmethod
def setup_class(cls):
c... |
import unittest
from silasdk.users import User
from tests.test_config import *
class Test006PlaidLinkTokenTest(unittest.TestCase):
def test_plaid_link_token_200(self):
response = User.plaid_link_token(app, user_handle)
self.assertTrue(response["success"])
self.assertIsNotNone(response['lin... |
"""
Copyright (c) Contributors to the Open 3D Engine Project.
For complete copyright and license terms please see the LICENSE at the root of this distribution.
SPDX-License-Identifier: Apache-2.0 OR MIT
"""
import os
import sys
import azlmbr.bus as bus
import azlmbr.editor as editor
import azlmbr.editor.graph as gra... |
import os
import json
import pickle
import numpy as np
from itertools import chain
from collections import Counter
from torch.utils.data import Dataset
from lib.config import CONF
from data.scannet.model_util_scannet import ScannetDatasetConfig
# data setting
DC = ScannetDatasetConfig()
class ReferenceDataset(Datas... |
import bandwidthd
try:
import MySQLdb
except Exception as e:
MySQLdb=None
if MySQLdb:
MySQLconn = MySQLdb.connect (host = "localhost",
user = "test",
passwd = "test",
db = "test")
MySQLcurs = MySQLconn.cursor()
try:
MySQLcurs.exec... |
"""Script generating a CloudFormation template to create an S3 bucket destined to hold
performance test reports.
The template also contains IAM resources to control access to the bucket.
"""
from troposphere import Template, Parameter, Ref, Join
from troposphere import iam
from troposphere import s3
class InvalidRe... |
# -*- coding: utf-8 -*-
import scrapy
import pandas as pd
from lxml import html
from lxml.html.clean import Cleaner
from pytz import UTC, timezone, FixedOffset
import logging
from financedatahoarder.scraper.scrapers.items import OverviewKeyStats
OSUUDEN_ARVO = 'Osuuden arvo' # Fund
LOPETUSHINTA = 'Lopetushinta' # ET... |
"""
Created on Thu Oct 14 14:47:38 2021
@author: cxue2
"""
from ._metric import _Metric_00
from ._misc import _fn_tpl_compare
import torch
class Recall(_Metric_00):
def from_meta(self, hmp):
_, _, fn, tp = torch.ravel(hmp['cnf'])
return tp / (tp + fn)
@_fn_tpl_compare(1)
def comp... |
# -*- coding: utf-8 -*-
# Copyright (c) 2018, 9t9it and contributors
# For license information, please see license.txt
from __future__ import unicode_literals
import frappe
from frappe.model.document import Document
from collections import defaultdict
from erpnext.controllers.taxes_and_totals import get_itemised_tax_... |
import numpy as np
from sklearn.metrics import classification_report as sk_classification_report
from sklearn.metrics import confusion_matrix
from rdkit import Chem
from rdkit.Chem import AllChem
from rdkit.Chem import Draw
from .molecular_metrics import MolecularMetrics
def strip_salt(mols, stereo=False):
out... |
import os
import numpy as np
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
from matplotlib.axes import Axes
from matplotlib.figure import Figure
from mplfinance.original_flavor import candlestick2_ohlc
from util import convert_to_list, decode_img
from setting import DPI, IMG_H, IMG_W, CHART_DI... |
'''Implementation of Random Markov Field ground segmentation described in:
G. Postica, A. Romanoni, and M. Matteucci. Robust moving objects detection in LiDAR
data exploiting visual cues. In IEEE/RSJ International Conference on Intelligent Robots and
Systems (IROS), pages 1093-1098, 2016.
INPUT: point_cloud [num_poin... |
def broadcast(data, route, users, exclude=None, json_encoder=None):
for user in users:
if user != exclude:
user.send(data, route, json_encoder=json_encoder) |
import os
import torch
from transformers import TrainerControl, TrainerState
from transformers.file_utils import WEIGHTS_NAME
from transformers.modeling_utils import PreTrainedModel
from transformers.trainer_callback import TrainerCallback
from transformers.trainer_utils import PREFIX_CHECKPOINT_DIR
from transformers.... |
# USAGE
# python predict_batch.py --model output.h5 --labels logos/retinanet_classes.csv
# --input logos/images --output output
# import the necessary packages
from keras_retinanet.utils.image import preprocess_image
from keras_retinanet.utils.image import read_image_bgr
from keras_retinanet.utils.image import resize_... |
import os
import csv
csvpath = os.path.join("..", "Resources", ["election_data.csv"])
with open(csvpath, "rw")as csvfile:
csvreader = csv.reader(csvfile, delimiter = ",")
header = next(csvreader)
candidates = []
num_votes = []
percent_votes = []
total_votes = 0
for votes in n... |
#!/usr/local/bin/python
import boto3
import os
from subprocess import call, Popen, PIPE
def read(file):
"""Read a file and return contents as string"""
with open(file, 'r') as f:
return f.read()
def write(ssm, key, value):
"""Write string value to ssm secure parameter"""
ssm.put_parameter(N... |
#!/usr/bin/env python3
# Tested on
# Windows 10 (python 3.6)
# Ubuntu 16.4.1 (python 3.5)
import os, sys
# this is the magic for ASCII escape sequences of text
# attribute control to work on Windows platform
if sys.platform.lower() == "win32":
os.system('color')
# Group of Different functions for different ... |
"""SCons.Tool.fortran
Tool-specific initialization for a generic Posix f77/f90 Fortran compiler.
There normally shouldn't be any need to import this module directly.
It will usually be imported through the generic SCons.Tool.Tool()
selection method.
"""
#
# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 20... |
# -*- coding: utf-8 -*-
#
# Copyright 2017-2019 Spotify AB.
#
# 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... |
#!/usr/bin/env python3
import logging
from Bio import SeqIO
from Bio.Seq import Seq
from Bio.SeqRecord import SeqRecord
from collections import defaultdict
from bleties.SharedFunctions import Gff, get_not_gaps
logger = logging.getLogger("Insert")
class Insert(object):
"""Insert IESs from GFF file and associat... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.