text stringlengths 1 927k |
|---|
"""Extract retweets by date from all of the tweets in collection.
Creates a CSV for each date, and includes the IDs of tweets that were
retweeted on that date. Format is
(tweet_date, ID of the retweet, ID of original tweet)
with the date formatted as YYYY_MM_DD.
This script assumes:
- MongoDB is listening on loc... |
import pyaf.Bench.TS_datasets as tsds
import tests.artificial.process_artificial_dataset as art
art.process_dataset(N = 1024 , FREQ = 'D', seed = 0, trendtype = "ConstantTrend", cycle_length = 30, transform = "BoxCox", sigma = 0.0, exog_count = 20, ar_order = 12); |
def f():
for i in 1,2,3,4,5:
if i == 3: break
yield i
print list(f()) |
# coding=utf-8
import textwrap
import unittest
from conans.client.generators.text import TXTGenerator
from conans.model.build_info import CppInfo
from conans.model.conan_file import ConanFile
from conans.model.env_info import EnvValues
from conans.model.ref import ConanFileReference
from conans.model.settings import S... |
# Copyright 2018 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, s... |
from game_screen import *
class App:
def __init__(self, width, height):
self.width = width
self.height = height
self.window = pygame.display.set_mode((self.width, self.height))
pygame.display.set_caption('VersuSpace')
self.running = True
self.quit_listener = AppQuit... |
from .base import DownloadSource
import requests
from mod_updater.util.utils import TermColors
class CurseForgeSource(DownloadSource):
REQUIRED_ARGS = ["project_id"]
OPTIONAL_ARGS = [("release_type", "release")]
def __init__(self, project, release_type, path, mc_version):
self._file_data_url =... |
# ===============================================================================
# Copyright 2018 ross
#
# 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/LICE... |
import scipy
import time
try:
import SloppyCell.Plotting as Plotting
except ImportError:
pass
def C(p, origMatrix, weightsRDP=0.,weights2D=0.,weightsLS=0.,weightPR=0.,weightPriors=0.,*args,**kwargs):
"""
p is list {a_{ij}, i: 1..n, j: i+1..n}
n is size of total matrix
"""
n = origMatrix.sha... |
from __future__ import print_function
from __future__ import absolute_import
from __future__ import division
import argparse
import numpy as np
import random
import csv
import os
import sys
import re
from tqdm import tqdm
from rdkit import Chem
import pickle as cp
def get_rxn_smiles(prod, reactants):
prod_smi =... |
# SYNOPSIS: from asm import *
from os.path import basename, splitext
from sys import argv
# Module variables because I don't feel like making a class
_romSize, _maxRomSize, _zpSize = 0, 0, 1
_symbols, _refsL, _refsH = {}, [], []
_labels = {} # Inverse of _symbols, but only when made with label(). For disassembler
_co... |
"""taskbuster URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.8/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
Class-... |
"""Setup py2ch application."""
from os.path import dirname, join
from setuptools import setup
version = '1.0'
setup(
name='pych',
author='BehindLoader',
version=version,
packages=['pych'],
license='MIT',
description='Python 2ch API client.',
long_description=open(join(dirname(__file__), ... |
import numpy as np
import cv2
def load_batch(ls,od,data_path,batch_size,which_batch):
image_list=[]
for i in range(which_batch*batch_size,(which_batch+1)*batch_size):
image=[]
image.append(cv2.imread(data_path+ls[od[i]]+'_red.png',0))
image.append(cv2.imread(data_path+ls[od[i]]+'_green.... |
from __future__ import absolute_import, unicode_literals
from django.db.models import Case, IntegerField, When
def order_enum(field, members):
"""
Make an annotation value that can be used to sort by an enum field.
``field``
The name of an EnumChoiceField.
``members``
An iterable of... |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.6 on 2018-02-12 22:13
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('category', '0001_initial'),
]
operations = [
migrations.AlterField(
... |
#!/usr/bin/env python3
import numpy as np
import math
from obstacle_detection import check_for_obs
# State machine states
FOLLOW_LANE = 0
DECELERATE_TO_STOP = 1
STAY_STOPPED = 2
# Stop speed threshold
STOP_THRESHOLD = 0.02
# Number of cycles before moving from stop sign.
SEMAPHORE = 3
STOP_COUNTS = 10
class Behav... |
from typing import Any
from werkzeug.http import HTTP_STATUS_CODES
_sentinel = object()
# TODO Remove these shortcuts when pin Flask>=2.0
def route_shortcuts(cls):
"""A decorator used to add route shortcuts for `Flask` and `Blueprint` objects.
Includes `get()`, `post()`, `put()`, `patch()`, `delete()`.
... |
# Generated by Django 3.2.5 on 2021-07-22 21:15
import api.models.user
from django.db import migrations, models
import uuid
class Migration(migrations.Migration):
initial = True
dependencies = [
('auth', '0012_alter_user_first_name_max_length'),
]
operations = [
migrations.CreateMo... |
"""
PASSENGERS
"""
numPassengers = 3820
passenger_arriving = (
(3, 13, 5, 5, 1, 0, 10, 13, 5, 4, 2, 0), # 0
(4, 9, 7, 5, 2, 0, 10, 14, 8, 5, 1, 0), # 1
(2, 11, 3, 4, 2, 0, 10, 11, 9, 9, 1, 0), # 2
(7, 15, 7, 3, 4, 0, 5, 10, 12, 6, 2, 0), # 3
(5, 6, 4, 2, 2, 0, 10, 10, 6, 4, 1, 0), # 4
(8, 10, 7, 8, 3, 0, 1... |
print('-'*25)
print('Sequência de Fibonacci')
print('-'*25)
termos = int(input('Quantos termos vc quer mostrar? '))
c = 1
valor = -1
valor1 = 1
valor2 = 0
print('~'*30)
while c <= termos:
valor2 = valor + valor1
valor = valor1
valor1 = valor2
print(f'{valor2}', end=' => ')
c += 1
print('FIM')
print(... |
import numpy as np
class Particle(object):
def __init__(self, bounds, weight, cognitiveConstant, socialConstant):
self.position = None # particle position
self.velocity = None # particle velocity
self.best_position = None # best position individual
self.best_error = float('inf')... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# ======================================================================
# Copyright 2017 Julien LE CLEACH
#
# 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 Lice... |
import sqlite3
from my_config import DB_CONNECTION_STR
class SqliteUtil():
def __init__(self):
self.db_connection_str = DB_CONNECTION_STR
self.con = sqlite3.connect(self.db_connection_str, check_same_thread=False)
self.con.row_factory = sqlite3.Row
self.cursorObj = self.con.cursor... |
# Generated by Django 2.2.1 on 2019-06-07 11:12
from django.db import migrations, models
import django.utils.timezone
class Migration(migrations.Migration):
dependencies = [("Native_Service", "0004_date_time_field_changed")]
operations = [
migrations.AddField(
model_name="nativepost",
... |
from typing import Callable
from .subscriber.subscriber import Subscriber
from .publisher.publisher import Publisher
from ..common.broker_mode import BrokerMode, BROKER_MODE
from .subscriber.subscriber_factory import SubscriberFactory
from .publisher.publisher_factory import PublisherFactory
'''
A host can be both a ... |
# -*- coding:utf-8 -*-
from __future__ import unicode_literals
METRICS_COOKIE_AGE = 60 * 60 * 24 * 30 * 6
METRICS_COOKIE_DOMAIN = None
METRICS_COOKIE_HTTPONLY = True
METRICS_COOKIE_NAME = 'visitorid'
METRICS_COOKIE_PATH = '/'
METRICS_COOKIE_SECURE = False |
"""
Description:
Author: Jiaqi Gu (jqgu@utexas.edu)
Date: 2021-06-07 03:43:40
LastEditors: Jiaqi Gu (jqgu@utexas.edu)
LastEditTime: 2021-06-07 03:43:40
"""
from torchonn.op.mzi_op import project_matrix_to_unitary
from typing import List, Union
import torch
from torch import Tensor, nn
from torch.types import Device, ... |
import time
import bisect
import cv2 as cv
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.animation as animation
from matplotlib import gridspec
VIDEO_FILE = 'la_luna.mp4'
RL_BITRATE_FILE = './rl_bitrate'
RL_BUFFER_FILE = './rl_buffer'
MPC_BITRATE_FILE = './mpc_bitrate'
MPC_BUFFER_FILE = './mpc_... |
"""
Module for testing the Dataset class.
"""
from __future__ import (absolute_import, division, print_function,
unicode_literals)
import os
import random
import pytest
import pandas as pd
from surprise import BaselineOnly
from surprise import Dataset
from surprise import Reader
from surprise... |
import unittest
from datetime import datetime
from os import path
from unittest.mock import patch, MagicMock
import sort
class TestPathStrMaker(unittest.TestCase):
def test_maker_is_callable(self):
fn = sort.get_path_str_maker('tester')
self.assertTrue(callable(fn))
@patch('sort._get_exif_d... |
input = """Vixen can fly 19 km/s for 7 seconds, but then must rest for 124 seconds.
Rudolph can fly 3 km/s for 15 seconds, but then must rest for 28 seconds.
Donner can fly 19 km/s for 9 seconds, but then must rest for 164 seconds.
Blitzen can fly 19 km/s for 9 seconds, but then must rest for 158 seconds.
Comet can fly... |
"""
Copyright (c) Contributors to the Open 3D Engine Project.
For complete copyright and license terms please see the LICENSE at the root of this distribution.
SPDX-License-Identifier: Apache-2.0 OR MIT
"""
# Test case ID : C15425929
# Test Case Title : Verify that undo - redo operations do not create any error
# ... |
# Copyright 2021 Huawei Technologies Co., Ltd
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agree... |
#!/usr/bin/env python3
# coding=UTF-8
import pyagxrobots
import time
scoutmini=pyagxrobots.pysdkugv.ScoutMiniBase()
scoutmini.EnableCAN()
num=5
while num>0:
scoutmini.SetMotionCommand(linear_vel=0.1)
print('rpm')
print(scoutmini.ScoutMiniActuator2.rpm())
print('GetLinearVelocity')
print(scoutmi... |
# Generated by Django 3.0.8 on 2021-02-24 07:38
from django.db import migrations, models
import django.db.models.deletion
import uuid
import wastd.observations.models
class Migration(migrations.Migration):
dependencies = [
('observations', '0033_auto_20210219_1350'),
]
operations = [
mi... |
from __future__ import absolute_import, print_function, unicode_literals
from threading import Thread
import zmq
from wolframclient.language import wl
from wolframclient.serializers import export
from wolframclient.utils.externalevaluate import EXPORT_KWARGS, start_zmq_loop
from wolframclient.utils.tests import Test... |
# Generated by Django 2.2.4 on 2019-08-11 11:17
from django.db import migrations, models
import taghaza.models
class Migration(migrations.Migration):
dependencies = [
('taghaza', '0015_auto_20190811_1052'),
]
operations = [
migrations.AlterField(
model_name='taghaza',
... |
# (C) Copyright 2017 IBM Corp.
# (C) Copyright 2017 Inova Development Inc.
# 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-... |
import os
from flask_migrate import Migrate, upgrade
from app import create_app, db
flask_config_name = os.environ.get('FLASK_CONFIG') or 'testing'
app = create_app(config_name=flask_config_name)
migrate = Migrate(app, db) |
import XenAPI
from loggable import Loggable
from .singleton import Singleton
from exc import *
import threading
from rethinkdb import RethinkDB
r = RethinkDB()
class XenAdapter(Loggable, metaclass=Singleton):
AUTOINSTALL_PREFIX = '/autoinstall'
VMEMPEROR_ACCESS_PREFIX='vm-data/vmemperor/access'
def __... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# aioredis_timeseries documentation build configuration file, created by
# sphinx-quickstart on Tue Jul 9 22:26:36 2013.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present i... |
import cv2
import pickle
import numpy as np
import ptlib as pt
from ptlib.core.metadata import MetadataManager
from ptlib.core.queue import Queue
class VideoIngest(pt.Task):
# variables here are static
NUM_WORKERS = 1
VIDEO_PATH = "C:\\Users\\Owner\\Videos\\Battlefield 2042 Open Beta\\testvid.mp4"
B... |
"""
Various utility functions used throughout the different Mezzanine apps.
""" |
import os
from api.exceptions import StripeException
from api.payment import PaymentInterface
from api.request import Request
from transaction.models import Transaction
import stripe
class StripePayment(Request, PaymentInterface):
'''
Stripe payment method class
'''
def __init__(self):
url = ... |
from django import forms
from django.forms import ModelForm, modelformset_factory
from .models import (
AcademicSession,
AcademicTerm,
SiteConfig,
StudentClass,
Subject,
)
SiteConfigForm = modelformset_factory(
SiteConfig,
fields=(
"key",
"value",
),
extra=0,
)
... |
from django.contrib.auth.models import Group, Permission
from rest_framework.generics import ListAPIView
from rest_framework.viewsets import ModelViewSet
from apps.meiduo_admin.serializers.group import GroupSerialzier, GroupSimpleSerializer
from apps.meiduo_admin.utils import CustomPageNumberPagination
# 新增用户组数据---获取权... |
#!/usr/bin/env python3
import logging
import os
import sys
import time
import traceback
from collections import namedtuple
from pathlib import Path
from screenshots import Client, Screenshooter
def env(name, default):
return os.environ.get(name, default)
Spec = namedtuple(
"Spec",
"commands before aft... |
#! /usr/bin/env python
# objgraph
#
# Read "nm -o" input (on IRIX: "nm -Bo") of a set of libraries or modules
# and print various interesting listings, such as:
#
# - which names are used but not defined in the set (and used where),
# - which names are defined in the set (and where),
# - which modules use which other ... |
import _plotly_utils.basevalidators
class LenValidator(_plotly_utils.basevalidators.NumberValidator):
def __init__(
self, plotly_name="len", parent_name="histogram2dcontour.colorbar", **kwargs
):
super(LenValidator, self).__init__(
plotly_name=plotly_name,
parent_name=p... |
# -*- coding: utf-8 -*-
from django import forms
from django.core import validators
from modeltranslation.fields import TranslationField
class TranslationModelForm(forms.ModelForm):
def __init__(self, *args, **kwargs):
super(TranslationModelForm, self).__init__(*args, **kwargs)
for f in self._met... |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.4 on 2017-09-12 17:42
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('recetas', '0014_auto_20170905_1934'),
]
operations... |
import os
try:
import pandas as pd
except:
os.system('pip3 install pandas')
import pandas as pd
try:
import psycopg2
except:
os.system('pip3 install psycopg2-binary')
import psycopg2
import numpy as np
from psycopg2.extensions import register_adapter, AsIs
psycopg2.extensions.register_adapter(np... |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, print_function, unicode_literals
import unittest
from rest_framework import serializers
from ...serializers.swapping import SwappingSerializerMixin
class ChildSerializer(serializers.Serializer):
foo = serializers.IntegerField()
bar = serializer... |
# Copyright 2019 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... |
# -*- test-case-name: vumi.transports.telnet.tests.test_telnet -*-
"""Transport that sends and receives to telnet clients."""
from twisted.internet import reactor
from twisted.internet.protocol import ServerFactory
from twisted.internet.defer import inlineCallbacks, Deferred, gatherResults
from twisted.conch.telnet i... |
# Ref URL: https://stackoverflow.com/a/8220790/1001242
import dbProps
print(dbProps) |
# Generated by Django 2.2.2 on 2019-07-04 04:45
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('story', '0006_auto_20190703_2240'),
]
operations = [
migrations.RenameField(
model_name='story',
old_name='artist',
... |
from osim.env import L2M2019Env
'''
TD3
'''
import copy
import numpy as np
import pandas as pd
import argparse
import os
import os.path
from os import path
import utils
from collections import Iterable
import torch
import torch.nn as nn
import torch.nn.functional as F
device = torch.device("cuda" if torch.cuda... |
from django.contrib import messages
from django.core.exceptions import ObjectDoesNotExist
from django.http import HttpResponseRedirect
from django.shortcuts import render, get_object_or_404
from django.urls import reverse
from .models import Sequence
from .forms import SequenceForm
def index(request):
""" Redirec... |
"""autogenerated by genpy from SubDepthController/mixer.msg. Do not edit."""
import sys
python3 = True if sys.hexversion > 0x03000000 else False
import genpy
import struct
class mixer(genpy.Message):
_md5sum = "ba840d81d8a0efbe22902b684b543995"
_type = "SubDepthController/mixer"
_has_header = False #flag to mar... |
from django.contrib import admin
from import_export.admin import ImportExportActionModelAdmin
from .models import Medication
# Register your models here.
class MedicationAdmin(ImportExportActionModelAdmin):
pass
admin.site.register(Medication, MedicationAdmin) |
# pylint:disable=arguments-renamed,isinstance-second-argument-not-valid-type
try:
import claripy
except ImportError:
claripy = None
from .tagged_object import TaggedObject
from .utils import get_bits, stable_hash
class Expression(TaggedObject):
"""
The base class of all AIL expressions.
"""
... |
"""
ShopCart Service
Paths:
------
GET /shopcarts - Returns a list all of the ShopCarts
POST /shopcarts - creates a new ShopCart record in the database
POST /shopcarts/{customer_id}/items - add an item to the shopcart for customer_id
GET /shopcarts/{customer_id} - Returns the ShopCart with a given id number
GET /shopca... |
# Generated by Django 2.0.1 on 2018-01-28 19:30
from django.db import migrations
def add_initial_data(apps, schema_editor):
County = apps.get_model('petitions', 'County')
Court = apps.get_model('petitions', 'Court')
SubCounty = apps.get_model('petitions', 'SubCounty')
Prison = apps.get_model('petit... |
"""
Text types
"""
from scrapely.extractors import text as extract_text, safehtml
class _BaseTextProcessor(object):
"""basic text processor, defines identity functions, some of which
are overridden in subclasses
"""
def extract(self, text):
"""Matches and extracts any string, as it is"""
... |
import pandas as pd
import pytest
from reco_utils.evaluation.parameter_sweep import generate_param_grid
@pytest.fixture(scope="module")
def parameter_dictionary():
params = {
"param1": [1, 2, 3],
"param2": [4, 5, 6],
"param3": 1
}
return params
def test_param_sweep(parameter_di... |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes ... |
#!/usr/bin/env python3
#reaction_find_connections - find connections between organisms
import sys
organisms = {}
for filename in sys.argv[1:]:
with open(filename) as current:
organisms[filename] = {'ins': set(), 'outs': set()}
for line in current:
record = line.rstrip('\n').split('\t')
... |
from django import template, VERSION
from django.conf import settings
from django.utils.safestring import mark_safe
from .. import utils
register = template.Library()
@register.simple_tag
def render_presigned_bundle(
bundle_name,
bucket_name,
prefix=None,
expiration=None,
extension=None,
con... |
"""DjangoErp URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/2.0/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-bas... |
'''
Flask app config.
'''
DB_FILE = 'app/instance/var/db/users.db'
display = {} |
import numpy as np
import pandas as pd
from sklearn.neighbors import NearestNeighbors
from sklearn.feature_extraction.text import CountVectorizer
### Import and shape data
path_base = 'gitstuff/buildweek2/DS--Data-Engineering-/'
df = pd.read_csv(path_base + 'data/cannabis.csv')
## select subset with high rating
good... |
"""
Custom classes for communicating with equipment.
"""
import importlib
import logging
import os
import weakref
from msl.qt import QtCore
from msl.network import Service
from msl.io import search
from msl.equipment.utils import convert_to_enum
from .. import (
logger,
Register,
)
registry = []
""":class:`l... |
'''
Informations Retrieval Library
==============================
MatrixCooccurrence: You give it a Matrix,
and it creates new co-occurrence matrix of its features
'''
# Author: Tarek Amr <@gr33ndata>
import sys, math
from matrix import Matrix
from superlist import SuperList
from itertools import permutations
cla... |
# Copyright (c) 2010-2020 openpyxl
import pytest
from openpyxl.xml.functions import fromstring, tostring
from openpyxl.tests.helper import compare_xml
@pytest.fixture
def RichText():
from ..text import RichText
return RichText
class TestRichText:
def test_ctor(self, RichText):
text = RichText... |
import os
from keras.callbacks import EarlyStopping
from sklearn import preprocessing
from sklearn.utils import shuffle
from keras.models import Sequential
from keras.layers import Dense, Dropout, Flatten
from keras.layers import Conv2D, MaxPooling2D
import keras
import seaborn as sns
import pandas as pd
import numpy a... |
#!/usr/bin/env python
# --------------------------------------------------------
# Fast R-CNN
# Copyright (c) 2015 Microsoft
# Licensed under The MIT License [see LICENSE for details]
# Written by Ross Girshick
# --------------------------------------------------------
"""Test a Fast R-CNN network on an image databas... |
# -*- coding: utf-8 -*-
import click
from jira import JIRA, JIRAError
from jirainfo.helpers import printJiraErrorAndExit, printErrorMsg
class JiraHelper(object):
def __init__(self, host, user="", password=""):
self.host = host
self.user = user
self.password = password
try:
... |
from os import listdir
from os.path import isfile, join, basename
from dmrpp_generator.main import DMRPPGenerator
from re import match
if __name__ == "__main__":
workstation_path = "/workstation/"
join_path = lambda x: join(workstation_path, x)
input_files = [join_path(f) for f in listdir(workstation_path... |
import hashlib
import os
import shutil
from urllib.request import urlretrieve
from tqdm import tqdm
from constants import CELEB_A_URL, CELEB_A_HASH
from services import _unzip
def download_cartoonset10k():
print("downloading cartoonset10k dataset")
os.system("gsutil cp gs://cartoonset_public_files/cartoonset... |
from flask import jsonify
from server import app
@app.route("/health")
def health():
"""health route"""
state = {"status": "UP"}
return jsonify(state)
@app.route('/answer')
def answer():
answer = {'The Answer to Life the Universe and Everything': 42}
return jsonify(answer)
@app.route('/answer/<nu... |
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT license.
import json
import time
from tqdm import tqdm
import pandas as pd
path = r'C:\Users\train.tsv'
def local_time():
return str(time.strftime("%H:%M:%S",time.localtime()))
print(local_time() + " Starting script " )
columns = ['author','nu... |
path_cashflow = r"./Cashflows.csv"
path_rate = r"./Yield curve.csv"
# Implementation with Pandas
import pandas as pd
# Read in the cash flows data and rate data as csv
cashflow_df = pd.read_csv(path_cashflow)
rate_df = pd.read_csv(path_rate)
# Calculate discount factor from the rates
rate_df["Discount factor"] = 1 /... |
#!/usr/bin/env python
# -*- coding: utf-8
# Copyright 2017-2019 The FIAAS 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
#
# U... |
""" Network class: a model, made from multiple parts (modules). """
from torch import nn
from .repr_mixin import ModuleDictReprMixin
from .modules import (DefaultModule,
EncoderModule, DecoderModule, MLPDecoderModule,
HuggingFaceLoader, TIMMLoader)
from .utils import get_sha... |
"""
Tools to allow users to place custom meshes on a building
"""
import bpy
import bmesh
from mathutils import Matrix, Vector
from bpy.props import PointerProperty
from .facemap import (
FaceMap,
add_faces_to_map,
add_facemap_for_groups
)
from ..utils import (
select,
local_xyz,
bm_to_obj,
... |
from influxdb.client import InfluxDBClusterClient
from oslo_config import cfg
from oslo_log import log
LOG = log.getLogger(__name__)
CONF = cfg.CONF
influxdb_opts = {
cfg.StrOpt('influxdb_url',
secret=True,
help='influxdb url'),
}
CONF.register_opts(influxdb_opts, 'influxdb')
cl... |
# Copyright 2020 The TensorFlow Probability Authors. All Rights Reserved.
# @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
# THIS FILE IS AUTO-GENERATED BY `gen_linear_operators.py`.
# DO NOT MODIFY DIRECTLY.
# @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@... |
#!/usr/bin/env python
import rospy,copy
from geometry_msgs.msg import Twist
from std_srvs.srv import Trigger, TriggerResponse
from pimouse_ros.msg import LightSensorValues
class WallStop():
def __init__(self):
self.cmd_vel = rospy.Publisher('/cmd_vel',Twist,queue_size=1)
self.sensor_values = Light... |
#!/usr/bin/env python
import mclevel
import infiniteworld
import sys
import os
from box import BoundingBox
import numpy
from numpy import zeros, bincount
import logging
import itertools
import traceback
import shlex
import operator
import codecs
from math import floor
try:
import readline # if available, used by ... |
# Generated by Django 4.0.3 on 2022-03-06 12:36
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('BlogApp', '0005_alter_blogpost_image'),
]
operations = [
migrations.AlterField(
model_name='blogpost',
name='image',... |
"""Tests for cli.py
"""
import os
import subprocess
import sys
from shlex import quote
from shlex import split
import pytest
from pysradb import SRAdb
def run(command):
if sys.version_info.minor >= 7:
result = subprocess.run(split(command), capture_output=True)
else:
result = subprocess.run(... |
import pymysql
from database import db
import asyncio
import aiomysql
class local_mysql():
def __init__(self):
self.host = db['host']
self.user = db['user']
self.password = db['password']
self.database = db['database']
self.db = pymysql.connect(self.host, self.user, self.pa... |
from dygie.predictors.dygie import DyGIEPredictor |
# dataset settings
dataset_type = 'PotsdamDataset'
data_root = 'data/potsdam'
img_norm_cfg = dict(
mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375], to_rgb=True)
crop_size = (512, 512)
train_pipeline = [
dict(type='LoadImageFromFile'),
dict(type='LoadAnnotations', reduce_zero_label=True),
dic... |
# -*- coding: utf-8 -*-
'''
Routines to set up a minion
'''
# Import python libs
from __future__ import print_function
import copy
import errno
import fnmatch
import hashlib
import logging
import multiprocessing
import os
import re
import salt
import signal
import sys
import threading
import time
import traceback
impo... |
""" Functions for algebraic fitting """
from __future__ import (absolute_import, division, print_function,
unicode_literals)
import six
import numpy as np
MODE_DICT_ELLIPSE = {'circle': 'xy', 'ellipse_aligned': '0', 'ellipse': ''}
MODE_DICT_ELLIPSOID = {'sphere': 'xyz', 'prolate': 'xy', 'oblate... |
import argparse
import json
import os
import re
import sys
import simpleamt
def process_assignments(mtc, hit_id, status):
results = []
paginator = mtc.get_paginator("list_assignments_for_hit")
try:
for a_page in paginator.paginate(
HITId=hit_id, PaginationConfig={"PageSize": 100}
... |
from itertools import combinations
from pprint import pprint # noqa
from ahpy import Compare
criteria_comparisons = {
('Cost', 'Safety'): 3,
('Cost', 'Style'): 7,
('Cost', 'Capacity'): 3,
('Safety', 'Style'): 9,
('Safety', 'Capacity'): 1,
('Style', 'Capacity'): 1/7
}
criteria = Compare('Crit... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.