content stringlengths 0 1.05M | origin stringclasses 2
values | type stringclasses 2
values |
|---|---|---|
#
# copyright_notice
#
"""smap wrappers
"""
__all__ = ()
from opengltk.extent import smaplib, utillib
| nilq/baby-python | python |
import pytest
from lj506.skeleton import fib, main
__author__ = "Eric Busboom"
__copyright__ = "Eric Busboom"
__license__ = "MIT"
def test_access():
"""API Tests"""
| nilq/baby-python | python |
import logging
import uuid
from assistant.orders.models import LineItem
from .models import Stock
from .exceptions import InsufficientStock
logger = logging.getLogger(__name__)
def process_simple_stock_allocation(**data):
stocks = Stock.objects.filter(product_variant=data.get("variant"))
line_items = data.... | nilq/baby-python | python |
from flask import request, render_template, make_response
from datetime import datetime
import psycopg2
import os
#__ Configure access to .env file
from dotenv import load_dotenv
from pathlib import Path # python3 only
def get_query_by_id(id_to_update):
"""
Get all ranks from pathogen table
"""
#L... | nilq/baby-python | python |
##
## Copyright (C) 2017, Amit Aides, all rights reserved.
##
## This file is part of Camera Network
## (see https://bitbucket.org/amitibo/cameranetwork_git).
##
## Redistribution and use in source and binary forms, with or without modification,
## are permitted provided that the following conditions are met:
##
## ... | nilq/baby-python | python |
"""Module for the main SqsTestPrefix Construct."""
# Standard library imports
import json
# Third party imports
from aws_cdk import core as cdk, aws_sqs as sqs, aws_lambda as lambda_
# Local application/library specific imports
from filter_dynamodb_event_streams_sent_to_lambda.lambda_function import LambdaFunction
... | nilq/baby-python | python |
from com.sun.star.style.ParagraphAdjust import CENTER, LEFT, RIGHT, BLOCK, STRETCH
from com.sun.star.text.ControlCharacter import PARAGRAPH_BREAK, APPEND_PARAGRAPH, LINE_BREAK
def populateTopText(cursor, doc, text, practice):
styles = doc.StyleFamilies
page_styles = styles.getByName("PageStyles")
oDefault... | nilq/baby-python | python |
#!/usr/bin/env python
"""
This script computes the features necessary to achieve the results on the SHS
training set reported in the paper:
Humphrey, E. J., Nieto, O., & Bello, J. P. (2013). Data Driven and
Discriminative Projections for Large-Scale Cover Song Identification. In Proc.
of the 14th International Socie... | nilq/baby-python | python |
import json
import pika
#create client class,since we want to connect to different cloudamqp instances
class CloudAMQPClient:
def __init__(self, cloud_amqp_url, queue_name):
self.cloud_amqp_url = cloud_amqp_url
self.queue_name = queue_name
self.params = pika.URLParameters(cloud_amqp_url)
... | nilq/baby-python | python |
# -*- coding: utf-8 -*-
"""
Class Piece:
The shapes of tetrimonos
each of them was a tuple of tuples containing the rotations
PIECES is a dict containing all the shapes where number as a key.
{1: I, 2: J, 3: L, 4: O, 5: S, 6:T, 7:Z}
@author: Chens
https://github.com/ChenSunMac
"""
class Piece:
... | nilq/baby-python | python |
import sys,os
keywords = ['PLPS_path', 'PDB2PQR_path', 'APBS_path', 'XLOGP3_path', 'ligand_file', 'BABEL_path',\
'n_conf', 'OMEGA_path']
def read_input(input_file):
file = open(input_file, 'r')
lig_file = []
for line in file:
key = line.split()[0]
if(key == keywords[0]):
... | nilq/baby-python | python |
from featurechart import *
from treeview import *
def demo():
cp = load_earley('gazdar6.cfg', trace=2)
trees = cp.parse('the man who chased Fido returned')
for tree in trees: print tree
#run_profile()
if __name__ == '__main__': demo()
| nilq/baby-python | python |
# -*- coding: utf-8 -*-
# Copyright 2020 Green Valley Belgium NV
#
# 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 appl... | nilq/baby-python | python |
import operator
class MultiMapping:
def __init__(self, *stores):
self.stores = list(stores)
def __getitem__(self, key):
for store in self.stores:
if key in store:
return store[key]
raise KeyError(key)
_marker = []
def get(self, key, default=_marker):
... | nilq/baby-python | python |
import logging
import shutil
from pathlib import Path
from typing import List, Tuple, Union
import numpy as np
import pandas as pd
from genomics_data_index.storage.SampleSet import SampleSet
from genomics_data_index.storage.index.KmerSearchManager import KmerSearchManagerSourmash
from genomics_data_index.storage.mode... | nilq/baby-python | python |
import numpy as np
class SimulationGoal:
"""
A class that tracks whether the simulation has reached its global goal.
"""
def __init__(self):
"""
We set the self.is_done to False as a start.
"""
self.is_done = False
def goal_reached(self, grid_world):
"""
... | nilq/baby-python | python |
# -*- coding: utf-8 -*-
import os
import stat
serverScript="dnsserver.py"
serverScriptFolder="modules"
dbFolder="databases"
dbFile="storage.sqlite"
server_script_path=os.path.join(request.folder,"modules","dnsserver.py")
st = os.stat(server_script_path)
os.chmod(server_script_path, st.st_mode | stat.S_IEXEC)
server_pa... | nilq/baby-python | python |
import matplotlib.pyplot as plt
f = open("../data/train_small.csv", 'r')
g = open("../data/test_small.csv", 'r')
#Skip the head line
f.readline()
g.readline()
################################################
train_label_data, train_feature_data = [], []
for line in f:
labels = line.split(',')
labels = map(str.st... | nilq/baby-python | python |
from naive_bayes import NaiveBayesClassifier
def test_evaluate_algorithm():
classifier = NaiveBayesClassifier()
dataset = [[3.393533211, 2.331273381, 0],
[3.110073483, 1.781539638, 0],
[1.343808831, 3.368360954, 0],
[3.582294042, 4.67917911, 0],
... | nilq/baby-python | python |
# *************************************
# |docname| - Misc CLI tools for Docker
# *************************************
# This files provides most of the subcommands for `docker_tools.py`.
#
# If you want to add a new subcommand you must add it to the list in the add_commands
# function. That command ensures that dock... | nilq/baby-python | python |
import os
import io
import base64
from cryptography.hazmat.primitives.kdf.pbkdf2 import PBKDF2HMAC
from cryptography.hazmat.primitives.ciphers import Cipher, algorithms, modes
from cryptography.hazmat.backends import default_backend
#from cryptography.hazmat.primitives import padding
from cryptography.hazmat.backends.o... | nilq/baby-python | python |
from pathlib import Path
import unittest
import re
from unittest.mock import patch
from typer.testing import CliRunner
from plotly.graph_objects import Figure
from tempfile import NamedTemporaryFile
from ausdex import main
class TestMain(unittest.TestCase):
def setUp(self):
self.runner = CliRunner()
... | nilq/baby-python | python |
'''
Created on Feb 9, 2019
@author: NOOK
'''
from abc import ABC
from numpy import array, zeros
from math import sqrt, sin, cos, atan2, pi
def POW(a, b):
return a**b;
class RadarCoordinatesTemplate(ABC):
'''
classdocs
'''
def __init__(self):
'''
Constructor
'''
... | nilq/baby-python | python |
#!/usr/bin/env python3
#
# Copyright (c) 2015 - 2021, Intel Corporation
#
# 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, th... | nilq/baby-python | python |
import path_utils
import os
import Sample
import gym_raas
replot_dir = ""
dir = os.path.join(path_utils.get_output_dir(), replot_dir)
s = Sample.replot_sample_dict_from_dir(dir)
| nilq/baby-python | python |
__author__ = 'Przemyslaw "Blasto" Wentrys'
@app.route('/mysql/testt')
def mysql_test():
execute = MySQL_Connection().execute_query
query = MySQL_Functions()
server = 'Naboo'
database = 'jira'
table = 'jiraissue'
columns = '*'
return str(execute(server, query.check_for_existence(database... | nilq/baby-python | python |
#!/usr/bin/env python3
"""
See http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html for a list of status code
"""
from .rfc7285 import mimetypes
import logging
import traceback
import bottle
def is_error(code):
return not code in [200, 204]
def format_error(response = bottle.response, message='', exception = ... | nilq/baby-python | python |
##############################################################################
#
# Copyright (c) 2003-2018 by The University of Queensland
# http://www.uq.edu.au
#
# Primary Business: Queensland, Australia
# Licensed under the Apache License, version 2.0
# http://www.apache.org/licenses/LICENSE-2.0
#
# Development unt... | nilq/baby-python | python |
'''
File: dict_merge.py
Project: 01-DataSturcture
===========
File Created: Tuesday, 21st July 2020 4:49:05 pm
Author: <<LanLing>> (<<lanlingrock@gmail.com>>)
===========
Last Modified: Tuesday, 21st July 2020 4:49:09 pm
Modified By: <<LanLing>> (<<lanlingrock@gmail.com>>>)
===========
Description: 字典合并
Copyright <<202... | nilq/baby-python | python |
"""
A module for (non-TS) species conformer generation
Note:
variables that contain atom indices such as torsions and tops are 1-indexed,
while atoms in Molecules are 0-indexed.
Todo:
* Consider boat-chair conformers (https://en.wikipedia.org/wiki/Cyclohexane_conformation)
* finally, consider h-bonds
... | nilq/baby-python | python |
class FibonacciCode:
def fib_sequence(self, n, decode=False):
l = []
a = 0
b = 1
if decode:
for _ in range(n + 2):
l.append(a)
a, b = b, a + b
else:
while a <= n:
l.append(a)
a, b = b, a ... | nilq/baby-python | python |
#!/usr/bin/env python3
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
def split_date(df):
# Remove the empty lines
df = df.dropna(how="all")
# Create a new dateframe for only the date and time
date = df.Päivämäärä.str.split(expand=True)
# Change column names
d... | nilq/baby-python | python |
class CSVNoDupPlugin:
def input(self, infile):
inputcsv = open(infile, 'r')
self.lines = []
for line in inputcsv:
self.lines.append(line.strip().split(','))
def run(self):
# Find dups in first line
names = []
dups = []
for element in self.lines[0]... | nilq/baby-python | python |
# Dependencies
from bs4 import BeautifulSoup
import pandas as pd
import datetime as dt
from splinter import Browser
import time
import re
# Define a function called `scrape` that will execute all of your scraping code from the `mission_to_mars.ipynb` notebook and return one Python dictionary containing all of the scr... | nilq/baby-python | python |
import json
from django.conf import settings
from django.core.urlresolvers import reverse
from django.test import TestCase
from rest_framework.test import APIClient
import annotator
from annotator import models
class RootTestCase(TestCase):
"""
See the documentation for the
`root <http://docs.annotator... | nilq/baby-python | python |
try:
# detect if concurrent.futures is available as a Python
# stdlib or Python 2.7 backport
from ..futures import patch as wrap_futures
from ..futures import unpatch as unwrap_futures
futures_available = True
except ImportError:
def wrap_futures():
pass
def unwrap_futures():
... | nilq/baby-python | python |
# proxy module
from __future__ import absolute_import
from apptools.naming.binding import *
| nilq/baby-python | python |
from datetime import date
import boundaries
boundaries.register('Halifax districts',
domain='Halifax, NS',
last_updated=date(2012, 11, 6),
name_func=boundaries.attr('DISTNAME'),
id_func=boundaries.attr('DIST_ID'),
authority='Halifax Regional Municipality',
notes='We use a shapefile received vi... | nilq/baby-python | python |
import os
from pathlib import Path
import quickfix as fix
from dotenv import load_dotenv
from fixit.application import Application
_ = load_dotenv()
def main(path):
try:
settings = fix.SessionSettings(path.name)
application = Application(
username=os.environ['FIX_USERNAME'],
... | nilq/baby-python | python |
from collections import defaultdict
class Graph():
def __init__(self,vertices):
self.graph = defaultdict(list)
self.V = vertices
def addEdge(self,u,v):
self.graph[u].append(v)
def isCyclicUtil(self, v, visited, recStack):
visited[v] = True
recStack[v] = True
for neighbour in self.graph[v]:
if vi... | nilq/baby-python | python |
#!/usr/bin/env python
"""Classes that provide abstractions of different image source manifests."""
import json
import re
from typing import List, Set, Union
from docker_registry_client_async import FormattedSHA256, ImageName, JsonBytes
from .manifest import Manifest
class ArchiveChangeset(JsonBytes):
"""
... | nilq/baby-python | python |
from Chef import Chef
from ChineseChef import ChineseChef
myChef = Chef()
myChef.make_special_dish()
myChineseChef = ChineseChef()
myChineseChef.make_fried_rice()
| nilq/baby-python | python |
# coding=utf-8
# *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union, overload
from .. import... | nilq/baby-python | python |
"""
This file implements a deep neural network that tries to predict the next position of the laser spot from the current
position of the laser spot.
"""
import numpy as np
import observations_set
from keras import Sequential
from keras.layers import Dense
from keras.models import Model, model_from_json
from keras.opt... | nilq/baby-python | python |
"""Top-level {{cookiecutter.package_slug}} package."""
import logging
from logging import NullHandler
__author__ = '{{cookiecutter.full_name}}'
__email__ = '{{cookiecutter.email}}'
__version__ = '{{cookiecutter.version}}'
logging.getLogger(__name__).addHandler(NullHandler())
| nilq/baby-python | python |
"""polysearch URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/3.2/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: path('', views.home, name='home')
Class-ba... | nilq/baby-python | python |
import random
shapes = [
[
(1, 1, 1, 1)
],
[
(1, 0), (1, 0), (1, 1)
],
[
(0, 1), (0, 1), (1, 1)
],
[
(0, 1), (1, 1), (1, 0)
],
[
(1, 1), (1, 1)
]
]
class Block:
def __init__(self):
self.shape = random.choice(shapes)
s... | nilq/baby-python | python |
from image_match.goldberg import ImageSignature
gis = ImageSignature()
a = gis.generate_signature('MonaLisa_Wikipedia.jpg')
b = gis.generate_signature('MonaLisa_WikiImages.jpg')
c = gis.generate_signature('Caravaggio_Wikipedia.jpg')
print('a = MonaLisa_Wikipedia.jpg\n','b = MonaLisa_WikiImages.jpg\n','c = Caravaggio_Wi... | nilq/baby-python | python |
#!/usr/bin/env python
from distutils.core import setup
setup(name='XUnit2HTML',
version='1.0.1',
description='A tool for converting xunit generated xml files into an html report',
author='Gudni Olafsson',
author_email='gudni.olafsson@gmail.com',
py_modules=['xunit2html'],
scripts=[... | nilq/baby-python | python |
#!/usr/bin/envthon
# coding: utf-8
import requests
from bs4 import BeautifulSoup
import re
import sys
import os, shutil
#from internal_processing import get_job_details, get_name_and_loc, get_posted_and_applicants
from internal_processing import get_job_title, get_job_id, get_job_description
from helpers import s... | nilq/baby-python | python |
# Source https://github.com/NVlabs/PWC-Net/blob/master/PyTorch/models/PWCNet.py
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.autograd import Variable
from matplotlib.pyplot import imread
import matplotlib.pyplot as plt
import os
# os.environ['PYTHON_EGG_CACHE'] = 'tmp/' # a writable ... | nilq/baby-python | python |
import pytest
import tensorflow as tf
from doctr.models import backbones
@pytest.mark.parametrize(
"arch_name, input_shape, output_size",
[
["vgg16_bn", (224, 224, 3), (7, 56, 512)],
["resnet31", (32, 128, 3), (4, 32, 512)],
["magc_resnet31", (32, 128, 3), (4, 32, 512)],
["mob... | nilq/baby-python | python |
from fsm.models import ActivityLog
def quit_edge(self, edge, fsmStack, request, **kwargs):
"""
Edge method that terminates this live-session.
"""
for studentState in fsmStack.state.linkChildren.all():
studentState.linkState = None # detach from our state
studentState.save()
return... | nilq/baby-python | python |
from core import Bot
from templates import Template
template = Template()
class Message:
def message(self):
@Bot.bot.message_handler(content_types=['text'])
def text_message(message):
if message.text == "/start":
Bot.bot.reply_to(message, template.start(), parse_mode='H... | nilq/baby-python | python |
from django.conf.urls import include, url
from tumblelog.views import (
PostIndexView, AddPostView, PostDetailView,
UpdatePostView, DeletePostView, ImageFileView,
TestSessionView,
)
from django_mongoengine import mongo_admin
post_patterns = [
url(r'^$', PostDetailView.as_view(), name="post"),
url... | nilq/baby-python | python |
#!/usr/bin/python3
# =============================================================================
# CrowdTangle Utils
# =============================================================================
#
# Miscellaneous utility functions to be used with CrowdTangle Link.
# @Author: Brayan Rodriguez <bradrd2009jp@gmail.co... | nilq/baby-python | python |
# -*- coding: utf-8 -*-
#############################################################################
#
# Copyright © Dragon Dollar Limited
# contact: contact@dragondollar.com
#
# This software is a collection of webservices designed to provide a secure
# and scalable framework to build e-commerce websites.
#
# This s... | nilq/baby-python | python |
# import numpy as np
# r= [1.0,1.0,1.0,-1.0,1.0,1.0]
# gamma = 0.5
#
# r = np.array(r)
# discounted_r = np.zeros_like(r)
# running_add = 0
# # we go from last reward to first one so we don't have to do exponentiations
# for t in reversed(range(0, r.size)):
# if r[t] != 0:
# running_add = 0 # if the game end... | nilq/baby-python | python |
from django.shortcuts import render
from project.models import Project
def project_index(request):
p1 = Project(
title='My First Project',
description='A web development project.',
technology='Django',
image='img/project1.png'
)
p2 = Project(
title='My Second Pro... | nilq/baby-python | python |
import ephem
manen = ((ephem.Io(), 'i'),
(ephem.Europa(), 'e'),
(ephem.Ganymede(), 'g'),
(ephem.Callisto(), 'c'))
nu = ephem.now()
interval = ephem.minute
m = ephem.Europa()
t = nu
lengte = 80
jupiterIndex = int(lengte / 2) + 1
while True:
regel = lengte * [' ']
regel[jupiterIndex... | nilq/baby-python | python |
# Copyright 2019 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, ... | nilq/baby-python | python |
# Copyright (c) 2016-present, Facebook, Inc.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import unittest
from unittest.mock import (
MagicMock,
patch,
)
from ... import commands
from ...commands import restart
from .command_test... | nilq/baby-python | python |
from django.template import Engine
_dirs_undefined = object()
class JsEngine(Engine):
def __init__(self, dirs=None, app_dirs=False,
allowed_include_roots=None, context_processors=None,
debug=False, loaders=None, string_if_invalid='',
file_charset='utf-8'):
... | nilq/baby-python | python |
# -*- coding: utf-8 -*-
from ffmpymedia import __author__, __version__, __version_info__, __copyright__
video_codecs = {'mpeg2video': 'MPEG-2 video',
'h264': 'H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10',
'vp8': 'On2 VP8',
'mpeg4': 'MPEG-4 part 2',
'theora... | nilq/baby-python | python |
# -*- coding: utf-8 -*-
#障碍跑
#使用时请将ip改成需要连接的机器人
#winxos 2012-07-14
import time,math
import wsNaoVisionMT as wsnv
import wsNaoMotion as wsnm
import numpy as np
import obstacleState as state
ground=np.array([[0,0,80],[180,220,255]])
if __name__ == '__main__':
ip="192.168.1.103" #修改此处ip地址为机器人实际连接ip
nv=wsnv.wsNaoV... | nilq/baby-python | python |
import argparse
import os
import shutil
import stat
if __name__ == "__main__":
if os.getuid() != 0:
print("This script is intended to be run as root!")
print("By doing this, we isolate the commands that truly need privilege.")
print("This script runs: cp, chmod (on only the input/output fil... | nilq/baby-python | python |
import json
import pygame
from ceEntity import CEEntity
import ceSprite
import ceColor
import ceText
import ceGame
def rowToInts(row):
return [int(s) for s in row.split()]
def clamp(val, mn, mx):
if val<mn:
return mn
elif val>mx:
return mx
else:
return val
class CEStage(CEEnti... | nilq/baby-python | python |
# Generated by Django 3.0 on 2021-03-20 12:17
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('udaan_app', '0001_initial'),
]
operations = [
migrations.CreateModel(
name='QuizResponse',
... | nilq/baby-python | python |
"""Stock feature generation including momentum indicators and volatility
Currently RSI (Relative Strength Index), volatility, and price return rank are successfully calculated for each stock
and for each day based on the basic price data ingested from yahoo. To Run the program,
the stock_price_and_returns.c... | nilq/baby-python | python |
#!/usr/bin/env python
import pika
def on_request(ch, method, props, body):
n = int(body)
response = n*n
print(" [.] Calculando %s * %s = %s" % (n, n, response))
ch.basic_publish(exchange='',
routing_key=props.reply_to,
properties=pika.BasicProperties(correlat... | nilq/baby-python | python |
from datetime import datetime, timedelta
from django.conf import settings
from django.contrib import messages
from django.http import HttpResponseRedirect
from django.utils.http import is_safe_url
from django.utils.translation import override
from django.views.generic import View
from pretalx.common.phrases import ph... | nilq/baby-python | python |
from numba import jit
@jit
def fibo(n):
if n < 2:
return n
return fibo(n-1) + fibo(n-2)
print(fibo(45)) | nilq/baby-python | python |
# Training script with LazyLoader
#
# Instead of dumping all input into memory, we lazy load on the fly.
# This can create an IO bound where slow training down but helping to training large dataset such as MetaVideoLazy
import os
from tqdm.auto import tqdm
from opt import config_parser
import logging
import ruamel.... | nilq/baby-python | python |
# Copyright 2021 UW-IT, University of Washington
# SPDX-License-Identifier: Apache-2.0
from django.test import TestCase
from accountsynchr.trumba_gws import TrumbaToGws
from accountsynchr.tests import fdao_gws_override
@fdao_gws_override
class TestTrumbaToGws(TestCase):
def test_group_manager(self):
tg ... | nilq/baby-python | python |
# flake8: noqa
from my_happy_pandas._libs import NaT, Period, Timedelta, Timestamp
from my_happy_pandas._libs.missing import NA
from my_happy_pandas.core.dtypes.dtypes import (
CategoricalDtype,
DatetimeTZDtype,
IntervalDtype,
PeriodDtype,
)
from my_happy_pandas.core.dtypes.missing import isna, isnull... | nilq/baby-python | python |
import numpy as np
import scipy
import GPyOpt
import GPy
from multi_objective import MultiObjective
from multi_outputGP import multi_outputGP
from uKG_SGA import uKG_SGA
from uKG_cf import uKG_cf
from uEI_noiseless import uEI_noiseless
from parameter_distribution import ParameterDistribution
from utility import Utility... | nilq/baby-python | python |
# NOQA
import asyncio
import requests
from xml.etree import ElementTree
from itertools import islice
from discord.ext import commands
class Language:
"""Dictionaries & other word things."""
def __init__(self, bot):
"""Cog constructor."""
self.bot = bot
@commands.command()
async def d... | nilq/baby-python | python |
import pytest
import skbot.ignition as ign
import skbot.transform as tf
from typing import Tuple, List, Union
from pathlib import Path
joint_types = Union[tf.RotationalJoint, tf.PrismaticJoint]
sdf_folder = Path(__file__).parents[1] / "ignition" / "sdf"
ign.sdformat.generic_sdf.base.WARN_UNSUPPORTED = False
@pytest... | nilq/baby-python | python |
import torch
import torch.nn as nn
import torch.nn.functional as F
import spacetimeformer as stf
from .encoder import VariableDownsample
class SpacetimeformerEmbedding(nn.Module):
def __init__(
self,
d_y,
d_x,
d_model=256,
time_emb_dim=6,
method="spatio-temporal"... | nilq/baby-python | python |
from subprocess import check_output, STDOUT, CalledProcessError
# ffmpeg command:
# ffmpeg -decryption_key 5df1b4e0d7ca82a62177e3518fe2f35a -i "./video_encripted.mp4" -pix_fmt bgr24 -vcodec copy "./video_decripted.mp4"
schema_encript = "cenc-aes-ctr"
key_encript = "5df1b4e0d7ca82a62177e3518fe2f35a"
kid_encript... | nilq/baby-python | python |
/usr/lib64/python2.7/sre_parse.py | nilq/baby-python | python |
import sys
sys.path.append("/home/shansixioing/tools")
from gen_utils import master_run
import random
import numpy as np
import glob
seed = 12342
random.seed(seed)
np.random.seed(seed)
import time
def main():
# gpu_ls = ['babygroot0', 'babygroot1', 'babygroot3', 'groot0', 'groot1', 'groot2', 'groot3', 'nebula0'... | nilq/baby-python | python |
class BaseTask:
def run(self):
raise Exception("Method is not implemented")
def get_status(self):
raise Exception("Method is not implemented")
def wipe(self):
pass
| nilq/baby-python | python |
# Copyright 2019 The IEVA-DGM Authors. All rights reserved.
# Use of this source code is governed by a MIT-style license that can be
# found in the LICENSE file.
# mpas dataset
from __future__ import absolute_import, division, print_function
import os
import pandas as pd
import numpy as np
from skimage import io, t... | nilq/baby-python | python |
import os
from pkg_resources import resource_filename
import pandas as pd
def load_titanic(return_X_y: bool = False, as_frame: bool = False):
"""
Loads in a subset of the titanic dataset. You can find the full dataset [here](https://www.kaggle.com/c/titanic/data).
Arguments:
return_X_y: return a... | nilq/baby-python | python |
# Contents of test_cart_1d.py
#===============================================================================
# TEST CartDecomposition and CartDataExchanger in 1D
#===============================================================================
def run_cart_1d( verbose=False ):
import numpy as np
from mpi4py ... | nilq/baby-python | python |
from django.shortcuts import get_object_or_404
from django import template
from mailing.models import CustomerLoyaltyElement
from accounts.models import CorporateProfile, CompanyName
from travelling.models import Trip, Rating
register = template.Library()
@register.inclusion_tag('mailing/get-loyalty-element.html', ... | nilq/baby-python | python |
# coding=utf-8
"""
Emulate a gmetric client for usage with
[Ganglia Monitoring System](http://ganglia.sourceforge.net/)
"""
from . Handler import Handler
import logging
try:
import gmetric
except ImportError:
gmetric = None
class GmetricHandler(Handler):
"""
Implements the abstract Handler class, se... | nilq/baby-python | python |
from datetime import datetime
from pathlib import Path
from textwrap import dedent
import os
import pwd
import subprocess
import sys
import textwrap
import click
import jinja2
STATUS_CLASSIFIERS = {
"planning": "Development Status :: 1 - Planning",
"prealpha": "Development Status :: 2 - Pre-Alpha",
"alpha... | nilq/baby-python | python |
__version__ = "0.0.9"
from .core import *
| nilq/baby-python | python |
import sys
__version__ = "0.1"
from .dicodon_optimization import (
optimize_dicodon_usage,
dicodon_count_from_sequences,
codon_count_from_sequences,
dicodon_score_dict_from_sequences,
score,
translate_to_aa,
)
from .fasta import parse_fasta_to_dict
| nilq/baby-python | python |
import pywhatkit
import speech_recognition as sr
import pyttsx3
r = sr.Recognizer()
def SpeakText(command):
engine = pyttsx3.init()
engine.say(command)
engine.runAndWait()
try:
with sr.Microphone() as source2:
r.adjust_for_ambient_noise(source2, duration=0.2)
... | nilq/baby-python | python |
#!/usr/bin/env python3
import sys
import getopt
import os
import json
from typing import Dict
from typing import List
def showhow():
print("configfilter.py -t tpldir -o outdir [-p <pattern>] [-v] <key-value.json>")
print(" -t: 設定ファイルのテンプレートが格納されたディレクトリ")
print(" -o: 処理された設定ファイルの出力先ディレクトリ")
print(" ... | nilq/baby-python | python |
from splinter import Browser
from bs4 import BeautifulSoup
from webdriver_manager.chrome import ChromeDriverManager
import requests
import pandas as pd
import pymongo
import time
client = pymongo.MongoClient('mongodb://localhost:27017')
db = client.mars_db
collection = db.mars
def init_browser():
executable... | nilq/baby-python | python |
class AnnotationModel:
def __init__(self, text: str, comment: str, last_update: str):
self.text = text
self.comment = comment
self.last_update = last_update
| nilq/baby-python | python |
""" Assignment 7
Write a short script that will get a name from the user.
Find the length of the name.
If the length is lower than 5 print "Under".
If the length is more than 5 print "Over".
If the length is exactly 5 print "Five".
Try to use 'if', 'else' and 'elif' exactly once each.
Also, try not to evaluate the le... | nilq/baby-python | python |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Author : leeyoshinari
import pymysql
import zhihu_spider.settings as cfg
class MySQL(object):
def __init__(self):
self.db = None
self.cursor = None
self.connect()
def connect(self):
self.db = pymysql.connect(host... | nilq/baby-python | python |
import numpy as np
# ra54 = np.random.random((5,4))
ra54 = np.arange(20).reshape(5,4)
print(ra54)
print(ra54[2,3])
print(ra54[(2,3),(3,3)])
it = np.nditer(ra54, flags=['multi_index'], op_flags=['readwrite'])
while not it.finished:
idx = it.multi_index
print(idx, '=>', ra54[idx])
it.iternext()
| nilq/baby-python | python |
import asyncio
async def make_americano():
print("Americano Start")
await asyncio.sleep(3)
print("Americano End")
return "Americano"
async def make_latte():
print("Latte Start")
await asyncio.sleep(5)
print("Latte End")
return "Latte"
async def main():
coro1 = make_americano()
... | nilq/baby-python | python |
# -*- coding: utf-8 -*-
"""Special tools for working with mapping types."""
from types import SimpleNamespace
from typing import Mapping, Iterator, Iterable, TypeVar, Union, Any
T = TypeVar("T")
T_Sentinel = type("T_Sentinel", (), {})
R_SENTINEL = T_Sentinel()
T_Bool = Union[T_Sentinel, bool]
def lowerify_mapping(... | nilq/baby-python | python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.