text stringlengths 1 927k |
|---|
from faker import Faker
from model_bakery.recipe import Recipe, foreign_key
from users.baker_recipes import staff_user
fake = Faker()
setting = Recipe(
"settings.Setting",
central_logistics_company=True,
platform_user=foreign_key(staff_user),
deposit_vat=19,
mc_swiss_delivery_fee_vat=19,
)
glob... |
try:
from uarray import array
except ImportError:
try:
from array import array
except ImportError:
print("SKIP")
raise SystemExit
try:
memoryview(b'a').itemsize
except:
print("SKIP")
raise SystemExit
for code in ['b', 'h', 'i', 'q', 'f', 'd']:
print(memoryview(array... |
"""Test that DBObject works as expected."""
from ymldb.dbobject import DBObject
from ymldb.location import Location
def test_dbobject_instantiation() -> None:
"""Test that we can create a DB Object."""
dbo = DBObject(raw_data={}, location=Location(container=[], name=""))
assert dbo.raw_data == {}
as... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from setuptools import setup
# should be loaded below
__version__ = None
with open('es6widgetexample/_version.py') as version:
exec(version.read())
setup(
name="es6widgetexample",
version=__version__,
description="An evolving approach to creating a Jupyt... |
# This file is dual licensed under the terms of the Apache License, Version
# 2.0, and the BSD License. See the LICENSE file in the root of this repository
# for complete details.
from __future__ import absolute_import, division, print_function
__all__ = [
"__title__", "__summary__", "__uri__", "__version__", "__... |
from django.contrib import admin
# Register your models here.
from django.contrib.auth.admin import UserAdmin as BaseUserAdmin
from django.contrib.auth.models import User
from .models import Profile, HasSkill, Skill, Favourite
class ProfileInline(admin.StackedInline):
model = Profile
can_delete = False
... |
# Copyright (c) 2003-2005 The Regents of The University of Michigan
# Copyright (c) 2013 Advanced Micro Devices, Inc.
# 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 co... |
# -*- mode: python; coding: utf-8 -*-
# Copyright 2019-2020 the .NET Foundation
# Licensed under the MIT License.
from __future__ import absolute_import, division, print_function
__all__ = """
indent_xml
LockedDownTraits
LockedXmlTraits
MetaLockedDownTraits
stringify_xml_doc
write_xml_doc
XmlSer
""".split()
from abc... |
# TEE PELI TÄHÄN
import pygame
import random
class Moneyrobot():
def __init__(self):
pygame.init()
self.lataa_kuvat()
self.taso = 0
self.kolikot = 0
self.korkeus = 640
self.leveys = 640
self.peli_ohi = False
self.kello = pygame.time.Clock()
s... |
"""
2941. 크로아티아 알파벳
작성자: xCrypt0r
언어: Python 3
사용 메모리: 29,380 KB
소요 시간: 80 ms
해결 날짜: 2020년 9월 23일
"""
def main():
croatian = ['c=', 'c-', 'dz=', 'd-', 'lj', 'nj', 's=', 'z=']
s = input()
for c in croatian:
s = s.replace(c, '.')
print(len(s))
if __name__ == '__main__':
main() |
#
# PySNMP MIB module EPPC-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/EPPC-MIB
# Produced by pysmi-0.3.4 at Wed May 1 13:05:04 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar 27 2019, 09:23:1... |
# -*- coding: utf-8 -*-
import base64
import os
import logging
from collections import defaultdict
from flask import render_template, jsonify, request, current_app, redirect, session
from flask_login import login_user, logout_user, login_required, current_user
from flask_principal import Identity, identity_changed, An... |
from src.katas import fizz_buzz
import unittest
class FizzBuzzTest(unittest.TestCase):
def test_it_return_fizz_for_multiples_of_three(self):
converter = fizz_buzz.FizzBuzz()
for number in [3, 6, 9, 12]:
self.assertEqual('Fizz', converter.convert(number))
def test_it_return_buzz_... |
# -*- coding: utf-8 -*-
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: streamlit/proto/Favicon.proto
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from google.protobuf import reflection as _reflection
from google.protobuf import symbol_datab... |
# 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 ... |
VERSION = '0.1.6.1' |
# coding=utf-8
# *** WARNING: this file was generated by the Pulumi SDK Generator. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union, overload
from .. import _utilities
from... |
# Copyright 2018 The Cornac 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 ... |
"""
Distributed under the terms of the BSD 3-Clause License.
The full license is in the file LICENSE, distributed with this software.
Author: Jun Zhu <jun.zhu@xfel.eu>, Ebad Kamil <ebad.kamil@xfel.eu>
Copyright (C) European X-Ray Free-Electron Laser Facility GmbH.
All rights reserved.
"""
import functools
from PyQt5... |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2012 Nebula, 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
#
# ... |
from __future__ import unicode_literals
import os, json
from glob import glob
fileset = ("locale", "corpora")
def check(setname):
print "checking " + setname
mapping = dict((fName, set(json.load(open(fName)))) for fName in glob(setname + "*.json"))
def check_key(key, fromLang):
for fName, js... |
"""Test pysma init."""
import logging
import re
from unittest.mock import patch
import aiohttp
import pytest
from pysma import SMA
from pysma.const import (
DEVCLASS_INVERTER,
ENERGY_METER_VIA_INVERTER,
OPTIMIZERS_VIA_INVERTER,
)
from pysma.definitions import device_type as device_type_sensor
from pysma.d... |
#! /usr/bin/env python3
# Hello! This is a simple example file for textattr.
# All you need to do to use textattr is this line at the beginning:
from textattr import *
# You can get the escape code for a set of attributes using ta() and save it:
taYellowOnBlue = ta("y /b")
# You can then input it to print() and such... |
import time
import pytest
import requests
from ray.experimental import serve
from ray.experimental.serve import BackendConfig
import ray
def test_e2e(serve_instance):
serve.init() # so we have access to global state
serve.create_endpoint("endpoint", "/api", blocking=True)
result = serve.api._get_global_... |
import pytest
from dependency_injector import Scope
from dependency_injector.errors import InvalidScopeError
from ..utils import Context
from . import ioc
class Service1:
pass
class Service2:
def __init__(self, service1: Service1):
self.service1 = service1
def test_inject_transient_into_dependen... |
from __future__ import absolute_import
import six
from django.db import IntegrityError, transaction
from rest_framework.response import Response
from sentry import analytics
from sentry.api.serializers import serialize
from sentry.integrations.exceptions import IntegrationError
from sentry.models import Repository
fr... |
from typing import List
import numpy as np
from bridge_sim.internal.plot import plt
from bridge_sim.internal.plot.geometry.angles import ax_3d
from bridge_sim.sim.model import Node
def node_scatter_3d(nodes: List[Node], new_fig: bool = True):
# Split into separate arrays of x, y and z position, and colors.
... |
"""
pol_metrics.py
Scripts to measure 4 polarization metrics (as defined by DiMaggio) of a
distribution of preferences.
"""
import csv
import os.path
import numpy as np
import pandas as pd
from scipy.stats import moment, kurtosis, uniform, laplace
from scipy.misc import comb, factorialk
from sklearn import mixture
f... |
#!/usr/bin/env python
""" Package setup/installation and metadata for lambdata
"""
import setuptools
REQUIRED = [
"numpy",
"pandas",
"sklearn"
]
with open("README.md", "r") as fh:
LONG_DESCRIPTION = fh.read()
setuptools.setup(
name="lambdata-carlosgutier",
version="0.0.8",
author="carlos... |
from PyQt5 import QtWidgets, QtCore, uic
import sys
import os
from mqtt_qobject import MqttClient
def distance_for_button(button):
on = button.objectName()
if on == 'distance_point1':
return 0.1
elif on == 'distance_1':
return 1
elif on == 'distance_10':
return 10
elif on... |
import os
import shutil
os.unlink('filter_plugins/.keep')
os.unlink('inventory/group_vars/.keep')
shutil.rmtree('licenses') |
"""Univariate copulas module."""
from copulas.univariate.base import BoundedType, ParametricType, Univariate
from copulas.univariate.beta import BetaUnivariate
from copulas.univariate.gamma import GammaUnivariate
from copulas.univariate.gaussian import GaussianUnivariate
from copulas.univariate.gaussian_kde import Gau... |
"""
Manage user and organization robot accounts.
"""
from endpoints.api import (
resource,
nickname,
ApiResource,
log_action,
related_user_resource,
require_user_admin,
require_scope,
path_param,
parse_args,
query_param,
validate_json_request,
max_json_size,
)
from endpo... |
#This cheat sheet explains several functions to handle files in python
#%%
import os
#%%
print('current working path: ' + os.getcwd())
print('absolute path: ' + os.path.abspath('.'))
print('is path absolute ? ' + str(os.path.isabs('.')))
# %%
print('relative path: ' + os.path.relpath('.'))
# %%
print('path name of ... |
import sys
import time
import uuid
import pandaserver.userinterface.Client as Client
from pandaserver.taskbuffer.JobSpec import JobSpec
from pandaserver.taskbuffer.FileSpec import FileSpec
site = sys.argv[1]
cloud = sys.argv[2]
datasetName = 'panda.destDB.%s' % str(uuid.uuid4())
destName = None
jobList = []
fo... |
import os.path
import argparse
#Author: Daniel Edwards
#Date: 12-08-2021
#Validate IP file existence
parser = argparse.ArgumentParser()
parser.add_argument('-f', '--file', help='Specify the file and/or the file\'s path containing IP addresses')
parser.add_argument('-i', '--ip', nargs='+', help='Specify IP address(es)... |
'''
Decide on a JSONField implementation based on available packages.
There are two possible options, preferred in the following order:
- JSONField from django-jsonfield with django-jsonfield-compat
- JSONField from django-mysql (needs MySQL 5.7+)
Raises an ImportError if USE_JSONFIELD is True but none of these ... |
#!/usr/bin/env python
from __future__ import print_function
import roslib
roslib.load_manifest('csi_opencv_tester')
import sys
import rospy
import cv2
from std_msgs.msg import String
from sensor_msgs.msg import Image
from cv_bridge import CvBridge, CvBridgeError
class image_converter:
def __init__(self):
# sel... |
# -*- coding: utf-8 -*-
# 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... |
# Test driver for bsddb package.
"""
Run all test cases.
"""
import os
import sys
import tempfile
import time
import unittest
from test.test_support import requires, run_unittest, import_module
# Skip test if _bsddb module was not built.
import_module('_bsddb')
# Silence Py3k warning
import_module('bsddb', deprecated=... |
from _pytest.pytester import Pytester
def test_no_items_should_not_show_output(pytester: Pytester) -> None:
result = pytester.runpytest("--fixtures-per-test")
result.stdout.no_fnmatch_line("*fixtures used by*")
assert result.ret == 0
def test_fixtures_in_module(pytester: Pytester) -> None:
p = pytes... |
#!/usr/bin/env python3
"""
Common test run patterns
"""
from datetime import datetime
from clusters import NullCluster
from pre_tests import NullPreTest
from ci_tests import NullTest
from post_tests import NullPostTest
class ClusterTestSetsRunner:
"""A cluster test runner that runs multiple sets of pre, test & ... |
# Copyright 2021 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 agreed to in writing, ... |
import rlp
import binascii
from ethereum.utils import (
normalize_address,
hash32,
trie_root,
big_endian_int,
address,
int256,
encode_hex,
encode_int,
big_endian_to_int,
int_to_addr,
zpad,
parse_as_bin,
parse_as_int,
decode_hex,
sha3,
is_string,
is_num... |
from nboost.plugins.models import resolve_model
from nboost import defaults
import unittest
import numpy as np
class TestPtBertRerankModelPlugin(unittest.TestCase):
def setUp(self):
self.model = resolve_model(
model_dir='onnx-bert-base-msmarco',
data_dir=defaults.data_dir,
... |
#! /usr/bin/python -u
from __future__ import print_function
from datetime import *
import os
import RPi.GPIO as GPIO
import scheduler
import signal
import smtplib
import sqlite3
import subprocess
import sys
import time
import forecastio
import tempSensor
__version__ = 2.3
# set working directory to where "thermos_da... |
from nose.tools import eq_
from pyecharts import options as opts
from pyecharts.charts import Bar, Grid, Line
def _chart_for_grid() -> Bar:
x_data = ["{}月".format(i) for i in range(1, 13)]
bar = (
Bar()
.add_xaxis(x_data)
.add_yaxis(
"蒸发量",
[2.0, 4.9, 7.0, 23.2... |
"""
Copyright (c) 2019, Matt Pewsey
"""
import attr
import numpy as np
import matplotlib.pyplot as plt
from .spatial_hash import SpatialHash
__all__ = ['Alignment']
@attr.s(hash=False)
class Alignment(object):
"""
A class representing a survey alignment.
Parameters
----------
name : str
... |
from typing import Callable, Dict, List, Union
import dgl
import dgl.nn.pytorch as dglnn
import torch
import torch.nn as nn
class RelGraphEmbedding(nn.Module):
def __init__(
self,
hg: dgl.DGLHeteroGraph,
embedding_size: int,
num_nodes: Dict[str, int],
node_feats: Dict[str,... |
# 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... |
# -*- coding: utf-8 -*-
# Copyright (c) 2018, PT DAS and Contributors
# See license.txt
from __future__ import unicode_literals
import frappe
import unittest
class TestTambang(unittest.TestCase):
pass |
from ideas.examples import switch
from ideas.import_hook import remove_hook
def test_transform():
source = """
switch EXPR:
case EXPR_1:
SUITE
case EXPR_2:
SUITE
case in (EXPR_3, EXPR_4, ...):
SUITE
else:
... |
# coding: utf-8
"""
validateapi
The validation APIs help you validate data. Check if an E-mail address is real. Check if a domain is real. Check up on an IP address, and even where it is located. All this and much more is available in the validation API. # noqa: E501
OpenAPI spec version: v1
Gen... |
"""Functions to work with matrix and transformations"""
import math
from pymel import util
from pymel.core import datatypes, nodetypes
from . import vector
#############################################
# TRANSFORM
#############################################
def getTranslation(node):
"""Return the position o... |
# ------------------------------
# 589. N-ary Tree Preorder Traversal
#
# Description:
# Given an n-ary tree, return the preorder traversal of its nodes' values.
# For example, given a 3-ary tree:
# Return its preorder traversal as: [1,3,5,6,2,4].
# Note: Recursive solution is trivial, could you do it iteratively?
# ... |
version https://git-lfs.github.com/spec/v1
oid sha256:3348198148bbe54d8b7ff5d3e8ed868e45a258d2922323ff5915ff307ab28bf0
size 7907 |
# A DatasetStore can be used to create and retrieve IPTK Datasets
from iptk import DatasetStore
ds = DatasetStore("test_store/")
# Each IPTK dataset needs a unique identifier. Using the SHA1 hash of a unique
# descriptor of the files in the dataset is strongly recommended. For DICOM
# data, the SeriesInstanceUID field... |
from geopy.geocoders import Nominatim
geolocator = Nominatim(user_agent="appleWebKit/537.36 (KHTML, like Gecko) Chrome/101.0.4951.54 Mobile Safari/537.36")
location = geolocator.geocode("jugovzhodna Slovenija", geometry="wkt")
geometry = location.raw["geotext"].replace("POLYGON((", "").replace("))", "")
geometry = ge... |
"""
目前的服务主要是请求本地的一个接口,以及微信获取open_id的接口
因此,使用连接池理论上会有更好的性能
tornado没有自带的连接池,只好上aiohttp了
"""
from typing import Optional
import aiohttp
from config import connection_config
from util import UtilError
_client = None
async def init() -> None:
global _client
if _client is not None:
return
# client对象... |
# coding=utf-8
import os
import shutil
import numpy as np
import tensorflow as tf
from scipy.sparse import coo_matrix
#######################################################################################################################
## GRAPH OBJECT CLASS ########################################################... |
#!/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 licenses this file
to you under the Apache License, Version 2.0 (the
"License")... |
#!/usr/bin/env python3
# Copyright (c) 2015-2019 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test the setban rpc call."""
from test_framework.test_framework import BitcoinTestFramework
from test_... |
#!/usr/bin/env python3
from telegram import Update
from telegram.ext import (
Updater,
CommandHandler,
CallbackContext,
MessageHandler,
Filters,
CallbackQueryHandler,
)
import telegram
import sys
from datetime import datetime
import pytz
# Us
from scraper import get_bloodstocks
from strings imp... |
# encoding=utf8
import cgi
import urlparse
import copy
import json
import time
from django.test import TestCase
from django.test.utils import override_settings
from django.core.urlresolvers import reverse
from django.core.cache import get_cache
from django.conf import settings
from django.http import HttpResponseRedire... |
# -*- coding: utf-8 -*-
import hmac
import hashlib
import time
from . import utils
from .compat import urlquote, to_bytes, is_py2
from .headers import *
import logging
from .credentials import StaticCredentialsProvider
AUTH_VERSION_1 = 'v1'
AUTH_VERSION_2 = 'v2'
logger = logging.getLogger(__name__)
def make_auth(... |
# -*- encoding: utf-8 -*-
# Copyright (c) 2020 Stephen Bunn <stephen@bunn.io>
# ISC License <https://choosealicense.com/licenses/isc>
"""
"""
from string import printable
from typing import Optional
import pytest
from hypothesis import given
from hypothesis.strategies import SearchStrategy, composite, from_regex, in... |
from unittest.mock import patch
from lego.apps.articles.models import Article
from lego.apps.comments.models import Comment
from lego.apps.comments.notifications import CommentNotification, CommentReplyNotification
from lego.apps.users.models import User
from lego.utils.test_utils import BaseTestCase
@patch('lego.ut... |
num1 = input('Ingrese el numero 1 ')
num2 = input('Ingrese el numero 2 ')
num3 = input('Ingrese el numero 3 ')
def multiplicacion(num1,num2,num3):
resultado = num1 * num2
if(num3 > num1):
print('El numero %s es mayor a %s' %(num3,num1))
elif(num3 < num1):
print('El numero %s es men... |
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
import numpy as np
from pyspark.sql import Window
from pyspark.sql.functions import col, row_number, broadcast, rand
from reco_utils.common.constants import (
DEFAULT_ITEM_COL,
DEFAULT_USER_COL,
DEFAULT_TIMESTAM... |
# --------------
#Code starts here
def palindrome(num):
l=[]
t=num
while t>0:
l.append(t%10)
t=t//10
l.reverse()
tlen=len(l)
if l.count(9)==tlen:
return num+2
else:
return smallPalin(l,tlen)
def smallPalin(lis,n):
mid=n//2
left=mid-1
npalin=False
... |
import subprocess
def du(path):
du = subprocess.run(["du", "-sb", path], stdout=subprocess.PIPE)
# Decode binary string, split return and fetch first entry
# in array which is the size in bytes
size = du.stdout.decode().split()[0]
return size
def du_remote(host, path):
du = subprocess.run(["... |
# Copyright The PyTorch Lightning 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 agreed to i... |
from os.path import (
realpath,
join,
)
from typing import List
from hummingbot import get_strategy_list
# Global variables
required_exchanges: List[str] = []
# Global static values
KEYFILE_PREFIX = "key_file_"
KEYFILE_POSTFIX = ".json"
ENCYPTED_CONF_PREFIX = "encrypted_"
ENCYPTED_CONF_POSTFIX = ".json"
GLOB... |
from pprint import pprint as pp
from character_tracker.character import Character
from character_tracker.utils import validate_option_choice, get_int_input
class Initiate(Character):
def __init__(self):
super().__init__()
def get_me_some_gear(self):
pass
def show_me_the_moves(self):
... |
# -*- coding:utf-8 -*-
"""
License SYPH-L.
Copyright (c) 2013- SYPH(Shaohan Niu), All Rights Reserved.
-----------------------------------------------------------
Author:
Date: 2016/12/22
Change Activity:
"""
import os
import base64
import json
import pyDes
from Crypto.Hash import SHA
from C... |
import FWCore.ParameterSet.Config as cms
# This modifier is for HE-specific changes for sim, reco, etc.
run2_HE_2018 = cms.Modifier() |
"""
Created on 9 Dec 2020
@author: Bruno Beloff (bruno.beloff@southcoastscience.com)
The A4CalibratedDatum is designed to provide a model training data set that encapsulates the calibration of the
electrochemical sensor - we_v_zero_x_cal is only relevant to sensors with NO2 cross-sensitivity.
example document:
{"weV... |
import argparse
import numpy as np
from pathlib import Path
import cv2
from model import get_model
# from noise_model import get_noise_model
MAX_8BIT = 255.
MAX_16BIT = 65535.
def get_args():
parser = argparse.ArgumentParser(description="Test trained model",
formatter_class=ar... |
import numpy as np
from numpy import*
import csv
# def traceBack(matchList, s, t, src, tgt, dTable, btTable):
# if btTable[s][t] == " ":
# return
# #print(str(s) + ", " + str(t))
# if btTable[s][t] == "DI":
# traceBack(matchList, s - 1, t - 1, src, tgt, dTable, btTable)
# #if dTabl... |
"""Pytorch GauGAN implementation.
Either segmentation one hot mask or rgb mask can be passed to discriminator with little modification.
Todo
- Modify to try to generate and match mask also as loss.
- Try discriminator with either segmentation image or label.
- Use multiscale feature from discriminator to ... |
from typing import Dict, List, Optional
from pathlib import Path
from zorro import configs
def get_group2model_output_paths(group_names: List[str],
phenomenon: str,
paradigm: str,
step: str = '*',
... |
# Copyright (c) 2010 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""A generator for initializing_coclass.h, which contains a bunch of
repeated code that can't be produced through the preprocessor."""
import sys
from st... |
# -*- coding: utf-8 -*-
"""
Tests that dialects are properly handled during parsing
for all of the parsers defined in parsers.py
"""
import csv
from pandas import DataFrame
from pandas.compat import StringIO
from pandas.errors import ParserWarning
import pandas.util.testing as tm
class DialectTests(object):
... |
# Author: Kelvin Lai <kelvin@firststreet.org>
# Copyright: This module is owned by First Street Foundation
# Standard Imports
import logging
# Internal Imports
from firststreet.api import csv_format
from firststreet.api.api import Api
from firststreet.errors import InvalidArgument
from firststreet.models.adaptation i... |
from datetime import datetime, timedelta
import numpy as np
import pytest
from pandas.errors import UnsupportedFunctionCall
from pandas import (
DataFrame,
DatetimeIndex,
MultiIndex,
Series,
Timedelta,
Timestamp,
date_range,
period_range,
to_datetime,
to_timedelta,
)
import pa... |
# -*- coding: utf-8 -*-
from scrapy.linkextractors import LinkExtractor
from scrapy.spiders import Rule
from . import GenericSpider
class BearbrickSpider(GenericSpider):
name = 'bearbrick'
allowed_domains = ['bearbrick.com']
rules = (
# Match each product in product list.
Rule(
... |
# Copyright 2013 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import mimetypes
import os
from compiled_file_system import SingleFile
from directory_zipper import DirectoryZipper
from docs_server_utils import ToUnicode
... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import re
import shutil
import time
from importlib import import_module
import chainer
import yaml
from chainer import iterators
from chainer import serializers
from chainer import training
from chainer.training import extensions
from chainer.training import tri... |
from django.conf import settings
from django.conf.urls import include, url
from django.conf.urls.static import static
from django.contrib import admin
from django.views import defaults as default_views
from lightning_plus.puzzle.urls import urlpatterns as puzzle_urls
from lightning_plus.graphql.admin.view import graph... |
# -*- coding: utf-8 -*-
"""
Title: Sending Contigs to Nucmer
Created on Tue Aug 13 2019
@author: Eric
@email: ericyoung7@gmail.com
"""
import glob, os
import pandas as pd
from Bio import SeqIO
from pymummer import nucmer
from pathlib import Path
path_to_file = "pilon.fasta"
path = Path(path_to_file)
short_contigs = ... |
"""The tests the for Locative device tracker platform."""
from unittest.mock import patch, Mock
import pytest
from homeassistant import data_entry_flow
from homeassistant.components import locative
from homeassistant.components.device_tracker import \
DOMAIN as DEVICE_TRACKER_DOMAIN
from homeassistant.components.... |
# -*- coding: utf-8 -*-
"""
Azure Resource Manager (ARM) Compute Virtual Machine Execution Module
.. versionadded:: 1.0.0
.. versionchanged:: 2.0.0
:maintainer: <devops@eitr.tech>
:configuration: This module requires Azure Resource Manager credentials to be passed as keyword arguments
to every function or via ac... |
def selection_sort(arr):
# For every slot in array
for fillslot in range(len(arr)-1,0,-1):
positionOfMax=0
# For every set of 0 to fillslot+1
for location in range(1,fillslot+1):
# Set maximum's location
if arr[location]>arr[positionOfMax]:
... |
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: Apache-2.0
"""
Purpose
Shows how to use the AWS SDK for Python (Boto3) with Amazon Kinesis and version 2 of
the Amazon Kinesis Data Analytics API to create an application that reads data from
an input stream, uses SQL code... |
# -*- coding: utf-8 -*-
#------------------------------------------------------------------------------
# file: $Id$
# auth: Philip J Grabner <grabner@cadit.com>
# date: 2013/10/29
# copy: (C) Copyright 2013 Cadit Health Inc., All Rights Reserved.
#-----------------------------------------------------------------------... |
from typing import List, Optional, Tuple
import logging
from blspy import G2Element
from chia.consensus.coinbase import pool_parent_id
from chia.pools.pool_puzzles import (
create_absorb_spend,
solution_to_pool_state,
get_most_recent_singleton_coin_from_coin_spend,
pool_state_to_inner_puzzle,
creat... |
import getpass
import sys
import urllib2
import json
import smtplib
import time
from email.mime.text import MIMEText
print "\nLoging into your mail server...\n"
EMAIL = raw_input("Email address: ")
PWD = getpass.getpass("Email password: ")
# IFTT trigger email
REC = 'trigger@applet.ifttt.com'
SUBJECT = 'TradeAlert!'
... |
"""
Build navaid coordinate map
"""
import json
from pathlib import Path
import httpx
# redirect https://ourairports.com/data/navaids.csv
URL = "https://davidmegginson.github.io/ourairports-data/navaids.csv"
OUTPUT_PATH = Path(__file__).parent / "files" / "navaids.json"
def main():
"""Builds the navaid coordina... |
import argparse
import copy
import matplotlib.pyplot as plt
import seaborn as sns
import openmldefaults
import os
import pandas as pd
# sshfs jv2657@habanero.rcs.columbia.edu:/rigel/home/jv2657/experiments ~/habanero_experiments
def parse_args():
parser = argparse.ArgumentParser()
parser.add_argument('--datas... |
class Encoder(object):
"""
Base class for a encoder employing an identity function.
Args:
enforce_reversible (bool, optional): Check for reversibility on ``Encoder.encode`` and
``Encoder.decode``. Formally, reversible means:
``Encoder.decode(Encoder.encode(object_)) == object_``... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.