text stringlengths 2 999k |
|---|
#!/usr/bin/env 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 "Lice... |
"""
Russian-specific forms helpers
"""
from __future__ import absolute_import, unicode_literals
import re
from django.contrib.localflavor.ru.ru_regions import RU_COUNTY_CHOICES, RU_REGIONS_CHOICES
from django.forms.fields import RegexField, Select
from django.utils.translation import ugettext_lazy as _
phone_digits... |
# -*- coding: utf-8 -*-
"""
(beta) Channels Last Memory Format in PyTorch
*******************************************************
**Author**: `Vitaly Fedyunin <https://github.com/VitalyFedyunin>`_
What is Channels Last
---------------------
Channels last memory format is an alternative way of ordering NCHW tensors in... |
"""
Server's configuration variables
"""
import six
from conans import tools
from conans.util.env_reader import get_env
from datetime import timedelta
import os
import random
import string
from conans.errors import ConanException
from conans.util.files import save, mkdir
from six.moves.configparser import ConfigParser... |
import numpy as np
from transonic import boost, Array, Type
A = Array[Type(np.float64, np.complex128), "3d"]
Af = "float[:,:,:]"
A = Af # issue fused type with Cython
def proj(vx: A, vy: A, vz: A, kx: Af, ky: Af, kz: Af, inv_k_square_nozero: Af):
tmp = (kx * vx + ky * vy + kz * vz) * inv_k_square_nozero
vx ... |
import setuptools
with open("README.md",'r') as f:
long_description = f.read()
setuptools.setup(
name="world-time-api",
version='2020.05.31',
author='Tyler Dula',
author_email='echo.dulatr@gmail.com',
description='A wrapper for the World Time API.',
long_description=long_description,
l... |
from math import ceil
from os import listdir
from os.path import isfile, join
from PIL import Image, ImageOps
from shutil import copyfile
import os
import json
DIRFILE = open('directories.json')
DIRS = json.load(DIRFILE)
DIRFILE.close()
POST_CONTENT = '''---
title: {}
image: {}
thumbnail: {}
caption: {}... |
#!/usr/bin/python
# Copyright (c) 2020, 2021 Oracle and/or its affiliates.
# This software is made available to you under the terms of the GPL 3.0 license or the Apache 2.0 license.
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
# Apache License v2.0
# See LICENSE.TXT for d... |
broker_url = 'redis://127.0.0.1:6379/0'
# broker_pool_limit=100
#
# timezone = 'Asia/Shanghai'
#
# accept_content = ['pickle','json']
# task_serializer='pickle'
#
# result_backend='redis://127.0.0.1:6379/0'
# result_serializer='pickle'
# result_cache_max=10000
# result_expires=3600
#
# worker_redirect_stdouts_level='I... |
# coding=utf-8
from django.contrib.contenttypes import generic
from django.contrib.contenttypes.models import ContentType
from django.db import models
from django.utils.translation import ugettext_lazy as _
from decorators import stats_container
@stats_container
class Stats(models.Model):
content_type = models.Fo... |
# Copyright 2021 IBM 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 wri... |
from rad import *
from yolov3_base import YOLO
class YOLOv3(Model):
def __init__(self, model_attack, model_detect):
super().__init__(model_attack, model_detect, 'YOLOv3')
def preprocess_image(self, image_path):
image, self.val_image, self.resized = self.model_detect.preprocess_... |
1、搭建好pytenv环境,理解local、global、shell3种方式区别,安装部署完成jupyter并运行
local 对当前的目录进行python版本的设定,当前目录下的子目录会继承这个设定。
global 全局修改python版本。
shell 只对当前会话的shell做设定,当退出当前会话的shell,这个设定也就失效了。
2、打印出100以内的斐波那契数列,使用2种方法实现
第一种:
#fib
a=0
b=1
print(0,a)
print(1,b)
i = 2
while True:
c = a + b
if c > 100:
break
print(i , c)
... |
# 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... |
from js9 import j
import os
import capnp
# import msgpack
import base64
ModelBaseCollection = j.data.capnp.getModelBaseClassCollection()
ModelBase = j.data.capnp.getModelBaseClass()
# from JumpScale9.clients.tarantool.KVSInterface import KVSTarantool
class $NameModel(ModelBase):
'''
'''
def __init__(sel... |
from typing import Optional, Tuple, Union, List
import torch
import numpy as np
from ....data.subject import Subject
from ....utils import to_tuple
from ....torchio import DATA, TypeTuple, TypeData, TypeTripletInt
from ... import IntensityTransform
from .. import RandomTransform
class RandomSwap(RandomTransform, Inte... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on May, 2020
Nathan de Lara <ndelara@enst.fr>
"""
import numpy as np
from scipy import sparse
from sknetwork.utils.format import directed2undirected
def edgelist2adjacency(edgelist: list, undirected: bool = False) -> sparse.csr_matrix:
"""Build an adjace... |
#!/usr/bin/env python
# Helpful little script that spits out a comma-separated list of
# language codes for Qt icons that should be included
# in binary stratis distributions
import glob
import os
import re
import sys
if len(sys.argv) != 3:
sys.exit("Usage: %s $QTDIR/translations $STRATISDIR/src/qt/locale"%sys.arg... |
import numpy as np
import seaborn as sns
import matplotlib.pyplot as plt
import pandas as pd
avgArr = [684.0322959592726, 884.7363009861817, 888.8322884189091, 942.080300986182, 970.7522934458182, 991.2322959592727, 991.2323009861818, 1011.712300986182, 1036.288295959273, 1044.4803034996364, 1060.8642859054546, 1069.0... |
import pytest
import uuid
from couchdb import Server
from openprocurement.auction.design import sync_design_chronograph, sync_design
from openprocurement.auction.tests.utils import test_public_document, \
put_test_doc
SERVER = Server('http://admin:zaq1xsw2@127.0.0.1:9000')
@pytest.fixture(scope='function')
de... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Thu Apr 1 11:36:22 2021
@author: arsii
"""
import pytest
from tscfat.Utils.plot_decorator import plot_decorator
from tscfat.Analysis.plot_timeseries import plot_timeseries
from tscfat.Utils.argument_loader import setup_pd
class TestPlotDecorator(object)... |
import unittest
from paddle.v2.framework.framework import Variable, g_main_program, Program
import paddle.v2.framework.core as core
import numpy as np
class TestVariable(unittest.TestCase):
def test_np_dtype_convert(self):
DT = core.DataType
convert = Variable._convert_np_dtype_to_dtype_
s... |
# based on https://github.com/pypa/sampleproject/blob/master/setup.py
# see http://packaging.python.org/en/latest/tutorial.html#creating-your-own-project
from setuptools import setup, find_packages
from setuptools.command.install import install as stdinstall
import codecs
import os
import re
import sys
def find_v... |
import numpy as np
import pandas as pd
import math
from sklearn.model_selection import train_test_split
from sklearn.ensemble import RandomForestRegressor
from sklearn.metrics import mean_absolute_error, r2_score
df = pd.read_csv('CryptoCoinClose.csv')
#df.drop( ['BNB'], axis = 1)
features = ['BTC', 'XRP', 'XLM', 'L... |
import tensorflow as tf
from tensorflow.keras import datasets, layers, optimizers, Sequential, metrics
from tensorflow import keras
import os
import numpy as np
import sys
sys.path.append("../src")
from dopamine import Dopamine, dopamine
assert tf.__version__.startswith('2.')
tf.random.set_seed(22)
np.random.seed(2... |
import neural_network_lyapunov.examples.quadrotor2d.quadrotor_2d as\
quadrotor_2d
import unittest
import numpy as np
import torch
import scipy.integrate
class TestQuadrotor2D(unittest.TestCase):
def test_dynamics_equilibrium(self):
plant = quadrotor_2d.Quadrotor2D(torch.float64)
u = plant.u_e... |
import contextlib
import json
import logging
import mimetypes
import os
import warnings
try:
from urllib.parse import quote_plus
except ImportError:
from urllib import quote_plus # type: ignore
from contextlib2 import ExitStack
from future.utils import raise_from
import requests
from requests.cookies import ... |
#!/usr/bin/env python3
# Copyright (c) 2014-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.
"""Helpful routines for regression testing."""
from base64 import b64encode
from binascii import hexlify,... |
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT license.
from typing import Dict, List, Any
# from retriever.entitylinking.mentiondetector.ner_mention import NERMentionDetector
from retriever.entitylinking.mentiondetector.web_api_ner_mention import WebAPINERMentionDetector
from retriever.entitylinking.... |
import unittest
from unittest.mock import MagicMock
from networking.PositionSender import PositionSender
class PositionSenderTest(unittest.TestCase):
def test_send(self):
connection_handler_mock = MagicMock()
sender = PositionSender(connection_handler_mock)
x = 42
z = 1337
... |
try:
import uio
uio.TextIOBase
except:
print('SKIP')
raise SystemExit
s = uio.TextIOBase(uio.BytesIO(b"123привет"))
print(s.read(1))
print(s.read(3))
print(s.read(1))
print(s.read())
|
import sys
import datetime
from csv import writer
import os
from pathlib import Path
# import getpass
## not using getpass so we can see when the string has been fully read
os.system('cls')
full_date = datetime.datetime.now()
short_date = full_date.strftime('%Y%m%d')
print(short_date)
print("Program to save Gift Car... |
# -*- coding: utf-8 -*-
# Copyright (c) 2018-2019 Linh Pham
# wwdtm is relased under the terms of the Apache License 2.0
"""Explicitly listing show modules in this package"""
from wwdtm.show import core, details, info, utility
__all__ = ["core", "details", "info", "utility"]
|
# Author: Grand Roman Joldes
# E-mail: grand.joldes@uwa.edu.au
import sys
dir = sys.argv[1]
def terminate(errorcode):
print("\n")
exit(errorcode)
def error(msg):
print msg
terminate(1)
res = slicer.util.loadVolume(dir+"\\CT_cropped.nrrd")
if (res == False):
error("Failed to load "+dir+"\\CT_cropped... |
import time
import tensorflow as tf
physical_devices = tf.config.experimental.list_physical_devices('GPU')
if len(physical_devices) > 0:
tf.config.experimental.set_memory_growth(physical_devices[0], True)
from absl import app, flags, logging
from absl.flags import FLAGS
import core.utils as utils
from core.... |
# -*- coding: utf-8 -*-
# Copyright (c) 2020, Aerele Technologies Private Limited and Contributors
# See license.txt
from __future__ import unicode_literals
# import frappe
import unittest
class TestSitePurchaseConfirmation(unittest.TestCase):
pass
|
# SPDX-License-Identifier: BSD-3-Clause
# Copyright (c) 2021 Scipp contributors (https://github.com/scipp)
# @file
# @author Simon Heybrock
import scipp as sc
import numpy as np
from .common import assert_export
class TestDatasetSlice:
def setup_method(self):
var = sc.Variable(dims=['x'], values=np.arange... |
# -*- coding: utf-8 -*-
import tensorflow as tf
import layer_utils
import match_utils
class SentenceMatchModelGraph(object):
"""
Create Natural Language Sentence Matching Models.
-- sentence-sentence pairs
-- question-answer pairs
-- premise-hypothesis pairs
"""
def __init__(s... |
import warnings
import numpy as np
from typing import Union, List
from sklearn.metrics import pairwise_distances
from gensim.models import KeyedVectors
from whatlies.embedding import Embedding
from whatlies.embeddingset import EmbeddingSet
from whatlies.language.common import SklearnTransformerMixin
class GensimLa... |
import torch
from rich.progress import track
from rich import print
from .dataset import Dataset
from .samplers import BatchSampler, ParallelSampler
class FewShotDataset (Dataset):
def __init__(
self,
directory: str,
device: torch.device
):
super().__init__(direc... |
# Copyright 2012 the V8 project authors. 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 conditi... |
from kapyo.service.auth_service import AuthService, KayoAuthService
from kapyo.dataclass.token import KayoAuthToken
from kapyo.dataclass.credentials import Credentials
from kapyo.helpers import retry
import logging
class AuthSession:
def __init__(self,auth_service=None):
self.auth_token: KayoAuthToken = ... |
class Message(object):
RLGYM_HEADER_END_TOKEN = "RLGEHEADER"
RLGYM_BODY_END_TOKEN = "RLGEBODY"
RLGYM_NULL_MESSAGE_HEADER = "RLGNMH"
RLGYM_NULL_MESSAGE_BODY = "RLGNMB"
RLGYM_CONFIG_MESSAGE_HEADER = "RLGC"
RLGYM_STATE_MESSAGE_HEADER = "RLGSMH"
RLGYM_AGENT_ACTION_MESSAGE_HEADER = "RLGAAMH"
... |
from typing import Dict
from boa3.model.builtin.interop.nativecontract import StdLibMethod
from boa3.model.variable import Variable
class JsonSerializeMethod(StdLibMethod):
def __init__(self):
from boa3.model.type.type import Type
identifier = 'json_serialize'
native_identifier = 'jsonSer... |
# 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 agreed to in writing, ... |
import re
from typing import List
class TestIntroduction:
def test_a(self):
def solution(text: str):
return True if re.search("0xB0", text) else False
line1 = 'start address: 0xA0, func1 address: 0xC0'
line2 = 'end address: 0xFF, func2 address: 0xB0'
assert solution(lin... |
import argparse
import cv2
import imutils
import operator
import time
ap = argparse.ArgumentParser()
ap.add_argument("-i", "--image", required=True, help="path to the image file")
args = vars(ap.parse_args())
# define the lower and upper boundaries of the colors in the HSV color space
lower = {'red': (166, 84, 141), ... |
from abc import ABC, abstractmethod
import numpy as np
class CollisionObject(ABC):
@abstractmethod
def isCollision(self, target):
pass
class CollisionBox(CollisionObject):
def __init__(self, location, lengths):
self.location = np.asarray(location)
self.lengths = np.asarray(lengt... |
# -*- coding: utf-8 -*-
import datetime
import os
import sys
sys.path.append(os.path.abspath("../concurrency_safe_shelve"))
sys.path.append(os.path.abspath("../utils"))
from . import auth_server_blueprint
from .constant import _access_token
from .constant import _auth_code_db_name
from concurrency_safe_shelve import o... |
"""
2523 : 별 찍기 - 13
URL : https://www.acmicpc.net/problem/2523
Input :
3
Output :
*
**
***
**
*
"""
n = int(input())
for i in range(1, n + 1, 1):
print(''.join(map(lambda x: '*', range(i))))
for i in range(n - 1, 0, -1):
print(''.join(map(lambda... |
# Github Service Test
import unittest
import GitHubService as gs
import os
import requests
class TestGithubService(unittest.TestCase):
def test_get_repo_url(self):
headers={'Authorization':'token 5c4d81ec05cb82053d9fd0c0519120fe3eed17be',
'User-Agent':'https://api.github.com/meta',
'Content-Type... |
'''
Good Point:
1. In one bfs
Bad Point:
1. in fact the if-elses really took time. Don't do that
2. not clear enough
'''
# Definition for a Node.
class Node:
def __init__(self, val=0, neighbors=[]):
self.val = val
self.neighbors = neighbors
class Solution:
def cloneGraph(self, n... |
#Compass Student Export to Seperate CSV for Barcode creation. Library Use
# Justin Clarke <justin@dev.justinclarke.me>
'''import csv
f=open('file.csv')
datareader = csv.reader(f, delimiter=',', quotechar='"')
headers = datareader.next()
datalist=[]
for row in datareader:
data={}
for i in range(4):
dat... |
from __future__ import print_function
import functools
import json
import re
import traceback
from pymel.core import *
from ... import core
from ... import nodeApi
def parse( names ):
'''
Given a string, divides it into the naming chunks. One name can be marked
with a '*' to denote it repeats.
'''... |
print ("hello")
print ("bye bye bye")
|
import unittest
from inspect4py.utils import *
class Test(unittest.TestCase):
def test_extract_software_type(self):
json_test = [
{"type": "service", "run": "python /GitHub/test_repos/Chowlk/app.py"},
{"type": "script with main", "run": "python /GitHub/test_repos/Chowlk/converter.p... |
foods = ['spam', 'eggs', 'ham']
things = foods
things[1] = 'chips'
print(foods[1]) # 'chips'
print(foods) # ['spam', 'chips', 'ham']
print(things) # ['spam', 'chips', 'ham']
print(40 * '-')
a = ['spam', 'eggs', 'ham']
b = a
c = a[:]
print(a is b, a is c) # (True, False)
print(a == b, a == c) # (True, True)
b[1] ... |
# Copyright 2018 The DNNC Authors. All Rights Reserved.
#
# 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 Ap... |
# 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... |
"""
MAP Client Plugin Step
"""
from mapclient.mountpoints.workflowstep import WorkflowStepMountPoint
class FieldworkModelTransformationStep(WorkflowStepMountPoint):
"""
Step for applying a rigid-body or scaling transform to
a fieldwork model.
"""
def __init__(self, location):
... |
"""
Haystack-API
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) # noqa: E501
The version of the OpenAPI document: 0.1
Generated by: https://openapi-generator.tech
"""
import re # noqa: F401
import sys # noqa: F401
from openapi_client.ap... |
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.autograd import Variable
import math
from mmcv.runner import load_checkpoint
from mmseg.utils import get_root_logger
from functools import partial
from ..builder import BACKBONES
__all__ = [
'resnet103D', 'resnet183D', 'resnet343D', 'resn... |
class List:
def __init__(self):
self.data = {}
self.length = 0
def append(self, element):
self.data[self.length] = element
self.length += 1
def pop(self):
self.length -= 1
last_element = self.data[self.length]
del self.data[self.length]
return last_element
def insert(self, in... |
#!/usr/bin/env python3
# Copyright (c) 2018-2019 The Bitcoin Core developers
# Copyright (c) 2019 The EncoCoin developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
import argparse
import os
import subprocess
import sys
def... |
from __future__ import print_function, division
import numpy
from galpy.util import coords
import pytest
import astropy
_APY3= astropy.__version__ > '3'
def test_radec_to_lb_ngp():
_turn_off_apy()
# Test that the NGP is at b=90
ra, dec= 192.25, 27.4
lb= coords.radec_to_lb(ra,dec,degree=True,epoch=1950.... |
# DEP MONI - Personal departure monitor
#
# Based on VasttraPi (https://github.com/platisd/vasttraPi/blob/master/departures.py) by Dimitris Platis (published under MIT license).
# The structure & function is widely borrowed from VasttraPi.
from tkinter import Tk, Label, Button, N, S, E, W, Frame
import tkinter.font a... |
import sqlite3
connection = sqlite3.connect('demo_data.sqlite3')
# Helper Functions
def execute_fetchall_sqlite_query(connection, query):
cursor = connection.cursor()
return cursor.execute(query).fetchall()
# Part 1B: Queries
## Count how many rows you have - it should be 3!
query = "SELECT COUNT(*) FROM d... |
import argparse
import os
import sys
import itertools
import SoftLayer
import Crypto.Cipher.AES
def encrypt_password(hostname, password):
"""IPMIView stores its passwords encrypted with AES-128-CBC using
an all-zeros IV and the hostname as the key.
SO SECURE!"""
iv = b'\x00\x00\x00\x00\x00\x00\x00\... |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.4 on 2016-12-04 20:15
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('movies', '0022_userprofile'),
]
operations = [
migrations.AlterModelTable(
... |
from collections import Counter, OrderedDict
import torch
from transforms import (
PretrainedSPTokenizer,
PretrainedSPVocab,
PyTextVocabTransform,
PyTextScriptVocabTransform,
iterate_batch,
tokenizer_func,
totensor,
vocab_func,
)
from torchtext.experimental.transforms import (
basic_... |
"""Cancel an existing iSCSI account."""
# :license: MIT, see LICENSE for more details.
import click
import SoftLayer
from SoftLayer.CLI import environment
from SoftLayer.CLI import exceptions
from SoftLayer.CLI import formatting
@click.command()
@click.argument('volume-id')
@click.option('--reason', help="An option... |
from collections import namedtuple
import torch
from torch.nn import Conv2d, BatchNorm2d, PReLU, ReLU, Sigmoid, MaxPool2d, AdaptiveAvgPool2d, Sequential, Module, InstanceNorm2d
import torch.nn.functional as F
"""
ArcFace implementation from [TreB1eN](https://github.com/TreB1eN/InsightFace_Pytorch)
"""
class Flatten(... |
from collections import OrderedDict
from django import forms
from django.utils.translation import ugettext_lazy as _
from . import app_settings
from .helpers import get_foreign_keys
class BaseReportForm(object):
'''
Holds basic function
'''
def get_filters(self):
"""
Get the foreign... |
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
import base64
from copy import deepcopy
import json
import os
try:
from urllib.parse import urlparse
except ImportE... |
import torch
import numpy as np
# import bagread
# import matplotlib.pyplot as plt
import torch.nn as nn
import torch.nn.functional as F
import time
from ..util import get_data_maybe
NUM_HISTORY = 2
NUM_INPUTS = (NUM_HISTORY + 1) * 13
NUM_OUTPUTS = 18
NUM_HIDDEN_UNITS = 200
NUM_HIDDEN_LAYERS = 2
# NUM_ENSEMBLE = 1
#
... |
from fractions import Fraction
import operator
import pandas as pd
import numpy as np
from abc import ABCMeta, abstractmethod
from probability.concept.random_variable import RandomVariable, SetOfRandomVariable
def joint_distribution(series_or_dataframe):
from probability.probability_distribution import Probabil... |
"""
byceps.services.user.transfer.log
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:Copyright: 2006-2021 Jochen Kupperschmidt
:License: Revised BSD (see `LICENSE` file for details)
"""
from dataclasses import dataclass
from datetime import datetime
from typing import Any, Dict
from uuid import UUID
from ....typing import UserI... |
#Message App
#copyright (c) 2015 Tyler Spadgenske
#MIT License
################################
#To be packaged with stock TYOS#
################################
import pygame, time, os
from pygame.locals import *
class Run():
def __init__(self, fona):
self.fona = fona
self.next_app = None
... |
"""
Functions for validating the schema of repo-tools-data.
"""
import collections
import csv
import datetime
import difflib
import pathlib
import re
import yaml
from schema import And, Optional, Or, Schema, SchemaError
from yaml.constructor import ConstructorError
def valid_agreement(s):
"""Is this a valid "ag... |
"""Three earth-gravity models for use with SGP4."""
from collections import namedtuple
from propagation import getgravconst
EarthGravity = namedtuple(
'EarthGravity',
'tumin mu radiusearthkm xke j2 j3 j4 j3oj2',
)
wgs72old = EarthGravity(*getgravconst('wgs72old'))
wgs72 = EarthGravity(*getgravconst('wgs7... |
import sqlite3, random
names = ['ruan', 'stefan', 'philip', 'norman', 'frank', 'pete', 'johnny', 'peter', 'adam']
cities = ['cape town', 'johannesburg', 'pretoria', 'dublin', 'kroonstad', 'bloemfontein', 'port elizabeth', 'auckland', 'sydney']
lastnames = ['smith', 'bekker', 'admams', 'phillips', 'james', 'adamson']
w... |
# -*- coding: utf-8 -*-
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: comment.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.protobuf imp... |
from server import *
startServer()
|
# -*- coding: utf-8 -*-
"""Base exchange class"""
# -----------------------------------------------------------------------------
__version__ = '1.14.254'
# -----------------------------------------------------------------------------
from ccxt.base.errors import ExchangeError
from ccxt.base.errors import NotSuppo... |
# _*_ coding:utf-8 _*_
import logging
import re
from pyquery import PyQuery as pq
from app.spider_store.utils.content_cleaner import cleaner
from app.spider_store.common import (get_content, get_location)
"""***猎奇网爬虫***"""
def lieqi_news_download(url):
i = 1
content_list = []
title = None
source = ... |
# coding=utf-8
"""
Contains an abstract base class that supports data transformations.
"""
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import os
import numpy as np
import scipy
import scipy.ndimage
import time
import deepchem as dc
import tensorflow as... |
import gym
from .main import MarloEnvBuilder
def _register():
##########################################
# Version 0 of env
##########################################
gym.envs.registration.register(
id='MarLo-BuildbattleTrain1-v0',
entry_point=MarloEnvBuilder
)
|
import math
from ..problem import Problem
from ..algorithm_common import AlgorithmCommon as AC
class function_XinSheYang(Problem):
def __init__(self, size):
super().__init__(self, size)
self.MIN_VAL = -2*math.pi
self.MAX_VAL = math.pi
self.SCORE_MIN = -float('inf')
self.SC... |
# find a peak (any peak) if it exists.
import matplotlib.pyplot as plt
import numpy as np
NUM_POINTS = 51
# make random data the same for all instances
np.random.seed(0)
def build_peak_in_middle_data():
peak = np.floor(NUM_POINTS/2)
right = 2*peak - NUM_POINTS
uphill = np.arange(0, peak)
downhill =... |
# -*- coding: utf-8 -*-
# File generated according to DDataPlotter.ui
# WARNING! All changes made in this file will be lost!
## WARNING! All changes made in this file will be lost when recompiling UI file!
################################################################################
from PySide2.QtCore impo... |
#!/usr/bin/env python
"""Django's command-line utility for administrative tasks."""
import os
import sys
def main():
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'django_example.settings')
try:
from django.core.management import execute_from_command_line
except ImportError as exc:
... |
"""
Bulk walk Agent MIB (SNMPv2c)
+++++++++++++++++++++++++++++
Perform SNMP GETBULK operation with the following options:
* with SNMPv2c, community 'public'
* over IPv4/UDP
* to an Agent at demo.snmplabs.com:161
* for OID in tuple form
* with non-repeaters=0 and max-repeaters=25
This script performs similar to the ... |
"""Tests for Euclidean algorithms, GCDs, LCMs and polynomial remainder sequences. """
from sympy.polys.euclidtools import (
dup_gcdex, dup_half_gcdex, dup_invert,
dup_euclidean_prs, dmp_euclidean_prs,
dup_primitive_prs, dmp_primitive_prs,
dup_subresultants, dmp_subresultants,
dup_prs_resultant, dmp... |
# -*- coding: utf-8 -*-
"""
Created on Mon Sep 23 19:45:18 2019
@author: CHaithcock
"""
import sys
sys.path.insert(1, 'C:/Users/chaithcock/Documents/repos/RushHour/RHGraph')
import itertools
import numpy as np
import RHGeneratorConstants as gen
import RHState
c = 5
t = 2
c1 = np.arange(c//1 + 1) # num strips wit... |
from sqlalchemy import Column, Integer, String, DateTime, Boolean, ForeignKey
from sqlalchemy.orm import relationship
from sqlalchemy.sql import func
from app.db.base_class import Base
class Messages(Base):
id = Column(Integer, primary_key=True, index=True)
author_user_id = Column(Integer, ForeignKey("users.id... |
from .compress import make_new_fasttext_model, CompressedFastTextKeyedVectors # noqa - kepr for backward compatibility
|
"""
@author: Cem Akpolat
@created by cemakpolat at 2021-12-29
"""
|
c = [0, 0, 1, 0, 0, 1, 0] # len = 7
#c = [0, 0, 0, 1, 0, 0] # len = 6
i = len(c)
j = 0
jumps = 0
while j < i:
print("jumps: " + str(jumps))
if (j + 2 < i) and c[j + 2] == 0: #safe to skip ahead
j += 1
print("bonus j: " + str(j))
j += 1
print("reg j: " + str(j))
if (j < i):
ju... |
#!/usr/bin/env python
from __future__ import print_function
import os
import random
import numpy as np
from mpi4py import MPI
comm = MPI.COMM_WORLD # Communicator for the processes.
rank = comm.Get_rank() # What number process is this one?
size = comm.Get_size() # How many processes in total are there?
def che... |
# Generated by Django 2.1.8 on 2019-06-15 14:04
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('orders', '0001_initial'),
]
operations = [
migrations.RemoveField(
model_name='skucomments',
name='goods',
),
]
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.