content stringlengths 5 1.05M |
|---|
# Reimplementation of integral_2d1d_v01 for up to date bundles
# Reimplementation of integral_2d1d_v02 with Integrator21GL instead of legacy GaussLegendre
from load import ROOT as R
import numpy as N
import gna.constructors as C
from gna.bundle import TransformationBundle
class integral_2d1d_v03(TransformationBundle)... |
from .help import Help
from .set_prefix import SetPrefix
from .register import Register
from .delete import Delete
commands = [Help(), SetPrefix(), Register(), Delete()] |
#program to insert a given string at the beginning of all items in a list.
num = [1,2,3,4]
print(['emp{0}'.format(i) for i in num])
|
import os
os.environ['CUDA_VISIBLE_DEVICES'] = '0'
from autoballs.utils import get_img_from_seg, visualize
from autoballs.network.dataloader import (
Dataset,
get_training_augmentation,
get_validation_augmentation,
get_test_augmentation,
get_preprocessing,
)
import torch
from torch... |
import setuptools
with open("README.md", "r") as fh:
long_description = fh.read()
setuptools.setup(
name="tlopu",
version="0.0.1",
author="Giuseppe Luca Tommasone",
author_email="luca@lighton.io",
description="Blogpost code for Transfer Learning on videos.",
long_description=long_descripti... |
# python3
# Copyright 2018 DeepMind Technologies Limited. 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 re... |
# ticker.py
import csv
from . import report
from . import tableformat
from .follow import follow
def select_columns(rows, indices):
for row in rows:
yield [row[index] for index in indices]
def convert_types(rows, types):
for row in rows:
yield [func(val) for func, val in zip(types, row)]
def... |
#!/usr/bin/python
# Basic examples of binary trees
class Node:
def __init__(self, data):
self.data = data
self.left = None
self.right = None
def insert(self, data):
if self.data:
if data < self.data:
if not self.left:
self.left = Node(data)
... |
import pyperclip
import random
class User:
'''
Class to generate new instance of a user.
'''
users_list = []
def __init__(self,username,password):
'''
__init__ method that helps to define properties of an object
'''
self.username = username
self.password... |
# output a file that maps instruction mneumonic to its metadata including the flag(s) it sets
# x86data.json is from https://github.com/asmjit/asmdb/blob/master/x86data.js
import json
def get_x86registers():
with open('./x86data.json') as fp:
data = json.load(fp)
prev_mn = None
regs = {}
... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# BioSTEAM: The Biorefinery Simulation and Techno-Economic Analysis Modules
# Copyright (C) 2020-2021, Yoel Cortes-Pena <yoelcortes@gmail.com>
# Bioindustrial-Park: BioSTEAM's Premier Biorefinery Models and Results
# Copyright (C) 2020-2021, Yalin Li <yalinli2@illinois.edu... |
# -*- mode:python; coding:utf-8 -*-
# Copyright (c) 2021 IBM Corp. 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
... |
# coding: utf-8
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
class PAVDistiller:
def __init__(self, input_len, kd_loader, device, regularization=True):
# input_len: 512
self.input_len = input_len
self.kd_loader = kd_loader
self.devi... |
# --
# Copyright (c) 2008-2021 Net-ng.
# All rights reserved.
#
# This software is licensed under the BSD License, as described in
# the file LICENSE.txt, which you should have received as part of
# this distribution.
# --
from nagare.admin import command
class Commands(command.Commands):
DESC = 'Redis subcomman... |
import collections
import hashlib
import json
import logging
import os.path
import re
import sys
from datetime import datetime
from typing import Any, Dict, Iterator, List, NamedTuple, Optional, Set, Tuple
import distlib.wheel
import jinja2
import packaging.utils
import packaging.version
import requests
from atomicwri... |
ART = 'art-default.jpg'
ICON = 'icon-default.png'
SEARCH_ICON = 'icon-search.png'
OPTIONS_ICON = 'icon-options.png'
NEXT_ICON = 'icon-next.png'
BACK_ICON = 'icon-back.png'
ADD_ICON = 'icon-add.png'
REMOVE_ICON = 'icon-remove.png'
from plex_music_service import PlexMusicService
def on_error(e):
Log(e)
return ... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.utils.encoding import python_2_unicode_compatible
from django.db import models
from django.contrib.auth.models import User
import datetime
import pytz
from django.utils import timezone
@python_2_unicode_compatible
# Create your models here.
c... |
import stripe
from stripe.test.helper import StripeResourceTest
class SourceTest(StripeResourceTest):
def test_retrieve_resource(self):
stripe.Source.retrieve("src_foo")
self.requestor_mock.request.assert_called_with(
'get',
'/v1/sources/src_foo',
{},
... |
"""
Classes for prediction, output formatting, and visualization.
"""
import datetime
import glob
import json
import os
import pickle
from tempfile import NamedTemporaryFile
from typing import Iterable, List, Optional, Union
import numpy as np
import cv2
import imantics
from detectron2.config import CfgNode
from detec... |
import json
import sys
import urllib.request
# reference https://foosoft.net/projects/anki-connect/#note-actions
deckname = ""
def request(action, **params):
return {'action': action, 'params': params, 'version': 6}
def invoke(action, **params):
requestJson = json.dumps(request(action, **params)).encode('ut... |
import discord
import aiohttp
import feedparser as fp
import stackprinter as sp
from discord.ext import commands
from datetime import datetime
from bin import zb
from bin import cp
class OwnerCog(commands.Cog):
def __init__(self, bot):
self.bot = bot
@commands.command(name='dev', hidden=True)
@c... |
# vim:fileencoding=utf-8:noet
from __future__ import (unicode_literals, division, absolute_import, print_function)
try:
import vim
except ImportError:
vim = object()
from powerline.bindings.vim import vim_command_exists
from powerline.theme import requires_segment_info
# coc_status's format: E1 W2
def parse_coc_st... |
#!/usr/bin/env python3
from __future__ import annotations
import difflib
import glob
import shutil
import sys
from typing import Iterator
import click
import nbformat
from nbconvert.preprocessors import ExecutePreprocessor # type: ignore[import]
from nbformat import notebooknode
def diff(v1: str, v2: str, filename... |
import json
from django.contrib.auth.models import User
def create_superuser(username, password, email):
User.objects.create_superuser(username=username, password=password, email=email)
def create_user(username, password, email):
User.objects.create_user(username=username, password=password, email=email)
... |
import dataclasses
from enum import Enum
from dsorm import Comparison, Database, DataClassTable, make_table
db = Database.memory()
@make_table
class Team(Enum):
UNASSIGNED = 0
RED = 1
BLUE = 2
@make_table
@dataclasses.dataclass
class Person(DataClassTable):
first_name: str = None
last_name: st... |
from __future__ import absolute_import
from __future__ import unicode_literals
def reraise(error):
import six
six.reraise(type(error), error)
class Impossible(AssertionError):
"""raised only in cases that we believe to be impossible"""
class Unsupervised(Exception):
"""The pgctl supervision proces... |
# Generated by Django 3.0.4 on 2020-04-05 00:46
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Burner',
fields=[
('id', models.AutoField(a... |
#!/usr/bin/env python
import os
# Always prefer setuptools over distutils
from setuptools import setup, find_packages
# https://packaging.python.org/guides/single-sourcing-package-version/
# http://blog.ionelmc.ro/2014/05/25/python-packaging/
PATH_ROOT = os.path.dirname(__file__)
import project # noqa: E402
def... |
# -*- coding:utf-8 -*-
from django.db import models
from account.models.user import User
class Ticket(models.Model):
"""
登录券
"""
user = models.ForeignKey(to=User, verbose_name="用户", on_delete=models.CASCADE)
# 注意事项,如果手动修改了user, 但是sessionid却是另外一个用户的,那么子系统就会与sso的不匹配了
# 在这里我们暂时以user为准, 后续在使用tick... |
# coding=utf-8
"""
摆动排序
描述:给你一个没有排序的数组,请将原数组就地重新排列满足如下性质
nums[0] <= nums[1] >= nums[2] <= nums[3]....
思路:
要么先快排,然后两两互换
要么一开始两两比较互换
"""
class Solution:
"""
@param: nums: A list of integers
@return: nothing
"""
def wiggleSort(self, nums):
# write your code here
# quicksort fi... |
# Problem Statement
# Calvin is driving his favorite vehicle on the 101 freeway. He notices that the check engine light of his vehicle is on, and he wants to service it immediately to avoid any risks. Luckily, a service lane runs parallel to the highway. The length of the highway and the service lane is N units. The s... |
# list of the available constraints types. They will be used in the criterias names
criteria_types = ["land_use", "bio", "socio_eco", "forest"]
# list of all the available benefits types, they will be used for benefits names
benefit_types = ["local_live", "wood_prod", "carbon", "bio"]
# list of the layer themes
theme... |
from argparse import ArgumentParser
import importlib
import matplotlib
#print(matplotlib.get_backend())
#matplotlib.rcParams["backend"] = "TkAgg"
#print(matplotlib.get_backend())
import matplotlib.pyplot as plt
#plt.switch_backend("TkAgg")
import numpy as np
import torch
import torch.nn as nn
import torch.nn.function... |
def main():
with open('part2.in') as f:
content = f.readlines()
content = [int(x.strip()) for x in content]
num_steps = traverse_list(content)
print(num_steps)
def traverse_list(maze):
index = 0
num_steps = 0
while (index > -1 and index < len(maze)):
new_index =... |
import sys
import tempfile
import requests
import torchvision
import torch
from torchvision import transforms as T
from models.resnet import resnet50
from halutmatmul.model import HalutHelper
def download_weights(path: str, is_ci: bool = False) -> None:
url = "https://github.com/joennlae/PyTorch_CIFAR10/raw/ver... |
import os
from typing import Tuple
import pandas as pd
import numpy as np
from sklearn.model_selection import train_test_split
from torchvision import datasets as torchdata
from continuum.datasets import ImageFolderDataset
from continuum.download import unzip
from continuum.tasks import TaskType
class PACS(ImageFol... |
# AUTO-GENERATED by tools/checkspecs.py - DO NOT EDIT
from ..odf import ODFTracker
def test_ODFTracker_inputs():
input_map = dict(
ODF=dict(
extensions=None,
mandatory=True,
),
angle_threshold=dict(
argstr="-at %f",
),
args=dict(
... |
""" Module for spec widgets
"""
from __future__ import print_function, absolute_import, division, unicode_literals
import numpy as np
import pdb
from qtpy import QtGui
from qtpy import QtCore
from qtpy.QtWidgets import QWidget, QDialog, QPushButton, QLabel
from qtpy.QtWidgets import QVBoxLayout, QHBoxLayout, QListWi... |
import FWCore.ParameterSet.Config as cms
process = cms.Process("CaloTest")
process.load("Configuration.EventContent.EventContent_cff")
process.load('FWCore.MessageService.MessageLogger_cfi')
process.load('GeneratorInterface.Core.generatorSmeared_cfi')
process.load("SimGeneral.HepPDTESSource.pdt_cfi")
process.load("Sim... |
#!/usr/bin/env python3
"""
The toolbox for kinetic library related tasks
"""
import logging
import os
from collections import OrderedDict
from copy import deepcopy
from rmgpy import settings
from rmgpy.chemkin import load_chemkin_file
from rmgpy.data.base import Entry
from rmgpy.data.kinetics import KineticsLibrary
f... |
from command_base import CommandBase
from bcbcommand import BcbCommand
from echo import Echo
from test import Test
from lights import Lights
|
print('SIMULANDO CAIXA!!!')
print('=-=' * 15)
n = int(input('VALOR A SACAR: R$'))
cinquenta = vinte = dez = um = 0
print('=-=' * 15)
while True:
if n % 50 == 0:
cinquenta += 1
n -= 50
elif n % 20 == 0:
vinte += 1
n -= 20
elif n % 10 == 0:
dez += 1
n -= 10
... |
print('=======DESAFIO 1=======')
cores = {'vazio': '\033[m',
'ciano': '\033[1;36m'}
nome = input('Qual o seu nome?: ')
print('Olá {}{}{}! Seja bem vindo!'.format(cores['ciano'], nome, cores['vazio']))
|
"""Function that takes in a string of parens and returns a value
based on whether the parens are open, balanced, or broken."""
class Node(object):
"""Build a node object."""
def __init__(self, data=None, next=None):
"""Constructor for the Node object."""
self.data = data
self.next = n... |
import pygame
class Piece:
def __init__(self, x, y, color, stages, centers):
self.x = x
self.y = y
self.color = color
self.stages = stages
self.centers = centers
self.rotation = 0
def rotate(self, board, delta):
# if no board is provided then f... |
# ---
# |>s |
# |s@s|
# | C |
# ---
level.description("You feel slime on all sides, you're surrounded!")
level.tip("Call warrior.bind_(direction) to bind an enemy to keep him "
"from attacking. Bound enemies look like captives.")
level.clue("Count the number of enemies around you. Bind an enemy if "
... |
import torch
import torch.nn as nn
import torch.optim as optim
from Networks import CIFAR10_FPN_Unaugmented_Explicit, BasicBlock
from utils import train_class_net, cifar_loaders
device = 'cuda:0'
print('device = ', device)
seed = 50
torch.manual_seed(seed)
# ----------------------------------------------------------... |
import torch
from typing import List, Optional
def top_k_logits(logits, k):
if k == 0:
return logits
values, _ = torch.topk(logits, k)
min_values = values[-1]
return torch.where(logits < min_values, torch.ones_like(logits, dtype=logits.dtype) * -1e10, logits)
def sample_token(node, top_k=40, t... |
#!/usr/bin/env python
__author__ = "Blaze Sanders"
__email__ = "b@cafebeep.com"
__company__ = "BEEP BEEP Technologies Inc"
__status__ = "Development"
__date__ = "Late Updated: 2019-06-14"
__doc__ = "Class to locally search user information, with ability to pull and push data from servers and flashdrives"
#... |
"""
Add samples
This script takes a wav file that must have n peaks and create n different files for each peak.
"""
import numpy as np
from scipy.io.wavfile import read,write
import peakutils, os
# average
# 3169 / 2 = 1584.5
side = 10000
# The stander for the peaks
stander = 0
"""
Write the .wav file
"""
def exp... |
import pandas as pd
from sklearn.feature_selection import SelectKBest
from sklearn.feature_selection import f_classif
from sklearn.preprocessing import scale, normalize, MinMaxScaler
from sklearn.metrics import accuracy_score, precision_score, recall_score, classification_report, f1_score
from sklearn.model_selection i... |
# This file is part of Pynguin.
#
# Pynguin is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Pynguin is distributed in the ho... |
# o #masina merge pe strada si computerul de bord ne anunta daca suntem pe loc, in localitate, drum judetean sau autostrada
# definim o variabila viteza actuala unde tinem viteza
# si verificam daca e pe loc (0), sau daca e in localitate (unde poti merge cu max 50),
# sau pe drum judetean unde poti merge cu pana in 90,... |
#!/usr/bin/python3
import sys
for line in sys.stdin:
line = line.strip()
myList = line.split(',')
if (myList[0] == 'ball') :
print('%s\t%s\t%s' % (myList[4], myList[6], myList[9]))
|
from django.contrib import admin
from .models import GraduatingClass, Person, School
class GraduatingClassAdmin(admin.ModelAdmin):
pass
class PersonAdmin(admin.ModelAdmin):
ordering = ('graduation_last_name', 'graduation_first_name')
list_display = [
'display_name',
'graduation_last_nam... |
import unittest
import os
import fastly
from fastly._version import __version__
class APITest(unittest.TestCase):
def setUp(self):
self.api = fastly.API()
self.host = os.environ.get('FASTLY_SERVICE_HOST', 'test.com')
self.service_id = os.environ.get('FASTLY_SERVICE_ID', 'test.com')
... |
#
# Copyright (C) 2014-2018 Pico Technology Ltd. See LICENSE file for terms.
#
"""
This is a Python module defining the functions from the ps6000Api.h C header
file for PicoScope 6000 Series oscilloscopes using the ps6000 driver API
functions.
"""
from ctypes import *
from picosdk.library import Library
class Ps6000... |
from RFEM.initModel import Model, clearAtributes
class SolidMeshRefinement():
def __init__(self,
no: int = 1,
target_length: float = 0.15,
solids: str = '',
comment: str = '',
params: dict = None,
model = Model):
... |
# Copyright (c) 2018 Sony Pictures Imageworks 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 applicable law... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import re
from bs4 import BeautifulSoup
import time
import requests
import fake_useragent
import os
import random
class GetPic:
def __init__(self):
self.new_urls = set()
self.old_urls = set()
def craw(self, root_url):
self.new_urls.add(... |
import unittest
import pandas as pd
from chemcharts.core.container.chemdata import ChemData
from chemcharts.core.container.fingerprint import *
from chemcharts.core.functions.binning import Binning
class TestBinning(unittest.TestCase):
@classmethod
def setUpClass(cls) -> None:
smiles = Smiles(["COc1c... |
# -*- coding: utf-8 -*-
"""
Created on Fri Oct 10 11:42:31 2014, para la práctica de cristales sónicos de Labo 5.
@author: Juan Beiroa.
@authorofauthor: Mark Jones.
Pueden ver el programa original que sirvió como base de este en la web de Mark
Jones: http://markjones112358.co.nz/projects/Python-Tone-Generator/... |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'VDiskShare.ui'
#
# Created: Fri May 25 12:18:13 2012
# by: PyQt4 UI code generator 4.9.1
#
# WARNING! All changes made in this file will be lost!
from PyQt4 import QtCore, QtGui
try:
_fromUtf8 = QtCore.QString.fromUtf8
except Attr... |
# Generated by Django 3.0.3 on 2020-08-19 23:04
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('predictor', '0002_review'),
]
operations = [
migrations.AlterField(
model_name='review',
name='dokumen_relevan',
... |
import sys
test_cases = open('sample.txt', 'r')
for test in test_cases:
# ignore test if it is an empty line
# 'test' represents the test case, do something with it
# ...
# ...
num = [int(x) for x in test.split(',')]
binary = bin(num[0])
# print len(binary)
if binary[len(binary)-num[1]] ... |
blame_phantom_html_template = """
<body id="inline-git-blame">
<style>{css}</style>
<div class="phantom-arrow"></div>
<div class="phantom">
<span class="message">
<strong>Git Blame</strong> ({author})
{date} {time} |
<a href="prev?s... |
import json
from tqdm import tqdm
from utils.misc import Struct
from utils.basic_utils import load_json
from os.path import exists
from model.vcmr import HeroForVcmr
import torch
from utils.const import VFEAT_DIM
from apex import amp
from load_data import get_video_ids, load_video_sub_dataset
from data import VcmrFull... |
'''
Universidade Federal de Pernambuco (UFPE) (http://www.ufpe.br)
Centro de Informática (CIn) (http://www.cin.ufpe.br)
Bacharelado em Sistemas de Informacao
IF 969 - Algoritmos e Estruturas de Dados
Author: Antônio Paulino de Lima Neto (apln2)
Email: apln2@cin.ufpe.br
Created on Sat Jun ... |
# Markov Logic Networks - Grounding
#
# (C) 2013 by Daniel Nyga (nyga@cs.tum.edu)
#
# 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 ri... |
"""
Collection of constants for the different modules
"""
from .config import CLANG
# List of all compiler alias
COMPILERS = ["cc", "gcc", "clang", CLANG]
# All optimizer flags in the compiler
OPTIMIZERFLAGS = ['-O0', '-O1', '-O2', '-O3', '-Og', '-Os', '-Ofast']
# All flags for dependency generation
DEPENDENCYFLAGS... |
##!/usr/bin/python
#
# ============================================================================
#
# 05.07.17 <-- Date of Last Modification.
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# ----------------------------------------------------------------------------
#
# THE DATABOX
#
# Copyright (C) Eugen... |
from rest_framework.pagination import PageNumberPagination
class Pagination(PageNumberPagination):
"""
Using this method requires calling the 'paginate_queryset' method before.
Keep in mind that for the operation, you need to pass the request response
already 'mounted', here will only be made the spre... |
from pydmtx.symbol import Symbol
from pydmtx.encode import encode as encode_encode
from pydmtx.reedsolomon import encode as reedsolomon_encode
from pydmtx.bitstream import bitstream
from pydmtx.plugins.registry import plugin_manager
from pydmtx.plugins import ExportPlugin
DEFAULT_QUIET_ZONE = 2
DEFAULT_SYMBOL_SIZE = ... |
import numpy as np
import matplotlib.pyplot as plt
import abc
from numba import vectorize, float64
import functools
class TipSampleInteraction(abc.ABC):
def __init__(self):
self._F = self._get_F()
def __neg__(self):
return NegateForce(self)
def __sum__(self, other):
return SumFor... |
import math
import unittest
import networkx as nx
import numpy as np
import pandas as pd
from analysis_pipeline.generate_graphs import get_points_to_plot
import analysis_pipeline.simplified_graph_metrics
import multiprocessing
from analysis_pipeline.pcap_to_edgelists import create_mappings
class testSyntheticAttackI... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# This file is part of curveball.
# https://github.com/yoavram/curveball
# Licensed under the MIT license:
# http://www.opensource.org/licenses/MIT-license
# Copyright (c) 2015, Yoav Ram <yoav@yoavram.com>
from __future__ import print_function
from __future__ im... |
'ks5 web server'
from flask import Flask
import controllers.hello as controller_hello
app = Flask(__name__)
app.add_url_rule('/api/hello', view_func=controller_hello.hello, methods=['GET'])
if __name__ == '__main__':
app.logger.info('starting server in development mode')
app.logger.info('all ready, startin... |
"""
ArticleDecoder - Decode and assemble files from usenet articles (nzbSegments)
(c) Copyright 2005 Philip Jenvey
[See end of file]
"""
import binascii, os, re, shutil, string, time, Hellanzb
from threading import Lock
from twisted.internet import reactor
from zlib import crc32
from Hellanzb.Daemon import beginDownl... |
"""Summation of primes
The sum of the primes below 10 is 2 + 3 + 5 + 7 = 17.
Find the sum of all the primes below two million.
"""
from euler.solutions import solution_3
def prime_sum(limit):
"""Compute the sum of all primes below the given limit.
Arguments:
limit (int): The limit below which prime... |
# -*- coding: utf-8 -*-
import re
import xml.etree.ElementTree as etree
from ..base.downloader import BaseDownloader
# Based on zdfm by Roland Beermann (http://github.com/enkore/zdfm/)
class ZDF(BaseDownloader):
__name__ = "ZDF Mediathek"
__type__ = "downloader"
__version__ = "0.89"
__status__ = "tes... |
from .base import CRUDBase
from app.models.form import FormCreate, Form, FormUpdate
class CRUDForm(CRUDBase[Form, FormCreate, FormUpdate]):
pass
crud_form = CRUDForm(Form, FormCreate, FormUpdate)
|
# store database models
from . import db # the dot (.) referst to the package (website)
from flask_login import UserMixin
from sqlalchemy.sql import func
class User(db.Model, UserMixin): # UserMixin is used to access the current user's info
id = db.Column(db.Integer, primary_key=True)
email = db.Column(db.Str... |
import sys
from .test_helper import TestHelper
from json_regex_diff.jsondiff import JsonDiff
class JsonModelDiffTest(TestHelper):
def test_simple_regex_no_difference(self):
"""
With no difference we should have an empty list
"""
new_file = self.write_string_to_file('["test"]', "i... |
from django import forms
from .models import Profile,Image,Comments
class ProfileForm(forms.ModelForm):
class Meta:
model = Profile
exclude=['user']
class ImageForm(forms.ModelForm):
class Meta:
model = Image
exclude =[ 'profile', 'like_add', 'date_uploaded','vote_score', 'nu... |
# Generated by Django 3.0.4 on 2020-04-24 15:13
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('rasiberryPiGPIOBaseAPI', '0003_auto_20200424_1511'),
]
operations = [
migrations.AlterModelOptions(
name='scheduler',
option... |
# the 5th sharif acm contest: number 2:SMS lock decrypt program
"""
THE PROBLEM:
This year, ACM scientific committee members use emails to discuss
about the problems and edit the selected ones. They know that email is
not a secure way of communication, especially on such an important
topic. So they transfer passwo... |
# Copyright 2021 Amazon.com, Inc. or its affiliates. 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. A copy of the License is located at
#
# http://aws.amazon.com/apache2.0/
#
# or in the "LICENSE.txt" file accom... |
#
# MIT License
#
# Copyright (c) 2020 Airbyte
#
# 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... |
# integer variable, Integers are whole numbers
a = 10
print("Integer value for variable a is : "+str(a))
#float variable, float are numbers with a floating point(or decimal place)
b = 10.5
# print is the function that perform actions or calculate outputs(or both)
print(b)
# Another useful data type is the string. A s... |
# coding=utf-8
import json
import responses
import time
import jwt
from unittest import TestCase
from os.path import join, dirname
import ibm_watson
from ibm_watson.language_translator_v3 import TranslationResult, TranslationModels, TranslationModel, IdentifiedLanguages, IdentifiableLanguages, DeleteModelResult
platf... |
import logging
from datetime import datetime
from django.contrib.auth import authenticate, login
from django.db.utils import IntegrityError
from django.shortcuts import render, redirect
from rest_framework import status
from rest_framework.generics import (CreateAPIView, GenericAPIView, ListAPIView,
... |
for i in range(0,10):
print('good', end="")
print("\n") |
# -*- coding: utf-8 -*-
"""evaluation.ipynb
Automatically generated by Colaboratory.
Original file is located at
https://colab.research.google.com/drive/12RfjRSBRnyNOPcfEZti27ytvwaR9WptA
"""
import os
import tensorflow as tf
from tensorflow.keras.preprocessing.text import Tokenizer
from tensorflow.keras.preproc... |
from pyquery import PyQuery as pq
from graphviz import Digraph
import hashlib
dot = Digraph(comment='Sitemap')
dot.format = 'svg'
class crawler:
def __init__(self, d):
self._domain = d
self.graph_path = []
def craw(self, target_url=None):
target_url = self._domain
d = pq(url... |
import pytest
import pathlib
from altanalyze3.utilities.helpers import (
get_md5_sum,
get_tmp_suffix
)
DATA_FOLDER = pathlib.Path(__file__).resolve().parents[1].joinpath("data")
@pytest.mark.parametrize(
"location, control_md5_sum",
[
("hg19_ref.tsv", "cb3093cbaeb5a27d95fc09add352641a")
... |
#!/usr/bin/env python
# vim: ai ts=4 sts=4 et sw=4
def unique(s):
"""Return a list of the elements in s, but without duplicates.
For example, unique([1,2,3,1,2,3]) is some permutation of [1,2,3],
unique("abcabc") some permutation of ["a", "b", "c"], and
unique(([1, 2], [2, 3], [1, 2])) some permu... |
"""Module to handle coordinate transforms."""
import numpy as np
import abc
class OwnerMixin:
@property
def shape(self):
return self.coordinate.shape
@property
def ndim(self):
return len(self.shape)
def copy(self, deep=False):
new_obj = type(self).__new__(type(self))
... |
import asyncio
import functools
import random
import time
from testing import Client
from testing import default_test_setup
from testing import gen_data
from testing import gen_points
from testing import gen_series
from testing import InsertError
from testing import PoolError
from testing import QueryError
from testing... |
def walk_processes(top, topname='top', topdown=True, ignoreFlag=False):
"""Generator for recursive tree of climlab processes
Usage:
processes = []
for name, proc, top_proc in walk_processes(model):
processes.append(proc)
Generates a complete list of all processes and... |
"""
Make sure we can find the binary inside an app bundle.
"""
import lldb
from lldbsuite.test.decorators import *
import lldbsuite.test.lldbutil as lldbutil
import lldbsuite.test.lldbplatformutil as lldbplatformutil
from lldbsuite.test.lldbtest import *
@decorators.skipUnlessDarwin
class FindAppInMacOSAppBundle(Test... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.