text stringlengths 1 927k |
|---|
#!/usr/bin/env python3
import bibtexparser as bp
import argparse
import re
def fix_journal(j):
"Attempt to canonicalize the journal name."
j = j.lower()
j = j.replace("," , "" )
j = j.replace("\&", "and")
j = re.sub(" *the *", " ", j).strip()
return j
def fix_abbrev(a):
"Encode the ab... |
from typing import Any, cast
from unittest.mock import MagicMock, Mock
import pandas
import pytest
from callee import String
from pytest_mock.plugin import MockerFixture
from tests.service_test_fixtures import ServiceTestFixture
from tests.utils import shuffled_cases
from the_census._config import Config
from the_cen... |
import os
import sys
import torch
import numpy as np
from tqdm import tqdm
from torch.utils.data import DataLoader
from neat_eo.core import load_config, check_classes, check_channels
from neat_eo.tiles import tiles_from_dir, tile_label_from_file, tiles_from_csv
def add_parser(subparser, formatter_class):
parser ... |
from typing import Tuple
import numpy as np
from games.level import Level
class Game:
"""
A game can be played (by a human/agent/etc).
It requires a level and has some rules.
"""
def __init__(self, level: Level):
self.level = level
self.current_pos = np.array([0, 0])
def... |
from typing import Union
import numpy as np
from numpy.lib.stride_tricks import sliding_window_view
from jesse.helpers import get_candle_source, slice_candles, same_length
def sinwma(candles: np.ndarray, period: int = 14, source_type: str = "close", sequential: bool = False) -> Union[
float, np.ndarray]:
""... |
#!/bin/python
#Generate one document showing precision/recall/fscores in a latex table.
#Pass as arguments CSV files generated using 'pminer-global-perf' command with -c ";" option.
#Can take as many files as required but ensure that there are only five graphs to avoid bugs (indeed, this script is made to handle 5 gra... |
#%%
from src.data import load_metagraph
import seaborn as sns
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
mg = load_metagraph("G", "2020-01-21")
is_pdiff = np.where(mg["is_pdiff"])[0]
mg = mg.reindex(is_pdiff)
degree_df = mg.calculate_degrees()
plt.figure()
melt_degree = pd.melt(
degre... |
cargos = {'ana' : 'vendedora',
'pedro': 'taxista',
'paulo' : 'garçom' }
for n in cargos:
print('%s : %s' % (n, cargos[n])) |
import sys
import cgi
import os
class Shapes():
def __init__(self, form, output):
self.form = form
self.output = output
def ovale(self, grid, size, pointsWH):
x = (size[0] // 5)
for i, array in enumerate(grid):
spacing_height = round(((pointsWH[1][1] - pointsWH[1][0]) / 2) - (size[1] / 2))
bottom_si... |
from cms.plugin_base import CMSPluginBase
from cms.plugin_pool import plugin_pool
from cms.models.pluginmodel import CMSPlugin
from django.utils.translation import ugettext_lazy as _
from .models import FAQSinglePluginModel, FAQCategoryPluginModel, FAQ
class FAQTOCPlugin(CMSPluginBase):
model = CMSPlugin
na... |
import colorama
import pkg_resources
import sys
import unicodedata
from bitstring import BitArray # pyright: reportMissingImports=false
from blspy import AugSchemeMPL, G1Element, PrivateKey # pyright: reportMissingImports=false
from chaingreen.util.hash import std_hash
from chaingreen.util.keyring_wrapper import Key... |
# Nimble Storage, Inc. (c) 2013-2014
# 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... |
import json
import requests
import logging.config
from dateutil.parser import parse
logging.config.fileConfig("logging.ini", disable_existing_loggers=False)
logger = logging.getLogger(__name__)
def nws_temp_time_series(lat, lon):
api_url = "https://api.weather.gov/points/" + str(lat) + "," + str(lon)
respons... |
import json
import math
import numpy as np
import time
import warnings
from webcolors import name_to_rgb, hex_to_rgb, rgb_to_hex
import ipywidgets as widgets
class Color:
def __init__(self, color=None):
if color is None:
self.r = self.g = self.b = 160
elif isinstance(color, Color):
... |
import torch
from torch import Tensor
from typing import Callable, Tuple
from paragen.utils.ops import local_seed
from paragen.modules.utils import create_padding_mask_from_length
from paragen.modules.search.abstract_search import AbstractSearch
"""
Args: window_size L
input: length [B], encoder_out [S * B * D], enco... |
from __future__ import annotations
from dataclasses import dataclass
from abc import abstractmethod
import sys
from typing import Dict, Tuple, Iterable, List
from typeguard import typechecked
from Data import DataPipelineOutput
_SURVEYPIPELINE = Dict[str, any] = {}
def register_surveypipeline(name):
"""Decora... |
#////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
# Name :
# Author : Avi
# Revision : $Revision: #10 $
#
# Copyright 2009- ECMWF.
# This software is licensed under the terms of the Apache Licence version 2.0
# which can be obtained at http://www.apache.org/licenses/LICENSE... |
from litex.tools.litex_client import RemoteClient
from litescope.software.driver.analyzer import LiteScopeAnalyzerDriver
wb = RemoteClient()
wb.open()
analyzer = LiteScopeAnalyzerDriver(wb.regs, "analyzer", debug=True)
analyzer.configure_subsampler(1) ## increase this to "skip" cycles, e.g. subsample
analyzer.confi... |
# -*- coding: utf-8 -*-
import re
from django.conf import urls
from django.urls import get_resolver
from django.utils.deprecation import MiddlewareMixin
from . import utils as maintenance
from .conf import settings
urls.handler503 = "maintenancemode.views.temporary_unavailable"
urls.__all__.append("handler503")
IG... |
import sys
from math import ceil
def main():
n, *capacity = map(int, sys.stdin.read().split())
max_peop = n
time = 0
for c in capacity:
time += ceil(max_peop / c)
if max_peop > c:
max_peop = c
print(time)
if __name__ == "__main__":
main() |
#!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
"""
Wav2letter decoders.
"""
import gc
import itertools as it
import os.path as osp
import warnings
from collections ... |
from setuptools import setup
setup(
name='tablesnap',
version='0.7.2',
author='Jeremy Grosser',
author_email='jeremy@synack.me',
url='https://github.com/JeremyGrosser/tablesnap',
scripts=[
'tablesnap',
'tableslurp',
'tablechop'
],
install_requires=[
'pyin... |
# coding=utf-8
# Copyright 2020 The TensorFlow Datasets Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appl... |
# coding=utf-8
from __future__ import unicode_literals
from collections import OrderedDict
import datetime
from django.core.management.base import BaseCommand
from django.contrib.admin.models import LogEntry
from django.contrib.contenttypes.models import ContentType
from legalaid.models import Case
class Command(Bas... |
"""
Suggested new question wording
Use subroutines where appropriate
Create an empty list and assign it to a global variable called numbersArray
Ask the user to input a number
cast this input to an integer
Add this integer to the next available index in the array
Add a try except block around the integer cast
set a boo... |
import os
import six
import yaml
from .component import Component
def get_exchange_item_mapping(items):
"""Construct a mapping for exchange items.
Parameters
----------
items : iterable
List of exchange item names or (*dest*, *src*) tuples.
Returns
-------
items : list
... |
# -*- coding: utf-8 -*-
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: monitoring/Alert.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_database as ... |
# forked from https://github.com/peterbe/django-cache-memoize
from functools import wraps
import hashlib
import inspect
import logging
import time
from django.core.cache import cache
from django.utils.encoding import force_bytes, force_text
logger = logging.getLogger('apps')
def timeit(fn):
@wraps(fn)
def t... |
from flask import (
Blueprint,
flash,
redirect,
render_template,
request,
url_for, current_app)
from flask_login import (
current_user,
login_required,
login_user,
logout_user,
)
from app import db
from app.account.forms import (
ChangeEmailForm,
ChangePasswordForm,
... |
"""Module to find real rooms in data and sum their sector IDs."""
def main():
"""Run the main function."""
with open('data/day4data.txt', 'r') as f:
dataList = f.readlines()
realRoomList = []
roomNames = []
sum = 0
for line in dataList:
data = line.strip("\n").split('-')
... |
"""
lakeFS API
lakeFS HTTP API # noqa: E501
The version of the OpenAPI document: 0.1.0
Contact: services@treeverse.io
Generated by: https://openapi-generator.tech
"""
import re # noqa: F401
import sys # noqa: F401
from lakefs_client.api_client import ApiClient, Endpoint as _Endpoint
from lak... |
from galaxy import web
from galaxy.web.base.controller import BaseAPIController
from galaxy.web.framework.helpers import is_true
def get_id(base, format):
if format:
return "%s.%s" % (base, format)
else:
return base
class GenomesController(BaseAPIController):
"""
RESTful controller f... |
#
# io_rgb.py -- RGB image file handling.
#
# This is open-source software licensed under a BSD license.
# Please see the file LICENSE.txt for details.
#
import sys
import time
import mimetypes
from io import BytesIO
import numpy as np
from ginga.BaseImage import Header, ImageError
from ginga.util import iohelper, rg... |
from behave import *
import json
from agent_backchannel_client import agent_backchannel_GET, agent_backchannel_POST, expected_agent_state
from agent_test_utils import format_cred_proposal_by_aip_version
from time import sleep
import time
# This step is defined in another feature file
# Given "Acme" and "Bob" have an e... |
MYSQL_HOST = "db-dev-marketvault.c3aprxswdrnw.us-east-2.rds.amazonaws.com" |
import attr
from abc import ABCMeta, abstractmethod
from attr.converters import optional as c_optional
from attr.validators import instance_of, optional as v_optional
from datetime import datetime, timedelta
from typing import List, Union, Type
from ics.attendee import Attendee
from ics.component import Component
from... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon Dec 16 09:29:30 2019
@author: m102324
Description
-----------
Plot Receiver operating characteristic (ROC) curves using K-fold cross-validation.
Format
-------
* 1st-column : sample ID (string)
* 2nd-column : binary label (intger, must be 0 or 1)
* 3rd... |
#encoding:utf-8
"""
Django settings for mysite project.
Generated by 'django-admin startproject' using Django 1.8.7.
For more information on this file, see
https://docs.djangoproject.com/en/1.8/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.8/ref/settings/
""... |
#!/usr/bin/env python3
# Copyright (c) 2009 Giampaolo Rodola'. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""
Generate MANIFEST.in file.
"""
import os
import subprocess
SKIP_EXTS = ('.png', '.jpg', '.jpeg')
SKIP_FILES = ('.cirrus.yml',... |
import logging
from typing import Dict, List, Iterable
import asyncio
import discord
from discord.ext import commands
import emoji
from .game import RideTheBus, GameState
from .result import Result
from utils import playingcards
logger = logging.getLogger(__name__)
COLOR = 0xFFFF00
ROUND_RULES = {
GameState.RE... |
# Copyright 2016-2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"). You
# may not use this file except in compliance with the License. A copy of
# the License is located at
#
# http://aws.amazon.com/apache2.0/
#
#
# or in the "license" f... |
# Copyright 2018 Heisenberg Quantum Simulations
# -*- 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... |
from model.contact import Contact
import random
def test_edit_some_contact_via_main_view_lastname(app, db, check_ui):
if len(db.get_contact_list()) == 0:
app.contact.add(Contact(firstname="faname", lastname="lname", address="address", homephone="1",
mobilephone="2", workpho... |
def do(action, value, acc, i):
if action == 'acc':
acc += value
elif action == 'jmp':
i += value - 1
elif action == 'nop':
pass
return acc, i
def run(instrs):
visited, acc, i = set(), 0, 0
while i < len(instrs):
if i in visited:
break
else:
... |
import psycopg2
import sqlite3
import os
from dotenv import load_dotenv
import pandas as pd
from sqlalchemy import create_engine
load_dotenv()
DB_NAME = os.getenv("DB_NAME")
DB_USER = os.getenv("DB_USER")
DB_PW = os.getenv("DB_PW")
DB_HOST = os.getenv("DB_HOST")
DB_URL = os.getenv("DB_URL")
df = pd.read_csv('titanic... |
import os
from rtxp.core import dsa
from rtxp.core import hashes
from rtxp.core import utils
_HASH_TX_SIGN = 'STX\0'
_HASH_TX_SIGN_TESTNET = 'stx\0'
def _get_signing_hash(blob, test=False):
prefix = _HASH_TX_SIGN_TESTNET if test else _HASH_TX_SIGN
return hashes.sha512half(prefix + blob)
def _sign_blob(blob, ro... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from datetime import datetime, date, timedelta
import calendar
def get_month_range(start_date=None):
if start_date is None:
start_date = date.today().replace(day=1)
_, days_in_month = calendar.monthrange(start_date.year, start_date.month)
end_date = st... |
import json
from database.database import Database, Inspector
class HIT:
def __init__(self, task_id=None, hit_id=None):
super().__init__()
if task_id is not None:
self.task_id = task_id
self.inspector = Inspector(task_id)
self.__dict__.update(self.info)
... |
"""
A setuptools-based setup module.
See:
https://github.com/hsheth2/avro_gen
"""
from setuptools import setup, find_packages
from codecs import open
from os import path
here = path.abspath(path.dirname(__file__))
# Get the long description from the README file
if path.exists(path.join(here, 'README.md')):
with... |
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import unicode_literals
import logging
import unittest
from mock import MagicMock
from mock import patch
from networkapi.ambiente.models import Ambiente
from networkapi.api_network.exceptions import IncorrectRedundantGatewayRegistryExcept... |
from datetime import datetime
from django.utils import tree
from django.utils.copycompat import deepcopy
class ExpressionNode(tree.Node):
"""
Base class for all query expressions.
"""
# Arithmetic connectors
ADD = '+'
SUB = '-'
MUL = '*'
DIV = '/'
MOD = '%%' # This is a quoted % o... |
# Circuit Playground Express Acceleration Logger
#
# Author: Carter Nelson
# MIT License (https://opensource.org/licenses/MIT)
import time
from adafruit_circuitplayground.express import cpx
TOTAL_TIME = 10 # seconds
COLORS = {
'RED' : ( 80, 0, 0),
'GREEN' : ( 0, 80, 0),
'BLUE' : ( 0, 0... |
# coding: utf-8
"""
RadioManager
RadioManager # noqa: E501
OpenAPI spec version: 2.0
Contact: support@pluxbox.com
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
import unittest
import radiomanager_sdk
from radiomanager_sdk.api.stor... |
from jsonrpc import ServiceProxy
import sys
import string
# ===== BEGIN USER SETTINGS =====
# if you do not set these you will be prompted for a password for every command
rpcuser = ""
rpcpass = ""
# ====== END USER SETTINGS ======
if rpcpass == "":
access = ServiceProxy("http://127.0.0.1:5888")
else:
access = Ser... |
from sqlalchemy.orm.session import sessionmaker, Session
from galaxy_crawler.models import v1 as model
from galaxy_crawler.models import engine
def create_session(e) -> 'Session':
return sessionmaker(bind=e)()
class ModelTestBase(object):
def setup_method(self):
self.engine = engine.get_in_memory_... |
from ._version import __version__
import sys
from odc.aws.dns import cli as dns_cli
def cli():
sys.exit(dns_cli(sys.argv[1:])) |
from setuptools import setup, find_packages
with open("README.md", "r") as stream:
long_description = stream.read()
setup(
name = 'Amino.py',
version = '2.0.3',
url = 'https://github.com/Slimakoi/Amino.py',
download_url = 'https://github.com/Slimakoi/Amino.py/tarball/master',
license = 'MIT',
... |
import setuptools
with open("README.md", "r") as fh:
long_description = fh.read()
setuptools.setup(
name="miniipe",
version="0.4.0",
author="Thomas van Dijk",
author_email="tvdmaps@gmail.com",
description="An easy, no-dependencies package for writing IPE files from Python.",
long_descripti... |
#! /usr/bin/env python
"""Luigi Tasks to perform various RNA seq functions, from Mapping to Counting.
Mapping is done using hisat2 and counting is done using featurecounts
and stringtie
"""
import os
import luigi
import sys
dir_path = os.path.dirname(os.path.realpath(__file__))
lib_path = os.path.abspath(os.path.joi... |
import sqlite3
with sqlite3.connect("sample.db") as connection:
c = connection.cursor()
c.execute("DROP TABLE posts")
c.execute("CREATE TABLE posts(title TEXT, description TEXT)")
c.execute('INSERT INTO posts VALUES("Good", "I\'m good.")')
c.execute('INSERT INTO posts VALUES("Well", "I\'m well.")') |
#!/usr/bin/python3
#
# Copyright (C) 2020 The Android Open Source Project
#
# 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 requir... |
# Licensed under a 3-clause BSD style license - see LICENSE.rst
from __future__ import (absolute_import, division, print_function,
unicode_literals)
import io
from ...tests.helper import pytest
from ..compat import gzip
pytestmark = pytest.mark.skipif(str("sys.version_info < (3,0)"))
def t... |
import os
import unittest
from elasticdl.python.common.model_helper import (
_get_spec_value,
get_model_spec,
get_module_file_path,
)
_model_zoo_path = os.path.dirname(os.path.realpath(__file__))
class ModelHelperTest(unittest.TestCase):
def test_get_model_spec(self):
(
model,
... |
from datetime import datetime
from injector import inject
from pdip.configuration.models.database import DatabaseConfig
from pdip.cqrs import ICommandHandler
from pdip.data import RepositoryProvider
from pdip.exceptions import OperationalException
from pdip.logging.loggers.database import SqlLogger
from scheduler.appl... |
from Backtest.main.Exit.Exit import Exit
from Backtest.main.Utils.TimeUtil import TimeUtil
from Backtest.main.Visual.StratVisual import StratVisual
from Backtest.main.Utils.AssetBrackets import AssetBrackets
from Backtest.main.Entrance.Enter import Enter
import numpy as np
class TestStrat:
def __init__(self, Entr... |
print(1)
n = int(input())
if(n==2):
print(3)
else:
print(2) |
def extractTkocreationsCom(item):
'''
Parser for 'tkocreations.com'
'''
vol, chp, frag, postfix = extractVolChapterFragmentPostfix(item['title'])
if not (chp or vol) or "preview" in item['title'].lower():
return None
tagmap = [
('PRC', 'PRC', 'translated'),
('Loiterous', 'Loiter... |
import ee
import geemap
# Create a map centered at (lat, lon).
Map = geemap.Map(center=[40, -100], zoom=4)
# Add some data to the Map
dem = ee.Image("JAXA/ALOS/AW3D30_V1_1").select('MED')
Map.addLayer(dem, {'min': 0, 'max': 5000, 'palette': ['000000', 'ffffff'] }, 'DEM', True)
# TEST Map.setCenter
Map.setCenter(0, 2... |
from model.group import Group
from random import randrange
"""
def test_modify_group_name(app):
if app.group.count() == 0:
app.group.create(Group(name='test'))
old_groups = app.group.get_group_list()
index = randrange(len(old_groups))
group = Group(name='New rename group')
group.id = old_gro... |
try: import cPickle as pickle
except: import pickle
from gem.evaluation import metrics
from gem.utils import evaluation_util, graph_util
import numpy as np
import networkx as nx
import sys
sys.path.insert(0, './')
from gem.utils import embed_util
def evaluateStaticLinkPrediction(digraph, graph_embedding,
... |
A, B = map(int, input().split())
for i in range(A, B + 1):
if i % 3 == 0 or str(i).count('3') != 0:
print(i) |
# Tweepy
# Copyright 2009-2022 Joshua Roesslein
# See LICENSE for details.
import requests
class TweepyException(Exception):
"""Base exception for Tweepy
.. versionadded:: 4.0
"""
pass
class HTTPException(TweepyException):
"""HTTPException()
Exception raised when an HTTP request fails
... |
# coding: utf-8
"""
Cherwell REST API
Unofficial Python Cherwell REST API library. # noqa: E501
The version of the OpenAPI document: 9.3.2
Contact: See AUTHORS.
Generated by: https://openapi-generator.tech
"""
import pprint
import re # noqa: F401
import six
from pycherwell.configuration imp... |
# -*- coding: utf-8 -*-
"""
############################################################################
#
# autoPACK Authors: Graham T. Johnson, Mostafa Al-Alusi, Ludovic Autin,
# and Michel Sanner
# Based on COFFEE Script developed by Graham Johnson between 2005 and 2010
# with assistance from Mostafa Al-Alusi i... |
"""
Basic tool parameters.
"""
import logging
import re
import os
import os.path
from six import string_types
from xml.etree.ElementTree import XML
from galaxy import util
from galaxy.web import form_builder
from galaxy.util import string_as_bool, sanitize_param, unicodify
from galaxy.util.expressions import Expressi... |
from typing import List
from task1.const import ALPHABET, SYLLABLE_LEN
def swap(s: str, i: int, j: int) -> str:
str_list = list(s)
str_list[i], str_list[j] = str_list[j], str_list[i]
return ''.join(str_list)
def preprocess(text: str) -> str:
return ''.join(ch for ch in text.lower() if ch in ALPHAB... |
import PySimpleGUI as sg
import cv2
from creategui import changedicttolist, CreateTablegui, Data_template
from resizefill import resize, xyaxis
from PIL import ImageFont, ImageDraw, Image
import tldextract
import subprocess
import platform
import argparse
import yaml
import imutils
import datetime
config_vals = ""
wit... |
import math
def totalDist(crabs, pos):
total = 0
for crab in crabs:
total += abs(crab - pos)
return total
input = None
filename = "day7-input.txt" # "day7-sample.txt"
with open(filename) as reader:
input = reader.read()
crabs = list(map(int, input.strip().split(",")))
cmin, cmax = min(crabs)... |
import logging
import allure
import pytest
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
from webdriver_manager.chrome import ChromeDriverManager
from models.auth import AuthData
from pages.app import Application
logger = logging.getLogger("moodle")
@pytest.fixture(scope="s... |
# Utility script to generate macros from
# the triangle quadrature rules retrieved from the appendix of
# F.D. Witherden, , P.E. Vincent, "On the identification of symmetric quadrature rules for finite element methods"
# Department of Aeronautics, Imperial College London, SW7 2AZ, United Kingdom
import sys
from pathli... |
from decimal import Decimal
from typing import Optional, Union
from .. import xdr as stellar_xdr
from ..asset import Asset
from ..muxed_account import MuxedAccount
from ..price import Price
from ..type_checked import type_checked
from ..utils import raise_if_not_valid_amount
from .operation import Operation
__all__ =... |
from django.contrib.contenttypes.fields import GenericRelation
from django.core.exceptions import ValidationError
from django.core.validators import MaxValueValidator, MinValueValidator
from django.db import models
from django.urls import reverse
from taggit.managers import TaggableManager
from dcim.choices import *
f... |
import uuid
import numpy as np
from shapely.geometry import Point, LineString
from ._finite_cell import FiniteCell
class ScorePoint:
def __init__(
self,
coords: list,
value: float = 1,
influence_range: float = 2000
):
self.uuid = str(uuid.uuid4())
self.value = v... |
# Copyright 2012 OpenStack Foundation
# Copyright 2015 Objectif Libre
# 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/license... |
# -*- coding: utf-8 -*-
#!/usr/bin/env python
#
# Copyright 2015 BigML
#
# 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 b... |
# Copyright 2018 AT&T Intellectual Property. All other 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... |
import numpy as np
from common.realtime import DT_CTRL, DT_DMON
from selfdrive.controls.lib.drive_helpers import create_event, EventTypes as ET
from common.filter_simple import FirstOrderFilter
from common.stat_live import RunningStatFilter
_AWARENESS_TIME = 100. # 1.6 minutes limit without user touching steering whe... |
# Copyright (c) Microsoft Corporation
# All rights reserved.
#
# MIT License
#
# 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 ... |
def TC_idx(T):
"""
Returns TC Reordering indices.
When channels are ordered like (1R 1G 1B 2R 2G 2B 3R 3G 3B 4R ...),
Returns indices to make it (1R 2R 3R 2G 3G 4G 3B 4B 5B 4R 5R 6R ...).
"""
assert T >= 3
idx_3frame = [0, 3, 6, 4, 7, 10, 8, 11, 14] # (1R 2R 3R) (2G 3G 4G) (3B 4B 5B)
rep... |
"""
GNG vs SOM comparison example for PLASTK.
This script shows how to:
- Train PLASTK vector quantizers (SOM and GNG)
- Set default parameters
- Create a simple agent and environment.
- Run an interaction between the agent and the environment
with a GUI.
$Id: gngsom.py,v 1.3 2006/02/17 19:40:09 jp Exp $
... |
#
# Copyright 2018 Analytics Zoo Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to... |
#!/Users/joshuabrummet/workspace/senior-design/LISPAT/lispat_app/lispat/bin/python3
# $Id: rst2odt_prepstyles.py 5839 2009-01-07 19:09:28Z dkuhlman $
# Author: Dave Kuhlman <dkuhlman@rexx.com>
# Copyright: This module has been placed in the public domain.
"""
Fix a word-processor-generated styles.odt for odtwriter us... |
#!/usr/bin/env python3
import sys,re,os,re, datetime
import subprocess, shlex
# import requests
import json
import hashlib
import getopt
from datetime import datetime
from pprint import pprint
from pathlib import Path
################################################################################
## Hashing large f... |
from functools import wraps
from flask import request, g, jsonify
from itsdangerous import (
TimedJSONWebSignatureSerializer as Serializer,
SignatureExpired,
BadSignature,
)
from index import app
TWO_WEEKS = 1209600
def generate_token(user, expiration=TWO_WEEKS):
s = Serializer(app.config["SECRET_KEY... |
{
'targets': [
{
'target_name': 'scip_node_bindings',
'include_dirs': [
'../../scipoptsuite-3.0.1/scip-3.0.1/src/scip',
'../../scipoptsuite-3.0.1/scip-3.0.1/src/'
],
'ldflags': [
'-lscipopt-3.0.1.linux.x86_64.gnu.opt',
'-L../../scipoptsuite-3.0.1/lib'
... |
from django.urls import path, reverse_lazy
from django.contrib.auth import views as auth_views
from . import views
app_name = 'account'
urlpatterns = [
path('login/', auth_views.LoginView.as_view(), name = 'login'),
path('logout/', auth_views.LogoutView.as_view(), name = 'logout'),
path('', views.dashboar... |
import os
# toolchains options
ARCH='arm'
CPU='cortex-m3'
CROSS_TOOL='keil'
# bsp lib config
BSP_LIBRARY_TYPE = None
if os.getenv('RTT_CC'):
CROSS_TOOL = os.getenv('RTT_CC')
if os.getenv('RTT_ROOT'):
RTT_ROOT = os.getenv('RTT_ROOT')
# cross_tool provides the cross compiler
# EXEC_PATH is the compiler execut... |
import dataclasses
import logging
from typing import Any, Callable, Dict, List, Optional, Tuple
import tensorflow as tf
import tensorflow_ranking as tfr
from loganary.ranking.common import get_ndcg_metric
from tensorflow.python.feature_column.feature_column_v2 import FeatureColumn
from tensorflow.python.ops.init_ops i... |
# coding: utf-8
"""
Metacore IoT Object Storage API
Metacore Object Storage - IOT Core Services # noqa: E501
OpenAPI spec version: 1.1
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
import unittest
import metacore_api_python_cli
fr... |
#!/usr/bin/env python
"""Create a "virtual" Python installation
"""
# If you change the version here, change it in setup.py
# and docs/conf.py as well.
__version__ = "1.9" # following best practices
virtualenv_version = __version__ # legacy, again
import base64
import sys
import os
import codecs
import optparse
imp... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.