text stringlengths 2 999k |
|---|
# -*- coding: utf-8 -*-
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
options = Options()
options.headless = True
path = "path/to/chromedriver.exe" # You need to change this
def parser():
driver = webdriver.Chrome(path, chrome_options=options)
driver.get... |
import warnings
import numpy as np
from scipy.spatial import Delaunay
from skimage.filters import sobel
from skimage import color, img_as_ubyte
from PIL import Image, ImageDraw, ImageFilter
def distance(p1, p2):
(x1, y1) = p1
(x2, y2) = p2
d = int((y2-y1)**2 + (x2-x1)**2)**0.5
return d
def populate(a, b, n, wid... |
"""
Event providers powered by Bugout journals.
"""
from datetime import datetime
import json
import logging
from typing import Dict, List, Optional, Tuple
from bugout.app import Bugout
from bugout.data import BugoutResource, BugoutSearchResult
from bugout.journal import SearchOrder
from dateutil.parser import isopars... |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may ... |
"""
Hyde Processing Tool - GSMap Rain
__date__ = '20200319'
__version__ = '1.0.0'
__author__ = 'Fabio Delogu (fabio.delogu@cimafoundation.org'
__library__ = 'hyde'
General command line:
python3 HYDE_DynamicData_GSMap_Rain.py -settings_file configuration.json -time YYYYMMDDHHMM
Version:
20200319 (1.0.0) --> Beta rele... |
import subprocess
import logging
import graphviz
from pathlib import Path
from unittest import mock
from BALSAMIC import __version__ as balsamic_version
def test_init_reference_write_json(
invoke_cli,
tmp_path,
):
# Given test_reference.json
test_genome_version = "hg19"
test_container_ver... |
from . import base
from . import fields
from .location import Location
class Venue(base.TelegramObject):
"""
This object represents a venue.
https://core.telegram.org/bots/api#venue
"""
location: Location = fields.Field(base=Location)
title: base.String = fields.Field()
address: base.Stri... |
from fastapi import APIRouter, HTTPException
from app.api import crud
from app.models.pydantic import SummaryPayloadSchema, SummaryResponseSchema
from app.models.tortoise import SummarySchema
from typing import List
router = APIRouter()
@router.post('/', response_model=SummaryResponseSchema, status_code=201)
async... |
import os
import copy
import lzma
import tarfile
import hashlib
import tempfile
import contextlib
import shutil
import jinja2
import stat
import urlparse
import codecs
# import zipfile
import collections
import subprocess
import lamnfyc.utils
import lamnfyc.settings
from lamnfyc.logger import log
RequiredPacket = col... |
###############
# @file ldac.py
# @author Douglas Applegate & Thomas Erben
# @date 27/11/2013
#
# @brief Utilities to make accessing LDAC cats easier within Python
###############
# HISTORY INFORMATION:
# ====================
#
# 01.09.2010:
# I included treatment of slices through vectorkeys in
# LDACCat... |
import os
from . import helpers
def test_custom_root_log_node(testdir):
testdir.makefile(".ini", pytest='[pytest]\nlogfest-root-node=logfest\n')
testdir.makepyfile("""
import pytest
@pytest.fixture(scope='session')
def session(session_logger):
session_logger.info("{0}")
... |
from .api import APIItems
class Scenes(APIItems):
"""Represents Hue Scenes.
https://developers.meethue.com/documentation/scenes-api
"""
def __init__(self, raw, request):
super().__init__(raw, request, 'scenes', Scene)
class Scene:
"""Represents a Hue Scene."""
def __init__(self, id... |
# Copyright 2018 The Texar 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 ... |
"""
This file contains the logic for loading data for all RelationClassification tasks.
"""
import os
import json, csv
from abc import ABC, abstractmethod
from collections import defaultdict, Counter
from typing import *
from openprompt.utils.logging import logger
from openprompt.data_utils.utils import InputExample... |
# 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.
# -----------------------------------------------------... |
from django.conf.urls import url, include
from rest_framework.urlpatterns import format_suffix_patterns
from rest_framework.authtoken.views import obtain_auth_token
from feeds import views as feed_views
from plugins import views as plugin_views
from plugininstances import views as plugininstance_views
from pipelines... |
# Copyright (C) 2019 The Raphielscape Company LLC.
#
# Licensed under the Raphielscape Public License, Version 1.d (the "License");
# you may not use this file except in compliance with the License.
#
from asyncio import sleep
from pylast import User, WSError
from re import sub
from urllib import parse
from os import ... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Tests for Geoconvert."""
import unittest
from geoconvert.convert import zipcode_to_dept_name
from geoconvert.convert import address_to_zipcode
from geoconvert.convert import dept_name_to_zipcode
from geoconvert.convert import country_name_to_id
from geoconvert.convert... |
#!/usr/bin/env python
'''
Author: Shih-Yuan Liu
'''
#import rospkg
import yaml
from graphviz import Digraph
import sys
# TODO read from command line
config = "baseline"
param_file = "default"
argv = sys.argv
if len(argv) > 1:
param_file = sys.argv[1]
#file_path = rospkg.RosPack().get_path("duckietown") + "/config/... |
import numpy as np
import pprint
from yggdrasil import units
from yggdrasil.communication.NetCDFFileComm import NetCDFFileComm
from yggdrasil.serialize.WOFOSTParamSerialize import WOFOSTParamSerialize
fname_param = 'cropfile_example.cab'
# fname_netcdf = 'simple.nc'
fname_netcdf = 'test.nc'
# Test serializer
with ope... |
""":mod:`wand.cdefs.pixel_wand` --- Pixel-Wand definitions
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.. versionadded:: 0.5.0
"""
from ctypes import (CDLL, POINTER, c_char_p, c_double,
c_float, c_int, c_longdouble, c_size_t,
c_ubyte, c_uint, c_ushort, c_void_p... |
"""Blank file for Python transversal.
This can be deleted or renamed to store the source code of your project.
"""
|
# -*- coding: utf-8 -*-
# Copyright 2011 Takeshi KOMIYA
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... |
import re
import time
import json
import traceback
from os import environ
from hashlib import md5
from typing import List, Union
from flask import (Flask, make_response, redirect, render_template,
request, send_from_directory, Response)
from duty.utils import gen_secret
from microvk import VkApi, ... |
# SPDX-License-Identifier: Apache-2.0
#
# http://nexb.com and https://github.com/nexB/scancode.io
# The ScanCode.io software is licensed under the Apache License version 2.0.
# Data generated with ScanCode.io is provided as-is without warranties.
# ScanCode is a trademark of nexB Inc.
#
# You may not use this software ... |
#!/usr/bin/env python3
from bs4 import BeautifulSoup, Comment
from bs4.element import NavigableString
import copy
from util import *
import dateutil.parser as dparser
import re
import os
from urllib.parse import urljoin
import dateparser
import json
import sys
# TODO: Single item lists get absorbed into parent also i... |
import math
import numpy as np
from consts import Consts
def get_SSO_inclination(a, ecc):
# The formula for the RAAN drift is taken from D.A. Vallado Fundamentals of
# Astrodynamics, page 649, eq 9-37
# Inputs: constants, a - semi-major axis [m] and inclination
# Outputs: SSO orbit inclination [rad]
... |
from mahjong.constants import EAST, FIVE_RED_MAN, FIVE_RED_PIN, FIVE_RED_SOU
from utils.settings_handler import settings
def is_aka_dora(tile):
"""
:param tile: int 136 tiles format
:return: boolean
"""
if not settings.FIVE_REDS:
return False
if tile in [FIVE_RED_MAN, FIVE_RED_PIN, FI... |
#!/usr/bin/env python3
import sys
import fileinput
from transliterate import translit
source_lang = 'ru'
def is_ascii_str(test):
try: test.decode('ascii')
except: return False
else: return True
for line in fileinput.input(sys.argv[1], inplace=True):
if line.split()[1] == 'NAME':
if not is_as... |
# coding: utf-8
import re
import six
from huaweicloudsdkcore.sdk_response import SdkResponse
from huaweicloudsdkcore.utils.http_utils import sanitize_for_serialization
class CancelSubscriptionResponse(SdkResponse):
"""
Attributes:
openapi_types (dict): The key is attribute name
... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import datetime
import os
import sys
import signal
import time
import ConfigParser
import glob
import json
import Mobigen.Common.Log as Log; Log.Init()
from watchdog.observers import Observer
import shutil
from watchdog.events import FileSystemEventHandler
from watchdog.eve... |
#MIT License
#Copyright (c) 2021 Paramatin-OP
#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... |
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
Created on Mon May 20 16:13:54 2019
@author: sazd3
"""
from __future__ import division
import matplotlib.pyplot as plt
import numpy as np
x0=[0.5,-.5,0]
y0=[0,0,np.sqrt(5)/4]
x=x0
y=y0
newx=(x[0]+x[1])/2
newy=(y[0]+y[1])/2
n=100000 #number of points
for i in range(n)... |
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
# Leviathan Music Manager
# A command-line utility to manage your music collection.
#
# Copyright (C) 2010-2013, 2020 S. Zeid
# https://code.s.zeid.me/leviathan
#
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU G... |
# -*- coding: utf-8 -*-
"""
Created on Thu Feb 23 10:36:36 2017
@author: pierre_b
"""
|
# -*- coding: utf-8 -*-
from tornado import locale as t_locale
import os
import os.path
import gettext
class WebtoolsTranslation(gettext.GNUTranslations):
def __init__(self, *args, **kwargs):
super(WebtoolsTranslation, self).__init__(*args, **kwargs)
self.set_output_charset('utf-8')
def mer... |
import re
import urllib.request
xkcd_colors_url = 'https://xkcd.com/color/rgb.txt'
pattern = re.compile('([a-zA-Z0-9 /]+)\s+\#([a-fA-F0-9]+)');
# csharp
target_filename = 'colors.cs'
color_entry_format = 'public static readonly Color %s = new Color(%s);\n'
color_hex_format = '0x%sFF'
print('> Requesting color list f... |
#!/usr/bin/python
#
# Copyright (c) 2017, United States Government, as represented by the
# Administrator of the National Aeronautics and Space Administration.
#
# All rights reserved.
#
# The Astrobee platform is licensed under the Apache License, Version 2.0
# (the "License"); you may not use this file except in comp... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Fri Nov 5 14:11:00 2021
@author: laros
"""
import pandas as pd
import numpy as np
import seaborn as sns
import matplotlib
import matplotlib.pyplot as plt
# %matplotlib inline
sns.set(color_codes=True)
from scipy import stats
from sklearn.ensemble import R... |
"""Gym environment registration"""
from . import tests
import matplotlib
# matplotlib.use("Agg")
from pddlgym.rendering import *
from gym.envs.registration import register
import gym
import os
# Save users from having to separately import gym
def make(*args, **kwargs):
return gym.make(*args, **kwargs)
def regi... |
_base_ = 'retinanet_pvtv2-b0_fpn_1x_coco.py'
model = dict(
backbone=dict(
embed_dims=64,
num_layers=[3, 6, 40, 3],
mlp_ratios=(4, 4, 4, 4),
init_cfg=dict(checkpoint='https://github.com/whai362/PVT/'
'releases/download/v2/pvt_v2_b5.pth')),
neck=dict(i... |
# -*- coding: utf-8 -*-
"""
-------------------------------------------------
File Name: UsefulProxyCheck
Description : check useful proxy
Author : JHao
date: 2019/8/7
-------------------------------------------------
Change Activity:
2019/8/7: check useful proxy
... |
# -*- coding: utf-8 -*-
import numpy as np
from ProGED.generators.grammar import GeneratorGrammar
import sympy as sp
from diophantine import solve
from itertools import product
def grammar_from_template (template_name, generator_settings, repeat_limit = 100, depth_limit = 100):
if template_name in GRAMMAR_LIBRA... |
from typing import Any, Awaitable, List
import pytest
from returns.future import Future, FutureResult
from returns.io import IO
@pytest.mark.anyio()
async def test_inner_value(subtests):
"""Ensure that coroutine correct value is preserved for all units."""
containers: List[Awaitable[Any]] = [
# We h... |
class FluidsObs(object):
"""
The base FLUIDS observation interface
"""
def __init__(self):
pass
def get_array(self):
"""
Returns a numpy array representation of the observation
Returns
-------
np.array
"""
raise NotImplementedError
|
#############################
# Author: Aravind Kashyap
# File: lis.py
# comments: This programme outputs the Longest Strictly Increasing Subsequence in O(NLogN)
# Where N is the Number of elements in the list
#############################
def CeilIndex(v, l, r, key):
while r - l > 1:
m = (l + r) ... |
from pylab import *
import pandas as pd
import matplotlib.pyplot as plot
filePath = ("/Users/liuzhongkai/Downloads/Python量化交易实战/code/dataTest.csv")
dataFile = pd.read_csv(filePath, header=None, prefix='V')
summary = dataFile.describe()
dataFile_normalization = dataFile.iloc[:,1:6]
for i in range(5) :
mean = sum... |
import torch.nn as nn
import torchvision.transforms as transforms
import nnan
snn = nnan.NNaNUnit(dims=[10,10,10])
__all__ = ['alexnet_nan']
class AlexNetOWT_BN(nn.Module):
def __init__(self, num_classes=1000):
super(AlexNetOWT_BN, self).__init__()
self.features = nn.Sequential(
nn.C... |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.20 on 2019-05-23 15:38
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('media', '0009_auto_20181207_1318'),
]
operations = [
migrations.AlterField... |
from arena import *
import random
scene = Scene(host="arenaxr.org", realm="realm", scene="example")
def click(scene, evt, msg):
if evt.type == "mouseup":
print("mouseup!")
elif evt.type == "mousedown":
print("mousedown!")
@scene.run_once
def main():
my_tet = Tetrahedron(
object_id... |
# Copyright (c) 2009 Upi Tamminen <desaster@gmail.com>
# See the COPYRIGHT file for more information
from twisted.internet import reactor, defer
from twisted.internet.defer import inlineCallbacks
from rassh.core.honeypot import HoneyPotCommand
import random, re
commands = {}
class command_faked_package_class_factory... |
'''
The MIT License (MIT)
Copyright (c) 2016 WavyCloud
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, p... |
# -*- coding: utf-8 -*-
# Copyright (c) 2015, Mayo Clinic
# 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... |
import numpy as np
import pandas as pd
import os
import json
from mbi import Domain
class Dataset:
def __init__(self, df, domain, weights=None):
""" create a Dataset object
:param df: a pandas dataframe
:param domain: a domain object
:param weight: weight for each row
"""
... |
from __future__ import absolute_import
from __future__ import print_function
from __future__ import division
import numpy as np
import tensorflow as tf
class Model(object):
def __init__(self, features_L, features_R, targets, is_training):
with tf.variable_scope('feature_extractor'):
embedding... |
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
import torch
from sklearn.metrics import roc_curve, roc_auc_score, f1_score, classification_report
def get_default_device():
"""Pick GPU if available, else CPU"""
if torch.cuda.is_available():
return torch.de... |
##############################################################################
# Copyright (c) 2013-2018, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
#
# This file is part of Spack.
# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
# LLNL-CODE-64... |
import matplotlib.pyplot as plt
from matplotlib import animation
try:
from tensorflow.keras.layers import Input
from tensorflow.keras.models import Model, load_model
from tensorflow.keras.layers import Convolution2D
from keras import backend as K
plt.rcParams['animation.ffmpeg_path'] = '/home/jm/bi... |
import os, sys
import imageio
from opt import get_opts
import torch
from collections import defaultdict
from torch.utils.data import DataLoader
from datasets import dataset_dict
# models
from models.nerf import Embedding, NeRF
from models.rendering import render_rays
# optimizer, scheduler, visualization
from utils... |
from .nasbench201_database import NASBench201DataBase
from .nasbench201_dataset import NASBench201Dataset
__all__ = [NASBench201DataBase, NASBench201Dataset] |
import copy,os
from collections import OrderedDict
import numpy as np
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d.axes3d import Axes3D
from matplotlib import cm
from pypospack.pyposmat.data import PyposmatDataFile
from pypospack.pyposmat.data import PyposmatConfigurationFile
from pypospack.pyposmat.visua... |
# -*- coding: utf-8 -*-
"""
Tencent is pleased to support the open source community by making BK-LOG 蓝鲸日志平台 available.
Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved.
BK-LOG 蓝鲸日志平台 is licensed under the MIT License.
License for BK-LOG 蓝鲸日志平台:
------------------------------------------------... |
# This file is created by generate_build_files.py. Do not edit manually.
test_support_sources = [
"src/crypto/asn1/asn1_locl.h",
"src/crypto/bio/internal.h",
"src/crypto/bytestring/internal.h",
"src/crypto/chacha/internal.h",
"src/crypto/cipher_extra/internal.h",
"src/crypto/conf/conf_def.h",
... |
# Copyright 2016 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... |
import datetime
import ujson
import zlib
from django.utils.translation import ugettext as _
from django.utils.timezone import now as timezone_now
from django.db.models import Sum
from analytics.lib.counts import COUNT_STATS, RealmCount
from zerver.lib.avatar import get_avatar_field
import zerver.lib.bugdown as bugdo... |
# based on https://github.com/dawenl/vae_cf
import numpy as np
from scipy import sparse
import pandas as pd
import os
import bottleneck as bn
def load_train_data(csv_file, n_items, n_users, global_indexing=False):
tp = pd.read_csv(csv_file)
n_users = n_users if global_indexing else tp['uid'].max() + 1... |
# -*- coding: utf-8 -*-
"""
Meeasure class for the research project 'Cortical Spike Synchrony as
a Measure of Contour Uniformity', as part of the RTG computational cognition,
Osnabrueck University, Germany.
"""
__author__ = 'Julius Mayer, Viktoria Zemliak, Flora Perizonius'
__email__ = 'viktoriia.zemliak@uni... |
# -*- coding: utf-8 -*-
# @Time : 2019/4/19 10:12 AM
# @Author : ShaHeTop-Almighty-ares
# @Email : yang6333yyx@126.com
# @File : __init__.py.py
# @Software: PyCharm
|
from flask_wtf import FlaskForm
from wtforms import StringField,PasswordField,SubmitField,BooleanField
from wtforms.validators import Required,Email,EqualTo
from ..models import User
from wtforms import ValidationError
class RegistrationForm(FlaskForm):
email = StringField('Your Email Address',validators=[Require... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Jul 23 10:49:24 2019
@author: -
"""
import numpy as np
def computeAdjust4CBC(DIMS, numVar, varDex, bcType):
# Get DIMS data
NX = DIMS[3]
NZ = DIMS[4]
OPS = (NX+1) * NZ
# All DOF per variable
rowsAll = ... |
import json
import os
from os import makedirs
from os.path import exsits, getmtime, join, splitext
import time
def jsonize(dct):
""" Remvoes non-json elements from a dictionary.
Converts VirtualFile objects to the integral value 1.
Content stored in VirtualFile is lost. Write to file to avoid loss.
R... |
# -*- coding: UTF-8 -*-
#$ header procedure incr(double) results(double)
def incr(x):
y = x + 1
return y
#$ header procedure decr(double) results(double)
def decr(x):
y = x - 1
return y
|
#
# All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
# its licensors.
#
# For complete copyright and license terms please see the LICENSE at the root of this
# distribution (the "License"). All use of this software is governed by the License,
# or, if provided, by the license below or th... |
import base64
import json
import re
import uuid
from pyDes import des, CBC, PAD_PKCS5
from requests_toolbelt import MultipartEncoder
from todayLoginService import TodayLoginService
class AutoSign:
# 初始化签到类
def __init__(self, todayLoginService: TodayLoginService, userInfo):
self.session = todayLoginS... |
########################################
# Automatically generated, do not edit.
########################################
from pyvisdk.thirdparty import Enum
HostLowLevelProvisioningManagerReloadTarget = Enum(
'currentConfig',
'snapshotConfig',
)
|
from pathlib import Path
import click
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
from ertk.utils import PathlibPath
@click.command()
@click.argument("input", type=PathlibPath(exists=True, dir_okay=False))
@click.option("--individual", help="Plot individual folds for each metric.")
def ma... |
# Copyright 2017 Neural Networks and Deep Learning lab, MIPT
#
# 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 applicab... |
# coding: utf-8
from mpi4py import MPI
from scipy.sparse import eye as sparse_id
from psydac.linalg.basic import LinearOperator
from psydac.fem.basic import FemField
#===============================================================================
class FemLinearOperator( LinearOperator ):
"""
Linear opera... |
import tensorflow as tf
from config import *
def model_1():
'Иницилизация структуры модели'
input_img = tf.keras.layers.Input(shape=IMG_SHAPE)
output_code = []
out = tf.keras.layers.Convolution2D(16, (3, 3), padding='same', activation='relu')(input_img)
out = tf.keras.layers.MaxPooling2D(padding='... |
#!/usr/bin/env python
"""A module with utilities for maintaining compatibility with Python 2 and 3."""
import collections
import os
import shlex
import sys
import time
import types
from typing import Any
from typing import Dict
from typing import List
from typing import Optional
from typing import Text
from typing imp... |
import torch
from .wrapper import Wrapper
class PyTorchWrapper(Wrapper):
def __init__(self, model, tokenizer):
super(PyTorchWrapper, self).__init__()
self._model = model
self._tokenizer = tokenizer
self.unk_token = self._tokenizer.unk_token
def _forward(self, text_list):
... |
"""
Functions to load sample data
"""
import numpy as np
import pandas as pd
from .download import fetch_data
def _setup_map(ax, xticks, yticks, crs, region, land=None, ocean=None):
"""
Setup a Cartopy map with land and ocean features and proper tick labels.
"""
import cartopy.feature as cfeature
... |
import collections
def solution(bridge_length, weight, truck_weights) :
time = 0
number_complete = len(truck_weights)
list_untransiting = collections.deque(truck_weights)
list_transiting = collections.deque([])
list_transited = collections.deque([])
while True :
number_complete_truck ... |
#!/usr/bin/env python
import os
import sys
import time
import select
import fcntl
import termios
import readline
import signal
def nonblockingfd(fd):
fcntl.fcntl(fd, fcntl.F_SETFL, fcntl.fcntl(fd, fcntl.F_GETFL) | os.O_NONBLOCK)
def echonocbreak(fd):
old = termios.tcgetattr(fd)
old[3] = old[3] | termios.... |
# Copyright 2015 Internap.
#
# 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, so... |
import functools
from webdriver_components.pageobjects import Component, ComponentMetaclass, Css
class TableRowMetaclass(ComponentMetaclass):
"""
class PayRateRow(TableRow):
cell_names = (
'from_date',
'pay_rate',
'charge_out_rate'
... |
from supersql.constants.datatype_parameters import (
DEFAULT,
PK,
PRIMARY_KEY,
REQUIRED,
)
def ddl(instance):
pass
def traverser():
count = len(arguments)
for param in arguments:
if isinstance(param)
|
from __future__ import absolute_import, division, print_function
import numpy as np
from glue.core import Data
from glue.core.coordinates import WCSCoordinates
from astropy.io import fits
from astropy.wcs import WCS
from ..gridded_fits import fits_writer
def test_fits_writer_data(tmpdir):
filename = tmpdir.joi... |
import logging
import sys
import argparse
from dataactcore.interfaces.db import GlobalDB
from dataactcore.logging import configure_logging
from dataactbroker.fsrs import config_valid, fetch_and_replace_batch, GRANT, PROCUREMENT
from dataactvalidator.health_check import create_app
logger = logging.getLogger(__name__)... |
from .structs import Coin
AAVE = Coin("AAVE")
ADA = Coin("ADA")
ALGO = Coin("ALGO")
ANKR = Coin("ANKR")
ATOM = Coin("ATOM")
BAL = Coin("BAL")
BAND = Coin("BAND")
BAT = Coin("BAT")
BCH = Coin("BCH")
BNT = Coin("BNT")
BTC = Coin("BTC")
CELR = Coin("CELR")
CHZ = Coin("CHZ")
COMP = Coin("COMP")
CRO = Coin("CRO")
CRV = Coi... |
""" This module contains code to freeze a number of Python modules
into a single (mostly) standalone DLL or EXE. """
import modulefinder
import sys
import os
import marshal
import imp
import platform
import struct
import io
import distutils.sysconfig as sysconf
import zipfile
import importlib
from . import pefile
# ... |
import network, machine, ssd1306, test, oled_ssd1306, time, menu_framework
import uasyncio as asyncio
loop = asyncio.get_event_loop()
board_station = network.WLAN(network.STA_IF)
board_AP = network.WLAN(network.AP_IF)
def reboot():
machine.reset()
async def ipcfg():
# allows easy setting of AP c... |
import os
import pandas as pd
import numpy as np
import pickle
import matplotlib.pyplot as plt
import seaborn as sns
from zvt import zvt_env
from zvt.api.data_type import Region, Provider
from zvt.factors.candlestick_factor import CandleStickFactor, candlestick_patterns
# import faulthandler
# faulthandler.enable()
... |
#!/usr/bin/env python3
# Extract regexes from a typescript file.
# Approach:
# 1. Use tsc to transpile to a JS file.
# 2. Use our JS regex extractor on the resulting JS.
# Import libLF
import os
import sys
import re
sys.path.append(os.path.join(os.environ['REGEX_GENERALIZABILITY_PROJECT_ROOT'], 'lib'))
import libLF
i... |
#!/usr/bin/env python3
#
# Copyright 2021 Graviti. Licensed under MIT License.
#
# pylint: disable=invalid-name
# pylint: disable=missing-module-docstring
import json
import os
from typing import Iterable, Iterator, List, Tuple
from ...dataset import Data, Dataset
from ...exception import ModuleImportError
from ...ge... |
"""
Plot comparison of different Criterion baselines, for a benchmark that
has a parameter. Requires matplotlib and numpy.
Usage: (run in benchmark crate root)
python3 plot_parametrized_comparison.py [benchmark path] [baseline names...]
benchmark path could be e.g. "fft/copy and fft"
"""
import sys
import json
from ... |
# Copyright (c) 2021, VRAI Labs and/or its affiliates. All rights reserved.
#
# This software is licensed under the Apache License, Version 2.0 (the
# "License") as published by the Apache Software Foundation.
#
# You may not use this file except in compliance with the License. You may
# obtain a copy of the License at... |
# To gradually migrate to mypy we aren't setting these globally yet
# mypy: disallow_untyped_defs=True
# mypy: disallow_untyped_calls=True
import argparse
import collections
import logging
import sys
import curtsies
import curtsies.events
import curtsies.input
import curtsies.window
from . import args as bpargs, tra... |
""" Amazon Access Challenge Starter Code
This code enhances the original categorical data with a few sets of additional
features. It then trains ensemble of decision tree models on the data.
Hyperparameter searches were done using leaderboard feedback and grid searches
in earlier versions of this code.
Model blendin... |
# Copyright 2016 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.