text stringlengths 2 999k |
|---|
import random
from kmeans import KMeans
locations = [[1, 1], [11, 11], [1, 2], [11, 12], [2, 1],
[12, 11], [1, 3], [11, 13], [3, 1], [13, 11],
[2, 2], [12, 12]]
random.seed(0)
clusterer = KMeans(2)
assignments = clusterer.train(locations)
print(clusterer.means)
print(assignments)
|
#!/usr/bin/env python
import xml.etree.ElementTree as et
import re
from sqlalchemy.orm import sessionmaker
from sqlalchemy import create_engine
from ayahbox import *
from ayahboxtransform import *
class QuranFile(object):
"""
Used to enumerate a file with quran ayah data and
"""
def __init__(self, f... |
# (c) 2015, Jonathan Davila <jdavila(at)ansible.com>
# (c) 2017 Ansible Project
# 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
DOCUMENTATION = """
lookup: hashi_vault
author: Jonat... |
import os
from distutils.core import setup
from setuptools import find_packages
VERSION = __import__("twitterfeed").VERSION
CLASSIFIERS = [
'Framework :: Django',
'Intended Audience :: Developers',
'License :: OSI Approved :: BSD License',
'Operating System :: OS Independent',
'Topic :: Software ... |
from dataclasses import dataclass
import logging
import threading
import time
import traceback
from pathlib import Path
from typing import Any, Callable, Dict, List, Optional, Set, Tuple
from concurrent.futures.thread import ThreadPoolExecutor
from blspy import G1Element
from chiapos import DiskProver
from aedge.cons... |
"""Utilities for writing code that runs on Python 2 and 3"""
# Copyright (c) 2010-2015 Benjamin Peterson
#
# 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 with... |
import json
import uuid
class Job:
def __init__(self, name):
self.jobId = str(uuid.uuid4())
self.jobName = name
self.appName = None
self.globalParameters = {}
self.enabled = True
self.executeBatch = 0
self.crontab = '*/5 * * * * ?'
self.tasks = []
... |
"""
Collates information for, and writes MESS files for rate calculations
"""
import mess_io
from mechroutines.models import build, blocks
def make_messpf_str(temps, spc_dct, spc_name, spc_locs,
pes_mod_dct_i, spc_mod_dct_i,
run_prefix, save_prefix):
""" Reads and processe... |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.8 on 2019-03-07 18:24
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('shows', '0007_auto_20171119_1722'),
]
operations =... |
# OpenWeatherMap API Key
api_key = "ef5e0e355ae0bcbb30cbb19d0a2314c8"
|
game_board = ['_'] * 9
print(game_board[0] + '|' + game_board[1] + '|' + game_board[2])
print(game_board[3] + '|' + game_board[4] + '|' + game_board[5])
print(game_board[6] + '|' + game_board[7] + '|' + game_board[8])
while True:
pos = input('Pick a number from 0-8')
pos = int(pos)
game_board[pos] = 'X'
... |
""" This script will test the submodules used by the scattering module"""
import torch
import os
import io
import numpy as np
import pytest
from kymatio import HarmonicScattering3D
from kymatio.scattering3d.utils import generate_weighted_sum_of_gaussians
backends = []
skcuda_available = False
try:
if torch.cuda.... |
import motor.motor_asyncio
from fastapi import FastAPI
from fastapi_users import FastAPIUsers, models
from fastapi_users.authentication import JWTAuthentication
from fastapi_users.db import MongoDBUserDatabase
DATABASE_URL = "mongodb://localhost:27017"
SECRET = "SECRET"
class User(models.BaseUser):
pass
class ... |
from django.contrib.auth import get_user_model
from django.test import TestCase, Client
from django.shortcuts import reverse
from .models import Tag
class TagModelTestCase(TestCase):
def setUp(self):
self.tag = Tag.objects.create(name='example')
def test_model_created_object(self):
tags = Ta... |
# 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 ... |
import argparse
import re
from string import printable
from textwrap import dedent
from .constants import (
LIVESTREAMER_VERSION, STREAM_PASSTHROUGH, DEFAULT_PLAYER_ARGUMENTS
)
from .utils import find_default_player
_filesize_re = re.compile("""
(?P<size>\d+(\.\d+)?)
(?P<modifier>[Kk]|[Mm])?
(?:[Bb]... |
import json
import os
import os.path
from urllib.request import *
def getvehcats(file):
""" Get vehicle indices from different coco object categories """
vehicles = {}
for i in file['categories']:
if i['supercategory'] == 'vehicle' and i['name'] not in 'boatairplane':
vehicl... |
# Copyright (c) 2021 Christopher Taylor
#
# Distributed under the Boost Software License, Version 1.0. (See accompanying
# file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
#
from .collectives import *
|
import datetime
import fastavro
import json
import pandas
import six
from .client import Client
from .company import Company
from .data_group import DataGroup, DataGroupColumn
from .datasource import Datasource
from .errors import DataMonsterError
__all__ = ["DataMonster", "DimensionSet"]
class DataMonster(object):... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import re
import django.contrib.auth.models
import django.core.validators
import django.utils.timezone
from django.conf import settings
from django.db import migrations, models
import waldur_core.core.fields
import waldur_core.core.models
class Migrat... |
import unittest
from unittest.mock import Mock
from guet.commands.command import Command
from guet.executor import Executor
from guet.factory import CommandFactory
class TestExecutor(unittest.TestCase):
def test_init_loads_command_factory_by_default(self):
executor = Executor()
self.assertIsNo... |
# Copyright (c) 2021, NVIDIA CORPORATION. All rights reserved.
# Copyright 2015 and onwards 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/license... |
# -*- coding: utf-8 -*-
"""materiapps.ipynb
Automatically generated by Colaboratory.
"""
!wget https://sf.net/projects/materiappslive/files/Debian/sources/setup.sh
!sh setup.sh
!apt-get install akaikkr task-alps bsa dsqss ermod feram fermisurfer gamess-setup hphi lammps mvmc openmx paraview quantum-espresso respack v... |
import os
import pyBigWig
import re
import tempfile
from collections import Counter
from warnings import warn
import HTSeq
import numpy as np
import pybedtools
import pysam
from scipy.stats import binned_statistic
class SimpleFeature(object):
def __init__(self, chrom, start, end, value, strand):
self.chr... |
# -*- coding: utf-8 -*-
# Copyright (C) 2010-2016 Mag. Christian Tanzer All rights reserved
# Glasauergasse 32, A--1130 Wien, Austria. tanzer@swing.co.at
# ****************************************************************************
# This module is part of the package GTW.OMP.EVT.
#
# This module is licensed under the... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
import pygmsh
from helpers import compute_volume
def test():
geom = pygmsh.built_in.Geometry()
lcar = 0.1
circle = geom.add_circle([0.5, 0.5, 0.0], 1.0, lcar)
triangle = geom.add_polygon(
[
[2.0, -0.5, 0.0],
[4.0, -0.5... |
import fresh_tomatoes
import media
toy_story = media.Movie("Toy Story",
"A story of a boy and his toys that come to life",
"http://upload.wikimedia.org/wikipedia/en/1/13/Toy_Story.jpg",
"https://www.youtube.com/watch?v=vwyZH85NQC4")
#print(toy_sto... |
from django.db import models
# Create your models here.
class Cliente(models.Model):
ID_cliente = models.AutoField(primary_key=True)
nome_cliente = models.CharField(max_length=100, verbose_name="Nome:")
cpf = models.CharField(max_length=14, verbose_name="CPF:")
def __str__(self):
return self.... |
import os
import sys
from argparse import ArgumentParser
import logging
import json
import time
import numpy as np
sys.path.append(os.path.dirname(os.path.abspath(__file__)))
from annotation import Annotation
ROOT_DATA_PATH="/claraDevDay/Data/DP_CAMELYON16/"
TRAIN_ANO_PATH = ROOT_DATA_PATH+"/jsons/train"
VALID_ANO... |
# Copyright 2013-2021 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
import os
from spack import *
class Turbine(AutotoolsPackage):
"""Turbine: The Swift/T runtime"""
homepage = ... |
"""
PSD Image module.
"""
from __future__ import absolute_import, unicode_literals
import logging
from psd_tools.api import adjustments
from psd_tools.api import deprecated
from psd_tools.api import pil_io
from psd_tools.api.layers import (Group, PixelLayer, ShapeLayer, SmartObjectLayer, TypeLayer, GroupMixin)
from p... |
import numpy as np
import math
import pdb
class Obstacle:
def __init__(self, args, track_id, bb):
self.args = args
self.car_length = bb[0]
self.car_width = bb[1]
self.track_id = track_id
def get_obstacle_cost_derivatives(self, npc_traj, i, ego_state):
a = self.car_len... |
def foo_bar(a, test, test_other):
for x in range(test_other + test):
print(x, a)
def simple_function(a):
test = 1
test_other = 11
foo_bar(a, test, test_other)
|
import sys
import logging
import dramatiq
from redis.exceptions import RedisError
from tom_education.models import (
AsyncError, ASYNC_STATUS_FAILED, PipelineProcess
)
logger = logging.getLogger(__name__)
def task(**kwargs):
"""
Decorator that wraps dramatiq.actor, but runs tasks synchronously during
... |
from __future__ import annotations
from collections import UserDict
from typing import Any, Callable
import json
import copy
class PathDict(UserDict):
"""
PathDict wraps a dict, with extra functions like
working with paths.
"""
# FIX wrong behavior of standard library
# <a>.pop(<b>, None) returns key erro... |
import os
import subprocess
from typing import List, Union
import numpy as np
import pandas as pd
from .parse_result import output2dict
dir_script = os.path.dirname(os.path.realpath(__file__))
BINFILEPATH = os.path.abspath(dir_script+'/bin/mican')
class Alignment:
"""
MICAN alignment class
Attributes
... |
from injector import inject
from backend_application.repository import DatabaseRepository
class ProjectService:
@inject
def __init__(self, repository: DatabaseRepository):
self.repository = repository
"""
returns project relevant data, like application
domains, projects per application d... |
from sqlalchemy.orm import Session, Query
import models, schemas
from typing import List
def get_post_by_id(id: int, db: Session) -> Query:
"""
get_post_by_id takes the post from database by its id.
:param id: id of post to get.
:param db: database session.
:return: first result of session quer... |
import datetime
from datetime import date, datetime, timedelta
from django.contrib import messages
from django import forms
from django.contrib.auth import authenticate, login
from django.contrib.auth.decorators import login_required
from django.http import HttpResponse, HttpResponseRedirect
from django.shortc... |
# pipeline example modified from David Johnson of the Michigan SPIDER team's GRASTA low-rank example, originally at
# https://raw.githubusercontent.com/dvdmjohnson/d3m_michigan_primitives/master/spider/pipelines/unsupervised_learning_grasta.py
from d3m.metadata import pipeline as meta_pipeline
from d3m.metadata.base ... |
# -*- coding: utf-8 -*-
class GrabberBase(object):
def __init__(self, headers=None, proxy=False):
if proxy:
self.proxies = {"http": "socks5://127.0.0.1:1080", 'https': 'socks5://127.0.0.1:1080'}
else:
self.proxies = {}
self.proxy = proxy
if headers is None:
... |
import torch
import numpy as np
def fit(train_loader, val_loader, model, loss_fn, optimizer, scheduler, n_epochs, cuda, log_interval, metrics=[],
start_epoch=0):
"""
Loaders, model, loss function and metrics should work together for a given task,
i.e. The model should be able to process data outpu... |
import statistics
class Analyzer:
#--------------------------------------------------------------------------------
def __init__(self):
self.temperature_list_celcius = []
self.temperature_list_fahrenheit = []
self.humidity_list = []
#-------------------------------... |
# Copyright 2019 Fortinet, Inc.
#
# 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 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the... |
from django.db import models
from django.utils.translation import ugettext_lazy as _
from taggit.managers import TaggableManager
from wagtail.admin.edit_handlers import FieldPanel
from wagtail.images.edit_handlers import ImageChooserPanel
from wagtail.snippets.models import register_snippet
@register_snippet
class Vo... |
# -*- coding: utf-8 -*-
#
# This class was auto-generated from the API references found at
# https://support.direct.ingenico.com/documentation/api/reference/
#
from ingenico.direct.sdk.data_object import DataObject
class SessionResponse(DataObject):
__asset_url = None
__client_api_url = None
__client_ses... |
# Criado para o meu desenvolvimento com esse fremawork, minha maneira de aumentar o desempenho dos estudos descrevendo
# todos os passos que eu fiz ate chegar ao ponto desejado da criacao do blog
# A leitura da pasta projeto_blog.txt naos esta em ordem apresentado mas tambem contem todos os passos menos detalhados. |
# Copyright (C) 2020 GreenWaves Technologies, SAS
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
# This progr... |
# -*- coding: utf-8 -*-
"""Program used to daemonize the worker.
Using :func:`os.execv` as forking and multiprocessing
leads to weird issues (it was a long time ago now, but it
could have something to do with the threading mutex bug)
"""
from __future__ import absolute_import, unicode_literals
import argparse
import c... |
load("@build_stack_rules_proto//scala:scala_grpc_compile.bzl", "scala_grpc_compile")
load("@io_bazel_rules_scala//scala:scala.bzl", "scala_library")
def scala_grpc_library(**kwargs):
name = kwargs.get("name")
deps = kwargs.get("deps")
visibility = kwargs.get("visibility")
name_pb = name + "_pb"
s... |
# coding: utf-8
"""
ORY Hydra
Welcome to the ORY Hydra HTTP API documentation. You will find documentation for all HTTP APIs here. # noqa: E501
The version of the OpenAPI document: v1.7.4
Generated by: https://openapi-generator.tech
"""
import pprint
import re # noqa: F401
import six
from ory_h... |
import RPi.GPIO as GPIO
import time
# Default pin allocations
TRIG = 2
ECHO = 3
#Function block to measure Distance
def get_distance(trigger_pin = TRIG, echo_pin = ECHO):
GPIO.setwarnings(False)
# Use BCM Mode for pin numbering
GPIO.setmode(GPIO.BCM)
#Set Trigger pin as output and echo pin as input... |
#!/usr/bin/env python
#**************************************************************************#
# Filename: py_rev_shel.py (Created: 2016-08-18) #
# (Updated: 2016-10-02) #
# Info: ... |
"""M1 for data processing from native CFD files (OpenFOAM, Ansys Fluent)"""
# an example of post-processing state file from ParaView
# trace generated using paraview version 5.8.0
#
# To ensure correct image size when batch processing, please search
# for and uncomment the line `# renderView*.ViewSize = [*,*]`
... |
import json
with open("src/assets/app.settings.json", "r") as f:
setting = json.load(f)
class bcolors:
HEADER = '\033[95m'
OKBLUE = '\033[94m'
OKCYAN = '\033[96m'
OKGREEN = '\033[92m'
WARNING = '\033[93m'
FAIL = '\033[91m'
ENDC = '\033[0m'
BOLD = '\033[1m'
UNDERLINE = '\033[4m... |
#!/usr/bin/env python3
#
# Copyright (c) 2016, The OpenThread Authors.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# 1. Redistributions of source code must retain the above copyright
# ... |
from __future__ import absolute_import
# Copyright (c) 2010-2018 openpyxl
# Python stdlib imports
from datetime import (
time,
datetime,
date,
)
# 3rd party imports
import pytest
# package imports
from openpyxl.comments import Comment
from openpyxl.cell.cell import ERROR_CODES
@pytest.fixture
def Dum... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import torch
import numpy as np
from models.losses import FocalLoss, L1Loss, BinRotLoss
from models.decode import ddd_decode
from models.utils import _sigmoid
from utils.debugger import Debugger
from utils.pos... |
# -*- coding: utf-8 -*-
'''
Functions to interact with Hashicorp Vault.
:maintainer: SaltStack
:maturity: new
:platform: all
:note: If you see the following error, you'll need to upgrade ``requests`` to atleast 2.4.2
.. code-block:: text
<timestamp> [salt.pillar][CRITICAL][14337] Pillar render err... |
"""
Copyright 2020 The OneFlow 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 law or agr... |
from pyapp import PyApp # noqa
if __name__ == "__main__":
app = PyApp()
app.run()
|
from conans import ConanFile, CMake, tools
class ENetConan(ConanFile):
name = "ENet"
version = "1.3.13"
settings = "os", "compiler", "build_type", "arch"
options = {"shared": [True, False]}
description = "Reliable UDP networking library"
default_options = "shared=False"
url = "https://gith... |
from sympy.core.numbers import comp, Rational
from sympy.physics.optics.utils import (refraction_angle, fresnel_coefficients,
deviation, brewster_angle, critical_angle, lens_makers_formula,
mirror_formula, lens_formula, hyperfocal_distance,
transverse_magnification)
from sympy.physics.optics.med... |
import os
import os.path
import tempfile
import contextlib
import subprocess
import shutil
import sys
from nose.tools import istest, nottest, assert_equal
import spur
import stickytape
from test_scripts import root as test_script_root
@istest
def single_file_script_still_works():
test_script_output(
scri... |
from pathlib import Path, PurePath
from .types import ProjectConfig, StaticAsset, FileId
from .page import Page
def test_project() -> None:
path = Path("test_data/bad_project")
project_config, project_diagnostics = ProjectConfig.open(path)
assert len(project_diagnostics) == 1
assert project_config.con... |
# -*- coding: utf-8 -*-
# FeedCrawler
# Projekt von https://github.com/rix1337
import datetime
import json
import re
from bs4 import BeautifulSoup
from feedcrawler import internal
from feedcrawler.common import check_hoster
from feedcrawler.common import check_is_site
from feedcrawler.common import check_valid_relea... |
# -*- coding: utf-8 -*
from copy import deepcopy
tree = {
'.': [
['bar_dir', 'baz_dir', 'foo_dir'],
['hello_world.py', 'README.md'],
],
'./bar_dir': [
['bar_dir_2'],
['bar_data.h5'],
],
'./bar_dir/bar_dir_2': [
['bar_dir_3'],
['bar_file.py'],
],
... |
import os
import logging
from nose.tools import assert_equal
from nose.plugins.skip import SkipTest
from ckan import plugins as p
from ckanext.qa.sniff_format import sniff_file_format, is_json, is_ttl, turtle_regex
logging.basicConfig(level=logging.INFO)
log = logging.getLogger('ckan.sniff')
class TestSniffFormat... |
from .main import sum_quantities, get_form, libraries_loaded
from . import box
|
from django.contrib.auth.models import Permission
from django.contrib.contenttypes.models import ContentType
from rest_framework import serializers
from apps.users.models import User
class PermissionSerialzier(serializers.ModelSerializer):
"""
用户权限表序列化器
"""
class Meta:
model=Permission
... |
#!/usr/bin/env python3
# Copyright (c) 2015-2018 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 new Bitevelin multisig prefix functionality.
#
from test_framework.test_framework import Bitcoi... |
from drf_yasg.inspectors import PaginatorInspector
from drf_yasg import openapi
from collections import OrderedDict
class PageNumberPaginatorInspectorClass(PaginatorInspector):
def get_paginated_response(self, paginator, response_schema):
paged_schema = openapi.Schema(
type=openapi.TYPE_OBJECT... |
# The MIT License (MIT)
#
# Copyright (c) 2015 Leon Jacobs
#
# 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, modif... |
from ctypes import *
from ctypes import util
from .runtime import send_message, ObjCInstance
from .cocoatypes import *
######################################################################
# CORE FOUNDATION
cf = cdll.LoadLibrary(util.find_library('CoreFoundation'))
kCFStringEncodingUTF8 = 0x08000100
CFAllocatorR... |
"""The tests for the Universal Media player platform."""
from copy import copy
import unittest
from homeassistant.const import (
STATE_OFF, STATE_ON, STATE_UNKNOWN, STATE_PLAYING, STATE_PAUSED)
import homeassistant.components.switch as switch
import homeassistant.components.media_player as media_player
import home... |
class LMS8001_CHANNEL_PD(object):
def __init__(self, chip, channel, cfgNo):
self.chip = chip
self.channel = channel
self.cfgNo = cfgNo
#
# Read channel PD
#
def __getattr__(self, name):
channel = self.__dict__["channel"]
cfgNo = self.__dict__["cfgNo"]
... |
# coding: utf-8
#
# Copyright 2018 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... |
# -*- coding: utf-8 -*-
"""
Created on Thu May 2 15:43:55 2019
@author: preet
"""
from graphTheory2 import Graph
g1 = { "a" : ["d"],
"b" : ["c"],
"c" : ["b", "c", "d", "e"],
"d" : ["a", "c"],
"e" : ["c"],
"f" : []
}
g2 = { "a" : ["d","f"],
"b" : ["c"],
"c" : ["b", "c", ... |
import turtle
import os
wn = turtle.Screen()
wn.title("Гоненица")
wn.bgcolor("#DFB9CA")
wn.setup(width=1200, height=400)
wn.tracer(0)
# pole
for kletka in range(1, 38):
# kvadratche
kvadratche = turtle.Turtle()
kvadratche.speed(0)
kvadratche.shape("square")
kvadratche.color("#F34616")
kvadr... |
# Licensed to Elasticsearch B.V. under one or more contributor
# license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright
# ownership. Elasticsearch B.V. licenses this file to you under
# the Apache License, Version 2.0 (the "License"); you may
# not use this f... |
"""Distutils based setup script for Biopython.
This uses Distutils (http://python.org/sigs/distutils-sig/) the standard
python mechanism for installing packages. For the easiest installation
just type the command:
python setup.py install
For more in-depth instructions, see the installation section of the
Biopython m... |
import asyncio
import functools
import inspect
import json
import math
import os
import random
import re
import sys
import threading
import time
import uuid
import warnings
from argparse import ArgumentParser, Namespace
from collections.abc import MutableMapping
from datetime import datetime
from itertools import islic... |
import json, math, itertools
from semi.CNetTrain import Tuples
from collections import defaultdict
class lastSys(object):
def __init__(self, config):
pass
def calculate(self, log_turn,log_input_key="batch"):
acts = log_turn["output"]["dialog-acts"]
out = defaultdict(float)
... |
from aoc import data
import parse
from collections import Counter
def part1(inputData):
# By sorting the endpoints all horizontal segments go left to right
# and all vertical segments go top to bottom
inputData = [sorted([(line['x1'], line['y1']), (line['x2'], line['y2'])]) for line in inputData]
visi... |
from .matplotlib_viewer import MPViewer
from .pygame_viewer import PygameViewer
from .panda3d_viewer import Panda3dViewer
from .video_renderer import VideoRenderer
from .viewer import BaseViewer
__all__ = ["MPViewer","PygameViewer","Panda3dViewer","VideoRenderer","BaseViewer"]
|
from stacker.blueprints.base import Blueprint
from troposphere import (
sns,
sqs,
Ref,
GetAtt,
Output,
)
from . import util
import awacs
import awacs.sqs
from awacs.aws import (
Policy,
Statement,
Condition,
ArnEquals,
Principal,
)
def queue_policy(sns_arn, sqs_arns):
s... |
import numpy as np
import pytest
import tensorflow as tf
from packaging import version
from deepctr.feature_column import SparseFeat, VarLenSparseFeat, DenseFeat, get_feature_names
from deepctr.models import DIEN
from ..utils import check_model
def get_xy_fd(use_neg=False, hash_flag=False):
feature_columns = [Sp... |
from datetime import datetime
from operator import itemgetter
from os.path import dirname, join
import pytest
from city_scrapers_core.constants import ADVISORY_COMMITTEE, PASSED
from city_scrapers_core.utils import file_response
from freezegun import freeze_time
from city_scrapers.spiders.wayne_mental_health_authorit... |
#!/usr/bin/env python3
from pydantic import BaseModel
class UserRepoSize(BaseModel):
user_name:str
repo_name:str
size:int |
import requests
import services
import colored
from colored import fg, bg, attr
# colours
green = fg('#5000b8') + bg('#000000')
cyan = fg('#274f44') + bg('#000000')
bold = '\033[1m'
underline = '\033[4m'
end = '\033[0m'
red = fg('#0000a1') + bg('#000000')
# header
print(" ")
print(" ")
print(... |
import unittest
import stactools.ga_nlcd
class TestModule(unittest.TestCase):
def test_version(self):
self.assertIsNotNone(stactools.ga_nlcd.__version__)
|
# generated from catkin/cmake/template/pkg.context.pc.in
CATKIN_PACKAGE_PREFIX = ""
PROJECT_PKG_CONFIG_INCLUDE_DIRS = "".split(';') if "" != "" else []
PROJECT_CATKIN_DEPENDS = "".replace(';', ' ')
PKG_CONFIG_LIBRARIES_WITH_PREFIX = "".split(';') if "" != "" else []
PROJECT_NAME = "rotator_gazebo"
PROJECT_SPACE_DIR = "... |
import day05
import sys
from timeit import default_timer as timer
lines = sys.stdin.readlines()
print("Read", len(lines), "lines")
day05 = day05.Day05(lines)
start1 = timer()
part1 = day05.solve_part_1_output()
end1 = timer()
print("Part 1 results is", part1, "in", end1 - start1, "seconds")
start2 = timer()
part2 =... |
#!/usr/bin/env python
import flask_migrate
import flask_script
from myapp.comm import send_update
from myapp.database import models
from myapp.database.adapter import db
from myapp.database.models import Update
from myapp.webserver.socketio import socketio
from myapp.webserver.webapp import webapp
manager = flask_s... |
#!/usr/bin/env python3
import rospy
from std_msgs.msg import String
from asa_ros_msgs.srv import FindAnchor
class AsaAnchorFindHelper:
def __init__(self):
rospy.init_node("asa_request_helper")
rospy.loginfo("Waiting for asa_ros/find_anchor serivce...")
rospy.Subscriber('spot/asa_ros/reques... |
# Copyright (c) 2020 PaddlePaddle 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 appli... |
#!/usr/bin/env python
from ansible_collections.terryhowe.hashivault.plugins.module_utils.hashivault import hashivault_argspec
from ansible_collections.terryhowe.hashivault.plugins.module_utils.hashivault import hashivault_auth_client
from ansible_collections.terryhowe.hashivault.plugins.module_utils.hashivault import h... |
# -*- coding:utf-8 -*-
# Create Date: 3/3/21, 5:18 PM
# Author: ming
# ---
# Last Modified: 3/3/21
# Modified By: ming
# ---
# Copyright (c) 2020 MARL @ SJTU
import logging
import os
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
LOG_DIR = os.path.join(BASE_DIR, "logs2")
LOG_LEVEL = logging.D... |
import numpy as np
import cv2
width = 256
height = 192
channels = 3
def prepare_image(imagePath):
X = []
X.append(cv2.resize(cv2.imread(imagePath, cv2.IMREAD_COLOR), (width, height), \
interpolation=cv2.INTER_AREA))
return np.array(X)
|
# -*- coding: utf-8 -*-
from __future__ import unicode_literals, absolute_import, division, print_function
from collections import namedtuple
from dateutil.parser import parse as parse_date
import requests
from lxml import etree
__all__ = ['get_current_tournaments', 'get_status', 'WEBSITE_URL', 'TOURNAMENTS_XML_URL'... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.