text stringlengths 2 999k |
|---|
from apphelpers.rest.hug import user_id
from app import signals
from app.models import RejectedComment, comment_actions, groups
from app.libs import pending_comment as pendingcommentlib
from app.libs import comment_action_log as commentactionloglib
from app.libs import comment as commentlib
def create(
id, c... |
from jsonrpc import ServiceProxy
access = ServiceProxy("http://127.0.0.1:14432")
pwd = raw_input("Enter old wallet passphrase: ")
pwd2 = raw_input("Enter new wallet passphrase: ")
access.walletpassphrasechange(pwd, pwd2)
|
from setuptools import setup
from python.bolo import version
setup(
name="{{cookiecutter.package_name}}",
version=version.get_git_version(),
author="",
author_email="",
url = "https://github.com/KIPAC/{{cookiecutter.repo_name}}",
package_dir={"":"python"},
packages=["{{cookiecutter.package... |
# Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0
# For details: https://github.com/nedbat/coveragepy/blob/master/NOTICE.txt
"""Core control stuff for coverage.py."""
import atexit
import contextlib
import os
import os.path
import platform
import sys
import time
from coverage import env... |
#!/usr/bin/env python
#
# Electrum - lightweight Bitgesell client
# Copyright (C) 2011 thomasv@gitorious
#
# 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 wit... |
# Lint as: python3
# Copyright 2020 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agr... |
# Language: Python
# Level: 8kyu
# Name of Problem: Surface Area And Volume of A Box
# Instructions: Write a function that returns the total surface area and volume of a box as an array: [area, volume]
# Solution:
def get_size(w, h, d):
area = (w * d + d * h + w * h) * 2
volume = w * h * d
return [area, ... |
from __future__ import unicode_literals
import colorama
import logging
logger = logging.getLogger(__name__)
def fix_subparsers(subparsers):
"""Workaround for bug in Python 3. See more info at:
https://bugs.python.org/issue16308
https://github.com/iterative/dvc/issues/769
Args:
... |
from abc import ABC, abstractmethod
from typing import Generic, TypeVar
T = TypeVar("T")
class Factory(ABC, Generic[T]):
"""Provides methods for creating, validating and releasing `T` objects and managed resources"""
@abstractmethod
def create(self) -> T:
"""Create a new `T` object and allocates... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# diaspy documentation build configuration file, created by
# sphinx-quickstart on Tue Jan 15 15:35:41 2013.
#
# 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
# autog... |
"""Auto-generated file, do not edit by hand. IN metadata"""
from ..phonemetadata import NumberFormat, PhoneNumberDesc, PhoneMetadata
PHONE_METADATA_IN = PhoneMetadata(id='IN', country_code=None, international_prefix=None,
general_desc=PhoneNumberDesc(national_number_pattern='[125]\\d{2,6}', possible_number_pattern... |
import time
from io import BytesIO
from json import JSONDecodeError
import json
import logging
from typing import Union, List
from lxml import etree
from lxml.etree import ParseError
import hashlib
from pydicom import dcmread
from pydicom.fileset import FileSet
from fhir.resources import construct_fhir_element as const... |
def anagram_easy(str1, str2):
str1 = str1.replace(' ', '').lower()
str2 = str2.replace(' ', '').lower()
return sorted(str1) == sorted(str2)
print(anagram_easy('Clint Eastwood', 'old west action'))
def anagram_medium(str1, str2):
str1 = str1.replace(' ', '').lower()
str2 = str2.replace(' ', '').lo... |
import Routines.TdlConsoleWrapper as CW
import GLOBAL_DATA.Level_Tile_Data as DATA
from Routines import SidavLOS as LOS
import tdl
DEBUG_RENDER_EVERYTHING = False
SINGLE_ARROW_MODE = False
NON_VISIBLE_TILE_COLOR = (32, 32, 64)
map_of_already_drawn_items = []
# def draw_whole_level_map(lvl): # seen tiles only
# C... |
from __future__ import division
from neupy.core.properties import IntProperty, NumberProperty
from .base import SingleStepConfigurable
__all__ = ('SearchThenConverge',)
class SearchThenConverge(SingleStepConfigurable):
"""
Algorithm decrease learning step after each epoch.
Parameters
----------
... |
from prettytable import PrettyTable
class StackTable(PrettyTable):
def __init__(self, multicloud_stack):
super().__init__()
self.field_names = ["Attribute", "Value"]
self.align["Attribute"] = "r"
self.align["Value"] = "l"
self.add_row(["Name", multicloud_stack.stack_name... |
from abc import ABC, abstractmethod
from metadata_extractor.connection.connection_abstract import RDBMSConnection
from metadata_extractor.builders.rdbms.rdbms_builder_abstract import RDBMSBuilder
from metadata_extractor.models.atlas_model.rdbms.database_schema import DatabaseSchema
from metadata_extractor.models.atlas_... |
from __future__ import annotations
import datetime
import os
import pickle
import numpy as np
import torch
from src.data_process import THCNewsDataProcessor, DataIterator, THCNewsFeaturesExtractor
from src.models.base_model import SequenceClassificationModel, BiLSTMSequenceClassificationModel
from src.schema import C... |
import os
import tensorflow as tf
tf.logging.set_verbosity(tf.logging.INFO)
file_path = os.path.dirname(__file__)
model_dir = os.path.join(file_path, 'chinese_L-12_H-768_A-12/')
config_name = os.path.join(model_dir, 'bert_config.json')
ckpt_name = os.path.join(model_dir, 'bert_model.ckpt')
output_dir = os.path.join(... |
import racegen, namegen, statgen, classgen, featgen, skillgen
class NPC():
def __init__(self):
#Inputs
self.inLevel = None
self.inRace = None
self.inName = None
self.inGender = None
self.inStats = None
self.inClass = None
self.inFeats = None
self.inSkills = None
#Intermediate values
self.raceSt... |
# This is a guess the number game.
import random
guessesTaken = 0
print('Hello! What is your name?')
myName = input()
number = random.randint(1, 20)
print('Well, ' + myName + ', I am thinking of a number between 1 and 20.')
while guessesTaken < 6:
print('Take a guess.') # There are four spaces in fr... |
#!/usr/bin/env python
import os
import shutil
import subprocess
import sys
import tempfile
import warnings
from django import contrib
# databrowse is deprecated, but we still want to run its tests
warnings.filterwarnings('ignore', "The Databrowse contrib app is deprecated",
PendingDeprecationW... |
import os
import pickle
import platform
import re
from pathlib import Path
import cloudpickle
import pytest
import tests.base.develop_utils as tutils
import torch
from pytorch_lightning import Trainer, seed_everything
from pytorch_lightning.callbacks import ModelCheckpoint
from pytorch_lightning.loggers import TensorB... |
import sys
import os
import six
from gensim.corpora import WikiCorpus
from gensim.corpora.wikicorpus import *
# parent = os.path.dirname(os.path.realpath(__file__))
# sys.path.append(parent + '/../venv/lib/python2.7/site-packages/gensim/corpora/')
def tokenize(content):
# override original method in wikicorpus.p... |
from flask import Flask, render_template, redirect, jsonify
from flask_pymongo import PyMongo
# From the separate python file directory import the code to scrape pages
from scrape_mars import scrape
app = Flask(__name__)
# Flask_pymongo for mongo connection
app.config["MONGO_URI"] = "mongodb://localhost:270... |
"""
Entry
"""
import gym
from arch import Curiosity
def run():
"""
Instantiates and trains the Curiosity model
"""
env = gym.make('MountainCar-v0')
env = env.unwrapped
cr = Curiosity(n_states=env.observation_space.shape[0],
n_actions=env.action_space.n)
cr.trai... |
import numpy as np
data = [1, 2, 3]
arr = np.array(data)
data2 = arr * 10
print(data2) |
# -*- coding: UTF-8 -*-
"""
collector.xhn - 新华网数据采集
官网:http://www.xinhuanet.com/
接口分析:
1. 获取文章列表
http://qc.wa.news.cn/nodeart/list?nid=115093&pgnum=1&cnt=10000
新华全媒体头条
http://www.xinhuanet.com/politics/qmtt/index.htm
====================================================================
"""
import requests
import re... |
# -*- coding: utf-8 -*-
"""
# Run server:
>>> import thriftpy2
>>> from thriftpy2.http import make_server
>>> pingpong = thriftpy2.load("pingpong.thrift")
>>>
>>> class Dispatcher(object):
>>> def ping(self):
>>> return "pong"
>>> server = make_server(pingpong.PingService, Dispatcher(),
... |
from pydatastructs.linear_data_structures.arrays import (
OneDimensionalArray, DynamicArray)
from pydatastructs.utils.misc_util import _check_type, _comp
from concurrent.futures import ThreadPoolExecutor
from math import log, floor
__all__ = [
'merge_sort_parallel',
'brick_sort',
'brick_sort_parallel',... |
from PyQt5.QtWidgets import QMainWindow, QShortcut, QApplication, QFileDialog, QSizePolicy, QTableWidgetItem
from PyQt5.QtCore import Qt, QSettings, QDir, QFileInfo
from pySPM.tools.spectraviewer import Ui_SpectraViewer
import pySPM
import sys
import numpy as np
import os
import struct
DPI = 100.0
class SpectraViewer(... |
#
# Copyright (C) 2010-2017 Samuel Abels
# The MIT License (MIT)
#
# 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,... |
"""A simple GeoHash implementation."""
# Forward and reverse base 32 map
BASESEQUENCE = '0123456789bcdefghjkmnpqrstuvwxyz'
BASE32MAP = dict((k,count) for count,k in enumerate(BASESEQUENCE))
BASE32MAPR = dict((count,k) for count,k in enumerate(BASESEQUENCE))
def _bits_to_float(bits, lower=-90.0, middle=0.0, upper=90.0... |
# 914000100
if not "1" in sm.getQRValue(21002):
sm.systemMessage("You can only exit after you accept the quest from Athena Pierce, who is to your right.")
else:
sm.removeSkill(20000017)
sm.removeSkill(20000018)
sm.giveSkill(20000017)
sm.giveSkill(20000018)
sm.warp(914000200, 1) |
from __future__ import absolute_import, division, print_function
class IntegrationAlgorithm(object):
"""A class to perform 3D summation integration"""
def __init__(self, **kwargs):
pass
def __call__(self, reflections, image_volume=None):
"""Process the reflections.
:param reflec... |
r"""
Enumeration of rational points on affine schemes
Naive algorithms for enumerating rational points over `\QQ` or finite fields
over for general schemes.
.. WARNING::
Incorrect results and infinite loops may occur if using a wrong function.
(For instance using an affine function for a projective scheme o... |
# Copyright 2015 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 pygame
import numpy as np
import math
import time
import matplotlib.pyplot as plt
from matplotlib.colors import BoundaryNorm
from matplotlib.ticker import MaxNLocator
from mpl_toolkits.mplot3d import Axes3D
from matplotlib import cm
from matplotlib.ticker import LinearLocator, FormatStrFormatter
class Reacher:... |
from django import forms
from .models import Election , Postcode
from django.forms.extras.widgets import SelectDateWidget
from django.db.utils import OperationalError
#from jsignature.forms import JSignatureField
#from jsignature.utils import draw_signature
#from jsignature.widgets import JSignatureWid#get
try:
va... |
#
# Copyright (c) 2017, Intel Corporation.
#
# This program is free software; you can redistribute it and/or modify it
# under the terms and conditions of the GNU General Public License,
# version 2, as published by the Free Software Foundation.
#
# This program is distributed in the hope it will be useful, but WITHOUT... |
# Copyright 2017 The Chromium 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 copy
import datetime
import mock
import logging
import tempfile
import unittest
from infra.services.bugdroid import gitiles_poller
from infra.service... |
#if u steal credits u wil be the gayest gay in the world. i will fban u from 100 feds and u will leave tg
"""
Pulls Up A Random string created by Indian Bhai.
cmd: .hp
full credits : @pureindialover
"""
from telethon import events
import asyncio
import os
import sys
import random
@borg.on(events.NewMessage(patte... |
# Uses python3
def calc_fib(n):
if (n <= 1):
return n
a, b = 0, 1
for i in range(1, n):
a, b = b, a + b
return b
if __name__ == '__main__':
n = int(input())
print(calc_fib(n))
|
from threading import Thread
from tensorflow.python.ipu import ipu_outfeed_queue
from tensorflow.python.ipu import ipu_strategy
from tensorflow.python.ipu import utils
from tensorflow import keras
import tensorflow as tf
# The host side queue
outfeed_queue = ipu_outfeed_queue.IPUOutfeedQueue(feed_name="outfeed")
# ... |
# Copyright (c) 2011 X.commerce, a business unit of eBay Inc.
# Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file... |
# -*- coding: utf-8 -*-
# Copyright 2021 Google 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... |
# Generated by Django 3.1.2 on 2020-11-25 00:14
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('Hydroxychloroquine', '0006_auto_20201109_2345'),
]
operations = [
migrations.AddField(
model_name='excursion',
name=... |
# 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... |
# Script creates the 'n' number of ES doamins
import boto3
import random
import sys
import json
# Total number of ES domains to be created
count = int(sys.argv[2])
# Fetch the account ID associated with the profile name passed as input arg
session = boto3.Session(profile_name=sys.argv[1])
credentials = session.get_c... |
from django.http import HttpResponse
from django.shortcuts import render, redirect
# Create your views here.
from book.models import BookInfo
def create_book(request):
book = BookInfo.objects.create(
name='abc',
pub_date='2020-1-1',
readcount=10
)
return HttpResponse("create")
d... |
# coding=utf-8
# Copyright 2020 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... |
# Copyright 2012 The Chromium 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 fnmatch
import inspect
import os
import re
from telemetry import decorators
from telemetry.core import camel_case
@decorators.Cache
def DiscoverMod... |
country = 'CANADA'
# by converting the string entered to lowercase and comparing it to a string
# that is all lowercase letters I make the comparison case-insensitive
# If someone types in CANADA or Canada it will still be a match
if country.lower() == 'canada':
print('Hello eh')
else:
print('Hello')
|
import numpy as np
from var_learning.core import VarLearning
from var_learning.formula import Formula
from var_learning.plot import hist_two
from .two_particles import TwoParticles
from .phys import hist_two_phys, mass, pt
class PhysLearning(VarLearning):
def __init__(self, signal=None, bg=None,
... |
import warnings
from .abs import BertSumAbs
from .decoder import BertSumAbsDecoder
__all__ = [
"BertSumAbs",
"BertSumAbsDecoder",
]
try:
from .onmt_decoder import BertSumAbsOpenNMTDecoder
__all__.append("BertSumAbsOpenNMTDecoder")
except ModuleNotFoundError:
warnings.warn("Failed to import BertS... |
#!/usr/bin/python3
#
# Copyright (C) 2010, 2011, 2012, 2013 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:
#
# 1. Redistributions of source code must retain the above copyright not... |
class Solution:
def singleNumber(self, nums: List[int]) -> int:
"""
:type nums: List[int]
:rtype: int
"""
a = 0
for i in nums:
a ^= i
return a
|
# Copyright (C) 2017 Google Inc.
# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>
from flask import Blueprint
from sqlalchemy import orm
from ggrc import settings
from ggrc.models import all_models
from ggrc.models import reflection
from ggrc.rbac import permissions
from ggrc.services.re... |
from __future__ import print_function
import json
import requests
class StudioClient:
"""
This is Spotflock Studio Python SDK Client for v1.2.0.
For more information, visit https://studio.spotflock.com/documentation/
Attributes:
api_key (str): API Key Generated for an app in... |
import json
import uuid
from base64 import b64encode
from django.conf import settings
import requests
import olympia.core.logger
log = olympia.core.logger.getLogger('lib.remote_settings')
class RemoteSettings(object):
username = None
password = None
bucket = None
collection = None
sign_off_ne... |
"""Utilities for real-time data augmentation on image data.
"""
import warnings
import numpy as np
from .affine_transformations import (apply_affine_transform,
apply_brightness_shift,
apply_channel_shift, flip_axis)
from .dataframe_iterator imp... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Sep 1 11:57:52 2021
@author: smullally
"""
import Susan
import matplotlib.pyplot as plt
import numpy as np
outdir = "/Users/smullally/Science/tess_monitor_standards/paper/plots/"
#Directory of the data files
ddir = "/Users/smullally/Science/tess_mon... |
#
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
#
from enum import Enum
from mlos.Spaces import SimpleHypergrid, \
ContinuousDimension, DiscreteDimension, CategoricalDimension, Point
from .RegressionModel import RegressionModelConfig
class SklearnRidgeRegressionModelConfig... |
from curses_tools import draw_frame
from explosion import explode
class Obstacle:
def __init__(self, canvas, init_x, frame, speed):
self.canvas = canvas
self.x = init_x
self.y = 0
self.frame = frame
self.height = len(frame.splitlines())
self.width = max(map(len, fra... |
#!/usr/bin/python3
count = 0
for i in range(2, 100):
k = i // 2
j = 2
for j in range(2, k + 1):
k = i % j
if k == 0:
count = count - 1
break
k = i // 2
count = count + 1
print(count)
|
import requests
import json
import pandas as pd
from django.conf import settings
from rest_framework.response import Response
from rest_framework import status
from trading import serializers, models
# 3rd Part API: iextrading.com
def get_symbols():
url = 'https://api.iextrading.com/1.0/ref-data/symbols'
res... |
# On 1 TitanX, it takes around 10s for testing
# test on pretrained model: (pre, rec, fscore) = (26.43, 32.47, 29.14)
import os.path as osp
from proposals import generate_proposals
# model
model = dict(type='dsgcn',
kwargs=dict(feature_dim=256,
featureless=False,
... |
# Copyright 2021 Huawei Technologies Co., Ltd
#
# 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... |
#!/usr/bin/env python
import os
from os import listdir
import re
import MarkdownPP
class Variable:
def __init__(self, name):
self.name = name
self.description = None
self.type = 'string'
self.default = None
class Output:
def __init__(self, name):
self.name = name
... |
#!/usr/bin/python
"""
front_end.py: Lexer and parser for the ASDL schema language.
"""
from __future__ import print_function
import re
from asdl import asdl_ as asdl
from asdl.asdl_ import Module, Type, Constructor, Field, Sum, Product
# Types for describing tokens in an ASDL specification.
class TokenKind(object):... |
from django.db import models
from django.contrib.auth.models import AbstractBaseUser
from django.contrib.auth.models import BaseUserManager
from django.contrib.auth.models import PermissionsMixin
class UserManager(BaseUserManager):
"""Manager for user"""
def create_user(self, username, email, password=None):
... |
"""
I/O for Abaqus inp files.
"""
import numpy
from ..__about__ import __version__
from .._exceptions import ReadError
from .._files import open_file
from .._helpers import register
from .._mesh import CellBlock, Mesh
abaqus_to_meshio_type = {
# trusses
"T2D2": "line",
"T2D2H": "line",
"T2D3": "line3"... |
import json
import os
from typing import TYPE_CHECKING
from funcy import reraise
from dvc.exceptions import DvcException
from dvc.render.base import Renderer
from dvc.render.utils import get_files
from dvc.utils import relpath
if TYPE_CHECKING:
from dvc.types import StrPath
class ImageRenderer(Renderer):
T... |
import iot_logging
log = iot_logging.getLogger(__name__)
from iot_api.user_api import db
from iot_api.user_api.models import AppKey
from iot_api.user_api import Error
MAX_PER_ORGANIZATION = 500
def count_with(organization_id):
""" Count all app keys of an organization """
return db.session.query(AppKey).filt... |
from service.model.intelligence import IntelligenceModel
from service.resources import BaseResource
SERVICE_NAME = 'Intelligence'
class IntelligenceModelService(BaseResource):
ROUTES = [
"/intelligence/model",
"/intelligence/model/"
]
def on_get(self, req, resp):
values, offset =... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.test import TestCase
from django.contrib.auth.models import User
from .models import *
# Create your tests here.
# Create your tests here.
class UserTest(TestCase):
def setUp(self):
self.user=User(username='dk',first_name='d',las... |
from tracker.models.bid import Bid, BidSuggestion, DonationBid
from tracker.models.country import Country, CountryRegion
from tracker.models.donation import Donation, Donor, DonorCache, Milestone
from tracker.models.event import (
Event,
PostbackURL,
Runner,
SpeedRun,
Submission,
HostSlot,
)
fro... |
##
# @author Brandon Michael
# This program asks the user for a year that we can check to see if it is a
# leap year or not.
## Determines if a year is a leap year
# @param year The year to test (Integer)
# @return true or false where the year is a leap year
def isLeapYear(year):
# If the year is divisible b... |
from typing import List
class Solution:
def firstPalindrome(self, words: List[str]) -> str:
answer: str = ""
def isPalindrome(word: str) -> bool:
answer: bool = True
len_word: int = len(word)
for i in range(len_word//2):
if word[i] !... |
import json
from electrum_zcash.wallet_db import WalletDB, FINAL_SEED_VERSION
from . import SequentialTestCase
class WalletDBTestCase(SequentialTestCase):
def test_check_unfinished_multisig(self):
d = {'wallet_type': 'standard', "seed_version": FINAL_SEED_VERSION}
db = WalletDB(json.dumps(d), ... |
# search.py
# ---------
# Licensing Information: Please do not distribute or publish solutions to this
# project. You are free to use and extend these projects for educational
# purposes. The Pacman AI projects were developed at UC Berkeley, primarily by
# John DeNero (denero@cs.berkeley.edu) and Dan Klein (klein@cs.be... |
from sympy import *
from KratosMultiphysics import *
from sympy_fe_utilities import *
## Settings explanation
# DIMENSION TO COMPUTE:
# This symbolic generator is valid for both 2D and 3D cases. Since the element has been programed with a dimension template in Kratos,
# it is advised to set the dim_to_compute flag as ... |
# encoding=utf-8
import pandas as pd
import numpy as np
data = pd.read_csv(r'D:\Destop\123.csv', dtype={'LinkedAccountId': np.object})
link_user = '515743265704'
# instance_name = 'dacproes2uatinstance' # 实例名字
tag_name = 'user:' + 'appenv' # 标签名
tag_value = 'dac-uat' # 标签名
# user_unique = list(data['LinkedAccoun... |
# -*- coding: utf-8 -*-
import numpy as np
from ctp.indexing.base import Index
class NPSearchIndex(Index):
def __init__(self):
super().__init__()
self.data = None
def build(self,
data: np.ndarray):
self.data = data
def query(self,
data: np.ndarray,
... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import asyncio
from collections import namedtuple
from inspect import iscoroutinefunction
from typing import Any, Union
from eeee import exceptions
__author__ = 'Paweł Zadrożny'
__copyright__ = 'Copyright (c) 2018, Pawelzny'
def subscribe(event: "Event", publisher: Unio... |
import os
import json
import logging
from twisted.internet import defer
from torba.basemanager import BaseWalletManager
from lbryschema.claim import ClaimDict
from .ledger import MainNetLedger
from .account import generate_certificate
from .transaction import Transaction
from .database import WalletDatabase
log = l... |
import os
import glob
import argparse
from tqdm import tqdm
from pathlib import Path
import cv2
def parse_args():
parser = argparse.ArgumentParser(description='Prepare data for nsff training')
parser.add_argument('--root_dir', type=str, help='data root directory', required=True)
parser.add_argument('--cud... |
# encoding: utf-8
from ckan.common import config
from pylons.test import pylonsapp
from paste.deploy.converters import asbool
import paste.fixture
from ckan.lib.helpers import url_for
from nose import SkipTest
import ckan.tests.helpers as helpers
import ckan
from ckan.logic.action.create import package_create, user_c... |
# Copyright 2021 The Kubeflow Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in... |
from __future__ import absolute_import, division, print_function
import pytest
from scitbx import matrix
from .utils import is_approximate_integer_multiple
from .utils import vector_group, group_vectors
def test_is_approximate_integer_multiple():
v1 = matrix.col((34, 50, 20))
v2 = 2.1 * v1.rotate_around_or... |
"""
Exomerge is a lightweight Python interface for manipulating ExodusII files.
Copyright (c) 2012-2020, National Technology & Engineering Solutions
of Sandia, LLC (NTESS). Under the terms of Contract DE-NA0003525 with
NTESS, the U.S. Government retains certain rights in this software.
Redistribution and use in sour... |
# coding: utf-8
"""Test that tokenizer exceptions and emoticons are handles correctly."""
from __future__ import unicode_literals
import pytest
@pytest.mark.parametrize('text', ["auf'm", "du's", "über'm", "wir's"])
def test_de_tokenizer_splits_contractions(de_tokenizer, text):
tokens = de_tokenizer(text)
a... |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator (autorest: 3.0.... |
#!/usr/bin/env python3
# -*- coding=utf-8 -*-
import cv2 as cv
import numpy as np
"""
Opencv DNN 实现图像分类
使用ImageNet数据集支持1000分类的GoogleNet网络模型,其中label标签是在一个单独的文本文件中读取
读取模型的API:
cv.dnn.readNetFromCaffe(prototxt, caffeModel)
- prototxt 模型配置文件
- caffeModel 模型的权重二进制文件
使用模型实现预测的时候... |
#!/usr/bin/env python
import sys
import string
maxlines = int(sys.argv[3] or '1000', 10)
perfect = {}
with open(sys.argv[1], 'r') as f:
for line in map(string.strip, f):
key, v0 = line.split(",", 1)
perfect[key] = float(v0)
count = 0
low = 0.0
up = 0.0
perfect_max = max(perfect.itervalues())
... |
#
# Copyright 2018-2021 Elyra Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writ... |
"""
Django settings for jeffchenseo project.
Generated by 'django-admin startproject' using Django 1.11.
For more information on this file, see
https://docs.djangoproject.com/en/1.11/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.11/ref/settings/
"""
import ... |
import argparse
import imp
import os
import re
import sys
import pkg_resources
from threading import RLock, Thread
from keyeventthread import KeyEventThread
from os.path import expanduser
# import our libs
from utils import Utils, Display
from keystore import KeyStore as kb
from events import EventHandler
from mynmap... |
#
# 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 us... |
# Crie um programa que leia varios numeros inteiros pelo teclado. O programa só vai parar quando o usuário digitar o valor 999, que é a condição de parada. No final, mostre quantos números foram digitados e qual foi a soma entre eles. (deconsiderando o flag)
n = s = c = 0
while n != 999:
n = int(input('Digite um va... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.