text
stringlengths
2
999k
from numpy import array from retry import retry from litai import ArticleScorer def test_scoring(): @retry(tries=10) def score_fun(): scorer = ArticleScorer(database='data/example.db') scorer.score( scores_table='mouse', pos_keywords='mouse', neg_keywords='...
""" sentry.testutils.cases ~~~~~~~~~~~~~~~~~~~~~~ :copyright: (c) 2010-2014 by the Sentry Team, see AUTHORS for more details. :license: BSD, see LICENSE for more details. """ from __future__ import absolute_import __all__ = ( 'TestCase', 'TransactionTestCase', 'APITestCase', 'TwoFactorAPITestCase', 'AuthProvider...
#----------------------------------------------------------------------------- # This file is part of the rogue software platform. It is subject to # the license terms in the LICENSE.txt file found in the top-level directory # of this distribution and at: # https://confluence.slac.stanford.edu/display/ppareg/LICENSE...
import param from nick_derobertis_site.common.component import HTMLComponent from .{{ cookiecutter.snake_case_name }}_model import {{ cookiecutter.pascal_case_name }}Model class {{ cookiecutter.pascal_case_name }}Component(HTMLComponent): model = param.ClassSelector(class_={{ cookiecutter.pascal_case_name }}Mode...
import os, sys, requests from flask import Flask, request from flask_restful import Resource, Api app = Flask(__name__) api = Api(app) #curl -H "Content-Type: application/json" -X POST -d '{"job_id":"ac97682c-c81e-4170-bb46-8301df317587"}' http://localhost:9000/scheduled-bod class UIHRecurrence(Resource): def p...
from datetime import datetime from decimal import Decimal from django.contrib.postgres import fields as psql_fields from django.db import models import pytest from avocato.exceptions import AvocatoError from avocato.fields import IntField, MethodField from avocato.validators import Length, OneOf from avocato.vendors...
import os import environ import sentry_sdk from django.utils.translation import gettext_lazy as _ from sentry_sdk.integrations.django import DjangoIntegration checkout_dir = environ.Path(__file__) - 2 assert os.path.exists(checkout_dir("manage.py")) parent_dir = checkout_dir.path("..") if os.path.isdir(parent_dir("e...
""" This inline script can be used to dump flows as HAR files. """ import json import sys import base64 import zlib import os from datetime import datetime import pytz import mitmproxy from mitmproxy import version from mitmproxy.utils import strutils from mitmproxy.net.http import cookies HAR = {} # A list of s...
import os import argparse from azureml.core import Workspace from azureml.core.environment import Environment from azureml.core.model import Model, InferenceConfig import shutil from ml_service.util.env_variables import Env e = Env() # Get Azure machine learning workspace ws = Workspace.get( name=e.workspace_name...
#!c:\users\raj\desktop\dev\ecommerce\scripts\python.exe from django.core import management if __name__ == "__main__": management.execute_from_command_line()
# generated from catkin/cmake/template/pkg.context.pc.in CATKIN_PACKAGE_PREFIX = "" PROJECT_PKG_CONFIG_INCLUDE_DIRS = "".split(';') if "" != "" else [] PROJECT_CATKIN_DEPENDS = "".replace(';', ' ') PKG_CONFIG_LIBRARIES_WITH_PREFIX = "".split(';') if "" != "" else [] PROJECT_NAME = "hector_compressed_map_transport" PROJ...
"""Consistent Hash CacheNode class""" class CacheNode: """CacheNode, record cache node info and send cache method""" def __init__(self, ip): self._ip = ip @property def ip(self): return self._ip @ip.setter def ip(self, value: str): self._ip = value def send(self,...
import komand from .schema import ReverseIpWhoisInput, ReverseIpWhoisOutput # Custom imports below from komand_domaintools.util import util class ReverseIpWhois(komand.Action): def __init__(self): super(self.__class__, self).__init__( name='reverse_ip_whois', description='P...
import lzma import sys import os import io import tarfile #ZZip Extracter Version 1.2 #Copyright (c) Alexander Richards tar_bytes = bytes() version = 1.2 write_string_identifier_dir = "ZZIP1.0DIR " write_string_identifier = "ZZIP1.0 " string_identifier = "ZZIP1.0" string_identifier_dir = "ZZIP1.0DIR" filterstouse =...
import unittest from os import path import json import ndex.beta.layouts as layouts from ndex.networkn import NdexGraph HERE = path.abspath(path.dirname(__file__)) class NetworkNConstructorTests(unittest.TestCase): def test1(self): with open(path.join(HERE, 'tiny_corpus.cx'),'r') as cx_file: ...
""" Reduce filters with the help of name filters """ from pySPACE.missions.nodes.base_node import BaseNode import logging from pySPACE.resources.data_types.feature_vector import FeatureVector import numpy class FeatureNameFilterNode(BaseNode): """ Filter feature vectors by name patterns or indices .. tod...
# -*- coding: utf-8 -*- # PLEASE DO NOT EDIT THIS FILE, IT IS GENERATED AND WILL BE OVERWRITTEN: # https://github.com/ccxt/ccxt/blob/master/CONTRIBUTING.md#how-to-contribute-code from ccxt.base.exchange import Exchange import base64 import math from ccxt.base.errors import ExchangeError from ccxt.base.errors import A...
import copy import datetime import random import traceback import logging import os import numpy as np import torch from torch.utils.data import DataLoader from tqdm import tqdm logger = logging.getLogger('pipeline') logger.setLevel(logging.INFO) def init_random_seed(value=0): random.seed(value) np.random....
# 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 (t...
""" Main module for surveying solution. Calls each separate solution and summarizes results and performance """ import time import sys import pandas as pd import pyjion from itertools import product from typing import Type, TYPE_CHECKING from orchestrator import GridOrchestrator if TYPE_CHECKING: from view impor...
import mimetypes from base64 import b64decode from datetime import datetime import os from typing import Union from webwhatsapi import Contact from webwhatsapi.helper import safe_str from webwhatsapi.objects.contact import Contact from webwhatsapi.objects.whatsapp_object import WhatsappObject def getContacts(x, dri...
# Copyright (c) 2017 Sony Corporation. 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...
# Copyright (c) 2022 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 app...
from django.urls import path from . import views urlpatterns = [ path('signup/', views.SignUp.as_view(), name='signup'), path('reset_password/', views.ResetPassword.as_view(), name='reset'), ]
# Copyright 2015 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...
from __future__ import absolute_import import re import uuid import pytest from six import text_type from sentry.testutils import TestCase from clims.services import SubstanceBase from clims.services.container import PlateBase from clims.services import FloatField, TextField from clims.models import Container from dja...
# -*- coding: utf-8 -*- """Tests for the SHA-1 hasher implementation.""" import unittest from plaso.hashers import sha1 from tests.hashers import test_lib class SHA1Test(test_lib.HasherTestCase): """Tests the SHA-1 hasher.""" def testFileHashMatches(self): """Tests that a few known files match the expecte...
name = "alienpy"
from StringIO import StringIO from django import http from django.core.serializers.json import Serializer from django.db.models.query import QuerySet from django.views.generic import TemplateView class TemplateContextView(TemplateView): """ Allow define context in as_view method. """ context = dict() ...
# 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, overload from .. import _utilities __a...
# -*- coding: utf-8 -*- # Copyright (c) 2019, Frappe Technologies and Contributors # See license.txt from __future__ import unicode_literals # import frappe import unittest class TestGoogleDrive(unittest.TestCase): pass
import logging import os import requests import tempfile import time from ocs_ci.framework import config from ocs_ci.ocs import managedservice from ocs_ci.ocs.exceptions import UnexpectedBehaviour from ocs_ci.utility.utils import exec_cmd logger = logging.getLogger(name=__file__) def set_pagerduty_integration_secre...
import asyncio from datetime import datetime from typing import Callable import discord from discord.ext import commands class AoiTask: def __init__(self, task: asyncio.Task, ctx: commands.Context, status: Callable[[], str]): self.task = task self.ctx = ctx self._status = status s...
import sys from cx_Freeze import setup, Executable import os import sys path=sys.prefix.replace('\\','/') pathbin= path +'/Library/bin/' os.environ['TCL_LIBRARY'] = path + '/tcl/tcl8.6' os.environ['TK_LIBRARY'] = path + '/tcl/tk8.6' base = None if sys.platform == 'win32': base = 'Console' icon="Pictures/icon...
from random import choice from flask_sqlalchemy import SQLAlchemy from fortunate import utils from fortunate.exceptions import ApiException db = SQLAlchemy() class SqlFortune(utils.Fortune): def init_app(self, app): db.init_app(app) def commit(self, model): db.session.add(model) d...
from .client import Houston
# Beispielprogramm für das Buch "Python Challenge" # # Copyright 2020 by Michael Inden from ch08_binary_trees.solutions.ex05_levelorder import levelorder, create_level_order_example_tree def test_levelorder(): root = create_level_order_example_tree() result = [] levelorder(root, lambda item: result.appe...
import pytest import os from flaky import flaky from telegram import CallbackQuery, User, Message, Chat, Update, user, Bot from ..owepaybot import button, groupDontRegister from ..HELPME.bot_sql_integration import * @pytest.fixture(scope='function', params=['message', 'inline']) def user_register_callback_query(bot):...
from py42.services.alertrules import FileTypeMismatchService class TestFileTypeMisMatchClient(object): def test_get_by_id_posts_to_correct_endpoint_for_type_mismatch_rule_type( self, mock_connection ): alert_rule_client = FileTypeMismatchService(mock_connection, u"tenant-id") alert_rul...
"""Public interface to top-level pytype functions.""" import contextlib import logging import os import sys import tokenize import traceback from pytype import __version__ from pytype import analyze from pytype import config from pytype import directors from pytype import errors from pytype import load_pytd from pyty...
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('spatial', '0001_initial'), ] operations = [ migrations.AddField( model_name='layer', name='legend', ...
import ssl import unittest import pkg_resources from aiosmtpd.controller import Controller as BaseController from aiosmtpd.handlers import Sink from aiosmtpd.smtp import SMTP as SMTPProtocol from email.mime.text import MIMEText from smtplib import SMTP class Controller(BaseController): def factory(self): ...
#!/usr/bin/python import xgboost as xgb # Always call this before using distributed module xgb.rabit.init() # Load file, file will be automatically sharded in distributed mode. dtrain = xgb.DMatrix('../../demo/data/agaricus.txt.train') dtest = xgb.DMatrix('../../demo/data/agaricus.txt.test') # Specify parameters via...
from __future__ import absolute_import # NaughtyAmerica plugin by AliAbdul from .Podcast import Podcast ################################################## class NaughtyAmerica(Podcast): def __init__(self): Podcast.__init__(self, "Naughty America", "NaughtyAmerica.png", "http://www.naughtyamerica.com/one_minclip_ar...
import argparse from .greet import greet def parse_args(): parser = argparse.ArgumentParser( description='Create automated github reports' ) parser.add_argument('name', metavar='NAME', type=str, help='name to greet') return parser.parse_args() def main(): args ...
from __future__ import unicode_literals, division, absolute_import from builtins import * # pylint: disable=unused-import, redefined-builtin import logging from flexget import plugin from flexget.event import event log = logging.getLogger('mock_output') class MockOutput(object): """ Debugging plugin which...
import torch import torch.nn as nn from models.Net import AlexNet, Uniform_D from dataset.customData import MyCustomDataset from loss.contrast import Contrast_Loss, Quantization_Loss import numpy as np from torch.autograd import Variable from torchvision import transforms from torch.utils.data import DataLoader from ut...
# 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...
import re from collections import OrderedDict from django import forms from django.db import models from django.template import loader try: from formtools.wizard.storage import get_storage from formtools.wizard.forms import ManagementForm from formtools.wizard.views import StepsHelper except: ...
import aiohttp import asyncio import uuid from mineid.main import errors class Player: """ Represents a Minecraft Player. Attributes: self.uuid: the uuid (Universally Unique Identifier) of the player self.username: the username of the player self._data: the data used to originally...
import streamlit as st import os import sys import ee import sys import base64 import geemap as gee from geemap import cartoee import pandas as pd from utils import new_get_image_collection_gif st.title("SARveillance") st.subheader("Sentinel-1 SAR time series analysis for OSINT use") class SAREXPLORER: north_ar...
""" Displays a NetworkX barbell graph to screen using a CircosPlot. Features of this example: - MatrixPlot - Styling matrix plot with different colormap. """ import matplotlib.pyplot as plt import networkx as nx from nxviz.plots import MatrixPlot G = nx.barbell_graph(m1=10, m2=3) # Instantiate a MatrixPlot with no...
# coding: UTF-8 from __future__ import (absolute_import, division, print_function, unicode_literals) from .menu_interface import MenuInterface from scenes.elements import ( GameDiv, GameTextElement, ButtonGroup, ) from consts.i18n import ( YES, NO, ) class DialogInterface...
""" Introduces utilities used throughout the package, including: - interfaces for making objects `distpy.util.Savable.Savable` and `distpy.util.Loadable.Loadable` in binary hdf5 files using h5py - helper methods for using h5py to save and load variables and arrays (`h5py_extensions`) - type category definitions (`...
#coding=utf-8 import datetime from random import choice,randint from urllib import request class Base(): @classmethod def autoGenerateAddrs(cls): return request.urlopen(request.Request("http://10.126.0.249:8080/getRandAddr")).read().decode("utf-8").split("|") @classmethod def autoGeneratePhon...
#!/usr/bin/env python # coding: utf-8 # In[52]: import matplotlib.pyplot as plt import numpy as np import os from os import listdir import pandas as pd import shutil from shutil import copyfile get_ipython().run_line_magic('matplotlib', 'inline') import re import pathlib import csv # ## Instructions For Use # 1...
# Copyright 2013-2021 Lawrence Livermore National Security, LLC and other # Spack Project Developers. See the top-level COPYRIGHT file for details. # # SPDX-License-Identifier: (Apache-2.0 OR MIT) from spack import * class RocmBandwidthTest(CMakePackage): """Test to measure PciE bandwidth on ROCm platforms""" ...
import re import collections DATA = '06.txt' def get_data(): points = list() with open(DATA) as f: for line in f: match = re.match(r'(\d+), (\d+)', line) points.append(list(int(_) for _ in match.groups())) xmin, xmax = float('inf'), 0 ymin, ymax = floa...
# -*- coding: utf-8 -*- # snapshottest: v1 - https://goo.gl/zC4yUc from __future__ import unicode_literals from snapshottest import Snapshot snapshots = Snapshot() snapshots['test_empty 1'] = { 'data': { 'allServices': { 'edges': [ ], 'totalCount': 0 } } }...
# Copyright (C) 2010-2011 Richard Lincoln # # 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, publish...
from typing import List from blspy import AugSchemeMPL, G1Element, G2Element from mint.consensus.coinbase import create_puzzlehash_for_pk from mint.util.bech32m import encode_puzzle_hash from mint.util.config import load_config from mint.util.default_root import DEFAULT_ROOT_PATH from mint.util.ints import uint32 fro...
from PIL import Image from osr2mp4 import logger from osr2mp4.ImageProcess.PrepareFrames.YImage import YImage class ScoreNumbers: def __init__(self, scale, settings): self.score_images = [] scoreprefix = "-" score_x = scoreprefix + "x" score_percent = scoreprefix + "percent" score_dot = scoreprefix + "dot"...
# Copyright 2015 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...
# Copyright 2017, OpenCensus 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 applicable law or agreed to in w...
import random import warnings import numpy as np from pettingzoo.utils.conversions import (aec_to_parallel_wrapper, parallel_to_aec_wrapper, turn_based_aec_to_parallel_wrapper) from pettingzoo.utils.wrappers import BaseWrapper from .api_test import missing_attr_warning def...
# Copyright (c) 2018 European Organization for Nuclear Research. # 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/LIC...
import dask.dataframe as dd import numpy as np import pandas as pd import pytest from pandas.testing import assert_frame_equal from dask_sql.utils import ParsingException def test_select(c, df): result_df = c.sql("SELECT * FROM df") result_df = result_df.compute() assert_frame_equal(result_df, df) def...
from django.db import models from django.contrib.auth.models import User from django.conf import settings from django.utils import timezone # Create your models here. class Profile(models.Model): user = models.OneToOneField(User, null=True, on_delete=models.CASCADE) profile_pic = models.ImageField(null=True, ...
# -*- coding: utf-8 -*- import json import logging from io import IOBase from typing import Optional, Union from flask_babel import gettext as __ from retry.api import retry from slack import WebClient from slack.errors import SlackApiError, SlackClientError from rabbitai import app from rabbitai.models.reports impor...
from django import template from django.conf import settings from django.contrib.auth.models import User from django.core.urlresolvers import reverse from django.test import TestCase from oauth2 import Client from socialregistration.signals import login, connect import mock import urllib import urlparse class Template...
# https://github.com/meta4/mplcal # Copyright (c) 2020, Peter Wilson # # All rights reserved. # import statements import calendar import matplotlib.pyplot as plt calendar.setfirstweekday(6) # Sunday is 1st day in US w_days = 'Sun Mon Tue Wed Thu Fri Sat'.split() m_names = '''January February March April May June July...
# 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. from dataclasses import dataclass, field from fairseq import file_utils from fairseq.data.encoders import register_bpe from fairseq.dataclass...
# -*- coding: utf-8 -*- # # Copyright © Spyder Project Contributors # Licensed under the terms of the MIT License # """ Tests for EditorSplitter class in editor.py """ # Standard library imports try: from unittest.mock import Mock import pathlib except ImportError: from mock import Mock # Python 2 im...
"""OreSuki script""" __author__ = 'Vardë' import os import sys import shlex import subprocess from pathlib import Path from typing import NamedTuple import debandshit as dbs import vardefunc as vdf import awsmfunc as awf import havsfunc as hvf from vsutil import depth, get_y, get_w import lvsfunc as lvf import vapou...
#!/usr/bin/python3 """ This module contains a function that safe filters states by user input. """ import MySQLdb from sys import argv if __name__ == "__main__": db = MySQLdb.connect(user=argv[1], passwd=argv[2], db=argv[3]) cursor = db.cursor() cursor.execute("SELECT * FROM states where name like %s\ ...
#The MIT License (MIT) #Copyright (c) 2014 Microsoft Corporation #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, modi...
import base64 import hashlib import zlib import re import tempfile import pathlib import urllib.request from mkdocs.plugins import BasePlugin from mkdocs.structure.files import File from mkdocs import config class KrokiPlugin(BasePlugin): config_scheme = ( ('ServerURL', config.config_options.Type( ...
#!/usr/bin/env python3 from contextlib import contextmanager import pandas as pd import numpy as np import random import torch import time import os import argparse from scipy import sparse from sklearn.model_selection import train_test_split from sklearn.preprocessing import StandardScaler from sklearn.impute import ...
### This example code uses: Maker Pi Pico ;; Reference: www.cytron.io/p-maker-pi-pico """CircuitPython Essentials NeoPixel example""" import time import board import neopixel pixel_pin = board.GP28 num_pixels = 1 pixels = neopixel.NeoPixel(pixel_pin, num_pixels, brightness=0.2, auto_write=False) def ...
# SPDX-License-Identifier: Apache-2.0 # # The OpenSearch Contributors require contributions made to # this file be licensed under the Apache-2.0 license or a # compatible open source license. import unittest from assemble_workflow.bundle_url_location import BundleUrlLocation class TestBundleUrlLocation(unittest.Tes...
from unittest import TestCase, main from unittest.mock import patch, MagicMock, ANY from airflow import DAG from pre_sync_documents_to_kernel import get_sps_packages class TestGetSPSPackages(TestCase): @patch("pre_sync_documents_to_kernel.Variable.get") def test_get_sps_packages_raises_error_if_no_xc_dir_fr...
"""books table Revision ID: 941035b5155d Revises: 55d9cf8d35d2 Create Date: 2020-05-26 20:38:40.592532 """ from alembic import op import sqlalchemy as sa # revision identifiers, used by Alembic. revision = '941035b5155d' down_revision = '55d9cf8d35d2' branch_labels = None depends_on = None def upgrade(): # ##...
from ursina import * from ursina.prefabs.first_person_controller import FirstPersonController from ursina.prefabs.panel import Panel from ursina.shaders import * from perlin_noise import PerlinNoise from numpy import floor,abs from random import randint,randrange import psutil import os import json version = '0.0.4a' ...
import numpy as np import pandas as pd from munch import Munch from plaster.run.nn_v2.nn_v2_params import NNV2Params from plaster.run.nn_v2.nn_v2_worker import nn_v2 from plaster.run.prep import prep_fixtures from plaster.run.prep.prep_params import PrepParams from plaster.run.prep.prep_worker import prep from plaster....
# 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 use ...
# Copyright (c) 1998-2002 John Aycock # # 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, publis...
from datetime import timedelta from typing import Union from ariadne import ScalarType timedelta_scalar = ScalarType("Timedelta") @timedelta_scalar.serializer def serialize_timedelta(value: timedelta) -> float: return value.total_seconds() @timedelta_scalar.value_parser def parse_timedelta_value(value: Union...
from .. import settings from .. import logging as logg from scanpy.api import Neighbors from scanpy.api.pp import pca from scipy.sparse import issparse import numpy as np def neighbors(adata, n_neighbors=30, n_pcs=30, use_rep=None, knn=True, random_state=0, method='umap', metric='euclidean', metric_kwd...
import asyncio from .trigger import Trigger ### class PubSubTrigger(Trigger): def __init__(self, app, message_types, pubsub=None, id=None): super().__init__(app, id) self.PubSub = pubsub if pubsub is not None else app.PubSub if isinstance(message_types, str): self.PubSub.subscribe(message_types, self.on...
import yaml import numpy as np import tensorflow as tf from absl import logging def set_memory_growth(): gpus = tf.config.experimental.list_physical_devices('GPU') if gpus: try: # Currently, memory growth needs to be the same across GPUs for gpu in gpus: tf.conf...
for changeTuple in Query.input.tuples('change'): method = changeTuple.ast printExpr = AstModification.buildExpression('System.out.println("Executing method {}")'.format(method.name)) printStmt = Node.createNewNode('ExpressionStatement', None) printStmt.expression = printExpr method.beginModification...
#!/usr/local/bin/python3 """ Alex-Antoine Fortin Tuesday December 05, 2017 Description This python script: 1. Import needed modules 2. Defines model as defined in 01-Xception-Model.py 3. Loads weights from .hdf5 4. Freezes fewer layers 5. Resumes training """ import os, imp, numpy as np from time import time t = imp.lo...
from __future__ import print_function import matplotlib.pyplot as plt import os import sys import re import gc # Selection of features following "Writing mathematical expressions" tutorial mathtext_titles = { 0: "Header demo", 1: "Subscripts and superscripts", 2: "Fractions, binomials and stacked numbers",...
''' Date Time Utility ''' from datetime import datetime class DateTimeUtil(object): def getDate(self): date = datetime.now().strftime('%b %d %y') return date def getTime(self): time = datetime.now().strftime('%H:%M:%S') return time
# Copyright 2016 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...
from discord_interactions.flask_ext import Interactions, CommandContext from discord_interactions.ocm import Command, Option, OptionChoices from discord_interactions import User from flask import Flask import os import random app = Flask(__name__) interactions = Interactions(app, os.getenv("CLIENT_PUBLIC_KEY")) clas...
extension_paths = { # No name 'noname': 'other/uncategorized', # audio '.aif': 'media/audio', '.cda': 'media/audio', '.mid': 'media/audio', '.midi': 'media/audio', '.mp3': 'media/audio', '.mpa': 'media/audio', '.ogg': '...
import logging import os from platform import system import requests import socket try: import cookielib except ImportError: # python 3 import http.cookiejar as cookielib _auth_provider = None _headers = {'Accept-Language': 'en'} try: if system() == 'Windows': from requests_negotiate_sspi imp...
from shapeworld.captions import Caption class Proposition(Caption): __slots__ = ('proptype', 'clauses') def __init__(self, proptype, clauses): assert proptype in ('conjunction', 'disjunction', 'exclusive-disjunction', 'implication', 'equivalence') assert len(clauses) >= 1 and all(isinstance(...
import unittest from conans.test.utils.tools import TestClient class CMakeInstallPackageTest(unittest.TestCase): def patch_config_test(self): client = TestClient() conanfile = """from conans import ConanFile, CMake from conans.tools import save, load import os class AConan(ConanFile): settin...