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 |
|---|---|---|---|---|---|
# Authors: Emmanuelle Gouillart <emmanuelle.gouillart@normalesup.org>
# Gael Varoquaux <gael.varoquaux@normalesup.org>
# License: BSD
import numpy as np
import scipy as sp
from scipy import ndimage
from nose.tools import assert_equal, assert_true
from numpy.testing import assert_raises
from ..image import i... | seckcoder/lang-learn | python/sklearn/sklearn/feature_extraction/tests/test_image.py | Python | unlicense | 9,781 |
"""
mesclan.app
~~~~~~~~~~~~~~~~~
"""
from flask import Flask
def make_app():
"""
Factory function for creating an app
"""
return Flask(__name__)
| hahnicity/mesclan | mesclan/app.py | Python | unlicense | 164 |
#!/bin/bin/python
#!/usr/bin/python
import os
import sys
import time
import select
import socket
import hashlib
import requests
import tempfile
import threading
stats = set()
def start (consul):
global stats
signal = threading.Condition()
def go ():
while (True):
try:
... | dgvncsz0f/pong | bin/resolver.py | Python | unlicense | 1,243 |
from bitmovin.resources.models import AkamaiNetStorageOutput
from ..rest_service import RestService
class AkamaiNetStorage(RestService):
BASE_ENDPOINT_URL = 'encoding/outputs/akamai-netstorage'
def __init__(self, http_client):
super().__init__(http_client=http_client, relative_url=self.BASE_ENDPOINT_... | bitmovin/bitmovin-python | bitmovin/services/outputs/akamai_netstorage_output_service.py | Python | unlicense | 356 |
#!/usr/bin/env python
"""
An implementation of netcat compatible with Python 2 and 3.
Written because netcat wasn't installed on Oracle Linux 7.3
"""
import argparse
import socket
import sys
parser = argparse.ArgumentParser(description='Simple netcat in pure python.')
parser.add_argument('-s', '--source', metavar='ADD... | benformosa/Toolbox | netcat.py | Python | unlicense | 1,218 |
'''
ScrollView
==========
.. versionadded:: 1.0.4
The :class:`ScrollView` widget provides a scrollable/pannable viewport that is
clipped at the scrollview's bounding box.
Scrolling Behavior
------------------
The ScrollView accepts only one child and applies a viewport/window to
it according to the :attr:`~ScrollV... | Bakterija/log_fruit | src/tests/scrollview_bug_test/scrollv.py | Python | unlicense | 42,114 |
from pippi import dsp
freqs = [200, 350, 500, 700, 1000, 1400, 2000, 3500]
length = dsp.stf(300)
def make_pulse(snd):
snd_len = dsp.flen(snd)
blip = dsp.cut(snd, 0, dsp.mstf(1))
blip = dsp.env(blip, 'sine')
blip = dsp.pad(blip, 0, snd_len - dsp.flen(blip))
return blip
def make_vary(snd):
nu... | hecanjog/buchla-score | vary-score.py | Python | unlicense | 1,065 |
'''
Problem: Design and implement a hash table that uses chaining for collision
total time: 1.5hrs buggy; 2hrs finished
'''
from random import randint
class Node:
def __init__(self, key=None, data=None):
self.key = key
self.data = data
self.next = None
return
def __repr__(sel... | joeghodsi/interview-questions | cracking-the-coding-interview/ch8-object-oriented-design/8.10-hash-table.py | Python | unlicense | 3,863 |
# Copyright 2018 Inap.
#
# 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, softwa... | lindycoder/fake-switches | fake_switches/arista/command_processor/config_interface.py | Python | apache-2.0 | 7,579 |
#!/usr/bin/env python
import my_func
myfunc()
| shamurti/Python_Class | func_test.py | Python | apache-2.0 | 49 |
import logging
import random
from queue import Queue
from typing import List
import ray
import ray.streaming._streaming as _streaming
import ray.streaming.generated.streaming_pb2 as streaming_pb
from ray.actor import ActorHandle, ActorID
from ray.streaming.config import Config
CHANNEL_ID_LEN = 20
class ChannelID:
... | stephanie-wang/ray | streaming/python/runtime/transfer.py | Python | apache-2.0 | 8,998 |
#
# 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... | mrkm4ntr/incubator-airflow | airflow/www/app.py | Python | apache-2.0 | 4,942 |
with open('/home/matheus/Vídeos/video.mp4', 'rb') as fonte:
with open('/home/matheus/Vídeos/pasta/videoCópia.mp4', 'wb') as destino:
byte = fonte.read()
destino.write(byte) | matheusfarias/Python | codes/arquivos/arquivos10.py | Python | apache-2.0 | 195 |
#!/usr/bin/env python
# @@@ START COPYRIGHT @@@
#
# 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 Li... | rlugojr/incubator-trafodion | install/python-installer/scripts/traf_ldap.py | Python | apache-2.0 | 2,738 |
# (C) Copyright 2015-2017 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/licenses/LICENSE-2.0
#
# Unless required by ... | sapcc/monasca-api | monasca_tempest_tests/tests/api/test_alarm_definitions.py | Python | apache-2.0 | 50,380 |
import sys
import os
sys.path.append(os.path.join(os.path.dirname(__file__), '../../src/MMTransE'))
from MMTransE import MMTransE
model = MMTransE(dim=75, save_dir=os.path.join(os.path.dirname(__file__), 'model_MMtransE_person_15k.bin'))
model.Train_MT(epochs=400, save_every_epochs=100, languages=['en', 'fr'],... | muhaochen/MTransE | run/en_fr/train_MMtransE_15k.py | Python | apache-2.0 | 766 |
# Copyright (c) 2013 Hewlett-Packard Development Company, L.P.
#
# 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... | openstack/os-collect-config | os_collect_config/heat_local.py | Python | apache-2.0 | 1,909 |
class Result:
def __init__(self, user_query, nodes, keywords):
self.user_query = user_query
self.nodes = nodes
self.keywords = keywords
def __len__(self):
return len(self.nodes)
def get_node(self, index):
return self.nodes[index]
# noinspection PyMethodMayBeSt... | DanDits/Pyoogle | pyoogle/search/result.py | Python | apache-2.0 | 1,845 |
#!/usr/bin/env python
# Licensed to Cloudera, Inc. under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. Cloudera, Inc. licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you ma... | pwong-mapr/private-hue | desktop/libs/liboozie/src/liboozie/submittion.py | Python | apache-2.0 | 9,396 |
# coding: utf-8
"""
Kubernetes
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) # noqa: E501
The version of the OpenAPI document: release-1.23
Generated by: https://openapi-generator.tech
"""
import pprint
import re # noqa: F401
import si... | kubernetes-client/python | kubernetes/client/models/v1_label_selector.py | Python | apache-2.0 | 5,205 |
import os.path
import os
import threading
import time
from future.utils import iteritems
from pandaharvester.harvestercore import core_utils
from pandaharvester.harvestercore.plugin_base import PluginBase
from pandaharvester.harvestermover import mover_utils
from pilot.api import data
# logger
baseLogger = core_utils... | PanDAWMS/panda-harvester | pandaharvester/harvesterpreparator/pilotmover_mt_preparator.py | Python | apache-2.0 | 5,420 |
# 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... | alexgorban/models | research/object_detection/model_lib_v2_test.py | Python | apache-2.0 | 3,383 |
#!/usr/bin/env python
# encoding: utf-8
"""Implements `!p ` interpolation."""
import os
from collections import namedtuple
from UltiSnips import _vim
from UltiSnips.compatibility import as_unicode
from UltiSnips.indent_util import IndentUtil
from UltiSnips.text_objects._base import NoneditableTextObject
from UltiSni... | yslin/tools-zodlin | ubuntu/vim/.vim/lang/all/ultisnips/pythonx/UltiSnips/text_objects/_python_code.py | Python | apache-2.0 | 8,025 |
# Copyright (c) 2015 The Pycroft Authors. See the AUTHORS file.
# This file is part of the Pycroft project and licensed under the terms of
# the Apache License, Version 2.0. See the LICENSE file for details.
from datetime import date, datetime, time, timedelta
from functools import partial
import json
import operator
... | agdsn/pycroft | pycroft/helpers/i18n.py | Python | apache-2.0 | 14,103 |
"""Support for Fronius devices."""
import copy
import logging
import voluptuous as vol
from pyfronius import Fronius
from homeassistant.components.sensor import PLATFORM_SCHEMA
from homeassistant.const import (CONF_RESOURCE, CONF_SENSOR_TYPE, CONF_DEVICE,
CONF_MONITORED_CONDITIONS)
fr... | jabesq/home-assistant | homeassistant/components/fronius/sensor.py | Python | apache-2.0 | 6,081 |
########
# Copyright (c) 2014 GigaSpaces Technologies Ltd. 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... | cloudify-cosmo/cloudify-amqp-influxdb | amqp_influxdb/__init__.py | Python | apache-2.0 | 6,769 |
from collections import Counter
from scattertext.features.FeatsFromSpacyDoc import FeatsFromSpacyDoc
class FeatsFromSpacyDocOnlyNounChunks(FeatsFromSpacyDoc):
'''
Just returns noun chunks from spaCy
'''
def get_feats(self, doc):
'''
Parameters
----------
doc, Spacy Docs
Returns
-------
Counter no... | JasonKessler/scattertext | scattertext/features/FeatsFromSpacyDocOnlyNounChunks.py | Python | apache-2.0 | 404 |
#!/usr/bin/env python3
import os
import shutil
import subprocess
import tempfile
REPO = 'git@github.com:nicholasbishop/dumbmath-rs.git'
BRANCH = 'gh-pages'
COMMIT_MSG = 'Automatic-ish rustdoc update'
def run_cmd(cmd, cwd=None):
print(' '.join(cmd))
subprocess.check_call(cmd, cwd=cwd)
def main():
run_c... | nicholasbishop/dumbmath-rs | update-gh-pages.py | Python | apache-2.0 | 924 |
import textwrap
import pytest
# AWX
from awx.main.redact import UriCleaner
from awx.main.tests.URI import URI
TEST_URIS = [
URI('no host', scheme='https', username='myusername', password='mypass', host=None),
URI('no host', scheme='https', username='myusername', password='mypass*********', host=None),
URI... | wwitzel3/awx | awx/main/tests/unit/test_redact.py | Python | apache-2.0 | 6,615 |
# Copyright 2022 The IREE Authors
#
# Licensed under the Apache License v2.0 with LLVM Exceptions.
# See https://llvm.org/LICENSE.txt for license information.
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
import absl.testing
import numpy
from . import test_util
model_path = "https://storage.googleapis.com... | google/iree | integrations/tensorflow/test/python/iree_tfl_tests/mobilenet_v1_test.py | Python | apache-2.0 | 979 |
import logging
import os
import pytest
import tests.test_utils as test_utils
from great_expectations.data_context.store import DatabaseStoreBackend
from great_expectations.data_context.util import instantiate_class_from_config
from great_expectations.exceptions import StoreBackendError
try:
sqlalchemy = pytest.i... | great-expectations/great_expectations | tests/data_context/store/test_database_store_backend.py | Python | apache-2.0 | 7,990 |
_base_ = '../mask_rcnn/mask_rcnn_r50_fpn_1x_coco.py'
model = dict(
backbone=dict(
dcn=dict(type='DCNv2', deform_groups=1, fallback_on_stride=False),
stage_with_dcn=(False, True, True, True)))
| open-mmlab/mmdetection | configs/dcnv2/mask_rcnn_r50_fpn_mdconv_c3-c5_1x_coco.py | Python | apache-2.0 | 212 |
# 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
# distributed under the Li... | alexpilotti/python-keystoneclient | keystoneclient/v3/tokens.py | Python | apache-2.0 | 1,276 |
"""
Copyright (c) 2015 SONATA-NFV
ALL RIGHTS RESERVED.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to... | stevenvanrossem/son-emu | src/emuvim/examples/demo_topo_1pop.py | Python | apache-2.0 | 2,840 |
from qgis.core import *
class QWeb:
def __init__(self, iface):
self.iface = iface
self.canvas = self.iface.mapCanvas()
def msg(self, request):
self.iface.messageBar().pushInfo("Qweb msg", request.query["content"])
return "Message pusehd"
def extent(self, request):
... | parksandwildlife/static | static/py/qweb.py | Python | apache-2.0 | 630 |
# Copyright 2014 CloudFounders NV
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writ... | sql-analytics/openvstorage | ovs/lib/helpers/decorators.py | Python | apache-2.0 | 5,679 |
import os
import tempfile
import unittest
import logging
from pyidf import ValidationLevel
import pyidf
from pyidf.idf import IDF
from pyidf.performance_curves import CurveBiquadratic
log = logging.getLogger(__name__)
class TestCurveBiquadratic(unittest.TestCase):
def setUp(self):
self.fd, self.path = te... | rbuffat/pyidf | tests/test_curvebiquadratic.py | Python | apache-2.0 | 4,022 |
# ---------------------------------------------------------------------------
# SpatialNotifierSample3.py
#
# SAMPLE #3:
# This file shows how you would use the Spatial Notification GP tools to
# create a different spatial notification rule for every polygon in a
# feature class. No dataset conditions are applied, and... | Esri/workflowmanager-admin-tools | Documentation/SpatialNotifierSample3.py | Python | apache-2.0 | 7,203 |
import logging
from stevedore.driver import DriverManager
from stevedore.extension import ExtensionManager
LOG = logging.getLogger(__name__)
NAMESPACE = 'fakturo.provider'
class ProviderBase(object):
api = None
client = None
def __init__(self):
pass
def extend_parser(self, name, parser)... | billingstack/python-fakturo | fakturo/core/provider/__init__.py | Python | apache-2.0 | 1,481 |
import pendulum
from share.normalize import *
class Tag(Parser):
name = ctx
class ThroughTags(Parser):
tag = Delegate(Tag, ctx)
class AgentIdentifier(Parser):
# email address
uri = IRI(ctx)
class WorkIdentifier(Parser):
uri = IRI(ctx)
class AffiliatedAgent(Parser):
schema = GuessAgent... | zamattiac/SHARE | providers/gov/clinicaltrials/normalizer.py | Python | apache-2.0 | 3,804 |
# --------------------------------------------------------------------------
# Source file provided under Apache License, Version 2.0, January 2004,
# http://www.apache.org/licenses/
# (c) Copyright IBM Corp. 2015, 2016
# --------------------------------------------------------------------------
"""
Mathematical probl... | IBMDecisionOptimization/docplex-examples | examples/cp/basic/vietnamese_problem.py | Python | apache-2.0 | 1,329 |
"""
MysqlLog - File ``/var/log/mysqld.log``
=======================================
Module for parsing the log file for Mysql, including ``/var/log/mysql/mysqld.log``,
``/var/log/mysqld.log`` and ``/var/opt/rh/rh-mysql*/log/mysql/mysqld.log``.
.. note::
By default, logrotate of mysql.log is set to daily.
In s... | RedHatInsights/insights-core | insights/parsers/mysql_log.py | Python | apache-2.0 | 2,088 |
from __future__ import unicode_literals
from distutils.version import StrictVersion
from itertools import chain
from time import time
import errno
import io
import os
import socket
import threading
import warnings
from redis._compat import (xrange, imap, unicode, long,
nativestr, basestring,... | mdworks2016/work_development | Python/20_Third_Certification/venv/lib/python3.7/site-packages/redis/connection.py | Python | apache-2.0 | 54,565 |
#!/usr/bin/env python
# Copyright 2014-2019 The PySCF Developers. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# U... | sunqm/pyscf | pyscf/dft/uks_symm.py | Python | apache-2.0 | 1,830 |
#!/usr/bin/env python2
import argparse
import hashlib
import cStringIO
# import io
import json
import sys
import re
import tarfile
from apibus_handler import SaeApibusAuthHandler
import urllib2
parser = argparse.ArgumentParser(description='Download sae logs.')
parser.add_argument('--logs_type', help='storage,http,etc... | cxcxcxcx/sae-logs | get_sae_logs.py | Python | apache-2.0 | 1,287 |
import sys
sys.path.insert(1, "../../../")
import h2o
def tweedie_offset(ip,port):
insurance = h2o.import_file(h2o.locate("smalldata/glm_test/insurance.csv"))
insurance["offset"] = insurance["Holders"].log()
insurance["Group"] = insurance["Group"].asfactor()
insurance["Age"] = insurance["Age"].asfacto... | PawarPawan/h2o-v3 | h2o-py/tests/testdir_algos/deeplearning/pyunit_tweedie_offsetDeeplearning.py | Python | apache-2.0 | 3,324 |
import logging
import json
from nvclient_model import model_nvsession, model_nvnetwork, model_instance, model_nvclient
import nvclient_view_con
import date_str
class view_nvclient_connected(nvclient_view_con.view_nvclient_con):
def __init__(self, model):
nvclient_view_con.view_nvclient_con.__init__(self,m... | osynge/whatenv | osweint/nvclient_view_nvclient_connected.py | Python | apache-2.0 | 3,298 |
import os
BASE_DIR = os.path.dirname(os.path.dirname(__file__))
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True
ALLOWED_HOSTS = ['*']
# Database
# https://docs.djangoproject.com/en/1.6/ref/settings/#databases
# DATABASES = {
# 'default': {
# #'ENGINE': 'django.db.backends.... | myzj/dop | dop/dop/debug_settings.py | Python | apache-2.0 | 1,522 |
# Copyright 2012 Hewlett-Packard Development Company, L.P.
#
# 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... | gforcada/jenkins-job-builder | jenkins_jobs/modules/properties.py | Python | apache-2.0 | 44,745 |
#-*-coding:utf8;-*-
#qpy:2
#qpy:console
#Prasith Lakshan 08/10/2014
import string
print "\nA simple word and char counter for text files\n"
print "Please enter the path of the file. \neg : exmplefolder/example.txt\n>"
path = raw_input("Press enter to input path: ")
#opening file with read only mode
text = open(pat... | PrasithL/python_scripts | word_counter.py | Python | apache-2.0 | 1,252 |
#!/usr/bin/python
# Copyright (c) Facebook, Inc. and its affiliates.
"""Adobe API tools."""
import adobe_api
# These are the most common actions that one would use the Adobe UM API for.
def user_exists(username):
"""Return True if the username exists, or False if it doesn't."""
try:
adobe_api.AdobeAP... | facebook/IT-CPE | legacy/adobe_tools/adobe_tools.py | Python | apache-2.0 | 2,966 |
from ncclient import manager
import ncclient
import xml.etree.ElementTree as ET
host = "192.168.1.1"
username="root"
password="root"
with manager.connect_ssh(host=host, port=830, username=username, password=password, hostkey_verify=False ) as m:
print m.delete_config(target='startup')
| macauleycheng/AOS_OF_Example | 000-Netconf/delete-config-startup.py | Python | apache-2.0 | 315 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.2 on 2016-10-18 01:37
from __future__ import unicode_literals
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
import django_extensions.db.fields
class Migration(migrations.Migration):
initial = True
... | jacobis/choosing | polls/migrations/0001_initial.py | Python | apache-2.0 | 4,163 |
## Python implementation of MBMA (Van den Bosch & Daelemans 1999)
## Copyright (C) 2011 Institute for Dutch Lexicology (INL)
## Author: Folgert Karsdorp, INL
## E-mail: <servicedesk@inl.nl>
## URL: <http://www.inl.nl/>
## For licence information, see LICENCE.TXT
import re
import collections
try:
from lxml.etree ... | INL/MBMP-morphological-parser | mbmp/util.py | Python | apache-2.0 | 2,896 |
#!/usr/bin/python
# 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 applicabl... | google/makani | avionics/common/generate_version_crc.py | Python | apache-2.0 | 2,443 |
# -*- coding: utf-8 -*-
u"""test simulation list
:copyright: Copyright (c) 2019 RadiaSoft LLC. All Rights Reserved.
:license: http://www.apache.org/licenses/LICENSE-2.0.html
"""
from __future__ import absolute_import, division, print_function
import pytest
def test_copy_non_session(fc):
from pykern.pkcollections... | mrakitin/sirepo | tests/sim_list_test.py | Python | apache-2.0 | 4,033 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
reload(sys)
sys.setdefaultencoding('utf-8')
unknown_err = 100
no_err= 200
err_sys = 503
err_access_expired = 504
err_access_repeate = 505
err_user_not_login = 506
err_user_login_expired = 507
err_user_login_other = 508
err_user_id_not_exist = 511
err_user_id_e... | Danceiny/HackGirlfriend | Libraries/ErrorDefine.py | Python | apache-2.0 | 1,464 |
# Copyright 2019 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | google/jax | tests/debug_nans_test.py | Python | apache-2.0 | 6,696 |
# ------------------------------------------------------------------------------
# This class manages the various services to provide a framework to display
# useful information to the user in rotation.
# ------------------------------------------------------------------------------
import datetime
from threading impor... | tiy1807/PythonUtils | PythonUtils/live_info/live_manager.py | Python | apache-2.0 | 3,008 |
#!/usr/bin/env python3
# Copyright 2020 The OpenROAD 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
#
# Unless required by applica... | efabless/openlane | scripts/mergeLef.py | Python | apache-2.0 | 3,536 |
"""
sphinx.ext.intersphinx
~~~~~~~~~~~~~~~~~~~~~~
Insert links to objects documented in remote Sphinx documentation.
This works as follows:
* Each Sphinx HTML build creates a file named "objects.inv" that contains a
mapping from object names to URIs relative to the HTML set's root.
* P... | sonntagsgesicht/regtest | .aux/venv/lib/python3.9/site-packages/sphinx/ext/intersphinx.py | Python | apache-2.0 | 17,151 |
# -*- coding:utf-8 -*-
class Model(object):
"""
Model模块基类,用于存储,训练和预测模型
"""
def __init__(self):
pass
def train(self, dataset):
"""
模型训练
:param dataset: DataSet基类, 行情数据,可能涉及多种行情,此时以列表等形式存储
:return: void
"""
pass
def predict(self, dataset):
"""
模型预测,根据实时行情给出预测结果:涨、跌、平
:param dataset: Market基... | zsffq999/helloworld | strategy/model/__init__.py | Python | apache-2.0 | 612 |
# Problem link - https://leetcode.com/problems/kth-largest-element-in-an-array/
class Heap:
def __init__(self,A):
self.A = A
self.heapSize = len(self.A)
# This method maintains the max heap property.
def max_heapify(self, i):
largest = i
left = 2*i + 1
right = 2*i + 2... | saisankargochhayat/algo_quest | leetcode/kth-largest-element-in-an-array/kth_largest.py | Python | apache-2.0 | 1,884 |
"""payu.experiment
===============
Basic file system operations for Payu
:copyright: Copyright 2011 Marshall Ward, see AUTHORS for details.
:license: Apache License, Version 2.0, see LICENSE for details.
"""
# Standard library
import errno
import os
import shutil
import sys
# Extensions
import yaml
DEF... | marshallward/payu | payu/fsops.py | Python | apache-2.0 | 4,579 |
# Copyright 2021, Kay Hayen, mailto:kay.hayen@gmail.com
#
# Python test originally created or extracted from other peoples work. The
# parts from me are licensed as below. It is at least Free Software where
# it's copied from other people. In these cases, that will normally be
# indicated.
#
# L... | kayhayen/Nuitka | tests/benchmarks/constructs/CallLambdaExpressionDirectly.py | Python | apache-2.0 | 1,153 |
# Copyright 2021 DeepMind Technologies Limited
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agree... | deepmind/brave | brave/datasets/time_sampling.py | Python | apache-2.0 | 6,197 |
# 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 'PollChoiceData.ip'
db.add_column('pollit_pollchoicedata', 'ip', self.gf('django.db.models.... | callowayproject/django-pollit | pollit/migrations/0002_auto__add_field_pollchoicedata_ip__chg_field_pollchoicedata_user.py | Python | apache-2.0 | 6,258 |
#
# Copyright 2012 WebFilings, 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... | robertkluin/furious | furious/handlers/__init__.py | Python | apache-2.0 | 1,050 |
import <error descr="No module named six">six</error>
class M(type):
def baz(self):
pass
class B1(object):
pass
class B2(object):
def bar(self):
pass
class C(six.with_metaclass(M, B1, B2)):
def foo(self):
self.bar()
C.baz()
from <error descr="Unresolved referenc... | youdonghai/intellij-community | python/testData/inspections/PyUnresolvedReferencesInspection/sixWithMetaclass.py | Python | apache-2.0 | 511 |
"""Victim / Victims Object"""
# standard library
from typing import TYPE_CHECKING, Iterator, Union
# first-party
from tcex.api.tc.v3.api_endpoints import ApiEndpoints
from tcex.api.tc.v3.object_abc import ObjectABC
from tcex.api.tc.v3.object_collection_abc import ObjectCollectionABC
from tcex.api.tc.v3.security_labels... | ThreatConnect-Inc/tcex | tcex/api/tc/v3/victims/victim.py | Python | apache-2.0 | 8,055 |
import tensorflow as tf
import numpy as np
import cPickle
#Load features and labels
features = cPickle.load(open('nn_features.p', 'rb'))
labels = cPickle.load(open('labels.p', 'rb'))
#change these values later
in_dim = features.shape[1]
out_dim = 100
n_samples = features.shape[0]
batch_size = 128
num_features = fea... | jashwanth9/Expert-recommendation-system | code/neural net/nn.py | Python | apache-2.0 | 2,202 |
""" An utility script for calculating usages of services """
import os
import sys
import json
import time
import inspect
import datetime
import calendar
import logging
import logging.handlers
from argparse import ArgumentParser
from utils import parse_date_string
DAY_IN_SECS = 86399 # 24 * 60 * 60 - 1
def mont... | eResearchSA/reporting-unified | calculator.py | Python | apache-2.0 | 4,223 |
"""
Copyright (c) 2004-Present Pivotal Software, Inc.
This program and the accompanying materials are made available under
the terms of the under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.... | Chibin/gpdb | src/test/tinc/tincrepo/mpp/gpdb/tests/storage/pg_twophase/pg_twophase.py | Python | apache-2.0 | 6,466 |
"""Testing methods that need Handle server write access"""
import sys
if sys.version_info < (2, 7):
import unittest2 as unittest
else:
import unittest
import json
import pyhandle
from pyhandle.searcher import Searcher
from pyhandle.client.resthandleclient import RESTHandleClient
from pyhandle.handleexceptions... | EUDAT-B2SAFE/PYHANDLE | pyhandle/tests/testcases/handleclient_search_unit_test.py | Python | apache-2.0 | 4,053 |
import unittest
import numpy as np
import matplotlib.pyplot as plt
from pypvcell.illumination import load_astm
from pypvcell.solarcell import SQCell, MJCell, DBCell
from pypvcell.photocurrent import gen_step_qe
class SolarCellTestCase(unittest.TestCase):
def setUp(self):
self.input_ill = load_astm("AM1.5... | kanhua/pypvcell | tests/test_solarcell.py | Python | apache-2.0 | 2,479 |
from tfword2vec import utils, word2vec
import argparse
import logging
import tensorflow as tf
import os
import numpy as np
aparser = argparse.ArgumentParser()
aparser.add_argument("document_file")
aparser.add_argument("output_directory")
aparser.add_argument("--vocab_size", type=int, default=1000)
aparser.add_argumen... | oktopac/tfword2vec | examples/word2vec.py | Python | apache-2.0 | 1,313 |
# Copyright 2017--2022 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" fi... | awslabs/sockeye | test/unit/test_encoder.py | Python | apache-2.0 | 2,602 |
import re
import collections
from enum import Enum
from ydk._core._dm_meta_info import _MetaInfoClassMember, _MetaInfoClass, _MetaInfoEnum
from ydk.types import Empty, YList, YLeafList, DELETE, Decimal64, FixedBitsDict
from ydk._core._dm_meta_info import ATTRIBUTE, REFERENCE_CLASS, REFERENCE_LIST, REFERENCE_LEAFLI... | 111pontes/ydk-py | cisco-ios-xr/ydk/models/cisco_ios_xr/_meta/_Cisco_IOS_XR_tty_vty_cfg.py | Python | apache-2.0 | 4,165 |
import ply.lex as lex
from ply.lex import TOKEN
import re
import Intermediate_Representation_DSL_Translator.ParserLogger as pLogger
# List of token names. This is always required
tokens = (
'PLUS',
'MINUS',
'TIMES',
'DIVIDE',
'LPAREN',
'RPAREN',
'SPACE',
'COMMENT',
'STARTP',
... | DmitriyFromBSUIR/Home_Automation_Server | ITASIR_DSL/Lexer.py | Python | apache-2.0 | 3,179 |
# -*- coding: utf-8 -*-
# Copyright 2011 Matthias Fuchs
#
# 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 applic... | uboot/stromx | python/example/observer.py | Python | apache-2.0 | 1,702 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
# vi: set ft=python sts=4 ts=4 sw=4 et:
"""
The Agave wrapper in python
"""
from os import path as op, getenv
from glob import glob
from random import shuffle
from argparse import ArgumentParser, RawT... | poldracklab/crn-app-registration-tool | cappat/wrapper.py | Python | apache-2.0 | 5,612 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright (C) 2013 PolyBeacon, 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... | kickstandproject/ripcord | ripcord/cmd/manage.py | Python | apache-2.0 | 2,080 |
from setuptools import setup, find_packages
setup(
name='django-greenfan',
version='0.1.0',
description='OpenStack Continuous Integration',
author='Soren Hansen',
author_email='sorhanse@cisco.com',
url='http://github.com/sorenh/python-django-greenfan',
packages=find_packages(),
include_... | sorenh/python-django-greenfan | setup.py | Python | apache-2.0 | 843 |
from typing import cast
import pytest
from ruamel.yaml.comments import CommentedMap
from schema_salad.sourceline import cmap
from cwltool.command_line_tool import CommandLineTool
from cwltool.context import LoadingContext
snippet = cast(
CommentedMap,
cmap(
[
{
"cwlVersion... | common-workflow-language/cwltool | tests/test_anon_types.py | Python | apache-2.0 | 5,243 |
#/***********************************************************************
# * Licensed Materials - Property of IBM
# *
# * IBM SPSS Products: Statistics Common
# *
# * (C) Copyright IBM Corp. 1989, 2020
# *
# * US Government Users Restricted Rights - Use, duplication or disclosure
# * restricted by GSA ADP Schedule Co... | IBMPredictiveAnalytics/STATS_CLUS_SIL | src/STATS_CLUS_SIL.py | Python | apache-2.0 | 31,282 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('mig_main', '0004_committee'),
('history', '0004_auto_20140920_0141'),
]
operations = [
migrations.CreateModel(
... | tbpmig/mig-website | history/migrations/0005_committeemember.py | Python | apache-2.0 | 805 |
import numpy as np
import os
import cv2
import sys
import glob
import pandas as pd
from PIL import Image
from multiprocessing import Pool, cpu_count, freeze_support
from keras.layers import Dense
from keras.layers import Dropout
from keras.layers import Flatten
from keras.constraints import maxnorm
from keras.optimizer... | jmanday/Master | SIGE/Practicas/Practica2/keras1.py | Python | apache-2.0 | 5,393 |
#
# Copyright (c) 2013 Juniper Networks, Inc. All rights reserved.
#
#
# Opserver
#
# Operational State Server for VNC
#
from gevent import monkey
monkey.patch_all()
import sys
import json
import socket
import time
import copy
import traceback
import signal
import random
import hashlib
import ConfigParser
import logg... | nischalsheth/contrail-controller | src/opserver/alarmgen.py | Python | apache-2.0 | 108,346 |
#!/bin/python
GITHUB_TOKEN = '<YOUR GITHUB TOKEN>'
OWNER = '<YOUR / YOUR COMPANY GITHUB ACCOUNT NAME>'
PROJECTS = [{
'name' : 'Project 1',
'command' : 'p1',
'repos' : [ 'repo1',
'repo2' ]
},
{
'name' : 'Project 2',
'command'... | AFouques/github_script | settings.py | Python | apache-2.0 | 541 |
# coding: utf-8
#
# Copyright 2016 The Oppia 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 requi... | prasanna08/oppia | core/domain/user_query_jobs_one_off_test.py | Python | apache-2.0 | 15,215 |
from django_assets import Bundle, register
## CSS ##
css_poll_bundle = Bundle('site_media/css/poll.css')
register('css_poll',
css_poll_bundle,
filters = 'yui_css', output = 'site_media/css/gen/packed.poll.css')
## Javascript ## | Kami/sgrstats.com | sgrstats/polls/assets.py | Python | apache-2.0 | 233 |
# -*- coding: utf-8 -*-
#
# python-keystoneclient documentation build configuration file, created by
# sphinx-quickstart on Sun Dec 6 14:19:25 2009.
#
# 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
# autogenerat... | tylertian/Openstack | openstack F/python-keystoneclient/doc/source/conf.py | Python | apache-2.0 | 7,531 |
# Copyright (c) OpenMMLab. All rights reserved.
import pytest
import torch
from mmdet.models.backbones import RegNet
regnet_test_data = [
('regnetx_400mf',
dict(w0=24, wa=24.48, wm=2.54, group_w=16, depth=22,
bot_mul=1.0), [32, 64, 160, 384]),
('regnetx_800mf',
dict(w0=56, wa=35.73, wm=2.2... | open-mmlab/mmdetection | tests/test_models/test_backbones/test_regnet.py | Python | apache-2.0 | 2,177 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 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.apach... | cloudbau/glance | glance/db/sqlalchemy/migrate_repo/versions/013_add_protected.py | Python | apache-2.0 | 1,112 |
# 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 writ... | esikachev/scenario | sahara/plugins/vanilla/plugin.py | Python | apache-2.0 | 3,123 |
import matplotlib.pyplot as plt
class Plot:
def save(self, destination_filename="plotted.png", width=10, height=10, local_dpi=100):
fig = plt.gcf()
fig.set_size_inches(width, height)
plt.savefig(destination_filename, dpi=local_dpi)
def plot(self, xlist, ylist, marker_style='circle', def_color="r", def_alpha=... | mnmnc/campephilus | modules/plotter/plot.py | Python | apache-2.0 | 2,808 |
# 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... | tensorflow/fairness-indicators | tensorboard_plugin/setup.py | Python | apache-2.0 | 3,820 |
#
# Copyright (c) 2016 nexB Inc. and others. All rights reserved.
# http://nexb.com and https://github.com/nexB/scancode-toolkit/
# The ScanCode software is licensed under the Apache License version 2.0.
# Data generated with ScanCode require an acknowledgment.
# ScanCode is a trademark of nexB Inc.
#
# You may not use... | yashdsaraf/scancode-toolkit | tests/scancode/test_interrupt.py | Python | apache-2.0 | 2,755 |
from __future__ import absolute_import
__author__ = 'ross'
import os
import unittest
from pychron.core.test_helpers import isotope_db_factory, massspec_db_factory, get_data_dir as mget_data_dir
from pychron.entry.export.mass_spec_irradiation_exporter import MassSpecIrradiationExporter, \
generate_production_ratios... | UManPychron/pychron | pychron/entry/tests/massspec_irrad_export.py | Python | apache-2.0 | 5,554 |
#
# 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... | airbnb/airflow | airflow/cli/commands/pool_command.py | Python | apache-2.0 | 4,183 |