content
stringlengths
0
1.05M
origin
stringclasses
2 values
type
stringclasses
2 values
import time from os import path from core_data_modules.cleaners import Codes, PhoneCleaner from core_data_modules.cleaners.cleaning_utils import CleaningUtils from core_data_modules.traced_data import Metadata from core_data_modules.traced_data.io import TracedDataCodaV2IO from core_data_modules.util import IOUtils f...
nilq/baby-python
python
import random from core.skills.skillsLoader import SkillsList from core.utils.cleanOrder import * class Skill: def __init__(self, keyphrases, superwords,badwords, result): self.keyphrases = cleanStringList(keyphrases) # On clean les phrases connues et les mots clés self.superwords = cleanStringLi...
nilq/baby-python
python
from typing import Any import tensorflow as tf from determined import tensorboard class TFKerasTensorBoard(tf.keras.callbacks.TensorBoard): # type: ignore def __init__(self, *args: Any, **kwargs: Any): log_dir = str(tensorboard.get_base_path({}).resolve()) super().__init__(log_dir=log_dir, *arg...
nilq/baby-python
python
#!/usr/bin/env python import math class Areas: def __init__(self): pass def circle(self, _, radiusEntry, label): radius = float(radiusEntry.get_text()) result = radius**2 * math.pi result = round(result, 3) label.set_text("RESULT: " + str(result)) def triangle(self, _, baseEntry, heightEntry, label): ...
nilq/baby-python
python
from setuptools import setup import setuptools setup(name="rubikenv", version="0.1", description="Gym env for rubik cube", author="Adrien Bufort", author_email="adrienbufort@gmail.com", packages=setuptools.find_packages(), package_dir={"rubikenv": "rubikenv"}, install_requires...
nilq/baby-python
python
import collections from supriya import CalculationRate from supriya.synthdefs import UGen class FreeVerb(UGen): """ A FreeVerb reverb unit generator. :: >>> source = supriya.ugens.In.ar(bus=0) >>> supriya.ugens.FreeVerb.ar( ... source=source, ... ) FreeVe...
nilq/baby-python
python
# print(bin(int(input(),8))[2:]) 짧은 풀이 def change(num, first = False): ret = '' while num: ret += chr(num % 2 + 48) num //= 2 while len(ret) < 3: ret += '0' idx = 3 if first: while idx > 1 and ret[idx - 1] == '0': idx -= 1 return ret[:idx][::-1] N =...
nilq/baby-python
python
import config import transformers import torch.nn as nn class HateSpeechClassifier(nn.Module): def __init__(self): super(HateSpeechClassifier, self).__init__() self.bert = transformers.BertModel.from_pretrained(config.BERT_PATH, return_dict=False) self.bert.resize_token_embeddings(len(conf...
nilq/baby-python
python
import json import sys from extract_excel_create import ExtractExcelCreate from extract_excel_insert import ExtractExcelInsert from extract_excel_update import ExtractExcelUpdate class App: FILE_NAME = '.\excel_config.json' def __init__(self): self._config = self.retrieveData() self._program_t...
nilq/baby-python
python
""" General-purpose PDE System class """ import numpy from dolfin import * from .illposed import * from .errorest import * from .utilities import _call from collections import OrderedDict parameters["refinement_algorithm"] = "plaza_with_parent_facets" __all__ = ["PDESystem", "LinearPDE", "NonlinearPDE", "GoalAdaptiv...
nilq/baby-python
python
class RandomActor: def __init__(self, game): self.game = game def getActionProb(self, board, player): valids = self.game.getValidMoves(board, player) probs = valids sum_probs = sum(probs) probs = [x/float(sum_probs) for x in probs] return probs
nilq/baby-python
python
''' For further detail/future revisions, visit https://shyam.saladi.org/pymol_viridis DESCRIPTION Makes perceptually uniform and colorblind accessible color palettes available in PyMOL Certain colors are indistinguishable to people with the various forms of color blindness, and therefore are better n...
nilq/baby-python
python
from html import unescape from alertserver.config import Trello as config_trello import trolly client = trolly.client.Client(config_trello.api_key, config_trello.token) assert client is not None member = client.get_member() assert member is not None print('Connected by Member: %s' % member.get_member_information()[...
nilq/baby-python
python
from snapedautility.plot_corr import plot_corr import pandas as pd import numpy as np from pytest import raises import altair def df(): df = pd.DataFrame({"a":np.random.normal(100, 30, 5), "b":np.random.normal(8, 5, size=5), "c":np.random.randint(100, size=5), ...
nilq/baby-python
python
import os from django.conf import settings from utils.email import add_outgoing_email # expense emails def send_accountingsystem_expense_email(expense): """ Sends an email to the accountingsystem with the invoice as an attachment, and with the expense uuid and description in email subject """ a...
nilq/baby-python
python
from .proxyselenium import get_chromedriver
nilq/baby-python
python
from django import template from django.utils.safestring import mark_safe import commonmark register = template.Library() @register.filter() def commonmark_safe(text): ast = commonmark.Parser().parse(text) walker = ast.walker() # Remove images for node, entering in walker: if node.t == 'ima...
nilq/baby-python
python
import plotly.graph_objects as go import networkx as nx from pathlib import Path import os import subprocess import importlib.util """ This file handles the logic when a button is pressed on our GUI __author__ Cade Tipton __author__ Gatlin Cruz __version__ 9/15/20 """ BASE_DIR = Path(__file__).resolve().parent.parent ...
nilq/baby-python
python
#!/usr/bin/env python3 import os import logging logger = logging.getLogger("rpifancontrol.cputemp") def get(): """ Obtains the current CPU temperature. :returns: Current CPU temperature if successful, zero value otherwise. :rtype: float """ result = -1. # The first line in this file hol...
nilq/baby-python
python
import json import os import boto3 from botocore.exceptions import ClientError from typing import Any, Dict from aws_lambda_powertools import Logger, Tracer from aws_lambda_powertools.utilities.typing import LambdaContext from aws_lambda_powertools.utilities.data_classes import APIGatewayProxyEvent from boto3.dynamodb....
nilq/baby-python
python
import dace.library def assert_exists(name): dace.library.get_library(name) def assert_not_exists(name): raised = False try: dace.library.get_library(name) except: raised = True pass if not raised: raise RuntimeError("Library " + name + " exists.") assert_not_exist...
nilq/baby-python
python
from train import ex def main(): batch_size = 8 sequence_length = 327680 model_complexity = 48 ex.run( config_updates={ "split": "redux", "audio": "mix.flac", "instrument": "all", "midi_programs": range(96), "max_harmony": None, ...
nilq/baby-python
python
#!/usr/bin/env python from bs4 import BeautifulSoup import glob import pandas as pd import re import sys from parsers import parse_totals, parse_tests from util import normalize_int def is_testing_table(table): headers = [th.text for th in table.findAll("th")] return "Tests" in headers # Use the historical...
nilq/baby-python
python
# -*- coding: utf-8 -*- """ Orchestration for operations on the contacts collection. This is simply pass-through now, but left as a place-holder as an example of a more robust service. """ from typing import List, Dict import falcon from ..common.logging import LoggerMixin from ..repository.contacts_repository impor...
nilq/baby-python
python
# -*- coding: utf-8 -*- import time import numpy as np import torch from app.rangechecker import RangeChecker from videoholder import VideoHolder from track import centroidtracker from util import box_center __all__ = ['CarRecord', 'FeatureExtractor', 'CarCounter'] class CarRecord(): def __init__(self, oid, ...
nilq/baby-python
python
# FIXME: file is only used by Tektronix_driven_transmon.py: we disabled methods overriden there to limit dependencies import logging import numpy as np from scipy.optimize import brent from .qubit_object import Transmon from qcodes.utils import validators as vals from qcodes.instrument.parameter import ManualParamete...
nilq/baby-python
python
if __name__ == '__main__': from vdirsyncer.cli import app app()
nilq/baby-python
python
from abc import ABC, abstractmethod from dataclasses import dataclass from typing import Optional from foundation.value_objects import T from pomodoros.application.queries.tasks import GetRecentTasksByProjectId from pomodoros.application.repositories.tasks import TaskRepository from pomodoros.domain.value_objects impo...
nilq/baby-python
python
#!/usr/bin/env python # coding: utf-8 # Required libraries import os import numpy as np import pandas as pd def define_folder(loc_): """ Creating folder based on the giving location information. If the given information is not folder, it gives error message. Parameters ---------- loc_ : ...
nilq/baby-python
python
import unittest from eqs import Vector from eqs.matrix import Matrix class MatrixTest(unittest.TestCase): def test_is_square(self): self.assertTrue( Matrix(2, 2).is_square ) def test_is_not_square(self): self.assertFalse( Matrix(2, 3).is_square ) ...
nilq/baby-python
python
""" reference http://oppython.hatenablog.com/entry/2015/09/28/222920 """ import numpy as np from matplotlib import pyplot as plt from scipy import optimize def approximate_polynomial(coefficients,x,y=0): """calc polynomial f(x)=sum(a[i]*x**i) using Horner method""" fx=0 for i in range(len(coefficients))...
nilq/baby-python
python
# Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved. # SPDX-License-Identifier: MIT-0 import boto3 import os # Define the environment variables for repository branch name and region REGION = os.getenv('AWS_REGION') MAIN_BRANCH_NAME = os.getenv('MAIN_BRANCH_NAME') REPOSITORY_NAME = os.getenv('REPO...
nilq/baby-python
python
import re p = re.compile("^(\D+)\s(\d+),(\d+)\s\D+\s(\d+),(\d+)$") lights = [[0 for x in range(1000)] for x in range(1000)] with open('input.txt') as f: for inst in f.readlines(): m = p.match(inst) action = m.group(1) x1 = int(m.group(2)) y1 = int(m.group(3)) x2 = int(m.g...
nilq/baby-python
python
o = object() r = o.__reduce__() print type(r), len(r) class C(object): def __repr__(self): return "<C>" c = C() r = c.__reduce__() print type(r), len(r) assert len(r) == 2 c2 = r[0](*r[1]) print c, c2
nilq/baby-python
python
# -*- coding: utf-8 -*- # Generated by Django 1.11.3 on 2017-09-28 16:38 from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('fdi', '0007_auto_20170925_1600'), ] operations = [ migrations.AddField( ...
nilq/baby-python
python
"""add server description Revision ID: 5bb20df3f035 Revises: ffdd07363665 Create Date: 2020-08-21 21:40:14.688639 """ from alembic import op import sqlalchemy as sa # revision identifiers, used by Alembic. revision = '5bb20df3f035' down_revision = 'ffdd07363665' branch_labels = None depends_on = None def upgrade(...
nilq/baby-python
python
""" pyart.util.xsect ================ Function for extracting cross sections from radar volumes. .. autosummary:: :toctree: generated/ cross_section_ppi _copy_dic """ from copy import copy import numpy as np from ..core import Radar def cross_section_ppi(radar, target_azimuths): """ Extract...
nilq/baby-python
python
# coding:utf-8 import urllib.request from selenium import webdriver import re import json import os import timeit def get_num(filename): # 获取每一话的url尾缀的集合 with open(filename, 'rb') as f: res = f.read().decode() ans = res.split('\n') return ans def get_all_img_url(base_url, download_filen...
nilq/baby-python
python
from django.conf.urls import url, include from rest_framework.routers import DefaultRouter from .views import UserView router = DefaultRouter() router.register('', UserView) urlpatterns = [ url('', include(router.urls)) ]
nilq/baby-python
python
from django.db.models import Q from django.contrib.auth.mixins import LoginRequiredMixin from django.shortcuts import get_object_or_404 from django.views.generic import TemplateView from cajas.users.models.employee import Employee from cajas.users.models.group import Group from cajas.office.models.officeCountry impor...
nilq/baby-python
python
""" Hook for https://github.com/libtcod/python-tcod You should skip this hook if you're using a custom font. """ from PyInstaller.utils.hooks import collect_data_files # Package tdl's 'default' font file. datas = collect_data_files('tdl')
nilq/baby-python
python
__all__ = ['commands']
nilq/baby-python
python
import numpy as np from helper.dataHelper import getAll def getBestFit(score, exam_type, expense): ## Get all schools' information allSchools = getAll() usefulInfo = [] # Construct the array to store useful information for school in allSchools: schoolInfo = [] schoolInfo.append(sch...
nilq/baby-python
python
from __future__ import division from itertools import chain from sklearn.feature_extraction.text import CountVectorizer import numpy as np import pandas as pd from fisher import pvalue import re import collections from nltk.stem.porter import PorterStemmer import math from percept.tasks.base import Task from percept.fi...
nilq/baby-python
python
import getopt from sys import argv from . import Serve, init_app from .configs.Config import UserConfig production = False opts,args = getopt.getopt(argv[1:],'-p',['production']) for opt_name,opt_value in opts: if opt_name in ('-p', '--production'): production = True if production: Serve(UserConfig....
nilq/baby-python
python
from twitter.pants.targets.jvm_target import JvmTarget class OinkQuery(JvmTarget): def __init__(self, name, dependencies, sources=None, excludes=None): JvmTarget.__init__(self, name, sources, dependencies, excludes) # TODO: configurations is required when fetching jar_dependencies but should not be self...
nilq/baby-python
python
import sys class Solution(object): def threeSumClosest(self, nums, target): """ :type nums: List[int] :type target: int :rtype: int """ numsSorted = sorted(nums) minDiff, minS = sys.maxint, None i = 0 while i < len(numsSorted) - 2: ...
nilq/baby-python
python
from telethon import events from ..db import db from ..globals import limited_client @events.register(events.NewMessage(pattern=r"^/start", func=lambda m: m.is_private)) async def start_user_handler(event): print("start") user_id = event.chat_id con = db.get() if con["max_sub_count"] <= len(con["subs"...
nilq/baby-python
python
# Source: https://github.com/micropython/micropython-lib from umqttsimple import MQTTClient as NotSoRobust import utime class MQTTClient(NotSoRobust): DELAY = 2 DEBUG = True def reconnect(self): i = 0 while 1: try: if self.sock: self.poller_r...
nilq/baby-python
python
# Licensed under a 3-clause BSD style license - see LICENSE.rst import os import json DEFAULTS = { 'lincor max': 3500, 'y range': [625, 1225], 'x range': [1040, 1901], 'step': 5, 'bottom': 624, 'top': 1223, 'readnoise': 12, 'gain': 1.5, 'spextool_path': os.path.join(os.path.expandu...
nilq/baby-python
python
import pyhop import map ###OPERATORS### """ Moves the robot 'a' from it current position to position 'x'. If the robot is carrying a box, the position of that box changes together with the position of the robot """ def moveto(state, a, x): if map.room_of(state.loc[a])==map.room_of(x): state.loc[a] = x ...
nilq/baby-python
python
# -*- coding: utf-8 -*- import tensorflow as tf import matplotlib.pyplot as plt import matplotlib as mpl import simulators import derivatives import utils import books import hedge_models import preprocessing import approximators from constants import FLOAT_DTYPE class BrownianMotion(simulators.GBM): def __init_...
nilq/baby-python
python
coset_init = lib.coset_init_lf insert = lib.cs_insert_lf remove = lib.cs_remove_lf get_s = lib.cs_get_size_lf clear = lib.cs_clear_lf get_min = lib.cs_min_lf get_max = lib.cs_min_lf upper_bound = lib.cs_upper_bound_lf rupper_bound = lib.cs_rupper_bound_lf get_k = lib.cs_get_k_lf
nilq/baby-python
python
# Copyright (c) 2015 Mirantis, 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 requir...
nilq/baby-python
python
from airflow import DAG from airflow.operators.python_operator import PythonOperator from datetime import datetime default_args = { 'owner': 'demo', 'depends_on_past': False, 'start_date': datetime(2020, 9, 9), 'email': ['demo.cheng@hotmail.com'], 'queue': 'cheetah_q1' } dag = DAG("daily_maintain...
nilq/baby-python
python
from .__init__ import * def multiplicationFunc(maxRes=99, maxMulti=99): a = random.randint(0, maxMulti) b = random.randint(0, min(int(maxMulti / a), maxRes)) c = a * b problem = str(a) + "*" + str(b) + "=" solution = str(c) return problem, solution
nilq/baby-python
python
s = list(input()) c=0 for i in range(0,len(s),3): if s[i]!='P': c+=1 if s[i+1]!='E': c+=1 if s[i+2]!='R': c+=1 print(c)
nilq/baby-python
python
#!/usr/bin/env python3 # encoding:utf-8 ''' File Observer daemon ''' import time import argparse import requests from watchdog.observers.polling import PollingObserver as Observer from watchdog.events import FileSystemEventHandler from lib.logger import Logger __author__ = 'Marco Espinosa' __version__ = '1.0' __email...
nilq/baby-python
python
# # Copyright 2018 Analytics Zoo Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to...
nilq/baby-python
python
#!/usr/bin/python3 # # Use the data in a spreadsheet to compute some statistics about the number of students in eahc program, track, and addmission group # # Input # ./add_stats_to_spreadsheet.py spreadsheet_filae.xls sheet_name # # Éxamples: # # last modified: 2020-07-25 # import pprint import time import json impor...
nilq/baby-python
python
import mido import fluidsynth import os from midi2audio import FluidSynth import music21 from music21 import * from mido import MidiFile, MidiTrack from F2 import melody from Bass import bass def compile(melodySong, bassSong): melody(melodySong) bass(bassSong) harm = mido.MidiFile('four-chor...
nilq/baby-python
python
#!/usr/bin/env python import rospy from geometry_msgs.msg import TwistStamped from nav_msgs.msg import Odometry import tf_conversions class drive_straight_controller: def __init__(self): self.setup_parameters() self.setup_publishers() self.setup_subscribers() def setup_parameters(self): self.gain_distance...
nilq/baby-python
python
# epydoc recognizes @param f2 as a parameter despite the space after the # argument, but does not recognize note as a field (because of the space). def sample(f1, f2, f3, f4): """ @see: field 1 @note : is it a field? has space before colon @param f1: field 3 with an arg @type f1: integer @param f2 : is it a...
nilq/baby-python
python
import jwt; from colorconsole import terminal screen = terminal.get_terminal(conEmu=False) string = """ ___ _________ _____ _ | \ \ / /__ __/ ____| | | | |\ \ /\ / / | | | | _ __ __ _ ___| | _____ _ __ _ | | \ \/ \/ / | | | | | '__/ _` |/ ...
nilq/baby-python
python
import os import PIL from PIL import Image import numpy as np import argparse # import sys # sys.path.append('/usr/local/bin/cuda-9.0/lib64') import tensorflow as tf import keras from keras import backend as K from keras.layers import Input, Lambda, Conv2D from keras.models import load_model, Model from keras.callbacks...
nilq/baby-python
python
from django.urls import path from rest_framework.authtoken.views import obtain_auth_token from server.users.views import LogoutView, RegisterView urlpatterns = [ path("users/register/", RegisterView.as_view(), name="register"), path("users/login/", obtain_auth_token, name="login"), path("users/logout/", L...
nilq/baby-python
python
import random import time import sys # Developed By: Leo Power # https://powerthecoder.xyz main_list= [] list_am = input("Enter amount of players: ") for i in range(int(list_am)): name = input("Enter Player Name: ") main_list.append(name) x = 0 while x != 1: print() amount_per_team = input("Player Pe...
nilq/baby-python
python
import attrdict class InventoryItem(attrdict.AttrMap): def __init__(self, *args, **kwargs): """Idea from http://stackoverflow.com/questions/4984647/accessing-dict-keys-like-an-attribute-in-python. Initialise with: >>> item = InventoryItem(item_json_dictionary)""" super(InventoryIte...
nilq/baby-python
python
"""Subclass of QPP Measure to calculate measure 407 (MSSA).""" import collections from claims_to_quality.analyzer.calculation.qpp_measure import QPPMeasure from claims_to_quality.analyzer.processing import claim_filtering from claims_to_quality.config import config from claims_to_quality.lib.connectors import idr_quer...
nilq/baby-python
python
# -*- coding: utf-8 -*- # # analyze learning experiments # # 18 Sep 2015 by Ulrich Stern # # notes: # * naming: # calculated reward: entering of actual or virtual (fly 2) training circle # control reward: entering of control circle ("top vs. bottom") # # TODO # * always for new analysis: make sure bad trajectory data...
nilq/baby-python
python
#  Copyright 2019 LINE Corporation # #  Licensed under the Apache License, Version 2.0 (the "License"); you may #  not use this file except in compliance with the License. You may obtain #  a copy of the License at # #       https://www.apache.org/licenses/LICENSE-2.0 # #  Unless required by applicable law or agreed to...
nilq/baby-python
python
import numpy as np from matplotlib import pyplot as plt from matplotlib import cm from UncertainSCI.distributions import UniformDistribution """ This script demonstrates basic instantiation and manipulation of a bivariate uniform probability distribution on a rectangle. """ dim = 2 bounds = np.zeros([2,dim]) bounds...
nilq/baby-python
python
#!/usr/bin/python3 from usb.core import find as finddev devices = finddev(find_all=1, idVendor=0x1366) for dev in devices: try: dev.reset() except: pass
nilq/baby-python
python
"""It is necessary to traverse the bam file sort some data by read name""" import argparse, sys, os, gzip, pickle, zlib, base64 from shutil import rmtree, copy from multiprocessing import cpu_count, Pool, Lock from tempfile import mkdtemp, gettempdir from subprocess import Popen, PIPE from seqtools.format.sam.bam.fil...
nilq/baby-python
python
from __future__ import annotations from datetime import datetime from jsonclasses import jsonclass, types from jsonclasses_pymongo import pymongo @pymongo @jsonclass(class_graph='linked') class LinkedBomb: id: str = types.readonly.str.primary.mongoid.required name: str soldiers: list[LinkedSoldier] = type...
nilq/baby-python
python
""" rvmath.base ~~~~~~~~~~~ :copyright: 2021 by rvmath Authors, see AUTHORS for more details. :license: BSD, see LICENSE for more details. """ from __future__ import annotations import collections import itertools as it import numbers import operator import secrets import typing as ty from dataclasse...
nilq/baby-python
python
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Wed Jan 24 13:26:57 2018 @author: Fall """ import matplotlib.pyplot as plt import numpy as np x = np.linspace(-5,5,1000) y = np.sin(x) plt.plot(x, y, label="objective") plt.plot(x, 0*x+0.5, color="r", linestyle="--", label="constraint") plt.fill_between(x...
nilq/baby-python
python
import os import time import argparse import logging from dirtositemap import DirToSitemap from config import * from sitemaptree import SitemapTree def cmp_file(f1, f2): st1 = os.stat(f1) st2 = os.stat(f2) # compare file size if st1.st_size != st2.st_size: return False b...
nilq/baby-python
python
### # Copyright (c) 2005, Jeremiah Fincher # All rights reserved. # # 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, # this list of conditi...
nilq/baby-python
python
#!/usr/bin/python2 import rospy import cv_bridge from cv_bridge import CvBridge import cv2 import rospy import numpy as np from sensor_msgs.msg import CompressedImage from crazyflie.msg import CFData # from crazyflie.msg import CFImage from crazyflie.msg import CFCommand from crazyflie.msg import CFMotion import time...
nilq/baby-python
python
#!/usr/bin/python """ (C) Copyright 2019 Intel Corporation. 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 la...
nilq/baby-python
python
# Copyright lowRISC contributors. # Licensed under the Apache License, Version 2.0, see LICENSE for details. # SPDX-License-Identifier: Apache-2.0 '''Generate DV code for an IP block''' import logging as log import os import sys from collections import defaultdict from typing import Dict, List, Union, Optional import...
nilq/baby-python
python
import cocotb from lib.util import assertions from lib.cycle import wait, clock @cocotb.test() def memory_address_register(dut): def assert_o_address(value, error_msg): """Check the output address""" assertions.assertEqual(dut.o_address.value.binstr, value, error_msg) # Test initialization ...
nilq/baby-python
python
from tqdm import tqdm import numpy as np import matplotlib.pyplot as plt import torch import torch.optim as optim from modules.networks import LinearGaussianTree, TriResNet, ASVIupdate from modules.models import ColliderModel, MeanField, GlobalFlow, MultivariateNormal from modules.distributions import NormalDistribu...
nilq/baby-python
python
from django.contrib import admin from .models import ScrumyUser, ScrumyGoals, GoalStatus # Register your models here. myModels = [ScrumyUser, ScrumyGoals, GoalStatus] admin.site.register(myModels)
nilq/baby-python
python
import re from itertools import izip_longest def percent(num, den): return '%2.0f%%' % ((float(num)/den) * 100) def parse(fname, level=2): f = file(fname) c = f.read() f.close() num_lines = len(c.split('\n')) headings = [] print 'num lines', num_lines regexp = '#{1,%s}\s' % level f...
nilq/baby-python
python
import glob import os from time import sleep, ctime PATH = r"C:\Users\timmo\Downloads\*" list_of_files = glob.glob(PATH) latest_file = max(list_of_files, key=os.path.getctime) latest_mod = os.path.getctime(latest_file) latest_mod = ctime(latest_mod) #latest_mod = datetime.fromtimestamp(latest_mod).strftime('%Y-%m-%d ...
nilq/baby-python
python
""" The MIT License (MIT) Copyright (c) 2015-2019 Rapptz Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, pu...
nilq/baby-python
python
import FWCore.ParameterSet.Config as cms from ..modules.hltEgammaCandidatesL1Seeded_cfi import * from ..modules.hltEgammaHGCALIDVarsL1Seeded_cfi import * from ..modules.hltEgammaHoverEL1Seeded_cfi import * HLTPhoton187L1SeededTask = cms.Task( hltEgammaCandidatesL1Seeded, hltEgammaHGCALIDVarsL1Seeded, hltE...
nilq/baby-python
python
#!/usr/bin/env python3 # pylint: disable=C0103 """Gets coordination environment and corresponding CSM.""" from pymatgen import Structure from pymatgen.symmetry.analyzer import SpacegroupAnalyzer from pymatgen.analysis.chemenv.coordination_environments\ .coordination_geometry_finder import LocalGeometryFinder fro...
nilq/baby-python
python
from .conv import * from .cell import * from .mix_ops import * from .prune import * from .ops import *
nilq/baby-python
python
import binascii import binance.crypto import binance.message from .signature import * from .transaction import * class TransactionEncoder(object): def __init__(self, wallet, memo="", source=0, data=None): self.wallet = wallet self.memo = memo self.source = source self.data = data ...
nilq/baby-python
python
from pythonforandroid.recipe import CompiledComponentsPythonRecipe from os.path import dirname, join class CryptographyRecipe(CompiledComponentsPythonRecipe): name = 'cryptography' version = '1.4' url = 'https://github.com/pyca/cryptography/archive/{version}.tar.gz' depends = [('python2', 'python3cryst...
nilq/baby-python
python
"""empty message Revision ID: 096057bb3435 Revises: 2daaf569f64d Create Date: 2021-09-19 01:29:38.703707 """ from alembic import op import sqlalchemy as sa # revision identifiers, used by Alembic. revision = '096057bb3435' down_revision = '2daaf569f64d' branch_labels = None depends_on = None def upgrade(): # ...
nilq/baby-python
python
# -*- coding: utf-8 -*- """ Created on Sat Dec 27 12:05:05 2014 @author: dreymond """ import json import pickle import os import codecs #import bs4 from Patent2Net.P2N_Lib import LoadBiblioFile, Decoupe, UnNest3, UrlInventorBuild, UrlApplicantBuild, UrlIPCRBuild from Patent2Net.P2N_Config import LoadConfig import ...
nilq/baby-python
python
from mamba import description, before, context, it, after from expects import equal, expect, be_none from os import ( environ, getpid, ) import pika from infcommon import logger from infcommon.serializer import factory as serializer_factory from infrabbitmq.rabbitmq import ( RabbitMQClient, DIRECT_EX...
nilq/baby-python
python
import logging import os import turnip_exchange_tool.gateways.turnip_exchange as source from turnip_exchange_tool.gateways.db import Sqlite3Db from turnip_exchange_tool.models.island import Island _format = "%(asctime)s - %(name)s - %(levelname)s - %(message)s" logging.basicConfig(format=_format, level=logging.DEBUG)...
nilq/baby-python
python
from flask import render_template, request, redirect, url_for, session, escape, send_from_directory, current_app from flask.ext.login import current_user from mathsonmars.models import db from mathsonmars.extensions import cache from mathsonmars.marslogger import logger from mathsonmars.main import main_view from maths...
nilq/baby-python
python
import json from dataclasses import asdict from typing import Dict, List, Tuple, Type from fractal.core.repositories import Entity from fractal.core.repositories.inmemory_repository_mixin import InMemoryRepositoryMixin from fractal.core.utils.json_encoder import EnhancedEncoder class ExternalDataInMemoryRepositoryMi...
nilq/baby-python
python
from request_manager import app, db from flask import render_template, redirect, url_for from request.form import RequestForm from product.models import Product from client.models import Client from request.models import RequestModel @app.route('/') @app.route('/index') def index(): return redirect(url_for('reques...
nilq/baby-python
python