text stringlengths 2 999k |
|---|
# -*- coding=utf-8 -*-
import os
import shutil
import pytest
import vistir
from requirementslib.models.requirements import Requirement
from requirementslib.models.setup_info import ast_parse_setup_py
@pytest.mark.skipif(os.name == "nt", reason="Building this is broken on windows")
@pytest.mark.parametrize(
"tes... |
import string
import unicodedata
SLUG_CHARS_DISPLAY = '[a-z0-9-]'
_SLUG_CHARS = string.ascii_lowercase + string.digits + '-'
_SLUG_SIZE = 50
def slugify(text):
'''Returns the slug of a string (that can be used in an URL for example.'''
slug = unicodedata.normalize('NFKD', text).encode('ascii', 'ignore')
... |
# Generated by Django 2.2.10 on 2020-02-29 14:55
import diventi.accounts.models
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('accounts', '0255_auto_20200225_0743'),
]
operations = [
migrations.AlterModelManagers(
name='diventiuser... |
# coding: utf-8
import kivy
from kivy.app import App
from kivy.uix.boxlayout import BoxLayout
from kivy.uix.button import Button
# version requirement
kivy.require('1.9.1')
class Tela1(BoxLayout):
def __init__(self, **kwargs):
super(Tela1, self).__init__(**kwargs)
self.orientation = 'vertical'
... |
# -*- coding: utf-8 -*-
"""
Contains the DropNa class
=========================
Simply a shortcut class for a common operation.
Summary of DropNa Usage:
------------------------
See pandas Documentation
"""
from .post import Post
import pandas as pd
from typing import List
class DropNa(Post):
"""Used to drop c... |
from httplib2 import *
from httplib2 import DEFAULT_MAX_REDIRECTS
import json
import logging
import time
from performanceplatform.collector.logging_setup import (
extra_fields_from_exception)
_MAX_RETRIES = 5
def abort_message(method, uri, status, reason):
return (
'{} request for {} failed with code... |
from __future__ import annotations
import json
from pathlib import Path
from typing import Callable, TypeVar
import docutils.nodes
from sphinx.application import Sphinx
from sphinx_hyperhelp import HyperHelpTranslator
T_co = TypeVar("T_co", covariant=True)
def build_file(app: Sphinx, content: str) -> tuple[str, d... |
# coding=utf-8
# Copyright 2017 The Tensor2Tensor 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... |
#Your path to the repository JS_Graph_Sage
path_To_Project_Repo = 'Mes Documents/Git'
def _update_JS_Repo(path) :
global path_To_Project_Repo
if path != "1" :
path_To_Project_Repo = str(path)
# #Your path to the repository where you'll save the JSON version of the graphs (for example JS_Graph_Sage/obj)
# path_To_... |
from pathlib import Path
import dash_html_components as html
from .. import WebvizPluginABC
from ..webviz_assets import WEBVIZ_ASSETS
class EmbedPdf(WebvizPluginABC):
"""Embeds a given PDF file into the page.
!> Webviz does not scan your PDF for malicious code. Make sure it comes from a trusted source.
---
* ... |
# Copyright 2018 The TensorFlow Authors. 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 required by applica... |
def parallel_gpu_jobs(allow_growth=True, fraction=.5):
'''Sets the max used memory as a fraction for tensorflow
backend
allow_growth :: True of False
fraction :: a float value (e.g. 0.5 means 4gb out of 8gb)
'''
import keras.backend as K
import tensorflow as tf
from nvidia_info impo... |
##########################################################################
#
# pgAdmin 4 - PostgreSQL Tools
#
# Copyright (C) 2013 - 2020, The pgAdmin Development Team
# This software is released under the PostgreSQL Licence
#
##########################################################################
import json
impor... |
"""
Copyright (c) 2020 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 law or agreed to in wri... |
from sys import platform
import numpy as np
from Agents import *
from Graph import *
from utils import *
from Map import *
from sklearn.neighbors import NearestNeighbors
import matplotlib.pyplot as plt
import matplotlib.patches as mpatches
'''
Authors:
Rahul Sajnani
Amarthya Sasi Kiran
Abhiram Kadiyala
Date: 5th Feb... |
# coding: utf-8
#
# Copyright 2022 :Barry-Thomas-Paul: Moss
#
# 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 applicab... |
from rest_framework.mixins import CreateModelMixin, ListModelMixin, RetrieveModelMixin, UpdateModelMixin
from rest_framework.response import Response
from rest_framework.viewsets import GenericViewSet
from v1.decorators.nodes import is_self_signed_message
from ..models.validator import Validator
from ..serializers.val... |
import requests
from bs4 import BeautifulSoup
import khayyam
import json
import pandas as pd
import re
def req(POSTstr):
headers={
'Host': 'www.time.ir',
'User-Agent':'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:60.0) Gecko/20100101 Firefox/60.0',
'Accept': '*/*',
'Accept-Language':... |
import tempfile
from unittest import TestCase
from datetime import datetime
import shutil
import nexradaws
from nexradaws.resources.localnexradfile import LocalNexradFile
from nexradaws.resources.awsnexradfile import AwsNexradFile
class TestDownloadResults(TestCase):
def setUp(self):
self.query = nexra... |
# Copyright (c) 2013 OpenStack Foundation.
# 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... |
import insert_from_file
def insert():
table = 'purchase_notice_status'
columns = ['code', 'name']
insert_from_file.insert(table, table, columns, columns) |
import pandas as p
d1=p.read_csv("http://pythonhow.com/data/sampledata_x_2.txt")
d2=p. |
#!/usr/bin/env python
from setuptools import setup
VERSION = '1.0.0'
setup(
name='gdsyncpy',
version=VERSION,
description='A simple command-line tool for deduplicating and syncing local and Google Drive '
'folders by their MD5 hashes.',
author='Giuliano Mega',
author_email='giulian... |
# Autodetecting setup.py script for building the Python extensions
import argparse
import importlib._bootstrap
import importlib.machinery
import importlib.util
import logging
import os
import re
import shlex
import sys
import sysconfig
import warnings
from glob import glob, escape
import _osx_support
try:
import... |
from models import *
convert('cfg/yolov3-tiny-1branch-256-quant-thick128-grayscale.cfg', 'weights/last-grayscale.pt')
|
#! /usr/bin/python
# import the necessary packages
import face_recognition
import imutils
import pickle
import cv2
import os
import logging
from collections import Counter
logging.basicConfig(level=os.environ.get("LOGLEVEL", "INFO"))
log = logging.getLogger(__name__)
def analyze_video(video_path):
# Initialize ... |
import logging
from django.db import models
logger = logging.getLogger(name=__name__)
class RoleManager(models.Manager):
def get_by_natural_key(self, label):
return self.get(label=label)
class StoredPermissionManager(models.Manager):
def get_by_natural_key(self, namespace, name):
... |
from distutils.core import setup
setup(name='transport-carbon',
version='0.0.4',
description='Python Transport GHG Emissions',
long_description=open('README.rst').read(),
author='Jamie Bull',
author_email='jamie.bull@oco-carbon.com',
classifiers=['Development Status :: 2 - Pre-Alpha'... |
# Copyright 2006 Joe Wreschnig
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2 as
# published by the Free Software Foundation.
#
# $Id: _util.py 4218 2007-12-02 06:11:20Z piman $
"""Utility classes for Mutagen.
You should not re... |
import torch
import torch.nn.functional as F
from librosa.feature.inverse import mel_to_stft
from librosa.filters import mel as librosa_mel_fn
import numpy as np
from mikuai.speedyspeech.utils.torch_stft import STFT
from mikuai.speedyspeech.functional import pad_batch
from mikuai.speedyspeech.hparam import HPStft as hp... |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2020 CERN.
# Copyright (C) 2020 Northwestern University.
#
# Invenio-RDM-Records is free software; you can redistribute it and/or modify
# it under the terms of the MIT License; see LICENSE file for more details.
"""Test Elasticsearch Mapping."""
import uuid
import pytest
fr... |
# -*- coding: utf-8 -*-
def execute_rule(**kwargs):
sql = kwargs.get("sql")
m = 0
n = 0
sql_content = []
sqlbegin = 0
sqlend = 0
str_len = len(sql)
for k in range(str_len):
if sql[k] == "(":
m = m + 1
if sql[k] == ")":
m = m - 1
if sql[k:... |
'''c. Simular la operación de colas de un Rapipago, que funciona con dos colas diferentes. El usuario llega y se
ubica en la cola de menor cantidad de personas. Al finalizar el proceso indique cuántos elementos tiene cada
cola.'''
from funciones import limpiar_pantalla, muestro_mensaje, hacer_menu
from random import... |
"""
All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
its licensors.
For complete copyright and license terms please see the LICENSE at the root of this
distribution (the "License"). All use of this software is governed by the License,
or, if provided, by the license below or the license... |
# -*- coding: utf-8 -*-
from setuptools import setup, find_packages
with open('requirements.txt') as f:
install_requires = f.read().strip().split('\n')
# get version from __version__ variable in accounting_app/__init__.py
from accounting_app import __version__ as version
setup(
name='accounting_app',
version=vers... |
"""
Rewrite: /spec/functional_specs/analytics_spec.rb
When getting analytics for the number of hits to the service, the number is
equal to the sum of the number of requests made by all applications
When getting analytics for individual applications, the number is equal to
the number of requests send by the applicatio... |
#
# Copyright 2017, Couchbase, 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 required by applicable l... |
import os
import sys
import json
import time
from functools import partial
import numpy as np
# import tensorflow as tf
# from tensorflow.python.framework import function
from tqdm import tqdm
def encode_dataset(*splits, encoder):
encoded_splits = []
for split in splits:
fields = []
for field i... |
import webapp2
import json
from google.appengine.ext import ndb
from datetime import datetime
import logging
DEFAULT_TIME_FORMAT = '%Y-%m-%dT%H:%M:%S.%fZ'
class APIRequest(webapp2.RequestHandler):
def __init__(self, request, response):
# super(APIRequest, self).__init__() # pycharm really wants me to ad... |
"""Tests for the classes from `peregrinus.world.celestial`."""
import unittest
from peregrinus.world import UNITS
from peregrinus.world.celestial import base, binary, planet, star
class PlanetTest(unittest.TestCase):
"""Test case for the class `Planet`."""
def setUp(self: 'PlanetTest') -> None:
"""S... |
import typing
from collections import OrderedDict
from django.core.exceptions import ObjectDoesNotExist
from rest_framework import status
from rest_framework.decorators import action
from rest_framework.pagination import PageNumberPagination
from rest_framework.request import Request
from rest_framework.response impor... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# ---------------------------------------------------------------------
# Copyright (c) Merchise Autrement [~º/~] and Contributors
# All rights reserved.
#
# This is free software; you can do what the LICENCE file allows you to.
#
from xoutil.modules import modulemethod
... |
from flask import Flask, render_template, request, redirect
import pymongo
import os
from bson import ObjectId, json_util
import json
import urllib
from datetime import datetime
app = Flask(__name__)
db = pymongo.MongoClient(os.getenv('MONGOHQ_URL')).heroku_5t0mm7j6
@app.route('/', methods=["GET"])
def write_hajku(... |
from flask import request
from threading import Timer
from app.web.blueprint import web
from flask_login import login_required, current_user
from flask.views import MethodView
from flask import render_template, url_for, current_app, flash
from app.models.gift import GiftModel
from app import db
@web.route('/my/gifts'... |
"""
def BuildBagsOfFeatures (self, Sentences):
self.lp (["-"*80,"-"*80,"-"*80,"-"*20+" BUILDING BAGS OF WORDS "+"-"*30]);
for sentence in Sentences:
# IMPORTANT: There can be some ISOLATED-components (nodes not connected to others) in the graph.
DependencyParseGraph = ... |
# coding=utf-8
# *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union
from .. import _utilitie... |
"""crs module tests"""
import json
import logging
import os
import subprocess
import pytest
import rasterio
from rasterio._crs import _CRS
from rasterio.env import env_ctx_if_needed, Env
from rasterio.enums import WktVersion
from rasterio.errors import CRSError
from .conftest import requires_gdal21, requires_gdal22... |
# Copyright (C) 2020 GreenWaves Technologies, SAS
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
# This progr... |
# Generated by Django 2.1.4 on 2020-04-11 12:19
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
import django.utils.timezone
class Migration(migrations.Migration):
initial = True
dependencies = [
migrations.swappable_dependency(settings.AUT... |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.20 on 2019-06-02 23:38
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('FlightBooking', '0005_auto_20170404_1208'),
]
ope... |
from mongoengine import *
class Config(Document):
meta = {'collection': 'config'}
key = StringField(required=True)
value = StringField(required=True)
default = StringField(required=True)
@staticmethod
def create(key, value, default):
try:
Config.objects.get(key=key)
... |
#!/usr/bin/env python3
# SPDX-FileCopyrightText: 2009 Fermi Research Alliance, LLC
# SPDX-License-Identifier: Apache-2.0
"""
Project:
glideinWMS
Description:
unit test for subclasses of DictFileTwoKeys in
glideinwms/creation/lib/cWDictFile.py
Author:
Dennis Box dbox@fnal.gov
"""
import unittest
imp... |
"""Plugin package for NenuFAR beam-models"""
__version__ = '0.1'
|
from copy import copy
import math
import torch
from torch import nn
import unittest
from time import time
import numpy as np
try:
import apex.amp as amp
from apex.amp import half_function
except (ModuleNotFoundError, ImportError) as e:
amp = None
from ..optimized.compat import half_function
try:
... |
from copy import deepcopy
from django.db import transaction
from democracy.enums import InitialSectionType
from democracy.models import SectionType
def _copy_translations(new_obj, old_obj):
for old_translation in old_obj.translations.all():
translation = deepcopy(old_translation)
translation.pk... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# SPDX-License-Identifier: Apache-2.0
# SPDX-FileCopyrightText: © 2021 Massachusetts Institute of Technology.
# SPDX-FileCopyrightText: © 2021 Lee McCuller <mcculler@mit.edu>
# NOTICE: authors should document their contributions in concisely in NOTICE
# with details inline ... |
from .attr import Attr
from .attr_proxy import AttrProxy
from .keyed import KeyedList, KeyedSet
from .missing import MISSING
from .spec_property import spec_property
from .validated import ValidatedType, bounded, validated
__all__ = (
"Attr",
"AttrProxy",
"KeyedList",
"KeyedSet",
"MISSING",
"Va... |
# -*- coding: utf-8 -*-
# ---
# jupyter:
# jupytext:
# text_representation:
# extension: .py
# format_name: percent
# format_version: '1.3'
# jupytext_version: 1.11.5
# kernelspec:
# display_name: Python 3
# name: python3
# ---
# %% [markdown]
# # 📝 Exercise M1.01
# %% [markdo... |
"""
Module representing the Meta-Learners, containing an Ensemble of Base-Learners
"""
import numpy as np
from sklearn import metrics
import warnings
from abc import abstractmethod
from sklearn.ensemble import RandomForestRegressor
import os
import joblib
import glob
from deepstack.base import Member
from tensorflow.ke... |
import mock
from twisted.trial import unittest
from oppy.util import exitrequest
class ExitRequestTest(unittest.TestCase):
def test_ExitRequest_addr_ipv4(self):
er = exitrequest.ExitRequest('\x00\x00', addr='\x7f\x00\x00\x01')
self.assertTrue(er.is_ipv4)
self.assertFalse(er.is_ipv6)
... |
# -*- coding: utf-8 -*-
"""
Created on Wed Dec 18 22:16:19 2019
@author: Utilisateur
"""
from noiseplanet.matcher.model.leuven import match_leuven
from noiseplanet.matcher.model.nearest import match_nearest_edge
from noiseplanet.matcher.model.route import graph_from_track, route_from_track
|
"""
Created on Sat Jun 6
@author: koeifans
"""
from main import User
from superuser import SuperUser
def main():
user = User('John', 'password', 'john@some.come', '12/25/1999')
print(user.username)
print(user.password)
print(user)
print()
print(repr(user))
user2 = User("John", "passwor... |
# Copyright (c) 2021-2022, NVIDIA CORPORATION. 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 required by ... |
# -*- coding: utf-8 -*-
# Copyright 2013-2014, Simon Kennedy, sffjunkie+code@gmail.com
#
# Part of 'hiss' the asynchronous notification library
import os
import sys
sys.path.insert(0,
os.path.abspath(os.path.join(os.path.dirname(__file__), '..')))
import pytest
pytestmark = pytest.mark.skipif(True, re... |
import base64
import os
import re
import abc
import json
import time
import shlex
import hashlib
import tempfile
import subprocess
import asyncio
from typing import Tuple
from functools import lru_cache
input_file_regex = re.compile(r'''(\{)(infile-[\w\.\-\d]+)(\})''')
output_file_regex = re.compile(r'''(\{)(outfile-... |
import sys
import os
import re
import gc
import logging
from datetime import datetime
from typing import List, Any, Optional, Dict
import httplib2 # type: ignore[import]
import xlrd # type: ignore[import]
import yaml
import git # type: ignore[import]
from googleapiclient import discovery # type: ignore[import]
fro... |
#!/usr/bin/env python
import argparse
import logging
import os.path
import re
import string
import botocore
from opinel.utils.console import configPrintException
from opinel.utils.credentials import get_profiles_from_aws_credentials_file, aws_config_file
import aws_inventory.config
import aws_inventory.blacklist
imp... |
from PIL import Image
import pytesseract
import nltk.data
import re
from newspaper import Article
from googlesearch import search
def google_search(query): # function to google querys
search_urls = []
for i in search(query, tld='com',num= 1, start= 1, stop= 1):
search_urls.append(i)
return sea... |
from base64 import b64encode
import uuid
print b64encode(uuid.uuid4().bytes+uuid.uuid4().bytes) |
# Copyright (c) 2018 PaddlePaddle Authors. 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 required by app... |
# Copyright (c) 2017 Cloudbase Solutions Srl
#
# 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 ... |
# orm/strategies.py
# Copyright (C) 2005-2020 the SQLAlchemy authors and contributors
# <see AUTHORS file>
#
# This module is part of SQLAlchemy and is released under
# the MIT License: http://www.opensource.org/licenses/mit-license.php
"""sqlalchemy.orm.interfaces.LoaderStrategy
implementations, and related Mapper... |
"""
Various bayesian regression
"""
from __future__ import print_function
# Authors: V. Michel, F. Pedregosa, A. Gramfort
# License: BSD 3 clause
from math import log
import numpy as np
from scipy import linalg
from .base import LinearModel
from ..base import RegressorMixin
from ..utils.extmath import fast_logdet, p... |
from ub.events import javes05
from ub import CMD_HELP, bot as javes, LOGS, CLEAN_WELCOME, BOTLOG_CHATID, JAVES_NAME
from ub.javes_main.commands import rekcah05
from telethon.events import ChatAction
JAVES_NNAME = str(JAVES_NAME) if JAVES_NAME else str(JAVES_MSG)
@javes.on(ChatAction)
async def welcome_to_chat(event):
... |
from dataclasses import dataclass, field
from enum import Enum
from typing import Any, Dict, FrozenSet, List, Optional, Set, Tuple, Union
from unittest import TestCase
from dataclass_factory import parse
@dataclass
class D:
a: int
b: int = field(init=False, default=1)
c: str = "def_value"
class E(Enum)... |
import itertools
import sys
#import urlparse
from datetime import datetime, timedelta
from urllib.parse import urljoin, urlparse, urlsplit
import os
import re
import pickle
import zlib
from urllib.request import Request, urlopen, urlretrieve
from urllib.error import HTTPError
from urllib.error import URLError
from b... |
import os
import sys
import argparse
import subprocess
parser = argparse.ArgumentParser(description="print commands that set up the cosmosis env")
cosmosis_src_dir = os.path.split(__file__)[0]
parser.add_argument("--source", default=cosmosis_src_dir)
parser.add_argument("--no-omp", action='store_false', dest='omp', he... |
#
# Copyright (c) 2008-2015 Thierry Florac <tflorac AT ulthar.net>
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRAN... |
from graphene import ObjectType, relay
from cookbook.ingredients.models import Category, Ingredient
from graphene_django.filter import DjangoFilterConnectionField
from graphene_django.types import DjangoObjectType
class CategoryNode(DjangoObjectType):
class Meta:
model = Category
filter_fields = ... |
# -*- coding: utf-8 -*-
{
'name': "cowin_hr",
'summary': """
Short (1 phrase/line) summary of the module's purpose, used as
subtitle on modules listing or apps.openerp.com""",
'description': """
Long description of module's purpose
""",
'author': "My Company",
'website... |
import test_v1
import os
from common.connections import ContrailConnections
from vm_test import VMFixture
from vn_test import VNFixture
from common.openstack_libs import ks_client as ksclient
from vnc_api.vnc_api import *
from keystone_tests import KeystoneCommands
class BaseMultitenancyTest(test_v1.BaseTestCase_v1):
... |
import cv2
import base as bs
import numpy as np
def emboss_filter(img, K_size=3, sigma=1.3):
if len(img.shape) == 3:
H, W, C = img.shape
else:
img = np.expand_dims(img, axis=-1)
H, W, C = img.shape
##padding
pad = K_size // 2
out = np.zeros((H + pad * 2, W + pad * 2, C... |
#encoding: utf-8
class Bragi():
def __init__(self):
print('Bragi constructor') |
# -*- coding: iso-8859-1 -*-
"""
MoinMoin - dummy migration terminator script
This must be the last migration script.
@copyright: 2008 by Thomas Waldmann
@license: GNU GPL, see COPYING for details.
"""
def execute(script, data_dir, rev):
return None
|
import os
import math
import re
import tempfile
from shutil import copyfile, rmtree, copy
from pprint import pprint, pformat
# from rich import print
from rich.panel import Panel
from rich.table import Table, box
from rich.console import Console
# from fabsim.base.utils import add_prefix, print_prefix
from fabsim.bas... |
"""
Zoom.
Move the cursor over the image to alter its position. Click and press
the mouse to zoom. This program displays a series of lines with their
heights corresponding to a color value read from an image.
"""
img = loadImage("ystone08.jpg")
imgPixels = [[0] * img.width for _ in range(img.height)]
scaleVal = 1.0
nm... |
import tensorflow as tf
from layers import BiLSTM
class Encoder(object):
def __init__(self, hidden_units, output_keep_prob, input_keep_prob,
state_keep_prob, n_layers=1, seed=3435):
self.hidden_units = hidden_units
self.seed = seed
self.output_keep_prob = output_keep_prob... |
import os
from django.template import TemplateDoesNotExist
from django.template.loaders import filesystem, app_directories
from hamlpy import hamlpy
from djaml.utils import get_django_template_loaders
def get_haml_loader(loader):
if hasattr(loader, 'Loader'):
baseclass = loader.Loader
else:
... |
#
# If you're here looking for usage examples, look elsewhere (bin/ktool is better)
# these test cases are just to make sure things work at a bare minimum, no good code to be found here,
# and there's a solid chance i'm doing something improperly out of sheer laziness
#
import os
import sys
import unittest
... |
from .path import DNENode, DummyNode
from .request import Request, DummyRequest
from .response import Response, TextResponse, StaticResponse
from .error import NotResponseError, NoResponseReturnedError, NoMethodError, ResponseError
from .view import View
from queue import Empty as QueueEmpty
import asyncio
class Asgi... |
# -*- coding: utf-8 -*-
"""
Created on Mon Dec 26 19:41:16 2016
@author: yxl
"""
from imagepy.core.engine import Free
from imagepy.core.manager import ImageManager, TextLogManager, \
TableManager, WindowsManager, WTableManager
class ImageKiller(Free):
"""ImageKiller: derived from imagepy.core.engine.Free"""
... |
#!/usr/bin/env python3
"""A module containing the base classes for RADAR.
Classes corresponding to the project, participant, and data
"""
from collections.abc import MutableMapping, KeysView, ItemsView, ValuesView
from datetime import datetime
from fsspec import filesystem
from fsspec.utils import infer_storage_option... |
#!/usr/bin/env python
""" Adobe character mapping (CMap) support.
CMaps provide the mapping between character codes and Unicode
code-points to character ids (CIDs).
More information is available on the Adobe website:
http://opensource.adobe.com/wiki/display/cmap/CMap+Resources
"""
import sys
import os
import os... |
# This script downloads and prepares the 20 newsgroups dataset.
# It also samples a specified subset of the dataset in order to keep the repository size small.
#
# It is provided for reproducibility and for running larger samples.
# A small prepared and sampled dataset is already provided.
import argparse
import csv
i... |
import difflib
from test.test_support import run_unittest, findfile
import unittest
import doctest
import sys
class TestWithAscii(unittest.TestCase):
def test_one_insert(self):
sm = difflib.SequenceMatcher(None, 'b' * 100, 'a' + 'b' * 100)
self.assertAlmostEqual(sm.ratio(), 0.995, places=3)
... |
from django.shortcuts import render
from django_filters.rest_framework import DjangoFilterBackend
from rest_framework import views, viewsets
from rest_framework.decorators import api_view
from rest_framework.response import Response
# Create your views here.
from .models import Appointment, SchedulerAppointment, Appoi... |
import os
import sys
def get_max_bp(seats):
# print(seats)
return max(seats)
def find_missing(seats):
seats.sort()
for idx, num in enumerate(seats):
if num - seats[0] != idx:
return num - 1
return seats[-1] + 1
def get_seat_id(bp):
seat = ['0' if letter in ['F', ... |
# USANDO A ESTRUTURA CONDICIONAL ANINHADA IF, ELIF E ELSE
# ESTOU USANDO UM EXEMPLO INVENTADO POR MIM MESMO E NÃO O EXEMPLO DEMONSTRADO PELO PROFESSOR
estado = input('Digite o nome do Estado em que você mora: ').strip()
uf = estado.upper()
if (uf == 'PE') or (uf =='PB') or (uf =='AL') or (uf =='BA') or (uf =='CE') or (... |
def num_sum():
n= [1, 2, 3, 4, 5]
sum=0
i=0
while i<len(n):
sum=sum+n[i]
i=i+1
print(sum)
num_sum() |
import datetime
import os
import subprocess
import sys
import warnings
from typing import Optional, Union
import click
from ruamel.yaml import YAML
from ruamel.yaml.compat import StringIO
from great_expectations import exceptions as ge_exceptions
from great_expectations.checkpoint import Checkpoint, LegacyCheckpoint
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.