text
stringlengths
2
999k
import torch from torchvision import transforms import cv2 import numpy as np import types from numpy import random def intersect(box_a, box_b): max_xy = np.minimum(box_a[:, 2:], box_b[2:]) min_xy = np.maximum(box_a[:, :2], box_b[:2]) inter = np.clip((max_xy - min_xy), a_min=0, a_max=np.inf) return in...
""" Functions for working with STIX 2 Data Markings. These high level functions will operate on both object-level markings and granular markings unless otherwise noted in each of the functions. Note: These functions are also available as methods on SDOs, SROs, and Marking Definitions. The corresponding method...
# -*- coding: utf-8 -*- # This code is part of Qiskit. # # (C) Copyright IBM 2017, 2019. # # This code is licensed under the Apache License, Version 2.0. You may # obtain a copy of this license in the LICENSE.txt file in the root directory # of this source tree or at http://www.apache.org/licenses/LICENSE-2.0. # # Any...
# -*- coding: utf-8 -*- # Morra project: Features for MorphParser # # Copyright (C) 2020-present by Sergei Ternovykh # License: BSD, see LICENSE for details """ If you need MorphParser to support your language, add feature-functions for your language here. Then, create parser as: ``MorphParser(features='<your lang...
# -*- coding: utf-8 -*- # Copyright (c) 2018 Dave Kruger. # 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, this # list...
# 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/python3 -i # # Copyright (c) 2015-2019 The Khronos Group Inc. # Copyright (c) 2015-2019 Valve Corporation # Copyright (c) 2015-2019 LunarG, Inc. # Copyright (c) 2015-2019 Google Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the ...
# coding: utf-8 """ TGS API A production scale tool for BYOND server management # noqa: E501 OpenAPI spec version: 9.0.0 Generated by: https://github.com/swagger-api/swagger-codegen.git """ import pprint import re # noqa: F401 import six from swagger_client.models.error_code import ErrorCode...
import h5py import numpy as np import os import matplotlib.pyplot as plt import time from preprocessor import pca from preprocessor import split_train_test from preprocessor import ConfusionMatrixHelper # Neural Network Classifier using Stochastic Gradient Descent, ReLU is used as activation function, Cross Entropy e...
# -*- coding: utf-8 -*- # Generated by the protocol buffer compiler. DO NOT EDIT! # source: stream_metric_states.proto import sys _b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1')) from google.protobuf import descriptor as _descriptor from google.protobuf import message as _message from google...
"""Koninklijke Philips N.V., 2019 - 2020. All rights reserved. file used for installing the package""" import os import sys import subprocess def find_installer(): """ Function finds the installer full name based on the substring""" proj_dist = os.path.join(os.path.dirname(os.path.abspath(os.path.join(__file_...
import _plotly_utils.basevalidators class ColorValidator(_plotly_utils.basevalidators.ColorValidator): def __init__( self, plotly_name="color", parent_name="scattersmith.marker.colorbar.tickfont", **kwargs ): super(ColorValidator, self).__init__( plotly_name...
#----------------------------------------------------------------------------- # Copyright (c) 2012 - 2020, Anaconda, Inc., and Bokeh Contributors. # All rights reserved. # # The full license is in the file LICENSE.txt, distributed with this software. #-------------------------------------------------------------------...
#!/usr/bin/env python3 # Copyright (c) 2014-2017 The Bitcoin Core developers # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. """Run regression test suite. This module calls down into individual test cases via subprocess. It will f...
#!/usr/bin/python ''' Extract _("...") strings for translation and convert to Qt stringdefs so that they can be picked up by Qt linguist. ''' from __future__ import division,print_function,unicode_literals from subprocess import Popen, PIPE import glob import operator import os import sys OUT_CPP="qt/theucoinstrings.c...
# Copyright 2013-2022 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) from spack import * class PyPytestMetadata(PythonPackage): """pytest plugin for test session metadata""" homepa...
""" JPEG quality settings equivalent to the Photoshop settings. Can be used when saving JPEG files. The following presets are available by default: ``web_low``, ``web_medium``, ``web_high``, ``web_very_high``, ``web_maximum``, ``low``, ``medium``, ``high``, ``maximum``. More presets can be added to the :py:data:`prese...
from data.data_loader import Dataset_ETT_hour, Dataset_ETT_minute, Dataset_Custom, Dataset_Pred from data.edf_loader import EdfDataset from data.sample_loader import SampleDataset from exp.exp_basic import Exp_Basic from models.model import Informer, InformerStack from utils.tools import EarlyStopping, adjust_learning...
# # 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...
#!/usr/bin/env python # Copyright 2014 Google Inc. 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, this list of c...
# -*- coding: utf-8 -*- # # Lasso.jl documentation build configuration file, created by # sphinx-quickstart on Mon Feb 16 12:11:05 2015. # # This file is execfile()d with the current directory set to its # containing dir. # # Note that not all possible configuration values are present in this # autogenerated file. # # ...
from ckeditor.fields import RichTextField from django.contrib.auth.models import AbstractBaseUser, BaseUserManager from django.core.validators import MaxValueValidator, MinValueValidator from django.db import models class MyUserManager(BaseUserManager): def create_user(self, email, name, password=None): "...
from ems_admin.models import EMSPermission def create_default_permissions(user): EMSPermission.objects.create( user=user, name="Employees", ) EMSPermission.objects.create( user=user, name="Organisation", ) EMSPermission.objects.create( user=user, ...
A_2301_10 = {0: {'A': -0.6704902559066079, 'C': 0.18784164174069487, 'E': -0.1593131866169312, 'D': 0.04453611512559486, 'G': -0.0222749775419972, 'F': -0.4454205137149625, 'I': -0.6415722419159657, 'H': -0.9734148928798959, 'K': -0.788314122240594, 'M': 0.48739792678308397, 'L': 0.349073642968043, 'N': -0.291529171618...
from django.urls import path from . import views app_name = 'about' urlpatterns = [ path('author/', views.AboutAuthorView.as_view(), name='author'), path('work_schedule/', views.AboutTechView.as_view(), name='work_schedule'), ]
import ast import getpass import glob import logging import os import sys import csv import time import datetime if sys.version_info > (3, 0): from urllib.parse import unquote else: from urllib import unquote import ee import requests import retrying from requests_toolbelt.multipart import encoder from bs4 im...
import requests import json from urllib.parse import urljoin class Model: def __init__(self, URL): self.base_url = URL def addJob(self, docs): files = { 'file': ('docs.json', json.dumps(docs), 'application/json') } return requests.post( urljoin(self.base_...
from datetime import timedelta, datetime from django.core.management import call_command from django.test import TestCase from wagtail.tests.utils import WagtailTestUtils from wagtail.core.models import Page from wagtail_trash.models import TrashCan class TestManagementCommands(TestCase, WagtailTestUtils): def te...
import os def gene_symbols_significant_upregulated(global_variables, out_path, biotype, de_ID): out_file = open(os.path.join(out_path,"data","gene_symbols","gene_symbols_significant_upregulated.txt"),"w") master_gene_table = global_variables["master_gene_table"] # gets the genes for gene_ID in maste...
# Lint as: python2, python3 # Copyright 2019 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 # ...
# Copyright 2018 The Google AI Language Team Authors and # The HuggingFace Inc. team. # Copyright (c) 2020, MeetKai Inc. All rights reserved. # Copyright (c) 2020, NVIDIA CORPORATION. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in complia...
# # Secret Labs' Regular Expression Engine # # Copyright (c) 1998-2001 by Secret Labs AB. All rights reserved. # # This version of the SRE library can be redistributed under CNRI's # Python 1.6 license. For any other use, please contact Secret Labs # AB (info@pythonware.com). # # Portions of this engine have been dev...
# pylint: disable=g-bad-file-header # Copyright 2016 The Bazel 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 ...
""" Copyright (c) 2018-2019 Qualcomm Technologies, Inc. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted (subject to the limitations in the disclaimer below) provided that the following conditions are met: * Redistributions of source code must retain...
# Copyright 2017 The TensorFlow Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applica...
# 给定一个字符串,你需要反转字符串中每个单词的字符顺序,同时仍保留空格和单词的初始顺序。 # 示例 1: # 输入: "Let's take LeetCode contest" # 输出: "s'teL ekat edoCteeL tsetnoc" class Solution: def reverseWords(self, s: str) -> str: s1 = ' '.join(s.split(' ')[::-1]) print(s1) return s1[::-1] s1 = Solution().reverseWords("Let's take Leet...
# coding: utf-8 # Copyright (c) Pymatgen Development Team. # Distributed under the terms of the MIT License. """ Test for the piezo tensor class """ __author__ = "Handong Ling" __version__ = "0.1" __maintainer__ = "Handong Ling" __email__ = "handongling@berkeley.edu" __status__ = "Development" __date__ = "4/23/19" ...
import numpy as np import cv2 class ImageStrip: def __init__(self): pass @staticmethod def _get_output_dimensions(num_images, width, height, pad): total_width = num_images * (width + pad) + pad total_height = height + pad * 2 return total_width, total_height def produ...
import unittest from utils import * class TestStrUtils(unittest.TestCase): def setUp(self): pass def tearDown(self): pass def test_quoteme_by_type(self): to_quote_in = (True, False, 0.001, 'bazu"ka',"shuki", 123, [123, "mama"], {"artizan": "vodka", "price": 19.19} ) quoted...
from pa.config import Config from pa.db.fd import FdDB class FDs: def __init__(self, config=Config): self.fds = FdDB(config) def add(self, fd, for_user): fd['start_date'] = self.date_to_str(fd['start_date']) fd['end_date'] = self.date_to_str(fd['end_date']) fd['username'] = fo...
# Webhooks for external integrations. from typing import Any, Callable, Dict, Iterable, Optional, Tuple, Text from django.utils.translation import ugettext as _ from django.http import HttpRequest, HttpResponse from zerver.lib.actions import check_send_stream_message from zerver.lib.response import json_success, json...
#!/usr/bin/env python3 # Copyright (c) 2015-2016 The Bitcoin Core developers # Copyright (c) 2017 The Sucrecoin Core developers # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. """Test p2p mempool message. Test that nodes are disco...
# pylint:disable=missing-module-docstring,missing-class-docstring,missing-function-docstring from .base import compare_template, SimpleTestCase class ModalTest(SimpleTestCase): maxDiff = None def test_rendered(self): template = """ {% load carbondesign %} {% Modal id="uid" %} {% endModal %} """ ...
__source__ = 'https://leetcode.com/problems/largest-component-size-by-common-factor/' # Time: O(N sqrt{W}) where N is the length of A, and W=max(A[i]). # Space: O(N) # # Description: Leetcode # 952. Largest Component Size by Common Factor # # Given a non-empty array of unique positive integers A, consider the followin...
from .valueguard import *
# Copyright 2019 The Dreamer 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 applicabl...
import pytest # Use wildcard import to make sure FigureWidget is always included from plotly.graph_objects import * from plotly.missing_ipywidgets import FigureWidget as FigureWidgetMissingIPywidgets try: import ipywidgets as _ipywidgets from distutils.version import LooseVersion as _LooseVersion if _Loo...
""" This module is used to fit a set of x,y data to a model passed to it. It is used to calculate the slope and intercepts for the linearized fits. Two things should be noted: First, this fitting module uses the NLLSQ module of SciPy rather than a linear fit. This along with a few other modules could probably be rem...
import io import os import re from setuptools import setup, find_packages from pkg_resources import DistributionNotFound, get_distribution INSTALL_REQUIRES = ["numpy>=1.11.1", "scipy", "scikit-image>=0.16.1", "PyYAML"] # If none of packages in first installed, install second package CHOOSE_INSTALL_REQUIRES = [ (...
from django.conf.urls import url from django.views.generic import RedirectView from . import views urlpatterns = [ # In-context demo url(r"^in-context/$", views.in_context, name="pontoon.in_context",), # Legacy: Redirect to /in-context url( r"^intro/$", RedirectView.as_view(pattern_nam...
# ------------------------------------------------------------------------------- # Copyright IBM Corp. 2016 # # 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/licens...
# -*- coding: utf-8 -*- # Copyright 2022 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...
# coding: utf-8 # Copyright (c) 2016, 2022, Oracle and/or its affiliates. All rights reserved. # This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may c...
# MIT LICENSE # # Copyright 1997 - 2020 by IXIA Keysight # # 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,...
""" Core bot commands essential for built in features """ from discord.ext import commands import discord class Core(commands.Cog): def __init__(self, bot): self.bot = bot @commands.command() async def ping(self, ctx): """Test bot ping""" await ctx.send(f"Pong! I am {str(self.bot....
#!/usr/bin/python # Copyright 2010 Google Inc. # Licensed under the Apache License, Version 2.0 # http://www.apache.org/licenses/LICENSE-2.0 # Google's Python Class # http://code.google.com/edu/languages/google-python-class/ import os import re import sys import urllib import urllib.request import shutil import webbr...
""" User's set of endpoints. """ from datetime import datetime from decimal import Decimal from flask import jsonify, request, Response from flask_restful import Resource from sqlalchemy.exc import IntegrityError, SQLAlchemyError from sqlalchemy.orm.exc import NoResultFound from wallet_api import db, db_isolation_lev...
''' 2021 Benjamin Kellenberger ''' from ai.models.detectron2.genericDetectronModel import GenericDetectron2Model from ai.models.detectron2.labels.torchvisionClassifier import GeneralizedTorchvisionClassifier, DEFAULT_OPTIONS class MnasNet(GeneralizedTorchvisionClassifier): def __init__(self, project, config...
#################################################################################### ### ### Program to find eigenenergies of the infinite square well. ### #################################################################################### # Importing useful stuff from numpy import * from matplotlib.pyplot import *...
# -*- coding: utf-8 -*- # Scrapy settings for c_amz project # # For simplicity, this file contains only settings considered important or # commonly used. You can find more settings consulting the documentation: # # http://doc.scrapy.org/en/latest/topics/settings.html # http://scrapy.readthedocs.org/en/latest/t...
# -*- coding: utf-8 -*- # Generated by the protocol buffer compiler. DO NOT EDIT! # source: frameworks/base/tools/aapt2/Resources.proto import sys _b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1')) from google.protobuf import descriptor as _descriptor from google.protobuf import message as _me...
from stt_engine import get_audio from tts_engine import speak import utils import smtp_hanlder import os import mailing_content_verifier #the login creds username=utils.LOGIN_CREDS[0] pwd=utils.LOGIN_CREDS[1] #starting the infinite loop to get the input while True: speak("listening") print...
from django.db import models from django.contrib.auth.models import AbstractUser # Create your models here. class Service(models.Model): name = models.CharField(max_length=100) def __str__(self): return self.name class User(AbstractUser): bio = models.TextField(max_length=500, blank=True) em...
# 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 ...
#!/usr/bin/env python # -*- coding: utf-8 -*- # Copyright 1999-2020 Alibaba Group Holding 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-...
# Generated by Django 2.2 on 2022-02-22 07:27 from django.db import migrations, models class Migration(migrations.Migration): initial = True dependencies = [ ('auth', '0011_update_proxy_permissions'), ] operations = [ migrations.CreateModel( name='UserProfile', ...
""" SoftLayer.tests.CLI.modules.call_api_tests ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ :license: MIT, see LICENSE for more details. """ import json from SoftLayer.CLI import call_api from SoftLayer import testing class BuildFilterTests(testing.TestCase): def test_empty(self): assert call...
# -*- coding: utf-8 -*- from __future__ import absolute_import, print_function, unicode_literals import logging import typing import importanize from ..plugins import ImportanizePlugin, hookimpl log = logging.getLogger(__name__) if typing.TYPE_CHECKING: from ..groups import BaseImportGroup from ..statemen...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Wed Aug 5 12:03:57 2020 @author: akimosi """ from moneycontrolPy import mcp import time import json start_time = time.time() root_dir = "/home/akimosi/Documents/moneycontrolPy/" bundle_size = 10 api = mcp.API() api.DRIVER_PATH = root_dir + "chromedriv...
import sqlite3 conn = sqlite3.connect('BD_Dany_trab2AV1.db') cursor = conn.cursor() cursor.execute(""" CREATE TABLE PECAS( id_peca INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, nome_peca TEXT NOT NULL, peso_peca FLOAT NOT NULL, cor_peca TEXT NOT NULL ); """) cursor.execute(""" CREATE TABLE DEPOSITO( ...
from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ ('document_indexing', '0023_auto_20210821_2059'), ] operations = [ migrations.AlterUniqueTogether( name='indexinstancenode', unique_tog...
from datetime import datetime, timedelta from sanic.response import json import jwt import pytest from freezegun import freeze_time from sanic_jwt.decorators import protected @pytest.fixture def access_token(app): sanic_app, sanic_jwt = app _, response = sanic_app.test_client.post( "/auth", json={"u...
import json from flask import Flask, render_template import sleipnir app = Flask(__name__) app.register_blueprint(sleipnir.v1) with open('config.json') as f: settings = json.loads(f.read()) @app.route('/') def index(): return render_template('index.html', settings=settings) if __name__ == '__main__': ...
import keras import scipy.io.wavfile as sio import os import unittest from fwks.model import AcousticModel from fwks.stage import RandomSelectionAdapter import fwks.dataset as dataset import fwks.stage as stage from tests.meta import get_test_dataset class TrainingTestSuite(unittest.TestCase): @classmethod ...
# -*- coding: utf-8 -*- """hategru.ipynb Automatically generated by Colaboratory. Original file is located at https://colab.research.google.com/drive/1fg_cClsHnbiRLknbfd1tVF2hTqP0UL4m """ from google.colab import drive drive.mount('/content/drive') import os import pickle import numpy as np import pandas as pd ...
""" Model contributed by: MITRE Corporation Adapted from: https://github.com/craston/MARS """ import logging from typing import Union, Optional, Tuple from art.estimators.classification import PyTorchClassifier import numpy as np from PIL import Image import torch from torch import optim from MARS.opts import parse_o...
# -*- coding: utf-8 -*- """ wsgi ~~~~ A simple WSGI module """ from werkzeug.serving import run_simple from werkzeug.wsgi import DispatcherMiddleware from docon import factory import os.path import logging.config if os.path.exists('logging.conf'): logging.config.fileConfig('logging.conf') logging.ge...
"""Support to interface with the Plex API.""" import json import logging import plexapi.exceptions import requests.exceptions from homeassistant.components.media_player import DOMAIN as MP_DOMAIN, MediaPlayerDevice from homeassistant.components.media_player.const import ( MEDIA_TYPE_EPISODE, MEDIA_TYPE_MOVIE,...
############################################################################## # This file is a part of PFFDTD. # # PFFTD is released under the MIT License. # For details see the LICENSE file. # # Copyright 2021 Brian Hamilton. # # File name: test_air_abs_filters.py # # Description: This is a testbench for different ai...
# Copyright (c) 2020 Dell Inc. or its subsidiaries. # 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...
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('core', '0009_location_user'), ] operations = [ migrations.RemoveField( model_name='location', name='...
import hashlib import pytest from datetime import datetime, timedelta from mock import patch from app import storage, docker_v2_signing_key from contextlib import contextmanager from playhouse.test_utils import assert_query_count from freezegun import freeze_time from data import model, database from data.databas...
import cv2 import os.path import numpy as np from sklearn.externals import joblib ### Module imports ### import sys sys.path.append('../../') class Triangulate: """ Class implementation for triangulating two 2D points """ def rayIntersection(self, ray1Dir, ray1Point, ray2Dir, ray2Point): ...
import torch from torch import nn from torch import autograd from torch.nn.utils.rnn import pack_padded_sequence, pad_packed_sequence class SeqToLangModel(nn.Module): def __init__(self, num_of_ngrams, output_size, hidden_size, embedding_dim): super().__init__() self.chars_embedding = nn.Embedding...
from tkinter import Toplevel, ttk, Tk from tkinter import filedialog, StringVar, messagebox, IntVar def askokcancel(window, title='Do You need to exit?', message=None): if messagebox.askokcancel(title, message): window.destroy() else: window.deiconify() def showwarning(window, title='Warning...
import numpy as np import fitsio from astropy.table import Table,join from LSS.tabulated_cosmo import TabulatedDESI cosmo = TabulatedDESI() dis_dc = cosmo.comoving_radial_distance #functions that shouldn't have any dependence on survey go here def find_znotposs(dz): dz.sort('TARGETID') tidnoz = [] tid...
from django.http import HttpResponseRedirect from django.template import RequestContext from django.newforms import form_for_model, form_for_instance from django.shortcuts import render_to_response, get_object_or_404 from serpantin.apps.test.models import Article def article_form(request, object_id=''): print "ar...
import argparse import datetime import os import pickle # hacky way to make sure utils is visible import sys import pandas as pd sys.path.append(os.path.abspath(os.path.abspath(os.path.dirname(__file__)) + '/../../..')) from src.utils import config from src.utils import read_redirects def main(): parser = argp...
# © https://sudipghimire.com.np # %% [markdown] """ ## While Loop - It is used for iterating until the condition fails to satisfy Basic Syntax: while <condition>: # statements <update> """ x = 0 while x < 10: print(f'current value of x is {x}') x += 1 # x++ # incorrect in case of python # %% an...
# This file is part of Indico. # Copyright (C) 2002 - 2020 CERN # # Indico is free software; you can redistribute it and/or # modify it under the terms of the MIT License; see the # LICENSE file for more details. from __future__ import unicode_literals from collections import OrderedDict from datetime import date, ti...
import telebot import os import requests from flask import Flask, request from org.companyname.cryptocoinsinfobot.requestAPI import requestAPI # set up config variables en your heroku environment # your bot TOKEN token = os.environ.get('TOKEN') # your heroku app URL and add path "bot" for active update appURL = os.env...
try: from UserDict import IterableUserDict except ImportError: from collections import UserDict as IterableUserDict from .service import BaseService from .slogging import get_logger from devp2p import utils from devp2p import crypto from rlp.utils import decode_hex from devp2p import __version__ log = get_logge...
import pytest from django.contrib.sessions.middleware import SessionMiddleware from legal_advice_builder.models import Answer from legal_advice_builder.models import Condition from legal_advice_builder.models import LawCase from legal_advice_builder.models import Question from legal_advice_builder.views import FormWiz...
print("Enter two numbers:-") x=int(input("FIRST NUMBER:")) y=int(input("SECOND NUMBER:")) print("1-ADDITION") print("2-SUBTRACTION") print("3-MULTIPLICATION") print("4-DIVISION") print("5-MODULUS") print("ENTER YOUR CHOICE NUMBER FROM THE ABOVE LIST:-") ch=input("CHOICE NUMBER:") if (ch=="1"): print("A...
# 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...
#!/usr/bin/python # Copyright 2002 Vladimir Prus # Distributed under the Boost Software License, Version 1.0. # (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) import BoostBuild t = BoostBuild.Tester(pass_toolset=0) t.write("test.jam", """ actions unbuilt { } unbuilt all ; ECHO "Hi" ...
import tqdm import pytest import numpy as np from torch.utils.tensorboard import SummaryWriter from tianshou.policy import BasePolicy from tianshou.env import DummyVectorEnv, SubprocVectorEnv from tianshou.data import Batch, Collector, AsyncCollector from tianshou.data import ( ReplayBuffer, PrioritizedReplayB...
JSON_VERSION = 10 # This version added adjacent connectors in departures column ODGI_VERSION = 10 import logging LOGGER = logging.getLogger(__name__) LOGGING_FORMAT_STR = \ '[%(asctime)s - %(levelname)s - %(name)s - %(lineno)d] %(message)s' """str: format string for log messages""" LOGGING_DATE_FORMAT = '%d/%m...
"""Support for Genius Hub switch/outlet devices.""" from homeassistant.components.switch import SwitchDevice, DEVICE_CLASS_OUTLET from homeassistant.helpers.typing import ConfigType, HomeAssistantType from . import DOMAIN, GeniusZone ATTR_DURATION = "duration" GH_ON_OFF_ZONE = "on / off" async def async_setup_plat...
from aiogram import types from telegram_bot.database import crud from telegram_bot.database.database import get_db_session from telegram_bot.intergration import he_weather from telegram_bot.service.telegram import TelegramMessageService from telegram_bot.telegram.dispatcher import dp from telegram_bot.telegram.keyboar...