filename
stringlengths
13
19
text
stringlengths
134
1.04M
the-stack_106_25489
from typing import List, Optional, Iterable from ....head.database import Database as db from ....globals import SURVEY_TYPES from ....head.data_management import DataManager as Dm from ....head.messages import Messages as Msg from ....gui.TopWindow import TopWindow from ....head.objects.survey import Survey class Co...
the-stack_106_25493
# # 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 # ...
the-stack_106_25496
# coding=utf-8 # Copyright 2020 The TensorFlow Datasets Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by appl...
the-stack_106_25498
# 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 ...
the-stack_106_25504
import pytest import torch import torch.nn as nn import random import itertools from hydra.experimental import initialize, compose from train_gata import ( request_infos_for_train, request_infos_for_eval, get_game_files, GATADoubleDQN, TransitionCache, Transition, ReplayBuffer, main, )...
the-stack_106_25506
from splunk_eventgen.lib.plugins.output.httpevent_core import HTTPCoreOutputPlugin from splunk_eventgen.lib.logging_config import logger try: import ujson as json except ImportError: import json class NoServers(Exception): def __init__(self, *args, **kwargs): Exception.__init__(self, *args, **kwa...
the-stack_106_25507
import pathlib from setuptools import setup, find_packages from distutils.core import setup HERE = pathlib.Path(__file__).parent README = (HERE / "README.md").read_text() setup( name='gerrit_coverage', url='https://github.com/tom-010/gerrit_coverage', version='0.0.5', author='Thomas Deniffel', au...
the-stack_106_25508
import re lmps_log_file='log.lammps' lines=None with open(lmps_log_file,'r') as f: lines=f.readlines() line = lines[len(lines)-1].strip() line = re.sub(' +',' ',line) line = [float(s) for s in line.split(" ")] n_data = len(line) step = line[0] max_replica_force = line[1] max_atom_force = line[2] grad_v0 = line[3...
the-stack_106_25509
# 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_25510
""" Simulation to examine the P(reject) as the number of test locations increases. """ __author__ = 'wittawat' import kgof import kgof.data as data import kgof.glo as glo import kgof.density as density import kgof.goftest as gof import kgof.util as util import kgof.kernel as kernel # need independent_jobs package...
the-stack_106_25511
#!/usr/bin/env python import sys import numpy as np from frovedis.exrpc.server import * from frovedis.matrix.dense import FrovedisBlockcyclicMatrix from frovedis.matrix.wrapper import PBLAS # initializing the Frovedis server argvs = sys.argv argc = len(argvs) if (argc < 2): print ('Please give frovedis_server cal...
the-stack_106_25513
import socket import ure def http_get(url): _, _, host, path = url.split('/', 3) print(path) addr = socket.getaddrinfo(host, 80)[0][-1] s = socket.socket() s.connect(addr) s.send(bytes('GET /%s HTTP/1.0\r\nHost: %s\r\n\r\n' % (path, host), 'utf8')) while True: data = s.recv(100) ...
the-stack_106_25514
"""WordOps Swap Creation""" import os import psutil from wo.core.aptget import WOAptGet from wo.core.fileutils import WOFileUtils from wo.core.logging import Log from wo.core.shellexec import WOShellExec class WOSwap(): """Manage Swap""" def __init__(): """Initialize """ pass def add(s...
the-stack_106_25515
''' For test of the trained model ''' import os import time import sys import shutil import random from time import strftime from argparse import ArgumentParser import numpy as np import torch import torch.utils.data import torch.nn.functional as F torch.multiprocessing.set_sharing_strategy('file_system') from PIL...
the-stack_106_25518
# Copyright 2011 OpenStack Foundation. # 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 req...
the-stack_106_25520
import json from typing import Union import numpy as np # Modified from # https://gist.github.com/jannismain/e96666ca4f059c3e5bc28abb711b5c92#file-compactjsonencoder-py # to handle more classes class CompactJSONEncoder(json.JSONEncoder): """A JSON Encoder that puts small containers on single lines.""" CONTAI...
the-stack_106_25522
"""TCP class packets""" import struct import textwrap class TCP(object): """Class representing a tcp packet""" def __init__(self, packet): """pass in the tcp packet to be parsed""" __packet = struct.unpack("!HH2I2H2H", packet[:20]) self.src_port = __packet[0] sel...
the-stack_106_25523
#!/usr/bin/env python # ======================================================================== # 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 l...
the-stack_106_25527
import os import xlrd import random import collections import sys import copy import json from datetime import date import datetime import argparse import numpy as np import time import requests import json import pandas as pd # 🏢 load package first, it's important try: import package.analyzer_system as ana_sys...
the-stack_106_25532
''' Derived SceneviewerWidget capable of editing node coordinate positions and derivatives. ''' from enum import Enum from PySide2 import QtCore from opencmiss.maths.vectorops import add, cross, div, magnitude, mult, sub from opencmiss.utils.zinc.general import ChangeManager from opencmiss.zincwidgets.sceneviewerwidge...
the-stack_106_25534
# -*- coding: utf-8 -*- from app import app from flask import * from app.models.Email import Email from app.models.banco.Usuario import Usuario from app.models.form.login_usuario import LoginForm from app.models.form.cadastro_usuario import CadastroForm from app.models.form.editar_usuario import EditarForm from flask_l...
the-stack_106_25535
# Download the Python helper library from twilio.com/docs/python/install from twilio.rest import Client from datetime import date # Your Account Sid and Auth Token from twilio.com/user/account account_sid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" auth_token = "your_auth_token" client = Client(account_sid, auth_token) # ...
the-stack_106_25536
""" Copyright (c) 2020 Alex Forencich 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, distribute...
the-stack_106_25537
"""Test the Google mixin class.""" import unittest from turnovertools import google from turnovertools import mediaobjects as mobs # pylint: disable=W0212 class TestGoogleMixin(unittest.TestCase): """Create various mobs classes mixed in with Google and confirm that their attributes work properly.""" de...
the-stack_106_25538
from django.conf import settings from django.contrib.admin.views.decorators import staff_member_required import json from django.shortcuts import render, redirect from django.contrib import messages from django.http import HttpResponse, Http404, JsonResponse, HttpResponseRedirect import random from io import StringIO, ...
the-stack_106_25540
# -*- 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...
the-stack_106_25542
''' I used these to work through bugs and identify data's format ''' def is_symmetric_sparse_arr(arr): ''' arr is the coord array of the sparse array tuple ''' for row in arr: a,b = row[0], row[1] if not [b,a] in arr: return False else: return True def has_diago...
the-stack_106_25544
import argparse import os from os.path import join import pandas as pd import yaml from constants import h5_internal_paths from constants.dataset_tables import ModelsTableHeader, DatasetTableHeader from file_actions.writers.h5 import \ assemble_tomo_from_subtomos from networks.utils import build_prediction_output...
the-stack_106_25545
# -*- coding: utf-8 -*- ''' The static grains, these are the core, or built in grains. When grains are loaded they are not loaded in the same way that modules are loaded, grain functions are detected and executed, the functions MUST return a dict which will be applied to the main grains dict. This module will always b...
the-stack_106_25546
import uuid from common.logger import get_logger from payments.domain.order import Order from payments.domain.payment import Payment from payments.domain.paypal_payment import PaypalPayment logger = get_logger(__name__) class OrderFactory: @staticmethod def create_order_from_repository_order(order): ...
the-stack_106_25548
import struct import numpy as np def _read_big_endian_int(s): return struct.unpack(">l", s[:4])[0] def _vector_convert(n): # convert n to a 10-dimensional array a with only a[n] = 1.0 a = np.zeros((10, 1)) a[n] = 1.0 return a def load(image_path, label_path): """Returns a tuple (data) of tuples (image, label),...
the-stack_106_25551
# -*- encoding: utf-8 -*- # Author: hushukai import tensorflow as tf from tensorflow.keras import layers from tensorflow.keras import backend as K from .utils import pad_to_fixed_size_tf, remove_pad_tf def nms(split_positions, scores, score_thresh=0.7, distance_thresh=16, max_outputs=50): """Non-Maximum-Suppres...
the-stack_106_25552
"""Boyuan 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-based ...
the-stack_106_25553
try: import aiohttp.web except ImportError: print("The dashboard requires aiohttp to run.") import sys sys.exit(1) import argparse import copy import datetime import errno import json import logging import os import platform import threading import time import traceback import yaml import uuid import g...
the-stack_106_25555
import pygame.font class Button(): def __init__(self, ai_settings, screen, msg): self.screen = screen self.screen_rect = screen.get_rect() self.width, self.height = 200, 50 self.button_color = (0, 255, 0) self.text_color = (0, 0, 0) self.font = pygame.font.Sys...
the-stack_106_25556
import asyncio import dataclasses import json import logging import sys from enum import Enum from typing import Any, Dict, List, Optional, Set, Union, AsyncGenerator from galaxy.api.consts import Feature, OSCompatibility from galaxy.api.jsonrpc import ApplicationError, Connection from galaxy.api.types import ( Ac...
the-stack_106_25558
#!/usr/bin/env python # # @author Jorge Santos # License: 3-Clause BSD import actionlib import copy import rospy import nav_msgs.srv as nav_srvs import mbf_msgs.msg as mbf_msgs import move_base_msgs.msg as mb_msgs from dynamic_reconfigure.client import Client from dynamic_reconfigure.server import Server from geometr...
the-stack_106_25559
"""Write the output to a CSV file.""" from collections import defaultdict import pandas as pd from ..pylib import util def csv_writer(args, rows): """Output the data.""" rows = sorted(rows, key=lambda r: (r["flora_id"], r["family"], r["taxon"])) for row in rows: row["raw_traits"] = [e._.data fo...
the-stack_106_25561
""" Support to interact with a Music Player Daemon. For more details about this platform, please refer to the documentation at https://home-assistant.io/components/media_player.mpd/ """ from datetime import timedelta import logging import os import voluptuous as vol from homeassistant.components.media_player import ...
the-stack_106_25563
import copy from django.conf.urls import url, include from django.shortcuts import HttpResponse, render, redirect from django.urls import reverse from supermatt.utils.pager import PageInfo from supermatt.utils.filter_code import FilterList class BaseSupermatt(object): ''' 该类可以把所有数据都拿到 ''' list_disp...
the-stack_106_25565
# -*- coding: utf-8 -*- """ Created on Fri May 10 03:44:30 2019 @author: Shani """ import os, sys from PIL import Image # open an image file (.bmp,.jpg,.png,.gif) you have in the working folder imageFile = '3599.jpeg' im1 = Image.open(imageFile) # adjust width and height to your needs width = 50 height = 50 # use on...
the-stack_106_25566
import json import os import re import shutil from argparse import ArgumentParser import cv2 from circuit_recognizer.annotations import Annotation from circuit_recognizer.utils import get_annotation_source_image, get_image_path def get_source_dims(anno): image = get_annotation_source_image(anno) return imag...
the-stack_106_25568
#!/usr/bin/env python3 # Copyright 2018 The Chromium OS Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. """Common libdot util code.""" import argparse import base64 import hashlib import importlib.machinery import io import logging im...
the-stack_106_25570
import asyncio import itertools import logging import threading # pylint: disable=invalid-name # pylint: disable=global-statement try: # Python 3.8 or newer has a suitable process watcher asyncio.ThreadedChildWatcher except AttributeError: # backport the Python 3.8 threaded child watcher im...
the-stack_106_25572
# coding: utf-8 """ InfluxDB OSS API Service. The InfluxDB v2 API provides a programmatic interface for all interactions with InfluxDB. Access the InfluxDB API using the `/api/v2/` endpoint. # noqa: E501 OpenAPI spec version: 2.0.0 Generated by: https://openapi-generator.tech """ import pprint import re # noqa:...
the-stack_106_25577
#!/Users/apple/Desktop/ForestMIR/venv/bin/python3.9 '''Convert a jams file into one or more lab files.''' import argparse import collections import sys import os import json import pandas as pd import jams def get_output_name(output_prefix, namespace, index): '''Get the output name (prefix) Parameters ...
the-stack_106_25578
""" Incremental update pdf file New in version 2 - attach multi-object to end of the pdf file. base on 'portion_of_rewrite_objects' in config.py """ __version__ = '0.2' __author__ = 'Morteza' from config import iu_config import sys import PyPDF2 import pdf_object_preprocess as poc import random import datetime impor...
the-stack_106_25579
from __future__ import print_function import argparse import torch import torch.nn as nn import torch.nn.functional as F import torch.optim as optim from torchvision import datasets, transforms from torch.optim.lr_scheduler import StepLR class Net(nn.Module): def __init__(self): super(Net, self).__init__(...
the-stack_106_25581
#!/usr/bin/env python import numpy as np #import sys #import warnings # #if not sys.warnoptions: # warnings.simplefilter("ignore") __all__ = ["Orbit"] class Orbit: def __init__(self, roa=None, ror=None, i_pl=None, aor=None): if roa is not None and aor is None: self.roa = roa s...
the-stack_106_25584
from __future__ import absolute_import import abc from copy import deepcopy import time from enum import Enum import six from simpleflow.base import Submittable from simpleflow.history import History from . import futures from .activity import Activity if False: from typing import Optional, Any, Dict, Union, ...
the-stack_106_25585
# Copyright 2020 The FastEstimator 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 appl...
the-stack_106_25586
# This file helps to compute a version number in source trees obtained from # git-archive tarball (such as those provided by githubs download-from-tag # feature). Distribution tarballs (built by setup.py sdist) and build # directories (produced by setup.py build) will contain a much shorter file # that just contains t...
the-stack_106_25587
# Copyright (c) 2009-2010 Six Apart Ltd. # 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 conditions an...
the-stack_106_25588
# -*- coding: utf-8 -*- from __future__ import print_function from __future__ import absolute_import import os import re import traceback from zulint.printer import print_err, colors from typing import cast, Any, Callable, Dict, List, Optional, Tuple, Iterable Rule = Dict[str, Any] RuleList = List[Dict[str, Any]] ...
the-stack_106_25590
################################################################################################## # # TracSynth.py - GW quality trace element analysis & Monte Carlo modeling setup # # (1) clean up (account for non-detects, etc.) # (2) limit to useful analytes (e.g., sufficient detections) # (3) compute and list ...
the-stack_106_25592
"""Support for MQTT discovery.""" from __future__ import annotations import asyncio from collections import deque import functools import json import logging import re import time from homeassistant.const import CONF_DEVICE, CONF_PLATFORM from homeassistant.core import HomeAssistant from homeassistant.data_entry_flow...
the-stack_106_25594
import requests import json import time import random import sys import getopt # 一些默认的参数 sckey = "" # 用于 servre酱 消息推送,若不需要,无需修改保持现状 prefix = "御坂" suffix = "号" zfill_n = 0 chk_range = "1,20001" # 闭区间 filename_out = "lists.txt" # 以下一般无需修改 url = "https://passport.bilibili.com/web/generic/check/nickname" hea = { "Ac...
the-stack_106_25595
import atexit from Adafruit_MotorHAT import Adafruit_MotorHAT class Motor(object): """Used to update speed of the Jetbot motors. Args: driver: An `Adafruit_MotorHAT` instance used to control the motor. channel: Motor channel. Left is channel 1 and right is channel 2. alpha: Motor ...
the-stack_106_25596
from django.db import models from .behaviors.models import Timestampable, Taggable, Versionable from django.utils.translation import ugettext_lazy as _ # Create your models here. class PopoloDateTimeField(models.DateTimeField): """Converting datetime to popolo.""" def get_popolo_value(self, value): ret...
the-stack_106_25597
from argparse import ArgumentParser from functools import wraps import os import numpy as np import pandas as pd if __name__ == "__main__": __register = list() parser = ArgumentParser() parser.add_argument("folder", type=str, help="Where to save the data") parser.add_argument("--delimiter", type=str...
the-stack_106_25598
# coding=utf-8 # Licensed Materials - Property of IBM # Copyright IBM Corp. 2017,2018 import inspect import logging import os import pkg_resources import sys import streamsx from pkgutil import extend_path _TRACE = logging.getLogger('streamsx.runtime') def _add_to_sys_path(dir_): if _TRACE.isEnabledFor(logging.D...
the-stack_106_25599
#!/usr/bin/env python # Copyright (c) 2014 Wladimir J. van der Laan # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. ''' Run this script from the root of the repository to update all translations from transifex. It will do the follo...
the-stack_106_25600
#! /usr/bin/env python # encoding: utf-8 import os import TaskGen,Task,Utils from TaskGen import taskgen,before,extension nasm_str='${NASM} ${NASM_FLAGS} ${NASM_INCLUDES} ${SRC} -o ${TGT}' EXT_NASM=['.s','.S','.asm','.ASM','.spp','.SPP'] def apply_nasm_vars(self): if hasattr(self,'nasm_flags'): for flag in self.to_...
the-stack_106_25602
import functools import logging import torch import math import numpy as np logger = logging.getLogger(__name__) def get_device_of(tensor): """This function returns the device of the tensor refer to https://github.com/allenai/allennlp/blob/master/allennlp/nn/util.py Arguments: tensor {tensor} -...
the-stack_106_25603
import logging from typing import List, Optional, TextIO import numpy as np import numpy.typing as npt from ..cli import run_with_file_argument from ..io_utils import get_lines logger = logging.getLogger(__name__) def read_input(input: TextIO) -> npt.NDArray[int]: return np.array([list(map(int, line)) for line...
the-stack_106_25604
""" Legalese -------- Copyright (c) 2015, 2016 Genome Research Ltd. Author: Colin Nolan <cn13@sanger.ac.uk> This file is part of HGI's common Python library This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Softwa...
the-stack_106_25607
from twython import Twython import json import html import os import re from auth_keys import * from datetime import datetime, timedelta from pytz import timezone MONTHS = [ "Jan", "Feb", "Mar", "Apr", "May", "June", "July", "Aug", "Sept", "Oct", "Nov", "Dec" ] EMOJI_RE...
the-stack_106_25609
# -*- coding: utf-8 -*- """ Created on Sun Jan 20 21:07:28 2019 @author: Chadwick Boulay @author: Anahita Malvea This must be run from the ../.. directory (parent/parent) """ import csv from pathlib import Path from data.utils import download_from_web if __name__ == "__main__": working_dir = Path.cwd() / 'data' ...
the-stack_106_25612
#### REST FRAMEWORK ##### from rest_framework import status from rest_framework import generics from rest_framework import permissions from rest_framework.response import Response ##### SERIALIZERS ##### from users.serializers import BuyerOrderSerializer from users.serializers import SellerProfileSeria...
the-stack_106_25613
#!/usr/bin/env python3 # -*- config: utf-8 -*- from tkinter import * def add(): a = Toplevel() a.geometry('120x130') a.resizable(0, 0) Label(a, text="x1").grid(row=0, column=0) ent1 = Entry(a, width=5) ent1.grid(row=0, column=1) Label(a, text="x2").grid(row=1, column=0) ...
the-stack_106_25614
# Electrum - lightweight Bitcoin client # Copyright (C) 2011 Thomas Voegtlin # # 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 t...
the-stack_106_25615
""" Blur image using GaussianBlur operator ====================================== """ import torch import kornia import cv2 import numpy as np import matplotlib.pyplot as plt # read the image with OpenCV img: np.array = cv2.imread('./data/lena.jpg') img = cv2.cvtColor(img, cv2.COLOR_BGR2RGB) # convert to torch te...
the-stack_106_25617
import logging from typing import ( Any, Awaitable, Callable, Dict, List, Optional, Union, Tuple, ) from opentrons.calibration_storage import get, modify, helpers, delete from opentrons.calibration_storage.types import ( TipLengthCalNotFound, PipetteOffsetByPipetteMount, ) from ...
the-stack_106_25618
""" Copyright (C) 2005-2015 Splunk Inc. All Rights Reserved. log utility for TA """ import logging import logging.handlers as handlers import os.path as op from tab_splunktalib.splunk_platform import make_splunkhome_path import tab_splunktalib.common.util as cutil from tab_splunktalib.common.pattern import singleton...
the-stack_106_25619
import os, sys, math, gc, time import numpy as np from sklearn.model_selection import train_test_split import tensorflow as tf import tensorflow.keras as keras from tensorflow.keras import Sequential from tensorflow.keras.layers import Dense, Dropout, ReLU BASE_PATH = os.path.dirname(os.path.realpath(__file__)) MODUL...
the-stack_106_25620
# Copyright 2014 Datera # 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 applic...
the-stack_106_25621
import os class DictParseError(Exception): pass def open_dict(dict_file): dict_data = [] with open(dict_file, 'r') as df: for line in df: dict_data.append(line) return dict_data def parse_dict(data): temp_dict = {} for line in data: d1 = line.split(':',...
the-stack_106_25625
import os import platform def get_data_dir() -> str: system = platform.system() if system == "Windows": return os.getenv('APPDATA') + "/scbw" else: return os.path.expanduser("~") + "/.scbw" VERSION = "1.0.4" SCBW_BASE_DIR = get_data_dir() SC_GAME_DIR = f"{SCBW_BASE_DIR}/games" SC_BWAPI_...
the-stack_106_25626
# Copyright (c) 2020, Xilinx # 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 conditions and the follow...
the-stack_106_25627
import math, os, time from math import ceil, floor import xtils # CIFA10 -------------------- # batch_nums = math.ceil(data_info['train_size']/bsize_train) train_size = 50000 batch_size = 128 batch_size_val = 64 batch_nums = math.ceil(train_size / batch_size) BN = batch_nums # =>> Unit #5005 cfgar = { # expe...
the-stack_106_25628
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # @Date : 2019-11-25 23:58:55 # @Author : Racter Liu (racterub) (racterub@gmail.com) # @Link : https://racterub.io # @License : MIT import csv f = open("./Dengue_Daily_EN.csv") rows = csv.DictReader(f) #1 scope = ["Taipei City", "New Taipei City"] for row in rows...
the-stack_106_25631
"""Download handlers for http and https schemes""" from time import time from cStringIO import StringIO from urlparse import urldefrag from zope.interface import implements from twisted.internet import defer, reactor, protocol from twisted.web.http_headers import Headers as TxHeaders from twisted.web.iweb import IBod...
the-stack_106_25633
import os import time import yaml import math import numpy as np import matplotlib matplotlib.use('Agg', warn=False) from matplotlib.backends.backend_agg import FigureCanvasAgg import matplotlib.pyplot as plt from matplotlib.ticker import FuncFormatter from datetime import datetime, timedelta from argparse import Argu...
the-stack_106_25634
from story.utils import * import warnings warnings.filterwarnings("ignore") import os import tensorflow as tf tf.compat.v1.logging.set_verbosity(tf.compat.v1.logging.ERROR) from generator.gpt2.src import sample, encoder, model import json class GPT2Generator: def __init__(self, generate_num=120, temperature=0....
the-stack_106_25635
import torch from torch.autograd import gradcheck from nitorch.spatial import grid_grad, grid_pull, grid_push, grid_count from nitorch.spatial import identity_grid, BoundType, InterpolationType import pytest # global parameters dtype = torch.double # data type (double advised to check gradients) shape1 = 3 ...
the-stack_106_25637
# 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 2.3.33.0 # ...
the-stack_106_25640
# Copyright 2014 Red Hat, 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 a...
the-stack_106_25641
#using pil libraries and pandas from PIL import Image from PIL import ImageFont from PIL import ImageDraw import pandas as pd #by using excel x1 = pd.ExcelFile('list2.xlsx') df = x1.parse('Sheet1') #by using csv df = pd.read_csv("list2.csv") for index, row in df.iterrows(): #for loop for making 'n' ...
the-stack_106_25642
import xml.etree.ElementTree as ET from os import getcwd sets=['train','val','test'] classes = ["trunk"] def convert_annotation(image_id, list_file): in_file = open('data/VOC/Annotations/%s.xml'%(image_id)) tree=ET.parse(in_file) root = tree.getroot() for obj in root.iter('object'): difficu...
the-stack_106_25643
# # Copyright 2016 The BigDL 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 ...
the-stack_106_25644
# 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 # distributed under the Li...
the-stack_106_25645
import sys import re from subprocess import call import numpy as np import matplotlib.pyplot as plt import matplotlib.lines as lines import matplotlib.transforms as mtransforms import matplotlib.text as mtext import matplotlib.patches as patches from matplotlib.patches import Polygon # Utility class to implement enu...
the-stack_106_25647
#!/usr/bin/python # -*- coding: utf-8 -*- # (c) 2017, Ansible by Red Hat, inc # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) from __future__ import absolute_import, division, print_function __metaclass__ = type ANSIBLE_METADATA = {'metadata_version': '1.1', ...
the-stack_106_25648
#!/usr/bin/env python # # Public Domain 2014-2018 MongoDB, Inc. # Public Domain 2008-2014 WiredTiger, Inc. # # This is free and unencumbered software released into the public domain. # # Anyone is free to copy, modify, publish, use, compile, sell, or # distribute this software, either in source code form or as a compil...
the-stack_106_25655
# -*- coding:utf-8 -*- import sys sys.path.append("../moebot") def test(): """Run the unit tests.""" import unittest tests = unittest.TestLoader().discover('tests') unittest.TextTestRunner(verbosity=2).run(tests) if __name__ == '__main__': test()
the-stack_106_25656
# var = 1 # while var == 1: # num = int(input("输入一个数字 :")) # print("你输入的数字是: ", num) # print("Good bye!") # class MyNumbers: # def __iter__(self): # self.a = 1 # return self # def __next__(self): # x = self.a # self.a += 1 # return x # myClass = MyNumbers()...
the-stack_106_25657
# Copyright 2018 Amazon.com, Inc. or its affiliates. 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. # A copy of the License is located at # # http://www.apache.org/licenses/LICENSE-2.0 # # or in ...
the-stack_106_25659
# -*- coding: utf-8 -*- ''' Pillar data from vCenter or an ESXi host .. versionadded:: 2017.7.0 :depends: - pyVmomi This external pillar can pull attributes from objects in vCenter or an ESXi host and provide those attributes as pillar data to minions. This can allow for pillar based targeting of minions on ESXi ho...
the-stack_106_25660
from copy import deepcopy from easydict import EasyDict space_invaders_impala_config = dict( exp_name='space_invaders_impala_seed0', env=dict( collector_env_num=8, evaluator_env_num=4, n_evaluator_episode=8, stop_value=10000000000, env_id='SpaceInvadersNoFrameskip-v4', ...
the-stack_106_25662
import tempfile from os import path from django.test import TestCase from django.contrib.auth import get_user_model from django.urls import reverse from rest_framework import status from rest_framework.test import APIClient from PIL import Image from core.models import Recipe, Tag, Ingredient from recipe.serializers ...