content
stringlengths
0
1.05M
origin
stringclasses
2 values
type
stringclasses
2 values
import sys if len(sys.argv) != 3: sys.exit("Wrong argument. getSeq.py <.fasta> <seqID>") targetid = str(sys.argv[2]) # Flag seq2print = False with open(sys.argv[1], "r") as f: for line in f: if not seq2print: if line.startswith(">"): #print(line.lstrip(">")) if line.rstrip().lstrip(">") == targetid: ...
nilq/baby-python
python
# uncompyle6 version 2.9.10 # Python bytecode 2.7 (62211) # Decompiled from: Python 3.6.0b2 (default, Oct 11 2016, 05:27:10) # [GCC 6.2.0 20161005] # Embedded file name: type_Params.py from types import * import mcl.object.MclTime PARAMS_QUERY_TYPE_ALL = 0 PARAMS_QUERY_TYPE_IP_ONLY = 1 PARAMS_QUERY_TYPE_TCP_ONLY = 2 P...
nilq/baby-python
python
from typing import Any, Dict from . import State from app import app from models import User class AssetState(State[User]): def __init__(self) -> None: super().__init__() self.pending_file_upload_cache: Dict[str, Any] = {} def get_user(self, sid: str) -> User: return self._sid_map[si...
nilq/baby-python
python
from .dijkstras_algorithm import DijkstraNode, DijkstraEdge, DijkstraGraph from .a_star import AStarNode, AStarEdge, AStarGraph from .custom_dijkstras_algorithm import CDijkstraNode, CDijkstraEdge, CDijkstraGraph
nilq/baby-python
python
from .test_case import TestCase from infi.unittest.parameters import iterate class IsolatedPythonVersion(TestCase): def test(self): with self.temporary_directory_context(): self.projector("repository init a.b.c none short long") self.projector("isolated-python python-version get") ...
nilq/baby-python
python
import smtplib from email.mime.image import MIMEImage from email.mime.multipart import MIMEMultipart from email.mime.text import MIMEText from email.mime.base import MIMEBase from email import encoders import xml from xml.dom.minidom import parse, parseString def send_email(to, server, subj, body, attachments...
nilq/baby-python
python
#!/usr/bin/python import time,serial,math,sys,numpy as np,matplotlib.pyplot as plt print '*** Graf periode pulzarja - 11.05.2017 ***' povpstolp=20 #stevilo povprecenj stolpcev (integer) perioda=7145.117 #perioda pulzarja v stevilu vzorcev (float) odmik=1000 #odmik zacetka (integer) 0<odmik=<perioda zacetek=8000 #za...
nilq/baby-python
python
from django.contrib import admin from .models import * from django import forms from ckeditor_uploader.widgets import CKEditorUploadingWidget class ServiceAdmin(admin.ModelAdmin): list_display = ['title','status'] class CategoryAdmin(admin.ModelAdmin): list_display = ['title','parent','slug'] class BrandAdmi...
nilq/baby-python
python
""" FIFO Queue = [] Queue = [1,2,3,4] push [2,3,4] pop [3,4] pop [4] pop [] pop empty stack """ class Queue(object): def __init__(self): self.queue = [] self.length = 0 def enque(self, data): self.queue.append(data) self.length += 1 def deque(self): if self.lengt...
nilq/baby-python
python
def test_canary(): assert True
nilq/baby-python
python
import numpy as np import random import sys from scipy.stats import f from scipy.stats import norm param= int(sys.argv[1]) np.random.seed(param) n=500 # mediciones efectuadas p=100 # variables medidas mu=0.0 sigma=1.0 X=np.random.normal(mu,sigma,size=(n,p)) Y=np.random.normal(mu,sigma,size=(n,1)) XT=X.T YT=Y.T Inv=np...
nilq/baby-python
python
# Permission mixins to override default django-guardian behaviour from guardian.mixins import PermissionRequiredMixin class SetChildPermissionObjectMixin: """ Sets child object as the focus of the permission check in the view. """ def get_permission_object(self): return self.child class Perm...
nilq/baby-python
python
# Copyright 2020 Huawei Technologies Co., Ltd # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to...
nilq/baby-python
python
import pandas as pd import numpy as np from ttk.corpus.CategorizedDatedCorpusReader import CategorizedDatedCorpusReader class CategorizedDatedCorpusReporter(object): """ Reporting utility for CategorizedDatedCorpusReporter corpora. """ def __init__(self): self._output_formats = ['list', 'str', 'datafr...
nilq/baby-python
python
import os import math import sys import datetime import re import numpy as np import traceback import pprint import json from rafiki.model import BaseModel, InvalidModelParamsException, test_model_class from rafiki.constants import TaskType # Min numeric value MIN_VALUE = -9999999999 class BigramHmm(BaseModel): ...
nilq/baby-python
python
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Wed Jan 26 09:03:17 2022 @author: apauron """ import os import get_files_cluster import pandas as pd from numpy import genfromtxt ### Get the parent folder of the working directory. Change it if you modify the name of the folders path_parent = os.path.dirn...
nilq/baby-python
python
# Exercice 3.3 : Nombres premiers ## Question 1 def divise(n : int, p : int) -> bool: """Précondition : n > 0 et p >= 0 Renvoie True si et seulement si n divise p. """ return p % n == 0 # Jeu de tests assert divise(1, 4) == True assert divise(2, 4) == True assert divise(3, 4) == False assert di...
nilq/baby-python
python
import os import re import subprocess import time import urllib import glanceclient import keystoneauth1 import keystoneauth1.identity.v2 as keystoneauth1_v2 import keystoneauth1.session as keystoneauth1_session import keystoneclient.v2_0.client as keystoneclient_v2 import keystoneclient.v3.client as keystoneclient_v3...
nilq/baby-python
python
# -*- coding: utf-8 -*- from flask import Flask, abort from flask_bootstrap import Bootstrap from flask_sqlalchemy import SQLAlchemy from config import basedir, UPLOAD_FOLDER #from flask.ext.mail import Mail theapp = Flask(__name__) theapp.config.from_object('config') #mail = Mail(theapp) bootstrap = Bootstrap(theapp...
nilq/baby-python
python
import Sofa import SofaPython.Tools import SofaTest def createScene(node): node.createObject('PythonScriptController', filename=__file__, classname='VerifController') class VerifController(SofaTest.Controller): def initGraph(self, node): Sofa.msg_info("initGraph ENTER") child = node.crea...
nilq/baby-python
python
""" This application demonstrates how to create a Tag Template in Data Catalog, loading its information from Google Sheets. """ import argparse import logging import re import stringcase import unicodedata from google.api_core import exceptions from google.cloud import datacatalog from googleapiclient import discovery...
nilq/baby-python
python
import cloudpassage import sys import os import pytest import datetime import time import platform sys.path.append(os.path.join(os.path.dirname(__file__), '../../', '')) import lib.validate as validate class TestUnitValidate: def test_validate_valid_time(self): accepted = True try: val...
nilq/baby-python
python
#!/usr/bin/env python # -*- coding: utf-8 -*- """Evolve life in a landscape. Life evolves alongside landscapes by biotic and abiotic processes under complex dynamics at Earth's surface. Researchers who wish to explore these dynamics can use this component as a tool for them to build landscape-life evolution models. La...
nilq/baby-python
python
import math import timeit import random import sympy import warnings from random import randint, seed import sys from ecpy.curves import Curve,Point from Crypto.Hash import SHA3_256, SHA256, HMAC import requests from Crypto.Cipher import AES from Crypto import Random from Crypto.Util.Padding import pad from Crypto.Util...
nilq/baby-python
python
from singly_linked_lists.remove_nth_node_from_list import remove_nth_from_end from data_structures.singly_linked_list_node import SinglyLinkedListNode def test_remove_nth_from_end(): head = SinglyLinkedListNode(1) assert remove_nth_from_end(head, 1) is None head = SinglyLinkedListNode(1) head.next = ...
nilq/baby-python
python
# Copyright (c) 2009 Alexandre Quessy, Arjan Scherpenisse # See LICENSE for details. """ Tests for txosc/osc.py Maintainer: Arjan Scherpenisse """ from twisted.trial import unittest from twisted.internet import reactor, defer, task from txosc import osc from txosc import async from txosc import dispatch class TestG...
nilq/baby-python
python
#!/usr/bin/env python # -*- coding: utf-8 -*- # Copyright 2017 jem@seethis.link # Licensed under the MIT license (http://opensource.org/licenses/MIT) from __future__ import absolute_import, division, print_function, unicode_literals import yaml import struct import hexdump import math import re import time import os ...
nilq/baby-python
python
# This file adds code completion to the auto-generated pressuresense_pb2 file. from .pressuresense_pb2 import PressureQuanta, PressureLog from .common_proto import _TimeStamp from typing import List, Callable, Union class _PressureProfile( object ): mpa = 0 class _PressureQuanta( object ): profiles = _Press...
nilq/baby-python
python
import sys import logging import argparse from pprint import pprint from . import * def dumpSubject(cert): info = getSubjectFromCertFile(cert) pprint(info, indent=2) def main(): services = ",".join(LOGIN_SERVICE.keys()) parser = argparse.ArgumentParser(description=__doc__, formatter_class=argparse.RawDe...
nilq/baby-python
python
''' knowyourmeme.com image crawler: ------------------------------------------- Script designed to specifically crawl meme templates to be used in ml(and self enjoyment). url: https://knowyourmeme.com/photos/templates/page/<page_number> So, as you can see, we are lucky enough that knowyoumeme has pagination here IMP...
nilq/baby-python
python
# Generated by Django 2.2.1 on 2019-06-03 04:58 from django.db import migrations, models import django.utils.timezone class Migration(migrations.Migration): initial = True dependencies = [ ('Profesor', '0001_initial'), ] operations = [ migrations.CreateModel( name='Estu...
nilq/baby-python
python
import sys sys.path.append(".") import numpy as np from DDPG import * from main import * import os.path import argparse from Environment import Environment from shield import Shield def carplatoon(learning_method, number_of_rollouts, simulation_steps, learning_eposides, actor_structure, critic_structure, train_dir,...
nilq/baby-python
python
#!/usr/bin/python3 # # Scratchpad for working with raw U2F messages, useful for creating raw messages as test data. # Example keys from secion 8.2 of # https://fidoalliance.org/specs/fido-u2f-v1.0-nfc-bt-amendment-20150514/fido-u2f-raw-message-formats.html#authentication-response-message-success from binascii import h...
nilq/baby-python
python
# encoding: utf-8 from workflow import web, Workflow, PasswordNotFound def get_saved_searches(api_key, url): """ Parse all pages of projects :return: list """ return get_saved_searches_page(api_key, url, 1, []) def get_dashboards(api_key, url): """ Parse all pages of projects :return:...
nilq/baby-python
python
############################################################################## # Written by: Cachen Chen <cachen@novell.com> # Date: 08/05/2008 # Description: hscrollbar.py wrapper script # Used by the hscrollbar-*.py tests ##########################################################################...
nilq/baby-python
python
from dotenv import load_dotenv import os load_dotenv(verbose=True) DISCORD_BOT_TOKEN = os.getenv('DISCORD_BOT_TOKEN')
nilq/baby-python
python
# Time: O(log n) # Space: O(n) Call stack size class Solution: def searchRange(self, nums, target): first = self.binarySearch(nums, 0, len(nums) - 1, target, True) last = self.binarySearch(nums, 0, len(nums) - 1, target, False) return [first, last] def binarySearch(self, nu...
nilq/baby-python
python
# -*- coding: utf-8 -*- # import model interface from . import models # import constraints from . import constraints # import tasks from . import tasks # import solvers from . import solvers
nilq/baby-python
python
import csv from django.db import models import reversion from django.core.exceptions import ObjectDoesNotExist @reversion.register() class FileTemplate(models.Model): FILE_FOR_CHOICES = ( ('input', 'Input'), ('equip', 'Equipment'), ('output', 'Output'), ) name = models.CharField(...
nilq/baby-python
python
import daisy import unittest class TestMetaCollection(unittest.TestCase): def get_mongo_graph_provider(self, mode, directed, total_roi): return daisy.persistence.MongoDbGraphProvider( 'test_daisy_graph', directed=directed, total_roi=total_roi, mode=mode) ...
nilq/baby-python
python
# -*- coding: utf-8 -*- """ Created on Sun Jul 29 08:40:49 2018 @author: user """ import numpy as np np.random.seed(1) from matplotlib import pyplot as plt import skimage.data from skimage.color import rgb2gray from skimage.filters import threshold_mean from skimage.transform import resize import network # Utils def...
nilq/baby-python
python
def main() -> None: N, K = map(int, input().split()) assert 1 <= K <= N <= 100 for _ in range(N): P_i = tuple(map(int, input().split())) assert len(P_i) == 3 assert all(0 <= P_ij <= 300 for P_ij in P_i) if __name__ == '__main__': main()
nilq/baby-python
python
# -*- coding: UTF-8 -*- import sys,io,os from mitie import * from collections import defaultdict reload(sys) sys.setdefaultencoding('utf-8') #此代码参考:https://nlu.rasa.com/python.html #这个代码是为了测试,直接通过python api去获取rasa nlu的意图和实体识别接口 sys.path.append('../MITIE/mitielib') from rasa_nlu.model import Metadata, Interpreter ...
nilq/baby-python
python
from tir import Webapp import unittest class GTPA107(unittest.TestCase): @classmethod def setUpClass(inst): inst.oHelper = Webapp() inst.oHelper.Setup("SIGAGTP", "20/04/2020", "T1", "D MG 01 ") inst.oHelper.Program('GTPA107') def test_GTPA107_CT001(self): self.oHelper.SearchBrowse("D MG 000033", "Filia...
nilq/baby-python
python
#!/usr/bin/env python import unittest import os import time from bones.utils import * class TestUtils(unittest.TestCase): def test_temp_filename_collision(self): fn1 = temp_filename() fn2 = temp_filename() self.assertNotEqual(fn1, fn2) def test_temp_filename_kwargs(self): fn =...
nilq/baby-python
python
from django.http import HttpRequest from django.test import Client from django.test import TestCase from django.urls import reverse from project_core.tests import database_population class CallListTest(TestCase): def setUp(self): self._user = database_population.create_management_user() self._fun...
nilq/baby-python
python
from .base import Base class Ls(Base): """Show List""" def run(self): if self.options['<ctgr>'] == "done": self.show(None, 1) elif self.options['<ctgr>'] == "all": self.show(None, None) else: self.show(self.options['<ctgr>'],1 if self.options['<done...
nilq/baby-python
python
import io import os import sys from setuptools import setup if sys.version_info < (3, 6): sys.exit('Sorry, Python < 3.6.0 is not supported') DESCRIPTION = 'Images Generator for bouncing objects movie' here = os.path.abspath(os.path.dirname(__file__)) try: with io.open(os.path.join(here, 'README.md'), encodin...
nilq/baby-python
python
import os from tqdm import tqdm from PIL import Image, UnidentifiedImageError if __name__ == '__main__': jpg_path = '../shufa_pic/shufa' broken_jpg_path = '../shufa_pic/broken_img' for jpg_file in tqdm(os.listdir(jpg_path)): src = os.path.join(jpg_path, jpg_file) try: image = Im...
nilq/baby-python
python
#!/usr/bin/env python # this just calculates the roots, it doesn't generate the heat map # see https://thoughtstreams.io/jtauber/littlewood-fractals/ import itertools import sys import time import numpy DEGREE = 16 INNER_ONLY = False print "generating roots for degree={}".format(DEGREE,) start = time.time() c...
nilq/baby-python
python
from aiohttp.test_utils import TestClient from server.serializer import JSendSchema, JSendStatus from server.serializer.fields import Many from server.serializer.models import RentalSchema class TestRentalsView: async def test_get_rentals(self, client: TestClient, random_admin, random_bike): """Assert t...
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. """Timer.""" import time class Timer(object): """A simple timer (adapted from Detectron).""" def __init__(self): self.tota...
nilq/baby-python
python
#!/usr/bin/env python import optparse import os,sys #from optparse import OptionParser import glob import subprocess import linecache import struct import shutil def setupParserOptions(): parser = optparse.OptionParser() parser.set_usage("%prog -f <stack> -p <parameter> -c <ctf> -s") parser.add_option("-f",dest="s...
nilq/baby-python
python
from itertools import cycle from django.conf import settings from django.contrib.auth.mixins import LoginRequiredMixin from django.core.cache import cache from django.http import Http404 from django.shortcuts import render from django.views.generic import TemplateView from django.views.generic.base import View import...
nilq/baby-python
python
node = S(input, "application/json") object = { "name": "test", "comment": "42!" } node.prop("comment", object) propertyNode = node.prop("comment") value = propertyNode.prop("comment").stringValue()
nilq/baby-python
python
# -*- coding: utf-8 -*- """Example Google style docstrings. This module demonstrates documentation as specified by the `Google Python Style Guide`_. Docstrings may extend over multiple lines. Sections are created with a section header and a colon followed by a block of indented text. Example: Examples can be give...
nilq/baby-python
python
__author__ = "Nathan Ward" import logging from datetime import date, datetime from pytz import timezone, utc _LOGGER = logging.getLogger() _LOGGER.setLevel(logging.INFO) def get_market_open_close() -> dict: """ Grab the market open and close settings. Convert timezone. Lambdas run in UTC. Settings are s...
nilq/baby-python
python
# -*- coding: utf-8 -*- #--------------------------------------- # Import Libraries #--------------------------------------- import sys import io import json from os.path import isfile import clr clr.AddReference("IronPython.SQLite.dll") clr.AddReference("IronPython.Modules.dll") from datetime import datetime #-------...
nilq/baby-python
python
import unittest import sys module = sys.argv[-1].split(".py")[0] class PublicTests(unittest.TestCase): @classmethod def setUpClass(cls): global top_3 undertest = __import__(module) top_3 = getattr(undertest, 'top_3', None) def test_exemplo(self): l = [1,2,3,4,8,22,-3,5] ...
nilq/baby-python
python
import datetime from .wordpress import WordPress class CclawTranslations(WordPress): base_urls = [ "https://cclawtranslations.home.blog/", ] last_updated = datetime.date(2021, 11, 3) def init(self): self.blacklist_patterns += ["CONTENIDO | SIGUIENTE"] def parse_content(self, el...
nilq/baby-python
python
from discord.ext import commands class Echo(commands.Cog): def __init__(self, bot): self.bot = bot @commands.command() async def echo(self, ctx): await ctx.send(ctx.message.content[6:]) def setup(bot): bot.add_cog(Echo(bot))
nilq/baby-python
python
import json import logging from . import BASE from .oauth import Tokens logger = logging.getLogger(__name__) def store(client_id: str, tokens: Tokens) -> None: cache = BASE / f"{client_id}_cache.json" # Store tokens cache.touch(0o600, exist_ok=True) with cache.open("w") as fh: temp = {k: v ...
nilq/baby-python
python
from .model import TreeNode """ BFS Solution Space : O(n) Time : O(n) """ class Solution: def pseudoPalindromicPaths(self, root: TreeNode) -> int: if not root: return 0 stack = [(root, [])] res = [] ans = 0 while stack: node, mem = stack.pop()...
nilq/baby-python
python
import sys, os from MySQLdb import Error as Error from connect_db import read_connection class ReaderBase(object): def __init__(self): self._password_file = "/n/home00/cadams/mysqldb" def connect(self): return read_connection(self._password_file)
nilq/baby-python
python
"""Geometric Brownian motion.""" import numpy as np from stochastic.processes.base import BaseTimeProcess from stochastic.processes.continuous.brownian_motion import BrownianMotion from stochastic.utils import generate_times from stochastic.utils.validation import check_numeric from stochastic.utils.validation import ...
nilq/baby-python
python
#----------------------------------------------------- # Make plots from matplotlib using data exported by # DNSS.jl # Soham M 05/2022 #----------------------------------------------------- import numpy as np import glob import matplotlib as mpl import matplotlib.pyplot as plt from matplotlib.ticker import MaxNLocator...
nilq/baby-python
python
import os import torch from torchinfo import summary from torch.utils.data import DataLoader import source.utils as utils import source.arguments as arguments from source.model import FusionNet, UNet from source.dataset.dataset import NucleiCellDataset def main(m_args): # For reproducibility torch.manual_see...
nilq/baby-python
python
"""Objects representing regions in space.""" import math import random import itertools import numpy import scipy.spatial import shapely.geometry import shapely.ops from scenic.core.distributions import Samplable, RejectionException, needsSampling from scenic.core.lazy_eval import valueInContext from scenic.core.vec...
nilq/baby-python
python
#!/usr/bin/env python # -*- coding: utf-8 -*- """ Tests for C++ module twiss. """ import os import IBSLib as ibslib import numpy as np import pandas as pd import pytest constants = [ (ibslib.clight, 299792458.0), (ibslib.hbarGeV, 6.582119569e-25), (ibslib.electron_mass, 0.51099895000e-3), (ibslib.pr...
nilq/baby-python
python
import attr from typing import Any, List, Optional from tokopedia import TokopediaResponse @attr.dataclass(slots=True) class ActiveProductsShop: id: int name: str uri: str location: str @attr.dataclass(slots=True) class ActiveProductShop: id: int name: str url: str is_gold: bool ...
nilq/baby-python
python
"""Tests for the models of the ``media_library`` app.""" from django.test import TestCase from user_media.models import UserMediaImage from user_media.tests.factories import UserMediaImageFactory from . import factories class MediaLibraryTestCase(TestCase): """Tests for the ``MediaLibrary`` model class.""" ...
nilq/baby-python
python
from slack import WebClient class SlackApiWrapper(WebClient): def __init__(self, api_token): super().__init__(api_token) def post_message(self, channel, message): response = self.chat_postMessage( channel=channel, text=message) assert response["ok"] def po...
nilq/baby-python
python
from sys import stdin, stdout num_cases = int(stdin.readline()) stdin.readline() for case in range(num_cases): n = int(stdin.readline().strip()) # num_candidates candidates = [] for i in range(n): candidates.append(stdin.readline().strip()) votes = [] line = stdin.readline().strip() while line...
nilq/baby-python
python
from setuptools import setup from torch.utils.cpp_extension import BuildExtension, CppExtension setup( name='syncbn_cpu', ext_modules=[ CppExtension('syncbn_cpu', [ 'operator.cpp', 'syncbn_cpu.cpp', ]), ], cmdclass={ 'build_ext': BuildExtension })...
nilq/baby-python
python
from typing import get_type_hints, TypeVar, Type __all__ = ["Storage"] T = TypeVar('T') class Storage(dict): """ A Storage object is like a dictionary except `obj.foo` can be used in addition to `obj['foo']`. >>> o = Storage(a=1) >>> o.a 1 >>> o['a'] 1 >...
nilq/baby-python
python
from libarduino import pinMode,digitalWrite,analogRead import time class Actuator(): def __init__(self, port): self.port = port pinMode(self.port, 'OUTPUT') def activate(self): digitalWrite(self.port, 1) def deactivate(self): digitalWrite(self.port, 0) class Ranger(): ...
nilq/baby-python
python
from django import forms class CartAddForm(forms.Form): quantity = forms.IntegerField(min_value=1, max_value=9)
nilq/baby-python
python
#!/usr/bin/python # Copyright 2020 Makani Technologies LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicabl...
nilq/baby-python
python
#-*- coding: utf-8 -*- __all__ = ['LEA','ECB','CBC','CTR','CFB','OFB','CCM','GCM','CMAC'] from .LEA import LEA from .ECB import ECB from .CBC import CBC from .CTR import CTR from .CFB import CFB from .OFB import OFB from .CCM import CCM from .GCM import GCM from .CMAC import CMAC from .CipherMode i...
nilq/baby-python
python
# Copyright 2019 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
nilq/baby-python
python
#This file contains a common EKF tracking code for both elevator and rover #It checks variable from file config.npy to figure out its own type import time from datetime import datetime import subprocess import numpy as np from numpy import linalg from numpy.linalg import inv import math import cmath import linalgfu...
nilq/baby-python
python
from Jumpscale import j class Nodes: def __init__(self, session, url): self._session = session self._base_url = url j.data.schema.add_from_path( "/sandbox/code/github/threefoldtech/jumpscaleX_threebot/ThreeBotPackages/tfgrid/directory/models" ) self._model = j.d...
nilq/baby-python
python
#!/usr/bin/env python # # Copyright (c) 2019 Opticks Team. All Rights Reserved. # # This file is part of Opticks # (see https://bitbucket.org/simoncblyth/opticks). # # 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...
nilq/baby-python
python
class Frame: def __init__(self, size): self.type = None # whether this is an audio/video frame self.data = None # this is the raw frame data self.codec = None # codec self.time_stamp = 0 # TS of the frame self.size = size class AudioFrame(Frame): def __init__(self):...
nilq/baby-python
python
import traceback import math import numpy as np import pandas as pd from .CostModule import CostModule class CollectionCost(CostModule): """ Assumptions: 1. System contains central inverters of 1 MW rating each. The inverter being considered is a containerized solution which includes a co-located LV/M...
nilq/baby-python
python
# Copyright (c) 2013 The SAYCBridge Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. from z3b import enum import core.suit as suit import z3 _honor_names = ('ace', 'king', 'queen', 'jack', 'ten') _honor_values = (4, 3, 2, 1, 0) def...
nilq/baby-python
python
# An XOR linked list is a more memory efficient doubly linked list. # Instead of each node holding next and prev fields, it holds a field named both, # which is an XOR of the next node and the previous node. # Implement an XOR linked list; it has an add(element) which adds the # element to the end, and a get(index) whi...
nilq/baby-python
python
from app import const BASE_ID = const.AIRTABLE_MAP_BY_GEOGRAPHIC_AREA_BASE_ID AREA_CONTACT_TABLE_NAME = "Area Contact" AREA_TARGET_COMMUNITY_TABLE_NAME = "Area Target Community" class AirtableGeographicAreaTypes: AREA_TYPE_CITY = "City" AREA_TYPE_POLYGON = "Polygon" AREA_TYPE_REGION = "Region" AREA_...
nilq/baby-python
python
from csv import DictReader from scrapy import Item from pyproj import Proj, transform from jedeschule.spiders.nordrhein_westfalen_helper import NordRheinWestfalenHelper from jedeschule.spiders.school_spider import SchoolSpider from jedeschule.items import School # for an overview of the data provided by the State o...
nilq/baby-python
python
# Generated by Django 3.2 on 2022-02-12 21:34 from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ ('reservations', '0001_initial'), ] operations = [ migrations.AlterField( model_name='reservation',...
nilq/baby-python
python
import hashlib import os import errno def hashpasswd(passwd): return hashlib.sha512(passwd.encode('utf-8')).hexdigest() def create_path(path): if not os.path.exists(os.path.dirname(path)): try: os.makedirs(os.path.dirname(path)) except OSError as exc: # Guard against race condit...
nilq/baby-python
python
#!/usr/bin/untitled #created by Reyad import smtplib import json # import datetime # import mysql.connector import pymysql # import MySQLdb from email.mime.multipart import MIMEMultipart from email.mime.text import MIMEText from datetime import datetime # import datetime from email.mime.applicat...
nilq/baby-python
python
from is_wire.core import Channel, Message, Subscription from google.protobuf.struct_pb2 import Struct import socket channel = Channel("amqp://guest:guest@10.10.2.7:30000") subscription = Subscription(channel) # Prepare request struct = Struct() struct.fields["value"].number_value = 1.0 request = Message(content=struc...
nilq/baby-python
python
import logging from omega import __version__ from tests.interfaces.test_web_interfaces import TestWebInterfaces logger = logging.getLogger(__name__) class TestSys(TestWebInterfaces): async def test_sever_version(self): ver = await self.server_get("sys", "version", is_pickled=False) self.assertEq...
nilq/baby-python
python
from montague.ast import ( And, Call, ComplexType, Exists, ForAll, IfAndOnlyIf, IfThen, Iota, Lambda, Not, Or, TYPE_ENTITY, TYPE_EVENT, TYPE_TRUTH_VALUE, TYPE_WORLD, Var, ) def test_variable_to_str(): assert str(Var("a")) == "a" def test_and_to_str...
nilq/baby-python
python
from recommendation.api.types.related_articles import candidate_finder from recommendation.utils import configuration import recommendation EXPECTED = [('Q22686', 1.0), ('Q3752663', 0.8853468379287844), ('Q2462124', 0.861691557168689), ('Q432473', 0.8481581254555062), ('Q242351', 0.8379904779822078), ('Q86...
nilq/baby-python
python
""" Objects Defining objects imitating the behavior of Python's built-in objects but linked to the database. """ from yuno.objects.dict import YunoDict from yuno.objects.list import YunoList
nilq/baby-python
python
import ptypes from ptypes import * ## string primitives class LengthPrefixedAnsiString(pstruct.type): _fields_ = [ (pint.uint32_t, 'Length'), (lambda s: dyn.clone(pstr.string, length=s['Length'].li.int()), 'String'), ] def str(self): return self['String'].li.str() class LengthPrefi...
nilq/baby-python
python
############################################################################## # Copyright (c) 2016 ZTE Corporation # feng.xiaowei@zte.com.cn # All rights reserved. This program and the accompanying materials # are made available under the terms of the Apache License, Version 2.0 # which accompanies this distribution, ...
nilq/baby-python
python
import sys def raise_from(my_exception, other_exception): raise my_exception, None, sys.exc_info()[2] # noqa: W602, E999
nilq/baby-python
python