text stringlengths 2 999k |
|---|
import os
import json
Environ = os._Environ
def is_on_cloudfoundry(env: Environ=os.environ) -> bool:
return 'VCAP_SERVICES' in env
def load_cups_from_vcap_services(name: str, env: Environ=os.environ) -> None:
'''
Detects if VCAP_SERVICES exists in the environment; if so, parses
it and imports all t... |
from pymongo import MongoClient
from pymongo import ReadPreference
from datetime import datetime, timedelta
class Mongo(MongoClient):
def __init__(self, username, password, host, db='tags', collection='tweets_pipeline_v2'):
uri = f"mongodb://{username}:{password}@{host}/{db}"
super(Mongo, self)._... |
from lk_logger import lk
from examples import t01_simple_examples as t01
from examples import t02_referencing as t02
from examples import t03_fibonacci as t03
from examples import t04_catch_exceptions as t04
from examples import t05_qt_button_click_event as t05
from examples import t06_lambdex_kwargs as t06
""" Rules... |
# Data Preprocessing Template
# Importing the libraries
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
# Importing the dataset
dataset = pd.read_csv('50_Startups.csv')
X = dataset.iloc[:, :-1].values
y = dataset.iloc[:, 4].values
#encoding independent variable state
#from sklearn.preprocessin... |
#!/usr/bin/env python3
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
import argparse
import glob
import multiprocessing
import os
import re
import shutil
import subprocess
import sys
import hashlib
from logger import log
class BaseError(Exception):
"""Base class fo... |
# python3
# Copyright 2018 DeepMind Technologies Limited. 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 re... |
import torch
from torch import nn
from torch.distributions import MultivariateNormal
class Normal(nn.Module):
def __init__(self, num_vars=100):
super(Normal, self).__init__()
self.num_vars = num_vars
self.means = nn.Parameter(torch.zeros(num_vars))
self.std = nn.Parameter(torch.ey... |
import sys
class SortableArray():
def __init__(self, arr):
self.arr = arr
def partition(self, left, right):
# choose right most as pivot
pivot_index = right
# get pivot value for compares
pivot = self.arr[pivot_index]
right -= 1
print(f'left orig: {left} right orig: {right}')
while True:
# move... |
"""
Classes to contextualize math operations in log vs linear space.
"""
from types import MethodType
import numpy as np
from ..exceptions import InvalidBase
__all__ = (
'get_ops',
'LinearOperations',
'LogOperations',
)
# For 2.x, these are ascii strings. For 3.x these are unicode strings.
acceptable... |
# ##### BEGIN GPL LICENSE BLOCK #####
#
# This program 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, or (at your option) any later version.
#
# This program is distrib... |
#!/usr/bin/env python
"""
Example script to register two volumes with VoxelMorph models.
Please make sure to use trained models appropriately. Let's say we have a model trained to register
a scan (moving) to an atlas (fixed). To register a scan to the atlas and save the warp field, run:
register.py --moving mov... |
# This file is part of the pyMOR project (https://www.pymor.org).
# Copyright 2013-2021 pyMOR developers and contributors. All rights reserved.
# License: BSD 2-Clause License (https://opensource.org/licenses/BSD-2-Clause)
import numpy as np
from pymor.algorithms.image import estimate_image_hierarchical
from pymor.al... |
import logging
import hmac
from hashlib import sha256
import os
import urllib
from datetime import datetime
log = logging.getLogger(__name__)
# This warning is stupid
# pylint: disable=logging-fstring-interpolation
def prepend_bucketname(name):
prefix = os.getenv('BUCKETNAME_PREFIX', "gsfc-ngap-{}-".format(os.g... |
from flask import render_template,request,redirect,url_for
from . import main
from ..requests import get_sources,get_articles
from ..models import Sources
#views
@main.route('/')
def index():
'''
view root page function that returns the index the page and its data
'''
sources = get_sources('business')
sports_sour... |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, division, print_function
from marshmallow import fields
from polyaxon_schemas.ml.layers.base import BaseLayerConfig, BaseLayerSchema
class WrapperSchema(BaseLayerSchema):
layer = fields.Nested('LayerSchema')
@staticmethod
def schema_config... |
import pytest
from pages.aplication import Application
def pytest_addoption(parser):
parser.addoption('--browser_name', action='store', default="chrome", help="Choose browser: chrome or firefox")
parser.addoption('--base_url', action='store', default='https://prodoctorov.ru/new/rate/doctor/12/'
... |
class optimType:
REACTION_KO = 1
REACTION_UO = 2
GENE_KO = 3
GENE_UO = 4
MEDIUM = 5
MEDIUM_LEVELS = 6
MEDIUM_REACTION_KO = 7
MEDIUM_REACTION_UO = 8
COMPOSITION = 9
PROTEIN_KO = 10
PROTEIN_UO = 11
types = {1:"Reaction Knockouts",2:"Reaction Under/Over expression", 3:"Gene... |
from enum import Enum
from typing import Optional
from uuid import UUID
from pydantic import BaseModel
from app.models import User, Organization
class DataRoomBase(BaseModel):
name: Optional[str] = None
description: Optional[str] = None
class DataRoomCreateRequest(DataRoomBase):
name: str
class Data... |
import json
import pymongo
from config import *
def response(flow):
global collection
client = pymongo.MongoClient(MONGO_URL)
db = client[WECHAT_XHS_MONGO_DB]
collection = db[WECHAT_XHS_NOTE_MONGO_COLLECTION]
url1 = 'https://www.xiaohongshu.com/sapi/wx_mp_api/sns/v1/search/notes?'
... |
import json
from datetime import datetime, timedelta
from bittrex.bittrex import Bittrex
def TradingAlorythm(command, market, amount, coinname, step, stoploss, key, secret):
TestTrading = Bittrex(key, secret)
period = timedelta(seconds=20)
next_tick = datetime.now() + period
seconds = 20
firstCycl... |
#!/usr/bin/env python3
"""flash.py
Usage:
flash.py [<image>] [options]
flash.py (-h | --help)
Options:
-h --help Show this screen.
--target=<target> Select the target device [default: SAM3x8e].
--erase Erase the target before flashing.
--port=<p> Target device port [default: t... |
#!/bin/env python
#
# Copyright (C) 2014 eNovance SAS <licensing@enovance.com>
#
# 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 r... |
# pylint: disable=too-many-lines
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRe... |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.9 on 2017-09-30 18:08
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('menu', '0005_auto_20170930_1059'),
]
operations = [
migrations.AlterField(
... |
from importlib import import_module
from django.db.models.signals import post_migrate
from django.apps import AppConfig
def default_data_setup(sender, **kwargs):
from django.contrib.auth.models import User
try:
anon = User.objects.get(username='ANONYMOUS_USER')
except User.DoesNotExist:
pr... |
from nltk.util import ngrams
from nltk.corpus import stopwords
from collections import Counter
from .common import get_pp_pipeline
def or_list(booleans):
return True in booleans
def get_ngrams(D):
'''
Returns all ngrams (aka a token containing a dollar sign ($)) from a set of topics or documents
:par... |
import collections
import copy
import logging
import time
from abc import abstractmethod
from ...scheduler import HyperbandScheduler, RLScheduler, FIFOScheduler
from ...scheduler.seq_scheduler import LocalSequentialScheduler
from ...utils import in_ipynb, try_import_mxnet
from ...utils.utils import setup_compute
__al... |
def load_pheno_file(pheno_file):
import os
import pandas as pd
if not os.path.isfile(pheno_file):
err = "\n\n[!] CPAC says: The group-level analysis phenotype file "\
"provided does not exist!\nPath provided: %s\n\n" \
% pheno_file
raise Exception(err)
wi... |
import sys
# -------
# Pythons
# -------
# Syntax sugar.
_ver = sys.version_info
#: Python 2.x?
is_py2 = (_ver[0] == 2)
#: Python 3.x?
is_py3 = (_ver[0] == 3)
if is_py2:
from urlparse import urlparse
from urllib import quote
from urlparse import urljoin
import pytz as timezone
from email import... |
"""motiv synchronization primitives
Module:
Using a uniform interface to define synchronization
primitives helps us use multiple execution frameworks
without changing any of the code written.
for example, multiprocessing vs threading.
"""
import abc
class SystemEvent(abc.ABC):
"""Event abstract ... |
from django.db import models
from django.contrib.auth.models import AbstractBaseUser
from django.contrib.auth.models import PermissionsMixin,BaseUserManager
# Create your models here.
class UserProfileManager(BaseUserManager):
"""Manager for user profiles """
def create_user(self,email,name,password=None):
... |
"""Rule generation utilities."""
load("@org_tensorflow//tensorflow:tensorflow.bzl", "if_not_windows", "tf_binary_additional_srcs", "tf_cc_binary", "tf_copts")
load("//tensorflow_decision_forests/tensorflow:utils.bzl", "rpath_linkopts_to_tensorflow")
def py_wrap_yggdrasil_learners(
name = None,
learner... |
"""
Input: tsv file in the form
Input Video filename | topic | subtopic | title greek | title english | start time | end time | delete segments
input.mp4 | 1 | 1 | έξοδος | output | 00:10:05 | 00:30:10 | 00:11:15-00:12:30,00:20:35-00:22:10
"""
import os
import subprocess
import sys... |
# Copyright 2019 Amazon.com, Inc. or its affiliates. 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. A copy of the License is located at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# or in the "license" file... |
#!/usr/bin/env python
from threading import Timer,Thread
import RPIO
from RPIO import PWM
import paramiko
import json
import sys
from time import time, sleep
from relaxxapi.relaxxapi import relaxx
r = None
sftp_base_path = "/home/shack/music"
button = 4
loud1 = 21
loud2 = 22
state = 0
def init_state():
state =... |
import numpy as np
from qtpy.QtCore import Qt
from qtpy.QtWidgets import QComboBox, QDoubleSpinBox, QLabel
from ...layers.utils._color_manager_constants import ColorMode
from ...utils.translations import trans
from ..utils import qt_signals_blocked
from ..widgets.qt_color_swatch import QColorSwatchEdit
from .qt_layer_... |
# coding: utf-8
"""
Isilon SDK
Isilon SDK - Language bindings for the OneFS API # noqa: E501
OpenAPI spec version: 4
Contact: sdk@isilon.com
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
import unittest
import isi_sdk_8_0_1
from i... |
from dash import dcc, html
from dash.dependencies import Input, Output
from app import app
from layouts import index, record, watch, replay, about
# from examples.run import callback_example
from callbacks.record import *
from callbacks.watch import *
from callbacks.replay import *
layout = html.Article([
dcc.Loc... |
import numpy as np
import pandas as pd
import os
import random
import math
from itertools import repeat
import itertools
import sys, copy, shutil
import subprocess
from multiprocessing.dummy import Pool
from collections import defaultdict
import copy
import random
import matplotlib.pyplot as plt
try:
from collec... |
# --------------------------------------------------------
# Tensorflow Faster R-CNN
# Licensed under The MIT License [see LICENSE for details]
# Written by Jiasen Lu, Jianwei Yang, based on code from Ross Girshick
# --------------------------------------------------------
from __future__ import absolute_import
from __... |
import click
from flask.cli import FlaskGroup
from . import create_app
@click.group(cls=FlaskGroup, create_app=create_app)
def main():
"""Management script for the python_project_template application."""
if __name__ == "__main__": # pragma: no cover
main()
|
import pytorch_lightning as pl
from loss.loss import get_loss
from optimizer.optimizer import get_optimizer
from scheduler.scheduler import get_scheduler
import torch
import numpy as np
from pytorch_lightning.metrics import Accuracy
import segmentation_models_pytorch as smp
from utils.utils import load_obj
import alb... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""Analyze CSV file into scores.
Created on Sat Feb 12 22:15:29 2022 // @hk_nien
"""
from pathlib import Path
import os
import re
import sys
import pandas as pd
import numpy as np
PCODES = dict([
# Regio Noord
(1011, 'Amsterdam'),
(1625, 'Hoorn|Zwaag'),
... |
# -*- coding: utf-8 -*-
"""Loan Qualifier Application.
This is a command line application to match applicants with qualifying loans.
Example:
$ python app.py
"""
from re import T
import sys
import fire
import questionary
from pathlib import Path
import csv
from qualifier.utils.fileio import (
load_csv,
... |
from collections import defaultdict
from datetime import date, datetime, timedelta
from typing import Dict, List, Set, Tuple
from functools import lru_cache
from copy import copy
import traceback
import numpy as np
import plotly.graph_objects as go
from plotly.subplots import make_subplots
from pandas import DataFrame... |
# Copyright 2020 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from pathlib import Path
import pytest
from pants.backend.codegen.export_codegen_goal import ExportCodegen
from pants.backend.codegen.export_codegen_goal import rules as write_codegen_ru... |
from collections import defaultdict
from operator import itemgetter
# python -m movies_recommender.RecommenderSVD
from movies_analyzer.Movies import Movies
from movies_analyzer.RecommendationDataset import RecommendationDataSet
from movies_recommender.Recommender import Recommender
from surprise import SVD, KNNBasic
... |
"""
Copyright 2019 Glen Harmon
MNTNER Object Description
https://www.ripe.net/manage-ips-and-asns/db/support/documentation/ripe-database-documentation/rpsl-object-types/4-3-descriptions-of-secondary-objects/4-3-4-description-of-the-mntner-object
"""
from .rpsl import Rpsl
class Maintainer(Rpsl):
def __init__(... |
from django.db.models import query
from .query import SafeDeleteQuery
from functools import partial, reduce
from django.db.models.constants import LOOKUP_SEP
from django.db.models import Max, Min, F
from django.utils.module_loading import import_string
def get_lookup_value(obj, field):
return reduce(lambda i, f:... |
import numpy as np
from itertools import product
from markovGames.gameDefs.mdpDefs import Policy
def getAllDetPol(numStates, numActions):
detProbs = [np.array([1 if j == i else 0 for j in range(numActions)]) for i in range(numActions)]
return product(detProbs, repeat=numStates)
def getPolList(states, acSet)... |
#!/usr/bin/env python
# ----------------------------------------------------------------------- #
# Copyright 2017, Gregor von Laszewski, Indiana University #
# #
# Licensed under the Apache License, Version 2.0 (the "License"); you ... |
# -*- coding: utf-8 -*-
"""
Created on Mon Feb 06 11:19:04 2012
Program to open a dialog box and get a file, check the file name and send it
along with the serienummer
@author: a001109
Updated: 191010 MHan, Updated for Svea profiles and new CTD.
"""
def checkCtdFileName(ctd=None, confile='.XMLCON'):
import Tkin... |
# Copyright 2017 Battelle Energy Alliance, LLC
#
# 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... |
# 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... |
from hikyuu import PG_FixedPercent
# 部件作者
author = "fasiondog"
# 版本
version = '20200825'
def part(p=0.2):
return PG_FixedPercent(p)
part.__doc__ = PG_FixedPercent.__doc__
if __name__ == '__main__':
print(part()) |
# coding: utf-8
"""
Kubernetes
No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
OpenAPI spec version: v1.11.1
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
import os
import sys
i... |
from fineract.objects.fineract_object import DataFineractObject
from fineract.objects.types import Type
class Group(DataFineractObject):
"""
This class represents a Group.
"""
def __repr__(self):
return self.get__repr__({'group_id': self.id})
def _init_attributes(self):
self.id = ... |
import logging
import requests
from django.conf import settings
from .base import BaseSmsClient
logger = logging.getLogger("notifier")
class CGSmsClient(BaseSmsClient):
@classmethod
def send(cls, number: str, text: str, **kwargs):
sub_account = settings.NOTIFIER["SMS"]["GATEWAYS"]["CGS"]["SUB_ACCO... |
#!/usr/bin/python
#
# Author: Jashua R. Cloutier (contact via https://bitbucket.org/senex)
# Project: http://senexcanis.com/open-source/cppheaderparser/
#
# Copyright (C) 2011, Jashua R. Cloutier
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted ... |
# 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... |
#!/usr/bin/env python3
import argparse
import codecs
import sys
def transform(i,o):
for line in i:
if len(line.strip()) == 0:
continue
key, trans = line.strip().split(None, 1)
ntrans = []
for t in trans.split():
if t.startswith("<"):
continu... |
#!/Users/erol/Code/2.7/bin/python
#Change this before running
import sys, getopt, glob, csv
from math import sqrt
from Bio import Struct
from Bio.Struct.Geometry import center_of_mass
from Bio.PDB import *
import numpy as np
def string_to_float(val):
try:
return float(val)
except ValueError as e:
raise
... |
# -*- coding: utf-8 -*-
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: addressbook.proto
import sys
_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from google.protobuf... |
"""
Small helpers for code that is not shown in the notebooks
"""
from sklearn import neighbors, datasets, linear_model
import pylab as pl
import numpy as np
from matplotlib.colors import ListedColormap
# Create color maps for 3-class classification problem, as with iris
cmap_light = ListedColormap(['#FFAAAA', '#AAFF... |
# -*- coding: utf-8 -*-
# Scrapy settings for iwata project
#
# For simplicity, this file contains only settings considered important or
# commonly used. You can find more settings consulting the documentation:
#
# https://doc.scrapy.org/en/latest/topics/settings.html
# https://doc.scrapy.org/en/latest/topics/... |
# Copyright 2020 BlueCat Networks (USA) Inc. and its affiliates
#
# 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 applicabl... |
#!/usr/bin/python
# Copyright (c) 2020, 2022 Oracle and/or its affiliates.
# This software is made available to you under the terms of the GPL 3.0 license or the Apache 2.0 license.
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
# Apache License v2.0
# See LICENSE.TXT for d... |
from app import app
app.run(app.config['HOST'], app.config['PORT'], app.config['DEBUG'])
|
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""
Fortnite replay api blueprint
"""
|
s3gis_tests = load_module("tests.unit_tests.modules.s3.s3gis")
s3gis = s3gis_tests.s3gis
def test_KMLLayer():
current.session.s3.debug = True
current.request.utcnow = datetime.datetime.now()
s3gis_tests.layer_test(
db,
db.gis_layer_kml,
dict(
name = "Test KML",
... |
from .models import Character, Faction, Ship
__author__ = 'ekampf'
def initialize():
human = Character(name='Human')
human.put()
droid = Character(name='Droid')
droid.put()
rebels = Faction(id="rebels", name='Alliance to Restore the Republic', hero_key=human.key)
rebels.put()
empire =... |
import logging
import time
import json
from collections import defaultdict
import tqdm
import click
from django.utils import timezone
from django.db import transaction, connection
from django.db.models import Q
from django.contrib.auth import get_user_model
import rssant_common.django_setup # noqa:F401
from rssant_a... |
#!/usr/bin/env python
import webapp2
from google.appengine.api import app_identity
from google.appengine.api import mail
from conference import ConferenceApi
class SetAnnouncementHandler(webapp2.RequestHandler):
def get(self):
"""Set Announcement in Memcache."""
header = self.request.headers.get('... |
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.autograd import Variable
def pad_to_shape(this, shp):
"""
Not a very safe function.
"""
return F.pad(this, (0, shp[3] - this.shape[3], 0, shp[2] - this.shape[2]))
class First(nn.Module):
def __init__(self... |
"""Run decoding analyses in sensors space accross memory content and
visual perception for the working memory task and save decoding performance"""
# Authors: Romain Quentin <rom.quentin@gmail.com>
# Jean-Remi King <jeanremi.king@gmail.com>
#
# License: BSD (3-clause)
import os
import os.path as op
import nu... |
# Copyright 2019-2020 Amazon.com, Inc. or its affiliates. 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. A copy of
# the License is located at
#
# http://aws.amazon.com/apache2.0/
#
# or in the "license" fil... |
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
from sklearn.metrics import roc_curve, auc
__author__ = "Aurélien Massiot"
__credits__ = "https://github.com/octo-technology/bdacore"
__license__ = "Apache 2.0"
def plot_confusion_matrix(confusion_matrix, classes_list, normalize=True, figsize=(1... |
urlpatterns = []
handler404 = "csrf_tests.views.csrf_token_error_handler"
|
"""
Sust Global Climate Explorer API
This API provides programmatic access to physical risk exposure data. For more guidance on using this API, please visit the Sust Global Dev Center: https://developers.sustglobal.com. # noqa: E501
The version of the OpenAPI document: beta
Generated by: https://op... |
#!/usr/bin/env python
# -*- encoding: utf-8 -*-
#
# Copyright © 2012 eNovance <licensing@enovance.com>
#
# Author: Julien Danjou <julien@danjou.info>
#
# 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 Lice... |
# -*- coding: utf-8 -*-
import re
import unittest
from setuptools import setup
def my_test_suite():
"""From http://stackoverflow.com/questions/17001010/.
"""
test_loader = unittest.TestLoader()
test_suite = test_loader.discover('tests', pattern='test_*.py')
return test_suite
with open('rebin.p... |
# Copyright (c) 2008,2015,2016,2017,2018,2019 MetPy Developers.
# Distributed under the terms of the BSD 3-Clause License.
# SPDX-License-Identifier: BSD-3-Clause
"""Contains a collection of thermodynamic calculations."""
import warnings
import numpy as np
import scipy.integrate as si
import scipy.optimize as so
from... |
# TODO: maybe make this flexible
|
#!/usr/bin/env python
"""
A very simple progress bar which keep track of the progress as we consume an
iterator.
"""
import os
import signal
import time
from prompt_toolkit import HTML
from prompt_toolkit.key_binding import KeyBindings
from prompt_toolkit.patch_stdout import patch_stdout
from prompt_toolkit.shortcuts ... |
#!/usr/bin/env python
# encoding: utf-8
import os
import sqlite3 as lite
import sys
import json
import time
import urllib.request
import tweepy
from TwitterMiner_Keys import *
from tweepy import OAuthHandler
from TwitterMiner_settings import *
import hashlib
#from Twitter_validate import validate_image
def dump_hash... |
# Generated by Django 3.1.3 on 2021-03-13 11:57
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
import django.utils.timezone
class Migration(migrations.Migration):
initial = True
dependencies = [
migrations.swappable_dependency(settings.AUT... |
# This file is part of Indico.
# Copyright (C) 2002 - 2019 CERN
#
# Indico is free software; you can redistribute it and/or
# modify it under the terms of the MIT License; see the
# LICENSE file for more details.
from __future__ import unicode_literals
from datetime import date, datetime, time, timedelta
from functoo... |
# 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 u... |
from itertools import product
import math
from collections import OrderedDict
from pathlib import Path
import logging
import pandas as pd
import numpy as np
import geopandas as gpd
import shapely.geometry as sg
import googlemaps
# Configure logging
logger = logging.getLogger()
handler = logging.StreamHandler()
forma... |
import unittest
import gevent
from gevent import sleep
from gevent.queue import Queue
import mock
from locust import events
from locust.core import Locust, TaskSet, task
from locust.exception import LocustError
from locust.main import parse_options
from locust.rpc import Message
from locust.runners import LocalLocust... |
import os
import datetime
import hashlib
import pexpect
from config import *
from common import openssl, jsonMessage, gencrl
from OpenSSL import crypto
# 通过证书文件吊销证书
def revokeFromCert(cert):
# 读取证书数据
try:
x509_obj = crypto.load_certificate(crypto.FILETYPE_PEM, cert)
# get_serial_number返回10进制的s... |
# SPDX-FileCopyrightText: 2021 ladyada for Adafruit Industries
# SPDX-License-Identifier: MIT
import time
from board import SCL, SDA
import busio
from adafruit_neotrellis.neotrellis import NeoTrellis
# create the i2c object for the trellis
i2c_bus = busio.I2C(SCL, SDA)
# create the trellis
trellis = Ne... |
# @file VariableFormat_Test.py
# Unit test harness for the VariableFormat module/classes.
#
##
# Copyright (c) 2017, Microsoft Corporation
#
# 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. Redi... |
# Copyright (c) 2015 Mirantis, 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... |
# 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... |
import random
x=random.random()
print("The Random number is",round(x,3))
|
# Copyright 2019 Nokia
# 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, softwar... |
from ent2id.Ent2Id import *
|
# -*- coding: utf8 -*-
# Copyright (c) 2017-2018 THL A29 Limited, a Tencent company. 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... |
# Licensed to Elasticsearch B.V. under one or more contributor
# license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright
# ownership. Elasticsearch B.V. licenses this file to you under
# the Apache License, Version 2.0 (the "License"); you may
# not use this f... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.