content
stringlengths
0
1.05M
origin
stringclasses
2 values
type
stringclasses
2 values
from django.urls import reverse from rest_framework import status from cornershop.apps.weather.tests import WeatherAPTestCase class WeatherPostTestCase(WeatherAPTestCase): def test_with_existing_record(self): url = reverse('weather-list') response = self.client.get(url, format='json') ...
nilq/baby-python
python
"""Utilities for algebraic number theory. """ from sympy.core.sympify import sympify from sympy.ntheory.factor_ import factorint from sympy.polys.domains.rationalfield import QQ from sympy.polys.domains.integerring import ZZ from sympy.polys.matrices.exceptions import DMRankError from sympy.polys.numberfields.minpoly ...
nilq/baby-python
python
import enum import os from argparse import ArgumentParser import tensorflow as tf import create_mask_image tf.logging.set_verbosity(tf.logging.INFO) logger = tf.logging home = os.path.expanduser("~") class TrainingPaths(enum.Enum): MASK = 0, ORIGINAL_IMAGE = 1, MASKED_IMAGE = 2 PATHS = { TrainingPaths....
nilq/baby-python
python
from __future__ import absolute_import, unicode_literals from .extras.clients import WebApplicationPushClient from .extras.grant_types import AuthorizationCodePushGrant from .extras.endpoints import Server from .extras.errors import MalformedResponsePushCodeError
nilq/baby-python
python
from functools import wraps import logging import math import time from typing import Callable logger = logging.getLogger() def format_seconds(seconds: int): seconds = int(seconds or 0) hours = math.floor(seconds / 3600) seconds -= hours * 3600 minutes = math.floor(seconds / 60) seconds -= minu...
nilq/baby-python
python
#!/usr/bin/env python import RPi.GPIO as GPIO import subprocess import time SENSOR_PIN = 14 TIME_ON = 20 def main(): GPIO.setmode(GPIO.BCM) GPIO.setup(SENSOR_PIN, GPIO.IN) subprocess.run(['xset', 'dpms', 'force', 'off']) def callback(_): subprocess.run(['xset', 'dpms', 'force', 'on']) ...
nilq/baby-python
python
"""Testing v0x04 FlowRemoved message.""" from pyof.v0x04.asynchronous.flow_removed import FlowRemoved from pyof.v0x04.common.flow_match import Match from tests.test_struct import TestStruct class TestFlowRemovedMsg(TestStruct): """FlowRemoved message tests (also those in :class:`.TestDump`).""" @classmethod ...
nilq/baby-python
python
import enum from ..time import Resolution, UTC class Curve: """ The curve identifies any type of time series data and OHLC data. The ``curve.name`` is used in the API when loading data for a curve. """ def __init__(self, name, curve_type=None, instance_issued_timezone=None, are...
nilq/baby-python
python
#! python3 import sys, PyQt5 from PyQt5.QtWidgets import QWidget, QLabel, QLineEdit, QApplication class Example(QWidget): def __init__(self): super().__init__() self.initUI() def initUI(self): self.label = QLabel(self) qle = QLineEdit(self) qle.m...
nilq/baby-python
python
# coding=utf-8 # Distributed under the MIT software license, see the accompanying # file LICENSE or http://www.opensource.org/licenses/mit-license.php. # FIpurE: This is odd... import sys import os from grpc._cython.cygrpc import StatusCode from pur.core.purnode import purNode from pur.generated.purbase_pb2 import G...
nilq/baby-python
python
# -*- coding: utf-8 -*- import sys import time timer = time.clock if sys.platform[:3] == 'win' else time.time def total(reps, func, *args, **kwargs): """Total time to run func() reps times. Returns (total time, last result) """ repslist = list(range(reps)) start = timer() for i in repslist:...
nilq/baby-python
python
"""Platform to present any Tuya DP as a binary sensor.""" import logging from functools import partial import voluptuous as vol from homeassistant.components.binary_sensor import ( DEVICE_CLASSES_SCHEMA, DOMAIN, BinarySensorEntity, ) from homeassistant.const import CONF_DEVICE_CLASS from .common import Lo...
nilq/baby-python
python
#!/usr/bin/env python3 from utils import mathfont import fontforge # Create a WOFF font with glyphs for all the operator strings. font = mathfont.create("stretchy", "Copyright (c) 2021 Igalia S.L.") # Set parameters for stretchy tests. font.math.MinConnectorOverlap = mathfont.em // 2 # Make sure that underover para...
nilq/baby-python
python
# Copyright (C) 2018 The python-bitcoin-utils developers # # This file is part of python-bitcoin-utils # # It is subject to the license terms in the LICENSE file found in the top-level # directory of this distribution. # # No part of python-bitcoin-utils, including this file, may be copied, # modified, propagated, or d...
nilq/baby-python
python
legal_labels = ["west-germany", "usa", "france", "canada", "uk", "japan"] label_name = "places" MAX_NUM_WORDS = 10000 MAX_SEQ_LENGTH = 100 EMBEDDING_DIM = 50
nilq/baby-python
python
from django.conf.urls import url from . import views from django.contrib.auth.views import LoginView, LogoutView, PasswordResetView, PasswordResetDoneView, PasswordResetConfirmView app_name = 'account' urlpatterns = [ url(r'^$', LoginView.as_view(template_name='account/welcome.html'), name='welcome_page'), ur...
nilq/baby-python
python
import numpy as np from astropy.io import fits import matplotlib.pyplot as plt source = 'NGC3351' line = np.array(('CO10','CO21','13CO21','13CO32','C18O21','C18O32')) num = line.shape[0] for i in range(num): fits_map = fits.open('data_image/'+source+'_'+line[i]+'_mom0_broad_nyq.fits')[0].data fits_err = fits....
nilq/baby-python
python
import pytest import grblas as gb import dask_grblas as dgb from grblas import dtypes from pytest import raises from .utils import compare def test_new(): s = gb.Scalar.new(int) ds = dgb.Scalar.new(int) compare(lambda x: x, s, ds) s = gb.Scalar.new(float) ds = dgb.Scalar.new(float) compare(lam...
nilq/baby-python
python
# -*- coding: utf-8 -*- """This file contains the wifi.log (Mac OS X) parser.""" import logging import re import pyparsing from plaso.events import time_events from plaso.lib import errors from plaso.lib import eventdata from plaso.lib import timelib from plaso.parsers import manager from plaso.parsers import text_p...
nilq/baby-python
python
# chebyfit/__init__.py from .chebyfit import __doc__, __all__, __version__ from .chebyfit import *
nilq/baby-python
python
from typing import Generator, Mapping, Union from flask_babel import lazy_gettext from app.questionnaire.location import Location from .context import Context from .section_summary_context import SectionSummaryContext class SubmitQuestionnaireContext(Context): def __call__( self, answers_are_editable: ...
nilq/baby-python
python
def get_answer(): """something""" return True
nilq/baby-python
python
# Copyright (c) 2015, Michael Boyle # See LICENSE file for details: <https://github.com/moble/scri/blob/master/LICENSE> from __future__ import print_function, division, absolute_import import pytest import numpy as np from numpy import * import quaternion import spherical_functions as sf import scri from conftest im...
nilq/baby-python
python
from apiaudio.api_request import APIRequest class Connector(APIRequest): OBJECT_NAME = "connector" resource_path = "/connector/" connection_path = "/connection/" @classmethod def retrieve(cls, name): if not name: raise Exception("Name must be set") return cls._get_requ...
nilq/baby-python
python
import unittest from rime.util import struct class TestStruct(unittest.TestCase): def test_dict_attr(self): self.assertEqual(struct.Struct.items, dict.items) def test_constructor(self): s = struct.Struct(test_attr='test_obj') self.assertEqual(s.test_attr, 'test_obj') self.ass...
nilq/baby-python
python
import pandas as pd from calendar import isleap def get_date_range_hours_from_year(year): """ creates date range in hours for the year excluding leap day :param year: year of date range :type year: int :return: pd.date_range with 8760 values :rtype: pandas.data_range """ date_rang...
nilq/baby-python
python
from collections import defaultdict import nltk import random import string import torch from nltk.corpus import stopwords from pytorch_pretrained_bert import BertTokenizer, BertForMaskedLM from tqdm import tqdm device = torch.device("cuda" if torch.cuda.is_available() else "cpu") print('Initialize BERT vocabulary......
nilq/baby-python
python
from .FeatureSet import FeatureSet class Version(FeatureSet): def __init__(self, api, internalIdentifier, identifier, versionString, apiString): super(Version, self).__init__(api, internalIdentifier) self.nativeIdentifier = identifier self.apiString = apiString self.majorVersion, s...
nilq/baby-python
python
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations from django.conf import settings class Migration(migrations.Migration): dependencies = [ migrations.swappable_dependency(settings.AUTH_USER_MODEL), ] operations = [ migrations.Create...
nilq/baby-python
python
#!/usr/bin/python import dnaseq import bm_preproc import kmer_index human_chromosome = dnaseq.read_genome("chr1.GRCh38.excerpt.fasta") def approximate_matches(p, t, index): n = 2 matches = set() total_hits = 0 for i in range(0, 24, 8): pi = p[i:i+8] hits = index.query(pi); total_hits += len(hits) for hi...
nilq/baby-python
python
from .baselines import * from .cocostuff import * from .potsdam import * from .duckietown import *
nilq/baby-python
python
import os import sys import tempfile from unittest import mock from hashlib import sha1 from random import random from io import StringIO import argparse from .base import BaseTest from .. import cloudssh class Test(BaseTest): fake_reservations = [ { 'Groups': [], 'Instances': ...
nilq/baby-python
python
#!/usr/bin/env python from glob import glob import re from collections import Counter import subprocess32 as sp import string from itertools import product from sys import stderr from time import time def split_regions_file(boot_contigs_dict, fnames, size): """ takes Counter dictionary of bootstrapped contigs...
nilq/baby-python
python
import tempfile from django.urls import reverse from PIL import Image from rest_framework import status from rest_framework.test import APITestCase from brouwers.users.tests.factories import UserFactory from ..factories import AlbumFactory, PhotoFactory class PhotoViewsetTests(APITestCase): def setUp(self): ...
nilq/baby-python
python
""" MIT License Copyright (c) 2020 Shahibur Rahaman """ import Operations import time def main(): print( """ Calculator version 2.9.10.20 Copyright (c) Shahibur Rahaman Licensed under the MIT License. |> Press (Ctrl + C) to exit the program. |> Choose your operation: 1. Addition 2. Subtraction 3. Mul...
nilq/baby-python
python
import sys import json from data_grab.run_scraper import Scraper if(len(sys.argv)<2): print('Please Give topic name. e.g. "Clock"') sys.exit() topic = sys.argv[1] data_obj = False j_data = json.loads(open('data_grab/resources/topic_examvida.json').read()) for c in j_data: if topic == c["topic_name"]: ...
nilq/baby-python
python
from views.main_view import prompt prompt()
nilq/baby-python
python
#!/usr/bin/env python # Copyright (c) 2009, Giampaolo Rodola'. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. """ A clone of 'pmap' utility on Linux, 'vmmap' on OSX and 'procstat -v' on BSD. Report memory map of a process. $ python scripts/p...
nilq/baby-python
python
# coding=utf-8 # Copyright 2021-present, the Recognai S.L. team. # # 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 ...
nilq/baby-python
python
# Copyright (c) 2018, Manfred Moitzi # License: MIT License import pytest import os import ezdxf BASEDIR = 'integration_tests' if os.path.exists('integration_tests') else '.' DATADIR = 'data' COLDFIRE = r"D:\Source\dxftest\CADKitSamples\kit-dev-coldfire-xilinx_5213.dxf" @pytest.mark.skipif(not os.path.exists(COLDFIR...
nilq/baby-python
python
def run(): my_range = range(0, 7, 2) print(my_range) other_range = range(0, 8, 2) print(other_range) print(id(my_range)) print(id(other_range)) print(my_range == other_range) # Validate (value equality) print(my_range is other_range) # Validate (object equality) # Par for...
nilq/baby-python
python
from fastapi import APIRouter, Depends from typing import List from src.utils.crud_router import include_generic_collection_document_router from src.dependencies import current_active_user from src.services.courses import CourseService, CourseSectionService dependencies: List[Depends] = [Depends(current_active_user)]...
nilq/baby-python
python
from typing import Dict, Text, Any, List import tensorflow_transform as tft def preprocessing_fn(inputs: Dict[Text, Any], custom_config) -> Dict[Text, Any]: """tf.transform's callback function for preprocessing inputs. Args: inputs: map from feature keys to raw not-yet-transformed features. custo...
nilq/baby-python
python
import numpy as np import tensorflow as tf from datasets import audio from infolog import log from wavenet_vocoder import util from wavenet_vocoder.util import * from .gaussian import sample_from_gaussian from .mixture import sample_from_discretized_mix_logistic from .modules import (Conv1D1x1, ConvTranspose2D, ConvTr...
nilq/baby-python
python
"""Testing for vault_backend module.""" import hvac import pytest import requests import config import vault_backend def test___get_vault_client(monkeypatch): # valid test client = vault_backend.__get_vault_client('salesforce') assert isinstance(client, hvac.Client) # test w/ no VAULT_CERT def m...
nilq/baby-python
python
#==================================================================================== # TOPIC: PYTHON - Modules Usage #==================================================================================== # # FILE-NAME : 013_module_usage.py # DEPENDANT-FILES : These are the files and libraries needed to run this p...
nilq/baby-python
python
from django.db import models from django.urls import reverse from django.utils.translation import ugettext_lazy as _ from colorful.fields import RGBColorField from mayan.apps.acls.models import AccessControlList from mayan.apps.databases.model_mixins import ExtraDataModelMixin from mayan.apps.events.classes import Ev...
nilq/baby-python
python
"""Common run function which does the heavy lifting of formatting output""" import csv import enum import itertools import logging import typing from notions.flatten import flatten_item from notions.models.database import Database from notions.models.page import Page, PageTitleProperty from . import yaml from .confi...
nilq/baby-python
python
import numpy as np import pickle from natasha import ( Doc, Segmenter, NewsEmbedding, NewsMorphTagger, MorphVocab ) from navec import Navec from telegram.ext import Updater, CommandHandler, MessageHandler, Filters, ConversationHandler from telegram import Bot as Bot_ from metrics import metric PAT...
nilq/baby-python
python
from django.apps import AppConfig class CityeventConfig(AppConfig): name = 'cityEvent'
nilq/baby-python
python
#!/usr/bin/env python # -*- coding: utf-8 -*- import os import arrow from app import celery, create_app from app.models.email_event import EmailEvent from app.email import send_email @celery.task def schedule_send_emails(): now = arrow.utcnow().replace(second=0, microsecond=0) app = create_app(os.getenv('JU...
nilq/baby-python
python
# Command Line Interface import argparse as ap import datetime as dt import inflationtools.main as main from argparse import RawTextHelpFormatter # Allows to use newline in help text import locale import gettext # Unable to get pot for this file... find the reason. pt = gettext.translation('CLI', localedir='locales', ...
nilq/baby-python
python
# -*- coding: utf-8 -*- # Generated by Django 1.10.4 on 2016-12-28 15:33 from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('book', '0008_book_type'), ] operations = [ migrations.AddField( ...
nilq/baby-python
python
#!/usr/bin/python3 def islower(c): chrcode = ord(c) if chrcode >= 97 and chrcode <= 122: return True else: return False
nilq/baby-python
python
import json import os import time import pandas as pd from bing import bing_web_search def crawl_snippets(title, retry=3): _, raw_resp = bing_web_search(title) response = json.loads(raw_resp) for _ in range(retry): try: pages = response['webPages']['value'] return '\n'.joi...
nilq/baby-python
python
import base64 from unittest.mock import ANY import pytest from rhub.auth.keycloak import KeycloakClient from rhub.api import DEFAULT_PAGE_LIMIT API_BASE = '/v0' def test_token_create(client, keycloak_mock): keycloak_mock.login.return_value = {'access_token': 'foobar'} rv = client.post( f'{API_BAS...
nilq/baby-python
python
from corehq.apps.commtrack.const import COMMTRACK_USERNAME from corehq.apps.users.util import DEMO_USER_ID, SYSTEM_USER_ID from corehq.pillows.utils import ( COMMCARE_SUPPLY_USER_TYPE, DEMO_USER_TYPE, MOBILE_USER_TYPE, SYSTEM_USER_TYPE, WEB_USER_TYPE, ) from corehq.warehouse.loaders import ( App...
nilq/baby-python
python
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Mon Apr 15 11:52:31 2019 @author: tgadfort """ import sys import re from datetime import timedelta from playTypes import playtype # create logger import logging module_logger = logging.getLogger('log.{0}'.format(__name__)) ##############################...
nilq/baby-python
python
""" Abstractions for lazy compositions/manipulations of And Inverter Graphs. """ from __future__ import annotations from typing import (Union, FrozenSet, Callable, Tuple, Mapping, Sequence, Optional) import attr import funcy as fn from bidict import bidict from pyrsistent import pmap from pyrsist...
nilq/baby-python
python
import numpy as np import xobjects as xo import xpart as xp # Create a Particles on your selected context (default is CPU) context = xo.ContextCupy() part = xp.Particles(_context=context, x=[1,2,3]) ############## # PANDAS/HDF # ############## # Save particles to hdf file via pandas import pandas as pd df = part.to...
nilq/baby-python
python
# proxy module from pyface.i_file_dialog import *
nilq/baby-python
python
import unicodedata from django.utils.timezone import make_aware from eagle.models import EDINETCompany, EDINETDocument class EDINETDocumentRegister(): @classmethod def register_document(cls, document, xbrl_path, pdf_path): def normalize(text): if text is not None: return ...
nilq/baby-python
python
import asyncio import aiohttp import json async def pollForex(symbols, authkey): i = 0 while True: symbol = symbols[i % len(symbols)] try: async with aiohttp.ClientSession() as session: async with session.get( url="https://api-fxpractice.oanda...
nilq/baby-python
python
import os import sys import glob import random import math import datetime import itertools import json import re import logging # from collections import OrderedDict import numpy as np from scipy.stats import multivariate_normal # import scipy.misc import tensorflow as tf # import keras import keras.backend as KB imp...
nilq/baby-python
python
from django.contrib import admin from forums.models import Category from guardian.admin import GuardedModelAdmin class CategoryAdmin(GuardedModelAdmin): list_display = ('title', 'parent', 'ordering') list_display_links = ('title',) admin.site.register(Category, CategoryAdmin)
nilq/baby-python
python
# transaction_model.py # # ATM MVC program # # Team alroda # # Aldrich Huang A01026502 2B # Robert Janzen A01029341 2B # David Xiao A00725026 2B import datetime import os class TransactionModel: _TRANSACTION_COLUMNS = 'date,uid,account_type,account_number,transaction_type,amount' def __init__(self): ...
nilq/baby-python
python
#!/usr/bin/python3.5 """ Command line utility to extract basic statistics from a gpx file """ import pdb import sys as mod_sys import logging as mod_logging import math as mod_math import gpxpy as mod_gpxpy #hack for heart rate import xml.etree.ElementTree as ET #heart rate statistics import numpy as np import o...
nilq/baby-python
python
import matplotlib.pyplot as plt, sys sys.path.insert(0, '..') from Louis.misc import * from Louis.ARC_data.objects import * from Louis.grids import * from Louis.unifying import * def show_pb(name, n=17): l, i = reversed(pickle_read(name)), 0 for pb, p, c_type in l: i += 1 if i % n == 0: ...
nilq/baby-python
python
import re import csv from io import BytesIO from zipfile import ZipFile import requests from ._version import __version__ URLHAUS_API_URL = 'https://urlhaus.abuse.ch/downloads/' REGEX_CSV_HEADER = re.compile(r'^#\s((?:[a-z_]+,)+(?:[a-z_]+))\r', re.MULTILINE) REGEX_HOSTFILE_DOMAIN = re.compile(r'^127\.0\.0\.1\t(.+)...
nilq/baby-python
python
from enum import Enum from typing import List, NewType TeamID = NewType("TeamID", int) class RoleType(Enum): PLANNER = 0 OPERATOR = 1 LINKER = 2 KEYFARMING = 3 CLEANER = 4 FIELD_AGENT = 5 ITEM_SPONSOR = 6 KEY_TRANSPORT = 7 RECHARGING = 8 SOFTWARE_SUPPORT = 9 ANOMALY_TL = 1...
nilq/baby-python
python
#!/usr/bin/env python # Copyright 2015 Ufora Inc. # # 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 applic...
nilq/baby-python
python
import os import shutil import datetime import functools import subprocess import xml.etree.ElementTree as ET import numpy as np import torch import logging from util.misc import all_gather from collections import OrderedDict, defaultdict class OWEvaluator: def __init__(self, voc_gt, iou_types, args=None, use_07_...
nilq/baby-python
python
# a method for obtaining a rough estimate of species richness on islands with transient dynamics # check it gives reasonable estimates import numpy as np import matplotlib.pyplot as plt import pandas as pd # check a range of parameter values # --- # where to save results dir_results = '../../../results/verify/test...
nilq/baby-python
python
#!/usr/bin/env python3 import rospy from nav_msgs.msg import Path, Odometry from geometry_msgs.msg import PoseStamped, Point, Quaternion, Twist from controller_copy import Controller class Test(): def __init__(self): self.odom_topic = "/odom" self.target_path = Path() self.target_path.pos...
nilq/baby-python
python
from pathlib import Path from typing import List, Tuple import numpy as np from relaxations.interval import Interval from relaxations.linear_bounds import LinearBounds def load_spec(spec_dir: Path, counter: int) -> List[Tuple[List[Interval], Interval, LinearBounds]]: parameters = list() interval_bounds = li...
nilq/baby-python
python
import cv2 import numpy as np def parse_mapping(ground_truth): map = {} f = open(ground_truth, "r") for line in f.readlines(): label = line.strip().split(",")[1] if label not in map: map[label] = len(map) def parse_data(ground_truth): images = {} label_dict = {} f ...
nilq/baby-python
python
# 入力フレーズに対してコサイン類似度を求めていく # 類似度の結果をjson, pklで出力 from sentence_transformers import SentenceTransformer import numpy as np import torch from torch import nn import pickle import json # 今回の入力 key_phrase = 'pulls the trigger' # データセットの読み込み with open('combined_word2id_dict.pkl', 'rb') as f: phrase_dict = pickle.load(f...
nilq/baby-python
python
s = 0 cont = 0 for c in range(1, 501, 2): if c % 3 == 0 and c % 2 == 1: s += c cont += 1 print(f'A soma de {cont} valores múltiplos de 3 entre 1 e 501 é {s}')
nilq/baby-python
python
import math import numpy as np import os from scipy import ndimage from scipy.interpolate import RegularGridInterpolator as rgi import common import argparse import ntpath # Import shipped libraries. import librender import libmcubes from multiprocessing import Pool use_gpu = True if use_gpu: import libfusiongpu ...
nilq/baby-python
python
arr=list(map(int,input().rstrip().split())) fff=list(map(int,input().rstrip().split())) a=0 for i in range(len(arr)): a=a+abs(arr[i]-fff[i]) print(a)
nilq/baby-python
python
# -*- coding: utf-8 -*- # Generated by Django 1.11.16 on 2018-12-04 12:13 from __future__ import absolute_import, unicode_literals from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('icds_reports', '0080_merge_20181130_1818'), ] operations = [ migr...
nilq/baby-python
python
import storage import nomadlist import wikivoyage def build(cities=None): index_guides(cities or index_cities()) return True def index_cities(): cities = nomadlist.list_cities() storage.upsert_cities(cities) return cities def index_guides(cities): city_docs = map(build_guide, cities) ...
nilq/baby-python
python
# -*- coding: utf-8 -*- """ @Created on: 2019/5/23 16:23 @Author: heyao @Description: """ import os import warnings from knowledge_graph.local_config import DevelopmentConfig try: from knowledge_graph.production_config import ProductionConfig except ImportError: warnings.warn("you dont have production conf...
nilq/baby-python
python
"""Dataset setting and data loader for MNIST.""" import torch from torchvision import datasets, transforms import params def get_svhn(train): print("SVHN Data Loading ...") train_dataset = datasets.SVHN(root='/home/hhjung/hhjung/SVHN/', split='train', transform=tran...
nilq/baby-python
python
from collections import namedtuple ConnectArgsType = namedtuple('ConnectArgsType', [ 'verify', 'verify_expiration', 'key', 'audience', 'issuer', 'algorithm', 'auth_header_prefix', 'decode_options' ]) CONNECT_ARGS = ConnectArgsType( verify=None, verify_expiration=None, key=None, audience=None, ...
nilq/baby-python
python
#!/usr/bin/python3 """ This module contains the function is_same_class """ def is_same_class(obj, a_class): """return true if obj is the exact class a_class, otherwise false""" return (type(obj) == a_class)
nilq/baby-python
python
from libtad.base_service import BaseService from libtad.datatypes.places import Place from libtad.common import XmlUtils import libtad.constants as Constants import xml.etree.ElementTree as ET from urllib.parse import ParseResult, urlunparse, urlencode from urllib.request import urlopen, Request from ssl import SSLCont...
nilq/baby-python
python
#!/usr/bin/env python3 # zeroex00.com # rfc1413 import argparse import socket import sys import threading master_results = [] master_banners = {} master_errors = [] def main(args): if not args.query_port and not args.all_ports: print("[!] you must specify at least one port or -a") exit(2) ...
nilq/baby-python
python
import json import sys from twisted.internet import reactor, defer from twisted.web.client import getPage, HTTPClientFactory try: from twisted.internet import ssl except ImportError: ssl = None class Jar: def __init__(self, name_long, name_short, url): self.name_long = list(name_long) s...
nilq/baby-python
python
import base64 import configparser import click import requests from logbook import * # from requests.cookies import RequestsCookieJar import controller as ctrl from config.base_settings import CAPTCHA_MODEL_NAME, TIMEOUT, USE_PROXY from controller.url_config import url_captcha, url_login # from service.log import in...
nilq/baby-python
python
constants.physical_constants["neutron to shielded proton mag. mom. ratio"]
nilq/baby-python
python
""" Test for building manifests for COMBINE archives :Author: Jonathan Karr <karr@mssm.edu> :Date: 2021-07-19 :Copyright: 2021, Center for Reproducible Biomedical Modeling :License: MIT """ from biomodels_qc.utils import EXTENSION_COMBINE_FORMAT_MAP import os import unittest class CombineArchiveCreationTestCase(uni...
nilq/baby-python
python
from . import CostFunctions from . import ActivationFunctions from . import PyNet #from . import tfNet #got rid of tensorflow from . import Autoencoder from .NeuralNetwork import NeuralNetwork ,NeuralNetworkArray from .EvolutionaryNeuralNetwork import EvolutionaryNeuralNetwork,PyEvolutionaryNeuralNetwork from .Tests i...
nilq/baby-python
python
{ "targets": [ { "target_name": "node_ovhook", "cflags!": ["-fno-exceptions"], "cflags_cc!": ["-fno-exceptions"], "include_dirs": [ "<!@(node -p \"require('node-addon-api').include\")", "./src", ], 'defin...
nilq/baby-python
python
import ephem from datetime import datetime import pandas as pd import numpy as np import requests from flask import Flask, render_template, session, redirect, request import folium import geocoder app = Flask(__name__) def get_latlng(): #Get user lat long via IP address myloc = geocoder.ip('me') return...
nilq/baby-python
python
from bcc import BPF # Hello BPF Program bpf_text = """ #include <net/inet_sock.h> #include <bcc/proto.h> // 1. Attach kprobe to "inet_listen" int kprobe__inet_listen(struct pt_regs *ctx, struct socket *sock, int backlog) { bpf_trace_printk("Hello World!\\n"); return 0; }; int kprobe__ip_rcv(struct pt_regs...
nilq/baby-python
python
from tensornetwork.block_sparse import index from tensornetwork.block_sparse import charge from tensornetwork.block_sparse import blocksparsetensor from tensornetwork.block_sparse import linalg from tensornetwork.block_sparse.blocksparsetensor import (BlockSparseTensor, ...
nilq/baby-python
python
from SuperImpose import SuperImpose class SuperImposeFields(SuperImpose): ''' SuperImpose subclass implementing specific functionality to super-impose all field images on background image ''' @staticmethod def run_super_impose_on_all_fields(back_rgba_img, fields_img_loc_dict): ''' ...
nilq/baby-python
python
from django.urls import path from . import views app_name = 'articles' urlpatterns = [ path('', views.index, name ='index'), path('<int:article_id>/', views.detail, name ='detail'), path('<int:article_id>/leave_comment/', views.leave_comment, name ='leave_comment'), ]
nilq/baby-python
python
# JEWELS AND STONES LEETCODE SOLUTION: # creating a class. class Solution(object): # creating a function to solve the problem. def numJewelsInStones(self, jewels, stones): # creating a variable to track the count. count = 0 # creating a for-loop to iterate for the elements...
nilq/baby-python
python