text stringlengths 2 999k |
|---|
import numpy as np
import os
import subprocess
import sys
from setuptools import find_packages, setup
from setuptools.command.build_ext import build_ext
from Cython.Build import cythonize
is_posix = (os.name == "posix")
if is_posix:
os_name = subprocess.check_output("uname").decode("utf8")
if "Darwin" in os... |
from simplesoccer.mini_env_states import SoccerStates
class EvalPolicy:
def compute_actions(self, states: SoccerStates):
raise NotImplementedError()
|
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes ... |
#-----------------------------------------------------------------------------
# Copyright (c) 2005-2020, PyInstaller Development Team.
#
# Distributed under the terms of the GNU General Public License (version 2
# or later) with exception for distributing the bootloader.
#
# The full license is in the file COPYING.txt... |
#!/usr/bin/env python3
# Copyright (c) 2018-2020 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 blinkhash-wallet."""
import hashlib
import os
import stat
import subprocess
import textwrap
from... |
# -*- coding: utf-8 -*-
"""
Python Markdown
A Python implementation of John Gruber's Markdown.
Documentation: https://python-markdown.github.io/
GitHub: https://github.com/Python-Markdown/markdown/
PyPI: https://pypi.org/project/Markdown/
Started by Manfred Stienstra (http://www.dwerg.net/).
Maintained for a few yea... |
def countdown (n):
for i in range(n):
print "%d..." % (n - i)
print "Happy New Years!"
|
# -*- coding: utf-8 -*-
# copyright 2003-2013 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
# contact http://www.logilab.fr/ -- mailto:contact@logilab.fr
#
# This file is part of logilab-common.
#
# logilab-common is free software: you can redistribute it and/or modify it under
# the terms of the GNU Lesser Genera... |
def extractLingTranslatesSometimes(item):
"""
# 'Ling Translates Sometimes'
"""
vol, chp, frag, postfix = extractVolChapterFragmentPostfix(item['title'])
if not (chp or vol or frag) or 'preview' in item['title'].lower():
return None
return False
|
from flask import g
from wtforms.validators import ValidationError
from mod_auth.forms import unique_username, valid_password
from mod_auth.models import User
from tests.base import BaseTestCase
class Field:
def __init__(self, data):
self.data = data
class TestForm(BaseTestCase):
def test_unique_u... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# This file is part of the SPORCO package. Details of the copyright
# and user license can be found in the 'LICENSE.txt' file distributed
# with the package.
"""
Parallel CSC with a Spatial Mask
================================
This example compares the use of :class:`.pa... |
class A1:
def mymethod1(self):
print("It is an instance method of A1 class")
class B1(A1):
def mymethod1(self):
print("It is an instance method of B1 class")
class C1(B1):
def mymethod1(self):
print("It is an instance method of C1 class")
class D1(C1):
def mymetho... |
""" Leetcode 1446 - Consecutive Characters
https://leetcode.com/problems/consecutive-characters/
1. MINE Straight-Forward: Time: O(N) Space: O(1) (N is len_of_s)
2. Python-Method: Time: O(N) Space: O(N) (N is len_of_s)
"""
class Solution1:
""" 1. MINE Straight-Forward """
def max_power(self, s: str) -> in... |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
# ---------------------------------------------------------------------... |
import inspect
from PYB11Generator import *
from FieldBase import FieldBase
from Field import Field
#-------------------------------------------------------------------------------
# Add numeric operations to a Field
#-------------------------------------------------------------------------------
@PYB11template("Dimen... |
#
# compressedColumn.py
#
# This source file is part of the FoundationDB open source project
#
# Copyright 2013-2018 Apple Inc. and the FoundationDB project 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 c... |
import numpy as np
from ._base import BaseGrid2D, BaseGrid3D, BaseTraveltime
from ._fteik import ray2d, ray3d
from ._interp import vinterp2d, vinterp3d
class Grid2D(BaseGrid2D):
def __init__(self, *args, **kwargs):
"""
2D grid class.
Parameters
----------
grid : array_lik... |
import numpy as np
def decimal_to_binlist(decimal, digits): # ex) 6,3 --> [1,1,0]
bin_str = "{:0{digits}b}".format(decimal, digits=digits)
return [int(s) for s in list(bin_str)]
def binlist_to_decimal(bin_list): # ex) [0,1,1] --> 3
return int("".join([str(i) for i in bin_list]), 2)
def make_hammin... |
from __future__ import division
import os
import time
from shutil import copyfile
from glob import glob
import tensorflow as tf
import numpy as np
import config
from collections import namedtuple
from module import *
from utils import *
from ops import *
from metrics import *
os.environ["CUDA_VISIBLE_DEVICES"] = "0"
... |
import sys
from math import log
from itertools import combinations
class CipherDescription:
def __init__(self, state_size):
'''
Create an empty instance of a cipher of given state size
'''
self.state_size = state_size
self.temporaries = set()
self.rounds = 1
... |
import asyncio
import datetime
import io
import os.path
import aiofiles
import falcon
import PIL.Image
class Image:
def __init__(self, config, image_id, size):
self.config = config
self.image_id = image_id
self.size = size
self.modified = datetime.datetime.utcnow()
@property... |
# Copyright 2020 BigBitBus
#
# 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, s... |
##########################################################################
#
# pgAdmin 4 - PostgreSQL Tools
#
# Copyright (C) 2013 - 2017, The pgAdmin Development Team
# This software is released under the PostgreSQL Licence
#
##########################################################################
import time
from... |
# coding: utf-8
"""
LUSID API
# Introduction This page documents the [LUSID APIs](https://www.lusid.com/api/swagger), which allows authorised clients to query and update their data within the LUSID platform. SDKs to interact with the LUSID APIs are available in the following languages : * [C#](https://gith... |
from base64 import b64encode
from datetime import date
from onegov.ballot import Ballot
from onegov.ballot import Election
from onegov.ballot import ElectionCompound
from onegov.ballot import Vote
from onegov.election_day import _
from onegov.election_day.utils.d3_renderer import D3Renderer
from unittest.mock import pa... |
import os
import json
import html
import re
from collections import OrderedDict
from collections import Counter
from string import punctuation
import numpy as np
import pandas as pd
import torch
from torch.utils.data import TensorDataset, DataLoader
from hparams import hps_data
def read_data(dataset, max_count=hps_... |
COPY_SQL = """
COPY {}
FROM '{}'
ACCESS_KEY_ID '{{}}'
SECRET_ACCESS_KEY '{{}}'
IGNOREHEADER 1
DELIMITER ';'
"""
COPY_ALL_RIDES_SQL = COPY_SQL.format(
"staging_rides",
f's3://uber-tracking-expenses-bucket-s3-{{}}/rides/rides_receipts.csv'
)
COPY_ALL_EATS_SQL = COPY_SQL.format(
"staging_eats",
f's3://ub... |
"""Unit tests for the 3D heisenberg group in vector representation."""
import geomstats.backend as gs
from geomstats.geometry.heisenberg import HeisenbergVectors
from tests.conftest import Parametrizer
from tests.data.heisenberg_data import HeisenbergVectorsTestData
from tests.geometry_test_cases import LieGroupTestCa... |
import ssl
from pathlib import Path
from typing import Dict
import numpy as np
import torch
from maskrcnn_benchmark.config import cfg
from maskrcnn_benchmark.structures.bounding_box import BoxList
from common.engine import BaseEngine
from .mask_rcnn_predictor import COCODemo
# cancel ssl certificate verify
ssl._crea... |
import sys
import torch
from torchvision.datasets import FakeData
import train
from arguments import get_arguments
def get_fake_datasets(**kwargs):
return FakeData(), FakeData()
def test_setup_data_loaders(mocker):
# NOTE: Removing any sys.argv to get default arguments
sys.argv = [""]
args = get_ar... |
#!/usr/bin/env python3
#
# Copyright 2014 Simone Campagna
#
# 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 ... |
import scrapy
import logging
from scrapy.loader import ItemLoader
from scrapy.http import FormRequest
from scrapy.exceptions import CloseSpider
from datetime import datetime
from fbposts.items import FbPostItem, parse_date
class FacebookSpider(scrapy.Spider):
"""
Parse FB pages (needs credentials)
"""
... |
import gi
from ghue.controller import Controller
from ghue.device.hue import HueDeviceManager
gi.require_version('Gtk', '3.0')
from gi.repository import Gtk, GLib
import phue
from .application import GHueApplication
if __name__ == '__main__':
GLib.set_application_name("Philips Hue")
controller = Controller(... |
import pymonetdb
import datetime, time
import itertools
import csv
import json
import os
import multiprocessing
from subprocess import call
from common import util
class IDEBenchDriver:
def init(self, options, schema, driver_arg):
pass
def create_connection(self):
connection = pymonetdb.conne... |
#!/usr/bin/env/python
#
# 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
# "... |
# --------------
#Importing header files
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
#Code starts here
data = pd.read_csv(path)
data.Rating.plot(kind='hist')
data = data[data.Rating<=5]
data.Rating.plot(kind='hist')
#Code ends here
# --------------
# code starts here
total_null = data.... |
##################################################################################################
# BSD 3-Clause License
#
# Copyright (c) 2020, Jose R. Garcia
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following condi... |
# Generated by Django 4.0.3 on 2022-03-25 16:37
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('recipes', '0003_recipe_picture'),
]
operations = [
migrations.AddField(
model_name='recipe',
name='slug',
... |
from __future__ import print_function
from __future__ import absolute_import
import warnings
import copy
import time
import numpy as np
import multiprocessing
import threading
try:
import queue
except ImportError:
import Queue as queue
from .topology import Container
from .. import backend as K
from .. import... |
# -*- coding: utf-8 -*-
import pytest
class TestAccountSettings:
"""Tests for the /account/settings page."""
def test_submit_email_form_without_xhr_returns_full_html_page(self, app):
res = app.get("/account/settings")
email_form = res.forms["email"]
email_form["email"] = "new_email@... |
import os
import shutil
from io import StringIO
from types import SimpleNamespace
import pkg_resources
#
from colt import Colt
#
from .qm.qm import QM, implemented_qm_software
from .molecule.terms import Terms
from .dihedral_scan import DihedralScan
from .misc import LOGO
class Initialize(Colt):
_user_input = """... |
import sys
import argparse
import sqlite3
from collections import defaultdict as dd
parser = argparse.ArgumentParser(
description='Initialize the Epigraph Database',
formatter_class=argparse.ArgumentDefaultsHelpFormatter)
parser.add_argument(
'epi_db', help='epigraph database')
parser.add_argument(
'-... |
#!/usr/bin/env python
#
# Copyright 2018 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 requir... |
"""
This module houses the ctypes function prototypes for OGR DataSource
related data structures. OGR_Dr_*, OGR_DS_*, OGR_L_*, OGR_F_*,
OGR_Fld_* routines are relevant here.
"""
from ctypes import POINTER, c_char_p, c_double, c_int, c_long, c_void_p
from django.contrib.gis.gdal.envelope import OGREnvelope
from djan... |
import os
import re
import json
import string
import hashlib
import requests
import datetime
import pandas as pd
import pymongo as pm
from bson import Binary
from bs4 import BeautifulSoup
from urllib.parse import quote_plus
class MongoOps():
"""
docstring for MongoOps
"""
def __init__(self, username="a... |
# -*- coding: utf-8 -*-
from tests.renderer.xml import xml_templates
from pyramid_oereb.lib.records.view_service import ViewServiceRecord
from pyramid_oereb.views.webservice import Parameter
from pyramid_oereb.lib.renderer.extract.xml_ import Renderer
template = xml_templates().get_template('view_service.xml')
def ... |
from setuptools import setup
import os.path as osp
from torch.utils.cpp_extension import BuildExtension, CUDAExtension
ROOT_DIR = osp.dirname(osp.abspath(__file__))
__version__ = None
exec(open('svox/version.py', 'r').read())
CUDA_FLAGS = []
INSTALL_REQUIREMENTS = []
try:
ext_modules = [
CUDAExtension(... |
import torch
import torch.nn as nn
import model.ops as ops
import torch.nn.functional as F
def make_model(args, parent=False):
return DRLN(args)
class CALayer(nn.Module):
def __init__(self, channel, reduction=16):
super(CALayer, self).__init__()
self.avg_pool = nn.AdaptiveAvgPool2d(1)
... |
a = b = 0
_ = (not a and not b)
_ = (not a or not b)
_ = not (b + a)
_ = (not b + a)
|
# global
import math
import tensorflow as tf
from numbers import Number
from typing import Union, Tuple, Optional, List
from tensorflow.python.types.core import Tensor
def flip(x: Tensor,
axis: Optional[Union[int, Tuple[int], List[int]]] = None)\
-> Tensor:
num_dims = len(x.shape)
if not num... |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may ... |
"""
Websocket based API for Home Assistant.
For more details about this component, please refer to the documentation at
https://home-assistant.io/developers/websocket_api/
"""
import asyncio
from concurrent import futures
from contextlib import suppress
from functools import partial
import json
import logging
from ai... |
# -------------------------------------------------------------------------
#
# Part of the CodeChecker project, under the Apache License v2.0 with
# LLVM Exceptions. See LICENSE for license information.
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
#
# ---------------------------------------------------... |
import pytest
import numpy as np
from glue.core import roi
from cubeviz.utils.contour import ContourSettings
from cubeviz.tools.moment_maps import MomentMapsGUI
@pytest.fixture(scope='module')
def moment_maps_gui(cubeviz_layout):
cl = cubeviz_layout
mm = MomentMapsGUI(cl._data, cl.session.data_collection, p... |
from context import dbconnect
def mockup_data(connection):
Query = dbconnect.models.Query
create_sql = "create table mockdata(id integer primary key, name text not null, value integer not null)"
insert_sql = "insert into mockdata(id, name, value) values (?, ?, ?)"
queries = []
queries.append(Query(create_sql, ()... |
# -*- coding: utf-8 -*-
# 画出特征雷达图,代码接KMeans_cluster.py
def print_cluster_result(data, kmodel):
import pandas as pd
# 简单打印结果
r1 = pd.Series(kmodel.labels_).value_counts() # 统计各个类别的数目
r2 = pd.DataFrame(kmodel.cluster_centers_) # 找出聚类中心
r = pd.concat([r2, r1], axis=1) # 横向连接(0是纵向),得到聚类中心对应的类别下的数目
... |
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------... |
from PySide6 import QtUiTools
Ui_VolView, VolViewBase = QtUiTools.loadUiType("volview.ui")
class VolViewWindow(VolViewBase):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.ui = Ui_VolView()
self.ui.setupUi(self)
__all__ = [
"VolViewWindow",
... |
# 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
# distributed under t... |
#!/Users/tom/GitHub/ga_statistics/bin/python
from django.core import management
if __name__ == "__main__":
management.execute_from_command_line()
|
from django.utils.datastructures import MultiValueDict
from orgs.utils import get_current_org
from .models import Attachment, OperateLog
from .serializers import AttachmentSerializer, OperateLogSerializer
from rest_framework import views, status, generics
from rest_framework.response import Response
from django.db imp... |
import configparser
import kafka
from kafka_producer_consumer import push_message,get_connection_consumer,get_connection_producer,create_topic
from webscraping import get_movies
config = configparser.ConfigParser()
config.read('config.properties')
# global properties
bootstrap_ip_port=config['KAFKA']['KAFKA_BROKER_IP... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# This file is part of OTC Tool released under MIT
# Copyright (C) 2016 T-systems Kurt Garloff, Zsolt Nagy
import json
import prettytable
import jmespath
def defaultprettytable( cols ):
p = prettytable.PrettyTable(cols)
p.align = 'l'
p.sortby = None
r... |
# 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... |
#!/usr/bin/env python
from setuptools import find_namespace_packages
from distutils.core import setup
import os
def read(fname):
return open(os.path.join(os.path.dirname(__file__), fname)).read()
package_name = "dbt-core"
package_version = "0.15.0b1"
description = """dbt (data build tool) is a command line tool... |
#!/usr/bin/env python
# test BLE Scanning software
# jcs 6/8/2014
import blescan
import sys
import bluetooth._bluetooth as bluez
dev_id = 0
try:
sock = bluez.hci_open_dev(dev_id)
except:
print "error accessing bluetooth device..."
sys.exit(1)
blescan.hci_le_set_scan_parameters(sock)
blescan.hci_enable_le_sc... |
# coding: utf-8
# author: Fei Gao <leetcode.com@feigao.xyz>
# Problem: binary tree paths
#
# Given a binary tree, return all root-to-leaf paths.
#
# For example, given the following binary tree:
#
# 1
# / \
# 2 3
# \
# 5
#
# All root-to-leaf paths are:
# ["1->2->5", "1->3"]
# Credits:Special thanks to... |
import scripts.inputmanager as inp
STARTING_MESSAGE = "Before saving new parameters try testing to see the best accuracy I got."
print(STARTING_MESSAGE.upper())
inp.input_loop()
|
248 |
"""
This is unsupported legacy code.
Would be supported lately.
"""
from json import loads, dumps
from django.test import TestCase
from django.urls import reverse
from core.models import Links
from core.tests.utils import set_links_in_db_from_file, is_equal_lists, \
get_dict_from_link, set_links_in_db_from_list
i... |
from datetime import datetime, timedelta
from typing import List
import warnings
from dateutil.relativedelta import FR, MO, SA, SU, TH, TU, WE # noqa
import numpy as np
from pandas.errors import PerformanceWarning
from pandas import DateOffset, Series, Timestamp, date_range
from pandas.tseries.offsets import Day, ... |
import numpy as np
class Dice:
def __init__(self, min_value=1, max_value=6):
self.min_value = min_value
self.max_value = max_value
def launch(self):
return np.random.randint(self.min_value, self.max_value + 1) |
# -*- coding: utf-8 -*-
# Copyright (C) 2014 Floris Bruynooghe <flub@devork.be>
r"""
Use remote Mercurial repository as a Pillar source.
.. versionadded:: 2015.8.0
The module depends on the ``hglib`` python module being available.
This is the same requirement as for hgfs\_ so should not pose any extra
hurdles.
Thi... |
# -*- coding: utf-8 -*-
'''
Copyright (c) 2021, MIT Interactive Robotics Group, PI Julie A. Shah.
Authors: Shen Li, Nadia Figueroa, Ankit Shah, Julie A. Shah
All rights reserved.
'''
import os
import hr_planning
import math
starting_seed = 0
reps = 30
n_files_to_split = 2
def main():
"""
Generate .sh files ... |
import requests
from app_settings.db import settings_collection
from app_settings.models import Settings
from settings import MAILGUN_API_KEY
DEFAULT_EMAIL = (
"Block Tracker <postmaster@sandbox38920d794f42405e81f5689097f0cc19.mailgun.org>"
)
class MailGunClient:
url = "https://api.mailgun.net/v3/sandbox389... |
import numpy as np
import matplotlib.pyplot as plt
import matplotlib
def polyfit(dates, levels, p):
x = matplotlib.dates.date2num(dates)
y = levels
# new edit below
p_coeff = np.polyfit(x-x[0], y, p)
poly = np.poly1d(p_coeff)
return poly, x[0]
|
import PySimpleGUI as sg
"""
PySimpleGUI The Complete Course
Lesson 7 - Multiple Windows
1-lvl nested window
"""
# Design pattern 1 - First window does not remain active
layout = [[ sg.Text('Window 1'),],
[sg.Input()],
[sg.Text('', size=(20,1), key='-OUTPUT-')],
[sg.Button('L... |
#!/usr/bin/env python3
# encoding: utf-8
# @Date : 2017-07-24 00:00
# @Author : Bluethon (j5088794@gmail.com)
# @Link : http://github.com/bluethon
from rest_framework.routers import DefaultRouter
from . import views
router = DefaultRouter()
router.register(r'sprints', views.SprintViewSet)
router.register(... |
import torch.nn as nn
import torch
import torch.nn.functional as F
import numpy as np
class SoftmaxCrossEntropyLoss(nn.Module):
def __init__(self):
"""
:param num_negs: number of negative instances in bpr loss.
"""
super(SoftmaxCrossEntropyLoss, self).__init__()
def forward(se... |
import os
import re
import sys
# Read arguments
if len(sys.argv) != 2:
raise ValueError('Please provide a filename input')
filename = sys.argv[1]
# Read file
file_data = open(os.getcwd() + '/' + filename, 'r')
# Parse file
tiles = []
for line in file_data.readlines():
line = line.replace('\n', '')
line... |
# Copyright 2019, Kay Hayen, mailto:kay.hayen@gmail.com
#
# Python tests originally created or extracted from other peoples work. The
# parts were too small to be protected.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the ... |
from __future__ import absolute_import
from pyspark.sql import SQLContext
from pyspark.mllib.regression import LabeledPoint
from ..utils.rdd_utils import from_labeled_point, to_labeled_point, lp_to_simple_rdd
from pyspark.mllib.linalg import Vector as MLLibVector, Vectors as MLLibVectors
def to_data_frame(sc, featur... |
# Copyright 2021 Northern.tech AS
#
# 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 django.contrib import admin
from .models import Agent, Category, Lead, User, UserProfile
admin.site.register(Agent)
admin.site.register(Lead)
admin.site.register(User)
admin.site.register(UserProfile)
admin.site.register(Category)
|
from hsmclient.tests.unit import utils
from hsmclient.tests.unit.v1 import fakes
from hsmclient.v1 import rbds
cs = fakes.FakeClient()
class RbdsTest(utils.TestCase):
def test_list(self):
rl = cs.rbds.list()
cs.assert_called('GET', '/rbds')
for r in rl:
self.assertIsInstanc... |
"""Download files from the specified ftp server."""
# standard
import datetime
import functools
from os import path
# third party
import paramiko
def print_callback(filename, bytes_so_far, bytes_total):
"""Log file transfer progress."""
rough_percent_transferred = int(100 * (bytes_so_far / bytes_total))
... |
class Vitals:
LEARNING_RATE = 0.1
MOMENTUM_RATE = 0.8
FIRST_LAYER = 5 * 7
SECOND_LAYER = 14
OUTPUT_LAYER = 3 |
c=input("enter city name:").strip()
if c=='Gujarat':
print('namaste')
elif c=='Hydrabad':
print('vannakam')
else:
print('city not availabel') |
# Copyright 2022 The AI Flow 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 collections import defaultdict
import json
from pandas.core import frame
import torch
import pandas as pd
import os
import pickle as pkl
import numpy as np
import cv2
import h5py
import tqdm
import functools
import lmdb
class EGTEA_GAZE_DATASET(torch.utils.data.Dataset):
def __init__(self, logger, config, ro... |
#
# Secret Labs' Regular Expression Engine
#
# convert re-style regular expression to sre pattern
#
# Copyright (c) 1998-2001 by Secret Labs AB. All rights reserved.
#
# See the sre.py file for information on usage and redistribution.
#
"""Internal support module for sre"""
# XXX: show string offset and offending ch... |
import os
import time
while 1:
exit_code = os.system("cd /home/pi/usb4vc/rpi_app; python3 -u usb4vc_main.py") >> 8
print("App died! Exit code:", exit_code)
if exit_code == 169:
exit()
time.sleep(0.5) |
"""
"""
import support
support.compileJPythonc("test254c.py", deep=1, core=1, jar="test254.jar", output="test254.err")
|
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may ... |
from pydantic import BaseModel
STATUS201_DESC = 'Created.'
class Status201(BaseModel):
detail: str
class Config:
schema_extra ={
'example': {
'detail': 'User Created.'
}
}
|
'''
Plan:
1. Build a LSTM classifier to predict the action from historical env, rewards and actions
2. Implement the rollout to collect simulation data
3. Use rewards to update the weights using sample_weights
'''
from keras.models import Sequential, model_from_json
from keras.losses import binary_crossentropy
from ke... |
# -*- coding: utf-8 -*-
#
# Copyright © Spyder Project Contributors
# Licensed under the terms of the MIT License
# (see spyder/__init__.py for details)
"""Spyder completion container."""
# Standard library imports
# Third-party imports
from qtpy.QtWidgets import QMessageBox
# Local imports
from spyder.api.widgets.... |
from __future__ import absolute_import
from __future__ import print_function
import veriloggen
import submodule_read_verilog_nested
expected_verilog = """
module top #
(
parameter WIDTH = 8
)
(
input CLK,
input RST,
output [WIDTH-1:0] LED,
output [inst_blinkled_WIDTH-1+1-1:0] inst_blinkled_dummy_out0,
inpu... |
# -*- coding: utf-8 -*-
# Copyright (C) 2021 Davide Gessa
'''
MIT License
Copyright (c) 2021 Davide Gessa
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 li... |
#!/bin/python3
import math
import os
import random
import re
import sys
#
# Complete the 'minNum' function below.
#
# The function is expected to return an INTEGER.
# The function accepts following parameters:
# 1. INTEGER samDaily
# 2. INTEGER kellyDaily
# 3. INTEGER difference
#
def minNum(samDaily, kellyDail... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.