text
stringlengths
2
999k
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # Setup -- Singly LinkedList # Deleting a Node from a Singly LinkedList # plus Interview Question 2.1 - Remove Duplicates from Linked List # Python Example class Node(object): def __init__(self, data=None, next=None): self.data = data self.next = next def __repr_...
from flask import json, url_for from tests import create_authorization_header from tests.app.db import create_inbound_sms def test_get_inbound_sms_returns_200(client, sample_service): all_inbound_sms = [ create_inbound_sms(service=sample_service, user_number="447700900111", content="Hi"), create_...
from gettext import find import torch from ezflow.utils import ( AverageMeter, coords_grid, endpointerror, find_free_port, forward_interpolate, is_port_available, upflow, ) def test_endpointerror(): pred = torch.rand(4, 2, 256, 256) target = torch.rand(4, 2, 256, 256) _ = en...
#!/usr/bin/python3 -i # # 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 License. # You may obtain a copy of the License a...
""" Get video frames and metadata =================================== Video frames and meta data can be loaded using the ibllib.io.video module, which contains functions for loading individual or groups of frames efficiently. The video may be streamed remotely or loaded from a local file. In these examples a remote U...
from dataclasses import dataclass from uncertainties import UFloat from ddmtools.utils.uncertainty import FUF, as_ufloat @dataclass(init=False) class IntensiveParameters: framerate: UFloat micrometre_per_pixel: UFloat temperature: UFloat viscosity: UFloat def __init__(self, framerate: FUF, micr...
# -*- 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...
#!/usr/bin/env python scores = { "pullups": [(4,20), (5,23), (5,23), (5,23), (5,21), (5,20), (5,19), (4,19)], "crunches": [ (70,105), (70,110), (70,115), (70,115), (70,110), (65,105), (50,100), (40,100), ], "run": [ (18 * 60,27 * 6...
import numpy as np import torch import torch.nn.functional as F from torch import nn class Scalar(nn.Module): def __init__(self): super().__init__() self.register_buffer('total', torch.FloatTensor([0.0])) self.register_buffer('count', torch.FloatTensor([0.0])) def forward(self, scalar...
# Copyright 2016 Joel Dunham # # 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 writi...
from __future__ import absolute_import, division, print_function import numpy as np # returns a list of augmented audio data, stereo or mono def augment_audio(y, sr, n_augment=0, allow_speedandpitch=True, allow_pitch=True, all...
# Generated by Django 3.0.8 on 2020-07-11 13:33 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('leads', '0001_initial'), ] operations = [ migrations.AlterField( model_name='lead', name='attachment', f...
from __future__ import absolute_import, division, print_function from getpass import getpass def get_input(prompt=''): try: line = raw_input(prompt) except NameError: line = input(prompt) return line def get_credentials(): """Prompt for and return a username and passwo...
from django.apps import AppConfig class MlApiConfig(AppConfig): name = 'ml_api'
import traceback import discord, datetime, json, random from discord.ext import commands import aiohttp, io from random import randint from yarl import URL import fast_colorthief start_time = datetime.datetime.utcnow() class General(commands.Cog): def __init__(self, bot): self.bot = bot @commands.co...
#!/usr/bin/env python # -*- coding: utf-8 -*- import io import os from pathlib import Path from setuptools import find_packages, setup # Package meta-data. NAME = 'tid-regression-model' DESCRIPTION = 'Regression model for using in the Train In Data online course "Deployment of Machine Learning Models".' URL = 'http...
#!/usr/bin/python2 -utt # -*- coding: utf-8 -*- from __future__ import print_function import torch import torch.nn as nn import numpy as np import sys import os import time from PIL import Image from torch.autograd import Variable import torch.backends.cudnn as cudnn import torch.optim as optim from tqdm import tqdm i...
def calculate(x, y): print(x + y) def calculate_sub(x, y): print(x - y)
import getpass import inspect import re import tkinter as tk from tkinter.font import Font import json from tkinter import filedialog from datetime import datetime from pathlib import Path from typing import Tuple, Dict, IO from rcsnn.tkUtils.ConsoleDprint import ConsoleDprint from rcsnn.tkUtils.DataField import DataF...
# # E-mail configuration for sending a message when a user # successfully uploads a file to the hscq server. # # Russell Kackley (rkackley@naoj.org) # import socket from email.mime.text import MIMEText send_email_flag = True # Our SMTP server is defined here smtp_server = 'smtp.subaru.nao.ac.jp' sender_name = 'hsc...
""" Prime Developer Trial No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) # noqa: E501 The version of the OpenAPI document: v1 Generated by: https://openapi-generator.tech """ import re # noqa: F401 import sys # noqa: F401 from fds.sdk.Q...
#!/usr/bin/env python2 # -*- coding: utf-8 -*- import logging from doubanfm.views import help_view from doubanfm.controller.lrc_controller import LrcController logger = logging.getLogger('doubanfm') # get logger class HelpController(LrcController): """ 按键控制 """ def __init__(self, player, data, que...
__author__ = "Johannes Köster" __copyright__ = "Copyright 2021, Johannes Köster" __email__ = "johannes.koester@uni-due.de" __license__ = "MIT" import logging import os import sys import time import shutil import tarfile import tempfile from collections import namedtuple import uuid import re import math from snakemak...
import pytest from .factories import PhoneNumberFactory, ReceivedMessageFactory from .utils import FakeTwilioClient from apps.twilio_integration.models import PhoneNumber, ReceivedMessage from apps.users.tests.factories import UserFactory MODULE_TO_TEST = "apps.twilio_integration.models" @pytest.fixture def Patched...
import matplotlib.pyplot as plt def plot(X, Y, ajust=False, line=None, line_label=None, line_color=None ): """ type= dot/linear """ plt.scatter(X,Y,label='Y(X)') plt.xlabel('X') plt.ylabel('Y') plt.legend() if ajust: plt.plot(X,line,label=line_label,color=line_color) plt.show(block=True) re...
from direct.directnotify import DirectNotifyGlobal from toontown.coghq import CogHQExterior from toontown.dna.DNAParser import loadDNAFileAI, DNAStorage from toontown.hood import ZoneUtil class SellbotHQExterior(CogHQExterior.CogHQExterior): notify = DirectNotifyGlobal.directNotify.newCategory('SellbotHQExterior'...
import functools import inspect import os import re import shutil import sys import tempfile import uuid import warnings from _thread import RLock from collections.abc import Iterator from contextlib import contextmanager, nullcontext, suppress from datetime import datetime, timedelta from errno import ENOENT from func...
import os import enum import logging from datetime import datetime from logging.handlers import RotatingFileHandler from os.path import dirname is_really_something = lambda s,t:s and t(s) something_greater_than_zero = lambda s:(s > 0) default_timestamp = lambda t:t.isoformat().replace(':', '').replace('-','').split...
############################################################################## # Copyright (c) 2013-2017, Lawrence Livermore National Security, LLC. # Produced at the Lawrence Livermore National Laboratory. # # This file is part of Spack. # Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved. # LLNL-CODE-64...
from django.core.management.base import BaseCommand, CommandError from drinks.models import Ingredient class Command(BaseCommand): help = 'Create substitutions and add categories' def handle(self, *args, **options): qs = Ingredient.objects.exclude(generic=True) for ingredient in qs.iterator()...
# -*- coding: utf-8 -*- ''' Service Worker ------- This service worker plugin generates a service worker which will cache all the static and lightweight files of the output site (images not included). The Service Worker version is generated automatically as a hash of its files instead. It uses cache busting techniques...
""" byceps.events.ticketing ~~~~~~~~~~~~~~~~~~~~~~~ :Copyright: 2014-2022 Jochen Kupperschmidt :License: Revised BSD (see `LICENSE` file for details) """ from dataclasses import dataclass from typing import Optional from ..services.seating.transfer.models import SeatID from ..services.ticketing.transfer.models impor...
# Copyright 2014 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. from telemetry.page import page as page_module from telemetry.page import page_set as page_set_module class KeyHitTestCasesPage(page_module.Page): def _...
#!/usr/bin/python # # 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 ag...
# Copyright 2001 by Gavin E. Crooks. All rights reserved. # This code is part of the Biopython distribution and governed by its # license. Please see the LICENSE file that should have been included # as part of this package. # Gavin E. Crooks 2001-10-10 """ASTRAL RAF (Rapid Access Format) Sequence Maps. The ASTRAL...
from typing import TYPE_CHECKING, Dict, List from ray.tune.checkpoint_manager import Checkpoint if TYPE_CHECKING: from ray.tune.trial import Trial class Callback: """Tune base callback that can be extended and passed to a ``TrialRunner`` Tune callbacks are called from within the ``TrialRunner`` class. ...
# -*- coding: utf-8 -*- # Generated by Django 1.11 on 2018-05-13 05:15 from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): initial = True dependencies = [ ] operations = [ migrations.CreateModel( name='User', ...
"""projectphil URL Configuration The `urlpatterns` list routes URLs to views. For more information please see: https://docs.djangoproject.com/en/2.2/topics/http/urls/ Examples: Function views 1. Add an import: from my_app import views 2. Add a URL to urlpatterns: path('', views.home, name='home') Class-b...
import smtplib import time from utils.messageCreator import messageCreator from email.mime.multipart import MIMEMultipart from email.mime.text import MIMEText class userSender: user_email = "" user_password = "" host = "" port = 0 to_list = [] messDictionary = {} SubjectFromMes...
# coding: utf-8 # MIT License # # Copyright (c) 2018 Kalate Hexanome, 4IF, INSA Lyon # # 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 ri...
import filetype def main(path): kind = filetype.guess(path) if kind is None: print('Cannot guess file type!') return typ=kind.mime ans=typ.find("video") print(typ) print('File extension: %s' % kind.extension) print('File MIME type: %s' % kind.mime) if __name__ == '__main__'...
import pytest from azureml_appinsights_logger.console_logger import ConsoleLogger from azureml_appinsights_logger.logger_interface import Severity @pytest.fixture def mock_run(mocker): mocker.patch.object(ConsoleLogger, 'get_run_id_and_set_context', return_value="MY...
# coding: utf-8 """ Copyright 2016 SmartBear Software Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applica...
#$Header: /nfs/slac/g/glast/ground/cvs/GlastRelease-scons/CalUtil/CalUtilLib.py,v 1.4 2011/11/12 00:46:41 jrb Exp $ def generate(env, **kw): if not kw.get('depsOnly', 0): env.Tool('addLibrary', library = ['CalUtil']) if env['PLATFORM']=='win32' and env.get('CONTAINERNAME','')=='GlastRelease': e...
# coding=utf-8 # *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. *** # *** 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, overload from .. import...
#!/usr/bin/env python3 """ transforms.py Implementation of the forward and backward fourier-bessel transforms (Hankel transform) using the discrete sine transform function via scipy. """ import numpy as np from scipy.fftpack import dst, idst def discrete_hankel_transform( r: np.ndarray, k: np.ndarray, fr: np.n...
#!/usr/bin/env python """MODULE DOCSTRING WILL BE DYNAMICALLY OVERRIDED.""" from twmods import (make_manager, EPILOG) from twmods.commands.trends import make_commands DESCRIPTION = "A utility script to call trends/xxx of Twitter API." USAGE = """ twtrend.py [--version] [--help] twtrend.py trends/available twtr...
import pandas as pd import os import numpy as np paths = { 'Data' : os.path.join(os.getcwd(), 'Data') } def json_reader(file): df = pd.read_json(os.path.join(paths['Data'], file),encoding='utf-8', dtype=int) df.set_index('Lesson-Code') return df def DataFrame_appender(df : pd.DataFrame , ld : pd.Dat...
# coding=utf-8 # Copyright 2018 The Google AI Language Team Authors and The HugginFace Inc. team. # # 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/LICENS...
# # Copyright (c) 2001 - 2016 The SCons Foundation # # 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, merge...
import unittest import json import unifi_tracker as unifi TEST_RESULT_PROLOG = b'{"vap_table": [{"sta_table": ' TEST_RESULT_EPILOG = b'}]}' TEST_CLIENTS1 = b'[{"mac": "mac1", "hostname": "hostname1"}, {"mac": "mac2", "hostname": "hostname2"}]' TEST_CLIENTS2 = b'[{"mac": "mac1", "hostname": "hostname1"}, {"mac": "mac3"...
# Prompt: Create a BankAccount class that allows a user to create various instance objects and withdraw from/deposit to them. class BankAccount: def __init__(self): # TODO: What instance variable(s) do you need? def withdraw(self, amount): # TODO: Implement logic for withdraw def deposit(...
import _plotly_utils.basevalidators class ColorValidator(_plotly_utils.basevalidators.ColorValidator): def __init__( self, plotly_name="color", parent_name="scatter3d.marker.colorbar.title.font", **kwargs, ): super(ColorValidator, self).__init__( plotly_name...
from sqlalchemy import create_engine from sqlalchemy.ext.declarative import declarative_base from sqlalchemy.orm import sessionmaker SQLALCHEMY_DATABASE_URL = "sqlite:///./data.db" engine = create_engine( SQLALCHEMY_DATABASE_URL, connect_args={"check_same_thread": False},echo=True ) SessionLocal = sessionmaker(a...
# -*- coding: utf-8 -*- from openprocurement.api.utils import context_unpack, json_view, get_now from openprocurement.tender.core.utils import optendersresource, apply_patch from openprocurement.tender.core.validation import ( validate_tender_not_in_terminated_status, ) from openprocurement.tender.belowthreshold.v...
import datetime import logging import random from time import sleep from typing import Any import click from project_common.abc import AirflowTask, create_cli from project_common.cli_types import type_timedelta logger = logging.getLogger(__name__) cli = create_cli() @cli.register_callback class RandomFailTask(Airf...
norm_cfg = dict(type='SyncBN', requires_grad=True) model = dict( type='EncoderDecoder', pretrained=None, backbone=dict( type='ResNetV1d', depth=101, num_stages=4, out_indices=(0, 1, 2, 3), dilations=(1, 1, 2, 4), strides=(1, 2, 1, 1), norm_cfg=dict(typ...
from __future__ import print_function from os import sys from skbuild import setup setup( name='itk-ultrasound', version='0.5.0', author='Matthew McCormick', author_email='matt.mccormick@kitware.com', packages=['itk'], package_dir={'itk': 'itk'}, download_url=r'https://github.com/KitwareMe...
# -*- coding: utf-8 -*- import os import sys import types import numpy as np from sklearn.metrics import accuracy_score from sklearn.tree import DecisionTreeClassifier from sklearn.tree import DecisionTreeRegressor from sklearn.ensemble import AdaBoostClassifier from sklearn.ensemble import RandomForestClassifier fr...
from . import instance class SelfConstructor: def __new__(cls, *args, **kwargs): if len(args) == 1 and len(kwargs) == 0: if isinstance(args[0], cls): inst = args[0] else: inst = super().__new__(cls) inst.initialize(args[...
# coding: utf-8 """ TileDB Storage Platform API TileDB Storage Platform REST API # noqa: E501 The version of the OpenAPI document: 2.2.19 Generated by: https://openapi-generator.tech """ from __future__ import absolute_import import datetime import unittest import tiledb.cloud.rest_api from tile...
# # Copyright 2019 The FATE 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...
"""The test project for the SkewYInterface class. Command examples: $ python test_projects/SkewYInterface/main.py """ import sys sys.path.append('./') import os from types import ModuleType from typing_extensions import TypedDict import apysc as ap from apysc._file import file_util this_module:...
# Copyright 2013 Big Switch Networks, 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 applicable law or agreed to...
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import numpy as np import random class Compose: def __init__(self, transforms): self.transforms = transforms def __call__(self, c...
#! /usr/bin/env python # Copyright 2015 Peter Williams <peter@newton.cx> and collaborators. # Licensed under the MIT License. # I don't use the ez_setup module because it causes us to automatically build # and install a new setuptools module, which I'm not interested in doing. from setuptools import setup setup ( ...
""" Django settings for pyShop project. Generated by 'django-admin startproject' using Django 1.11.4. For more information on this file, see https://docs.djangoproject.com/en/1.11/topics/settings/ For the full list of settings and their values, see https://docs.djangoproject.com/en/1.11/ref/settings/ """ import os ...
import contextlib import functools from collections import namedtuple from itertools import chain, takewhile from typing import Dict, List import sqlparse from snowflake.connector import SnowflakeConnection from snowflake.connector.cursor import DictCursor, SnowflakeCursor from dbnd import log_dataset_op from dbnd_...
#!/usr/bin/env python """The setup script.""" from setuptools import setup, find_packages with open('README.rst') as readme_file: readme = readme_file.read() with open('HISTORY.rst') as history_file: history = history_file.read() requirements = None setup_requirements = [{%- if cookiecutter....
# 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 ...
# Copyright 2017 Maurice Carey # # 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 agr...
# Generated by Django 3.2.7 on 2021-10-18 19:24 from django.db import migrations, models class Migration(migrations.Migration): initial = True dependencies = [ ] operations = [ migrations.CreateModel( name='Leaders', fields=[ ('id', models.BigAutoFie...
import pyb # USR button is controlled using a Switch object # This is the one closer to the center of the pyboard sw = pyb.Switch() led = pyb.LED(4) # 4 is the blue LED # toggles the LED when the USR button is released # no need for while True: statement to keep this running # read up on interrupts to understand how ...
""" Technique - A slight improvement over the previous technique and a slight but unnoticeable improvement in performance as well. - Since the series starts with 2 odd number, the third one will be even because it is the sum of two odd numbers. The next two will again be odd since one odd number gets added to an even...
#向文件写入两行字符串 f = open('hello.txt', 'w') # 打开(文本+写入模式) f.write('Hello!\n') f.write('How are you?\n') f.close() # 关闭
# Copyright 2013-2018 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) """This module contains utilities for using multi-methods in spack. You can think of multi-methods like overloaded methods...
# @Title: 求众数 (Majority Element) # @Author: KivenC # @Date: 2019-03-13 10:01:10 # @Runtime: 104 ms # @Memory: 14.4 MB class Solution: def majorityElement(self, nums: List[int]) -> int: return sorted(nums)[len(nums) // 2]
#!/usr/bin/env python # Licensed to Cloudera, Inc. under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. Cloudera, Inc. licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you ma...
# Copyright 2014-2016 OpenMarket Ltd # Copyright 2017 Vector Creations Ltd # Copyright 2018-2019 New Vector Ltd # Copyright 2019 The Matrix.org Foundation C.I.C. # # 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...
# Given an array nums and a value val, remove all instances # of that value in-place and return the new length. # Do not allocate extra space for another array, you must do # this by modifying the input array in-place with O(1) extra memory. # The order of elements can be changed. It doesnt matter what you leave beyond...
import os import oriskami import warnings from oriskami.test.helper import (OriskamiTestCase) class OriskamiAPIResourcesTests(OriskamiTestCase): def test_event_queue_retrieve(self): response = oriskami.EventQueue.retrieve("1") event = response.data[0] self.assertEqual(event["id"], "1") ...
# [ANDES] (C)2015-2020 Hantao Cui # # 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 3 of the License, or # (at your option) any later version. # # File name: block.py # Las...
description = 'qmesydaq devices for SANS1' # included by sans1 group = 'lowlevel' sysconfig = dict( datasinks = ['BerSANSFileSaver', 'LivePNGSink', 'LivePNGSinkLog', # 'DetectorSetup', 'DetectorCalibration' ], ) devices = dict( BerSANSFileSaver = device('nicos_mlz.sans1.data...
import pytest import bionic as bn def test_pyplot_no_parens(builder): @builder @bn.pyplot def plot(pyplot): ax = pyplot.subplot() ax.plot([1, 2, 3], [1, 3, 9]) img = builder.build().get("plot") assert img.width > 0 assert img.height > 0 def test_pyplot_no_args(builder): ...
#!/usr/bin/env python import os from setuptools import setup long_description = open( os.path.join( os.path.dirname(__file__), 'README.md' ) ).read() setup( name='blasto', version='0.1.3', description='A Python implementation of Hill-Climbing for cracking classic ciphers', url='https://git...
from django.test import TestCase from lxml import html import pytest from projects.tests.factories import ProjectFactory, NominationFactory, ClaimFactory @pytest.mark.django_db class TestNominationDetailView: def test_loads(self, client): response = client.get(NominationFactory().get_absolute_url()) ...
""" spotilyzer test mock describe_instance_types paginator """ # system imports import os import json # test imports from .base import MockPaginatorsBase class MockDescribeInstanceTypesPaginator(MockPaginatorsBase): def __init__(self): super(MockDescribeInstanceTypesPaginator, self).__init__() ...
""" This module defines view function decorator to collect UWSGI metrics and expose them via an endpoint. """ import functools import os import time from werkzeug.exceptions import HTTPException from especifico.exceptions import ProblemException try: import uwsgi_metrics HAS_UWSGI_METRICS = True # pragma:...
from . import git, locations from .images import Image, default from .index import Index from .tags import Tag from .versions import Version from .utils import dictify, listify, setify, memoize def _resolve_line_continuations(lines): """Glue together lines terminated by a backslash.""" previous = None fo...
""" Home Work 6 Ankit Khandelwal Exercise 9 Jacobi 15863 """ from math import exp import matplotlib.pyplot as plt import numpy as np xv = np.linspace(-1, 1, 40) yv = np.linspace(-1, 1, 40) delta = 2 / 39 def rho(x, y): if x <= 0.3 and x >= -0.3: return exp(-abs(y) / 0.1) else: return 0 p...
import os def get_parent_dir(n=0): current_path = os.path.dirname(os.path.abspath(__file__)) for _ in range(n): current_path = os.path.dirname(current_path) return current_path os.sys.path.append(get_parent_dir(2)) from .Layer import Layer from .Dense import Dense
#coding:utf-8 import requests from lxml import etree class Xinlang: def __init__(self): self.url = 'http://zst.aicai.com/ssq/openInfo/' self.headers = { 'User-Agent': '"Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0) ",' } def get_data(self, url): response = r...
from asposeemail import Settings from com.aspose.email import PersonalStorage from com.aspose.email import PersonalStorageQueryBuilder from com.aspose.email import MapiImportance from com.aspose.email import MapiMessageFlags class SearchMessagesAndFoldersInPST: def __init__(self): ...
import logging import math import os import pickle import random import sys import time from math import ceil, log from pathlib import Path from typing import Dict, List, Set, Tuple import matplotlib.pyplot as plt import numpy as np import pandas as pd import seaborn as sns import torch import torch.nn as nn import to...
from .models import Create, Profile from django import forms class CreateForm(forms.ModelForm): class Meta: model = Create fields = ('Name', 'Description', 'Event', 'Date', 'Time', 'duration')
import demistomock as demisto from CommonServerPython import * from CommonServerUserPython import * ''' IMPORTS ''' import json import requests import base64 import email import hashlib from typing import List from dateutil.parser import parse from typing import Dict, Tuple, Any, Optional, Union # Disable insecure wa...
from django.conf import settings from places.models import Place import requests PLACES_API_ROOT = "https://maps.googleapis.com/maps/api/place" PLACES_DETAILS_URL = "{ROOT_URL}/details/json?inputtype=textquery&key={key}&place_id={place_id}&fields={fields}" PLACES_PHOTO_URL = "{ROOT_URL}/photo?key={key}&photoreference...
# emacs: -*- mode: python; py-indent-offset: 4; tab-width: 4; indent-tabs-mode: nil -*- # ex: set sts=4 ts=4 sw=4 noet: # ## ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ## # # See COPYING file distributed along with the datalad package for the # copyright and license terms. # # ## ### ##...
# 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 or agreed to ...
""" WSGI config for ImageLocalFinder project. It exposes the WSGI callable as a module-level variable named ``application``. For more information on this file, see https://docs.djangoproject.com/en/1.9/howto/deployment/wsgi/ """ import os from django.core.wsgi import get_wsgi_application os.environ.setdefault("DJA...