code stringlengths 2 1.05M | repo_name stringlengths 5 104 | path stringlengths 4 251 | language stringclasses 1
value | license stringclasses 15
values | size int32 2 1.05M |
|---|---|---|---|---|---|
from unicurses import *
class Console:
def __init__(self):
stdscr = initscr()
noecho()
cbreak()
curs_set(False)
start_color()
use_default_colors()
init_pair( 0, COLOR_WHITE, COLOR_BLACK)
init_pair( 1, COLOR_RED, COLOR_BLACK)
init_pair( 2, COLOR_YELLOW, COLOR_BLACK)
init... | zb89/pyrogue | console.py | Python | unlicense | 1,242 |
#!/usr/bin/env python
import sys
import os
import Pipeline.settings.BiotoolsSettings as BiotoolsSettings
import DPyGetOpt
from Pipeline.core.PipelineTemplate import PipelineTemplate
import Pipeline.core.PipelineUtil as PipelineUtil
from Pipeline.core.PipelineError import PipelineError
from Pipeline.core.PipelineCluster... | kotoroshinoto/Cluster_SimpleJob_Generator | pybin/Pipeline/commands/PipelineTemplateGenerator.py | Python | unlicense | 8,154 |
"""
uhbd_interface.py:
Functions/data necessary to perform a UHBD calculation on a single pdb file.
Core of the batch run suite.
Required files:
pkaS-doinp.inp (in ./inputs/)
pkaS.dat (in ./inputs/)
Version Notes:
0.4.1: Fixed bug: if multiple jobs running, sometimes two jo... | harmsm/uhbd | previous_releases/0.6.0/UhbdInterface.py | Python | unlicense | 11,201 |
from rk.ssh.tunnel import *
| korniichuk/rk | rk/ssh/__init__.py | Python | unlicense | 28 |
import time
import json
import os
# Returns the list of reminders as dict.
# @return reminders - Python Dictionary
def get_reminders():
file = "{}/reminders.json".format(os.path.dirname(os.path.realpath(__file__)))
with open(file, "r") as data_file:
reminders = json.load(data_file)
return reminders... | svimanet/IRC-Bob | modules/reminders.py | Python | unlicense | 1,220 |
#!/usr/bin/python
#
# Frontend for running support related commands on hyperic installations.
#
# Opens as an interactive shell if no parameters are passed, otherwise runs
# the command and parameters that have been passed on the command line.
#
# Enter help to see available commands.
#
#
# Adding a new command is do... | cc14514/hq6 | dist/support/src/main/resources/scripts/support.py | Python | unlicense | 4,294 |
import os
# This function only READS the Commit info.
# There is no point in loading any commit in memory.
# What purpose can that serve? Nothing. (Prove this)
def load(cls, name, path):
try:
with open(path, 'rb') as commit_info_file:
commit_info_dict = pickle.load(commit_info_file.read())
... | arrow-/pitstops | commit.py | Python | unlicense | 862 |
"""
Testing for enumerate_param, enumerate_params, and enumerate_keyed_param
"""
import unittest
import mws
# pylint: disable=invalid-name
class TestParamsRaiseExceptions(unittest.TestCase):
"""
Simple test that asserts a ValueError is raised by an improper entry to
`utils.enumerate_keyed_param`.
"""
... | Bobspadger/python-amazon-mws | tests/test_param_methods.py | Python | unlicense | 4,345 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
###
# Copyright (2016-2019) Hewlett Packard Enterprise Development LP
#
# 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/licen... | HewlettPackard/oneview-ansible | test/test_oneview_ethernet_network_facts.py | Python | apache-2.0 | 4,198 |
# -*- coding: ascii -*-
r"""
:Copyright:
Copyright 2007 - 2015
Andr\xe9 Malo or his licensors, as applicable
:License:
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.... | ndparker/tdi | tdi/tools/htmlform/_adapters.py | Python | apache-2.0 | 4,395 |
__author__ = "Nitin Kumar, Rick Sherman"
__credits__ = "Jeremy Schulman"
import unittest
from nose.plugins.attrib import attr
from mock import patch
import os
from jnpr.junos import Device
from jnpr.junos.facts.swver import facts_software_version as software_version, version_info
from ncclient.manager import Manager,... | dgjnpr/py-junos-eznc | tests/unit/facts/test_swver.py | Python | apache-2.0 | 4,029 |
# Copyright (c) 2016-2017 Dustin Doloff
# Licensed under Apache License v2.0
import argparse
import difflib
import hashlib
import os
import subprocess
import zipfile
# Resets color formatting
COLOR_END = '\33[0m'
# Modifies characters or color
COLOR_BOLD = '\33[1m'
COLOR_DISABLED = '\33[02m' # Mostly just means darke... | quittle/bazel_toolbox | assert/scripts/assert_equal.py | Python | apache-2.0 | 4,276 |
# Copyright 2012, Nachi Ueno, NTT MCL, 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.apache.org/licenses/LICENSE-2.0
#
# Unles... | igor-toga/local-snat | neutron/tests/unit/agent/linux/test_iptables_firewall.py | Python | apache-2.0 | 86,232 |
# coding=utf-8
# Copyright 2021 Google Health Research.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable la... | google/ehr-predictions | ehr_prediction_modeling/mask_manager.py | Python | apache-2.0 | 15,792 |
# Copyright 2022 Google 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 to in writing, ... | google/gazoo-device | gazoo_device/tests/unit_tests/utils/dli_powerswitch_logs.py | Python | apache-2.0 | 1,345 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import re
import sys
if __name__ == '__main__':
sys.path.append('../../')
import json
import logging
import sqlite3
from gchelpers.ip.GeoDbManager import GeoDbManager
from gchelpers.dt import DateTimeHandler
GEO_MANAGER = GeoDbManager()
def splitpath(path, ... | devgc/GcHelpers | gchelpers/db/SqliteCustomFunctions.py | Python | apache-2.0 | 4,308 |
from rest_framework import serializers as ser
from api.base.utils import absolute_reverse
from api.base.serializers import JSONAPISerializer, LinksField, RelationshipField, ShowIfVersion, DevOnly
class PreprintProviderSerializer(JSONAPISerializer):
filterable_fields = frozenset([
'name',
'descri... | cwisecarver/osf.io | api/preprint_providers/serializers.py | Python | apache-2.0 | 3,317 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2012 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
#
# Copyright 2012 Nebula, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# no... | yanheven/console | horizon/middleware.py | Python | apache-2.0 | 8,472 |
# Copyright 2021 Google LLC. 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 a... | GoogleCloudPlatform/mlops-on-gcp | immersion/guided_projects/guided_project_2_solution/models/keras/model.py | Python | apache-2.0 | 11,500 |
# Copyright 2012 Nebula, 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 agree... | mrunge/openstack_horizon | openstack_horizon/dashboards/project/volumes/volumes/tabs.py | Python | apache-2.0 | 1,035 |
import pytest
from api.base.settings.defaults import API_BASE
from osf_tests.factories import (
ProjectFactory,
AuthUserFactory,
PrivateLinkFactory,
)
from osf.utils import permissions
@pytest.fixture()
def admin():
return AuthUserFactory()
@pytest.fixture()
def base_url():
return '/{}nodes/'.fo... | pattisdr/osf.io | api_tests/nodes/views/test_view_only_query_parameter.py | Python | apache-2.0 | 15,854 |
from direct.directnotify import DirectNotifyGlobal
from toontown.toonbase import ToontownBattleGlobals
from toontown.suit import SuitDNA
BattleExperienceAINotify = DirectNotifyGlobal.directNotify.newCategory('BattleExprienceAI')
def getSkillGained(toonSkillPtsGained, toonId, track):
exp = 0
expList = toonSkill... | linktlh/Toontown-journey | toontown/battle/BattleExperienceAI.py | Python | apache-2.0 | 7,187 |
import subprocess, os, zipfile, requests
## Function Download
def download(url, fichier):
pass
fileName = fichier
req = requests.get(url)
file = open(fileName, 'wb')
for chunk in req.iter_content(100000):
file.write(chunk)
file.close()
print("The download is finish !")
## Function Unzip
def unzip(source , ... | dinnozap/MinecraftServerMaker | launch.py | Python | apache-2.0 | 2,078 |
#!/usr/bin/python
# Copyright (c) 2010 OpenStack, 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 ... | tylertian/Openstack | openstack F/glance/setup.py | Python | apache-2.0 | 2,108 |
# coding: utf-8
import random
from PIL import Image
from PIL import ImageDraw
from PIL import ImageFont
import sys
import os
# how many pictures to generate
num = 10
if len(sys.argv) > 1:
num = int(sys.argv[1])
def genline(text, font, filename):
'''
generate one line
'''
w, h = font.getsize(text... | Halfish/lstm-ctc-ocr | 1_generateImage.py | Python | apache-2.0 | 1,086 |
# Copyright 2013-2016 DataStax, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writi... | kishkaru/python-driver | cassandra/policies.py | Python | apache-2.0 | 32,311 |
# Copyright 2016 Google 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.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agree... | wenwei202/terngrad | terngrad/inception/slim/slim.py | Python | apache-2.0 | 1,101 |
from funkybomb import Template, Text
from application.util import route
from templates import documentation
from templates.util import template
@route('/docs/integrations')
@template(documentation.tmpl)
async def docs_integrations_home(req):
tmpl = Template()
tmpl.p + 'Coming soon.'
return {
'co... | glennyonemitsu/funkybomb | website/handlers/docs/integrations.py | Python | apache-2.0 | 634 |
# 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... | dhuang/incubator-airflow | kubernetes_tests/test_kubernetes_pod_operator_backcompat.py | Python | apache-2.0 | 23,072 |
# coding=utf-8
# Copyright 2022 The ML Fairness Gym Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicab... | google/ml-fairness-gym | distributions.py | Python | apache-2.0 | 3,400 |
# -*- coding: utf-8 -*-
# Copyright 2014 Michael Malocha <michael@knockrentals.com>
#
# Expanded from the work by Julien Duponchelle <julien@duponchelle.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 ... | bergonzzi/eracareers | era_scraper/eracareers/middlewares/elasticsearch_new.py | Python | apache-2.0 | 2,816 |
import asyncio
from unittest import mock
import pytest
from multidict import CIMultiDict
from aiohttp.signals import Signal
from aiohttp.test_utils import make_mocked_request
from aiohttp.web import Application, Response
@pytest.fixture
def app():
return Application()
@pytest.fixture
def debug_app():
retu... | playpauseandstop/aiohttp | tests/test_signals.py | Python | apache-2.0 | 3,612 |
#!/usr/bin/env python
# encoding: utf-8
"""
n_queens.py
Created by Shengwei on 2014-07-23.
"""
# https://oj.leetcode.com/problems/n-queens/
# tags: medim / hard, matrix, bit manipulation, generator, dfs, edge cases, bitmap
"""
The n-queens puzzle is the problem of placing n queens on an n×n chessboard such that no t... | CodingVault/LeetCodeInPython | n_queens.py | Python | apache-2.0 | 2,232 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""
-------------------------------------------------------------------------------
Function:
【整理】Python中:self和init__的含义 + 为何要有self和__init__
http://www.crifan.com/summary_the_meaning_of_self_and___init___in_python_and_why_need_them
Author: Crifan
Verison: 2012-11-27
-... | onehao/opensource | pyml/basic/extension/selfkeyword.py | Python | apache-2.0 | 3,171 |
#!/usr/bin/env python
#
# Copyright 2008 the V8 project authors. 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
# noti... | sultan99/online | ONode/Tools/test.py | Python | apache-2.0 | 42,584 |
# -*- coding: utf-8 -*-
import os, io
from setuptools import setup
from SVNOnline.SVNOnline import __version__
here = os.path.abspath(os.path.dirname(__file__))
README = io.open(os.path.join(here, 'README.rst'), encoding='UTF-8').read()
CHANGES = io.open(os.path.join(here, 'CHANGES.rst'), encoding='UTF-8').read()
setu... | sintrb/SVNOnline | setup.py | Python | apache-2.0 | 1,012 |
# Copyright 2016 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 i... | nuagenetworks/nuage-openstack-neutron | nuage_neutron/db/migration/alembic_migrations/versions/newton/expand/c4fb5a76b195_add_switchport_mapping.py | Python | apache-2.0 | 2,371 |
# Copyright 2012-2015 MongoDB, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writin... | mongodb/motor | test/test_environment.py | Python | apache-2.0 | 11,605 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""Tests for the EWF image path specification implementation."""
import unittest
from dfvfs.path import ewf_path_spec
from tests.path import test_lib
class EwfPathSpecTest(test_lib.PathSpecTestCase):
"""Tests for the EWF image path specification implementation."""
def... | manashmndl/dfvfs | tests/path/ewf_path_spec.py | Python | apache-2.0 | 1,121 |
import sys
import urllib2
import HTMLParser
import xml.etree.ElementTree as ET
from logging import getLogger
class Rss(object):
"""A class for handling RSS feeds"""
def __init__(self,url=None):
if not url:
self.url = ''
self.articles = ''
else:
self.url = url
... | rad08d/rssreader_flask | flask_rss/rssapp/rss.py | Python | apache-2.0 | 4,065 |
# Suite B tests
# Copyright (c) 2014-2015, Jouni Malinen <j@w1.fi>
#
# This software may be distributed under the terms of the BSD license.
# See README for more details.
import time
import logging
logger = logging.getLogger()
import hostapd
from utils import HwsimSkip
def test_suite_b(dev, apdev):
"""WPA2-PSK/G... | wangybgit/Chameleon | hostapd-OpenWrt/tests/hwsim/test_suite_b.py | Python | apache-2.0 | 5,735 |
import os
import boto3
from chalice import Chalice
from chalicelib import db
from chalicelib import rekognition
app = Chalice(app_name='media-query')
_MEDIA_DB = None
_REKOGNITION_CLIENT = None
_SUPPORTED_IMAGE_EXTENSIONS = (
'.jpg',
'.png',
)
def get_media_db():
global _MEDIA_DB
if _MEDIA_DB is No... | aws-samples/chalice-workshop | code/media-query/06-web-api/app.py | Python | apache-2.0 | 1,443 |
# 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
# distribu... | digambar15/openstack-iot | iot/conductor/handlers/driver.py | Python | apache-2.0 | 1,411 |
# coding=utf-8
# Copyright 2020 The Google Research Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicab... | google-research/electra | run_finetuning.py | Python | apache-2.0 | 12,663 |
# Copyright 2018 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... | aldian/tensorflow | tensorflow/python/distribute/values.py | Python | apache-2.0 | 60,015 |
def action_comment_load_more(context, action, entity_type, entity_id, last_id, parent_id, **args):
try:
entity = IN.entitier.load_single(entity_type, int(entity_id))
if not entity:
return
output = Object()
db = IN.db
connection = db.connection
container_id = IN.commenter.get_container_id(entity)... | vinoth3v/In | In/comment/page/load_more.py | Python | apache-2.0 | 2,050 |
import unittest, sys
sys.path.extend(['.','..','../..','py'])
import h2o2 as h2o
import h2o_cmd, h2o_import as h2i, h2o_browse as h2b
from h2o_test import find_file, dump_json, verboseprint
expectedZeros = [0, 4914, 656, 24603, 38665, 124, 13, 5, 1338, 51, 320216, 551128, 327648, 544044, 577981,
573487, 576189, 5686... | bikash/h2o-dev | py2/testdir_single_jvm/test_parse_covtype_2.py | Python | apache-2.0 | 3,121 |
import pprint as pp
import pandas as pd
from sklearn.linear_model import Ridge, Lasso
from sklearn.metrics import mean_absolute_error
from sklearn.model_selection import GridSearchCV, KFold, cross_val_score
from sklearn.svm import LinearSVR
from ionyx.contrib import AveragingRegressor
from ionyx.datasets import DataSet... | jdwittenauer/ionyx | tests/averaging_regressor_test.py | Python | apache-2.0 | 1,583 |
# -*- coding: utf-8 -*-
# Copyright 2020 Google 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... | googleapis/python-aiplatform | samples/generated_samples/aiplatform_generated_aiplatform_v1beta1_metadata_service_query_artifact_lineage_subgraph_async.py | Python | apache-2.0 | 1,632 |
import os
from .base import * # NOQA
import dj_database_url
DEBUG = False
TEMPLATE_DEBUG = DEBUG
ADMINS = (
)
DATABASES = {'default': dj_database_url.config()}
LOGGING = {
'version': 1,
'disable_existing_loggers': True,
'filters': {
'require_debug_false': {
'()': 'django.utils.log.R... | kencochrane/scorinator | scorinator/scorinator/settings/prod.py | Python | apache-2.0 | 2,973 |
# -*- 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 agreed to in writing, software
... | easytaxibr/airflow | tests/core.py | Python | apache-2.0 | 93,982 |
class TreeNode:
def __init__(self, x):
self.val = x
self.left = None
class Solution:
def distributeCoins(self, root: TreeNode) -> int:
total = 0
def dfs(node):
if not node:
return 0
L, R = dfs(node.left), dfs(node.right)
... | ccqpein/Arithmetic-Exercises | Distribute-Coins-in-Binary-Tree/DCIBT.py | Python | apache-2.0 | 433 |
#!/usr/bin/env python
from __future__ import absolute_import
from .annotator import Annotator, AnnoTier, AnnoSpan
import re
import pyparsing as pypar
def word_token_regex(disallowed_delimiter):
return pypar.Regex(r"[^\s\n" + re.escape(disallowed_delimiter) + r"]+")
pypar.ParserElement.setDefaultWhitespaceChars(... | ecohealthalliance/EpiTator | epitator/structured_data_annotator.py | Python | apache-2.0 | 5,239 |
import tensorflow as tf
import tensorflow.contrib.slim as slim
import pprint
import os
from datasets import dataset_factory
from dcgan import dcgan_generator, dcgan_discriminator
from train import dcgan_train_step
from tensorflow.python.training import optimizer
from collections import OrderedDict
from utils import g... | lishuwnc/DCGAN | main.py | Python | apache-2.0 | 10,297 |
# Copyright 2014-2016 The Meson development team
# 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 agree... | becm/meson | mesonbuild/mconf.py | Python | apache-2.0 | 12,095 |
#------------------------------------------------------------------------------
# Copyright 2013 Esri
# 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/LICENS... | JudTown17/solutions-geoprocessing-toolbox | data_management/test/test_topographic_tools/TestAddDTEDtoElevationMosaicDataset.py | Python | apache-2.0 | 3,123 |
# Copyright 2022 The Magenta 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 ... | magenta/magenta | magenta/models/onsets_frames_transcription/infer_util_test.py | Python | apache-2.0 | 1,356 |
import uuid
def is_username(val):
"""
If the value parses as a UUID, then it's an ID, not a username.
If it does not parse as such, then it must be a username.
"""
try:
uuid.UUID(val)
return False
except ValueError:
return True
def split_ids_and_usernames(identity_ids... | globusonline/globus-sdk-python | globus_sdk/auth/identity_map.py | Python | apache-2.0 | 7,931 |
#!/usr/bin/python
import logging
import logging.handlers
def setupLogger(log_path, verbose):
logger = logging.getLogger('hive')
logger.setLevel(logging.DEBUG)
logger.propagate = False
fh = logging.handlers.TimedRotatingFileHandler(log_path, when="midnight", backupCount=5)
fh.setLevel(log... | krcooke/hive-home | bin/utils/logger.py | Python | apache-2.0 | 803 |
from django import forms
from aat.models import RecognizerPreTrainedData
class DefaultDetectionForm(forms.Form):
title = "Please specify the directory containing your videos"
#video = forms.FileField(required=True, widget=forms.ClearableFileInput())
video = forms.CharField(widget=forms.TextInput(attrs={'c... | fedjo/thesis | project/aat/forms.py | Python | apache-2.0 | 3,217 |
def init_actions_(service, args):
"""
this needs to returns an array of actions representing the depencies between actions.
Looks at ACTION_DEPS in this module for an example of what is expected
"""
# some default logic for simple actions
return {
'test': ['install']
}
de... | Jumpscale/ays_jumpscale8 | tests/test_services/test_validate_delete_models/actions.py | Python | apache-2.0 | 2,695 |
from python_cowbull_server import error_handler
from flask_helpers.check_kwargs import check_kwargs
class GameMode(object):
"""
A representation of a game mode (complexity, number of digits, guesses allowed, etc.). The
mode contains the following information:
* mode <str> A text name fo... | dsandersAzure/python_cowbull_server | Game/GameMode.py | Python | apache-2.0 | 9,034 |
# Copyright (C) 2016 Matt Griswold <grizz@20c.com>
#
# This file is part of bgpfu
#
# 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 req... | bgpfu/bgpfu | src/bgpfu/prefixlist/simple.py | Python | apache-2.0 | 3,810 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
###############################################################################
# Copyright Kitware 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 ... | sutartmelson/girder | girder/utility/server.py | Python | apache-2.0 | 9,533 |
# Lint as: python3
# Copyright 2021 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 ... | tensorflow/lingvo | lingvo/jax/base_model.py | Python | apache-2.0 | 37,124 |
#
# Copyright (c) 2008-2015 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 l... | mahabs/nitro | nssrc/com/citrix/netscaler/nitro/resource/config/audit/auditmessages.py | Python | apache-2.0 | 6,791 |
# Copyright 2013 OpenStack Foundation
# 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 requ... | vedujoshi/tempest | tempest/api/network/test_floating_ips.py | Python | apache-2.0 | 10,882 |
# coding=utf-8
# Copyright 2022 The Uncertainty Baselines 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 ap... | google/uncertainty-baselines | baselines/jft/experiments/jft300m_vit_base16_finetune_cifar100.py | Python | apache-2.0 | 4,319 |
__all__ = ["Transition"]
class Transition(object):
def __init__(self, startState, nextState, word, suffix, marked):
self.startState = startState
self.nextState = nextState
self.word = word
self.suffix = suffix
self.marked = False
def similarTransitions(self, transition... | otuncelli/turkish-stemmer-python | TurkishStemmer/transitions/__init__.py | Python | apache-2.0 | 516 |
# Copyright 2014 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... | baigk/compass-core | compass/hdsdiscovery/vendors/appliance/plugins/mac.py | Python | apache-2.0 | 1,508 |
import os
import time
from collections import Counter
from re import findall
from unittest import skip
from cassandra import ConsistencyLevel
from ccmlib.common import is_win
from ccmlib.node import Node
from nose.plugins.attrib import attr
from assertions import assert_almost_equal, assert_one
from dtest import Test... | thobbs/cassandra-dtest | repair_tests/incremental_repair_test.py | Python | apache-2.0 | 14,693 |
# -*- coding: utf-8 -*-
"""Test Request Module
This module contains the tests for the OpenRecords `/request` endpoint.
"""
import pytest
from app.models import Requests | CityOfNewYork/NYCOpenRecords | tests/functional/test_requests.py | Python | apache-2.0 | 170 |
import os, types, collections
class EmptyLine(Exception) :
"""Raised when an empty or comment line is found (dealt with internally)"""
def __init__(self, lineNumber) :
message = "Empty line: #%d" % lineNumber
Exception.__init__(self, message)
self.message = message
def __str__(self) :
return self.message... | tariqdaouda/pyGeno | pyGeno/tools/parsers/CSVTools.py | Python | apache-2.0 | 10,715 |
#
# Copyright (c) 2008-2015 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 l... | mahabs/nitro | nssrc/com/citrix/netscaler/nitro/resource/config/appflow/appflowcollector.py | Python | apache-2.0 | 10,726 |
#
# 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
# ... | openstack/heat | heat/tests/test_stack_lock.py | Python | apache-2.0 | 12,477 |
import sys
def dictContains(D, key):
if sys.version_info[0] == 2:
return D.has_key(key)
elif sys.version_info[0] == 3:
return key in D
else:
raise Exception("No support for self.__dictContains for python major " +
"version: {}".format(sys.vers... | Quva/sparkplug | sparkplug/helpers/helpers.py | Python | apache-2.0 | 339 |
# 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... | aam-at/tensorflow | tensorflow/python/eager/benchmarks_test.py | Python | apache-2.0 | 50,309 |
"""Check that required Docker images are available."""
import re
from pipes import quote
from ansible.module_utils import six
from openshift_checks import OpenShiftCheck
from openshift_checks.mixins import DockerHostMixin
NODE_IMAGE_SUFFIXES = ["haproxy-router", "docker-registry", "deployer", "pod"]
DEPLOYMENT_IMAGE... | zhiwliu/openshift-ansible | roles/openshift_health_checker/openshift_checks/docker_image_availability.py | Python | apache-2.0 | 13,335 |
#!/usr/bin/env python3
# Copyright 2019 The Kubernetes 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 appl... | kubernetes/perf-tests | clusterloader2/pkg/prometheus/manifests/dashboards/network.dashboard.py | Python | apache-2.0 | 5,840 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('printy', '0001_initial'),
]
operations = [
migrations.CreateModel(
name='PostItModel',
fields=[
... | jdsolucoes/Ppostit | printy/migrations/0002_auto_20150921_2215.py | Python | apache-2.0 | 967 |
# Copyright 2012 NetApp
# Copyright 2015 Mirantis 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.apache.org/licenses/LICENSE-2.0
#... | redhat-openstack/manila | manila/share/driver.py | Python | apache-2.0 | 45,808 |
from django.db import models
from django.contrib.auth.models import User
from albaproject.settings import MEDIA_ROOT
import pdb
def _upload_to_generic(prefix_path=None, instance=None, field=None, filename=None):
#pdb.set_trace()
if not instance.pk: # generate DB PK if not present
instance... | marcos-sb/quick-openstacked-hadoop | Alba/albaproject/mapred/models.py | Python | apache-2.0 | 2,416 |
# Simple example of reading the MCP3008 analog input channels and printing
import time
import sys
import numpy as np
# Import SPI library (for hardware SPI) and MCP3008 library.
import Adafruit_GPIO.SPI as SPI
import Adafruit_MCP3008
import RPi.GPIO as GPIO
import spidev
# Software SPI configuration:
#CLK = 18
#MIS... | opendatadurban/citizen_sensors | Weather_Station/test_wind_dir.py | Python | apache-2.0 | 2,418 |
from JumpScale import j
from Sheet import *
class Sheets(j.tools.code.classGetBase()):
def __init__(self):
self.__jslocation__ = "j.tools.worksheets"
self.sheets = {}
self.sheetsByCategory = {}
self.sheetNames = []
def new(self, name, nrcols=72, headers=[], category=None):
... | Jumpscale/jumpscale_core8 | lib/JumpScale/tools/worksheets/Sheets.py | Python | apache-2.0 | 3,721 |
# Copyright 2019 The dm_control 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 i... | deepmind/dm_control | dm_control/entities/manipulators/kinova/__init__.py | Python | apache-2.0 | 848 |
import os
import json
from PySide2 import QtCore
from opencmiss.zinc.context import Context
from opencmiss.zinc.material import Material
from mapclientplugins.meshgeneratorstep.model.meshgeneratormodel import MeshGeneratorModel
from mapclientplugins.meshgeneratorstep.model.meshannotationmodel import MeshAnnotationMo... | rchristie/mapclientplugins.meshgeneratorstep | mapclientplugins/meshgeneratorstep/model/mastermodel.py | Python | apache-2.0 | 6,058 |
from django.contrib.auth.models import User
from django.test import TestCase
from dcim.choices import *
from dcim.filters import *
from dcim.models import (
Cable, ConsolePort, ConsolePortTemplate, ConsoleServerPort, ConsoleServerPortTemplate, Device, DeviceBay,
DeviceBayTemplate, DeviceRole, DeviceType, Front... | digitalocean/netbox | netbox/dcim/tests/test_filters.py | Python | apache-2.0 | 132,317 |
'''
@Summary: Utility Methods for dynamic actions during program operation.
@Author: devopsec
'''
import os, sys, socket, inspect
def getWorkingDirs():
''' Returns project dir, parent dir, and current dir of calling script as dict'''
project_dir, parent_dir, current_dir = None
if os.path.exists(os.path.d... | flyballlabs/threatdetectionservice | api/util/dynamic.py | Python | apache-2.0 | 3,841 |
"""Support for Telegram bot using polling."""
import logging
from homeassistant.const import (
EVENT_HOMEASSISTANT_START, EVENT_HOMEASSISTANT_STOP)
from homeassistant.core import callback
from . import (
CONF_ALLOWED_CHAT_IDS, PLATFORM_SCHEMA as TELEGRAM_PLATFORM_SCHEMA,
BaseTelegramBotEntity, initialize_... | jamespcole/home-assistant | homeassistant/components/telegram_bot/polling.py | Python | apache-2.0 | 3,026 |
import re
from django.template import Node, Variable, VariableNode, _render_value_in_context
from django.template import TemplateSyntaxError, TokenParser, Library
from django.template import TOKEN_TEXT, TOKEN_VAR
from django.utils import translation
from django.utils.encoding import force_unicode
register = L... | greggian/TapdIn | django/templatetags/i18n.py | Python | apache-2.0 | 9,355 |
import pytest
import numpy as np
import noisily as ns
# FIXME This has got to be an abuse of fixtures, right?
@pytest.fixture(scope='module', params=[(1, 1), (37, 57), (128, 128)])
def indices2D(request):
shape = request.param
return np.transpose(np.indices(shape))
@pytest.fixture(scope='module', params=[(1... | tocubed/noisily | tests/test_noise.py | Python | apache-2.0 | 2,684 |
# Copyright 2012 Nebula, 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 agree... | openstack/horizon | openstack_dashboard/dashboards/project/instances/tables.py | Python | apache-2.0 | 48,198 |
# Copyright 2021 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import absolute_import
from pex.fetcher import URLFetcher
from pex.network_configuration import NetworkConfiguration
from pex.requirements import Constraint, parse_require... | pantsbuild/pex | pex/resolve/requirement_configuration.py | Python | apache-2.0 | 2,532 |
"""
Tests for the MDK public API that are easier to do in Python.
"""
from time import time
from builtins import range
from past.builtins import unicode
from unittest import TestCase
from tempfile import mkdtemp
from collections import Counter
import configparser
import hypothesis.strategies as st
from hypothesis imp... | datawire/mdk | unittests/test_mdk.py | Python | apache-2.0 | 27,210 |
# Copyright 2016 Cisco 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 agreed to in writin... | ragupta-git/ImcSdk | imcsdk/utils/imcbackup.py | Python | apache-2.0 | 8,595 |
#!/usr/bin/env python
"""
The scripts that compose this module contains a set of functions
needed to process properly a background subtraction of each camera
of a dataset
"""
import cbackground
import cv2
import numpy as np
import sys
from gui import trackbar
from threedgeometry import frameretriever
| lacatus/TFM | bgsubtraction/__init__.py | Python | apache-2.0 | 305 |
import json, time
from pyspider.database.base.taskdb import TaskDB as BaseTaskDB
from .couchdbbase import SplitTableMixin
class TaskDB(SplitTableMixin, BaseTaskDB):
collection_prefix = ''
def __init__(self, url, database='taskdb', username=None, password=None):
self.username = username
self.p... | luoq/pyspider | pyspider/database/couchdb/taskdb.py | Python | apache-2.0 | 3,764 |
""" Created by Max 12/10/2017 """
from ValueIteration import ValueIteration
from Game import Game
x = {(0, 32, -5, -5): None,
(0, 32, -5, -4): None,
(0, 32, -5, -3): None,
(0, 32, -5, -2): None,
(0, 32, -5, -1): None,
(0, 32, -5, 0): None,
(0, 32, -5, 1): None,
(0, 32, -5, 2): None,
(0, 32, -5, 3): None,
(0,... | MaxRobinson/CS449 | project7/extra.py | Python | apache-2.0 | 494,316 |
# Copyright (c) 2016 Ansible, Inc.
# All Rights Reserved.
# Python
import json
# Django
from django.db import models
# Tower
from awx.main.models.base import CreatedModifiedModel, prevent_search
from awx.main.fields import JSONField
from awx.main.utils import encrypt_field
from awx.conf import settings_registry
__a... | GoogleCloudPlatform/sap-deployment-automation | third_party/github.com/ansible/awx/awx/conf/models.py | Python | apache-2.0 | 2,977 |
# -*- coding: utf-8 -*-
# Copyright 2022 Google 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... | googleapis/python-compute | google/cloud/compute_v1/services/region_commitments/pagers.py | Python | apache-2.0 | 5,692 |