text stringlengths 2 999k |
|---|
import base64
import collections
import datetime
import importlib
import inspect
import json
import logging
import os
import sys
import tarfile
import traceback
from builtins import str
import boto3
from werkzeug.wrappers import Response
# This file may be copied into a project's root,
# so handle both scenarios.
try... |
import LL1
class Node(LL1.Node):
def delete(self, k):
if(k<0):
return None
node = self
nodeinit = node
if(k==0):
nodeinit = nodeinit.next
else:
i = 1
while(node.next != None):
if(i == k):
nod... |
import random
import multihash
import pytest
import base58
from Crypto.PublicKey import RSA
from libp2p.peer.id import ID, id_b58_encode, id_b58_decode, id_from_public_key, id_from_private_key
ALPHABETS = '123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz'
def test_init_():
random_id_string = ''
for... |
#!/usr/bin/env python3
# coding: utf-8
#
# $Id: constants.py 1546.v0.2-dev.1 $
# SPDX-License-Identifier: BSD-2-Clause
"""
Game constants, to be imported
From:
https://github.com/blind-coder/SpaceTrader/blob/master/SpaceTrader/src/main/java/de/anderdonau/spacetrader/Main.java
https://github.com/blind-... |
import backtrader as bt
from models.Strategies.StrategySkeleton import StrategySkeleton as StrategySkeleton
class SimpleStratSkeleton(StrategySkeleton):
""" Modelizes a simple strategy without stop loss or take profit """
def __init__(self):
super().__init__()
self.order = None
def notif... |
from classifier.NaiveBayesSKlearn import SKNaiveBayesClassifier
from api.helpers import classify_text, classify_lead_excerpts
train_data = [
('This is sample text 1', 'class A'),
('Some other text', 'class B'),
('Classification is a very nice algorithm', 'class A'),
('Lighting technicians are responsib... |
#-----------------------------------------------------------------------------
# Copyright (c) 2018-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... |
from django.contrib.auth import get_user_model
from django.urls import reverse
from django.test import TestCase
from rest_framework import status
from rest_framework.test import APIClient
from core.models import Ingredient
from recipe.serializers import IngredientSerializer
INGREDIENTS_URL=reverse('recipe:ingredient... |
from django.http import HttpResponse
from django.core.mail import send_mail
from django.template.loader import render_to_string
from django.conf import settings
from .models import Order, OrderLineItem
from products.models import Album
from profiles.models import UserProfile
import json
import time
class StripeWH_H... |
# -*- coding: utf-8 -*-
"""
Utility functions for simplifying interactions with lenstronomy classes.
"""
from lenstronomy.ImSim.Numerics.numerics_subframe import NumericsSubFrame
class PSFHelper():
"""Class for simplifying interactions with the lenstronomy PSF class
when using 2d images generated outside lenstronom... |
# -*- coding: utf-8 -*-
"""
ipcai2016
Copyright (c) German Cancer Research Center,
Computer Assisted Interventions.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE for details
"""
"""
Crea... |
import json
from pathlib import (
Path,
)
from typing import (
TYPE_CHECKING,
Any,
Dict,
Generator,
Iterable,
List,
Optional,
Tuple,
Type,
Union,
cast,
)
from eth_typing import (
URI,
Address,
ContractName,
Manifest,
)
from eth_utils import (
to_canon... |
"""Support for a Hue API to control Home Assistant."""
import copy
import datetime
import functools
import inspect
import json
import logging
import os
import ssl
import time
from typing import Any, AsyncGenerator, Optional
import tzlocal
from aiohttp import web
import emulated_hue.const as const
from emulated_hue.en... |
# 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... |
import nuke
import os
#--------------------------------------------------------------------------------------------
#
# Customize Nuke Shortcuts
#
#--------------------------------------------------------------------------------------------
# In Nuke 9 there are now 3 different shortcut contexts:
# Window Conte... |
import textwrap
import jikanpy
import requests
def getPosterLink(mal):
# grab poster from kitsu
kitsu = getKitsu(mal)
image = requests.get(f'https://kitsu.io/api/edge/anime/{kitsu}').json()
return image['data']['attributes']['posterImage']['original']
def getKitsu(mal):
# get kitsu id from mal id... |
# Copyright (c) 2020 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by app... |
#
# This file is part of LiteX.
#
# Copyright (c) 2020 Florent Kermarrec <florent@enjoy-digital.fr>
# Copyright (c) 2020 Dolu1990 <charles.papon.90@gmail.com>
# SPDX-License-Identifier: BSD-2-Clause
import os
from os import path
from migen import *
from litex import get_data_mod
from litex.soc.interconnect import w... |
#
# Copyright 2017, 2020 Lars Pastewka
# 2019-2020 Antoine Sanner
#
# ### MIT license
#
# 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 limita... |
import numpy as np
import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt
def plot_prediction_price(origin, predict, title):
_, ax = plt.subplots(figsize = (15,5))
# matplotlib.rcParams['figure.figsize'] = (10, 10)
ax.scatter(x = range(0, origin.size), y=origin, c = 'blue', label = 'Actual P... |
"""
WSGI config for grasa_event_locator project.
This module contains the WSGI application used by Django's development server
and any production WSGI deployments. It should expose a module-level variable
named ``application``. Django's ``runserver`` and ``runfcgi`` commands discover
this application via the ``WSGI_AP... |
#!/usr/bin/env python3
# Copyright (c) 2017 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test thincoin-cli"""
from test_framework.test_framework import BitcoinTestFramework
from test_framework.util... |
import matplotlib
import matplotlib.pyplot as plt
import pandas
import os
import re
# plt.rc('font', size=SMALL_SIZE) # controls default text sizes
# plt.rc('axes', titlesize=SMALL_SIZE) # fontsize of the axes title
plt.rc('axes', labelsize=16) # fontsize of the x and y labels
# plt.rc('xtick', labelsi... |
# 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... |
__all__ = [
"Worker",
"WorkerThread",
"WorkerError",
"WorkerPool",
"WorkerPoolHandle",
"MessageQueue",
"Channel",
"Connection",
]
import logging
from contextlib import ExitStack, contextmanager
from dataclasses import dataclass, field
from queue import Queue
from threading import Threa... |
from typing import Dict, List, Optional, Tuple, NamedTuple
# SpendResult = Tuple[bool, int]
class SpendResult(NamedTuple):
is_successful: bool
balance: int
class Account(object):
def __init__(self, name: str, initial_balc: int) -> None:
self.name = name
self.initial_balc = ... |
from django.conf.urls import url
from django.contrib import admin
from django.urls import include, path
urlpatterns = [
path('admin/', admin.site.urls),
path('board/', include('marketplace.apps.board.urls')),
]
|
"""Module symbol-table generator"""
from __future__ import print_function
import sys, types
from . import ast
from .consts import SC_LOCAL, SC_GLOBAL_IMPLICIT, SC_GLOBAL_EXPLICIT, \
SC_FREE, SC_CELL, SC_UNKNOWN
from .misc import mangle
MANGLE_LEN = 256
class Scope:
# XXX how much information ... |
import asyncio
import asynctest
from asynctest import CoroutineMock, MagicMock, Mock, patch
from nkn_client.websocket.nkn_api import (
NknWebsocketApiClient,
NknWebsocketApiClientError
)
class TestNknWebsocketApiClient(asynctest.TestCase):
def setUp(self):
self._client = NknWebsocketApiClient()
def ... |
# coding: utf-8
"""
Isilon SDK
Isilon SDK - Language bindings for the OneFS API # noqa: E501
OpenAPI spec version: 3
Contact: sdk@isilon.com
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
import unittest
import isi_sdk_8_0
from isi... |
a = 10
b = "test"
|
#!/usr/bin/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
# "Licens... |
#!/usr/bin/python
#
# Copyright 2018 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 ag... |
# Automatically generated from poetry/pyproject.toml
# flake8: noqa
# -*- coding: utf-8 -*-
from setuptools import setup
packages = \
['c7n_sphinxext']
package_data = \
{'': ['*'], 'c7n_sphinxext': ['_templates/*']}
install_requires = \
['Pygments>=2.10.0,<3.0.0',
'Sphinx>=3.0,<3.1',
'argcomplete (>=1.12.3,<2.0.0)... |
first_num = 2;
secord_num = 3;
sum = firstNum + secondNum;
print(sum);
|
import os
import io
import re
import sys
from setuptools import setup, find_packages
from pkg_resources import get_distribution, DistributionNotFound
def read(*names, **kwargs):
with io.open(
os.path.join(os.path.dirname(__file__), *names),
encoding=kwargs.get("encoding", "utf8")
) as fp:
... |
import streamlit as st
import pandas as pd
import src.models.data_preprocessing as data_preprocessing
import src.pages.home as home
import src.pages.data_exploration as data_exploration
import src.pages.problem_statistics as problem_statistics
import src.pages.content_statistics as content_statistics
import src.pages... |
#
# Copyright (C) 2009, Jose Antonio Martin H.
#
#
#
# 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 socket
import unittest2 as unittest
from datetime import datetime, timedelta
from multiprocessing import get_logger
from Queue import Empty
from carrot.backends.base import BaseMessage
from carrot.connection import BrokerConnection
from celery.utils.timer2 import Timer
from celery import conf
from celery.deco... |
class Vehicle:
@staticmethod
def move():
return "moving..." |
import os
import numpy as np
import dynalysis.basics as bcs
import dynalysis.classes as clss
#=====basics=====#
def vect_len(coor1, coor2):
'''returns: length of vector'''
if len(coor1)!=len(coor2): raise bcs.AlgorithmError('func vect_len')
vect = [coor1[i]-coor2[i] for i in range(len(coor1))]
... |
from flask import render_template,request,redirect,url_for,abort
from flask_login import login_required,current_user
from ..models import Pitches,Role,User,Comments
from . import main
from flask import render_template
from .. import db,photos
from .forms import PitchForm,CommentForm,UpdateProfile
@main.route('/')
def... |
import json
from datetime import datetime
from test.test_const import CONST_BASE_URL, CONST_PORT, CONST_SSL
from unittest import TestCase
from pygrocydm.userobject import USEROBJECTS_ENDPOINT, UserObject
from pygrocydm.grocy_api_client import GrocyApiClient
class TestUserEntity(TestCase):
def setUp(self):
... |
# -*- coding: utf-8 -*-
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: calendar_events.proto
import sys
_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from google.prot... |
"""A couple of point pens to filter contours in various ways."""
from fontTools.pens.basePen import AbstractPen, BasePen
from robofab.pens.pointPen import AbstractPointPen
from robofab.objects.objectsRF import RGlyph as _RGlyph
from robofab.objects.objectsBase import _interpolatePt
import math
#
# threshold filter... |
# -*- coding: utf-8 -*-
import unittest
from decimal import Decimal
from scripts.probability import roll_success_range
"""
Max shots script tests.
"""
__author__ = 'Bernardo Martínez Garrido'
__license__ = 'MIT'
class TestZeroToTenBelowNotEqual(unittest.TestCase):
"""
Tests the chance to go above with the... |
from __future__ import unicode_literals
from django import forms
from django.apps import apps
from django.utils.functional import curry
from django.utils.translation import ugettext_lazy as _
FIELD_TYPES = [
('text', _('text'), forms.CharField),
('email', _('e-mail address'), forms.EmailField),
('longtex... |
#Author: ahmelq - github.com/ahmedelq/
#License: MIT
#This is a solution of the challange: https://codegolf.stackexchange.com/questions/180970/create-chunks-from-an-array?page=2&tab=votes#tab-top
def split(ary, n):
"""Given an array, and an integer, split the array into n parts"""
result = []
for i in ran... |
from plotter_utils import smooth, reformat_large_tick_values
import matplotlib.ticker as tick
import matplotlib.cm as cm
import matplotlib.pyplot as plt
import numpy as np
import matplotlib
matplotlib.use('TkAgg')
def extract_obs(obs):
# 6 + 6 + 24 + 6*n + 1
n_extra = 0
dist = obs[0][:6].astype(np.float) ... |
import datetime
from ..config import db
from .server import Server
from .server_backup import ServerBackup
class ServerLog(db.Model):
__tablename__ = "server_logs"
id = db.Column(db.Integer, primary_key=True)
server_id = db.Column(db.Integer, db.ForeignKey(Server.id), nullable=False)
created = db.Col... |
# Copyright (c) 2014-present PlatformIO <contact@platformio.org>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appli... |
from setuptools import setup, find_packages
from torch.utils.cpp_extension import BuildExtension, CUDA_HOME
from torch.utils.cpp_extension import CppExtension, CUDAExtension
# In any case, include the CPU version
modules = [
CppExtension('torchsearchsorted.cpu',
['src/cpu/searchsorted_cpu_w... |
# -*- coding: utf-8 -*-
"""Mixed one vs. two spaces after a period.
---
layout: post
source: Consistency.
source_url: ???
title: Mixed use of 1 vs. 2 spaces after a period.
date: 2014-06-10 12:31:19
categories: writing
---
Points out instances where there are two conventions, 1 vs. 2 spaces after
a... |
r"""
Macdonald Polynomials
Notation used in the definitions follows mainly [Mac1995]_.
The integral forms of the bases `H` and `Ht` do not appear in
Macdonald's book. They correspond to the two bases
`H_\mu[X;q,t] = \sum_{\nu} K_{\nu\mu}(q,t) s_\mu[X]` and
`{\tilde H}_\mu[X;q,t] = t^{n(\mu)} \sum_{\nu} K_{\nu\mu}(q,... |
from .compat import unittest
import ucl
import json
import os.path
import glob
import re
TESTS_SCHEMA_FOLDER = '../tests/schema/*.json'
comment_re = re.compile('\/\*((?!\*\/).)*?\*\/', re.DOTALL | re.MULTILINE)
def json_remove_comments(content):
return comment_re.sub('', content)
class ValidationTest(unittest.Te... |
import io
import cv2
import math
import base64
import numpy as np
from PIL import Image
from os.path import dirname, join
import tensorflow as tf
from explain_lite import OcclusionSensitivity
"""
模型解释
"""
model_file = join(dirname(__file__), "model_beauty_q_v2.tflite")
interpreter = tf.compat.v1.lite.Interpreter(model... |
import os
import time
import subprocess
import io
import tarfile
from pathlib import Path
from subprocess import CalledProcessError
import docker
import asyncio
from async_generator import yield_
from .utils import (
pool_helper, wallet_helper, default_trustee, ensure_pool_is_functional, ensure_all_nodes_online,
... |
import requests
class Client:
DEFAULT_API_URL = "https://api.mailgun.net/v3"
def __init__(self, mailgun):
self.mailgun = mailgun
def prepare_request(self, url: str, method="get", data=None, headers=None, params=None, **kwargs):
real_url = "%s/%s/%s" % (self.get_api_url(), self.mailgun.pr... |
#Plotting flower species
#Importing libraries
from bokeh.plotting import figure
from bokeh.io import output_file, show
from bokeh.sampledata.iris import flowers
from bokeh.models import Range1d, PanTool, ResetTool, HoverTool
#Define the output file path
output_file("iris.html")
#Create the figure object
... |
description = 'AMOR unpolarized deflected beam mode'
group = 'basic'
pvprefix = 'SQ:AMOR:motc:'
devices = dict(
ltz = device('nicos_ess.devices.epics.motor.EpicsMotor',
description = 'Deflector vertical translation',
motorpv = pvprefix + 'ltz',
errormsgpv = pvprefix + 'ltz-MsgTxt',
),... |
/home/runner/.cache/pip/pool/82/0f/9e/386248a4aa71542a69d83b23143759c4b99e6a2185fb92ee6dfc70f04c |
"""
List Slicing
syntax: some_list[start:end:step]
"""
first_list = [1, 2, 3, 4]
second_list = [1, 2, 3, 4, 5, 6]
# First Parameter for Slice: start
first_list[1:] # [2, 3, 4]
first_list[3:] # [4]
first_list[-1:] # [4]
first_list[-3:] # [2, 3, 4]
first_list[0:] # copy of the list first_list, first_list == first_... |
from NIENV import *
# API METHODS --------------
# self.main_widget
# self.update_shape()
# Ports
# self.input(index)
# self.set_output_val(index, val)
# self.exec_output(index)
# self.create_new_input(type_, label, widget_name=None, widget_pos='under', pos=-1)
# self.delete_input(index)
# self.create_new_output(t... |
#!/usr/bin/env python2
import os
import errno
import sys
import subprocess
import shutil
sys.path.append(os.path.join(os.path.dirname(__file__), '..', '..', '..', '..', '..', 'xar'))
import xar
import xml.etree.ElementTree as ET
# Check that the product version is correctly set during the build process
test_displa... |
# Copyright 2013-2020 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 PyGriddataformats(PythonPackage):
"""The gridDataFormats package provides classes to unify... |
import os
# Send a command to the linux terminal
def terminal(cmd):
#print(cmd)
return os.popen(cmd).read()
def getServerProcessID():
output = terminal('ps -A | grep bssl')
output = output.strip().split(' ')
if len(output) == 0 or output[0] == '': return None
pid = int(output[0])
return pid
def stopServer():
... |
# Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: MIT-0
# pylint: skip-file
import os
import boto3
from pytest import fixture, raises
from stubs import stub_step_functions
from mock import Mock
from stepfunctions import StepFunctions
@fixture
def cls():
cls = S... |
import numpy as np
import tables
import argparse
import os
import sys
def run_npz(file, out):
data = np.load(file)
coords = data['coord']
x = coords[0,:]
y = coords[1,:]
d = 10.0 * np.sqrt(np.sum((x - y)**2))
print d
with open(out, 'w') as f:
f.write('{:f}\n'.format(d))
def ru... |
# Scrapy settings for quotes project
#
# For simplicity, this file contains only settings considered important or
# commonly used. You can find more settings consulting the documentation:
#
# https://docs.scrapy.org/en/latest/topics/settings.html
# https://docs.scrapy.org/en/latest/topics/downloader-middleware.... |
# coding: utf-8
"""
TGS API
A production scale tool for BYOND server management # noqa: E501
OpenAPI spec version: 9.0.0
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
import pprint
import re # noqa: F401
import six
from swagger_client.models.user_create_request import ... |
import num_check as pair
import distribute as db
def role_comment():
no = pair.check(db.cpu, db.cpu_num)
if no == 0 :
role = 'no role...'
elif no == 1 :
role = 'one pair!'
elif no == 2 :
role = 'two pair!'
elif no == 3 :
role = 'three card!'
elif no == ... |
# command line entry point
from .cmdline import main
main() |
# Copyright 2010 Orbitz WorldWide
#
# Ammended by Helio Guilherme <helioxentric@gmail.com>
# Copyright 2011-2015 Nokia Networks
# Copyright 2016- Robot Framework Foundation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You ma... |
"""
OSMnx setup script.
See license in LICENSE.txt.
"""
import os
from setuptools import setup
# provide a long description using reStructuredText
LONG_DESCRIPTION = r"""
**OSMnx** is a Python package that lets you download spatial geometries and
model, project, visualize, and analyze real-world street networks fro... |
#!/usr/bin/env python
# Licensed to Cloudera, Inc. under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. Cloudera, Inc. licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you ma... |
"""
Tyson Reimer
University of Manitoba
August 06th, 2020
"""
import os
import numpy as np
import matplotlib.pyplot as plt
from sklearn.metrics import roc_auc_score
from sklearn.linear_model import LogisticRegression
from umbms import get_proj_path, get_script_logger, verify_path
from umbms.loadsave ... |
from .InputText import text
from .InputSelect import select
from .InputConfirm import confirm
from .InputMultiSelect import multi_select
from .inputPatchSelect import patch_select
from .InputLog import logger
def many(selected_inputs_data):
STORE = {
"text": text,
"select": select,
"confir... |
"""
Some top-level exceptions that are generally useful.
"""
class UploadedImageIsUnreadableError(Exception):
"""
Raise this when the image generation backend can't read the image being
uploaded. This doesn't necessarily mean that the image is definitely
mal-formed or corrupt, but the imaging library ... |
# -*- coding: utf-8 -*-
# ------------------------------------------------------------------------------
#
# Copyright 2022 Valory AG
# Copyright 2018-2021 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.
# ... |
# Copyright 2018 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... |
# Copyright 2018 The TensorFlow Probability 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 o... |
from io import BytesIO
import sys
from typing import Any, AsyncIterable, Callable, Optional, Union
from blacksheep import Request, Response
from blacksheep.server.responses import (
MessageType,
accepted,
bad_request,
created,
file,
ContentDispositionType,
forbidden,
html,
json,
... |
from __future__ import print_function
import enum
import re
import struct
import sys
import threading
import time
import serial
from serial.tools.list_ports import comports
from common import *
def multichr(ords):
if sys.version_info[0] >= 3:
return bytes(ords)
else:
return ''.join(map(chr, ... |
import math
# shadho_worker is a python module sent to the worker automatically along with
# your code that takes care of loading the hyperparmeters and packaging the
# results in a way that SHADHO understands.
import shadho_worker
# Somewhere in this file, you have to define a function to optimize. This will
# be r... |
from django.urls import path
from django.conf.urls import url,include
from . import views
urlpatterns = [
url(r'^upload/$', views.upload_file),
url(r"^download/$",views.download_file,name='down'),
url(r"^index/$",views.home_page,name="home"),
url(r"^search/$",views.search,name='search'),
] |
r"""
Basic tests of RCA1 algorithm in :class:`multidim.PointCloud`
Copyright
---------
- This file is part of https://github.com/geomdata/gda-public/
- 2015, 2016, 2017 by Geometric Data Analytics, Inc. (http://geomdata.com)
- AGPL license. See `LICENSE` or https://github.com/geomdata/gda-public/blob/master/LICENSE... |
#!/usr/bin/env python3
# I use python 2.7 grammer
import psutil
import os
import sys
#subprcess.call ('ls -al', shell=True)
def find_ibofos_coredump_and_renaming():
core_dir_path="/etc/ibofos/core"
file_list = os.listdir(core_dir_path)
for path in file_list:
filename=os.path.basename(path)
... |
from .cfmmc import CfmmcBrowser
# 下载日常数据
downloadDailySettlement = CfmmcBrowser.downloadDailySettlement
|
# Copyright (c) 2017-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the license found in the LICENSE file in
# the root directory of this source tree. An additional grant of patent rights
# can be found in the PATENTS file in the same directory.
import numpy as np
import torch
f... |
import matplotlib
matplotlib.use('GTKAgg')
from matplotlib.backends.backend_gtk import DialogLineprops
import numpy as np
import matplotlib.pyplot as plt
def f(t):
s1 = np.cos(2*np.pi*t)
e1 = np.exp(-t)
return np.multiply(s1,e1)
t1 = np.arange(0.0, 5.0, 0.1)
t2 = np.arange(0.0, 5.0, 0.02)
t3 = np.arange(... |
from datetime import datetime
from libsaas import http, parsers
from libsaas.services import base
class Indicator(base.RESTResource):
path = 'indicators'
@base.apimethod
def get(self, start_date, end_date):
assert isinstance(start_date, datetime)
assert isinstance(end_date, datetime)
... |
# 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... |
"""
Tools for managing and manipulating tables on disk in parquet format.
"""
#
# Copyright (c) 2016-2021 Deephaven Data Labs and Patent Pending
#
##############################################################################
# This code is auto generated. DO NOT EDIT FILE!
# Run generatePythonIntegra... |
# Copyright (c) 2018, NVIDIA CORPORATION.
import operator
import pytest
import numpy as np
import pandas as pd
import pyarrow as pa
import array as arr
from librmm_cffi import librmm as rmm
import cudf as gd
from cudf.dataframe.dataframe import Series, DataFrame
from cudf.dataframe.buffer import Buffer
from cudf.se... |
try:
age = int(input("Age: "))
xfactor = 10/age # it'll crash at age = 0 -> ZeroDivisionError
except (ValueError, ZeroDivisionError) as ex:
print("You didn't enter a valid age 🥲")
# except ZeroDivisionError:
# print("Age cannot be zero 😂")
else:
print("No exceptions found!")
|
# => moved to ponder/plotgene.py
import pandas as PD
import numpy as N
import matplotlib.pyplot as P
#import bedtools as BT
#import gtfgffbed as GGB
import jgem.utils as UT
import random
from matplotlib.patches import Rectangle, PathPatch, Circle, Ellipse
from matplotlib.lines import Line2D
from matplotlib.path impo... |
# Copyright (c) 2017 NVIDIA Corporation
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
from open_seq2seq.data.text2text.text2text import SpecialTextTokens
import argparse
import sentencepiece as spm
vocab_size = 327... |
import os
import sys
def get_http_prompt_path():
"""Get the path to http-prompt executable."""
python_dir = os.path.dirname(sys.executable)
bin_name = 'http-prompt'
if sys.platform == 'win32':
bin_name += '.exe'
paths = [
os.path.join(python_dir, bin_name),
os.path.join(py... |
# coding=utf-8
import re
import ast
from setuptools import setup, find_packages
_version_re = re.compile(r'__version__\s+=\s+(.*)')
with open('seldom/__init__.py', 'rb') as f:
version = str(ast.literal_eval(_version_re.search(
f.read().decode('utf-8')).group(1)))
with open("description.rst", "r", encodin... |
#!/usr/bin/env python
# Copyright (c) 2017-2019 The Zcash developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or https://www.opensource.org/licenses/mit-license.php.
#
# Test reorg limit
#
import sys; assert sys.version_info < (3,), ur"This script does not run under Python 3. ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.