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 |
|---|---|---|---|---|---|
# -*- coding: utf-8 -*-
from mock import MagicMock, patch
from zerver.lib.test_classes import WebhookTestCase
from zerver.lib.webhooks.git import COMMITS_LIMIT
class GogsHookTests(WebhookTestCase):
STREAM_NAME = 'commits'
URL_TEMPLATE = "/api/v1/external/gogs?&api_key={api_key}&stream={stream}"
FIXTURE_DI... | tommyip/zulip | zerver/webhooks/gogs/tests.py | Python | apache-2.0 | 7,979 |
from __future__ import unicode_literals
import re
from setuptools import find_packages, setup
def get_version(filename):
with open(filename) as fh:
metadata = dict(re.findall("__([a-z]+)__ = '([^']+)'", fh.read()))
return metadata['version']
setup(
name='Mopidy-GPIOcont',
version=get_v... | JasperGerth/Mopidy-GPIOcont | setup.py | Python | apache-2.0 | 1,323 |
# Copyright 2014 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
import os
from collections import namedtuple
from textwrap import dedent
from pants.base.build_file import BuildFile
from pants.base.file_system_project_tree import FileSystemProjectTree
... | wisechengyi/pants | tests/python/pants_test/build_graph/test_build_file_parser.py | Python | apache-2.0 | 16,934 |
#!/usr/bin/env python
# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
### BEGIN LICENSE
# Copyright (C) 2013 <Zane Swafford> <zane@zaneswafford.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 o... | Snesi/spindl | setup.py | Python | apache-2.0 | 5,807 |
# -*- 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... | googleads/google-ads-python | google/ads/googleads/v8/resources/types/campaign_audience_view.py | Python | apache-2.0 | 1,547 |
# -*- coding: utf-8 -*-
# Copyright (c) 2015-2016 MIT Probabilistic Computing Project
# 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... | probcomp/cgpm | src/mixtures/relevance.py | Python | apache-2.0 | 11,300 |
# Copyright 2015 Cisco Systems, 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 requi... | vganapath/rally | tests/unit/plugins/openstack/scenarios/swift/test_objects.py | Python | apache-2.0 | 8,874 |
# 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... | alshedivat/tensorflow | tensorflow/contrib/rnn/python/ops/lstm_ops.py | Python | apache-2.0 | 25,081 |
import cv2
import numpy as np
import CutFaces as cf
import json
from scipy import interpolate
import random
#convert 3-chaneles image to 1-channel mat summed from 3-channels by mod 255
def GetTwoDimMatrix(img):
height, width, channels = img.shape
twoDim = np.zeros((height, width,1));
for i in range(0,height):
fo... | inventive-seven/FaceSplielen | Source/FaceTransform/FaceTransform/FaceTransform.py | Python | apache-2.0 | 6,788 |
#!/usr/bin/env python
# coding=utf8
# Copyright 2015 Syfun
#
# 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 ... | syfun/pweby | pweby/exception.py | Python | apache-2.0 | 2,680 |
"""
Dummy data for Resource testcases.
"""
import mock
import unittest
import upapi.base
import upapi.scopes
class TestResource(unittest.TestCase):
def setUp(self):
"""
Initialize some data for an UP app.
"""
self.app_id = 'app_id'
self.app_secret = 'app_secret'
se... | Jawbone/UPPlatform_Python_SDK | tests/unit/__init__.py | Python | apache-2.0 | 2,722 |
#!/usr/bin/python
"""
This callback plugin verifies the required minimum version of Ansible
is installed for proper operation of the OpenShift Ansible Installer.
The plugin is named with leading `aa_` to ensure this plugin is loaded
first (alphanumerically) by Ansible.
"""
import sys
from ansible import __version__
i... | liggitt/openshift-ansible | roles/lib_utils/callback_plugins/aa_version_requirement.py | Python | apache-2.0 | 1,831 |
"""
instabot example
Workflow:
Like and follow users who liked the last media of input users.
"""
import sys
import os
from tqdm import tqdm
import argparse
sys.path.append(os.path.join(sys.path[0], '../'))
from instabot import Bot
parser = argparse.ArgumentParser(add_help=True)
parser.add_argument(... | AlexBGoode/instabot | examples/like_and_follow_last_user_media_likers.py | Python | apache-2.0 | 935 |
#------------------------------------------------------------------------------
# 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 requi... | csmoore/MyMiscellanea | Python/ReplaceInEachFileAndFolder.py | Python | apache-2.0 | 4,048 |
# -*- coding: utf-8 -*-
'''
Use the :doc:`Salt Event System </topics/event/index>` to fire events from the
master to the minion and vice-versa.
'''
# Import salt libs
import salt.crypt
import salt.utils.event
import salt.payload
def fire_master(data, tag, preload=None):
'''
Fire an event off up to the master... | victorywang80/Maintenance | saltstack/src/salt/modules/event.py | Python | apache-2.0 | 1,206 |
'''function that operator on pandas DataFrame instances
create_report_categorical(df, ...)
create_report_numeric(df, ...)
replace(df, old_name, new_name, new_value)
Copyright 2017 Roy E. Lowrance
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the L... | rlowrance/python_lib | applied_data_science3/dataframe.py | Python | apache-2.0 | 6,114 |
from datetime import date, time, timedelta, datetime
from time import localtime
Date = date
Time = time
TimeDelta = timedelta
Timestamp = datetime
DateTimeDeltaType = timedelta
DateTimeType = datetime
def DateFromTicks(ticks):
"""Convert UNIX ticks into a date instance."""
return date(*localtime(ticks)[:3])... | akuzminsky/etcdb | etcdb/times.py | Python | apache-2.0 | 571 |
# -*- coding: utf-8 -*-
#
# 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
#... | Fokko/incubator-airflow | airflow/utils/email.py | Python | apache-2.0 | 5,067 |
# Includes the lib path
import sys
import tos
import datetime
import time
import logging
from SharedLibs.tools import raw_to_celcius, raw_to_volts_iris, raw_to_volts_micaz
from Shared import *
import pika # component to access Event Manager
sys.path.insert(0,'/opt/tinyos-2.1.2/support/sdk/python')
sys.path.insert(1,'... | labtempo/osiris-tmon | TmonCollector/src/main/resources/HybridWSNCollector.py | Python | apache-2.0 | 12,831 |
# Copyright 2014 IBM Corp.
"""This module contains common structures and functions that help to handle
AMQP messages based on olso.messaging framework.
"""
import fnmatch
import logging
import inspect
import socket
import threading
import time
from oslo.messaging import target
from oslo.messaging import transport
fr... | openstack/powervc-driver | common-powervc/powervc/common/messaging.py | Python | apache-2.0 | 9,009 |
# -*- coding: utf-8 -*-
from openprocurement.auctions.core.utils import opresource
from openprocurement.auctions.core.views.mixins import AuctionBidDocumentResource
@opresource(name='dgfOtherAssets:Auction Bid Documents',
collection_path='/auctions/{auction_id}/bids/{bid_id}/documents',
path='... | openprocurement/openprocurement.auctions.dgf | openprocurement/auctions/dgf/views/other/bid_document.py | Python | apache-2.0 | 566 |
import inspect
from datetime import datetime
import numpy as np
import pandas as pd
import pytest
import xarray as xr
import xarray.plot as xplt
from xarray import DataArray, Dataset
from xarray.plot.dataset_plot import _infer_meta_data
from xarray.plot.plot import _infer_interval_breaks
from xarray.plot.utils import... | jhamman/xarray | xarray/tests/test_plot.py | Python | apache-2.0 | 76,162 |
#!/usr/bin/env python
# This file is part of pdar.
#
# Copyright 2011 Jason Penney
#
# 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
#
# Unle... | jpenney/pdar | pdar/console.py | Python | apache-2.0 | 6,660 |
# Copyright 2021 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import annotations
import os
from textwrap import dedent
from pants.backend.codegen.protobuf import target_types
from pants.backend.codegen.protobuf.target_types import (... | pantsbuild/pants | src/python/pants/backend/codegen/protobuf/target_types_test.py | Python | apache-2.0 | 1,988 |
#!/usr/bin/python
'''
Copyright 2009, The Android Open Source Project
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
Un... | alexanderscott/akka-log-highlighter | hl.py | Python | apache-2.0 | 5,720 |
# Copyright 2014 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from pants.backend.jvm.targets.java_agent import JavaAgent
from pants.base.exceptions import TargetDefinitionException
from pants.build_graph.build_file_aliases import BuildFileAliases
fro... | tdyas/pants | tests/python/pants_test/targets/test_java_agent.py | Python | apache-2.0 | 3,408 |
# Copyright 2021 The Kubeflow 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... | kubeflow/pipelines | sdk/python/kfp/components/yaml_component_test.py | Python | apache-2.0 | 3,696 |
# Copyright 2017, 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... | googleapis/python-pubsub | tests/unit/pubsub_v1/publisher/batch/test_thread.py | Python | apache-2.0 | 19,373 |
from __future__ import unicode_literals
import tunigo
from tunigo import utils
class Playlist(object):
def __init__(
self,
created=0,
description='',
id='',
image='',
location='',
main_genre=None,
main_genre_template... | trygveaa/python-tunigo | tunigo/playlist.py | Python | apache-2.0 | 3,914 |
import re
DICT_PROMPT_TO_CHARACTER = {
'>>>': '#',
'scm>': ';',
}
def canonicalize(assess_id):
"""
Takes an assessment/question's ID and canonicalizeicalizes it across iterations of
a course.
"""
hash_regex = re.compile(r'\w{32}')
lines = assess_id.split('\n')
canon_lines... | Cal-CS-61A-Staff/ok-client | client/utils/assess_id_util.py | Python | apache-2.0 | 1,397 |
# encoding: utf-8
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding field 'EventSync.created_at'
db.add_column('webinars_eventsync', 'created_at', self.gf('sanetime.... | prior/webinars | webinars_web/webinars/migrations/0054_auto__add_field_eventsync_created_at__chg_field_eventsync_started_at.py | Python | apache-2.0 | 32,635 |
from scheduler import Scheduler
class Engine:
def __init__(self, inputFile):
self.scheduler = Scheduler(inputFile)
def start(self):
self.scheduler.startCrawl()
| Yobretaw/Qrawler | src/engine.py | Python | apache-2.0 | 169 |
from pandac.PandaModules import *
from toontown.battle.BattleProps import *
from toontown.battle.BattleSounds import *
from toontown.distributed.ToontownMsgTypes import *
from direct.gui.DirectGui import cleanupDialog
from direct.directnotify import DirectNotifyGlobal
from toontown.hood import Place
from toontown.battl... | linktlh/Toontown-journey | toontown/town/Street.py | Python | apache-2.0 | 17,518 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2010-2011 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.... | cloudbau/glance | glance/tests/unit/common/test_wsgi.py | Python | apache-2.0 | 12,376 |
#!/usr/bin/python3.4
# http://python-3-patterns-idioms-test.readthedocs.io/en/latest/Singleton.html
class OnlyOne:
class __OnlyOne:
def __init__(self, arg):
self.val = arg
def __str__(self):
return repr(self) * self.val
instance = None
def __init__(self, arg):
... | jasonwee/asus-rt-n14uhp-mrtg | src/bin/SingletonPattern.py | Python | apache-2.0 | 639 |
import os
import tempfile
import httplib
import urllib, urllib2
import base64
from functools import wraps
from string import Template
from wsgiref.util import request_uri
from amara.lib.iri import *
from akara import logger
def status_response(code):
return '%i %s'%(code, httplib.responses[code])
class iterwrap... | uogbuji/akara | lib/util/__init__.py | Python | apache-2.0 | 12,360 |
# Copyright 2020 Makani Technologies 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... | google/makani | analysis/aero/aero_ssam_test.py | Python | apache-2.0 | 7,650 |
# Copyright (c) 2019 Tim Burke <tim@swiftstack.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 required by applicable law or ... | openstack/python-swiftclient | test/functional/test_openstacksdk.py | Python | apache-2.0 | 3,661 |
#pylint: disable=line-too-long
import unittest
from csputils import CSP
class Fixtures(object):
one = (
"default-src 'self'; object-src 'self' https://www.youtube.com; script-src 'self' 'unsafe-eval' https://*.twitter.com https://*.twimg.com https://ssl.google-analytics.com https://api-ssl.bitly.com; rep... | jamesbroadhead/csputils | tests/test_csp.py | Python | apache-2.0 | 5,984 |
import get_data
import ROUGE
def cal_ROUGE(result_filepath):
list_true_summary = get_data.get_test_summary()
f = open(result_filepath)
list_predict_summary = []
for i , line in enumerate(f.readlines()):
list_predict_summary.append(line)
#list_true_summary = [summary.encode("utf8") for summary in list_true_s... | yangzhiye/NLPCC2017-task3 | cal_result.py | Python | apache-2.0 | 1,019 |
import numpy as np
from random import shuffle
from utils_io_folder import get_immediate_subfolder_paths, get_immediate_childfile_names, get_folder_name_from_path
''' 1. generate the list of pairs '''
def generate_pairs_list_for_training(dataset_folder_path, numpy_file_path, txt_file_path = None):
folders_paths_li... | Guanghan/ROLO | update/utils/utils_io_list.py | Python | apache-2.0 | 3,203 |
# Copyright 2020 Makani Technologies 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... | google/makani | analysis/crosswind_batch_sims/score_log_file.py | Python | apache-2.0 | 3,294 |
# Copyright 2015 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
import contextlib
import hashlib
import os
import shutil
import uuid
from abc import abstractmethod
from email import message_from_string
from .common import safe_mkdtemp, safe_open
from ... | snyaggarwal/pex | pex/http.py | Python | apache-2.0 | 9,171 |
# Copyright (C) 2014 Nippon Telegraph and Telephone 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 appli... | hdb3/ryu-hp | simple.py | Python | apache-2.0 | 1,990 |
# Copyright 2015 Google 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 writing, ... | wilcoant/bookshelf | 4-auth/bookshelf/model_datastore.py | Python | apache-2.0 | 2,745 |
from pytest_bdd import given, when, then
from model.contact import Contact
import random
@given('a contact list')
def contact_list(db):
return db.get_list_contacts()
@given('a contact with <firstname>, <lastname>, <middlename>, <nickname>, <title>, <company>, <address>, <email2>, <email3>, <work_phone>,... | Alinyan/python_training | bdd/contact_steps.py | Python | apache-2.0 | 3,837 |
"""
Copyright 2015 Paul T. Grogan, Massachusetts Institute of Technology
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... | ehsanfar/ofspy_v2 | ofspy/disturbance.py | Python | apache-2.0 | 1,486 |
# coding=utf-8
# Copyright 2022 The Tensor2Tensor 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... | tensorflow/tensor2tensor | tensor2tensor/utils/t2t_model_test.py | Python | apache-2.0 | 3,008 |
from collections import namedtuple
import logging
import numpy as np
from ray.rllib.policy.sample_batch import MultiAgentBatch, SampleBatch
from ray.rllib.policy import Policy
from ray.rllib.utils.annotations import DeveloperAPI
from ray.rllib.offline.io_context import IOContext
from ray.rllib.utils.numpy import conv... | richardliaw/ray | rllib/offline/off_policy_estimator.py | Python | apache-2.0 | 3,992 |
# Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# 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 ... | NeCTAR-RC/nova | nova/tests/unit/test_service.py | Python | apache-2.0 | 16,075 |
"""
Connect to a MySensors gateway via pymysensors API.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/sensor.mysensors/
"""
import asyncio
from collections import defaultdict
import logging
import os
import socket
import sys
from timeit import default_t... | LinuxChristian/home-assistant | homeassistant/components/mysensors.py | Python | apache-2.0 | 24,400 |
# 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 agreed to in writing, ... | google-research/evoflow | tests/backend/test_statistical.py | Python | apache-2.0 | 826 |
import sure # noqa # pylint: disable=unused-import
import xmltodict
import moto.server as server
def test_cloudfront_list():
backend = server.create_backend_app("cloudfront")
test_client = backend.test_client()
res = test_client.get("/2020-05-31/distribution")
data = xmltodict.parse(res.data, dict_... | spulec/moto | tests/test_cloudfront/test_server.py | Python | apache-2.0 | 439 |
# Copyright (c) 2013 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 or agreed to in writi... | 0xf2/stackalytics | stackalytics/dashboard/web.py | Python | apache-2.0 | 24,373 |
# -*- coding: utf-8 -*-
from flask import Blueprint,render_template,request,redirect, url_for, session,flash,jsonify
from sqlalchemy import desc,and_
from myaccount.models import FinanceContent,ContantTagAssoc,FinanceTags,FinanceTagsType
from myaccount import db
import time
fincontent = Blueprint('fincontent',__name_... | 5venw0ng/accountbook.py | myaccount/view/fincnt.py | Python | apache-2.0 | 3,113 |
"""
This module handles the conversion between colander object schemas and swagger
object schemas by converting types and node validators.
"""
import colander
from cornice_swagger.converters.exceptions import NoSuchConverter
def convert_length_validator_factory(max_key, min_key):
def validator_converter(valida... | Cornices/cornice.ext.swagger | cornice_swagger/converters/schema.py | Python | apache-2.0 | 7,058 |
# -*- coding: utf-8 -*-
# Copyright 2014 SpendRight, 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 b... | spendright/scrape-urls | scraper.py | Python | apache-2.0 | 4,258 |
# Copyright 2021 The Distla 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 applicable ... | google/distla_core | distla/distla_core/distla_core/linalg/eigh/purify.py | Python | apache-2.0 | 16,318 |
# -*- coding: utf-8 -*-
import scrapy
import time
from crawlAll.items import NewsSpiderItem
class TouTiaoHaoSpider (scrapy.Spider):
name = "toutiaohao"
allowed_domains = ["toutiao.com"]
start_urls = ['http://www.toutiao.com/m1/']
base_url = 'http://www.toutiao.com'
#请求每一个分类,按照页数来
def parse(sel... | RennesUsher/crawlAll | crawlAll/spiders/TouTiaoHao.py | Python | apache-2.0 | 1,690 |
# Copyright 2017,2018 IBM Corp.
#
# 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 agr... | mfcloud/python-zvm-sdk | zvmsdk/smtclient.py | Python | apache-2.0 | 153,225 |
"""
prepare server
"""
import os
import uuid
import logging
import platform
from packstack.installer import basedefs
from packstack.installer import exceptions
from packstack.installer import utils
from packstack.installer import validators
from packstack.modules.common import filtered_hosts
# Controller object wil... | radez/packstack | packstack/plugins/serverprep_901.py | Python | apache-2.0 | 22,017 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# chesslytics documentation build configuration file, created by
# sphinx-quickstart on Tue Jul 9 22:26:36 2013.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
#... | charlieaustin/chess | docs/conf.py | Python | apache-2.0 | 8,447 |
# encoding = utf-8
import os
import sys
import time
import datetime
import json
import jsonpath_rw
from datetime import datetime
def validate_input(helper, definition):
"""Implement your own validation logic to validate the input stanza configurations"""
# This example accesses the modular input variable
... | domeger/SplunkTAforPuppetEnterprise | bin/input_module_puppet_enterprise_metrics.py | Python | apache-2.0 | 2,674 |
import collections.abc
from typing import TYPE_CHECKING, Iterable, Sequence, Type, Union
from xml.etree import cElementTree as ET
from annotypes import Anno, Array
from malcolm.compat import et_to_string
from malcolm.core import (
DEFAULT_TIMEOUT,
Port,
StateSet,
Table,
VMeta,
Widget,
conf... | dls-controls/pymalcolm | malcolm/modules/builtin/util.py | Python | apache-2.0 | 7,903 |
from AbstractManager import AbstractManager
class ActionManager(AbstractManager):
def __init__(self):
self._itemList = [] #a list of all items
def addItem(self, newItem): #adds an item to the item list
for existingItem in self._itemList: ... | paulydboy/Quad-Vision | DroneControl/ActionManager.py | Python | apache-2.0 | 1,516 |
#
# Copyright (c) 2015 Autodesk 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 l... | a3linux/ochothon | images/portal/resources/toolset/toolset/commands/poll.py | Python | apache-2.0 | 2,567 |
# Copyright 2019 The Sonnet 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 applicable l... | deepmind/sonnet | sonnet/regularizers.py | Python | apache-2.0 | 971 |
# -*- coding: utf-8 -*-
"""The periodic task scheduler."""
from __future__ import absolute_import, unicode_literals
import copy
import errno
import heapq
import os
import shelve
import sys
import time
import traceback
from calendar import timegm
from collections import namedtuple
from functools import total_ordering
f... | mdworks2016/work_development | Python/20_Third_Certification/venv/lib/python3.7/site-packages/celery/beat.py | Python | apache-2.0 | 24,444 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compli... | canarie/openstack-dashboard | django-openstack/src/django_openstack/nova/views/regions.py | Python | apache-2.0 | 1,516 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright 2015 clowwindy
#
# 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 b... | zxjcarrot/shadowsocks | shadowsocks/tcprelay.py | Python | apache-2.0 | 29,084 |
# Copyright 2011 OpenStack Foundation.
# Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance w... | SylvainA/os-event-catcher | openstack/common/log.py | Python | apache-2.0 | 26,337 |
#!/usr/bin/env python
# encoding: utf-8
import random
import matplotlib.pyplot as plt
def load_data():
x = [[1, 1], [0, 0], [1, 0], [0, 1]]
y = [1, 0, 0, 0]
return x, y
class Perceptron(object):
def __init__(self, input_nums):
self.weights = [random.random() for _ in range(input_nums)]
... | rockyzhengwu/mlscratch | perceptron/perceptron.py | Python | apache-2.0 | 1,541 |
import httplib2
import json
import yaml
import os
import socket
import random
import time
import traceback
class Cluster:
def __init__(self):
self.uri = "https://kubernetes.default.svc.cluster.local:443"
self.token_file_path = "/var/run/secrets/kubernetes.io/serviceaccount/token"
... | cloudawan/cloudone_template | rabbitmq/image/src/join_cluster.py | Python | apache-2.0 | 7,315 |
__author__ = 'dmakogon'
from gigaspace.common import templating
from gigaspace.common import remote
nova_exceptions = remote.novaclient.client.exceptions
cinder_exceptions = remote.cinderclient.client.exceptions
class BaseNovaActions(remote.RemoteServices, templating.UserdataTemplate):
"""
Base Cinder actio... | denismakogon/gigaspace-test-task | gigaspace/nova_workflow/base.py | Python | apache-2.0 | 3,363 |
import signal
import logging
#from eventbrain.contrib.rabbitmq.pika_wrapper import ChannelWrapper
from eventbrain.contrib.rabbitmq.kombu_wrapper import ChannelWrapper
from eventbrain.util.repeating_timer import RepeatingTimer
LOG = logging.getLogger(__name__)
class ActorBase(object):
"""
Base class for Deci... | ttrifonov/EventBrain | src/eventbrain/actor/base.py | Python | apache-2.0 | 2,237 |
# Copyright 2018 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 agreed to ... | QuLogic/meson | mesonbuild/modules/hotdoc.py | Python | apache-2.0 | 17,787 |
from settings import *
import os
# These should really just be settings but for now it's ok.
os.environ['TRIGGER_HOST'] = '10.16.2.149' # ess-jay-dee-net-mon-one
os.environ['TRIGGER_PORT'] = '9000'
os.environ['TRIGGER_SETTINGS'] = '/home/jathan/.trigger/settings.py'
# Used in hpt/supervisord.conf. Not currently in u... | hollowpoint/hollowpoint | hpt/hpt/local_settings.py | Python | apache-2.0 | 623 |
from datetime import datetime
from typing import Dict, Any
import agate
from dbt.logger import GLOBAL_LOGGER as logger
from dbt.task.runnable import ManifestTask
from dbt.adapters.factory import get_adapter
from dbt.contracts.results import RunOperationResult
from dbt.exceptions import InternalException
import dbt
i... | fishtown-analytics/dbt | core/dbt/task/run_operation.py | Python | apache-2.0 | 2,413 |
from __future__ import (
absolute_import, division, print_function, unicode_literals)
import collections
import time
from mopidy import exceptions
from mopidy.audio import tags as tags_lib, utils
from mopidy.internal import encoding
from mopidy.internal.gi import Gst, GstPbutils
# GST_ELEMENT_FACTORY_LIST:
_DECO... | ZenithDK/mopidy | mopidy/audio/scan.py | Python | apache-2.0 | 9,021 |
"""Version of typed-astunparse package."""
from version_query import predict_version_str
VERSION = predict_version_str()
| mbdevpl/typed-astunparse | typed_astunparse/_version.py | Python | apache-2.0 | 123 |
# coding: utf-8
from collections import defaultdict
class EventsDispatcher(object):
"""
Event dispatcher.
"""
def __init__(self):
self.handlers = defaultdict(list)
def send(self, event, sender=None):
"""
:param event: Event object.
:type event: Event
:par... | pavelpat/yased | src/yased/__init__.py | Python | apache-2.0 | 1,876 |
# -*- cpy-indent-level: 4; indent-tabs-mode: nil -*-
# ex: set expandtab softtabstop=4 shiftwidth=4:
#
# Copyright (C) 2008,2009,2010,2011,2012,2013,2014,2015,2017 Contributor
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You ma... | quattor/aquilon | lib/aquilon/worker/commands/add_host_prefix.py | Python | apache-2.0 | 2,390 |
#!/usr/bin/env python
'''
Input: raw data from /proc/interrupts
Output: json timeseries file with total interrupts per cpu thread
'''
import sys
import json
import re
from datetime import datetime
from common import csv_to_json
def parse_raw_interrupts(raw_fn):
'''
Read file, parse each entry at a particula... | jschaub30/viz_workload | scripts/parse_interrupts.py | Python | apache-2.0 | 2,953 |
# Copyright 2016 Hackers' Club, University Of Peradeniya
# Author : Tharinda Ehelepola, E/11/105
#
# 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... | HackersUOP/project-iMAS | modules/image_analytic_app/restfulServices/headCounting.py | Python | apache-2.0 | 757 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
]
operations = [
migrations.CreateModel(
name='Board',
fields=[
('id', models.AutoField(verbos... | orriborri/medlemsregister | medlemsregister/register/migrations/0001_initial.py | Python | artistic-2.0 | 2,035 |
# -*- coding: utf-8 -*-
from south.utils import datetime_utils as datetime
from south.db import db
from south.v2 import DataMigration
from django.db import models
from django.utils import timezone
class Migration(DataMigration):
def forwards(self, orm):
for visit in orm.Visit.objects.all():
... | myvoice-nigeria/myvoice | myvoice/clinics/migrations/0023_data__survey_sent.py | Python | bsd-2-clause | 14,087 |
##############################################################################
#
# An example of creating a chart with Pandas and XlsxWriter.
#
# Copyright 2013, John McNamara, jmcnamara@cpan.org
#
import pandas as pd
# Some sample data to plot.
list_data = [10, 20, 30, 20, 15, 30, 45]
# Create a Pandas dataframe fr... | jmcnamara/pandas_xlsxwriter_charts | examples/chart_area.py | Python | bsd-2-clause | 1,363 |
# -*- coding: utf-8 -*-
"""
pygments.lexers.asm
~~~~~~~~~~~~~~~~~~~
Lexers for assembly languages.
:copyright: Copyright 2006-2011 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
import re
from pygments.lexer import RegexLexer, include, bygroups, using, DelegatingL... | markandrewj/pygments | pygments/lexers/asm.py | Python | bsd-2-clause | 11,938 |
# -*- coding: utf-8 -*-
"""Field classes for formatting and validating the serialized object.
"""
# Adapted from https://github.com/twilio/flask-restful/blob/master/flask_restful/fields.py.
# See the `NOTICE <https://github.com/sloria/marshmallow/blob/master/NOTICE>`_
# file for more licensing information.
from __futu... | roam/machete | machete/vendor/marshmallow/fields.py | Python | bsd-2-clause | 25,137 |
""" Produce documentation for motion axes from commissioning spreadsheet.
Retrieves information from commissioning spreadsheet and reformats into a more
readable layout. Different output options available.
"""
import xlrd
import argparse
import pandas as pd
from subprocess import call
def process_arguments():
de... | waynelewis/motion_docgen | motion_docgen.py | Python | bsd-2-clause | 2,778 |
# coding: utf-8
'''
This script reads data from various sources to process and store in MongoDB.
'''
import datetime
import pyexcel
import logging
import json
import requests
import re
import keycorrection
from transform import collections_scielo
import models
from transform_date import *
from accent_remover import *
... | scieloorg/journals-catalog | jcatalog/transform/scielo_update.py | Python | bsd-2-clause | 9,417 |
import sys
if sys.version_info < (2, 7):
# In python < 2.7 unittest doesn't have expectedFailure
from django.utils import unittest
else:
# django.utils.unittest became deprecated in Django 1.7
import unittest # NOQA
import mock
from django import forms
from django.core.exceptions import ImproperlyCon... | frankier/django-betterforms | betterforms/tests.py | Python | bsd-2-clause | 41,485 |
import signal
import sys
import traceback
from optparse import OptionParser
import urllib2
from lib.importer import build_module_list, site_yielder
# for use in catching the SIGINT (Ctrl+4)
from lib.string_utils import trunc
die_now = False
def signal_handler(signal, frame):
# Trigger this with CTRL+4
v... | brianwc/juriscraper | sample_caller.py | Python | bsd-2-clause | 7,543 |
import inspect
import os
class CoreSettings(object):
'''
Settings not likely to change between versions
'''
@property
def BASE_DIR(self):
return os.path.dirname(
os.path.dirname(
os.path.abspath(inspect.getfile(self.__class__))
)
)
DEB... | RonnyPfannschmidt/django-classy-settings | cbs/base/__init__.py | Python | bsd-2-clause | 558 |
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
import cmsplugin_simpleslider
version = cmsplugin_simpleslider.__version__
setup(
name='cmsplugin_simpleslider',
packages=['cmsplugin_simpleslider'],
include_package_data=True,
version=version,
descript... | creimers/cmsplugin_simpleslider | setup.py | Python | bsd-2-clause | 1,103 |
import os
from collections import defaultdict
import dill
import numpy as np
import pySDC.helpers.plot_helper as plt_helper
from pySDC.helpers.stats_helper import filter_stats, sort_stats
from pySDC.implementations.collocation_classes.gauss_lobatto import CollGaussLobatto
from pySDC.implementations.controller_classes... | Parallel-in-Time/pySDC | pySDC/playgrounds/VSDC/simple_problems.py | Python | bsd-2-clause | 7,735 |
# Remember to set ft_stopword_file='' for mysql.
# See top-level readme for more details.
from wolis.test_case import WolisTestCase
from wolis import utils
class SearchTest(WolisTestCase):
def test_search(self):
url = '/index.php'
self.get(url)
self.assert_successish()
for... | p/wolis-phpbb | tests/search.py | Python | bsd-2-clause | 832 |
"""
This is a test/demo of the terrain system.
"""
from panda3d.core import *
loadPrcFile("TerrainConfig.prc")
from direct.showbase.ShowBase import ShowBase
from direct.showbase.DirectObject import DirectObject
import direct.directbase.DirectStart
from direct.filter.CommonFilters import CommonFilters
import math
fr... | Craig-Macomber/infiniteRalph | main.py | Python | bsd-2-clause | 12,559 |
# -*- coding: utf-8 -*-
#=======================================================================
#
# Copyright notice for the CellularAutomata class.
#
# The upstream version is from http://opencores.org/project,ca_prng
#
#########
#
# Fast and simple ca_prng conformant cellular automata model in
# Python. This model ... | benzea/nco | prng/rule30_reference.py | Python | bsd-2-clause | 3,996 |
"""Leetcode 20. Valid Parentheses
Easy
URL: https://leetcode.com/problems/valid-parentheses/
Given a string containing just the characters
'(', ')', '{', '}', '[' and ']', determine if the input string is valid.
An input string is valid if:
- Open brackets must be closed by the same type of brackets.
- Open bracket... | bowen0701/algorithms_data_structures | lc0020_valid_parentheses.py | Python | bsd-2-clause | 2,532 |