text stringlengths 2 999k |
|---|
import json
from time import sleep
import gspread
import requests
from gspread_formatting import *
from oauth2client.service_account import ServiceAccountCredentials
class Spreadsheet:
# comment out all but one of these depending on which spreadsheet being used
# URL = 'https://docs.google.com/spreadsheets/... |
import logging
import os
import numpy as np
import torch
from torch.utils.data import Dataset, DataLoader
import torchvision.transforms as transforms
from torch.utils.data.distributed import DistributedSampler
from .dataset import CheXpert
def _get_mean_and_std(dataset: Dataset):
"""Compute the mean and std of ... |
import json
from collections import Iterable
from pathlib import Path
import cadquery as cq
import matplotlib.pyplot as plt
import plotly.graph_objects as go
from cadquery import exporters
import paramak
from paramak.neutronics_utils import (add_stl_to_moab_core,
define_moab_cor... |
#!/usr/bin/python2
"""
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"); yo... |
"""
Logging module for printing status during an exploit, and internally
within ``pwntools``.
Exploit Developers
------------------
By using the standard ``from pwn import *``, an object named ``log`` will
be inserted into the global namespace. You can use this to print out
status messages during exploitation.
For e... |
import rows
import os
from timeit import default_timer
import json
output_path = '../package/data/'
class Brasilio(object):
def __init__(self, output_path='../package/data/', verbose=False):
self.verbose = verbose
self.output_path = output_path
self.timer = default_timer
def _... |
#!/usr/bin/env python3
import os
import pathlib
import sys
import subprocess
def has_cargo_fmt():
"""Runs a quick check to see if cargo fmt is installed."""
try:
c = subprocess.run(["cargo", "fmt", "--", "--help"], capture_output=True)
except OSError:
return False
else:
return ... |
import os
import distutils.spawn
import mpi4py
from mpi4py import MPI
def check_mpi():
mpiexec_path, _ = os.path.split(distutils.spawn.find_executable("mpiexec"))
for executable, path in mpi4py.get_config().items():
if executable not in ['mpicc', 'mpicxx', 'mpif77', 'mpif90', 'mpifort']:
co... |
import queue
import time
import numpy as np
class CameraInformation:
def __init__(self, cam_id: str):
self._frame_queue: queue.Queue = queue.Queue(maxsize=1)
self._frame_shape = None
self._last_frame_time = None
self.is_online = True
self.node_id = cam_id
def write_fra... |
# AUTO-GENERATED by tools/checkspecs.py - DO NOT EDIT
from __future__ import unicode_literals
from ..utils import Generate5tt
def test_Generate5tt_inputs():
input_map = dict(
algorithm=dict(
argstr='%s',
mandatory=True,
position=-3,
),
args=dict(argstr='... |
#!/usr/bin/env python
from setuptools import setup
def readme():
with open('README.md') as f:
return f.read()
setup(
name='impasse',
# Version chosen for parity with Assimp since we need ABI compatibility
version='5.0.6',
license='BSD',
description='Alternate Python bindings for the... |
from __future__ import absolute_import
from __future__ import print_function
import sys
import os
# the next line can be removed after installation
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.dirname(
os.path.dirname(os.path.dirname(os.path.abspath(__file__)))))))
from veriloggen import *
import ve... |
# Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0
# For details: https://github.com/nedbat/coveragepy/blob/master/NOTICE.txt
"""Tests for coverage.numbits"""
import json
import sqlite3
from hypothesis import example, given, settings
from hypothesis.strategies import sets, integers
from... |
#!/usr/bin/env python3
import os
import math
from cereal import car, log
from common.numpy_fast import clip, interp
from common.realtime import sec_since_boot, config_realtime_process, Priority, Ratekeeper, DT_CTRL
from common.profiler import Profiler
from common.params import Params, put_nonblocking
import cereal.mess... |
import cozmo
name = input("What is your name? ")
def cozmo_program(robot: cozmo.robot.Robot):
robot.say_text(
f"Hi! My name is Cozmo. How are you, {name}?").wait_for_completed()
cozmo.run_program(cozmo_program)
|
# Copyright (c) 2016 Uber Technologies, Inc.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publ... |
from binascii import crc32
from contextlib import contextmanager
from datetime import datetime, timedelta, timezone
from pathlib import Path
from osgeo import gdal
import pytest
import rasterio
from click.testing import CliRunner
from rasterio import DatasetReader
from rasterio.enums import Compression
from rio_cogeo ... |
import scrapy, re
from alleco.objects.official import Official
class ross_t(scrapy.Spider):
name = "ross_t"
muniName = "ROSS"
muniType = "TOWNSHIP"
complete = True
def start_requests(self):
urls = ['https://www.ross.pa.us/245/Board-of-Commissioners',
'https://www.ross.pa.us/225/Other-Elected-Offic... |
"""
状态模式
"""
from __future__ import annotations
from abc import ABC, abstractmethod
class Context:
# 状态(状态模式的判断)
_state: State = None
def __init__(self, state: State) -> None:
self.transition_to(state)
def transition_to(self, state: State) -> None:
# 根据不同状态,切换上下文
self._state ... |
# -*- coding: utf-8 -*-
# Copyright 2020 Green Valley Belgium NV
#
# 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... |
import os
import time
import pickle
import math
import numpy as np
import linecache
import matplotlib.pyplot as plt
# from matplotlib.pyplot import MultipleLocator
import grid
data_path = 'E:/dataset/didi/processed'
save_path = 'E:/dataset/didi/processed/order_20161101_sampled_value_map_fig'
data_file_name = 'process... |
w = int(input())
h = int(input())
for i in range(h):
output = str()
for j in range(w):
if (i + j) % 2 == 0:
output += '0'
else:
output += '1'
print(output) |
<warning descr="Python version 2.6, 2.7 do not support this syntax.">raise exception from cause</warning>
a = 1 |
from bridges.symbol import *
class Text(Symbol):
def __init__(self, label = None):
super(Text, self).__init__()
if label is not None:
self._text = label
else:
self._text = ""
self.stroke_width = 1.0
self._font_size = None
self._anchor_ali... |
import torch
import torch.nn as nn
import rdkit.Chem as Chem
import torch.nn.functional as F
from hgraph.nnutils import *
from hgraph.encoder import IncHierMPNEncoder
from hgraph.mol_graph import MolGraph
from hgraph.inc_graph import IncTree, IncGraph
class HTuple():
def __init__(self, node=None, mess=None, vmask=... |
#!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates. All rights reserved.
import unittest
import numpy as np
import numpy.testing as npt
import six
from caffe2.python import core, workspace
from ml.rl.caffe_utils import C2
from ml.rl.preprocessing import identify_types, normalization
from ml.rl.p... |
import speech_recognition as sr
r=sr.Recognizer()
with sr.Microphone() as source:
print("Say Something")
sudio=r.listen(source)
print("Time over")
try:
print("Text: "+r.recognize_google(audio))
except:
pass
|
import tkinter
from tkinter import *
win = Tk()
sb = Spinbox(win, from_=0, to=10)
sb.pack()
win.mainloop()
|
import citysim3d.envs
from visual_dynamics.envs import Env
class ServoingEnv(citysim3d.envs.SimpleQuadPanda3dServoingEnv, Env):
def _get_config(self):
config = super(ServoingEnv, self)._get_config()
config.update({'env': self.env,
'max_time_steps': self.max_time_steps,
... |
from .dynamic_iterbased_runner import DynamicIterBasedRunner
__all__ = ['DynamicIterBasedRunner']
|
#Django Imports
from django.conf import settings
#Python Imports
import requests, os
#Local Imports
from .at_utils import AfricasTalkingException
#Import Afica's Talking Settings
AFRICAS_TALKING_SETTINGS = getattr(settings,'AFRICAS_TALKING',{})
API_KEY = AFRICAS_TALKING_SETTINGS.get('API_KEY',None)
USERNAME = AFRI... |
#! /usr/bin/env python
# encoding: utf-8
# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file
import os,sys,traceback,base64,signal
try:
import cPickle
except ImportError:
import pickle as cPickle
try:
import subprocess32 as subprocess
except ImportError:
import subprocess
try:
TimeoutEx... |
# -*- coding: utf-8 -*-
"""
Class and program to colorize python source code for ANSI terminals.
Based on an HTML code highlighter by Jurgen Hermann found at:
http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/52298
Modifications by Fernando Perez (fperez@colorado.edu).
Information on the original HTML highligh... |
# Last Updated: 2.2
from datetime import datetime
from util.diagMessage import DiagMessage
# Logger class
# Buffers and writes messages to a file
class Logger:
BUFFER_MAX = 10
DEFAULT_FN = "../log.txt"
# Constructor for logger class
# Params: fn - file name to use or leave default
# log -... |
# Standard Library
from copy import deepcopy
# 3rd Party
# Internal
# ########################################################################### #
class MetaData (dict):
"""
A class for holding information about an object
"""
def __init__ (self,*args,**kwargs):
super(MetaData,self).__... |
Inc('dfaccto/util.py', abs=True)
class _Event(ModuleContext):
def __init__(self):
ModuleContext.__init__(self)
self._setup_packages()
def _setup_packages(self):
self.pkg = Pkg('dfaccto_event',
x_templates={self.File('generic/package.vhd.tpl'): self.File('pkg/dfaccto_event.vhd')})
with se... |
# -*- coding: utf-8 -*-
# Max-Planck-Gesellschaft zur Förderung der Wissenschaften e.V. (MPG) is
# holder of all proprietary rights on this computer program.
# You can only use this computer program if you have closed
# a license agreement with MPG or you get the right to use the computer
# program from someone who is... |
"""
foxBMS Software License
Copyright 2010-2016, Fraunhofer-Gesellschaft zur Foerderung
der angewandten Forschung e.V.
All rights reserved.
BSD 3-Clause License
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions ... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import country_converter as coco
import pandas as pd
from covsirphy.util.term import Term
from covsirphy.loading.db_base import _RemoteDatabase
class _OWID(_RemoteDatabase):
"""
Access "Our World In Data".
https://github.com/owid/covid-19-data/tree/master/pub... |
#!/usr/bin/env python
# Quick hack to generate a sqlite db of chat logs.
# Currently used like so:
# find ~/Desktop/chatlogs -name "*.ichat" -exec python examples/imlog2db.py -d db.sqlite {} \;
# and so on..
import sys
import os
sys.path.append(os.path.dirname(__file__) + '/../imlog')
import re
import imlog
import s... |
# -----------------------------------------------------------------------------
#
# Copyright (C) 2021 CERN & Newcastle University for the benefit of the
# BioDynaMo collaboration. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance w... |
"""
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
WARNING
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
This directory is for the internal of Theano.
You are strongly advised not to use it, except if you know
what you are doing!
If you want to use a scalar variable in a Theano graph,
you pr... |
from __future__ import unicode_literals, division, absolute_import
from builtins import * # noqa pylint: disable=unused-import, redefined-builtin
from io import StringIO
import pytest
from jinja2 import Template
from flexget.entry import Entry
from flexget.logger import capture_output
from flexget.manager import ge... |
#!/usr/bin/env python
"""
Copyright 2017 ARM Limited
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... |
# 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 use ... |
from decimal import *
# Purpose: read in SSDEEP output and print findings.
# Author: Tanner G.
def main():
file = open("ssdeep_comparison", "r")
# read past first line of output
file.readline()
filea_data = file.readline()
fileb_data = file.readline()
file.close()
totalCount = 0
similarities = 0
index = 0
... |
#!/usr/bin/env python
import cPickle
from functools import wraps
def redis_lru(capacity=5000, slice=slice(None)):
def decorator(func):
cache_keys = "lru:keys:%s" % (func.__name__,)
cache_vals = "lru:vals:%s" % (func.__name__,)
cache_hits = "lru:hits:%s" % (func.__name__,)
cache_miss = "lru:miss:%s" % (func.__... |
swizzle_table = [
[
b"\x00",
b"\x01",
b"\x40",
b"\x03",
b"\x10",
b"\x21",
b"\x50",
b"\x23",
b"\x04",
b"\x09",
b"\x44",
b"\x0b",
b"\x14",
b"\x29",
b"\x54",
b"\x2b",
],
[
b"\... |
from core.models import User
from django.http import HttpResponse, JsonResponse
from django.shortcuts import get_object_or_404
from drf_yasg import openapi
from drf_yasg.utils import swagger_auto_schema
from rest_framework import permissions, status
from rest_framework.decorators import api_view, permission_classes
fro... |
"""Provides the Objector class."""
from json import loads
from typing import TYPE_CHECKING, Any, Dict, List, Optional, Union
from .exceptions import ClientException, RedditAPIException
from .models.reddit.base import RedditBase
from .util import snake_case_keys
if TYPE_CHECKING: # pragma: no cover
from ... impo... |
from .core import *
SCHEMA_VERSION = 'v2.6.5'
SCHEMA_URL = 'https://vega.github.io/schema/vega/v2.6.5.json'
|
"""Various input/output utility functions"""
from typing import Any, Optional
import os
import re
from io import BytesIO
import cloudpickle
import pandas as pd
from zstandard import ZstdCompressor, ZstdDecompressor
COMPRESSION_MAX_OUTPUT_SIZE = 10 ** 9 # 1GB
def pickle_dumps(variable: object) -> bytes:
pickl... |
# coding: utf-8
from __future__ import unicode_literals
from io import StringIO, BytesIO
from pathlib import Path
import pytest
from .util import load_test_model
from ..tokens import Doc
from ..strings import StringStore
from .. import util
# These languages are used for generic tokenizer tests – only add a languag... |
from loss.BCELoss import cal_bce_loss
from loss.HEL import cal_hel_loss
from loss.IOULoss import cal_iou_loss, cal_weighted_iou_loss
from loss.L12Loss import cal_mae_loss, cal_mse_loss
from loss.SSIM import cal_ssim_loss
supported_loss = dict(
bce=cal_bce_loss,
hel=cal_hel_loss,
iou=cal_iou_loss,
weigh... |
#!/usr/bin/env python3
#https://codeforces.com/group/H9K9zY8tcT/contest/297258/problem/B
#heap?
from queue import PriorityQueue
n = int(input())
g = {}
c = {str(i):0 for i in range(1,n+1)} #children count
for i in range(1,n+1):
k = str(i)
g[k] = input().split() # l[0]=weight; l[1]=no use; l[2:] parents;... |
from django.forms import ModelForm
from .models import MRIScan
class MRIScanForm(ModelForm):
class Meta:
model = MRIScan
fields = ['case_id', 't1', 't1ce', 't2', 'flair'] |
# coding=utf-8
# Copyright 2020 The Google Research 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 applicab... |
# get hsv values using trackbar
import cv2
import numpy as np
import time
# A required callback method that goes into the trackbar function.
def nothing(x):
pass
# Initializing the webcam feed.
cap = cv2.VideoCapture(0)
cap.set(3,1280)
cap.set(4,720)
# Create a window named trackbars.
cv2.namedWindow("Trackbars"... |
# -*- coding: utf-8 -*-
"""
Microsoft-Windows-Direct3D10_1
GUID : 9b7e4c8f-342c-4106-a19f-4f2704f689f0
"""
from construct import Int8sl, Int8ul, Int16ul, Int16sl, Int32sl, Int32ul, Int64sl, Int64ul, Bytes, Double, Float32l, Struct
from etl.utils import WString, CString, SystemTime, Guid
from etl.dtyp import Sid
from et... |
from __future__ import absolute_import
import sys
import os
import errno
import types
import gc
import signal
import traceback
from gevent.event import AsyncResult
from gevent.hub import get_hub, linkproxy, sleep, getcurrent
from gevent.fileobject import FileObject
from gevent.greenlet import Greenlet, joinall
spawn = ... |
# Generated by Django 2.0.4 on 2018-04-24 01:54
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('blog', '0001_initial'),
]
operations = [
migrations.RenameField(
model_name='post',
old_name='sub_Title',
... |
# -*- coding: utf-8 -*-
from __future__ import absolute_import
import mock
from exam import fixture
from sentry.interfaces.template import Template
from sentry.models import Event
from sentry.testutils import TestCase
class TemplateTest(TestCase):
@fixture
def interface(self):
return Template.to_p... |
#!/usr/bin/env python
import os
import shutil
import glob
import time
import sys
import subprocess
import string
from optparse import OptionParser, make_option
import ConfigParser
SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__))
PKG_NAME = os.path.basename(SCRIPT_DIR)
PARAMETERS = None
#XW_ENV = "export DBUS_... |
from django.shortcuts import render
def contrib_file(request):
return render(request, "dpaste/contribute.html")
|
from tkinter import messagebox
from ClientInsert import *
class ClientEdit(ClientInsert):
def __init__(self, db, id_cliente, master):
super().__init__(db, master)
self.title('Editar Cliente')
self.__id_cliente = id_cliente
self.__list = master
table_cliente = db.s... |
template = """<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Title of the document</title>
<script type="text/javascript" src="https://s3.tradingview.com/tv.js"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/milligram/1.3.0/milligram.min.css">
<style>
.tradingvi... |
# Copyright (C) 2010 Google Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and th... |
# Daniel Mc Callion
# This program prints the summer months
months = ("January",
"February",
"March",
"April",
"May",
"June",
"July",
"August",
"September",
"October",
"November",
"December")
summer = months[4:7]
for month in summer:
print(month)
|
class FieldC():
def __init__(self, name, column_type, primary_key, default):
self.name = name
self.column_type = column_type
self.primary_key = primary_key
self.default = default
def __str__(self):
return '<%s, %s:%s>' % (self.__class__.__name__, self.column_type... |
from django.contrib.auth import get_user_model
from django.test import TestCase
class UsersManagersTests(TestCase):
"""
Test user creation manager
"""
def test_create_user(self):
"""
Creates a new user with email as primary identifier instead of username
"""
User = get... |
import pysam
from optparse import OptionParser
from x_gene_annotation import *
class mRNA_Transfer():
def call_transfer_mut(self, sf_rna, sf_dna_up, sf_dna_bottom, sf_candidate):
m_rna_vars = self.load_variants(sf_rna)
m_DNA_RNA_ovlp_vars = self.get_overlap_variants(sf_dna_bottom, m_rna_vars)
... |
# -*- coding: utf-8 -*-
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
# vi: set ft=python sts=4 ts=4 sw=4 et:
import pytest
from ....testing import example_data
from ...niftyreg import get_custom_path
from ..asl import FitAsl
from ...niftyreg.tests.test_regutils import no_nifty_tool
@py... |
# automatically generated by the FlatBuffers compiler, do not modify
# namespace: tflite
import flatbuffers
from flatbuffers.compat import import_numpy
np = import_numpy()
class DimensionMetadata(object):
__slots__ = ['_tab']
@classmethod
def GetRootAsDimensionMetadata(cls, buf, offset):
n = fla... |
# -*- coding: utf-8 -*-
from django.utils.translation import ugettext_lazy
from openslides.utils.personal_info import PersonalInfo
from .models import Item
class AgendaPersonalInfo(PersonalInfo):
"""
Class for personal info block for the agenda app.
"""
headline = ugettext_lazy('I am on the list of... |
def test():
from tensorflow.keras import datasets
assert model.get_layer("class_prediction").get_config()["units"]==43, "Check the number of output classes"
assert model.get_layer("class_prediction").get_config()["activation"]=="softmax", "Check your activation function"
assert model.output[0].name== '... |
from rest_framework import serializers
from django.contrib.auth import get_user_model
from .models import CustomUser
User = get_user_model()
class TokenSerializer(serializers.Serializer):
"""
This serializer serializes the token data
"""
access = serializers.CharField(max_length=255)
refresh = se... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import re
from setuptools import setup, find_packages
version = None
with open('jaeger_client/__init__.py', 'r') as f:
for line in f:
m = re.match(r'^__version__\s*=\s*(["\'])([^"\']+)\1', line)
if m:
version = m.group(2)
break
... |
# Copyright (C) 2012-2013 Red Hat, 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 la... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# king_phisher/server/plugins.py
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notice, t... |
import click
import sys
from web3 import Web3
from plasma.client.client import Client
from plasma.utils import utils
@click.command()
@click.option('--token_address', help="The ethereum address of the pdex token smart contract", required=True)
@click.option('--root_chain_address', help="The ethereum address of the ro... |
from django.db import models
from django.utils.translation import ugettext_lazy as _
from .feedback import Feedback
class SearchResultFeedback(Feedback):
"""
Database model representing feedback about search results (e.g. empty results).
"""
search_query = models.CharField(max_length=1000, verbose_n... |
#!/usr/bin/env python
# coding: utf-8
import codecs
import sys
import sklearn as sk
import pandas as pd
import numpy as np
import math
from sklearn import preprocessing
from sklearn.decomposition import PCA
from src.pca.algoritmo_QR import eigenvectores_eigenvalores_QR_vf
from src.pca.metodo_potencia_deflation imp... |
from tkinter import*
import random
import time
root = Tk()
root.geometry("1600x700+0+0")
root.title("Restaurant Management System")
Tops = Frame(root,bg="white",width = 1600,height=50,relief=SUNKEN)
Tops.pack(side=TOP)
f1 = Frame(root,width = 900,height=700,relief=SUNKEN)
f1.pack(side=LEFT)
f2 = Frame(root ,width =... |
from plotly.basedatatypes import BaseLayoutHierarchyType as _BaseLayoutHierarchyType
import copy as _copy
class Font(_BaseLayoutHierarchyType):
# class properties
# --------------------
_parent_path_str = "layout.scene.xaxis.title"
_path_str = "layout.scene.xaxis.title.font"
_valid_props = {"colo... |
#!/usr/bin/python
# -- Content-Encoding: UTF-8 --
"""
Utility methods, for compatibility between Python version
:author: Thomas Calmant
:copyright: Copyright 2015, isandlaTech
:license: Apache License 2.0
:version: 0.2.6
..
Copyright 2015 isandlaTech
Licensed under the Apache License, Version 2.0 (the "Lice... |
# Copyright 2014, Rackspace, US, 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 w... |
import IoTSensor
import LORAGateway
class GatewayPlacement:
def __init__(self, sensor_list):
self._sensor_list = sensor_list
self._gateway_list = []
def add_gateway(self, gateway):
self._gateway_list.append(gateway)
def remove_gateway(self, gateway):
self._gateway_list.re... |
#! /usr/bin/python3
#
# Copyright (c) 2017 Intel Corporation
#
# SPDX-License-Identifier: Apache-2.0
#
"""
Create and remove network tunnels to the target via the server
--------------------------------------------------------------
"""
from . import tc
from . import ttb_client
class tunnel(tc.target_extension_c):
... |
# np_baseball is available
# Import numpy
import numpy as np
# Create np_height_in from np_baseball
np_height_in = np_baseball[:,0]
# Print out the mean of np_height_in
print(np.mean(np_height_in))
# Print out the median of np_height_in
print(np.median(np_height_in))
# np_baseball is available
#... |
"""
Top-level URL lookup for InvenTree application.
Passes URL lookup downstream to each app as required.
"""
from django.conf.urls import url, include
from django.urls import path
from django.contrib import admin
from company.urls import company_urls
from company.urls import manufacturer_part_urls
from company.url... |
import os
import logging
import pickle
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
import al
from al.dataset import mnist
from al.model.model_zoo.simple_cnn import ConvModel
from al.model.mnist import MnistLearner
from al.dataset.mnist import MnistDataset
from al.train... |
from __future__ import annotations
import asyncio
import bisect
import builtins
import concurrent.futures
import errno
import heapq
import logging
import os
import random
import sys
import threading
import warnings
import weakref
from collections import defaultdict, deque, namedtuple
from collections.abc import Hashab... |
# -*- coding: utf-8 -*-
# Copyright 2022 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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... |
"""Class to hold the tracks and cameras of a 3D scene.
This can be the output of either data association or of bundle adjustment.
Authors: Ayush Baid, John Lambert, Xiaolong Wu
"""
import itertools
from typing import Any, Dict, List, Optional, Tuple
import numpy as np
from gtsam import PinholeCameraCal3Bundler, Pose3... |
'''n = 99
p = 'garrafas'
while n > 0:
if n == 1:
p = 'garrafa'
print(f'{n} {p} de cerveja no muro!')
print(f'{n} {p} no muro!')
print('Se uma garrafa cair no chão')
print('Quantas restarão?')
n -= 1
print('Fim da canção!')'''
p = 'garrafas'
for c in range(99, 0, -1):
if c == 1:
... |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.6 on 2018-02-17 21:34
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('wagtailcommerce_carts', '0004_cart_coupon'),
('wagt... |
import os
import numpy as np
from pyhlm.model import WeakLimitHDPHLM, WeakLimitHDPHLMPython
from pyhlm.internals.hlm_states import WeakLimitHDPHLMStates
from pyhlm.word_model import LetterHSMM, LetterHSMMPython
import pyhsmm
import warnings
from tqdm import trange
warnings.filterwarnings('ignore')
import time
#%%
def ... |
#
# MIT License
#
# Copyright 2017 Launchpad project contributors (see COPYRIGHT.md)
#
# 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 ... |
from django.shortcuts import render
from django.views.generic import View
from django.core.exceptions import ObjectDoesNotExist
from django.contrib import messages
from cart.models import Order
class Dashboard(View):
def get(self,*args,**kwargs):
order_qs = Order.objects.filter(user=self.request.user,order... |
import pytest
from testutils.factories import create_test_person
from django.contrib.auth.models import User, Permission
from openstates.data.models import Person, Organization
from people_admin.models import UnmatchedName, NameStatus, DeltaSet
from people_admin.views import MATCHER_PERM, EDIT_PERM, RETIRE_PERM
import ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.