text stringlengths 1 927k |
|---|
#!/usr/bin/python
#
# 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, software
# ... |
################################################################################
# Copyright 2019 Noblis, Inc #
# #
# Licensed under the Apache License, Version 2.0 (the "License"); ... |
# -*- coding: utf-8 -*-
#
# michael a.g. aïvázis
# orthologue
# (c) 1998-2022 all rights reserved
#
from .Descriptor import Descriptor
class ElementDescriptor(Descriptor):
"""
Descriptor class that gathers all the metadata about a document tag that was provided by
the user during the DTD declaration. It... |
from os.path import join
from ...utils import get_test_data_path
from pliers.extractors import ClarifaiAPIExtractor
from pliers.stimuli import ImageStim
from pliers.extractors.base import merge_results
import numpy as np
import pytest
@pytest.mark.skipif("'CLARIFAI_API_KEY' not in os.environ")
def test_clarifai_api_e... |
# Copyright 2020-2021 OpenDR European Project
#
# 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 agree... |
# encoding=utf-8
# Author: Yu-Lun Chiang
# Description: Test NewsCrawler
import logging
import pytest
from collections import namedtuple
from src.crawler.media import bcc
from src.utils.struct import NewsStruct
logger = logging.getLogger(__name__)
TEST_DATA = namedtuple(
typename="TEST_DATA",
field_names=[
... |
import sys
def get_digits_ignore_zero(x):
digits = {}
for digit in str(x):
if digit == '0':
continue
if digit in digits:
digits[digit] += 1
else:
digits[digit] = 1
return digits
def following_integer(x):
original_digits = get_digits_ignore_ze... |
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
from selenium.webdriver.common.by import By
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.support.ui import WebDriverWait
from selenium.common.exceptions import NoAlertPresentException
import... |
"""
ASGI config for Assignment project.
It exposes the ASGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/4.0/howto/deployment/asgi/
"""
import os
from django.core.asgi import get_asgi_application
os.environ.setdefault('DJANGO_SE... |
#!/usr/bin/python
"""
MIT License
Copyright (c) 2017 5kyc0d3r
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, m... |
r"""
Derivations
Let `A` be a ring and `B` be an bimodule over `A`.
A derivation `d : A \to B` is an additive map that satisfies
the Leibniz rule
.. MATH::
d(xy) = x d(y) + d(x) y.
If `B` is an algebra over `A` and if we are given in addition a
ring homomorphism `\theta : A \to B`, a twisted derivation with res... |
#!/usr/bin/env python
#--------------------------------------------------------------
# This is a Enge Function Factory specific for the J-PARC. Some
# Enge's function parameters are defined by the aperture and length,
# and others are defined by the field distribution formula from Trace3D
# documentation.
#---------... |
# 1.装包
# 2.导包
from django.conf import settings
from itsdangerous import TimedJSONWebSignatureSerializer as Serializer
# 3.实例化
# 4.加密解密
class SecretOauth(object):
# 加密
def dumps(self, data):
s = Serializer(secret_key=settings.SECRET_KEY, expires_in=3600)
result = s.dumps(data)
return re... |
import torch
import numpy as np
import SimpleITK as sitk
from Phys_Seg.data_loading import load_and_preprocess, save_segmentation_nifti, read_file, save_img
from Phys_Seg.predict_case import predict_phys_seg, physics_preprocessing, image_preprocessing
import importlib
from Phys_Seg.utils import postprocess_prediction, ... |
import struct
from collections import namedtuple
from StringIO import StringIO
# Magic string expected at the start of the file to verify it's LZO
_LZO_MAGIC = bytearray("\x89LZO\x00\r\n\x1a\n")
_COMPRESSION_CHECKSUMS = (0x02, 0x200) # ADLER32 CRC32
_DECOMPRESSION_CHECKSUMS = (0x01, 0x100) # ADLER32 CRC32
def _pa... |
from ..utils.formats import flatten_dict
DENYLIST_ENDPOINT = ['kms', 'sts']
DENYLIST_ENDPOINT_TAGS = {
's3': ['params.Body'],
}
def truncate_arg_value(value, max_len=1024):
"""Truncate values which are bytes and greater than `max_len`.
Useful for parameters like 'Body' in `put_object` operations.
""... |
import math
#compute primes using list difference
#from http://www.secnetix.de/olli/Python/list_comprehensions.hawk
noprimes = [j for i in range(2, 8) for j in range(i*2, 50, i)]
difference = [x for x in range(2, 50) if x not in noprimes]
# print(difference)
#my own version, a little more complicated
primes = [x for ... |
from django.conf import settings
from django.utils import translation
import jingo
import pytest
from mock import Mock, patch
from nose.tools import eq_
import amo
import amo.tests
from addons.models import Addon
from translations import helpers
from translations.fields import save_signal
from translations.models imp... |
# Copyright (c) Twisted Matrix Laboratories.
# See LICENSE for details.
"""
Tests for L{twisted.python.text}.
"""
from cStringIO import StringIO
from twisted.trial import unittest
from twisted.python import text
sampleText = \
"""Every attempt to employ mathematical methods in the study of chemical
questions must ... |
from flask import Blueprint
from controllers.show import shows, create_shows, create_show_submission
show_bp = Blueprint('show_bp', __name__)
show_bp.route('/', methods=['GET'])(shows)
show_bp.route('/create', methods=['GET'])(create_shows)
show_bp.route('/create', methods=['POST'])(create_show_submission) |
# Copyright 2011 OpenStack Foundation
#
# 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 a... |
# Copyright 2012 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 requ... |
import random
def name_to_number(name):
if(name=='rock'):
return 0
elif(name=='Spock'):
return 1
elif(name=='paper'):
return 2
elif(name=='lizard'):
return 3
elif(name=='scissors'):
return 4
else:
return name,"is an invalid name"
def number_to_name... |
# 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... |
import numpy as np
from openephys_fileIO.fileIO import *
from openephys_fileIO.Binary import *
def test_write_binary_data():
# Test writing of binary data
dataFolder = 'test/data'
# Read the data in original int16 format
data,headers = load_OpenEphysRecording4BinaryFile(dataFolder,
num_d... |
# encoding: utf-8
import inspect
import functools
import logging
import re
import importlib
import inspect
from collections import defaultdict
from werkzeug.utils import import_string
import six
from six import string_types, text_type
import ckan.model as model
import ckan.authz as authz
import ckan.lib.navl.dictiz... |
r = input("Input radius: ")
diameter, circumference, area = circle_measures(r) |
"""
这份代码使用 Q learning 算法训练并运行俄罗斯方块游戏 ai。其中简化状态空间的方法可参考论文 Adapting Reinforcement Learning to Tetris
"""
import numpy as np
from game import *
sub_well = 4
base = 7
def getStateIndex(field_width, field_height, field_map):
"""
因为每一列有 7 种不同的情况,所以采用七进制数来作为状态索引
"""
temp = [0 for _ in range(field_width)]... |
class VatNumberCheckResult(object):
"""Result of a VAT number validation check.
:ivar is_valid:
Boolean value indicating if the checked VAT number was deemed to be
valid. ``True`` if the VAT number is valid or ``False`` if the VAT
number is positively invalid.
:ivar log_lines:
... |
"""
Author : nkalyan🤠
implementing Python Scripts on reading and returning the name no of mails that sent each day in week
and plot/display them in bar graph
I wrote code In counting to count the number of emails sent by each distinct user. That code may be helpful for this assignment.
"""
import matplotlib.py... |
#!/usr/bin/python3
#https://practice.geeksforgeeks.org/problems/student-record/0
def sol(records, n):
mx = 0
res = []
for ni in range(0, n*4, 4):
am = sum(map(int, records[ni+1:ni+4]))//3
if am > mx:
# If we find a better average overwrite the result list
# with the ... |
from typing import List, Optional
class ComponentFunction:
__slots__ = ('mapped_base', 'virtual_addr', 'symbol_name', )
def __init__(self, mapped_base: int, virtual_addr: int, symbol_name: Optional[str]=None):
self.mapped_base = mapped_base
self.virtual_addr = virtual_addr
self.symbo... |
"""
Training Statics Tools
A class for loading statistics related to a particular rutraiining session.
"""
import numpy as np
#from scipy import stats
import pandas as pd
import os
def str_between(s, start, end):
return (s.split(start))[1].split(end)[0]
def is_stat_file_version(file_name, version):
return f... |
# -*- coding: utf-8 -*-
"""
To connect the power meter you'll need to use the "Power meter driver switcher" application to switch to the PM100D (Ni-Visa) drivers.
Then the resource name should show up when exceuting:
import visa
visa.ResourceManager().list_resources()
"""
from lantz.messagebased import MessageBasedD... |
import codecs
import logging
import pickle
from chemdner_corpus import ChemdnerCorpus
class GproCorpus(ChemdnerCorpus):
"""Chemdner GPRO corpus from BioCreative V"""
def __init__(self, corpusdir, **kwargs):
super(GproCorpus, self).__init__(corpusdir, **kwargs)
self.subtypes = ["NESTED", "IDEN... |
import utils
class Model:
def __init__(self, file_path):
with open(file_path, 'r', encoding="utf8") as model_file:
self.model_tree = {}
for line in model_file:
chars, minus_log_p = utils.parse_model_file_line(line)
n_1_gram = ''.join(chars[:-1])
last_char = chars[-1]
if n_1_gram not in self... |
# Copyright 2018 the V8 project authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
def CheckChangeOnCommit(input_api, output_api):
tests = input_api.canned_checks.GetUnitTestsInDirectory(
input_api, output_api, 'unittests')
retu... |
import itertools
def std_from_mean_kde(data):
"""
Plot the KDE of the pandas series along with vertical
reference lines for each standard deviation from the mean.
Parameters:
- data: pandas Series with numeric data
Returns:
Matplotlib Axes object.
"""
mean_mag, std... |
from django.urls import re_path
from ladder import views
urlpatterns = [
re_path(r'^$', views.index, name='index'),
re_path(r'^list/$', views.list_rounds, name='list'),
re_path(r'^current/$', views.current_season_redirect, name='current'),
# ex: /2013/round/1/
re_path(r'^(?P<year>\d+)/round/(?P<se... |
import sys
import sqlite3
import hashlib
import time
import logging
import os.path
logger = logging.getLogger(__name__)
logpath = os.path.dirname(__file__)
logpath = os.path.join(logpath, 'logs/')
fileHandler = logging.FileHandler(logpath + __name__ + '.log')
formatter = logging.Formatter('%(asctime)s - %(name)s - %(... |
from moto.swf.models import GenericType
import sure # noqa # pylint: disable=unused-import
# Tests for GenericType (ActivityType, WorkflowType)
class FooType(GenericType):
@property
def kind(self):
return "foo"
@property
def _configuration_keys(self):
return ["justAnExampleTimeout"]
... |
#### NOTICE: THIS FILE IS AUTOGENERATED
#### MODIFICATIONS MAY BE LOST IF DONE IMPROPERLY
#### PLEASE SEE THE ONLINE DOCUMENTATION FOR EXAMPLES
from swgpy.object import *
def create(kernel):
result = Creature()
result.template = "object/mobile/shared_r2_space.iff"
result.attribute_template_id = 9
result.stfName... |
import os
from pathlib import Path
import unittest
import json
from starlette.testclient import TestClient
from ml_base.utilities import ModelManager
os.chdir(Path(__file__).resolve().parent.parent.parent)
os.environ["REST_CONFIG"] = "examples/rest_config.yaml"
from rest_model_service.main import app, create_app
fro... |
from argparse import Namespace
from textwrap import dedent
import pytest
from inverted_index import InvertedIndex
from inverted_index import build_inverted_index
from inverted_index import DEFAULT_INVERTED_INDEX_SAVE_PATH
from inverted_index import callback_query, process_queries
from inverted_index import callback_b... |
# coding: utf-8
"""
Pure Storage FlashBlade REST 1.6 Python SDK
Pure Storage FlashBlade REST 1.6 Python SDK, developed by [Pure Storage, Inc](http://www.purestorage.com/). Documentations can be found at [purity-fb.readthedocs.io](http://purity-fb.readthedocs.io/).
OpenAPI spec version: 1.6
Contact: i... |
from django.template import Template, Context
from django.utils.deprecation import MiddlewareMixin
from django.conf import settings
from django.db.models import Q
from django.urls import reverse, NoReverseMatch
from django.core.exceptions import ObjectDoesNotExist
from .signals import page_found, page_not_found, page_... |
# Copyright (c) 2020 Carnegie Mellon University
#
# 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, ... |
import pytest
class InvalidCharacterNameError(Exception):
pass
class InvalidClassNameError(Exception):
pass
class Character:
pass
VALID_CLASSES = ["sorcerer", "warrior"]
def create_character(name: str, class_name: str) -> Character:
"""
Creates a new character and inserts it into the datab... |
"""plantara URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/3.2/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: path('', views.home, name='home')
Class-base... |
import logging
from six import string_types
from traitlets import Bool
from traitlets.config.configurable import Configurable
from ipypublish.utils import handle_error, pathlib
try:
from shutil import which as exe_exists
except ImportError:
from distutils.spawn import find_executable as exe_exists # noqa: F... |
#!/usr/bin/env python
# Copyright 2011 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... |
import sublime
import sublime_plugin
import re
completions = []
def plugin_loaded():
init_settings()
def init_settings():
get_settings()
sublime.load_settings('img-placeholder.sublime-settings').add_on_change('get_settings', get_settings)
def get_settings():
settings = sublime.load_settings('img-pla... |
import hashlib
import os
import sys
import shutil
import tempfile
import filecmp
import datetime
import stat
import time
import urllib
from util.util import *
import functools
# FancyURLopener is incorrectly documented; this working handler was
# copied from
# https://mail.python.org/pipermail/python-bugs-list/2006-F... |
"""Тест."""
import unittest
from recipes import form_answer
from database import delete_table_data
from parsing import NEWS, AFISHA, HOROSCOPE, WEATHER
class TestBot(unittest.TestCase):
"""Тест."""
def test_form_answer(self):
"""Тест."""
rec1 = {"name": "Булочки с изюмом",
"in... |
#!/usr/bin/python -u
#
# Setup script for libxml2 and libxslt if found
#
import sys, os
from distutils.core import setup, Extension
# Below ROOT, we expect to find include, include/libxml2, lib and bin.
# On *nix, it is not needed (but should not harm),
# on Windows, it is set by configure.js.
ROOT = r'/Users/emsommer... |
from __future__ import division
from __future__ import absolute_import
from builtins import str
from builtins import range
from builtins import object
from past.utils import old_div
#================================================================================
# Marion Neumann [marion dot neumann at uni-bonn dot ... |
# Lint as: python2, python3
# Copyright 2019 Google LLC. 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 req... |
#####################################################################################
#
# Copyright (c) Microsoft Corporation. All rights reserved.
#
# This source code is subject to terms and conditions of the Apache License, Version 2.0. A
# copy of the license can be found in the License.html file at the root of t... |
# Generated by Django 3.1.2 on 2021-05-31 14:45
import datetime
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('abastece', '0005_auto_20210528_1946'),
]
operations = [
migrations.AlterField(
model_name='pedido',
... |
# Copyright 2015 Google 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 law or ag... |
import sys
import os
import shutil
import cv2
import open3d as o3d
import open3d.core as o3c
import numpy as np
from rendering.pytorch3d_renderer import PyTorch3DRenderer
from data import StandaloneFrameDataset
import data.presets as presets
import tsdf.default_voxel_grid
import data.camera
from settings import proce... |
def rotate_counterclockwise(array_2d):
list_of_tuples = zip(*array_2d[::])
return [list(elem) for elem in list_of_tuples]
def rotate_clockwise(array_2d):
"""
Code copied by: https://stackoverflow.com/a/48444999/3753724
"""
list_of_tuples = zip(*array_2d[::-1])
return [list(elem) for elem in... |
# 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, overload
from .. import... |
import pygame, sys
from pygame.locals import *
import random
#### GAME SETUP ######
pygame.init()
FPS = 60
FramePerSec = pygame.time.Clock()
# Defining game constants
RED = (255, 0, 0)
WHITE = (255, 255, 255)
SCREEN_WIDTH = 400
SCREEN_HEIGHT = 600
GAME_NAME = "Dodge The Enemy"
SCORE = 0
# Creating the main surfa... |
import os
from load_data import load_batch, load_data_names, load_batch_from_names, load_batch_from_names_random
from my_model import get_eye_tracker_model
import numpy as np
from keras.models import load_model
from keras.optimizers import SGD, adam
def generator(data, batch_size, img_cols, img_rows, img_ch):
whi... |
# coding=utf-8
"""
Uses /proc/mounts and os.statvfs() to get disk space usage
#### Dependencies
* /proc/mounts
#### Examples
# no exclude filters at all
exclude_filters =,
# exclude everything that begins /boot or /mnt
exclude_filters = ^/boot, ^/mnt
# exclude everything that includes the le... |
from typing import Any, List
from fastapi import APIRouter, Depends, HTTPException
from sqlalchemy.orm import Session
from app import models, schemas, services
from app.api import deps
router = APIRouter()
@router.get("/", response_model=List[schemas.User])
def read_users(
db: Session = Depends(deps.get_db),
... |
from django.conf.urls import include, url
from django.http import HttpResponse
from app import views
urlpatterns = [
url(r'^verify', views.verify_receipt),
url('verify/scum', views.verify_receipt_scum),
url('verify/jellycuts', views.verify_receipt_jelly),
] |
# -*- coding: utf-8 -*-
# Copyright © 2013-2014 Udo Spallek, Roberto Alsina and others.
# 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
#... |
"""Module for summarizing cargo planning testing results.
Ed Polanco
ed.polanco@outlook.com
"""
import pandas as pd
from collections import OrderedDict
import datetime
import time
from aimacode.search import Problem, Node
from timeit import default_timer as timer
from run_search import PrintableProblem, PROBL... |
import torch.nn as nn
import torch.nn.functional as F
from . import register_nas_estimator
from ..space import BaseSpace
from .base import BaseEstimator
@register_nas_estimator("oneshot")
class OneShotEstimator(BaseEstimator):
"""
One shot estimator.
Use model directly to get estimations.
"""
d... |
# 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.
import logging
from typing import Any, List
import torch.nn as nn
from vissl.utils.misc import is_apex_available
_CONV_TYPES = (nn.Conv1d, n... |
# Copyright (C) 2017 Google Inc.
# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>
"""Add non-adjusted next cycle start date
Revision ID: 44047daa31a9
Revises: 1431e7094e26
Create Date: 2015-07-07 14:31:27.780564
"""
# Workaround legacy code which blocks Workflow new attribute addition
... |
# -*- coding: utf-8 -*-
# Copyright (c) 2020. Distributed under the terms of the MIT License.
from dataclasses import dataclass
from math import sqrt, pi
from typing import List
import numpy as np
from monty.json import MSONable
from tqdm import tqdm
from vise.util.mix_in import ToJsonFileMixIn
from scipy.constants i... |
# Recomendação : Use apenas se seu computador/celular for bom.
# Autor : Kiny
# Pix : (61) 9603-5417
# Github : https://github.com/Kiny-Kiny
# WhatsApp : http://wa.me/552179180533
# Telegram : @K_iny
# Instagram : @parziovanni
# Twitter : @KinyBruno
################################... |
import unittest
import re
import time
from JumpScale import j
try:
import ujson as json
except:
import json
import random
descr = """
basic functioning of osis (test set)
"""
organization = "jumpscale"
author = "incubaid"
license = "bsd"
version = "1.0"
category = "osis.basic.testset"
enable=True
priority=1
s... |
from AppVars import AppVars
from AppResources import AppResources |
#!/usr/bin/env python3
# Copyright (c) 2017 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test ysw-cli"""
from test_framework.test_framework import YieldSakingWalletTestFramework
from test_framework... |
# -*- coding: utf-8 -*-
from cmscloud.template_api import registry
from django.conf import settings
def get_meta_version(max_version):
max_version = int(max_version)
assert 6 <= max_version <= 9
if max_version == 9:
return '1'
else:
return 'IE%d' % (max_version, )
META_TAG = '<meta ht... |
# coding: UTF-8
from .callback import Hook, Callback
from .checkpoint import ModelCheckPoint
from .csvlogger import CSVLogger
from .early_stopping import EarlyStopping
from .lr_scheduler import (
LambdaLR, StepLR, MultiStepLR, ExponentialLR, ReduceLROnPlateau)
from .tensorboard_logger import TensorBoardLogger
__a... |
# -*- coding: utf-8 -*-
from app import app ... |
import numpy as np
import torch
import torch.nn as nn
from retinanet.config_experiment_2 import INDEXES_MIX, VEHICLE_INDEXES
def calc_iou(a, b):
area = (b[:, 2] - b[:, 0]) * (b[:, 3] - b[:, 1])
iw = torch.min(torch.unsqueeze(a[:, 2], dim=1), b[:, 2]) - torch.max(torch.unsqueeze(a[:, 0], 1), b[:, 0])
ih = ... |
# coding: utf-8
"""
Kubernetes
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) # noqa: E501
OpenAPI spec version: v1.14.7
Generated by: https://openapi-generator.tech
"""
from __future__ import absolute_import
import unittest
import kube... |
from flask import Flask
from flask import jsonify
from flask import render_template
from flask import request
import os, base64, uuid
from twilio.twiml.voice_response import VoiceResponse, Gather, Dial
from twilio.rest import Client
# Declare and configure application
app = Flask(__name__, static_url_path='/static')
... |
list_x = [1,2,3,4,5,6,7,8]
def square(x):
return x*x
# for x in list_x:
# square(x)
r = map(square,list_x)
print(list(r)) |
#! /opt/spark/bin/pyspark
import re
from pathlib import Path
INPUT_TXT = "~/uol-ds-tools/pyspark-utils/frankenstein.txt"
myfile = Path(INPUT_TXT).expanduser().absolute()
rdd_txt = sc.textFile(f"file:///{myfile}")
# Simple word counts splitting on whitespace
counts = (
rdd_txt.flatMap(lambda line: line.split())... |
"""
ASGI config for simpleblog project.
It exposes the ASGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/3.1/howto/deployment/asgi/
"""
import os
from django.core.asgi import get_asgi_application
os.environ.setdefault('DJANGO_SE... |
# Keypirinha launcher (keypirinha.com)
import socket
import keypirinha as kp
import keypirinha_net as kpnet
import keypirinha_util as kpu
class MyIP(kp.Plugin):
"""
Get your public and local IP directly from Keypirinha.
"""
ITEM_CAT = kp.ItemCategory.USER_BASE + 1
KEYWORD = 'ip'
def __init... |
# PyTorch StudioGAN: https://github.com/POSTECH-CVLab/PyTorch-StudioGAN
# The MIT License (MIT)
# See license file or visit https://github.com/POSTECH-CVLab/PyTorch-StudioGAN for details
# src/main.py
import json
import os
import sys
import random
import warnings
from argparse import ArgumentParser
from utils.misc ... |
#!/usr/bin/env python
#
# __COPYRIGHT__
#
# 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, publish,
... |
from __future__ import print_function
import os
from cmd3.console import Console
from cmd3.shell import command
from cloudmesh_numpy.command_numpy import command_numpy
class cm_shell_numpy:
def activate_cm_shell_numpy(self):
self.register_command_topic('mycommands', 'numpy')
@command
def do_num... |
# -*- coding: utf-8 -*-
# PLEASE DO NOT EDIT THIS FILE, IT IS GENERATED AND WILL BE OVERWRITTEN:
# https://github.com/anyex/anyex/blob/master/CONTRIBUTING.md#how-to-contribute-code
from anyex.base.exchange import Exchange
from anyex.base.errors import ExchangeError
from anyex.base.errors import AuthenticationError
fr... |
# Always prefer setuptools over distutils
from setuptools import setup
# To use a consistent encoding
from codecs import open
from os import path
import re
here = path.abspath(path.dirname(__file__))
# get the long description from the readme file
with open(path.join(here, 'README.md'), encoding='utf-8') as f:
l... |
from .JWTAuthenticationMiddleware import JWTAuthenticationMiddleware |
from .gfpgan import * |
import re
from django.db.models import Q
from django.utils.translation import ugettext_lazy as _
from rest_framework.exceptions import APIException
from rest_framework.response import Response
from rest_framework.views import APIView
from leasing.models import Contact
from leasing.permissions import PerMethodPermissi... |
# Lint as: python2, python3
# 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
#
... |
import os
from twilio.rest import Client
#import twilioConfig from one folder up and inside Config_Files folder
import sys
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
try:
from Config_Files import twilioConfig
except ImportError:
from Config_Files import twilioConfig_default as... |
import unittest
import mock
from stacker.context import Context
from stacker.exceptions import ImproperlyConfigured
from stacker.plan import (
Step,
Plan,
)
from stacker.status import (
COMPLETE,
SKIPPED,
SUBMITTED,
)
from stacker.stack import Stack
from .factories import generate_definition
cou... |
import html2text
import pandas as pd
from wasabi import Printer
from parseepo import validate
from parseepo.exception import SingleAttrException
from parseepo.utils import prepare_name
h = html2text.HTML2Text()
msg = Printer()
NAMES = ["EP", "Num", "Ext", "publication_date", "language", "attr", "text"]
NESTED_ATTR = ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.