text stringlengths 1 927k |
|---|
# coding=utf-8
# Copyright 2018 The Tensor2Tensor 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... |
"""Removing settings table
Revision ID: 2932df901655
Revises: 155c6ce689ed
Create Date: 2014-04-03 10:45:09.592592
"""
# revision identifiers, used by Alembic.
revision = '2932df901655'
down_revision = '155c6ce689ed'
from alembic import op
import sqlalchemy as sa
def upgrade():
op.drop_table('settings')
def... |
import argparse
import os
import sys
import io
import time
import json
from bson.json_util import dumps
import traceback
import confluent_kafka
from ast import literal_eval
import avro.schema
import fastavro
import subprocess
import datetime
import multiprocessing
# import threading
import pymongo
import pytz
from nu... |
from flask import Flask
from flask import render_template
app = Flask(__name__)
@app.route("/")
def index():
greeting = "Hello World"
return render_template("index.html", greeting=greeting)
if __name__ == "__main__":
app.run()
© 2018 GitHub, Inc. |
"""
Test utils module.
"""
import logging
from uwgroups.utils import reconcile, grouper
from .__init__ import TestBase
log = logging.getLogger(__name__)
class TestReconcile(TestBase):
def test01(self):
to_add, to_remove = reconcile(
current=set(),
desired=set())
self.as... |
# -*- coding: utf-8 -*-
"""
Created on Fri Jul 16 08:10:35 2021
@author: RAGHAV ATREYA
"""
# -StartPython.py *- coding: utf-8 -*-
"""
Spyder Editor
#%% starts a new cell. Use second green triangle to run just the cell that
your mouse has last clicked in (or Ctrl-Enter on a PC or Command-Return on a
Macintosh or Menu>... |
# Copyright 2018 The Cirq Developers
#
# 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in ... |
"""
Copyright (c) 2020 The Orbit Authors. All rights reserved.
Use of this source code is governed by a BSD-style license that can be
found in the LICENSE file.
"""
import logging
import time
import pywinauto
from pywinauto.application import Application
def wait_for_orbit():
"""Waits for Orbit to start up."""
... |
from find_the_odd_int import find_it
class TestFindIt:
def test_0(self):
assert find_it([20,1,-1,2,-2,3,3,5,5,1,2,4,20,4,-1,-2,5]) == 5
def test_1(self):
assert find_it([1,1,2,-2,5,2,4,4,-1,-2,5]) == -1
def test_2(self):
assert find_it([20,1,1,2,2,3,3,5,5,4,20,4,5]) == 5
def... |
# from django.shortcuts import render
from rest_framework import generics
from .models import Post
from .permissions import IsAuthororReadOnly
from .serializers import PostSerializer
class PostList(generics.ListCreateAPIView):
queryset = Post.objects.all()
serializer_class = PostSerializer
class PostDetail(g... |
from custom_user.serializers import RelatedFieldAlternative
from rest_framework import serializers
from .models import Appointment
from visiting_schedule.models import VisitingSchedule
from patient.models import Patient
from visiting_schedule.serializers import VisitingScheduleSerializer
from patient.serializers import... |
import kivy
kivy.require('1.9.0')
from kivy.app import App
from kivy.properties import ObjectProperty, StringProperty
from kivy.uix.listview import ListItemButton
from kivy.uix.boxlayout import BoxLayout
from kivy.uix.screenmanager import ScreenManager, Screen
temp_x= "temp"
temp_y= "temp"
class PlantListButton(List... |
import os
import fnmatch
import sys
from tkinter import *
from idlelib import SearchEngine
from idlelib.SearchDialogBase import SearchDialogBase
def grep(text, io=None, flist=None):
root = text._root()
engine = SearchEngine.get(root)
if not hasattr(engine, "_grepdialog"):
engine._grepdialog = GrepD... |
# -*- coding: utf-8 -*-
from ..tre_elements import TREExtension, TREElement
__classification__ = "UNCLASSIFIED"
__author__ = "Thomas McCullough"
class OBJ(TREElement):
def __init__(self, value):
super(OBJ, self).__init__()
self.add_field('OBJ_TY', 's', 20, value)
self.add_field('OBJ_NM',... |
# coding: utf-8
"""
InsightVM API
OpenAPI spec version: 3
Contact: support@rapid7.com
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
import unittest
import swagger_client
from swagger_client.models.scan_template_service_discovery_tcp im... |
#! python3
# randomQuizGenerator.py - Creates quizzes with questions and answers in
# random order, along with the answer key.
from pathlib import Path
import random
# The quiz data. Keys are states and values are their capitals
capitals = {'Alabama': 'Montgomery', 'Alaska': 'Juneau', 'Arizona': 'Phoenix',
... |
# encoding: utf-8
# module gi._gi
# from /usr/lib/python3/dist-packages/gi/_gi.cpython-35m-x86_64-linux-gnu.so
# by generator 1.145
# no doc
# imports
import _gobject as _gobject # <module '_gobject'>
import _glib as _glib # <module '_glib'>
import gi as __gi
import gobject as __gobject
class RegisteredTypeInfo(__gi... |
######## Image Object Detection Using Tensorflow-trained Classifier #########
#
# Author: Evan Juras
# Date: 1/15/18
# Description:
# This program uses a TensorFlow-trained neural network to perform object detection.
# It loads the classifier and uses it to perform object detection on an image.
# It draws boxes, score... |
from sanic import Blueprint
from sanic.response import json
from sanic_openapi import doc
from ..model.database import User
from ..service.auth_helper import Auth
from ..util.dto import AuthDto, json_response
from ..util.response import response_message, USER_NOT_EXIST, SUCCESS
user_auth = AuthDto.user_auth
bp = Blu... |
# 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... |
"""
To understand why this file is here, please read:
http://cookiecutter-django.readthedocs.io/en/latest/faq.html#why-is-there-a-django-contrib-sites-directory-in-cookiecutter-django
"""
from django.conf import settings
from django.db import migrations
def update_site_forward(apps, schema_editor):
"""Set site d... |
from synapse.api.errors import Codes, LoginError, SynapseError
from synapse.api.ratelimiting import Ratelimiter
from synapse.http.server import finish_request
from synapse.http.servlet import (
RestServlet,
parse_json_object_from_request,
parse_string,
)
from synapse.http.site import SynapseRequest
from syn... |
from singletask_sql.tests import DBTestCase
from sqlalchemy import orm
from sqlalchemy import func
from singletask_sql.tables import TasksTable
from singletask_sql.tables.utils import query as query_utils
# https://docs.sqlalchemy.org/en/14/orm/query.html
def create_task(description):
task = TasksTable()
ta... |
#!/usr/bin/env python3
'''This takes an input .dat file name and an output file name as parameters.
If no output file name is supplied, it will have the same name as the .dat file except it will be .csv.
The input file is assumed to be in the Linux Ftrace .dat format.
This program reads the input file and converts i... |
#!/usr/bin/env python3
# Copyright (c) 2019-2020 The Widecoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test the importdescriptors RPC.
Test importdescriptors by generating keys on node0, importing the cor... |
'''
REVERSE A LINKED LIST
Reverse a singly linked list.
'''
# Recursive Solution, Time Complexity: O(N) ; Space Complexity: O(N) (Stack)
def reverseList(head: ListNode) -> ListNode:
return self.reverse(head, None)
def reverse(node: ListNode, prev: ListNode) -> ListNode:
if not node:
return ... |
"""
Experiment specifications:
an experiment is defined by train,test dataset pair,
each dataset is loaded from graphical_models/datasets.
Authors: kkorovin@cs.cmu.edu
"""
import os
import numpy as np
from graphical_models import BinaryMRF
from inference import get_algorithm
from graphical_models.data_gen import st... |
import numpy as np
import pytest
from sklearn_quantile.utils import weighted_quantile
from numpy.testing import assert_equal
from numpy.testing import assert_array_almost_equal
from numpy.testing import assert_almost_equal
from numpy.testing import assert_raises
def test_quantile_equal_weights():
rng = np.rando... |
import os
import re
import warnings
import copy
import shutil
import subprocess
import numpy as np
import sysconfig
from collections import OrderedDict
from yggdrasil import platform, tools
from yggdrasil.drivers.CompiledModelDriver import (
CompiledModelDriver, CompilerBase, ArchiverBase)
from yggdrasil.metaschema... |
# coding=utf-8
# Copyright 2020-present the HuggingFace Inc. team.
#
# 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 ap... |
#Aula 95 - Exemplo de desempacotamento
lista = [11, 10, 12]
tupla = 11, 10, 12
def func(a, b, c):
print(a)
print(b)
print(c)
print(30*'-')
lista.sort()
func(*lista)
l = [*tupla] #Ou l = list(tupla)
l.sort()
func(*l)
func(**dict(zip(("b", "a", "c"), tupla))) |
from .utils.const import * |
"""
Example of Pymunk Physics Engine Platformer
"""
import math
from typing import Optional
import arcade
SCREEN_TITLE = "PyMunk Platformer"
# How big are our image tiles?
SPRITE_IMAGE_SIZE = 128
# Scale sprites up or down
SPRITE_SCALING_PLAYER = 0.5
SPRITE_SCALING_TILES = 0.5
# Scaled sprite size for tiles
SPRITE_... |
"""
Copyright (c) 2016-2019 Keith Sterling http://www.keithsterling.com
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
documentation files (the "Software"), to deal in the Software without restriction, including without limitation
the rights to use, copy, m... |
import dash
from dash import html
from dash import dcc
import dash_bootstrap_components as dbc
from dash.dependencies import Input, Output
from server import app
from views.db_connect import db_conn_page
from views.data_general_situation import data_general_situation_page
from views.data_overall import data_overall_p... |
import pyaf.tests.model_control.test_ozone_custom_models_enabled as testmod
testmod.build_model( ['Difference'] , ['ConstantTrend'] , ['Seasonal_Hour'] , ['ARX'] ); |
import torch.nn as nn
from models import *
import torch
import gc
def get_model(nfeat, args):
if args.model == "gcn":
model = GCN_Body(nfeat,args.num_hidden,args.dropout)
elif args.model == "gat":
heads = ([args.num_heads] * args.num_layers) + [args.num_out_heads]
model = GAT_body(args... |
#HillClimbing과 Problem에 사용되는 부모 클래스 Setup 정의
class Setup:
# delta, alpha, dx... 와 같은 설정들 initializing.
def __init__(self) -> None:
self._delta = 0
self._alpha = 0
self._dx = 0
self._numRestart = 0
self._numSample = 0
self._numExp = 0 |
'''This module defines all instructions.'''
from collections import namedtuple
from tokens import PUSH, DUP, SWAP, POP, ADD, SUB, MUL, DIV, MOD, MARK, JUMP, \
JUMP_Z, JUMP_N, EXIT, CALL, END, STORE, LOAD, OUTC, OUTI, INC, INI
Ins = namedtuple('Ins', 'opcode param_type token')
class ParamTypes:
INTEGER = 'si... |
import os
from setuptools import setup, find_packages
here = os.path.abspath(os.path.dirname(__file__))
with open(os.path.join(here, 'README.txt')) as f:
README = f.read()
with open(os.path.join(here, 'CHANGES.txt')) as f:
CHANGES = f.read()
requires = [
'plaster_pastedeploy',
'pyramid >= 1.9a',
... |
from .util import *
from .nlp import * |
# coding=utf-8
from django.db import models
from django.db.models import Count, Max, Q, Sum, Case, When, IntegerField, Value, OuterRef, Subquery
from django.db.models import F
from django.utils import timezone
from dateutil.relativedelta import relativedelta
from django.utils.translation import ugettext_lazy as _
from ... |
# Copyright 2020 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... |
from distutils.core import setup
import setuptools
with open("README.md", "r") as fh:
long_description = fh.read()
setup(
name='linelength_event_detector',
version='0.1.0',
author='Emma D\'Esopo',
author_email='emma.d\'esopo@ucsf.edu',
description='Tool for detecting spikes in EEG data usi... |
from flask import Flask, request, Response
from flask_restx import Resource, Api, fields
from flask import abort, jsonify
from flask_cors import CORS
app = Flask(__name__)
CORS(app)
api = Api(app)
ns_movies = api.namespace('ns_movies', description='Movies APIs')
movie_data = api.model(
'Movie Data',
{
... |
"""score_bidaf.py
Scoring script for use with the Bi-directional Attention Flow model from the ONNX model zoo.
https://github.com/onnx/models/tree/master/text/machine_comprehension/bidirectional_attention_flow
"""
import json
import nltk
import numpy as np
import os
from nltk import word_tokenize
from utils import g... |
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
import time
driver = webdriver.Chrome(executable_path="E:/SQA/chromedriver_win32/chromedriver.exe")
driver.get("https://fs2.formsite.com/meherpavan/form2/index.html?1537702596407")
textBoxes = driver.find_elements_by_class_name("text_fiel... |
#!/usr/bin/env python
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# ---------------------------------------------... |
# -*- coding: utf-8 -*-
from django.db import models
from django.conf import settings
from django.utils.translation import ugettext_lazy as _
from .base_models import IcebergBaseModel
WEBHOOK_MAX_TRIGGER_AGGREGATION = getattr(settings, 'WEBHOOK_MAX_TRIGGER_AGGREGATION', 200)
WEBHOOK_DEFAULT_AGGREGATION_DELAY = getatt... |
#!/usr/bin/env python3
# Copyright (c) 2014-2016 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
from test_framework.test_framework import BitcoinTestFramework
from test_framework.util import *
def ge... |
from collections import Counter
a = input().strip()
W = 25
H = 6
def get_layers(a, w, h):
total = w * h
layers = []
for i, v in enumerate(a):
if i == 0 or i % total == 0:
layers.append(list())
layers[-1].append(int(v))
return layers
def part1(a, w, h):
layers = get_l... |
#from .version import __version__, short_version
__version__ = '0.2.0+802fbf2'
short_version = '0.2.0'
__all__ = ['__version__', 'short_version'] |
import hiicart.gateway.amazon.views
from django.conf.urls.defaults import *
urlpatterns = patterns('',
(r'cbui/?$', 'hiicart.gateway.amazon.views.cbui'),
(r'ipn/?$', 'hiicart.gateway.amazon.views.ipn'),
) |
import sys
from collections import deque
def BFS():
queue = deque()
queue.append((0,0,1,False))
visited = [[[0]*2 for _ in range(m)]for _ in range(n)]
visited[0][0][0] = 1
while queue:
x,y,d,b = queue.popleft()
if x== n-1 and y == m-1:
return d
if 0<=x+1<n and ro... |
VERBOSE=None |
# Copyright (c) Yiming Wang
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import importlib
import os
# automatically import any Python files in the optim/lr_scheduler/ directory
for file in os.listdir(os.path.dirname(__file__)):
if n... |
# Copyright 2018 Amazon.com, Inc. or its affiliates. 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.
# A copy of the License is located at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# or in the "license... |
import argparse, sys, os, os.path as op, json, subprocess
import numpy as np
import open3d as o3d
import plotly.graph_objects as go
PATH = 'D:\\edu\\UniBonn\\Study\\thesis\\codes\\NSVF\\'
# PATH2MODEL = 'D:\\edu\\UniBonn\\Study\\thesis\\codes\\blender\\projects\\brdf_sphere\\brdf_sphere.ply'
plotData = []
light_sta... |
# Copyright (c) 2018 Intel Corporation
#
# 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... |
#!/usr/bin/env python3
# Copyright 2013-2021 Aerospike, 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... |
#!/usr/bin/env python
#
# Execute with sudo python arppoison.py
#
# ARP Poisoning Script for testing defendARP.py and defendARP.bat
#
import time
import sys
from scapy.all import *
from optparse import OptionParser
def main(argv):
# Create option parser
parser = OptionParser()
# Define options
parser.add_option("-... |
import threading
from django.conf import settings
from corehq.apps.tzmigration.exceptions import TimezoneMigrationProgressError
from corehq.util.quickcache import skippable_quickcache
from corehq.util.soft_assert import soft_assert
from corehq.util.view_utils import get_request
from models import TimezoneMigrationProgr... |
import random
import base64
import io
import nacl.public
import lightnion as lnn
def circuit(state, descriptor):
onion_key = base64.b64decode(descriptor['ntor-onion-key'] + '====')
eidentity = descriptor['identity']['master-key'] # (assuming ed25519 here)
identity = base64.b64decode(descriptor['router'][... |
#!/bin/env python
#Copyright ReportLab Europe Ltd. 2000-2017
#see license.txt for license details
#history https://hg.reportlab.com/hg-public/reportlab/log/tip/tools/docco/rl_doc_utils.py
__version__='3.3.0'
__doc__ = """
This module contains utilities for generating guides
"""
import os, sys, glob
import string
from... |
import requests
import hashlib
from six.moves.urllib_parse import quote_plus, parse_qs
class HashMismatchException(Exception):
"""
Exception thrown when hash from Paynow does not match locally generated hash
"""
def __init__(self, message):
super(HashMismatchException, self).__init__(message)
... |
#!/usr/bin/env python
# -*- mode: python; encoding: utf-8 -*-
"""Tests for grr.parsers.windows_registry_parser."""
from __future__ import absolute_import
from __future__ import unicode_literals
from grr_response_core.lib import flags
from grr_response_core.lib import utils
from grr_response_core.lib.parsers import wi... |
# https://www.hackerrank.com/challenges/diagonal-difference/problem
#!/bin/python3
import math
import os
import random
import re
import sys
#
# Complete the 'diagonalDifference' function below.
#
# The function is expected to return an INTEGER.
# The function accepts 2D_INTEGER_ARRAY arr as parameter.
#
def diagona... |
# Copyright 2013-2019 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 PyNbformat(PythonPackage):
"""The Jupyter Notebook format"""
homepage = "https://gith... |
"""variants_process main command."""
import timeit
import re
from datetime import datetime
from os.path import join
import pandas as pd
import numpy as np
import pybedtools as pyb
START = timeit.default_timer()
## IMPORT VARIANTS FILE
def import_variants(path):
"""
Determine filetype and import, returns pand... |
from gtagora.models.base import BaseModel
class Breadcrumb(BaseModel):
pass |
# -*- coding: utf-8 -*-
import requests
import json
def get_test_plan(swagger_url=None, swagger_url_json_path=None):
global data
if swagger_url is None:
try:
with open(swagger_url_json_path, 'r', encoding='utf-8') as f:
data = json.load(f, strict=False)
except Type... |
# -*- coding: utf-8 -*-
"""
Calculate the difference between two dictionaries as:
(1) items added
(2) items removed
(3) keys same in both but changed values
(4) keys same in both and unchanged values
Originally posted at http://stackoverflow.com/questions/1165352/fast-comparison-between-two-python-d... |
################################################################################
# Copyright (c) 2011-2021, National Research Foundation (SARAO)
#
# Licensed under the BSD 3-Clause License (the "License"); you may not use
# this file except in compliance with the License. You may obtain a copy
# of the License at
#
# ... |
# https://docs.scrapy.org/en/latest/topics/items.html
import scrapy
class Item(scrapy.Item):
file_name = scrapy.Field()
url = scrapy.Field()
validate = True
class File(Item):
data = scrapy.Field()
data_type = scrapy.Field()
# Added by the FilesStore extension, for the KingfisherProcessAPI ... |
from argparse import _HelpAction, _SubParsersAction
import re
class NavigationException(Exception):
pass
def parser_navigate(parser_result, path, current_path=None):
if isinstance(path, str):
if path == '':
return parser_result
path = re.split(r'\s+', path)
current_path = cur... |
# Copyright 2010-2014, Google Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and ... |
#!/usr/bin/env python
import os
import sys
if __name__ == '__main__':
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'Houses.settings')
try:
from django.core.management import execute_from_command_line
except ImportError as exc:
raise ImportError(
"Couldn't import Django. Are y... |
"""Delay line linearity characterization
Friedrich Schotte, Jul 22, 2015 - Jul 23, 2015
Setup:
Ramsay-100B RF Generator, 351.93398 MHz +10 dBm -> FPGA RF IN
FPGA 1: X-scope trig -> CH1, DC50, 500 mV/div
FPGA 13: ps L oscill -> DC block -> 90-MHz low-pass -> CH2, DC50, 500 mV/div
Timebase 5 ns/div
Measurement P1 CH2, ti... |
from django.contrib import admin
from . import tasks
from .app_settings import FREIGHT_DEVELOPER_MODE
from .models import (
Contract,
ContractCustomerNotification,
ContractHandler,
EveEntity,
Location,
Pricing,
)
from .tasks import update_locations
@admin.register(Location)
class LocationAdmi... |
from cortado.abstractfactor import AbstractFactor
import numpy as np
from cortado.seq import Seq
from cortado.funcslicer import FuncSlicer
from cortado.consts import HEADLENGTH, SLICELEN, MISSINGLEVEL
from numba import jit
from numba.typed import Dict
from numba import types
@jit(nopython=True, cache=False)
def g_left... |
from oosc.absence.models import Absence
from rest_framework import serializers
from oosc.students.serializers import SimpleStudentSerializer
from datetime import datetime
class AbsenceSerializer(serializers.ModelSerializer):
class Meta:
model=Absence
fields=('id','student','_class','reasons','date_... |
# coding: utf-8
"""
UltraCart Rest API V2
UltraCart REST API Version 2 # noqa: E501
OpenAPI spec version: 2.0.0
Contact: support@ultracart.com
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
import pprint
import re # noqa: F401
import six
class Coupon(object):
"""N... |
import os
from setuptools import setup, find_packages
def parse_requirements(file):
return sorted(set(
line.partition('#')[0].strip()
for line in open(os.path.join(os.path.dirname(__file__), file))
) - set(''))
setup(
name='eo-flow',
python_requires='>=3.5',
version='1.1.0',
... |
# -*- coding: utf-8 -*-
"""
eve.utils
~~~~~~~~~
Utility functions and classes.
:copyright: (c) 2013 by Nicola Iarocci.
:license: BSD, see LICENSE for more details.
"""
import eve
import hashlib
from flask import request
from flask import current_app as app
from datetime import datetime, timedelt... |
# make deterministic
from mingpt.utils import set_seed
set_seed(42)
#frompc
import numpy as np
import torch
import torch.nn as nn
from torch.nn import functional as F
import math
from torch.utils.data import Dataset
from mingpt.model import *
from mingpt.trainer import Trainer, TrainerConfig
from mingpt.utils import... |
import pandas as pd
from sklearn.base import BaseEstimator, TransformerMixin
class OneHotEncoderTransformer(BaseEstimator, TransformerMixin):
def __init__(self, columns) -> None:
self.columns = columns
def fit(self, X, y=None):
return self
def transform(self, X, y=None):
X = pd.... |
from .calculate_coordinates import Particle
test = Particle(4, 6)
test_two = Particle(3, 8)
test_three = Particle(4, 6)
print(id(test))
print(id(test_three))
print(id(test_two)) |
import os
# This exercise is Part 1 of 4 of the birthday data exercise series.
# For this exercise, we will keep track of when our friend’s birthdays are, and be able to find that information based on their name.
# Create a dictionary (in your file) of names and birthdays.
# When you run your program it should ask th... |
# Generated by Django 3.0.5 on 2020-05-03 02:07
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('app_sme12', '0011_auto_20200502_0716'),
]
operations = [
migrations.CreateModel(
name='Authoriz... |
import os
import inspect
import networkx as nx
print("Run this script from the doc/ directory of the repository")
funcs = inspect.getmembers(nx, inspect.isfunction)
for n, f in funcs:
# print(n + ": "+str(f))
cmd = r"find . -name *\." + n + ".rst -print"
# print(cmd)
result = os.popen(cmd).read()
... |
#!/usr/bin/env python3
# Copyright (c) 2012-2015 Netforce Co. Ltd.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, co... |
# -*- coding: utf-8 -*-
#
# pietrack documentation build configuration file, created by
# sphinx-quickstart on Wed Jul 29 18:10:32 2015.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
# ... |
# Stress test for threads using AES encryption routines.
#
# AES was chosen because it is integer based and inplace so doesn't use the
# heap. It is therefore a good test of raw performance and correctness of the
# VM/runtime. It can be used to measure threading performance (concurrency is
# in principle possible) an... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# THIS FILE WAS GENERATED BY generate_classes.py - DO NOT EDIT #
# (Generated on 2019-09-11 10:14:02.142913) #
from .base_classes import BaseEvent
class SwitchScenes(BaseEvent):
"""
Indicates a scene change.
:Returns:
*scene_name*
type: S... |
from random import randint
from scraper import Scraper
from time import sleep
def main():
url = "https://www.idealista.com/alquiler-viviendas/santa-cruz-de-tenerife/centro-ifara/centro/"
a = Scraper(url)
for i in range(len(a.links)):
a.get_page()
print(len(a.links))
print(len(a.da... |
# Copyright (c) 2021 Graphcore Ltd. 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 applicable l... |
import hashlib
import json
import logging
import os
import shutil
import subprocess
import bs4
import util
def handle_iframe(iframe, soup):
allowed_domains = ["https://www.youtube.com/"]
illegal_domain = True
iframe_src = iframe.attrs["src"]
for domain in allowed_domains:
if iframe_src.start... |
import pytest
from src.geometry.line2d import standard_line
def test_standard_line_0():
# One point is not enough to form a line
for i in range(-10, 11):
for j in range(-10, 11):
A, B, C = standard_line(i, j, i, j)
assert A == 0 and B == 0 and C == 0
@pytest.mark.parametrize(... |
#
sector = [
"stock",
"fund"
]
keytab = {
"功能": [
"项目设置",
"重启",
"中止",
"数据处理",
"训练拆分",
"序列特征",
"数据运算",
"数据合并",
"数据复制",
"数据提取",
"训练拟合",
"数据预测",
"回测分析",
"图形展示",
],
"项目设置": {
"位置": "",... |
# -*- coding: utf-8 -*-
# This file is part of Viper - https://github.com/viper-framework/viper
# See the file 'LICENSE' for copying permission.
import os
import json
import tempfile
from viper.common.abstracts import Module
from viper.core.session import __sessions__
from .pdftools.pdfid import PDFiD, PDFiD2JSON
fr... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.