text stringlengths 2 999k |
|---|
from django.test import TestCase
from pyquery import PyQuery as pq
from ..utils import collapse_whitespace, html_to_text
class UtilsTests(TestCase):
def test_collapse_whitespace(self):
text = '\r\n\f\u200b \n\t '
self.assertEqual(collapse_whitespace(text), "")
def test_html_to_text_one_elem... |
from fastapi import FastAPI
from starlette.middleware.cors import CORSMiddleware
from app.api.api_v1.api import api_router
from app.core.config import settings
from app.db.mongodb import db
app = FastAPI(
title=settings.PROJECT_NAME, openapi_url=f"{settings.API_V1_STR}/openapi.json"
)
# Set all CORS enabled orig... |
# This sample demonstrates how to use the methods RestartIpConfiguration and
# ForceIp of the GigETransportLayer object. These can be necessary when
# manipulating the IP configuration of a GigE camera.
from pypylon import pylon
import random
tl_factory = pylon.TlFactory.GetInstance()
for dev_info in tl_factory.Enum... |
'''purge all data. go back to clean slate'''
from backend.fcmapp import ApplicationService
print('Starting application...')
APP = ApplicationService()
print('started', APP.component)
#purge cache
APP.cache.purge()
#purge rabbit
APP.shutdown()
|
#
# Copyright (c) 2008-2015 Citrix Systems, 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 l... |
from test.util_platforms import linux_only_forall
linux_only_forall()
import os
import sys
import pytest
import pickle
import os.path as p
import subprocess as sp
class TestDDPPlugin:
def test_all(self, tmpdir):
test_save_path = str(p.join(tmpdir.make_numbered_dir(), "test.save"))
env = os.envir... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# This file is part of pyloric, a simulator published under MIT license.
import io
import os
import sys
from shutil import rmtree
from setuptools import find_packages, setup, Command
# Package meta-data.
NAME = "pyloric"
DESCRIPTION = "Simulator of the pyloric network ... |
import array
import pytest
import arcade
SCREEN_WIDTH = 800
SCREEN_HEIGHT = 600
@pytest.fixture(scope="module")
def ctx():
window = arcade.Window(SCREEN_WIDTH, SCREEN_HEIGHT, "Test OpenGL")
yield window.ctx
window.use()
window.close()
def test_default_properties(ctx):
"""Test textures"""
te... |
description = 'Sample slits horiz. gap'
prefix = '14IDB:m25'
target = 0.15015
EPICS_enabled = True |
import os
from poroto.common import load_template
from poroto.config import gen_path
class VhdlTestBench:
def __init__(self, designer, functions, mmap, streams_map, debug):
self.designer = designer
self.functions = functions
self.debug = debug
self.registers_map = mmap
self.... |
import os
import os.path as osp
import yaml
def _check_dir(dir, make_dir=True):
if not osp.exists(dir):
if make_dir:
print('Create directory {}'.format(dir))
os.mkdir(dir)
else:
raise Exception('Directory not exist: {}'.format(dir))
def get_train_config(config... |
from django import test
from ievv_opensource.ievv_customsql import customsql_registry
class TestRegistry(test.TestCase):
def test_add(self):
class MockCustomSql(customsql_registry.AbstractCustomSql):
pass
mockregistry = customsql_registry.MockableRegistry()
mockregistry.add('... |
r'''
--- Day 8: Seven Segment Search ---
You barely reach the safety of the cave when the whale smashes into the cave
mouth, collapsing it. Sensors indicate another exit to this cave at a much
greater depth, so you have no choice but to press on.
As your submarine slowly makes its way through the cave system, you n... |
from vizdoomgym.envs.vizdoomenv import VizdoomEnv
class VizdoomMyWayHomeSparse(VizdoomEnv):
def __init__(self, **kwargs):
super(VizdoomMyWayHomeSparse, self).__init__(10, **kwargs)
|
import logging
from TwitchWebsocket.Message import Message
from Settings import Settings
from Log import Log
Log(__file__)
# Modules
import tkinter as tk
import tkinter.scrolledtext as tkst
import tkinter.font as tkFont
import time, json
from datetime import datetime
from functools import reduce
import threading
c... |
def main(a, b):
cards = list(input())
cards[cards.index('A')] = a
cards[cards.index('A')] = b
if cards[-1] == 'B' and cards[-2] == 'B':
return ([-1], [8, 9])[b == 7]
prev = 0; prev_idx = 0; ans = []
for i, v in enumerate(cards):
if v != 'B':
count = cards[prev_idx:i].count('B')
if cou... |
import numpy as np
from astropy.table import Table
import matplotlib.pyplot as plt
import os
import emcee
import corner
from .cooling_age import calc_cooling_age, get_cooling_model
from .ifmr import calc_initial_mass, ifmr_bayesian
from .ms_age import calc_ms_age, get_isochrone_model
from .extra_func import calc_percen... |
from django.forms import ModelForm
from .models import Comment, Post
class PostForm(ModelForm):
class Meta:
model = Post
fields = ('group', 'text', 'image')
labels = {'group': 'Выберите группу', 'text': 'Текст поста',
'image': 'Загрузите изображение'}
class CommentForm... |
'''
Copyright (C) Espec North America, INC. - All Rights Reserved
Written by Myles Metzler mmetzler@espec.com, Dec. 2017
SCP220 debug port handler.
'''
import struct
import serial
from serial import SerialException
class SCP220DebugError(Exception):
'''generic error'''
pass
class SCP220Debug(object):
'''... |
from abc import ABC, abstractmethod
class BaseFish(ABC):
def __init__(self, name: str, species: str, size: int, price: float):
self.name = name
self.species = species
self.size = size
self.price = price
@property
def name(self):
return self.__name
@name.setter... |
from rest_framework import serializers
from apiApp.models import AreaType, Area, SensorType, Sensor, WorkingTable
class AreaTypeSerializer(serializers.ModelSerializer):
class Meta:
model = AreaType
fields = "__all__"
pass
class AreaSerializer(serializers.ModelSerializer):
class Meta:
... |
"""This file handles the parsing of feature specifications from files,
ending up with a configuration matrix"""
from collections import OrderedDict
from itertools import product
import os
from os.path import abspath, expanduser, expandvars
from pkg_resources import parse_version
import re
import sys
import six
import... |
import numpy as np
import pandas as pd
from sklearn.linear_model import lasso_path
from lassoloaddata import get_folds
# define the grid of lambda values to explore
alphas = np.logspace(-4, -0.5, 30)
def get_lasso_path(X_train, y_train, alphas=alphas):
"""
compute the lasso path for the given data
Args:
... |
#!/usr/bin/env python3
# Copyright (c) 2021 The Amero Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test being able to connect to the same devnet"""
from test_framework.test_framework import BitcoinTestFramewo... |
import numpy as np
import matplotlib.pyplot as plt
import os
import shutil
import imageio
def plotAndSave(X, Y, path):
plt.cla()
plt.bar(X, Y)
plt.savefig(path)
def checkfile(path):
if not os.path.exists(path):
os.mkdir(path)
else:
shutil.rmtree(path)
os.mkdir(path)
if ... |
import unittest
import csv
import os
import json
import datetime
from datetime import date
conf = None
class SimpleTest(unittest.TestCase):
def test_num_output_accts_matches(self):
simName = conf["general"]["simulation_name"]
accountFile=os.getcwd()+"/"+conf["input"]["directory"]... |
# 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 the Li... |
"""Message View tests."""
# run these tests like:
#
# FLASK_ENV=production python -m unittest test_message_views.py
import os
from unittest import TestCase
from config import get_config_ipdb_break
import ipdb
# if get_config_ipdb_break(): ipdb.set_trace()
from models import db, Message, User, Likes
# BEFORE we... |
"""
Created by adam on 3/27/18
"""
__author__ = 'adam'
import asyncio
import environment
from Profiling import log_start_stop
from Server.ServerTools import Client
from Sqlite.SqliteTools import initialize_master_db, delete_master_db
from CommonTools.Loggers import delete_files
async def run(future):
import Dat... |
"""
defines:
- SolidSection
- Material
- Part
"""
import numpy as np
allowed_element_types = [
'r2d2', 'conn2d2',
'cpe3', 'cpe4', 'cpe4r',
'cps3', 'cps4', 'cps4r',
'coh2d4', 'c3d10h', 'cohax4',
'cax3', 'cax4r', 'mass', 'rotaryi', 't2d2', 'c3d8r',
]
class SolidSection:
"""a SolidSection de... |
# coding: utf-8
"""
API Specification
# Introduction Welcome to gridscales API documentation. A REST API is a programming interface that allows you to access and send data directly to our systems using HTTPS requests, without the need to use a web GUI. All the functionality you are already familiar with in y... |
__author__ = 'pavelkosicin'
def test_search_query(app):
app.search.enter_query(query="thats")
app.navigation.choose_songs_tab()
app.search.check_response_title(expected_result_title="That's What I Like", error_message='Nothing found on request')
app.search.check_response_person(expected_result_person=... |
"""
请输入关键字:赵丽颖
最终保存 赵丽颖.html 到本地文件
"""
import requests
# 1.拼接URL地址
keyword = input('关键字:')
url = 'http://tieba.baidu.com/s?wd={}'.format(keyword)
headers = {
'User-Agent':'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.4324.104 Safari/537.36',
}
# 2.发请求获取... |
# coding: utf-8
import re
import six
from huaweicloudsdkcore.sdk_response import SdkResponse
from huaweicloudsdkcore.utils.http_utils import sanitize_for_serialization
class DeleteLabelsResponse(SdkResponse):
"""
Attributes:
openapi_types (dict): The key is attribute name
... |
#!/usr/bin/env python3
# TODO: same as for box86, flac can't be auto-generated yet
try:
# Python 3.5.2+ (NewType)
from typing import Union, List, Sequence, Dict, Tuple, NewType, TypeVar
except ImportError:
#print("Your Python version does not have the typing module, fallback to empty 'types'")
# Dummies
class GT... |
import os
import numpy as np
import pytest
from tensorflow.keras import Input, Model, models, backend
from tensorflow.keras.layers import MaxPooling2D, Flatten, Dense
from snntoolbox.bin.utils import run_pipeline
from tests.core.test_models import get_correlations, get_ann_acc
DATA_FORMAT = backend.image_data_format(... |
# -*- coding: utf-8 -*-
# ------------------------------------------------------------------------------
#
# Copyright 2018-2019 Fetch.AI 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 ... |
import cv2
import imagezmq
import socket
import time
from config import Config
# initialize the ImageSender object with the socket address of the
config = Config()
server_url = f"tcp://{config.gcp_address}:5555"
sender = imagezmq.ImageSender(connect_to=server_url)
# get the host name and initialize the video stream... |
# -*- coding: utf-8 -*- #
# Copyright 2013 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... |
# Databricks notebook source
# MAGIC %md-sandbox
# MAGIC
# MAGIC <div style="text-align: center; line-height: 0; padding-top: 9px;">
# MAGIC <img src="https://databricks.com/wp-content/uploads/2018/03/db-academy-rgb-1200px.png" alt="Databricks Learning" style="width: 600px">
# MAGIC </div>
# COMMAND ----------
# M... |
def reader():
print('Hello World!')
if __name__ == '__main__':
reader()
|
"""app URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/3.0/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: path('', views.home, name='home')
Class-based vie... |
import datetime as dt
import re
import pytest
import pytz
import stix2
from .constants import OPINION_ID
EXPLANATION = (
'This doesn\'t seem like it is feasible. We\'ve seen how '
'PandaCat has attacked Spanish infrastructure over the '
'last 3 years, so this change in targeting seems too great'
' t... |
# Copyright 2017 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... |
import os
class FileManager:
def __init__(self):
super().__init__()
def fileInfoScan (self, filepath):
fileInfoResult = {}
fileMetaStats = os.stat(filepath)
fileInfoResult['name'] = os.path.basename(filepath)
fileInfoResult['size'] = fileMetaStats.st_size
fileI... |
"""
Compute LSH hash codes based on the provided functor on all or specific
descriptors from the configured index given a file-list of UUIDs.
When using an input file-list of UUIDs, we require that the UUIDs of
indexed descriptors be strings, or equality comparable to the UUIDs' string
representation.
We update a key... |
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
import os
from setuptools import setup
NAME = "botbuilder-schema"
VERSION = os.environ["packageVersion"] if "packageVersion" in os.environ else "4.13.0"
REQUIRES = ["msrest==0.6.10"]
root = os.path.abspath(os.path... |
#!/usr/bin/env python2
# Copyright (c) 2014-2015 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 REST interface
#
from test_framework.test_framework import MotionTestFramework
from test_frame... |
import sys
GlobalIdCounter = 0
def GetID():
global GlobalIdCounter
GlobalIdCounter += 1
return GlobalIdCounter
def GetUID():
return "x%d"%GetID()
def FixCasing(Str):
NewStr = ""
NextUpperCase = True
for c in Str:
if NextUpperCase:
NextUpperCase = False
NewStr += c.upper()
else:
if c == "_":
Ne... |
import json
import logging
import re
import urllib2
class _NullHandler(logging.Handler):
"""
Null Handler class for Logger
"""
def emit(self, record):
pass
logger = logging.getLogger(__name__)
logger.addHandler(_NullHandler())
class ZabbixAPIException(Exception):
"""
ZabbixAPI exception class
cod... |
import asyncio
from modules.games.util.game import Game
HANGMAN_EMOJI_HEAD = "<:head:542748031196332051>"
HANGMAN_EMOJIS_ARMS = ["<:arms0:542748031393464320>",
"<:arms1:542748031494258708>",
"<:arms2:542748031573950464>"]
HANGMAN_EMOJIS_LEGS = ["<:legs1:5427480314608353... |
# Copyright (c) 2014-2019, Camptocamp SA
# All rights reserved.
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# 1. Redistributions of source code must retain the above copyright notice, this
# list of conditions an... |
"""
=============================================
Integration and ODEs (:mod:`scipy.integrate`)
=============================================
.. currentmodule:: scipy.integrate
Integrating functions, given function object
============================================
.. autosummary::
:toctree: generated/
quad ... |
# Copyright (c) 2008-2021 LG Electronics, 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 t... |
nome = str(input('Qual é seu nome completo? ')).strip()
print(f'Seu nome tem Silva? {"Silva" in nome.title().split()}')
|
# basic libs
import numpy as np
import torch
import cv2
import imutils
# pytorch
import torch
from torch.utils.data import Dataset
import albumentations as A
# custom modules
np.random.seed(42)
class Dataset_train(Dataset):
def __init__(self, volums_list, aug, n_classes, dataset):
sel... |
from __future__ import absolute_import
import ctypes
import os
import sys
if os.name == "posix":
if sys.platform == "darwin":
lib_name = "libtiledb.dylib"
else:
lib_name = "libtiledb.so"
else:
lib_name = "tiledb"
# On Windows and whl builds, we may have a shared library already linked, or... |
from django.shortcuts import render, redirect, get_object_or_404
from .models import Image, Profile, Comment, Relation
from django.contrib.auth.models import User
from django.contrib.auth.decorators import login_required
from .forms import uploadForm, commentForm
# Create your views here.
@login_required(login_url='/... |
# exported from PySB model 'model'
from pysb import Model, Monomer, Parameter, Expression, Compartment, Rule, Observable, Initial, MatchOnce, Annotation, ANY, WILD
Model()
Monomer('Ligand', ['Receptor'])
Monomer('ParpU', ['C3A'])
Monomer('C8A', ['BidU', 'C3pro'])
Monomer('BaxM', ['BidM', 'BaxA'])
Monomer('Apop', ['C... |
from django.core.cache import caches
from . import base
any_cache = caches['tmp_anything']
class Video(base.ExtractBase):
def info(self):
return dict(
title=self.title(),
urls=self.urls(),
embed_codes=self.embed_codes(),
)
def title(self):
sel = ... |
"""
requests_tracker.requests
=========================
"""
from __future__ import absolute_import
import json as JSON
from django.core.cache import cache
from django.utils.timezone import now
from requests.models import Request
from requests.packages.urllib3.connectionpool import HTTPConnectionPool
from requests.se... |
"""
`busio` - Bus protocol support like I2C and SPI
=================================================
See `CircuitPython:busio` in CircuitPython for more details.
* Author(s): cefn
"""
import threading
from adafruit_blinka import Enum, Lockable, agnostic
from adafruit_blinka.agnostic import board_id, detector
impor... |
class Crawler:
"""
This class handles the calling of the scraper.
"""
def __init__(self) -> None:
pass |
from typing import List
from weaverbird.backends.mongo_translator.steps.types import MongoStep
from weaverbird.pipeline.steps import PercentageStep
def translate_percentage(step: PercentageStep) -> List[MongoStep]:
return [
{
'$group': {
'_id': {g: f'${g}' for g in step.group}... |
# ~~~
# This file is part of the dune-xt-common project:
# https://github.com/dune-community/dune-xt-common
# Copyright 2009-2018 dune-xt-common developers and contributors. All rights reserved.
# License: Dual licensed as BSD 2-Clause License (http://opensource.org/licenses/BSD-2-Clause)
# or GPL-2.0+ (http://... |
import pytest
from pytest_mock import MockerFixture
import ecdsa
import base64
from pystratis.api.wallet import Wallet
from pystratis.api.wallet.responsemodels import *
from pystratis.core import PubKey, CoinType, Recipient, Outpoint, DestinationChain, ExtPubKey
from pystratis.api.global_responsemodels import UtxoDescr... |
#
# MIT License
#
# (C) Copyright 2019, 2021-2022 Hewlett Packard Enterprise Development LP
#
# 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... |
import KratosMultiphysics
import KratosMultiphysics.CompressiblePotentialFlowApplication
import math
def Factory(settings, Model):
if( not isinstance(settings,KratosMultiphysics.Parameters) ):
raise Exception("expected input shall be a Parameters object, encapsulating a json string")
return DefineWake... |
from collections.abc import Iterable, MutableSequence
from typing import List
from html_form_parser.models.form_data_entry import FormDataEntry
class FormDataEntryCollection(MutableSequence):
"""
A collection of FormDataField objects. Providing methods for locating
entries in the collection by name, or n... |
import os
import click
import boto3
import tempfile
import time
AWS_ACCESS_KEY_ID = os.getenv('AWS_ACCESS_KEY_ID')
AWS_SECRET_KEY = os.getenv('AWS_SECRET_KEY')
AWS_S3_BUCKET = os.getenv('AWS_S3_BUCKET', 'yawc')
AWS_REGION = os.getenv('AWS_REGION', 'ap-northeast-1')
AWS_SQS_URL = os.getenv('AWS_SQS_URL')
s3 = boto3.c... |
from utime import *
from ucollections import namedtuple
import ustruct
import uctypes
import ffi
import ffilib
import _libc
libc = ffilib.libc()
# struct tm *gmtime(const time_t *timep);
# struct tm *localtime(const time_t *timep);
# size_t strftime(char *s, size_t max, const char *format,
# con... |
# Copyright 2015 Hewlett-Packard Development Company, L.P.
#
# 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... |
import os
basedir = os.path.abspath(os.path.dirname(__file__))
class Config(object):
SQLALCHEMY_DATABASE_URI = os.environ.get('DATABASE_URL') \
or 'sqlite:///' + os.path.join(basedir, 'app.db')
SQLALCHEMY_TRACK_MODIFICATIONS = False |
# Copyright 2012 OpenStack 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 agr... |
import sys
def testCreateFreqMapWithStrings():
str_list = [ "ram", "shyam", "geeta", "ram", "hari", "shyam" ]
strFreqMap = createFreqDict(str_list)
assert(strFreqMap["ram"] == 2)
assert(strFreqMap["hari"] == 1)
assert(strFreqMap['shyam'] == 2)
print("Test Passed")
def testCreateFreqM... |
from piccolo_cipher import piccolokeygen
def test_key():
k80 = piccolokeygen.piccolokeygen(80)
assert len(k80) == 20
k128 = piccolokeygen.piccolokeygen(128)
assert len(k128) == 32 |
from typing import Callable, List, Match, Pattern, Tuple
from ..exceptions import ResourceNotFound
ResourceResolver = Callable[[List[Pattern[str]], str], Tuple[Pattern[str], Match]]
def first_in(
patterns: List[Pattern[str]], resource: str
) -> Tuple[Pattern[str], Match[str]]:
for pattern in patterns:
... |
from .ballista import *
|
# ##### BEGIN GPL LICENSE BLOCK #####
#
# 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 2
# of the License, or (at your option) any later version.
#
# This program is distrib... |
# example_bo_w_tp
# author: Jungtaek Kim (jtkim@postech.ac.kr)
# last updated: October 10, 2021
import numpy as np
import os
from bayeso.bo import bo_w_tp
from bayeso.tp import tp
from bayeso.utils import utils_plotting
PATH_SAVE = '../figures/bo_with_surrogates/'
STR_FUN_TARGET = 'bo_w_tp'
def fun_target(X):
... |
import asyncio
from pixivpy3 import AppPixivAPI as AAPI
from pixivpy_async import AppPixivAPI, PixivClient
from pixivpy_async.sync import AppPixivAPI as SAAPI
_USERNAME = 'userbay'
_PASSWORD = 'UserPay'
def test0():
api = AAPI()
api.login(_USERNAME, _PASSWORD)
print("test0 - finished")
def test2():
... |
import rospy
import time
from std_msgs.msg import Float64
from dynamixel_driver.dynamixel_const import *
def performAction(action):
# Take the action and issue the actual dynamixel command
pub = rospy.Publisher('tilt_controller/command', Float64, queue_size=10)
print("Performning action: " + str(action)... |
import copy
import logging
from typing import List, Optional
from great_expectations.core.batch import BatchDefinition, BatchRequestBase
from great_expectations.datasource.data_connector import FilePathDataConnector
from great_expectations.datasource.types import BatchSpec, PathBatchSpec
from great_expectations.execut... |
#!/usr/bin/env python
# coding=utf-8
# Copyright 2021 The HuggingFace Inc. team. 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/LI... |
NEWS_API_KEY = '25af597429964787a9d58e12e9746cf3'
|
"""
pyexcel_xls
~~~~~~~~~~~~~~~~~~~
The lower level xls/xlsx/xlsm file format handler using xlrd/xlwt
:copyright: (c) 2015-2016 by Onni Software Ltd
:license: New BSD License
"""
# flake8: noqa
# this line has to be place above all else
# because of dynamic import
_FILE_TYPE = 'xls'
_... |
#!/usr/bin/env python
from setuptools import setup
import re
VERSIONFILE="kmapper/_version.py"
verstrline = open(VERSIONFILE, "rt").read()
VSRE = r"^__version__ = ['\"]([^'\"]*)['\"]"
mo = re.search(VSRE, verstrline, re.M)
if mo:
verstr = mo.group(1)
else:
raise RuntimeError("Unable to find version string in ... |
# Bilangan Prima adalah Bilangan yang habis dibagi
# oleh bilangan itu sendiri dan bilangan 1
def isPrime(num):
# Mengecek apakah num merupakan bilangan negatif dan dibawah 2
if num < 2:
return "Bukan Bilangan Prima"
# Perulangan disini dimulai dari 2 dikarenakan
# bilangan prima dimulai dari 2 ... |
import warnings
class MCException(Exception):
def __init__(self, message, status_code=0):
self.message = message
self.status_code = status_code
def deprecated(func):
# This is a decorator which can be used to mark functions as deprecated. It will result in a
# warning being emitted when ... |
#!/usr/bin/env python
# This file is protected via CODEOWNERS
import os
import re
import sys
from setuptools import setup
CURRENT_PYTHON = sys.version_info[:2]
REQUIRED_PYTHON = (3, 7)
# This check and everything above must remain compatible with Python 2.7.
if CURRENT_PYTHON < REQUIRED_PYTHON:
sys.stderr.write... |
from django.db import models
from django.contrib.auth.models import User
departments=[('Cardiologist','Cardiologist'),
('Dermatologists','Dermatologists'),
('Emergency Medicine Specialists','Emergency Medicine Specialists'),
('Allergists/Immunologists','Allergists/Immunologists'),
('Anesthesiologists','Anesthesiolog... |
# 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 logging
from unittest import TestCase
from client import BitsgapClientWs
from tests.keys import public_key,private_key
class TestWSPriceHistory(TestCase):
def my_handler(message):
logging.info(message)
authClient = BitsgapClientWs(public_key, private_key)
market = 'kraken'
pair = 'ETH... |
"""
init.py
Starting script to run NetPyNE-based M1 model.
Usage:
python init.py # Run simulation, optionally plot a raster
MPI usage:
mpiexec -n 4 nrniv -python -mpi init.py
"""
import matplotlib; matplotlib.use('Agg') # to avoid graphics error in servers
from netpyne import sim
from cfg import cfg
from ... |
from __future__ import absolute_import
# Copyright (c) 2010-2015 openpyxl
"""Read an xlsx file into Python"""
# Python stdlib imports
from zipfile import ZipFile, ZIP_DEFLATED, BadZipfile
from sys import exc_info
from io import BytesIO
import os.path
import warnings
# compatibility imports
from openpyxl.compat impor... |
from optimModels.optimization.evaluation_functions import build_evaluation_function
from optimModels.optimization.run import kinetic_strain_optim
from optimModels.model.kineticModel import load_kinetic_model
from optimModels.simulation.simul_problems import KineticSimulationProblem
from optimModels.utils.configurations... |
"""Evaluation and Control Multichain Differential Value Iteration."""
from typing import Union
import numpy as np
from absl import logging
from differential_value_iteration.algorithms import algorithm
from differential_value_iteration.environments import structure
_DEBUG_ITER = -1
class Evaluation(algorithm.Evaluat... |
from pprint import pprint
import requests
r = requests.get('http://api.openweathermap.org/data/2.5/weather?q=Chicago&APPID=289d79262f138bd6ebb226285fd277e3')
#print(r.json())
# pprint(r.json())
print(r.json()['base']) |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('foia_hub', '0019_auto_20150301_1941'),
]
operations = [
migrations.DeleteModel(
name='ReadingRoomUrls',
),
]... |
#!/usr/bin/env python
import os
import re
import imp
import sys
sys.dont_write_bytecode = True
from pprint import pprint
from argparse import ArgumentParser
VERSION = 'v1'
sys.path.insert(0, VERSION)
from lexer import Lexer
from parser import Parser
from virtualmachine import VirtualMachine
from patterns import PATT... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.