text stringlengths 2 999k |
|---|
from linked_list import LinkedList
class Node():
"""
Summary of Node class: Class definition of a node which is an individual item contained in a linked list. Each node contains the data for each item.
Attributes:
value (string): a string value
_next: a property of Node class that will reference ... |
# -*- coding: utf-8 -*-
"""
Clayton Thyne CCODE DOFILE
Translated to Python
Created on Fri Jan 26 11:44:25 2018
@author: OEFDataScience
"""
#packages
import numpy as np
import re
#functions
def clthyn_scrape(file_name):
#extract ccode numbers in order
cnums = []
#read text file and st... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import _init_paths
import os
import json
import cv2
import numpy as np
import time
from progress.bar import Bar
import torch
from external.nms import soft_nms
from opts_wider import opts
from logger import Lo... |
import json
import logging
from pathlib import Path
from time import time
import numpy as np
from sklearn.metrics import confusion_matrix
from cd4ml.feature_importance import get_feature_importance
from cd4ml.get_encoder import get_trained_encoder
from cd4ml.logger.fluentd_logging import FluentdLogger
from cd4ml.ml_m... |
#!/usr/bin/env python
import argparse
import retro
from time import sleep
parser = argparse.ArgumentParser()
parser.add_argument('--game', default='Airstriker-Genesis', help='the name or path for the game to run')
parser.add_argument('--state', help='the initial state file to load, minus the extension')
parser.add_a... |
import math
from binascii import hexlify
from clvm_tools import binutils
from deafwave.types.blockchain_format.program import Program
from deafwave.types.blockchain_format.sized_bytes import bytes32
from deafwave.types.condition_opcodes import ConditionOpcode
from deafwave.util.ints import uint64
from deafwave.wallet... |
from ..util import create_element, MNS
from ..version import EXCHANGE_2010
from .common import EWSService
class GetRoomLists(EWSService):
"""MSDN: https://docs.microsoft.com/en-us/exchange/client-developer/web-service-reference/getroomlists"""
SERVICE_NAME = 'GetRoomLists'
element_container_name = '{%s}Ro... |
# coding=utf-8
r"""
This code was generated by
\ / _ _ _| _ _
| (_)\/(_)(_|\/| |(/_ v1.0.0
/ /
"""
from twilio.base import deserialize
from twilio.base import values
from twilio.base.instance_context import InstanceContext
from twilio.base.instance_resource import InstanceResource
from twilio.base... |
from modules.helper import *
from modules.x509_ds import *
from parsec import *
def add_parsers(x):
global parsers
parsers.append(x)
def pop_parsers():
global parsers
parsers.pop()
def error():
global parsers
if len(parsers) > 0:
return parsers[len(parsers) - 1]
else:
... |
""" Helpers for randomized testing """
from random import uniform
import random
from sympy import I, nsimplify, Tuple, Symbol
from sympy.core.compatibility import is_sequence, as_int
def random_complex_number(a=2, b=-1, c=3, d=1, rational=False):
"""
Return a random complex number.
To reduce chance of ... |
from sys import stdin
def sumOfTwoArrays(arr1, n, arr2, m, output) :
i = n - 1
j = m - 1
carry = 0
k = max(n, m)
#k is the current index output array
while i >= 0 and j >= 0 :
SUM = arr1[i] + arr2[j] + carry
output[k] = SUM % 10
carry = SUM // 10
i -= 1
... |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes ... |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may ... |
import cv2
import time
import numpy as np
import sys
sys.path.append("../")
from Detector.nms import py_nms
class MtcnnDetector(object):
def __init__(self,
detectors,
min_face_size=20,
stride=2,
threshold=[0.6, 0.7, 0.7],
scale... |
# -*- coding: utf-8 -*-
from typing import Any
import mock
import ujson
from django.test import TestCase
from django.utils import translation
from django.conf import settings
from django.http import HttpResponse
from django.core import mail
from http.cookies import SimpleCookie
from zerver.models import get_realm_st... |
from portality.core import app
class Authorise(object):
@classmethod
def has_role(cls, role, reference):
# if we are the super user we can do anything
if app.config["SUPER_USER_ROLE"] in reference:
return True
# if the user's role list contains the role explicitly t... |
# -*- coding: utf-8 -*-
#
# Copyright (c) 2015, ParaTools, 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,
# t... |
import argparse
import joblib
import uuid
import tensorflow as tf
import pickle
import time
import numpy as np
import gym
def env_get_state(env):
qpos = env.env.model.data.qpos.flat.copy()
qvel = env.env.model.data.qvel.flat.copy()
return np.concatenate([qpos, qvel])
def env_set_state(env, ob):
qpos_idx = env.env... |
# coding: utf-8
import asyncio
import base64
import ctypes
import getpass
import html
import html.parser
import http
import http.client
import http.cookiejar
import http.cookies
import http.server
import itertools
import optparse
import os
import re
import shlex
import shutil
import socket
import struct
import subproc... |
import importlib
import inspect
import os
from pathlib import Path
from PySide6.QtCore import QDir, QSize
from PySide6.QtWidgets import QFileDialog, QListWidget, QTabWidget
from cilissa.images import Image
from cilissa.operations import Metric, Transformation
from cilissa_gui.decorators import PathInsert
from cilissa... |
import os.path
import shutil
from abc import ABC, abstractmethod
from typing import List, Set
from autonmt.bundle.metrics import *
from autonmt.bundle.utils import *
from autonmt.preprocessing.dataset import Dataset
from autonmt.preprocessing.processors import normalize_file, pretokenize_file, encode_file, decode_file... |
import torch.nn as nn
from utils.model import weights_init
class Generator(nn.Module):
"""
Input shape: (N, in_dim)
Output shape: (N, 3, 64, 64)
"""
def __init__(self, in_dim, dim=64):
super(Generator, self).__init__()
def dconv_bn_relu(in_dim, out_dim):
return nn.Sequ... |
from __future__ import annotations
from typing import cast
import warnings
import numpy as np
from pandas._libs.lib import (
NoDefault,
no_default,
)
from pandas._libs.missing import is_matching_na
import pandas._libs.testing as _testing
from pandas.core.dtypes.common import (
is_bool,
is_categorica... |
#!/usr/bin/env python
##############################################################################
##
# This file is part of Sardana
##
# http://www.sardana-controls.org/
##
# Copyright 2011 CELLS / ALBA Synchrotron, Bellaterra, Spain
##
# Sardana is free software: you can redistribute it and/or modify
# it under th... |
"""
CourtID: illappct
Court Short Name: Ill. App. Ct.
Author: Rebecca Fordon
Reviewer: Mike Lissner
History:
* 2016-06-23: Created by Rebecca Fordon
"""
from juriscraper.oral_args.united_states.state import ill
class Site(ill.Site):
def __init__(self, *args, **kwargs):
super(Site, self).__init__(*args, *... |
# Copyright Contributors to the Amundsen project.
# SPDX-License-Identifier: Apache-2.0
import logging
import time
from random import randint
from typing import Any, Dict, List, Optional, Tuple, Type, Union
from amundsen_common.entity.resource_type import ResourceType
from amundsen_common.models.dashboard import Dash... |
# coding: utf-8
__title__ = 'devto-py'
__description__ = 'Dev.to REST API client'
__version__ = '0.1'
__author__ = 'rhymes'
|
# Copyright 2015 ETH Zurich
#
# 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, sof... |
# -*- coding: utf-8 -*-
# Copyright 2018, IBM.
#
# This source code is licensed under the Apache License, Version 2.0 found in
# the LICENSE.txt file in the root directory of this source tree.
"""Models tests."""
from datetime import datetime
from qiskit.validation import fields, ValidationError
from qiskit.validat... |
# -*- coding: utf-8 -*-
#
# This file is part of REANA.
# Copyright (C) 2022 CERN.
#
# REANA is free software; you can redistribute it and/or modify it
# under the terms of the MIT License; see LICENSE file for more details.
"""REANA Server validation utilities."""
import itertools
import pathlib
from typing import D... |
import csv, re
from os import path
from pathlib import Path
from itertools import groupby
from .dbobjects import Column, Table, Schema, create_typed_table, MetaDataError, MetaDataWarning
TRANSFORM_PARAM_RE = re.compile(r"\$(\d+)")
class TableMappings(list):
def __init__(self, table_mappings):
super().__init__(t... |
import logging
import os
import time
from typing import Dict, Set
from webapp import common, contacts_reader, project_reader, rg_reader, vo_reader
from webapp.contacts_reader import ContactsData
from webapp.topology import Topology
from webapp.vos_data import VOsData
log = logging.getLogger(__name__)
class CachedD... |
import pandas as pd
import ssl
ssl._create_default_https_context = ssl._create_unverified_context
df_csv = pd.read_csv('example')
print(df_csv)
df_csv.to_csv('My_output', index=False)
df_excel = pd.read_excel('Excel_Sample.xlsx', sheet_name='Sheet1')
print(df_excel)
df_excel.to_excel('Excel_Sample2.xlsx',sheet_name... |
# -*-coding:utf-8-*-
#
# Copyright 2020. Huawei Technologies Co., Ltd. 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
#... |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, print_function, unicode_literals
from django.apps import AppConfig
class DocumentsConfig(AppConfig):
name = 'documents'
|
from model.groupn import Groupn
from random import randrange
def test_modify_group_name(app):
if app.group.count() == 0:
app.group.create(Groupn(name ='test'))
old_groups = app.group.get_group_list()
index = randrange(len(old_groups))
Group = Groupn(name="new group")
Group.id = old_groups... |
import unittest
import luigi
import luigi.notifications
import datetime
import pickle
from luigi.parameter import MissingParameterException
luigi.notifications.DEBUG = True
from luigi.util import inherits, common_params, requires, copies, delegates
from luigi.mock import MockFile
from luigi.interface import ArgParseInt... |
print('=' * 30)
print('{:^30}'.format('BANCO CEV'))
print('=' * 30)
valor = int(input('Que valor você quer sacar? R$'))
total = valor
ced = 50
totced = 0
while True:
if total >= ced:
total -= ced
totced += 1
else:
if totced > 0:
print(f'Total de {totced} cédulas de R${ced}')... |
from unittest import TestCase
import numpy as np
from numpy.testing import assert_allclose
from pytest import mark
from fastats.core.ast_transforms.convert_to_jit import convert_to_jit
from fastats.linear_algebra import qr, qr_classical_gram_schmidt
from fastats.scaling.scaling import standard
from tests.data.datase... |
import os
import sys
from setuptools import setup
# Set external files
try:
from pypandoc import convert
README = convert('README.md', 'rst')
except ImportError:
README = open(os.path.join(os.path.dirname(__file__), 'README.md')).read()
with open(os.path.join(os.path.dirname(__file__), 'requirements.... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from alipay.aop.api.constant.ParamConstants import *
class CardDomainVO(object):
def __init__(self):
self._description = None
self._domain_name = None
@property
def description(self):
return self._description
@descri... |
# $Copyright (c) 2015 Software AG, Darmstadt, Germany and/or Software AG USA Inc., Reston, VA, USA, and/or Terracotta Inc., San Francisco, CA, USA, and/or Software AG (Canada) Inc., Cambridge, Ontario, Canada, and/or, Software AG (UK) Ltd., Derby, United Kingdom, and/or Software A.G. (Israel) Ltd., Or-Yehuda, Israel an... |
import asyncio
import heapq
import time
from .errors import (
BadResponseError,
BadStatusError,
BadStatusLine,
ErrorOnStream,
NoProxyError,
ProxyConnError,
ProxyEmptyRecvError,
ProxyRecvError,
ProxySendError,
ProxyTimeoutError,
ResolveError,
)
from .resolver import Resolver
... |
# coding=utf-8
# Copyright 2021 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... |
"""Map ArgTypes to Arg classes."""
from args import _ArgType
#from args.meta_arg import MetaArg
from args.arg import Arg
from args.term import Term
from args.type import Type as Tipe
from args.keyword import Keyword
from args.instructor import Instructor
from args.show import Show
from args.course_level import CourseLe... |
from __future__ import print_function
import sys
from Ziggeo import Ziggeo
if(len(sys.argv) < 4):
print("Error\n")
print("Usage: $>python video_expiration_days.py YOUR_API_TOKEN YOUR_PRIVATE_KEY VIDEO_TOKEN EXPIRATION\n") # Expiration days are integer
sys.exit()
api_token = sys.argv[1]
private_key = sys.argv[2]
v... |
# Copyright Pincer 2021-Present
# Full MIT License can be found in `LICENSE` at the project root.
from __future__ import annotations
import logging
from inspect import isasyncgenfunction, _empty
from typing import Dict, Any
from typing import TYPE_CHECKING
from ..commands import ChatCommandHandler
from ..core.dispa... |
from django.db import connection
# If using cursor without "with" -- it must be closed explicitly:
with connection.cursor() as cursor:
cursor.execute('select column1, column2, column3 from table where aaa=%s', [5])
for row in cursor.fetchall():
print row[0], row[1], row[3]
|
# (C) Datadog, Inc. 2019-present
# All rights reserved
# Licensed under a 3-clause BSD style license (see LICENSE)
import pytest
from . import common
@pytest.mark.e2e
def test_check(dd_agent_check, instance):
aggregator = dd_agent_check(instance, rate=True)
for mname in common.COMMON_METRICS:
aggreg... |
"""
Django settings for Award project.
Generated by 'django-admin startproject' using Django 1.11.
For more information on this file, see
https://docs.djangoproject.com/en/1.11/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.11/ref/settings/
"""
import os
imp... |
# 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 copy
from pyrobot.habitat.sim_utils import make_cfg
import habitat_sim
class HabitatSim(object):
"""Class that interfaces with Hab... |
import os
import pytest
distributed = pytest.importorskip("distributed")
import sys
from operator import getitem
from distributed import Client, SchedulerPlugin
from distributed.utils_test import cluster, loop # noqa F401
from dask.layers import fractional_slice
class SchedulerImportCheck(SchedulerPlugin):
... |
# pylint: disable=invalid-name # disabled because of capital SI in module name
# pylint: disable=missing-module-docstring
# pylint: disable=missing-class-docstring
# pylint: disable=missing-function-docstring
import logging
import os
from pathlib import Path
import lmfit
import numpy as np
import pytest
import xarray ... |
EXTENSIONS = [
{
'name': 'case02',
'extension_class': '.extension.Case02Extension'
}
]
ROUTES = [
{
'uri': '/',
'handler': '.view.Case02View'
},
]
STATICS = [
{
'uri': '/static',
'file_or_directory': './static'
}
]
|
# coding: utf-8
"""
FlashArray REST API
No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
OpenAPI spec version: 2.9
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
import pprint
import re
import six
import typing
from .... |
from django.test import TestCase
from uriredirect.models import RewriteRule, UriRegister
class UriRegisterTestCase(TestCase):
fixtures = ['test_mediatype.json', 'test_uriregister.json', 'test_rewriterule.json']
def test_find_matching_rules_correct_match(self):
usginRegister = UriRegister.objects.g... |
import threading
import numpy as np
class image_replay_buffer:
def __init__(self, env_params, buffer_size):
self.env_params = env_params
self.size = buffer_size
self.T = env_params['max_timesteps']
# memory management
self.current_size = 0
self.n_transitions_stored =... |
from rest_framework import serializers
from .models import Board, TODO, Reminder
class BoardSerializer(serializers.HyperlinkedModelSerializer):
todos = serializers.HyperlinkedRelatedField(
view_name='todo-detail',
many=True,
read_only=True,
)
uncompleted = serializers.HyperlinkedId... |
"""Dataset with 'Human associated gemyvongvirus 1' sequences.
A dataset with 2 'Human associated gemyvongvirus 1' genomes.
THIS PYTHON FILE WAS GENERATED BY A COMPUTER PROGRAM! DO NOT EDIT!
"""
import sys
from catch.datasets import GenomesDatasetSingleChrom
ds = GenomesDatasetSingleChrom(__name__, __file__, __spe... |
'''
Created on Mar 14, 2013
@author: mmunn
Unit test : EUCA-4869 euca-deregister returns bogus error message when deregistering a malformed image ID
setUp : Install Credentials,
test : use euca-deregister on malformed imageid and check for new user friendly AWS compatible error.
tear... |
# Generated by Django 2.0.6 on 2018-11-11 09:15
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('event', '0002_auto_20181111_1907'),
('event', '0002_auto_20181111_2140'),
]
operations = [
]
|
# Copyright 2015 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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by app... |
from flask import current_app
import pytest
import json
@pytest.mark.usefixtures("app", "client", autouse=True) # to use fixtures from conftest
class TestWebAPIs(object):
"""
Testing the APIs by connecting to the flask app from a client.
"""
@classmethod
def setup_class(cls):
cls.ap... |
#!/usr/bin/env python3
# Copyright (c) 2016 The Bitcoin Core developers
# Copyright (c) 2017-2018 The Astral Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test segwit transactions and blocks on P2P network."""
... |
from models.area import Area
area = Area()
area.all()
print(area.sql)
print(area.values) |
from dateutil.parser import parse as date_parse
from cartodb_services.refactor.service.utils import round_robin
from cartodb_services.mapbox.types import MAPBOX_ROUTING_APIKEY_ROUNDROBIN
class MapboxRoutingConfig(object):
"""
Configuration needed to operate the Mapbox directions service.
"""
def __in... |
from typing import List
from src.types.coin import Coin
from src.types.announcement import Announcement
from src.util.condition_tools import (
created_outputs_for_conditions_dict,
conditions_dict_for_solution,
created_announcements_for_conditions_dict,
)
def additions_for_solution(coin_name, solution) ->... |
import math
# Function to return the highest power
# of k less than or equal to n
def prevPowerofK(n, k):
p = int(math.log(n) / math.log(k))
return int(math.pow(k, p))
# Function to return the smallest power
# of k greater than or equal to n
def nextPowerOfK(n, k):
return prevPowerofK(n, k) * k
# ... |
import logging
logging.basicConfig(level=logging.DEBUG)
import os
import sys
import tempfile
#
# Directories / Paths
#
CURRENT_DIR = os.path.join(os.path.dirname(os.path.abspath(__file__)), '..')
# Build plugin paths
CODE_DIR = os.path.abspath(os.path.join(CURRENT_DIR, '..', 'Code'))
LIBRARIES_DIR = os.path.abspath... |
# Copyright 2011 Google 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 or agreed to in writing,... |
"""
This file offers the methods to automatically retrieve the graph Tenacibaculum mesophilum.
The graph is automatically retrieved from the STRING repository.
References
---------------------
Please cite the following if you use the data:
```bib
@article{szklarczyk2019string,
title={STRING v11: protein--prote... |
INPUT = open('input10.txt').read()
TEST1 = """
28
33
18
42
31
14
46
20
48
47
24
23
49
45
19
38
39
11
1
32
25
35
8
17
7
9
4
2
34
10
3
"""
TEST2 = """
16
10
15
5
1
11
7
19
6
12
4
"""
import math
def combs(blocklen):
# return blocklen
if blocklen == 1:
return 1
if blocklen == 2:
return... |
# -*- coding: utf-8 -*-
from EXOSIMS.util.vprint import vprint
from EXOSIMS.util.eccanom import eccanom
from EXOSIMS.util.get_dirs import get_cache_dir
from EXOSIMS.util.get_dirs import get_downloads_dir
import EXOSIMS.Prototypes.Observatory
import numpy as np
import astropy.units as u
import astropy.constants ... |
'''
Copyright 2022 Airbus SAS
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
dis... |
#Non-Boolean and operator
print(10 and 5) # --A1
print(0 and 12) # -- A2
print(13 and 0) # --A3
print(12 and 'python') # --A4
|
import cmdstanpy
import pickle, os, time, argparse
from src.datasets.datasets import *
from src.select import *
ap = argparse.ArgumentParser()
ap.add_argument('-o', '--optimize', required=True,
type = int, help='Wheter optimized or sampled.')
ap.add_argument('-m', '--model', required=True)
ap.add_arg... |
from simple_pb2 import *
from uuid import uuid4
import random
import Queue
print "Starting python client"
channel = beta_implementations.insecure_channel('localhost', 50051)
stub = beta_create_SimpleService_stub(channel)
def runTests():
# Test normal call: return a sum of all numbers sent to it
print "Test 1... |
class agente_corredor_ex_9():
def __init__(self):
self.cur = 1
def invoca(self,pos):
if pos == 0:
if(self.cur == 0):
return "fica parado"
if(self.cur > pos and self.cur > 1):
self.cur = self.cur - 1
return "andar-"
if(self.cur ... |
# Copyright 2015 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 req... |
from qtpy import QtWidgets
from .views import View
class DataObjectWindow(QtWidgets.QMainWindow):
def __init__(self, data_object, parent=None, *args, **kwargs):
super(DataObjectWindow, self).__init__(parent, *args, **kwargs)
self.data_object = data_object
self.tabWidget = QtWidgets.QTabWi... |
# Generated by Django 4.0.3 on 2022-03-25 14:16
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]
ope... |
from Core import *
def TestF1():
print("Test1")
Node1=GDataNode.CreateGradNode(3.0)
Node2=GDataNode.CreateGradNode(-2.0)
Node3=Add()(Node1,Node2)
Node4=GDataNode.CreateGradNode(-7.0)
Node5=GDataNode.CreateGradNode(4.0)
Node6=Add()(Node4,Node5)
Node7=Add()(Node3,Node6)
Node8=Mul()(No... |
#
# Copyright (c) 1996-2000 Tyler C. Sarna <tsarna@sarna.org>
# 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, thi... |
from .generate import IP
from .generate import rangeIP |
""" google_search.py """
import re
import people_also_ask
def get_people_also_ask_links(search_term: str) -> list:
"""
Given a search term, returns the google People Also Ask links
:param search_term: The query to google
:type: str
:rtype: list
:return: list of links returned by people also a... |
"""2017 - Day 1 Part 2: Inverse Captcha tests."""
from src.year2017.day01b import solve
class TestSolve:
def test_all_match(self):
assert solve("1212") == 6
assert solve("123123") == 12
def test_no_match(self):
assert solve("1221") == 0
def test_one_match(self):
assert so... |
"""Faust app"""
import logging
import random
import uuid
from datetime import datetime
import faust
from domination.shadow import ShaDow
class HumanRating(faust.Record, serializer='json', include_metadata=False):
"""Source object from topic 'dominate'"""
rating: int
unique_id: str
class HumanCategori... |
import click
from flask.cli import with_appcontext
from flask_sqlalchemy import SQLAlchemy
db = SQLAlchemy()
@click.command('init-db')
@with_appcontext
def init_db_command():
"""Clear the existing data and create new tables."""
import app.models
db.create_all()
click.echo('Initialized the database.')... |
class Solution:
# @param A, a list of integers
# @return an integer
def maxProduct(self, A):
a = A[0]
b = A[0]
c = A[0]
result = A[0]
for j in xrange(1, len(A)):
i = A[j]
a *= i
b *= i
c = i
a, b = max(max(a,... |
import setuptools
with open("README.md", "r") as fh:
long_description = fh.read()
setuptools.setup(
name="funcsim",
version="0.0.14",
license="bsd-3-clause",
author="Henry Bryant",
author_email="henry@tamu.edu",
description="functional, simple stochastic simulation",
keywords=["functio... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import math
from .AbstractNoiseGen import AbstractNoiseGen
from pyspark.sql.types import *
from pyspark.sql import functions as F
class AbbreviationGen(AbstractNoiseGen):
"""
This class is introduces abbreviations into the data.
"""
def __init__(self, df... |
"""Plugin declaration for Welcome Wizard."""
__version__ = "1.0.2"
from django.db.models.signals import post_migrate
from nautobot.extras.plugins import PluginConfig
from welcome_wizard.signals import welcome_wizard_devicetype
class WelcomeWizardConfig(PluginConfig):
"""Plugin configuration for the welcome_wiz... |
#!/usr/bin/env python
import sys, re, operator, string
#
# The functions
#
def read_file(path_to_file):
"""
Takes a path to a file and returns the entire
contents of the file as a string
"""
with open(path_to_file) as f:
data = f.read()
return data
def filter_chars_and_normalize(str_da... |
#!/usr/bin/env python
import time
from usbcolors import USBColors
if __name__ == '__main__':
usbcolors = USBColors()
usbcolors.set_color(usbcolors.BLACK)
print("Black")
time.sleep(1)
i = 0
while i < 500:
i = (i + 1) % 512
usbcolors.set_RGB(0,i,0)
#time.sleep(0.001)
#print("Green ",i)
usbcolors.set_RGB(0... |
import itertools
import logging
from copy import copy
from typing import Set, List, KeysView, Union, Dict, Optional, Tuple, Any
log = logging.getLogger('assemblyline.classification')
class InvalidClassification(Exception):
pass
class InvalidDefinition(Exception):
pass
class Classification(object):
MI... |
# AUTO GENERATED FILE - DO NOT EDIT
from dash.development.base_component import Component, _explicitize_args
class AntdSlider(Component):
"""An AntdSlider component.
Keyword arguments:
- id (string; optional)
- className (string; optional)
- defaultValue (number | list of numbers; optional)
- disabled (boo... |
# Natural Language Toolkit: Clusterer Interfaces
#
# Copyright (C) 2001-2016 NLTK Project
# Author: Trevor Cohn <tacohn@cs.mu.oz.au>
# Porting: Steven Bird <stevenbird1@gmail.com>
# URL: <http://nltk.org/>
# For license information, see LICENSE.TXT
from nltk.probability import DictionaryProbDist
class ClusterI(object... |
# 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 asyncio
import logging
import signal
from hypercorn.asyncio import serve
from hypercorn.config import Config
import uvicorn
from bareasgi import Application, text_writer
logging.basicConfig(level=logging.DEBUG)
LOGGER = logging.getLogger(__name__)
async def on_startup(scope, info, request):
LOGGER.info... |
# Copyright 2016 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.
#
# NOTE: Created with generate_compiled_resources_gyp.py, please do not edit.
{
'targets': [
{
'target_name': 'iron-pages-extracted',
'depe... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.