content stringlengths 0 1.05M | origin stringclasses 2
values | type stringclasses 2
values |
|---|---|---|
#! /usr/bin/env python
#-******************************************************************************
#
# Copyright (c) 2012-2013,
# Sony Pictures Imageworks Inc. and
# Industrial Light & Magic, a division of Lucasfilm Entertainment Company Ltd.
#
# All rights reserved.
#
# Redistribution and use in source and bina... | nilq/baby-python | python |
# Copyright 2022 The Balsa 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 wr... | nilq/baby-python | python |
# -*- coding: utf-8 -*-
"""Main module."""
import sys
import urllib.request
import re
def main():
'''Checks that an argument has been given, otherwise returns and error. Then checks that the file contains something.
Then it converts the file to a string, takes the first line as the size of the array for our ... | nilq/baby-python | python |
import os
import logging
import sys
import tempfile
from setuptools import setup, find_packages
from setuptools.command.install import install
VERSION='1.1.4'
def readme():
"""Use `pandoc` to convert `README.md` into a `README.rst` file."""
if os.path.isfile('README.md') and any('dist' in x for x in sys.argv[1:]... | nilq/baby-python | python |
import argparse
class Arguments():
def __init__(self):
self.parser = argparse.ArgumentParser(
description='''
Quick & easy to use nutritional supplement tracking software
https://github.com/ncdulo/suppylement
'''
)
# Shoul... | nilq/baby-python | python |
from timeslot import TimeSlot, sort_by_begin_time, sort_by_end_time
from random import shuffle
import arrow, timeslot
#############################################################################
#
# Testing Merge
#
#############################################################################
def test_merge_unable():... | nilq/baby-python | python |
from zoloto.cameras.camera import Camera # noqa
from zoloto.cameras.file import ImageFileCamera, VideoFileCamera # noqa
| nilq/baby-python | python |
from dagster_graphql.client.query import START_PIPELINE_EXECUTION_MUTATION, SUBSCRIPTION_QUERY
from dagster_graphql.implementation.context import DagsterGraphQLContext
from dagster_graphql.implementation.pipeline_execution_manager import SubprocessExecutionManager
from dagster_graphql.schema import create_schema
from d... | nilq/baby-python | python |
from datetime import timedelta
import pendulum
import pytest
import logging
from uuid import uuid4
from unittest.mock import MagicMock
import prefect
from prefect.client.client import FlowRunInfoResult, ProjectInfo
from prefect.engine import signals, state
from prefect.run_configs import UniversalRun
from prefect.bac... | nilq/baby-python | python |
import time
import random
import logging
from datetime import datetime
from osgate.connectors.connector import AbstractConnector, ConnectorBase
log = logging.getLogger(__name__)
class DefaultConnector(AbstractConnector, ConnectorBase):
"""Used for testing of design pattern; allows non-existing connector and dev... | nilq/baby-python | python |
from os import environ, path
from ._settings_default import *
from ..exceptions import ImproperlyConfigured
PROFILE = environ.get("GOLD_DIGGER_PROFILE", "local")
if PROFILE == "master":
from ._settings_master import *
elif PROFILE == "local":
try:
from ._settings_local import *
except ImportError... | nilq/baby-python | python |
from django.urls import path
from . import views
urlpatterns = [
path('', views.data_view, name='data_view'),
] | nilq/baby-python | python |
from random import randint
class Die():
"""表示一个骰子的类"""
def __init__(self,number_size = 6):
self.number_size = number_size
#翻滚骰子
def roll(self):
"""返回一个位于1和骰子面数之间的随机数"""
return randint(1,self.number_size) | nilq/baby-python | python |
"""Voorbeeld met 2 armen."""
from asyncgcodecli import UArm
async def move_script(uarms: UArm):
"""Script that moves the robot arm."""
# set de robot arm mode to 0 (pomp)
for uarm in uarms:
uarm.set_mode(0)
for _ in range(1, 5):
for uarm in uarms:
await uarm.sleep(0)
... | nilq/baby-python | python |
from django.db import models
# Create your models here.
class List(models.Model):
item = models.CharField(max_length=200)
completed = models.BooleanField(default=False)
def __str__(self):
return self.item + ' | ' + str(self.completed)
| nilq/baby-python | python |
import unittest
import logging
from varfilter import filter
class Testfilter(unittest.TestCase):
def setUp(self):
print('Preparando el contexto')
def test_fint_int_ok(self):
print('fint con entero correcto')
t = filter.fint(10)
self.assertEqual(t, 10)
def test_fint_str_o... | nilq/baby-python | python |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
from django.conf import settings
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('spam', '0001_initial'),
]
operat... | nilq/baby-python | python |
from messagebird.base import Base
from messagebird.formats import Formats
from messagebird.hlr import HLR
class Lookup(Base):
def __init__(self):
self.href = None
self.countryCode = None
self.countryPrefix = None
self.phoneNumber = None
self.type = None
self._format... | nilq/baby-python | python |
# import commands
import commands
# password helper
import json
from getpass import getpass
# define 'submitnonce' command
def parse(cmd, arguments, connection):
if len(arguments) != 2:
print("error: '"+cmd.name+"' requires one argument.")
else:
nonce = arguments[1]
response, result ... | nilq/baby-python | python |
"""
*C♯ - Level 4*
"""
from ..._pitch import Pitch
__all__ = ["Cs4"]
class Cs4(
Pitch,
):
pass
| nilq/baby-python | python |
for i in range(1,5): #More than 2 lines will result in 0 score. Do not leave a blank line also
print(int(pow(10,i)/9) * i) | nilq/baby-python | python |
import datetime
import getpass
import os
import platform
import pwd
import socket
import sys
import time
def collect_python_facts():
return {
'version': {
'major': sys.version_info[0],
'minor': sys.version_info[1],
'micro': sys.version_info[2],
'releaselevel... | nilq/baby-python | python |
"""Token module to indicate that a feed plugin for LOFAR can be generated from
here.
"""
# Since the LOFAR project provides an AntPat compatible file of beam-model data,
# no initialization steps are necessary.
| nilq/baby-python | python |
"""
A collection of modules for collecting, analyzing and plotting
financial data. User contributions welcome!
"""
#from __future__ import division
import os, time, warnings, md5
from urllib import urlopen
try: import datetime
except ImportError:
raise SystemExit('The finance module requires datetime support... | nilq/baby-python | python |
"""This script uses web.py to control and retreive the state of thermostats in a home.
"""
import json
import random
import web
# web.py definition that maps /anything to the Index class defined below
urls = ('/(.*)', 'Index')
# In memory database for existing sensors
sensor_devices_in_home = {}
def setup_devices(... | nilq/baby-python | python |
#
# Copyright (c) 2015-2016 Wind River Systems, Inc.
#
# SPDX-License-Identifier: Apache-2.0
#
import errno
import functools
import select
import socket
def syscall_retry_on_interrupt(func, *args):
"""Attempt system call again if interrupted by EINTR """
for _ in range(0, 5):
try:
return f... | nilq/baby-python | python |
# -*- coding: utf-8 -*-
#
# Copyright 2015 Ternaris, Munich, Germany
#
# 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, c... | nilq/baby-python | python |
import numpy as np
def calculate_predictions(events, cluster_info):
# This function takes existing events, and backtracks this to predictions.
predictions = np.empty((len(cluster_info), 2), dtype=np.float64)
# The predictions matrices are stored (for historical reasons) in microns. So multiply with pixel... | nilq/baby-python | python |
import os
import unittest
from __main__ import vtk, qt, ctk, slicer
#
# TortuosityLogicTests
#
class TortuosityLogicTests:
def __init__(self, parent):
parent.title = "TortuosityLogicTests" # TODO make this more human readable by adding spaces
parent.categories = ["Testing.TestCases"]
parent.dependencies... | nilq/baby-python | python |
#!/usr/bin/env python3
# author: greyshell
# description: demo how to use heapq library
import heapq
class MaxHeapNode(object):
def __init__(self, key):
self.key = key
def __lt__(self, other):
# compare based on val
# tweak the comparison logic to build max heap: change less_than_si... | nilq/baby-python | python |
import logging
from gehomesdk.erd.converters.abstract import ErdReadOnlyConverter
from gehomesdk.erd.converters.primitives import *
from gehomesdk.erd.values.laundry import ErdTankSelected, TankSelected, TANK_SELECTED_MAP
_LOGGER = logging.getLogger(__name__)
class TankSelectedConverter(ErdReadOnlyConverter[TankSele... | nilq/baby-python | python |
#!/usr/bin/env python
"""This script generates a two-column reStructuredText table in which:
- each row corresponds to a module in a Python package
- the first column links to the module documentation
- the second column links to the module source code generated by
the 'viewcode' extension
"""
__date__ =... | nilq/baby-python | python |
# ------------------------------------
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
# ------------------------------------
import os
import uuid
from azure.keyvault.certificates import CertificateClient, CertificatePolicy
from key_vault_base import KeyVaultBase
class KeyVaultCertificates(Ke... | nilq/baby-python | python |
import os
import dropbox
from .cloud_provider import CloudProvider
class DBox(CloudProvider):
def __init__(self, access_token):
"""
Initializes class
Parameters
----------
access_token : str
Dropbox access token
"""
if not isinstance(access_tok... | nilq/baby-python | python |
#####################################
# CELERY
#####################################
from datetime import timedelta
from kombu import Exchange
from kombu import Queue
def celery_queue(key):
return Queue(key, Exchange(key), routing_key=key)
CELERY_CREATE_MISSING_QUEUES = True
CELERY_DEFAULT_QUEUE = 'default'
CE... | nilq/baby-python | python |
from django.db import models
from django.core.validators import MaxValueValidator, MinValueValidator
from authentication.models import Account
from authentication.models import AccountManager
class Entity(models.Model):
created_at = models.DateTimeField(auto_now_add=True)
created_by = Account
updated_at = ... | nilq/baby-python | python |
# Lint as: python3
# Copyright 2021 Jose Carlos Provencio
#
# 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 applicabl... | nilq/baby-python | python |
from flask import url_for, request
from flask_restplus import Namespace, Resource
import strongr.restdomain.model.gateways
from strongr.restdomain.model.oauth2 import Client
ns = Namespace('oauth', description='Operations related to oauth2 login')
@ns.route('/revoke', methods=['POST'])
class Revoke(Resource):
de... | nilq/baby-python | python |
from hs_students import HighSchool
highSchoolStudent = HighSchool('Manasvi', 10)
print(highSchoolStudent.get_name_captalize())
print(highSchoolStudent.get_School_name())
| nilq/baby-python | python |
from django.conf.urls import url
from . import views
from django.conf import settings
from django.conf.urls.static import static
from django.urls import path
from photos import views
from .views import BlogCreateView
urlpatterns =[
path('post/new/', BlogCreateView.as_view(), name='post_new'),
url(r'^one/', vi... | nilq/baby-python | python |
from tests.util import BaseTest
class Test_C2025(BaseTest):
def error_code(self) -> str:
return "C2025"
def test_fail_1(self):
code = """
foo = (1 if True
else 0)
"""
result = self.run_flake8(code, True)
self.assert_error_at(result, "C2025", 1, 8... | nilq/baby-python | python |
"""
This following demonstrates a Noise_NNpsk0+psk2_25519_ChaChaPoly_BLAKE2s handshake and initial transport messages.
"""
from dissononce.processing.impl.handshakestate import HandshakeState
from dissononce.processing.impl.symmetricstate import SymmetricState
from dissononce.processing.impl.cipherstate import CipherSt... | nilq/baby-python | python |
from invoke import (
run,
task,
)
from . import common
LANGUAGE = 'js'
@task
def clean():
print 'cleaning %s...' % (LANGUAGE,)
with common.base_directory():
run("rm -rf %(language)s && mkdir %(language)s" % {'language': LANGUAGE})
@task(default=True)
def compile():
print 'compiling %s.... | nilq/baby-python | python |
import math
from typing import List
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch import Tensor
def _initialize_embeddings(weight: Tensor, d: int) -> None:
d_sqrt_inv = 1 / math.sqrt(d)
# This initialization is taken from torch.nn.Linear and is equivalent to:
# nn.init.kai... | nilq/baby-python | python |
#!/usr/bin/python3
# Extract Ansible tasks from tripleo repos
import os
import yaml
TASK_ATTRS = [
"action",
"any_errors_fatal",
"args",
"async",
"become",
"become_exe",
"become_flags",
"become_method",
"become_user",
"changed_when",
"check_mode",
"collections",
"c... | nilq/baby-python | python |
from searx import settings, autocomplete
from searx.languages import language_codes as languages
from searx.url_utils import urlencode
COOKIE_MAX_AGE = 60 * 60 * 24 * 365 * 5 # 5 years
LANGUAGE_CODES = [l[0] for l in languages]
LANGUAGE_CODES.append('all')
DISABLED = 0
ENABLED = 1
class MissingArgumentException(Ex... | nilq/baby-python | python |
from scapy.all import *
from ccsds_base import CCSDSPacket
class PL_IF_HK_TLM_PKT_TlmPkt(Packet):
"""Pl_if App
app = PL_IF
command = HK_TLM_PKT
msg_id = PL_IF_HK_TLM_MID = 0x09de = 0x0800 + 0x1de
"""
name = "PL_IF_HK_TLM_PKT_TlmPkt"
fields_desc = [
# APPEND_ITEM CMD_VALID_COUNT 16... | nilq/baby-python | python |
from autorop.bof.Corefile import Corefile
| nilq/baby-python | python |
import netaddr
from django.urls import reverse
from sidekick.models import (
LogicalSystem, RoutingType,
NetworkServiceType, NetworkService,
NetworkServiceGroup,
)
from .utils import BaseTest
class NetworkServiceTest(BaseTest):
# Logical System
def test_logicalsystem_basic(self):
v = Lo... | nilq/baby-python | python |
"""
Http related errors
"""
class HTTPError(Exception):
""" Base class for all http related errors """
status_code = 500
class HTTPForbidden(HTTPError):
""" Http forbidden error (status code 403). """
status_code = 403
class HTTPBadRequest(HTTPError):
""" Client sent a bad request. """
sta... | nilq/baby-python | python |
# coding=utf-8
"""
Port of the ganglia gearman collector
Collects stats from gearman job server
#### Dependencies
* gearman
"""
from diamond.collector import str_to_bool
import diamond.collector
import os
import subprocess
import time
try:
import gearman
except ImportError:
gearman = None
class Gearma... | nilq/baby-python | python |
import requests
print requests.delete("http://localhost:7215/player/", json={"uid": "K/1H5bdxo7GwMBUp8qVQz42h7ZE=", }).content
print requests.put("http://localhost:7215/player/", json={"uid": "K/1H5bdxo7GwMBUp8qVQz42h7ZE=", "team": "emc", "rank": "grunt",}).content
#print requests.put("http://localhost:7215/battlemo... | nilq/baby-python | python |
from django.conf.urls import url
from django.contrib import admin
from django.contrib.auth.views import login, logout
from chat.views import index,register_page
app_name= "multichat"
urlpatterns = [url(r'^home/$', index),
url(r'^$', index),
url(r'^register/$', register_page),
url(r'^accounts/login/$', l... | nilq/baby-python | python |
from .game_move import GameMove
from .game_node import GameNode
from .game_state import GameState
from .game_tree import GameTree
# from .game import Game
from .game_multithread import GameMultithread
| nilq/baby-python | python |
from coders import NoopCoder
from sources import CsvFileSource
| nilq/baby-python | python |
# built-in
import ctypes;
import os;
# import matey shared library
current_dir = os.path.dirname(__file__);
matey_path = os.path.join(current_dir, "matey.so");
libmatey = ctypes.CDLL(matey_path);
#### SUM #######################################################################
libmatey.sum.restype = ctypes.c_int;
lib... | nilq/baby-python | python |
# -*- coding: utf-8 -*-
from setuptools import setup, find_packages
with open('README.md', 'r') as rm:
long_desc = rm.read()
setup(
name='soloman',
version='3.0.2',
description='For the love of Artificial Intelligence, Python and QML',
long_description=long_desc,
long_description_content_type=... | nilq/baby-python | python |
from email.charset import Charset, QP
from email.mime.text import MIMEText
from .base import AnymailBaseBackend, BasePayload
from .._version import __version__
from ..exceptions import AnymailAPIError, AnymailImproperlyInstalled
from ..message import AnymailRecipientStatus
from ..utils import get_anymail_setting, UNSE... | nilq/baby-python | python |
import pandas as pd
import numpy as np
class omdf:
def __init__(self,dff):
self.df = dff
self.arr = self.df.to_numpy()
def df_add_col_instr(self):
self.df['cat'] = self.df.apply(lambda row: TS(row.Summary), axis = 1)
return self.df.to_dict()
def df_add_col_dic(self,colname,... | nilq/baby-python | python |
# -*- coding: utf-8 -*-
from __future__ import print_function, unicode_literals, absolute_import, division
""" http://projecteuler.net/index.php?section=problems&id=18 triangle
it has been finished in 10 minutes
using recursive method is prefered, brute force not feasible to solve this problem
"""
from proje... | nilq/baby-python | python |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# 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, ... | nilq/baby-python | python |
# -*- coding: utf-8 -*-
'''
Este módulo tiene todas las funciones pertinentes para obtener y/o calcular los diferentes parámetros del modelo a partir de datos y/o parámetros del artículo de Arenas.
Convención del vector de parámetros siguiendo la Supplementary Table 1 de [1]:
# Parámetros usuales
β = ... | nilq/baby-python | python |
"""Support for TPLink lights."""
from __future__ import annotations
import logging
from typing import Any
from kasa import SmartDevice
from homeassistant.components.light import (
ATTR_BRIGHTNESS,
ATTR_COLOR_TEMP,
ATTR_HS_COLOR,
ATTR_TRANSITION,
COLOR_MODE_BRIGHTNESS,
COLOR_MODE_COLOR_TEMP,
... | nilq/baby-python | python |
# -*- coding: utf-8 -*-
import logging
import allel
import h5py
import os
import os.path
import haplotype_plot.constants as constants
import haplotype_plot.reader as reader
import haplotype_plot.filter as strainer
import haplotype_plot.haplotyper as haplotyper
import numpy as np
logger = logging.getLogger(... | nilq/baby-python | python |
import torch
import transformers
from packaging import version
from torch.utils.data import SequentialSampler
from transformers import BertConfig, BertForSequenceClassification
from .registry import non_distributed_component_funcs
def get_bert_data_loader(
batch_size,
total_samples,
sequence_... | nilq/baby-python | python |
# SPDX-FileCopyrightText: 2021 European Spallation Source <info@ess.eu>
# SPDX-License-Identifier: BSD-3-Clause
__author__ = 'github.com/wardsimon'
__version__ = '0.0.1'
import numpy as np
import pytest
from easyCore.Objects.Base import Descriptor, Parameter, BaseObj
from easyCore.Objects.Groups import BaseCollecti... | nilq/baby-python | python |
#!/usr/bin/env python3
import csv
import itertools as it
import os
import sys
def write_csv(f, cols, machines, variants):
w = csv.writer(f, delimiter=',')
headers = ["{}-{}".format(m, v) for (m, v) in it.product(machines, variants)]
w.writerow(headers)
for e in zip(*cols):
w.writerow(list(e))
... | nilq/baby-python | python |
import torch
from torch.autograd import Variable
from deepqmc.wavefunction.wf_orbital import Orbital
from deepqmc.wavefunction.molecule import Molecule
from pyscf import gto
import matplotlib.pyplot as plt
import numpy as np
import unittest
class TestAOvalues(unittest.TestCase):
def setUp(self):
# def... | nilq/baby-python | python |
from math import ceil
from struct import pack, unpack
import numpy as np
import ftd2xx as ftd
from timeflux.core.node import Node
from timeflux.helpers.clock import now
from timeflux.core.exceptions import WorkerInterrupt, TimefluxException
VID = 0x24f4 # Vendor ID
PID = 0x1000 # Product ID
HEADER = 0xAA... | nilq/baby-python | python |
first = "0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1... | nilq/baby-python | python |
# -*- coding: utf-8 -*-
# Copyright (c) 2018-2021, earthobservations developers.
# Distributed under the MIT License. See LICENSE for more info.
"""
=====
About
=====
Example for DWD RADOLAN Composite RW/SF using wetterdienst and wradlib.
Hourly and gliding 24h sum of radar- and station-based measurements (German).
Se... | nilq/baby-python | python |
# -*- encoding: utf-8 -*-
import pandas as pd
import pytest
from deeptables.datasets import dsutils
from deeptables.models import deeptable
from deeptables.utils import consts
class TestModelInput:
def setup_class(cls):
cls.df_bank = dsutils.load_bank().sample(frac=0.01)
cls.df_movielens = dsuti... | nilq/baby-python | python |
# This file is part of Moksha.
# Copyright (C) 2008-2010 Red Hat, 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 b... | nilq/baby-python | python |
from ctypes import *
SHM_SIZE = 4096
SHM_KEY = 67483
try:
rt = CDLL('librt.so')
except:
rt = CDLL('librt.so.1')
shmget = rt.shmget
shmget.argtypes = [c_int, c_size_t, c_int]
shmget.restype = c_int
shmat = rt.shmat
shmat.argtypes = [c_int, POINTER(c_void_p), c_int]
shmat.restype = c_void_p
shmctl = rt.shmct... | nilq/baby-python | python |
import pandas as pd
from numpy import datetime64
from pandas_datareader import data
from pandas.core.series import Series
from pandas.core.frame import DataFrame
from yahoofinancials import YahooFinancials
# holding period return in percents
def get_holding_period_return(df: DataFrame, start, end, col) -> float:
... | nilq/baby-python | python |
class JobLookupError(KeyError):
"""Raised when the job store cannot find a job for update or removal."""
def __init__(self, job_id):
super().__init__(u'No job by the id of %s was found' % job_id)
class ConflictingIdError(KeyError):
"""Raised when the uniqueness of job IDs is being violated."""
... | nilq/baby-python | python |
import pytest
from src.dataToCode.dataClasses.classData import ClassData
from src.dataToCode.dataClasses.interface import Interface
from src.dataToCode.languages.toPython.fileNameToPython import FileNameToPython
data = [
("Orc", "orc.py"),
("HighOrc", "high_orc.py"),
("PrettyLongClassName", "pretty_long_c... | nilq/baby-python | python |
# -*- coding: utf-8 -*-
"""
# @Time : 29/06/18 12:23 PM
# @Author : ZHIMIN HOU
# @FileName: run_Control.py
# @Software: PyCharm
# @Github : https://github.com/hzm2016
"""
import numpy as np
np.random.seed(1)
import time
import gym
import gym_puddle
import gym.spaces
import pickle
from algorithms import *
from T... | nilq/baby-python | python |
from .black_scholes_process import BlackScholesMertonProcess
| nilq/baby-python | python |
from datetime import datetime
from os.path import dirname, join
import pytest
from city_scrapers_core.constants import COMMISSION
from city_scrapers_core.utils import file_response
from freezegun import freeze_time
from city_scrapers.spiders.chi_ssa_8 import ChiSsa8Spider
test_response = file_response(
join(dirn... | nilq/baby-python | python |
import os, sys
sys.path.insert(0, os.path.join("..",".."))
from nodebox.graphics.context import *
from nodebox.graphics import *
# Generate compositions using random text.
font('Arial Black')
def rndText():
"""Returns a random string of up to 9 characters."""
t = u""
for i in range(random(10)):
t... | nilq/baby-python | python |
#coding utf8
#!/usr/bin/env python
# Python 2/3 compatibility
from __future__ import print_function
import numpy as np
import cv2
import Queue
# local modules
from video import create_capture
from common import clock, draw_str
Sample_Num = 128
xx1 = lambda x1, x2: int((x1+x2)/2-(x2-x1)*0.2)
xx2 = lambda x1, x2: int... | nilq/baby-python | python |
#!/usr/bin/env python
from __future__ import print_function, division
from multiprocessing import Pool
import os
from shutil import copy
import glob
from sqlalchemy import or_
from pyql.database.ql_database_interface import Master
from pyql.database.ql_database_interface import session
from pyql.database.ql_database... | nilq/baby-python | python |
"""This module contains loosely related utility functions used by the Gemicai"""
from string import Template
import os
from tabulate import tabulate
from collections import Counter
from math import log
from matplotlib import pyplot as plt
import numpy as np
import itertools
from sklearn.metrics import confusion_matrix... | nilq/baby-python | python |
# CRINGE FILE NAME ALERT(PC culture is not even rational)
import sys
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql_psycopg2',
'NAME': 'autogger',
'USER': 'postgres_user',
'PASSWORD': 'postgres_user_password',
'HOST': 'localhost',
'PORT': '5432',... | nilq/baby-python | python |
# --------------
# Importing header files
import numpy as np
import warnings
warnings.filterwarnings('ignore')
#New record
new_record=[[50, 9, 4, 1, 0, 0, 40, 0]]
#Reading file
data = np.genfromtxt(path, delimiter=",", skip_header=1)
#print(data)
#Code starts here
#Task -1 : In this first ta... | nilq/baby-python | python |
import pygame
from pygame import color
import os
letter_x = pygame.image.load(os.path.join('res', 'letter_x.png'))
letter_0 = pygame.image.load(os.path.join('res', 'letter_o.png'))
class Grip:
def __init__(self) :
self.grip_line = [((0, 200), (600, 200)), #1st horizontal line
... | nilq/baby-python | python |
from dbconnect import session, User, Offer, Skills, Languages
from tweetparse import tweetParse
def addUserToDB(mentor, twit_uid, tweet_id, screenname):
userVar = User(mentor_mentee=mentor, twitter_uid=twit_uid, original_tweet_id=tweet_id, scrn_name=screenname)
session.add(userVar)
session.commit()
ret... | nilq/baby-python | python |
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# d... | nilq/baby-python | python |
# iNTERFACE 2 - TESTE
from tkinter import *
from tkinter import messagebox
# AINDA EM CONSTRUÇÃO AULA 2
janela = Tk()
janela.title('Systems OS')
janela.geometry('500x400')
w= Spinbox(janela, values=("Python", "HTML", "Java", "Javascript"))
w.pack()
e = Spinbox(janela, values=("carnes", "Verduras", "Legumes", "F... | nilq/baby-python | python |
#!/usr/bin/env python3
import SimpleITK as sITK
import nibabel as nib
import numpy as np
class nibabelToSimpleITK(object):
'''
Collection of methods to convert from nibabel to simpleITK and vice versa. Note: Only applicable for 3d images for
now.
'''
@staticmethod
def sitkImageFromNib( nibIm... | nilq/baby-python | python |
#!/usr/bin/env python3
# Programita para implementar el método de bisección
# Busca un cero de f en el intervalo [a,b]
# tol= tolerancia prescripta para detener el método numérico
# (si no sería un ciclo infinito)
# Hipótesis: las del teorema de Bolzano
# f(a) y f(b) deben tener signos opuestos
# f debe ser continua ... | nilq/baby-python | python |
__author__ = "Samantha Lawler"
__copyright__ = "Copyright 2020"
__version__ = "1.0.1"
__maintainer__ = "Rabaa"
__email__ = "beborabaa@gmail.com"
import numpy as np
import sys
## Class: TestParticle
# Functions: Default Constructor, DataDissection, IdentifyResonance, PrintData
class TestParticle:
def __init__(sel... | nilq/baby-python | python |
# LPS22HB/HH pressure seneor micropython drive
# ver: 2.0
# License: MIT
# Author: shaoziyang (shaoziyang@micropython.org.cn)
# v1.0 2016.4
# v2.0 2019.7
LPS22_CTRL_REG1 = const(0x10)
LPS22_CTRL_REG2 = const(0x11)
LPS22_STATUS = const(0x27)
LPS22_TEMP_OUT_L = const(0x2B)
LPS22_PRESS_OUT_XL = const(0x28)
... | nilq/baby-python | python |
from anytree import Resolver, ChildResolverError, Walker
from src.tree_node import TreeNode
class AssetInfoTree:
def __init__(self, texture_info_list):
self.walker = Walker()
r = Resolver('name')
id = 0
self.root = TreeNode('Root', id)
id += 1
for info in text... | nilq/baby-python | python |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# https://www.redblobgames.com/articles/visibility/
# https://en.wikipedia.org/wiki/Art_gallery_problem
"Hover mouse to illuminate the visible area of the room"
from vedo import *
import numpy as np
rw = Rectangle((0,0), (1,1)).texture(dataurl+"textures/paper1.jpg")
tx = ... | nilq/baby-python | python |
import py
import random, sys, os
from rpython.jit.backend.ppc.codebuilder import BasicPPCAssembler, PPCBuilder
from rpython.jit.backend.ppc.regname import *
from rpython.jit.backend.ppc.register import *
from rpython.jit.backend.ppc import form
from rpython.jit.backend import detect_cpu
from rpython.jit.backend.ppc.ar... | nilq/baby-python | python |
import discord
from utils import DIGITS
from utils.config import Users
from utils.discord import help_me, get_user, DiscordInteractive
from utils.errors import UserNonexistent, NoPlays
from utils.osu.apiTools import get_recent
from utils.osu.embedding import embed_play
from utils.osu.stating import stat_play
from util... | nilq/baby-python | python |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
__author__ = "Christian Heider Nielsen"
__doc__ = r"""
Created on 08-12-2020
"""
from itertools import tee
from typing import Any, Generator, Iterable
import tqdm
from notus.notification import JobNotificationSession
from warg import drop_unused_... | nilq/baby-python | python |
from util.tipo import tipo
class S_PARTY_MEMBER_CHANGE_MP(object):
def __init__(self, tracker, time, direction, opcode, data):
print(str(type(self)).split('.')[3]+'('+str(len(data))+'): '+ str(data.get_array_hex(1))[1:-1])
server_id = data.read(tipo.uint32)
player_id = data.read(tipo.uint32... | nilq/baby-python | python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.