content
stringlengths
0
1.05M
origin
stringclasses
2 values
type
stringclasses
2 values
import smart_imports smart_imports.all() class SettingAdmin(django_admin.ModelAdmin): list_display = ('key', 'value', 'updated_at') def save_model(self, request, obj, form, change): from . import settings settings[obj.key] = obj.value def delete_model(self, request, obj): from ....
nilq/baby-python
python
from __future__ import division import pandas as pd import numpy as np from sklearn.neighbors import NearestNeighbors import sys import pickle __author__ = 'sladesal' __time__ = '20171110' """ Parameters ---------- data : 原始数据 tag_index : 因变量所在的列数,以0开始 max_amount : 少类别类想要达到的数据量 std_rate : 多类:少类...
nilq/baby-python
python
from django.contrib.auth.models import User from django.shortcuts import render from ..date_checker import update_all from ..forms import UserForm, UserProfileForm from ..models import UserProfile from random import randint def register(request): """Registration Page View Displays registration form for user ...
nilq/baby-python
python
import numpy as np import pickle import tensorflow as tf import os import sys sys.path.append("../../..") sys.path.append("../..") sys.path.append("..") import utils import random import math from mimic3models.multitask import utils as mt_utils from waveform.WaveformLoader import WaveformDataset from mimic3models.prepr...
nilq/baby-python
python
import math def get_client_ip(request) -> str: """Get real client IP address.""" x_forwarded_for = request.META.get('HTTP_X_FORWARDED_FOR') if x_forwarded_for: ip = x_forwarded_for.split(',')[0] else: ip = request.META.get('REMOTE_ADDR') return ip def get_pretty_file_size(size_in...
nilq/baby-python
python
""" mmic A short description of the project. """ # Add imports here from . import components # Handle versioneer from ._version import get_versions versions = get_versions() __version__ = versions["version"] __git_revision__ = versions["full-revisionid"] del get_versions, versions
nilq/baby-python
python
#!/usr/bin/env python from __tools__ import MyParser from __tools__ import XmlParser #import matplotlib.pyplot as plt import lxml.etree as lxml import subprocess as sp import numpy as np parser=MyParser(description="Tool to create histogramm for iexcitoncl from jobfile") parser.add_argument("--format",type=str,defau...
nilq/baby-python
python
#!/usr/bin/env python3 import sys import os import logging import numpy as np import PIL.Image as Image import vboard as vb if __name__ == '__main__': logging.basicConfig(level=logging.INFO) kl = vb.detect_key_lines() for filename in sys.argv[1:]: name = os.path.basename(filename) try: ...
nilq/baby-python
python
import argparse import os import json from bs4 import BeautifulSoup from tqdm import tqdm if __name__ == "__main__": parser = argparse.ArgumentParser(description='Script to process podcasts trascripts to json file') parser.add_argument('--input_file', type=str, required=True) parser.add_argument('--output...
nilq/baby-python
python
#!/usr/bin/env python # encoding: utf-8 """ File: thin_mrbayes_runs.py Author: Brant Faircloth Created by Brant Faircloth on 29 March 2012 09:03 PDT (-0700) Copyright (c) 2012 Brant C. Faircloth. All rights reserved. Description: """ import os import sys import glob import shutil import argparse from phyluce.helpe...
nilq/baby-python
python
# Copyright 2013-2018 Lawrence Livermore National Security, LLC and other # Spack Project Developers. See the top-level COPYRIGHT file for details. # # SPDX-License-Identifier: (Apache-2.0 OR MIT) from spack import * class Panda(CMakePackage): """PANDA: Parallel AdjaceNcy Decomposition Algorithm""" homepage...
nilq/baby-python
python
import argparse import json import pickle from bz2 import BZ2File from pprint import pprint # with open("wiki_data/properties.pkl", "rb") as props: # properties_mapper = pickle.load(props) properties_mapper = {} properties_mapper.update( { "Q6581097": "male", "Q6581072": "female", } ) d...
nilq/baby-python
python
# ---------------------------------------------------------------------------- # Copyright (c) 2013--, scikit-bio development team. # # Distributed under the terms of the Modified BSD License. # # The full license is in the file COPYING.txt, distributed with this software. # --------------------------------------------...
nilq/baby-python
python
from rest_framework.test import APITestCase from rest_framework import status from rest_framework.reverse import reverse as api_reverse from survivor.models import Survivor, FlagAsInfected, Reports class ReportsAPITestCase(APITestCase): def setUp(self): Survivor.objects.create( name='New Name...
nilq/baby-python
python
import pathlib from setuptools import setup current_location = pathlib.Path(__file__).parent README = (current_location / "README.md").read_text() setup( name="wiktionary-parser-ru", version="0.0.1", packages=["wiktionaryparserru", "tests"], url="https://github.com/ShatteredMind/wiktionaryparserru", ...
nilq/baby-python
python
def convert(s): s_split = s.split(' ') return s_split def niceprint(s): for i, elm in enumerate(s): print('Element #', i + 1, ' = ', elm, sep='') return None c1 = 10 c2 = 's'
nilq/baby-python
python
# Copyright (c) Microsoft Corporation. # Licensed under the MIT license. """ LightGBM/Python training script """ import os import sys import argparse import logging import traceback import json from distutils.util import strtobool import lightgbm from collections import namedtuple # Add the right path to PYTHONPATH #...
nilq/baby-python
python
""" Lark parser and AST definition for Domain Relational Calculus. """ from typing import Dict, NamedTuple, Set, Tuple from lark import Lark, Token, Tree from relcal import config from relcal.helpers.primitives import Singleton #################### # Type definitions # #################### Fields = Tuple[Token, ......
nilq/baby-python
python
import logging import logging.config import os import signal import sys import click import gevent import gevent.pool from eth_keys.datatypes import PrivateKey from eth_utils import to_checksum_address from gevent.queue import Queue from marshmallow.exceptions import ValidationError from toml.decoder import TomlDecode...
nilq/baby-python
python
# -*- coding: utf-8 -*- """ Test cases related to direct loading of external libxml2 documents """ from __future__ import absolute_import import sys import unittest from .common_imports import HelperTestCase, etree DOC_NAME = b"libxml2:xmlDoc" DESTRUCTOR_NAME = b"destructor:xmlFreeDoc" class ExternalDocumentTestC...
nilq/baby-python
python
import math from tkinter import Tk, Canvas, W, E, NW from tkinter.filedialog import askopenfilename from tkinter import messagebox from scipy.interpolate import interp1d import time import numpy as np # Definición recursiva, requiere numpy # def B(t,P): # if len(P)==1: # return np.array(P[0]) # else: # ...
nilq/baby-python
python
from gensim.models.keyedvectors import KeyedVectors import numpy as np import pandas as pd __author__ = "Sreejith Sreekumar" __email__ = "sreekumar.s@husky.neu.edu" __version__ = "0.0.1" model = KeyedVectors.load_word2vec_format('/media/sree/venus/pre-trained-models/GoogleNews-vectors-negative300.bin', binary=True...
nilq/baby-python
python
#!/usr/bin/python # -*- coding: utf-8 -*- # Filename: results_to_latex.py import os, argparse, json, math import logging TEMPLATE_CE_RESULTS = r"""\begin{table}[tb] \scriptsize \centering \caption{Chaos Engineering Experiment Results on %s}\label{tab:ce-experiment-results-%s} \begin{tabularx}{\columnwidth}{lrrrXXXX} ...
nilq/baby-python
python
import yfinance as yf import pandas as pd import numpy as np import quandl API_KEY = '8ohVvwCgmzgRpFeza8FD' quandl.ApiConfig.api_key = API_KEY # Download APPL Stock price df = yf.download('AAPL', start='1999-12-31', end='2010-12-31', progress=False) df.rename(columns = {'Adj Close': 'adj_close'},inplace=True) df = d...
nilq/baby-python
python
#!/usr/bin/env python ############################################################################# ## ## This file is part of Taurus, a Tango User Interface Library ## ## http://www.tango-controls.org/static/taurus/latest/doc/html/index.html ## ## Copyright 2011 CELLS / ALBA Synchrotron, Bellaterra, Spain ## ## Tau...
nilq/baby-python
python
TEST = 'noe'
nilq/baby-python
python
#!/usr/bin/env python # -*- coding: utf-8 -*- """ routines for getting network interface addresses """ # by Benjamin C. Wiley Sittler, BSD/OSX support by Greg Hazel __all__ = [ 'getifaddrs', 'getaddrs', 'getnetaddrs', 'getbroadaddrs', 'getdstaddrs', 'main', 'IFF_UP', 'IFF_BROADCAST', ...
nilq/baby-python
python
from .main import * from .database import * from .headless import * from .bdi import * from .spq import * from .oci import * from .stai import * from .starter import * from .two_of_four_ocd_practice import * from .two_of_four_ocd_test import * from .extra import * from .teacher_practice import * from .teacher_test imp...
nilq/baby-python
python
# Do not edit this file directly. # It was auto-generated by: code/programs/reflexivity/reflexive_refresh load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_file") def imgui(): http_archive( name = "imgui", build_file = "...
nilq/baby-python
python
#!/usr/bin/env python # -*- coding: utf-8 -*- """Perform a functional test of the status command.""" import os import orion.core.cli def test_no_experiments(clean_db, monkeypatch, capsys): """Test status with no experiments.""" monkeypatch.chdir(os.path.dirname(os.path.abspath(__file__))) orion.core.cli....
nilq/baby-python
python
import json import sqlite3 with open('../data_retrieval/authors/author_info.json') as data_file: data = json.load(data_file) connection = sqlite3.connect('scholarDB.db') with connection: cursor = connection.cursor() for row in data: name = row['name'] website = row['website'] emai...
nilq/baby-python
python
#!/usr/bin/env python3 # Copyright (c) Facebook, Inc. and its affiliates. # All rights reserved. # # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree. """ Custom Jupyterhub Authenticator to use Facebook OAuth with business manager check. ""...
nilq/baby-python
python
import numpy as np import pandas as pd from sklearn import * from sklearn.linear_model import LinearRegression from sklearn.model_selection import train_test_split from matplotlib import pyplot import time import os showPlot=True #prepare data data_file_name = "../FinalCost.csv" data_csv = pd.read_csv(data_file_na...
nilq/baby-python
python
import numpy as np class ZeroNoisePrng: """ A dummy PRNG returning zeros always. """ def laplace(self, *args, size=1, **kwargs): return np.zeros(shape=size) def exponential(self, *args, size=1, **kwargs): return np.zeros(shape=size) def binomial(self, *args, size=1, **kwargs):...
nilq/baby-python
python
''' @author: Sana Dev Team Created on May 24, 2011 ''' from __future__ import with_statement import sys, traceback from django.conf import settings from django.core import urlresolvers from piston.utils import decorator from sana import api from sana.api.fields import REQUEST, DISPATCHABLE CRUD = {'GET':'read', 'PO...
nilq/baby-python
python
"""You are given an integer n, the number of teams in a tournament that has strange rules: If the current number of teams is even, each team gets paired with another team. A total of n / 2 matches are played, and n / 2 teams advance to the next round. If the current number of teams is odd, one team randomly advances i...
nilq/baby-python
python
from django.contrib import admin from publicmarkup.legislation.models import Resource, Legislation, Title, Section class LegislationAdmin(admin.ModelAdmin): prepopulated_fields = {"slug": ("name",)} class SectionInline(admin.TabularInline): model = Section extra = 5 class TitleAdmin(admin.Mod...
nilq/baby-python
python
from pyscenario import * from util.arg import * from util.scene import RoadSideGen class Scenario(PyScenario): def get_description(self): return 'Test random boxes at the border of roads' def get_map(self): return arg_get('-map', 'shapes-1') def init(self): gen = RoadSideGen(self....
nilq/baby-python
python
def two(x, y, *args): print(x, y, args) if __name__ == '__main__': two('a', 'b', 'c')
nilq/baby-python
python
#!/usr/bin/env python3 from _common import StreamContext import sys from argparse import ArgumentParser import itertools from shelltools.ressample import ReservoirSampler from typing import Sequence def _has_dupes(items: Sequence): if len(items) <= 1: return False if len(items) == 2: return it...
nilq/baby-python
python
import sys import argparse import matplotlib.pyplot as plt import pandas as pd import tensorflow as tf from sklearn.utils import shuffle def main(_): # read data df = pd.read_csv('../../data/boston/boston_train.csv', header=0) print(df.describe()) f, ax1 = plt.subplots() for i in range(1, 8): ...
nilq/baby-python
python
# Copyright 2021 Michal Krassowski from collections import defaultdict from time import time from jedi.api.classes import Completion from .logger import log class LabelResolver: def __init__(self, format_label, time_to_live=60 * 30): self.format_label = format_label self._cache = {} sel...
nilq/baby-python
python
import pandas as pd import numpy as np #seri olusturma #s = pd.Series(data, index=index) ile seri olusturulur # s = pd.Series(np.random.randn(5)) #index --> 0,1,2,3,4 # s = pd.Series(np.random.randn(5),index=['a','b','c','d','e']) # print(s) # print('-'*50) # print(s.index) # print('*'*50) # data = {'a':2...
nilq/baby-python
python
import numpy as np def fieldFromCurrentLoop(current, radius, R, Z): """ Checks inputs to fieldFromCurrentLoop() for TypeErrors etc. """ if type(current) != type(0.): raise TypeError("Current should be a float, "+str(type(current))+" detected.") if type(radius) != type(0.): raise ...
nilq/baby-python
python
n = int(input('number: ')) count = 0 for i in range(1, n+1): if n % i == 0: count += 1 print(i, end=' ') print() print('count:', count)
nilq/baby-python
python
#!/usr/bin/python # -*- coding: utf-8 -*- # Copyright © 2014, 2015, 2017 Kevin Thibedeau # (kevin 'period' thibedeau 'at' gmail 'punto' com) # # 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...
nilq/baby-python
python
import unittest from sqlalchemy.orm import sessionmaker from nesta.core.orms.nomis_orm import Base from nesta.core.orms.orm_utils import get_mysql_engine class TestNomis(unittest.TestCase): '''Check that the WiktionaryNgram ORM works as expected''' engine = get_mysql_engine("MYSQLDBCONF", "mysqldb") Sessi...
nilq/baby-python
python
from django.apps import AppConfig class DeptConfig(AppConfig): name = 'dept'
nilq/baby-python
python
#!/usr/bin/python # -*- coding: utf-8 -*- # Copyright (c) 2015 Amir Mofasser <amir.mofasser@gmail.com> (@amimof) # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) DOCUMENTATION = """ module: ibmim_installer version_added: "1.9.4" short_description: Install/Uninstall IBM Inst...
nilq/baby-python
python
""" This file defines and implements the basic goal descriptors for PDDL2.2. The implementation of comparison goals is implemented in DomainInequality. """ from typing import Union, List from enum import Enum from pddl.domain_formula import DomainFormula, TypedParameter from pddl.domain_time_spec import TIME_SPEC cl...
nilq/baby-python
python
# pylint # {{{ # vim: tw=100 foldmethod=indent # pylint: disable=bad-continuation, invalid-name, superfluous-parens # pylint: disable=bad-whitespace, mixed-indentation # pylint: disable=redefined-outer-name # pylint: disable=missing-docstring, trailing-whitespace, trailing-newlines, too-few-public-methods # }}} import...
nilq/baby-python
python
import mock import unittest import mongomock from core.seen_manager import canonize, SeenManager from core.metadata import DocumentMetadata from tests.test_base import BaseTestClass class TestSeenManager(BaseTestClass): def test_canonize(self): input_url = ["http://www.google.com", "...
nilq/baby-python
python
""" Python generator utilities for DMT """ import shutil from pathlib import Path from setuptools import setup, find_packages here = Path(__file__).parent.resolve() # Remove build and dist folders shutil.rmtree(Path("build"), ignore_errors=True) shutil.rmtree(Path("dist"), ignore_errors=True) # Get the lo...
nilq/baby-python
python
#!/usr/bin/env python # coding: utf-8 # <!--BOOK_INFORMATION--> # <img align="left" style="padding-right:10px;" src="images/book_cover.jpg" width="120"> # # *This notebook contains an excerpt from the [Python Programming and Numerical Methods - A Guide for Engineers and Scientists](https://www.elsevier.com/books/pyth...
nilq/baby-python
python
import markdown from django.template.loader import render_to_string from modules.polygon import models CONTEST_TAG_RE = r'(?i)\[polygon_contest\s+id:(?P<contest_id>\d+)\]' class ContestExtension(markdown.Extension): """Contest plugin markdown extension for SIStema wiki.""" def extendMarkdown(self, md): ...
nilq/baby-python
python
######## # PART 1 def get_numbers(): numbers = None with open("event2019/day16/input.txt", "r") as file: for line in file: numbers = list(map(int, line[:-1])) #numbers = [int(x) for x in line[:-1]] return numbers def fft(inp): ''' TODO: optimize with part 2 ''' ...
nilq/baby-python
python
import streamlit as st def app(): st.write("# About") col1, col2, col3 = st.columns([5,2,5]) with col1: st.image("davide.jpg") st.write("### Davide Torlo") st.write("Ricercatore PostDoc all'Università SISSA di Trieste") st.write("Ideatore principale di concept, metriche e g...
nilq/baby-python
python
keywords = { ".5" : "FOR[ITERATION]", "wrap" : "KEYWORD", "as" : "KEYWORD[ASSIGNMENT]", "let" : "KEYWORD[RELOP]", "pp" : "INCRE[RELOP]", ".2" : "IF[CONDITIONAL]", "vomit" : "KEYWORD[PRINT]", "|" : "PARANTHESIS", "--" ...
nilq/baby-python
python
""" JAX DSP utility functions """ from functools import partial import jax import jax.numpy as jnp import librosa from jax.numpy import ndarray def rolling_window(a: ndarray, window: int, hop_length: int): """return a stack of overlap subsequence of an array. ``return jnp.stack( [a[0:10], a[5:15], a[10:20],...
nilq/baby-python
python
# -*- encoding: utf-8 -*- ''' Created on 2012-3-23 @author: Neil ''' from django.shortcuts import render_to_response from grnglow.glow.views import people from grnglow.glow.models.photo import Photo def base(request): return render_to_response('base.html') def index(request): if request.user.is_authenticat...
nilq/baby-python
python
# -*- coding: utf-8 -*- """ Created on Fri May 24 15:17:13 2019 @author: DaniJ """ ''' It is like the four_layer_model_2try_withFixSpeciesOption_Scaling.py, but with two surfaces. There is not Poisson-Boltzman interaction between the two surfaces. ''' import numpy as np from scipy import linalg def four_layer_two_su...
nilq/baby-python
python
# Step 1 - Gather Data import pandas as pd import datetime import re import json import os import unittest import time import sys # Own Imports sys.path.append(os.path.dirname(os.path.dirname(__file__))) from deployment.Control_Enactor import Enactor from deployment.Data_Retreiver import Data_Retreiver class Contro...
nilq/baby-python
python
# Generated by Django 2.2.6 on 2020-01-18 06:25 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('blog', '0002_auto_20200116_2309'), ] operations = [ migrations.AddField( model_name='enroll', name='outofmid', ...
nilq/baby-python
python
# Copyright (c) 2016, Dennis Meuwissen # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # # 1. Redistributions of source code must retain the above copyright notice, this # list of conditions an...
nilq/baby-python
python
# Simple XML to CSV # e.g. for https://ghr.nlm.nih.gov/download/ghr-summaries.xml # Silas S. Brown 2017 - public domain - no warranty # Bugs: may not correctly handle descriptions that mix # tags with inline text on the same level. # FOR EXPLORATORY USE ONLY. # Where to find history: # on GitHub at https://github.com...
nilq/baby-python
python
def seat_spec_to_id(seat_spec): row = 0 for pos in range(7): if seat_spec[pos] == 'B': row = row + pow(2,6-pos) # print("adding row", pow(2,6-pos)) # print("row", row) col = 0 for pos in range(3): if seat_spec[7+pos] == 'R': col = col + pow(2,2-pos) # print("adding col", pow(2,...
nilq/baby-python
python
import argparse import math import sys def main() -> int: parser = argparse.ArgumentParser( description="Utility for generating the pitch register table C source.", ) parser.add_argument( 'c', metavar='C_FILE', type=str, help='The C file we should generate.', ) ...
nilq/baby-python
python
from llvmlite import ir as lir import llvmlite.binding as ll import numba import hpat from hpat.utils import debug_prints from numba import types from numba.typing.templates import (infer_global, AbstractTemplate, infer, signature, AttributeTemplate, infer_getattr, bound_function) fr...
nilq/baby-python
python
from py.webSocketParser import SurveyTypes neo = [ {"sigma_tp": 7.2258e-06, "diameter": 16.84, "epoch_mjd": 56800.0, "ad": 1.782556743092633, "producer": "Otto Matic", "rms": 0.49521, "H_sigma": "", "closeness": 3366.5887401966647, "spec_B": "S", "K2": "", "K1": "", "M1": "", "two_body": "", "full_name": "433 Eros...
nilq/baby-python
python
# # This script should be sourced after slicerqt.py # def tcl(cmd): global _tpycl try: _tpycl except NameError: # no tcl yet, so first bring in the adapters, then the actual code import tpycl _tpycl = tpycl.tpycl() packages = ['freesurfer', 'mrml', 'mrmlLogic', 'teem', 'vtk', 'vtkITK'] ...
nilq/baby-python
python
import os import shutil import sys from pathlib import Path from subprocess import Popen from cmd.Tasks.Task import Task from cmd.Tasks.Tasks import Tasks from cmd.Tasks.Build.manifest_config import manifest_config import json class Build(Task): NAME = Tasks.BUILD def __build_app(self): print('****'...
nilq/baby-python
python
from django.apps import AppConfig class Sql3Config(AppConfig): name = 'SQL3'
nilq/baby-python
python
# Testing environment setting
nilq/baby-python
python
# -*- coding: utf-8 -*- """ Created on Sun Mar 3 07:06:58 2019 @author: astar """ import random import math import matplotlib.pyplot as plt from time import clock class Ant: def __init__(self, map_): self.map = map_ self.path = [] self.path_length = math.inf ...
nilq/baby-python
python
import unittest from datetime import datetime from pyopenrec.comment import Comment class TestComment(unittest.TestCase): c = Comment() def test_get_comment(self): dt = datetime(2021, 12, 21, 0, 0, 0) data = self.c.get_comment("n9ze3m2w184", dt) self.assertEqual(200, data["status"]) ...
nilq/baby-python
python
from numpy.testing import * import time import random import skimage.graph.heap as heap def test_heap(): _test_heap(100000, True) _test_heap(100000, False) def _test_heap(n, fast_update): # generate random numbers with duplicates random.seed(0) a = [random.uniform(1.0, 100.0) for i in range(n /...
nilq/baby-python
python
# -*- coding: utf-8 -*- # Generated by Django 1.11.18 on 2019-01-25 23:37 from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('core', '0014_auto_20181116_0716'), ] operations = [ migrations.AlterField(...
nilq/baby-python
python
import discord from discord.ext import commands import chickensmoothie as cs class Pet: def __init__(self, bot): self.bot = bot @commands.command() @commands.guild_only() async def pet(self, ctx, link: str = ''): # Pet command pet = await cs.pet(link) # Get pet data if pet ...
nilq/baby-python
python
# ---------------------------------------- # Created on 3rd Apr 2021 # By the Cached Coder # ---------------------------------------- ''' This script defines the function required to get a the email ids to send the mail to from the GForms' responses. Functions: getAllResponses(): No Inputs Returns ...
nilq/baby-python
python
import numpy as np from simulation_api import SimulationAPI from simulation_control.dm_control.utility import EnvironmentParametrization from simulation_control.dm_control.utility import SensorsReading # Check if virtual_arm_environment API works with a given step input sapi = SimulationAPI() sapi.step(np.array([0, 0...
nilq/baby-python
python
def pg(obs, num_particles=100, num_mcmc_iter=2000): T = len(obs) X = np.zeros([num_mcmc_iter, T]) params = [] # list of SV_params # YOUR CODE return X, params
nilq/baby-python
python
# -*- coding: utf-8 -*- import sys import numpy as np import scipy.io.wavfile def main(): try: if len(sys.argv) != 5: raise ValueError("Invalid arguement count"); if sys.argv[1] == "towave": toWave(sys.argv[2], sys.argv[3], float(sys.argv[4])) elif sys....
nilq/baby-python
python
# # BSD 3-Clause License # # Copyright (c) 2017 xxxx # All rights reserved. # Copyright 2021 Huawei Technologies Co., Ltd # # 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 ...
nilq/baby-python
python
# ===- test_floats.py ----------------------------------*- python -*-===// # # Copyright (C) 2021 GrammaTech, Inc. # # This code is licensed under the MIT license. # See the LICENSE file in the project root for license terms. # # This project is sponsored by the Office of Naval Research, One Liberty # Center, 875 ...
nilq/baby-python
python
# Copyright Tom SF Haines # # 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, soft...
nilq/baby-python
python
import json import numpy as np import boto3 import scipy import scipy.sparse from io import BytesIO import os ACCESS_KEY = os.environ['ACCESS_KEY'] SECRET_ACCESS_KEY = os.environ['SECRET_ACCESS_KEY'] def getData(): BUCKET = 'personal-bucket-news-ranking' client = boto3.client('s3', ...
nilq/baby-python
python
B = input().strip() B1 = '' for b in B: if b in ['X', 'L', 'C']: B1 += b else: break if B1 == 'LX': B1 = 'XL' B2 = B[len(B1):] if B2 == 'VI': B2 = 'IV' elif B2 == 'I' and B1.endswith('X'): B1 = B1[:-1] B2 = 'IX' if B1 == 'LX': B1 = 'XL' print(B1+B2)
nilq/baby-python
python
from rest_framework import status from rest_framework.decorators import api_view from rest_framework.response import Response from django.conf import settings import pymongo from . import permissions @api_view(['GET']) def root(request, **kwargs): permitted_user_types = ['interviewer'] if permissions.check(r...
nilq/baby-python
python
import unittest import sys import inspect from unittest.mock import Mock from io import StringIO from math import ceil from damage import Damage from classes import Paladin from spells import PaladinSpell from models.spells.loader import load_paladin_spells_for_level class PaladinTests(unittest.TestCase): def se...
nilq/baby-python
python
# -*- coding: UTF-8 -*- import pika if __name__ == '__main__': connection = pika.BlockingConnection(pika.ConnectionParameters("localhost")) channel = connection.channel() channel.exchange_declare(exchange="tang",type="fanout") message = "You are awsome!" for i in range(0, 100): # 循环100次发送消息 ...
nilq/baby-python
python
import torch.nn as nn import config from utils.manager import PathManager class BaseModel(nn.Module): def __init__(self, model_params: config.ParamsConfig, path_manager: PathManager, loss_func, data_source, **kwargs): s...
nilq/baby-python
python
import pandas as pd from IPython.display import display_html, Image import weasyprint as wsp import matplotlib.pyplot as plt import os import math experiment_pref = 'experiment-log-' test_file_pref = 'test_file_' csv_ext = '.csv' txt_ext = '.txt' def display_best_values(directory=None): real_list = [] oracl...
nilq/baby-python
python
'''Collects tweets, embeddings and save to DB''' from flask_sqlalchemy import SQLAlchemy from dotenv import load_dotenv import os import tweepy import basilica from .models import DB, Tweet, User TWITTER_USERS = ['calebhicks', 'elonmusk', 'rrherr', 'SteveMartinToGo', 'alyankovic', 'nasa', 'sadserver...
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
import logging from contextlib import contextmanager from unittest import mock import pytest import hedwig.conf from hedwig.backends.base import HedwigPublisherBaseBackend from hedwig.backends.import_utils import import_module_attr from hedwig.testing.config import unconfigure from tests.models import MessageType t...
nilq/baby-python
python
# author: Drew Botwinick, Botwinick Innovations # license: 3-clause BSD import os import sys # region Daemonize (Linux) # DERIVED FROM: http://code.activestate.com/recipes/66012-fork-a-daemon-process-on-unix/ # This module is used to fork the current process into a daemon. # Almost none of this is necessary (or ad...
nilq/baby-python
python
# -*- coding: utf-8 -*- # Generated by Django 1.10.6 on 2017-03-30 14:57 from __future__ import unicode_literals import cms.models.fields from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): initial = True dependencies = [ ('cms', '0016_au...
nilq/baby-python
python
import pandas as pd #%% print('hello')
nilq/baby-python
python
import pygeoip gip = pygeoip.GeoIP("GeoLiteCity.dat") res = gip.record_by_addr('192.168.29.160') for key, val in res.items(): print('%s : %s' % (key, val))
nilq/baby-python
python
""" Simple data container for a observable """ from tcvx21 import Quantity import numpy as np class MissingDataError(Exception): """An error to indicate that the observable is missing data""" pass class Observable: def __init__(self, data, diagnostic, observable, label, color, linestyle): """Si...
nilq/baby-python
python