filename stringlengths 13 19 | text stringlengths 134 1.04M |
|---|---|
the-stack_106_19648 | import yaml, logging, datetime, time
from . import DataModel
from .data import *
from .endpoints import Endpoint
from ..helpers.helpers import ConsulTemplate
class Fqdns(DataCasting, object):
def __init__(self):
super().__init__('fqdn')
self.fqdns = []
for f in self.list():
sel... |
the-stack_106_19649 | #!/usr/bin/env python
from __future__ import print_function
import sys
import subprocess
import socket
try:
import urllib.parse
url_parser = urllib.parse.urlparse
except:
try:
import urlparse
url_parser = urlparse.urlparse
except:
print('urllib or urlparse is needed')
sys.exit(1)
import framewo... |
the-stack_106_19650 | # 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, software
# distributed u... |
the-stack_106_19651 | # Copyright (C) 2016-Present Pivotal Software, Inc. All rights reserved.
#
# This program and the accompanying materials are made available under
# the terms of the 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 Li... |
the-stack_106_19654 | lr_mult = 4
optimizer = dict(type='SGD', lr=0.01, momentum=0.9, weight_decay=0.0005)
optimizer_config = dict(grad_clip=None)
lr_config = dict(
policy='step',
warmup='linear',
warmup_iters=2500,
warmup_ratio=0.001,
step=[55*lr_mult, 68*lr_mult])
total_epochs = 80*lr_mult
checkpoint_config = dict(inte... |
the-stack_106_19658 | # Copyright 2018 Capital One Services, LLC
# Copyright The Cloud Custodian Authors.
# SPDX-License-Identifier: Apache-2.0
import logging
from azure.mgmt.resource.resources.models import GenericResource, ResourceGroupPatchable
from c7n_azure.utils import is_resource_group
class TagHelper:
log = logging.getLogger... |
the-stack_106_19659 | # Copyright 2014 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from pants.base.payload import Payload
from pants.build_graph.target import Target
from pants.contrib.go.targets.go_local_source import GoLocalSource
from pants.contrib.go.targets.go_targ... |
the-stack_106_19660 | # -*- coding: utf-8 -*-
#
# multimeter_file.py
#
# This file is part of NEST.
#
# Copyright (C) 2004 The NEST Initiative
#
# NEST is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 2 of the License... |
the-stack_106_19661 | # -*- coding: utf-8 -*-
# Copyright (c) 2019-2021 Ramon van der Winkel.
# All rights reserved.
# Licensed under BSD-3-Clause-Clear. See LICENSE file for details.
from django.http import Http404
from django.urls import reverse
from django.views.generic import TemplateView
from django.contrib.auth.mixins import User... |
the-stack_106_19664 | from django.urls import path
from django_filters.views import FilterView
from autobuyfast.cars.views import ( # CarLikeFunc,
AllSearchView,
CarCreateView,
CarDeleteView,
CarSold,
CarUpdateView,
CompareCreateView,
CompareView,
car_detail_view,
cars_list_view,
filter_car_search_v... |
the-stack_106_19665 | # Copyright 2016 FUJITSU LIMITED
#
# 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 writ... |
the-stack_106_19667 | import numpy as np
import pandas as pd
import math
from copy import deepcopy
from abc import abstractmethod, ABCMeta
from scipy.interpolate import interp1d
from bids.utils import listify
from itertools import chain
from six import add_metaclass
from bids.utils import matches_entities
@add_metaclass(ABCMeta)
class BID... |
the-stack_106_19668 | #***************************************************************************************************
#
# File Name: gen_support.py
# Application Version: v0.1
# Application Developer: Anastasiia Butko (LBNL)
#
# Software: Task assIGnment mappE... |
the-stack_106_19670 | # -*- coding: utf-8 -*-
# MySQL Connector/Python - MySQL driver written in Python.
# Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
# MySQL Connector/Python is licensed under the terms of the GPLv2
# <http://www.gnu.org/licenses/old-licenses/gpl-2.0.html>, like most
# MySQL Connectors. There ar... |
the-stack_106_19672 | import os, sys
import autograd.numpy as np
from autograd import value_and_grad
from scipy.optimize import minimize
from util import get_median_inter_mnist, Kernel, load_data, ROOT_PATH, jitchol, _sqdist, \
remove_outliers, nystrom_decomp, chol_inv, bundle_az_aw, visualise_ATEs
from joblib import Parallel, delayed
i... |
the-stack_106_19673 | # coding: utf-8
"""
CLOUD API
An enterprise-grade Infrastructure is provided as a Service (IaaS) solution that can be managed through a browser-based \"Data Center Designer\" (DCD) tool or via an easy to use API. The API allows you to perform a variety of management tasks such as spinning up additional serv... |
the-stack_106_19674 | # -*- coding: UTF-8 -*-
# Copyright (c) 2021 PaddlePaddle 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
#
... |
the-stack_106_19675 | """Module with abstract interface for sparsifiers."""
from abc import ABC, abstractmethod
import copy
import numpy as np
import torch
import torch.nn as nn
from torch.distributions.multinomial import Multinomial
class BaseSparsifier(ABC, nn.Module):
"""The basic interface for a sparsifier.
A sparsifier spar... |
the-stack_106_19676 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright © 2017 Apple Inc. All rights reserved.
#
# Use of this source code is governed by a BSD-3-clause license that can
# be found in the LICENSE.txt file or at https://opensource.org/licenses/BSD-3-Clause
import os
import sys
from setuptools import setup, find_pac... |
the-stack_106_19677 | import logging; _L = logging.getLogger('openaddr.ci.collect')
from argparse import ArgumentParser
from urllib.parse import urlparse
from datetime import date
from time import sleep
from os import environ
from .objects import read_latest_set, read_completed_runs_to_date
from . import db_connect, db_cursor, setup_logge... |
the-stack_106_19679 | from bitarray import bitarray
def show(a):
_ptr, size, _endian, _unused, alloc = a.buffer_info()
print('%d %d' % (size, alloc))
a = bitarray()
prev = -1
while len(a) < 2000:
alloc = a.buffer_info()[4]
if prev != alloc:
show(a)
prev = alloc
a.append(1)
for i in 800_000, 400_000, 399_... |
the-stack_106_19681 | #!/usr/bin/env python
import asyncio
import logging
from typing import (
Optional
)
from hummingbot.core.data_type.user_stream_tracker_data_source import UserStreamTrackerDataSource
from hummingbot.logger import HummingbotLogger
from hummingbot.core.data_type.user_stream_tracker import UserStreamTracker
from hummi... |
the-stack_106_19682 | #!/usr/bin/env python3
import argparse, requests, json, pickle, os, sys, subprocess, time, random, http.client, httplib2, datetime
from moviepy.editor import VideoFileClip, concatenate_videoclips
from google_auth_oauthlib.flow import Flow, InstalledAppFlow
from googleapiclient.discovery import build
from googleapiclie... |
the-stack_106_19684 | #!/usr/bin/env python3
#####################################################################
# This script presents how to read and use the sound buffer.
# This script stores a "basic_sounds.wav" file of recorded audio.
# Note: This requires scipy library
###############################################################... |
the-stack_106_19685 | def kafkaSendFiles(
directories, files, basicmetadata, df_metadata, kafkaProducer, kafkaTopic
):
import hashlib
from PIL import Image
import os
from kafka import KafkaProducer
import requests
import json
blobstorage_dir = directories["blobstorage_dir"]
thumbnail_dir = directories[... |
the-stack_106_19686 | from functools import partial
from crispy_forms.helper import FormHelper
from django import forms
from .models import (
Distribution,
Individual,
Household,
)
from workflow.models import (
Office,
Program,
SiteProfile,
)
class DatePicker(forms.DateInput):
"""
Use in form to create a Jq... |
the-stack_106_19687 | #!c:\users\yogeshwar\anaconda3\python.exe
from http.server import HTTPServer, BaseHTTPRequestHandler
import cgi
import logging
import pandas as pd
import json
from src.csv_to_db_package.csv_to_db import csv_to_db_func
from src.csv_to_db_package.crud_operations_db import view_db_data, delete_db_row, insert_db_row,\
... |
the-stack_106_19688 | import json
import os
from typing import List, Mapping, Tuple, Union
import numpy as np
from skimage.io import imread
from slicedimage import ImageFormat
from starfish.experiment.builder import FetchedTile, TileFetcher, write_experiment_json
from starfish.types import Axes, Coordinates, Features, Number
from starfish... |
the-stack_106_19690 | from datetime import datetime
import mock
from farmos_ext import Farm
from farmos_ext.farmobj import FarmObj
@mock.patch("farmos_ext.Farm")
def test_farmobj_empty(mock_farm):
obj = FarmObj(mock_farm, {})
assert not obj.name
assert obj.farm == mock_farm
@mock.patch("farmos_ext.Farm")
def ... |
the-stack_106_19693 | #
# Copyright (c) 2014 Juniper Networks, Inc. All rights reserved.
#
"""
This file contains implementation of dependency tracker
for contrail config daemons
"""
from collections import OrderedDict
# This class tracks dependencies among different objects based on a reaction map.
# Objects could be derived from DBBase... |
the-stack_106_19696 | def visualize_el_preds(data_and_predictions, output_fp='visualization.html'):
f = open(output_fp, 'w+')
for data in data_and_predictions:
inst_type = data['type']
ctx_left = data['context_left']
mention = data['mention']
ctx_right = data['context_right']
# Input
... |
the-stack_106_19698 | import inspect
import os
from unittest.mock import Mock
import pytest
from _pytest.monkeypatch import MonkeyPatch
import hypercorn.__main__
from hypercorn.config import Config
def test_load_config_none() -> None:
assert isinstance(hypercorn.__main__._load_config(None), Config)
def test_load_config_pyfile(monk... |
the-stack_106_19699 | # Copyright 2019 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... |
the-stack_106_19702 | from flask import Blueprint, current_app
from flask import request, send_file, render_template, flash, redirect, url_for
from io import BytesIO
from wlan_api.activation import insert_vouchers_into_database
from wlan_api.generate import generate_vouchers
from wlan_api.pdf import VoucherPrint
from wlan_api.pdf.pdfjam i... |
the-stack_106_19703 | """Top-level package for FastCCD Support IOC."""
__author__ = """Ronald J Pandolfi"""
__email__ = 'ronpandolfi@lbl.gov'
__version__ = '0.1.0'
from . import utils
from caproto.server import PVGroup, get_pv_pair_wrapper
from caproto.server.autosave import autosaved, AutosaveHelper
pvproperty_with_rbv = get_pv_pair_wr... |
the-stack_106_19704 | # Copyright (C) 2018-2021 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
"""Main entry-point to run timetests tests.
Default run:
$ pytest test_timetest.py
Options[*]:
--test_conf Path to test config
--exe Path to timetest binary to execute
--niter Number of times to run executable
[*... |
the-stack_106_19705 | #!/usr/bin/env python
from re import sub
from sys import argv,exit
from os import path,getenv
from glob import glob
import argparse
parser = argparse.ArgumentParser(description='make forest')
parser.add_argument('--region',metavar='region',type=str,default=None)
toProcess = parser.parse_args().region
argv=[]
import RO... |
the-stack_106_19706 | # A handler to manage the data which needs to end up in the ISPyB xml out
# file.
import os
import time
from xia2.Handlers.Files import FileHandler
from xia2.Handlers.Phil import PhilIndex
def sanitize(path):
"""Replace double path separators with single ones."""
double = os.sep * 2
return path.replac... |
the-stack_106_19707 | #!/usr/bin/env python
# -*- 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 ... |
the-stack_106_19708 | #!/usr/bin/env python
# Copyright 2021 Roboception GmbH
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and... |
the-stack_106_19709 | # Copyright 2021 Adobe. All rights reserved.
# This file is licensed to you 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... |
the-stack_106_19710 | """
Support for deCONZ devices.
For more details about this component, please refer to the documentation at
https://home-assistant.io/components/deconz/
"""
import logging
import voluptuous as vol
from homeassistant import config_entries, data_entry_flow
from homeassistant.components.discovery import SERVICE_DECONZ
... |
the-stack_106_19715 | # -*- coding: utf-8 -*-
"""The dynamic output module CLI arguments helper."""
from plaso.lib import errors
from plaso.cli.helpers import interface
from plaso.cli.helpers import manager
from plaso.output import dynamic
class DynamicOutputArgumentsHelper(interface.ArgumentsHelper):
"""Dynamic output module CLI argum... |
the-stack_106_19716 | #!/usr/bin/env python
import glob
import os
import os.path
import sys
if sys.version_info < (3, 6, 0):
sys.stderr.write("ERROR: You need Python 3.6 or later to use mypy.\n")
exit(1)
# we'll import stuff from the source tree, let's ensure is on the sys path
sys.path.insert(0, os.path.dirname(os.path.realpath(... |
the-stack_106_19717 | # Copyright (c) Microsoft Corporation.
# Licensed under the MIT license.
import glob
import os
import re
from typing import List
from shrike.compliant_logging.exceptions import (
PublicValueError,
print_prefixed_stack_trace_and_raise,
)
class StackTraceExtractor:
"""
A class to perform extraction of ... |
the-stack_106_19718 | """
Run by the evaluator, tries to make a GET request to a given server
"""
import argparse
import logging
import os
import random
import socket
import sys
import time
import traceback
import urllib.request
import requests
socket.setdefaulttimeout(1)
import external_sites
import actions.utils
from plugins.plugin_c... |
the-stack_106_19721 | # Copyright 2021 The Commplax 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 agreed to in... |
the-stack_106_19722 | # System configs
GLOBAL_HOST = '0.0.0.0'
LOCAL_HOST = '127.0.0.1'
# Slave configs
MIN_HEARTBEAT_SPAN = 0.2
DEFAULT_HEARTBEAT_SPAN = 3.0
DEFAULT_HEARTBEAT_TOLERANCE = 15.0
DEFAULT_SLAVE_PORT = 7236
# Master configs
MIN_HEARTBEAT_CHECK_SPAN = 0.1
DEFAULT_HEARTBEAT_CHECK_SPAN = 1.0
DEFAULT_MASTER_PORT = 7235
# Two-side... |
the-stack_106_19723 | # -*- coding: utf-8-*-
import random
import re
import jasperpath
import pygame
import time
#mark1
new_word = "KISS"
WORDS = ("%s" %new_word)
PRIORITY = 4
image = 'kiss.png'
size = width, height = 320, 320
red = (255,0,0)
white = (255,255,255)
black = 0, 0, 0
x=0
y=0
def handle(self, text, mic, profile):
self... |
the-stack_106_19724 | import csv
import glob
import os
import xml.etree.ElementTree as ET
import igibson
from igibson.objects.articulated_object import URDFObject
from igibson.utils.assets_utils import download_assets
download_assets()
def get_categories():
dir = os.path.join(igibson.ig_dataset_path, "objects")
return [cat for c... |
the-stack_106_19726 | '''
들어간 차 목록 큐 enter
나온 차 목록 큐 leave
enter 맨 앞의 차가 이미 나왔으면
enter 맨 앞의 차 제거
enter 맨 앞의 차 = leave 맨 앞의 차면
추월 아님
아니면
추월한거임
'''
from collections import deque
import sys
input = sys.stdin.readline
# input
N = int(input())
enter = deque([input().rstrip() for _ in range(N)])
leave = deque([input().rstrip() for ... |
the-stack_106_19727 | import argparse
import torch.nn as nn
from util.misc import *
from util.graph_def import *
from models.nets import ARCHITECTURES
from data.loaders import load_data, DATASETS
from util.schedules import linear_interpolation
from util.hessian import hessian_spectral_norm_approx
parser = argparse.ArgumentParser(formatt... |
the-stack_106_19728 | # -*- coding: utf-8 -*-
import numpy as np
import torch
from torch import nn
from kbcr.models import ComplEx, Multi
from kbcr.models.reasoning import SimpleHoppy
from kbcr.reformulators import LinearReformulator, AttentiveReformulator
import pytest
@pytest.mark.light
def test_multi():
nb_entit... |
the-stack_106_19730 | #!/usr/bin/env python
"""
SETUP.py - Setup utility for TAMOC: Texas A&M Oilspill Calculator
This script manages the installation of the TAMOC package into a standard
Python distribution.
For more information on TAMOC, see README.txt, LICENSE.txt, and CHANGES.txt.
Notes
-----
To install, use:
> python setup.py b... |
the-stack_106_19731 | from collections import defaultdict
from insights.core import filters
from insights.parsers.ps import PsAux, PsAuxcww
from insights.specs import Specs
from insights.specs.default import DefaultSpecs
import pytest
def setup_function(func):
if func is test_get_filter:
filters.add_filter(Specs.ps_aux, "COM... |
the-stack_106_19733 | import os
import mock
import jukebox.scanner
@mock.patch('mutagen.File')
@mock.patch('os.walk')
def test_dir_scanner_scan(walk, File):
walk.return_value = [
('base', [], ['file_name']),
]
File.return_value = {
'title': ['fun1', 'fun2'],
'album': [],
'artist': ['bob'],
}... |
the-stack_106_19734 | # ----------------------------------------------------------------------
# Alcatel.OS62xx.get_vlans
# ----------------------------------------------------------------------
# Copyright (C) 2007-2019 The NOC Project
# See LICENSE for details
# ----------------------------------------------------------------------
# NOC... |
the-stack_106_19735 | # Python file with all essential functions used during CiliateAnnotation program execution
import subprocess
import sys
import datetime
import time
import os.path
import errno
import math
import regex as re
from datetime import datetime
from settings import *
from functools import reduce
#-----------------------------... |
the-stack_106_19736 | '''
Common parameters:
- variant_genotypes <numpy float array of shape (n_variants, n_samples, n_alleles [3])>: For every variant and in the gene
(indexed by the first dimension) and every sample (indexed by the second dimension), what are the three probabilities of
it being either: i) homozygous allele-1, ii) heterozy... |
the-stack_106_19738 | """ Util functions for csgo package
"""
import json
import numpy as np
import re
import subprocess
class AutoVivification(dict):
"""Implementation of perl's autovivification feature. Stolen from https://stackoverflow.com/questions/651794/whats-the-best-way-to-initialize-a-dict-of-dicts-in-python"""
def __ge... |
the-stack_106_19739 | import math, random
import gym
import numpy as np
import torch
import torch.nn as nn
import torch.optim as optim
import torch.autograd as autograd
import torch.nn.functional as F
from common.replay_buffer import ReplayBuffer
import matplotlib.pyplot as plt
env_id = "LunarLander-v2"
env = gym.make(env_id)
class N... |
the-stack_106_19740 | import click
import cv2
import numpy as np
import shutil
from tqdm import tqdm
from pathlib import Path
@click.command()
@click.option("--input-dir", "-i", default="./annotations")
@click.option("--output-dir", "-o", default="./masks")
@click.option("--background-label", "-b", default=0)
@click.option("--removal-targ... |
the-stack_106_19741 | import argparse
import os
import torch
import torch.nn as nn
import torch.utils.data as data
class Configs(object):
@staticmethod
def base_config():
parser = argparse.ArgumentParser()
parser.add_argument("--classifier", type=str, default="vdpwi", choices=["vdpwi", "resnet"])
parser.add... |
the-stack_106_19745 | """fyle_qbo URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/3.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-base... |
the-stack_106_19746 | import easyocr
import sys
sys.path.append("../../")
sys.path.append(".")
import argparse
from common.utility import *
from moviepy.video.io.ffmpeg_reader import FFMPEG_VideoReader
from moviepy.editor import VideoFileClip
def camera_time_pos(camNO):
return load_time_pos_setting(config_folder, camNO)
def getImgTim... |
the-stack_106_19747 | import datetime
from django.db import models
from base.abstracts import AbstractBaseModel
class GeoCoderLog(AbstractBaseModel):
number_of_request = models.IntegerField(default=0)
@classmethod
def get_today_record(cls):
record = cls.objects.filter(
created_at__range=(
d... |
the-stack_106_19749 | #!/usr/bin/env python2.7
import sys
from numpy import *
from pylab import *
from matplotlib import rc, rcParams
dict=sys.argv[1].split("/")[2]
trie = genfromtxt('../data/trie_search_found_' + dict + '.output')
tst = genfromtxt('../data/tst_search_found_' + dict + '.output')
radix = genfromtxt('../data/radix_searc... |
the-stack_106_19754 | #!/usr/bin/env python
import re
from django.core.management.base import BaseCommand
from documents.models import Agency, Document, ProcessedDocument
class Command(BaseCommand):
help = """
Remove CSVs that got added as responsive documents in error.
"""
SKIP_AGENCIES = [
"Redmond Police Depart... |
the-stack_106_19756 | import os
import json
import numpy as np
from naming_conventions import languages, languages_readable
from uriel import Similarities
import uriel
import copy
import pickle
from collections import defaultdict
import matplotlib.pyplot as plt
from scipy import stats
from matplotlib import colors
import seaborn as sns
... |
the-stack_106_19757 | from monsterfactory import MonsterFactory
from character import NPC
import random
class Location:
name = ""
adjacentLocations = []
npcs = []
monsters = []
boss = None
def getName(self):
return self.name
def getNPC(self):
if len(self.npcs) > 0:
return self.npcs[... |
the-stack_106_19761 | import matplotlib.pyplot as plt
import pandas as pd
import numpy as np
# import seaborn as sns
import shutil
import time
import os
os.environ["CUDA_DEVICE_ORDER"] = "PCI_BUS_ID"
os.environ["CUDA_VISIBLE_DEVICES"] = "-1"
import tensorflow as tf
from tensorflow import keras
from tensorflow.keras import layers
print(t... |
the-stack_106_19762 | # -*- coding: utf-8 -*-
"""
emmett_mongorest.serializers
----------------------------
Provides REST serialization tools
:copyright: 2019 Giovanni Barillari
:license: BSD-3-Clause
"""
from emmett_rest.serializers import Serializer as _Serializer
class Serializer(_Serializer):
def __init__(se... |
the-stack_106_19763 | # -*- coding: utf-8 -*-
'''
Management of Linux logical volumes
===================================
A state module to manage LVMs
.. code-block:: yaml
/dev/sda:
lvm.pv_present
my_vg:
lvm.vg_present:
- devices: /dev/sda
lvroot:
lvm.lv_present:
- vgname: my_vg
- ... |
the-stack_106_19764 | # -*- test-case-name: twisted.conch.test.test_manhole -*-
# Copyright (c) Twisted Matrix Laboratories.
# See LICENSE for details.
"""
Asynchronous local terminal input handling
@author: Jp Calderone
"""
import os, tty, sys, termios
from twisted.internet import reactor, stdio, protocol, defer
from twisted.python imp... |
the-stack_106_19765 | #!/usr/bin/env python
## HiCPack
## Author(s): Mohsen Naghipourfar
## Contact: mn7697np@gmail.com or naghipourfar@ce.sharif.edu
## This software is distributed without any guarantee under the terms of the GNU General
## MIT License
"""
Script to keep only valid pairs when no restriction enzyme are used (i.e. DNAse o... |
the-stack_106_19766 | from dama.reg.wrappers import XGB, SKLP
import xgboost as xgb
class Xgboost(XGB):
def prepare_model(self, obj_fn=None, num_steps: int = 0, model_params=None, batch_size: int = None):
data_train = self.ds[self.data_groups["data_train_group"]].to_ndarray()
target_train = self.ds[self.data_groups["t... |
the-stack_106_19767 | import decimal
from typing import (
Tuple,
)
abi_decimal_context = decimal.Context(prec=999)
ZERO = decimal.Decimal(0)
TEN = decimal.Decimal(10)
def ceil32(x: int) -> int:
return x if x % 32 == 0 else x + 32 - (x % 32)
def compute_unsigned_integer_bounds(num_bits: int) -> Tuple[int, int]:
return (
... |
the-stack_106_19769 | from django.conf.urls import url, include
from django.conf.urls.static import static
from django.contrib.auth import views as auth_views
from django.conf import settings
from authentication import views as views
from vehicle import views as v_views
from driver import views as d_views
from accidents import views as a_v... |
the-stack_106_19771 | # coding: utf-8
import re
import six
from huaweicloudsdkcore.sdk_response import SdkResponse
from huaweicloudsdkcore.utils.http_utils import sanitize_for_serialization
class DeleteSecurityGroupResponse(SdkResponse):
"""
Attributes:
openapi_types (dict): The key is attribute name
... |
the-stack_106_19773 | # 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... |
the-stack_106_19774 | # -*- coding: utf-8 -*-
"""
Tencent is pleased to support the open source community by making 蓝鲸智云(BlueKing) available.
Copyright (C) 2017 THL A29 Limited, a Tencent company. All rights reserved.
Licensed under the MIT License (the "License"); you may not use this file except in compliance with the License.
You ma... |
the-stack_106_19775 | """Base class for directed graphs."""
from copy import deepcopy
import networkx as nx
from networkx.classes.graph import Graph
from networkx.classes.coreviews import AdjacencyView
from networkx.classes.reportviews import (
OutEdgeView,
InEdgeView,
DiDegreeView,
InDegreeView,
OutDegreeView,
)
from n... |
the-stack_106_19779 | # Copyright 1997 - 2018 by IXIA Keysight
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"),
# to deal in the Software without restriction, including without limitation
# the rights to use, copy, modify, merge, publish,... |
the-stack_106_19781 | import collections
import logging
import firewall_translator.generic
class Action(firewall_translator.generic.Action):
def __init__(self, allow=False, reply=False, log=False):
if log:
raise NotImplementedError
super(Action, self).__init__(allow, reply, log)
def __repr__(self):
... |
the-stack_106_19782 | import numpy as np
from sklearn.preprocessing import MinMaxScaler
from genomic_neuralnet.config import MAX_EPOCHS, CONTINUE_EPOCHS, TRY_CONVERGENCE, USE_ARAC
from genomic_neuralnet.common.in_temp_dir import in_temp_dir
from fann2 import libfann
LEARNING_RATE = 0.01
_ITERATIONS_BETWEEN_REPORTS = 1000
_DESIRED_ERROR = ... |
the-stack_106_19784 | import re
import numpy as np
import pytest
import qcodes as qc
from qcodes.dataset.descriptions.dependencies import InterDependencies_
from qcodes.dataset.descriptions.param_spec import ParamSpecBase
from qcodes.dataset.measurements import DataSaver
CALLBACK_COUNT = 0
CALLBACK_RUN_ID = None
CALLBACK_SNAPSHOT = None
... |
the-stack_106_19788 | #!/usr/bin/env python
# Skeleton for python-based regression tests using
# JSON-RPC
# Add python-qbitcoinrpc to module search path:
import os
import sys
sys.path.append(os.path.join(os.path.dirname(os.path.abspath(__file__)), "python-qbitcoinrpc"))
import json
import shutil
import subprocess
import tempfile
import ... |
the-stack_106_19790 | """
Author: Francis Chan
Data Transformation for building classification models
"""
from sklearn.base import TransformerMixin, BaseEstimator
import random
import pandas as pd
import numpy as np
from collections import defaultdict
from sklearn.preprocessing import LabelEncoder, OneHotEncoder
from sklearn... |
the-stack_106_19791 | import numpy as np
def _ensure_matrix(x):
"""
Ensures the vector/matrix `x` is in matrix format.
Parameters
----------
x : array_like, shape (n,)
Vector or matrix.
Returns
-------
x : array_like, shape (m, p)
Matrix.
"""
x = np.array(x)
... |
the-stack_106_19792 | # -*- coding: utf-8 -*-
#
# geometric-smote documentation build configuration file, created by
# sphinx-quickstart on Mon Jan 18 14:44:12 2016.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated fil... |
the-stack_106_19793 | from django.test import TestCase
from django.contrib.auth.models import User
from dwitter.models import Dweet
from dwitter.models import Comment
from django.utils import timezone
from datetime import timedelta
class DweetTestCase(TestCase):
def setUp(self):
user1 = User.objects.create(id=1, username="user... |
the-stack_106_19794 | from torch import nn
import torch
import torch.nn.functional as F
from torch.autograd import Variable
from core import resnet, densenet, resnext, mobilenet
import numpy as np
from core.anchors import generate_default_anchor_maps, hard_nms
from config import CAT_NUM, PROPOSAL_NUM
class ProposalNet(nn.Module)... |
the-stack_106_19795 | """
Integration test for the Cornflow client
Base, admin and service user get tested
Integration between Airflow and cornflow through airflow client and cornflow client tested as well
"""
# Full imports
import json
import os
import pulp as pl
import time
# Partial imports
from unittest import TestCase
# Internal impo... |
the-stack_106_19796 | from __future__ import unicode_literals
from io import open
import os
import re
import tempfile
import ttfw_idf
@ttfw_idf.idf_example_test(env_tag="test_jtag_arm")
def test_examples_sysview_tracing_heap_log(env, extra_data):
rel_project_path = os.path.join('examples', 'system', 'sysview_tracing_heap_log')
du... |
the-stack_106_19797 | # 2. Add Two Numbers [Medium]
# You are given two non-empty linked lists representing two non-negative
# integers. The digits are stored in reverse order and each of their nodes
# contain a single digit. Add the two numbers and return it as a linked list.
# You may assume the two numbers do not contain any leadin... |
the-stack_106_19799 | # Imports
import pyttsx3
from time import time, sleep
import unicodedata
# Retrieves wpm speed
rate = int(input('WPM : '))
while not(0 < rate <= 50):
rate = int(input('Please enter a speed between 0 and 50 WPM : '))
# Reads the text of the user in the text.txt file
with open('text.txt', 'r') as f:
string = f.... |
the-stack_106_19803 |
from data import data_info
import numpy as np
import pandas as pd
import sys
import matplotlib.pyplot as plt
import plotly.graph_objects as go
def csv_to_df(csv_file):
data = pd.read_csv(csv_file)
data.rename(columns={data.columns[0]: "Number", data.columns[1]: "x", data.columns[2]: "y"}, inplace=True)
d... |
the-stack_106_19804 | from django.contrib.contenttypes.models import ContentType
from django.db.models import Count, Model
from modelcluster.fields import ParentalKey
from taggit.models import Tag
# The edit_handlers module extends Page with some additional attributes required by
# wagtail admin (namely, base_form_class and get_edit_handle... |
the-stack_106_19805 | from selenium import webdriver
import os, time
# 加载启动项
option = webdriver.ChromeOptions()
option.add_argument('headless')
# 更换头部
option.add_argument('user-agent=Mozilla/5.0 (Linux; Android 6.0; Nexus 5 Build/MRA58N) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3729.169 Mobile Safari/537.36')
# 定义截图地址&图片格式
scree... |
the-stack_106_19806 | # gunicorn config
# gunicorn -c config/gunicorn.py --worker-class sanic.worker.GunicornWorker server:app
bind = '0.0.0.0:8001'
backlog = 2048
workers = 2
worker_connections = 1000
timeout = 30
keepalive = 2
spew = False
daemon = False
umask = 0
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.