filename
stringlengths
13
19
text
stringlengths
134
1.04M
the-stack_106_19157
from pygments.style import Style from pygments.token import ( Comment, Error, Keyword, Literal, Name, Number, Operator, String, Text ) class BaseSixteenStyle(Style): base00 = '#000000' base01 = '#121212' base02 = '#222222' base03 = '#333333' base04 = '#999999' base05 = '#c1c1c1' base06...
the-stack_106_19159
# -*- coding: utf-8 -*- """ .. admonition:: License Copyright 2019 CNES Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless requir...
the-stack_106_19160
#!/usr/bin/env python # -*- coding: utf-8 -*- # @Author : qichun tang # @Contact : qichun.tang@bupt.edu.cn from collections import defaultdict from copy import deepcopy from math import inf from time import time from typing import Tuple, Union, List, Dict import numpy as np from ConfigSpace import Configuration fr...
the-stack_106_19161
# Copyright 2019 Shift Cryptosecurity AG # # 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...
the-stack_106_19162
from optparse import make_option from django.core.management.base import BaseCommand, CommandError from fcm.utils import get_device_model Device = get_device_model() class Command(BaseCommand): args = ['<device_id>', '<message>'] help = 'Send message through fcm api' def add_arguments(self, parser): ...
the-stack_106_19163
# program r7_01.py # Rozpoczynamy program import os from r7_functions import * def exif_anonymize(): directory = "." images_files = [".jpg", ".jpeg", ".png"] for dirpath, dirname, files in os.walk(directory): for file in files: image_file = os.path.join(dirpath, file) e...
the-stack_106_19168
# coding: utf-8 # Copyright (c) 2016, 2021, 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...
the-stack_106_19169
# -*- coding: utf-8 -*- # Copyright 2018 Novo Nordisk Foundation Center for Biosustainability, # Technical University of Denmark. # # 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...
the-stack_106_19170
# Copyright (C) 2018 Corefracture, Chris Coleman. # www.corefracture.com - @corefracture # # Licensed under the MIT License, https://opensource.org/licenses/MIT # See LICENSE.md for more details import logging from enum import Enum LOGGER = logging.getLogger(__name__) class NetemType(Enum): LATENCY = "0" JI...
the-stack_106_19172
#autotranslate.py # pip install easyread # pip install openpyxl from easyread.translator import Translate from openpyxl import Workbook from datetime import datetime article = open('article.txt','r',encoding='utf-8') article = article.read() article = article.split() print('Count: ',len(article)) result...
the-stack_106_19173
# -*- coding: utf-8 -*- from __future__ import print_function import logging import os import pandas as pd from pybel.constants import IS_A from pybel.utils import ensure_quotes from pybel_tools.constants import PYBEL_RESOURCES_ENV from pybel_tools.definition_utils import write_namespace, get_date from pybel_tools.d...
the-stack_106_19174
from math import inf import os import numpy as np import datetime from . import globs ################################ # line search functions ################################ def ternary_ls(obj_fct, x, direction, accuracy): gamma_ub = 1 gamma_lb = 0 # initialize y = x + direction # end point en...
the-stack_106_19175
import json from django.contrib import messages from django.core.files import File from django.db import transaction from django.db.models import Count, F, Prefetch, Q from django.forms.models import inlineformset_factory from django.http import Http404, HttpResponseRedirect from django.shortcuts import redirect from ...
the-stack_106_19178
import argparse import numpy from .._helpers import _writer_map, read, reader_map, write from ._helpers import _get_version_text def convert(argv=None): # Parse command line arguments. parser = _get_convert_parser() args = parser.parse_args(argv) # read mesh data mesh = read(args.infile, file_f...
the-stack_106_19180
# Copyright 2019 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 # # Unless required by applicable la...
the-stack_106_19182
import torch import numpy as np from . import MultiOutputKernel, Parameter, config class IndependentMultiOutputKernel(MultiOutputKernel): def __init__(self, *kernels, output_dims=None, name="IMO"): if output_dims is None: output_dims = len(kernels) super(IndependentMultiOutputKernel, se...
the-stack_106_19183
from typing import Optional, List from pydantic.error_wrappers import ErrorWrapper, ValidationError from dispatch.exceptions import NotFoundError from dispatch.project import service as project_service from .models import ( SourceStatus, SourceStatusCreate, SourceStatusUpdate, SourceStatusRead, ) de...
the-stack_106_19188
#!/usr/bin/env python """A builder implementation for windows clients.""" import ctypes import io import logging import os import re import shutil import subprocess import sys from typing import List import zipfile import win32process from grr_response_client_builder import build from grr_response_client_builder imp...
the-stack_106_19189
# Ordered list of items in Custom Item Pool page and Starting Inventory page CUSTOMITEMS = [ "bow", "progressivebow", "boomerang", "redmerang", "hookshot", "mushroom", "powder", "firerod", "icerod", "bombos", "ether", "quake", ...
the-stack_106_19190
from __future__ import absolute_import from __future__ import print_function from __future__ import unicode_literals import logging import os import sys from datetime import datetime, timedelta from django.core.management import BaseCommand, CommandError from corehq.blobs.migrate import MIGRATIONS from corehq.blobs.ut...
the-stack_106_19192
""" Text in plots """ #***************************************************************************** # Copyright (C) 2006 Alex Clemesha <clemesha@gmail.com>, # William Stein <wstein@gmail.com>, # 2008 Mike Hansen <mhansen@gmail.com>, # # Distributed under the terms of...
the-stack_106_19194
import click from setup.executor import Executor from setup.requirement_exception import RequirementException from builder.builder import Builder from uploader.sftp_uploader import SFTPUploader @click.group() def cli(): pass @click.command() def check(): print("Checking requisites...") try: Exe...
the-stack_106_19196
import os import json import logging from seldon_core.utils import ( extract_request_parts, construct_response, json_to_seldon_message, seldon_message_to_json, construct_response_json, extract_request_parts_json, extract_feedback_request_parts, ) from seldon_core.user_model import ( INCL...
the-stack_106_19198
#!/usr/bin/env pythonw # /******************************************************************** # Filename: edit_corners.py # Author: AHN # Creation Date: Mar 12, 2018 # **********************************************************************/ # # Editor to define four corners in a Goban picture and save the intersection...
the-stack_106_19199
"""Simulates a DB being available before we ran a command """ from unittest.mock import patch from django.core.management import call_command from django.db.utils import OperationalError from django.test import TestCase class CommandTests(TestCase): def test_wait_for_db_ready(self): """Test waiting for db when ...
the-stack_106_19200
"""A Python MapSequence Object""" #pylint: disable=W0401,W0614,W0201,W0212,W0404 from copy import deepcopy import numpy as np import matplotlib.animation import numpy.ma as ma import astropy.units as u from sunpy.map import GenericMap from sunpy.visualization.animator.mapsequenceanimator import MapSequenceAnimator ...
the-stack_106_19201
from xv_leak_tools.test_components.cleanup.cleanup_vpns import CleanupVPNs class MacOSCleanup(CleanupVPNs): # You can add more applications, processes etc. here or you can override this class # and the vpn_application component to avoid editing this one. VPN_PROCESS_NAMES = [ 'openvpn', '...
the-stack_106_19203
""" Copyright (c) 2016-present, Facebook, Inc. All rights reserved. This source code is licensed under the BSD-style license found in the LICENSE file in the root directory of this source tree. An additional grant of patent rights can be found in the PATENTS file in the same directory. The IP allocator maintains the...
the-stack_106_19204
# -------------------------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. # --------------------------------------------------------------------...
the-stack_106_19205
#!/usr/bin/python import time import sys import os import zlib import lzma import bsdiff4 import json import math import matplotlib.pyplot as plt basepath = sys.argv[1] if len(sys.argv) == 2 else '/etc' def compress(method): ini = time.time() results = [] for path, dirs, files in os.walk(basepath): ...
the-stack_106_19206
# -*- coding: utf-8 -*- """ Created on 10/02/2014 @author: Dani """ import re import codecs from reconciler.entities.normalized_country import NormalizedCountry from reconciler.exceptions.unknown_country_error import UnknownCountryError class CountryNormalizer(object): """ In this class we'll implement th...
the-stack_106_19207
import sys import logging def get_logger(logger_name, log_level=logging.INFO): logger = logging.getLogger(logger_name) if not logger.hasHandlers(): fmt = logging.Formatter( fmt="%(asctime)-11s %(name)s:%(lineno)d %(levelname)s: %(message)s", datefmt="[%Y/%m/%d-%H:%M:%S]" ...
the-stack_106_19209
from .node import Node from datetime import datetime as timestamp from time import time as now from .metrics import Metrics class DepthFirstSearch: def __init__(self, automated_planner): self.time_start = now() self.visited = [] self.automated_planner = automated_planner self.init ...
the-stack_106_19211
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations class Migration(migrations.Migration): dependencies = [ ('relation', '0005_auto_20151215_1549'), ] operations = [ migrations.RemoveField( model_name='relation', ...
the-stack_106_19213
from django.shortcuts import render from django.http import HttpResponsePermanentRedirect, HttpResponseNotFound from django.contrib.auth.decorators import login_required from cbp.models import FtpGroup, BackupGroup from cbp.forms import FtpServersForm @login_required(login_url='accounts/login/') def ftp_servers(requ...
the-stack_106_19219
# Copyright 2018 The TensorFlow Probability 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 o...
the-stack_106_19220
#!/usr/bin/env python ''' Project: Geothon (https://github.com/MBoustani/Geothon) File: Vector/create_kml_point.py Description: This code creates a point kml from latitude and longitue. Author: Maziyar Boustani (github.com/MBoustani) ''' import os try: import ogr except ImportError: f...
the-stack_106_19223
""" Key functions for the ADFQ algorithms Using jit posterior_numeric_exact posterior_numeric posterior_adfq posterior_adfq_v2 """ import numpy as np from scipy.stats import norm from scipy.special import logsumexp import pdb from numba import jit REW_VAR_0 = 1e-3 DTYPE = np.float64 def posterior_numeric_exact(n_m...
the-stack_106_19224
from operator import attrgetter import pyangbind.lib.xpathhelper as xpathhelper from pyangbind.lib.yangtypes import RestrictedPrecisionDecimalType, RestrictedClassType, TypedListType from pyangbind.lib.yangtypes import YANGBool, YANGListType, YANGDynClass, ReferenceType from pyangbind.lib.base import PybindBase from d...
the-stack_106_19225
"""General test cases usable by multiple test modules.""" from __future__ import unicode_literals import random import string from itertools import chain from hashlib import md5 # Trimming off whitespace/line return chars # reserving '0' for less-than string comparisons # reserving '~' for greater-than string compari...
the-stack_106_19231
# Copyright (c) 2014 Rackspace, 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 in wr...
the-stack_106_19232
# QUANTCONNECT.COM - Democratizing Finance, Empowering Individuals. # Lean CLI v1.0. Copyright 2021 QuantConnect 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...
the-stack_106_19234
from keras.preprocessing.text import Tokenizer from DataReader import DataReader from nltk.corpus import stopwords from keras.models import Sequential from keras.layers import Dense from keras.layers import LSTM from keras.layers.wrappers import Bidirectional from keras.layers import Embedding import numpy as np from k...
the-stack_106_19235
import warnings from typing import List, Optional, Union, Dict from mkdocs.structure.nav import ( Navigation as MkDocsNavigation, Section, Link, _get_by_type, _add_parent_links, _add_previous_and_next_links, ) from mkdocs.structure.pages import Page from .arrange import arrange, InvalidArrange...
the-stack_106_19238
# 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...
the-stack_106_19241
import json from typing import Any, Dict, Optional, Type from abc import ABC from datetime import datetime from bson import ObjectId from bson.objectid import InvalidId from pydantic import BaseConfig, BaseModel class OID: @classmethod def __get_validators__(cls): yield cls.validate @classmeth...
the-stack_106_19242
from typing import List class Solution: def find_min(self, nums: List[int]) -> int: self.nums = nums self.last = len(self.nums) - 1 return self.search(0, self.last, self.nums[0]) def search(self, left: int, right: int, target: int) -> int: if left > right: return t...
the-stack_106_19243
#!/usr/bin/env python # coding: utf-8 from msgpack import packb, unpackb def test_unpack_buffer(): from array import array buf = array('b') buf.fromstring(packb(('foo', 'bar'))) obj = unpackb(buf, use_list=1) assert [b'foo', b'bar'] == obj
the-stack_106_19244
""" Copyright 2019 Goldman Sachs. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software di...
the-stack_106_19245
# Copyright (c) Microsoft Corporation. # Licensed under the MIT License. import torch.utils.data import random from data.base_data_loader import BaseDataLoader from data import online_dataset_for_old_photos as dts_ray_bigfile def CreateDataset(opt): dataset = None if opt.training_dataset=='domain_A' or opt.t...
the-stack_106_19246
from collections import Counter from graph_tool import Graph, edge_endpoint_property from itertools import chain, combinations import logging import numpy as np from rhodonite.utils.graph import dict_to_vertex_prop, dict_to_edge_prop from rhodonite.cooccurrence.basic import cooccurrence_counts def cumulative_cooccur...
the-stack_106_19247
from __future__ import print_function, absolute_import import os import six import subprocess from .base import CapPA from .enums import IS_MAC from .utils import warn class Pip(CapPA): def __init__(self, *flags): super(Pip, self).__init__(*flags) self.name = 'pip' self.friendly_name = ...
the-stack_106_19248
#!/usr/bin/env python3 """Google certified android devices tracker""" import difflib import json from datetime import date from os import rename, path, system, environ from time import sleep from requests import get, post GIT_OAUTH_TOKEN = environ['GIT_OAUTH_TOKEN_XFU'] BOT_TOKEN = environ['BOTTOKEN'] TODAY = str(dat...
the-stack_106_19250
import matplotlib.pyplot as plt import pandas as pd import numpy as np import tensorflow as tf from tensorflow.keras.layers import * from tensorflow.python.lib.io import file_io from skimage.transform import rescale, resize import os os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3' # Function that reads the data from the ...
the-stack_106_19251
class Tasks: def __init__(self, taskID, title, datetime, description, statusID): self.taskID = taskID self.title = title self.datetime = datetime self.description = description self.statusID = statusID def get_status_name(self, list): for val in list: ...
the-stack_106_19254
# -*- coding:utf-8 -*- # ##### 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. # # ...
the-stack_106_19255
################################################################################################### ### Record & Render Information ################################################################################################### import os import csv import plotly import plotly.graph_objs as go import itertools impor...
the-stack_106_19258
""" My Discovery collection """ # Always prefer setuptools over distutils from setuptools import setup, find_packages # To use a consistent encoding from codecs import open from os import path here = path.abspath(path.dirname(__file__)) # Get the long description from the README file with open(path.join(here, 'READM...
the-stack_106_19259
# -*- coding: utf-8 -*- #!/usr/bin/env python # # Copyright 2017-2022 BigML # # 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...
the-stack_106_19260
""" The MIT License (MIT) Copyright (c) 2015-2021 Rapptz Copyright (c) 2021-present Pycord Development 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 limit...
the-stack_106_19261
# coding: utf-8 """ App Center Client Microsoft Visual Studio App Center API # noqa: E501 OpenAPI spec version: preview Contact: benedetto.abbenanti@gmail.com Project Repository: https://github.com/b3nab/appcenter-sdks """ import pprint import re # noqa: F401 import six class ResignStatus(o...
the-stack_106_19262
from django.test import TestCase from scratch_model import * chain = Blockchain() transaction1 = Transaction('A', 'B', 100) block1 = Block(transactions=[transaction1], time='now', index=1) block1.mine_block() chain.add_block(block1) transaction2 = Transaction('c', 'd', 50) transaction3 = Transaction('a', 'd', 150) ...
the-stack_106_19263
# MIT License # Copyright 2020 Ryan Hausen # # 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...
the-stack_106_19265
import numpy as np import matplotlib.pyplot as plt from sklearn.base import BaseEstimator from sklearn.cluster import KMeans from sklearn.model_selection import train_test_split from sklearn.metrics import classification_report from sklearn.metrics import confusion_matrix from sklearn.preprocessing import MinMaxScaler...
the-stack_106_19267
# -*- coding: utf-8 -*- # # Configuration file for the Sphinx documentation builder. # # This file does only contain a selection of the most common options. For a # full list see the documentation: # http://www.sphinx-doc.org/en/master/config # -- Path setup ------------------------------------------------------------...
the-stack_106_19268
# Artificial Neural Network # Installing Theano # pip install --upgrade --no-deps git+git://github.com/Theano/Theano.git # Installing Tensorflow # pip install tensorflow # Installing Keras # pip install --upgrade keras # Part 1 - Data Preprocessing # Importing the libraries import numpy as np import matplotlib.pyp...
the-stack_106_19269
''' Elie Yen Python version: 3.6 Conway's Game of life ''' import numpy import math def get_generation(cells, generations): #_ the direction of adjacent cells adj = ((-2, -2), (-2, -1), (-2, 0), (-1, -2), (-1, 0), (0, -2), (0, -1), (0, 0)) def status(cells, cur): print("...
the-stack_106_19271
# Ensure we get the local copy of tornado instead of what's on the standard path import os import sys import time sys.path.insert(0, os.path.abspath("..")) import tornado master_doc = "index" project = "Tornado" copyright = "2009-%s, The Tornado Authors" % time.strftime("%Y") version = release = tornado.version ext...
the-stack_106_19272
import json import urllib import urllib2 import tempfile import subprocess def set_image_cmd(filename): return ['/usr/bin/feh', '--bg-scale', filename] API_URL = 'http://www.bing.com/HPImageArchive.aspx?format=js&idx=0&n=1&mkt=en-US' def get_current_image_data(): """return the latest bing image data: A dicti...
the-stack_106_19273
"""Solve a random maze with Markovian Decision Process""" # ----------------------------------------------------------------------------- # Copyright 2019 (C) Nicolas P. Rougier & Anthony Strock # Released under a BSD two-clauses license # # References: Bellman, Richard (1957), A Markovian Decision Process. # ...
the-stack_106_19275
#!/usr/bin/env python # Copyright 2014-2018 The PySCF Developers. 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 # # U...
the-stack_106_19277
# # 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...
the-stack_106_19280
# Copyright 2020 The TensorFlow Probability 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 o...
the-stack_106_19281
from __future__ import division import numpy as np import pandas import math import os import types import h5py from six.moves import cPickle as pickle import seaborn as sns import matplotlib.pyplot as plt sns.set_style("white") from ML_Tools.Plotting_And_Evaluation.Plotters import * from ML_Tools.General.Misc_Functi...
the-stack_106_19282
import gym import sys; import os import matplotlib.pyplot as plt import numpy as np import torch import argparse import imageio import maml_rl.envs from tqdm import tqdm from maml_rl.policies.conv_lstm_policy import ConvLSTMPolicy from scipy.ndimage.filters import gaussian_filter from scipy.misc import imresize searc...
the-stack_106_19283
from django.shortcuts import render, get_object_or_404 from django.utils import timezone from .models import Engine, RefreshBatch from .collections import ( general_table, stats_daterange_table, players_chart, wads_popularity_table, iwad_popularity_chart, servers_popularity_table) from datetime import timed...
the-stack_106_19284
#!/usr/bin/python3 # (c) 2014, WasHere Consulting, Inc import struct f = open("mbr.dd", "rb") mbr = bytearray() try: mbr = f.read(512) finally: f.close() sig = struct.unpack("<I", mbr[0x1B8:0x1BC]) print("Disk signature: ", sig[0]) active = mbr[0x1BE] if active == 0x80: print("Active flag: Active") else: ...
the-stack_106_19285
import nextcord, random, json from nextcord.ext import commands from Functions.Response import embed from Functions.Permission import permissionCheck from Functions.Integration import DiscordInteraction class Voice(commands.Cog): def __init__(self, bot: commands.Bot) -> None: self.bot = bot @nextc...
the-stack_106_19286
#!/usr/bin/python # -*- coding: utf-8 -*- """ PyCOMPSs Testbench ======================== """ # Imports import unittest from pycompss.api.api import compss_wait_on from pycompss.api.task import task class testMultiReturnInstanceMethods(unittest.TestCase): @task(returns=(int, int)) def argTask(self, *args)...
the-stack_106_19290
from Instruments.devGlobalFunctions import devGlobal import numpy as np import struct import wx import math import pyte16 as pyte from wx.lib.pubsub import pub #Simple panel class graphPanel(wx.Panel): def __init__(self, parent, device): wx.Panel.__init__(self,parent) button_sizer = wx.BoxSizer(...
the-stack_106_19292
import unittest import numpy as np from scipy.sparse import csr_matrix from sklearn.cluster import KMeans as SKMeans from sklearn.datasets import make_blobs import dislib as ds from dislib.cluster import KMeans import dislib.data.util.model as utilmodel class KMeansTest(unittest.TestCase): def test_init_params(...
the-stack_106_19295
import sys import streamlit as st import matplotlib.pyplot as plt import numpy as np from dpu_utils.utils import RichPath from data.edits import Edit from dpu_utils.ptutils import BaseComponent ''' # Copy Span Visualization ''' model_path = sys.argv[1] @st.cache def get_model(filename): path = ...
the-stack_106_19296
#!/usr/bin/python3 import argparse import http.client import os import csv import json import dateutil.parser def main(file_path, delimiter, max_rows, elastic_index, json_struct, datetime_field, elastic_type, elastic_address, id_column): endpoint = '/_bulk' if max_rows is None: max_rows_disp = "all" ...
the-stack_106_19297
import numpy as np #Fijamos semilla np.random.seed(666) from tensorflow import set_random_seed set_random_seed(2) from read_data import readData, readEmbeddings, readDataTest from general import prepareData, writeOutput, prepareDataTest from keras.layers import Dense, Dropout, LSTM, Embedding, Bidirectional from kera...
the-stack_106_19299
# 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...
the-stack_106_19300
import os import sys import torch from torch.nn.functional import conv2d import numpy as np sys.path.append(os.path.dirname(os.path.realpath(__file__))) from losses.mmd.approximate_patch_mmd import get_reduction_fn class PatchLoss(torch.nn.Module): def _sum_over_patches(self, diffs): return conv2d(diffs,...
the-stack_106_19303
from __future__ import division import json import os import re import sys from subprocess import Popen, PIPE from math import log, ceil from tempfile import TemporaryFile from warnings import warn from functools import wraps try: import audioop except ImportError: import pyaudioop as audioop if sys.version_...
the-stack_106_19304
from __future__ import absolute_import from __future__ import division from __future__ import print_function import torch.utils.data as data import pycocotools.coco as coco import numpy as np import torch import json import cv2 import os import math from utils.image import flip, color_aug from utils.image import get_...
the-stack_106_19306
# -*- coding: utf-8 -*- import pytest from pyleecan.Classes.SlotW23 import SlotW23 from numpy import ndarray, arcsin, pi from pyleecan.Classes.LamSlot import LamSlot from pyleecan.Classes.Slot import Slot from pyleecan.Methods.Slot.SlotW23 import S23_H1rCheckError # For AlmostEqual DELTA = 1e-4 slotW23_test = list()...
the-stack_106_19307
import enum import functools import inspect import keyword import logging import sys import types import typing from .ParseError import ParseError class Serialization: @classmethod def createClass(cls, name, description): self = cls() slots = [] attributes = {"__slots__": slots, "__an...
the-stack_106_19308
# Copyright 2012-2017 The Meson development 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/LICENSE-2.0 # Unless required by applicable law or agree...
the-stack_106_19309
# -*- coding: utf-8 -*- # Licensed under a 3-clause BSD style license - see LICENSE.rst # Author: Pauli Virtanen, 2016 from __future__ import (absolute_import, division, print_function, unicode_literals) import math import operator from .util import inf, nan, is_na def compute_stats(sample...
the-stack_106_19310
import pip.download from pip.commands.search import (compare_versions, highest_version, transform_hits, SearchCommand) from pip.status_codes import NO_MATCHES_FOUND, SUCCESS from pip.backwardcompat import xmlrpclib, b fro...
the-stack_106_19311
# coding:utf8 ''' Created on 2016年8月3日 @author: zhangq ''' from django.conf.urls import url from Ts_app import views urlpatterns = [ url(r'^$', views.homeview), url(r'^ts_app/$', views.indexview), url(r'^ajax_radio/', views.radioview), url(r'^equipment/$', views.rentview), url(r'^testlink/$', view...
the-stack_106_19312
#!/usr/bin/env python3 import pytablewriter as ptw import pytablereader as ptr # prepare data --- file_path = "sample_data.csv" csv_text = "\n".join([ '"attr_a","attr_b","attr_c"', '1,4,"a"', '2,2.1,"bb"', '3,120.9,"ccc"', ]) with open(file_path, "w") as f: f.write(csv_text) # load from a csv ...
the-stack_106_19313
# Copyright (c) Microsoft Corporation. # Licensed under the MIT License. import mlflow from mlflow.exceptions import MlflowException from mlflow.entities import ViewType import os, logging from pathlib import Path from contextlib import contextmanager from typing import Optional, Text from .exp import MLflowExperimen...
the-stack_106_19315
# MIT License # # Copyright (c) 2018 Evgeny Medvedev, evge.medvedev@gmail.com # # 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 # ...
the-stack_106_19316
""" @author: Ming Ming Zhang, mmzhangist@gmail.com Detections """ import tensorflow as tf import utils def select_top_scoring( anchors, probs, offsets, confidence_threshold=0.05, num_top_scoring=1000, window=[0,0,512,512], batch_size=2, ...
the-stack_106_19317
class Solution: def maxDistToClosest(self, seats: List[int]) -> int: maxDistance = -1 n = len(seats) first1 = seats.index(1) last1 = seats[::-1].index(1) i = first1 + 1 while i < n-last1: if seats[i] == 0: distance = 0 beg_i...
the-stack_106_19320
# # Copyright © 2021 United States Government as represented by the Administrator # of the National Aeronautics and Space Administration. No copyright is claimed # in the United States under Title 17, U.S. Code. All Other Rights Reserved. # # SPDX-License-Identifier: NASA-1.3 # from astropy import units as u import nu...