content stringlengths 5 1.05M |
|---|
"""Tools for multi-streams"""
from itertools import product
from typing import Mapping, Iterable, Any, Optional, Callable
import heapq
from dataclasses import dataclass
from functools import partial
from operator import itemgetter
from creek.util import Pipe, identity_func
StreamsMap = Mapping[Any, Iterable] # a ma... |
# coding: utf-8
"""
蓝鲸用户管理 API
蓝鲸用户管理后台服务 API # noqa: E501
OpenAPI spec version: v2
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
import pprint
import re # noqa: F401
import six
class CreateCategory(object):
"""NOTE: This class is auto generated by the swagger co... |
#!/usr/bin/env python
# encoding: utf-8
"""
dataloader.py
Created by Shuailong on 2016-10-12.
Dataset for Blame Analysis project.
"""
import os
import csv
import re
import datetime
import string
#fix relative import statement to absolute import statement
from blamepipeline import DATA_DIR
#sets folder under data
... |
import urllib.request
from dataclasses import dataclass, field
from pathlib import Path
from typing import Tuple
import numpy as np
import pandas as pd
@dataclass
class BaseDataset:
name: str = field(init=False)
num_samples: int = field(init=False)
num_features: int = field(init=False)
num_outlier: i... |
#!/usr/bin/env python3
# Copyright (c) 2019 The Zcash developers
# Copyright (c) 2020 The PIVX developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or https://www.opensource.org/licenses/mit-license.php.
from test_framework.test_framework import SurgeTestFramework
from test_fram... |
from django.contrib.gis import admin
from .models import WorldBorder, Forest, Lake, Province, POI, River
admin.site.register(WorldBorder, admin.GeoModelAdmin)
admin.site.register(Forest, admin.GeoModelAdmin)
admin.site.register(Lake, admin.GeoModelAdmin)
admin.site.register(Province, admin.GeoModelAdmin)
admin.site.r... |
# coding=utf8
# Copyright 2018 JDCLOUD.COM
#
# 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 ... |
class Solution:
def lengthOfLastWord(self, s: str) -> int:
# Approach 2
# Check only the tail of the string
# Trim if empty space is present
# iterate until the next space
space = chr(32)
i = len(s)-1
count = 0
while i>=0 and s[i] == space:
... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Hive Colony Framework
# Copyright (c) 2008-2020 Hive Solutions Lda.
#
# This file is part of Hive Colony Framework.
#
# Hive Colony Framework is free software: you can redistribute it and/or modify
# it under the terms of the Apache License as published by the Apach... |
import numpy as np
import pandas as pd
def calculate_bounds(df, modes, maximum_bin_count, distance = "euclidean_distance", minimum_distance = 0.0, maximum_distance = np.inf):
bounds = {}
df = df.copy()
df = df[df[distance] >= minimum_distance]
df = df[df[distance] < maximum_distance]
for mode in ... |
import cv2
import numpy as np
from math import exp as exp
# object label list
LABELS=['person', 'bicycle', 'car', 'motorbike', 'aeroplane', 'bus', 'train', 'truck', 'boat', 'traffic light', 'fire hydrant', 'stop sign', 'parking meter', 'bench', 'bird', 'cat', 'dog', 'horse', 'sheep', 'cow', 'elephant', 'bear', 'zebra'... |
#
# PySNMP MIB module SLP1-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/SLP1-MIB
# Produced by pysmi-0.3.4 at Wed May 1 15:07:31 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar 27 2019, 09:23:1... |
# 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 u... |
"""
Total Field Magnetic Anomaly from Great Britain
================================================
These data are a complete airborne survey of the entire Great Britain
conducted between 1955 and 1965. The data are made available by the
British Geological Survey (BGS) through their `geophysical data portal
<https://... |
from django.shortcuts import render
from django.http import HttpResponse, HttpResponseRedirect
from django.contrib.sites.shortcuts import get_current_site
import pymysql
from django.urls import reverse
from django.contrib.auth import authenticate, login, logout
from django.contrib.auth.decorators import login_required
... |
from baselines.pposgd.pposgd_simple import OBSERVATION_DIM, set_obstacles
# obstacle1.x = 1
# obstacle2.x = 2.5
# obstacle3.x = 2.5 (hidden behind obstacle2)
result = [0] * 42
dx = 0
step = 1
set_obstacles(result, dx, step)
assert set_obstacles.prev == [-2.0, 0.0, 0.1]
assert set_obstacles.next == [2.0, 0.0, 0.1]
ass... |
import math
def arrowprops(dx, dy, **kwargs):
m = math.sqrt(dx**2 + dy**2)
l = 1/8 * m
w = 2/3 * l
return {
'head_length': kwargs.get('head_length', l),
'head_width': kwargs.get('head_width', w),
'length_includes_head': True,
'overhang': kwargs.get('overhang', 0.0),
... |
import csv
import os
from os.path import basename
import fileinput
import glob
import os.path
import itertools
#da modificare
path_store = 'D:/Projects/DANTE/annotation/'
path_save = 'D:/Projects/DANTE/annotation/expert/'
path_videos = 'D:/Projects/DANTE/video/alpha/'
def readValuesFromCSV(spamReader):
frame... |
import torch as tc
import moviepy.editor as mpy
import numpy as np
import uuid
import os
from collections import deque
import matplotlib.pyplot as plt
@tc.no_grad()
def movie(env, agent, args):
base_path = os.path.join(args.asset_dir, args.model_name)
os.makedirs(base_path, exist_ok=True)
fps = 64
ma... |
from SHIMON.api.ping import ApiPing
from SHIMON.api.error import error
from testing.base import BaseTest
from testing.http import assertHttpResponse
from SHIMON import HttpResponse
class TestPing(BaseTest):
@BaseTest.request_context
def test_ping_with_redirect_returns_http_200(self) -> None:
assertH... |
def encrypt(plaintext):
return plaintext, dict()
def decrypt(plaintext):
return plaintext
|
import base64
import logging
import sys
import time
from typing import TYPE_CHECKING, Dict, List, Optional, Union
try:
import certifi
from awscrt import io, mqtt
from awscrt.exceptions import AwsCrtError
from awsiot import mqtt_connection_builder
except ImportError: # pragma: no cover
pass
import... |
#!/usr/bin/python
# -*- encoding: utf-8 -*-
import os
from functools import wraps
from email.mime.text import MIMEText
from email.mime.multipart import MIMEMultipart
from flask import Flask, Response, request, jsonify, make_response, json
from flask_cors import CORS
import pkg_resources
import smtplib
import time
impo... |
from wtforms import StringField, PasswordField, BooleanField, SubmitField, HiddenField, RadioField
from wtforms.validators import DataRequired, Length, EqualTo
from flask_wtf import FlaskForm
class FindPhoneForm(FlaskForm):
username = StringField('Username', validators=[DataRequired(), Length(3, 64)])
phone_b... |
'''
Created on Mar 5, 2012
@author: jabuhacx
'''
import unittest
import MtWilsonHttpAuthorization
import httplib
import time
import datetime
class Test(unittest.TestCase):
def setUp(self):
self.server = "localhost:8080"
self.url = "/AttestationService/resources"
self.mtwil... |
"""
Desi Tashan Kodi Addon
Copyright (C) 2016 gujal
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.
... |
#Imports
from functools import partial
#Create a key listener class
class KeyListener(object):
#List of keys
keys = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z", "space", "Up", "Do... |
"""
Support for interface with a Sony Bravia TV.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/media_player.braviatv_psk/
"""
import logging
import re
import voluptuous as vol
from homeassistant.components.media_player import (
MediaPlayerDevice, ... |
from typing import List
class Solution:
def minSubArrayLen(self, s: int, nums: List[int]) -> int:
res, l, sum, N = float('inf'), 0, 0, len(nums)
for i in range(N):
sum += nums[i]
while sum >= s:
res = min(res, i+1-l)
sum -= nums[l]
... |
from delorean import Delorean
from gryphon.data_service.auditors.orderbook_auditor import OrderbookAuditor
class CoinbaseOrderbookAuditor(OrderbookAuditor):
def __init__(self):
super(CoinbaseOrderbookAuditor, self).__init__()
self.exchange_name = 'COINBASE_BTC_USD'
product_id = 'BTC-USD'
... |
# Copyright (c) LinkedIn Corporation. All rights reserved. Licensed under the BSD-2 Clause license.
# See LICENSE in the project root for license information.
#!/usr/bin/env python
# -*- coding:utf-8 -*-
import requests
import ujson
from testutils import prefix, api_v0
@prefix('test_v0_rosters')
def test_api_v0_ros... |
from __future__ import absolute_import
from django.db import IntegrityError, transaction
from rest_framework import serializers
from rest_framework.response import Response
from sentry.api.bases.organization import OrganizationEndpoint, OrganizationPermission
from sentry.api.exceptions import ResourceDoesNotExist
fro... |
#!/usr/bin/env python
from os.path import exists
try:
# Use setup() from setuptools(/distribute) if available
from setuptools import setup
except ImportError:
from distutils.core import setup
setup(name='zouk',
version='0.0.1',
author='Angel ILIEV, John Jacobsen',
author_email='a.v.ilie... |
def three_split(seq):
target=sum(seq)/3
cur=None
res=[]
for index,i in enumerate(seq):
if cur==None:
cur=i
else:
cur+=i
if cur==target:
res.append((seq[:index+1], index+1))
res2=[]
for i,j in res:
cur=None
for k,l in enu... |
# -*- coding: utf-8 -*-
from clue.misc import random_integer
class IllegalMove(BaseException):
pass
class MovementBoard:
HALLWAY = 1
def __init__(self, board, special_moves):
self.board = board
self.special_moves = special_moves
def tile_no(self, pos):
return self.board[... |
import pandas
import pandas as pd
import yfinance as yf
yf
r = yf.Ticker('EQNR.OL')
r
r.info
r = yf.Ticker('EQNR.OL')
r = yf.Ticker?
r
r.info?
r.history(proxy='http://www-proxy.statoil.no:80')
r.history()
h = r.history()
len(h)
h
len(yf.Ticker('EQNR.OL').history())
len(yf.Ticker('MSFT').history())
len(yf.Ticker('MSFT')... |
import math
def uniform(size, tensor):
stdv = 1.0 / math.sqrt(size)
if tensor is not None:
tensor.data.uniform_(-stdv, stdv)
def glorot(tensor):
stdv = math.sqrt(6.0 / (tensor.size(0) + tensor.size(1)))
if tensor is not None:
tensor.data.uniform_(-stdv, stdv)
def zeros(tensor):
... |
import unittest
from multiprocessing import Process
import requests
import json
import time
from ..exchange import Exchange
from ..config import DefaultConfig
from ..auth import Auth
from ..error import TimeoutError,ResponseError
from grabbag.list import first_not_none
from grabbag.dict import merge
TEST_METHODS = ... |
import unittest
from interpreter import instructions
from interpreter.registers import Registers
class TestAnd(unittest.TestCase):
def test_and(self):
'''
Test the and instruction setting destination register to the
bitwise and of the two source register
'''
reg =... |
import requests
from rest_framework import filters, viewsets, status
from rest_framework.decorators import action
from rest_framework.response import Response
from apps.reviews.models import Review, REVIEW_MARK_NEGATIVE, REVIEW_MARK_POSITIVE, REVIEW_MARK_NEUTRAL
from apps.reviews.serializers import ReviewSerializer
... |
import sqlite3
from discord.ext import commands
class BotEvents(commands.Cog, name = "Bot events"):
def __init__(self, bot):
self.bot = bot
self.bot.loop.create_task(self.update_guilds())
async def update_guilds(self):
await self.bot.wait_until_ready()
for guild in self.bot.guilds:
await self.bot.dbc.e... |
DATA_PATHA = "../data"
cascades = DATA_PATHA+"/dataset_weibo.txt"
cascade_train = DATA_PATHA+"/cascade_train.txt"
cascade_val = DATA_PATHA+"/cascade_val.txt"
cascade_test = DATA_PATHA+"/cascade_test.txt"
shortestpath_train = DATA_PATHA+"/shortestpath_train.txt"
shortestpath_val = DATA_PATHA+"/shortestpath_val.txt"
... |
import click
import numpy as np
from problem19 import LeaderboardCyclopeptideSequencing
def spectrum_mass(spectrum, m):
spectrum = sorted(spectrum)
spectral_convolution = [
spectrum[i] - spectrum[j]
for i in range(len(spectrum))
for j in range(i)]
spectral_convolution.extend(spec... |
# _ _ _
# / \ _ __ __| (_)_ __ ___ _ __ _ _
# / _ \ | '_ \ / _` | | '_ \ / _ \| '_ \| | | |
# / ___ \| | | | (_| | | | | | (_) | |_) | |_| |
# /_/ \_\_| |_|\__,_|_|_| |_|\___/| .__/ \__, |
# |_| |___/
# by Jakob Groß
import abc
class ... |
# ****************************************************************
# Author: Sheldon Dorgelo
# Date (last edited): 02/11/2020
# Purpose: creates a plot with the detections highlighted for
# easier viewing
# ****************************************************************
import DataObject
import matpl... |
import numpy as np
import skimage.io as io
import sys
from PIL import Image
import glob
import ntpath
import os
from nltk.tokenize import RegexpTokenizer
def read_hmap(hmap_path):
hmap = Image.open(hmap_path)
hmap = np.asarray(hmap)
hmap = np.squeeze(hmap[:,:,0])
return hmap
x_index, y_... |
"""
This module provides definitions and functionality related to foreign-exchange conversions.
"""
__all__ = ["FXRate", "FXRateLookupError", "FXRateService"]
from abc import ABCMeta, abstractmethod
from decimal import Decimal
from typing import Iterable, NamedTuple, Optional, Tuple
from .commons.numbers import ONE,... |
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
Created on Fri Sep 8 10:51:21 2017
@author: jlashner
"""
from pylab import *
import tmm
import numpy as np
import matplotlib.pyplot as plt
import scipy.integrate as intg
#Constants
c =2.99792458 * 10**8 #speed of light [m/s]
#Units
GHz = 10 ** 9 # GHz -> Hz
de... |
#!/usr/bin/env python
import typer
from typing import Dict, List, Tuple
from lib import aoc
SAMPLE = ["""\
mxmxvkd kfcds sqjhc nhms (contains dairy, fish)
trh fvjkl sbzzf mxmxvkd (contains dairy)
sqjhc fvjkl (contains soy)
sqjhc mxmxvkd sbzzf (contains fish)
"""]
class Day21(aoc.Challenge):
TIMER_ITERATIONS = (2... |
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy import Column, Integer, String, Date
from sqlalchemy.orm import sessionmaker
# Kita harus import setiap tipe data yang ingin kita gunakan
from sqlalchemy import create_engine
# engine = create_engine('mysql+mysqlconnector://root:ge3k@localhost:330... |
#!/usr/bin/env python
################################################################################
##
## MIT License
##
## Copyright (c) 2018 Team Roborex, NIT Rourkela
##
## Permission is hereby granted, free of charge, to any person obtaining a copy
## of this software and associated documentation files (the "So... |
import hmac
from hashlib import sha1
from time import time
from yarl import URL
from isilon import exceptions
def generate_presigned_uri(
user_key: str, object_uri: str, method: str = "GET", duration: int = 60
) -> str:
"""Generate a presigned url to download objects.
For more information, please see: ... |
from time import sleep
def contagem(i, f, p):
print('~' * 40)
if p == 0: # Segunda opção para p == 0
print('passo = 1')
p = 1 # end
if p < 0:
p = -p # p *= -1
print(f'Contagem de {i} até {f} de {p} em {p}')
sleep(1)
if i <= f:
while i <= f:
print(... |
"""
The lower-level driver for the QICK library. Contains classes for interfacing with the SoC.
"""
import os
import json
from pynq import Overlay, DefaultIP, allocate
try:
import xrfclk
import xrfdc
except:
pass
import numpy as np
from pynq.lib import AxiGPIO
import time
from .parser import *
from .streame... |
# Exercício Python 115: Crie um pequeno sistema modularizado
# Crie um Pequeno sistema Modularizado
# que permita cadastrar pessoas pelo seu nome e idade em um arquivo de texto simples.
# O sistemas terá 3 opções:
# Listar, Cadastrar, Sair
from ex115.menu.menu import *
from time import sleep
arquivo_diretorio = "./ba... |
#!/usr/bin/env python
"""
Hello world script for Session API (https://www.tropo.com/docs/webapi/sessionapi.htm)
Upon launch, it will trigger a message to be sent via Jabber to the addess specified in
'number'.
"""
from itty import *
from ciscotropowebapi import Tropo, Session
from urllib import urlencode
from urllib2... |
from spaceone.core.error import *
class ERROR_SCHEDULE_OPTION(ERROR_INVALID_ARGUMENT):
_message = 'Only one schedule option can be set. (cron | interval | minutes | hours)'
|
# Generated by Django 3.1.7 on 2021-03-24 05:14
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('atd', '0003_uploadfile'),
]
operations = [
migrations.CreateModel(
name='FileUpload',
fields=[
('id'... |
from discord.ext import commands
import discord.utils
def is_owner_check(message):
""""is it me?"""
return message.author.id == '149281074437029890'
def is_owner():
"""is me but a decorator"""
return commands.check(lambda ctx: is_owner_check(ctx.message))
def is_user_check(message, user_id):
"""I... |
import asyncio
import os
import shutil
from datetime import datetime
from pathlib import Path
from typing import List
from fastapi import APIRouter, Depends, HTTPException, Response
from fastapi.security.api_key import APIKey
from sqlalchemy.orm import Session
from app import schemas
from app.api.deps import get_api_... |
import unittest
from darwcss.darwcss import CSS, Selector, Style
class TestConf(unittest.TestCase):
def test_conf_inheritance_selector(self):
css = CSS({"darwcss_auto": True})
with css.selector('.home') as selector:
self.assertEqual(selector.meta_cfg, {"darwcss_auto": True})
... |
import logging
from typing import Dict, List, Optional, Tuple
from localstack import config
from localstack.services import install
from localstack.utils.common import (
TMP_THREADS,
ShellCommandThread,
chmod_r,
get_free_tcp_port,
mkdir,
)
from localstack.utils.run import FuncThread
from localstack... |
from ..deque.deque import Deque, Cell
from .exceptions import InconsistentMaxSize
class DequeuedQueue(Deque):
def __init__(self, max_size):
if max_size <= 0:
raise InconsistentMaxSize("DequeuedQueue has max_size greater than 0")
super().__init__(max_size)
def _add(self, data, pos... |
import os
from typing import Generator
from .vector import Colour
def chunk(seq: list[str], n: int) -> Generator[list[str], None, None]:
for i in range(0, len(seq), n):
yield seq[i : i + n]
class Canvas:
def __init__(self, width: int, height: int) -> None:
self.height = height
self.... |
default_app_config = '_app.initial_data.apps.InitialDataConfig'
|
# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT!
import grpc
import api_pb2 as api__pb2
class ManagerStub(object):
"""For each RPC service, we define mapping to HTTP REST API method.
The mapping includes the URL path, query parameters and request body.
https://cloud.google.com/service-infr... |
import argparse
import sys
from flowy import SWFWorkflowStarter
def main():
parser = argparse.ArgumentParser()
parser.add_argument("domain")
parser.add_argument("name")
parser.add_argument("version")
parser.add_argument("--task-list")
parser.add_argument("--task-duration", type=int, default=N... |
import argparse
import copy
from covid19.version import version
def get_configuration(args=None):
default_interval = 1200
default_port = 8080
default_pg_port = 5432
default_pg_database = 'covid19'
parser = argparse.ArgumentParser()
parser.add_argument('--version', action='version', version=f... |
#!/usr/bin/env python
import os
import unittest
import sys
from test_common import TestCommon
sys.path.append(os.path.join(os.path.dirname(__file__), '..', 'library'))
from fastly_service import FastlyConfiguration
class TestFastlySettings(TestCommon):
@TestCommon.vcr.use_cassette()
def test_fastly_settings(... |
from collections import defaultdict
from typing import List, Tuple, Set, Optional
import torch
from torch.utils.data import Dataset
from transformers import BertTokenizer
MAX_SEQ_LEN = 512
def turn2example(
tokenizer: BertTokenizer,
domain: str,
slot: str,
value: str,
context_ids: List[int],
... |
# Copyright (C) 2019 Nanyang Wang, Yinda Zhang, Zhuwen Li, Yanwei Fu, Wei Liu, Yu-Gang Jiang, Fudan University
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may no... |
# Generated by Django 2.2.19 on 2021-06-24 09:54
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('posts', '0004_auto_20210617_1146'),
]
operations = [
migrations.AlterModelOptions(
name='pagehit',
options={'ordering': ['c... |
import sys
from collections import deque
input = sys.stdin.readline
'''
BFS를 쓰면 초 단위로 바이러스 퍼지는거 파악 가능
각 바이러스별로 다음 단위시간에 퍼질 구역들을 저장할 배열 필요.
'''
# function
def bfs(N, S):
directions = ((1, 0), (-1, 0), (0, 1), (0, -1))
time_table = [[0 for _ in range(N)] for _ in range(N)]
while virus:
r, c, virus_na... |
# -*- coding: utf-8 -*-
"""
Example script to serve as starting point for displaying and comparing results of motion correction versus no motion correction.
Prerequisite:
You should have executed the following on your command prompt
./run_simulations_thorax.sh
./run_MCIR_0.sh
./run_MCIR_1.sh
Authors: Kris... |
# Solution to [Python If-Else](https://www.hackerrank.com/challenges/py-if-else/problem)
#!/bin/python3
if __name__ == '__main__':
weird = "Weird"
not_weird = "Not Weird"
n = int(input().strip())
odd = (n % 2 == 1)
even = not odd
if odd:
print(weird)
elif even and 2 <= n ... |
'''
Test the TMCL_Slave.
Created on 15.12.2020
@author: LK
'''
from PyTrinamicMicro.TMCL_Slave import TMCL_Slave
from PyTrinamicMicro.connections.virtual_tmcl_interface import virtual_tmcl_interface
from PyTrinamic.TMCL import TMCL_Request, TMCL_Reply, TMCL
from PyTrinamic.modules.TMCM0960.TMCM0960 import TMCM0960
i... |
from django.contrib import admin
from .models import Reference
@admin.register(Reference)
class ReferenceAdmin(admin.ModelAdmin):
list_display = ['title', 'description', 'link', 'author', 'publish']
|
import os
import logging
from flask import Flask, render_template, Response, send_from_directory, request, current_app
flask_app = Flask(__name__)
logging.basicConfig()
log = logging.getLogger(__name__)
@flask_app.route("/")
def main():
return render_template('main.html', title='Inventory')
@flask_app.route("/s... |
"""
Extractor module
"""
from nltk.tokenize import sent_tokenize
from .base import Pipeline
from .questions import Questions
from .tokenizer import Tokenizer
class Extractor(Pipeline):
"""
Class that uses an extractive question-answering model to extract content from a given text context.
"""
def _... |
"""Dialog to ask user for base class and class name
@copyright: 2016-2018 Dietmar Schwertberger
@license: MIT (see LICENSE.txt) - THIS PROGRAM COMES WITH NO WARRANTY
"""
import wx
import common, compat
class WindowDialog(wx.Dialog):
# dialog for builder function
parent = parent_property = None # used by S... |
import numpy as np
from copy import deepcopy
from pycqed.measurement.waveform_control.block import Block
from pycqed.measurement.waveform_control import sequence
from pycqed.measurement.waveform_control import pulsar as ps
from pycqed.measurement.pulse_sequences.single_qubit_tek_seq_elts import \
sweep_pulse_params... |
from pymilvus_orm import Index
from pymilvus_orm.types import DataType
from pymilvus_orm.default_config import DefaultConfig
import sys
sys.path.append("..")
from check.param_check import *
from check.func_check import *
from utils.util_log import test_log as log
from common.common_type import *
def index_catch():
... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# SPDX-License-Identifier: Apache-2.0
# SPDX-FileCopyrightText: © 2021 Massachusetts Institute of Technology.
# SPDX-FileCopyrightText: © 2021 Lee McCuller <mcculler@mit.edu>
# NOTICE: authors should document their contributions in concisely in NOTICE
# with details inline ... |
"""
Information about individual spreadsheets as they're used in the spreadsheet
visualizer.
"""
from nest_py.core.data_types.tablelike_schema import TablelikeSchema
COLLECTION_NAME = 'ssviz_spreadsheets'
def generate_schema():
schema = TablelikeSchema(COLLECTION_NAME)
schema.add_foreignid_attribute('file_id... |
# Copyright 2013-2022 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)
from spack import *
class RUnits(RPackage):
"""Measurement Units for R Vectors
Support for measurement units in... |
# import codecs
import codecs
import binascii
s = b'I love python.'
# Using codecs.decode() method
gfg = codecs.decode(s)
print(gfg)
print(binascii.crc32(b"hello world"))
# Or, in two pieces:
crc = binascii.crc32(b"hello")
crc = binascii.crc32(b" world", crc)
print('crc32 = {:#010x}'.format(crc)) |
class Animal(object):
# weight
# color
def __init__(self,weight=None, color=None):
print("Initializing...")
self.weight = weight
self.color = color
def __str__(self):
return "Animal( weight: {}, color: {})".format(self.weight, self.color)
class Mammal(Animal):
def... |
import os
import numpy as np
from netCDF4 import Dataset
from compliance_checker.ioos import (
IOOS0_1Check,
IOOS1_1Check,
IOOS1_2_PlatformIDValidator,
IOOS1_2Check,
NamingAuthorityValidator,
)
from compliance_checker.tests import BaseTestCase
from compliance_checker.tests.helpers import MockTime... |
# Copyright (C) 2019 Google Inc.
# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>
import unittest
import mock
from ggrc.query import builder
class TestQueryHelper(unittest.TestCase):
def test_expression_keys(self):
""" test expression keys function
Make sure it works with:
... |
import os.path
from random import randint
class XkcdPasswordGenerator:
"""generates xkcd-inspired passwords"""
def __init__(self, word_list):
self.word_list = word_list
def generate(self, words=4, separator=' '):
result = [self.random_word() for _ in range(words)]
if separator is ... |
# -*- coding: utf-8 -*-
# Generated by Django 1.11 on 2018-05-04 08:40
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('mygallery', '0001_initial'),
]
operations = [
... |
from django.conf.urls import url
from rest_framework import routers
from talentmap_api.fsbid.views import reference as views
router = routers.SimpleRouter()
urlpatterns = [
url(r'^dangerpay/$', views.FSBidDangerPayView.as_view(), name='FSBid-danger-pay'),
url(r'^cycles/$', views.FSBidCyclesView.as_view(), na... |
'''Sample module showing the creation of blaze arrays'''
from __future__ import absolute_import, division, print_function
import sys
import numpy as np
import blaze
try:
import tables as tb
except ImportError:
print("This example requires PyTables to run.")
sys.exit()
def print_section(a_string, level... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('heritage', '0012_auto_20160107_0107'),
]
operations = [
migrations.AddField(
model_name='asset',
nam... |
# ---
# jupyter:
# jupytext:
# formats: ipynb,py:percent
# text_representation:
# extension: .py
# format_name: percent
# format_version: '1.3'
# jupytext_version: 1.12.0
# kernelspec:
# display_name: ODC
# language: python
# name: odc
# ---
# %% [markdown]
# # Access Se... |
"""The Blackholes AstroCatalog.
"""
# flake8: noqa --- ignore imported but unused flake8 warnings
import os
import glob
from . import main
# from . import production
_PATH_BLACKHOLES = os.path.join(os.path.dirname(__file__), "")
PATH_BH_SCHEMA = os.path.join(_PATH_BLACKHOLES, "schema", "")
|
from core import *
#\item[something] has no enumeration
#[TAG] changes arguments to [] type
"""
<ol class="enumeration" type="1">
<li value="(O1)">This is item three.</li>
<li value="(O2)">This is item fifty.</li>
<li value="(O3)">
Something Aweakkjlk
<ol class="enumeration" type="1">
<li value... |
#!/usr/bin/python
import fileinput
import os
try:
with fileinput.FileInput('./env/lib/python3.8/site-packages/firebase/__init__.py', inplace=True, backup='.bak') as file:
for line in file:
print(line.replace('.async', '.assync'), end='')
with fileinput.FileInput('./env/lib/python3.8/site-p... |
from typing import List, TypedDict
from google.appengine.ext import ndb
from backend.common.consts.api_version import ApiMajorVersion
from backend.common.models.event import Event
from backend.common.models.location import Location
from backend.common.queries.dict_converters.converter_base import ConverterBase
clas... |
cidade = str(input('Digite uma o nome de cidade: ')).lower().strip()
print(cidade[:5] == 'santo')
#separado = cidade.split()
#print('santo' in separado[0])
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.