text stringlengths 2 999k |
|---|
# 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 appli... |
import numpy as np
#import numpy.linalg
import scipy.integrate
# solve polarized RT equation analytically either using matricant (O-matrix) method from Degl'Innocenti or DELO method from Rees+
# JAD 8/12/2014
def opacity_matrix(a,p):
return np.array([[a[0],a[1],a[2],a[3]],[a[1],a[0],p[2],-p[1]],[a[2],-p[2],a[0],p[... |
"""
Test base helpers.
"""
# Python3 support
from __future__ import print_function
from __future__ import unicode_literals
# Python std lib
import os
import sys
import unittest
# third party libs
try:
import jinja2 # noqa
HAS_JINJA = True
except ImportError:
HAS_JINJA = False
try:
import jtextfsm a... |
from arxiv_public_data import fulltext
from google.cloud import storage
import multiprocessing
max_cpu = 2
storage_client = storage.Client()
if __name__ == '__main__':
fulltext.convert_directory_parallel(path=storage_client.bucket("gs://nkebucket-arxiv-ai/arxiv-pdf"), processes=2, timelimit=2*60)
#
full... |
## 백준 2011번
## 암호코드
## 다이나믹 프로그래밍
'''점화식
dp[n] = dp[n] + dp[n-1] -> 한자리 숫자
dp[n] = dp[n] + dp[n-2] -> 두자리 숫자
'''
def count(N):
l = len(N)
# dp[i] : i번째 수 단계에서 암호 코드의 개수
dp = [0] * (l+1)
if N[0] == 0: # 암호 만들 수 없는 경우
##* print(0)
return dp, l
else:
N = [0] + N # 인덱싱을 위해 추... |
#!/usr/bin/env python
# encoding: utf-8
#
# Copyright SAS Institute
#
# 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 b... |
# -*- coding: utf-8 -*-
"""
jinja2.filters
~~~~~~~~~~~~~~
Bundled jinja filters.
:copyright: (c) 2017 by the Jinja Team.
:license: BSD, see LICENSE for more details.
"""
import re
import math
import random
import warnings
from itertools import groupby, chain
from collections import namedtuple
fro... |
# -*- coding: utf-8 -*-
"""
babel.numbers
~~~~~~~~~~~~~
Locale dependent formatting and parsing of numeric data.
The default locale for the functions in this module is determined by the
following environment variables, in that order:
* ``LC_NUMERIC``,
* ``LC_ALL``, and
* ``LANG``
... |
from ctypes import resize
import dearpygui.dearpygui as dpg
from dynamixels_functions import *
from registry import *
from themes import *
import time
tot_time = 0
# CALLBACK FUNCTIONS
def change_wave_form( sender, data, user ):
data = dpg.get_value( CONVOLUCAO )
dpg.... |
# -*- coding: utf-8 -*-
"""
Created on 2021-03-02 23:42:40
---------
@summary:
---------
@author: liubo
"""
import feapder
class TencentNewsParser(feapder.BatchParser):
"""
注意 这里继承的是BatchParser,而不是BatchSpider
"""
def start_requests(self, task):
task_id = task[0]
url = task[1]
... |
from collections import defaultdict
from concurrent.futures import ThreadPoolExecutor
from logging import getLogger
from threading import Lock
import chess
import numpy as np
from chess_zero.config import Config
from chess_zero.env.chess_env import ChessEnv, Winner
#from chess_zero.play_game.uci import info
logger ... |
# -*- coding: utf-8 -*-
# Copyright (c) 2010 OpenStack Foundation.
#
# 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... |
"""Tests for spy creation."""
import pytest
import inspect
from typing import Any
from decoy.spy_calls import SpyCall
from decoy.spy import create_spy, AsyncSpy, Spy, SpyConfig
from .common import (
noop,
some_func,
some_async_func,
SomeClass,
SomeAsyncClass,
SomeNestedClass,
)
pytestmark = p... |
# Copyright (c) 2020-2021, 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... |
'''Tests for multipletests and fdr pvalue corrections
Author : Josef Perktold
['b', 's', 'sh', 'hs', 'h', 'fdr_i', 'fdr_n', 'fdr_tsbh']
are tested against R:multtest
'hommel' is tested against R stats p_adjust (not available in multtest
'fdr_gbs', 'fdr_2sbky' I did not find them in R, currently tested for
cons... |
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
from sklearn import ensemble
from sklearn.utils import shuffle
from sklearn.metrics import mean_squared_error
from sklearn.cross_validation import (ShuffleSplit, cross_val_score,
train_test_split)
from sklearn.... |
# Sample Lambda Function to post notifications to a Chime room when an AWS Health event happens
from __future__ import print_function
import json
import logging
import os
from urllib2 import Request, urlopen, URLError, HTTPError
# Setting up logging
logger = logging.getLogger()
logger.setLevel(logging.INFO)
# main func... |
import os
import pytest
import sys
import time
from ray._private.test_utils import (
wait_for_condition,
check_local_files_gced,
generate_runtime_env_dict,
)
import ray
from unittest import mock
if not os.environ.get("CI"):
# This flags turns on the local development that link against current ray
... |
# Configuration file for the Sphinx documentation builder.
#
# This file only contains a selection of the most common options. For a full
# list see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html
# -- Path setup --------------------------------------------------------------
# If ex... |
# 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... |
# Generated by Django 2.2 on 2018-09-26 07:46
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('LectioEx', '0002_auto_20180926_0744'),
]
operations = [
migrations.AddField(
model_name='badge',
name='upload_date',
... |
#
# @BEGIN LICENSE
#
# Psi4: an open-source quantum chemistry software package
#
# Copyright (c) 2007-2017 The Psi4 Developers.
#
# The copyrights for code used from other parties are included in
# the corresponding files.
#
# This file is part of Psi4.
#
# Psi4 is free software; you can redistribute it and/or modify
#... |
from __future__ import print_function
import re
from . import dbdict
from .ruffus_utility import *
from .ruffus_utility import shorten_filenames_encoder, FILE_CHECK_RETRY, FILE_CHECK_SLEEP
from .ruffus_exceptions import *
################################################################################
#
# file_name_... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from frappe import _
def get_data():
return [
{
"module_name": "Pos Barcode Scanner",
"color": "grey",
"icon": "octicon octicon-file-directory",
"type": "module",
"label": _("Pos Barcode Scanner")
}
]
|
"""
zoom.page
"""
import io
import logging
import sys
import zoom
from zoom.component import Component
from zoom.components import as_actions
from zoom.response import HTMLResponse
from zoom.mvc import DynamicView
from zoom.utils import OrderedSet
import zoom.html as html
import zoom.apps
import zoom.forms
impor... |
# encoding: utf-8
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
from froide.helper.auth_migration_util import USER_DB_NAME
APP_MODEL, APP_MODEL_NAME = 'account.User', 'account.user'
class Migration(SchemaMigration):
def forwards(self, orm):
... |
import tensorflow as tf
class cross_entropy(object):
@staticmethod
def evaluate(a, y, regularization_term):
#We use tf.max(a, 1e-10) to make sure we only clip if we risk doing log(0), thus avoiding NaN problems
return tf.reduce_mean(-tf.reduce_sum(y * tf.log(tf.maximum(a, 1e-10)), reduction_in... |
import inspect
import sqlalchemy as sa
from sqlalchemy.sql.type_api import TypeEngine as SQLAType
from typing import *
from .base_model import BaseModel as Model
from .model_registry import ModelRegistry
from .utils import snake_case
def foreign_key(*args,
fk_col: Optional[str] = None,
... |
"""Base class for HVAC systems following a standards template."""
from pydantic import Field
from enum import Enum
from .._base import IDdEnergyBaseModel
class Vintages(str, Enum):
ashrae_2019 = 'ASHRAE_2019'
ashrae_2016 = 'ASHRAE_2016'
ashrae_2013 = 'ASHRAE_2013'
ashrae_2010 = 'ASHRAE_2010'
ashr... |
from __future__ import print_function
import timeit
import cProfile as profile
import math
import numpy as np
import warnings
warnings.filterwarnings("ignore")
from parampy import Parameters,SIUnitDispenser,Quantity,SIQuantity,Unit, UnitDispenser, Units, errors
###################### UNIT TESTS ####################... |
'''
beeBrain - An Artificial Intelligence & Machine Learning library
by Dev. Ibrahim Said Elsharawy (www.devhima.tk)
'''
''''
MIT License
Copyright (c) 2019 Ibrahim Said Elsharawy
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "So... |
"""
Registers various :mod:`~django.contrib.admin` models to generate the app's
admin site interface.
References
----------
* `The Django admin site`_
.. _The Django admin site:
https://docs.djangoproject.com/en/3.0/ref/contrib/admin/
"""
import datetime
import json
from typing import Union
from django.contrib im... |
from flask import Flask, request, redirect, send_file
from flask_cors import CORS, cross_origin
from werkzeug.contrib.fixers import ProxyFix
from utilities.getInfo import getData as GD
from dataCall import dataCall as DC
app = Flask(__name__)
CORS(app, support_credentials=True)
@app.route('/')
@cross_origin(support... |
import itertools
from typing import Tuple, Union, List, Callable
import numpy as np
from numpy.linalg import LinAlgError
from onpolicy.envs.highway.highway_env.road.lane import AbstractLane
from onpolicy.envs.highway.highway_env.types import Vector, Matrix, Interval
def intervals_product(a: Interval, b: Interval) -... |
# ===================================================================================================
# _ __ _ _
# | |/ /__ _| | |_ _ _ _ _ __ _
# | ' </ _` | | _| || | '_/ _` |
# |_|\_\__,_|_|\__|\_,_|_| \__,_|
... |
# -*- coding: utf-8 -*-
# Tests ported from tests/test_models.py and tests/test_user.py
import os
import json
import datetime as dt
from future.moves.urllib.parse import urlparse, urljoin, parse_qs
from django.db import connection, transaction
from django.contrib.auth.models import Group
from django.test.utils import ... |
import os.path
from nltk.tokenize import word_tokenize
from nltk.corpus import stopwords
import string
from lxml import etree
import lxml.html
import requests
import json
import pandas as pd
from nltk import tokenize
from operator import itemgetter
import math
import nltk
from random import randint
from time import sle... |
"""字体图标解析库"""
from json import load, dump
from logging import getLogger
from PIL import Image, ImageFont, ImageDraw
from aip import AipOcr
from fontTools.ttLib.ttFont import TTFont
logger = getLogger('lazy_spider')
class FontMappingBase:
# 映射表
def __init__(self):
self.real_font_mapping: dict = {}
... |
from .operator import UnaryOperator, BinaryOperator
from ..symbolic import concretizable, is_concrete_like, do_evaluate
from ..smt.constraint import Constraint
from ..smt import backend
#==================================================================================================
#
# NON-CONCRETIZABLE TYPES
#
#-... |
"""Tests for distutils.file_util."""
import unittest
import os
import errno
from unittest.mock import patch
from distutils.file_util import move_file, copy_file
from distutils import log
from distutils.tests import support
from distutils.errors import DistutilsFileError
from test.support import run_unittest
class Fil... |
# Copyright (c) 2021 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 ... |
from Edge import Edge
class Node:
def __init__(self, u, category="非终止状态"):
"""
brief: 初始化
param self.u: 结点编号
param self.category: 结点的类型: 可能的取值为: "非终止状态", "终止状态"
param self.Edges: 以 u 为起点的所有的边
"""
self.u = u
self.category = category
self.Edges... |
from flask import Flask
app = Flask(__name__)
@app.route("/")
def hello():
return "Hello World!"
@app.route("/test")
def helloXYZ():
return "Hello, TestXXXXX!"
|
#!/usr/bin/env python
from __future__ import print_function
from __future__ import division
import sys
import time
import numpy as np
import gflags as flags
from rst_evaluation import const2rst, evaltrees, compare_disc_constituency
from tree import Tree
sys.setrecursionlimit(20000)
FLAGS = flags.FLAGS
flags.DEFI... |
#
# PySNMP MIB module Wellfleet-OSPF-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/Wellfleet-OSPF-MIB
# Produced by pysmi-0.3.4 at Wed May 1 15:41:14 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, ... |
#!/usr/bin/env python
# python 2 only, adjust path (or port, I'd love you) as needed
# run @ --help for (a little) more information
# MIT licensed.
"""\
primarily a python eval command. auto-formats the result of your expression:
(> indicates the line contains user input)
> $ @ '1'
1
> $ @ '1 + 1'
2
> $ ... |
import numpy as np
from lenstronomy.LensModel.Profiles.spp import SPP
from lenstronomy.LensModel.Profiles.base_profile import LensProfileBase
class CurvedArc(LensProfileBase):
"""
lens model that describes a section of a highly magnified deflector region.
The parameterization is chosen to describe local o... |
# 为了 Python2 玩家们
from __future__ import print_function, division
# 第三方
import tensorflow as tf
from sklearn.metrics import confusion_matrix
import numpy as np
# 我们自己
import load
train_samples, train_labels = load._train_samples, load._train_labels
test_samples, test_labels = load._test_samples, load._test_labels
p... |
# coding=utf-8
PARTNERS_PRICE = """
{
"prices": [
{
"currency_code": "USD",
"display_name": "POOL",
"distance": 10.93,
"duration": 1320,
"estimate": "$13-17",
"high_estimate": 18,
"localized_display_name": "POOL",
... |
# Generated by Django 3.0.1 on 2019-12-22 07:37
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('tasks', '0005_auto_20191219_1610'),
]
operations = [
migrations.AlterField(
model_name='answer',
name='message',
... |
import os
import numpy as np
import pandas as pd
from pandas_datareader.data import DataReader
import requests
from zipline.utils.cli import maybe_show_progress
from .core import register
def _cachpath(symbol, type_):
return '-'.join((symbol.replace(os.path.sep, '_'), type_))
def yahoo_equities(symbols, start... |
#!/usr/bin/python
"""
(C) Copyright 2018-2022 Intel Corporation.
SPDX-License-Identifier: BSD-2-Clause-Patent
"""
from avocado.core.exceptions import TestFail
from ior_test_base import IorTestBase
from telemetry_test_base import TestWithTelemetry
from telemetry_utils import TelemetryUtils
class TestWithTelemetry... |
import socket
import time
from settings import HOST, PORT, IDENT, CHANNEL
from oauth import PASS
def openSocket():
s = socket.socket()
s.connect((HOST, PORT))
s.send(bytes("PASS " + PASS + "\r\n", "UTF-8"))
s.send(bytes("NICK " + IDENT + "\r\n", "UTF-8"))
s.send(bytes("JOIN #" + CHANNEL +"\r\n", "UTF-8"))
retu... |
# -*- coding: utf-8 -*-
"""
Created on Fri Apr 19 17:30:52 2019
reference: https://blog.csdn.net/qq_32799915/article/details/85704240
@author: Xingguang Zhang
"""
import os
import numpy as np
import cv2
def cal_for_frames(video_path):
cap = cv2.VideoCapture(video_path)
i = 0
flow = []
wh... |
#!/usr/bin/env python
# -*- coding: utf-8 -*- #
from __future__ import unicode_literals
AUTHOR = u'Amjith'
SITENAME = u'pgcli'
SITEURL = 'https://www.pgcli.com'
PATH = 'content'
TIMEZONE = 'America/Los_Angeles'
DEFAULT_LANG = u'en'
# Feed generation is usually not desired when developing
FEED_ALL_ATOM = 'feeds/all... |
""" PSRCat survey """
import pdb
import numpy as np
from astropy.table import Table
from astropy.coordinates import SkyCoord
from astropy import units
try:
from pulsars import io as pio
except ImportError:
print("Warning: You need FRB/pulsars installed to use PSRCat")
from frb.surveys import surveycoord
f... |
"""
Azure (ARM) Resource Execution Module
.. versionadded:: 2019.2.0
:maintainer: <devops@decisionlab.io>, <devops@l2web.ca>
:maturity: new
:depends:
* `azure-core <https://pypi.python.org/pypi/azure-core>`_ >= 1.15.0
* `azure-batch <https://pypi.python.org/pypi/azure-batch>`_ >= 10.0.0
* `azure-identity ... |
import graphene
from django.contrib.auth import get_user_model, models as auth_models
from graphene import relay
from graphene_federation import key
from ...account import models
from ...checkout.utils import get_user_checkout
from ...core.exceptions import PermissionDenied
from ...core.permissions import AccountPermi... |
# Copyright Yi-Si.Lu (luyisi1982@gmail.com)
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to ... |
from typing import Dict
from ...error import GraphQLError
from ...language import NameNode, FragmentDefinitionNode
from . import ASTValidationContext, ASTValidationRule
__all__ = ["UniqueFragmentNamesRule", "duplicate_fragment_name_message"]
def duplicate_fragment_name_message(frag_name: str) -> str:
return f"T... |
# Importing the libraries
import datetime
import hashlib
import json
from flask import Flask, jsonify
# Part 1 - Building a Blockchain
class Blockchain:
def __init__(self):
self.chain = []
self.create_block(proof = 1, previous_hash = '0')
def create_block(self, proof, previous_hash):
... |
# -*- coding: utf-8 -*-
'''
Created on 2015-08-21
@author: xhj
'''
from mongoengine.connection import connect
from config_operation import DB_HOST, DB_PORT, DBNAME
from mongoengine.document import Document
from mongoengine.fields import StringField
import sys
reload(sys)
sys.setdefaultencoding('utf8')
cla... |
# -*- encoding:utf-8 -*-
"""
==================================
Input and output (:mod:`scipy.io`)
==================================
.. currentmodule:: scipy.io
SciPy has many modules, classes, and functions available to read data
from and write data to a variety of file formats.
.. seealso:: :ref:`numpy... |
from collections import OrderedDict
import re
import abc
from datetime import datetime
from babel.dates import format_date
from mangrove.data_cleaner import TelephoneNumber
from mangrove.errors.MangroveException import AnswerTooBigException, AnswerTooSmallException, AnswerWrongType, \
IncorrectDate, AnswerTooLongE... |
# Generated by Django 2.1.2 on 2018-12-02 15:10
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('Camelot', '0004_counter_counter'),
]
operations = [
migrations.CreateModel(
name='Liuyan',
fields=[
... |
#-*- coding: utf-8 -*-
from django import forms
from django.utils.translation import ugettext as _
from filer import settings as filer_settings
from filer.admin.fileadmin import FileAdmin
from filer.models import Image
class ImageAdminForm(forms.ModelForm):
subject_location = forms.CharField(
max_length=6... |
import pytest
from django.contrib.auth.models import AnonymousUser
from django.http.response import Http404
from django.test import RequestFactory
from proposal_recommender.users.models import User
from proposal_recommender.users.tests.factories import UserFactory
from proposal_recommender.users.views import (
Use... |
# Copyright 2009-2015 MongoDB, 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 writin... |
from atlabs.sms import Sms
header = {
"base_url": "https://sandboxapi.fsi.ng",
"Sandbox-Key": "your-sandbox-key-here",
"Content-Type": "application/json"
}
body = {
"to": "+2348123456789",
"from": "FSI",
"message": "Hello world!",
"keyword": "innovation-sandbox",
"linkId": "d",
"re... |
# -*- coding: utf-8 -*-
# Python 3.6
# Python_networking | ip_validation
# 07.07.2017 Tomasz Wisniewski
import re
import unittest
def validate_ip(ip):
"""
IP address validation,
:return 1 if IP is correct , else returns 0
"""
ipregex = re.compile(
"^([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4... |
"""
To understand why this file is here, please read:
http://cookiecutter-django.readthedocs.org/en/latest/faq.html#why-is-there-a-django-contrib-sites-directory-in-cookiecutter-django
"""
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.conf import settings
from django.db import migration... |
from setuptools import setup, find_packages
with open('requirements.txt') as f:
install_requires = f.read().strip().split('\n')
# get version from __version__ variable in gia_events/__init__.py
from gia_events import __version__ as version
setup(
name='gia_events',
version=version,
description='Event Management'... |
from django.core.urlresolvers import reverse_lazy
from django.db.models import Count, Avg
from django.http import Http404
from shared.utils import *
from bombquiz.models import *
from bombquiz.forms import *
from mcbv.base import TemplateView
from mcbv.edit import CreateView, FormView
seconds = 30
lose_questio... |
import unittest
import torch as t
from SPIKERR.encode import poisson_encode
arbitrary_seed = 333
t.manual_seed(arbitrary_seed)
t.backends.cudnn.deterministic = True
t.backends.cudnn.benchmark = False
class TestEncode(unittest.TestCase):
def test_poisson_encode(self):
example = t.empty(3, 3).uniform_(0, 1... |
#!/usr/bin/python
print("\x1B[2J");
print("\x1B[6;5mtest")
|
# Copyright 2020 Petuum. All Rights Reserved.
#
# It includes the derived work based on:
# https://github.com/tensorflow/tensorflow
# Copyright 2019 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 ... |
def import_object(name, current_module=None):
"""
Import an object at "dotted path".
>>> from importlib import import_module
>>> import_object('importlib.import_module') is import_module
True
Any object such as package, module, sub-module, function and class
can be imported:
>>> impor... |
# Standard Library imports
# Core Django imports
from django.test import TestCase
# Third-party imports
from rest_framework.test import APIRequestFactory
import rest_framework_jwt.views
# App imports
from app.views import account_management_views
from utils.test_utils import *
class LoginTestCase(TestCase):
d... |
import math
import time, sys
t0 = time.time()
def gcd(a, b):
if a % b == 0:
return b
return gcd(b, a % b)
def SieveOfEratosthenes(n): # For finding primes
primes = [True] * (n + 1)
primes[0] = primes[1] = False
for i in range(2, int(math.sqrt(n)+1)):
if primes[i]:
k = i... |
#!/usr/bin/env python3
import subprocess
import os
from os import path
from pathlib import Path
class Compile():
"""Compile class for compiling code and returning output
Attributes:
code (string): code to be compiled
lang (string): programming language used
input (string): user i... |
#!/usr/bin/env python3
''' Fujitsu MB81C71 - CMOS 64K-Bit High-Speed SRAM '''
from Chipdesc.chip import Chip
class MB81C71(Chip):
''' Fujitsu MB81C71 - CMOS 64K-Bit High-Speed SRAM '''
symbol_name = "64KX1"
checked = "IOC 0040"
symbol = '''
+------+
1| |14
-->+A0 A8+<--
2| |15
... |
from dataclasses import dataclass
from typing import Optional
from mashumaro import DataClassDictMixin
from mashumaro.config import (
TO_DICT_ADD_BY_ALIAS_FLAG,
TO_DICT_ADD_OMIT_NONE_FLAG,
BaseConfig,
)
@dataclass
class A(DataClassDictMixin):
x: Optional[int] = None
class Config(BaseConfig):
... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import copy
import os
import logging
import pickle
try:
import sigopt as sgo
except ImportError:
sgo = None
from ray.tune.suggest.suggestion import SuggestionAlgorithm
logger = logging.getLogger(__nam... |
from django.contrib.auth.models import User
from django.db import models
from users.models import Profile
class Post(models.Model):
user = models.ForeignKey(User, on_delete=models.CASCADE)
profile = models.ForeignKey(Profile, on_delete=models.CASCADE)
title = models.CharField(max_length=255)
... |
# Django imports
from django.shortcuts import render, redirect
from django.http import HttpResponse
from django.conf import settings # Access to project settings
from django.contrib.auth.models import User
from django.contrib.auth import authenticate
from django.contrib.auth import login as django_login # To distingu... |
def run():
from terminaltables import SingleTable
from pyfiglet import Figlet
banner = """ BabySploit is a framework aimed at helping aspiring
penetration testers learn how to use the most common and
useful tools in the field. Below is a table displaying
what commands are available and wh... |
from .base import * # noqa
from .base import env
# GENERAL
# ------------------------------------------------------------------------------
# https://docs.djangoproject.com/en/dev/ref/settings/#debug
DEBUG = True
# https://docs.djangoproject.com/en/dev/ref/settings/#secret-key
SECRET_KEY = env(
"DJANGO_SECRET_KEY... |
from .transforms import *
from .enhance import *
from . import functional |
###########################################################################
# MIT License
#
# Copyright (c) 2020 Matthew Sottile
#
# 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 rest... |
import aoc_utils
import itertools
import functools
import operator
import networkx
import math
from collections import *
from copy import deepcopy
import random
import re
import time
lines = aoc_utils.readlines()
density = defaultdict(int)
for line in lines:
a, b = line.split(" -> ")
a = list(map(int, (a.split(... |
import numpy as np
from pyhdx.fileIO import csv_to_protein
from pyhdx.support import color_pymol, apply_cmap
from pymol import cmd
from functions.base import *
from functions.formatting import *
from functions.pymol import *
from functions.logging import write_log
write_log(__file__)
output_dir = current_dir / 'fi... |
"""
Created on Tue Sep 15 2018
@author: Supratim Haldar
"""
import pandas as pd
import numpy as np
from scipy import optimize
from scipy.optimize import fmin_bfgs
import matplotlib.pyplot as pyplot
import logisticRegression
import time
import imageio
# Load training data
def loadTrainingData(path):
train_data = p... |
from hashlib import sha256
import json
class Block:
def __init__(self, index, transactions, timestamp, previous_hash, nonce=0):
self.index = index
self.transactions = transactions
self.timestamp = timestamp
self.previous_hash = previous_hash
self.nonce = nonce
def comp... |
"""bienestaruesunstable URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.9/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, name='hom... |
# -*- coding: utf-8 -*-
"""
werkzeug.wsgi
~~~~~~~~~~~~~
This module implements WSGI related helpers.
:copyright: (c) 2014 by the Werkzeug Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
import re
import os
import sys
import posixpath
import mimetypes
from itert... |
import configparser
import os
from pkg_resources import resource_string
from subprocess import run
from appdirs import user_data_dir
from geohealthaccess.exceptions import GrassNotFound
DATA_DIR = user_data_dir(appname="geoaccesshealth")
def default_config():
"""Get default configuration."""
return resour... |
# -*- coding: utf-8 -*-
#
# Configuration file for the Sphinx documentation builder.
#
# This file does only contain a selection of the most common options. For a
# full list see the documentation:
# http://www.sphinx-doc.org/en/master/config
# -- Path setup ------------------------------------------------------------... |
import os
import pickle
from time import strftime
def save(fname):
date = strftime('%Y-%m-%d') # 日期
amount = int(input('amount: ')) # 金额,float代替int可以有小数点
comment = input('comment: ') # 说明
# 从文件中取出全部的收支记录
with open(fname, 'rb') as fobj:
records = pickle.load(fobj)
balance = records[-1... |
__version__ = '0.2.2'
from .wizard.views.multipleformwizard import (
SessionMultipleFormWizardView, CookieMultipleFormWizardView,
NamedUrlSessionMultipleFormWizardView, NamedUrlCookieMultipleFormWizardView,
MultipleFormWizardView, NamedUrlMultipleFormWizardView)
from .wizard.views.wizardapi import WizardA... |
#!/usr/bin/env python3
import errno
import os
import socket
import subprocess
import time
import pytest
def openport(port):
# Find a usable port by iterating until there's an unconnectable port
while True:
try:
socket.create_connection(('localhost', port), 0.1)
port += 1
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.