text stringlengths 2 999k |
|---|
## This module deals with code regarding handling the double
## underscore separated keys
import re
from functools import partial
def dunderkey(*args):
"""Produces a nested key from multiple args separated by double
underscore
>>> dunderkey('a', 'b', 'c')
>>> 'a__b__c'
:param *args : *Stri... |
import os
import pickle
import datetime
from abc import abstractmethod
from typing import Mapping, Any, TypeVar, Iterable, Type, Dict, List
import simplekv, simplekv.fs
from datapipelines import DataSource, DataSink, PipelineContext, NotFoundError
from cassiopeia.dto.common import DtoObject
from cassiopeia.dto.champi... |
"""Core oso functionality"""
__version__ = "0.20.0-beta"
import os
from typing import List, Any, Set
from polar import Polar, Variable, exceptions
from .exceptions import NotFoundError, ForbiddenError
class Oso(Polar):
"""The central object to manage application policy state, e.g.
the policy data, and veri... |
# -*- coding: utf-8 -*-
"""Parser for Docker configuration and log files."""
import codecs
import json
import os
from dfdatetime import semantic_time as dfdatetime_semantic_time
from dfdatetime import time_elements as dfdatetime_time_elements
from dfvfs.helpers import text_file
from plaso.containers import events
fr... |
import sys
import re
from os import mkdir
from os.path import join, exists, basename
from subprocess import Popen, PIPE, STDOUT
from shutil import move
from glob import glob
from numpy import array, arange
from calm.pandas_time_series import PandasTimeSeries
# =============
# = Constants =
# =============
STOCHKIT_HOM... |
import sys
from types import ModuleType
from typing import Dict
__all__ = ["MonkeyJail"]
_sys_modules: Dict[str, ModuleType] = {}
class MonkeyJail:
def __init__(self):
self.saved = {}
def __enter__(self):
from gevent import monkey
for key in list(monkey.saved) + ["selectors"]:
... |
# -*- coding: utf-8 -*-
# Copyright 2018 IBM.
#
# 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 agre... |
from __future__ import annotations
import abc
import datetime
from io import BytesIO
import os
from textwrap import fill
from typing import (
Any,
Mapping,
cast,
)
import warnings
import zipfile
from pandas._config import config
from pandas._libs.parsers import STR_NA_VALUES
from pandas._typing import (
... |
"""
This page is similar to Menu class, but here we
will render the results and summon the graph.
self = where the widgets will be rendered.
app = to access app-bot and change bot properties and methods
for threshold, confidence, paths, intersection line.
main_container = where the menu will be rendered.
A frame obj... |
#!/usr/bin/env python
import os.path as op
import numpy as np
import pylab as plt
from scipy import arange
import rapidtide.io as tide_io
import rapidtide.fit as tide_fit
from rapidtide.tests.utils import get_test_data_path
def test_findmaxlag(display=False, debug=False):
textfilename = op.join(get_test_data_... |
import time
import pandas as pd
import numpy as np
CITY_DATA = { 'chicago': 'chicago.csv',
'new york city': 'new_york_city.csv',
'washington': 'washington.csv' }
def get_filters():
"""
Asks user to specify a city, month, and day to analyze.
Returns:
(str) city - name of... |
# Copyright 2021 The DDSP 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 in wri... |
from hazelcast.protocol.codec import \
semaphore_acquire_codec, \
semaphore_available_permits_codec, \
semaphore_drain_permits_codec, \
semaphore_init_codec, \
semaphore_reduce_permits_codec, \
semaphore_release_codec, \
semaphore_try_acquire_codec
from hazelcast.proxy.base import PartitionS... |
# Copyright Contributors to the Pyro project.
# Copyright (c) 2020, YosefLab.
# SPDX-License-Identifier: Apache-2.0 AND BSD-3-Clause
"""
The data preprocessing code in this script is adapted from:
https://github.com/YosefLab/scvi-tutorials/blob/50dd3269abfe0c375ec47114f2c20725a016736f/seed_labeling.ipynb
"""
import m... |
# 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... |
#!/usr/bin/env python
import os
import json
from getpass import getpass
from pathlib import Path
from datetime import date, timedelta
from itertools import product
from book import BookClient, Time, Category, Campus, Place, BookResult
CONFIG_PATH = os.getenv('TJU_CLI_CONFIG_PATH', 'config.json')
def main():
co... |
"""
WSGI config for gps_tracker project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/3.1/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault('DJANGO_S... |
import psycopg2
from django.db.backends.base.schema import BaseDatabaseSchemaEditor
from django.db.backends.ddl_references import IndexColumns
from django.db.backends.utils import strip_quotes
class DatabaseSchemaEditor(BaseDatabaseSchemaEditor):
sql_create_sequence = "CREATE SEQUENCE %(sequence)s"
sql_dele... |
# -*- coding: utf-8
import click
@click.command()
def main():
print("I'm the awesomest cleanup tool ever!")
if __name__ == '__main__':
main()
|
a1 = 15.67
a2 = 17.23
a3 = 0.75
a4 = 93.2
A = int(input('Enter your value for A: '))
Z = int(input('Enter your value for Z: '))
if A % 2 != 0:
a5 = 0
elif A % 2 == 0 and Z % 2 == 0:
a5 = 12
else:
a5 = -12
B = a1 * A - a2 * (A ** (2 / 3)) - a3 * (Z ** 2) / (A ** (1 / 3)) - a4 * ((A - 2 * Z) ** 2) / A + a5 / ... |
from ita import Loader, Parser, Generator
loader = Loader("sablony")
parser = Parser( loader )
generator = Generator( parser )
print( generator.run("cviceni") ) |
#!/usr/bin/env python
COPY_GOOGLE_DOC_KEY = '16hWlfG1dY6u3XyI7JYD1cX-nh5enrAvD0fLtOYT4u0I'
|
# first line: 274
def resample_img(img, target_affine=None, target_shape=None,
interpolation='continuous', copy=True, order="F"):
"""Resample a Niimg-like object
Parameters
----------
img: Niimg-like object
See http://nilearn.github.io/manipulating_images/input_output.html
... |
import argparse
import json
import os
import requests
import ScanInPlexCommon as Common
import subprocess
import urllib.parse
class Scanner:
def __init__(self, cmd_args=None):
self.valid = True
self.cmd_args = cmd_args
if self.cmd_args == None:
parser = argparse.ArgumentParser()... |
from mmcv.utils import Registry, build_from_cfg
BBOX_ASSIGNERS = Registry('bbox_assigner')
BBOX_SAMPLERS = Registry('bbox_sampler')
BBOX_CODERS = Registry('bbox_coder')
def build_assigner(cfg, **default_args):
return build_from_cfg(cfg, BBOX_ASSIGNERS, default_args)
def build_sampler(cfg, **default_... |
# coding=utf-8
from __future__ import unicode_literals
from django.db import models, migrations
import django.utils.timezone
import model_utils.fields
import djorm_pgfulltext.fields
class Migration(migrations.Migration):
dependencies = []
operations = [
migrations.CreateModel(
name="Not... |
# coding=utf-8
# *** WARNING: this file was generated by pulumigen. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
from .. import _utilities
import typing
# Make subpackages available:
if typing.TYPE_CHECKING:
import pulumi_kubernetes.helm.v2 as __v2
v2 = __v2
import ... |
# -*- coding: utf-8 -*-
# Generated by Django 1.11 on 2018-03-11 12:39
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('ebayinfo', '0007_auto_20180311_0948'),
]
operations = [
migrations.RemoveFiel... |
from sqlalchemy_serializer import SerializerMixin
from flask_project_template.ext.database import db
class Product(db.Model, SerializerMixin):
id = db.Column(db.Integer, primary_key=True)
name = db.Column(db.String(140))
price = db.Column(db.Numeric())
description = db.Column(db.Text)
class User(db... |
# 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
# d... |
import copy
from collections import defaultdict
from typing import Tuple, Optional
from easydict import EasyDict
import numpy as np
from ding.utils import LockContext, LockContextType
from .player import Player
class BattleRecordDict(dict):
"""
Overview:
A dict which is used to record battle game res... |
# coding: utf-8
# Copyright (c) Max-Planck-Institut für Eisenforschung GmbH - Computational Materials Design (CM) Department
# Distributed under the terms of "New BSD License", see the LICENSE file.
import pandas
from pysqa.wrapper.slurm import SlurmCommands
__author__ = "Jan Janssen"
__copyright__ = (
"Copyrigh... |
import logging
import base64
from abc import ABC, abstractmethod
logger = logging.getLogger(__name__)
class EncoderStrategy(ABC):
"""
interface that defines the way the encoding is done
"""
@abstractmethod
def encode(self, string):
"""
encode
"""
pass
@abstra... |
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT license.
import unittest
from collections import defaultdict
from maro.communication import RegisterTable, SessionMessage
class FakedProxy:
def __init__(self):
self._peers = {
"worker_a": ["worker_a.1", "worker_a.2", "worker_a.3... |
# coding=utf-8
# Copyright (C) 2020 NumS Development 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... |
#!/usr/bin/env python3
# Copyright (c) 2015-2016 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 Mircoin multisig prefix functionality.
#
from test_framework.test_framework import BitcoinT... |
from .table import Table
from .database import Database
class View(Table):
def __init__(self, db: Database, schema: str, name: str, view_def: str) -> None:
self.viewDefinition = None
super().__init__(db, schema, name)
self.set_view_definition(view_def)
def set_view_definition(self, vi... |
from .menu import Menu
from .urls import Urls, COUNTRY_USA
from .utils import request_json
class Store(object):
"""The interface to the Store API
You can use this to find store information about stores near an
address, or to find the closest store to an address.
"""
def __init__(self, data={}, ... |
# Time: O(p^2), p is the length of the prefix
# Space: O(p * t + s), t is the number of nodes of trie
# , s is the size of the sentences
class TrieNode(object):
def __init__(self):
self.__TOP_COUNT = 3
self.infos = []
self.leaves = {}
def insert(self, s, times... |
import mpmath
def pytest_sessionstart(session):
mpmath.mp.dps = 20 # 20 decimal places precision
|
"""
Copyright (C) 2022 Benjamin Bokser
"""
import numpy as np
actuator_u8 = {
"name": "u8",
"kt": 8.4/100,
"omega_max": 3700 * (2 * np.pi / 60),
"tau_stall": 2.8,
"r": 0.186,
"i_max": 31,
"i_stall": 31,
"gr": 1
}
actuator_8318 = {
"name": "8318",
"kt": 8.4/100,
"omega_max... |
#!/usr/bin/env python
# generate_seat_keys.py
# for a valid table_keys presented by a user, creates seat keys for 4 players
# Kiat Huang <kiat.huang@gmail.com>
import sys
import json
import random
import string
from datetime import datetime
import collections
# Played deal - bidding workflow
# 1. user presents a tok... |
# Copyright 2020 The TensorFlow Hub 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 app... |
TRPOconfig = {
'cg_damping': 1e-2,
'GAE_lambda': 0.,
'reward_decay': 0.9,
'max_kl_divergence': 0.001,
'hidden_layers': [64, 64],
'hidden_layers_v': [64, 64],
'max_grad_norm': None,
'value_lr': 5e-4,
'train_v_iters': 10,
'lr_pi': 1e-3,
'steps_per_iter': 128,
'v... |
# coding: utf-8
"""
Looker API 3.0 Reference
### Authorization The Looker API uses Looker **API3** credentials for authorization and access control. Looker admins can create API3 credentials on Looker's **Admin/Users** page. Pass API3 credentials to the **/login** endpoint to obtain a temporary access_token.... |
# -*- coding: utf-8 -*-
from bs4 import BeautifulSoup
import urllib.parse
import urllib.request
import json
import re
class RecipeNotFound(Exception):
pass
class Marmiton(object):
@staticmethod
def search(query_dict):
"""
Search recipes parsing the returned html data.
Options:
'aqt': string of keywor... |
import os
import numpy as np
from PIL import Image
import torch
import torchvision
from torchvision import transforms
import torchvision.models as models
from torchvision.datasets import ImageFolder
import torch.nn as nn
import torch.optim as optim
import torch.nn.functional as F
from torch.utils.data import Dataset, ... |
from __future__ import division
from __future__ import absolute_import
#typing
import logging
import copy
#overrides
import torch
import torch.nn.functional as F
from torch.nn.modules import Dropout
import numpy
from allennlp.common.checks import check_dimensions_match, ConfigurationError
from allennlp.data import ... |
################################################################################
# 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... |
import numpy as np
import scipy.sparse as sp
np.random.seed(0)
def nx_sample_neighbor(nx_g, start_node):
neighbors = [nd for nd in nx_g.neighbors(start_node)]
return np.random.choice(neighbors, size=1)[0]
def random_walk_with_restart(g, node_idx, restart_prob, length):
trace = [node_idx]
start_nod... |
Bridge Edges
#
# First some utility functions
#
def make_link(G, node1, node2, r_or_g):
# modified make_link to apply
# a color to the edge instead of just 1
if node1 not in G:
G[node1] = {}
(G[node1])[node2] = r_or_g
if node2 not in G:
G[node2] = {}
(G[node2])[node1] = r_or_g
... |
#!/usr/bin/env python3
"""tests for crowsnest.py"""
import os
from subprocess import getstatusoutput, getoutput
prg = './crowsnest.py'
consonant_words = [
'brigantine', 'clipper', 'dreadnought', 'frigate', 'galleon', 'haddock',
'junk', 'ketch', 'longboat', 'mullet', 'narwhal', 'porpoise', 'quay',
'regatta... |
from __future__ import absolute_import
import pytest
from . import test_utils as u
import SimEngine.Mote.MoteDefines as d
@pytest.fixture(params=[True, False])
def fixture_secjoin_enabled(request):
return request.param
def test_secjoin_msf(sim_engine, fixture_secjoin_enabled):
sim_engine = sim_engine(
... |
from collections import deque
class MyStack:
def __init__(self):
"""
Initialize your data structure here.
"""
self.stack = deque()
def push(self, x: int) -> None:
"""
Push element x onto stack.
"""
self.stack.append(x)
def pop(self) -> int:... |
#!/usr/bin/env python3
import sys
import argparse
import inspect
from signal import signal, SIGINT
import time
import datetime
import board
import neopixel
from colors import Color
from helpers import frange, pre_execution, post_execution, retry
class LEDPanel:
def __init__(self, pixel_pin=board.D18, num_pixels... |
# future
from __future__ import with_statement
# stdlib
from logging.config import fileConfig
import os
# third party
from alembic import context # type: ignore
from sqlalchemy import engine_from_config
from sqlalchemy import pool
# grid absolute
from grid.db.base import Base
# this is the Alembic Config object, w... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import simplejson as json
from alipay.aop.api.constant.ParamConstants import *
class ClientInfo(object):
def __init__(self):
self._language = None
self._os = None
self._type = None
self._version_no = None
@property
def langua... |
# Problem 142: Perfect Square Collection
# https://projecteuler.net/problem=142
memo_i_max = 500
memo = [i**2 for i in range(memo_i_max+1)] # note: contains 0**2
def sq(i):
global memo_i_max
if i > memo_i_max:
for j in range(memo_i_max+1, i+100+1):
memo.append(j**2)
me... |
#!/usr/bin/env python3
import os
import itertools
import tempfile
import sys
# TODO(nodir): pass these variables as a runtime parameter
MAIN_PATH = '../../..'
CPU_TIME_LIMIT = 3600 # seconds
RAM_LIMIT = 80000 # 80 GB
runlim_tmp = tempfile.mktemp()
if len(sys.argv)>1:
fmcad_modes=[sys.argv[1]]
print("Running fmc... |
# 462. 最少移动次数使数组元素相等 II
#
# 20200916
# huao
# 是中位数,不是平均数哦
from typing import List
class Solution:
def minMoves2(self, nums: List[int]) -> int:
nums.sort()
mid = nums[len(nums) // 2]
move = 0
for num in nums:
move += abs(num - mid)
return move |
# Copyright 2017 Google Inc. 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 ag... |
from __future__ import division
from numba import cuda # type: ignore
import cupy as cp # type: ignore
import math
class CrossA0001:
"""CrossA0001."""
def __init__(self) -> None:
"""__init__.
:rtype: None
"""
pass
def _crossA0001(
self,
X: cp.core.core.... |
# Copyright (c) 2021 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... |
# Copyright (c) 2021 Qianyun, Inc. All rights reserved.
from cloudify.utils import convert2bool
from .utils import get_instance_or_source_node_properties, get_connection_config
class Connector(object):
def __init__(self):
self.node_properties = get_instance_or_source_node_properties()
self.connec... |
# 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 glob
import os
import sys
import llnl.util.filesystem as fs
class Papi(AutotoolsPackage):
"""PAPI provides t... |
from aws_service_reserver.rds_helper import RdsHelper
from aws_service_reserver.reservable import Reservable
OFFERING_ID_FLAG = '--reserved-db-instances-offering-id'
INSTANCE_COUNT_FLAG = '--db-instance-count'
class RdsReservable(Reservable):
def format_cli_command(self, instance_count_string, offering_id_strin... |
from abc import ABC
import numpy as np
from geomstats.geometry.grassmannian import GrassmannianCanonicalMetric
class GrassmannianChordal2NormMetric(GrassmannianCanonicalMetric, ABC):
def __init__(self, n, p):
super().__init__(n, p)
def dist(self, point_a, point_b):
"""Chordal 2-norm distance between two point... |
__all__ = ('bboards', 'crafting', 'general', 'guest', 'jobs',
'maps', 'roster', 'social', 'staff_commands', 'unloggedin',
'xp')
|
import logging
import subprocess
import matplotlib.pyplot as plt
from copy import copy
from pathlib import Path
from math import pi, tan
import numpy as np
import astropy.units as u
from astropy.io import ascii
from astropy.table import QTable
import simtools.config as cfg
import simtools.io_handler as io
import simt... |
from datetime import datetime, timedelta
import pandas as pd
from .base import _IEXBase
from iexfinance.utils.exceptions import IEXQueryError
# Data provided for free by IEX
# Data is furnished in compliance with the guidelines promulgated in the IEX
# API terms of service and manual
# See https://iextrading... |
import pytest
import threading
from time import sleep
from datetime import datetime, timedelta
from emit import queue
from emit.decorators import defer, delay
from emit.transports import (
Transport, Worker, Group, ThreadedWorker, WorkerError, WorkerStoppedError)
from emit.queue import Queue
from emit.utils import ... |
# Copyright 2017, OpenCensus 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 in w... |
class Cursor():
def __init__(self):
self.x = 0
self.y = 0
|
from django.shortcuts import render
from apps.mysensing import Room, Door
from rest_framework import viewsets
from apps.mysensing.serializers import RoomSerializer, DoorSerializer
import requests
import json
# Create your views here.
class RoomViewSet(viewsets.ModelViewSet):
queryset = Room.objects.all()
seri... |
import seaborn as sns
import matplotlib.pyplot as plt
import numpy as np
import pylab
import csv
import random
import sys
import os
def get_data(path):
epoch = []
num_reach_target = []
num_hit_obs = []
num_out_of_range = []
num_moving = []
with open(path, "r+", encoding="utf-8") as csvfile:
... |
#!/usr/bin/env python
# Licensed to Cloudera, Inc. under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. Cloudera, Inc. licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you ma... |
import re
import logging, traceback
from websocket import create_connection
from watson_developer_cloud import AuthorizationV1, SpeechToTextV1
import json
import threading
import sys, os
import time
from configparser import SafeConfigParser
######
try:
parser = SafeConfigParser()
parser.read(sys.argv[1] + "/..... |
"""
Model fields for working with trees.
"""
from __future__ import unicode_literals
from django.db import models
from django.conf import settings
from mptt.forms import TreeNodeChoiceField, TreeNodeMultipleChoiceField
__all__ = ('TreeForeignKey', 'TreeOneToOneField', 'TreeManyToManyField')
class TreeForeignKey(mo... |
import os
from setuptools import setup, find_packages
from setuptools_git_versioning import version_from_git
HERE = os.path.dirname(os.path.abspath(__file__))
with open(os.path.join(HERE, "README.md"), "r") as f:
long_description = f.read()
with open(os.path.join(HERE, "requirements.txt"), "r") as f:
require... |
from typing import List, Dict, TYPE_CHECKING, Optional, Union
from gym import spaces
import numpy as np
import pandas as pd
from highway_env import utils
from highway_env.envs.common.finite_mdp import compute_ttc_grid
from highway_env.road.lane import AbstractLane
from highway_env.utils import distance_to_circle
from ... |
import random
from discord.ext import commands
from ..events.utils import Utils
class Eight(commands.Cog):
"""Eight Command Class"""
def __init__(self, bot):
self.bot = bot
self.desc = "Magic 8 ball - fortune telling tool."
self.usage = "eight [text]"
@commands.command(name='eigh... |
from typing import Optional, List, Union
import os
import pandas as pd
import numpy as np
from joblib import parallel_backend
import ray.cloudpickle as cpickle
from ray.ml.checkpoint import Checkpoint
from ray.ml.predictor import Predictor, DataBatchType
from ray.ml.preprocessor import Preprocessor
from ray.ml.consta... |
# ======================================================================
#
# Brad T. Aagaard, U.S. Geological Survey
#
# This code was developed as part of the Computational Infrastructure
# for Geodynamics (http://geodynamics.org).
#
# Copyright (c) 2010-2017 University of California, Davis
#
# See COPYING for license... |
from ..grpc_gen.common_pb2 import ConsistencyLevel
LOGICAL_BITS = 18
LOGICAL_BITS_MASK = (1 << LOGICAL_BITS) - 1
EVENTUALLY_TS = 1
BOUNDED_TS = 2
DEFAULT_CONSISTENCY_LEVEL = ConsistencyLevel.Bounded
|
from yggdrasil.communication.transforms.TransformBase import TransformBase
class FilterTransform(TransformBase):
r"""Class for applying a filter."""
_transformtype = 'filter'
_schema_required = ['filter']
_schema_properties = {'filter': {'$ref': '#/definitions/filter'}}
def __init__(self, *args, ... |
#!/usr/bin/env python3
# Copyright (c) 2015-2017 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 a node with the -disablewallet option.
- Test that validateaddress RPC works when running with -d... |
from helpers import *
import extras
# print(f"[I] __name__ in main.py: {__name__}")
name = 'Little Wolf'
print(f"Lowercase Leters: {extract_lower(extras.name)}")
print(f"Uppercase Leters: {extract_upper(extras.name)}") |
from .settings import settings
from .auth import Auth
import requests
class Notification:
id = None
def __init__(self, task = None):
self.id = task
def Read():
if not Auth.tokenValid():
Auth.refreshToken()
response = requests.get(settings.baseURL + 'api/message?type=... |
from django.shortcuts import render, reverse, HttpResponseRedirect
from django.views import View
from meal_plan_app.forms import CreateMealPlanForm
from meal_plan_app.models import MealPlan
from django.contrib.auth.decorators import login_required
# Create your views here.
@login_required
def meal_plan_view(request, i... |
"""Runs the OSU MPI benchmarks.
Source:
https://mvapich.cse.ohio-state.edu/benchmarks/
Uses IntelMPI
"""
from typing import Any, Dict, Iterator, List
from absl import flags
from perfkitbenchmarker import benchmark_spec
from perfkitbenchmarker import configs
from perfkitbenchmarker import sample
from perfkitbenchm... |
# -*- coding: utf-8 -*-
# File generated according to Generator/ClassesRef/Machine/WindingCW1L.csv
# WARNING! All changes made in this file will be lost!
"""Method code available at https://github.com/Eomys/pyleecan/tree/master/pyleecan/Methods/Machine/WindingCW1L
"""
from os import linesep
from logging import getLogg... |
# emacs: -*- mode: python; py-indent-offset: 4; tab-width: 4; indent-tabs-mode: nil -*-
# ex: set sts=4 ts=4 sw=4 noet:
# ## ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ##
#
# See COPYING file distributed along with the datalad package for the
# copyright and license terms.
#
# ## ### ##... |
"""
Contains functions related to calculations important for characterizing molecule structure.
"""
import numpy as np
def calculate_distance(rA, rB):
"""
This function calculates the distance between two points given as numpy arrays.
Parameters
----------
rA, rB : np.adarray
The coordina... |
# Lint as: python3
# Copyright 2019 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agr... |
'''
Canonical name for the program
'''
program_name = "SNPs_Analysis"
|
# Copyright 2018 Google LLC.
"""Linter plugin for pylint."""
import collections
import logging
import sys
import re
from subprocess import Popen, PIPE
from pylint.epylint import py_run
from pygls import hookimpl, lsp
try:
import ujson as json
except Exception: # pylint: disable=broad-except
import json
log ... |
from django.conf.urls import patterns, url
from webalyzer.collected import views
urlpatterns = patterns(
'',
url(r'^$', views.index, name='index'),
url(
r'^(?P<domain>[\w\.]+)$',
views.index,
name='domain_index'
),
url(
r'^recently-collected$',
views.recent... |
from bs4 import BeautifulSoup
import requests
import os, sys
global book_page_num
book_page_num = 0
page_max = 136
download_links = []
categories = {
1:"web-development",
2:"programming",
3:"datebases",
4:"game-programming",
5:"graphics-design",
6:"operating-systems",
7:"networking-cloud-computing",
8:"admin... |
import pytest
import scenic
from scenic.core.errors import InvalidScenarioError, RuntimeParseError
from scenic.core.object_types import Object
from tests.utils import compileScenic, sampleScene, sampleEgo, sampleParamPFrom
def test_empty():
with pytest.raises(InvalidScenarioError):
compileScenic('')
def... |
# coding: utf-8
"""
Kubernetes
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) # noqa: E501
OpenAPI spec version: release-1.15
Generated by: https://openapi-generator.tech
"""
import pprint
import re # noqa: F401
import six
class V1Sca... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.