text stringlengths 2 999k |
|---|
import json
import os
import sys
try:
from urllib.parse import urlparse, urlencode
from urllib.request import urlopen, Request, build_opener, HTTPHandler
from urllib.error import HTTPError
except ImportError:
from urlparse import urlparse
from urllib import urlencode
from urllib2 import urlopen... |
# This code is part of Qiskit.
#
# (C) Copyright IBM 2021.
#
# This code is licensed under the Apache License, Version 2.0. You may
# obtain a copy of this license in the LICENSE.txt file in the root directory
# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0.
#
# Any modifications or derivative wo... |
# -*- coding: utf-8 -*-
# ---------------------------------------------------------------------
# ZTE.ZXDSL531.get_dot11_associations
# ---------------------------------------------------------------------
# Copyright (C) 2007-2019 The NOC Project
# See LICENSE for details
# --------------------------------------------... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import datetime
from django.utils.timezone import utc
class Migration(migrations.Migration):
dependencies = [
('bulk', '0006_auto_20150302_1750'),
]
operations = [
migrations.AlterFi... |
import os
import dj_database_url
### Basic config
BASE = os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '..'))
DEBUG = TEMPLATE_DEBUG = True
SITE_ID = 1
SECRET_KEY = 'its-a-secret-to-everybody'
# Until Sentry works on Py3, do errors the old-fashioned way.
ADMINS = []
# General project information
# T... |
from django.db import migrations
from api.user.models import CustomUser
class Migration(migrations.Migration):
def seed_data(apps, schema_editor):
user = CustomUser(
name = 'admin',
email = 'admin@admin.dev',
is_staff = True,
is_superuser = True,
phone = "9876554321",
gender =... |
# Copyright 2019-2020 The Lux 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... |
# INCOMPLETE / UNSUCCESSFUL
# find median of two sorted arrays
import ipdb
class Solution(object):
def findMedianSortedArrays(self, nums1, nums2):
"""
:type nums1: List[int]
:type nums2: List[int]
:rtype: float
"""
n1 = len(nums1)
n2 = len(nums2)
# s... |
import siteScripts.timeout.scraper as timeoutScraper
import logging
from webscraper.models.landmark import Landmark
from webscraper.services.csv import saveLandmarksCSV
def main():
# File to save landmarks
f = "landmarks.csv"
# Scrapers
timeOutLandmarks = timeoutScraper.scrape()
# Save Data
... |
#!/usr/bin/env python
import sys
from typing import Sequence, Set
import argparse
import numpy
import pandas
_zero_svs_are_outliers = True
_outlier_std_threshold = 5.0
_column_order = ["CHROM", "SVTYPE", "Mean", "Median", "STD",
"Outlier_Sample", "Outlier_Number", "Outlier_Cate"]
def read_statfile... |
"""
Copyright (c) 2018-2019 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 i... |
import urllib
import concurrent.futures
import threading |
"""
pysteps.io.exporter
===================
Methods for exporting forecasts of 2d precipitation fields into various file
formats.
Each exporter method in this module has its own initialization function that
implements the following interface::
initialize_forecast_exporter_xxx(filename, startdate, timestep,
... |
from bs4 import BeautifulSoup
import requests
import test
import gspread
from oauth2client.service_account import ServiceAccountCredentials
import datetime
def update_inRange():
print("Today's Date : ",datetime.date.today())
today = datetime.date.today() - datetime.timedelta(1)
yesterday_month = today.st... |
print("Challenge 1:")
# A message for user
message = "This is goind to be tricky ;"
Message = "Very tricky!"
print(message) # show the message on the screen
# Perform mathematical operations
result = 2**3
print("2**3 =", result)
result = 5 - 3
print("5 - 3 =", result)
print("Challenge complete!") |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.conf import settings
from django.db import models
from django.urls import reverse_lazy
from django.utils.translation import ugettext as _
class Blog(models.Model):
"""Blog of blogs"""
BLOG_STATUS = {
('1normal', _('status_pu... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from runner.koan import *
class AboutStringManipulation(Koan):
def test_use_format_to_interpolate_variables(self):
value1 = 'one'
value2 = 2
string = "The values are {0} and {1}".format(value1, value2)
self.assertEqual("The values are... |
# Copyright 2013 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""A "Test Server Spawner" that handles killing/stopping per-test test servers.
It's used to accept requests from the device to spawn and kill instances of ... |
# coding: utf-8
"""
Cloudbreak API
Cloudbreak is a powerful left surf that breaks over a coral reef, a mile off southwest the island of Tavarua, Fiji. Cloudbreak is a cloud agnostic Hadoop as a Service API. Abstracts the provisioning and ease management and monitoring of on-demand clusters. SequenceIQ's Cloud... |
from __future__ import (absolute_import, division, print_function,
unicode_literals)
import six
import functools
import os
import re
import signal
import sys
from six import unichr
import traceback
import matplotlib
from matplotlib._pylab_helpers import Gcf
from matplotlib.backend_bases impor... |
class ClientStorage:
def getAllClients(self):
pass
def postClient(self, name, surname, email):
pass
def delClient(self, id_client):
pass
def patchClient(self, id_client, new_name, new_surname, new_email):
pass
|
#!/usr/bin/env python3
# coding:utf-8
from zipfile import ZipFile
comments = []
filename = "90052"
channel = ZipFile("channel.zip", 'r')
while filename.isdigit():
filename += ".txt"
f = channel.open(filename, 'r')
line = f.readline()
f.close()
t = channel.getinfo(filename).comment
comments.app... |
""" Nom recursive version of fibo. """
# pythran export fibo(int)
# runas fibo(7)
def fibo(n):
""" fibonaccie compuation. """
a, b = 1, 1
for _ in range(n):
a, b = a + b, a
return a
|
import json
import uuid
from enum import Enum
import web3
from eth_account.messages import defunct_hash_message
from web3 import Web3
from common.logger import get_logger
logger = get_logger(__name__)
class ContractType(Enum):
REGISTRY = "REGISTRY"
MPE = "MPE"
RFAI = "RFAI"
class BlockChainUtil(objec... |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2011 Nicira Networks, Inc.
# 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.apac... |
import RPi.GPIO as G
import time as t
G.setmode(G.BCM)
G.setup(19, G.OUT)
G.setup(26, G.IN)# pull_up_down=G.PUD_UP)
G.setup(21, G.OUT)
G.setup(20, G.IN, pull_up_down=G.PUD_UP)
print("setup done")
G.output(21, True)
print("output on")
while True:
input_sensor = G.input(26)
if input_sensor == False:
pri... |
# coding: utf-8
from __future__ import absolute_import
import six
from postfinancecheckout.api_client import ApiClient
class BankAccountServiceApi:
def __init__(self, configuration):
self.api_client = ApiClient(configuration=configuration)
def count(self, space_id, **kwargs):
"""Count
... |
import unittest
"""
Leetcode(https://leetcode.com/problems/container-with-most-water/solution/)
"""
def maxArea(height):
ans = 0
left, right = 0, len(height) - 1
while left < right:
ans = max(ans, min(height[left], height[right]) * (right - left))
if height[left] < height[right]:
... |
# Copyright 2016-2018 Dirk Thomas
# Licensed under the Apache License, Version 2.0
import logging
from pathlib import Path
import sys
from flake8 import LOG
from flake8.api.legacy import get_style_guide
# avoid debug and info messages from flake8 internals
LOG.setLevel(logging.WARN)
def test_flake8():
style_g... |
from sim.signal import Signal, SIG_UNDEF
from sim.sequencer import DEFAULT_SEQUENCER as SEQ
from sim.tests import okeq, okin, setsig, fails
from sim.device.arith import CounterOnebit
counter = CounterOnebit(
'c1b',
t_toggle_0_to_1=3.,
t_toggle_1_to_0=3.,
t_out_2_carry=1.,
t_clear_2_carry=2.,... |
from primitive_object import PrimitiveObject
from null import Null
from rpython.rlib.debug import make_sure_not_resized
class ComplexObject(PrimitiveObject):
__slots__ = ("fields", "size")
_immutable_fields_ = ("fields", "size")
def __init__(self, initial_size):
self.size = initial_size
s... |
#!/usr/bin/env python
from __future__ import unicode_literals
import configargparse
import sys
from config.config import statusCode,benchmark_types, language_supported, file_location
import config.bleu_results as bleu_results
import tools.sp_enc_dec as sp
import ancillary_functions_anuvaad.ancillary_functions as ancill... |
class CellState:
# Don't show these attributes in gui (not used any more?)
excludeAttr = ['divideFlag']
excludeAttr = ['deathFlag']
def __init__(self, cid):
self.id = cid
self.growthRate = 1.0
self.color = [0.5,0.5,0.5]
self.divideFlag = False
self.deathFlag = False
|
import sys
import argparse
import pandas as pd
from PySide2.QtCore import QDateTime, QTimeZone
from PySide2.QtWidgets import QApplication
from lesson_08_main_window import MainWindow
from lesson_08_mainWidget import Widget
def transform_date(utc, timezone=None):
utc_fmt = "yyyy-MM-ddTHH:mm:ss.zzzZ"
new_date... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright 1999-2021 Alibaba Group Holding Ltd.
#
# 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-... |
# Copyright 2021 Huawei Technologies Co., Ltd
#
# 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... |
# coding=utf-8
from app.api.base import base_name as names
from app.api.src.sales import *
from app.api.base.base_router import BaseRouter
class Sales(BaseRouter):
def __init__(self):
super().__init__()
self.args = [names.LOGIN, names.PASSWORD]
def get(self, id_user):
args = {
... |
# -*- coding: utf-8 -*-
'''
Using states instead of maps to deploy clouds
=============================================
.. versionadded:: 2014.1.0 (Hydrogen)
Use this minion to spin up a cloud instance:
.. code-block:: yaml
my-ec2-instance:
cloud.profile:
my-ec2-config
'''
import pprint
from salt... |
'make cuda-convnet batches from images in the input dir; start numbering batches from 7'
import os
import sys
import numpy as np
import cPickle as pickle
from natsort import natsorted
from PIL import Image
from PIL import ImageOps
def process( image ):
image = np.array( image ) # 32 x 32 x 3
image = np.ro... |
# Copyright 2017 MDSLAB - University of Messina
# 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
#
# U... |
from __future__ import division
from __future__ import print_function
import tensorflow as tf
import numpy as np
from itertools import count
import sys
from networks import policy_nn
from utils import *
from env import Env
from BFS.KB import KB
from BFS.BFS import BFS
import time
relation = sys.argv[1]
# episodes = ... |
from django.contrib import admin
from .models import *
admin.site.register(Client)
admin.site.register(ServicesPL)
admin.site.register(MaterialsPL)
admin.site.register(Request)
admin.site.register(ChosenServices)
admin.site.register(ChosenMaterials)
admin.site.register(WorkGroup)
admin.site.register(Executor... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
from caffe2.python import core
import caffe2.python.hypothesis_test_util as hu
import caffe2.python.serialized_test.serialized_test_util as serial
from hypothesis import ... |
import urllib
import json
summ = 0
count = 0
address = 'http://python-data.dr-chuck.net/comments_319811.json'
#raw_input('Enter location: ')
uh = urllib.urlopen(address)
data = uh.read()
#print data
tree = json.loads(data)
#print json.dumps(tree, indent= 4)
for item in tree['comments']:
count = count +1
#pri... |
import pytest
from diofant import (I, Matrix, MutableDenseMatrix, MutableSparseMatrix,
PurePoly, Rational, ShapeError, SparseMatrix, eye, ones,
zeros)
from diofant.abc import x, y, z
__all__ = ()
def test_sparse_matrix():
def sparse_eye(n):
return SparseMatrix.... |
# -*- coding: utf-8 -*-
"""
Tool tests meant to be run with pytest.
Testing whether issue #596 has been repaired.
Note: Platform dependent test. Will only fail on Windows > NT. """
import time
from os import remove
from os.path import join
from moviepy.video.compositing.CompositeVideoClip impo... |
# Generated by Django 2.1 on 2019-02-14 14:05
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('report_builder', '0006_auto_20180413_0747'),
]
operations = [
migrations.AlterField(
model_name='filterfield',
name='f... |
from pyautogui import *
import pyautogui
import time
import keyboard
import random
import win32api, win32con
px = 0
py = 0
class Tile():
def __init__(self,px,py):
self.x = px
self.y = py
def click(x,y):
win32api.SetCursorPos((x,y))
win32api.mouse_event(win32con.MOUSE... |
# coding: utf-8
"""
Isilon SDK
Isilon SDK - Language bindings for the OneFS API # noqa: E501
OpenAPI spec version: 10
Contact: sdk@isilon.com
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
import unittest
import isi_sdk_9_0_0
from ... |
#!/usr/bin/env python3
# Copyright (c) 2018 The Bitcoin Core developers
# Copyright (c) 2019-2021 Xenios SEZC
# https://www.veriblock.org
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test RPC help output."""
from test_framew... |
from importlib import import_module
import re
from copy import deepcopy
from ..utils.data_info import MixinInfo
from .column import Column
from .table import Table, QTable, has_info_class
from ..units.quantity import QuantityInfo
__construct_mixin_classes = ('astropy.time.core.Time',
'as... |
from django.contrib import admin
from django.urls import path, include
from django.conf import settings
from django.conf.urls.static import static
urlpatterns = [
path('admin/', admin.site.urls),
path('', include('posts.urls')),
path('accounts/', include('accounts.urls')),
]
if settings.DEBUG:
urlpatt... |
# -*- coding: utf-8 -*-
#
# Copyright (c) 2017 - 2019 Karlsruhe Institute of Technology - Steinbuch Centre for Computing
# This code is distributed under the MIT License
# Please, see the LICENSE file
#
"""
Created on Sat Aug 10 08:47:51 2019
@author: vykozlov
"""
import unittest
import semseg_vaihingen.models.deepaas... |
"""
Copyright 2013 Steven Diamond, 2017 Akshay Agrawal
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... |
import torch.nn as nn
import torch
import torch.nn.functional as F
from models.pointnet_util import PointNetSetAbstractionMsg,PointNetSetAbstraction,PointNetFeaturePropagation
class get_model(nn.Module):
def __init__(self, num_classes, normal_channel=False):
super(get_model, self).__init__()
if no... |
# Copyright (c) 2020, NVIDIA CORPORATION. All rights reserved.
#
# NVIDIA CORPORATION and its licensors retain all intellectual property
# and proprietary rights in and to this software, related documentation
# and any modifications thereto. Any use, reproduction, disclosure or
# distribution of this software and re... |
from __future__ import print_function
import argparse
import json
import datetime
import pyjq
import yaml
import sys
from netaddr import IPNetwork
from shared.nodes import Account, Region
from shared.query import query_aws, get_parameter_file
class Severity:
# For logging
DEBUG = 0
INFO = 1
WARN = 2
... |
# searchAgents.py
# ---------------
# Licensing Information: Please do not distribute or publish solutions to this
# project. You are free to use and extend these projects for educational
# purposes. The Pacman AI projects were developed at UC Berkeley, primarily by
# John DeNero (denero@cs.berkeley.edu) and Dan Klein ... |
import six
import transmissionrpc
from pytz import reference, utc
from sqlalchemy import Column, Integer, String
from monitorrent.db import Base, DBSession
from monitorrent.plugin_managers import register_plugin
import base64
class TransmissionCredentials(Base):
__tablename__ = "transmission_credentials"
id ... |
'''
Created on Dec 19, 2018
@author: gsnyder
Generate notices report for a given project-version
'''
from blackduck.HubRestApi import HubInstance
import argparse
import json
import logging
import sys
import time
import zipfile
parser = argparse.ArgumentParser("A program to generate the notices file for a given pro... |
from qtpy.QtCore import QSize
from qtpy.QtGui import QIcon
from qtpy.QtWidgets import QListWidget, QListWidgetItem
from pathlib import Path
ICON_ROOT = Path(__file__).parent / "icons"
STYLES = r"""
QListWidget{
min-width: 294;
background: none;
font-size: 8pt;
color: #eee;
}
... |
from collections import defaultdict
from copy import copy
from math import ceil, floor
def parse_item(item):
[num, name] = item.strip().split(' ')
return {}
def filter_zeroes(d):
ret = defaultdict(lambda: 0)
for k, v in d.items():
if v != 0:
ret[k] = v
return ret
output_to_for... |
from django.db import migrations
from ufdl.core_app.migrations import DataMigration
from ufdl.core_app.migrations.job_templates import get_python_job_template_migration
from .job_templates import iterate_job_templates
class Migration(migrations.Migration):
"""
Migration inserting the pre-trained model prese... |
# Copyright 2019 PIQuIL - 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 ... |
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# -----------------------------------------------------------------... |
#!/usr/bin/env python2
# Copyright (c) 2014 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 -reindex with CheckBlockIndex
#
from test_framework import NewcoinTestFramework
from newcoinrpc.authp... |
from django.contrib.auth.models import User
from django.contrib.auth import authenticate, login
from rest_framework import generics
from rest_framework import permissions
from rest_framework.views import status
from rest_framework.response import Response
from rest_framework_jwt.settings import api_settings
from .ser... |
# -*-coding:Utf-8 -*
# Copyright (c) 2010-2017 LE GOFF Vincent
# 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 source code must retain the above copyright notice, this
# ... |
# 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
# d... |
#!/usr/bin/env python
# -- Content-Encoding: UTF-8 --
"""
Tests the ConfigurationAdmin shell commands
:author: Thomas Calmant
"""
# Pelix
import pelix.framework
import pelix.services
import pelix.shell
import pelix.shell.beans as beans
# Standard library
import os
try:
from StringIO import StringIO
except Import... |
"""
Vanilla DenseNet implementation
Paper: https://arxiv.org/abs/1608.06993
Implementation taken from: https://github.com/pytorch/vision/blob/main/torchvision/models/densenet.py
"""
import re
from collections import OrderedDict
from functools import partial
from typing import Any, List, Optional, Tuple
import torch
im... |
# -*- coding: utf-8 -*-
"""module for android forensics."""
import os
import io
import subprocess
import sqlite3
from datetime import datetime
from modules import logger
from modules import manager
from modules import interface
class AndForensicsConnector(interface.ModuleConnector):
NAME = 'andforensics_connecto... |
# -*- coding: utf-8 -*-
# PLEASE DO NOT EDIT THIS FILE, IT IS GENERATED AND WILL BE OVERWRITTEN:
# https://github.com/ccxt/ccxt/blob/master/CONTRIBUTING.md#how-to-contribute-code
from ccxt.base.exchange import Exchange
import math
from ccxt.base.errors import ExchangeError
from ccxt.base.errors import AuthenticationE... |
""" linter and formatter of notebooks
"""
# Copyright (c) 2020 ipyradiant contributors.
# Distributed under the terms of the Modified BSD License.
import json
import shutil
import subprocess
import sys
from hashlib import sha256
from pathlib import Path
import black
import isort
import nbformat
from . import projec... |
#!/usr/bin/env python
from CraftProtocol.Protocol.Packet.BasePacket import BasePacket
from CraftProtocol.Protocol.Packet.PacketDirection import PacketDirection
from CraftProtocol.StreamIO import StreamIO
class KeepAliveServerPacket(BasePacket):
PACKET_ID = 0x0B
PACKET_DIRECTION = PacketDirection.SERVERBOUND
... |
# coding: utf-8
# Copyright (c) 2016, 2021, Oracle and/or its affiliates. All rights reserved.
# This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may c... |
import datetime
import re
class PublicationUtils:
@staticmethod
def get_month(bibtex_entry):
month = bibtex_entry.get("month")
m = None
try:
m = int(month)
except Exception:
pass
try:
m = datetime.datetime.strptime(month, "%b").month
... |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.2 on 2017-06-25 08:45
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('blog', '0018_auto_20170625_1616'),
]
operations = [
migrations.AddField(
... |
import json
import tempfile
import time
from collections import defaultdict
from os import path, remove
import numpy as np
import torch
import torch.distributed as dist
from PIL import Image
from pycocotools.coco import COCO as _COCO
from pycocotools.cocoeval import COCOeval
from pycocotools.mask import encode as mask... |
# Define your item pipelines here
#
# Don't forget to add your pipeline to the ITEM_PIPELINES setting
# See: https://docs.scrapy.org/en/latest/topics/item-pipeline.html
# useful for handling different item types with a single interface
from itemadapter import ItemAdapter
class QuotesAvroPipeline:
def process_it... |
from setuptools import setup
setup(
name="myhello",
version='0.1',
py_modules=['colors'],
include_package_data=True,
install_requires=[
'Click',
'colorama',
],
entry_points='''
[console_scripts]
myhello=hello:cli
''',
)
|
try:
from zcrmsdk.src.com.zoho.crm.api.exception import SDKException
from zcrmsdk.src.com.zoho.crm.api.util import Constants
except Exception:
from ..exception import SDKException
from ..util import Constants
class Argument(object):
def __init__(self):
"""Creates an instance of Argument"""
self.__name = Non... |
#
# Copyright (c) 2021 Citrix Systems, 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... |
import datetime
import math
import requests_cache
from bs4 import BeautifulSoup
from rest_framework import status
from rest_framework.decorators import api_view
from rest_framework.response import Response
from api.modules.holidays.constants import HOLIDAYS_PAGE_URL, HINDI_DAY_STRING_MAP, HINDI_MONTH_STRING_MAP
from ... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import functools
import numpy as np
from .. import Variable
from ..core.utils import (FrozenOrderedDict, Frozen,
NdimSizeLenMixin, DunderArrayMixin)
from ..core import indexing
from... |
# Copyright (c) Microsoft Corporation. All rights reserved.S
# Licensed under the MIT License. See License.txt in the project root for
# license information.
import os
import sys
import logging # noqa: F401
import json
import time
from concurrent.futures import ThreadPoolExecutor
from paho_client import PahoClient
""... |
from typing import TYPE_CHECKING
from django.db import models
from posthog.models.utils import UUIDModel, sane_repr
if TYPE_CHECKING:
from posthog.models.organization import OrganizationMembership
class ExplicitTeamMembership(UUIDModel):
class Level(models.IntegerChoices):
"""Keep in sync with Orga... |
import sys
class PrintUtils:
progress = 0
total_progress = 0
@classmethod
def print_progress_bar(cls, iteration, total, prefix = '', suffix = '', decimals = 1, length = 100, fill = '█', print_end = "\r"):
"""
Call in a loop to create terminal progress bar
@params:
i... |
print('Olá!\nvou te ajudar a calcular o valor do aumento que você receberá.')
sal = float(input('Qual o seu salário atual? \n R$'))
if sal > 1250.00:
print('Seu salário final será de R${:.2f}, pois seu aumento foi de 10%.'.format(sal+sal*0.10))
else:
print('Seu salário final será de R${:.2f}, pois seu aumento f... |
"""
HttpCtrl library provides HTTP/HTTPS client and server API to Robot Framework to make REST API testing easy.
Authors: Andrei Novikov
Date: 2018-2021
Copyright: The 3-Clause BSD License
"""
from http.server import SimpleHTTPRequestHandler
from robot.api import logger
from HttpCtrl.internal_messages... |
from henrio import *
import unittest
class QueueTest(unittest.TestCase):
def test_queue(self):
try:
l = get_default_loop()
q = HeapQueue(50)
print(q)
async def d():
return await q.get()
async def a(i):
await sl... |
'''
samples from all raw data;
by default samples in a non-iid manner; namely, randomly selects users from
raw data until their cumulative amount of data exceeds the given number of
datapoints to sample (specified by --fraction argument);
ordering of original data points is not preserved in sampled data
'''
import a... |
# Author: Kelvin Lai <kelvin@firststreet.org>
# Copyright: This module is owned by First Street Foundation
# Standard Imports
import logging
# Internal Imports
from firststreet.api import csv_format
from firststreet.api.api import Api
from firststreet.errors import InvalidArgument
from firststreet.models.historic imp... |
"""
Cisco Intersight
Cisco Intersight is a management platform delivered as a service with embedded analytics for your Cisco and 3rd party IT infrastructure. This platform offers an intelligent level of management that enables IT organizations to analyze, simplify, and automate their environments in more advan... |
#!/usr/bin/python
# The MIT License (MIT)
#
# Copyright (c) 2017 Oracle
#
# 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 us... |
from django.contrib import admin
from .models import ToDo
admin.site.register(ToDo)
|
"""
Generic RPC functions for labby
"""
# import asyncio
import asyncio
from cgi import print_exception
import os
from pathlib import Path
from typing import Any, Callable, Dict, Iterable, List, Optional, Type, Union
import yaml
from attr import attrib, attrs
from autobahn.wamp.exception import ApplicationError
from ... |
from datetime import date
import dateparser
from scrapy import FormRequest, Request
from gazette.items import Gazette
from gazette.spiders.base import BaseGazetteSpider
class VilaVelhaSpider(BaseGazetteSpider):
name = "es_vila_velha"
allowed_domains = ["www.vilavelha.es.gov.br"]
TERRITORY_ID = "3205200... |
# Configuration file for the Sphinx documentation builder.
#
# This file only contains a selection of the most common options. For a full
# list see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html
# -- Path setup --------------------------------------------------------------
# If ex... |
import os
from nornir.plugins.tasks import networking
THIS_DIR = os.path.dirname(os.path.realpath(__file__))
class Test(object):
def test_netmiko_file_transfer(self, nornir):
source_file = os.path.join(THIS_DIR, "data", "test_file.txt")
dest_file = "test_file.txt"
result = nornir.filter... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.