code stringlengths 6 947k | repo_name stringlengths 5 100 | path stringlengths 4 226 | language stringclasses 1
value | license stringclasses 15
values | size int64 6 947k |
|---|---|---|---|---|---|
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# File: CAM-resnet.py
import cv2
import sys
import argparse
import numpy as np
import os
import multiprocessing
import tensorflow as tf
from tensorpack import *
from tensorpack.dataflow import dataset
from tensorpack.tfutils import optimizer, gradproc
from tensorpack.tfu... | eyaler/tensorpack | examples/Saliency/CAM-resnet.py | Python | apache-2.0 | 5,641 |
# coding=utf-8
# Copyright 2018 The DisentanglementLib 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
#
# Un... | google-research/disentanglement_lib | disentanglement_lib/evaluation/abstract_reasoning/relational_layers_test.py | Python | apache-2.0 | 4,868 |
#
# Copyright 2013 Red Hat, 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... | oVirt/ovirt-scheduler-proxy | src/ovirtscheduler/runner.py | Python | apache-2.0 | 2,775 |
__author__ = 'Chao'
import numpy as np
from sklearn import svm, cross_validation
from sklearn.ensemble import RandomForestClassifier
from sklearn.neighbors import KNeighborsClassifier
activity_label = {'1': 'WALKING',
'2': 'WALKING_UPSTAIRS',
'3': 'WALKING_DOWNSTAIRS',
... | Sapphirine/Human-Activity-Monitoring-and-Prediction | analysis.py | Python | apache-2.0 | 6,718 |
#!/usr/bin/env python
#
# Copyright 2020 Espressif Systems (Shanghai) PTE 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 req... | espressif/esp-idf | tools/test_apps/build_system/ldgen_test/check_placements.py | Python | apache-2.0 | 2,847 |
"""
Define a set of scopes to be used by COS Internal OAuth implementation, specifically tailored to work with APIv2.
List of scopes, nomenclature, and rationale can be found in the relevant "Login as OSF- phase 2" proposal document
"""
from collections import namedtuple
from website import settings
# Public scopes... | pattisdr/osf.io | framework/auth/oauth_scopes.py | Python | apache-2.0 | 18,447 |
# Copyright (c) 2018 PaddlePaddle 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 app... | pkuyym/Paddle | python/paddle/fluid/tests/book/test_label_semantic_roles.py | Python | apache-2.0 | 12,571 |
# 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... | pypa/warehouse | warehouse/integrations/github/tasks.py | Python | apache-2.0 | 862 |
import pytest
@pytest.mark.parametrize(
"method,path",
[
('get_html', '/'),
('get_html', '/parameters/GB020'),
('get_json', '/parameters/GB020.geojson'),
('get_json', '/parameters/GB020.geojson?domainelement=GB020-1'),
('get_html', '/languages/nene1249'),
('get_... | clld/grambank | tests/test_functional.py | Python | apache-2.0 | 635 |
"""MySensors platform that offers a Climate (MySensors-HVAC) component."""
from homeassistant.components import mysensors
from homeassistant.components.climate import ClimateDevice
from homeassistant.components.climate.const import (
ATTR_TARGET_TEMP_HIGH, ATTR_TARGET_TEMP_LOW, DOMAIN, HVAC_MODE_AUTO,
HVAC_MODE... | jabesq/home-assistant | homeassistant/components/mysensors/climate.py | Python | apache-2.0 | 6,774 |
# -*- 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
... | brandsoulmates/incubator-airflow | airflow/operators/S3_to_FS.py | Python | apache-2.0 | 1,792 |
import logging
from concurrent.futures import CancelledError
import asyncio
from aiohttp import web
from aioredis import create_redis
from etc.ice_fetcher import get_current_song
from config.settings import STREAM_HOST, STREAM_PORT
server_logger = logging.getLogger('aiohttp.server')
async def push_current_track(r... | wolendranh/movie_radio | radio/views/track_info_sse.py | Python | apache-2.0 | 2,957 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.5 on 2017-10-04 21:23
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [("peering", "0003_auto_20170903_1235")]
operations = [
migrations.AlterField(
model_name="autonomoussystem",
... | respawner/peering-manager | peering/migrations/0004_auto_20171004_2323.py | Python | apache-2.0 | 1,014 |
# -*- coding: utf-8 -*-
from subprocess import check_call
def test_shellstreaming_help():
check_call(["shellstreaming", "--help"])
| laysakura/shellstreaming | test/master/test_master_functional.py | Python | apache-2.0 | 139 |
# 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... | girving/tensorflow | tensorflow/python/ops/ctc_ops.py | Python | apache-2.0 | 13,730 |
"""Fake Wings component"""
from threading import Thread
import time
# Use fake GPIO
import GPIOSim.RPi.in_mem as GPIO
from tuxeatpi.components.wings import Wings
from tuxeatpi.fake_components.base import push_switch
class FakeWings(Wings):
"""Fake wings class"""
def __init__(self, pins, event_queue, logge... | TuxEatPi/tuxeatpi | tuxeatpi/fake_components/wings.py | Python | apache-2.0 | 2,035 |
import standard_play
import play
import behavior
import robocup
import tactics.line_up
import tactics.defense
import main
class DefendPenalty(play.Play):
def __init__(self):
super().__init__(continuous=True)
self.add_transition(behavior.Behavior.State.start,
behavior.B... | JNeiger/robocup-software | soccer/gameplay/plays/restarts/defend_penalty.py | Python | apache-2.0 | 863 |
import numpy as np
from typing import Any, List, Tuple
from ray.rllib.models.torch.misc import Reshape
from ray.rllib.models.torch.torch_modelv2 import TorchModelV2
from ray.rllib.utils.framework import try_import_torch
from ray.rllib.utils.framework import TensorType
torch, nn = try_import_torch()
if torch:
from ... | pcmoritz/ray-1 | rllib/agents/dreamer/dreamer_model.py | Python | apache-2.0 | 19,097 |
# coding=utf-8
#
# Copyright 2017 F5 Networks 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 a... | F5Networks/f5-common-python | f5/bigip/tm/asm/policies/login_enforcement.py | Python | apache-2.0 | 1,423 |
"""
============================
Base RPC Handler for Tornado
============================
This is a basic server implementation, designed for use within the
Tornado framework. The classes in this library should not be used
directly, but rather though the XML or JSON RPC implementations.
You can use the utility functio... | UniPiTechnology/evok | tornadorpc_evok/base.py | Python | apache-2.0 | 13,270 |
# Python
import pytest
import mock
from dateutil.parser import parse
from dateutil.relativedelta import relativedelta
from crum import impersonate
import datetime
# Django rest framework
from rest_framework.exceptions import PermissionDenied
from django.utils import timezone
# AWX
from awx.api.versioning import rever... | wwitzel3/awx | awx/main/tests/functional/api/test_job.py | Python | apache-2.0 | 9,725 |
from flask import Flask
app = Flask('keyhub')
| ttycl/keyhub | keyhub/wsgi.py | Python | apache-2.0 | 46 |
# coding=utf-8
# Copyright 2014 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import (absolute_import, division, generators, nested_scopes, print_function,
unicode_literals, with_statement)
import os
from colle... | slyphon/pants | tests/python/pants_test/backend/jvm/tasks/test_jvm_dependency_usage.py | Python | apache-2.0 | 4,527 |
# -*- 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-datacatalog | samples/generated_samples/datacatalog_v1_generated_policy_tag_manager_list_policy_tags_sync.py | Python | apache-2.0 | 1,525 |
""" Cisco_IOS_XR_tunnel_l2tun_oper
This module contains a collection of YANG definitions
for Cisco IOS\-XR tunnel\-l2tun package operational data.
This module contains definitions
for the following management objects\:
l2tp\: L2TP operational data
l2tpv2\: l2tpv2
Copyright (c) 2013\-2016 by Cisco Systems, Inc.
... | 111pontes/ydk-py | cisco-ios-xr/ydk/models/cisco_ios_xr/Cisco_IOS_XR_tunnel_l2tun_oper.py | Python | apache-2.0 | 488,131 |
# -*- 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,2016 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... | guillaume-philippon/aquilon | lib/aquilon/worker/commands/update_machine.py | Python | apache-2.0 | 16,386 |
#!/usr/bin/python
#coding: utf-8
#auth: asher
#date: 20171027
#purpose: get usefulinfo from jsonfile
import ConfigParser
import time
import datetime
import requests
import fileinput
import sys
import os
import codecs
import json
import getWarranty
reload(sys)
sys.setdefaultencoding( "utf-8" )
def getConfig():
"... | lichengshuang/createvhost | python/asher/getcmdbinfo/bin/getcmdbinfo.py | Python | apache-2.0 | 5,242 |
# Copyright 2021 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import annotations
from typing import DefaultDict, Sequence
from unittest import mock
import pytest
from pants.engine.fs import EMPTY_DIGEST
from pants.jvm.resolve.commo... | pantsbuild/pants | src/python/pants/jvm/resolve/coursier_fetch_filter_test.py | Python | apache-2.0 | 2,986 |
# Copyright 2008 German Aerospace Center (DLR)
#
# 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 agre... | antont/tundra | src/Application/PythonScriptModule/pymodules_old/lib/webdav/acp/__init__.py | Python | apache-2.0 | 829 |
import pygame
import time
import scripts
"""
Score class
Handles all the score area
package: ianna
"""
class IannaScore():
def __init__ (self, buffer, screen, game_entities):
self.score_image = pygame.image.load('artwork/marcador.png').convert()
self.font = pygame.image.load('artwork/font.png').convert()
... | fjpena/sword-of-ianna-zx | python_src/ianna_score.py | Python | apache-2.0 | 6,072 |
# -*- coding: utf-8 -*-
# Copyright 2012 Yoshihisa Tanaka
#
# 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 ... | yosisa/pyfluent | setup.py | Python | apache-2.0 | 1,712 |
# -*- coding: utf-8 -*-
#!/usr/bin/env python
#
# Copyright 2015-2021 BigML
#
# 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... | bigmlcom/bigmler | bigmler/tests/test_06_missing_splits.py | Python | apache-2.0 | 5,076 |
from django.contrib import admin
# Register your models here.
from learning_logs.models import Topic, Entry
admin.site.register(Topic)
admin.site.register(Entry)
| wsqhubapp/learning_log | learning_logs/admin.py | Python | apache-2.0 | 163 |
# (c) Copyright 2008-2015 Synapse Wireless, Inc.
"""System Info IDs - used in 'getInfo()' and 'getStat()' calls"""
# Types
SI_TYPE_VENDOR = 0
SI_TYPE_RADIO = 1
SI_TYPE_CPU = 2
SI_TYPE_PLATFORM = 3
SI_TYPE_BUILD = 4
SI_TYPE_VERSION_MAJOR = ... | synapse-wireless/bulk-reprogramming | snappyImages/synapse/sysInfo.py | Python | apache-2.0 | 4,335 |
import sys
if sys.version_info >= (3, 8):
from functools import singledispatchmethod
else:
from functools import singledispatch, update_wrapper
def singledispatchmethod(func):
dispatcher = singledispatch(func)
def wrapper(*args, **kw):
return dispatcher.dispatch(args[1].__clas... | adamcharnock/lightbus | lightbus/utilities/singledispatch.py | Python | apache-2.0 | 447 |
class DestinationNotFoundException(Exception):
pass
class InvalidDateFormat(Exception):
pass | kapucko/bus-train-search | btsearch/exceptions.py | Python | apache-2.0 | 101 |
# Copyright 2021 DeepMind Technologies Limited. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by ... | deepmind/distrax | distrax/_src/distributions/mvn_from_bijector_test.py | Python | apache-2.0 | 12,417 |
import base64
import os
import re
import bpy
import gpu
LAMP_TYPES = [
gpu.GPU_DYNAMIC_LAMP_DYNVEC,
gpu.GPU_DYNAMIC_LAMP_DYNCO,
gpu.GPU_DYNAMIC_LAMP_DYNIMAT,
gpu.GPU_DYNAMIC_LAMP_DYNPERSMAT,
gpu.GPU_DYNAMIC_LAMP_DYNENERGY,
gpu.GPU_DYNAMIC_LAMP_DYNENERGY,
gpu.GPU_DYNAMIC_LAMP_DYNCOL,
gp... | Kupoman/blendergltf | blendergltf/extension_exporters/khr_technique_webgl.py | Python | apache-2.0 | 14,656 |
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "ownmusicweb.settings")
try:
from django.core.management import execute_from_command_line
except ImportError:
# The above import may fail for some other reason. Ensure that ... | Lightshadow244/OwnMusicWeb | ownmusicweb/manage.py | Python | apache-2.0 | 809 |
# Copyright 2021 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, sof... | google-research/long-range-arena | lra_benchmarks/models/longformer/longformer.py | Python | apache-2.0 | 13,102 |
# 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/improv_rnn/improv_rnn_create_dataset.py | Python | apache-2.0 | 2,205 |
from tests.approvals_config import configure_approvaltests
import pytest
# begin-snippet: conftest_pytest_session_scoped
@pytest.fixture(scope="session", autouse=True)
def set_default_reporter_for_all_tests():
configure_approvaltests()
# end-snippet
| approvals/ApprovalTests.Python | tests/conftest.py | Python | apache-2.0 | 258 |
# Copyright 2016 Adler Brediks Medrado
#
# 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... | adlermedrado/abbr | setup.py | Python | apache-2.0 | 1,346 |
from bzt.modules.functional import FunctionalAggregator, FunctionalAggregatorListener, FunctionalSample
from tests import BZTestCase
from tests.mocks import MockFunctionalReader
class MockListener(FunctionalAggregatorListener):
def __init__(self):
self.results = []
def aggregated_results(self, resul... | itaymendel/taurus | tests/modules/test_functionalAggregator.py | Python | apache-2.0 | 3,428 |
# Copyright 2015 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
import logging
import os
import sys
import threading
from contextlib import contextmanager
from dataclasses import dataclass
from setproctitle import setproctitle as set_process_title
fr... | wisechengyi/pants | src/python/pants/pantsd/pants_daemon.py | Python | apache-2.0 | 22,406 |
#-----------------------------------------------------------------------------------------------------------------------
#Introdução a Programação de Computadores - IPC
#Universidade do Estado do Amazonas - UEA
#Prof. Jucimar Jr.
#Alexandre Marques Uchôa 1715310028
#Jandinne Duarte de Oliveira 1... | jucimarjr/IPC_2017-1 | lista02/lista02_exercicio01_questao06.py | Python | apache-2.0 | 781 |
# coding: utf-8
"""
Stakeholder engagement API
This API enables Intelligent Engagement for your Business. iEngage is a platform that combines process, augmented intelligence and rewards to help you intelligently engage customers.
OpenAPI spec version: 1.0
Generated by: https://github.com/swagger... | iEngage/python-sdk | iengage_client/models/nlc.py | Python | apache-2.0 | 5,546 |
# -*- coding: utf-8 -*-
__author__ = 'tyler'
import urllib2
import scrapy
from scrapy import log
import demjson
'''class AutoSpider(scrapy.Spider):
name = "sse"
allowed_domains = ["query.sse.com.cn"]
preurl='http://data.eastmoney.com/stock';
start_urls = [
'http://query.sse.com.cn/i... | dingmingliu/quanttrade | quantspider/quantspider/spiders/sse_spider.py | Python | apache-2.0 | 3,630 |
# 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 a... | schwehr/gdal-autotest2 | python/alg/tps_test.py | Python | apache-2.0 | 3,423 |
import datetime
import six
try:
from django.contrib.sites.requests import RequestSite
except ImportError: # Django < 1.9
from django.contrib.sites.models import RequestSite
from django.core.exceptions import ObjectDoesNotExist
from django.core.serializers.json import DjangoJSONEncoder
from django.forms.model... | drax68/graphite-web | webapp/graphite/events/views.py | Python | apache-2.0 | 5,333 |
import datetime
import os
import subprocess
import sys
import warnings
from typing import Optional, Union
import click
from ruamel.yaml import YAML
from ruamel.yaml.compat import StringIO
from great_expectations import exceptions as ge_exceptions
from great_expectations.checkpoint import Checkpoint, LegacyCheckpoint
... | great-expectations/great_expectations | great_expectations/cli/v012/toolkit.py | Python | apache-2.0 | 22,960 |
#! /usr/bin/python
# -*- coding: utf8 -*-
import tensorflow as tf
import os
from sys import platform as _platform
import collections
import random
import numpy as np
import warnings
from six.moves import xrange
from tensorflow.python.platform import gfile
import re
## Iteration functions
def generate_skip_gram_bat... | arcyfelix/ML-DL-AI | Supervised Learning/GANs/dcgan-tensorflayer/tensorlayer/nlp.py | Python | apache-2.0 | 32,641 |
import sys
import os
sys.path.append(os.path.join(os.path.dirname(__file__), '..'))
import logging.config
from flask import Flask, Blueprint
from werkzeug.contrib.fixers import ProxyFix
from ceep_api import settings
from ceep_api.api import restplus
from ceep_api.api.endpoints.adbmonitors import ns as adbmonitors_n... | seraph115/ceep_api | ceep_api/run.py | Python | apache-2.0 | 1,398 |
#------------------------------------------------------------------------------
# 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_geonames_tools/TestUtilities.py | Python | apache-2.0 | 1,403 |
from __future__ import print_function
from __future__ import division
from django.core.management.base import BaseCommand
from query.models import Video, Face, LabelSet, Frame
from scannerpy import ProtobufGenerator, Config
import os
import cv2
import math
import numpy as np
import tensorflow as tf
import align.detect_... | MattPerron/esper | esper/query/management/commands/score.py | Python | apache-2.0 | 14,310 |
resource_id = "celery-1"
_install_script = """
[ { "id": "celery-1",
"key": {"name": "Celery", "version": "2.3"},
"config_port": {
"password": "engage_129",
"username": "engage_celery",
"vhost": "engage_celery_vhost"
},
"input_ports": {
"broker": {
"BROKER_HOST": "${hos... | quaddra/engage | python_pkg/engage/drivers/genforma/drivertest_celery.py | Python | apache-2.0 | 2,355 |
# 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, s... | googleapis/python-bigquery | google/cloud/bigquery/iam.py | Python | apache-2.0 | 1,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 us... | iemejia/incubator-beam | sdks/python/apache_beam/runners/direct/consumer_tracking_pipeline_visitor_test.py | Python | apache-2.0 | 5,990 |
# -*- 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-dialogflow | samples/generated_samples/dialogflow_generated_dialogflow_v2_entity_types_batch_create_entities_async.py | Python | apache-2.0 | 1,788 |
from . elasticfactor import ElasticFactor
from ... environment import cfg
from elasticsearch import Elasticsearch
def run(node):
id_a, id_b = node.get('id_a', '63166071_1'), node.get('id_b', '63166071_2')
es = Elasticsearch()
data_a = es.get(index="factor_state2016", doc_type='factor_network', id=i... | qadium-memex/linkalytics | linkalytics/factor/constructor/merge.py | Python | apache-2.0 | 603 |
import unittest
import copy
import gc
import rpy2.rinterface as rinterface
rinterface.initr()
class SexpTestCase(unittest.TestCase):
def testNew_invalid(self):
x = "a"
self.assertRaises(ValueError, rinterface.Sexp, x)
def testNew(self):
sexp = rinterface.baseenv.get("letters")
... | lbouma/Cyclopath | pyserver/bin/rpy2/rinterface/tests/test_Sexp.py | Python | apache-2.0 | 4,549 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.6 on 2016-08-17 00:40
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('turnos', '0004_auto_20160519_0134'),
]
operations = [
migrations.RenameField('Turno'... | mava-ar/sgk | src/turnos/migrations/0005_auto_20160816_2140.py | Python | apache-2.0 | 415 |
__author__ = 'LiGe'
#encoding:utf-8
import networkx as nx
import matplotlib.pyplot as plot
from file_to_graph import file_to_mat
def build_graph(mat):
G=nx.DiGraph()#创建空图
for i in range(0,mat.shape[0]):
G.add_node(i)#创造节点
for i in range(0,mat.shape[0]):
for j in range(0,mat.shape... | yanshengli/DBN_Learning | 基于复杂语言网络的文本二分类/select_feature.py | Python | apache-2.0 | 1,297 |
import os
import re
import cmd
import sys
import time
import util
host = sys.argv[1]
cmd.run ("virsh shutdown %s"%(host))
while util.vm_is_running(host):
time.sleep(1)
| alobbs/qvm | qvm/qvm-stop.py | Python | apache-2.0 | 171 |
#!/usr/bin/env python
# Copyright (c) 2016 Lyft 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... | lyft/bandit-high-entropy-string | setup.py | Python | apache-2.0 | 680 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Method Manager
Provide the end user interface for method (geophysical) dependent
modelling and inversion as well as data and model visualization.
"""
import numpy as np
import pygimli as pg
from pygimli.utils import prettyFloat as pf
def fit(funct, data, err=None, ... | gimli-org/gimli | pygimli/frameworks/methodManager.py | Python | apache-2.0 | 29,010 |
#!/usr/bin/env python
#-*- coding: UTF-8 -*-
#Ticloud web version 2.0
#author:WangRui
import ConfigParser
import logging
class ConfigManager(object):
_config_dict = None
@staticmethod
def create(filename):
parse_file = ParseIniFile(filename)
parse_file.init()
parse_file.getvalue... | liugangabc/ccs_web | common/configmanager.py | Python | apache-2.0 | 4,155 |
class Error(Exception):
def __init__(self, msg):
self.msg = msg
| mattaw/SoCFoundationFlow | admin/waf/waf-extensions/SFFerrors.py | Python | apache-2.0 | 77 |
###################################################################################################
#
# query_string_parser.py
# Extracts the query string from a URL and prints each parameter and value.
#
# Plugin Author: Your Name Here (ryan@obsidianforensics.com)
#
##################################################... | obsidianforensics/hindsight | pyhindsight/plugins/query_string_parser.py | Python | apache-2.0 | 2,196 |
from django.db.models import Q
from links.models import Post
from comments.models import ThreadedComment as comments
from django.utils import timezone
from datetime import datetime, timedelta
from django.contrib import messages
KARMA_LOW = 100
KARMA_MEDIUM = 1000
KARMA_HIGH = 5000
INTERVAL_LOW = 3600
INTERVAL_MEDIUM... | sheshkovsky/jaryan | links/utils.py | Python | apache-2.0 | 1,792 |
from core.serializers import ProjectSerializer
from rest_framework import generics
from core.models import Project
class ProjectList(generics.ListCreateAPIView):
queryset = Project.objects.all()
serializer_class = ProjectSerializer
class ProjectDetail(generics.RetrieveUpdateDestroyAPIView):
queryset = Pro... | wathsalav/xos | xos/core/views/projects.py | Python | apache-2.0 | 382 |
"""This contains the unit tests for treadmill.utils.
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import io
import os
import shutil
import signal
import stat
import tempfile
import time
import unittest
# Disab... | captiosus/treadmill | tests/utils_test.py | Python | apache-2.0 | 12,668 |
'''
Created on 15.02.2015
@author: diesel
'''
import datetime
from indexdata import IndexData, IndexHistory
import indexdatabase
def _selectTrue( idxData ):
return True
class FetchData():
'''
classdocs
'''
def __init__(self, indexName):
'''
Constructor
'''
self... | selentd/pythontools | pytools/src/IndexEval/fetchdata.py | Python | apache-2.0 | 5,671 |
import sys, argparse
class MyParser(argparse.ArgumentParser):
def error(self, message):
'''Wraps error and prints in a shorter way'''
sys.stderr.write('error: %s\n' % message)
#self.print_help()
sys.exit(2)
| viliusl/dockery | objects/myparser.py | Python | apache-2.0 | 246 |
# coding=utf-8
# Copyright 2020 The HuggingFace Team. 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 requir... | huggingface/transformers | tests/mobilebert/test_modeling_mobilebert.py | Python | apache-2.0 | 15,383 |
#!/usr/bin/python
# -*- coding:utf-8 -*-
from setuptools import setup
setup(
name='Earo',
version='0.1.0',
url='https://github.com/Everley1993/Laky-Earo',
license='Apache',
author='Everley',
author_email='463785757@qq.com',
description='A microframework based on EDA for business logic devel... | Everley1993/Laky-Earo | setup.py | Python | apache-2.0 | 608 |
#
# Copyright (c) 2015 Juniper Networks, Inc. All rights reserved.
#
from gevent import monkey
monkey.patch_all()
from pysandesh.sandesh_base import sandesh_global
from sandesh_common.vns.ttypes import Module
from nodemgr.common.event_manager import EventManager, EventManagerTypeInfo
class ConfigEventManager(EventM... | eonpatapon/contrail-controller | src/nodemgr/config_nodemgr/event_manager.py | Python | apache-2.0 | 616 |
# -*- encoding: utf-8 -*-
"""
h2o -- module for using H2O services.
:copyright: (c) 2016 H2O.ai
:license: Apache License Version 2.0 (see LICENSE for details)
"""
from __future__ import absolute_import, division, print_function, unicode_literals
import logging
import os
import warnings
import webbrowser
import type... | h2oai/h2o-dev | h2o-py/h2o/h2o.py | Python | apache-2.0 | 72,871 |
import json
import re
import subprocess
from django.conf import settings
default_app_config = "peering.apps.PeeringConfig"
def call_irr_as_set_resolver(irr_as_set, address_family=6):
"""
Call a subprocess to expand the given AS-SET for an IP version.
"""
prefixes = []
if not irr_as_set:
... | respawner/peering-manager | peering/__init__.py | Python | apache-2.0 | 2,416 |
class Solution(object):
def constructRectangle(self, area):
"""
:type area: int
:rtype: List[int]
"""
ans = None
W = 1
while W * W <= area:
if area % W == 0:
ans = [area / W, W]
W += 1
return ans
| ckclark/leetcode | py/construct-the-rectangle.py | Python | apache-2.0 | 304 |
# coding: utf-8
"""
Wavefront REST API
<p>The Wavefront REST API enables you to interact with Wavefront servers using standard REST API tools. You can use the REST API to automate commonly executed operations such as automatically tagging sources.</p><p>When you make REST API calls outside the Wavefront REST ... | wavefrontHQ/python-client | test/test_source_api.py | Python | apache-2.0 | 2,945 |
#
# Copyright (c) 2001 - 2015 The SCons Foundation
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, merge... | kayhayen/Nuitka | nuitka/build/inline_copy/lib/scons-2.3.2/SCons/Tool/MSCommon/vc.py | Python | apache-2.0 | 19,499 |
from flask import render_template, flash, request, redirect, url_for
from flask_login import login_required
from kernel import agileCalendar
from kernel.DataBoard import Data
from kernel.NM_Aggregates import WorkBacklog, DevBacklog, RiskBacklog
from kconfig import coordinationBookByName
from . import coordination
__a... | flopezag/fiware-backlog | app/coordination/views.py | Python | apache-2.0 | 6,105 |
# Copyright 2018 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 required by applicable ... | prasanna08/oppia | core/controllers/custom_landing_pages_test.py | Python | apache-2.0 | 3,649 |
import pytest
from tests.functional.services.api.images import (
add_image,
delete_image_by_id,
get_image_id,
wait_for_image_to_analyze,
)
from tests.functional.services.utils.http_utils import get_api_conf
@pytest.fixture(scope="package")
def add_image_with_teardown_package_scope(request):
def _... | anchore/anchore-engine | tests/functional/conftest.py | Python | apache-2.0 | 696 |
# 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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | google/clusterfuzz | src/appengine/handlers/performance_report/constants.py | Python | apache-2.0 | 5,306 |
# Copyright (C) 2012 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... | samrussell/ryu | ryu/lib/packet/icmp.py | Python | apache-2.0 | 8,213 |
# 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 may not use this file ex... | sanjeevtripurari/hue | desktop/core/src/desktop/lib/metrics/file_reporter.py | Python | apache-2.0 | 2,100 |
#!/usr/bin/env python
# LatitudePlot.py
# Created 30 July 2013
# Created by snowdonjames@googlemail.com
import os, time, math
from datetime import datetime
from time import mktime
import xml.etree.ElementTree as ET
from PIL import Image, ImageDraw
def GetKmlFiles():
"""Locates and reads local .kml files, returns... | TheR3ason/map-your-location-history | LatitudePlot.py | Python | apache-2.0 | 4,022 |
from mongoengine import Document, StringField, DateTimeField, ListField, DateTimeField, IntField, BooleanField, \
ObjectIdField, FloatField
class Covelement(Document):
instructionsCov = IntField()
instructionsMis = IntField()
branchesCov = IntField()
branchesMis = IntField()
lineCov = IntField(... | ftrautsch/testEvolution | resultprocessor/coveragemodels.py | Python | apache-2.0 | 1,211 |
#!/usr/bin/env python
"""GRR restful API rendering plugins."""
# pylint: disable=unused-import
from grr.gui.api_plugins import aff4
from grr.gui.api_plugins import artifact
from grr.gui.api_plugins import config
from grr.gui.api_plugins import docs
from grr.gui.api_plugins import hunt
from grr.gui.api_plugins import r... | wandec/grr | gui/api_plugins/__init__.py | Python | apache-2.0 | 368 |
from sklearn import datasets
from sklearn.linear_model import LinearRegression
import matplotlib.pyplot as plt
loaded_data = datasets.load_boston()
data_X = loaded_data.data
data_y = loaded_data.target
model = LinearRegression()
model.fit(data_X, data_y)
print(model.predict(data_X[:4,:]))
print(data_y[:4])
print(mo... | shunliz/test | python/scikit/linear.py | Python | apache-2.0 | 505 |
"""
Application level configuration and logging
"""
import os
import global_settings
import sys
from logging.config import dictConfig
from importlib import import_module
import logging
log = logging.getLogger(__name__)
class Settings(object):
"""
Configuration class for percept
"""
settings_list = No... | VikParuchuri/percept | percept/conf/base.py | Python | apache-2.0 | 3,688 |
"""Test icatdump and icatingest.
"""
from subprocess import CalledProcessError
import pytest
import icat
import icat.config
from icat.query import Query
from conftest import DummyDatafile, gettestdata, getConfig, callscript
# Test input
ds_params = str(gettestdata("ingest-ds-params.xml"))
datafiles = str(gettestdata... | icatproject/python-icat | tests/test_06_ingest.py | Python | apache-2.0 | 11,631 |
# 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... | karllessard/tensorflow | tensorflow/python/kernel_tests/lookup_ops_test.py | Python | apache-2.0 | 145,826 |
"""Support for Abode Security System cameras."""
from datetime import timedelta
import logging
import requests
from homeassistant.components.camera import Camera
from homeassistant.util import Throttle
from . import DOMAIN as ABODE_DOMAIN, AbodeDevice
DEPENDENCIES = ['abode']
MIN_TIME_BETWEEN_UPDATES = timedelta(s... | jamespcole/home-assistant | homeassistant/components/abode/camera.py | Python | apache-2.0 | 2,683 |
# -*- coding: utf-8 -*-
#
# Nefertari documentation build configuration file, created by
# sphinx-quickstart on Fri Mar 27 11:16:31 2015.
#
# 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
# autogenerated file.
#
#... | ziad-saab/ramses | docs/source/conf.py | Python | apache-2.0 | 9,733 |
# -*- coding: utf-8 -*-
# File: model_box.py
import numpy as np
from collections import namedtuple
import tensorflow as tf
from tensorpack.tfutils.scope_utils import under_name_scope
from config import config
@under_name_scope()
def clip_boxes(boxes, window, name=None):
"""
Args:
boxes: nx4, xyxy
... | eyaler/tensorpack | examples/FasterRCNN/model_box.py | Python | apache-2.0 | 7,519 |
'''
This module is to create model of Course
'''
from openerp import api, fields, models, _
class Course(models.Model):
'''
This class create model of Course
'''
_name = 'openacademy.course' # Model odoo name
name = fields.Char(string='Title', required=True) # Field reserved
description =... | glizek/openacademy-project | openacademy/model/openacademy_course.py | Python | apache-2.0 | 1,587 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
from django.utils.timezone import utc
import datetime
class Migration(migrations.Migration):
dependencies = [
('feed', '0003_auto_20141227_2343'),
]
operations = [
migrations.AddFiel... | mseln/klufweb | klufweb/feed/migrations/0004_auto_20141229_1211.py | Python | apache-2.0 | 1,090 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.