content stringlengths 5 1.05M |
|---|
# -*- coding: utf-8 -*-
# ---
# jupyter:
# kernelspec:
# display_name: Python 3
# name: python3
# ---
# %% [markdown]
# # 📝 Exercise M1.04
#
# The goal of this exercise is to evaluate the impact of using an arbitrary
# integer encoding for categorical variables along with a linear
# classification model suc... |
from pprint import pprint, pformat
from ast import literal_eval
class DTSaveLoad():
def __init__(self):
#self.path = bge.logic.expandPath("//dts/")
self.path = "dts/"
self.data_type = ".dtsl"
def Save(self , name_data_save , dict_datas):
self.datas =... |
import time
import json
import os
import os.path
try:
import _pickle as cPickle
except:
import cPickle
from backtester.logger import *
from backtester.instruments_manager import InstrumentManager
from datetime import datetime
from backtester.state_writer import StateWriter
from backtester.process_result import ... |
# -*- coding: utf-8 -*-
import parameters
class Model:
""" Classe principal du jeu
- plateau : int[][]
- 0 -> case vide
- 1 -> pion j1
- 2 -> pion j2
- pose : int -> nombre de pions a posé encore
- tour : int --> numéro du joueur
- pion : int[2] contient les coordonnées du ... |
import frappe
from frappe.model import no_value_fields
import json
@frappe.whitelist()
def get_preview_data(doctype, docname):
preview_fields = []
meta = frappe.get_meta(doctype)
if not meta.show_preview_popup: return
preview_fields = [field.fieldname for field in meta.fields \
if field.in_preview and field.fie... |
import gzip
import json
import random
import sys
import re
import pandas as pd
def process(inf):
def normalizeString(s):
s = s.lower().strip()
s = re.sub(r"([.!?])", r" \1", s)
s = re.sub(r"[^a-zA-Z.!?]+", r" ", s)
return s
datas = []
g = gzip.open(inf, "r")
for l in... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sat Nov 2 08:05:59 2019
@author: lx
"""
class Card:
suits = ["Clubs", "Diamonds", "Hearts", "Spades"]
ranks = ["narf", "Ace", "2", "3", "4", "5", "6", "7",
"8", "9", "10", "Jack", "Queen", "King"]
def __init__(self, suit=0, rank... |
import sys
import signal
import asyncio
import cno
async def respond(req):
print('>>> \033[1;35m{}\033[0m {}'.format(req.method, req.path))
for k, v in req.headers:
print(' \033[1;34m{}\033[0m: {}'.format(k, v))
payload = len(await req.payload.read())
print(' \033[1;36mpayload\033[0m: ... |
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.autograd import Variable
from Model.CNN_1 import CNN
def test_performance(model, device, test_loader, loss, pred_train_labels, train_labels, printHistory=True):
test_num_right = 0
for step, (datas, labels) in enumerate(test_loader):... |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.2 on 2017-08-05 15:51
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('nomi', '0124_auto_20170805_1539'),
]
operations = [
migrations.AlterField(
... |
"""
The model is adapted from the tensorflow tutorial:
https://www.tensorflow.org/get_started/mnist/pros
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import tensorflow as tf
class Model(object):
def __init__(self):
self.x_input = tf.placeholder... |
class Solution:
def __init__(self):
self.res = 0
def longestConsecutive(self, root: TreeNode) -> int:
self._dfs(root)
return self.res
def _dfs(self, root):
if not root:
return 0
lseq = self._dfs(root.left)
rseq = self._dfs(root.right... |
import glob
from itertools import product
import os
import openmc
import openmc.lib
import numpy as np
import pytest
from tests.testing_harness import PyAPITestHarness
pytestmark = pytest.mark.skipif(
not openmc.lib._dagmc_enabled(),
reason="Mesh library is not enabled.")
TETS_PER_VOXEL = 12
class Unstruc... |
#-------------------------------------------------------------------------------
# Name: PS090_bounding_box_to_coordinate_system.py
# Purpose: Rotates model bounding box in accordance of coordiante system
# for the active chunk, bounding box size is kept. The orig.
# ver... |
from __future__ import absolute_import
from __future__ import unicode_literals
from lxml import etree
from django.urls import reverse
from django.http import HttpResponse
from corehq.apps.app_manager.dbaccessors import get_app
from corehq.apps.app_manager.decorators import require_deploy_apps
from corehq.apps.app_man... |
"""Dot that."""
from sqlalchemy import Column, Integer, String
from sqlalchemy.ext.declarative import declarative_base
Base = declarative_base()
class Book(Base):
"""Handle the book entity."""
__tablename__ = 'BOOK'
book_id = Column(Integer, primary_key=True, autoincrement=True)
title = Column(Str... |
class Char:
EOF = None
DIGIT = 1
LOWER = 2
UPPER = 3
SYMBOL = 4
SPACE = 5
NEWLINE = 6
OTHER = 7
def __init__(self, value, type, line=-1, column=-1):
self.value = value
self.type = type
self.line = line
self.column = column
def __repr__(self):
... |
class Config:
"""Contains all the configuration keys and credentials."""
GOOGLE_DRIVE_CREDENTIALS = 'config/lgcontrol-xxxxx.json'
|
# Python solution for 'Friend or Foe?' codewars question.
# Level: 7 kyu
# Tags: FUNDAMENTALS
# Author: Jack Brokenshire
# Date: 12/04/2020
import unittest
def friend(x):
"""
If a name has exactly 4 letters in it, you can be sure that it has to be a friend of yours! Otherwise, you can
be sure he's not...... |
#!/home/sy/.virtualenvs/binks/bin/python
"""
Author: Sy<somarl@live.com>
LICENSE: MIT License Copyright (c) 2018 Sy
For personal use actually. Place it here to illustrate how to customize
the local.py for specific sites.
"""
import getpass
import json
import os
import socket
import sys
from datetime import datetime... |
"""
Copyright 2019 Rahul Gupta, Aditya Kanade, Shirish Shevade.
Indian Institute of Science.
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 r... |
import os
import json
from PIL import Image
import pandas as pd
import torch
from torch.utils.data import Dataset
class MyDataSet(Dataset):
"""自定义数据集"""
def __init__(self,
root_dir: str,
csv_name: str,
json_path: str,
transform=None):
... |
# -*- coding: utf-8 -*-
# ------------------------------------------------------------------------------
#
# Copyright 2018-2019 Fetch.AI Limited
#
# 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 ... |
import yaml
from .slots_object_model import SlotsObjectModel
from .common import Undefined, Field
import importlib
import sys
PY3 = sys.version_info >= (3, 0)
if PY3:
unicode = str
# types from the open api specification (see details: https://swagger.io/docs/specification/data-models/data-types/)
TYPES = {
... |
import json
import os
class ConfigManager():
"""Reads the config.pyl and provides an interface for the other classes"""
# Two main resposiblilities
# giving other classes an interface
# translating the settings-popup to a dictionary to dump into json
# the settings are only accessed through the c... |
import os
import tempfile
import unittest
import unittest.mock as mock
from opsdroid.helper import del_rw, move_config_to_appdir
class TestHelper(unittest.TestCase):
"""Test the opsdroid helper classes."""
def test_del_rw(self):
with mock.patch('os.chmod') as mock_chmod,\
mock.patch... |
# coding: utf-8
from . import custodian
from flask import jsonify
|
from itertools import combinations_with_replacement as combs
s, k = input().split()
print(*[''.join(p) for p in combs(sorted(s), int(k))], sep='\n')
|
"""
idseq-dedup outputs a cluster file in the form of a csv
The first column contains the representative read id of
a cluster, and the second column contains the read id.
"""
from csv import DictReader
from typing import Dict, Optional, List
def parse_clusters_file(
idseq_dedup_clusters_path: str,
) -> Dict[str, ... |
USAGE="""
input: a minimum spanning tree (sorted descendingly by score)
token1 token2
output: a sorted list of tokens given a hierarchical clustering tree
-s, --leaf_selection: if an incomplete tree is given, clusters are output
-w, --min_weight: discard edges below this minimum weight
-m, --max_we... |
import os
import json
import zipfile
import jsonschema
from tqdm import tqdm
from urllib.request import urlretrieve
image_schema = {
"type": "object",
"properties": {
"file_name": {
"type": "string"
},
"id": {
"type": "integer"
}
},
"requi... |
#!/usr/bin/env python2
# --------------------------------------------------------------------------------------------------
# Tokyo Westerns CTF 2019 - M Poly Cipher (RE 279pt)
# --------------------------------------------------------------------------------------------------
import struct
import sys
# Public Key A:... |
from . import parse
from . import converter
from .consts import CCML_DICTIONARY
|
def insert_sort(data):
for i in range(len(data)):
buf = data[i]
j = i - 1
while (j >= 0) and (data[j] > buf):
data[j + 1] = data[j]
j -= 1
data[j + 1] = buf
return data
if __name__ == '__main__':
data = [1, 4, 0, 6, 7]
print(insert_sort(data))
|
"""Search a file by its name.
Calling this module directly will start an interactive search session, the
json file is read once and subsequent seaches can be made without reloading."""
import re
import os
import argparse
from folder_structure_navigator import JsonTraverser
def path_format(hierarchy, file):
"""... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
利用pymysql模块管理mysql的连接和CURD基础使用
author: gxcuizy
date: 2018-10-24
"""
import pymysql
def show_version():
"""基础使用,查看mysql版本"""
# 创建一个连接
db = pymysql.connect(db_host, db_user, db_pw, db_name)
# 用cursor()创建一个游标对象
cursor = db.cursor()
# 使用execute()... |
#!/usr/bin/env python3
import utils as u
import numpy as np
poisson = np.random.poisson
e=5
att=1/3
h=1-att
max_block=20
def grindWithHS():
numSims = 100000
blocksNoGrind=[]
blocksGrind=[]
biggerThanExp=0
HSBlocksLost=[]
failedAttempts=0
noAttackBlocks=[]
for i in range(numSims):
... |
import collections
import socket
import mock
import pytest
from cvm.context import CVMContext
@pytest.fixture
def context(config):
return CVMContext(config)
@pytest.fixture
def config():
return {
"esxi": {},
"vcenter": {},
"vnc": {},
"sandesh": {
"collectors": "... |
class FootballProbabilityGrid(list):
def __init__(self, goal_matrix, home_goal_expectation, away_goal_expectation):
list.__init__(self, goal_matrix)
self.home_goal_expectation = home_goal_expectation
self.away_goal_expectation = away_goal_expectation
def __repr__(self):
repr_str... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Last modified: Wang Tai (i@wangtai.me)
"""docstring
"""
__revision__ = '0.1'
import time
from django.http import HttpResponse
from annotations import to_url, get, strlist
from utils import time_table_data_source
from utils import ical_data_bridge
@to_url("^$")
def ... |
import os
from typing import Tuple, Iterable
from threading import Thread, Event, Lock
__all__ = ['safe_thread_count', 'blocking_tee', 'background']
def safe_thread_count(pct=0.8):
# TODO: maybe a smarter way of doing this?
return int(os.cpu_count() * pct)
def blocking_tee(it: Iterable, n: int) -> Tuple[T... |
''' translator module
denine functions to translate text from english to french and from french to english
returns the translated text
'''
import json
import os
from ibm_watson import LanguageTranslatorV3
from ibm_cloud_sdk_core.authenticators import IAMAuthenticator
from dotenv import load_dotenv
load_do... |
"""
単変量特徴選択
個々の特徴量とターゲットとの間に統計的に顕著な関係がるかどうかを計算する。
最も高い確信度で関連している特徴量が選択される。
この方法は、計算が高速でモデルを構築する必要がないが、
個々の特徴量を個別に考慮するために他の特徴量と組み合わさって意味のある特徴量は捨てられる。
特徴選択後に使われるモデルとは完全に独立である。
selectPercentile:全部の特徴量に対する上位の割合を指定
selectKBest:使用される上位の特徴量
"""
import matplotlib.pyplot as plt
import seaborn as sns
sns.set_styl... |
# Source: https://github.com/Screetsec/Sudomy/issues/28
#
# This fetches the data displayed on the Google Safe Browsing Transparency Report and outputs it as a CSV
# that can be imported into a Kaggle dataset.
# The original visualization can be found here: https://transparencyreport.google.com/safe-browsing/overview
... |
from ibis.expr.types.analytic import * # noqa: F401,F403
from ibis.expr.types.arrays import * # noqa: F401,F403
from ibis.expr.types.binary import * # noqa: F401,F403
from ibis.expr.types.category import * # noqa: F401,F403
from ibis.expr.types.collections import * # noqa: F401,F403
from ibis.expr.types.core impor... |
# -*- coding: utf-8 -*-
from __future__ import print_function
import caffe
from google.protobuf import text_format
import filecmp
import math
import os
import shutil
import stat
import subprocess
import sys
import time
import shutil
import difflib
import json
sys.path.append('../')
from username import USERNAME
sys.do... |
from __future__ import unicode_literals
from django.db import models
from wagtail.wagtailcore.models import Page
|
START_MESSAGE = ('Добро пожаловать на игру "Что? Где? Когда?"!' +
'\nДля начало ознакомьтесь с /help.')
HELP_MESSAGE = ('Список основных команд'+
'\nкак лучше начинать игру'+
'\n/loadbase для начала загрузите базу вопросов,'+
'\n/registeringteams регист... |
#!/usr/bin/env python3
"""
Python interface for analysis. You need to provide an ElasticSearch instance with the data.
All the data crunching is done in the ElasticSearch.
"""
import os, sys, json, argparse, copy, urllib.parse, itertools
import dateutil.parser
import matplotlib
# We need to activate the back... |
#!/bin/python
ACCEPTABLE = 864000
msgid = 'intersphinx'
import sys
import os
import time
import subprocess
def interface():
try:
f = sys.argv[1]
except IndexError:
exit('[%s]: the first argument to must be an existing file.' % (msgid, sys.argv[0]))
try:
s = sys.argv[2]
ex... |
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import warnings
warnings.filterwarnings("ignore")
import yfinance as yf
yf.pdr_override()
import datetime as dt
# input
symbol = 'AAPL'
start = dt.date.today() - dt.timedelta(days = 365*4)
end = dt.date.today()
# Read data
df = yf.download(symbol... |
# -*- coding: utf-8 -*-
import sys
import json
import shlex
import select
import threading
import contextlib
import subprocess
from try_leela import names
def close_(fd):
try:
fd.close()
except:
pass
class Session(object):
def __init__(self, exe, tree):
self.exe = exe
s... |
# Copyright 2016 Canonical Limited.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writi... |
# coding: utf-8
# python setup.py sdist register upload
from setuptools import setup, find_packages
def get_requires():
with open('requirements.txt') as requirements_file:
return requirements_file.readlines()
setup(
name='grammar_text',
version='0.0.4',
description='Text with grammar.',
a... |
import sqlite3
from flask import Flask, render_template,request
from model import Transformer
#from sqlmodel import create_table, data_entry,close ,conn,
import sqlmodel
app = Flask(__name__)
users = [
#first exemple
{
'name' : 'akif',
'surname' : 'capoglu',
"sentence... |
#!/usr/bin/env python
# Copyright (C) 2014 Canonical
# All Rights Reserved
# Author: Jacek Nykis <jacek.nykis@canonical.com>
import re
import argparse
import subprocess
import nagios_plugin
def check_ceph_status(args):
if args.status_file:
nagios_plugin.check_file_freshness(args.status_file, 3600)
... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import cPickle as pickle
import shutil
import os
import json
import sys
class PersistentDict(dict):
def __init__(self, filename, *args, **kwargs):
self.filename = filename
dict.__init__(self, *args, **kwargs)
def save(self):
tmpfile = self... |
import pywikibot, re, os
#os.chdir(r'projects/treisijs')
site = pywikibot.Site("wikidata", "wikidata")
site.login()
lvwiki = pywikibot.Site("lv", "wikipedia")
null = ''
def chunker(seq, size):
return (seq[pos:pos + size] for pos in range(0, len(seq), size))
def getdata():
lvpage = pywikibot.Page(lvwiki,"Vikipēdi... |
# vim:ts=4:sts=4:sw=4:expandtab
from kolejka.judge import config
from kolejka.judge.commands.base import *
from kolejka.judge.paths import *
from kolejka.judge.typing import *
from kolejka.judge.validators import *
__all__ = [ 'MakeCommand', 'CMakeCommand', ]
def __dir__():
return __all__
class MakeCommand(Pr... |
import unittest
import torch
import torchvision.transforms.functional as tvf
from meddlr.transforms.base.spatial import (
AffineTransform,
FlipTransform,
Rot90Transform,
TranslationTransform,
)
class TestAffineTransform(unittest.TestCase):
def test_func(self):
angle, translate, scale = 1... |
"""
Copyright (c) 2022 Huawei Technologies Co.,Ltd.
openGauss is licensed under Mulan PSL v2.
You can use this software according to the terms and conditions of the Mulan PSL v2.
You may obtain a copy of Mulan PSL v2 at:
http://license.coscl.org.cn/MulanPSL2
THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, W... |
# Copyright 2011, VMware, Inc., 2014 A10 Networks
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# ... |
# Copyright (C) 2020-2021 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
"""Python native tests."""
import numpy as np
import openfl.native as fx
def one_hot(labels, classes):
"""
One Hot encode a vector.
Args:
labels (list): List of labels to onehot encode
classes (int): Tot... |
from builtins import object
import os
import time
import qc
from qc.db import report
from qc.thatsDEM import triangle
from qc.thatsDEM import array_geometry
from qc.thatsDEM import pointcloud
import qc.density_check
import qc.z_precision_roads
import qc.roof_ridge_strip
import qc.spike_check
import qc.z_accuracy
imp... |
"""
Imports a run from a directory.
"""
import os
import time
import yaml
import tempfile
import click
import mlflow
from mlflow.entities import RunStatus
from mlflow_export_import import utils, click_doc
from mlflow_export_import import mk_local_path
from mlflow_export_import.common.find_artifacts import find_artifa... |
import string
def strings(filename, min=4):
"""
Python implementation of strings
https://stackoverflow.com/a/17197027
"""
with open(filename, errors="ignore") as f:
result = ""
for c in f.read():
if c in string.printable:
result += c
cont... |
import json
from app import db
from app.models import Blocklist, Client, Settings, User, init_app
from xss import app
from .fixtures import client, client_empty
from .functions import *
def test_client_to_dict_clients(client):
access_header, _ = login_get_headers(client, "admin", "xss")
create_client(client... |
""" Unit test helper modules """
import six
class DummyMemcache(dict):
def _assertKeyBinary(self, key):
if not isinstance(key, six.binary_type):
raise ValueError('Key must be binary string.')
return key
def set(self, key, value):
self._assertKeyBinary(key)
self[ke... |
from tkinter import *
root=Tk()
frame=Frame(root,width=300, height=300)
button1=Button(frame,text="button 1")
button2=Button(frame,text="button 2")
button1.pack(side=LEFT)
button2.pack(side=RIGHT)
frame.pack()
root.mainloop() |
"""`BiphasicAxonMapModel`"""
from typing import Type
import numpy as np
import sys
from . import AxonMapModel, AxonMapSpatial, TemporalModel, Model
from ..implants import ProsthesisSystem, ElectrodeArray
from ..stimuli import BiphasicPulseTrain, Stimulus
from ..percepts import Percept
from ..utils import FreezeError
f... |
from output.models.saxon_data.wild.wild024_xsd.wild024 import (
T,
Eden,
)
__all__ = [
"T",
"Eden",
]
|
from .. import MTYPE_INVOKE, perform_request
from ...Codec import Codec
# rpc_le_adv_set_param(RPC_T_LE_ADV_PARAM_TYPE param, in binary value) -> RPC_T_GAP_CAUSE
def set_param(param, value) :
codec = Codec(7, 1, MTYPE_INVOKE, "II{}", "I")
return perform_request(codec, param, value)
# rpc_le_adv_get_param(RPC_... |
# -*- coding:utf-8 _*-
"""
Load Multi-exposure tube contour dataset (METCD)
@Author : Xiaoqi Cheng
@Time : 2020/10/24 19:40
"""
import torch, os, cv2
from torch.utils.data import Dataset, DataLoader
from torchvision.transforms import transforms
import matplotlib.pyplot as plt
from PIL import Image
import... |
# -*- coding: utf-8 -*-
"""
zine.utils.net
~~~~~~~~~~~~~~
This module implements various network related functions and among
others a minimal urllib implementation that supports timeouts.
:copyright: (c) 2009 by the Zine Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more d... |
# ##### 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.
#
# This program is distr... |
# coding: utf-8
#
# Copyright 2014 The Oppia 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 requi... |
"""
Distributed under the MIT License. See LICENSE.txt for more info.
"""
from django.urls import path
from .views.search import cone_search
from .views.search_result import cone_search_result
urlpatterns = [
path('search_result/', cone_search_result, name='cone_search_result'),
path('', cone_search, name='c... |
from functools import lru_cache
def wrap_around_10(val):
val = val % 10
if val == 0:
val = 10
return val
def part1(p1_pos, p2_pos):
num_dice = 0
d = 1
p1_score, p2_score = (0, 0)
while p1_score < 1000 and p2_score < 1000:
p1_pos += (d+d+1+d+2)
p1_pos = wrap_around_... |
version = "4.3.3"
|
# (C) Datadog, Inc. 2018
# All rights reserved
# Licensed under a 3-clause BSD style license (see LICENSE)
import random
from requests import Request, Session
class SessionWrapper:
def __init__(self, aci_url, session, apic_cookie, verify=None, timeout=None, log=None):
self.session = session
self.... |
import unittest
from context import lily
from lily import regression_trees
import numpy as np
import logging
logging.basicConfig(level=logging.INFO, format="%(lineno)d\t%(message)s")
class TestRegressionTrees(unittest.TestCase):
def setUp(self):
self.data = self._load_test_data('data/ex00.txt')
s... |
'''Alias module. Instead of 'import numpy as np' you can do 'from mt import np'.'''
from .matrix import *
from numpy import *
from numpy import __version__
import numpy as _np
for key in _np.__dict__:
globals()[key] = _np.__dict__[key]
|
from typing import Callable, List, NamedTuple, Union
class AppletState(NamedTuple):
"""The current applet content, i.e text, icons, menus items etc"""
header: str = "…"
menu: List[str] = []
class AppletConfig(NamedTuple):
"""The applet configuration as defined when added to the panel. Most importan... |
import argparse
import hashlib
import json
import numpy as np
import os
from PIL import Image
from urllib.request import urlretrieve
INPUT_FILE_URL = (
"https://knossosbuildpipeline.blob.core.windows.net/static/imagenet/msrc.jpg"
)
PYTORCH_RESNET50_ORIGINAL_URL = (
"https://download.pytorch.org/models/resnet50... |
import requests
import datetime
import re
from module import db
URL = "https://www.airkorea.or.kr/web/data_pmRelay_search_pop"
headers = {
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3729.157 Safari/537.36",
"Content-Type": "application/x-www-form... |
import pandas as pd
import numpy as np
import math
from curses import wrapper
import urwid
from gurobi import *
from sklearn import preprocessing
from tabulate import tabulate
import json
# globals
# tables with available players at each position
hitter_tables = { 'C': "",
'1B': "",
... |
from environments.base_environment import BaseEnvironment
import numpy as np
class Environment(BaseEnvironment):
def __init__(self):
# Encode the board as 9 positions with 0 (empty), 1 (first player) or -1 (second player).
# The position at line `i` and column `j` will be at `3*i+j`.
# The... |
"""empty message
Revision ID: f8cf69635038
Revises: 4647cb8fe558
Create Date: 2021-06-06 16:46:47.592930
"""
from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import postgresql
# revision identifiers, used by Alembic.
revision = 'f8cf69635038'
down_revision = '4647cb8fe558'
branch_labels = None... |
# -*- coding: utf-8 -*-
# ---
# jupyter:
# jupytext:
# formats: ipynb,py:light
# text_representation:
# extension: .py
# format_name: light
# format_version: '1.5'
# jupytext_version: 1.11.1
# kernelspec:
# display_name: Python 3
# language: python
# name: python3
# ---
... |
from .export import convert_parameter # NOQA
from .export import export # NOQA
|
#!/usr/bin/env python
# encoding:utf-8
from handler.otp.otp import otp
# URL 正则表达式 路由配置
Route = [
# 登录页面
(r"/otp", otp.OTPHandler),
(r"/otp/add", otp.OTPAddHandler),
(r"/otp/list", otp.OTPListHandler),
(r"/otp/lists", otp.OTPShareListHandler),
(r"/otp/update", otp.OTPUpdateHandler),
(r"/ot... |
import yaml
class ConfigParser:
def __init__(self, config_path:str):
with open(config_path,"r") as f:
params = yaml.safe_load(f)
self.params = params
# Check parameters
self.check_dataset_params()
self.check_logging_params()
for key in params.ke... |
import numpy as np
import math
import csv
import cv2
from sklearn.utils import shuffle
from sklearn.model_selection import train_test_split
from keras.models import Sequential
from keras.layers import Dense, Flatten, Lambda, Cropping2D, Conv2D, Activation, Dropout
from keras.callbacks import ModelCheckpoint
def data_l... |
from __future__ import annotations
import arcpy
import os
from entity_resolution import ProcessedDataResult
class ERBase(object):
def __init__(self) -> None:
self.out_file: str
return
def create_output_tables(self) -> None:
self.out_addresses = os.path.join(self.out_file, 'a... |
#!/usr/bin/env python2
"""
COSMO TECHNICAL TESTSUITE
General purpose script to compare two files containing tables
Only lines with given table pattern are considered
"""
# built-in modules
import os, sys, string
# information
__author__ = "Xavier Lapillonne"
__maintainer__ = "xavier.lapillonne@meteoswiss.ch"
... |
from __future__ import absolute_import, print_function, unicode_literals
import os
import re
import sys
MAX_LENGTH = 280
BREAK_ON_SENTENCE = True
END_TXT = " /end"
CONTINUATION = "..."
TEST_FILE = "towel.txt"
SENTENCE_END = r"[\.\?!]"
SENTENCE_END_PAT = re.compile(SENTENCE_END)
BREAK_CHARS = r"[:;,]"
BREAK_CHARS_PA... |
# Generated by Django 2.2 on 2019-04-23 00:04
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('core', '0002_profile'),
]
operations = [
migrations.AddField(
model_name='profile',
name='color',
field=mo... |
from setuptools import setup
__version__ = "0.2.1"
setup(
name="python-project-generator",
version=__version__,
description="A cookiecutter template for Sanic Framework",
author="Yifang Deng",
author_email="yvedengw@gmail.com",
license="MIT",
python_requires=">=3.7",
)
|
from .bucket import Bucket
from .connection import Connection
from .network import Network
from .input import Input
from .output import Output
from .pool import Pool
from .network import Network
|
from argparse import ArgumentParser
import os
import json
from collections import Counter
import pickle
'''
The script takes a directory with annotation files as a argument and extracts from them label names,
filters them and saves the file with the map of labels. The map is used to filter out the unused signs
and ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.