text stringlengths 3.07k 12.6k |
|---|
#!/usr/bin/env python3
# ****************************************************************************
# Copyright 2019 The Apollo 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... |
#!/usr/bin/env python3
"""Run the Where program to do analysis of space geodetic data over a time period
Usage::
{exe:runner} from_date to_date --<pipeline> [options]
The program requires two dates, specifying the time period that will be
analysed. Typically, each date is given in the format `<year month day>` (... |
import logging
import pyhf
from pyhf import events
from pyhf.tensor.manager import get_backend
from pyhf.parameters import ParamViewer
log = logging.getLogger(__name__)
def required_parset(sigmas, fixed):
n_parameters = len(sigmas)
return {
'paramset_type': 'constrained_by_normal',
'n_parame... |
# Copyright (C) 2020 Cancer Care Associates
# 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 ... |
import logging
from zeep.settings import Settings
from zeep.proxy import ServiceProxy
from zeep.transports import Transport
from zeep.wsdl import Document
logger = logging.getLogger(__name__)
class Factory(object):
def __init__(self, types, kind, namespace):
self._method = getattr(types, 'get_%s' % kind... |
"""Defines a command message that sets COMPLETED status for job models"""
from __future__ import unicode_literals
import logging
from collections import namedtuple
from django.db import transaction
from django.utils.timezone import now
from job.messages.publish_job import create_publish_job_message
from job.models i... |
"""
Source: EurekaTrees (https://github.com/ChuckWoodraska/EurekaTrees)
"""
import os
import jinja2
import json
class Node(object):
def __init__(self, data):
self.data = data
self.left = None
self.right = None
self.parent = None
class Tree(object):
def __init__(self):
... |
# This file is part of Indico.
# Copyright (C) 2002 - 2022 CERN
#
# Indico is free software; you can redistribute it and/or
# modify it under the terms of the MIT License; see the
# LICENSE file for more details.
from copy import deepcopy
from marshmallow import fields, validate
from indico.core.marshmallow import m... |
import glob
import json
import logging
import os
import tempfile
from unittest.mock import ANY, patch
from click.testing import CliRunner
from flask import Flask
from flask_appbuilder import AppBuilder, SQLA
from flask_appbuilder.cli import (
create_app,
create_permissions,
create_user,
export_roles,
... |
###
## * << Haru Free PDF Library 2.0.0 >> -- encoding_list.c
## *
## * Copyright (c) 1999-2006 <NAME> <<EMAIL>>
## *
## * Permission to use, copy, modify, distribute and sell this software
## * and its documentation for any purpose is hereby granted without fee,
## * provided that the above copyright notice app... |
# coding=utf-8
# Copyright 2021 The Uncertainty Baselines 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 ap... |
import os
import sys
import click
from pheasant import __version__
from pheasant.core.page import Pages
pgk_dir = os.path.dirname(os.path.abspath(__file__))
version_msg = f"{__version__} from {pgk_dir} (Python {sys.version[:3]})."
@click.group(invoke_without_command=True)
@click.pass_context
@click.version_option(... |
# pylint: disable=unused-argument
# pylint: disable=redefined-outer-name
# pylint: disable=too-many-arguments
import asyncio
import json
import uuid
from asyncio import AbstractEventLoop
from pathlib import Path
from pprint import pformat
from typing import Iterator, List
import aio_pika
import pytest
from _pytest.fix... |
import argparse
import functools
import logging
import numpy as np
from torch import nn
import pfrl
from pfrl import experiments, utils
from pfrl.agents import a2c
from pfrl.policies import SoftmaxCategoricalHead
from pfrl.wrappers import atari_wrappers
def phi(x):
# Feature extractor
return np.asarray(x, d... |
import torch
import torch.nn as nn
import torch.utils.model_zoo as model_zoo
import torch.nn.functional as F
__all__ = ['erfnet']
model_urls = {
'ERFnet': 'https://github.com/adrshm91/erfnet_pytorch/tree/master/trained_models/erfnet_pretrained.pth',
}
class DownsamplerBlock (nn.Module):
def __init__(self, ... |
from tkinter import HIDDEN, NORMAL, Tk, Canvas
def toggle_eyes():
current_color = c.itemcget(eye_left, 'fill')
new_color = c.body_color if current_color == 'white' else 'white'
current_state = c.itemcget(pupil_left, 'state')
new_state = NORMAL if current_state == HIDDEN else HIDDEN
c.itemconfigure(... |
from Cryptodome.Cipher import AES
from enum import Enum
import zlib
from hashlib import sha256
import struct
import xml.etree.ElementTree as ET
class CipherId(Enum):
AES256 = 0x31c1f2e6bf714350be5805216afc5aff
class HeaderField(Enum):
END = 0
COMMENT = 1
CIPHERID = 2
COMPRESSION = 3
MASTERSE... |
#!/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.
"""Count and display statistics of the data.
Examples
--------
.. code-block:: shell
python parlai/scripts/data_stat... |
# -*- coding: utf-8 -*-
#
# This file is part of the SKAMaster project
#
#
#
""" SKAMaster
Master device
"""
# PROTECTED REGION ID(SKAMaster.additionnal_import) ENABLED START #
# Tango imports
from tango import DebugIt
from tango.server import run, attribute, command, device_property
# SKA specific imports
from ska.... |
#!/usr/bin/env python
"""
MetaWIBELE: abundance_normalization module
Normalize abundance table within sample to get relative abundance
Copyright (c) 2019 Harvard School of Public Health
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (t... |
import logging
import click
import pandas as pd
import numpy as np
from flexp import flexp
from sklearn.base import TransformerMixin, BaseEstimator
from sklearn.impute import SimpleImputer
from sklearn.linear_model import LinearRegression, Ridge
from sklearn.metrics import mean_squared_error
from sklearn.preprocessing... |
#-------------------------------------------------------------------------------
# Part of Tweedledum Project. This file is distributed under the MIT License.
# See accompanying file /LICENSE for details.
#-------------------------------------------------------------------------------
import operator
import random
imp... |
"""
class to detect phrase
"""
import codecs
import gc
import logging
import os
logger = logging.getLogger(__name__)
from gensim.models.phrases import Phrases, Phraser
from gensim.models.word2vec import LineSentence
class TxtIter(object):
def __init__(self, sentences, ngrams):
self.ngrams = ngrams
... |
import os
import fnmatch
from os.path import islink, isdir, isfile, realpath, join, dirname, basename
from glob import glob
#from ceres import CeresTree, CeresNode, setDefaultSliceCachingBehavior
from node import BranchNode, LeafNode
from readers import WhisperReader, GzippedWhisperReader, RRDReader
from util import fi... |
# -*- coding: utf-8 -*-
# @Time : 2019/8/7 10:26
# @Author : <NAME>
# @FileName: MatirxMaker.py
# @Usage:LeeCode
# @Note: Anotated By Lianm with Chinese
# @E-mail: <EMAIL>
import os
import argparse
import csv
# 将一个带有表头(分别为GeneId和SampleId)的两列的文件读入,保存为一个字典:
# {"sample" -> SampleId,
# "gene1" -> expression1,
# "gene2"... |
import numpy as np
import json
import matplotlib.pyplot as plt
def load_data():
# 从文件导入数据
datafile = './data/housing.data'
data = np.fromfile(datafile, sep=' ')
# 每条数据包括14项,其中前面13项是影响因素,第14项是相应的房屋价格中位数
feature_names = [ 'CRIM', 'ZN', 'INDUS', 'CHAS', 'NOX', 'RM', 'AGE', 'DIS', 'RAD', 'TAX', 'PTR... |
import json
import os.path
from argparse import ArgumentParser, ArgumentTypeError
from typing import Union, Dict, Any
CWD = str(os.getcwdb())
def str2bool(v: Union[str, bool]) -> bool:
if isinstance(v, bool):
return v
if v.lower() in ('yes', 'true', 't', 'y', '1'):
return True
elif v.lowe... |
import asyncio
import logging
import math
import subprocess
import threading
import time
from scrapy.utils.misc import load_object
from scrapy.utils.url import add_http_if_no_scheme
from proxybroker import Broker
from haipproxy.utils import get_redis_conn, RedisOps
from haipproxy.settings import (
SQUID_BIN_PATH,... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2015-2018 University of Dundee & Open Microscopy Environment.
# All rights reserved.
#
# 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 Founda... |
#!/usr/bin/python3
import struct
from .PySF2Synth import S16ToF32
def decode_string(with_zero):
i=0
while i<len(with_zero):
b= with_zero[i]
if b==0 or b>=128:
break
i+=1
return with_zero[0:i].decode('ascii')
def ReadRiffChunk(f):
fourcc = f.read(4).decode('ascii')
size = struct.unpack('i',f.read(4))[0]
... |
"""
City Finder Processor
---------------------
This is an example of a Lintol processor. You can run it like so:
python3 processor.py out-example-2021-02-01-hansard-plenary.txt
or, if you would like a nicely-formatted HTML page to look at:
ltldoorstep -o html --output-file output.html process sample_transc... |
# This technical data was produced for the U. S. Government under Contract No. W15P7T-13-C-F600, and
# is subject to the Rights in Technical Data-Noncommercial Items clause at DFARS 252.227-7013 (FEB 2012)
from datetime import datetime
from django.db import models
from django.contrib.auth.models import User, Group
fro... |
import os
import glob
import gc
from unet3d.utils import pickle_load
import unet3d.utils.args_utils as get_args
from unet3d.utils.path_utils import get_project_dir
from unet3d.utils.path_utils import get_training_h5_paths
from unet3d.utils.path_utils import get_shape_from_string
from unet3d.utils.path_utils import get... |
#!/usr/bin/env python
# Built-in imports
import sys
# Own imports
from baxter_bon_appetit.cfg import (
JointSpringsBonAppetitConfig,
)
# General module imports
import rospy
import baxter_interface
from dynamic_reconfigure.server import (
Server
)
from std_msgs.msg import (
Empty
)
from baxter_core_msg... |
import os
import cv2
import torch
import numpy as np
import _init_paths
from model.module import networks
from SSH.model.SSH import SSH
from SSH.model.utils.config import cfg
from SSH.model.network import load_check_point
from SSH.model.nms.nms_wrapper import nms
from SSH.model.utils.test_utils import _get_image_blob,... |
# -*- coding: utf-8 -*-
"""
Test ABI/API compatibility
"""
import os
import re
import pytest
from tests.conftest import perform_once
LIB_NAMES = ('libaccelize_drmc', 'libaccelize_drm')
REPOSITORY_PATH = 'https://github.com/Accelize/drmlib'
def _run(*command, **kwargs):
"""
Run a command.
Args:
... |
# Copyright (c) Microsoft Corporation.
#
# Licensed under the Apache License, Version 2.0 (the "License")
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http:#www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writi... |
# Lint as: python3
# Copyright 2020 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 ... |
# The follwong code was heavily inspired by and partly copied from
# https://github.com/willhardy/dynamic-models/blob/master/surveymaker/signals.py
# django imports
from django.db import connection#, DatabaseError
from django.db import models
from django.db.models.signals import class_prepared
from django.db.models.... |
import math
import torch
from torch import nn
from .. import utils
class ResidualBlock(nn.Module):
def __init__(self, main, skip=None):
super().__init__()
self.skip = skip if skip else nn.Identity()
self.main = nn.Sequential(*main)
def forward(self, input):
return self.main(... |
# -*- coding: utf-8 -*-
"""
Provides functions and methods for importing data and results from NODLE,
COWI UK's large displacement frame analysis software
@author: RIHY
"""
import pandas
import numpy
import xlrd # for reading from Excel
from mesh import Mesh, DispResults
from common import read_block
# ------------... |
#
# Copyright 2016 Quantopian, 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 wr... |
"""Support for displaying weather info from Ecobee API."""
from datetime import datetime
from pyecobee.const import ECOBEE_STATE_UNKNOWN
from homeassistant.components.weather import (
ATTR_FORECAST_CONDITION,
ATTR_FORECAST_TEMP,
ATTR_FORECAST_TEMP_LOW,
ATTR_FORECAST_TIME,
ATTR_FORECAST_WIND_SPEED,... |
#
# (C) Copyright 2013 Enthought, Inc., Austin, TX
# All right reserved.
#
# This file is open source software distributed according to the terms in
# LICENSE.txt
#
from __future__ import absolute_import
from contextlib import contextmanager
from traits.adaptation.api import AdaptationOffer, \
get_global_adaptati... |
# Sprite classes for platform game
import pygame as pg
from settings import *
from random import choice
vec = pg.math.Vector2
class Spritesheet:
# utility class for loading and parsing spritesheets
def __init__(self, filename):
self.spritesheet = pg.image.load(filename).convert()
def get_image(sel... |
# Copyright 2021 The NetKet 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 module contains the general information for AaaRadiusProvider ManagedObject."""
from ...ucscentralmo import ManagedObject
from ...ucscentralcoremeta import UcsCentralVersion, MoPropertyMeta, MoMeta
from ...ucscentralmeta import VersionMeta
class AaaRadiusProviderConsts():
KEY_SET_FALSE = "false"
KEY_... |
import os, os.path, sys
from waflib.TaskGen import feature, after_method
from waflib import Utils, Task, Logs, Options, Errors
import xml.sax.handler
testlock = Utils.threading.Lock()
class NunitCounter(xml.sax.handler.ContentHandler):
def __init__(self):
self.num_passed = 0;
self.num_failed = 0;
self.num_skipp... |
# -*- coding: utf-8 -*-
"""
Common functionality for converting metadata
"""
import logging
import numpy
from numpy.polynomial import polynomial
from .sicd_elements.blocks import Poly2DType
__classification__ = "UNCLASSIFIED"
__author__ = "<NAME>"
def get_seconds(dt1, dt2, precision='us'):
"""
The number o... |
from PyQt5.QtCore import Qt, QRectF, QRect
from PyQt5.QtGui import QPainter, QColor, QPainterPath, QFont
from PyQt5.QtWidgets import QPushButton, QDesktopWidget, QMainWindow
from TLabel import TLabel
class MyButton(QPushButton):
MINI = 0
CLOSE = 1
def __init__(self, patten, parent=None):
super(My... |
# -*- coding: utf-8 -*-
import simplejson as json
from werkzeug.routing import BaseConverter
from eve.tests import TestBase, TestMinimal
from eve import Eve
from eve.io.base import BaseJSONEncoder
from eve.tests.test_settings import MONGO_DBNAME
from uuid import UUID
from eve.io.mongo import Validator
class UUIDEnco... |
import requests
import pandas as pd
from bs4 import BeautifulSoup
import timeit
import numpy as np
import threading
# pd.set_option("display.max_rows", None, "display.max_columns", None)
start = timeit.default_timer()
finaldfarr = []
gameLinks = []
# listOfYears = ["https://gohuskies.com/sports/womens-volleyball/sch... |
import sys
sys.path.append('..')
import fewshot_re_kit
import torch
from torch import autograd, optim, nn
from torch.autograd import Variable
from torch.nn import functional as F
import numpy as np
class CausalConv1d(nn.Module):
def __init__(self, in_channels, out_channels, kernel_size=2, dilation=2):
sup... |
import os
import cv2
import numpy as np
# Initialisation
def visualiseRankResults(args, data):
# constants
NUM_OF_RANKING = 10
START_QUERY = 0
END_QUERY = 10
# load data
query_fids = data[:, 0]
results_images = data[:, 1:]
height_new_im = ((NUM_OF_RANKING + 1) * 128)
new_im = np... |
##
# Copyright © 2020, The Gust Framework Authors. All rights reserved.
#
# The Gust/Elide framework and tools, and all associated source or object computer code, except where otherwise noted,
# are licensed under the Zero Prosperity license, which is enclosed in this repository, in the file LICENSE.txt. Use of
# this ... |
"""
Note: Rename `env.example` to `.env` and enter your token then run
`poetry run test` in your terminal
"""
import os
import dotenv
from discord.ext import commands
from discord.ext.prettyhelp import (
DefaultMenu,
PrettyHelp,
bot_has_permissions,
has_guild_permissions,
has_permiss... |
# -*- coding: utf-8 -*-
#
import rdflib
from rdflib.collection import Collection
from . import RDF_first
def clone_dataset(source_ds, target_ds=None):
if target_ds and not isinstance(target_ds, (rdflib.Dataset, rdflib.ConjunctiveGraph)):
raise RuntimeError("when cloning a dataset, the target_ds must be a ... |
import numpy as np
import matplotlib.pyplot as plt
import math
from sklearn.datasets import make_swiss_roll, make_s_curve
from sklearn.metrics.pairwise import euclidean_distances
class DiffusionMap:
"""
class implementing the main utilities of a DiffusionMap, including the algorithm for training and plotting
... |
import os
import json
from PySide2 import QtWidgets
from hotbox_designer.dialog import warning
from hotbox_designer.languages import (
MEL, PYTHON, NUKE_TCL, NUKE_EXPRESSION, HSCRIPT)
HOTBOXES_FILENAME = 'hotboxes.json'
SHARED_HOTBOXES_FILENAME = 'shared_hotboxes.json'
SETMODE_PRESS_RELEASE = 'open on press | clo... |
#
# 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"); you may not... |
import codecs
import os
import re
import typing as tp
from satella.exceptions import ConfigurationValidationError
from .base import Descriptor, ConfigDictValue
from .registry import register_custom_descriptor
@staticmethod
def _make_boolean(v: tp.Any) -> bool:
if isinstance(v, str):
if v.upper() == 'TRUE... |
"""
Scrapper implementation
"""
import datetime
import json
import re
import shutil
from random import randint
from time import sleep
import requests
from bs4 import BeautifulSoup
from constants import ASSETS_PATH, CRAWLER_CONFIG_PATH, HTTP_PATTERN
from core_utils.article import Article
from core_utils.pdf_utils impo... |
# Full Nexus Keycode Protocol Keycode Generator
# Convenience script to generate keycodes 'on the fly' for testing/QA purposes.
import argparse
import codecs
import nexus_keycode.protocols.full as protocol
from nexus_keycode.protocols.channel_origin_commands import ChannelOriginAction
VALID_NXK_MESSAGE_TYPES = ["SET... |
from typing import List
import joblib
import optuna
import pandas as pd
from model.gbdt import stratified_kfold_cat, stratified_kfold_lgbm, stratified_kfold_xgb
from optuna import Trial
from optuna.samplers import TPESampler
from sklearn.metrics import roc_auc_score
class BayesianOptimizer:
def __init__(self, ob... |
import ast
__version__ = '0.0.5'
__all__ = ('FailsChecker', )
MESSAGES = {
'PF101': 'PF101 Potential IndexError fail.',
'PF102': 'PF102 Potential KeyError fail. You can replace this with `dict.get(key, failback_value)`',
'PF103': 'PF103 Potential IndexError or KeyError fail.',
}
class PluginVisitor(ast.... |
# -*- coding: utf-8 -*-
# This code is part of Qiskit.
#
# (C) Copyright IBM 2017.
#
# This code is licensed under the Apache License, Version 2.0. You may
# obtain a copy of this license in the LICENSE.txt file in the root directory
# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0.
#
# Any modif... |
"""
Project Euler Problem 203: https://projecteuler.net/problem=203
The binomial coefficients (n k) can be arranged in triangular form, Pascal's
triangle, like this:
1
1 1
1 2 1
1 3 3 1
1 4 6 4 ... |
import pytest
import os
import pickle as pkl
import numpy as np
import matplotlib
# Disable plotting
matplotlib.use("Template")
class TestData:
def __init__(self):
"""Initialize simple variables."""
# Test data directory
self.datadir = os.path.join(os.path.dirname(os.path.abspath(__file__... |
import itertools
from .common import InfoExtractor
from ..compat import compat_str
from ..utils import (
ExtractorError,
smuggle_url,
str_or_none,
traverse_obj,
unified_strdate,
unsmuggle_url,
)
class VoicyBaseIE(InfoExtractor):
def _extract_from_playlist_data(self, value):
voice_... |
import pygame
class KEY:
"""
All the usefull keyboard intrupts
"""
backspace = pygame.K_BACKSPACE
tab = pygame.K_TAB
clear = pygame.K_CLEAR
return_ = pygame.K_RETURN
pause = pygame.K_PAUSE
escape = pygame.K_ESCA... |
# SYS IMPORTS
import sys, os, time
import re
# PACKAGE IMPORTS
import numpy as np
import scipy as sp
import matplotlib.pyplot as plt
def analysis():
print('Hello Analysis!')
# plots a galaxy given filtered MassModel data
# - mm_data : numpy array of imported mass model data
# - gal_id : string containing the gala... |
from database.feverous_db import FeverousDB
from utils.wiki_page import WikiPage
import jsonlines
import json
import unicodedata
from cleantext import clean
import unicodedata
from urllib.parse import unquote
from utils.log_helper import LogHelper
LogHelper.setup()
logger = LogHelper.get_logger(__name__)
DB = None
... |
# python 3.6
"""Interpolates real images with In-domain GAN Inversion.
The real images should be first inverted to latent codes with `invert.py`. After
that, this script can be used for image interpolation.
NOTE: This script will interpolate every image pair from source directory to
target directory.
"""
import os
i... |
# Copyright 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" file accompan... |
# -*- coding: utf-8 -*-
from ctypes import cast, c_int, c_double, c_float, c_void_p
import numpy as np
from pyfr.backends.base import ComputeKernel, NotSuitableError
from pyfr.backends.openmp.provider import OpenMPKernelProvider
from pyfr.ctypesutil import LibWrapper
class XSMMWrappers(LibWrapper):
_libname = ... |
import numpy as np
import torch
from ..hooks import OpenVINOTensor, forward_hook
class DetectionOutput(torch.nn.Module):
def __init__(self, top_k, nms_threshold, confidence_threshold, background_label_id):
super().__init__()
self.variance_encoded_in_target = True
self.nms_threshold = nms_t... |
#!/usr/bin/python3
import itertools
import json
import os
import shutil
from pathlib import Path
import pytest
from _pytest.monkeypatch import MonkeyPatch
import brownie
from brownie._config import ARGV
pytest_plugins = "pytester"
# travis cannot call github ethereum/solidity API, so this method is patched
def py... |
#!/usr/bin/env python
#
# Copyright 2014, Google Inc. All rights reserved.
# Use of this source code is governed by a BSD-style license that can
# be found in the LICENSE file.
# This test is not automated, it depends on flushing the Linux OS buffer cache,
# which can only be done by root. Also, it is fairly big and r... |
#!/usr/bin/env python
# coding: utf-8
import re
examples = [
{'Problem': '1 + 2 * 3 + 4 * 5 + 6', 'Answer': 71, 'Answer2': 231},
{'Problem': '11 + 22 + 31 + 5 * 6', 'Answer': 414, 'Answer2': 414},
{'Problem': '1 + (2 * 3) + (4 * (5 + 6))', 'Answer': 51, 'Answer2': 51},
{'Problem': '2 * 3 + (4 * 5)', '... |
"""
Represents an instance of a GPX file's data.
"""
import gpxpy
import json
from datetime import timedelta, timezone
from dateutil.parser import isoparse
class GPXFile:
ISO_8601_BASIC = "%Y%m%dT%H%M%SZ"
SUFFIX = "gpx"
CONFIG_FILE = "config.json"
IGNORE_FILE = "ignore.json"
def __init__(self, i... |
# Copyright 2007 Google, Inc. All Rights Reserved.
# Licensed to PSF under a Contributor Agreement.
"""Abstract Base Classes (ABCs) according to PEP 3119."""
from _weakrefset import WeakSet
def abstractmethod(funcobj):
"""A decorator indicating abstract methods.
Requires that the metaclass is ABCMeta or de... |
#!/usr/bin/env python3
# Copyright 2015-2021 <NAME> and the splitflap contributors
#
# 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.... |
#!/usr/bin/env python
# cardinal_pythonlib/sizeformatter.py
"""
===============================================================================
Original code copyright (C) 2009-2020 <NAME> (<EMAIL>).
This file is part of cardinal_pythonlib.
Licensed under the Apache License, Version 2.0 (the "License");... |
from typing import Optional, List, Dict, TYPE_CHECKING
import os
import site
import hashlib
import urllib.parse
import tarfile
from pathlib import Path
from .._util import get_hash, get_checksum, download_file, ensure_pathy
from ...util import make_tempdir, get_minor_version, ENV_VARS, check_bool_env_var
from ...git_i... |
import numpy as np
import cv2
from os import getcwd
from sys import path
from skimage import io
# modules imported
# database management functions
path.append( getcwd() + '/Database Management')
from db_functions import insertData, createTable, getLastPoint
"""
initialising basic variables and functions
"""
de... |
#!/usr/bin/python
import sys
import json
import serial
import serial.tools.list_ports
import time
import rospy
from client_pwm_driver_x6.msg import *
from client_pwm_driver_x6.srv import *
from atmega328p_service_discovery.srv import *
class SerialPortDevice:
_ser = None
def __init__(self, device_id, serial... |
#!/usr/bin/python2.7
# Copyright 2010 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 ... |
from morle.algorithms.align import extract_all_rules
import morle.algorithms.fst as FST
from morle.datastruct.lexicon import Lexicon, LexiconEntry, unnormalize_word
from morle.datastruct.graph import GraphEdge, EdgeSet
from morle.datastruct.rules import RuleSet
from morle.models.suite import ModelSuite
from morle.utils... |
# Copyright 2021 <NAME>
#
# 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, softw... |
# Import all packages needed to create a flask application.
import os
from flask import Flask, app, render_template, request
from instanceGeneration import *
from MF1 import *
from weatherConditions import *
path = os.getcwd()
# HTML string for the web page.
# Accepts the user input in the form of a number from the f... |
import abc
import datetime
import logging
import munge
import os
import copy
from future.utils import with_metaclass
from vaping.config import parse_interval
import vaping.io
class PluginBase(vaping.io.Thread):
"""
Base plugin class
Initializes:
- `self.plugin_config` as plugins config
- `self.... |
#***************************
#********* IMPORT **********
#***************************
#for flask
from flask import Flask,render_template
# for database
from flask_pymongo import PyMongo
# for scheduler
import time
import schedule
from threading import Thread
from gevent import monkey
# our news Scrapper
# from... |
"""Functions used to generate configuration data."""
from collections import ChainMap
import os.path
from typing import Tuple
from packaging import version
from plumbum import local
from plumbum.cmd import git
from .. import vcs
from ..types import AnyByStrDict, OptAnyByStrDict, OptBool, OptStr, OptStrSeq
from .obje... |
from cwbot.modules.BaseDungeonModule import BaseDungeonModule, eventDbMatch
from cwbot.kolextra.request.GetScareHoboPartsRequest \
import GetScareHoboPartsRequest
def scareHobosCreated(oldPartCount, newPartCount):
""" Number of scarehobos created = maximum part DECREASE """
partDec... |
# Copyright 2019 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... |
#!/usr/bin/env python
# coding: utf-8
# Copyright 2012 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.
from __future__ import print_function
import argparse
import distutils.version
import os
import re
import subprocess
... |
import numbers
from binascii import hexlify, unhexlify
import pytest
from mbedtls.mpi import MPI
@pytest.mark.parametrize("value", (12, 2 ** 32 - 1, 10 ** 100))
def test_from_int(value):
mpi = MPI.from_int(value)
assert mpi == value
assert value == mpi
assert mpi == mpi
def test_is_integral():
... |
# -*- coding: utf-8 -*-
# Copyright (c) 2014 Metaswitch Networks
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LIC... |
# This script runs on the pi 3 B+
from keras.preprocessing.image import img_to_array
from keras.models import load_model
from imutils.video import VideoStream
from threading import Thread
from squeezenet_model import SqueezeNet, preprocess_input
import numpy as np
import imutils
import time
import cv2
import os
import... |
from ..models import User, Paper, Message, Course, School, Order
from . import per
from flask import render_template, request, session, redirect, url_for, jsonify, abort, flash
from .. import basic
@per.route('/info/<uid>')
@per.route('/')
def info_page(uid=None):
if uid:
user = User.query_one(U... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.