text stringlengths 2 999k |
|---|
# ######################### LICENSE ############################ #
# Copyright (c) 2005-2015, Michele Simionato
# All rights reserved.
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
# Redistributions of so... |
from rest_framework import serializers
from .models import Planet
|
import torch
from cogdl.tasks import build_task
from cogdl.datasets import build_dataset
from cogdl.models import build_model
from cogdl.utils import build_args_from_dict
def get_default_args():
cuda_available = torch.cuda.is_available()
default_dict = {'hidden_size': 16,
'dropout': 0.5,
... |
from flask import render_template, request
from flask.ext.classy import FlaskView
from . import contacts_bluesrprints
class ContactView(FlaskView):
route_base = '/'
def get_context_data(self):
context = {
'info': {
'title': 'Contact - Clean Blog',
'head': '... |
stack_base_name = "skyer9-test"
region_name = "ap-northeast-2"
acm_certificate_arn = "arn:aws:acm:us-east-1:061175447448:certificate/d6c212a8-8871-XXXXXXXXXXXXXXX"
acm_cluster_certificate_arn = "arn:aws:acm:ap-northeast-2:061175447448:certificate/45a14cb8-3da4-4XXXXXXXXXXXXXXX"
# for assets
root_domain_name = "10x10.i... |
# SPDX-License-Identifier: Apache-2.0
#
# The OpenSearch Contributors require contributions made to
# this file be licensed under the Apache-2.0 license or a
# compatible open source license.
import os
import unittest
from typing import Any, Dict
from unittest.mock import MagicMock, Mock, patch
import yaml
from mani... |
import time
import logging
import subprocess
import sys
class NonZeroReturnException(Exception): pass
def run_check(cmd: str, shell=True):
logging.info('Running cmd `%s`' % cmd)
t0 = time.time()
completed_proc = subprocess.run(cmd, shell=shell, executable='/bin/bash', stdout=sys.stdout, stderr=sys.s... |
from __future__ import annotations
import json
import re
from distutils.version import StrictVersion
from enum import Enum
from importlib import resources
from pathlib import Path
from tempfile import TemporaryDirectory
from typing import Optional, Union
from qtvscodestyle.qtpy.qt_compat import QtImportError
from qtv... |
#! /usr/bin/env
from .pkt_dispatch import PacketDispatcher
from scapy.all import rdpcap
class PacketFileDispatcher(PacketDispatcher):
'''Definition of PacketDispatcher for files of packets.
Args:
pkt_src: str - network interface (wlan0, eth0, lo, ...)
filtr: str - tcpdump-like filters (BPF)
... |
import re
from enum import Enum
minute_re = re.compile(
"{0}|{1}|{2}|{3}|{4}".format(
"(?P<all>\\*)",
"(?P<specific>[0-5]?\\d)",
"(?P<range>[0-5]?\\d-[0-5]?\\d)",
"(?P<list>[0-5]?\\d(,[0-5]?\\d)+)",
"(?P<step>(\\*|[0-5]?\\d)/(([0-5]?[1-9])|([1-5]0)))",
)
)
hour_re = re.... |
import pickle
def getBox(idx):
tmp = [[] for i in range(24)]
for i, x in enumerate(data[idx]):
if (x != 0):
tmp[i % 24].append(x)
ans = [[] for i in range(24)]
for i in range(24):
tmp[i].sort()
q1 = tmp[i][int(len(tmp[i]) / 4)]
q3 = tmp[i][int(len(tmp[i]) * 3... |
from django.contrib.auth.tokens import PasswordResetTokenGenerator
import six
class EmailVerificationTokenGenerator(PasswordResetTokenGenerator):
def _make_hash_value(self, user, timestamp):
return (six.text_type(user.pk)+six.text_type(timestamp)+six.text_type(user.is_email_verified))
email_verific... |
import pandas as pd
from pandas import DataFrame
from ..transformers import Transformer
from ..internal import ColumnResolver, listify
class TransformerExecutor:
def validate(self, df, columnDefinitions):
for columnDef in columnDefinitions:
for transformer in listify(columnDef['transformers'])... |
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.autograd import Variable
import math
from functools import partial
__all__ = [
'resnet10', 'resnet18', 'resnet34', 'resnet50', 'resnet101',
'resnet152', 'resnet200'
]
def conv3x3x3(in_planes, out_planes, stride=1, dilation=1):
#... |
import secrets
import boto3
import moto
import pytest
from helpers import bulk_delete_dynamo_items, delete_dynamo_item
@pytest.fixture
def client():
with moto.mock_dynamodb2():
yield boto3.resource("dynamodb", region_name="eu-west-1").meta.client
def test_can_delete_single_item(client):
client.cre... |
'''
This code could allocate the GPU automatically.
Please run this code in Python 3 only!!!
'''
import os, sys, shutil
import subprocess as sbp
from datetime import datetime
def get_all_gpu():
all_gpus = list()
nvidia = sbp.run(['nvidia-smi', '-L'], stdout=sbp.PIPE)
for line in nvidia.stdout.decode('ut... |
"""Requests with no directory."""
from .addcustomer import AddCustomer
from .commondatasource import CommonDataSource
from .createorder import CreateOrder
from .customeraccounts import CustomerAccounts
from .deleterequest import DeleteRequest
from .getimages import GetImages
from .getproductsforrange import GetProduct... |
"""
This module demonstrates INDEXING into a SEQUENCE:
-- How to index into a sequence, using square brackets []
-- The 'len' function
-- What goes wrong if the index is out of range
Authors: David Mutchler, Vibha Alangar, Matt Boutell, Dave Fisher,
Mark Hays, Amanda Stouder, Derek Whitley, and their co... |
from test.support import (TESTFN, run_unittest, import_module, unlink,
requires, _2G, _4G)
import unittest
import os, re, itertools, socket, sys
# Skip test if we can't import mmap.
mmap = import_module('mmap')
PAGESIZE = mmap.PAGESIZE
class MmapTests(unittest.TestCase):
def setUp(self... |
"""A ApiController Module."""
from masonite.request import Request
from masonite.view import View
from masonite.controllers import Controller
class ApiController(Controller):
"""ApiController Controller Class."""
def __init__(self, request: Request):
"""ApiController Initializer
Arguments:
... |
# Author: Mohit Gangwani
# Date: 11/05/2018
# Git-Hub: Data-is-Life
import pandas as pd
import os
import pickle
# import numpy as np
from random import randint
from sklearn.preprocessing import PolynomialFeatures as MMXs
from sklearn.model_selection import train_test_split
def save_pickle(something, path):
if no... |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.7 on 2017-08-04 18:52
from __future__ import unicode_literals
from django.conf import settings
import django.contrib.postgres.fields
from django.db import migrations, models
import django.db.models.deletion
import uuid
class Migration(migrations.Migration):
ini... |
# Copyright 2020 kubeflow.org.
#
# 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,... |
# Copyright 2016 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... |
# -*- coding: utf-8 -*-
def myfunction():
grains = {}
grains['match'] = 'maker'
return grains
|
from core.advbase import *
from slot.a import *
def module():
return Elias
class Elias(Adv):
a3 = ('lo',0.4)
conf = {}
conf['slots.paralysis.a'] = RR()+Spirit_of_the_Season()
conf['acl'] = """
`dragon
`s1, fsc
`s3, fsc
`s2, fsc
`s4, fsc
`fs, x=4
... |
#!/usr/bin/env python3
# ==============================================================================
# Copyright 2018 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
... |
import os
import sys
import json
from .bittrex import Bittrex
from .market import Market
from .notification import *
from .fakeapi import FakeAPI
from jsmin import jsmin
import threading
from pprint import pprint as pp
class Trader(object):
"""
The object which makes the tick API read calls and dispatches ... |
import os
import random
import sys
"""
Notes:
- While this does the job it just defers the operation of summing
- Let me add a bit more complexity: include a parameter which specifies at what value the sum should begin:
sum_of_list(some_list, start_at=10)
sum_of_list(list(range(1, 10)), start_at=20) should giv... |
from mpi4py import rc
from mpi4py import MPI
|
#!/usr/bin/env python2.7
# Copyright 2018 The Fuchsia Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import argparse
import json
import os
import sys
FUCHSIA_ROOT = os.path.dirname( # $root
os.path.dirname( # build
... |
import asyncio
import discord
from discord.ext import commands
from IreneUtility.util import u_logger as log
from IreneUtility.Utility import Utility
class SelfAssignRoles(commands.Cog):
def __init__(self, ex):
self.ex: Utility = ex
self.error_msg = f"> An error has occurred. Please report it."
... |
"""
Copyright (c) 2019-2020 Intel Corporation
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in w... |
# -*- coding: utf-8 -*-
from pytest import raises
from mock import Mock
from pyee import EventEmitter, PatternException
def test_is_pattern():
ee = EventEmitter()
assert ee._isPattern('a/#')
assert ee._isPattern('a/+/+')
assert not ee._isPattern('a/#/+')
assert not ee._isPattern('a/c+/c')
ass... |
#!/usr/bin/env python3
import unittest
import numpy as np
from panda import Panda
from panda.tests.safety import libpandasafety_py
import panda.tests.safety.common as common
from panda.tests.safety.common import make_msg, MAX_WRONG_COUNTERS
MAX_RATE_UP = 4
MAX_RATE_DOWN = 10
MAX_STEER = 300
MAX_RT_DELTA = 75
RT_INTERV... |
"""Implements VideoFileClip, a class for video clips creation using video files."""
from moviepy.audio.io.AudioFileClip import AudioFileClip
from moviepy.decorators import convert_path_to_string
from moviepy.video.io.ffmpeg_reader import FFMPEG_VideoReader
from moviepy.video.VideoClip import VideoClip
class VideoFil... |
# Calculate cyclomatic complexities for all functions defined in the current program
# @author Ko Nakagawa
# @category CodeAnalysis
# @keybinding
# @menupath
# @toolbar
try:
from ghidra_builtins import *
from typing import List, Dict, Any
except Exception as e:
pass
from ghidra.program.model.listing impor... |
#!/usr/bin/env python3
# Copyright 2016 gRPC 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... |
from interpreter import Interpreter
from lexer import Lexer
from parser_ import Parser
from interpreter import Interpreter
while True:
try:
text = input("clac >")
lexer = Lexer(text)
tokens = lexer.generate_tokens()
parser = Parser(tokens)
tree = parser.parse()
if n... |
from typing import Optional, Any
import torch
import numpy as np
from abc import ABC, abstractmethod
from functools import lru_cache
from slam.common.utils import check_tensor, assert_debug
def torch__spherical_projection(t_pointcloud: torch.Tensor,
height: int,
... |
if __name__ == "__main__":
path = input("Enter a path to file: ")
with open(path, "r", encoding="utf-8") as f:
a = [int(i) for i in f]
count = 0
max_sum = 0
for i in range(len(a) - 1):
for j in range(i + 1, len(a)):
if (a[i] % 160 != a[j] % 160) and ((a[i] % 7 =... |
# 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.
{
'conditions': [
# TODO(stuartmorgan): All dependencies from code built on iOS to
# webkit/ should be removed, at which point this condition c... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
from exoskeleton.__main__ import Exoskeleton
name = "exoskeleton"
__version__ = "0.9.2"
__author__ = "Rüdiger Voigt"
|
from django.conf.urls import url
from .views import OAuthQQURLAPIView,QQAuthUserView
urlpatterns = [
url(r'^qq/statues/$', OAuthQQURLAPIView.as_view()),
url(r'^qq/users/$', QQAuthUserView.as_view()),
] |
"""Configuration settings for eval_policy, evaluating pre-trained policies."""
import sacred
from imitation.scripts.common import common
eval_policy_ex = sacred.Experiment(
"eval_policy",
ingredients=[common.common_ingredient],
)
@eval_policy_ex.config
def replay_defaults():
eval_n_timesteps = int(1e4)... |
import fragmenter
import json
import cmiles
from openeye import oechem, oequacpac
from matplotlib.backends.backend_pdf import PdfPages
import matplotlib.pyplot as plt
import seaborn as sbn
if __name__ == '__main__':
import argparse
parser = argparse.ArgumentParser(description="calculate OE WBO")
parser.ad... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
from lyrics.config import Config
from lyrics.player import Player
from lyrics.window import Window
import sys
import curses
def ErrorHandler(func):
def wrapper(*args, **kwargs):
try:
curses.wrapper(func)
except KeyboardInterrupt:
... |
import time
import random
from os import path
import os
import subprocess
import json
import datetime
import pytest
import cattle
from urlparse import urlparse
REPLICA = 'tcp://localhost:9502'
REPLICA2 = 'tcp://localhost:9505'
BACKUP_DEST = '/data/backupbucket'
VOLUME_NAME = 'test-volume_1.0'
VOLUME_SIZE = str(4 *... |
import unittest
import numpy as np
from numba import autojit
mu = 0.1
Lx, Ly = 101, 101
@autojit
def diffusionObstacleStep(u,tempU,iterNum):
for n in range(iterNum):
for i in range(1, Lx - 1):
for j in range(1, Ly - 1):
u[i,j] = mu * (tempU[i+1,j]-2*tempU[i,j]+tempU[i-1,j] +... |
from unittest import TestCase
from terraform_compliance.common.helper import (
flatten_list,
check_if_cidr,
is_ip_in_cidr,
seek_key_in_dict,
find_root_by_key,
are_networks_same,
convert_resource_type,
seek_regex_key_in_dict_values,
jsonify,
remove_mounted_resources,
get_resou... |
# -*- coding: utf-8 -*-
"""base dumper
:mod:`~dictdumper.dumper` contains :class:`~dictdumper.dumper.Dumper` only,
which is an abstract base class for all dumpers, eg. :class:`~dictdumper.vuejs.VueJS`,
:class:`~dictdumper.json.JSON`, :class:`~dictdumper.plist.PLIST`,
:class:`~dictdumper.tree.Tree`, and :class:`~dictdu... |
from typing import List
import pandas as pd
import numpy as np
from scipy.stats import chisquare
from .parser import Parser
class Check:
"""
Perform data quality check that accompanies metric evaluation in the experiment.
See [Data Quality Checks](../stats/basics.md#data-quality-checks) for details abou... |
"""
This contains exceptions for GeoCube.
"""
class GeoCubeError(RuntimeError):
"""Base GeoCube exception class."""
class VectorDataError(GeoCubeError):
"""This is for errors in the vector data passed into GeoCube."""
|
# coding: utf-8
"""
Pure Storage FlashBlade REST 1.9 Python SDK
Pure Storage FlashBlade REST 1.9 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.9
Contact: i... |
# Copyright 2007 Matt Chaput. 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 the... |
# Copyright (c) Code Written and Tested by Ahmed Emad in 05/02/2020, 00:39
import os
import uuid
from django.contrib.auth.models import User
from django.core.validators import MaxValueValidator, MinValueValidator
from django.db import models
from django.db.models import F, Avg
from . import unique_slugify
def shop... |
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
import numpy as np
def _hparams(algorithm, dataset, random_state):
"""
Global registry of hyperparams. Each entry is a (default, random) tuple.
New algorithms / networks / etc. should add entries here.
"""
SMALL_IMAGES... |
import logging
from cleo import Application, Command
from rich.console import Console
from py_nest_thermostat import __version__
from py_nest_thermostat.auth import Authenticator
from py_nest_thermostat.config import config
from py_nest_thermostat.logger import log
from py_nest_thermostat.nest_api import NestThermost... |
# Copyright 2015 IBM 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 t... |
#!/usr/bin/python
from httputils.router import CurrencyHandler
from httputils import httpmethod
from rpcutils import rpcmethod, error
from wsutils import wsmethod, websocket, topics
from wsutils.broker import Broker
from logger import logger
from .websockets import WebSocket
from .config import Config
from .constants i... |
#
# 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... |
import indicators.rsi.rsi_settings as rsi_settings
from indicators.rsi.rsi_obj import RSI
import ochlv_db.db_settings as db_settings
import sqlite3
import pandas as pd
from tqdm import tqdm
import time
from datetime import datetime
stop_streaming = False
def rsi_fn(n = '-------rsi_idle-------'):
kwargs = {
... |
import pytest
pytestmark = pytest.mark.sphinx('html', testroot='widgets2')
@pytest.mark.parametrize('page', ['index.html', ], indirect=True)
class TestWidgets2:
def test_index(self, page):
# The genericpage doesn't have an acquire for template, so just use
h1 = page.find('h1').contents[0].strip(... |
# 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... |
'''
A module which implements the basic Transformer
'''
import uuid
import threading
import pdb
import torch
from torch import nn
from models.new_attention import NewAttention
from models.attention import MultiHeadedAttention
from models.embeddings import PositionEmbedding, TokenEmbedding
from models.utils import Labe... |
import torchvision
from torchvision.models import resnet as vrn
import torch.utils.model_zoo as model_zoo
from .utils import register
class ResNet(vrn.ResNet):
'Deep Residual Network - https://arxiv.org/abs/1512.03385'
def __init__(self, layers=[3, 4, 6, 3], bottleneck=vrn.Bottleneck, outputs=[5], groups=1, ... |
# Module to process screencaptures and perform OCR Recognition
#-----
from PIL import Image
GAME_REGION = (60, 440, 1040, 1400)
BLACK = (0, 0, 0, 255)
WHITE = (255, 255, 255, 255)
class ScreenCapture:
def __init__(self):
self.screen = Image.open('screencaptures/capture.png')
self.screen.load()
def cro... |
from flask import Flask
from flask import render_template, jsonify, make_response, request
from celery.result import AsyncResult
from celery import Celery
from example.conf import REDIS_ADDRESS, REDIS_PORT
app = Flask(__name__, template_folder="./templates")
celery_app = Celery(
backend=f'redis://{REDIS_ADDRESS}... |
# Modules import
import requests
from requests.auth import HTTPBasicAuth
import json
import time
# Disable SSL warnings. Not needed in production environments with valid certificates
import urllib3
urllib3.disable_warnings()
# Authentication
BASE_URL = 'https://<IP ADDRESS or FQDN>' # Example BASE_URL = 'https://sand... |
'''
A Convolutional Network implementation example using TensorFlow library.
This example is using the MNIST database of handwritten digits
(http://yann.lecun.com/exdb/mnist/)
Author: Aymeric Damien
Project: https://github.com/aymericdamien/TensorFlow-Examples/
'''
from __future__ import print_function
import tensor... |
# -*- coding: utf-8 -*-
#https://www.pythoncentral.io/series/python-sqlalchemy-database-tutorial/
import os
import sys
if not (os.path.dirname(os.path.dirname(__file__)) in sys.path): sys.path.append(os.path.dirname(os.path.dirname(__file__)))
if not (os.path.dirname(__file__) in sys.path): sys.path.append(os.path.dirn... |
#! /usr/bin/env python
# Copyright 2014 Uri Laserson
#
# 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... |
from gevent import monkey
monkey.patch_all()
import os
import sys
import re
import shutil
import gevent
import csv
import zipfile
import boto
import boto.s3
import boto.s3.key
import datetime
import requests
import json
import uuid
import time
import threading
from scalrpy.util import analytics
from scalrpy.util impo... |
import filecmp
import os
import pytest
from triphecta import distances, utils, variant_counts
this_dir = os.path.dirname(os.path.abspath(__file__))
data_dir = os.path.join(this_dir, "data", "distances")
def test_distances_between_vcf_files():
vcf_names_tsv = os.path.join(data_dir, "distances_between_vcf_files.v... |
#!/usr/bin/env python3
# Copyright (c) 2014-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 the getchaintips RPC.
- introduce a network split
- work on chains of different lengths
- join th... |
# pylint: disable=g-bad-file-header
# pylint: disable=superfluous-parens
# Copyright 2017 The Bazel 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:/... |
import scrapy
from dateparser import parse
from gazette.items import Gazette
from gazette.spiders.base import BaseGazetteSpider
class SpJundiaiSpider(BaseGazetteSpider):
TERRITORY_ID = "3525904"
name = "sp_jundiai"
allowed_domains = ["jundiai.sp.gov.br"]
start_urls = ["https://imprensaoficial.jundiai... |
"""
punjabi-cache-frames: frame caching method used in Punjabi dental/retroflex project (Kochetov, Faytak, Nara)
"""
# TODO: actually using?
from __future__ import absolute_import, division, print_function
import argparse
import glob
import numpy as np
import os
import pandas as pd
import re
import struct
import subp... |
# coding=utf-8
from __future__ import print_function
from __future__ import absolute_import
import inspect
import os
import sys
import warnings
from collections import OrderedDict
from clint.textui import puts, colored
from commcare_cloud.cli_utils import print_command
from commcare_cloud.commands.ansible.downtime i... |
# -*- coding: utf-8 -*-
# Define here the models for your scraped items
#
# See documentation in:
# https://doc.scrapy.org/en/latest/topics/items.html
import scrapy
class MlneoItem(scrapy.Item):
# define the fields for your item here like:
# name = scrapy.Field()
pass
|
from django.contrib import admin
from .models import *
from django import forms
from django.contrib.auth.models import Group
import os
from post_office.models import Attachment, Log, Email
# Required for Admin page
from post_office.admin import AttachmentAdmin, LogAdmin,\
EmailAdmin
show_all_models = False
if os.g... |
# Copyright (C) 2019 The Raphielscape Company LLC.
#
# Licensed under the Raphielscape Public License, Version 1.c (the "License");
# you may not use this file except in compliance with the License.
#
""" Userbot initialization. """
import os
from sys import version_info
from logging import basicConfig, getLogger, IN... |
#import findspark
#findspark.init()
from pyspark import SparkConf,SparkContext
from pyspark.streaming import StreamingContext
from pyspark.sql import Row,SQLContext
import sys
import requests
def compute(hashtag):
tags = hashtag.split(',')
for h in tags:
if(len(h)>1):
yield (h,1)
def get_... |
###############################################################################
#
# Tests for XlsxWriter.
#
# Copyright (c), 2013-2021, John McNamara, jmcnamara@cpan.org
#
import unittest
from ...compatibility import StringIO
from ..helperfunctions import _xml_to_list
from ...table import Table
from ...worksheet impor... |
import oauth
from django.http import HttpResponse, HttpResponseRedirect
from django.contrib.auth.models import User, AnonymousUser
from django.contrib.auth.decorators import login_required
from django.template import loader
from django.contrib.auth import authenticate
from django.conf import settings
from django.core.u... |
import re
from typing import List, Union, Tuple, TYPE_CHECKING, Optional, Match
from ..source_ref import SourceRefBase, SegmentedSourceRef
from . import segment_map
if TYPE_CHECKING:
from ..compiler import RDLEnvironment
from typing import Dict
class VerilogPreprocessor:
def __init__(self, env: 'RDLEnvir... |
"""
Relation matrices for ambient modular symbols spaces
This file contains functions that are used by the various ambient modular
symbols classes to compute presentations of spaces in terms of generators and
relations, using the standard methods based on Manin symbols.
"""
#******************************************... |
from SearchAlgorithms import BuscaProfundidadeIterativa
from SearchAlgorithms import BuscaCustoUniforme
from SearchAlgorithms import BuscaGananciosa
from SearchAlgorithms import AEstrela
from Graph import State
import time
import networkx as nx
import random
import csv
class Map(State):
def __init__(self, city, c... |
# Copyright (c) 2017 LINE Corporation
# These sources are released under the terms of the MIT license: see LICENSE
import collections
import concurrent.futures
import datetime
import json
import logging
import platform
import time
from itertools import chain
import prometheus_client
import requests
from prometheus_cl... |
import os
import torch
import torchvision as tv
from torchvision import models
import torch.nn as nn
import numpy as np
from torch.utils.data import DataLoader
from utils import makedirs, tensor2cuda, load_model, LabelDict
from argument import parser
from visualization import VanillaBackprop
from attack import FastGra... |
"""basicforms URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/2.0/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-ba... |
labels = []
labels.append(open(f"Labels_swe/Adina_labels.txt", "r",encoding="utf-8").readlines())
labels.append(open(f"Labels_swe/Christian_labels.txt", "r",encoding="utf-8").readlines())
labels.append(open(f"Labels_swe/Liza_labels.txt", "r",encoding="utf-8").readlines())
labels.append(open(f"Labels_swe/Sofia_label... |
# stdlib
import socket
import time
from typing import Any
from typing import List
# syft absolute
from syft.lib.python import List as SyList
from syft.lib.python.string import String
# relative
from ...syft.grid.duet.process_test import SyftTestProcess
def do_send(data: Any, port: int) -> None:
# syft absolute
... |
#------------------------------
"""Class :py:class:`CMWDBDocEditor` implementation for CMWDBDocsBase
====================================================================
Usage ::
#### Test: python lcls2/psana/psana/graphqt/CMWDBDocEditor.py
# Import
from psana.graphqt.CMWDBDocEditor import *
See:
- :cl... |
# from urllib.parse import urlencode
# from urllib.request import Request, urlopen
import urllib
import urllib2
import sys
import traceback
class Feature_Library_Service_Caller:
def __init__(self, input_filename, output_filename, features, input_type='txt', process=""):
self.input_filename = input_filenam... |
# ******************************************************************************
# Copyright 2017-2018 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apa... |
import os
from datetime import datetime, timezone
import measurement_module as meas
import yaml
import pprint
import time
# import pandas as pd
measurement_starttime = time.perf_counter()
##### Prepare measurement #####
# Open parameters file
try:
with open('params.yaml', 'r') as yamlfile:
params = yam... |
import datetime
import gzip
import inspect
import math
import os
import pickle
import time
import glfw
import numpy as np
import PIL.Image
from . import utilities
from .audio_player import AudioPlayer
from .constants import (
APP_GIF_CAPTURE_COUNT,
APP_GIF_CAPTURE_SCALE,
APP_MEASURE_FRAME_COUNT,
APP_S... |
# -*- coding: utf-8 -*-
import os
import sys
sys.path.insert(0, os.path.abspath(".."))
# -- General configuration ------------------------------------------------
# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
exten... |
#
# PySNMP MIB module RBN-DHCP-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/RBN-DHCP-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 20:44:16 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar 27 2019,... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.