text stringlengths 2 999k |
|---|
from __future__ import print_function
import dbus
import dbus.exceptions
import dbus.mainloop.glib
import dbus.service
BLUEZ_SERVICE_NAME = 'org.bluez'
LE_ADVERTISING_MANAGER_IFACE = 'org.bluez.LEAdvertisingManager1'
DBUS_OM_IFACE = 'org.freedesktop.DBus.ObjectManager'
DBUS_PROP_IFACE = 'org.freedesktop.DBus.Properti... |
import dropbox
class TransferData:
def __init__(self, access_token):
self.access_token = access_token
def upload_file(self, file_from, file_to):
dbx = dropbox.Dropbox(self.access_token)
f = open(file_from, 'rb')
dbx.files_upload(f.read(), file_to)
def main():
access_toke... |
from bot_messenger import messenger
from bs4 import BeautifulSoup
from firebase.firebase import db_firebase
#driver=messenger.driver
class scrapy:
def extract():#driver):
#print('realizando extraçao')
#elemento = driver.find_element_by_xpath('/html/body/div/div[1]/div[1]/div[4]/div[1]/div[... |
#!/usr/bin/env python
import os
import sys
import argparse
from data_tools.lib.files import findNumber,ParameterParser
from data_tools.lib.group import Group,run_grouping
class IntervalGroup(Group):
def __init__(self, tup):
super(IntervalGroup, self).__init__(tup)
self.last = None
self.chu... |
from django.contrib import admin
from .models import User
from django.contrib.auth.admin import UserAdmin
# Register your models here.
class UserAdmin(UserAdmin):
fieldsets = (
('Credenciales', {
'fields': ('username','password')}),
('Información personal', {
"fields": ('ema... |
print('-' * 30)
print('{:^30}'.format('Sequência de Fibonacci'))
print('-' * 30)
quantidade = int(input('Quantos termos você quer mostrar? '))
print('~' * 30)
lista = [0, 1]
contador = 1
while contador <= quantidade:
if quantidade >= 3 and contador >= 3:
termo = lista[contador-2] + lista[contador-3]
... |
# Copyright 2020 G-Research
#
# 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... |
import machine
import utime
from .ntc_temperature_sensor import NtcTemperatureSensor
class WaterFlowSensor:
Counter = 10
def __init__(self, pin, ntc_temperature_sensor: NtcTemperatureSensor=None, calibration_factor=4.5):
WaterFlowSensor.Counter = WaterFlowSensor.Counter + 1
self.pulse_count ... |
"""
Django settings for CompareKaro project.
Generated by 'django-admin startproject' using Django 1.10.5.
For more information on this file, see
https://docs.djangoproject.com/en/1.10/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.10/ref/settings/
"""
impor... |
""" Classes for making interactive plots.
"""
from __future__ import division, print_function, unicode_literals, absolute_import
import os
import numpy as np
from ..utils import between, loadjson, savejson
from ..spectra.convolve import convolve_psf
from ..spectra.plotting import get_flux_plotrange
from ..guis import ... |
from __future__ import absolute_import
import os
import string
import functools
ESCAPE_SLASH = '%SLASH%'
def combine(*parts):
"""combine ``parts`` into valid ZooKeeper path.
:arg parts: list of str
"""
if not any(parts):
return '/'
parts = filter(lambda part: part, parts)
return os... |
from allure import title, description, suite, parent_suite
from pages.api import asserts
from data import API_USERS_SUCCESS, API_GET_METHOD_NOT_ALLOWED, API_AUTH_TOKEN_EMPTY, API_BAD_REQUEST_LENGTH_TOKEN, \
AUTH_DATA_LENGTH_TOKEN, API_BAD_REQUEST_BAD_LIMIT, API_BAD_REQUEST_BAD_OFFSET, \
API_AUTH_NOT_FOUND_TOKEN... |
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use ... |
import logging
from .config import is_configured, get_config
__global_logger = None
__loggers = {}
def _reset():
"""
This is only used for testing. To get a fresh session, we should
reset `config`, `bundle` and `logger` modules by calling their `reset()`.
"""
global __global_logger, __loggers
... |
#!/usr/bin/env python
# BSD 3-Clause License; see https://github.com/scikit-hep/uproot-methods/blob/master/LICENSE
import uproot_methods.base
class Methods(uproot_methods.base.ROOTMethods):
@property
def xerrorshigh(self):
return self._fEXhigh
@property
def xerrorslow(self):
return self._fEXlow
@pro... |
#!w:\source\repos\agent\venv\scripts\python.exe
# $Id: rst2s5.py 4564 2006-05-21 20:44:42Z wiemann $
# Author: Chris Liechti <cliechti@gmx.net>
# Copyright: This module has been placed in the public domain.
"""
A minimal front end to the Docutils Publisher, producing HTML slides using
the S5 template system.
"""
try... |
# -*- coding: utf-8 -*-
###########################################################################
# Copyright (c), The AiiDA team. All rights reserved. #
# This file is part of the AiiDA code. #
# ... |
import random
import string
import sys
import unittest
from xpack_metricbeat import XPackTest
import metricbeat
class ActiveMqTest(XPackTest):
COMPOSE_SERVICES = ['activemq']
def get_activemq_module_config(self, metricset):
return {
'name': 'activemq',
'metricsets': [metrics... |
import os
import argparse
os.environ["OMP_NUM_THREADS"] = "1"
import numpy as np
import numpy.random as npr
import mimo
from mimo.distributions import NormalGamma
from mimo.distributions import MatrixNormalWishart
from mimo.distributions import GaussianWithNormalGamma
from mimo.distributions import LinearGaussianWit... |
import numpy as np
import sys,os
os.environ["CUDA_VISIBLE_DEVICES"] = ''
from easyreg.viewers_tomv import *
from mermaid.utils import *
from mermaid.data_utils import *
import SimpleITK as sitk
from glob import glob
import os
sz = [160,200,200]
def get_image_list_to_draw(refer_folder,momentum_folder,img_type,source... |
#
# Copyright (C) 2007 Serge Vakulenko, <vak@cronyx.ru>
#
# This file is part of Unicoder utility, which is distributed
# under the terms of the GNU General Public License (GPL).
# See the accompanying file "COPYING" for more details.
#
import sys, string
for id in sys.argv[1:]:
id = string.lower (id[:-4])
print "#i... |
# coding=utf-8
"""
pygame-menu
https://github.com/ppizarror/pygame-menu
TEXT INPUT
Text input class, this widget lets user to write text.
License:
-------------------------------------------------------------------------------
The MIT License (MIT)
Copyright 2017-2020 Pablo Pizarro R. @ppizarror
Permission is hereby... |
from django.test import TestCase
from django.core.files.storage import default_storage
from PIL import Image
from daguerre.tests.base import BaseTestCase
from daguerre.utils import (
make_hash, save_image, get_exif_orientation,
get_image_dimensions, apply_exif_orientation,
exif_aware_size, DEFAULT_FORMAT, ... |
#!/usr/bin/env python3
# Copyright (c) 2017-2019 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 various command line arguments and configuration file parameters."""
import os
from test_framewo... |
import unittest
import datetime
from .. import checkers
from .. import constants
class IsPlayerParticipateInGame(unittest.TestCase):
def test(self):
now = datetime.datetime.utcnow()
past = now - datetime.timedelta(seconds=constants.INACTIVE_PREMIUM_LIVETIME)
future = now + datetime.time... |
from typing import Optional#, Tuple, Sequence, Type, Union, Dict
import numpy as np
from anndata import AnnData
import scipy.stats
from scanpy import logging as logg
def cluster_consistency(
adata: AnnData,
level: int = 1,
group: Optional[str] = None,
key: Optional[str] = 'nsbm',
copy: bool = Fa... |
def selectionSort(arr):
for i in range(len(arr)):
minIdx = i
for j in range(i+1, len(arr)):
if arr[minIdx] > arr[j]:
minIdx = j
arr[i], arr[minIdx] = arr[minIdx], arr[i]
for i in arr:
print(i, end=" ")
print()
def bubbleSort(arr):
for i in ra... |
# coding=utf-8
# Copyright 2014 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import absolute_import, division, print_function, unicode_literals
import logging
import traceback
from pants.build_graph.address import Address
from pants... |
# coding: utf-8
"""
Deep Lynx
The construction of megaprojects has consistently demonstrated challenges for project managers in regard to meeting cost, schedule, and performance requirements. Megaproject construction challenges are common place within megaprojects with many active projects in the United State... |
# Created by Minbiao Han and Roman Sharykin
# AI fall 2018
from __future__ import print_function
from __future__ import division
from builtins import range
from past.utils import old_div
import MalmoPython
import json
import logging
import math
import os
import random
import sys
import time
import re
import uuid
from... |
import pytest
from risks.validation_helpers import get_non_matching_fields
@pytest.fixture
def regexes():
return ['abc', '^onlythis$', '^.{7}$']
field_values = ['abcd', 'onlythis', '123f567']
@pytest.fixture
def fields():
return [
{'value': v} for v in field_values
]
class TestGetNonMatching... |
from unittest import mock
from django.test import TestCase
from oscar.apps.shipping import methods, repository
class TestDefaultShippingRepository(TestCase):
def setUp(self):
self.repo = repository.Repository()
def test_returns_free_when_basket_is_non_empty(self):
basket = mock.Mock()
... |
from . import values
class UndefinedValue(Exception):
"""Raised when a value is not defined."""
class Invalid(Exception):
"""Raised when a validator failed."""
class InvalidValue(Invalid):
"""Raised when a type is not as expected."""
def __init__(self, node, msg=None, **kwargs):
super(... |
import sys, os
myPath = os.path.dirname(os.path.abspath(__file__))
sys.path.insert(0, myPath + '/../')
import torch
from torch import nn
from torch.optim import Adam
from torch.nn.init import xavier_normal as xavier
import matplotlib.pyplot as plt
from data.loader import cryptoData
from models.model import SeqRegre... |
# -*- coding: utf-8 -*-
# Copyright (c) 2012 Mitch Garnaat http://garnaat.org/
# All rights reserved.
#
# 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
# withou... |
from app.handlers.main_menu import MainMenuHandlers
from app.handlers.matchup_selection import MatchupSelectionHandlers
from app.handlers.player_profile import PlayerProfileHandlers
from app.handlers.players_list import PlayersListHandlers
from app.handlers.session_players import SessionPlayersHandlers
|
class Solution:
def groupAnagrams(self, strs):
map = {}
primes = []
for i in strs:
arr = [0]*26
for j in i:
arr[ord(j)%26]+=1
if str(arr) in map:
map[str(arr)].append(i)
else:
map[str(arr)] = [i]... |
# Copyright 2017 The TensorFlow Agents 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 law or ag... |
from alignments.MegaAlignment import MegaAlignment
import scipy.optimize
import numpy
class CloneFrequencyComputer_cnv1(object):
"""
Compute clone frequency (F) from mutant allele fraction matrix (C) and observed variant frequencies (v_obs).
C x F = v_obs
"""
def __init__(self, se... |
"""Gym environment wrapper for a Wireless Sensor Network"""
import tensorflow as tf
import gym
from graph_nets import utils_np, utils_tf
from graph_nets.graphs import GraphsTuple
from observation import ObservationBuilder, TIMESLOT_IDX, POSSIBLE_IDX
class GraphSpace(gym.spaces.Space):
"""Graph space for usage ... |
from . import __version__ as app_version
app_name = "frappe"
app_title = "Frappe Framework"
app_publisher = "Frappe Technologies"
app_description = "Full stack web framework with Python, Javascript, MariaDB, Redis, Node"
app_icon = "octicon octicon-circuit-board"
app_color = "orange"
source_link = "https://github.com/... |
import argparse
import datetime
import os
import time
import dotenv as de
import numpy as np
de.load_dotenv()
import torch
import torch.nn as nn
from torch_geometric.data import DataLoader
from torch_geometric.nn import GCNConv
from torch.nn import Linear
import torch.nn.functional as F
# import atom3d.util.dataty... |
CRITICAL_MARK_BEGIN = '<!-- BEGIN: django-critical css ('
CRITICAL_MARK_END = ') END: django-critical css -->'
CRITICAL_ASYNC_MARK = '<!-- django-critical async snippet -->'
CRITICAL_KEY_MARK_BEGIN = '<!-- BEGIN: django-critical key ('
CRITICAL_KEY_MARK_END = ') END: django-critical key -->'
|
import os
from oscar.defaults import * # noqa
# Path helper
location = lambda x: os.path.join(
os.path.dirname(os.path.realpath(__file__)), x)
ALLOWED_HOSTS = ['test', '.oscarcommerce.com']
DATABASES = {
'default': {
'ENGINE': os.environ.get('DATABASE_ENGINE',
'djan... |
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
# For details: https://github.com/PyCQA/pylint/blob/master/LICENSE
import collections
from pylint.constants import MSG_TYPES
_MsgBase = collections.namedtuple(
"_MsgBase",
[
"msg_id",
"symbol",
"msg",
... |
import os
import subprocess
from pathlib import Path
from tempfile import NamedTemporaryFile
docker_image = "claranet/direnv-asdf:latest"
top = Path(__file__).parent.parent.parent
home = os.environ["HOME"]
uid = os.getuid()
gid = os.getgid()
# Use a temporary file for the AWS credentials file,
# so it will be automa... |
""" Global and local Scopes
Scopes and Namespaces
When an object is assigned to a variable # a = 10
that variable points to some object
and we say that the variable (name) is bound to that object
That object can be accessed using that name in various parts of our code... |
# Note: To use the 'upload' functionality of this file, you must:
# $ pip install twine
import io
import os
import re
import sys
from shutil import rmtree
from setuptools import Command, find_packages, setup
def read(path, encoding="utf-8"):
path = os.path.join(os.path.dirname(__file__), path)
with io.ope... |
"""
BZT structures
Copyright 2019 BlazeMeter 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 w... |
from dash_extensions.enrich import Output, Input, State, ServersideOutput
from _app.gen import parse_contents, find_closest
from _app.update import update_dropdown, update_marks, update_table, update_graph
from dash import callback_context
from dash.exceptions import PreventUpdate
import pandas as pd
def register_... |
from django.apps import AppConfig
class CoreConfig(AppConfig):
default_auto_field = 'django.db.models.BigAutoField'
name = 'core'
def ready(self) -> None:
from core import signals
return super().ready() |
# // divisão inteira
# ** exponenciação
nome = input('Digite o seu nome: ')
print('Prazer em te conhecer, {:20}!'.format(nome))
print('Prazer em te conhecer, {:>20}!'.format(nome))
print('Prazer em te conhecer, {:<20}!'.format(nome))
print('Prazer em te conhecer, {:^20}!'.format(nome))
print('Prazer em te conhecer, {:=... |
# Copyright 2015 Futurewei. 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... |
"""
Django settings for photomania project.
Generated by 'django-admin startproject' using Django 3.1.7.
For more information on this file, see
https://docs.djangoproject.com/en/3.1/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/3.1/ref/settings/
"""
... |
import subprocess
import sys
from distutils.errors import CompileError
from os import path
from setuptools import Extension, find_packages, setup
from setuptools.command.build_ext import build_ext
__version__ = "0.0.1"
"""
To upload to pypi see PUBLISH.md
"""
here = path.abspath(path.dirname(__file__))
def che... |
#!/usr/bin/env python3
# Copyright 2019 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 o... |
import os
from flask import Flask, Response, request
from twilio import twiml
from twilio.rest import TwilioRestClient
app = Flask(__name__)
client = TwilioRestClient()
# this should be your Twilio number, format: +14155551234
CUSTOMER_SERVICE_NUMBER = os.environ.get('CUSTOMER_SERVICE_NUMBER', '')
# your cell phone ... |
import numpy as np
import cv2
import wave
import subprocess
import os, base64
# landmarks connections
cons = [[48, 49], [49, 50], [50, 51], [51, 52], [52, 53], [53, 54], [54, 55], [55, 56], [56, 57],
[57, 58], [58, 59], [59, 48], [60, 61], [61, 62], [62, 63], [63, 64], [64, 65], [65, 66],
[66, 67], [67... |
"""
Text Generation Using Keywords
Keytotext converts a list of Keywords to sentences and larger texts
"""
__version__ = "2.3.2"
from .pipeline import pipeline
from .trainer import trainer
from .dataset import make_dataset
|
from .a2c import A2C
from .reinforce import REINFORCE
from .svpg import SVPG
|
i = 1
while i <= 12:
monthlyInterestRate = annualInterestRate/12.0
minimumMonthlyPayment = balance * monthlyPaymentRate
unpaidBalance = balance - minimumMonthlyPayment
updatedBalance = unpaidBalance + monthlyInterestRate * unpaidBalance
balance = updatedBalance
i += 1
print("The Remaining Balanc... |
##############################################################################
# Copyright (c) 2007 Open Kernel Labs, Inc. (Copyright Holder).
# All rights reserved.
#
# 1. Redistribution and use of OKL4 (Software) in source and binary
# forms, with or without modification, are permitted provided that the
# following ... |
# Generates VariableType.h/cpp
#
# VariableType is a subclass of at::Type that provides the binding code
# necessary to provide a differentiable version of ATen operators. There are a
# number of different things we could mean:
#
# - Given a non-differentiable forward implementation, we might
# directly associate... |
import pkg as pg
print(dir())
print(dir(pg))
a1 = pg.a.A1()
a2 = pg.a.A2()
b1 = pg.b.B1()
b2 = pg.b.B2()
# Output
'''
$ python tryit.py
['__annotations__', '__builtins__', '__cached__', '__doc__', '__file__', '__loader__', '__name__', '__package__', '__spec__', 'pg']
['__builtins__', '__cached__', '__doc_... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from flask import (Flask, request, jsonify)
from flask.ext.sqlalchemy import SQLAlchemy
from flask.ext.script import Manager
from flask.ext.migrate import Migrate, MigrateCommand
from flask.ext.cors import CORS
from werkzeug.exceptions import BadRequest
import... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""diskover - Elasticsearch file system crawler
diskover is a file system crawler that index's
your file metadata into Elasticsearch.
See README.md or https://github.com/shirosaidev/diskover
for more information.
Amazon S3 inventory module for diskover
Copyright (C) Chris... |
import numpy as np
from common.numpy_fast import clip, interp
def apply_deadzone(error, deadzone):
if error > deadzone:
error -= deadzone
elif error < - deadzone:
error += deadzone
else:
error = 0.
return error
class PIController(object):
def __init__(self, k_p, k_i, k_f=1., pos_limit=None, neg_... |
# 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 ... |
import sys
from cherrypy._cpcompat import py3k
try:
from xmlrpclib import DateTime, Fault, ProtocolError, ServerProxy, SafeTransport
except ImportError:
from xmlrpc.client import DateTime, Fault, ProtocolError, ServerProxy, SafeTransport
if py3k:
HTTPSTransport = SafeTransport
# Python 3.0's SafeTran... |
import unittest
from Signature import Signature
class TestSignature(unittest.TestCase):
secret = "TWFGC9YBBsj8FaQ%N4v6hmfzjXK6yqR6rEsvHfkLfwIUKCk@ngvWZ7CqBfC7G4I"
def _emulate_get_request(self):
return {"frontend": "9aho8o1bv2r7uqdtbpt7kq0l91",
"signature": {
"signe... |
# Copyright 2020 The Pigweed 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in ... |
# Copyright (C) 2018-2020 Intel Corporation
#
# SPDX-License-Identifier: MIT
"""
Django settings for CVAT project.
Generated by 'django-admin startproject' using Django 2.0.1.
For more information on this file, see
https://docs.djangoproject.com/en/2.0/topics/settings/
For the full list of settings and their values... |
# -*- coding: utf-8 -*-
from __future__ import print_function
import gevent
import pytest
from ethereum import slogging
from secp256k1 import PrivateKey
from raiden.encoding.signing import GLOBAL_CTX
from raiden.messages import (
Ack,
decode,
DirectTransfer,
Lock,
MediatedTransfer,
Ping,
R... |
import os
import signal
import subprocess
import sys
import unittest
from test import support
from test.support import script_helper
@unittest.skipUnless(os.name == "posix", "only supported on Unix")
class EINTRTests(unittest.TestCase):
@unittest.skipUnless(hasattr(signal, "setitimer"), "requires s... |
"""
This file contains tests for the cluster module's Cluster class.
"""
# Obviously we want to test 'private' attributes.
# pylint: disable=protected-access
import numpy as np
from local_stats.cluster import Cluster
def test_init():
"""
Classic test to blow up if attribute names change.
"""
cluste... |
from __future__ import print_function,division
import tensorflow as tf
import os
from os import listdir
from os.path import isfile, join
import shutil
import sys
import math
import json
import logging
import numpy as np
from PIL import Image
from datetime import datetime
import tensorflow as tf
from PIL import Image
... |
import numpy as np
from gym.spaces import Dict, Discrete
from rlkit.data_management.replay_buffer import ReplayBuffer
class ObsDictRelabelingBuffer(ReplayBuffer):
"""
Replay buffer for environments whose observations are dictionaries, such as
- OpenAI Gym GoalEnv environments. https://blog.openai.com... |
# python argparse11.py 4
# python argparse11.py 4 -v
# python argparse11.py 4 -vv
import argparse
parser = argparse.ArgumentParser()
parser.add_argument("x", type=int, help="the base")
parser.add_argument("y", type=int, help="the exponent")
parser.add_argument("-v", "--verbose", action="count", default=0)
args = pa... |
#!/usr/bin/python
from time import time
from ast import literal_eval
import key_distribution as db
import uuid
import server
import cgi
import sys
sys.path.insert(0, '../lib')
import lib
SERVER = 'localhost'
PORT_NUMBER = 8081
TIMEOUT = 60*60 #An hour
class TGSServer(server.ResponseServer):
def response(self, TG... |
import discord
from discord.ext import commands
from discord.ext.menus.views import ViewMenuPages
from helpers.pagination import AsyncEmbedListPageSource
class SpeciesConverter(commands.Converter):
async def convert(self, ctx, arg):
if arg.startswith("#") and arg[1:].isdigit():
arg = arg[1:]
... |
#!/usr/bin/python
#-*- coding: utf-8 -*-
import pandas as pd
from src.DataManagement.Preprocessing import PreprocessingStrategy
from sklearn.preprocessing import PolynomialFeatures as _PolynomialFeatures
class PolynomialFeatures(PreprocessingStrategy):
def __init__(self,**kwargs):
super().__init__()
... |
###############################################################################
# Language Modeling on Penn Tree Bank
#
# This file generates new sentences sampled from the language model
#
###############################################################################
import argparse
import torch
import data
parse... |
# 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
# distributed under t... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
def slownie(liczba):
"""Zmienia liczbe na nazwy"""
liczby = { 0: "zero",
1: "jeden",
2: "dwa",
3: "trzy",
4: "cztery",
5: "pięć",
6: "sześć",
7: "siedem",
8: "osiem",
9: "dziewięć",
10: "dziesięć",
11: "jedenaście",
... |
# Copyright (C) 2018 The LineageOS 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 agreed ... |
from random import randint
from app import app
if __name__ == '__main__':
try:
print('Введите номер порта, на котором будет запущен сервер. Диапазон [8000; 60000]')
port = int(input("Или нажмите <Enter> для выбора случайного: "))
if port < 8000 or port > 60000 or not port:
ra... |
#!/usr/bin/env python
# -*- coding:utf-8 -*-
# Author: Donny You (youansheng@gmail.com)
# Class Definition for GAN.
import os
import torch
from methods.tools.blob_helper import BlobHelper
from methods.tools.runner_helper import RunnerHelper
from models.gan.model_manager import ModelManager
from datasets.test.test_da... |
import argparse
def get_argparse():
parser = argparse.ArgumentParser()
parser.add_argument('--in_txt', type=str, default='The moon would be black tonight',
help='Starting Text Default - "The moon would be black tonight"')
parser.add_argument('--seq_len', type=int, default=100,
... |
"""Switch platform for FireServiceRota integration."""
import logging
from homeassistant.components.switch import SwitchEntity
from homeassistant.config_entries import ConfigEntry
from homeassistant.core import callback
from homeassistant.helpers.dispatcher import async_dispatcher_connect
from homeassistant.helpers.ty... |
import json
import os
import pytest
from MicrosoftGraphAPI import MsGraphClient, generic_command
def load_test_data(test_data_filename):
with open(os.path.join('./test_data', test_data_filename)) as f:
return json.load(f)
@pytest.fixture()
def client(requests_mock):
requests_mock.post(
'ht... |
# -*- coding: utf-8 -*-
"""
Tencent is pleased to support the open source community by making 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community
Edition) available.
Copyright (C) 2017-2020 THL A29 Limited, a Tencent company. All rights reserved.
Licensed under the MIT License (the "License"); you may not use this file except in co... |
class script(object):
START_MSG = """ <b>Hi {}
You can call this as an Misa Amina Bot if you like :D
This is Version 2 of Misa Amina Bot
Bot gives button Automatic... !
My Mine 💕@soulsharper!
But Iam corporate With This manh 🔥@Ron_y_reing_Z and His Channel and Group https://t.me/musi_c_world
For more click ... |
import pytest
import common
import time
import random
import subprocess
import os
from common import client, core_api, volume_name # NOQA
from common import sts_name, statefulset, storage_class # NOQA
from common import DATA_SIZE_IN_MB_1, DATA_SIZE_IN_MB_2, DATA_SIZE_IN_MB_3
from common import DATA_SIZE_IN_MB_4, Ki
... |
import itertools
import math
import random
from typing import List, Set, Union # for mypy type checking
FLOAT_DIGITS = 8
EPSILON = 10 ** (-FLOAT_DIGITS)
def _sign(num):
if num == 0:
return 0
return 1 if num > 0 else -1
class Pointlike(tuple):
@property
def rounded(self) -> "Pointlike":
... |
# coding=utf-8
from __future__ import absolute_import, division, print_function, \
unicode_literals
from pack001 import *
from unittest import TestCase
from iota import Address, Fragment, ProposedBundle, ProposedTransaction, Tag, \
TryteString
from iota.crypto.signing import KeyGenerator
from iota.crypto.types imp... |
from checkov.common.models.consts import ANY_VALUE
from checkov.common.models.enums import CheckCategories
from checkov.terraform.checks.resource.base_resource_value_check import BaseResourceValueCheck
class CloudfrontDistributionEnabled(BaseResourceValueCheck):
def __init__(self):
name = "Ensure Cloudfr... |
# -*- coding: utf-8 -*-
# Copyright 2014 Telefonica Investigación y Desarrollo, S.A.U
#
# This file is part of FI-WARE 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:
#
# h... |
d = {}
seq = "KYRTWEEFTRAAEKLYQADPMKVRVVLKYRHCDG"
for aa in seq:
try:
d[aa] += 1
except KeyError:
d[aa] = 1
print(d)
|
import pygame
import typing
# Type hints
Vector = typing.Union[typing.Tuple[int, int], typing.List[int]]
presets = []
class WidgetManager:
def __init__(self, *widgets):
self.shown_widgets = []
self.hidden_widgets = []
self.add(*widgets)
self.previous_keys = [0] * 10
sel... |
from deriva.core import DerivaServer, ErmrestCatalog, HatracStore, AttrDict,get_credential
from deriva.core.ermrest_model import builtin_types, Table, Column, Key, ForeignKey
# replace this with your real server FQDN
servername = "leo.isrd.isi.edu"
servername = "hdsca.isrd.isi.edu"
credentials = get_credential(servern... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.