content stringlengths 0 1.05M | origin stringclasses 2
values | type stringclasses 2
values |
|---|---|---|
#!/usr/bin/env python
import networkx as nx
import sys
with open('soc-sign-bitcoinotc.csv', 'r') as fin:
with open('bitcoinotc.in', 'a') as fout:
G = nx.DiGraph()
fout.write("Relation Edges" + '\n')
fout.write("From To" + '\n')
for line in fin:
n1, n2, rating, time = line.split(',')
fout.write(str(n1) ... | nilq/baby-python | python |
from __future__ import division
import copy
from Game.deck import *
from Game.column import *
from Game.heap import *
NB_CARDS_SUBDECK = 24
NB_HEAPS = 4
NB_COLUMNS = 7
IN_HEAP = 'heap'
IN_DECK = 'deck'
IN_COL = 'col'
UNDRAWN = 'undraw'
ACTIONS = ['draw', 'deck-heap', 'deck-col', 'col-heap', 'heap-col', 'col-col']
c... | nilq/baby-python | python |
from .transformer_factory import function_transformer # noqa
| nilq/baby-python | python |
import sys
import requests
import mysql.connector
import datetime
from mysql.connector import errorcode
from bs4 import BeautifulSoup
def get_link(argv):
hari = str(datetime.datetime.now().day)
bulan = str(datetime.datetime.now().month)
tahun = str(datetime.datetime.now().year)
url = "http://www.viva.... | nilq/baby-python | python |
from ..registry_tools import iso_register
from .core import UnitedStates
@iso_register('US-NY')
class NewYork(UnitedStates):
"""New York"""
include_lincoln_birthday = True
include_election_day_every_year = True
| nilq/baby-python | python |
"""jc - JSON CLI output utility `sfdisk` command output parser
Supports the following `sfdisk` options:
- `-l`
- `-F`
- `-d` (deprecated - only for older versions of util-linux)
- `-uM` (deprecated - only for older versions of util-linux)
- `-uC` (deprecated - only for older versions of util-linux)
- `-uS` (depre... | nilq/baby-python | python |
from __future__ import print_function
# vim: set fileencoding= UTF-8
#!usr/bin/python
"""Word Spot
ENG: Enter string. Output. All world in order they came in, if any word have appired more then once, print index in (paranthesise)
input: qwe sdf tyu qwe sdf try sdf qwe sdf rty sdf wer sdf wer
output:qwe(7) sdf(12) ... | nilq/baby-python | python |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import os
from typing import Dict, Tuple, Any, Set
from tabun_stat import utils
from tabun_stat.processors.base import BaseProcessor
class BirthdaysProcessor(BaseProcessor):
def __init__(self) -> None:
super().__init__()
# {(день, месяц): айдишники... | nilq/baby-python | python |
#!/usr/bin/python
"""
This script provides a set of tools to parse the vector and scalar files dumped
out of omnet simulation and indexed data and stats for use of other modules.
"""
from numpy import *
from glob import glob
from optparse import OptionParser
from pprint import pprint
from functools import partial
fro... | nilq/baby-python | python |
from Proxy import ProxyFactory, Proxy
from LRUCache import LRUCache
from utils import distance, stress, MAX_DISTANCE, LOWEST_STRESS
from typing import Hashable, List, Tuple, Dict, Any
class Origin:
def __init__(self, database, max_size_of_LRUCache : int, max_age_of_LRUCache: int, load_balancing_interval : int):
... | nilq/baby-python | python |
from __future__ import print_function
from .client import Client
__title__ = 'Steamfront'
__author__ = 'Callum Bartlett'
__license__ = 'MIT'
__copyright__ = 'Copyright 2017 Callum Bartlett'
__version__ = '0.1.0'
if __name__ == '__main__':
from sys import argv
if len(argv) < 2:
print('Please give the name of a ga... | nilq/baby-python | python |
import sys
from ctypes import *
sys.path.append('../')
#import vscp.udp as udp
#from vscp.vscp_class import *
#from vscp.vscp_type import *
from vscp import *
def makeClass2StrMeasurement( vscpclass, vscptype, strval ):
ex = vscp.vscpEventEx()
return ex
e = vscp.vscpEvent()
ex = vscp.vscpEventEx()
print(ty... | nilq/baby-python | python |
"""
Test cases for linear programming based on CVXOPT
This case is an economic dispatch code
"""
from cvxopt import matrix
from cvxopt import solvers
class LinearProgramming():
def run(self, PG_MAX, PG_MIN, CG, PD):
"""
:param PG_MAX: maximal generator output
:param PG_MIN: minimal gene... | nilq/baby-python | python |
import secrets
import redis
from app.core.config import settings
ok_status = {'detail': 'Ok'}
def generate_id():
return secrets.token_urlsafe(8)
class SingletonMeta(type):
_instances = {}
def __call__(cls, *args, **kwargs):
if cls not in cls._instances:
instance = super().__call_... | nilq/baby-python | python |
import json
import logging
import os
import pytest
from fhir2dataset.query import Query
from tests.tools import create_resource_test
log_format = "[%(asctime)s] [%(levelname)s] - %(message)s"
logging.basicConfig(level=logging.INFO, format=log_format)
@pytest.mark.parametrize(
"dirname, fhir_api_url",
[
... | nilq/baby-python | python |
''' Tst cases fro get_names method '''
import unittest
from spydrnet import ir
from spydrnet_physical.util import get_names
from spydrnet_physical.util import get_attr
class TestGetNames(unittest.TestCase):
''' Test case class '''
def setUp(self):
''' Basic element setup '''
self.definitio... | nilq/baby-python | python |
import random
from hashlib import sha256
def gen_password(user_password):
'''产生一个安全的密码'''
bin_password = user_password.encode('utf8') # 将密码转成 bytes 类型
hash_value = sha256(bin_password).hexdigest() # 计算用户密码的哈希值
salt = '%x' % random.randint(0x10000000, 0xffffffff) # 产生随机盐
safe_password = salt + h... | nilq/baby-python | python |
__author__ = 'Eric Weast'
__copyright__ = "Copyright 2014, Eric Weast"
__license__ = "GPL v2"
from .exceptions import EncodingError
from .exceptions import DecodingError
from .decoder import decode
from .decoder import decode_from_file
from .encode import encode | nilq/baby-python | python |
from copy import copy
from meerk40t.core.cutcode import RasterCut
from meerk40t.core.element_types import *
from meerk40t.core.node.node import Node
from meerk40t.core.parameters import Parameters
from meerk40t.core.units import Length
from meerk40t.image.actualize import actualize
from meerk40t.svgelements import Col... | nilq/baby-python | python |
"""
training script
date: 10/4
author: arabian9ts
"""
# escape matplotlib error
import matplotlib
matplotlib.use('Agg')
# escape tensorflow warning
import os
os.environ['TF_CPP_MIN_LOG_LEVEL']='2'
import datetime
import tensorflow as tf
import numpy as np
import pickle
import threading
import matplotlib.pyplot as p... | nilq/baby-python | python |
import unittest
from contiguous.structures import DataSection, Group
from contiguous.types import String
class TestContiguous(unittest.TestCase):
""" Test basic functionality with native Python types in schemas."""
def test_lengths(self):
data = DataSection(
String("name", 25),
... | nilq/baby-python | python |
from typing import List
class ListNode:
def __init__(self, val=0):
self.val = val
self.next = None
def insert_at_tail(nodes: List[int]) -> ListNode:
head = ListNode(nodes[0])
for node in nodes[1:]:
insert_helper(head, node)
return head
def insert_helper(head: ListNode, node... | nilq/baby-python | python |
import ast
import rest_framework.serializers as module_to_patch
from drf_jsonpatch.patcher import Patcher
from drf_jsonpatch.nodes.serialiazers import (
import_jsonpatch,
import_apply_json_patch,
if_apply_jsonpatch,
)
patch = Patcher(module_to_patch)
# ---- import jsonpatch ----
# added between django... | nilq/baby-python | python |
begin_unit
comment|'# Copyright 2012 Red Hat, Inc.'
nl|'\n'
comment|'# All Rights Reserved.'
nl|'\n'
comment|'#'
nl|'\n'
comment|'# Licensed under the Apache License, Version 2.0 (the "License"); you may'
nl|'\n'
comment|'# not use this file except in compliance with the License. You may obtain'
nl|'\n'
comment|'... | nilq/baby-python | python |
#!/usr/bin/env python
import argparse
import os
import sys
from lib.config import enable_verbose_mode, get_target_arch
from lib.util import execute_stdout
SOURCE_ROOT = os.path.abspath(os.path.dirname(os.path.dirname(__file__)))
def main():
os.chdir(SOURCE_ROOT)
args = parse_args()
if args.verbose:
ena... | nilq/baby-python | python |
from .pipenv_setup_comp import compare_deps
from ._version import (__title__, __description__, __url__, __version__,
__author__, __author_email__, __license__)
__all__ = ["compare_deps", "__title__", "__description__", "__url__",
"__version__", "__author__", "__author_email__", "__lic... | nilq/baby-python | python |
"""
@file: This file contains the database helper class that manages both 'users' and 'contacts' collections
@Note: Calling this with python will do nothing
"""
#------------------------------STANDARD DEPENDENCIES-----------------------------#
import json
import pickle, copyreg, ssl # for serializing User obje... | nilq/baby-python | python |
# https://leetcode.com/problems/keyboard-row
import re
class Solution(object):
def findWords(self, words):
"""
:type words: List[str]
:rtype: List[str]
"""
match_r1 = lambda w: bool(re.match("^[qwertyuiop]*$", w.lower()))
match_r2 = lambda w: bool(re.match("^[asdf... | nilq/baby-python | python |
from flask import Flask
from flask_sqlalchemy import SQLAlchemy
from flask_migrate import Migrate
app = Flask(__name__)
app.config.from_object("app.config.Config")
db = SQLAlchemy(app) #database object
migrate = Migrate(app,db) #object responsible for tracking changes in DB
from app import routes, models | nilq/baby-python | python |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright 2014 Junko Tsuji
# This script generates bed files as final outputs of
# DNA methylation pipeline by taking a CX_report file
# generated from bismark_methylation_extractor.
from optparse import OptionParser
import sys, os.path, string
# RGB strings and inte... | nilq/baby-python | python |
# -*- coding: utf-8 -*-
import random
from source.tree.heap import MinHeap, MaxHeap
# region INSERTION SORT
# 直接插入排序
def straight_insertion_sort(a, reverse=False):
"""
直接插入排序
基本操作:将一个记录插入到已排好序的有序表中,从而得到一个新的,记录数增加1的有序表。
:param a:
:param reverse:
:return:
"""
# 从无序表的第二条记录开始
for i i... | nilq/baby-python | python |
# Generated by Django 2.2.13 on 2021-02-25 16:22
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
("data_refinery_common", "0063_auto_20210212_1855"),
]
operations = [
migrations.AlterModelOptions(name="dataset", options={"base_manager_name": "obj... | nilq/baby-python | python |
from django.conf.urls import url
from views import FakeImageView
from . import views
urlpatterns = [
url(r'^', FakeImageView.as_view(),name='index.html'),
#url(r'^tweet_json/', FakeJSONView.as_view(),name='tweet_json.html')
] | nilq/baby-python | python |
#!/usr/bin/env python
import logging
import unittest
from decimal import Decimal
import pandas as pd
from hummingbot.connector.exchange.paper_trade.paper_trade_exchange import QuantizationParams
from hummingbot.core.clock import (
Clock,
ClockMode
)
from hummingbot.core.data_type.common import TradeType
from ... | nilq/baby-python | python |
class ClonedRepoExistedError(Exception):
"""Base class for other exceptions"""
pass
class BranchUpToDateException(Exception):
pass
class DefaultCommitToolException(Exception):
pass
class PotentialInfiniteLoopException(Exception):
pass | nilq/baby-python | python |
import os
from pathlib import Path
output = Path(os.path.abspath(__file__)).parent.parent / "output"
| nilq/baby-python | python |
# Copyright 2017 Spotify AB
#
# 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, softw... | nilq/baby-python | python |
### list all installed fonts plus it's variations
for fontName in installedFonts():
variations = listFontVariations(fontName)
if variations:
print(fontName)
for axis_name, dimensions in variations.items():
print (axis_name, dimensions)
print ()
| nilq/baby-python | python |
"""
Module for abstract serializer/unserializer base classes.
"""
from StringIO import StringIO
from django.core.serializers.base import SerializationError, DeserializationError
from django.core.exceptions import ObjectDoesNotExist
class Serializer(object):
"""
Abstract serializer base class.
"""
# ... | nilq/baby-python | python |
import unittest
from validator import format
class TestFormat(unittest.TestCase):
def test_invalid_yaml(self):
invalid_yaml = """
key: value
- item#1
- item#2
"""
(parsed, err) = format.validate(invalid_yaml)
self.assertIsNone(parsed)
self.assertEq... | nilq/baby-python | python |
# coding: utf-8
# # For Loops (2) - Looping through the items in a sequence
# In the last lesson we introduced the concept of a For loop and learnt how we can use them to repeat a section of code. We learnt how to write a For loop that repeats a piece of code a specific number of times using the <code>range()</code... | nilq/baby-python | python |
from django.test import TestCase
from django.utils import timezone
from datetime import timedelta
from decimal import Decimal
from blackbook.models import Currency, CurrencyConversion
class CurrencyTest(TestCase):
def testString(self):
currency = Currency.objects.create(name="Test Currency", code="TEST"... | nilq/baby-python | python |
import sys, string
import re
from ucscGb.gbData.ordereddict import OrderedDict
import collections
class RaStanza(OrderedDict):
'''
Holds an individual entry in the RaFile.
'''
@property
def name(self):
return self._name
def __init__(self, key=None, value=None):
OrderedDict.__i... | nilq/baby-python | python |
import json
from parserutils.strings import camel_to_snake
from ..query.fields import RENDERER_ALIASES
from ..query.fields import DictField, ObjectField
from .geometry import Extent
def to_words(cls_instance_or_name, as_string=True):
if isinstance(cls_instance_or_name, type):
class_name = cls_instance... | nilq/baby-python | python |
import sys
from typing import Optional, TextIO
from antlr4 import InputStream
from src.messages.message_lexer import message_lexer
class Lexer(message_lexer):
def __init__(self, key: str, inp: InputStream, output: TextIO = sys.stdout):
super().__init__(inp, output)
self._recent = None
self.... | nilq/baby-python | python |
start_node = '0'
end_node = '8'
def a_star(start_node, end_node):
open_set = set(start_node)
closed_set = set()
g = {} # Store distance from start node.
parents = {} # Parents contain an adjacent map of all nodes.
# Distance of start node from itself is zero
g[start_node] = 0
parents[start_node] = start... | nilq/baby-python | python |
import functools
import numpy as np
import jax
import jax.numpy as jnp
from jax import jit, vmap
from jax.ops import index, index_update
def get_ray_bundle(height, width, focal_length, tfrom_cam2world):
ii, jj = jnp.meshgrid(
jnp.arange(width, dtype=jnp.float32,),
jnp.arange(height, dtype=jnp.floa... | nilq/baby-python | python |
# coding: utf-8
"""
Author:
Weichen Shen,wcshen1994@163.com
Reference:
[1] Feng Y, Lv F, Shen W, et al. Deep Session Interest Network for Click-Through Rate Prediction[J]. arXiv preprint arXiv:1905.06482, 2019.(https://arxiv.org/abs/1905.06482)
"""
from collections import OrderedDict
from tensorflow.python.... | nilq/baby-python | python |
import pandas as pd
from ....Trade.Strategy.Cta.DyST_TraceFocus import *
from ....Trade.Strategy.DyStockCtaBase import *
from ....Trade.DyStockStrategyBase import *
class DyStockDataFocusAnalysisUtility(object):
"""
热点分析工具类
这个类有点特别,会借助DyST_FocusTrace类
"""
class DummyCtaEngine:
def... | nilq/baby-python | python |
from pathlib import Path
from six.moves.urllib.parse import urlunparse
from six.moves.urllib.error import HTTPError
from six.moves.urllib.request import urlretrieve
import logging
logger = logging.getLogger(__name__)
class HiRISE_URL(object):
"""Manage HiRISE URLs.
Provide a storage path as calculated from... | nilq/baby-python | python |
#!/usr/bin/env python
class Cart:
def __init__(self):
self.id = None
self.capacity = None
self.payload = None
self.last_known_location = None
| nilq/baby-python | python |
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
browser = webdriver.Chrome()
browser.get('https://www.dan.me.uk/bgplookup')
count=6535#接着上一次继续跑的初值
while count<=64511:
browser.find_element_by_name('asn').clear()
browser.find_element_by_name('asn').send_keys(count)
... | nilq/baby-python | python |
# hw06_03
import random
def makesentence():
subjects = ['Dog', 'Cat', 'Monkey', 'Pig', 'Fox']
verbs = ['walks', 'runs', 'jumps']
advs = ['slowly', 'quickly']
print('%s %s %s.' % (random.choice(subjects), random.choice(verbs), random.choice(advs)))
for i in range(5):
makesentence()
'''
Cat walk... | nilq/baby-python | python |
#!/usr/bin/python3
# -*- coding: utf-8 -*-
from PyQt5.QtCore import QThread, pyqtSignal
from handlers import APIHandler, LoadMusicHandler
from config import config
from vkapi import VKLightError
from utils import save_json, stat
class LoadMusic(QThread):
music = pyqtSignal(list)
error = pyqtSignal(str)
... | nilq/baby-python | python |
# Programa onde 4 jogadores jogam um dado e tem resultados aleatórios.
# Guarda esses resultados em um dicionário em Python. No final, coloca esse dicionário em ordem, sabendo que o
# vencedor tirou o maior número no dado.
from random import randint
from time import sleep
from operator import itemgetter
jogo = {'joga... | nilq/baby-python | python |
# (C) Datadog, Inc. 2018-present
# All rights reserved
# Licensed under a 3-clause BSD style license (see LICENSE)
from .__about__ import __version__
from .kafka_consumer import KafkaCheck
__all__ = ['__version__', 'KafkaCheck']
| nilq/baby-python | python |
import os
from multiprocessing.managers import BaseManager, BaseProxy
import numpy as np
import tensorflow as tf
from tensorflow.python.training import session_run_hook
from tensorflow.python.training.basic_session_run_hooks import SessionRunArgs
from rank_based import Experience
class sync_expericence(Experience):... | nilq/baby-python | python |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.8 on 2019-03-21 08:36
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('wildlifecompliance', '0147_merge_20190314_1451'),
]
operations = [
migratio... | nilq/baby-python | python |
""" A module for getting the class names for a dataset, in a single canonical order.
"""
import json
from folder import datasets_path
def get_class_data(dataset):
path = datasets_path / dataset / 'classes.json'
with path.open('r') as f:
class_data = json.load(f)
class_data.sort(key=lambda d:... | nilq/baby-python | python |
from .tell_os import is_linux
if is_linux():
import Xlib
import Xlib.display
from contextlib import contextmanager
from typing import Optional
from .abstract_desktop_monitor import AbstractDesktopMonitor
@contextmanager
def window_obj(display, win_id):
"""Simplify dealing with BadW... | nilq/baby-python | python |
from io import open
import requests
def test_scene():
image_data = open("scene.jpg", "rb").read()
response = requests.post(
"http://localhost:80/v1/vision/scene",
files={"image": image_data},
data={"api_key": "Mojohn1"},
).json()
assert response["success"] ==... | nilq/baby-python | python |
import seaborn as sns
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
def Hist(dataset, xlabel, filename): #Log Trip Duration His
sns.set_style("darkgrid")
sns.distplot(dataset, kde=True, rug=False)
plt.legend()
plt.xlabel(xlabel)
plt.ylabel('Frequency')
plt.tight_layo... | nilq/baby-python | python |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time : 2018/1/30 下午12:10
# @Author : wook
# @File : db.py
import pymysql
db = pymysql.connect(host="localhost", user="root", passwd="123123", db="mysql", port=3306, charset="utf8") # 连接对象
# 使用 cursor() 方法创建一个游标对象 cursor
cursor = db.cursor()
# 使用 execute() ... | nilq/baby-python | python |
import os
from flask import Flask
from flask_cors import CORS
from .extensions import db, bcrypt
from flask_socketio import SocketIO
from .models import users, messages
from .config import DevConfig, ProdConfig
socketio = SocketIO(cors_allowed_origins="*")
def create_app():
app = Flask(__name__)
app.config['... | nilq/baby-python | python |
"""
Copyright 2020 The OneFlow 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 applicable law or agr... | nilq/baby-python | python |
#!/usr/bin/env python3
import os
import random
import sys
import string
import random
if len(sys.argv) < 2:
print(f'Usage: {sys.argv[0]} <target>')
sys.exit(1)
ip = sys.argv[1]
print("Hello! I am a little sploit. I could be written on any language, but "
"my author loves Python. Look at my source - it... | nilq/baby-python | python |
"""
IMPORT STEP
"""
import re
import datetime
import time
import traceback
import sys
import json
from math import ceil
from pyspark import SparkConf, SparkContext
from pyspark.sql import SQLContext, Row
from pyspark.sql.types import *
from pyspark.sql.functions import lit, col, udf
def save_txt(document, path):
... | nilq/baby-python | python |
"""Tests for calculator.py."""
__author__ = 'Boris Polyanskiy'
import unittest
from party_calc.calculator import Person, PartyCalculator
class TestPerson(unittest.TestCase):
def test_init(self) -> None:
person = Person('mr.White')
self.assertEqual(person.name, 'mr.White')
self.assertEqu... | nilq/baby-python | python |
from django.db import models
# Create your models here.
class Permission(models.Model):
"""
权限表
"""
hide_type_choices = (
(1, 'FALSE'),
(2, 'TRUE'),
)
route_url = models.CharField(max_length=64, verbose_name="路由路径", unique=True)
route_name = models.CharField(max_length=32,... | nilq/baby-python | python |
from flask import Flask
from config import app_config
from app.database import create_tables
from app.api.views.user_endpoints import user
from app.api.views.meetup_endpoints import meetup
from app.api.utils.errors import err, bad_request, internal_server_error, not_found, method_not_allowed
def create_app(config_name... | nilq/baby-python | python |
import unittest
from camera_trap_classifier.data.importer import DatasetImporter
class ImportFromCSVSingleImageTester(unittest.TestCase):
""" Test Import from CSV """
def setUp(self):
path = './test/test_files/dataset_single_image_multi_species.csv'
source_type = 'csv'
params = {'path... | nilq/baby-python | python |
#! /usr/bin/env python
#
# Licensed to Elasticsearch under one or more contributor
# license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright
# ownership. Elasticsearch licenses this file to you under
# the Apache License, Version 2.0 (the "License"); you may
... | nilq/baby-python | python |
import os
import pdb
from django import forms
from django.conf import settings
from django.contrib.auth import forms as auth_forms
from django.contrib.auth import password_validation
from django.core.files.uploadedfile import UploadedFile
from django.forms.widgets import FileInput
from django.utils import timezone
fro... | nilq/baby-python | python |
'''
作者:邱少一
功能:
1.0功能:模拟投掷一个骰子
2.0新增功能:模拟投掷两个骰子
3.0新增功能:可视化投掷两个骰子的结果
4.0新增功能:=======直方图可视化作图和统计工具:matplotlib
5.0新增功能:=======科学计算工具:numpy
版本:1.0
日期:2017/12/1
学习:1、随机数:random():0到1的数;uniform(a,b):a到b的随机浮点数;randint(a,b):a到b的随机数
choice(<list>):随机从list中取一个元素 ;shuffle(<list>):将列表中元素打乱,sample(<list>,k):从列表... | nilq/baby-python | python |
job_list = [
"python3 exp_neurolisp.py -o -t suite --dump --path=./test_data/suite_data/",
"python3 exp_neurolisp.py -o -t unify_mem --mem_size=2000 --dump --path=./test_data/unify_data/mem_test/",
"python3 exp_neurolisp.py -o -t unify_mem --mem_size=2500 --dump --path=./test_data/unify_data/mem_test/",
... | nilq/baby-python | python |
# Copyright (c) 2020 ING Bank N.V.
#
# 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, modify, merge, publish, distr... | nilq/baby-python | python |
#!/usr/bin/env python3
# Copyright 2004-present Facebook. All Rights Reserved.
import json
import unittest
from network_health_service.stats.fetch_stats import get_link_queries, get_node_queries
from network_health_service.stats.metrics import Metrics
class CreateQueryTests(unittest.TestCase):
def setUp(self) -... | nilq/baby-python | python |
import pathlib
import os
from argparse import ArgumentParser
from e3372 import WebAPI, SMSHandler, SMS
config_dir = os.path.join(pathlib.Path.home(), '.e3372-sms-handler')
trusted_phone = ''
def sms_handler(sms: SMS, api: WebAPI):
global trusted_phone
print(f'from={sms.phone}, date={sms.date}, text={sms.t... | nilq/baby-python | python |
# hex
<warning descr="Python version 2.6, 2.7, 3.4, 3.5 do not support underscores in numeric literals">0xCAFE_F00D</warning>
# oct
<warning descr="Python version 2.6, 2.7, 3.4, 3.5 do not support underscores in numeric literals">0o1_23</warning>
<error descr="Python version 3.6 does not support this syntax. It requir... | nilq/baby-python | python |
#!/usr/bin/env python
"""
Generate framework agreement signature pages from supplier "about you"
information for suppliers who successfully applied to a framework.
Usage:
scripts/framework-applications/generate-framework-agreement-signature-pages.py
[-v...] [options]
<stage> <framework> <output_dir... | nilq/baby-python | python |
# Generated by Django 2.2.3 on 2019-10-21 08:40
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('devices', '0001_initial'),
('users', '0001_initial'),
]
operations = [
migrations.AddField(
... | nilq/baby-python | python |
import gevent
from gevent import wsgi
import test__pywsgi
from test__pywsgi import *
del TestHttps
test__pywsgi.server_implements_chunked = False
test__pywsgi.server_implements_pipeline = False
test__pywsgi.server_implements_100continue = False
TestCase.get_wsgi_module = lambda *args: wsgi
if __name__ == '__main__':... | nilq/baby-python | python |
import nau7802py, time
myScale = nau7802py.NAU7802() # Create instance of the NAU7802 class
#
# Begin void setup() equivalent
#
print('Qwiic Scale Example')
if not myScale.begin():
print('Scale not detected. Please check wiring. Freezing...')
while True:
pass
print('Scale detected!')
#
# Begin voi... | nilq/baby-python | python |
import unittest
# These can't be imported until the test_imported_enums_proto module has been built.
Status = None
MessageID = None
ExposesInternalEnumConstantsMessageinternal_enum = None
UsesImportedEnumsMessage = None
class ImportedEnumsTest(unittest.TestCase):
@classmethod
def setUpClass(cls):
gl... | nilq/baby-python | python |
# Generated by Django 3.2.5 on 2021-07-17 13:11
import contest.models
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_... | nilq/baby-python | python |
import logging
from contextlib import contextmanager, AbstractContextManager
from typing import Callable
from sqlalchemy import create_engine
from sqlalchemy.ext.declarative import as_declarative, declared_attr
from sqlalchemy.orm import Session, sessionmaker, scoped_session
logger = logging.getLogger(__name__)
@as_... | nilq/baby-python | python |
from flask import Flask, render_template, redirect, session, request
import random
import datetime
app = Flask(__name__)
app.secret_key = "12345678asdfghjk"
@app.route('/')
def index():
if not 'gold' in session:
session['gold'] = 0
if not 'log' in session:
session['log'] = ["Thanks for joining the game!"]
retu... | nilq/baby-python | python |
from django.apps import AppConfig
class PersonConfig(AppConfig):
name = 'person'
| nilq/baby-python | python |
#
# Copyright 2017-2018 European Centre for Medium-Range Weather Forecasts (ECMWF).
#
# 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... | nilq/baby-python | python |
from hazma.decay import charged_pion, muon, neutral_pion
from hazma.field_theory_helper_functions.common_functions import minkowski_dot as MDot
from hazma.parameters import electron_mass as me
from hazma.parameters import muon_mass as mmu
from hazma.parameters import charged_pion_mass as mpi
from hazma.parameters imp... | nilq/baby-python | python |
# -*- coding: utf-8 -*-
"""Test settings"""
import os
# Set your environment variables for testing or put values here
# user email or phone number
USER_LOGIN = os.getenv('VK_USER_LOGIN', '')
USER_PASSWORD = os.getenv('VK_USER_PASSWORD', '')
# aka API/Client ID
APP_ID = os.getenv('VK_APP_ID')
PHONE_NUMBER = os.getenv... | nilq/baby-python | python |
import cost_funcs.info as info
import cost_funcs.standard as std
import pytest
def test_bounds_eggholder():
assert info.get_bounds(std.eggholder, 2)[0][0] == -512
def test_bounds_michal_dim():
for dim in range(10):
assert len(info.get_bounds(std.michal, dim)) == dim
def test_function_name_eggholde... | nilq/baby-python | python |
import re
from django.core import exceptions as core_exceptions
from api.models import Contributor, ExtendedField, ProductType
from api.facility_type_processing_type import (
get_facility_and_processing_type,
)
def extract_int_range_value(value):
"""
Excel workbooks mat contain decimal values for number_o... | nilq/baby-python | python |
import os
import json
from collections import namedtuple
import shutil
import pytest
import responses
from coincurve import PrivateKey
from requests.exceptions import ConnectionError
import common.receipts as receipts
from common.tools import compute_locator, is_compressed_pk
from common.appointment import Appointment... | nilq/baby-python | python |
import requests
import json
def post_to_rapidapps(body):
url = "https://rapid-apps-2475.eu-gb.mybluemix.net/services/2984dcb289ef8da69bfdc2442546d334"
payload = {
"iduser":body['iduser'],
"firstname":body['firstname'],
"lastname":body['lastname'],
"height":body['height'],
... | nilq/baby-python | python |
# BerylDB - A modular database.
# http://www.beryldb.com
#
# Copyright (C) 2021 Carlos F. Ferry <cferry@beryldb.com>
#
# This file is part of BerylDB. BerylDB is free software: you can
# redistribute it and/or modify it under the terms of the BSD License
# version 3.
#
# More information about our licensing can be fou... | nilq/baby-python | python |
# Generated by Django 3.1.2 on 2021-02-09 12:17
from django.db import migrations, models
import django.utils.timezone
class Migration(migrations.Migration):
dependencies = [
('mvp', '0016_notification_ratings'),
]
operations = [
migrations.CreateModel(
name='Hub_User',
... | nilq/baby-python | python |
import cv2
import numpy as np
import matplotlib.pyplot as plt
'''
创建一个SURF对象:
cv2.xfeatures2d.SURF_create(, hessianThreshold, nOctaves, nOctaveLayers, extended, upright)
hessianThreshold:默认100
nOctaves:金字塔组数默认4
nOctaveLayers:每组金子塔的层数默认3
extended:默认False,扩展描述符标志,False表示使用64个元素描述符。
upright:默认... | nilq/baby-python | python |
# terrascript/provider/rancher/rancher2.py
# Automatically generated by tools/makecode.py (24-Sep-2021 15:25:37 UTC)
import terrascript
class rancher2(terrascript.Provider):
"""Terraform Rancher2 provider"""
__description__ = "Terraform Rancher2 provider"
__namespace__ = "rancher"
__name__ = "ranche... | nilq/baby-python | python |
#!/usr/bin/env python
import rospy
import numpy as np
from nav_msgs.msg import OccupancyGrid
from geometry_msgs.msg import PoseStamped
from tf import TransformListener
from copy import deepcopy
class MapWhiteout:
def map_callback(self, map):
print("received map!")
self.map = map
if self.... | nilq/baby-python | python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.