content
stringlengths
0
1.05M
origin
stringclasses
2 values
type
stringclasses
2 values
from __future__ import unicode_literals import datetime from django.core.urlresolvers import reverse from tracpro.polls.models import Answer, PollRun, Response from tracpro.test.cases import TracProDataTest from ..models import BaselineTerm class TestBaselineTermCRUDL(TracProDataTest): def setUp(self): ...
nilq/baby-python
python
# Copyright (c) 2020 Spanish National Research Council # # 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 ...
nilq/baby-python
python
# flake8: noqa # Copyright (c) 2015 - 2017 Holger Nahrstaedt # Copyright (c) 2016-2017 The pyedflib Developers # <https://github.com/holgern/pyedflib> # See LICENSE for license details. from __future__ import division, print_function, absolute_import from ._extensions._pyedflib import * from ...
nilq/baby-python
python
""" Holds functions responsible for objects validation across FAT-Forensics. """ # Author: Kacper Sokol <k.sokol@bristol.ac.uk> # License: new BSD import warnings from typing import Union import numpy as np import fatf.utils.tools as fut __all__ = ['is_numerical_dtype', 'is_textual_dtype', 'i...
nilq/baby-python
python
'''Validação de URL com POO Pontos de Obsevação em uma URL: caracteres padrões → "?", "&", "https://", "http://", "www." ''' import re class ExtratorURL: def __init__(self, url): self.url = self.clear_url(url) self.url_validation() def clear_url(self, url): if type(url) == str: ...
nilq/baby-python
python
#!/usr/bin/env python3 project = "stories" copyright = "2018, Artem Malyshev" author = "Artem Malyshev" version = "0.9" release = "0.9" templates_path = ["templates"] source_suffix = ".rst" master_doc = "index" language = None exclude_patterns = ["_build"] pygments_style = "sphinx" html_theme = "alabaster" ...
nilq/baby-python
python
from transformers import AutoModelWithLMHead, AutoTokenizer def run_gpt2(gpt2_input): tokenizer = AutoTokenizer.from_pretrained('gpt2') model = AutoModelWithLMHead.from_pretrained('gpt2') sequence = gpt2_input input = tokenizer.encode(sequence, return_tensors='pt') generated = model.generate(inpu...
nilq/baby-python
python
# coding=utf-8 # Copyright 2018 The TF-Agents 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...
nilq/baby-python
python
import numpy as np from protosc.model.utils import train_xvalidate, create_clusters, select_features from protosc.model.filter import FilterModel from protosc.simulation import create_correlated_data, create_independent_data from protosc.feature_matrix import FeatureMatrix def get_test_matrix(n_row=100, n_col=50): ...
nilq/baby-python
python
# -*- coding: utf-8 -*- import base64 import hashlib import math import time from datetime import datetime # from ccxt.base.errors import AuthenticationError, InvalidOrder from ccxt.base.errors import ExchangeError from ccxt.base.exchange import Exchange class qtrade (Exchange): def describe(self): ret...
nilq/baby-python
python
import os from typing import List # # get next filename under the [exchange directory]. if there is no folder for filename - the folder will be created # def get_next_report_filename(dir, filename_mask): filename_mask2 = filename_mask % (dir, 0) directory = os.path.dirname(filename_mask2) try: o...
nilq/baby-python
python
#!/usr/bin/env python # coding: utf-8 # This notebook was prepared by [Donne Martin](https://github.com/donnemartin). Source and license info is on [GitHub](https://github.com/donnemartin/interactive-coding-challenges). # # Challenge Notebook # ## Problem: Implement Fizz Buzz. # # * [Constraints](#Constraints) # * ...
nilq/baby-python
python
#IP Address of the SQL server host = "157.230.209.171" #MySql username user = "easley_1267" #MySQL password password = "ROY7iOUUQAt18r8qnsXf5jO3foUHgAbp"
nilq/baby-python
python
import pandas as pd def convert_jh_global_time_series_to_long(df, name): """Converts JH global time series data from wide to long format""" df = df.melt(id_vars=['Province/State', 'Country/Region', 'Lat', 'Long'], var_name='date', value_name=name) # Convert to datetime ...
nilq/baby-python
python
import time def example(seconds): print('Starting task') for i in range(seconds): print(i) time.sleep(1) print('Task completed') if __name__ == '__main__': example(10)
nilq/baby-python
python
"""The wireless version of a connection""" from Connection import Connection class Wireless_Connection(Connection): type = "Wireless_Connection" def __init__(self, source, dest): """ Create a connection between wireless devices. """ Connection.__init__(self, source,...
nilq/baby-python
python
from celery import shared_task @shared_task def add(a, b): return (a+b)
nilq/baby-python
python
# This file is part of the History Store (histore). # # Copyright (C) 2018-2021 New York University. # # The History Store (histore) is released under the Revised BSD License. See # file LICENSE for full license details. """Writer for archives that are materialized as Json files on the file system. """ from typing im...
nilq/baby-python
python
#!/usr/bin/env python from ALU import * import numpy as np import pandas as pd import pickle class Dataset(): def __init__(self, data_bits, path, label_bit_msk=None): if label_bit_msk is None: label_bit_msk = [True for _ in range(data_bits)] elif(len(label_bit_msk) > data_bits): ...
nilq/baby-python
python
''' Regrid the GBT data to match the VLA HI data. ''' from spectral_cube import SpectralCube from astropy.utils.console import ProgressBar import numpy as np import os from cube_analysis.io_utils import create_huge_fits from paths import fourteenB_HI_data_path, data_path # Load the non-pb masked cube vla_cube = S...
nilq/baby-python
python
#!/usr/bin/env python # -*- coding: utf-8 -*- class TX(): def __init__(self): self.txid = '' self.inputs = [] self.outputs = [] self.block_height = 0 self.confirmations = 0 def print_tx(self): print '\nblock ', str(self.block_height), "(" + str(self.confirmatio...
nilq/baby-python
python
from series import fibonacci, lucas, sum_series # Fibonacci tests" # Expected Outcome def test_zero(): expected = 0 actual = fibonacci(0) assert actual == expected def test_one(): expected = 1 actual = fibonacci(1) assert actual == expected def test_15n(): expected = 610 actual = fib...
nilq/baby-python
python
from django.urls import path from . import views app_name = 'orders' urlpatterns = [ path('create/', views.order_create, name='order_create'), path( 'order_list/<str:username>/', views.orderlist, name='order_list' ), path( 'order_list/<int:id>/detail/', views.o...
nilq/baby-python
python
''' Python 3.6 This script contains functions to clean the text in the tweets. Methods here are not called directly. Instead, they are called from either "NLTK_clean_tweet_testing.py" or "TextBlob_clean_tweet_testing.py" ''' print("Importing tweetCleaner...") from bs4 import BeautifulSoup import re from nltk.stem im...
nilq/baby-python
python
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import math import json import torch import torch.nn.functional as F from fairseq import metrics, utils from fairseq.criterions import Fairse...
nilq/baby-python
python
# -*- coding: UTF-8 -*- from __future__ import unicode_literals from django.shortcuts import render, get_object_or_404 from django.core.paginator import Paginator, EmptyPage, PageNotAnInteger from .models import MyModel def mymodel_list(request): paginate_by = 24 qs = MyModel.objects.all() paginator = ...
nilq/baby-python
python
import tkinter as tk from sudokuUI import SudokuUI root = tk.Tk() #p = [ [0,i,i+1] for i in range(9) ] + [ [1,(i+3)% 9, i + 1] for i in range(9)] + [ [2,(i+6) % 9, i+1] for i in range(9)] + [[3,(i+1)%9,i+1] for i in range(9)] + [[4,(i+4)%9,i+1] for i in range(9)] + [[5, (i+7)% 9, i + 1] for i in range(9)] + [[6,(...
nilq/baby-python
python
# SPDX-License-Identifier: MIT # Copyright (c) 2021 scmanjarrez. All rights reserved. # This work is licensed under the terms of the MIT license. from contextlib import closing import sqlite3 as sql DB = 'diptico.db' def setup_db(): with closing(sql.connect(DB)) as db: with closing(db.cursor()) as cur...
nilq/baby-python
python
######## # Copyright (c) 2019 Cloudify Platform Ltd. 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 requi...
nilq/baby-python
python
# Generated by Django 2.2.3 on 2019-07-30 13:15 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('events', '0002_auto_20190730_0034'), ('profiles', '0002_profile_follows'), ] operations = [ migrations.AddField( model_n...
nilq/baby-python
python
import numpy as np import warnings from time import sleep from main import get_prediction from example_data_base import save_historical_data, get_historical_data prediction_rates = {} def get_random_array(n): return np.random.randint(0, 10, n).tolist() def convert_to_db_format(predictions): cars = predicti...
nilq/baby-python
python
# Ivan Carvalho # Solution to https://www.urionlinejudge.com.br/judge/problems/view/2057 #!/usr/bin/env python2.7 # encoding : utf-8 numero = sum([int(i) for i in raw_input().split(" ")]) if numero < 0: print numero + 24 elif numero < 24: print numero else: print numero-24
nilq/baby-python
python
"""Centralized setup of logging for the service.""" import logging.config import sys from os import path def setup_logging(conf): """Create the services logger.""" if conf and path.isfile(conf): logging.config.fileConfig(conf) print("Configure logging, from conf:{}".format(conf), file=sys.std...
nilq/baby-python
python
import setuptools setuptools.setup( name='pytorch-nce2', version='0.0.1', author='Kaiyu Shi', author_email='skyisno.1@gmail.com', description='An NCE implementation in pytorch', long_description=open('README.md').read(), long_description_content_type='text/markdown', url='https://githu...
nilq/baby-python
python
import os import errno import librosa import librosa.display import matplotlib.pyplot as plt import numpy as np from sklearn.model_selection import train_test_split DATA_PATH = 'raw_data' SAMPLE_RATE = 16000 DURATION = 2.5 OFFSET = 0.5 HOP_LENGTH = 512 # MFCC -> (n_mfcc, t) # t = sample_rate * time / hop_length MAX...
nilq/baby-python
python
# # Copyright (c) 2013-2018 Quarkslab. # This file is part of IRMA project. # # 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 in the top-level directory # of this distribution and at: # # http:...
nilq/baby-python
python
from django.db import models class Category(models.Model): name = models.CharField(max_length=128, unique=True) def __str__(self): return self.name class Page(models.Model): category = models.ForeignKey(Category, on_delete=models.CASCADE) title = models.CharField(max_length=128) ur...
nilq/baby-python
python
#!/usr/bin/env python # Copyright (c) 2014 Google Inc. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. # mock, just outputs empty .h/.cpp files import os import sys if len(sys.argv) == 2: basename, ext = os.path.splitext(sys.argv[1]) wit...
nilq/baby-python
python
from .unigram import UniGramModel
nilq/baby-python
python
import os import pandas as pd jaea_fns_175 = pd.read_csv(os.path.join(__path__[0], "JAEA_FNS_175.csv")).set_index("E")
nilq/baby-python
python
import torch import torch.nn as nn from utils import split_data,read_json_file, get_text from dataset import my_dataset,my_collate_fn from model import my_model,weights_init from engine import train_fn,eval_fn import cv2 from sklearn import model_selection import pandas as pd vocab="- !#$%&'()*+,./0123456789:;<=>?@AB...
nilq/baby-python
python
# creating a tupples #empty tupple s1=() print('s1 : ',s1) #tupple with multiple elements and accessing it s2=(2782,'thakur',99) print('s2 : ',s2) #another way to create tupples and access them S3=(82,85,96,56,70,99) print('S3 : ',S3) s4=74,'sandeep',90 print('s4 : ',s4) s3=(82) print('s3=(82): ',s3) #cre...
nilq/baby-python
python
P = 10 objects = [(5, 18),(2, 9), (4, 12), (6,25)] print("Items available: ",objects) print("***********************************") objects = filter(lambda x: x[0]<=P, objects) objects = sorted(objects, key=lambda x: x[1]/x[0], reverse=True) weight, value, subset = 0, 0, [] print("Items filtered and sorted: ",obj...
nilq/baby-python
python
from setuptools import setup, find_packages setup( name="JsonDataManager", license="MIT", version="1.0", author="PieSignal", author_email="leeon@insiro.me", url="https://github.com/PieSignal/JsonDataManager", requires=["typing >= 3.7.4.1, <4"], packages=find_packages(), )
nilq/baby-python
python
import json import re import sys from math import sin, cos, sqrt, atan2, radians def main(): LAT_ORIGIN = radians(39.103119) # YOUR LOCATION LATITUDE IN ( ) LON_ORIGIN = radians(-84.512016) # YOUR LOCATION LONGITUDE IN ( ) radius_of_earth = 6378.0 results = [] with open("list.txt") as airpor...
nilq/baby-python
python
import vcf import argparse from record import Record, PhaseSet, ChromosomoHaplotype from stats import PhaseSetStats, HapStats def get_phase_set_stats(template_phase_set:PhaseSet, phase_set:PhaseSet): prev_record: Record record: Record t_record: Record t_prev_record: Record record_count = 0 s...
nilq/baby-python
python
# File that prepares the transcripts into CSV for insertion into the database # Created by Thomas Orth import pandas as pd import sys # CHANGE THESE VALUES DEPENDING ON THE TRANSCRIPT name = "Charles Terry" summary = "Charles Terry is interviewed about his life in old trenton and other aspects such as working for t...
nilq/baby-python
python
from __future__ import print_function import numpy as np from collections import defaultdict import matplotlib.pyplot as plt import matplotlib.patches as patches class PQTNode: """PQT Node class""" def __init__(self, bounds=[[0., 1.], [0., 1.]]): self.children = [] self.bounds = bounds ...
nilq/baby-python
python
''' ''' ''' ISC License Copyright (c) 2016, Autonomous Vehicle Systems Lab, University of Colorado at Boulder Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all c...
nilq/baby-python
python
class Matrix(object): def __init__(self, matrix_string): self.__matrix = [[int(el) for el in line.split()] for line in matrix_string.splitlines()] def row(self, index): return self.__matrix[index-1].copy() def column(self, index): return [el[index-1] for el...
nilq/baby-python
python
def texto(num): cores = {'Vermelho': '\033[31;1m', 'Azul': '\033[1;34m', 'Limpa': '\033[m'} print(f'{cores["Vermelho"]}ERRO! "{cores["Azul"]}{num}{cores["Vermelho"]}" não é um valor válido!{cores["Limpa"]}') def leiadinheiro(msg): while True: resp = str(input(msg)).strip() resp1 = resp.rep...
nilq/baby-python
python
# Copyright 2010 Google 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-2.0 # # Unless required by applicable law or a...
nilq/baby-python
python
# -*- coding: utf-8 -*- """ Tencent is pleased to support the open source community by making BK-BASE 蓝鲸基础平台 available. Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved. BK-BASE 蓝鲸基础平台 is licensed under the MIT License. License for BK-BASE 蓝鲸基础平台: ------------------------------------------...
nilq/baby-python
python
# Copyright (C) 2018 Google Inc. # Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file> """Cycle Task Entry RBAC Factory.""" from ggrc.models import all_models from integration.ggrc import Api from integration.ggrc.access_control.rbac_factories import base from integration.ggrc.models import fa...
nilq/baby-python
python
from simplecv.data import test_transforms as ttas from albumentations import Compose, OneOf, Normalize from albumentations import HorizontalFlip, VerticalFlip, RandomRotate90, RandomCrop from simplecv.api.preprocess import albu from albumentations.pytorch import ToTensorV2 import torch.nn as nn config = dict( mode...
nilq/baby-python
python
from .logit_lens import LogitLens
nilq/baby-python
python
""" @author Huaze Shen @date 2019-07-19 """ def combination_sum_2(candidates, target): results = [] if candidates is None or len(candidates) == 0: return results candidates = sorted(candidates) combination = [] helper(results, combination, candidates, 0, target) return results def he...
nilq/baby-python
python
from django.test import TestCase from django.urls import reverse from user.forms import (AssociatedEmailChoiceForm, AddEmailForm, LoginForm, ProfileForm, RegistrationForm) from user.models import User class TestForms(TestCase): def create_test_forms(self, FormClass, valid_dict, invalid_dict, user=None): ...
nilq/baby-python
python
# Copyright (c) 2015-2017 The Switch Authors. All rights reserved. # Licensed under the Apache License, Version 2.0, which is in the LICENSE file. """ This file should only include the version. Do not import any packages or modules here because this file needs to be executed before SWITCH is installed and executed in e...
nilq/baby-python
python
#!/usr/bin/env python # -*- coding: utf-8 -*- from .dependency import Dependency from ..config import Configuration from ..util.process import Process from ..util.color import Color import os class Hashcat(Dependency): dependency_required = False dependency_name = 'hashcat' dependency_url = 'https://has...
nilq/baby-python
python
from PyQt5.QtWidgets import QWidget, \ QHBoxLayout,\ QVBoxLayout,\ QDialog,\ QLineEdit,\ QLabel,\ QPushButton from PyQt5.QtCore import Qt class NewFile(QDialog): def __init__(self, parent=None): super().__init__(parent) self.name = QLineEdit() self.name.setText("Un...
nilq/baby-python
python
''' Base class for RTE test suite ''' import abc import numpy as np class BaseTestRTE(object): ''' base class to test all interfaces ''' __metaclass__ = abc.ABCMeta @property @abc.abstractmethod def _interface(self): return None def test_apply_bc_0(self): ''' a...
nilq/baby-python
python
"""A client for Team Foundation Server.""" from __future__ import unicode_literals import logging import os import re import sys import tempfile import xml.etree.ElementTree as ET from six.moves.urllib.parse import unquote from rbtools.clients import RepositoryInfo, SCMClient from rbtools.clients.errors import (Inv...
nilq/baby-python
python
########### IMPORTING THE REQURIED LIBRARIES ########### from __future__ import print_function from bs4 import BeautifulSoup as soup from random import choice from terminaltables import AsciiTable from .proxy import _proxy from .utils import * import requests ######## DECLARING THE CLASS FOR GETTING COVID-19 DATA ###...
nilq/baby-python
python
#!/usr/bin/env python3 import sys import re # www.hackerrank.com # http://www.hackerrank.com # Regex_Pattern = r'^\w{3}\W{1}\w+\W{1}\w{3}$' Regex_Pattern = r'^\d{1}\w{4}\.$' print(str(bool(re.search(Regex_Pattern, input()))).lower())
nilq/baby-python
python
#! /usr/bin/env python # encoding: utf-8 # WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file import os,re from waflib import Utils,Options,Context gnuopts=''' bindir, user commands, ${EXEC_PREFIX}/bin sbindir, system binaries, ${EXEC_PREFIX}/sbin libexecdir, program-specific binaries, ${EXEC...
nilq/baby-python
python
import logging import numpy import parse_cif_file import os import sys from operator import itemgetter def get_dihedral_angle1(p0,p1,p2,p3): """http://stackoverflow.com/q/20305272/1128289""" p = [p0, p1, p2, p3] b = p[:-1] - p[1:] b[0] *= -1 v = numpy.array( [ v - (v.dot(b[1])/b[1].dot(b[1])) * b[1...
nilq/baby-python
python
# -*- coding: utf-8 -*- """ cdeweb.errors ~~~~~~~~~~~~~ Error views. :copyright: Copyright 2016 by Matt Swain. :license: MIT, see LICENSE file for more details. """ from __future__ import absolute_import from __future__ import division from __future__ import print_function from __future__ import unicode_literals imp...
nilq/baby-python
python
from setuptools import setup setup( name='zipf', version='0.1', author='Amira Khan', packages=['zipf'], install_requires=[ 'matplotlib', 'pandas', 'scipy', 'pyyaml', 'pytest'], entry_points={ 'console_scripts': [ 'countwords = zipf.co...
nilq/baby-python
python
from abc import ABC, abstractmethod import ccxt from PySide6 import QtWidgets # import ccxt.async_support as ccxt from XsCore import xsIni from ccxt import Exchange class PluginBase(ABC): name: str = "" display_name: str = "" info: str = "" help_doc = "" # 不重写为没有文档 使用文档说明,为md文件,存放database的plugin_help...
nilq/baby-python
python
# Copyright 2014 Google 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-2.0 # # Unless required by applicable law or ...
nilq/baby-python
python
# link:https://leetcode.com/problems/design-browser-history/ class BrowserHistory: def __init__(self, homepage: str): self.forw_memo = [] # forw_memo stores the future url self.back_memo = [] # back_memo stores the previous url self.curr_url = homepage def visit(self, url: str...
nilq/baby-python
python
''' Models utility module. ''' import tensorflow as tf def dense(input_size,output_size,depth,size): '''Create a dense model with specific input_size,output_size,depth and number of neuros.''' layers = [tf.keras.layers.Flatten(input_shape=(input_size,input_size,3))] for i in range(depth): ...
nilq/baby-python
python
# -*- coding: utf-8 -*- """ @file @brief """ import timeit import pandas def unit(x): """ Optimizes the rendering of time. .. runpython:: :showcode: from jupytalk.benchmark.mlprediction import unit print(unit(34)) print(unit(3.4)) print(unit(0.34)) print(...
nilq/baby-python
python
DRB1_1385_9 = {0: {'A': -999.0, 'E': -999.0, 'D': -999.0, 'G': -999.0, 'F': -0.004754, 'I': -0.99525, 'H': -999.0, 'K': -999.0, 'M': -0.99525, 'L': -0.99525, 'N': -999.0, 'Q': -999.0, 'P': -999.0, 'S': -999.0, 'R': -999.0, 'T': -999.0, 'W': -0.004754, 'V': -0.99525, 'Y': -0.004754}, 1: {'A': 0.0, 'E': 0.1, 'D': -1.3, '...
nilq/baby-python
python
from linghelper.phonetics.praat import PraatLoader from linghelper.phonetics.praat.helper import to_time_based_dict from scipy.interpolate import interp1d from numpy import vstack,array def interpolate_pitch(pitch_track): defined_keys = [k for k in sorted(pitch_track.keys()) if pitch_track[k]['Pitch'] != '--...
nilq/baby-python
python
import sys import web_tests.create_test_suite as tests import web_tests.csv2_runner as csv2_runner def main(gvar): # setup to run Chromium tests runner = csv2_runner.Csv2TestRunner(verbosity=2, gvar=gvar) suite = tests.chromium_test_suite() runner.run(suite) print() if __name__ == "__main__": ...
nilq/baby-python
python
from payment.payment_interface import PaymentInterface from rest_framework.test import APITestCase class TestPaymentInterface(APITestCase): def test_get(self): res = PaymentInterface.get('https://api.paystack.co/bank') self.assertEquals(res.get('status'), True) def test_get_with_auth(self): ...
nilq/baby-python
python
import numpy as np from multiprocessing import Pool from multiprocessing import cpu_count _user_input = None _item_input = None _labels = None _batch_size = None _index = None _dataset = None # input: dataset(Mat, List, Rating, Negatives), batch_choice, num_negatives # output: [_user_input_list, _item_inp...
nilq/baby-python
python
#!/usr/bin/python3 import numpy as np from os.path import join as pjoin from os import linesep from shutil import copyfile from scipy.io import mmwrite from scipy.sparse import coo_matrix import gzip diri='data/raw' diro='data/de' key='celltype' values=['dysfunctional','naive'] #Load covariate info dc=np.loadtxt(pj...
nilq/baby-python
python
__version__ = "0.3.2" __api_version__ = "0.10.1"
nilq/baby-python
python
from aiocloudflare.commons.auth import Auth class Dnssec(Auth): _endpoint1 = "zones" _endpoint2 = "dnssec" _endpoint3 = None
nilq/baby-python
python
#reference: https://github.com/val-iisc/capnet/blob/master/src/proj_codes.py from __future__ import division import math import numpy as np import torch import utils.network_utils class Projector(torch.nn.Module): ''' Project the 3D point cloud to 2D plane args: xyz: float tensor, (BS,N_PTS,...
nilq/baby-python
python
#!/usr/bin/python #--2 and 3-- __author__ = "gray" __date__ = "20171228" __version__ = "1.0.2" __aim__ = """ GetData.py for miseq pipeline CHSLAB used Copy file, Rename file, unzip file > for QC used input: sample sheet project Dir (Target Dir) [sample sheet] format RawSampleName\tNewSampleName[marker] "...
nilq/baby-python
python
# Standard Library import json import os import pstats import shutil import time from multiprocessing.pool import ThreadPool # Third Party import boto3 import pandas as pd import pytest # First Party from smdebug.core.access_layer.utils import is_s3 from smdebug.profiler.analysis.python_profile_analysis import Pyinst...
nilq/baby-python
python
# # Copyright (c) 2009-2015 Tom Keffer <tkeffer@gmail.com> # # See the file LICENSE.txt for your full rights. # """Console simulator for the weewx weather system""" from __future__ import with_statement from __future__ import absolute_import from __future__ import print_function import math import random import ...
nilq/baby-python
python
from typing import Dict import psycopg2 import requests def insert_reading(reading: Dict): sql = """ INSERT INTO youless_readings ( net_counter, power, consumption_high, consumption_low, production_high, p...
nilq/baby-python
python
import os import torch from torch.autograd import Function import torch.nn as nn from typing import * from torch.utils.cpp_extension import load ppp_ops = load(name="ppp_ops", sources=[f"{os.path.dirname(os.path.abspath(__file__))}/pointnetpp_operations.cpp", f"{os.path.dirname(...
nilq/baby-python
python
import sys import time import pprint from web3 import Web3 from solcx import compile_source import os contract_source_path = os.environ['HOME']+'/765_a3/MyContract.sol' logs = False grcpt = False def compile_source_file(file_path): with open(file_path, 'r') as f: source = f.read() return compile_source(s...
nilq/baby-python
python
import xacc xacc.Initialize() # Get access to D-Wave QPU and # allocate some qubits dwave = xacc.getAccelerator('dwave') qubits = dwave.createBuffer('q') # Define the function we'd like to # off-load to the QPU, here # we're using a the QMI low-level language @xacc.qpu(accelerator=dwave) def f(buffer, h, j): ...
nilq/baby-python
python
# -*- coding: utf-8 -*- ''' Redis SDB module ================ .. versionadded:: 2019.2.0 This module allows access to Redis using an ``sdb://`` URI. Like all SDB modules, the Redis module requires a configuration profile to be configured in either the minion or master configuration file. This profile requires very...
nilq/baby-python
python
import ast import os import logging from contextlib import contextmanager from pystatic.arg import Arg, Argument from typing import List, Tuple from pystatic.target import Target from pystatic.symid import symid2list from pystatic.typesys import TypeClassTemp, TypeFuncTemp, TypeIns, TypeTemp, TypeType from pystatic.sym...
nilq/baby-python
python
#!/usr/bin/env python # -*- coding: utf-8 -*- """ Copyright (c) 2012, Rui Carmo Description: Docstring utility functions License: MIT (see LICENSE.md for details) """ import os, sys, logging import inspect from bottle import app log = logging.getLogger() def docs(): """Gather all docstrings related to routes an...
nilq/baby-python
python
import pytest from pydantic import ValidationError from porcupine.base import Serializer class User(object): def __init__(self, name=None, surname=None, age=None): self.name = name self.surname = surname self.age = age class UserSerializer(Serializer): name: str surname: str ...
nilq/baby-python
python
from pkg_resources import parse_version from configparser import ConfigParser import setuptools assert parse_version(setuptools.__version__)>=parse_version('36.2') # note: all settings are in settings.ini; edit there, not here config = ConfigParser(delimiters=['=']) config.read('settings.ini') cfg = config['DEFAULT'...
nilq/baby-python
python
import json import requests __version__ = '1.0.2' class TelenorWeb2SMSException(Exception): """A generic exception for all others to extend.""" def __str__(self): # Use the class docstring if the exception message hasn't been provided if len(self.args) == 0: re...
nilq/baby-python
python
from functools import partial from typing import Callable, Tuple import numpy as np from hmc.core import for_loop, while_loop from hmc.integrators.terminal import cond def step(val: Tuple, zo: np.ndarray, step_size: float, vector_field: Callable) -> Tuple: """Single step of the implicit midpoint integrator. Com...
nilq/baby-python
python
import pandas as pd from datetime import datetime import shlex import subprocess import requests from reportlab.pdfgen import canvas def generateReport(event_ts, keys): print('printing report') directory = "./data/" csv_name = "result.csv" csvpath = directory + csv_name csv = pd.read_csv(csvpath) ...
nilq/baby-python
python
"""regex utils """ import re def remove_digits(s: str) -> str: """ removes digits in a string """ return re.sub("\d+", "", s)
nilq/baby-python
python
''' Transcribing DNA into RNA http://rosalind.info/problems/rna/ Problem An RNA string is a string formed from the alphabet containing 'A', 'C', 'G', and 'U'. Given a DNA string t corresponding to a coding strand, its transcribed RNA string u is formed by replacing all occurrences of 'T' in t with 'U' in u. Given: ...
nilq/baby-python
python