text stringlengths 2 999k |
|---|
# Creating an application
# there is a folder name ... new folder1...where audios,videos,images are there
# so you have to keep it in separate folders
import os, shutil
# NOTE --> you can write every single extension inside tuples(becuz we don't want to change the values)
dict_extensions = {
'audio_extensi... |
from .encoding import Encoding
from .wrappers import Upsample, resize
__all__ = [
'Upsample',
'resize',
'Encoding',
]
|
# coding: utf-8
# /*##########################################################################
# Copyright (C) 2016-2021 European Synchrotron Radiation Facility
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to dea... |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.4 on 2018-01-11 20:31
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('crm', '0017_auto_20180111_2022'),
]
operations = [
migrations.AlterModelOptions(
... |
# Copyright (C) 2010-2018 Apple Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and ... |
import os
from getpass import getpass
from telethon import TelegramClient, ConnectionMode
from telethon.errors import SessionPasswordNeededError
from telethon.tl.types import (
UpdateShortChatMessage, UpdateShortMessage, PeerChat
)
from telethon.utils import get_display_name
def sprint(string, *args, **kwargs):
... |
"""
The point cloud that has the largest number of points
"""
import numpy as np
import torch
import glob
import os
import sys
scannet_dir = "/home/dtc/Backup/Data/ScanNet"
# path to pth
original_dir = os.path.join(scannet_dir, "Pth/Original")
pth_files = glob.glob(os.path.join(original_dir, "*.pth"))
n_points... |
#!/usr/bin/env python
"""Django's command-line utility for administrative tasks."""
import os
import sys
def main():
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'weeklyemailapp_1.settings')
try:
from django.core.management import execute_from_command_line
except ImportError as exc:
rai... |
#!/usr/bin/env python
# Copyright 2014-2015 RethinkDB, all rights reserved.
import itertools, os, sys, time
try:
xrange
except NameError:
xrange = range
sys.path.append(os.path.join(os.path.dirname(__file__), os.path.pardir, 'common'))
import rdb_unittest, utils
# ---
class SquashBase(rdb_unittest.RdbTestC... |
#!/usr/bin/env python3
# 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.
"""
Basic example which iterates through the tasks specified and checks them for offensive
language.
Examples
--------
... |
import _plotly_utils.basevalidators
class MarkerValidator(_plotly_utils.basevalidators.CompoundValidator):
def __init__(self, plotly_name="marker", parent_name="splom", **kwargs):
super(MarkerValidator, self).__init__(
plotly_name=plotly_name,
parent_name=parent_name,
d... |
# ----------------------------------------------------------------------------
# Copyright (c) 2020, Meta-Storms development team.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file LICENSE, distributed with this software.
# -------------------------------------------------... |
from django.db import models
class Item(models.Model):
text = models.TextField(blank=False, null=False)
date_posted = models.DateField(auto_now=True)
def __str__(self): # __unicode__ for Python 2
return "item" |
from .feature_extract import FeatureExtractor
from .intra_speaker_dataset import IntraSpeakerDataset, collate_pseudo
from .noise import WavAug
from .preprocess_dataset import PreprocessDataset
from .utils import *
from .VCTK_split import train_valid_test
|
import py
from rpython.rlib.parsing.ebnfparse import parse_ebnf
from rpython.rlib.parsing.regexparse import parse_regex
from rpython.rlib.parsing.lexer import Lexer, DummyLexer
from rpython.rlib.parsing.deterministic import DFA, LexerError
from rpython.rlib.parsing.tree import Nonterminal, Symbol, RPythonVisitor
from r... |
"""
This module will test the start command
"""
import shutil
from pathlib import Path
from controller import colors
from controller.app import Configuration
from controller.deploy.docker import Docker
from tests import (
Capture,
create_project,
exec_command,
execute_outside,
init_project,
pu... |
# Copyright 2020 Spotify AB
#
# 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, so... |
"""
Contains class that generates the 'locality.txt' file for any state.
locality.txt contains the following columns:
election_administration_id,
external_identifier_type,
external_identifier_othertype,
external_identifier_value,
name,
polling_location_ids,
state_id,
type,
other_type,
id
"""
import pandas as pd
imp... |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
import socket
import struct
import logging
from util.compatibility import text_
logger = logging.getLogger('util')
class IPAddresss:
def __init__(self, ipdbFile):
self.ipdb = open(ipdbFile, "rb")
str = self.ipdb.read(8)
(self.firstIndex, se... |
import torch
from torch import optim
import torch.nn as nn
import numpy as np
import logging
from deeprobust.image.attack.base_attack import BaseAttack
from deeprobust.image.utils import onehot_like
from deeprobust.image.optimizer import AdamOptimizer
class CarliniWagner(BaseAttack):
"""
C&W attack is an effe... |
import numpy as np
class LogisticRegression:
def __init__(self, lr=0.001, n_iters = 1000):
self.lr = lr
self.n_iters = n_iters
self.weights = None
self.bias = None
def fit (self, X, y):
n_samples, n_features = X.shape
#... |
"""Change coordinates"""
from numpy import arccos, arctan2, hypot, sqrt
def to_polar(coo_x, coo_y):
"""
r, θ = to_polar(x, y)
Change Cartesian coordinates to Polar coordinates.
Parameters
----------
x : array_like
first Cartesian coordinate
y : array_like
seconde Cartesia... |
##########################################################################
#
# Copyright 2010 Dr D Studios Pty Limited (ACN 127 184 954) (Dr. D Studios),
# its affiliates and/or its licensors.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the foll... |
import heapq
import weakref
import numpy
from chainer import cuda
class Variable(object):
"""Array with a structure to keep track of computation.
Every variable holds a data array of type either :class:`numpy.ndarray` or
:class:`cupy.ndarray`.
A Variable object may be constructed in two ways: by ... |
from __future__ import with_statement
import datetime
import fiscalyear
import pytest
# Fiscal calendars to test
US_FEDERAL = ("previous", 10, 1)
UK_PERSONAL = ("same", 4, 6)
class TestCheckInt(object):
@pytest.mark.parametrize(
"value, exception",
[
("asdf", TypeError),
... |
# -*- coding: utf-8 -*-
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: list_plugin_v1.proto
import sys
_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from google.proto... |
import cv2
import argparse
import os
parser = argparse.ArgumentParser()
parser.add_argument("-i", "--folder", required=True,
help="path to folder containing images")
args = parser.parse_args()
extensions = ('.png','.jpg','.jpeg')
filenames = [file for file in os.listdir(args.folder) if file.lower().endswith(ext... |
# Copyright (c) 2012 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""A StatusReceiver module to mail someone when a step warns/fails.
Since the behavior is very similar to the MailNotifier, we simply inherit from
it an... |
# -*- coding: utf-8 -*-
# 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... |
# coding=utf-8
# Copyright 2020 The Google Research 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 applicab... |
"""Contains SQL Dialects."""
from typing import NamedTuple
from sqlfluff.core.dialects.dialect_ansi import ansi_dialect
from sqlfluff.core.dialects.dialect_bigquery import bigquery_dialect
from sqlfluff.core.dialects.dialect_mysql import mysql_dialect
from sqlfluff.core.dialects.dialect_teradata import teradata_diale... |
# coding=utf-8
# *** WARNING: this file was generated by the Pulumi SDK Generator. ***
# *** 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 _utilities, _tables
from ... |
from frappe import _
def get_data():
return [
{
'module_name': 'Background Verification',
'color': 'grey',
'icon': 'fa fa-star',
'type': 'module',
'label': _('Background Verification'),
'items': [
{
... |
import numpy as np
from ..abstract import Processor
from ..backend.boxes import to_one_hot
class ControlMap(Processor):
"""Controls which inputs are passed ''processor'' and the order of its
outputs.
# Arguments
processor: Function e.g. a ''paz.processor''
intro_indices: List of Ints... |
#!/usr/bin/env python3
# Copyright (c) 2017-2018 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Class for bitcoind node under test"""
import contextlib
import decimal
import errno
from enum import E... |
import pytest
from my_package import process
@pytest.mark.parametrize(
'name, expected',
[
['Hemingway, Ernest', 'Ernest Hemingway'],
['virginia woolf', 'Virginia Woolf'],
['charles dickens ', 'Charles Dickens'],
],
)
def test_clean_name(name, expected):
assert process.clean_... |
import os
import typing
import pandas as pd
import numpy as np
from d3m import container, utils
from d3m.base import utils as base_utils
from d3m.metadata import base as metadata_base, hyperparams
from d3m.primitive_interfaces import base, transformer
import common_primitives
import logging
import math
from scipy.ff... |
# coding: utf-8
"""
Isilon SDK
Isilon SDK - Language bindings for the OneFS API # noqa: E501
OpenAPI spec version: 8
Contact: sdk@isilon.com
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
import unittest
import isi_sdk_8_2_1
from i... |
import socket
import urllib.parse
import configargparse
def get_arg_parser_with_db(description):
"""
Returns an ArgumentParser pre-initalized with common arguments for configuring logging and the main
database connection. It also supports reading arguments from environment variables.
"""
parser ... |
import decimal
import sys
import psycopg2
conn = psycopg2.connect('')
cur = conn.cursor()
cur.execute("SELECT 1, 2+{}".format(sys.argv[1]))
v = cur.fetchall()
assert v == [(1, 5)]
# Verify #6597 (timestamp format) is fixed.
cur = conn.cursor()
cur.execute("SELECT now()")
v = cur.fetchall()
# Verify round-trip of str... |
import argparse
import torch
import torch.nn as nn
import torch.optim as optim
import torch.nn.functional as F
from torch.autograd import Variable
from helpers.utils import to_data, expand_dims, \
int_type, float_type, long_type, add_weight_norm
from helpers.layers import build_conv_encoder, build_dense_encoder
... |
# -*- coding: utf-8 -*-
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: spaceone/api/monitoring/v1/escalation_policy.proto
"""Generated protocol buffer code."""
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from google.protobuf import reflecti... |
from django.urls import path
from game.views import EmailFormView
urlpatterns = [
path('emailform/', EmailFormView.as_view(), name='email_form'),
]
|
"""Import modules."""
import math
import os
import sys
import struct
import numpy
try:
from PIL import Image
except ImportError as e:
if sys.platform == 'linux2':
sys.stderr.write("PIL module not found, please install it with:\n")
sys.stderr.write("apt-get install python-pip\n")
sys.stde... |
# -*- coding: utf-8 -*-
# PLEASE DO NOT EDIT THIS FILE, IT IS GENERATED AND WILL BE OVERWRITTEN:
# https://github.com/ccxt/ccxt/blob/master/CONTRIBUTING.md#how-to-contribute-code
from ccxt.base.exchange import Exchange
from ccxt.base.errors import ExchangeError
from ccxt.base.errors import NotSupported
class _1brok... |
# coding: utf-8
#
# Copyright 2019 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 "lice... |
#!/usr/bin/env python3
"""DCMTools for loading (compressed) DICOM studies and series.
This module provides various methods to load compressed archives or
a single directory, which can contain (multiple) DICOM studies / series.
"""
from __future__ import print_function
import tarfile
import os
import time
try:
# ... |
# Copyright 2018 PerfKitBenchmarker 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 appli... |
import torch
import torch.nn as nn
class StackedLSTM(nn.Module):
"""
Our own implementation of stacked LSTM.
Needed for the decoder, because we do input feeding.
"""
def __init__(self, num_layers, input_size, rnn_size, dropout):
super(StackedLSTM, self).__init__()
self.dropout = nn... |
# 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 agreed to in... |
"""
IPMI control of CPU temperatures.
"""
import re
from typing import Dict
from .controller_state import ControllerState
from .cpu_sensor import CpuSensor
from .ipmitool import Ipmitool
from .util import parse_hex
class IpmiCpu:
"""
IPMI control of CPU temperatures.
"""
ipmitool: Ipmitool
pat_i... |
#-----------------------------------------------------------------------------
# Copyright (c) 2013-2020, PyInstaller Development Team.
#
# Distributed under the terms of the GNU General Public License (version 2
# or later) with exception for distributing the bootloader.
#
# The full license is in the file COPYING.txt... |
#!/usr/bin/env python
"""Django's command-line utility for administrative tasks."""
import os
import sys
def main():
"""Run administrative tasks."""
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'djangographene.settings')
try:
from django.core.management import execute_from_command_line
exce... |
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... |
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... |
#!/usr/bin/env python3
# Copyright (c) 2015-2018 The Utb Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
from test_framework.blocktools import get_masternode_payment, create_coinbase, create_block
from test_framewor... |
from nltk.corpus import wordnet
import nltk
from nltk.corpus import wordnet
def strip_non_ascii(s):
return "".join(i for i in s if ord(i) < 128)
filename = raw_input("tokens filename: ")
lines = []
with open(filename, 'r') as f:
for line in f:
lines.append(strip_non_ascii(line))
narratives = [x[x.rfind('|')+1:... |
"""tutorial URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/2.1/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... |
###################################################################################################
#ESPNetv2: A Light-weight, Power Efficient, and General Purpose Convolutional Neural Network
#Paper-Link: https://arxiv.org/pdf/1811.11431.pdf
#############################################################################... |
from typing import Any, Dict, Tuple
from ee.clickhouse.queries.event_query import ClickhouseEventQuery
from ee.clickhouse.queries.trends.util import get_active_user_params, populate_entity_params
from ee.clickhouse.queries.util import date_from_clause, get_time_diff, get_trunc_func_ch, parse_timestamps
from posthog.co... |
from dataclasses import dataclass, field
from abc import ABC,abstractmethod
from os import error
from Séquence import ErrorBid
from Consts import SUITS,LEVELS
@dataclass
class Card(ABC) :
sort_index: int = field(init=False, repr=False)
level: str
hcp_value : int = 0
def __post_init__(self)... |
from setuptools import setup
setup(
name='pytorch_tps',
description='Thin plate spline interpolation for PyTorch',
version="0.0.1",
author='Yucheol Jung',
author_email='ycjung@postech.ac.kr',
packages=['pytorch_tps'],
url='https://github.com/ycjungSubhuman/pytorch_tps',
)
|
# Copyright (c) 2010 Leif Johnson <leif@leifjohnson.net>
#
# 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,... |
# -*- coding: utf-8 -*-
import json
import os
import re
from distutils.version import LooseVersion
import pip
from django.core.management.base import BaseCommand, CommandError
try:
from pip._internal.download import PipSession
from pip._internal.req.req_file import parse_requirements
from pip._internal.ut... |
"""Handles mapping between color names and ANSI codes and determining auto color codes."""
import sys
from collections import Mapping
BASE_CODES = {
'/all': 0, 'b': 1, 'f': 2, 'i': 3, 'u': 4, 'flash': 5, 'outline': 6, 'negative': 7, 'invis': 8, 'strike': 9,
'/b': 22, '/f': 22, '/i': 23, '/u': 24, '/flash': 25... |
# 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.
from collections import OrderedDict
import logging
import os
import contextlib
import torch
from fairseq import metrics, options
from fairse... |
class FieldManifest:
def __init__(self,
field_id=None,
data_type="RawField",
element_query=None,
data_attribute=None,
child_selectors=None,
flatten_data=False
):
self.field_id = field_id
... |
# Checking FK and IK to make sure the code is right
from math import cos, sin, atan2, sqrt, acos, pi
# Forward Kinematics
def FKin(q1, q2, q3):
"""q1 limit = -1.13 to 1.57, q2 limit = -2.64 to 2.55, q3 limit = -1.78 to 1.78"""
l1 = 0.155
l2 = 0.135
l3 = 0.218
phi = q1 + q2 + q3
print(p... |
"""
Zorp tests
"""
|
n = 5
for x in range(0, n):
for y in range(0, n):
if y > x:
print("*", end=" ")
else:
print(chr(y+65), end=" ")
print()
"""
65 > ASCII of 'A'
""" |
# coding: utf-8
"""
LogicMonitor REST API
LogicMonitor is a SaaS-based performance monitoring platform that provides full visibility into complex, hybrid infrastructures, offering granular performance monitoring and actionable data and insights. logicmonitor_sdk enables you to manage your LogicMonitor account... |
try:
from .code import var_2_cool_json
except ImportError:
from code import var_2_cool_json
import unittest
class FullTest(unittest.TestCase):
def test_1(self):
"""
Basic test that this thing just works :)
:return:
"""
test_var = {
'a' : 1,
... |
"""
WiderFace evaluation code
author: wondervictor
mail: tianhengcheng@gmail.com
copyright@wondervictor
MIT License
Copyright (c) 2018 Vic Chan
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 wi... |
"""Get descendant/parent counts for all GO terms in a GODag and broad L0 and L1 terms."""
from __future__ import print_function
__copyright__ = "Copyright (C) 2016-2018, DV Klopfenstein, H Tang, All rights reserved."
__author__ = "DV Klopfenstein"
import collections as cx
from itertools import chain
from goatools.go... |
import os
import sys
import psutil
import tensorflow as tf
import numpy as np
from collections import defaultdict, OrderedDict
from tabulate import tabulate
import tensorpack
from ..compat import tfv1
from ..utils.utils import find_library_full_path as find_library
from ..utils.nvml import NVMLContext
from ..libinfo ... |
"""
The typing module: Support for gradual typing as defined by PEP 484.
At large scale, the structure of the module is following:
* Imports and exports, all public names should be explicitly added to __all__.
* Internal helper functions: these should never be used in code outside this module.
* _SpecialForm and its i... |
from flask import Flask
app = Flask(__name__)
@app.route("/")
def hello():
return "Hello, Pavan..."
|
import os
print("Hello World. I am Python")
if "a" in os.environ and "b" in os.environ:
firstnum = os.environ['a']
secondnum = os.environ['b']
sum = int(firstnum) + int(secondnum)
print('Sum of {0} & {1} is {2}'.format(firstnum,secondnum,sum))
else:
print('No parameters passed to calculate the sum.')
print("Pyt... |
import re
import time
from optparse import OptionParser
from beneficialtweets import train, predict
from utils import ProgressBarThread
parser = OptionParser()
parser.add_option('--train', dest='train', help='Build the classifier from given dataset', default='')
parser.add_option('--predict', dest='predict', help='Cl... |
import abc
from enum import Enum
from typing import Optional
from bionorm.common.models.util import Location
class BioEntityType(Enum):
GENE = 'GENE'
SPECIES = 'SPECIES'
DISEASE = 'DISEASE'
CHEMICAL = 'CHEMICAL'
class BioEntity(abc.ABC):
def __init__(self, location: Location, text: str):
... |
# coding: utf-8
from __future__ import unicode_literals
import calendar
import copy
import datetime
import functools
import hashlib
import itertools
import json
import math
import os.path
import random
import re
import sys
import time
import traceback
import threading
from .common import InfoExtractor, SearchInfoExt... |
#code from https://github.com/HanxunH/Active-Passive-Losses
import torch
import torch.nn.functional as F
import numpy as np
import mlconfig
mlconfig.register(torch.nn.CrossEntropyLoss)
if torch.cuda.is_available():
torch.backends.cudnn.benchmark = True
if torch.cuda.device_count() > 1:
device = torch.d... |
import matplotlib.pyplot as plt
import numpy as np
import os
import get_dc_data
# Differential figure.
casedata = get_dc_data.retrieve(download=False)
f2 = plt.figure(figsize=(6,4))
plt.suptitle("COVID-19 Data Summary, District of Columbia ",
fontweight="bold")
plt.title("github.com/reidac/covid19-curv... |
import pygame
from States.Baseclass import Base
from Functions.textfunctions import *
from GameConstants.constants import *
from GameConstants.variables import *
from Classes.buttons import Button
startbtn = Button(x = WINDOW_WIDTH // 2 - 200, y = WINDOW_HEIGHT // 2 + 200, text="Play Again", color=GREEN, color2 = DA... |
'''
Created by auto_sdk on 2016.09.13
'''
from top.api.base import RestApi
class ItemUpdateRequest(RestApi):
def __init__(self, domain='gw.api.taobao.com', port=80):
RestApi.__init__(self, domain, port)
self.after_sale_id = None
self.approve_status = None
self.auction_point = None
... |
import _plotly_utils.basevalidators
class TitleValidator(_plotly_utils.basevalidators.TitleValidator):
def __init__(self, plotly_name="title", parent_name="carpet.aaxis", **kwargs):
super(TitleValidator, self).__init__(
plotly_name=plotly_name,
parent_name=parent_name,
... |
import py
class ns(py.xml.Namespace):
pass
def test_tag_with_text():
x = ns.hello("world")
u = unicode(x)
assert u == "<hello>world</hello>"
def test_class_identity():
assert ns.hello is ns.hello
def test_tag_with_text_and_attributes():
x = ns.some(name="hello", value="world")
... |
import scipy.sparse as sp
import tensorflow as tf
from .convert import sparse_to_tensor
class SparseTest(tf.test.TestCase):
def test_sparse_to_tensor(self):
value = [[0, 1, 0], [1, 0, 2], [0, 2, 0]]
value = sp.coo_matrix(value)
with self.test_session():
self.assertAllEqual(
... |
from Midi import Midi
import os
import matplotlib.pyplot as plt
def delete_repetition(note_list):
new_list = [note_list[0]]
for i in range(1, len(note_list)):
if note_list[i - 1][0] != note_list[i][0]:
new_list.append(note_list[i])
return new_list
def get_pattern(file_out):
direc... |
# xloverlay/__init__.py
""" Overlay library for python XLattice packages. """
__version__ = '0.0.8'
__version_date__ = '2018-03-08'
__all__ = ['__version__', '__version_date__', 'XLOverlayError', ]
class XLOverlayError(RuntimeError):
""" General purpose exception for the package. """
|
# Copyright 2017 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... |
import os
os.chdir('zip_bomb')
for i in range(10):
os.system('cp data z{}'.format(i))
os.system('tar -cjf bomb.tar.bz z*')
os.system('rm z*')
for i in range(10):
for j in range(10):
os.system('cp bomb.tar.bz z{}.tar.bz'.format(j))
os.system('rm bomb.tar.bz')
os.system('tar -cjf bomb.tar.bz z*'... |
# Lint as: python3
# Copyright 2020 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 ... |
# -*- coding: utf-8 -*-
"""Adds CreateView and related functionality to SQLAlchemy"""
from sqlalchemy_views import metadata
from sqlalchemy_views.views import CreateView, DropView # noqa
__version__ = metadata.version
__author__ = metadata.authors[0]
__license__ = metadata.license
__copyright__ = metadata.copyright
|
#!/usr/bin/env python
from setuptools import setup
setup(name='generic_celery_task',
version='0.3',
description='A workaround for the lack of dynamic tasks in Celery',
long_description=open("README.rst").read(),
author='Stefan Talpalaru',
author_email='stefantalpalaru@yahoo.com',
u... |
# Adventure 3: buildStreet.py
# From the book: "Adventures in Minecraft", 2nd Edition
# written by David Whale and Martin O'Hanlon, Wiley, 2017
# http://eu.wiley.com/WileyCDA/WileyTitle/productCd-1119439582.html
#
# This program builds a street of identical houses.
# It uses a for loop.
# Import necessary modules
imp... |
#!/usr/bin/python2.7
"""
Read a maf file from stdin and write out a new maf with only blocks having all
of the required in species, after dropping any other species and removing
columns containing only gaps.
usage: %prog species,species2,... < maf
"""
import psyco_full
import bx.align.maf
import copy
import sys
fr... |
from __future__ import print_function
from dace.codegen import cppunparse
import six
def test_py2cpp(func, expected_string):
result = cppunparse.py2cpp(func)
if result != expected_string:
print("ERROR in py2cpp, expected:\n%s\n\ngot:\n%s\n" %
(expected_string, result))
return Fal... |
from manimlib.imports import *
from accalib.electrical_circuits import BatteryLampCircuit, BatteryLampCircuitAC
from accalib.particles import Electron
from accalib.lines import DottedLine
from accalib.tools import rule_of_thirds_guide
class IntroPhasorsPart(Scene):
def construct(self):
section_label = Te... |
from pathlib import Path
import mlflow
import pandas as pd
import pytest
from kedro.extras.datasets.pandas import CSVDataSet
from kedro.extras.datasets.pickle import PickleDataSet
from mlflow.tracking import MlflowClient
from pytest_lazyfixture import lazy_fixture
from kedro_mlflow.io.artifacts import MlflowArtifactD... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.